500d796573
Component Workers: - Deploys if_control, switch, filter, merge, try_catch, wait, set, array_ops, string_ops, number_ops, date_ops, validate_json, ai_transform_compile, ai_transform_run, foreach_control as independent Workers, backing cypher-executor's SVC_* service bindings (fast internal RPC for logic components). cypher-executor routing: - New routes: /auth (recipe resolution), /credentials (CRUD), /webhooks/named (user-friendly alias for cmp_/rec_ hashes). - auth-recipe-seeds.ts: 20 pre-built platform auth recipes (Google Sheets, Gmail, Telegram, etc.) seeded into RECIPES KV. - graph-executor + cypher-handlers + search-nodes updated for the new resolution chain. - scripts/seed-auth-recipes.ts: one-shot tool to push seeds to KV. - wrangler.toml: 15 SVC_* bindings wired to the new logic Workers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
/**
|
|
* seed-auth-recipes.ts
|
|
*
|
|
* 將 auth-recipe-seeds.ts 中定義的 20 個 auth recipe 上傳至 cypher.arcrun.dev。
|
|
*
|
|
* 執行:
|
|
* npx tsx scripts/seed-auth-recipes.ts
|
|
*
|
|
* 環境變數:
|
|
* ARCRUN_API_URL - 預設 https://cypher.arcrun.dev
|
|
*/
|
|
|
|
import { AUTH_RECIPE_SEEDS } from '../src/lib/auth-recipe-seeds.js';
|
|
|
|
const BASE_URL = process.env.ARCRUN_API_URL ?? 'https://cypher.arcrun.dev';
|
|
|
|
async function main() {
|
|
console.log(`\n Seeding ${AUTH_RECIPE_SEEDS.length} auth recipes → ${BASE_URL}\n`);
|
|
|
|
let ok = 0;
|
|
let fail = 0;
|
|
|
|
for (const recipe of AUTH_RECIPE_SEEDS) {
|
|
process.stdout.write(` ${recipe.service.padEnd(24)} `);
|
|
|
|
try {
|
|
const res = await fetch(`${BASE_URL}/auth-recipes`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify(recipe),
|
|
});
|
|
|
|
if (res.ok) {
|
|
console.log(`✓`);
|
|
ok++;
|
|
} else {
|
|
const err = await res.text().catch(() => '');
|
|
console.log(`✗ HTTP ${res.status}: ${err.slice(0, 100)}`);
|
|
fail++;
|
|
}
|
|
} catch (e) {
|
|
console.log(`✗ ${e instanceof Error ? e.message : String(e)}`);
|
|
fail++;
|
|
}
|
|
}
|
|
|
|
console.log(`\n 完成:${ok} 成功,${fail} 失敗\n`);
|
|
if (fail > 0) process.exit(1);
|
|
}
|
|
|
|
main();
|