@anythingai/cli 0.0.2 → 0.0.3
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 +13 -0
- package/dist/js/bin.mjs +2308 -887
- package/package.json +6 -1
- package/skills/anything-cli/SKILL.md +27 -2
package/dist/js/bin.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { hideBin } from "yargs/helpers";
|
|
4
4
|
import yargs from "yargs";
|
|
5
|
-
import { exec, execSync } from "node:child_process";
|
|
5
|
+
import { exec, execSync, spawn } from "node:child_process";
|
|
6
6
|
import fs, { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import path, { basename, dirname, extname, join, resolve } from "node:path";
|
|
8
8
|
import Conf from "conf";
|
|
@@ -3053,544 +3053,1563 @@ function errorCodeFromHttpStatus(status) {
|
|
|
3053
3053
|
|
|
3054
3054
|
//#endregion
|
|
3055
3055
|
//#region package.json
|
|
3056
|
-
var version = "0.0.
|
|
3056
|
+
var version = "0.0.3";
|
|
3057
3057
|
|
|
3058
3058
|
//#endregion
|
|
3059
|
-
//#region
|
|
3060
|
-
const
|
|
3061
|
-
|
|
3062
|
-
if (
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3059
|
+
//#region generated/core/bodySerializer.gen.ts
|
|
3060
|
+
const serializeFormDataPair = (data, key, value) => {
|
|
3061
|
+
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
3062
|
+
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
3063
|
+
else data.append(key, JSON.stringify(value));
|
|
3064
|
+
};
|
|
3065
|
+
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
3066
|
+
const data = new FormData();
|
|
3067
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
3068
|
+
if (value === void 0 || value === null) return;
|
|
3069
|
+
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
3070
|
+
else serializeFormDataPair(data, key, value);
|
|
3071
|
+
});
|
|
3072
|
+
return data;
|
|
3073
|
+
} };
|
|
3074
|
+
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
3075
|
+
|
|
3076
|
+
//#endregion
|
|
3077
|
+
//#region generated/core/params.gen.ts
|
|
3078
|
+
const extraPrefixes = Object.entries({
|
|
3079
|
+
$body_: "body",
|
|
3080
|
+
$headers_: "headers",
|
|
3081
|
+
$path_: "path",
|
|
3082
|
+
$query_: "query"
|
|
3083
|
+
});
|
|
3084
|
+
|
|
3085
|
+
//#endregion
|
|
3086
|
+
//#region generated/core/serverSentEvents.gen.ts
|
|
3087
|
+
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
3088
|
+
let lastEventId;
|
|
3089
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
3090
|
+
const createStream = async function* () {
|
|
3091
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
3092
|
+
let attempt = 0;
|
|
3093
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
3094
|
+
while (true) {
|
|
3095
|
+
if (signal.aborted) break;
|
|
3096
|
+
attempt++;
|
|
3097
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
3098
|
+
if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
|
|
3099
|
+
try {
|
|
3100
|
+
const requestInit = {
|
|
3101
|
+
redirect: "follow",
|
|
3102
|
+
...options,
|
|
3103
|
+
body: options.serializedBody,
|
|
3104
|
+
headers,
|
|
3105
|
+
signal
|
|
3106
|
+
};
|
|
3107
|
+
let request = new Request(url, requestInit);
|
|
3108
|
+
if (onRequest) request = await onRequest(url, requestInit);
|
|
3109
|
+
const response = await (options.fetch ?? globalThis.fetch)(request);
|
|
3110
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
3111
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
3112
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
3113
|
+
let buffer = "";
|
|
3114
|
+
const abortHandler = () => {
|
|
3115
|
+
try {
|
|
3116
|
+
reader.cancel();
|
|
3117
|
+
} catch {}
|
|
3118
|
+
};
|
|
3119
|
+
signal.addEventListener("abort", abortHandler);
|
|
3120
|
+
try {
|
|
3121
|
+
while (true) {
|
|
3122
|
+
const { done, value } = await reader.read();
|
|
3123
|
+
if (done) break;
|
|
3124
|
+
buffer += value;
|
|
3125
|
+
const chunks = buffer.split("\n\n");
|
|
3126
|
+
buffer = chunks.pop() ?? "";
|
|
3127
|
+
for (const chunk of chunks) {
|
|
3128
|
+
const lines = chunk.split("\n");
|
|
3129
|
+
const dataLines = [];
|
|
3130
|
+
let eventName;
|
|
3131
|
+
for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
|
|
3132
|
+
else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
|
|
3133
|
+
else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
|
|
3134
|
+
else if (line.startsWith("retry:")) {
|
|
3135
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
3136
|
+
if (!Number.isNaN(parsed)) retryDelay = parsed;
|
|
3137
|
+
}
|
|
3138
|
+
let data;
|
|
3139
|
+
let parsedJson = false;
|
|
3140
|
+
if (dataLines.length) {
|
|
3141
|
+
const rawData = dataLines.join("\n");
|
|
3142
|
+
try {
|
|
3143
|
+
data = JSON.parse(rawData);
|
|
3144
|
+
parsedJson = true;
|
|
3145
|
+
} catch {
|
|
3146
|
+
data = rawData;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
if (parsedJson) {
|
|
3150
|
+
if (responseValidator) await responseValidator(data);
|
|
3151
|
+
if (responseTransformer) data = await responseTransformer(data);
|
|
3152
|
+
}
|
|
3153
|
+
onSseEvent?.({
|
|
3154
|
+
data,
|
|
3155
|
+
event: eventName,
|
|
3156
|
+
id: lastEventId,
|
|
3157
|
+
retry: retryDelay
|
|
3158
|
+
});
|
|
3159
|
+
if (dataLines.length) yield data;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
} finally {
|
|
3163
|
+
signal.removeEventListener("abort", abortHandler);
|
|
3164
|
+
reader.releaseLock();
|
|
3165
|
+
}
|
|
3166
|
+
break;
|
|
3167
|
+
} catch (error) {
|
|
3168
|
+
onSseError?.(error);
|
|
3169
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
|
|
3170
|
+
await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3174
|
+
return { stream: createStream() };
|
|
3175
|
+
};
|
|
3176
|
+
|
|
3177
|
+
//#endregion
|
|
3178
|
+
//#region generated/core/pathSerializer.gen.ts
|
|
3179
|
+
const separatorArrayExplode = (style) => {
|
|
3180
|
+
switch (style) {
|
|
3181
|
+
case "label": return ".";
|
|
3182
|
+
case "matrix": return ";";
|
|
3183
|
+
case "simple": return ",";
|
|
3184
|
+
default: return "&";
|
|
3071
3185
|
}
|
|
3072
|
-
|
|
3186
|
+
};
|
|
3187
|
+
const separatorArrayNoExplode = (style) => {
|
|
3188
|
+
switch (style) {
|
|
3189
|
+
case "form": return ",";
|
|
3190
|
+
case "pipeDelimited": return "|";
|
|
3191
|
+
case "spaceDelimited": return "%20";
|
|
3192
|
+
default: return ",";
|
|
3193
|
+
}
|
|
3194
|
+
};
|
|
3195
|
+
const separatorObjectExplode = (style) => {
|
|
3196
|
+
switch (style) {
|
|
3197
|
+
case "label": return ".";
|
|
3198
|
+
case "matrix": return ";";
|
|
3199
|
+
case "simple": return ",";
|
|
3200
|
+
default: return "&";
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
3204
|
+
if (!explode) {
|
|
3205
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
3206
|
+
switch (style) {
|
|
3207
|
+
case "label": return `.${joinedValues}`;
|
|
3208
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
3209
|
+
case "simple": return joinedValues;
|
|
3210
|
+
default: return `${name}=${joinedValues}`;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
const separator = separatorArrayExplode(style);
|
|
3214
|
+
const joinedValues = value.map((v) => {
|
|
3215
|
+
if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
|
|
3216
|
+
return serializePrimitiveParam({
|
|
3217
|
+
allowReserved,
|
|
3218
|
+
name,
|
|
3219
|
+
value: v
|
|
3220
|
+
});
|
|
3221
|
+
}).join(separator);
|
|
3222
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
3223
|
+
};
|
|
3224
|
+
const serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
3225
|
+
if (value === void 0 || value === null) return "";
|
|
3226
|
+
if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
3227
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
3228
|
+
};
|
|
3229
|
+
const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
3230
|
+
if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
3231
|
+
if (style !== "deepObject" && !explode) {
|
|
3232
|
+
let values = [];
|
|
3233
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
3234
|
+
values = [
|
|
3235
|
+
...values,
|
|
3236
|
+
key,
|
|
3237
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
3238
|
+
];
|
|
3239
|
+
});
|
|
3240
|
+
const joinedValues = values.join(",");
|
|
3241
|
+
switch (style) {
|
|
3242
|
+
case "form": return `${name}=${joinedValues}`;
|
|
3243
|
+
case "label": return `.${joinedValues}`;
|
|
3244
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
3245
|
+
default: return joinedValues;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
const separator = separatorObjectExplode(style);
|
|
3249
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
3250
|
+
allowReserved,
|
|
3251
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
3252
|
+
value: v
|
|
3253
|
+
})).join(separator);
|
|
3254
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
3255
|
+
};
|
|
3256
|
+
|
|
3257
|
+
//#endregion
|
|
3258
|
+
//#region generated/core/utils.gen.ts
|
|
3259
|
+
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
3260
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
3261
|
+
let url = _url;
|
|
3262
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
3263
|
+
if (matches) for (const match of matches) {
|
|
3264
|
+
let explode = false;
|
|
3265
|
+
let name = match.substring(1, match.length - 1);
|
|
3266
|
+
let style = "simple";
|
|
3267
|
+
if (name.endsWith("*")) {
|
|
3268
|
+
explode = true;
|
|
3269
|
+
name = name.substring(0, name.length - 1);
|
|
3270
|
+
}
|
|
3271
|
+
if (name.startsWith(".")) {
|
|
3272
|
+
name = name.substring(1);
|
|
3273
|
+
style = "label";
|
|
3274
|
+
} else if (name.startsWith(";")) {
|
|
3275
|
+
name = name.substring(1);
|
|
3276
|
+
style = "matrix";
|
|
3277
|
+
}
|
|
3278
|
+
const value = path[name];
|
|
3279
|
+
if (value === void 0 || value === null) continue;
|
|
3280
|
+
if (Array.isArray(value)) {
|
|
3281
|
+
url = url.replace(match, serializeArrayParam({
|
|
3282
|
+
explode,
|
|
3283
|
+
name,
|
|
3284
|
+
style,
|
|
3285
|
+
value
|
|
3286
|
+
}));
|
|
3287
|
+
continue;
|
|
3288
|
+
}
|
|
3289
|
+
if (typeof value === "object") {
|
|
3290
|
+
url = url.replace(match, serializeObjectParam({
|
|
3291
|
+
explode,
|
|
3292
|
+
name,
|
|
3293
|
+
style,
|
|
3294
|
+
value,
|
|
3295
|
+
valueOnly: true
|
|
3296
|
+
}));
|
|
3297
|
+
continue;
|
|
3298
|
+
}
|
|
3299
|
+
if (style === "matrix") {
|
|
3300
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
3301
|
+
name,
|
|
3302
|
+
value
|
|
3303
|
+
})}`);
|
|
3304
|
+
continue;
|
|
3305
|
+
}
|
|
3306
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
3307
|
+
url = url.replace(match, replaceValue);
|
|
3308
|
+
}
|
|
3309
|
+
return url;
|
|
3310
|
+
};
|
|
3311
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
3312
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
3313
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
3314
|
+
if (path) url = defaultPathSerializer({
|
|
3315
|
+
path,
|
|
3316
|
+
url
|
|
3317
|
+
});
|
|
3318
|
+
let search = query ? querySerializer(query) : "";
|
|
3319
|
+
if (search.startsWith("?")) search = search.substring(1);
|
|
3320
|
+
if (search) url += `?${search}`;
|
|
3321
|
+
return url;
|
|
3322
|
+
};
|
|
3323
|
+
function getValidRequestBody(options) {
|
|
3324
|
+
const hasBody = options.body !== void 0;
|
|
3325
|
+
if (hasBody && options.bodySerializer) {
|
|
3326
|
+
if ("serializedBody" in options) return options.serializedBody !== void 0 && options.serializedBody !== "" ? options.serializedBody : null;
|
|
3327
|
+
return options.body !== "" ? options.body : null;
|
|
3328
|
+
}
|
|
3329
|
+
if (hasBody) return options.body;
|
|
3073
3330
|
}
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
"
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3331
|
+
|
|
3332
|
+
//#endregion
|
|
3333
|
+
//#region generated/core/auth.gen.ts
|
|
3334
|
+
const getAuthToken = async (auth, callback) => {
|
|
3335
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
3336
|
+
if (!token) return;
|
|
3337
|
+
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
3338
|
+
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
3339
|
+
return token;
|
|
3340
|
+
};
|
|
3341
|
+
|
|
3342
|
+
//#endregion
|
|
3343
|
+
//#region generated/client/utils.gen.ts
|
|
3344
|
+
const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
3345
|
+
const querySerializer = (queryParams) => {
|
|
3346
|
+
const search = [];
|
|
3347
|
+
if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
|
|
3348
|
+
const value = queryParams[name];
|
|
3349
|
+
if (value === void 0 || value === null) continue;
|
|
3350
|
+
const options = parameters[name] || args;
|
|
3351
|
+
if (Array.isArray(value)) {
|
|
3352
|
+
const serializedArray = serializeArrayParam({
|
|
3353
|
+
allowReserved: options.allowReserved,
|
|
3354
|
+
explode: true,
|
|
3355
|
+
name,
|
|
3356
|
+
style: "form",
|
|
3357
|
+
value,
|
|
3358
|
+
...options.array
|
|
3359
|
+
});
|
|
3360
|
+
if (serializedArray) search.push(serializedArray);
|
|
3361
|
+
} else if (typeof value === "object") {
|
|
3362
|
+
const serializedObject = serializeObjectParam({
|
|
3363
|
+
allowReserved: options.allowReserved,
|
|
3364
|
+
explode: true,
|
|
3365
|
+
name,
|
|
3366
|
+
style: "deepObject",
|
|
3367
|
+
value,
|
|
3368
|
+
...options.object
|
|
3369
|
+
});
|
|
3370
|
+
if (serializedObject) search.push(serializedObject);
|
|
3371
|
+
} else {
|
|
3372
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
3373
|
+
allowReserved: options.allowReserved,
|
|
3374
|
+
name,
|
|
3375
|
+
value
|
|
3376
|
+
});
|
|
3377
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
return search.join("&");
|
|
3381
|
+
};
|
|
3382
|
+
return querySerializer;
|
|
3383
|
+
};
|
|
3384
|
+
/**
|
|
3385
|
+
* Infers parseAs value from provided Content-Type header.
|
|
3386
|
+
*/
|
|
3387
|
+
const getParseAs = (contentType) => {
|
|
3388
|
+
if (!contentType) return "stream";
|
|
3389
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
3390
|
+
if (!cleanContent) return;
|
|
3391
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
|
|
3392
|
+
if (cleanContent === "multipart/form-data") return "formData";
|
|
3393
|
+
if ([
|
|
3394
|
+
"application/",
|
|
3395
|
+
"audio/",
|
|
3396
|
+
"image/",
|
|
3397
|
+
"video/"
|
|
3398
|
+
].some((type) => cleanContent.startsWith(type))) return "blob";
|
|
3399
|
+
if (cleanContent.startsWith("text/")) return "text";
|
|
3400
|
+
};
|
|
3401
|
+
const checkForExistence = (options, name) => {
|
|
3402
|
+
if (!name) return false;
|
|
3403
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
|
|
3404
|
+
return false;
|
|
3405
|
+
};
|
|
3406
|
+
const setAuthParams = async ({ security, ...options }) => {
|
|
3407
|
+
for (const auth of security) {
|
|
3408
|
+
if (checkForExistence(options, auth.name)) continue;
|
|
3409
|
+
const token = await getAuthToken(auth, options.auth);
|
|
3410
|
+
if (!token) continue;
|
|
3411
|
+
const name = auth.name ?? "Authorization";
|
|
3412
|
+
switch (auth.in) {
|
|
3413
|
+
case "query":
|
|
3414
|
+
if (!options.query) options.query = {};
|
|
3415
|
+
options.query[name] = token;
|
|
3416
|
+
break;
|
|
3417
|
+
case "cookie":
|
|
3418
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
3419
|
+
break;
|
|
3420
|
+
default:
|
|
3421
|
+
options.headers.set(name, token);
|
|
3422
|
+
break;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
};
|
|
3426
|
+
const buildUrl = (options) => getUrl({
|
|
3427
|
+
baseUrl: options.baseUrl,
|
|
3428
|
+
path: options.path,
|
|
3429
|
+
query: options.query,
|
|
3430
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
3431
|
+
url: options.url
|
|
3432
|
+
});
|
|
3433
|
+
const mergeConfigs = (a, b) => {
|
|
3434
|
+
const config = {
|
|
3435
|
+
...a,
|
|
3436
|
+
...b
|
|
3437
|
+
};
|
|
3438
|
+
if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
3439
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
3440
|
+
return config;
|
|
3441
|
+
};
|
|
3442
|
+
const headersEntries = (headers) => {
|
|
3443
|
+
const entries = [];
|
|
3444
|
+
headers.forEach((value, key) => {
|
|
3445
|
+
entries.push([key, value]);
|
|
3446
|
+
});
|
|
3447
|
+
return entries;
|
|
3448
|
+
};
|
|
3449
|
+
const mergeHeaders = (...headers) => {
|
|
3450
|
+
const mergedHeaders = new Headers();
|
|
3451
|
+
for (const header of headers) {
|
|
3452
|
+
if (!header) continue;
|
|
3453
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
3454
|
+
for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
|
|
3455
|
+
else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
|
|
3456
|
+
else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
3457
|
+
}
|
|
3458
|
+
return mergedHeaders;
|
|
3459
|
+
};
|
|
3460
|
+
var Interceptors = class {
|
|
3461
|
+
fns = [];
|
|
3462
|
+
clear() {
|
|
3463
|
+
this.fns = [];
|
|
3464
|
+
}
|
|
3465
|
+
eject(id) {
|
|
3466
|
+
const index = this.getInterceptorIndex(id);
|
|
3467
|
+
if (this.fns[index]) this.fns[index] = null;
|
|
3468
|
+
}
|
|
3469
|
+
exists(id) {
|
|
3470
|
+
const index = this.getInterceptorIndex(id);
|
|
3471
|
+
return Boolean(this.fns[index]);
|
|
3472
|
+
}
|
|
3473
|
+
getInterceptorIndex(id) {
|
|
3474
|
+
if (typeof id === "number") return this.fns[id] ? id : -1;
|
|
3475
|
+
return this.fns.indexOf(id);
|
|
3476
|
+
}
|
|
3477
|
+
update(id, fn) {
|
|
3478
|
+
const index = this.getInterceptorIndex(id);
|
|
3479
|
+
if (this.fns[index]) {
|
|
3480
|
+
this.fns[index] = fn;
|
|
3481
|
+
return id;
|
|
3482
|
+
}
|
|
3483
|
+
return false;
|
|
3484
|
+
}
|
|
3485
|
+
use(fn) {
|
|
3486
|
+
this.fns.push(fn);
|
|
3487
|
+
return this.fns.length - 1;
|
|
3488
|
+
}
|
|
3489
|
+
};
|
|
3490
|
+
const createInterceptors = () => ({
|
|
3491
|
+
error: new Interceptors(),
|
|
3492
|
+
request: new Interceptors(),
|
|
3493
|
+
response: new Interceptors()
|
|
3494
|
+
});
|
|
3495
|
+
const defaultQuerySerializer = createQuerySerializer({
|
|
3496
|
+
allowReserved: false,
|
|
3497
|
+
array: {
|
|
3498
|
+
explode: true,
|
|
3499
|
+
style: "form"
|
|
3500
|
+
},
|
|
3501
|
+
object: {
|
|
3502
|
+
explode: true,
|
|
3503
|
+
style: "deepObject"
|
|
3504
|
+
}
|
|
3505
|
+
});
|
|
3506
|
+
const defaultHeaders = { "Content-Type": "application/json" };
|
|
3507
|
+
const createConfig = (override = {}) => ({
|
|
3508
|
+
...jsonBodySerializer,
|
|
3509
|
+
headers: defaultHeaders,
|
|
3510
|
+
parseAs: "auto",
|
|
3511
|
+
querySerializer: defaultQuerySerializer,
|
|
3512
|
+
...override
|
|
3513
|
+
});
|
|
3514
|
+
|
|
3515
|
+
//#endregion
|
|
3516
|
+
//#region generated/client/client.gen.ts
|
|
3517
|
+
const createClient$1 = (config = {}) => {
|
|
3518
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
3519
|
+
const getConfig = () => ({ ..._config });
|
|
3520
|
+
const setConfig = (config) => {
|
|
3521
|
+
_config = mergeConfigs(_config, config);
|
|
3522
|
+
return getConfig();
|
|
3523
|
+
};
|
|
3524
|
+
const interceptors = createInterceptors();
|
|
3525
|
+
const beforeRequest = async (options) => {
|
|
3526
|
+
const opts = {
|
|
3527
|
+
..._config,
|
|
3528
|
+
...options,
|
|
3529
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
3530
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
3531
|
+
serializedBody: void 0
|
|
3532
|
+
};
|
|
3533
|
+
if (opts.security) await setAuthParams({
|
|
3534
|
+
...opts,
|
|
3535
|
+
security: opts.security
|
|
3536
|
+
});
|
|
3537
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
3538
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
3539
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
3540
|
+
return {
|
|
3541
|
+
opts,
|
|
3542
|
+
url: buildUrl(opts)
|
|
3543
|
+
};
|
|
3544
|
+
};
|
|
3545
|
+
const request = async (options) => {
|
|
3546
|
+
const { opts, url } = await beforeRequest(options);
|
|
3547
|
+
const requestInit = {
|
|
3548
|
+
redirect: "follow",
|
|
3549
|
+
...opts,
|
|
3550
|
+
body: getValidRequestBody(opts)
|
|
3551
|
+
};
|
|
3552
|
+
let request = new Request(url, requestInit);
|
|
3553
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
3554
|
+
const _fetch = opts.fetch;
|
|
3555
|
+
let response;
|
|
3556
|
+
try {
|
|
3557
|
+
response = await _fetch(request);
|
|
3558
|
+
} catch (error) {
|
|
3559
|
+
let finalError = error;
|
|
3560
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, void 0, request, opts);
|
|
3561
|
+
finalError = finalError || {};
|
|
3562
|
+
if (opts.throwOnError) throw finalError;
|
|
3563
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
3564
|
+
error: finalError,
|
|
3565
|
+
request,
|
|
3566
|
+
response: void 0
|
|
3567
|
+
};
|
|
3568
|
+
}
|
|
3569
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
3570
|
+
const result = {
|
|
3571
|
+
request,
|
|
3572
|
+
response
|
|
3573
|
+
};
|
|
3574
|
+
if (response.ok) {
|
|
3575
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
3576
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
3577
|
+
let emptyData;
|
|
3578
|
+
switch (parseAs) {
|
|
3579
|
+
case "arrayBuffer":
|
|
3580
|
+
case "blob":
|
|
3581
|
+
case "text":
|
|
3582
|
+
emptyData = await response[parseAs]();
|
|
3583
|
+
break;
|
|
3584
|
+
case "formData":
|
|
3585
|
+
emptyData = new FormData();
|
|
3586
|
+
break;
|
|
3587
|
+
case "stream":
|
|
3588
|
+
emptyData = response.body;
|
|
3589
|
+
break;
|
|
3590
|
+
default:
|
|
3591
|
+
emptyData = {};
|
|
3592
|
+
break;
|
|
3593
|
+
}
|
|
3594
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
3595
|
+
data: emptyData,
|
|
3596
|
+
...result
|
|
3597
|
+
};
|
|
3598
|
+
}
|
|
3599
|
+
let data;
|
|
3600
|
+
switch (parseAs) {
|
|
3601
|
+
case "arrayBuffer":
|
|
3602
|
+
case "blob":
|
|
3603
|
+
case "formData":
|
|
3604
|
+
case "json":
|
|
3605
|
+
case "text":
|
|
3606
|
+
data = await response[parseAs]();
|
|
3607
|
+
break;
|
|
3608
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
3609
|
+
data: response.body,
|
|
3610
|
+
...result
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
if (parseAs === "json") {
|
|
3614
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
3615
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
3616
|
+
}
|
|
3617
|
+
return opts.responseStyle === "data" ? data : {
|
|
3618
|
+
data,
|
|
3619
|
+
...result
|
|
3620
|
+
};
|
|
3621
|
+
}
|
|
3622
|
+
const textError = await response.text();
|
|
3623
|
+
let jsonError;
|
|
3624
|
+
try {
|
|
3625
|
+
jsonError = JSON.parse(textError);
|
|
3626
|
+
} catch {}
|
|
3627
|
+
const error = jsonError ?? textError;
|
|
3628
|
+
let finalError = error;
|
|
3629
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request, opts);
|
|
3630
|
+
finalError = finalError || {};
|
|
3631
|
+
if (opts.throwOnError) throw finalError;
|
|
3632
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
3633
|
+
error: finalError,
|
|
3634
|
+
...result
|
|
3635
|
+
};
|
|
3636
|
+
};
|
|
3637
|
+
const makeMethodFn = (method) => (options) => request({
|
|
3638
|
+
...options,
|
|
3639
|
+
method
|
|
3640
|
+
});
|
|
3641
|
+
const makeSseFn = (method) => async (options) => {
|
|
3642
|
+
const { opts, url } = await beforeRequest(options);
|
|
3643
|
+
return createSseClient({
|
|
3644
|
+
...opts,
|
|
3645
|
+
body: opts.body,
|
|
3646
|
+
headers: opts.headers,
|
|
3647
|
+
method,
|
|
3648
|
+
onRequest: async (url, init) => {
|
|
3649
|
+
let request = new Request(url, init);
|
|
3650
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
3651
|
+
return request;
|
|
3652
|
+
},
|
|
3653
|
+
url
|
|
3654
|
+
});
|
|
3655
|
+
};
|
|
3656
|
+
return {
|
|
3657
|
+
buildUrl,
|
|
3658
|
+
connect: makeMethodFn("CONNECT"),
|
|
3659
|
+
delete: makeMethodFn("DELETE"),
|
|
3660
|
+
get: makeMethodFn("GET"),
|
|
3661
|
+
getConfig,
|
|
3662
|
+
head: makeMethodFn("HEAD"),
|
|
3663
|
+
interceptors,
|
|
3664
|
+
options: makeMethodFn("OPTIONS"),
|
|
3665
|
+
patch: makeMethodFn("PATCH"),
|
|
3666
|
+
post: makeMethodFn("POST"),
|
|
3667
|
+
put: makeMethodFn("PUT"),
|
|
3668
|
+
request,
|
|
3669
|
+
setConfig,
|
|
3670
|
+
sse: {
|
|
3671
|
+
connect: makeSseFn("CONNECT"),
|
|
3672
|
+
delete: makeSseFn("DELETE"),
|
|
3673
|
+
get: makeSseFn("GET"),
|
|
3674
|
+
head: makeSseFn("HEAD"),
|
|
3675
|
+
options: makeSseFn("OPTIONS"),
|
|
3676
|
+
patch: makeSseFn("PATCH"),
|
|
3677
|
+
post: makeSseFn("POST"),
|
|
3678
|
+
put: makeSseFn("PUT"),
|
|
3679
|
+
trace: makeSseFn("TRACE")
|
|
3680
|
+
},
|
|
3681
|
+
trace: makeMethodFn("TRACE")
|
|
3682
|
+
};
|
|
3683
|
+
};
|
|
3684
|
+
|
|
3685
|
+
//#endregion
|
|
3686
|
+
//#region generated/client.gen.ts
|
|
3687
|
+
const client = createClient$1(createConfig());
|
|
3688
|
+
|
|
3689
|
+
//#endregion
|
|
3690
|
+
//#region generated/sdk.gen.ts
|
|
3691
|
+
/**
|
|
3692
|
+
* Get current user info
|
|
3693
|
+
*
|
|
3694
|
+
* Returns the authenticated user and their organizations, including plan and credit context.
|
|
3695
|
+
*/
|
|
3696
|
+
const getV0ApiMe = (options) => (options?.client ?? client).get({
|
|
3697
|
+
security: [{
|
|
3698
|
+
scheme: "basic",
|
|
3699
|
+
type: "http"
|
|
3700
|
+
}],
|
|
3701
|
+
url: "/v0/api/me",
|
|
3702
|
+
...options
|
|
3089
3703
|
});
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3704
|
+
/**
|
|
3705
|
+
* List organization members
|
|
3706
|
+
*
|
|
3707
|
+
* Returns collaborators and pending invites for an organization the authenticated user can access.
|
|
3708
|
+
*/
|
|
3709
|
+
const getV0ApiOrganizationsByOrganizationIdMembers = (options) => (options.client ?? client).get({
|
|
3710
|
+
security: [{
|
|
3711
|
+
scheme: "basic",
|
|
3712
|
+
type: "http"
|
|
3713
|
+
}],
|
|
3714
|
+
url: "/v0/api/organizations/{organizationId}/members",
|
|
3715
|
+
...options
|
|
3093
3716
|
});
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3717
|
+
/**
|
|
3718
|
+
* List accessible projects
|
|
3719
|
+
*
|
|
3720
|
+
* Returns project groups the authenticated user can access, optionally filtered by organization or search query.
|
|
3721
|
+
*/
|
|
3722
|
+
const getV0ApiProjects = (options) => (options?.client ?? client).get({
|
|
3723
|
+
security: [{
|
|
3724
|
+
scheme: "basic",
|
|
3725
|
+
type: "http"
|
|
3726
|
+
}],
|
|
3727
|
+
url: "/v0/api/projects",
|
|
3728
|
+
...options
|
|
3097
3729
|
});
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3730
|
+
/**
|
|
3731
|
+
* Create a new project
|
|
3732
|
+
*
|
|
3733
|
+
* Creates a new project and starts initial generation from a prompt.
|
|
3734
|
+
*/
|
|
3735
|
+
const postV0ApiProjects = (options) => (options?.client ?? client).post({
|
|
3736
|
+
security: [{
|
|
3737
|
+
scheme: "basic",
|
|
3738
|
+
type: "http"
|
|
3739
|
+
}],
|
|
3740
|
+
url: "/v0/api/projects",
|
|
3741
|
+
...options,
|
|
3742
|
+
headers: {
|
|
3743
|
+
"Content-Type": "application/json",
|
|
3744
|
+
...options?.headers
|
|
3745
|
+
}
|
|
3106
3746
|
});
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3747
|
+
/**
|
|
3748
|
+
* List accessible databases
|
|
3749
|
+
*
|
|
3750
|
+
* Returns databases in an organization that the authenticated user can access.
|
|
3751
|
+
*/
|
|
3752
|
+
const getV0ApiDatabases = (options) => (options.client ?? client).get({
|
|
3753
|
+
security: [{
|
|
3754
|
+
scheme: "basic",
|
|
3755
|
+
type: "http"
|
|
3756
|
+
}],
|
|
3757
|
+
url: "/v0/api/databases",
|
|
3758
|
+
...options
|
|
3111
3759
|
});
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
"
|
|
3120
|
-
"
|
|
3121
|
-
]
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3760
|
+
/**
|
|
3761
|
+
* Create a database
|
|
3762
|
+
*
|
|
3763
|
+
* Creates a new user database. The database is provisioned asynchronously — poll GET /databases/{databaseId} until the status leaves CREATING.
|
|
3764
|
+
*/
|
|
3765
|
+
const postV0ApiDatabases = (options) => (options?.client ?? client).post({
|
|
3766
|
+
security: [{
|
|
3767
|
+
scheme: "basic",
|
|
3768
|
+
type: "http"
|
|
3769
|
+
}],
|
|
3770
|
+
url: "/v0/api/databases",
|
|
3771
|
+
...options,
|
|
3772
|
+
headers: {
|
|
3773
|
+
"Content-Type": "application/json",
|
|
3774
|
+
...options?.headers
|
|
3775
|
+
}
|
|
3125
3776
|
});
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3777
|
+
/**
|
|
3778
|
+
* List organization domains
|
|
3779
|
+
*
|
|
3780
|
+
* Returns the apex domains for an organization, including verification status and linked project information.
|
|
3781
|
+
*/
|
|
3782
|
+
const getV0ApiDomains = (options) => (options.client ?? client).get({
|
|
3783
|
+
security: [{
|
|
3784
|
+
scheme: "basic",
|
|
3785
|
+
type: "http"
|
|
3786
|
+
}],
|
|
3787
|
+
url: "/v0/api/domains",
|
|
3788
|
+
...options
|
|
3131
3789
|
});
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3790
|
+
/**
|
|
3791
|
+
* Add a domain
|
|
3792
|
+
*
|
|
3793
|
+
* Adds a custom domain to an organization, optionally linked to a project group.
|
|
3794
|
+
*/
|
|
3795
|
+
const postV0ApiDomains = (options) => (options?.client ?? client).post({
|
|
3796
|
+
security: [{
|
|
3797
|
+
scheme: "basic",
|
|
3798
|
+
type: "http"
|
|
3799
|
+
}],
|
|
3800
|
+
url: "/v0/api/domains",
|
|
3801
|
+
...options,
|
|
3802
|
+
headers: {
|
|
3803
|
+
"Content-Type": "application/json",
|
|
3804
|
+
...options?.headers
|
|
3805
|
+
}
|
|
3136
3806
|
});
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3807
|
+
/**
|
|
3808
|
+
* Duplicate a project
|
|
3809
|
+
*
|
|
3810
|
+
* Duplicates an existing project group into the same organization and returns the new project group ID.
|
|
3811
|
+
*/
|
|
3812
|
+
const postV0ApiProjectsByProjectGroupIdDuplicate = (options) => (options.client ?? client).post({
|
|
3813
|
+
security: [{
|
|
3814
|
+
scheme: "basic",
|
|
3815
|
+
type: "http"
|
|
3816
|
+
}],
|
|
3817
|
+
url: "/v0/api/projects/{projectGroupId}/duplicate",
|
|
3818
|
+
...options,
|
|
3819
|
+
headers: {
|
|
3820
|
+
"Content-Type": "application/json",
|
|
3821
|
+
...options.headers
|
|
3822
|
+
}
|
|
3140
3823
|
});
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3824
|
+
/**
|
|
3825
|
+
* Delete a project
|
|
3826
|
+
*
|
|
3827
|
+
* Marks a project group for deletion and schedules permanent cleanup.
|
|
3828
|
+
*/
|
|
3829
|
+
const deleteV0ApiProjectsByProjectGroupId = (options) => (options.client ?? client).delete({
|
|
3830
|
+
security: [{
|
|
3831
|
+
scheme: "basic",
|
|
3832
|
+
type: "http"
|
|
3833
|
+
}],
|
|
3834
|
+
url: "/v0/api/projects/{projectGroupId}",
|
|
3835
|
+
...options
|
|
3149
3836
|
});
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3837
|
+
/**
|
|
3838
|
+
* Get project info
|
|
3839
|
+
*
|
|
3840
|
+
* Returns project group details including modules and dev server status.
|
|
3841
|
+
*/
|
|
3842
|
+
const getV0ApiProjectsByProjectGroupId = (options) => (options.client ?? client).get({
|
|
3843
|
+
security: [{
|
|
3844
|
+
scheme: "basic",
|
|
3845
|
+
type: "http"
|
|
3846
|
+
}],
|
|
3847
|
+
url: "/v0/api/projects/{projectGroupId}",
|
|
3848
|
+
...options
|
|
3153
3849
|
});
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3850
|
+
/**
|
|
3851
|
+
* Inspect auth provider configuration
|
|
3852
|
+
*
|
|
3853
|
+
* Returns the auth providers configured for a project group, including the secret metadata used by the Authentication settings UI.
|
|
3854
|
+
*/
|
|
3855
|
+
const getV0ApiProjectsByProjectGroupIdAuthProviders = (options) => (options.client ?? client).get({
|
|
3856
|
+
security: [{
|
|
3857
|
+
scheme: "basic",
|
|
3858
|
+
type: "http"
|
|
3859
|
+
}],
|
|
3860
|
+
url: "/v0/api/projects/{projectGroupId}/auth/providers",
|
|
3861
|
+
...options
|
|
3159
3862
|
});
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3863
|
+
/**
|
|
3864
|
+
* Rename a project group
|
|
3865
|
+
*
|
|
3866
|
+
* Renames a project group the authenticated user can access and returns the updated metadata.
|
|
3867
|
+
*/
|
|
3868
|
+
const postV0ApiProjectsByProjectGroupIdRename = (options) => (options.client ?? client).post({
|
|
3869
|
+
security: [{
|
|
3870
|
+
scheme: "basic",
|
|
3871
|
+
type: "http"
|
|
3872
|
+
}],
|
|
3873
|
+
url: "/v0/api/projects/{projectGroupId}/rename",
|
|
3874
|
+
...options,
|
|
3875
|
+
headers: {
|
|
3876
|
+
"Content-Type": "application/json",
|
|
3877
|
+
...options.headers
|
|
3878
|
+
}
|
|
3166
3879
|
});
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3880
|
+
/**
|
|
3881
|
+
* Request a change
|
|
3882
|
+
*
|
|
3883
|
+
* Sends a prompt to generate changes in an existing project. Optionally creates or continues a conversation thread.
|
|
3884
|
+
*/
|
|
3885
|
+
const postV0ApiProjectsByProjectGroupIdGenerate = (options) => (options.client ?? client).post({
|
|
3886
|
+
security: [{
|
|
3887
|
+
scheme: "basic",
|
|
3888
|
+
type: "http"
|
|
3889
|
+
}],
|
|
3890
|
+
url: "/v0/api/projects/{projectGroupId}/generate",
|
|
3891
|
+
...options,
|
|
3892
|
+
headers: {
|
|
3893
|
+
"Content-Type": "application/json",
|
|
3894
|
+
...options.headers
|
|
3895
|
+
}
|
|
3178
3896
|
});
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3897
|
+
/**
|
|
3898
|
+
* Read messages
|
|
3899
|
+
*
|
|
3900
|
+
* Returns chat messages for a project, optionally filtered by thread.
|
|
3901
|
+
*/
|
|
3902
|
+
const getV0ApiProjectsByProjectGroupIdMessages = (options) => (options.client ?? client).get({
|
|
3903
|
+
security: [{
|
|
3904
|
+
scheme: "basic",
|
|
3905
|
+
type: "http"
|
|
3906
|
+
}],
|
|
3907
|
+
url: "/v0/api/projects/{projectGroupId}/messages",
|
|
3908
|
+
...options
|
|
3189
3909
|
});
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3910
|
+
/**
|
|
3911
|
+
* Read project status
|
|
3912
|
+
*
|
|
3913
|
+
* Returns a small status document (latest revision status + deployment summary) for cheap polling. Avoids the message body payload.
|
|
3914
|
+
*/
|
|
3915
|
+
const getV0ApiProjectsByProjectGroupIdStatus = (options) => (options.client ?? client).get({
|
|
3916
|
+
security: [{
|
|
3917
|
+
scheme: "basic",
|
|
3918
|
+
type: "http"
|
|
3919
|
+
}],
|
|
3920
|
+
url: "/v0/api/projects/{projectGroupId}/status",
|
|
3921
|
+
...options
|
|
3196
3922
|
});
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3923
|
+
/**
|
|
3924
|
+
* Read project files
|
|
3925
|
+
*
|
|
3926
|
+
* Lists project files, or returns one file with content when `path` is provided.
|
|
3927
|
+
*/
|
|
3928
|
+
const getV0ApiProjectsByProjectGroupIdFiles = (options) => (options.client ?? client).get({
|
|
3929
|
+
security: [{
|
|
3930
|
+
scheme: "basic",
|
|
3931
|
+
type: "http"
|
|
3932
|
+
}],
|
|
3933
|
+
url: "/v0/api/projects/{projectGroupId}/files",
|
|
3934
|
+
...options
|
|
3205
3935
|
});
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
"
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
updatedAt: z.string(),
|
|
3219
|
-
pointInTimeRestoreEnabled: z.boolean()
|
|
3936
|
+
/**
|
|
3937
|
+
* Read recent development logs
|
|
3938
|
+
*
|
|
3939
|
+
* Returns recent development logs for a project, optionally filtered by level or message text.
|
|
3940
|
+
*/
|
|
3941
|
+
const getV0ApiProjectsByProjectGroupIdLogs = (options) => (options.client ?? client).get({
|
|
3942
|
+
security: [{
|
|
3943
|
+
scheme: "basic",
|
|
3944
|
+
type: "http"
|
|
3945
|
+
}],
|
|
3946
|
+
url: "/v0/api/projects/{projectGroupId}/logs",
|
|
3947
|
+
...options
|
|
3220
3948
|
});
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3949
|
+
/**
|
|
3950
|
+
* Read project auth settings
|
|
3951
|
+
*
|
|
3952
|
+
* Returns the current project auth provider state and whether each provider appears configured.
|
|
3953
|
+
*/
|
|
3954
|
+
const getV0ApiProjectsByProjectGroupIdSettingsAuth = (options) => (options.client ?? client).get({
|
|
3955
|
+
security: [{
|
|
3956
|
+
scheme: "basic",
|
|
3957
|
+
type: "http"
|
|
3958
|
+
}],
|
|
3959
|
+
url: "/v0/api/projects/{projectGroupId}/settings/auth",
|
|
3960
|
+
...options
|
|
3227
3961
|
});
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3962
|
+
/**
|
|
3963
|
+
* Update project auth settings
|
|
3964
|
+
*
|
|
3965
|
+
* Updates the enabled state for a project auth provider and optionally stores provider secrets.
|
|
3966
|
+
*/
|
|
3967
|
+
const postV0ApiProjectsByProjectGroupIdSettingsAuth = (options) => (options.client ?? client).post({
|
|
3968
|
+
security: [{
|
|
3969
|
+
scheme: "basic",
|
|
3970
|
+
type: "http"
|
|
3971
|
+
}],
|
|
3972
|
+
url: "/v0/api/projects/{projectGroupId}/settings/auth",
|
|
3973
|
+
...options,
|
|
3974
|
+
headers: {
|
|
3975
|
+
"Content-Type": "application/json",
|
|
3976
|
+
...options.headers
|
|
3977
|
+
}
|
|
3232
3978
|
});
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3979
|
+
/**
|
|
3980
|
+
* List secrets
|
|
3981
|
+
*
|
|
3982
|
+
* Returns the configured secrets for a project without exposing plaintext values.
|
|
3983
|
+
*/
|
|
3984
|
+
const getV0ApiProjectsByProjectGroupIdSecrets = (options) => (options.client ?? client).get({
|
|
3985
|
+
security: [{
|
|
3986
|
+
scheme: "basic",
|
|
3987
|
+
type: "http"
|
|
3988
|
+
}],
|
|
3989
|
+
url: "/v0/api/projects/{projectGroupId}/secrets",
|
|
3990
|
+
...options
|
|
3239
3991
|
});
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3992
|
+
/**
|
|
3993
|
+
* Add secrets
|
|
3994
|
+
*
|
|
3995
|
+
* Adds one or more secrets to a project. Send a single secret object or a bulk array.
|
|
3996
|
+
*/
|
|
3997
|
+
const postV0ApiProjectsByProjectGroupIdSecrets = (options) => (options.client ?? client).post({
|
|
3998
|
+
security: [{
|
|
3999
|
+
scheme: "basic",
|
|
4000
|
+
type: "http"
|
|
4001
|
+
}],
|
|
4002
|
+
url: "/v0/api/projects/{projectGroupId}/secrets",
|
|
4003
|
+
...options,
|
|
4004
|
+
headers: {
|
|
4005
|
+
"Content-Type": "application/json",
|
|
4006
|
+
...options.headers
|
|
4007
|
+
}
|
|
3252
4008
|
});
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
4009
|
+
/**
|
|
4010
|
+
* Delete a secret
|
|
4011
|
+
*
|
|
4012
|
+
* Removes a secret from the project.
|
|
4013
|
+
*/
|
|
4014
|
+
const deleteV0ApiProjectsByProjectGroupIdSecretsBySecretId = (options) => (options.client ?? client).delete({
|
|
4015
|
+
security: [{
|
|
4016
|
+
scheme: "basic",
|
|
4017
|
+
type: "http"
|
|
4018
|
+
}],
|
|
4019
|
+
url: "/v0/api/projects/{projectGroupId}/secrets/{secretId}",
|
|
4020
|
+
...options
|
|
3256
4021
|
});
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
4022
|
+
/**
|
|
4023
|
+
* Publish project
|
|
4024
|
+
*
|
|
4025
|
+
* Publishes the project, making it publicly accessible. Optionally claims a custom slug.
|
|
4026
|
+
*/
|
|
4027
|
+
const postV0ApiProjectsByProjectGroupIdPublish = (options) => (options.client ?? client).post({
|
|
4028
|
+
security: [{
|
|
4029
|
+
scheme: "basic",
|
|
4030
|
+
type: "http"
|
|
4031
|
+
}],
|
|
4032
|
+
url: "/v0/api/projects/{projectGroupId}/publish",
|
|
4033
|
+
...options,
|
|
4034
|
+
headers: {
|
|
4035
|
+
"Content-Type": "application/json",
|
|
4036
|
+
...options.headers
|
|
4037
|
+
}
|
|
3260
4038
|
});
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
4039
|
+
/**
|
|
4040
|
+
* Start an App Store submission
|
|
4041
|
+
*
|
|
4042
|
+
* Starts the Expo launch flow for an app store submission. Returns the session so clients can poll for launch URL readiness.
|
|
4043
|
+
*/
|
|
4044
|
+
const postV0ApiProjectsByProjectGroupIdSubmit = (options) => (options.client ?? client).post({
|
|
4045
|
+
security: [{
|
|
4046
|
+
scheme: "basic",
|
|
4047
|
+
type: "http"
|
|
4048
|
+
}],
|
|
4049
|
+
url: "/v0/api/projects/{projectGroupId}/submit",
|
|
4050
|
+
...options,
|
|
4051
|
+
headers: {
|
|
4052
|
+
"Content-Type": "application/json",
|
|
4053
|
+
...options.headers
|
|
4054
|
+
}
|
|
3268
4055
|
});
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
4056
|
+
/**
|
|
4057
|
+
* Read submission status
|
|
4058
|
+
*
|
|
4059
|
+
* Returns the current state of an Expo launch session for a project.
|
|
4060
|
+
*/
|
|
4061
|
+
const getV0ApiProjectsByProjectGroupIdSubmitBySubmissionId = (options) => (options.client ?? client).get({
|
|
4062
|
+
security: [{
|
|
4063
|
+
scheme: "basic",
|
|
4064
|
+
type: "http"
|
|
4065
|
+
}],
|
|
4066
|
+
url: "/v0/api/projects/{projectGroupId}/submit/{submissionId}",
|
|
4067
|
+
...options
|
|
3274
4068
|
});
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
})),
|
|
3288
|
-
pendingInvites: z.array(z.object({
|
|
3289
|
-
id: z.string(),
|
|
3290
|
-
toEmail: z.string(),
|
|
3291
|
-
expiresAt: z.string(),
|
|
3292
|
-
status: z.enum(["pending", "expired"])
|
|
3293
|
-
}))
|
|
4069
|
+
/**
|
|
4070
|
+
* Unpublish project
|
|
4071
|
+
*
|
|
4072
|
+
* Removes the published app for a project group without deleting the project group itself.
|
|
4073
|
+
*/
|
|
4074
|
+
const postV0ApiProjectsByProjectGroupIdUnpublish = (options) => (options.client ?? client).post({
|
|
4075
|
+
security: [{
|
|
4076
|
+
scheme: "basic",
|
|
4077
|
+
type: "http"
|
|
4078
|
+
}],
|
|
4079
|
+
url: "/v0/api/projects/{projectGroupId}/unpublish",
|
|
4080
|
+
...options
|
|
3294
4081
|
});
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
4082
|
+
/**
|
|
4083
|
+
* List assets
|
|
4084
|
+
*
|
|
4085
|
+
* Returns the image assets uploaded to a project group, optionally filtered by a search query and paginated.
|
|
4086
|
+
*/
|
|
4087
|
+
const getV0ApiProjectsByProjectGroupIdAssets = (options) => (options.client ?? client).get({
|
|
4088
|
+
security: [{
|
|
4089
|
+
scheme: "basic",
|
|
4090
|
+
type: "http"
|
|
4091
|
+
}],
|
|
4092
|
+
url: "/v0/api/projects/{projectGroupId}/assets",
|
|
4093
|
+
...options
|
|
3301
4094
|
});
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
4095
|
+
/**
|
|
4096
|
+
* Upload an asset
|
|
4097
|
+
*
|
|
4098
|
+
* Uploads an image asset to a project group. Send the file as multipart/form-data under the `file` field, with an optional display `name`.
|
|
4099
|
+
*/
|
|
4100
|
+
const postV0ApiProjectsByProjectGroupIdAssets = (options) => (options.client ?? client).post({
|
|
4101
|
+
...formDataBodySerializer,
|
|
4102
|
+
security: [{
|
|
4103
|
+
scheme: "basic",
|
|
4104
|
+
type: "http"
|
|
4105
|
+
}],
|
|
4106
|
+
url: "/v0/api/projects/{projectGroupId}/assets",
|
|
4107
|
+
...options,
|
|
4108
|
+
headers: {
|
|
4109
|
+
"Content-Type": null,
|
|
4110
|
+
...options.headers
|
|
4111
|
+
}
|
|
3306
4112
|
});
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
4113
|
+
/**
|
|
4114
|
+
* Delete an asset
|
|
4115
|
+
*
|
|
4116
|
+
* Removes an asset from a project group.
|
|
4117
|
+
*/
|
|
4118
|
+
const deleteV0ApiProjectsByProjectGroupIdAssetsByAssetId = (options) => (options.client ?? client).delete({
|
|
4119
|
+
security: [{
|
|
4120
|
+
scheme: "basic",
|
|
4121
|
+
type: "http"
|
|
4122
|
+
}],
|
|
4123
|
+
url: "/v0/api/projects/{projectGroupId}/assets/{assetId}",
|
|
4124
|
+
...options
|
|
3310
4125
|
});
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
4126
|
+
/**
|
|
4127
|
+
* Get a single database
|
|
4128
|
+
*
|
|
4129
|
+
* Returns details for a specific user database.
|
|
4130
|
+
*/
|
|
4131
|
+
const getV0ApiDatabasesByDatabaseId = (options) => (options.client ?? client).get({
|
|
4132
|
+
security: [{
|
|
4133
|
+
scheme: "basic",
|
|
4134
|
+
type: "http"
|
|
4135
|
+
}],
|
|
4136
|
+
url: "/v0/api/databases/{databaseId}",
|
|
4137
|
+
...options
|
|
3317
4138
|
});
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
4139
|
+
/**
|
|
4140
|
+
* Query a database
|
|
4141
|
+
*
|
|
4142
|
+
* Executes a read-only SQL query against the database. Only SELECT, WITH, EXPLAIN, and SHOW statements are allowed.
|
|
4143
|
+
*/
|
|
4144
|
+
const postV0ApiDatabasesByDatabaseIdQuery = (options) => (options.client ?? client).post({
|
|
4145
|
+
security: [{
|
|
4146
|
+
scheme: "basic",
|
|
4147
|
+
type: "http"
|
|
4148
|
+
}],
|
|
4149
|
+
url: "/v0/api/databases/{databaseId}/query",
|
|
4150
|
+
...options,
|
|
4151
|
+
headers: {
|
|
4152
|
+
"Content-Type": "application/json",
|
|
4153
|
+
...options.headers
|
|
4154
|
+
}
|
|
3322
4155
|
});
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
4156
|
+
/**
|
|
4157
|
+
* Get database connection string
|
|
4158
|
+
*
|
|
4159
|
+
* Returns the connection string for a user database.
|
|
4160
|
+
*/
|
|
4161
|
+
const getV0ApiDatabasesByDatabaseIdConnection = (options) => (options.client ?? client).get({
|
|
4162
|
+
security: [{
|
|
4163
|
+
scheme: "basic",
|
|
4164
|
+
type: "http"
|
|
4165
|
+
}],
|
|
4166
|
+
url: "/v0/api/databases/{databaseId}/connection",
|
|
4167
|
+
...options
|
|
3329
4168
|
});
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
4169
|
+
/**
|
|
4170
|
+
* Reset development database
|
|
4171
|
+
*
|
|
4172
|
+
* Resets the development branch of a user database.
|
|
4173
|
+
*/
|
|
4174
|
+
const postV0ApiDatabasesByDatabaseIdReset = (options) => (options.client ?? client).post({
|
|
4175
|
+
security: [{
|
|
4176
|
+
scheme: "basic",
|
|
4177
|
+
type: "http"
|
|
4178
|
+
}],
|
|
4179
|
+
url: "/v0/api/databases/{databaseId}/reset",
|
|
4180
|
+
...options
|
|
3336
4181
|
});
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
4182
|
+
/**
|
|
4183
|
+
* Remove a domain
|
|
4184
|
+
*
|
|
4185
|
+
* Removes a custom domain.
|
|
4186
|
+
*/
|
|
4187
|
+
const deleteV0ApiDomainsByDomainId = (options) => (options.client ?? client).delete({
|
|
4188
|
+
security: [{
|
|
4189
|
+
scheme: "basic",
|
|
4190
|
+
type: "http"
|
|
4191
|
+
}],
|
|
4192
|
+
url: "/v0/api/domains/{domainId}",
|
|
4193
|
+
...options
|
|
3344
4194
|
});
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
4195
|
+
/**
|
|
4196
|
+
* Verify a domain
|
|
4197
|
+
*
|
|
4198
|
+
* Triggers verification for a custom domain.
|
|
4199
|
+
*/
|
|
4200
|
+
const postV0ApiDomainsByDomainIdVerify = (options) => (options.client ?? client).post({
|
|
4201
|
+
security: [{
|
|
4202
|
+
scheme: "basic",
|
|
4203
|
+
type: "http"
|
|
4204
|
+
}],
|
|
4205
|
+
url: "/v0/api/domains/{domainId}/verify",
|
|
4206
|
+
...options
|
|
3349
4207
|
});
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
4208
|
+
/**
|
|
4209
|
+
* List project deployments
|
|
4210
|
+
*
|
|
4211
|
+
* Returns recent deployments for a project group, ordered by creation time descending.
|
|
4212
|
+
*/
|
|
4213
|
+
const getV0ApiProjectsByProjectGroupIdDeployments = (options) => (options.client ?? client).get({
|
|
4214
|
+
security: [{
|
|
4215
|
+
scheme: "basic",
|
|
4216
|
+
type: "http"
|
|
4217
|
+
}],
|
|
4218
|
+
url: "/v0/api/projects/{projectGroupId}/deployments",
|
|
4219
|
+
...options
|
|
4220
|
+
});
|
|
4221
|
+
/**
|
|
4222
|
+
* Get deployment status
|
|
4223
|
+
*
|
|
4224
|
+
* Returns the current state of a deployment, including build logs if available.
|
|
4225
|
+
*/
|
|
4226
|
+
const getV0ApiDeploymentsByDeploymentId = (options) => (options.client ?? client).get({
|
|
4227
|
+
security: [{
|
|
4228
|
+
scheme: "basic",
|
|
4229
|
+
type: "http"
|
|
4230
|
+
}],
|
|
4231
|
+
url: "/v0/api/deployments/{deploymentId}",
|
|
4232
|
+
...options
|
|
4233
|
+
});
|
|
4234
|
+
/**
|
|
4235
|
+
* Get deployment logs
|
|
4236
|
+
*
|
|
4237
|
+
* Returns the build logs for a specific deployment.
|
|
4238
|
+
*/
|
|
4239
|
+
const getV0ApiDeploymentsByDeploymentIdLogs = (options) => (options.client ?? client).get({
|
|
4240
|
+
security: [{
|
|
4241
|
+
scheme: "basic",
|
|
4242
|
+
type: "http"
|
|
4243
|
+
}],
|
|
4244
|
+
url: "/v0/api/deployments/{deploymentId}/logs",
|
|
4245
|
+
...options
|
|
3355
4246
|
});
|
|
4247
|
+
/**
|
|
4248
|
+
* Rollback a deployment
|
|
4249
|
+
*
|
|
4250
|
+
* Deployment rollback is not yet implemented.
|
|
4251
|
+
*/
|
|
4252
|
+
const postV0ApiProjectsByProjectGroupIdDeploymentsRollback = (options) => (options.client ?? client).post({
|
|
4253
|
+
security: [{
|
|
4254
|
+
scheme: "basic",
|
|
4255
|
+
type: "http"
|
|
4256
|
+
}],
|
|
4257
|
+
url: "/v0/api/projects/{projectGroupId}/deployments/rollback",
|
|
4258
|
+
...options
|
|
4259
|
+
});
|
|
4260
|
+
/**
|
|
4261
|
+
* Invite a member
|
|
4262
|
+
*
|
|
4263
|
+
* Sends an invitation to join the organization. Requires OWNER or ADMIN role.
|
|
4264
|
+
*/
|
|
4265
|
+
const postV0ApiOrganizationsByOrganizationIdInvites = (options) => (options.client ?? client).post({
|
|
4266
|
+
security: [{
|
|
4267
|
+
scheme: "basic",
|
|
4268
|
+
type: "http"
|
|
4269
|
+
}],
|
|
4270
|
+
url: "/v0/api/organizations/{organizationId}/invites",
|
|
4271
|
+
...options,
|
|
4272
|
+
headers: {
|
|
4273
|
+
"Content-Type": "application/json",
|
|
4274
|
+
...options.headers
|
|
4275
|
+
}
|
|
4276
|
+
});
|
|
4277
|
+
/**
|
|
4278
|
+
* Remove a member
|
|
4279
|
+
*
|
|
4280
|
+
* Removes a member from the organization. Requires OWNER or ADMIN role.
|
|
4281
|
+
*/
|
|
4282
|
+
const postV0ApiOrganizationsByOrganizationIdMembersRemove = (options) => (options.client ?? client).post({
|
|
4283
|
+
security: [{
|
|
4284
|
+
scheme: "basic",
|
|
4285
|
+
type: "http"
|
|
4286
|
+
}],
|
|
4287
|
+
url: "/v0/api/organizations/{organizationId}/members/remove",
|
|
4288
|
+
...options,
|
|
4289
|
+
headers: {
|
|
4290
|
+
"Content-Type": "application/json",
|
|
4291
|
+
...options.headers
|
|
4292
|
+
}
|
|
4293
|
+
});
|
|
4294
|
+
/**
|
|
4295
|
+
* Update member role
|
|
4296
|
+
*
|
|
4297
|
+
* Changes the role of an organization member. Requires OWNER or ADMIN role.
|
|
4298
|
+
*/
|
|
4299
|
+
const postV0ApiOrganizationsByOrganizationIdMembersRole = (options) => (options.client ?? client).post({
|
|
4300
|
+
security: [{
|
|
4301
|
+
scheme: "basic",
|
|
4302
|
+
type: "http"
|
|
4303
|
+
}],
|
|
4304
|
+
url: "/v0/api/organizations/{organizationId}/members/role",
|
|
4305
|
+
...options,
|
|
4306
|
+
headers: {
|
|
4307
|
+
"Content-Type": "application/json",
|
|
4308
|
+
...options.headers
|
|
4309
|
+
}
|
|
4310
|
+
});
|
|
4311
|
+
|
|
4312
|
+
//#endregion
|
|
4313
|
+
//#region src/api-client.ts
|
|
4314
|
+
const USER_AGENT = `anything-cli/${version}`;
|
|
4315
|
+
const ErrorWithMessageSchema = z.object({ message: z.string().min(1) });
|
|
4316
|
+
const ErrorWithErrorStringSchema = z.object({ error: z.string().min(1) });
|
|
4317
|
+
const ErrorWithNestedMessageSchema = z.object({ error: z.object({ message: z.string() }) });
|
|
4318
|
+
function extractErrorMessage(status, details) {
|
|
4319
|
+
const withMessage = ErrorWithMessageSchema.safeParse(details);
|
|
4320
|
+
if (withMessage.success) return withMessage.data.message;
|
|
4321
|
+
const withErrorString = ErrorWithErrorStringSchema.safeParse(details);
|
|
4322
|
+
if (withErrorString.success) return withErrorString.data.error;
|
|
4323
|
+
const withNested = ErrorWithNestedMessageSchema.safeParse(details);
|
|
4324
|
+
if (withNested.success) return withNested.data.error.message;
|
|
4325
|
+
if (typeof details === "string" && details.length > 0) return details;
|
|
4326
|
+
return `API error (${status})`;
|
|
4327
|
+
}
|
|
4328
|
+
function parseRetryAfter(response) {
|
|
4329
|
+
if (response.status !== 429) return null;
|
|
4330
|
+
const header = response.headers.get("retry-after");
|
|
4331
|
+
if (!header) return null;
|
|
4332
|
+
const seconds = Number(header);
|
|
4333
|
+
if (Number.isFinite(seconds)) return seconds >= 0 ? Math.ceil(seconds) : null;
|
|
4334
|
+
const dateMs = Date.parse(header);
|
|
4335
|
+
if (!Number.isNaN(dateMs)) {
|
|
4336
|
+
const delta = Math.ceil((dateMs - Date.now()) / 1e3);
|
|
4337
|
+
return delta > 0 ? delta : 0;
|
|
4338
|
+
}
|
|
4339
|
+
return null;
|
|
4340
|
+
}
|
|
4341
|
+
function buildAuthHeader$1(apiKey) {
|
|
4342
|
+
return apiKey.startsWith("anything_") || apiKey.startsWith("create_") ? `Basic ${Buffer.from(`${apiKey}:`).toString("base64")}` : apiKey;
|
|
4343
|
+
}
|
|
4344
|
+
function toSecretEnvironment(value) {
|
|
4345
|
+
switch (value.toUpperCase()) {
|
|
4346
|
+
case "DEVELOPMENT": return "DEVELOPMENT";
|
|
4347
|
+
case "PREVIEW": return "PREVIEW";
|
|
4348
|
+
case "PRODUCTION": return "PRODUCTION";
|
|
4349
|
+
default: return null;
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
function toMemberRole(value) {
|
|
4353
|
+
switch (value.toUpperCase()) {
|
|
4354
|
+
case "OWNER": return "OWNER";
|
|
4355
|
+
case "ADMIN": return "ADMIN";
|
|
4356
|
+
case "EDITOR": return "EDITOR";
|
|
4357
|
+
case "VIEWER": return "VIEWER";
|
|
4358
|
+
default: return null;
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
3356
4361
|
const RollbackResponseSchema = z.object({
|
|
3357
4362
|
success: z.boolean(),
|
|
3358
|
-
deployment:
|
|
3359
|
-
});
|
|
3360
|
-
const InviteMemberResponseSchema = z.object({
|
|
3361
|
-
success: z.boolean(),
|
|
3362
|
-
invite: z.object({
|
|
4363
|
+
deployment: z.object({
|
|
3363
4364
|
id: z.string(),
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
})
|
|
3367
|
-
});
|
|
3368
|
-
const RemoveMemberResponseSchema = z.object({ success: z.boolean() });
|
|
3369
|
-
const UpdateMemberRoleResponseSchema = z.object({
|
|
3370
|
-
success: z.boolean(),
|
|
3371
|
-
userId: z.string(),
|
|
3372
|
-
role: z.string()
|
|
4365
|
+
status: z.string()
|
|
4366
|
+
}).optional()
|
|
3373
4367
|
});
|
|
3374
4368
|
var AnythingApiClient = class {
|
|
3375
|
-
|
|
3376
|
-
authHeader;
|
|
4369
|
+
client;
|
|
3377
4370
|
constructor(config) {
|
|
3378
|
-
this.
|
|
3379
|
-
|
|
4371
|
+
this.client = createClient$1(createConfig({
|
|
4372
|
+
baseUrl: config.apiUrl.replace(/\/$/, ""),
|
|
4373
|
+
headers: {
|
|
4374
|
+
authorization: buildAuthHeader$1(config.apiKey),
|
|
4375
|
+
"user-agent": USER_AGENT
|
|
4376
|
+
}
|
|
4377
|
+
}));
|
|
3380
4378
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
4379
|
+
toResult(result) {
|
|
4380
|
+
const { data, error, response } = result;
|
|
4381
|
+
if (!response) return err({
|
|
4382
|
+
message: `Network error: ${error instanceof Error ? error.message : String(error)}`,
|
|
4383
|
+
status: null
|
|
4384
|
+
});
|
|
4385
|
+
if (!response.ok) {
|
|
4386
|
+
const retryAfter = parseRetryAfter(response);
|
|
4387
|
+
return err({
|
|
4388
|
+
message: extractErrorMessage(response.status, error),
|
|
4389
|
+
status: response.status,
|
|
4390
|
+
details: error,
|
|
4391
|
+
...retryAfter !== null ? { retryAfter } : {}
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
if (data === void 0) return err({
|
|
4395
|
+
message: "Unexpected API response format",
|
|
4396
|
+
status: response.status
|
|
3386
4397
|
});
|
|
4398
|
+
return ok(data);
|
|
4399
|
+
}
|
|
4400
|
+
async getMe() {
|
|
4401
|
+
return this.toResult(await getV0ApiMe({ client: this.client }));
|
|
3387
4402
|
}
|
|
3388
4403
|
async getOrganizationMembers({ organizationId }) {
|
|
3389
|
-
return this.
|
|
3390
|
-
|
|
3391
|
-
path:
|
|
3392
|
-
|
|
3393
|
-
});
|
|
4404
|
+
return this.toResult(await getV0ApiOrganizationsByOrganizationIdMembers({
|
|
4405
|
+
client: this.client,
|
|
4406
|
+
path: { organizationId }
|
|
4407
|
+
}));
|
|
3394
4408
|
}
|
|
3395
4409
|
async createProject({ prompt, organizationId, name }) {
|
|
3396
|
-
return this.
|
|
3397
|
-
|
|
3398
|
-
path: "/projects",
|
|
4410
|
+
return this.toResult(await postV0ApiProjects({
|
|
4411
|
+
client: this.client,
|
|
3399
4412
|
body: {
|
|
3400
4413
|
prompt,
|
|
3401
4414
|
organizationId,
|
|
3402
4415
|
...name !== null ? { name } : {}
|
|
3403
|
-
}
|
|
3404
|
-
|
|
3405
|
-
});
|
|
4416
|
+
}
|
|
4417
|
+
}));
|
|
3406
4418
|
}
|
|
3407
4419
|
async duplicateProjectGroup({ projectGroupId, name }) {
|
|
3408
|
-
return this.
|
|
3409
|
-
|
|
3410
|
-
path:
|
|
3411
|
-
body: name !== null ? { name } : {}
|
|
3412
|
-
|
|
3413
|
-
});
|
|
4420
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdDuplicate({
|
|
4421
|
+
client: this.client,
|
|
4422
|
+
path: { projectGroupId },
|
|
4423
|
+
body: name !== null ? { name } : {}
|
|
4424
|
+
}));
|
|
3414
4425
|
}
|
|
3415
4426
|
async listProjects({ organizationId, query, limit }) {
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
});
|
|
4427
|
+
return this.toResult(await getV0ApiProjects({
|
|
4428
|
+
client: this.client,
|
|
4429
|
+
query: {
|
|
4430
|
+
...organizationId !== null ? { organizationId } : {},
|
|
4431
|
+
...query !== null ? { query } : {},
|
|
4432
|
+
limit
|
|
4433
|
+
}
|
|
4434
|
+
}));
|
|
3425
4435
|
}
|
|
3426
4436
|
async listDatabases({ organizationId, limit }) {
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
});
|
|
4437
|
+
return this.toResult(await getV0ApiDatabases({
|
|
4438
|
+
client: this.client,
|
|
4439
|
+
query: {
|
|
4440
|
+
organizationId,
|
|
4441
|
+
limit
|
|
4442
|
+
}
|
|
4443
|
+
}));
|
|
3435
4444
|
}
|
|
3436
4445
|
async generate({ projectGroupId, prompt, threadId, createNewThread }) {
|
|
3437
|
-
return this.
|
|
3438
|
-
|
|
3439
|
-
path:
|
|
4446
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdGenerate({
|
|
4447
|
+
client: this.client,
|
|
4448
|
+
path: { projectGroupId },
|
|
3440
4449
|
body: {
|
|
3441
4450
|
prompt,
|
|
3442
4451
|
...threadId !== null ? { threadId } : {},
|
|
3443
4452
|
...createNewThread ? { createNewThread: true } : {}
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
});
|
|
4453
|
+
}
|
|
4454
|
+
}));
|
|
3447
4455
|
}
|
|
3448
4456
|
async getMessages({ projectGroupId, threadId, limit }) {
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
schema: MessagesResponseSchema
|
|
3458
|
-
});
|
|
4457
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdMessages({
|
|
4458
|
+
client: this.client,
|
|
4459
|
+
path: { projectGroupId },
|
|
4460
|
+
query: {
|
|
4461
|
+
...threadId !== null ? { threadId } : {},
|
|
4462
|
+
...limit !== null ? { limit } : {}
|
|
4463
|
+
}
|
|
4464
|
+
}));
|
|
3459
4465
|
}
|
|
3460
4466
|
async getProjectLogs({ projectGroupId, level, search, limit }) {
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
schema: ProjectLogsResponseSchema
|
|
3471
|
-
});
|
|
4467
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdLogs({
|
|
4468
|
+
client: this.client,
|
|
4469
|
+
path: { projectGroupId },
|
|
4470
|
+
query: {
|
|
4471
|
+
...level !== null ? { level } : {},
|
|
4472
|
+
...search !== null ? { search } : {},
|
|
4473
|
+
...limit !== null ? { limit } : {}
|
|
4474
|
+
}
|
|
4475
|
+
}));
|
|
3472
4476
|
}
|
|
3473
4477
|
async getProjectAuthProviders({ projectGroupId }) {
|
|
3474
|
-
return this.
|
|
3475
|
-
|
|
3476
|
-
path:
|
|
3477
|
-
|
|
3478
|
-
});
|
|
4478
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdAuthProviders({
|
|
4479
|
+
client: this.client,
|
|
4480
|
+
path: { projectGroupId }
|
|
4481
|
+
}));
|
|
3479
4482
|
}
|
|
3480
4483
|
async getProjectAuthSettings({ projectGroupId }) {
|
|
3481
|
-
return this.
|
|
3482
|
-
|
|
3483
|
-
path:
|
|
3484
|
-
|
|
3485
|
-
});
|
|
4484
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdSettingsAuth({
|
|
4485
|
+
client: this.client,
|
|
4486
|
+
path: { projectGroupId }
|
|
4487
|
+
}));
|
|
3486
4488
|
}
|
|
3487
4489
|
async updateProjectAuthSettings({ projectGroupId, provider, enabled, secrets, enableForAllModules }) {
|
|
3488
|
-
return this.
|
|
3489
|
-
|
|
3490
|
-
path:
|
|
4490
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdSettingsAuth({
|
|
4491
|
+
client: this.client,
|
|
4492
|
+
path: { projectGroupId },
|
|
3491
4493
|
body: {
|
|
3492
4494
|
provider,
|
|
3493
4495
|
enabled,
|
|
3494
4496
|
...secrets.length > 0 ? { secrets } : {},
|
|
3495
4497
|
...enableForAllModules ? { enableForAllModules } : {}
|
|
3496
|
-
}
|
|
3497
|
-
|
|
3498
|
-
});
|
|
4498
|
+
}
|
|
4499
|
+
}));
|
|
3499
4500
|
}
|
|
3500
4501
|
async getProject({ projectGroupId }) {
|
|
3501
|
-
return this.
|
|
3502
|
-
|
|
3503
|
-
path:
|
|
3504
|
-
|
|
3505
|
-
});
|
|
4502
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupId({
|
|
4503
|
+
client: this.client,
|
|
4504
|
+
path: { projectGroupId }
|
|
4505
|
+
}));
|
|
3506
4506
|
}
|
|
3507
4507
|
async getProjectStatus({ projectGroupId }) {
|
|
3508
|
-
return this.
|
|
3509
|
-
|
|
3510
|
-
path:
|
|
3511
|
-
|
|
3512
|
-
});
|
|
4508
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdStatus({
|
|
4509
|
+
client: this.client,
|
|
4510
|
+
path: { projectGroupId }
|
|
4511
|
+
}));
|
|
3513
4512
|
}
|
|
3514
4513
|
async renameProjectGroup({ projectGroupId, name }) {
|
|
3515
|
-
return this.
|
|
3516
|
-
|
|
3517
|
-
path:
|
|
3518
|
-
body: { name }
|
|
3519
|
-
|
|
3520
|
-
});
|
|
4514
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdRename({
|
|
4515
|
+
client: this.client,
|
|
4516
|
+
path: { projectGroupId },
|
|
4517
|
+
body: { name }
|
|
4518
|
+
}));
|
|
3521
4519
|
}
|
|
3522
4520
|
async listProjectFiles({ projectGroupId }) {
|
|
3523
|
-
return this.
|
|
3524
|
-
|
|
3525
|
-
path:
|
|
3526
|
-
|
|
3527
|
-
|
|
4521
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdFiles({
|
|
4522
|
+
client: this.client,
|
|
4523
|
+
path: { projectGroupId }
|
|
4524
|
+
})).andThen((data) => "files" in data ? ok(data) : err({
|
|
4525
|
+
message: "Unexpected API response format",
|
|
4526
|
+
status: 200
|
|
4527
|
+
}));
|
|
3528
4528
|
}
|
|
3529
4529
|
async getProjectFile({ projectGroupId, path }) {
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
4530
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdFiles({
|
|
4531
|
+
client: this.client,
|
|
4532
|
+
path: { projectGroupId },
|
|
4533
|
+
query: { path }
|
|
4534
|
+
})).andThen((data) => "file" in data ? ok(data) : err({
|
|
4535
|
+
message: "Unexpected API response format",
|
|
4536
|
+
status: 200
|
|
4537
|
+
}));
|
|
3536
4538
|
}
|
|
3537
4539
|
async addSecret({ projectGroupId, displayName, value, environment }) {
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
4540
|
+
let environmentValue;
|
|
4541
|
+
if (environment !== null) {
|
|
4542
|
+
const normalized = toSecretEnvironment(environment);
|
|
4543
|
+
if (normalized === null) return err({
|
|
4544
|
+
message: `Invalid environment: ${environment}. Expected one of development, preview, production.`,
|
|
4545
|
+
status: 400
|
|
4546
|
+
});
|
|
4547
|
+
environmentValue = normalized;
|
|
4548
|
+
}
|
|
4549
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdSecrets({
|
|
4550
|
+
client: this.client,
|
|
4551
|
+
path: { projectGroupId },
|
|
3541
4552
|
body: {
|
|
3542
4553
|
displayName,
|
|
3543
4554
|
value,
|
|
3544
|
-
...
|
|
3545
|
-
}
|
|
3546
|
-
|
|
3547
|
-
|
|
4555
|
+
...environmentValue !== void 0 ? { environment: environmentValue } : {}
|
|
4556
|
+
}
|
|
4557
|
+
})).andThen((data) => "secret" in data ? ok(data) : err({
|
|
4558
|
+
message: "Unexpected API response format",
|
|
4559
|
+
status: 201
|
|
4560
|
+
}));
|
|
3548
4561
|
}
|
|
3549
4562
|
async listSecrets({ projectGroupId }) {
|
|
3550
|
-
return this.
|
|
3551
|
-
|
|
3552
|
-
path:
|
|
3553
|
-
|
|
3554
|
-
});
|
|
4563
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdSecrets({
|
|
4564
|
+
client: this.client,
|
|
4565
|
+
path: { projectGroupId }
|
|
4566
|
+
}));
|
|
3555
4567
|
}
|
|
3556
4568
|
async deleteSecret({ projectGroupId, secretId }) {
|
|
3557
|
-
return this.
|
|
3558
|
-
|
|
3559
|
-
path:
|
|
3560
|
-
|
|
4569
|
+
return this.toResult(await deleteV0ApiProjectsByProjectGroupIdSecretsBySecretId({
|
|
4570
|
+
client: this.client,
|
|
4571
|
+
path: {
|
|
4572
|
+
projectGroupId,
|
|
4573
|
+
secretId
|
|
4574
|
+
}
|
|
4575
|
+
}));
|
|
3561
4576
|
}
|
|
3562
4577
|
async publish({ projectGroupId, slug }) {
|
|
3563
|
-
return this.
|
|
3564
|
-
|
|
3565
|
-
path:
|
|
3566
|
-
body: slug !== null ? { slug } : {}
|
|
3567
|
-
|
|
3568
|
-
});
|
|
4578
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdPublish({
|
|
4579
|
+
client: this.client,
|
|
4580
|
+
path: { projectGroupId },
|
|
4581
|
+
body: slug !== null ? { slug } : {}
|
|
4582
|
+
}));
|
|
3569
4583
|
}
|
|
3570
4584
|
async submitProject({ projectGroupId, store }) {
|
|
3571
|
-
return this.
|
|
3572
|
-
|
|
3573
|
-
path:
|
|
3574
|
-
body: { store }
|
|
3575
|
-
|
|
3576
|
-
});
|
|
4585
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdSubmit({
|
|
4586
|
+
client: this.client,
|
|
4587
|
+
path: { projectGroupId },
|
|
4588
|
+
body: { store }
|
|
4589
|
+
}));
|
|
3577
4590
|
}
|
|
3578
4591
|
async getProjectSubmission({ projectGroupId, submissionId }) {
|
|
3579
|
-
return this.
|
|
3580
|
-
|
|
3581
|
-
path:
|
|
3582
|
-
|
|
3583
|
-
|
|
4592
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdSubmitBySubmissionId({
|
|
4593
|
+
client: this.client,
|
|
4594
|
+
path: {
|
|
4595
|
+
projectGroupId,
|
|
4596
|
+
submissionId
|
|
4597
|
+
}
|
|
4598
|
+
}));
|
|
3584
4599
|
}
|
|
3585
4600
|
async unpublish({ projectGroupId }) {
|
|
3586
|
-
return this.
|
|
3587
|
-
|
|
3588
|
-
path:
|
|
3589
|
-
|
|
3590
|
-
|
|
4601
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdUnpublish({
|
|
4602
|
+
client: this.client,
|
|
4603
|
+
path: { projectGroupId }
|
|
4604
|
+
}));
|
|
4605
|
+
}
|
|
4606
|
+
async deleteProject({ projectGroupId }) {
|
|
4607
|
+
return this.toResult(await deleteV0ApiProjectsByProjectGroupId({
|
|
4608
|
+
client: this.client,
|
|
4609
|
+
path: { projectGroupId }
|
|
4610
|
+
}));
|
|
3591
4611
|
}
|
|
3592
4612
|
async uploadAsset({ projectGroupId, filePath, name }) {
|
|
3593
|
-
const url = `${this.baseUrl}/projects/${projectGroupId}/assets`;
|
|
3594
4613
|
let fileBuffer;
|
|
3595
4614
|
try {
|
|
3596
4615
|
const { readFileSync } = await import("node:fs");
|
|
@@ -3601,250 +4620,161 @@ var AnythingApiClient = class {
|
|
|
3601
4620
|
status: null
|
|
3602
4621
|
});
|
|
3603
4622
|
}
|
|
3604
|
-
const
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
method: "POST",
|
|
3612
|
-
headers: {
|
|
3613
|
-
authorization: this.authHeader,
|
|
3614
|
-
"user-agent": USER_AGENT
|
|
3615
|
-
},
|
|
3616
|
-
body: formData
|
|
3617
|
-
});
|
|
3618
|
-
} catch (cause) {
|
|
3619
|
-
return err({
|
|
3620
|
-
message: `Network error: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
3621
|
-
status: null
|
|
3622
|
-
});
|
|
3623
|
-
}
|
|
3624
|
-
if (!response.ok) {
|
|
3625
|
-
const text = await response.text().catch(() => "");
|
|
3626
|
-
let details;
|
|
3627
|
-
try {
|
|
3628
|
-
details = JSON.parse(text);
|
|
3629
|
-
} catch {
|
|
3630
|
-
details = text || void 0;
|
|
4623
|
+
const file = new File([new Uint8Array(fileBuffer)], basename(filePath));
|
|
4624
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdAssets({
|
|
4625
|
+
client: this.client,
|
|
4626
|
+
path: { projectGroupId },
|
|
4627
|
+
body: {
|
|
4628
|
+
file,
|
|
4629
|
+
...name !== null ? { name } : {}
|
|
3631
4630
|
}
|
|
3632
|
-
|
|
3633
|
-
return err({
|
|
3634
|
-
message: `API error (${response.status})`,
|
|
3635
|
-
status: response.status,
|
|
3636
|
-
details,
|
|
3637
|
-
...retryAfter !== null ? { retryAfter } : {}
|
|
3638
|
-
});
|
|
3639
|
-
}
|
|
3640
|
-
const json = await response.json();
|
|
3641
|
-
const parsed = UploadAssetResponseSchema.safeParse(json);
|
|
3642
|
-
if (!parsed.success) return err({
|
|
3643
|
-
message: "Unexpected API response format",
|
|
3644
|
-
status: response.status,
|
|
3645
|
-
details: parsed.error.errors
|
|
3646
|
-
});
|
|
3647
|
-
return ok(parsed.data);
|
|
4631
|
+
}));
|
|
3648
4632
|
}
|
|
3649
4633
|
async listAssets({ projectGroupId, query, limit, offset }) {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
schema: ListAssetsResponseSchema
|
|
3660
|
-
});
|
|
3661
|
-
}
|
|
3662
|
-
async listDomains({ organizationId }) {
|
|
3663
|
-
const params = new URLSearchParams({ organizationId });
|
|
3664
|
-
return this.request({
|
|
3665
|
-
method: "GET",
|
|
3666
|
-
path: `/domains?${params.toString()}`,
|
|
3667
|
-
schema: ListDomainsResponseSchema
|
|
3668
|
-
});
|
|
4634
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdAssets({
|
|
4635
|
+
client: this.client,
|
|
4636
|
+
path: { projectGroupId },
|
|
4637
|
+
query: {
|
|
4638
|
+
...query !== null ? { query } : {},
|
|
4639
|
+
...limit !== null ? { limit } : {},
|
|
4640
|
+
...offset !== null ? { offset } : {}
|
|
4641
|
+
}
|
|
4642
|
+
}));
|
|
3669
4643
|
}
|
|
3670
4644
|
async deleteAsset({ projectGroupId, assetId }) {
|
|
3671
|
-
return this.
|
|
3672
|
-
|
|
3673
|
-
path:
|
|
3674
|
-
|
|
4645
|
+
return this.toResult(await deleteV0ApiProjectsByProjectGroupIdAssetsByAssetId({
|
|
4646
|
+
client: this.client,
|
|
4647
|
+
path: {
|
|
4648
|
+
projectGroupId,
|
|
4649
|
+
assetId
|
|
4650
|
+
}
|
|
4651
|
+
}));
|
|
4652
|
+
}
|
|
4653
|
+
async listDomains({ organizationId }) {
|
|
4654
|
+
return this.toResult(await getV0ApiDomains({
|
|
4655
|
+
client: this.client,
|
|
4656
|
+
query: { organizationId }
|
|
4657
|
+
}));
|
|
3675
4658
|
}
|
|
3676
4659
|
async getDatabase({ databaseId }) {
|
|
3677
|
-
return this.
|
|
3678
|
-
|
|
3679
|
-
path:
|
|
3680
|
-
|
|
3681
|
-
});
|
|
4660
|
+
return this.toResult(await getV0ApiDatabasesByDatabaseId({
|
|
4661
|
+
client: this.client,
|
|
4662
|
+
path: { databaseId }
|
|
4663
|
+
}));
|
|
3682
4664
|
}
|
|
3683
4665
|
async createDatabase({ organizationId, projectGroupId, name }) {
|
|
3684
|
-
return this.
|
|
3685
|
-
|
|
3686
|
-
path: "/databases",
|
|
4666
|
+
return this.toResult(await postV0ApiDatabases({
|
|
4667
|
+
client: this.client,
|
|
3687
4668
|
body: {
|
|
3688
4669
|
organizationId,
|
|
3689
4670
|
...projectGroupId !== null ? { projectGroupId } : {},
|
|
3690
4671
|
...name !== null ? { name } : {}
|
|
3691
|
-
}
|
|
3692
|
-
|
|
3693
|
-
});
|
|
4672
|
+
}
|
|
4673
|
+
}));
|
|
3694
4674
|
}
|
|
3695
4675
|
async queryDatabase({ databaseId, sql }) {
|
|
3696
|
-
return this.
|
|
3697
|
-
|
|
3698
|
-
path:
|
|
3699
|
-
body: { sql }
|
|
3700
|
-
|
|
3701
|
-
});
|
|
4676
|
+
return this.toResult(await postV0ApiDatabasesByDatabaseIdQuery({
|
|
4677
|
+
client: this.client,
|
|
4678
|
+
path: { databaseId },
|
|
4679
|
+
body: { sql }
|
|
4680
|
+
}));
|
|
3702
4681
|
}
|
|
3703
4682
|
async getDatabaseConnection({ databaseId }) {
|
|
3704
|
-
return this.
|
|
3705
|
-
|
|
3706
|
-
path:
|
|
3707
|
-
|
|
3708
|
-
});
|
|
4683
|
+
return this.toResult(await getV0ApiDatabasesByDatabaseIdConnection({
|
|
4684
|
+
client: this.client,
|
|
4685
|
+
path: { databaseId }
|
|
4686
|
+
}));
|
|
3709
4687
|
}
|
|
3710
4688
|
async resetDatabase({ databaseId }) {
|
|
3711
|
-
return this.
|
|
3712
|
-
|
|
3713
|
-
path:
|
|
3714
|
-
});
|
|
4689
|
+
return this.toResult(await postV0ApiDatabasesByDatabaseIdReset({
|
|
4690
|
+
client: this.client,
|
|
4691
|
+
path: { databaseId }
|
|
4692
|
+
}));
|
|
3715
4693
|
}
|
|
3716
4694
|
async addDomain({ organizationId, domain, projectGroupId }) {
|
|
3717
|
-
return this.
|
|
3718
|
-
|
|
3719
|
-
path: "/domains",
|
|
4695
|
+
return this.toResult(await postV0ApiDomains({
|
|
4696
|
+
client: this.client,
|
|
3720
4697
|
body: {
|
|
3721
4698
|
organizationId,
|
|
3722
4699
|
domain,
|
|
3723
4700
|
...projectGroupId !== null ? { projectGroupId } : {}
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
});
|
|
4701
|
+
}
|
|
4702
|
+
}));
|
|
3727
4703
|
}
|
|
3728
4704
|
async removeDomain({ domainId }) {
|
|
3729
|
-
return this.
|
|
3730
|
-
|
|
3731
|
-
path:
|
|
3732
|
-
});
|
|
4705
|
+
return this.toResult(await deleteV0ApiDomainsByDomainId({
|
|
4706
|
+
client: this.client,
|
|
4707
|
+
path: { domainId }
|
|
4708
|
+
}));
|
|
3733
4709
|
}
|
|
3734
4710
|
async verifyDomain({ domainId }) {
|
|
3735
|
-
return this.
|
|
3736
|
-
|
|
3737
|
-
path:
|
|
3738
|
-
|
|
3739
|
-
});
|
|
4711
|
+
return this.toResult(await postV0ApiDomainsByDomainIdVerify({
|
|
4712
|
+
client: this.client,
|
|
4713
|
+
path: { domainId }
|
|
4714
|
+
}));
|
|
3740
4715
|
}
|
|
3741
4716
|
async listDeployments({ projectGroupId, limit }) {
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
method: "GET",
|
|
3748
|
-
path,
|
|
3749
|
-
schema: ListDeploymentsResponseSchema
|
|
3750
|
-
});
|
|
4717
|
+
return this.toResult(await getV0ApiProjectsByProjectGroupIdDeployments({
|
|
4718
|
+
client: this.client,
|
|
4719
|
+
path: { projectGroupId },
|
|
4720
|
+
query: limit !== null ? { limit } : {}
|
|
4721
|
+
}));
|
|
3751
4722
|
}
|
|
3752
4723
|
async getDeployment({ deploymentId }) {
|
|
3753
|
-
return this.
|
|
3754
|
-
|
|
3755
|
-
path:
|
|
3756
|
-
|
|
3757
|
-
});
|
|
4724
|
+
return this.toResult(await getV0ApiDeploymentsByDeploymentId({
|
|
4725
|
+
client: this.client,
|
|
4726
|
+
path: { deploymentId }
|
|
4727
|
+
}));
|
|
3758
4728
|
}
|
|
3759
4729
|
async getDeploymentLogs({ deploymentId }) {
|
|
3760
|
-
return this.
|
|
3761
|
-
|
|
3762
|
-
path:
|
|
3763
|
-
|
|
3764
|
-
});
|
|
4730
|
+
return this.toResult(await getV0ApiDeploymentsByDeploymentIdLogs({
|
|
4731
|
+
client: this.client,
|
|
4732
|
+
path: { deploymentId }
|
|
4733
|
+
}));
|
|
3765
4734
|
}
|
|
3766
|
-
async rollbackDeployment({ projectGroupId
|
|
3767
|
-
return this.
|
|
3768
|
-
|
|
3769
|
-
path:
|
|
3770
|
-
|
|
3771
|
-
|
|
4735
|
+
async rollbackDeployment({ projectGroupId }) {
|
|
4736
|
+
return this.toResult(await postV0ApiProjectsByProjectGroupIdDeploymentsRollback({
|
|
4737
|
+
client: this.client,
|
|
4738
|
+
path: { projectGroupId }
|
|
4739
|
+
})).andThen((data) => {
|
|
4740
|
+
const parsed = RollbackResponseSchema.safeParse(data);
|
|
4741
|
+
return parsed.success ? ok(parsed.data) : err({
|
|
4742
|
+
message: "Unexpected API response format",
|
|
4743
|
+
status: 200
|
|
4744
|
+
});
|
|
3772
4745
|
});
|
|
3773
4746
|
}
|
|
3774
4747
|
async inviteMember({ organizationId, email, role }) {
|
|
3775
|
-
return this.
|
|
3776
|
-
|
|
3777
|
-
path:
|
|
4748
|
+
return this.toResult(await postV0ApiOrganizationsByOrganizationIdInvites({
|
|
4749
|
+
client: this.client,
|
|
4750
|
+
path: { organizationId },
|
|
3778
4751
|
body: {
|
|
3779
4752
|
email,
|
|
3780
4753
|
...role !== null ? { role } : {}
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
});
|
|
4754
|
+
}
|
|
4755
|
+
}));
|
|
3784
4756
|
}
|
|
3785
4757
|
async removeMember({ organizationId, email }) {
|
|
3786
|
-
return this.
|
|
3787
|
-
|
|
3788
|
-
path:
|
|
3789
|
-
body: { email }
|
|
3790
|
-
|
|
3791
|
-
});
|
|
4758
|
+
return this.toResult(await postV0ApiOrganizationsByOrganizationIdMembersRemove({
|
|
4759
|
+
client: this.client,
|
|
4760
|
+
path: { organizationId },
|
|
4761
|
+
body: { email }
|
|
4762
|
+
}));
|
|
3792
4763
|
}
|
|
3793
4764
|
async updateMemberRole({ organizationId, email, role }) {
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
4765
|
+
const normalizedRole = toMemberRole(role);
|
|
4766
|
+
if (normalizedRole === null) return err({
|
|
4767
|
+
message: `Invalid role: ${role}. Expected one of owner, admin, editor, viewer.`,
|
|
4768
|
+
status: 400
|
|
4769
|
+
});
|
|
4770
|
+
return this.toResult(await postV0ApiOrganizationsByOrganizationIdMembersRole({
|
|
4771
|
+
client: this.client,
|
|
4772
|
+
path: { organizationId },
|
|
3797
4773
|
body: {
|
|
3798
4774
|
email,
|
|
3799
|
-
role
|
|
3800
|
-
},
|
|
3801
|
-
schema: UpdateMemberRoleResponseSchema
|
|
3802
|
-
});
|
|
3803
|
-
}
|
|
3804
|
-
async request(params) {
|
|
3805
|
-
const url = `${this.baseUrl}${params.path}`;
|
|
3806
|
-
let response;
|
|
3807
|
-
try {
|
|
3808
|
-
response = await fetch(url, {
|
|
3809
|
-
method: params.method,
|
|
3810
|
-
headers: {
|
|
3811
|
-
authorization: this.authHeader,
|
|
3812
|
-
"user-agent": USER_AGENT,
|
|
3813
|
-
...params.body ? { "Content-Type": "application/json" } : {}
|
|
3814
|
-
},
|
|
3815
|
-
...params.body ? { body: JSON.stringify(params.body) } : {}
|
|
3816
|
-
});
|
|
3817
|
-
} catch (cause) {
|
|
3818
|
-
return err({
|
|
3819
|
-
message: `Network error: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
3820
|
-
status: null
|
|
3821
|
-
});
|
|
3822
|
-
}
|
|
3823
|
-
if (!response.ok) {
|
|
3824
|
-
const text = await response.text().catch(() => "");
|
|
3825
|
-
let details;
|
|
3826
|
-
try {
|
|
3827
|
-
details = JSON.parse(text);
|
|
3828
|
-
} catch {
|
|
3829
|
-
details = text || void 0;
|
|
4775
|
+
role: normalizedRole
|
|
3830
4776
|
}
|
|
3831
|
-
|
|
3832
|
-
return err({
|
|
3833
|
-
message: `API error (${response.status})`,
|
|
3834
|
-
status: response.status,
|
|
3835
|
-
details,
|
|
3836
|
-
...retryAfter !== null ? { retryAfter } : {}
|
|
3837
|
-
});
|
|
3838
|
-
}
|
|
3839
|
-
if (response.status === 204 || !params.schema) return ok(void 0);
|
|
3840
|
-
const json = await response.json();
|
|
3841
|
-
const parsed = params.schema.safeParse(json);
|
|
3842
|
-
if (!parsed.success) return err({
|
|
3843
|
-
message: "Unexpected API response format",
|
|
3844
|
-
status: response.status,
|
|
3845
|
-
details: parsed.error.errors
|
|
3846
|
-
});
|
|
3847
|
-
return ok(parsed.data);
|
|
4777
|
+
}));
|
|
3848
4778
|
}
|
|
3849
4779
|
};
|
|
3850
4780
|
|
|
@@ -3870,9 +4800,14 @@ function printTable({ headers, rows }) {
|
|
|
3870
4800
|
console.log(widths.map((w) => "─".repeat(w)).join("──"));
|
|
3871
4801
|
for (const row of rows) console.log(row.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" "));
|
|
3872
4802
|
}
|
|
4803
|
+
const DetailsWithErrorSchema = z.object({ error: z.string() });
|
|
4804
|
+
const DetailsWithErrorsSchema = z.object({ errors: z.array(z.union([z.string(), z.object({ message: z.string() })])) });
|
|
3873
4805
|
function printApiError(error) {
|
|
3874
4806
|
printError(error.message);
|
|
3875
|
-
|
|
4807
|
+
const withError = DetailsWithErrorSchema.safeParse(error.details);
|
|
4808
|
+
if (withError.success && withError.data.error !== error.message) console.error(` ${withError.data.error}`);
|
|
4809
|
+
const withErrors = DetailsWithErrorsSchema.safeParse(error.details);
|
|
4810
|
+
if (withErrors.success) for (const e of withErrors.data.errors) console.error(` ${typeof e === "string" ? e : e.message}`);
|
|
3876
4811
|
}
|
|
3877
4812
|
function outputSuccess({ argv, command, data, primaryId, startTime }) {
|
|
3878
4813
|
if (argv.quiet) {
|
|
@@ -3891,16 +4826,23 @@ function outputSuccess({ argv, command, data, primaryId, startTime }) {
|
|
|
3891
4826
|
}
|
|
3892
4827
|
return false;
|
|
3893
4828
|
}
|
|
4829
|
+
const DetailsWithCodeSchema = z.object({ code: z.string() });
|
|
4830
|
+
function extractErrorCode(details) {
|
|
4831
|
+
const parsed = DetailsWithCodeSchema.safeParse(details);
|
|
4832
|
+
return parsed.success ? parsed.data.code : null;
|
|
4833
|
+
}
|
|
3894
4834
|
function outputError({ argv, command, error, hint, exitCode }) {
|
|
3895
4835
|
const status = "status" in error ? error.status ?? null : null;
|
|
4836
|
+
const details = "details" in error ? error.details : void 0;
|
|
3896
4837
|
const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
|
|
3897
4838
|
process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
|
|
4839
|
+
const code = extractErrorCode(details) ?? errorCodeFromHttpStatus(status);
|
|
3898
4840
|
if (argv.json || argv.quiet) {
|
|
3899
4841
|
console.error(JSON.stringify({
|
|
3900
4842
|
ok: false,
|
|
3901
4843
|
command,
|
|
3902
4844
|
error: {
|
|
3903
|
-
code
|
|
4845
|
+
code,
|
|
3904
4846
|
message: error.message,
|
|
3905
4847
|
...hint ? { hint } : {},
|
|
3906
4848
|
...retryAfter !== null ? { retry_after_seconds: retryAfter } : {}
|
|
@@ -3910,7 +4852,8 @@ function outputError({ argv, command, error, hint, exitCode }) {
|
|
|
3910
4852
|
}
|
|
3911
4853
|
printApiError({
|
|
3912
4854
|
message: error.message,
|
|
3913
|
-
status: error.status
|
|
4855
|
+
status: error.status,
|
|
4856
|
+
details
|
|
3914
4857
|
});
|
|
3915
4858
|
if (retryAfter !== null) console.error(` ${styleText("dim", `Retry after ${retryAfter}s`)}`);
|
|
3916
4859
|
if (hint) console.error(` ${styleText("dim", hint)}`);
|
|
@@ -4040,7 +4983,8 @@ const upload = {
|
|
|
4040
4983
|
outputError({
|
|
4041
4984
|
argv,
|
|
4042
4985
|
command,
|
|
4043
|
-
error: result.error
|
|
4986
|
+
error: result.error,
|
|
4987
|
+
hint: "Check the file path exists and is under the size limit"
|
|
4044
4988
|
});
|
|
4045
4989
|
return;
|
|
4046
4990
|
}
|
|
@@ -4191,15 +5135,15 @@ const remove$1 = {
|
|
|
4191
5135
|
}
|
|
4192
5136
|
};
|
|
4193
5137
|
const assetsCommand = {
|
|
4194
|
-
command: "assets
|
|
5138
|
+
command: "assets",
|
|
4195
5139
|
describe: "Manage project assets (images)",
|
|
4196
|
-
builder: (yargs) => yargs.command(upload).command(list$2).command(remove$1).demandCommand(),
|
|
5140
|
+
builder: (yargs) => yargs.command(upload).command(list$2).command(remove$1).demandCommand(1, "Specify an assets subcommand. Run `anything assets --help` for usage."),
|
|
4197
5141
|
handler: () => {}
|
|
4198
5142
|
};
|
|
4199
5143
|
|
|
4200
5144
|
//#endregion
|
|
4201
5145
|
//#region src/commands/dev.ts
|
|
4202
|
-
const COMMAND$
|
|
5146
|
+
const COMMAND$26 = "dev";
|
|
4203
5147
|
const devCommand = {
|
|
4204
5148
|
command: "dev [state]",
|
|
4205
5149
|
describe: "Toggle local dev mode so commands target your local dev stack",
|
|
@@ -4219,7 +5163,7 @@ const devCommand = {
|
|
|
4219
5163
|
const apiUrl = resolveApiUrl({ apiUrl: argv.apiUrl });
|
|
4220
5164
|
if (outputSuccess({
|
|
4221
5165
|
argv,
|
|
4222
|
-
command: COMMAND$
|
|
5166
|
+
command: COMMAND$26,
|
|
4223
5167
|
data: {
|
|
4224
5168
|
devMode: enabled,
|
|
4225
5169
|
apiUrl
|
|
@@ -4287,7 +5231,7 @@ function isNonInteractive(argv) {
|
|
|
4287
5231
|
|
|
4288
5232
|
//#endregion
|
|
4289
5233
|
//#region src/commands/auth.ts
|
|
4290
|
-
const POLL_INTERVAL_MS$
|
|
5234
|
+
const POLL_INTERVAL_MS$2 = 2e3;
|
|
4291
5235
|
const POLL_TIMEOUT_MS$1 = 3e5;
|
|
4292
5236
|
const DEFAULT_WEB_URL = "https://anything.com";
|
|
4293
5237
|
const DevAutoLoginResponseSchema = z.object({
|
|
@@ -4420,7 +5364,7 @@ async function startCliAuth({ apiUrl }) {
|
|
|
4420
5364
|
async function pollForApiKey({ apiUrl, pollingId }) {
|
|
4421
5365
|
const deadline = Date.now() + POLL_TIMEOUT_MS$1;
|
|
4422
5366
|
while (Date.now() < deadline) {
|
|
4423
|
-
await setTimeout$1(POLL_INTERVAL_MS$
|
|
5367
|
+
await setTimeout$1(POLL_INTERVAL_MS$2);
|
|
4424
5368
|
const response = await fetch(`${apiUrl}/v0/auth/cli/poll?id=${encodeURIComponent(pollingId)}`, { headers: { "user-agent": USER_AGENT } }).catch(() => null);
|
|
4425
5369
|
if (!response) continue;
|
|
4426
5370
|
if (response.status === 429) {
|
|
@@ -4741,7 +5685,7 @@ const authCommand = {
|
|
|
4741
5685
|
|
|
4742
5686
|
//#endregion
|
|
4743
5687
|
//#region src/commands/database-connect.ts
|
|
4744
|
-
const COMMAND$
|
|
5688
|
+
const COMMAND$25 = "databases connect";
|
|
4745
5689
|
const databaseConnectCommand = {
|
|
4746
5690
|
command: "connect <databaseId>",
|
|
4747
5691
|
describe: "Print the connection string for a database",
|
|
@@ -4758,7 +5702,7 @@ const databaseConnectCommand = {
|
|
|
4758
5702
|
if (config.isErr()) {
|
|
4759
5703
|
outputError({
|
|
4760
5704
|
argv,
|
|
4761
|
-
command: COMMAND$
|
|
5705
|
+
command: COMMAND$25,
|
|
4762
5706
|
error: {
|
|
4763
5707
|
message: config.error.message,
|
|
4764
5708
|
status: null
|
|
@@ -4771,14 +5715,14 @@ const databaseConnectCommand = {
|
|
|
4771
5715
|
if (result.isErr()) {
|
|
4772
5716
|
outputError({
|
|
4773
5717
|
argv,
|
|
4774
|
-
command: COMMAND$
|
|
5718
|
+
command: COMMAND$25,
|
|
4775
5719
|
error: result.error
|
|
4776
5720
|
});
|
|
4777
5721
|
return;
|
|
4778
5722
|
}
|
|
4779
5723
|
if (outputSuccess({
|
|
4780
5724
|
argv,
|
|
4781
|
-
command: COMMAND$
|
|
5725
|
+
command: COMMAND$25,
|
|
4782
5726
|
data: result.value,
|
|
4783
5727
|
primaryId: result.value.connectionString
|
|
4784
5728
|
})) return;
|
|
@@ -4832,7 +5776,7 @@ async function resolveOrgId({ flagOrg, config, nonInteractive }) {
|
|
|
4832
5776
|
|
|
4833
5777
|
//#endregion
|
|
4834
5778
|
//#region src/commands/database-create.ts
|
|
4835
|
-
const COMMAND$
|
|
5779
|
+
const COMMAND$24 = "databases create";
|
|
4836
5780
|
const databaseCreateCommand = {
|
|
4837
5781
|
command: "create",
|
|
4838
5782
|
describe: "Create a new database for a project",
|
|
@@ -4854,7 +5798,7 @@ const databaseCreateCommand = {
|
|
|
4854
5798
|
if (config.isErr()) {
|
|
4855
5799
|
outputError({
|
|
4856
5800
|
argv,
|
|
4857
|
-
command: COMMAND$
|
|
5801
|
+
command: COMMAND$24,
|
|
4858
5802
|
error: {
|
|
4859
5803
|
message: config.error.message,
|
|
4860
5804
|
status: null
|
|
@@ -4871,7 +5815,7 @@ const databaseCreateCommand = {
|
|
|
4871
5815
|
if (!orgResult.ok) {
|
|
4872
5816
|
outputError({
|
|
4873
5817
|
argv,
|
|
4874
|
-
command: COMMAND$
|
|
5818
|
+
command: COMMAND$24,
|
|
4875
5819
|
error: {
|
|
4876
5820
|
message: orgResult.error,
|
|
4877
5821
|
status: null
|
|
@@ -4883,7 +5827,7 @@ const databaseCreateCommand = {
|
|
|
4883
5827
|
if (argv["dry-run"]) {
|
|
4884
5828
|
outputDryRun({
|
|
4885
5829
|
argv,
|
|
4886
|
-
command: COMMAND$
|
|
5830
|
+
command: COMMAND$24,
|
|
4887
5831
|
plannedActions: [{
|
|
4888
5832
|
action: "create_database",
|
|
4889
5833
|
org: orgResult.orgId,
|
|
@@ -4901,14 +5845,14 @@ const databaseCreateCommand = {
|
|
|
4901
5845
|
if (result.isErr()) {
|
|
4902
5846
|
outputError({
|
|
4903
5847
|
argv,
|
|
4904
|
-
command: COMMAND$
|
|
5848
|
+
command: COMMAND$24,
|
|
4905
5849
|
error: result.error
|
|
4906
5850
|
});
|
|
4907
5851
|
return;
|
|
4908
5852
|
}
|
|
4909
5853
|
if (outputSuccess({
|
|
4910
5854
|
argv,
|
|
4911
|
-
command: COMMAND$
|
|
5855
|
+
command: COMMAND$24,
|
|
4912
5856
|
data: result.value.database,
|
|
4913
5857
|
primaryId: result.value.database.id
|
|
4914
5858
|
})) return;
|
|
@@ -4921,7 +5865,7 @@ const databaseCreateCommand = {
|
|
|
4921
5865
|
|
|
4922
5866
|
//#endregion
|
|
4923
5867
|
//#region src/commands/database-get.ts
|
|
4924
|
-
const COMMAND$
|
|
5868
|
+
const COMMAND$23 = "databases get";
|
|
4925
5869
|
const databaseGetCommand = {
|
|
4926
5870
|
command: "get <databaseId>",
|
|
4927
5871
|
describe: "Inspect a database",
|
|
@@ -4938,7 +5882,7 @@ const databaseGetCommand = {
|
|
|
4938
5882
|
if (config.isErr()) {
|
|
4939
5883
|
outputError({
|
|
4940
5884
|
argv,
|
|
4941
|
-
command: COMMAND$
|
|
5885
|
+
command: COMMAND$23,
|
|
4942
5886
|
error: {
|
|
4943
5887
|
message: config.error.message,
|
|
4944
5888
|
status: null
|
|
@@ -4951,14 +5895,14 @@ const databaseGetCommand = {
|
|
|
4951
5895
|
if (result.isErr()) {
|
|
4952
5896
|
outputError({
|
|
4953
5897
|
argv,
|
|
4954
|
-
command: COMMAND$
|
|
5898
|
+
command: COMMAND$23,
|
|
4955
5899
|
error: result.error
|
|
4956
5900
|
});
|
|
4957
5901
|
return;
|
|
4958
5902
|
}
|
|
4959
5903
|
if (outputSuccess({
|
|
4960
5904
|
argv,
|
|
4961
|
-
command: COMMAND$
|
|
5905
|
+
command: COMMAND$23,
|
|
4962
5906
|
data: result.value.database,
|
|
4963
5907
|
primaryId: result.value.database.id
|
|
4964
5908
|
})) return;
|
|
@@ -4973,7 +5917,7 @@ const databaseGetCommand = {
|
|
|
4973
5917
|
|
|
4974
5918
|
//#endregion
|
|
4975
5919
|
//#region src/commands/database-query.ts
|
|
4976
|
-
const COMMAND$
|
|
5920
|
+
const COMMAND$22 = "databases query";
|
|
4977
5921
|
const databaseQueryCommand = {
|
|
4978
5922
|
command: "query <databaseId> <sql>",
|
|
4979
5923
|
describe: "Run a read-only SQL query against a database",
|
|
@@ -4994,7 +5938,7 @@ const databaseQueryCommand = {
|
|
|
4994
5938
|
if (config.isErr()) {
|
|
4995
5939
|
outputError({
|
|
4996
5940
|
argv,
|
|
4997
|
-
command: COMMAND$
|
|
5941
|
+
command: COMMAND$22,
|
|
4998
5942
|
error: {
|
|
4999
5943
|
message: config.error.message,
|
|
5000
5944
|
status: null
|
|
@@ -5010,14 +5954,15 @@ const databaseQueryCommand = {
|
|
|
5010
5954
|
if (result.isErr()) {
|
|
5011
5955
|
outputError({
|
|
5012
5956
|
argv,
|
|
5013
|
-
command: COMMAND$
|
|
5014
|
-
error: result.error
|
|
5957
|
+
command: COMMAND$22,
|
|
5958
|
+
error: result.error,
|
|
5959
|
+
hint: "Check the database ID and SQL syntax"
|
|
5015
5960
|
});
|
|
5016
5961
|
return;
|
|
5017
5962
|
}
|
|
5018
5963
|
if (outputSuccess({
|
|
5019
5964
|
argv,
|
|
5020
|
-
command: COMMAND$
|
|
5965
|
+
command: COMMAND$22,
|
|
5021
5966
|
data: result.value
|
|
5022
5967
|
})) return;
|
|
5023
5968
|
if (result.value.rows.length === 0) {
|
|
@@ -5035,7 +5980,7 @@ const databaseQueryCommand = {
|
|
|
5035
5980
|
|
|
5036
5981
|
//#endregion
|
|
5037
5982
|
//#region src/commands/database-reset.ts
|
|
5038
|
-
const COMMAND$
|
|
5983
|
+
const COMMAND$21 = "databases reset";
|
|
5039
5984
|
const databaseResetCommand = {
|
|
5040
5985
|
command: "reset <databaseId>",
|
|
5041
5986
|
describe: "Reset a database (destructive)",
|
|
@@ -5056,7 +6001,7 @@ const databaseResetCommand = {
|
|
|
5056
6001
|
if (config.isErr()) {
|
|
5057
6002
|
outputError({
|
|
5058
6003
|
argv,
|
|
5059
|
-
command: COMMAND$
|
|
6004
|
+
command: COMMAND$21,
|
|
5060
6005
|
error: {
|
|
5061
6006
|
message: config.error.message,
|
|
5062
6007
|
status: null
|
|
@@ -5068,7 +6013,7 @@ const databaseResetCommand = {
|
|
|
5068
6013
|
if (argv["dry-run"]) {
|
|
5069
6014
|
outputDryRun({
|
|
5070
6015
|
argv,
|
|
5071
|
-
command: COMMAND$
|
|
6016
|
+
command: COMMAND$21,
|
|
5072
6017
|
plannedActions: [{
|
|
5073
6018
|
action: "reset_database",
|
|
5074
6019
|
databaseId: argv.databaseId
|
|
@@ -5079,7 +6024,7 @@ const databaseResetCommand = {
|
|
|
5079
6024
|
if (!argv.yes) {
|
|
5080
6025
|
outputError({
|
|
5081
6026
|
argv,
|
|
5082
|
-
command: COMMAND$
|
|
6027
|
+
command: COMMAND$21,
|
|
5083
6028
|
error: {
|
|
5084
6029
|
message: "Database reset is destructive. Pass --yes to confirm.",
|
|
5085
6030
|
status: null
|
|
@@ -5092,14 +6037,14 @@ const databaseResetCommand = {
|
|
|
5092
6037
|
if (result.isErr()) {
|
|
5093
6038
|
outputError({
|
|
5094
6039
|
argv,
|
|
5095
|
-
command: COMMAND$
|
|
6040
|
+
command: COMMAND$21,
|
|
5096
6041
|
error: result.error
|
|
5097
6042
|
});
|
|
5098
6043
|
return;
|
|
5099
6044
|
}
|
|
5100
6045
|
if (outputSuccess({
|
|
5101
6046
|
argv,
|
|
5102
|
-
command: COMMAND$
|
|
6047
|
+
command: COMMAND$21,
|
|
5103
6048
|
data: {
|
|
5104
6049
|
reset: true,
|
|
5105
6050
|
databaseId: argv.databaseId
|
|
@@ -5111,7 +6056,7 @@ const databaseResetCommand = {
|
|
|
5111
6056
|
|
|
5112
6057
|
//#endregion
|
|
5113
6058
|
//#region src/commands/list-databases.ts
|
|
5114
|
-
const COMMAND$
|
|
6059
|
+
const COMMAND$20 = "databases list";
|
|
5115
6060
|
const listDatabasesCommand = {
|
|
5116
6061
|
command: "list",
|
|
5117
6062
|
describe: "List databases you can access",
|
|
@@ -5132,7 +6077,7 @@ const listDatabasesCommand = {
|
|
|
5132
6077
|
if (config.isErr()) {
|
|
5133
6078
|
outputError({
|
|
5134
6079
|
argv,
|
|
5135
|
-
command: COMMAND$
|
|
6080
|
+
command: COMMAND$20,
|
|
5136
6081
|
error: {
|
|
5137
6082
|
message: config.error.message,
|
|
5138
6083
|
status: null
|
|
@@ -5148,7 +6093,7 @@ const listDatabasesCommand = {
|
|
|
5148
6093
|
if (result.isErr()) {
|
|
5149
6094
|
outputError({
|
|
5150
6095
|
argv,
|
|
5151
|
-
command: COMMAND$
|
|
6096
|
+
command: COMMAND$20,
|
|
5152
6097
|
error: result.error
|
|
5153
6098
|
});
|
|
5154
6099
|
return;
|
|
@@ -5159,7 +6104,7 @@ const listDatabasesCommand = {
|
|
|
5159
6104
|
}
|
|
5160
6105
|
if (outputSuccess({
|
|
5161
6106
|
argv,
|
|
5162
|
-
command: COMMAND$
|
|
6107
|
+
command: COMMAND$20,
|
|
5163
6108
|
data: result.value
|
|
5164
6109
|
})) return;
|
|
5165
6110
|
if (result.value.databases.length === 0) {
|
|
@@ -5474,7 +6419,7 @@ const deploymentsCommand = {
|
|
|
5474
6419
|
|
|
5475
6420
|
//#endregion
|
|
5476
6421
|
//#region src/commands/domain-add.ts
|
|
5477
|
-
const COMMAND$
|
|
6422
|
+
const COMMAND$19 = "domains add";
|
|
5478
6423
|
const domainAddCommand = {
|
|
5479
6424
|
command: "add <domain>",
|
|
5480
6425
|
describe: "Add a custom domain to a project",
|
|
@@ -5497,7 +6442,7 @@ const domainAddCommand = {
|
|
|
5497
6442
|
if (config.isErr()) {
|
|
5498
6443
|
outputError({
|
|
5499
6444
|
argv,
|
|
5500
|
-
command: COMMAND$
|
|
6445
|
+
command: COMMAND$19,
|
|
5501
6446
|
error: {
|
|
5502
6447
|
message: config.error.message,
|
|
5503
6448
|
status: null
|
|
@@ -5514,7 +6459,7 @@ const domainAddCommand = {
|
|
|
5514
6459
|
if (!orgResult.ok) {
|
|
5515
6460
|
outputError({
|
|
5516
6461
|
argv,
|
|
5517
|
-
command: COMMAND$
|
|
6462
|
+
command: COMMAND$19,
|
|
5518
6463
|
error: {
|
|
5519
6464
|
message: orgResult.error,
|
|
5520
6465
|
status: null
|
|
@@ -5526,7 +6471,7 @@ const domainAddCommand = {
|
|
|
5526
6471
|
if (argv["dry-run"]) {
|
|
5527
6472
|
outputDryRun({
|
|
5528
6473
|
argv,
|
|
5529
|
-
command: COMMAND$
|
|
6474
|
+
command: COMMAND$19,
|
|
5530
6475
|
plannedActions: [{
|
|
5531
6476
|
action: "add_domain",
|
|
5532
6477
|
domain: argv.domain,
|
|
@@ -5544,14 +6489,14 @@ const domainAddCommand = {
|
|
|
5544
6489
|
if (result.isErr()) {
|
|
5545
6490
|
outputError({
|
|
5546
6491
|
argv,
|
|
5547
|
-
command: COMMAND$
|
|
6492
|
+
command: COMMAND$19,
|
|
5548
6493
|
error: result.error
|
|
5549
6494
|
});
|
|
5550
6495
|
return;
|
|
5551
6496
|
}
|
|
5552
6497
|
if (outputSuccess({
|
|
5553
6498
|
argv,
|
|
5554
|
-
command: COMMAND$
|
|
6499
|
+
command: COMMAND$19,
|
|
5555
6500
|
data: result.value.domain,
|
|
5556
6501
|
primaryId: result.value.domain.domain
|
|
5557
6502
|
})) return;
|
|
@@ -5563,7 +6508,7 @@ const domainAddCommand = {
|
|
|
5563
6508
|
|
|
5564
6509
|
//#endregion
|
|
5565
6510
|
//#region src/commands/domain-remove.ts
|
|
5566
|
-
const COMMAND$
|
|
6511
|
+
const COMMAND$18 = "domains remove";
|
|
5567
6512
|
const domainRemoveCommand = {
|
|
5568
6513
|
command: "remove <domainId>",
|
|
5569
6514
|
describe: "Remove a custom domain",
|
|
@@ -5584,7 +6529,7 @@ const domainRemoveCommand = {
|
|
|
5584
6529
|
if (config.isErr()) {
|
|
5585
6530
|
outputError({
|
|
5586
6531
|
argv,
|
|
5587
|
-
command: COMMAND$
|
|
6532
|
+
command: COMMAND$18,
|
|
5588
6533
|
error: {
|
|
5589
6534
|
message: config.error.message,
|
|
5590
6535
|
status: null
|
|
@@ -5596,7 +6541,7 @@ const domainRemoveCommand = {
|
|
|
5596
6541
|
if (argv["dry-run"]) {
|
|
5597
6542
|
outputDryRun({
|
|
5598
6543
|
argv,
|
|
5599
|
-
command: COMMAND$
|
|
6544
|
+
command: COMMAND$18,
|
|
5600
6545
|
plannedActions: [{
|
|
5601
6546
|
action: "remove_domain",
|
|
5602
6547
|
domainId: argv.domainId
|
|
@@ -5607,7 +6552,7 @@ const domainRemoveCommand = {
|
|
|
5607
6552
|
if (!argv.yes) {
|
|
5608
6553
|
outputError({
|
|
5609
6554
|
argv,
|
|
5610
|
-
command: COMMAND$
|
|
6555
|
+
command: COMMAND$18,
|
|
5611
6556
|
error: {
|
|
5612
6557
|
message: "Domain removal is destructive. Pass --yes to confirm.",
|
|
5613
6558
|
status: null
|
|
@@ -5620,14 +6565,14 @@ const domainRemoveCommand = {
|
|
|
5620
6565
|
if (result.isErr()) {
|
|
5621
6566
|
outputError({
|
|
5622
6567
|
argv,
|
|
5623
|
-
command: COMMAND$
|
|
6568
|
+
command: COMMAND$18,
|
|
5624
6569
|
error: result.error
|
|
5625
6570
|
});
|
|
5626
6571
|
return;
|
|
5627
6572
|
}
|
|
5628
6573
|
if (outputSuccess({
|
|
5629
6574
|
argv,
|
|
5630
|
-
command: COMMAND$
|
|
6575
|
+
command: COMMAND$18,
|
|
5631
6576
|
data: {
|
|
5632
6577
|
removed: true,
|
|
5633
6578
|
domainId: argv.domainId
|
|
@@ -5639,7 +6584,7 @@ const domainRemoveCommand = {
|
|
|
5639
6584
|
|
|
5640
6585
|
//#endregion
|
|
5641
6586
|
//#region src/commands/domain-verify.ts
|
|
5642
|
-
const COMMAND$
|
|
6587
|
+
const COMMAND$17 = "domains verify";
|
|
5643
6588
|
const domainVerifyCommand = {
|
|
5644
6589
|
command: "verify <domainId>",
|
|
5645
6590
|
describe: "Check DNS configuration for a custom domain",
|
|
@@ -5656,7 +6601,7 @@ const domainVerifyCommand = {
|
|
|
5656
6601
|
if (config.isErr()) {
|
|
5657
6602
|
outputError({
|
|
5658
6603
|
argv,
|
|
5659
|
-
command: COMMAND$
|
|
6604
|
+
command: COMMAND$17,
|
|
5660
6605
|
error: {
|
|
5661
6606
|
message: config.error.message,
|
|
5662
6607
|
status: null
|
|
@@ -5669,14 +6614,14 @@ const domainVerifyCommand = {
|
|
|
5669
6614
|
if (result.isErr()) {
|
|
5670
6615
|
outputError({
|
|
5671
6616
|
argv,
|
|
5672
|
-
command: COMMAND$
|
|
6617
|
+
command: COMMAND$17,
|
|
5673
6618
|
error: result.error
|
|
5674
6619
|
});
|
|
5675
6620
|
return;
|
|
5676
6621
|
}
|
|
5677
6622
|
if (outputSuccess({
|
|
5678
6623
|
argv,
|
|
5679
|
-
command: COMMAND$
|
|
6624
|
+
command: COMMAND$17,
|
|
5680
6625
|
data: result.value,
|
|
5681
6626
|
primaryId: String(result.value.verified)
|
|
5682
6627
|
})) return;
|
|
@@ -5985,11 +6930,26 @@ const commandTree = [
|
|
|
5985
6930
|
}, {
|
|
5986
6931
|
name: "--store",
|
|
5987
6932
|
type: "string",
|
|
5988
|
-
required: true
|
|
6933
|
+
required: true,
|
|
6934
|
+
choices: ["app-store"]
|
|
5989
6935
|
}],
|
|
5990
6936
|
idempotent: false,
|
|
5991
6937
|
destructive: false
|
|
5992
6938
|
},
|
|
6939
|
+
{
|
|
6940
|
+
name: "projects submit status",
|
|
6941
|
+
flags: [{
|
|
6942
|
+
name: "<projectId>",
|
|
6943
|
+
type: "string",
|
|
6944
|
+
required: true
|
|
6945
|
+
}, {
|
|
6946
|
+
name: "<submissionId>",
|
|
6947
|
+
type: "string",
|
|
6948
|
+
required: true
|
|
6949
|
+
}],
|
|
6950
|
+
idempotent: true,
|
|
6951
|
+
destructive: false
|
|
6952
|
+
},
|
|
5993
6953
|
{
|
|
5994
6954
|
name: "projects unpublish",
|
|
5995
6955
|
flags: [{
|
|
@@ -6004,6 +6964,20 @@ const commandTree = [
|
|
|
6004
6964
|
idempotent: true,
|
|
6005
6965
|
destructive: true
|
|
6006
6966
|
},
|
|
6967
|
+
{
|
|
6968
|
+
name: "projects delete",
|
|
6969
|
+
flags: [{
|
|
6970
|
+
name: "<projectId>",
|
|
6971
|
+
type: "string",
|
|
6972
|
+
required: true
|
|
6973
|
+
}, {
|
|
6974
|
+
name: "--yes",
|
|
6975
|
+
type: "boolean",
|
|
6976
|
+
required: true
|
|
6977
|
+
}],
|
|
6978
|
+
idempotent: false,
|
|
6979
|
+
destructive: true
|
|
6980
|
+
},
|
|
6007
6981
|
{
|
|
6008
6982
|
name: "projects messages",
|
|
6009
6983
|
flags: [
|
|
@@ -6098,23 +7072,86 @@ const commandTree = [
|
|
|
6098
7072
|
destructive: false
|
|
6099
7073
|
},
|
|
6100
7074
|
{
|
|
6101
|
-
name: "projects set",
|
|
7075
|
+
name: "projects set",
|
|
7076
|
+
flags: [{
|
|
7077
|
+
name: "<projectId>",
|
|
7078
|
+
type: "string",
|
|
7079
|
+
required: true
|
|
7080
|
+
}],
|
|
7081
|
+
idempotent: true,
|
|
7082
|
+
destructive: false
|
|
7083
|
+
},
|
|
7084
|
+
{
|
|
7085
|
+
name: "projects unset",
|
|
7086
|
+
flags: [],
|
|
7087
|
+
idempotent: true,
|
|
7088
|
+
destructive: false
|
|
7089
|
+
},
|
|
7090
|
+
{
|
|
7091
|
+
name: "projects auth providers",
|
|
7092
|
+
flags: [{
|
|
7093
|
+
name: "<projectId>",
|
|
7094
|
+
type: "string",
|
|
7095
|
+
required: true
|
|
7096
|
+
}],
|
|
7097
|
+
idempotent: true,
|
|
7098
|
+
destructive: false
|
|
7099
|
+
},
|
|
7100
|
+
{
|
|
7101
|
+
name: "projects settings auth get",
|
|
6102
7102
|
flags: [{
|
|
6103
|
-
name: "
|
|
7103
|
+
name: "[projectId]",
|
|
6104
7104
|
type: "string",
|
|
6105
|
-
required:
|
|
7105
|
+
required: false
|
|
6106
7106
|
}],
|
|
6107
7107
|
idempotent: true,
|
|
6108
7108
|
destructive: false
|
|
6109
7109
|
},
|
|
6110
7110
|
{
|
|
6111
|
-
name: "projects
|
|
6112
|
-
flags: [
|
|
6113
|
-
|
|
7111
|
+
name: "projects settings auth set",
|
|
7112
|
+
flags: [
|
|
7113
|
+
{
|
|
7114
|
+
name: "[projectId]",
|
|
7115
|
+
type: "string",
|
|
7116
|
+
required: false
|
|
7117
|
+
},
|
|
7118
|
+
{
|
|
7119
|
+
name: "--provider",
|
|
7120
|
+
type: "string",
|
|
7121
|
+
required: true,
|
|
7122
|
+
choices: [
|
|
7123
|
+
"google",
|
|
7124
|
+
"email",
|
|
7125
|
+
"facebook",
|
|
7126
|
+
"twitter"
|
|
7127
|
+
]
|
|
7128
|
+
},
|
|
7129
|
+
{
|
|
7130
|
+
name: "--enabled",
|
|
7131
|
+
type: "boolean",
|
|
7132
|
+
required: true
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
name: "--secret",
|
|
7136
|
+
type: "string",
|
|
7137
|
+
required: false
|
|
7138
|
+
},
|
|
7139
|
+
{
|
|
7140
|
+
name: "--env",
|
|
7141
|
+
type: "string",
|
|
7142
|
+
required: false,
|
|
7143
|
+
choices: [
|
|
7144
|
+
"development",
|
|
7145
|
+
"preview",
|
|
7146
|
+
"production"
|
|
7147
|
+
]
|
|
7148
|
+
}
|
|
7149
|
+
],
|
|
7150
|
+
idempotent: false,
|
|
6114
7151
|
destructive: false
|
|
6115
7152
|
},
|
|
6116
7153
|
{
|
|
6117
|
-
name: "secrets add",
|
|
7154
|
+
name: "projects secrets add",
|
|
6118
7155
|
flags: [
|
|
6119
7156
|
{
|
|
6120
7157
|
name: "<projectId>",
|
|
@@ -6141,7 +7178,7 @@ const commandTree = [
|
|
|
6141
7178
|
destructive: false
|
|
6142
7179
|
},
|
|
6143
7180
|
{
|
|
6144
|
-
name: "secrets list",
|
|
7181
|
+
name: "projects secrets list",
|
|
6145
7182
|
flags: [{
|
|
6146
7183
|
name: "<projectId>",
|
|
6147
7184
|
type: "string",
|
|
@@ -6151,7 +7188,7 @@ const commandTree = [
|
|
|
6151
7188
|
destructive: false
|
|
6152
7189
|
},
|
|
6153
7190
|
{
|
|
6154
|
-
name: "secrets remove",
|
|
7191
|
+
name: "projects secrets remove",
|
|
6155
7192
|
flags: [{
|
|
6156
7193
|
name: "<projectId>",
|
|
6157
7194
|
type: "string",
|
|
@@ -7601,6 +8638,13 @@ function createEmitter(argv) {
|
|
|
7601
8638
|
//#endregion
|
|
7602
8639
|
//#region src/watch-generation.ts
|
|
7603
8640
|
const TIMEOUT_MS = 300 * 1e3;
|
|
8641
|
+
const POLL_INTERVAL_MS$1 = 3e3;
|
|
8642
|
+
const TERMINAL_SUCCESS_STATUSES = new Set(["COMPLETED", "VALID"]);
|
|
8643
|
+
const TERMINAL_FAILURE_STATUSES = new Set([
|
|
8644
|
+
"INVALID",
|
|
8645
|
+
"INVALID_PROMPT",
|
|
8646
|
+
"FAILED"
|
|
8647
|
+
]);
|
|
7604
8648
|
const REVISIONS_FINISHED_QUERY = `
|
|
7605
8649
|
subscription ProjectGroupRevisionsFinished($id: ID!) {
|
|
7606
8650
|
projectGroupRevisionsFinished(id: $id) {
|
|
@@ -7693,7 +8737,6 @@ function waitForRevisionFinished({ config, projectGroupId }) {
|
|
|
7693
8737
|
});
|
|
7694
8738
|
});
|
|
7695
8739
|
}
|
|
7696
|
-
const SUCCESS_STATUSES = new Set(["COMPLETED", "VALID"]);
|
|
7697
8740
|
async function latestMessageSucceeded({ client, projectGroupId }) {
|
|
7698
8741
|
const result = await client.getMessages({
|
|
7699
8742
|
projectGroupId,
|
|
@@ -7703,28 +8746,70 @@ async function latestMessageSucceeded({ client, projectGroupId }) {
|
|
|
7703
8746
|
if (result.isErr()) return null;
|
|
7704
8747
|
const latest = result.value.messages[0];
|
|
7705
8748
|
if (!latest) return null;
|
|
7706
|
-
return
|
|
8749
|
+
return TERMINAL_SUCCESS_STATUSES.has(latest.status);
|
|
7707
8750
|
}
|
|
7708
|
-
|
|
8751
|
+
function sleep$2(ms) {
|
|
8752
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
8753
|
+
}
|
|
8754
|
+
async function pollUntilTerminal({ client, projectGroupId, emit, sleepFn = sleep$2 }) {
|
|
8755
|
+
emit({
|
|
8756
|
+
type: "progress",
|
|
8757
|
+
step: "generating",
|
|
8758
|
+
status: "running",
|
|
8759
|
+
message: "Streaming unavailable; polling generation status..."
|
|
8760
|
+
});
|
|
8761
|
+
const deadlineMs = Date.now() + TIMEOUT_MS;
|
|
8762
|
+
while (Date.now() < deadlineMs) {
|
|
8763
|
+
const result = await client.getProjectStatus({ projectGroupId });
|
|
8764
|
+
if (result.isErr()) {
|
|
8765
|
+
await sleepFn(POLL_INTERVAL_MS$1);
|
|
8766
|
+
continue;
|
|
8767
|
+
}
|
|
8768
|
+
const { status } = result.value;
|
|
8769
|
+
if (status !== null && TERMINAL_SUCCESS_STATUSES.has(status)) {
|
|
8770
|
+
emit({
|
|
8771
|
+
type: "progress",
|
|
8772
|
+
step: "generating",
|
|
8773
|
+
status: "complete",
|
|
8774
|
+
message: "Generation complete"
|
|
8775
|
+
});
|
|
8776
|
+
return true;
|
|
8777
|
+
}
|
|
8778
|
+
if (status !== null && TERMINAL_FAILURE_STATUSES.has(status)) {
|
|
8779
|
+
emit({
|
|
8780
|
+
type: "result",
|
|
8781
|
+
ok: false,
|
|
8782
|
+
error: {
|
|
8783
|
+
code: "generation_failed",
|
|
8784
|
+
message: `Generation failed with status: ${status}`
|
|
8785
|
+
}
|
|
8786
|
+
});
|
|
8787
|
+
return false;
|
|
8788
|
+
}
|
|
8789
|
+
await sleepFn(POLL_INTERVAL_MS$1);
|
|
8790
|
+
}
|
|
8791
|
+
emit({
|
|
8792
|
+
type: "result",
|
|
8793
|
+
ok: false,
|
|
8794
|
+
error: {
|
|
8795
|
+
code: "timeout",
|
|
8796
|
+
message: "Generation timed out waiting for completion"
|
|
8797
|
+
}
|
|
8798
|
+
});
|
|
8799
|
+
return false;
|
|
8800
|
+
}
|
|
8801
|
+
async function watchGeneration({ config, client, projectGroupId, emit, waitForFinished = waitForRevisionFinished, sleepFn }) {
|
|
7709
8802
|
const finished = await waitForFinished({
|
|
7710
8803
|
config,
|
|
7711
8804
|
projectGroupId
|
|
7712
8805
|
});
|
|
7713
8806
|
if (!finished.ok) {
|
|
7714
|
-
if (finished.error.code === "websocket_error") {
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
type: "progress",
|
|
7721
|
-
step: "generating",
|
|
7722
|
-
status: "complete",
|
|
7723
|
-
message: "Generation complete"
|
|
7724
|
-
});
|
|
7725
|
-
return true;
|
|
7726
|
-
}
|
|
7727
|
-
}
|
|
8807
|
+
if (finished.error.code === "websocket_error") return pollUntilTerminal({
|
|
8808
|
+
client,
|
|
8809
|
+
projectGroupId,
|
|
8810
|
+
emit,
|
|
8811
|
+
sleepFn
|
|
8812
|
+
});
|
|
7728
8813
|
emit({
|
|
7729
8814
|
type: "result",
|
|
7730
8815
|
ok: false,
|
|
@@ -7747,7 +8832,7 @@ async function watchGeneration({ config, client, projectGroupId, emit, waitForFi
|
|
|
7747
8832
|
|
|
7748
8833
|
//#endregion
|
|
7749
8834
|
//#region src/commands/create.ts
|
|
7750
|
-
const COMMAND$
|
|
8835
|
+
const COMMAND$16 = "projects create";
|
|
7751
8836
|
const createCommand = {
|
|
7752
8837
|
command: "create",
|
|
7753
8838
|
describe: "Create a new app and start initial generation",
|
|
@@ -7769,7 +8854,7 @@ const createCommand = {
|
|
|
7769
8854
|
if (config.isErr()) {
|
|
7770
8855
|
outputError({
|
|
7771
8856
|
argv,
|
|
7772
|
-
command: COMMAND$
|
|
8857
|
+
command: COMMAND$16,
|
|
7773
8858
|
error: {
|
|
7774
8859
|
message: config.error.message,
|
|
7775
8860
|
status: null
|
|
@@ -7786,7 +8871,7 @@ const createCommand = {
|
|
|
7786
8871
|
if (!orgResult.ok) {
|
|
7787
8872
|
outputError({
|
|
7788
8873
|
argv,
|
|
7789
|
-
command: COMMAND$
|
|
8874
|
+
command: COMMAND$16,
|
|
7790
8875
|
error: {
|
|
7791
8876
|
message: orgResult.error,
|
|
7792
8877
|
status: null
|
|
@@ -7803,7 +8888,7 @@ const createCommand = {
|
|
|
7803
8888
|
if (!promptResult.ok) {
|
|
7804
8889
|
outputValidationError({
|
|
7805
8890
|
argv,
|
|
7806
|
-
command: COMMAND$
|
|
8891
|
+
command: COMMAND$16,
|
|
7807
8892
|
message: promptResult.error
|
|
7808
8893
|
});
|
|
7809
8894
|
return;
|
|
@@ -7811,7 +8896,7 @@ const createCommand = {
|
|
|
7811
8896
|
if (argv["dry-run"]) {
|
|
7812
8897
|
outputDryRun({
|
|
7813
8898
|
argv,
|
|
7814
|
-
command: COMMAND$
|
|
8899
|
+
command: COMMAND$16,
|
|
7815
8900
|
plannedActions: [{
|
|
7816
8901
|
action: "create_project",
|
|
7817
8902
|
org: orgResult.orgId,
|
|
@@ -7838,7 +8923,7 @@ const createCommand = {
|
|
|
7838
8923
|
if (result.isErr()) {
|
|
7839
8924
|
outputError({
|
|
7840
8925
|
argv,
|
|
7841
|
-
command: COMMAND$
|
|
8926
|
+
command: COMMAND$16,
|
|
7842
8927
|
error: result.error
|
|
7843
8928
|
});
|
|
7844
8929
|
return;
|
|
@@ -7863,17 +8948,38 @@ const createCommand = {
|
|
|
7863
8948
|
});
|
|
7864
8949
|
if (argv.quiet) {
|
|
7865
8950
|
console.log(result.value.projectGroupId);
|
|
8951
|
+
if (succeeded === false) process.exitCode = 1;
|
|
7866
8952
|
return;
|
|
7867
8953
|
}
|
|
7868
|
-
if (
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
8954
|
+
if (succeeded === false) {
|
|
8955
|
+
if (!argv.json) {
|
|
8956
|
+
outputError({
|
|
8957
|
+
argv,
|
|
8958
|
+
command: COMMAND$16,
|
|
8959
|
+
error: {
|
|
8960
|
+
message: "Generation failed.",
|
|
8961
|
+
status: null
|
|
8962
|
+
}
|
|
8963
|
+
});
|
|
8964
|
+
printLabel("Project Group ID", result.value.projectGroupId);
|
|
8965
|
+
}
|
|
8966
|
+
process.exitCode = 1;
|
|
8967
|
+
return;
|
|
8968
|
+
}
|
|
8969
|
+
if (argv.json) {
|
|
8970
|
+
const { projectGroupId: projectId, ...rest } = result.value;
|
|
8971
|
+
printNdjson({
|
|
8972
|
+
type: "result",
|
|
8973
|
+
ok: true,
|
|
8974
|
+
data: {
|
|
8975
|
+
projectId,
|
|
8976
|
+
...rest
|
|
8977
|
+
}
|
|
8978
|
+
});
|
|
8979
|
+
} else {
|
|
8980
|
+
printStreamMarker("done", `project ${result.value.projectGroupId} ready`);
|
|
7875
8981
|
printSuccess("App created! Generation complete.");
|
|
7876
|
-
printLabel("Project
|
|
8982
|
+
printLabel("Project ID", result.value.projectGroupId);
|
|
7877
8983
|
printLabel("Revision ID", result.value.revisionId);
|
|
7878
8984
|
}
|
|
7879
8985
|
}
|
|
@@ -7934,7 +9040,7 @@ function getDeploymentError({ result, statusCommand }) {
|
|
|
7934
9040
|
|
|
7935
9041
|
//#endregion
|
|
7936
9042
|
//#region src/commands/publish.ts
|
|
7937
|
-
const COMMAND$
|
|
9043
|
+
const COMMAND$15 = "projects publish";
|
|
7938
9044
|
const publishStatusCommand = {
|
|
7939
9045
|
command: "status <projectId> <deploymentId>",
|
|
7940
9046
|
describe: "Check the status of a publish deployment",
|
|
@@ -8019,7 +9125,7 @@ const publishCommand = {
|
|
|
8019
9125
|
if (config.isErr()) {
|
|
8020
9126
|
outputError({
|
|
8021
9127
|
argv,
|
|
8022
|
-
command: COMMAND$
|
|
9128
|
+
command: COMMAND$15,
|
|
8023
9129
|
error: {
|
|
8024
9130
|
message: config.error.message,
|
|
8025
9131
|
status: null
|
|
@@ -8037,7 +9143,7 @@ const publishCommand = {
|
|
|
8037
9143
|
if (argv.json || argv.quiet) {
|
|
8038
9144
|
outputValidationError({
|
|
8039
9145
|
argv,
|
|
8040
|
-
command: COMMAND$
|
|
9146
|
+
command: COMMAND$15,
|
|
8041
9147
|
message,
|
|
8042
9148
|
hint
|
|
8043
9149
|
});
|
|
@@ -8051,7 +9157,7 @@ const publishCommand = {
|
|
|
8051
9157
|
if (argv["dry-run"]) {
|
|
8052
9158
|
outputDryRun({
|
|
8053
9159
|
argv,
|
|
8054
|
-
command: COMMAND$
|
|
9160
|
+
command: COMMAND$15,
|
|
8055
9161
|
plannedActions: [{
|
|
8056
9162
|
action: "publish_project",
|
|
8057
9163
|
projectGroupId: argv.projectId,
|
|
@@ -8068,7 +9174,7 @@ const publishCommand = {
|
|
|
8068
9174
|
if (result.isErr()) {
|
|
8069
9175
|
outputError({
|
|
8070
9176
|
argv,
|
|
8071
|
-
command: COMMAND$
|
|
9177
|
+
command: COMMAND$15,
|
|
8072
9178
|
error: result.error
|
|
8073
9179
|
});
|
|
8074
9180
|
return;
|
|
@@ -8078,12 +9184,13 @@ const publishCommand = {
|
|
|
8078
9184
|
if (!argv.wait) {
|
|
8079
9185
|
if (outputSuccess({
|
|
8080
9186
|
argv,
|
|
8081
|
-
command: COMMAND$
|
|
9187
|
+
command: COMMAND$15,
|
|
8082
9188
|
data: {
|
|
8083
9189
|
projectId,
|
|
8084
9190
|
deploymentId,
|
|
8085
9191
|
status: "PENDING",
|
|
8086
|
-
...publishData
|
|
9192
|
+
...publishData,
|
|
9193
|
+
url
|
|
8087
9194
|
},
|
|
8088
9195
|
primaryId: url ?? projectId,
|
|
8089
9196
|
startTime
|
|
@@ -8109,7 +9216,7 @@ const publishCommand = {
|
|
|
8109
9216
|
if (deployResult.isErr()) {
|
|
8110
9217
|
outputError({
|
|
8111
9218
|
argv,
|
|
8112
|
-
command: COMMAND$
|
|
9219
|
+
command: COMMAND$15,
|
|
8113
9220
|
error: deployResult.error
|
|
8114
9221
|
});
|
|
8115
9222
|
return;
|
|
@@ -8121,7 +9228,7 @@ const publishCommand = {
|
|
|
8121
9228
|
if (deployError) {
|
|
8122
9229
|
outputError({
|
|
8123
9230
|
argv,
|
|
8124
|
-
command: COMMAND$
|
|
9231
|
+
command: COMMAND$15,
|
|
8125
9232
|
error: {
|
|
8126
9233
|
message: deployError.message,
|
|
8127
9234
|
status: null
|
|
@@ -8132,7 +9239,7 @@ const publishCommand = {
|
|
|
8132
9239
|
}
|
|
8133
9240
|
if (outputSuccess({
|
|
8134
9241
|
argv,
|
|
8135
|
-
command: COMMAND$
|
|
9242
|
+
command: COMMAND$15,
|
|
8136
9243
|
data: {
|
|
8137
9244
|
projectId,
|
|
8138
9245
|
deploymentId,
|
|
@@ -8149,7 +9256,7 @@ const publishCommand = {
|
|
|
8149
9256
|
|
|
8150
9257
|
//#endregion
|
|
8151
9258
|
//#region src/commands/duplicate.ts
|
|
8152
|
-
const COMMAND$
|
|
9259
|
+
const COMMAND$14 = "projects duplicate";
|
|
8153
9260
|
const duplicateCommand = {
|
|
8154
9261
|
command: "duplicate <projectId>",
|
|
8155
9262
|
describe: "Duplicate an existing app",
|
|
@@ -8165,7 +9272,7 @@ const duplicateCommand = {
|
|
|
8165
9272
|
if (argv["dry-run"]) {
|
|
8166
9273
|
outputDryRun({
|
|
8167
9274
|
argv,
|
|
8168
|
-
command: COMMAND$
|
|
9275
|
+
command: COMMAND$14,
|
|
8169
9276
|
plannedActions: [{
|
|
8170
9277
|
action: "duplicate_project",
|
|
8171
9278
|
projectGroupId: argv.projectId,
|
|
@@ -8181,7 +9288,7 @@ const duplicateCommand = {
|
|
|
8181
9288
|
if (config.isErr()) {
|
|
8182
9289
|
outputError({
|
|
8183
9290
|
argv,
|
|
8184
|
-
command: COMMAND$
|
|
9291
|
+
command: COMMAND$14,
|
|
8185
9292
|
error: {
|
|
8186
9293
|
message: config.error.message,
|
|
8187
9294
|
status: null
|
|
@@ -8198,7 +9305,7 @@ const duplicateCommand = {
|
|
|
8198
9305
|
if (result.isErr()) {
|
|
8199
9306
|
outputError({
|
|
8200
9307
|
argv,
|
|
8201
|
-
command: COMMAND$
|
|
9308
|
+
command: COMMAND$14,
|
|
8202
9309
|
error: result.error
|
|
8203
9310
|
});
|
|
8204
9311
|
return;
|
|
@@ -8206,7 +9313,7 @@ const duplicateCommand = {
|
|
|
8206
9313
|
const { projectGroupId: projectId, ...dupData } = result.value;
|
|
8207
9314
|
if (outputSuccess({
|
|
8208
9315
|
argv,
|
|
8209
|
-
command: COMMAND$
|
|
9316
|
+
command: COMMAND$14,
|
|
8210
9317
|
data: {
|
|
8211
9318
|
projectId,
|
|
8212
9319
|
...dupData
|
|
@@ -8333,7 +9440,7 @@ const filesCommand = {
|
|
|
8333
9440
|
|
|
8334
9441
|
//#endregion
|
|
8335
9442
|
//#region src/commands/generate.ts
|
|
8336
|
-
const COMMAND$
|
|
9443
|
+
const COMMAND$13 = "projects generate";
|
|
8337
9444
|
const generateCommand = {
|
|
8338
9445
|
command: "generate <projectId>",
|
|
8339
9446
|
describe: "Send a prompt to an existing app",
|
|
@@ -8364,7 +9471,7 @@ const generateCommand = {
|
|
|
8364
9471
|
if (!promptResult.ok) {
|
|
8365
9472
|
outputValidationError({
|
|
8366
9473
|
argv,
|
|
8367
|
-
command: COMMAND$
|
|
9474
|
+
command: COMMAND$13,
|
|
8368
9475
|
message: promptResult.error
|
|
8369
9476
|
});
|
|
8370
9477
|
return;
|
|
@@ -8372,7 +9479,7 @@ const generateCommand = {
|
|
|
8372
9479
|
if (argv["dry-run"]) {
|
|
8373
9480
|
outputDryRun({
|
|
8374
9481
|
argv,
|
|
8375
|
-
command: COMMAND$
|
|
9482
|
+
command: COMMAND$13,
|
|
8376
9483
|
plannedActions: [{
|
|
8377
9484
|
action: "generate",
|
|
8378
9485
|
projectGroupId: argv.projectId,
|
|
@@ -8390,7 +9497,7 @@ const generateCommand = {
|
|
|
8390
9497
|
if (config.isErr()) {
|
|
8391
9498
|
outputError({
|
|
8392
9499
|
argv,
|
|
8393
|
-
command: COMMAND$
|
|
9500
|
+
command: COMMAND$13,
|
|
8394
9501
|
error: {
|
|
8395
9502
|
message: config.error.message,
|
|
8396
9503
|
status: null
|
|
@@ -8422,8 +9529,9 @@ const generateCommand = {
|
|
|
8422
9529
|
});
|
|
8423
9530
|
else outputError({
|
|
8424
9531
|
argv,
|
|
8425
|
-
command: COMMAND$
|
|
8426
|
-
error: result.error
|
|
9532
|
+
command: COMMAND$13,
|
|
9533
|
+
error: result.error,
|
|
9534
|
+
hint: "Verify the project and thread IDs are correct"
|
|
8427
9535
|
});
|
|
8428
9536
|
process.exitCode = 1;
|
|
8429
9537
|
return;
|
|
@@ -8567,7 +9675,7 @@ const projectAuthCommand = {
|
|
|
8567
9675
|
|
|
8568
9676
|
//#endregion
|
|
8569
9677
|
//#region src/commands/info.ts
|
|
8570
|
-
const COMMAND$
|
|
9678
|
+
const COMMAND$12 = "projects get";
|
|
8571
9679
|
const infoCommand = {
|
|
8572
9680
|
command: "info <projectId>",
|
|
8573
9681
|
describe: "Get app info and dev server status",
|
|
@@ -8584,7 +9692,7 @@ const infoCommand = {
|
|
|
8584
9692
|
if (config.isErr()) {
|
|
8585
9693
|
outputError({
|
|
8586
9694
|
argv,
|
|
8587
|
-
command: COMMAND$
|
|
9695
|
+
command: COMMAND$12,
|
|
8588
9696
|
error: {
|
|
8589
9697
|
message: config.error.message,
|
|
8590
9698
|
status: null
|
|
@@ -8597,29 +9705,34 @@ const infoCommand = {
|
|
|
8597
9705
|
if (result.isErr()) {
|
|
8598
9706
|
outputError({
|
|
8599
9707
|
argv,
|
|
8600
|
-
command: COMMAND$
|
|
8601
|
-
error: result.error
|
|
9708
|
+
command: COMMAND$12,
|
|
9709
|
+
error: result.error,
|
|
9710
|
+
hint: "Check the project ID with: anything projects list --json"
|
|
8602
9711
|
});
|
|
8603
9712
|
return;
|
|
8604
9713
|
}
|
|
9714
|
+
const info = result.value;
|
|
9715
|
+
const latestPublishedUrl = info.latestPublishedUrl ?? (info.slug ? `https://${info.slug}.created.app` : null);
|
|
8605
9716
|
if (outputSuccess({
|
|
8606
9717
|
argv,
|
|
8607
|
-
command: COMMAND$
|
|
8608
|
-
data:
|
|
9718
|
+
command: COMMAND$12,
|
|
9719
|
+
data: {
|
|
9720
|
+
...info,
|
|
9721
|
+
latestPublishedUrl
|
|
9722
|
+
},
|
|
8609
9723
|
primaryId: result.value.id
|
|
8610
9724
|
})) return;
|
|
8611
|
-
const info = result.value;
|
|
8612
9725
|
console.log();
|
|
8613
9726
|
printLabel("Name", info.name);
|
|
8614
9727
|
printLabel("ID", info.id);
|
|
8615
9728
|
printLabel("Slug", info.slug);
|
|
8616
9729
|
printLabel("Filesystem", info.filesystemVersion);
|
|
8617
9730
|
printLabel("Dev Server", info.devServerUrl);
|
|
8618
|
-
printLabel("Published URL",
|
|
9731
|
+
printLabel("Published URL", latestPublishedUrl);
|
|
8619
9732
|
printLabel("Created", new Date(info.createdAt).toLocaleString());
|
|
8620
9733
|
printLabel("Updated", new Date(info.updatedAt).toLocaleString());
|
|
8621
9734
|
for (const url of info.publishedUrls) printLabel("Published URL", url);
|
|
8622
|
-
if (info.
|
|
9735
|
+
if (info.files.length > 0) {
|
|
8623
9736
|
console.log();
|
|
8624
9737
|
printTable({
|
|
8625
9738
|
headers: [
|
|
@@ -8628,10 +9741,10 @@ const infoCommand = {
|
|
|
8628
9741
|
"Path",
|
|
8629
9742
|
"ID"
|
|
8630
9743
|
],
|
|
8631
|
-
rows: info.
|
|
9744
|
+
rows: info.files.map((p) => [
|
|
8632
9745
|
p.name,
|
|
8633
9746
|
p.moduleType,
|
|
8634
|
-
p.pathSegment ?? "",
|
|
9747
|
+
p.path ?? p.pathSegment ?? "",
|
|
8635
9748
|
p.id
|
|
8636
9749
|
])
|
|
8637
9750
|
});
|
|
@@ -8641,7 +9754,7 @@ const infoCommand = {
|
|
|
8641
9754
|
|
|
8642
9755
|
//#endregion
|
|
8643
9756
|
//#region src/commands/list-projects.ts
|
|
8644
|
-
const COMMAND$
|
|
9757
|
+
const COMMAND$11 = "projects list";
|
|
8645
9758
|
const listProjectsCommand = {
|
|
8646
9759
|
command: "list",
|
|
8647
9760
|
describe: "List projects you can access",
|
|
@@ -8664,7 +9777,7 @@ const listProjectsCommand = {
|
|
|
8664
9777
|
if (config.isErr()) {
|
|
8665
9778
|
outputError({
|
|
8666
9779
|
argv,
|
|
8667
|
-
command: COMMAND$
|
|
9780
|
+
command: COMMAND$11,
|
|
8668
9781
|
error: {
|
|
8669
9782
|
message: config.error.message,
|
|
8670
9783
|
status: null
|
|
@@ -8686,7 +9799,7 @@ const listProjectsCommand = {
|
|
|
8686
9799
|
if (result.isErr()) {
|
|
8687
9800
|
outputError({
|
|
8688
9801
|
argv,
|
|
8689
|
-
command: COMMAND$
|
|
9802
|
+
command: COMMAND$11,
|
|
8690
9803
|
error: result.error
|
|
8691
9804
|
});
|
|
8692
9805
|
return;
|
|
@@ -8697,7 +9810,7 @@ const listProjectsCommand = {
|
|
|
8697
9810
|
}
|
|
8698
9811
|
if (outputSuccess({
|
|
8699
9812
|
argv,
|
|
8700
|
-
command: COMMAND$
|
|
9813
|
+
command: COMMAND$11,
|
|
8701
9814
|
data: result.value
|
|
8702
9815
|
})) return;
|
|
8703
9816
|
if (result.value.projects.length === 0) {
|
|
@@ -8723,7 +9836,7 @@ const listProjectsCommand = {
|
|
|
8723
9836
|
|
|
8724
9837
|
//#endregion
|
|
8725
9838
|
//#region src/commands/logs.ts
|
|
8726
|
-
const COMMAND$
|
|
9839
|
+
const COMMAND$10 = "projects logs";
|
|
8727
9840
|
const DEFAULT_POLL_INTERVAL_MS$1 = 3e3;
|
|
8728
9841
|
const IDLE_TIMEOUT_MS$1 = 300 * 1e3;
|
|
8729
9842
|
function parseSince(since) {
|
|
@@ -8803,7 +9916,7 @@ const logsCommand = {
|
|
|
8803
9916
|
if (config.isErr()) {
|
|
8804
9917
|
outputError({
|
|
8805
9918
|
argv,
|
|
8806
|
-
command: COMMAND$
|
|
9919
|
+
command: COMMAND$10,
|
|
8807
9920
|
error: {
|
|
8808
9921
|
message: config.error.message,
|
|
8809
9922
|
status: null
|
|
@@ -8823,7 +9936,7 @@ const logsCommand = {
|
|
|
8823
9936
|
if (result.isErr()) {
|
|
8824
9937
|
outputError({
|
|
8825
9938
|
argv,
|
|
8826
|
-
command: COMMAND$
|
|
9939
|
+
command: COMMAND$10,
|
|
8827
9940
|
error: result.error
|
|
8828
9941
|
});
|
|
8829
9942
|
return;
|
|
@@ -8833,7 +9946,7 @@ const logsCommand = {
|
|
|
8833
9946
|
if (!argv.follow) {
|
|
8834
9947
|
if (outputSuccess({
|
|
8835
9948
|
argv,
|
|
8836
|
-
command: COMMAND$
|
|
9949
|
+
command: COMMAND$10,
|
|
8837
9950
|
data: { logs }
|
|
8838
9951
|
})) return;
|
|
8839
9952
|
if (logs.length === 0) {
|
|
@@ -8895,7 +10008,7 @@ const logsCommand = {
|
|
|
8895
10008
|
|
|
8896
10009
|
//#endregion
|
|
8897
10010
|
//#region src/commands/messages.ts
|
|
8898
|
-
const COMMAND$
|
|
10011
|
+
const COMMAND$9 = "projects messages";
|
|
8899
10012
|
function formatMessage(msg) {
|
|
8900
10013
|
const time = new Date(msg.createdAt).toLocaleString();
|
|
8901
10014
|
const status = msg.status === "VALID" ? styleText("green", msg.status) : msg.status === "BUILDING" ? styleText("yellow", msg.status) : styleText("red", msg.status);
|
|
@@ -8926,7 +10039,7 @@ const messagesCommand = {
|
|
|
8926
10039
|
if (config.isErr()) {
|
|
8927
10040
|
outputError({
|
|
8928
10041
|
argv,
|
|
8929
|
-
command: COMMAND$
|
|
10042
|
+
command: COMMAND$9,
|
|
8930
10043
|
error: {
|
|
8931
10044
|
message: config.error.message,
|
|
8932
10045
|
status: null
|
|
@@ -8943,14 +10056,14 @@ const messagesCommand = {
|
|
|
8943
10056
|
if (result.isErr()) {
|
|
8944
10057
|
outputError({
|
|
8945
10058
|
argv,
|
|
8946
|
-
command: COMMAND$
|
|
10059
|
+
command: COMMAND$9,
|
|
8947
10060
|
error: result.error
|
|
8948
10061
|
});
|
|
8949
10062
|
return;
|
|
8950
10063
|
}
|
|
8951
10064
|
if (outputSuccess({
|
|
8952
10065
|
argv,
|
|
8953
|
-
command: COMMAND$
|
|
10066
|
+
command: COMMAND$9,
|
|
8954
10067
|
data: result.value
|
|
8955
10068
|
})) return;
|
|
8956
10069
|
const { messages } = result.value;
|
|
@@ -8964,10 +10077,10 @@ const messagesCommand = {
|
|
|
8964
10077
|
|
|
8965
10078
|
//#endregion
|
|
8966
10079
|
//#region src/commands/project-status.ts
|
|
8967
|
-
const COMMAND$
|
|
10080
|
+
const COMMAND$8 = "projects status";
|
|
8968
10081
|
const projectStatusCommand = {
|
|
8969
10082
|
command: "status <projectId>",
|
|
8970
|
-
describe: "
|
|
10083
|
+
describe: "Show the latest revision status and deployment summary (lightweight, for polling)",
|
|
8971
10084
|
builder: (yargs) => yargs.positional("projectId", {
|
|
8972
10085
|
type: "string",
|
|
8973
10086
|
demandOption: true,
|
|
@@ -8981,7 +10094,7 @@ const projectStatusCommand = {
|
|
|
8981
10094
|
if (config.isErr()) {
|
|
8982
10095
|
outputError({
|
|
8983
10096
|
argv,
|
|
8984
|
-
command: COMMAND$
|
|
10097
|
+
command: COMMAND$8,
|
|
8985
10098
|
error: {
|
|
8986
10099
|
message: config.error.message,
|
|
8987
10100
|
status: null
|
|
@@ -8994,20 +10107,24 @@ const projectStatusCommand = {
|
|
|
8994
10107
|
if (result.isErr()) {
|
|
8995
10108
|
outputError({
|
|
8996
10109
|
argv,
|
|
8997
|
-
command: COMMAND$
|
|
10110
|
+
command: COMMAND$8,
|
|
8998
10111
|
error: result.error
|
|
8999
10112
|
});
|
|
9000
10113
|
return;
|
|
9001
10114
|
}
|
|
10115
|
+
const { projectGroupId: projectId, ...statusRest } = result.value;
|
|
9002
10116
|
if (outputSuccess({
|
|
9003
10117
|
argv,
|
|
9004
|
-
command: COMMAND$
|
|
9005
|
-
data:
|
|
9006
|
-
|
|
10118
|
+
command: COMMAND$8,
|
|
10119
|
+
data: {
|
|
10120
|
+
projectId,
|
|
10121
|
+
...statusRest
|
|
10122
|
+
},
|
|
10123
|
+
primaryId: projectId
|
|
9007
10124
|
})) return;
|
|
9008
10125
|
const status = result.value;
|
|
9009
10126
|
console.log();
|
|
9010
|
-
printLabel("Project", status.projectGroupId);
|
|
10127
|
+
printLabel("Project ID", status.projectGroupId);
|
|
9011
10128
|
printLabel("Status", status.status ?? "(no revisions yet)");
|
|
9012
10129
|
printLabel("Latest Revision", status.latestRevisionId);
|
|
9013
10130
|
printLabel("Updated", new Date(status.updatedAt).toLocaleString());
|
|
@@ -9018,7 +10135,7 @@ const projectStatusCommand = {
|
|
|
9018
10135
|
|
|
9019
10136
|
//#endregion
|
|
9020
10137
|
//#region src/commands/rename.ts
|
|
9021
|
-
const COMMAND$
|
|
10138
|
+
const COMMAND$7 = "projects rename";
|
|
9022
10139
|
const renameCommand = {
|
|
9023
10140
|
command: "rename <projectId>",
|
|
9024
10141
|
describe: "Rename a project",
|
|
@@ -9036,7 +10153,7 @@ const renameCommand = {
|
|
|
9036
10153
|
if (name.length === 0) {
|
|
9037
10154
|
outputError({
|
|
9038
10155
|
argv,
|
|
9039
|
-
command: COMMAND$
|
|
10156
|
+
command: COMMAND$7,
|
|
9040
10157
|
error: {
|
|
9041
10158
|
message: "Project name cannot be empty.",
|
|
9042
10159
|
status: null
|
|
@@ -9048,7 +10165,7 @@ const renameCommand = {
|
|
|
9048
10165
|
if (argv["dry-run"]) {
|
|
9049
10166
|
outputDryRun({
|
|
9050
10167
|
argv,
|
|
9051
|
-
command: COMMAND$
|
|
10168
|
+
command: COMMAND$7,
|
|
9052
10169
|
plannedActions: [{
|
|
9053
10170
|
action: "rename_project",
|
|
9054
10171
|
projectGroupId: argv.projectId,
|
|
@@ -9065,7 +10182,7 @@ const renameCommand = {
|
|
|
9065
10182
|
if (config.isErr()) {
|
|
9066
10183
|
outputError({
|
|
9067
10184
|
argv,
|
|
9068
|
-
command: COMMAND$
|
|
10185
|
+
command: COMMAND$7,
|
|
9069
10186
|
error: {
|
|
9070
10187
|
message: config.error.message,
|
|
9071
10188
|
status: null
|
|
@@ -9081,7 +10198,7 @@ const renameCommand = {
|
|
|
9081
10198
|
if (result.isErr()) {
|
|
9082
10199
|
outputError({
|
|
9083
10200
|
argv,
|
|
9084
|
-
command: COMMAND$
|
|
10201
|
+
command: COMMAND$7,
|
|
9085
10202
|
error: result.error
|
|
9086
10203
|
});
|
|
9087
10204
|
return;
|
|
@@ -9089,7 +10206,7 @@ const renameCommand = {
|
|
|
9089
10206
|
const { projectGroupId: projectId, ...renameData } = result.value;
|
|
9090
10207
|
if (outputSuccess({
|
|
9091
10208
|
argv,
|
|
9092
|
-
command: COMMAND$
|
|
10209
|
+
command: COMMAND$7,
|
|
9093
10210
|
data: {
|
|
9094
10211
|
projectId,
|
|
9095
10212
|
...renameData
|
|
@@ -9609,6 +10726,11 @@ async function waitForSubmission({ client, projectGroupId, submission }) {
|
|
|
9609
10726
|
return ok(current);
|
|
9610
10727
|
}
|
|
9611
10728
|
function printSubmissionResult({ argv, command, pendingMessage, submission }) {
|
|
10729
|
+
const { projectGroupId: projectId, ...submissionRest } = submission;
|
|
10730
|
+
const submissionOut = {
|
|
10731
|
+
projectId,
|
|
10732
|
+
...submissionRest
|
|
10733
|
+
};
|
|
9612
10734
|
if (submission.status === "FAILED") {
|
|
9613
10735
|
printError(submission.errorMessage ?? "Submission failed.");
|
|
9614
10736
|
process.exitCode = 1;
|
|
@@ -9620,7 +10742,7 @@ function printSubmissionResult({ argv, command, pendingMessage, submission }) {
|
|
|
9620
10742
|
command,
|
|
9621
10743
|
data: {
|
|
9622
10744
|
success: true,
|
|
9623
|
-
submission
|
|
10745
|
+
submission: submissionOut
|
|
9624
10746
|
},
|
|
9625
10747
|
primaryId: submission.id
|
|
9626
10748
|
})) return;
|
|
@@ -9786,7 +10908,7 @@ const submitCommand = {
|
|
|
9786
10908
|
|
|
9787
10909
|
//#endregion
|
|
9788
10910
|
//#region src/commands/unpublish.ts
|
|
9789
|
-
const COMMAND$
|
|
10911
|
+
const COMMAND$6 = "projects unpublish";
|
|
9790
10912
|
const unpublishCommand = {
|
|
9791
10913
|
command: "unpublish <projectId>",
|
|
9792
10914
|
describe: "Unpublish an app from production",
|
|
@@ -9803,7 +10925,7 @@ const unpublishCommand = {
|
|
|
9803
10925
|
if (!argv.yes && !isNonInteractive(argv)) {
|
|
9804
10926
|
outputError({
|
|
9805
10927
|
argv,
|
|
9806
|
-
command: COMMAND$
|
|
10928
|
+
command: COMMAND$6,
|
|
9807
10929
|
error: {
|
|
9808
10930
|
message: "Pass --yes to unpublish this app.",
|
|
9809
10931
|
status: null
|
|
@@ -9815,9 +10937,89 @@ const unpublishCommand = {
|
|
|
9815
10937
|
if (argv["dry-run"]) {
|
|
9816
10938
|
outputDryRun({
|
|
9817
10939
|
argv,
|
|
9818
|
-
command: COMMAND$
|
|
10940
|
+
command: COMMAND$6,
|
|
10941
|
+
plannedActions: [{
|
|
10942
|
+
action: "unpublish_project",
|
|
10943
|
+
projectGroupId: argv.projectId
|
|
10944
|
+
}]
|
|
10945
|
+
});
|
|
10946
|
+
return;
|
|
10947
|
+
}
|
|
10948
|
+
const config = resolveConfig({
|
|
10949
|
+
dev: argv.dev,
|
|
10950
|
+
apiUrl: argv.apiUrl
|
|
10951
|
+
});
|
|
10952
|
+
if (config.isErr()) {
|
|
10953
|
+
outputError({
|
|
10954
|
+
argv,
|
|
10955
|
+
command: COMMAND$6,
|
|
10956
|
+
error: {
|
|
10957
|
+
message: config.error.message,
|
|
10958
|
+
status: null
|
|
10959
|
+
},
|
|
10960
|
+
exitCode: 4
|
|
10961
|
+
});
|
|
10962
|
+
return;
|
|
10963
|
+
}
|
|
10964
|
+
const startTime = performance.now();
|
|
10965
|
+
const result = await new AnythingApiClient(config.value).unpublish({ projectGroupId: argv.projectId });
|
|
10966
|
+
if (result.isErr()) {
|
|
10967
|
+
outputError({
|
|
10968
|
+
argv,
|
|
10969
|
+
command: COMMAND$6,
|
|
10970
|
+
error: result.error
|
|
10971
|
+
});
|
|
10972
|
+
return;
|
|
10973
|
+
}
|
|
10974
|
+
const { projectGroupId: projectId, ...unpublishData } = result.value;
|
|
10975
|
+
if (outputSuccess({
|
|
10976
|
+
argv,
|
|
10977
|
+
command: COMMAND$6,
|
|
10978
|
+
data: {
|
|
10979
|
+
projectId,
|
|
10980
|
+
...unpublishData
|
|
10981
|
+
},
|
|
10982
|
+
primaryId: projectId,
|
|
10983
|
+
startTime
|
|
10984
|
+
})) return;
|
|
10985
|
+
printSuccess("App unpublished.");
|
|
10986
|
+
}
|
|
10987
|
+
};
|
|
10988
|
+
|
|
10989
|
+
//#endregion
|
|
10990
|
+
//#region src/commands/delete-project.ts
|
|
10991
|
+
const COMMAND$5 = "projects delete";
|
|
10992
|
+
const deleteProjectCommand = {
|
|
10993
|
+
command: "delete <projectId>",
|
|
10994
|
+
describe: "Delete a project permanently (gated behind the project-delete-enabled flag; returns 404 when disabled)",
|
|
10995
|
+
builder: (yargs) => yargs.positional("projectId", {
|
|
10996
|
+
type: "string",
|
|
10997
|
+
demandOption: true,
|
|
10998
|
+
describe: "The project ID"
|
|
10999
|
+
}).option("yes", {
|
|
11000
|
+
type: "boolean",
|
|
11001
|
+
default: false,
|
|
11002
|
+
describe: "Confirm deletion without prompting"
|
|
11003
|
+
}).example("anything projects delete <project-id> --yes", "Delete a project permanently").example("anything projects delete <project-id> --yes --json", "Delete a project and capture the result in JSON"),
|
|
11004
|
+
handler: async (argv) => {
|
|
11005
|
+
if (!argv.yes && !isNonInteractive(argv)) {
|
|
11006
|
+
outputError({
|
|
11007
|
+
argv,
|
|
11008
|
+
command: COMMAND$5,
|
|
11009
|
+
error: {
|
|
11010
|
+
message: "Project deletion is destructive and cannot be undone. Pass --yes to confirm.",
|
|
11011
|
+
status: null
|
|
11012
|
+
},
|
|
11013
|
+
exitCode: 2
|
|
11014
|
+
});
|
|
11015
|
+
return;
|
|
11016
|
+
}
|
|
11017
|
+
if (argv["dry-run"]) {
|
|
11018
|
+
outputDryRun({
|
|
11019
|
+
argv,
|
|
11020
|
+
command: COMMAND$5,
|
|
9819
11021
|
plannedActions: [{
|
|
9820
|
-
action: "
|
|
11022
|
+
action: "delete_project",
|
|
9821
11023
|
projectGroupId: argv.projectId
|
|
9822
11024
|
}]
|
|
9823
11025
|
});
|
|
@@ -9830,7 +11032,7 @@ const unpublishCommand = {
|
|
|
9830
11032
|
if (config.isErr()) {
|
|
9831
11033
|
outputError({
|
|
9832
11034
|
argv,
|
|
9833
|
-
command: COMMAND$
|
|
11035
|
+
command: COMMAND$5,
|
|
9834
11036
|
error: {
|
|
9835
11037
|
message: config.error.message,
|
|
9836
11038
|
status: null
|
|
@@ -9840,27 +11042,27 @@ const unpublishCommand = {
|
|
|
9840
11042
|
return;
|
|
9841
11043
|
}
|
|
9842
11044
|
const startTime = performance.now();
|
|
9843
|
-
const result = await new AnythingApiClient(config.value).
|
|
11045
|
+
const result = await new AnythingApiClient(config.value).deleteProject({ projectGroupId: argv.projectId });
|
|
9844
11046
|
if (result.isErr()) {
|
|
9845
11047
|
outputError({
|
|
9846
11048
|
argv,
|
|
9847
|
-
command: COMMAND$
|
|
11049
|
+
command: COMMAND$5,
|
|
9848
11050
|
error: result.error
|
|
9849
11051
|
});
|
|
9850
11052
|
return;
|
|
9851
11053
|
}
|
|
9852
|
-
const { projectGroupId: projectId
|
|
11054
|
+
const { projectGroupId: projectId } = result.value;
|
|
9853
11055
|
if (outputSuccess({
|
|
9854
11056
|
argv,
|
|
9855
|
-
command: COMMAND$
|
|
11057
|
+
command: COMMAND$5,
|
|
9856
11058
|
data: {
|
|
9857
11059
|
projectId,
|
|
9858
|
-
|
|
11060
|
+
deleted: true
|
|
9859
11061
|
},
|
|
9860
11062
|
primaryId: projectId,
|
|
9861
11063
|
startTime
|
|
9862
11064
|
})) return;
|
|
9863
|
-
printSuccess("
|
|
11065
|
+
printSuccess("Project deleted.");
|
|
9864
11066
|
}
|
|
9865
11067
|
};
|
|
9866
11068
|
|
|
@@ -9918,6 +11120,10 @@ const projectsUnpublishCommand = {
|
|
|
9918
11120
|
...unpublishCommand,
|
|
9919
11121
|
command: "unpublish <projectId>"
|
|
9920
11122
|
};
|
|
11123
|
+
const projectsDeleteCommand = {
|
|
11124
|
+
...deleteProjectCommand,
|
|
11125
|
+
command: "delete <projectId>"
|
|
11126
|
+
};
|
|
9921
11127
|
const projectsSubmitCommand = {
|
|
9922
11128
|
...submitCommand,
|
|
9923
11129
|
command: "submit <projectId>"
|
|
@@ -9967,7 +11173,7 @@ const projectsUnsetCommand = {
|
|
|
9967
11173
|
const projectsCommand = {
|
|
9968
11174
|
command: "projects",
|
|
9969
11175
|
describe: "Manage Anything projects",
|
|
9970
|
-
builder: (yargs) => yargs.command(projectsListCommand).command(projectsCreateCommand).command(projectsDuplicateCommand).command(projectsGenerateCommand).command(projectsGetCommand).command(projectsRenameCommand).command(projectsMessagesCommand).command(projectsStatusCommand).command(projectsFilesCommand).command(projectAuthCommand).command(projectsLogsCommand).command(projectsSecretsCommand).command(projectsPublishCommand).command(projectsSubmitCommand).command(projectsUnpublishCommand).command(projectsSetCommand).command(projectsUnsetCommand).command(settingsCommand).example("anything projects create --org <org-id> --prompt todo-app", "Create a new app").example("anything projects generate <project-id> --prompt add-auth", "Iterate on an existing app").example("anything projects duplicate <project-id> --name \"My Copy\"", "Duplicate an app").example("anything projects publish <project-id> --slug my-app", "Publish an app").example("anything projects submit <project-id> --store app-store", "Start an App Store submission").example("anything projects unpublish <project-id> --yes", "Remove a published app from production").example("anything projects get <project-id> --json", "Inspect an app in JSON").example("anything projects rename <project-id> --name \"My App\"", "Rename a project").example("anything projects auth providers <project-id> --json", "Inspect auth provider settings in JSON").demandCommand(1, "Specify a projects subcommand. Run `anything projects --help` for usage."),
|
|
11176
|
+
builder: (yargs) => yargs.command(projectsListCommand).command(projectsCreateCommand).command(projectsDuplicateCommand).command(projectsGenerateCommand).command(projectsGetCommand).command(projectsRenameCommand).command(projectsMessagesCommand).command(projectsStatusCommand).command(projectsFilesCommand).command(projectAuthCommand).command(projectsLogsCommand).command(projectsSecretsCommand).command(projectsPublishCommand).command(projectsSubmitCommand).command(projectsUnpublishCommand).command(projectsDeleteCommand).command(projectsSetCommand).command(projectsUnsetCommand).command(settingsCommand).example("anything projects create --org <org-id> --prompt todo-app", "Create a new app").example("anything projects generate <project-id> --prompt add-auth", "Iterate on an existing app").example("anything projects duplicate <project-id> --name \"My Copy\"", "Duplicate an app").example("anything projects publish <project-id> --slug my-app", "Publish an app").example("anything projects submit <project-id> --store app-store", "Start an App Store submission").example("anything projects unpublish <project-id> --yes", "Remove a published app from production").example("anything projects delete <project-id> --yes", "Delete a project permanently").example("anything projects get <project-id> --json", "Inspect an app in JSON").example("anything projects rename <project-id> --name \"My App\"", "Rename a project").example("anything projects auth providers <project-id> --json", "Inspect auth provider settings in JSON").demandCommand(1, "Specify a projects subcommand. Run `anything projects --help` for usage."),
|
|
9971
11177
|
handler: () => {}
|
|
9972
11178
|
};
|
|
9973
11179
|
|
|
@@ -10088,7 +11294,7 @@ const pullCommand = {
|
|
|
10088
11294
|
|
|
10089
11295
|
//#endregion
|
|
10090
11296
|
//#region src/commands/ship.ts
|
|
10091
|
-
const COMMAND$
|
|
11297
|
+
const COMMAND$4 = "ship";
|
|
10092
11298
|
const shipCommand = {
|
|
10093
11299
|
command: "ship",
|
|
10094
11300
|
describe: "Create or update + generate + publish in one shot",
|
|
@@ -10125,7 +11331,7 @@ const shipCommand = {
|
|
|
10125
11331
|
if (!promptResult.ok) {
|
|
10126
11332
|
outputValidationError({
|
|
10127
11333
|
argv,
|
|
10128
|
-
command: COMMAND$
|
|
11334
|
+
command: COMMAND$4,
|
|
10129
11335
|
message: promptResult.error
|
|
10130
11336
|
});
|
|
10131
11337
|
return;
|
|
@@ -10137,7 +11343,7 @@ const shipCommand = {
|
|
|
10137
11343
|
if (config.isErr()) {
|
|
10138
11344
|
outputError({
|
|
10139
11345
|
argv,
|
|
10140
|
-
command: COMMAND$
|
|
11346
|
+
command: COMMAND$4,
|
|
10141
11347
|
error: {
|
|
10142
11348
|
message: config.error.message,
|
|
10143
11349
|
status: null
|
|
@@ -10159,7 +11365,7 @@ const shipCommand = {
|
|
|
10159
11365
|
if (!orgResult.ok) {
|
|
10160
11366
|
outputError({
|
|
10161
11367
|
argv,
|
|
10162
|
-
command: COMMAND$
|
|
11368
|
+
command: COMMAND$4,
|
|
10163
11369
|
error: {
|
|
10164
11370
|
message: orgResult.error,
|
|
10165
11371
|
status: null
|
|
@@ -10182,7 +11388,7 @@ const shipCommand = {
|
|
|
10182
11388
|
if (createResult.isErr()) {
|
|
10183
11389
|
outputError({
|
|
10184
11390
|
argv,
|
|
10185
|
-
command: COMMAND$
|
|
11391
|
+
command: COMMAND$4,
|
|
10186
11392
|
error: createResult.error
|
|
10187
11393
|
});
|
|
10188
11394
|
return;
|
|
@@ -10210,7 +11416,7 @@ const shipCommand = {
|
|
|
10210
11416
|
if (genResult.isErr()) {
|
|
10211
11417
|
outputError({
|
|
10212
11418
|
argv,
|
|
10213
|
-
command: COMMAND$
|
|
11419
|
+
command: COMMAND$4,
|
|
10214
11420
|
error: genResult.error
|
|
10215
11421
|
});
|
|
10216
11422
|
return;
|
|
@@ -10237,7 +11443,7 @@ const shipCommand = {
|
|
|
10237
11443
|
if (argv.json || argv.quiet) process.exitCode = 1;
|
|
10238
11444
|
else outputError({
|
|
10239
11445
|
argv,
|
|
10240
|
-
command: COMMAND$
|
|
11446
|
+
command: COMMAND$4,
|
|
10241
11447
|
error: {
|
|
10242
11448
|
message: "Generation failed. Skipping publish.",
|
|
10243
11449
|
status: null
|
|
@@ -10274,7 +11480,7 @@ const shipCommand = {
|
|
|
10274
11480
|
if (publishResult.isErr()) {
|
|
10275
11481
|
outputError({
|
|
10276
11482
|
argv,
|
|
10277
|
-
command: COMMAND$
|
|
11483
|
+
command: COMMAND$4,
|
|
10278
11484
|
error: publishResult.error
|
|
10279
11485
|
});
|
|
10280
11486
|
return;
|
|
@@ -10289,7 +11495,7 @@ const shipCommand = {
|
|
|
10289
11495
|
if (deployResult.isErr()) {
|
|
10290
11496
|
outputError({
|
|
10291
11497
|
argv,
|
|
10292
|
-
command: COMMAND$
|
|
11498
|
+
command: COMMAND$4,
|
|
10293
11499
|
error: deployResult.error
|
|
10294
11500
|
});
|
|
10295
11501
|
return;
|
|
@@ -10301,7 +11507,7 @@ const shipCommand = {
|
|
|
10301
11507
|
if (deployError) {
|
|
10302
11508
|
outputError({
|
|
10303
11509
|
argv,
|
|
10304
|
-
command: COMMAND$
|
|
11510
|
+
command: COMMAND$4,
|
|
10305
11511
|
error: {
|
|
10306
11512
|
message: deployError.message,
|
|
10307
11513
|
status: null
|
|
@@ -10403,7 +11609,7 @@ const skillCommand = {
|
|
|
10403
11609
|
|
|
10404
11610
|
//#endregion
|
|
10405
11611
|
//#region src/commands/status-cmd.ts
|
|
10406
|
-
const COMMAND$
|
|
11612
|
+
const COMMAND$3 = "status";
|
|
10407
11613
|
const statusCommand = {
|
|
10408
11614
|
command: "status",
|
|
10409
11615
|
describe: "Show current org, project, user, and auth state",
|
|
@@ -10418,7 +11624,7 @@ const statusCommand = {
|
|
|
10418
11624
|
if (configResult.isErr()) {
|
|
10419
11625
|
outputError({
|
|
10420
11626
|
argv,
|
|
10421
|
-
command: COMMAND$
|
|
11627
|
+
command: COMMAND$3,
|
|
10422
11628
|
error: {
|
|
10423
11629
|
message: configResult.error.message,
|
|
10424
11630
|
status: null
|
|
@@ -10443,7 +11649,7 @@ const statusCommand = {
|
|
|
10443
11649
|
}
|
|
10444
11650
|
if (outputSuccess({
|
|
10445
11651
|
argv,
|
|
10446
|
-
command: COMMAND$
|
|
11652
|
+
command: COMMAND$3,
|
|
10447
11653
|
data: {
|
|
10448
11654
|
authenticated: true,
|
|
10449
11655
|
credentialSource,
|
|
@@ -10479,7 +11685,7 @@ const statusCommand = {
|
|
|
10479
11685
|
|
|
10480
11686
|
//#endregion
|
|
10481
11687
|
//#region src/commands/switch.ts
|
|
10482
|
-
const COMMAND$
|
|
11688
|
+
const COMMAND$2 = "switch";
|
|
10483
11689
|
const switchCommand = {
|
|
10484
11690
|
command: "switch",
|
|
10485
11691
|
describe: "Interactive org/project picker",
|
|
@@ -10488,7 +11694,7 @@ const switchCommand = {
|
|
|
10488
11694
|
if (isNonInteractive(argv)) {
|
|
10489
11695
|
outputError({
|
|
10490
11696
|
argv,
|
|
10491
|
-
command: COMMAND$
|
|
11697
|
+
command: COMMAND$2,
|
|
10492
11698
|
error: {
|
|
10493
11699
|
message: "Switch requires interactive mode. Use `anything orgs set <id>` and `anything projects set <id>` instead.",
|
|
10494
11700
|
status: null
|
|
@@ -10504,7 +11710,7 @@ const switchCommand = {
|
|
|
10504
11710
|
if (config.isErr()) {
|
|
10505
11711
|
outputError({
|
|
10506
11712
|
argv,
|
|
10507
|
-
command: COMMAND$
|
|
11713
|
+
command: COMMAND$2,
|
|
10508
11714
|
error: {
|
|
10509
11715
|
message: config.error.message,
|
|
10510
11716
|
status: null
|
|
@@ -10518,7 +11724,7 @@ const switchCommand = {
|
|
|
10518
11724
|
if (me.isErr()) {
|
|
10519
11725
|
outputError({
|
|
10520
11726
|
argv,
|
|
10521
|
-
command: COMMAND$
|
|
11727
|
+
command: COMMAND$2,
|
|
10522
11728
|
error: me.error
|
|
10523
11729
|
});
|
|
10524
11730
|
return;
|
|
@@ -10527,7 +11733,7 @@ const switchCommand = {
|
|
|
10527
11733
|
if (orgs.length === 0) {
|
|
10528
11734
|
outputError({
|
|
10529
11735
|
argv,
|
|
10530
|
-
command: COMMAND$
|
|
11736
|
+
command: COMMAND$2,
|
|
10531
11737
|
error: {
|
|
10532
11738
|
message: "No organizations found.",
|
|
10533
11739
|
status: null
|
|
@@ -10569,7 +11775,7 @@ const switchCommand = {
|
|
|
10569
11775
|
setStoredProjectGroupId(projectChoice.id);
|
|
10570
11776
|
if (outputSuccess({
|
|
10571
11777
|
argv,
|
|
10572
|
-
command: COMMAND$
|
|
11778
|
+
command: COMMAND$2,
|
|
10573
11779
|
data: {
|
|
10574
11780
|
orgId: selectedOrg.id,
|
|
10575
11781
|
orgName: selectedOrg.name,
|
|
@@ -10585,7 +11791,7 @@ const switchCommand = {
|
|
|
10585
11791
|
}
|
|
10586
11792
|
if (outputSuccess({
|
|
10587
11793
|
argv,
|
|
10588
|
-
command: COMMAND$
|
|
11794
|
+
command: COMMAND$2,
|
|
10589
11795
|
data: {
|
|
10590
11796
|
orgId: selectedOrg.id,
|
|
10591
11797
|
orgName: selectedOrg.name
|
|
@@ -10596,6 +11802,284 @@ const switchCommand = {
|
|
|
10596
11802
|
}
|
|
10597
11803
|
};
|
|
10598
11804
|
|
|
11805
|
+
//#endregion
|
|
11806
|
+
//#region src/update-check.ts
|
|
11807
|
+
const PACKAGE_NAME = "@anythingai/cli";
|
|
11808
|
+
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
11809
|
+
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
11810
|
+
const NOTICE_FETCH_TIMEOUT_MS = 1500;
|
|
11811
|
+
const latestManifestSchema = z.object({ version: z.string() });
|
|
11812
|
+
function isNewerVersion(candidate, current) {
|
|
11813
|
+
const core = (v) => (v.split("-")[0] ?? "").split(".").map((part) => Number.parseInt(part, 10));
|
|
11814
|
+
const a = core(candidate);
|
|
11815
|
+
const b = core(current);
|
|
11816
|
+
if ([...a, ...b].some(Number.isNaN)) return false;
|
|
11817
|
+
for (let i = 0; i < 3; i++) {
|
|
11818
|
+
const left = a[i] ?? 0;
|
|
11819
|
+
const right = b[i] ?? 0;
|
|
11820
|
+
if (left !== right) return left > right;
|
|
11821
|
+
}
|
|
11822
|
+
return false;
|
|
11823
|
+
}
|
|
11824
|
+
async function fetchLatestVersion({ timeoutMs }) {
|
|
11825
|
+
try {
|
|
11826
|
+
const response = await fetch(REGISTRY_URL, {
|
|
11827
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
11828
|
+
headers: { accept: "application/json" }
|
|
11829
|
+
});
|
|
11830
|
+
if (!response.ok) return null;
|
|
11831
|
+
const parsed = latestManifestSchema.safeParse(await response.json());
|
|
11832
|
+
return parsed.success ? parsed.data.version : null;
|
|
11833
|
+
} catch {
|
|
11834
|
+
return null;
|
|
11835
|
+
}
|
|
11836
|
+
}
|
|
11837
|
+
function printUpdateNotice({ current, latest }) {
|
|
11838
|
+
console.error([
|
|
11839
|
+
"",
|
|
11840
|
+
styleText("yellow", `Update available for ${PACKAGE_NAME}: ${current} → ${latest}`),
|
|
11841
|
+
styleText("dim", `Run \`npm install -g ${PACKAGE_NAME}@latest\` to update.`),
|
|
11842
|
+
""
|
|
11843
|
+
].join("\n"));
|
|
11844
|
+
}
|
|
11845
|
+
async function notifyIfUpdateAvailable(now) {
|
|
11846
|
+
const state = getUpdateCheckState();
|
|
11847
|
+
let latest = state.latestKnownVersion;
|
|
11848
|
+
if (state.checkedAt === null || now - state.checkedAt >= CHECK_INTERVAL_MS) {
|
|
11849
|
+
const fetched = await fetchLatestVersion({ timeoutMs: NOTICE_FETCH_TIMEOUT_MS });
|
|
11850
|
+
recordUpdateCheck({
|
|
11851
|
+
checkedAt: now,
|
|
11852
|
+
latestVersion: fetched
|
|
11853
|
+
});
|
|
11854
|
+
if (fetched) latest = fetched;
|
|
11855
|
+
}
|
|
11856
|
+
if (!latest || !isNewerVersion(latest, CLI_VERSION)) return;
|
|
11857
|
+
if (state.notifiedVersion === latest) return;
|
|
11858
|
+
printUpdateNotice({
|
|
11859
|
+
current: CLI_VERSION,
|
|
11860
|
+
latest
|
|
11861
|
+
});
|
|
11862
|
+
recordUpdateNotified(latest);
|
|
11863
|
+
}
|
|
11864
|
+
async function maybeNotifyUpdate(argv, now) {
|
|
11865
|
+
if (argv.json || argv.quiet) return;
|
|
11866
|
+
if (isNonInteractive(argv)) return;
|
|
11867
|
+
if (!process.stderr.isTTY) return;
|
|
11868
|
+
await notifyIfUpdateAvailable(now);
|
|
11869
|
+
}
|
|
11870
|
+
|
|
11871
|
+
//#endregion
|
|
11872
|
+
//#region src/commands/update.ts
|
|
11873
|
+
const COMMAND$1 = "update";
|
|
11874
|
+
const FETCH_TIMEOUT_MS = 8e3;
|
|
11875
|
+
function detectPackageManager(scriptPath) {
|
|
11876
|
+
const path = scriptPath.replace(/\\/g, "/").toLowerCase();
|
|
11877
|
+
if (path.includes("/pnpm/") || path.includes("/pnpm-global/")) return "pnpm";
|
|
11878
|
+
if (path.includes("/.bun/")) return "bun";
|
|
11879
|
+
if (path.includes("/yarn/") || path.includes("/.config/yarn/")) return "yarn";
|
|
11880
|
+
return "npm";
|
|
11881
|
+
}
|
|
11882
|
+
function buildInstallCommand({ packageManager, target }) {
|
|
11883
|
+
switch (packageManager) {
|
|
11884
|
+
case "pnpm": return {
|
|
11885
|
+
command: "pnpm",
|
|
11886
|
+
args: [
|
|
11887
|
+
"add",
|
|
11888
|
+
"-g",
|
|
11889
|
+
target
|
|
11890
|
+
]
|
|
11891
|
+
};
|
|
11892
|
+
case "yarn": return {
|
|
11893
|
+
command: "yarn",
|
|
11894
|
+
args: [
|
|
11895
|
+
"global",
|
|
11896
|
+
"add",
|
|
11897
|
+
target
|
|
11898
|
+
]
|
|
11899
|
+
};
|
|
11900
|
+
case "bun": return {
|
|
11901
|
+
command: "bun",
|
|
11902
|
+
args: [
|
|
11903
|
+
"add",
|
|
11904
|
+
"-g",
|
|
11905
|
+
target
|
|
11906
|
+
]
|
|
11907
|
+
};
|
|
11908
|
+
case "npm": return {
|
|
11909
|
+
command: "npm",
|
|
11910
|
+
args: [
|
|
11911
|
+
"install",
|
|
11912
|
+
"-g",
|
|
11913
|
+
target
|
|
11914
|
+
]
|
|
11915
|
+
};
|
|
11916
|
+
default: {
|
|
11917
|
+
const exhaustive = packageManager;
|
|
11918
|
+
throw new Error(`Unhandled package manager: ${String(exhaustive)}`);
|
|
11919
|
+
}
|
|
11920
|
+
}
|
|
11921
|
+
}
|
|
11922
|
+
function resolveSelfPath() {
|
|
11923
|
+
const entry = process.argv[1];
|
|
11924
|
+
if (!entry) return "";
|
|
11925
|
+
try {
|
|
11926
|
+
return realpathSync(entry);
|
|
11927
|
+
} catch {
|
|
11928
|
+
return entry;
|
|
11929
|
+
}
|
|
11930
|
+
}
|
|
11931
|
+
function runInstall({ command, args, capture }) {
|
|
11932
|
+
return new Promise((resolve, reject) => {
|
|
11933
|
+
const child = spawn(command, args, {
|
|
11934
|
+
stdio: capture ? [
|
|
11935
|
+
"ignore",
|
|
11936
|
+
"pipe",
|
|
11937
|
+
"pipe"
|
|
11938
|
+
] : "inherit",
|
|
11939
|
+
shell: process.platform === "win32"
|
|
11940
|
+
});
|
|
11941
|
+
let output = "";
|
|
11942
|
+
child.stdout?.on("data", (chunk) => {
|
|
11943
|
+
output += String(chunk);
|
|
11944
|
+
});
|
|
11945
|
+
child.stderr?.on("data", (chunk) => {
|
|
11946
|
+
output += String(chunk);
|
|
11947
|
+
});
|
|
11948
|
+
child.on("error", reject);
|
|
11949
|
+
child.on("close", (code) => resolve({
|
|
11950
|
+
code,
|
|
11951
|
+
output: output.trim()
|
|
11952
|
+
}));
|
|
11953
|
+
});
|
|
11954
|
+
}
|
|
11955
|
+
const updateCommand = {
|
|
11956
|
+
command: "update",
|
|
11957
|
+
describe: "Update the CLI to the latest published version",
|
|
11958
|
+
builder: (yargs) => yargs.option("check", {
|
|
11959
|
+
type: "boolean",
|
|
11960
|
+
default: false,
|
|
11961
|
+
describe: "Report whether an update is available without installing it"
|
|
11962
|
+
}).example("anything update", "Update to the latest version if one exists").example("anything update --check", "Check for a newer version without installing").example("anything update --dry-run", "Print the install command without running it"),
|
|
11963
|
+
handler: async (argv) => {
|
|
11964
|
+
const latest = await fetchLatestVersion({ timeoutMs: FETCH_TIMEOUT_MS });
|
|
11965
|
+
if (latest === null) {
|
|
11966
|
+
outputError({
|
|
11967
|
+
argv,
|
|
11968
|
+
command: COMMAND$1,
|
|
11969
|
+
error: {
|
|
11970
|
+
message: `Could not reach the npm registry to check for updates.`,
|
|
11971
|
+
status: null
|
|
11972
|
+
},
|
|
11973
|
+
hint: `Update manually with \`npm install -g ${PACKAGE_NAME}@latest\`.`,
|
|
11974
|
+
exitCode: EXIT_TIMEOUT
|
|
11975
|
+
});
|
|
11976
|
+
return;
|
|
11977
|
+
}
|
|
11978
|
+
const packageManager = detectPackageManager(resolveSelfPath());
|
|
11979
|
+
const { command, args } = buildInstallCommand({
|
|
11980
|
+
packageManager,
|
|
11981
|
+
target: `${PACKAGE_NAME}@${latest}`
|
|
11982
|
+
});
|
|
11983
|
+
const installCommand = [command, ...args].join(" ");
|
|
11984
|
+
if (!isNewerVersion(latest, CLI_VERSION)) {
|
|
11985
|
+
if (outputSuccess({
|
|
11986
|
+
argv,
|
|
11987
|
+
command: COMMAND$1,
|
|
11988
|
+
data: {
|
|
11989
|
+
currentVersion: CLI_VERSION,
|
|
11990
|
+
latestVersion: latest,
|
|
11991
|
+
updateAvailable: false,
|
|
11992
|
+
updated: false
|
|
11993
|
+
},
|
|
11994
|
+
primaryId: CLI_VERSION
|
|
11995
|
+
})) return;
|
|
11996
|
+
printSuccess(`Already on the latest version (${CLI_VERSION}).`);
|
|
11997
|
+
return;
|
|
11998
|
+
}
|
|
11999
|
+
if (argv.check) {
|
|
12000
|
+
if (outputSuccess({
|
|
12001
|
+
argv,
|
|
12002
|
+
command: COMMAND$1,
|
|
12003
|
+
data: {
|
|
12004
|
+
currentVersion: CLI_VERSION,
|
|
12005
|
+
latestVersion: latest,
|
|
12006
|
+
updateAvailable: true,
|
|
12007
|
+
updated: false,
|
|
12008
|
+
packageManager,
|
|
12009
|
+
installCommand
|
|
12010
|
+
},
|
|
12011
|
+
primaryId: latest
|
|
12012
|
+
})) return;
|
|
12013
|
+
console.log();
|
|
12014
|
+
printLabel("Current", CLI_VERSION);
|
|
12015
|
+
printLabel("Latest", latest);
|
|
12016
|
+
console.log();
|
|
12017
|
+
console.log(`Run \`anything update\` or \`${installCommand}\` to update.`);
|
|
12018
|
+
return;
|
|
12019
|
+
}
|
|
12020
|
+
if (argv["dry-run"]) {
|
|
12021
|
+
outputDryRun({
|
|
12022
|
+
argv,
|
|
12023
|
+
command: COMMAND$1,
|
|
12024
|
+
plannedActions: [{
|
|
12025
|
+
action: "update",
|
|
12026
|
+
from: CLI_VERSION,
|
|
12027
|
+
to: latest,
|
|
12028
|
+
packageManager,
|
|
12029
|
+
command: installCommand
|
|
12030
|
+
}]
|
|
12031
|
+
});
|
|
12032
|
+
return;
|
|
12033
|
+
}
|
|
12034
|
+
if (!argv.json && !argv.quiet) console.log(`Updating ${PACKAGE_NAME} ${CLI_VERSION} → ${latest} via ${packageManager}...`);
|
|
12035
|
+
let result;
|
|
12036
|
+
try {
|
|
12037
|
+
result = await runInstall({
|
|
12038
|
+
command,
|
|
12039
|
+
args,
|
|
12040
|
+
capture: argv.json || argv.quiet
|
|
12041
|
+
});
|
|
12042
|
+
} catch (error) {
|
|
12043
|
+
outputError({
|
|
12044
|
+
argv,
|
|
12045
|
+
command: COMMAND$1,
|
|
12046
|
+
error: {
|
|
12047
|
+
message: `Failed to run \`${installCommand}\`: ${error instanceof Error ? error.message : String(error)}`,
|
|
12048
|
+
status: null
|
|
12049
|
+
},
|
|
12050
|
+
hint: `Is ${packageManager} installed and on your PATH? You can update manually with \`${installCommand}\`.`
|
|
12051
|
+
});
|
|
12052
|
+
return;
|
|
12053
|
+
}
|
|
12054
|
+
if (result.code !== 0) {
|
|
12055
|
+
const detail = result.output ? `\n${styleText("dim", result.output)}` : "";
|
|
12056
|
+
outputError({
|
|
12057
|
+
argv,
|
|
12058
|
+
command: COMMAND$1,
|
|
12059
|
+
error: {
|
|
12060
|
+
message: `Update failed: \`${installCommand}\` exited with code ${result.code}.${detail}`,
|
|
12061
|
+
status: null
|
|
12062
|
+
},
|
|
12063
|
+
hint: `Try running \`${installCommand}\` directly to see the full output.`
|
|
12064
|
+
});
|
|
12065
|
+
return;
|
|
12066
|
+
}
|
|
12067
|
+
if (outputSuccess({
|
|
12068
|
+
argv,
|
|
12069
|
+
command: COMMAND$1,
|
|
12070
|
+
data: {
|
|
12071
|
+
previousVersion: CLI_VERSION,
|
|
12072
|
+
latestVersion: latest,
|
|
12073
|
+
updated: true,
|
|
12074
|
+
packageManager,
|
|
12075
|
+
installCommand
|
|
12076
|
+
},
|
|
12077
|
+
primaryId: latest
|
|
12078
|
+
})) return;
|
|
12079
|
+
printSuccess(`Updated to ${latest}. Run \`anything --version\` to confirm.`);
|
|
12080
|
+
}
|
|
12081
|
+
};
|
|
12082
|
+
|
|
10599
12083
|
//#endregion
|
|
10600
12084
|
//#region src/commands/user.ts
|
|
10601
12085
|
function formatCredits(creditBalance) {
|
|
@@ -10710,72 +12194,6 @@ const userCommand = {
|
|
|
10710
12194
|
}
|
|
10711
12195
|
};
|
|
10712
12196
|
|
|
10713
|
-
//#endregion
|
|
10714
|
-
//#region src/update-check.ts
|
|
10715
|
-
const PACKAGE_NAME = "@anythingai/cli";
|
|
10716
|
-
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
10717
|
-
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
10718
|
-
const FETCH_TIMEOUT_MS = 1500;
|
|
10719
|
-
const latestManifestSchema = z.object({ version: z.string() });
|
|
10720
|
-
function isNewerVersion(candidate, current) {
|
|
10721
|
-
const core = (v) => (v.split("-")[0] ?? "").split(".").map((part) => Number.parseInt(part, 10));
|
|
10722
|
-
const a = core(candidate);
|
|
10723
|
-
const b = core(current);
|
|
10724
|
-
if ([...a, ...b].some(Number.isNaN)) return false;
|
|
10725
|
-
for (let i = 0; i < 3; i++) {
|
|
10726
|
-
const left = a[i] ?? 0;
|
|
10727
|
-
const right = b[i] ?? 0;
|
|
10728
|
-
if (left !== right) return left > right;
|
|
10729
|
-
}
|
|
10730
|
-
return false;
|
|
10731
|
-
}
|
|
10732
|
-
async function fetchLatestVersion() {
|
|
10733
|
-
try {
|
|
10734
|
-
const response = await fetch(REGISTRY_URL, {
|
|
10735
|
-
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
10736
|
-
headers: { accept: "application/json" }
|
|
10737
|
-
});
|
|
10738
|
-
if (!response.ok) return null;
|
|
10739
|
-
const parsed = latestManifestSchema.safeParse(await response.json());
|
|
10740
|
-
return parsed.success ? parsed.data.version : null;
|
|
10741
|
-
} catch {
|
|
10742
|
-
return null;
|
|
10743
|
-
}
|
|
10744
|
-
}
|
|
10745
|
-
function printUpdateNotice({ current, latest }) {
|
|
10746
|
-
console.error([
|
|
10747
|
-
"",
|
|
10748
|
-
styleText("yellow", `Update available for ${PACKAGE_NAME}: ${current} → ${latest}`),
|
|
10749
|
-
styleText("dim", `Run \`npm install -g ${PACKAGE_NAME}@latest\` to update.`),
|
|
10750
|
-
""
|
|
10751
|
-
].join("\n"));
|
|
10752
|
-
}
|
|
10753
|
-
async function notifyIfUpdateAvailable(now) {
|
|
10754
|
-
const state = getUpdateCheckState();
|
|
10755
|
-
let latest = state.latestKnownVersion;
|
|
10756
|
-
if (state.checkedAt === null || now - state.checkedAt >= CHECK_INTERVAL_MS) {
|
|
10757
|
-
const fetched = await fetchLatestVersion();
|
|
10758
|
-
recordUpdateCheck({
|
|
10759
|
-
checkedAt: now,
|
|
10760
|
-
latestVersion: fetched
|
|
10761
|
-
});
|
|
10762
|
-
if (fetched) latest = fetched;
|
|
10763
|
-
}
|
|
10764
|
-
if (!latest || !isNewerVersion(latest, CLI_VERSION)) return;
|
|
10765
|
-
if (state.notifiedVersion === latest) return;
|
|
10766
|
-
printUpdateNotice({
|
|
10767
|
-
current: CLI_VERSION,
|
|
10768
|
-
latest
|
|
10769
|
-
});
|
|
10770
|
-
recordUpdateNotified(latest);
|
|
10771
|
-
}
|
|
10772
|
-
async function maybeNotifyUpdate(argv, now) {
|
|
10773
|
-
if (argv.json || argv.quiet) return;
|
|
10774
|
-
if (isNonInteractive(argv)) return;
|
|
10775
|
-
if (!process.stderr.isTTY) return;
|
|
10776
|
-
await notifyIfUpdateAvailable(now);
|
|
10777
|
-
}
|
|
10778
|
-
|
|
10779
12197
|
//#endregion
|
|
10780
12198
|
//#region src/commands/watch.ts
|
|
10781
12199
|
const IDLE_TIMEOUT_MS = 300 * 1e3;
|
|
@@ -10924,7 +12342,7 @@ const watchCommand = {
|
|
|
10924
12342
|
//#endregion
|
|
10925
12343
|
//#region src/cli.ts
|
|
10926
12344
|
function createCli(argv) {
|
|
10927
|
-
const cli = yargs(argv).scriptName("anything").usage("$0 <command> [options]").example("anything auth login", "Log in via browser").example("anything ship --prompt \"Build a todo app\"", "Create + publish in one shot").example("anything domains list org_123", "List domains for one organization").example("anything orgs", "List your organizations").example("anything orgs get <org-id>", "Inspect one organization").example("anything orgs set <org-id>", "Set the active organization").example("anything orgs members <org-id>", "Inspect collaborators and pending invites").example("anything projects create --prompt todo-app", "Create a new app").example("anything projects generate <project-id> --prompt add-auth", "Iterate on an existing app").example("anything projects publish <project-id> --slug my-app", "Publish an app").example("anything projects get <project-id> --json", "Inspect an app in JSON").example("anything projects rename <project-id> --name \"My App\"", "Rename a project").example("anything databases list --org <org-id>", "List databases for an organization").example("anything deployments list <project-id>", "List deployments for a project").example("anything members invite user@example.com --org org_123", "Invite a member").example("anything status", "Show current context").example("anything switch", "Interactive org/project picker").example("anything introspect", "Output command tree as JSON").option("json", {
|
|
12345
|
+
const cli = yargs(argv).scriptName("anything").usage("$0 <command> [options]").example("anything auth login", "Log in via browser").example("anything ship --prompt \"Build a todo app\"", "Create + publish in one shot").example("anything domains list org_123", "List domains for one organization").example("anything orgs", "List your organizations").example("anything orgs get <org-id>", "Inspect one organization").example("anything orgs set <org-id>", "Set the active organization").example("anything orgs members <org-id>", "Inspect collaborators and pending invites").example("anything projects create --prompt todo-app", "Create a new app").example("anything projects generate <project-id> --prompt add-auth", "Iterate on an existing app").example("anything projects publish <project-id> --slug my-app", "Publish an app").example("anything projects get <project-id> --json", "Inspect an app in JSON").example("anything projects rename <project-id> --name \"My App\"", "Rename a project").example("anything databases list --org <org-id>", "List databases for an organization").example("anything deployments list <project-id>", "List deployments for a project").example("anything members invite user@example.com --org org_123", "Invite a member").example("anything update", "Update the CLI to the latest version").example("anything status", "Show current context").example("anything switch", "Interactive org/project picker").example("anything introspect", "Output command tree as JSON").option("json", {
|
|
10928
12346
|
type: "boolean",
|
|
10929
12347
|
default: false,
|
|
10930
12348
|
describe: "Output as JSON envelope: { ok, command, data }",
|
|
@@ -10944,11 +12362,6 @@ function createCli(argv) {
|
|
|
10944
12362
|
default: false,
|
|
10945
12363
|
describe: "Preview planned actions without executing (state-modifying commands)",
|
|
10946
12364
|
global: true
|
|
10947
|
-
}).option("quiet", {
|
|
10948
|
-
type: "boolean",
|
|
10949
|
-
default: false,
|
|
10950
|
-
describe: "Print only the primary identifier (ID or URL)",
|
|
10951
|
-
global: true
|
|
10952
12365
|
}).option("dev", {
|
|
10953
12366
|
type: "boolean",
|
|
10954
12367
|
hidden: true,
|
|
@@ -10967,14 +12380,22 @@ function createCli(argv) {
|
|
|
10967
12380
|
"dry-run": args["dry-run"] === true,
|
|
10968
12381
|
dev: args.dev === true
|
|
10969
12382
|
}, Date.now());
|
|
10970
|
-
}).command(assetsCommand).command(authCommand).command(databasesCommand).command(deploymentsCommand).command(domainsCommand).command(introspectCommand).command(linkCommand).command(llmContextCommand).command(membersCommand).command(orgsCommand).command(projectsCommand).command(pullCommand).command(shipCommand).command(skillCommand).command(statusCommand).command(switchCommand).command(unlinkCommand).command(userCommand).command(watchCommand).demandCommand(1, "Specify a command. Run --help for usage.").strict().wrap(null).version(CLI_VERSION).help().fail((msg, err, instance) => {
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
12383
|
+
}).command(assetsCommand).command(authCommand).command(databasesCommand).command(deploymentsCommand).command(domainsCommand).command(introspectCommand).command(linkCommand).command(llmContextCommand).command(membersCommand).command(orgsCommand).command(projectsCommand).command(pullCommand).command(shipCommand).command(skillCommand).command(statusCommand).command(switchCommand).command(unlinkCommand).command(updateCommand).command(userCommand).command(watchCommand).demandCommand(1, "Specify a command. Run --help for usage.").strict().wrap(null).version(CLI_VERSION).help().fail((msg, err, instance) => {
|
|
12384
|
+
const isJson = argv.includes("--json");
|
|
12385
|
+
const message = err ? err.message || String(err) : msg;
|
|
12386
|
+
if (err) console.error(message);
|
|
12387
|
+
else {
|
|
12388
|
+
if (!isJson) instance.showHelp("error");
|
|
12389
|
+
console.error(`\n${message}`);
|
|
10975
12390
|
}
|
|
10976
|
-
|
|
10977
|
-
|
|
12391
|
+
if (isJson) console.error(JSON.stringify({
|
|
12392
|
+
ok: false,
|
|
12393
|
+
command: null,
|
|
12394
|
+
error: {
|
|
12395
|
+
code: "INVALID_ARGUMENTS",
|
|
12396
|
+
message
|
|
12397
|
+
}
|
|
12398
|
+
}, null, 2));
|
|
10978
12399
|
process.exitCode = EXIT_INVALID_ARGS;
|
|
10979
12400
|
}).exitProcess(false);
|
|
10980
12401
|
if (isDevEnvironment()) cli.command(devCommand);
|