@dereekb/nestjs 13.11.14 → 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.
Files changed (65) hide show
  1. package/discord/index.cjs.js +37 -34
  2. package/discord/index.esm.js +36 -33
  3. package/discord/package.json +4 -4
  4. package/discord/src/lib/discord.api.d.ts +6 -6
  5. package/discord/src/lib/discord.api.page.d.ts +4 -4
  6. package/discord/src/lib/discord.config.d.ts +2 -2
  7. package/discord/src/lib/discord.module.d.ts +2 -2
  8. package/discord/src/lib/discord.util.d.ts +3 -3
  9. package/discord/src/lib/webhook/webhook.discord.d.ts +2 -2
  10. package/discord/src/lib/webhook/webhook.discord.module.d.ts +2 -2
  11. package/discord/src/lib/webhook/webhook.discord.verify.d.ts +2 -2
  12. package/eslint/index.cjs.js +142 -145
  13. package/eslint/index.esm.js +141 -144
  14. package/eslint/package.json +4 -4
  15. package/eslint/src/lib/index.d.ts +2 -2
  16. package/eslint/src/lib/plugin.d.ts +1 -1
  17. package/eslint/src/lib/require-inject.rule.d.ts +1 -1
  18. package/index.cjs.js +98 -112
  19. package/index.esm.js +98 -112
  20. package/mailgun/index.cjs.js +17 -13
  21. package/mailgun/index.esm.js +17 -13
  22. package/mailgun/package.json +6 -6
  23. package/mailgun/src/lib/mailgun.d.ts +7 -5
  24. package/mailgun/src/lib/mailgun.service.module.d.ts +4 -3
  25. package/mailgun/src/lib/mailgun.util.d.ts +6 -5
  26. package/openai/index.cjs.js +9 -9
  27. package/openai/index.esm.js +9 -9
  28. package/openai/package.json +6 -6
  29. package/openai/src/lib/openai.module.d.ts +2 -2
  30. package/openai/src/lib/openai.util.d.ts +3 -3
  31. package/openai/src/lib/webhook/webhook.openai.module.d.ts +2 -2
  32. package/openai/src/lib/webhook/webhook.openai.verify.d.ts +2 -2
  33. package/package.json +5 -5
  34. package/src/lib/asset/asset.loader.node.d.ts +3 -3
  35. package/src/lib/asset/asset.nest.d.ts +6 -5
  36. package/src/lib/decorators/local.decorator.d.ts +2 -2
  37. package/src/lib/decorators/rawbody.d.ts +7 -7
  38. package/src/lib/module/client/client.config.d.ts +2 -2
  39. package/src/lib/module/client/client.module.d.ts +3 -2
  40. package/src/lib/module/env/env.d.ts +1 -1
  41. package/src/lib/module/env/env.nest.d.ts +2 -2
  42. package/src/lib/module/module.d.ts +5 -5
  43. package/src/lib/util/encryption/json.encrypt.d.ts +18 -16
  44. package/src/lib/util/file/file.json.d.ts +2 -2
  45. package/src/lib/util/pdf/pdf.encryption.d.ts +3 -3
  46. package/stripe/index.cjs.js +13 -13
  47. package/stripe/index.esm.js +13 -13
  48. package/stripe/package.json +6 -6
  49. package/stripe/src/lib/stripe.api.d.ts +4 -4
  50. package/stripe/src/lib/stripe.module.d.ts +3 -3
  51. package/stripe/src/lib/webhook/webhook.stripe.d.ts +4 -4
  52. package/typeform/index.cjs.js +12 -12
  53. package/typeform/index.esm.js +12 -12
  54. package/typeform/package.json +6 -6
  55. package/typeform/src/lib/typeform.module.d.ts +2 -2
  56. package/typeform/src/lib/typeform.util.d.ts +2 -2
  57. package/typeform/src/lib/webhook/webhook.typeform.form.d.ts +4 -4
  58. package/typeform/src/lib/webhook/webhook.typeform.module.d.ts +2 -2
  59. package/typeform/src/lib/webhook/webhook.typeform.verify.d.ts +2 -2
  60. package/vapiai/index.cjs.js +6 -6
  61. package/vapiai/index.esm.js +6 -6
  62. package/vapiai/package.json +6 -6
  63. package/vapiai/src/lib/vapiai.module.d.ts +2 -2
  64. package/vapiai/src/lib/webhook/webhook.vapiai.module.d.ts +2 -2
  65. package/vapiai/src/lib/webhook/webhook.vapiai.verify.d.ts +2 -2
package/index.cjs.js CHANGED
@@ -148,6 +148,9 @@ function _ts_generator$2(thisArg, body) {
148
148
  * The ref's {@link AssetLocalPathRef.path} is resolved relative
149
149
  * to the configured {@link NodeJsLocalAssetLoaderConfig.basePath}.
150
150
  *
151
+ * @param config - Filesystem configuration with base path.
152
+ * @returns An {@link AssetLoader} backed by the local filesystem.
153
+ *
151
154
  * @example
152
155
  * ```ts
153
156
  * const loader = nodeJsLocalAssetLoader({ basePath: './assets' });
@@ -155,9 +158,6 @@ function _ts_generator$2(thisArg, body) {
155
158
  * // reads from ./assets/data/districts.json
156
159
  * });
157
160
  * ```
158
- *
159
- * @param config - Filesystem configuration with base path.
160
- * @returns An {@link AssetLoader} backed by the local filesystem.
161
161
  */ function nodeJsLocalAssetLoader(config) {
162
162
  var basePath = config.basePath;
163
163
  var getFn = function getFn(ref) {
@@ -192,16 +192,17 @@ function _ts_generator$2(thisArg, body) {
192
192
  * Local assets are loaded from the filesystem. Remote assets (which always
193
193
  * have absolute URLs) are loaded via `fetch`.
194
194
  *
195
- * @example
196
- * ```ts
197
- * @Module(appAssetLoaderModuleMetadata({
195
+ * @param config - Local filesystem config and optional remote fetch config.
196
+ * @returns NestJS {@link ModuleMetadata} that provides an {@link AssetLoader}.
197
+ *
198
+ * @Module (appAssetLoaderModuleMetadata({
198
199
  * local: { basePath: './assets' }
199
200
  * }))
200
201
  * export class AppAssetLoaderModule {}
201
202
  * ```
202
203
  *
203
- * @param config - Local filesystem config and optional remote fetch config.
204
- * @returns NestJS {@link ModuleMetadata} that provides an {@link AssetLoader}.
204
+ * @example
205
+ * ```ts
205
206
  */ function appAssetLoaderModuleMetadata(config) {
206
207
  var local = nodeJsLocalAssetLoader(config.local);
207
208
  var remote = rxjs.fetchAssetLoader(config.remote);
@@ -233,8 +234,8 @@ function _ts_generator$2(thisArg, body) {
233
234
  *
234
235
  * Checks for both http://localhost and https://localhost origins.
235
236
  *
236
- * @param context - the NestJS execution context containing the HTTP request
237
- * @returns true if the request origin is localhost
237
+ * @param context - The NestJS execution context containing the HTTP request.
238
+ * @returns True if the request origin is localhost.
238
239
  */ function isLocalhost(context) {
239
240
  var _req_headers_origin;
240
241
  var req = context.switchToHttp().getRequest();
@@ -385,26 +386,17 @@ function _ts_generator$1(thisArg, body) {
385
386
  */ var rawBodyLogger = new common.Logger('RawBody');
386
387
  var ParseRawBody = common.createParamDecorator(function(_, context) {
387
388
  return _async_to_generator$1(function() {
388
- var req, body;
389
+ var req;
389
390
  return _ts_generator$1(this, function(_state) {
390
- switch(_state.label){
391
- case 0:
392
- req = context.switchToHttp().getRequest();
393
- if (!req.readable) {
394
- rawBodyLogger.error('RawBody request was not readable. This is generally due to bad configuration.');
395
- throw new common.BadRequestException('Invalid body');
396
- }
397
- return [
398
- 4,
399
- rawbody(req)
400
- ];
401
- case 1:
402
- body = _state.sent();
403
- return [
404
- 2,
405
- body
406
- ];
391
+ req = context.switchToHttp().getRequest();
392
+ if (!req.readable) {
393
+ rawBodyLogger.error('RawBody request was not readable. This is generally due to bad configuration.');
394
+ throw new common.BadRequestException('Invalid body');
407
395
  }
396
+ return [
397
+ 2,
398
+ rawbody(req)
399
+ ];
408
400
  });
409
401
  })();
410
402
  });
@@ -462,9 +454,9 @@ var ParseRawBody = common.createParamDecorator(function(_, context) {
462
454
  /**
463
455
  * Parses a raw body buffer as JSON.
464
456
  *
465
- * @param rawBody - The raw body buffer to parse
466
- * @returns The parsed JSON object
467
- * @throws {SyntaxError} When the body is not valid JSON
457
+ * @param rawBody - The raw body buffer to parse.
458
+ * @returns The parsed JSON object.
459
+ * @throws {SyntaxError} When the body is not valid JSON.
468
460
  *
469
461
  * @example
470
462
  * ```typescript
@@ -477,8 +469,8 @@ var ParseRawBody = common.createParamDecorator(function(_, context) {
477
469
  /**
478
470
  * Parses a raw body buffer as a URL-encoded query string.
479
471
  *
480
- * @param rawBody - The raw body buffer to parse
481
- * @returns The parsed query parameters
472
+ * @param rawBody - The raw body buffer to parse.
473
+ * @returns The parsed query parameters.
482
474
  *
483
475
  * @example
484
476
  * ```typescript
@@ -491,8 +483,8 @@ var ParseRawBody = common.createParamDecorator(function(_, context) {
491
483
  /**
492
484
  * Converts a raw body buffer to a trimmed UTF-8 string.
493
485
  *
494
- * @param rawBody - The raw body buffer to convert
495
- * @returns The decoded and trimmed string content
486
+ * @param rawBody - The raw body buffer to convert.
487
+ * @returns The decoded and trimmed string content.
496
488
  *
497
489
  * @example
498
490
  * ```typescript
@@ -779,9 +771,9 @@ function _type_of(obj) {
779
771
  /**
780
772
  * Merges two module metadata entries together.
781
773
  *
782
- * @param base - the base module metadata
783
- * @param additional - additional metadata to merge in
784
- * @returns the merged module metadata
774
+ * @param base - The base module metadata.
775
+ * @param additional - Additional metadata to merge in.
776
+ * @returns The merged module metadata.
785
777
  */ function mergeModuleMetadata(base) {
786
778
  var additional = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
787
779
  return {
@@ -808,8 +800,8 @@ function _type_of(obj) {
808
800
  *
809
801
  * For class providers, returns the class itself; for object providers, returns the provide token.
810
802
  *
811
- * @param providers - the providers to extract tokens from
812
- * @returns an array of injection tokens
803
+ * @param providers - Providers to extract tokens from.
804
+ * @returns Injection tokens collected from each provider.
813
805
  */ function injectionTokensFromProviders(providers) {
814
806
  return util.asArray(providers).map(function(x) {
815
807
  return (typeof x === "undefined" ? "undefined" : _type_of(x)) === 'object' ? x.provide : x;
@@ -866,8 +858,8 @@ function _define_property$3(obj, key, value) {
866
858
  value: /**
867
859
  * Validates that the configuration contains a non-empty client web app URL.
868
860
  *
869
- * @param config - The configuration to validate
870
- * @throws {Error} When `clientWebAppUrl` is not specified
861
+ * @param config - The configuration to validate.
862
+ * @throws {Error} When `clientWebAppUrl` is not specified.
871
863
  */ function assertValidConfig(config) {
872
864
  if (!config.client.clientWebAppUrl) {
873
865
  throw new Error('No client app url specified.');
@@ -955,8 +947,9 @@ function _class_call_check$2(instance, Constructor) {
955
947
  *
956
948
  * Reads the client web app URL from the CLIENT_WEB_APP_URL environment variable.
957
949
  *
958
- * @param configService - NestJS config service for reading environment variables
959
- * @returns a validated ClientAppServiceConfig
950
+ * @param configService - NestJS config service for reading environment variables.
951
+ * @returns A validated ClientAppServiceConfig.
952
+ *
960
953
  * @__NO_SIDE_EFFECTS__
961
954
  */ function clientAppConfigFactory(configService) {
962
955
  var config = {
@@ -1020,8 +1013,8 @@ function _class_call_check$1(instance, Constructor) {
1020
1013
  *
1021
1014
  * Use this to register a server environment configuration instance with the NestJS dependency injection container.
1022
1015
  *
1023
- * @param env - the server environment config to provide
1024
- * @returns a NestJS Provider that supplies the config under SERVER_ENV_TOKEN
1016
+ * @param env - The server environment config to provide.
1017
+ * @returns A NestJS Provider that supplies the config under SERVER_ENV_TOKEN.
1025
1018
  */ function serverEnvTokenProvider(env) {
1026
1019
  return {
1027
1020
  provide: SERVER_ENV_TOKEN,
@@ -1032,7 +1025,7 @@ function _class_call_check$1(instance, Constructor) {
1032
1025
  /**
1033
1026
  * Checks process.env.NODE_ENV for "test".
1034
1027
  *
1035
- * @returns true if the current Node environment is "test", false otherwise
1028
+ * @returns True if the current Node environment is "test", false otherwise.
1036
1029
  */ function isTestNodeEnv() {
1037
1030
  return process.env['NODE_ENV'] === 'test';
1038
1031
  }
@@ -1159,7 +1152,7 @@ exports.ServerEnvironmentService = __decorate([
1159
1152
  * @param input.dirPath - Absolute path to the parent directory; created (recursively) when missing.
1160
1153
  * @param input.data - Value to serialize as JSON (pretty-printed with two-space indentation).
1161
1154
  * @param input.mode - Optional numeric file mode (e.g. `0o600`) applied via `chmod` after the write.
1162
- * @returns A promise that resolves once the JSON has been written and the optional `chmod` has completed.
1155
+ * @returns Resolves once the JSON has been written and the optional `chmod` has completed.
1163
1156
  */ function writeJsonFile(input) {
1164
1157
  node_fs.mkdirSync(input.dirPath, {
1165
1158
  recursive: true
@@ -1170,16 +1163,14 @@ exports.ServerEnvironmentService = __decorate([
1170
1163
  }, function(err) {
1171
1164
  if (err) {
1172
1165
  reject(err);
1173
- return;
1174
- }
1175
- if (input.mode == null) {
1166
+ } else if (input.mode == null) {
1176
1167
  resolve();
1177
- return;
1168
+ } else {
1169
+ node_fs.chmod(input.filePath, input.mode, function(chmodErr) {
1170
+ if (chmodErr) reject(chmodErr);
1171
+ else resolve();
1172
+ });
1178
1173
  }
1179
- node_fs.chmod(input.filePath, input.mode, function(chmodErr) {
1180
- if (chmodErr) reject(chmodErr);
1181
- else resolve();
1182
- });
1183
1174
  });
1184
1175
  });
1185
1176
  }
@@ -1191,7 +1182,7 @@ exports.ServerEnvironmentService = __decorate([
1191
1182
  * swallowing them masks real failures and makes operations appear to have succeeded.
1192
1183
  *
1193
1184
  * @param filePath - Absolute path to the file to remove.
1194
- * @returns A promise that resolves once the file is removed (or was already absent).
1185
+ * @returns Resolves once the file is removed (or was already absent).
1195
1186
  */ function removeFile(filePath) {
1196
1187
  return promises$1.rm(filePath, {
1197
1188
  force: true
@@ -1448,7 +1439,7 @@ function _ts_generator(thisArg, body) {
1448
1439
  return {
1449
1440
  load: function load() {
1450
1441
  return _async_to_generator(function() {
1451
- var raw;
1442
+ var raw, result;
1452
1443
  return _ts_generator(this, function(_state) {
1453
1444
  switch(_state.label){
1454
1445
  case 0:
@@ -1459,14 +1450,13 @@ function _ts_generator(thisArg, body) {
1459
1450
  case 1:
1460
1451
  raw = _state.sent();
1461
1452
  if (raw == null) {
1462
- return [
1463
- 2,
1464
- undefined
1465
- ];
1453
+ result = undefined;
1454
+ } else {
1455
+ result = reviver == null ? raw : reviver(raw);
1466
1456
  }
1467
1457
  return [
1468
1458
  2,
1469
- reviver == null ? raw : reviver(raw)
1459
+ result
1470
1460
  ];
1471
1461
  }
1472
1462
  });
@@ -1562,38 +1552,32 @@ function _ts_generator(thisArg, body) {
1562
1552
  case 1:
1563
1553
  raw = _state.sent();
1564
1554
  if (raw == null) {
1565
- return [
1566
- 2,
1567
- {}
1568
- ];
1569
- }
1570
- if (reviver == null) {
1571
- return [
1572
- 2,
1573
- raw
1574
- ];
1575
- }
1576
- result = {};
1577
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1578
- try {
1579
- for(_iterator = Object.keys(raw)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1580
- key = _step.value;
1581
- revived = reviver(raw[key]);
1582
- if (revived != null) {
1583
- result[key] = revived;
1584
- }
1585
- }
1586
- } catch (err) {
1587
- _didIteratorError = true;
1588
- _iteratorError = err;
1589
- } finally{
1555
+ result = {};
1556
+ } else if (reviver == null) {
1557
+ result = raw;
1558
+ } else {
1559
+ result = {};
1560
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1590
1561
  try {
1591
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1592
- _iterator.return();
1562
+ for(_iterator = Object.keys(raw)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1563
+ key = _step.value;
1564
+ revived = reviver(raw[key]);
1565
+ if (revived != null) {
1566
+ result[key] = revived;
1567
+ }
1593
1568
  }
1569
+ } catch (err) {
1570
+ _didIteratorError = true;
1571
+ _iteratorError = err;
1594
1572
  } finally{
1595
- if (_didIteratorError) {
1596
- throw _iteratorError;
1573
+ try {
1574
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1575
+ _iterator.return();
1576
+ }
1577
+ } finally{
1578
+ if (_didIteratorError) {
1579
+ throw _iteratorError;
1580
+ }
1597
1581
  }
1598
1582
  }
1599
1583
  }
@@ -1766,8 +1750,8 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1766
1750
  /**
1767
1751
  * Validates that the given secret is a 64-character hexadecimal string (32 bytes for AES-256).
1768
1752
  *
1769
- * @param secret - the hex-encoded secret key string to validate
1770
- * @returns true if the secret is exactly 64 valid hex characters, false otherwise
1753
+ * @param secret - The hex-encoded secret key string to validate.
1754
+ * @returns True if the secret is exactly 64 valid hex characters, false otherwise.
1771
1755
  *
1772
1756
  * @example
1773
1757
  * ```typescript
@@ -1784,15 +1768,15 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1784
1768
  * The getter is called immediately and the key is validated on creation. The returned
1785
1769
  * function provides the resolved Buffer without re-resolving or re-validating.
1786
1770
  *
1771
+ * @param source - The secret source configuration.
1772
+ * @returns A getter that returns the resolved 32-byte Buffer for AES-256 encryption.
1773
+ * @throws {Error} When the resolved key is not 64 hex characters.
1774
+ *
1787
1775
  * @example
1788
1776
  * ```typescript
1789
1777
  * const getKey = resolveEncryptionKey('a'.repeat(64));
1790
1778
  * const key: Buffer = getKey();
1791
1779
  * ```
1792
- *
1793
- * @param source - The secret source configuration.
1794
- * @returns A getter that returns the resolved 32-byte Buffer for AES-256 encryption.
1795
- * @throws Error if the resolved key is not 64 hex characters.
1796
1780
  */ function resolveEncryptionKey(source) {
1797
1781
  var hex = util.getValueFromGetter(source);
1798
1782
  if (!isValidAES256GCMEncryptionSecret(hex)) {
@@ -1806,6 +1790,10 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1806
1790
  /**
1807
1791
  * Creates an `AES256GCMEncryption` instance that captures the resolved key in a closure.
1808
1792
  *
1793
+ * @param source - The hex-encoded secret or getter for the AES-256 key.
1794
+ * @returns An `AES256GCMEncryption` instance.
1795
+ * @throws {Error} When the resolved key is not 64 hex characters.
1796
+ *
1809
1797
  * @example
1810
1798
  * ```typescript
1811
1799
  * const encryption = createAES256GCMEncryption('a'.repeat(64));
@@ -1818,9 +1806,6 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1818
1806
  * // decryptedStr === 'hello'
1819
1807
  * ```
1820
1808
  *
1821
- * @param source - The hex-encoded secret or getter for the AES-256 key.
1822
- * @returns An `AES256GCMEncryption` instance.
1823
- * @throws Error if the resolved key is not 64 hex characters.
1824
1809
  * @__NO_SIDE_EFFECTS__
1825
1810
  */ function createAES256GCMEncryption(source) {
1826
1811
  var getKey = resolveEncryptionKey(source);
@@ -1872,16 +1857,16 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1872
1857
  *
1873
1858
  * Format: base64(IV (12 bytes) + ciphertext + authTag (16 bytes))
1874
1859
  *
1860
+ * @param value - The value to encrypt (must be JSON-serializable).
1861
+ * @param key - The 32-byte encryption key from `resolveEncryptionKey()`.
1862
+ * @returns The encrypted value as a base64 string.
1863
+ *
1875
1864
  * @example
1876
1865
  * ```typescript
1877
1866
  * const getKey = resolveEncryptionKey(mySecret);
1878
1867
  * const encrypted = encryptValue({ sensitive: 'data' }, getKey());
1879
1868
  * const decrypted = decryptValue<{ sensitive: string }>(encrypted, getKey());
1880
1869
  * ```
1881
- *
1882
- * @param value - The value to encrypt (must be JSON-serializable).
1883
- * @param key - The 32-byte encryption key from `resolveEncryptionKey()`.
1884
- * @returns The encrypted value as a base64 string.
1885
1870
  */ function encryptValue(value, key) {
1886
1871
  var iv = node_crypto.randomBytes(ENCRYPTED_FIELD_IV_LENGTH);
1887
1872
  var cipher = node_crypto.createCipheriv(ENCRYPTED_FIELD_ALGORITHM, key, iv);
@@ -1924,6 +1909,10 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1924
1909
  * The key is resolved and validated eagerly at creation time. The provider encrypts/decrypts
1925
1910
  * raw strings (no JSON serialization) — suitable for use with `selectiveFieldEncryptor`.
1926
1911
  *
1912
+ * @param source - The hex-encoded secret or getter for the AES-256 key.
1913
+ * @returns A `StringEncryptionProvider` that encrypts/decrypts strings via AES-256-GCM.
1914
+ * @throws {Error} When the resolved key is not 64 hex characters.
1915
+ *
1927
1916
  * @example
1928
1917
  * ```typescript
1929
1918
  * const provider = createAesStringEncryptionProvider('a'.repeat(64));
@@ -1932,9 +1921,6 @@ var ENCRYPTED_FIELD_KEY_LENGTH = 32;
1932
1921
  * // decrypted === 'sensitive data'
1933
1922
  * ```
1934
1923
  *
1935
- * @param source - The hex-encoded secret or getter for the AES-256 key.
1936
- * @returns A `StringEncryptionProvider` that encrypts/decrypts strings via AES-256-GCM.
1937
- * @throws Error if the resolved key is not 64 hex characters.
1938
1924
  * @__NO_SIDE_EFFECTS__
1939
1925
  */ function createAesStringEncryptionProvider(source) {
1940
1926
  var encryption = createAES256GCMEncryption(source);
@@ -2077,6 +2063,9 @@ function _templateObject() {
2077
2063
  * Lives in `@dereekb/nestjs` (rather than `@dereekb/util`) because it uses Node's
2078
2064
  * built-in `node:crypto` module, which isn't available in the browser.
2079
2065
  *
2066
+ * @param buffer - PDF file contents.
2067
+ * @returns The encryption status of the PDF.
2068
+ *
2080
2069
  * @example
2081
2070
  * ```ts
2082
2071
  * const status = detectPdfEncryption(buffer);
@@ -2088,9 +2077,6 @@ function _templateObject() {
2088
2077
  * // Safe to read, but not to mutate without the owner password.
2089
2078
  * }
2090
2079
  * ```
2091
- *
2092
- * @param buffer - PDF file contents.
2093
- * @returns The encryption status of the PDF.
2094
2080
  */ function detectPdfEncryption(buffer) {
2095
2081
  var result = 'unknown_encrypted';
2096
2082
  var encryptIndex = findEncryptKeywordIndex(buffer);
@@ -2430,7 +2416,7 @@ function readPdfTokenOrRefValue(buffer, start) {
2430
2416
  var token = buffer.toString('latin1', start, tokenEnd);
2431
2417
  var referenceEnd = readIndirectReferenceEnd(buffer, tokenEnd);
2432
2418
  var result;
2433
- if (referenceEnd !== null) {
2419
+ if (referenceEnd != null) {
2434
2420
  result = {
2435
2421
  entry: {
2436
2422
  type: 'ref',