every-plugin 0.1.2 → 0.1.4
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/client/index.d.ts +18 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +33 -0
- package/dist/effect.d.ts +2 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/orpc.d.ts +3 -0
- package/dist/orpc.d.ts.map +1 -0
- package/dist/orpc.js +2 -0
- package/dist/plugin.d.ts +56 -85
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +33 -103
- package/dist/runtime/errors.d.ts +0 -14
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js +0 -2
- package/dist/runtime/index.d.ts +40 -18
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +127 -24
- package/dist/runtime/services/module-federation.service.d.ts +3 -2
- package/dist/runtime/services/module-federation.service.d.ts.map +1 -1
- package/dist/runtime/services/module-federation.service.js +21 -23
- package/dist/runtime/services/normalize.d.ts +18 -0
- package/dist/runtime/services/normalize.d.ts.map +1 -0
- package/dist/runtime/services/normalize.js +17 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.ts +17 -0
- package/dist/runtime/services/plugin-lifecycle.service.d.ts.map +1 -0
- package/dist/runtime/services/plugin-lifecycle.service.js +35 -0
- package/dist/runtime/services/plugin-loader.service.d.ts +21 -0
- package/dist/runtime/services/plugin-loader.service.d.ts.map +1 -0
- package/dist/runtime/services/plugin-loader.service.js +83 -0
- package/dist/runtime/services/plugin.service.d.ts +12 -20
- package/dist/runtime/services/plugin.service.d.ts.map +1 -1
- package/dist/runtime/services/plugin.service.js +18 -268
- package/dist/runtime/services/secrets.service.d.ts +2 -3
- package/dist/runtime/services/secrets.service.d.ts.map +1 -1
- package/dist/runtime/services/secrets.service.js +7 -5
- package/dist/runtime/services.d.ts +1 -1
- package/dist/runtime/services.d.ts.map +1 -1
- package/dist/runtime/services.js +1 -1
- package/dist/testing/index.d.ts +11 -16
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +25 -27
- package/dist/testing/mocks/module-federation.service.d.ts +1 -1
- package/dist/testing/mocks/module-federation.service.d.ts.map +1 -1
- package/dist/types.d.ts +177 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/zod.d.ts +2 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +1 -0
- package/package.json +99 -57
- package/dist/runtime/streaming/index.d.ts +0 -4
- package/dist/runtime/streaming/index.d.ts.map +0 -1
- package/dist/runtime/streaming/index.js +0 -2
- package/dist/runtime/streaming/state-effects.d.ts +0 -28
- package/dist/runtime/streaming/state-effects.d.ts.map +0 -1
- package/dist/runtime/streaming/state-effects.js +0 -30
- package/dist/runtime/streaming/streaming.d.ts +0 -8
- package/dist/runtime/streaming/streaming.d.ts.map +0 -1
- package/dist/runtime/streaming/streaming.js +0 -113
- package/dist/runtime/streaming/types.d.ts +0 -19
- package/dist/runtime/streaming/types.d.ts.map +0 -1
- package/dist/runtime/test-utils.d.ts +0 -3
- package/dist/runtime/test-utils.d.ts.map +0 -1
- package/dist/runtime/test-utils.js +0 -7
- package/dist/runtime/types.d.ts +0 -40
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- /package/dist/{runtime/streaming/types.js → types.js} +0 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { AnyContractRouter } from "@orpc/contract";
|
|
2
|
+
import type { Context, Router } from "@orpc/server";
|
|
3
|
+
import { Scope } from "effect";
|
|
4
|
+
import type { z } from "zod";
|
|
5
|
+
import type { Plugin, PluginConfigFor, PluginConstructorWithBinding } from "./plugin";
|
|
6
|
+
export type AnyContract = Router<AnyContractRouter, any>;
|
|
7
|
+
/**
|
|
8
|
+
* Base type for any plugin instance.
|
|
9
|
+
* This is the foundation that enables type inference across the entire plugin system.
|
|
10
|
+
* Uses 'any' for context to allow plugins with custom context types.
|
|
11
|
+
*/
|
|
12
|
+
export type AnyPlugin = Plugin<AnyContractRouter, z.ZodTypeAny, z.ZodTypeAny, any>;
|
|
13
|
+
/**
|
|
14
|
+
* Registry bindings define the compile-time shape of available plugins.
|
|
15
|
+
* This is a type-only construct that enables full IDE autocomplete and type safety
|
|
16
|
+
* without requiring runtime plugin imports.
|
|
17
|
+
*/
|
|
18
|
+
export type RegistryBindings = Record<string, {
|
|
19
|
+
contract: AnyContractRouter;
|
|
20
|
+
config: PluginConfigFor<z.ZodTypeAny, z.ZodTypeAny>;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Extracts the Plugin type from a binding definition.
|
|
24
|
+
* This enables type inference: Binding → Plugin → Router → Client
|
|
25
|
+
*/
|
|
26
|
+
export type PluginOf<B> = B extends {
|
|
27
|
+
contract: infer C;
|
|
28
|
+
config: infer Conf;
|
|
29
|
+
} ? Conf extends PluginConfigFor<infer V, infer S> ? C extends AnyContractRouter ? Plugin<C, V, S> : never : never : never;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the config type from a binding definition.
|
|
32
|
+
* This provides strongly-typed configuration based on the plugin's zod schema.
|
|
33
|
+
*/
|
|
34
|
+
export type ConfigOf<B> = z.infer<PluginOf<B>["configSchema"]>;
|
|
35
|
+
/**
|
|
36
|
+
* Extracts the router type from a plugin.
|
|
37
|
+
* This enables type inference from Plugin → Router → RouterClient with full procedure autocomplete.
|
|
38
|
+
*/
|
|
39
|
+
export type RouterOf<T extends AnyPlugin> = ReturnType<T["createRouter"]>;
|
|
40
|
+
/**
|
|
41
|
+
* Extracts the context type from a plugin.
|
|
42
|
+
* This is used for typing the router client context parameter.
|
|
43
|
+
*/
|
|
44
|
+
export type ContextOf<T extends AnyPlugin> = T extends Plugin<AnyContractRouter, z.ZodTypeAny, z.ZodTypeAny, infer TContext> ? TContext : never;
|
|
45
|
+
/**
|
|
46
|
+
* Infers binding definitions from plugin constructor objects.
|
|
47
|
+
* Used to derive RegistryBindings from a collection of plugin constructors.
|
|
48
|
+
*/
|
|
49
|
+
export type InferBindingsFromPlugins<T> = {
|
|
50
|
+
[K in keyof T]: T[K] extends PluginConstructorWithBinding<infer C, infer V, infer S, infer Ctx> ? {
|
|
51
|
+
contract: C;
|
|
52
|
+
config: PluginConfigFor<V, S>;
|
|
53
|
+
} : never;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Converts registry bindings to plugin constructor types.
|
|
57
|
+
* This is used internally by the runtime to maintain type safety.
|
|
58
|
+
*/
|
|
59
|
+
export type PluginBindingsFor<R extends RegistryBindings> = {
|
|
60
|
+
[K in keyof R]: R[K] extends {
|
|
61
|
+
contract: infer C;
|
|
62
|
+
config: infer Conf;
|
|
63
|
+
} ? Conf extends PluginConfigFor<infer V, infer S> ? C extends AnyContractRouter ? PluginConstructorWithBinding<C, V, S, Context> : never : never : never;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Runtime registry configuration.
|
|
67
|
+
* Maps plugin IDs to their remote URLs and metadata.
|
|
68
|
+
*/
|
|
69
|
+
export type PluginRegistry = Record<string, {
|
|
70
|
+
remoteUrl: string;
|
|
71
|
+
type: string;
|
|
72
|
+
version?: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Type-safe registry that enforces key alignment with bindings.
|
|
77
|
+
* When used with RegistryBindings, ensures plugin IDs match between registry and type definitions.
|
|
78
|
+
*/
|
|
79
|
+
export type PluginRegistryFor<R extends RegistryBindings> = {
|
|
80
|
+
[K in keyof R]: {
|
|
81
|
+
remoteUrl: string;
|
|
82
|
+
type: string;
|
|
83
|
+
version?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Configuration for secrets injection.
|
|
89
|
+
* Secrets are hydrated into plugin configs using template replacement.
|
|
90
|
+
*/
|
|
91
|
+
export interface SecretsConfig {
|
|
92
|
+
[key: string]: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Plugin constructor with metadata.
|
|
96
|
+
* Represents a loaded plugin class ready for instantiation.
|
|
97
|
+
*/
|
|
98
|
+
export interface PluginConstructor<T extends AnyPlugin = AnyPlugin> {
|
|
99
|
+
readonly ctor: new () => T;
|
|
100
|
+
readonly metadata: {
|
|
101
|
+
readonly pluginId: string;
|
|
102
|
+
readonly version?: string;
|
|
103
|
+
readonly description?: string;
|
|
104
|
+
readonly type?: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Instantiated plugin with metadata.
|
|
109
|
+
* Represents a plugin instance ready for initialization.
|
|
110
|
+
*/
|
|
111
|
+
export interface PluginInstance<T extends AnyPlugin = AnyPlugin> {
|
|
112
|
+
readonly plugin: T;
|
|
113
|
+
readonly metadata: {
|
|
114
|
+
readonly pluginId: string;
|
|
115
|
+
readonly version?: string;
|
|
116
|
+
readonly description?: string;
|
|
117
|
+
readonly type?: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Fully initialized plugin ready for use.
|
|
122
|
+
* Contains the plugin instance, validated config, execution context, and scope.
|
|
123
|
+
* This is what gets passed to createPluginClient for type-safe procedure calls.
|
|
124
|
+
*/
|
|
125
|
+
export interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
|
|
126
|
+
readonly plugin: T;
|
|
127
|
+
readonly metadata: {
|
|
128
|
+
readonly pluginId: string;
|
|
129
|
+
readonly version?: string;
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
readonly type?: string;
|
|
132
|
+
};
|
|
133
|
+
readonly config: z.infer<T["configSchema"]>;
|
|
134
|
+
readonly context: ContextOf<T>;
|
|
135
|
+
readonly scope: Scope.CloseableScope;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Runtime options for plugin execution and resource management.
|
|
139
|
+
*/
|
|
140
|
+
export interface RuntimeOptions {
|
|
141
|
+
/** Resource isolation level for plugins */
|
|
142
|
+
isolation?: "strict" | "shared" | "none";
|
|
143
|
+
/** Memory limit per plugin instance */
|
|
144
|
+
memoryLimit?: string;
|
|
145
|
+
/** Maximum concurrent plugin operations */
|
|
146
|
+
concurrency?: number;
|
|
147
|
+
/** Resource timeout for plugin operations */
|
|
148
|
+
resourceTimeout?: string;
|
|
149
|
+
/** Enable debug logging */
|
|
150
|
+
debug?: boolean;
|
|
151
|
+
/** Enable metrics collection */
|
|
152
|
+
metrics?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Enhanced plugin result containing client, router, and metadata.
|
|
156
|
+
*/
|
|
157
|
+
export interface PluginResult<T extends AnyPlugin = AnyPlugin> {
|
|
158
|
+
readonly client: import("@orpc/server").RouterClient<RouterOf<T>, Record<never, never>>;
|
|
159
|
+
readonly router: RouterOf<T>;
|
|
160
|
+
readonly metadata: {
|
|
161
|
+
readonly pluginId: string;
|
|
162
|
+
readonly version?: string;
|
|
163
|
+
readonly description?: string;
|
|
164
|
+
readonly type?: string;
|
|
165
|
+
};
|
|
166
|
+
readonly initialized: InitializedPlugin<T>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Runtime configuration for the plugin system.
|
|
170
|
+
* The generic R parameter enables compile-time type safety when provided.
|
|
171
|
+
*/
|
|
172
|
+
export interface PluginRuntimeConfig<R extends RegistryBindings = RegistryBindings> {
|
|
173
|
+
registry: PluginRegistry;
|
|
174
|
+
secrets?: SecretsConfig;
|
|
175
|
+
options?: RuntimeOptions;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"A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AC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAC5C;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/dist/zod.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC"}
|
package/dist/zod.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "zod";
|
package/package.json
CHANGED
|
@@ -1,59 +1,101 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2
|
+
"name": "every-plugin",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./runtime": {
|
|
12
|
+
"types": "./dist/runtime/index.d.ts",
|
|
13
|
+
"default": "./dist/runtime/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./dist/client/index.d.ts",
|
|
17
|
+
"default": "./dist/client/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./testing": {
|
|
20
|
+
"types": "./dist/testing/index.d.ts",
|
|
21
|
+
"default": "./dist/testing/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./normalize": {
|
|
24
|
+
"types": "./dist/runtime/services/normalize.d.ts",
|
|
25
|
+
"require": "./dist/runtime/services/normalize.js",
|
|
26
|
+
"default": "./dist/runtime/services/normalize.js"
|
|
27
|
+
},
|
|
28
|
+
"./effect": {
|
|
29
|
+
"types": "./dist/effect.d.ts",
|
|
30
|
+
"default": "./dist/effect.js"
|
|
31
|
+
},
|
|
32
|
+
"./zod": {
|
|
33
|
+
"types": "./dist/zod.d.ts",
|
|
34
|
+
"default": "./dist/zod.js"
|
|
35
|
+
},
|
|
36
|
+
"./orpc": {
|
|
37
|
+
"types": "./dist/orpc.d.ts",
|
|
38
|
+
"default": "./dist/orpc.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -b",
|
|
47
|
+
"test": "vitest run --config vitest.unit.config.ts",
|
|
48
|
+
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
49
|
+
"test:integration": "npm run test:build-plugin && vitest run --config vitest.integration.config.ts",
|
|
50
|
+
"test:all": "npm run test:unit && npm run test:integration",
|
|
51
|
+
"test:watch": "vitest --config vitest.unit.config.ts --watch",
|
|
52
|
+
"test:watch:integration": "vitest --config vitest.integration.config.ts --watch",
|
|
53
|
+
"test:ui": "vitest --ui",
|
|
54
|
+
"test:build-plugin": "cd __tests__/test-plugin && NODE_ENV=test npm run build"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"typescript": "^5.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@effect/language-service": "^0.38.1",
|
|
61
|
+
"@effect/vitest": "^0.25.1",
|
|
62
|
+
"@rspack/cli": "^1.5.2",
|
|
63
|
+
"@rspack/core": "^1.5.2",
|
|
64
|
+
"@types/bun": "^1.2.21",
|
|
65
|
+
"@types/node": "^24.3.1",
|
|
66
|
+
"@vitest/ui": "3.2.4",
|
|
67
|
+
"bun-types": "^1.2.21",
|
|
68
|
+
"sirv": "^3.0.2",
|
|
69
|
+
"vitest": "^3.2.4"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@better-fetch/fetch": "^1.1.18",
|
|
73
|
+
"@module-federation/enhanced": "^0.19.1",
|
|
74
|
+
"@module-federation/node": "^2.7.15",
|
|
75
|
+
"@module-federation/runtime-core": "^0.19.1",
|
|
76
|
+
"@orpc/contract": "1.8.6",
|
|
77
|
+
"@orpc/server": "1.8.6",
|
|
78
|
+
"effect": "3.17.13",
|
|
79
|
+
"zod": "4.1.5"
|
|
80
|
+
},
|
|
81
|
+
"keywords": [
|
|
82
|
+
"plugin",
|
|
83
|
+
"module-federation",
|
|
84
|
+
"orpc",
|
|
85
|
+
"zod",
|
|
86
|
+
"typescript"
|
|
87
|
+
],
|
|
88
|
+
"author": "plugin.every.near",
|
|
89
|
+
"license": "MIT",
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "https://github.com/near-everything/every-plugin.git"
|
|
93
|
+
},
|
|
94
|
+
"bugs": {
|
|
95
|
+
"url": "https://github.com/near-everything/every-plugin/issues"
|
|
96
|
+
},
|
|
97
|
+
"homepage": "https://plugin.everything.dev",
|
|
98
|
+
"workspaces": [
|
|
99
|
+
"./__tests__/test-plugin/*"
|
|
100
|
+
]
|
|
59
101
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/streaming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State transition helpers for common patterns
|
|
3
|
-
*/
|
|
4
|
-
export declare const StateTransitions: {
|
|
5
|
-
/**
|
|
6
|
-
* Transition to a new phase with optional updates
|
|
7
|
-
*/
|
|
8
|
-
to: <T extends {
|
|
9
|
-
phase?: string;
|
|
10
|
-
}>(phase: string, updates?: Partial<T>) => (state: T) => T;
|
|
11
|
-
/**
|
|
12
|
-
* Add polling delay to state
|
|
13
|
-
*/
|
|
14
|
-
withPolling: <T>(delayMs: number) => (state: T) => T;
|
|
15
|
-
/**
|
|
16
|
-
* Set error state with message and stop polling
|
|
17
|
-
*/
|
|
18
|
-
withError: <T>(errorMessage: string) => (state: T) => T;
|
|
19
|
-
/**
|
|
20
|
-
* Preserve existing state with updates
|
|
21
|
-
*/
|
|
22
|
-
update: <T>(updates: Partial<T>) => (state: T) => T;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Simple pipe utility for composing state transformations
|
|
26
|
-
*/
|
|
27
|
-
export declare const pipe: <T>(value: T, ...fns: Array<(val: T) => T>) => T;
|
|
28
|
-
//# sourceMappingURL=state-effects.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-effects.d.ts","sourceRoot":"","sources":["../../../src/runtime/streaming/state-effects.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;SACE,CAAC,SAAS;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,SAAS,MAAM,YAAW,OAAO,CAAC,CAAC,CAAC,MAClE,OAAO,CAAC,KAAG,CAAC;IAEf;;OAEG;kBACW,CAAC,WAAW,MAAM,MAC7B,OAAO,CAAC,KAAG,CAAC;IAEf;;OAEG;gBACS,CAAC,gBAAgB,MAAM,MAChC,OAAO,CAAC,KAAG,CAAC;IAOf;;OAEG;aACM,CAAC,WAAW,OAAO,CAAC,CAAC,CAAC,MAC5B,OAAO,CAAC,KAAG,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAG,CACxB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State transition helpers for common patterns
|
|
3
|
-
*/
|
|
4
|
-
export const StateTransitions = {
|
|
5
|
-
/**
|
|
6
|
-
* Transition to a new phase with optional updates
|
|
7
|
-
*/
|
|
8
|
-
to: (phase, updates = {}) => (state) => ({ ...state, phase, ...updates }),
|
|
9
|
-
/**
|
|
10
|
-
* Add polling delay to state
|
|
11
|
-
*/
|
|
12
|
-
withPolling: (delayMs) => (state) => ({ ...state, nextPollMs: delayMs }),
|
|
13
|
-
/**
|
|
14
|
-
* Set error state with message and stop polling
|
|
15
|
-
*/
|
|
16
|
-
withError: (errorMessage) => (state) => ({
|
|
17
|
-
...state,
|
|
18
|
-
phase: 'error',
|
|
19
|
-
errorMessage,
|
|
20
|
-
nextPollMs: null
|
|
21
|
-
}),
|
|
22
|
-
/**
|
|
23
|
-
* Preserve existing state with updates
|
|
24
|
-
*/
|
|
25
|
-
update: (updates) => (state) => ({ ...state, ...updates }),
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Simple pipe utility for composing state transformations
|
|
29
|
-
*/
|
|
30
|
-
export const pipe = (value, ...fns) => fns.reduce((acc, fn) => fn(acc), value);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Effect, Stream } from "effect";
|
|
2
|
-
import type { z } from "zod";
|
|
3
|
-
import type { Contract, Plugin } from "../../plugin";
|
|
4
|
-
import { type PluginRuntimeError } from "../errors";
|
|
5
|
-
import type { InitializedPlugin } from "../types";
|
|
6
|
-
import type { StreamingOptions } from "./types";
|
|
7
|
-
export declare const createSourceStream: <T extends Plugin<Contract>, TInput extends z.infer<T["inputSchema"]>, TItem, TPluginState extends z.infer<T["stateSchema"]>>(initializedPlugin: InitializedPlugin<T>, executePlugin: (plugin: InitializedPlugin<T>, input: TInput) => Effect.Effect<z.infer<T["outputSchema"]>, PluginRuntimeError>, input: TInput, options?: StreamingOptions<TItem, TPluginState>) => Stream.Stream<TItem, PluginRuntimeError>;
|
|
8
|
-
//# sourceMappingURL=streaming.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../../src/runtime/streaming/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,KAAK,kBAAkB,EAAwB,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,SAAS,CAAC;AAsB7D,eAAO,MAAM,kBAAkB,GAC7B,CAAC,SAAS,MAAM,CAAC,QAAQ,CAAC,EAC1B,MAAM,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EACxC,KAAK,EACL,YAAY,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAE9C,mBAAmB,iBAAiB,CAAC,CAAC,CAAC,EACvC,eAAe,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,kBAAkB,CAAC,EAC7H,OAAO,MAAM,EACb,UAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAM,KAClD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAuHzC,CAAC"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Duration, Effect, Stream } from "effect";
|
|
2
|
-
import { toPluginRuntimeError } from "../errors";
|
|
3
|
-
/**
|
|
4
|
-
* Extract delay from plugin state (nextPollMs field)
|
|
5
|
-
* Returns null if nextPollMs is null (signals termination) or undefined (no delay specified)
|
|
6
|
-
*/
|
|
7
|
-
const extractDelayFromState = (state) => {
|
|
8
|
-
const stateWithPolling = state;
|
|
9
|
-
if (stateWithPolling?.nextPollMs === null) {
|
|
10
|
-
return null; // Explicit termination signal
|
|
11
|
-
}
|
|
12
|
-
return stateWithPolling?.nextPollMs ? Duration.millis(stateWithPolling.nextPollMs) : null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Check if plugin state signals stream termination
|
|
16
|
-
*/
|
|
17
|
-
const isTerminalState = (state) => {
|
|
18
|
-
const stateWithPolling = state;
|
|
19
|
-
return stateWithPolling?.nextPollMs === null;
|
|
20
|
-
};
|
|
21
|
-
export const createSourceStream = (initializedPlugin, executePlugin, input, options = {}) => {
|
|
22
|
-
// Create initial stream state with plugin's initial state
|
|
23
|
-
const initialStreamState = {
|
|
24
|
-
invocations: 0,
|
|
25
|
-
pluginState: input.state,
|
|
26
|
-
lastItemCount: 0,
|
|
27
|
-
};
|
|
28
|
-
// Use Stream.async for full control over emission timing and delays
|
|
29
|
-
return Stream.async((emit) => {
|
|
30
|
-
let currentStreamState = initialStreamState;
|
|
31
|
-
let totalItemsEmitted = 0;
|
|
32
|
-
const loop = async () => {
|
|
33
|
-
try {
|
|
34
|
-
while (true) {
|
|
35
|
-
console.log(`[STREAMING] Starting iteration ${currentStreamState.invocations + 1}`);
|
|
36
|
-
// Check invocation limit BEFORE executing
|
|
37
|
-
if (options.maxInvocations && currentStreamState.invocations >= options.maxInvocations) {
|
|
38
|
-
console.log(`[STREAMING] Reached maxInvocations limit: ${options.maxInvocations}`);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
// Check maxItems limit BEFORE executing
|
|
42
|
-
if (options.maxItems && totalItemsEmitted >= options.maxItems) {
|
|
43
|
-
console.log(`[STREAMING] Reached maxItems limit: ${options.maxItems}`);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
// Execute plugin with current plugin state
|
|
47
|
-
const pluginInput = {
|
|
48
|
-
...input,
|
|
49
|
-
state: currentStreamState.pluginState ?? null
|
|
50
|
-
};
|
|
51
|
-
console.log(`[STREAMING] About to execute plugin with input:`, JSON.stringify(pluginInput, null, 2));
|
|
52
|
-
console.log(`[STREAMING] Plugin state:`, JSON.stringify(currentStreamState.pluginState, null, 2));
|
|
53
|
-
const rawResult = await Effect.runPromise(executePlugin(initializedPlugin, pluginInput).pipe(Effect.catchAll((error) => {
|
|
54
|
-
return toPluginRuntimeError(error);
|
|
55
|
-
})));
|
|
56
|
-
console.log(`[STREAMING] Plugin execution completed`);
|
|
57
|
-
// Transform raw plugin result to streaming format
|
|
58
|
-
const resultObj = rawResult;
|
|
59
|
-
const items = Array.isArray(resultObj.items) ? resultObj.items : [];
|
|
60
|
-
const nextPluginState = resultObj.nextState;
|
|
61
|
-
console.log(`[STREAMING] Transformed result: ${items.length} items`);
|
|
62
|
-
// Update stream state (increment AFTER execution)
|
|
63
|
-
currentStreamState = {
|
|
64
|
-
invocations: currentStreamState.invocations + 1,
|
|
65
|
-
pluginState: nextPluginState,
|
|
66
|
-
lastItemCount: items.length,
|
|
67
|
-
};
|
|
68
|
-
console.log(`[STREAMING] Invocation ${currentStreamState.invocations}, Items: ${items.length}`);
|
|
69
|
-
// Call state change hook if provided
|
|
70
|
-
if (options.onStateChange) {
|
|
71
|
-
await Effect.runPromise(options.onStateChange(nextPluginState, items).pipe(Effect.catchAll((error) => {
|
|
72
|
-
console.warn(`[STREAMING] onStateChange failed:`, error);
|
|
73
|
-
return Effect.void;
|
|
74
|
-
})));
|
|
75
|
-
}
|
|
76
|
-
// Emit items immediately (before any delays)
|
|
77
|
-
for (const item of items) {
|
|
78
|
-
if (options.maxItems && totalItemsEmitted >= options.maxItems) {
|
|
79
|
-
console.log(`[STREAMING] Stopping emission at maxItems limit: ${options.maxItems}`);
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
emit.single(item);
|
|
83
|
-
totalItemsEmitted++;
|
|
84
|
-
}
|
|
85
|
-
// Check for termination conditions
|
|
86
|
-
if (nextPluginState && isTerminalState(nextPluginState)) {
|
|
87
|
-
console.log(`[STREAMING] Plugin signaled termination`);
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
// Check stopWhenEmpty condition
|
|
91
|
-
if (options.stopWhenEmpty && items.length === 0) {
|
|
92
|
-
console.log(`[STREAMING] Stopping due to empty result and stopWhenEmpty=true`);
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
// Handle delay AFTER emission, BEFORE next iteration
|
|
96
|
-
const nextDelay = extractDelayFromState(nextPluginState);
|
|
97
|
-
if (nextDelay && Duration.toMillis(nextDelay) > 0) {
|
|
98
|
-
console.log(`[STREAMING] Sleeping for ${Duration.toMillis(nextDelay)}ms before next iteration`);
|
|
99
|
-
await Effect.runPromise(Effect.sleep(nextDelay));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// End the stream
|
|
103
|
-
emit.end();
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
console.log(`[STREAMING] Error occurred:`, error);
|
|
107
|
-
emit.fail(error);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
// Start the loop
|
|
111
|
-
loop();
|
|
112
|
-
});
|
|
113
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Effect } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
* Internal stream state managed by the runtime
|
|
4
|
-
*/
|
|
5
|
-
export interface StreamState<TPluginState> {
|
|
6
|
-
readonly invocations: number;
|
|
7
|
-
readonly pluginState: TPluginState;
|
|
8
|
-
readonly lastItemCount: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Enhanced streaming options with Effect-based hooks
|
|
12
|
-
*/
|
|
13
|
-
export interface StreamingOptions<TItem = unknown, TPluginState = unknown> {
|
|
14
|
-
maxItems?: number;
|
|
15
|
-
maxInvocations?: number;
|
|
16
|
-
stopWhenEmpty?: boolean;
|
|
17
|
-
onStateChange?: (newPluginState: TPluginState, items: TItem[]) => Effect.Effect<void, Error>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/streaming/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,YAAY;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,YAAY,GAAG,OAAO;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;CAC9F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/runtime/test-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,gBAAgB,QAAO,YAYlC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
export const createTestLogger = () => ({
|
|
3
|
-
logInfo: (message, context) => Effect.sync(() => console.log(`[INFO] ${message}`, context || '')),
|
|
4
|
-
logWarning: (message, context) => Effect.sync(() => console.warn(`[WARNING] ${message}`, context || '')),
|
|
5
|
-
logError: (message, error, context) => Effect.sync(() => console.error(`[ERROR] ${message}`, error, context || '')),
|
|
6
|
-
logDebug: (message, context) => Effect.sync(() => console.log(`[DEBUG] ${message}`, context || '')),
|
|
7
|
-
});
|
package/dist/runtime/types.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
import type { Plugin, PluginLogger, PluginRegistry } from "../plugin";
|
|
3
|
-
export interface PluginRuntimeConfig {
|
|
4
|
-
registry: PluginRegistry;
|
|
5
|
-
secrets?: SecretsConfig;
|
|
6
|
-
logger?: PluginLogger;
|
|
7
|
-
}
|
|
8
|
-
export interface SecretsConfig {
|
|
9
|
-
[key: string]: string;
|
|
10
|
-
}
|
|
11
|
-
export type AnyPlugin = Plugin<any, z.ZodTypeAny, z.ZodTypeAny>;
|
|
12
|
-
export interface PluginConstructor {
|
|
13
|
-
readonly ctor: new () => AnyPlugin;
|
|
14
|
-
readonly metadata: {
|
|
15
|
-
readonly pluginId: string;
|
|
16
|
-
readonly version?: string;
|
|
17
|
-
readonly description?: string;
|
|
18
|
-
readonly type?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface PluginInstance<T extends AnyPlugin = AnyPlugin> {
|
|
22
|
-
readonly plugin: T;
|
|
23
|
-
readonly metadata: {
|
|
24
|
-
readonly pluginId: string;
|
|
25
|
-
readonly version?: string;
|
|
26
|
-
readonly description?: string;
|
|
27
|
-
readonly type?: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
|
|
31
|
-
readonly plugin: T;
|
|
32
|
-
readonly metadata: {
|
|
33
|
-
readonly pluginId: string;
|
|
34
|
-
readonly version?: string;
|
|
35
|
-
readonly description?: string;
|
|
36
|
-
readonly type?: string;
|
|
37
|
-
};
|
|
38
|
-
readonly config: z.infer<T["configSchema"]>;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=types.d.ts.map
|