@protobase/workflows 0.100.2 → 0.100.3

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,12 @@
1
+ //#region src/definition/import/http-connection.d.ts
2
+ /**
3
+ * What an HTTP task's connection sends in this app: a header holding a secret, its whole value, such as `Bearer ...`;
4
+ * null sends nothing in its place.
5
+ */
6
+ export type ConnectionHeader = {
7
+ header: string;
8
+ secret: string;
9
+ } | null;
10
+ /** The header each connection sends, by the connection's ARN, as the import is given them. */
11
+ export type ConnectionHeaders = Record<string, ConnectionHeader>;
12
+ //#endregion
@@ -0,0 +1,84 @@
1
+ import { expressionSource } from "../expressions.js";
2
+ //#region src/definition/import/http-connection.ts
3
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
+ const secretName = /^[A-Za-z_][A-Za-z0-9_]*$/;
5
+ const literalNames = /* @__PURE__ */ new Set([
6
+ "true",
7
+ "false",
8
+ "null"
9
+ ]);
10
+ const headerName = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
11
+ const asked = (arn) => `names a connection, whose credentials this app does not hold: pass connection_headers { ${JSON.stringify(arn)}: { "header": "Authorization", "secret": "<NAME>" } }, the header its credentials go in and a secret workflows.secrets lists that holds the header's whole value, such as "Bearer ...", or null to send none`;
12
+ /**
13
+ * The ARN of the connection an HTTP task's `Authentication` or `InvocationConfig` names, or the problems that keep it
14
+ * from being read: both or neither given, another field beside `ConnectionArn`, or the ARN as an expression.
15
+ */
16
+ const connectionOf = (args, state) => {
17
+ const given = ["Authentication", "InvocationConfig"].filter((field) => args[field] !== void 0);
18
+ if (given.length === 0) return { problems: [] };
19
+ if (given.length > 1) return { problems: [{
20
+ state,
21
+ field: "Arguments.InvocationConfig",
22
+ message: "is given beside Authentication: an HTTP task names one connection"
23
+ }] };
24
+ const field = given[0];
25
+ const connection = args[field];
26
+ if (!isObject(connection)) return { problems: [{
27
+ state,
28
+ field: `Arguments.${field}`,
29
+ message: "is not { \"ConnectionArn\": \"...\" }"
30
+ }] };
31
+ const problems = Object.keys(connection).filter((key) => key !== "ConnectionArn").map((key) => ({
32
+ state,
33
+ field: `Arguments.${field}.${key}`,
34
+ message: "has no counterpart here: an HTTP task imports with its ConnectionArn alone"
35
+ }));
36
+ const arn = connection.ConnectionArn;
37
+ if (typeof arn !== "string" || expressionSource(arn) !== void 0) problems.push({
38
+ state,
39
+ field: `Arguments.${field}.ConnectionArn`,
40
+ message: "is not an ARN written out, which the import needs to know its header"
41
+ });
42
+ if (problems.length > 0) return { problems };
43
+ return {
44
+ arn,
45
+ field: `Arguments.${field}.ConnectionArn`,
46
+ problems: []
47
+ };
48
+ };
49
+ /** The problem with the header given for a connection, if any. */
50
+ const connectionHeaderProblem = (arn, given, state, field) => {
51
+ if (!Object.hasOwn(given, arn)) return {
52
+ state,
53
+ field,
54
+ message: asked(arn)
55
+ };
56
+ const header = given[arn];
57
+ if (header === null) return;
58
+ if (!isObject(header) || typeof header.header !== "string" || !headerName.test(header.header)) return {
59
+ state,
60
+ field,
61
+ message: `has a connection_headers entry whose header is not a header name: ${asked(arn)}`
62
+ };
63
+ if (typeof header.secret !== "string" || !secretName.test(header.secret) || literalNames.has(header.secret)) return {
64
+ state,
65
+ field,
66
+ message: `has a connection_headers entry whose secret is not a secret's name: ${asked(arn)}`
67
+ };
68
+ };
69
+ /**
70
+ * The request's headers with the connection's header added, taking the place of a header of that name in any case,
71
+ * as a connection's header wins in Step Functions; headers written as an expression are merged when the step runs.
72
+ */
73
+ const withConnectionHeader = (headers, { header, secret }) => {
74
+ const value = `{% $states.context.Secrets.${secret} %}`;
75
+ const source = expressionSource(headers);
76
+ if (source !== void 0) return `{% $merge([{}, $sift((${source}), function($value, $name) { $lowercase($name) != ${JSON.stringify(header.toLowerCase())} }), { ${JSON.stringify(header)}: $states.context.Secrets.${secret} }]) %}`;
77
+ const kept = Object.entries(isObject(headers) ? headers : {}).filter(([name]) => name.toLowerCase() !== header.toLowerCase());
78
+ return {
79
+ ...Object.fromEntries(kept),
80
+ [header]: value
81
+ };
82
+ };
83
+ //#endregion
84
+ export { connectionHeaderProblem, connectionOf, withConnectionHeader };
@@ -0,0 +1,130 @@
1
+ import { fieldPath } from "../problem.js";
2
+ import { expressionSource } from "../expressions.js";
3
+ import { connectionHeaderProblem, connectionOf, withConnectionHeader } from "./http-connection.js";
4
+ import { httpTaskResult, templateWithHttpTaskResult } from "./result-shape.js";
5
+ //#region src/definition/import/http-task.ts
6
+ /** The resource of the Step Functions HTTP task. */
7
+ const httpTaskResource = "arn:aws:states:::http:invoke";
8
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9
+ const argumentNames = {
10
+ ApiEndpoint: "url",
11
+ Method: "method",
12
+ Headers: "headers",
13
+ QueryParameters: "query",
14
+ RequestBody: "body"
15
+ };
16
+ const connectionFields = ["Authentication", "InvocationConfig"];
17
+ const unsentMethods = ["HEAD", "OPTIONS"];
18
+ const unreachedRead = "reads the HTTP task's result as a whole or in a form the import does not rewrite, such as $states . result: read its fields as $states.result.ResponseBody, $states.result.StatusCode, $states.result.StatusText and $states.result.Headers, or the result as $states.result";
19
+ const otherArgument = (key) => key === "Transform" ? "encodes the body as a form, which app:http does not do; send the body as text with a Content-Type header instead" : "is not an argument of the HTTP task this app imports";
20
+ const textRecordProblems = (value, state, field) => {
21
+ if (value === void 0 || expressionSource(value) !== void 0) return [];
22
+ if (!isObject(value)) return [{
23
+ state,
24
+ field,
25
+ message: "is not an object: app:http takes an object of text values"
26
+ }];
27
+ return Object.entries(value).filter(([, item]) => Array.isArray(item) || isObject(item)).map(([name]) => ({
28
+ state,
29
+ field: `${field}.${name}`,
30
+ message: "holds a list or an object: app:http sends one text value per name"
31
+ }));
32
+ };
33
+ const methodProblems = (args, state) => {
34
+ const method = args.Method;
35
+ if (typeof method !== "string" || expressionSource(method) !== void 0) return [];
36
+ const upper = method.toUpperCase();
37
+ if (unsentMethods.includes(upper)) return [{
38
+ state,
39
+ field: "Arguments.Method",
40
+ message: `is ${upper}, which app:http does not send: it sends GET, POST, PUT, PATCH and DELETE`
41
+ }];
42
+ if (upper === "GET" && args.RequestBody !== void 0) return [{
43
+ state,
44
+ field: "Arguments.RequestBody",
45
+ message: "is given with GET, which app:http sends without a body: send it with POST, PUT or PATCH"
46
+ }];
47
+ return [];
48
+ };
49
+ const errorProblem = (name) => {
50
+ if (name.startsWith("States.Http.StatusCode.")) return "is a single status, which app:http does not tell apart: it fails with Http.Status for every status outside 2xx";
51
+ if (name === "States.Http.Socket") return "is the HTTP task's timeout, which app:http does not fail with: it fails with Http.Network when no answer comes, and States.Timeout after the Task's TimeoutSeconds";
52
+ if (name === "States.TaskFailed") return "here matches only an error a step type does not name, never app:http's own: name Http.Status, Http.Network and the others list_workflow_types gives, or States.ALL";
53
+ if (name.startsWith("States.Http.") || name.startsWith("Events.ConnectionResource.")) return "is an error of the HTTP task or its connection, which app:http does not fail with";
54
+ };
55
+ const errorsProblems = (state, where) => ["Retry", "Catch"].flatMap((field) => (Array.isArray(state[field]) ? state[field] : []).flatMap((rule, index) => {
56
+ return (isObject(rule) && Array.isArray(rule.ErrorEquals) ? rule.ErrorEquals : []).flatMap((name, at) => {
57
+ const message = typeof name === "string" ? errorProblem(name) : void 0;
58
+ return message ? [{
59
+ state: where,
60
+ field: `${field}[${index}].ErrorEquals[${at}]`,
61
+ message: `is ${name}, which ${message}`
62
+ }] : [];
63
+ });
64
+ }));
65
+ const httpArguments = (args, header) => {
66
+ const mapped = Object.fromEntries(Object.entries(argumentNames).filter(([from]) => args[from] !== void 0).map(([from, to]) => [to, args[from]]));
67
+ if (args.RequestBody !== void 0) mapped.body_encoding = "json";
68
+ if (header) mapped.headers = withConnectionHeader(mapped.headers, header);
69
+ return mapped;
70
+ };
71
+ /**
72
+ * An HTTP task in JSONata as an app:http step that sends the same request and gives the same result, or the problems
73
+ * that keep it from doing so exactly, each by name: its arguments, method, connection and errors. Its `Output` and
74
+ * `Assign` read the HTTP task's result, `{ StatusCode, StatusText, Headers, ResponseBody }`, and without an `Output` it
75
+ * gives that, so later states read what they read in Step Functions.
76
+ */
77
+ const importHttpTask = (state, where, connections) => {
78
+ const args = state.Arguments;
79
+ if (!isObject(args)) return {
80
+ state,
81
+ problems: [{
82
+ state: where,
83
+ field: "Arguments",
84
+ message: args === void 0 ? "is missing: an HTTP task gives at least its ApiEndpoint and Method" : "is one expression, whose fields the import cannot tell apart: write ApiEndpoint, Method, Headers, QueryParameters and RequestBody each as a field of Arguments"
85
+ }]
86
+ };
87
+ const connection = connectionOf(args, where);
88
+ const problems = [
89
+ ...Object.keys(args).filter((key) => !Object.hasOwn(argumentNames, key) && !connectionFields.includes(key)).map((key) => ({
90
+ state: where,
91
+ field: `Arguments.${key}`,
92
+ message: otherArgument(key)
93
+ })),
94
+ ...methodProblems(args, where),
95
+ ...textRecordProblems(args.Headers, where, "Arguments.Headers"),
96
+ ...textRecordProblems(args.QueryParameters, where, "Arguments.QueryParameters"),
97
+ ...connection.problems,
98
+ ...errorsProblems(state, where)
99
+ ];
100
+ const headerProblem = connection.arn !== void 0 ? connectionHeaderProblem(connection.arn, connections, where, connection.field) : void 0;
101
+ if (headerProblem) problems.push(headerProblem);
102
+ const output = state.Output === void 0 ? {
103
+ value: `{% ${httpTaskResult} %}`,
104
+ unreached: []
105
+ } : templateWithHttpTaskResult(state.Output, ["Output"]);
106
+ const assign = state.Assign === void 0 ? void 0 : templateWithHttpTaskResult(state.Assign, ["Assign"]);
107
+ for (const path of [...output.unreached, ...assign?.unreached ?? []]) problems.push({
108
+ state: where,
109
+ field: fieldPath(path),
110
+ message: unreachedRead
111
+ });
112
+ if (problems.length > 0) return {
113
+ state,
114
+ problems
115
+ };
116
+ const header = connection.arn !== void 0 ? connections[connection.arn] : null;
117
+ const imported = {
118
+ ...state,
119
+ Resource: "app:http",
120
+ Arguments: httpArguments(args, header),
121
+ Output: output.value
122
+ };
123
+ if (assign) imported.Assign = assign.value;
124
+ return {
125
+ state: imported,
126
+ problems: []
127
+ };
128
+ };
129
+ //#endregion
130
+ export { httpTaskResource, importHttpTask };
@@ -0,0 +1,13 @@
1
+ import { Problem } from "../problem.js";
2
+ import { ConnectionHeaders } from "./http-connection.js";
3
+ //#region src/definition/import/import-machine.d.ts
4
+ /**
5
+ * A state machine exported from Step Functions with each of its HTTP tasks, in Maps and Blocks too, as an app:http step
6
+ * (see `importHttpTask`), each connection sending the header `connections` gives for it; every other state as it is.
7
+ * With problems, nothing should be saved: each names the state and field that does not import exactly.
8
+ */
9
+ export declare const importStateMachine: (machine: Record<string, unknown>, connections?: ConnectionHeaders) => {
10
+ stateMachine: Record<string, unknown>;
11
+ problems: Problem[];
12
+ };
13
+ //#endregion
@@ -0,0 +1,58 @@
1
+ import { importHttpTask } from "./http-task.js";
2
+ //#region src/definition/import/import-machine.ts
3
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
+ const innerFields = [
5
+ "ItemProcessor",
6
+ "Iterator",
7
+ "Processor"
8
+ ];
9
+ const importStates = (states, path, connections) => {
10
+ if (!isObject(states)) return {
11
+ states,
12
+ problems: []
13
+ };
14
+ const problems = [];
15
+ return {
16
+ states: Object.fromEntries(Object.entries(states).map(([name, state]) => {
17
+ if (!isObject(state)) return [name, state];
18
+ let next = state;
19
+ if (state.Type === "Task" && state.Resource === "arn:aws:states:::http:invoke" && state.Parameters === void 0) {
20
+ const result = importHttpTask(state, [...path, name].join("/"), connections);
21
+ problems.push(...result.problems);
22
+ next = result.state;
23
+ }
24
+ for (const field of innerFields) {
25
+ const inner = next[field];
26
+ if (!isObject(inner)) continue;
27
+ const result = importStates(inner.States, [...path, name], connections);
28
+ problems.push(...result.problems);
29
+ next = {
30
+ ...next,
31
+ [field]: {
32
+ ...inner,
33
+ States: result.states
34
+ }
35
+ };
36
+ }
37
+ return [name, next];
38
+ })),
39
+ problems
40
+ };
41
+ };
42
+ /**
43
+ * A state machine exported from Step Functions with each of its HTTP tasks, in Maps and Blocks too, as an app:http step
44
+ * (see `importHttpTask`), each connection sending the header `connections` gives for it; every other state as it is.
45
+ * With problems, nothing should be saved: each names the state and field that does not import exactly.
46
+ */
47
+ const importStateMachine = (machine, connections = {}) => {
48
+ const { states, problems } = importStates(machine.States, [], connections);
49
+ return {
50
+ stateMachine: machine.States === void 0 ? machine : {
51
+ ...machine,
52
+ States: states
53
+ },
54
+ problems
55
+ };
56
+ };
57
+ //#endregion
58
+ export { importStateMachine };
@@ -0,0 +1,113 @@
1
+ import { expressionSource, parse } from "../expressions.js";
2
+ import { expressionReads } from "../reads.js";
3
+ //#region src/definition/import/result-shape.ts
4
+ /**
5
+ * The HTTP task's result, `{ StatusCode, StatusText, Headers, ResponseBody }` with each header's values as a list, as
6
+ * JSONata built from app:http's `{ status, status_text, headers, body }`.
7
+ */
8
+ const httpTaskResult = "({ \"StatusCode\": $states.result.status, \"StatusText\": $states.result.status_text, \"Headers\": $merge([{}, $each($states.result.headers, function($value, $name) { { $name: [$value] } })]), \"ResponseBody\": $states.result.body })";
9
+ const readsPerResult = 4;
10
+ const read = "$states.result";
11
+ const nameCharacter = /[\w$]/;
12
+ const operandEnd = /[\w$)\]}"'`]/;
13
+ const closing = (source, start) => {
14
+ const quote = source[start];
15
+ for (let at = start + 1; at < source.length; at++) if (source[at] === "\\") at++;
16
+ else if (source[at] === quote) return at + 1;
17
+ return source.length;
18
+ };
19
+ const lastSignificant = (text) => text.trimEnd().at(-1) ?? "";
20
+ const replaced = (source) => {
21
+ let rewritten = "";
22
+ let count = 0;
23
+ let at = 0;
24
+ while (at < source.length) {
25
+ const character = source[at];
26
+ const regex = character === "/" && source[at + 1] !== "*" && !operandEnd.test(lastSignificant(rewritten));
27
+ if (character === "\"" || character === "'" || character === "`" || regex) {
28
+ const end = closing(source, at);
29
+ rewritten += source.slice(at, end);
30
+ at = end;
31
+ continue;
32
+ }
33
+ if (source.startsWith("/*", at)) {
34
+ const end = source.indexOf("*/", at + 2);
35
+ const stop = end === -1 ? source.length : end + 2;
36
+ rewritten += source.slice(at, stop);
37
+ at = stop;
38
+ continue;
39
+ }
40
+ if (source.startsWith(read, at) && !nameCharacter.test(source[at + 14] ?? "") && !nameCharacter.test(source[at - 1] ?? "")) {
41
+ rewritten += httpTaskResult;
42
+ count++;
43
+ at += 14;
44
+ continue;
45
+ }
46
+ rewritten += character;
47
+ at++;
48
+ }
49
+ return {
50
+ rewritten,
51
+ count
52
+ };
53
+ };
54
+ const resultReads = (source) => {
55
+ const parsed = parse(source);
56
+ if ("error" in parsed) return;
57
+ const states = expressionReads(parsed.expression).states;
58
+ return {
59
+ count: states.filter((path) => path[0] === "result").length,
60
+ whole: states.some((path) => path.length === 0)
61
+ };
62
+ };
63
+ /**
64
+ * The expression with each read of `$states.result` reading the HTTP task's result, so `$states.result.ResponseBody`
65
+ * reads the body and a variable given the whole result keeps the HTTP task's shape; `undefined` when a read is written
66
+ * in a form the rewrite does not reach, such as `$states . result`, which the syntax tree tells. An expression that does
67
+ * not parse is left as it is, for the check to refuse.
68
+ */
69
+ const withHttpTaskResult = (source) => {
70
+ const before = resultReads(source);
71
+ if (!before) return source;
72
+ const { rewritten, count } = replaced(source);
73
+ const after = resultReads(rewritten);
74
+ if (before.whole || before.count !== count || after?.count !== count * readsPerResult) return;
75
+ return rewritten;
76
+ };
77
+ /**
78
+ * A template, such as an `Output` or an `Assign`, with every expression in it reading the HTTP task's result, and the
79
+ * path of each expression whose reads the rewrite does not reach.
80
+ */
81
+ const templateWithHttpTaskResult = (value, path = []) => {
82
+ const source = expressionSource(value);
83
+ if (source !== void 0) {
84
+ const rewritten = withHttpTaskResult(source);
85
+ return rewritten === void 0 ? {
86
+ value,
87
+ unreached: [path]
88
+ } : {
89
+ value: `{%${rewritten}%}`,
90
+ unreached: []
91
+ };
92
+ }
93
+ if (Array.isArray(value)) {
94
+ const items = value.map((item, index) => templateWithHttpTaskResult(item, [...path, index]));
95
+ return {
96
+ value: items.map((item) => item.value),
97
+ unreached: items.flatMap((item) => item.unreached)
98
+ };
99
+ }
100
+ if (typeof value === "object" && value !== null) {
101
+ const entries = Object.entries(value).map(([key, item]) => [key, templateWithHttpTaskResult(item, [...path, key])]);
102
+ return {
103
+ value: Object.fromEntries(entries.map(([key, item]) => [key, item.value])),
104
+ unreached: entries.flatMap(([, item]) => item.unreached)
105
+ };
106
+ }
107
+ return {
108
+ value,
109
+ unreached: []
110
+ };
111
+ };
112
+ //#endregion
113
+ export { httpTaskResult, templateWithHttpTaskResult, withHttpTaskResult };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ import { PinKind, PinType, fits, pinType, pinTypeText } from "./definition/pins/
12
12
  import { definitionWarnings } from "./definition/check-warnings.js";
13
13
  import { allStates, blockDefinition, findBlock, innerMachine } from "./definition/inner.js";
14
14
  import { usedConnections } from "./definition/used-connections.js";
15
+ import { ConnectionHeader, ConnectionHeaders } from "./definition/import/http-connection.js";
16
+ import { importStateMachine } from "./definition/import/import-machine.js";
15
17
  import { taskResource, waitSuffix, waitsForToken } from "./definition/task-resource.js";
16
18
  import { assignedNames } from "./definition/expression-fields.js";
17
19
  import { Dependencies, dependsOn, machineDependencies } from "./definition/dataflow/dependencies.js";
@@ -34,4 +36,4 @@ import { triggerChecks } from "./plugin/trigger-checks.js";
34
36
  import { TypeEntry, Unavailable, typeList } from "./plugin/type-list.js";
35
37
  import { ConnectionSupport, connectionUnavailable } from "./plugin/connection-availability.js";
36
38
  import { CatalogEntry, TypeCatalog, typeCatalog } from "./plugin/type-catalog.js";
37
- export { type AnswerRefusal, type BlockCache, type BlockRun, type BlockRunStore, type BlockShare, type BlockState, type CacheCall, type CacheEntry, type CacheIdentity, type CatalogEntry, type Catcher, type CheckOptions, type Checkpoint, type ChoiceRule, type ChoiceState, type ConnectionSupport, type Definition, type DefinitionParts, type Dependencies, type EarlierCheckpoint, type ErrorOutput, type KeptAnswer, type KeyShape, type LoadedPlugin, type LoadedRun, type Machine, type MapState, type Order, type PinKind, type PinSchemas, type PinType, type Problem, type ReadBase, type RecordSchemas, type RecordUse, type Redactor, type Reference, type ReplayedStep, type RerunFrom, type Retrier, type RunChange, type RunStatus, type RunStore, type Runner, type RunnerPort, type SegmentInput, type SegmentQueue, type State, type StateMachine, type StepCacheStore, StepError, type StepLog, type StepRecord, type StepStatus, type StepWiring, type TaskAnswer, type TaskContext, type TaskHandler, type TaskHandlers, type TaskState, type TaskTokenStore, type TraceMode, type TraceSink, type Trigger, type TriggerCheck, type TypeCatalog, type TypeEntry, type Unavailable, type WaitingTask, allStates, assignedNames, blockDefinition, checkDefinition, connectionUnavailable, createRunner, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, findBlock, fits, heldBackLog, innerMachine, inputSchema, keptAssigned, limits, loadPlugins, machineDependencies, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken };
39
+ export { type AnswerRefusal, type BlockCache, type BlockRun, type BlockRunStore, type BlockShare, type BlockState, type CacheCall, type CacheEntry, type CacheIdentity, type CatalogEntry, type Catcher, type CheckOptions, type Checkpoint, type ChoiceRule, type ChoiceState, type ConnectionHeader, type ConnectionHeaders, type ConnectionSupport, type Definition, type DefinitionParts, type Dependencies, type EarlierCheckpoint, type ErrorOutput, type KeptAnswer, type KeyShape, type LoadedPlugin, type LoadedRun, type Machine, type MapState, type Order, type PinKind, type PinSchemas, type PinType, type Problem, type ReadBase, type RecordSchemas, type RecordUse, type Redactor, type Reference, type ReplayedStep, type RerunFrom, type Retrier, type RunChange, type RunStatus, type RunStore, type Runner, type RunnerPort, type SegmentInput, type SegmentQueue, type State, type StateMachine, type StepCacheStore, StepError, type StepLog, type StepRecord, type StepStatus, type StepWiring, type TaskAnswer, type TaskContext, type TaskHandler, type TaskHandlers, type TaskState, type TaskTokenStore, type TraceMode, type TraceSink, type Trigger, type TriggerCheck, type TypeCatalog, type TypeEntry, type Unavailable, type WaitingTask, allStates, assignedNames, blockDefinition, checkDefinition, connectionUnavailable, createRunner, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, keptAssigned, limits, loadPlugins, machineDependencies, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken };
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { orderOf } from "./definition/types.js";
16
16
  import { checkDefinition } from "./definition/check-definition.js";
17
17
  import { definitionFromParts, partOfProblem, partsOfDefinition } from "./definition/parts.js";
18
18
  import { definitionWarnings } from "./definition/check-warnings.js";
19
+ import { importStateMachine } from "./definition/import/import-machine.js";
19
20
  import { StepError } from "./run/errors.js";
20
21
  import { redacted, secretRedactor, shortestSecret } from "./run/redact.js";
21
22
  import { keptAssigned, rerunCheckpoint, rerunProblem, resultRead } from "./run/rerun.js";
@@ -30,4 +31,4 @@ import { triggerChecks } from "./plugin/trigger-checks.js";
30
31
  import { typeList } from "./plugin/type-list.js";
31
32
  import { connectionUnavailable } from "./plugin/connection-availability.js";
32
33
  import { typeCatalog } from "./plugin/type-catalog.js";
33
- export { StepError, allStates, assignedNames, blockDefinition, checkDefinition, connectionUnavailable, createRunner, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, findBlock, fits, heldBackLog, innerMachine, inputSchema, keptAssigned, limits, loadPlugins, machineDependencies, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken };
34
+ export { StepError, allStates, assignedNames, blockDefinition, checkDefinition, connectionUnavailable, createRunner, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, keptAssigned, limits, loadPlugins, machineDependencies, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/workflows",
3
- "version": "0.100.2",
3
+ "version": "0.100.3",
4
4
  "description": "Workflows as state machines with JSONata expressions: their check, a runner that saves only what a run needs to go on and traces every step, and the plugin interface for trigger and step types.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {