@reeve-iot/workflow-core 1.0.0 → 1.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.
- package/README.md +31 -1
- package/dist/analysis/documentSignature.d.ts +0 -1
- package/dist/analysis/documentSignature.js +0 -1
- package/dist/analysis/draftAnalysis.d.ts +0 -1
- package/dist/analysis/draftAnalysis.js +0 -1
- package/dist/editor/canvasFrames.d.ts +0 -1
- package/dist/editor/canvasFrames.js +0 -1
- package/dist/editor/createId.d.ts +0 -1
- package/dist/editor/createId.js +0 -1
- package/dist/editor/declaredBranches.d.ts +0 -1
- package/dist/editor/declaredBranches.js +0 -1
- package/dist/editor/editableDocument.d.ts +0 -1
- package/dist/editor/editableDocument.js +0 -1
- package/dist/editor/enumFieldFault.d.ts +0 -1
- package/dist/editor/enumFieldFault.js +0 -1
- package/dist/editor/incomingVariables.d.ts +0 -1
- package/dist/editor/incomingVariables.js +0 -1
- package/dist/editor/mappingFeeds.d.ts +0 -1
- package/dist/editor/mappingFeeds.js +0 -1
- package/dist/editor/messageCatalogue.d.ts +0 -1
- package/dist/editor/messageCatalogue.js +1 -2
- package/dist/editor/nodeLabels.d.ts +0 -1
- package/dist/editor/nodeLabels.js +0 -1
- package/dist/editor/passthroughTrace.d.ts +0 -1
- package/dist/editor/passthroughTrace.js +0 -1
- package/dist/editor/react.d.ts +0 -1
- package/dist/editor/react.js +0 -1
- package/dist/editor/store.d.ts +0 -1
- package/dist/editor/store.js +4 -6
- package/dist/editor/typedLiterals.d.ts +0 -1
- package/dist/editor/typedLiterals.js +0 -1
- package/dist/editor/validateBranchOutputs.d.ts +0 -1
- package/dist/editor/validateBranchOutputs.js +0 -1
- package/dist/editor/validateNodes.d.ts +0 -1
- package/dist/editor/validateNodes.js +0 -1
- package/dist/editor/validatePortTypeNames.d.ts +0 -1
- package/dist/editor/validatePortTypeNames.js +0 -1
- package/dist/editor/validateStructure.d.ts +0 -1
- package/dist/editor/validateStructure.js +0 -1
- package/dist/editor/validationRules.d.ts +0 -1
- package/dist/editor/validationRules.js +0 -1
- package/dist/editor/validationSummary.d.ts +0 -1
- package/dist/editor/validationSummary.js +0 -1
- package/dist/editor/workflowReference.d.ts +0 -1
- package/dist/editor/workflowReference.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/blockDeclaration.d.ts +0 -1
- package/dist/model/blockDeclaration.js +0 -1
- package/dist/model/blockType.d.ts +0 -1
- package/dist/model/blockType.js +0 -1
- package/dist/model/blockTypeInternal.d.ts +0 -1
- package/dist/model/blockTypeInternal.js +0 -1
- package/dist/model/canvas.d.ts +0 -1
- package/dist/model/canvas.js +0 -1
- package/dist/model/concurrency.d.ts +0 -1
- package/dist/model/concurrency.js +0 -1
- package/dist/model/storedDocument.d.ts +3 -4
- package/dist/model/storedDocument.js +2 -16
- package/dist/model/storedDocumentGrammar.d.ts +3 -14
- package/dist/model/storedDocumentGrammar.js +15 -33
- package/dist/model/workflow.d.ts +1 -4
- package/dist/model/workflow.js +1 -3
- package/dist/portTypes/ascii.d.ts +0 -1
- package/dist/portTypes/ascii.js +0 -1
- package/dist/portTypes/builtins.d.ts +0 -1
- package/dist/portTypes/builtins.js +0 -1
- package/dist/portTypes/capabilities.d.ts +0 -1
- package/dist/portTypes/capabilities.js +0 -1
- package/dist/portTypes/closedTerm.d.ts +0 -1
- package/dist/portTypes/closedTerm.js +0 -1
- package/dist/portTypes/grammar.d.ts +0 -1
- package/dist/portTypes/grammar.js +2 -67
- package/dist/portTypes/literalCoercion.d.ts +0 -1
- package/dist/portTypes/literalCoercion.js +0 -1
- package/dist/portTypes/literalForm.d.ts +0 -1
- package/dist/portTypes/literalForm.js +0 -1
- package/dist/portTypes/name.d.ts +0 -1
- package/dist/portTypes/name.js +0 -1
- package/dist/portTypes/registry.d.ts +0 -1
- package/dist/portTypes/registry.js +0 -1
- package/dist/portTypes/repeatedMember.d.ts +0 -1
- package/dist/portTypes/repeatedMember.js +0 -1
- package/dist/portTypes/typeArguments.d.ts +0 -1
- package/dist/portTypes/typeArguments.js +0 -1
- package/dist/portTypes/types.d.ts +1 -2
- package/dist/portTypes/types.js +0 -1
- package/dist/ports/dynamicPorts.d.ts +0 -1
- package/dist/ports/dynamicPorts.js +0 -1
- package/dist/ports/portTypeResolver.d.ts +0 -1
- package/dist/ports/portTypeResolver.js +0 -1
- package/dist/viewport/canvasViewport.d.ts +0 -1
- package/dist/viewport/canvasViewport.js +0 -1
- package/package.json +5 -1
- package/dist/analysis/documentSignature.d.ts.map +0 -1
- package/dist/analysis/documentSignature.js.map +0 -1
- package/dist/analysis/draftAnalysis.d.ts.map +0 -1
- package/dist/analysis/draftAnalysis.js.map +0 -1
- package/dist/editor/canvasFrames.d.ts.map +0 -1
- package/dist/editor/canvasFrames.js.map +0 -1
- package/dist/editor/createId.d.ts.map +0 -1
- package/dist/editor/createId.js.map +0 -1
- package/dist/editor/declaredBranches.d.ts.map +0 -1
- package/dist/editor/declaredBranches.js.map +0 -1
- package/dist/editor/editableDocument.d.ts.map +0 -1
- package/dist/editor/editableDocument.js.map +0 -1
- package/dist/editor/enumFieldFault.d.ts.map +0 -1
- package/dist/editor/enumFieldFault.js.map +0 -1
- package/dist/editor/incomingVariables.d.ts.map +0 -1
- package/dist/editor/incomingVariables.js.map +0 -1
- package/dist/editor/mappingFeeds.d.ts.map +0 -1
- package/dist/editor/mappingFeeds.js.map +0 -1
- package/dist/editor/messageCatalogue.d.ts.map +0 -1
- package/dist/editor/messageCatalogue.js.map +0 -1
- package/dist/editor/nodeLabels.d.ts.map +0 -1
- package/dist/editor/nodeLabels.js.map +0 -1
- package/dist/editor/passthroughTrace.d.ts.map +0 -1
- package/dist/editor/passthroughTrace.js.map +0 -1
- package/dist/editor/react.d.ts.map +0 -1
- package/dist/editor/react.js.map +0 -1
- package/dist/editor/store.d.ts.map +0 -1
- package/dist/editor/store.js.map +0 -1
- package/dist/editor/typedLiterals.d.ts.map +0 -1
- package/dist/editor/typedLiterals.js.map +0 -1
- package/dist/editor/validateBranchOutputs.d.ts.map +0 -1
- package/dist/editor/validateBranchOutputs.js.map +0 -1
- package/dist/editor/validateNodes.d.ts.map +0 -1
- package/dist/editor/validateNodes.js.map +0 -1
- package/dist/editor/validatePortTypeNames.d.ts.map +0 -1
- package/dist/editor/validatePortTypeNames.js.map +0 -1
- package/dist/editor/validateStructure.d.ts.map +0 -1
- package/dist/editor/validateStructure.js.map +0 -1
- package/dist/editor/validationRules.d.ts.map +0 -1
- package/dist/editor/validationRules.js.map +0 -1
- package/dist/editor/validationSummary.d.ts.map +0 -1
- package/dist/editor/validationSummary.js.map +0 -1
- package/dist/editor/workflowReference.d.ts.map +0 -1
- package/dist/editor/workflowReference.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/model/blockDeclaration.d.ts.map +0 -1
- package/dist/model/blockDeclaration.js.map +0 -1
- package/dist/model/blockType.d.ts.map +0 -1
- package/dist/model/blockType.js.map +0 -1
- package/dist/model/blockTypeInternal.d.ts.map +0 -1
- package/dist/model/blockTypeInternal.js.map +0 -1
- package/dist/model/canvas.d.ts.map +0 -1
- package/dist/model/canvas.js.map +0 -1
- package/dist/model/concurrency.d.ts.map +0 -1
- package/dist/model/concurrency.js.map +0 -1
- package/dist/model/storedDocument.d.ts.map +0 -1
- package/dist/model/storedDocument.js.map +0 -1
- package/dist/model/storedDocumentGrammar.d.ts.map +0 -1
- package/dist/model/storedDocumentGrammar.js.map +0 -1
- package/dist/model/workflow.d.ts.map +0 -1
- package/dist/model/workflow.js.map +0 -1
- package/dist/portTypes/ascii.d.ts.map +0 -1
- package/dist/portTypes/ascii.js.map +0 -1
- package/dist/portTypes/builtins.d.ts.map +0 -1
- package/dist/portTypes/builtins.js.map +0 -1
- package/dist/portTypes/capabilities.d.ts.map +0 -1
- package/dist/portTypes/capabilities.js.map +0 -1
- package/dist/portTypes/closedTerm.d.ts.map +0 -1
- package/dist/portTypes/closedTerm.js.map +0 -1
- package/dist/portTypes/grammar.d.ts.map +0 -1
- package/dist/portTypes/grammar.js.map +0 -1
- package/dist/portTypes/literalCoercion.d.ts.map +0 -1
- package/dist/portTypes/literalCoercion.js.map +0 -1
- package/dist/portTypes/literalForm.d.ts.map +0 -1
- package/dist/portTypes/literalForm.js.map +0 -1
- package/dist/portTypes/name.d.ts.map +0 -1
- package/dist/portTypes/name.js.map +0 -1
- package/dist/portTypes/registry.d.ts.map +0 -1
- package/dist/portTypes/registry.js.map +0 -1
- package/dist/portTypes/repeatedMember.d.ts.map +0 -1
- package/dist/portTypes/repeatedMember.js.map +0 -1
- package/dist/portTypes/typeArguments.d.ts.map +0 -1
- package/dist/portTypes/typeArguments.js.map +0 -1
- package/dist/portTypes/types.d.ts.map +0 -1
- package/dist/portTypes/types.js.map +0 -1
- package/dist/ports/dynamicPorts.d.ts.map +0 -1
- package/dist/ports/dynamicPorts.js.map +0 -1
- package/dist/ports/portTypeResolver.d.ts.map +0 -1
- package/dist/ports/portTypeResolver.js.map +0 -1
- package/dist/viewport/canvasViewport.d.ts.map +0 -1
- package/dist/viewport/canvasViewport.js.map +0 -1
package/README.md
CHANGED
|
@@ -42,6 +42,35 @@ declare module '@reeve-iot/workflow-core' {
|
|
|
42
42
|
|
|
43
43
|
The full contract is in [docs/reference/port-types.md](https://github.com/reeve-iot/reeve-workflow/blob/main/docs/reference/port-types.md).
|
|
44
44
|
|
|
45
|
+
### Editor store
|
|
46
|
+
|
|
47
|
+
The editor state (nodes, edges, canvas stack, selection, validation) lives in one store per editor.
|
|
48
|
+
`createWorkflowEditorStore(options)` makes one, outside React or inside it. `WorkflowEditorStoreProvider` creates a
|
|
49
|
+
store from the same `options` and shares it with its children; `useWorkflowEditorStore(selector)` reads it, and
|
|
50
|
+
throws outside a provider. There is no global store, so two editors on a page do not share a canvas.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import {
|
|
54
|
+
WorkflowEditorStoreProvider,
|
|
55
|
+
readStoredDefinitionText,
|
|
56
|
+
useWorkflowEditorStore,
|
|
57
|
+
} from '@reeve-iot/workflow-core'
|
|
58
|
+
|
|
59
|
+
function OpenButton({ definitionJson }: { definitionJson: string }) {
|
|
60
|
+
const loadStoredWorkflow = useWorkflowEditorStore((s) => s.loadStoredWorkflow)
|
|
61
|
+
return <button onClick={() => loadStoredWorkflow(readStoredDefinitionText(definitionJson))}>Open</button>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
<WorkflowEditorStoreProvider options={{ portTypes }}>
|
|
65
|
+
<OpenButton definitionJson={saved} />
|
|
66
|
+
</WorkflowEditorStoreProvider>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A stored workflow is read by the stored-document reader (`readStoredDefinitionText`, or `readStoredDefinition` for a
|
|
70
|
+
value you already hold), which never throws. If it refuses the document, `loadStoredWorkflow` shows an empty canvas
|
|
71
|
+
that cannot be saved and puts the reason on `loadedDocumentFault`, so a save never replaces the stored workflow with
|
|
72
|
+
an empty one. `loadWorkflow` takes a graph you built yourself.
|
|
73
|
+
|
|
45
74
|
### Validation findings
|
|
46
75
|
|
|
47
76
|
`validateStructure()`, `validateWorkflow()` and `validateWorkflowWarnings()` return `ValidationFinding[]`. `code` is
|
|
@@ -49,8 +78,9 @@ the stable rule identifier, `message` is its English text, and `params` carries
|
|
|
49
78
|
Host rules return their own `code`, `params` and English `message`.
|
|
50
79
|
|
|
51
80
|
```ts
|
|
52
|
-
import { validationMessage } from '@reeve-iot/workflow-core'
|
|
81
|
+
import { createWorkflowEditorStore, validationMessage } from '@reeve-iot/workflow-core'
|
|
53
82
|
|
|
83
|
+
const store = createWorkflowEditorStore({ portTypes })
|
|
54
84
|
const finding = store.getState().validateWorkflow()[0]
|
|
55
85
|
if (finding) console.log(validationMessage(finding))
|
|
56
86
|
```
|
|
@@ -2,4 +2,3 @@ import type { DraftAnalysisDocument } from './draftAnalysis.js';
|
|
|
2
2
|
/** Text that is equal for two documents exactly when a draft analysis of one answers for the other: the document with
|
|
3
3
|
* node positions left out. */
|
|
4
4
|
export declare function documentSignature(document: DraftAnalysisDocument): string;
|
|
5
|
-
//# sourceMappingURL=documentSignature.d.ts.map
|
|
@@ -95,4 +95,3 @@ export declare function isMapTerm(term: string): boolean;
|
|
|
95
95
|
/** Whether `term` is exactly `Map<String,String>` (key and value in any ASCII case, neither nullable, the map not nullable):
|
|
96
96
|
* the one map whose literal an editor can draw as key/value rows of text. */
|
|
97
97
|
export declare function isStringMapTerm(term: string): boolean;
|
|
98
|
-
//# sourceMappingURL=draftAnalysis.d.ts.map
|
|
@@ -103,4 +103,3 @@ export function isStringMapTerm(term) {
|
|
|
103
103
|
return value.kind === 'atom' && !value.nullable && foldAsciiCase(value.name) === 'string'
|
|
104
104
|
&& parsed.term.key !== undefined && foldAsciiCase(parsed.term.key.name) === 'string';
|
|
105
105
|
}
|
|
106
|
-
//# sourceMappingURL=draftAnalysis.js.map
|
|
@@ -28,4 +28,3 @@ export declare function boundBlockTypes(nodes: readonly WorkflowNode[], blockTyp
|
|
|
28
28
|
/** Every canvas of `definition` the compiler grades, a declared branch it lacks as `emptyBranch`, in its walk order. A
|
|
29
29
|
* path two canvases share is skipped with everything below it: the compiler keys what it learns by path. */
|
|
30
30
|
export declare function documentCanvases(stored: WorkflowDefinition, blockTypes: readonly BlockTypeDescriptor[]): DocumentCanvas[];
|
|
31
|
-
//# sourceMappingURL=canvasFrames.d.ts.map
|
|
@@ -2,4 +2,3 @@
|
|
|
2
2
|
* in several test environments, so it is used when present and otherwise built from random bytes. Ids only
|
|
3
3
|
* have to be unique within one document, and a host that needs its own scheme passes `createId`. */
|
|
4
4
|
export declare function createDefaultId(): string;
|
|
5
|
-
//# sourceMappingURL=createId.d.ts.map
|
package/dist/editor/createId.js
CHANGED
|
@@ -18,4 +18,3 @@ export function createDefaultId() {
|
|
|
18
18
|
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
19
19
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=createId.js.map
|
|
@@ -11,4 +11,3 @@ export declare function emptyBranch(node: WorkflowNode | undefined, blockType: B
|
|
|
11
11
|
/** `definition` with each declared branch a node lacks written as `emptyBranch`, after the node's own; `definition`
|
|
12
12
|
* itself where none is lacking. Nothing in it is changed. */
|
|
13
13
|
export declare function withDeclaredBranches(definition: WorkflowDefinition, blockTypes: readonly BlockTypeDescriptor[]): WorkflowDefinition;
|
|
14
|
-
//# sourceMappingURL=declaredBranches.d.ts.map
|
|
@@ -16,4 +16,3 @@ export declare function editorForm(definition: WorkflowDefinition): WorkflowDefi
|
|
|
16
16
|
/** Writes `current` with canonical edge and mapping forms; an empty passthrough is omitted.
|
|
17
17
|
* Nodes and edges pair with loaded ones by id, then by order among one id. */
|
|
18
18
|
export declare function restoredDefinition(current: WorkflowDefinition, loaded: WorkflowDefinition | null): SavedWorkflowDefinition;
|
|
19
|
-
//# sourceMappingURL=editableDocument.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { BlockTypeDescriptor } from '../model/blockType.js';
|
|
2
2
|
/** The reason a block's Enum configuration fields are malformed, under the rule ids C# registration refuses them with. */
|
|
3
3
|
export declare function enumFieldFault(block: BlockTypeDescriptor): string | undefined;
|
|
4
|
-
//# sourceMappingURL=enumFieldFault.d.ts.map
|
|
@@ -33,4 +33,3 @@ export interface IncomingVariablesInput {
|
|
|
33
33
|
* The type is the resolver's closed declared term; for a name only a passthrough entry gives it is the term the analysis
|
|
34
34
|
* answers for that output. Where neither has one it is undefined. */
|
|
35
35
|
export declare function computeIncomingVariables({ node, nodes, edges, blockTypes, canvasStack, workflowInputParams, resolver, analysis, freshness, }: IncomingVariablesInput): IncomingVariable[];
|
|
36
|
-
//# sourceMappingURL=incomingVariables.d.ts.map
|
|
@@ -54,4 +54,3 @@ export function computeIncomingVariables({ node, nodes, edges, blockTypes, canva
|
|
|
54
54
|
}
|
|
55
55
|
return [...variables.entries()].map(([name, { type, stale }]) => ({ name, type, ...(stale ? { stale } : {}), edgeId: offeredBy.get(name) }));
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=incomingVariables.js.map
|
|
@@ -5,4 +5,3 @@ export declare function isActiveMapping(edge: WorkflowEdge, input: string): bool
|
|
|
5
5
|
/** Whether the compiler's WiredInputNames counts this mapping as feeding `input`, `nodeIds` being the ids on the
|
|
6
6
|
* edge's canvas: an active literal whatever its value or wire's source, a wired mapping when its source is there. */
|
|
7
7
|
export declare function feedsInput(edge: WorkflowEdge, input: string, nodeIds: ReadonlySet<string>): boolean;
|
|
8
|
-
//# sourceMappingURL=mappingFeeds.d.ts.map
|
|
@@ -24,4 +24,3 @@ export declare const LIBRARY_VALIDATION_CODES: readonly string[];
|
|
|
24
24
|
* used whenever it has one.
|
|
25
25
|
*/
|
|
26
26
|
export declare function validationMessage(finding: ValidationFinding, catalogue?: ValidationMessageCatalogue): string;
|
|
27
|
-
//# sourceMappingURL=messageCatalogue.d.ts.map
|
|
@@ -58,7 +58,7 @@ export const MESSAGE_ONLY_VALIDATION_CODES = [
|
|
|
58
58
|
'dotted-name', 'port-type-alias', 'port-type-unregistered', 'expression-field-access-invalid', 'expression-type-mismatch',
|
|
59
59
|
'expression-result-type-mismatch', 'error-policy-on-boundary-node',
|
|
60
60
|
'port-list-without-dynamic-ports', 'declared-outputs-unsupported', 'declared-output-source-unknown',
|
|
61
|
-
'type-parameter-conflict', 'type-parameter-unbound', 'type-parameter-constraint', 'json-projection-invalid',
|
|
61
|
+
'type-parameter-conflict', 'type-parameter-unbound', 'type-parameter-constraint', 'json-projection-invalid',
|
|
62
62
|
'secret-input-passthrough', 'secret-input-key-invalid',
|
|
63
63
|
];
|
|
64
64
|
/** The English templates, by code. A finding is rendered from its entry only when it carries every `requiredParams`. */
|
|
@@ -82,4 +82,3 @@ export function validationMessage(finding, catalogue) {
|
|
|
82
82
|
return finding.message;
|
|
83
83
|
return override ? override(params, finding) : english.render(params);
|
|
84
84
|
}
|
|
85
|
-
//# sourceMappingURL=messageCatalogue.js.map
|
|
@@ -7,4 +7,3 @@ import type { WorkflowDefinition, WorkflowNode } from '../model/workflow.js';
|
|
|
7
7
|
* text, in quotes. Pass the result as `validateNodes`' `nodeLabel` when calling it directly. A node is placed by identity:
|
|
8
8
|
* ask for the node objects of `definition` itself; any other node is named without its canvas. */
|
|
9
9
|
export declare function documentNodeLabels(definition: Pick<WorkflowDefinition, 'nodes'>, blockTypes: readonly BlockTypeDescriptor[]): (node: WorkflowNode) => string;
|
|
10
|
-
//# sourceMappingURL=nodeLabels.d.ts.map
|
|
@@ -14,4 +14,3 @@ export declare function hasMalformedStoredPortType(node: WorkflowNode, blockType
|
|
|
14
14
|
/** The passthrough names the compiler makes ports, laddered as ResolvePassthroughType: a declared input, the last mapping
|
|
15
15
|
* into the name, then a forwarded configuration value. A name the editor cannot trace (a block it lacks) counts as traced. */
|
|
16
16
|
export declare function tracedPassthrough(canvas: TraceCanvas, node: WorkflowNode): Set<string>;
|
|
17
|
-
//# sourceMappingURL=passthroughTrace.d.ts.map
|
package/dist/editor/react.d.ts
CHANGED
|
@@ -22,4 +22,3 @@ export declare function useWorkflowEditorStoreApi(): WorkflowEditorStore;
|
|
|
22
22
|
/** Reads the editor store from context. Throws rather than falling back to a global, so a component
|
|
23
23
|
* rendered outside the provider fails loudly instead of quietly editing nothing. */
|
|
24
24
|
export declare function useWorkflowEditorStore<T = WorkflowEditorState>(selector?: (state: WorkflowEditorState) => T): T;
|
|
25
|
-
//# sourceMappingURL=react.d.ts.map
|
package/dist/editor/react.js
CHANGED
package/dist/editor/store.d.ts
CHANGED
|
@@ -168,4 +168,3 @@ type WorkflowEditorData = Pick<WorkflowEditorState, 'nodes' | 'edges' | 'canvasS
|
|
|
168
168
|
export declare const createInitialWorkflowEditorData: () => WorkflowEditorData;
|
|
169
169
|
export type WorkflowEditorStore = ReturnType<typeof createWorkflowEditorStore>;
|
|
170
170
|
export declare function createWorkflowEditorStore(options: WorkflowEditorStoreOptions): StoreApi<WorkflowEditorState>;
|
|
171
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/editor/store.js
CHANGED
|
@@ -552,15 +552,14 @@ function readProjection(target, raw) {
|
|
|
552
552
|
}
|
|
553
553
|
function canonicalizeEdgeMappings(mappings) {
|
|
554
554
|
const canonical = {};
|
|
555
|
+
if (Array.isArray(mappings))
|
|
556
|
+
throw new TypeError('Mappings must be an object, not an array (rule L7)');
|
|
555
557
|
for (const [target, raw] of Object.entries(mappings)) {
|
|
556
558
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
557
559
|
throw new TypeError(`Mapping '${target}' must be an object`);
|
|
558
|
-
if (Object.keys(raw).some((key) => !['type', 'sourceOutputName', '
|
|
560
|
+
if (Object.keys(raw).some((key) => !['type', 'sourceOutputName', 'literalValue', 'projection'].includes(key))) {
|
|
559
561
|
throw new TypeError(`Mapping '${target}' contains an unlisted key`);
|
|
560
562
|
}
|
|
561
|
-
if (Object.hasOwn(raw, 'sourceOutput') && Object.hasOwn(raw, 'sourceOutputName')) {
|
|
562
|
-
throw new TypeError(`Mapping '${target}' has both source-output spellings`);
|
|
563
|
-
}
|
|
564
563
|
const literal = typeof raw.type === 'string' && raw.type.toLowerCase() === 'literal';
|
|
565
564
|
if (Object.hasOwn(raw, 'literalValue') && raw.literalValue === null) {
|
|
566
565
|
throw new TypeError(`Mapping '${target}' cannot have a null literalValue`);
|
|
@@ -570,11 +569,10 @@ function canonicalizeEdgeMappings(mappings) {
|
|
|
570
569
|
canonical[target] = { type: 'literal', ...(Object.hasOwn(raw, 'literalValue') ? { literalValue: raw.literalValue } : {}), ...projection };
|
|
571
570
|
continue;
|
|
572
571
|
}
|
|
573
|
-
const source =
|
|
572
|
+
const source = raw.sourceOutputName;
|
|
574
573
|
if (typeof source !== 'string' || source.length === 0)
|
|
575
574
|
continue;
|
|
576
575
|
canonical[target] = { type: 'direct', sourceOutputName: source, ...projection };
|
|
577
576
|
}
|
|
578
577
|
return canonical;
|
|
579
578
|
}
|
|
580
|
-
//# sourceMappingURL=store.js.map
|
|
@@ -15,4 +15,3 @@ export declare function validatePortTypeNames(input: {
|
|
|
15
15
|
/** Names a branch's container in a duplicate-node-id finding; its block type id without it. */
|
|
16
16
|
blockTypes?: readonly BlockTypeDescriptor[];
|
|
17
17
|
}): ValidationFinding[];
|
|
18
|
-
//# sourceMappingURL=validatePortTypeNames.d.ts.map
|
|
@@ -23,4 +23,3 @@ export type NodeValidationRule = (context: NodeValidationContext) => ValidationF
|
|
|
23
23
|
/** Runs every rule and flattens the result. A rule that throws is reported as a finding of its own rather
|
|
24
24
|
* than being allowed to abort validation for every other node. */
|
|
25
25
|
export declare function runNodeRules(rules: readonly NodeValidationRule[], context: NodeValidationContext): ValidationFinding[];
|
|
26
|
-
//# sourceMappingURL=validationRules.d.ts.map
|
|
@@ -25,4 +25,3 @@ type LabelResolver = (nodeId: string | null, canvasPath: readonly CanvasPathSegm
|
|
|
25
25
|
* the live node list. */
|
|
26
26
|
export declare function buildValidationSummary(errors: ValidationFinding[], warnings?: ValidationFinding[], resolveLabel?: LabelResolver): ValidationSummary;
|
|
27
27
|
export {};
|
|
28
|
-
//# sourceMappingURL=validationSummary.d.ts.map
|
|
@@ -16,4 +16,3 @@ export declare const WorkflowReferenceResolverContext: import("react").Context<W
|
|
|
16
16
|
export declare function useWorkflowReferenceResolver(): WorkflowReferenceResolver;
|
|
17
17
|
/** The workflow a node references, or null when the block does not run one or nothing is chosen yet. */
|
|
18
18
|
export declare function readWorkflowReference(configuration: Record<string, unknown>, runsWorkflowFrom: string | null | undefined): string | null;
|
|
19
|
-
//# sourceMappingURL=workflowReference.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/model/blockType.js
CHANGED
|
@@ -2,4 +2,3 @@ import type { BlockTypeDescriptor } from './blockType.js';
|
|
|
2
2
|
/** The branches a descriptor declares, in declared order; a descriptor that omits the list is read from its output
|
|
3
3
|
* map, so every reader walks the same branches. */
|
|
4
4
|
export declare function declaredBranchNames(block: BlockTypeDescriptor): readonly string[];
|
|
5
|
-
//# sourceMappingURL=blockTypeInternal.d.ts.map
|
package/dist/model/canvas.d.ts
CHANGED
package/dist/model/canvas.js
CHANGED
|
@@ -15,7 +15,7 @@ export interface StoredDocumentFault {
|
|
|
15
15
|
}
|
|
16
16
|
export type StoredPortTypeSiteKind = 'DeclaredOutput' | 'DynamicInputPort' | 'DynamicOutputPort' | 'InputParameter' | 'OutputParameter' | 'TypeArgument' | 'ProjectionType';
|
|
17
17
|
/** One port type field of a document the reader accepted, with its text as written: `null` when it is
|
|
18
|
-
* absent or `null
|
|
18
|
+
* absent or `null`. The grammar, not the reader, decides whether the text is a name. */
|
|
19
19
|
export interface StoredPortTypeSite {
|
|
20
20
|
site: StoredPortTypeSiteKind;
|
|
21
21
|
location: string;
|
|
@@ -55,13 +55,13 @@ export type StoredListRead = {
|
|
|
55
55
|
};
|
|
56
56
|
/** The deepest nesting of arrays and objects a document may have, the outermost counting as 1. */
|
|
57
57
|
export declare const MAX_DOCUMENT_NESTING = 64;
|
|
58
|
-
/** The configuration keys whose values are the library's port lists
|
|
58
|
+
/** The configuration keys whose values are the library's port lists. */
|
|
59
59
|
export declare const INPUT_PORTS_KEY = "InputPorts";
|
|
60
60
|
export declare const OUTPUT_PORTS_KEY = "OutputPorts";
|
|
61
61
|
/** Reads a workflow definition the editor holds, or was handed as a value, under the stored-document rules.
|
|
62
62
|
* A value cannot hold two keys of one name, so L3 is seen only by `readStoredDefinitionText`. */
|
|
63
63
|
export declare function readStoredDefinition(value: unknown): StoredDefinitionRead;
|
|
64
|
-
/** Reads a stored definition's text under every rule,
|
|
64
|
+
/** Reads a stored definition's text under every reader rule, the first fault in document order. */
|
|
65
65
|
export declare function readStoredDefinitionText(documentText: string | null | undefined): StoredDefinitionRead;
|
|
66
66
|
/** Reads a workflow's declared input or output parameters the editor holds. Absent and `null` are none. */
|
|
67
67
|
export declare function readParameterList(value: unknown, direction: 'input' | 'output'): StoredListRead;
|
|
@@ -82,4 +82,3 @@ export declare function readMappingProjection(value: unknown): {
|
|
|
82
82
|
export declare function describeStoredDocumentFault(fault: Pick<StoredDocumentFault, 'location' | 'detail'> & {
|
|
83
83
|
readonly rule: string;
|
|
84
84
|
}): string;
|
|
85
|
-
//# sourceMappingURL=storedDocument.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { foldAsciiCase } from '../portTypes/ascii.js';
|
|
|
2
2
|
import { DEFINITION, PARAMETER_LIST, PORT_LIST, PROJECTION, STORED_DOCUMENT_RULES } from './storedDocumentGrammar.js';
|
|
3
3
|
/** The deepest nesting of arrays and objects a document may have, the outermost counting as 1. */
|
|
4
4
|
export const MAX_DOCUMENT_NESTING = 64;
|
|
5
|
-
/** The configuration keys whose values are the library's port lists
|
|
5
|
+
/** The configuration keys whose values are the library's port lists. */
|
|
6
6
|
export const INPUT_PORTS_KEY = 'InputPorts';
|
|
7
7
|
export const OUTPUT_PORTS_KEY = 'OutputPorts';
|
|
8
8
|
const escapeKey = (key) => key.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
@@ -379,16 +379,6 @@ class Walk {
|
|
|
379
379
|
case 'config':
|
|
380
380
|
this.config(value, at);
|
|
381
381
|
return;
|
|
382
|
-
case 'either':
|
|
383
|
-
if (value.is === 'array' && kind.refuseArray)
|
|
384
|
-
this.fail(STORED_DOCUMENT_RULES.L7, at, 'array-form mappings must be migrated to the object form');
|
|
385
|
-
else if (value.is === 'array')
|
|
386
|
-
this.array(value, kind.array, at);
|
|
387
|
-
else if (value.is === 'object')
|
|
388
|
-
this.map(value, kind.map, at);
|
|
389
|
-
else
|
|
390
|
-
this.fail(STORED_DOCUMENT_RULES.L7, at, `${describeValue(value)} where an array or an object of mappings is required`);
|
|
391
|
-
return;
|
|
392
382
|
case 'object':
|
|
393
383
|
this.object(value, kind, at);
|
|
394
384
|
}
|
|
@@ -525,9 +515,6 @@ class Walk {
|
|
|
525
515
|
const variant = kind.fields.find((f) => foldAsciiCase(f.key) === foldAsciiCase(key));
|
|
526
516
|
if (variant)
|
|
527
517
|
this.fail(STORED_DOCUMENT_RULES.L5, append(at, key), `a key '${key}' where '${variant.key}' is meant; keys match exactly`);
|
|
528
|
-
const current = Object.entries(kind.retired).find(([retired]) => foldAsciiCase(retired) === foldAsciiCase(key))?.[1];
|
|
529
|
-
if (current !== undefined)
|
|
530
|
-
this.fail(STORED_DOCUMENT_RULES.L6, append(at, key), `a key '${key}', a retired spelling of '${current}'`);
|
|
531
518
|
this.fail(STORED_DOCUMENT_RULES.UnknownKey, append(at, key), `unlisted key '${key}' on ${kind.name}`);
|
|
532
519
|
}
|
|
533
520
|
for (const f of kind.fields) {
|
|
@@ -636,7 +623,7 @@ export function readStoredDefinition(value) {
|
|
|
636
623
|
return { ok: false, fault: NO_DOCUMENT };
|
|
637
624
|
return readDefinition(() => hold(value, '', 1));
|
|
638
625
|
}
|
|
639
|
-
/** Reads a stored definition's text under every rule,
|
|
626
|
+
/** Reads a stored definition's text under every reader rule, the first fault in document order. */
|
|
640
627
|
export function readStoredDefinitionText(documentText) {
|
|
641
628
|
if (isBlank(documentText))
|
|
642
629
|
return { ok: false, fault: NO_DOCUMENT };
|
|
@@ -691,4 +678,3 @@ export function readMappingProjection(value) {
|
|
|
691
678
|
export function describeStoredDocumentFault(fault) {
|
|
692
679
|
return `${fault.detail} (rule ${fault.rule}, at '${fault.location}')`;
|
|
693
680
|
}
|
|
694
|
-
//# sourceMappingURL=storedDocument.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/** The rules a reader's fault carries, one member each, and the only ids a fault names.
|
|
2
|
-
*
|
|
1
|
+
/** The rules a reader's fault carries, one member each, and the only ids a fault names. A port type field faults
|
|
2
|
+
* as `L7`, and an embedded port list under the rule its own text breaks. */
|
|
3
3
|
export declare const STORED_DOCUMENT_RULES: Readonly<{
|
|
4
4
|
readonly L1: "L1";
|
|
5
5
|
readonly L2: "L2";
|
|
6
6
|
readonly L3: "L3";
|
|
7
7
|
readonly L4: "L4";
|
|
8
8
|
readonly L5: "L5";
|
|
9
|
-
readonly L6: "L6";
|
|
10
9
|
readonly L7: "L7";
|
|
11
10
|
readonly DuplicateNodeId: "duplicate-node-id";
|
|
12
11
|
readonly DuplicateEdgeId: "duplicate-edge-id";
|
|
@@ -15,7 +14,7 @@ export declare const STORED_DOCUMENT_RULES: Readonly<{
|
|
|
15
14
|
readonly DottedName: "dotted-name";
|
|
16
15
|
readonly ErrorPolicyRouteUnread: "error-policy-route-unread";
|
|
17
16
|
}>;
|
|
18
|
-
/** The rule broken: L1–L7 describe text and shape faults; named rules cover duplicate ids and dotted names. */
|
|
17
|
+
/** The rule broken: L1–L5 and L7 describe text and shape faults; named rules cover duplicate ids and dotted names. */
|
|
19
18
|
export type StoredDocumentRule = (typeof STORED_DOCUMENT_RULES)[keyof typeof STORED_DOCUMENT_RULES];
|
|
20
19
|
/** Every rule id of the reader, for the test that holds the contract to them. */
|
|
21
20
|
export declare const STORED_DOCUMENT_RULE_IDS: readonly StoredDocumentRule[];
|
|
@@ -41,11 +40,6 @@ export type Kind = {
|
|
|
41
40
|
of: 'portType';
|
|
42
41
|
} | ArrayKind | MapKind | {
|
|
43
42
|
of: 'config';
|
|
44
|
-
} | {
|
|
45
|
-
of: 'either';
|
|
46
|
-
array: ArrayKind;
|
|
47
|
-
map: MapKind;
|
|
48
|
-
refuseArray?: boolean;
|
|
49
43
|
} | ObjectKind;
|
|
50
44
|
export interface ArrayKind {
|
|
51
45
|
of: 'array';
|
|
@@ -64,13 +58,11 @@ export interface Field {
|
|
|
64
58
|
refusedRule?: StoredDocumentRule;
|
|
65
59
|
refusedDetail?: string;
|
|
66
60
|
}
|
|
67
|
-
/** `retired` maps a spelling a field no longer has to the field's one key (rule L6). */
|
|
68
61
|
export interface ObjectKind {
|
|
69
62
|
of: 'object';
|
|
70
63
|
name: string;
|
|
71
64
|
fields: Field[];
|
|
72
65
|
role: Role;
|
|
73
|
-
retired: Readonly<Record<string, string>>;
|
|
74
66
|
}
|
|
75
67
|
export declare const PARAMETER_LIST: ArrayKind;
|
|
76
68
|
export declare const PORT_LIST: ArrayKind;
|
|
@@ -82,8 +74,6 @@ export interface GrammarPath {
|
|
|
82
74
|
readonly path: string;
|
|
83
75
|
readonly values: readonly string[];
|
|
84
76
|
}
|
|
85
|
-
/** The label of an object kind, as `StoredVersionComparison.LabelOf` labels it: a mapping names the form it is in. */
|
|
86
|
-
export declare function kindLabel(kind: ObjectKind): string;
|
|
87
77
|
/** Every path of the kind table, in the order the backend's `Describe` visits them: the definition's, then a
|
|
88
78
|
* parameter's, then a port list entry's. */
|
|
89
79
|
export declare function grammarPaths(): GrammarPath[];
|
|
@@ -93,4 +83,3 @@ export declare function grammarObjects(): GrammarPath[];
|
|
|
93
83
|
/** The value classes of a field: its kind's, then `null` where it may hold one, then `absent` where it is optional.
|
|
94
84
|
* A configuration field's classes open with `object`, the field's own shape, and not a value's. */
|
|
95
85
|
export declare function valuesOf(entry: Field): string[];
|
|
96
|
-
//# sourceMappingURL=storedDocumentGrammar.d.ts.map
|