@venizia/ignis-helpers 0.4.7-1 → 0.4.7-3

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 (104) hide show
  1. package/README.md +3 -3
  2. package/dist/esm/core.d.ts +4 -2
  3. package/dist/esm/core.d.ts.map +1 -1
  4. package/dist/esm/core.js +9 -3
  5. package/dist/esm/core.js.map +1 -1
  6. package/dist/esm/modules/base.d.ts +1 -1
  7. package/dist/esm/modules/base.d.ts.map +1 -1
  8. package/dist/esm/modules/base.js +14 -5
  9. package/dist/esm/modules/base.js.map +1 -1
  10. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.d.ts +22 -0
  11. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.d.ts.map +1 -0
  12. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.js +10 -0
  13. package/dist/esm/modules/crypto/algorithms/abstract.algorithm.js.map +1 -0
  14. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.d.ts +7 -6
  15. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.d.ts.map +1 -1
  16. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js +32 -38
  17. package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js.map +1 -1
  18. package/dist/esm/modules/crypto/algorithms/aes.algorithm.d.ts +9 -8
  19. package/dist/esm/modules/crypto/algorithms/aes.algorithm.d.ts.map +1 -1
  20. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js +46 -41
  21. package/dist/esm/modules/crypto/algorithms/aes.algorithm.js.map +1 -1
  22. package/dist/esm/modules/crypto/algorithms/aes.engine.d.ts +32 -0
  23. package/dist/esm/modules/crypto/algorithms/aes.engine.d.ts.map +1 -0
  24. package/dist/esm/modules/crypto/algorithms/aes.engine.js +76 -0
  25. package/dist/esm/modules/crypto/algorithms/aes.engine.js.map +1 -0
  26. package/dist/esm/modules/crypto/algorithms/base.algorithm.d.ts +10 -17
  27. package/dist/esm/modules/crypto/algorithms/base.algorithm.d.ts.map +1 -1
  28. package/dist/esm/modules/crypto/algorithms/base.algorithm.js +51 -12
  29. package/dist/esm/modules/crypto/algorithms/base.algorithm.js.map +1 -1
  30. package/dist/esm/modules/crypto/algorithms/credential.algorithm.d.ts +37 -0
  31. package/dist/esm/modules/crypto/algorithms/credential.algorithm.d.ts.map +1 -0
  32. package/dist/esm/modules/crypto/algorithms/credential.algorithm.js +95 -0
  33. package/dist/esm/modules/crypto/algorithms/credential.algorithm.js.map +1 -0
  34. package/dist/esm/modules/crypto/algorithms/ecdh.algorithm.d.ts +6 -2
  35. package/dist/esm/modules/crypto/algorithms/ecdh.algorithm.d.ts.map +1 -1
  36. package/dist/esm/modules/crypto/algorithms/ecdh.algorithm.js +18 -5
  37. package/dist/esm/modules/crypto/algorithms/ecdh.algorithm.js.map +1 -1
  38. package/dist/esm/modules/crypto/algorithms/hash.algorithm.d.ts +15 -5
  39. package/dist/esm/modules/crypto/algorithms/hash.algorithm.d.ts.map +1 -1
  40. package/dist/esm/modules/crypto/algorithms/hash.algorithm.js +17 -6
  41. package/dist/esm/modules/crypto/algorithms/hash.algorithm.js.map +1 -1
  42. package/dist/esm/modules/crypto/algorithms/index.d.ts +1 -0
  43. package/dist/esm/modules/crypto/algorithms/index.d.ts.map +1 -1
  44. package/dist/esm/modules/crypto/algorithms/index.js +1 -0
  45. package/dist/esm/modules/crypto/algorithms/index.js.map +1 -1
  46. package/dist/esm/modules/crypto/algorithms/rsa.algorithm.d.ts +8 -7
  47. package/dist/esm/modules/crypto/algorithms/rsa.algorithm.d.ts.map +1 -1
  48. package/dist/esm/modules/crypto/algorithms/rsa.algorithm.js +22 -25
  49. package/dist/esm/modules/crypto/algorithms/rsa.algorithm.js.map +1 -1
  50. package/dist/esm/modules/crypto/common/types.d.ts +3 -3
  51. package/dist/esm/modules/crypto/common/types.d.ts.map +1 -1
  52. package/dist/esm/modules/crypto/common/types.js.map +1 -1
  53. package/dist/esm/modules/logger/base/base.d.ts.map +1 -1
  54. package/dist/esm/modules/logger/base/base.js +3 -3
  55. package/dist/esm/modules/logger/base/base.js.map +1 -1
  56. package/dist/esm/modules/logger/base/console.d.ts +9 -4
  57. package/dist/esm/modules/logger/base/console.d.ts.map +1 -1
  58. package/dist/esm/modules/logger/base/console.js +15 -4
  59. package/dist/esm/modules/logger/base/console.js.map +1 -1
  60. package/dist/esm/modules/logger/common/constants.d.ts +0 -1
  61. package/dist/esm/modules/logger/common/constants.d.ts.map +1 -1
  62. package/dist/esm/modules/logger/common/constants.js +0 -6
  63. package/dist/esm/modules/logger/common/constants.js.map +1 -1
  64. package/dist/esm/modules/logger/common/debug-gate.d.ts +33 -0
  65. package/dist/esm/modules/logger/common/debug-gate.d.ts.map +1 -0
  66. package/dist/esm/modules/logger/common/debug-gate.js +51 -0
  67. package/dist/esm/modules/logger/common/debug-gate.js.map +1 -0
  68. package/dist/esm/modules/logger/common/index.d.ts +1 -0
  69. package/dist/esm/modules/logger/common/index.d.ts.map +1 -1
  70. package/dist/esm/modules/logger/common/index.js +1 -0
  71. package/dist/esm/modules/logger/common/index.js.map +1 -1
  72. package/dist/esm/modules/logger/common/types.d.ts +7 -0
  73. package/dist/esm/modules/logger/common/types.d.ts.map +1 -1
  74. package/dist/esm/modules/logger/common/types.js +16 -0
  75. package/dist/esm/modules/logger/common/types.js.map +1 -1
  76. package/dist/esm/modules/logger/factory.d.ts +29 -12
  77. package/dist/esm/modules/logger/factory.d.ts.map +1 -1
  78. package/dist/esm/modules/logger/factory.js +108 -50
  79. package/dist/esm/modules/logger/factory.js.map +1 -1
  80. package/dist/esm/modules/logger/hf/logger.d.ts.map +1 -1
  81. package/dist/esm/modules/logger/hf/logger.js +3 -3
  82. package/dist/esm/modules/logger/hf/logger.js.map +1 -1
  83. package/dist/esm/modules/logger/index.d.ts +0 -1
  84. package/dist/esm/modules/logger/index.d.ts.map +1 -1
  85. package/dist/esm/modules/logger/index.js +0 -1
  86. package/dist/esm/modules/logger/index.js.map +1 -1
  87. package/dist/esm/modules/uid/uuid/sha1.d.ts +1 -1
  88. package/dist/esm/modules/uid/uuid/sha1.js +1 -1
  89. package/dist/esm/modules/uid/uuid/sha1.js.map +1 -1
  90. package/dist/esm/utilities/module.utility.d.ts.map +1 -1
  91. package/dist/esm/utilities/module.utility.js +1 -0
  92. package/dist/esm/utilities/module.utility.js.map +1 -1
  93. package/dist/esm/utilities/request.utility.d.ts.map +1 -1
  94. package/dist/esm/utilities/request.utility.js +1 -0
  95. package/dist/esm/utilities/request.utility.js.map +1 -1
  96. package/package.json +2 -2
  97. package/dist/esm/modules/logger/resolver.d.ts +0 -33
  98. package/dist/esm/modules/logger/resolver.d.ts.map +0 -1
  99. package/dist/esm/modules/logger/resolver.js +0 -95
  100. package/dist/esm/modules/logger/resolver.js.map +0 -1
  101. package/dist/esm/modules/logger/slot.d.ts +0 -44
  102. package/dist/esm/modules/logger/slot.d.ts.map +0 -1
  103. package/dist/esm/modules/logger/slot.js +0 -126
  104. package/dist/esm/modules/logger/slot.js.map +0 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@ The root entry loads with no optional peer installed. Every third-party backend
12
12
 
13
13
  ## Example
14
14
 
15
- Register a logger provider once at the entrypoint, then take scoped loggers and helpers anywhere:
15
+ Choose a logger provider once at the entrypoint, then take scoped loggers and helpers anywhere:
16
16
 
17
17
  ```typescript
18
18
  // bun add pino ioredis
@@ -37,7 +37,7 @@ const user = await redis.get({ key: 'user:1', transform: JSON.parse });
37
37
  logger.for('warmup').info('Cache warmed | user: %j', user);
38
38
  ```
39
39
 
40
- Notice that your code only ever types against `ILogger`. `LoggerFactory.use()` swaps the backend for every logger handed out so far. With no provider registered, the factory falls back to winston on the first log call.
40
+ Notice that your code only ever types against `ILogger`. `LoggerFactory.use()` swaps the backend for every logger handed out so far. With no provider chosen, the factory uses the console; `@venizia/ignis` selects Winston when an application starts.
41
41
 
42
42
  Dates and IDs need no peer at all:
43
43
 
@@ -90,7 +90,7 @@ import { ModuleUtility } from '@venizia/ignis-helpers';
90
90
  ModuleUtility.register({ modules: { ioredis } });
91
91
  ```
92
92
 
93
- A binary must also call `LoggerFactory.use()` explicitly - the winston fallback cannot reach a bundle. Details: [Module Utility](https://ignis.venizia.ai/references/utilities/module).
93
+ A binary needs no `LoggerFactory.use()`: the console is the default logger. Details: [Module Utility](https://ignis.venizia.ai/references/utilities/module).
94
94
 
95
95
  ## Where it sits
96
96
 
@@ -4,8 +4,7 @@ export * from './modules/error/index.js';
4
4
  export { LogLevels } from './modules/logger/common/types.js';
5
5
  export type { ILogger, ILoggerProvider, TLogLevel } from './modules/logger/common/types.js';
6
6
  export { ConsoleLogger } from './modules/logger/base/console.js';
7
- export { LoggerSlot } from './modules/logger/slot.js';
8
- export type { TLoggerResolver } from './modules/logger/slot.js';
7
+ export { LoggerFactory } from './modules/logger/factory.js';
9
8
  export * from './modules/network/http-request/fetcher/base-fetcher.js';
10
9
  export * from './modules/network/http-request/fetcher/node-fetcher.js';
11
10
  export * from './modules/network/http-request/base-network-request.helper.js';
@@ -31,6 +30,9 @@ export { ParseUtility } from './utilities/parse.utility.js';
31
30
  export { PerformanceUtility } from './utilities/performance.utility.js';
32
31
  export { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility.js';
33
32
  export { ProjectRootRegistry } from './utilities/project-root.utility.js';
33
+ export { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm.js';
34
+ export { ECDH } from './modules/crypto/algorithms/ecdh.algorithm.js';
35
+ export type { ECDHAlgorithmType, IECDHEncryptedPayload, IECDHExtraOptions, } from './modules/crypto/algorithms/ecdh.algorithm.js';
34
36
  export { AESAlgorithms } from './modules/crypto/algorithms/aes.constants.js';
35
37
  export type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants.js';
36
38
  export type { IPayloadCipher } from './modules/crypto/common/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,O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KpD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/esm/core.js CHANGED
@@ -4,9 +4,10 @@ export { BaseHelper } from './modules/base.js';
4
4
  export { EnvironmentNames } from './modules/env/names.js';
5
5
  export * from './modules/error/index.js';
6
6
  export { LogLevels } from './modules/logger/common/types.js';
7
- // The browser-safe logger seam: `LoggerFactory` is node-only, so a browser app installs its own resolver here.
7
+ // The one way to get a logger, the same in the browser and on the server: `LoggerFactory` imports nothing from node, and its
8
+ // default provider is the console. An application chooses another with `LoggerFactory.use({ provider, level })`.
8
9
  export { ConsoleLogger } from './modules/logger/base/console.js';
9
- export { LoggerSlot } from './modules/logger/slot.js';
10
+ export { LoggerFactory } from './modules/logger/factory.js';
10
11
  export * from './modules/network/http-request/fetcher/base-fetcher.js';
11
12
  // The node fetcher carries no node builtin - its one `querystring.stringify` is written out - so the
12
13
  // framework HTTP layer is reachable from a browser bundle, and a connector on HTTP need not
@@ -36,8 +37,13 @@ export { ParseUtility } from './utilities/parse.utility.js';
36
37
  export { PerformanceUtility } from './utilities/performance.utility.js';
37
38
  export { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility.js';
38
39
  export { ProjectRootRegistry } from './utilities/project-root.utility.js';
40
+ // `ECDH` is the one crypto algorithm that is browser-pure: it runs over `crypto.subtle`, `btoa` and `atob`. It and its
41
+ // base class come by leaf path, never the algorithms barrel, which also carries `AES`, `LegacyAES` and `RSA`
42
+ // (server code: they use `Buffer`, and `AES` reads files with `node:fs`).
43
+ export { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm.js';
44
+ export { ECDH } from './modules/crypto/algorithms/ecdh.algorithm.js';
39
45
  // Type-only: erased at compile time, so re-exporting these carries no runtime/bundle cost even
40
- // though the concrete classes they describe (crypto algorithms, the ioredis-backed helper) are not
46
+ // though the concrete classes they describe (the other crypto algorithms, the ioredis-backed helper) are not
41
47
  // themselves part of this pure surface.
42
48
  export { AESAlgorithms } from './modules/crypto/algorithms/aes.constants.js';
43
49
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,6FAA6F;AAC7F,8DAA8D;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,+GAA+G;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,cAAc,qDAAqD,CAAC;AACpE,qGAAqG;AACrG,4FAA4F;AAC5F,oBAAoB;AACpB,cAAc,qDAAqD,CAAC;AACpE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,iGAAiG;AACjG,yFAAyF;AACzF,cAAc,yDAAyD,CAAC;AAExE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAcrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,gGAAgG;AAChG,6FAA6F;AAC7F,iGAAiG;AACjG,0DAA0D;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,+FAA+F;AAC/F,mGAAmG;AACnG,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export { BaseHelper } from './modules/base';\n// By name, never `export *` from `./modules/env`: that barrel also carries `Environment` and\n// `applicationEnvironment`, both of which read `process.env`.\nexport { EnvironmentNames } from './modules/env/names';\nexport * from './modules/error';\nexport { LogLevels } from './modules/logger/common/types';\nexport type { ILogger, ILoggerProvider, TLogLevel } from './modules/logger/common/types';\n// The browser-safe logger seam: `LoggerFactory` is node-only, so a browser app installs its own resolver here.\nexport { ConsoleLogger } from './modules/logger/base/console';\nexport { LoggerSlot } from './modules/logger/slot';\nexport type { TLoggerResolver } from './modules/logger/slot';\nexport * from './modules/network/http-request/fetcher/base-fetcher';\n// The node fetcher carries no node builtin - its one `querystring.stringify` is written out - so the\n// framework HTTP layer is reachable from a browser bundle, and a connector on HTTP need not\n// re-implement one.\nexport * from './modules/network/http-request/fetcher/node-fetcher';\nexport * from './modules/network/http-request/base-network-request.helper';\nexport * from './modules/pool';\nexport * from './modules/queue/internal/hf';\nexport * from './modules/temporal';\nexport * from './modules/uid';\n// The url guard, pure half only: `UrlPolicy` decides a url and a literal address with string and\n// number work. Its sibling `UrlIngest` reaches `node:dns` and stays out of this subpath.\nexport * from './modules/network/utilities/url-safety/common/constants';\nexport type { IUrlSafetyPolicy } from './modules/network/utilities/url-safety/common/types';\nexport * from './modules/network/utilities/url-safety/policy';\nexport * from './modules/network/utilities/query-string';\nexport { RetryBackoffStrategies, RetryJitterModes } from './modules/retry/common/constants';\nexport type { TRetryBackoffStrategy, TRetryJitterMode } from './modules/retry/common/constants';\nexport type { IRetryBackoffOptions, IRetryContext } from './modules/retry/common/types';\nexport { RetryHelper } from './modules/retry/helper';\nexport { SlugHelper } from './modules/slug/helper';\nexport { TreeBuilder } from './modules/tree/builder';\nexport type {\n IBuildOptions,\n IHeightWhereOptions,\n ILeavesOptions,\n INodeWithPath,\n IPrintOptions,\n ITreeNode,\n IWalkAsyncOptions,\n IWalkOptions,\n TNodePredicate,\n TOnVisit,\n TOnVisitAsync,\n} from './modules/tree/common/types';\nexport { TreeWalker } from './modules/tree/walk';\n\n// Pure value/type utilities that already live under the root barrel's `./utilities` re-export -\n// that barrel also carries node-only siblings (module.utility.ts, request.utility.ts), so it\n// cannot itself become a subpath. Named one at a time here instead of widening the barrel: every\n// symbol below is verified free of node builtins/globals.\nexport { BuildInfoRegistry } from './utilities/build-info.utility';\nexport type { IBuildInfo, TBuildInfoRecord } from './utilities/build-info.utility';\nexport { ParseUtility } from './utilities/parse.utility';\nexport { PerformanceUtility } from './utilities/performance.utility';\nexport { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility';\nexport { ProjectRootRegistry } from './utilities/project-root.utility';\n\n// Type-only: erased at compile time, so re-exporting these carries no runtime/bundle cost even\n// though the concrete classes they describe (crypto algorithms, the ioredis-backed helper) are not\n// themselves part of this pure surface.\nexport { AESAlgorithms } from './modules/crypto/algorithms/aes.constants';\nexport type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants';\nexport type { IPayloadCipher } from './modules/crypto/common/types';\nexport type { IRedisHelper } from './modules/redis/common/interfaces';\n"]}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,6FAA6F;AAC7F,8DAA8D;AAC9D,OAA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G;AAC7G,0EAA0E;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAOlE,+FAA+F;AAC/F,6GAA6G;AAC7G,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC","sourcesContent":["export { BaseHelper } from './modules/base';\n// By name, never `export *` from `./modules/env`: that barrel also carries `Environment` and\n// `applicationEnvironment`, both of which read `process.env`.\nexport { EnvironmentNames } from './modules/env/names';\nexport * from './modules/error';\nexport { LogLevels } from './modules/logger/common/types';\nexport type { ILogger, ILoggerProvider, TLogLevel } from './modules/logger/common/types';\n// The one way to get a logger, the same in the browser and on the server: `LoggerFactory` imports nothing from node, and its\n// default provider is the console. An application chooses another with `LoggerFactory.use({ provider, level })`.\nexport { ConsoleLogger } from './modules/logger/base/console';\nexport { LoggerFactory } from './modules/logger/factory';\nexport * from './modules/network/http-request/fetcher/base-fetcher';\n// The node fetcher carries no node builtin - its one `querystring.stringify` is written out - so the\n// framework HTTP layer is reachable from a browser bundle, and a connector on HTTP need not\n// re-implement one.\nexport * from './modules/network/http-request/fetcher/node-fetcher';\nexport * from './modules/network/http-request/base-network-request.helper';\nexport * from './modules/pool';\nexport * from './modules/queue/internal/hf';\nexport * from './modules/temporal';\nexport * from './modules/uid';\n// The url guard, pure half only: `UrlPolicy` decides a url and a literal address with string and\n// number work. Its sibling `UrlIngest` reaches `node:dns` and stays out of this subpath.\nexport * from './modules/network/utilities/url-safety/common/constants';\nexport type { IUrlSafetyPolicy } from './modules/network/utilities/url-safety/common/types';\nexport * from './modules/network/utilities/url-safety/policy';\nexport * from './modules/network/utilities/query-string';\nexport { RetryBackoffStrategies, RetryJitterModes } from './modules/retry/common/constants';\nexport type { TRetryBackoffStrategy, TRetryJitterMode } from './modules/retry/common/constants';\nexport type { IRetryBackoffOptions, IRetryContext } from './modules/retry/common/types';\nexport { RetryHelper } from './modules/retry/helper';\nexport { SlugHelper } from './modules/slug/helper';\nexport { TreeBuilder } from './modules/tree/builder';\nexport type {\n IBuildOptions,\n IHeightWhereOptions,\n ILeavesOptions,\n INodeWithPath,\n IPrintOptions,\n ITreeNode,\n IWalkAsyncOptions,\n IWalkOptions,\n TNodePredicate,\n TOnVisit,\n TOnVisitAsync,\n} from './modules/tree/common/types';\nexport { TreeWalker } from './modules/tree/walk';\n\n// Pure value/type utilities that already live under the root barrel's `./utilities` re-export -\n// that barrel also carries node-only siblings (module.utility.ts, request.utility.ts), so it\n// cannot itself become a subpath. Named one at a time here instead of widening the barrel: every\n// symbol below is verified free of node builtins/globals.\nexport { BuildInfoRegistry } from './utilities/build-info.utility';\nexport type { IBuildInfo, TBuildInfoRecord } from './utilities/build-info.utility';\nexport { ParseUtility } from './utilities/parse.utility';\nexport { PerformanceUtility } from './utilities/performance.utility';\nexport { FormBodyUtility, RequestBodyErrors } from './utilities/form-body.utility';\nexport { ProjectRootRegistry } from './utilities/project-root.utility';\n\n// `ECDH` is the one crypto algorithm that is browser-pure: it runs over `crypto.subtle`, `btoa` and `atob`. It and its\n// base class come by leaf path, never the algorithms barrel, which also carries `AES`, `LegacyAES` and `RSA`\n// (server code: they use `Buffer`, and `AES` reads files with `node:fs`).\nexport { AbstractCryptoAlgorithm } from './modules/crypto/algorithms/abstract.algorithm';\nexport { ECDH } from './modules/crypto/algorithms/ecdh.algorithm';\nexport type {\n ECDHAlgorithmType,\n IECDHEncryptedPayload,\n IECDHExtraOptions,\n} from './modules/crypto/algorithms/ecdh.algorithm';\n\n// Type-only: erased at compile time, so re-exporting these carries no runtime/bundle cost even\n// though the concrete classes they describe (the other crypto algorithms, the ioredis-backed helper) are not\n// themselves part of this pure surface.\nexport { AESAlgorithms } from './modules/crypto/algorithms/aes.constants';\nexport type { AESAlgorithmType } from './modules/crypto/algorithms/aes.constants';\nexport type { IPayloadCipher } from './modules/crypto/common/types';\nexport type { IRedisHelper } from './modules/redis/common/interfaces';\n"]}
@@ -8,7 +8,7 @@ export declare class BaseHelper {
8
8
  });
9
9
  /** The helper's logger, resolved on first read - a helper that never logs never builds one. */
10
10
  get logger(): ILogger;
11
- /** Installs one logger on this helper - a test spy, or a host overriding the global resolver. */
11
+ /** Installs one logger on this helper - a test spy, or a host overriding the factory's logger. */
12
12
  set logger(value: ILogger);
13
13
  getIdentifier(): string;
14
14
  getLogger(): ILogger;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/modules/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAG7D,qBAAa,UAAU;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;gBAEP,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAKxD,+FAA+F;IAC/F,IAAI,MAAM,IAAI,OAAO,CAWpB;IAED,iGAAiG;IACjG,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAExB;IAED,aAAa;IAIb,SAAS,IAAI,OAAO;CAGrB"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/modules/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAY7D,qBAAa,UAAU;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;gBAEP,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAKxD,+FAA+F;IAC/F,IAAI,MAAM,IAAI,OAAO,CAWpB;IAED,kGAAkG;IAClG,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAExB;IAED,aAAa;IAIb,SAAS,IAAI,OAAO;CAGrB"}
@@ -1,4 +1,13 @@
1
- import { LoggerSlot } from './logger/slot.js';
1
+ import { LoggerFactory } from './logger/factory.js';
2
+ /** Pins a logger on a helper instance: later reads are a plain property read, not its getter. A module function, not a private static: a mixin that extends `BaseHelper` could not be emitted with a private member. */
3
+ const pinLogger = (opts) => {
4
+ Object.defineProperty(opts.helper, 'logger', {
5
+ value: opts.logger,
6
+ writable: true,
7
+ configurable: true,
8
+ enumerable: false,
9
+ });
10
+ };
2
11
  export class BaseHelper {
3
12
  constructor(opts) {
4
13
  this.scope = opts.scope ?? '';
@@ -7,16 +16,16 @@ export class BaseHelper {
7
16
  /** The helper's logger, resolved on first read - a helper that never logs never builds one. */
8
17
  get logger() {
9
18
  const scopes = [this.scope, this.identifier].filter((scope) => typeof scope === 'string' && scope.length > 0);
10
- const logger = LoggerSlot.resolveHelperLogger({ scopes });
19
+ const logger = LoggerFactory.getLogger(scopes);
11
20
  // Read off a prototype (reflection walks them), pinning would shadow this getter for every instance.
12
21
  if (Object.hasOwn(this, 'scope')) {
13
- LoggerSlot.pinHelperLogger({ helper: this, logger });
22
+ pinLogger({ helper: this, logger });
14
23
  }
15
24
  return logger;
16
25
  }
17
- /** Installs one logger on this helper - a test spy, or a host overriding the global resolver. */
26
+ /** Installs one logger on this helper - a test spy, or a host overriding the factory's logger. */
18
27
  set logger(value) {
19
- LoggerSlot.pinHelperLogger({ helper: this, logger: value });
28
+ pinLogger({ helper: this, logger: value });
20
29
  }
21
30
  getIdentifier() {
22
31
  return this.identifier;
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/modules/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,OAAO,UAAU;IAIrB,YAAY,IAA4C;QACtD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,+FAA+F;IAC/F,IAAI,MAAM;QACR,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CACjD,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CACzD,CAAC;QACF,MAAM,MAAM,GAAG,UAAU,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAE1D,qGAAqG;QACrG,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;YACjC,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iGAAiG;IACjG,IAAI,MAAM,CAAC,KAAc;QACvB,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import { type ILogger } from '@/modules/logger/common/types';\nimport { LoggerSlot } from '@/modules/logger/slot';\n\nexport class BaseHelper {\n scope: string;\n identifier: string;\n\n constructor(opts: { scope: string; identifier?: string }) {\n this.scope = opts.scope ?? '';\n this.identifier = opts.identifier ?? '';\n }\n\n /** The helper's logger, resolved on first read - a helper that never logs never builds one. */\n get logger(): ILogger {\n const scopes = [this.scope, this.identifier].filter(\n (scope) => typeof scope === 'string' && scope.length > 0,\n );\n const logger = LoggerSlot.resolveHelperLogger({ scopes });\n\n // Read off a prototype (reflection walks them), pinning would shadow this getter for every instance.\n if (Object.hasOwn(this, 'scope')) {\n LoggerSlot.pinHelperLogger({ helper: this, logger });\n }\n return logger;\n }\n\n /** Installs one logger on this helper - a test spy, or a host overriding the global resolver. */\n set logger(value: ILogger) {\n LoggerSlot.pinHelperLogger({ helper: this, logger: value });\n }\n\n getIdentifier() {\n return this.identifier;\n }\n\n getLogger(): ILogger {\n return this.logger;\n }\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/modules/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,wNAAwN;AACxN,MAAM,SAAS,GAAG,CAAC,IAAyC,EAAQ,EAAE;IACpE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE;QAC3C,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,OAAO,UAAU;IAIrB,YAAY,IAA4C;QACtD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,+FAA+F;IAC/F,IAAI,MAAM;QACR,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CACjD,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CACzD,CAAC;QACF,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAE/C,qGAAqG;QACrG,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;YACjC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kGAAkG;IAClG,IAAI,MAAM,CAAC,KAAc;QACvB,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import { LoggerFactory } from '@/modules/logger/factory';\nimport { type ILogger } from '@/modules/logger/common/types';\n\n/** Pins a logger on a helper instance: later reads are a plain property read, not its getter. A module function, not a private static: a mixin that extends `BaseHelper` could not be emitted with a private member. */\nconst pinLogger = (opts: { helper: object; logger: ILogger }): void => {\n Object.defineProperty(opts.helper, 'logger', {\n value: opts.logger,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n};\n\nexport class BaseHelper {\n scope: string;\n identifier: string;\n\n constructor(opts: { scope: string; identifier?: string }) {\n this.scope = opts.scope ?? '';\n this.identifier = opts.identifier ?? '';\n }\n\n /** The helper's logger, resolved on first read - a helper that never logs never builds one. */\n get logger(): ILogger {\n const scopes = [this.scope, this.identifier].filter(\n (scope) => typeof scope === 'string' && scope.length > 0,\n );\n const logger = LoggerFactory.getLogger(scopes);\n\n // Read off a prototype (reflection walks them), pinning would shadow this getter for every instance.\n if (Object.hasOwn(this, 'scope')) {\n pinLogger({ helper: this, logger });\n }\n return logger;\n }\n\n /** Installs one logger on this helper - a test spy, or a host overriding the factory's logger. */\n set logger(value: ILogger) {\n pinLogger({ helper: this, logger: value });\n }\n\n getIdentifier() {\n return this.identifier;\n }\n\n getLogger(): ILogger {\n return this.logger;\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { BaseHelper } from '../../base.js';
2
+ import type { ICryptoAlgorithm } from '../common/types.js';
3
+ /**
4
+ * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no
5
+ * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it
6
+ * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs
7
+ * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).
8
+ */
9
+ export declare abstract class AbstractCryptoAlgorithm<AlgorithmType extends string, EncryptInputType = unknown, DecryptInputType = unknown, SecretKeyType = unknown, EncryptReturnType = unknown, DecryptReturnType = unknown, ExtraOptions = unknown> extends BaseHelper implements ICryptoAlgorithm<AlgorithmType, EncryptInputType, DecryptInputType, SecretKeyType, EncryptReturnType, DecryptReturnType, ExtraOptions> {
10
+ algorithm: AlgorithmType;
11
+ abstract encrypt(opts: {
12
+ message: EncryptInputType;
13
+ secret: SecretKeyType;
14
+ opts?: ExtraOptions;
15
+ }): EncryptReturnType;
16
+ abstract decrypt(opts: {
17
+ message: DecryptInputType;
18
+ secret: SecretKeyType;
19
+ opts?: ExtraOptions;
20
+ }): DecryptReturnType;
21
+ }
22
+ //# sourceMappingURL=abstract.algorithm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/abstract.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;GAKG;AACH,8BAAsB,uBAAuB,CAC3C,aAAa,SAAS,MAAM,EAC5B,gBAAgB,GAAG,OAAO,EAC1B,gBAAgB,GAAG,OAAO,EAC1B,aAAa,GAAG,OAAO,EACvB,iBAAiB,GAAG,OAAO,EAC3B,iBAAiB,GAAG,OAAO,EAC3B,YAAY,GAAG,OAAO,CAEtB,SAAQ,UACR,YACE,gBAAgB,CACd,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,CACb;IAEH,SAAS,EAAE,aAAa,CAAC;IAEzB,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QACrB,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB;IAErB,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QACrB,OAAO,EAAE,gBAAgB,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,GAAG,iBAAiB;CACtB"}
@@ -0,0 +1,10 @@
1
+ import { BaseHelper } from '../../base.js';
2
+ /**
3
+ * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no
4
+ * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it
5
+ * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs
6
+ * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).
7
+ */
8
+ export class AbstractCryptoAlgorithm extends BaseHelper {
9
+ }
10
+ //# sourceMappingURL=abstract.algorithm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.algorithm.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/abstract.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;GAKG;AACH,MAAM,OAAgB,uBASpB,SAAQ,UAAU;CAyBnB","sourcesContent":["import { BaseHelper } from '@/modules/base';\nimport type { ICryptoAlgorithm } from '../common/types';\n\n/**\n * The contract of a crypto algorithm class, with no runtime dependency beyond `BaseHelper`: no `node:*`, no\n * key derivation. It lives in its own file so a browser-pure class (`ECDH`, over `crypto.subtle`) can extend it\n * and ride `@venizia/ignis-helpers/core`. `BaseCryptoAlgorithm` (`base.algorithm.ts`, which needs\n * `Buffer`) extends it for the server algorithms (`AES`, `LegacyAES`, `RSA`).\n */\nexport abstract class AbstractCryptoAlgorithm<\n AlgorithmType extends string,\n EncryptInputType = unknown,\n DecryptInputType = unknown,\n SecretKeyType = unknown,\n EncryptReturnType = unknown,\n DecryptReturnType = unknown,\n ExtraOptions = unknown,\n>\n extends BaseHelper\n implements\n ICryptoAlgorithm<\n AlgorithmType,\n EncryptInputType,\n DecryptInputType,\n SecretKeyType,\n EncryptReturnType,\n DecryptReturnType,\n ExtraOptions\n >\n{\n algorithm: AlgorithmType;\n\n abstract encrypt(opts: {\n message: EncryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): EncryptReturnType;\n\n abstract decrypt(opts: {\n message: DecryptInputType;\n secret: SecretKeyType;\n opts?: ExtraOptions;\n }): DecryptReturnType;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AESAlgorithmType } from './aes.algorithm.js';
1
+ import { type AESAlgorithmType } from './aes.constants.js';
2
2
  import { BaseCryptoAlgorithm } from './base.algorithm.js';
3
3
  interface IAESExtraOptions {
4
4
  iv?: Buffer;
@@ -10,8 +10,9 @@ interface IAESExtraOptions {
10
10
  * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never
11
11
  * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no
12
12
  * salt to override, so the option would type-check and silently do nothing.
13
+ * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.
13
14
  */
14
- export declare class LegacyAES extends BaseCryptoAlgorithm<AESAlgorithmType, string, string, string, string, string, IAESExtraOptions> {
15
+ export declare class LegacyAES extends BaseCryptoAlgorithm<AESAlgorithmType, string, string, string, Promise<string>, Promise<string>, IAESExtraOptions> {
15
16
  constructor(opts: {
16
17
  algorithm: AESAlgorithmType;
17
18
  });
@@ -20,20 +21,20 @@ export declare class LegacyAES extends BaseCryptoAlgorithm<AESAlgorithmType, str
20
21
  message: string;
21
22
  secret: string;
22
23
  opts?: IAESExtraOptions;
23
- }): string;
24
+ }): Promise<string>;
24
25
  encryptFile(opts: {
25
26
  absolutePath: string;
26
27
  secret: string;
27
- }): string;
28
+ }): Promise<string>;
28
29
  decrypt(opts: {
29
30
  message: string;
30
31
  secret: string;
31
32
  opts?: IAESExtraOptions;
32
- }): string;
33
+ }): Promise<string>;
33
34
  decryptFile(opts: {
34
35
  absolutePath: string;
35
36
  secret: string;
36
- }): string;
37
+ }): Promise<string>;
37
38
  private normalizeSecretKeyLegacy;
38
39
  }
39
40
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"aes-legacy.algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes-legacy.algorithm.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,mBAAmB,CAChD,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,gBAAgB,CACjB;gBACa,IAAI,EAAE;QAAE,SAAS,EAAE,gBAAgB,CAAA;KAAE;IAIjD,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB;IAIhD,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;KAAE;IA2C1E,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAanE,OAAO,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;KAAE;IA6C1E,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAa1D,OAAO,CAAC,wBAAwB;CASjC"}
1
+ {"version":3,"file":"aes-legacy.algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes-legacy.algorithm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,mBAAmB,CAChD,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,EACf,OAAO,CAAC,MAAM,CAAC,EACf,gBAAgB,CACjB;gBACa,IAAI,EAAE;QAAE,SAAS,EAAE,gBAAgB,CAAA;KAAE;IAIjD,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB;IAI1C,OAAO,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuCb,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAY5E,OAAO,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;KACzB,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCb,WAAW,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlF,OAAO,CAAC,wBAAwB;CASjC"}
@@ -1,13 +1,15 @@
1
1
  import { ObjectUtility } from '@venizia/ignis-inversion';
2
- import C from 'node:crypto';
3
2
  import fs from 'node:fs';
4
3
  import { DEFAULT_PAD_END } from '../common/index.js';
4
+ import { AESAlgorithms } from './aes.constants.js';
5
+ import { AesEngine } from './aes.engine.js';
5
6
  import { BaseCryptoAlgorithm } from './base.algorithm.js';
6
7
  const DEFAULT_LENGTH = 16;
7
8
  /**
8
9
  * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never
9
10
  * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no
10
11
  * salt to override, so the option would type-check and silently do nothing.
12
+ * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.
11
13
  */
12
14
  export class LegacyAES extends BaseCryptoAlgorithm {
13
15
  constructor(opts) {
@@ -16,29 +18,25 @@ export class LegacyAES extends BaseCryptoAlgorithm {
16
18
  static withAlgorithm(algorithm) {
17
19
  return new LegacyAES({ algorithm });
18
20
  }
19
- encrypt(opts) {
21
+ async encrypt(opts) {
20
22
  const { message, secret } = opts;
21
- const { iv = C.randomBytes(DEFAULT_LENGTH), inputEncoding = 'utf-8', outputEncoding = 'base64', doThrow = true, } = opts.opts ?? {};
23
+ const { iv = Buffer.from(crypto.getRandomValues(new Uint8Array(DEFAULT_LENGTH))), inputEncoding = 'utf-8', outputEncoding = 'base64', doThrow = true, } = opts.opts ?? {};
22
24
  try {
23
25
  const secretKey = this.normalizeSecretKeyLegacy({
24
26
  secret,
25
27
  length: this.getAlgorithmKeySize(),
26
28
  });
27
- const cipher = C.createCipheriv(this.algorithm, Buffer.from(secretKey), iv);
29
+ const { cipherText, authTag } = await AesEngine.seal({
30
+ algorithm: this.algorithm,
31
+ key: Buffer.from(secretKey),
32
+ iv,
33
+ plain: Buffer.from(message, inputEncoding),
34
+ });
28
35
  const parts = [iv];
29
- const cipherText = cipher.update(message, inputEncoding);
30
- const cipherFinal = cipher.final();
31
- switch (this.algorithm) {
32
- case 'aes-256-cbc': {
33
- break;
34
- }
35
- case 'aes-256-gcm': {
36
- parts.push(cipher.getAuthTag());
37
- break;
38
- }
36
+ if (authTag !== null) {
37
+ parts.push(authTag);
39
38
  }
40
39
  parts.push(cipherText);
41
- parts.push(cipherFinal);
42
40
  return Buffer.concat(parts).toString(outputEncoding);
43
41
  }
44
42
  catch (error) {
@@ -48,42 +46,39 @@ export class LegacyAES extends BaseCryptoAlgorithm {
48
46
  return message;
49
47
  }
50
48
  }
51
- encryptFile(opts) {
49
+ async encryptFile(opts) {
52
50
  const { absolutePath, secret } = opts;
53
51
  if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {
54
52
  return '';
55
53
  }
56
54
  const buffer = fs.readFileSync(absolutePath);
57
55
  const fileContent = buffer?.toString('utf-8');
58
- const encrypted = this.encrypt({ message: fileContent, secret });
59
- return encrypted;
56
+ return this.encrypt({ message: fileContent, secret });
60
57
  }
61
- decrypt(opts) {
58
+ async decrypt(opts) {
62
59
  const { message, secret } = opts;
63
60
  const { inputEncoding = 'base64', outputEncoding = 'utf-8', doThrow = true } = opts.opts ?? {};
64
61
  try {
65
- const iv = opts.opts?.iv ??
66
- Buffer.from(message, inputEncoding).subarray(0, DEFAULT_LENGTH) ??
67
- Buffer.alloc(DEFAULT_LENGTH, 0);
62
+ const raw = Buffer.from(message, inputEncoding);
63
+ const iv = opts.opts?.iv ?? raw.subarray(0, DEFAULT_LENGTH);
68
64
  let messageIndex = iv.length;
69
65
  const secretKey = this.normalizeSecretKeyLegacy({
70
66
  secret,
71
67
  length: this.getAlgorithmKeySize(),
72
68
  });
73
- const decipher = C.createDecipheriv(this.algorithm, Buffer.from(secretKey), iv);
74
- switch (this.algorithm) {
75
- case 'aes-256-cbc': {
76
- break;
77
- }
78
- case 'aes-256-gcm': {
79
- const authTag = Buffer.from(message, inputEncoding).subarray(iv.length, iv.length + DEFAULT_LENGTH);
80
- messageIndex += authTag.length;
81
- decipher.setAuthTag(authTag);
82
- break;
83
- }
69
+ let authTag = null;
70
+ if (this.algorithm === AESAlgorithms.AES_256_GCM) {
71
+ authTag = raw.subarray(iv.length, iv.length + DEFAULT_LENGTH);
72
+ messageIndex += authTag.length;
84
73
  }
85
- const cipherText = Buffer.from(message, inputEncoding).subarray(messageIndex);
86
- return Buffer.concat([decipher.update(cipherText), decipher.final()]).toString(outputEncoding);
74
+ const plain = await AesEngine.open({
75
+ algorithm: this.algorithm,
76
+ key: Buffer.from(secretKey),
77
+ iv,
78
+ cipherText: raw.subarray(messageIndex),
79
+ authTag,
80
+ });
81
+ return Buffer.from(plain).toString(outputEncoding);
87
82
  }
88
83
  catch (error) {
89
84
  if (doThrow) {
@@ -92,15 +87,14 @@ export class LegacyAES extends BaseCryptoAlgorithm {
92
87
  return message;
93
88
  }
94
89
  }
95
- decryptFile(opts) {
90
+ async decryptFile(opts) {
96
91
  const { absolutePath, secret } = opts;
97
92
  if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {
98
93
  return '';
99
94
  }
100
95
  const buffer = fs.readFileSync(absolutePath);
101
96
  const fileContent = buffer?.toString('utf-8');
102
- const decrypted = this.decrypt({ message: fileContent, secret });
103
- return decrypted;
97
+ return this.decrypt({ message: fileContent, secret });
104
98
  }
105
99
  normalizeSecretKeyLegacy(opts) {
106
100
  const { secret, length, padEnd = DEFAULT_PAD_END } = opts;
@@ -1 +1 @@
1
- {"version":3,"file":"aes-legacy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from 'node:crypto';\nimport fs from 'node:fs';\nimport { DEFAULT_PAD_END } from '../common';\nimport type { AESAlgorithmType } from './aes.algorithm';\nimport { BaseCryptoAlgorithm } from './base.algorithm';\n\nconst DEFAULT_LENGTH = 16;\n\ninterface IAESExtraOptions {\n iv?: Buffer;\n inputEncoding?: BufferEncoding;\n outputEncoding?: BufferEncoding;\n doThrow?: boolean;\n}\n\n/**\n * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never\n * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no\n * salt to override, so the option would type-check and silently do nothing.\n */\nexport class LegacyAES extends BaseCryptoAlgorithm<\n AESAlgorithmType,\n string,\n string,\n string,\n string,\n string,\n IAESExtraOptions\n> {\n constructor(opts: { algorithm: AESAlgorithmType }) {\n super({ scope: LegacyAES.name, ...opts });\n }\n\n static withAlgorithm(algorithm: AESAlgorithmType) {\n return new LegacyAES({ algorithm });\n }\n\n encrypt(opts: { message: string; secret: string; opts?: IAESExtraOptions }) {\n const { message, secret } = opts;\n const {\n iv = C.randomBytes(DEFAULT_LENGTH),\n inputEncoding = 'utf-8',\n outputEncoding = 'base64',\n doThrow = true,\n } = opts.opts ?? {};\n\n try {\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n\n const cipher = C.createCipheriv(this.algorithm, Buffer.from(secretKey), iv);\n\n const parts = [iv];\n const cipherText = cipher.update(message, inputEncoding);\n const cipherFinal = cipher.final();\n\n switch (this.algorithm) {\n case 'aes-256-cbc': {\n break;\n }\n case 'aes-256-gcm': {\n parts.push((cipher as C.CipherGCM).getAuthTag());\n break;\n }\n }\n parts.push(cipherText);\n parts.push(cipherFinal);\n\n return Buffer.concat(parts).toString(outputEncoding);\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n encryptFile(opts: { absolutePath: string; secret: string }): string {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n const encrypted = this.encrypt({ message: fileContent, secret });\n return encrypted;\n }\n\n decrypt(opts: { message: string; secret: string; opts?: IAESExtraOptions }) {\n const { message, secret } = opts;\n const { inputEncoding = 'base64', outputEncoding = 'utf-8', doThrow = true } = opts.opts ?? {};\n\n try {\n const iv =\n opts.opts?.iv ??\n Buffer.from(message, inputEncoding).subarray(0, DEFAULT_LENGTH) ??\n Buffer.alloc(DEFAULT_LENGTH, 0);\n let messageIndex = iv.length;\n\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n const decipher = C.createDecipheriv(this.algorithm, Buffer.from(secretKey), iv);\n\n switch (this.algorithm) {\n case 'aes-256-cbc': {\n break;\n }\n case 'aes-256-gcm': {\n const authTag = Buffer.from(message, inputEncoding).subarray(\n iv.length,\n iv.length + DEFAULT_LENGTH,\n );\n messageIndex += authTag.length;\n (decipher as C.DecipherGCM).setAuthTag(authTag);\n break;\n }\n }\n\n const cipherText = Buffer.from(message, inputEncoding).subarray(messageIndex);\n return Buffer.concat([decipher.update(cipherText), decipher.final()]).toString(\n outputEncoding,\n );\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n decryptFile(opts: { absolutePath: string; secret: string }) {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n const decrypted = this.decrypt({ message: fileContent, secret });\n return decrypted;\n }\n\n private normalizeSecretKeyLegacy(opts: { secret: string; length: number; padEnd?: string }) {\n const { secret, length, padEnd = DEFAULT_PAD_END } = opts;\n\n if (secret.length > length) {\n return secret.slice(0, length);\n }\n\n return secret.padEnd(length, padEnd);\n }\n}\n"]}
1
+ {"version":3,"file":"aes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OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAA8C;QAC9D,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAEtC,IAAI,CAAC,YAAY,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;YACpE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;IAEO,wBAAwB,CAAC,IAAyD;QACxF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,IAAI,CAAC;QAE1D,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["import { ObjectUtility } from '@venizia/ignis-inversion';\nimport fs from 'node:fs';\nimport { DEFAULT_PAD_END } from '../common';\nimport { AESAlgorithms, type AESAlgorithmType } from './aes.constants';\nimport { AesEngine } from './aes.engine';\nimport { BaseCryptoAlgorithm } from './base.algorithm';\n\nconst DEFAULT_LENGTH = 16;\n\ninterface IAESExtraOptions {\n iv?: Buffer;\n inputEncoding?: BufferEncoding;\n outputEncoding?: BufferEncoding;\n doThrow?: boolean;\n}\n\n/**\n * Frozen back-compat format - keys come from `normalizeSecretKeyLegacy` (padEnd/truncate), never\n * PBKDF2. `kdfSalt`/`kdfIterations` are deliberately absent from `IAESExtraOptions`: there is no\n * salt to override, so the option would type-check and silently do nothing.\n * `encrypt` and `decrypt` are async: the cipher runs over `crypto.subtle`.\n */\nexport class LegacyAES extends BaseCryptoAlgorithm<\n AESAlgorithmType,\n string,\n string,\n string,\n Promise<string>,\n Promise<string>,\n IAESExtraOptions\n> {\n constructor(opts: { algorithm: AESAlgorithmType }) {\n super({ scope: LegacyAES.name, ...opts });\n }\n\n static withAlgorithm(algorithm: AESAlgorithmType) {\n return new LegacyAES({ algorithm });\n }\n\n async encrypt(opts: {\n message: string;\n secret: string;\n opts?: IAESExtraOptions;\n }): Promise<string> {\n const { message, secret } = opts;\n const {\n iv = Buffer.from(crypto.getRandomValues(new Uint8Array(DEFAULT_LENGTH))),\n inputEncoding = 'utf-8',\n outputEncoding = 'base64',\n doThrow = true,\n } = opts.opts ?? {};\n\n try {\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n\n const { cipherText, authTag } = await AesEngine.seal({\n algorithm: this.algorithm,\n key: Buffer.from(secretKey),\n iv,\n plain: Buffer.from(message, inputEncoding),\n });\n\n const parts: Uint8Array[] = [iv];\n\n if (authTag !== null) {\n parts.push(authTag);\n }\n parts.push(cipherText);\n\n return Buffer.concat(parts).toString(outputEncoding);\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n async encryptFile(opts: { absolutePath: string; secret: string }): Promise<string> {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n return this.encrypt({ message: fileContent, secret });\n }\n\n async decrypt(opts: {\n message: string;\n secret: string;\n opts?: IAESExtraOptions;\n }): Promise<string> {\n const { message, secret } = opts;\n const { inputEncoding = 'base64', outputEncoding = 'utf-8', doThrow = true } = opts.opts ?? {};\n\n try {\n const raw = Buffer.from(message, inputEncoding);\n const iv = opts.opts?.iv ?? raw.subarray(0, DEFAULT_LENGTH);\n let messageIndex = iv.length;\n\n const secretKey = this.normalizeSecretKeyLegacy({\n secret,\n length: this.getAlgorithmKeySize(),\n });\n\n let authTag: Uint8Array | null = null;\n if (this.algorithm === AESAlgorithms.AES_256_GCM) {\n authTag = raw.subarray(iv.length, iv.length + DEFAULT_LENGTH);\n messageIndex += authTag.length;\n }\n\n const plain = await AesEngine.open({\n algorithm: this.algorithm,\n key: Buffer.from(secretKey),\n iv,\n cipherText: raw.subarray(messageIndex),\n authTag,\n });\n return Buffer.from(plain).toString(outputEncoding);\n } catch (error) {\n if (doThrow) {\n throw error;\n }\n\n return message;\n }\n }\n\n async decryptFile(opts: { absolutePath: string; secret: string }): Promise<string> {\n const { absolutePath, secret } = opts;\n\n if (!absolutePath || ObjectUtility.isEmpty({ value: absolutePath })) {\n return '';\n }\n\n const buffer = fs.readFileSync(absolutePath);\n const fileContent = buffer?.toString('utf-8');\n return this.decrypt({ message: fileContent, secret });\n }\n\n private normalizeSecretKeyLegacy(opts: { secret: string; length: number; padEnd?: string }) {\n const { secret, length, padEnd = DEFAULT_PAD_END } = opts;\n\n if (secret.length > length) {\n return secret.slice(0, length);\n }\n\n return secret.padEnd(length, padEnd);\n }\n}\n"]}
@@ -19,7 +19,8 @@ export interface IAESKeyringEntry {
19
19
  }
20
20
  export type TAESSecret = string | IAESKeyringEntry[];
21
21
  export { AESAlgorithms, type AESAlgorithmType };
22
- export declare class AES extends BaseCryptoAlgorithm<AESAlgorithmType, string, string, TAESSecret, string, string, IAESExtraOptions> {
22
+ /** `encrypt` and `decrypt` are async: key derivation and the cipher run over `crypto.subtle`. */
23
+ export declare class AES extends BaseCryptoAlgorithm<AESAlgorithmType, string, string, TAESSecret, Promise<string>, Promise<string>, IAESExtraOptions> {
23
24
  constructor(opts: {
24
25
  algorithm: AESAlgorithmType;
25
26
  });
@@ -28,33 +29,33 @@ export declare class AES extends BaseCryptoAlgorithm<AESAlgorithmType, string, s
28
29
  secret: TAESSecret;
29
30
  kdfSalt?: string;
30
31
  kdfIterations?: number;
31
- }): {
32
+ }): Promise<{
32
33
  id: string;
33
34
  key: Buffer;
34
- };
35
+ }>;
35
36
  protected resolveDecryptKey(opts: {
36
37
  secret: TAESSecret;
37
38
  id: string;
38
39
  kdfSalt?: string;
39
40
  kdfIterations?: number;
40
- }): Buffer;
41
+ }): Promise<Buffer>;
41
42
  encrypt(opts: {
42
43
  message: string;
43
44
  secret: TAESSecret;
44
45
  opts?: IAESExtraOptions;
45
- }): string;
46
+ }): Promise<string>;
46
47
  encryptFile(opts: {
47
48
  absolutePath: string;
48
49
  secret: TAESSecret;
49
- }): string;
50
+ }): Promise<string>;
50
51
  decrypt(opts: {
51
52
  message: string;
52
53
  secret: TAESSecret;
53
54
  opts?: IAESDecryptOptions;
54
- }): string;
55
+ }): Promise<string>;
55
56
  decryptFile(opts: {
56
57
  absolutePath: string;
57
58
  secret: TAESSecret;
58
- }): string;
59
+ }): Promise<string>;
59
60
  }
60
61
  //# sourceMappingURL=aes.algorithm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aes.algorithm.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/algorithms/aes.algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,UAAU,kBAAkB;IAC1B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8HAA8H;IAC9H,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0HAA0H;IAC1H,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sIAAsI;AACtI,UAAU,gBAAiB,SAAQ,kBAAkB;IACnD,EAAE,CAAC,EAAE,MAAM,C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