@executioncontrolprotocol/extension-storage 0.10.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.
@@ -0,0 +1,6 @@
1
+ /** In-memory @executioncontrolprotocol/storage stub. @category Extensions */
2
+ export declare const storageExtension: import("@executioncontrolprotocol/core").ExtensionDefinition;
3
+ /** Register @executioncontrolprotocol/storage. */
4
+ export declare function registerStorageExtension(): Promise<void>;
5
+ export default storageExtension;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,8DAyBnB,CAAA;AAIV,kDAAkD;AAClD,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAI9D;AAED,eAAe,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ import { defineExtension, capabilityFor, globalRegistry, catalogExtension } from "@executioncontrolprotocol/core";
2
+ import { z } from "zod";
3
+ const blobs = new Map();
4
+ /** In-memory @executioncontrolprotocol/storage stub. @category Extensions */
5
+ export const storageExtension = defineExtension("@executioncontrolprotocol", "storage")
6
+ .withConfig({
7
+ prefix: z.string().optional(),
8
+ })
9
+ .withCapabilities([
10
+ capabilityFor("@executioncontrolprotocol/storage", "write")
11
+ .withInput(z.object({ key: z.string(), value: z.unknown() }))
12
+ .withOutput(z.object({ ok: z.boolean() }))
13
+ .withHandler(async (input, ctx) => {
14
+ const cfg = ctx.extensionConfig ?? {};
15
+ const prefix = cfg.prefix ?? "";
16
+ const key = `${prefix}${input.key}`;
17
+ blobs.set(key, input.value);
18
+ return { ok: true };
19
+ }),
20
+ capabilityFor("@executioncontrolprotocol/storage", "read")
21
+ .withInput(z.object({ key: z.string() }))
22
+ .withOutput(z.object({ value: z.unknown().optional() }))
23
+ .withHandler(async (input, ctx) => {
24
+ const cfg = ctx.extensionConfig ?? {};
25
+ const prefix = cfg.prefix ?? "";
26
+ const key = `${prefix}${input.key}`;
27
+ return { value: blobs.get(key) };
28
+ }),
29
+ ])
30
+ .build();
31
+ catalogExtension(storageExtension);
32
+ /** Register @executioncontrolprotocol/storage. */
33
+ export async function registerStorageExtension() {
34
+ if (!globalRegistry.getExtension("@executioncontrolprotocol/storage")) {
35
+ await globalRegistry.registerExtension(storageExtension);
36
+ }
37
+ }
38
+ export default storageExtension;
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAA;AAExC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,2BAA2B,EAAE,SAAS,CAAC;KACpF,UAAU,CAAC;IACV,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC;KACD,gBAAgB,CAAC;IAChB,aAAa,CAAC,mCAAmC,EAAE,OAAO,CAAC;SACxD,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SAC5D,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SACzC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAChC,MAAM,GAAG,GAAI,GAAqD,CAAC,eAAe,IAAI,EAAE,CAAA;QACxF,MAAM,MAAM,GAAI,GA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ontrolprotocol/extension-storage",
3
+ "version": "0.10.0",
4
+ "description": "Key-value blob storage extension for ECP",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -b"
21
+ },
22
+ "peerDependencies": {
23
+ "@executioncontrolprotocol/core": "^0.10.0",
24
+ "@executioncontrolprotocol/types": "^0.10.0",
25
+ "zod": "^3.24.0"
26
+ },
27
+ "devDependencies": {
28
+ "@executioncontrolprotocol/core": "0.10.0",
29
+ "@executioncontrolprotocol/types": "0.10.0",
30
+ "typescript": "^5.7.0",
31
+ "zod": "^3.24.0"
32
+ }
33
+ }