@protobase/workflows 0.100.20 → 0.100.21

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/index.d.ts CHANGED
@@ -40,5 +40,5 @@ import { KnownRunner, MatchSettings, Placement, PollingRunner, QueuedJob, Runner
40
40
  import { CompletedVersion, JobCompletion, jobAnswer, jobErrors } from "./runners/job-answer.js";
41
41
  import { BuildReport, JobBuild, JobFile, RunnerJob, RunnerOrder, buildKind, buildStatuses, fileInputName, fileProperties } from "./runners/job-contract.js";
42
42
  import { customPlugin, customStepOf } from "./plugin/custom-step-id.js";
43
- import { CustomStepManifest, CustomStepVersion, ManifestProblem, customStepEntry, latestCustomSteps, manifestProblems, withCustomSteps } from "./plugin/custom-steps.js";
44
- export { type AnswerRefusal, type BlockCache, type BlockRun, type BlockRunStore, type BlockShare, type BlockState, type BuildReport, type CacheCall, type CacheEntry, type CacheIdentity, type CatalogEntry, type Catcher, type CheckOptions, type Checkpoint, type ChoiceRule, type ChoiceState, type CompletedVersion, type ConnectionHeader, type ConnectionHeaders, type ConnectionSupport, type CustomStepJob, type CustomStepJobs, type CustomStepManifest, type CustomStepVersion, type Definition, type DefinitionParts, type Dependencies, type EarlierCheckpoint, type ErrorOutput, type JobBuild, type JobCompletion, type JobFile, type KeptAnswer, type KeyShape, type KnownRunner, type LoadedPlugin, type LoadedRun, type Machine, type ManifestProblem, type MapState, type MatchSettings, type Order, type PinKind, type PinSchemas, type PinType, type Placement, type PollingRunner, type Problem, type QueuedJob, 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 RunnerJob, type RunnerOrder, type RunnerPort, type RunnerState, 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 Tier, type TraceMode, type TraceSink, type Trigger, type TriggerCheck, type TypeCatalog, type TypeEntry, type Unavailable, type WaitingTask, allStates, assignedNames, blockDefinition, buildKind, buildStatuses, checkDefinition, connectionUnavailable, createRunner, customPlugin, customStepEntry, customStepOf, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, fileInputName, fileProperties, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, jobAnswer, jobErrors, jobKind, keptAssigned, latestCustomSteps, limits, loadPlugins, machineDependencies, manifestProblems, matchJobs, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resources, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tierOf, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken, withCustomSteps };
43
+ import { CustomStepBuildStatus, CustomStepManifest, CustomStepVersion, ManifestProblem, customStepEntry, customStepTestDefinition, customStepTestState, latestCustomSteps, manifestProblems, withCustomSteps } from "./plugin/custom-steps.js";
44
+ export { type AnswerRefusal, type BlockCache, type BlockRun, type BlockRunStore, type BlockShare, type BlockState, type BuildReport, type CacheCall, type CacheEntry, type CacheIdentity, type CatalogEntry, type Catcher, type CheckOptions, type Checkpoint, type ChoiceRule, type ChoiceState, type CompletedVersion, type ConnectionHeader, type ConnectionHeaders, type ConnectionSupport, type CustomStepBuildStatus, type CustomStepJob, type CustomStepJobs, type CustomStepManifest, type CustomStepVersion, type Definition, type DefinitionParts, type Dependencies, type EarlierCheckpoint, type ErrorOutput, type JobBuild, type JobCompletion, type JobFile, type KeptAnswer, type KeyShape, type KnownRunner, type LoadedPlugin, type LoadedRun, type Machine, type ManifestProblem, type MapState, type MatchSettings, type Order, type PinKind, type PinSchemas, type PinType, type Placement, type PollingRunner, type Problem, type QueuedJob, 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 RunnerJob, type RunnerOrder, type RunnerPort, type RunnerState, 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 Tier, type TraceMode, type TraceSink, type Trigger, type TriggerCheck, type TypeCatalog, type TypeEntry, type Unavailable, type WaitingTask, allStates, assignedNames, blockDefinition, buildKind, buildStatuses, checkDefinition, connectionUnavailable, createRunner, customPlugin, customStepEntry, customStepOf, customStepTestDefinition, customStepTestState, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, fileInputName, fileProperties, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, jobAnswer, jobErrors, jobKind, keptAssigned, latestCustomSteps, limits, loadPlugins, machineDependencies, manifestProblems, matchJobs, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resources, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tierOf, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken, withCustomSteps };
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { rerunFrom } from "./run/rerun-from.js";
27
27
  import { runSegment } from "./run/segment.js";
28
28
  import { createRunner } from "./run/runner.js";
29
29
  import { buildKind, buildStatuses, fileInputName, fileProperties } from "./runners/job-contract.js";
30
- import { customStepEntry, latestCustomSteps, manifestProblems, withCustomSteps } from "./plugin/custom-steps.js";
30
+ import { customStepEntry, customStepTestDefinition, customStepTestState, latestCustomSteps, manifestProblems, withCustomSteps } from "./plugin/custom-steps.js";
31
31
  import { loadPlugins } from "./plugin/load-plugins.js";
32
32
  import { stepHandlers } from "./plugin/step-handlers.js";
33
33
  import { triggerChecks } from "./plugin/trigger-checks.js";
@@ -36,4 +36,4 @@ import { connectionUnavailable } from "./plugin/connection-availability.js";
36
36
  import { typeCatalog } from "./plugin/type-catalog.js";
37
37
  import { jobKind, matchJobs, tierOf } from "./runners/match-jobs.js";
38
38
  import { jobAnswer, jobErrors } from "./runners/job-answer.js";
39
- export { StepError, allStates, assignedNames, blockDefinition, buildKind, buildStatuses, checkDefinition, connectionUnavailable, createRunner, customPlugin, customStepEntry, customStepOf, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, fileInputName, fileProperties, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, jobAnswer, jobErrors, jobKind, keptAssigned, latestCustomSteps, limits, loadPlugins, machineDependencies, manifestProblems, matchJobs, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resources, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tierOf, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken, withCustomSteps };
39
+ export { StepError, allStates, assignedNames, blockDefinition, buildKind, buildStatuses, checkDefinition, connectionUnavailable, createRunner, customPlugin, customStepEntry, customStepOf, customStepTestDefinition, customStepTestState, dataflowDefinitionSchema, definitionFromParts, definitionSchema, definitionWarnings, dependsOn, expressionReferences, expressionSource, fileInputName, fileProperties, findBlock, fits, heldBackLog, importStateMachine, innerMachine, inputSchema, jobAnswer, jobErrors, jobKind, keptAssigned, latestCustomSteps, limits, loadPlugins, machineDependencies, manifestProblems, matchJobs, nestingDepth, orderOf, parseReference, partOfProblem, partsOfDefinition, pinType, pinTypeText, problemText, readText, redacted, referenceSchema, referenceValue, rerunCheckpoint, rerunFrom, rerunProblem, resolveSchema, resources, resultRead, resultSchema, resultState, runSegment, schemaAt, secretRedactor, shortestSecret, stepHandlers, stepStatusSchema, taskResource, taskTokenHash, tierOf, tokenPattern, triggerChecks, triggerSchema, typeCatalog, typeList, usedConnections, waitSuffix, waitsForToken, withCustomSteps };
@@ -1,3 +1,4 @@
1
+ import { Definition } from "../definition/types.js";
1
2
  import { CheckOptions } from "../definition/check-definition.js";
2
3
  import { JsonSchema } from "./context.js";
3
4
  import { TypeEntry } from "./type-list.js";
@@ -13,7 +14,11 @@ export type CustomStepVersion = {
13
14
  output: JsonSchema;
14
15
  error_prefix: string;
15
16
  errors: Record<string, string>;
17
+ /** How its image's builds on the app's runners stand, when one began: `ready` once any runner built it. */
18
+ build?: CustomStepBuildStatus | null;
16
19
  };
20
+ /** How a custom step version's image stands on the app's runners: built by one, building on one, or failed on each that tried. */
21
+ export type CustomStepBuildStatus = 'ready' | 'building' | 'failed';
17
22
  /** A custom step's manifest as a create or an update writes it. */
18
23
  export type CustomStepManifest = Partial<Omit<CustomStepVersion, 'version'>> & {
19
24
  container?: unknown;
@@ -33,6 +38,13 @@ export declare const manifestProblems: (manifest: CustomStepManifest) => Manifes
33
38
  * it requires when its output gives a stored file, its output, and its errors as `<error_prefix>.<Name>`.
34
39
  */
35
40
  export declare const customStepEntry: (step: CustomStepVersion) => TypeEntry;
41
+ /** The state a custom step's test run runs its step in. */
42
+ export declare const customStepTestState = "Test";
43
+ /**
44
+ * What a custom step's test run runs, with no workflow: the version `step` names, such as `custom:ocr:2`, alone, as
45
+ * one Task whose arguments are the run's input, with a step type's timeout.
46
+ */
47
+ export declare const customStepTestDefinition: (step: string) => Definition;
36
48
  /** The latest version of each custom step among `ids`, by the step's unversioned id, `custom:<name>`. */
37
49
  export declare const latestCustomSteps: (ids: readonly string[]) => Record<string, string>;
38
50
  /**
@@ -204,9 +204,30 @@ const customStepEntry = (step) => {
204
204
  output: step.output,
205
205
  ...errors.length > 0 && { errors: Object.fromEntries(errors.map(([name, text]) => [`${step.error_prefix}.${name}`, text])) },
206
206
  writes: true,
207
- available: true
207
+ available: true,
208
+ ...step.build && { build: step.build }
208
209
  };
209
210
  };
211
+ /** The state a custom step's test run runs its step in. */
212
+ const customStepTestState = "Test";
213
+ /**
214
+ * What a custom step's test run runs, with no workflow: the version `step` names, such as `custom:ocr:2`, alone, as
215
+ * one Task whose arguments are the run's input, with a step type's timeout.
216
+ */
217
+ const customStepTestDefinition = (step) => ({
218
+ trigger: { manual: {} },
219
+ order: "sequence",
220
+ stateMachine: {
221
+ QueryLanguage: "JSONata",
222
+ StartAt: customStepTestState,
223
+ States: { [customStepTestState]: {
224
+ Type: "Task",
225
+ Resource: step,
226
+ Arguments: "{% $states.context.Execution.Input %}",
227
+ End: true
228
+ } }
229
+ }
230
+ });
210
231
  const requiredInputs = (input) => Array.isArray(input.required) ? input.required : [];
211
232
  /** The latest version of each custom step among `ids`, by the step's unversioned id, `custom:<name>`. */
212
233
  const latestCustomSteps = (ids) => {
@@ -255,4 +276,4 @@ const withCustomSteps = (custom) => ({
255
276
  }
256
277
  });
257
278
  //#endregion
258
- export { customPlugin, customStepEntry, customStepOf, latestCustomSteps, manifestProblems, withCustomSteps };
279
+ export { customPlugin, customStepEntry, customStepOf, customStepTestDefinition, customStepTestState, latestCustomSteps, manifestProblems, withCustomSteps };
@@ -27,6 +27,8 @@ export type TypeEntry = {
27
27
  /** False when this app cannot run it, with the reason; a definition that uses it is not saved. */
28
28
  available: boolean;
29
29
  reason?: string;
30
+ /** A custom step version's image on the app's runners: `ready` once one built it, `building`, or `failed` on each that tried; none before a build began. */
31
+ build?: 'ready' | 'building' | 'failed';
30
32
  };
31
33
  /** Why the app cannot run a type, or undefined when it can. */
32
34
  export type Unavailable = (type: Omit<TypeEntry, 'available'>) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/workflows",
3
- "version": "0.100.20",
3
+ "version": "0.100.21",
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": {