@frontera-sdk/workflow 1.52.39 → 1.52.40

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/definition.ts +30 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontera-sdk/workflow",
3
- "version": "1.52.39",
3
+ "version": "1.52.40",
4
4
  "description": "Typed headless client for starting, inspecting, waiting on and cancelling Frontera workflow runs from a script or backend.",
5
5
  "keywords": [
6
6
  "frontera",
@@ -38,8 +38,8 @@
38
38
  "typecheck": "bunx tsc --noEmit"
39
39
  },
40
40
  "dependencies": {
41
- "@frontera-sdk/core": "1.52.39",
42
- "@frontera-sdk/functions": "1.52.39"
41
+ "@frontera-sdk/core": "1.52.40",
42
+ "@frontera-sdk/functions": "1.52.40"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/bun": "^1.3.14",
package/src/definition.ts CHANGED
@@ -278,6 +278,12 @@ export interface DecideParams {
278
278
  /** Question id to question; each id is a key of the result's `answers`. */
279
279
  questions: Record<string, DecideQuestion>
280
280
  }
281
+ export interface ActionSubjectParams {
282
+ /** The record's primary key: text or a number. */
283
+ primaryKey: DataInput
284
+ /** The record version the change was decided on: a whole number, 0 or more. */
285
+ expectedVersion?: DataInput
286
+ }
281
287
  export interface ActionParams {
282
288
  input: DataInput
283
289
  /**
@@ -287,6 +293,24 @@ export interface ActionParams {
287
293
  * without one. An empty reason is not sent.
288
294
  */
289
295
  reason?: DataInput
296
+ /**
297
+ * The record the Action acts on, when the step names its own instead of the
298
+ * run's subject: typically a row a `blueprint` step found, inside `forEach`.
299
+ *
300
+ * ```ts
301
+ * subject: {
302
+ * primaryKey: { type: 'expr', expr: '$item.id' },
303
+ * expectedVersion: { type: 'expr', expr: '$item._meta.recordVersion' },
304
+ * }
305
+ * ```
306
+ *
307
+ * The record is of the Action's own subject type. `expectedVersion` is the
308
+ * version the change was decided on; absent (or evaluating to nothing), the
309
+ * record's version is read right before the submit. When `input` leaves them
310
+ * out, the Action's primary-key input and its `expectedVersion` input are
311
+ * filled from the subject. A create Action takes no subject.
312
+ */
313
+ subject?: ActionSubjectParams
290
314
  /**
291
315
  * Keep the step open until the request settles (succeeded, rejected,
292
316
  * expired, cancelled, failed, or closed with an unknown outcome) instead of
@@ -388,6 +412,12 @@ export interface ConfirmParams {
388
412
  cancelLabel?: string
389
413
  /** How long the question stays open, in minutes (1 to 1440); 60 by default. */
390
414
  timeoutMinutes?: number
415
+ /**
416
+ * What happens when nobody can answer (a scheduled, manual or webhook run has no person):
417
+ * `fail` fails the step with `CONFIRM_UNAVAILABLE`; `continue` answers `unavailable` for
418
+ * the definition to branch on. Unset, it fails unless the definition reads the step's answer.
419
+ */
420
+ onUnavailable?: 'fail' | 'continue'
391
421
  }
392
422
  export interface RespondParams {
393
423
  status: number