@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.
Files changed (152) hide show
  1. package/dist/chunk-0y2fy5en.js +166 -0
  2. package/dist/chunk-3ctaaseb.js +1456 -0
  3. package/dist/chunk-4ggr8af6.js +30 -0
  4. package/dist/chunk-5zsavw98.js +91 -0
  5. package/dist/chunk-63f90zky.js +39 -0
  6. package/dist/chunk-700xe701.js +100 -0
  7. package/dist/chunk-ar6hcj1r.js +35 -0
  8. package/dist/chunk-cdanncng.js +74 -0
  9. package/dist/chunk-dp86pa6m.js +68 -0
  10. package/dist/chunk-e1h021kq.js +86 -0
  11. package/dist/chunk-gds7w7zh.js +330 -0
  12. package/dist/chunk-k4y5qt4y.js +14 -0
  13. package/dist/chunk-mz53r914.js +300 -0
  14. package/dist/chunk-ngy1fdcx.js +57 -0
  15. package/dist/chunk-p7yrcmqm.js +322 -0
  16. package/dist/chunk-rt9tq4j6.js +116 -0
  17. package/dist/chunk-skzxcba3.js +14282 -0
  18. package/dist/chunk-vfeytkqx.js +1687 -0
  19. package/dist/chunk-y2pv8d6a.js +162 -0
  20. package/dist/chunk-y64skrwp.js +17 -0
  21. package/dist/chunk-yjtaq94c.js +1094 -0
  22. package/dist/chunk-zm72ksz0.js +256 -0
  23. package/dist/client.d.ts +4 -0
  24. package/dist/client.js +58 -0
  25. package/dist/contracts/artifact-markers.d.ts +42 -0
  26. package/dist/contracts/artifact-markers.js +16 -0
  27. package/dist/contracts/artifacts.d.ts +67 -0
  28. package/dist/contracts/artifacts.js +27 -0
  29. package/dist/contracts/pipeline-document/built-ins.d.ts +23 -0
  30. package/dist/contracts/pipeline-document/conditions/operators.d.ts +8 -0
  31. package/dist/contracts/pipeline-document/index.d.ts +11 -0
  32. package/dist/contracts/pipeline-document/index.js +99 -0
  33. package/dist/contracts/pipeline-document/json.d.ts +35 -0
  34. package/dist/contracts/pipeline-document/routes.d.ts +16 -0
  35. package/dist/contracts/pipeline-document/schema.d.ts +780 -0
  36. package/dist/contracts/pipeline-document/step-contract.d.ts +11 -0
  37. package/dist/contracts/step-artifact-submissions.d.ts +71 -0
  38. package/dist/contracts/step-artifact-submissions.js +171 -0
  39. package/dist/defaults/atomic-json-file.d.ts +10 -0
  40. package/dist/defaults/auth-file.d.ts +14 -0
  41. package/dist/defaults/base-url.d.ts +1 -0
  42. package/dist/defaults/config-file.d.ts +46 -0
  43. package/dist/defaults/home-dir.d.ts +3 -0
  44. package/dist/defaults/index.d.ts +12 -0
  45. package/dist/defaults/index.js +1240 -0
  46. package/dist/defaults/legacy-config-migration.d.ts +27 -0
  47. package/dist/defaults/load-push-defaults.d.ts +25 -0
  48. package/dist/defaults/project-config.d.ts +32 -0
  49. package/dist/defaults/project-ref.d.ts +34 -0
  50. package/dist/definitions/artifacts/artifact.d.ts +62 -0
  51. package/dist/definitions/artifacts/index.d.ts +1 -0
  52. package/dist/definitions/pipelines/define-default-pipeline-assignment.d.ts +263 -0
  53. package/dist/definitions/pipelines/index.d.ts +3 -0
  54. package/dist/definitions/pipelines/index.js +26 -0
  55. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +208 -0
  56. package/dist/definitions/pipelines/work-item-fields.d.ts +93 -0
  57. package/dist/definitions/steps/compile-mcps.d.ts +34 -0
  58. package/dist/definitions/steps/define-code-step.d.ts +84 -0
  59. package/dist/definitions/steps/define-mcp.d.ts +79 -0
  60. package/dist/definitions/steps/define-step.d.ts +137 -0
  61. package/dist/definitions/steps/env.d.ts +136 -0
  62. package/dist/definitions/steps/index.d.ts +14 -0
  63. package/dist/definitions/steps/index.js +76 -0
  64. package/dist/definitions/steps/mcp-server-config.d.ts +102 -0
  65. package/dist/definitions/steps/prompt-template.d.ts +24 -0
  66. package/dist/definitions/steps/repo.d.ts +67 -0
  67. package/dist/definitions/steps/runtime.d.ts +115 -0
  68. package/dist/definitions/steps/step-definitions-client.d.ts +400 -0
  69. package/dist/definitions/steps/step-features.d.ts +109 -0
  70. package/dist/definitions/steps/step-handle.d.ts +25 -0
  71. package/dist/definitions/steps/step-ref.d.ts +19 -0
  72. package/dist/definitions/validation/index.d.ts +2 -0
  73. package/dist/definitions/validation/index.js +19 -0
  74. package/dist/definitions/validation/validate-artifact-markers.d.ts +3 -0
  75. package/dist/definitions/validation/validate-artifacts.d.ts +7 -0
  76. package/dist/definitions/validation/validate-definition-specs.d.ts +16 -0
  77. package/dist/definitions/validation/validate-env.d.ts +15 -0
  78. package/dist/definitions/validation/validate-repo.d.ts +13 -0
  79. package/dist/definitions/validation/validate-runtime.d.ts +12 -0
  80. package/dist/definitions/validation/validation-issue.d.ts +11 -0
  81. package/dist/devcontainer-config-path.d.ts +21 -0
  82. package/dist/devcontainer-config-path.js +15 -0
  83. package/dist/env-vars.d.ts +136 -0
  84. package/dist/env-vars.js +37 -0
  85. package/dist/eslint.d.ts +42 -0
  86. package/dist/eslint.js +127 -0
  87. package/dist/generated/client/client.gen.d.ts +2 -0
  88. package/dist/generated/client/index.d.ts +8 -0
  89. package/dist/generated/client/types.gen.d.ts +117 -0
  90. package/dist/generated/client/utils.gen.d.ts +33 -0
  91. package/dist/generated/client.gen.d.ts +12 -0
  92. package/dist/generated/core/auth.gen.d.ts +18 -0
  93. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  94. package/dist/generated/core/params.gen.d.ts +43 -0
  95. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  96. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  97. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  98. package/dist/generated/core/types.gen.d.ts +78 -0
  99. package/dist/generated/core/utils.gen.d.ts +19 -0
  100. package/dist/generated/index.d.ts +2 -0
  101. package/dist/generated/sdk.gen.d.ts +302 -0
  102. package/dist/generated/types.gen.d.ts +18375 -0
  103. package/dist/git-url/git-remote.d.ts +30 -0
  104. package/dist/git-url/git-repo-identity.d.ts +44 -0
  105. package/dist/git-url/git-repo-identity.js +161 -0
  106. package/dist/git-url/parse-git-host.d.ts +23 -0
  107. package/dist/health-checks.d.ts +169 -0
  108. package/dist/health-checks.js +21 -0
  109. package/dist/index.d.ts +11 -0
  110. package/dist/index.js +296 -0
  111. package/dist/jsonc.d.ts +3 -0
  112. package/dist/jsonc.js +12 -0
  113. package/dist/managed-runtimes.d.ts +20 -0
  114. package/dist/managed-runtimes.js +15 -0
  115. package/dist/opencode-mcp.d.ts +313 -0
  116. package/dist/opencode-mcp.js +31 -0
  117. package/dist/pipelines/chain.d.ts +7 -0
  118. package/dist/pipelines/compile-args.d.ts +12 -0
  119. package/dist/pipelines/compile-chain.d.ts +9 -0
  120. package/dist/pipelines/compile-checks.d.ts +16 -0
  121. package/dist/pipelines/compile-state.d.ts +30 -0
  122. package/dist/pipelines/condition-data.d.ts +78 -0
  123. package/dist/pipelines/conditions.d.ts +47 -0
  124. package/dist/pipelines/context.d.ts +16 -0
  125. package/dist/pipelines/define-pipeline.d.ts +32 -0
  126. package/dist/pipelines/each.d.ts +5 -0
  127. package/dist/pipelines/errors.d.ts +26 -0
  128. package/dist/pipelines/handles.d.ts +29 -0
  129. package/dist/pipelines/index.d.ts +18 -0
  130. package/dist/pipelines/index.js +83 -0
  131. package/dist/pipelines/model.d.ts +103 -0
  132. package/dist/pipelines/nodes.d.ts +54 -0
  133. package/dist/pipelines/ref-types.d.ts +54 -0
  134. package/dist/pipelines/refs.d.ts +80 -0
  135. package/dist/pipelines/registry.d.ts +12 -0
  136. package/dist/pipelines/source.d.ts +17 -0
  137. package/dist/pipelines/types.d.ts +160 -0
  138. package/dist/push/code-step-lookup.d.ts +32 -0
  139. package/dist/push/code-step-lookup.js +12 -0
  140. package/dist/push/collect-definitions.d.ts +70 -0
  141. package/dist/push/collect-pipeline-documents.d.ts +14 -0
  142. package/dist/push/index.d.ts +6 -0
  143. package/dist/push/index.js +327 -0
  144. package/dist/push/push-from-directory.d.ts +37 -0
  145. package/dist/repo-config.d.ts +80 -0
  146. package/dist/repo-config.js +25 -0
  147. package/dist/scarn-config-parser.d.ts +29 -0
  148. package/dist/scarn-config-parser.js +10 -0
  149. package/dist/task-plane-client.d.ts +489 -0
  150. package/dist/z.d.ts +7 -0
  151. package/package.json +132 -4
  152. package/README.md +0 -3
@@ -0,0 +1,1687 @@
1
+ // @bun
2
+ // src/generated/core/serverSentEvents.gen.ts
3
+ var createSseClient = ({
4
+ onRequest,
5
+ onSseError,
6
+ onSseEvent,
7
+ responseTransformer,
8
+ responseValidator,
9
+ sseDefaultRetryDelay,
10
+ sseMaxRetryAttempts,
11
+ sseMaxRetryDelay,
12
+ sseSleepFn,
13
+ url,
14
+ ...options
15
+ }) => {
16
+ let lastEventId;
17
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
18
+ const createStream = async function* () {
19
+ let retryDelay = sseDefaultRetryDelay ?? 3000;
20
+ let attempt = 0;
21
+ const signal = options.signal ?? new AbortController().signal;
22
+ while (true) {
23
+ if (signal.aborted)
24
+ break;
25
+ attempt++;
26
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
27
+ if (lastEventId !== undefined) {
28
+ headers.set("Last-Event-ID", lastEventId);
29
+ }
30
+ try {
31
+ const requestInit = {
32
+ redirect: "follow",
33
+ ...options,
34
+ body: options.serializedBody,
35
+ headers,
36
+ signal
37
+ };
38
+ let request = new Request(url, requestInit);
39
+ if (onRequest) {
40
+ request = await onRequest(url, requestInit);
41
+ }
42
+ const _fetch = options.fetch ?? globalThis.fetch;
43
+ const response = await _fetch(request);
44
+ if (!response.ok)
45
+ throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
46
+ if (!response.body)
47
+ throw new Error("No body in SSE response");
48
+ const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
49
+ let buffer = "";
50
+ const abortHandler = () => {
51
+ try {
52
+ reader.cancel();
53
+ } catch {}
54
+ };
55
+ signal.addEventListener("abort", abortHandler);
56
+ try {
57
+ while (true) {
58
+ const { done, value } = await reader.read();
59
+ if (done)
60
+ break;
61
+ buffer += value;
62
+ buffer = buffer.replace(/\r\n/g, `
63
+ `).replace(/\r/g, `
64
+ `);
65
+ const chunks = buffer.split(`
66
+
67
+ `);
68
+ buffer = chunks.pop() ?? "";
69
+ for (const chunk of chunks) {
70
+ const lines = chunk.split(`
71
+ `);
72
+ const dataLines = [];
73
+ let eventName;
74
+ for (const line of lines) {
75
+ if (line.startsWith("data:")) {
76
+ dataLines.push(line.replace(/^data:\s*/, ""));
77
+ } else if (line.startsWith("event:")) {
78
+ eventName = line.replace(/^event:\s*/, "");
79
+ } else if (line.startsWith("id:")) {
80
+ lastEventId = line.replace(/^id:\s*/, "");
81
+ } else if (line.startsWith("retry:")) {
82
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
83
+ if (!Number.isNaN(parsed)) {
84
+ retryDelay = parsed;
85
+ }
86
+ }
87
+ }
88
+ let data;
89
+ let parsedJson = false;
90
+ if (dataLines.length) {
91
+ const rawData = dataLines.join(`
92
+ `);
93
+ try {
94
+ data = JSON.parse(rawData);
95
+ parsedJson = true;
96
+ } catch {
97
+ data = rawData;
98
+ }
99
+ }
100
+ if (parsedJson) {
101
+ if (responseValidator) {
102
+ await responseValidator(data);
103
+ }
104
+ if (responseTransformer) {
105
+ data = await responseTransformer(data);
106
+ }
107
+ }
108
+ onSseEvent?.({
109
+ data,
110
+ event: eventName,
111
+ id: lastEventId,
112
+ retry: retryDelay
113
+ });
114
+ if (dataLines.length) {
115
+ yield data;
116
+ }
117
+ }
118
+ }
119
+ } finally {
120
+ signal.removeEventListener("abort", abortHandler);
121
+ reader.releaseLock();
122
+ }
123
+ break;
124
+ } catch (error) {
125
+ onSseError?.(error);
126
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
127
+ break;
128
+ }
129
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
130
+ await sleep(backoff);
131
+ }
132
+ }
133
+ };
134
+ const stream = createStream();
135
+ return { stream };
136
+ };
137
+
138
+ // src/generated/core/pathSerializer.gen.ts
139
+ var separatorArrayExplode = (style) => {
140
+ switch (style) {
141
+ case "label":
142
+ return ".";
143
+ case "matrix":
144
+ return ";";
145
+ case "simple":
146
+ return ",";
147
+ default:
148
+ return "&";
149
+ }
150
+ };
151
+ var separatorArrayNoExplode = (style) => {
152
+ switch (style) {
153
+ case "form":
154
+ return ",";
155
+ case "pipeDelimited":
156
+ return "|";
157
+ case "spaceDelimited":
158
+ return "%20";
159
+ default:
160
+ return ",";
161
+ }
162
+ };
163
+ var separatorObjectExplode = (style) => {
164
+ switch (style) {
165
+ case "label":
166
+ return ".";
167
+ case "matrix":
168
+ return ";";
169
+ case "simple":
170
+ return ",";
171
+ default:
172
+ return "&";
173
+ }
174
+ };
175
+ var serializeArrayParam = ({
176
+ allowReserved,
177
+ explode,
178
+ name,
179
+ style,
180
+ value
181
+ }) => {
182
+ if (!explode) {
183
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
184
+ switch (style) {
185
+ case "label":
186
+ return `.${joinedValues2}`;
187
+ case "matrix":
188
+ return `;${name}=${joinedValues2}`;
189
+ case "simple":
190
+ return joinedValues2;
191
+ default:
192
+ return `${name}=${joinedValues2}`;
193
+ }
194
+ }
195
+ const separator = separatorArrayExplode(style);
196
+ const joinedValues = value.map((v) => {
197
+ if (style === "label" || style === "simple") {
198
+ return allowReserved ? v : encodeURIComponent(v);
199
+ }
200
+ return serializePrimitiveParam({
201
+ allowReserved,
202
+ name,
203
+ value: v
204
+ });
205
+ }).join(separator);
206
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
207
+ };
208
+ var serializePrimitiveParam = ({
209
+ allowReserved,
210
+ name,
211
+ value
212
+ }) => {
213
+ if (value === undefined || value === null) {
214
+ return "";
215
+ }
216
+ if (typeof value === "object") {
217
+ throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
218
+ }
219
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
220
+ };
221
+ var serializeObjectParam = ({
222
+ allowReserved,
223
+ explode,
224
+ name,
225
+ style,
226
+ value,
227
+ valueOnly
228
+ }) => {
229
+ if (value instanceof Date) {
230
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
231
+ }
232
+ if (style !== "deepObject" && !explode) {
233
+ let values = [];
234
+ Object.entries(value).forEach(([key, v]) => {
235
+ values = [
236
+ ...values,
237
+ key,
238
+ allowReserved ? v : encodeURIComponent(v)
239
+ ];
240
+ });
241
+ const joinedValues2 = values.join(",");
242
+ switch (style) {
243
+ case "form":
244
+ return `${name}=${joinedValues2}`;
245
+ case "label":
246
+ return `.${joinedValues2}`;
247
+ case "matrix":
248
+ return `;${name}=${joinedValues2}`;
249
+ default:
250
+ return joinedValues2;
251
+ }
252
+ }
253
+ const separator = separatorObjectExplode(style);
254
+ const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
255
+ allowReserved,
256
+ name: style === "deepObject" ? `${name}[${key}]` : key,
257
+ value: v
258
+ })).join(separator);
259
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
260
+ };
261
+
262
+ // src/generated/core/utils.gen.ts
263
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
264
+ var defaultPathSerializer = ({ path, url: _url }) => {
265
+ let url = _url;
266
+ const matches = _url.match(PATH_PARAM_RE);
267
+ if (matches) {
268
+ for (const match of matches) {
269
+ let explode = false;
270
+ let name = match.substring(1, match.length - 1);
271
+ let style = "simple";
272
+ if (name.endsWith("*")) {
273
+ explode = true;
274
+ name = name.substring(0, name.length - 1);
275
+ }
276
+ if (name.startsWith(".")) {
277
+ name = name.substring(1);
278
+ style = "label";
279
+ } else if (name.startsWith(";")) {
280
+ name = name.substring(1);
281
+ style = "matrix";
282
+ }
283
+ const value = path[name];
284
+ if (value === undefined || value === null) {
285
+ continue;
286
+ }
287
+ if (Array.isArray(value)) {
288
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
289
+ continue;
290
+ }
291
+ if (typeof value === "object") {
292
+ url = url.replace(match, serializeObjectParam({
293
+ explode,
294
+ name,
295
+ style,
296
+ value,
297
+ valueOnly: true
298
+ }));
299
+ continue;
300
+ }
301
+ if (style === "matrix") {
302
+ url = url.replace(match, `;${serializePrimitiveParam({
303
+ name,
304
+ value
305
+ })}`);
306
+ continue;
307
+ }
308
+ const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
309
+ url = url.replace(match, replaceValue);
310
+ }
311
+ }
312
+ return url;
313
+ };
314
+ var getUrl = ({
315
+ baseUrl,
316
+ path,
317
+ query,
318
+ querySerializer,
319
+ url: _url
320
+ }) => {
321
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
322
+ let url = (baseUrl ?? "") + pathUrl;
323
+ if (path) {
324
+ url = defaultPathSerializer({ path, url });
325
+ }
326
+ let search = query ? querySerializer(query) : "";
327
+ if (search.startsWith("?")) {
328
+ search = search.substring(1);
329
+ }
330
+ if (search) {
331
+ url += `?${search}`;
332
+ }
333
+ return url;
334
+ };
335
+ function getValidRequestBody(options) {
336
+ const hasBody = options.body !== undefined;
337
+ const isSerializedBody = hasBody && options.bodySerializer;
338
+ if (isSerializedBody) {
339
+ if ("serializedBody" in options) {
340
+ const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
341
+ return hasSerializedBody ? options.serializedBody : null;
342
+ }
343
+ return options.body !== "" ? options.body : null;
344
+ }
345
+ if (hasBody) {
346
+ return options.body;
347
+ }
348
+ return;
349
+ }
350
+
351
+ // src/generated/core/auth.gen.ts
352
+ var getAuthToken = async (auth, callback) => {
353
+ const token = typeof callback === "function" ? await callback(auth) : callback;
354
+ if (!token) {
355
+ return;
356
+ }
357
+ if (auth.scheme === "bearer") {
358
+ return `Bearer ${token}`;
359
+ }
360
+ if (auth.scheme === "basic") {
361
+ return `Basic ${btoa(token)}`;
362
+ }
363
+ return token;
364
+ };
365
+
366
+ // src/generated/core/bodySerializer.gen.ts
367
+ var jsonBodySerializer = {
368
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
369
+ };
370
+
371
+ // src/generated/client/utils.gen.ts
372
+ var createQuerySerializer = ({
373
+ parameters = {},
374
+ ...args
375
+ } = {}) => {
376
+ const querySerializer = (queryParams) => {
377
+ const search = [];
378
+ if (queryParams && typeof queryParams === "object") {
379
+ for (const name in queryParams) {
380
+ const value = queryParams[name];
381
+ if (value === undefined || value === null) {
382
+ continue;
383
+ }
384
+ const options = parameters[name] || args;
385
+ if (Array.isArray(value)) {
386
+ const serializedArray = serializeArrayParam({
387
+ allowReserved: options.allowReserved,
388
+ explode: true,
389
+ name,
390
+ style: "form",
391
+ value,
392
+ ...options.array
393
+ });
394
+ if (serializedArray)
395
+ search.push(serializedArray);
396
+ } else if (typeof value === "object") {
397
+ const serializedObject = serializeObjectParam({
398
+ allowReserved: options.allowReserved,
399
+ explode: true,
400
+ name,
401
+ style: "deepObject",
402
+ value,
403
+ ...options.object
404
+ });
405
+ if (serializedObject)
406
+ search.push(serializedObject);
407
+ } else {
408
+ const serializedPrimitive = serializePrimitiveParam({
409
+ allowReserved: options.allowReserved,
410
+ name,
411
+ value
412
+ });
413
+ if (serializedPrimitive)
414
+ search.push(serializedPrimitive);
415
+ }
416
+ }
417
+ }
418
+ return search.join("&");
419
+ };
420
+ return querySerializer;
421
+ };
422
+ var getParseAs = (contentType) => {
423
+ if (!contentType) {
424
+ return "stream";
425
+ }
426
+ const cleanContent = contentType.split(";")[0]?.trim();
427
+ if (!cleanContent) {
428
+ return;
429
+ }
430
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
431
+ return "json";
432
+ }
433
+ if (cleanContent === "multipart/form-data") {
434
+ return "formData";
435
+ }
436
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
437
+ return "blob";
438
+ }
439
+ if (cleanContent.startsWith("text/")) {
440
+ return "text";
441
+ }
442
+ return;
443
+ };
444
+ var checkForExistence = (options, name) => {
445
+ if (!name) {
446
+ return false;
447
+ }
448
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
449
+ return true;
450
+ }
451
+ return false;
452
+ };
453
+ var setAuthParams = async ({
454
+ security,
455
+ ...options
456
+ }) => {
457
+ for (const auth of security) {
458
+ if (checkForExistence(options, auth.name)) {
459
+ continue;
460
+ }
461
+ const token = await getAuthToken(auth, options.auth);
462
+ if (!token) {
463
+ continue;
464
+ }
465
+ const name = auth.name ?? "Authorization";
466
+ switch (auth.in) {
467
+ case "query":
468
+ if (!options.query) {
469
+ options.query = {};
470
+ }
471
+ options.query[name] = token;
472
+ break;
473
+ case "cookie":
474
+ options.headers.append("Cookie", `${name}=${token}`);
475
+ break;
476
+ case "header":
477
+ default:
478
+ options.headers.set(name, token);
479
+ break;
480
+ }
481
+ }
482
+ };
483
+ var buildUrl = (options) => getUrl({
484
+ baseUrl: options.baseUrl,
485
+ path: options.path,
486
+ query: options.query,
487
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
488
+ url: options.url
489
+ });
490
+ var mergeConfigs = (a, b) => {
491
+ const config = { ...a, ...b };
492
+ if (config.baseUrl?.endsWith("/")) {
493
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
494
+ }
495
+ config.headers = mergeHeaders(a.headers, b.headers);
496
+ return config;
497
+ };
498
+ var headersEntries = (headers) => {
499
+ const entries = [];
500
+ headers.forEach((value, key) => {
501
+ entries.push([key, value]);
502
+ });
503
+ return entries;
504
+ };
505
+ var mergeHeaders = (...headers) => {
506
+ const mergedHeaders = new Headers;
507
+ for (const header of headers) {
508
+ if (!header) {
509
+ continue;
510
+ }
511
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
512
+ for (const [key, value] of iterator) {
513
+ if (value === null) {
514
+ mergedHeaders.delete(key);
515
+ } else if (Array.isArray(value)) {
516
+ for (const v of value) {
517
+ mergedHeaders.append(key, v);
518
+ }
519
+ } else if (value !== undefined) {
520
+ mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
521
+ }
522
+ }
523
+ }
524
+ return mergedHeaders;
525
+ };
526
+
527
+ class Interceptors {
528
+ fns = [];
529
+ clear() {
530
+ this.fns = [];
531
+ }
532
+ eject(id) {
533
+ const index = this.getInterceptorIndex(id);
534
+ if (this.fns[index]) {
535
+ this.fns[index] = null;
536
+ }
537
+ }
538
+ exists(id) {
539
+ const index = this.getInterceptorIndex(id);
540
+ return Boolean(this.fns[index]);
541
+ }
542
+ getInterceptorIndex(id) {
543
+ if (typeof id === "number") {
544
+ return this.fns[id] ? id : -1;
545
+ }
546
+ return this.fns.indexOf(id);
547
+ }
548
+ update(id, fn) {
549
+ const index = this.getInterceptorIndex(id);
550
+ if (this.fns[index]) {
551
+ this.fns[index] = fn;
552
+ return id;
553
+ }
554
+ return false;
555
+ }
556
+ use(fn) {
557
+ this.fns.push(fn);
558
+ return this.fns.length - 1;
559
+ }
560
+ }
561
+ var createInterceptors = () => ({
562
+ error: new Interceptors,
563
+ request: new Interceptors,
564
+ response: new Interceptors
565
+ });
566
+ var defaultQuerySerializer = createQuerySerializer({
567
+ allowReserved: false,
568
+ array: {
569
+ explode: true,
570
+ style: "form"
571
+ },
572
+ object: {
573
+ explode: true,
574
+ style: "deepObject"
575
+ }
576
+ });
577
+ var defaultHeaders = {
578
+ "Content-Type": "application/json"
579
+ };
580
+ var createConfig = (override = {}) => ({
581
+ ...jsonBodySerializer,
582
+ headers: defaultHeaders,
583
+ parseAs: "auto",
584
+ querySerializer: defaultQuerySerializer,
585
+ ...override
586
+ });
587
+
588
+ // src/generated/client/client.gen.ts
589
+ var createClient = (config = {}) => {
590
+ let _config = mergeConfigs(createConfig(), config);
591
+ const getConfig = () => ({ ..._config });
592
+ const setConfig = (config2) => {
593
+ _config = mergeConfigs(_config, config2);
594
+ return getConfig();
595
+ };
596
+ const interceptors = createInterceptors();
597
+ const beforeRequest = async (options) => {
598
+ const opts = {
599
+ ..._config,
600
+ ...options,
601
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
602
+ headers: mergeHeaders(_config.headers, options.headers),
603
+ serializedBody: undefined
604
+ };
605
+ if (opts.security) {
606
+ await setAuthParams({
607
+ ...opts,
608
+ security: opts.security
609
+ });
610
+ }
611
+ if (opts.requestValidator) {
612
+ await opts.requestValidator(opts);
613
+ }
614
+ if (opts.body !== undefined && opts.bodySerializer) {
615
+ opts.serializedBody = opts.bodySerializer(opts.body);
616
+ }
617
+ if (opts.body === undefined || opts.serializedBody === "") {
618
+ opts.headers.delete("Content-Type");
619
+ }
620
+ const url = buildUrl(opts);
621
+ return { opts, url };
622
+ };
623
+ const request = async (options) => {
624
+ const { opts, url } = await beforeRequest(options);
625
+ const requestInit = {
626
+ redirect: "follow",
627
+ ...opts,
628
+ body: getValidRequestBody(opts)
629
+ };
630
+ let request2 = new Request(url, requestInit);
631
+ for (const fn of interceptors.request.fns) {
632
+ if (fn) {
633
+ request2 = await fn(request2, opts);
634
+ }
635
+ }
636
+ const _fetch = opts.fetch;
637
+ let response;
638
+ try {
639
+ response = await _fetch(request2);
640
+ } catch (error2) {
641
+ let finalError2 = error2;
642
+ for (const fn of interceptors.error.fns) {
643
+ if (fn) {
644
+ finalError2 = await fn(error2, undefined, request2, opts);
645
+ }
646
+ }
647
+ finalError2 = finalError2 || {};
648
+ if (opts.throwOnError) {
649
+ throw finalError2;
650
+ }
651
+ return opts.responseStyle === "data" ? undefined : {
652
+ error: finalError2,
653
+ request: request2,
654
+ response: undefined
655
+ };
656
+ }
657
+ for (const fn of interceptors.response.fns) {
658
+ if (fn) {
659
+ response = await fn(response, request2, opts);
660
+ }
661
+ }
662
+ const result = {
663
+ request: request2,
664
+ response
665
+ };
666
+ if (response.ok) {
667
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
668
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
669
+ let emptyData;
670
+ switch (parseAs) {
671
+ case "arrayBuffer":
672
+ case "blob":
673
+ case "text":
674
+ emptyData = await response[parseAs]();
675
+ break;
676
+ case "formData":
677
+ emptyData = new FormData;
678
+ break;
679
+ case "stream":
680
+ emptyData = response.body;
681
+ break;
682
+ case "json":
683
+ default:
684
+ emptyData = {};
685
+ break;
686
+ }
687
+ return opts.responseStyle === "data" ? emptyData : {
688
+ data: emptyData,
689
+ ...result
690
+ };
691
+ }
692
+ let data;
693
+ switch (parseAs) {
694
+ case "arrayBuffer":
695
+ case "blob":
696
+ case "formData":
697
+ case "text":
698
+ data = await response[parseAs]();
699
+ break;
700
+ case "json": {
701
+ const text = await response.text();
702
+ data = text ? JSON.parse(text) : {};
703
+ break;
704
+ }
705
+ case "stream":
706
+ return opts.responseStyle === "data" ? response.body : {
707
+ data: response.body,
708
+ ...result
709
+ };
710
+ }
711
+ if (parseAs === "json") {
712
+ if (opts.responseValidator) {
713
+ await opts.responseValidator(data);
714
+ }
715
+ if (opts.responseTransformer) {
716
+ data = await opts.responseTransformer(data);
717
+ }
718
+ }
719
+ return opts.responseStyle === "data" ? data : {
720
+ data,
721
+ ...result
722
+ };
723
+ }
724
+ const textError = await response.text();
725
+ let jsonError;
726
+ try {
727
+ jsonError = JSON.parse(textError);
728
+ } catch {}
729
+ const error = jsonError ?? textError;
730
+ let finalError = error;
731
+ for (const fn of interceptors.error.fns) {
732
+ if (fn) {
733
+ finalError = await fn(error, response, request2, opts);
734
+ }
735
+ }
736
+ finalError = finalError || {};
737
+ if (opts.throwOnError) {
738
+ throw finalError;
739
+ }
740
+ return opts.responseStyle === "data" ? undefined : {
741
+ error: finalError,
742
+ ...result
743
+ };
744
+ };
745
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
746
+ const makeSseFn = (method) => async (options) => {
747
+ const { opts, url } = await beforeRequest(options);
748
+ return createSseClient({
749
+ ...opts,
750
+ body: opts.body,
751
+ headers: opts.headers,
752
+ method,
753
+ onRequest: async (url2, init) => {
754
+ let request2 = new Request(url2, init);
755
+ for (const fn of interceptors.request.fns) {
756
+ if (fn) {
757
+ request2 = await fn(request2, opts);
758
+ }
759
+ }
760
+ return request2;
761
+ },
762
+ serializedBody: getValidRequestBody(opts),
763
+ url
764
+ });
765
+ };
766
+ return {
767
+ buildUrl,
768
+ connect: makeMethodFn("CONNECT"),
769
+ delete: makeMethodFn("DELETE"),
770
+ get: makeMethodFn("GET"),
771
+ getConfig,
772
+ head: makeMethodFn("HEAD"),
773
+ interceptors,
774
+ options: makeMethodFn("OPTIONS"),
775
+ patch: makeMethodFn("PATCH"),
776
+ post: makeMethodFn("POST"),
777
+ put: makeMethodFn("PUT"),
778
+ request,
779
+ setConfig,
780
+ sse: {
781
+ connect: makeSseFn("CONNECT"),
782
+ delete: makeSseFn("DELETE"),
783
+ get: makeSseFn("GET"),
784
+ head: makeSseFn("HEAD"),
785
+ options: makeSseFn("OPTIONS"),
786
+ patch: makeSseFn("PATCH"),
787
+ post: makeSseFn("POST"),
788
+ put: makeSseFn("PUT"),
789
+ trace: makeSseFn("TRACE")
790
+ },
791
+ trace: makeMethodFn("TRACE")
792
+ };
793
+ };
794
+ // src/generated/core/params.gen.ts
795
+ var extraPrefixesMap = {
796
+ $body_: "body",
797
+ $headers_: "headers",
798
+ $path_: "path",
799
+ $query_: "query"
800
+ };
801
+ var extraPrefixes = Object.entries(extraPrefixesMap);
802
+ // src/generated/client.gen.ts
803
+ var client = createClient(createConfig());
804
+
805
+ // src/generated/sdk.gen.ts
806
+ class HeyApiClient {
807
+ client;
808
+ constructor(args) {
809
+ this.client = args?.client ?? client;
810
+ }
811
+ }
812
+
813
+ class HeyApiRegistry {
814
+ defaultKey = "default";
815
+ instances = new Map;
816
+ get(key) {
817
+ const instance = this.instances.get(key ?? this.defaultKey);
818
+ if (!instance) {
819
+ throw new Error(`No SDK client found. Create one with "new ScarnClient()" to fix this error.`);
820
+ }
821
+ return instance;
822
+ }
823
+ set(value, key) {
824
+ this.instances.set(key ?? this.defaultKey, value);
825
+ }
826
+ }
827
+
828
+ class Api extends HeyApiClient {
829
+ "allApiAuth*"(options) {
830
+ return (options?.client ?? this.client).delete({ url: "/api/auth/*", ...options });
831
+ }
832
+ "allApiAuth*2"(options) {
833
+ return (options?.client ?? this.client).get({ url: "/api/auth/*", ...options });
834
+ }
835
+ "allApiAuth*3"(options) {
836
+ return (options?.client ?? this.client).head({ url: "/api/auth/*", ...options });
837
+ }
838
+ "allApiAuth*4"(options) {
839
+ return (options?.client ?? this.client).options({ url: "/api/auth/*", ...options });
840
+ }
841
+ "allApiAuth*5"(options) {
842
+ return (options?.client ?? this.client).patch({ url: "/api/auth/*", ...options });
843
+ }
844
+ "allApiAuth*6"(options) {
845
+ return (options?.client ?? this.client).post({ url: "/api/auth/*", ...options });
846
+ }
847
+ "allApiAuth*7"(options) {
848
+ return (options?.client ?? this.client).put({ url: "/api/auth/*", ...options });
849
+ }
850
+ "allApiAuth*8"(options) {
851
+ return (options?.client ?? this.client).trace({ url: "/api/auth/*", ...options });
852
+ }
853
+ }
854
+
855
+ class Projects extends HeyApiClient {
856
+ resolveProjectBySlug(options) {
857
+ return (options.client ?? this.client).get({ url: "/api/projects/resolve", ...options });
858
+ }
859
+ listProjectWorkItems(options) {
860
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-items", ...options });
861
+ }
862
+ listProjectWorkItemFieldOptions(options) {
863
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-item-field-options", ...options });
864
+ }
865
+ getProject(options) {
866
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
867
+ }
868
+ listProjects(options) {
869
+ return (options?.client ?? this.client).get({ url: "/api/projects", ...options });
870
+ }
871
+ createProject(options) {
872
+ return (options.client ?? this.client).post({
873
+ url: "/api/projects",
874
+ ...options,
875
+ headers: {
876
+ "Content-Type": "application/json",
877
+ ...options.headers
878
+ }
879
+ });
880
+ }
881
+ updateProjectDefaultPipelineAssignment(options) {
882
+ return (options.client ?? this.client).put({
883
+ url: "/api/projects/{projectId}/default-pipeline-assignment",
884
+ ...options,
885
+ headers: {
886
+ "Content-Type": "application/json",
887
+ ...options.headers
888
+ }
889
+ });
890
+ }
891
+ updateProjectMemberPermissions(options) {
892
+ return (options.client ?? this.client).put({ url: "/api/projects/{projectId}/members/{userId}/permissions", ...options });
893
+ }
894
+ checkProjectRepo(options) {
895
+ return (options.client ?? this.client).post({
896
+ url: "/api/projects/repo-check",
897
+ ...options,
898
+ headers: {
899
+ "Content-Type": "application/json",
900
+ ...options.headers
901
+ }
902
+ });
903
+ }
904
+ checkProjectIssueTracker(options) {
905
+ return (options.client ?? this.client).post({
906
+ url: "/api/projects/issue-tracker-check",
907
+ ...options,
908
+ headers: {
909
+ "Content-Type": "application/json",
910
+ ...options.headers
911
+ }
912
+ });
913
+ }
914
+ }
915
+
916
+ class StepDefinitions extends HeyApiClient {
917
+ listStepDefinitions(options) {
918
+ return (options.client ?? this.client).get({ url: "/api/step-definitions", ...options });
919
+ }
920
+ createStepDefinition(options) {
921
+ return (options.client ?? this.client).post({
922
+ url: "/api/step-definitions",
923
+ ...options,
924
+ headers: {
925
+ "Content-Type": "application/json",
926
+ ...options.headers
927
+ }
928
+ });
929
+ }
930
+ upsertStepDefinition(options) {
931
+ return (options.client ?? this.client).put({
932
+ url: "/api/step-definitions",
933
+ ...options,
934
+ headers: {
935
+ "Content-Type": "application/json",
936
+ ...options.headers
937
+ }
938
+ });
939
+ }
940
+ getStepDefinition(options) {
941
+ return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
942
+ }
943
+ archiveStepDefinition(options) {
944
+ return (options.client ?? this.client).put({ url: "/api/step-definitions/{stepDefinitionId}/archive", ...options });
945
+ }
946
+ }
947
+
948
+ class Tasks extends HeyApiClient {
949
+ createTask(options) {
950
+ return (options.client ?? this.client).post({
951
+ url: "/api/tasks",
952
+ ...options,
953
+ headers: {
954
+ "Content-Type": "application/json",
955
+ ...options.headers
956
+ }
957
+ });
958
+ }
959
+ getTask(options) {
960
+ return (options.client ?? this.client).get({ url: "/api/tasks/{taskId}", ...options });
961
+ }
962
+ getTaskRuns(options) {
963
+ return (options.client ?? this.client).get({ url: "/api/tasks/{taskId}/runs", ...options });
964
+ }
965
+ }
966
+
967
+ class TaskRuns extends HeyApiClient {
968
+ claimTaskRuns(options) {
969
+ return (options.client ?? this.client).post({
970
+ url: "/api/task-runs/claims",
971
+ ...options,
972
+ headers: {
973
+ "Content-Type": "application/json",
974
+ ...options.headers
975
+ }
976
+ });
977
+ }
978
+ heartbeatTaskRun(options) {
979
+ return (options.client ?? this.client).put({
980
+ url: "/api/task-runs/{taskRunId}/heartbeat",
981
+ ...options,
982
+ headers: {
983
+ "Content-Type": "application/json",
984
+ ...options.headers
985
+ }
986
+ });
987
+ }
988
+ getTaskRunWorkerContext(options) {
989
+ return (options.client ?? this.client).post({
990
+ url: "/api/task-runs/{taskRunId}/worker-context",
991
+ ...options,
992
+ headers: {
993
+ "Content-Type": "application/json",
994
+ ...options.headers
995
+ }
996
+ });
997
+ }
998
+ completeTaskRun(options) {
999
+ return (options.client ?? this.client).post({
1000
+ url: "/api/task-runs/{taskRunId}/completions",
1001
+ ...options,
1002
+ headers: {
1003
+ "Content-Type": "application/json",
1004
+ ...options.headers
1005
+ }
1006
+ });
1007
+ }
1008
+ yieldTaskRun(options) {
1009
+ return (options.client ?? this.client).post({
1010
+ url: "/api/task-runs/{taskRunId}/yields",
1011
+ ...options,
1012
+ headers: {
1013
+ "Content-Type": "application/json",
1014
+ ...options.headers
1015
+ }
1016
+ });
1017
+ }
1018
+ markTaskRunRunning(options) {
1019
+ return (options.client ?? this.client).put({ url: "/api/task-runs/{taskRunId}/running", ...options });
1020
+ }
1021
+ readTaskLogs(options) {
1022
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}/logs", ...options });
1023
+ }
1024
+ appendTaskLogs(options) {
1025
+ return (options.client ?? this.client).post({
1026
+ url: "/api/task-runs/{taskRunId}/logs",
1027
+ ...options,
1028
+ headers: {
1029
+ "Content-Type": "application/json",
1030
+ ...options.headers
1031
+ }
1032
+ });
1033
+ }
1034
+ getTaskRun(options) {
1035
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}", ...options });
1036
+ }
1037
+ listTaskRuns(options) {
1038
+ return (options.client ?? this.client).get({ url: "/api/task-runs", ...options });
1039
+ }
1040
+ getTaskLogArchive(options) {
1041
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}/logs/archive", ...options });
1042
+ }
1043
+ createSessionUploadUrl(options) {
1044
+ return (options.client ?? this.client).post({
1045
+ url: "/api/task-runs/{taskRunId}/session-upload-url",
1046
+ ...options,
1047
+ headers: {
1048
+ "Content-Type": "application/json",
1049
+ ...options.headers
1050
+ }
1051
+ });
1052
+ }
1053
+ createArtifactUploadUrl(options) {
1054
+ return (options.client ?? this.client).post({
1055
+ url: "/api/task-runs/{taskRunId}/artifact-upload-url",
1056
+ ...options,
1057
+ headers: {
1058
+ "Content-Type": "application/json",
1059
+ ...options.headers
1060
+ }
1061
+ });
1062
+ }
1063
+ listTaskArtifacts(options) {
1064
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}/artifacts", ...options });
1065
+ }
1066
+ recordTaskArtifact(options) {
1067
+ return (options.client ?? this.client).post({
1068
+ url: "/api/task-runs/{taskRunId}/artifacts",
1069
+ ...options,
1070
+ headers: {
1071
+ "Content-Type": "application/json",
1072
+ ...options.headers
1073
+ }
1074
+ });
1075
+ }
1076
+ getArtifactDownloadUrl(options) {
1077
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}/artifacts/{artifactId}/download-url", ...options });
1078
+ }
1079
+ listTaskArtifactFailures(options) {
1080
+ return (options.client ?? this.client).get({ url: "/api/task-runs/{taskRunId}/artifact-failures", ...options });
1081
+ }
1082
+ recordTaskArtifactFailure(options) {
1083
+ return (options.client ?? this.client).post({
1084
+ url: "/api/task-runs/{taskRunId}/artifact-failures",
1085
+ ...options,
1086
+ headers: {
1087
+ "Content-Type": "application/json",
1088
+ ...options.headers
1089
+ }
1090
+ });
1091
+ }
1092
+ }
1093
+
1094
+ class PipelineDefinitions extends HeyApiClient {
1095
+ createPipelineDefinition(options) {
1096
+ return (options.client ?? this.client).post({
1097
+ url: "/api/pipeline-definitions",
1098
+ ...options,
1099
+ headers: {
1100
+ "Content-Type": "application/json",
1101
+ ...options.headers
1102
+ }
1103
+ });
1104
+ }
1105
+ listPipelineDefinitionVersions(options) {
1106
+ return (options.client ?? this.client).get({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/versions", ...options });
1107
+ }
1108
+ publishPipelineDefinitionVersion(options) {
1109
+ return (options.client ?? this.client).post({
1110
+ url: "/api/pipeline-definitions/{pipelineDefinitionId}/versions",
1111
+ ...options,
1112
+ headers: {
1113
+ "Content-Type": "application/json",
1114
+ ...options.headers
1115
+ }
1116
+ });
1117
+ }
1118
+ activatePipelineDefinitionVersion(options) {
1119
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/versions/{version}/activate", ...options });
1120
+ }
1121
+ archivePipelineDefinition(options) {
1122
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/archive", ...options });
1123
+ }
1124
+ unarchivePipelineDefinition(options) {
1125
+ return (options.client ?? this.client).put({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/unarchive", ...options });
1126
+ }
1127
+ getPipelineDefinition(options) {
1128
+ return (options.client ?? this.client).get({ url: "/api/pipeline-definitions/{pipelineDefinitionId}", ...options });
1129
+ }
1130
+ getPipelineDefinitionVersion(options) {
1131
+ return (options.client ?? this.client).get({ url: "/api/pipeline-definitions/{pipelineDefinitionId}/versions/{version}", ...options });
1132
+ }
1133
+ listPipelineDefinitions(options) {
1134
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/pipeline-definitions", ...options });
1135
+ }
1136
+ }
1137
+
1138
+ class PipelineExecutions extends HeyApiClient {
1139
+ listPipelineExecutions(options) {
1140
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions", ...options });
1141
+ }
1142
+ createPipelineExecution(options) {
1143
+ return (options.client ?? this.client).post({
1144
+ url: "/api/pipeline-executions",
1145
+ ...options,
1146
+ headers: {
1147
+ "Content-Type": "application/json",
1148
+ ...options.headers
1149
+ }
1150
+ });
1151
+ }
1152
+ rerunPipelineExecutionVisit(options) {
1153
+ return (options.client ?? this.client).post({ url: "/api/pipeline-executions/{pipelineExecutionId}/visits/{visitId}/rerun", ...options });
1154
+ }
1155
+ continueWithoutReply(options) {
1156
+ return (options.client ?? this.client).post({ url: "/api/pipeline-executions/{pipelineExecutionId}/questions/{questionId}/continue", ...options });
1157
+ }
1158
+ cancelPipelineExecution(options) {
1159
+ return (options.client ?? this.client).put({ url: "/api/pipeline-executions/{pipelineExecutionId}/cancel", ...options });
1160
+ }
1161
+ cancelPipelineExecutions(options) {
1162
+ return (options.client ?? this.client).put({
1163
+ url: "/api/pipeline-executions/batch/cancel",
1164
+ ...options,
1165
+ headers: {
1166
+ "Content-Type": "application/json",
1167
+ ...options.headers
1168
+ }
1169
+ });
1170
+ }
1171
+ sendVisitMessage(options) {
1172
+ return (options.client ?? this.client).post({
1173
+ url: "/api/pipeline-executions/{pipelineExecutionId}/visits/{visitId}/messages",
1174
+ ...options,
1175
+ headers: {
1176
+ "Content-Type": "application/json",
1177
+ ...options.headers
1178
+ }
1179
+ });
1180
+ }
1181
+ decideWaitVisit(options) {
1182
+ return (options.client ?? this.client).post({
1183
+ url: "/api/pipeline-executions/{pipelineExecutionId}/visits/{visitId}/decision",
1184
+ ...options,
1185
+ headers: {
1186
+ "Content-Type": "application/json",
1187
+ ...options.headers
1188
+ }
1189
+ });
1190
+ }
1191
+ getPipelineExecution(options) {
1192
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}", ...options });
1193
+ }
1194
+ getVisitThread(options) {
1195
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/{pipelineExecutionId}/visits/{visitId}/thread", ...options });
1196
+ }
1197
+ countPipelineExecutionsByPipeline(options) {
1198
+ return (options.client ?? this.client).get({ url: "/api/pipeline-executions/counts/by-pipeline", ...options });
1199
+ }
1200
+ }
1201
+
1202
+ class WorkItems extends HeyApiClient {
1203
+ listWorkItemQuestions(options) {
1204
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/questions", ...options });
1205
+ }
1206
+ deleteWorkItem(options) {
1207
+ return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1208
+ }
1209
+ getWorkItem(options) {
1210
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1211
+ }
1212
+ editWorkItem(options) {
1213
+ return (options.client ?? this.client).patch({
1214
+ url: "/api/work-items/{workItemId}",
1215
+ ...options,
1216
+ headers: {
1217
+ "Content-Type": "application/json",
1218
+ ...options.headers
1219
+ }
1220
+ });
1221
+ }
1222
+ listWorkItemChildren(options) {
1223
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/children", ...options });
1224
+ }
1225
+ createWorkItem(options) {
1226
+ return (options.client ?? this.client).post({
1227
+ url: "/api/work-items",
1228
+ ...options,
1229
+ headers: {
1230
+ "Content-Type": "application/json",
1231
+ ...options.headers
1232
+ }
1233
+ });
1234
+ }
1235
+ upsertWorkItem(options) {
1236
+ return (options.client ?? this.client).put({
1237
+ url: "/api/work-items",
1238
+ ...options,
1239
+ headers: {
1240
+ "Content-Type": "application/json",
1241
+ ...options.headers
1242
+ }
1243
+ });
1244
+ }
1245
+ deleteWorkItems(options) {
1246
+ return (options.client ?? this.client).delete({
1247
+ url: "/api/work-items/batch",
1248
+ ...options,
1249
+ headers: {
1250
+ "Content-Type": "application/json",
1251
+ ...options.headers
1252
+ }
1253
+ });
1254
+ }
1255
+ createWorkItems(options) {
1256
+ return (options.client ?? this.client).post({
1257
+ url: "/api/work-items/batch",
1258
+ ...options,
1259
+ headers: {
1260
+ "Content-Type": "application/json",
1261
+ ...options.headers
1262
+ }
1263
+ });
1264
+ }
1265
+ upsertWorkItems(options) {
1266
+ return (options.client ?? this.client).put({
1267
+ url: "/api/work-items/batch",
1268
+ ...options,
1269
+ headers: {
1270
+ "Content-Type": "application/json",
1271
+ ...options.headers
1272
+ }
1273
+ });
1274
+ }
1275
+ setWorkItemParent(options) {
1276
+ return (options.client ?? this.client).patch({
1277
+ url: "/api/work-items/{workItemId}/parent",
1278
+ ...options,
1279
+ headers: {
1280
+ "Content-Type": "application/json",
1281
+ ...options.headers
1282
+ }
1283
+ });
1284
+ }
1285
+ }
1286
+
1287
+ class Conversations extends HeyApiClient {
1288
+ getConversation(options) {
1289
+ return (options.client ?? this.client).get({ url: "/api/conversations/{conversationId}", ...options });
1290
+ }
1291
+ listWorkItemConversations(options) {
1292
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}/conversations", ...options });
1293
+ }
1294
+ sendConversationMessage(options) {
1295
+ return (options.client ?? this.client).post({
1296
+ url: "/api/conversations/{conversationId}/messages",
1297
+ ...options,
1298
+ headers: {
1299
+ "Content-Type": "application/json",
1300
+ ...options.headers
1301
+ }
1302
+ });
1303
+ }
1304
+ continueConversation(options) {
1305
+ return (options.client ?? this.client).post({ url: "/api/conversations/{conversationId}/continue", ...options });
1306
+ }
1307
+ endConversation(options) {
1308
+ return (options.client ?? this.client).post({ url: "/api/conversations/{conversationId}/done", ...options });
1309
+ }
1310
+ }
1311
+
1312
+ class WorkItemComments extends HeyApiClient {
1313
+ listWorkItemComments(options) {
1314
+ return (options.client ?? this.client).get({ url: "/api/work-item-comments", ...options });
1315
+ }
1316
+ createWorkItemComment(options) {
1317
+ return (options.client ?? this.client).post({
1318
+ url: "/api/work-item-comments",
1319
+ ...options,
1320
+ headers: {
1321
+ "Content-Type": "application/json",
1322
+ ...options.headers
1323
+ }
1324
+ });
1325
+ }
1326
+ deleteWorkItemComment(options) {
1327
+ return (options.client ?? this.client).delete({ url: "/api/work-item-comments/{commentId}", ...options });
1328
+ }
1329
+ editWorkItemComment(options) {
1330
+ return (options.client ?? this.client).patch({
1331
+ url: "/api/work-item-comments/{commentId}",
1332
+ ...options,
1333
+ headers: {
1334
+ "Content-Type": "application/json",
1335
+ ...options.headers
1336
+ }
1337
+ });
1338
+ }
1339
+ setWorkItemCommentPin(options) {
1340
+ return (options.client ?? this.client).post({
1341
+ url: "/api/work-item-comments/{commentId}/pin",
1342
+ ...options,
1343
+ headers: {
1344
+ "Content-Type": "application/json",
1345
+ ...options.headers
1346
+ }
1347
+ });
1348
+ }
1349
+ }
1350
+
1351
+ class WorkItemCommentDrafts extends HeyApiClient {
1352
+ listPendingCommentDrafts(options) {
1353
+ return (options.client ?? this.client).get({ url: "/api/work-item-comment-drafts", ...options });
1354
+ }
1355
+ approveCommentDraft(options) {
1356
+ return (options.client ?? this.client).post({
1357
+ url: "/api/work-item-comment-drafts/{notificationId}/approve",
1358
+ ...options,
1359
+ headers: {
1360
+ "Content-Type": "application/json",
1361
+ ...options.headers
1362
+ }
1363
+ });
1364
+ }
1365
+ rejectCommentDraft(options) {
1366
+ return (options.client ?? this.client).post({ url: "/api/work-item-comment-drafts/{notificationId}/reject", ...options });
1367
+ }
1368
+ }
1369
+
1370
+ class WorkItemBlocks extends HeyApiClient {
1371
+ listWorkItemBlocks(options) {
1372
+ return (options.client ?? this.client).get({ url: "/api/work-item-blocks", ...options });
1373
+ }
1374
+ createWorkItemBlock(options) {
1375
+ return (options.client ?? this.client).post({
1376
+ url: "/api/work-item-blocks",
1377
+ ...options,
1378
+ headers: {
1379
+ "Content-Type": "application/json",
1380
+ ...options.headers
1381
+ }
1382
+ });
1383
+ }
1384
+ deleteWorkItemBlock(options) {
1385
+ return (options.client ?? this.client).delete({ url: "/api/work-item-blocks/{blockId}", ...options });
1386
+ }
1387
+ }
1388
+
1389
+ class ProjectArtifacts extends HeyApiClient {
1390
+ listProjectArtifacts(options) {
1391
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/artifacts", ...options });
1392
+ }
1393
+ deleteProjectArtifact(options) {
1394
+ return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/artifacts/{artifactId}", ...options });
1395
+ }
1396
+ getProjectArtifact(options) {
1397
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/artifacts/{artifactId}", ...options });
1398
+ }
1399
+ deleteProjectArtifacts(options) {
1400
+ return (options.client ?? this.client).delete({
1401
+ url: "/api/projects/{projectId}/artifacts/batch",
1402
+ ...options,
1403
+ headers: {
1404
+ "Content-Type": "application/json",
1405
+ ...options.headers
1406
+ }
1407
+ });
1408
+ }
1409
+ }
1410
+
1411
+ class UserNotifications extends HeyApiClient {
1412
+ listUserNotifications(options) {
1413
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notifications", ...options });
1414
+ }
1415
+ getUserNotification(options) {
1416
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notifications/{notificationId}", ...options });
1417
+ }
1418
+ dismissUserNotification(options) {
1419
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/notifications/{notificationId}/dismiss", ...options });
1420
+ }
1421
+ respondToFeedbackRequest(options) {
1422
+ return (options.client ?? this.client).post({
1423
+ url: "/api/projects/{projectId}/notifications/{notificationId}/respond",
1424
+ ...options,
1425
+ headers: {
1426
+ "Content-Type": "application/json",
1427
+ ...options.headers
1428
+ }
1429
+ });
1430
+ }
1431
+ }
1432
+
1433
+ class NotificationRules extends HeyApiClient {
1434
+ listNotificationRules(options) {
1435
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/notification-rules", ...options });
1436
+ }
1437
+ upsertNotificationRule(options) {
1438
+ return (options.client ?? this.client).put({
1439
+ url: "/api/projects/{projectId}/notification-rules",
1440
+ ...options,
1441
+ headers: {
1442
+ "Content-Type": "application/json",
1443
+ ...options.headers
1444
+ }
1445
+ });
1446
+ }
1447
+ }
1448
+
1449
+ class StepDefinitionTemplates extends HeyApiClient {
1450
+ listStepDefinitionTemplates(options) {
1451
+ return (options?.client ?? this.client).get({ url: "/api/step-definition-templates", ...options });
1452
+ }
1453
+ getStepDefinitionTemplate(options) {
1454
+ return (options.client ?? this.client).get({ url: "/api/step-definition-templates/{stepDefinitionTemplateId}", ...options });
1455
+ }
1456
+ instantiateStepDefinitionTemplate(options) {
1457
+ return (options.client ?? this.client).post({
1458
+ url: "/api/step-definition-templates/{stepDefinitionTemplateId}/instantiate",
1459
+ ...options,
1460
+ headers: {
1461
+ "Content-Type": "application/json",
1462
+ ...options.headers
1463
+ }
1464
+ });
1465
+ }
1466
+ }
1467
+
1468
+ class ProjectIntegrations extends HeyApiClient {
1469
+ listProjectIntegrations(options) {
1470
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/integrations", ...options });
1471
+ }
1472
+ createProjectIntegration(options) {
1473
+ return (options.client ?? this.client).post({
1474
+ url: "/api/projects/{projectId}/integrations",
1475
+ ...options,
1476
+ headers: {
1477
+ "Content-Type": "application/json",
1478
+ ...options.headers
1479
+ }
1480
+ });
1481
+ }
1482
+ syncProjectIntegration(options) {
1483
+ return (options.client ?? this.client).post({
1484
+ url: "/api/projects/{projectId}/integrations/{integrationId}/sync",
1485
+ ...options,
1486
+ headers: {
1487
+ "Content-Type": "application/json",
1488
+ ...options.headers
1489
+ }
1490
+ });
1491
+ }
1492
+ deleteProjectIntegration(options) {
1493
+ return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/integrations/{integrationId}", ...options });
1494
+ }
1495
+ }
1496
+
1497
+ class GitHubIntegrations extends HeyApiClient {
1498
+ beginGitHubAppInstall(options) {
1499
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/install", ...options });
1500
+ }
1501
+ completeGitHubAppInstall(options) {
1502
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/callback", ...options });
1503
+ }
1504
+ handleGitHubWebhook(options) {
1505
+ return (options?.client ?? this.client).post({ url: "/api/integrations/github/webhook", ...options });
1506
+ }
1507
+ listMyGitHubRepos(options) {
1508
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/repos", ...options });
1509
+ }
1510
+ refreshGitHubInstallationRepos(options) {
1511
+ return (options.client ?? this.client).post({ url: "/api/integrations/github/installations/{installationId}/refresh", ...options });
1512
+ }
1513
+ }
1514
+
1515
+ class ProjectInvites extends HeyApiClient {
1516
+ getProjectInviteByToken(options) {
1517
+ return (options.client ?? this.client).get({ url: "/api/project-invites/{token}", ...options });
1518
+ }
1519
+ listProjectInvites(options) {
1520
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/invites", ...options });
1521
+ }
1522
+ createProjectInvite(options) {
1523
+ return (options.client ?? this.client).post({
1524
+ url: "/api/projects/{projectId}/invites",
1525
+ ...options,
1526
+ headers: {
1527
+ "Content-Type": "application/json",
1528
+ ...options.headers
1529
+ }
1530
+ });
1531
+ }
1532
+ revokeProjectInvite(options) {
1533
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/invites/{inviteId}/revoke", ...options });
1534
+ }
1535
+ acceptProjectInvite(options) {
1536
+ return (options.client ?? this.client).post({ url: "/api/project-invites/{token}/accept", ...options });
1537
+ }
1538
+ }
1539
+
1540
+ class Billing extends HeyApiClient {
1541
+ getOrgUsage(options) {
1542
+ return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
1543
+ }
1544
+ }
1545
+
1546
+ class Username extends HeyApiClient {
1547
+ checkUsernameAvailable(options) {
1548
+ return (options.client ?? this.client).get({ url: "/api/username/available", ...options });
1549
+ }
1550
+ setUsername(options) {
1551
+ return (options.client ?? this.client).post({
1552
+ url: "/api/username",
1553
+ ...options,
1554
+ headers: {
1555
+ "Content-Type": "application/json",
1556
+ ...options.headers
1557
+ }
1558
+ });
1559
+ }
1560
+ }
1561
+
1562
+ class Secrets extends HeyApiClient {
1563
+ listMySecrets(options) {
1564
+ return (options?.client ?? this.client).get({ url: "/api/me/secrets", ...options });
1565
+ }
1566
+ createMySecret(options) {
1567
+ return (options.client ?? this.client).post({
1568
+ url: "/api/me/secrets",
1569
+ ...options,
1570
+ headers: {
1571
+ "Content-Type": "application/json",
1572
+ ...options.headers
1573
+ }
1574
+ });
1575
+ }
1576
+ deleteMySecret(options) {
1577
+ return (options.client ?? this.client).delete({ url: "/api/me/secrets/{secretId}", ...options });
1578
+ }
1579
+ renameMySecret(options) {
1580
+ return (options.client ?? this.client).patch({
1581
+ url: "/api/me/secrets/{secretId}",
1582
+ ...options,
1583
+ headers: {
1584
+ "Content-Type": "application/json",
1585
+ ...options.headers
1586
+ }
1587
+ });
1588
+ }
1589
+ }
1590
+
1591
+ class ScarnClient extends HeyApiClient {
1592
+ static __registry = new HeyApiRegistry;
1593
+ constructor(args) {
1594
+ super(args);
1595
+ ScarnClient.__registry.set(this, args?.key);
1596
+ }
1597
+ _api;
1598
+ get api() {
1599
+ return this._api ??= new Api({ client: this.client });
1600
+ }
1601
+ _projects;
1602
+ get projects() {
1603
+ return this._projects ??= new Projects({ client: this.client });
1604
+ }
1605
+ _stepDefinitions;
1606
+ get stepDefinitions() {
1607
+ return this._stepDefinitions ??= new StepDefinitions({ client: this.client });
1608
+ }
1609
+ _tasks;
1610
+ get tasks() {
1611
+ return this._tasks ??= new Tasks({ client: this.client });
1612
+ }
1613
+ _taskRuns;
1614
+ get taskRuns() {
1615
+ return this._taskRuns ??= new TaskRuns({ client: this.client });
1616
+ }
1617
+ _pipelineDefinitions;
1618
+ get pipelineDefinitions() {
1619
+ return this._pipelineDefinitions ??= new PipelineDefinitions({ client: this.client });
1620
+ }
1621
+ _pipelineExecutions;
1622
+ get pipelineExecutions() {
1623
+ return this._pipelineExecutions ??= new PipelineExecutions({ client: this.client });
1624
+ }
1625
+ _workItems;
1626
+ get workItems() {
1627
+ return this._workItems ??= new WorkItems({ client: this.client });
1628
+ }
1629
+ _conversations;
1630
+ get conversations() {
1631
+ return this._conversations ??= new Conversations({ client: this.client });
1632
+ }
1633
+ _workItemComments;
1634
+ get workItemComments() {
1635
+ return this._workItemComments ??= new WorkItemComments({ client: this.client });
1636
+ }
1637
+ _workItemCommentDrafts;
1638
+ get workItemCommentDrafts() {
1639
+ return this._workItemCommentDrafts ??= new WorkItemCommentDrafts({ client: this.client });
1640
+ }
1641
+ _workItemBlocks;
1642
+ get workItemBlocks() {
1643
+ return this._workItemBlocks ??= new WorkItemBlocks({ client: this.client });
1644
+ }
1645
+ _projectArtifacts;
1646
+ get projectArtifacts() {
1647
+ return this._projectArtifacts ??= new ProjectArtifacts({ client: this.client });
1648
+ }
1649
+ _userNotifications;
1650
+ get userNotifications() {
1651
+ return this._userNotifications ??= new UserNotifications({ client: this.client });
1652
+ }
1653
+ _notificationRules;
1654
+ get notificationRules() {
1655
+ return this._notificationRules ??= new NotificationRules({ client: this.client });
1656
+ }
1657
+ _stepDefinitionTemplates;
1658
+ get stepDefinitionTemplates() {
1659
+ return this._stepDefinitionTemplates ??= new StepDefinitionTemplates({ client: this.client });
1660
+ }
1661
+ _projectIntegrations;
1662
+ get projectIntegrations() {
1663
+ return this._projectIntegrations ??= new ProjectIntegrations({ client: this.client });
1664
+ }
1665
+ _gitHubIntegrations;
1666
+ get gitHubIntegrations() {
1667
+ return this._gitHubIntegrations ??= new GitHubIntegrations({ client: this.client });
1668
+ }
1669
+ _projectInvites;
1670
+ get projectInvites() {
1671
+ return this._projectInvites ??= new ProjectInvites({ client: this.client });
1672
+ }
1673
+ _billing;
1674
+ get billing() {
1675
+ return this._billing ??= new Billing({ client: this.client });
1676
+ }
1677
+ _username;
1678
+ get username() {
1679
+ return this._username ??= new Username({ client: this.client });
1680
+ }
1681
+ _secrets;
1682
+ get secrets() {
1683
+ return this._secrets ??= new Secrets({ client: this.client });
1684
+ }
1685
+ }
1686
+
1687
+ export { createClient, Api, Projects, StepDefinitions, Tasks, TaskRuns, PipelineDefinitions, PipelineExecutions, WorkItems, Conversations, WorkItemComments, WorkItemCommentDrafts, WorkItemBlocks, ProjectArtifacts, UserNotifications, NotificationRules, StepDefinitionTemplates, ProjectIntegrations, GitHubIntegrations, ProjectInvites, Billing, Username, Secrets, ScarnClient };