@dragonmastery/tamer 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +2 -1
  2. package/dist/{apply-BOABC3UB.mjs → apply-BjrYbyHn.mjs} +14 -16
  3. package/dist/{apply-BOABC3UB.mjs.map → apply-BjrYbyHn.mjs.map} +1 -1
  4. package/dist/{applyTarget-GWDEOXeY.mjs → applyTarget-Ce_mtRQX.mjs} +3 -3
  5. package/dist/{applyTarget-GWDEOXeY.mjs.map → applyTarget-Ce_mtRQX.mjs.map} +1 -1
  6. package/dist/{bootstrap-BxwxC_2Z.mjs → bootstrap-D__dHw1w.mjs} +6 -6
  7. package/dist/bootstrap-D__dHw1w.mjs.map +1 -0
  8. package/dist/{buildDispatchUploadForm-BoUB93b3.mjs → buildDispatchUploadForm-CVnPmHg4.mjs} +1 -1
  9. package/dist/{buildDispatchUploadForm-BoUB93b3.mjs.map → buildDispatchUploadForm-CVnPmHg4.mjs.map} +1 -1
  10. package/dist/{cloudflareSnapshot-DzPuCRTh.mjs → cloudflareSnapshot-C6cF8GG8.mjs} +5 -7
  11. package/dist/{cloudflareSnapshot-DzPuCRTh.mjs.map → cloudflareSnapshot-C6cF8GG8.mjs.map} +1 -1
  12. package/dist/{deploy-C0edCpn9.mjs → deploy-C6fX9td0.mjs} +23 -11
  13. package/dist/deploy-C6fX9td0.mjs.map +1 -0
  14. package/dist/{destroy-tenant-U0t7BeJ0.mjs → destroy-tenant-T_94ed9x.mjs} +2 -4
  15. package/dist/{destroy-tenant-U0t7BeJ0.mjs.map → destroy-tenant-T_94ed9x.mjs.map} +1 -1
  16. package/dist/{destroy-DzgA4lCA.mjs → destroy-vfk2Zbfj.mjs} +11 -13
  17. package/dist/{destroy-DzgA4lCA.mjs.map → destroy-vfk2Zbfj.mjs.map} +1 -1
  18. package/dist/{dev-CZbKfdFw.mjs → dev-BLthyLml.mjs} +8 -10
  19. package/dist/{dev-CZbKfdFw.mjs.map → dev-BLthyLml.mjs.map} +1 -1
  20. package/dist/{dns-records.resolve-C2T0m4NG.mjs → dns-records.resolve-8a_eHfVI.mjs} +1 -1
  21. package/dist/{dns-records.resolve-DwBR_1WI.mjs → dns-records.resolve-BB2agPAb.mjs} +1 -1
  22. package/dist/{dns-records.resolve-DwBR_1WI.mjs.map → dns-records.resolve-BB2agPAb.mjs.map} +1 -1
  23. package/dist/{dns-records.sync-Bpzz9H0s.mjs → dns-records.sync-DqYROe07.mjs} +3 -3
  24. package/dist/{dns-records.sync-Bpzz9H0s.mjs.map → dns-records.sync-DqYROe07.mjs.map} +1 -1
  25. package/dist/{doctor-C_hs7k2D.mjs → doctor-32YLAXXl.mjs} +2 -2
  26. package/dist/{doctor-C_hs7k2D.mjs.map → doctor-32YLAXXl.mjs.map} +1 -1
  27. package/dist/drift-BCxWdYHG.mjs +8 -0
  28. package/dist/{drift-B5bpkI0i.mjs → drift-CeemyFqL.mjs} +37 -9
  29. package/dist/drift-CeemyFqL.mjs.map +1 -0
  30. package/dist/{events-BIznt8Sj.mjs → events-otk0l3aJ.mjs} +2 -4
  31. package/dist/{events-BIznt8Sj.mjs.map → events-otk0l3aJ.mjs.map} +1 -1
  32. package/dist/{generator-Ba-vqyBG.mjs → generator-gvCy7ouY.mjs} +6 -5
  33. package/dist/generator-gvCy7ouY.mjs.map +1 -0
  34. package/dist/{import-B0dlwKoQ.mjs → import-OvohE-H2.mjs} +8 -8
  35. package/dist/import-OvohE-H2.mjs.map +1 -0
  36. package/dist/index.d.mts +314 -38
  37. package/dist/index.d.mts.map +1 -1
  38. package/dist/{logpush-job-DsRkOORJ.mjs → logpush-job-DJPlpnRu.mjs} +2 -2
  39. package/dist/{logpush-job-DsRkOORJ.mjs.map → logpush-job-DJPlpnRu.mjs.map} +1 -1
  40. package/dist/{migrate-BpW6JkIg.mjs → migrate-CroDjbJz.mjs} +6 -8
  41. package/dist/{migrate-BpW6JkIg.mjs.map → migrate-CroDjbJz.mjs.map} +1 -1
  42. package/dist/normalize-DVSTRZhO.mjs.map +1 -1
  43. package/dist/{plan-Do5rE-c5.mjs → plan-C2urqJOz.mjs} +39 -14
  44. package/dist/plan-C2urqJOz.mjs.map +1 -0
  45. package/dist/{planFormat-CJw8Kq2s.mjs → planFormat-5XMJK879.mjs} +1 -1
  46. package/dist/{planFormat-CJw8Kq2s.mjs.map → planFormat-5XMJK879.mjs.map} +1 -1
  47. package/dist/{provision-tenant-Wfck-2Oa.mjs → provision-tenant-BJ1KugON.mjs} +6 -8
  48. package/dist/{provision-tenant-Wfck-2Oa.mjs.map → provision-tenant-BJ1KugON.mjs.map} +1 -1
  49. package/dist/{r2S3EmptyBucket-DD81ZWQ7.mjs → r2S3EmptyBucket-B9_pHfvB.mjs} +1 -1
  50. package/dist/{r2S3EmptyBucket-DD81ZWQ7.mjs.map → r2S3EmptyBucket-B9_pHfvB.mjs.map} +1 -1
  51. package/dist/{fetchStackImports-C-1THPYL.mjs → registry-EWWdkLf7.mjs} +272 -1065
  52. package/dist/registry-EWWdkLf7.mjs.map +1 -0
  53. package/dist/secrets-CnzjvndT.mjs +3 -0
  54. package/dist/{stackOutputs-CQQHtdPA.mjs → stackOutputs-Cltzl2g0.mjs} +2 -2
  55. package/dist/{stackOutputs-CQQHtdPA.mjs.map → stackOutputs-Cltzl2g0.mjs.map} +1 -1
  56. package/dist/{status-D5GLpWyn.mjs → status-DkkS5lc9.mjs} +7 -9
  57. package/dist/{status-D5GLpWyn.mjs.map → status-DkkS5lc9.mjs.map} +1 -1
  58. package/dist/{sync-B_pyPi7Z.mjs → sync-CpfxqlOx.mjs} +7 -9
  59. package/dist/{sync-B_pyPi7Z.mjs.map → sync-CpfxqlOx.mjs.map} +1 -1
  60. package/dist/tamer.mjs +4428 -213
  61. package/dist/tamer.mjs.map +1 -1
  62. package/dist/{tamerArtifactsR2-Ccgplu2Q.mjs → tamerArtifactsR2-DnUJmxnO.mjs} +2 -2
  63. package/dist/{tamerArtifactsR2-Ccgplu2Q.mjs.map → tamerArtifactsR2-DnUJmxnO.mjs.map} +1 -1
  64. package/dist/{types-JrdlG7Dy.mjs → types-BzzHwIdw.mjs} +6 -8
  65. package/dist/{types-JrdlG7Dy.mjs.map → types-BzzHwIdw.mjs.map} +1 -1
  66. package/dist/{verifyPlanFile-ah_4tvTu.mjs → verifyPlanFile-BmEadIqm.mjs} +2 -2
  67. package/dist/{verifyPlanFile-ah_4tvTu.mjs.map → verifyPlanFile-BmEadIqm.mjs.map} +1 -1
  68. package/dist/{wfp-delete-BhuUrBUA.mjs → wfp-delete-CDBFqmrM.mjs} +2 -3
  69. package/dist/{wfp-delete-BhuUrBUA.mjs.map → wfp-delete-CDBFqmrM.mjs.map} +1 -1
  70. package/dist/{wfp-put-DL0mJNNz.mjs → wfp-put-BrwICc9i.mjs} +3 -4
  71. package/dist/{wfp-put-DL0mJNNz.mjs.map → wfp-put-BrwICc9i.mjs.map} +1 -1
  72. package/dist/{worker-route-CMbtozNa.mjs → worker-route-x8q3K4-z.mjs} +3 -4
  73. package/dist/{worker-route-CMbtozNa.mjs.map → worker-route-x8q3K4-z.mjs.map} +1 -1
  74. package/dist/{workers-C-oeZhdD.mjs → workers-D3Ekf3mF.mjs} +3 -4
  75. package/dist/{workers-C-oeZhdD.mjs.map → workers-D3Ekf3mF.mjs.map} +1 -1
  76. package/dist/{wranglerSpawn-DmEz0ldT.mjs → wranglerSpawn-CUlo2qOJ.mjs} +1 -1
  77. package/dist/{wranglerSpawn-DmEz0ldT.mjs.map → wranglerSpawn-CUlo2qOJ.mjs.map} +1 -1
  78. package/dist/{zoneResolver-VoxLHM4N.mjs → zoneResolver-DNNNmO_w.mjs} +1 -1
  79. package/dist/{zoneResolver-VoxLHM4N.mjs.map → zoneResolver-DNNNmO_w.mjs.map} +1 -1
  80. package/package.json +1 -1
  81. package/dist/CFApiClient-DhbyyV71.mjs +0 -868
  82. package/dist/CFApiClient-DhbyyV71.mjs.map +0 -1
  83. package/dist/StateManager-DTqtLLVX.mjs +0 -760
  84. package/dist/StateManager-DTqtLLVX.mjs.map +0 -1
  85. package/dist/bootstrap-BxwxC_2Z.mjs.map +0 -1
  86. package/dist/deploy-C0edCpn9.mjs.map +0 -1
  87. package/dist/drift-B5bpkI0i.mjs.map +0 -1
  88. package/dist/drift-BNa92AK5.mjs +0 -10
  89. package/dist/fetchStackImports-C-1THPYL.mjs.map +0 -1
  90. package/dist/generator-Ba-vqyBG.mjs.map +0 -1
  91. package/dist/import-B0dlwKoQ.mjs.map +0 -1
  92. package/dist/loader-DAvCKLTT.mjs +0 -518
  93. package/dist/loader-DAvCKLTT.mjs.map +0 -1
  94. package/dist/plan-Do5rE-c5.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-gvCy7ouY.mjs","names":["out: GeneratedSecretsStoreSecretBinding[]","config: WranglerConfig"],"sources":["../src/features/secrets-store/secrets-store.generate.ts","../src/core/wrangler/generator.ts"],"sourcesContent":["import type { NamingEngine } from \"../../core/naming/NamingEngine.js\";\nimport type {\n StateEntry,\n SecretsStoreResourceConfig,\n SecretsStoreSecretBinding,\n SecretsStoreStateEntry,\n} from \"../../types.js\";\nimport { secretsStoreDeriveName } from \"./secrets-store.naming.js\";\n\nexport interface SecretsStoreStateLike {\n get(key: string): StateEntry | undefined;\n getAll(): Record<string, StateEntry>;\n}\n\n/**\n * One row of wrangler's `secrets_store_secrets[]` array. Resolved from a\n * worker's declared `secretsStoreSecrets[]` by looking up the\n * Tamer-managed store's `store_id` in state. The named secret itself must\n * already exist inside the store (created out-of-band via wrangler\n * `secrets-store secret create`); Tamer never reads or writes secret\n * values.\n */\nexport interface GeneratedSecretsStoreSecretBinding {\n binding: string;\n store_id: string;\n secret_name: string;\n}\n\n/**\n * Resolve `secretsStoreSecrets[]` worker bindings into wrangler-shape\n * `secrets_store_secrets[]` entries by looking up the referenced\n * Tamer-managed store's `store_id` in state. Throws with an actionable\n * message if a referenced store has never been applied — the binding\n * would otherwise be deployed against a non-existent store.\n */\nexport function secretsStoreSecretsGenerate(\n bindings: SecretsStoreSecretBinding[],\n env: string,\n state: SecretsStoreStateLike,\n naming: NamingEngine,\n secretsStores?: SecretsStoreResourceConfig[],\n): GeneratedSecretsStoreSecretBinding[] {\n const out: GeneratedSecretsStoreSecretBinding[] = [];\n for (const b of bindings) {\n const storeConfig = secretsStores?.find((s) => s.logicalName === b.store);\n const derivedName = storeConfig\n ? secretsStoreDeriveName(storeConfig, env, naming)\n : naming.secretsStoreName(b.store, env);\n const entry = state.get(`secrets_store:${derivedName}`) as\n | SecretsStoreStateEntry\n | undefined;\n if (!entry || entry.type !== \"secrets_store\") {\n throw new Error(\n `Secrets Store binding \"${b.binding}\" references store \"${b.store}\" — ` +\n `not in state. Declare it under \\`resources.secretsStores\\` and run ` +\n `'tamer apply --env ${env}' first.`,\n );\n }\n out.push({\n binding: b.binding,\n store_id: entry.cfId,\n secret_name: b.secretName,\n });\n }\n return out;\n}\n","import { writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport type { WranglerConfig } from \"../../generated/wrangler-types.js\";\nimport type { ResolvedWorkerConfig } from \"../config/resolver.js\";\nimport type { StateManager } from \"../state/StateManager.js\";\nimport type { NamingEngine } from \"../naming/NamingEngine.js\";\nimport { resourceModules } from \"../registry/registry.js\";\nimport { secretsStoreSecretsGenerate } from \"../../features/secrets-store/secrets-store.generate.js\";\n\nexport class CfiError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CfiError\";\n }\n}\n\n/**\n * Build the worker's `wrangler.json` by asking every registered resource\n * module for its bindings fragment, then merging on top of the\n * passthrough config (`resolved.wranglerConfig`). Adding a new resource\n * kind requires zero edits here — register the module, done.\n */\nexport function generateWranglerConfig(\n resolved: ResolvedWorkerConfig,\n state: StateManager,\n naming: NamingEngine,\n): WranglerConfig {\n let config: WranglerConfig = {\n ...resolved.wranglerConfig,\n $schema: \"node_modules/wrangler/config-schema.json\",\n };\n\n const worker = {\n workerKey: resolved.workerKey,\n deployedName: resolved.workerName,\n };\n for (const mod of resourceModules) {\n const resources = mod.pickResources(resolved.resources);\n const fragment = mod.generate({\n resources,\n env: resolved.env,\n state,\n naming,\n passthrough: resolved.wranglerConfig,\n worker,\n });\n config = { ...config, ...fragment };\n }\n\n const secretBindings = resolved.resources?.secretsStoreSecrets ?? [];\n if (secretBindings.length > 0) {\n const passthroughSecrets =\n resolved.wranglerConfig.secrets_store_secrets ?? [];\n const generated = secretsStoreSecretsGenerate(\n secretBindings,\n resolved.env,\n state,\n naming,\n resolved.resources?.secretsStores,\n );\n config = {\n ...config,\n secrets_store_secrets: [...passthroughSecrets, ...generated],\n };\n }\n\n return config;\n}\n\nexport function writeWranglerJson(\n workerDir: string,\n config: WranglerConfig,\n outFile: string = \"wrangler.json\",\n): void {\n const path = join(workerDir, outFile);\n writeFileSync(path, JSON.stringify(config, null, 2), \"utf-8\");\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAgB,4BACd,UACA,KACA,OACA,QACA,eACsC;CACtC,MAAMA,MAA4C,EAAE;AACpD,MAAK,MAAM,KAAK,UAAU;EACxB,MAAM,cAAc,eAAe,MAAM,MAAM,EAAE,gBAAgB,EAAE,MAAM;EACzE,MAAM,cAAc,cAChB,uBAAuB,aAAa,KAAK,OAAO,GAChD,OAAO,iBAAiB,EAAE,OAAO,IAAI;EACzC,MAAM,QAAQ,MAAM,IAAI,iBAAiB,cAAc;AAGvD,MAAI,CAAC,SAAS,MAAM,SAAS,gBAC3B,OAAM,IAAI,MACR,0BAA0B,EAAE,QAAQ,sBAAsB,EAAE,MAAM,4FAE1C,IAAI,UAC7B;AAEH,MAAI,KAAK;GACP,SAAS,EAAE;GACX,UAAU,MAAM;GAChB,aAAa,EAAE;GAChB,CAAC;;AAEJ,QAAO;;;;;;;;;;;AC1CT,SAAgB,uBACd,UACA,OACA,QACgB;CAChB,IAAIC,SAAyB;EAC3B,GAAG,SAAS;EACZ,SAAS;EACV;CAED,MAAM,SAAS;EACb,WAAW,SAAS;EACpB,cAAc,SAAS;EACxB;AACD,MAAK,MAAM,OAAO,iBAAiB;EACjC,MAAM,YAAY,IAAI,cAAc,SAAS,UAAU;EACvD,MAAM,WAAW,IAAI,SAAS;GAC5B;GACA,KAAK,SAAS;GACd;GACA;GACA,aAAa,SAAS;GACtB;GACD,CAAC;AACF,WAAS;GAAE,GAAG;GAAQ,GAAG;GAAU;;CAGrC,MAAM,iBAAiB,SAAS,WAAW,uBAAuB,EAAE;AACpE,KAAI,eAAe,SAAS,GAAG;EAC7B,MAAM,qBACJ,SAAS,eAAe,yBAAyB,EAAE;EACrD,MAAM,YAAY,4BAChB,gBACA,SAAS,KACT,OACA,QACA,SAAS,WAAW,cACrB;AACD,WAAS;GACP,GAAG;GACH,uBAAuB,CAAC,GAAG,oBAAoB,GAAG,UAAU;GAC7D;;AAGH,QAAO;;AAGT,SAAgB,kBACd,WACA,QACA,UAAkB,iBACZ;AAEN,eADa,KAAK,WAAW,QAAQ,EACjB,KAAK,UAAU,QAAQ,MAAM,EAAE,EAAE,QAAQ"}
@@ -1,9 +1,7 @@
1
- import { n as loadConfig, t as getWorkers } from "./loader-DAvCKLTT.mjs";
2
- import { n as cloudflareAccountIdFromEnv, t as CFApiClient } from "./CFApiClient-DhbyyV71.mjs";
3
- import { _ as namingFromConfig, a as resourceModules, i as getResourceModule, p as resolveWorkerConfig, t as fetchStackImports } from "./fetchStackImports-C-1THPYL.mjs";
4
- import { f as stackNameForConfig, t as StateManager } from "./StateManager-DTqtLLVX.mjs";
5
- import "./r2S3EmptyBucket-DD81ZWQ7.mjs";
6
- import { n as workerRouteStateKey, t as findZoneIdByName } from "./zoneResolver-VoxLHM4N.mjs";
1
+ import { B as getWorkers, C as stackNameForConfig, L as CFApiClient, O as resolveWorkerConfig, P as namingFromConfig, R as cloudflareAccountIdFromEnv, V as loadConfig, d as fetchStackImports, m as StateManager } from "./tamer.mjs";
2
+ import { n as resourceModules, t as getResourceModule } from "./registry-EWWdkLf7.mjs";
3
+ import "./r2S3EmptyBucket-B9_pHfvB.mjs";
4
+ import { n as workerRouteStateKey, t as findZoneIdByName } from "./zoneResolver-DNNNmO_w.mjs";
7
5
 
8
6
  //#region src/cli/commands/import.ts
9
7
  const REGISTRY_KINDS = new Set(resourceModules.map((m) => m.kind));
@@ -46,6 +44,8 @@ async function runImport(options) {
46
44
  api,
47
45
  state,
48
46
  naming,
47
+ config,
48
+ baseDir,
49
49
  ts
50
50
  });
51
51
  } else if (options.kind === "dispatch_namespace") await importDispatchNamespace({
@@ -110,7 +110,7 @@ async function importDnsRecord(ctx) {
110
110
  const hit = (await api.zoneDnsRecordListAll(declared.zoneId)).find((r) => r.id === options.cfId);
111
111
  if (!hit) throw new Error(`import dns_record: record id "${options.cfId}" not found in zone "${declared.zoneId}"`);
112
112
  if (hit.type !== declared.type) throw new Error(`import dns_record: cf record type "${hit.type}" does not match declared type "${declared.type}"`);
113
- const { dnsRecordStateKey } = await import("./dns-records.resolve-C2T0m4NG.mjs");
113
+ const { dnsRecordStateKey } = await import("./dns-records.resolve-8a_eHfVI.mjs");
114
114
  const key = dnsRecordStateKey(declared.zoneId, declared.type, declared.name);
115
115
  const existing = state.get(key);
116
116
  state.set(key, {
@@ -161,4 +161,4 @@ async function importWorkerRoute(ctx) {
161
161
 
162
162
  //#endregion
163
163
  export { runImport };
164
- //# sourceMappingURL=import-B0dlwKoQ.mjs.map
164
+ //# sourceMappingURL=import-OvohE-H2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-OvohE-H2.mjs","names":[],"sources":["../src/cli/commands/import.ts"],"sourcesContent":["import { loadConfig, getWorkers } from \"../../core/config/loader.js\";\nimport { cloudflareAccountIdFromEnv } from \"../../core/cloudflareEnv.js\";\nimport { namingFromConfig } from \"../../core/config/namingFromConfig.js\";\nimport { CFApiClient } from \"../../core/api/CFApiClient.js\";\nimport { StateManager } from \"../../core/state/StateManager.js\";\nimport { stackNameForConfig } from \"../../core/state/stackName.js\";\nimport { resolveWorkerConfig } from \"../../core/config/resolver.js\";\nimport { fetchStackImports } from \"../../core/imports/fetchStackImports.js\";\nimport { workerRouteStateKey } from \"../../features/worker-route/worker-route.stateKey.js\";\nimport { findZoneIdByName } from \"../../core/routes/zoneResolver.js\";\nimport {\n getResourceModule,\n resourceModules,\n type ResourceKind,\n} from \"../../core/registry/registry.js\";\n\n/** All registered resource kinds plus the non-registry imports. */\nexport type ImportKind =\n | ResourceKind\n | \"dispatch_namespace\"\n | \"dns_record\"\n | \"worker_route\";\n\nexport interface ImportOptions {\n env: string;\n kind: ImportKind;\n /** Logical name from `tamer.config.ts` (or worker key, for `worker_route`). */\n logical: string;\n /** Cloudflare resource id (D1 uuid, KV id, R2 bucket name, or namespace name). */\n cfId?: string;\n /** Required for sharded D1 imports (YYYY-MM-DD). */\n shardDate?: string;\n /** R2 buckets only: creation date (YYYY-MM-DD) used in the binding key. */\n createdDate?: string;\n /** worker_route only: the route id from `/zones/{id}/workers/routes`. */\n routeId?: string;\n /** worker_route only: zone name from `tamerRoutes`. */\n zoneName?: string;\n configPath?: string;\n}\n\nconst REGISTRY_KINDS = new Set<string>(resourceModules.map((m) => m.kind));\n\n/**\n * `tamer import` — register an existing Cloudflare resource into Tamer state\n * by logical name (CloudFormation `import_resources` analogue). For all\n * resource-registry kinds the work is delegated to the module's\n * `importOne` hook; `dispatch_namespace` and `worker_route` remain inline\n * because they aren't registry resources today.\n */\nexport async function runImport(options: ImportOptions): Promise<void> {\n const env = options.env;\n if (env === \"local\") {\n throw new Error(\"import: --env local is not supported (no persisted state)\");\n }\n const baseDir = process.cwd();\n const config = await loadConfig(options.configPath, { env });\n const accountId = config.account_id ?? cloudflareAccountIdFromEnv();\n if (!accountId) {\n throw new Error(\n \"account_id required in config or CLOUDFLARE_ACCOUNT_ID env var\",\n );\n }\n const api = new CFApiClient(accountId);\n const naming = namingFromConfig(config);\n const state = new StateManager(\n config.tenant.id,\n env,\n stackNameForConfig(config),\n );\n await state.hydrate(api);\n state.beginOperation(\"import\", `${options.kind}:${options.logical}`);\n\n const ts = new Date().toISOString();\n\n try {\n if (REGISTRY_KINDS.has(options.kind)) {\n const mod = getResourceModule(options.kind as ResourceKind);\n if (!mod) throw new Error(`unknown import kind \"${options.kind}\"`);\n await mod.importOne({\n options: {\n env,\n kind: options.kind,\n logical: options.logical,\n cfId: options.cfId,\n shardDate: options.shardDate,\n createdDate: options.createdDate,\n routeId: options.routeId,\n zoneName: options.zoneName,\n },\n env,\n api,\n state,\n naming,\n config,\n baseDir,\n ts,\n });\n } else if (options.kind === \"dispatch_namespace\") {\n await importDispatchNamespace({ options, env, api, state, ts });\n } else if (options.kind === \"dns_record\") {\n await importDnsRecord({ options, env, api, state, config, ts });\n } else if (options.kind === \"worker_route\") {\n await importWorkerRoute({\n options,\n env,\n baseDir,\n accountId,\n api,\n naming,\n state,\n config,\n ts,\n });\n } else {\n throw new Error(`unknown import kind \"${options.kind}\"`);\n }\n\n state.finishOperation(\"imported\");\n await state.persist(api);\n console.log(`Imported ${options.kind} \"${options.logical}\" into ${env} state.`);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n state.failOperation(msg);\n try {\n await state.persist(api);\n } catch {\n /* swallow secondary persist failure */\n }\n throw err;\n }\n}\n\nasync function importDispatchNamespace(ctx: {\n options: ImportOptions;\n env: string;\n api: CFApiClient;\n state: StateManager;\n ts: string;\n}): Promise<void> {\n const { options, api, state, ts } = ctx;\n const namespaces = await api.dispatchNamespaceListAll();\n const hit = namespaces.find((n) => n.namespace_name === options.cfId);\n if (!hit) {\n throw new Error(\n `import dispatch_namespace: namespace \"${options.cfId}\" not found`,\n );\n }\n const derivedName = hit.namespace_name;\n const key = `dispatch_ns:${derivedName}`;\n const existing = state.get(key);\n state.set(key, {\n type: \"dispatch_namespace\",\n logicalName: options.logical,\n derivedName,\n createdAt:\n existing?.type === \"dispatch_namespace\" ? existing.createdAt : ts,\n updatedAt: ts,\n });\n}\n\nasync function importDnsRecord(ctx: {\n options: ImportOptions;\n env: string;\n api: CFApiClient;\n state: StateManager;\n config: Awaited<ReturnType<typeof loadConfig>>;\n ts: string;\n}): Promise<void> {\n const { options, api, state, config, ts } = ctx;\n if (!options.cfId) {\n throw new Error(\n \"import dns_record: --cf-id <recordId> is required (the record id from `tamer drift` or the Cloudflare dashboard URL)\",\n );\n }\n const declared = (config.dnsRecords ?? []).find(\n (r) => r.logicalName === options.logical,\n );\n if (!declared) {\n throw new Error(\n `import dns_record: no dnsRecords entry with logicalName \"${options.logical}\" in the Tamer project config`,\n );\n }\n const list = await api.zoneDnsRecordListAll(declared.zoneId);\n const hit = list.find((r) => r.id === options.cfId);\n if (!hit) {\n throw new Error(\n `import dns_record: record id \"${options.cfId}\" not found in zone \"${declared.zoneId}\"`,\n );\n }\n if (hit.type !== declared.type) {\n throw new Error(\n `import dns_record: cf record type \"${hit.type}\" does not match declared type \"${declared.type}\"`,\n );\n }\n const { dnsRecordStateKey } = await import(\n \"../../features/dns-records/dns-records.resolve.js\"\n );\n const key = dnsRecordStateKey(declared.zoneId, declared.type, declared.name);\n const existing = state.get(key);\n state.set(key, {\n type: \"dns_record\",\n logicalName: options.logical,\n zoneId: declared.zoneId,\n recordType: declared.type,\n name: hit.name,\n content: hit.content,\n ttl: hit.ttl ?? 1,\n proxied: hit.proxied ?? false,\n priority: hit.priority,\n comment: hit.comment ?? \"\",\n recordId: hit.id,\n createdAt: existing?.type === \"dns_record\" ? existing.createdAt : ts,\n updatedAt: ts,\n });\n}\n\nasync function importWorkerRoute(ctx: {\n options: ImportOptions;\n env: string;\n baseDir: string;\n accountId: string;\n api: CFApiClient;\n naming: ReturnType<typeof namingFromConfig>;\n state: StateManager;\n config: Awaited<ReturnType<typeof loadConfig>>;\n ts: string;\n}): Promise<void> {\n const { options, env, baseDir, accountId, api, naming, state, config, ts } =\n ctx;\n if (!options.routeId) {\n throw new Error(\"import worker_route: --route-id <id> is required\");\n }\n const workers = await getWorkers(config, baseDir);\n const wc = workers.find(([k]) => k === options.logical)?.[1];\n if (!wc) {\n throw new Error(\n `import worker_route: no worker key \"${options.logical}\" in the Tamer project config`,\n );\n }\n const imports = await fetchStackImports(api, config, env);\n const resolved = await resolveWorkerConfig(\n config,\n options.logical,\n wc,\n env,\n baseDir,\n accountId,\n naming,\n state,\n { imports },\n );\n if (resolved.apiManagedRoutes.length === 0) {\n throw new Error(\n `import worker_route: worker \"${options.logical}\" declares no api-managed tamerRoutes for env ${env}`,\n );\n }\n\n const route = options.zoneName\n ? resolved.apiManagedRoutes.find((r) => r.zone_name === options.zoneName)\n : resolved.apiManagedRoutes[0];\n if (!route) {\n throw new Error(\n `import worker_route: no route for zone \"${options.zoneName}\" in resolved config`,\n );\n }\n const zoneId = await findZoneIdByName(api, route.zone_name);\n if (!zoneId) {\n throw new Error(`import worker_route: zone \"${route.zone_name}\" not found`);\n }\n const list = await api.zoneWorkerRoutesList(zoneId);\n const hit = list.find((r) => r.id === options.routeId);\n if (!hit) {\n throw new Error(\n `import worker_route: route id \"${options.routeId}\" not found in zone \"${route.zone_name}\"`,\n );\n }\n if (hit.pattern !== route.pattern) {\n throw new Error(\n `import worker_route: cf pattern \"${hit.pattern}\" does not match resolved \"${route.pattern}\"`,\n );\n }\n const key = workerRouteStateKey(zoneId, options.routeId);\n const existing = state.get(key);\n state.set(key, {\n type: \"worker_route\",\n workerKey: options.logical,\n workerName: resolved.workerName,\n zoneId,\n zoneName: route.zone_name,\n routeId: options.routeId,\n pattern: route.pattern,\n createdAt: existing?.type === \"worker_route\" ? existing.createdAt : ts,\n updatedAt: ts,\n });\n}\n"],"mappings":";;;;;;AAyCA,MAAM,iBAAiB,IAAI,IAAY,gBAAgB,KAAK,MAAM,EAAE,KAAK,CAAC;;;;;;;;AAS1E,eAAsB,UAAU,SAAuC;CACrE,MAAM,MAAM,QAAQ;AACpB,KAAI,QAAQ,QACV,OAAM,IAAI,MAAM,4DAA4D;CAE9E,MAAM,UAAU,QAAQ,KAAK;CAC7B,MAAM,SAAS,MAAM,WAAW,QAAQ,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AM,OADO,MAAM,IAAI,qBAAqB,OAAO,EAClC,MAAM,MAAM,EAAE,OAAO,QAAQ,QAAQ;AACtD,KAAI,CAAC,IACH,OAAM,IAAI,MACR,kCAAkC,QAAQ,QAAQ,uBAAuB,MAAM,UAAU,GAC1F;AAEH,KAAI,IAAI,YAAY,MAAM,QACxB,OAAM,IAAI,MACR,oCAAoC,IAAI,QAAQ,6BAA6B,MAAM,QAAQ,GAC5F;CAEH,MAAM,MAAM,oBAAoB,QAAQ,QAAQ,QAAQ;CACxD,MAAM,WAAW,MAAM,IAAI,IAAI;AAC/B,OAAM,IAAI,KAAK;EACb,MAAM;EACN,WAAW,QAAQ;EACnB,YAAY,SAAS;EACrB;EACA,UAAU,MAAM;EAChB,SAAS,QAAQ;EACjB,SAAS,MAAM;EACf,WAAW,UAAU,SAAS,iBAAiB,SAAS,YAAY;EACpE,WAAW;EACZ,CAAC"}
package/dist/index.d.mts CHANGED
@@ -366,10 +366,10 @@ interface RawEnvironment {
366
366
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
367
367
  */
368
368
  previews?: {
369
- logpush?: Interface7690406478080179507690406470477942004818536;
370
- observability?: Interface7690406478080179507690406470477942004818536;
371
- limits?: Interface7690406478080179507690406470477942004818536;
372
- cache?: Interface7690406478080179507690406470477942004818536;
369
+ logpush?: Interface7690406478080179507690406470491392004818536;
370
+ observability?: Interface7690406478080179507690406470491392004818536;
371
+ limits?: Interface7690406478080179507690406470491392004818536;
372
+ cache?: Interface7690406478080179507690406470491392004818536;
373
373
  /**
374
374
  * A map of values to substitute when deploying your Worker.
375
375
  *
@@ -696,6 +696,40 @@ interface RawEnvironment {
696
696
  */
697
697
  remote?: boolean;
698
698
  }[];
699
+ /**
700
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
701
+ *
702
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
703
+ */
704
+ agent_memory?: {
705
+ /**
706
+ * The binding name used to refer to the Agent Memory namespace in the Worker.
707
+ */
708
+ binding: string;
709
+ /**
710
+ * The user-chosen namespace name. Must exist in Cloudflare at deploy time.
711
+ */
712
+ namespace: string;
713
+ /**
714
+ * Whether the Agent Memory binding should be remote in local development
715
+ */
716
+ remote?: boolean;
717
+ }[];
718
+ /**
719
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the binding is zero-config -- only the variable name is required, declared as a single object (not an array).
720
+ *
721
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
722
+ */
723
+ web_search?: {
724
+ /**
725
+ * The binding name used to refer to Web Search in the Worker.
726
+ */
727
+ binding: string;
728
+ /**
729
+ * Whether the Web Search binding should be remote or not in local development
730
+ */
731
+ remote?: boolean;
732
+ };
699
733
  /**
700
734
  * Specifies Hyperdrive configs that are bound to this Worker environment.
701
735
  *
@@ -974,9 +1008,14 @@ interface RawEnvironment {
974
1008
  */
975
1009
  binding: string;
976
1010
  /**
977
- * Name of the Pipeline to bind
1011
+ * Id of the Stream to bind
978
1012
  */
979
- pipeline: string;
1013
+ stream?: string;
1014
+ /**
1015
+ * @deprecated
1016
+ * Id of the Stream to bind
1017
+ */
1018
+ pipeline?: string;
980
1019
  /**
981
1020
  * Whether the pipeline should be remote or not in local development
982
1021
  */
@@ -1471,6 +1510,40 @@ interface RawEnvironment {
1471
1510
  */
1472
1511
  remote?: boolean;
1473
1512
  }[];
1513
+ /**
1514
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
1515
+ *
1516
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
1517
+ */
1518
+ agent_memory?: {
1519
+ /**
1520
+ * The binding name used to refer to the Agent Memory namespace in the Worker.
1521
+ */
1522
+ binding: string;
1523
+ /**
1524
+ * The user-chosen namespace name. Must exist in Cloudflare at deploy time.
1525
+ */
1526
+ namespace: string;
1527
+ /**
1528
+ * Whether the Agent Memory binding should be remote in local development
1529
+ */
1530
+ remote?: boolean;
1531
+ }[];
1532
+ /**
1533
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the binding is zero-config -- only the variable name is required, declared as a single object (not an array).
1534
+ *
1535
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
1536
+ */
1537
+ web_search?: {
1538
+ /**
1539
+ * The binding name used to refer to Web Search in the Worker.
1540
+ */
1541
+ binding: string;
1542
+ /**
1543
+ * Whether the Web Search binding should be remote or not in local development
1544
+ */
1545
+ remote?: boolean;
1546
+ };
1474
1547
  /**
1475
1548
  * Specifies Hyperdrive configs that are bound to this Worker environment.
1476
1549
  *
@@ -1749,9 +1822,14 @@ interface RawEnvironment {
1749
1822
  */
1750
1823
  binding: string;
1751
1824
  /**
1752
- * Name of the Pipeline to bind
1825
+ * Id of the Stream to bind
1826
+ */
1827
+ stream?: string;
1828
+ /**
1829
+ * @deprecated
1830
+ * Id of the Stream to bind
1753
1831
  */
1754
- pipeline: string;
1832
+ pipeline?: string;
1755
1833
  /**
1756
1834
  * Whether the pipeline should be remote or not in local development
1757
1835
  */
@@ -1994,9 +2072,9 @@ interface Rule {
1994
2072
  * The `EnvironmentInheritable` interface declares all the configuration fields for an environment that can be inherited (and overridden) from the top-level environment.
1995
2073
  *
1996
2074
  * This interface was referenced by `WranglerSchema`'s JSON-Schema
1997
- * via the `definition` "interface-769040647-8080-17950-769040647-0-477942004818536".
2075
+ * via the `definition` "interface-769040647-8080-17950-769040647-0-491392004818536".
1998
2076
  */
1999
- interface Interface7690406478080179507690406470477942004818536 {
2077
+ interface Interface7690406478080179507690406470491392004818536 {
2000
2078
  /**
2001
2079
  * The name of your Worker. Alphanumeric + dashes only.
2002
2080
  */
@@ -2310,10 +2388,10 @@ interface Interface7690406478080179507690406470477942004818536 {
2310
2388
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
2311
2389
  */
2312
2390
  previews?: {
2313
- logpush?: Interface7690406478080179507690406470477942004818536;
2314
- observability?: Interface7690406478080179507690406470477942004818536;
2315
- limits?: Interface7690406478080179507690406470477942004818536;
2316
- cache?: Interface7690406478080179507690406470477942004818536;
2391
+ logpush?: Interface7690406478080179507690406470491392004818536;
2392
+ observability?: Interface7690406478080179507690406470491392004818536;
2393
+ limits?: Interface7690406478080179507690406470491392004818536;
2394
+ cache?: Interface7690406478080179507690406470491392004818536;
2317
2395
  /**
2318
2396
  * A map of values to substitute when deploying your Worker.
2319
2397
  *
@@ -2640,6 +2718,40 @@ interface Interface7690406478080179507690406470477942004818536 {
2640
2718
  */
2641
2719
  remote?: boolean;
2642
2720
  }[];
2721
+ /**
2722
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
2723
+ *
2724
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
2725
+ */
2726
+ agent_memory?: {
2727
+ /**
2728
+ * The binding name used to refer to the Agent Memory namespace in the Worker.
2729
+ */
2730
+ binding: string;
2731
+ /**
2732
+ * The user-chosen namespace name. Must exist in Cloudflare at deploy time.
2733
+ */
2734
+ namespace: string;
2735
+ /**
2736
+ * Whether the Agent Memory binding should be remote in local development
2737
+ */
2738
+ remote?: boolean;
2739
+ }[];
2740
+ /**
2741
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the binding is zero-config -- only the variable name is required, declared as a single object (not an array).
2742
+ *
2743
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
2744
+ */
2745
+ web_search?: {
2746
+ /**
2747
+ * The binding name used to refer to Web Search in the Worker.
2748
+ */
2749
+ binding: string;
2750
+ /**
2751
+ * Whether the Web Search binding should be remote or not in local development
2752
+ */
2753
+ remote?: boolean;
2754
+ };
2643
2755
  /**
2644
2756
  * Specifies Hyperdrive configs that are bound to this Worker environment.
2645
2757
  *
@@ -2918,9 +3030,14 @@ interface Interface7690406478080179507690406470477942004818536 {
2918
3030
  */
2919
3031
  binding: string;
2920
3032
  /**
2921
- * Name of the Pipeline to bind
3033
+ * Id of the Stream to bind
3034
+ */
3035
+ stream?: string;
3036
+ /**
3037
+ * @deprecated
3038
+ * Id of the Stream to bind
2922
3039
  */
2923
- pipeline: string;
3040
+ pipeline?: string;
2924
3041
  /**
2925
3042
  * Whether the pipeline should be remote or not in local development
2926
3043
  */
@@ -3598,10 +3715,10 @@ interface RawConfig {
3598
3715
  * For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#previews
3599
3716
  */
3600
3717
  previews?: {
3601
- logpush?: Interface7690406478080179507690406470477942004818536;
3602
- observability?: Interface7690406478080179507690406470477942004818536;
3603
- limits?: Interface7690406478080179507690406470477942004818536;
3604
- cache?: Interface7690406478080179507690406470477942004818536;
3718
+ logpush?: Interface7690406478080179507690406470491392004818536;
3719
+ observability?: Interface7690406478080179507690406470491392004818536;
3720
+ limits?: Interface7690406478080179507690406470491392004818536;
3721
+ cache?: Interface7690406478080179507690406470491392004818536;
3605
3722
  /**
3606
3723
  * A map of values to substitute when deploying your Worker.
3607
3724
  *
@@ -3928,6 +4045,40 @@ interface RawConfig {
3928
4045
  */
3929
4046
  remote?: boolean;
3930
4047
  }[];
4048
+ /**
4049
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
4050
+ *
4051
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
4052
+ */
4053
+ agent_memory?: {
4054
+ /**
4055
+ * The binding name used to refer to the Agent Memory namespace in the Worker.
4056
+ */
4057
+ binding: string;
4058
+ /**
4059
+ * The user-chosen namespace name. Must exist in Cloudflare at deploy time.
4060
+ */
4061
+ namespace: string;
4062
+ /**
4063
+ * Whether the Agent Memory binding should be remote in local development
4064
+ */
4065
+ remote?: boolean;
4066
+ }[];
4067
+ /**
4068
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the binding is zero-config -- only the variable name is required, declared as a single object (not an array).
4069
+ *
4070
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
4071
+ */
4072
+ web_search?: {
4073
+ /**
4074
+ * The binding name used to refer to Web Search in the Worker.
4075
+ */
4076
+ binding: string;
4077
+ /**
4078
+ * Whether the Web Search binding should be remote or not in local development
4079
+ */
4080
+ remote?: boolean;
4081
+ };
3931
4082
  /**
3932
4083
  * Specifies Hyperdrive configs that are bound to this Worker environment.
3933
4084
  *
@@ -4206,9 +4357,14 @@ interface RawConfig {
4206
4357
  */
4207
4358
  binding: string;
4208
4359
  /**
4209
- * Name of the Pipeline to bind
4360
+ * Id of the Stream to bind
4361
+ */
4362
+ stream?: string;
4363
+ /**
4364
+ * @deprecated
4365
+ * Id of the Stream to bind
4210
4366
  */
4211
- pipeline: string;
4367
+ pipeline?: string;
4212
4368
  /**
4213
4369
  * Whether the pipeline should be remote or not in local development
4214
4370
  */
@@ -4703,6 +4859,40 @@ interface RawConfig {
4703
4859
  */
4704
4860
  remote?: boolean;
4705
4861
  }[];
4862
+ /**
4863
+ * Specifies Agent Memory namespace bindings that are bound to this Worker environment.
4864
+ *
4865
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
4866
+ */
4867
+ agent_memory?: {
4868
+ /**
4869
+ * The binding name used to refer to the Agent Memory namespace in the Worker.
4870
+ */
4871
+ binding: string;
4872
+ /**
4873
+ * The user-chosen namespace name. Must exist in Cloudflare at deploy time.
4874
+ */
4875
+ namespace: string;
4876
+ /**
4877
+ * Whether the Agent Memory binding should be remote in local development
4878
+ */
4879
+ remote?: boolean;
4880
+ }[];
4881
+ /**
4882
+ * Cloudflare Web Search binding. There is exactly one shared web corpus, so the binding is zero-config -- only the variable name is required, declared as a single object (not an array).
4883
+ *
4884
+ * NOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.
4885
+ */
4886
+ web_search?: {
4887
+ /**
4888
+ * The binding name used to refer to Web Search in the Worker.
4889
+ */
4890
+ binding: string;
4891
+ /**
4892
+ * Whether the Web Search binding should be remote or not in local development
4893
+ */
4894
+ remote?: boolean;
4895
+ };
4706
4896
  /**
4707
4897
  * Specifies Hyperdrive configs that are bound to this Worker environment.
4708
4898
  *
@@ -4981,9 +5171,14 @@ interface RawConfig {
4981
5171
  */
4982
5172
  binding: string;
4983
5173
  /**
4984
- * Name of the Pipeline to bind
5174
+ * Id of the Stream to bind
5175
+ */
5176
+ stream?: string;
5177
+ /**
5178
+ * @deprecated
5179
+ * Id of the Stream to bind
4985
5180
  */
4986
- pipeline: string;
5181
+ pipeline?: string;
4987
5182
  /**
4988
5183
  * Whether the pipeline should be remote or not in local development
4989
5184
  */
@@ -5440,6 +5635,18 @@ declare function isCfBinding(x: unknown): x is CfBinding;
5440
5635
  * before validation.
5441
5636
  */
5442
5637
  type TamerResolvableString = string | CfBinding;
5638
+ /** Context for per-resource Cloudflare name resolution (e.g. sharded D1 shard date). */
5639
+ interface CloudflareNameContext {
5640
+ /** ISO `YYYY-MM-DD` shard stamp for sharded D1. */
5641
+ shardDate?: string;
5642
+ }
5643
+ /**
5644
+ * Per-resource Cloudflare name for the current env.
5645
+ * No UUIDs — name only. Used for sync, plan, apply, drift, import, and generate.
5646
+ *
5647
+ * Resolution order when unset: stack {@link NamingConventions} hook → {@link NamingEngine} default.
5648
+ */
5649
+ type CloudflareNameFn = (tenantId: string, env: string, ctx?: CloudflareNameContext) => string;
5443
5650
  /** Wrangler R2 binding with optional {@link TamerResolvableString} `bucket_name`. */
5444
5651
  type WranglerR2BucketResolvable = Omit<WranglerR2Bucket, "bucket_name"> & {
5445
5652
  bucket_name?: TamerResolvableString;
@@ -5502,13 +5709,19 @@ interface TenantMeta {
5502
5709
  }
5503
5710
  /**
5504
5711
  * D1 database declared on a worker's `resources.d1[]`.
5505
- * Cloudflare **name** comes from {@link NamingConventions.d1Single} or
5506
- * {@link NamingConventions.d1Shard}; **id** is stored in state after `sync` / `apply`.
5712
+ * Cloudflare **name** for managed databases follows
5713
+ * {@link D1ResourceConfig.cloudflareName} {@link NamingConventions.d1Single} /
5714
+ * {@link NamingConventions.d1Shard} → defaults; **id** is stored in state after `sync` / `apply`.
5507
5715
  */
5508
5716
  interface D1ResourceConfig {
5509
5717
  logicalName: string;
5510
5718
  /** `"single"`: one DB per logical name. `"sharded"`: date-stamped shards (see `d1Shard` naming hook). */
5511
5719
  type: "single" | "sharded";
5720
+ /**
5721
+ * Optional per-resource Cloudflare database name. For sharded D1, receives
5722
+ * {@link CloudflareNameContext.shardDate}. External D1 uses {@link databaseName} instead.
5723
+ */
5724
+ cloudflareName?: CloudflareNameFn;
5512
5725
  /**
5513
5726
  * `managed` (default): Tamer creates the database; the Cloudflare name follows
5514
5727
  * `naming.d1Single` / shard rules.
@@ -5538,14 +5751,18 @@ interface D1ResourceConfig {
5538
5751
  */
5539
5752
  preserveOnDestroy?: boolean;
5540
5753
  }
5541
- /** R2 bucket on `resources.r2[]`. Name from {@link NamingConventions.r2Bucket} or default. */
5754
+ /** R2 bucket on `resources.r2[]`. Name from {@link cloudflareName} → {@link NamingConventions.r2Bucket} default. */
5542
5755
  interface R2ResourceConfig {
5543
5756
  logicalName: string;
5757
+ /** Optional per-resource Cloudflare bucket name override. */
5758
+ cloudflareName?: CloudflareNameFn;
5544
5759
  /** When set, used as the Wrangler R2 `binding` instead of the generated stable name. */
5545
5760
  binding?: string;
5546
5761
  }
5547
5762
  interface KVResourceConfig {
5548
5763
  logicalName: string;
5764
+ /** Optional per-resource Cloudflare KV namespace name override. */
5765
+ cloudflareName?: CloudflareNameFn;
5549
5766
  /** When set, used as the Wrangler KV `binding` instead of the generated name. */
5550
5767
  binding?: string;
5551
5768
  }
@@ -5558,6 +5775,8 @@ interface KVResourceConfig {
5558
5775
  */
5559
5776
  interface QueueResourceConfig {
5560
5777
  logicalName: string;
5778
+ /** Optional per-resource Cloudflare queue name override. */
5779
+ cloudflareName?: CloudflareNameFn;
5561
5780
  /** When set, used as the Wrangler queue `binding` instead of the generated name. */
5562
5781
  binding?: string;
5563
5782
  /**
@@ -5575,6 +5794,8 @@ interface QueueResourceConfig {
5575
5794
  */
5576
5795
  interface HyperdriveResourceConfig {
5577
5796
  logicalName: string;
5797
+ /** Optional per-resource Cloudflare Hyperdrive config name override. */
5798
+ cloudflareName?: CloudflareNameFn;
5578
5799
  /** When set, used as the Wrangler hyperdrive `binding` instead of the generated name. */
5579
5800
  binding?: string;
5580
5801
  /** Origin database connection. Sent to Cloudflare on create; not stored in Tamer state. */
@@ -5604,6 +5825,8 @@ interface HyperdriveResourceConfig {
5604
5825
  */
5605
5826
  interface VectorizeResourceConfig {
5606
5827
  logicalName: string;
5828
+ /** Optional per-resource Cloudflare Vectorize index name override. */
5829
+ cloudflareName?: CloudflareNameFn;
5607
5830
  /** When set, used as the Wrangler vectorize `binding` instead of the generated name. */
5608
5831
  binding?: string;
5609
5832
  /** Vector dimensionality (e.g. 768 for `@cf/baai/bge-base-en-v1.5`). Immutable. */
@@ -5625,6 +5848,8 @@ interface VectorizeResourceConfig {
5625
5848
  */
5626
5849
  interface AIGatewayResourceConfig {
5627
5850
  logicalName: string;
5851
+ /** Optional per-resource Cloudflare AI Gateway slug override. */
5852
+ cloudflareName?: CloudflareNameFn;
5628
5853
  /** Cache TTL in seconds. Default 0 (caching disabled). */
5629
5854
  cacheTtl?: number;
5630
5855
  /** Invalidate cached entries when upstream model output changes. Default false. */
@@ -5657,6 +5882,8 @@ interface AIGatewayResourceConfig {
5657
5882
  */
5658
5883
  interface PipelineResourceConfig {
5659
5884
  logicalName: string;
5885
+ /** Optional per-resource Cloudflare Pipeline name override. */
5886
+ cloudflareName?: CloudflareNameFn;
5660
5887
  /**
5661
5888
  * Arroyo SQL describing the processing flow, e.g.
5662
5889
  * `insert into my_sink select * from my_stream;`. Stream and sink names
@@ -5705,6 +5932,8 @@ interface HyperdriveOriginSpec {
5705
5932
  */
5706
5933
  interface WorkflowResourceConfig {
5707
5934
  logicalName: string;
5935
+ /** Optional per-resource Cloudflare workflow registration name override. */
5936
+ cloudflareName?: CloudflareNameFn;
5708
5937
  /**
5709
5938
  * Class name exported by the worker that implements this workflow
5710
5939
  * (`export class BillingWorkflow extends WorkflowEntrypoint {...}` →
@@ -6015,6 +6244,8 @@ interface WorkerResources {
6015
6244
  */
6016
6245
  interface SecretsStoreResourceConfig {
6017
6246
  logicalName: string;
6247
+ /** Optional per-resource Cloudflare Secrets Store name override. */
6248
+ cloudflareName?: CloudflareNameFn;
6018
6249
  }
6019
6250
  /**
6020
6251
  * One row in the worker's wrangler `secrets_store_secrets[]` array. Pure
@@ -6075,6 +6306,24 @@ interface RouteResourceConfig {
6075
6306
  */
6076
6307
  prodEnvs?: string[];
6077
6308
  }
6309
+ /**
6310
+ * Declares secrets a worker requires at deploy/runtime.
6311
+ *
6312
+ * **Names only — never values.** Secret material lives in the Tamer vault
6313
+ * (`tamer secrets set` / `load`) and reaches Cloudflare via `push` / `deploy`.
6314
+ * {@link WorkerSecretsConfig.required} is reconciled by `plan` and `drift`
6315
+ * against vault fingerprints and deployed worker presence.
6316
+ */
6317
+ interface WorkerSecretsConfig {
6318
+ /**
6319
+ * Logical secret names this worker needs at runtime (e.g. `STRIPE_KEY`).
6320
+ * Values are stored in the Tamer vault via `tamer secrets set` / `load` and
6321
+ * pushed to Cloudflare on `tamer secrets push` or `tamer deploy`. Reconciled
6322
+ * by `plan`, `drift`, and `tamer secrets verify` against vault fingerprints
6323
+ * and {@link SecretStateEntry.lastPushedHash} — never put plaintext here.
6324
+ */
6325
+ required: string[];
6326
+ }
6078
6327
  type ManagedFields = "name" | "account_id" | "d1_databases" | "r2_buckets" | "kv_namespaces" | "queues" | "hyperdrive" | "vectorize";
6079
6328
  type BaseWranglerFields = Omit<WranglerConfig, ManagedFields>;
6080
6329
  interface EnvOverride extends Omit<BaseWranglerFields, "vars" | "r2_buckets"> {
@@ -6123,6 +6372,11 @@ interface WorkerConfig extends Omit<BaseWranglerFields, "vars" | "r2_buckets" |
6123
6372
  * When set, `tamer deploy` passes `--dispatch-namespace` to Wrangler (Workers for Platforms user Worker upload).
6124
6373
  */
6125
6374
  dispatchNamespace?: string;
6375
+ /**
6376
+ * Required worker secrets (names only). See {@link WorkerSecretsConfig}.
6377
+ * Absent block means no declared secrets for this worker.
6378
+ */
6379
+ secrets?: WorkerSecretsConfig;
6126
6380
  local?: EnvOverride;
6127
6381
  env?: Record<string, EnvOverride>;
6128
6382
  }
@@ -6509,7 +6763,27 @@ interface WorkerRouteStateEntry {
6509
6763
  createdAt: string;
6510
6764
  updatedAt: string;
6511
6765
  }
6512
- type StateEntry = D1StateEntry | R2StateEntry | KVStateEntry | QueueStateEntry | HyperdriveStateEntry | VectorizeStateEntry | AIGatewayStateEntry | PipelineStateEntry | WorkflowStateEntry | SecretsStoreStateEntry | DnsRecordStateEntry | DispatchNamespaceStateEntry | LogpushJobStateEntry | LogpushPipelinesStateEntry | WorkerRouteStateEntry;
6766
+ /**
6767
+ * Last-pushed fingerprint for a worker secret — **no secret material**.
6768
+ *
6769
+ * Written by `tamer secrets push` and `tamer deploy` after a successful CF API
6770
+ * PUT. Stored in {@link CfiState.resources} under key `secret:{worker}:{name}`.
6771
+ * Compared to the vault row's `value_hash` to detect rotation (`vault hash !=
6772
+ * lastPushedHash` → needs push). Keyed per secret × worker × env so the same
6773
+ * secret can be current on one worker and stale on another.
6774
+ */
6775
+ interface SecretStateEntry {
6776
+ type: "secret";
6777
+ /** Worker key from `tamer.config.ts` (e.g. `api`). */
6778
+ worker: string;
6779
+ /** Logical secret name (e.g. `STRIPE_KEY`). */
6780
+ name: string;
6781
+ /** Vault `value_hash` last PUT to this worker for this env. */
6782
+ lastPushedHash: string;
6783
+ /** ISO timestamp of the last successful push. */
6784
+ lastPushedAt: string;
6785
+ }
6786
+ type StateEntry = D1StateEntry | R2StateEntry | KVStateEntry | QueueStateEntry | HyperdriveStateEntry | VectorizeStateEntry | AIGatewayStateEntry | PipelineStateEntry | WorkflowStateEntry | SecretsStoreStateEntry | DnsRecordStateEntry | DispatchNamespaceStateEntry | LogpushJobStateEntry | LogpushPipelinesStateEntry | WorkerRouteStateEntry | SecretStateEntry;
6513
6787
  /** Provisioning lifecycle for a workspace tenant (`product` + `workspace`). */
6514
6788
  type ProvisioningStatus = "pending" | "d1_created" | "migrations_applied" | "script_uploaded" | "ready" | "tombstoned";
6515
6789
  interface TenantD1ShardRef {
@@ -6623,20 +6897,22 @@ interface TenantStatus {
6623
6897
  }
6624
6898
  /**
6625
6899
  * Optional functions that derive **Cloudflare resource names** from config
6626
- * (`logicalName`, `tenant.id`, `env`, etc.). Used by `apply`, `sync`, `plan`,
6627
- * `drift`, and `import` through one shared naming derivation path.
6900
+ * (`logicalName`, `tenant.id`, `env`, etc.). Used when a resource has no
6901
+ * {@link CloudflareNameFn} override on its config.
6628
6902
  *
6629
- * **Greenfield:** omit this block — Tamer uses built-in defaults below.
6903
+ * **Resolution order (managed resources):**
6904
+ * 1. `resource.cloudflareName?(tenantId, env, ctx?)`
6905
+ * 2. stack `naming.{kindHook}?(...)` (this interface)
6906
+ * 3. {@link NamingEngine} built-in default
6630
6907
  *
6631
- * **Brownfield:** reproduce legacy names here (functions, not UUIDs). Config
6632
- * holds logical names and hooks; **state** holds `cfId` after `tamer sync`.
6633
- * Run bootstrap → sync → plan before expecting adoption to succeed.
6908
+ * **Greenfield:** omit both per-resource overrides and this block.
6634
6909
  *
6635
- * KV, queues, hyperdrive, vectorize, pipelines, AI gateway, secrets store,
6636
- * dispatch namespaces, and DNS use fixed derived names today (no hooks).
6910
+ * **Brownfield:** use per-resource `cloudflareName` when names differ per
6911
+ * logical resource; use stack hooks for shared formulas. Config holds logical
6912
+ * names and hooks; **state** holds `cfId` after `tamer sync`.
6637
6913
  *
6638
6914
  * @see docs/brownfield-adoption.md
6639
- * @see docs/consumer-quickstart.md
6915
+ * @see docs/per-resource-cloudflare-naming.md
6640
6916
  */
6641
6917
  interface NamingConventions {
6642
6918
  /**
@@ -6724,5 +7000,5 @@ declare function materializeCloudflareBindings(value: unknown): unknown;
6724
7000
  */
6725
7001
  declare function defineCloudflareConfig(config: unknown): CfiConfig;
6726
7002
  //#endregion
6727
- export { AIGatewayResourceConfig, AIGatewayStateEntry, CfBinding, type CfBindingSpec, type CfLogpushPipelinesField, type CfResourceField, type CfResourceKind, CfiConfig, CfiConfigMulti, CfiConfigSingle, CfiOperationName, CfiOperationRecord, CfiOperationStatus, CfiStackConfig, CfiStackMeta, CfiStackOutputValue, CfiState, D1ResourceConfig, D1StateEntry, DispatchNamespaceResourceConfig, DispatchNamespaceStateEntry, DnsRecordResourceConfig, DnsRecordStateEntry, EnvOverride, HyperdriveOriginSpec, HyperdriveResourceConfig, HyperdriveStateEntry, KVResourceConfig, KVStateEntry, LogpushJobPipelinesAutoDestination, LogpushJobPipelinesIngestDestination, LogpushJobR2Destination, LogpushJobResourceConfig, LogpushJobStateEntry, LogpushPipelinesStateEntry, LogpushWorkersTraceDataset, NamingConventions, PipelineResourceConfig, PipelineStateEntry, ProvisioningStatus, QueueResourceConfig, QueueStateEntry, R2ResourceConfig, R2StateEntry, type RawConfig, type RawEnvironment, ResourceStatus, RouteResourceConfig, SecretsStoreResourceConfig, SecretsStoreSecretBinding, SecretsStoreStateEntry, StateEntry, TAMER_OVERLAY_ENV_KEY, TamerResolvableString, TenantD1ShardRef, TenantMeta, TenantStateEntry, TenantStatus, VectorizeResourceConfig, VectorizeStateEntry, WorkerConfig, WorkerResources, WorkerRouteStateEntry, WorkerStatus, WorkflowResourceConfig, WorkflowStateEntry, type WranglerConfig, type WranglerD1Database, type WranglerEnvironment, type WranglerKVNamespace, type WranglerR2Bucket, WranglerR2BucketResolvable, cf, cfBindingSpecToTamerRef, defineCloudflareConfig, defineConfig, defineProjectOverlay, defineWorker, getDispatchNamespaces, getDnsRecords, getLogpushJobs, isCfBinding, materializeCloudflareBindings, materializeTamerResolvable, materializeVars };
7003
+ export { AIGatewayResourceConfig, AIGatewayStateEntry, CfBinding, type CfBindingSpec, type CfLogpushPipelinesField, type CfResourceField, type CfResourceKind, CfiConfig, CfiConfigMulti, CfiConfigSingle, CfiOperationName, CfiOperationRecord, CfiOperationStatus, CfiStackConfig, CfiStackMeta, CfiStackOutputValue, CfiState, CloudflareNameContext, CloudflareNameFn, D1ResourceConfig, D1StateEntry, DispatchNamespaceResourceConfig, DispatchNamespaceStateEntry, DnsRecordResourceConfig, DnsRecordStateEntry, EnvOverride, HyperdriveOriginSpec, HyperdriveResourceConfig, HyperdriveStateEntry, KVResourceConfig, KVStateEntry, LogpushJobPipelinesAutoDestination, LogpushJobPipelinesIngestDestination, LogpushJobR2Destination, LogpushJobResourceConfig, LogpushJobStateEntry, LogpushPipelinesStateEntry, LogpushWorkersTraceDataset, NamingConventions, PipelineResourceConfig, PipelineStateEntry, ProvisioningStatus, QueueResourceConfig, QueueStateEntry, R2ResourceConfig, R2StateEntry, type RawConfig, type RawEnvironment, ResourceStatus, RouteResourceConfig, SecretStateEntry, SecretsStoreResourceConfig, SecretsStoreSecretBinding, SecretsStoreStateEntry, StateEntry, TAMER_OVERLAY_ENV_KEY, TamerResolvableString, TenantD1ShardRef, TenantMeta, TenantStateEntry, TenantStatus, VectorizeResourceConfig, VectorizeStateEntry, WorkerConfig, WorkerResources, WorkerRouteStateEntry, WorkerSecretsConfig, WorkerStatus, WorkflowResourceConfig, WorkflowStateEntry, type WranglerConfig, type WranglerD1Database, type WranglerEnvironment, type WranglerKVNamespace, type WranglerR2Bucket, WranglerR2BucketResolvable, cf, cfBindingSpecToTamerRef, defineCloudflareConfig, defineConfig, defineProjectOverlay, defineWorker, getDispatchNamespaces, getDnsRecords, getLogpushJobs, isCfBinding, materializeCloudflareBindings, materializeTamerResolvable, materializeVars };
6728
7004
  //# sourceMappingURL=index.d.mts.map