@cloudflare/deploy-helpers 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +201 -116
- package/dist/metafile-esm.json +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -11,10 +11,11 @@ import url2, { URLSearchParams as URLSearchParams$1 } from 'node:url';
|
|
|
11
11
|
import * as cli from '@cloudflare/cli-shared-helpers';
|
|
12
12
|
import { updateStatus, cancel } from '@cloudflare/cli-shared-helpers';
|
|
13
13
|
import { SchedulingPolicy, ApplicationsService, listDurableObjects, ApiError, resolveImageName, pushImageIfChanged, ContainerImagePreparationsService, ContainerImagePreparationStatus, createDurableObjectNamespaceResolver, initContainersSharedContext, pushBuiltContainerImage, deployContainers, verifyDockerInstalled } from '@cloudflare/containers-shared';
|
|
14
|
-
import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, getResolvedDurableObjectContainerApps, isDurableObjectContainerApp, getDockerPath, validateDurableObjectContainerApplications, getDurableObjectClassNameToUseSQLiteMap, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports,
|
|
14
|
+
import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, partitionExports, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, getResolvedDurableObjectContainerApps, isDurableObjectContainerApp, getDockerPath, validateDurableObjectContainerApplications, getDurableObjectClassNameToUseSQLiteMap, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, printBindings, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getDurableObjectContainerApps, getBindings, hasDurableObjectExports, parseNonHyphenedUuid, getWorkersCIBranchName, getCIOverrideName, getBindingTypeFriendlyName, defaultWranglerConfig } from '@cloudflare/workers-utils';
|
|
15
15
|
import { Response, FormData } from 'undici';
|
|
16
16
|
import chalk6 from 'chalk';
|
|
17
17
|
import PQueue from 'p-queue';
|
|
18
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
18
19
|
import { spinner, inputPrompt, leftT } from '@cloudflare/cli-shared-helpers/interactive';
|
|
19
20
|
import { writeFile, access, readFile, readdir, stat } from 'node:fs/promises';
|
|
20
21
|
import prettyBytes from 'pretty-bytes';
|
|
@@ -22,7 +23,6 @@ import { hash as hash$1 } from 'blake3-wasm';
|
|
|
22
23
|
import { Blob } from 'node:buffer';
|
|
23
24
|
import { gzipSync } from 'node:zlib';
|
|
24
25
|
import { brandColor, white, gray, bold, yellow, dim, red, blue } from '@cloudflare/cli-shared-helpers/colors';
|
|
25
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
26
26
|
import { setTimeout as setTimeout$1 } from 'node:timers/promises';
|
|
27
27
|
import readline from 'node:readline';
|
|
28
28
|
import { parse as parse$1 } from 'dotenv';
|
|
@@ -2753,6 +2753,82 @@ var EXPORTS_RECONCILIATION_ERROR_CODE = 100402;
|
|
|
2753
2753
|
var INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE = 100405;
|
|
2754
2754
|
var ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE = 100406;
|
|
2755
2755
|
var WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE = 10208;
|
|
2756
|
+
function isWorkflowDefinedInThisScript(workflow, scriptName) {
|
|
2757
|
+
return workflow.script_name === void 0 || workflow.script_name === scriptName;
|
|
2758
|
+
}
|
|
2759
|
+
__name(isWorkflowDefinedInThisScript, "isWorkflowDefinedInThisScript");
|
|
2760
|
+
function getWorkflowsOwnedByScript(config2, scriptName) {
|
|
2761
|
+
const owned = /* @__PURE__ */ new Map();
|
|
2762
|
+
for (const workflow of config2.workflows ?? []) {
|
|
2763
|
+
if (isWorkflowDefinedInThisScript(workflow, scriptName)) {
|
|
2764
|
+
owned.set(workflow.name, workflow);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
for (const [className, workflowExport] of Object.entries(
|
|
2768
|
+
partitionExports(config2.exports).workflow
|
|
2769
|
+
)) {
|
|
2770
|
+
const binding = owned.get(workflowExport.name);
|
|
2771
|
+
owned.set(workflowExport.name, {
|
|
2772
|
+
name: workflowExport.name,
|
|
2773
|
+
class_name: className,
|
|
2774
|
+
limits: binding?.limits ?? workflowExport.limits,
|
|
2775
|
+
concurrency: binding?.concurrency ?? workflowExport.concurrency,
|
|
2776
|
+
schedules: binding?.schedules ?? workflowExport.schedules,
|
|
2777
|
+
default_retention: binding?.default_retention ?? workflowExport.default_retention
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
return [...owned.values()];
|
|
2781
|
+
}
|
|
2782
|
+
__name(getWorkflowsOwnedByScript, "getWorkflowsOwnedByScript");
|
|
2783
|
+
function validateOwnedWorkflowDeclarations(config2, scriptName) {
|
|
2784
|
+
const exportsByWorkflowName = new Map(
|
|
2785
|
+
Object.entries(partitionExports(config2.exports).workflow).map(
|
|
2786
|
+
([className, workflowExport]) => [
|
|
2787
|
+
workflowExport.name,
|
|
2788
|
+
{ className, workflowExport }
|
|
2789
|
+
]
|
|
2790
|
+
)
|
|
2791
|
+
);
|
|
2792
|
+
const errors = [];
|
|
2793
|
+
for (const [index, workflow] of (config2.workflows ?? []).entries()) {
|
|
2794
|
+
const match = exportsByWorkflowName.get(workflow.name);
|
|
2795
|
+
if (match === void 0) {
|
|
2796
|
+
continue;
|
|
2797
|
+
}
|
|
2798
|
+
const { className, workflowExport } = match;
|
|
2799
|
+
if (!isWorkflowDefinedInThisScript(workflow, scriptName)) {
|
|
2800
|
+
errors.push(
|
|
2801
|
+
`"workflows[${index}]" binds the Workflow "${workflow.name}" of the Worker "${workflow.script_name}", but "exports.${className}" declares it in this Worker. Workflow names are unique per account, so remove "script_name" from the binding or give the export a different name.`
|
|
2802
|
+
);
|
|
2803
|
+
continue;
|
|
2804
|
+
}
|
|
2805
|
+
if (workflow.class_name !== className) {
|
|
2806
|
+
errors.push(
|
|
2807
|
+
`"workflows[${index}]" and "exports.${className}" both declare the Workflow "${workflow.name}", but with different classes ("${workflow.class_name}" and "${className}").`
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
for (const key of [
|
|
2811
|
+
"limits",
|
|
2812
|
+
"concurrency",
|
|
2813
|
+
"schedules",
|
|
2814
|
+
"default_retention"
|
|
2815
|
+
]) {
|
|
2816
|
+
const bindingValue = workflow[key];
|
|
2817
|
+
const exportValue = workflowExport[key];
|
|
2818
|
+
if (bindingValue !== void 0 && exportValue !== void 0 && !isDeepStrictEqual([bindingValue].flat(), [exportValue].flat())) {
|
|
2819
|
+
errors.push(
|
|
2820
|
+
`"workflows[${index}].${key}" and "exports.${className}.${key}" both configure the Workflow "${workflow.name}", but with different values. Set "${key}" in only one of them.`
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (errors.length > 0) {
|
|
2826
|
+
throw new UserError(errors.join("\n"), {
|
|
2827
|
+
telemetryMessage: "workflow binding and export declarations conflict"
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
__name(validateOwnedWorkflowDeclarations, "validateOwnedWorkflowDeclarations");
|
|
2756
2832
|
|
|
2757
2833
|
// src/deploy/helpers/worker-not-found-error.ts
|
|
2758
2834
|
var WORKER_NOT_FOUND_ERR_CODE = 10007;
|
|
@@ -4007,6 +4083,7 @@ async function triggersDeploy(props) {
|
|
|
4007
4083
|
const { config: config2, scriptName, routes, crons } = props;
|
|
4008
4084
|
if (props.validated !== true) {
|
|
4009
4085
|
validateEventTriggerTargets(config2, scriptName);
|
|
4086
|
+
validateOwnedWorkflowDeclarations(config2, scriptName);
|
|
4010
4087
|
}
|
|
4011
4088
|
if (props.dryRun) {
|
|
4012
4089
|
logger.log(`--dry-run: exiting now.`);
|
|
@@ -4031,9 +4108,7 @@ async function triggersDeploy(props) {
|
|
|
4031
4108
|
const uploadMs = Date.now() - start;
|
|
4032
4109
|
const deployments = [];
|
|
4033
4110
|
const workflowDeployments = [];
|
|
4034
|
-
const
|
|
4035
|
-
(workflow) => isWorkflowDefinedInThisScript(workflow, scriptName)
|
|
4036
|
-
);
|
|
4111
|
+
const ownedWorkflows = getWorkflowsOwnedByScript(config2, scriptName);
|
|
4037
4112
|
const { wantWorkersDev, workersDevInSync } = await subdomainDeploy(
|
|
4038
4113
|
props,
|
|
4039
4114
|
accountId,
|
|
@@ -4101,7 +4176,7 @@ ${dashLink}`, {
|
|
|
4101
4176
|
});
|
|
4102
4177
|
}
|
|
4103
4178
|
}
|
|
4104
|
-
if (!wantWorkersDev &&
|
|
4179
|
+
if (!wantWorkersDev && ownedWorkflows.length > 0) {
|
|
4105
4180
|
await getWorkersDevSubdomain(config2, accountId, {
|
|
4106
4181
|
configPath: config2.configPath,
|
|
4107
4182
|
registrationContext: "workflows"
|
|
@@ -4182,98 +4257,97 @@ ${dashLink}`, {
|
|
|
4182
4257
|
)
|
|
4183
4258
|
);
|
|
4184
4259
|
}
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
if (
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
);
|
|
4195
|
-
}
|
|
4196
|
-
if (workflow.concurrency) {
|
|
4197
|
-
throw new UserError(
|
|
4198
|
-
`Workflow "${workflow.name}" has "concurrency" configured but references external script "${workflow.script_name}". Configure concurrency on the worker that defines the workflow.`,
|
|
4199
|
-
{
|
|
4200
|
-
telemetryMessage: "triggers deploy workflow concurrency external script"
|
|
4201
|
-
}
|
|
4202
|
-
);
|
|
4203
|
-
}
|
|
4204
|
-
if (workflow.schedules) {
|
|
4205
|
-
throw new UserError(
|
|
4206
|
-
`Workflow "${workflow.name}" has "schedules" configured but references external script "${workflow.script_name}". Configure schedules on the worker that defines the workflow.`,
|
|
4207
|
-
{
|
|
4208
|
-
telemetryMessage: "triggers deploy workflow schedules external script"
|
|
4209
|
-
}
|
|
4210
|
-
);
|
|
4211
|
-
}
|
|
4212
|
-
if (workflow.default_retention) {
|
|
4213
|
-
throw new UserError(
|
|
4214
|
-
`Workflow "${workflow.name}" has "default_retention" configured but references external script "${workflow.script_name}". Configure default_retention on the worker that defines the workflow.`,
|
|
4215
|
-
{
|
|
4216
|
-
telemetryMessage: "triggers deploy workflow default_retention external script"
|
|
4217
|
-
}
|
|
4218
|
-
);
|
|
4219
|
-
}
|
|
4220
|
-
continue;
|
|
4260
|
+
for (const workflow of config2.workflows) {
|
|
4261
|
+
if (!isWorkflowDefinedInThisScript(workflow, scriptName)) {
|
|
4262
|
+
if (workflow.limits) {
|
|
4263
|
+
throw new UserError(
|
|
4264
|
+
`Workflow "${workflow.name}" has "limits" configured but references external script "${workflow.script_name}". Configure limits on the worker that defines the workflow.`,
|
|
4265
|
+
{
|
|
4266
|
+
telemetryMessage: "triggers deploy workflow limits external script"
|
|
4267
|
+
}
|
|
4268
|
+
);
|
|
4221
4269
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
config2,
|
|
4226
|
-
`/accounts/${accountId}/workflows/${workflow.name}`,
|
|
4270
|
+
if (workflow.concurrency) {
|
|
4271
|
+
throw new UserError(
|
|
4272
|
+
`Workflow "${workflow.name}" has "concurrency" configured but references external script "${workflow.script_name}". Configure concurrency on the worker that defines the workflow.`,
|
|
4227
4273
|
{
|
|
4228
|
-
|
|
4229
|
-
body: JSON.stringify({
|
|
4230
|
-
script_name: scriptName,
|
|
4231
|
-
class_name: workflow.class_name,
|
|
4232
|
-
...workflow.limits && { limits: workflow.limits },
|
|
4233
|
-
...workflow.concurrency && {
|
|
4234
|
-
concurrency: workflow.concurrency
|
|
4235
|
-
},
|
|
4236
|
-
...workflow.schedules && {
|
|
4237
|
-
schedules: (Array.isArray(workflow.schedules) ? workflow.schedules : [workflow.schedules]).map((cron) => ({ cron }))
|
|
4238
|
-
},
|
|
4239
|
-
...workflow.default_retention && {
|
|
4240
|
-
default_retention: workflow.default_retention
|
|
4241
|
-
}
|
|
4242
|
-
}),
|
|
4243
|
-
headers: {
|
|
4244
|
-
"Content-Type": "application/json"
|
|
4245
|
-
}
|
|
4274
|
+
telemetryMessage: "triggers deploy workflow concurrency external script"
|
|
4246
4275
|
}
|
|
4247
|
-
)
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
}
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4276
|
+
);
|
|
4277
|
+
}
|
|
4278
|
+
if (workflow.schedules) {
|
|
4279
|
+
throw new UserError(
|
|
4280
|
+
`Workflow "${workflow.name}" has "schedules" configured but references external script "${workflow.script_name}". Configure schedules on the worker that defines the workflow.`,
|
|
4281
|
+
{
|
|
4282
|
+
telemetryMessage: "triggers deploy workflow schedules external script"
|
|
4283
|
+
}
|
|
4284
|
+
);
|
|
4285
|
+
}
|
|
4286
|
+
if (workflow.default_retention) {
|
|
4287
|
+
throw new UserError(
|
|
4288
|
+
`Workflow "${workflow.name}" has "default_retention" configured but references external script "${workflow.script_name}". Configure default_retention on the worker that defines the workflow.`,
|
|
4289
|
+
{
|
|
4290
|
+
telemetryMessage: "triggers deploy workflow default_retention external script"
|
|
4291
|
+
}
|
|
4292
|
+
);
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
for (const workflow of ownedWorkflows) {
|
|
4297
|
+
workflowDeployments.push({
|
|
4298
|
+
name: workflow.name,
|
|
4299
|
+
deployment: fetchResult(
|
|
4300
|
+
config2,
|
|
4301
|
+
`/accounts/${accountId}/workflows/${workflow.name}`,
|
|
4302
|
+
{
|
|
4303
|
+
method: "PUT",
|
|
4304
|
+
body: JSON.stringify({
|
|
4305
|
+
script_name: scriptName,
|
|
4306
|
+
class_name: workflow.class_name,
|
|
4307
|
+
...workflow.limits && { limits: workflow.limits },
|
|
4308
|
+
...workflow.concurrency && {
|
|
4309
|
+
concurrency: workflow.concurrency
|
|
4310
|
+
},
|
|
4311
|
+
...workflow.schedules && {
|
|
4312
|
+
schedules: (Array.isArray(workflow.schedules) ? workflow.schedules : [workflow.schedules]).map((cron) => ({ cron }))
|
|
4313
|
+
},
|
|
4314
|
+
...workflow.default_retention && {
|
|
4315
|
+
default_retention: workflow.default_retention
|
|
4266
4316
|
}
|
|
4317
|
+
}),
|
|
4318
|
+
headers: {
|
|
4319
|
+
"Content-Type": "application/json"
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
).then(
|
|
4323
|
+
() => ({
|
|
4324
|
+
category: "Workflows",
|
|
4325
|
+
targets: [`workflow: ${workflow.name}`]
|
|
4326
|
+
}),
|
|
4327
|
+
(error51) => {
|
|
4328
|
+
if (error51 instanceof APIError && error51.code === WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE && workflow.schedules) {
|
|
4329
|
+
error51.preventReport();
|
|
4267
4330
|
return {
|
|
4268
4331
|
category: "Workflows",
|
|
4269
|
-
resource: `Workflow "${workflow.name}"`,
|
|
4270
4332
|
targets: [],
|
|
4271
|
-
error:
|
|
4333
|
+
error: new UserError(
|
|
4334
|
+
`Workflow "${workflow.name}" has "schedules" configured, but scheduled Workflows require a paid Workers plan.`,
|
|
4335
|
+
{
|
|
4336
|
+
cause: error51,
|
|
4337
|
+
telemetryMessage: "triggers deploy workflow cron requires paid plan"
|
|
4338
|
+
}
|
|
4339
|
+
)
|
|
4272
4340
|
};
|
|
4273
4341
|
}
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4342
|
+
return {
|
|
4343
|
+
category: "Workflows",
|
|
4344
|
+
resource: `Workflow "${workflow.name}"`,
|
|
4345
|
+
targets: [],
|
|
4346
|
+
error: error51
|
|
4347
|
+
};
|
|
4348
|
+
}
|
|
4349
|
+
)
|
|
4350
|
+
});
|
|
4277
4351
|
}
|
|
4278
4352
|
const completedWorkflowDeployments = await Promise.all(
|
|
4279
4353
|
workflowDeployments.map(async ({ name, deployment }) => ({
|
|
@@ -4570,12 +4644,12 @@ async function subdomainDeploy(props, accountId, scriptName, workerUrl, routes,
|
|
|
4570
4644
|
}
|
|
4571
4645
|
__name(subdomainDeploy, "subdomainDeploy");
|
|
4572
4646
|
function validateEventTriggerTargets(config2, scriptName) {
|
|
4647
|
+
const ownedWorkflowNames = new Set(
|
|
4648
|
+
getWorkflowsOwnedByScript(config2, scriptName).map(({ name }) => name)
|
|
4649
|
+
);
|
|
4573
4650
|
for (const event of config2.triggers?.events ?? []) {
|
|
4574
4651
|
for (const target of event.targets) {
|
|
4575
|
-
|
|
4576
|
-
(workflow) => workflow.name === target.workflow_name && isWorkflowDefinedInThisScript(workflow, scriptName)
|
|
4577
|
-
);
|
|
4578
|
-
if (!isDefinedByThisWorker) {
|
|
4652
|
+
if (!ownedWorkflowNames.has(target.workflow_name)) {
|
|
4579
4653
|
throw new UserError(
|
|
4580
4654
|
`Event trigger "${event.type}" targets Workflow "${target.workflow_name}", but that Workflow is not defined by this Worker.
|
|
4581
4655
|
|
|
@@ -4589,10 +4663,6 @@ Add it to the "workflows" configuration or remove the event trigger target.`,
|
|
|
4589
4663
|
}
|
|
4590
4664
|
}
|
|
4591
4665
|
__name(validateEventTriggerTargets, "validateEventTriggerTargets");
|
|
4592
|
-
function isWorkflowDefinedInThisScript(workflow, scriptName) {
|
|
4593
|
-
return workflow.script_name === void 0 || workflow.script_name === scriptName;
|
|
4594
|
-
}
|
|
4595
|
-
__name(isWorkflowDefinedInThisScript, "isWorkflowDefinedInThisScript");
|
|
4596
4666
|
|
|
4597
4667
|
// ../workers-shared/utils/configuration/constants.ts
|
|
4598
4668
|
var MAX_ROUTES_RULES = 100;
|
|
@@ -6679,10 +6749,16 @@ var IMAGE_PREPARATION_POLL_INTERVAL_MS = 2e3;
|
|
|
6679
6749
|
var IMAGE_PREPARATION_TIMEOUT_MS = 15 * 6e4;
|
|
6680
6750
|
function getApplicationSettings(container) {
|
|
6681
6751
|
const flags = container.unsafe?.configuration?.experimental_flags;
|
|
6752
|
+
const configuration = {
|
|
6753
|
+
...flags !== void 0 && { experimental_flags: flags },
|
|
6754
|
+
// The Containers API calls `ssh` `wrangler_ssh`.
|
|
6755
|
+
...container.ssh !== void 0 && { wrangler_ssh: container.ssh },
|
|
6756
|
+
...container.authorized_keys !== void 0 && {
|
|
6757
|
+
authorized_keys: container.authorized_keys
|
|
6758
|
+
}
|
|
6759
|
+
};
|
|
6682
6760
|
return {
|
|
6683
|
-
...
|
|
6684
|
-
configuration: { experimental_flags: flags }
|
|
6685
|
-
},
|
|
6761
|
+
...Object.keys(configuration).length > 0 && { configuration },
|
|
6686
6762
|
...container.observability !== void 0 && {
|
|
6687
6763
|
observability: {
|
|
6688
6764
|
logs: {
|
|
@@ -6697,6 +6773,13 @@ function normalizeFlags(flags = []) {
|
|
|
6697
6773
|
return [...new Set(flags)].sort();
|
|
6698
6774
|
}
|
|
6699
6775
|
__name(normalizeFlags, "normalizeFlags");
|
|
6776
|
+
function hasConfigurationChanged(configured, existing = {}) {
|
|
6777
|
+
return configured.experimental_flags !== void 0 && !isDeepStrictEqual(
|
|
6778
|
+
normalizeFlags(configured.experimental_flags),
|
|
6779
|
+
normalizeFlags(existing.experimental_flags)
|
|
6780
|
+
) || configured.wrangler_ssh !== void 0 && !isDeepStrictEqual(configured.wrangler_ssh, existing.wrangler_ssh) || configured.authorized_keys !== void 0 && !isDeepStrictEqual(configured.authorized_keys, existing.authorized_keys);
|
|
6781
|
+
}
|
|
6782
|
+
__name(hasConfigurationChanged, "hasConfigurationChanged");
|
|
6700
6783
|
function isRegistryImage(image) {
|
|
6701
6784
|
return typeof image.image === "string";
|
|
6702
6785
|
}
|
|
@@ -6863,10 +6946,7 @@ async function applyApplication(application, namespaceId, settings = {}, updateE
|
|
|
6863
6946
|
return;
|
|
6864
6947
|
}
|
|
6865
6948
|
const patch = {};
|
|
6866
|
-
if (settings.configuration !== void 0 &&
|
|
6867
|
-
normalizeFlags(settings.configuration.experimental_flags),
|
|
6868
|
-
normalizeFlags(existing.configuration?.experimental_flags)
|
|
6869
|
-
)) {
|
|
6949
|
+
if (settings.configuration !== void 0 && hasConfigurationChanged(settings.configuration, existing.configuration)) {
|
|
6870
6950
|
patch.configuration = settings.configuration;
|
|
6871
6951
|
}
|
|
6872
6952
|
if (settings.observability !== void 0 && !isDeepStrictEqual(settings.observability, existing.observability)) {
|
|
@@ -7267,7 +7347,14 @@ async function resolveExportsUploadPayload(props) {
|
|
|
7267
7347
|
const { migrations, exports: durableObjectExports } = await resolveDoLifecyclePayload(props);
|
|
7268
7348
|
const exports$1 = {
|
|
7269
7349
|
...partitionedExports.worker,
|
|
7270
|
-
...durableObjectExports ?? {}
|
|
7350
|
+
...durableObjectExports ?? {},
|
|
7351
|
+
// Workflow settings are applied when `triggers deploy` provisions the
|
|
7352
|
+
// Workflow; the upload API only accepts the type and name.
|
|
7353
|
+
...Object.fromEntries(
|
|
7354
|
+
Object.entries(partitionedExports.workflow).map(
|
|
7355
|
+
([className, { name }]) => [className, { type: "workflow", name }]
|
|
7356
|
+
)
|
|
7357
|
+
)
|
|
7271
7358
|
};
|
|
7272
7359
|
return {
|
|
7273
7360
|
migrations,
|
|
@@ -23993,6 +24080,7 @@ external_exports.object({
|
|
|
23993
24080
|
"none"
|
|
23994
24081
|
]).optional(),
|
|
23995
24082
|
not_found_handling: external_exports.enum(["single-page-application", "404-page", "none"]).optional(),
|
|
24083
|
+
base_path: external_exports.string().optional(),
|
|
23996
24084
|
redirects: RedirectsSchema,
|
|
23997
24085
|
headers: HeadersSchema,
|
|
23998
24086
|
has_static_routing: external_exports.boolean().optional(),
|
|
@@ -24383,10 +24471,8 @@ async function getWorkflow(config2, accountId, workflowName) {
|
|
|
24383
24471
|
}
|
|
24384
24472
|
__name(getWorkflow, "getWorkflow");
|
|
24385
24473
|
async function checkWorkflowConflicts(config2, accountId, scriptName) {
|
|
24386
|
-
const workflowsToDeploy = config2
|
|
24387
|
-
|
|
24388
|
-
);
|
|
24389
|
-
if (!workflowsToDeploy?.length) {
|
|
24474
|
+
const workflowsToDeploy = getWorkflowsOwnedByScript(config2, scriptName);
|
|
24475
|
+
if (!workflowsToDeploy.length) {
|
|
24390
24476
|
return { hasConflicts: false };
|
|
24391
24477
|
}
|
|
24392
24478
|
const workflowChecks = await Promise.all(
|
|
@@ -25164,6 +25250,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
25164
25250
|
{ telemetryMessage: "data_blobs with es module worker" }
|
|
25165
25251
|
);
|
|
25166
25252
|
}
|
|
25253
|
+
validateOwnedWorkflowDeclarations(config2, name);
|
|
25167
25254
|
if (props.command === "deploy") {
|
|
25168
25255
|
validateEventTriggerTargets(config2, name);
|
|
25169
25256
|
validateRoutes(props.routes, props.assetsOptions);
|
|
@@ -25311,13 +25398,11 @@ Edits that have been made via the script API will be overridden by your local co
|
|
|
25311
25398
|
return { workerTag, tags, workerExists, aborted: true };
|
|
25312
25399
|
}
|
|
25313
25400
|
}
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25319
|
-
return { workerTag, tags, workerExists, aborted: true };
|
|
25320
|
-
}
|
|
25401
|
+
const workflowCheck = await checkWorkflowConflicts(config2, accountId, name);
|
|
25402
|
+
if (workflowCheck.hasConflicts) {
|
|
25403
|
+
logger.warn(workflowCheck.message);
|
|
25404
|
+
if (!await deployConfirm("Do you want to continue?")) {
|
|
25405
|
+
return { workerTag, tags, workerExists, aborted: true };
|
|
25321
25406
|
}
|
|
25322
25407
|
}
|
|
25323
25408
|
await ensureQueuesExistByConfig(
|