hanzio 1.2.0 → 2.0.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/README.md +786 -239
- package/dist/api-wrapper/builders.d.ts +4 -3
- package/dist/api-wrapper/create-client.d.ts +1 -1
- package/dist/api-wrapper/describe.d.ts +16 -0
- package/dist/api-wrapper/endpoint.d.ts +18 -0
- package/dist/api-wrapper/errors.d.ts +39 -2
- package/dist/api-wrapper/index.d.ts +5 -0
- package/dist/api-wrapper/otel.d.ts +44 -0
- package/dist/api-wrapper/paginate.d.ts +12 -0
- package/dist/api-wrapper/redaction.d.ts +2 -0
- package/dist/api-wrapper/shared.d.ts +16 -2
- package/dist/api-wrapper/testing.d.ts +23 -0
- package/dist/api-wrapper/transport.d.ts +4 -5
- package/dist/api-wrapper/types.d.ts +103 -18
- package/dist/array/index.d.ts +50 -4
- package/dist/cache/createCache.d.ts +31 -0
- package/dist/cache/index.d.ts +19 -2
- package/dist/color/contrast.d.ts +40 -0
- package/dist/color/index.d.ts +2 -0
- package/dist/{math → color}/metricsSeriesColors.d.ts +14 -7
- package/dist/cool-console-log/index.d.ts +34 -5
- package/dist/crypto/encoding.d.ts +18 -0
- package/dist/crypto/hash.d.ts +33 -0
- package/dist/crypto/index.d.ts +4 -0
- package/dist/crypto/sealer.d.ts +25 -0
- package/dist/crypto/webhook.d.ts +20 -0
- package/dist/date/index.d.ts +46 -2
- package/dist/emitter/index.d.ts +21 -0
- package/dist/error/index.d.ts +12 -0
- package/dist/format/index.d.ts +102 -0
- package/dist/function/index.d.ts +60 -0
- package/dist/guard/index.d.ts +20 -0
- package/dist/i18n/index.d.ts +37 -0
- package/dist/index-0zvtcbzy.js +224 -0
- package/dist/index-181e6vfw.js +29 -0
- package/dist/index-8r2vdzjg.js +87 -0
- package/dist/index-hy7kbb99.js +157 -0
- package/dist/{src/secrets/infisical.js → index-j1ybktbr.js} +500 -538
- package/dist/index-k9yx6bne.js +89 -0
- package/dist/index-kj1phgrx.js +169 -0
- package/dist/index-mnkcfyx8.js +78 -0
- package/dist/{p-queue/index.js → index-pwt0dz63.js} +7 -11
- package/dist/index-rp5pqghz.js +157 -0
- package/dist/index-srt06xd2.js +15 -0
- package/dist/index-wjyb9bsd.js +263 -0
- package/dist/index.d.ts +7 -7
- package/dist/jwt/index.d.ts +50 -2
- package/dist/math/index.d.ts +2 -2
- package/dist/math/linearRegressionTrend.d.ts +14 -1
- package/dist/math/scale.d.ts +8 -0
- package/dist/object/index.d.ts +19 -0
- package/dist/p-queue/index.d.ts +1 -1
- package/dist/promise/index.d.ts +97 -2
- package/dist/sitemap/index.d.ts +48 -6
- package/dist/src/api-wrapper/index.js +60 -1130
- package/dist/src/api-wrapper/testing.js +20 -0
- package/dist/{cool-console-log → src/cool-console-log}/index.js +80 -33
- package/dist/src/crypto/index.js +195 -0
- package/dist/src/format/index.js +211 -0
- package/dist/src/i18n/index.js +36 -0
- package/dist/src/index.js +739 -3145
- package/dist/src/jwt/index.js +138 -92
- package/dist/src/p-queue/index.js +9 -437
- package/dist/src/secrets/index.js +44 -1428
- package/dist/src/secrets/vite.js +6 -39
- package/dist/src/secrets/worker.js +10 -273
- package/dist/src/sitemap/index.js +183 -511
- package/dist/src/storage/index.js +119 -0
- package/dist/src/zod/index.js +340 -167
- package/dist/state/index.d.ts +21 -0
- package/dist/storage/index.d.ts +58 -0
- package/dist/string/index.d.ts +75 -2
- package/dist/typedswitch/index.d.ts +31 -24
- package/dist/types/index.d.ts +11 -0
- package/dist/url/index.d.ts +50 -1
- package/dist/zod/index.d.ts +32 -3
- package/dist/zod/introspect.d.ts +19 -0
- package/dist/zod/jsonToZodSchemaMapper.d.ts +3 -1
- package/dist/zod/zodMinMaxFilter.d.ts +22 -3
- package/dist/zod/zodToTypeString.d.ts +8 -3
- package/package.json +78 -7
- package/src/api-wrapper/actions-impl.ts +11 -72
- package/src/api-wrapper/builders.ts +32 -25
- package/src/api-wrapper/create-client.ts +171 -41
- package/src/api-wrapper/describe.ts +157 -0
- package/src/api-wrapper/endpoint.ts +26 -0
- package/src/api-wrapper/error-reporting.ts +7 -1
- package/src/api-wrapper/errors.ts +107 -2
- package/src/api-wrapper/headers.ts +11 -6
- package/src/api-wrapper/index.ts +5 -0
- package/src/api-wrapper/otel.ts +139 -0
- package/src/api-wrapper/paginate.ts +28 -0
- package/src/api-wrapper/redaction.ts +42 -0
- package/src/api-wrapper/shared.ts +21 -2
- package/src/api-wrapper/testing.ts +48 -0
- package/src/api-wrapper/transport.ts +41 -43
- package/src/api-wrapper/types.ts +185 -18
- package/src/array/index.ts +195 -42
- package/src/cache/createCache.ts +157 -0
- package/src/cache/index.ts +132 -147
- package/src/color/contrast.ts +163 -0
- package/src/color/index.ts +22 -0
- package/src/{math → color}/metricsSeriesColors.ts +47 -49
- package/src/cool-console-log/index.ts +128 -41
- package/src/crypto/encoding.ts +83 -0
- package/src/crypto/hash.ts +170 -0
- package/src/crypto/index.ts +26 -0
- package/src/crypto/sealer.ts +168 -0
- package/src/crypto/webhook.ts +86 -0
- package/src/date/index.ts +109 -34
- package/src/emitter/index.ts +82 -0
- package/src/error/index.ts +63 -0
- package/src/format/index.ts +389 -0
- package/src/function/index.ts +201 -0
- package/src/guard/index.ts +80 -0
- package/src/i18n/index.ts +125 -0
- package/src/index.ts +11 -7
- package/src/jwt/index.ts +199 -125
- package/src/math/index.ts +5 -10
- package/src/math/linearRegressionTrend.ts +33 -8
- package/src/math/scale.ts +17 -0
- package/src/object/index.ts +99 -0
- package/src/p-queue/index.ts +2 -0
- package/src/promise/index.ts +304 -9
- package/src/sitemap/index.ts +293 -130
- package/src/state/index.ts +133 -81
- package/src/storage/index.ts +187 -0
- package/src/string/index.ts +261 -23
- package/src/typedswitch/index.ts +58 -38
- package/src/types/index.ts +14 -0
- package/src/url/index.ts +146 -1
- package/src/zod/index.ts +105 -9
- package/src/zod/introspect.ts +103 -0
- package/src/zod/jsonToZodSchemaMapper.ts +44 -21
- package/src/zod/zodMinMaxFilter.ts +37 -13
- package/src/zod/zodToTypeString.ts +184 -181
- package/dist/api-wrapper/index.js +0 -250
- package/dist/gzip/index.d.ts +0 -2
- package/dist/gzip/index.js +0 -16
- package/dist/index.js +0 -1823
- package/dist/jwt/index.js +0 -19
- package/dist/sitemap/index.js +0 -552
- package/dist/src/gzip/index.js +0 -16
- package/dist/src/secrets/loaders.js +0 -1529
- package/dist/zod/index.js +0 -210
package/dist/src/secrets/vite.js
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
status;
|
|
6
|
-
constructor(code, message, details = {}) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = "SecretLoadError";
|
|
9
|
-
this.code = code;
|
|
10
|
-
this.operation = details.operation;
|
|
11
|
-
this.status = details.status;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/secrets/vite.ts
|
|
16
|
-
function getViteDefine(secretSet, options = {}) {
|
|
17
|
-
const values = secretSet.secrets();
|
|
18
|
-
const keys = options.publicKeys ?? Object.keys(values);
|
|
19
|
-
if (!options.publicKeys && keys.some((key) => !key.startsWith("VITE_"))) {
|
|
20
|
-
throw new SecretLoadError("CONFIGURATION", "Vite secret sets must contain only VITE_ keys, or provide an explicit publicKeys list.");
|
|
21
|
-
}
|
|
22
|
-
for (const key of keys) {
|
|
23
|
-
if (!Object.hasOwn(values, key) || !/^[A-Za-z_$][\w$]*$/.test(key)) {
|
|
24
|
-
throw new SecretLoadError("CONFIGURATION", "Vite publicKeys must reference configured keys with valid JavaScript identifiers.");
|
|
25
|
-
}
|
|
26
|
-
if (["MODE", "BASE_URL", "PROD", "DEV", "SSR"].includes(key)) {
|
|
27
|
-
throw new SecretLoadError("CONFIGURATION", "Vite built-in environment constants cannot be overridden by secrets.");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return Object.fromEntries(keys.map((key) => [`import.meta.env.${key}`, JSON.stringify(values[key])]));
|
|
31
|
-
}
|
|
32
|
-
function viteSecretSetPlugin(secretSet, options = {}) {
|
|
33
|
-
return {
|
|
34
|
-
name: "hanzio-secret-set",
|
|
35
|
-
config: () => ({ define: getViteDefine(secretSet, options) })
|
|
36
|
-
};
|
|
37
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
getViteDefine2,
|
|
3
|
+
viteSecretSetPlugin2
|
|
4
|
+
} from "../../index-181e6vfw.js";
|
|
38
5
|
export {
|
|
39
|
-
getViteDefine,
|
|
40
|
-
viteSecretSetPlugin
|
|
6
|
+
getViteDefine2 as getViteDefine,
|
|
7
|
+
viteSecretSetPlugin2 as viteSecretSetPlugin
|
|
41
8
|
};
|
|
@@ -1,275 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.name = "SecretLoadError";
|
|
9
|
-
this.code = code;
|
|
10
|
-
this.operation = details.operation;
|
|
11
|
-
this.status = details.status;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/secrets/deadline.ts
|
|
16
|
-
async function withSecretDeadline(options, operation) {
|
|
17
|
-
const timeoutMs = options.timeoutMs ?? 30000;
|
|
18
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647) {
|
|
19
|
-
throw new SecretLoadError("CONFIGURATION", "Secret timeoutMs must be a positive finite timer duration.");
|
|
20
|
-
}
|
|
21
|
-
const controller = new AbortController;
|
|
22
|
-
const cancel = () => controller.abort(new SecretLoadError("ABORTED", "Secret loading was cancelled."));
|
|
23
|
-
if (options.signal?.aborted) {
|
|
24
|
-
cancel();
|
|
25
|
-
} else {
|
|
26
|
-
options.signal?.addEventListener("abort", cancel, { once: true });
|
|
27
|
-
}
|
|
28
|
-
const timer = setTimeout(() => controller.abort(new SecretLoadError("TIMEOUT", `Secret loading timed out after ${timeoutMs}ms.`)), timeoutMs);
|
|
29
|
-
let rejectOnAbort = () => {};
|
|
30
|
-
try {
|
|
31
|
-
const aborted = new Promise((_, reject) => {
|
|
32
|
-
rejectOnAbort = () => reject(controller.signal.reason);
|
|
33
|
-
controller.signal.addEventListener("abort", rejectOnAbort, { once: true });
|
|
34
|
-
});
|
|
35
|
-
if (controller.signal.aborted) {
|
|
36
|
-
throw controller.signal.reason;
|
|
37
|
-
}
|
|
38
|
-
return await Promise.race([operation(controller.signal), aborted]);
|
|
39
|
-
} finally {
|
|
40
|
-
clearTimeout(timer);
|
|
41
|
-
options.signal?.removeEventListener("abort", cancel);
|
|
42
|
-
controller.signal.removeEventListener("abort", rejectOnAbort);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/secrets/environment.ts
|
|
47
|
-
function getProcessEnvironment() {
|
|
48
|
-
return typeof process === "undefined" ? undefined : process.env;
|
|
49
|
-
}
|
|
50
|
-
function resolveSecretEnvironment(option, env) {
|
|
51
|
-
const explicit = typeof option === "function" ? option() : option;
|
|
52
|
-
if (typeof explicit === "object" && explicit !== null) {
|
|
53
|
-
if (typeof explicit.slug !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(explicit.slug)) {
|
|
54
|
-
throw new SecretLoadError("CONFIGURATION", "Custom secret environment requires a valid slug.");
|
|
55
|
-
}
|
|
56
|
-
return explicit.slug;
|
|
57
|
-
}
|
|
58
|
-
const selected = explicit ?? env?.SECRETS_ENV;
|
|
59
|
-
if (selected !== undefined) {
|
|
60
|
-
if (selected === "production" || selected === "prod") {
|
|
61
|
-
return "prod";
|
|
62
|
-
}
|
|
63
|
-
if (selected === "development" || selected === "dev") {
|
|
64
|
-
return "dev";
|
|
65
|
-
}
|
|
66
|
-
if (selected === "staging") {
|
|
67
|
-
return "staging";
|
|
68
|
-
}
|
|
69
|
-
throw new SecretLoadError("CONFIGURATION", "Invalid secret environment. Use dev, staging, prod, or an explicit { slug } option.");
|
|
70
|
-
}
|
|
71
|
-
if (env?.NODE_ENV === "production" || env?.NODE_ENV === "prod") {
|
|
72
|
-
return "prod";
|
|
73
|
-
}
|
|
74
|
-
if (env?.NODE_ENV === "staging") {
|
|
75
|
-
return "staging";
|
|
76
|
-
}
|
|
77
|
-
return "dev";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/secrets/core.ts
|
|
81
|
-
var registryKey = Symbol.for("hanzio.secrets.environmentWrites.v1");
|
|
82
|
-
var shared = globalThis;
|
|
83
|
-
var environmentWrites = shared[registryKey] ?? new WeakMap;
|
|
84
|
-
shared[registryKey] = environmentWrites;
|
|
85
|
-
var defaultLogger = {
|
|
86
|
-
info: (message, attrs) => console.log(`${message} environment=${attrs.environment} count=${attrs.count} source=${attrs.source} durationMs=${attrs.durationMs}`, { sources: attrs.sources }),
|
|
87
|
-
error: (message, attrs) => console.error(message, attrs)
|
|
88
|
-
};
|
|
89
|
-
function readOverrides(keys, env) {
|
|
90
|
-
if (!env) {
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
const writes = environmentWrites.get(env);
|
|
94
|
-
return Object.fromEntries(keys.flatMap((key) => {
|
|
95
|
-
const value = Object.hasOwn(env, key) ? env[key] : undefined;
|
|
96
|
-
if (writes?.has(key)) {
|
|
97
|
-
if (writes.get(key) === value) {
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
writes.delete(key);
|
|
101
|
-
}
|
|
102
|
-
return value ? [[key, value]] : [];
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
async function defineSecretSet(keys, options, environmentVariables) {
|
|
106
|
-
const keySet = [...new Set(keys)];
|
|
107
|
-
const environment = resolveSecretEnvironment(options.environment, environmentVariables);
|
|
108
|
-
const logger = options.logger === false ? undefined : options.logger ?? defaultLogger;
|
|
109
|
-
let cached;
|
|
110
|
-
let parsed;
|
|
111
|
-
let sources;
|
|
112
|
-
let inFlight;
|
|
113
|
-
const log = (level, message, attributes) => {
|
|
114
|
-
try {
|
|
115
|
-
logger?.[level](message, attributes);
|
|
116
|
-
} catch {}
|
|
117
|
-
};
|
|
118
|
-
const loadSnapshot = async (request, signal) => {
|
|
119
|
-
const local = readOverrides(keySet, environmentVariables);
|
|
120
|
-
const missing = keySet.filter((key) => !Object.hasOwn(local, key));
|
|
121
|
-
let loaderSource = options.loader.source ?? "custom loader";
|
|
122
|
-
let loaded = {};
|
|
123
|
-
if (missing.length) {
|
|
124
|
-
try {
|
|
125
|
-
loaded = await options.loader({
|
|
126
|
-
keys: missing,
|
|
127
|
-
environment,
|
|
128
|
-
signal,
|
|
129
|
-
timeoutMs: request.timeoutMs ?? options.timeoutMs ?? 30000,
|
|
130
|
-
reportSource: (source) => {
|
|
131
|
-
loaderSource = source;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
} catch (error) {
|
|
135
|
-
if (error instanceof SecretLoadError) {
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
138
|
-
throw new SecretLoadError("LOADER", "Secret loader failed.");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const overrides = readOverrides(keySet, environmentVariables);
|
|
142
|
-
const next = Object.fromEntries(keySet.map((key) => {
|
|
143
|
-
if (Object.hasOwn(overrides, key)) {
|
|
144
|
-
return [key, overrides[key]];
|
|
145
|
-
}
|
|
146
|
-
if (Object.hasOwn(loaded, key)) {
|
|
147
|
-
return [key, loaded[key]];
|
|
148
|
-
}
|
|
149
|
-
return [key, undefined];
|
|
150
|
-
}));
|
|
151
|
-
const missingKeys = keySet.filter((key) => typeof next[key] !== "string" || !next[key]);
|
|
152
|
-
if (missingKeys.length) {
|
|
153
|
-
throw new SecretLoadError("MISSING_SECRETS", `Missing secrets: ${missingKeys.join(", ")}`);
|
|
154
|
-
}
|
|
155
|
-
let nextParsed;
|
|
156
|
-
try {
|
|
157
|
-
nextParsed = options.schema ? await options.schema.parseAsync({ ...next }) : { ...next };
|
|
158
|
-
nextParsed = structuredClone(nextParsed);
|
|
159
|
-
} catch {
|
|
160
|
-
throw new SecretLoadError("VALIDATION", "Secret schema validation failed. Check the configured schema; values are omitted.");
|
|
161
|
-
}
|
|
162
|
-
signal.throwIfAborted();
|
|
163
|
-
const nextSources = Object.fromEntries(keySet.map((key) => [
|
|
164
|
-
key,
|
|
165
|
-
Object.hasOwn(overrides, key) ? "process.env" : loaderSource
|
|
166
|
-
]));
|
|
167
|
-
if (options.writeToProcessEnv !== false && environmentVariables) {
|
|
168
|
-
let writes = environmentWrites.get(environmentVariables);
|
|
169
|
-
if (!writes) {
|
|
170
|
-
writes = new Map;
|
|
171
|
-
environmentWrites.set(environmentVariables, writes);
|
|
172
|
-
}
|
|
173
|
-
for (const key of keySet) {
|
|
174
|
-
if (Object.hasOwn(overrides, key)) {
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
environmentVariables[key] = next[key];
|
|
178
|
-
writes.set(key, next[key]);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
cached = next;
|
|
182
|
-
parsed = nextParsed;
|
|
183
|
-
sources = nextSources;
|
|
184
|
-
};
|
|
185
|
-
const load = (request = {}) => {
|
|
186
|
-
if (inFlight) {
|
|
187
|
-
return inFlight;
|
|
188
|
-
}
|
|
189
|
-
inFlight = (async () => {
|
|
190
|
-
const start = Date.now();
|
|
191
|
-
try {
|
|
192
|
-
await withSecretDeadline({
|
|
193
|
-
timeoutMs: request.timeoutMs ?? options.timeoutMs,
|
|
194
|
-
signal: request.signal ?? options.signal
|
|
195
|
-
}, (signal) => loadSnapshot(request, signal));
|
|
196
|
-
const sourceCounts = new Map;
|
|
197
|
-
for (const key of keySet) {
|
|
198
|
-
const source = sources[key];
|
|
199
|
-
sourceCounts.set(source, (sourceCounts.get(source) ?? 0) + 1);
|
|
200
|
-
}
|
|
201
|
-
const counts = Object.fromEntries(sourceCounts);
|
|
202
|
-
log("info", "Loaded secrets", {
|
|
203
|
-
environment,
|
|
204
|
-
count: keySet.length,
|
|
205
|
-
durationMs: Date.now() - start,
|
|
206
|
-
source: Object.keys(counts).join(" + ") || "none",
|
|
207
|
-
sources: counts
|
|
208
|
-
});
|
|
209
|
-
} catch (error) {
|
|
210
|
-
const safe = error instanceof SecretLoadError ? error : new SecretLoadError("LOADER", "Secret loading failed.");
|
|
211
|
-
log("error", "Secret loading failed", {
|
|
212
|
-
environment,
|
|
213
|
-
count: keySet.length,
|
|
214
|
-
durationMs: Date.now() - start,
|
|
215
|
-
code: safe.code
|
|
216
|
-
});
|
|
217
|
-
throw safe;
|
|
218
|
-
}
|
|
219
|
-
})().finally(() => {
|
|
220
|
-
inFlight = undefined;
|
|
221
|
-
});
|
|
222
|
-
return inFlight;
|
|
223
|
-
};
|
|
224
|
-
const secretSet = {
|
|
225
|
-
secret(key) {
|
|
226
|
-
if (!Object.hasOwn(cached, key)) {
|
|
227
|
-
throw new SecretLoadError("MISSING_SECRETS", `Secret ${key} not found`);
|
|
228
|
-
}
|
|
229
|
-
return cached[key];
|
|
230
|
-
},
|
|
231
|
-
secrets: () => ({ ...cached }),
|
|
232
|
-
parsed: () => structuredClone(parsed),
|
|
233
|
-
sources: () => ({ ...sources }),
|
|
234
|
-
async reload(request) {
|
|
235
|
-
await load(request);
|
|
236
|
-
return secretSet;
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
await load();
|
|
240
|
-
return secretSet;
|
|
241
|
-
}
|
|
242
|
-
// src/secrets/worker-loader.ts
|
|
243
|
-
function cloudflareWorkerEnvLoader(workerEnv) {
|
|
244
|
-
const loader = async (ctx) => {
|
|
245
|
-
const out = Object.create(null);
|
|
246
|
-
for (const key of ctx.keys) {
|
|
247
|
-
const str = workerBindingToString(Object.hasOwn(workerEnv, key) ? workerEnv[key] : undefined);
|
|
248
|
-
if (str !== undefined) {
|
|
249
|
-
out[key] = str;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return out;
|
|
253
|
-
};
|
|
254
|
-
return Object.assign(loader, { source: "Cloudflare Worker bindings" });
|
|
255
|
-
}
|
|
256
|
-
function workerBindingToString(value) {
|
|
257
|
-
if (value === undefined || value === null) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
if (typeof value === "string") {
|
|
261
|
-
return value === "" ? undefined : value;
|
|
262
|
-
}
|
|
263
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
264
|
-
return String(value);
|
|
265
|
-
}
|
|
266
|
-
if (typeof value === "object") {
|
|
267
|
-
return JSON.stringify(value);
|
|
268
|
-
}
|
|
269
|
-
return String(value);
|
|
270
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
defineSecretSet2,
|
|
3
|
+
cloudflareWorkerEnvLoader2
|
|
4
|
+
} from "../../index-wjyb9bsd.js";
|
|
5
|
+
import {
|
|
6
|
+
SecretLoadError2
|
|
7
|
+
} from "../../index-srt06xd2.js";
|
|
271
8
|
export {
|
|
272
|
-
SecretLoadError,
|
|
273
|
-
cloudflareWorkerEnvLoader,
|
|
274
|
-
defineSecretSet
|
|
9
|
+
SecretLoadError2 as SecretLoadError,
|
|
10
|
+
cloudflareWorkerEnvLoader2 as cloudflareWorkerEnvLoader,
|
|
11
|
+
defineSecretSet2 as defineSecretSet
|
|
275
12
|
};
|