@protobase/schema 0.67.10 → 0.67.11

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.
@@ -1,9 +1,11 @@
1
1
  //#region src/built-in-field-types.d.ts
2
2
  /**
3
3
  * The field types Protobase brings, which a view chooses with `.widget(name)` like a plugin's, by the storage types
4
- * each shows: `members`, a JSON array of the user ids of an organization's members. A plugin's of the same name wins.
4
+ * each shows: `members`, a JSON array of the user ids of an organization's members, and `workflow`, a workflow's
5
+ * definition drawn as a graph to edit. A plugin's of the same name wins.
5
6
  */
6
7
  export declare const builtInFieldTypes: {
7
8
  readonly members: readonly ["json"];
9
+ readonly workflow: readonly ["json"];
8
10
  };
9
11
  //#endregion
@@ -1,8 +1,12 @@
1
1
  //#region src/built-in-field-types.ts
2
2
  /**
3
3
  * The field types Protobase brings, which a view chooses with `.widget(name)` like a plugin's, by the storage types
4
- * each shows: `members`, a JSON array of the user ids of an organization's members. A plugin's of the same name wins.
4
+ * each shows: `members`, a JSON array of the user ids of an organization's members, and `workflow`, a workflow's
5
+ * definition drawn as a graph to edit. A plugin's of the same name wins.
5
6
  */
6
- const builtInFieldTypes = { members: ["json"] };
7
+ const builtInFieldTypes = {
8
+ members: ["json"],
9
+ workflow: ["json"]
10
+ };
7
11
  //#endregion
8
12
  export { builtInFieldTypes };
@@ -11,6 +11,7 @@ import { parseCapability } from "./access/capability.js";
11
11
  import { checkEventFilter } from "./events/event-models.js";
12
12
  import { webhookResources } from "./webhooks/webhook-resources.js";
13
13
  import { workflowResources } from "./workflows/workflow-resources.js";
14
+ import { StepInput, StepInputKind, WorkflowStepType, requiredStepInputs, workflowStepTypes } from "./workflows/step-types.js";
14
15
  import { PropShapes, RefShape, pruneByShape, shapes } from "./ref-shape.js";
15
16
  import { SearchTerm, matchedSearchField, matchesSearch, searchTerms, termMatches } from "./search-match.js";
16
17
  import { defaultRecentLimit, navRecentErrors, statusTones } from "./nav-recent.js";
@@ -44,4 +45,4 @@ import { builtInFieldTypes } from "./built-in-field-types.js";
44
45
  import { CallCandidate, CallClientMessage, CallDescription, CallGuestLink, CallGuestRefusal, CallGuestState, CallLeftReason, CallLobbyGuest, CallMode, CallRemoteTrack, CallResume, CallRosterMember, CallServerMessage, CallTrackRequest, CallTrackSource, CallVideoLayer } from "./calls/call-protocol.js";
45
46
  import { guestCallsPath } from "./calls/call-guests.js";
46
47
  import { CallRing, callsChannelEvent, declineWord, ringNotice, ringsPath } from "./calls/call-rings.js";
47
- export { type AddressCheck, type Availability, type CallCandidate, type CallClientMessage, type CallDescription, type CallGuestLink, type CallGuestRefusal, type CallGuestState, type CallLeftReason, type CallLobbyGuest, type CallMode, type CallRemoteTrack, type CallResume, type CallRing, type CallRosterMember, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type Locale, type MobileReleaseAnswer, type PersonStatus, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type ReleaseBinding, type SearchTerm, type StatusInput, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, firstPartyCodeKey, guestCallsPath, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, ringNotice, ringsPath, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources, workflowResources };
48
+ export { type AddressCheck, type Availability, type CallCandidate, type CallClientMessage, type CallDescription, type CallGuestLink, type CallGuestRefusal, type CallGuestState, type CallLeftReason, type CallLobbyGuest, type CallMode, type CallRemoteTrack, type CallResume, type CallRing, type CallRosterMember, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type Locale, type MobileReleaseAnswer, type PersonStatus, type PluginHost, type PluginRequirement, type PropShapes, type RefShape, type ReleaseBinding, type SearchTerm, type StatusInput, type StepInput, type StepInputKind, type WorkflowStepType, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, firstPartyCodeKey, guestCallsPath, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, requiredStepInputs, ringNotice, ringsPath, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources, workflowResources, workflowStepTypes };
package/dist/internal.js CHANGED
@@ -19,6 +19,7 @@ import { bottomBarFor } from "./bottom-bar.js";
19
19
  import { decodeKey, encodeKey } from "./keys.js";
20
20
  import { webhookResources } from "./webhooks/webhook-resources.js";
21
21
  import { workflowResources } from "./workflows/workflow-resources.js";
22
+ import { requiredStepInputs, workflowStepTypes } from "./workflows/step-types.js";
22
23
  import { pruneByShape, shapes } from "./ref-shape.js";
23
24
  import { inRange, pluginProblem } from "./plugin-version.js";
24
25
  import { redactSecrets } from "./redact-secrets.js";
@@ -43,4 +44,4 @@ import { listColumnNames } from "./list-columns.js";
43
44
  import { builtInFieldTypes } from "./built-in-field-types.js";
44
45
  import { guestCallsPath } from "./calls/call-guests.js";
45
46
  import { callsChannelEvent, declineWord, ringNotice, ringsPath } from "./calls/call-rings.js";
46
- export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, firstPartyCodeKey, guestCallsPath, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, ringNotice, ringsPath, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources, workflowResources };
47
+ export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, applyAssistantEvent, authBasePath, availabilities, boardErrors, bottomBarFor, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, emptyAssistantState, encodeKey, fieldRefsIn, fillAddress, firstPartyCodeKey, guestCallsPath, heldStatus, historyIdParam, historyIdPattern, historyPath, hrefField, hrefPlaceholders, humanize, inRange, isFieldRef, isGroupChart, isLocale, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, markFieldRefs, matchedSearchField, matchesSearch, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, navRecentErrors, parseCapability, parseFormula, parseSize, parseTable, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordTitle, recordTitleField, redactSecrets, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, requiredStepInputs, ringNotice, ringsPath, searchTerms, serviceWorkerFile, shapes, shownInputs, statusPath, statusTextProblem, statusTones, tableDisplay, termMatches, unmarkFieldRefs, updateSetErrors, updateValues, viewOfList, webhookResources, workflowResources, workflowStepTypes };
@@ -0,0 +1,30 @@
1
+ //#region src/workflows/step-types.d.ts
2
+ /**
3
+ * How a step type's argument is written: `text`, one line, which may be an expression; `choice`, one of `options`;
4
+ * `json`, any JSON value or an expression, such as an object of field values.
5
+ */
6
+ export type StepInputKind = 'text' | 'choice' | 'json';
7
+ /** An argument of a step type: its name in `Arguments`, how it is written, and whether a save needs it. */
8
+ export type StepInput = {
9
+ name: string;
10
+ kind: StepInputKind;
11
+ required?: boolean;
12
+ options?: readonly string[];
13
+ };
14
+ /**
15
+ * The step types a workflow's Task names as its `Resource`, each with its arguments: the server runs them, a save
16
+ * refuses a Task without a required one, and the editor draws a form of them.
17
+ */
18
+ export declare const workflowStepTypes: {
19
+ readonly 'app:http': readonly [StepInput, StepInput, StepInput, StepInput, StepInput, StepInput];
20
+ readonly 'app:records.create': readonly [StepInput, StepInput];
21
+ readonly 'app:records.update': readonly [StepInput, StepInput, StepInput];
22
+ readonly 'app:records.get': readonly [StepInput, StepInput];
23
+ readonly 'app:records.list': readonly [StepInput, StepInput, StepInput, StepInput];
24
+ readonly 'app:mail.send': readonly [StepInput, StepInput, StepInput, StepInput, StepInput];
25
+ readonly 'app:piece': readonly [StepInput, StepInput, StepInput, StepInput];
26
+ };
27
+ export type WorkflowStepType = keyof typeof workflowStepTypes;
28
+ /** The names of the arguments each step type needs, as the definition check takes them. */
29
+ export declare const requiredStepInputs: Record<WorkflowStepType, string[]>;
30
+ //#endregion
@@ -0,0 +1,70 @@
1
+ //#region src/workflows/step-types.ts
2
+ const text = (name, required = false) => ({
3
+ name,
4
+ kind: "text",
5
+ ...required && { required }
6
+ });
7
+ const json = (name, required = false) => ({
8
+ name,
9
+ kind: "json",
10
+ ...required && { required }
11
+ });
12
+ const choice = (name, options) => ({
13
+ name,
14
+ kind: "choice",
15
+ options
16
+ });
17
+ /**
18
+ * The step types a workflow's Task names as its `Resource`, each with its arguments: the server runs them, a save
19
+ * refuses a Task without a required one, and the editor draws a form of them.
20
+ */
21
+ const workflowStepTypes = {
22
+ "app:http": [
23
+ text("url", true),
24
+ choice("method", [
25
+ "GET",
26
+ "POST",
27
+ "PUT",
28
+ "PATCH",
29
+ "DELETE"
30
+ ]),
31
+ json("headers"),
32
+ json("query"),
33
+ json("body"),
34
+ choice("response", [
35
+ "json",
36
+ "text",
37
+ "file"
38
+ ])
39
+ ],
40
+ "app:records.create": [text("resource", true), json("data", true)],
41
+ "app:records.update": [
42
+ text("resource", true),
43
+ json("key", true),
44
+ json("data", true)
45
+ ],
46
+ "app:records.get": [text("resource", true), json("key", true)],
47
+ "app:records.list": [
48
+ text("resource", true),
49
+ text("filter"),
50
+ text("order_by"),
51
+ json("limit")
52
+ ],
53
+ "app:mail.send": [
54
+ json("to", true),
55
+ text("subject", true),
56
+ text("text", true),
57
+ text("html"),
58
+ json("attachments")
59
+ ],
60
+ "app:piece": [
61
+ text("piece", true),
62
+ text("action", true),
63
+ text("connection"),
64
+ json("props")
65
+ ]
66
+ };
67
+ /** The names of the arguments each step type needs, as the definition check takes them. */
68
+ const requiredStepInputs = Object.fromEntries(Object.entries(workflowStepTypes).map(([type, inputs]) => [type, inputs.filter((input) => input.required).map((input) => input.name)]));
69
+ //#endregion
70
+ export { requiredStepInputs, workflowStepTypes };
@@ -35,7 +35,7 @@ const workflowsView = view("workflows").names({
35
35
  singular: "Workflow",
36
36
  plural: "Workflows"
37
37
  }).icon("workflow").title((r) => r.name).help("Steps that run one after another along their edges, written in the States Language with JSONata expressions. Each save that changes its definition is a new version; a run keeps the version it started on.").fields((r) => ({
38
- definition: r.definition.help("Its trigger and its state machine in the States Language with JSONata, every value read by name: the run's input as $states.context.Execution.Input, an earlier result by the variable a state assigned"),
38
+ definition: r.definition.help("Its trigger and its steps, drawn as a graph that lays itself out. Every value is read by name: the run's input as $states.context.Execution.Input, an earlier result by the variable a state assigned").widget("workflow"),
39
39
  updated_at: r.updated_at.label("Updated")
40
40
  })).list((r) => ({
41
41
  columns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.67.10",
3
+ "version": "0.67.11",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {