@process.co/element-types 0.0.7 → 0.0.9

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,32 @@
1
+ import type { ISlotDefinition } from './slot-definition';
2
+ export type MaterializedSlotBranch = {
3
+ kind: 'static' | 'dynamic';
4
+ id?: string;
5
+ label?: string;
6
+ branchValue?: string;
7
+ path?: string;
8
+ idPath?: string;
9
+ labelPath?: string;
10
+ enabledPath?: string;
11
+ actionsPath?: string;
12
+ exportsPath?: string;
13
+ hideOnDisable?: boolean;
14
+ labelPlaceholderTemplate?: string;
15
+ labelPlaceholderValue?: string;
16
+ };
17
+ export type MaterializedSlotLayout = {
18
+ showBranchLabels?: boolean;
19
+ activeSlotId?: string;
20
+ activeSlotLabel?: string;
21
+ hideDisabled?: boolean;
22
+ hideDisabledPath?: string;
23
+ hideOnDisable?: boolean;
24
+ exportSchemaPath?: string;
25
+ };
26
+ export type MaterializedSlotDefinition = {
27
+ layout: MaterializedSlotLayout;
28
+ branches: MaterializedSlotBranch[];
29
+ };
30
+ /** Normalize **`ISlotDefinition`** for codegen / workflow inference (JSON-serializable). */
31
+ export declare function materializeSlotDefinition(def: ISlotDefinition | null | undefined): MaterializedSlotDefinition | null;
32
+ //# sourceMappingURL=materialize-slot-definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialize-slot-definition.d.ts","sourceRoot":"","sources":["../src/materialize-slot-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC,CAAC;AAyCF,4FAA4F;AAC5F,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GACtC,0BAA0B,GAAG,IAAI,CAQnC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.materializeSlotDefinition = materializeSlotDefinition;
4
+ function branchKind(row) {
5
+ return 'type' in row && row.type === 'static' ? 'static' : 'dynamic';
6
+ }
7
+ function pickBranch(row) {
8
+ const b = { kind: branchKind(row) };
9
+ if (row.id !== undefined)
10
+ b.id = row.id;
11
+ if (row.label !== undefined)
12
+ b.label = row.label;
13
+ if (row.branchValue !== undefined)
14
+ b.branchValue = row.branchValue;
15
+ if (row.path !== undefined)
16
+ b.path = row.path;
17
+ if (row.idPath !== undefined)
18
+ b.idPath = row.idPath;
19
+ if (row.labelPath !== undefined)
20
+ b.labelPath = row.labelPath;
21
+ if (row.enabledPath !== undefined)
22
+ b.enabledPath = row.enabledPath;
23
+ if (row.actionsPath !== undefined)
24
+ b.actionsPath = row.actionsPath;
25
+ if (row.exportsPath !== undefined)
26
+ b.exportsPath = row.exportsPath;
27
+ if (row.hideOnDisable !== undefined)
28
+ b.hideOnDisable = row.hideOnDisable;
29
+ if (row.labelPlaceholderTemplate !== undefined)
30
+ b.labelPlaceholderTemplate = row.labelPlaceholderTemplate;
31
+ if (row.labelPlaceholderValue !== undefined)
32
+ b.labelPlaceholderValue = row.labelPlaceholderValue;
33
+ return b;
34
+ }
35
+ function pickLayout(def) {
36
+ const layout = {};
37
+ if (def.showBranchLabels !== undefined)
38
+ layout.showBranchLabels = def.showBranchLabels;
39
+ if (def.activeSlotId !== undefined)
40
+ layout.activeSlotId = def.activeSlotId;
41
+ if (def.activeSlotLabel !== undefined)
42
+ layout.activeSlotLabel = def.activeSlotLabel;
43
+ if (def.hideDisabled !== undefined)
44
+ layout.hideDisabled = def.hideDisabled;
45
+ if (def.hideDisabledPath !== undefined)
46
+ layout.hideDisabledPath = def.hideDisabledPath;
47
+ if (def.hideOnDisable !== undefined)
48
+ layout.hideOnDisable = def.hideOnDisable;
49
+ if (def.exportSchemaPath !== undefined)
50
+ layout.exportSchemaPath = def.exportSchemaPath;
51
+ return layout;
52
+ }
53
+ function isEffectivelyEmpty(def) {
54
+ const rows = def.slots ?? [];
55
+ const layout = pickLayout(def);
56
+ return rows.length === 0 && Object.keys(layout).length === 0;
57
+ }
58
+ /** Normalize **`ISlotDefinition`** for codegen / workflow inference (JSON-serializable). */
59
+ function materializeSlotDefinition(def) {
60
+ if (def == null || isEffectivelyEmpty(def)) {
61
+ return null;
62
+ }
63
+ return {
64
+ layout: pickLayout(def),
65
+ branches: (def.slots ?? []).map(pickBranch),
66
+ };
67
+ }
68
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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FHLElBQUksSUFBSSxJQUFJLGtCQUFrQixDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUM7UUFDM0MsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBQ0QsT0FBTztRQUNMLE1BQU0sRUFBRSxVQUFVLENBQUMsR0FBRyxDQUFDO1FBQ3ZCLFFBQVEsRUFBRSxDQUFDLEdBQUcsQ0FBQyxLQUFLLElBQUksRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLFVBQVUsQ0FBQztLQUM1QyxDQUFDO0FBQ0osQ0FBQyJ9
@@ -0,0 +1,82 @@
1
+ import type { ISlotDefinition } from './slot-definition';
2
+ /**
3
+ * One flattened prop row from **`process-co` compatibility `loadElementPointers`** (`buildProp` output).
4
+ * Matches **`@process.co/elements`** `IProcessDefinitionUIPointers.props[]` plus loader fields.
5
+ */
6
+ export type ProcessElementPropCliWire = {
7
+ key: string;
8
+ label: string;
9
+ description?: string;
10
+ type?: unknown;
11
+ jsonType?: unknown;
12
+ isFunction?: boolean;
13
+ required?: boolean;
14
+ default?: unknown;
15
+ ui?: string;
16
+ options?: unknown;
17
+ deps?: string[];
18
+ placeholder?: string;
19
+ [key: string]: unknown;
20
+ };
21
+ /**
22
+ * One action row from **`loadElementPointers`** for a Process element (not Pipedream shape).
23
+ * This is what sits in **`IProcessDefinitionUIInfo.actions[]`** after the process loader runs.
24
+ */
25
+ export type ProcessElementActionCliWire = {
26
+ type: 'action';
27
+ key: string;
28
+ name: string;
29
+ description?: string;
30
+ icon?: unknown;
31
+ ui?: string;
32
+ categoryKey?: string;
33
+ sampleEmit?: unknown;
34
+ returns?: string;
35
+ slots?: ISlotDefinition;
36
+ noAuth?: boolean;
37
+ hasNew?: boolean;
38
+ initValue?: unknown;
39
+ props?: ProcessElementPropCliWire[];
40
+ [key: string]: unknown;
41
+ };
42
+ /**
43
+ * One signal row from **`loadElementPointers`** for a Process element.
44
+ */
45
+ export type ProcessElementSignalCliWire = {
46
+ type: 'signal';
47
+ key: string;
48
+ name: string;
49
+ description?: string;
50
+ ui?: string;
51
+ categoryKey?: string;
52
+ sampleEmit?: unknown;
53
+ returns?: string;
54
+ noAuth?: boolean;
55
+ hasNew?: boolean;
56
+ initValue?: unknown;
57
+ icon?: unknown;
58
+ hooks?: boolean;
59
+ dedupe?: unknown;
60
+ http?: unknown;
61
+ instant?: boolean;
62
+ props?: ProcessElementPropCliWire[];
63
+ [key: string]: unknown;
64
+ };
65
+ /**
66
+ * Full object emitted by **`process-element`** (compatibility CLI): **`SuperJSON.stringify(loadElementPointers(...))`**.
67
+ * Structurally aligned with **`@process.co/elements` `IProcessDefinitionUIInfo`** plus process-loader fields on each row.
68
+ */
69
+ export type ProcessElementCliOutputWire = {
70
+ elementType: 'process' | 'pipedream' | 'dofloV1' | 'n8n';
71
+ /** App / namespace slug (`element.app`); used as default FERN namespace when building keys. */
72
+ name: string;
73
+ description: {
74
+ short: string;
75
+ long: string;
76
+ MD: string;
77
+ };
78
+ actions: ProcessElementActionCliWire[];
79
+ signals: ProcessElementSignalCliWire[];
80
+ credentials: unknown[];
81
+ };
82
+ //# sourceMappingURL=process-element-cli-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-element-cli-output.d.ts","sourceRoot":"","sources":["../src/process-element-cli-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;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IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;IACzD,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvY2Vzcy1lbGVtZW50LWNsaS1vdXRwdXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHJvY2Vzcy1lbGVtZW50LWNsaS1vdXRwdXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -0,0 +1,30 @@
1
+ export type ISlotInstanceDefinition = {
2
+ id?: string;
3
+ label?: string;
4
+ enabled?: boolean;
5
+ path?: string;
6
+ idPath?: string;
7
+ labelPath?: string;
8
+ enabledPath?: string;
9
+ labelPlaceholderTemplate?: string;
10
+ labelPlaceholderValue?: string;
11
+ branchValue?: string;
12
+ hideOnDisable?: boolean;
13
+ actionsPath?: string;
14
+ exportsPath?: string;
15
+ };
16
+ export type ISlotStaticInstanceDefinition = ISlotInstanceDefinition & {
17
+ type: 'static';
18
+ };
19
+ export type ISlotDefinition = {
20
+ showBranchLabels?: boolean;
21
+ activeSlotId?: string;
22
+ activeSlotLabel?: string;
23
+ hideDisabled?: boolean;
24
+ /** Expression/template path for per-row hide-disabled (flow editor / container layout). */
25
+ hideDisabledPath?: string;
26
+ hideOnDisable?: boolean;
27
+ exportSchemaPath?: string;
28
+ slots?: (ISlotInstanceDefinition | ISlotStaticInstanceDefinition)[];
29
+ };
30
+ //# sourceMappingURL=slot-definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-definition.d.ts","sourceRoot":"","sources":["../src/slot-definition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,uBAAuB,GAAG;IACpE,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,uBAAuB,GAAG,6BAA6B,CAAC,EAAE,CAAC;CACrE,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xvdC1kZWZpbml0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Nsb3QtZGVmaW5pdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@process.co/element-types",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,243 @@
1
+ import type {
2
+ MaterializedActionAuthoringEntry,
3
+ MaterializedAuthoringCatalog,
4
+ MaterializedSignalAuthoringEntry,
5
+ } from './materialize-authoring-from-cli-output';
6
+ import type { MaterializedSlotBranch, MaterializedSlotDefinition } from './materialize-slot-definition';
7
+ import type { ProcessElementCliOutputWire } from './process-element-cli-output';
8
+ import { materializeAuthoringCatalogFromCliOutput } from './materialize-authoring-from-cli-output';
9
+
10
+ /**
11
+ * Bump when this contract changes — regenerate workflow-sdk / codegen consumers.
12
+ * Raw CLI JSON does not carry this; the **contract** is the stable TS surface.
13
+ */
14
+ export const ELEMENT_AUTHORING_CONTRACT_VERSION = 1 as const;
15
+
16
+ /**
17
+ * Normalized prop kind for **`keyof` / conditional types** (not the raw loader string).
18
+ */
19
+ export type AuthoringPropWireKind =
20
+ | 'string'
21
+ | 'number'
22
+ | 'boolean'
23
+ | 'integer'
24
+ | 'object'
25
+ | 'array'
26
+ | 'unknown';
27
+
28
+ /** One action prop in the **locked** authoring shape. */
29
+ export interface AuthoringPropContract {
30
+ readonly key: string;
31
+ readonly label: string;
32
+ readonly wireKind: AuthoringPropWireKind;
33
+ readonly required: boolean;
34
+ }
35
+
36
+ /**
37
+ * One container branch. **`childStepsProperty`** is intentionally a **string literal type** so
38
+ * `defineGroup`-style APIs can use `B['childStepsProperty']` and get `'actions'`, not `string`.
39
+ */
40
+ export interface SlotBranchAuthoringContract {
41
+ readonly kind: 'static' | 'dynamic';
42
+ readonly slotRowId?: string;
43
+ readonly paths: Readonly<{
44
+ row?: string;
45
+ id?: string;
46
+ label?: string;
47
+ enabled?: string;
48
+ actions?: string;
49
+ exports?: string;
50
+ }>;
51
+ /**
52
+ * Where nested steps attach on each branch row, relative to that row’s object.
53
+ * Locked default **`actions`**; override only if element contract documents otherwise.
54
+ */
55
+ readonly childStepsProperty: 'actions';
56
+ /** Branch-level export callback property when present (e.g. switch **`export`**). */
57
+ readonly branchExportsProperty?: 'export' | 'exports';
58
+ }
59
+
60
+ export interface SlotsAuthoringContract {
61
+ readonly layout: Readonly<{
62
+ showBranchLabels?: boolean;
63
+ activeSlotId?: string;
64
+ activeSlotLabel?: string;
65
+ hideDisabled?: boolean;
66
+ hideDisabledPath?: string;
67
+ hideOnDisable?: boolean;
68
+ exportSchemaPath?: string;
69
+ }>;
70
+ readonly branches: readonly SlotBranchAuthoringContract[];
71
+ }
72
+
73
+ /** Locked per-action shape for FERN-keyed inference. */
74
+ export interface ActionAuthoringContract {
75
+ readonly fern: string;
76
+ readonly elementKey: string;
77
+ readonly name: string;
78
+ readonly returnsTypeName?: string;
79
+ readonly props: readonly AuthoringPropContract[];
80
+ readonly slots: SlotsAuthoringContract | null;
81
+ }
82
+
83
+ export interface SignalAuthoringContract {
84
+ readonly fern: string;
85
+ readonly elementKey: string;
86
+ readonly name: string;
87
+ readonly returnsTypeName?: string;
88
+ readonly props: readonly AuthoringPropContract[];
89
+ }
90
+
91
+ /**
92
+ * **Canonical object** for TypeScript to hang inference off — not the CLI blob.
93
+ *
94
+ * - Runtime: **`authoringCatalogContractFromCliOutput`** / **`toAuthoringCatalogContract`**.
95
+ * - Best inference: codegen emits **`export const X = { … } as const satisfies ElementAuthoringCatalogContract`**
96
+ * so **`keyof X['actions']`** is a **union of FERN literals**, not plain **`string`**.
97
+ */
98
+ export interface ElementAuthoringCatalogContract {
99
+ readonly version: typeof ELEMENT_AUTHORING_CONTRACT_VERSION;
100
+ readonly namespace: string;
101
+ readonly actions: Readonly<Record<string, ActionAuthoringContract>>;
102
+ readonly signals: Readonly<Record<string, SignalAuthoringContract>>;
103
+ }
104
+
105
+ // --- Type-level helpers (the “magic” entry points) -------------------------------------------
106
+
107
+ export type ChildStepsPropertyForBranch<B extends SlotBranchAuthoringContract> = B['childStepsProperty'];
108
+
109
+ export type ActionPropKeys<A extends ActionAuthoringContract> = A['props'][number]['key'];
110
+
111
+ export type ActionContractByFern<
112
+ C extends ElementAuthoringCatalogContract,
113
+ Fern extends keyof C['actions'] & string,
114
+ > = C['actions'][Fern];
115
+
116
+ // --- Normalization: materialized → contract ---------------------------------------------------
117
+
118
+ function normalizeWireKind(wireType: string): AuthoringPropWireKind {
119
+ const t = wireType.trim().toLowerCase();
120
+ if (t === 'string' || t === 'number' || t === 'boolean' || t === 'integer') {
121
+ return t as AuthoringPropWireKind;
122
+ }
123
+ if (t === 'object' || t.startsWith('object(')) {
124
+ return 'object';
125
+ }
126
+ if (t === 'array' || t.startsWith('array<')) {
127
+ return 'array';
128
+ }
129
+ return 'unknown';
130
+ }
131
+
132
+ function inferBranchExportsProperty(branch: MaterializedSlotBranch): 'export' | 'exports' | undefined {
133
+ const e = branch.exportsPath;
134
+ if (e === undefined) {
135
+ return undefined;
136
+ }
137
+ if (e.endsWith('.export') || e.includes('.export.')) {
138
+ return 'export';
139
+ }
140
+ if (e.endsWith('.exports') || e.includes('.exports.')) {
141
+ return 'exports';
142
+ }
143
+ return undefined;
144
+ }
145
+
146
+ function branchToContract(branch: MaterializedSlotBranch): SlotBranchAuthoringContract {
147
+ const exportsProp = inferBranchExportsProperty(branch);
148
+ return {
149
+ kind: branch.kind,
150
+ slotRowId: branch.id,
151
+ paths: {
152
+ row: branch.path,
153
+ id: branch.idPath,
154
+ label: branch.labelPath,
155
+ enabled: branch.enabledPath,
156
+ actions: branch.actionsPath,
157
+ exports: branch.exportsPath,
158
+ },
159
+ childStepsProperty: 'actions',
160
+ ...(exportsProp !== undefined ? { branchExportsProperty: exportsProp } : {}),
161
+ };
162
+ }
163
+
164
+ function slotsToContract(slots: MaterializedSlotDefinition | null): SlotsAuthoringContract | null {
165
+ if (slots === null) {
166
+ return null;
167
+ }
168
+ return {
169
+ layout: { ...slots.layout },
170
+ branches: slots.branches.map(branchToContract),
171
+ };
172
+ }
173
+
174
+ function propToContract(p: { key: string; label: string; wireType: string; required: boolean }): AuthoringPropContract {
175
+ return {
176
+ key: p.key,
177
+ label: p.label,
178
+ wireKind: normalizeWireKind(p.wireType),
179
+ required: p.required,
180
+ };
181
+ }
182
+
183
+ function actionToContract(a: MaterializedActionAuthoringEntry): ActionAuthoringContract {
184
+ return {
185
+ fern: a.fern,
186
+ elementKey: a.elementKey,
187
+ name: a.name,
188
+ returnsTypeName: a.returns,
189
+ props: a.props.map(propToContract),
190
+ slots: slotsToContract(a.slots),
191
+ };
192
+ }
193
+
194
+ function signalToContract(s: MaterializedSignalAuthoringEntry): SignalAuthoringContract {
195
+ return {
196
+ fern: s.fern,
197
+ elementKey: s.elementKey,
198
+ name: s.name,
199
+ returnsTypeName: s.returns,
200
+ props: s.props.map(propToContract),
201
+ };
202
+ }
203
+
204
+ /**
205
+ * Map **loose materialized catalog** (from CLI JSON) into the **locked `ElementAuthoringCatalogContract`**.
206
+ */
207
+ export function toAuthoringCatalogContract(cat: MaterializedAuthoringCatalog): ElementAuthoringCatalogContract {
208
+ const actions: Record<string, ActionAuthoringContract> = {};
209
+ const signals: Record<string, SignalAuthoringContract> = {};
210
+ for (const [fern, a] of Object.entries(cat.actionsByFern)) {
211
+ actions[fern] = actionToContract(a);
212
+ }
213
+ for (const [fern, s] of Object.entries(cat.signalsByFern)) {
214
+ signals[fern] = signalToContract(s);
215
+ }
216
+ return {
217
+ version: ELEMENT_AUTHORING_CONTRACT_VERSION,
218
+ namespace: cat.namespace,
219
+ actions,
220
+ signals,
221
+ };
222
+ }
223
+
224
+ /** One-shot: **`process-element` JSON shape** → locked contract. */
225
+ export function authoringCatalogContractFromCliOutput(
226
+ info: ProcessElementCliOutputWire,
227
+ namespace?: string,
228
+ ): ElementAuthoringCatalogContract {
229
+ return toAuthoringCatalogContract(materializeAuthoringCatalogFromCliOutput(info, namespace));
230
+ }
231
+
232
+ /**
233
+ * **Early** artifact: one file per element / build, written by **`@process.co/compatibility`**.
234
+ * **Late** step merges many shards into **`workflow-sdk`** `fern-authoring-registry.generated.ts`.
235
+ */
236
+ export type FernAuthoringShardFileV1 = {
237
+ readonly version: typeof ELEMENT_AUTHORING_CONTRACT_VERSION;
238
+ /** Source path or id (optional, for debugging). */
239
+ readonly source?: string;
240
+ readonly namespace: string;
241
+ readonly actions: Record<string, ActionAuthoringContract>;
242
+ readonly signals: Record<string, SignalAuthoringContract>;
243
+ };
@@ -0,0 +1,36 @@
1
+ import type { ISlotDefinition } from './slot-definition';
2
+
3
+ /**
4
+ * Optional bootstrap registry (FERN → **`ISlotDefinition`**).
5
+ * Prefer driving inference from **`materializeAuthoringCatalogFromCliOutput`** on the full
6
+ * **`process-element` / `loadElementPointers`** JSON — that includes **props**, **returns**, and **slots**.
7
+ */
8
+ export const builtinActionSlotsRegistry = {
9
+ 'process-internal::action:switch': {
10
+ hideDisabled: true,
11
+ slots: [
12
+ {
13
+ type: 'static' as const,
14
+ id: '{{ID_GUID}}_default_case',
15
+ labelPath: '$.data.cases.defaultLabel',
16
+ enabledPath: '$.data.cases.defaultEnabled',
17
+ hideOnDisable: true,
18
+ },
19
+ {
20
+ path: '$.data.cases.cases[*]',
21
+ idPath: '$.data.cases.cases[*].id',
22
+ labelPath: '$.data.cases.cases[*].label',
23
+ enabledPath: '$.data.cases.cases[*].enabled',
24
+ hideOnDisable: true,
25
+ },
26
+ ],
27
+ } satisfies ISlotDefinition,
28
+ } as const;
29
+
30
+ export type BuiltinActionSlotsRegistry = typeof builtinActionSlotsRegistry;
31
+
32
+ export type BuiltinActionSlotsFern = keyof BuiltinActionSlotsRegistry;
33
+
34
+ export type InferBuiltinActionSlots<Fern extends string> = Fern extends BuiltinActionSlotsFern
35
+ ? BuiltinActionSlotsRegistry[Fern]
36
+ : undefined;
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { z } from 'zod';
2
3
 
3
4
  // Element types
@@ -15,32 +16,67 @@ export type ElementSignal<T> = { type: "signal"; icon?: ElementIcon; label?: str
15
16
 
16
17
  export type ElementIcon = { type: "FontAwesome" | "MaterialIcons" | "ProcessIcons" | "RemoteImage" | "image"; icon: string | ['far' | 'fas' | 'fab' | 'fal' | 'fad', string] } | string;
17
18
 
18
- export type ISlotInstanceDefinition = {
19
- id?: string;
20
- label?: string;
21
- enabled?: boolean;
22
- path?: string;
23
- idPath?: string;
24
- labelPath?: string;
25
- enabledPath?: string;
26
- labelPlaceholderTemplate?: string;
27
- labelPlaceholderValue?: string;
28
- branchValue?: string;
29
- hideOnDisable?: boolean;
30
- }
31
-
32
- export type ISlotStaticInstanceDefinition = ISlotInstanceDefinition & {
33
- type: "static";
34
- }
35
-
36
- export type ISlotDefinition = {
37
- showBranchLabels?: boolean;
38
- activeSlotId?: string;
39
- activeSlotLabel?: string;
40
- hideDisabled?: boolean;
41
- hideOnDisable?: boolean;
42
- slots?: (ISlotInstanceDefinition | ISlotStaticInstanceDefinition)[];
43
- }
19
+ import type {
20
+ ISlotInstanceDefinition,
21
+ ISlotStaticInstanceDefinition,
22
+ ISlotDefinition,
23
+ } from './slot-definition';
24
+
25
+ export type { ISlotInstanceDefinition, ISlotStaticInstanceDefinition, ISlotDefinition };
26
+
27
+ export {
28
+ builtinActionSlotsRegistry,
29
+ type BuiltinActionSlotsRegistry,
30
+ type BuiltinActionSlotsFern,
31
+ type InferBuiltinActionSlots,
32
+ } from './builtin-action-slots-registry';
33
+
34
+ /** Full **`process-element` CLI** JSON shape + materializer for FERN-keyed props/slots (workflow-sdk / codegen). */
35
+ export type {
36
+ ProcessElementPropCliWire,
37
+ ProcessElementActionCliWire,
38
+ ProcessElementSignalCliWire,
39
+ ProcessElementCliOutputWire,
40
+ } from './process-element-cli-output';
41
+
42
+ export type {
43
+ MaterializedSlotBranch,
44
+ MaterializedSlotLayout,
45
+ MaterializedSlotDefinition,
46
+ } from './materialize-slot-definition';
47
+ export { materializeSlotDefinition } from './materialize-slot-definition';
48
+
49
+ export type {
50
+ MaterializedPropAuthoring,
51
+ MaterializedActionAuthoringEntry,
52
+ MaterializedSignalAuthoringEntry,
53
+ MaterializedAuthoringCatalog,
54
+ } from './materialize-authoring-from-cli-output';
55
+ export {
56
+ buildProcessActionFern,
57
+ buildProcessSignalFern,
58
+ materializeAuthoringCatalogFromCliOutput,
59
+ } from './materialize-authoring-from-cli-output';
60
+
61
+ /** Locked authoring catalog + helpers for FERN / slot / prop inference (not raw CLI JSON). */
62
+ export {
63
+ ELEMENT_AUTHORING_CONTRACT_VERSION,
64
+ toAuthoringCatalogContract,
65
+ authoringCatalogContractFromCliOutput,
66
+ } from './authoring-contract';
67
+ export type {
68
+ AuthoringPropWireKind,
69
+ AuthoringPropContract,
70
+ SlotBranchAuthoringContract,
71
+ SlotsAuthoringContract,
72
+ ActionAuthoringContract,
73
+ SignalAuthoringContract,
74
+ ElementAuthoringCatalogContract,
75
+ ChildStepsPropertyForBranch,
76
+ ActionPropKeys,
77
+ ActionContractByFern,
78
+ FernAuthoringShardFileV1,
79
+ } from './authoring-contract';
44
80
 
45
81
  // Base types for module definitions
46
82
  export type ModuleDefinition = {
@@ -623,4 +659,4 @@ export type WithThis<T> = T extends { methods: Record<string, any>; props: Recor
623
659
  : T['methods'][K];
624
660
  };
625
661
  }
626
- : T;
662
+ : T;