@void/deploy-cloudflare 0.20.2 → 0.21.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.
package/dist/index.d.mts CHANGED
@@ -107,6 +107,10 @@ type CloudflareFrameworkDeployConfig = Readonly<{
107
107
  assetsIgnore?: ReadonlyArray<string>;
108
108
  crons?: ReadonlyArray<string>;
109
109
  requiredSecrets?: ReadonlyArray<string>;
110
+ ai?: Readonly<{
111
+ binding: string;
112
+ gateway?: string;
113
+ }>;
110
114
  }>;
111
115
  /**
112
116
  * Point a standalone framework Worker at the canonical root Cloudflare state.
@@ -227,6 +231,8 @@ export declare function deployCloudflareVersionTriggers(options: {
227
231
  previousTriggerConfig?: CloudflareTriggerConfig;
228
232
  /** Wrangler skips an empty Custom Domain set, so the caller may publish it directly. */
229
233
  publishEmptyCustomDomains?: () => Promise<CloudflareCommandResult>;
234
+ /** cf skips an empty Cron Trigger set, so the caller may publish it directly. */
235
+ publishEmptyCrons?: () => Promise<CloudflareCommandResult>;
230
236
  manageRoutes?: boolean;
231
237
  }): Promise<CloudflareCommandResult>;
232
238
  type CloudflareTriggerStabilization = Readonly<{
@@ -256,6 +262,7 @@ export declare function stabilizeCloudflareVersionTriggers(options: {
256
262
  previousTriggerConfig?: CloudflareTriggerConfig;
257
263
  knownTriggerConfigs?: Readonly<Record<string, CloudflareTriggerConfig>>;
258
264
  publishEmptyCustomDomains?: () => Promise<CloudflareCommandResult>;
265
+ publishEmptyCrons?: () => Promise<CloudflareCommandResult>;
259
266
  manageRoutes?: boolean;
260
267
  attempts?: number;
261
268
  }): Promise<CloudflareTriggerStabilization>;
@@ -284,6 +291,7 @@ type CloudflareVersionActivationOptions = {
284
291
  message: string;
285
292
  /** Direct empty-domain publisher for the Wrangler reconciliation gap. */
286
293
  publishEmptyCustomDomains?: () => Promise<CloudflareCommandResult>;
294
+ publishEmptyCrons?: () => Promise<CloudflareCommandResult>;
287
295
  /** Last successfully published traffic state, newer than immutable version annotations. */
288
296
  previousTrafficConfig?: CloudflareTrafficConfig;
289
297
  /** Explicitly Void-owned queue consumers retained for schema-1 cleanup and failed retries. */
@@ -324,7 +332,7 @@ export declare function extractWorkersDevSubdomain(url: string): string | undefi
324
332
  //#region src/metadata.d.ts
325
333
  /**
326
334
  * Share one authenticated transport for the activator's read-only metadata calls.
327
- * Writes and unsupported commands retain the pinned Wrangler runner. Responses
335
+ * Writes and unsupported commands use the pinned cf command adapter. Responses
328
336
  * keep its JSON contract so activation and concurrency checks remain unchanged.
329
337
  */
330
338
  export declare function createCloudflareMetadataRunner(options: {
@@ -336,7 +344,7 @@ export declare function createCloudflareMetadataRunner(options: {
336
344
  getToken: () => Promise<string | null>;
337
345
  verifyUploader: () => boolean;
338
346
  fetch?: typeof globalThis.fetch;
339
- /** Environment used to decide whether Wrangler's proxy-aware transport is required. */
347
+ /** Environment used to decide whether the CLI's proxy-aware transport is required. */
340
348
  env?: Readonly<Record<string, string | undefined>>;
341
349
  }): CloudflareCommandRunner;
342
350
  //#endregion
package/dist/index.mjs CHANGED
@@ -541,6 +541,13 @@ function writeCloudflareFrameworkDeployConfig(options) {
541
541
  if (required !== void 0 && (!Array.isArray(required) || !required.every((name) => typeof name === "string"))) throw new Error("Cloudflare framework config has a malformed secrets.required field.");
542
542
  upsert(["secrets", "required"], [.../* @__PURE__ */ new Set([...required ?? [], ...options.requiredSecrets])]);
543
543
  }
544
+ if (options.ai) {
545
+ const config = parse(content);
546
+ if (config.ai === void 0) upsert(["ai"], { binding: options.ai.binding });
547
+ const binding = typeof config.ai?.binding === "string" ? config.ai.binding : options.ai.binding;
548
+ if (binding !== "AI") upsert(["vars", "__VOID_AI_BINDING"], binding);
549
+ if (options.ai.gateway) upsert(["vars", "__VOID_AI_GATEWAY"], options.ai.gateway);
550
+ }
544
551
  let changed = content !== initial;
545
552
  if (changed) writeFileSync(options.configPath, content);
546
553
  const pointer = `${JSON.stringify({
@@ -790,6 +797,10 @@ async function deployCloudflareVersionTriggers(options) {
790
797
  options.workerName
791
798
  ], { capture: false });
792
799
  if (!isCleanCommandExit(deployed)) return deployed;
800
+ if (options.triggerConfig.crons.length === 0 && options.publishEmptyCrons) {
801
+ const published = await options.publishEmptyCrons();
802
+ if (!isCleanCommandExit(published)) return published;
803
+ }
793
804
  for (const queue of removedQueueConsumers(options.triggerConfig, options.previousTriggerConfig)) {
794
805
  const removed = await options.runWrangler([
795
806
  "queues",
@@ -807,7 +818,7 @@ async function deployCloudflareVersionTriggers(options) {
807
818
  if (!options.publishEmptyCustomDomains) return {
808
819
  status: 1,
809
820
  stdout: "",
810
- stderr: "Wrangler cannot publish an empty Custom Domain set and no direct publisher was available."
821
+ stderr: "Cloudflare could not publish an empty Custom Domain set and no direct publisher was available."
811
822
  };
812
823
  const published = await options.publishEmptyCustomDomains();
813
824
  if (!isCleanCommandExit(published)) return published;
@@ -877,6 +888,7 @@ async function stabilizeCloudflareVersionTriggers(options) {
877
888
  triggerConfig: activeTriggerConfig,
878
889
  previousTriggerConfig: cleanupBaseline,
879
890
  publishEmptyCustomDomains: options.publishEmptyCustomDomains,
891
+ publishEmptyCrons: options.publishEmptyCrons,
880
892
  manageRoutes: options.manageRoutes
881
893
  });
882
894
  if (!isCleanCommandExit(triggers)) return {
@@ -1424,7 +1436,8 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1424
1436
  targetTriggerConfig: desiredTriggerConfig,
1425
1437
  previousTriggerConfig,
1426
1438
  knownTriggerConfigs,
1427
- publishEmptyCustomDomains: options.publishEmptyCustomDomains
1439
+ publishEmptyCustomDomains: options.publishEmptyCustomDomains,
1440
+ publishEmptyCrons: options.publishEmptyCrons
1428
1441
  });
1429
1442
  if (!triggers.ok) {
1430
1443
  if (triggers.activeVersionId && triggers.activeVersionId !== versionId) return {
@@ -1463,7 +1476,8 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1463
1476
  targetTriggerConfig: desiredTriggerConfig,
1464
1477
  previousTriggerConfig,
1465
1478
  knownTriggerConfigs,
1466
- publishEmptyCustomDomains: options.publishEmptyCustomDomains
1479
+ publishEmptyCustomDomains: options.publishEmptyCustomDomains,
1480
+ publishEmptyCrons: options.publishEmptyCrons
1467
1481
  });
1468
1482
  return {
1469
1483
  ok: false,
@@ -1532,7 +1546,8 @@ async function restorePreviousVersionAndTriggers(options, commonArgs, previousVe
1532
1546
  targetTriggerConfig,
1533
1547
  previousTriggerConfig: failedTriggerConfig,
1534
1548
  knownTriggerConfigs: { [previousVersionId]: targetTriggerConfig },
1535
- publishEmptyCustomDomains: options.publishEmptyCustomDomains
1549
+ publishEmptyCustomDomains: options.publishEmptyCustomDomains,
1550
+ publishEmptyCrons: options.publishEmptyCrons
1536
1551
  });
1537
1552
  return triggers.ok && triggers.targetOwnsTraffic ? "succeeded" : "failed";
1538
1553
  }
@@ -1970,7 +1985,7 @@ function defaultSleep(milliseconds) {
1970
1985
  //#region src/metadata.ts
1971
1986
  /**
1972
1987
  * Share one authenticated transport for the activator's read-only metadata calls.
1973
- * Writes and unsupported commands retain the pinned Wrangler runner. Responses
1988
+ * Writes and unsupported commands use the pinned cf command adapter. Responses
1974
1989
  * keep its JSON contract so activation and concurrency checks remain unchanged.
1975
1990
  */
1976
1991
  function createCloudflareMetadataRunner(options) {
@@ -1985,7 +2000,7 @@ function createCloudflareMetadataRunner(options) {
1985
2000
  const prefix = `${options.apiBaseUrl.replace(/\/$/, "")}/accounts/${encodeURIComponent(options.accountId)}/workers/scripts/${encodeURIComponent(options.workerName)}`;
1986
2001
  const fetcher = options.fetch ?? globalThis.fetch;
1987
2002
  const proxyEnv = options.env ?? process.env;
1988
- const requiresWranglerProxy = Boolean(proxyEnv.https_proxy || proxyEnv.HTTPS_PROXY || proxyEnv.http_proxy || proxyEnv.HTTP_PROXY);
2003
+ const requiresProxyTransport = Boolean(proxyEnv.https_proxy || proxyEnv.HTTPS_PROXY || proxyEnv.http_proxy || proxyEnv.HTTP_PROXY);
1989
2004
  const refused = {
1990
2005
  status: 1,
1991
2006
  stdout: "",
@@ -2011,7 +2026,7 @@ function createCloudflareMetadataRunner(options) {
2011
2026
  rest = args.slice(3);
2012
2027
  }
2013
2028
  if (!kind || !runOptions.capture || rest.length !== common.length || rest.some((value, i) => value !== common[i])) return fallback(args, runOptions);
2014
- if (requiresWranglerProxy) return fallback(args, runOptions);
2029
+ if (requiresProxyTransport) return fallback(args, runOptions);
2015
2030
  let response;
2016
2031
  try {
2017
2032
  if (!tokenPromise && !options.verifyUploader()) return refused;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-cloudflare",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -20,7 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@void/deploy-core": "0.20.2",
23
+ "@void/deploy-core": "0.21.0",
24
24
  "jsonc-parser": "3.3.1"
25
25
  },
26
26
  "devDependencies": {