@scarn/sdk 0.8.2 → 0.8.3
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/automations/define-automation.d.ts +20 -0
- package/dist/automations/index.d.ts +8 -0
- package/dist/automations/index.js +21 -0
- package/dist/automations/targets.d.ts +36 -0
- package/dist/automations/types.d.ts +116 -0
- package/dist/{chunk-nb0nkt71.js → chunk-01nfqm18.js} +1 -0
- package/dist/chunk-0vzq22dj.js +73 -0
- package/dist/chunk-11hbmexe.js +250 -0
- package/dist/{chunk-2fn95pdd.js → chunk-3gy0cb5f.js} +5 -1
- package/dist/{chunk-qrasq5xe.js → chunk-43y7tfn4.js} +33 -414
- package/dist/chunk-61jf8b6s.js +53 -0
- package/dist/chunk-76d1bwwz.js +119 -0
- package/dist/chunk-8z1wa3kd.js +109 -0
- package/dist/{chunk-p7yrcmqm.js → chunk-cnxaagfj.js} +2 -52
- package/dist/{chunk-cdanncng.js → chunk-ejzfdm1z.js} +21 -5
- package/dist/{chunk-gds7w7zh.js → chunk-fgfhvsee.js} +1 -4
- package/dist/{chunk-x9788y82.js → chunk-fyfvp6jx.js} +30 -13
- package/dist/{chunk-mz53r914.js → chunk-jj9pezwb.js} +22 -119
- package/dist/{chunk-8pyhrdgy.js → chunk-wnfj3wyx.js} +55 -11
- package/dist/chunk-x0hjhqrf.js +416 -0
- package/dist/chunk-y11p1q7r.js +159 -0
- package/dist/client.js +4 -2
- package/dist/contracts/automation-document/index.d.ts +5 -0
- package/dist/contracts/automation-document/index.js +34 -0
- package/dist/contracts/automation-document/schema.d.ts +363 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +9 -7
- package/dist/contracts/pipeline-document/schema.d.ts +3 -3
- package/dist/contracts/work-item-changes.d.ts +6 -0
- package/dist/contracts/work-item-changes.js +1 -0
- package/dist/defaults/index.js +2 -2
- package/dist/definitions/automations/automations-client.d.ts +178 -0
- package/dist/definitions/automations/index.d.ts +1 -0
- package/dist/definitions/automations/index.js +12 -0
- package/dist/definitions/pipelines/index.d.ts +0 -1
- package/dist/definitions/pipelines/index.js +4 -12
- package/dist/definitions/pipelines/work-item-fields.d.ts +11 -22
- package/dist/definitions/steps/define-code-step.d.ts +3 -1
- package/dist/definitions/steps/define-step.d.ts +13 -0
- package/dist/definitions/steps/index.js +9 -6
- package/dist/definitions/steps/repo.d.ts +11 -3
- package/dist/definitions/steps/runtime.d.ts +11 -12
- package/dist/definitions/steps/step-definitions-client.d.ts +12 -0
- package/dist/definitions/steps/step-features.d.ts +2 -2
- package/dist/definitions/steps/step-handle.d.ts +6 -1
- package/dist/definitions/validation/index.js +2 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +37 -5
- package/dist/generated/types.gen.d.ts +2756 -1875
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -30
- package/dist/pipelines/define-pipeline.d.ts +7 -7
- package/dist/pipelines/handles.d.ts +0 -5
- package/dist/pipelines/index.js +7 -4
- package/dist/pipelines/types.d.ts +13 -1
- package/dist/push/collect-definitions.d.ts +3 -8
- package/dist/push/collect-pipeline-documents.d.ts +13 -3
- package/dist/push/index.d.ts +2 -2
- package/dist/push/index.js +87 -124
- package/dist/push/push-from-directory.d.ts +10 -6
- package/dist/repo-config.d.ts +14 -4
- package/dist/repo-config.js +5 -1
- package/dist/task-plane-client.d.ts +40 -0
- package/package.json +13 -1
- package/dist/chunk-ra53p0v8.js +0 -256
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +0 -263
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The zod schema for automation JSON documents (schema version 1): what
|
|
3
|
+
* `defineAutomation` compiles to and `scarn pipelines build` writes as
|
|
4
|
+
* `<key>.json`, next to the pipeline documents.
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* {
|
|
8
|
+
* "kind": "automation",
|
|
9
|
+
* "schemaVersion": 1,
|
|
10
|
+
* "key": "wayfinder",
|
|
11
|
+
* "title": "Wayfinder",
|
|
12
|
+
* "scope": "workItem",
|
|
13
|
+
* "rules": [
|
|
14
|
+
* {
|
|
15
|
+
* "event": "child.ready",
|
|
16
|
+
* "next": {
|
|
17
|
+
* "routes": [
|
|
18
|
+
* {
|
|
19
|
+
* "when": { "path": "event.child.labels", "op": "contains", "value": "wayfinder:research" },
|
|
20
|
+
* "kind": "step",
|
|
21
|
+
* "to": "research",
|
|
22
|
+
* "args": { "question": "event.child.title" },
|
|
23
|
+
* "on": "child"
|
|
24
|
+
* }
|
|
25
|
+
* ],
|
|
26
|
+
* "otherwise": { "kind": "skip" }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ]
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* - `scope` limits `event`: work-item automations react to `self.attached`
|
|
34
|
+
* and `child.*`, project automations to `workItem.*`.
|
|
35
|
+
* - `next` has the shape of a pipeline node's `next`: `match` (`"first"`, the
|
|
36
|
+
* default, or `"all"`), `routes`, each with an optional `when`, and
|
|
37
|
+
* `otherwise`. A rule with one target compiles to one route without `when`.
|
|
38
|
+
* - Each route is a target: `step` (a step key, with args) or `pipeline` (a
|
|
39
|
+
* pipeline key), each started for the work item `on` names (`"workItem"`,
|
|
40
|
+
* the one the rule is about, or `"child"`, only on `child.*` events);
|
|
41
|
+
* `attach` (another automation's key, project scope only); or `skip`.
|
|
42
|
+
* - Refs in `when` and `args` read the event: `event.workItem.<prop>`,
|
|
43
|
+
* `event.child.<prop>` (on `child.*` events) and `event.label` (on
|
|
44
|
+
* `workItem.label.added`), where `<prop>` is `title`, `description`,
|
|
45
|
+
* `labels`, `state` or `fields.<name>`. Args use the pipeline arg format
|
|
46
|
+
* (a ref string, `{ "value": ... }` or `{ "list": [...] }`).
|
|
47
|
+
*
|
|
48
|
+
* The schema checks structure and that events fit the scope. Whether `to`
|
|
49
|
+
* names a known step or pipeline, and whether args fit its input, is checked
|
|
50
|
+
* when the automation is published.
|
|
51
|
+
*/
|
|
52
|
+
import { z } from "zod";
|
|
53
|
+
export declare const AUTOMATION_SCOPES: readonly ["workItem", "project"];
|
|
54
|
+
/** Events of a work-item automation: about its own work item and its child work items. */
|
|
55
|
+
export declare const WORK_ITEM_AUTOMATION_EVENTS: readonly ["self.attached", "child.created", "child.ready", "child.closed"];
|
|
56
|
+
/** Events of a project automation: about any top-level work item in the project. */
|
|
57
|
+
export declare const PROJECT_AUTOMATION_EVENTS: readonly ["workItem.created", "workItem.ready", "workItem.label.added"];
|
|
58
|
+
export declare const AUTOMATION_EVENTS: readonly ["self.attached", "child.created", "child.ready", "child.closed", "workItem.created", "workItem.ready", "workItem.label.added"];
|
|
59
|
+
/** Which work item a started Task or pipeline run is for. */
|
|
60
|
+
export declare const AUTOMATION_SUBJECTS: readonly ["workItem", "child"];
|
|
61
|
+
export type AutomationScope = (typeof AUTOMATION_SCOPES)[number];
|
|
62
|
+
export type WorkItemAutomationEvent = (typeof WORK_ITEM_AUTOMATION_EVENTS)[number];
|
|
63
|
+
export type ProjectAutomationEvent = (typeof PROJECT_AUTOMATION_EVENTS)[number];
|
|
64
|
+
export type AutomationEvent = (typeof AUTOMATION_EVENTS)[number];
|
|
65
|
+
export type AutomationSubject = (typeof AUTOMATION_SUBJECTS)[number];
|
|
66
|
+
/** The scope whose automations react to `event`. */
|
|
67
|
+
export declare function scopeOfEvent(event: AutomationEvent): AutomationScope;
|
|
68
|
+
/** Whether `event` has a `child` work item. */
|
|
69
|
+
export declare function eventHasChild(event: AutomationEvent): boolean;
|
|
70
|
+
/** What a rule starts: a step's Task, a pipeline run, an attachment, or nothing. */
|
|
71
|
+
export declare const automationTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
|
+
kind: z.ZodLiteral<"step">;
|
|
73
|
+
to: z.ZodString;
|
|
74
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
75
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
76
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
77
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
78
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
79
|
+
}, z.core.$strict>]>>;
|
|
80
|
+
}, z.core.$strict>]>>>;
|
|
81
|
+
on: z.ZodEnum<{
|
|
82
|
+
workItem: "workItem";
|
|
83
|
+
child: "child";
|
|
84
|
+
}>;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
87
|
+
to: z.ZodString;
|
|
88
|
+
on: z.ZodEnum<{
|
|
89
|
+
workItem: "workItem";
|
|
90
|
+
child: "child";
|
|
91
|
+
}>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"attach">;
|
|
94
|
+
automation: z.ZodString;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"skip">;
|
|
97
|
+
}, z.core.$strict>], "kind">;
|
|
98
|
+
/** One route: an optional `when`, then the target's keys. */
|
|
99
|
+
export declare const automationRouteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
kind: z.ZodLiteral<"step">;
|
|
101
|
+
to: z.ZodString;
|
|
102
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
103
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
104
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
105
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
106
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
107
|
+
}, z.core.$strict>]>>;
|
|
108
|
+
}, z.core.$strict>]>>>;
|
|
109
|
+
on: z.ZodEnum<{
|
|
110
|
+
workItem: "workItem";
|
|
111
|
+
child: "child";
|
|
112
|
+
}>;
|
|
113
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
114
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
115
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
116
|
+
to: z.ZodString;
|
|
117
|
+
on: z.ZodEnum<{
|
|
118
|
+
workItem: "workItem";
|
|
119
|
+
child: "child";
|
|
120
|
+
}>;
|
|
121
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"attach">;
|
|
124
|
+
automation: z.ZodString;
|
|
125
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
126
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
|
+
kind: z.ZodLiteral<"skip">;
|
|
128
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
129
|
+
}, z.core.$strict>], "kind">;
|
|
130
|
+
export declare const automationNextSchema: z.ZodObject<{
|
|
131
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
all: "all";
|
|
133
|
+
first: "first";
|
|
134
|
+
}>>;
|
|
135
|
+
routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
136
|
+
kind: z.ZodLiteral<"step">;
|
|
137
|
+
to: z.ZodString;
|
|
138
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
139
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
140
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
142
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
143
|
+
}, z.core.$strict>]>>;
|
|
144
|
+
}, z.core.$strict>]>>>;
|
|
145
|
+
on: z.ZodEnum<{
|
|
146
|
+
workItem: "workItem";
|
|
147
|
+
child: "child";
|
|
148
|
+
}>;
|
|
149
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
150
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
152
|
+
to: z.ZodString;
|
|
153
|
+
on: z.ZodEnum<{
|
|
154
|
+
workItem: "workItem";
|
|
155
|
+
child: "child";
|
|
156
|
+
}>;
|
|
157
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
kind: z.ZodLiteral<"attach">;
|
|
160
|
+
automation: z.ZodString;
|
|
161
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
162
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
163
|
+
kind: z.ZodLiteral<"skip">;
|
|
164
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
165
|
+
}, z.core.$strict>], "kind">>;
|
|
166
|
+
otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
|
+
kind: z.ZodLiteral<"step">;
|
|
168
|
+
to: z.ZodString;
|
|
169
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
170
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
171
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
173
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
174
|
+
}, z.core.$strict>]>>;
|
|
175
|
+
}, z.core.$strict>]>>>;
|
|
176
|
+
on: z.ZodEnum<{
|
|
177
|
+
workItem: "workItem";
|
|
178
|
+
child: "child";
|
|
179
|
+
}>;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
182
|
+
to: z.ZodString;
|
|
183
|
+
on: z.ZodEnum<{
|
|
184
|
+
workItem: "workItem";
|
|
185
|
+
child: "child";
|
|
186
|
+
}>;
|
|
187
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"attach">;
|
|
189
|
+
automation: z.ZodString;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
kind: z.ZodLiteral<"skip">;
|
|
192
|
+
}, z.core.$strict>], "kind">>;
|
|
193
|
+
}, z.core.$strict>;
|
|
194
|
+
export declare const automationRuleSchema: z.ZodObject<{
|
|
195
|
+
event: z.ZodEnum<{
|
|
196
|
+
"self.attached": "self.attached";
|
|
197
|
+
"child.created": "child.created";
|
|
198
|
+
"child.ready": "child.ready";
|
|
199
|
+
"child.closed": "child.closed";
|
|
200
|
+
"workItem.created": "workItem.created";
|
|
201
|
+
"workItem.ready": "workItem.ready";
|
|
202
|
+
"workItem.label.added": "workItem.label.added";
|
|
203
|
+
}>;
|
|
204
|
+
next: z.ZodObject<{
|
|
205
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
206
|
+
all: "all";
|
|
207
|
+
first: "first";
|
|
208
|
+
}>>;
|
|
209
|
+
routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
|
+
kind: z.ZodLiteral<"step">;
|
|
211
|
+
to: z.ZodString;
|
|
212
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
213
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
214
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
215
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
216
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
217
|
+
}, z.core.$strict>]>>;
|
|
218
|
+
}, z.core.$strict>]>>>;
|
|
219
|
+
on: z.ZodEnum<{
|
|
220
|
+
workItem: "workItem";
|
|
221
|
+
child: "child";
|
|
222
|
+
}>;
|
|
223
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
224
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
225
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
226
|
+
to: z.ZodString;
|
|
227
|
+
on: z.ZodEnum<{
|
|
228
|
+
workItem: "workItem";
|
|
229
|
+
child: "child";
|
|
230
|
+
}>;
|
|
231
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
232
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
233
|
+
kind: z.ZodLiteral<"attach">;
|
|
234
|
+
automation: z.ZodString;
|
|
235
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
236
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
237
|
+
kind: z.ZodLiteral<"skip">;
|
|
238
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
239
|
+
}, z.core.$strict>], "kind">>;
|
|
240
|
+
otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
241
|
+
kind: z.ZodLiteral<"step">;
|
|
242
|
+
to: z.ZodString;
|
|
243
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
244
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
245
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
246
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
247
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
248
|
+
}, z.core.$strict>]>>;
|
|
249
|
+
}, z.core.$strict>]>>>;
|
|
250
|
+
on: z.ZodEnum<{
|
|
251
|
+
workItem: "workItem";
|
|
252
|
+
child: "child";
|
|
253
|
+
}>;
|
|
254
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
255
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
256
|
+
to: z.ZodString;
|
|
257
|
+
on: z.ZodEnum<{
|
|
258
|
+
workItem: "workItem";
|
|
259
|
+
child: "child";
|
|
260
|
+
}>;
|
|
261
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"attach">;
|
|
263
|
+
automation: z.ZodString;
|
|
264
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
265
|
+
kind: z.ZodLiteral<"skip">;
|
|
266
|
+
}, z.core.$strict>], "kind">>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
}, z.core.$strict>;
|
|
269
|
+
type Target = z.infer<typeof automationTargetSchema>;
|
|
270
|
+
export declare const automationDocumentSchema: z.ZodObject<{
|
|
271
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
272
|
+
kind: z.ZodLiteral<"automation">;
|
|
273
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
274
|
+
key: z.ZodString;
|
|
275
|
+
title: z.ZodOptional<z.ZodString>;
|
|
276
|
+
scope: z.ZodEnum<{
|
|
277
|
+
workItem: "workItem";
|
|
278
|
+
project: "project";
|
|
279
|
+
}>;
|
|
280
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
281
|
+
event: z.ZodEnum<{
|
|
282
|
+
"self.attached": "self.attached";
|
|
283
|
+
"child.created": "child.created";
|
|
284
|
+
"child.ready": "child.ready";
|
|
285
|
+
"child.closed": "child.closed";
|
|
286
|
+
"workItem.created": "workItem.created";
|
|
287
|
+
"workItem.ready": "workItem.ready";
|
|
288
|
+
"workItem.label.added": "workItem.label.added";
|
|
289
|
+
}>;
|
|
290
|
+
next: z.ZodObject<{
|
|
291
|
+
match: z.ZodOptional<z.ZodEnum<{
|
|
292
|
+
all: "all";
|
|
293
|
+
first: "first";
|
|
294
|
+
}>>;
|
|
295
|
+
routes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
296
|
+
kind: z.ZodLiteral<"step">;
|
|
297
|
+
to: z.ZodString;
|
|
298
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
299
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
300
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
301
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
302
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
303
|
+
}, z.core.$strict>]>>;
|
|
304
|
+
}, z.core.$strict>]>>>;
|
|
305
|
+
on: z.ZodEnum<{
|
|
306
|
+
workItem: "workItem";
|
|
307
|
+
child: "child";
|
|
308
|
+
}>;
|
|
309
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
310
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
311
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
312
|
+
to: z.ZodString;
|
|
313
|
+
on: z.ZodEnum<{
|
|
314
|
+
workItem: "workItem";
|
|
315
|
+
child: "child";
|
|
316
|
+
}>;
|
|
317
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
318
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
319
|
+
kind: z.ZodLiteral<"attach">;
|
|
320
|
+
automation: z.ZodString;
|
|
321
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
322
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
323
|
+
kind: z.ZodLiteral<"skip">;
|
|
324
|
+
when: z.ZodOptional<z.ZodType<import("../pipeline-document").Condition, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").Condition, unknown>>>;
|
|
325
|
+
}, z.core.$strict>], "kind">>;
|
|
326
|
+
otherwise: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
327
|
+
kind: z.ZodLiteral<"step">;
|
|
328
|
+
to: z.ZodString;
|
|
329
|
+
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
330
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
331
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
332
|
+
list: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
333
|
+
value: z.ZodType<import("../pipeline-document").JsonValue, unknown, z.core.$ZodTypeInternals<import("../pipeline-document").JsonValue, unknown>>;
|
|
334
|
+
}, z.core.$strict>]>>;
|
|
335
|
+
}, z.core.$strict>]>>>;
|
|
336
|
+
on: z.ZodEnum<{
|
|
337
|
+
workItem: "workItem";
|
|
338
|
+
child: "child";
|
|
339
|
+
}>;
|
|
340
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
341
|
+
kind: z.ZodLiteral<"pipeline">;
|
|
342
|
+
to: z.ZodString;
|
|
343
|
+
on: z.ZodEnum<{
|
|
344
|
+
workItem: "workItem";
|
|
345
|
+
child: "child";
|
|
346
|
+
}>;
|
|
347
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
348
|
+
kind: z.ZodLiteral<"attach">;
|
|
349
|
+
automation: z.ZodString;
|
|
350
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
351
|
+
kind: z.ZodLiteral<"skip">;
|
|
352
|
+
}, z.core.$strict>], "kind">>;
|
|
353
|
+
}, z.core.$strict>;
|
|
354
|
+
}, z.core.$strict>>;
|
|
355
|
+
}, z.core.$strict>;
|
|
356
|
+
export type AutomationTargetJson = Target;
|
|
357
|
+
export type AutomationRoute = z.infer<typeof automationRouteSchema>;
|
|
358
|
+
export type AutomationNext = z.infer<typeof automationNextSchema>;
|
|
359
|
+
export type AutomationRule = z.infer<typeof automationRuleSchema>;
|
|
360
|
+
export type AutomationDocument = z.infer<typeof automationDocumentSchema>;
|
|
361
|
+
/** The JSON Schema for automation documents, for editors and external tools. */
|
|
362
|
+
export declare function automationDocumentJsonSchema(): Record<string, unknown>;
|
|
363
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* the input a `reply` wait takes, and caught errors.
|
|
4
4
|
*/
|
|
5
5
|
import type { JsonSchema } from "./json";
|
|
6
|
-
export declare const BUILT_IN_ERRORS: readonly ["Scarn.All", "Scarn.StepFailed", "Scarn.HealthCheckFailed", "Scarn.Timeout", "Scarn.HeartbeatTimeout", "Scarn.MaxRunsExceeded", "Scarn.MaxTurnsExceeded", "Scarn.ConditionError", "Scarn.ArgsError", "Scarn.LogArchiveFailed", "Scarn.WorkItemChangesInvalid", "Scarn.WorkItemNotNative"];
|
|
6
|
+
export declare const BUILT_IN_ERRORS: readonly ["Scarn.All", "Scarn.StepFailed", "Scarn.HealthCheckFailed", "Scarn.Timeout", "Scarn.HeartbeatTimeout", "Scarn.MaxRunsExceeded", "Scarn.MaxTurnsExceeded", "Scarn.ConcurrencyGroupFull", "Scarn.ConditionError", "Scarn.ArgsError", "Scarn.LogArchiveFailed", "Scarn.WorkItemChangesInvalid", "Scarn.WorkItemNotNative"];
|
|
7
7
|
/** The errors a wait node can raise, so the only names its `catch` may use. */
|
|
8
8
|
export declare const WAIT_ERRORS: readonly ["Scarn.All", "Scarn.MaxRunsExceeded", "Scarn.ArgsError"];
|
|
9
9
|
/**
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
deepEqual,
|
|
4
|
+
isJsonObject,
|
|
5
|
+
jsonPointer,
|
|
6
|
+
routeAt,
|
|
7
|
+
routeEntries
|
|
8
|
+
} from "../../chunk-61jf8b6s.js";
|
|
2
9
|
import {
|
|
3
10
|
ALIAS_PATTERN,
|
|
4
11
|
COMPARISON_OPERATORS,
|
|
@@ -17,11 +24,8 @@ import {
|
|
|
17
24
|
computedSourceSchema,
|
|
18
25
|
conditionSchema,
|
|
19
26
|
decisionActionSchema,
|
|
20
|
-
deepEqual,
|
|
21
27
|
eachSchema,
|
|
22
28
|
failNodeSchema,
|
|
23
|
-
isJsonObject,
|
|
24
|
-
jsonPointer,
|
|
25
29
|
listSchema,
|
|
26
30
|
literalSchema,
|
|
27
31
|
nextSchema,
|
|
@@ -30,15 +34,13 @@ import {
|
|
|
30
34
|
pipelineDocumentJsonSchema,
|
|
31
35
|
pipelineDocumentSchema,
|
|
32
36
|
retrySchema,
|
|
33
|
-
routeAt,
|
|
34
|
-
routeEntries,
|
|
35
37
|
routeSchema,
|
|
36
38
|
startSchema,
|
|
37
39
|
stepNodeSchema,
|
|
38
40
|
succeedNodeSchema,
|
|
39
41
|
toleratedFailuresSchema,
|
|
40
42
|
waitNodeSchema
|
|
41
|
-
} from "../../chunk-
|
|
43
|
+
} from "../../chunk-cnxaagfj.js";
|
|
42
44
|
import {
|
|
43
45
|
BUILT_IN_ERRORS,
|
|
44
46
|
CONVERSATION_RESULT_SCHEMA,
|
|
@@ -47,7 +49,7 @@ import {
|
|
|
47
49
|
REPLY_RESULT_SCHEMA,
|
|
48
50
|
WAIT_ERRORS,
|
|
49
51
|
decisionResultSchema
|
|
50
|
-
} from "../../chunk-
|
|
52
|
+
} from "../../chunk-01nfqm18.js";
|
|
51
53
|
import"../../chunk-skzxcba3.js";
|
|
52
54
|
import"../../chunk-y64skrwp.js";
|
|
53
55
|
export {
|
|
@@ -311,9 +311,9 @@ export declare const waitNodeSchema: z.ZodObject<{
|
|
|
311
311
|
kind: z.ZodLiteral<"wait">;
|
|
312
312
|
title: z.ZodOptional<z.ZodString>;
|
|
313
313
|
for: z.ZodEnum<{
|
|
314
|
-
event: "event";
|
|
315
314
|
decision: "decision";
|
|
316
315
|
reply: "reply";
|
|
316
|
+
event: "event";
|
|
317
317
|
timer: "timer";
|
|
318
318
|
}>;
|
|
319
319
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -478,9 +478,9 @@ export declare const nodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
478
478
|
kind: z.ZodLiteral<"wait">;
|
|
479
479
|
title: z.ZodOptional<z.ZodString>;
|
|
480
480
|
for: z.ZodEnum<{
|
|
481
|
-
event: "event";
|
|
482
481
|
decision: "decision";
|
|
483
482
|
reply: "reply";
|
|
483
|
+
event: "event";
|
|
484
484
|
timer: "timer";
|
|
485
485
|
}>;
|
|
486
486
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -671,9 +671,9 @@ export declare const pipelineDocumentSchema: z.ZodObject<{
|
|
|
671
671
|
kind: z.ZodLiteral<"wait">;
|
|
672
672
|
title: z.ZodOptional<z.ZodString>;
|
|
673
673
|
for: z.ZodEnum<{
|
|
674
|
-
event: "event";
|
|
675
674
|
decision: "decision";
|
|
676
675
|
reply: "reply";
|
|
676
|
+
event: "event";
|
|
677
677
|
timer: "timer";
|
|
678
678
|
}>;
|
|
679
679
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -9,7 +9,13 @@ export type WorkItemChange = {
|
|
|
9
9
|
title: string;
|
|
10
10
|
description: string;
|
|
11
11
|
fields?: Record<string, unknown>;
|
|
12
|
+
labels?: string[];
|
|
12
13
|
blockedBy?: string[];
|
|
14
|
+
} | {
|
|
15
|
+
kind: "label";
|
|
16
|
+
workItemId: string;
|
|
17
|
+
add?: string[];
|
|
18
|
+
remove?: string[];
|
|
13
19
|
} | {
|
|
14
20
|
kind: "block";
|
|
15
21
|
blockedWorkItemId: string;
|
package/dist/defaults/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-rt9tq4j6.js";
|
|
5
5
|
import {
|
|
6
6
|
createScarnClient
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import"../chunk-
|
|
7
|
+
} from "../chunk-3gy0cb5f.js";
|
|
8
|
+
import"../chunk-wnfj3wyx.js";
|
|
9
9
|
import"../chunk-y64skrwp.js";
|
|
10
10
|
|
|
11
11
|
// src/defaults/auth-file.ts
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Automations } from "../../generated/sdk.gen";
|
|
3
|
+
import type { PutApiProjectsByProjectIdAutomationsByKeyResponses } from "../../generated/types.gen";
|
|
4
|
+
type RequestOptions = {
|
|
5
|
+
headers?: Record<string, unknown> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type PublishAutomationResult = PutApiProjectsByProjectIdAutomationsByKeyResponses[200];
|
|
8
|
+
export type Automation = PublishAutomationResult["automation"];
|
|
9
|
+
declare const automationDocumentIssueSchema: z.ZodObject<{
|
|
10
|
+
code: z.ZodString;
|
|
11
|
+
path: z.ZodString;
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/** One validation error the server reports for a rejected automation document. */
|
|
16
|
+
export type AutomationDocumentIssue = z.infer<typeof automationDocumentIssueSchema>;
|
|
17
|
+
type ApiError = {
|
|
18
|
+
title?: string;
|
|
19
|
+
detail?: string;
|
|
20
|
+
code?: string;
|
|
21
|
+
meta?: {
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when the API rejects a request. `issues` carries the per-path
|
|
27
|
+
* validation errors of an `AUTOMATION_DOCUMENT_INVALID` rejection.
|
|
28
|
+
*/
|
|
29
|
+
export declare class AutomationsApiError extends Error {
|
|
30
|
+
readonly code: string | undefined;
|
|
31
|
+
readonly issues: readonly AutomationDocumentIssue[];
|
|
32
|
+
constructor(error: ApiError);
|
|
33
|
+
}
|
|
34
|
+
export declare function createAutomationsClient(baseUrl: string): ReturnType<typeof buildAutomationsClient>;
|
|
35
|
+
declare const buildAutomationsClient: (automations: Automations) => {
|
|
36
|
+
listByProjectId: (projectId: string, options?: RequestOptions) => Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
projectId: string;
|
|
39
|
+
key: string;
|
|
40
|
+
title: string | unknown;
|
|
41
|
+
scope: "workItem" | "project";
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
latestVersion: {
|
|
44
|
+
id: string;
|
|
45
|
+
version: number;
|
|
46
|
+
schemaVersion: number;
|
|
47
|
+
contentHash: string;
|
|
48
|
+
document: {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
};
|
|
51
|
+
publishedAt: string;
|
|
52
|
+
} | unknown;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt: string;
|
|
55
|
+
}[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Publishes `document` as the automation's next version, creating the
|
|
58
|
+
* automation (disabled) when its key is new. `published` is false when it
|
|
59
|
+
* matched the latest version.
|
|
60
|
+
*/
|
|
61
|
+
publish: (projectId: string, key: string, document: Record<string, unknown>, options?: RequestOptions) => Promise<{
|
|
62
|
+
published: boolean;
|
|
63
|
+
automation: {
|
|
64
|
+
id: string;
|
|
65
|
+
projectId: string;
|
|
66
|
+
key: string;
|
|
67
|
+
title: string | unknown;
|
|
68
|
+
scope: "workItem" | "project";
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
latestVersion: {
|
|
71
|
+
id: string;
|
|
72
|
+
version: number;
|
|
73
|
+
schemaVersion: number;
|
|
74
|
+
contentHash: string;
|
|
75
|
+
document: {
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
};
|
|
78
|
+
publishedAt: string;
|
|
79
|
+
} | unknown;
|
|
80
|
+
createdAt: string;
|
|
81
|
+
updatedAt: string;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
84
|
+
enable: (projectId: string, key: string, options?: RequestOptions) => Promise<{
|
|
85
|
+
id: string;
|
|
86
|
+
projectId: string;
|
|
87
|
+
key: string;
|
|
88
|
+
title: string | unknown;
|
|
89
|
+
scope: "workItem" | "project";
|
|
90
|
+
enabled: boolean;
|
|
91
|
+
latestVersion: {
|
|
92
|
+
id: string;
|
|
93
|
+
version: number;
|
|
94
|
+
schemaVersion: number;
|
|
95
|
+
contentHash: string;
|
|
96
|
+
document: {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
publishedAt: string;
|
|
100
|
+
} | unknown;
|
|
101
|
+
createdAt: string;
|
|
102
|
+
updatedAt: string;
|
|
103
|
+
}>;
|
|
104
|
+
disable: (projectId: string, key: string, options?: RequestOptions) => Promise<{
|
|
105
|
+
id: string;
|
|
106
|
+
projectId: string;
|
|
107
|
+
key: string;
|
|
108
|
+
title: string | unknown;
|
|
109
|
+
scope: "workItem" | "project";
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
latestVersion: {
|
|
112
|
+
id: string;
|
|
113
|
+
version: number;
|
|
114
|
+
schemaVersion: number;
|
|
115
|
+
contentHash: string;
|
|
116
|
+
document: {
|
|
117
|
+
[key: string]: unknown;
|
|
118
|
+
};
|
|
119
|
+
publishedAt: string;
|
|
120
|
+
} | unknown;
|
|
121
|
+
createdAt: string;
|
|
122
|
+
updatedAt: string;
|
|
123
|
+
}>;
|
|
124
|
+
listForWorkItem: (workItemId: string, options?: RequestOptions) => Promise<{
|
|
125
|
+
workItemId: string;
|
|
126
|
+
automation: {
|
|
127
|
+
id: string;
|
|
128
|
+
projectId: string;
|
|
129
|
+
key: string;
|
|
130
|
+
title: string | unknown;
|
|
131
|
+
scope: "workItem" | "project";
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
latestVersion: {
|
|
134
|
+
id: string;
|
|
135
|
+
version: number;
|
|
136
|
+
schemaVersion: number;
|
|
137
|
+
contentHash: string;
|
|
138
|
+
document: {
|
|
139
|
+
[key: string]: unknown;
|
|
140
|
+
};
|
|
141
|
+
publishedAt: string;
|
|
142
|
+
} | unknown;
|
|
143
|
+
createdAt: string;
|
|
144
|
+
updatedAt: string;
|
|
145
|
+
};
|
|
146
|
+
attachedByUserId: string;
|
|
147
|
+
attachedAt: string;
|
|
148
|
+
}[]>;
|
|
149
|
+
attach: (workItemId: string, key: string, options?: RequestOptions) => Promise<{
|
|
150
|
+
workItemId: string;
|
|
151
|
+
automation: {
|
|
152
|
+
id: string;
|
|
153
|
+
projectId: string;
|
|
154
|
+
key: string;
|
|
155
|
+
title: string | unknown;
|
|
156
|
+
scope: "workItem" | "project";
|
|
157
|
+
enabled: boolean;
|
|
158
|
+
latestVersion: {
|
|
159
|
+
id: string;
|
|
160
|
+
version: number;
|
|
161
|
+
schemaVersion: number;
|
|
162
|
+
contentHash: string;
|
|
163
|
+
document: {
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
};
|
|
166
|
+
publishedAt: string;
|
|
167
|
+
} | unknown;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
};
|
|
171
|
+
attachedByUserId: string;
|
|
172
|
+
attachedAt: string;
|
|
173
|
+
}>;
|
|
174
|
+
detach: (workItemId: string, key: string, options?: RequestOptions) => Promise<{
|
|
175
|
+
detached: boolean;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./automations-client";
|