@scarn/sdk 0.8.21 → 0.8.22
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/auth/index.js +15 -16
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-6p340dd4.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-r3sbp2wn.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-nkm31g10.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-8tmsvkmj.js → chunk-52520csz.js} +13 -12
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-k57h6qke.js → chunk-5fa4arn1.js} +12 -8
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-p74r4y6j.js → chunk-7dr4kybf.js} +481 -449
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-xhpp6qz8.js → chunk-9ct3xypr.js} +2552 -3780
- package/dist/{chunk-azss2d1n.js → chunk-9geh4c3v.js} +153 -155
- package/dist/{chunk-8hsk6f6b.js → chunk-9qf0eg7m.js} +19 -19
- package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
- package/dist/chunk-bcvx11fn.js +174 -0
- package/dist/{chunk-59arcerk.js → chunk-cyfeaz43.js} +86 -86
- package/dist/chunk-czq37rrt.js +286 -0
- package/dist/chunk-ec5z8bbq.js +126 -0
- package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
- package/dist/{chunk-gasw078g.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-y81cr6tp.js → chunk-k7xnsmp5.js} +158 -87
- package/dist/{chunk-zxzvketc.js → chunk-kbpkpxcn.js} +20 -19
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-0he2dx5n.js → chunk-p3s7cjfc.js} +15 -14
- package/dist/chunk-pq6hrtnb.js +49 -0
- package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
- package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
- package/dist/chunk-vyv8kvkv.js +113 -0
- package/dist/{chunk-h1v6w1fh.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-8kzaxz52.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- package/dist/client.js +62 -61
- package/dist/connectors/index.js +36 -37
- package/dist/contracts/artifact-markers.js +11 -12
- package/dist/contracts/artifacts.js +21 -23
- package/dist/contracts/automation-document/index.js +28 -30
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +95 -97
- package/dist/contracts/step-artifact-submissions.js +20 -17
- package/dist/contracts/work-item-changes.js +8 -6
- package/dist/defaults/index.js +22 -23
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- package/dist/definitions/steps/define-mcp.d.ts +2 -2
- package/dist/definitions/steps/index.js +93 -95
- package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
- package/dist/definitions/steps/step-definitions-client.d.ts +18 -0
- package/dist/definitions/validation/index.js +17 -18
- package/dist/devcontainer-config-path.js +9 -11
- package/dist/env-vars.js +37 -39
- package/dist/environment.js +41 -42
- package/dist/eslint.js +0 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +41 -1
- package/dist/generated/types.gen.d.ts +1801 -0
- package/dist/git-url/git-repo-identity.js +0 -2
- package/dist/health-checks.js +15 -17
- package/dist/index.js +364 -358
- package/dist/jsonc.js +7 -8
- package/dist/managed-connections.d.ts +16 -0
- package/dist/managed-connections.js +9 -0
- package/dist/managed-runtimes.js +9 -11
- package/dist/opencode-mcp.d.ts +55 -1
- package/dist/opencode-mcp.js +33 -28
- package/dist/pipelines/index.js +78 -81
- package/dist/push/code-step-lookup.js +9 -10
- package/dist/push/index.d.ts +1 -0
- package/dist/push/index.js +88 -59
- package/dist/push/push-from-directory.d.ts +3 -0
- package/dist/push/pushed-mcp-servers.d.ts +28 -0
- package/dist/repo-config.js +41 -43
- package/dist/resolve-environment.js +14 -15
- package/dist/scarn-config-parser.js +5 -6
- package/dist/task-plane-client.d.ts +137 -1
- package/package.json +6 -2
- package/dist/chunk-08gcnrzh.js +0 -96
- package/dist/chunk-5say64w8.js +0 -14
- package/dist/chunk-aph2js2v.js +0 -167
- package/dist/chunk-mrzn5tq4.js +0 -107
- package/dist/chunk-pwyj6qf3.js +0 -119
- package/dist/chunk-qt81x1pm.js +0 -275
- package/dist/chunk-vsp708vw.js +0 -167
- package/dist/chunk-y64skrwp.js +0 -17
- package/dist/chunk-y7ac1t9c.js +0 -39
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
devcontainerConfigPathSchema2
|
|
4
|
+
} from "./chunk-yypj3zn0.js";
|
|
5
|
+
import {
|
|
6
|
+
envVarsSchema2,
|
|
7
|
+
storedEnvVarsSchema2
|
|
8
|
+
} from "./chunk-vyv8kvkv.js";
|
|
9
|
+
import {
|
|
10
|
+
managedRuntimeIdSchema2
|
|
11
|
+
} from "./chunk-y4dwmhn2.js";
|
|
12
|
+
import {
|
|
13
|
+
connectorIdsSchema2,
|
|
14
|
+
findMissingConnectorVars2
|
|
15
|
+
} from "./chunk-3j5wf2t5.js";
|
|
16
|
+
import {
|
|
17
|
+
string,
|
|
18
|
+
number,
|
|
19
|
+
array,
|
|
20
|
+
object,
|
|
21
|
+
strictObject,
|
|
22
|
+
union,
|
|
23
|
+
discriminatedUnion,
|
|
24
|
+
literal
|
|
25
|
+
} from "./chunk-9ct3xypr.js";
|
|
26
|
+
|
|
27
|
+
// src/environment.ts
|
|
28
|
+
var environmentNameSchema2 = string().regex(/^[a-z0-9][a-z0-9-]*$/, "must match /^[a-z0-9][a-z0-9-]*$/");
|
|
29
|
+
var environmentRuntimeSchema2 = discriminatedUnion("kind", [
|
|
30
|
+
strictObject({
|
|
31
|
+
kind: literal("devcontainer"),
|
|
32
|
+
config: devcontainerConfigPathSchema2.optional()
|
|
33
|
+
}),
|
|
34
|
+
strictObject({
|
|
35
|
+
kind: literal("managed"),
|
|
36
|
+
id: managedRuntimeIdSchema2
|
|
37
|
+
}),
|
|
38
|
+
strictObject({ kind: literal("host") })
|
|
39
|
+
]);
|
|
40
|
+
var rejectEnvironmentBranch2 = (issue) => issue.code === "unrecognized_keys" && issue.keys.includes("branch") ? "environments have no branch; use the step's repo baseBranch" : undefined;
|
|
41
|
+
var environmentFieldsSchema2 = strictObject({
|
|
42
|
+
runtime: environmentRuntimeSchema2.optional(),
|
|
43
|
+
vars: envVarsSchema2.optional(),
|
|
44
|
+
connectors: connectorIdsSchema2.optional()
|
|
45
|
+
}, { error: rejectEnvironmentBranch2 });
|
|
46
|
+
var findHostSetupVar2 = ({
|
|
47
|
+
runtime,
|
|
48
|
+
vars
|
|
49
|
+
}) => runtime?.kind === "host" ? (vars ?? []).find((entry) => entry.applies !== "agent") : undefined;
|
|
50
|
+
var hostSetupVarMessage2 = (entry) => `env var "${entry.name}" applies to '${entry.applies}', but runtime 'host' has no container to set up; use 'agent'`;
|
|
51
|
+
var environmentContentSchema2 = environmentFieldsSchema2.extend({ description: string().optional() }).superRefine((value, context) => {
|
|
52
|
+
const setupVar = findHostSetupVar2(value);
|
|
53
|
+
if (setupVar !== undefined) {
|
|
54
|
+
context.addIssue({
|
|
55
|
+
code: "custom",
|
|
56
|
+
path: ["vars"],
|
|
57
|
+
message: hostSetupVarMessage2(setupVar)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
for (const { connector, vars } of findMissingConnectorVars2(value.connectors ?? [], value.vars ?? [])) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
path: ["connectors"],
|
|
64
|
+
message: `connector "${connector}" needs ${vars.join(", ")}; add them to the environment's vars`
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
function rejectHostSetupVars(vars, ctx, path) {
|
|
69
|
+
for (const entry of vars) {
|
|
70
|
+
if (entry.applies !== "agent") {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: "custom",
|
|
73
|
+
path: [...path, entry.name, "applies"],
|
|
74
|
+
message: `env "${entry.name}": applies "${entry.applies}" needs a container to set up; host has none`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var namedEnvironmentRefSchema = strictObject({
|
|
80
|
+
kind: literal("named"),
|
|
81
|
+
name: environmentNameSchema2
|
|
82
|
+
});
|
|
83
|
+
var inlineEnvironmentRefSchema = strictObject({
|
|
84
|
+
kind: literal("inline"),
|
|
85
|
+
runtime: environmentRuntimeSchema2.optional(),
|
|
86
|
+
envJson: envVarsSchema2.nullish(),
|
|
87
|
+
connectors: connectorIdsSchema2.optional()
|
|
88
|
+
}, { error: rejectEnvironmentBranch2 });
|
|
89
|
+
function rejectHostSetupRef(ref, ctx) {
|
|
90
|
+
if (ref.kind === "inline" && ref.runtime?.kind === "host") {
|
|
91
|
+
rejectHostSetupVars(ref.envJson ?? [], ctx, ["envJson"]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
var environmentRefSchema2 = discriminatedUnion("kind", [
|
|
95
|
+
namedEnvironmentRefSchema,
|
|
96
|
+
inlineEnvironmentRefSchema
|
|
97
|
+
]).superRefine(rejectHostSetupRef).nullable();
|
|
98
|
+
var inlineEnvironmentRefReadSchema = inlineEnvironmentRefSchema.extend({
|
|
99
|
+
envJson: storedEnvVarsSchema2.nullish()
|
|
100
|
+
});
|
|
101
|
+
var environmentRefReadSchema2 = discriminatedUnion("kind", [
|
|
102
|
+
namedEnvironmentRefSchema,
|
|
103
|
+
inlineEnvironmentRefReadSchema
|
|
104
|
+
]).superRefine(rejectHostSetupRef).nullable();
|
|
105
|
+
var inlineEnvironmentReadSchema2 = inlineEnvironmentRefReadSchema.superRefine(rejectHostSetupRef).nullable();
|
|
106
|
+
var storedEnvironmentRuntimeSchema2 = discriminatedUnion("kind", [
|
|
107
|
+
object({
|
|
108
|
+
kind: literal("devcontainer"),
|
|
109
|
+
config: string().optional()
|
|
110
|
+
}),
|
|
111
|
+
object({ kind: literal("managed"), id: managedRuntimeIdSchema2 }),
|
|
112
|
+
object({ kind: literal("host") })
|
|
113
|
+
]);
|
|
114
|
+
var storedEnvironmentFieldsSchema2 = object({
|
|
115
|
+
runtime: storedEnvironmentRuntimeSchema2.optional(),
|
|
116
|
+
vars: storedEnvVarsSchema2.optional(),
|
|
117
|
+
connectors: array(string()).optional()
|
|
118
|
+
});
|
|
119
|
+
var storedEnvironmentContentSchema2 = storedEnvironmentFieldsSchema2.extend({
|
|
120
|
+
description: string().optional()
|
|
121
|
+
});
|
|
122
|
+
var resolvedEnvironmentRefSchema2 = union([
|
|
123
|
+
strictObject({
|
|
124
|
+
kind: literal("inline"),
|
|
125
|
+
runtime: environmentRuntimeSchema2.optional(),
|
|
126
|
+
envJson: storedEnvVarsSchema2.nullish(),
|
|
127
|
+
connectors: array(string()).optional()
|
|
128
|
+
}),
|
|
129
|
+
strictObject({
|
|
130
|
+
kind: literal("named"),
|
|
131
|
+
name: environmentNameSchema2,
|
|
132
|
+
version: number().int().positive(),
|
|
133
|
+
content: storedEnvironmentContentSchema2
|
|
134
|
+
}),
|
|
135
|
+
strictObject({
|
|
136
|
+
kind: literal("named"),
|
|
137
|
+
name: environmentNameSchema2,
|
|
138
|
+
notFound: literal(true)
|
|
139
|
+
})
|
|
140
|
+
]).nullable();
|
|
141
|
+
|
|
142
|
+
class EnvironmentNotFound2 extends Error {
|
|
143
|
+
environmentName;
|
|
144
|
+
kind = "EnvironmentNotFound";
|
|
145
|
+
code = "SCARN_ENVIRONMENT_NOT_FOUND";
|
|
146
|
+
constructor(environmentName) {
|
|
147
|
+
super(`Environment not found: ${environmentName}`);
|
|
148
|
+
this.environmentName = environmentName;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
class EnvironmentInvalid2 extends Error {
|
|
153
|
+
environment;
|
|
154
|
+
issues;
|
|
155
|
+
kind = "EnvironmentInvalid";
|
|
156
|
+
code = "SCARN_ENVIRONMENT_INVALID";
|
|
157
|
+
constructor(environment, issues) {
|
|
158
|
+
super(`Invalid ${environment ?? "environment reference"}: ${issues.map((issue) => `${issue.path.join(".") || "<root>"}: ${issue.message}`).join("; ")}`);
|
|
159
|
+
this.environment = environment;
|
|
160
|
+
this.issues = issues;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
class BrokenDevcontainerReference2 extends Error {
|
|
165
|
+
configPath;
|
|
166
|
+
kind = "BrokenDevcontainerReference";
|
|
167
|
+
code = "SCARN_DEVCONTAINER_REFERENCE_BROKEN";
|
|
168
|
+
constructor(configPath, discoveryPaths) {
|
|
169
|
+
super(discoveryPaths ? `Devcontainer auto-discovery found no config; checked: ${discoveryPaths.join(", ")}` : `Devcontainer config not found: ${configPath}`);
|
|
170
|
+
this.configPath = configPath;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { environmentNameSchema2, environmentRuntimeSchema2, rejectEnvironmentBranch2, environmentFieldsSchema2, findHostSetupVar2, hostSetupVarMessage2, environmentContentSchema2, environmentRefSchema2, environmentRefReadSchema2, inlineEnvironmentReadSchema2, storedEnvironmentRuntimeSchema2, storedEnvironmentFieldsSchema2, storedEnvironmentContentSchema2, resolvedEnvironmentRefSchema2, EnvironmentNotFound2, EnvironmentInvalid2, BrokenDevcontainerReference2 };
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
captureSite,
|
|
4
|
+
PipelineBuildError2,
|
|
5
|
+
AuthoringError,
|
|
6
|
+
pipelineOn,
|
|
7
|
+
pendingChains,
|
|
8
|
+
registerNode,
|
|
9
|
+
registerTarget,
|
|
10
|
+
registerEach,
|
|
11
|
+
nodeOf,
|
|
12
|
+
targetOf,
|
|
13
|
+
eachOf,
|
|
14
|
+
chainOf,
|
|
15
|
+
requireNode
|
|
16
|
+
} from "./chunk-aqqywy8g.js";
|
|
17
|
+
import {
|
|
18
|
+
withOwners,
|
|
19
|
+
withTracker,
|
|
20
|
+
rootPlaceholder,
|
|
21
|
+
refData,
|
|
22
|
+
useRef,
|
|
23
|
+
unusedReads,
|
|
4
24
|
ConditionData,
|
|
5
|
-
|
|
6
|
-
attempt,
|
|
7
|
-
compileArg,
|
|
8
|
-
compileCondition,
|
|
25
|
+
ComputedData,
|
|
9
26
|
conditionData,
|
|
27
|
+
requireRef,
|
|
28
|
+
compileCondition,
|
|
29
|
+
compileArg,
|
|
30
|
+
argEntries,
|
|
31
|
+
newState,
|
|
10
32
|
issue,
|
|
11
33
|
mapSource,
|
|
12
|
-
|
|
13
|
-
place
|
|
14
|
-
|
|
15
|
-
requireRef,
|
|
16
|
-
rootPlaceholder,
|
|
17
|
-
unusedReads,
|
|
18
|
-
useRef,
|
|
19
|
-
withOwners,
|
|
20
|
-
withTracker
|
|
21
|
-
} from "./chunk-mp2rqtcj.js";
|
|
22
|
-
import {
|
|
23
|
-
bareStepHandle,
|
|
24
|
-
waitHandle
|
|
25
|
-
} from "./chunk-xqfj56m9.js";
|
|
34
|
+
attempt,
|
|
35
|
+
place
|
|
36
|
+
} from "./chunk-ptpy7nnm.js";
|
|
26
37
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
chainOf,
|
|
31
|
-
eachOf,
|
|
32
|
-
nodeOf,
|
|
33
|
-
pendingChains,
|
|
34
|
-
pipelineOn,
|
|
35
|
-
registerEach,
|
|
36
|
-
registerNode,
|
|
37
|
-
registerTarget,
|
|
38
|
-
requireNode,
|
|
39
|
-
targetOf
|
|
40
|
-
} from "./chunk-y11p1q7r.js";
|
|
38
|
+
waitHandle,
|
|
39
|
+
bareStepHandle
|
|
40
|
+
} from "./chunk-vn1rfxma.js";
|
|
41
41
|
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} from "./chunk-
|
|
42
|
+
decisionResultSchema2,
|
|
43
|
+
REPLY_RESULT_SCHEMA2,
|
|
44
|
+
CONVERSATION_RESULT_SCHEMA2,
|
|
45
|
+
REPLY_INPUT_SCHEMA2,
|
|
46
|
+
ERROR_SCHEMA2
|
|
47
|
+
} from "./chunk-7anj08zc.js";
|
|
48
48
|
import {
|
|
49
49
|
toJSONSchema
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-9ct3xypr.js";
|
|
51
51
|
|
|
52
52
|
// src/pipelines/context.ts
|
|
53
53
|
function schemaOf(node, source) {
|
|
54
54
|
if (node.kind === "step") {
|
|
55
55
|
if (source === "result" && node.conversation) {
|
|
56
|
-
return
|
|
56
|
+
return CONVERSATION_RESULT_SCHEMA2;
|
|
57
57
|
}
|
|
58
58
|
return (source === "result" ? node.resultSchema : node.inputSchema) ?? undefined;
|
|
59
59
|
}
|
|
@@ -89,7 +89,7 @@ function makeContext(node, kind) {
|
|
|
89
89
|
});
|
|
90
90
|
} else {
|
|
91
91
|
Object.defineProperties(context, {
|
|
92
|
-
error: owned("error",
|
|
92
|
+
error: owned("error", ERROR_SCHEMA2),
|
|
93
93
|
input: owned("input", schemaOf(node, "input"))
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -225,8 +225,8 @@ function wireBody(state, chain, json) {
|
|
|
225
225
|
}
|
|
226
226
|
const catches = chain.catch.map((entry, index) => {
|
|
227
227
|
const pointer = ["nodes", id, "catch", index];
|
|
228
|
-
const
|
|
229
|
-
const target = compileTransition(state, entry.target,
|
|
228
|
+
const context = makeContext(chain.node, "catch");
|
|
229
|
+
const target = compileTransition(state, entry.target, context, pointer, entry.site, "catch");
|
|
230
230
|
return { on: [...entry.on], ...target };
|
|
231
231
|
});
|
|
232
232
|
if (catches.length > 0) {
|
|
@@ -242,9 +242,9 @@ function wireBody(state, chain, json) {
|
|
|
242
242
|
const entry = {};
|
|
243
243
|
const { when, target, label, overridable } = route;
|
|
244
244
|
if (when !== undefined) {
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
247
|
-
entry["when"] =
|
|
245
|
+
const compiled = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
|
|
246
|
+
if (compiled !== undefined) {
|
|
247
|
+
entry["when"] = compiled;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
const compiled = compileTransition(state, target, context, pointer, next.site, "next");
|
|
@@ -434,7 +434,7 @@ function compile(config, site) {
|
|
|
434
434
|
const fields = workItemFields(state);
|
|
435
435
|
const warnings = unusedChainWarnings(state);
|
|
436
436
|
if (state.issues.length > 0 || start === undefined) {
|
|
437
|
-
throw new
|
|
437
|
+
throw new PipelineBuildError2(config.key, state.issues);
|
|
438
438
|
}
|
|
439
439
|
const nodes = {};
|
|
440
440
|
for (const [id, placed] of orderedNodes(state)) {
|
|
@@ -465,14 +465,14 @@ function compile(config, site) {
|
|
|
465
465
|
});
|
|
466
466
|
return definition;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function definePipeline2(config) {
|
|
469
469
|
return compile(config, captureSite());
|
|
470
470
|
}
|
|
471
471
|
// src/pipelines/nodes.ts
|
|
472
472
|
function inputSchemaJson(input) {
|
|
473
473
|
return input === undefined ? null : toJSONSchema(input);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function decision2(id, options) {
|
|
476
476
|
const actions = Object.entries(options.actions).map(([key, action]) => ({
|
|
477
477
|
key,
|
|
478
478
|
label: action.label,
|
|
@@ -484,11 +484,11 @@ function decision(id, options) {
|
|
|
484
484
|
for: "decision",
|
|
485
485
|
actions,
|
|
486
486
|
inputSchema: inputSchemaJson(options.input),
|
|
487
|
-
resultSchema:
|
|
487
|
+
resultSchema: decisionResultSchema2(actions),
|
|
488
488
|
site: captureSite()
|
|
489
489
|
});
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function reply2(id) {
|
|
492
492
|
return waitHandle({
|
|
493
493
|
kind: "wait",
|
|
494
494
|
id,
|
|
@@ -496,10 +496,10 @@ function reply(id) {
|
|
|
496
496
|
actions: null,
|
|
497
497
|
inputSchema: {
|
|
498
498
|
type: "object",
|
|
499
|
-
properties: { questions:
|
|
499
|
+
properties: { questions: REPLY_INPUT_SCHEMA2 },
|
|
500
500
|
required: ["questions"]
|
|
501
501
|
},
|
|
502
|
-
resultSchema:
|
|
502
|
+
resultSchema: REPLY_RESULT_SCHEMA2,
|
|
503
503
|
site: captureSite()
|
|
504
504
|
});
|
|
505
505
|
}
|
|
@@ -513,7 +513,7 @@ function terminal(node) {
|
|
|
513
513
|
site: node.site
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function succeed2(id, options = {}) {
|
|
517
517
|
return terminal({
|
|
518
518
|
kind: "succeed",
|
|
519
519
|
id,
|
|
@@ -522,7 +522,7 @@ function succeed(id, options = {}) {
|
|
|
522
522
|
site: captureSite()
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function fail2(id, options = {}) {
|
|
526
526
|
return terminal({
|
|
527
527
|
kind: "fail",
|
|
528
528
|
id,
|
|
@@ -533,10 +533,10 @@ function fail(id, options = {}) {
|
|
|
533
533
|
site: captureSite()
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function stepRef2(key) {
|
|
537
537
|
return bareStepHandle({ key, inputSchemaJson: null, resultSchemaJson: null, errors: [] }, false);
|
|
538
538
|
}
|
|
539
|
-
var
|
|
539
|
+
var workItem2 = {
|
|
540
540
|
get title() {
|
|
541
541
|
return rootPlaceholder("workItem.title", {
|
|
542
542
|
type: "string"
|
|
@@ -548,13 +548,13 @@ var workItem = {
|
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
|
-
function
|
|
551
|
+
function workItemField2(alias, label) {
|
|
552
552
|
return rootPlaceholder(`workItem.fields.${alias}`, undefined, {
|
|
553
553
|
field: { alias, label }
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
556
|
// src/pipelines/each.ts
|
|
557
|
-
function
|
|
557
|
+
function each2(over, second, third) {
|
|
558
558
|
const data = refData(over);
|
|
559
559
|
if (data === undefined) {
|
|
560
560
|
throw new AuthoringError("each needs an array reference to iterate over");
|
|
@@ -602,55 +602,55 @@ function compare(op, left, value) {
|
|
|
602
602
|
right: value === NO_RIGHT ? { kind: "none" } : right(value)
|
|
603
603
|
}));
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function equal2(left, value) {
|
|
606
606
|
return compare("equal", left, value);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function notEqual2(left, value) {
|
|
609
609
|
return compare("notEqual", left, value);
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function lessThan2(left, value) {
|
|
612
612
|
return compare("lessThan", left, value);
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function lessThanInclusive2(left, value) {
|
|
615
615
|
return compare("lessThanInclusive", left, value);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function greaterThan2(left, value) {
|
|
618
618
|
return compare("greaterThan", left, value);
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function greaterThanInclusive2(left, value) {
|
|
621
621
|
return compare("greaterThanInclusive", left, value);
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function exists2(left) {
|
|
624
624
|
return compare("exists", left, NO_RIGHT);
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function isEmpty2(left) {
|
|
627
627
|
return compare("isEmpty", left, NO_RIGHT);
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function contains2(left, value) {
|
|
630
630
|
return compare("contains", left, value);
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function startsWith2(left, value) {
|
|
633
633
|
return compare("startsWith", left, value);
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function endsWith2(left, value) {
|
|
636
636
|
return compare("endsWith", left, value);
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function matches2(left, pattern) {
|
|
639
639
|
return compare("matches", left, pattern);
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function before2(left, date) {
|
|
642
642
|
return compare("before", left, date);
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function after2(left, date) {
|
|
645
645
|
return compare("after", left, date);
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function all2(...conditions) {
|
|
648
648
|
return toCondition(new ConditionData({ kind: "all", items: conditions.map(conditionData) }));
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function any2(...conditions) {
|
|
651
651
|
return toCondition(new ConditionData({ kind: "any", items: conditions.map(conditionData) }));
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function not2(condition) {
|
|
654
654
|
return toCondition(new ConditionData({ kind: "not", item: conditionData(condition) }));
|
|
655
655
|
}
|
|
656
656
|
function element(list) {
|
|
@@ -670,13 +670,13 @@ function list(op, over, where) {
|
|
|
670
670
|
where: conditionData(where(item))
|
|
671
671
|
}));
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function some2(over, where) {
|
|
674
674
|
return list("some", over, where);
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function every2(over, where) {
|
|
677
677
|
return list("every", over, where);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function none2(over, where) {
|
|
680
680
|
return list("none", over, where);
|
|
681
681
|
}
|
|
682
682
|
function reduce(fn, source, field, weights) {
|
|
@@ -694,19 +694,19 @@ function reduce(fn, source, field, weights) {
|
|
|
694
694
|
field: requireRef(select(field, element(data)), `the field of "${fn}"`)
|
|
695
695
|
}));
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function sum2(source, field) {
|
|
698
698
|
return reduce("sum", source, field);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function avg2(source, second) {
|
|
701
701
|
return typeof second === "function" ? reduce("avg", source, second) : reduce("avg", source, undefined, second?.weights);
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function min2(source, field) {
|
|
704
704
|
return reduce("min", source, field);
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function max2(source, field) {
|
|
707
707
|
return reduce("max", source, field);
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function count2(source, where) {
|
|
710
710
|
if (Array.isArray(source)) {
|
|
711
711
|
const refs = source.map((value) => requireRef(value, 'each value of "count"'));
|
|
712
712
|
return toComputed(new ComputedData({ fn: "count", refs }));
|
|
@@ -718,4 +718,4 @@ function count(source, where) {
|
|
|
718
718
|
where: conditionData(select(where, element(data)))
|
|
719
719
|
}));
|
|
720
720
|
}
|
|
721
|
-
export {
|
|
721
|
+
export { definePipeline2, decision2, reply2, succeed2, fail2, stepRef2, workItem2, workItemField2, each2, equal2, notEqual2, lessThan2, lessThanInclusive2, greaterThan2, greaterThanInclusive2, exists2, isEmpty2, contains2, startsWith2, endsWith2, matches2, before2, after2, all2, any2, not2, some2, every2, none2, sum2, avg2, min2, max2, count2 };
|