@cloudflare/workers-utils 0.39.0 → 0.39.1
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/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-5H6GBNUC.mjs → chunk-YZWVNJ5I.mjs} +1 -1
- package/dist/{compliance-yQnxg2l5.d.mts → compliance-Cd7XSPJW.d.mts} +2 -2
- package/dist/compliance.d.mts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +66 -54
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +1 -1
- package/package.json +3 -3
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bf as TailConsumer, bj as WorkerMetadata, R as RawConfig } from './compliance-
|
|
1
|
+
import { bf as TailConsumer, bj as WorkerMetadata, R as RawConfig } from './compliance-Cd7XSPJW.mjs';
|
|
2
2
|
import { AssetConfig } from '@cloudflare/workers-shared';
|
|
3
3
|
import { Cloudflare } from 'cloudflare';
|
|
4
4
|
import 'node:url';
|
package/dist/browser.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { constructWranglerConfig } from './chunk-
|
|
1
|
+
export { constructWranglerConfig } from './chunk-YZWVNJ5I.mjs';
|
|
2
2
|
import './chunk-Q72B4Q5Z.mjs';
|
|
@@ -3384,11 +3384,11 @@ type ContainerEngine = {
|
|
|
3384
3384
|
*
|
|
3385
3385
|
* The `previews` block contains any intentionally divergent configuration intended solely for Previews, including:
|
|
3386
3386
|
* - All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)
|
|
3387
|
-
* - Select inheritable properties: `logpush`, `observability`, `limits`, `cache`
|
|
3387
|
+
* - Select inheritable properties: `logpush`, `observability`, `limits`, `placement`, `cache`
|
|
3388
3388
|
*
|
|
3389
3389
|
* @inheritable
|
|
3390
3390
|
*/
|
|
3391
|
-
interface PreviewsConfig extends Partial<EnvironmentNonInheritable>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "cache">> {
|
|
3391
|
+
interface PreviewsConfig extends Partial<EnvironmentNonInheritable>, Partial<Pick<EnvironmentInheritable, "logpush" | "observability" | "limits" | "placement" | "cache">> {
|
|
3392
3392
|
}
|
|
3393
3393
|
|
|
3394
3394
|
/**
|
package/dist/compliance.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { q as COMPLIANCE_REGION_CONFIG_PUBLIC, r as COMPLIANCE_REGION_CONFIG_UNKNOWN, f as ComplianceConfig, bF as getCloudflareApiBaseUrl, bH as getCloudflareComplianceRegion, bI as getCloudflareContainerRegistry, bN as getComplianceRegionSubdomain } from './compliance-
|
|
1
|
+
export { q as COMPLIANCE_REGION_CONFIG_PUBLIC, r as COMPLIANCE_REGION_CONFIG_UNKNOWN, f as ComplianceConfig, bF as getCloudflareApiBaseUrl, bH as getCloudflareComplianceRegion, bI as getCloudflareContainerRegistry, bN as getComplianceRegionSubdomain } from './compliance-Cd7XSPJW.mjs';
|
|
2
2
|
import 'node:url';
|
|
3
3
|
import 'undici';
|
|
4
4
|
import '@cloudflare/workers-shared';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as ContainerApp, d as WorkerMetadataBinding, e as CfTailConsumer, L as Logger, A as ApiCredentials, f as ComplianceConfig, g as Route } from './compliance-
|
|
2
|
-
export { h as ARTIFACTS_EVENT_TYPES, i as Access, j as ArtifactsEventTrigger, k as ArtifactsEventType, l as AssetConfigMetadata, m as Assets, n as AssetsOptions, o as AsyncHook, p as BinaryFile, q as COMPLIANCE_REGION_CONFIG_PUBLIC, r as COMPLIANCE_REGION_CONFIG_UNKNOWN, s as CacheOptions, t as CfAIBinding, u as CfAISearch, v as CfAISearchNamespace, w as CfAccount, x as CfAgentMemory, y as CfAnalyticsEngineDataset, z as CfArtifacts, F as CfAssetsBinding, G as CfBrowserBinding, H as CfCapnp, I as CfD1Database, J as CfDataBlobBindings, K as CfDevPluginCfg, M as CfDispatchNamespace, N as CfDurableObject, O as CfDurableObjectMigrations, P as CfExports, Q as CfFlagship, S as CfHelloWorld, T as CfHyperdrive, U as CfImagesBinding, V as CfKvNamespace, X as CfLogfwdr, Y as CfLogfwdrBinding, Z as CfMTlsCertificate, _ as CfMediaBinding, $ as CfModule, a0 as CfModuleType, a1 as CfPipeline, a2 as CfPlacement, a3 as CfQueue, a4 as CfR2Bucket, a5 as CfRateLimit, a6 as CfScriptFormat, a7 as CfSecretsStoreSecrets, a8 as CfSendEmailBindings, a9 as CfService, aa as CfStreamBinding, ab as CfTextBlobBindings, ac as CfUnsafe, ad as CfUnsafeBinding, ae as CfUserLimits, af as CfVars, ag as CfVectorize, ah as CfVersionMetadataBinding, ai as CfVpcNetwork, aj as CfVpcService, ak as CfWasmModuleBindings, al as CfWorkerContext, am as CfWorkerInit, an as CfWorkerLoader, ao as CfWorkerSourceMap, ap as CfWorkflow, aq as CloudchamberConfig, ar as ConfigFields, as as ConfigModuleRuleType, at as ConfiguredExport, au as ContainerEngine, av as ContainerObservability, aw as CustomDomainRoute, ax as DispatchNamespaceOutbound, ay as DockerConfiguration, az as DurableObjectBindings, aA as DurableObjectContainerImage, aB as DurableObjectExportStorage, aC as DurableObjectMigration, aD as ENVIRONMENT_TAG_PREFIX, aE as Entry, aF as Environment, aG as EnvironmentNonInheritable, aH as ExportsReconciliationEntryBase, aI as ExportsReconciliationErrorDetail, aJ as ExportsReconciliationInfo, aK as ExportsReconciliationRename, aL as ExportsReconciliationResult, aM as ExportsReconciliationTransfer, aN as ExportsReconciliationTransferPending, aO as ExportsReconciliationWarning, aP as FetchKVGetValueFetcher, aQ as FetchListResultFetcher, aR as FetchPagedListResultFetcher, aS as FetchResult, aT as FetchResultFetcher, aU as File, aV as Hook, aW as HookValues, aX as INHERIT_SYMBOL, aY as JSON_CONFIG_FORMATS, aZ as Json, a_ as LOGGER_LEVELS, a$ as LegacyAssetPaths, b0 as LocalS3Credentials, b1 as LogLevel, b2 as LoggerLevel, b3 as NodeJSCompatMode, b4 as Observability, b5 as PATH_TO_DEPLOY_CONFIG, b6 as PreviewsConfig, b7 as RawDevConfig, b8 as RawEnvironment, a as RedirectedRawConfig, b9 as Rule, ba as SERVICE_TAG_PREFIX, bb as ServiceFetch, bc as ServiceMetadataRes, bd as StartDevWorkerInput, be as StreamingTailConsumer, bf as TailConsumer, bg as Trigger, bh as UserLimits, bi as ValidatedAssetsOptions, bj as WorkerMetadata, bk as WorkflowBinding, bl as ZoneIdRoute, bm as ZoneNameRoute, bn as addAuthorizationHeader, bo as defaultWranglerConfig, bp as extractAccountTag, bq as extractWAFBlockRayId, br as fetchInternalBase, bs as fetchKVGetValueBase, bt as fetchListResultBase, bu as fetchResultBase, bv as getBrowserRenderingHeadfulFromEnv, bw as getBuildConditionsFromEnv, bx as getBuildPlatformFromEnv, by as getC3CommandFromEnv, bz as getCIGeneratePreviewAlias, bA as getCIMatchTag, bB as getCIOverrideName, bC as getCIOverrideNetworkModeHost, bD as getCfFetchEnabledFromEnv, bE as getCfFetchPathFromEnv, bF as getCloudflareApiBaseUrl, bG as getCloudflareApiEnvironmentFromEnv, bH as getCloudflareComplianceRegion, bI as getCloudflareContainerRegistry, bJ as getCloudflareEnv, bK as getCloudflareIncludeProcessEnvFromEnv, bL as getCloudflareLoadDevVarsFromDotEnv, bM as getCloudflaredPathFromEnv, bN as getComplianceRegionSubdomain, bO as getD1ExtraLocationChoices, bP as getDisableConfigWatching, bQ as getLocalExplorerEnabledFromEnv, bR as getLocalObservabilityEnabledFromEnv, bS as getNoSkillsUpdatePromptsFromEnv, bT as getOpenNextDeployFromEnv, bU as getOutputFileDirectoryFromEnv, bV as getOutputFilePathFromEnv, bW as getRegistryPath, bX as getSanitizeLogs, bY as getSubdomainMixedStateCheckDisabled, bZ as getTraceHeader, b_ as getWorkersCIBranchName, b$ as getWranglerCacheDirFromEnv, c0 as getWranglerHideBanner, c1 as getWranglerSendErrorReportsFromEnv, c2 as getWranglerSendMetricsFromEnv, c3 as hasCursor, c4 as hasMorePages, c5 as isDoNotTrackEnabled, c6 as isWAFBlockResponse, c7 as maybeAddTraceHeader, c8 as parseRetryAfterMs, c9 as parseRetryAfterValue, ca as performApiFetchBase, cb as renderError, cc as throwFetchError, cd as truncate } from './compliance-
|
|
1
|
+
import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as ContainerApp, d as WorkerMetadataBinding, e as CfTailConsumer, L as Logger, A as ApiCredentials, f as ComplianceConfig, g as Route } from './compliance-Cd7XSPJW.mjs';
|
|
2
|
+
export { h as ARTIFACTS_EVENT_TYPES, i as Access, j as ArtifactsEventTrigger, k as ArtifactsEventType, l as AssetConfigMetadata, m as Assets, n as AssetsOptions, o as AsyncHook, p as BinaryFile, q as COMPLIANCE_REGION_CONFIG_PUBLIC, r as COMPLIANCE_REGION_CONFIG_UNKNOWN, s as CacheOptions, t as CfAIBinding, u as CfAISearch, v as CfAISearchNamespace, w as CfAccount, x as CfAgentMemory, y as CfAnalyticsEngineDataset, z as CfArtifacts, F as CfAssetsBinding, G as CfBrowserBinding, H as CfCapnp, I as CfD1Database, J as CfDataBlobBindings, K as CfDevPluginCfg, M as CfDispatchNamespace, N as CfDurableObject, O as CfDurableObjectMigrations, P as CfExports, Q as CfFlagship, S as CfHelloWorld, T as CfHyperdrive, U as CfImagesBinding, V as CfKvNamespace, X as CfLogfwdr, Y as CfLogfwdrBinding, Z as CfMTlsCertificate, _ as CfMediaBinding, $ as CfModule, a0 as CfModuleType, a1 as CfPipeline, a2 as CfPlacement, a3 as CfQueue, a4 as CfR2Bucket, a5 as CfRateLimit, a6 as CfScriptFormat, a7 as CfSecretsStoreSecrets, a8 as CfSendEmailBindings, a9 as CfService, aa as CfStreamBinding, ab as CfTextBlobBindings, ac as CfUnsafe, ad as CfUnsafeBinding, ae as CfUserLimits, af as CfVars, ag as CfVectorize, ah as CfVersionMetadataBinding, ai as CfVpcNetwork, aj as CfVpcService, ak as CfWasmModuleBindings, al as CfWorkerContext, am as CfWorkerInit, an as CfWorkerLoader, ao as CfWorkerSourceMap, ap as CfWorkflow, aq as CloudchamberConfig, ar as ConfigFields, as as ConfigModuleRuleType, at as ConfiguredExport, au as ContainerEngine, av as ContainerObservability, aw as CustomDomainRoute, ax as DispatchNamespaceOutbound, ay as DockerConfiguration, az as DurableObjectBindings, aA as DurableObjectContainerImage, aB as DurableObjectExportStorage, aC as DurableObjectMigration, aD as ENVIRONMENT_TAG_PREFIX, aE as Entry, aF as Environment, aG as EnvironmentNonInheritable, aH as ExportsReconciliationEntryBase, aI as ExportsReconciliationErrorDetail, aJ as ExportsReconciliationInfo, aK as ExportsReconciliationRename, aL as ExportsReconciliationResult, aM as ExportsReconciliationTransfer, aN as ExportsReconciliationTransferPending, aO as ExportsReconciliationWarning, aP as FetchKVGetValueFetcher, aQ as FetchListResultFetcher, aR as FetchPagedListResultFetcher, aS as FetchResult, aT as FetchResultFetcher, aU as File, aV as Hook, aW as HookValues, aX as INHERIT_SYMBOL, aY as JSON_CONFIG_FORMATS, aZ as Json, a_ as LOGGER_LEVELS, a$ as LegacyAssetPaths, b0 as LocalS3Credentials, b1 as LogLevel, b2 as LoggerLevel, b3 as NodeJSCompatMode, b4 as Observability, b5 as PATH_TO_DEPLOY_CONFIG, b6 as PreviewsConfig, b7 as RawDevConfig, b8 as RawEnvironment, a as RedirectedRawConfig, b9 as Rule, ba as SERVICE_TAG_PREFIX, bb as ServiceFetch, bc as ServiceMetadataRes, bd as StartDevWorkerInput, be as StreamingTailConsumer, bf as TailConsumer, bg as Trigger, bh as UserLimits, bi as ValidatedAssetsOptions, bj as WorkerMetadata, bk as WorkflowBinding, bl as ZoneIdRoute, bm as ZoneNameRoute, bn as addAuthorizationHeader, bo as defaultWranglerConfig, bp as extractAccountTag, bq as extractWAFBlockRayId, br as fetchInternalBase, bs as fetchKVGetValueBase, bt as fetchListResultBase, bu as fetchResultBase, bv as getBrowserRenderingHeadfulFromEnv, bw as getBuildConditionsFromEnv, bx as getBuildPlatformFromEnv, by as getC3CommandFromEnv, bz as getCIGeneratePreviewAlias, bA as getCIMatchTag, bB as getCIOverrideName, bC as getCIOverrideNetworkModeHost, bD as getCfFetchEnabledFromEnv, bE as getCfFetchPathFromEnv, bF as getCloudflareApiBaseUrl, bG as getCloudflareApiEnvironmentFromEnv, bH as getCloudflareComplianceRegion, bI as getCloudflareContainerRegistry, bJ as getCloudflareEnv, bK as getCloudflareIncludeProcessEnvFromEnv, bL as getCloudflareLoadDevVarsFromDotEnv, bM as getCloudflaredPathFromEnv, bN as getComplianceRegionSubdomain, bO as getD1ExtraLocationChoices, bP as getDisableConfigWatching, bQ as getLocalExplorerEnabledFromEnv, bR as getLocalObservabilityEnabledFromEnv, bS as getNoSkillsUpdatePromptsFromEnv, bT as getOpenNextDeployFromEnv, bU as getOutputFileDirectoryFromEnv, bV as getOutputFilePathFromEnv, bW as getRegistryPath, bX as getSanitizeLogs, bY as getSubdomainMixedStateCheckDisabled, bZ as getTraceHeader, b_ as getWorkersCIBranchName, b$ as getWranglerCacheDirFromEnv, c0 as getWranglerHideBanner, c1 as getWranglerSendErrorReportsFromEnv, c2 as getWranglerSendMetricsFromEnv, c3 as hasCursor, c4 as hasMorePages, c5 as isDoNotTrackEnabled, c6 as isWAFBlockResponse, c7 as maybeAddTraceHeader, c8 as parseRetryAfterMs, c9 as parseRetryAfterValue, ca as performApiFetchBase, cb as renderError, cc as throwFetchError, cd as truncate } from './compliance-Cd7XSPJW.mjs';
|
|
3
3
|
import * as jsoncParser from 'jsonc-parser';
|
|
4
4
|
import { UserError, TelemetryMessage } from './errors.mjs';
|
|
5
5
|
export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, createFatalError } from './errors.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ export { MetricsRegistry } from './chunk-Z62CVNHJ.mjs';
|
|
|
2
2
|
export { _forceColour, formatZodError } from './chunk-7AX24RFK.mjs';
|
|
3
3
|
import { isRedirectedRawConfig, configFileName, formatConfigSnippet, getDurableObjectExports, getContainerNameToClassNameMap, parsePackageJSON, readFileSync, ParseError, parseJSON, APIError, CONTAINER_IMAGES_BINDING, dir, parseTOML, modify, applyEdits, format, dist_default, parseJSONC } from './chunk-JGKSDUFK.mjs';
|
|
4
4
|
export { APIError, CONTAINER_IMAGES_BINDING, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, configFileName, configFormat, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectClassNameToUseSQLiteMap, getDurableObjectContainerApps, getDurableObjectExports, getResolvedDurableObjectContainerApps, hasDurableObjectExports, indexLocation, isDurableObjectContainerApp, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation, validateDurableObjectContainerApplications } from './chunk-JGKSDUFK.mjs';
|
|
5
|
-
import { assertNever } from './chunk-
|
|
6
|
-
export { DEFAULT_COMPAT_DATE, assertNever, constructWranglerConfig, mapWorkerMetadataBindings } from './chunk-
|
|
5
|
+
import { assertNever } from './chunk-YZWVNJ5I.mjs';
|
|
6
|
+
export { DEFAULT_COMPAT_DATE, assertNever, constructWranglerConfig, mapWorkerMetadataBindings } from './chunk-YZWVNJ5I.mjs';
|
|
7
7
|
export { NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, getTodaysCompatDate, isCompatDate, isNodejsCompatDefaultOn, resolveNodejsCompat, stripRedundantNodejsCompatFlags } from './chunk-C6O4ION7.mjs';
|
|
8
8
|
import { getCloudflareEnv, getCloudflareContainerRegistry, getCloudflareApiBaseUrl, getTraceHeader, getCloudflaredPathFromEnv, getOutputFilePathFromEnv, getOutputFileDirectoryFromEnv, getCIOverrideName, getWranglerCacheDirFromEnv } from './chunk-IYSONYTF.mjs';
|
|
9
9
|
export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareContainerRegistry, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getNoSkillsUpdatePromptsFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, isDoNotTrackEnabled } from './chunk-IYSONYTF.mjs';
|
|
@@ -29,7 +29,6 @@ import { createHash, randomBytes } from 'node:crypto';
|
|
|
29
29
|
import { arch } from 'node:os';
|
|
30
30
|
import * as timersPromises from 'node:timers/promises';
|
|
31
31
|
import { setTimeout as setTimeout$1 } from 'node:timers/promises';
|
|
32
|
-
import { assert as assert$1 } from 'node:console';
|
|
33
32
|
|
|
34
33
|
// ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json
|
|
35
34
|
var require_vendors = __commonJS({
|
|
@@ -1801,6 +1800,9 @@ var getJSONPath = /* @__PURE__ */ __name((obj, allPaths, isArrayInsertion, prevP
|
|
|
1801
1800
|
for (const [k, v] of Object.entries(obj)) {
|
|
1802
1801
|
const currentPath = [...prevPath, k];
|
|
1803
1802
|
if (Array.isArray(v)) {
|
|
1803
|
+
if (v.length === 0 && !isArrayInsertion) {
|
|
1804
|
+
allPaths.push([...currentPath, v]);
|
|
1805
|
+
}
|
|
1804
1806
|
v.forEach((x, i) => {
|
|
1805
1807
|
if (isArrayInsertion) {
|
|
1806
1808
|
allPaths.push([...currentPath, -1, x]);
|
|
@@ -1811,7 +1813,13 @@ var getJSONPath = /* @__PURE__ */ __name((obj, allPaths, isArrayInsertion, prevP
|
|
|
1811
1813
|
}
|
|
1812
1814
|
});
|
|
1813
1815
|
} else if (typeof v === "object" && v !== null) {
|
|
1814
|
-
|
|
1816
|
+
if (Object.keys(v).length === 0) {
|
|
1817
|
+
if (!isArrayInsertion) {
|
|
1818
|
+
allPaths.push([...currentPath, v]);
|
|
1819
|
+
}
|
|
1820
|
+
} else {
|
|
1821
|
+
getJSONPath(v, allPaths, isArrayInsertion, currentPath);
|
|
1822
|
+
}
|
|
1815
1823
|
} else {
|
|
1816
1824
|
allPaths.push([...currentPath, v]);
|
|
1817
1825
|
}
|
|
@@ -17995,17 +18003,31 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv, envName) {
|
|
|
17995
18003
|
return result;
|
|
17996
18004
|
}
|
|
17997
18005
|
__name(validateRoutes, "validateRoutes");
|
|
17998
|
-
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
17999
|
-
if (rawEnv.placement) {
|
|
18006
|
+
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv, diagnosticField = "placement") {
|
|
18007
|
+
if (rawEnv.placement !== void 0) {
|
|
18008
|
+
if (typeof rawEnv.placement !== "object" || rawEnv.placement === null || Array.isArray(rawEnv.placement)) {
|
|
18009
|
+
diagnostics.errors.push(
|
|
18010
|
+
`The field "${diagnosticField}" should be an object but got ${JSON.stringify(rawEnv.placement)}.`
|
|
18011
|
+
);
|
|
18012
|
+
return inheritable(
|
|
18013
|
+
diagnostics,
|
|
18014
|
+
topLevelEnv,
|
|
18015
|
+
rawEnv,
|
|
18016
|
+
"placement",
|
|
18017
|
+
() => true,
|
|
18018
|
+
void 0
|
|
18019
|
+
);
|
|
18020
|
+
}
|
|
18000
18021
|
const placement = rawEnv.placement;
|
|
18001
18022
|
const hasHint = "hint" in placement;
|
|
18002
|
-
const
|
|
18003
|
-
const
|
|
18004
|
-
|
|
18005
|
-
|
|
18023
|
+
const targetedFields = ["region", "host", "hostname"];
|
|
18024
|
+
const presentTargetedFields = targetedFields.filter(
|
|
18025
|
+
(field) => field in placement
|
|
18026
|
+
);
|
|
18027
|
+
const hasTargetedFields = presentTargetedFields.length > 0;
|
|
18006
18028
|
if (hasHint && hasTargetedFields) {
|
|
18007
18029
|
diagnostics.errors.push(
|
|
18008
|
-
`"
|
|
18030
|
+
`"${diagnosticField}" cannot have both "hint" (smart format) and "region"/"host"/"hostname" (targeted format) fields`
|
|
18009
18031
|
);
|
|
18010
18032
|
return inheritable(
|
|
18011
18033
|
diagnostics,
|
|
@@ -18019,7 +18041,7 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
18019
18041
|
if (hasHint) {
|
|
18020
18042
|
validateRequiredProperty(
|
|
18021
18043
|
diagnostics,
|
|
18022
|
-
|
|
18044
|
+
diagnosticField,
|
|
18023
18045
|
"mode",
|
|
18024
18046
|
placement.mode,
|
|
18025
18047
|
"string",
|
|
@@ -18029,75 +18051,58 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
18029
18051
|
const hint = placement.hint;
|
|
18030
18052
|
if (hint !== void 0 && typeof hint !== "string") {
|
|
18031
18053
|
diagnostics.errors.push(
|
|
18032
|
-
`"
|
|
18054
|
+
`"${diagnosticField}.hint" must be a string when "${diagnosticField}.mode" is "${mode}"`
|
|
18033
18055
|
);
|
|
18034
18056
|
}
|
|
18035
18057
|
if (hint && mode !== "smart") {
|
|
18036
18058
|
diagnostics.errors.push(
|
|
18037
|
-
`"
|
|
18059
|
+
`"${diagnosticField}.hint" can only be set when "${diagnosticField}.mode" is "smart"`
|
|
18038
18060
|
);
|
|
18039
18061
|
}
|
|
18040
18062
|
} else if (hasTargetedFields) {
|
|
18041
18063
|
validateOptionalProperty(
|
|
18042
18064
|
diagnostics,
|
|
18043
|
-
|
|
18065
|
+
diagnosticField,
|
|
18044
18066
|
"mode",
|
|
18045
18067
|
placement.mode,
|
|
18046
18068
|
"string",
|
|
18047
|
-
["
|
|
18069
|
+
["targeted"]
|
|
18048
18070
|
);
|
|
18049
|
-
|
|
18050
|
-
|
|
18071
|
+
for (const field of presentTargetedFields) {
|
|
18072
|
+
validateRequiredProperty(
|
|
18051
18073
|
diagnostics,
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
placement
|
|
18055
|
-
"string"
|
|
18056
|
-
);
|
|
18057
|
-
}
|
|
18058
|
-
if (hasHost) {
|
|
18059
|
-
validateOptionalProperty(
|
|
18060
|
-
diagnostics,
|
|
18061
|
-
"placement",
|
|
18062
|
-
"host",
|
|
18063
|
-
placement.host,
|
|
18064
|
-
"string"
|
|
18065
|
-
);
|
|
18066
|
-
}
|
|
18067
|
-
if (hasHostname) {
|
|
18068
|
-
validateOptionalProperty(
|
|
18069
|
-
diagnostics,
|
|
18070
|
-
"placement",
|
|
18071
|
-
"hostname",
|
|
18072
|
-
placement.hostname,
|
|
18074
|
+
diagnosticField,
|
|
18075
|
+
field,
|
|
18076
|
+
placement[field],
|
|
18073
18077
|
"string"
|
|
18074
18078
|
);
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
if (hasRegion) {
|
|
18080
|
-
presentFields.push("region");
|
|
18081
|
-
}
|
|
18082
|
-
if (hasHost) {
|
|
18083
|
-
presentFields.push("host");
|
|
18084
|
-
}
|
|
18085
|
-
if (hasHostname) {
|
|
18086
|
-
presentFields.push("hostname");
|
|
18079
|
+
if (placement[field] === "") {
|
|
18080
|
+
diagnostics.errors.push(
|
|
18081
|
+
`"${diagnosticField}.${field}" must be a non-empty string.`
|
|
18082
|
+
);
|
|
18087
18083
|
}
|
|
18084
|
+
}
|
|
18085
|
+
if (presentTargetedFields.length > 1) {
|
|
18088
18086
|
diagnostics.errors.push(
|
|
18089
|
-
`"
|
|
18087
|
+
`"${diagnosticField}" fields ${presentTargetedFields.map((field) => `"${field}"`).join(", ")} are mutually exclusive. Only one can be specified.`
|
|
18090
18088
|
);
|
|
18091
18089
|
}
|
|
18092
18090
|
} else {
|
|
18093
18091
|
validateRequiredProperty(
|
|
18094
18092
|
diagnostics,
|
|
18095
|
-
|
|
18093
|
+
diagnosticField,
|
|
18096
18094
|
"mode",
|
|
18097
18095
|
placement.mode,
|
|
18098
18096
|
"string",
|
|
18099
18097
|
["off", "smart", "targeted"]
|
|
18100
18098
|
);
|
|
18099
|
+
if (placement.mode === "targeted") {
|
|
18100
|
+
validateAtLeastOnePropertyRequired(diagnostics, diagnosticField, [
|
|
18101
|
+
{ key: "region", value: placement.region, type: "string" },
|
|
18102
|
+
{ key: "host", value: placement.host, type: "string" },
|
|
18103
|
+
{ key: "hostname", value: placement.hostname, type: "string" }
|
|
18104
|
+
]);
|
|
18105
|
+
}
|
|
18101
18106
|
}
|
|
18102
18107
|
}
|
|
18103
18108
|
return inheritable(
|
|
@@ -22017,6 +22022,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
22017
22022
|
"logpush",
|
|
22018
22023
|
"observability",
|
|
22019
22024
|
"limits",
|
|
22025
|
+
"placement",
|
|
22020
22026
|
"cache"
|
|
22021
22027
|
]) && isValid;
|
|
22022
22028
|
isValid = validateVars(envName)(
|
|
@@ -22031,6 +22037,12 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
22031
22037
|
previews.define,
|
|
22032
22038
|
void 0
|
|
22033
22039
|
) && isValid;
|
|
22040
|
+
normalizeAndValidatePlacement(
|
|
22041
|
+
diagnostics,
|
|
22042
|
+
void 0,
|
|
22043
|
+
previews,
|
|
22044
|
+
`${field}.placement`
|
|
22045
|
+
);
|
|
22034
22046
|
isValid = validateBindingsProperty(envName, validateDurableObjectBinding)(
|
|
22035
22047
|
diagnostics,
|
|
22036
22048
|
`${field}.durable_objects`,
|
|
@@ -26682,7 +26694,7 @@ function getWorkerNameFromProject(projectPath) {
|
|
|
26682
26694
|
}
|
|
26683
26695
|
__name(getWorkerNameFromProject, "getWorkerNameFromProject");
|
|
26684
26696
|
function toUrlPath(filePath) {
|
|
26685
|
-
|
|
26697
|
+
assert2(
|
|
26686
26698
|
!/^[a-z]:/i.test(filePath),
|
|
26687
26699
|
"Tried to convert a Windows file path with a drive to a URL path."
|
|
26688
26700
|
);
|