@dereekb/nestjs 13.11.13 → 13.11.15
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/discord/index.cjs.js +37 -34
- package/discord/index.esm.js +36 -33
- package/discord/package.json +4 -4
- package/discord/src/lib/discord.api.d.ts +6 -6
- package/discord/src/lib/discord.api.page.d.ts +4 -4
- package/discord/src/lib/discord.config.d.ts +2 -2
- package/discord/src/lib/discord.module.d.ts +2 -2
- package/discord/src/lib/discord.util.d.ts +3 -3
- package/discord/src/lib/webhook/webhook.discord.d.ts +2 -2
- package/discord/src/lib/webhook/webhook.discord.module.d.ts +2 -2
- package/discord/src/lib/webhook/webhook.discord.verify.d.ts +2 -2
- package/eslint/index.cjs.js +142 -145
- package/eslint/index.esm.js +141 -144
- package/eslint/package.json +4 -4
- package/eslint/src/lib/index.d.ts +2 -2
- package/eslint/src/lib/plugin.d.ts +1 -1
- package/eslint/src/lib/require-inject.rule.d.ts +1 -1
- package/index.cjs.js +98 -112
- package/index.esm.js +98 -112
- package/mailgun/index.cjs.js +17 -13
- package/mailgun/index.esm.js +17 -13
- package/mailgun/package.json +6 -6
- package/mailgun/src/lib/mailgun.d.ts +7 -5
- package/mailgun/src/lib/mailgun.service.module.d.ts +4 -3
- package/mailgun/src/lib/mailgun.util.d.ts +6 -5
- package/openai/index.cjs.js +9 -9
- package/openai/index.esm.js +9 -9
- package/openai/package.json +6 -6
- package/openai/src/lib/openai.module.d.ts +2 -2
- package/openai/src/lib/openai.util.d.ts +3 -3
- package/openai/src/lib/webhook/webhook.openai.module.d.ts +2 -2
- package/openai/src/lib/webhook/webhook.openai.verify.d.ts +2 -2
- package/package.json +5 -5
- package/src/lib/asset/asset.loader.node.d.ts +3 -3
- package/src/lib/asset/asset.nest.d.ts +6 -5
- package/src/lib/decorators/local.decorator.d.ts +2 -2
- package/src/lib/decorators/rawbody.d.ts +7 -7
- package/src/lib/module/client/client.config.d.ts +2 -2
- package/src/lib/module/client/client.module.d.ts +3 -2
- package/src/lib/module/env/env.d.ts +1 -1
- package/src/lib/module/env/env.nest.d.ts +2 -2
- package/src/lib/module/module.d.ts +5 -5
- package/src/lib/util/encryption/json.encrypt.d.ts +18 -16
- package/src/lib/util/file/file.json.d.ts +2 -2
- package/src/lib/util/pdf/pdf.encryption.d.ts +3 -3
- package/stripe/index.cjs.js +13 -13
- package/stripe/index.esm.js +13 -13
- package/stripe/package.json +6 -6
- package/stripe/src/lib/stripe.api.d.ts +4 -4
- package/stripe/src/lib/stripe.module.d.ts +3 -3
- package/stripe/src/lib/webhook/webhook.stripe.d.ts +4 -4
- package/typeform/index.cjs.js +12 -12
- package/typeform/index.esm.js +12 -12
- package/typeform/package.json +6 -6
- package/typeform/src/lib/typeform.module.d.ts +2 -2
- package/typeform/src/lib/typeform.util.d.ts +2 -2
- package/typeform/src/lib/webhook/webhook.typeform.form.d.ts +4 -4
- package/typeform/src/lib/webhook/webhook.typeform.module.d.ts +2 -2
- package/typeform/src/lib/webhook/webhook.typeform.verify.d.ts +2 -2
- package/vapiai/index.cjs.js +6 -6
- package/vapiai/index.esm.js +6 -6
- package/vapiai/package.json +6 -6
- package/vapiai/src/lib/vapiai.module.d.ts +2 -2
- package/vapiai/src/lib/webhook/webhook.vapiai.module.d.ts +2 -2
- package/vapiai/src/lib/webhook/webhook.vapiai.verify.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -146,6 +146,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
146
146
|
* The ref's {@link AssetLocalPathRef.path} is resolved relative
|
|
147
147
|
* to the configured {@link NodeJsLocalAssetLoaderConfig.basePath}.
|
|
148
148
|
*
|
|
149
|
+
* @param config - Filesystem configuration with base path.
|
|
150
|
+
* @returns An {@link AssetLoader} backed by the local filesystem.
|
|
151
|
+
*
|
|
149
152
|
* @example
|
|
150
153
|
* ```ts
|
|
151
154
|
* const loader = nodeJsLocalAssetLoader({ basePath: './assets' });
|
|
@@ -153,9 +156,6 @@ function _ts_generator$2(thisArg, body) {
|
|
|
153
156
|
* // reads from ./assets/data/districts.json
|
|
154
157
|
* });
|
|
155
158
|
* ```
|
|
156
|
-
*
|
|
157
|
-
* @param config - Filesystem configuration with base path.
|
|
158
|
-
* @returns An {@link AssetLoader} backed by the local filesystem.
|
|
159
159
|
*/ function nodeJsLocalAssetLoader(config) {
|
|
160
160
|
var basePath = config.basePath;
|
|
161
161
|
var getFn = function getFn(ref) {
|
|
@@ -190,16 +190,17 @@ function _ts_generator$2(thisArg, body) {
|
|
|
190
190
|
* Local assets are loaded from the filesystem. Remote assets (which always
|
|
191
191
|
* have absolute URLs) are loaded via `fetch`.
|
|
192
192
|
*
|
|
193
|
-
* @
|
|
194
|
-
*
|
|
195
|
-
*
|
|
193
|
+
* @param config - Local filesystem config and optional remote fetch config.
|
|
194
|
+
* @returns NestJS {@link ModuleMetadata} that provides an {@link AssetLoader}.
|
|
195
|
+
*
|
|
196
|
+
* @Module (appAssetLoaderModuleMetadata({
|
|
196
197
|
* local: { basePath: './assets' }
|
|
197
198
|
* }))
|
|
198
199
|
* export class AppAssetLoaderModule {}
|
|
199
200
|
* ```
|
|
200
201
|
*
|
|
201
|
-
* @
|
|
202
|
-
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
203
204
|
*/ function appAssetLoaderModuleMetadata(config) {
|
|
204
205
|
var local = nodeJsLocalAssetLoader(config.local);
|
|
205
206
|
var remote = fetchAssetLoader(config.remote);
|
|
@@ -231,8 +232,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
231
232
|
*
|
|
232
233
|
* Checks for both http://localhost and https://localhost origins.
|
|
233
234
|
*
|
|
234
|
-
* @param context -
|
|
235
|
-
* @returns
|
|
235
|
+
* @param context - The NestJS execution context containing the HTTP request.
|
|
236
|
+
* @returns True if the request origin is localhost.
|
|
236
237
|
*/ function isLocalhost(context) {
|
|
237
238
|
var _req_headers_origin;
|
|
238
239
|
var req = context.switchToHttp().getRequest();
|
|
@@ -383,26 +384,17 @@ function _ts_generator$1(thisArg, body) {
|
|
|
383
384
|
*/ var rawBodyLogger = new Logger('RawBody');
|
|
384
385
|
var ParseRawBody = createParamDecorator(function(_, context) {
|
|
385
386
|
return _async_to_generator$1(function() {
|
|
386
|
-
var req
|
|
387
|
+
var req;
|
|
387
388
|
return _ts_generator$1(this, function(_state) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
rawBodyLogger.error('RawBody request was not readable. This is generally due to bad configuration.');
|
|
393
|
-
throw new BadRequestException('Invalid body');
|
|
394
|
-
}
|
|
395
|
-
return [
|
|
396
|
-
4,
|
|
397
|
-
rawbody(req)
|
|
398
|
-
];
|
|
399
|
-
case 1:
|
|
400
|
-
body = _state.sent();
|
|
401
|
-
return [
|
|
402
|
-
2,
|
|
403
|
-
body
|
|
404
|
-
];
|
|
389
|
+
req = context.switchToHttp().getRequest();
|
|
390
|
+
if (!req.readable) {
|
|
391
|
+
rawBodyLogger.error('RawBody request was not readable. This is generally due to bad configuration.');
|
|
392
|
+
throw new BadRequestException('Invalid body');
|
|
405
393
|
}
|
|
394
|
+
return [
|
|
395
|
+
2,
|
|
396
|
+
rawbody(req)
|
|
397
|
+
];
|
|
406
398
|
});
|
|
407
399
|
})();
|
|
408
400
|
});
|
|
@@ -460,9 +452,9 @@ var ParseRawBody = createParamDecorator(function(_, context) {
|
|
|
460
452
|
/**
|
|
461
453
|
* Parses a raw body buffer as JSON.
|
|
462
454
|
*
|
|
463
|
-
* @param rawBody - The raw body buffer to parse
|
|
464
|
-
* @returns The parsed JSON object
|
|
465
|
-
* @throws {SyntaxError} When the body is not valid JSON
|
|
455
|
+
* @param rawBody - The raw body buffer to parse.
|
|
456
|
+
* @returns The parsed JSON object.
|
|
457
|
+
* @throws {SyntaxError} When the body is not valid JSON.
|
|
466
458
|
*
|
|
467
459
|
* @example
|
|
468
460
|
* ```typescript
|
|
@@ -475,8 +467,8 @@ var ParseRawBody = createParamDecorator(function(_, context) {
|
|
|
475
467
|
/**
|
|
476
468
|
* Parses a raw body buffer as a URL-encoded query string.
|
|
477
469
|
*
|
|
478
|
-
* @param rawBody - The raw body buffer to parse
|
|
479
|
-
* @returns The parsed query parameters
|
|
470
|
+
* @param rawBody - The raw body buffer to parse.
|
|
471
|
+
* @returns The parsed query parameters.
|
|
480
472
|
*
|
|
481
473
|
* @example
|
|
482
474
|
* ```typescript
|
|
@@ -489,8 +481,8 @@ var ParseRawBody = createParamDecorator(function(_, context) {
|
|
|
489
481
|
/**
|
|
490
482
|
* Converts a raw body buffer to a trimmed UTF-8 string.
|
|
491
483
|
*
|
|
492
|
-
* @param rawBody - The raw body buffer to convert
|
|
493
|
-
* @returns The decoded and trimmed string content
|
|
484
|
+
* @param rawBody - The raw body buffer to convert.
|
|
485
|
+
* @returns The decoded and trimmed string content.
|
|
494
486
|
*
|
|
495
487
|
* @example
|
|
496
488
|
* ```typescript
|
|
@@ -777,9 +769,9 @@ function _type_of(obj) {
|
|
|
777
769
|
/**
|
|
778
770
|
* Merges two module metadata entries together.
|
|
779
771
|
*
|
|
780
|
-
* @param base -
|
|
781
|
-
* @param additional -
|
|
782
|
-
* @returns
|
|
772
|
+
* @param base - The base module metadata.
|
|
773
|
+
* @param additional - Additional metadata to merge in.
|
|
774
|
+
* @returns The merged module metadata.
|
|
783
775
|
*/ function mergeModuleMetadata(base) {
|
|
784
776
|
var additional = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
785
777
|
return {
|
|
@@ -806,8 +798,8 @@ function _type_of(obj) {
|
|
|
806
798
|
*
|
|
807
799
|
* For class providers, returns the class itself; for object providers, returns the provide token.
|
|
808
800
|
*
|
|
809
|
-
* @param providers -
|
|
810
|
-
* @returns
|
|
801
|
+
* @param providers - Providers to extract tokens from.
|
|
802
|
+
* @returns Injection tokens collected from each provider.
|
|
811
803
|
*/ function injectionTokensFromProviders(providers) {
|
|
812
804
|
return asArray(providers).map(function(x) {
|
|
813
805
|
return (typeof x === "undefined" ? "undefined" : _type_of(x)) === 'object' ? x.provide : x;
|
|
@@ -864,8 +856,8 @@ function _define_property$3(obj, key, value) {
|
|
|
864
856
|
value: /**
|
|
865
857
|
* Validates that the configuration contains a non-empty client web app URL.
|
|
866
858
|
*
|
|
867
|
-
* @param config - The configuration to validate
|
|
868
|
-
* @throws {Error} When `clientWebAppUrl` is not specified
|
|
859
|
+
* @param config - The configuration to validate.
|
|
860
|
+
* @throws {Error} When `clientWebAppUrl` is not specified.
|
|
869
861
|
*/ function assertValidConfig(config) {
|
|
870
862
|
if (!config.client.clientWebAppUrl) {
|
|
871
863
|
throw new Error('No client app url specified.');
|
|
@@ -953,8 +945,9 @@ function _class_call_check$2(instance, Constructor) {
|
|
|
953
945
|
*
|
|
954
946
|
* Reads the client web app URL from the CLIENT_WEB_APP_URL environment variable.
|
|
955
947
|
*
|
|
956
|
-
* @param configService - NestJS config service for reading environment variables
|
|
957
|
-
* @returns
|
|
948
|
+
* @param configService - NestJS config service for reading environment variables.
|
|
949
|
+
* @returns A validated ClientAppServiceConfig.
|
|
950
|
+
*
|
|
958
951
|
* @__NO_SIDE_EFFECTS__
|
|
959
952
|
*/ function clientAppConfigFactory(configService) {
|
|
960
953
|
var config = {
|
|
@@ -1018,8 +1011,8 @@ function _class_call_check$1(instance, Constructor) {
|
|
|
1018
1011
|
*
|
|
1019
1012
|
* Use this to register a server environment configuration instance with the NestJS dependency injection container.
|
|
1020
1013
|
*
|
|
1021
|
-
* @param env -
|
|
1022
|
-
* @returns
|
|
1014
|
+
* @param env - The server environment config to provide.
|
|
1015
|
+
* @returns A NestJS Provider that supplies the config under SERVER_ENV_TOKEN.
|
|
1023
1016
|
*/ function serverEnvTokenProvider(env) {
|
|
1024
1017
|
return {
|
|
1025
1018
|
provide: SERVER_ENV_TOKEN,
|
|
@@ -1030,7 +1023,7 @@ function _class_call_check$1(instance, Constructor) {
|
|
|
1030
1023
|
/**
|
|
1031
1024
|
* Checks process.env.NODE_ENV for "test".
|
|
1032
1025
|
*
|
|
1033
|
-
* @returns
|
|
1026
|
+
* @returns True if the current Node environment is "test", false otherwise.
|
|
1034
1027
|
*/ function isTestNodeEnv() {
|
|
1035
1028
|
return process.env['NODE_ENV'] === 'test';
|
|
1036
1029
|
}
|
|
@@ -1157,7 +1150,7 @@ ServerEnvironmentService = __decorate([
|
|
|
1157
1150
|
* @param input.dirPath - Absolute path to the parent directory; created (recursively) when missing.
|
|
1158
1151
|
* @param input.data - Value to serialize as JSON (pretty-printed with two-space indentation).
|
|
1159
1152
|
* @param input.mode - Optional numeric file mode (e.g. `0o600`) applied via `chmod` after the write.
|
|
1160
|
-
* @returns
|
|
1153
|
+
* @returns Resolves once the JSON has been written and the optional `chmod` has completed.
|
|
1161
1154
|
*/ function writeJsonFile(input) {
|
|
1162
1155
|
mkdirSync(input.dirPath, {
|
|
1163
1156
|
recursive: true
|
|
@@ -1168,16 +1161,14 @@ ServerEnvironmentService = __decorate([
|
|
|
1168
1161
|
}, function(err) {
|
|
1169
1162
|
if (err) {
|
|
1170
1163
|
reject(err);
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
if (input.mode == null) {
|
|
1164
|
+
} else if (input.mode == null) {
|
|
1174
1165
|
resolve();
|
|
1175
|
-
|
|
1166
|
+
} else {
|
|
1167
|
+
chmod(input.filePath, input.mode, function(chmodErr) {
|
|
1168
|
+
if (chmodErr) reject(chmodErr);
|
|
1169
|
+
else resolve();
|
|
1170
|
+
});
|
|
1176
1171
|
}
|
|
1177
|
-
chmod(input.filePath, input.mode, function(chmodErr) {
|
|
1178
|
-
if (chmodErr) reject(chmodErr);
|
|
1179
|
-
else resolve();
|
|
1180
|
-
});
|
|
1181
1172
|
});
|
|
1182
1173
|
});
|
|
1183
1174
|
}
|
|
@@ -1189,7 +1180,7 @@ ServerEnvironmentService = __decorate([
|
|
|
1189
1180
|
* swallowing them masks real failures and makes operations appear to have succeeded.
|
|
1190
1181
|
*
|
|
1191
1182
|
* @param filePath - Absolute path to the file to remove.
|
|
1192
|
-
* @returns
|
|
1183
|
+
* @returns Resolves once the file is removed (or was already absent).
|
|
1193
1184
|
*/ function removeFile(filePath) {
|
|
1194
1185
|
return rm(filePath, {
|
|
1195
1186
|
force: true
|
|
@@ -1446,7 +1437,7 @@ function _ts_generator(thisArg, body) {
|
|
|
1446
1437
|
return {
|
|
1447
1438
|
load: function load() {
|
|
1448
1439
|
return _async_to_generator(function() {
|
|
1449
|
-
var raw;
|
|
1440
|
+
var raw, result;
|
|
1450
1441
|
return _ts_generator(this, function(_state) {
|
|
1451
1442
|
switch(_state.label){
|
|
1452
1443
|
case 0:
|
|
@@ -1457,14 +1448,13 @@ function _ts_generator(thisArg, body) {
|
|
|
1457
1448
|
case 1:
|
|
1458
1449
|
raw = _state.sent();
|
|
1459
1450
|
if (raw == null) {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
];
|
|
1451
|
+
result = undefined;
|
|
1452
|
+
} else {
|
|
1453
|
+
result = reviver == null ? raw : reviver(raw);
|
|
1464
1454
|
}
|
|
1465
1455
|
return [
|
|
1466
1456
|
2,
|
|
1467
|
-
|
|
1457
|
+
result
|
|
1468
1458
|
];
|
|
1469
1459
|
}
|
|
1470
1460
|
});
|
|
@@ -1560,38 +1550,32 @@ function _ts_generator(thisArg, body) {
|
|
|
1560
1550
|
case 1:
|
|
1561
1551
|
raw = _state.sent();
|
|
1562
1552
|
if (raw == null) {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return [
|
|
1570
|
-
2,
|
|
1571
|
-
raw
|
|
1572
|
-
];
|
|
1573
|
-
}
|
|
1574
|
-
result = {};
|
|
1575
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1576
|
-
try {
|
|
1577
|
-
for(_iterator = Object.keys(raw)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1578
|
-
key = _step.value;
|
|
1579
|
-
revived = reviver(raw[key]);
|
|
1580
|
-
if (revived != null) {
|
|
1581
|
-
result[key] = revived;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
} catch (err) {
|
|
1585
|
-
_didIteratorError = true;
|
|
1586
|
-
_iteratorError = err;
|
|
1587
|
-
} finally{
|
|
1553
|
+
result = {};
|
|
1554
|
+
} else if (reviver == null) {
|
|
1555
|
+
result = raw;
|
|
1556
|
+
} else {
|
|
1557
|
+
result = {};
|
|
1558
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1588
1559
|
try {
|
|
1589
|
-
|
|
1590
|
-
|
|
1560
|
+
for(_iterator = Object.keys(raw)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1561
|
+
key = _step.value;
|
|
1562
|
+
revived = reviver(raw[key]);
|
|
1563
|
+
if (revived != null) {
|
|
1564
|
+
result[key] = revived;
|
|
1565
|
+
}
|
|
1591
1566
|
}
|
|
1567
|
+
} catch (err) {
|
|
1568
|
+
_didIteratorError = true;
|
|
1569
|
+
_iteratorError = err;
|
|
1592
1570
|
} finally{
|
|
1593
|
-
|
|
1594
|
-
|
|
1571
|
+
try {
|
|
1572
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1573
|
+
_iterator.return();
|
|
1574
|
+
}
|
|
1575
|
+
} finally{
|
|
1576
|
+
if (_didIteratorError) {
|
|
1577
|
+
throw _iteratorError;
|
|
1578
|
+
}
|
|
1595
1579
|
}
|
|
1596
1580
|
}
|
|
1597
1581
|
}
|
|
@@ -1764,8 +1748,8 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1764
1748
|
/**
|
|
1765
1749
|
* Validates that the given secret is a 64-character hexadecimal string (32 bytes for AES-256).
|
|
1766
1750
|
*
|
|
1767
|
-
* @param secret -
|
|
1768
|
-
* @returns
|
|
1751
|
+
* @param secret - The hex-encoded secret key string to validate.
|
|
1752
|
+
* @returns True if the secret is exactly 64 valid hex characters, false otherwise.
|
|
1769
1753
|
*
|
|
1770
1754
|
* @example
|
|
1771
1755
|
* ```typescript
|
|
@@ -1782,15 +1766,15 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1782
1766
|
* The getter is called immediately and the key is validated on creation. The returned
|
|
1783
1767
|
* function provides the resolved Buffer without re-resolving or re-validating.
|
|
1784
1768
|
*
|
|
1769
|
+
* @param source - The secret source configuration.
|
|
1770
|
+
* @returns A getter that returns the resolved 32-byte Buffer for AES-256 encryption.
|
|
1771
|
+
* @throws {Error} When the resolved key is not 64 hex characters.
|
|
1772
|
+
*
|
|
1785
1773
|
* @example
|
|
1786
1774
|
* ```typescript
|
|
1787
1775
|
* const getKey = resolveEncryptionKey('a'.repeat(64));
|
|
1788
1776
|
* const key: Buffer = getKey();
|
|
1789
1777
|
* ```
|
|
1790
|
-
*
|
|
1791
|
-
* @param source - The secret source configuration.
|
|
1792
|
-
* @returns A getter that returns the resolved 32-byte Buffer for AES-256 encryption.
|
|
1793
|
-
* @throws Error if the resolved key is not 64 hex characters.
|
|
1794
1778
|
*/ function resolveEncryptionKey(source) {
|
|
1795
1779
|
var hex = getValueFromGetter(source);
|
|
1796
1780
|
if (!isValidAES256GCMEncryptionSecret(hex)) {
|
|
@@ -1804,6 +1788,10 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1804
1788
|
/**
|
|
1805
1789
|
* Creates an `AES256GCMEncryption` instance that captures the resolved key in a closure.
|
|
1806
1790
|
*
|
|
1791
|
+
* @param source - The hex-encoded secret or getter for the AES-256 key.
|
|
1792
|
+
* @returns An `AES256GCMEncryption` instance.
|
|
1793
|
+
* @throws {Error} When the resolved key is not 64 hex characters.
|
|
1794
|
+
*
|
|
1807
1795
|
* @example
|
|
1808
1796
|
* ```typescript
|
|
1809
1797
|
* const encryption = createAES256GCMEncryption('a'.repeat(64));
|
|
@@ -1816,9 +1804,6 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1816
1804
|
* // decryptedStr === 'hello'
|
|
1817
1805
|
* ```
|
|
1818
1806
|
*
|
|
1819
|
-
* @param source - The hex-encoded secret or getter for the AES-256 key.
|
|
1820
|
-
* @returns An `AES256GCMEncryption` instance.
|
|
1821
|
-
* @throws Error if the resolved key is not 64 hex characters.
|
|
1822
1807
|
* @__NO_SIDE_EFFECTS__
|
|
1823
1808
|
*/ function createAES256GCMEncryption(source) {
|
|
1824
1809
|
var getKey = resolveEncryptionKey(source);
|
|
@@ -1870,16 +1855,16 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1870
1855
|
*
|
|
1871
1856
|
* Format: base64(IV (12 bytes) + ciphertext + authTag (16 bytes))
|
|
1872
1857
|
*
|
|
1858
|
+
* @param value - The value to encrypt (must be JSON-serializable).
|
|
1859
|
+
* @param key - The 32-byte encryption key from `resolveEncryptionKey()`.
|
|
1860
|
+
* @returns The encrypted value as a base64 string.
|
|
1861
|
+
*
|
|
1873
1862
|
* @example
|
|
1874
1863
|
* ```typescript
|
|
1875
1864
|
* const getKey = resolveEncryptionKey(mySecret);
|
|
1876
1865
|
* const encrypted = encryptValue({ sensitive: 'data' }, getKey());
|
|
1877
1866
|
* const decrypted = decryptValue<{ sensitive: string }>(encrypted, getKey());
|
|
1878
1867
|
* ```
|
|
1879
|
-
*
|
|
1880
|
-
* @param value - The value to encrypt (must be JSON-serializable).
|
|
1881
|
-
* @param key - The 32-byte encryption key from `resolveEncryptionKey()`.
|
|
1882
|
-
* @returns The encrypted value as a base64 string.
|
|
1883
1868
|
*/ function encryptValue(value, key) {
|
|
1884
1869
|
var iv = randomBytes(ENCRYPTED_FIELD_IV_LENGTH);
|
|
1885
1870
|
var cipher = createCipheriv(ENCRYPTED_FIELD_ALGORITHM, key, iv);
|
|
@@ -1922,6 +1907,10 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1922
1907
|
* The key is resolved and validated eagerly at creation time. The provider encrypts/decrypts
|
|
1923
1908
|
* raw strings (no JSON serialization) — suitable for use with `selectiveFieldEncryptor`.
|
|
1924
1909
|
*
|
|
1910
|
+
* @param source - The hex-encoded secret or getter for the AES-256 key.
|
|
1911
|
+
* @returns A `StringEncryptionProvider` that encrypts/decrypts strings via AES-256-GCM.
|
|
1912
|
+
* @throws {Error} When the resolved key is not 64 hex characters.
|
|
1913
|
+
*
|
|
1925
1914
|
* @example
|
|
1926
1915
|
* ```typescript
|
|
1927
1916
|
* const provider = createAesStringEncryptionProvider('a'.repeat(64));
|
|
@@ -1930,9 +1919,6 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
|
|
|
1930
1919
|
* // decrypted === 'sensitive data'
|
|
1931
1920
|
* ```
|
|
1932
1921
|
*
|
|
1933
|
-
* @param source - The hex-encoded secret or getter for the AES-256 key.
|
|
1934
|
-
* @returns A `StringEncryptionProvider` that encrypts/decrypts strings via AES-256-GCM.
|
|
1935
|
-
* @throws Error if the resolved key is not 64 hex characters.
|
|
1936
1922
|
* @__NO_SIDE_EFFECTS__
|
|
1937
1923
|
*/ function createAesStringEncryptionProvider(source) {
|
|
1938
1924
|
var encryption = createAES256GCMEncryption(source);
|
|
@@ -2075,6 +2061,9 @@ function _templateObject() {
|
|
|
2075
2061
|
* Lives in `@dereekb/nestjs` (rather than `@dereekb/util`) because it uses Node's
|
|
2076
2062
|
* built-in `node:crypto` module, which isn't available in the browser.
|
|
2077
2063
|
*
|
|
2064
|
+
* @param buffer - PDF file contents.
|
|
2065
|
+
* @returns The encryption status of the PDF.
|
|
2066
|
+
*
|
|
2078
2067
|
* @example
|
|
2079
2068
|
* ```ts
|
|
2080
2069
|
* const status = detectPdfEncryption(buffer);
|
|
@@ -2086,9 +2075,6 @@ function _templateObject() {
|
|
|
2086
2075
|
* // Safe to read, but not to mutate without the owner password.
|
|
2087
2076
|
* }
|
|
2088
2077
|
* ```
|
|
2089
|
-
*
|
|
2090
|
-
* @param buffer - PDF file contents.
|
|
2091
|
-
* @returns The encryption status of the PDF.
|
|
2092
2078
|
*/ function detectPdfEncryption(buffer) {
|
|
2093
2079
|
var result = 'unknown_encrypted';
|
|
2094
2080
|
var encryptIndex = findEncryptKeywordIndex(buffer);
|
|
@@ -2428,7 +2414,7 @@ function readPdfTokenOrRefValue(buffer, start) {
|
|
|
2428
2414
|
var token = buffer.toString('latin1', start, tokenEnd);
|
|
2429
2415
|
var referenceEnd = readIndirectReferenceEnd(buffer, tokenEnd);
|
|
2430
2416
|
var result;
|
|
2431
|
-
if (referenceEnd
|
|
2417
|
+
if (referenceEnd != null) {
|
|
2432
2418
|
result = {
|
|
2433
2419
|
entry: {
|
|
2434
2420
|
type: 'ref',
|
package/mailgun/index.cjs.js
CHANGED
|
@@ -123,6 +123,7 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
123
123
|
*
|
|
124
124
|
* @param config - The conversion configuration containing the email request, default sender, and recipient variable settings.
|
|
125
125
|
* @returns The constructed {@link MailgunMessageData} ready to be sent via the Mailgun API.
|
|
126
|
+
* @throws {Error} When `batchSend` is enabled with `cc`/`bcc` set, when the recipient list exceeds {@link MAX_BATCH_SEND_RECIPIENTS}, or when attachments are supplied via both `messageData` and `request.attachments`.
|
|
126
127
|
*/ function convertMailgunTemplateEmailRequestToMailgunMessageData(config) {
|
|
127
128
|
var _ref, _ref1, _ref2, _ref3, _request_finalizeRecipientVariables, _request_batchSend;
|
|
128
129
|
var request = config.request, defaultSender = config.defaultSender, testEnvironment = config.isTestingEnvironment, tmp = config.recipientVariablePrefix, inputRecipientVariablePrefix = tmp === void 0 ? DEFAULT_RECIPIENT_VARIABLE_PREFIX : tmp, tmp1 = config.addRecipientVariablePrefixToAllMergedGlobalVariables, inputAddRecipientVariablePrefixToAllMergedGlobalVariables = tmp1 === void 0 ? true : tmp1, tmp2 = config.addCopyOfMergedRecipientVariablesWithoutPrefixToGlobalVariables, inputAddCopyOfMergedRecipientVariablesWithoutPrefixToGlobalVariables = tmp2 === void 0 ? false : tmp2, tmp3 = config.addCopyOfTemplateVariablesWithRecipientVariablePrefix, inputAddCopyOfTemplateVariablesWithRecipientVariablePrefix = tmp3 === void 0 ? false : tmp3;
|
|
@@ -279,8 +280,8 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
279
280
|
*
|
|
280
281
|
* Each recipient is formatted as "Name <email>" when a name is present, or just the email address.
|
|
281
282
|
*
|
|
282
|
-
* @param recipients -
|
|
283
|
-
* @returns
|
|
283
|
+
* @param recipients - Recipients to convert.
|
|
284
|
+
* @returns Formatted email address strings.
|
|
284
285
|
*/ function convertMailgunRecipientsToStrings(recipients) {
|
|
285
286
|
return recipients.map(function(x) {
|
|
286
287
|
return convertMailgunRecipientToString(x);
|
|
@@ -291,8 +292,8 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
291
292
|
*
|
|
292
293
|
* Returns "Name <email>" when a name is present, or just the email address otherwise.
|
|
293
294
|
*
|
|
294
|
-
* @param recipient -
|
|
295
|
-
* @returns
|
|
295
|
+
* @param recipient - The recipient to convert.
|
|
296
|
+
* @returns A formatted email participant string.
|
|
296
297
|
*/ function convertMailgunRecipientToString(recipient) {
|
|
297
298
|
var address = recipient.email;
|
|
298
299
|
if (recipient.name) {
|
|
@@ -303,8 +304,9 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
303
304
|
/**
|
|
304
305
|
* Encodes a value to a string for use as a Mailgun template variable. Throws an error if the value is not supported.
|
|
305
306
|
*
|
|
306
|
-
* @param value The value to encode.
|
|
307
|
+
* @param value - The value to encode.
|
|
307
308
|
* @returns The encoded value, or undefined if the value is null or undefined.
|
|
309
|
+
* @throws {Error} When `value` has an unsupported runtime type.
|
|
308
310
|
*/ function encodeMailgunTemplateVariableValue(value) {
|
|
309
311
|
var encodedValue;
|
|
310
312
|
switch(typeof value === "undefined" ? "undefined" : _type_of$1(value)){
|
|
@@ -780,9 +782,10 @@ var mailgunLogger = new common.Logger('MailgunServiceModule');
|
|
|
780
782
|
*
|
|
781
783
|
* Automatically switches to sandbox credentials when USE_MAILGUN_SANDBOX is true or the environment is a test environment.
|
|
782
784
|
*
|
|
783
|
-
* @param configService - NestJS config service for reading environment variables
|
|
784
|
-
* @param serverEnvironmentService -
|
|
785
|
-
* @returns
|
|
785
|
+
* @param configService - NestJS config service for reading environment variables.
|
|
786
|
+
* @param serverEnvironmentService - Service indicating the current server environment.
|
|
787
|
+
* @returns A validated MailgunServiceConfig.
|
|
788
|
+
* @throws {Error} When sandbox mode is requested without sandbox credentials, or when `MAILGUN_SENDER_EMAIL` / `MAILGUN_API_KEY` / `MAILGUN_DOMAIN` are missing.
|
|
786
789
|
*/ function mailgunServiceConfigFactory(configService, serverEnvironmentService) {
|
|
787
790
|
var _configService_get, _configService_get1, _configService_get2;
|
|
788
791
|
var isTestingEnv = serverEnvironmentService.isTestingEnv;
|
|
@@ -945,8 +948,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
945
948
|
/**
|
|
946
949
|
* Creates a composite key from the from/replyTo email addresses used to group MailgunRecipientBatchSendTarget values.
|
|
947
950
|
*
|
|
948
|
-
* @param recipient -
|
|
949
|
-
* @returns
|
|
951
|
+
* @param recipient - Batch send target whose from/replyTo addresses are used as the grouping key.
|
|
952
|
+
* @returns Composite key in the form "f:{fromEmail}|r:{replyToEmail}" used to group recipients into batches.
|
|
950
953
|
*/ function mailgunRecipientBatchSendTargetFromReplyToBatchGroupKey(recipient) {
|
|
951
954
|
var _ref, _ref1;
|
|
952
955
|
var _recipient_from, _recipient_replyTo;
|
|
@@ -957,8 +960,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
957
960
|
/**
|
|
958
961
|
* Creates a ExpandMailgunRecipientBatchSendTargetRequestFactory from the input config.
|
|
959
962
|
*
|
|
960
|
-
* @param config
|
|
961
|
-
* @returns
|
|
963
|
+
* @param config - Factory configuration providing the base request, recipient lookup, and per-recipient variable handling.
|
|
964
|
+
* @returns A factory that expands `MailgunRecipientBatchSendTarget` lists into individual `MailgunTemplateEmailRequest` objects.
|
|
965
|
+
* @throws {Error} When no subject is configured and `useSubjectFromRecipientUserVariables` is false.
|
|
962
966
|
*/ function expandMailgunRecipientBatchSendTargetRequestFactory(config) {
|
|
963
967
|
var _inputBaseRequest_from, _inputBaseRequest_replyTo;
|
|
964
968
|
var inputBaseRequest = config.request, useSubjectFromRecipientUserVariables = config.useSubjectFromRecipientUserVariables, allowSingleRecipientBatchSendRequests = config.allowSingleRecipientBatchSendRequests, recipientVariablesConfig = config.recipientVariablesConfig, mailgunRecipientBatchSendTargetEntityKeyRecipientLookup = config.mailgunRecipientBatchSendTargetEntityKeyRecipientLookup, overrideCarbonCopyVariablesWithCarbonCopyKeyRecipients = config.overrideCarbonCopyVariablesWithCarbonCopyKeyRecipients;
|
|
@@ -1097,7 +1101,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1097
1101
|
/**
|
|
1098
1102
|
* Creates a MailgunRecipientBatchSendTargetEntityKeyRecipientLookup given the input configuration.
|
|
1099
1103
|
*
|
|
1100
|
-
* @param config The configuration for the lookup.
|
|
1104
|
+
* @param config - The configuration for the lookup.
|
|
1101
1105
|
* @returns The lookup.
|
|
1102
1106
|
*/ function mailgunRecipientBatchSendTargetEntityKeyRecipientLookup(config) {
|
|
1103
1107
|
var recipientsMap = config.recipientsMap;
|
package/mailgun/index.esm.js
CHANGED
|
@@ -121,6 +121,7 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
121
121
|
*
|
|
122
122
|
* @param config - The conversion configuration containing the email request, default sender, and recipient variable settings.
|
|
123
123
|
* @returns The constructed {@link MailgunMessageData} ready to be sent via the Mailgun API.
|
|
124
|
+
* @throws {Error} When `batchSend` is enabled with `cc`/`bcc` set, when the recipient list exceeds {@link MAX_BATCH_SEND_RECIPIENTS}, or when attachments are supplied via both `messageData` and `request.attachments`.
|
|
124
125
|
*/ function convertMailgunTemplateEmailRequestToMailgunMessageData(config) {
|
|
125
126
|
var _ref, _ref1, _ref2, _ref3, _request_finalizeRecipientVariables, _request_batchSend;
|
|
126
127
|
var request = config.request, defaultSender = config.defaultSender, testEnvironment = config.isTestingEnvironment, tmp = config.recipientVariablePrefix, inputRecipientVariablePrefix = tmp === void 0 ? DEFAULT_RECIPIENT_VARIABLE_PREFIX : tmp, tmp1 = config.addRecipientVariablePrefixToAllMergedGlobalVariables, inputAddRecipientVariablePrefixToAllMergedGlobalVariables = tmp1 === void 0 ? true : tmp1, tmp2 = config.addCopyOfMergedRecipientVariablesWithoutPrefixToGlobalVariables, inputAddCopyOfMergedRecipientVariablesWithoutPrefixToGlobalVariables = tmp2 === void 0 ? false : tmp2, tmp3 = config.addCopyOfTemplateVariablesWithRecipientVariablePrefix, inputAddCopyOfTemplateVariablesWithRecipientVariablePrefix = tmp3 === void 0 ? false : tmp3;
|
|
@@ -277,8 +278,8 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
277
278
|
*
|
|
278
279
|
* Each recipient is formatted as "Name <email>" when a name is present, or just the email address.
|
|
279
280
|
*
|
|
280
|
-
* @param recipients -
|
|
281
|
-
* @returns
|
|
281
|
+
* @param recipients - Recipients to convert.
|
|
282
|
+
* @returns Formatted email address strings.
|
|
282
283
|
*/ function convertMailgunRecipientsToStrings(recipients) {
|
|
283
284
|
return recipients.map(function(x) {
|
|
284
285
|
return convertMailgunRecipientToString(x);
|
|
@@ -289,8 +290,8 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
289
290
|
*
|
|
290
291
|
* Returns "Name <email>" when a name is present, or just the email address otherwise.
|
|
291
292
|
*
|
|
292
|
-
* @param recipient -
|
|
293
|
-
* @returns
|
|
293
|
+
* @param recipient - The recipient to convert.
|
|
294
|
+
* @returns A formatted email participant string.
|
|
294
295
|
*/ function convertMailgunRecipientToString(recipient) {
|
|
295
296
|
var address = recipient.email;
|
|
296
297
|
if (recipient.name) {
|
|
@@ -301,8 +302,9 @@ var MAILGUN_REPLY_TO_EMAIL_HEADER_DATA_VARIABLE_KEY = "h:Reply-To";
|
|
|
301
302
|
/**
|
|
302
303
|
* Encodes a value to a string for use as a Mailgun template variable. Throws an error if the value is not supported.
|
|
303
304
|
*
|
|
304
|
-
* @param value The value to encode.
|
|
305
|
+
* @param value - The value to encode.
|
|
305
306
|
* @returns The encoded value, or undefined if the value is null or undefined.
|
|
307
|
+
* @throws {Error} When `value` has an unsupported runtime type.
|
|
306
308
|
*/ function encodeMailgunTemplateVariableValue(value) {
|
|
307
309
|
var encodedValue;
|
|
308
310
|
switch(typeof value === "undefined" ? "undefined" : _type_of$1(value)){
|
|
@@ -778,9 +780,10 @@ var mailgunLogger = new Logger('MailgunServiceModule');
|
|
|
778
780
|
*
|
|
779
781
|
* Automatically switches to sandbox credentials when USE_MAILGUN_SANDBOX is true or the environment is a test environment.
|
|
780
782
|
*
|
|
781
|
-
* @param configService - NestJS config service for reading environment variables
|
|
782
|
-
* @param serverEnvironmentService -
|
|
783
|
-
* @returns
|
|
783
|
+
* @param configService - NestJS config service for reading environment variables.
|
|
784
|
+
* @param serverEnvironmentService - Service indicating the current server environment.
|
|
785
|
+
* @returns A validated MailgunServiceConfig.
|
|
786
|
+
* @throws {Error} When sandbox mode is requested without sandbox credentials, or when `MAILGUN_SENDER_EMAIL` / `MAILGUN_API_KEY` / `MAILGUN_DOMAIN` are missing.
|
|
784
787
|
*/ function mailgunServiceConfigFactory(configService, serverEnvironmentService) {
|
|
785
788
|
var _configService_get, _configService_get1, _configService_get2;
|
|
786
789
|
var isTestingEnv = serverEnvironmentService.isTestingEnv;
|
|
@@ -943,8 +946,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
943
946
|
/**
|
|
944
947
|
* Creates a composite key from the from/replyTo email addresses used to group MailgunRecipientBatchSendTarget values.
|
|
945
948
|
*
|
|
946
|
-
* @param recipient -
|
|
947
|
-
* @returns
|
|
949
|
+
* @param recipient - Batch send target whose from/replyTo addresses are used as the grouping key.
|
|
950
|
+
* @returns Composite key in the form "f:{fromEmail}|r:{replyToEmail}" used to group recipients into batches.
|
|
948
951
|
*/ function mailgunRecipientBatchSendTargetFromReplyToBatchGroupKey(recipient) {
|
|
949
952
|
var _ref, _ref1;
|
|
950
953
|
var _recipient_from, _recipient_replyTo;
|
|
@@ -955,8 +958,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
955
958
|
/**
|
|
956
959
|
* Creates a ExpandMailgunRecipientBatchSendTargetRequestFactory from the input config.
|
|
957
960
|
*
|
|
958
|
-
* @param config
|
|
959
|
-
* @returns
|
|
961
|
+
* @param config - Factory configuration providing the base request, recipient lookup, and per-recipient variable handling.
|
|
962
|
+
* @returns A factory that expands `MailgunRecipientBatchSendTarget` lists into individual `MailgunTemplateEmailRequest` objects.
|
|
963
|
+
* @throws {Error} When no subject is configured and `useSubjectFromRecipientUserVariables` is false.
|
|
960
964
|
*/ function expandMailgunRecipientBatchSendTargetRequestFactory(config) {
|
|
961
965
|
var _inputBaseRequest_from, _inputBaseRequest_replyTo;
|
|
962
966
|
var inputBaseRequest = config.request, useSubjectFromRecipientUserVariables = config.useSubjectFromRecipientUserVariables, allowSingleRecipientBatchSendRequests = config.allowSingleRecipientBatchSendRequests, recipientVariablesConfig = config.recipientVariablesConfig, mailgunRecipientBatchSendTargetEntityKeyRecipientLookup = config.mailgunRecipientBatchSendTargetEntityKeyRecipientLookup, overrideCarbonCopyVariablesWithCarbonCopyKeyRecipients = config.overrideCarbonCopyVariablesWithCarbonCopyKeyRecipients;
|
|
@@ -1095,7 +1099,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1095
1099
|
/**
|
|
1096
1100
|
* Creates a MailgunRecipientBatchSendTargetEntityKeyRecipientLookup given the input configuration.
|
|
1097
1101
|
*
|
|
1098
|
-
* @param config The configuration for the lookup.
|
|
1102
|
+
* @param config - The configuration for the lookup.
|
|
1099
1103
|
* @returns The lookup.
|
|
1100
1104
|
*/ function mailgunRecipientBatchSendTargetEntityKeyRecipientLookup(config) {
|
|
1101
1105
|
var recipientsMap = config.recipientsMap;
|
package/mailgun/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/mailgun",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.15",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.11.
|
|
6
|
-
"@dereekb/model": "13.11.
|
|
7
|
-
"@dereekb/nestjs": "13.11.
|
|
8
|
-
"@dereekb/rxjs": "13.11.
|
|
9
|
-
"@dereekb/util": "13.11.
|
|
5
|
+
"@dereekb/date": "13.11.15",
|
|
6
|
+
"@dereekb/model": "13.11.15",
|
|
7
|
+
"@dereekb/nestjs": "13.11.15",
|
|
8
|
+
"@dereekb/rxjs": "13.11.15",
|
|
9
|
+
"@dereekb/util": "13.11.15",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"form-data": "^4.0.5",
|