zitejs 0.10.0-start.2 → 0.10.0-start.20

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.
Files changed (171) hide show
  1. package/dist/cjs/auth/index.d.ts +2 -2
  2. package/dist/cjs/auth/index.js +6 -0
  3. package/dist/cjs/auth/index.test.js +30 -0
  4. package/dist/cjs/auth/previewClaim.d.ts +7 -0
  5. package/dist/cjs/auth/previewClaim.js +16 -0
  6. package/dist/cjs/backend/index.d.ts +121 -3
  7. package/dist/cjs/backend/index.test.js +58 -0
  8. package/dist/cjs/bundle/index.d.ts +8 -0
  9. package/dist/cjs/bundle/index.js +9 -8
  10. package/dist/cjs/check/index.d.ts +45 -1
  11. package/dist/cjs/check/index.js +198 -109
  12. package/dist/cjs/check/start/problem.d.ts +11 -0
  13. package/dist/cjs/check/start/problem.js +5 -0
  14. package/dist/cjs/check/start/routeTree.d.ts +9 -0
  15. package/dist/cjs/check/start/routeTree.js +111 -0
  16. package/dist/cjs/check/start/sourceRules.d.ts +8 -0
  17. package/dist/cjs/check/start/sourceRules.js +1110 -0
  18. package/dist/cjs/check/start/tsgo.d.ts +2 -0
  19. package/dist/cjs/check/start/tsgo.js +35 -0
  20. package/dist/cjs/cli.js +1 -1
  21. package/dist/cjs/client/index.d.ts +24 -0
  22. package/dist/cjs/dev/index.js +14 -4
  23. package/dist/cjs/integrations/rules.d.ts +13 -0
  24. package/dist/cjs/integrations/rules.js +29 -0
  25. package/dist/cjs/integrations/rules.test.js +1 -0
  26. package/dist/cjs/internal/appMode.d.ts +3 -0
  27. package/dist/cjs/internal/appMode.js +15 -0
  28. package/dist/cjs/runtime/index.d.ts +13 -13
  29. package/dist/cjs/start/entries.d.ts +10 -4
  30. package/dist/cjs/start/entries.js +23 -6
  31. package/dist/cjs/steps/index.d.ts +78 -0
  32. package/dist/cjs/steps/index.js +507 -0
  33. package/dist/cjs/steps/index.test.d.ts +1 -0
  34. package/dist/cjs/steps/index.test.js +635 -0
  35. package/dist/cjs/sync/index.js +2 -1
  36. package/dist/cjs/sync/lib.d.ts +10 -3
  37. package/dist/cjs/sync/lib.js +35 -21
  38. package/dist/cjs/sync/lib.test.js +106 -36
  39. package/dist/cjs/types/fields.d.ts +8 -1
  40. package/dist/cjs/types/fields.js +7 -1
  41. package/dist/cjs/types/tables.d.ts +16 -0
  42. package/dist/cjs/upload/index.js +12 -2
  43. package/dist/cjs/upload/index.test.js +39 -0
  44. package/dist/cjs/vite/index.js +8 -3
  45. package/dist/cjs/vite/index.test.js +10 -2
  46. package/dist/esm/auth/index.d.ts +2 -2
  47. package/dist/esm/auth/index.js +6 -0
  48. package/dist/esm/auth/index.test.js +30 -0
  49. package/dist/esm/auth/previewClaim.d.ts +7 -0
  50. package/dist/esm/auth/previewClaim.js +12 -0
  51. package/dist/esm/backend/index.d.ts +121 -3
  52. package/dist/esm/backend/index.test.js +58 -0
  53. package/dist/esm/bundle/index.d.ts +8 -0
  54. package/dist/esm/bundle/index.js +8 -8
  55. package/dist/esm/check/index.d.ts +45 -1
  56. package/dist/esm/check/index.js +198 -113
  57. package/dist/esm/check/start/problem.d.ts +11 -0
  58. package/dist/esm/check/start/problem.js +1 -0
  59. package/dist/esm/check/start/routeTree.d.ts +9 -0
  60. package/dist/esm/check/start/routeTree.js +70 -0
  61. package/dist/esm/check/start/sourceRules.d.ts +8 -0
  62. package/dist/esm/check/start/sourceRules.js +1107 -0
  63. package/dist/esm/check/start/tsgo.d.ts +2 -0
  64. package/dist/esm/check/start/tsgo.js +29 -0
  65. package/dist/esm/cli.js +1 -1
  66. package/dist/esm/client/index.d.ts +24 -0
  67. package/dist/esm/dev/index.js +16 -6
  68. package/dist/esm/integrations/rules.d.ts +13 -0
  69. package/dist/esm/integrations/rules.js +29 -0
  70. package/dist/esm/integrations/rules.test.js +1 -0
  71. package/dist/esm/internal/appMode.d.ts +3 -0
  72. package/dist/esm/internal/appMode.js +10 -0
  73. package/dist/esm/runtime/index.d.ts +13 -13
  74. package/dist/esm/start/aiUsage.d.ts +23 -0
  75. package/dist/esm/start/aiUsage.js +146 -0
  76. package/dist/esm/start/airtable/arrayFields.d.ts +10 -0
  77. package/dist/esm/start/airtable/arrayFields.js +30 -0
  78. package/dist/esm/start/airtable/dispatch.d.ts +54 -0
  79. package/dist/esm/start/airtable/dispatch.js +483 -0
  80. package/dist/esm/start/airtable/formulas.d.ts +70 -0
  81. package/dist/esm/start/airtable/formulas.js +258 -0
  82. package/dist/esm/start/airtable/index.d.ts +8 -0
  83. package/dist/esm/start/airtable/index.js +54 -0
  84. package/dist/esm/start/authHooks.d.ts +7 -0
  85. package/dist/esm/start/authHooks.js +10 -0
  86. package/dist/esm/start/authHooksModule.d.ts +1 -0
  87. package/dist/esm/start/authHooksModule.js +3 -0
  88. package/dist/esm/start/clientErrorMessage.test.d.ts +1 -0
  89. package/dist/esm/start/clientErrorMessage.test.js +105 -0
  90. package/dist/esm/start/credentials.d.ts +2 -0
  91. package/dist/esm/start/credentials.js +2 -0
  92. package/dist/esm/start/data/baseRunner.d.ts +92 -0
  93. package/dist/esm/start/data/baseRunner.js +83 -0
  94. package/dist/esm/start/data/dispatch.d.ts +16 -0
  95. package/dist/esm/start/data/dispatch.js +198 -0
  96. package/dist/esm/start/data/index.d.ts +15 -0
  97. package/dist/esm/start/data/index.js +58 -0
  98. package/dist/esm/start/data/sqlNameMappings.d.ts +58 -0
  99. package/dist/esm/start/data/sqlNameMappings.js +92 -0
  100. package/dist/esm/start/data/transformations.d.ts +97 -0
  101. package/dist/esm/start/data/transformations.js +262 -0
  102. package/dist/esm/start/data/types.d.ts +91 -0
  103. package/dist/esm/start/data/types.js +14 -0
  104. package/dist/esm/start/describe.d.ts +35 -5
  105. package/dist/esm/start/describe.js +74 -22
  106. package/dist/esm/start/entries.d.ts +10 -4
  107. package/dist/esm/start/entries.js +21 -5
  108. package/dist/esm/start/errors.d.ts +63 -0
  109. package/dist/esm/start/errors.js +146 -0
  110. package/dist/esm/start/errors.test.d.ts +1 -0
  111. package/dist/esm/start/errors.test.js +23 -0
  112. package/dist/esm/start/factories.test-d.d.ts +1 -0
  113. package/dist/esm/start/factories.test-d.js +20 -0
  114. package/dist/esm/start/index.d.ts +32 -27
  115. package/dist/esm/start/index.js +77 -47
  116. package/dist/esm/start/instance.d.ts +4 -4
  117. package/dist/esm/start/instance.js +54 -11
  118. package/dist/esm/start/outbound.d.ts +11 -0
  119. package/dist/esm/start/outbound.js +398 -0
  120. package/dist/esm/start/previewClaim.d.ts +7 -0
  121. package/dist/esm/start/previewClaim.js +23 -0
  122. package/dist/esm/start/problems.js +1 -1
  123. package/dist/esm/start/quiet.d.ts +2 -0
  124. package/dist/esm/start/quiet.js +27 -0
  125. package/dist/esm/start/redactSecrets.d.ts +15 -0
  126. package/dist/esm/start/redactSecrets.js +154 -0
  127. package/dist/esm/start/redactSecrets.test.d.ts +1 -0
  128. package/dist/esm/start/redactSecrets.test.js +151 -0
  129. package/dist/esm/start/registration.d.ts +13 -0
  130. package/dist/esm/start/registration.js +21 -0
  131. package/dist/esm/start/registrationHash.d.ts +22 -0
  132. package/dist/esm/start/registrationHash.js +470 -0
  133. package/dist/esm/start/router.d.ts +18 -4
  134. package/dist/esm/start/router.js +134 -11
  135. package/dist/esm/start/runLog.d.ts +7 -4
  136. package/dist/esm/start/runLog.js +64 -6
  137. package/dist/esm/start/scope.d.ts +2 -2
  138. package/dist/esm/start/server.d.ts +40 -36
  139. package/dist/esm/start/server.js +320 -48
  140. package/dist/esm/start/steps.d.ts +28 -0
  141. package/dist/esm/start/steps.js +97 -0
  142. package/dist/esm/start/types.d.ts +178 -5
  143. package/dist/esm/start/version.d.ts +1 -0
  144. package/dist/esm/start/version.js +2 -0
  145. package/dist/esm/start/vite.js +88 -11
  146. package/dist/esm/start/worker.d.ts +6 -0
  147. package/dist/esm/start/worker.js +12 -0
  148. package/dist/esm/start/workflow.d.ts +42 -12
  149. package/dist/esm/start/workflow.js +3 -3
  150. package/dist/esm/start/workflow.test-d.js +41 -8
  151. package/dist/esm/start/workflowModules.js +1 -1
  152. package/dist/esm/start/workflowRun.d.ts +21 -8
  153. package/dist/esm/start/workflowRun.js +29 -8
  154. package/dist/esm/steps/index.d.ts +78 -0
  155. package/dist/esm/steps/index.js +502 -0
  156. package/dist/esm/steps/index.test.d.ts +1 -0
  157. package/dist/esm/steps/index.test.js +633 -0
  158. package/dist/esm/sync/index.js +2 -1
  159. package/dist/esm/sync/lib.d.ts +10 -3
  160. package/dist/esm/sync/lib.js +35 -21
  161. package/dist/esm/sync/lib.test.js +106 -36
  162. package/dist/esm/types/fields.d.ts +8 -1
  163. package/dist/esm/types/fields.js +6 -0
  164. package/dist/esm/types/tables.d.ts +16 -0
  165. package/dist/esm/upload/index.js +12 -2
  166. package/dist/esm/upload/index.test.js +39 -0
  167. package/dist/esm/vite/index.js +8 -3
  168. package/dist/esm/vite/index.test.js +10 -2
  169. package/package.json +37 -16
  170. package/dist/cjs/start/problems.d.ts +0 -19
  171. package/dist/cjs/start/problems.js +0 -11
@@ -1,24 +1,57 @@
1
1
  import { describe, expectTypeOf, it } from "vitest";
2
- import { createWorkflow } from "./workflow.js";
3
- describe("createWorkflow handler args", () => {
2
+ import { createAutomation } from "./workflow.js";
3
+ describe("createAutomation handler args", () => {
4
4
  it("gives a schedule no trigger", () => {
5
- createWorkflow({ schedule: { scheduleType: "oneTime", fireAt: "2026-10-10T03:00:00Z", timezone: "UTC" } }).handler((args) => {
5
+ createAutomation({ schedule: { scheduleType: "oneTime", fireAt: "2026-10-10T03:00:00Z", timezone: "UTC" } }).handler((args) => {
6
6
  expectTypeOf(args).toEqualTypeOf();
7
7
  });
8
8
  });
9
9
  it("types the trigger by the kind it declares", () => {
10
- createWorkflow({ trigger: { every: "5m" } }).handler(({ trigger }) => {
10
+ createAutomation({ trigger: { every: "5m" } }).handler(({ trigger }) => {
11
11
  expectTypeOf(trigger).toEqualTypeOf();
12
12
  });
13
- createWorkflow({ trigger: { integration: "slack", events: ["message.channels"] } }).handler(({ trigger }) => {
13
+ createAutomation({ trigger: { integration: "slack", events: ["message.channels"] } }).handler(({ trigger }) => {
14
14
  expectTypeOf(trigger).toEqualTypeOf();
15
15
  });
16
- createWorkflow({ trigger: { integration: "asana" } }).handler(({ trigger }) => {
16
+ createAutomation({
17
+ trigger: { integration: "asana", subscribe: async () => ({ externalId: "w1" }), unsubscribe: async () => { } },
18
+ }).handler(({ trigger }) => {
17
19
  expectTypeOf(trigger).toEqualTypeOf();
18
20
  });
19
21
  });
22
+ it("registers a provider trigger with subscribe", () => {
23
+ // @ts-expect-error nothing would register it with the provider
24
+ createAutomation({ trigger: { integration: "asana" } });
25
+ createAutomation({
26
+ trigger: {
27
+ integration: "github",
28
+ subscribe: (input) => {
29
+ expectTypeOf(input.notificationUrl).toEqualTypeOf();
30
+ return { externalId: "1", secret: input.secret };
31
+ },
32
+ },
33
+ });
34
+ });
35
+ it("takes no database or form trigger yet, with or without subscribe", () => {
36
+ const subscribe = async () => ({ externalId: "w1" });
37
+ // @ts-expect-error a Start automation can't take a database trigger yet
38
+ createAutomation({ trigger: { table: "orders", on: ["created"], subscribe } });
39
+ // @ts-expect-error nor a form trigger
40
+ createAutomation({ trigger: { form: "Intake", on: ["submitted"], subscribe } });
41
+ });
42
+ it("needs neither when only schedules added at runtime run it", () => {
43
+ createAutomation({ description: "Sends one reminder" }).handler((args) => {
44
+ expectTypeOf(args).toEqualTypeOf();
45
+ });
46
+ });
47
+ it("gives every workflow step.run, typed by what its function returns", () => {
48
+ createAutomation({ trigger: { every: "5m" } }).handler(async ({ step }) => {
49
+ expectTypeOf(await step.run("load", async () => ({ id: 7 }))).toEqualTypeOf();
50
+ expectTypeOf(await step.run("count", () => 3)).toEqualTypeOf();
51
+ });
52
+ });
20
53
  it("takes a schedule or a trigger, not both", () => {
21
- // @ts-expect-error a workflow runs on one or the other
22
- createWorkflow({ schedule: { scheduleType: "oneTime", fireAt: "x", timezone: "UTC" }, trigger: { every: "5m" } });
54
+ // @ts-expect-error an automation runs on one or the other
55
+ createAutomation({ schedule: { scheduleType: "oneTime", fireAt: "x", timezone: "UTC" }, trigger: { every: "5m" } });
23
56
  });
24
57
  });
@@ -1,3 +1,3 @@
1
1
  // Replaced at build by zite() with a lazy import of every app module that
2
- // mentions createWorkflow. Empty wherever the plugin didn't build the app.
2
+ // mentions createAutomation. Empty wherever the plugin didn't build the app.
3
3
  export const workflowModules = {};
@@ -1,20 +1,26 @@
1
- import { type Workflow } from "./workflow.js";
1
+ import { type StepLog } from "./steps.js";
2
+ import { type Automation } from "./workflow.js";
2
3
  export type TriggerReport = {
3
4
  handled: string[];
4
5
  cursor?: string;
5
6
  };
6
- export type WorkflowRunResult = {
7
+ type StepsRan = {
8
+ steps?: StepLog[];
9
+ };
10
+ export type WorkflowRunResult = ({
7
11
  ok: true;
8
12
  output: unknown;
9
13
  trigger?: TriggerReport;
10
- } | {
14
+ } & StepsRan) | ({
11
15
  ok: false;
12
16
  error: {
13
17
  code: string;
14
18
  message: string;
15
19
  };
16
20
  trigger?: TriggerReport;
17
- };
21
+ failedStep?: string;
22
+ } & StepsRan);
23
+ type SdkCall = (integrationId: string, className: string, methodName: string, params: unknown) => Promise<unknown>;
18
24
  /**
19
25
  * Splits the platform's state out of the input. A poll or a provider delivery
20
26
  * with a cursor gets `seen`, `handled` and `advance`. Handled ids are reported
@@ -22,7 +28,7 @@ export type WorkflowRunResult = {
22
28
  * the staged cursor only on success. Only ids the incoming `seen` lacked are
23
29
  * reported: billing reads an empty list as a run that found nothing new.
24
30
  */
25
- export declare function triggerContext(workflow: Workflow, rawInput: unknown): {
31
+ export declare function triggerContext(workflow: Automation, rawInput: unknown): {
26
32
  input: unknown;
27
33
  trigger?: undefined;
28
34
  report?: undefined;
@@ -67,14 +73,21 @@ export declare function triggerContext(workflow: Workflow, rawInput: unknown): {
67
73
  };
68
74
  report: (succeeded: boolean) => TriggerReport;
69
75
  };
70
- /** Runs the handler in a workflow access scope: no user, and data calls allowed. */
71
- export declare function runWorkflow(workflow: Workflow, rawInput: unknown): Promise<WorkflowRunResult>;
76
+ /**
77
+ * Runs the handler in a workflow access scope: no user, and data calls allowed.
78
+ * A resumed run replays the steps its first attempt saved.
79
+ */
80
+ export declare function runWorkflow(workflow: Automation, rawInput: unknown, { resuming, call }?: {
81
+ resuming?: boolean;
82
+ call?: SdkCall;
83
+ }): Promise<WorkflowRunResult>;
72
84
  export type LoadedWorkflow = {
73
85
  id: string;
74
86
  file: string;
75
- workflow: Workflow;
87
+ workflow: Automation;
76
88
  };
77
89
  /** Every exported workflow in the app, by export name. */
78
90
  export declare function loadWorkflows(modules?: Record<string, () => Promise<Record<string, unknown>>>): Promise<LoadedWorkflow[]>;
79
91
  /** The input as the run log keeps it: a trigger's `seen` list can hold thousands of ids. */
80
92
  export declare const loggedInput: (rawInput: unknown) => unknown;
93
+ export {};
@@ -3,8 +3,15 @@
3
3
  // runner's schedules, polls and provider deliveries work unchanged.
4
4
  import { errorOf } from "./runLog.js";
5
5
  import { runInScope } from "./scope.js";
6
- import { isWorkflow } from "./workflow.js";
6
+ import { createSteps } from "./steps.js";
7
+ import { isAutomation } from "./workflow.js";
7
8
  import { workflowModules } from "./workflowModules.js";
9
+ const platformCall = (...args) => {
10
+ const call = globalThis.__wrapSdkCall;
11
+ if (!call)
12
+ throw new Error("The Zite platform binding is missing");
13
+ return call(...args);
14
+ };
8
15
  const asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
9
16
  const idOf = (id) => {
10
17
  if (typeof id !== "string" && typeof id !== "number")
@@ -23,7 +30,8 @@ const idOf = (id) => {
23
30
  */
24
31
  export function triggerContext(workflow, rawInput) {
25
32
  const raw = asRecord(rawInput);
26
- const { __cron, __poll, __webhook, ...input } = raw ?? {};
33
+ // `__cron` stays in the input, as on classic: scheduled code reads its scheduleId and scheduledAt there.
34
+ const { __poll, __webhook, ...input } = raw ?? {};
27
35
  const declared = workflow.config.trigger;
28
36
  if (!declared)
29
37
  return { input: raw ? input : rawInput };
@@ -70,16 +78,29 @@ export function triggerContext(workflow, rawInput) {
70
78
  });
71
79
  return { input, trigger, report };
72
80
  }
73
- /** Runs the handler in a workflow access scope: no user, and data calls allowed. */
74
- export async function runWorkflow(workflow, rawInput) {
81
+ /**
82
+ * Runs the handler in a workflow access scope: no user, and data calls allowed.
83
+ * A resumed run replays the steps its first attempt saved.
84
+ */
85
+ export async function runWorkflow(workflow, rawInput, { resuming = false, call = platformCall } = {}) {
75
86
  const { input, trigger, report } = triggerContext(workflow, rawInput);
76
- const args = { input, ...(trigger ? { trigger } : {}) };
87
+ const steps = createSteps({ call, resuming });
88
+ const args = { input, step: steps.step, ...(trigger ? { trigger } : {}) };
89
+ const ran = () => (steps.log.length > 0 ? { steps: steps.log } : {});
77
90
  try {
78
91
  const output = await runInScope({ kind: "workflow", user: null }, () => workflow.handler(args));
79
- return { ok: true, output, ...(report ? { trigger: report(true) } : {}) };
92
+ return { ok: true, output, ...(report ? { trigger: report(true) } : {}), ...ran() };
80
93
  }
81
94
  catch (error) {
82
- return { ok: false, error: errorOf(error), ...(report ? { trigger: report(false) } : {}) };
95
+ await steps.settle();
96
+ const failedStep = steps.failedStep();
97
+ return {
98
+ ok: false,
99
+ error: errorOf(error),
100
+ ...(report ? { trigger: report(false) } : {}),
101
+ ...(failedStep !== undefined ? { failedStep } : {}),
102
+ ...ran(),
103
+ };
83
104
  }
84
105
  }
85
106
  /** Every exported workflow in the app, by export name. */
@@ -87,7 +108,7 @@ export async function loadWorkflows(modules = workflowModules) {
87
108
  const found = [];
88
109
  for (const [file, load] of Object.entries(modules)) {
89
110
  for (const [id, value] of Object.entries(await load()))
90
- if (isWorkflow(value))
111
+ if (isAutomation(value))
91
112
  found.push({ id, file, workflow: value });
92
113
  }
93
114
  return found;
@@ -0,0 +1,78 @@
1
+ import type { ZiteStep } from "../backend/index.js";
2
+ export declare const STEP_FAILURE_MEMO_KEY = "__ziteStepError";
3
+ export declare const STEP_FAILED_STEP_KEY = "__ziteFailedStep";
4
+ export declare const STEP_RESULT_MAX_BYTES: number;
5
+ export declare const STEP_SLEEP_MAX_MS: number;
6
+ export declare const STEP_DEFAULT_RETRIES = 3;
7
+ export declare const STEP_MAX_RETRIES = 10;
8
+ /** Why a durable call stops short. A retry outranks the other two. */
9
+ export type StepStop = {
10
+ kind: "retry";
11
+ name: string;
12
+ attempt: number;
13
+ error: unknown;
14
+ } | {
15
+ kind: "sleep";
16
+ name: string;
17
+ wakeAt: string;
18
+ } | {
19
+ kind: "step";
20
+ name: string;
21
+ };
22
+ /** A stop that isn't a failure: the run goes on at a wake time, or at once. */
23
+ export type StepSuspension = {
24
+ kind: "sleep";
25
+ name: string;
26
+ wakeAt: string;
27
+ } | {
28
+ kind: "step";
29
+ name: string;
30
+ };
31
+ /** A stop to try a step again: each failed step's next try, in the next call. */
32
+ export type StepRetry = {
33
+ step: string;
34
+ attempt: number;
35
+ attempts: Record<string, number>;
36
+ };
37
+ export type StepEventStatus = "ran" | "memoized" | "failed" | "sleeping" | "skipped";
38
+ export type StepRuntimeOptions = {
39
+ /** The run's saved steps by name, from earlier calls; filled in as steps save. */
40
+ memos: Record<string, unknown>;
41
+ /** A durable call may stop at a step for its orchestrator to call it again. */
42
+ durable: boolean;
43
+ /** Outside a durable call, what a sleep does: an editor test skips it, an app's request refuses it. */
44
+ sleeps?: "skip" | "refuse";
45
+ /** In a durable call, how long it starts new steps for. */
46
+ budgetMs?: number;
47
+ /**
48
+ * How long after the call starts `settle` waits for steps still working.
49
+ * A step past it runs again in the next call. Four minutes by default, so
50
+ * the call answers inside a five-minute request timeout.
51
+ */
52
+ deadlineMs?: number;
53
+ /** Which try each step that failed in an earlier call is on; others are on their first. */
54
+ attempts?: Record<string, number>;
55
+ /** Saves a step's result, or its final failure. Throws when it can't. */
56
+ save: (name: string, value: unknown, durationMs: number) => Promise<unknown>;
57
+ onEvent?: (name: string, status: StepEventStatus, durationMs?: number, extra?: Record<string, unknown>) => void;
58
+ /** Marks a failed save as the platform's failure rather than the app's. */
59
+ onPlatformFault?: (error: Error) => void;
60
+ now?: () => number;
61
+ };
62
+ export type StepRuntime = {
63
+ step: ZiteStep;
64
+ /** Resolves at the call's first stop. */
65
+ stopped: Promise<void>;
66
+ stop(): StepStop | undefined;
67
+ suspension(): StepSuspension | undefined;
68
+ retry(): StepRetry | undefined;
69
+ /** How many steps this call saved, sleeps included. */
70
+ saved(): number;
71
+ /**
72
+ * Waits for steps still doing work to save, including ones they start, but
73
+ * not for one stuck behind a stop, nor past the deadline.
74
+ */
75
+ settle(): Promise<void>;
76
+ };
77
+ export declare const isStepFailureMemo: (memo: unknown) => boolean;
78
+ export declare function createStepRuntime(options: StepRuntimeOptions): StepRuntime;