@segmentstream/ontology 0.208.0 → 0.209.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/workflow.js CHANGED
@@ -13,6 +13,11 @@ export const MAX_WORKFLOWS = 50;
13
13
  * record. A workflow may carry several, so it exceeds the workflows an ontology may declare.
14
14
  */
15
15
  export const MAX_ACTION_TRIGGERS = 100;
16
+ /**
17
+ * The most platform triggers, `platform(…)`, one ontology may declare across its workflows, as for
18
+ * webhooks: it bounds the runs one platform event can start.
19
+ */
20
+ export const MAX_PLATFORM_TRIGGERS = 20;
16
21
  /** Declares a cron trigger; list it in `workflow(name, { triggers })`. UTC, five fields. */
17
22
  export function cron(name, expression, options) {
18
23
  return {
@@ -50,6 +55,23 @@ export function webhook(name, options) {
50
55
  ...(options.input === undefined ? {} : { input: options.input }),
51
56
  };
52
57
  }
58
+ /**
59
+ * Declares a platform trigger; list it in `workflow(name, { triggers })`. The workflow starts for
60
+ * each listed event the platform records for this workspace, and its runs act as the workflow's
61
+ * own user. A workflow that follows a deployment declares one; work that follows another workflow
62
+ * stays in that workflow, since workflow runs are not events.
63
+ */
64
+ export function platform(name, options) {
65
+ return {
66
+ [WorkflowTriggerTypeId]: WorkflowTriggerTypeId,
67
+ kind: "platform",
68
+ name,
69
+ description: options?.description,
70
+ events: options?.events ?? [],
71
+ when: options?.when,
72
+ input: options?.input,
73
+ };
74
+ }
53
75
  export function after(name, target, options) {
54
76
  const names = triggerTarget(target);
55
77
  return {
@@ -12,10 +12,12 @@
12
12
  */
13
13
  export { p } from "./property.js";
14
14
  export type { AnyProperty, NumberOptions, Property, PropertyOptions, TextOptions, } from "./property.js";
15
- export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, nextCronTime, webhook, workflow, } from "./workflow.js";
15
+ export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_PLATFORM_TRIGGERS, MAX_WORKFLOWS, nextCronTime, platform, webhook, workflow, } from "./workflow.js";
16
+ export { PLATFORM_EVENT_TYPES } from "./platform-events.js";
17
+ export type { PlatformEvent, PlatformEventOf, PlatformEventType } from "./platform-events.js";
16
18
  export { MAX_WEBHOOK_BODY_BYTES, MAX_META_WEBHOOK_BODY_BYTES, MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, WEBHOOK_BASE_PATH, WEBHOOK_SIGNATURE_SCHEMES, webhookDelivery, webhookHeaderProblem, webhookPath, } from "./webhooks.js";
17
19
  export type { WebhookDelivery, WebhookHmacFormat, WebhookSignatureScheme, WebhookSignedPart, } from "./webhooks.js";
18
- export type { ActionEvent, ActionTrigger, AfterOptions, AnyActionHandle, AnyWorkflow, ChangedBounds, CronOptions, CronProblem, CronTrigger, TriggerFunction, TriggerRecord, WebhookOptions, WebhookSignature, WebhookVerification, WebhookTrigger, Workflow, WorkflowFunction, WorkflowOptions, WorkflowRunContext, WorkflowTrigger, } from "./workflow.js";
20
+ export type { ActionEvent, ActionTrigger, AfterOptions, AnyActionHandle, AnyWorkflow, ChangedBounds, CronOptions, CronProblem, CronTrigger, PlatformOptions, PlatformTrigger, TriggerFunction, TriggerRecord, WebhookOptions, WebhookSignature, WebhookVerification, WebhookTrigger, Workflow, WorkflowFunction, WorkflowOptions, WorkflowRunContext, WorkflowTrigger, } from "./workflow.js";
19
21
  export { run, WORKFLOW_BASE_PATH, WorkflowStepRequired } from "./workflow-runtime.js";
20
22
  export { recoverWorkflowStarts, StartRecoveryWorkflowRequired } from "./start-recovery.js";
21
23
  export { runTriggerAction, TriggerRunUnsupported, TriggerRunWorkflowRequired, } from "./trigger-run.js";
package/dist/workflows.js CHANGED
@@ -11,7 +11,8 @@
11
11
  * with the workflow's.
12
12
  */
13
13
  export { p } from "./property.js";
14
- export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_WORKFLOWS, nextCronTime, webhook, workflow, } from "./workflow.js";
14
+ export { after, changed, cron, cronNeverFires, cronProblem, isWorkflow, isWorkflowTrigger, MAX_ACTION_TRIGGERS, MAX_PLATFORM_TRIGGERS, MAX_WORKFLOWS, nextCronTime, platform, webhook, workflow, } from "./workflow.js";
15
+ export { PLATFORM_EVENT_TYPES } from "./platform-events.js";
15
16
  export { MAX_WEBHOOK_BODY_BYTES, MAX_META_WEBHOOK_BODY_BYTES, MAX_WEBHOOK_HEADERS, MAX_WEBHOOKS, WEBHOOK_BASE_PATH, WEBHOOK_SIGNATURE_SCHEMES, webhookDelivery, webhookHeaderProblem, webhookPath, } from "./webhooks.js";
16
17
  export { run, WORKFLOW_BASE_PATH, WorkflowStepRequired } from "./workflow-runtime.js";
17
18
  export { recoverWorkflowStarts, StartRecoveryWorkflowRequired } from "./start-recovery.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.208.0",
3
+ "version": "0.209.0",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",