@stackables/bridge 1.1.1 → 1.3.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.
- package/README.md +221 -59
- package/build/ExecutionTree.js +12 -2
- package/build/bridge-format.d.ts +0 -10
- package/build/bridge-format.js +721 -218
- package/build/types.d.ts +48 -1
- package/package.json +2 -1
package/build/types.d.ts
CHANGED
|
@@ -54,6 +54,12 @@ export type Bridge = {
|
|
|
54
54
|
handles: HandleBinding[];
|
|
55
55
|
/** Connection wires */
|
|
56
56
|
wires: Wire[];
|
|
57
|
+
/**
|
|
58
|
+
* Iterator handle names for array mapping blocks.
|
|
59
|
+
* Key: the array destination field name (first path component of `to`).
|
|
60
|
+
* Value: the iterator handle alias declared with `[] as <iter> { }`.
|
|
61
|
+
*/
|
|
62
|
+
arrayIterators?: Record<string, string>;
|
|
57
63
|
/**
|
|
58
64
|
* Pipe fork registry — one entry per pipe use.
|
|
59
65
|
* Maps the fork's trunk key to the originating handle name and the base
|
|
@@ -73,6 +79,11 @@ export type Bridge = {
|
|
|
73
79
|
instance?: number;
|
|
74
80
|
};
|
|
75
81
|
}>;
|
|
82
|
+
/**
|
|
83
|
+
* When set, this bridge was declared with the passthrough shorthand:
|
|
84
|
+
* `bridge Type.field with <name>`. The value is the define/tool name.
|
|
85
|
+
*/
|
|
86
|
+
passthrough?: string;
|
|
76
87
|
};
|
|
77
88
|
/**
|
|
78
89
|
* A handle binding — declares a named data source available in a bridge.
|
|
@@ -86,12 +97,19 @@ export type HandleBinding = {
|
|
|
86
97
|
} | {
|
|
87
98
|
handle: string;
|
|
88
99
|
kind: "input";
|
|
100
|
+
} | {
|
|
101
|
+
handle: string;
|
|
102
|
+
kind: "output";
|
|
89
103
|
} | {
|
|
90
104
|
handle: string;
|
|
91
105
|
kind: "context";
|
|
92
106
|
} | {
|
|
93
107
|
handle: string;
|
|
94
108
|
kind: "const";
|
|
109
|
+
} | {
|
|
110
|
+
handle: string;
|
|
111
|
+
kind: "define";
|
|
112
|
+
name: string;
|
|
95
113
|
};
|
|
96
114
|
/** Internal module identifier for the bridge's own trunk (input args + output fields) */
|
|
97
115
|
export declare const SELF_MODULE = "_";
|
|
@@ -203,7 +221,36 @@ export type ConstDef = {
|
|
|
203
221
|
value: string;
|
|
204
222
|
};
|
|
205
223
|
/** Union of all instruction types */
|
|
206
|
-
export type Instruction = Bridge | ToolDef | ConstDef;
|
|
224
|
+
export type Instruction = Bridge | ToolDef | ConstDef | DefineDef;
|
|
225
|
+
/**
|
|
226
|
+
* Define block — a reusable named subgraph (pipeline / macro).
|
|
227
|
+
*
|
|
228
|
+
* At parse time a define is stored as a template. When a bridge declares
|
|
229
|
+
* `with <define> as <handle>`, the define's handles and wires are inlined
|
|
230
|
+
* into the bridge with namespaced identifiers for isolation.
|
|
231
|
+
*
|
|
232
|
+
* Example:
|
|
233
|
+
* define secureProfile {
|
|
234
|
+
* with userApi as api
|
|
235
|
+
* with input as i
|
|
236
|
+
* with output as o
|
|
237
|
+
* api.id <- i.userId
|
|
238
|
+
* o.name <- api.login
|
|
239
|
+
* }
|
|
240
|
+
*/
|
|
241
|
+
export type DefineDef = {
|
|
242
|
+
kind: "define";
|
|
243
|
+
/** Define name — referenced in bridge `with` declarations */
|
|
244
|
+
name: string;
|
|
245
|
+
/** Declared handles (tools, input, output, etc.) */
|
|
246
|
+
handles: HandleBinding[];
|
|
247
|
+
/** Connection wires (same format as Bridge wires) */
|
|
248
|
+
wires: Wire[];
|
|
249
|
+
/** Array iterators (same as Bridge) */
|
|
250
|
+
arrayIterators?: Record<string, string>;
|
|
251
|
+
/** Pipe fork registry (same as Bridge) */
|
|
252
|
+
pipeHandles?: Bridge["pipeHandles"];
|
|
253
|
+
};
|
|
207
254
|
/**
|
|
208
255
|
* Pluggable cache store for httpCall.
|
|
209
256
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackables/bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Declarative dataflow for GraphQL",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"prepack": "tsc",
|
|
13
13
|
"test": "node --import tsx/esm --test test/*.test.ts",
|
|
14
|
+
"e2e": "node --import tsx/esm --test e2e/e2e.test.ts",
|
|
14
15
|
"semantic-release": "semantic-release -b main"
|
|
15
16
|
},
|
|
16
17
|
"repository": {
|