@particle-academy/fancy-flow 0.55.0 → 0.56.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/dist/{chunk-YVLOLS25.js → chunk-GB4A7DFM.js} +19 -4
- package/dist/chunk-GB4A7DFM.js.map +1 -0
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/schema/index.d.cts +29 -5
- package/dist/schema/index.d.ts +29 -5
- package/dist/schema.cjs +17 -2
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-YVLOLS25.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@ export { evaluateConfig, evaluateExpression, resolvePath, text, truthy } from '.
|
|
|
7
7
|
import { buildNodeTypes } from './chunk-E3AGYTHP.js';
|
|
8
8
|
export { ANY_PORT_TYPE, RegistryNode, buildNodeTypes, createConnectionValidator, defaultPortCompatibility } from './chunk-E3AGYTHP.js';
|
|
9
9
|
export { LEGACY_PAUSE_PREFIXES, PAUSE_PREFIX, decodePause, encodePause, isPause, pauseForHuman } from './chunk-UEOE6B52.js';
|
|
10
|
-
import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-
|
|
11
|
-
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-
|
|
10
|
+
import { workflowToBlob, importWorkflow, exportWorkflow } from './chunk-GB4A7DFM.js';
|
|
11
|
+
export { WORKFLOW_SCHEMA_URL, WORKFLOW_SCHEMA_VERSION, exportWorkflow, importWorkflow, migrateSchema, workflowToBlob } from './chunk-GB4A7DFM.js';
|
|
12
12
|
import { ReactFlowProvider, useReactFlow, humanInputFields, onNodeKindsChanged, listNodeKinds, getNodeKind, defaultConfigFor, FlowEditorProvider, addEdge, applyEdgeChanges, applyNodeChanges, Position, ensureBuiltinKinds, validateConfig, categoryAccent, Handle } from './chunk-22OJOD4X.js';
|
|
13
13
|
export { BUILTIN_KINDS, LaneNode, NoteNode, categoryAccent, clearNodeKindOverrides, defaultConfigFor, ensureBuiltinKinds, getNodeKind, listNodeKinds, onNodeKindsChanged, overrideNodeKind, registerBuiltinKinds, registerNodeKind, resolveNodePorts, resolvePortSpec, runFlow, useFlowEditor, useFlowEditorOptional, validateConfig } from './chunk-22OJOD4X.js';
|
|
14
14
|
import { getRichInputAdapter } from './chunk-F5RPRB7A.js';
|
package/dist/schema/index.d.cts
CHANGED
|
@@ -116,13 +116,37 @@ type ImportOptions = {
|
|
|
116
116
|
* instead of errors. Default false. */
|
|
117
117
|
lenient?: boolean;
|
|
118
118
|
};
|
|
119
|
+
/** A migration step: takes a version-N document to version N+1. */
|
|
120
|
+
type MigrationStep = (schema: Record<string, unknown>) => Record<string, unknown>;
|
|
119
121
|
/**
|
|
120
|
-
* Migrate a raw schema object up to the current version
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* Migrate a raw schema object up to the current version, as far as it can go.
|
|
123
|
+
*
|
|
124
|
+
* Additive changes need no migration — an older document simply lacks the newer
|
|
125
|
+
* optional fields. This is the seam for a future BREAKING bump, and
|
|
126
|
+
* `importWorkflow` runs it before validating the version.
|
|
127
|
+
*
|
|
128
|
+
* ## The three rules, each with a reason
|
|
129
|
+
*
|
|
130
|
+
* - **A PAST version migrates forward**, step by step, to the current one.
|
|
131
|
+
* - **A FUTURE version is left ALONE.** We cannot know what a later schema
|
|
132
|
+
* means, and migrating downward would be guessing. Untouched hands it to the
|
|
133
|
+
* version check, which reports it honestly.
|
|
134
|
+
* - **A GAP in the table is left alone too.** A missing step is not a licence
|
|
135
|
+
* to guess.
|
|
136
|
+
*
|
|
137
|
+
* ## Why `steps` is a parameter
|
|
138
|
+
*
|
|
139
|
+
* With only v1 in existence there is no old document to migrate, so a seam
|
|
140
|
+
* tested against the built-in (empty) table is a check that CANNOT fail — it
|
|
141
|
+
* would pass identically against a function that returned its input untouched,
|
|
142
|
+
* which is what this was until the twins needed the same seam.
|
|
143
|
+
*
|
|
144
|
+
* The PHP and Python runtimes carry the identical shape. That mattered more
|
|
145
|
+
* than it sounds: they had no migration at all and errored on any version
|
|
146
|
+
* mismatch, so a v2 bump would have made every stored Op unreadable on exactly
|
|
147
|
+
* the runtimes where durable runs resume.
|
|
124
148
|
*/
|
|
125
|
-
declare function migrateSchema(schema: unknown): unknown;
|
|
149
|
+
declare function migrateSchema(schema: unknown, steps?: Record<number, MigrationStep>): unknown;
|
|
126
150
|
/**
|
|
127
151
|
* Hydrate a schema into runtime FlowGraph + validate kinds/configs against
|
|
128
152
|
* the registry. Reports issues for unknown kinds, missing required config,
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -116,13 +116,37 @@ type ImportOptions = {
|
|
|
116
116
|
* instead of errors. Default false. */
|
|
117
117
|
lenient?: boolean;
|
|
118
118
|
};
|
|
119
|
+
/** A migration step: takes a version-N document to version N+1. */
|
|
120
|
+
type MigrationStep = (schema: Record<string, unknown>) => Record<string, unknown>;
|
|
119
121
|
/**
|
|
120
|
-
* Migrate a raw schema object up to the current version
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* Migrate a raw schema object up to the current version, as far as it can go.
|
|
123
|
+
*
|
|
124
|
+
* Additive changes need no migration — an older document simply lacks the newer
|
|
125
|
+
* optional fields. This is the seam for a future BREAKING bump, and
|
|
126
|
+
* `importWorkflow` runs it before validating the version.
|
|
127
|
+
*
|
|
128
|
+
* ## The three rules, each with a reason
|
|
129
|
+
*
|
|
130
|
+
* - **A PAST version migrates forward**, step by step, to the current one.
|
|
131
|
+
* - **A FUTURE version is left ALONE.** We cannot know what a later schema
|
|
132
|
+
* means, and migrating downward would be guessing. Untouched hands it to the
|
|
133
|
+
* version check, which reports it honestly.
|
|
134
|
+
* - **A GAP in the table is left alone too.** A missing step is not a licence
|
|
135
|
+
* to guess.
|
|
136
|
+
*
|
|
137
|
+
* ## Why `steps` is a parameter
|
|
138
|
+
*
|
|
139
|
+
* With only v1 in existence there is no old document to migrate, so a seam
|
|
140
|
+
* tested against the built-in (empty) table is a check that CANNOT fail — it
|
|
141
|
+
* would pass identically against a function that returned its input untouched,
|
|
142
|
+
* which is what this was until the twins needed the same seam.
|
|
143
|
+
*
|
|
144
|
+
* The PHP and Python runtimes carry the identical shape. That mattered more
|
|
145
|
+
* than it sounds: they had no migration at all and errored on any version
|
|
146
|
+
* mismatch, so a v2 bump would have made every stored Op unreadable on exactly
|
|
147
|
+
* the runtimes where durable runs resume.
|
|
124
148
|
*/
|
|
125
|
-
declare function migrateSchema(schema: unknown): unknown;
|
|
149
|
+
declare function migrateSchema(schema: unknown, steps?: Record<number, MigrationStep>): unknown;
|
|
126
150
|
/**
|
|
127
151
|
* Hydrate a schema into runtime FlowGraph + validate kinds/configs against
|
|
128
152
|
* the registry. Reports issues for unknown kinds, missing required config,
|
package/dist/schema.cjs
CHANGED
|
@@ -10737,8 +10737,23 @@ function toSchemaEdge(e) {
|
|
|
10737
10737
|
label: typeof e.label === "string" ? e.label : void 0
|
|
10738
10738
|
};
|
|
10739
10739
|
}
|
|
10740
|
-
|
|
10741
|
-
|
|
10740
|
+
var MIGRATIONS = {};
|
|
10741
|
+
function migrateSchema(schema, steps = MIGRATIONS) {
|
|
10742
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
10743
|
+
const doc = schema;
|
|
10744
|
+
let version = doc.version;
|
|
10745
|
+
if (typeof version !== "number" || !Number.isInteger(version) || version >= WORKFLOW_SCHEMA_VERSION) {
|
|
10746
|
+
return schema;
|
|
10747
|
+
}
|
|
10748
|
+
let out = doc;
|
|
10749
|
+
while (version < WORKFLOW_SCHEMA_VERSION) {
|
|
10750
|
+
const step = steps[version];
|
|
10751
|
+
if (!step) return out;
|
|
10752
|
+
out = step(out);
|
|
10753
|
+
version += 1;
|
|
10754
|
+
out.version = version;
|
|
10755
|
+
}
|
|
10756
|
+
return out;
|
|
10742
10757
|
}
|
|
10743
10758
|
function importWorkflow(schema, options = {}) {
|
|
10744
10759
|
const issues = [];
|