@alpic-ai/api 0.0.0-dev.gfbb7177 → 0.0.0-dev.gfbcb537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6722 -97
- package/dist/index.mjs +2307 -190
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,10 @@ import { z } from "zod";
|
|
|
2
2
|
import * as z$1 from "zod/v4";
|
|
3
3
|
import { oc } from "@orpc/contract";
|
|
4
4
|
import ms from "ms";
|
|
5
|
-
//#region
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_supports-color@8.1.1_zod@4.6.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
6
9
|
/**
|
|
7
10
|
* Reusable URL validation that disallows javascript: scheme
|
|
8
11
|
*/
|
|
@@ -119,7 +122,12 @@ z$1.object({
|
|
|
119
122
|
token_type: z$1.string(),
|
|
120
123
|
expires_in: z$1.coerce.number().optional(),
|
|
121
124
|
scope: z$1.string().optional(),
|
|
122
|
-
refresh_token: z$1.string().optional()
|
|
125
|
+
refresh_token: z$1.string().optional(),
|
|
126
|
+
/**
|
|
127
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
128
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
129
|
+
*/
|
|
130
|
+
issuer: z$1.string().optional().catch(void 0)
|
|
123
131
|
}).strip();
|
|
124
132
|
z$1.object({
|
|
125
133
|
error: z$1.string(),
|
|
@@ -158,7 +166,12 @@ const OAuthClientInformationSchema = z$1.object({
|
|
|
158
166
|
client_id: z$1.string(),
|
|
159
167
|
client_secret: z$1.string().optional(),
|
|
160
168
|
client_id_issued_at: z$1.number().optional(),
|
|
161
|
-
client_secret_expires_at: z$1.number().optional()
|
|
169
|
+
client_secret_expires_at: z$1.number().optional(),
|
|
170
|
+
/**
|
|
171
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
172
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
173
|
+
*/
|
|
174
|
+
issuer: z$1.string().optional().catch(void 0)
|
|
162
175
|
}).strip();
|
|
163
176
|
OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
164
177
|
z$1.object({
|
|
@@ -170,7 +183,1401 @@ z$1.object({
|
|
|
170
183
|
token_type_hint: z$1.string().optional()
|
|
171
184
|
}).strip();
|
|
172
185
|
//#endregion
|
|
173
|
-
//#region
|
|
186
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
187
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
188
|
+
module.exports = {
|
|
189
|
+
MAX_LENGTH: 256,
|
|
190
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
191
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
192
|
+
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
|
|
193
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
194
|
+
RELEASE_TYPES: [
|
|
195
|
+
"major",
|
|
196
|
+
"premajor",
|
|
197
|
+
"minor",
|
|
198
|
+
"preminor",
|
|
199
|
+
"patch",
|
|
200
|
+
"prepatch",
|
|
201
|
+
"prerelease"
|
|
202
|
+
],
|
|
203
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
204
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
205
|
+
FLAG_LOOSE: 2
|
|
206
|
+
};
|
|
207
|
+
}));
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
210
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
211
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
212
|
+
}));
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
215
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
216
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
217
|
+
const debug = require_debug();
|
|
218
|
+
exports = module.exports = {};
|
|
219
|
+
const re = exports.re = [];
|
|
220
|
+
const safeRe = exports.safeRe = [];
|
|
221
|
+
const src = exports.src = [];
|
|
222
|
+
const safeSrc = exports.safeSrc = [];
|
|
223
|
+
const t = exports.t = {};
|
|
224
|
+
let R = 0;
|
|
225
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
226
|
+
const safeRegexReplacements = [
|
|
227
|
+
["\\s", 1],
|
|
228
|
+
["\\d", MAX_LENGTH],
|
|
229
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
230
|
+
];
|
|
231
|
+
const makeSafeRegex = (value) => {
|
|
232
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
233
|
+
return value;
|
|
234
|
+
};
|
|
235
|
+
const createToken = (name, value, isGlobal) => {
|
|
236
|
+
const safe = makeSafeRegex(value);
|
|
237
|
+
const index = R++;
|
|
238
|
+
debug(name, index, value);
|
|
239
|
+
t[name] = index;
|
|
240
|
+
src[index] = value;
|
|
241
|
+
safeSrc[index] = safe;
|
|
242
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
243
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
244
|
+
};
|
|
245
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
246
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
247
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
248
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
249
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
250
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
251
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
252
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
253
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
254
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
255
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
256
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
257
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
258
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
259
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
260
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
261
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
262
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
263
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
264
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
265
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
266
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
267
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
268
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
269
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
270
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
271
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
272
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
273
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
274
|
+
exports.tildeTrimReplace = "$1~";
|
|
275
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
276
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
277
|
+
createToken("LONECARET", "(?:\\^)");
|
|
278
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
279
|
+
exports.caretTrimReplace = "$1^";
|
|
280
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
281
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
282
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
283
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
284
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
285
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
286
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
287
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
288
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
289
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
290
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
291
|
+
}));
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
294
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
295
|
+
const looseOption = Object.freeze({ loose: true });
|
|
296
|
+
const emptyOpts = Object.freeze({});
|
|
297
|
+
const parseOptions = (options) => {
|
|
298
|
+
if (!options) return emptyOpts;
|
|
299
|
+
if (typeof options !== "object") return looseOption;
|
|
300
|
+
return options;
|
|
301
|
+
};
|
|
302
|
+
module.exports = parseOptions;
|
|
303
|
+
}));
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
306
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
307
|
+
const numeric = /^[0-9]+$/;
|
|
308
|
+
const compareIdentifiers = (a, b) => {
|
|
309
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
310
|
+
const anum = numeric.test(a);
|
|
311
|
+
const bnum = numeric.test(b);
|
|
312
|
+
if (anum && bnum) {
|
|
313
|
+
a = +a;
|
|
314
|
+
b = +b;
|
|
315
|
+
}
|
|
316
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
317
|
+
};
|
|
318
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
319
|
+
module.exports = {
|
|
320
|
+
compareIdentifiers,
|
|
321
|
+
rcompareIdentifiers
|
|
322
|
+
};
|
|
323
|
+
}));
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
326
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
327
|
+
const debug = require_debug();
|
|
328
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
329
|
+
const { safeRe: re, t } = require_re();
|
|
330
|
+
const parseOptions = require_parse_options();
|
|
331
|
+
const { compareIdentifiers } = require_identifiers();
|
|
332
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
333
|
+
const identifiers = identifier.split(".");
|
|
334
|
+
if (identifiers.length > prerelease.length) return false;
|
|
335
|
+
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
336
|
+
return true;
|
|
337
|
+
};
|
|
338
|
+
module.exports = class SemVer {
|
|
339
|
+
constructor(version, options) {
|
|
340
|
+
options = parseOptions(options);
|
|
341
|
+
if (version instanceof SemVer) {
|
|
342
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
343
|
+
else version = version.version;
|
|
344
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
345
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
346
|
+
debug("SemVer", version, options);
|
|
347
|
+
this.options = options;
|
|
348
|
+
this.loose = !!options.loose;
|
|
349
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
350
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
351
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
352
|
+
this.raw = version;
|
|
353
|
+
this.major = +m[1];
|
|
354
|
+
this.minor = +m[2];
|
|
355
|
+
this.patch = +m[3];
|
|
356
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
357
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
358
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
359
|
+
if (!m[4]) this.prerelease = [];
|
|
360
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
361
|
+
if (/^[0-9]+$/.test(id)) {
|
|
362
|
+
const num = +id;
|
|
363
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
364
|
+
}
|
|
365
|
+
return id;
|
|
366
|
+
});
|
|
367
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
368
|
+
this.format();
|
|
369
|
+
}
|
|
370
|
+
format() {
|
|
371
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
372
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
373
|
+
return this.version;
|
|
374
|
+
}
|
|
375
|
+
toString() {
|
|
376
|
+
return this.version;
|
|
377
|
+
}
|
|
378
|
+
compare(other) {
|
|
379
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
380
|
+
if (!(other instanceof SemVer)) {
|
|
381
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
382
|
+
other = new SemVer(other, this.options);
|
|
383
|
+
}
|
|
384
|
+
if (other.version === this.version) return 0;
|
|
385
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
386
|
+
}
|
|
387
|
+
compareMain(other) {
|
|
388
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
389
|
+
if (this.major < other.major) return -1;
|
|
390
|
+
if (this.major > other.major) return 1;
|
|
391
|
+
if (this.minor < other.minor) return -1;
|
|
392
|
+
if (this.minor > other.minor) return 1;
|
|
393
|
+
if (this.patch < other.patch) return -1;
|
|
394
|
+
if (this.patch > other.patch) return 1;
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
comparePre(other) {
|
|
398
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
399
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
400
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
401
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
402
|
+
let i = 0;
|
|
403
|
+
do {
|
|
404
|
+
const a = this.prerelease[i];
|
|
405
|
+
const b = other.prerelease[i];
|
|
406
|
+
debug("prerelease compare", i, a, b);
|
|
407
|
+
if (a === void 0 && b === void 0) return 0;
|
|
408
|
+
else if (b === void 0) return 1;
|
|
409
|
+
else if (a === void 0) return -1;
|
|
410
|
+
else if (a === b) continue;
|
|
411
|
+
else return compareIdentifiers(a, b);
|
|
412
|
+
} while (++i);
|
|
413
|
+
}
|
|
414
|
+
compareBuild(other) {
|
|
415
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
416
|
+
let i = 0;
|
|
417
|
+
do {
|
|
418
|
+
const a = this.build[i];
|
|
419
|
+
const b = other.build[i];
|
|
420
|
+
debug("build compare", i, a, b);
|
|
421
|
+
if (a === void 0 && b === void 0) return 0;
|
|
422
|
+
else if (b === void 0) return 1;
|
|
423
|
+
else if (a === void 0) return -1;
|
|
424
|
+
else if (a === b) continue;
|
|
425
|
+
else return compareIdentifiers(a, b);
|
|
426
|
+
} while (++i);
|
|
427
|
+
}
|
|
428
|
+
inc(release, identifier, identifierBase) {
|
|
429
|
+
if (release.startsWith("pre")) {
|
|
430
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
431
|
+
if (identifier) {
|
|
432
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
433
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
switch (release) {
|
|
437
|
+
case "premajor":
|
|
438
|
+
this.prerelease.length = 0;
|
|
439
|
+
this.patch = 0;
|
|
440
|
+
this.minor = 0;
|
|
441
|
+
this.major++;
|
|
442
|
+
this.inc("pre", identifier, identifierBase);
|
|
443
|
+
break;
|
|
444
|
+
case "preminor":
|
|
445
|
+
this.prerelease.length = 0;
|
|
446
|
+
this.patch = 0;
|
|
447
|
+
this.minor++;
|
|
448
|
+
this.inc("pre", identifier, identifierBase);
|
|
449
|
+
break;
|
|
450
|
+
case "prepatch":
|
|
451
|
+
this.prerelease.length = 0;
|
|
452
|
+
this.inc("patch", identifier, identifierBase);
|
|
453
|
+
this.inc("pre", identifier, identifierBase);
|
|
454
|
+
break;
|
|
455
|
+
case "prerelease":
|
|
456
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
457
|
+
this.inc("pre", identifier, identifierBase);
|
|
458
|
+
break;
|
|
459
|
+
case "release":
|
|
460
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
461
|
+
this.prerelease.length = 0;
|
|
462
|
+
break;
|
|
463
|
+
case "major":
|
|
464
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
465
|
+
this.minor = 0;
|
|
466
|
+
this.patch = 0;
|
|
467
|
+
this.prerelease = [];
|
|
468
|
+
break;
|
|
469
|
+
case "minor":
|
|
470
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
471
|
+
this.patch = 0;
|
|
472
|
+
this.prerelease = [];
|
|
473
|
+
break;
|
|
474
|
+
case "patch":
|
|
475
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
476
|
+
this.prerelease = [];
|
|
477
|
+
break;
|
|
478
|
+
case "pre": {
|
|
479
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
480
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
481
|
+
else {
|
|
482
|
+
let i = this.prerelease.length;
|
|
483
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
484
|
+
this.prerelease[i]++;
|
|
485
|
+
i = -2;
|
|
486
|
+
}
|
|
487
|
+
if (i === -1) {
|
|
488
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
489
|
+
this.prerelease.push(base);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (identifier) {
|
|
493
|
+
let prerelease = [identifier, base];
|
|
494
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
495
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
496
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
497
|
+
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
498
|
+
} else this.prerelease = prerelease;
|
|
499
|
+
}
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
503
|
+
}
|
|
504
|
+
this.raw = this.format();
|
|
505
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
506
|
+
return this;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}));
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
512
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
513
|
+
const SemVer = require_semver$1();
|
|
514
|
+
const parse = (version, options, throwErrors = false) => {
|
|
515
|
+
if (version instanceof SemVer) return version;
|
|
516
|
+
try {
|
|
517
|
+
return new SemVer(version, options);
|
|
518
|
+
} catch (er) {
|
|
519
|
+
if (!throwErrors) return null;
|
|
520
|
+
throw er;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
module.exports = parse;
|
|
524
|
+
}));
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
527
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
528
|
+
const parse = require_parse();
|
|
529
|
+
const valid = (version, options) => {
|
|
530
|
+
const v = parse(version, options);
|
|
531
|
+
return v ? v.version : null;
|
|
532
|
+
};
|
|
533
|
+
module.exports = valid;
|
|
534
|
+
}));
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js
|
|
537
|
+
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
538
|
+
const parse = require_parse();
|
|
539
|
+
const clean = (version, options) => {
|
|
540
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
541
|
+
return s ? s.version : null;
|
|
542
|
+
};
|
|
543
|
+
module.exports = clean;
|
|
544
|
+
}));
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js
|
|
547
|
+
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
548
|
+
const SemVer = require_semver$1();
|
|
549
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
550
|
+
if (typeof options === "string") {
|
|
551
|
+
identifierBase = identifier;
|
|
552
|
+
identifier = options;
|
|
553
|
+
options = void 0;
|
|
554
|
+
}
|
|
555
|
+
try {
|
|
556
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
557
|
+
} catch (er) {
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
module.exports = inc;
|
|
562
|
+
}));
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js
|
|
565
|
+
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
566
|
+
const parse = require_parse();
|
|
567
|
+
const diff = (version1, version2) => {
|
|
568
|
+
const v1 = parse(version1, null, true);
|
|
569
|
+
const v2 = parse(version2, null, true);
|
|
570
|
+
const comparison = v1.compare(v2);
|
|
571
|
+
if (comparison === 0) return null;
|
|
572
|
+
const v1Higher = comparison > 0;
|
|
573
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
574
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
575
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
576
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
577
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
578
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
579
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
580
|
+
return "patch";
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
const prefix = highHasPre ? "pre" : "";
|
|
584
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
585
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
586
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
587
|
+
return "prerelease";
|
|
588
|
+
};
|
|
589
|
+
module.exports = diff;
|
|
590
|
+
}));
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js
|
|
593
|
+
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
594
|
+
const SemVer = require_semver$1();
|
|
595
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
596
|
+
module.exports = major;
|
|
597
|
+
}));
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js
|
|
600
|
+
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
601
|
+
const SemVer = require_semver$1();
|
|
602
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
603
|
+
module.exports = minor;
|
|
604
|
+
}));
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js
|
|
607
|
+
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
608
|
+
const SemVer = require_semver$1();
|
|
609
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
610
|
+
module.exports = patch;
|
|
611
|
+
}));
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
|
|
614
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
615
|
+
const parse = require_parse();
|
|
616
|
+
const prerelease = (version, options) => {
|
|
617
|
+
const parsed = parse(version, options);
|
|
618
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
619
|
+
};
|
|
620
|
+
module.exports = prerelease;
|
|
621
|
+
}));
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
624
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
625
|
+
const SemVer = require_semver$1();
|
|
626
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
627
|
+
module.exports = compare;
|
|
628
|
+
}));
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
|
|
631
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
632
|
+
const compare = require_compare();
|
|
633
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
634
|
+
module.exports = rcompare;
|
|
635
|
+
}));
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js
|
|
638
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
639
|
+
const compare = require_compare();
|
|
640
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
641
|
+
module.exports = compareLoose;
|
|
642
|
+
}));
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js
|
|
645
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
646
|
+
const SemVer = require_semver$1();
|
|
647
|
+
const compareBuild = (a, b, loose) => {
|
|
648
|
+
const versionA = new SemVer(a, loose);
|
|
649
|
+
const versionB = new SemVer(b, loose);
|
|
650
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
651
|
+
};
|
|
652
|
+
module.exports = compareBuild;
|
|
653
|
+
}));
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js
|
|
656
|
+
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
657
|
+
const compareBuild = require_compare_build();
|
|
658
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
659
|
+
module.exports = sort;
|
|
660
|
+
}));
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js
|
|
663
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
664
|
+
const compareBuild = require_compare_build();
|
|
665
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
666
|
+
module.exports = rsort;
|
|
667
|
+
}));
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
|
|
670
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
671
|
+
const compare = require_compare();
|
|
672
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
673
|
+
module.exports = gt;
|
|
674
|
+
}));
|
|
675
|
+
//#endregion
|
|
676
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
|
|
677
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
678
|
+
const compare = require_compare();
|
|
679
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
680
|
+
module.exports = lt;
|
|
681
|
+
}));
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
|
|
684
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
685
|
+
const compare = require_compare();
|
|
686
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
687
|
+
module.exports = eq;
|
|
688
|
+
}));
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
|
|
691
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
692
|
+
const compare = require_compare();
|
|
693
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
694
|
+
module.exports = neq;
|
|
695
|
+
}));
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
|
|
698
|
+
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
699
|
+
const compare = require_compare();
|
|
700
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
701
|
+
module.exports = gte;
|
|
702
|
+
}));
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
|
|
705
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
706
|
+
const compare = require_compare();
|
|
707
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
708
|
+
module.exports = lte;
|
|
709
|
+
}));
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
|
|
712
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
713
|
+
const eq = require_eq();
|
|
714
|
+
const neq = require_neq();
|
|
715
|
+
const gt = require_gt();
|
|
716
|
+
const gte = require_gte();
|
|
717
|
+
const lt = require_lt();
|
|
718
|
+
const lte = require_lte();
|
|
719
|
+
const cmp = (a, op, b, loose) => {
|
|
720
|
+
switch (op) {
|
|
721
|
+
case "===":
|
|
722
|
+
if (typeof a === "object") a = a.version;
|
|
723
|
+
if (typeof b === "object") b = b.version;
|
|
724
|
+
return a === b;
|
|
725
|
+
case "!==":
|
|
726
|
+
if (typeof a === "object") a = a.version;
|
|
727
|
+
if (typeof b === "object") b = b.version;
|
|
728
|
+
return a !== b;
|
|
729
|
+
case "":
|
|
730
|
+
case "=":
|
|
731
|
+
case "==": return eq(a, b, loose);
|
|
732
|
+
case "!=": return neq(a, b, loose);
|
|
733
|
+
case ">": return gt(a, b, loose);
|
|
734
|
+
case ">=": return gte(a, b, loose);
|
|
735
|
+
case "<": return lt(a, b, loose);
|
|
736
|
+
case "<=": return lte(a, b, loose);
|
|
737
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
module.exports = cmp;
|
|
741
|
+
}));
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js
|
|
744
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
745
|
+
const SemVer = require_semver$1();
|
|
746
|
+
const parse = require_parse();
|
|
747
|
+
const { safeRe: re, t } = require_re();
|
|
748
|
+
const coerce = (version, options) => {
|
|
749
|
+
if (version instanceof SemVer) return version;
|
|
750
|
+
if (typeof version === "number") version = String(version);
|
|
751
|
+
if (typeof version !== "string") return null;
|
|
752
|
+
options = options || {};
|
|
753
|
+
let match = null;
|
|
754
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
755
|
+
else {
|
|
756
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
757
|
+
let next;
|
|
758
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
759
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
760
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
761
|
+
}
|
|
762
|
+
coerceRtlRegex.lastIndex = -1;
|
|
763
|
+
}
|
|
764
|
+
if (match === null) return null;
|
|
765
|
+
const major = match[2];
|
|
766
|
+
const minor = match[3] || "0";
|
|
767
|
+
const patch = match[4] || "0";
|
|
768
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
769
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
770
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
771
|
+
};
|
|
772
|
+
module.exports = coerce;
|
|
773
|
+
}));
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js
|
|
776
|
+
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
777
|
+
const parse = require_parse();
|
|
778
|
+
const constants = require_constants();
|
|
779
|
+
const SemVer = require_semver$1();
|
|
780
|
+
const truncate = (version, truncation, options) => {
|
|
781
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
782
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
783
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
784
|
+
};
|
|
785
|
+
const cloneInputVersion = (version, options) => {
|
|
786
|
+
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
787
|
+
return parse(versionStringToParse, options);
|
|
788
|
+
};
|
|
789
|
+
const doTruncation = (version, truncation) => {
|
|
790
|
+
if (isPrerelease(truncation)) return version.version;
|
|
791
|
+
version.prerelease = [];
|
|
792
|
+
switch (truncation) {
|
|
793
|
+
case "major":
|
|
794
|
+
version.minor = 0;
|
|
795
|
+
version.patch = 0;
|
|
796
|
+
break;
|
|
797
|
+
case "minor": version.patch = 0;
|
|
798
|
+
}
|
|
799
|
+
return version.format();
|
|
800
|
+
};
|
|
801
|
+
const isPrerelease = (type) => {
|
|
802
|
+
return type.startsWith("pre");
|
|
803
|
+
};
|
|
804
|
+
module.exports = truncate;
|
|
805
|
+
}));
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
|
|
808
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
809
|
+
var LRUCache = class {
|
|
810
|
+
constructor() {
|
|
811
|
+
this.max = 1e3;
|
|
812
|
+
this.map = /* @__PURE__ */ new Map();
|
|
813
|
+
}
|
|
814
|
+
get(key) {
|
|
815
|
+
const value = this.map.get(key);
|
|
816
|
+
if (value === void 0) return;
|
|
817
|
+
else {
|
|
818
|
+
this.map.delete(key);
|
|
819
|
+
this.map.set(key, value);
|
|
820
|
+
return value;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
delete(key) {
|
|
824
|
+
return this.map.delete(key);
|
|
825
|
+
}
|
|
826
|
+
set(key, value) {
|
|
827
|
+
if (!this.delete(key) && value !== void 0) {
|
|
828
|
+
if (this.map.size >= this.max) {
|
|
829
|
+
const firstKey = this.map.keys().next().value;
|
|
830
|
+
this.delete(firstKey);
|
|
831
|
+
}
|
|
832
|
+
this.map.set(key, value);
|
|
833
|
+
}
|
|
834
|
+
return this;
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
module.exports = LRUCache;
|
|
838
|
+
}));
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
|
|
841
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
842
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
843
|
+
module.exports = class Range {
|
|
844
|
+
constructor(range, options) {
|
|
845
|
+
options = parseOptions(options);
|
|
846
|
+
if (range instanceof Range) {
|
|
847
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
848
|
+
else return new Range(range.raw, options);
|
|
849
|
+
}
|
|
850
|
+
if (range instanceof Comparator) {
|
|
851
|
+
this.raw = range.value;
|
|
852
|
+
this.set = [[range]];
|
|
853
|
+
this.formatted = void 0;
|
|
854
|
+
return this;
|
|
855
|
+
}
|
|
856
|
+
this.options = options;
|
|
857
|
+
this.loose = !!options.loose;
|
|
858
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
859
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
860
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
861
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
862
|
+
if (this.set.length > 1) {
|
|
863
|
+
const first = this.set[0];
|
|
864
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
865
|
+
if (this.set.length === 0) this.set = [first];
|
|
866
|
+
else if (this.set.length > 1) {
|
|
867
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
868
|
+
this.set = [c];
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
this.formatted = void 0;
|
|
874
|
+
}
|
|
875
|
+
get range() {
|
|
876
|
+
if (this.formatted === void 0) {
|
|
877
|
+
this.formatted = "";
|
|
878
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
879
|
+
if (i > 0) this.formatted += "||";
|
|
880
|
+
const comps = this.set[i];
|
|
881
|
+
for (let k = 0; k < comps.length; k++) {
|
|
882
|
+
if (k > 0) this.formatted += " ";
|
|
883
|
+
this.formatted += comps[k].toString().trim();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
return this.formatted;
|
|
888
|
+
}
|
|
889
|
+
format() {
|
|
890
|
+
return this.range;
|
|
891
|
+
}
|
|
892
|
+
toString() {
|
|
893
|
+
return this.range;
|
|
894
|
+
}
|
|
895
|
+
parseRange(range) {
|
|
896
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
897
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
898
|
+
const cached = cache.get(memoKey);
|
|
899
|
+
if (cached) return cached;
|
|
900
|
+
const loose = this.options.loose;
|
|
901
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
902
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
903
|
+
debug("hyphen replace", range);
|
|
904
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
905
|
+
debug("comparator trim", range);
|
|
906
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
907
|
+
debug("tilde trim", range);
|
|
908
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
909
|
+
debug("caret trim", range);
|
|
910
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
911
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
912
|
+
debug("loose invalid filter", comp, this.options);
|
|
913
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
914
|
+
});
|
|
915
|
+
debug("range list", rangeList);
|
|
916
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
917
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
918
|
+
for (const comp of comparators) {
|
|
919
|
+
if (isNullSet(comp)) return [comp];
|
|
920
|
+
rangeMap.set(comp.value, comp);
|
|
921
|
+
}
|
|
922
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
923
|
+
const result = [...rangeMap.values()];
|
|
924
|
+
cache.set(memoKey, result);
|
|
925
|
+
return result;
|
|
926
|
+
}
|
|
927
|
+
intersects(range, options) {
|
|
928
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
929
|
+
return this.set.some((thisComparators) => {
|
|
930
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
931
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
932
|
+
return rangeComparators.every((rangeComparator) => {
|
|
933
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
934
|
+
});
|
|
935
|
+
});
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
test(version) {
|
|
940
|
+
if (!version) return false;
|
|
941
|
+
if (typeof version === "string") try {
|
|
942
|
+
version = new SemVer(version, this.options);
|
|
943
|
+
} catch (er) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
const cache = new (require_lrucache())();
|
|
951
|
+
const parseOptions = require_parse_options();
|
|
952
|
+
const Comparator = require_comparator();
|
|
953
|
+
const debug = require_debug();
|
|
954
|
+
const SemVer = require_semver$1();
|
|
955
|
+
const { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
956
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
957
|
+
const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
958
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
959
|
+
const isAny = (c) => c.value === "";
|
|
960
|
+
const isSatisfiable = (comparators, options) => {
|
|
961
|
+
let result = true;
|
|
962
|
+
const remainingComparators = comparators.slice();
|
|
963
|
+
let testComparator = remainingComparators.pop();
|
|
964
|
+
while (result && remainingComparators.length) {
|
|
965
|
+
result = remainingComparators.every((otherComparator) => {
|
|
966
|
+
return testComparator.intersects(otherComparator, options);
|
|
967
|
+
});
|
|
968
|
+
testComparator = remainingComparators.pop();
|
|
969
|
+
}
|
|
970
|
+
return result;
|
|
971
|
+
};
|
|
972
|
+
const parseComparator = (comp, options) => {
|
|
973
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
974
|
+
debug("comp", comp, options);
|
|
975
|
+
comp = replaceCarets(comp, options);
|
|
976
|
+
debug("caret", comp);
|
|
977
|
+
comp = replaceTildes(comp, options);
|
|
978
|
+
debug("tildes", comp);
|
|
979
|
+
comp = replaceXRanges(comp, options);
|
|
980
|
+
debug("xrange", comp);
|
|
981
|
+
comp = replaceStars(comp, options);
|
|
982
|
+
debug("stars", comp);
|
|
983
|
+
return comp;
|
|
984
|
+
};
|
|
985
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
986
|
+
const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
987
|
+
const replaceTildes = (comp, options) => {
|
|
988
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
989
|
+
};
|
|
990
|
+
const replaceTilde = (comp, options) => {
|
|
991
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
992
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
993
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
994
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
995
|
+
let ret;
|
|
996
|
+
if (isX(M)) ret = "";
|
|
997
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
998
|
+
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
999
|
+
else if (pr) {
|
|
1000
|
+
debug("replaceTilde pr", pr);
|
|
1001
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1002
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1003
|
+
debug("tilde return", ret);
|
|
1004
|
+
return ret;
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
const replaceCarets = (comp, options) => {
|
|
1008
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1009
|
+
};
|
|
1010
|
+
const replaceCaret = (comp, options) => {
|
|
1011
|
+
debug("caret", comp, options);
|
|
1012
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1013
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1014
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1015
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1016
|
+
let ret;
|
|
1017
|
+
if (isX(M)) ret = "";
|
|
1018
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1019
|
+
else if (isX(p)) {
|
|
1020
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1021
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1022
|
+
} else if (pr) {
|
|
1023
|
+
debug("replaceCaret pr", pr);
|
|
1024
|
+
if (M === "0") {
|
|
1025
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1026
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1027
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1028
|
+
} else {
|
|
1029
|
+
debug("no pr");
|
|
1030
|
+
if (M === "0") {
|
|
1031
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
1032
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1033
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1034
|
+
}
|
|
1035
|
+
debug("caret return", ret);
|
|
1036
|
+
return ret;
|
|
1037
|
+
});
|
|
1038
|
+
};
|
|
1039
|
+
const replaceXRanges = (comp, options) => {
|
|
1040
|
+
debug("replaceXRanges", comp, options);
|
|
1041
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1042
|
+
};
|
|
1043
|
+
const replaceXRange = (comp, options) => {
|
|
1044
|
+
comp = comp.trim();
|
|
1045
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1046
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1047
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1048
|
+
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
1049
|
+
const xM = isX(M);
|
|
1050
|
+
const xm = xM || isX(m);
|
|
1051
|
+
const xp = xm || isX(p);
|
|
1052
|
+
const anyX = xp;
|
|
1053
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
1054
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1055
|
+
if (xM) {
|
|
1056
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
1057
|
+
else ret = "*";
|
|
1058
|
+
} else if (gtlt && anyX) {
|
|
1059
|
+
if (xm) m = 0;
|
|
1060
|
+
p = 0;
|
|
1061
|
+
if (gtlt === ">") {
|
|
1062
|
+
gtlt = ">=";
|
|
1063
|
+
if (xm) {
|
|
1064
|
+
M = +M + 1;
|
|
1065
|
+
m = 0;
|
|
1066
|
+
p = 0;
|
|
1067
|
+
} else {
|
|
1068
|
+
m = +m + 1;
|
|
1069
|
+
p = 0;
|
|
1070
|
+
}
|
|
1071
|
+
} else if (gtlt === "<=") {
|
|
1072
|
+
gtlt = "<";
|
|
1073
|
+
if (xm) M = +M + 1;
|
|
1074
|
+
else m = +m + 1;
|
|
1075
|
+
}
|
|
1076
|
+
if (gtlt === "<") pr = "-0";
|
|
1077
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1078
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1079
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1080
|
+
debug("xRange return", ret);
|
|
1081
|
+
return ret;
|
|
1082
|
+
});
|
|
1083
|
+
};
|
|
1084
|
+
const replaceStars = (comp, options) => {
|
|
1085
|
+
debug("replaceStars", comp, options);
|
|
1086
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1087
|
+
};
|
|
1088
|
+
const replaceGTE0 = (comp, options) => {
|
|
1089
|
+
debug("replaceGTE0", comp, options);
|
|
1090
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1091
|
+
};
|
|
1092
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1093
|
+
if (isX(fM)) from = "";
|
|
1094
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1095
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1096
|
+
else if (fpr) from = `>=${from}`;
|
|
1097
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1098
|
+
if (isX(tM)) to = "";
|
|
1099
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
1100
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
1101
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1102
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1103
|
+
else to = `<=${to}`;
|
|
1104
|
+
return `${from} ${to}`.trim();
|
|
1105
|
+
};
|
|
1106
|
+
const testSet = (set, version, options) => {
|
|
1107
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
1108
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1109
|
+
for (let i = 0; i < set.length; i++) {
|
|
1110
|
+
debug(set[i].semver);
|
|
1111
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
1112
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1113
|
+
const allowed = set[i].semver;
|
|
1114
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
return true;
|
|
1120
|
+
};
|
|
1121
|
+
}));
|
|
1122
|
+
//#endregion
|
|
1123
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
|
|
1124
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1125
|
+
const ANY = Symbol("SemVer ANY");
|
|
1126
|
+
module.exports = class Comparator {
|
|
1127
|
+
static get ANY() {
|
|
1128
|
+
return ANY;
|
|
1129
|
+
}
|
|
1130
|
+
constructor(comp, options) {
|
|
1131
|
+
options = parseOptions(options);
|
|
1132
|
+
if (comp instanceof Comparator) {
|
|
1133
|
+
if (comp.loose === !!options.loose) return comp;
|
|
1134
|
+
else comp = comp.value;
|
|
1135
|
+
}
|
|
1136
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1137
|
+
debug("comparator", comp, options);
|
|
1138
|
+
this.options = options;
|
|
1139
|
+
this.loose = !!options.loose;
|
|
1140
|
+
this.parse(comp);
|
|
1141
|
+
if (this.semver === ANY) this.value = "";
|
|
1142
|
+
else this.value = this.operator + this.semver.version;
|
|
1143
|
+
debug("comp", this);
|
|
1144
|
+
}
|
|
1145
|
+
parse(comp) {
|
|
1146
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1147
|
+
const m = comp.match(r);
|
|
1148
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1149
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1150
|
+
if (this.operator === "=") this.operator = "";
|
|
1151
|
+
if (!m[2]) this.semver = ANY;
|
|
1152
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
1153
|
+
}
|
|
1154
|
+
toString() {
|
|
1155
|
+
return this.value;
|
|
1156
|
+
}
|
|
1157
|
+
test(version) {
|
|
1158
|
+
debug("Comparator.test", version, this.options.loose);
|
|
1159
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
1160
|
+
if (typeof version === "string") try {
|
|
1161
|
+
version = new SemVer(version, this.options);
|
|
1162
|
+
} catch (er) {
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
1166
|
+
}
|
|
1167
|
+
intersects(comp, options) {
|
|
1168
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
1169
|
+
if (this.operator === "") {
|
|
1170
|
+
if (this.value === "") return true;
|
|
1171
|
+
return new Range(comp.value, options).test(this.value);
|
|
1172
|
+
} else if (comp.operator === "") {
|
|
1173
|
+
if (comp.value === "") return true;
|
|
1174
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1175
|
+
}
|
|
1176
|
+
options = parseOptions(options);
|
|
1177
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
1178
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
1179
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
1180
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
1181
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
1182
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
1183
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
1184
|
+
return false;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
const parseOptions = require_parse_options();
|
|
1188
|
+
const { safeRe: re, t } = require_re();
|
|
1189
|
+
const cmp = require_cmp();
|
|
1190
|
+
const debug = require_debug();
|
|
1191
|
+
const SemVer = require_semver$1();
|
|
1192
|
+
const Range = require_range();
|
|
1193
|
+
}));
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
|
|
1196
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1197
|
+
const Range = require_range();
|
|
1198
|
+
const satisfies = (version, range, options) => {
|
|
1199
|
+
try {
|
|
1200
|
+
range = new Range(range, options);
|
|
1201
|
+
} catch (er) {
|
|
1202
|
+
return false;
|
|
1203
|
+
}
|
|
1204
|
+
return range.test(version);
|
|
1205
|
+
};
|
|
1206
|
+
module.exports = satisfies;
|
|
1207
|
+
}));
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js
|
|
1210
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1211
|
+
const Range = require_range();
|
|
1212
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1213
|
+
module.exports = toComparators;
|
|
1214
|
+
}));
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js
|
|
1217
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1218
|
+
const SemVer = require_semver$1();
|
|
1219
|
+
const Range = require_range();
|
|
1220
|
+
const maxSatisfying = (versions, range, options) => {
|
|
1221
|
+
let max = null;
|
|
1222
|
+
let maxSV = null;
|
|
1223
|
+
let rangeObj = null;
|
|
1224
|
+
try {
|
|
1225
|
+
rangeObj = new Range(range, options);
|
|
1226
|
+
} catch (er) {
|
|
1227
|
+
return null;
|
|
1228
|
+
}
|
|
1229
|
+
versions.forEach((v) => {
|
|
1230
|
+
if (rangeObj.test(v)) {
|
|
1231
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1232
|
+
max = v;
|
|
1233
|
+
maxSV = new SemVer(max, options);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
return max;
|
|
1238
|
+
};
|
|
1239
|
+
module.exports = maxSatisfying;
|
|
1240
|
+
}));
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js
|
|
1243
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1244
|
+
const SemVer = require_semver$1();
|
|
1245
|
+
const Range = require_range();
|
|
1246
|
+
const minSatisfying = (versions, range, options) => {
|
|
1247
|
+
let min = null;
|
|
1248
|
+
let minSV = null;
|
|
1249
|
+
let rangeObj = null;
|
|
1250
|
+
try {
|
|
1251
|
+
rangeObj = new Range(range, options);
|
|
1252
|
+
} catch (er) {
|
|
1253
|
+
return null;
|
|
1254
|
+
}
|
|
1255
|
+
versions.forEach((v) => {
|
|
1256
|
+
if (rangeObj.test(v)) {
|
|
1257
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1258
|
+
min = v;
|
|
1259
|
+
minSV = new SemVer(min, options);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
return min;
|
|
1264
|
+
};
|
|
1265
|
+
module.exports = minSatisfying;
|
|
1266
|
+
}));
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js
|
|
1269
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1270
|
+
const SemVer = require_semver$1();
|
|
1271
|
+
const Range = require_range();
|
|
1272
|
+
const gt = require_gt();
|
|
1273
|
+
const minVersion = (range, loose) => {
|
|
1274
|
+
range = new Range(range, loose);
|
|
1275
|
+
let minver = new SemVer("0.0.0");
|
|
1276
|
+
if (range.test(minver)) return minver;
|
|
1277
|
+
minver = new SemVer("0.0.0-0");
|
|
1278
|
+
if (range.test(minver)) return minver;
|
|
1279
|
+
minver = null;
|
|
1280
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1281
|
+
const comparators = range.set[i];
|
|
1282
|
+
let setMin = null;
|
|
1283
|
+
comparators.forEach((comparator) => {
|
|
1284
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1285
|
+
switch (comparator.operator) {
|
|
1286
|
+
case ">":
|
|
1287
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
1288
|
+
else compver.prerelease.push(0);
|
|
1289
|
+
compver.raw = compver.format();
|
|
1290
|
+
case "":
|
|
1291
|
+
case ">=":
|
|
1292
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
1293
|
+
break;
|
|
1294
|
+
case "<":
|
|
1295
|
+
case "<=": break;
|
|
1296
|
+
/* istanbul ignore next */
|
|
1297
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
1301
|
+
}
|
|
1302
|
+
if (minver && range.test(minver)) return minver;
|
|
1303
|
+
return null;
|
|
1304
|
+
};
|
|
1305
|
+
module.exports = minVersion;
|
|
1306
|
+
}));
|
|
1307
|
+
//#endregion
|
|
1308
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
|
|
1309
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1310
|
+
const Range = require_range();
|
|
1311
|
+
const validRange = (range, options) => {
|
|
1312
|
+
try {
|
|
1313
|
+
return new Range(range, options).range || "*";
|
|
1314
|
+
} catch (er) {
|
|
1315
|
+
return null;
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
module.exports = validRange;
|
|
1319
|
+
}));
|
|
1320
|
+
//#endregion
|
|
1321
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js
|
|
1322
|
+
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1323
|
+
const SemVer = require_semver$1();
|
|
1324
|
+
const Comparator = require_comparator();
|
|
1325
|
+
const { ANY } = Comparator;
|
|
1326
|
+
const Range = require_range();
|
|
1327
|
+
const satisfies = require_satisfies();
|
|
1328
|
+
const gt = require_gt();
|
|
1329
|
+
const lt = require_lt();
|
|
1330
|
+
const lte = require_lte();
|
|
1331
|
+
const gte = require_gte();
|
|
1332
|
+
const outside = (version, range, hilo, options) => {
|
|
1333
|
+
version = new SemVer(version, options);
|
|
1334
|
+
range = new Range(range, options);
|
|
1335
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1336
|
+
switch (hilo) {
|
|
1337
|
+
case ">":
|
|
1338
|
+
gtfn = gt;
|
|
1339
|
+
ltefn = lte;
|
|
1340
|
+
ltfn = lt;
|
|
1341
|
+
comp = ">";
|
|
1342
|
+
ecomp = ">=";
|
|
1343
|
+
break;
|
|
1344
|
+
case "<":
|
|
1345
|
+
gtfn = lt;
|
|
1346
|
+
ltefn = gte;
|
|
1347
|
+
ltfn = gt;
|
|
1348
|
+
comp = "<";
|
|
1349
|
+
ecomp = "<=";
|
|
1350
|
+
break;
|
|
1351
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
1352
|
+
}
|
|
1353
|
+
if (satisfies(version, range, options)) return false;
|
|
1354
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1355
|
+
const comparators = range.set[i];
|
|
1356
|
+
let high = null;
|
|
1357
|
+
let low = null;
|
|
1358
|
+
comparators.forEach((comparator) => {
|
|
1359
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
1360
|
+
high = high || comparator;
|
|
1361
|
+
low = low || comparator;
|
|
1362
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
1363
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
1364
|
+
});
|
|
1365
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
1366
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
1367
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
1368
|
+
}
|
|
1369
|
+
return true;
|
|
1370
|
+
};
|
|
1371
|
+
module.exports = outside;
|
|
1372
|
+
}));
|
|
1373
|
+
//#endregion
|
|
1374
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js
|
|
1375
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1376
|
+
const outside = require_outside();
|
|
1377
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1378
|
+
module.exports = gtr;
|
|
1379
|
+
}));
|
|
1380
|
+
//#endregion
|
|
1381
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js
|
|
1382
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1383
|
+
const outside = require_outside();
|
|
1384
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1385
|
+
module.exports = ltr;
|
|
1386
|
+
}));
|
|
1387
|
+
//#endregion
|
|
1388
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js
|
|
1389
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1390
|
+
const Range = require_range();
|
|
1391
|
+
const intersects = (r1, r2, options) => {
|
|
1392
|
+
r1 = new Range(r1, options);
|
|
1393
|
+
r2 = new Range(r2, options);
|
|
1394
|
+
return r1.intersects(r2, options);
|
|
1395
|
+
};
|
|
1396
|
+
module.exports = intersects;
|
|
1397
|
+
}));
|
|
1398
|
+
//#endregion
|
|
1399
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js
|
|
1400
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1401
|
+
const satisfies = require_satisfies();
|
|
1402
|
+
const compare = require_compare();
|
|
1403
|
+
module.exports = (versions, range, options) => {
|
|
1404
|
+
const set = [];
|
|
1405
|
+
let first = null;
|
|
1406
|
+
let prev = null;
|
|
1407
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
1408
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
1409
|
+
prev = version;
|
|
1410
|
+
if (!first) first = version;
|
|
1411
|
+
} else {
|
|
1412
|
+
if (prev) set.push([first, prev]);
|
|
1413
|
+
prev = null;
|
|
1414
|
+
first = null;
|
|
1415
|
+
}
|
|
1416
|
+
if (first) set.push([first, null]);
|
|
1417
|
+
const ranges = [];
|
|
1418
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
1419
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
1420
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
1421
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
1422
|
+
else ranges.push(`${min} - ${max}`);
|
|
1423
|
+
const simplified = ranges.join(" || ");
|
|
1424
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1425
|
+
return simplified.length < original.length ? simplified : range;
|
|
1426
|
+
};
|
|
1427
|
+
}));
|
|
1428
|
+
//#endregion
|
|
1429
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js
|
|
1430
|
+
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1431
|
+
const Range = require_range();
|
|
1432
|
+
const Comparator = require_comparator();
|
|
1433
|
+
const { ANY } = Comparator;
|
|
1434
|
+
const satisfies = require_satisfies();
|
|
1435
|
+
const compare = require_compare();
|
|
1436
|
+
const subset = (sub, dom, options = {}) => {
|
|
1437
|
+
if (sub === dom) return true;
|
|
1438
|
+
sub = new Range(sub, options);
|
|
1439
|
+
dom = new Range(dom, options);
|
|
1440
|
+
let sawNonNull = false;
|
|
1441
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1442
|
+
for (const simpleDom of dom.set) {
|
|
1443
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1444
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1445
|
+
if (isSub) continue OUTER;
|
|
1446
|
+
}
|
|
1447
|
+
if (sawNonNull) return false;
|
|
1448
|
+
}
|
|
1449
|
+
return true;
|
|
1450
|
+
};
|
|
1451
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1452
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
1453
|
+
const simpleSubset = (sub, dom, options) => {
|
|
1454
|
+
if (sub === dom) return true;
|
|
1455
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1456
|
+
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
1457
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
1458
|
+
else sub = minimumVersion;
|
|
1459
|
+
}
|
|
1460
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1461
|
+
if (options.includePrerelease) return true;
|
|
1462
|
+
else dom = minimumVersion;
|
|
1463
|
+
}
|
|
1464
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1465
|
+
let gt, lt;
|
|
1466
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
1467
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
1468
|
+
else eqSet.add(c.semver);
|
|
1469
|
+
if (eqSet.size > 1) return null;
|
|
1470
|
+
let gtltComp;
|
|
1471
|
+
if (gt && lt) {
|
|
1472
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1473
|
+
if (gtltComp > 0) return null;
|
|
1474
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
1475
|
+
}
|
|
1476
|
+
for (const eq of eqSet) {
|
|
1477
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
1478
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
1479
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
let higher, lower;
|
|
1483
|
+
let hasDomLT, hasDomGT;
|
|
1484
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1485
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1486
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
1487
|
+
for (const c of dom) {
|
|
1488
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1489
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1490
|
+
if (gt) {
|
|
1491
|
+
if (needDomGTPre) {
|
|
1492
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
1493
|
+
}
|
|
1494
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1495
|
+
higher = higherGT(gt, c, options);
|
|
1496
|
+
if (higher === c && higher !== gt) return false;
|
|
1497
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
1498
|
+
}
|
|
1499
|
+
if (lt) {
|
|
1500
|
+
if (needDomLTPre) {
|
|
1501
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
1502
|
+
}
|
|
1503
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1504
|
+
lower = lowerLT(lt, c, options);
|
|
1505
|
+
if (lower === c && lower !== lt) return false;
|
|
1506
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
1507
|
+
}
|
|
1508
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
1509
|
+
}
|
|
1510
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
1511
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
1512
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
1513
|
+
return true;
|
|
1514
|
+
};
|
|
1515
|
+
const higherGT = (a, b, options) => {
|
|
1516
|
+
if (!a) return b;
|
|
1517
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1518
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1519
|
+
};
|
|
1520
|
+
const lowerLT = (a, b, options) => {
|
|
1521
|
+
if (!a) return b;
|
|
1522
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1523
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1524
|
+
};
|
|
1525
|
+
module.exports = subset;
|
|
1526
|
+
}));
|
|
1527
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1528
|
+
const internalRe = require_re();
|
|
1529
|
+
const constants = require_constants();
|
|
1530
|
+
const SemVer = require_semver$1();
|
|
1531
|
+
const identifiers = require_identifiers();
|
|
1532
|
+
module.exports = {
|
|
1533
|
+
parse: require_parse(),
|
|
1534
|
+
valid: require_valid$1(),
|
|
1535
|
+
clean: require_clean(),
|
|
1536
|
+
inc: require_inc(),
|
|
1537
|
+
diff: require_diff(),
|
|
1538
|
+
major: require_major(),
|
|
1539
|
+
minor: require_minor(),
|
|
1540
|
+
patch: require_patch(),
|
|
1541
|
+
prerelease: require_prerelease(),
|
|
1542
|
+
compare: require_compare(),
|
|
1543
|
+
rcompare: require_rcompare(),
|
|
1544
|
+
compareLoose: require_compare_loose(),
|
|
1545
|
+
compareBuild: require_compare_build(),
|
|
1546
|
+
sort: require_sort(),
|
|
1547
|
+
rsort: require_rsort(),
|
|
1548
|
+
gt: require_gt(),
|
|
1549
|
+
lt: require_lt(),
|
|
1550
|
+
eq: require_eq(),
|
|
1551
|
+
neq: require_neq(),
|
|
1552
|
+
gte: require_gte(),
|
|
1553
|
+
lte: require_lte(),
|
|
1554
|
+
cmp: require_cmp(),
|
|
1555
|
+
coerce: require_coerce(),
|
|
1556
|
+
truncate: require_truncate(),
|
|
1557
|
+
Comparator: require_comparator(),
|
|
1558
|
+
Range: require_range(),
|
|
1559
|
+
satisfies: require_satisfies(),
|
|
1560
|
+
toComparators: require_to_comparators(),
|
|
1561
|
+
maxSatisfying: require_max_satisfying(),
|
|
1562
|
+
minSatisfying: require_min_satisfying(),
|
|
1563
|
+
minVersion: require_min_version(),
|
|
1564
|
+
validRange: require_valid(),
|
|
1565
|
+
outside: require_outside(),
|
|
1566
|
+
gtr: require_gtr(),
|
|
1567
|
+
ltr: require_ltr(),
|
|
1568
|
+
intersects: require_intersects(),
|
|
1569
|
+
simplifyRange: require_simplify(),
|
|
1570
|
+
subset: require_subset(),
|
|
1571
|
+
SemVer,
|
|
1572
|
+
re: internalRe.re,
|
|
1573
|
+
src: internalRe.src,
|
|
1574
|
+
tokens: internalRe.t,
|
|
1575
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1576
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1577
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1578
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1579
|
+
};
|
|
1580
|
+
})))();
|
|
174
1581
|
const AI_PLATFORMS = ["chatgpt", "claudeai"];
|
|
175
1582
|
const platformSchema = z.enum(AI_PLATFORMS);
|
|
176
1583
|
const PLATFORM_LABELS = {
|
|
@@ -179,6 +1586,7 @@ const PLATFORM_LABELS = {
|
|
|
179
1586
|
};
|
|
180
1587
|
const WAF_PLATFORMS = [
|
|
181
1588
|
"akamai",
|
|
1589
|
+
"cato",
|
|
182
1590
|
"cloudflare",
|
|
183
1591
|
"fastly"
|
|
184
1592
|
];
|
|
@@ -256,6 +1664,25 @@ z.object({
|
|
|
256
1664
|
clientSecret: z.string(),
|
|
257
1665
|
clientScopes: z.array(z.string())
|
|
258
1666
|
});
|
|
1667
|
+
const creditEntryReasonSchema = z.enum([
|
|
1668
|
+
"free_seed",
|
|
1669
|
+
"paid_conversion_floor",
|
|
1670
|
+
"top_up",
|
|
1671
|
+
"usage",
|
|
1672
|
+
"admin_adjustment"
|
|
1673
|
+
]);
|
|
1674
|
+
z.enum(["playground"]);
|
|
1675
|
+
z.number().int().min(500);
|
|
1676
|
+
const creditActivityEntrySchema = z.object({
|
|
1677
|
+
reason: creditEntryReasonSchema,
|
|
1678
|
+
day: z.number(),
|
|
1679
|
+
amountInNanoUSD: z.number(),
|
|
1680
|
+
messageCount: z.number().nullable()
|
|
1681
|
+
});
|
|
1682
|
+
z.object({
|
|
1683
|
+
balanceInNanoUSD: z.number(),
|
|
1684
|
+
recentActivity: z.array(creditActivityEntrySchema)
|
|
1685
|
+
});
|
|
259
1686
|
const deploymentStatusSchema$1 = z.enum([
|
|
260
1687
|
"ongoing",
|
|
261
1688
|
"deployed",
|
|
@@ -283,33 +1710,18 @@ const deploymentSummarySchema = z.object({
|
|
|
283
1710
|
createdAt: z.coerce.date(),
|
|
284
1711
|
updatedAt: z.coerce.date()
|
|
285
1712
|
});
|
|
286
|
-
/**
|
|
287
|
-
* Public environment
|
|
288
|
-
*
|
|
289
|
-
* Answers anonymously and exposes no OAuth metadata.
|
|
290
|
-
*/
|
|
1713
|
+
/** Public environment: answers anonymously and exposes no OAuth metadata. */
|
|
291
1714
|
const publicEnvironmentSchema = z.object({
|
|
292
1715
|
allowsAnonymous: z.literal(true),
|
|
293
1716
|
oAuthMetadata: z.strictObject({})
|
|
294
1717
|
});
|
|
295
|
-
/**
|
|
296
|
-
* Protected environment with an external resource metadata URL
|
|
297
|
-
*
|
|
298
|
-
* An external resource metadata URL is returned in the WWW-Authenticate header during the first 401 response.
|
|
299
|
-
* Everything that follows is handled outside of the MCP server scope.
|
|
300
|
-
*/
|
|
1718
|
+
/** Protected environment whose external resource metadata URL is returned in the WWW-Authenticate header on the first 401; everything after is handled outside the MCP server scope. */
|
|
301
1719
|
const externalResourceMetadataEnvironmentSchema = z.object({
|
|
302
1720
|
allowsAnonymous: z.boolean(),
|
|
303
1721
|
oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
|
|
304
1722
|
scope: z.string().optional()
|
|
305
1723
|
});
|
|
306
|
-
/**
|
|
307
|
-
* Protected environment with an external authorization server URL
|
|
308
|
-
*
|
|
309
|
-
* The server itself exposes the /.well-known/oauth-protected-resource endpoint.
|
|
310
|
-
* An external authorization server URL is returned when requesting the endpoint.
|
|
311
|
-
* Everything that follows is handled outside of the MCP server scope.
|
|
312
|
-
*/
|
|
1724
|
+
/** Protected environment whose own /.well-known/oauth-protected-resource endpoint points at an external authorization server; everything after is handled outside the MCP server scope. */
|
|
313
1725
|
const externalAuthorizationServerEnvironmentSchema = z.object({
|
|
314
1726
|
allowsAnonymous: z.boolean(),
|
|
315
1727
|
oAuthMetadata: z.object({
|
|
@@ -318,12 +1730,7 @@ const externalAuthorizationServerEnvironmentSchema = z.object({
|
|
|
318
1730
|
}),
|
|
319
1731
|
scope: z.string().optional()
|
|
320
1732
|
});
|
|
321
|
-
/**
|
|
322
|
-
* Standalone protected environment
|
|
323
|
-
*
|
|
324
|
-
* The server itself exposes the /.well-known/oauth-protected-resource endpoint.
|
|
325
|
-
* The server itself exposes the /.well-known/oauth-authorization-server endpoint.
|
|
326
|
-
*/
|
|
1733
|
+
/** Standalone protected environment: the server itself exposes both the /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints. */
|
|
327
1734
|
const standaloneEnvironmentSchema = z.object({
|
|
328
1735
|
allowsAnonymous: z.boolean(),
|
|
329
1736
|
oAuthMetadata: z.object({
|
|
@@ -332,17 +1739,12 @@ const standaloneEnvironmentSchema = z.object({
|
|
|
332
1739
|
}),
|
|
333
1740
|
scope: z.string().optional()
|
|
334
1741
|
});
|
|
335
|
-
/**
|
|
336
|
-
* Protected environment without OAuth discovery
|
|
337
|
-
*
|
|
338
|
-
* The server enforces authentication but exposes no OAuth discovery metadata.
|
|
339
|
-
* Neither /.well-known/oauth-protected-resource nor /.well-known/oauth-authorization-server
|
|
340
|
-
* are advertised. Clients must obtain credentials out-of-band.
|
|
341
|
-
*/
|
|
1742
|
+
/** Protected environment that enforces authentication but advertises no OAuth discovery metadata; clients must obtain credentials out-of-band. */
|
|
342
1743
|
const protectedWithoutDiscoveryEnvironmentSchema = z.object({
|
|
343
1744
|
allowsAnonymous: z.literal(false),
|
|
344
1745
|
oAuthMetadata: z.strictObject({}),
|
|
345
|
-
scope: z.string().optional()
|
|
1746
|
+
scope: z.string().optional(),
|
|
1747
|
+
wwwAuthenticate: z.string().optional()
|
|
346
1748
|
});
|
|
347
1749
|
const legacyPublicEnvironmentSchema = z.object({
|
|
348
1750
|
isPublic: z.literal(true),
|
|
@@ -387,10 +1789,13 @@ z.union([
|
|
|
387
1789
|
legacyProtectedWithoutDiscoveryEnvironmentSchema
|
|
388
1790
|
]);
|
|
389
1791
|
const playgroundModelSchema = z.enum([
|
|
1792
|
+
"global.anthropic.claude-haiku-5-5",
|
|
390
1793
|
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
391
|
-
"global.anthropic.claude-sonnet-
|
|
1794
|
+
"global.anthropic.claude-sonnet-5-5",
|
|
392
1795
|
"openai.gpt-5.4",
|
|
393
|
-
"openai.gpt-5.5"
|
|
1796
|
+
"openai.gpt-5.5",
|
|
1797
|
+
"openai.gpt-6-luna",
|
|
1798
|
+
"openai.gpt-6.1-sol"
|
|
394
1799
|
]);
|
|
395
1800
|
const environmentDomainSchema = z.object({
|
|
396
1801
|
name: z.string(),
|
|
@@ -426,14 +1831,16 @@ z.object({
|
|
|
426
1831
|
collectResponsePayload: z.boolean(),
|
|
427
1832
|
collectErrorMessage: z.boolean(),
|
|
428
1833
|
collectUserData: z.boolean(),
|
|
429
|
-
identityTraitKey: z.string().min(1).max(200).nullable()
|
|
1834
|
+
identityTraitKey: z.string().min(1).max(200).nullable(),
|
|
1835
|
+
leadEventName: z.string().min(1).max(200).nullable()
|
|
430
1836
|
});
|
|
431
|
-
z.object({
|
|
1837
|
+
const feedbackSchema = z.object({
|
|
432
1838
|
id: z.string(),
|
|
433
1839
|
createdAt: z.coerce.date(),
|
|
434
1840
|
environmentId: z.string(),
|
|
435
1841
|
content: z.string(),
|
|
436
|
-
source: z.enum(["model", "user"])
|
|
1842
|
+
source: z.enum(["model", "user"]),
|
|
1843
|
+
clientName: z.string().nullable()
|
|
437
1844
|
});
|
|
438
1845
|
z.object({
|
|
439
1846
|
content: z.string(),
|
|
@@ -449,7 +1856,7 @@ const intentCategoryColorSchema = z.enum([
|
|
|
449
1856
|
"pink",
|
|
450
1857
|
"gray"
|
|
451
1858
|
]);
|
|
452
|
-
intentCategoryColorSchema.options;
|
|
1859
|
+
const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
|
|
453
1860
|
const intentCategorySchema = z.object({
|
|
454
1861
|
id: z.string(),
|
|
455
1862
|
createdAt: z.coerce.date(),
|
|
@@ -457,7 +1864,7 @@ const intentCategorySchema = z.object({
|
|
|
457
1864
|
name: z.string(),
|
|
458
1865
|
color: intentCategoryColorSchema
|
|
459
1866
|
});
|
|
460
|
-
z.object({
|
|
1867
|
+
const intentCategorySummarySchema = z.object({
|
|
461
1868
|
id: z.string(),
|
|
462
1869
|
name: z.string(),
|
|
463
1870
|
color: intentCategoryColorSchema,
|
|
@@ -469,6 +1876,7 @@ z.object({
|
|
|
469
1876
|
environmentId: z.string(),
|
|
470
1877
|
toolName: z.string(),
|
|
471
1878
|
message: z.string(),
|
|
1879
|
+
clientName: z.string().nullable(),
|
|
472
1880
|
categories: z.array(intentCategorySchema)
|
|
473
1881
|
});
|
|
474
1882
|
const signalCategorySchema = z.object({
|
|
@@ -527,17 +1935,277 @@ z.object({
|
|
|
527
1935
|
createdAt: z.coerce.date(),
|
|
528
1936
|
updatedAt: z.coerce.date()
|
|
529
1937
|
});
|
|
1938
|
+
const alpicMcpRequestLogSchema = z.object({
|
|
1939
|
+
type: z.literal("mcp_request"),
|
|
1940
|
+
method: z.string()
|
|
1941
|
+
});
|
|
1942
|
+
const alpicMcpErrorLogSchema = z.object({
|
|
1943
|
+
type: z.literal("mcp_error"),
|
|
1944
|
+
method: z.string(),
|
|
1945
|
+
error: z.string()
|
|
1946
|
+
});
|
|
1947
|
+
z.union([alpicMcpRequestLogSchema, alpicMcpErrorLogSchema]);
|
|
530
1948
|
z.enum([
|
|
531
1949
|
"INFO",
|
|
532
1950
|
"WARNING",
|
|
533
1951
|
"DEBUG",
|
|
534
1952
|
"ERROR"
|
|
535
1953
|
]);
|
|
1954
|
+
const LOG_SEARCH_MAX_ESCAPED_LENGTH = 960;
|
|
1955
|
+
function escapeLogSearchTerm(search) {
|
|
1956
|
+
return [...search].flatMap((character) => [...new TextEncoder().encode(character)]).map((byte) => {
|
|
1957
|
+
const character = String.fromCharCode(byte);
|
|
1958
|
+
return /^[a-zA-Z0-9]$/.test(character) ? character : `\\x${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
1959
|
+
}).join("");
|
|
1960
|
+
}
|
|
1961
|
+
const logSearchSchema = z.string().max(240, `Search must be 240 characters or fewer`).refine((search) => escapeLogSearchTerm(search).length <= LOG_SEARCH_MAX_ESCAPED_LENGTH, "Search is too complex; shorten it or use fewer special characters");
|
|
1962
|
+
/** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
|
|
1963
|
+
const MCP_CLIENT_GROUPS = [
|
|
1964
|
+
{
|
|
1965
|
+
id: "claude_code",
|
|
1966
|
+
label: "Claude Code",
|
|
1967
|
+
vendor: "anthropic",
|
|
1968
|
+
rawNames: ["claude-code", "Anthropic/ClaudeCodeDesktop"]
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
id: "claude",
|
|
1972
|
+
label: "Claude",
|
|
1973
|
+
vendor: "anthropic",
|
|
1974
|
+
rawNames: [
|
|
1975
|
+
"Anthropic/ClaudeAI",
|
|
1976
|
+
"claude-ai",
|
|
1977
|
+
"claude",
|
|
1978
|
+
"Claude",
|
|
1979
|
+
"claude-desktop",
|
|
1980
|
+
"claude-desktop-3p"
|
|
1981
|
+
]
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
id: "claude_mobile",
|
|
1985
|
+
label: "Claude mobile",
|
|
1986
|
+
vendor: "anthropic",
|
|
1987
|
+
rawNames: ["claude-ios", "ClaudeAndroid"]
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
id: "claude_cowork",
|
|
1991
|
+
label: "Claude Cowork",
|
|
1992
|
+
vendor: "anthropic",
|
|
1993
|
+
rawNames: ["Anthropic/Cowork"]
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
id: "claude_sheet_add_in",
|
|
1997
|
+
label: "Claude (Sheet Add-In)",
|
|
1998
|
+
vendor: "anthropic",
|
|
1999
|
+
rawNames: ["sheet-add-in"]
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
id: "claude_toolbox",
|
|
2003
|
+
label: "Claude Toolbox",
|
|
2004
|
+
vendor: "anthropic",
|
|
2005
|
+
rawNames: ["Anthropic/Toolbox", "Anthropic/toolbox-bootstrap"]
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
id: "anthropic_api",
|
|
2009
|
+
label: "Anthropic API",
|
|
2010
|
+
vendor: "anthropic",
|
|
2011
|
+
rawNames: ["Anthropic/API"]
|
|
2012
|
+
},
|
|
2013
|
+
{
|
|
2014
|
+
id: "anthropic_connector_refresh",
|
|
2015
|
+
label: "Anthropic (connector refresh)",
|
|
2016
|
+
vendor: "anthropic",
|
|
2017
|
+
rawNames: ["Anthropic"]
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
id: "codex",
|
|
2021
|
+
label: "Codex",
|
|
2022
|
+
vendor: "openai",
|
|
2023
|
+
rawNames: [
|
|
2024
|
+
"codex-mcp-client",
|
|
2025
|
+
"codex",
|
|
2026
|
+
"Codex",
|
|
2027
|
+
"codex-cli",
|
|
2028
|
+
"openai-mcp (Codex)"
|
|
2029
|
+
]
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
id: "chatgpt",
|
|
2033
|
+
label: "ChatGPT",
|
|
2034
|
+
vendor: "openai",
|
|
2035
|
+
rawNames: ["openai-mcp", "openai-mcp (ChatGPT)"]
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
id: "openai_responses_api",
|
|
2039
|
+
label: "OpenAI Responses API",
|
|
2040
|
+
vendor: "openai",
|
|
2041
|
+
rawNames: ["openai-mcp (Responses API)"]
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
id: "openai_agent_builder",
|
|
2045
|
+
label: "OpenAI Agent Builder",
|
|
2046
|
+
vendor: "openai",
|
|
2047
|
+
rawNames: ["openai-mcp (Agent Builder)"]
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
id: "cursor",
|
|
2051
|
+
label: "Cursor",
|
|
2052
|
+
vendor: "cursor",
|
|
2053
|
+
rawNames: [
|
|
2054
|
+
"cursor-vscode",
|
|
2055
|
+
"Cursor",
|
|
2056
|
+
"cursor"
|
|
2057
|
+
]
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
id: "cline",
|
|
2061
|
+
label: "Cline",
|
|
2062
|
+
vendor: "cline",
|
|
2063
|
+
rawNames: [
|
|
2064
|
+
"Cline",
|
|
2065
|
+
"cline",
|
|
2066
|
+
"@cline/core"
|
|
2067
|
+
]
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
id: "github_copilot",
|
|
2071
|
+
label: "GitHub Copilot",
|
|
2072
|
+
vendor: "githubCopilot",
|
|
2073
|
+
rawNames: [
|
|
2074
|
+
"Copilot",
|
|
2075
|
+
"github-copilot-developer",
|
|
2076
|
+
"Copilot MCP Gateway",
|
|
2077
|
+
"Xcode/copilot-xcode"
|
|
2078
|
+
]
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
id: "gemini_cli",
|
|
2082
|
+
label: "Gemini CLI",
|
|
2083
|
+
vendor: "google",
|
|
2084
|
+
rawNames: ["gemini-cli-mcp-client", "gemini-cli"]
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
id: "antigravity",
|
|
2088
|
+
label: "Antigravity",
|
|
2089
|
+
vendor: "google",
|
|
2090
|
+
rawNames: ["antigravity-client"]
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
id: "gemini",
|
|
2094
|
+
label: "Gemini",
|
|
2095
|
+
vendor: "google",
|
|
2096
|
+
rawNames: ["Gemini", "google-ai-edge-gallery"]
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
id: "windsurf",
|
|
2100
|
+
label: "Windsurf",
|
|
2101
|
+
vendor: "windsurf",
|
|
2102
|
+
rawNames: ["Windsurf", "windsurf-client"]
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
id: "mistral",
|
|
2106
|
+
label: "Mistral / Le Chat",
|
|
2107
|
+
vendor: "mistral",
|
|
2108
|
+
rawNames: ["Mistral"],
|
|
2109
|
+
rawNamePrefixes: ["connector:custom-mcp:"]
|
|
2110
|
+
},
|
|
2111
|
+
{
|
|
2112
|
+
id: "n8n",
|
|
2113
|
+
label: "n8n",
|
|
2114
|
+
vendor: "n8n",
|
|
2115
|
+
rawNames: [
|
|
2116
|
+
"@n8n/n8n-nodes-langchain.mcpClient",
|
|
2117
|
+
"@n8n/n8n-nodes-langchain.mcpClientTool",
|
|
2118
|
+
"n8n"
|
|
2119
|
+
]
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
id: "alpic_playground",
|
|
2123
|
+
label: "Alpic Playground",
|
|
2124
|
+
vendor: "alpic",
|
|
2125
|
+
rawNames: ["alpic-playground", "playground"]
|
|
2126
|
+
},
|
|
2127
|
+
{
|
|
2128
|
+
id: "opencode",
|
|
2129
|
+
label: "opencode",
|
|
2130
|
+
vendor: "opencode",
|
|
2131
|
+
rawNames: ["opencode"]
|
|
2132
|
+
},
|
|
2133
|
+
{
|
|
2134
|
+
id: "zed",
|
|
2135
|
+
label: "Zed",
|
|
2136
|
+
vendor: "zed",
|
|
2137
|
+
rawNames: ["Zed", "zed"]
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
id: "zapier",
|
|
2141
|
+
label: "Zapier",
|
|
2142
|
+
vendor: "zapier",
|
|
2143
|
+
rawNames: ["Zapier", "zapier"]
|
|
2144
|
+
},
|
|
2145
|
+
{
|
|
2146
|
+
id: "make",
|
|
2147
|
+
label: "Make",
|
|
2148
|
+
vendor: "make",
|
|
2149
|
+
rawNames: ["Make", "make"]
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
id: "librechat",
|
|
2153
|
+
label: "LibreChat",
|
|
2154
|
+
vendor: "mcp",
|
|
2155
|
+
rawNames: ["LibreChat", "librechat"]
|
|
2156
|
+
},
|
|
2157
|
+
{
|
|
2158
|
+
id: "jan",
|
|
2159
|
+
label: "Jan",
|
|
2160
|
+
vendor: "mcp",
|
|
2161
|
+
rawNames: ["Jan", "jan"]
|
|
2162
|
+
},
|
|
2163
|
+
{
|
|
2164
|
+
id: "goose",
|
|
2165
|
+
label: "goose",
|
|
2166
|
+
vendor: "mcp",
|
|
2167
|
+
rawNames: ["goose", "Goose"]
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
id: "mcphost",
|
|
2171
|
+
label: "mcphost",
|
|
2172
|
+
vendor: "mcp",
|
|
2173
|
+
rawNames: ["mcphost"]
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
id: "mcporter",
|
|
2177
|
+
label: "mcporter",
|
|
2178
|
+
vendor: "mcp",
|
|
2179
|
+
rawNames: ["mcporter"]
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
id: "rmcp",
|
|
2183
|
+
label: "rmcp",
|
|
2184
|
+
vendor: "mcp",
|
|
2185
|
+
rawNames: ["rmcp"]
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
id: "unnamed_client",
|
|
2189
|
+
label: "Unnamed client",
|
|
2190
|
+
vendor: "mcp",
|
|
2191
|
+
rawNames: [
|
|
2192
|
+
"mcp",
|
|
2193
|
+
"unknown",
|
|
2194
|
+
""
|
|
2195
|
+
]
|
|
2196
|
+
}
|
|
2197
|
+
];
|
|
2198
|
+
/** A source pattern, not a RegExp, because analytics renders the same rule into ClickHouse RE2, which shares this syntax. */
|
|
2199
|
+
const MCP_REMOTE_WRAPPER_SUFFIX = String.raw` \(via mcp-remote [^\n]+?\)$`;
|
|
2200
|
+
new RegExp(MCP_REMOTE_WRAPPER_SUFFIX);
|
|
2201
|
+
new Map(MCP_CLIENT_GROUPS.map((group) => [group.id, group]));
|
|
536
2202
|
const runtimeSchema = z.enum([
|
|
537
2203
|
"python3.13",
|
|
538
2204
|
"python3.14",
|
|
2205
|
+
"python3.15",
|
|
539
2206
|
"node22",
|
|
540
|
-
"node24"
|
|
2207
|
+
"node24",
|
|
2208
|
+
"node26"
|
|
541
2209
|
]);
|
|
542
2210
|
const transportSchema = z.enum([
|
|
543
2211
|
"stdio",
|
|
@@ -610,15 +2278,7 @@ z.object({
|
|
|
610
2278
|
serverFields: serverFieldsSchema$1,
|
|
611
2279
|
source: z.enum(["registry", "defaults"])
|
|
612
2280
|
});
|
|
613
|
-
/**
|
|
614
|
-
* Returns a variant of a `maxLength`-constrained string that clamps (truncates) instead of
|
|
615
|
-
* rejecting on overflow — used for AI-generated copy where the model routinely overshoots.
|
|
616
|
-
*
|
|
617
|
-
* NOTE: this rebuilds the schema from scratch, carrying over only `maxLength` (as a clamp),
|
|
618
|
-
* `minLength`, and the description. Any other validators on the source field (`.regex()`,
|
|
619
|
-
* `.email()`, custom refinements) are intentionally dropped — this helper is meant for plain
|
|
620
|
-
* free-text length caps only. A field with `null` `maxLength` is returned unchanged.
|
|
621
|
-
*/
|
|
2281
|
+
/** Clamps instead of rejecting on max-length overflow (for AI-generated copy that overshoots); intentionally carries over only maxLength, minLength, and description, dropping any other validators. */
|
|
622
2282
|
const clampStringField = (field) => {
|
|
623
2283
|
const max = field.maxLength;
|
|
624
2284
|
if (max === null) return field;
|
|
@@ -626,6 +2286,10 @@ const clampStringField = (field) => {
|
|
|
626
2286
|
const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
|
|
627
2287
|
return field.description ? withMin.describe(field.description) : withMin;
|
|
628
2288
|
};
|
|
2289
|
+
const unboundedArrayField = (field) => {
|
|
2290
|
+
const unbounded = z.array(field.element);
|
|
2291
|
+
return field.description ? unbounded.describe(field.description) : unbounded;
|
|
2292
|
+
};
|
|
629
2293
|
const toolDefinitionSchema = z.object({
|
|
630
2294
|
name: z.string(),
|
|
631
2295
|
title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
|
|
@@ -638,11 +2302,22 @@ const toolDefinitionSchema = z.object({
|
|
|
638
2302
|
}).optional()
|
|
639
2303
|
});
|
|
640
2304
|
const positiveTestCaseSchema = z.object({
|
|
641
|
-
scenario: z.string().describe("Short label for what this case demonstrates."),
|
|
642
|
-
userPrompt: z.string().describe("A realistic, standalone user message a reviewer can paste and run with no prior state or multi-turn setup. Vary phrasing and tone across cases."),
|
|
2305
|
+
scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
|
|
2306
|
+
userPrompt: z.string().min(1).describe("A realistic, standalone user message a reviewer can paste and run with no prior state or multi-turn setup. Vary phrasing and tone across cases."),
|
|
643
2307
|
toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
|
|
644
2308
|
expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
|
|
645
|
-
}).
|
|
2309
|
+
}).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
|
|
2310
|
+
const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial().extend({
|
|
2311
|
+
scenario: z.string().optional(),
|
|
2312
|
+
userPrompt: z.string().optional()
|
|
2313
|
+
});
|
|
2314
|
+
const blankPositiveTestCase = () => ({
|
|
2315
|
+
scenario: "",
|
|
2316
|
+
userPrompt: "",
|
|
2317
|
+
toolTriggered: "",
|
|
2318
|
+
expectedOutput: ""
|
|
2319
|
+
});
|
|
2320
|
+
const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
|
|
646
2321
|
const screenshotEntrySchema = z.object({
|
|
647
2322
|
prompt: z.string(),
|
|
648
2323
|
url: z.url()
|
|
@@ -955,20 +2630,25 @@ const chatgptTranslationLocaleSchema = z.enum([
|
|
|
955
2630
|
"zh-TW"
|
|
956
2631
|
]);
|
|
957
2632
|
const negativeTestCaseSchema = z.object({
|
|
958
|
-
scenario: z.string(),
|
|
959
|
-
userPrompt: z.string()
|
|
960
|
-
}).
|
|
2633
|
+
scenario: z.string().min(1),
|
|
2634
|
+
userPrompt: z.string().min(1)
|
|
2635
|
+
}).describe("Each case: Scenario + User prompt (the plugin should NOT trigger).");
|
|
2636
|
+
const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial().extend({
|
|
2637
|
+
scenario: z.string().optional(),
|
|
2638
|
+
userPrompt: z.string().optional()
|
|
2639
|
+
});
|
|
2640
|
+
const blankNegativeTestCase = () => ({
|
|
2641
|
+
scenario: "",
|
|
2642
|
+
userPrompt: ""
|
|
2643
|
+
});
|
|
2644
|
+
const chatgptSkillSchema = z.object({ name: z.string() }).describe("A skill discovered on the MCP server, by name.");
|
|
961
2645
|
const chatgptToolJustificationSchema = z.object({
|
|
962
2646
|
toolName: z.string(),
|
|
963
2647
|
readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
|
|
964
2648
|
openWorldJustification: z.string().describe("One sentence on whether the tool reaches external systems beyond your own service."),
|
|
965
2649
|
destructiveJustification: z.string().describe("One sentence on whether the tool changes data. For a read-only tool, state the full triad: \"No data is created, modified, or deleted.\"")
|
|
966
2650
|
}).describe("Per-tool justification of each MCP annotation value (one specific sentence per hint).");
|
|
967
|
-
/**
|
|
968
|
-
* Base copy fields, defined once and reused by both the submission form and per-locale
|
|
969
|
-
* translations so the constraints (tagline ≤ 30 chars) never drift. The translation generation
|
|
970
|
-
* path wraps these in {@link clampStringField} since the LLM tends to overshoot the limit.
|
|
971
|
-
*/
|
|
2651
|
+
/** Defined once and reused by both the submission form and per-locale translations so the tagline ≤ 30 chars constraint never drifts. */
|
|
972
2652
|
const chatgptTaglineSchema = z.string().max(30);
|
|
973
2653
|
const chatgptDescriptionSchema = z.string();
|
|
974
2654
|
const chatgptTranslationSchema = z.object({
|
|
@@ -977,34 +2657,32 @@ const chatgptTranslationSchema = z.object({
|
|
|
977
2657
|
description: chatgptDescriptionSchema
|
|
978
2658
|
}).describe("Locale-scoped override for tagline + description. English (US) is the default.");
|
|
979
2659
|
chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema) });
|
|
980
|
-
/**
|
|
981
|
-
* Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
|
|
982
|
-
* When adding/removing/reordering fields, keep this in sync with the sheet.
|
|
983
|
-
*/
|
|
2660
|
+
/** Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section; keep it in sync with the sheet. */
|
|
984
2661
|
const chatgptSubmissionFormDataSchema = z.object({
|
|
985
2662
|
logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
|
|
986
2663
|
logoDark: z.string().optional().describe("Optional dark-mode logo icon. Square PNG, same specs as the light icon. Leave empty if the light icon also works on dark backgrounds."),
|
|
987
|
-
appName: z.string().describe("The name users will see in ChatGPT and in the
|
|
2664
|
+
appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
|
|
988
2665
|
tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
|
|
989
|
-
description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the
|
|
2666
|
+
description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the plugin does and why people will love it. Appears publicly on the directory page. End it by naming the product categories or intents the plugin does NOT cover, so ChatGPT learns when not to route to it (define exclusions by absent categories or wrong intents, never by naming other brands)."),
|
|
990
2667
|
category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
|
|
991
|
-
developerName: z.string().describe("Developer name shown publicly on the
|
|
2668
|
+
developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
|
|
992
2669
|
companyUrl: urlField.describe("Your company's main website URL."),
|
|
993
2670
|
supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
|
|
994
2671
|
privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
|
|
995
|
-
termsOfServiceUrl: urlField.describe("URL to the
|
|
996
|
-
demoRecordingUrl: urlField.describe("URL to a video demonstrating the
|
|
997
|
-
appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My
|
|
2672
|
+
termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
|
|
2673
|
+
demoRecordingUrl: urlField.describe("URL to a video demonstrating the plugin, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
|
|
2674
|
+
appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My plugin links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the plugin does not offer digital goods."),
|
|
998
2675
|
serverUrl: urlField.describe("URL of the MCP server."),
|
|
999
2676
|
authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
|
|
1000
2677
|
tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
|
|
1001
2678
|
toolJustifications: z.array(chatgptToolJustificationSchema).describe("Per-tool justification of `readOnlyHint`, `openWorldHint`, and `destructiveHint` annotation values. One short, specific sentence per hint describing what the tool actually does."),
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
2679
|
+
skills: z.array(chatgptSkillSchema).optional().describe("Skills the server exposes over MCP (auto-populated from the production server's manifest). Left unset when the server does not advertise the skills extension, which is a different state from advertising it and exposing none."),
|
|
2680
|
+
testCases: z.array(positiveTestCaseSchema).length(5).describe("Exactly 5 positive test cases. Each: Scenario, User prompt, Tool triggered, Expected output. Collectively cover the full capability across different flow stages (initial search or browse, market or locale handling, post-interaction detail, an action ChatGPT performs on the user's behalf, and a conversion or secondary tool) rather than five variations of the same first step."),
|
|
2681
|
+
negativeTestCases: z.array(negativeTestCaseSchema).length(3).describe("Exactly 3 negative test cases: prompts where the plugin should NOT trigger but the model might think it is relevant. These become production routing metadata that teaches ChatGPT when to stay silent, so pick tight near-misses: a product category the plugin does not carry, the right brand or domain but an intent the plugin does not serve, or a boundary with a sibling plugin."),
|
|
2682
|
+
screenshots: z.array(screenshotEntrySchema.extend({ prompt: z.string().max(75, { error: "Screenshot prompts are limited to 75 characters." }) })).max(3).describe("In-plugin screenshots paired with the user prompt that produced them (each prompt is 75 characters max). Widget plugins must show the widget UI; non-widget plugins show the model response. Min 1, max 3 entries, all public. Images: 706px wide, 400–860px tall, PNG."),
|
|
1005
2683
|
translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
|
|
1006
2684
|
allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
|
|
1007
|
-
releaseNotes: z.string().describe("Publicly displayed on the
|
|
2685
|
+
releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
|
|
1008
2686
|
});
|
|
1009
2687
|
const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
|
|
1010
2688
|
tagline: z.string().optional(),
|
|
@@ -1015,23 +2693,35 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
|
|
|
1015
2693
|
demoRecordingUrl: z.string().optional(),
|
|
1016
2694
|
serverUrl: z.string().optional(),
|
|
1017
2695
|
screenshots: z.array(screenshotDraftEntrySchema).optional(),
|
|
2696
|
+
testCases: z.array(positiveTestCaseDraftSchema).optional(),
|
|
2697
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
|
|
1018
2698
|
translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
|
|
1019
2699
|
});
|
|
1020
|
-
|
|
2700
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
|
|
2701
|
+
const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1021
2702
|
appName: true,
|
|
1022
2703
|
developerName: true,
|
|
1023
2704
|
serverUrl: true,
|
|
1024
2705
|
tools: true,
|
|
2706
|
+
skills: true,
|
|
1025
2707
|
authentication: true
|
|
1026
2708
|
});
|
|
1027
|
-
|
|
2709
|
+
/** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
|
|
2710
|
+
const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1028
2711
|
tagline: true,
|
|
1029
2712
|
description: true,
|
|
1030
2713
|
category: true,
|
|
1031
2714
|
testCases: true,
|
|
1032
2715
|
negativeTestCases: true,
|
|
1033
2716
|
toolJustifications: true
|
|
1034
|
-
}).extend({
|
|
2717
|
+
}).extend({
|
|
2718
|
+
testCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.testCases),
|
|
2719
|
+
negativeTestCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.negativeTestCases)
|
|
2720
|
+
}).extend({
|
|
2721
|
+
tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
|
|
2722
|
+
testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
|
|
2723
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
|
|
2724
|
+
});
|
|
1035
2725
|
const claudeCategorySchema = z.enum([
|
|
1036
2726
|
"Productivity",
|
|
1037
2727
|
"Communication",
|
|
@@ -1077,11 +2767,7 @@ const claudePolicyAcknowledgementSchema = z.enum([
|
|
|
1077
2767
|
"My connector does not collect conversation data beyond what is needed for its function.",
|
|
1078
2768
|
"Public documentation for this connector will be live by the publish date."
|
|
1079
2769
|
]);
|
|
1080
|
-
/**
|
|
1081
|
-
* Field order mirrors the claude.ai directory submission wizard
|
|
1082
|
-
* (`claude.ai/admin-settings/directory/submissions/new`), grouped by step.
|
|
1083
|
-
* When adding/removing/reordering fields, keep this in sync with the wizard.
|
|
1084
|
-
*/
|
|
2770
|
+
/** Field order mirrors the claude.ai directory submission wizard (`claude.ai/admin-settings/directory/submissions/new`), grouped by step; keep it in sync with the wizard. */
|
|
1085
2771
|
const claudeSubmissionFormDataSchema = z.object({
|
|
1086
2772
|
serverUrl: z.url().describe(`The full https:// URL where your MCP server is hosted and reachable. In the claude.ai wizard this is read live
|
|
1087
2773
|
from the custom connector you select — the connection is used to verify the URL and the tool list at submission time.
|
|
@@ -1158,7 +2844,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
|
|
|
1158
2844
|
categories: z.array(claudeCategorySchema).optional(),
|
|
1159
2845
|
screenshots: z.array(screenshotDraftEntrySchema).optional()
|
|
1160
2846
|
});
|
|
1161
|
-
|
|
2847
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
|
|
2848
|
+
const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
|
|
1162
2849
|
serverUrl: true,
|
|
1163
2850
|
name: true,
|
|
1164
2851
|
slug: true,
|
|
@@ -1173,39 +2860,93 @@ claudeSubmissionFormDataSchema.pick({
|
|
|
1173
2860
|
connectionRequirements: claudeSubmissionFormDataSchema.shape.connectionRequirements.optional(),
|
|
1174
2861
|
testInstructions: claudeSubmissionFormDataSchema.shape.testInstructions.optional()
|
|
1175
2862
|
});
|
|
1176
|
-
/**
|
|
1177
|
-
* Narrative fields the LLM-backed generation step produces for Claude submissions.
|
|
1178
|
-
* This schema accepts the slightly loose shape returned by AI generation, then normalizes it into
|
|
1179
|
-
* the strict form shape. Keep transforms here rather than in callers so generation leniency is
|
|
1180
|
-
* colocated with the Claude contract.
|
|
1181
|
-
*/
|
|
2863
|
+
/** Loose shape returned by AI generation for Claude narrative fields; transforms live here so generation leniency stays colocated with the Claude contract. */
|
|
1182
2864
|
const claudeAiGeneratedFormDataRawSchema = z.object({
|
|
1183
2865
|
oneLiner: claudeSubmissionFormDataSchema.shape.oneLiner,
|
|
1184
2866
|
description: claudeSubmissionFormDataSchema.shape.description,
|
|
1185
2867
|
categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
|
|
1186
2868
|
primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
|
|
1187
2869
|
});
|
|
1188
|
-
claudeAiGeneratedFormDataRawSchema.extend({
|
|
2870
|
+
const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
|
|
1189
2871
|
oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
|
|
1190
2872
|
categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
|
|
1191
2873
|
});
|
|
2874
|
+
function provenanceByField(prefillShape, aiGeneratedShape) {
|
|
2875
|
+
const byField = {};
|
|
2876
|
+
for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
|
|
2877
|
+
for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
|
|
2878
|
+
return byField;
|
|
2879
|
+
}
|
|
2880
|
+
provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
|
|
2881
|
+
const urlVerificationOutcomeSchema = z.enum([
|
|
2882
|
+
"pass",
|
|
2883
|
+
"fail",
|
|
2884
|
+
"unverified"
|
|
2885
|
+
]);
|
|
2886
|
+
const VERIFIABLE_URL_FIELDS = {
|
|
2887
|
+
chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
|
|
2888
|
+
claudeai: ["privacyPolicy"]
|
|
2889
|
+
};
|
|
2890
|
+
const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
|
|
2891
|
+
const policyDisclosureSchema = z.enum([
|
|
2892
|
+
"dataCategories",
|
|
2893
|
+
"purposesOfUse",
|
|
2894
|
+
"recipients",
|
|
2895
|
+
"retention"
|
|
2896
|
+
]);
|
|
2897
|
+
const urlVerificationFieldResultSchema = z.object({
|
|
2898
|
+
field: verifiableUrlFieldSchema,
|
|
2899
|
+
url: z.string(),
|
|
2900
|
+
outcome: urlVerificationOutcomeSchema,
|
|
2901
|
+
reason: z.string(),
|
|
2902
|
+
concerns: z.array(z.string()).optional(),
|
|
2903
|
+
scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
|
|
2904
|
+
});
|
|
2905
|
+
const urlVerificationSchema = z.object({
|
|
2906
|
+
verifiedAt: z.coerce.date(),
|
|
2907
|
+
results: z.array(urlVerificationFieldResultSchema)
|
|
2908
|
+
});
|
|
2909
|
+
const pageKindSchema = z.enum([
|
|
2910
|
+
"expectedDocument",
|
|
2911
|
+
"errorPage",
|
|
2912
|
+
"loginWall",
|
|
2913
|
+
"parkedDomain",
|
|
2914
|
+
"comingSoon",
|
|
2915
|
+
"marketingPage",
|
|
2916
|
+
"unrelatedDocument"
|
|
2917
|
+
]);
|
|
2918
|
+
z.object({
|
|
2919
|
+
pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
|
|
2920
|
+
reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
|
|
2921
|
+
missingDisclosures: z.array(policyDisclosureSchema).describe("For a privacy policy only: which of the four required disclosures the text does not cover. Empty for every other page kind.")
|
|
2922
|
+
});
|
|
1192
2923
|
const submissionMetaFieldsSchema = z.object({
|
|
1193
2924
|
id: z.string(),
|
|
1194
2925
|
environmentId: z.string(),
|
|
1195
2926
|
auditId: z.string().nullable(),
|
|
2927
|
+
urlVerification: urlVerificationSchema.nullable().default(null),
|
|
1196
2928
|
createdAt: z.coerce.date(),
|
|
1197
2929
|
updatedAt: z.coerce.date()
|
|
1198
2930
|
});
|
|
1199
2931
|
const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1200
2932
|
platform: z.literal("claudeai"),
|
|
1201
|
-
formData: claudeSubmissionDraftSchema
|
|
2933
|
+
formData: claudeSubmissionDraftSchema,
|
|
2934
|
+
prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
|
|
1202
2935
|
});
|
|
1203
2936
|
const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1204
2937
|
platform: z.literal("chatgpt"),
|
|
1205
|
-
formData: chatgptSubmissionDraftSchema
|
|
2938
|
+
formData: chatgptSubmissionDraftSchema,
|
|
2939
|
+
prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
|
|
1206
2940
|
});
|
|
1207
|
-
z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
2941
|
+
const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1208
2942
|
z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
|
|
2943
|
+
/** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
|
|
2944
|
+
const submissionSchema = submissionSchemaInternal;
|
|
2945
|
+
z.literal([
|
|
2946
|
+
100,
|
|
2947
|
+
75,
|
|
2948
|
+
50
|
|
2949
|
+
]);
|
|
1209
2950
|
const subscriptionPlanSchema = z.enum([
|
|
1210
2951
|
"pro",
|
|
1211
2952
|
"business",
|
|
@@ -1217,17 +2958,78 @@ const customerCreditsSchema = z.object({
|
|
|
1217
2958
|
expiresAt: z.number().nullable(),
|
|
1218
2959
|
currency: z.string()
|
|
1219
2960
|
});
|
|
1220
|
-
const customerUsageSchema = z.object({
|
|
1221
|
-
amountInCents: z.number(),
|
|
1222
|
-
currency: z.string(),
|
|
1223
|
-
periodEnd: z.number()
|
|
1224
|
-
});
|
|
1225
2961
|
const partnerDiscountSchema = z.object({ endsAt: z.number() });
|
|
1226
2962
|
z.object({
|
|
1227
2963
|
customerCredits: customerCreditsSchema.nullable(),
|
|
1228
|
-
customerUsage: customerUsageSchema.nullable(),
|
|
1229
2964
|
partnerDiscount: partnerDiscountSchema.nullable()
|
|
1230
2965
|
});
|
|
2966
|
+
const metricsQueueEventSchema = z.object({
|
|
2967
|
+
ts: z.number().int(),
|
|
2968
|
+
method: z.string(),
|
|
2969
|
+
tool: z.string().nullable(),
|
|
2970
|
+
client: z.string(),
|
|
2971
|
+
sessionId: z.string().nullable(),
|
|
2972
|
+
conversationId: z.string().nullable().optional(),
|
|
2973
|
+
durationMs: z.number().int(),
|
|
2974
|
+
outputTokens: z.number().int().nullable(),
|
|
2975
|
+
errorType: z.enum([
|
|
2976
|
+
"mcp_error",
|
|
2977
|
+
"tool_error",
|
|
2978
|
+
"timeout"
|
|
2979
|
+
]).nullable(),
|
|
2980
|
+
errorCode: z.number().int().nullable()
|
|
2981
|
+
});
|
|
2982
|
+
z.object({
|
|
2983
|
+
v: z.literal(1),
|
|
2984
|
+
envId: z.string(),
|
|
2985
|
+
events: z.array(metricsQueueEventSchema)
|
|
2986
|
+
});
|
|
2987
|
+
z.object({ v: z.number() });
|
|
2988
|
+
const TELEMETRY_SIGNALS = [
|
|
2989
|
+
"logs",
|
|
2990
|
+
"metrics",
|
|
2991
|
+
"traces"
|
|
2992
|
+
];
|
|
2993
|
+
const telemetrySignalSchema = z.enum(TELEMETRY_SIGNALS);
|
|
2994
|
+
const OTLP_PROTOCOLS = ["http/protobuf", "http/json"];
|
|
2995
|
+
const otlpProtocolSchema = z.enum(OTLP_PROTOCOLS);
|
|
2996
|
+
const otlpEndpointSchema = z.string().trim().min(1).max(2048);
|
|
2997
|
+
const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
|
|
2998
|
+
const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
|
|
2999
|
+
const otlpHeaderValueSchema = z.string().trim().max(OTLP_HEADER_VALUE_MAX_LENGTH).refine((value) => !/[\r\n]/.test(value), "Line breaks are not allowed in a header value");
|
|
3000
|
+
const telemetryDestinationHeaderSchema = z.object({
|
|
3001
|
+
id: z.string(),
|
|
3002
|
+
name: otlpHeaderNameSchema,
|
|
3003
|
+
value: otlpHeaderValueSchema,
|
|
3004
|
+
isSecret: z.boolean()
|
|
3005
|
+
});
|
|
3006
|
+
const otlpPushFailureReasonSchema = z.enum([
|
|
3007
|
+
"credentials",
|
|
3008
|
+
"wrong-path",
|
|
3009
|
+
"wrong-protocol",
|
|
3010
|
+
"invalid-payload",
|
|
3011
|
+
"partial-rejection",
|
|
3012
|
+
"blocked-target",
|
|
3013
|
+
"timeout",
|
|
3014
|
+
"unreachable",
|
|
3015
|
+
"receiver-error",
|
|
3016
|
+
"unexpected-status"
|
|
3017
|
+
]);
|
|
3018
|
+
const telemetryDestinationStatusSchema = z.enum(["active", "suspended"]);
|
|
3019
|
+
z.object({
|
|
3020
|
+
id: z.string(),
|
|
3021
|
+
signal: telemetrySignalSchema,
|
|
3022
|
+
endpoint: otlpEndpointSchema,
|
|
3023
|
+
protocol: otlpProtocolSchema,
|
|
3024
|
+
headers: z.array(telemetryDestinationHeaderSchema),
|
|
3025
|
+
status: telemetryDestinationStatusSchema,
|
|
3026
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable(),
|
|
3027
|
+
isScopedToIntentionalRequestsOnly: z.boolean()
|
|
3028
|
+
});
|
|
3029
|
+
const hasDuplicateHeaderNames = (headers) => {
|
|
3030
|
+
const names = headers.map(({ name }) => name.trim().toLowerCase());
|
|
3031
|
+
return new Set(names).size !== names.length;
|
|
3032
|
+
};
|
|
1231
3033
|
//#endregion
|
|
1232
3034
|
//#region src/auth-scope.ts
|
|
1233
3035
|
/** Accepts an API key or OAuth access token (default for most routes). */
|
|
@@ -1326,6 +3128,14 @@ const serverFieldsSchema = z.object({
|
|
|
1326
3128
|
});
|
|
1327
3129
|
//#endregion
|
|
1328
3130
|
//#region src/api.contract.ts
|
|
3131
|
+
const isValidIanaTimeZone = (timeZone) => {
|
|
3132
|
+
try {
|
|
3133
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
3134
|
+
return true;
|
|
3135
|
+
} catch {
|
|
3136
|
+
return false;
|
|
3137
|
+
}
|
|
3138
|
+
};
|
|
1329
3139
|
const deploymentStatusSchema = z.enum([
|
|
1330
3140
|
"ongoing",
|
|
1331
3141
|
"deployed",
|
|
@@ -1354,21 +3164,20 @@ const deploymentSchema = z.object({
|
|
|
1354
3164
|
isCurrent: z.boolean(),
|
|
1355
3165
|
deploymentPageUrl: z.url().nullable()
|
|
1356
3166
|
});
|
|
1357
|
-
const
|
|
3167
|
+
const isValidTimeInput = (value) => {
|
|
1358
3168
|
if (ms(value) !== void 0) return true;
|
|
1359
3169
|
return !Number.isNaN(new Date(value).getTime());
|
|
1360
3170
|
};
|
|
1361
|
-
const
|
|
3171
|
+
const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
|
|
3172
|
+
const base = oc.errors({ BAD_REQUEST: {} });
|
|
3173
|
+
const createEnvironmentContractV1 = base.route({
|
|
1362
3174
|
path: "/v1/environments",
|
|
1363
3175
|
method: "POST",
|
|
1364
3176
|
summary: "Create an environment",
|
|
1365
3177
|
description: "Create an environment for a project",
|
|
1366
3178
|
tags: ["environments"],
|
|
1367
3179
|
successDescription: "The environment has been created successfully"
|
|
1368
|
-
}).errors({
|
|
1369
|
-
NOT_FOUND: {},
|
|
1370
|
-
BAD_REQUEST: {}
|
|
1371
|
-
}).input(z.object({
|
|
3180
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1372
3181
|
projectId: z.string().describe("The ID of the project to create the environment for"),
|
|
1373
3182
|
name: z.string().min(1).describe("The name of the environment"),
|
|
1374
3183
|
sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
|
|
@@ -1381,7 +3190,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
1381
3190
|
createdAt: z.coerce.date(),
|
|
1382
3191
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
1383
3192
|
}));
|
|
1384
|
-
const getEnvironmentContractV1 =
|
|
3193
|
+
const getEnvironmentContractV1 = base.route({
|
|
1385
3194
|
path: "/v1/environments/{environmentId}",
|
|
1386
3195
|
method: "GET",
|
|
1387
3196
|
summary: "Get an environment",
|
|
@@ -1397,6 +3206,14 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
1397
3206
|
createdAt: z.coerce.date(),
|
|
1398
3207
|
projectId: z.string()
|
|
1399
3208
|
}));
|
|
3209
|
+
const deleteEnvironmentContractV1 = base.route({
|
|
3210
|
+
path: "/v1/environments/{environmentId}",
|
|
3211
|
+
method: "DELETE",
|
|
3212
|
+
summary: "Delete an environment",
|
|
3213
|
+
description: "All environments can be deleted except the production environment. This operation is not reversible: associated logs, analytics, and metrics are deleted as well.",
|
|
3214
|
+
tags: ["environments"],
|
|
3215
|
+
successDescription: "The environment has been deleted successfully"
|
|
3216
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.object({ success: z.literal(true) }));
|
|
1400
3217
|
const domainSchema = z.object({
|
|
1401
3218
|
domain: z.string(),
|
|
1402
3219
|
status: z.enum([
|
|
@@ -1438,7 +3255,7 @@ const projectOutputSchema = z.object({
|
|
|
1438
3255
|
productionEnvironment: productionEnvironmentSchema.nullable(),
|
|
1439
3256
|
environments: z.array(environmentSchema)
|
|
1440
3257
|
});
|
|
1441
|
-
const getProjectContractV1 =
|
|
3258
|
+
const getProjectContractV1 = base.route({
|
|
1442
3259
|
path: "/v1/projects/{projectId}",
|
|
1443
3260
|
method: "GET",
|
|
1444
3261
|
summary: "Get a project",
|
|
@@ -1446,18 +3263,15 @@ const getProjectContractV1 = oc.route({
|
|
|
1446
3263
|
tags: ["projects"],
|
|
1447
3264
|
successDescription: "The project details"
|
|
1448
3265
|
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
|
|
1449
|
-
const listProjectsContractV1 =
|
|
3266
|
+
const listProjectsContractV1 = base.route({
|
|
1450
3267
|
path: "/v1/projects",
|
|
1451
3268
|
method: "GET",
|
|
1452
3269
|
summary: "List projects",
|
|
1453
3270
|
description: "List all projects for a team",
|
|
1454
3271
|
tags: ["projects"],
|
|
1455
3272
|
successDescription: "The list of projects"
|
|
1456
|
-
}).errors({
|
|
1457
|
-
|
|
1458
|
-
BAD_REQUEST: {}
|
|
1459
|
-
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
1460
|
-
const createProjectContractV1 = oc.route({
|
|
3273
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
3274
|
+
const createProjectContractV1 = base.route({
|
|
1461
3275
|
path: "/v1/projects",
|
|
1462
3276
|
method: "POST",
|
|
1463
3277
|
summary: "Create a project",
|
|
@@ -1466,7 +3280,6 @@ const createProjectContractV1 = oc.route({
|
|
|
1466
3280
|
successDescription: "The project has been created successfully"
|
|
1467
3281
|
}).errors({
|
|
1468
3282
|
NOT_FOUND: {},
|
|
1469
|
-
BAD_REQUEST: {},
|
|
1470
3283
|
FORBIDDEN: {}
|
|
1471
3284
|
}).input(z.object({
|
|
1472
3285
|
teamId: z.string().optional(),
|
|
@@ -1507,7 +3320,101 @@ const environmentVariableOutputSchema = z.object({
|
|
|
1507
3320
|
isSecret: z.boolean(),
|
|
1508
3321
|
createdAt: z.coerce.date()
|
|
1509
3322
|
});
|
|
1510
|
-
const
|
|
3323
|
+
const telemetryDestinationHeaderOutputSchema = z.discriminatedUnion("isSecret", [z.object({
|
|
3324
|
+
id: z.string(),
|
|
3325
|
+
name: otlpHeaderNameSchema,
|
|
3326
|
+
value: z.null(),
|
|
3327
|
+
isSecret: z.literal(true)
|
|
3328
|
+
}), z.object({
|
|
3329
|
+
id: z.string(),
|
|
3330
|
+
name: otlpHeaderNameSchema,
|
|
3331
|
+
value: otlpHeaderValueSchema,
|
|
3332
|
+
isSecret: z.literal(false)
|
|
3333
|
+
})]);
|
|
3334
|
+
const telemetryDestinationOutputSchema = z.object({
|
|
3335
|
+
id: z.string(),
|
|
3336
|
+
signal: telemetrySignalSchema,
|
|
3337
|
+
endpoint: otlpEndpointSchema,
|
|
3338
|
+
protocol: otlpProtocolSchema,
|
|
3339
|
+
headers: z.array(telemetryDestinationHeaderOutputSchema),
|
|
3340
|
+
status: telemetryDestinationStatusSchema,
|
|
3341
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable(),
|
|
3342
|
+
isScopedToIntentionalRequestsOnly: z.boolean()
|
|
3343
|
+
});
|
|
3344
|
+
const createTelemetryDestinationHeaderInputSchema = z.object({
|
|
3345
|
+
name: otlpHeaderNameSchema,
|
|
3346
|
+
value: otlpHeaderValueSchema.min(1, "Enter a header value"),
|
|
3347
|
+
isSecret: z.boolean()
|
|
3348
|
+
});
|
|
3349
|
+
const updateTelemetryDestinationHeaderInputSchema = z.object({
|
|
3350
|
+
id: z.string().optional(),
|
|
3351
|
+
name: otlpHeaderNameSchema,
|
|
3352
|
+
value: otlpHeaderValueSchema.optional(),
|
|
3353
|
+
isSecret: z.boolean()
|
|
3354
|
+
});
|
|
3355
|
+
const uniqueTelemetryHeaders = (headers) => !hasDuplicateHeaderNames(headers);
|
|
3356
|
+
const listTelemetryDestinationsContractV1 = base.route({
|
|
3357
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations",
|
|
3358
|
+
method: "GET",
|
|
3359
|
+
summary: "List telemetry destinations",
|
|
3360
|
+
description: "List the OTLP destinations configured for an environment. Secret header values are never returned.",
|
|
3361
|
+
tags: ["telemetry"],
|
|
3362
|
+
successDescription: "The list of telemetry destinations"
|
|
3363
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(telemetryDestinationOutputSchema));
|
|
3364
|
+
const createTelemetryDestinationContractV1 = base.route({
|
|
3365
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations",
|
|
3366
|
+
method: "POST",
|
|
3367
|
+
summary: "Create a telemetry destination",
|
|
3368
|
+
description: "Verify and save an OTLP destination for logs, metrics, or traces.",
|
|
3369
|
+
tags: ["telemetry"],
|
|
3370
|
+
successDescription: "The telemetry destination has been created"
|
|
3371
|
+
}).errors({
|
|
3372
|
+
NOT_FOUND: {},
|
|
3373
|
+
FORBIDDEN: {},
|
|
3374
|
+
OTLP_DESTINATION_UNVERIFIED: { status: 400 },
|
|
3375
|
+
INTERNAL_SERVER_ERROR: {}
|
|
3376
|
+
}).input(z.object({
|
|
3377
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3378
|
+
signal: telemetrySignalSchema,
|
|
3379
|
+
endpoint: otlpEndpointSchema,
|
|
3380
|
+
protocol: otlpProtocolSchema.default("http/protobuf"),
|
|
3381
|
+
isScopedToIntentionalRequestsOnly: z.boolean().default(false),
|
|
3382
|
+
headers: z.array(createTelemetryDestinationHeaderInputSchema).default([]).refine(uniqueTelemetryHeaders, "Header names must be unique")
|
|
3383
|
+
})).output(telemetryDestinationOutputSchema);
|
|
3384
|
+
const updateTelemetryDestinationContractV1 = base.route({
|
|
3385
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
|
|
3386
|
+
method: "PATCH",
|
|
3387
|
+
summary: "Update a telemetry destination",
|
|
3388
|
+
description: "Verify and save changes to an OTLP destination. Omit headers to keep them unchanged; omit the value of an existing header to preserve it. A secret header value must be re-entered when the endpoint changes.",
|
|
3389
|
+
tags: ["telemetry"],
|
|
3390
|
+
successDescription: "The telemetry destination has been updated"
|
|
3391
|
+
}).errors({
|
|
3392
|
+
NOT_FOUND: {},
|
|
3393
|
+
FORBIDDEN: {},
|
|
3394
|
+
OTLP_DESTINATION_UNVERIFIED: { status: 400 }
|
|
3395
|
+
}).input(z.object({
|
|
3396
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3397
|
+
destinationId: z.string().describe("The ID of the telemetry destination"),
|
|
3398
|
+
endpoint: otlpEndpointSchema.optional(),
|
|
3399
|
+
protocol: otlpProtocolSchema.optional(),
|
|
3400
|
+
isScopedToIntentionalRequestsOnly: z.boolean().optional(),
|
|
3401
|
+
headers: z.array(updateTelemetryDestinationHeaderInputSchema).refine(uniqueTelemetryHeaders, "Header names must be unique").optional()
|
|
3402
|
+
})).output(telemetryDestinationOutputSchema);
|
|
3403
|
+
const deleteTelemetryDestinationContractV1 = base.route({
|
|
3404
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
|
|
3405
|
+
method: "DELETE",
|
|
3406
|
+
summary: "Delete a telemetry destination",
|
|
3407
|
+
description: "Delete an OTLP destination from an environment.",
|
|
3408
|
+
tags: ["telemetry"],
|
|
3409
|
+
successDescription: "The telemetry destination has been deleted"
|
|
3410
|
+
}).errors({
|
|
3411
|
+
NOT_FOUND: {},
|
|
3412
|
+
INTERNAL_SERVER_ERROR: {}
|
|
3413
|
+
}).input(z.object({
|
|
3414
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3415
|
+
destinationId: z.string().describe("The ID of the telemetry destination")
|
|
3416
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
3417
|
+
const listEnvironmentVariablesContractV1 = base.route({
|
|
1511
3418
|
path: "/v1/environments/{environmentId}/environment-variables",
|
|
1512
3419
|
method: "GET",
|
|
1513
3420
|
summary: "List environment variables",
|
|
@@ -1515,48 +3422,39 @@ const listEnvironmentVariablesContractV1 = oc.route({
|
|
|
1515
3422
|
tags: ["environments"],
|
|
1516
3423
|
successDescription: "The list of environment variables"
|
|
1517
3424
|
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
1518
|
-
const createEnvironmentVariablesContractV1 =
|
|
3425
|
+
const createEnvironmentVariablesContractV1 = base.route({
|
|
1519
3426
|
path: "/v1/environments/{environmentId}/environment-variables",
|
|
1520
3427
|
method: "POST",
|
|
1521
3428
|
summary: "Add environment variables",
|
|
1522
3429
|
description: "Add one or more environment variables to an environment",
|
|
1523
3430
|
tags: ["environments"],
|
|
1524
3431
|
successDescription: "The environment variables have been added successfully"
|
|
1525
|
-
}).errors({
|
|
1526
|
-
NOT_FOUND: {},
|
|
1527
|
-
BAD_REQUEST: {}
|
|
1528
|
-
}).input(z.object({
|
|
3432
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1529
3433
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1530
3434
|
environmentVariables: environmentVariablesSchema
|
|
1531
3435
|
})).output(z.object({ success: z.literal(true) }));
|
|
1532
|
-
const updateEnvironmentVariableContractV1 =
|
|
3436
|
+
const updateEnvironmentVariableContractV1 = base.route({
|
|
1533
3437
|
path: "/v1/environment-variables/{environmentVariableId}",
|
|
1534
3438
|
method: "PATCH",
|
|
1535
3439
|
summary: "Update an environment variable",
|
|
1536
3440
|
description: "Update an environment variable by ID",
|
|
1537
3441
|
tags: ["environments"],
|
|
1538
3442
|
successDescription: "The environment variable has been updated successfully"
|
|
1539
|
-
}).errors({
|
|
1540
|
-
NOT_FOUND: {},
|
|
1541
|
-
BAD_REQUEST: {}
|
|
1542
|
-
}).input(z.object({
|
|
3443
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1543
3444
|
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
1544
3445
|
key: environmentVariableSchema.shape.key,
|
|
1545
3446
|
value: environmentVariableSchema.shape.value.optional(),
|
|
1546
3447
|
isSecret: environmentVariableSchema.shape.isSecret.optional()
|
|
1547
3448
|
})).output(z.object({ success: z.literal(true) }));
|
|
1548
|
-
const deleteEnvironmentVariableContractV1 =
|
|
3449
|
+
const deleteEnvironmentVariableContractV1 = base.route({
|
|
1549
3450
|
path: "/v1/environment-variables/{environmentVariableId}",
|
|
1550
3451
|
method: "DELETE",
|
|
1551
3452
|
summary: "Delete an environment variable",
|
|
1552
3453
|
description: "Delete an environment variable by ID",
|
|
1553
3454
|
tags: ["environments"],
|
|
1554
3455
|
successDescription: "The environment variable has been deleted successfully"
|
|
1555
|
-
}).errors({
|
|
1556
|
-
|
|
1557
|
-
BAD_REQUEST: {}
|
|
1558
|
-
}).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
1559
|
-
const deleteProjectContractV1 = oc.route({
|
|
3456
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
3457
|
+
const deleteProjectContractV1 = base.route({
|
|
1560
3458
|
path: "/v1/projects/{projectId}",
|
|
1561
3459
|
method: "DELETE",
|
|
1562
3460
|
summary: "Delete a project",
|
|
@@ -1564,7 +3462,7 @@ const deleteProjectContractV1 = oc.route({
|
|
|
1564
3462
|
tags: ["projects"],
|
|
1565
3463
|
successDescription: "The project has been deleted successfully"
|
|
1566
3464
|
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
1567
|
-
const updateProjectContractV1 =
|
|
3465
|
+
const updateProjectContractV1 = base.route({
|
|
1568
3466
|
path: "/v1/projects/{projectId}",
|
|
1569
3467
|
method: "PATCH",
|
|
1570
3468
|
summary: "Update a project",
|
|
@@ -1573,14 +3471,13 @@ const updateProjectContractV1 = oc.route({
|
|
|
1573
3471
|
successDescription: "The project has been updated successfully"
|
|
1574
3472
|
}).errors({
|
|
1575
3473
|
NOT_FOUND: {},
|
|
1576
|
-
BAD_REQUEST: {},
|
|
1577
3474
|
FORBIDDEN: {}
|
|
1578
3475
|
}).input(z.object({
|
|
1579
3476
|
projectId: z.string().describe("The ID of the project"),
|
|
1580
3477
|
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
1581
3478
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
1582
3479
|
})).output(projectOutputSchema);
|
|
1583
|
-
const deployEnvironmentContractV1 =
|
|
3480
|
+
const deployEnvironmentContractV1 = base.route({
|
|
1584
3481
|
path: "/v1/environments/{environmentId}/deploy",
|
|
1585
3482
|
method: "POST",
|
|
1586
3483
|
summary: "Deploy an environment",
|
|
@@ -1589,29 +3486,25 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
1589
3486
|
successDescription: "The environment has been deployed successfully"
|
|
1590
3487
|
}).errors({
|
|
1591
3488
|
NOT_FOUND: {},
|
|
1592
|
-
BAD_REQUEST: {},
|
|
1593
3489
|
CONFLICT: {}
|
|
1594
3490
|
}).input(z.object({
|
|
1595
3491
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
1596
3492
|
token: z.string().describe("The token to identify the source archive").optional(),
|
|
1597
3493
|
settings: buildSettingsSchema.extend({ transport: transportSchema }).optional().describe("Project settings detected by the client from the source. When provided, the server skips downloading and extracting the source archive to detect them.")
|
|
1598
3494
|
})).output(deploymentSchema);
|
|
1599
|
-
const uploadDeploymentArtifactContractV1 =
|
|
3495
|
+
const uploadDeploymentArtifactContractV1 = base.route({
|
|
1600
3496
|
path: "/v1/deployments/upload",
|
|
1601
3497
|
method: "POST",
|
|
1602
3498
|
summary: "Upload deployment artifacts",
|
|
1603
3499
|
description: "Return a presigned S3 URL to upload a deployment artifact",
|
|
1604
3500
|
tags: ["deployments"],
|
|
1605
3501
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
1606
|
-
}).errors({
|
|
1607
|
-
NOT_FOUND: {},
|
|
1608
|
-
BAD_REQUEST: {}
|
|
1609
|
-
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
3502
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
1610
3503
|
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
1611
3504
|
token: z.string().describe("Token to identify the source archive"),
|
|
1612
3505
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
1613
3506
|
}));
|
|
1614
|
-
const listDeploymentsContractV1 =
|
|
3507
|
+
const listDeploymentsContractV1 = base.route({
|
|
1615
3508
|
path: "/v1/projects/{projectId}/deployments",
|
|
1616
3509
|
method: "GET",
|
|
1617
3510
|
summary: "List project deployments",
|
|
@@ -1623,7 +3516,7 @@ const listDeploymentsContractV1 = oc.route({
|
|
|
1623
3516
|
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
1624
3517
|
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
1625
3518
|
})).output(z.array(deploymentSchema));
|
|
1626
|
-
const getDeploymentContractV1 =
|
|
3519
|
+
const getDeploymentContractV1 = base.route({
|
|
1627
3520
|
path: "/v1/deployments/{deploymentId}",
|
|
1628
3521
|
method: "GET",
|
|
1629
3522
|
summary: "Get a deployment",
|
|
@@ -1646,20 +3539,17 @@ const logEntrySchema = z.object({
|
|
|
1646
3539
|
method: z.string().optional(),
|
|
1647
3540
|
durationInMs: z.number().optional()
|
|
1648
3541
|
});
|
|
1649
|
-
const getLogsContractV1 =
|
|
3542
|
+
const getLogsContractV1 = base.route({
|
|
1650
3543
|
path: "/v1/environments/{environmentId}/logs",
|
|
1651
3544
|
method: "GET",
|
|
1652
3545
|
summary: "Get logs",
|
|
1653
3546
|
description: "Get logs for an environment",
|
|
1654
3547
|
tags: ["environments"],
|
|
1655
3548
|
successDescription: "The logs"
|
|
1656
|
-
}).errors({
|
|
1657
|
-
NOT_FOUND: {},
|
|
1658
|
-
BAD_REQUEST: {}
|
|
1659
|
-
}).input(z.object({
|
|
3549
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1660
3550
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1661
|
-
since:
|
|
1662
|
-
until:
|
|
3551
|
+
since: timeInputSchema.optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
3552
|
+
until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
|
|
1663
3553
|
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
1664
3554
|
level: z.array(z.enum([
|
|
1665
3555
|
"INFO",
|
|
@@ -1667,23 +3557,20 @@ const getLogsContractV1 = oc.route({
|
|
|
1667
3557
|
"WARNING",
|
|
1668
3558
|
"DEBUG"
|
|
1669
3559
|
])).optional().describe("Filter by log level"),
|
|
1670
|
-
search:
|
|
3560
|
+
search: logSearchSchema.optional().describe("Term to search for in log content"),
|
|
1671
3561
|
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
1672
3562
|
})).output(z.object({
|
|
1673
3563
|
logs: z.array(logEntrySchema),
|
|
1674
3564
|
nextToken: z.string().nullable()
|
|
1675
3565
|
}));
|
|
1676
|
-
const getLatestLogsContractV1 =
|
|
3566
|
+
const getLatestLogsContractV1 = base.route({
|
|
1677
3567
|
path: "/v1/environments/{environmentId}/latest-logs",
|
|
1678
3568
|
method: "GET",
|
|
1679
3569
|
summary: "Get latest logs",
|
|
1680
3570
|
description: "Get the N most recent logs for an environment",
|
|
1681
3571
|
tags: ["environments"],
|
|
1682
3572
|
successDescription: "The latest logs"
|
|
1683
|
-
}).errors({
|
|
1684
|
-
NOT_FOUND: {},
|
|
1685
|
-
BAD_REQUEST: {}
|
|
1686
|
-
}).input(z.object({
|
|
3573
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1687
3574
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1688
3575
|
limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
|
|
1689
3576
|
level: z.array(z.enum([
|
|
@@ -1692,9 +3579,9 @@ const getLatestLogsContractV1 = oc.route({
|
|
|
1692
3579
|
"WARNING",
|
|
1693
3580
|
"DEBUG"
|
|
1694
3581
|
])).optional().describe("Filter by log level"),
|
|
1695
|
-
search:
|
|
3582
|
+
search: logSearchSchema.optional().describe("Term to search for in log content")
|
|
1696
3583
|
})).output(z.object({ logs: z.array(logEntrySchema) }));
|
|
1697
|
-
const getDeploymentLogsContractV1 =
|
|
3584
|
+
const getDeploymentLogsContractV1 = base.route({
|
|
1698
3585
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
1699
3586
|
method: "GET",
|
|
1700
3587
|
summary: "Get deployment logs",
|
|
@@ -1721,22 +3608,19 @@ const analyticsTimeSeriesSchema = z.object({
|
|
|
1721
3608
|
output_token_mean: z.array(analyticsDataPointSchema),
|
|
1722
3609
|
task_count: z.array(analyticsDataPointSchema)
|
|
1723
3610
|
});
|
|
1724
|
-
const getProjectAnalyticsContractV1 =
|
|
3611
|
+
const getProjectAnalyticsContractV1 = base.route({
|
|
1725
3612
|
path: "/v1/analytics/{projectId}",
|
|
1726
3613
|
method: "GET",
|
|
1727
3614
|
summary: "Get project analytics",
|
|
1728
3615
|
description: "Get analytics data for a project over a time range",
|
|
1729
3616
|
tags: ["analytics"],
|
|
1730
3617
|
successDescription: "The project analytics data"
|
|
1731
|
-
}).errors({
|
|
1732
|
-
NOT_FOUND: {},
|
|
1733
|
-
BAD_REQUEST: {}
|
|
1734
|
-
}).input(z.object({
|
|
3618
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1735
3619
|
projectId: z.string().describe("The ID of the project"),
|
|
1736
3620
|
startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
|
|
1737
3621
|
endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
|
|
1738
3622
|
timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
|
|
1739
|
-
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <=
|
|
3623
|
+
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => isValidIanaTimeZone(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
|
|
1740
3624
|
metadata: z.object({
|
|
1741
3625
|
startTimestamp: z.number(),
|
|
1742
3626
|
endTimestamp: z.number(),
|
|
@@ -1746,7 +3630,132 @@ const getProjectAnalyticsContractV1 = oc.route({
|
|
|
1746
3630
|
}),
|
|
1747
3631
|
timeSeries: analyticsTimeSeriesSchema
|
|
1748
3632
|
}));
|
|
1749
|
-
const
|
|
3633
|
+
const paginatedInsightsInputShape = {
|
|
3634
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3635
|
+
since: timeInputSchema.default("7d").describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
3636
|
+
until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
|
|
3637
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
3638
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
3639
|
+
search: z.string().trim().min(1).max(200).optional()
|
|
3640
|
+
};
|
|
3641
|
+
const listIntentsContractV1 = base.route({
|
|
3642
|
+
path: "/v1/environments/{environmentId}/intents",
|
|
3643
|
+
method: "GET",
|
|
3644
|
+
summary: "List intents",
|
|
3645
|
+
description: "List grouped user intents for an environment over a time range",
|
|
3646
|
+
tags: ["insights"],
|
|
3647
|
+
successDescription: "The grouped user intents"
|
|
3648
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3649
|
+
...paginatedInsightsInputShape,
|
|
3650
|
+
tools: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
|
|
3651
|
+
clientIds: z.array(z.string().min(1)).min(1).max(100).optional(),
|
|
3652
|
+
categoryIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
|
|
3653
|
+
sortDir: z.enum(["asc", "desc"]).default("desc")
|
|
3654
|
+
})).output(z.object({
|
|
3655
|
+
intents: z.array(z.object({
|
|
3656
|
+
id: z.string(),
|
|
3657
|
+
intentIds: z.array(z.string()).min(1),
|
|
3658
|
+
environmentId: z.string(),
|
|
3659
|
+
message: z.string(),
|
|
3660
|
+
toolName: z.string(),
|
|
3661
|
+
createdAt: z.coerce.date(),
|
|
3662
|
+
occurrenceCount: z.number().int().positive(),
|
|
3663
|
+
clientName: z.string().nullable(),
|
|
3664
|
+
clientId: z.string().nullable(),
|
|
3665
|
+
categories: z.array(z.object({
|
|
3666
|
+
id: z.string(),
|
|
3667
|
+
name: z.string(),
|
|
3668
|
+
color: intentCategoryColorSchema
|
|
3669
|
+
}))
|
|
3670
|
+
})),
|
|
3671
|
+
totalCount: z.number().int().nonnegative()
|
|
3672
|
+
}));
|
|
3673
|
+
const listFeedbacksContractV1 = base.route({
|
|
3674
|
+
path: "/v1/environments/{environmentId}/feedbacks",
|
|
3675
|
+
method: "GET",
|
|
3676
|
+
summary: "List feedbacks",
|
|
3677
|
+
description: "List user feedback for an environment over a time range",
|
|
3678
|
+
tags: ["insights"],
|
|
3679
|
+
successDescription: "The user feedback"
|
|
3680
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3681
|
+
...paginatedInsightsInputShape,
|
|
3682
|
+
clientIds: z.array(z.string().min(1)).min(1).max(100).optional()
|
|
3683
|
+
})).output(z.object({
|
|
3684
|
+
feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
|
|
3685
|
+
totalCount: z.number().int().nonnegative()
|
|
3686
|
+
}));
|
|
3687
|
+
const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
|
|
3688
|
+
const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
|
|
3689
|
+
const listIntentCategoriesContractV1 = base.route({
|
|
3690
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
3691
|
+
method: "GET",
|
|
3692
|
+
summary: "List intent categories",
|
|
3693
|
+
description: "List intent categories for an environment, including how many intents each category is linked to",
|
|
3694
|
+
tags: ["insights"],
|
|
3695
|
+
successDescription: "The intent categories"
|
|
3696
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
|
|
3697
|
+
const createIntentCategoryContractV1 = base.route({
|
|
3698
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
3699
|
+
method: "POST",
|
|
3700
|
+
summary: "Create an intent category",
|
|
3701
|
+
description: "Create an intent category, optionally linking it to existing intents",
|
|
3702
|
+
tags: ["insights"],
|
|
3703
|
+
successDescription: "The created intent category"
|
|
3704
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3705
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3706
|
+
name: intentCategoryNameSchema,
|
|
3707
|
+
color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
|
|
3708
|
+
intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
|
|
3709
|
+
})).output(intentCategorySchema);
|
|
3710
|
+
const updateIntentCategoryContractV1 = base.route({
|
|
3711
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
3712
|
+
method: "PATCH",
|
|
3713
|
+
summary: "Update an intent category",
|
|
3714
|
+
description: "Rename or recolor an intent category",
|
|
3715
|
+
tags: ["insights"],
|
|
3716
|
+
successDescription: "The updated intent category"
|
|
3717
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3718
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3719
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
3720
|
+
name: intentCategoryNameSchema.optional(),
|
|
3721
|
+
color: intentCategoryColorSchema.optional().describe("The category color")
|
|
3722
|
+
}).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
|
|
3723
|
+
const deleteIntentCategoryContractV1 = base.route({
|
|
3724
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
3725
|
+
method: "DELETE",
|
|
3726
|
+
summary: "Delete an intent category",
|
|
3727
|
+
description: "Delete an intent category; its intents are unlinked but not deleted",
|
|
3728
|
+
tags: ["insights"],
|
|
3729
|
+
successDescription: "The intent category has been deleted successfully"
|
|
3730
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3731
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3732
|
+
categoryId: z.string().describe("The ID of the category")
|
|
3733
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
3734
|
+
const linkIntentCategoryContractV1 = base.route({
|
|
3735
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
|
|
3736
|
+
method: "POST",
|
|
3737
|
+
summary: "Link an intent category",
|
|
3738
|
+
description: "Link an intent category to intents; already linked intents are ignored",
|
|
3739
|
+
tags: ["insights"],
|
|
3740
|
+
successDescription: "The intents have been linked successfully"
|
|
3741
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3742
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3743
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
3744
|
+
intentIds: categorizableIntentIdsSchema
|
|
3745
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
3746
|
+
const unlinkIntentCategoryContractV1 = base.route({
|
|
3747
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
|
|
3748
|
+
method: "POST",
|
|
3749
|
+
summary: "Unlink an intent category",
|
|
3750
|
+
description: "Unlink an intent category from intents; intents without the category are ignored",
|
|
3751
|
+
tags: ["insights"],
|
|
3752
|
+
successDescription: "The intents have been unlinked successfully"
|
|
3753
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3754
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3755
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
3756
|
+
intentIds: categorizableIntentIdsSchema
|
|
3757
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
3758
|
+
const listTeamsContractV1 = base.route({
|
|
1750
3759
|
path: "/v1/teams",
|
|
1751
3760
|
method: "GET",
|
|
1752
3761
|
summary: "List teams",
|
|
@@ -1759,7 +3768,22 @@ const listTeamsContractV1 = oc.route({
|
|
|
1759
3768
|
createdAt: z.coerce.date(),
|
|
1760
3769
|
hasStripeAccount: z.boolean()
|
|
1761
3770
|
})));
|
|
1762
|
-
const
|
|
3771
|
+
const getTeamUsageContractV1 = base.route({
|
|
3772
|
+
path: "/v1/teams/{teamId}/usage",
|
|
3773
|
+
method: "GET",
|
|
3774
|
+
summary: "Get team usage",
|
|
3775
|
+
description: "Get the MCP request usage of a team for its current billing window. A team that has made no request in the window reports zero.",
|
|
3776
|
+
tags: ["teams"],
|
|
3777
|
+
successDescription: "The current billing window usage"
|
|
3778
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
|
|
3779
|
+
teamId: z.string(),
|
|
3780
|
+
plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
|
|
3781
|
+
periodStart: z.coerce.date().describe("Start of the current billing window"),
|
|
3782
|
+
periodEnd: z.coerce.date().describe("End of the current billing window"),
|
|
3783
|
+
requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
|
|
3784
|
+
includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
|
|
3785
|
+
}));
|
|
3786
|
+
const getTunnelTicketContractV1 = base.route({
|
|
1763
3787
|
path: "/v1/tunnels/ticket",
|
|
1764
3788
|
method: "GET",
|
|
1765
3789
|
summary: "Get a tunnel ticket",
|
|
@@ -1771,16 +3795,13 @@ const getTunnelTicketContractV1 = oc.route({
|
|
|
1771
3795
|
ticket: z.string().describe("The signed tunnel ticket"),
|
|
1772
3796
|
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
1773
3797
|
}));
|
|
1774
|
-
const publishServerContractV1 =
|
|
3798
|
+
const publishServerContractV1 = base.route({
|
|
1775
3799
|
path: "/v1/distribution/publish",
|
|
1776
3800
|
method: "POST",
|
|
1777
3801
|
summary: "Publish a server to the MCP registry",
|
|
1778
3802
|
tags: ["distribution"],
|
|
1779
3803
|
successDescription: "The server has been published successfully"
|
|
1780
|
-
}).errors({
|
|
1781
|
-
NOT_FOUND: {},
|
|
1782
|
-
BAD_REQUEST: {}
|
|
1783
|
-
}).input(z.object({
|
|
3804
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1784
3805
|
projectId: z.string(),
|
|
1785
3806
|
domain: z.string(),
|
|
1786
3807
|
title: z.string().min(1).max(100),
|
|
@@ -1789,17 +3810,14 @@ const publishServerContractV1 = oc.route({
|
|
|
1789
3810
|
iconSrc: z.url().max(255).optional(),
|
|
1790
3811
|
dryRun: z.boolean().optional()
|
|
1791
3812
|
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
1792
|
-
const getServerInfoContractV1 =
|
|
3813
|
+
const getServerInfoContractV1 = base.route({
|
|
1793
3814
|
path: "/v1/distribution/get",
|
|
1794
3815
|
method: "GET",
|
|
1795
3816
|
summary: "Get server info",
|
|
1796
3817
|
description: "Get info about a server",
|
|
1797
3818
|
tags: ["distribution"],
|
|
1798
3819
|
successDescription: "The server info"
|
|
1799
|
-
}).errors({
|
|
1800
|
-
NOT_FOUND: {},
|
|
1801
|
-
BAD_REQUEST: {}
|
|
1802
|
-
}).input(z.object({
|
|
3820
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1803
3821
|
projectId: z.string(),
|
|
1804
3822
|
domain: z.string()
|
|
1805
3823
|
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
@@ -1818,7 +3836,7 @@ const playgroundOutputSchema = z.object({
|
|
|
1818
3836
|
isPlaygroundEnabled: z.boolean(),
|
|
1819
3837
|
serverMetadata: playgroundServerMetadataOutputSchema.nullable()
|
|
1820
3838
|
});
|
|
1821
|
-
const getPlaygroundContractV1 =
|
|
3839
|
+
const getPlaygroundContractV1 = base.route({
|
|
1822
3840
|
path: "/v1/environments/{environmentId}/playground",
|
|
1823
3841
|
method: "GET",
|
|
1824
3842
|
summary: "Get playground configuration",
|
|
@@ -1826,17 +3844,14 @@ const getPlaygroundContractV1 = oc.route({
|
|
|
1826
3844
|
tags: ["environments"],
|
|
1827
3845
|
successDescription: "The playground configuration"
|
|
1828
3846
|
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
|
|
1829
|
-
const upsertPlaygroundContractV1 =
|
|
3847
|
+
const upsertPlaygroundContractV1 = base.route({
|
|
1830
3848
|
path: "/v1/environments/{environmentId}/playground",
|
|
1831
3849
|
method: "PUT",
|
|
1832
3850
|
summary: "Update playground configuration",
|
|
1833
3851
|
description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
|
|
1834
3852
|
tags: ["environments"],
|
|
1835
3853
|
successDescription: "The updated playground configuration"
|
|
1836
|
-
}).errors({
|
|
1837
|
-
NOT_FOUND: {},
|
|
1838
|
-
BAD_REQUEST: {}
|
|
1839
|
-
}).input(z.object({
|
|
3854
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1840
3855
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1841
3856
|
isPlaygroundEnabled: z.boolean().optional(),
|
|
1842
3857
|
name: z.string().min(1).max(100).optional(),
|
|
@@ -1844,7 +3859,7 @@ const upsertPlaygroundContractV1 = oc.route({
|
|
|
1844
3859
|
headers: z.array(playgroundHeaderSchema).optional(),
|
|
1845
3860
|
examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
|
|
1846
3861
|
})).output(playgroundOutputSchema);
|
|
1847
|
-
const createBeaconContractV1 =
|
|
3862
|
+
const createBeaconContractV1 = base.route({
|
|
1848
3863
|
path: "/v1/beacon/audits",
|
|
1849
3864
|
method: "POST",
|
|
1850
3865
|
summary: "Create a beacon audit",
|
|
@@ -1853,7 +3868,6 @@ const createBeaconContractV1 = oc.route({
|
|
|
1853
3868
|
successDescription: "The audit has been created"
|
|
1854
3869
|
}).errors({
|
|
1855
3870
|
NOT_FOUND: {},
|
|
1856
|
-
BAD_REQUEST: {},
|
|
1857
3871
|
DNS_RESOLUTION_FAILED: { status: 400 }
|
|
1858
3872
|
}).input(z.object({
|
|
1859
3873
|
targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
|
|
@@ -1861,7 +3875,7 @@ const createBeaconContractV1 = oc.route({
|
|
|
1861
3875
|
projectId: z.string().optional().describe("The project ID to associate the audit with"),
|
|
1862
3876
|
excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
|
|
1863
3877
|
})).output(z.object({ id: z.string() }));
|
|
1864
|
-
const getBeaconContractV1 =
|
|
3878
|
+
const getBeaconContractV1 = base.route({
|
|
1865
3879
|
path: "/v1/beacon/audits/{auditId}",
|
|
1866
3880
|
method: "GET",
|
|
1867
3881
|
summary: "Get a beacon audit",
|
|
@@ -1876,9 +3890,73 @@ const getBeaconContractV1 = oc.route({
|
|
|
1876
3890
|
createdAt: z.coerce.date(),
|
|
1877
3891
|
report: auditReportWithScreenshotsSchema.nullable()
|
|
1878
3892
|
}));
|
|
3893
|
+
const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
|
|
3894
|
+
const submissionIdSchema = z.string().describe("The ID of the submission package");
|
|
3895
|
+
const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
|
|
3896
|
+
const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
|
|
3897
|
+
const createSubmissionContractV1 = base.route({
|
|
3898
|
+
path: "/v1/submissions",
|
|
3899
|
+
method: "POST",
|
|
3900
|
+
summary: "Create a submission package",
|
|
3901
|
+
description: "Create a submission package for an environment. Alpic reads the environment's live MCP server and prefills every field it can infer, so the response already carries the populated package. The environment must have a successful deployment and must not require authentication.",
|
|
3902
|
+
tags: ["submissions"],
|
|
3903
|
+
successDescription: "The created submission package, with its prefilled fields"
|
|
3904
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3905
|
+
environmentId: z.string().describe("The ID of the environment to build the package from"),
|
|
3906
|
+
platform: platformSchema.describe(PLATFORM_DESCRIPTION)
|
|
3907
|
+
})).output(submissionSchema);
|
|
3908
|
+
const listSubmissionsContractV1 = base.route({
|
|
3909
|
+
path: "/v1/projects/{projectId}/submissions",
|
|
3910
|
+
method: "GET",
|
|
3911
|
+
summary: "List submission packages",
|
|
3912
|
+
description: "List the submission packages of a project, grouped by directory and most recently updated first, optionally narrowed to one environment or one directory",
|
|
3913
|
+
tags: ["submissions"],
|
|
3914
|
+
successDescription: "The list of submission packages"
|
|
3915
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
3916
|
+
projectId: z.string().describe("The ID of the project"),
|
|
3917
|
+
environmentId: z.string().optional().describe("Filter by environment ID"),
|
|
3918
|
+
platform: platformSchema.optional().describe(PLATFORM_DESCRIPTION)
|
|
3919
|
+
})).output(z.array(submissionSchema));
|
|
3920
|
+
const getSubmissionContractV1 = base.route({
|
|
3921
|
+
path: "/v1/submissions/{submissionId}",
|
|
3922
|
+
method: "GET",
|
|
3923
|
+
summary: "Get a submission package",
|
|
3924
|
+
description: "Get a submission package by ID, including its form data and the prefill it started from",
|
|
3925
|
+
tags: ["submissions"],
|
|
3926
|
+
successDescription: "The submission package"
|
|
3927
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
|
|
3928
|
+
const updateSubmissionContractV1 = base.route({
|
|
3929
|
+
path: "/v1/submissions/{submissionId}",
|
|
3930
|
+
method: "PUT",
|
|
3931
|
+
summary: "Update a submission package",
|
|
3932
|
+
description: "Update the form data of a submission package. Only the fields you send are changed; the rest are left as they are. Unknown field names are rejected rather than ignored, so a typo fails the call. `platform` must match the package's own platform.",
|
|
3933
|
+
tags: ["submissions"],
|
|
3934
|
+
successDescription: "The updated submission package"
|
|
3935
|
+
}).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
|
|
3936
|
+
submissionId: submissionIdSchema,
|
|
3937
|
+
platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
|
|
3938
|
+
formData: claudeSubmissionUpdateSchema
|
|
3939
|
+
}), z.object({
|
|
3940
|
+
submissionId: submissionIdSchema,
|
|
3941
|
+
platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
|
|
3942
|
+
formData: chatgptSubmissionUpdateSchema
|
|
3943
|
+
})])).output(submissionSchema);
|
|
1879
3944
|
const contract = {
|
|
1880
|
-
teams: {
|
|
3945
|
+
teams: {
|
|
3946
|
+
list: { v1: listTeamsContractV1 },
|
|
3947
|
+
getUsage: { v1: getTeamUsageContractV1 }
|
|
3948
|
+
},
|
|
1881
3949
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
3950
|
+
intents: { list: { v1: listIntentsContractV1 } },
|
|
3951
|
+
intentCategories: {
|
|
3952
|
+
list: { v1: listIntentCategoriesContractV1 },
|
|
3953
|
+
create: { v1: createIntentCategoryContractV1 },
|
|
3954
|
+
update: { v1: updateIntentCategoryContractV1 },
|
|
3955
|
+
delete: { v1: deleteIntentCategoryContractV1 },
|
|
3956
|
+
link: { v1: linkIntentCategoryContractV1 },
|
|
3957
|
+
unlink: { v1: unlinkIntentCategoryContractV1 }
|
|
3958
|
+
},
|
|
3959
|
+
feedbacks: { list: { v1: listFeedbacksContractV1 } },
|
|
1882
3960
|
deployments: {
|
|
1883
3961
|
list: { v1: listDeploymentsContractV1 },
|
|
1884
3962
|
get: { v1: getDeploymentContractV1 },
|
|
@@ -1888,6 +3966,7 @@ const contract = {
|
|
|
1888
3966
|
environments: {
|
|
1889
3967
|
create: { v1: createEnvironmentContractV1 },
|
|
1890
3968
|
get: { v1: getEnvironmentContractV1 },
|
|
3969
|
+
delete: { v1: deleteEnvironmentContractV1 },
|
|
1891
3970
|
deploy: { v1: deployEnvironmentContractV1 },
|
|
1892
3971
|
getLogs: { v1: getLogsContractV1 },
|
|
1893
3972
|
getLatestLogs: { v1: getLatestLogsContractV1 }
|
|
@@ -1898,6 +3977,12 @@ const contract = {
|
|
|
1898
3977
|
update: { v1: updateEnvironmentVariableContractV1 },
|
|
1899
3978
|
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
1900
3979
|
},
|
|
3980
|
+
telemetryDestinations: {
|
|
3981
|
+
list: { v1: listTelemetryDestinationsContractV1 },
|
|
3982
|
+
create: { v1: createTelemetryDestinationContractV1 },
|
|
3983
|
+
update: { v1: updateTelemetryDestinationContractV1 },
|
|
3984
|
+
delete: { v1: deleteTelemetryDestinationContractV1 }
|
|
3985
|
+
},
|
|
1901
3986
|
projects: {
|
|
1902
3987
|
update: { v1: updateProjectContractV1 },
|
|
1903
3988
|
get: { v1: getProjectContractV1 },
|
|
@@ -1917,7 +4002,39 @@ const contract = {
|
|
|
1917
4002
|
beacon: {
|
|
1918
4003
|
create: { v1: createBeaconContractV1 },
|
|
1919
4004
|
get: { v1: getBeaconContractV1 }
|
|
4005
|
+
},
|
|
4006
|
+
submissions: {
|
|
4007
|
+
create: { v1: createSubmissionContractV1 },
|
|
4008
|
+
list: { v1: listSubmissionsContractV1 },
|
|
4009
|
+
get: { v1: getSubmissionContractV1 },
|
|
4010
|
+
update: { v1: updateSubmissionContractV1 }
|
|
4011
|
+
}
|
|
4012
|
+
};
|
|
4013
|
+
const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
|
|
4014
|
+
const contractForDocs = {
|
|
4015
|
+
...contract,
|
|
4016
|
+
deployments: deploymentsForDocs
|
|
4017
|
+
};
|
|
4018
|
+
/** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
|
|
4019
|
+
const OPENAPI_DOC_OPTIONS = {
|
|
4020
|
+
info: {
|
|
4021
|
+
title: "Alpic API",
|
|
4022
|
+
version: "1.0.0"
|
|
4023
|
+
},
|
|
4024
|
+
servers: [{ url: "https://api.alpic.ai" }],
|
|
4025
|
+
security: [{ bearerAuth: [] }],
|
|
4026
|
+
components: { securitySchemes: { bearerAuth: {
|
|
4027
|
+
type: "http",
|
|
4028
|
+
description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
|
|
4029
|
+
scheme: "bearer"
|
|
4030
|
+
} } },
|
|
4031
|
+
commonSchemas: {
|
|
4032
|
+
Submission: { schema: submissionSchema },
|
|
4033
|
+
ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
|
|
4034
|
+
ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
|
|
4035
|
+
ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
|
|
4036
|
+
ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
|
|
1920
4037
|
}
|
|
1921
4038
|
};
|
|
1922
4039
|
//#endregion
|
|
1923
|
-
export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
|
4040
|
+
export { AI_PLATFORMS, AUTH_SCOPE_ANY, AUTH_SCOPE_USER, INTENT_CATEGORY_COLORS, OPENAPI_DOC_OPTIONS, OTLP_PROTOCOLS, PLATFORM_LABELS, TELEMETRY_SIGNALS, buildSettingsSchema, chatgptSubmissionUpdateSchema, claudeSubmissionUpdateSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, otlpProtocolSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, telemetrySignalSchema, transportSchema, updateEnvironmentVariableSchema };
|