@zintrust/core 2.1.9 → 2.2.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/package.json +4 -38
- package/src/common/RemoteSignedJson.d.ts +1 -0
- package/src/common/RemoteSignedJson.d.ts.map +1 -1
- package/src/common/RemoteSignedJson.js +6 -1
- package/src/index.js +3 -3
- package/src/orm/adapters/MongoDBProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MongoDBProxyAdapter.js +3 -2
- package/src/orm/adapters/MySQLProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLProxyAdapter.js +1 -0
- package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLProxyAdapter.js +1 -0
- package/src/orm/adapters/SqlProxyAdapterUtils.d.ts +2 -0
- package/src/orm/adapters/SqlProxyAdapterUtils.d.ts.map +1 -1
- package/src/orm/adapters/SqlProxyAdapterUtils.js +17 -0
- package/src/orm/adapters/SqlProxyHttpAdapterShared.d.ts +1 -0
- package/src/orm/adapters/SqlProxyHttpAdapterShared.d.ts.map +1 -1
- package/src/orm/adapters/SqlProxyHttpAdapterShared.js +8 -3
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SqlServerProxyAdapter.js +1 -0
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
- package/src/tools/mail/drivers/Smtp.js +4 -1
- package/src/tools/redis/RedisTransport.d.ts.map +1 -1
- package/src/tools/redis/RedisTransport.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Production-grade TypeScript backend framework for JavaScript",
|
|
5
5
|
"homepage": "https://zintrust.com",
|
|
6
6
|
"repository": {
|
|
@@ -211,49 +211,15 @@
|
|
|
211
211
|
"chalk": "^5.6.2",
|
|
212
212
|
"commander": "^14.0.3",
|
|
213
213
|
"inquirer": "^14.0.0",
|
|
214
|
+
"ioredis": "^5.11.0",
|
|
214
215
|
"jsonwebtoken": "^9.0.3",
|
|
215
216
|
"mysql2": "^3.22.4",
|
|
216
217
|
"pg": "^8.21.0",
|
|
218
|
+
"redis": "^5.12.1",
|
|
217
219
|
"tsx": "^4.22.3"
|
|
218
220
|
},
|
|
219
221
|
"overrides": {
|
|
220
|
-
"
|
|
221
|
-
"axios": "^1.15.0",
|
|
222
|
-
"@eslint/plugin-kit": "^0.7.1",
|
|
223
|
-
"follow-redirects": "^1.16.0",
|
|
224
|
-
"@tootallnate/once": "3.0.1",
|
|
225
|
-
"node-forge": "^1.4.0",
|
|
226
|
-
"fast-uri": "3.1.2",
|
|
227
|
-
"fast-xml-parser": "5.8.0",
|
|
228
|
-
"protobufjs": "7.5.9",
|
|
229
|
-
"brace-expansion": "^5.0.5",
|
|
230
|
-
"picomatch": "^4.0.4",
|
|
231
|
-
"cross-spawn": "^7.0.5",
|
|
232
|
-
"glob": "^11.1.0",
|
|
233
|
-
"minimatch": "^10.2.2",
|
|
234
|
-
"rollup": "^4.59.0",
|
|
235
|
-
"vite": "^8.0.5",
|
|
236
|
-
"flatted": "^3.4.2",
|
|
237
|
-
"uuid": "14.0.0",
|
|
238
|
-
"@actions/github": {
|
|
239
|
-
"undici": "^6.24.0"
|
|
240
|
-
},
|
|
241
|
-
"@actions/http-client": {
|
|
242
|
-
"undici": "^6.24.0"
|
|
243
|
-
},
|
|
244
|
-
"miniflare": {
|
|
245
|
-
"undici": "^7.24.4"
|
|
246
|
-
},
|
|
247
|
-
"http-proxy-agent": "7.0.2",
|
|
248
|
-
"retry-request": "8.0.2",
|
|
249
|
-
"gaxios": "7.1.4",
|
|
250
|
-
"teeny-request": "10.1.2",
|
|
251
|
-
"braces": "^3.0.3",
|
|
252
|
-
"lodash": "^4.17.21",
|
|
253
|
-
"semver": "^7.6.3",
|
|
254
|
-
"tmp": "^0.2.4",
|
|
255
|
-
"ws": "^8.20.0",
|
|
256
|
-
"micromatch": "^4.0.8"
|
|
222
|
+
"ioredis": "^5.11.0"
|
|
257
223
|
},
|
|
258
224
|
"bin": {
|
|
259
225
|
"zintrust": "bin/zintrust.js",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteSignedJson.d.ts","sourceRoot":"","sources":["../../../src/common/RemoteSignedJson.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"RemoteSignedJson.d.ts","sourceRoot":"","sources":["../../../src/common/RemoteSignedJson.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yBAAyB,EAAE,MAAM,CAAC;IAElC,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAgIF,eAAO,MAAM,gBAAgB;YACb,CAAC,YACH,wBAAwB,QAC5B,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC;EA+Cb,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -133,7 +133,12 @@ export const RemoteSignedJson = Object.freeze({
|
|
|
133
133
|
try {
|
|
134
134
|
const resp = await fetch(url, {
|
|
135
135
|
method: 'POST',
|
|
136
|
-
headers: {
|
|
136
|
+
headers: {
|
|
137
|
+
'Content-Type': 'application/json',
|
|
138
|
+
Connection: 'close',
|
|
139
|
+
...signed,
|
|
140
|
+
...normalized.customHeaders,
|
|
141
|
+
},
|
|
137
142
|
body,
|
|
138
143
|
signal: nativeSignal,
|
|
139
144
|
});
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v2.
|
|
2
|
+
* @zintrust/core v2.2.0
|
|
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-27T17:41:35.334Z
|
|
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-27T17:41:35.138Z'; // 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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoDBProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MongoDBProxyAdapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MongoDBProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MongoDBProxyAdapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AA+D1E,wBAAgB,yBAAyB,IAAI,gBAAgB,CA4F5D"}
|
|
@@ -3,7 +3,7 @@ import { Env } from '../../config/env.js';
|
|
|
3
3
|
import { Logger } from '../../config/logger.js';
|
|
4
4
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
5
5
|
import { ProxyCache } from '../adapters/ProxyCache.js';
|
|
6
|
-
import { ensureSignedSettings, isRecord, requestSignedProxy, } from '../adapters/SqlProxyAdapterUtils.js';
|
|
6
|
+
import { ensureSignedSettings, isRecord, parseCustomHeadersFromEnv, requestSignedProxy, } from '../adapters/SqlProxyAdapterUtils.js';
|
|
7
7
|
const normalizeRows = (value) => {
|
|
8
8
|
if (value === null)
|
|
9
9
|
return [];
|
|
@@ -36,7 +36,8 @@ const buildProxySettings = () => {
|
|
|
36
36
|
const keyId = Env.get('MONGODB_PROXY_KEY_ID', '');
|
|
37
37
|
const secret = Env.get('MONGODB_PROXY_SECRET', '');
|
|
38
38
|
const timeoutMs = Env.getInt('MONGODB_PROXY_TIMEOUT_MS', 30000);
|
|
39
|
-
|
|
39
|
+
const customHeaders = parseCustomHeadersFromEnv('MONGODB');
|
|
40
|
+
return { baseUrl, keyId, secret, timeoutMs, customHeaders };
|
|
40
41
|
};
|
|
41
42
|
const buildSignedProxyConfig = (settings) => ({
|
|
42
43
|
settings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQLProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MySQLProxyAdapter.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MySQLProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MySQLProxyAdapter.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AAqU1F,eAAO,MAAM,iBAAiB;oBACZ,cAAc,GAAG,gBAAgB;EAcjD,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgreSQLProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/PostgreSQLProxyAdapter.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PostgreSQLProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/PostgreSQLProxyAdapter.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AA6P1F,eAAO,MAAM,sBAAsB;oBACjB,cAAc,GAAG,gBAAgB;EAMjD,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type RemoteSignedJsonSettings } from '../../common/RemoteSignedJson';
|
|
2
|
+
export declare const parseCustomHeadersFromEnv: (prefix: string) => Record<string, string> | undefined;
|
|
2
3
|
export type ProxySettings = {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
keyId?: string;
|
|
5
6
|
secret?: string;
|
|
6
7
|
timeoutMs: number;
|
|
7
8
|
signaturePathPrefixToStrip?: string;
|
|
9
|
+
customHeaders?: Record<string, string>;
|
|
8
10
|
};
|
|
9
11
|
export type SignedProxyConfig = {
|
|
10
12
|
settings: ProxySettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlProxyAdapterUtils.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlProxyAdapterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"SqlProxyAdapterUtils.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlProxyAdapterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAO3F,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAgBnF,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,aAAa,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,iBAAiB,KAAG,wBAkB/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,iBAAiB,KAAG,wBAYhE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,CAAC,EACxC,QAAQ,iBAAiB,EACzB,MAAM,MAAM,EACZ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,OAAO,CAAC,CAAC,CAGX,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAoB,CAAC"}
|
|
@@ -3,6 +3,22 @@ import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
|
3
3
|
import { isObject } from '../../helper/index.js';
|
|
4
4
|
import { resolveSigningPrefix } from '../adapters/ProxySigningPath.js';
|
|
5
5
|
import { normalizeSigningCredentials } from '../../proxy/SigningService.js';
|
|
6
|
+
// Export parseCustomHeadersFromEnv for use by other proxy adapters (Redis, SMTP, etc.)
|
|
7
|
+
export const parseCustomHeadersFromEnv = (prefix) => {
|
|
8
|
+
const headers = {};
|
|
9
|
+
const prefixUpper = prefix.toUpperCase();
|
|
10
|
+
const headerPrefix = `${prefixUpper}_PROXY_HEADERS_`;
|
|
11
|
+
// Get all environment variables that start with the header prefix
|
|
12
|
+
const envVars = typeof process !== 'undefined' && process.env !== undefined ? process.env : {};
|
|
13
|
+
for (const [key, value] of Object.entries(envVars)) {
|
|
14
|
+
if (key.startsWith(headerPrefix) && typeof value === 'string' && value.trim() !== '') {
|
|
15
|
+
// Extract header name: MYSQL_PROXY_HEADERS_X_Tracing_Id -> X-Tracing-Id
|
|
16
|
+
const headerName = key.slice(headerPrefix.length).replaceAll('_', '-');
|
|
17
|
+
headers[headerName] = value.trim();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
21
|
+
};
|
|
6
22
|
export const buildSignedSettings = (config) => {
|
|
7
23
|
const creds = normalizeSigningCredentials({
|
|
8
24
|
keyId: config.settings.keyId ?? '',
|
|
@@ -14,6 +30,7 @@ export const buildSignedSettings = (config) => {
|
|
|
14
30
|
secret: creds.secret,
|
|
15
31
|
timeoutMs: config.settings.timeoutMs,
|
|
16
32
|
signaturePathPrefixToStrip: config.settings.signaturePathPrefixToStrip ?? resolveSigningPrefix(config.settings.baseUrl),
|
|
33
|
+
customHeaders: config.settings.customHeaders,
|
|
17
34
|
missingUrlMessage: config.missingUrlMessage,
|
|
18
35
|
missingCredentialsMessage: config.missingCredentialsMessage,
|
|
19
36
|
messages: config.messages,
|
|
@@ -12,6 +12,7 @@ export type ProxySettingsBuildInput = {
|
|
|
12
12
|
sharedKeyIdKey?: string;
|
|
13
13
|
sharedSecretKey?: string;
|
|
14
14
|
sharedTimeoutKey?: string;
|
|
15
|
+
customHeadersPrefix?: string;
|
|
15
16
|
};
|
|
16
17
|
export declare const SqlProxyHttpAdapterShared: Readonly<{
|
|
17
18
|
buildProxySettingsFromEnv: (input: ProxySettingsBuildInput) => ProxySettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlProxyHttpAdapterShared.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlProxyHttpAdapterShared.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"SqlProxyHttpAdapterShared.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlProxyHttpAdapterShared.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAG5C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;AAE3C,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAyFF,eAAO,MAAM,yBAAyB;uCApEI,uBAAuB,KAAG,aAAa;4CAmBlC;QAC7C,QAAQ,EAAE,aAAa,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,KAAG,iBAAiB;sCAmBoB,iBAAiB,KAAG,IAAI;mBAIrC,CAAC,UACnB,iBAAiB,QACnB,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,OAAO,CAAC,CAAC,CAAC;sCAI4B,MAAM,KAAG,SAAS;6CAIX,MAAM,WAAW,MAAM,SAAS,OAAO,KAAG,KAAK;EAe7F,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Env } from '../../config/env.js';
|
|
2
2
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
3
|
-
import { ensureSignedSettings, requestSignedProxy, } from '../adapters/SqlProxyAdapterUtils.js';
|
|
3
|
+
import { ensureSignedSettings, parseCustomHeadersFromEnv, requestSignedProxy, } from '../adapters/SqlProxyAdapterUtils.js';
|
|
4
4
|
import { resolveSqlProxyMode } from '../adapters/SqlProxyRegistryMode.js';
|
|
5
5
|
const resolveBaseUrl = (input) => {
|
|
6
6
|
const explicit = Env.get(input.urlKey, '').trim();
|
|
@@ -22,7 +22,12 @@ const buildProxySettingsFromEnv = (input) => {
|
|
|
22
22
|
const keyId = Env.get(input.keyIdKey, Env.get(input.sharedKeyIdKey ?? 'ZT_PROXY_KEY_ID', ''));
|
|
23
23
|
const secret = Env.get(input.secretKey, Env.get(input.sharedSecretKey ?? 'ZT_PROXY_SECRET', ''));
|
|
24
24
|
const timeoutMs = Env.getInt(input.timeoutKey, Env.getInt(input.sharedTimeoutKey ?? 'ZT_PROXY_TIMEOUT_MS', 30000));
|
|
25
|
-
|
|
25
|
+
const customHeaders = input.customHeadersPrefix !== undefined &&
|
|
26
|
+
input.customHeadersPrefix !== null &&
|
|
27
|
+
input.customHeadersPrefix !== ''
|
|
28
|
+
? parseCustomHeadersFromEnv(input.customHeadersPrefix)
|
|
29
|
+
: undefined;
|
|
30
|
+
return { baseUrl, keyId, secret, timeoutMs, customHeaders };
|
|
26
31
|
};
|
|
27
32
|
const buildStandardSignedProxyConfig = (input) => {
|
|
28
33
|
const { settings, label } = input;
|
|
@@ -30,7 +35,7 @@ const buildStandardSignedProxyConfig = (input) => {
|
|
|
30
35
|
return {
|
|
31
36
|
settings,
|
|
32
37
|
missingUrlMessage: `${label} proxy URL is missing (${input.urlKey})`,
|
|
33
|
-
missingCredentialsMessage: `${label} proxy signing credentials are missing (${input.keyIdKey} / ${input.secretKey
|
|
38
|
+
missingCredentialsMessage: `${label} proxy signing credentials are missing (${input.keyIdKey} / ${input.secretKey})`,
|
|
34
39
|
messages: {
|
|
35
40
|
unauthorized: `${prefix} unauthorized`,
|
|
36
41
|
forbidden: `${prefix} forbidden`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlServerProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlServerProxyAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"SqlServerProxyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SqlServerProxyAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AA4P1E,wBAAgB,2BAA2B,IAAI,gBAAgB,CAK9D"}
|
|
@@ -22,6 +22,7 @@ const buildProxySettings = () => {
|
|
|
22
22
|
secretKey: 'SQLSERVER_PROXY_SECRET',
|
|
23
23
|
timeoutKey: 'SQLSERVER_PROXY_TIMEOUT_MS',
|
|
24
24
|
sharedTimeoutKey: 'ZT_PROXY_TIMEOUT_MS',
|
|
25
|
+
customHeadersPrefix: 'SQLSERVER',
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
const buildSignedProxyConfig = (settings) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Smtp.d.ts","sourceRoot":"","sources":["../../../../../src/tools/mail/drivers/Smtp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Smtp.d.ts","sourceRoot":"","sources":["../../../../../src/tools/mail/drivers/Smtp.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAC/B,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA+kBF,eAAO,MAAM,UAAU;IACrB;;;;OAIG;iBACgB,UAAU,WAAW,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;EAuDzE,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { Logger } from '../../../config/logger.js';
|
|
|
5
5
|
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
6
6
|
import * as net from '../../../node-singletons/net.js';
|
|
7
7
|
import * as tls from '../../../node-singletons/tls.js';
|
|
8
|
+
import { parseCustomHeadersFromEnv } from '../../../orm/adapters/SqlProxyAdapterUtils.js';
|
|
8
9
|
import { normalizeSigningCredentials } from '../../../proxy/SigningService.js';
|
|
9
10
|
import { buildRfc2822Message, } from '../../mail/MailMessage.js';
|
|
10
11
|
const resolveSigningPrefix = (baseUrl) => {
|
|
@@ -47,7 +48,8 @@ const buildProxySettings = () => {
|
|
|
47
48
|
const keyId = Env.SMTP_PROXY_KEY_ID ?? '';
|
|
48
49
|
const secret = Env.SMTP_PROXY_SECRET ?? '';
|
|
49
50
|
const timeoutMs = Env.SMTP_PROXY_TIMEOUT_MS;
|
|
50
|
-
|
|
51
|
+
const customHeaders = parseCustomHeadersFromEnv('SMTP');
|
|
52
|
+
return { baseUrl, keyId, secret, timeoutMs, customHeaders };
|
|
51
53
|
};
|
|
52
54
|
const buildSignedSettings = (settings) => {
|
|
53
55
|
const creds = normalizeSigningCredentials({
|
|
@@ -60,6 +62,7 @@ const buildSignedSettings = (settings) => {
|
|
|
60
62
|
secret: creds.secret,
|
|
61
63
|
timeoutMs: settings.timeoutMs,
|
|
62
64
|
signaturePathPrefixToStrip: resolveSigningPrefix(settings.baseUrl),
|
|
65
|
+
customHeaders: settings.customHeaders,
|
|
63
66
|
missingUrlMessage: 'SMTP proxy URL is missing (SMTP_PROXY_URL)',
|
|
64
67
|
missingCredentialsMessage: `SMTP proxy signing credentials are missing (${['SMTP_PROXY', 'KEY_ID'].join('_')} / ${['SMTP_PROXY', 'SECRET'].join('_')})`,
|
|
65
68
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisTransport.d.ts","sourceRoot":"","sources":["../../../../src/tools/redis/RedisTransport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"RedisTransport.d.ts","sourceRoot":"","sources":["../../../../src/tools/redis/RedisTransport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AAUH,KAAK,oBAAoB,GAAG;IAC1B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,oBAAoB,CAAC;IACnF,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,oBAAoB,CAAC;IACrF,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,oBAAoB,CAAC;IACpF,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,oBAAoB,CAAC;IAC/F,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,QAAQ,EAAE,MAAM;QACd,IAAI,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK;QAC5D,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,OAAO,CAAC;QACtE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,OAAO,CAAC;QACxE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,OAAO,CAAC;KACxE,CAAC;CACH,CAAC;AAiRF,eAAO,MAAM,yBAAyB,QAAO,kBAI5C,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,QAAQ,WAAW,EACnB,UAAU,qBAAqB,KAC9B,oBAoCF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,QAAQ,WAAW,EACnB,UAAU,qBAAqB,KAC9B,kBAaF,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Env } from '../../config/env.js';
|
|
2
2
|
import { Logger } from '../../config/logger.js';
|
|
3
3
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
4
|
+
import { parseCustomHeadersFromEnv } from '../../orm/adapters/SqlProxyAdapterUtils.js';
|
|
4
5
|
import { SignedRequest } from '../../security/SignedRequest.js';
|
|
5
6
|
const loggedSelections = new Set();
|
|
6
7
|
const readEnvString = (key, fallback = '') => {
|
|
@@ -59,6 +60,7 @@ const resolveProxySettings = () => ({
|
|
|
59
60
|
keyId: Env.REDIS_PROXY_KEY_ID.trim() === '' ? undefined : Env.REDIS_PROXY_KEY_ID,
|
|
60
61
|
secret: Env.REDIS_PROXY_SECRET.trim() === '' ? undefined : Env.REDIS_PROXY_SECRET,
|
|
61
62
|
timeoutMs: Env.REDIS_PROXY_TIMEOUT_MS,
|
|
63
|
+
customHeaders: parseCustomHeadersFromEnv('REDIS'),
|
|
62
64
|
});
|
|
63
65
|
const buildHeaders = async (settings, requestUrl, body) => {
|
|
64
66
|
const headers = {
|
|
@@ -75,6 +77,9 @@ const buildHeaders = async (settings, requestUrl, body) => {
|
|
|
75
77
|
});
|
|
76
78
|
Object.assign(headers, signed);
|
|
77
79
|
}
|
|
80
|
+
if (settings.customHeaders !== undefined) {
|
|
81
|
+
Object.assign(headers, settings.customHeaders);
|
|
82
|
+
}
|
|
78
83
|
return headers;
|
|
79
84
|
};
|
|
80
85
|
const requestProxyCommand = async (settings, command, args) => {
|