@pensar/apex 0.0.111 → 0.0.112

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 (64) hide show
  1. package/README.md +2 -3
  2. package/bin/pensar.js +31 -276
  3. package/build/agent-5qdmmchx.js +206 -0
  4. package/build/agent-s2z0dasf.js +16 -0
  5. package/build/auth-jvq72ekc.js +263 -0
  6. package/build/authentication-nya4td5k.js +310 -0
  7. package/build/blackboxAgent-qa9ze2hn.js +17 -0
  8. package/build/blackboxPentest-85hwznet.js +41 -0
  9. package/build/cli-15vxn9zj.js +1358 -0
  10. package/build/cli-2ckm5es2.js +50 -0
  11. package/build/cli-49cd9yfk.js +4475 -0
  12. package/build/cli-5d6cs4dq.js +53 -0
  13. package/build/cli-6gtnyaqf.js +109 -0
  14. package/build/cli-7ckctq7a.js +45 -0
  15. package/build/cli-8rxa073f.js +104 -0
  16. package/build/cli-bp6d08sg.js +110 -0
  17. package/build/cli-e20q3hqz.js +307 -0
  18. package/build/cli-f9shhcxf.js +1498 -0
  19. package/build/cli-hmrzx8am.js +507 -0
  20. package/build/cli-j66pect7.js +202 -0
  21. package/build/cli-jb0gcnrs.js +60 -0
  22. package/build/cli-jh38b6zv.js +1074 -0
  23. package/build/cli-kqtgcdzn.js +54784 -0
  24. package/build/cli-r8r90gka.js +96700 -0
  25. package/build/cli-va4y0089.js +395 -0
  26. package/build/cli-w04ggbe4.js +104 -0
  27. package/build/cli-x1msjf55.js +103 -0
  28. package/build/cli-yj3dy0vg.js +180 -0
  29. package/build/cli.js +509 -0
  30. package/build/doctor-b7612pzw.js +117 -0
  31. package/build/fixes-1r6v7kh2.js +49 -0
  32. package/build/index-5ke2yd32.js +17 -0
  33. package/build/index-9ze42wn7.js +68412 -0
  34. package/build/index-rd11fk7h.js +1257 -0
  35. package/build/index-tke6896d.js +1097 -0
  36. package/build/index-vwvh1rdw.js +535 -0
  37. package/build/issues-kx721wja.js +94 -0
  38. package/build/logs-hav7d0nm.js +77 -0
  39. package/build/main-2483qzbq.js +397 -0
  40. package/build/multipart-parser-r38qdp5v.js +350 -0
  41. package/build/pentest-zzebnfa0.js +25 -0
  42. package/build/pentests-s9fwd71b.js +70 -0
  43. package/build/projects-tr719twv.js +35 -0
  44. package/build/targetedPentest-w2c85whf.js +32 -0
  45. package/build/token-6x6aavpc.js +58 -0
  46. package/build/token-util-na95bqjj.js +6 -0
  47. package/build/uninstall-2j0pymb0.js +231 -0
  48. package/build/utils-jky0th19.js +107 -0
  49. package/package.json +3 -4
  50. package/build/auth.js +0 -625
  51. package/build/highlights-eq9cgrbb.scm +0 -604
  52. package/build/highlights-ghv9g403.scm +0 -205
  53. package/build/highlights-hk7bwhj4.scm +0 -284
  54. package/build/highlights-r812a2qc.scm +0 -150
  55. package/build/highlights-x6tmsnaa.scm +0 -115
  56. package/build/index.js +0 -292069
  57. package/build/injections-73j83es3.scm +0 -27
  58. package/build/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  59. package/build/tree-sitter-markdown-411r6y9b.wasm +0 -0
  60. package/build/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  61. package/build/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  62. package/build/tree-sitter-zig-e78zbjpm.wasm +0 -0
  63. package/src/core/installation/index.ts +0 -223
  64. package/src/core/installation/installation.test.ts +0 -454
@@ -0,0 +1,350 @@
1
+ import {
2
+ FormData,
3
+ file_default,
4
+ init_esm_min,
5
+ init_from
6
+ } from "./cli-49cd9yfk.js";
7
+ import {
8
+ __esm
9
+ } from "./cli-8rxa073f.js";
10
+
11
+ // node_modules/node-fetch/src/utils/multipart-parser.js
12
+ class MultipartParser {
13
+ constructor(boundary) {
14
+ this.index = 0;
15
+ this.flags = 0;
16
+ this.onHeaderEnd = noop;
17
+ this.onHeaderField = noop;
18
+ this.onHeadersEnd = noop;
19
+ this.onHeaderValue = noop;
20
+ this.onPartBegin = noop;
21
+ this.onPartData = noop;
22
+ this.onPartEnd = noop;
23
+ this.boundaryChars = {};
24
+ boundary = `\r
25
+ --` + boundary;
26
+ const ui8a = new Uint8Array(boundary.length);
27
+ for (let i = 0;i < boundary.length; i++) {
28
+ ui8a[i] = boundary.charCodeAt(i);
29
+ this.boundaryChars[ui8a[i]] = true;
30
+ }
31
+ this.boundary = ui8a;
32
+ this.lookbehind = new Uint8Array(this.boundary.length + 8);
33
+ this.state = S.START_BOUNDARY;
34
+ }
35
+ write(data) {
36
+ let i = 0;
37
+ const length_ = data.length;
38
+ let previousIndex = this.index;
39
+ let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
40
+ const boundaryLength = this.boundary.length;
41
+ const boundaryEnd = boundaryLength - 1;
42
+ const bufferLength = data.length;
43
+ let c;
44
+ let cl;
45
+ const mark = (name) => {
46
+ this[name + "Mark"] = i;
47
+ };
48
+ const clear = (name) => {
49
+ delete this[name + "Mark"];
50
+ };
51
+ const callback = (callbackSymbol, start, end, ui8a) => {
52
+ if (start === undefined || start !== end) {
53
+ this[callbackSymbol](ui8a && ui8a.subarray(start, end));
54
+ }
55
+ };
56
+ const dataCallback = (name, clear2) => {
57
+ const markSymbol = name + "Mark";
58
+ if (!(markSymbol in this)) {
59
+ return;
60
+ }
61
+ if (clear2) {
62
+ callback(name, this[markSymbol], i, data);
63
+ delete this[markSymbol];
64
+ } else {
65
+ callback(name, this[markSymbol], data.length, data);
66
+ this[markSymbol] = 0;
67
+ }
68
+ };
69
+ for (i = 0;i < length_; i++) {
70
+ c = data[i];
71
+ switch (state) {
72
+ case S.START_BOUNDARY:
73
+ if (index === boundary.length - 2) {
74
+ if (c === HYPHEN) {
75
+ flags |= F.LAST_BOUNDARY;
76
+ } else if (c !== CR) {
77
+ return;
78
+ }
79
+ index++;
80
+ break;
81
+ } else if (index - 1 === boundary.length - 2) {
82
+ if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
83
+ state = S.END;
84
+ flags = 0;
85
+ } else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
86
+ index = 0;
87
+ callback("onPartBegin");
88
+ state = S.HEADER_FIELD_START;
89
+ } else {
90
+ return;
91
+ }
92
+ break;
93
+ }
94
+ if (c !== boundary[index + 2]) {
95
+ index = -2;
96
+ }
97
+ if (c === boundary[index + 2]) {
98
+ index++;
99
+ }
100
+ break;
101
+ case S.HEADER_FIELD_START:
102
+ state = S.HEADER_FIELD;
103
+ mark("onHeaderField");
104
+ index = 0;
105
+ case S.HEADER_FIELD:
106
+ if (c === CR) {
107
+ clear("onHeaderField");
108
+ state = S.HEADERS_ALMOST_DONE;
109
+ break;
110
+ }
111
+ index++;
112
+ if (c === HYPHEN) {
113
+ break;
114
+ }
115
+ if (c === COLON) {
116
+ if (index === 1) {
117
+ return;
118
+ }
119
+ dataCallback("onHeaderField", true);
120
+ state = S.HEADER_VALUE_START;
121
+ break;
122
+ }
123
+ cl = lower(c);
124
+ if (cl < A || cl > Z) {
125
+ return;
126
+ }
127
+ break;
128
+ case S.HEADER_VALUE_START:
129
+ if (c === SPACE) {
130
+ break;
131
+ }
132
+ mark("onHeaderValue");
133
+ state = S.HEADER_VALUE;
134
+ case S.HEADER_VALUE:
135
+ if (c === CR) {
136
+ dataCallback("onHeaderValue", true);
137
+ callback("onHeaderEnd");
138
+ state = S.HEADER_VALUE_ALMOST_DONE;
139
+ }
140
+ break;
141
+ case S.HEADER_VALUE_ALMOST_DONE:
142
+ if (c !== LF) {
143
+ return;
144
+ }
145
+ state = S.HEADER_FIELD_START;
146
+ break;
147
+ case S.HEADERS_ALMOST_DONE:
148
+ if (c !== LF) {
149
+ return;
150
+ }
151
+ callback("onHeadersEnd");
152
+ state = S.PART_DATA_START;
153
+ break;
154
+ case S.PART_DATA_START:
155
+ state = S.PART_DATA;
156
+ mark("onPartData");
157
+ case S.PART_DATA:
158
+ previousIndex = index;
159
+ if (index === 0) {
160
+ i += boundaryEnd;
161
+ while (i < bufferLength && !(data[i] in boundaryChars)) {
162
+ i += boundaryLength;
163
+ }
164
+ i -= boundaryEnd;
165
+ c = data[i];
166
+ }
167
+ if (index < boundary.length) {
168
+ if (boundary[index] === c) {
169
+ if (index === 0) {
170
+ dataCallback("onPartData", true);
171
+ }
172
+ index++;
173
+ } else {
174
+ index = 0;
175
+ }
176
+ } else if (index === boundary.length) {
177
+ index++;
178
+ if (c === CR) {
179
+ flags |= F.PART_BOUNDARY;
180
+ } else if (c === HYPHEN) {
181
+ flags |= F.LAST_BOUNDARY;
182
+ } else {
183
+ index = 0;
184
+ }
185
+ } else if (index - 1 === boundary.length) {
186
+ if (flags & F.PART_BOUNDARY) {
187
+ index = 0;
188
+ if (c === LF) {
189
+ flags &= ~F.PART_BOUNDARY;
190
+ callback("onPartEnd");
191
+ callback("onPartBegin");
192
+ state = S.HEADER_FIELD_START;
193
+ break;
194
+ }
195
+ } else if (flags & F.LAST_BOUNDARY) {
196
+ if (c === HYPHEN) {
197
+ callback("onPartEnd");
198
+ state = S.END;
199
+ flags = 0;
200
+ } else {
201
+ index = 0;
202
+ }
203
+ } else {
204
+ index = 0;
205
+ }
206
+ }
207
+ if (index > 0) {
208
+ lookbehind[index - 1] = c;
209
+ } else if (previousIndex > 0) {
210
+ const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
211
+ callback("onPartData", 0, previousIndex, _lookbehind);
212
+ previousIndex = 0;
213
+ mark("onPartData");
214
+ i--;
215
+ }
216
+ break;
217
+ case S.END:
218
+ break;
219
+ default:
220
+ throw new Error(`Unexpected state entered: ${state}`);
221
+ }
222
+ }
223
+ dataCallback("onHeaderField");
224
+ dataCallback("onHeaderValue");
225
+ dataCallback("onPartData");
226
+ this.index = index;
227
+ this.state = state;
228
+ this.flags = flags;
229
+ }
230
+ end() {
231
+ if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) {
232
+ this.onPartEnd();
233
+ } else if (this.state !== S.END) {
234
+ throw new Error("MultipartParser.end(): stream ended unexpectedly");
235
+ }
236
+ }
237
+ }
238
+ function _fileName(headerValue) {
239
+ const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
240
+ if (!m) {
241
+ return;
242
+ }
243
+ const match = m[2] || m[3] || "";
244
+ let filename = match.slice(match.lastIndexOf("\\") + 1);
245
+ filename = filename.replace(/%22/g, '"');
246
+ filename = filename.replace(/&#(\d{4});/g, (m2, code) => {
247
+ return String.fromCharCode(code);
248
+ });
249
+ return filename;
250
+ }
251
+ async function toFormData(Body, ct) {
252
+ if (!/multipart/i.test(ct)) {
253
+ throw new TypeError("Failed to fetch");
254
+ }
255
+ const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
256
+ if (!m) {
257
+ throw new TypeError("no or bad content-type header, no multipart boundary");
258
+ }
259
+ const parser = new MultipartParser(m[1] || m[2]);
260
+ let headerField;
261
+ let headerValue;
262
+ let entryValue;
263
+ let entryName;
264
+ let contentType;
265
+ let filename;
266
+ const entryChunks = [];
267
+ const formData = new FormData;
268
+ const onPartData = (ui8a) => {
269
+ entryValue += decoder.decode(ui8a, { stream: true });
270
+ };
271
+ const appendToFile = (ui8a) => {
272
+ entryChunks.push(ui8a);
273
+ };
274
+ const appendFileToFormData = () => {
275
+ const file = new file_default(entryChunks, filename, { type: contentType });
276
+ formData.append(entryName, file);
277
+ };
278
+ const appendEntryToFormData = () => {
279
+ formData.append(entryName, entryValue);
280
+ };
281
+ const decoder = new TextDecoder("utf-8");
282
+ decoder.decode();
283
+ parser.onPartBegin = function() {
284
+ parser.onPartData = onPartData;
285
+ parser.onPartEnd = appendEntryToFormData;
286
+ headerField = "";
287
+ headerValue = "";
288
+ entryValue = "";
289
+ entryName = "";
290
+ contentType = "";
291
+ filename = null;
292
+ entryChunks.length = 0;
293
+ };
294
+ parser.onHeaderField = function(ui8a) {
295
+ headerField += decoder.decode(ui8a, { stream: true });
296
+ };
297
+ parser.onHeaderValue = function(ui8a) {
298
+ headerValue += decoder.decode(ui8a, { stream: true });
299
+ };
300
+ parser.onHeaderEnd = function() {
301
+ headerValue += decoder.decode();
302
+ headerField = headerField.toLowerCase();
303
+ if (headerField === "content-disposition") {
304
+ const m2 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
305
+ if (m2) {
306
+ entryName = m2[2] || m2[3] || "";
307
+ }
308
+ filename = _fileName(headerValue);
309
+ if (filename) {
310
+ parser.onPartData = appendToFile;
311
+ parser.onPartEnd = appendFileToFormData;
312
+ }
313
+ } else if (headerField === "content-type") {
314
+ contentType = headerValue;
315
+ }
316
+ headerValue = "";
317
+ headerField = "";
318
+ };
319
+ for await (const chunk of Body) {
320
+ parser.write(chunk);
321
+ }
322
+ parser.end();
323
+ return formData;
324
+ }
325
+ var s = 0, S, f = 1, F, LF = 10, CR = 13, SPACE = 32, HYPHEN = 45, COLON = 58, A = 97, Z = 122, lower = (c) => c | 32, noop = () => {};
326
+ var init_multipart_parser = __esm(() => {
327
+ init_from();
328
+ init_esm_min();
329
+ S = {
330
+ START_BOUNDARY: s++,
331
+ HEADER_FIELD_START: s++,
332
+ HEADER_FIELD: s++,
333
+ HEADER_VALUE_START: s++,
334
+ HEADER_VALUE: s++,
335
+ HEADER_VALUE_ALMOST_DONE: s++,
336
+ HEADERS_ALMOST_DONE: s++,
337
+ PART_DATA_START: s++,
338
+ PART_DATA: s++,
339
+ END: s++
340
+ };
341
+ F = {
342
+ PART_BOUNDARY: f,
343
+ LAST_BOUNDARY: f *= 2
344
+ };
345
+ });
346
+ init_multipart_parser();
347
+
348
+ export {
349
+ toFormData
350
+ };
@@ -0,0 +1,25 @@
1
+ import {
2
+ DEFAULT_CONCURRENCY,
3
+ runPentestSwarm,
4
+ runPentestWorkflow
5
+ } from "./cli-f9shhcxf.js";
6
+ import"./cli-e20q3hqz.js";
7
+ import"./cli-w04ggbe4.js";
8
+ import"./cli-2ckm5es2.js";
9
+ import"./cli-hmrzx8am.js";
10
+ import"./cli-6gtnyaqf.js";
11
+ import"./cli-r8r90gka.js";
12
+ import"./cli-jh38b6zv.js";
13
+ import"./cli-kqtgcdzn.js";
14
+ import"./cli-j66pect7.js";
15
+ import"./cli-bp6d08sg.js";
16
+ import"./cli-jb0gcnrs.js";
17
+ import"./cli-yj3dy0vg.js";
18
+ import"./cli-15vxn9zj.js";
19
+ import"./cli-7ckctq7a.js";
20
+ import"./cli-8rxa073f.js";
21
+ export {
22
+ runPentestWorkflow,
23
+ runPentestSwarm,
24
+ DEFAULT_CONCURRENCY
25
+ };
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ dispatchPentest,
4
+ getScan,
5
+ listScans
6
+ } from "./cli-x1msjf55.js";
7
+ import"./cli-bp6d08sg.js";
8
+ import"./cli-jb0gcnrs.js";
9
+ import"./cli-yj3dy0vg.js";
10
+ import"./cli-8rxa073f.js";
11
+
12
+ // src/cli/pentests.ts
13
+ function getFlag(flag, argv) {
14
+ const idx = argv.indexOf(flag);
15
+ return idx !== -1 && idx + 1 < argv.length ? argv[idx + 1] : undefined;
16
+ }
17
+ function showHelp() {
18
+ console.log(`pensar pentests — Manage pentests via the Pensar API
19
+
20
+ Usage:
21
+ pensar pentests <projectId> List pentests for a project
22
+ pensar pentests get <pentestId> Get pentest details
23
+ pensar pentests dispatch <projectId> [options] Dispatch a new pentest
24
+
25
+ dispatch options:
26
+ --branch <branch> Target branch to scan
27
+ --level <level> Scan depth: priority (default), full
28
+
29
+ Options:
30
+ -h, --help Show this help message`);
31
+ }
32
+ async function main() {
33
+ const args = process.argv.slice(2);
34
+ const sub = args[0];
35
+ if (!sub || sub === "--help" || sub === "-h" || sub === "help") {
36
+ showHelp();
37
+ return;
38
+ }
39
+ try {
40
+ if (sub === "get") {
41
+ const pentestId = args[1];
42
+ if (!pentestId) {
43
+ console.error("Error: pentest ID is required");
44
+ console.error("Usage: pensar pentests get <pentestId>");
45
+ process.exit(1);
46
+ }
47
+ const scan = await getScan(pentestId);
48
+ console.log(JSON.stringify(scan, null, 2));
49
+ } else if (sub === "dispatch") {
50
+ const projectId = args[1];
51
+ if (!projectId) {
52
+ console.error("Error: project ID is required");
53
+ console.error("Usage: pensar pentests dispatch <projectId> [--branch <branch>] [--level <priority|full>]");
54
+ process.exit(1);
55
+ }
56
+ const branch = getFlag("--branch", args);
57
+ const scanLevel = getFlag("--level", args);
58
+ const result = await dispatchPentest(projectId, { branch, scanLevel });
59
+ console.log(JSON.stringify(result, null, 2));
60
+ } else {
61
+ const scans = await listScans(sub);
62
+ console.log(JSON.stringify(scans, null, 2));
63
+ }
64
+ } catch (err) {
65
+ console.error(`
66
+ Error: ${err instanceof Error ? err.message : String(err)}`);
67
+ process.exit(1);
68
+ }
69
+ }
70
+ main();
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ listProjects
4
+ } from "./cli-x1msjf55.js";
5
+ import"./cli-bp6d08sg.js";
6
+ import"./cli-jb0gcnrs.js";
7
+ import"./cli-yj3dy0vg.js";
8
+ import"./cli-8rxa073f.js";
9
+
10
+ // src/cli/projects.ts
11
+ function showHelp() {
12
+ console.log(`pensar projects — List workspace projects
13
+
14
+ Usage:
15
+ pensar projects List all projects
16
+
17
+ Options:
18
+ -h, --help Show this help message`);
19
+ }
20
+ async function main() {
21
+ const args = process.argv.slice(2);
22
+ if (args.includes("--help") || args.includes("-h")) {
23
+ showHelp();
24
+ return;
25
+ }
26
+ try {
27
+ const projects = await listProjects();
28
+ console.log(JSON.stringify(projects, null, 2));
29
+ } catch (err) {
30
+ console.error(`
31
+ Error: ${err instanceof Error ? err.message : String(err)}`);
32
+ process.exit(1);
33
+ }
34
+ }
35
+ main();
@@ -0,0 +1,32 @@
1
+ import {
2
+ TargetedPentestAgent
3
+ } from "./cli-e20q3hqz.js";
4
+ import"./cli-r8r90gka.js";
5
+ import"./cli-jh38b6zv.js";
6
+ import"./cli-kqtgcdzn.js";
7
+ import"./cli-j66pect7.js";
8
+ import"./cli-bp6d08sg.js";
9
+ import"./cli-jb0gcnrs.js";
10
+ import"./cli-yj3dy0vg.js";
11
+ import"./cli-15vxn9zj.js";
12
+ import"./cli-7ckctq7a.js";
13
+ import"./cli-8rxa073f.js";
14
+
15
+ // src/core/api/targetedPentest.ts
16
+ async function runTargetedPentestAgent(input) {
17
+ const agent = new TargetedPentestAgent(input);
18
+ const { findings, findingsPath, pocsPath } = await agent.consume({
19
+ onTextDelta: (d) => process.stdout.write(d.text),
20
+ onToolCall: (d) => console.log(`→ calling ${d.toolName}`),
21
+ onToolResult: (d) => console.log(`✓ ${d.toolName} completed`),
22
+ onError: (e) => console.error("Agent error:", e)
23
+ });
24
+ console.log(`
25
+ Found ${findings.length} vulnerabilities`);
26
+ console.log(`Findings: ${findingsPath}`);
27
+ console.log(`POCs: ${pocsPath}`);
28
+ return { findings, findingsPath, pocsPath };
29
+ }
30
+ export {
31
+ runTargetedPentestAgent
32
+ };
@@ -0,0 +1,58 @@
1
+ import {
2
+ require_token_util
3
+ } from "./cli-va4y0089.js";
4
+ import {
5
+ require_token_error
6
+ } from "./cli-7ckctq7a.js";
7
+ import {
8
+ __commonJS
9
+ } from "./cli-8rxa073f.js";
10
+
11
+ // node_modules/@vercel/oidc/dist/token.js
12
+ var require_token = __commonJS((exports, module) => {
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __getOwnPropNames = Object.getOwnPropertyNames;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __export = (target, all) => {
18
+ for (var name in all)
19
+ __defProp(target, name, { get: all[name], enumerable: true });
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var token_exports = {};
31
+ __export(token_exports, {
32
+ refreshToken: () => refreshToken
33
+ });
34
+ module.exports = __toCommonJS(token_exports);
35
+ var import_token_error = require_token_error();
36
+ var import_token_util = require_token_util();
37
+ async function refreshToken() {
38
+ const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
39
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
40
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
41
+ const authToken = await (0, import_token_util.getVercelCliToken)();
42
+ if (!authToken) {
43
+ throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");
44
+ }
45
+ if (!projectId) {
46
+ throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");
47
+ }
48
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
49
+ if (!maybeToken) {
50
+ throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
51
+ }
52
+ (0, import_token_util.saveToken)(maybeToken, projectId);
53
+ }
54
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
55
+ return;
56
+ }
57
+ });
58
+ export default require_token();
@@ -0,0 +1,6 @@
1
+ import {
2
+ require_token_util
3
+ } from "./cli-va4y0089.js";
4
+ import"./cli-7ckctq7a.js";
5
+ import"./cli-8rxa073f.js";
6
+ export default require_token_util();