every-plugin 0.4.17 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-zltIcp7o.cjs → _virtual/rolldown_runtime.cjs} +3 -18
- package/dist/{chunk-QQAxy9l9.mjs → _virtual/rolldown_runtime.mjs} +1 -1
- package/dist/build/rspack/dev-server-middleware.cjs +201 -0
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -0
- package/dist/build/rspack/dev-server-middleware.mjs +200 -0
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +2 -362
- package/dist/build/rspack/index.d.cts +2 -20
- package/dist/build/rspack/index.d.mts +2 -20
- package/dist/build/rspack/index.mjs +2 -360
- package/dist/build/rspack/module-federation.cjs +47 -0
- package/dist/build/rspack/module-federation.cjs.map +1 -0
- package/dist/build/rspack/module-federation.mjs +47 -0
- package/dist/build/rspack/module-federation.mjs.map +1 -0
- package/dist/build/rspack/plugin.cjs +90 -0
- package/dist/build/rspack/plugin.cjs.map +1 -0
- package/dist/build/rspack/plugin.d.cts +20 -0
- package/dist/build/rspack/plugin.d.cts.map +1 -0
- package/dist/build/rspack/plugin.d.mts +20 -0
- package/dist/build/rspack/plugin.d.mts.map +1 -0
- package/dist/build/rspack/plugin.mjs +89 -0
- package/dist/build/rspack/plugin.mjs.map +1 -0
- package/dist/build/rspack/utils.cjs +41 -0
- package/dist/build/rspack/utils.cjs.map +1 -0
- package/dist/build/rspack/utils.mjs +38 -0
- package/dist/build/rspack/utils.mjs.map +1 -0
- package/dist/errors.cjs +62 -3
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +75 -3
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +75 -3
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +62 -3
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +8 -55
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +5 -51
- package/dist/orpc.cjs +1 -1
- package/dist/{package-D4mbTFY1.cjs → package.cjs} +22 -7
- package/dist/package.cjs.map +1 -0
- package/dist/{package-B0vvsKXO.mjs → package.mjs} +22 -5
- package/dist/package.mjs.map +1 -0
- package/dist/plugin.cjs +48 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +62 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.mts +62 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +47 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/runtime/errors.cjs +45 -0
- package/dist/runtime/errors.cjs.map +1 -0
- package/dist/runtime/errors.d.cts +27 -0
- package/dist/runtime/errors.d.cts.map +1 -0
- package/dist/runtime/errors.d.mts +27 -0
- package/dist/runtime/errors.d.mts.map +1 -0
- package/dist/runtime/errors.mjs +41 -0
- package/dist/runtime/errors.mjs.map +1 -0
- package/dist/runtime/index.cjs +157 -5
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +43 -5
- package/dist/runtime/index.d.cts.map +1 -0
- package/dist/runtime/index.d.mts +43 -5
- package/dist/runtime/index.d.mts.map +1 -0
- package/dist/runtime/index.mjs +155 -4
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/runtime/services/module-federation.service.cjs +143 -0
- package/dist/runtime/services/module-federation.service.cjs.map +1 -0
- package/dist/runtime/services/module-federation.service.d.cts +15 -0
- package/dist/runtime/services/module-federation.service.d.cts.map +1 -0
- package/dist/runtime/services/module-federation.service.d.mts +15 -0
- package/dist/runtime/services/module-federation.service.d.mts.map +1 -0
- package/dist/runtime/services/module-federation.service.mjs +143 -0
- package/dist/runtime/services/module-federation.service.mjs.map +1 -0
- package/dist/runtime/services/normalize.cjs +22 -2
- package/dist/runtime/services/normalize.cjs.map +1 -0
- package/dist/runtime/services/normalize.d.cts +21 -2
- package/dist/runtime/services/normalize.d.cts.map +1 -0
- package/dist/runtime/services/normalize.d.mts +21 -2
- package/dist/runtime/services/normalize.d.mts.map +1 -0
- package/dist/runtime/services/normalize.mjs +21 -2
- package/dist/runtime/services/normalize.mjs.map +1 -0
- package/dist/runtime/services/plugin-lifecycle.service.cjs +33 -0
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +17 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +1 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +17 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +1 -0
- package/dist/runtime/services/plugin-lifecycle.service.mjs +32 -0
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -0
- package/dist/runtime/services/plugin-loader.service.cjs +125 -0
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -0
- package/dist/runtime/services/plugin-loader.service.d.cts +54 -0
- package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -0
- package/dist/runtime/services/plugin-loader.service.d.mts +54 -0
- package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -0
- package/dist/runtime/services/plugin-loader.service.mjs +121 -0
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -0
- package/dist/runtime/services/plugin.service.cjs +33 -0
- package/dist/runtime/services/plugin.service.cjs.map +1 -0
- package/dist/runtime/services/plugin.service.d.cts +42 -0
- package/dist/runtime/services/plugin.service.d.cts.map +1 -0
- package/dist/runtime/services/plugin.service.d.mts +42 -0
- package/dist/runtime/services/plugin.service.d.mts.map +1 -0
- package/dist/runtime/services/plugin.service.mjs +32 -0
- package/dist/runtime/services/plugin.service.mjs.map +1 -0
- package/dist/runtime/services/secrets.service.cjs +50 -0
- package/dist/runtime/services/secrets.service.cjs.map +1 -0
- package/dist/runtime/services/secrets.service.d.cts +16 -0
- package/dist/runtime/services/secrets.service.d.cts.map +1 -0
- package/dist/runtime/services/secrets.service.d.mts +16 -0
- package/dist/runtime/services/secrets.service.d.mts.map +1 -0
- package/dist/runtime/services/secrets.service.mjs +48 -0
- package/dist/runtime/services/secrets.service.mjs.map +1 -0
- package/dist/runtime/validation.cjs +18 -0
- package/dist/runtime/validation.cjs.map +1 -0
- package/dist/runtime/validation.mjs +17 -0
- package/dist/runtime/validation.mjs.map +1 -0
- package/dist/testing/index.cjs +33 -55
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +28 -33
- package/dist/testing/index.d.cts.map +1 -1
- package/dist/testing/index.d.mts +28 -33
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +34 -54
- package/dist/testing/index.mjs.map +1 -1
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +261 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +261 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/dist/zod-core.cjs +9 -0
- package/dist/zod-core.d.cts +1 -0
- package/dist/zod-core.d.mts +1 -0
- package/dist/zod-core.mjs +3 -0
- package/dist/zod.cjs +13 -1
- package/dist/zod.cjs.map +1 -0
- package/dist/zod.d.cts +8 -2
- package/dist/zod.d.cts.map +1 -0
- package/dist/zod.d.mts +8 -2
- package/dist/zod.d.mts.map +1 -0
- package/dist/zod.mjs +9 -2
- package/dist/zod.mjs.map +1 -0
- package/package.json +17 -2
- package/dist/build/rspack/index.cjs.map +0 -1
- package/dist/build/rspack/index.d.cts.map +0 -1
- package/dist/build/rspack/index.d.mts.map +0 -1
- package/dist/build/rspack/index.mjs.map +0 -1
- package/dist/errors-9sNpYLv5.d.mts +0 -75
- package/dist/errors-9sNpYLv5.d.mts.map +0 -1
- package/dist/errors-CVnoPl9v.cjs +0 -68
- package/dist/errors-CVnoPl9v.cjs.map +0 -1
- package/dist/errors-D7keKf7a.mjs +0 -63
- package/dist/errors-D7keKf7a.mjs.map +0 -1
- package/dist/errors-DKPPPYYT.d.cts +0 -75
- package/dist/errors-DKPPPYYT.d.cts.map +0 -1
- package/dist/fetch-8DauUFDh.mjs +0 -335
- package/dist/fetch-8DauUFDh.mjs.map +0 -1
- package/dist/fetch-CrBvwsZ4.cjs +0 -336
- package/dist/fetch-CrBvwsZ4.cjs.map +0 -1
- package/dist/index-Coz54d1B.d.mts +0 -387
- package/dist/index-Coz54d1B.d.mts.map +0 -1
- package/dist/index-G63gBZIY.d.cts +0 -386
- package/dist/index-G63gBZIY.d.cts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/normalize-BW7kk8Lk.d.cts +0 -21
- package/dist/normalize-BW7kk8Lk.d.cts.map +0 -1
- package/dist/normalize-D4Qh0wVk.cjs +0 -28
- package/dist/normalize-D4Qh0wVk.cjs.map +0 -1
- package/dist/normalize-D7nae0Hn.mjs +0 -22
- package/dist/normalize-D7nae0Hn.mjs.map +0 -1
- package/dist/normalize-eB_j86fm.d.mts +0 -21
- package/dist/normalize-eB_j86fm.d.mts.map +0 -1
- package/dist/package-B0vvsKXO.mjs.map +0 -1
- package/dist/package-D4mbTFY1.cjs.map +0 -1
- package/dist/plugins-C6MGKdD-.mjs +0 -790
- package/dist/plugins-C6MGKdD-.mjs.map +0 -1
- package/dist/plugins-DNaNtkG7.cjs +0 -791
- package/dist/plugins-DNaNtkG7.cjs.map +0 -1
- package/dist/runtime-BTFJzoBu.cjs +0 -541
- package/dist/runtime-BTFJzoBu.cjs.map +0 -1
- package/dist/runtime-BYDchBFq.mjs +0 -476
- package/dist/runtime-BYDchBFq.mjs.map +0 -1
- package/dist/standard-CkH8zNkx.mjs +0 -584
- package/dist/standard-CkH8zNkx.mjs.map +0 -1
- package/dist/standard-v75BC6Z5.cjs +0 -685
- package/dist/standard-v75BC6Z5.cjs.map +0 -1
- package/dist/zod-A7Pti5IV.d.cts +0 -4
- package/dist/zod-A7Pti5IV.d.cts.map +0 -1
- package/dist/zod-BVo51kgJ.mjs +0 -10
- package/dist/zod-BVo51kgJ.mjs.map +0 -1
- package/dist/zod-DYghWCz1.cjs +0 -14
- package/dist/zod-DYghWCz1.cjs.map +0 -1
- package/dist/zod-Zw8dlP3j.d.mts +0 -4
- package/dist/zod-Zw8dlP3j.d.mts.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_errors = require('../errors.cjs');
|
|
3
|
+
let effect = require("effect");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/services/secrets.service.ts
|
|
7
|
+
const configSchema = zod.z.object({ secrets: zod.z.record(zod.z.string(), zod.z.unknown()) }).loose();
|
|
8
|
+
var SecretsConfigTag = class extends effect.Context.Tag("SecretsConfig")() {};
|
|
9
|
+
var SecretsService = class extends effect.Effect.Service()("SecretsService", { effect: effect.Effect.gen(function* () {
|
|
10
|
+
const secrets = yield* SecretsConfigTag;
|
|
11
|
+
const hydrateValue = (value) => {
|
|
12
|
+
if (typeof value === "string") {
|
|
13
|
+
let result = value;
|
|
14
|
+
for (const [key, secretValue] of Object.entries(secrets)) {
|
|
15
|
+
const pattern = new RegExp(`{{${key}}}`, "g");
|
|
16
|
+
result = result.replace(pattern, String(secretValue));
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) return value.map(hydrateValue);
|
|
21
|
+
if (value && typeof value === "object") {
|
|
22
|
+
if (value.constructor === Object || value.constructor === void 0) {
|
|
23
|
+
const hydrated$1 = {};
|
|
24
|
+
for (const [key, val] of Object.entries(value)) hydrated$1[key] = hydrateValue(val);
|
|
25
|
+
return hydrated$1;
|
|
26
|
+
}
|
|
27
|
+
const hydrated = Object.create(Object.getPrototypeOf(value));
|
|
28
|
+
for (const [key, val] of Object.entries(value)) hydrated[key] = hydrateValue(val);
|
|
29
|
+
return hydrated;
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
return { hydrateSecrets: (config) => effect.Effect.gen(function* () {
|
|
34
|
+
const parseResult = configSchema.parse(config);
|
|
35
|
+
try {
|
|
36
|
+
return hydrateValue(parseResult);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
return yield* effect.Effect.fail(new require_errors.PluginRuntimeError({
|
|
39
|
+
operation: "hydrate-secrets",
|
|
40
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
41
|
+
retryable: false
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}) };
|
|
45
|
+
}) }) {};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.SecretsConfigTag = SecretsConfigTag;
|
|
49
|
+
exports.SecretsService = SecretsService;
|
|
50
|
+
//# sourceMappingURL=secrets.service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.service.cjs","names":["z","Context","Effect","hydrated: Record<string, unknown>","hydrated","PluginRuntimeError"],"sources":["../../../src/runtime/services/secrets.service.ts"],"sourcesContent":["import { Context, Effect } from \"effect\";\nimport { z } from \"zod\";\nimport type { SecretsConfig } from \"../../types\";\nimport { PluginRuntimeError } from \"../errors\";\n\nconst configSchema = z.object({\n\tsecrets: z.record(z.string(), z.unknown())\n}).loose();\n\nexport class SecretsConfigTag extends Context.Tag(\"SecretsConfig\")<\n\tSecretsConfigTag,\n\tSecretsConfig\n>() { }\n\nexport class SecretsService extends Effect.Service<SecretsService>()(\"SecretsService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst secrets = yield* SecretsConfigTag;\n\n\t\tconst hydrateValue = (value: unknown): unknown => {\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tlet result = value;\n\t\t\t\tfor (const [key, secretValue] of Object.entries(secrets)) {\n\t\t\t\t\tconst pattern = new RegExp(`{{${key}}}`, \"g\");\n\t\t\t\t\tresult = result.replace(pattern, String(secretValue));\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\treturn value.map(hydrateValue);\n\t\t\t}\n\n\t\t\tif (value && typeof value === 'object') {\n\t\t\t\tconst isPlainObject = value.constructor === Object || value.constructor === undefined;\n\t\t\t\t\n\t\t\t\tif (isPlainObject) {\n\t\t\t\t\tconst hydrated: Record<string, unknown> = {};\n\t\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\t\thydrated[key] = hydrateValue(val);\n\t\t\t\t\t}\n\t\t\t\t\treturn hydrated;\n\t\t\t\t}\n\n\t\t\t\tconst hydrated = Object.create(Object.getPrototypeOf(value));\n\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\thydrated[key] = hydrateValue(val);\n\t\t\t\t}\n\t\t\t\treturn hydrated;\n\t\t\t}\n\n\t\t\treturn value;\n\t\t};\n\n\t\treturn {\n\t\t\thydrateSecrets: <T>(config: T) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst parseResult = configSchema.parse(config);\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn hydrateValue(parseResult) as T;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tnew PluginRuntimeError({\n\t\t\t\t\t\t\t\toperation: \"hydrate-secrets\",\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t\tretryable: false,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t};\n\t}),\n}) { }\n"],"mappings":";;;;;;AAKA,MAAM,eAAeA,MAAE,OAAO,EAC7B,SAASA,MAAE,OAAOA,MAAE,QAAQ,EAAEA,MAAE,SAAS,CAAC,EAC1C,CAAC,CAAC,OAAO;AAEV,IAAa,mBAAb,cAAsCC,eAAQ,IAAI,gBAAgB,EAG/D,CAAC;AAEJ,IAAa,iBAAb,cAAoCC,cAAO,SAAyB,CAAC,kBAAkB,EACtF,QAAQA,cAAO,IAAI,aAAa;CAC/B,MAAM,UAAU,OAAO;CAEvB,MAAM,gBAAgB,UAA4B;AACjD,MAAI,OAAO,UAAU,UAAU;GAC9B,IAAI,SAAS;AACb,QAAK,MAAM,CAAC,KAAK,gBAAgB,OAAO,QAAQ,QAAQ,EAAE;IACzD,MAAM,UAAU,IAAI,OAAO,KAAK,IAAI,KAAK,IAAI;AAC7C,aAAS,OAAO,QAAQ,SAAS,OAAO,YAAY,CAAC;;AAEtD,UAAO;;AAGR,MAAI,MAAM,QAAQ,MAAM,CACvB,QAAO,MAAM,IAAI,aAAa;AAG/B,MAAI,SAAS,OAAO,UAAU,UAAU;AAGvC,OAFsB,MAAM,gBAAgB,UAAU,MAAM,gBAAgB,QAEzD;IAClB,MAAMC,aAAoC,EAAE;AAC5C,SAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC7C,YAAS,OAAO,aAAa,IAAI;AAElC,WAAOC;;GAGR,MAAM,WAAW,OAAO,OAAO,OAAO,eAAe,MAAM,CAAC;AAC5D,QAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC7C,UAAS,OAAO,aAAa,IAAI;AAElC,UAAO;;AAGR,SAAO;;AAGR,QAAO,EACN,iBAAoB,WACnBF,cAAO,IAAI,aAAa;EACvB,MAAM,cAAc,aAAa,MAAM,OAAO;AAC9C,MAAI;AACH,UAAO,aAAa,YAAY;WACxB,OAAO;AACf,UAAO,OAAOA,cAAO,KACpB,IAAIG,kCAAmB;IACtB,WAAW;IACX,OACC,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;IAC1D,WAAW;IACX,CAAC,CACF;;GAED,EACH;EACA,EACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SecretsConfig } from "../../types.cjs";
|
|
2
|
+
import { PluginRuntimeError } from "../errors.cjs";
|
|
3
|
+
import { Context, Effect } from "effect";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/services/secrets.service.d.ts
|
|
6
|
+
declare const SecretsConfigTag_base: Context.TagClass<SecretsConfigTag, "SecretsConfig", SecretsConfig>;
|
|
7
|
+
declare class SecretsConfigTag extends SecretsConfigTag_base {}
|
|
8
|
+
declare const SecretsService_base: Effect.Service.Class<SecretsService, "SecretsService", {
|
|
9
|
+
readonly effect: Effect.Effect<{
|
|
10
|
+
hydrateSecrets: <T>(config: T) => Effect.Effect<T, PluginRuntimeError, never>;
|
|
11
|
+
}, never, SecretsConfigTag>;
|
|
12
|
+
}>;
|
|
13
|
+
declare class SecretsService extends SecretsService_base {}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SecretsService };
|
|
16
|
+
//# sourceMappingURL=secrets.service.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.service.d.cts","names":[],"sources":["../../../src/runtime/services/secrets.service.ts"],"sourcesContent":[],"mappings":";;;;;cAG+C;cAMlC,gBAAA,SAAyB,qBAAA;cAG/B;;gCA0CwB,MAAC,MAAA,CAAA,OAAA,GAAA;;AA7ChC,CAAA,CAAA;AAGO,cAEM,cAAA,SAAuB,mBAAA,CAF7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SecretsConfig } from "../../types.mjs";
|
|
2
|
+
import { PluginRuntimeError } from "../errors.mjs";
|
|
3
|
+
import { Context, Effect } from "effect";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/services/secrets.service.d.ts
|
|
6
|
+
declare const SecretsConfigTag_base: Context.TagClass<SecretsConfigTag, "SecretsConfig", SecretsConfig>;
|
|
7
|
+
declare class SecretsConfigTag extends SecretsConfigTag_base {}
|
|
8
|
+
declare const SecretsService_base: Effect.Service.Class<SecretsService, "SecretsService", {
|
|
9
|
+
readonly effect: Effect.Effect<{
|
|
10
|
+
hydrateSecrets: <T>(config: T) => Effect.Effect<T, PluginRuntimeError, never>;
|
|
11
|
+
}, never, SecretsConfigTag>;
|
|
12
|
+
}>;
|
|
13
|
+
declare class SecretsService extends SecretsService_base {}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SecretsService };
|
|
16
|
+
//# sourceMappingURL=secrets.service.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.service.d.mts","names":[],"sources":["../../../src/runtime/services/secrets.service.ts"],"sourcesContent":[],"mappings":";;;;;cAG+C;cAMlC,gBAAA,SAAyB,qBAAA;cAG/B;;gCA0CwB,MAAC,MAAA,CAAA,OAAA,GAAA;;AA7ChC,CAAA,CAAA;AAGO,cAEM,cAAA,SAAuB,mBAAA,CAF7B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PluginRuntimeError } from "../errors.mjs";
|
|
2
|
+
import { Context, Effect } from "effect";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/services/secrets.service.ts
|
|
6
|
+
const configSchema = z.object({ secrets: z.record(z.string(), z.unknown()) }).loose();
|
|
7
|
+
var SecretsConfigTag = class extends Context.Tag("SecretsConfig")() {};
|
|
8
|
+
var SecretsService = class extends Effect.Service()("SecretsService", { effect: Effect.gen(function* () {
|
|
9
|
+
const secrets = yield* SecretsConfigTag;
|
|
10
|
+
const hydrateValue = (value) => {
|
|
11
|
+
if (typeof value === "string") {
|
|
12
|
+
let result = value;
|
|
13
|
+
for (const [key, secretValue] of Object.entries(secrets)) {
|
|
14
|
+
const pattern = new RegExp(`{{${key}}}`, "g");
|
|
15
|
+
result = result.replace(pattern, String(secretValue));
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(value)) return value.map(hydrateValue);
|
|
20
|
+
if (value && typeof value === "object") {
|
|
21
|
+
if (value.constructor === Object || value.constructor === void 0) {
|
|
22
|
+
const hydrated$1 = {};
|
|
23
|
+
for (const [key, val] of Object.entries(value)) hydrated$1[key] = hydrateValue(val);
|
|
24
|
+
return hydrated$1;
|
|
25
|
+
}
|
|
26
|
+
const hydrated = Object.create(Object.getPrototypeOf(value));
|
|
27
|
+
for (const [key, val] of Object.entries(value)) hydrated[key] = hydrateValue(val);
|
|
28
|
+
return hydrated;
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
32
|
+
return { hydrateSecrets: (config) => Effect.gen(function* () {
|
|
33
|
+
const parseResult = configSchema.parse(config);
|
|
34
|
+
try {
|
|
35
|
+
return hydrateValue(parseResult);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return yield* Effect.fail(new PluginRuntimeError({
|
|
38
|
+
operation: "hydrate-secrets",
|
|
39
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
40
|
+
retryable: false
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}) };
|
|
44
|
+
}) }) {};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { SecretsConfigTag, SecretsService };
|
|
48
|
+
//# sourceMappingURL=secrets.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.service.mjs","names":["hydrated: Record<string, unknown>","hydrated"],"sources":["../../../src/runtime/services/secrets.service.ts"],"sourcesContent":["import { Context, Effect } from \"effect\";\nimport { z } from \"zod\";\nimport type { SecretsConfig } from \"../../types\";\nimport { PluginRuntimeError } from \"../errors\";\n\nconst configSchema = z.object({\n\tsecrets: z.record(z.string(), z.unknown())\n}).loose();\n\nexport class SecretsConfigTag extends Context.Tag(\"SecretsConfig\")<\n\tSecretsConfigTag,\n\tSecretsConfig\n>() { }\n\nexport class SecretsService extends Effect.Service<SecretsService>()(\"SecretsService\", {\n\teffect: Effect.gen(function* () {\n\t\tconst secrets = yield* SecretsConfigTag;\n\n\t\tconst hydrateValue = (value: unknown): unknown => {\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tlet result = value;\n\t\t\t\tfor (const [key, secretValue] of Object.entries(secrets)) {\n\t\t\t\t\tconst pattern = new RegExp(`{{${key}}}`, \"g\");\n\t\t\t\t\tresult = result.replace(pattern, String(secretValue));\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\treturn value.map(hydrateValue);\n\t\t\t}\n\n\t\t\tif (value && typeof value === 'object') {\n\t\t\t\tconst isPlainObject = value.constructor === Object || value.constructor === undefined;\n\t\t\t\t\n\t\t\t\tif (isPlainObject) {\n\t\t\t\t\tconst hydrated: Record<string, unknown> = {};\n\t\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\t\thydrated[key] = hydrateValue(val);\n\t\t\t\t\t}\n\t\t\t\t\treturn hydrated;\n\t\t\t\t}\n\n\t\t\t\tconst hydrated = Object.create(Object.getPrototypeOf(value));\n\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\thydrated[key] = hydrateValue(val);\n\t\t\t\t}\n\t\t\t\treturn hydrated;\n\t\t\t}\n\n\t\t\treturn value;\n\t\t};\n\n\t\treturn {\n\t\t\thydrateSecrets: <T>(config: T) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst parseResult = configSchema.parse(config);\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn hydrateValue(parseResult) as T;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tnew PluginRuntimeError({\n\t\t\t\t\t\t\t\toperation: \"hydrate-secrets\",\n\t\t\t\t\t\t\t\tcause:\n\t\t\t\t\t\t\t\t\terror instanceof Error ? error : new Error(String(error)),\n\t\t\t\t\t\t\t\tretryable: false,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t};\n\t}),\n}) { }\n"],"mappings":";;;;;AAKA,MAAM,eAAe,EAAE,OAAO,EAC7B,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,EAC1C,CAAC,CAAC,OAAO;AAEV,IAAa,mBAAb,cAAsC,QAAQ,IAAI,gBAAgB,EAG/D,CAAC;AAEJ,IAAa,iBAAb,cAAoC,OAAO,SAAyB,CAAC,kBAAkB,EACtF,QAAQ,OAAO,IAAI,aAAa;CAC/B,MAAM,UAAU,OAAO;CAEvB,MAAM,gBAAgB,UAA4B;AACjD,MAAI,OAAO,UAAU,UAAU;GAC9B,IAAI,SAAS;AACb,QAAK,MAAM,CAAC,KAAK,gBAAgB,OAAO,QAAQ,QAAQ,EAAE;IACzD,MAAM,UAAU,IAAI,OAAO,KAAK,IAAI,KAAK,IAAI;AAC7C,aAAS,OAAO,QAAQ,SAAS,OAAO,YAAY,CAAC;;AAEtD,UAAO;;AAGR,MAAI,MAAM,QAAQ,MAAM,CACvB,QAAO,MAAM,IAAI,aAAa;AAG/B,MAAI,SAAS,OAAO,UAAU,UAAU;AAGvC,OAFsB,MAAM,gBAAgB,UAAU,MAAM,gBAAgB,QAEzD;IAClB,MAAMA,aAAoC,EAAE;AAC5C,SAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC7C,YAAS,OAAO,aAAa,IAAI;AAElC,WAAOC;;GAGR,MAAM,WAAW,OAAO,OAAO,OAAO,eAAe,MAAM,CAAC;AAC5D,QAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC7C,UAAS,OAAO,aAAa,IAAI;AAElC,UAAO;;AAGR,SAAO;;AAGR,QAAO,EACN,iBAAoB,WACnB,OAAO,IAAI,aAAa;EACvB,MAAM,cAAc,aAAa,MAAM,OAAO;AAC9C,MAAI;AACH,UAAO,aAAa,YAAY;WACxB,OAAO;AACf,UAAO,OAAO,OAAO,KACpB,IAAI,mBAAmB;IACtB,WAAW;IACX,OACC,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;IAC1D,WAAW;IACX,CAAC,CACF;;GAED,EACH;EACA,EACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_errors = require('./errors.cjs');
|
|
3
|
+
let effect = require("effect");
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/validation.ts
|
|
6
|
+
const validate = (schema, data, pluginId, stage) => effect.Effect.gen(function* () {
|
|
7
|
+
const result = schema.safeParse(data);
|
|
8
|
+
if (result.success) return result.data;
|
|
9
|
+
return yield* effect.Effect.fail(new require_errors.ValidationError({
|
|
10
|
+
pluginId,
|
|
11
|
+
stage,
|
|
12
|
+
zodError: result.error
|
|
13
|
+
}));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.validate = validate;
|
|
18
|
+
//# sourceMappingURL=validation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.cjs","names":["Effect","ValidationError"],"sources":["../../src/runtime/validation.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport type { z } from \"zod\";\nimport { ValidationError } from \"./errors\";\n\nexport const validate = <T>(\n\tschema: z.ZodSchema<T>,\n\tdata: unknown,\n\tpluginId: string,\n\tstage: \"config\" | \"input\" | \"output\" | \"state\",\n): Effect.Effect<T, ValidationError> =>\n\tEffect.gen(function* () {\n\t\tconst result = schema.safeParse(data);\n\t\tif (result.success) {\n\t\t\treturn result.data;\n\t\t}\n\t\treturn yield* Effect.fail(\n\t\t\tnew ValidationError({\n\t\t\t\tpluginId,\n\t\t\t\tstage,\n\t\t\t\tzodError: result.error,\n\t\t\t}),\n\t\t);\n\t});\n"],"mappings":";;;;;AAIA,MAAa,YACZ,QACA,MACA,UACA,UAEAA,cAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,UAAU,KAAK;AACrC,KAAI,OAAO,QACV,QAAO,OAAO;AAEf,QAAO,OAAOA,cAAO,KACpB,IAAIC,+BAAgB;EACnB;EACA;EACA,UAAU,OAAO;EACjB,CAAC,CACF;EACA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationError } from "./errors.mjs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/validation.ts
|
|
5
|
+
const validate = (schema, data, pluginId, stage) => Effect.gen(function* () {
|
|
6
|
+
const result = schema.safeParse(data);
|
|
7
|
+
if (result.success) return result.data;
|
|
8
|
+
return yield* Effect.fail(new ValidationError({
|
|
9
|
+
pluginId,
|
|
10
|
+
stage,
|
|
11
|
+
zodError: result.error
|
|
12
|
+
}));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { validate };
|
|
17
|
+
//# sourceMappingURL=validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.mjs","names":[],"sources":["../../src/runtime/validation.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport type { z } from \"zod\";\nimport { ValidationError } from \"./errors\";\n\nexport const validate = <T>(\n\tschema: z.ZodSchema<T>,\n\tdata: unknown,\n\tpluginId: string,\n\tstage: \"config\" | \"input\" | \"output\" | \"state\",\n): Effect.Effect<T, ValidationError> =>\n\tEffect.gen(function* () {\n\t\tconst result = schema.safeParse(data);\n\t\tif (result.success) {\n\t\t\treturn result.data;\n\t\t}\n\t\treturn yield* Effect.fail(\n\t\t\tnew ValidationError({\n\t\t\t\tpluginId,\n\t\t\t\tstage,\n\t\t\t\tzodError: result.error,\n\t\t\t}),\n\t\t);\n\t});\n"],"mappings":";;;;AAIA,MAAa,YACZ,QACA,MACA,UACA,UAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,UAAU,KAAK;AACrC,KAAI,OAAO,QACV,QAAO,OAAO;AAEf,QAAO,OAAO,OAAO,KACpB,IAAI,gBAAgB;EACnB;EACA;EACA,UAAU,OAAO;EACjB,CAAC,CACF;EACA"}
|
package/dist/testing/index.cjs
CHANGED
|
@@ -1,78 +1,56 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_runtime = require('../runtime-BTFJzoBu.cjs');
|
|
3
|
-
require('../normalize-D4Qh0wVk.cjs');
|
|
4
|
-
require('../package-D4mbTFY1.cjs');
|
|
5
|
-
let effect = require("effect");
|
|
1
|
+
const require_runtime_index = require('../runtime/index.cjs');
|
|
6
2
|
|
|
7
|
-
//#region src/testing/mocks/module-federation.service.ts
|
|
8
|
-
const createMockModuleFederationServiceLayer = (pluginMap) => effect.Layer.succeed(require_runtime.ModuleFederationService, {
|
|
9
|
-
registerRemote: (pluginId, url) => effect.Effect.gen(function* () {
|
|
10
|
-
console.log(`[MOCK] registerRemote called for ${pluginId}`);
|
|
11
|
-
if (!(pluginId in pluginMap)) return yield* effect.Effect.fail(new require_runtime.ModuleFederationError({
|
|
12
|
-
pluginId,
|
|
13
|
-
remoteUrl: url,
|
|
14
|
-
cause: /* @__PURE__ */ new Error(`Mock: Plugin ${pluginId} not available in test plugin map`)
|
|
15
|
-
}));
|
|
16
|
-
console.log(`[MOCK] registerRemote succeeded for ${pluginId}`);
|
|
17
|
-
}),
|
|
18
|
-
loadRemoteConstructor: (pluginId, url) => effect.Effect.gen(function* () {
|
|
19
|
-
console.log(`[MOCK] loadRemoteConstructor called for ${pluginId}`);
|
|
20
|
-
const PluginConstructor = pluginMap[pluginId];
|
|
21
|
-
if (!PluginConstructor) return yield* effect.Effect.fail(new require_runtime.ModuleFederationError({
|
|
22
|
-
pluginId,
|
|
23
|
-
remoteUrl: url,
|
|
24
|
-
cause: /* @__PURE__ */ new Error(`Mock: Constructor for ${pluginId} not found in test plugin map`)
|
|
25
|
-
}));
|
|
26
|
-
console.log(`[MOCK] loadRemoteConstructor succeeded for ${pluginId}`);
|
|
27
|
-
return PluginConstructor;
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
3
|
//#region src/testing/index.ts
|
|
33
4
|
/**
|
|
34
|
-
*
|
|
35
|
-
* This mirrors PluginService.Live() but uses mock ModuleFederationService.
|
|
5
|
+
* Converts old pluginMap format to new registry format
|
|
36
6
|
*/
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
7
|
+
function convertPluginMapToRegistry(oldRegistry, pluginMap) {
|
|
8
|
+
const registry = {};
|
|
9
|
+
for (const [pluginId, ctor] of Object.entries(pluginMap)) {
|
|
10
|
+
const oldEntry = oldRegistry[pluginId];
|
|
11
|
+
registry[pluginId] = {
|
|
12
|
+
module: ctor,
|
|
13
|
+
remote: oldEntry?.remoteUrl,
|
|
14
|
+
version: oldEntry?.version,
|
|
15
|
+
description: oldEntry?.description
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return registry;
|
|
19
|
+
}
|
|
44
20
|
/**
|
|
45
21
|
* Creates a plugin runtime for locally available plugins (non-remote).
|
|
46
22
|
* Automatically infers type bindings from the plugin map, eliminating
|
|
47
23
|
* the need for manual RegistryBindings definitions.
|
|
48
24
|
*
|
|
49
|
-
*
|
|
50
|
-
* - Unit and integration tests
|
|
51
|
-
* - Local development and debugging
|
|
52
|
-
* - Monorepo setups where all plugins are in the same workspace
|
|
53
|
-
*
|
|
54
|
-
* For production with remote Module Federation plugins, use createPluginRuntime().
|
|
55
|
-
*
|
|
25
|
+
* @deprecated Use `createPluginRuntime` with module entries directly instead.
|
|
56
26
|
* @example
|
|
57
27
|
* ```ts
|
|
58
|
-
*
|
|
59
|
-
* const runtime = createLocalPluginRuntime(
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
28
|
+
* // Old API (deprecated)
|
|
29
|
+
* const runtime = createLocalPluginRuntime(
|
|
30
|
+
* { registry: { "my-plugin": { remoteUrl: "..." } }, secrets },
|
|
31
|
+
* { "my-plugin": MyPlugin }
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* // New API (recommended)
|
|
35
|
+
* const runtime = createPluginRuntime({
|
|
36
|
+
* registry: { "my-plugin": { module: MyPlugin } },
|
|
37
|
+
* secrets
|
|
38
|
+
* });
|
|
63
39
|
* ```
|
|
64
40
|
*/
|
|
65
41
|
function createLocalPluginRuntime(config, pluginMap) {
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
return require_runtime_index.createPluginRuntime({
|
|
43
|
+
registry: convertPluginMapToRegistry(config.registry, pluginMap),
|
|
44
|
+
secrets: config.secrets,
|
|
45
|
+
options: config.options
|
|
46
|
+
});
|
|
68
47
|
}
|
|
69
48
|
/**
|
|
70
|
-
* @deprecated Use `createLocalPluginRuntime`
|
|
49
|
+
* @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.
|
|
71
50
|
*/
|
|
72
51
|
const createTestPluginRuntime = createLocalPluginRuntime;
|
|
73
52
|
|
|
74
53
|
//#endregion
|
|
75
54
|
exports.createLocalPluginRuntime = createLocalPluginRuntime;
|
|
76
|
-
exports.createTestLayer = createTestLayer;
|
|
77
55
|
exports.createTestPluginRuntime = createTestPluginRuntime;
|
|
78
56
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["registry: Record<string, PluginRegistryEntry>","createPluginRuntime"],"sources":["../../src/testing/index.ts"],"sourcesContent":["import type { AnyPluginConstructor, InferRegistryFromEntries, PluginRegistryEntry, PluginRuntimeConfig } from \"../types\";\nimport { createPluginRuntime } from \"../runtime\";\nimport type { LoadedPluginWithBinding } from \"../plugin\";\n\nexport type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;\n\n/**\n * Simplified type inference for local plugin maps.\n * Just use the constructor types directly.\n *\n * @example\n * ```ts\n * const pluginMap = { \"my-plugin\": MyPlugin } as const;\n * type MyBindings = InferBindingsFromMap<typeof pluginMap>;\n * ```\n */\nexport type InferBindingsFromMap<T extends PluginMap> = {\n\t[K in keyof T]: T[K]\n};\n\n/**\n * Converts old pluginMap format to new registry format\n */\nfunction convertPluginMapToRegistry<T extends PluginMap>(\n\toldRegistry: Record<string, { remoteUrl: string; version?: string; description?: string }>,\n\tpluginMap: T\n): Record<keyof T, PluginRegistryEntry> {\n\tconst registry: Record<string, PluginRegistryEntry> = {};\n\t\n\tfor (const [pluginId, ctor] of Object.entries(pluginMap)) {\n\t\tconst oldEntry = oldRegistry[pluginId];\n\t\tregistry[pluginId] = {\n\t\t\tmodule: ctor as AnyPluginConstructor,\n\t\t\tremote: oldEntry?.remoteUrl,\n\t\t\tversion: oldEntry?.version,\n\t\t\tdescription: oldEntry?.description,\n\t\t};\n\t}\n\t\n\treturn registry as Record<keyof T, PluginRegistryEntry>;\n}\n\n/**\n * Creates a plugin runtime for locally available plugins (non-remote).\n * Automatically infers type bindings from the plugin map, eliminating\n * the need for manual RegistryBindings definitions.\n *\n * @deprecated Use `createPluginRuntime` with module entries directly instead.\n * @example\n * ```ts\n * // Old API (deprecated)\n * const runtime = createLocalPluginRuntime(\n * { registry: { \"my-plugin\": { remoteUrl: \"...\" } }, secrets },\n * { \"my-plugin\": MyPlugin }\n * );\n * \n * // New API (recommended)\n * const runtime = createPluginRuntime({\n * registry: { \"my-plugin\": { module: MyPlugin } },\n * secrets\n * });\n * ```\n */\nexport function createLocalPluginRuntime<TMap extends PluginMap>(\n\tconfig: {\n\t\tregistry: Record<string, { remoteUrl: string; version?: string; description?: string }>;\n\t\tsecrets?: Record<string, string>;\n\t\toptions?: any;\n\t},\n\tpluginMap: TMap\n) {\n\tconst newRegistry = convertPluginMapToRegistry(config.registry, pluginMap);\n\t\n\treturn createPluginRuntime({\n\t\tregistry: newRegistry,\n\t\tsecrets: config.secrets,\n\t\toptions: config.options,\n\t});\n}\n\n/**\n * @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.\n */\nexport const createTestPluginRuntime = createLocalPluginRuntime;\n\nexport type { EveryPlugin, PluginRegistry, RegisteredPlugins } from \"../types\";\nexport type { PluginRuntimeConfig };\n"],"mappings":";;;;;;AAuBA,SAAS,2BACR,aACA,WACuC;CACvC,MAAMA,WAAgD,EAAE;AAExD,MAAK,MAAM,CAAC,UAAU,SAAS,OAAO,QAAQ,UAAU,EAAE;EACzD,MAAM,WAAW,YAAY;AAC7B,WAAS,YAAY;GACpB,QAAQ;GACR,QAAQ,UAAU;GAClB,SAAS,UAAU;GACnB,aAAa,UAAU;GACvB;;AAGF,QAAO;;;;;;;;;;;;;;;;;;;;;;;AAwBR,SAAgB,yBACf,QAKA,WACC;AAGD,QAAOC,0CAAoB;EAC1B,UAHmB,2BAA2B,OAAO,UAAU,UAAU;EAIzE,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,CAAC;;;;;AAMH,MAAa,0BAA0B"}
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
5
|
-
import { Layer } from "effect";
|
|
1
|
+
import { LoadedPluginWithBinding } from "../plugin.cjs";
|
|
2
|
+
import { EveryPlugin, InferRegistryFromEntries, PluginRegistry, PluginRegistryEntry, PluginRuntimeConfig, RegisteredPlugins } from "../types.cjs";
|
|
3
|
+
import { PluginRuntime } from "../runtime/index.cjs";
|
|
4
|
+
import "../index.cjs";
|
|
6
5
|
|
|
7
|
-
//#region src/testing/mocks/module-federation.service.d.ts
|
|
8
|
-
type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;
|
|
9
|
-
//#endregion
|
|
10
6
|
//#region src/testing/index.d.ts
|
|
11
|
-
|
|
12
|
-
* Validates that all plugin map keys exist in RegisteredPlugins.
|
|
13
|
-
* This ensures proper type inference for client methods.
|
|
14
|
-
*/
|
|
15
|
-
type ValidatePluginMap<T extends PluginMap> = { [K in keyof T]: K extends keyof RegisteredPlugins ? T[K] : `❌ Plugin key "${K & string}" not registered in RegisteredPlugins. Add it to your types.d.ts file.` };
|
|
7
|
+
type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;
|
|
16
8
|
/**
|
|
17
9
|
* Simplified type inference for local plugin maps.
|
|
18
10
|
* Just use the constructor types directly.
|
|
@@ -23,38 +15,41 @@ type ValidatePluginMap<T extends PluginMap> = { [K in keyof T]: K extends keyof
|
|
|
23
15
|
* type MyBindings = InferBindingsFromMap<typeof pluginMap>;
|
|
24
16
|
* ```
|
|
25
17
|
*/
|
|
26
|
-
type InferBindingsFromMap<T extends PluginMap> = { [K in keyof T]: T[K] }
|
|
27
|
-
/**
|
|
28
|
-
* Creates a test layer with mock ModuleFederationService for unit testing.
|
|
29
|
-
* This mirrors PluginService.Live() but uses mock ModuleFederationService.
|
|
30
|
-
*/
|
|
31
|
-
declare const createTestLayer: <R extends RegisteredPlugins = RegisteredPlugins>(config: PluginRuntimeConfig<R>, pluginMap: PluginMap) => Layer.Layer<PluginService, never, never>;
|
|
18
|
+
type InferBindingsFromMap<T extends PluginMap> = { [K in keyof T]: T[K] };
|
|
32
19
|
/**
|
|
33
20
|
* Creates a plugin runtime for locally available plugins (non-remote).
|
|
34
21
|
* Automatically infers type bindings from the plugin map, eliminating
|
|
35
22
|
* the need for manual RegistryBindings definitions.
|
|
36
23
|
*
|
|
37
|
-
*
|
|
38
|
-
* - Unit and integration tests
|
|
39
|
-
* - Local development and debugging
|
|
40
|
-
* - Monorepo setups where all plugins are in the same workspace
|
|
41
|
-
*
|
|
42
|
-
* For production with remote Module Federation plugins, use createPluginRuntime().
|
|
43
|
-
*
|
|
24
|
+
* @deprecated Use `createPluginRuntime` with module entries directly instead.
|
|
44
25
|
* @example
|
|
45
26
|
* ```ts
|
|
46
|
-
*
|
|
47
|
-
* const runtime = createLocalPluginRuntime(
|
|
27
|
+
* // Old API (deprecated)
|
|
28
|
+
* const runtime = createLocalPluginRuntime(
|
|
29
|
+
* { registry: { "my-plugin": { remoteUrl: "..." } }, secrets },
|
|
30
|
+
* { "my-plugin": MyPlugin }
|
|
31
|
+
* );
|
|
48
32
|
*
|
|
49
|
-
* //
|
|
50
|
-
* const
|
|
33
|
+
* // New API (recommended)
|
|
34
|
+
* const runtime = createPluginRuntime({
|
|
35
|
+
* registry: { "my-plugin": { module: MyPlugin } },
|
|
36
|
+
* secrets
|
|
37
|
+
* });
|
|
51
38
|
* ```
|
|
52
39
|
*/
|
|
53
|
-
declare function createLocalPluginRuntime<TMap extends PluginMap
|
|
40
|
+
declare function createLocalPluginRuntime<TMap extends PluginMap>(config: {
|
|
41
|
+
registry: Record<string, {
|
|
42
|
+
remoteUrl: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}>;
|
|
46
|
+
secrets?: Record<string, string>;
|
|
47
|
+
options?: any;
|
|
48
|
+
}, pluginMap: TMap): PluginRuntime<InferRegistryFromEntries<Record<keyof TMap, PluginRegistryEntry>>>;
|
|
54
49
|
/**
|
|
55
|
-
* @deprecated Use `createLocalPluginRuntime`
|
|
50
|
+
* @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.
|
|
56
51
|
*/
|
|
57
52
|
declare const createTestPluginRuntime: typeof createLocalPluginRuntime;
|
|
58
53
|
//#endregion
|
|
59
|
-
export { type EveryPlugin, InferBindingsFromMap,
|
|
54
|
+
export { type EveryPlugin, InferBindingsFromMap, PluginMap, type PluginRegistry, type PluginRuntimeConfig, type RegisteredPlugins, createLocalPluginRuntime, createTestPluginRuntime };
|
|
60
55
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/testing/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/testing/index.ts"],"sourcesContent":[],"mappings":";;;;;;KAIY,SAAA,GAAY,eAAe;;;;AAAvC;AAYA;;;;;;AA+CgB,KA/CJ,oBA+C4B,CAAA,UA/CG,SA+CH,CAAA,GAAA,QAAc,MA9CzC,CA8CyC,GA9CrC,CA8CqC,CA9CnC,CA8CmC,CAAA,EAE1C;;;;;;;;;AAkBZ;;;;;;;;;;;;;iBApBgB,sCAAsC;YAE1C;;;;;YACA;;cAGA,OAAI,cAAA,yBAAA,aAAA,MAAA;;;;cAcH,gCAAuB"}
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import {
|
|
4
|
-
import "../
|
|
5
|
-
import { Layer } from "effect";
|
|
1
|
+
import { LoadedPluginWithBinding } from "../plugin.mjs";
|
|
2
|
+
import { EveryPlugin, InferRegistryFromEntries, PluginRegistry, PluginRegistryEntry, PluginRuntimeConfig, RegisteredPlugins } from "../types.mjs";
|
|
3
|
+
import { PluginRuntime } from "../runtime/index.mjs";
|
|
4
|
+
import "../index.mjs";
|
|
6
5
|
|
|
7
|
-
//#region src/testing/mocks/module-federation.service.d.ts
|
|
8
|
-
type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;
|
|
9
|
-
//#endregion
|
|
10
6
|
//#region src/testing/index.d.ts
|
|
11
|
-
|
|
12
|
-
* Validates that all plugin map keys exist in RegisteredPlugins.
|
|
13
|
-
* This ensures proper type inference for client methods.
|
|
14
|
-
*/
|
|
15
|
-
type ValidatePluginMap<T extends PluginMap> = { [K in keyof T]: K extends keyof RegisteredPlugins ? T[K] : `❌ Plugin key "${K & string}" not registered in RegisteredPlugins. Add it to your types.d.ts file.` };
|
|
7
|
+
type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;
|
|
16
8
|
/**
|
|
17
9
|
* Simplified type inference for local plugin maps.
|
|
18
10
|
* Just use the constructor types directly.
|
|
@@ -23,38 +15,41 @@ type ValidatePluginMap<T extends PluginMap> = { [K in keyof T]: K extends keyof
|
|
|
23
15
|
* type MyBindings = InferBindingsFromMap<typeof pluginMap>;
|
|
24
16
|
* ```
|
|
25
17
|
*/
|
|
26
|
-
type InferBindingsFromMap<T extends PluginMap> = { [K in keyof T]: T[K] }
|
|
27
|
-
/**
|
|
28
|
-
* Creates a test layer with mock ModuleFederationService for unit testing.
|
|
29
|
-
* This mirrors PluginService.Live() but uses mock ModuleFederationService.
|
|
30
|
-
*/
|
|
31
|
-
declare const createTestLayer: <R extends RegisteredPlugins = RegisteredPlugins>(config: PluginRuntimeConfig<R>, pluginMap: PluginMap) => Layer.Layer<PluginService, never, never>;
|
|
18
|
+
type InferBindingsFromMap<T extends PluginMap> = { [K in keyof T]: T[K] };
|
|
32
19
|
/**
|
|
33
20
|
* Creates a plugin runtime for locally available plugins (non-remote).
|
|
34
21
|
* Automatically infers type bindings from the plugin map, eliminating
|
|
35
22
|
* the need for manual RegistryBindings definitions.
|
|
36
23
|
*
|
|
37
|
-
*
|
|
38
|
-
* - Unit and integration tests
|
|
39
|
-
* - Local development and debugging
|
|
40
|
-
* - Monorepo setups where all plugins are in the same workspace
|
|
41
|
-
*
|
|
42
|
-
* For production with remote Module Federation plugins, use createPluginRuntime().
|
|
43
|
-
*
|
|
24
|
+
* @deprecated Use `createPluginRuntime` with module entries directly instead.
|
|
44
25
|
* @example
|
|
45
26
|
* ```ts
|
|
46
|
-
*
|
|
47
|
-
* const runtime = createLocalPluginRuntime(
|
|
27
|
+
* // Old API (deprecated)
|
|
28
|
+
* const runtime = createLocalPluginRuntime(
|
|
29
|
+
* { registry: { "my-plugin": { remoteUrl: "..." } }, secrets },
|
|
30
|
+
* { "my-plugin": MyPlugin }
|
|
31
|
+
* );
|
|
48
32
|
*
|
|
49
|
-
* //
|
|
50
|
-
* const
|
|
33
|
+
* // New API (recommended)
|
|
34
|
+
* const runtime = createPluginRuntime({
|
|
35
|
+
* registry: { "my-plugin": { module: MyPlugin } },
|
|
36
|
+
* secrets
|
|
37
|
+
* });
|
|
51
38
|
* ```
|
|
52
39
|
*/
|
|
53
|
-
declare function createLocalPluginRuntime<TMap extends PluginMap
|
|
40
|
+
declare function createLocalPluginRuntime<TMap extends PluginMap>(config: {
|
|
41
|
+
registry: Record<string, {
|
|
42
|
+
remoteUrl: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}>;
|
|
46
|
+
secrets?: Record<string, string>;
|
|
47
|
+
options?: any;
|
|
48
|
+
}, pluginMap: TMap): PluginRuntime<InferRegistryFromEntries<Record<keyof TMap, PluginRegistryEntry>>>;
|
|
54
49
|
/**
|
|
55
|
-
* @deprecated Use `createLocalPluginRuntime`
|
|
50
|
+
* @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.
|
|
56
51
|
*/
|
|
57
52
|
declare const createTestPluginRuntime: typeof createLocalPluginRuntime;
|
|
58
53
|
//#endregion
|
|
59
|
-
export { type EveryPlugin, InferBindingsFromMap,
|
|
54
|
+
export { type EveryPlugin, InferBindingsFromMap, PluginMap, type PluginRegistry, type PluginRuntimeConfig, type RegisteredPlugins, createLocalPluginRuntime, createTestPluginRuntime };
|
|
60
55
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/testing/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/testing/index.ts"],"sourcesContent":[],"mappings":";;;;;;KAIY,SAAA,GAAY,eAAe;;;;AAAvC;AAYA;;;;;;AA+CgB,KA/CJ,oBA+C4B,CAAA,UA/CG,SA+CH,CAAA,GAAA,QAAc,MA9CzC,CA8CyC,GA9CrC,CA8CqC,CA9CnC,CA8CmC,CAAA,EAE1C;;;;;;;;;AAkBZ;;;;;;;;;;;;;iBApBgB,sCAAsC;YAE1C;;;;;YACA;;cAGA,OAAI,cAAA,yBAAA,aAAA,MAAA;;;;cAcH,gCAAuB"}
|