@cloudflare/deploy-helpers 0.2.1 → 0.2.2

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.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { __commonJS, __name, __require, __toESM, fetchListResult, logger, fetchResult, confirm, fetchPagedListResult, prompt, isNonInteractiveOrCI } from './chunk-NAAB7FBS.mjs';
2
- export { initDeployHelpersContext } from './chunk-NAAB7FBS.mjs';
1
+ import { __commonJS, __name, __require, __toESM, fetchResult, fetchListResult, logger, confirm, fetchPagedListResult, prompt, isNonInteractiveOrCI, select } from './chunk-N72KNDFF.mjs';
2
+ export { initDeployHelpersContext } from './chunk-N72KNDFF.mjs';
3
3
  import * as path3 from 'node:path';
4
4
  import path3__default, { resolve, isAbsolute, dirname, join, extname, sep } from 'node:path';
5
5
  import fs2, { readFileSync, statSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
6
6
  import { AsyncLocalStorage } from 'node:async_hooks';
7
7
  import * as z from 'zod';
8
8
  import { z as z$1 } from 'zod';
9
- import assert6 from 'node:assert';
9
+ import assert5 from 'node:assert';
10
10
  import url, { URLSearchParams as URLSearchParams$1 } from 'node:url';
11
11
  import * as cli from '@cloudflare/cli-shared-helpers';
12
12
  import { cancel } from '@cloudflare/cli-shared-helpers';
13
- import { getEnvironmentVariableFactory, getHostFromRoute, retryOnAPIFailure, UserError as UserError$1, ParseError as ParseError$1, getComplianceRegionSubdomain, configFileName as configFileName$1, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, APIError, INHERIT_SYMBOL, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getWranglerTmpDir, getCIMatchTag, FatalError as FatalError$1, formatConfigSnippet as formatConfigSnippet$1, readFileSync as readFileSync$2, parseJSON as parseJSON$1, getBindingTypeFriendlyName, getBindingLocalSupport, assertNever as assertNever$1, experimental_patchConfig, getTodaysCompatDate, getDockerPath, parseNonHyphenedUuid as parseNonHyphenedUuid$1, getWorkersCIBranchName } from '@cloudflare/workers-utils';
13
+ import { getEnvironmentVariableFactory, INHERIT_SYMBOL, APIError, UserError as UserError$1, getHostFromRoute, retryOnAPIFailure, ParseError as ParseError$1, getComplianceRegionSubdomain, configFileName as configFileName$1, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getWranglerTmpDir, getCIMatchTag, FatalError as FatalError$1, formatConfigSnippet as formatConfigSnippet$1, readFileSync as readFileSync$2, parseJSON as parseJSON$1, getBindingTypeFriendlyName, getBindingLocalSupport, assertNever as assertNever$1, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, getTodaysCompatDate, getDockerPath, parseNonHyphenedUuid as parseNonHyphenedUuid$1, getWorkersCIBranchName } from '@cloudflare/workers-utils';
14
14
  import { spawnSync, execSync, spawn } from 'node:child_process';
15
15
  import { FormData, Response } from 'undici';
16
16
  import chalk5 from 'chalk';
@@ -703,10 +703,10 @@ var require_heap2 = __commonJS({
703
703
  var require_difflib = __commonJS({
704
704
  "../../node_modules/.pnpm/@ewoudenberg+difflib@0.1.0/node_modules/@ewoudenberg/difflib/lib/difflib.js"(exports) {
705
705
  (function() {
706
- var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert8, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
706
+ var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert9, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
707
707
  ({ floor, max, min } = Math);
708
708
  Heap = require_heap2();
709
- assert8 = __require("assert");
709
+ assert9 = __require("assert");
710
710
  _calculateRatio = /* @__PURE__ */ __name(function(matches, length) {
711
711
  if (length) {
712
712
  return 2 * matches / length;
@@ -1277,7 +1277,7 @@ var require_difflib = __commonJS({
1277
1277
  }
1278
1278
  _plainReplace(a, alo, ahi, b, blo, bhi) {
1279
1279
  var first, g, l, len, len1, line, lines, m, ref, second;
1280
- assert8(alo < ahi && blo < bhi);
1280
+ assert9(alo < ahi && blo < bhi);
1281
1281
  if (bhi - blo < ahi - alo) {
1282
1282
  first = this._dump("+", b, blo, bhi);
1283
1283
  second = this._dump("-", a, alo, ahi);
@@ -9007,7 +9007,7 @@ var MAX_UPLOAD_ATTEMPTS = 5;
9007
9007
  var MAX_UPLOAD_GATEWAY_ERRORS = 5;
9008
9008
  var MAX_DIFF_LINES = 100;
9009
9009
  var syncAssets = /* @__PURE__ */ __name(async (complianceConfig, accountId, assetDirectory, scriptName, dispatchNamespace) => {
9010
- assert6(accountId, "Missing accountId");
9010
+ assert5(accountId, "Missing accountId");
9011
9011
  logger.info("\u{1F300} Building list of assets...");
9012
9012
  const manifest = await buildAssetManifest(assetDirectory);
9013
9013
  const url2 = dispatchNamespace ? `/accounts/${accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/assets-upload-session` : `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`;
@@ -10280,10 +10280,10 @@ function populateConfigPatch(diff, patchObj, targetEnvironment) {
10280
10280
  return;
10281
10281
  }
10282
10282
  if (Array.isArray(diff)) {
10283
- assert6(Array.isArray(patchObj));
10283
+ assert5(Array.isArray(patchObj));
10284
10284
  return populateConfigPatchArray(diff, patchObj);
10285
10285
  }
10286
- assert6(!Array.isArray(patchObj));
10286
+ assert5(!Array.isArray(patchObj));
10287
10287
  return populateConfigPatchObject(diff, patchObj, targetEnvironment);
10288
10288
  }
10289
10289
  __name(populateConfigPatch, "populateConfigPatch");
@@ -11150,7 +11150,7 @@ function createWorkerUploadForm(worker, bindings, options) {
11150
11150
  const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
11151
11151
  const hasManifest = modules?.some(({ name }) => name === manifestModuleName);
11152
11152
  if (hasManifest && main.type === "esm") {
11153
- assert6(modules !== void 0);
11153
+ assert5(modules !== void 0);
11154
11154
  const subDirs = new Set(
11155
11155
  modules.map((module) => path3__default.posix.dirname(module.name))
11156
11156
  );
@@ -11384,7 +11384,7 @@ async function downloadWorkerConfig(workerName, environment, entrypoint, account
11384
11384
  __name(downloadWorkerConfig, "downloadWorkerConfig");
11385
11385
  async function getMigrationsToUpload(scriptName, props) {
11386
11386
  const { config, accountId } = props;
11387
- assert6(accountId, "Missing accountId");
11387
+ assert5(accountId, "Missing accountId");
11388
11388
  let migrations;
11389
11389
  if (config.migrations.length > 0) {
11390
11390
  let script;
@@ -12650,6 +12650,875 @@ function warnOrError(type, remote) {
12650
12650
  }
12651
12651
  }
12652
12652
  __name(warnOrError, "warnOrError");
12653
+ var ProvisionResourceHandler = class {
12654
+ constructor(type, bindingName, binding, idField, complianceConfig, accountId) {
12655
+ this.type = type;
12656
+ this.bindingName = bindingName;
12657
+ this.binding = binding;
12658
+ this.idField = idField;
12659
+ this.complianceConfig = complianceConfig;
12660
+ this.accountId = accountId;
12661
+ }
12662
+ static {
12663
+ __name(this, "ProvisionResourceHandler");
12664
+ }
12665
+ inherit() {
12666
+ this.binding[this.idField] = INHERIT_SYMBOL;
12667
+ }
12668
+ connect(id) {
12669
+ this.binding[this.idField] = id;
12670
+ }
12671
+ async provision(name) {
12672
+ const id = await this.create(name);
12673
+ this.connect(id);
12674
+ }
12675
+ // This binding is fully specified and can't/shouldn't be provisioned.
12676
+ // This is usually when it has an id (e.g. D1 `database_id`).
12677
+ isFullySpecified() {
12678
+ return false;
12679
+ }
12680
+ // Does this binding need to be provisioned?
12681
+ // Some bindings are not fully specified, but don't need provisioning
12682
+ // (e.g. R2 binding, with a bucket_name that already exists).
12683
+ async isConnectedToExistingResource() {
12684
+ return false;
12685
+ }
12686
+ // Should this resource be provisioned?
12687
+ async shouldProvision(settings) {
12688
+ if (!this.isFullySpecified()) {
12689
+ if (await this.canInherit(settings)) {
12690
+ this.inherit();
12691
+ } else {
12692
+ const connected = await this.isConnectedToExistingResource();
12693
+ if (connected) {
12694
+ if (typeof connected === "string") {
12695
+ this.connect(connected);
12696
+ }
12697
+ return false;
12698
+ }
12699
+ return true;
12700
+ }
12701
+ }
12702
+ return false;
12703
+ }
12704
+ };
12705
+ var R2Handler = class extends ProvisionResourceHandler {
12706
+ static {
12707
+ __name(this, "R2Handler");
12708
+ }
12709
+ get name() {
12710
+ return this.binding.bucket_name;
12711
+ }
12712
+ async create(name) {
12713
+ await createR2Bucket(
12714
+ this.complianceConfig,
12715
+ this.accountId,
12716
+ name,
12717
+ void 0,
12718
+ this.binding.jurisdiction
12719
+ );
12720
+ return name;
12721
+ }
12722
+ constructor(bindingName, binding, complianceConfig, accountId) {
12723
+ super(
12724
+ "r2_bucket",
12725
+ bindingName,
12726
+ binding,
12727
+ "bucket_name",
12728
+ complianceConfig,
12729
+ accountId
12730
+ );
12731
+ }
12732
+ /**
12733
+ * Inheriting an R2 binding replaces the id property (bucket_name for R2) with the inheritance symbol.
12734
+ * This works when deploying (and is appropriate for all other binding types), but it means that the
12735
+ * bucket_name for an R2 bucket is not displayed when deploying. As such, only use the inheritance symbol
12736
+ * if the R2 binding has no `bucket_name`.
12737
+ */
12738
+ inherit() {
12739
+ this.binding.bucket_name ??= INHERIT_SYMBOL;
12740
+ }
12741
+ /**
12742
+ * R2 bindings can be inherited if the binding name and jurisdiction match.
12743
+ * Additionally, if the user has specified a bucket_name in config, make sure that matches.
12744
+ */
12745
+ canInherit(settings) {
12746
+ return !!settings?.bindings.find(
12747
+ (existing) => existing.type === this.type && existing.name === this.bindingName && existing.jurisdiction === this.binding.jurisdiction && (this.binding.bucket_name ? this.binding.bucket_name === existing.bucket_name : true)
12748
+ );
12749
+ }
12750
+ async isConnectedToExistingResource() {
12751
+ assert5(typeof this.binding.bucket_name !== "symbol");
12752
+ if (!this.binding.bucket_name) {
12753
+ return false;
12754
+ }
12755
+ try {
12756
+ await getR2Bucket(
12757
+ this.complianceConfig,
12758
+ this.accountId,
12759
+ this.binding.bucket_name,
12760
+ this.binding.jurisdiction
12761
+ );
12762
+ return true;
12763
+ } catch (e) {
12764
+ if (!(e instanceof APIError && e.code === 10006)) {
12765
+ throw e;
12766
+ }
12767
+ return false;
12768
+ }
12769
+ }
12770
+ };
12771
+ var AISearchNamespaceHandler = class extends ProvisionResourceHandler {
12772
+ static {
12773
+ __name(this, "AISearchNamespaceHandler");
12774
+ }
12775
+ get name() {
12776
+ return this.binding.namespace;
12777
+ }
12778
+ async create(name) {
12779
+ await createAISearchNamespace(this.complianceConfig, this.accountId, name);
12780
+ return name;
12781
+ }
12782
+ constructor(bindingName, binding, complianceConfig, accountId) {
12783
+ super(
12784
+ "ai_search_namespace",
12785
+ bindingName,
12786
+ binding,
12787
+ "namespace",
12788
+ complianceConfig,
12789
+ accountId
12790
+ );
12791
+ }
12792
+ canInherit(settings) {
12793
+ return !!settings?.bindings.find(
12794
+ (existing) => existing.type === this.type && existing.name === this.bindingName && (this.binding.namespace ? this.binding.namespace === existing.namespace : true)
12795
+ );
12796
+ }
12797
+ async isConnectedToExistingResource() {
12798
+ assert5(typeof this.binding.namespace !== "symbol");
12799
+ if (!this.binding.namespace) {
12800
+ return false;
12801
+ }
12802
+ const namespace = await getAISearchNamespace(
12803
+ this.complianceConfig,
12804
+ this.accountId,
12805
+ this.binding.namespace
12806
+ );
12807
+ return namespace !== null;
12808
+ }
12809
+ };
12810
+ var AgentMemoryNamespaceHandler = class extends ProvisionResourceHandler {
12811
+ static {
12812
+ __name(this, "AgentMemoryNamespaceHandler");
12813
+ }
12814
+ get name() {
12815
+ return this.binding.namespace;
12816
+ }
12817
+ async create(name) {
12818
+ await createAgentMemoryNamespace(
12819
+ this.complianceConfig,
12820
+ this.accountId,
12821
+ name
12822
+ );
12823
+ return name;
12824
+ }
12825
+ constructor(bindingName, binding, complianceConfig, accountId) {
12826
+ super(
12827
+ "agent_memory",
12828
+ bindingName,
12829
+ binding,
12830
+ "namespace",
12831
+ complianceConfig,
12832
+ accountId
12833
+ );
12834
+ }
12835
+ canInherit(settings) {
12836
+ return !!settings?.bindings.find(
12837
+ (existing) => existing.type === this.type && existing.name === this.bindingName && (this.binding.namespace ? this.binding.namespace === existing.namespace : true)
12838
+ );
12839
+ }
12840
+ async isConnectedToExistingResource() {
12841
+ assert5(typeof this.binding.namespace !== "symbol");
12842
+ if (!this.binding.namespace) {
12843
+ return false;
12844
+ }
12845
+ const namespace = await getAgentMemoryNamespace(
12846
+ this.complianceConfig,
12847
+ this.accountId,
12848
+ this.binding.namespace
12849
+ );
12850
+ return namespace !== null;
12851
+ }
12852
+ };
12853
+ var KVHandler = class extends ProvisionResourceHandler {
12854
+ static {
12855
+ __name(this, "KVHandler");
12856
+ }
12857
+ get name() {
12858
+ return void 0;
12859
+ }
12860
+ async create(name) {
12861
+ return await createKVNamespace(this.complianceConfig, this.accountId, name);
12862
+ }
12863
+ constructor(bindingName, binding, complianceConfig, accountId) {
12864
+ super(
12865
+ "kv_namespace",
12866
+ bindingName,
12867
+ binding,
12868
+ "id",
12869
+ complianceConfig,
12870
+ accountId
12871
+ );
12872
+ }
12873
+ canInherit(settings) {
12874
+ return !!settings?.bindings.find(
12875
+ (existing) => existing.type === this.type && existing.name === this.bindingName
12876
+ );
12877
+ }
12878
+ isFullySpecified() {
12879
+ return !!this.binding.id;
12880
+ }
12881
+ };
12882
+ var D1Handler = class extends ProvisionResourceHandler {
12883
+ static {
12884
+ __name(this, "D1Handler");
12885
+ }
12886
+ get name() {
12887
+ return this.binding.database_name;
12888
+ }
12889
+ async create(name) {
12890
+ const db = await createD1Database(
12891
+ this.complianceConfig,
12892
+ this.accountId,
12893
+ name
12894
+ );
12895
+ return db.uuid;
12896
+ }
12897
+ constructor(bindingName, binding, complianceConfig, accountId) {
12898
+ super(
12899
+ "d1",
12900
+ bindingName,
12901
+ binding,
12902
+ "database_id",
12903
+ complianceConfig,
12904
+ accountId
12905
+ );
12906
+ }
12907
+ async canInherit(settings) {
12908
+ const maybeInherited = settings?.bindings.find(
12909
+ (existing) => existing.type === this.type && existing.name === this.bindingName
12910
+ );
12911
+ if (maybeInherited) {
12912
+ if (!this.binding.database_name) {
12913
+ return true;
12914
+ }
12915
+ const dbFromId = await getDatabaseInfoFromIdOrName(
12916
+ this.complianceConfig,
12917
+ this.accountId,
12918
+ maybeInherited.id
12919
+ );
12920
+ if (this.binding.database_name === dbFromId.name) {
12921
+ return true;
12922
+ }
12923
+ }
12924
+ return false;
12925
+ }
12926
+ async isConnectedToExistingResource() {
12927
+ assert5(typeof this.binding.database_name !== "symbol");
12928
+ if (!this.binding.database_name) {
12929
+ return false;
12930
+ }
12931
+ try {
12932
+ const db = await getDatabaseInfoFromIdOrName(
12933
+ this.complianceConfig,
12934
+ this.accountId,
12935
+ this.binding.database_name
12936
+ );
12937
+ return db.uuid;
12938
+ } catch (e) {
12939
+ if (!(e instanceof APIError && e.code === 7404)) {
12940
+ throw e;
12941
+ }
12942
+ return false;
12943
+ }
12944
+ }
12945
+ isFullySpecified() {
12946
+ return !!this.binding.database_id;
12947
+ }
12948
+ };
12949
+ var HANDLERS = {
12950
+ kv_namespace: {
12951
+ Handler: KVHandler,
12952
+ sort: 0,
12953
+ name: "KV Namespace",
12954
+ keyDescription: "title or id",
12955
+ configField: "kv_namespaces",
12956
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
12957
+ const preExistingKV = await listKVNamespaces(
12958
+ complianceConfig,
12959
+ accountId,
12960
+ true
12961
+ );
12962
+ return preExistingKV.map((ns) => ({ title: ns.title, value: ns.id }));
12963
+ }, "load"),
12964
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
12965
+ const { type: _, ...rest } = binding;
12966
+ return {
12967
+ ...rest,
12968
+ binding: bindingName
12969
+ };
12970
+ }, "toConfig")
12971
+ },
12972
+ d1: {
12973
+ Handler: D1Handler,
12974
+ sort: 1,
12975
+ name: "D1 Database",
12976
+ keyDescription: "name or id",
12977
+ configField: "d1_databases",
12978
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
12979
+ const preExisting = await listDatabases(
12980
+ complianceConfig,
12981
+ accountId,
12982
+ true,
12983
+ 1e3
12984
+ );
12985
+ return preExisting.map((db) => ({ title: db.name, value: db.uuid }));
12986
+ }, "load"),
12987
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
12988
+ const { type: _, ...rest } = binding;
12989
+ return {
12990
+ ...rest,
12991
+ binding: bindingName
12992
+ };
12993
+ }, "toConfig")
12994
+ },
12995
+ r2_bucket: {
12996
+ Handler: R2Handler,
12997
+ sort: 2,
12998
+ name: "R2 Bucket",
12999
+ keyDescription: "name",
13000
+ configField: "r2_buckets",
13001
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
13002
+ const preExisting = await listR2Buckets(complianceConfig, accountId);
13003
+ return preExisting.map((bucket) => ({
13004
+ title: bucket.name,
13005
+ value: bucket.name
13006
+ }));
13007
+ }, "load"),
13008
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
13009
+ const { type: _, ...rest } = binding;
13010
+ return {
13011
+ ...rest,
13012
+ binding: bindingName
13013
+ };
13014
+ }, "toConfig")
13015
+ },
13016
+ ai_search_namespace: {
13017
+ Handler: AISearchNamespaceHandler,
13018
+ sort: 3,
13019
+ name: "AI Search Namespace",
13020
+ keyDescription: "namespace name",
13021
+ configField: "ai_search_namespaces",
13022
+ load: /* @__PURE__ */ __name(async (_complianceConfig, _accountId) => {
13023
+ return [];
13024
+ }, "load"),
13025
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
13026
+ const { type: _, ...rest } = binding;
13027
+ return {
13028
+ ...rest,
13029
+ binding: bindingName
13030
+ };
13031
+ }, "toConfig")
13032
+ },
13033
+ agent_memory: {
13034
+ Handler: AgentMemoryNamespaceHandler,
13035
+ sort: 4,
13036
+ name: "Agent Memory",
13037
+ keyDescription: "namespace name",
13038
+ configField: "agent_memory",
13039
+ load: /* @__PURE__ */ __name(async (_complianceConfig, _accountId) => {
13040
+ return [];
13041
+ }, "load"),
13042
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
13043
+ const { type: _, ...rest } = binding;
13044
+ return {
13045
+ ...rest,
13046
+ binding: bindingName
13047
+ };
13048
+ }, "toConfig")
13049
+ }
13050
+ };
13051
+ function isProvisionableBinding(binding) {
13052
+ return binding.type in HANDLERS;
13053
+ }
13054
+ __name(isProvisionableBinding, "isProvisionableBinding");
13055
+ function createHandler(bindingName, binding, complianceConfig, accountId) {
13056
+ switch (binding.type) {
13057
+ case "kv_namespace":
13058
+ return new KVHandler(bindingName, binding, complianceConfig, accountId);
13059
+ case "d1":
13060
+ return new D1Handler(bindingName, binding, complianceConfig, accountId);
13061
+ case "r2_bucket":
13062
+ return new R2Handler(bindingName, binding, complianceConfig, accountId);
13063
+ case "ai_search_namespace":
13064
+ return new AISearchNamespaceHandler(
13065
+ bindingName,
13066
+ binding,
13067
+ complianceConfig,
13068
+ accountId
13069
+ );
13070
+ case "agent_memory":
13071
+ return new AgentMemoryNamespaceHandler(
13072
+ bindingName,
13073
+ binding,
13074
+ complianceConfig,
13075
+ accountId
13076
+ );
13077
+ }
13078
+ }
13079
+ __name(createHandler, "createHandler");
13080
+ function toConfigBinding(bindingName, binding) {
13081
+ switch (binding.type) {
13082
+ case "kv_namespace":
13083
+ return HANDLERS.kv_namespace.toConfig(bindingName, binding);
13084
+ case "d1":
13085
+ return HANDLERS.d1.toConfig(bindingName, binding);
13086
+ case "r2_bucket":
13087
+ return HANDLERS.r2_bucket.toConfig(bindingName, binding);
13088
+ case "ai_search_namespace":
13089
+ return HANDLERS.ai_search_namespace.toConfig(bindingName, binding);
13090
+ case "agent_memory":
13091
+ return HANDLERS.agent_memory.toConfig(bindingName, binding);
13092
+ }
13093
+ }
13094
+ __name(toConfigBinding, "toConfigBinding");
13095
+ async function collectPendingResources(complianceConfig, accountId, scriptName, bindings) {
13096
+ let settings;
13097
+ try {
13098
+ settings = await getSettings(complianceConfig, accountId, scriptName);
13099
+ } catch {
13100
+ logger.debug("No settings found");
13101
+ }
13102
+ const pendingResources = [];
13103
+ for (const [bindingName, binding] of Object.entries(bindings ?? {})) {
13104
+ if (!isProvisionableBinding(binding)) {
13105
+ continue;
13106
+ }
13107
+ const handler = createHandler(
13108
+ bindingName,
13109
+ binding,
13110
+ complianceConfig,
13111
+ accountId
13112
+ );
13113
+ if (await handler.shouldProvision(settings)) {
13114
+ pendingResources.push({
13115
+ binding: bindingName,
13116
+ resourceType: binding.type,
13117
+ handler
13118
+ });
13119
+ }
13120
+ }
13121
+ return pendingResources.sort(
13122
+ (a, b) => HANDLERS[a.resourceType].sort - HANDLERS[b.resourceType].sort
13123
+ );
13124
+ }
13125
+ __name(collectPendingResources, "collectPendingResources");
13126
+ async function provisionBindings(bindings, accountId, scriptName, autoCreate, config, options) {
13127
+ const configPath = config.userConfigPath ?? config.configPath;
13128
+ const pendingResources = await collectPendingResources(
13129
+ config,
13130
+ accountId,
13131
+ scriptName,
13132
+ bindings
13133
+ );
13134
+ if (pendingResources.length > 0) {
13135
+ assert5(
13136
+ configPath,
13137
+ "Provisioning resources is not possible without a config file"
13138
+ );
13139
+ if (useServiceEnvironments(config)) {
13140
+ throw new UserError$1(
13141
+ "Provisioning resources is not supported with a service environment",
13142
+ { telemetryMessage: "provision resources with service environment" }
13143
+ );
13144
+ }
13145
+ logger.log();
13146
+ printBindings(
13147
+ Object.fromEntries(
13148
+ pendingResources.map((resource) => [
13149
+ resource.binding,
13150
+ { type: resource.resourceType }
13151
+ ])
13152
+ ),
13153
+ config.tail_consumers,
13154
+ config.streaming_tail_consumers,
13155
+ config.containers,
13156
+ { provisioning: true }
13157
+ );
13158
+ logger.log();
13159
+ const existingResources = {};
13160
+ for (const resource of pendingResources) {
13161
+ existingResources[resource.resourceType] ??= await HANDLERS[resource.resourceType].load(config, accountId);
13162
+ await runProvisioningFlow(
13163
+ resource,
13164
+ existingResources[resource.resourceType],
13165
+ HANDLERS[resource.resourceType].name,
13166
+ scriptName,
13167
+ autoCreate
13168
+ );
13169
+ }
13170
+ const patch = {};
13171
+ const existingBindingNames = /* @__PURE__ */ new Set();
13172
+ const isUsingRedirectedConfig = config.userConfigPath && config.userConfigPath !== config.configPath;
13173
+ if (isUsingRedirectedConfig) {
13174
+ const { rawConfig: unredirectedConfig } = await experimental_readRawConfig(
13175
+ { config: config.userConfigPath },
13176
+ { useRedirectIfAvailable: false }
13177
+ );
13178
+ for (const resourceType of Object.keys(
13179
+ HANDLERS
13180
+ )) {
13181
+ const configField = HANDLERS[resourceType].configField;
13182
+ for (const binding of unredirectedConfig[configField] ?? []) {
13183
+ existingBindingNames.add(binding.binding);
13184
+ }
13185
+ }
13186
+ }
13187
+ for (const [bindingName, binding] of Object.entries(bindings ?? {})) {
13188
+ if (!isProvisionableBinding(binding)) {
13189
+ continue;
13190
+ }
13191
+ if (isUsingRedirectedConfig && !existingBindingNames.has(bindingName)) {
13192
+ continue;
13193
+ }
13194
+ const resourceType = HANDLERS[binding.type].configField;
13195
+ patch[resourceType] ??= [];
13196
+ const bindingToWrite = toConfigBinding(bindingName, binding);
13197
+ patch[resourceType].push(
13198
+ Object.fromEntries(
13199
+ Object.entries(bindingToWrite).filter(
13200
+ // Make sure all the values are JSON serialisable.
13201
+ // Otherwise we end up with "undefined" in the config.
13202
+ ([_, value]) => typeof value === "string"
13203
+ )
13204
+ )
13205
+ );
13206
+ }
13207
+ if (options.skipConfigWriteback) {
13208
+ logger.log(
13209
+ "Your Worker was deployed with provisioned resources. You may add the resource IDs to your config file if you wish, but future deploys will continue to work even without IDs."
13210
+ );
13211
+ } else if (!isNonInteractiveOrCI()) {
13212
+ try {
13213
+ await experimental_patchConfig(configPath, patch, false);
13214
+ logger.log(
13215
+ "Your Worker was deployed with provisioned resources. We've written the IDs of these resources to your config file, which you can choose to save or discard. Either way future deploys will continue to work."
13216
+ );
13217
+ } catch (e) {
13218
+ if (!(e instanceof PatchConfigError)) {
13219
+ throw e;
13220
+ }
13221
+ }
13222
+ }
13223
+ logger.log(`\u{1F389} All resources provisioned, continuing with deployment...
13224
+ `);
13225
+ }
13226
+ }
13227
+ __name(provisionBindings, "provisionBindings");
13228
+ function getSettings(complianceConfig, accountId, scriptName) {
13229
+ return fetchResult(
13230
+ complianceConfig,
13231
+ `/accounts/${accountId}/workers/scripts/${scriptName}/settings`
13232
+ );
13233
+ }
13234
+ __name(getSettings, "getSettings");
13235
+ function printDivider() {
13236
+ logger.log();
13237
+ }
13238
+ __name(printDivider, "printDivider");
13239
+ async function runProvisioningFlow(item, preExisting, friendlyBindingName, scriptName, autoCreate) {
13240
+ const NEW_OPTION_VALUE = "__WRANGLER_INTERNAL_NEW";
13241
+ const SEARCH_OPTION_VALUE = "__WRANGLER_INTERNAL_SEARCH";
13242
+ const MAX_OPTIONS = 4;
13243
+ const options = preExisting.slice(0, MAX_OPTIONS - 1);
13244
+ if (options.length < preExisting.length) {
13245
+ options.push({
13246
+ title: "Other (too many to list)",
13247
+ value: SEARCH_OPTION_VALUE
13248
+ });
13249
+ }
13250
+ const defaultName = autoProvisionedResourceName(scriptName, item.binding);
13251
+ logger.log("Provisioning", item.binding, `(${friendlyBindingName})...`);
13252
+ if (item.handler.name) {
13253
+ logger.log("Resource name found in config:", item.handler.name);
13254
+ logger.log(
13255
+ `\u{1F300} Creating new ${friendlyBindingName} "${item.handler.name}"...`
13256
+ );
13257
+ await item.handler.provision(item.handler.name);
13258
+ } else if (autoCreate) {
13259
+ logger.log(`\u{1F300} Creating new ${friendlyBindingName} "${defaultName}"...`);
13260
+ await item.handler.provision(defaultName);
13261
+ } else {
13262
+ let action = NEW_OPTION_VALUE;
13263
+ if (options.length > 0) {
13264
+ action = await select(
13265
+ `Would you like to connect an existing ${friendlyBindingName} or create a new one?`,
13266
+ {
13267
+ choices: options.concat([
13268
+ { title: "Create new", value: NEW_OPTION_VALUE }
13269
+ ]),
13270
+ defaultOption: options.length,
13271
+ fallbackOption: options.length
13272
+ }
13273
+ );
13274
+ }
13275
+ if (action === NEW_OPTION_VALUE) {
13276
+ const name = await prompt(
13277
+ `Enter a name for your new ${friendlyBindingName}`,
13278
+ {
13279
+ defaultValue: defaultName
13280
+ }
13281
+ );
13282
+ logger.log(`\u{1F300} Creating new ${friendlyBindingName} "${name}"...`);
13283
+ await item.handler.provision(name);
13284
+ } else if (action === SEARCH_OPTION_VALUE) {
13285
+ let foundResource;
13286
+ while (foundResource === void 0) {
13287
+ const input = await prompt(
13288
+ `Enter the ${HANDLERS[item.resourceType].keyDescription} for an existing ${friendlyBindingName}`
13289
+ );
13290
+ foundResource = preExisting.find(
13291
+ (resource) => resource.title === input || resource.value === input
13292
+ );
13293
+ if (foundResource) {
13294
+ item.handler.connect(foundResource.value);
13295
+ } else {
13296
+ logger.log(
13297
+ `No ${friendlyBindingName} with that ${HANDLERS[item.resourceType].keyDescription} "${input}" found. Please try again.`
13298
+ );
13299
+ }
13300
+ }
13301
+ } else {
13302
+ item.handler.connect(action);
13303
+ }
13304
+ }
13305
+ logger.log(`\u2728 ${item.binding} provisioned \u{1F389}`);
13306
+ printDivider();
13307
+ }
13308
+ __name(runProvisioningFlow, "runProvisioningFlow");
13309
+ function autoProvisionedResourceName(scriptName, bindingName) {
13310
+ return `${scriptName}-${bindingName.toLowerCase().replaceAll("_", "-")}`;
13311
+ }
13312
+ __name(autoProvisionedResourceName, "autoProvisionedResourceName");
13313
+ async function createKVNamespace(complianceConfig, accountId, title) {
13314
+ const response = await fetchResult(
13315
+ complianceConfig,
13316
+ `/accounts/${accountId}/storage/kv/namespaces`,
13317
+ {
13318
+ method: "POST",
13319
+ headers: {
13320
+ "Content-Type": "application/json"
13321
+ },
13322
+ body: JSON.stringify({
13323
+ title
13324
+ })
13325
+ }
13326
+ );
13327
+ return response.id;
13328
+ }
13329
+ __name(createKVNamespace, "createKVNamespace");
13330
+ async function listKVNamespaces(complianceConfig, accountId, limitCalls = false) {
13331
+ const pageSize = 100;
13332
+ let page = 1;
13333
+ const results = [];
13334
+ while (results.length % pageSize === 0) {
13335
+ const json2 = await fetchResult(
13336
+ complianceConfig,
13337
+ `/accounts/${accountId}/storage/kv/namespaces`,
13338
+ {},
13339
+ new URLSearchParams({
13340
+ per_page: pageSize.toString(),
13341
+ order: "title",
13342
+ direction: "asc",
13343
+ page: page.toString()
13344
+ })
13345
+ );
13346
+ page++;
13347
+ results.push(...json2);
13348
+ if (limitCalls) {
13349
+ break;
13350
+ }
13351
+ if (json2.length < pageSize) {
13352
+ break;
13353
+ }
13354
+ }
13355
+ return results;
13356
+ }
13357
+ __name(listKVNamespaces, "listKVNamespaces");
13358
+ async function createD1Database(complianceConfig, accountId, name) {
13359
+ try {
13360
+ return await fetchResult(
13361
+ complianceConfig,
13362
+ `/accounts/${accountId}/d1/database`,
13363
+ {
13364
+ method: "POST",
13365
+ headers: {
13366
+ "Content-Type": "application/json"
13367
+ },
13368
+ body: JSON.stringify({ name })
13369
+ }
13370
+ );
13371
+ } catch (e) {
13372
+ const errorCode = e.code;
13373
+ if (errorCode === 7502) {
13374
+ throw new UserError$1("A database with that name already exists", {
13375
+ telemetryMessage: "d1 create database already exists"
13376
+ });
13377
+ }
13378
+ if (errorCode === 7406) {
13379
+ throw new UserError$1(
13380
+ "You have reached the maximum number of D1 databases for your account. Please consider deleting unused databases, or visit the D1 documentation to learn more: https://developers.cloudflare.com/d1/",
13381
+ { telemetryMessage: "d1 create database limit reached" }
13382
+ );
13383
+ }
13384
+ throw e;
13385
+ }
13386
+ }
13387
+ __name(createD1Database, "createD1Database");
13388
+ async function listDatabases(complianceConfig, accountId, limitCalls = false, pageSize = 10) {
13389
+ let page = 1;
13390
+ const results = [];
13391
+ while (results.length % pageSize === 0) {
13392
+ const json2 = await fetchResult(
13393
+ complianceConfig,
13394
+ `/accounts/${accountId}/d1/database`,
13395
+ {},
13396
+ new URLSearchParams({
13397
+ per_page: pageSize.toString(),
13398
+ page: page.toString()
13399
+ })
13400
+ );
13401
+ page++;
13402
+ results.push(...json2);
13403
+ if (limitCalls && page > 3) {
13404
+ break;
13405
+ }
13406
+ if (json2.length < pageSize) {
13407
+ break;
13408
+ }
13409
+ }
13410
+ return results;
13411
+ }
13412
+ __name(listDatabases, "listDatabases");
13413
+ async function getDatabaseInfoFromIdOrName(complianceConfig, accountId, databaseIdOrName) {
13414
+ return await fetchResult(
13415
+ complianceConfig,
13416
+ `/accounts/${accountId}/d1/database/${databaseIdOrName}`,
13417
+ {
13418
+ headers: {
13419
+ "Content-Type": "application/json"
13420
+ }
13421
+ }
13422
+ );
13423
+ }
13424
+ __name(getDatabaseInfoFromIdOrName, "getDatabaseInfoFromIdOrName");
13425
+ async function listR2Buckets(complianceConfig, accountId, jurisdiction) {
13426
+ const headers = {};
13427
+ if (jurisdiction !== void 0) {
13428
+ headers["cf-r2-jurisdiction"] = jurisdiction;
13429
+ }
13430
+ const results = await fetchResult(complianceConfig, `/accounts/${accountId}/r2/buckets`, { headers });
13431
+ return results.buckets;
13432
+ }
13433
+ __name(listR2Buckets, "listR2Buckets");
13434
+ async function getR2Bucket(complianceConfig, accountId, bucketName, jurisdiction) {
13435
+ const headers = {};
13436
+ if (jurisdiction !== void 0) {
13437
+ headers["cf-r2-jurisdiction"] = jurisdiction;
13438
+ }
13439
+ return await fetchResult(
13440
+ complianceConfig,
13441
+ `/accounts/${accountId}/r2/buckets/${bucketName}`,
13442
+ {
13443
+ method: "GET",
13444
+ headers
13445
+ }
13446
+ );
13447
+ }
13448
+ __name(getR2Bucket, "getR2Bucket");
13449
+ async function createR2Bucket(complianceConfig, accountId, bucketName, location, jurisdiction, storageClass) {
13450
+ const headers = {};
13451
+ if (jurisdiction !== void 0) {
13452
+ headers["cf-r2-jurisdiction"] = jurisdiction;
13453
+ }
13454
+ return await fetchResult(
13455
+ complianceConfig,
13456
+ `/accounts/${accountId}/r2/buckets`,
13457
+ {
13458
+ method: "POST",
13459
+ body: JSON.stringify({
13460
+ name: bucketName,
13461
+ ...storageClass !== void 0 && { storageClass },
13462
+ ...location !== void 0 && { locationHint: location }
13463
+ }),
13464
+ headers
13465
+ }
13466
+ );
13467
+ }
13468
+ __name(createR2Bucket, "createR2Bucket");
13469
+ async function getAISearchNamespace(complianceConfig, accountId, namespaceName) {
13470
+ try {
13471
+ return await fetchResult(
13472
+ complianceConfig,
13473
+ `/accounts/${accountId}/ai-search/namespaces/${namespaceName}`,
13474
+ { method: "GET" }
13475
+ );
13476
+ } catch (e) {
13477
+ if (e instanceof APIError && e.status === 404) {
13478
+ return null;
13479
+ }
13480
+ throw e;
13481
+ }
13482
+ }
13483
+ __name(getAISearchNamespace, "getAISearchNamespace");
13484
+ async function createAISearchNamespace(complianceConfig, accountId, namespaceName) {
13485
+ await fetchResult(
13486
+ complianceConfig,
13487
+ `/accounts/${accountId}/ai-search/namespaces`,
13488
+ {
13489
+ method: "POST",
13490
+ headers: { "Content-Type": "application/json" },
13491
+ body: JSON.stringify({ name: namespaceName })
13492
+ }
13493
+ );
13494
+ }
13495
+ __name(createAISearchNamespace, "createAISearchNamespace");
13496
+ async function getAgentMemoryNamespace(complianceConfig, accountId, namespaceName) {
13497
+ try {
13498
+ return await fetchResult(
13499
+ complianceConfig,
13500
+ `/accounts/${accountId}/agent-memory/namespaces/${namespaceName}`
13501
+ );
13502
+ } catch (e) {
13503
+ if (e instanceof APIError && e.status === 404) {
13504
+ return null;
13505
+ }
13506
+ throw e;
13507
+ }
13508
+ }
13509
+ __name(getAgentMemoryNamespace, "getAgentMemoryNamespace");
13510
+ async function createAgentMemoryNamespace(complianceConfig, accountId, namespaceName) {
13511
+ await fetchResult(
13512
+ complianceConfig,
13513
+ `/accounts/${accountId}/agent-memory/namespaces`,
13514
+ {
13515
+ method: "POST",
13516
+ headers: { "Content-Type": "application/json" },
13517
+ body: JSON.stringify({ name: namespaceName })
13518
+ }
13519
+ );
13520
+ }
13521
+ __name(createAgentMemoryNamespace, "createAgentMemoryNamespace");
12653
13522
 
12654
13523
  // src/deploy/helpers/error-codes.ts
12655
13524
  var INVALID_INHERIT_BINDING_CODE = 10057;
@@ -12808,7 +13677,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
12808
13677
  }
12809
13678
  });
12810
13679
  sourceMappingPrepareStackTrace = Error.prepareStackTrace;
12811
- assert6(sourceMappingPrepareStackTrace !== void 0);
13680
+ assert5(sourceMappingPrepareStackTrace !== void 0);
12812
13681
  Error.prepareStackTrace = originalPrepareStackTrace;
12813
13682
  return sourceMappingPrepareStackTrace;
12814
13683
  }
@@ -12839,23 +13708,38 @@ function callFrameToCallSite(frame) {
12839
13708
  });
12840
13709
  }
12841
13710
  __name(callFrameToCallSite, "callFrameToCallSite");
13711
+ function tryPrepareStack(prepareStack, error, callSites) {
13712
+ try {
13713
+ return prepareStack(error, callSites);
13714
+ } catch (err) {
13715
+ logger?.debug(
13716
+ `Source map application failed, falling back to original stack trace: ${err}`
13717
+ );
13718
+ return null;
13719
+ }
13720
+ }
13721
+ __name(tryPrepareStack, "tryPrepareStack");
12842
13722
  var placeholderError = new Error();
12843
13723
  function getSourceMappedString(value, retrieveSourceMap) {
12844
13724
  const callSiteLines = Array.from(value.matchAll(CALL_SITE_REGEXP));
12845
13725
  const callSites = callSiteLines.map(lineMatchToCallSite);
12846
13726
  const prepareStack = getSourceMappingPrepareStackTrace(retrieveSourceMap);
12847
- const sourceMappedStackTrace = prepareStack(
13727
+ const sourceMappedStackTrace = tryPrepareStack(
13728
+ prepareStack,
12848
13729
  placeholderError,
12849
13730
  callSites
12850
13731
  );
13732
+ if (sourceMappedStackTrace === null) {
13733
+ return value;
13734
+ }
12851
13735
  const sourceMappedCallSiteLines = sourceMappedStackTrace.split("\n").slice(1);
12852
13736
  for (let i = 0; i < callSiteLines.length; i++) {
12853
- if (callSites[i].getFileName() === void 0) {
13737
+ if (callSites[i].getFileName() === null) {
12854
13738
  continue;
12855
13739
  }
12856
13740
  const callSiteLine = callSiteLines[i][0];
12857
13741
  const callSiteAtIndex = callSiteLine.indexOf("at");
12858
- assert6(callSiteAtIndex !== -1);
13742
+ assert5(callSiteAtIndex !== -1);
12859
13743
  const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
12860
13744
  value = value.replace(
12861
13745
  callSiteLine,
@@ -13080,7 +13964,7 @@ async function deploy(props, config, buildResult, callbacks) {
13080
13964
  } = props;
13081
13965
  const assetsOptions = resolveAssetOptions(props, config);
13082
13966
  if (!props.dryRun) {
13083
- assert6(accountId, "Missing account ID");
13967
+ assert5(accountId, "Missing account ID");
13084
13968
  await verifyWorkerMatchesCITag(config, accountId, name, config.configPath);
13085
13969
  }
13086
13970
  const deployConfirm = getDeployConfirmFunction({
@@ -13194,7 +14078,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
13194
14078
  }
13195
14079
  validateRoutes(allDeploymentRoutes, assetsOptions);
13196
14080
  const scriptName = name;
13197
- assert6(
14081
+ assert5(
13198
14082
  !config.site || config.site.bucket,
13199
14083
  "A [site] definition requires a `bucket` field with a path to the site's assets directory."
13200
14084
  );
@@ -13410,16 +14294,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
13410
14294
  { warnIfNoBindings: true, unsafeMetadata: config.unsafe?.metadata }
13411
14295
  );
13412
14296
  } else {
13413
- assert6(accountId, "Missing accountId");
14297
+ assert5(accountId, "Missing accountId");
13414
14298
  if (assetsOptions?.routerConfig.has_user_worker === false) {
13415
14299
  logger.debug("skipping provisioning on assets-only project");
13416
- } else if (props.resourcesProvision && callbacks.provisionBindings) {
13417
- await callbacks.provisionBindings(
14300
+ } else if (props.resourcesProvision) {
14301
+ await provisionBindings(
13418
14302
  bindings ?? {},
13419
14303
  accountId,
13420
14304
  scriptName,
13421
14305
  props.experimentalAutoCreate,
13422
- config
14306
+ config,
14307
+ {
14308
+ skipConfigWriteback: props.skipProvisioningConfigWriteback
14309
+ }
13423
14310
  );
13424
14311
  }
13425
14312
  workerBundle = createWorkerUploadForm(
@@ -13616,7 +14503,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
13616
14503
  const uploadMs = Date.now() - start;
13617
14504
  logger.log("Uploaded", workerName, formatTime(uploadMs));
13618
14505
  if (normalisedContainerConfig.length && props.containersRollout !== "none" && callbacks.deployContainers) {
13619
- assert6(versionId && accountId);
14506
+ assert5(versionId && accountId);
13620
14507
  await callbacks.deployContainers(config, normalisedContainerConfig, {
13621
14508
  versionId,
13622
14509
  accountId,
@@ -13627,7 +14514,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
13627
14514
  deployWfpUserWorker(props.dispatchNamespace, versionId);
13628
14515
  return { versionId, workerTag };
13629
14516
  }
13630
- assert6(accountId);
14517
+ assert5(accountId);
13631
14518
  const targets = await triggersDeploy({
13632
14519
  config,
13633
14520
  accountId,
@@ -13664,7 +14551,7 @@ async function versionsUpload(props, config, buildResult, callbacks) {
13664
14551
  } = props;
13665
14552
  const assetsOptions = resolveAssetOptions(props, config);
13666
14553
  if (!props.dryRun) {
13667
- assert6(accountId, "Missing account ID");
14554
+ assert5(accountId, "Missing account ID");
13668
14555
  await verifyWorkerMatchesCITag(config, accountId, name, config.configPath);
13669
14556
  }
13670
14557
  let versionId = null;
@@ -13864,16 +14751,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
13864
14751
  { unsafeMetadata: config.unsafe?.metadata }
13865
14752
  );
13866
14753
  } else {
13867
- assert6(accountId, "Missing accountId");
14754
+ assert5(accountId, "Missing accountId");
13868
14755
  if (assetsOptions?.routerConfig.has_user_worker === false) {
13869
14756
  logger.debug("skipping provisioning on assets-only project");
13870
- } else if (props.resourcesProvision && callbacks.provisionBindings) {
13871
- await callbacks.provisionBindings(
14757
+ } else if (props.resourcesProvision) {
14758
+ await provisionBindings(
13872
14759
  bindings,
13873
14760
  accountId,
13874
14761
  scriptName,
13875
14762
  props.experimentalAutoCreate,
13876
- config
14763
+ config,
14764
+ {
14765
+ skipConfigWriteback: props.skipProvisioningConfigWriteback
14766
+ }
13877
14767
  );
13878
14768
  }
13879
14769
  workerBundle = createWorkerUploadForm(worker, bindings, {
@@ -14117,4 +15007,4 @@ __name(validateNodeCompatMode, "validateNodeCompatMode");
14117
15007
  * THE SOFTWARE.
14118
15008
  */
14119
15009
 
14120
- export { INVALID_INHERIT_BINDING_CODE, InputWorkerSchema, NoInputError, OutputWorkerSchema, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, confirmLatestDeploymentOverwrite, convertConfigToBindings, convertToWranglerConfig, createDeployment, createTruncatedAlias, createWorkerUploadForm, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, ensureQueuesExistByConfig, extractBindingsOfType, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, fromMimeType, generatePreviewAlias, getBindings, getBranchName, getConfigPatch, getDeployConfirmFunction, getMigrationsToUpload, getQueue, getRemoteConfigDiff, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, moduleTypeMimeType, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, printBindings, printBundleSize, printVersions, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderRoute, resolveAssetOptions, sanitizeBranchName, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, useServiceEnvironments, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };
15010
+ export { INVALID_INHERIT_BINDING_CODE, InputWorkerSchema, NoInputError, OutputWorkerSchema, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, confirmLatestDeploymentOverwrite, convertConfigToBindings, convertToWranglerConfig, createDeployment, createTruncatedAlias, createWorkerUploadForm, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, ensureQueuesExistByConfig, extractBindingsOfType, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, fromMimeType, generatePreviewAlias, getBindings, getBranchName, getConfigPatch, getDeployConfirmFunction, getMigrationsToUpload, getQueue, getRemoteConfigDiff, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, moduleTypeMimeType, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderRoute, resolveAssetOptions, sanitizeBranchName, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, useServiceEnvironments, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };