every-plugin 0.0.5 → 0.1.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 (52) hide show
  1. package/README.md +320 -6
  2. package/dist/errors.d.ts +4 -4
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +10 -10
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +3 -3
  7. package/dist/plugin.d.ts +99 -54
  8. package/dist/plugin.d.ts.map +1 -1
  9. package/dist/plugin.js +18 -16
  10. package/dist/runtime/errors.d.ts +62 -0
  11. package/dist/runtime/errors.d.ts.map +1 -0
  12. package/dist/runtime/errors.js +9 -0
  13. package/dist/runtime/index.d.ts +73 -0
  14. package/dist/runtime/index.d.ts.map +1 -0
  15. package/dist/runtime/index.js +133 -0
  16. package/dist/runtime/mf.test.d.ts +2 -0
  17. package/dist/runtime/mf.test.d.ts.map +1 -0
  18. package/dist/runtime/mf.test.js +135 -0
  19. package/dist/runtime/runtime.test.d.ts +2 -0
  20. package/dist/runtime/runtime.test.d.ts.map +1 -0
  21. package/dist/runtime/runtime.test.js +378 -0
  22. package/dist/runtime/services/module-federation.service.d.ts +44 -0
  23. package/dist/runtime/services/module-federation.service.d.ts.map +1 -0
  24. package/dist/runtime/services/module-federation.service.js +131 -0
  25. package/dist/runtime/services/plugin.service.d.ts +75 -0
  26. package/dist/runtime/services/plugin.service.d.ts.map +1 -0
  27. package/dist/runtime/services/plugin.service.js +338 -0
  28. package/dist/runtime/services/secrets.service.d.ts +37 -0
  29. package/dist/runtime/services/secrets.service.d.ts.map +1 -0
  30. package/dist/runtime/services/secrets.service.js +36 -0
  31. package/dist/runtime/services.d.ts +4 -0
  32. package/dist/runtime/services.d.ts.map +1 -0
  33. package/dist/runtime/services.js +3 -0
  34. package/dist/runtime/streaming.d.ts +29 -0
  35. package/dist/runtime/streaming.d.ts.map +1 -0
  36. package/dist/runtime/streaming.js +59 -0
  37. package/dist/runtime/streaming.test.d.ts +2 -0
  38. package/dist/runtime/streaming.test.d.ts.map +1 -0
  39. package/dist/runtime/streaming.test.js +271 -0
  40. package/dist/runtime/test-utils.d.ts +3 -0
  41. package/dist/runtime/test-utils.d.ts.map +1 -0
  42. package/dist/runtime/test-utils.js +13 -0
  43. package/dist/runtime/types.d.ts +40 -0
  44. package/dist/runtime/types.d.ts.map +1 -0
  45. package/dist/runtime/types.js +1 -0
  46. package/dist/runtime/validation.d.ts +10 -0
  47. package/dist/runtime/validation.d.ts.map +1 -0
  48. package/dist/runtime/validation.js +16 -0
  49. package/dist/source.d.ts +63 -191
  50. package/dist/source.d.ts.map +1 -1
  51. package/dist/source.js +33 -70
  52. package/package.json +44 -22
package/README.md CHANGED
@@ -1,15 +1,329 @@
1
- # core-sdk
1
+ # every-plugin
2
2
 
3
- To install dependencies:
3
+ A modular plugin runtime & system built with [Effect.TS](https://effect.website/) for loading, initializing, and executing remote plugins via [Module Federation](https://module-federation.io/).
4
+
5
+ ## Installation
4
6
 
5
7
  ```bash
6
- bun install
8
+ npm install every-plugin
9
+ # or
10
+ bun add every-plugin
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ### Basic Plugin Usage
16
+
17
+ ```typescript
18
+ import { Effect } from "effect";
19
+ import { createPluginRuntime, PluginRuntime } from "every-plugin/runtime";
20
+
21
+ // Create a managed runtime (do this once per application/worker)
22
+ const runtime = createPluginRuntime({
23
+ registry: {
24
+ "@my-org/data-processor": {
25
+ version: "1.0.0",
26
+ remoteUrl: "https://cdn.example.com/plugins/data-processor@latest/remoteEntry.js",
27
+ description: "Processes data items",
28
+ type: "pipeline"
29
+ }
30
+ },
31
+ secrets: {
32
+ API_KEY: "your-secret-key",
33
+ DATABASE_URL: "postgresql://..."
34
+ },
35
+ logger: customLogger // optional
36
+ });
37
+
38
+ // Use the runtime to execute plugins
39
+ const result = await runtime.runPromise(
40
+ Effect.gen(function* () {
41
+ const pluginRuntime = yield* PluginRuntime;
42
+
43
+ // Load, instantiate and initialize a plugin
44
+ const plugin = yield* pluginRuntime.usePlugin("@my-org/data-processor", {
45
+ apiKey: "{{API_KEY}}", // Will be hydrated from secrets
46
+ batchSize: 100
47
+ });
48
+
49
+ const output = yield* pluginRuntime.executePlugin(plugin, {
50
+ items: ["item1", "item2", "item3"]
51
+ });
52
+
53
+ return output;
54
+ })
55
+ );
56
+
57
+ console.log(result);
58
+
59
+ // Clean up when done
60
+ await runtime.dispose();
61
+ ```
62
+
63
+ ### Alternative: Direct Layer Construction
64
+
65
+ If you prefer more explicit control over the runtime construction:
66
+
67
+ ```typescript
68
+ import { Effect, ManagedRuntime } from "effect";
69
+ import { PluginRuntime } from "every-plugin/runtime";
70
+
71
+ // This is equivalent to createPluginRuntime(config)
72
+ const runtime = ManagedRuntime.make(PluginRuntime.Live({
73
+ registry: { /* ... */ },
74
+ secrets: { /* ... */ }
75
+ }));
76
+
77
+ const result = await runtime.runPromise(
78
+ Effect.gen(function* () {
79
+ const pluginRuntime = yield* PluginRuntime;
80
+ const plugin = yield* pluginRuntime.usePlugin(pluginId, config);
81
+ return yield* pluginRuntime.executePlugin(plugin, input);
82
+ })
83
+ );
84
+ ```
85
+
86
+ ### Advanced Usage - Granular Control
87
+
88
+ ```typescript
89
+ import { Effect } from "effect";
90
+ import { PluginRuntime } from "every-plugin/runtime";
91
+
92
+ const processWithGranularControl = Effect.gen(function* () {
93
+ const pluginRuntime = yield* PluginRuntime;
94
+
95
+ // Step-by-step plugin lifecycle
96
+ const constructor = yield* pluginRuntime.loadPlugin("@my-org/data-processor");
97
+ const instance = yield* pluginRuntime.instantiatePlugin(constructor);
98
+ const initialized = yield* pluginRuntime.initializePlugin(instance, config);
99
+ const output = yield* pluginRuntime.executePlugin(initialized, input);
100
+
101
+ return output;
102
+ });
103
+
104
+ await runtime.runPromise(processWithGranularControl);
105
+ ```
106
+
107
+ ### Worker Integration
108
+
109
+ Perfect for BullMQ workers or similar job processing systems:
110
+
111
+ ```typescript
112
+ import { Job } from "bullmq";
113
+ import { Effect } from "effect";
114
+ import { createPluginRuntime, PluginRuntime } from "every-plugin/runtime";
115
+
116
+ // Initialize runtime once per worker
117
+ const runtime = createPluginRuntime({
118
+ registry: pluginRegistry,
119
+ secrets: await loadSecrets(),
120
+ });
121
+
122
+ // Job processor
123
+ const processJob = (job: Job) =>
124
+ runtime.runPromise(
125
+ Effect.gen(function* () {
126
+ const pluginRuntime = yield* PluginRuntime;
127
+ const { pluginId, config, input } = job.data;
128
+
129
+ const plugin = yield* pluginRuntime.usePlugin(pluginId, config);
130
+ return yield* pluginRuntime.executePlugin(plugin, input);
131
+ })
132
+ );
133
+
134
+ // Worker setup
135
+ const worker = new Worker("my-queue", processJob);
136
+
137
+ // Cleanup on shutdown
138
+ process.on("SIGTERM", async () => {
139
+ await worker.close();
140
+ await runtime.dispose();
141
+ });
142
+ ```
143
+
144
+ ```typescript
145
+ import { Effect } from "effect";
146
+ import { createPluginRuntime, PluginRuntime } from "every-plugin/runtime";
147
+
148
+ // Create a managed runtime (do this once per application/worker)
149
+ const runtime = createPluginRuntime({
150
+ registry: {
151
+ "@my-org/data-processor": {
152
+ version: "1.0.0",
153
+ remoteUrl: "https://cdn.example.com/plugins/data-processor@latest/remoteEntry.js",
154
+ description: "Processes data items",
155
+ type: "pipeline"
156
+ }
157
+ },
158
+ secrets: {
159
+ API_KEY: "your-secret-key",
160
+ DATABASE_URL: "postgresql://..."
161
+ },
162
+ logger: customLogger // optional
163
+ });
164
+
165
+ // Use the runtime to execute plugins
166
+ const result = await runtime.runPromise(
167
+ Effect.gen(function* () {
168
+ const pluginRuntime = yield* PluginRuntime;
169
+
170
+ return yield* pluginRuntime.streamPlugin(
171
+ "test-source-plugin",
172
+ TEST_CONFIG,
173
+ TEST_SEARCH_INPUT,
174
+ ).pipe(
175
+ Effect.flatMap(stream => stream.pipe(Stream.runCollect)),
176
+ Effect.catchAll((error: unknown) => {
177
+ // Should handle callback errors
178
+ expect(error).toBeDefined();
179
+ return Effect.succeed("callback-error-handled");
180
+ }),
181
+ );
182
+
183
+ // Load, instantiate and initialize a plugin
184
+ const plugin = yield* pluginRuntime.usePlugin("@my-org/data-processor", {
185
+ apiKey: "{{API_KEY}}", // Will be hydrated from secrets
186
+ batchSize: 100
187
+ });
188
+
189
+ // I want to do this in the source stream
190
+ const output = yield* pluginRuntime.executePlugin(plugin, {
191
+ items: ["item1", "item2", "item3"]
192
+ });
193
+
194
+
195
+
196
+ return output;
197
+ })
198
+ );
199
+
200
+ console.log(result);
201
+
202
+ // Clean up when done
203
+ await runtime.dispose();
204
+ ```
205
+
206
+ ### React/Next.js Integration
207
+
208
+ ```typescript
209
+ import { createPluginRuntime, PluginRuntime } from "every-plugin/runtime";
210
+ import { Effect } from "effect";
211
+
212
+ // Create runtime at app level
213
+ const pluginRuntime = createPluginRuntime({
214
+ registry: clientSideRegistry,
215
+ secrets: {} // No secrets on client side
216
+ });
217
+
218
+ // In a React component or API route
219
+ export async function executePlugin(pluginId: string, config: any, input: any) {
220
+ return pluginRuntime.runPromise(
221
+ Effect.gen(function* () {
222
+ const runtime = yield* PluginRuntime;
223
+ const plugin = yield* runtime.usePlugin(pluginId, config);
224
+ return yield* runtime.executePlugin(plugin, input);
225
+ })
226
+ );
227
+ }
228
+
229
+ // Cleanup in app teardown
230
+ export function cleanup() {
231
+ return pluginRuntime.dispose();
232
+ }
233
+ ```
234
+
235
+ ## Core Concepts
236
+
237
+ ### Plugin Registry
238
+
239
+ The registry defines available plugins and their remote locations:
240
+
241
+ ```typescript
242
+ type PluginRegistry = {
243
+ [pluginId: string]: {
244
+ version: string;
245
+ remoteUrl: string;
246
+ description?: string;
247
+ type?: string;
248
+ };
249
+ };
250
+ ```
251
+
252
+ ### Secret Hydration
253
+
254
+ Secrets are automatically hydrated using Mustache-style templating:
255
+
256
+ ```typescript
257
+ const config = {
258
+ apiKey: "{{API_KEY}}", // Will be replaced with actual secret
259
+ endpoint: "https://api.example.com"
260
+ };
261
+ ```
262
+
263
+ ### Plugin Lifecycle
264
+
265
+ 1. **Load**: Download and cache the remote plugin module
266
+ 2. **Instantiate**: Create a new instance of the plugin class
267
+ 3. **Initialize**: Configure the plugin with validated config and secrets
268
+ 4. **Execute**: Run the plugin with validated input, return validated output
269
+
270
+ ### Error Handling
271
+
272
+ All operations return Effect types with proper error handling:
273
+
274
+ ```typescript
275
+ const result = await runtime.runPromise(
276
+ Effect.gen(function* () {
277
+ const pluginRuntime = yield* PluginRuntime;
278
+ return yield* pluginRuntime.usePlugin(pluginId, config);
279
+ }).pipe(
280
+ Effect.catchAll((error) => {
281
+ console.error("Plugin execution failed:", error);
282
+ return Effect.succeed(null); // Fallback value
283
+ })
284
+ )
285
+ );
7
286
  ```
8
287
 
9
- To run:
288
+ ## API Reference
289
+
290
+ ### `createPluginRuntime(config)`
291
+
292
+ Creates a managed runtime for plugin execution.
293
+
294
+ **Parameters:**
295
+
296
+ - `config.registry`: Plugin registry mapping
297
+ - `config.secrets`: Secret values for hydration (optional)
298
+ - `config.logger`: Custom logger implementation (optional)
299
+
300
+ **Returns:** `ManagedRuntime` instance
301
+
302
+ ### `PluginRuntime`
303
+
304
+ Effect service tag for accessing the plugin runtime within Effect workflows.
305
+
306
+ ### Plugin Runtime Methods
307
+
308
+ - `loadPlugin(pluginId)`: Load plugin constructor from registry
309
+ - `instantiatePlugin(constructor)`: Create plugin instance
310
+ - `initializePlugin(instance, config)`: Initialize with config and secrets
311
+ - `executePlugin(plugin, input)`: Execute plugin with input
312
+ - `usePlugin(pluginId, config)`: Load + instantiate + initialize in one step (does not execute)
313
+
314
+ ## Development
10
315
 
11
316
  ```bash
12
- bun run index.ts
317
+ # Install dependencies
318
+ bun install
319
+
320
+ # Build the package
321
+ bun run build
322
+
323
+ # Run tests
324
+ bun test
13
325
  ```
14
326
 
15
- This project was created using `bun init` in bun v1.2.14. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
327
+ ## License
328
+
329
+ MIT
package/dist/errors.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export declare class PluginExecutionError extends Error {
2
- readonly retryable: boolean;
3
- constructor(message: string, retryable?: boolean);
2
+ readonly retryable: boolean;
3
+ constructor(message: string, retryable?: boolean);
4
4
  }
5
5
  export declare class ConfigurationError extends PluginExecutionError {
6
- constructor(message: string);
6
+ constructor(message: string);
7
7
  }
8
- //# sourceMappingURL=errors.d.ts.map
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,qBAAa,oBAAqB,SAAQ,KAAK;aACA,SAAS,EAAE,OAAO;gBAAnD,OAAO,EAAE,MAAM,EAAkB,SAAS,GAAE,OAAc;CAIvE;AAED,qBAAa,kBAAmB,SAAQ,oBAAoB;gBAC9C,OAAO,EAAE,MAAM;CAI5B"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,qBAAa,oBAAqB,SAAQ,KAAK;aAG7B,SAAS,EAAE,OAAO;gBADlC,OAAO,EAAE,MAAM,EACC,SAAS,GAAE,OAAc;CAK1C;AAED,qBAAa,kBAAmB,SAAQ,oBAAoB;gBAC/C,OAAO,EAAE,MAAM;CAI3B"}
package/dist/errors.js CHANGED
@@ -1,15 +1,15 @@
1
1
  // Plugin execution errors
2
2
  export class PluginExecutionError extends Error {
3
- retryable;
4
- constructor(message, retryable = true) {
5
- super(message);
6
- this.retryable = retryable;
7
- this.name = 'PluginExecutionError';
8
- }
3
+ retryable;
4
+ constructor(message, retryable = true) {
5
+ super(message);
6
+ this.retryable = retryable;
7
+ this.name = "PluginExecutionError";
8
+ }
9
9
  }
10
10
  export class ConfigurationError extends PluginExecutionError {
11
- constructor(message) {
12
- super(message, false); // Configuration errors are not retryable
13
- this.name = 'ConfigurationError';
14
- }
11
+ constructor(message) {
12
+ super(message, false); // Configuration errors are not retryable
13
+ this.name = "ConfigurationError";
14
+ }
15
15
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { Effect } from "effect";
2
2
  export { z } from "zod";
3
- export * from './errors';
4
- export * from './plugin';
5
- export * from './source';
6
- //# sourceMappingURL=index.d.ts.map
3
+ export * from "./errors";
4
+ export * from "./plugin";
5
+ export * from "./source";
6
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Effect } from "effect";
2
2
  export { z } from "zod";
3
- export * from './errors';
4
- export * from './plugin';
5
- export * from './source';
3
+ export * from "./errors";
4
+ export * from "./plugin";
5
+ export * from "./source";
package/dist/plugin.d.ts CHANGED
@@ -1,66 +1,111 @@
1
- import type { JSONSchemaType } from "ajv/dist/2020";
2
1
  import { Context, type Effect } from "effect";
3
- import { z } from 'zod';
2
+ import { z } from "zod";
4
3
  import type { ConfigurationError, PluginExecutionError } from "./errors";
5
- export declare const createOutputSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
6
- success: z.ZodBoolean;
7
- data: z.ZodOptional<T>;
8
- errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
- message: z.ZodString;
10
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
11
- stack: z.ZodOptional<z.ZodString>;
12
- }, z.core.$strip>>>;
13
- }, z.core.$strip>;
14
- export declare function createConfigSchema(): z.ZodObject<{
15
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
- secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4
+ export declare const createOutputSchema: <T extends z.ZodTypeAny>(
5
+ dataSchema: T,
6
+ ) => z.ZodObject<
7
+ {
8
+ success: z.ZodBoolean;
9
+ data: z.ZodOptional<T>;
10
+ errors: z.ZodOptional<
11
+ z.ZodArray<
12
+ z.ZodObject<
13
+ {
14
+ message: z.ZodString;
15
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ stack: z.ZodOptional<z.ZodString>;
17
+ },
18
+ z.core.$strip
19
+ >
20
+ >
21
+ >;
22
+ },
23
+ z.core.$strip
24
+ >;
25
+ export declare function createConfigSchema<
26
+ V extends z.ZodTypeAny,
27
+ S extends z.ZodTypeAny,
28
+ >(
29
+ variablesSchema?: V,
30
+ secretsSchema?: S,
31
+ ): z.ZodObject<{
32
+ variables: z.ZodOptional<V>;
33
+ secrets: z.ZodOptional<S>;
17
34
  }>;
18
- export declare function createConfigSchema<V extends z.ZodTypeAny>(variablesSchema?: V): z.ZodObject<{
19
- variables: z.ZodOptional<V>;
20
- secrets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
- }>;
22
- export declare function createConfigSchema<V extends z.ZodTypeAny, S extends z.ZodTypeAny>(variablesSchema?: V, secretsSchema?: S): z.ZodObject<{
23
- variables: z.ZodOptional<V>;
24
- secrets: z.ZodOptional<S>;
25
- }>;
26
- export declare function createInputSchema<I extends z.ZodTypeAny>(inputSchema: I): I;
27
- export declare const ErrorDetailsSchema: z.ZodObject<{
28
- message: z.ZodString;
29
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
30
- stack: z.ZodOptional<z.ZodString>;
31
- }, z.core.$strip>;
35
+ export declare function createInputSchema<I extends z.ZodTypeAny>(
36
+ inputSchema: I,
37
+ ): I;
38
+ export declare const ErrorDetailsSchema: z.ZodObject<
39
+ {
40
+ message: z.ZodString;
41
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
42
+ stack: z.ZodOptional<z.ZodString>;
43
+ },
44
+ z.core.$strip
45
+ >;
32
46
  export type ErrorDetails = z.infer<typeof ErrorDetailsSchema>;
33
- export type Config<V extends z.ZodTypeAny = z.ZodRecord<z.ZodString, z.ZodUnknown>, S extends z.ZodTypeAny = z.ZodRecord<z.ZodString, z.ZodUnknown>> = z.infer<ReturnType<typeof createConfigSchema<V, S>>>;
34
- export type Input<I extends z.ZodTypeAny> = z.infer<ReturnType<typeof createInputSchema<I>>>;
35
- export type Output<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof createOutputSchema<T>>>;
36
- export interface Plugin<TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TConfigSchema extends z.ZodTypeAny> {
37
- readonly id: string;
38
- readonly type: PluginType;
39
- initialize(config?: z.infer<TConfigSchema>): Effect.Effect<void, ConfigurationError, PluginLoggerTag>;
40
- execute(input: z.infer<TInputSchema>): Effect.Effect<z.infer<TOutputSchema>, PluginExecutionError, PluginLoggerTag>;
41
- shutdown(): Effect.Effect<void, never, PluginLoggerTag>;
47
+ export type Config<
48
+ V extends z.ZodTypeAny = z.ZodRecord<z.ZodString, z.ZodUnknown>,
49
+ S extends z.ZodTypeAny = z.ZodRecord<z.ZodString, z.ZodUnknown>,
50
+ > = z.infer<ReturnType<typeof createConfigSchema<V, S>>>;
51
+ export type Input<I extends z.ZodTypeAny> = z.infer<
52
+ ReturnType<typeof createInputSchema<I>>
53
+ >;
54
+ export type Output<T extends z.ZodTypeAny> = z.infer<
55
+ ReturnType<typeof createOutputSchema<T>>
56
+ >;
57
+ export interface Plugin<
58
+ TInputSchema extends z.ZodTypeAny,
59
+ TOutputSchema extends z.ZodTypeAny,
60
+ TConfigSchema extends z.ZodTypeAny,
61
+ > {
62
+ readonly id: string;
63
+ readonly type: PluginType;
64
+ readonly inputSchema: TInputSchema;
65
+ readonly outputSchema: TOutputSchema;
66
+ readonly configSchema: TConfigSchema;
67
+ initialize(
68
+ config?: z.infer<TConfigSchema>,
69
+ ): Effect.Effect<void, ConfigurationError, PluginLoggerTag>;
70
+ execute(
71
+ input: z.infer<TInputSchema>,
72
+ ): Effect.Effect<
73
+ z.infer<TOutputSchema>,
74
+ PluginExecutionError,
75
+ PluginLoggerTag
76
+ >;
77
+ shutdown(): Effect.Effect<void, never, PluginLoggerTag>;
42
78
  }
43
79
  export type PluginType = "transformer" | "distributor" | "source";
44
80
  export interface PluginMetadata {
45
- remoteUrl: string;
46
- type?: PluginType;
47
- configSchema: JSONSchemaType<any>;
48
- inputSchema: JSONSchemaType<any>;
49
- outputSchema: JSONSchemaType<any>;
50
- version?: string;
51
- description?: string;
81
+ remoteUrl: string;
82
+ type?: PluginType;
83
+ version?: string;
84
+ description?: string;
52
85
  }
53
86
  export interface PluginRegistry {
54
- [pluginId: string]: PluginMetadata;
87
+ [pluginId: string]: PluginMetadata;
55
88
  }
56
89
  export interface PluginLogger {
57
- readonly logInfo: (message: string, context?: unknown) => Effect.Effect<void>;
58
- readonly logWarning: (message: string, context?: unknown) => Effect.Effect<void>;
59
- readonly logError: (message: string, error?: unknown, context?: unknown) => Effect.Effect<void>;
60
- readonly logDebug: (message: string, context?: unknown) => Effect.Effect<void>;
61
- }
62
- declare const PluginLoggerTag_base: Context.TagClass<PluginLoggerTag, "PluginLogger", PluginLogger>;
63
- export declare class PluginLoggerTag extends PluginLoggerTag_base {
90
+ readonly logInfo: (message: string, context?: unknown) => Effect.Effect<void>;
91
+ readonly logWarning: (
92
+ message: string,
93
+ context?: unknown,
94
+ ) => Effect.Effect<void>;
95
+ readonly logError: (
96
+ message: string,
97
+ error?: unknown,
98
+ context?: unknown,
99
+ ) => Effect.Effect<void>;
100
+ readonly logDebug: (
101
+ message: string,
102
+ context?: unknown,
103
+ ) => Effect.Effect<void>;
64
104
  }
65
- export {};
66
- //# sourceMappingURL=plugin.d.ts.map
105
+ declare const PluginLoggerTag_base: Context.TagClass<
106
+ PluginLoggerTag,
107
+ "PluginLogger",
108
+ PluginLogger
109
+ >;
110
+ export declare class PluginLoggerTag extends PluginLoggerTag_base {}
111
+ //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,E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G,aAAa,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,UAAU,EAAE,CACpB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACzB;;AAED,qBAAa,eAAgB,SAAQ,oBAGlC;CAAG"}
package/dist/plugin.js CHANGED
@@ -1,25 +1,27 @@
1
1
  import { Context } from "effect";
2
- import { z } from 'zod';
2
+ import { z } from "zod";
3
3
  // Helpers
4
- export const createOutputSchema = (dataSchema) => z.object({
5
- success: z.boolean(),
6
- data: dataSchema.optional(),
7
- errors: z.array(ErrorDetailsSchema).optional(),
8
- });
4
+ export const createOutputSchema = (dataSchema) =>
5
+ z.object({
6
+ success: z.boolean(),
7
+ data: dataSchema.optional(),
8
+ errors: z.array(ErrorDetailsSchema).optional(),
9
+ });
9
10
  export function createConfigSchema(variablesSchema, secretsSchema) {
10
- return z.object({
11
- variables: (variablesSchema ?? z.record(z.string(), z.unknown())).optional(),
12
- secrets: (secretsSchema ?? z.record(z.string(), z.unknown())).optional(),
13
- });
11
+ return z.object({
12
+ variables: (
13
+ variablesSchema ?? z.record(z.string(), z.unknown())
14
+ ).optional(),
15
+ secrets: (secretsSchema ?? z.record(z.string(), z.unknown())).optional(),
16
+ });
14
17
  }
15
18
  export function createInputSchema(inputSchema) {
16
- return inputSchema;
19
+ return inputSchema;
17
20
  }
18
21
  // Core schemas
19
22
  export const ErrorDetailsSchema = z.object({
20
- message: z.string(),
21
- details: z.record(z.string(), z.unknown()).optional(),
22
- stack: z.string().optional(),
23
+ message: z.string(),
24
+ details: z.record(z.string(), z.unknown()).optional(),
25
+ stack: z.string().optional(),
23
26
  });
24
- export class PluginLoggerTag extends Context.Tag("PluginLogger")() {
25
- }
27
+ export class PluginLoggerTag extends Context.Tag("PluginLogger")() {}