@cloudflare/workers-utils 0.38.1 → 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-T5JQYOMX.mjs → chunk-JGKSDUFK.mjs} +19 -3
- package/dist/{chunk-KBTXSRPS.mjs → chunk-YZWVNJ5I.mjs} +1 -8
- package/dist/{compliance-Dta138UP.d.mts → compliance-Cd7XSPJW.d.mts} +17 -31
- package/dist/compliance.d.mts +1 -1
- package/dist/index.d.mts +20 -5
- package/dist/index.mjs +163 -105
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { MetricsRegistry } from './chunk-Z62CVNHJ.mjs';
|
|
2
2
|
export { _forceColour, formatZodError } from './chunk-7AX24RFK.mjs';
|
|
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-
|
|
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, hasDurableObjectExports, indexLocation, isDurableObjectContainerApp, isRedirectedConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation, validateDurableObjectContainerApplications } from './chunk-
|
|
5
|
-
import { assertNever } from './chunk-
|
|
6
|
-
export { DEFAULT_COMPAT_DATE, assertNever, constructWranglerConfig, mapWorkerMetadataBindings } from './chunk-
|
|
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
|
+
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-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({
|
|
@@ -1692,7 +1691,6 @@ var defaultWranglerConfig = {
|
|
|
1692
1691
|
vectorize: [],
|
|
1693
1692
|
ai_search_namespaces: [],
|
|
1694
1693
|
ai_search: [],
|
|
1695
|
-
websearch: void 0,
|
|
1696
1694
|
agent_memory: [],
|
|
1697
1695
|
hyperdrive: [],
|
|
1698
1696
|
workflows: [],
|
|
@@ -1802,6 +1800,9 @@ var getJSONPath = /* @__PURE__ */ __name((obj, allPaths, isArrayInsertion, prevP
|
|
|
1802
1800
|
for (const [k, v] of Object.entries(obj)) {
|
|
1803
1801
|
const currentPath = [...prevPath, k];
|
|
1804
1802
|
if (Array.isArray(v)) {
|
|
1803
|
+
if (v.length === 0 && !isArrayInsertion) {
|
|
1804
|
+
allPaths.push([...currentPath, v]);
|
|
1805
|
+
}
|
|
1805
1806
|
v.forEach((x, i) => {
|
|
1806
1807
|
if (isArrayInsertion) {
|
|
1807
1808
|
allPaths.push([...currentPath, -1, x]);
|
|
@@ -1812,7 +1813,13 @@ var getJSONPath = /* @__PURE__ */ __name((obj, allPaths, isArrayInsertion, prevP
|
|
|
1812
1813
|
}
|
|
1813
1814
|
});
|
|
1814
1815
|
} else if (typeof v === "object" && v !== null) {
|
|
1815
|
-
|
|
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
|
+
}
|
|
1816
1823
|
} else {
|
|
1817
1824
|
allPaths.push([...currentPath, v]);
|
|
1818
1825
|
}
|
|
@@ -17214,7 +17221,6 @@ var friendlyBindingNames = {
|
|
|
17214
17221
|
vectorize: "Vectorize Index",
|
|
17215
17222
|
ai_search_namespaces: "AI Search Namespace",
|
|
17216
17223
|
ai_search: "AI Search Instance",
|
|
17217
|
-
websearch: "Web Search",
|
|
17218
17224
|
agent_memory: "Agent Memory",
|
|
17219
17225
|
hyperdrive: "Hyperdrive Config",
|
|
17220
17226
|
r2_buckets: "R2 Bucket",
|
|
@@ -17268,7 +17274,6 @@ var bindingTypeFriendlyNames = {
|
|
|
17268
17274
|
vectorize: "Vectorize Index",
|
|
17269
17275
|
ai_search_namespace: "AI Search Namespace",
|
|
17270
17276
|
ai_search: "AI Search Instance",
|
|
17271
|
-
websearch: "Web Search",
|
|
17272
17277
|
agent_memory: "Agent Memory",
|
|
17273
17278
|
hyperdrive: "Hyperdrive Config",
|
|
17274
17279
|
service: "Worker",
|
|
@@ -17998,17 +18003,31 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv, envName) {
|
|
|
17998
18003
|
return result;
|
|
17999
18004
|
}
|
|
18000
18005
|
__name(validateRoutes, "validateRoutes");
|
|
18001
|
-
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
18002
|
-
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
|
+
}
|
|
18003
18021
|
const placement = rawEnv.placement;
|
|
18004
18022
|
const hasHint = "hint" in placement;
|
|
18005
|
-
const
|
|
18006
|
-
const
|
|
18007
|
-
|
|
18008
|
-
|
|
18023
|
+
const targetedFields = ["region", "host", "hostname"];
|
|
18024
|
+
const presentTargetedFields = targetedFields.filter(
|
|
18025
|
+
(field) => field in placement
|
|
18026
|
+
);
|
|
18027
|
+
const hasTargetedFields = presentTargetedFields.length > 0;
|
|
18009
18028
|
if (hasHint && hasTargetedFields) {
|
|
18010
18029
|
diagnostics.errors.push(
|
|
18011
|
-
`"
|
|
18030
|
+
`"${diagnosticField}" cannot have both "hint" (smart format) and "region"/"host"/"hostname" (targeted format) fields`
|
|
18012
18031
|
);
|
|
18013
18032
|
return inheritable(
|
|
18014
18033
|
diagnostics,
|
|
@@ -18022,7 +18041,7 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
18022
18041
|
if (hasHint) {
|
|
18023
18042
|
validateRequiredProperty(
|
|
18024
18043
|
diagnostics,
|
|
18025
|
-
|
|
18044
|
+
diagnosticField,
|
|
18026
18045
|
"mode",
|
|
18027
18046
|
placement.mode,
|
|
18028
18047
|
"string",
|
|
@@ -18032,75 +18051,58 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
18032
18051
|
const hint = placement.hint;
|
|
18033
18052
|
if (hint !== void 0 && typeof hint !== "string") {
|
|
18034
18053
|
diagnostics.errors.push(
|
|
18035
|
-
`"
|
|
18054
|
+
`"${diagnosticField}.hint" must be a string when "${diagnosticField}.mode" is "${mode}"`
|
|
18036
18055
|
);
|
|
18037
18056
|
}
|
|
18038
18057
|
if (hint && mode !== "smart") {
|
|
18039
18058
|
diagnostics.errors.push(
|
|
18040
|
-
`"
|
|
18059
|
+
`"${diagnosticField}.hint" can only be set when "${diagnosticField}.mode" is "smart"`
|
|
18041
18060
|
);
|
|
18042
18061
|
}
|
|
18043
18062
|
} else if (hasTargetedFields) {
|
|
18044
18063
|
validateOptionalProperty(
|
|
18045
18064
|
diagnostics,
|
|
18046
|
-
|
|
18065
|
+
diagnosticField,
|
|
18047
18066
|
"mode",
|
|
18048
18067
|
placement.mode,
|
|
18049
18068
|
"string",
|
|
18050
|
-
["
|
|
18069
|
+
["targeted"]
|
|
18051
18070
|
);
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
diagnostics,
|
|
18055
|
-
"placement",
|
|
18056
|
-
"region",
|
|
18057
|
-
placement.region,
|
|
18058
|
-
"string"
|
|
18059
|
-
);
|
|
18060
|
-
}
|
|
18061
|
-
if (hasHost) {
|
|
18062
|
-
validateOptionalProperty(
|
|
18063
|
-
diagnostics,
|
|
18064
|
-
"placement",
|
|
18065
|
-
"host",
|
|
18066
|
-
placement.host,
|
|
18067
|
-
"string"
|
|
18068
|
-
);
|
|
18069
|
-
}
|
|
18070
|
-
if (hasHostname) {
|
|
18071
|
-
validateOptionalProperty(
|
|
18071
|
+
for (const field of presentTargetedFields) {
|
|
18072
|
+
validateRequiredProperty(
|
|
18072
18073
|
diagnostics,
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
placement
|
|
18074
|
+
diagnosticField,
|
|
18075
|
+
field,
|
|
18076
|
+
placement[field],
|
|
18076
18077
|
"string"
|
|
18077
18078
|
);
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
if (hasRegion) {
|
|
18083
|
-
presentFields.push("region");
|
|
18084
|
-
}
|
|
18085
|
-
if (hasHost) {
|
|
18086
|
-
presentFields.push("host");
|
|
18087
|
-
}
|
|
18088
|
-
if (hasHostname) {
|
|
18089
|
-
presentFields.push("hostname");
|
|
18079
|
+
if (placement[field] === "") {
|
|
18080
|
+
diagnostics.errors.push(
|
|
18081
|
+
`"${diagnosticField}.${field}" must be a non-empty string.`
|
|
18082
|
+
);
|
|
18090
18083
|
}
|
|
18084
|
+
}
|
|
18085
|
+
if (presentTargetedFields.length > 1) {
|
|
18091
18086
|
diagnostics.errors.push(
|
|
18092
|
-
`"
|
|
18087
|
+
`"${diagnosticField}" fields ${presentTargetedFields.map((field) => `"${field}"`).join(", ")} are mutually exclusive. Only one can be specified.`
|
|
18093
18088
|
);
|
|
18094
18089
|
}
|
|
18095
18090
|
} else {
|
|
18096
18091
|
validateRequiredProperty(
|
|
18097
18092
|
diagnostics,
|
|
18098
|
-
|
|
18093
|
+
diagnosticField,
|
|
18099
18094
|
"mode",
|
|
18100
18095
|
placement.mode,
|
|
18101
18096
|
"string",
|
|
18102
18097
|
["off", "smart", "targeted"]
|
|
18103
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
|
+
}
|
|
18104
18106
|
}
|
|
18105
18107
|
}
|
|
18106
18108
|
return inheritable(
|
|
@@ -18543,16 +18545,6 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
18543
18545
|
validateBindingArray(envName, validateAISearchBinding),
|
|
18544
18546
|
[]
|
|
18545
18547
|
),
|
|
18546
|
-
websearch: notInheritable(
|
|
18547
|
-
diagnostics,
|
|
18548
|
-
topLevelEnv,
|
|
18549
|
-
rawConfig,
|
|
18550
|
-
rawEnv,
|
|
18551
|
-
envName,
|
|
18552
|
-
"websearch",
|
|
18553
|
-
validateNamedSimpleBinding(envName),
|
|
18554
|
-
void 0
|
|
18555
|
-
),
|
|
18556
18548
|
agent_memory: notInheritable(
|
|
18557
18549
|
diagnostics,
|
|
18558
18550
|
topLevelEnv,
|
|
@@ -19805,7 +19797,6 @@ var validateUnsafeBinding = /* @__PURE__ */ __name((diagnostics, field, value) =
|
|
|
19805
19797
|
"ai",
|
|
19806
19798
|
"ai_search_namespace",
|
|
19807
19799
|
"ai_search",
|
|
19808
|
-
"websearch",
|
|
19809
19800
|
"agent_memory",
|
|
19810
19801
|
"kv_namespace",
|
|
19811
19802
|
"durable_object_namespace",
|
|
@@ -20021,8 +20012,25 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
|
|
|
20021
20012
|
valid = false;
|
|
20022
20013
|
}
|
|
20023
20014
|
}
|
|
20015
|
+
const isDockerfileBuild = hasDockerfile && !hasImage;
|
|
20016
|
+
if (isDockerfileBuild) {
|
|
20017
|
+
if (image.build_context !== void 0 && (typeof image.build_context !== "string" || image.build_context.length === 0)) {
|
|
20018
|
+
diagnostics.errors.push(
|
|
20019
|
+
`"${imageField}.build_context" must be a non-empty string.`
|
|
20020
|
+
);
|
|
20021
|
+
valid = false;
|
|
20022
|
+
}
|
|
20023
|
+
if (image.build_vars !== void 0 && (typeof image.build_vars !== "object" || image.build_vars === null || Array.isArray(image.build_vars) || Object.values(image.build_vars).some(
|
|
20024
|
+
(value) => typeof value !== "string"
|
|
20025
|
+
))) {
|
|
20026
|
+
diagnostics.errors.push(
|
|
20027
|
+
`"${imageField}.build_vars" must be an object with string values.`
|
|
20028
|
+
);
|
|
20029
|
+
valid = false;
|
|
20030
|
+
}
|
|
20031
|
+
}
|
|
20024
20032
|
const unsupportedFields = Object.keys(image).filter(
|
|
20025
|
-
(property) => property !== "dockerfile" && property !== "image"
|
|
20033
|
+
(property) => property !== "dockerfile" && property !== "image" && !(isDockerfileBuild && (property === "build_context" || property === "build_vars"))
|
|
20026
20034
|
);
|
|
20027
20035
|
if (unsupportedFields.length > 0) {
|
|
20028
20036
|
diagnostics.errors.push(
|
|
@@ -20034,6 +20042,32 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
|
|
|
20034
20042
|
return valid;
|
|
20035
20043
|
}
|
|
20036
20044
|
__name(validateDurableObjectContainerImages, "validateDurableObjectContainerImages");
|
|
20045
|
+
function validateDurableObjectContainerUnsafe(diagnostics, field, value) {
|
|
20046
|
+
if (value === void 0) {
|
|
20047
|
+
return;
|
|
20048
|
+
}
|
|
20049
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
20050
|
+
diagnostics.errors.push(`"${field}" should be an object.`);
|
|
20051
|
+
return;
|
|
20052
|
+
}
|
|
20053
|
+
const unsafe = value;
|
|
20054
|
+
const configuration = unsafe.configuration;
|
|
20055
|
+
if (Object.keys(unsafe).some((key) => key !== "configuration") || configuration !== void 0 && (typeof configuration !== "object" || configuration === null || Array.isArray(configuration) || Object.keys(configuration).some((key) => key !== "experimental_flags"))) {
|
|
20056
|
+
diagnostics.errors.push(
|
|
20057
|
+
`Only "${field}.configuration.experimental_flags" is supported for Durable Object-managed Containers.`
|
|
20058
|
+
);
|
|
20059
|
+
return;
|
|
20060
|
+
}
|
|
20061
|
+
if (configuration !== void 0) {
|
|
20062
|
+
const flags = configuration.experimental_flags;
|
|
20063
|
+
if (flags !== void 0 && (!Array.isArray(flags) || flags.some((flag) => typeof flag !== "string"))) {
|
|
20064
|
+
diagnostics.errors.push(
|
|
20065
|
+
`"${field}.configuration.experimental_flags" should be an array of strings.`
|
|
20066
|
+
);
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
}
|
|
20070
|
+
__name(validateDurableObjectContainerUnsafe, "validateDurableObjectContainerUnsafe");
|
|
20037
20071
|
function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
20038
20072
|
const { generateDefaultName = true } = options;
|
|
20039
20073
|
return (diagnostics, field, value, config2) => {
|
|
@@ -20049,19 +20083,16 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
20049
20083
|
for (const containerAppOptional of value) {
|
|
20050
20084
|
const isDurableObjectManaged = containerAppOptional.scheduling_policy === "durable_object";
|
|
20051
20085
|
const hasValidDurableObjectClassName = typeof containerAppOptional.class_name === "string" && containerAppOptional.class_name.length > 0;
|
|
20052
|
-
|
|
20053
|
-
|
|
20054
|
-
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
"class_name",
|
|
20063
|
-
containerAppOptional.class_name,
|
|
20064
|
-
"string"
|
|
20086
|
+
validateOptionalProperty(
|
|
20087
|
+
diagnostics,
|
|
20088
|
+
field,
|
|
20089
|
+
"class_name",
|
|
20090
|
+
containerAppOptional.class_name,
|
|
20091
|
+
"string"
|
|
20092
|
+
);
|
|
20093
|
+
if (isDurableObjectManaged && containerAppOptional.class_name === "") {
|
|
20094
|
+
diagnostics.errors.push(
|
|
20095
|
+
`"containers.class_name" must be a non-empty string when specified for a Durable Object-managed Container.`
|
|
20065
20096
|
);
|
|
20066
20097
|
}
|
|
20067
20098
|
validateOptionalProperty(
|
|
@@ -20071,7 +20102,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
20071
20102
|
containerAppOptional.name,
|
|
20072
20103
|
"string"
|
|
20073
20104
|
);
|
|
20074
|
-
if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || hasValidDurableObjectClassName)) {
|
|
20105
|
+
if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || containerAppOptional.class_name === void 0 || hasValidDurableObjectClassName)) {
|
|
20075
20106
|
if (containerAppOptional.class_name === void 0) {
|
|
20076
20107
|
diagnostics.errors.push(
|
|
20077
20108
|
`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`
|
|
@@ -20093,12 +20124,35 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
20093
20124
|
containerAppOptional.images,
|
|
20094
20125
|
options.complianceConfig
|
|
20095
20126
|
);
|
|
20127
|
+
validateContainerObservability(
|
|
20128
|
+
diagnostics,
|
|
20129
|
+
`${field}.observability`,
|
|
20130
|
+
containerAppOptional.observability,
|
|
20131
|
+
config2
|
|
20132
|
+
);
|
|
20133
|
+
if (containerAppOptional.observability?.target_instance_count !== void 0 || containerAppOptional.observability?.target_instance_percentage !== void 0) {
|
|
20134
|
+
diagnostics.errors.push(
|
|
20135
|
+
`"${field}.observability" only supports enabling or disabling logs for Durable Object-managed Containers; instance targeting is not supported.`
|
|
20136
|
+
);
|
|
20137
|
+
}
|
|
20138
|
+
validateDurableObjectContainerUnsafe(
|
|
20139
|
+
diagnostics,
|
|
20140
|
+
`${field}.unsafe`,
|
|
20141
|
+
containerAppOptional.unsafe
|
|
20142
|
+
);
|
|
20096
20143
|
const unsupportedFields = Object.keys(containerAppOptional).filter(
|
|
20097
|
-
(key) => ![
|
|
20144
|
+
(key) => ![
|
|
20145
|
+
"name",
|
|
20146
|
+
"class_name",
|
|
20147
|
+
"scheduling_policy",
|
|
20148
|
+
"images",
|
|
20149
|
+
"observability",
|
|
20150
|
+
"unsafe"
|
|
20151
|
+
].includes(key)
|
|
20098
20152
|
);
|
|
20099
20153
|
if (unsupportedFields.length > 0) {
|
|
20100
20154
|
diagnostics.errors.push(
|
|
20101
|
-
`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", and "
|
|
20155
|
+
`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", and restricted "unsafe" settings are supported.`
|
|
20102
20156
|
);
|
|
20103
20157
|
}
|
|
20104
20158
|
continue;
|
|
@@ -21940,6 +21994,8 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
21940
21994
|
"d1_databases",
|
|
21941
21995
|
"r2_buckets",
|
|
21942
21996
|
"vectorize",
|
|
21997
|
+
"ai_search_namespaces",
|
|
21998
|
+
"ai_search",
|
|
21943
21999
|
"hyperdrive",
|
|
21944
22000
|
"services",
|
|
21945
22001
|
"analytics_engine_datasets",
|
|
@@ -21966,6 +22022,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
21966
22022
|
"logpush",
|
|
21967
22023
|
"observability",
|
|
21968
22024
|
"limits",
|
|
22025
|
+
"placement",
|
|
21969
22026
|
"cache"
|
|
21970
22027
|
]) && isValid;
|
|
21971
22028
|
isValid = validateVars(envName)(
|
|
@@ -21980,6 +22037,12 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
21980
22037
|
previews.define,
|
|
21981
22038
|
void 0
|
|
21982
22039
|
) && isValid;
|
|
22040
|
+
normalizeAndValidatePlacement(
|
|
22041
|
+
diagnostics,
|
|
22042
|
+
void 0,
|
|
22043
|
+
previews,
|
|
22044
|
+
`${field}.placement`
|
|
22045
|
+
);
|
|
21983
22046
|
isValid = validateBindingsProperty(envName, validateDurableObjectBinding)(
|
|
21984
22047
|
diagnostics,
|
|
21985
22048
|
`${field}.durable_objects`,
|
|
@@ -22026,6 +22089,18 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
22026
22089
|
previews.vectorize,
|
|
22027
22090
|
void 0
|
|
22028
22091
|
) && isValid;
|
|
22092
|
+
isValid = validateBindingArray(envName, validateAISearchNamespaceBinding)(
|
|
22093
|
+
diagnostics,
|
|
22094
|
+
`${field}.ai_search_namespaces`,
|
|
22095
|
+
previews.ai_search_namespaces,
|
|
22096
|
+
void 0
|
|
22097
|
+
) && isValid;
|
|
22098
|
+
isValid = validateBindingArray(envName, validateAISearchBinding)(
|
|
22099
|
+
diagnostics,
|
|
22100
|
+
`${field}.ai_search`,
|
|
22101
|
+
previews.ai_search,
|
|
22102
|
+
void 0
|
|
22103
|
+
) && isValid;
|
|
22029
22104
|
isValid = validateBindingArray(envName, validateHyperdriveBinding)(
|
|
22030
22105
|
diagnostics,
|
|
22031
22106
|
`${field}.hyperdrive`,
|
|
@@ -23181,7 +23256,6 @@ var BINDING_LOCAL_SUPPORT = {
|
|
|
23181
23256
|
flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
23182
23257
|
vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
23183
23258
|
vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
23184
|
-
websearch: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
23185
23259
|
agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
|
|
23186
23260
|
};
|
|
23187
23261
|
function getBindingLocalSupport(type) {
|
|
@@ -23679,11 +23753,6 @@ function convertConfigToBindings(config2, options) {
|
|
|
23679
23753
|
}
|
|
23680
23754
|
break;
|
|
23681
23755
|
}
|
|
23682
|
-
case "websearch": {
|
|
23683
|
-
const { binding, ...x } = info;
|
|
23684
|
-
output[binding] = { type: "websearch", ...x };
|
|
23685
|
-
break;
|
|
23686
|
-
}
|
|
23687
23756
|
case "agent_memory": {
|
|
23688
23757
|
for (const { binding, ...x } of info) {
|
|
23689
23758
|
output[binding] = { type: "agent_memory", ...x };
|
|
@@ -23856,7 +23925,6 @@ function printBindings(bindings, options) {
|
|
|
23856
23925
|
bindings
|
|
23857
23926
|
);
|
|
23858
23927
|
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
23859
|
-
const websearch = extractBindingsOfType("websearch", bindings);
|
|
23860
23928
|
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
23861
23929
|
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
23862
23930
|
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
@@ -24074,16 +24142,6 @@ function printBindings(bindings, options) {
|
|
|
24074
24142
|
}))
|
|
24075
24143
|
);
|
|
24076
24144
|
}
|
|
24077
|
-
if (websearch.length > 0) {
|
|
24078
|
-
output.push(
|
|
24079
|
-
...websearch.map(({ binding }) => ({
|
|
24080
|
-
name: binding,
|
|
24081
|
-
type: getBindingTypeFriendlyName("websearch"),
|
|
24082
|
-
value: void 0,
|
|
24083
|
-
mode: getMode({ isSimulatedLocally: false })
|
|
24084
|
-
}))
|
|
24085
|
-
);
|
|
24086
|
-
}
|
|
24087
24145
|
if (agent_memory.length > 0) {
|
|
24088
24146
|
output.push(
|
|
24089
24147
|
...agent_memory.map(({ binding, namespace }) => ({
|
|
@@ -24565,7 +24623,7 @@ ${allTailConsumers.map(({ service, streaming }) => {
|
|
|
24565
24623
|
log(
|
|
24566
24624
|
`${containersTitle}
|
|
24567
24625
|
${containers.map(
|
|
24568
|
-
(container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name} (durable_object)` : `- ${container.name} (${container.image})`
|
|
24626
|
+
(container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name ?? container.name} (durable_object)` : `- ${container.name} (${container.image})`
|
|
24569
24627
|
).join("\n")}`
|
|
24570
24628
|
);
|
|
24571
24629
|
log("");
|
|
@@ -26636,7 +26694,7 @@ function getWorkerNameFromProject(projectPath) {
|
|
|
26636
26694
|
}
|
|
26637
26695
|
__name(getWorkerNameFromProject, "getWorkerNameFromProject");
|
|
26638
26696
|
function toUrlPath(filePath) {
|
|
26639
|
-
|
|
26697
|
+
assert2(
|
|
26640
26698
|
!/^[a-z]:/i.test(filePath),
|
|
26641
26699
|
"Tried to convert a Windows file path with a drive to a URL path."
|
|
26642
26700
|
);
|