@zintrust/core 2.2.6 → 2.2.7
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/package.json +1 -1
- package/src/cli/cloudflare/CloudflareSecretSync.d.ts +3 -2
- package/src/cli/cloudflare/CloudflareSecretSync.d.ts.map +1 -1
- package/src/cli/cloudflare/CloudflareSecretSync.js +40 -12
- package/src/cli/commands/DeployCommand.d.ts.map +1 -1
- package/src/cli/commands/DeployCommand.js +2 -0
- package/src/cli/commands/DeployContainersProxyCommand.d.ts.map +1 -1
- package/src/cli/commands/DeployContainersProxyCommand.js +2 -0
- package/src/cli/commands/PutCommand.d.ts.map +1 -1
- package/src/cli/commands/PutCommand.js +2 -0
- package/src/index.js +3 -3
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ type CloudflareSecretSyncArgs = {
|
|
|
21
21
|
target?: string;
|
|
22
22
|
bulk?: boolean;
|
|
23
23
|
requireSelection?: boolean;
|
|
24
|
+
all?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export type CloudflareSecretSyncResult = {
|
|
26
27
|
pushed: number;
|
|
@@ -31,9 +32,9 @@ export type CloudflareSecretSyncResult = {
|
|
|
31
32
|
};
|
|
32
33
|
export declare const uniq: (items: string[]) => string[];
|
|
33
34
|
export declare const reportCloudflareSecretSync: (log: CloudflareSecretLog, result: Pick<CloudflareSecretSyncResult, "pushed" | "skippedEmptyKeys" | "failures">) => void;
|
|
34
|
-
export declare const syncCloudflareSecrets: ({ log, cwd, wranglerEnvs, envPath, dryRun, configGroups, directKeys, inlineValues, configPath, target, bulk, requireSelection, }: CloudflareSecretSyncArgs) => Promise<CloudflareSecretSyncResult>;
|
|
35
|
+
export declare const syncCloudflareSecrets: ({ log, cwd, wranglerEnvs, envPath, dryRun, configGroups, directKeys, inlineValues, configPath, target, bulk, requireSelection, all, }: CloudflareSecretSyncArgs) => Promise<CloudflareSecretSyncResult>;
|
|
35
36
|
declare const _default: Readonly<{
|
|
36
|
-
syncCloudflareSecrets: ({ log, cwd, wranglerEnvs, envPath, dryRun, configGroups, directKeys, inlineValues, configPath, target, bulk, requireSelection, }: CloudflareSecretSyncArgs) => Promise<CloudflareSecretSyncResult>;
|
|
37
|
+
syncCloudflareSecrets: ({ log, cwd, wranglerEnvs, envPath, dryRun, configGroups, directKeys, inlineValues, configPath, target, bulk, requireSelection, all, }: CloudflareSecretSyncArgs) => Promise<CloudflareSecretSyncResult>;
|
|
37
38
|
reportCloudflareSecretSync: (log: CloudflareSecretLog, result: Pick<CloudflareSecretSyncResult, "pushed" | "skippedEmptyKeys" | "failures">) => void;
|
|
38
39
|
}>;
|
|
39
40
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudflareSecretSync.d.ts","sourceRoot":"","sources":["../../../../src/cli/cloudflare/CloudflareSecretSync.ts"],"names":[],"mappings":"AAaA,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAcF,KAAK,wBAAwB,GAAG;IAC9B,GAAG,EAAE,mBAAmB,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,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CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AASF,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,EAAE,KAAG,MAAM,EAY5C,CAAC;AA+TF,eAAO,MAAM,0BAA0B,GACrC,KAAK,mBAAmB,EACxB,QAAQ,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,kBAAkB,GAAG,UAAU,CAAC,KACnF,IAcF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,uIAczC,wBAAwB,KAAG,OAAO,CAAC,0BAA0B,CAqD/D,CAAC;;mKArDC,wBAAwB,KAAG,OAAO,CAAC,0BAA0B,CAAC;sCAhC1D,mBAAmB,UAChB,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,kBAAkB,GAAG,UAAU,CAAC,KACnF,IAAI;;AAqFP,wBAGG"}
|
|
@@ -38,16 +38,22 @@ const getConfigArray = (config, key) => {
|
|
|
38
38
|
return [];
|
|
39
39
|
return uniq(raw.filter((item) => typeof item === 'string'));
|
|
40
40
|
};
|
|
41
|
-
const resolveValue = (key, envMap) => {
|
|
41
|
+
const resolveValue = (key, envMap, envPath, all = false) => {
|
|
42
42
|
const fromFile = envMap[key];
|
|
43
43
|
const fromProcess = process.env[key];
|
|
44
|
+
const isCustomEnvFile = envPath !== '.env' && envPath.trim() !== '';
|
|
45
|
+
// If custom env file is provided and all is false, only use values from the custom file
|
|
46
|
+
if (isCustomEnvFile && !all) {
|
|
47
|
+
return fromFile ?? '';
|
|
48
|
+
}
|
|
49
|
+
// Default behavior: fallback to process.env
|
|
44
50
|
return fromFile ?? fromProcess ?? '';
|
|
45
51
|
};
|
|
46
|
-
const resolveValueWithOverrides = (key, envMap, inlineValues) => {
|
|
52
|
+
const resolveValueWithOverrides = (key, envMap, inlineValues, envPath, all = false) => {
|
|
47
53
|
const inlineValue = inlineValues[key];
|
|
48
54
|
if (typeof inlineValue === 'string')
|
|
49
55
|
return inlineValue;
|
|
50
|
-
return resolveValue(key, envMap);
|
|
56
|
+
return resolveValue(key, envMap, envPath, all);
|
|
51
57
|
};
|
|
52
58
|
const getPutTimeoutMs = () => {
|
|
53
59
|
const raw = process.env['ZT_PUT_TIMEOUT_MS'];
|
|
@@ -131,13 +137,13 @@ const resolveSelectedKeys = ({ log, config, cwd, wranglerEnvs, configGroups = []
|
|
|
131
137
|
? 'No secret keys resolved from explicit keys or .zintrust.json cloudflare.shared_env/cloudflare.targets/cloudflare.wrangler_envs. Use --key/--keys, --var <group>, or add a Cloudflare env manifest.'
|
|
132
138
|
: 'No secret keys resolved from selected groups.');
|
|
133
139
|
};
|
|
134
|
-
const resolveBulkPayload = (log, wranglerEnv, selectedKeys, envMap, inlineValues) => {
|
|
140
|
+
const resolveBulkPayload = (log, wranglerEnv, selectedKeys, envMap, inlineValues, envPath, all = false) => {
|
|
135
141
|
const payload = {};
|
|
136
142
|
const includedKeys = [];
|
|
137
143
|
const skippedEmptyKeys = [];
|
|
138
144
|
const wranglerEnvLabel = describeWranglerEnv(wranglerEnv);
|
|
139
145
|
for (const key of selectedKeys) {
|
|
140
|
-
const value = resolveValueWithOverrides(key, envMap, inlineValues);
|
|
146
|
+
const value = resolveValueWithOverrides(key, envMap, inlineValues, envPath, all);
|
|
141
147
|
if (value.trim() === '') {
|
|
142
148
|
log.warn(`skip ${key} -> ${wranglerEnvLabel}: empty value`);
|
|
143
149
|
skippedEmptyKeys.push(key);
|
|
@@ -148,11 +154,12 @@ const resolveBulkPayload = (log, wranglerEnv, selectedKeys, envMap, inlineValues
|
|
|
148
154
|
}
|
|
149
155
|
return { payload, includedKeys, skippedEmptyKeys };
|
|
150
156
|
};
|
|
151
|
-
const processSecretSync = (
|
|
157
|
+
const processSecretSync = (args) => {
|
|
158
|
+
const { log, wranglerEnvs, selectedKeys, envMap, dryRun, configPath, inlineValues, envPath, all, } = args;
|
|
152
159
|
const progress = createSyncProgress();
|
|
153
160
|
forEachWranglerEnv(wranglerEnvs, (wranglerEnv, wranglerEnvLabel) => {
|
|
154
161
|
for (const key of selectedKeys) {
|
|
155
|
-
const value = resolveValueWithOverrides(key, envMap, inlineValues);
|
|
162
|
+
const value = resolveValueWithOverrides(key, envMap, inlineValues, envPath, all);
|
|
156
163
|
if (value.trim() === '') {
|
|
157
164
|
log.warn(`skip ${key} -> ${wranglerEnvLabel}: empty value`);
|
|
158
165
|
progress.skippedEmptyKeys.push(key);
|
|
@@ -174,10 +181,11 @@ const processSecretSync = (log, wranglerEnvs, selectedKeys, envMap, dryRun, conf
|
|
|
174
181
|
});
|
|
175
182
|
return progress;
|
|
176
183
|
};
|
|
177
|
-
const processSecretBulkSync = (
|
|
184
|
+
const processSecretBulkSync = (args) => {
|
|
185
|
+
const { log, wranglerEnvs, selectedKeys, envMap, dryRun, configPath, inlineValues, envPath, all, } = args;
|
|
178
186
|
const progress = createSyncProgress();
|
|
179
187
|
forEachWranglerEnv(wranglerEnvs, (wranglerEnv, wranglerEnvLabel) => {
|
|
180
|
-
const { payload, includedKeys, skippedEmptyKeys: skippedForEnv, } = resolveBulkPayload(log, wranglerEnv, selectedKeys, envMap, inlineValues);
|
|
188
|
+
const { payload, includedKeys, skippedEmptyKeys: skippedForEnv, } = resolveBulkPayload(log, wranglerEnv, selectedKeys, envMap, inlineValues, envPath, all);
|
|
181
189
|
progress.skippedEmptyKeys.push(...skippedForEnv);
|
|
182
190
|
if (includedKeys.length === 0) {
|
|
183
191
|
log.info(`skip bulk upload -> ${wranglerEnvLabel}: no non-empty keys`);
|
|
@@ -222,7 +230,7 @@ export const reportCloudflareSecretSync = (log, result) => {
|
|
|
222
230
|
log.warn(`${item.key} -> ${describeWranglerEnv(item.wranglerEnv)}: ${item.reason}`);
|
|
223
231
|
}
|
|
224
232
|
};
|
|
225
|
-
export const syncCloudflareSecrets = async ({ log, cwd, wranglerEnvs, envPath, dryRun = false, configGroups = [], directKeys = [], inlineValues = {}, configPath, target, bulk = false, requireSelection = true, }) => {
|
|
233
|
+
export const syncCloudflareSecrets = async ({ log, cwd, wranglerEnvs, envPath, dryRun = false, configGroups = [], directKeys = [], inlineValues = {}, configPath, target, bulk = false, requireSelection = true, all = false, }) => {
|
|
226
234
|
const normalizedConfigPath = typeof configPath === 'string' && configPath.trim() !== '' ? configPath.trim() : undefined;
|
|
227
235
|
if (normalizedConfigPath !== undefined && !existsSync(path.join(cwd, normalizedConfigPath))) {
|
|
228
236
|
throw ErrorFactory.createCliError(`Wrangler config not found: ${normalizedConfigPath}`);
|
|
@@ -244,8 +252,28 @@ export const syncCloudflareSecrets = async ({ log, cwd, wranglerEnvs, envPath, d
|
|
|
244
252
|
}
|
|
245
253
|
const envMap = await EnvFile.read({ cwd, path: envPath });
|
|
246
254
|
const syncResult = bulk
|
|
247
|
-
? processSecretBulkSync(
|
|
248
|
-
|
|
255
|
+
? processSecretBulkSync({
|
|
256
|
+
log,
|
|
257
|
+
wranglerEnvs,
|
|
258
|
+
selectedKeys,
|
|
259
|
+
envMap,
|
|
260
|
+
dryRun,
|
|
261
|
+
configPath: normalizedConfigPath,
|
|
262
|
+
inlineValues,
|
|
263
|
+
envPath,
|
|
264
|
+
all,
|
|
265
|
+
})
|
|
266
|
+
: processSecretSync({
|
|
267
|
+
log,
|
|
268
|
+
wranglerEnvs,
|
|
269
|
+
selectedKeys,
|
|
270
|
+
envMap,
|
|
271
|
+
dryRun,
|
|
272
|
+
configPath: normalizedConfigPath,
|
|
273
|
+
inlineValues,
|
|
274
|
+
envPath,
|
|
275
|
+
all,
|
|
276
|
+
});
|
|
249
277
|
return {
|
|
250
278
|
...syncResult,
|
|
251
279
|
selectedKeys,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DeployCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DeployCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DeployCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgMrE;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;cACO,YAAY;EAGtB,CAAC"}
|
|
@@ -58,6 +58,7 @@ const syncWranglerSecrets = async (cmd, cwd, wranglerEnv, options) => {
|
|
|
58
58
|
configPath: typeof options.config === 'string' ? options.config.trim() : undefined,
|
|
59
59
|
target: typeof options.target === 'string' ? options.target : undefined,
|
|
60
60
|
requireSelection: false,
|
|
61
|
+
all: options.all === true,
|
|
61
62
|
});
|
|
62
63
|
if (result.selectedKeys.length === 0)
|
|
63
64
|
return;
|
|
@@ -109,6 +110,7 @@ const createDeployCommand = () => {
|
|
|
109
110
|
command.option('-c, --config <path>', 'Wrangler config file (e.g. wrangler.containers-proxy.jsonc)');
|
|
110
111
|
command.option('--env-path <path>', 'Path to env file used when syncing Cloudflare secrets', '.env');
|
|
111
112
|
command.option('--target <id>', 'Cloudflare worker target key from .zintrust.json cloudflare.targets');
|
|
113
|
+
command.option('--all', 'Sync both custom env file and process.env (only applies when custom env file is provided)');
|
|
112
114
|
command.option('--no-sync-secrets', 'Skip Cloudflare secret sync before wrangler deploy');
|
|
113
115
|
},
|
|
114
116
|
execute: async (options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployContainersProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DeployContainersProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DeployContainersProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DeployContainersProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA+ErE,eAAO,MAAM,4BAA4B;cAC7B,YAAY;EA6BtB,CAAC"}
|
|
@@ -31,6 +31,7 @@ const syncDeploySecrets = async (cmd, cwd, config, env, options) => {
|
|
|
31
31
|
configPath: config,
|
|
32
32
|
target: typeof options.target === 'string' ? options.target : undefined,
|
|
33
33
|
requireSelection: false,
|
|
34
|
+
all: options.all === true,
|
|
34
35
|
});
|
|
35
36
|
if (result.selectedKeys.length === 0)
|
|
36
37
|
return;
|
|
@@ -60,6 +61,7 @@ export const DeployContainersProxyCommand = Object.freeze({
|
|
|
60
61
|
command.option('-c, --config <path>', 'Wrangler config file', DEFAULT_CONFIG);
|
|
61
62
|
command.option('--env-path <path>', 'Path to env file used when syncing Cloudflare secrets', '.env');
|
|
62
63
|
command.option('--target <id>', 'Cloudflare worker target key from .zintrust.json cloudflare.targets');
|
|
64
|
+
command.option('--all', 'Sync both custom env file and process.env (only applies when custom env file is provided)');
|
|
63
65
|
command.option('--no-sync-secrets', 'Skip Cloudflare secret sync before wrangler deploy');
|
|
64
66
|
},
|
|
65
67
|
execute: async (options) => execute(cmd, options),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PutCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/PutCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"PutCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/PutCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmHvF,eAAO,MAAM,UAAU;cACX,YAAY;EAWtB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -50,6 +50,7 @@ const addOptions = (command) => {
|
|
|
50
50
|
.option('--env_path <path>', 'Path to env file used as source values', '.env')
|
|
51
51
|
.option('-c, --config <path>', 'Wrangler config file to target (optional)')
|
|
52
52
|
.option('--bulk', 'Upload the final key set with one wrangler secret bulk call per target')
|
|
53
|
+
.option('--all', 'Sync both custom env file and process.env (only applies when custom env file is provided)')
|
|
53
54
|
.option('--dry-run', 'Show what would be uploaded without calling wrangler');
|
|
54
55
|
};
|
|
55
56
|
const ensureCloudflareProvider = (providerRaw) => {
|
|
@@ -75,6 +76,7 @@ const execute = async (cmd, options) => {
|
|
|
75
76
|
target: typeof options.target === 'string' ? options.target : undefined,
|
|
76
77
|
bulk: options.bulk === true,
|
|
77
78
|
requireSelection: true,
|
|
79
|
+
all: options.all === true,
|
|
78
80
|
});
|
|
79
81
|
reportCloudflareSecretSync(cmd, result);
|
|
80
82
|
};
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v2.2.
|
|
2
|
+
* @zintrust/core v2.2.7
|
|
3
3
|
*
|
|
4
4
|
* ZinTrust Framework - Production-Grade TypeScript Backend
|
|
5
5
|
* Built for performance, type safety, and exceptional developer experience
|
|
6
6
|
*
|
|
7
7
|
* Build Information:
|
|
8
|
-
* Built: 2026-05-
|
|
8
|
+
* Built: 2026-05-29T08:10:13.516Z
|
|
9
9
|
* Node: >=20.0.0
|
|
10
10
|
* License: MIT
|
|
11
11
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Available at runtime for debugging and health checks
|
|
22
22
|
*/
|
|
23
23
|
export const ZINTRUST_VERSION = '0.1.41';
|
|
24
|
-
export const ZINTRUST_BUILD_DATE = '2026-05-
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-05-29T08:10:13.484Z'; // Replaced during build
|
|
25
25
|
export { Application } from './boot/Application.js';
|
|
26
26
|
export { AwsSigV4 } from './common/index.js';
|
|
27
27
|
export { SignedRequest } from './security/SignedRequest.js';
|