@scarn/sdk 0.8.20 → 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/api-token-cache.d.ts +24 -0
- package/dist/auth/api-token-source.d.ts +39 -0
- package/dist/auth/authenticated-fetch.d.ts +10 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +19 -0
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-habmdf89.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-mzj1j0p5.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-qgkx89eg.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-n3ywwx7n.js → chunk-52520csz.js} +15 -14
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-tr3v83cn.js → chunk-5fa4arn1.js} +18 -11
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-yq0sf8sb.js → chunk-7dr4kybf.js} +483 -451
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-yf15kdte.js → chunk-9ct3xypr.js} +2636 -3864
- package/dist/chunk-9geh4c3v.js +1034 -0
- package/dist/{chunk-19brnwkp.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-z4smq8qd.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-t1dq2c2s.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-rq5k7m33.js → chunk-k7xnsmp5.js} +182 -97
- package/dist/{chunk-91f5gm5z.js → chunk-kbpkpxcn.js} +22 -21
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-g4j5cfpc.js → chunk-p3s7cjfc.js} +17 -16
- 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-0c60x3v8.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-098740f7.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- package/dist/client.d.ts +5 -1
- 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/create-api-client.d.ts +11 -0
- package/dist/defaults/index.js +44 -884
- package/dist/defaults/load-push-defaults.d.ts +11 -4
- package/dist/defaults/project-ref.d.ts +2 -4
- package/dist/definitions/automations/automations-client.d.ts +2 -1
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/environments-client.d.ts +2 -1
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +2 -1
- 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 +20 -1
- 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 +109 -79
- package/dist/push/push-from-directory.d.ts +9 -1
- 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 +143 -1
- package/package.json +11 -3
- package/dist/chunk-46wmsgv7.js +0 -14
- package/dist/chunk-a56zc4s5.js +0 -119
- package/dist/chunk-aemxz9r7.js +0 -107
- package/dist/chunk-b9ja6ss5.js +0 -275
- package/dist/chunk-e0pt5x0e.js +0 -167
- package/dist/chunk-pqtd0hr7.js +0 -96
- package/dist/chunk-rphfy0fj.js +0 -167
- package/dist/chunk-y34zsgsw.js +0 -39
- package/dist/chunk-y64skrwp.js +0 -17
package/dist/defaults/index.js
CHANGED
|
@@ -1,872 +1,35 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
parse,
|
|
4
|
+
writeJsonFileAtomically,
|
|
5
|
+
setHomeDirForTests2,
|
|
6
|
+
resolveHomeDir2,
|
|
7
|
+
createApiTokenSource2,
|
|
8
|
+
createAuthenticatedFetch2
|
|
9
|
+
} from "../chunk-9geh4c3v.js";
|
|
5
10
|
import {
|
|
6
|
-
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import"../chunk-
|
|
9
|
-
import
|
|
11
|
+
parseJsonc2
|
|
12
|
+
} from "../chunk-h9yxx0hd.js";
|
|
13
|
+
import"../chunk-k7xnsmp5.js";
|
|
14
|
+
import {
|
|
15
|
+
createScarnClient2
|
|
16
|
+
} from "../chunk-5fa4arn1.js";
|
|
10
17
|
|
|
11
18
|
// src/defaults/auth-file.ts
|
|
12
|
-
import { existsSync as
|
|
19
|
+
import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync2, rmSync as rmSync2 } from "fs";
|
|
13
20
|
import { join as join2 } from "path";
|
|
14
21
|
|
|
15
|
-
// ../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
16
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
17
|
-
const len = text.length;
|
|
18
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
19
|
-
function scanHexDigits(count, exact) {
|
|
20
|
-
let digits = 0;
|
|
21
|
-
let value2 = 0;
|
|
22
|
-
while (digits < count || !exact) {
|
|
23
|
-
let ch = text.charCodeAt(pos);
|
|
24
|
-
if (ch >= 48 && ch <= 57) {
|
|
25
|
-
value2 = value2 * 16 + ch - 48;
|
|
26
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
27
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
28
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
29
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
30
|
-
} else {
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
pos++;
|
|
34
|
-
digits++;
|
|
35
|
-
}
|
|
36
|
-
if (digits < count) {
|
|
37
|
-
value2 = -1;
|
|
38
|
-
}
|
|
39
|
-
return value2;
|
|
40
|
-
}
|
|
41
|
-
function setPosition(newPosition) {
|
|
42
|
-
pos = newPosition;
|
|
43
|
-
value = "";
|
|
44
|
-
tokenOffset = 0;
|
|
45
|
-
token = 16;
|
|
46
|
-
scanError = 0;
|
|
47
|
-
}
|
|
48
|
-
function scanNumber() {
|
|
49
|
-
let start = pos;
|
|
50
|
-
if (text.charCodeAt(pos) === 48) {
|
|
51
|
-
pos++;
|
|
52
|
-
} else {
|
|
53
|
-
pos++;
|
|
54
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
55
|
-
pos++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
59
|
-
pos++;
|
|
60
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
61
|
-
pos++;
|
|
62
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
63
|
-
pos++;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
scanError = 3;
|
|
67
|
-
return text.substring(start, pos);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
let end = pos;
|
|
71
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
72
|
-
pos++;
|
|
73
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
74
|
-
pos++;
|
|
75
|
-
}
|
|
76
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
77
|
-
pos++;
|
|
78
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
79
|
-
pos++;
|
|
80
|
-
}
|
|
81
|
-
end = pos;
|
|
82
|
-
} else {
|
|
83
|
-
scanError = 3;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return text.substring(start, end);
|
|
87
|
-
}
|
|
88
|
-
function scanString() {
|
|
89
|
-
let result = "", start = pos;
|
|
90
|
-
while (true) {
|
|
91
|
-
if (pos >= len) {
|
|
92
|
-
result += text.substring(start, pos);
|
|
93
|
-
scanError = 2;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
const ch = text.charCodeAt(pos);
|
|
97
|
-
if (ch === 34) {
|
|
98
|
-
result += text.substring(start, pos);
|
|
99
|
-
pos++;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
if (ch === 92) {
|
|
103
|
-
result += text.substring(start, pos);
|
|
104
|
-
pos++;
|
|
105
|
-
if (pos >= len) {
|
|
106
|
-
scanError = 2;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
const ch2 = text.charCodeAt(pos++);
|
|
110
|
-
switch (ch2) {
|
|
111
|
-
case 34:
|
|
112
|
-
result += '"';
|
|
113
|
-
break;
|
|
114
|
-
case 92:
|
|
115
|
-
result += "\\";
|
|
116
|
-
break;
|
|
117
|
-
case 47:
|
|
118
|
-
result += "/";
|
|
119
|
-
break;
|
|
120
|
-
case 98:
|
|
121
|
-
result += "\b";
|
|
122
|
-
break;
|
|
123
|
-
case 102:
|
|
124
|
-
result += "\f";
|
|
125
|
-
break;
|
|
126
|
-
case 110:
|
|
127
|
-
result += `
|
|
128
|
-
`;
|
|
129
|
-
break;
|
|
130
|
-
case 114:
|
|
131
|
-
result += "\r";
|
|
132
|
-
break;
|
|
133
|
-
case 116:
|
|
134
|
-
result += "\t";
|
|
135
|
-
break;
|
|
136
|
-
case 117:
|
|
137
|
-
const ch3 = scanHexDigits(4, true);
|
|
138
|
-
if (ch3 >= 0) {
|
|
139
|
-
result += String.fromCharCode(ch3);
|
|
140
|
-
} else {
|
|
141
|
-
scanError = 4;
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
scanError = 5;
|
|
146
|
-
}
|
|
147
|
-
start = pos;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if (ch >= 0 && ch <= 31) {
|
|
151
|
-
if (isLineBreak(ch)) {
|
|
152
|
-
result += text.substring(start, pos);
|
|
153
|
-
scanError = 2;
|
|
154
|
-
break;
|
|
155
|
-
} else {
|
|
156
|
-
scanError = 6;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
pos++;
|
|
160
|
-
}
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
function scanNext() {
|
|
164
|
-
value = "";
|
|
165
|
-
scanError = 0;
|
|
166
|
-
tokenOffset = pos;
|
|
167
|
-
lineStartOffset = lineNumber;
|
|
168
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
169
|
-
if (pos >= len) {
|
|
170
|
-
tokenOffset = len;
|
|
171
|
-
return token = 17;
|
|
172
|
-
}
|
|
173
|
-
let code = text.charCodeAt(pos);
|
|
174
|
-
if (isWhiteSpace(code)) {
|
|
175
|
-
do {
|
|
176
|
-
pos++;
|
|
177
|
-
value += String.fromCharCode(code);
|
|
178
|
-
code = text.charCodeAt(pos);
|
|
179
|
-
} while (isWhiteSpace(code));
|
|
180
|
-
return token = 15;
|
|
181
|
-
}
|
|
182
|
-
if (isLineBreak(code)) {
|
|
183
|
-
pos++;
|
|
184
|
-
value += String.fromCharCode(code);
|
|
185
|
-
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
186
|
-
pos++;
|
|
187
|
-
value += `
|
|
188
|
-
`;
|
|
189
|
-
}
|
|
190
|
-
lineNumber++;
|
|
191
|
-
tokenLineStartOffset = pos;
|
|
192
|
-
return token = 14;
|
|
193
|
-
}
|
|
194
|
-
switch (code) {
|
|
195
|
-
case 123:
|
|
196
|
-
pos++;
|
|
197
|
-
return token = 1;
|
|
198
|
-
case 125:
|
|
199
|
-
pos++;
|
|
200
|
-
return token = 2;
|
|
201
|
-
case 91:
|
|
202
|
-
pos++;
|
|
203
|
-
return token = 3;
|
|
204
|
-
case 93:
|
|
205
|
-
pos++;
|
|
206
|
-
return token = 4;
|
|
207
|
-
case 58:
|
|
208
|
-
pos++;
|
|
209
|
-
return token = 6;
|
|
210
|
-
case 44:
|
|
211
|
-
pos++;
|
|
212
|
-
return token = 5;
|
|
213
|
-
case 34:
|
|
214
|
-
pos++;
|
|
215
|
-
value = scanString();
|
|
216
|
-
return token = 10;
|
|
217
|
-
case 47:
|
|
218
|
-
const start = pos - 1;
|
|
219
|
-
if (text.charCodeAt(pos + 1) === 47) {
|
|
220
|
-
pos += 2;
|
|
221
|
-
while (pos < len) {
|
|
222
|
-
if (isLineBreak(text.charCodeAt(pos))) {
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
pos++;
|
|
226
|
-
}
|
|
227
|
-
value = text.substring(start, pos);
|
|
228
|
-
return token = 12;
|
|
229
|
-
}
|
|
230
|
-
if (text.charCodeAt(pos + 1) === 42) {
|
|
231
|
-
pos += 2;
|
|
232
|
-
const safeLength = len - 1;
|
|
233
|
-
let commentClosed = false;
|
|
234
|
-
while (pos < safeLength) {
|
|
235
|
-
const ch = text.charCodeAt(pos);
|
|
236
|
-
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
237
|
-
pos += 2;
|
|
238
|
-
commentClosed = true;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
pos++;
|
|
242
|
-
if (isLineBreak(ch)) {
|
|
243
|
-
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
244
|
-
pos++;
|
|
245
|
-
}
|
|
246
|
-
lineNumber++;
|
|
247
|
-
tokenLineStartOffset = pos;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (!commentClosed) {
|
|
251
|
-
pos++;
|
|
252
|
-
scanError = 1;
|
|
253
|
-
}
|
|
254
|
-
value = text.substring(start, pos);
|
|
255
|
-
return token = 13;
|
|
256
|
-
}
|
|
257
|
-
value += String.fromCharCode(code);
|
|
258
|
-
pos++;
|
|
259
|
-
return token = 16;
|
|
260
|
-
case 45:
|
|
261
|
-
value += String.fromCharCode(code);
|
|
262
|
-
pos++;
|
|
263
|
-
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
264
|
-
return token = 16;
|
|
265
|
-
}
|
|
266
|
-
case 48:
|
|
267
|
-
case 49:
|
|
268
|
-
case 50:
|
|
269
|
-
case 51:
|
|
270
|
-
case 52:
|
|
271
|
-
case 53:
|
|
272
|
-
case 54:
|
|
273
|
-
case 55:
|
|
274
|
-
case 56:
|
|
275
|
-
case 57:
|
|
276
|
-
value += scanNumber();
|
|
277
|
-
return token = 11;
|
|
278
|
-
default:
|
|
279
|
-
while (pos < len && isUnknownContentCharacter(code)) {
|
|
280
|
-
pos++;
|
|
281
|
-
code = text.charCodeAt(pos);
|
|
282
|
-
}
|
|
283
|
-
if (tokenOffset !== pos) {
|
|
284
|
-
value = text.substring(tokenOffset, pos);
|
|
285
|
-
switch (value) {
|
|
286
|
-
case "true":
|
|
287
|
-
return token = 8;
|
|
288
|
-
case "false":
|
|
289
|
-
return token = 9;
|
|
290
|
-
case "null":
|
|
291
|
-
return token = 7;
|
|
292
|
-
}
|
|
293
|
-
return token = 16;
|
|
294
|
-
}
|
|
295
|
-
value += String.fromCharCode(code);
|
|
296
|
-
pos++;
|
|
297
|
-
return token = 16;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function isUnknownContentCharacter(code) {
|
|
301
|
-
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
switch (code) {
|
|
305
|
-
case 125:
|
|
306
|
-
case 93:
|
|
307
|
-
case 123:
|
|
308
|
-
case 91:
|
|
309
|
-
case 34:
|
|
310
|
-
case 58:
|
|
311
|
-
case 44:
|
|
312
|
-
case 47:
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
function scanNextNonTrivia() {
|
|
318
|
-
let result;
|
|
319
|
-
do {
|
|
320
|
-
result = scanNext();
|
|
321
|
-
} while (result >= 12 && result <= 15);
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
return {
|
|
325
|
-
setPosition,
|
|
326
|
-
getPosition: () => pos,
|
|
327
|
-
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
328
|
-
getToken: () => token,
|
|
329
|
-
getTokenValue: () => value,
|
|
330
|
-
getTokenOffset: () => tokenOffset,
|
|
331
|
-
getTokenLength: () => pos - tokenOffset,
|
|
332
|
-
getTokenStartLine: () => lineStartOffset,
|
|
333
|
-
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
334
|
-
getTokenError: () => scanError
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
function isWhiteSpace(ch) {
|
|
338
|
-
return ch === 32 || ch === 9;
|
|
339
|
-
}
|
|
340
|
-
function isLineBreak(ch) {
|
|
341
|
-
return ch === 10 || ch === 13;
|
|
342
|
-
}
|
|
343
|
-
function isDigit(ch) {
|
|
344
|
-
return ch >= 48 && ch <= 57;
|
|
345
|
-
}
|
|
346
|
-
var CharacterCodes;
|
|
347
|
-
(function(CharacterCodes2) {
|
|
348
|
-
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
349
|
-
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
350
|
-
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
351
|
-
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
352
|
-
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
353
|
-
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
354
|
-
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
355
|
-
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
356
|
-
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
357
|
-
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
358
|
-
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
359
|
-
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
360
|
-
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
361
|
-
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
362
|
-
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
363
|
-
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
364
|
-
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
365
|
-
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
366
|
-
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
367
|
-
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
368
|
-
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
369
|
-
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
370
|
-
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
371
|
-
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
372
|
-
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
373
|
-
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
374
|
-
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
375
|
-
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
376
|
-
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
377
|
-
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
378
|
-
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
379
|
-
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
380
|
-
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
381
|
-
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
382
|
-
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
383
|
-
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
384
|
-
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
385
|
-
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
386
|
-
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
387
|
-
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
388
|
-
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
389
|
-
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
390
|
-
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
391
|
-
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
392
|
-
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
393
|
-
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
394
|
-
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
395
|
-
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
396
|
-
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
397
|
-
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
398
|
-
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
399
|
-
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
400
|
-
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
401
|
-
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
402
|
-
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
403
|
-
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
404
|
-
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
405
|
-
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
406
|
-
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
407
|
-
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
408
|
-
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
409
|
-
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
410
|
-
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
411
|
-
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
412
|
-
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
413
|
-
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
414
|
-
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
415
|
-
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
416
|
-
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
417
|
-
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
418
|
-
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
419
|
-
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
420
|
-
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
421
|
-
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
422
|
-
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
423
|
-
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
424
|
-
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
425
|
-
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
426
|
-
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
427
|
-
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
428
|
-
})(CharacterCodes || (CharacterCodes = {}));
|
|
429
|
-
|
|
430
|
-
// ../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
431
|
-
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
432
|
-
return " ".repeat(index);
|
|
433
|
-
});
|
|
434
|
-
var maxCachedValues = 200;
|
|
435
|
-
var cachedBreakLinesWithSpaces = {
|
|
436
|
-
" ": {
|
|
437
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
438
|
-
return `
|
|
439
|
-
` + " ".repeat(index);
|
|
440
|
-
}),
|
|
441
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
442
|
-
return "\r" + " ".repeat(index);
|
|
443
|
-
}),
|
|
444
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
445
|
-
return `\r
|
|
446
|
-
` + " ".repeat(index);
|
|
447
|
-
})
|
|
448
|
-
},
|
|
449
|
-
"\t": {
|
|
450
|
-
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
451
|
-
return `
|
|
452
|
-
` + "\t".repeat(index);
|
|
453
|
-
}),
|
|
454
|
-
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
455
|
-
return "\r" + "\t".repeat(index);
|
|
456
|
-
}),
|
|
457
|
-
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
458
|
-
return `\r
|
|
459
|
-
` + "\t".repeat(index);
|
|
460
|
-
})
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
// ../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
465
|
-
var ParseOptions;
|
|
466
|
-
(function(ParseOptions2) {
|
|
467
|
-
ParseOptions2.DEFAULT = {
|
|
468
|
-
allowTrailingComma: false
|
|
469
|
-
};
|
|
470
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
471
|
-
function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
472
|
-
let currentProperty = null;
|
|
473
|
-
let currentParent = [];
|
|
474
|
-
const previousParents = [];
|
|
475
|
-
function onValue(value) {
|
|
476
|
-
if (Array.isArray(currentParent)) {
|
|
477
|
-
currentParent.push(value);
|
|
478
|
-
} else if (currentProperty !== null) {
|
|
479
|
-
currentParent[currentProperty] = value;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
const visitor = {
|
|
483
|
-
onObjectBegin: () => {
|
|
484
|
-
const object = {};
|
|
485
|
-
onValue(object);
|
|
486
|
-
previousParents.push(currentParent);
|
|
487
|
-
currentParent = object;
|
|
488
|
-
currentProperty = null;
|
|
489
|
-
},
|
|
490
|
-
onObjectProperty: (name) => {
|
|
491
|
-
currentProperty = name;
|
|
492
|
-
},
|
|
493
|
-
onObjectEnd: () => {
|
|
494
|
-
currentParent = previousParents.pop();
|
|
495
|
-
},
|
|
496
|
-
onArrayBegin: () => {
|
|
497
|
-
const array = [];
|
|
498
|
-
onValue(array);
|
|
499
|
-
previousParents.push(currentParent);
|
|
500
|
-
currentParent = array;
|
|
501
|
-
currentProperty = null;
|
|
502
|
-
},
|
|
503
|
-
onArrayEnd: () => {
|
|
504
|
-
currentParent = previousParents.pop();
|
|
505
|
-
},
|
|
506
|
-
onLiteralValue: onValue,
|
|
507
|
-
onError: (error, offset, length) => {
|
|
508
|
-
errors.push({ error, offset, length });
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
visit(text, visitor, options);
|
|
512
|
-
return currentParent[0];
|
|
513
|
-
}
|
|
514
|
-
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
515
|
-
const _scanner = createScanner(text, false);
|
|
516
|
-
const _jsonPath = [];
|
|
517
|
-
let suppressedCallbacks = 0;
|
|
518
|
-
function toNoArgVisit(visitFunction) {
|
|
519
|
-
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
520
|
-
}
|
|
521
|
-
function toOneArgVisit(visitFunction) {
|
|
522
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
523
|
-
}
|
|
524
|
-
function toOneArgVisitWithPath(visitFunction) {
|
|
525
|
-
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
526
|
-
}
|
|
527
|
-
function toBeginVisit(visitFunction) {
|
|
528
|
-
return visitFunction ? () => {
|
|
529
|
-
if (suppressedCallbacks > 0) {
|
|
530
|
-
suppressedCallbacks++;
|
|
531
|
-
} else {
|
|
532
|
-
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
533
|
-
if (cbReturn === false) {
|
|
534
|
-
suppressedCallbacks = 1;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
} : () => true;
|
|
538
|
-
}
|
|
539
|
-
function toEndVisit(visitFunction) {
|
|
540
|
-
return visitFunction ? () => {
|
|
541
|
-
if (suppressedCallbacks > 0) {
|
|
542
|
-
suppressedCallbacks--;
|
|
543
|
-
}
|
|
544
|
-
if (suppressedCallbacks === 0) {
|
|
545
|
-
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
546
|
-
}
|
|
547
|
-
} : () => true;
|
|
548
|
-
}
|
|
549
|
-
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
550
|
-
const disallowComments = options && options.disallowComments;
|
|
551
|
-
const allowTrailingComma = options && options.allowTrailingComma;
|
|
552
|
-
function scanNext() {
|
|
553
|
-
while (true) {
|
|
554
|
-
const token = _scanner.scan();
|
|
555
|
-
switch (_scanner.getTokenError()) {
|
|
556
|
-
case 4:
|
|
557
|
-
handleError(14);
|
|
558
|
-
break;
|
|
559
|
-
case 5:
|
|
560
|
-
handleError(15);
|
|
561
|
-
break;
|
|
562
|
-
case 3:
|
|
563
|
-
handleError(13);
|
|
564
|
-
break;
|
|
565
|
-
case 1:
|
|
566
|
-
if (!disallowComments) {
|
|
567
|
-
handleError(11);
|
|
568
|
-
}
|
|
569
|
-
break;
|
|
570
|
-
case 2:
|
|
571
|
-
handleError(12);
|
|
572
|
-
break;
|
|
573
|
-
case 6:
|
|
574
|
-
handleError(16);
|
|
575
|
-
break;
|
|
576
|
-
}
|
|
577
|
-
switch (token) {
|
|
578
|
-
case 12:
|
|
579
|
-
case 13:
|
|
580
|
-
if (disallowComments) {
|
|
581
|
-
handleError(10);
|
|
582
|
-
} else {
|
|
583
|
-
onComment();
|
|
584
|
-
}
|
|
585
|
-
break;
|
|
586
|
-
case 16:
|
|
587
|
-
handleError(1);
|
|
588
|
-
break;
|
|
589
|
-
case 15:
|
|
590
|
-
case 14:
|
|
591
|
-
break;
|
|
592
|
-
default:
|
|
593
|
-
return token;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
598
|
-
onError(error);
|
|
599
|
-
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
600
|
-
let token = _scanner.getToken();
|
|
601
|
-
while (token !== 17) {
|
|
602
|
-
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
603
|
-
scanNext();
|
|
604
|
-
break;
|
|
605
|
-
} else if (skipUntil.indexOf(token) !== -1) {
|
|
606
|
-
break;
|
|
607
|
-
}
|
|
608
|
-
token = scanNext();
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function parseString(isValue) {
|
|
613
|
-
const value = _scanner.getTokenValue();
|
|
614
|
-
if (isValue) {
|
|
615
|
-
onLiteralValue(value);
|
|
616
|
-
} else {
|
|
617
|
-
onObjectProperty(value);
|
|
618
|
-
_jsonPath.push(value);
|
|
619
|
-
}
|
|
620
|
-
scanNext();
|
|
621
|
-
return true;
|
|
622
|
-
}
|
|
623
|
-
function parseLiteral() {
|
|
624
|
-
switch (_scanner.getToken()) {
|
|
625
|
-
case 11:
|
|
626
|
-
const tokenValue = _scanner.getTokenValue();
|
|
627
|
-
let value = Number(tokenValue);
|
|
628
|
-
if (isNaN(value)) {
|
|
629
|
-
handleError(2);
|
|
630
|
-
value = 0;
|
|
631
|
-
}
|
|
632
|
-
onLiteralValue(value);
|
|
633
|
-
break;
|
|
634
|
-
case 7:
|
|
635
|
-
onLiteralValue(null);
|
|
636
|
-
break;
|
|
637
|
-
case 8:
|
|
638
|
-
onLiteralValue(true);
|
|
639
|
-
break;
|
|
640
|
-
case 9:
|
|
641
|
-
onLiteralValue(false);
|
|
642
|
-
break;
|
|
643
|
-
default:
|
|
644
|
-
return false;
|
|
645
|
-
}
|
|
646
|
-
scanNext();
|
|
647
|
-
return true;
|
|
648
|
-
}
|
|
649
|
-
function parseProperty() {
|
|
650
|
-
if (_scanner.getToken() !== 10) {
|
|
651
|
-
handleError(3, [], [2, 5]);
|
|
652
|
-
return false;
|
|
653
|
-
}
|
|
654
|
-
parseString(false);
|
|
655
|
-
if (_scanner.getToken() === 6) {
|
|
656
|
-
onSeparator(":");
|
|
657
|
-
scanNext();
|
|
658
|
-
if (!parseValue()) {
|
|
659
|
-
handleError(4, [], [2, 5]);
|
|
660
|
-
}
|
|
661
|
-
} else {
|
|
662
|
-
handleError(5, [], [2, 5]);
|
|
663
|
-
}
|
|
664
|
-
_jsonPath.pop();
|
|
665
|
-
return true;
|
|
666
|
-
}
|
|
667
|
-
function parseObject() {
|
|
668
|
-
onObjectBegin();
|
|
669
|
-
scanNext();
|
|
670
|
-
let needsComma = false;
|
|
671
|
-
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
672
|
-
if (_scanner.getToken() === 5) {
|
|
673
|
-
if (!needsComma) {
|
|
674
|
-
handleError(4, [], []);
|
|
675
|
-
}
|
|
676
|
-
onSeparator(",");
|
|
677
|
-
scanNext();
|
|
678
|
-
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
} else if (needsComma) {
|
|
682
|
-
handleError(6, [], []);
|
|
683
|
-
}
|
|
684
|
-
if (!parseProperty()) {
|
|
685
|
-
handleError(4, [], [2, 5]);
|
|
686
|
-
}
|
|
687
|
-
needsComma = true;
|
|
688
|
-
}
|
|
689
|
-
onObjectEnd();
|
|
690
|
-
if (_scanner.getToken() !== 2) {
|
|
691
|
-
handleError(7, [2], []);
|
|
692
|
-
} else {
|
|
693
|
-
scanNext();
|
|
694
|
-
}
|
|
695
|
-
return true;
|
|
696
|
-
}
|
|
697
|
-
function parseArray() {
|
|
698
|
-
onArrayBegin();
|
|
699
|
-
scanNext();
|
|
700
|
-
let isFirstElement = true;
|
|
701
|
-
let needsComma = false;
|
|
702
|
-
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
703
|
-
if (_scanner.getToken() === 5) {
|
|
704
|
-
if (!needsComma) {
|
|
705
|
-
handleError(4, [], []);
|
|
706
|
-
}
|
|
707
|
-
onSeparator(",");
|
|
708
|
-
scanNext();
|
|
709
|
-
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
710
|
-
break;
|
|
711
|
-
}
|
|
712
|
-
} else if (needsComma) {
|
|
713
|
-
handleError(6, [], []);
|
|
714
|
-
}
|
|
715
|
-
if (isFirstElement) {
|
|
716
|
-
_jsonPath.push(0);
|
|
717
|
-
isFirstElement = false;
|
|
718
|
-
} else {
|
|
719
|
-
_jsonPath[_jsonPath.length - 1]++;
|
|
720
|
-
}
|
|
721
|
-
if (!parseValue()) {
|
|
722
|
-
handleError(4, [], [4, 5]);
|
|
723
|
-
}
|
|
724
|
-
needsComma = true;
|
|
725
|
-
}
|
|
726
|
-
onArrayEnd();
|
|
727
|
-
if (!isFirstElement) {
|
|
728
|
-
_jsonPath.pop();
|
|
729
|
-
}
|
|
730
|
-
if (_scanner.getToken() !== 4) {
|
|
731
|
-
handleError(8, [4], []);
|
|
732
|
-
} else {
|
|
733
|
-
scanNext();
|
|
734
|
-
}
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
function parseValue() {
|
|
738
|
-
switch (_scanner.getToken()) {
|
|
739
|
-
case 3:
|
|
740
|
-
return parseArray();
|
|
741
|
-
case 1:
|
|
742
|
-
return parseObject();
|
|
743
|
-
case 10:
|
|
744
|
-
return parseString(true);
|
|
745
|
-
default:
|
|
746
|
-
return parseLiteral();
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
scanNext();
|
|
750
|
-
if (_scanner.getToken() === 17) {
|
|
751
|
-
if (options.allowEmptyContent) {
|
|
752
|
-
return true;
|
|
753
|
-
}
|
|
754
|
-
handleError(4, [], []);
|
|
755
|
-
return false;
|
|
756
|
-
}
|
|
757
|
-
if (!parseValue()) {
|
|
758
|
-
handleError(4, [], []);
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
if (_scanner.getToken() !== 17) {
|
|
762
|
-
handleError(9, [], []);
|
|
763
|
-
}
|
|
764
|
-
return true;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// ../../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
768
|
-
var ScanError;
|
|
769
|
-
(function(ScanError2) {
|
|
770
|
-
ScanError2[ScanError2["None"] = 0] = "None";
|
|
771
|
-
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
772
|
-
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
773
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
774
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
775
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
776
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
777
|
-
})(ScanError || (ScanError = {}));
|
|
778
|
-
var SyntaxKind;
|
|
779
|
-
(function(SyntaxKind2) {
|
|
780
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
781
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
782
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
783
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
784
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
785
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
786
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
787
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
788
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
789
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
790
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
791
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
792
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
793
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
794
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
795
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
796
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
797
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
798
|
-
var parse2 = parse;
|
|
799
|
-
var ParseErrorCode;
|
|
800
|
-
(function(ParseErrorCode2) {
|
|
801
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
802
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
803
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
804
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
805
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
806
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
807
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
808
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
809
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
810
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
811
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
812
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
813
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
814
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
815
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
816
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
817
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
818
|
-
|
|
819
|
-
// src/defaults/atomic-json-file.ts
|
|
820
|
-
import {
|
|
821
|
-
chmodSync,
|
|
822
|
-
existsSync,
|
|
823
|
-
mkdirSync,
|
|
824
|
-
renameSync,
|
|
825
|
-
writeFileSync
|
|
826
|
-
} from "fs";
|
|
827
|
-
import { dirname } from "path";
|
|
828
|
-
var ensureFilePermissions = (filePath) => {
|
|
829
|
-
try {
|
|
830
|
-
chmodSync(filePath, 384);
|
|
831
|
-
} catch {}
|
|
832
|
-
};
|
|
833
|
-
function writeJsonFileAtomically(filePath, data) {
|
|
834
|
-
const parentDirectory = dirname(filePath);
|
|
835
|
-
if (!existsSync(parentDirectory)) {
|
|
836
|
-
mkdirSync(parentDirectory, { recursive: true });
|
|
837
|
-
}
|
|
838
|
-
const temporaryPath = `${filePath}.${String(process.pid)}.${String(Date.now())}.tmp`;
|
|
839
|
-
writeFileSync(temporaryPath, `${JSON.stringify(data, null, 2)}
|
|
840
|
-
`, {
|
|
841
|
-
encoding: "utf8",
|
|
842
|
-
mode: 384
|
|
843
|
-
});
|
|
844
|
-
ensureFilePermissions(temporaryPath);
|
|
845
|
-
renameSync(temporaryPath, filePath);
|
|
846
|
-
ensureFilePermissions(filePath);
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
// src/defaults/home-dir.ts
|
|
850
|
-
import { homedir } from "os";
|
|
851
|
-
var homeDirOverrideForTests;
|
|
852
|
-
function setHomeDirForTests(dir) {
|
|
853
|
-
homeDirOverrideForTests = dir;
|
|
854
|
-
}
|
|
855
|
-
function resolveHomeDir() {
|
|
856
|
-
return homeDirOverrideForTests ?? homedir();
|
|
857
|
-
}
|
|
858
|
-
|
|
859
22
|
// src/defaults/legacy-config-migration.ts
|
|
860
|
-
import { existsSync
|
|
23
|
+
import { existsSync, lstatSync, readFileSync, rmSync } from "fs";
|
|
861
24
|
import { join } from "path";
|
|
862
|
-
var legacyBareAuthFilePath = () => join(
|
|
863
|
-
var legacyJsonAuthFilePath = () => join(
|
|
25
|
+
var legacyBareAuthFilePath = () => join(resolveHomeDir2(), ".scarn");
|
|
26
|
+
var legacyJsonAuthFilePath = () => join(resolveHomeDir2(), ".scarn.json");
|
|
864
27
|
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
865
28
|
function migrateLegacyConfigIfNeeded(input) {
|
|
866
29
|
if (input.authFileExists() && input.configFileExists())
|
|
867
30
|
return;
|
|
868
|
-
const legacyPath =
|
|
869
|
-
if (!
|
|
31
|
+
const legacyPath = existsSync(legacyJsonAuthFilePath()) ? legacyJsonAuthFilePath() : legacyBareAuthFilePath();
|
|
32
|
+
if (!existsSync(legacyPath) || !lstatSync(legacyPath).isFile())
|
|
870
33
|
return;
|
|
871
34
|
let parsed;
|
|
872
35
|
try {
|
|
@@ -878,7 +41,7 @@ function migrateLegacyConfigIfNeeded(input) {
|
|
|
878
41
|
return;
|
|
879
42
|
rmSync(legacyPath, { force: true });
|
|
880
43
|
const otherLegacyPath = legacyPath === legacyJsonAuthFilePath() ? legacyBareAuthFilePath() : legacyJsonAuthFilePath();
|
|
881
|
-
if (
|
|
44
|
+
if (existsSync(otherLegacyPath) && lstatSync(otherLegacyPath).isFile()) {
|
|
882
45
|
rmSync(otherLegacyPath, { force: true });
|
|
883
46
|
}
|
|
884
47
|
if (!input.authFileExists()) {
|
|
@@ -896,8 +59,8 @@ function migrateLegacyConfigIfNeeded(input) {
|
|
|
896
59
|
}
|
|
897
60
|
|
|
898
61
|
// src/defaults/auth-file.ts
|
|
899
|
-
var authFilePath = () => join2(
|
|
900
|
-
var configFilePath = () => join2(
|
|
62
|
+
var authFilePath = () => join2(resolveHomeDir2(), ".scarn", "auth.jsonc");
|
|
63
|
+
var configFilePath = () => join2(resolveHomeDir2(), ".scarn", "config.jsonc");
|
|
901
64
|
var MIGRATION_DEFAULT_ARTIFACT_RETENTION = {
|
|
902
65
|
localMaxBytes: 2 * 1024 ** 3,
|
|
903
66
|
localMaxAgeDays: 14
|
|
@@ -931,7 +94,7 @@ function isAuthFile(value) {
|
|
|
931
94
|
}
|
|
932
95
|
var getAuthFilePath = () => authFilePath();
|
|
933
96
|
var loadAuthFileFromPath = (filePath) => {
|
|
934
|
-
if (!
|
|
97
|
+
if (!existsSync2(filePath))
|
|
935
98
|
return emptyAuthFile();
|
|
936
99
|
if (!lstatSync2(filePath).isFile())
|
|
937
100
|
return emptyAuthFile();
|
|
@@ -939,7 +102,7 @@ var loadAuthFileFromPath = (filePath) => {
|
|
|
939
102
|
if (content.trim().length === 0)
|
|
940
103
|
return emptyAuthFile();
|
|
941
104
|
const errors = [];
|
|
942
|
-
const parsed =
|
|
105
|
+
const parsed = parse(content, errors, {
|
|
943
106
|
allowTrailingComma: true
|
|
944
107
|
});
|
|
945
108
|
if (errors.length > 0)
|
|
@@ -950,8 +113,8 @@ var loadAuthFileFromPath = (filePath) => {
|
|
|
950
113
|
};
|
|
951
114
|
var loadAuthFile = () => {
|
|
952
115
|
migrateLegacyConfigIfNeeded({
|
|
953
|
-
authFileExists: () =>
|
|
954
|
-
configFileExists: () =>
|
|
116
|
+
authFileExists: () => existsSync2(authFilePath()),
|
|
117
|
+
configFileExists: () => existsSync2(configFilePath()),
|
|
955
118
|
writeAuthFile: (profiles) => {
|
|
956
119
|
writeJsonFileAtomically(authFilePath(), { profiles });
|
|
957
120
|
},
|
|
@@ -988,13 +151,13 @@ var deleteAuthProfile = (baseUrl) => {
|
|
|
988
151
|
writeAuthFile({ profiles: remainingProfiles });
|
|
989
152
|
};
|
|
990
153
|
// src/defaults/config-file.ts
|
|
991
|
-
import { existsSync as
|
|
154
|
+
import { existsSync as existsSync3, lstatSync as lstatSync3, readFileSync as readFileSync3 } from "fs";
|
|
992
155
|
import { randomUUID } from "crypto";
|
|
993
156
|
import { join as join3 } from "path";
|
|
994
157
|
var DEFAULT_ARTIFACT_LOCAL_MAX_BYTES = 2 * 1024 ** 3;
|
|
995
158
|
var DEFAULT_ARTIFACT_LOCAL_MAX_AGE_DAYS = 14;
|
|
996
|
-
var authFilePath2 = () => join3(
|
|
997
|
-
var configFilePath2 = () => join3(
|
|
159
|
+
var authFilePath2 = () => join3(resolveHomeDir2(), ".scarn", "auth.jsonc");
|
|
160
|
+
var configFilePath2 = () => join3(resolveHomeDir2(), ".scarn", "config.jsonc");
|
|
998
161
|
var getConfigFilePath = () => configFilePath2();
|
|
999
162
|
var defaultConfigFile = () => ({
|
|
1000
163
|
artifacts: {
|
|
@@ -1021,7 +184,7 @@ function isConfigFile(value) {
|
|
|
1021
184
|
return isArtifactRetentionSettings(obj["artifacts"]);
|
|
1022
185
|
}
|
|
1023
186
|
var loadConfigFileFromPath = (filePath) => {
|
|
1024
|
-
if (!
|
|
187
|
+
if (!existsSync3(filePath))
|
|
1025
188
|
return defaultConfigFile();
|
|
1026
189
|
if (!lstatSync3(filePath).isFile())
|
|
1027
190
|
return defaultConfigFile();
|
|
@@ -1029,7 +192,7 @@ var loadConfigFileFromPath = (filePath) => {
|
|
|
1029
192
|
if (content.trim().length === 0)
|
|
1030
193
|
return defaultConfigFile();
|
|
1031
194
|
const errors = [];
|
|
1032
|
-
const parsed =
|
|
195
|
+
const parsed = parse(content, errors, {
|
|
1033
196
|
allowTrailingComma: true
|
|
1034
197
|
});
|
|
1035
198
|
if (errors.length > 0)
|
|
@@ -1040,8 +203,8 @@ var loadConfigFileFromPath = (filePath) => {
|
|
|
1040
203
|
};
|
|
1041
204
|
var loadConfigFile = () => {
|
|
1042
205
|
migrateLegacyConfigIfNeeded({
|
|
1043
|
-
authFileExists: () =>
|
|
1044
|
-
configFileExists: () =>
|
|
206
|
+
authFileExists: () => existsSync3(authFilePath2()),
|
|
207
|
+
configFileExists: () => existsSync3(configFilePath2()),
|
|
1045
208
|
writeAuthFile: (profiles) => {
|
|
1046
209
|
writeJsonFileAtomically(authFilePath2(), { profiles });
|
|
1047
210
|
},
|
|
@@ -1139,7 +302,7 @@ function isProjectConfig(value) {
|
|
|
1139
302
|
async function loadProjectConfig(rootDir = process.cwd()) {
|
|
1140
303
|
try {
|
|
1141
304
|
const content = await readFile(getConfigPath(rootDir), "utf8");
|
|
1142
|
-
const parsed =
|
|
305
|
+
const parsed = parseJsonc2(content);
|
|
1143
306
|
return isProjectConfig(parsed) ? parsed : null;
|
|
1144
307
|
} catch {
|
|
1145
308
|
return null;
|
|
@@ -1157,14 +320,13 @@ class ProjectRefError extends Error {
|
|
|
1157
320
|
}
|
|
1158
321
|
}
|
|
1159
322
|
var PROJECT_REF_FORMAT_HINT = 'Expected "<owner>/<project-slug>", e.g. "acme/web-app".';
|
|
1160
|
-
async function resolveProjectRef(client, ref, {
|
|
323
|
+
async function resolveProjectRef(client, ref, { action = "view" } = {}) {
|
|
1161
324
|
const parsed = parseProjectRef(ref);
|
|
1162
325
|
if (!parsed) {
|
|
1163
326
|
throw new ProjectRefError("invalid", ref, `"${ref}" is not a valid project. ${PROJECT_REF_FORMAT_HINT}`);
|
|
1164
327
|
}
|
|
1165
328
|
const { data, error, response } = await client.projects.resolveProjectBySlug({
|
|
1166
|
-
query: { username: parsed.owner, slug: parsed.slug }
|
|
1167
|
-
headers
|
|
329
|
+
query: { username: parsed.owner, slug: parsed.slug }
|
|
1168
330
|
});
|
|
1169
331
|
if (data) {
|
|
1170
332
|
return { id: data.id, owner: parsed.owner, slug: parsed.slug };
|
|
@@ -1200,19 +362,17 @@ async function loadPushDefaults(opts) {
|
|
|
1200
362
|
const baseUrl = resolveScarnBaseUrl();
|
|
1201
363
|
const envAccessToken = process.env["SCARN_ACCESS_TOKEN"]?.trim();
|
|
1202
364
|
const accessToken = envAccessToken ? envAccessToken : loadAuthProfile(baseUrl)?.accessToken;
|
|
365
|
+
const fetch = accessToken ? createAuthenticatedFetch2(createApiTokenSource2({ baseUrl, getSessionToken: () => accessToken })) : undefined;
|
|
1203
366
|
const envProjectId = process.env["SCARN_PROJECT_ID"]?.trim();
|
|
1204
367
|
if (envProjectId) {
|
|
1205
|
-
return { baseUrl, projectId: envProjectId,
|
|
368
|
+
return { baseUrl, projectId: envProjectId, fetch };
|
|
1206
369
|
}
|
|
1207
370
|
const config = await findProjectConfigUpwards(opts.dir);
|
|
1208
|
-
if (!config || !
|
|
1209
|
-
return { baseUrl, projectId: undefined,
|
|
371
|
+
if (!config || !fetch) {
|
|
372
|
+
return { baseUrl, projectId: undefined, fetch };
|
|
1210
373
|
}
|
|
1211
|
-
const resolved = await resolveProjectRef(
|
|
1212
|
-
|
|
1213
|
-
action: "push pipelines to"
|
|
1214
|
-
});
|
|
1215
|
-
return { baseUrl, projectId: resolved.id, accessToken };
|
|
374
|
+
const resolved = await resolveProjectRef(createScarnClient2(baseUrl, { fetch }), config.project, { action: "push pipelines to" });
|
|
375
|
+
return { baseUrl, projectId: resolved.id, fetch };
|
|
1216
376
|
}
|
|
1217
377
|
export {
|
|
1218
378
|
PROJECT_CONFIG_RELATIVE_PATH,
|
|
@@ -1232,10 +392,10 @@ export {
|
|
|
1232
392
|
loadProjectConfig,
|
|
1233
393
|
loadPushDefaults,
|
|
1234
394
|
parseProjectRef,
|
|
1235
|
-
resolveHomeDir,
|
|
395
|
+
resolveHomeDir2 as resolveHomeDir,
|
|
1236
396
|
resolveProjectRef,
|
|
1237
397
|
resolveScarnBaseUrl,
|
|
1238
398
|
saveAuthProfile,
|
|
1239
|
-
setHomeDirForTests,
|
|
399
|
+
setHomeDirForTests2 as setHomeDirForTests,
|
|
1240
400
|
setTelemetryDisabled
|
|
1241
401
|
};
|