@protobase/schema 0.67.11 → 0.67.12

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,11 +1,14 @@
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, and `workflow`, a workflow's
5
- * definition drawn as a graph to edit. A plugin's of the same name wins.
4
+ * each shows: `json`, any JSON value edited as JSON text, `members`, a JSON array of the user ids of an organization's members, `workflow`, a workflow's
5
+ * definition drawn as a graph to edit, and `workflow_run`, a run's id, drawn as its steps on its workflow's graph. A
6
+ * plugin's of the same name wins.
6
7
  */
7
8
  export declare const builtInFieldTypes: {
9
+ readonly json: readonly ["json"];
8
10
  readonly members: readonly ["json"];
9
11
  readonly workflow: readonly ["json"];
12
+ readonly workflow_run: readonly ["uuid"];
10
13
  };
11
14
  //#endregion
@@ -1,12 +1,15 @@
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, and `workflow`, a workflow's
5
- * definition drawn as a graph to edit. A plugin's of the same name wins.
4
+ * each shows: `json`, any JSON value edited as JSON text, `members`, a JSON array of the user ids of an organization's members, `workflow`, a workflow's
5
+ * definition drawn as a graph to edit, and `workflow_run`, a run's id, drawn as its steps on its workflow's graph. A
6
+ * plugin's of the same name wins.
6
7
  */
7
8
  const builtInFieldTypes = {
9
+ json: ["json"],
8
10
  members: ["json"],
9
- workflow: ["json"]
11
+ workflow: ["json"],
12
+ workflow_run: ["uuid"]
10
13
  };
11
14
  //#endregion
12
15
  export { builtInFieldTypes };
@@ -57,6 +57,7 @@ export declare const workflowResources: (schema: string) => {
57
57
  readonly cause: Field<string | null>;
58
58
  readonly resume_at: Field<string | null>;
59
59
  readonly started_by: Field<string | null>;
60
+ readonly rerun_of: Field<string | number | null>;
60
61
  readonly tenant_id: Field<string | null>;
61
62
  readonly created_at: Field<string>;
62
63
  readonly finished_at: Field<string | null>;
@@ -74,6 +75,7 @@ export declare const workflowResources: (schema: string) => {
74
75
  readonly cause: Field<string | null>;
75
76
  readonly resume_at: Field<string | null>;
76
77
  readonly started_by: Field<string | null>;
78
+ readonly rerun_of: Field<string | number | null>;
77
79
  readonly tenant_id: Field<string | null>;
78
80
  readonly created_at: Field<string>;
79
81
  readonly finished_at: Field<string | null>;
@@ -44,7 +44,15 @@ const workflowsView = view("workflows").names({
44
44
  r.updated_at
45
45
  ],
46
46
  sort: [[r.updated_at, "desc"]]
47
- })).layout((r) => [
47
+ })).actions((a) => [a.link("test_run", {
48
+ label: "Test run",
49
+ icon: "play",
50
+ to: {
51
+ kind: "create",
52
+ resource: "workflow_runs",
53
+ values: { workflow_id: "{id}" }
54
+ }
55
+ })]).layout((r) => [
48
56
  layout.section("Workflow", [
49
57
  r.name,
50
58
  r.description,
@@ -60,9 +68,10 @@ const workflowsView = view("workflows").names({
60
68
  field: "workflow_id",
61
69
  columns: [
62
70
  "status",
63
- "version",
71
+ "started_by",
64
72
  "created_at",
65
73
  "duration_ms",
74
+ "version",
66
75
  "error"
67
76
  ]
68
77
  }),
@@ -117,6 +126,7 @@ const runsResource = (schema) => resource("workflow_runs").table(`${schema}.runs
117
126
  cause: f.text().optional().readOnly(),
118
127
  resume_at: f.timestamp().optional().readOnly(),
119
128
  started_by: f.text().optional().readOnly(),
129
+ rerun_of: f.relation("workflow_runs").optional().filterable(),
120
130
  tenant_id: f.text().optional().readOnly(),
121
131
  created_at: f.timestamp().readOnly().dbDefault().sortable(),
122
132
  finished_at: f.timestamp().optional().readOnly(),
@@ -129,8 +139,10 @@ const runsView = view("workflow_runs").names({
129
139
  singular: "Workflow run",
130
140
  plural: "Workflow runs"
131
141
  }).icon("play").title((r) => r.created_at).help("A run of a workflow with its input. It takes up where it stands after a restart; each of its steps is listed with what it read, gave and logged.").fields((r) => ({
142
+ id: r.id.label("Steps").widget("workflow_run"),
132
143
  workflow_id: r.workflow_id.label("Workflow"),
133
- input: r.input.help("Read by every state as $states.context.Execution.Input"),
144
+ input: r.input.widget("json").help("Read by every state as $states.context.Execution.Input; a re-run takes the input of the run it re-runs"),
145
+ rerun_of: r.rerun_of.label("Re-run of").help("A failed run of the workflow: the re-run keeps its steps before the one that failed, and goes on from there on the workflow as it is now"),
134
146
  key: r.key.help("A workflow runs once per key, such as the record a trigger found ready"),
135
147
  status: r.status.valueLabels({
136
148
  queued: "Queued",
@@ -142,6 +154,7 @@ const runsView = view("workflow_runs").names({
142
154
  succeeded: "green",
143
155
  failed: "red"
144
156
  }),
157
+ output: r.output.widget("json"),
145
158
  resume_at: r.resume_at.label("Goes on at"),
146
159
  started_by: r.started_by.label("Started by"),
147
160
  created_at: r.created_at.label("Started"),
@@ -152,11 +165,25 @@ const runsView = view("workflow_runs").names({
152
165
  r.created_at,
153
166
  r.workflow_id,
154
167
  r.status,
168
+ r.started_by,
155
169
  r.duration_ms,
156
170
  r.error
157
171
  ],
158
172
  sort: [[r.created_at, "desc"]]
159
- })).layout((r) => [
173
+ })).actions((a) => [a.link("rerun", {
174
+ label: "Re-run from the failed step",
175
+ icon: "restart",
176
+ to: {
177
+ kind: "create",
178
+ resource: "workflow_runs",
179
+ values: {
180
+ workflow_id: "{workflow_id}",
181
+ rerun_of: "{id}"
182
+ }
183
+ },
184
+ when: "status = \"failed\""
185
+ })]).layout((r) => [
186
+ layout.section("Trace", [r.id]),
160
187
  layout.section("Run", [
161
188
  r.workflow_id,
162
189
  r.input,
@@ -168,6 +195,7 @@ const runsView = view("workflow_runs").names({
168
195
  r.status,
169
196
  r.version,
170
197
  r.started_by,
198
+ r.rerun_of,
171
199
  r.created_at,
172
200
  r.resume_at,
173
201
  r.finished_at,
@@ -185,6 +213,17 @@ const runsView = view("workflow_runs").names({
185
213
  "duration_ms",
186
214
  "error"
187
215
  ]
216
+ }),
217
+ layout.related("Re-runs", {
218
+ resource: "workflow_runs",
219
+ field: "rerun_of",
220
+ columns: [
221
+ "status",
222
+ "started_by",
223
+ "created_at",
224
+ "duration_ms",
225
+ "error"
226
+ ]
188
227
  })
189
228
  ]);
190
229
  /** Every step of every run: its input with secrets redacted, output, variables, logs, timing, try and error. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.67.11",
3
+ "version": "0.67.12",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {