devflare 1.0.0-next.39 → 1.0.0-next.40
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/_chunks/account-BtWcv3X9.js +462 -0
- package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
- package/dist/_chunks/ai-CBEuLdoP.js +322 -0
- package/dist/_chunks/api-TzdliH-6.js +568 -0
- package/dist/_chunks/build-3T6O4uIg.js +24 -0
- package/dist/_chunks/build-artifacts-8TqBSQkG.js +483 -0
- package/dist/_chunks/cli-BTF1X4SG.js +1128 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-BsfkmTqh.js +45 -0
- package/dist/_chunks/compiler-uoyAQ8zW.js +424 -0
- package/dist/_chunks/config-D5u-bEkn.js +78 -0
- package/dist/_chunks/config-path-DCPto4XB.js +42 -0
- package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
- package/dist/_chunks/decorators-QmV57ixr.js +19 -0
- package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
- package/dist/_chunks/deploy-DMTr6JeR.js +915 -0
- package/dist/_chunks/dev-CvRHmRFZ.js +3456 -0
- package/dist/_chunks/doctor-DIG8DoFU.js +219 -0
- package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
- package/dist/_chunks/env-S0_nMVz1.js +125 -0
- package/dist/_chunks/family-DXC5SdFK.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-3moXTgpb.js +165 -0
- package/dist/_chunks/loader-DLXO60RO.js +1153 -0
- package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
- package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
- package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
- package/dist/_chunks/local-secrets-DMmEOygL.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-Wip3o1u8.js +90 -0
- package/dist/_chunks/login-BmnDzDlH.js +51 -0
- package/dist/_chunks/package-metadata-DAuCkyvK.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-BhqDmq8I.js +456 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-DdXj8LMM.js +358 -0
- package/dist/_chunks/previews-Dlr13x5M.js +1134 -0
- package/dist/_chunks/productions-D3AnOHac.js +411 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
- package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
- package/dist/_chunks/resolve-package-Y84HB3Nt.js +133 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-C3FqES2W.js +796 -0
- package/dist/_chunks/runtime-FvXvfuZ2.js +550 -0
- package/dist/_chunks/schema-normalization-DWVleVxo.js +477 -0
- package/dist/_chunks/secrets-70eN0Q6C.js +95 -0
- package/dist/_chunks/token-kguIDmej.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-OrLbzv4I.js +476 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-CsI0E-uV.js +1235 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-CS1jgNFE.js +410 -0
- package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
- package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
- package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
- package/dist/bridge/index.d.ts +6 -6
- package/dist/bridge/miniflare.d.ts +2 -2
- package/dist/bridge/proxy.d.ts +1 -1
- package/dist/bridge/v2/body-streams.d.ts +1 -1
- package/dist/bridge/v2/codec.d.ts +4 -4
- package/dist/bridge/v2/index.d.ts +10 -10
- package/dist/bridge/v2/serialization.d.ts +1 -1
- package/dist/bridge/v2/value-codec.d.ts +1 -1
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -1
- package/dist/bridge/v2/ws-relay.d.ts +3 -3
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser.d.ts +70 -70
- package/dist/browser.js +74 -2462
- package/dist/bundler/do-bundler.d.ts +1 -1
- package/dist/bundler/index.d.ts +3 -3
- package/dist/bundler/rolldown-shared.d.ts +1 -1
- package/dist/bundler/worker-bundler.d.ts +1 -1
- package/dist/cli/build-manifest.d.ts +1 -1
- package/dist/cli/command-utils.d.ts +1 -1
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +5 -5
- package/dist/cli/commands/build.d.ts +1 -1
- package/dist/cli/commands/config.d.ts +1 -1
- package/dist/cli/commands/deploy/prepare.d.ts +2 -2
- package/dist/cli/commands/deploy/runtime.d.ts +1 -1
- package/dist/cli/commands/deploy/verification.d.ts +1 -1
- package/dist/cli/commands/deploy.d.ts +1 -1
- package/dist/cli/commands/dev.d.ts +1 -1
- package/dist/cli/commands/doctor.d.ts +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/login.d.ts +1 -1
- package/dist/cli/commands/previews-support/cleanup.d.ts +1 -1
- package/dist/cli/commands/previews-support/family.d.ts +3 -3
- package/dist/cli/commands/previews-support/render.d.ts +3 -3
- package/dist/cli/commands/previews-support/theme.d.ts +2 -2
- package/dist/cli/commands/previews-support/types.d.ts +2 -2
- package/dist/cli/commands/previews.d.ts +1 -1
- package/dist/cli/commands/productions.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/secrets.d.ts +1 -1
- package/dist/cli/commands/token.d.ts +1 -1
- package/dist/cli/commands/type-generation/discovery.d.ts +2 -2
- package/dist/cli/commands/type-generation/generator.d.ts +3 -3
- package/dist/cli/commands/type-generation/models.d.ts +1 -1
- package/dist/cli/commands/types.d.ts +1 -1
- package/dist/cli/commands/worker.d.ts +1 -1
- package/dist/cli/deploy-strategy.d.ts +1 -1
- package/dist/cli/deploy-target.d.ts +1 -1
- package/dist/cli/help-pages/pages/account.d.ts +1 -1
- package/dist/cli/help-pages/pages/core.d.ts +1 -1
- package/dist/cli/help-pages/pages/index.d.ts +1 -1
- package/dist/cli/help-pages/pages/misc.d.ts +1 -1
- package/dist/cli/help-pages/pages/previews.d.ts +1 -1
- package/dist/cli/help-pages/pages/productions.d.ts +1 -1
- package/dist/cli/help-pages/render.d.ts +2 -2
- package/dist/cli/help-pages/shared.d.ts +1 -1
- package/dist/cli/help.d.ts +2 -2
- package/dist/cli/index.js +2 -1383
- package/dist/cli/preview-bindings.d.ts +3 -3
- package/dist/cli/preview.d.ts +1 -1
- package/dist/cli/wrangler-auth.d.ts +1 -1
- package/dist/cloudflare/account-core.d.ts +2 -2
- package/dist/cloudflare/account-resources.d.ts +2 -2
- package/dist/cloudflare/account-status.d.ts +1 -1
- package/dist/cloudflare/account-workers.d.ts +2 -2
- package/dist/cloudflare/account.d.ts +7 -7
- package/dist/cloudflare/auth.d.ts +1 -1
- package/dist/cloudflare/index.d.ts +13 -13
- package/dist/cloudflare/index.js +4 -59
- package/dist/cloudflare/kv-namespace.d.ts +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +1 -1
- package/dist/cloudflare/preview-registry-inference.d.ts +2 -2
- package/dist/cloudflare/preview-registry-records.d.ts +3 -3
- package/dist/cloudflare/preview-registry-shape.d.ts +2 -2
- package/dist/cloudflare/preview-registry-store.d.ts +3 -3
- package/dist/cloudflare/preview-registry-transport.d.ts +2 -2
- package/dist/cloudflare/preview-registry-types.d.ts +2 -2
- package/dist/cloudflare/preview-registry.d.ts +5 -5
- package/dist/cloudflare/tokens.d.ts +2 -2
- package/dist/cloudflare/usage.d.ts +2 -2
- package/dist/config/binding-resolution-helpers.d.ts +1 -1
- package/dist/config/compiler/bindings.d.ts +2 -2
- package/dist/config/compiler/core-helpers.d.ts +2 -2
- package/dist/config/compiler/do-workers.d.ts +2 -2
- package/dist/config/compiler/paths.d.ts +1 -1
- package/dist/config/compiler.d.ts +6 -6
- package/dist/config/define.d.ts +2 -2
- package/dist/config/deploy-resources.d.ts +5 -5
- package/dist/config/env-vars.d.ts +1 -1
- package/dist/config/framework-providers.d.ts +1 -1
- package/dist/config/index.d.ts +12 -12
- package/dist/config/loader.d.ts +2 -2
- package/dist/config/local-dev-vars.d.ts +1 -1
- package/dist/config/preview-resources.d.ts +4 -4
- package/dist/config/preview.d.ts +1 -1
- package/dist/config/ref.d.ts +2 -2
- package/dist/config/resolve-phased.d.ts +4 -4
- package/dist/config/resolve.d.ts +1 -1
- package/dist/config/resource-resolution.d.ts +6 -6
- package/dist/config/schema-env.d.ts +20 -20
- package/dist/config/schema-normalization.d.ts +1 -1
- package/dist/config/schema-types-bindings.d.ts +4 -4
- package/dist/config/schema-types-build.d.ts +1 -1
- package/dist/config/schema-types.d.ts +7 -7
- package/dist/config/schema.d.ts +46 -46
- package/dist/config/service-bindings-validation.d.ts +1 -1
- package/dist/config-entry.d.ts +6 -6
- package/dist/config-entry.js +3 -8
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- package/dist/dev-server/d1-migrations.d.ts +1 -1
- package/dist/dev-server/dev-server-state.d.ts +6 -6
- package/dist/dev-server/gateway-script.d.ts +1 -1
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +1 -1
- package/dist/dev-server/miniflare-dev-config.d.ts +5 -5
- package/dist/dev-server/miniflare-worker-config.d.ts +3 -3
- package/dist/dev-server/server-startup-helpers.d.ts +6 -6
- package/dist/dev-server/worker-surface-paths.d.ts +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -22
- package/dist/runtime/context-events.d.ts +1 -1
- package/dist/runtime/context.d.ts +3 -3
- package/dist/runtime/exports.d.ts +2 -2
- package/dist/runtime/index.d.ts +10 -10
- package/dist/runtime/index.js +5 -57
- package/dist/runtime/middleware.d.ts +1 -1
- package/dist/runtime/router/index.d.ts +3 -3
- package/dist/runtime/validation.d.ts +1 -1
- package/dist/secrets/local-secrets.d.ts +1 -1
- package/dist/shims/local-media-bindings.d.ts +1 -1
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.js +327 -9
- package/dist/sveltekit/local-bindings.d.ts +1 -1
- package/dist/sveltekit/platform.d.ts +1 -1
- package/dist/test/binding-hints.d.ts +2 -2
- package/dist/test/cf.d.ts +19 -19
- package/dist/test/index.d.ts +18 -18
- package/dist/test/index.js +4495 -46
- package/dist/test/offline-bindings.d.ts +3 -3
- package/dist/test/resolve-service-bindings.d.ts +1 -1
- package/dist/test/simple-context-bindings.d.ts +1 -1
- package/dist/test/simple-context-durable-objects.d.ts +1 -1
- package/dist/test/simple-context-env.d.ts +2 -2
- package/dist/test/simple-context-handlers.d.ts +2 -2
- package/dist/test/simple-context-lifecycle.d.ts +2 -2
- package/dist/test/simple-context-mfconfig.d.ts +1 -1
- package/dist/test/simple-context-multi-worker.d.ts +2 -2
- package/dist/test/simple-context-runtime.d.ts +1 -1
- package/dist/test/simple-context-startup.d.ts +1 -1
- package/dist/test/simple-context.d.ts +1 -1
- package/dist/test/utilities/env.d.ts +3 -3
- package/dist/test/utilities.d.ts +10 -10
- package/dist/test/worker.d.ts +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/utils/send-email.js +163 -19
- package/dist/vite/config-file.d.ts +2 -2
- package/dist/vite/index.d.ts +3 -3
- package/dist/vite/index.js +2 -31
- package/dist/vite/plugin-config-hook.d.ts +1 -1
- package/dist/vite/plugin-context.d.ts +3 -3
- package/dist/vite/plugin-durable-objects.d.ts +2 -2
- package/dist/vite/plugin-programmatic.d.ts +1 -1
- package/dist/vite/plugin-service-bindings.d.ts +2 -2
- package/dist/vite/plugin.d.ts +3 -3
- package/dist/worker-entry/composed-worker.d.ts +1 -1
- package/dist/worker-entry/routes.d.ts +2 -2
- package/dist/worker-entry/surface-paths.d.ts +1 -1
- package/dist/workflows/local-workflow-entrypoints.d.ts +1 -1
- package/package.json +5 -3
- package/dist/account-4tgh03a8.js +0 -484
- package/dist/ai-r3zqmxan.js +0 -261
- package/dist/api-6z01z734.js +0 -33
- package/dist/build-kw625v84.js +0 -51
- package/dist/config-ghk2bxj3.js +0 -102
- package/dist/deploy-9kee65n9.js +0 -1062
- package/dist/dev-x8zr249a.js +0 -3569
- package/dist/doctor-0ng5qrr1.js +0 -258
- package/dist/durable-object-0ybmg08a.js +0 -13
- package/dist/index-04wh9bxx.js +0 -514
- package/dist/index-0cc05hzv.js +0 -74
- package/dist/index-2yv7w548.js +0 -185
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3cpzsr47.js +0 -125
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-4mmpccrb.js +0 -309
- package/dist/index-5dkjffqz.js +0 -25
- package/dist/index-5hy7jmv3.js +0 -890
- package/dist/index-627srx16.js +0 -45
- package/dist/index-7m557715.js +0 -283
- package/dist/index-a8pnvg3r.js +0 -52
- package/dist/index-aabgympv.js +0 -39
- package/dist/index-atwc3csp.js +0 -256
- package/dist/index-cv4cvrxe.js +0 -2046
- package/dist/index-h7r11y4a.js +0 -539
- package/dist/index-hvtd936d.js +0 -1229
- package/dist/index-kcp7y951.js +0 -136
- package/dist/index-maw0jjnn.js +0 -147
- package/dist/index-mek9msfv.js +0 -705
- package/dist/index-n4xkaymm.js +0 -236
- package/dist/index-nkk59p3y.js +0 -579
- package/dist/index-phcrvs6d.js +0 -342
- package/dist/index-se4kw8tm.js +0 -460
- package/dist/index-x8s9rwfh.js +0 -2020
- package/dist/index-y7w3x9p1.js +0 -18
- package/dist/index-z9gy8w6b.js +0 -57
- package/dist/index-zdd0d9qa.js +0 -199
- package/dist/init-tb8jqgvr.js +0 -180
- package/dist/login-4h1sfsed.js +0 -75
- package/dist/previews-qr7c5j8h.js +0 -1336
- package/dist/productions-xpmd6bw8.js +0 -505
- package/dist/remote-kqcvhnfx.js +0 -192
- package/dist/secrets-6wbdsdek.js +0 -89
- package/dist/token-yp1qa70y.js +0 -419
- package/dist/types-15yv4cj3.js +0 -701
- package/dist/worker-1yg72jxg.js +0 -510
- package/dist/worker-entrypoint-y8s9kdcx.js +0 -15
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/config/schema-bindings.ts
|
|
3
|
+
/**
|
|
4
|
+
* Durable Object binding schema.
|
|
5
|
+
* Validates DO binding configuration in either string or object form.
|
|
6
|
+
*/
|
|
7
|
+
const durableObjectBindingSchema = z.custom((val) => {
|
|
8
|
+
if (typeof val === "string") return true;
|
|
9
|
+
if (val && typeof val === "object" && "className" in val) return typeof val.className === "string";
|
|
10
|
+
return false;
|
|
11
|
+
}, { message: "Expected string or { className: string, scriptName?: string }" });
|
|
12
|
+
/**
|
|
13
|
+
* Queue consumer configuration.
|
|
14
|
+
* Defines how messages are consumed from a Cloudflare Queue.
|
|
15
|
+
*/
|
|
16
|
+
const queueConsumerSchema = z.object({
|
|
17
|
+
queue: z.string(),
|
|
18
|
+
maxBatchSize: z.number().optional(),
|
|
19
|
+
maxBatchTimeout: z.number().optional(),
|
|
20
|
+
maxRetries: z.number().optional(),
|
|
21
|
+
deadLetterQueue: z.string().optional(),
|
|
22
|
+
maxConcurrency: z.number().optional(),
|
|
23
|
+
retryDelay: z.number().optional()
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Queues configuration for producers and consumers.
|
|
27
|
+
*/
|
|
28
|
+
const queuesConfigSchema = z.object({
|
|
29
|
+
producers: z.record(z.string(), z.string()).optional(),
|
|
30
|
+
consumers: z.array(queueConsumerSchema).optional()
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Rate Limiting binding configuration.
|
|
34
|
+
* Devflare uses camelCase authoring and compiles to Wrangler's `ratelimits`
|
|
35
|
+
* array (`namespace_id`, `simple.limit`, `simple.period`).
|
|
36
|
+
*/
|
|
37
|
+
const rateLimitBindingSchema = z.object({
|
|
38
|
+
namespaceId: z.string().regex(/^[1-9]\d*$/, "namespaceId must be a positive integer string"),
|
|
39
|
+
simple: z.object({
|
|
40
|
+
limit: z.number().int().positive(),
|
|
41
|
+
period: z.union([z.literal(10), z.literal(60)])
|
|
42
|
+
}).strict()
|
|
43
|
+
}).strict();
|
|
44
|
+
/**
|
|
45
|
+
* Version Metadata binding configuration.
|
|
46
|
+
*/
|
|
47
|
+
const versionMetadataBindingSchema = z.object({ binding: z.string().min(1) }).strict();
|
|
48
|
+
/**
|
|
49
|
+
* Worker Loader binding configuration for Dynamic Workers.
|
|
50
|
+
*/
|
|
51
|
+
const workerLoaderBindingSchema = z.object({}).strict();
|
|
52
|
+
/**
|
|
53
|
+
* Secrets Store binding configuration.
|
|
54
|
+
* Devflare accepts object form for explicit per-binding store IDs and string
|
|
55
|
+
* shorthand when the worker sets a top-level `secretsStoreId`.
|
|
56
|
+
*/
|
|
57
|
+
const secretsStoreBindingSchema = z.union([z.string().min(1), z.object({
|
|
58
|
+
storeId: z.string().min(1),
|
|
59
|
+
secretName: z.string().min(1)
|
|
60
|
+
}).strict()]);
|
|
61
|
+
/**
|
|
62
|
+
* Service binding schema.
|
|
63
|
+
* Binds to another Worker for RPC-style communication.
|
|
64
|
+
* Accepts plain objects or WorkerBinding from ref().worker.
|
|
65
|
+
*/
|
|
66
|
+
const serviceBindingKeys = new Set([
|
|
67
|
+
"service",
|
|
68
|
+
"environment",
|
|
69
|
+
"entrypoint",
|
|
70
|
+
"__ref"
|
|
71
|
+
]);
|
|
72
|
+
function isServiceBindingValue(val) {
|
|
73
|
+
if (typeof val !== "object" && typeof val !== "function" || val === null) return false;
|
|
74
|
+
const obj = val;
|
|
75
|
+
if (typeof obj.service !== "string" || obj.service.trim().length === 0) return false;
|
|
76
|
+
if (obj.environment !== void 0 && (typeof obj.environment !== "string" || obj.environment.trim().length === 0)) return false;
|
|
77
|
+
if (obj.entrypoint !== void 0 && (typeof obj.entrypoint !== "string" || obj.entrypoint.trim().length === 0)) return false;
|
|
78
|
+
if (typeof val === "object") {
|
|
79
|
+
for (const key of Object.keys(obj)) if (!serviceBindingKeys.has(key)) return false;
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const serviceBindingSchema = z.custom(isServiceBindingValue, { message: "Expected service binding object with { service: string, environment?: string, entrypoint?: string } or ref().worker" });
|
|
84
|
+
/**
|
|
85
|
+
* AI binding configuration.
|
|
86
|
+
* Provides access to Cloudflare Workers AI for inference.
|
|
87
|
+
*/
|
|
88
|
+
const aiBindingSchema = z.object({
|
|
89
|
+
binding: z.string(),
|
|
90
|
+
remote: z.boolean().optional(),
|
|
91
|
+
staging: z.boolean().optional()
|
|
92
|
+
}).strict();
|
|
93
|
+
/**
|
|
94
|
+
* AI Search namespace binding configuration.
|
|
95
|
+
* Provides access to all AI Search instances in a namespace.
|
|
96
|
+
*/
|
|
97
|
+
const aiSearchNamespaceBindingSchema = z.object({
|
|
98
|
+
namespace: z.string().min(1),
|
|
99
|
+
remote: z.boolean().optional()
|
|
100
|
+
}).strict();
|
|
101
|
+
/**
|
|
102
|
+
* AI Search instance binding configuration.
|
|
103
|
+
* Provides direct access to one AI Search instance in the default namespace.
|
|
104
|
+
*/
|
|
105
|
+
const aiSearchInstanceBindingSchema = z.object({
|
|
106
|
+
instanceName: z.string().min(1),
|
|
107
|
+
remote: z.boolean().optional()
|
|
108
|
+
}).strict();
|
|
109
|
+
/**
|
|
110
|
+
* Vectorize index binding configuration.
|
|
111
|
+
* Provides access to a Cloudflare Vectorize index for similarity search.
|
|
112
|
+
*/
|
|
113
|
+
const vectorizeBindingSchema = z.object({
|
|
114
|
+
indexName: z.string(),
|
|
115
|
+
remote: z.boolean().optional()
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Hyperdrive binding configuration.
|
|
119
|
+
* Provides accelerated PostgreSQL connections via connection pooling.
|
|
120
|
+
*/
|
|
121
|
+
const hyperdriveBindingByIdSchema = z.object({
|
|
122
|
+
id: z.string(),
|
|
123
|
+
localConnectionString: z.string().optional()
|
|
124
|
+
}).strict();
|
|
125
|
+
const hyperdriveBindingByNameSchema = z.object({
|
|
126
|
+
name: z.string(),
|
|
127
|
+
localConnectionString: z.string().optional(),
|
|
128
|
+
previewFallback: z.literal("base").optional(),
|
|
129
|
+
previewId: z.string().optional(),
|
|
130
|
+
previewLocalConnectionString: z.string().optional()
|
|
131
|
+
}).strict();
|
|
132
|
+
const hyperdriveBindingSchema = z.union([
|
|
133
|
+
z.string(),
|
|
134
|
+
hyperdriveBindingByIdSchema,
|
|
135
|
+
hyperdriveBindingByNameSchema
|
|
136
|
+
]);
|
|
137
|
+
const SINGLE_BROWSER_BINDING_ERROR_MESSAGE = "Devflare currently supports exactly one browser binding because Wrangler only supports a single browser binding.";
|
|
138
|
+
function formatBrowserBindingLimitMessage(bindingNames) {
|
|
139
|
+
if (bindingNames.length <= 1) return SINGLE_BROWSER_BINDING_ERROR_MESSAGE;
|
|
140
|
+
return `${SINGLE_BROWSER_BINDING_ERROR_MESSAGE} Configured bindings: ${bindingNames.join(", ")}`;
|
|
141
|
+
}
|
|
142
|
+
function getBrowserBindingNames(bindings) {
|
|
143
|
+
return bindings ? Object.keys(bindings) : [];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Browser Rendering binding configuration.
|
|
147
|
+
* Provides headless browser access for rendering/screenshots.
|
|
148
|
+
*/
|
|
149
|
+
const browserBindingValueSchema = z.union([z.string(), z.object({ remote: z.boolean().optional() }).strict()]);
|
|
150
|
+
const browserBindingSchema = z.record(z.string(), browserBindingValueSchema).superRefine((bindings, ctx) => {
|
|
151
|
+
const bindingNames = getBrowserBindingNames(bindings);
|
|
152
|
+
if (bindingNames.length > 1) ctx.addIssue({
|
|
153
|
+
code: z.ZodIssueCode.custom,
|
|
154
|
+
message: formatBrowserBindingLimitMessage(bindingNames)
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* Analytics Engine binding configuration.
|
|
159
|
+
* Provides access to Cloudflare Analytics Engine for event logging.
|
|
160
|
+
*/
|
|
161
|
+
const analyticsBindingSchema = z.object({ dataset: z.string() });
|
|
162
|
+
/**
|
|
163
|
+
* Email sending binding configuration.
|
|
164
|
+
* Enables sending emails via Cloudflare Email Routing.
|
|
165
|
+
*/
|
|
166
|
+
const sendEmailBindingSchema = z.object({
|
|
167
|
+
destinationAddress: z.string().optional(),
|
|
168
|
+
allowedDestinationAddresses: z.array(z.string()).optional(),
|
|
169
|
+
allowedSenderAddresses: z.array(z.string()).optional()
|
|
170
|
+
}).refine((binding) => {
|
|
171
|
+
return !(binding.destinationAddress && binding.allowedDestinationAddresses);
|
|
172
|
+
}, {
|
|
173
|
+
message: "sendEmail bindings must use either destinationAddress or allowedDestinationAddresses, not both",
|
|
174
|
+
path: ["allowedDestinationAddresses"]
|
|
175
|
+
});
|
|
176
|
+
const d1BindingByIdSchema = z.object({ id: z.string() }).strict();
|
|
177
|
+
const d1BindingByNameSchema = z.object({ name: z.string() }).strict();
|
|
178
|
+
const d1BindingSchema = z.union([
|
|
179
|
+
z.string(),
|
|
180
|
+
d1BindingByIdSchema,
|
|
181
|
+
d1BindingByNameSchema
|
|
182
|
+
]);
|
|
183
|
+
const kvBindingByIdSchema = z.object({ id: z.string() }).strict();
|
|
184
|
+
const kvBindingByNameSchema = z.object({ name: z.string() }).strict();
|
|
185
|
+
const kvBindingSchema = z.union([
|
|
186
|
+
z.string(),
|
|
187
|
+
kvBindingByIdSchema,
|
|
188
|
+
kvBindingByNameSchema
|
|
189
|
+
]);
|
|
190
|
+
const mtlsCertificateBindingByIdSchema = z.object({
|
|
191
|
+
certificateId: z.string().min(1),
|
|
192
|
+
remote: z.boolean().optional()
|
|
193
|
+
}).strict();
|
|
194
|
+
const mtlsCertificateBindingByWranglerIdSchema = z.object({
|
|
195
|
+
certificate_id: z.string().min(1),
|
|
196
|
+
remote: z.boolean().optional()
|
|
197
|
+
}).strict();
|
|
198
|
+
/**
|
|
199
|
+
* C17 — mTLS Certificate binding.
|
|
200
|
+
* The id is the UUID returned by `wrangler mtls-certificate upload`.
|
|
201
|
+
*/
|
|
202
|
+
const mtlsCertificateBindingSchema = z.union([
|
|
203
|
+
z.string().min(1),
|
|
204
|
+
mtlsCertificateBindingByIdSchema,
|
|
205
|
+
mtlsCertificateBindingByWranglerIdSchema
|
|
206
|
+
]);
|
|
207
|
+
/**
|
|
208
|
+
* C17 — Workers for Platforms (Dispatch Namespace) binding.
|
|
209
|
+
*/
|
|
210
|
+
const dispatchNamespaceBindingSchema = z.union([z.string().min(1), z.object({
|
|
211
|
+
namespace: z.string().min(1),
|
|
212
|
+
outbound: z.object({
|
|
213
|
+
service: z.string().min(1),
|
|
214
|
+
environment: z.string().optional(),
|
|
215
|
+
parameters: z.array(z.string()).optional()
|
|
216
|
+
}).strict().optional(),
|
|
217
|
+
remote: z.boolean().optional()
|
|
218
|
+
}).strict()]);
|
|
219
|
+
/**
|
|
220
|
+
* C17 — Workflows-as-binding (a workflow class exposed for another worker
|
|
221
|
+
* to invoke). Distinct from a worker declaring its own workflows.
|
|
222
|
+
*/
|
|
223
|
+
const workflowBindingSchema = z.object({
|
|
224
|
+
name: z.string().min(1),
|
|
225
|
+
className: z.string().min(1),
|
|
226
|
+
scriptName: z.string().min(1).optional(),
|
|
227
|
+
remote: z.boolean().optional(),
|
|
228
|
+
limits: z.object({ steps: z.number().int().positive() }).strict().optional()
|
|
229
|
+
}).strict();
|
|
230
|
+
/**
|
|
231
|
+
* C17 — Cloudflare Pipelines binding.
|
|
232
|
+
*/
|
|
233
|
+
const pipelineBindingSchema = z.union([z.string().min(1), z.object({
|
|
234
|
+
pipeline: z.string().min(1),
|
|
235
|
+
remote: z.boolean().optional()
|
|
236
|
+
}).strict()]);
|
|
237
|
+
/**
|
|
238
|
+
* C17 — Cloudflare Images binding (transformation/upload service).
|
|
239
|
+
*/
|
|
240
|
+
const imagesBindingSchema = z.object({ remote: z.boolean().optional() }).strict().or(z.literal(true));
|
|
241
|
+
/**
|
|
242
|
+
* C17 — Cloudflare Media Transformations binding.
|
|
243
|
+
*/
|
|
244
|
+
const mediaBindingSchema = z.object({ remote: z.boolean().optional() }).strict().or(z.literal(true));
|
|
245
|
+
/**
|
|
246
|
+
* C17 — Cloudflare Artifacts binding.
|
|
247
|
+
*/
|
|
248
|
+
const artifactsBindingSchema = z.union([z.string().min(1), z.object({
|
|
249
|
+
namespace: z.string().min(1),
|
|
250
|
+
remote: z.boolean().optional()
|
|
251
|
+
}).strict()]);
|
|
252
|
+
/**
|
|
253
|
+
* All worker bindings configuration.
|
|
254
|
+
* Defines connections to Cloudflare services and resources.
|
|
255
|
+
*/
|
|
256
|
+
const bindingsSchema = z.object({
|
|
257
|
+
kv: z.record(z.string(), kvBindingSchema).optional(),
|
|
258
|
+
d1: z.record(z.string(), d1BindingSchema).optional(),
|
|
259
|
+
r2: z.record(z.string(), z.string()).optional(),
|
|
260
|
+
durableObjects: z.record(z.string(), durableObjectBindingSchema).optional(),
|
|
261
|
+
queues: queuesConfigSchema.optional(),
|
|
262
|
+
rateLimits: z.record(z.string(), rateLimitBindingSchema).optional(),
|
|
263
|
+
versionMetadata: versionMetadataBindingSchema.optional(),
|
|
264
|
+
workerLoaders: z.record(z.string(), workerLoaderBindingSchema).optional(),
|
|
265
|
+
secretsStore: z.record(z.string(), secretsStoreBindingSchema).optional(),
|
|
266
|
+
services: z.record(z.string(), serviceBindingSchema).optional(),
|
|
267
|
+
ai: aiBindingSchema.optional(),
|
|
268
|
+
aiSearchNamespaces: z.record(z.string(), aiSearchNamespaceBindingSchema).optional(),
|
|
269
|
+
aiSearch: z.record(z.string(), aiSearchInstanceBindingSchema).optional(),
|
|
270
|
+
vectorize: z.record(z.string(), vectorizeBindingSchema).optional(),
|
|
271
|
+
hyperdrive: z.record(z.string(), hyperdriveBindingSchema).optional(),
|
|
272
|
+
browser: browserBindingSchema.optional(),
|
|
273
|
+
analyticsEngine: z.record(z.string(), analyticsBindingSchema).optional(),
|
|
274
|
+
sendEmail: z.record(z.string(), sendEmailBindingSchema).optional(),
|
|
275
|
+
mtlsCertificates: z.record(z.string(), mtlsCertificateBindingSchema).optional(),
|
|
276
|
+
dispatchNamespaces: z.record(z.string(), dispatchNamespaceBindingSchema).optional(),
|
|
277
|
+
workflows: z.record(z.string(), workflowBindingSchema).optional(),
|
|
278
|
+
pipelines: z.record(z.string(), pipelineBindingSchema).optional(),
|
|
279
|
+
images: z.record(z.string(), imagesBindingSchema).optional().superRefine((bindings, ctx) => {
|
|
280
|
+
if (!bindings || Object.keys(bindings).length <= 1) return;
|
|
281
|
+
ctx.addIssue({
|
|
282
|
+
code: z.ZodIssueCode.custom,
|
|
283
|
+
message: "Wrangler currently supports one Images binding per Worker"
|
|
284
|
+
});
|
|
285
|
+
}),
|
|
286
|
+
media: z.record(z.string(), mediaBindingSchema).optional().superRefine((bindings, ctx) => {
|
|
287
|
+
if (!bindings || Object.keys(bindings).length <= 1) return;
|
|
288
|
+
ctx.addIssue({
|
|
289
|
+
code: z.ZodIssueCode.custom,
|
|
290
|
+
message: "Wrangler currently supports one Media Transformations binding per Worker"
|
|
291
|
+
});
|
|
292
|
+
}),
|
|
293
|
+
artifacts: z.record(z.string(), artifactsBindingSchema).optional()
|
|
294
|
+
}).optional();
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/config/schema-normalization.ts
|
|
297
|
+
/**
|
|
298
|
+
* Return the single browser binding name, or `undefined` when no browser
|
|
299
|
+
* binding is configured.
|
|
300
|
+
*
|
|
301
|
+
* invariant: `bindings` is expected to have been validated by
|
|
302
|
+
* `browserBindingSchema` (see `schema-bindings.ts`), which rejects
|
|
303
|
+
* configurations with more than one browser binding via
|
|
304
|
+
* `superRefine` + `formatBrowserBindingLimitMessage`. Callers that bypass
|
|
305
|
+
* Zod (e.g. by casting raw input as `DevflareConfig`) should re-validate
|
|
306
|
+
* via `browserBindingSchema.parse()` before relying on this selector.
|
|
307
|
+
*/
|
|
308
|
+
function getSingleBrowserBindingName(bindings) {
|
|
309
|
+
const bindingNames = getBrowserBindingNames(bindings);
|
|
310
|
+
if (bindingNames.length === 0) return;
|
|
311
|
+
return bindingNames[0];
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Normalize a DO binding to its object form.
|
|
315
|
+
*/
|
|
316
|
+
function normalizeDOBinding(config) {
|
|
317
|
+
if (typeof config === "string") return {
|
|
318
|
+
className: config,
|
|
319
|
+
kind: "local"
|
|
320
|
+
};
|
|
321
|
+
const scriptName = config.scriptName;
|
|
322
|
+
const __ref = config.__ref;
|
|
323
|
+
const kind = scriptName || __ref ? "cross-worker" : "local";
|
|
324
|
+
return {
|
|
325
|
+
className: config.className,
|
|
326
|
+
scriptName,
|
|
327
|
+
__ref,
|
|
328
|
+
kind
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Normalize a D1 binding to a consistent object form.
|
|
333
|
+
* String bindings are treated as stable database names.
|
|
334
|
+
*/
|
|
335
|
+
function normalizeD1Binding(config) {
|
|
336
|
+
if (typeof config === "string") return { name: config };
|
|
337
|
+
if ("id" in config) return { databaseId: config.id };
|
|
338
|
+
return { name: config.name };
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Normalize a KV binding to a consistent object form.
|
|
342
|
+
* String bindings are treated as stable namespace names.
|
|
343
|
+
*/
|
|
344
|
+
function normalizeKVBinding(config) {
|
|
345
|
+
if (typeof config === "string") return { name: config };
|
|
346
|
+
if ("id" in config) return { namespaceId: config.id };
|
|
347
|
+
return { name: config.name };
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Normalize a Hyperdrive binding to a consistent object form.
|
|
351
|
+
* String bindings are treated as stable Hyperdrive configuration names.
|
|
352
|
+
*/
|
|
353
|
+
function normalizeHyperdriveBinding(config) {
|
|
354
|
+
if (typeof config === "string") return { name: config };
|
|
355
|
+
const localConnectionString = "localConnectionString" in config ? config.localConnectionString : "previewLocalConnectionString" in config ? config.previewLocalConnectionString : void 0;
|
|
356
|
+
if ("id" in config) return {
|
|
357
|
+
configurationId: config.id,
|
|
358
|
+
...localConnectionString && { localConnectionString }
|
|
359
|
+
};
|
|
360
|
+
return {
|
|
361
|
+
name: config.name,
|
|
362
|
+
...localConnectionString && { localConnectionString }
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Normalize an mTLS certificate binding to Devflare's camelCase shape.
|
|
367
|
+
*/
|
|
368
|
+
function normalizeMtlsCertificateBinding(config) {
|
|
369
|
+
if (typeof config === "string") return { certificateId: config };
|
|
370
|
+
if ("certificateId" in config) return {
|
|
371
|
+
certificateId: config.certificateId,
|
|
372
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
certificateId: config.certificate_id,
|
|
376
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Normalize a Dispatch Namespace binding to its object form.
|
|
381
|
+
*/
|
|
382
|
+
function normalizeDispatchNamespaceBinding(config) {
|
|
383
|
+
if (typeof config === "string") return { namespace: config };
|
|
384
|
+
return {
|
|
385
|
+
namespace: config.namespace,
|
|
386
|
+
...config.outbound && { outbound: {
|
|
387
|
+
service: config.outbound.service,
|
|
388
|
+
...config.outbound.environment && { environment: config.outbound.environment },
|
|
389
|
+
...config.outbound.parameters && { parameters: config.outbound.parameters }
|
|
390
|
+
} },
|
|
391
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Normalize a Workflow binding to its object form.
|
|
396
|
+
*/
|
|
397
|
+
function normalizeWorkflowBinding(config) {
|
|
398
|
+
return {
|
|
399
|
+
name: config.name,
|
|
400
|
+
className: config.className,
|
|
401
|
+
...config.scriptName && { scriptName: config.scriptName },
|
|
402
|
+
...config.remote !== void 0 && { remote: config.remote },
|
|
403
|
+
...config.limits && { limits: { steps: config.limits.steps } }
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Normalize a Pipeline binding to its object form.
|
|
408
|
+
*/
|
|
409
|
+
function normalizePipelineBinding(config) {
|
|
410
|
+
if (typeof config === "string") return { pipeline: config };
|
|
411
|
+
return {
|
|
412
|
+
pipeline: config.pipeline,
|
|
413
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Normalize an Images binding to Wrangler's singleton binding object.
|
|
418
|
+
*/
|
|
419
|
+
function normalizeImagesBinding(binding, config) {
|
|
420
|
+
if (config === true) return { binding };
|
|
421
|
+
return {
|
|
422
|
+
binding,
|
|
423
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Normalize a Media Transformations binding to Wrangler's singleton binding object.
|
|
428
|
+
*/
|
|
429
|
+
function normalizeMediaBinding(binding, config) {
|
|
430
|
+
if (config === true) return { binding };
|
|
431
|
+
return {
|
|
432
|
+
binding,
|
|
433
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Normalize an Artifacts binding to its object form.
|
|
438
|
+
*/
|
|
439
|
+
function normalizeArtifactsBinding(config) {
|
|
440
|
+
if (typeof config === "string") return { namespace: config };
|
|
441
|
+
return {
|
|
442
|
+
namespace: config.namespace,
|
|
443
|
+
...config.remote !== void 0 && { remote: config.remote }
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Normalize a Secrets Store binding to its explicit store/name form.
|
|
448
|
+
*/
|
|
449
|
+
function normalizeSecretsStoreBinding(config, defaultStoreId, bindingName = "unknown") {
|
|
450
|
+
if (typeof config === "string") {
|
|
451
|
+
if (!defaultStoreId) throw new Error(`Secrets Store binding "${bindingName}" uses shorthand and requires top-level secretsStoreId.`);
|
|
452
|
+
return {
|
|
453
|
+
storeId: defaultStoreId,
|
|
454
|
+
secretName: config
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
storeId: config.storeId,
|
|
459
|
+
secretName: config.secretName
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Get the identifier Devflare should use for local/runtime KV wiring.
|
|
464
|
+
*/
|
|
465
|
+
function getLocalKVNamespaceIdentifier(config) {
|
|
466
|
+
const normalized = normalizeKVBinding(config);
|
|
467
|
+
return normalized.namespaceId ?? normalized.name ?? "";
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Get the identifier Devflare should use for local/runtime D1 wiring.
|
|
471
|
+
*/
|
|
472
|
+
function getLocalD1DatabaseIdentifier(config) {
|
|
473
|
+
const normalized = normalizeD1Binding(config);
|
|
474
|
+
return normalized.databaseId ?? normalized.name ?? "";
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
export { browserBindingSchema as _, normalizeD1Binding as a, normalizeHyperdriveBinding as c, normalizeMediaBinding as d, normalizeMtlsCertificateBinding as f, bindingsSchema as g, normalizeWorkflowBinding as h, normalizeArtifactsBinding as i, normalizeImagesBinding as l, normalizeSecretsStoreBinding as m, getLocalKVNamespaceIdentifier as n, normalizeDOBinding as o, normalizePipelineBinding as p, getSingleBrowserBindingName as r, normalizeDispatchNamespaceBinding as s, getLocalD1DatabaseIdentifier as t, normalizeKVBinding as u };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { i as listLocalSecrets, o as writeLocalSecret, r as deleteLocalSecret } from "./local-secrets-DMmEOygL.js";
|
|
2
|
+
//#region src/cli/commands/secrets.ts
|
|
3
|
+
function getStringOption(options, key) {
|
|
4
|
+
const value = options[key];
|
|
5
|
+
return typeof value === "string" ? value : void 0;
|
|
6
|
+
}
|
|
7
|
+
function getCwd(options) {
|
|
8
|
+
return options.cwd ?? process.cwd();
|
|
9
|
+
}
|
|
10
|
+
function requireLocalFlag(parsed, logger) {
|
|
11
|
+
if (parsed.options.local === true) return true;
|
|
12
|
+
logger.error("Local Secrets Store commands require --local.");
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
function requireStoreAndName(parsed, logger) {
|
|
16
|
+
const storeId = getStringOption(parsed.options, "store");
|
|
17
|
+
const name = getStringOption(parsed.options, "name");
|
|
18
|
+
if (!storeId || !name) {
|
|
19
|
+
logger.error("Pass --store <id> and --name <name>.");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
storeId,
|
|
24
|
+
name
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function formatSecretRef(storeId, name) {
|
|
28
|
+
return `${storeId}/${name}`;
|
|
29
|
+
}
|
|
30
|
+
function usage() {
|
|
31
|
+
return [
|
|
32
|
+
"devflare secrets --local --store <id> --name <name> --value <value>",
|
|
33
|
+
"devflare secrets --local --store <id> --list",
|
|
34
|
+
"devflare secrets --local --store <id> --name <name> --delete"
|
|
35
|
+
].join("\n");
|
|
36
|
+
}
|
|
37
|
+
function runSecretsCommand(parsed, logger, options) {
|
|
38
|
+
if (!requireLocalFlag(parsed, logger)) return {
|
|
39
|
+
exitCode: 1,
|
|
40
|
+
output: usage()
|
|
41
|
+
};
|
|
42
|
+
const cwd = getCwd(options);
|
|
43
|
+
const storeId = getStringOption(parsed.options, "store");
|
|
44
|
+
if (parsed.options.list === true) {
|
|
45
|
+
const output = listLocalSecrets({
|
|
46
|
+
cwd,
|
|
47
|
+
storeId
|
|
48
|
+
}).map((row) => formatSecretRef(row.storeId, row.name)).join("\n");
|
|
49
|
+
if (output) logger.info(output);
|
|
50
|
+
return {
|
|
51
|
+
exitCode: 0,
|
|
52
|
+
output
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const required = requireStoreAndName(parsed, logger);
|
|
56
|
+
if (!required) return {
|
|
57
|
+
exitCode: 1,
|
|
58
|
+
output: usage()
|
|
59
|
+
};
|
|
60
|
+
if (parsed.options.delete === true) {
|
|
61
|
+
deleteLocalSecret({
|
|
62
|
+
cwd,
|
|
63
|
+
storeId: required.storeId,
|
|
64
|
+
name: required.name
|
|
65
|
+
});
|
|
66
|
+
const output = formatSecretRef(required.storeId, required.name);
|
|
67
|
+
logger.success(`Deleted local secret ${output}`);
|
|
68
|
+
return {
|
|
69
|
+
exitCode: 0,
|
|
70
|
+
output
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const value = getStringOption(parsed.options, "value");
|
|
74
|
+
if (value === void 0) {
|
|
75
|
+
logger.error("Pass --value <value>, --list, or --delete.");
|
|
76
|
+
return {
|
|
77
|
+
exitCode: 1,
|
|
78
|
+
output: usage()
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
writeLocalSecret({
|
|
82
|
+
cwd,
|
|
83
|
+
storeId: required.storeId,
|
|
84
|
+
name: required.name,
|
|
85
|
+
value
|
|
86
|
+
});
|
|
87
|
+
const output = formatSecretRef(required.storeId, required.name);
|
|
88
|
+
logger.success(`Stored local secret ${output}`);
|
|
89
|
+
return {
|
|
90
|
+
exitCode: 0,
|
|
91
|
+
output
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { runSecretsCommand };
|