wrangler 4.7.2 → 4.9.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/config-schema.json +56 -0
- package/package.json +6 -6
- package/wrangler-dist/cli.d.ts +30 -3
- package/wrangler-dist/cli.js +634 -307
package/wrangler-dist/cli.js
CHANGED
@@ -77785,12 +77785,12 @@ var html_rewriter_exports = {};
|
|
77785
77785
|
__export(html_rewriter_exports, {
|
77786
77786
|
HTMLRewriter: () => HTMLRewriter2
|
77787
77787
|
});
|
77788
|
-
var import_web2,
|
77788
|
+
var import_web2, import_miniflare26, HTMLRewriter2;
|
77789
77789
|
var init_html_rewriter = __esm({
|
77790
77790
|
"../pages-shared/environment-polyfills/html-rewriter.ts"() {
|
77791
77791
|
init_import_meta_url();
|
77792
77792
|
import_web2 = require("stream/web");
|
77793
|
-
|
77793
|
+
import_miniflare26 = require("miniflare");
|
77794
77794
|
HTMLRewriter2 = class {
|
77795
77795
|
static {
|
77796
77796
|
__name(this, "HTMLRewriter");
|
@@ -77808,9 +77808,9 @@ var init_html_rewriter = __esm({
|
|
77808
77808
|
transform(response) {
|
77809
77809
|
const body = response.body;
|
77810
77810
|
if (body === null) {
|
77811
|
-
return new
|
77811
|
+
return new import_miniflare26.Response(body, response);
|
77812
77812
|
}
|
77813
|
-
response = new
|
77813
|
+
response = new import_miniflare26.Response(response.body, response);
|
77814
77814
|
let rewriter;
|
77815
77815
|
const transformStream = new import_web2.TransformStream({
|
77816
77816
|
start: /* @__PURE__ */ __name(async (controller) => {
|
@@ -77839,7 +77839,7 @@ var init_html_rewriter = __esm({
|
|
77839
77839
|
const promise = body.pipeTo(transformStream.writable);
|
77840
77840
|
promise.catch(() => {
|
77841
77841
|
}).finally(() => rewriter.free());
|
77842
|
-
const res = new
|
77842
|
+
const res = new import_miniflare26.Response(transformStream.readable, response);
|
77843
77843
|
res.headers.delete("Content-Length");
|
77844
77844
|
return res;
|
77845
77845
|
}
|
@@ -78698,17 +78698,17 @@ async function generateASSETSBinding(options33) {
|
|
78698
78698
|
try {
|
78699
78699
|
const url4 = new URL(miniflareRequest.url);
|
78700
78700
|
url4.host = `localhost:${options33.proxyPort}`;
|
78701
|
-
const proxyRequest = new
|
78701
|
+
const proxyRequest = new import_miniflare27.Request(url4, miniflareRequest);
|
78702
78702
|
if (proxyRequest.headers.get("Upgrade") === "websocket") {
|
78703
78703
|
proxyRequest.headers.delete("Sec-WebSocket-Accept");
|
78704
78704
|
proxyRequest.headers.delete("Sec-WebSocket-Key");
|
78705
78705
|
}
|
78706
|
-
return await (0,
|
78706
|
+
return await (0, import_miniflare27.fetch)(proxyRequest, {
|
78707
78707
|
dispatcher: new ProxyDispatcher(miniflareRequest.headers.get("Host"))
|
78708
78708
|
});
|
78709
78709
|
} catch (thrown) {
|
78710
78710
|
options33.log.error(new Error(`Could not proxy request: ${thrown}`));
|
78711
|
-
return new
|
78711
|
+
return new import_miniflare27.Response(`[wrangler] Could not proxy request: ${thrown}`, {
|
78712
78712
|
status: 502
|
78713
78713
|
});
|
78714
78714
|
}
|
@@ -78717,7 +78717,7 @@ async function generateASSETSBinding(options33) {
|
|
78717
78717
|
return await assetsFetch(miniflareRequest);
|
78718
78718
|
} catch (thrown) {
|
78719
78719
|
options33.log.error(new Error(`Could not serve static asset: ${thrown}`));
|
78720
|
-
return new
|
78720
|
+
return new import_miniflare27.Response(
|
78721
78721
|
`[wrangler] Could not serve static asset: ${thrown}`,
|
78722
78722
|
{ status: 502 }
|
78723
78723
|
);
|
@@ -78829,11 +78829,11 @@ async function generateAssetsFetch(directory, log2) {
|
|
78829
78829
|
});
|
78830
78830
|
}, "generateResponse");
|
78831
78831
|
return async (input, init2) => {
|
78832
|
-
const request4 = new
|
78832
|
+
const request4 = new import_miniflare27.Request(input, init2);
|
78833
78833
|
return await generateResponse(request4);
|
78834
78834
|
};
|
78835
78835
|
}
|
78836
|
-
var import_node_assert25, import_node_fs33, import_node_path62, import_mime3,
|
78836
|
+
var import_node_assert25, import_node_fs33, import_node_path62, import_mime3, import_miniflare27, import_undici23, ProxyDispatcher, invalidAssetsFetch;
|
78837
78837
|
var init_assets = __esm({
|
78838
78838
|
"src/miniflare-cli/assets.ts"() {
|
78839
78839
|
init_import_meta_url();
|
@@ -78845,7 +78845,7 @@ var init_assets = __esm({
|
|
78845
78845
|
init_parseRedirects();
|
78846
78846
|
init_esm2();
|
78847
78847
|
import_mime3 = __toESM(require_mime());
|
78848
|
-
|
78848
|
+
import_miniflare27 = require("miniflare");
|
78849
78849
|
import_undici23 = __toESM(require_undici());
|
78850
78850
|
init_hash();
|
78851
78851
|
__name(generateASSETSBinding, "generateASSETSBinding");
|
@@ -81185,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81185
81185
|
|
81186
81186
|
// package.json
|
81187
81187
|
var name = "wrangler";
|
81188
|
-
var version = "4.
|
81188
|
+
var version = "4.9.0";
|
81189
81189
|
|
81190
81190
|
// src/environment-variables/misc-variables.ts
|
81191
81191
|
init_import_meta_url();
|
@@ -83843,6 +83843,7 @@ var friendlyBindingNames = {
|
|
83843
83843
|
mtls_certificates: "mTLS Certificates",
|
83844
83844
|
workflows: "Workflows",
|
83845
83845
|
pipelines: "Pipelines",
|
83846
|
+
secrets_store_secrets: "Secrets Store Secrets",
|
83846
83847
|
assets: "Assets"
|
83847
83848
|
};
|
83848
83849
|
function printBindings(bindings, context2 = {}) {
|
@@ -83872,6 +83873,7 @@ function printBindings(bindings, context2 = {}) {
|
|
83872
83873
|
hyperdrive: hyperdrive2,
|
83873
83874
|
r2_buckets,
|
83874
83875
|
logfwdr,
|
83876
|
+
secrets_store_secrets,
|
83875
83877
|
services,
|
83876
83878
|
analytics_engine_datasets,
|
83877
83879
|
text_blobs,
|
@@ -83956,16 +83958,17 @@ function printBindings(bindings, context2 = {}) {
|
|
83956
83958
|
if (send_email !== void 0 && send_email.length > 0) {
|
83957
83959
|
output.push({
|
83958
83960
|
name: friendlyBindingNames.send_email,
|
83959
|
-
entries: send_email.map(
|
83960
|
-
|
83961
|
-
|
83962
|
-
|
83963
|
-
|
83964
|
-
|
83965
|
-
)
|
83966
|
-
|
83967
|
-
|
83968
|
-
|
83961
|
+
entries: send_email.map((emailBinding) => {
|
83962
|
+
const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
|
83963
|
+
const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
|
83964
|
+
return {
|
83965
|
+
key: emailBinding.name,
|
83966
|
+
value: addSuffix(
|
83967
|
+
destination_address || allowed_destination_addresses?.join(", ") || "unrestricted",
|
83968
|
+
{ isSimulatedLocally: true }
|
83969
|
+
)
|
83970
|
+
};
|
83971
|
+
})
|
83969
83972
|
});
|
83970
83973
|
}
|
83971
83974
|
if (queues2 !== void 0 && queues2.length > 0) {
|
@@ -84053,6 +84056,21 @@ function printBindings(bindings, context2 = {}) {
|
|
84053
84056
|
})
|
84054
84057
|
});
|
84055
84058
|
}
|
84059
|
+
if (secrets_store_secrets !== void 0 && secrets_store_secrets.length > 0) {
|
84060
|
+
output.push({
|
84061
|
+
name: friendlyBindingNames.secrets_store_secrets,
|
84062
|
+
entries: secrets_store_secrets.map(
|
84063
|
+
({ binding, store_id, secret_name }) => {
|
84064
|
+
return {
|
84065
|
+
key: binding,
|
84066
|
+
value: addSuffix(`${store_id}/${secret_name}`, {
|
84067
|
+
isSimulatedLocally: true
|
84068
|
+
})
|
84069
|
+
};
|
84070
|
+
}
|
84071
|
+
)
|
84072
|
+
});
|
84073
|
+
}
|
84056
84074
|
if (services !== void 0 && services.length > 0) {
|
84057
84075
|
output.push({
|
84058
84076
|
name: friendlyBindingNames.services,
|
@@ -84751,52 +84769,74 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args)
|
|
84751
84769
|
rawConfig,
|
84752
84770
|
isDispatchNamespace
|
84753
84771
|
);
|
84772
|
+
const isRedirectedConfig = configPath && configPath !== userConfigPath;
|
84773
|
+
const definedEnvironments = Object.keys(rawConfig.env ?? {});
|
84774
|
+
if (isRedirectedConfig && definedEnvironments.length > 0) {
|
84775
|
+
diagnostics.errors.push(
|
84776
|
+
dedent`
|
84777
|
+
Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env6) => ` - ${env6}`).join("\n")}
|
84778
|
+
|
84779
|
+
|
84780
|
+
Such configurations are generated by tools, meaning that one of the tools
|
84781
|
+
your application is using is generating the incorrect configuration.
|
84782
|
+
Report this issue to the tool's author so that this can be fixed there.
|
84783
|
+
`
|
84784
|
+
);
|
84785
|
+
}
|
84754
84786
|
const envName = args.env;
|
84755
84787
|
(0, import_node_assert.default)(envName === void 0 || typeof envName === "string");
|
84756
84788
|
let activeEnv = topLevelEnv;
|
84757
84789
|
if (envName !== void 0) {
|
84758
|
-
|
84759
|
-
`
|
84760
|
-
|
84761
|
-
|
84762
|
-
|
84763
|
-
|
84764
|
-
|
84765
|
-
|
84766
|
-
|
84767
|
-
isDispatchNamespace,
|
84768
|
-
envName,
|
84769
|
-
topLevelEnv,
|
84770
|
-
isLegacyEnv2,
|
84771
|
-
rawConfig
|
84772
|
-
);
|
84773
|
-
diagnostics.addChild(envDiagnostics);
|
84774
|
-
} else if (!isPagesConfig(rawConfig)) {
|
84775
|
-
activeEnv = normalizeAndValidateEnvironment(
|
84776
|
-
envDiagnostics,
|
84777
|
-
configPath,
|
84778
|
-
topLevelEnv,
|
84779
|
-
// in this case reuse the topLevelEnv to ensure that nonInherited fields are not removed
|
84780
|
-
isDispatchNamespace,
|
84781
|
-
envName,
|
84782
|
-
topLevelEnv,
|
84783
|
-
isLegacyEnv2,
|
84784
|
-
rawConfig
|
84790
|
+
if (isRedirectedConfig) {
|
84791
|
+
diagnostics.errors.push(dedent`
|
84792
|
+
You have specified the environment "${envName}", but are using a redirected configuration, produced by a build tool such as Vite.
|
84793
|
+
You need to set the environment in your build tool, rather than via Wrangler.
|
84794
|
+
For example, if you are using Vite, refer to these docs: https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/
|
84795
|
+
`);
|
84796
|
+
} else {
|
84797
|
+
const envDiagnostics = new Diagnostics(
|
84798
|
+
`"env.${envName}" environment configuration`
|
84785
84799
|
);
|
84786
|
-
const
|
84787
|
-
|
84788
|
-
|
84800
|
+
const rawEnv = rawConfig.env?.[envName];
|
84801
|
+
if (rawEnv !== void 0) {
|
84802
|
+
activeEnv = normalizeAndValidateEnvironment(
|
84803
|
+
envDiagnostics,
|
84804
|
+
configPath,
|
84805
|
+
rawEnv,
|
84806
|
+
isDispatchNamespace,
|
84807
|
+
envName,
|
84808
|
+
topLevelEnv,
|
84809
|
+
isLegacyEnv2,
|
84810
|
+
rawConfig
|
84811
|
+
);
|
84812
|
+
diagnostics.addChild(envDiagnostics);
|
84813
|
+
} else if (!isPagesConfig(rawConfig)) {
|
84814
|
+
activeEnv = normalizeAndValidateEnvironment(
|
84815
|
+
envDiagnostics,
|
84816
|
+
configPath,
|
84817
|
+
topLevelEnv,
|
84818
|
+
// in this case reuse the topLevelEnv to ensure that nonInherited fields are not removed
|
84819
|
+
isDispatchNamespace,
|
84820
|
+
envName,
|
84821
|
+
topLevelEnv,
|
84822
|
+
isLegacyEnv2,
|
84823
|
+
rawConfig
|
84824
|
+
);
|
84825
|
+
const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(
|
84826
|
+
Object.keys(rawConfig.env)
|
84827
|
+
)}
|
84789
84828
|
` : "";
|
84790
|
-
|
84829
|
+
const message = `No environment found in configuration with name "${envName}".
|
84791
84830
|
Before using \`--env=${envName}\` there should be an equivalent environment section in the configuration.
|
84792
84831
|
${envNames}
|
84793
84832
|
Consider adding an environment configuration section to the ${configFileName(configPath)} file:
|
84794
84833
|
\`\`\`
|
84795
84834
|
[env.` + envName + "]\n```\n";
|
84796
|
-
|
84797
|
-
|
84798
|
-
|
84799
|
-
|
84835
|
+
if (envNames.length > 0) {
|
84836
|
+
diagnostics.errors.push(message);
|
84837
|
+
} else {
|
84838
|
+
diagnostics.warnings.push(message);
|
84839
|
+
}
|
84800
84840
|
}
|
84801
84841
|
}
|
84802
84842
|
}
|
@@ -85690,6 +85730,16 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
85690
85730
|
validateBindingArray(envName, validatePipelineBinding),
|
85691
85731
|
[]
|
85692
85732
|
),
|
85733
|
+
secrets_store_secrets: notInheritable(
|
85734
|
+
diagnostics,
|
85735
|
+
topLevelEnv,
|
85736
|
+
rawConfig,
|
85737
|
+
rawEnv,
|
85738
|
+
envName,
|
85739
|
+
"secrets_store_secrets",
|
85740
|
+
validateBindingArray(envName, validateSecretsStoreSecretBinding),
|
85741
|
+
[]
|
85742
|
+
),
|
85693
85743
|
version_metadata: notInheritable(
|
85694
85744
|
diagnostics,
|
85695
85745
|
topLevelEnv,
|
@@ -87097,6 +87147,45 @@ var validatePipelineBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
87097
87147
|
]);
|
87098
87148
|
return isValid2;
|
87099
87149
|
}, "validatePipelineBinding");
|
87150
|
+
var validateSecretsStoreSecretBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
87151
|
+
if (typeof value !== "object" || value === null) {
|
87152
|
+
diagnostics.errors.push(
|
87153
|
+
`"secrets_store_secrets" bindings should be objects, but got ${JSON.stringify(value)}`
|
87154
|
+
);
|
87155
|
+
return false;
|
87156
|
+
}
|
87157
|
+
let isValid2 = true;
|
87158
|
+
if (!isRequiredProperty(value, "binding", "string")) {
|
87159
|
+
diagnostics.errors.push(
|
87160
|
+
`"${field}" bindings must have a string "binding" field but got ${JSON.stringify(
|
87161
|
+
value
|
87162
|
+
)}.`
|
87163
|
+
);
|
87164
|
+
isValid2 = false;
|
87165
|
+
}
|
87166
|
+
if (!isRequiredProperty(value, "store_id", "string")) {
|
87167
|
+
diagnostics.errors.push(
|
87168
|
+
`"${field}" bindings must have a string "store_id" field but got ${JSON.stringify(
|
87169
|
+
value
|
87170
|
+
)}.`
|
87171
|
+
);
|
87172
|
+
isValid2 = false;
|
87173
|
+
}
|
87174
|
+
if (!isRequiredProperty(value, "secret_name", "string")) {
|
87175
|
+
diagnostics.errors.push(
|
87176
|
+
`"${field}" bindings must have a string "secret_name" field but got ${JSON.stringify(
|
87177
|
+
value
|
87178
|
+
)}.`
|
87179
|
+
);
|
87180
|
+
isValid2 = false;
|
87181
|
+
}
|
87182
|
+
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
87183
|
+
"binding",
|
87184
|
+
"store_id",
|
87185
|
+
"secret_name"
|
87186
|
+
]);
|
87187
|
+
return isValid2;
|
87188
|
+
}, "validateSecretsStoreSecretBinding");
|
87100
87189
|
function normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv) {
|
87101
87190
|
if (rawEnv.limits) {
|
87102
87191
|
validateRequiredProperty(
|
@@ -87360,6 +87449,7 @@ var defaultWranglerConfig = {
|
|
87360
87449
|
vectorize: [],
|
87361
87450
|
hyperdrive: [],
|
87362
87451
|
workflows: [],
|
87452
|
+
secrets_store_secrets: [],
|
87363
87453
|
services: [],
|
87364
87454
|
analytics_engine_datasets: [],
|
87365
87455
|
ai: void 0,
|
@@ -92514,11 +92604,10 @@ function castLogLevel(level) {
|
|
92514
92604
|
}
|
92515
92605
|
__name(castLogLevel, "castLogLevel");
|
92516
92606
|
function buildLog() {
|
92517
|
-
|
92518
|
-
|
92519
|
-
level
|
92520
|
-
}
|
92521
|
-
return new WranglerLog(level, { prefix: "wrangler-UserWorker" });
|
92607
|
+
const level = castLogLevel(logger.loggerLevel);
|
92608
|
+
return new WranglerLog(level, {
|
92609
|
+
prefix: level === import_miniflare6.LogLevel.DEBUG ? "wrangler-UserWorker" : "wrangler"
|
92610
|
+
});
|
92522
92611
|
}
|
92523
92612
|
__name(buildLog, "buildLog");
|
92524
92613
|
async function buildSourceOptions(config) {
|
@@ -92850,6 +92939,15 @@ function buildMiniflareBindingOptions(config) {
|
|
92850
92939
|
bindings.hyperdrive?.map(hyperdriveEntry) ?? []
|
92851
92940
|
),
|
92852
92941
|
workflows: Object.fromEntries(bindings.workflows?.map(workflowEntry) ?? []),
|
92942
|
+
secretsStoreSecrets: Object.fromEntries(
|
92943
|
+
bindings.secrets_store_secrets?.map((binding) => [
|
92944
|
+
binding.binding,
|
92945
|
+
binding
|
92946
|
+
]) ?? []
|
92947
|
+
),
|
92948
|
+
email: {
|
92949
|
+
send_email: bindings.send_email
|
92950
|
+
},
|
92853
92951
|
durableObjects: Object.fromEntries([
|
92854
92952
|
...internalObjects.map(({ name: name2, class_name }) => {
|
92855
92953
|
const useSQLite = classNameToUseSQLite.get(class_name);
|
@@ -92908,7 +93006,8 @@ function buildPersistOptions(localPersistencePath) {
|
|
92908
93006
|
kvPersist: import_node_path15.default.join(v3Path, "kv"),
|
92909
93007
|
r2Persist: import_node_path15.default.join(v3Path, "r2"),
|
92910
93008
|
d1Persist: import_node_path15.default.join(v3Path, "d1"),
|
92911
|
-
workflowsPersist: import_node_path15.default.join(v3Path, "workflows")
|
93009
|
+
workflowsPersist: import_node_path15.default.join(v3Path, "workflows"),
|
93010
|
+
secretsStorePersist: import_node_path15.default.join(v3Path, "secrets-store")
|
92912
93011
|
};
|
92913
93012
|
}
|
92914
93013
|
}
|
@@ -93068,6 +93167,14 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
93068
93167
|
liveReload: config.liveReload,
|
93069
93168
|
upstream,
|
93070
93169
|
unsafeProxySharedSecret: proxyToUserWorkerAuthenticationSecret,
|
93170
|
+
unsafeTriggerHandlers: true,
|
93171
|
+
// The way we run Miniflare instances with wrangler dev is that there are two:
|
93172
|
+
// - one holding the proxy worker,
|
93173
|
+
// - and one holding the user worker.
|
93174
|
+
// The issue with that setup is that end users would see two sets of request logs from Miniflare!
|
93175
|
+
// Instead of hiding all logs from this Miniflare instance, we specifically hide the request logs,
|
93176
|
+
// allowing other logs to be shown to the user (such as details about emails being triggered)
|
93177
|
+
logRequests: false,
|
93071
93178
|
log: log2,
|
93072
93179
|
verbose: logger.loggerLevel === "debug",
|
93073
93180
|
handleRuntimeStdio,
|
@@ -93338,6 +93445,12 @@ function convertCfWorkerInitBindingstoBindings(inputBindings) {
|
|
93338
93445
|
}
|
93339
93446
|
break;
|
93340
93447
|
}
|
93448
|
+
case "secrets_store_secrets": {
|
93449
|
+
for (const { binding, ...x6 } of info) {
|
93450
|
+
output[binding] = { type: "secrets_store_secret", ...x6 };
|
93451
|
+
}
|
93452
|
+
break;
|
93453
|
+
}
|
93341
93454
|
default: {
|
93342
93455
|
assertNever(type);
|
93343
93456
|
}
|
@@ -93365,6 +93478,7 @@ async function convertBindingsToCfWorkerInitBindings(inputBindings) {
|
|
93365
93478
|
d1_databases: void 0,
|
93366
93479
|
vectorize: void 0,
|
93367
93480
|
hyperdrive: void 0,
|
93481
|
+
secrets_store_secrets: void 0,
|
93368
93482
|
services: void 0,
|
93369
93483
|
analytics_engine_datasets: void 0,
|
93370
93484
|
dispatch_namespaces: void 0,
|
@@ -93452,6 +93566,9 @@ async function convertBindingsToCfWorkerInitBindings(inputBindings) {
|
|
93452
93566
|
} else if (binding.type === "workflow") {
|
93453
93567
|
bindings.workflows ??= [];
|
93454
93568
|
bindings.workflows.push({ ...binding, binding: name2 });
|
93569
|
+
} else if (binding.type === "secrets_store_secret") {
|
93570
|
+
bindings.secrets_store_secrets ??= [];
|
93571
|
+
bindings.secrets_store_secrets.push({ ...binding, binding: name2 });
|
93455
93572
|
} else if (isUnsafeBindingType(binding.type)) {
|
93456
93573
|
bindings.unsafe ??= {
|
93457
93574
|
bindings: [],
|
@@ -102343,6 +102460,7 @@ function getBindings(config, options33) {
|
|
102343
102460
|
d1_databases: config?.d1_databases,
|
102344
102461
|
vectorize: config?.vectorize,
|
102345
102462
|
hyperdrive: config?.hyperdrive,
|
102463
|
+
secrets_store_secrets: config?.secrets_store_secrets,
|
102346
102464
|
services: config?.services,
|
102347
102465
|
analytics_engine_datasets: config?.analytics_engine_datasets,
|
102348
102466
|
dispatch_namespaces: options33?.pages ? void 0 : config?.dispatch_namespaces,
|
@@ -103829,16 +103947,16 @@ function createWorkerUploadForm(worker) {
|
|
103829
103947
|
});
|
103830
103948
|
}
|
103831
103949
|
});
|
103832
|
-
bindings.send_email?.forEach(
|
103833
|
-
|
103834
|
-
|
103835
|
-
|
103836
|
-
|
103837
|
-
|
103838
|
-
|
103839
|
-
|
103840
|
-
}
|
103841
|
-
);
|
103950
|
+
bindings.send_email?.forEach((emailBinding) => {
|
103951
|
+
const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
|
103952
|
+
const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
|
103953
|
+
metadataBindings.push({
|
103954
|
+
name: emailBinding.name,
|
103955
|
+
type: "send_email",
|
103956
|
+
destination_address,
|
103957
|
+
allowed_destination_addresses
|
103958
|
+
});
|
103959
|
+
});
|
103842
103960
|
bindings.durable_objects?.bindings.forEach(
|
103843
103961
|
({ name: name2, class_name, script_name, environment }) => {
|
103844
103962
|
metadataBindings.push({
|
@@ -103923,6 +104041,16 @@ function createWorkerUploadForm(worker) {
|
|
103923
104041
|
id
|
103924
104042
|
});
|
103925
104043
|
});
|
104044
|
+
bindings.secrets_store_secrets?.forEach(
|
104045
|
+
({ binding, store_id, secret_name }) => {
|
104046
|
+
metadataBindings.push({
|
104047
|
+
name: binding,
|
104048
|
+
type: "secrets_store_secret",
|
104049
|
+
store_id,
|
104050
|
+
secret_name
|
104051
|
+
});
|
104052
|
+
}
|
104053
|
+
);
|
103926
104054
|
bindings.services?.forEach(
|
103927
104055
|
({ binding, service, environment, entrypoint }) => {
|
103928
104056
|
metadataBindings.push({
|
@@ -105232,7 +105360,7 @@ var import_promises34 = require("fs/promises");
|
|
105232
105360
|
var import_node_events4 = __toESM(require("node:events"));
|
105233
105361
|
var import_promises35 = require("node:fs/promises");
|
105234
105362
|
var import_path23 = __toESM(require("path"));
|
105235
|
-
var
|
105363
|
+
var import_miniflare24 = require("miniflare");
|
105236
105364
|
|
105237
105365
|
// src/index.ts
|
105238
105366
|
init_import_meta_url();
|
@@ -118250,6 +118378,18 @@ async function mapBindings(accountId, bindings) {
|
|
118250
118378
|
];
|
118251
118379
|
}
|
118252
118380
|
break;
|
118381
|
+
case "secrets_store_secret":
|
118382
|
+
{
|
118383
|
+
configObj.secrets_store_secrets = [
|
118384
|
+
...configObj.secrets_store_secrets ?? [],
|
118385
|
+
{
|
118386
|
+
binding: binding.name,
|
118387
|
+
store_id: binding.store_id,
|
118388
|
+
secret_name: binding.secret_name
|
118389
|
+
}
|
118390
|
+
];
|
118391
|
+
}
|
118392
|
+
break;
|
118253
118393
|
case "service":
|
118254
118394
|
{
|
118255
118395
|
configObj.services = [
|
@@ -120636,7 +120776,8 @@ function Options8(yargs) {
|
|
120636
120776
|
}).options({
|
120637
120777
|
outfile: {
|
120638
120778
|
type: "string",
|
120639
|
-
description: "The location of the output Worker script"
|
120779
|
+
description: "The location of the output Worker script",
|
120780
|
+
deprecated: true
|
120640
120781
|
},
|
120641
120782
|
outdir: {
|
120642
120783
|
type: "string",
|
@@ -124302,6 +124443,7 @@ async function createDraftWorker({
|
|
124302
124443
|
d1_databases: [],
|
124303
124444
|
vectorize: [],
|
124304
124445
|
hyperdrive: [],
|
124446
|
+
secrets_store_secrets: [],
|
124305
124447
|
services: [],
|
124306
124448
|
analytics_engine_datasets: [],
|
124307
124449
|
wasm_modules: {},
|
@@ -124981,20 +125123,20 @@ function pages(yargs, subHelp) {
|
|
124981
125123
|
Handler14
|
124982
125124
|
).command(
|
124983
125125
|
"functions",
|
124984
|
-
|
125126
|
+
"Helpers related to Pages Functions",
|
124985
125127
|
(args) => args.command(subHelp).command(
|
124986
125128
|
"build [directory]",
|
124987
|
-
"Compile a folder of
|
125129
|
+
"Compile a folder of Pages Functions into a single Worker",
|
124988
125130
|
Options8,
|
124989
125131
|
Handler8
|
124990
125132
|
).command(
|
124991
125133
|
"build-env [projectDir]",
|
124992
|
-
|
125134
|
+
false,
|
124993
125135
|
Options9,
|
124994
125136
|
Handler9
|
124995
125137
|
).command(
|
124996
125138
|
"optimize-routes [routesPath] [outputRoutesPath]",
|
124997
|
-
|
125139
|
+
false,
|
124998
125140
|
OptimizeRoutesOptions,
|
124999
125141
|
OptimizeRoutesHandler
|
125000
125142
|
)
|
@@ -128921,6 +129063,14 @@ function validateCorsOrigins(values) {
|
|
128921
129063
|
if (!values || !values.length) {
|
128922
129064
|
return values;
|
128923
129065
|
}
|
129066
|
+
if (values.includes("none")) {
|
129067
|
+
if (values.length > 1) {
|
129068
|
+
throw new UserError(
|
129069
|
+
"When specifying 'none', only one value is permitted."
|
129070
|
+
);
|
129071
|
+
}
|
129072
|
+
return [];
|
129073
|
+
}
|
128924
129074
|
if (values.includes("*")) {
|
128925
129075
|
if (values.length > 1) {
|
128926
129076
|
throw new UserError("When specifying '*', only one value is permitted.");
|
@@ -128954,22 +129104,12 @@ function addCreateOptions(yargs) {
|
|
128954
129104
|
type: "string",
|
128955
129105
|
demandOption: true
|
128956
129106
|
}).group(
|
128957
|
-
[
|
128958
|
-
"enable-worker-binding",
|
128959
|
-
"enable-http",
|
128960
|
-
"require-http-auth",
|
128961
|
-
"cors-origins"
|
128962
|
-
],
|
129107
|
+
["source", "require-http-auth", "cors-origins"],
|
128963
129108
|
`${source_default.bold("Source settings")}`
|
128964
|
-
).option("
|
128965
|
-
type: "
|
128966
|
-
describe: "
|
128967
|
-
default:
|
128968
|
-
demandOption: false
|
128969
|
-
}).option("enable-http", {
|
128970
|
-
type: "boolean",
|
128971
|
-
describe: "Generate an endpoint to ingest data via HTTP",
|
128972
|
-
default: true,
|
129109
|
+
).option("source", {
|
129110
|
+
type: "array",
|
129111
|
+
describe: "Space separated list of allowed sources. Options are 'http' or 'worker'",
|
129112
|
+
default: ["http", "worker"],
|
128973
129113
|
demandOption: false
|
128974
129114
|
}).option("require-http-auth", {
|
128975
129115
|
type: "boolean",
|
@@ -128978,7 +129118,7 @@ function addCreateOptions(yargs) {
|
|
128978
129118
|
demandOption: false
|
128979
129119
|
}).option("cors-origins", {
|
128980
129120
|
type: "array",
|
128981
|
-
describe: "CORS origin allowlist for HTTP endpoint (use * for any origin)",
|
129121
|
+
describe: "CORS origin allowlist for HTTP endpoint (use * for any origin). Defaults to an empty array",
|
128982
129122
|
demandOption: false,
|
128983
129123
|
coerce: validateCorsOrigins
|
128984
129124
|
}).group(
|
@@ -128986,17 +129126,17 @@ function addCreateOptions(yargs) {
|
|
128986
129126
|
`${source_default.bold("Batch hints")}`
|
128987
129127
|
).option("batch-max-mb", {
|
128988
129128
|
type: "number",
|
128989
|
-
describe: "Maximum batch size in megabytes before flushing",
|
129129
|
+
describe: "Maximum batch size in megabytes before flushing. Defaults to 100 MB if unset. Minimum: 1, Maximum: 100",
|
128990
129130
|
demandOption: false,
|
128991
129131
|
coerce: validateInRange("batch-max-mb", 1, 100)
|
128992
129132
|
}).option("batch-max-rows", {
|
128993
129133
|
type: "number",
|
128994
|
-
describe: "Maximum number of rows per batch before flushing",
|
129134
|
+
describe: "Maximum number of rows per batch before flushing. Defaults to 10,000,000 if unset. Minimum: 100, Maximum: 10,000,000",
|
128995
129135
|
demandOption: false,
|
128996
|
-
coerce: validateInRange("batch-max-rows", 100,
|
129136
|
+
coerce: validateInRange("batch-max-rows", 100, 1e7)
|
128997
129137
|
}).option("batch-max-seconds", {
|
128998
129138
|
type: "number",
|
128999
|
-
describe: "Maximum age of batch in seconds before flushing",
|
129139
|
+
describe: "Maximum age of batch in seconds before flushing. Defaults to 300 if unset. Minimum: 1, Maximum: 300",
|
129000
129140
|
demandOption: false,
|
129001
129141
|
coerce: validateInRange("batch-max-seconds", 1, 300)
|
129002
129142
|
}).group(["transform-worker"], `${source_default.bold("Transformations")}`).option("transform-worker", {
|
@@ -129011,9 +129151,7 @@ function addCreateOptions(yargs) {
|
|
129011
129151
|
"r2-access-key-id",
|
129012
129152
|
"r2-secret-access-key",
|
129013
129153
|
"r2-prefix",
|
129014
|
-
"compression"
|
129015
|
-
"file-template",
|
129016
|
-
"partition-template"
|
129154
|
+
"compression"
|
129017
129155
|
],
|
129018
129156
|
`${source_default.bold("Destination settings")}`
|
129019
129157
|
).option("r2-bucket", {
|
@@ -129037,7 +129175,7 @@ function addCreateOptions(yargs) {
|
|
129037
129175
|
return true;
|
129038
129176
|
}).option("r2-prefix", {
|
129039
129177
|
type: "string",
|
129040
|
-
describe: "Prefix for storing files in the destination bucket",
|
129178
|
+
describe: "Prefix for storing files in the destination bucket. Default is no prefix",
|
129041
129179
|
default: "",
|
129042
129180
|
demandOption: false
|
129043
129181
|
}).option("compression", {
|
@@ -129046,23 +129184,9 @@ function addCreateOptions(yargs) {
|
|
129046
129184
|
choices: ["none", "gzip", "deflate"],
|
129047
129185
|
default: "gzip",
|
129048
129186
|
demandOption: false
|
129049
|
-
}).option("partition-template", {
|
129050
|
-
type: "string",
|
129051
|
-
describe: "Path template for partitioned files in the bucket. If not specified, the default will be used",
|
129052
|
-
demandOption: false
|
129053
|
-
}).option("file-template", {
|
129054
|
-
type: "string",
|
129055
|
-
describe: `Template for individual file names (must include \${slug}). For example: "\${slug}.log.gz"`,
|
129056
|
-
demandOption: false,
|
129057
|
-
coerce: /* @__PURE__ */ __name((val2) => {
|
129058
|
-
if (!val2.includes("${slug}")) {
|
129059
|
-
throw new UserError("filename must contain ${slug}");
|
129060
|
-
}
|
129061
|
-
return val2;
|
129062
|
-
}, "coerce")
|
129063
129187
|
}).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
|
129064
129188
|
type: "number",
|
129065
|
-
describe: "Number of pipeline
|
129189
|
+
describe: "Number of shards for the pipeline. More shards handle higher request volume; fewer shards produce larger output files. Defaults to 2 if unset. Minimum: 1, Maximum: 15",
|
129066
129190
|
demandOption: false
|
129067
129191
|
});
|
129068
129192
|
}
|
@@ -129117,22 +129241,30 @@ async function createPipelineHandler(args) {
|
|
129117
129241
|
if (!destination.credentials.secret_access_key) {
|
129118
129242
|
throw new FatalError("Requires a r2 secret access key");
|
129119
129243
|
}
|
129120
|
-
if (args.
|
129121
|
-
|
129122
|
-
|
129123
|
-
|
129124
|
-
|
129125
|
-
|
129126
|
-
|
129127
|
-
|
129128
|
-
|
129129
|
-
|
129130
|
-
|
129244
|
+
if (args.source.length > 0) {
|
129245
|
+
const sourceHandlers = {
|
129246
|
+
http: /* @__PURE__ */ __name(() => {
|
129247
|
+
const http5 = {
|
129248
|
+
type: "http",
|
129249
|
+
format: "json",
|
129250
|
+
authentication: args.requireHttpAuth
|
129251
|
+
};
|
129252
|
+
if (args.corsOrigins && args.corsOrigins.length > 0) {
|
129253
|
+
http5.cors = { origins: args.corsOrigins };
|
129254
|
+
}
|
129255
|
+
return http5;
|
129256
|
+
}, "http"),
|
129257
|
+
worker: /* @__PURE__ */ __name(() => ({
|
129258
|
+
type: "binding",
|
129259
|
+
format: "json"
|
129260
|
+
}), "worker")
|
129131
129261
|
};
|
129132
|
-
|
129133
|
-
|
129262
|
+
for (const source of args.source) {
|
129263
|
+
const handler32 = sourceHandlers[source];
|
129264
|
+
if (handler32) {
|
129265
|
+
pipelineConfig.source.push(handler32());
|
129266
|
+
}
|
129134
129267
|
}
|
129135
|
-
pipelineConfig.source.push(source);
|
129136
129268
|
}
|
129137
129269
|
if (pipelineConfig.source.length === 0) {
|
129138
129270
|
throw new UserError(
|
@@ -129145,25 +129277,21 @@ async function createPipelineHandler(args) {
|
|
129145
129277
|
if (args.r2Prefix) {
|
129146
129278
|
pipelineConfig.destination.path.prefix = args.r2Prefix;
|
129147
129279
|
}
|
129148
|
-
if (args.partitionTemplate) {
|
129149
|
-
pipelineConfig.destination.path.filepath = args.partitionTemplate;
|
129150
|
-
}
|
129151
|
-
if (args.fileTemplate) {
|
129152
|
-
pipelineConfig.destination.path.filename = args.fileTemplate;
|
129153
|
-
}
|
129154
129280
|
if (args.shardCount) {
|
129155
129281
|
pipelineConfig.metadata.shards = args.shardCount;
|
129156
129282
|
}
|
129157
|
-
logger.log(`\u{1F300} Creating
|
129283
|
+
logger.log(`\u{1F300} Creating pipeline named "${name2}"`);
|
129158
129284
|
const pipeline = await createPipeline(accountId, pipelineConfig);
|
129159
129285
|
logger.log(
|
129160
|
-
`\u2705 Successfully created
|
129286
|
+
`\u2705 Successfully created pipeline "${pipeline.name}" with ID ${pipeline.id}
|
129287
|
+
`
|
129161
129288
|
);
|
129162
|
-
logger.log(
|
129163
|
-
|
129289
|
+
logger.log(formatPipelinePretty(pipeline));
|
129290
|
+
logger.log("\u{1F389} You can now send data to your pipeline!");
|
129291
|
+
if (args.source.includes("worker")) {
|
129164
129292
|
logger.log(
|
129165
129293
|
`
|
129166
|
-
To
|
129294
|
+
To send data to your pipeline from a Worker, add the following to your wrangler config file:
|
129167
129295
|
`
|
129168
129296
|
);
|
129169
129297
|
logger.log(
|
@@ -129180,11 +129308,11 @@ To start interacting with this Pipeline from a Worker, open your Worker\u2019s c
|
|
129180
129308
|
)
|
129181
129309
|
);
|
129182
129310
|
}
|
129183
|
-
if (args.
|
129311
|
+
if (args.source.includes("http")) {
|
129184
129312
|
logger.log(`
|
129185
|
-
Send data to your
|
129313
|
+
Send data to your pipeline's HTTP endpoint:
|
129186
129314
|
`);
|
129187
|
-
logger.log(`
|
129315
|
+
logger.log(`curl "${pipeline.endpoint}" -d '[{"foo": "bar"}]'
|
129188
129316
|
`);
|
129189
129317
|
}
|
129190
129318
|
}
|
@@ -129195,7 +129323,7 @@ init_import_meta_url();
|
|
129195
129323
|
function addDeleteOptions(yargs) {
|
129196
129324
|
return yargs.positional("pipeline", {
|
129197
129325
|
type: "string",
|
129198
|
-
describe: "The name of the
|
129326
|
+
describe: "The name of the pipeline to delete",
|
129199
129327
|
demandOption: true
|
129200
129328
|
});
|
129201
129329
|
}
|
@@ -129206,12 +129334,52 @@ async function deletePipelineHandler(args) {
|
|
129206
129334
|
const accountId = await requireAuth(config);
|
129207
129335
|
const name2 = args.pipeline;
|
129208
129336
|
validateName("pipeline name", name2);
|
129209
|
-
logger.log(`Deleting
|
129337
|
+
logger.log(`Deleting pipeline ${name2}.`);
|
129210
129338
|
await deletePipeline(accountId, name2);
|
129211
|
-
logger.log(`Deleted
|
129339
|
+
logger.log(`Deleted pipeline ${name2}.`);
|
129212
129340
|
}
|
129213
129341
|
__name(deletePipelineHandler, "deletePipelineHandler");
|
129214
129342
|
|
129343
|
+
// src/pipelines/cli/get.ts
|
129344
|
+
init_import_meta_url();
|
129345
|
+
function addGetOptions(yargs) {
|
129346
|
+
return yargs.positional("pipeline", {
|
129347
|
+
type: "string",
|
129348
|
+
describe: "The name of the pipeline to inspect",
|
129349
|
+
demandOption: true
|
129350
|
+
}).option("format", {
|
129351
|
+
type: "string",
|
129352
|
+
describe: "The output format for pipeline",
|
129353
|
+
default: "pretty",
|
129354
|
+
demandOption: false,
|
129355
|
+
coerce: /* @__PURE__ */ __name((value) => {
|
129356
|
+
const formats = ["pretty", "json"];
|
129357
|
+
if (!formats.includes(value)) {
|
129358
|
+
throw new UserError(`Unknown format value: ${value}`);
|
129359
|
+
}
|
129360
|
+
return value;
|
129361
|
+
}, "coerce")
|
129362
|
+
});
|
129363
|
+
}
|
129364
|
+
__name(addGetOptions, "addGetOptions");
|
129365
|
+
async function getPipelineHandler(args) {
|
129366
|
+
await printWranglerBanner();
|
129367
|
+
const config = readConfig(args);
|
129368
|
+
const accountId = await requireAuth(config);
|
129369
|
+
const name2 = args.pipeline;
|
129370
|
+
validateName("pipeline name", name2);
|
129371
|
+
const pipeline = await getPipeline(accountId, name2);
|
129372
|
+
switch (args.format) {
|
129373
|
+
case "json":
|
129374
|
+
logger.log(JSON.stringify(pipeline, null, 2));
|
129375
|
+
break;
|
129376
|
+
case "pretty":
|
129377
|
+
logger.log(formatPipelinePretty(pipeline));
|
129378
|
+
break;
|
129379
|
+
}
|
129380
|
+
}
|
129381
|
+
__name(getPipelineHandler, "getPipelineHandler");
|
129382
|
+
|
129215
129383
|
// src/pipelines/cli/list.ts
|
129216
129384
|
init_import_meta_url();
|
129217
129385
|
async function listPipelinesHandler(args) {
|
@@ -129229,33 +129397,11 @@ async function listPipelinesHandler(args) {
|
|
129229
129397
|
}
|
129230
129398
|
__name(listPipelinesHandler, "listPipelinesHandler");
|
129231
129399
|
|
129232
|
-
// src/pipelines/cli/show.ts
|
129233
|
-
init_import_meta_url();
|
129234
|
-
function addShowOptions(yargs) {
|
129235
|
-
return yargs.positional("pipeline", {
|
129236
|
-
type: "string",
|
129237
|
-
describe: "The name of the Pipeline to show",
|
129238
|
-
demandOption: true
|
129239
|
-
});
|
129240
|
-
}
|
129241
|
-
__name(addShowOptions, "addShowOptions");
|
129242
|
-
async function showPipelineHandler(args) {
|
129243
|
-
await printWranglerBanner();
|
129244
|
-
const config = readConfig(args);
|
129245
|
-
const accountId = await requireAuth(config);
|
129246
|
-
const name2 = args.pipeline;
|
129247
|
-
validateName("pipeline name", name2);
|
129248
|
-
logger.log(`Retrieving config for Pipeline "${name2}".`);
|
129249
|
-
const pipeline = await getPipeline(accountId, name2);
|
129250
|
-
logger.log(JSON.stringify(pipeline, null, 2));
|
129251
|
-
}
|
129252
|
-
__name(showPipelineHandler, "showPipelineHandler");
|
129253
|
-
|
129254
129400
|
// src/pipelines/cli/update.ts
|
129255
129401
|
init_import_meta_url();
|
129256
129402
|
function addUpdateOptions(yargs) {
|
129257
129403
|
return yargs.positional("pipeline", {
|
129258
|
-
describe: "The name of the
|
129404
|
+
describe: "The name of the pipeline to update",
|
129259
129405
|
type: "string",
|
129260
129406
|
demandOption: true
|
129261
129407
|
}).option("r2-bucket", {
|
@@ -129264,20 +129410,11 @@ function addUpdateOptions(yargs) {
|
|
129264
129410
|
demandOption: false
|
129265
129411
|
// Not required for updates.
|
129266
129412
|
}).group(
|
129267
|
-
[
|
129268
|
-
"enable-worker-binding",
|
129269
|
-
"enable-http",
|
129270
|
-
"require-http-auth",
|
129271
|
-
"cors-origins"
|
129272
|
-
],
|
129413
|
+
["source", "require-http-auth", "cors-origins"],
|
129273
129414
|
`${source_default.bold("Source settings")}`
|
129274
|
-
).option("
|
129275
|
-
type: "
|
129276
|
-
describe: "
|
129277
|
-
demandOption: false
|
129278
|
-
}).option("enable-http", {
|
129279
|
-
type: "boolean",
|
129280
|
-
describe: "Generate an endpoint to ingest data via HTTP",
|
129415
|
+
).option("source", {
|
129416
|
+
type: "array",
|
129417
|
+
describe: "Space separated list of allowed sources. Options are 'http' or 'worker'",
|
129281
129418
|
demandOption: false
|
129282
129419
|
}).option("require-http-auth", {
|
129283
129420
|
type: "boolean",
|
@@ -129293,17 +129430,17 @@ function addUpdateOptions(yargs) {
|
|
129293
129430
|
`${source_default.bold("Batch hints")}`
|
129294
129431
|
).option("batch-max-mb", {
|
129295
129432
|
type: "number",
|
129296
|
-
describe: "Maximum batch size in megabytes before flushing",
|
129433
|
+
describe: "Maximum batch size in megabytes before flushing. Minimum: 1, Maximum: 100",
|
129297
129434
|
demandOption: false,
|
129298
129435
|
coerce: validateInRange("batch-max-mb", 1, 100)
|
129299
129436
|
}).option("batch-max-rows", {
|
129300
129437
|
type: "number",
|
129301
|
-
describe: "Maximum number of rows per batch before flushing",
|
129438
|
+
describe: "Maximum number of rows per batch before flushing. Minimum: 100, Maximum: 10,000,000",
|
129302
129439
|
demandOption: false,
|
129303
|
-
coerce: validateInRange("batch-max-rows", 100,
|
129440
|
+
coerce: validateInRange("batch-max-rows", 100, 1e7)
|
129304
129441
|
}).option("batch-max-seconds", {
|
129305
129442
|
type: "number",
|
129306
|
-
describe: "Maximum age of batch in seconds before flushing",
|
129443
|
+
describe: "Maximum age of batch in seconds before flushing. Minimum: 1, Maximum: 300",
|
129307
129444
|
demandOption: false,
|
129308
129445
|
coerce: validateInRange("batch-max-seconds", 1, 300)
|
129309
129446
|
}).group(["transform-worker"], `${source_default.bold("Transformations")}`).option("transform-worker", {
|
@@ -129318,9 +129455,7 @@ function addUpdateOptions(yargs) {
|
|
129318
129455
|
"r2-access-key-id",
|
129319
129456
|
"r2-secret-access-key",
|
129320
129457
|
"r2-prefix",
|
129321
|
-
"compression"
|
129322
|
-
"file-template",
|
129323
|
-
"partition-template"
|
129458
|
+
"compression"
|
129324
129459
|
],
|
129325
129460
|
`${source_default.bold("Destination settings")}`
|
129326
129461
|
).option("r2-access-key-id", {
|
@@ -129347,23 +129482,9 @@ function addUpdateOptions(yargs) {
|
|
129347
129482
|
describe: "Compression format for output files",
|
129348
129483
|
choices: ["none", "gzip", "deflate"],
|
129349
129484
|
demandOption: false
|
129350
|
-
}).option("partition-template", {
|
129351
|
-
type: "string",
|
129352
|
-
describe: "Path template for partitioned files in the bucket",
|
129353
|
-
demandOption: false
|
129354
|
-
}).option("file-template", {
|
129355
|
-
type: "string",
|
129356
|
-
describe: "Template for individual file names (must include ${slug})",
|
129357
|
-
demandOption: false,
|
129358
|
-
coerce: /* @__PURE__ */ __name((val2) => {
|
129359
|
-
if (!val2.includes("${slug}")) {
|
129360
|
-
throw new Error("filename must contain ${slug}");
|
129361
|
-
}
|
129362
|
-
return val2;
|
129363
|
-
}, "coerce")
|
129364
129485
|
}).group(["shard-count"], `${source_default.bold("Pipeline settings")}`).option("shard-count", {
|
129365
129486
|
type: "number",
|
129366
|
-
describe: "Number of pipeline
|
129487
|
+
describe: "Number of shards for the pipeline. More shards handle higher request volume; fewer shards produce larger output files",
|
129367
129488
|
demandOption: false
|
129368
129489
|
});
|
129369
129490
|
}
|
@@ -129415,45 +129536,44 @@ async function updatePipelineHandler(args) {
|
|
129415
129536
|
throw new FatalError("Requires a r2 secret access key");
|
129416
129537
|
}
|
129417
129538
|
}
|
129418
|
-
if (args.
|
129419
|
-
const
|
129420
|
-
|
129421
|
-
|
129422
|
-
|
129423
|
-
|
129424
|
-
|
129425
|
-
|
129426
|
-
|
129427
|
-
|
129428
|
-
|
129429
|
-
|
129430
|
-
|
129539
|
+
if (args.source && args.source.length > 0) {
|
129540
|
+
const existingSources = pipelineConfig.source;
|
129541
|
+
pipelineConfig.source = [];
|
129542
|
+
const sourceHandlers = {
|
129543
|
+
http: /* @__PURE__ */ __name(() => {
|
129544
|
+
const existing = existingSources.find((s5) => s5.type === "http");
|
129545
|
+
return {
|
129546
|
+
...existing,
|
129547
|
+
// Copy over existing properties for forwards compatibility
|
129548
|
+
type: "http",
|
129549
|
+
format: "json",
|
129550
|
+
...args.requireHttpAuth && { authentication: args.requireHttpAuth }
|
129551
|
+
// Include only if defined
|
129552
|
+
};
|
129553
|
+
}, "http"),
|
129554
|
+
worker: /* @__PURE__ */ __name(() => {
|
129555
|
+
const existing = existingSources.find(
|
129556
|
+
(s5) => s5.type === "binding"
|
129557
|
+
);
|
129558
|
+
return {
|
129559
|
+
...existing,
|
129560
|
+
// Copy over existing properties for forwards compatibility
|
129561
|
+
type: "binding",
|
129562
|
+
format: "json"
|
129563
|
+
};
|
129564
|
+
}, "worker")
|
129565
|
+
};
|
129566
|
+
for (const source of args.source) {
|
129567
|
+
const handler32 = sourceHandlers[source];
|
129568
|
+
if (handler32) {
|
129569
|
+
pipelineConfig.source.push(handler32());
|
129570
|
+
}
|
129431
129571
|
}
|
129432
129572
|
}
|
129433
|
-
if (
|
129434
|
-
|
129435
|
-
|
129436
|
-
(s5) => s5.type !== "http"
|
129573
|
+
if (pipelineConfig.source.length === 0) {
|
129574
|
+
throw new UserError(
|
129575
|
+
"No sources have been enabled. At least one source (HTTP or Worker Binding) should be enabled"
|
129437
129576
|
);
|
129438
|
-
if (args.enableHttp) {
|
129439
|
-
const update = {
|
129440
|
-
type: "http",
|
129441
|
-
format: "json",
|
129442
|
-
...source
|
129443
|
-
};
|
129444
|
-
pipelineConfig.source.push(update);
|
129445
|
-
}
|
129446
|
-
}
|
129447
|
-
const httpSource = pipelineConfig.source.find(
|
129448
|
-
(s5) => s5.type === "http"
|
129449
|
-
);
|
129450
|
-
if (httpSource) {
|
129451
|
-
if (args.requireHttpAuth) {
|
129452
|
-
httpSource.authentication = args.requireHttpAuth;
|
129453
|
-
}
|
129454
|
-
if (args.corsOrigins && args.corsOrigins.length > 0) {
|
129455
|
-
httpSource.cors = { origins: args.corsOrigins };
|
129456
|
-
}
|
129457
129577
|
}
|
129458
129578
|
if (args.transformWorker) {
|
129459
129579
|
if (args.transformWorker === "none") {
|
@@ -129465,19 +129585,24 @@ async function updatePipelineHandler(args) {
|
|
129465
129585
|
if (args.r2Prefix) {
|
129466
129586
|
pipelineConfig.destination.path.prefix = args.r2Prefix;
|
129467
129587
|
}
|
129468
|
-
if (args.partitionTemplate) {
|
129469
|
-
pipelineConfig.destination.path.filepath = args.partitionTemplate;
|
129470
|
-
}
|
129471
|
-
if (args.fileTemplate) {
|
129472
|
-
pipelineConfig.destination.path.filename = args.fileTemplate;
|
129473
|
-
}
|
129474
129588
|
if (args.shardCount) {
|
129475
129589
|
pipelineConfig.metadata.shards = args.shardCount;
|
129476
129590
|
}
|
129477
|
-
|
129591
|
+
const httpSource = pipelineConfig.source.find(
|
129592
|
+
(s5) => s5.type === "http"
|
129593
|
+
);
|
129594
|
+
if (httpSource) {
|
129595
|
+
if (args.requireHttpAuth) {
|
129596
|
+
httpSource.authentication = args.requireHttpAuth;
|
129597
|
+
}
|
129598
|
+
if (args.corsOrigins) {
|
129599
|
+
httpSource.cors = { origins: args.corsOrigins };
|
129600
|
+
}
|
129601
|
+
}
|
129602
|
+
logger.log(`\u{1F300} Updating pipeline "${name2}"`);
|
129478
129603
|
const pipeline = await updatePipeline(accountId, name2, pipelineConfig);
|
129479
129604
|
logger.log(
|
129480
|
-
`\u2705 Successfully updated
|
129605
|
+
`\u2705 Successfully updated pipeline "${pipeline.name}" with ID ${pipeline.id}
|
129481
129606
|
`
|
129482
129607
|
);
|
129483
129608
|
}
|
@@ -129567,32 +129692,100 @@ __name(parseTransform, "parseTransform");
|
|
129567
129692
|
function pipelines(pipelineYargs) {
|
129568
129693
|
return pipelineYargs.command(
|
129569
129694
|
"create <pipeline>",
|
129570
|
-
"Create a new
|
129695
|
+
"Create a new pipeline",
|
129571
129696
|
addCreateOptions,
|
129572
129697
|
createPipelineHandler
|
129573
129698
|
).command(
|
129574
129699
|
"list",
|
129575
|
-
"List
|
129700
|
+
"List all pipelines",
|
129576
129701
|
(yargs) => yargs,
|
129577
129702
|
listPipelinesHandler
|
129578
129703
|
).command(
|
129579
|
-
"
|
129580
|
-
"
|
129581
|
-
|
129582
|
-
|
129704
|
+
"get <pipeline>",
|
129705
|
+
"Get a pipeline's configuration",
|
129706
|
+
addGetOptions,
|
129707
|
+
getPipelineHandler
|
129583
129708
|
).command(
|
129584
129709
|
"update <pipeline>",
|
129585
|
-
"Update a
|
129710
|
+
"Update a pipeline",
|
129586
129711
|
addUpdateOptions,
|
129587
129712
|
updatePipelineHandler
|
129588
129713
|
).command(
|
129589
129714
|
"delete <pipeline>",
|
129590
|
-
"Delete a
|
129715
|
+
"Delete a pipeline",
|
129591
129716
|
addDeleteOptions,
|
129592
129717
|
deletePipelineHandler
|
129593
129718
|
);
|
129594
129719
|
}
|
129595
129720
|
__name(pipelines, "pipelines");
|
129721
|
+
function formatPipelinePretty(pipeline) {
|
129722
|
+
let buffer = "";
|
129723
|
+
const formatTypeLabels = {
|
129724
|
+
json: "JSON"
|
129725
|
+
};
|
129726
|
+
buffer += `${formatLabelledValues({
|
129727
|
+
Id: pipeline.id,
|
129728
|
+
Name: pipeline.name
|
129729
|
+
})}
|
129730
|
+
`;
|
129731
|
+
buffer += "Sources:\n";
|
129732
|
+
const httpSource = pipeline.source.find((s5) => s5.type === "http");
|
129733
|
+
if (httpSource) {
|
129734
|
+
const httpInfo = {
|
129735
|
+
Endpoint: pipeline.endpoint,
|
129736
|
+
Authentication: httpSource.authentication === true ? "on" : "off",
|
129737
|
+
...httpSource?.cors?.origins && {
|
129738
|
+
"CORS Origins": httpSource.cors.origins.join(", ")
|
129739
|
+
},
|
129740
|
+
Format: formatTypeLabels[httpSource.format]
|
129741
|
+
};
|
129742
|
+
buffer += " HTTP:\n";
|
129743
|
+
buffer += `${formatLabelledValues(httpInfo, { indentationCount: 4 })}
|
129744
|
+
`;
|
129745
|
+
}
|
129746
|
+
const bindingSource = pipeline.source.find((s5) => s5.type === "binding");
|
129747
|
+
if (bindingSource) {
|
129748
|
+
const bindingInfo = {
|
129749
|
+
Format: formatTypeLabels[bindingSource.format]
|
129750
|
+
};
|
129751
|
+
buffer += " Worker:\n";
|
129752
|
+
buffer += `${formatLabelledValues(bindingInfo, { indentationCount: 4 })}
|
129753
|
+
`;
|
129754
|
+
}
|
129755
|
+
const destinationInfo = {
|
129756
|
+
Type: pipeline.destination.type.toUpperCase(),
|
129757
|
+
Bucket: pipeline.destination.path.bucket,
|
129758
|
+
Format: "newline-delimited JSON",
|
129759
|
+
// TODO: Make dynamic once we support more output formats
|
129760
|
+
...pipeline.destination.path.prefix && {
|
129761
|
+
Prefix: pipeline.destination.path.prefix
|
129762
|
+
},
|
129763
|
+
...pipeline.destination.compression.type && {
|
129764
|
+
Compression: pipeline.destination.compression.type.toUpperCase()
|
129765
|
+
}
|
129766
|
+
};
|
129767
|
+
buffer += "Destination:\n";
|
129768
|
+
buffer += `${formatLabelledValues(destinationInfo, { indentationCount: 2 })}
|
129769
|
+
`;
|
129770
|
+
const batchHints = {
|
129771
|
+
...pipeline.destination.batch.max_bytes && {
|
129772
|
+
"Max bytes": prettyBytes(pipeline.destination.batch.max_bytes)
|
129773
|
+
},
|
129774
|
+
...pipeline.destination.batch.max_duration_s && {
|
129775
|
+
"Max duration": `${pipeline.destination.batch.max_duration_s?.toLocaleString()} seconds`
|
129776
|
+
},
|
129777
|
+
...pipeline.destination.batch.max_rows && {
|
129778
|
+
"Max records": pipeline.destination.batch.max_rows?.toLocaleString()
|
129779
|
+
}
|
129780
|
+
};
|
129781
|
+
if (Object.keys(batchHints).length > 0) {
|
129782
|
+
buffer += " Batch hints:\n";
|
129783
|
+
buffer += `${formatLabelledValues(batchHints, { indentationCount: 4 })}
|
129784
|
+
`;
|
129785
|
+
}
|
129786
|
+
return buffer;
|
129787
|
+
}
|
129788
|
+
__name(formatPipelinePretty, "formatPipelinePretty");
|
129596
129789
|
|
129597
129790
|
// src/pubsub/pubsub-commands.ts
|
129598
129791
|
init_import_meta_url();
|
@@ -133375,6 +133568,7 @@ var secretsStoreSecretNamespace = createNamespace({
|
|
133375
133568
|
|
133376
133569
|
// src/secrets-store/commands.ts
|
133377
133570
|
init_import_meta_url();
|
133571
|
+
var import_miniflare20 = require("miniflare");
|
133378
133572
|
|
133379
133573
|
// src/secrets-store/client.ts
|
133380
133574
|
init_import_meta_url();
|
@@ -133464,6 +133658,27 @@ async function duplicateSecret(accountId, storeId, secretId, body) {
|
|
133464
133658
|
__name(duplicateSecret, "duplicateSecret");
|
133465
133659
|
|
133466
133660
|
// src/secrets-store/commands.ts
|
133661
|
+
async function usingLocalSecretsStoreSecretAPI(persistTo, config, storeId, secretName, closure) {
|
133662
|
+
const persist = getLocalPersistencePath(persistTo, config);
|
133663
|
+
const persistOptions = buildPersistOptions(persist);
|
133664
|
+
const mf = new import_miniflare20.Miniflare({
|
133665
|
+
script: 'addEventListener("fetch", (e) => e.respondWith(new Response(null, { status: 404 })))',
|
133666
|
+
...persistOptions,
|
133667
|
+
secretsStoreSecrets: {
|
133668
|
+
SECRET: {
|
133669
|
+
store_id: storeId,
|
133670
|
+
secret_name: secretName
|
133671
|
+
}
|
133672
|
+
}
|
133673
|
+
});
|
133674
|
+
const namespace = await mf.getSecretsStoreSecretAPI("SECRET");
|
133675
|
+
try {
|
133676
|
+
return await closure(namespace());
|
133677
|
+
} finally {
|
133678
|
+
await mf.dispose();
|
133679
|
+
}
|
133680
|
+
}
|
133681
|
+
__name(usingLocalSecretsStoreSecretAPI, "usingLocalSecretsStoreSecretAPI");
|
133467
133682
|
var secretsStoreStoreCreateCommand = createCommand({
|
133468
133683
|
metadata: {
|
133469
133684
|
description: "Create a store within an account",
|
@@ -133491,8 +133706,10 @@ var secretsStoreStoreCreateCommand = createCommand({
|
|
133491
133706
|
const accountId = config.account_id || await getAccountId();
|
133492
133707
|
store = await createStore(accountId, { name: args.name });
|
133493
133708
|
} else {
|
133494
|
-
|
133495
|
-
|
133709
|
+
throw new UserError(
|
133710
|
+
"Local secrets stores are automatically created for you on use. To create a Secrets Store on your account, use the --remote flag.",
|
133711
|
+
{ telemetryMessage: true }
|
133712
|
+
);
|
133496
133713
|
}
|
133497
133714
|
logger.log(`\u2705 Created store! (Name: ${args.name}, ID: ${store.id})`);
|
133498
133715
|
}
|
@@ -133523,8 +133740,10 @@ var secretsStoreStoreDeleteCommand = createCommand({
|
|
133523
133740
|
const accountId = config.account_id || await getAccountId();
|
133524
133741
|
await deleteStore(accountId, args.storeId);
|
133525
133742
|
} else {
|
133526
|
-
|
133527
|
-
|
133743
|
+
throw new UserError(
|
133744
|
+
"This command is not supported in local mode. Use `wrangler <cmd> --remote` to delete a Secrets Store from your account.",
|
133745
|
+
{ telemetryMessage: true }
|
133746
|
+
);
|
133528
133747
|
}
|
133529
133748
|
logger.log(`\u2705 Deleted store! (ID: ${args.storeId})`);
|
133530
133749
|
}
|
@@ -133563,7 +133782,7 @@ var secretsStoreStoreListCommand = createCommand({
|
|
133563
133782
|
stores = await listStores(accountId, urlParams);
|
133564
133783
|
} else {
|
133565
133784
|
throw new UserError(
|
133566
|
-
"
|
133785
|
+
"This command is not supported in local mode. Use `wrangler <cmd> --remote` to list Secrets Stores on your account.",
|
133567
133786
|
{ telemetryMessage: true }
|
133568
133787
|
);
|
133569
133788
|
}
|
@@ -133611,6 +133830,10 @@ var secretsStoreSecretListCommand = createCommand({
|
|
133611
133830
|
type: "boolean",
|
133612
133831
|
description: "Execute command against remote Secrets Store",
|
133613
133832
|
default: false
|
133833
|
+
},
|
133834
|
+
"persist-to": {
|
133835
|
+
type: "string",
|
133836
|
+
describe: "Directory for local persistence"
|
133614
133837
|
}
|
133615
133838
|
},
|
133616
133839
|
async handler(args, { config }) {
|
@@ -133625,10 +133848,23 @@ var secretsStoreSecretListCommand = createCommand({
|
|
133625
133848
|
const accountId = config.account_id || await getAccountId();
|
133626
133849
|
secrets = await listSecrets(accountId, args.storeId, urlParams);
|
133627
133850
|
} else {
|
133628
|
-
|
133629
|
-
|
133630
|
-
|
133631
|
-
|
133851
|
+
secrets = (await usingLocalSecretsStoreSecretAPI(
|
133852
|
+
args.persistTo,
|
133853
|
+
config,
|
133854
|
+
args.storeId,
|
133855
|
+
"",
|
133856
|
+
(api) => api.list()
|
133857
|
+
)).map((key) => ({
|
133858
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
133859
|
+
id: key.metadata.uuid,
|
133860
|
+
store_id: args.storeId,
|
133861
|
+
name: key.name,
|
133862
|
+
comment: "",
|
133863
|
+
scopes: [],
|
133864
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
133865
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
133866
|
+
status: "active"
|
133867
|
+
}));
|
133632
133868
|
}
|
133633
133869
|
if (secrets.length === 0) {
|
133634
133870
|
throw new FatalError("List request returned no secrets.", 1, {
|
@@ -133672,6 +133908,10 @@ var secretsStoreSecretGetCommand = createCommand({
|
|
133672
133908
|
type: "boolean",
|
133673
133909
|
description: "Execute command against remote Secrets Store",
|
133674
133910
|
default: false
|
133911
|
+
},
|
133912
|
+
"persist-to": {
|
133913
|
+
type: "string",
|
133914
|
+
describe: "Directory for local persistence"
|
133675
133915
|
}
|
133676
133916
|
},
|
133677
133917
|
async handler(args, { config }) {
|
@@ -133681,10 +133921,23 @@ var secretsStoreSecretGetCommand = createCommand({
|
|
133681
133921
|
const accountId = config.account_id || await getAccountId();
|
133682
133922
|
secret2 = await getSecret(accountId, args.storeId, args.secretId);
|
133683
133923
|
} else {
|
133684
|
-
|
133685
|
-
|
133686
|
-
|
133924
|
+
const name2 = await usingLocalSecretsStoreSecretAPI(
|
133925
|
+
args.persistTo,
|
133926
|
+
config,
|
133927
|
+
args.storeId,
|
133928
|
+
"",
|
133929
|
+
(api) => api.get(args.secretId)
|
133687
133930
|
);
|
133931
|
+
secret2 = {
|
133932
|
+
id: args.secretId,
|
133933
|
+
store_id: args.storeId,
|
133934
|
+
name: name2,
|
133935
|
+
comment: "",
|
133936
|
+
scopes: [],
|
133937
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
133938
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
133939
|
+
status: "active"
|
133940
|
+
};
|
133688
133941
|
}
|
133689
133942
|
const prettierSecret = [
|
133690
133943
|
{
|
@@ -133739,6 +133992,10 @@ var secretsStoreSecretCreateCommand = createCommand({
|
|
133739
133992
|
type: "boolean",
|
133740
133993
|
description: "Execute command against remote Secrets Store",
|
133741
133994
|
default: false
|
133995
|
+
},
|
133996
|
+
"persist-to": {
|
133997
|
+
type: "string",
|
133998
|
+
describe: "Directory for local persistence"
|
133742
133999
|
}
|
133743
134000
|
},
|
133744
134001
|
async handler(args, { config }) {
|
@@ -133768,10 +134025,24 @@ var secretsStoreSecretCreateCommand = createCommand({
|
|
133768
134025
|
comment: args.comment
|
133769
134026
|
});
|
133770
134027
|
} else {
|
133771
|
-
|
133772
|
-
|
133773
|
-
|
133774
|
-
|
134028
|
+
secrets = [
|
134029
|
+
await usingLocalSecretsStoreSecretAPI(
|
134030
|
+
args.persistTo,
|
134031
|
+
config,
|
134032
|
+
args.storeId,
|
134033
|
+
args.name,
|
134034
|
+
(api) => api.create(secretValue)
|
134035
|
+
)
|
134036
|
+
].map((id) => ({
|
134037
|
+
id,
|
134038
|
+
store_id: args.storeId,
|
134039
|
+
name: args.name,
|
134040
|
+
comment: args.comment ?? "",
|
134041
|
+
scopes: args.scopes.split(","),
|
134042
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
134043
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
134044
|
+
status: "pending"
|
134045
|
+
}));
|
133775
134046
|
}
|
133776
134047
|
if (secrets.length === 0) {
|
133777
134048
|
throw new FatalError("Failed to create a secret.", 1, {
|
@@ -133831,6 +134102,10 @@ var secretsStoreSecretUpdateCommand = createCommand({
|
|
133831
134102
|
type: "boolean",
|
133832
134103
|
description: "Execute command against remote Secrets Store",
|
133833
134104
|
default: false
|
134105
|
+
},
|
134106
|
+
"persist-to": {
|
134107
|
+
type: "string",
|
134108
|
+
describe: "Directory for local persistence"
|
133834
134109
|
}
|
133835
134110
|
},
|
133836
134111
|
async handler(args, { config }) {
|
@@ -133864,10 +134139,23 @@ var secretsStoreSecretUpdateCommand = createCommand({
|
|
133864
134139
|
...args.comment && { comment: args.comment }
|
133865
134140
|
});
|
133866
134141
|
} else {
|
133867
|
-
|
133868
|
-
|
133869
|
-
|
134142
|
+
const name2 = await usingLocalSecretsStoreSecretAPI(
|
134143
|
+
args.persistTo,
|
134144
|
+
config,
|
134145
|
+
args.storeId,
|
134146
|
+
"",
|
134147
|
+
(api) => api.update(secretValue, args.secretId)
|
133870
134148
|
);
|
134149
|
+
secret2 = {
|
134150
|
+
id: args.secretId,
|
134151
|
+
store_id: args.storeId,
|
134152
|
+
name: name2,
|
134153
|
+
comment: "",
|
134154
|
+
scopes: [],
|
134155
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
134156
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
134157
|
+
status: "active"
|
134158
|
+
};
|
133871
134159
|
}
|
133872
134160
|
logger.log(`\u2705 Updated secret! (ID: ${secret2.id})`);
|
133873
134161
|
const prettierSecret = [
|
@@ -133909,6 +134197,10 @@ var secretsStoreSecretDeleteCommand = createCommand({
|
|
133909
134197
|
type: "boolean",
|
133910
134198
|
description: "Execute command against remote Secrets Store",
|
133911
134199
|
default: false
|
134200
|
+
},
|
134201
|
+
"persist-to": {
|
134202
|
+
type: "string",
|
134203
|
+
describe: "Directory for local persistence"
|
133912
134204
|
}
|
133913
134205
|
},
|
133914
134206
|
async handler(args, { config }) {
|
@@ -133917,9 +134209,12 @@ var secretsStoreSecretDeleteCommand = createCommand({
|
|
133917
134209
|
const accountId = config.account_id || await getAccountId();
|
133918
134210
|
await deleteSecret(accountId, args.storeId, args.secretId);
|
133919
134211
|
} else {
|
133920
|
-
|
133921
|
-
|
133922
|
-
|
134212
|
+
await usingLocalSecretsStoreSecretAPI(
|
134213
|
+
args.persistTo,
|
134214
|
+
config,
|
134215
|
+
args.storeId,
|
134216
|
+
"",
|
134217
|
+
(api) => api.delete(args.secretId)
|
133923
134218
|
);
|
133924
134219
|
}
|
133925
134220
|
logger.log(`\u2705 Deleted secret! (ID: ${args.secretId})`);
|
@@ -133965,6 +134260,10 @@ var secretsStoreSecretDuplicateCommand = createCommand({
|
|
133965
134260
|
type: "boolean",
|
133966
134261
|
description: "Execute command against remote Secrets Store",
|
133967
134262
|
default: false
|
134263
|
+
},
|
134264
|
+
"persist-to": {
|
134265
|
+
type: "string",
|
134266
|
+
describe: "Directory for local persistence"
|
133968
134267
|
}
|
133969
134268
|
},
|
133970
134269
|
async handler(args, { config }) {
|
@@ -133983,10 +134282,23 @@ var secretsStoreSecretDuplicateCommand = createCommand({
|
|
133983
134282
|
}
|
133984
134283
|
);
|
133985
134284
|
} else {
|
133986
|
-
|
133987
|
-
|
133988
|
-
|
134285
|
+
const duplicatedSecretId = await usingLocalSecretsStoreSecretAPI(
|
134286
|
+
args.persistTo,
|
134287
|
+
config,
|
134288
|
+
args.storeId,
|
134289
|
+
"",
|
134290
|
+
(api) => api.duplicate(args.secretId, args.name)
|
133989
134291
|
);
|
134292
|
+
duplicatedSecret = {
|
134293
|
+
id: duplicatedSecretId,
|
134294
|
+
store_id: args.storeId,
|
134295
|
+
name: args.name,
|
134296
|
+
comment: "",
|
134297
|
+
scopes: [],
|
134298
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
134299
|
+
modified: (/* @__PURE__ */ new Date()).toISOString(),
|
134300
|
+
status: "active"
|
134301
|
+
};
|
133990
134302
|
}
|
133991
134303
|
logger.log(`\u2705 Duplicated secret! (ID: ${duplicatedSecret.id})`);
|
133992
134304
|
const prettierSecret = [
|
@@ -143450,7 +143762,7 @@ init_import_meta_url();
|
|
143450
143762
|
var import_node_crypto13 = require("node:crypto");
|
143451
143763
|
var fs22 = __toESM(require("node:fs"));
|
143452
143764
|
var import_node_path56 = require("node:path");
|
143453
|
-
var
|
143765
|
+
var import_miniflare23 = require("miniflare");
|
143454
143766
|
|
143455
143767
|
// src/dev/dev-vars.ts
|
143456
143768
|
init_import_meta_url();
|
@@ -143496,7 +143808,7 @@ __name(isProcessEnvPopulated, "isProcessEnvPopulated");
|
|
143496
143808
|
init_import_meta_url();
|
143497
143809
|
var import_fs22 = require("fs");
|
143498
143810
|
var import_promises32 = require("fs/promises");
|
143499
|
-
var
|
143811
|
+
var import_miniflare22 = require("miniflare");
|
143500
143812
|
var import_workerd = require("workerd");
|
143501
143813
|
var DEFAULT_OUTFILE_RELATIVE_PATH = "worker-configuration.d.ts";
|
143502
143814
|
async function generateRuntimeTypes({
|
@@ -143542,7 +143854,7 @@ async function generate({
|
|
143542
143854
|
compatibilityFlags = []
|
143543
143855
|
}) {
|
143544
143856
|
const worker = (0, import_fs22.readFileSync)(require.resolve("workerd/worker.mjs")).toString();
|
143545
|
-
const mf = new
|
143857
|
+
const mf = new import_miniflare22.Miniflare({
|
143546
143858
|
compatibilityDate: "2024-01-01",
|
143547
143859
|
compatibilityFlags: ["nodejs_compat", "rtti_api"],
|
143548
143860
|
modules: true,
|
@@ -143764,7 +144076,7 @@ ${content.join("\n")}`,
|
|
143764
144076
|
}
|
143765
144077
|
const tsconfigPath = config.tsconfig ?? (0, import_node_path56.join)((0, import_node_path56.dirname)(config.configPath), "tsconfig.json");
|
143766
144078
|
const tsconfigTypes = readTsconfigTypes(tsconfigPath);
|
143767
|
-
const { mode } = (0,
|
144079
|
+
const { mode } = (0, import_miniflare23.getNodeCompat)(
|
143768
144080
|
config.compatibility_date,
|
143769
144081
|
config.compatibility_flags
|
143770
144082
|
);
|
@@ -143849,7 +144161,8 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
143849
144161
|
secrets,
|
143850
144162
|
assets: config.assets,
|
143851
144163
|
workflows: config.workflows,
|
143852
|
-
pipelines: config.pipelines
|
144164
|
+
pipelines: config.pipelines,
|
144165
|
+
secrets_store_secrets: config.secrets_store_secrets
|
143853
144166
|
};
|
143854
144167
|
const entrypointFormat = entrypoint?.format ?? "modules";
|
143855
144168
|
const fullOutputPath = (0, import_node_path56.resolve)(outputPath);
|
@@ -143911,6 +144224,14 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
143911
144224
|
envTypeStructure.push([constructTypeKey(d12.binding), "D1Database"]);
|
143912
144225
|
}
|
143913
144226
|
}
|
144227
|
+
if (configToDTS.secrets_store_secrets) {
|
144228
|
+
for (const secretsStoreSecret of configToDTS.secrets_store_secrets) {
|
144229
|
+
envTypeStructure.push([
|
144230
|
+
constructTypeKey(secretsStoreSecret.binding),
|
144231
|
+
"SecretsStoreSecret"
|
144232
|
+
]);
|
144233
|
+
}
|
144234
|
+
}
|
143914
144235
|
if (configToDTS.services) {
|
143915
144236
|
for (const service of configToDTS.services) {
|
143916
144237
|
envTypeStructure.push([constructTypeKey(service.binding), "Fetcher"]);
|
@@ -150044,9 +150365,13 @@ function createCLIParser(argv) {
|
|
150044
150365
|
}
|
150045
150366
|
]);
|
150046
150367
|
registry.registerNamespace("workflows");
|
150047
|
-
wrangler.command(
|
150048
|
-
|
150049
|
-
|
150368
|
+
wrangler.command(
|
150369
|
+
"pipelines",
|
150370
|
+
`\u{1F6B0} Manage Cloudflare Pipelines ${source_default.hex(betaCmdColor)("[open beta]")}`,
|
150371
|
+
(pipelinesYargs) => {
|
150372
|
+
return pipelines(pipelinesYargs.command(subHelp));
|
150373
|
+
}
|
150374
|
+
);
|
150050
150375
|
registry.define([
|
150051
150376
|
{
|
150052
150377
|
command: "wrangler login",
|
@@ -150425,7 +150750,7 @@ async function analyseBundle(workerBundle) {
|
|
150425
150750
|
"`wrangler check startup` does not support service-worker format Workers. Refer to https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/ for migration guidance."
|
150426
150751
|
);
|
150427
150752
|
}
|
150428
|
-
const mf = new
|
150753
|
+
const mf = new import_miniflare24.Miniflare({
|
150429
150754
|
name: "profiler",
|
150430
150755
|
compatibilityDate: metadata.compatibility_date,
|
150431
150756
|
compatibilityFlags: metadata.compatibility_flags,
|
@@ -151905,7 +152230,7 @@ init_import_meta_url();
|
|
151905
152230
|
// src/cli-hotkeys.ts
|
151906
152231
|
init_import_meta_url();
|
151907
152232
|
var import_readline = __toESM(require("readline"));
|
151908
|
-
var
|
152233
|
+
var import_miniflare25 = require("miniflare");
|
151909
152234
|
|
151910
152235
|
// src/utils/onKeyPress.ts
|
151911
152236
|
init_import_meta_url();
|
@@ -151999,16 +152324,16 @@ function cli_hotkeys_default(options33) {
|
|
151999
152324
|
__name(printInstructions, "printInstructions");
|
152000
152325
|
Logger.registerBeforeLogHook(clearPreviousInstructions);
|
152001
152326
|
Logger.registerAfterLogHook(printInstructions);
|
152002
|
-
|
152003
|
-
|
152327
|
+
import_miniflare25.Log.unstable_registerBeforeLogHook(clearPreviousInstructions);
|
152328
|
+
import_miniflare25.Log.unstable_registerAfterLogHook(printInstructions);
|
152004
152329
|
printInstructions();
|
152005
152330
|
return () => {
|
152006
152331
|
unregisterKeyPress();
|
152007
152332
|
clearPreviousInstructions();
|
152008
152333
|
Logger.registerBeforeLogHook(void 0);
|
152009
152334
|
Logger.registerAfterLogHook(void 0);
|
152010
|
-
|
152011
|
-
|
152335
|
+
import_miniflare25.Log.unstable_registerBeforeLogHook(void 0);
|
152336
|
+
import_miniflare25.Log.unstable_registerAfterLogHook(void 0);
|
152012
152337
|
};
|
152013
152338
|
}
|
152014
152339
|
__name(cli_hotkeys_default, "default");
|
@@ -152474,6 +152799,7 @@ async function setupDevEnv(devEnv, configPath, auth, args) {
|
|
152474
152799
|
d1_databases: args.d1Databases,
|
152475
152800
|
vectorize: void 0,
|
152476
152801
|
hyperdrive: void 0,
|
152802
|
+
secrets_store_secrets: void 0,
|
152477
152803
|
services: args.services,
|
152478
152804
|
analytics_engine_datasets: void 0,
|
152479
152805
|
dispatch_namespaces: void 0,
|
@@ -152833,6 +153159,7 @@ function getBindings2(configParam, env6, local, args) {
|
|
152833
153159
|
d1_databases: mergedD1Bindings,
|
152834
153160
|
vectorize: configParam.vectorize,
|
152835
153161
|
hyperdrive: hyperdriveBindings,
|
153162
|
+
secrets_store_secrets: configParam.secrets_store_secrets,
|
152836
153163
|
services: mergedServiceBindings,
|
152837
153164
|
analytics_engine_datasets: configParam.analytics_engine_datasets,
|
152838
153165
|
browser: configParam.browser,
|
@@ -154042,7 +154369,7 @@ var ConfigController = class extends Controller {
|
|
154042
154369
|
|
154043
154370
|
// src/api/startDevWorker/RemoteRuntimeController.ts
|
154044
154371
|
init_import_meta_url();
|
154045
|
-
var
|
154372
|
+
var import_miniflare28 = require("miniflare");
|
154046
154373
|
|
154047
154374
|
// src/dev/create-worker-preview.ts
|
154048
154375
|
init_import_meta_url();
|
@@ -154399,7 +154726,7 @@ var RemoteRuntimeController = class extends RuntimeController {
|
|
154399
154726
|
}
|
154400
154727
|
#abortController = new AbortController();
|
154401
154728
|
#currentBundleId = 0;
|
154402
|
-
#mutex = new
|
154729
|
+
#mutex = new import_miniflare28.Mutex();
|
154403
154730
|
#session;
|
154404
154731
|
async #previewSession(props) {
|
154405
154732
|
try {
|
@@ -154794,7 +155121,7 @@ init_import_meta_url();
|
|
154794
155121
|
|
154795
155122
|
// src/api/integrations/platform/index.ts
|
154796
155123
|
init_import_meta_url();
|
154797
|
-
var
|
155124
|
+
var import_miniflare30 = require("miniflare");
|
154798
155125
|
|
154799
155126
|
// src/api/integrations/platform/caches.ts
|
154800
155127
|
init_import_meta_url();
|
@@ -154861,7 +155188,7 @@ var ExecutionContext = class _ExecutionContext {
|
|
154861
155188
|
|
154862
155189
|
// src/api/integrations/platform/services.ts
|
154863
155190
|
init_import_meta_url();
|
154864
|
-
var
|
155191
|
+
var import_miniflare29 = require("miniflare");
|
154865
155192
|
var import_undici26 = __toESM(require_undici());
|
154866
155193
|
async function getServiceBindings(services = []) {
|
154867
155194
|
if (services.length === 0) {
|
@@ -154913,9 +155240,9 @@ function getServiceBindingProxyFetch({
|
|
154913
155240
|
try {
|
154914
155241
|
const resp = await (0, import_undici26.fetch)(newUrl, request4);
|
154915
155242
|
const respBody = await resp.arrayBuffer();
|
154916
|
-
return new
|
155243
|
+
return new import_miniflare29.Response(respBody, resp);
|
154917
155244
|
} catch {
|
154918
|
-
return new
|
155245
|
+
return new import_miniflare29.Response(
|
154919
155246
|
`Error: Unable to fetch from external service (${serviceName} bound with ${bindingName} binding), please make sure that the service is still running with \`wrangler dev\``,
|
154920
155247
|
{ status: 500 }
|
154921
155248
|
);
|
@@ -154946,7 +155273,7 @@ async function getPlatformProxy(options33 = {}) {
|
|
154946
155273
|
},
|
154947
155274
|
() => getMiniflareOptionsFromConfig(rawConfig, env6, options33)
|
154948
155275
|
);
|
154949
|
-
const mf = new
|
155276
|
+
const mf = new import_miniflare30.Miniflare({
|
154950
155277
|
script: "",
|
154951
155278
|
modules: true,
|
154952
155279
|
...miniflareOptions
|
@@ -155065,7 +155392,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options33)
|
|
155065
155392
|
if (bindings.services !== void 0) {
|
155066
155393
|
bindingOptions.serviceBindings = Object.fromEntries(
|
155067
155394
|
bindings.services.map((binding) => {
|
155068
|
-
const name2 = binding.service === config.name ?
|
155395
|
+
const name2 = binding.service === config.name ? import_miniflare30.kCurrentWorker : binding.service;
|
155069
155396
|
return [binding.binding, { name: name2, entrypoint: binding.entrypoint }];
|
155070
155397
|
})
|
155071
155398
|
);
|