@gravity-rail/cli 4.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -32
- package/dist/{account-verify-phone-VZYUPN64.js → account-verify-phone-FUOCVZ55.js} +5 -5
- package/dist/{chunk-KDWGBYCM.js → chunk-HTPFRSPP.js} +922 -13
- package/dist/chunk-HTPFRSPP.js.map +1 -0
- package/dist/chunk-LQLGLI4Q.js +128 -0
- package/dist/chunk-LQLGLI4Q.js.map +1 -0
- package/dist/cli-utils.d.ts +20 -0
- package/dist/cli-utils.js +1 -1
- package/dist/errors-CBQHNNRI.js +13 -0
- package/dist/gr.js +8753 -5082
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +91 -6
- package/dist/lib.js +4609 -2354
- package/dist/lib.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-3T7A5PSF.js +0 -59
- package/dist/chunk-3T7A5PSF.js.map +0 -1
- package/dist/chunk-JOXB4Y4Q.js +0 -861
- package/dist/chunk-JOXB4Y4Q.js.map +0 -1
- package/dist/chunk-KDWGBYCM.js.map +0 -1
- package/dist/errors-CFRLSAGA.js +0 -11
- /package/dist/{account-verify-phone-VZYUPN64.js.map → account-verify-phone-FUOCVZ55.js.map} +0 -0
- /package/dist/{errors-CFRLSAGA.js.map → errors-CBQHNNRI.js.map} +0 -0
package/dist/chunk-JOXB4Y4Q.js
DELETED
|
@@ -1,861 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CredentialsManager,
|
|
3
|
-
getEnvironmentConfig,
|
|
4
|
-
isOrgSessionCredential,
|
|
5
|
-
printTable,
|
|
6
|
-
resolveNonInteractiveAuth
|
|
7
|
-
} from "./chunk-KDWGBYCM.js";
|
|
8
|
-
import {
|
|
9
|
-
AuthRequiredError,
|
|
10
|
-
CLIError
|
|
11
|
-
} from "./chunk-3T7A5PSF.js";
|
|
12
|
-
|
|
13
|
-
// src/lib/pagination.ts
|
|
14
|
-
function isListResult(data) {
|
|
15
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) return false;
|
|
16
|
-
const obj = data;
|
|
17
|
-
return Array.isArray(obj.items) && ("supportsAll" in obj || "meta" in obj && (obj.meta === void 0 || typeof obj.meta === "object"));
|
|
18
|
-
}
|
|
19
|
-
function isPagePaginatedResponse(data) {
|
|
20
|
-
if (!data || typeof data !== "object") return false;
|
|
21
|
-
const obj = data;
|
|
22
|
-
if (!Array.isArray(obj.items) || typeof obj.page !== "number") return false;
|
|
23
|
-
if (typeof obj.totalPages === "number") return true;
|
|
24
|
-
if (typeof obj.total === "number" && typeof obj.pageSize === "number") return true;
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
function isCursorPaginatedResponse(data) {
|
|
28
|
-
if (!data || typeof data !== "object") return false;
|
|
29
|
-
const obj = data;
|
|
30
|
-
return Array.isArray(obj.items) && typeof obj.hasMore === "boolean";
|
|
31
|
-
}
|
|
32
|
-
function isPaginatedResponse(data) {
|
|
33
|
-
return isPagePaginatedResponse(data) || isCursorPaginatedResponse(data);
|
|
34
|
-
}
|
|
35
|
-
function extractPaginationMeta(data) {
|
|
36
|
-
if (isPagePaginatedResponse(data)) {
|
|
37
|
-
const totalPages = data.totalPages ?? (data.pageSize ? Math.ceil(data.total / data.pageSize) : void 0);
|
|
38
|
-
return {
|
|
39
|
-
total: data.total,
|
|
40
|
-
page: data.page,
|
|
41
|
-
totalPages
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (isCursorPaginatedResponse(data)) {
|
|
45
|
-
return {
|
|
46
|
-
hasMore: data.hasMore,
|
|
47
|
-
nextCursor: data.nextCursor
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return void 0;
|
|
51
|
-
}
|
|
52
|
-
function formatPaginationWarning(meta, supportsAll = true) {
|
|
53
|
-
if (!meta) return void 0;
|
|
54
|
-
const allHint = supportsAll ? " Use --all to fetch all pages." : "";
|
|
55
|
-
if (meta.totalPages !== void 0 && meta.totalPages > 1) {
|
|
56
|
-
const pageNum = meta.page ?? 1;
|
|
57
|
-
return `Showing page ${pageNum} of ${meta.totalPages} (${meta.total} total items).${allHint}`;
|
|
58
|
-
}
|
|
59
|
-
if (meta.hasMore === true) {
|
|
60
|
-
return `More results available.${allHint}`;
|
|
61
|
-
}
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
function unwrapItems(data) {
|
|
65
|
-
if (Array.isArray(data)) return data;
|
|
66
|
-
if (data && typeof data === "object" && "items" in data && Array.isArray(data.items)) {
|
|
67
|
-
return data.items;
|
|
68
|
-
}
|
|
69
|
-
return [data];
|
|
70
|
-
}
|
|
71
|
-
var LIST_PAGINATION_ARGS = [
|
|
72
|
-
{ name: "page", description: "Page number" },
|
|
73
|
-
{ name: "page-size", description: "Page size" },
|
|
74
|
-
{ name: "all", description: "Fetch all pages and return combined results", isFlag: true }
|
|
75
|
-
];
|
|
76
|
-
function parsePaginationArgs(args) {
|
|
77
|
-
const result = {};
|
|
78
|
-
if (args.all === true) {
|
|
79
|
-
result.all = true;
|
|
80
|
-
}
|
|
81
|
-
if (args.page !== void 0) {
|
|
82
|
-
const num = Number(args.page);
|
|
83
|
-
if (isNaN(num) || num < 1) throw new CLIError("--page must be a positive integer");
|
|
84
|
-
result.page = num;
|
|
85
|
-
}
|
|
86
|
-
if (args["page-size"] !== void 0) {
|
|
87
|
-
const num = Number(args["page-size"]);
|
|
88
|
-
if (isNaN(num) || num < 1) throw new CLIError("--page-size must be a positive integer");
|
|
89
|
-
if (num > 100) throw new CLIError("--page-size must be at most 100 (API limit)");
|
|
90
|
-
result.pageSize = num;
|
|
91
|
-
}
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
var MAX_PAGE_SIZE = 100;
|
|
95
|
-
var MAX_PAGES = 200;
|
|
96
|
-
async function fetchAllPages(fetcher) {
|
|
97
|
-
const allItems = [];
|
|
98
|
-
let page = 1;
|
|
99
|
-
while (page <= MAX_PAGES) {
|
|
100
|
-
const result = await fetcher({ page, pageSize: MAX_PAGE_SIZE });
|
|
101
|
-
const items = unwrapItems(result);
|
|
102
|
-
allItems.push(...items);
|
|
103
|
-
const meta = extractPaginationMeta(result);
|
|
104
|
-
if (meta?.totalPages !== void 0) {
|
|
105
|
-
if (page >= meta.totalPages) break;
|
|
106
|
-
} else if (!isPagePaginatedResponse(result)) {
|
|
107
|
-
if (items.length < MAX_PAGE_SIZE) break;
|
|
108
|
-
}
|
|
109
|
-
if (page === MAX_PAGES) {
|
|
110
|
-
throw new CLIError(
|
|
111
|
-
`Reached maximum page limit (${MAX_PAGES}). Results may be incomplete.`
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
page++;
|
|
115
|
-
}
|
|
116
|
-
return allItems;
|
|
117
|
-
}
|
|
118
|
-
async function fetchAllCursorPages(fetcher) {
|
|
119
|
-
const allItems = [];
|
|
120
|
-
let cursor;
|
|
121
|
-
let pages = 0;
|
|
122
|
-
while (pages < MAX_PAGES) {
|
|
123
|
-
const result = await fetcher({ cursor });
|
|
124
|
-
const items = unwrapItems(result);
|
|
125
|
-
allItems.push(...items);
|
|
126
|
-
pages++;
|
|
127
|
-
if (isCursorPaginatedResponse(result) && result.hasMore && result.nextCursor) {
|
|
128
|
-
cursor = result.nextCursor;
|
|
129
|
-
} else {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
if (pages === MAX_PAGES) {
|
|
133
|
-
throw new CLIError(
|
|
134
|
-
`Reached maximum page limit (${MAX_PAGES}). Results may be incomplete.`
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return allItems;
|
|
139
|
-
}
|
|
140
|
-
function listResult(data, supportsAll = false) {
|
|
141
|
-
return {
|
|
142
|
-
items: unwrapItems(data),
|
|
143
|
-
meta: extractPaginationMeta(data),
|
|
144
|
-
supportsAll
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// src/lib/jq.ts
|
|
149
|
-
import { spawnSync } from "child_process";
|
|
150
|
-
function applyJqFilter(json, filter) {
|
|
151
|
-
const result = spawnSync("jq", ["-r", filter], {
|
|
152
|
-
input: json,
|
|
153
|
-
encoding: "utf8",
|
|
154
|
-
maxBuffer: 64 * 1024 * 1024
|
|
155
|
-
});
|
|
156
|
-
if (result.error && result.error.code === "ENOENT") {
|
|
157
|
-
throw new CLIError(
|
|
158
|
-
"--jq requires the `jq` binary on PATH, and it was not found. Install jq, or omit --jq and filter the JSON yourself."
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
const wroteToExitedJq = result.error?.code === "EPIPE" && result.status !== null;
|
|
162
|
-
if (result.error && !wroteToExitedJq) {
|
|
163
|
-
throw new CLIError(`--jq could not run jq: ${result.error.message}`);
|
|
164
|
-
}
|
|
165
|
-
if (result.status !== 0) {
|
|
166
|
-
const exited = result.signal ? `jq was killed by ${result.signal}` : `jq exited ${result.status}`;
|
|
167
|
-
const detail = (result.stderr || "").trim() || exited;
|
|
168
|
-
throw new CLIError(`--jq filter failed: ${detail}`);
|
|
169
|
-
}
|
|
170
|
-
return (result.stdout || "").replace(/\n$/, "");
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// src/lib/output.ts
|
|
174
|
-
function writeJson(value, opts, pretty = true) {
|
|
175
|
-
const json = pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);
|
|
176
|
-
if (opts.jq) {
|
|
177
|
-
const filtered = applyJqFilter(json, opts.jq);
|
|
178
|
-
process.stdout.write(filtered === "" ? "\n" : filtered + "\n");
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
process.stdout.write(json + "\n");
|
|
182
|
-
}
|
|
183
|
-
function detectOutputFormat(explicit) {
|
|
184
|
-
if (explicit) return explicit;
|
|
185
|
-
return process.stdout.isTTY ? "table" : "json";
|
|
186
|
-
}
|
|
187
|
-
function outputData(data, opts, columns, paginationMeta, supportsAll) {
|
|
188
|
-
let items;
|
|
189
|
-
let meta;
|
|
190
|
-
let allSupported;
|
|
191
|
-
if (isListResult(data)) {
|
|
192
|
-
items = data.items;
|
|
193
|
-
meta = data.meta;
|
|
194
|
-
allSupported = data.supportsAll ?? false;
|
|
195
|
-
} else {
|
|
196
|
-
items = unwrapItems(data);
|
|
197
|
-
meta = paginationMeta ?? extractPaginationMeta(data);
|
|
198
|
-
allSupported = supportsAll ?? false;
|
|
199
|
-
}
|
|
200
|
-
const warning = formatPaginationWarning(meta, allSupported);
|
|
201
|
-
if (warning) {
|
|
202
|
-
process.stderr.write(warning + "\n");
|
|
203
|
-
}
|
|
204
|
-
if (opts.jq) {
|
|
205
|
-
writeJson(items, opts);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
switch (opts.outputFormat) {
|
|
209
|
-
case "json":
|
|
210
|
-
writeJson(items, opts);
|
|
211
|
-
break;
|
|
212
|
-
case "jsonl":
|
|
213
|
-
for (const item of items) {
|
|
214
|
-
process.stdout.write(JSON.stringify(item) + "\n");
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
case "table":
|
|
218
|
-
if (columns) {
|
|
219
|
-
printTable(items, columns);
|
|
220
|
-
} else {
|
|
221
|
-
writeJson(items, opts);
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function outputSingle(data, opts, columns) {
|
|
227
|
-
if (opts.jq) {
|
|
228
|
-
writeJson(data, opts);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
switch (opts.outputFormat) {
|
|
232
|
-
case "json":
|
|
233
|
-
writeJson(data, opts);
|
|
234
|
-
break;
|
|
235
|
-
case "jsonl":
|
|
236
|
-
process.stdout.write(JSON.stringify(data) + "\n");
|
|
237
|
-
break;
|
|
238
|
-
case "table":
|
|
239
|
-
if (columns) {
|
|
240
|
-
printTable([data], columns);
|
|
241
|
-
} else {
|
|
242
|
-
writeJson(data, opts);
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
var COL = {
|
|
248
|
-
id: () => ({ header: "ID", getValue: (item) => String(item.id ?? "") }),
|
|
249
|
-
uuid: () => ({ header: "UUID", getValue: (item) => item.uuid ?? "" }),
|
|
250
|
-
name: () => ({ header: "NAME", getValue: (item) => item.name ?? "" }),
|
|
251
|
-
status: () => ({ header: "STATUS", getValue: (item) => item.status ?? "" }),
|
|
252
|
-
created: () => ({
|
|
253
|
-
header: "CREATED",
|
|
254
|
-
getValue: (item) => item.createdAt ?? ""
|
|
255
|
-
}),
|
|
256
|
-
updated: () => ({
|
|
257
|
-
header: "UPDATED",
|
|
258
|
-
getValue: (item) => item.updatedAt ?? ""
|
|
259
|
-
}),
|
|
260
|
-
description: () => ({
|
|
261
|
-
header: "DESCRIPTION",
|
|
262
|
-
getValue: (item) => item.description ?? ""
|
|
263
|
-
}),
|
|
264
|
-
enabled: () => ({
|
|
265
|
-
header: "ENABLED",
|
|
266
|
-
getValue: (item) => String(item.enabled ?? "")
|
|
267
|
-
})
|
|
268
|
-
};
|
|
269
|
-
function hint(opts, lines) {
|
|
270
|
-
if ((opts.outputFormat ?? "table") !== "table") return;
|
|
271
|
-
process.stdout.write("\n" + lines.join("\n") + "\n");
|
|
272
|
-
}
|
|
273
|
-
function stderr(msg) {
|
|
274
|
-
process.stderr.write(msg + "\n");
|
|
275
|
-
}
|
|
276
|
-
async function flushStdout() {
|
|
277
|
-
if (process.stdout.writableLength === 0) return;
|
|
278
|
-
await new Promise((resolve) => {
|
|
279
|
-
process.stdout.write("", () => resolve());
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// src/lib/context.ts
|
|
284
|
-
import { GravityRailClient } from "@gravity-rail/sdk";
|
|
285
|
-
import { homedir } from "os";
|
|
286
|
-
|
|
287
|
-
// src/lib/org-auth.ts
|
|
288
|
-
import { createServer } from "http";
|
|
289
|
-
import { execFile } from "child_process";
|
|
290
|
-
import { createHash, randomBytes } from "crypto";
|
|
291
|
-
var OrgSignInResponseError = class extends Error {
|
|
292
|
-
};
|
|
293
|
-
var ORG_AUTH_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
294
|
-
var ORG_SESSION_CACHE_TTL_MS = 6.5 * 24 * 60 * 60 * 1e3;
|
|
295
|
-
var CLI_ORG_AUTH_BRIDGE_PATH = "/cli/org-auth";
|
|
296
|
-
var ORG_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
297
|
-
async function tryDirectJoin(apiUrl, accessToken, orgAuthInfo) {
|
|
298
|
-
const response = await fetch(`${apiUrl}/api/v2/o/${orgAuthInfo.orgUuid}/join`, {
|
|
299
|
-
method: "POST",
|
|
300
|
-
headers: {
|
|
301
|
-
"Content-Type": "application/json",
|
|
302
|
-
Authorization: `Bearer ${accessToken}`
|
|
303
|
-
},
|
|
304
|
-
body: "{}"
|
|
305
|
-
});
|
|
306
|
-
if (response.status === 400) {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
if (!response.ok) {
|
|
310
|
-
throw new Error(`Org join failed (HTTP ${response.status})`);
|
|
311
|
-
}
|
|
312
|
-
let body;
|
|
313
|
-
try {
|
|
314
|
-
body = await response.json();
|
|
315
|
-
} catch {
|
|
316
|
-
throw new OrgSignInResponseError("Org join succeeded but returned an invalid response");
|
|
317
|
-
}
|
|
318
|
-
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
319
|
-
throw new OrgSignInResponseError("Org join succeeded but returned an invalid response");
|
|
320
|
-
}
|
|
321
|
-
if (typeof body.orgSession !== "string" || !body.orgSession) {
|
|
322
|
-
throw new OrgSignInResponseError("Org join succeeded but returned no org session");
|
|
323
|
-
}
|
|
324
|
-
let expiresAt;
|
|
325
|
-
if (body.expiresAt !== void 0) {
|
|
326
|
-
if (typeof body.expiresAt !== "string" || !Number.isFinite(Date.parse(body.expiresAt))) {
|
|
327
|
-
throw new OrgSignInResponseError("Org join returned an invalid session expiry");
|
|
328
|
-
}
|
|
329
|
-
expiresAt = body.expiresAt;
|
|
330
|
-
if (Date.parse(expiresAt) <= Date.now()) {
|
|
331
|
-
throw new OrgSignInResponseError("Org join returned an expired session");
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return { session: body.orgSession, expiresAt };
|
|
335
|
-
}
|
|
336
|
-
function isAllowedAuthUrl(url, apiUrl, frontendUrl) {
|
|
337
|
-
try {
|
|
338
|
-
const parsed = new URL(url);
|
|
339
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return false;
|
|
340
|
-
const allowedHosts = [apiUrl, frontendUrl].filter((u) => Boolean(u)).map((u) => {
|
|
341
|
-
try {
|
|
342
|
-
return new URL(u).hostname;
|
|
343
|
-
} catch {
|
|
344
|
-
return void 0;
|
|
345
|
-
}
|
|
346
|
-
}).filter((h) => Boolean(h));
|
|
347
|
-
return allowedHosts.includes(parsed.hostname);
|
|
348
|
-
} catch {
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function openBrowser(url) {
|
|
353
|
-
let command;
|
|
354
|
-
let args;
|
|
355
|
-
if (process.platform === "darwin") {
|
|
356
|
-
command = "open";
|
|
357
|
-
args = [url];
|
|
358
|
-
} else if (process.platform === "win32") {
|
|
359
|
-
command = "cmd.exe";
|
|
360
|
-
args = ["/c", "start", "", url];
|
|
361
|
-
} else {
|
|
362
|
-
command = "xdg-open";
|
|
363
|
-
args = [url];
|
|
364
|
-
}
|
|
365
|
-
execFile(command, args, (_err) => {
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
function isHeadless() {
|
|
369
|
-
if (process.env.GRAVITY_RAIL_NO_BROWSER) return true;
|
|
370
|
-
if (process.platform === "linux") {
|
|
371
|
-
return !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY;
|
|
372
|
-
}
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
function startOrgSessionCapture(expectedState, expectedOrgUuid, _allowedOrigin) {
|
|
376
|
-
let resolveSession;
|
|
377
|
-
let rejectSession;
|
|
378
|
-
const session = new Promise((resolve, reject) => {
|
|
379
|
-
resolveSession = resolve;
|
|
380
|
-
rejectSession = reject;
|
|
381
|
-
});
|
|
382
|
-
const server = createServer((req, res) => {
|
|
383
|
-
res.setHeader("Cache-Control", "no-store");
|
|
384
|
-
res.setHeader("Referrer-Policy", "no-referrer");
|
|
385
|
-
if (req.method !== "GET") {
|
|
386
|
-
res.writeHead(405);
|
|
387
|
-
res.end();
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
const callback = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
391
|
-
const code = callback.searchParams.get("code");
|
|
392
|
-
if (callback.pathname !== "/" || !code?.startsWith("gr_cli_org_") || callback.searchParams.get("state") !== expectedState || callback.searchParams.get("org_uuid") !== expectedOrgUuid) {
|
|
393
|
-
res.writeHead(400);
|
|
394
|
-
res.end("Invalid sign-in callback");
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
res.writeHead(200, { "Content-Type": "text/plain" });
|
|
398
|
-
res.end("Return to the terminal to finish sign-in.");
|
|
399
|
-
resolveSession(code);
|
|
400
|
-
});
|
|
401
|
-
let resolveReady;
|
|
402
|
-
let rejectReady;
|
|
403
|
-
const ready = new Promise((resolve, reject) => {
|
|
404
|
-
resolveReady = resolve;
|
|
405
|
-
rejectReady = reject;
|
|
406
|
-
});
|
|
407
|
-
server.on("error", (err) => {
|
|
408
|
-
rejectReady(err);
|
|
409
|
-
rejectSession(err);
|
|
410
|
-
});
|
|
411
|
-
server.listen(0, "127.0.0.1", () => {
|
|
412
|
-
resolveReady(server.address().port);
|
|
413
|
-
});
|
|
414
|
-
const timeout = setTimeout(() => {
|
|
415
|
-
rejectSession(
|
|
416
|
-
new Error(
|
|
417
|
-
"Organization authentication timed out.\nComplete sign-in in the browser, then re-run the command."
|
|
418
|
-
)
|
|
419
|
-
);
|
|
420
|
-
}, ORG_AUTH_TIMEOUT_MS);
|
|
421
|
-
timeout.unref();
|
|
422
|
-
let closed = false;
|
|
423
|
-
const close = () => {
|
|
424
|
-
if (closed) return;
|
|
425
|
-
closed = true;
|
|
426
|
-
clearTimeout(timeout);
|
|
427
|
-
server.close();
|
|
428
|
-
};
|
|
429
|
-
return { ready, session, close };
|
|
430
|
-
}
|
|
431
|
-
function buildStepUpUrl(authUrl, orgUuid, port, state, challenge) {
|
|
432
|
-
const url = new URL(authUrl);
|
|
433
|
-
const bridgeQuery = new URLSearchParams({ org: orgUuid, port: String(port), state, challenge });
|
|
434
|
-
url.searchParams.set("return_to", `${CLI_ORG_AUTH_BRIDGE_PATH}?${bridgeQuery.toString()}`);
|
|
435
|
-
return url.toString();
|
|
436
|
-
}
|
|
437
|
-
function newStateNonce() {
|
|
438
|
-
return randomBytes(16).toString("hex");
|
|
439
|
-
}
|
|
440
|
-
async function stepUpViaBrowser(orgAuthInfo, apiUrl, accessToken) {
|
|
441
|
-
const state = newStateNonce();
|
|
442
|
-
const verifier = randomBytes(32).toString("base64url");
|
|
443
|
-
const challenge = createHash("sha256").update(verifier).digest("base64url");
|
|
444
|
-
const allowedOrigin = new URL(orgAuthInfo.authUrl).origin;
|
|
445
|
-
const capture = startOrgSessionCapture(state, orgAuthInfo.orgUuid, allowedOrigin);
|
|
446
|
-
try {
|
|
447
|
-
const port = await capture.ready;
|
|
448
|
-
const stepUpUrl = buildStepUpUrl(
|
|
449
|
-
orgAuthInfo.authUrl,
|
|
450
|
-
orgAuthInfo.orgUuid,
|
|
451
|
-
port,
|
|
452
|
-
state,
|
|
453
|
-
challenge
|
|
454
|
-
);
|
|
455
|
-
stderr(`
|
|
456
|
-
This workspace requires organization SSO authentication.`);
|
|
457
|
-
stderr(`Opening browser to complete sign-in...`);
|
|
458
|
-
stderr(` ${stepUpUrl}
|
|
459
|
-
`);
|
|
460
|
-
stderr(`If the browser does not open, visit the URL above manually.`);
|
|
461
|
-
openBrowser(stepUpUrl);
|
|
462
|
-
const code = await capture.session;
|
|
463
|
-
const response = await fetch(`${apiUrl}/api/v2/auth/cli-org-handoff/redeem`, {
|
|
464
|
-
method: "POST",
|
|
465
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${accessToken}` },
|
|
466
|
-
body: JSON.stringify({ orgUuid: orgAuthInfo.orgUuid, code, verifier })
|
|
467
|
-
});
|
|
468
|
-
if (!response.ok)
|
|
469
|
-
throw new Error(`Could not finish organization sign-in (${response.status}).`);
|
|
470
|
-
let result;
|
|
471
|
-
try {
|
|
472
|
-
result = await response.json();
|
|
473
|
-
} catch {
|
|
474
|
-
throw new OrgSignInResponseError("Invalid organization sign-in response.");
|
|
475
|
-
}
|
|
476
|
-
if (!result || !isOrgSessionCredential(result.orgSession)) {
|
|
477
|
-
throw new OrgSignInResponseError("Invalid organization sign-in response.");
|
|
478
|
-
}
|
|
479
|
-
return result.orgSession;
|
|
480
|
-
} finally {
|
|
481
|
-
capture.close();
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
function registerOrgAuthHandler(apiClient, apiUrl, accessToken, orgAuthCtx) {
|
|
485
|
-
apiClient.setOrgAuthHandler(
|
|
486
|
-
async (orgAuthInfo) => {
|
|
487
|
-
const orgUuid = orgAuthInfo.orgUuid;
|
|
488
|
-
if (!ORG_UUID_RE.test(orgUuid)) {
|
|
489
|
-
throw new Error("Invalid organization id in auth challenge");
|
|
490
|
-
}
|
|
491
|
-
const cm = orgAuthCtx?.credentialsManager;
|
|
492
|
-
const initialCachedSession = cm && orgAuthCtx ? cm.getOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid) : void 0;
|
|
493
|
-
const adopt = (session2, expiresAt) => {
|
|
494
|
-
if (!isOrgSessionCredential(session2)) {
|
|
495
|
-
throw new OrgSignInResponseError("Invalid organization sign-in response.");
|
|
496
|
-
}
|
|
497
|
-
if (cm && orgAuthCtx && expiresAt && cm.getOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid) === initialCachedSession) {
|
|
498
|
-
cm.setOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid, session2, expiresAt);
|
|
499
|
-
}
|
|
500
|
-
return {
|
|
501
|
-
session: session2,
|
|
502
|
-
orgUuid,
|
|
503
|
-
source: "new",
|
|
504
|
-
onRejected: () => {
|
|
505
|
-
if (cm && orgAuthCtx)
|
|
506
|
-
cm.removeOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid, session2);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
};
|
|
510
|
-
if (cm && orgAuthCtx && !orgAuthInfo.sessionRejected && !orgAuthInfo.acrValues?.length) {
|
|
511
|
-
const cached = cm.getOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid);
|
|
512
|
-
if (cached) {
|
|
513
|
-
return {
|
|
514
|
-
session: cached,
|
|
515
|
-
orgUuid,
|
|
516
|
-
source: "cache",
|
|
517
|
-
onRejected: () => {
|
|
518
|
-
cm.removeOrgSession(orgAuthCtx.env, orgAuthCtx.profile, orgUuid, cached);
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
let orgSession = null;
|
|
524
|
-
try {
|
|
525
|
-
orgSession = await tryDirectJoin(apiUrl, accessToken, orgAuthInfo);
|
|
526
|
-
} catch (err) {
|
|
527
|
-
if (err instanceof OrgSignInResponseError) throw err;
|
|
528
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
529
|
-
stderr(`Warning: org direct-join failed (${msg}); trying browser sign-in`);
|
|
530
|
-
}
|
|
531
|
-
if (orgSession !== null) {
|
|
532
|
-
return adopt(orgSession.session, orgSession.expiresAt);
|
|
533
|
-
}
|
|
534
|
-
if (!orgAuthCtx?.interactive || isHeadless()) {
|
|
535
|
-
throw new Error(
|
|
536
|
-
"This workspace\u2019s organization requires SSO sign-in, which needs a browser.\nRun an interactive `gr` command on a machine with a browser to sign in once (the session is then cached), or use an API key for non-interactive use:\n export GRAVITY_RAIL_API_KEY=<key> (see: gr api-keys)"
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
|
-
if (!isAllowedAuthUrl(orgAuthInfo.authUrl, apiUrl, orgAuthCtx.frontendUrl)) {
|
|
540
|
-
throw new Error(
|
|
541
|
-
`Refusing to open organization auth URL: host does not match the configured API/frontend host. Re-run with the expected --api-url, or contact support.`
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
const session = await stepUpViaBrowser(orgAuthInfo, apiUrl, accessToken);
|
|
545
|
-
return adopt(session, new Date(Date.now() + ORG_SESSION_CACHE_TTL_MS).toISOString());
|
|
546
|
-
}
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
// src/lib/sandbox-fetch.ts
|
|
551
|
-
function withAuditHeaders(fetchFn, headers) {
|
|
552
|
-
const { chatId, sessionId, toolCallId } = headers;
|
|
553
|
-
return async (input, init) => {
|
|
554
|
-
const reqHeaders = new Headers(init?.headers);
|
|
555
|
-
const dynamicToolCallId = globalThis.__GRAVITY_RAIL_TOOL_CALL_ID__ || (typeof process !== "undefined" ? process.env.GRAVITY_RAIL_TOOL_CALL_ID : void 0);
|
|
556
|
-
if (chatId !== void 0) {
|
|
557
|
-
reqHeaders.set("X-GR-Chat-Id", String(chatId));
|
|
558
|
-
}
|
|
559
|
-
if (sessionId) {
|
|
560
|
-
reqHeaders.set("X-GR-Session-Id", sessionId);
|
|
561
|
-
}
|
|
562
|
-
if (dynamicToolCallId || toolCallId) {
|
|
563
|
-
reqHeaders.set("X-GR-Tool-Call-Id", dynamicToolCallId || toolCallId || "");
|
|
564
|
-
}
|
|
565
|
-
return fetchFn(input, { ...init, headers: reqHeaders });
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
function createSandboxFetchFromEnv() {
|
|
569
|
-
const env = typeof process !== "undefined" ? process.env : {};
|
|
570
|
-
const chatIdRaw = env.GRAVITY_RAIL_CHAT_ID;
|
|
571
|
-
const chatId = chatIdRaw ? Number(chatIdRaw) : void 0;
|
|
572
|
-
return withAuditHeaders(fetch, {
|
|
573
|
-
chatId: chatId !== void 0 && Number.isFinite(chatId) ? chatId : void 0,
|
|
574
|
-
sessionId: env.GRAVITY_RAIL_SESSION_ID,
|
|
575
|
-
toolCallId: env.GRAVITY_RAIL_TOOL_CALL_ID
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// src/lib/context.ts
|
|
580
|
-
function makeApiClient(accessToken, apiUrl, fetchFn, orgAuthCtx) {
|
|
581
|
-
const resolvedFetch = fetchFn ?? createSandboxFetchFromEnv();
|
|
582
|
-
const apiClient = new GravityRailClient(accessToken, apiUrl, resolvedFetch);
|
|
583
|
-
registerOrgAuthHandler(apiClient, apiUrl, accessToken ?? "", orgAuthCtx);
|
|
584
|
-
return apiClient;
|
|
585
|
-
}
|
|
586
|
-
function interactiveOrgAuth(ctx) {
|
|
587
|
-
return {
|
|
588
|
-
credentialsManager: ctx.credentialsManager,
|
|
589
|
-
env: ctx.env,
|
|
590
|
-
profile: ctx.profile,
|
|
591
|
-
frontendUrl: ctx.envConfig.frontendUrl,
|
|
592
|
-
interactive: true
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
function isLoopbackBrokerUrl(rawUrl) {
|
|
596
|
-
try {
|
|
597
|
-
const { hostname, protocol } = new URL(rawUrl);
|
|
598
|
-
if (protocol !== "http:" && protocol !== "https:") return false;
|
|
599
|
-
const host = hostname.replace(/^\[|\]$/g, "");
|
|
600
|
-
return host === "127.0.0.1" || host === "::1" || host === "localhost";
|
|
601
|
-
} catch {
|
|
602
|
-
return false;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
function sandboxBrokerUrl() {
|
|
606
|
-
const brokerUrl = process.env.GRAVITY_RAIL_BROKER_URL;
|
|
607
|
-
if (!brokerUrl || !isLoopbackBrokerUrl(brokerUrl)) return null;
|
|
608
|
-
return brokerUrl;
|
|
609
|
-
}
|
|
610
|
-
function tryBrokerContext(ctx) {
|
|
611
|
-
const brokerUrl = sandboxBrokerUrl();
|
|
612
|
-
if (!brokerUrl) return null;
|
|
613
|
-
const apiClient = makeApiClient(void 0, brokerUrl, createSandboxFetchFromEnv());
|
|
614
|
-
return { ...ctx, accessToken: "", apiClient };
|
|
615
|
-
}
|
|
616
|
-
function contextWithToken(ctx, auth) {
|
|
617
|
-
const apiClient = makeApiClient(
|
|
618
|
-
auth.accessToken,
|
|
619
|
-
ctx.envConfig.apiUrl,
|
|
620
|
-
void 0,
|
|
621
|
-
auth.credentials ? interactiveOrgAuth(ctx) : void 0
|
|
622
|
-
);
|
|
623
|
-
return {
|
|
624
|
-
...ctx,
|
|
625
|
-
accessToken: auth.accessToken,
|
|
626
|
-
apiClient,
|
|
627
|
-
profileWorkspace: auth.credentials?.workspaceUuid
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
function createContext(opts) {
|
|
631
|
-
const envConfig = getEnvironmentConfig(opts.env, {
|
|
632
|
-
apiUrl: opts.apiUrl,
|
|
633
|
-
startDir: opts.startDir
|
|
634
|
-
});
|
|
635
|
-
const credentialsManager = new CredentialsManager(homedir(), envConfig.apiUrl);
|
|
636
|
-
const profile = credentialsManager.resolveProfileName(opts.profile, opts.env);
|
|
637
|
-
return {
|
|
638
|
-
env: opts.env,
|
|
639
|
-
envConfig,
|
|
640
|
-
outputFormat: detectOutputFormat(opts.outputFormat),
|
|
641
|
-
jq: opts.jq,
|
|
642
|
-
verbose: opts.verbose ?? false,
|
|
643
|
-
allowWrite: opts.allowWrite ?? false,
|
|
644
|
-
credentialsManager,
|
|
645
|
-
profile
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
async function createAuthenticatedContext(opts) {
|
|
649
|
-
const ctx = createContext(opts);
|
|
650
|
-
const brokerCtx = tryBrokerContext(ctx);
|
|
651
|
-
if (brokerCtx) return brokerCtx;
|
|
652
|
-
const auth = await resolveNonInteractiveAuth({
|
|
653
|
-
env: ctx.env,
|
|
654
|
-
envConfig: ctx.envConfig,
|
|
655
|
-
credentialsManager: ctx.credentialsManager,
|
|
656
|
-
profile: ctx.profile
|
|
657
|
-
});
|
|
658
|
-
if (auth) return contextWithToken(ctx, auth);
|
|
659
|
-
if (ctx.profile !== "default") {
|
|
660
|
-
throw new AuthRequiredError(
|
|
661
|
-
`No credentials for profile "${ctx.profile}" (${ctx.env}). Run: gr auth login --name ${ctx.profile} or gr auth import-dev`
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
throw new AuthRequiredError(
|
|
665
|
-
"Not authenticated. Run `gr login`, `gr auth import-dev` (local dev), or set GRAVITY_RAIL_API_KEY."
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
function requireAuth(ctx) {
|
|
669
|
-
if (!("apiClient" in ctx)) {
|
|
670
|
-
throw new Error("Command handler accessed apiClient without declaring requiresAuth");
|
|
671
|
-
}
|
|
672
|
-
return ctx;
|
|
673
|
-
}
|
|
674
|
-
function createPublicContext(opts) {
|
|
675
|
-
const env = opts.env ?? "prod";
|
|
676
|
-
const envConfig = getEnvironmentConfig(env, {
|
|
677
|
-
apiUrl: opts.apiUrl,
|
|
678
|
-
frontendUrl: opts.frontendUrl,
|
|
679
|
-
startDir: opts.startDir
|
|
680
|
-
});
|
|
681
|
-
const credentialsManager = new CredentialsManager(homedir(), envConfig.apiUrl);
|
|
682
|
-
const profile = credentialsManager.resolveProfileName(opts.profile, env);
|
|
683
|
-
return {
|
|
684
|
-
env,
|
|
685
|
-
envConfig,
|
|
686
|
-
outputFormat: detectOutputFormat(opts.outputFormat),
|
|
687
|
-
jq: opts.jq,
|
|
688
|
-
verbose: opts.verbose ?? false,
|
|
689
|
-
allowWrite: opts.allowWrite ?? false,
|
|
690
|
-
credentialsManager,
|
|
691
|
-
profile
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
async function createPublicAuthenticatedContext(opts) {
|
|
695
|
-
const ctx = createPublicContext(opts);
|
|
696
|
-
const brokerCtx = tryBrokerContext(ctx);
|
|
697
|
-
if (brokerCtx) return brokerCtx;
|
|
698
|
-
const auth = await resolveNonInteractiveAuth({
|
|
699
|
-
env: ctx.env,
|
|
700
|
-
envConfig: ctx.envConfig,
|
|
701
|
-
credentialsManager: ctx.credentialsManager,
|
|
702
|
-
profile: ctx.profile
|
|
703
|
-
});
|
|
704
|
-
if (auth) return contextWithToken(ctx, auth);
|
|
705
|
-
throw new AuthRequiredError();
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
// src/lib/concierge-api.ts
|
|
709
|
-
function baseUrl(ctx) {
|
|
710
|
-
return `${ctx.envConfig.apiUrl}/api/v2/concierge`;
|
|
711
|
-
}
|
|
712
|
-
function authHeaders(ctx) {
|
|
713
|
-
return {
|
|
714
|
-
Authorization: `Bearer ${ctx.accessToken}`,
|
|
715
|
-
"Content-Type": "application/json"
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
function toCamelChat(raw) {
|
|
719
|
-
return {
|
|
720
|
-
id: raw.id,
|
|
721
|
-
uuid: raw.uuid,
|
|
722
|
-
chatType: raw.chatType,
|
|
723
|
-
title: raw.title,
|
|
724
|
-
threadId: raw.threadId,
|
|
725
|
-
createdAt: raw.createdAt,
|
|
726
|
-
updatedAt: raw.updatedAt
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
function toCamelMessage(raw) {
|
|
730
|
-
return {
|
|
731
|
-
id: raw.id,
|
|
732
|
-
role: raw.role,
|
|
733
|
-
content: raw.content ?? "",
|
|
734
|
-
createdAt: raw.createdAt ?? null,
|
|
735
|
-
// Protocol-exempt snake_case on wire (see ConciergeMessageResponse)
|
|
736
|
-
toolCalls: raw.tool_calls ?? null,
|
|
737
|
-
toolCallId: raw.tool_call_id ?? null
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
async function listConciergeChats(ctx) {
|
|
741
|
-
const res = await fetch(`${baseUrl(ctx)}/chats`, { headers: authHeaders(ctx) });
|
|
742
|
-
if (!res.ok) throw new Error(`Failed to list concierge chats: ${res.status}`);
|
|
743
|
-
const data = await res.json();
|
|
744
|
-
return data.map(toCamelChat);
|
|
745
|
-
}
|
|
746
|
-
async function createConciergeChat(ctx, title) {
|
|
747
|
-
const res = await fetch(`${baseUrl(ctx)}/chats`, {
|
|
748
|
-
method: "POST",
|
|
749
|
-
headers: authHeaders(ctx),
|
|
750
|
-
body: JSON.stringify({ title: title ?? null })
|
|
751
|
-
});
|
|
752
|
-
if (!res.ok) throw new Error(`Failed to create concierge chat: ${res.status}`);
|
|
753
|
-
return toCamelChat(await res.json());
|
|
754
|
-
}
|
|
755
|
-
async function getConciergeChat(ctx, chatId) {
|
|
756
|
-
const res = await fetch(`${baseUrl(ctx)}/chats/${chatId}`, { headers: authHeaders(ctx) });
|
|
757
|
-
if (!res.ok) throw new Error(`Failed to get concierge chat ${chatId}: ${res.status}`);
|
|
758
|
-
return toCamelChat(await res.json());
|
|
759
|
-
}
|
|
760
|
-
async function originateConciergeCall(ctx, kind = "concierge_setup", outboundMessage, clientSurface) {
|
|
761
|
-
const body = { kind };
|
|
762
|
-
if (outboundMessage) body.outbound_message = outboundMessage;
|
|
763
|
-
if (clientSurface) body.client_surface = clientSurface;
|
|
764
|
-
const res = await fetch(`${baseUrl(ctx)}/calls`, {
|
|
765
|
-
method: "POST",
|
|
766
|
-
headers: authHeaders(ctx),
|
|
767
|
-
body: JSON.stringify(body)
|
|
768
|
-
});
|
|
769
|
-
if (res.status === 412) {
|
|
770
|
-
throw new Error("Your account phone is not verified. Run `gr account verify-phone` first.");
|
|
771
|
-
}
|
|
772
|
-
if (!res.ok) {
|
|
773
|
-
const detail = await res.text();
|
|
774
|
-
throw new Error(`Failed to start concierge call: ${res.status} ${detail}`);
|
|
775
|
-
}
|
|
776
|
-
return await res.json();
|
|
777
|
-
}
|
|
778
|
-
async function originateConciergeSms(ctx, kind = "concierge_setup") {
|
|
779
|
-
const res = await fetch(`${baseUrl(ctx)}/sms`, {
|
|
780
|
-
method: "POST",
|
|
781
|
-
headers: authHeaders(ctx),
|
|
782
|
-
body: JSON.stringify({ kind })
|
|
783
|
-
});
|
|
784
|
-
if (res.status === 412) {
|
|
785
|
-
throw new Error("Your account phone is not verified. Run `gr account verify-phone` first.");
|
|
786
|
-
}
|
|
787
|
-
if (!res.ok) {
|
|
788
|
-
const detail = await res.text();
|
|
789
|
-
throw new Error(`Failed to start concierge SMS: ${res.status} ${detail}`);
|
|
790
|
-
}
|
|
791
|
-
return await res.json();
|
|
792
|
-
}
|
|
793
|
-
async function startAccountPhoneVerify(ctx, phone) {
|
|
794
|
-
const res = await fetch(`${ctx.envConfig.apiUrl}/api/v2/account/phone/verify/start`, {
|
|
795
|
-
method: "POST",
|
|
796
|
-
headers: authHeaders(ctx),
|
|
797
|
-
body: JSON.stringify({ phone })
|
|
798
|
-
});
|
|
799
|
-
if (!res.ok) {
|
|
800
|
-
const detail = await res.text();
|
|
801
|
-
throw new Error(`Failed to send verification code: ${res.status} ${detail}`);
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
async function confirmAccountPhoneVerify(ctx, code) {
|
|
805
|
-
const res = await fetch(`${ctx.envConfig.apiUrl}/api/v2/account/phone/verify/confirm`, {
|
|
806
|
-
method: "POST",
|
|
807
|
-
headers: authHeaders(ctx),
|
|
808
|
-
body: JSON.stringify({ code })
|
|
809
|
-
});
|
|
810
|
-
if (!res.ok) {
|
|
811
|
-
const detail = await res.text();
|
|
812
|
-
throw new Error(`Failed to confirm verification code: ${res.status} ${detail}`);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
async function getConciergeChatMessages(ctx, chatId) {
|
|
816
|
-
const res = await fetch(`${baseUrl(ctx)}/chats/${chatId}/messages`, {
|
|
817
|
-
headers: authHeaders(ctx)
|
|
818
|
-
});
|
|
819
|
-
if (!res.ok)
|
|
820
|
-
throw new Error(`Failed to get concierge messages for chat ${chatId}: ${res.status}`);
|
|
821
|
-
const data = await res.json();
|
|
822
|
-
return data.map(toCamelMessage);
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
export {
|
|
826
|
-
isListResult,
|
|
827
|
-
isPagePaginatedResponse,
|
|
828
|
-
isCursorPaginatedResponse,
|
|
829
|
-
isPaginatedResponse,
|
|
830
|
-
extractPaginationMeta,
|
|
831
|
-
formatPaginationWarning,
|
|
832
|
-
unwrapItems,
|
|
833
|
-
LIST_PAGINATION_ARGS,
|
|
834
|
-
parsePaginationArgs,
|
|
835
|
-
fetchAllPages,
|
|
836
|
-
fetchAllCursorPages,
|
|
837
|
-
listResult,
|
|
838
|
-
detectOutputFormat,
|
|
839
|
-
outputData,
|
|
840
|
-
outputSingle,
|
|
841
|
-
COL,
|
|
842
|
-
hint,
|
|
843
|
-
stderr,
|
|
844
|
-
flushStdout,
|
|
845
|
-
createSandboxFetchFromEnv,
|
|
846
|
-
sandboxBrokerUrl,
|
|
847
|
-
createContext,
|
|
848
|
-
createAuthenticatedContext,
|
|
849
|
-
requireAuth,
|
|
850
|
-
createPublicContext,
|
|
851
|
-
createPublicAuthenticatedContext,
|
|
852
|
-
listConciergeChats,
|
|
853
|
-
createConciergeChat,
|
|
854
|
-
getConciergeChat,
|
|
855
|
-
originateConciergeCall,
|
|
856
|
-
originateConciergeSms,
|
|
857
|
-
startAccountPhoneVerify,
|
|
858
|
-
confirmAccountPhoneVerify,
|
|
859
|
-
getConciergeChatMessages
|
|
860
|
-
};
|
|
861
|
-
//# sourceMappingURL=chunk-JOXB4Y4Q.js.map
|