@venizia/ignis-helpers 0.1.1-12 → 0.1.1-14

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.
@@ -1,9 +1,20 @@
1
1
  export declare class KafkaBundlerPluginNames {
2
2
  static readonly PLATFORMATIC_WASM = "ignis:platformatic-wasm";
3
+ static readonly PLATFORMATIC_REQUIRE = "ignis:platformatic-require";
3
4
  }
4
5
  export declare class PlatformaticWasmSpecifiers {
5
6
  static readonly ENTRYPOINT = "@platformatic/wasm-utils";
6
7
  static readonly BUNDLED_ENTRYPOINT = "@platformatic/wasm-utils/bundled";
7
8
  static readonly ENTRYPOINT_FILTER: RegExp;
8
9
  }
10
+ export declare class PlatformaticRequireSpecifiers {
11
+ /** Modules whose module-scope `require()` calls must be hoisted to static imports. */
12
+ static readonly MODULE_FILTER: RegExp;
13
+ /** `const <binding> = require('<specifier>');` at module scope; anchored so a lazy `require()` nested inside a function body never matches. */
14
+ static readonly REQUIRE_PATTERN: RegExp;
15
+ /** Optional peers of `@platformatic/kafka`; a static import would break builds that do not install them. */
16
+ static readonly SKIPPED_SPECIFIERS: readonly string[];
17
+ /** Prefix for the injected import bindings, namespaced to avoid colliding with upstream identifiers. */
18
+ static readonly IMPORT_ALIAS_PREFIX = "__ignisRequire";
19
+ }
9
20
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/bundler/common/constants.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAuB;IAClC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,6BAA6B;CAC/D;AAED,qBAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,UAAU,8BAA8B;IACxD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,sCAAsC;IACxE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAiC;CACnE"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/bundler/common/constants.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAuB;IAClC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,6BAA6B;IAC9D,MAAM,CAAC,QAAQ,CAAC,oBAAoB,gCAAgC;CACrE;AAED,qBAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,UAAU,8BAA8B;IACxD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,sCAAsC;IACxE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAiC;CACnE;AAED,qBAAa,6BAA6B;IACxC,sFAAsF;IACtF,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAkD;IAE/E,+IAA+I;IAC/I,MAAM,CAAC,QAAQ,CAAC,eAAe,SAAwD;IAEvF,4GAA4G;IAC5G,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAoC;IAEzF,wGAAwG;IACxG,MAAM,CAAC,QAAQ,CAAC,mBAAmB,oBAAoB;CACxD"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformaticWasmSpecifiers = exports.KafkaBundlerPluginNames = void 0;
3
+ exports.PlatformaticRequireSpecifiers = exports.PlatformaticWasmSpecifiers = exports.KafkaBundlerPluginNames = void 0;
4
4
  class KafkaBundlerPluginNames {
5
5
  static { this.PLATFORMATIC_WASM = 'ignis:platformatic-wasm'; }
6
+ static { this.PLATFORMATIC_REQUIRE = 'ignis:platformatic-require'; }
6
7
  }
7
8
  exports.KafkaBundlerPluginNames = KafkaBundlerPluginNames;
8
9
  class PlatformaticWasmSpecifiers {
@@ -11,4 +12,15 @@ class PlatformaticWasmSpecifiers {
11
12
  static { this.ENTRYPOINT_FILTER = /^@platformatic\/wasm-utils$/; }
12
13
  }
13
14
  exports.PlatformaticWasmSpecifiers = PlatformaticWasmSpecifiers;
15
+ class PlatformaticRequireSpecifiers {
16
+ /** Modules whose module-scope `require()` calls must be hoisted to static imports. */
17
+ static { this.MODULE_FILTER = /@platformatic[\\/]kafka[\\/]dist[\\/].*\.js$/; }
18
+ /** `const <binding> = require('<specifier>');` at module scope; anchored so a lazy `require()` nested inside a function body never matches. */
19
+ static { this.REQUIRE_PATTERN = /^const\s+(\w+)\s*=\s*require\((['"])(.+?)\2\);?$/gm; }
20
+ /** Optional peers of `@platformatic/kafka`; a static import would break builds that do not install them. */
21
+ static { this.SKIPPED_SPECIFIERS = ['protobufjs', '@node-rs/crc32']; }
22
+ /** Prefix for the injected import bindings, namespaced to avoid colliding with upstream identifiers. */
23
+ static { this.IMPORT_ALIAS_PREFIX = '__ignisRequire'; }
24
+ }
25
+ exports.PlatformaticRequireSpecifiers = PlatformaticRequireSpecifiers;
14
26
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/bundler/common/constants.ts"],"names":[],"mappings":";;;AAAA,MAAa,uBAAuB;aAClB,sBAAiB,GAAG,yBAAyB,CAAC;;AADhE,0DAEC;AAED,MAAa,0BAA0B;aACrB,eAAU,GAAG,0BAA0B,CAAC;aACxC,uBAAkB,GAAG,kCAAkC,CAAC;aACxD,sBAAiB,GAAG,6BAA6B,CAAC;;AAHpE,gEAIC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/bundler/common/constants.ts"],"names":[],"mappings":";;;AAAA,MAAa,uBAAuB;aAClB,sBAAiB,GAAG,yBAAyB,CAAC;aAC9C,yBAAoB,GAAG,4BAA4B,CAAC;;AAFtE,0DAGC;AAED,MAAa,0BAA0B;aACrB,eAAU,GAAG,0BAA0B,CAAC;aACxC,uBAAkB,GAAG,kCAAkC,CAAC;aACxD,sBAAiB,GAAG,6BAA6B,CAAC;;AAHpE,gEAIC;AAED,MAAa,6BAA6B;IACxC,sFAAsF;aACtE,kBAAa,GAAG,8CAA8C,CAAC;IAE/E,+IAA+I;aAC/H,oBAAe,GAAG,oDAAoD,CAAC;IAEvF,4GAA4G;aAC5F,uBAAkB,GAAsB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAEzF,wGAAwG;aACxF,wBAAmB,GAAG,gBAAgB,CAAC;;AAXzD,sEAYC"}
@@ -1,3 +1,5 @@
1
1
  export * from './common';
2
+ export * from './platformatic-require.plugin';
2
3
  export * from './platformatic-wasm.plugin';
4
+ export * from './plugins';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,WAAW,CAAC"}
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./common"), exports);
18
+ __exportStar(require("./platformatic-require.plugin"), exports);
18
19
  __exportStar(require("./platformatic-wasm.plugin"), exports);
20
+ __exportStar(require("./plugins"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gEAA8C;AAC9C,6DAA2C;AAC3C,4CAA0B"}
@@ -0,0 +1,4 @@
1
+ import type { BunPlugin } from 'bun';
2
+ /** `@platformatic/kafka` resolves some dependencies through `createRequire(import.meta.url)` at module scope; `bun build --compile` cannot see through that, so the specifier stays unresolved and the binary dies with "Cannot find package" before boot - this plugin hoists those calls to static imports at bundle time. */
3
+ export declare const platformaticRequirePlugin: () => BunPlugin;
4
+ //# sourceMappingURL=platformatic-require.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformatic-require.plugin.d.ts","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/platformatic-require.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGrC,gUAAgU;AAChU,eAAO,MAAM,yBAAyB,QAAO,SAgC3C,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.platformaticRequirePlugin = void 0;
4
+ const common_1 = require("./common");
5
+ /** `@platformatic/kafka` resolves some dependencies through `createRequire(import.meta.url)` at module scope; `bun build --compile` cannot see through that, so the specifier stays unresolved and the binary dies with "Cannot find package" before boot - this plugin hoists those calls to static imports at bundle time. */
6
+ const platformaticRequirePlugin = () => ({
7
+ name: common_1.KafkaBundlerPluginNames.PLATFORMATIC_REQUIRE,
8
+ setup(build) {
9
+ build.onLoad({ filter: common_1.PlatformaticRequireSpecifiers.MODULE_FILTER }, async (args) => {
10
+ const source = await Bun.file(args.path).text();
11
+ const imports = [];
12
+ const contents = source.replace(common_1.PlatformaticRequireSpecifiers.REQUIRE_PATTERN, (matched, binding, _quote, specifier) => {
13
+ if (common_1.PlatformaticRequireSpecifiers.SKIPPED_SPECIFIERS.includes(specifier)) {
14
+ return matched;
15
+ }
16
+ const alias = `${common_1.PlatformaticRequireSpecifiers.IMPORT_ALIAS_PREFIX}${imports.length}`;
17
+ imports.push(`import ${alias} from ${JSON.stringify(specifier)};`);
18
+ // No `?.default` unwrap: a default import already yields `module.exports` for CJS, and
19
+ // unwrapping would break JSON payloads carrying their own top-level `default` key - the
20
+ // draft-06 meta schema has one, so unwrapping silently replaces it with `{}`.
21
+ return `const ${binding} = ${alias};`;
22
+ });
23
+ // No match is not an error: upstream fixing this makes the plugin an inert no-op.
24
+ if (!imports.length) {
25
+ return undefined;
26
+ }
27
+ return { contents: `${imports.join('\n')}\n${contents}`, loader: 'js' };
28
+ });
29
+ },
30
+ });
31
+ exports.platformaticRequirePlugin = platformaticRequirePlugin;
32
+ //# sourceMappingURL=platformatic-require.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformatic-require.plugin.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/platformatic-require.plugin.ts"],"names":[],"mappings":";;;AACA,qCAAkF;AAElF,gUAAgU;AACzT,MAAM,yBAAyB,GAAG,GAAc,EAAE,CAAC,CAAC;IACzD,IAAI,EAAE,gCAAuB,CAAC,oBAAoB;IAClD,KAAK,CAAC,KAAK;QACT,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,sCAA6B,CAAC,aAAa,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;YACjF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;YAChD,MAAM,OAAO,GAAa,EAAE,CAAC;YAE7B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAC7B,sCAA6B,CAAC,eAAe,EAC7C,CAAC,OAAO,EAAE,OAAe,EAAE,MAAc,EAAE,SAAiB,EAAE,EAAE;gBAC9D,IAAI,sCAA6B,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBACzE,OAAO,OAAO,CAAC;gBACjB,CAAC;gBAED,MAAM,KAAK,GAAG,GAAG,sCAA6B,CAAC,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;gBACtF,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBAEnE,uFAAuF;gBACvF,wFAAwF;gBACxF,8EAA8E;gBAC9E,OAAO,SAAS,OAAO,MAAM,KAAK,GAAG,CAAC;YACxC,CAAC,CACF,CAAC;YAEF,kFAAkF;YAClF,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAhCU,QAAA,yBAAyB,6BAgCnC"}
@@ -0,0 +1,4 @@
1
+ import type { BunPlugin } from 'bun';
2
+ /** Every `@platformatic/kafka` fix needed by `bun build --compile`, as one list - a service compile script registers this instead of tracking the individual plugins. */
3
+ export declare const platformaticKafkaPlugins: () => BunPlugin[];
4
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAIrC,yKAAyK;AACzK,eAAO,MAAM,wBAAwB,QAAO,SAAS,EAGpD,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.platformaticKafkaPlugins = void 0;
4
+ const platformatic_require_plugin_1 = require("./platformatic-require.plugin");
5
+ const platformatic_wasm_plugin_1 = require("./platformatic-wasm.plugin");
6
+ /** Every `@platformatic/kafka` fix needed by `bun build --compile`, as one list - a service compile script registers this instead of tracking the individual plugins. */
7
+ const platformaticKafkaPlugins = () => [
8
+ (0, platformatic_wasm_plugin_1.platformaticWasmPlugin)(),
9
+ (0, platformatic_require_plugin_1.platformaticRequirePlugin)(),
10
+ ];
11
+ exports.platformaticKafkaPlugins = platformaticKafkaPlugins;
12
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../../../src/modules/queue/kafka/bundler/plugins.ts"],"names":[],"mappings":";;;AACA,+EAA0E;AAC1E,yEAAoE;AAEpE,yKAAyK;AAClK,MAAM,wBAAwB,GAAG,GAAgB,EAAE,CAAC;IACzD,IAAA,iDAAsB,GAAE;IACxB,IAAA,uDAAyB,GAAE;CAC5B,CAAC;AAHW,QAAA,wBAAwB,4BAGnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/modules/secrets/factory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAI3F,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,oBAAoB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/modules/secrets/factory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAI3F,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,oBAAoB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,OAAO,CAAC,cAAc,CAAC,CA2CzB"}
@@ -12,19 +12,34 @@ async function createSecretsHelper(opts) {
12
12
  cacheTtlSeconds: opts.cacheTtlSeconds,
13
13
  renewBeforeRatio: opts.renewBeforeRatio,
14
14
  };
15
+ const config = opts.config;
15
16
  switch (opts.provider) {
16
17
  case common_1.SecretProviders.SYSTEM_ENVS: {
17
18
  return new system_envs_1.SystemEnvsHelper({ identifier: opts.identifier });
18
19
  }
19
20
  case common_1.SecretProviders.HASHICORP_VAULT: {
20
- module_utility_1.ModuleUtility.assertInstalled({ scope: 'HashiCorpVaultHelper', modules: ['node-vault'] });
21
+ // `client` is the injected escape: the helper never reaches for the peer, so demanding it here would defeat the escape.
22
+ if (!config?.client) {
23
+ module_utility_1.ModuleUtility.assertInstalled({
24
+ scope: 'HashiCorpVaultHelper',
25
+ modules: ['node-vault'],
26
+ allowRegistered: true,
27
+ });
28
+ }
21
29
  const { HashiCorpVaultHelper } = (await import('./hashicorp/index.js'));
22
- return new HashiCorpVaultHelper({ ...opts.config, ...shared });
30
+ return new HashiCorpVaultHelper({ ...config, ...shared });
23
31
  }
24
32
  case common_1.SecretProviders.DOTENV_VAULT: {
25
- module_utility_1.ModuleUtility.assertInstalled({ scope: 'DotenvVaultHelper', modules: ['@dotenvx/dotenvx'] });
33
+ // `decode` is the injected escape - same reasoning as `client` above.
34
+ if (!config?.decode) {
35
+ module_utility_1.ModuleUtility.assertInstalled({
36
+ scope: 'DotenvVaultHelper',
37
+ modules: ['@dotenvx/dotenvx'],
38
+ allowRegistered: true,
39
+ });
40
+ }
26
41
  const { DotenvVaultHelper } = (await import('./dotenv/index.js'));
27
- return new DotenvVaultHelper({ ...opts.config, ...shared });
42
+ return new DotenvVaultHelper({ ...config, ...shared });
28
43
  }
29
44
  default: {
30
45
  throw (0, error_1.getError)({
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/modules/secrets/factory.ts"],"names":[],"mappings":";;AAOA,kDA6BC;AAnCD,2CAA2C;AAC3C,+DAA2D;AAC3D,qCAA2F;AAC3F,+CAAiD;AAEjD,0RAA0R;AACnR,KAAK,UAAU,mBAAmB,CACvC,IAAoD;IAEpD,MAAM,MAAM,GAAG;QACb,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,eAAe,EAAE,IAAI,CAAC,eA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L,CAAC;YACD,MAAM,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAY,CAAC;YAC7E,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAA,gBAAQ,EAAC;gBACb,OAAO,EAAE,sDAAsD,IAAI,CAAC,QAAQ,EAAE;aAC/E,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -11,6 +11,10 @@ export declare class ModuleUtility {
11
11
  * A `bun build --compile` binary ships without `node_modules`, which leaves runtime resolution
12
12
  * nothing to resolve against: the application imports such a peer statically - that import is
13
13
  * what gets it into the binary - and registers it here before the consuming component boots.
14
+ *
15
+ * Deliberately does not log. It runs at the entrypoint of exactly the deployment that has no
16
+ * logger provider yet, where `LoggerFactory` throws - and a throw mid-loop would drop every
17
+ * module after the first.
14
18
  */
15
19
  static register(opts: {
16
20
  modules: Record<string, AnyType>;
@@ -23,10 +27,18 @@ export declare class ModuleUtility {
23
27
  static loadSync<T = AnyType>(opts: {
24
28
  module: string;
25
29
  }): T;
26
- /** Presence check only - throws naming what to install, without executing the module. */
30
+ /**
31
+ * Presence check only - throws naming what to install, without executing the module.
32
+ *
33
+ * `allowRegistered` must be set only where {@link load} or {@link loadSync} is what finally loads
34
+ * the module. Where the consumer resolves the specifier itself - `pino.transport()` inside a
35
+ * worker thread, or any caller with its own `createRequire` - the registry cannot reach it, and
36
+ * counting a registration as installed would replace this precise error with an opaque one.
37
+ */
27
38
  static assertInstalled(opts: {
28
39
  modules: Array<string>;
29
40
  scope?: string;
41
+ allowRegistered?: boolean;
30
42
  }): void;
31
43
  }
32
44
  //# sourceMappingURL=module.utility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.utility.d.ts","sourceRoot":"","sources":["../../src/utilities/module.utility.ts"],"names":[],"mapp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OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;IAMjE,sFAAsF;WACzE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAcpE,kFAAkF;IAClF,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,CAAC;IAczD;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,IAAI;CAgBT"}
@@ -30,11 +30,14 @@ class ModuleUtility {
30
30
  * A `bun build --compile` binary ships without `node_modules`, which leaves runtime resolution
31
31
  * nothing to resolve against: the application imports such a peer statically - that import is
32
32
  * what gets it into the binary - and registers it here before the consuming component boots.
33
+ *
34
+ * Deliberately does not log. It runs at the entrypoint of exactly the deployment that has no
35
+ * logger provider yet, where `LoggerFactory` throws - and a throw mid-loop would drop every
36
+ * module after the first.
33
37
  */
34
38
  static register(opts) {
35
39
  for (const [module, value] of Object.entries(opts.modules)) {
36
40
  this.registered.set(module, value);
37
- logger.for(this.register.name).debug("Registered module: '%s'", module);
38
41
  }
39
42
  }
40
43
  /** Loads the module. Use this everywhere except a constructor, which cannot await. */
@@ -63,12 +66,19 @@ class ModuleUtility {
63
66
  throw this.fail({ method: 'loadSync', module, error });
64
67
  }
65
68
  }
66
- /** Presence check only - throws naming what to install, without executing the module. */
69
+ /**
70
+ * Presence check only - throws naming what to install, without executing the module.
71
+ *
72
+ * `allowRegistered` must be set only where {@link load} or {@link loadSync} is what finally loads
73
+ * the module. Where the consumer resolves the specifier itself - `pino.transport()` inside a
74
+ * worker thread, or any caller with its own `createRequire` - the registry cannot reach it, and
75
+ * counting a registration as installed would replace this precise error with an opaque one.
76
+ */
67
77
  static assertInstalled(opts) {
68
- const { modules, scope } = opts;
78
+ const { modules, scope, allowRegistered = false } = opts;
69
79
  const appRequire = this.appRequire();
70
80
  for (const module of modules) {
71
- if (this.registered.has(module)) {
81
+ if (allowRegistered && this.registered.has(module)) {
72
82
  continue;
73
83
  }
74
84
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"module.utility.js","sourceRoot":"","sources":["../../src/utilities/module.utility.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,0DAA6B;AAE7B,6CAAiD;AACjD,2CAA2C;AAE3C,MAAM,MAAM,GAAG,sBAAa,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;AAE1D,4LAA4L;AAC5L,MAAa,aAAa;IACxB,sGAAsG;aAC9E,eAAU,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEhE,8FAA8F;IACtF,MAAM,CAAC,UAAU;QACvB,OAAO,IAAA,2BAAa,EAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;IACjE,CAAC;IAEO,MAAM,CAAC,IAAI,CAAC,IAAwE;QAC1F,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAC9C,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEtE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,iCAAiC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE5E,OAAO,IAAA,gBAAQ,EAAC;YACd,OAAO,EAAE,kBAAkB,MAAM,KAAK,MAAM,eAC1C,KAAK,CAAC,CAAC,CAAC,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,EAAE,KAAK,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;;AA/FH,sCAgGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ignis-helpers",
3
- "version": "0.1.1-12",
3
+ "version": "0.1.1-14",
4
4
  "description": "Production-ready TypeScript utility library: pluggable logging (winston or pino behind one ILogger contract), Redis single/cluster/sentinel with pub/sub, BullMQ/MQTT/Kafka message queues, MinIO/Disk/Bun-S3 object storage, AES-256/RSA/ECDH cryptography, Snowflake UID generation, cron scheduling, Socket.IO/WebSocket, TCP/TLS/UDP networking, HTTP clients, secrets/Vault, worker thread pools, and environment management. Sub-path imports isolate optional peer dependencies so the root barrel never forces a peer into your bundle.",
5
5
  "keywords": [
6
6
  "aes",
@@ -268,7 +268,7 @@
268
268
  "devDependencies": {
269
269
  "@dotenvx/dotenvx": "^2.14.0",
270
270
  "@hono/zod-openapi": "^1.5.1",
271
- "@platformatic/kafka": "^2.6.1",
271
+ "@platformatic/kafka": "^2.8.0",
272
272
  "@socket.io/redis-adapter": "^8.3.0",
273
273
  "@socket.io/redis-emitter": "^5.1.0",
274
274
  "@types/bun": "^1.3.14",