@scarn/sdk 0.0.0-stage → 0.8.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/chunk-0y2fy5en.js +166 -0
- package/dist/chunk-3ctaaseb.js +1456 -0
- package/dist/chunk-4ggr8af6.js +30 -0
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/chunk-700xe701.js +100 -0
- package/dist/chunk-ar6hcj1r.js +35 -0
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/chunk-gds7w7zh.js +330 -0
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/chunk-mz53r914.js +300 -0
- package/dist/chunk-ngy1fdcx.js +57 -0
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/chunk-rt9tq4j6.js +116 -0
- package/dist/chunk-skzxcba3.js +14282 -0
- package/dist/chunk-vfeytkqx.js +1687 -0
- package/dist/chunk-y2pv8d6a.js +162 -0
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/chunk-yjtaq94c.js +1094 -0
- package/dist/chunk-zm72ksz0.js +256 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +58 -0
- package/dist/contracts/artifact-markers.d.ts +42 -0
- package/dist/contracts/artifact-markers.js +16 -0
- package/dist/contracts/artifacts.d.ts +67 -0
- package/dist/contracts/artifacts.js +27 -0
- package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
- package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
- package/dist/contracts/pipeline-document/index.d.ts +11 -0
- package/dist/contracts/pipeline-document/index.js +99 -0
- package/dist/contracts/pipeline-document/json.d.ts +35 -0
- package/dist/contracts/pipeline-document/routes.d.ts +16 -0
- package/dist/contracts/pipeline-document/schema.d.ts +780 -0
- package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
- package/dist/contracts/step-artifact-submissions.d.ts +71 -0
- package/dist/contracts/step-artifact-submissions.js +171 -0
- package/dist/defaults/atomic-json-file.d.ts +10 -0
- package/dist/defaults/auth-file.d.ts +14 -0
- package/dist/defaults/base-url.d.ts +1 -0
- package/dist/defaults/config-file.d.ts +46 -0
- package/dist/defaults/home-dir.d.ts +3 -0
- package/dist/defaults/index.d.ts +12 -0
- package/dist/defaults/index.js +1240 -0
- package/dist/defaults/legacy-config-migration.d.ts +27 -0
- package/dist/defaults/load-push-defaults.d.ts +25 -0
- package/dist/defaults/project-config.d.ts +32 -0
- package/dist/defaults/project-ref.d.ts +34 -0
- package/dist/definitions/artifacts/artifact.d.ts +62 -0
- package/dist/definitions/artifacts/index.d.ts +1 -0
- package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
- package/dist/definitions/pipelines/index.d.ts +3 -0
- package/dist/definitions/pipelines/index.js +26 -0
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
- package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
- package/dist/definitions/steps/compile-mcps.d.ts +34 -0
- package/dist/definitions/steps/define-code-step.d.ts +84 -0
- package/dist/definitions/steps/define-mcp.d.ts +79 -0
- package/dist/definitions/steps/define-step.d.ts +137 -0
- package/dist/definitions/steps/env.d.ts +136 -0
- package/dist/definitions/steps/index.d.ts +14 -0
- package/dist/definitions/steps/index.js +76 -0
- package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
- package/dist/definitions/steps/prompt-template.d.ts +24 -0
- package/dist/definitions/steps/repo.d.ts +67 -0
- package/dist/definitions/steps/runtime.d.ts +115 -0
- package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
- package/dist/definitions/steps/step-features.d.ts +109 -0
- package/dist/definitions/steps/step-handle.d.ts +25 -0
- package/dist/definitions/steps/step-ref.d.ts +19 -0
- package/dist/definitions/validation/index.d.ts +2 -0
- package/dist/definitions/validation/index.js +19 -0
- package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
- package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
- package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
- package/dist/definitions/validation/validate-env.d.ts +15 -0
- package/dist/definitions/validation/validate-repo.d.ts +13 -0
- package/dist/definitions/validation/validate-runtime.d.ts +12 -0
- package/dist/definitions/validation/validation-issue.d.ts +11 -0
- package/dist/devcontainer-config-path.d.ts +21 -0
- package/dist/devcontainer-config-path.js +15 -0
- package/dist/env-vars.d.ts +136 -0
- package/dist/env-vars.js +37 -0
- package/dist/eslint.d.ts +42 -0
- package/dist/eslint.js +127 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +302 -0
- package/dist/generated/types.gen.d.ts +18375 -0
- package/dist/git-url/git-remote.d.ts +30 -0
- package/dist/git-url/git-repo-identity.d.ts +44 -0
- package/dist/git-url/git-repo-identity.js +161 -0
- package/dist/git-url/parse-git-host.d.ts +23 -0
- package/dist/health-checks.d.ts +169 -0
- package/dist/health-checks.js +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +296 -0
- package/dist/jsonc.d.ts +3 -0
- package/dist/jsonc.js +12 -0
- package/dist/managed-runtimes.d.ts +20 -0
- package/dist/managed-runtimes.js +15 -0
- package/dist/opencode-mcp.d.ts +313 -0
- package/dist/opencode-mcp.js +31 -0
- package/dist/pipelines/chain.d.ts +7 -0
- package/dist/pipelines/compile-args.d.ts +12 -0
- package/dist/pipelines/compile-chain.d.ts +9 -0
- package/dist/pipelines/compile-checks.d.ts +16 -0
- package/dist/pipelines/compile-state.d.ts +30 -0
- package/dist/pipelines/condition-data.d.ts +78 -0
- package/dist/pipelines/conditions.d.ts +47 -0
- package/dist/pipelines/context.d.ts +16 -0
- package/dist/pipelines/define-pipeline.d.ts +32 -0
- package/dist/pipelines/each.d.ts +5 -0
- package/dist/pipelines/errors.d.ts +26 -0
- package/dist/pipelines/handles.d.ts +29 -0
- package/dist/pipelines/index.d.ts +18 -0
- package/dist/pipelines/index.js +83 -0
- package/dist/pipelines/model.d.ts +103 -0
- package/dist/pipelines/nodes.d.ts +54 -0
- package/dist/pipelines/ref-types.d.ts +54 -0
- package/dist/pipelines/refs.d.ts +80 -0
- package/dist/pipelines/registry.d.ts +12 -0
- package/dist/pipelines/source.d.ts +17 -0
- package/dist/pipelines/types.d.ts +160 -0
- package/dist/push/code-step-lookup.d.ts +32 -0
- package/dist/push/code-step-lookup.js +12 -0
- package/dist/push/collect-definitions.d.ts +70 -0
- package/dist/push/collect-pipeline-documents.d.ts +14 -0
- package/dist/push/index.d.ts +6 -0
- package/dist/push/index.js +327 -0
- package/dist/push/push-from-directory.d.ts +37 -0
- package/dist/repo-config.d.ts +80 -0
- package/dist/repo-config.js +25 -0
- package/dist/scarn-config-parser.d.ts +29 -0
- package/dist/scarn-config-parser.js +10 -0
- package/dist/task-plane-client.d.ts +489 -0
- package/dist/z.d.ts +7 -0
- package/package.json +132 -4
- package/README.md +0 -3
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
exports_external
|
|
4
|
+
} from "./chunk-skzxcba3.js";
|
|
5
|
+
|
|
6
|
+
// src/contracts/pipeline-document/json.ts
|
|
7
|
+
function isJsonObject(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function escapePointerSegment(segment) {
|
|
11
|
+
return String(segment).replaceAll("~", "~0").replaceAll("/", "~1");
|
|
12
|
+
}
|
|
13
|
+
function jsonPointer(segments) {
|
|
14
|
+
return segments.map((segment) => `/${escapePointerSegment(segment)}`).join("");
|
|
15
|
+
}
|
|
16
|
+
function deepEqual(left, right) {
|
|
17
|
+
if (left === right) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(left)) {
|
|
21
|
+
return Array.isArray(right) && left.length === right.length && left.every((item, index) => deepEqual(item, right[index]));
|
|
22
|
+
}
|
|
23
|
+
if (isJsonObject(left) && isJsonObject(right)) {
|
|
24
|
+
const leftKeys = Object.keys(left);
|
|
25
|
+
const rightKeys = Object.keys(right);
|
|
26
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
// src/contracts/pipeline-document/conditions/operators.ts
|
|
31
|
+
var COMPARISON_OPERATORS = [
|
|
32
|
+
"equal",
|
|
33
|
+
"notEqual",
|
|
34
|
+
"lessThan",
|
|
35
|
+
"lessThanInclusive",
|
|
36
|
+
"greaterThan",
|
|
37
|
+
"greaterThanInclusive"
|
|
38
|
+
];
|
|
39
|
+
var CONDITION_OPERATORS = [
|
|
40
|
+
...COMPARISON_OPERATORS,
|
|
41
|
+
"exists",
|
|
42
|
+
"isEmpty",
|
|
43
|
+
"contains",
|
|
44
|
+
"startsWith",
|
|
45
|
+
"endsWith",
|
|
46
|
+
"matches",
|
|
47
|
+
"before",
|
|
48
|
+
"after",
|
|
49
|
+
"some",
|
|
50
|
+
"every",
|
|
51
|
+
"none"
|
|
52
|
+
];
|
|
53
|
+
var COMPUTED_FUNCTIONS = [
|
|
54
|
+
"sum",
|
|
55
|
+
"avg",
|
|
56
|
+
"min",
|
|
57
|
+
"max",
|
|
58
|
+
"count"
|
|
59
|
+
];
|
|
60
|
+
var ORDERING_OPERATORS = new Set([
|
|
61
|
+
"lessThan",
|
|
62
|
+
"lessThanInclusive",
|
|
63
|
+
"greaterThan",
|
|
64
|
+
"greaterThanInclusive"
|
|
65
|
+
]);
|
|
66
|
+
var STRING_OPERATORS = new Set([
|
|
67
|
+
"startsWith",
|
|
68
|
+
"endsWith",
|
|
69
|
+
"matches"
|
|
70
|
+
]);
|
|
71
|
+
var DATE_OPERATORS = new Set(["before", "after"]);
|
|
72
|
+
var LIST_OPERATORS = new Set(["some", "every", "none"]);
|
|
73
|
+
|
|
74
|
+
// src/contracts/pipeline-document/schema.ts
|
|
75
|
+
var NODE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
76
|
+
var ALIAS_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
77
|
+
var nodeIdSchema = exports_external.string().regex(NODE_ID_PATTERN, "Node ids may only contain letters, digits, '_' and '-'");
|
|
78
|
+
var jsonValueSchema = exports_external.json();
|
|
79
|
+
var literalSchema = exports_external.strictObject({ value: jsonValueSchema });
|
|
80
|
+
var scalarArgSchema = exports_external.union([exports_external.string().min(1), literalSchema]);
|
|
81
|
+
var listSchema = exports_external.strictObject({ list: exports_external.array(scalarArgSchema) });
|
|
82
|
+
var argValueSchema = exports_external.union([
|
|
83
|
+
exports_external.string().min(1),
|
|
84
|
+
literalSchema,
|
|
85
|
+
listSchema
|
|
86
|
+
]);
|
|
87
|
+
var computedSourceSchema = exports_external.union([
|
|
88
|
+
exports_external.array(exports_external.string().min(1)).min(1),
|
|
89
|
+
exports_external.strictObject({
|
|
90
|
+
path: exports_external.string().min(1),
|
|
91
|
+
field: exports_external.string().min(1).optional(),
|
|
92
|
+
get where() {
|
|
93
|
+
return conditionSchema.optional();
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
]);
|
|
97
|
+
var LIST_OPS = new Set(["some", "every", "none"]);
|
|
98
|
+
var UNARY_OPS = new Set(["exists", "isEmpty"]);
|
|
99
|
+
var conditionSchema = exports_external.strictObject({
|
|
100
|
+
get all() {
|
|
101
|
+
return exports_external.array(conditionSchema).min(1).optional();
|
|
102
|
+
},
|
|
103
|
+
get any() {
|
|
104
|
+
return exports_external.array(conditionSchema).min(1).optional();
|
|
105
|
+
},
|
|
106
|
+
get not() {
|
|
107
|
+
return conditionSchema.optional();
|
|
108
|
+
},
|
|
109
|
+
path: exports_external.string().min(1).optional(),
|
|
110
|
+
sum: computedSourceSchema.optional(),
|
|
111
|
+
avg: computedSourceSchema.optional(),
|
|
112
|
+
min: computedSourceSchema.optional(),
|
|
113
|
+
max: computedSourceSchema.optional(),
|
|
114
|
+
count: computedSourceSchema.optional(),
|
|
115
|
+
weights: exports_external.array(exports_external.number()).min(1).optional(),
|
|
116
|
+
op: exports_external.enum(CONDITION_OPERATORS).optional(),
|
|
117
|
+
value: jsonValueSchema.optional(),
|
|
118
|
+
ref: exports_external.string().min(1).optional(),
|
|
119
|
+
get where() {
|
|
120
|
+
return conditionSchema.optional();
|
|
121
|
+
}
|
|
122
|
+
}).superRefine((condition, ctx) => {
|
|
123
|
+
const combinators = ["all", "any", "not"].filter((key) => condition[key] !== undefined);
|
|
124
|
+
const lefts = ["path", ...COMPUTED_FUNCTIONS].filter((key) => condition[key] !== undefined);
|
|
125
|
+
if (combinators.length > 0) {
|
|
126
|
+
const extras = Object.keys(condition).filter((key) => key !== combinators[0]);
|
|
127
|
+
if (combinators.length > 1 || extras.length > 0) {
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
code: "custom",
|
|
130
|
+
message: `A condition with "${String(combinators[0])}" can't have other keys (found ${[...combinators.slice(1), ...extras].map((key) => `"${key}"`).join(", ")})`
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (lefts.length !== 1) {
|
|
136
|
+
ctx.addIssue({
|
|
137
|
+
code: "custom",
|
|
138
|
+
message: lefts.length === 0 ? 'A condition needs exactly one of "path", "sum", "avg", "min", "max", "count", or a combinator "all", "any", "not"' : `A condition can have only one of ${lefts.map((key) => `"${key}"`).join(", ")}`
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (condition.op === undefined) {
|
|
143
|
+
ctx.addIssue({
|
|
144
|
+
code: "custom",
|
|
145
|
+
message: 'A condition needs "op"',
|
|
146
|
+
path: ["op"]
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const isList = LIST_OPS.has(condition.op);
|
|
151
|
+
const isUnary = UNARY_OPS.has(condition.op);
|
|
152
|
+
if (isList && condition.where === undefined) {
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: "custom",
|
|
155
|
+
message: `"${condition.op}" needs a "where" condition`,
|
|
156
|
+
path: ["where"]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (!isList && condition.where !== undefined) {
|
|
160
|
+
ctx.addIssue({
|
|
161
|
+
code: "custom",
|
|
162
|
+
message: `"where" is only allowed with "some", "every" or "none", not "${condition.op}"`,
|
|
163
|
+
path: ["where"]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const hasValue = condition.value !== undefined;
|
|
167
|
+
const hasRef = condition.ref !== undefined;
|
|
168
|
+
if ((isList || isUnary) && (hasValue || hasRef)) {
|
|
169
|
+
ctx.addIssue({
|
|
170
|
+
code: "custom",
|
|
171
|
+
message: `"${condition.op}" takes no "value" or "ref"`,
|
|
172
|
+
path: [hasValue ? "value" : "ref"]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (!isList && !isUnary && hasValue === hasRef) {
|
|
176
|
+
ctx.addIssue({
|
|
177
|
+
code: "custom",
|
|
178
|
+
message: `"${condition.op}" needs exactly one of "value" or "ref"`
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (condition.weights !== undefined && condition.avg === undefined) {
|
|
182
|
+
ctx.addIssue({
|
|
183
|
+
code: "custom",
|
|
184
|
+
message: '"weights" is only allowed with "avg"',
|
|
185
|
+
path: ["weights"]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
var toleratedFailuresSchema = exports_external.union([
|
|
190
|
+
exports_external.strictObject({ count: exports_external.int().nonnegative() }),
|
|
191
|
+
exports_external.strictObject({ percent: exports_external.number().min(0).max(100) })
|
|
192
|
+
]);
|
|
193
|
+
var eachSchema = exports_external.strictObject({
|
|
194
|
+
over: exports_external.string().min(1),
|
|
195
|
+
maxConcurrency: exports_external.int().positive().optional(),
|
|
196
|
+
toleratedFailures: toleratedFailuresSchema.optional()
|
|
197
|
+
});
|
|
198
|
+
var routeShape = {
|
|
199
|
+
when: conditionSchema.optional(),
|
|
200
|
+
to: nodeIdSchema,
|
|
201
|
+
pipeline: exports_external.string().min(1).optional(),
|
|
202
|
+
args: exports_external.record(exports_external.string().min(1), argValueSchema).optional(),
|
|
203
|
+
each: eachSchema.optional(),
|
|
204
|
+
partial: exports_external.literal(true).optional()
|
|
205
|
+
};
|
|
206
|
+
function noPartialWithEach(route, ctx) {
|
|
207
|
+
if (route.each !== undefined && route.partial !== undefined) {
|
|
208
|
+
ctx.addIssue({
|
|
209
|
+
code: "custom",
|
|
210
|
+
message: `A route can't have both "each" and "partial"`,
|
|
211
|
+
path: ["partial"]
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
var routeSchema = exports_external.strictObject(routeShape).superRefine(noPartialWithEach);
|
|
216
|
+
var otherwiseSchema = exports_external.strictObject(routeShape).omit({ when: true }).superRefine(noPartialWithEach);
|
|
217
|
+
var startSchema = exports_external.strictObject(routeShape).omit({ partial: true });
|
|
218
|
+
var MATCH_MODES = ["first", "all"];
|
|
219
|
+
var nextSchema = exports_external.strictObject({
|
|
220
|
+
match: exports_external.enum(MATCH_MODES).optional(),
|
|
221
|
+
routes: exports_external.array(routeSchema).min(1),
|
|
222
|
+
otherwise: otherwiseSchema.optional()
|
|
223
|
+
});
|
|
224
|
+
var retrySchema = exports_external.strictObject({
|
|
225
|
+
on: exports_external.array(exports_external.string().min(1)).min(1),
|
|
226
|
+
maxAttempts: exports_external.int().positive(),
|
|
227
|
+
intervalSeconds: exports_external.number().nonnegative().optional(),
|
|
228
|
+
backoffRate: exports_external.number().positive().optional(),
|
|
229
|
+
maxDelaySeconds: exports_external.number().nonnegative().optional()
|
|
230
|
+
});
|
|
231
|
+
var catchSchema = exports_external.strictObject({
|
|
232
|
+
on: exports_external.array(exports_external.string().min(1)).min(1),
|
|
233
|
+
to: nodeIdSchema,
|
|
234
|
+
pipeline: exports_external.string().min(1).optional(),
|
|
235
|
+
args: exports_external.record(exports_external.string().min(1), argValueSchema).optional()
|
|
236
|
+
});
|
|
237
|
+
var stepNodeSchema = exports_external.strictObject({
|
|
238
|
+
kind: exports_external.literal("step"),
|
|
239
|
+
title: exports_external.string().optional(),
|
|
240
|
+
step: exports_external.string().min(1),
|
|
241
|
+
next: nextSchema.optional(),
|
|
242
|
+
retry: exports_external.array(retrySchema).optional(),
|
|
243
|
+
catch: exports_external.array(catchSchema).optional(),
|
|
244
|
+
timeoutSeconds: exports_external.int().positive().optional(),
|
|
245
|
+
heartbeatSeconds: exports_external.int().positive().optional(),
|
|
246
|
+
maxRuns: exports_external.int().positive().optional(),
|
|
247
|
+
maxTurns: exports_external.int().nonnegative().optional()
|
|
248
|
+
});
|
|
249
|
+
var DEFAULT_MAX_TURNS = 2;
|
|
250
|
+
var DECISION_BODY_MODES = ["optional", "required"];
|
|
251
|
+
var decisionActionSchema = exports_external.strictObject({
|
|
252
|
+
key: exports_external.string().min(1),
|
|
253
|
+
label: exports_external.string().min(1),
|
|
254
|
+
body: exports_external.enum(DECISION_BODY_MODES).optional()
|
|
255
|
+
});
|
|
256
|
+
var waitNodeSchema = exports_external.strictObject({
|
|
257
|
+
kind: exports_external.literal("wait"),
|
|
258
|
+
title: exports_external.string().optional(),
|
|
259
|
+
for: exports_external.enum(["decision", "reply", "event", "timer"]),
|
|
260
|
+
actions: exports_external.array(decisionActionSchema).optional(),
|
|
261
|
+
next: nextSchema.optional(),
|
|
262
|
+
catch: exports_external.array(catchSchema).optional(),
|
|
263
|
+
timeoutSeconds: exports_external.int().positive().optional(),
|
|
264
|
+
maxRuns: exports_external.int().positive().optional()
|
|
265
|
+
});
|
|
266
|
+
var succeedNodeSchema = exports_external.strictObject({
|
|
267
|
+
kind: exports_external.literal("succeed"),
|
|
268
|
+
title: exports_external.string().optional()
|
|
269
|
+
});
|
|
270
|
+
var failNodeSchema = exports_external.strictObject({
|
|
271
|
+
kind: exports_external.literal("fail"),
|
|
272
|
+
title: exports_external.string().optional(),
|
|
273
|
+
error: exports_external.string().min(1).optional(),
|
|
274
|
+
cause: exports_external.string().optional()
|
|
275
|
+
});
|
|
276
|
+
var nodeSchema = exports_external.discriminatedUnion("kind", [
|
|
277
|
+
stepNodeSchema,
|
|
278
|
+
waitNodeSchema,
|
|
279
|
+
succeedNodeSchema,
|
|
280
|
+
failNodeSchema
|
|
281
|
+
]);
|
|
282
|
+
var pipelineDocumentSchema = exports_external.strictObject({
|
|
283
|
+
$schema: exports_external.string().optional(),
|
|
284
|
+
schemaVersion: exports_external.literal(1),
|
|
285
|
+
key: exports_external.string().min(1),
|
|
286
|
+
title: exports_external.string().optional(),
|
|
287
|
+
timeoutSeconds: exports_external.int().positive().optional(),
|
|
288
|
+
workItemFields: exports_external.record(exports_external.string().regex(ALIAS_PATTERN, "Aliases must be identifiers (letters, digits, '_')"), exports_external.string().min(1)).optional(),
|
|
289
|
+
start: startSchema,
|
|
290
|
+
nodes: exports_external.record(nodeIdSchema, nodeSchema)
|
|
291
|
+
});
|
|
292
|
+
function pipelineDocumentJsonSchema() {
|
|
293
|
+
return exports_external.toJSONSchema(pipelineDocumentSchema, { io: "input" });
|
|
294
|
+
}
|
|
295
|
+
// src/contracts/pipeline-document/routes.ts
|
|
296
|
+
function routeEntries(next) {
|
|
297
|
+
if (next === undefined) {
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
const entries = next.routes.map((route, index) => ({
|
|
301
|
+
kind: "route",
|
|
302
|
+
index,
|
|
303
|
+
route,
|
|
304
|
+
pointer: ["routes", index]
|
|
305
|
+
}));
|
|
306
|
+
if (next.otherwise !== undefined) {
|
|
307
|
+
entries.push({
|
|
308
|
+
kind: "otherwise",
|
|
309
|
+
index: 0,
|
|
310
|
+
route: next.otherwise,
|
|
311
|
+
pointer: ["otherwise"]
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return entries;
|
|
315
|
+
}
|
|
316
|
+
function routeAt(next, kind, index) {
|
|
317
|
+
if (next === undefined) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
return kind === "otherwise" ? next.otherwise : next.routes[index];
|
|
321
|
+
}
|
|
322
|
+
export { isJsonObject, jsonPointer, deepEqual, COMPARISON_OPERATORS, CONDITION_OPERATORS, COMPUTED_FUNCTIONS, ORDERING_OPERATORS, STRING_OPERATORS, DATE_OPERATORS, LIST_OPERATORS, NODE_ID_PATTERN, ALIAS_PATTERN, literalSchema, listSchema, argValueSchema, computedSourceSchema, conditionSchema, toleratedFailuresSchema, eachSchema, routeSchema, otherwiseSchema, startSchema, MATCH_MODES, nextSchema, retrySchema, catchSchema, stepNodeSchema, DEFAULT_MAX_TURNS, DECISION_BODY_MODES, decisionActionSchema, waitNodeSchema, succeedNodeSchema, failNodeSchema, nodeSchema, pipelineDocumentSchema, pipelineDocumentJsonSchema, routeEntries, routeAt };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/jsonc.ts
|
|
3
|
+
var stripJsoncComments = (content) => {
|
|
4
|
+
let result = "";
|
|
5
|
+
let inString = false;
|
|
6
|
+
let escapeNextCharacter = false;
|
|
7
|
+
let lineComment = false;
|
|
8
|
+
let blockComment = false;
|
|
9
|
+
for (let index = 0;index < content.length; index += 1) {
|
|
10
|
+
const character = content.charAt(index);
|
|
11
|
+
const nextCharacter = content.charAt(index + 1);
|
|
12
|
+
if (lineComment) {
|
|
13
|
+
if (character === `
|
|
14
|
+
`) {
|
|
15
|
+
lineComment = false;
|
|
16
|
+
result += character;
|
|
17
|
+
}
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (blockComment) {
|
|
21
|
+
if (character === "*" && nextCharacter === "/") {
|
|
22
|
+
blockComment = false;
|
|
23
|
+
index += 1;
|
|
24
|
+
}
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (inString) {
|
|
28
|
+
result += character;
|
|
29
|
+
if (escapeNextCharacter) {
|
|
30
|
+
escapeNextCharacter = false;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (character === "\\") {
|
|
34
|
+
escapeNextCharacter = true;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (character === '"') {
|
|
38
|
+
inString = false;
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (character === '"') {
|
|
43
|
+
inString = true;
|
|
44
|
+
result += character;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (character === "/" && nextCharacter === "/") {
|
|
48
|
+
lineComment = true;
|
|
49
|
+
index += 1;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (character === "/" && nextCharacter === "*") {
|
|
53
|
+
blockComment = true;
|
|
54
|
+
index += 1;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
result += character;
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
var stripTrailingCommas = (content) => {
|
|
62
|
+
let result = "";
|
|
63
|
+
let inString = false;
|
|
64
|
+
let escapeNextCharacter = false;
|
|
65
|
+
for (let index = 0;index < content.length; index += 1) {
|
|
66
|
+
const character = content.charAt(index);
|
|
67
|
+
if (inString) {
|
|
68
|
+
result += character;
|
|
69
|
+
if (escapeNextCharacter) {
|
|
70
|
+
escapeNextCharacter = false;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (character === "\\") {
|
|
74
|
+
escapeNextCharacter = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (character === '"') {
|
|
78
|
+
inString = false;
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (character === '"') {
|
|
83
|
+
inString = true;
|
|
84
|
+
result += character;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (character === ",") {
|
|
88
|
+
let lookaheadIndex = index + 1;
|
|
89
|
+
while (lookaheadIndex < content.length) {
|
|
90
|
+
const lookaheadCharacter2 = content.charAt(lookaheadIndex);
|
|
91
|
+
if (/\s/u.test(lookaheadCharacter2)) {
|
|
92
|
+
lookaheadIndex += 1;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
result += character;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (lookaheadIndex >= content.length) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const lookaheadCharacter = content.charAt(lookaheadIndex);
|
|
105
|
+
if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
result += character;
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
};
|
|
114
|
+
var parseJsonc = (content) => JSON.parse(stripTrailingCommas(stripJsoncComments(content)));
|
|
115
|
+
|
|
116
|
+
export { stripJsoncComments, stripTrailingCommas, parseJsonc };
|