every-plugin 0.1.6 → 0.2.0

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 (35) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/plugin.d.ts +0 -2
  4. package/dist/plugin.d.ts.map +1 -1
  5. package/dist/plugin.js +0 -1
  6. package/dist/runtime/index.d.ts +15 -35
  7. package/dist/runtime/index.d.ts.map +1 -1
  8. package/dist/runtime/index.js +55 -68
  9. package/dist/runtime/services/module-federation.service.d.ts +7 -11
  10. package/dist/runtime/services/module-federation.service.d.ts.map +1 -1
  11. package/dist/runtime/services/module-federation.service.js +7 -9
  12. package/dist/runtime/services/plugin-lifecycle.service.d.ts +9 -12
  13. package/dist/runtime/services/plugin-lifecycle.service.d.ts.map +1 -1
  14. package/dist/runtime/services/plugin-lifecycle.service.js +5 -6
  15. package/dist/runtime/services/plugin-loader.service.d.ts +50 -13
  16. package/dist/runtime/services/plugin-loader.service.d.ts.map +1 -1
  17. package/dist/runtime/services/plugin-loader.service.js +25 -15
  18. package/dist/runtime/services/plugin.service.d.ts +41 -17
  19. package/dist/runtime/services/plugin.service.d.ts.map +1 -1
  20. package/dist/runtime/services/plugin.service.js +13 -7
  21. package/dist/runtime/services/secrets.service.d.ts +8 -9
  22. package/dist/runtime/services/secrets.service.d.ts.map +1 -1
  23. package/dist/runtime/services/secrets.service.js +28 -27
  24. package/dist/runtime/services.d.ts +3 -1
  25. package/dist/runtime/services.d.ts.map +1 -1
  26. package/dist/runtime/services.js +3 -1
  27. package/dist/testing/index.d.ts +45 -12
  28. package/dist/testing/index.d.ts.map +1 -1
  29. package/dist/testing/index.js +34 -27
  30. package/dist/testing/mocks/module-federation.service.d.ts +3 -5
  31. package/dist/testing/mocks/module-federation.service.d.ts.map +1 -1
  32. package/dist/testing/mocks/module-federation.service.js +18 -24
  33. package/dist/types.d.ts +21 -8
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +4 -1
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export * from "./errors";
2
2
  export * from "./plugin";
3
3
  export * from "./runtime";
4
4
  export { getNormalizedRemoteName } from "./runtime/services/normalize";
5
- export type { AnyPlugin, ConfigOf, InitializedPlugin, PluginConstructor, PluginInstance, PluginOf, PluginRegistry, PluginRegistryFor, PluginRuntimeConfig, RegistryBindings, RouterOf, SecretsConfig } from "./types";
5
+ export type { AnyPlugin, ConfigOf, InitializedPlugin, EveryPlugin, PluginConstructor, PluginInstance, PluginOf, PluginRegistry, PluginRegistryFor, PluginRuntimeConfig, RegistryBindings, RouterOf, SecretsConfig } from "./types";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,YAAY,EACX,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,YAAY,EACX,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,MAAM,SAAS,CAAC"}
package/dist/plugin.d.ts CHANGED
@@ -92,7 +92,6 @@ export declare const CommonPluginErrors: {
92
92
  */
93
93
  export interface Plugin<TContract extends AnyContractRouter, TVariables extends z.ZodTypeAny, TSecrets extends z.ZodTypeAny, TContext extends Context = Record<never, never>> {
94
94
  readonly id: string;
95
- readonly type: string;
96
95
  readonly contract: TContract;
97
96
  readonly configSchema: PluginConfigFor<TVariables, TSecrets>;
98
97
  initialize(config: {
@@ -113,7 +112,6 @@ export interface Plugin<TContract extends AnyContractRouter, TVariables extends
113
112
  */
114
113
  export declare function createPlugin<V extends z.ZodTypeAny, S extends z.ZodTypeAny, TContract extends AnyContractRouter, TContext extends Context = Record<never, never>>(config: {
115
114
  id: string;
116
- type?: string;
117
115
  variables: V;
118
116
  secrets: S;
119
117
  contract: TContract;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,KAAK,kBAAkB,CAAC,CAAC,SAAS,iBAAiB,EAAE,QAAQ,SAAS,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAE5H;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC,UAAU,IACzE,CAAC,CAAC,SAAS,CAAC;IAAE,SAAS,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE3C;;GAE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AAC;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,CACZ,MAAM,EAAE;QAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KAAE,KAClD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,YAAY,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;CAChE,GAsD4B,4BAA4B,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CACnF"}
package/dist/plugin.js CHANGED
@@ -60,7 +60,6 @@ export function createPlugin(config) {
60
60
  });
61
61
  class CreatedPlugin {
62
62
  id = config.id;
63
- type = config.type || "source";
64
63
  contract = config.contract;
65
64
  configSchema = configSchema;
66
65
  _context = null;
@@ -1,46 +1,26 @@
1
- import { Context, Effect, Layer, ManagedRuntime } from "effect";
1
+ import { ManagedRuntime } from "effect";
2
2
  import type { z } from "zod";
3
- import type { InitializedPlugin, PluginConstructor, PluginInstance, PluginOf, PluginRegistry, PluginResult, PluginRuntimeConfig, RegistryBindings, RuntimeOptions, SecretsConfig } from "../types";
4
- import { PluginRuntimeError } from "./errors";
5
- import { type IPluginService } from "./services/plugin.service";
6
- export interface IPluginRuntime<R extends RegistryBindings = RegistryBindings> {
7
- readonly loadPlugin: <K extends keyof R>(pluginId: K) => Effect.Effect<PluginConstructor<PluginOf<R[K]>>, PluginRuntimeError>;
8
- readonly instantiatePlugin: <K extends keyof R>(ctor: PluginConstructor<PluginOf<R[K]>>) => Effect.Effect<PluginInstance<PluginOf<R[K]>>, PluginRuntimeError>;
9
- readonly initializePlugin: <K extends keyof R>(instance: PluginInstance<PluginOf<R[K]>>, config: z.infer<PluginOf<R[K]>["configSchema"]>) => Effect.Effect<InitializedPlugin<PluginOf<R[K]>>, PluginRuntimeError>;
10
- readonly usePlugin: <K extends keyof R>(pluginId: K, config: z.infer<PluginOf<R[K]>["configSchema"]>) => Effect.Effect<PluginResult<PluginOf<R[K]>>, PluginRuntimeError>;
11
- readonly shutdown: () => Effect.Effect<void, never, never>;
12
- }
13
- export declare class PluginRuntimeImpl<R extends RegistryBindings = RegistryBindings> implements IPluginRuntime<R> {
14
- private pluginService;
3
+ import type { EveryPlugin, InitializedPlugin, PluginConstructor, PluginInstance, PluginOf, PluginRegistry, RegistryBindings, RuntimeOptions, SecretsConfig } from "../types";
4
+ import { PluginService } from "./services/plugin.service";
5
+ export declare class PluginRuntime<R extends RegistryBindings = RegistryBindings> {
6
+ private runtime;
15
7
  private registry;
16
8
  private pluginCache;
17
- constructor(pluginService: IPluginService, registry: PluginRegistry);
9
+ constructor(runtime: ManagedRuntime.ManagedRuntime<PluginService, never>, registry: PluginRegistry);
18
10
  private generateCacheKey;
19
11
  private validatePluginId;
20
- loadPlugin<K extends keyof R>(pluginId: K): Effect.Effect<PluginConstructor<PluginOf<R[K]>>, PluginRuntimeError>;
21
- instantiatePlugin<K extends keyof R>(ctor: PluginConstructor<PluginOf<R[K]>>): Effect.Effect<PluginInstance<PluginOf<R[K]>>, PluginRuntimeError>;
22
- initializePlugin<K extends keyof R>(instance: PluginInstance<PluginOf<R[K]>>, config: z.infer<PluginOf<R[K]>["configSchema"]>): Effect.Effect<InitializedPlugin<PluginOf<R[K]>>, PluginRuntimeError>;
23
- usePlugin<K extends keyof R>(pluginId: K, config: z.infer<PluginOf<R[K]>["configSchema"]>): Effect.Effect<PluginResult<PluginOf<R[K]>>, PluginRuntimeError>;
24
- shutdown(): Effect.Effect<void, never, never>;
25
- /**
26
- * Evict a plugin from cache and shutdown its instance
27
- */
28
- evictPlugin<K extends keyof R>(pluginId: K, config: z.infer<PluginOf<R[K]>["configSchema"]>): Effect.Effect<void, never>;
29
- }
30
- declare const PluginRuntimeService_base: Context.TagClass<PluginRuntimeService, "PluginRuntimeService", IPluginService>;
31
- export declare class PluginRuntimeService extends PluginRuntimeService_base {
32
- static Live: <R extends RegistryBindings = RegistryBindings>(config: PluginRuntimeConfig<R>) => Layer.Layer<PluginRuntimeService, never, never>;
12
+ private runPromise;
13
+ loadPlugin<K extends keyof R>(pluginId: K): Promise<PluginConstructor<PluginOf<R[K]>>>;
14
+ instantiatePlugin<K extends keyof R>(ctor: PluginConstructor<PluginOf<R[K]>>): Promise<PluginInstance<PluginOf<R[K]>>>;
15
+ initializePlugin<K extends keyof R>(instance: PluginInstance<PluginOf<R[K]>>, config: z.infer<PluginOf<R[K]>["configSchema"]>): Promise<InitializedPlugin<PluginOf<R[K]>>>;
16
+ usePlugin<K extends keyof R>(pluginId: K, config: z.infer<PluginOf<R[K]>["configSchema"]>): Promise<EveryPlugin<PluginOf<R[K]>>>;
17
+ shutdown(): Promise<void>;
18
+ evictPlugin<K extends keyof R>(pluginId: K, config: z.infer<PluginOf<R[K]>["configSchema"]>): Promise<void>;
33
19
  }
34
- /**
35
- * Creates a typed plugin runtime with compile-time registry key validation.
36
- */
37
20
  export declare function createPluginRuntime<R extends RegistryBindings = RegistryBindings>(config: {
38
21
  registry: PluginRegistry;
39
22
  secrets?: SecretsConfig;
40
23
  options?: RuntimeOptions;
41
- }): {
42
- runtime: ManagedRuntime.ManagedRuntime<PluginRuntimeService, never>;
43
- PluginRuntime: Effect.Effect<PluginRuntimeImpl<R>, never, never>;
44
- };
45
- export type { ConfigOf, InitializedPlugin, PluginOf, PluginResult, RegistryBindings } from "../types";
24
+ }): PluginRuntime<R>;
25
+ export type { ConfigOf, EveryPlugin, InitializedPlugin, PluginOf, RegistryBindings } from "../types";
46
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {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AiB,EACjB,QAAQ,EACR,gBAAgB,EAChB,MAAM,UAAU,CAAC"}
@@ -1,15 +1,13 @@
1
- import { Context, Effect, Hash, Layer, ManagedRuntime } from "effect";
1
+ import { Cause, Effect, Exit, Hash, ManagedRuntime, Option } from "effect";
2
2
  import { createPluginClient, getPluginRouter } from "../client/index";
3
3
  import { PluginRuntimeError } from "./errors";
4
- import { SecretsService } from "./services";
5
- import { ModuleFederationService } from "./services/module-federation.service";
6
4
  import { PluginService } from "./services/plugin.service";
7
- export class PluginRuntimeImpl {
8
- pluginService;
5
+ export class PluginRuntime {
6
+ runtime;
9
7
  registry;
10
8
  pluginCache = new Map();
11
- constructor(pluginService, registry) {
12
- this.pluginService = pluginService;
9
+ constructor(runtime, registry) {
10
+ this.runtime = runtime;
13
11
  this.registry = registry;
14
12
  }
15
13
  generateCacheKey(pluginId, config) {
@@ -18,7 +16,6 @@ export class PluginRuntimeImpl {
18
16
  }
19
17
  validatePluginId(pluginId) {
20
18
  const pluginIdStr = pluginId;
21
- // Runtime validation against registry
22
19
  if (!(pluginIdStr in this.registry)) {
23
20
  return Effect.fail(new PluginRuntimeError({
24
21
  pluginId: pluginIdStr,
@@ -29,39 +26,54 @@ export class PluginRuntimeImpl {
29
26
  }
30
27
  return Effect.succeed(pluginIdStr);
31
28
  }
29
+ async runPromise(effect) {
30
+ const exit = await this.runtime.runPromiseExit(effect);
31
+ if (Exit.isFailure(exit)) {
32
+ const error = Cause.failureOption(exit.cause);
33
+ if (Option.isSome(error)) {
34
+ throw error.value;
35
+ }
36
+ throw Cause.squash(exit.cause);
37
+ }
38
+ return exit.value;
39
+ }
32
40
  loadPlugin(pluginId) {
33
- const self = this;
34
- return Effect.gen(function* () {
35
- const validatedId = yield* self.validatePluginId(pluginId);
36
- const result = yield* self.pluginService.loadPlugin(validatedId);
41
+ const effect = Effect.gen(this, function* () {
42
+ const pluginService = yield* PluginService;
43
+ const validatedId = yield* this.validatePluginId(pluginId);
44
+ const result = yield* pluginService.loadPlugin(validatedId);
37
45
  return result;
38
46
  });
47
+ return this.runPromise(effect);
39
48
  }
40
49
  instantiatePlugin(ctor) {
41
- const self = this;
42
- return Effect.gen(function* () {
43
- const result = yield* self.pluginService.instantiatePlugin(ctor);
50
+ const effect = Effect.gen(this, function* () {
51
+ const pluginService = yield* PluginService;
52
+ const result = yield* pluginService.instantiatePlugin(ctor);
44
53
  return result;
45
54
  });
55
+ return this.runPromise(effect);
46
56
  }
47
57
  initializePlugin(instance, config) {
48
- const self = this;
49
- return Effect.gen(function* () {
50
- const result = yield* self.pluginService.initializePlugin(instance, config);
58
+ const effect = Effect.gen(this, function* () {
59
+ const pluginService = yield* PluginService;
60
+ const result = yield* pluginService.initializePlugin(instance, config);
51
61
  return result;
52
62
  });
63
+ return this.runPromise(effect);
53
64
  }
54
- usePlugin(pluginId, config) {
65
+ async usePlugin(pluginId, config) {
55
66
  const cacheKey = this.generateCacheKey(String(pluginId), config);
56
67
  let cachedPlugin = this.pluginCache.get(cacheKey);
57
68
  if (!cachedPlugin) {
58
- const self = this;
59
- const operation = Effect.gen(function* () {
60
- const validatedId = yield* self.validatePluginId(pluginId);
69
+ const operation = Effect.gen(this, function* () {
70
+ const pluginService = yield* PluginService;
71
+ const validatedId = yield* this.validatePluginId(pluginId);
61
72
  // Load → Instantiate → Initialize
62
- const ctor = yield* self.pluginService.loadPlugin(validatedId);
63
- const instance = yield* self.pluginService.instantiatePlugin(ctor);
64
- const initialized = yield* self.pluginService.initializePlugin(instance, config);
73
+ const ctor = yield* pluginService.loadPlugin(validatedId);
74
+ const instance = yield* pluginService.instantiatePlugin(ctor);
75
+ const _initialized = yield* pluginService.initializePlugin(instance, config);
76
+ const initialized = _initialized;
65
77
  const client = createPluginClient(initialized);
66
78
  const router = getPluginRouter(initialized);
67
79
  return {
@@ -70,63 +82,38 @@ export class PluginRuntimeImpl {
70
82
  metadata: initialized.metadata,
71
83
  initialized
72
84
  };
73
- });
85
+ }).pipe(Effect.provide(this.runtime));
74
86
  cachedPlugin = Effect.cached(operation).pipe(Effect.flatten);
75
87
  this.pluginCache.set(cacheKey, cachedPlugin);
76
88
  }
77
- return cachedPlugin;
89
+ return this.runPromise(cachedPlugin);
78
90
  }
79
91
  shutdown() {
80
- return this.pluginService.cleanup();
92
+ const effect = Effect.gen(function* () {
93
+ const pluginService = yield* PluginService;
94
+ yield* pluginService.cleanup();
95
+ });
96
+ return this.runPromise(effect);
81
97
  }
82
- /**
83
- * Evict a plugin from cache and shutdown its instance
84
- */
85
98
  evictPlugin(pluginId, config) {
86
99
  const cacheKey = this.generateCacheKey(String(pluginId), config);
87
- const self = this;
88
- return Effect.gen(function* () {
89
- // Get cached plugin if it exists
90
- const cachedPlugin = self.pluginCache.get(cacheKey);
100
+ const effect = Effect.gen(this, function* () {
101
+ const pluginService = yield* PluginService;
102
+ const cachedPlugin = this.pluginCache.get(cacheKey);
91
103
  if (cachedPlugin) {
92
- // Remove from cache first
93
- self.pluginCache.delete(cacheKey);
94
- // Try to shutdown the plugin gracefully
104
+ this.pluginCache.delete(cacheKey);
95
105
  const pluginResult = yield* cachedPlugin.pipe(Effect.catchAll(() => Effect.succeed(null)));
96
106
  if (pluginResult?.initialized) {
97
- yield* self.pluginService.shutdownPlugin(pluginResult.initialized).pipe(Effect.catchAll(() => Effect.void) // Ignore shutdown errors during eviction
98
- );
107
+ yield* pluginService.shutdownPlugin(pluginResult.initialized).pipe(Effect.catchAll(() => Effect.void));
99
108
  }
100
109
  }
101
- }).pipe(Effect.catchAll(() => Effect.void) // Never fail
102
- );
110
+ }).pipe(Effect.catchAll(() => Effect.void));
111
+ return this.runPromise(effect);
103
112
  }
104
113
  }
105
- export class PluginRuntimeService extends Context.Tag("PluginRuntimeService")() {
106
- static Live = (config) => {
107
- const secrets = config.secrets || {};
108
- return Layer.scoped(PluginRuntimeService, Effect.gen(function* () {
109
- const pluginService = yield* PluginService;
110
- // Register cleanup finalizer for automatic resource management
111
- yield* Effect.addFinalizer(() => pluginService.cleanup().pipe(Effect.catchAll(() => Effect.void) // Ensure cleanup never fails
112
- ));
113
- return pluginService;
114
- })).pipe(Layer.provide(PluginService.Live(config.registry, secrets).pipe(Layer.provide(Layer.mergeAll(ModuleFederationService.Live, SecretsService.Live(secrets))))));
115
- };
116
- }
117
- /**
118
- * Creates a typed plugin runtime with compile-time registry key validation.
119
- */
120
114
  export function createPluginRuntime(config) {
121
- const runtimeConfig = {
122
- registry: config.registry,
123
- secrets: config.secrets,
124
- options: config.options
125
- };
126
- const runtime = ManagedRuntime.make(PluginRuntimeService.Live(runtimeConfig));
127
- const createTypedRuntime = Effect.gen(function* () {
128
- const pluginService = yield* PluginRuntimeService;
129
- return new PluginRuntimeImpl(pluginService, runtimeConfig.registry);
130
- }).pipe(Effect.provide(runtime));
131
- return { runtime, PluginRuntime: createTypedRuntime };
115
+ const secrets = config.secrets || {};
116
+ const layer = PluginService.Live(config.registry, secrets);
117
+ const runtime = ManagedRuntime.make(layer);
118
+ return new PluginRuntime(runtime, config.registry);
132
119
  }
@@ -1,17 +1,13 @@
1
- import { Effect, Layer } from "effect";
1
+ import { Effect } from "effect";
2
2
  import type { AnyPlugin } from "../../types";
3
3
  import { ModuleFederationError } from "../errors";
4
- export interface IModuleFederationService {
5
- readonly registerRemote: (pluginId: string, url: string) => Effect.Effect<void, ModuleFederationError>;
6
- readonly loadRemoteConstructor: (pluginId: string, url: string) => Effect.Effect<new () => AnyPlugin, ModuleFederationError>;
7
- }
8
- declare const ModuleFederationService_base: import("effect/Context").TagClass<ModuleFederationService, "ModuleFederationService", IModuleFederationService> & Effect.Tag.Proxy<ModuleFederationService, IModuleFederationService> & {
9
- use: <X>(body: (_: IModuleFederationService) => X) => [X] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, ModuleFederationService | R> : [X] extends [PromiseLike<infer A_1>] ? Effect.Effect<A_1, import("effect/Cause").UnknownException, ModuleFederationService> : Effect.Effect<X, never, ModuleFederationService>;
10
- };
4
+ declare const ModuleFederationService_base: Effect.Service.Class<ModuleFederationService, "ModuleFederationService", {
5
+ readonly effect: Effect.Effect<{
6
+ registerRemote: (pluginId: string, url: string) => Effect.Effect<undefined, ModuleFederationError, never>;
7
+ loadRemoteConstructor: (pluginId: string, url: string) => Effect.Effect<new () => AnyPlugin, ModuleFederationError, never>;
8
+ }, never, never>;
9
+ }>;
11
10
  export declare class ModuleFederationService extends ModuleFederationService_base {
12
- static Live: Layer.Layer<ModuleFederationService, never, never>;
13
11
  }
14
- export declare const ModuleFederationServiceTag: typeof ModuleFederationService;
15
- export declare const ModuleFederationServiceLive: Layer.Layer<ModuleFederationService, never, never>;
16
12
  export {};
17
13
  //# sourceMappingURL=module-federation.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/module-federation.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AASlD,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,cAAc,EAAE,CACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,KACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IAChD,QAAQ,CAAC,qBAAqB,EAAE,CAC/B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,KACP,MAAM,CAAC,MAAM,CAAC,UAAU,SAAS,EAAE,qBAAqB,CAAC,CAAC;CAC/D;;;;AAsED,qBAAa,uBAAwB,SAAQ,4BAES;IACrD,MAAM,CAAC,IAAI,qDAyFT;CACF;AAED,eAAO,MAAM,0BAA0B,gCAA0B,CAAC;AAClE,eAAO,MAAM,2BAA2B,oDAA+B,CAAC"}
1
+ {"version":3,"file":"module-federation.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/module-federation.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;;;mCAkFpB,MAAM,OAAO,MAAM;0CA2CZ,MAAM,OAAO,MAAM,6BAzHzC,SAAS;;;AAyExB,qBAAa,uBAAwB,SAAQ,4BAuF3C;CAAG"}
@@ -1,10 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
2
  import { createInstance, getInstance, } from "@module-federation/enhanced/runtime";
3
3
  import { setGlobalFederationInstance } from "@module-federation/runtime-core";
4
- import { Effect, Layer } from "effect";
4
+ import { Effect } from "effect";
5
5
  import { ModuleFederationError } from "../errors";
6
6
  import { getNormalizedRemoteName } from "./normalize";
7
- const pkg = require("../../../package.json");
7
+ import pkg from "../../../package.json";
8
8
  const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
9
9
  try {
10
10
  let instance = getInstance();
@@ -26,7 +26,7 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
26
26
  version: pkg.dependencies.effect,
27
27
  shareConfig: {
28
28
  singleton: true,
29
- requiredVersion: "^3.17.0", // Allow any 3.17.x patch version
29
+ requiredVersion: "^3.18.0", // Allow any 3.18.x patch version
30
30
  eager: true,
31
31
  strictVersion: true, // Enforce major/minor compatibility
32
32
  },
@@ -68,8 +68,8 @@ const createModuleFederationInstance = Effect.cached(Effect.sync(() => {
68
68
  throw new Error(`Failed to initialize Module Federation: ${error}`);
69
69
  }
70
70
  }));
71
- export class ModuleFederationService extends Effect.Tag("ModuleFederationService")() {
72
- static Live = Layer.effect(ModuleFederationService, Effect.gen(function* () {
71
+ export class ModuleFederationService extends Effect.Service()("ModuleFederationService", {
72
+ effect: Effect.gen(function* () {
73
73
  const mf = yield* Effect.flatten(createModuleFederationInstance);
74
74
  return {
75
75
  registerRemote: (pluginId, url) => Effect.gen(function* () {
@@ -91,7 +91,6 @@ export class ModuleFederationService extends Effect.Tag("ModuleFederationService
91
91
  cause: new Error(`Remote not available (${url}): ${JSON.stringify(error)}`),
92
92
  }));
93
93
  }
94
- // Register remote using normalized name
95
94
  const remoteName = getNormalizedRemoteName(pluginId);
96
95
  yield* Effect.try({
97
96
  try: () => mf.registerRemotes([{ name: remoteName, entry: url }]),
@@ -130,7 +129,6 @@ export class ModuleFederationService extends Effect.Tag("ModuleFederationService
130
129
  });
131
130
  }),
132
131
  };
133
- }));
132
+ }),
133
+ }) {
134
134
  }
135
- export const ModuleFederationServiceTag = ModuleFederationService;
136
- export const ModuleFederationServiceLive = ModuleFederationService.Live;
@@ -1,17 +1,14 @@
1
- import { Context, Effect, Layer } from "effect";
1
+ import { Effect } from "effect";
2
2
  import type { AnyPlugin, InitializedPlugin } from "../../types";
3
- import { type PluginRuntimeError } from "../errors";
4
- export interface IPluginLifecycleService {
5
- readonly register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void, never>;
6
- readonly unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, never>;
7
- readonly shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError>;
8
- readonly cleanup: () => Effect.Effect<void, never>;
9
- }
10
- declare const PluginLifecycleService_base: Context.TagClass<PluginLifecycleService, "PluginLifecycleService", IPluginLifecycleService>;
3
+ declare const PluginLifecycleService_base: Effect.Service.Class<PluginLifecycleService, "PluginLifecycleService", {
4
+ readonly effect: Effect.Effect<{
5
+ register: <T extends AnyPlugin>(plugin: InitializedPlugin<T>) => Effect.Effect<void, never, never>;
6
+ unregister: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, never, never>;
7
+ shutdown: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, import("../errors").PluginRuntimeError, never>;
8
+ cleanup: () => Effect.Effect<void, never, never>;
9
+ }, never, never>;
10
+ }>;
11
11
  export declare class PluginLifecycleService extends PluginLifecycleService_base {
12
- static Live: Layer.Layer<PluginLifecycleService, never, never>;
13
12
  }
14
- export declare const PluginLifecycleServiceTag: typeof PluginLifecycleService;
15
- export declare const PluginLifecycleServiceLive: Layer.Layer<PluginLifecycleService, never, never>;
16
13
  export {};
17
14
  //# sourceMappingURL=plugin-lifecycle.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-lifecycle.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/plugin-lifecycle.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAO,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,kBAAkB,EAAwB,MAAM,WAAW,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,SAAS,EACrC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,KACzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,CACnB,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,KACjC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,CACjB,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,KACjC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;CACpD;;AAED,qBAAa,sBAAuB,SAAQ,2BAGzC;IACD,MAAM,CAAC,IAAI,oDAiET;CACH;AAED,eAAO,MAAM,yBAAyB,+BAAyB,CAAC;AAChE,eAAO,MAAM,0BAA0B,mDAA8B,CAAC"}
1
+ {"version":3,"file":"plugin-lifecycle.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/plugin-lifecycle.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;;;mBAQ/C,CAAC,SAAS,SAAS,UAAU,iBAAiB,CAAC,CAAC,CAAC;6BAKvC,iBAAiB,CAAC,SAAS,CAAC;2BAO9B,iBAAiB,CAAC,SAAS,CAAC;;;;AAjBrD,qBAAa,sBAAuB,SAAQ,2BAgE1C;CAAI"}
@@ -1,7 +1,7 @@
1
- import { Context, Effect, Layer, Ref } from "effect";
1
+ import { Effect, Ref } from "effect";
2
2
  import { toPluginRuntimeError } from "../errors";
3
- export class PluginLifecycleService extends Context.Tag("PluginLifecycleService")() {
4
- static Live = Layer.effect(PluginLifecycleService, Effect.gen(function* () {
3
+ export class PluginLifecycleService extends Effect.Service()("PluginLifecycleService", {
4
+ effect: Effect.gen(function* () {
5
5
  const activePlugins = yield* Ref.make(new Set());
6
6
  return {
7
7
  register: (plugin) => Ref.update(activePlugins, plugins => new Set(plugins).add(plugin)),
@@ -29,7 +29,6 @@ export class PluginLifecycleService extends Context.Tag("PluginLifecycleService"
29
29
  }).pipe(Effect.catchAll(() => Effect.void) // Convert errors to void for cleanup
30
30
  ),
31
31
  };
32
- }));
32
+ }),
33
+ }) {
33
34
  }
34
- export const PluginLifecycleServiceTag = PluginLifecycleService;
35
- export const PluginLifecycleServiceLive = PluginLifecycleService.Live;
@@ -1,21 +1,58 @@
1
- import { Context, Effect, Layer } from "effect";
2
- import type { AnyPlugin, InitializedPlugin, PluginConstructor, PluginInstance, PluginRegistry, SecretsConfig } from "../../types";
1
+ import { Context, Effect, Scope } from "effect";
2
+ import type { z } from "zod";
3
+ import type { AnyPlugin, PluginConstructor, PluginInstance, PluginRegistry } from "../../types";
3
4
  import { PluginRuntimeError } from "../errors";
4
5
  import { ModuleFederationService } from "./module-federation.service";
5
6
  import { SecretsService } from "./secrets.service";
6
- export interface IPluginLoaderService {
7
- readonly loadPlugin: (pluginId: string) => Effect.Effect<PluginConstructor<AnyPlugin>, PluginRuntimeError>;
8
- readonly instantiatePlugin: <T extends AnyPlugin>(pluginConstructor: PluginConstructor<T>) => Effect.Effect<PluginInstance<T>, PluginRuntimeError>;
9
- readonly initializePlugin: <T extends AnyPlugin>(pluginInstance: PluginInstance<T>, config: {
10
- variables: unknown;
11
- secrets: unknown;
12
- }) => Effect.Effect<InitializedPlugin<T>, PluginRuntimeError>;
7
+ declare const PluginRegistryTag_base: Context.TagClass<PluginRegistryTag, "PluginRegistry", PluginRegistry>;
8
+ export declare class PluginRegistryTag extends PluginRegistryTag_base {
13
9
  }
14
- declare const PluginLoaderService_base: Context.TagClass<PluginLoaderService, "PluginLoaderService", IPluginLoaderService>;
10
+ declare const RegistryService_base: Effect.Service.Class<RegistryService, "RegistryService", {
11
+ readonly effect: Effect.Effect<{
12
+ get: (pluginId: string) => Effect.Effect<{
13
+ remoteUrl: string;
14
+ version?: string;
15
+ description?: string;
16
+ }, PluginRuntimeError, never>;
17
+ }, never, PluginRegistryTag>;
18
+ }>;
19
+ export declare class RegistryService extends RegistryService_base {
20
+ }
21
+ declare const PluginLoaderService_base: Effect.Service.Class<PluginLoaderService, "PluginLoaderService", {
22
+ readonly effect: Effect.Effect<{
23
+ loadPlugin: (pluginId: string) => Effect.Effect<{
24
+ ctor: new () => AnyPlugin;
25
+ metadata: {
26
+ pluginId: string;
27
+ version: string | undefined;
28
+ };
29
+ }, PluginRuntimeError, never>;
30
+ instantiatePlugin: <T extends AnyPlugin>(pluginConstructor: PluginConstructor<T>) => Effect.Effect<{
31
+ plugin: T;
32
+ metadata: {
33
+ readonly pluginId: string;
34
+ readonly version?: string;
35
+ readonly description?: string;
36
+ readonly type?: string;
37
+ };
38
+ }, PluginRuntimeError, never>;
39
+ initializePlugin: <T extends AnyPlugin>(pluginInstance: PluginInstance<T>, config: {
40
+ variables: unknown;
41
+ secrets: unknown;
42
+ }) => Effect.Effect<{
43
+ plugin: T;
44
+ metadata: {
45
+ readonly pluginId: string;
46
+ readonly version?: string;
47
+ readonly description?: string;
48
+ };
49
+ config: z.infer<T["configSchema"]>;
50
+ context: any;
51
+ scope: Scope.CloseableScope;
52
+ }, PluginRuntimeError, never>;
53
+ }, never, RegistryService | ModuleFederationService | SecretsService>;
54
+ }>;
15
55
  export declare class PluginLoaderService extends PluginLoaderService_base {
16
- static Live: (registry: PluginRegistry, secrets: SecretsConfig) => Layer.Layer<PluginLoaderService, never, ModuleFederationService | SecretsService>;
17
56
  }
18
- export declare const PluginLoaderServiceTag: typeof PluginLoaderService;
19
- export declare const PluginLoaderServiceLive: (registry: PluginRegistry, secrets: SecretsConfig) => Layer.Layer<PluginLoaderService, never, ModuleFederationService | SecretsService>;
20
57
  export {};
21
58
  //# sourceMappingURL=plugin-loader.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-loader.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/plugin-loader.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAS,MAAM,QAAQ,CAAC;AAEvD,OAAO,KAAK,EACX,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAwB,MAAM,WAAW,CAAC;AAErE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,UAAU,EAAE,CACpB,QAAQ,EAAE,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAA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MAAM;;;;;;;AALzB,qBAAa,eAAgB,SAAQ,oBAkBnC;CAAI;;;+BAgBoB,MAAM;;;;;;;4BA4BT,CAAC,SAAS,SAAS,qBACnB,iBAAiB,CAAC,CAAC,CAAC;;;;;;;;;2BAmCrB,CAAC,SAAS,SAAS,kBACrB,cAAc,CAAC,CAAC,CAAC,UACzB;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,OAAO,EAAE,OAAO,CAAA;SAAE;;;;;;;oBAwDvB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;;;;;;AAxIvD,qBAAa,mBAAoB,SAAQ,wBA+IvC;CACD"}
@@ -1,21 +1,33 @@
1
- import { Context, Effect, Layer, Scope } from "effect";
1
+ import { Context, Effect, Scope } from "effect";
2
2
  import { PluginRuntimeError, toPluginRuntimeError } from "../errors";
3
3
  import { validate } from "../validation";
4
4
  import { ModuleFederationService } from "./module-federation.service";
5
5
  import { SecretsService } from "./secrets.service";
6
- export class PluginLoaderService extends Context.Tag("PluginLoaderService")() {
7
- static Live = (registry, secrets) => Layer.effect(PluginLoaderService, Effect.gen(function* () {
6
+ export class PluginRegistryTag extends Context.Tag("PluginRegistry")() {
7
+ }
8
+ export class RegistryService extends Effect.Service()("RegistryService", {
9
+ effect: Effect.gen(function* () {
10
+ const registry = yield* PluginRegistryTag;
11
+ return {
12
+ get: (pluginId) => Effect.fromNullable(registry[pluginId]).pipe(Effect.mapError(() => new PluginRuntimeError({
13
+ pluginId,
14
+ operation: "load-plugin",
15
+ cause: new Error(`Plugin ${pluginId} not found in registry`),
16
+ retryable: false,
17
+ }))),
18
+ };
19
+ }),
20
+ }) {
21
+ }
22
+ export class PluginLoaderService extends Effect.Service()("PluginLoaderService", {
23
+ effect: Effect.gen(function* () {
8
24
  const moduleFederationService = yield* ModuleFederationService;
9
25
  const secretsService = yield* SecretsService;
26
+ const registryService = yield* RegistryService;
10
27
  const resolveUrl = (baseUrl, version) => version && version !== "latest"
11
28
  ? baseUrl.replace("@latest", `@${version}`)
12
29
  : baseUrl;
13
- const getMetadata = (pluginId) => Effect.fromNullable(registry[pluginId]).pipe(Effect.mapError(() => new PluginRuntimeError({
14
- pluginId,
15
- operation: "load-plugin",
16
- cause: new Error(`Plugin ${pluginId} not found in registry`),
17
- retryable: false,
18
- })));
30
+ const getMetadata = (pluginId) => registryService.get(pluginId);
19
31
  return {
20
32
  loadPlugin: (pluginId) => Effect.gen(function* () {
21
33
  const metadata = yield* getMetadata(pluginId);
@@ -27,8 +39,7 @@ export class PluginLoaderService extends Context.Tag("PluginLoaderService")() {
27
39
  ctor,
28
40
  metadata: {
29
41
  pluginId,
30
- version: metadata.version,
31
- type: metadata.type,
42
+ version: metadata.version
32
43
  },
33
44
  };
34
45
  }),
@@ -57,7 +68,7 @@ export class PluginLoaderService extends Context.Tag("PluginLoaderService")() {
57
68
  cause: validationError.zodError,
58
69
  retryable: false,
59
70
  })));
60
- const hydratedConfig = yield* secretsService.hydrateSecrets(validatedConfig, secrets);
71
+ const hydratedConfig = yield* secretsService.hydrateSecrets(validatedConfig);
61
72
  const finalConfig = yield* validate(plugin.configSchema, hydratedConfig, plugin.id, "config").pipe(Effect.mapError((validationError) => new PluginRuntimeError({
62
73
  pluginId: plugin.id,
63
74
  operation: "validate-hydrated-config",
@@ -77,7 +88,6 @@ export class PluginLoaderService extends Context.Tag("PluginLoaderService")() {
77
88
  };
78
89
  }),
79
90
  };
80
- }));
91
+ }),
92
+ }) {
81
93
  }
82
- export const PluginLoaderServiceTag = PluginLoaderService;
83
- export const PluginLoaderServiceLive = PluginLoaderService.Live;
@@ -1,21 +1,45 @@
1
- import { Context, Effect, Layer } from "effect";
2
- import type { AnyPlugin, InitializedPlugin, PluginConstructor, PluginInstance, PluginRegistry, SecretsConfig } from "../../types";
3
- import type { PluginRuntimeError } from "../errors";
4
- export interface IPluginService {
5
- readonly loadPlugin: (pluginId: string) => Effect.Effect<PluginConstructor<AnyPlugin>, PluginRuntimeError>;
6
- readonly instantiatePlugin: <T extends AnyPlugin>(pluginConstructor: PluginConstructor<T>) => Effect.Effect<PluginInstance<T>, PluginRuntimeError>;
7
- readonly initializePlugin: <T extends AnyPlugin>(pluginInstance: PluginInstance<T>, config: {
8
- variables: unknown;
9
- secrets: unknown;
10
- }) => Effect.Effect<InitializedPlugin<T>, PluginRuntimeError>;
11
- readonly shutdownPlugin: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, PluginRuntimeError>;
12
- readonly cleanup: () => Effect.Effect<void, never>;
13
- }
14
- declare const PluginService_base: Context.TagClass<PluginService, "PluginService", IPluginService>;
1
+ import { Effect, Layer, Scope } from "effect";
2
+ import type { AnyPlugin, InitializedPlugin, PluginRegistry, SecretsConfig } from "../../types";
3
+ import { PluginLifecycleService } from "./plugin-lifecycle.service";
4
+ import { PluginLoaderService } from "./plugin-loader.service";
5
+ declare const PluginService_base: Effect.Service.Class<PluginService, "PluginService", {
6
+ readonly scoped: Effect.Effect<{
7
+ loadPlugin: (pluginId: string) => Effect.Effect<{
8
+ ctor: new () => AnyPlugin;
9
+ metadata: {
10
+ pluginId: string;
11
+ version: string | undefined;
12
+ };
13
+ }, import("../errors").PluginRuntimeError, never>;
14
+ instantiatePlugin: <T extends AnyPlugin>(pluginConstructor: import("../..").PluginConstructor<T>) => Effect.Effect<{
15
+ plugin: T;
16
+ metadata: {
17
+ readonly pluginId: string;
18
+ readonly version?: string;
19
+ readonly description?: string;
20
+ readonly type?: string;
21
+ };
22
+ }, import("../errors").PluginRuntimeError, never>;
23
+ initializePlugin: <T extends AnyPlugin>(pluginInstance: import("../..").PluginInstance<T>, config: {
24
+ variables: unknown;
25
+ secrets: unknown;
26
+ }) => Effect.Effect<{
27
+ plugin: T;
28
+ metadata: {
29
+ readonly pluginId: string;
30
+ readonly version?: string;
31
+ readonly description?: string;
32
+ };
33
+ config: import("zod").infer<T["configSchema"]>;
34
+ context: any;
35
+ scope: Scope.CloseableScope;
36
+ }, import("../errors").PluginRuntimeError, never>;
37
+ shutdownPlugin: (plugin: InitializedPlugin<AnyPlugin>) => Effect.Effect<void, never, never>;
38
+ cleanup: () => Effect.Effect<void, never, never>;
39
+ }, never, PluginLoaderService | PluginLifecycleService>;
40
+ }>;
15
41
  export declare class PluginService extends PluginService_base {
16
- static Live: (registry: PluginRegistry, secrets: SecretsConfig) => Layer.Layer<PluginService, never, import("./module-federation.service").ModuleFederationService | import("./secrets.service").SecretsService>;
42
+ static Live: (registry: PluginRegistry, secrets: SecretsConfig) => Layer.Layer<PluginService, never, never>;
17
43
  }
18
- export declare const PluginServiceTag: typeof PluginService;
19
- export declare const PluginServiceLive: (registry: PluginRegistry, secrets: SecretsConfig) => Layer.Layer<PluginService, never, import("./module-federation.service").ModuleFederationService | import("./secrets.service").SecretsService>;
20
44
  export {};
21
45
  //# sourceMappingURL=plugin.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/plugin.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAQ,KAAK,EAAS,MAAM,QAAQ,CAAC;AAC7D,OAAO,KAAK,EACX,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAIpD,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,UAAU,EAAE,CACpB,QAAQ,EAAE,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,CAAC;IACrE,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC,SAAS,SAAS,EAC/C,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,KACnC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC1D,Q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,SAAS,aAAa,8CAmB9D;CACD"}
@@ -1,8 +1,10 @@
1
- import { Context, Effect, Exit, Layer, Scope } from "effect";
1
+ import { Effect, Exit, Layer, Scope } from "effect";
2
+ import { ModuleFederationService } from "./module-federation.service";
2
3
  import { PluginLifecycleService } from "./plugin-lifecycle.service";
3
- import { PluginLoaderService } from "./plugin-loader.service";
4
- export class PluginService extends Context.Tag("PluginService")() {
5
- static Live = (registry, secrets) => Layer.scoped(PluginService, Effect.gen(function* () {
4
+ import { PluginLoaderService, PluginRegistryTag, RegistryService } from "./plugin-loader.service";
5
+ import { SecretsConfigTag, SecretsService } from "./secrets.service";
6
+ export class PluginService extends Effect.Service()("PluginService", {
7
+ scoped: Effect.gen(function* () {
6
8
  const loader = yield* PluginLoaderService;
7
9
  const lifecycle = yield* PluginLifecycleService;
8
10
  return {
@@ -19,7 +21,11 @@ export class PluginService extends Context.Tag("PluginService")() {
19
21
  }),
20
22
  cleanup: lifecycle.cleanup,
21
23
  };
22
- })).pipe(Layer.provide(Layer.mergeAll(PluginLoaderService.Live(registry, secrets), PluginLifecycleService.Live)));
24
+ }),
25
+ }) {
26
+ static Live = (registry, secrets) => {
27
+ const contextLayer = Layer.mergeAll(Layer.succeed(PluginRegistryTag, registry), Layer.succeed(SecretsConfigTag, secrets));
28
+ const servicesLayer = Layer.mergeAll(ModuleFederationService.Default, SecretsService.Default, RegistryService.Default, PluginLifecycleService.Default).pipe(Layer.provide(contextLayer));
29
+ return PluginService.Default.pipe(Layer.provide(PluginLoaderService.Default), Layer.provide(servicesLayer));
30
+ };
23
31
  }
24
- export const PluginServiceTag = PluginService;
25
- export const PluginServiceLive = PluginService.Live;
@@ -1,16 +1,15 @@
1
- import { Effect, Layer } from "effect";
1
+ import { Context, Effect } from "effect";
2
2
  import type { SecretsConfig } from "../../types";
3
3
  import { PluginRuntimeError } from "../errors";
4
- export interface ISecretsService {
5
- readonly hydrateSecrets: <T>(config: T, secretsConfig: SecretsConfig) => Effect.Effect<T, PluginRuntimeError>;
4
+ declare const SecretsConfigTag_base: Context.TagClass<SecretsConfigTag, "SecretsConfig", SecretsConfig>;
5
+ export declare class SecretsConfigTag extends SecretsConfigTag_base {
6
6
  }
7
- declare const SecretsService_base: import("effect/Context").TagClass<SecretsService, "SecretsService", ISecretsService> & Effect.Tag.Proxy<SecretsService, ISecretsService> & {
8
- use: <X>(body: (_: ISecretsService) => X) => [X] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, R | SecretsService> : [X] extends [PromiseLike<infer A_1>] ? Effect.Effect<A_1, import("effect/Cause").UnknownException, SecretsService> : Effect.Effect<X, never, SecretsService>;
9
- };
7
+ declare const SecretsService_base: Effect.Service.Class<SecretsService, "SecretsService", {
8
+ readonly effect: Effect.Effect<{
9
+ hydrateSecrets: <T>(config: T) => Effect.Effect<T, PluginRuntimeError, never>;
10
+ }, never, SecretsConfigTag>;
11
+ }>;
10
12
  export declare class SecretsService extends SecretsService_base {
11
- static Live: (secrets: SecretsConfig) => Layer.Layer<SecretsService, never, never>;
12
13
  }
13
- export declare const SecretsServiceTag: typeof SecretsService;
14
- export declare const SecretsServiceLive: (secrets: SecretsConfig) => Layer.Layer<SecretsService, never, never>;
15
14
  export {};
16
15
  //# sourceMappingURL=secrets.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secrets.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/secrets.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EACT,aAAa,EAAE,aAAa,KACxB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;CAC1C;;;;AAMD,qBAAa,cAAe,SAAQ,mBAGjC;IACF,MAAM,CAAC,IAAI,GAAI,SAAS,aAAa,+CA8BjC;CACJ;AAED,eAAO,MAAM,iBAAiB,uBAAiB,CAAC;AAChD,eAAO,MAAM,kBAAkB,YAlCN,aAAa,8CAkCe,CAAC"}
1
+ {"version":3,"file":"secrets.service.d.ts","sourceRoot":"","sources":["../../../src/runtime/services/secrets.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;;AAM/C,qBAAa,gBAAiB,SAAQ,qBAGnC;CAAI;;;yBAOa,CAAC,UAAU,CAAC;;;AALhC,qBAAa,cAAe,SAAQ,mBA+BlC;CAAI"}
@@ -1,34 +1,35 @@
1
- import { Effect, Layer } from "effect";
1
+ import { Context, Effect } from "effect";
2
2
  import { z } from "zod";
3
3
  import { PluginRuntimeError } from "../errors";
4
4
  const configSchema = z.object({
5
5
  secrets: z.record(z.string(), z.unknown())
6
6
  }).loose();
7
- export class SecretsService extends Effect.Tag("SecretsService")() {
8
- static Live = (secrets) => Layer.succeed(SecretsService, {
9
- hydrateSecrets: (config, secretsConfig) => Effect.gen(function* () {
10
- const parseResult = configSchema.parse(config);
11
- try {
12
- const configString = JSON.stringify(parseResult);
13
- let hydratedString = configString;
14
- // Use provided secrets or fallback to secretsConfig
15
- const effectiveSecrets = { ...secretsConfig, ...secrets };
16
- // Simple template replacement for {{SECRET_NAME}} patterns
17
- for (const [key, value] of Object.entries(effectiveSecrets)) {
18
- const pattern = new RegExp(`{{${key}}}`, "g");
19
- hydratedString = hydratedString.replace(pattern, String(value));
7
+ export class SecretsConfigTag extends Context.Tag("SecretsConfig")() {
8
+ }
9
+ export class SecretsService extends Effect.Service()("SecretsService", {
10
+ effect: Effect.gen(function* () {
11
+ const secrets = yield* SecretsConfigTag;
12
+ return {
13
+ hydrateSecrets: (config) => Effect.gen(function* () {
14
+ const parseResult = configSchema.parse(config);
15
+ try {
16
+ const configString = JSON.stringify(parseResult);
17
+ let hydratedString = configString;
18
+ for (const [key, value] of Object.entries(secrets)) {
19
+ const pattern = new RegExp(`{{${key}}}`, "g");
20
+ hydratedString = hydratedString.replace(pattern, String(value));
21
+ }
22
+ return JSON.parse(hydratedString);
23
+ }
24
+ catch (error) {
25
+ return yield* Effect.fail(new PluginRuntimeError({
26
+ operation: "hydrate-secrets",
27
+ cause: error instanceof Error ? error : new Error(String(error)),
28
+ retryable: false,
29
+ }));
20
30
  }
21
- return JSON.parse(hydratedString);
22
- }
23
- catch (error) {
24
- return yield* Effect.fail(new PluginRuntimeError({
25
- operation: "hydrate-secrets",
26
- cause: error instanceof Error ? error : new Error(String(error)),
27
- retryable: false,
28
- }));
29
- }
30
- }),
31
- });
31
+ }),
32
+ };
33
+ }),
34
+ }) {
32
35
  }
33
- export const SecretsServiceTag = SecretsService;
34
- export const SecretsServiceLive = SecretsService.Live;
@@ -1,4 +1,6 @@
1
+ export * from "./services/module-federation.service";
1
2
  export * from "./services/plugin.service";
3
+ export * from "./services/plugin-lifecycle.service";
4
+ export * from "./services/plugin-loader.service";
2
5
  export * from "./services/secrets.service";
3
- export * from "./services/module-federation.service";
4
6
  //# sourceMappingURL=services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/runtime/services.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sCAAsC,CAAA"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/runtime/services.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAA;AACpD,cAAc,2BAA2B,CAAA;AACzC,cAAc,qCAAqC,CAAA;AACnD,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA"}
@@ -1,3 +1,5 @@
1
+ export * from "./services/module-federation.service";
1
2
  export * from "./services/plugin.service";
3
+ export * from "./services/plugin-lifecycle.service";
4
+ export * from "./services/plugin-loader.service";
2
5
  export * from "./services/secrets.service";
3
- export * from "./services/module-federation.service";
@@ -1,20 +1,53 @@
1
- import { Effect, Layer, ManagedRuntime } from "effect";
2
- import { PluginRuntimeImpl, PluginRuntimeService } from "../runtime";
1
+ import { Layer } from "effect";
2
+ import type { PluginBinding } from "../plugin";
3
+ import { PluginRuntime } from "../runtime";
4
+ import { PluginService } from "../runtime/services";
3
5
  import type { PluginRuntimeConfig, RegistryBindings } from "../types";
4
- import { type TestPluginMap } from "./mocks/module-federation.service";
6
+ import { type PluginMap } from "./mocks/module-federation.service";
7
+ /**
8
+ * Automatically infer RegistryBindings from a map of locally available plugins.
9
+ * Eliminates the need for manual binding definitions when using createLocalPluginRuntime.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const pluginMap = { "my-plugin": MyPlugin } as const;
14
+ * type MyBindings = InferBindingsFromMap<typeof pluginMap>;
15
+ * ```
16
+ */
17
+ export type InferBindingsFromMap<T extends PluginMap> = {
18
+ [K in keyof T]: PluginBinding<T[K]>;
19
+ } & RegistryBindings;
5
20
  /**
6
21
  * Creates a test layer with mock ModuleFederationService for unit testing.
7
- * This mirrors PluginRuntimeService.Live but uses mock ModuleFederationService.
22
+ * This mirrors PluginService.Live() but uses mock ModuleFederationService.
23
+ */
24
+ export declare const createTestLayer: <R extends RegistryBindings = RegistryBindings>(config: PluginRuntimeConfig<R>, pluginMap: PluginMap) => Layer.Layer<PluginService, never, never>;
25
+ /**
26
+ * Creates a plugin runtime for locally available plugins (non-remote).
27
+ * Automatically infers type bindings from the plugin map, eliminating
28
+ * the need for manual RegistryBindings definitions.
29
+ *
30
+ * Ideal for:
31
+ * - Unit and integration tests
32
+ * - Local development and debugging
33
+ * - Monorepo setups where all plugins are in the same workspace
34
+ *
35
+ * For production with remote Module Federation plugins, use createPluginRuntime().
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const pluginMap = { "my-plugin": MyPlugin } as const;
40
+ * const runtime = createLocalPluginRuntime({ registry, secrets }, pluginMap);
41
+ *
42
+ * // Types are automatically inferred - no manual bindings needed!
43
+ * const plugin = await runtime.usePlugin("my-plugin", config);
44
+ * ```
8
45
  */
9
- export declare const createTestLayer: <R extends RegistryBindings = RegistryBindings>(config: PluginRuntimeConfig<R>, pluginMap: TestPluginMap) => Layer.Layer<PluginRuntimeService, never, never>;
46
+ export declare function createLocalPluginRuntime<T extends PluginMap>(config: PluginRuntimeConfig, pluginMap: T): PluginRuntime<InferBindingsFromMap<T>>;
10
47
  /**
11
- * Creates a test plugin runtime using mock services.
12
- * This mirrors createPluginRuntime exactly but uses test layer.
48
+ * @deprecated Use `createLocalPluginRuntime` instead. This alias is kept for backward compatibility.
13
49
  */
14
- export declare const createTestPluginRuntime: <R extends RegistryBindings = RegistryBindings>(config: PluginRuntimeConfig<R>, pluginMap: TestPluginMap) => {
15
- runtime: ManagedRuntime.ManagedRuntime<PluginRuntimeService, never>;
16
- PluginRuntime: Effect.Effect<PluginRuntimeImpl<R>, never, never>;
17
- };
50
+ export declare const createTestPluginRuntime: typeof createLocalPluginRuntime;
18
51
  export type { PluginRegistry, RegistryBindings } from "../types";
19
- export type { PluginRuntimeConfig, TestPluginMap };
52
+ export type { PluginMap, PluginRuntimeConfig };
20
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAA0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;;;;GAoBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,SAAS,EAC3D,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,CAAC,GACV,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAKxC;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,iCAA2B,CAAC;AAGhE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjE,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,38 +1,45 @@
1
- import { Effect, Layer, ManagedRuntime } from "effect";
2
- import { PluginRuntimeImpl, PluginRuntimeService } from "../runtime";
3
- // Import the mock service factory and types
4
- import { PluginService, SecretsService } from "../runtime/services";
1
+ import { Layer, ManagedRuntime } from "effect";
2
+ import { PluginRuntime } from "../runtime";
3
+ import { PluginLifecycleService, PluginLoaderService, PluginRegistryTag, PluginService, RegistryService, SecretsConfigTag, SecretsService } from "../runtime/services";
5
4
  import { createMockModuleFederationServiceLayer } from "./mocks/module-federation.service";
6
5
  /**
7
6
  * Creates a test layer with mock ModuleFederationService for unit testing.
8
- * This mirrors PluginRuntimeService.Live but uses mock ModuleFederationService.
7
+ * This mirrors PluginService.Live() but uses mock ModuleFederationService.
9
8
  */
10
9
  export const createTestLayer = (config, pluginMap) => {
11
10
  const secrets = config.secrets || {};
12
- // Same structure as PluginRuntimeService.Live but with mock ModuleFederationService
13
- return Layer.scoped(PluginRuntimeService, Effect.gen(function* () {
14
- const pluginService = yield* PluginService;
15
- // Register cleanup finalizer for automatic resource management
16
- yield* Effect.addFinalizer(() => pluginService.cleanup().pipe(Effect.catchAll(() => Effect.void) // Ensure cleanup never fails
17
- ));
18
- return pluginService;
19
- })).pipe(Layer.provide(PluginService.Live(config.registry, secrets).pipe(Layer.provide(Layer.mergeAll(createMockModuleFederationServiceLayer(pluginMap), // Mock instead of real
20
- SecretsService.Live(secrets))))));
11
+ const contextLayer = Layer.mergeAll(Layer.succeed(PluginRegistryTag, config.registry), Layer.succeed(SecretsConfigTag, secrets));
12
+ const mockModuleFederationLayer = createMockModuleFederationServiceLayer(pluginMap);
13
+ const servicesLayer = Layer.mergeAll(mockModuleFederationLayer, SecretsService.Default, RegistryService.Default, PluginLifecycleService.Default).pipe(Layer.provide(contextLayer));
14
+ return PluginService.Default.pipe(Layer.provide(PluginLoaderService.Default), Layer.provide(servicesLayer));
21
15
  };
22
16
  /**
23
- * Creates a test plugin runtime using mock services.
24
- * This mirrors createPluginRuntime exactly but uses test layer.
17
+ * Creates a plugin runtime for locally available plugins (non-remote).
18
+ * Automatically infers type bindings from the plugin map, eliminating
19
+ * the need for manual RegistryBindings definitions.
20
+ *
21
+ * Ideal for:
22
+ * - Unit and integration tests
23
+ * - Local development and debugging
24
+ * - Monorepo setups where all plugins are in the same workspace
25
+ *
26
+ * For production with remote Module Federation plugins, use createPluginRuntime().
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const pluginMap = { "my-plugin": MyPlugin } as const;
31
+ * const runtime = createLocalPluginRuntime({ registry, secrets }, pluginMap);
32
+ *
33
+ * // Types are automatically inferred - no manual bindings needed!
34
+ * const plugin = await runtime.usePlugin("my-plugin", config);
35
+ * ```
25
36
  */
26
- export const createTestPluginRuntime = (config, pluginMap) => {
37
+ export function createLocalPluginRuntime(config, pluginMap) {
27
38
  const layer = createTestLayer(config, pluginMap);
28
39
  const runtime = ManagedRuntime.make(layer);
29
- // Same exact pattern as createPluginRuntime
30
- const createTypedRuntime = Effect.gen(function* () {
31
- const pluginService = yield* PluginRuntimeService;
32
- return new PluginRuntimeImpl(pluginService, config.registry);
33
- });
34
- return {
35
- runtime,
36
- PluginRuntime: createTypedRuntime.pipe(Effect.provide(runtime))
37
- };
38
- };
40
+ return new PluginRuntime(runtime, config.registry);
41
+ }
42
+ /**
43
+ * @deprecated Use `createLocalPluginRuntime` instead. This alias is kept for backward compatibility.
44
+ */
45
+ export const createTestPluginRuntime = createLocalPluginRuntime;
@@ -1,8 +1,6 @@
1
1
  import { Layer } from "effect";
2
+ import type { PluginConstructorWithBinding } from "../../plugin";
2
3
  import { ModuleFederationService } from "../../runtime/services/module-federation.service";
3
- import type { AnyPlugin } from "../../types";
4
- export interface TestPluginMap {
5
- [pluginId: string]: new () => AnyPlugin;
6
- }
7
- export declare const createMockModuleFederationServiceLayer: (pluginMap: TestPluginMap) => Layer.Layer<ModuleFederationService, never, never>;
4
+ export type PluginMap = Record<string, PluginConstructorWithBinding<any, any, any, any>>;
5
+ export declare const createMockModuleFederationServiceLayer: (pluginMap: PluginMap) => Layer.Layer<ModuleFederationService, never, never>;
8
6
  //# sourceMappingURL=module-federation.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.service.d.ts","sourceRoot":"","sources":["../../../src/testing/mocks/module-federation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,SAAS,CAAC;CACzC;AA6CD,eAAO,MAAM,sCAAsC,GAAI,WAAW,aAAa,uDACT,CAAC"}
1
+ {"version":3,"file":"module-federation.service.d.ts","sourceRoot":"","sources":["../../../src/testing/mocks/module-federation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAE3F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEzF,eAAO,MAAM,sCAAsC,GAAI,WAAW,SAAS,uDAoCxE,CAAC"}
@@ -1,35 +1,29 @@
1
1
  import { Effect, Layer } from "effect";
2
2
  import { ModuleFederationError } from "../../runtime/errors";
3
3
  import { ModuleFederationService } from "../../runtime/services/module-federation.service";
4
- // Create the mock service implementation
5
- const createMockService = (pluginMap) => ({
4
+ export const createMockModuleFederationServiceLayer = (pluginMap) => Layer.succeed(ModuleFederationService, {
6
5
  registerRemote: (pluginId, url) => Effect.gen(function* () {
7
- // Mock registration - succeeds if plugin is in the map
8
- // Use original pluginId as key since TestPluginMap uses original plugin IDs
9
- if (pluginId in pluginMap) {
10
- return;
6
+ console.log(`[MOCK] registerRemote called for ${pluginId}`);
7
+ if (!(pluginId in pluginMap)) {
8
+ return yield* Effect.fail(new ModuleFederationError({
9
+ pluginId,
10
+ remoteUrl: url,
11
+ cause: new Error(`Mock: Plugin ${pluginId} not available in test plugin map`),
12
+ }));
11
13
  }
12
- // Fail for plugins not in the map
13
- return yield* Effect.fail(new ModuleFederationError({
14
- pluginId,
15
- remoteUrl: url,
16
- cause: new Error(`Mock: Plugin ${pluginId} not available in test plugin map`),
17
- }));
14
+ console.log(`[MOCK] registerRemote succeeded for ${pluginId}`);
18
15
  }),
19
16
  loadRemoteConstructor: (pluginId, url) => Effect.gen(function* () {
20
- // Return the plugin constructor from the map
21
- // Use original pluginId as key since TestPluginMap uses original plugin IDs
17
+ console.log(`[MOCK] loadRemoteConstructor called for ${pluginId}`);
22
18
  const PluginConstructor = pluginMap[pluginId];
23
- if (PluginConstructor) {
24
- return PluginConstructor;
19
+ if (!PluginConstructor) {
20
+ return yield* Effect.fail(new ModuleFederationError({
21
+ pluginId,
22
+ remoteUrl: url,
23
+ cause: new Error(`Mock: Constructor for ${pluginId} not found in test plugin map`),
24
+ }));
25
25
  }
26
- // Fail for plugins not in the map
27
- return yield* Effect.fail(new ModuleFederationError({
28
- pluginId,
29
- remoteUrl: url,
30
- cause: new Error(`Mock: Constructor for ${pluginId} not found in test plugin map`),
31
- }));
26
+ console.log(`[MOCK] loadRemoteConstructor succeeded for ${pluginId}`);
27
+ return PluginConstructor;
32
28
  }),
33
29
  });
34
- // Create a Layer that provides the mock ModuleFederationService
35
- export const createMockModuleFederationServiceLayer = (pluginMap) => Layer.succeed(ModuleFederationService, createMockService(pluginMap));
package/dist/types.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type { AnyContractRouter } from "@orpc/contract";
2
2
  import type { Context, Router } from "@orpc/server";
3
- import { Scope } from "effect";
3
+ import type { Scope } from "effect";
4
4
  import type { z } from "zod";
5
5
  import type { Plugin, PluginConfigFor, PluginConstructorWithBinding } from "./plugin";
6
+ import type { PluginRuntime } from "./runtime";
6
7
  export type AnyContract = Router<AnyContractRouter, any>;
7
8
  /**
8
9
  * Base type for any plugin instance.
@@ -26,7 +27,7 @@ export type RegistryBindings = Record<string, {
26
27
  export type PluginOf<B> = B extends {
27
28
  contract: infer C;
28
29
  config: infer Conf;
29
- } ? Conf extends PluginConfigFor<infer V, infer S> ? C extends AnyContractRouter ? Plugin<C, V, S> : never : never : never;
30
+ } ? Conf extends PluginConfigFor<infer V, infer S> ? C extends AnyContractRouter ? Plugin<C, V, S, Context> : never : never : never;
30
31
  /**
31
32
  * Extracts the config type from a binding definition.
32
33
  * This provides strongly-typed configuration based on the plugin's zod schema.
@@ -68,7 +69,6 @@ export type PluginBindingsFor<R extends RegistryBindings> = {
68
69
  */
69
70
  export type PluginRegistry = Record<string, {
70
71
  remoteUrl: string;
71
- type: string;
72
72
  version?: string;
73
73
  description?: string;
74
74
  }>;
@@ -79,7 +79,6 @@ export type PluginRegistry = Record<string, {
79
79
  export type PluginRegistryFor<R extends RegistryBindings> = {
80
80
  [K in keyof R]: {
81
81
  remoteUrl: string;
82
- type: string;
83
82
  version?: string;
84
83
  description?: string;
85
84
  };
@@ -114,7 +113,6 @@ export interface PluginInstance<T extends AnyPlugin = AnyPlugin> {
114
113
  readonly pluginId: string;
115
114
  readonly version?: string;
116
115
  readonly description?: string;
117
- readonly type?: string;
118
116
  };
119
117
  }
120
118
  /**
@@ -128,7 +126,6 @@ export interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
128
126
  readonly pluginId: string;
129
127
  readonly version?: string;
130
128
  readonly description?: string;
131
- readonly type?: string;
132
129
  };
133
130
  readonly config: z.infer<T["configSchema"]>;
134
131
  readonly context: ContextOf<T>;
@@ -154,17 +151,33 @@ export interface RuntimeOptions {
154
151
  /**
155
152
  * Enhanced plugin result containing client, router, and metadata.
156
153
  */
157
- export interface PluginResult<T extends AnyPlugin = AnyPlugin> {
154
+ export interface EveryPlugin<T extends AnyPlugin = AnyPlugin> {
158
155
  readonly client: import("@orpc/server").RouterClient<RouterOf<T>, Record<never, never>>;
159
156
  readonly router: RouterOf<T>;
160
157
  readonly metadata: {
161
158
  readonly pluginId: string;
162
159
  readonly version?: string;
163
160
  readonly description?: string;
164
- readonly type?: string;
165
161
  };
166
162
  readonly initialized: InitializedPlugin<T>;
167
163
  }
164
+ /**
165
+ * Namespace containing type utilities for working with plugin results.
166
+ */
167
+ export declare namespace EveryPlugin {
168
+ /**
169
+ * Extract the typed plugin result from a runtime instance.
170
+ * Provides full type safety for plugin clients, routers, and metadata.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const runtime = createPluginRuntime<MyBindings>({...});
175
+ * let plugin: EveryPlugin.Infer<typeof runtime, "my-plugin">;
176
+ * plugin = await runtime.usePlugin("my-plugin", config);
177
+ * ```
178
+ */
179
+ type Infer<T extends PluginRuntime<any>, K extends T extends PluginRuntime<infer R> ? keyof R : never> = T extends PluginRuntime<infer R> ? EveryPlugin<PluginOf<R[K]>> : never;
180
+ }
168
181
  /**
169
182
  * Runtime configuration for the plugin system.
170
183
  * The generic R parameter enables compile-time type safety when provided.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MA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AC,SAAS,SAAS,GAAG,SAAS;IAC1D,QAAQ,CAAC,MAAM,EAAE,OAAO,cAAc,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACxF,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,yBAAiB,WAAW,CAAC;IAC3B;;;;;;;;;;OAUG;IACH,KAAY,KAAK,CACf,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAC5B,CAAC,SAAS,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,IAC1D,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAChC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB;IAChF,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "every-plugin",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -59,6 +59,9 @@
59
59
  "devDependencies": {
60
60
  "@effect/language-service": "^0.38.1",
61
61
  "@effect/vitest": "^0.25.1",
62
+ "@orpc/client": "^1.9.2",
63
+ "@orpc/openapi": "^1.9.2",
64
+ "@orpc/zod": "^1.9.2",
62
65
  "@rspack/cli": "^1.5.2",
63
66
  "@rspack/core": "^1.5.2",
64
67
  "@types/bun": "^1.2.21",