@alpic-ai/api 0.0.0-dev.gf251ee1 → 0.0.0-dev.gf278e1f
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 +5193 -64
- package/dist/index.mjs +2084 -56
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,9 @@ 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
|
-
|
|
5
|
+
// \0rolldown/runtime.js
|
|
6
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
7
|
+
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
6
8
|
/**
|
|
7
9
|
* Reusable URL validation that disallows javascript: scheme
|
|
8
10
|
*/
|
|
@@ -119,7 +121,12 @@ z$1.object({
|
|
|
119
121
|
token_type: z$1.string(),
|
|
120
122
|
expires_in: z$1.coerce.number().optional(),
|
|
121
123
|
scope: z$1.string().optional(),
|
|
122
|
-
refresh_token: z$1.string().optional()
|
|
124
|
+
refresh_token: z$1.string().optional(),
|
|
125
|
+
/**
|
|
126
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
127
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
128
|
+
*/
|
|
129
|
+
issuer: z$1.string().optional().catch(void 0)
|
|
123
130
|
}).strip();
|
|
124
131
|
z$1.object({
|
|
125
132
|
error: z$1.string(),
|
|
@@ -158,7 +165,12 @@ const OAuthClientInformationSchema = z$1.object({
|
|
|
158
165
|
client_id: z$1.string(),
|
|
159
166
|
client_secret: z$1.string().optional(),
|
|
160
167
|
client_id_issued_at: z$1.number().optional(),
|
|
161
|
-
client_secret_expires_at: z$1.number().optional()
|
|
168
|
+
client_secret_expires_at: z$1.number().optional(),
|
|
169
|
+
/**
|
|
170
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
171
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
172
|
+
*/
|
|
173
|
+
issuer: z$1.string().optional().catch(void 0)
|
|
162
174
|
}).strip();
|
|
163
175
|
OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
164
176
|
z$1.object({
|
|
@@ -169,8 +181,1722 @@ z$1.object({
|
|
|
169
181
|
token: z$1.string(),
|
|
170
182
|
token_type_hint: z$1.string().optional()
|
|
171
183
|
}).strip();
|
|
172
|
-
|
|
173
|
-
|
|
184
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/constants.js
|
|
185
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
186
|
+
module.exports = {
|
|
187
|
+
MAX_LENGTH: 256,
|
|
188
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
189
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
190
|
+
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
|
|
191
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
192
|
+
WHITESPACE_CHARACTERS: [
|
|
193
|
+
" ",
|
|
194
|
+
"\n",
|
|
195
|
+
"\v",
|
|
196
|
+
"\f",
|
|
197
|
+
"\r",
|
|
198
|
+
" ",
|
|
199
|
+
"\xA0",
|
|
200
|
+
" ",
|
|
201
|
+
" ",
|
|
202
|
+
" ",
|
|
203
|
+
" ",
|
|
204
|
+
" ",
|
|
205
|
+
" ",
|
|
206
|
+
" ",
|
|
207
|
+
" ",
|
|
208
|
+
" ",
|
|
209
|
+
" ",
|
|
210
|
+
" ",
|
|
211
|
+
" ",
|
|
212
|
+
"\u2028",
|
|
213
|
+
"\u2029",
|
|
214
|
+
" ",
|
|
215
|
+
" ",
|
|
216
|
+
" ",
|
|
217
|
+
""
|
|
218
|
+
],
|
|
219
|
+
RELEASE_TYPES: [
|
|
220
|
+
"major",
|
|
221
|
+
"premajor",
|
|
222
|
+
"minor",
|
|
223
|
+
"preminor",
|
|
224
|
+
"patch",
|
|
225
|
+
"prepatch",
|
|
226
|
+
"prerelease"
|
|
227
|
+
],
|
|
228
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
229
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
230
|
+
FLAG_LOOSE: 2
|
|
231
|
+
};
|
|
232
|
+
}));
|
|
233
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/debug.js
|
|
234
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
235
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
236
|
+
}));
|
|
237
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/re.js
|
|
238
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
239
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
240
|
+
const debug = require_debug();
|
|
241
|
+
exports = module.exports = {};
|
|
242
|
+
const re = exports.re = [];
|
|
243
|
+
const safeRe = exports.safeRe = [];
|
|
244
|
+
const src = exports.src = [];
|
|
245
|
+
const safeSrc = exports.safeSrc = [];
|
|
246
|
+
const t = exports.t = {};
|
|
247
|
+
let R = 0;
|
|
248
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
249
|
+
const safeRegexReplacements = [
|
|
250
|
+
["\\s", 1],
|
|
251
|
+
["\\d", MAX_LENGTH],
|
|
252
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
253
|
+
];
|
|
254
|
+
const makeSafeRegex = (value) => {
|
|
255
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
256
|
+
return value;
|
|
257
|
+
};
|
|
258
|
+
const createToken = (name, value, isGlobal) => {
|
|
259
|
+
const safe = makeSafeRegex(value);
|
|
260
|
+
const index = R++;
|
|
261
|
+
debug(name, index, value);
|
|
262
|
+
t[name] = index;
|
|
263
|
+
src[index] = value;
|
|
264
|
+
safeSrc[index] = safe;
|
|
265
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
266
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
267
|
+
};
|
|
268
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
269
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
270
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
271
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
272
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
273
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
274
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
275
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
276
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
277
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
278
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
279
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
280
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
281
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
282
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
283
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
284
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
285
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
286
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
287
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
288
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
289
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
290
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
291
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
292
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
293
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
294
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
295
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
296
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
297
|
+
exports.tildeTrimReplace = "$1~";
|
|
298
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
299
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
300
|
+
createToken("LONECARET", "(?:\\^)");
|
|
301
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
302
|
+
exports.caretTrimReplace = "$1^";
|
|
303
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
304
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
305
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
306
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
307
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
308
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
309
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
310
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
311
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
312
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
313
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
314
|
+
}));
|
|
315
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/parse-options.js
|
|
316
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
317
|
+
const looseOption = Object.freeze({ loose: true });
|
|
318
|
+
const emptyOpts = Object.freeze({});
|
|
319
|
+
const parseOptions = (options) => {
|
|
320
|
+
if (!options) return emptyOpts;
|
|
321
|
+
if (typeof options !== "object") return looseOption;
|
|
322
|
+
return options;
|
|
323
|
+
};
|
|
324
|
+
module.exports = parseOptions;
|
|
325
|
+
}));
|
|
326
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/identifiers.js
|
|
327
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
328
|
+
const numeric = /^[0-9]+$/;
|
|
329
|
+
const compareIdentifiers = (a, b) => {
|
|
330
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
331
|
+
const anum = numeric.test(a);
|
|
332
|
+
const bnum = numeric.test(b);
|
|
333
|
+
if (anum && bnum) {
|
|
334
|
+
a = +a;
|
|
335
|
+
b = +b;
|
|
336
|
+
}
|
|
337
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
338
|
+
};
|
|
339
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
340
|
+
module.exports = {
|
|
341
|
+
compareIdentifiers,
|
|
342
|
+
rcompareIdentifiers
|
|
343
|
+
};
|
|
344
|
+
}));
|
|
345
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/semver.js
|
|
346
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
347
|
+
const debug = require_debug();
|
|
348
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
349
|
+
const { safeRe: re, t } = require_re();
|
|
350
|
+
const parseOptions = require_parse_options();
|
|
351
|
+
const { compareIdentifiers } = require_identifiers();
|
|
352
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
353
|
+
const identifiers = identifier.split(".");
|
|
354
|
+
if (identifiers.length > prerelease.length) return false;
|
|
355
|
+
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
356
|
+
return true;
|
|
357
|
+
};
|
|
358
|
+
module.exports = class SemVer {
|
|
359
|
+
constructor(version, options) {
|
|
360
|
+
options = parseOptions(options);
|
|
361
|
+
if (version instanceof SemVer) {
|
|
362
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
363
|
+
else version = version.version;
|
|
364
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
365
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
366
|
+
debug("SemVer", version, options);
|
|
367
|
+
this.options = options;
|
|
368
|
+
this.loose = !!options.loose;
|
|
369
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
370
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
371
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
372
|
+
this.raw = version;
|
|
373
|
+
this.major = +m[1];
|
|
374
|
+
this.minor = +m[2];
|
|
375
|
+
this.patch = +m[3];
|
|
376
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
377
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
378
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
379
|
+
if (!m[4]) this.prerelease = [];
|
|
380
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
381
|
+
if (/^[0-9]+$/.test(id)) {
|
|
382
|
+
const num = +id;
|
|
383
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
384
|
+
}
|
|
385
|
+
return id;
|
|
386
|
+
});
|
|
387
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
388
|
+
this.format();
|
|
389
|
+
}
|
|
390
|
+
format() {
|
|
391
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
392
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
393
|
+
return this.version;
|
|
394
|
+
}
|
|
395
|
+
toString() {
|
|
396
|
+
return this.version;
|
|
397
|
+
}
|
|
398
|
+
compare(other) {
|
|
399
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
400
|
+
if (!(other instanceof SemVer)) {
|
|
401
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
402
|
+
other = new SemVer(other, this.options);
|
|
403
|
+
}
|
|
404
|
+
if (other.version === this.version) return 0;
|
|
405
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
406
|
+
}
|
|
407
|
+
compareMain(other) {
|
|
408
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
409
|
+
if (this.major < other.major) return -1;
|
|
410
|
+
if (this.major > other.major) return 1;
|
|
411
|
+
if (this.minor < other.minor) return -1;
|
|
412
|
+
if (this.minor > other.minor) return 1;
|
|
413
|
+
if (this.patch < other.patch) return -1;
|
|
414
|
+
if (this.patch > other.patch) return 1;
|
|
415
|
+
return 0;
|
|
416
|
+
}
|
|
417
|
+
comparePre(other) {
|
|
418
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
419
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
420
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
421
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
422
|
+
let i = 0;
|
|
423
|
+
do {
|
|
424
|
+
const a = this.prerelease[i];
|
|
425
|
+
const b = other.prerelease[i];
|
|
426
|
+
debug("prerelease compare", i, a, b);
|
|
427
|
+
if (a === void 0 && b === void 0) return 0;
|
|
428
|
+
else if (b === void 0) return 1;
|
|
429
|
+
else if (a === void 0) return -1;
|
|
430
|
+
else if (a === b) continue;
|
|
431
|
+
else return compareIdentifiers(a, b);
|
|
432
|
+
} while (++i);
|
|
433
|
+
}
|
|
434
|
+
compareBuild(other) {
|
|
435
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
436
|
+
let i = 0;
|
|
437
|
+
do {
|
|
438
|
+
const a = this.build[i];
|
|
439
|
+
const b = other.build[i];
|
|
440
|
+
debug("build compare", i, a, b);
|
|
441
|
+
if (a === void 0 && b === void 0) return 0;
|
|
442
|
+
else if (b === void 0) return 1;
|
|
443
|
+
else if (a === void 0) return -1;
|
|
444
|
+
else if (a === b) continue;
|
|
445
|
+
else return compareIdentifiers(a, b);
|
|
446
|
+
} while (++i);
|
|
447
|
+
}
|
|
448
|
+
inc(release, identifier, identifierBase) {
|
|
449
|
+
if (release.startsWith("pre")) {
|
|
450
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
451
|
+
if (identifier) {
|
|
452
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
453
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
switch (release) {
|
|
457
|
+
case "premajor":
|
|
458
|
+
this.prerelease.length = 0;
|
|
459
|
+
this.patch = 0;
|
|
460
|
+
this.minor = 0;
|
|
461
|
+
this.major++;
|
|
462
|
+
this.inc("pre", identifier, identifierBase);
|
|
463
|
+
break;
|
|
464
|
+
case "preminor":
|
|
465
|
+
this.prerelease.length = 0;
|
|
466
|
+
this.patch = 0;
|
|
467
|
+
this.minor++;
|
|
468
|
+
this.inc("pre", identifier, identifierBase);
|
|
469
|
+
break;
|
|
470
|
+
case "prepatch":
|
|
471
|
+
this.prerelease.length = 0;
|
|
472
|
+
this.inc("patch", identifier, identifierBase);
|
|
473
|
+
this.inc("pre", identifier, identifierBase);
|
|
474
|
+
break;
|
|
475
|
+
case "prerelease":
|
|
476
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
477
|
+
this.inc("pre", identifier, identifierBase);
|
|
478
|
+
break;
|
|
479
|
+
case "release":
|
|
480
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
481
|
+
this.prerelease.length = 0;
|
|
482
|
+
break;
|
|
483
|
+
case "major":
|
|
484
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
485
|
+
this.minor = 0;
|
|
486
|
+
this.patch = 0;
|
|
487
|
+
this.prerelease = [];
|
|
488
|
+
break;
|
|
489
|
+
case "minor":
|
|
490
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
491
|
+
this.patch = 0;
|
|
492
|
+
this.prerelease = [];
|
|
493
|
+
break;
|
|
494
|
+
case "patch":
|
|
495
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
496
|
+
this.prerelease = [];
|
|
497
|
+
break;
|
|
498
|
+
case "pre": {
|
|
499
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
500
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
501
|
+
else {
|
|
502
|
+
let i = this.prerelease.length;
|
|
503
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
504
|
+
this.prerelease[i]++;
|
|
505
|
+
i = -2;
|
|
506
|
+
}
|
|
507
|
+
if (i === -1) {
|
|
508
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
509
|
+
this.prerelease.push(base);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (identifier) {
|
|
513
|
+
let prerelease = [identifier, base];
|
|
514
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
515
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
516
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
517
|
+
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
518
|
+
} else this.prerelease = prerelease;
|
|
519
|
+
}
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
523
|
+
}
|
|
524
|
+
this.raw = this.format();
|
|
525
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}));
|
|
530
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/parse.js
|
|
531
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
532
|
+
const SemVer = require_semver$1();
|
|
533
|
+
const parse = (version, options, throwErrors = false) => {
|
|
534
|
+
if (version instanceof SemVer) return version;
|
|
535
|
+
try {
|
|
536
|
+
return new SemVer(version, options);
|
|
537
|
+
} catch (er) {
|
|
538
|
+
if (!throwErrors) return null;
|
|
539
|
+
throw er;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
module.exports = parse;
|
|
543
|
+
}));
|
|
544
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/valid.js
|
|
545
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
546
|
+
const parse = require_parse();
|
|
547
|
+
const valid = (version, options) => {
|
|
548
|
+
const v = parse(version, options);
|
|
549
|
+
return v ? v.version : null;
|
|
550
|
+
};
|
|
551
|
+
module.exports = valid;
|
|
552
|
+
}));
|
|
553
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/clean.js
|
|
554
|
+
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
555
|
+
const parse = require_parse();
|
|
556
|
+
const clean = (version, options) => {
|
|
557
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
558
|
+
return s ? s.version : null;
|
|
559
|
+
};
|
|
560
|
+
module.exports = clean;
|
|
561
|
+
}));
|
|
562
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/inc.js
|
|
563
|
+
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
564
|
+
const SemVer = require_semver$1();
|
|
565
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
566
|
+
if (typeof options === "string") {
|
|
567
|
+
identifierBase = identifier;
|
|
568
|
+
identifier = options;
|
|
569
|
+
options = void 0;
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
573
|
+
} catch (er) {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
module.exports = inc;
|
|
578
|
+
}));
|
|
579
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/diff.js
|
|
580
|
+
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
581
|
+
const parse = require_parse();
|
|
582
|
+
const diff = (version1, version2) => {
|
|
583
|
+
const v1 = parse(version1, null, true);
|
|
584
|
+
const v2 = parse(version2, null, true);
|
|
585
|
+
const comparison = v1.compare(v2);
|
|
586
|
+
if (comparison === 0) return null;
|
|
587
|
+
const v1Higher = comparison > 0;
|
|
588
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
589
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
590
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
591
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
592
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
593
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
594
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
595
|
+
return "patch";
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const prefix = highHasPre ? "pre" : "";
|
|
599
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
600
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
601
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
602
|
+
return "prerelease";
|
|
603
|
+
};
|
|
604
|
+
module.exports = diff;
|
|
605
|
+
}));
|
|
606
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/major.js
|
|
607
|
+
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
608
|
+
const SemVer = require_semver$1();
|
|
609
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
610
|
+
module.exports = major;
|
|
611
|
+
}));
|
|
612
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/minor.js
|
|
613
|
+
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
614
|
+
const SemVer = require_semver$1();
|
|
615
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
616
|
+
module.exports = minor;
|
|
617
|
+
}));
|
|
618
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/patch.js
|
|
619
|
+
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
620
|
+
const SemVer = require_semver$1();
|
|
621
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
622
|
+
module.exports = patch;
|
|
623
|
+
}));
|
|
624
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/prerelease.js
|
|
625
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
626
|
+
const parse = require_parse();
|
|
627
|
+
const prerelease = (version, options) => {
|
|
628
|
+
const parsed = parse(version, options);
|
|
629
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
630
|
+
};
|
|
631
|
+
module.exports = prerelease;
|
|
632
|
+
}));
|
|
633
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare.js
|
|
634
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
635
|
+
const SemVer = require_semver$1();
|
|
636
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
637
|
+
module.exports = compare;
|
|
638
|
+
}));
|
|
639
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rcompare.js
|
|
640
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
641
|
+
const compare = require_compare();
|
|
642
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
643
|
+
module.exports = rcompare;
|
|
644
|
+
}));
|
|
645
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-loose.js
|
|
646
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
647
|
+
const compare = require_compare();
|
|
648
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
649
|
+
module.exports = compareLoose;
|
|
650
|
+
}));
|
|
651
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-build.js
|
|
652
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
653
|
+
const SemVer = require_semver$1();
|
|
654
|
+
const compareBuild = (a, b, loose) => {
|
|
655
|
+
const versionA = new SemVer(a, loose);
|
|
656
|
+
const versionB = new SemVer(b, loose);
|
|
657
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
658
|
+
};
|
|
659
|
+
module.exports = compareBuild;
|
|
660
|
+
}));
|
|
661
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/sort.js
|
|
662
|
+
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
663
|
+
const compareBuild = require_compare_build();
|
|
664
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
665
|
+
module.exports = sort;
|
|
666
|
+
}));
|
|
667
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rsort.js
|
|
668
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
669
|
+
const compareBuild = require_compare_build();
|
|
670
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
671
|
+
module.exports = rsort;
|
|
672
|
+
}));
|
|
673
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/gt.js
|
|
674
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
675
|
+
const compare = require_compare();
|
|
676
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
677
|
+
module.exports = gt;
|
|
678
|
+
}));
|
|
679
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lt.js
|
|
680
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
681
|
+
const compare = require_compare();
|
|
682
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
683
|
+
module.exports = lt;
|
|
684
|
+
}));
|
|
685
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/eq.js
|
|
686
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
687
|
+
const compare = require_compare();
|
|
688
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
689
|
+
module.exports = eq;
|
|
690
|
+
}));
|
|
691
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/neq.js
|
|
692
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
693
|
+
const compare = require_compare();
|
|
694
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
695
|
+
module.exports = neq;
|
|
696
|
+
}));
|
|
697
|
+
// ../../node_modules/.pnpm/semver@7.8.6/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
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lte.js
|
|
704
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
705
|
+
const compare = require_compare();
|
|
706
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
707
|
+
module.exports = lte;
|
|
708
|
+
}));
|
|
709
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/cmp.js
|
|
710
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
711
|
+
const eq = require_eq();
|
|
712
|
+
const neq = require_neq();
|
|
713
|
+
const gt = require_gt();
|
|
714
|
+
const gte = require_gte();
|
|
715
|
+
const lt = require_lt();
|
|
716
|
+
const lte = require_lte();
|
|
717
|
+
const cmp = (a, op, b, loose) => {
|
|
718
|
+
switch (op) {
|
|
719
|
+
case "===":
|
|
720
|
+
if (typeof a === "object") a = a.version;
|
|
721
|
+
if (typeof b === "object") b = b.version;
|
|
722
|
+
return a === b;
|
|
723
|
+
case "!==":
|
|
724
|
+
if (typeof a === "object") a = a.version;
|
|
725
|
+
if (typeof b === "object") b = b.version;
|
|
726
|
+
return a !== b;
|
|
727
|
+
case "":
|
|
728
|
+
case "=":
|
|
729
|
+
case "==": return eq(a, b, loose);
|
|
730
|
+
case "!=": return neq(a, b, loose);
|
|
731
|
+
case ">": return gt(a, b, loose);
|
|
732
|
+
case ">=": return gte(a, b, loose);
|
|
733
|
+
case "<": return lt(a, b, loose);
|
|
734
|
+
case "<=": return lte(a, b, loose);
|
|
735
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
module.exports = cmp;
|
|
739
|
+
}));
|
|
740
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/coerce.js
|
|
741
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
742
|
+
const SemVer = require_semver$1();
|
|
743
|
+
const parse = require_parse();
|
|
744
|
+
const { safeRe: re, t } = require_re();
|
|
745
|
+
const coerce = (version, options) => {
|
|
746
|
+
if (version instanceof SemVer) return version;
|
|
747
|
+
if (typeof version === "number") version = String(version);
|
|
748
|
+
if (typeof version !== "string") return null;
|
|
749
|
+
options = options || {};
|
|
750
|
+
let match = null;
|
|
751
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
752
|
+
else {
|
|
753
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
754
|
+
let next;
|
|
755
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
756
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
757
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
758
|
+
}
|
|
759
|
+
coerceRtlRegex.lastIndex = -1;
|
|
760
|
+
}
|
|
761
|
+
if (match === null) return null;
|
|
762
|
+
const major = match[2];
|
|
763
|
+
const minor = match[3] || "0";
|
|
764
|
+
const patch = match[4] || "0";
|
|
765
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
766
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
767
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
768
|
+
};
|
|
769
|
+
module.exports = coerce;
|
|
770
|
+
}));
|
|
771
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/truncate.js
|
|
772
|
+
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
773
|
+
const parse = require_parse();
|
|
774
|
+
const constants = require_constants();
|
|
775
|
+
const SemVer = require_semver$1();
|
|
776
|
+
const truncate = (version, truncation, options) => {
|
|
777
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
778
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
779
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
780
|
+
};
|
|
781
|
+
const cloneInputVersion = (version, options) => {
|
|
782
|
+
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
783
|
+
return parse(versionStringToParse, options);
|
|
784
|
+
};
|
|
785
|
+
const doTruncation = (version, truncation) => {
|
|
786
|
+
if (isPrerelease(truncation)) return version.version;
|
|
787
|
+
version.prerelease = [];
|
|
788
|
+
switch (truncation) {
|
|
789
|
+
case "major":
|
|
790
|
+
version.minor = 0;
|
|
791
|
+
version.patch = 0;
|
|
792
|
+
break;
|
|
793
|
+
case "minor": version.patch = 0;
|
|
794
|
+
}
|
|
795
|
+
return version.format();
|
|
796
|
+
};
|
|
797
|
+
const isPrerelease = (type) => {
|
|
798
|
+
return type.startsWith("pre");
|
|
799
|
+
};
|
|
800
|
+
module.exports = truncate;
|
|
801
|
+
}));
|
|
802
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/lrucache.js
|
|
803
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
804
|
+
var LRUCache = class {
|
|
805
|
+
constructor() {
|
|
806
|
+
this.max = 1e3;
|
|
807
|
+
this.map = /* @__PURE__ */ new Map();
|
|
808
|
+
}
|
|
809
|
+
get(key) {
|
|
810
|
+
const value = this.map.get(key);
|
|
811
|
+
if (value === void 0) return;
|
|
812
|
+
else {
|
|
813
|
+
this.map.delete(key);
|
|
814
|
+
this.map.set(key, value);
|
|
815
|
+
return value;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
delete(key) {
|
|
819
|
+
return this.map.delete(key);
|
|
820
|
+
}
|
|
821
|
+
set(key, value) {
|
|
822
|
+
if (!this.delete(key) && value !== void 0) {
|
|
823
|
+
if (this.map.size >= this.max) {
|
|
824
|
+
const firstKey = this.map.keys().next().value;
|
|
825
|
+
this.delete(firstKey);
|
|
826
|
+
}
|
|
827
|
+
this.map.set(key, value);
|
|
828
|
+
}
|
|
829
|
+
return this;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
module.exports = LRUCache;
|
|
833
|
+
}));
|
|
834
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/trim-comparator-whitespace.js
|
|
835
|
+
var require_trim_comparator_whitespace = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
836
|
+
const { MAX_LENGTH, MAX_SAFE_BUILD_LENGTH, WHITESPACE_CHARACTERS } = require_constants();
|
|
837
|
+
/**
|
|
838
|
+
* Remembers the last two rows of digits so their characters need not be reread.
|
|
839
|
+
* Positions start at -1 until a row has been found.
|
|
840
|
+
*
|
|
841
|
+
* @typedef {object} DigitRunCache
|
|
842
|
+
* @property {number} start The first character of the most recently found row.
|
|
843
|
+
* @property {number} end The position after that row's last character.
|
|
844
|
+
* @property {number} previousStart The first character of the previous row.
|
|
845
|
+
* @property {number} previousEnd The position after the previous row.
|
|
846
|
+
*/
|
|
847
|
+
const whitespace = /* @__PURE__ */ new Uint8Array(65536);
|
|
848
|
+
for (const char of WHITESPACE_CHARACTERS) whitespace[char.charCodeAt(0)] = 1;
|
|
849
|
+
/**
|
|
850
|
+
* Checks whether a character is whitespace, like a space, tab, or newline.
|
|
851
|
+
* Looking past the end of the string returns false.
|
|
852
|
+
*
|
|
853
|
+
* @param {string|undefined} char One character, or undefined past the string's end.
|
|
854
|
+
* @returns {boolean} Whether the character is whitespace.
|
|
855
|
+
* @example isWhitespace(' ') // true
|
|
856
|
+
* @example isWhitespace('1') // false
|
|
857
|
+
*/
|
|
858
|
+
const isWhitespace = (char) => char !== void 0 && whitespace[char.charCodeAt(0)] === 1;
|
|
859
|
+
/**
|
|
860
|
+
* Checks for v, =, or whitespace before the version number.
|
|
861
|
+
* These are historical version prefixes, not range operators:
|
|
862
|
+
* < and > are handled separately, as are tilde and caret ranges.
|
|
863
|
+
*
|
|
864
|
+
* @param {string|undefined} char One character to check.
|
|
865
|
+
* @returns {boolean} Whether the character can belong to a version prefix.
|
|
866
|
+
* @example isVersionPrefix('=') // true
|
|
867
|
+
* @example isVersionPrefix('>') // false
|
|
868
|
+
*/
|
|
869
|
+
const isVersionPrefix = (char) => char === "v" || char === "=" || isWhitespace(char);
|
|
870
|
+
/**
|
|
871
|
+
* Checks whether a character is one of the digits 0 through 9.
|
|
872
|
+
*
|
|
873
|
+
* @param {string|undefined} char One character to check.
|
|
874
|
+
* @returns {boolean} Whether the character is an ASCII digit.
|
|
875
|
+
* @example isDigit('7') // true
|
|
876
|
+
* @example isDigit('.') // false
|
|
877
|
+
*/
|
|
878
|
+
const isDigit = (char) => char !== void 0 && char >= "0" && char <= "9";
|
|
879
|
+
/**
|
|
880
|
+
* Checks whether a character is an English letter, uppercase or lowercase.
|
|
881
|
+
*
|
|
882
|
+
* @param {string|undefined} char One character to check.
|
|
883
|
+
* @returns {boolean} Whether the character is an ASCII letter.
|
|
884
|
+
* @example isLetter('b') // true
|
|
885
|
+
* @example isLetter('7') // false
|
|
886
|
+
*/
|
|
887
|
+
const isLetter = (char) => char !== void 0 && (char >= "a" && char <= "z" || char >= "A" && char <= "Z");
|
|
888
|
+
/**
|
|
889
|
+
* Checks for a letter, digit, or hyphen: the characters allowed inside
|
|
890
|
+
* prerelease and build names such as beta-1.
|
|
891
|
+
*
|
|
892
|
+
* @param {string|undefined} char One character to check.
|
|
893
|
+
* @returns {boolean} Whether the character can be part of an identifier.
|
|
894
|
+
* @example isIdentifierCharacter('-') // true
|
|
895
|
+
* @example isIdentifierCharacter('.') // false; dots separate identifiers
|
|
896
|
+
*/
|
|
897
|
+
const isIdentifierCharacter = (char) => isDigit(char) || isLetter(char) || char === "-";
|
|
898
|
+
/**
|
|
899
|
+
* Checks whether a version component can begin here: with a digit or
|
|
900
|
+
* a wildcard such as x, X, or *.
|
|
901
|
+
*
|
|
902
|
+
* @param {string|undefined} char One character to check.
|
|
903
|
+
* @returns {boolean} Whether a number or wildcard can start with this character.
|
|
904
|
+
* @example isVersionStart('x') // true
|
|
905
|
+
* @example isVersionStart('v') // false; v belongs to the prefix
|
|
906
|
+
*/
|
|
907
|
+
const isVersionStart = (char) => isDigit(char) || char === "x" || char === "X" || char === "*";
|
|
908
|
+
/**
|
|
909
|
+
* Finds the end of a row of digits, but returns no more than limit digits.
|
|
910
|
+
* Remembers the last two rows so looking at them again does not reread them.
|
|
911
|
+
*
|
|
912
|
+
* @param {string} range The text to read; it is not changed.
|
|
913
|
+
* @param {number} start The position of the first character to check.
|
|
914
|
+
* @param {number} limit The most digit characters the returned match can include.
|
|
915
|
+
* @param {DigitRunCache} digitRuns Shared cache of digit-run positions, updated in place.
|
|
916
|
+
* @returns {number} The position after the matched digits, or start if none match.
|
|
917
|
+
* @example findDigitsEndIndex('123abc', 0, 10, digitRuns) // 3, pointing at a
|
|
918
|
+
* @example findDigitsEndIndex('123abc', 0, 2, digitRuns) // 2, pointing at the unread 3
|
|
919
|
+
*/
|
|
920
|
+
const findDigitsEndIndex = (range, start, limit, digitRuns) => {
|
|
921
|
+
if (!isDigit(range[start])) return start;
|
|
922
|
+
if (start >= digitRuns.start && start < digitRuns.end) return Math.min(start + limit, digitRuns.end);
|
|
923
|
+
if (start >= digitRuns.previousStart && start < digitRuns.previousEnd) return Math.min(start + limit, digitRuns.previousEnd);
|
|
924
|
+
let end = start + 1;
|
|
925
|
+
while (isDigit(range[end])) end++;
|
|
926
|
+
digitRuns.previousStart = digitRuns.start;
|
|
927
|
+
digitRuns.previousEnd = digitRuns.end;
|
|
928
|
+
digitRuns.start = start;
|
|
929
|
+
digitRuns.end = end;
|
|
930
|
+
return Math.min(start + limit, end);
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* Reads a number using the old regex's length and leading-zero rules.
|
|
934
|
+
* Strict mode reads just the first zero in 012; loose mode can read all three.
|
|
935
|
+
*
|
|
936
|
+
* @param {string} range The text to read; it is not changed.
|
|
937
|
+
* @param {number} start The position where the number should begin.
|
|
938
|
+
* @param {boolean} loose Whether to allow leading zeros.
|
|
939
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
940
|
+
* @returns {number} The position after the matched digits, not their numeric value.
|
|
941
|
+
* @example findVersionNumberEndIndex('012', 0, false, digitRuns) // 1
|
|
942
|
+
* @example findVersionNumberEndIndex('012', 0, true, digitRuns) // 3
|
|
943
|
+
*/
|
|
944
|
+
const findVersionNumberEndIndex = (range, start, loose, digitRuns) => {
|
|
945
|
+
if (!loose && range[start] === "0") return start + 1;
|
|
946
|
+
return findDigitsEndIndex(range, start, loose ? MAX_LENGTH : MAX_LENGTH + 1, digitRuns);
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Reads one piece of a prerelease name, such as beta or 1 in beta.1.
|
|
950
|
+
* Tries the letter-or-hyphen form first, then the number-only form.
|
|
951
|
+
*
|
|
952
|
+
* @param {string} range The text to read; it is not changed.
|
|
953
|
+
* @param {number} start The position where the identifier should begin.
|
|
954
|
+
* @param {boolean} loose Whether numeric identifiers may have leading zeros.
|
|
955
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
956
|
+
* @returns {number} The position after the identifier, or start if none matches.
|
|
957
|
+
* @example findPrereleaseIdentifierEndIndex('beta.1', 0, false, digitRuns) // 4, at the dot
|
|
958
|
+
* @example findPrereleaseIdentifierEndIndex('001beta', 0, false, digitRuns) // 7
|
|
959
|
+
*/
|
|
960
|
+
const findPrereleaseIdentifierEndIndex = (range, start, loose, digitRuns) => {
|
|
961
|
+
const digitsEnd = findDigitsEndIndex(range, start, MAX_LENGTH, digitRuns);
|
|
962
|
+
if (isLetter(range[digitsEnd]) || range[digitsEnd] === "-") {
|
|
963
|
+
let end = digitsEnd + 1;
|
|
964
|
+
const limit = end + MAX_SAFE_BUILD_LENGTH;
|
|
965
|
+
while (end < limit && isIdentifierCharacter(range[end])) end++;
|
|
966
|
+
return end;
|
|
967
|
+
}
|
|
968
|
+
return findVersionNumberEndIndex(range, start, loose, digitRuns);
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Reads a prerelease suffix such as -beta.1, one dot-separated piece at a time.
|
|
972
|
+
* Loose mode also allows the name without its opening hyphen.
|
|
973
|
+
*
|
|
974
|
+
* @param {string} range The text to read; it is not changed.
|
|
975
|
+
* @param {number} start The position where the suffix should begin, including -.
|
|
976
|
+
* @param {boolean} loose Whether the opening hyphen is optional and zeros allowed.
|
|
977
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
978
|
+
* @returns {number} The position after the matched suffix, or start if absent.
|
|
979
|
+
* @example findPrereleaseEndIndex('-beta.1+sha', 0, false, digitRuns) // 7, at the plus
|
|
980
|
+
* @example findPrereleaseEndIndex('beta', 0, false, digitRuns) // 0; no opening hyphen
|
|
981
|
+
*/
|
|
982
|
+
const findPrereleaseEndIndex = (range, start, loose, digitRuns) => {
|
|
983
|
+
const hyphen = range[start] === "-";
|
|
984
|
+
if (!loose && !hyphen) return start;
|
|
985
|
+
const identifierStart = start + (hyphen ? 1 : 0);
|
|
986
|
+
let end = findPrereleaseIdentifierEndIndex(range, identifierStart, loose, digitRuns);
|
|
987
|
+
if (end === identifierStart) {
|
|
988
|
+
if (!loose || !hyphen) return start;
|
|
989
|
+
end = findPrereleaseIdentifierEndIndex(range, start, loose, digitRuns);
|
|
990
|
+
}
|
|
991
|
+
while (range[end] === ".") {
|
|
992
|
+
const next = findPrereleaseIdentifierEndIndex(range, end + 1, loose, digitRuns);
|
|
993
|
+
if (next === end + 1) break;
|
|
994
|
+
end = next;
|
|
995
|
+
}
|
|
996
|
+
return end;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Reads one build-name piece, such as sha or 123 in +sha.123.
|
|
1000
|
+
* Stops at a disallowed character or the old regex's length limit.
|
|
1001
|
+
*
|
|
1002
|
+
* @param {string} range The text to read; it is not changed.
|
|
1003
|
+
* @param {number} start The position where the identifier should begin.
|
|
1004
|
+
* @returns {number} The position after the identifier, or start if none matches.
|
|
1005
|
+
* @example findBuildIdentifierEndIndex('sha.123', 0) // 3, at the dot
|
|
1006
|
+
* @example findBuildIdentifierEndIndex('001', 0) // 3; leading zeros are allowed
|
|
1007
|
+
*/
|
|
1008
|
+
const findBuildIdentifierEndIndex = (range, start) => {
|
|
1009
|
+
let end = start;
|
|
1010
|
+
while (end - start < MAX_SAFE_BUILD_LENGTH && isIdentifierCharacter(range[end])) end++;
|
|
1011
|
+
return end;
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* Reads optional build metadata such as +sha.123.
|
|
1015
|
+
* Leaves the position unchanged if there is no plus sign followed by a name.
|
|
1016
|
+
*
|
|
1017
|
+
* @param {string} range The text to read; it is not changed.
|
|
1018
|
+
* @param {number} start The position where the opening + should be.
|
|
1019
|
+
* @returns {number} The position after the matched metadata, or start if absent.
|
|
1020
|
+
* @example findBuildEndIndex('+sha.123 <2', 0) // 8, at the space
|
|
1021
|
+
* @example findBuildEndIndex('+', 0) // 0; a plus sign alone is not a match
|
|
1022
|
+
*/
|
|
1023
|
+
const findBuildEndIndex = (range, start) => {
|
|
1024
|
+
if (range[start] !== "+") return start;
|
|
1025
|
+
let end = findBuildIdentifierEndIndex(range, start + 1);
|
|
1026
|
+
if (end === start + 1) return start;
|
|
1027
|
+
while (range[end] === ".") {
|
|
1028
|
+
const next = findBuildIdentifierEndIndex(range, end + 1);
|
|
1029
|
+
if (next === end + 1) break;
|
|
1030
|
+
end = next;
|
|
1031
|
+
}
|
|
1032
|
+
return end;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* Reads three numbers separated by dots, then any prerelease and build suffixes.
|
|
1036
|
+
* Uses loose rules, so forms such as 01.02.03beta can match here.
|
|
1037
|
+
*
|
|
1038
|
+
* @param {string} range The text to read; it is not changed.
|
|
1039
|
+
* @param {number} start The position of the first number, after any prefix.
|
|
1040
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1041
|
+
* @returns {number} The position after the version match, or start if none matches.
|
|
1042
|
+
* @example findLooseFullVersionEndIndex('1.2.3-beta+sha <2', 0, digitRuns) // 14
|
|
1043
|
+
* @example findLooseFullVersionEndIndex('1.2', 0, digitRuns) // 0; needs three numbers
|
|
1044
|
+
*/
|
|
1045
|
+
const findLooseFullVersionEndIndex = (range, start, digitRuns) => {
|
|
1046
|
+
let end = start;
|
|
1047
|
+
for (let component = 0; component < 3; component++) {
|
|
1048
|
+
const next = findVersionNumberEndIndex(range, end, true, digitRuns);
|
|
1049
|
+
if (next === end) return start;
|
|
1050
|
+
end = next;
|
|
1051
|
+
if (component < 2) {
|
|
1052
|
+
if (range[end] !== ".") return start;
|
|
1053
|
+
end++;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
const prereleaseEnd = findPrereleaseEndIndex(range, end, true, digitRuns);
|
|
1057
|
+
return findBuildEndIndex(range, prereleaseEnd);
|
|
1058
|
+
};
|
|
1059
|
+
/**
|
|
1060
|
+
* Reads one component of a partial or wildcard version, such as 2 or x in 2.x.
|
|
1061
|
+
* Numbers use strict leading-zero rules; wildcards take up one character.
|
|
1062
|
+
*
|
|
1063
|
+
* @param {string} range The text to read; it is not changed.
|
|
1064
|
+
* @param {number} start The position where the component should begin.
|
|
1065
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1066
|
+
* @returns {number} The position after the component, or start if none matches.
|
|
1067
|
+
* @example findPartialVersionComponentEndIndex('2.x', 0, digitRuns) // 1, at the dot
|
|
1068
|
+
* @example findPartialVersionComponentEndIndex('2.x', 2, digitRuns) // 3, after x
|
|
1069
|
+
*/
|
|
1070
|
+
const findPartialVersionComponentEndIndex = (range, start, digitRuns) => {
|
|
1071
|
+
if (isDigit(range[start])) return findVersionNumberEndIndex(range, start, false, digitRuns);
|
|
1072
|
+
return isVersionStart(range[start]) ? start + 1 : start;
|
|
1073
|
+
};
|
|
1074
|
+
/**
|
|
1075
|
+
* Reads up to three components, allowing forms such as 1, 1.2, or 1.x.
|
|
1076
|
+
* After the third component, also reads any strict prerelease and build suffixes.
|
|
1077
|
+
*
|
|
1078
|
+
* @param {string} range The text to read; it is not changed.
|
|
1079
|
+
* @param {number} start The position of a number or wildcard, after any prefix.
|
|
1080
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1081
|
+
* @returns {number} The position after the matched version text.
|
|
1082
|
+
* @example findPartialVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
|
|
1083
|
+
* @example findPartialVersionEndIndex('1.', 0, digitRuns) // 1; the trailing dot is unread
|
|
1084
|
+
*/
|
|
1085
|
+
const findPartialVersionEndIndex = (range, start, digitRuns) => {
|
|
1086
|
+
let end = findPartialVersionComponentEndIndex(range, start, digitRuns);
|
|
1087
|
+
for (let component = 0; component < 2; component++) {
|
|
1088
|
+
if (range[end] !== ".") return end;
|
|
1089
|
+
const next = findPartialVersionComponentEndIndex(range, end + 1, digitRuns);
|
|
1090
|
+
if (next === end + 1) return end;
|
|
1091
|
+
end = next;
|
|
1092
|
+
}
|
|
1093
|
+
const prereleaseEnd = findPrereleaseEndIndex(range, end, false, digitRuns);
|
|
1094
|
+
return findBuildEndIndex(range, prereleaseEnd);
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* Finds where a version match ends, without deciding whether the range is valid.
|
|
1098
|
+
* Tries a loose full version first, then a partial or wildcard version, just
|
|
1099
|
+
* like the old regex's LOOSEPLAIN and XRANGEPLAIN alternatives.
|
|
1100
|
+
*
|
|
1101
|
+
* @param {string} range The text to read; it is not changed.
|
|
1102
|
+
* @param {number} start The position of a number or wildcard, after any prefix.
|
|
1103
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1104
|
+
* @returns {number} The position where scanning the next candidate can resume.
|
|
1105
|
+
* @example findVersionEndIndex('1.2.3 <2', 0, digitRuns) // 5, at the space
|
|
1106
|
+
* @example findVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
|
|
1107
|
+
*/
|
|
1108
|
+
const findVersionEndIndex = (range, start, digitRuns) => {
|
|
1109
|
+
const fullVersionEnd = findLooseFullVersionEndIndex(range, start, digitRuns);
|
|
1110
|
+
return fullVersionEnd !== start ? fullVersionEnd : findPartialVersionEndIndex(range, start, digitRuns);
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* Finds the one whitespace character the old replacement would remove.
|
|
1114
|
+
* Keeps leading whitespace, skips an optional operator, and checks immediately
|
|
1115
|
+
* after it. Returns -1 if there is nothing to remove.
|
|
1116
|
+
*
|
|
1117
|
+
* @param {string} range The text containing a candidate already found by the caller.
|
|
1118
|
+
* @param {number} matchStart The candidate's position, including leading whitespace.
|
|
1119
|
+
* @returns {number} The position of the removable whitespace, or -1 if absent.
|
|
1120
|
+
* @example findRemovableWhitespaceIndex(' > 1', 0) // 2; keep the space at position 0
|
|
1121
|
+
* @example findRemovableWhitespaceIndex('>1', 0) // -1
|
|
1122
|
+
*/
|
|
1123
|
+
const findRemovableWhitespaceIndex = (range, matchStart) => {
|
|
1124
|
+
let position = matchStart;
|
|
1125
|
+
if (isWhitespace(range[position])) position++;
|
|
1126
|
+
if (range[position] === "<" || range[position] === ">") position++;
|
|
1127
|
+
if (range[position] === "=") position++;
|
|
1128
|
+
return isWhitespace(range[position]) ? position : -1;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* Joins an operator to its version, turning > 1.2.3 into >1.2.3.
|
|
1132
|
+
* Copies everything else according to the old regex's matching rules.
|
|
1133
|
+
* Moves forward through prefixes and whole versions to avoid repeatedly
|
|
1134
|
+
* searching the same characters on long inputs.
|
|
1135
|
+
*
|
|
1136
|
+
* @param {string} range The range text to process; the original string is unchanged.
|
|
1137
|
+
* @returns {string} The range with matched operator whitespace removed.
|
|
1138
|
+
* @example trimComparatorWhitespace('> 1.2.3 < 2') // '>1.2.3 <2'
|
|
1139
|
+
* @example trimComparatorWhitespace('> invalid') // '> invalid'
|
|
1140
|
+
*/
|
|
1141
|
+
const trimComparatorWhitespace = (range) => {
|
|
1142
|
+
let result = "";
|
|
1143
|
+
let copyFrom = 0;
|
|
1144
|
+
let cursor = 0;
|
|
1145
|
+
const digitRuns = {
|
|
1146
|
+
start: -1,
|
|
1147
|
+
end: -1,
|
|
1148
|
+
previousStart: -1,
|
|
1149
|
+
previousEnd: -1
|
|
1150
|
+
};
|
|
1151
|
+
while (cursor < range.length) {
|
|
1152
|
+
const matchStart = cursor;
|
|
1153
|
+
if (range[cursor] === "<" || range[cursor] === ">") cursor++;
|
|
1154
|
+
else if (!isVersionPrefix(range[cursor]) && !isVersionStart(range[cursor])) {
|
|
1155
|
+
cursor++;
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
while (cursor < range.length && isVersionPrefix(range[cursor])) cursor++;
|
|
1159
|
+
if (!isVersionStart(range[cursor])) continue;
|
|
1160
|
+
const whitespacePosition = findRemovableWhitespaceIndex(range, matchStart);
|
|
1161
|
+
if (whitespacePosition !== -1) {
|
|
1162
|
+
result += range.slice(copyFrom, whitespacePosition);
|
|
1163
|
+
copyFrom = whitespacePosition + 1;
|
|
1164
|
+
}
|
|
1165
|
+
cursor = findVersionEndIndex(range, cursor, digitRuns);
|
|
1166
|
+
}
|
|
1167
|
+
return result + range.slice(copyFrom);
|
|
1168
|
+
};
|
|
1169
|
+
module.exports = trimComparatorWhitespace;
|
|
1170
|
+
}));
|
|
1171
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/range.js
|
|
1172
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1173
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
1174
|
+
module.exports = class Range {
|
|
1175
|
+
constructor(range, options) {
|
|
1176
|
+
options = parseOptions(options);
|
|
1177
|
+
if (range instanceof Range) {
|
|
1178
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
1179
|
+
else return new Range(range.raw, options);
|
|
1180
|
+
}
|
|
1181
|
+
if (range instanceof Comparator) {
|
|
1182
|
+
this.raw = range.value;
|
|
1183
|
+
this.set = [[range]];
|
|
1184
|
+
this.formatted = void 0;
|
|
1185
|
+
return this;
|
|
1186
|
+
}
|
|
1187
|
+
this.options = options;
|
|
1188
|
+
this.loose = !!options.loose;
|
|
1189
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1190
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1191
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1192
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1193
|
+
if (this.set.length > 1) {
|
|
1194
|
+
const first = this.set[0];
|
|
1195
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1196
|
+
if (this.set.length === 0) this.set = [first];
|
|
1197
|
+
else if (this.set.length > 1) {
|
|
1198
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
1199
|
+
this.set = [c];
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
this.formatted = void 0;
|
|
1205
|
+
}
|
|
1206
|
+
get range() {
|
|
1207
|
+
if (this.formatted === void 0) {
|
|
1208
|
+
this.formatted = "";
|
|
1209
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1210
|
+
if (i > 0) this.formatted += "||";
|
|
1211
|
+
const comps = this.set[i];
|
|
1212
|
+
for (let k = 0; k < comps.length; k++) {
|
|
1213
|
+
if (k > 0) this.formatted += " ";
|
|
1214
|
+
this.formatted += comps[k].toString().trim();
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return this.formatted;
|
|
1219
|
+
}
|
|
1220
|
+
format() {
|
|
1221
|
+
return this.range;
|
|
1222
|
+
}
|
|
1223
|
+
toString() {
|
|
1224
|
+
return this.range;
|
|
1225
|
+
}
|
|
1226
|
+
parseRange(range) {
|
|
1227
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
1228
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
1229
|
+
const cached = cache.get(memoKey);
|
|
1230
|
+
if (cached) return cached;
|
|
1231
|
+
const loose = this.options.loose;
|
|
1232
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1233
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1234
|
+
debug("hyphen replace", range);
|
|
1235
|
+
range = trimComparatorWhitespace(range);
|
|
1236
|
+
debug("comparator trim", range);
|
|
1237
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1238
|
+
debug("tilde trim", range);
|
|
1239
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1240
|
+
debug("caret trim", range);
|
|
1241
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1242
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
1243
|
+
debug("loose invalid filter", comp, this.options);
|
|
1244
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1245
|
+
});
|
|
1246
|
+
debug("range list", rangeList);
|
|
1247
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1248
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1249
|
+
for (const comp of comparators) {
|
|
1250
|
+
if (isNullSet(comp)) return [comp];
|
|
1251
|
+
rangeMap.set(comp.value, comp);
|
|
1252
|
+
}
|
|
1253
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
1254
|
+
const result = [...rangeMap.values()];
|
|
1255
|
+
cache.set(memoKey, result);
|
|
1256
|
+
return result;
|
|
1257
|
+
}
|
|
1258
|
+
intersects(range, options) {
|
|
1259
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
1260
|
+
return this.set.some((thisComparators) => {
|
|
1261
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1262
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1263
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1264
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
});
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
test(version) {
|
|
1271
|
+
if (!version) return false;
|
|
1272
|
+
if (typeof version === "string") try {
|
|
1273
|
+
version = new SemVer(version, this.options);
|
|
1274
|
+
} catch (er) {
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
const cache = new (require_lrucache())();
|
|
1282
|
+
const parseOptions = require_parse_options();
|
|
1283
|
+
const Comparator = require_comparator();
|
|
1284
|
+
const debug = require_debug();
|
|
1285
|
+
const SemVer = require_semver$1();
|
|
1286
|
+
const trimComparatorWhitespace = require_trim_comparator_whitespace();
|
|
1287
|
+
const { safeRe: re, src, t, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
1288
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1289
|
+
const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
1290
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1291
|
+
const isAny = (c) => c.value === "";
|
|
1292
|
+
const isSatisfiable = (comparators, options) => {
|
|
1293
|
+
let result = true;
|
|
1294
|
+
const remainingComparators = comparators.slice();
|
|
1295
|
+
let testComparator = remainingComparators.pop();
|
|
1296
|
+
while (result && remainingComparators.length) {
|
|
1297
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1298
|
+
return testComparator.intersects(otherComparator, options);
|
|
1299
|
+
});
|
|
1300
|
+
testComparator = remainingComparators.pop();
|
|
1301
|
+
}
|
|
1302
|
+
return result;
|
|
1303
|
+
};
|
|
1304
|
+
const parseComparator = (comp, options) => {
|
|
1305
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
1306
|
+
debug("comp", comp, options);
|
|
1307
|
+
comp = replaceCarets(comp, options);
|
|
1308
|
+
debug("caret", comp);
|
|
1309
|
+
comp = replaceTildes(comp, options);
|
|
1310
|
+
debug("tildes", comp);
|
|
1311
|
+
comp = replaceXRanges(comp, options);
|
|
1312
|
+
debug("xrange", comp);
|
|
1313
|
+
comp = replaceStars(comp, options);
|
|
1314
|
+
debug("stars", comp);
|
|
1315
|
+
return comp;
|
|
1316
|
+
};
|
|
1317
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1318
|
+
const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
1319
|
+
const replaceTildes = (comp, options) => {
|
|
1320
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1321
|
+
};
|
|
1322
|
+
const replaceTilde = (comp, options) => {
|
|
1323
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1324
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1325
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1326
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
1327
|
+
let ret;
|
|
1328
|
+
if (isX(M)) ret = "";
|
|
1329
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1330
|
+
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1331
|
+
else if (pr) {
|
|
1332
|
+
debug("replaceTilde pr", pr);
|
|
1333
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1334
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1335
|
+
debug("tilde return", ret);
|
|
1336
|
+
return ret;
|
|
1337
|
+
});
|
|
1338
|
+
};
|
|
1339
|
+
const replaceCarets = (comp, options) => {
|
|
1340
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1341
|
+
};
|
|
1342
|
+
const replaceCaret = (comp, options) => {
|
|
1343
|
+
debug("caret", comp, options);
|
|
1344
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1345
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1346
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1347
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1348
|
+
let ret;
|
|
1349
|
+
if (isX(M)) ret = "";
|
|
1350
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1351
|
+
else if (isX(p)) {
|
|
1352
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1353
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1354
|
+
} else if (pr) {
|
|
1355
|
+
debug("replaceCaret pr", pr);
|
|
1356
|
+
if (M === "0") {
|
|
1357
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1358
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1359
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1360
|
+
} else {
|
|
1361
|
+
debug("no pr");
|
|
1362
|
+
if (M === "0") {
|
|
1363
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
1364
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1365
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1366
|
+
}
|
|
1367
|
+
debug("caret return", ret);
|
|
1368
|
+
return ret;
|
|
1369
|
+
});
|
|
1370
|
+
};
|
|
1371
|
+
const replaceXRanges = (comp, options) => {
|
|
1372
|
+
debug("replaceXRanges", comp, options);
|
|
1373
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1374
|
+
};
|
|
1375
|
+
const replaceXRange = (comp, options) => {
|
|
1376
|
+
comp = comp.trim();
|
|
1377
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1378
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1379
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1380
|
+
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
1381
|
+
const xM = isX(M);
|
|
1382
|
+
const xm = xM || isX(m);
|
|
1383
|
+
const xp = xm || isX(p);
|
|
1384
|
+
const anyX = xp;
|
|
1385
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
1386
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1387
|
+
if (xM) {
|
|
1388
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
1389
|
+
else ret = "*";
|
|
1390
|
+
} else if (gtlt && anyX) {
|
|
1391
|
+
if (xm) m = 0;
|
|
1392
|
+
p = 0;
|
|
1393
|
+
if (gtlt === ">") {
|
|
1394
|
+
gtlt = ">=";
|
|
1395
|
+
if (xm) {
|
|
1396
|
+
M = +M + 1;
|
|
1397
|
+
m = 0;
|
|
1398
|
+
p = 0;
|
|
1399
|
+
} else {
|
|
1400
|
+
m = +m + 1;
|
|
1401
|
+
p = 0;
|
|
1402
|
+
}
|
|
1403
|
+
} else if (gtlt === "<=") {
|
|
1404
|
+
gtlt = "<";
|
|
1405
|
+
if (xm) M = +M + 1;
|
|
1406
|
+
else m = +m + 1;
|
|
1407
|
+
}
|
|
1408
|
+
if (gtlt === "<") pr = "-0";
|
|
1409
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1410
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1411
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1412
|
+
debug("xRange return", ret);
|
|
1413
|
+
return ret;
|
|
1414
|
+
});
|
|
1415
|
+
};
|
|
1416
|
+
const replaceStars = (comp, options) => {
|
|
1417
|
+
debug("replaceStars", comp, options);
|
|
1418
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1419
|
+
};
|
|
1420
|
+
const replaceGTE0 = (comp, options) => {
|
|
1421
|
+
debug("replaceGTE0", comp, options);
|
|
1422
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1423
|
+
};
|
|
1424
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1425
|
+
if (isX(fM)) from = "";
|
|
1426
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1427
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1428
|
+
else if (fpr) from = `>=${from}`;
|
|
1429
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1430
|
+
if (isX(tM)) to = "";
|
|
1431
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
1432
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
1433
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1434
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1435
|
+
else to = `<=${to}`;
|
|
1436
|
+
return `${from} ${to}`.trim();
|
|
1437
|
+
};
|
|
1438
|
+
const testSet = (set, version, options) => {
|
|
1439
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
1440
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1441
|
+
for (let i = 0; i < set.length; i++) {
|
|
1442
|
+
debug(set[i].semver);
|
|
1443
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
1444
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1445
|
+
const allowed = set[i].semver;
|
|
1446
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
return false;
|
|
1450
|
+
}
|
|
1451
|
+
return true;
|
|
1452
|
+
};
|
|
1453
|
+
}));
|
|
1454
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/comparator.js
|
|
1455
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1456
|
+
const ANY = Symbol("SemVer ANY");
|
|
1457
|
+
module.exports = class Comparator {
|
|
1458
|
+
static get ANY() {
|
|
1459
|
+
return ANY;
|
|
1460
|
+
}
|
|
1461
|
+
constructor(comp, options) {
|
|
1462
|
+
options = parseOptions(options);
|
|
1463
|
+
if (comp instanceof Comparator) {
|
|
1464
|
+
if (comp.loose === !!options.loose) return comp;
|
|
1465
|
+
else comp = comp.value;
|
|
1466
|
+
}
|
|
1467
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1468
|
+
debug("comparator", comp, options);
|
|
1469
|
+
this.options = options;
|
|
1470
|
+
this.loose = !!options.loose;
|
|
1471
|
+
this.parse(comp);
|
|
1472
|
+
if (this.semver === ANY) this.value = "";
|
|
1473
|
+
else this.value = this.operator + this.semver.version;
|
|
1474
|
+
debug("comp", this);
|
|
1475
|
+
}
|
|
1476
|
+
parse(comp) {
|
|
1477
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1478
|
+
const m = comp.match(r);
|
|
1479
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1480
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1481
|
+
if (this.operator === "=") this.operator = "";
|
|
1482
|
+
if (!m[2]) this.semver = ANY;
|
|
1483
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
1484
|
+
}
|
|
1485
|
+
toString() {
|
|
1486
|
+
return this.value;
|
|
1487
|
+
}
|
|
1488
|
+
test(version) {
|
|
1489
|
+
debug("Comparator.test", version, this.options.loose);
|
|
1490
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
1491
|
+
if (typeof version === "string") try {
|
|
1492
|
+
version = new SemVer(version, this.options);
|
|
1493
|
+
} catch (er) {
|
|
1494
|
+
return false;
|
|
1495
|
+
}
|
|
1496
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
1497
|
+
}
|
|
1498
|
+
intersects(comp, options) {
|
|
1499
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
1500
|
+
if (this.operator === "") {
|
|
1501
|
+
if (this.value === "") return true;
|
|
1502
|
+
return new Range(comp.value, options).test(this.value);
|
|
1503
|
+
} else if (comp.operator === "") {
|
|
1504
|
+
if (comp.value === "") return true;
|
|
1505
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1506
|
+
}
|
|
1507
|
+
options = parseOptions(options);
|
|
1508
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
1509
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
1510
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
1511
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
1512
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
1513
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
1514
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
1515
|
+
return false;
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
const parseOptions = require_parse_options();
|
|
1519
|
+
const { safeRe: re, t } = require_re();
|
|
1520
|
+
const cmp = require_cmp();
|
|
1521
|
+
const debug = require_debug();
|
|
1522
|
+
const SemVer = require_semver$1();
|
|
1523
|
+
const Range = require_range();
|
|
1524
|
+
}));
|
|
1525
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/satisfies.js
|
|
1526
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1527
|
+
const Range = require_range();
|
|
1528
|
+
const satisfies = (version, range, options) => {
|
|
1529
|
+
try {
|
|
1530
|
+
range = new Range(range, options);
|
|
1531
|
+
} catch (er) {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
return range.test(version);
|
|
1535
|
+
};
|
|
1536
|
+
module.exports = satisfies;
|
|
1537
|
+
}));
|
|
1538
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/to-comparators.js
|
|
1539
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1540
|
+
const Range = require_range();
|
|
1541
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1542
|
+
module.exports = toComparators;
|
|
1543
|
+
}));
|
|
1544
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/max-satisfying.js
|
|
1545
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1546
|
+
const SemVer = require_semver$1();
|
|
1547
|
+
const Range = require_range();
|
|
1548
|
+
const maxSatisfying = (versions, range, options) => {
|
|
1549
|
+
let max = null;
|
|
1550
|
+
let maxSV = null;
|
|
1551
|
+
let rangeObj = null;
|
|
1552
|
+
try {
|
|
1553
|
+
rangeObj = new Range(range, options);
|
|
1554
|
+
} catch (er) {
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
versions.forEach((v) => {
|
|
1558
|
+
if (rangeObj.test(v)) {
|
|
1559
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1560
|
+
max = v;
|
|
1561
|
+
maxSV = new SemVer(max, options);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
return max;
|
|
1566
|
+
};
|
|
1567
|
+
module.exports = maxSatisfying;
|
|
1568
|
+
}));
|
|
1569
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-satisfying.js
|
|
1570
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1571
|
+
const SemVer = require_semver$1();
|
|
1572
|
+
const Range = require_range();
|
|
1573
|
+
const minSatisfying = (versions, range, options) => {
|
|
1574
|
+
let min = null;
|
|
1575
|
+
let minSV = null;
|
|
1576
|
+
let rangeObj = null;
|
|
1577
|
+
try {
|
|
1578
|
+
rangeObj = new Range(range, options);
|
|
1579
|
+
} catch (er) {
|
|
1580
|
+
return null;
|
|
1581
|
+
}
|
|
1582
|
+
versions.forEach((v) => {
|
|
1583
|
+
if (rangeObj.test(v)) {
|
|
1584
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1585
|
+
min = v;
|
|
1586
|
+
minSV = new SemVer(min, options);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
return min;
|
|
1591
|
+
};
|
|
1592
|
+
module.exports = minSatisfying;
|
|
1593
|
+
}));
|
|
1594
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-version.js
|
|
1595
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1596
|
+
const SemVer = require_semver$1();
|
|
1597
|
+
const Range = require_range();
|
|
1598
|
+
const gt = require_gt();
|
|
1599
|
+
const minVersion = (range, loose) => {
|
|
1600
|
+
range = new Range(range, loose);
|
|
1601
|
+
let minver = new SemVer("0.0.0");
|
|
1602
|
+
if (range.test(minver)) return minver;
|
|
1603
|
+
minver = new SemVer("0.0.0-0");
|
|
1604
|
+
if (range.test(minver)) return minver;
|
|
1605
|
+
minver = null;
|
|
1606
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1607
|
+
const comparators = range.set[i];
|
|
1608
|
+
let setMin = null;
|
|
1609
|
+
comparators.forEach((comparator) => {
|
|
1610
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1611
|
+
switch (comparator.operator) {
|
|
1612
|
+
case ">":
|
|
1613
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
1614
|
+
else compver.prerelease.push(0);
|
|
1615
|
+
compver.raw = compver.format();
|
|
1616
|
+
case "":
|
|
1617
|
+
case ">=":
|
|
1618
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
1619
|
+
break;
|
|
1620
|
+
case "<":
|
|
1621
|
+
case "<=": break;
|
|
1622
|
+
/* istanbul ignore next */
|
|
1623
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
1627
|
+
}
|
|
1628
|
+
if (minver && range.test(minver)) return minver;
|
|
1629
|
+
return null;
|
|
1630
|
+
};
|
|
1631
|
+
module.exports = minVersion;
|
|
1632
|
+
}));
|
|
1633
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/valid.js
|
|
1634
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1635
|
+
const Range = require_range();
|
|
1636
|
+
const validRange = (range, options) => {
|
|
1637
|
+
try {
|
|
1638
|
+
return new Range(range, options).range || "*";
|
|
1639
|
+
} catch (er) {
|
|
1640
|
+
return null;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
module.exports = validRange;
|
|
1644
|
+
}));
|
|
1645
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/outside.js
|
|
1646
|
+
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1647
|
+
const SemVer = require_semver$1();
|
|
1648
|
+
const Comparator = require_comparator();
|
|
1649
|
+
const { ANY } = Comparator;
|
|
1650
|
+
const Range = require_range();
|
|
1651
|
+
const satisfies = require_satisfies();
|
|
1652
|
+
const gt = require_gt();
|
|
1653
|
+
const lt = require_lt();
|
|
1654
|
+
const lte = require_lte();
|
|
1655
|
+
const gte = require_gte();
|
|
1656
|
+
const outside = (version, range, hilo, options) => {
|
|
1657
|
+
version = new SemVer(version, options);
|
|
1658
|
+
range = new Range(range, options);
|
|
1659
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1660
|
+
switch (hilo) {
|
|
1661
|
+
case ">":
|
|
1662
|
+
gtfn = gt;
|
|
1663
|
+
ltefn = lte;
|
|
1664
|
+
ltfn = lt;
|
|
1665
|
+
comp = ">";
|
|
1666
|
+
ecomp = ">=";
|
|
1667
|
+
break;
|
|
1668
|
+
case "<":
|
|
1669
|
+
gtfn = lt;
|
|
1670
|
+
ltefn = gte;
|
|
1671
|
+
ltfn = gt;
|
|
1672
|
+
comp = "<";
|
|
1673
|
+
ecomp = "<=";
|
|
1674
|
+
break;
|
|
1675
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
1676
|
+
}
|
|
1677
|
+
if (satisfies(version, range, options)) return false;
|
|
1678
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1679
|
+
const comparators = range.set[i];
|
|
1680
|
+
let high = null;
|
|
1681
|
+
let low = null;
|
|
1682
|
+
comparators.forEach((comparator) => {
|
|
1683
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
1684
|
+
high = high || comparator;
|
|
1685
|
+
low = low || comparator;
|
|
1686
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
1687
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
1688
|
+
});
|
|
1689
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
1690
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
1691
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
1692
|
+
}
|
|
1693
|
+
return true;
|
|
1694
|
+
};
|
|
1695
|
+
module.exports = outside;
|
|
1696
|
+
}));
|
|
1697
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/gtr.js
|
|
1698
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1699
|
+
const outside = require_outside();
|
|
1700
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1701
|
+
module.exports = gtr;
|
|
1702
|
+
}));
|
|
1703
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/ltr.js
|
|
1704
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1705
|
+
const outside = require_outside();
|
|
1706
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1707
|
+
module.exports = ltr;
|
|
1708
|
+
}));
|
|
1709
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/intersects.js
|
|
1710
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1711
|
+
const Range = require_range();
|
|
1712
|
+
const intersects = (r1, r2, options) => {
|
|
1713
|
+
r1 = new Range(r1, options);
|
|
1714
|
+
r2 = new Range(r2, options);
|
|
1715
|
+
return r1.intersects(r2, options);
|
|
1716
|
+
};
|
|
1717
|
+
module.exports = intersects;
|
|
1718
|
+
}));
|
|
1719
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/simplify.js
|
|
1720
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1721
|
+
const satisfies = require_satisfies();
|
|
1722
|
+
const compare = require_compare();
|
|
1723
|
+
module.exports = (versions, range, options) => {
|
|
1724
|
+
const set = [];
|
|
1725
|
+
let first = null;
|
|
1726
|
+
let prev = null;
|
|
1727
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
1728
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
1729
|
+
prev = version;
|
|
1730
|
+
if (!first) first = version;
|
|
1731
|
+
} else {
|
|
1732
|
+
if (prev) set.push([first, prev]);
|
|
1733
|
+
prev = null;
|
|
1734
|
+
first = null;
|
|
1735
|
+
}
|
|
1736
|
+
if (first) set.push([first, null]);
|
|
1737
|
+
const ranges = [];
|
|
1738
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
1739
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
1740
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
1741
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
1742
|
+
else ranges.push(`${min} - ${max}`);
|
|
1743
|
+
const simplified = ranges.join(" || ");
|
|
1744
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1745
|
+
return simplified.length < original.length ? simplified : range;
|
|
1746
|
+
};
|
|
1747
|
+
}));
|
|
1748
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/subset.js
|
|
1749
|
+
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1750
|
+
const Range = require_range();
|
|
1751
|
+
const Comparator = require_comparator();
|
|
1752
|
+
const { ANY } = Comparator;
|
|
1753
|
+
const satisfies = require_satisfies();
|
|
1754
|
+
const compare = require_compare();
|
|
1755
|
+
const subset = (sub, dom, options = {}) => {
|
|
1756
|
+
if (sub === dom) return true;
|
|
1757
|
+
sub = new Range(sub, options);
|
|
1758
|
+
dom = new Range(dom, options);
|
|
1759
|
+
let sawNonNull = false;
|
|
1760
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1761
|
+
for (const simpleDom of dom.set) {
|
|
1762
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1763
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1764
|
+
if (isSub) continue OUTER;
|
|
1765
|
+
}
|
|
1766
|
+
if (sawNonNull) return false;
|
|
1767
|
+
}
|
|
1768
|
+
return true;
|
|
1769
|
+
};
|
|
1770
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1771
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
1772
|
+
const simpleSubset = (sub, dom, options) => {
|
|
1773
|
+
if (sub === dom) return true;
|
|
1774
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1775
|
+
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
1776
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
1777
|
+
else sub = minimumVersion;
|
|
1778
|
+
}
|
|
1779
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1780
|
+
if (options.includePrerelease) return true;
|
|
1781
|
+
else dom = minimumVersion;
|
|
1782
|
+
}
|
|
1783
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1784
|
+
let gt, lt;
|
|
1785
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
1786
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
1787
|
+
else eqSet.add(c.semver);
|
|
1788
|
+
if (eqSet.size > 1) return null;
|
|
1789
|
+
let gtltComp;
|
|
1790
|
+
if (gt && lt) {
|
|
1791
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1792
|
+
if (gtltComp > 0) return null;
|
|
1793
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
1794
|
+
}
|
|
1795
|
+
for (const eq of eqSet) {
|
|
1796
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
1797
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
1798
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
1799
|
+
return true;
|
|
1800
|
+
}
|
|
1801
|
+
let higher, lower;
|
|
1802
|
+
let hasDomLT, hasDomGT;
|
|
1803
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1804
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1805
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
1806
|
+
for (const c of dom) {
|
|
1807
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1808
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1809
|
+
if (gt) {
|
|
1810
|
+
if (needDomGTPre) {
|
|
1811
|
+
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;
|
|
1812
|
+
}
|
|
1813
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1814
|
+
higher = higherGT(gt, c, options);
|
|
1815
|
+
if (higher === c && higher !== gt) return false;
|
|
1816
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
1817
|
+
}
|
|
1818
|
+
if (lt) {
|
|
1819
|
+
if (needDomLTPre) {
|
|
1820
|
+
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;
|
|
1821
|
+
}
|
|
1822
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1823
|
+
lower = lowerLT(lt, c, options);
|
|
1824
|
+
if (lower === c && lower !== lt) return false;
|
|
1825
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
1826
|
+
}
|
|
1827
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
1828
|
+
}
|
|
1829
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
1830
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
1831
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
1832
|
+
return true;
|
|
1833
|
+
};
|
|
1834
|
+
const higherGT = (a, b, options) => {
|
|
1835
|
+
if (!a) return b;
|
|
1836
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1837
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1838
|
+
};
|
|
1839
|
+
const lowerLT = (a, b, options) => {
|
|
1840
|
+
if (!a) return b;
|
|
1841
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1842
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1843
|
+
};
|
|
1844
|
+
module.exports = subset;
|
|
1845
|
+
}));
|
|
1846
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1847
|
+
const internalRe = require_re();
|
|
1848
|
+
const constants = require_constants();
|
|
1849
|
+
const SemVer = require_semver$1();
|
|
1850
|
+
const identifiers = require_identifiers();
|
|
1851
|
+
module.exports = {
|
|
1852
|
+
parse: require_parse(),
|
|
1853
|
+
valid: require_valid$1(),
|
|
1854
|
+
clean: require_clean(),
|
|
1855
|
+
inc: require_inc(),
|
|
1856
|
+
diff: require_diff(),
|
|
1857
|
+
major: require_major(),
|
|
1858
|
+
minor: require_minor(),
|
|
1859
|
+
patch: require_patch(),
|
|
1860
|
+
prerelease: require_prerelease(),
|
|
1861
|
+
compare: require_compare(),
|
|
1862
|
+
rcompare: require_rcompare(),
|
|
1863
|
+
compareLoose: require_compare_loose(),
|
|
1864
|
+
compareBuild: require_compare_build(),
|
|
1865
|
+
sort: require_sort(),
|
|
1866
|
+
rsort: require_rsort(),
|
|
1867
|
+
gt: require_gt(),
|
|
1868
|
+
lt: require_lt(),
|
|
1869
|
+
eq: require_eq(),
|
|
1870
|
+
neq: require_neq(),
|
|
1871
|
+
gte: require_gte(),
|
|
1872
|
+
lte: require_lte(),
|
|
1873
|
+
cmp: require_cmp(),
|
|
1874
|
+
coerce: require_coerce(),
|
|
1875
|
+
truncate: require_truncate(),
|
|
1876
|
+
Comparator: require_comparator(),
|
|
1877
|
+
Range: require_range(),
|
|
1878
|
+
satisfies: require_satisfies(),
|
|
1879
|
+
toComparators: require_to_comparators(),
|
|
1880
|
+
maxSatisfying: require_max_satisfying(),
|
|
1881
|
+
minSatisfying: require_min_satisfying(),
|
|
1882
|
+
minVersion: require_min_version(),
|
|
1883
|
+
validRange: require_valid(),
|
|
1884
|
+
outside: require_outside(),
|
|
1885
|
+
gtr: require_gtr(),
|
|
1886
|
+
ltr: require_ltr(),
|
|
1887
|
+
intersects: require_intersects(),
|
|
1888
|
+
simplifyRange: require_simplify(),
|
|
1889
|
+
subset: require_subset(),
|
|
1890
|
+
SemVer,
|
|
1891
|
+
re: internalRe.re,
|
|
1892
|
+
src: internalRe.src,
|
|
1893
|
+
tokens: internalRe.t,
|
|
1894
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1895
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1896
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1897
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1898
|
+
};
|
|
1899
|
+
})))();
|
|
174
1900
|
const AI_PLATFORMS = ["chatgpt", "claudeai"];
|
|
175
1901
|
const platformSchema = z.enum(AI_PLATFORMS);
|
|
176
1902
|
const PLATFORM_LABELS = {
|
|
@@ -183,7 +1909,11 @@ const WAF_PLATFORMS = [
|
|
|
183
1909
|
"cloudflare",
|
|
184
1910
|
"fastly"
|
|
185
1911
|
];
|
|
186
|
-
const ALLOWED_PLATFORMS = [...
|
|
1912
|
+
const ALLOWED_PLATFORMS = [...[
|
|
1913
|
+
...AI_PLATFORMS,
|
|
1914
|
+
"meta",
|
|
1915
|
+
"google"
|
|
1916
|
+
], ...WAF_PLATFORMS];
|
|
187
1917
|
const allowedPlatformSchema = z.enum(ALLOWED_PLATFORMS);
|
|
188
1918
|
const auditStatusSchema = z.enum([
|
|
189
1919
|
"pending",
|
|
@@ -336,7 +2066,8 @@ const standaloneEnvironmentSchema = z.object({
|
|
|
336
2066
|
const protectedWithoutDiscoveryEnvironmentSchema = z.object({
|
|
337
2067
|
allowsAnonymous: z.literal(false),
|
|
338
2068
|
oAuthMetadata: z.strictObject({}),
|
|
339
|
-
scope: z.string().optional()
|
|
2069
|
+
scope: z.string().optional(),
|
|
2070
|
+
wwwAuthenticate: z.string().optional()
|
|
340
2071
|
});
|
|
341
2072
|
const legacyPublicEnvironmentSchema = z.object({
|
|
342
2073
|
isPublic: z.literal(true),
|
|
@@ -381,10 +2112,13 @@ z.union([
|
|
|
381
2112
|
legacyProtectedWithoutDiscoveryEnvironmentSchema
|
|
382
2113
|
]);
|
|
383
2114
|
const playgroundModelSchema = z.enum([
|
|
2115
|
+
"global.anthropic.claude-haiku-5-5",
|
|
384
2116
|
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
385
|
-
"global.anthropic.claude-sonnet-
|
|
2117
|
+
"global.anthropic.claude-sonnet-5-5",
|
|
386
2118
|
"openai.gpt-5.4",
|
|
387
|
-
"openai.gpt-5.5"
|
|
2119
|
+
"openai.gpt-5.5",
|
|
2120
|
+
"openai.gpt-6-luna",
|
|
2121
|
+
"openai.gpt-6.1-sol"
|
|
388
2122
|
]);
|
|
389
2123
|
const environmentDomainSchema = z.object({
|
|
390
2124
|
name: z.string(),
|
|
@@ -420,7 +2154,8 @@ z.object({
|
|
|
420
2154
|
collectResponsePayload: z.boolean(),
|
|
421
2155
|
collectErrorMessage: z.boolean(),
|
|
422
2156
|
collectUserData: z.boolean(),
|
|
423
|
-
identityTraitKey: z.string().min(1).max(200).nullable()
|
|
2157
|
+
identityTraitKey: z.string().min(1).max(200).nullable(),
|
|
2158
|
+
leadEventName: z.string().min(1).max(200).nullable()
|
|
424
2159
|
});
|
|
425
2160
|
const feedbackSchema = z.object({
|
|
426
2161
|
id: z.string(),
|
|
@@ -539,6 +2274,14 @@ z.enum([
|
|
|
539
2274
|
"DEBUG",
|
|
540
2275
|
"ERROR"
|
|
541
2276
|
]);
|
|
2277
|
+
const LOG_SEARCH_MAX_ESCAPED_LENGTH = 960;
|
|
2278
|
+
function escapeLogSearchTerm(search) {
|
|
2279
|
+
return [...search].flatMap((character) => [...new TextEncoder().encode(character)]).map((byte) => {
|
|
2280
|
+
const character = String.fromCharCode(byte);
|
|
2281
|
+
return /^[a-zA-Z0-9]$/.test(character) ? character : `\\x${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
2282
|
+
}).join("");
|
|
2283
|
+
}
|
|
2284
|
+
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");
|
|
542
2285
|
/** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
|
|
543
2286
|
const MCP_CLIENT_GROUPS = [
|
|
544
2287
|
{
|
|
@@ -572,6 +2315,12 @@ const MCP_CLIENT_GROUPS = [
|
|
|
572
2315
|
vendor: "anthropic",
|
|
573
2316
|
rawNames: ["Anthropic/Cowork"]
|
|
574
2317
|
},
|
|
2318
|
+
{
|
|
2319
|
+
id: "claude_sheet_add_in",
|
|
2320
|
+
label: "Claude (Sheet Add-In)",
|
|
2321
|
+
vendor: "anthropic",
|
|
2322
|
+
rawNames: ["sheet-add-in"]
|
|
2323
|
+
},
|
|
575
2324
|
{
|
|
576
2325
|
id: "claude_toolbox",
|
|
577
2326
|
label: "Claude Toolbox",
|
|
@@ -606,7 +2355,7 @@ const MCP_CLIENT_GROUPS = [
|
|
|
606
2355
|
id: "chatgpt",
|
|
607
2356
|
label: "ChatGPT",
|
|
608
2357
|
vendor: "openai",
|
|
609
|
-
rawNames: ["openai-mcp (ChatGPT)"]
|
|
2358
|
+
rawNames: ["openai-mcp", "openai-mcp (ChatGPT)"]
|
|
610
2359
|
},
|
|
611
2360
|
{
|
|
612
2361
|
id: "openai_responses_api",
|
|
@@ -620,12 +2369,6 @@ const MCP_CLIENT_GROUPS = [
|
|
|
620
2369
|
vendor: "openai",
|
|
621
2370
|
rawNames: ["openai-mcp (Agent Builder)"]
|
|
622
2371
|
},
|
|
623
|
-
{
|
|
624
|
-
id: "openai_other",
|
|
625
|
-
label: "OpenAI Other",
|
|
626
|
-
vendor: "openai",
|
|
627
|
-
rawNames: ["openai-mcp"]
|
|
628
|
-
},
|
|
629
2372
|
{
|
|
630
2373
|
id: "cursor",
|
|
631
2374
|
label: "Cursor",
|
|
@@ -782,8 +2525,10 @@ new Map(MCP_CLIENT_GROUPS.map((group) => [group.id, group]));
|
|
|
782
2525
|
const runtimeSchema = z.enum([
|
|
783
2526
|
"python3.13",
|
|
784
2527
|
"python3.14",
|
|
2528
|
+
"python3.15",
|
|
785
2529
|
"node22",
|
|
786
|
-
"node24"
|
|
2530
|
+
"node24",
|
|
2531
|
+
"node26"
|
|
787
2532
|
]);
|
|
788
2533
|
const transportSchema = z.enum([
|
|
789
2534
|
"stdio",
|
|
@@ -864,6 +2609,10 @@ const clampStringField = (field) => {
|
|
|
864
2609
|
const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
|
|
865
2610
|
return field.description ? withMin.describe(field.description) : withMin;
|
|
866
2611
|
};
|
|
2612
|
+
const unboundedArrayField = (field) => {
|
|
2613
|
+
const unbounded = z.array(field.element);
|
|
2614
|
+
return field.description ? unbounded.describe(field.description) : unbounded;
|
|
2615
|
+
};
|
|
867
2616
|
const toolDefinitionSchema = z.object({
|
|
868
2617
|
name: z.string(),
|
|
869
2618
|
title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
|
|
@@ -876,11 +2625,22 @@ const toolDefinitionSchema = z.object({
|
|
|
876
2625
|
}).optional()
|
|
877
2626
|
});
|
|
878
2627
|
const positiveTestCaseSchema = z.object({
|
|
879
|
-
scenario: z.string().describe("Short label for what this case demonstrates."),
|
|
880
|
-
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."),
|
|
2628
|
+
scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
|
|
2629
|
+
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."),
|
|
881
2630
|
toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
|
|
882
2631
|
expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
|
|
883
|
-
}).
|
|
2632
|
+
}).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
|
|
2633
|
+
const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial().extend({
|
|
2634
|
+
scenario: z.string().optional(),
|
|
2635
|
+
userPrompt: z.string().optional()
|
|
2636
|
+
});
|
|
2637
|
+
const blankPositiveTestCase = () => ({
|
|
2638
|
+
scenario: "",
|
|
2639
|
+
userPrompt: "",
|
|
2640
|
+
toolTriggered: "",
|
|
2641
|
+
expectedOutput: ""
|
|
2642
|
+
});
|
|
2643
|
+
const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
|
|
884
2644
|
const screenshotEntrySchema = z.object({
|
|
885
2645
|
prompt: z.string(),
|
|
886
2646
|
url: z.url()
|
|
@@ -1193,9 +2953,18 @@ const chatgptTranslationLocaleSchema = z.enum([
|
|
|
1193
2953
|
"zh-TW"
|
|
1194
2954
|
]);
|
|
1195
2955
|
const negativeTestCaseSchema = z.object({
|
|
1196
|
-
scenario: z.string(),
|
|
1197
|
-
userPrompt: z.string()
|
|
1198
|
-
}).
|
|
2956
|
+
scenario: z.string().min(1),
|
|
2957
|
+
userPrompt: z.string().min(1)
|
|
2958
|
+
}).describe("Each case: Scenario + User prompt (the plugin should NOT trigger).");
|
|
2959
|
+
const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial().extend({
|
|
2960
|
+
scenario: z.string().optional(),
|
|
2961
|
+
userPrompt: z.string().optional()
|
|
2962
|
+
});
|
|
2963
|
+
const blankNegativeTestCase = () => ({
|
|
2964
|
+
scenario: "",
|
|
2965
|
+
userPrompt: ""
|
|
2966
|
+
});
|
|
2967
|
+
const chatgptSkillSchema = z.object({ name: z.string() }).describe("A skill discovered on the MCP server, by name.");
|
|
1199
2968
|
const chatgptToolJustificationSchema = z.object({
|
|
1200
2969
|
toolName: z.string(),
|
|
1201
2970
|
readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
|
|
@@ -1215,27 +2984,28 @@ chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema
|
|
|
1215
2984
|
const chatgptSubmissionFormDataSchema = z.object({
|
|
1216
2985
|
logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
|
|
1217
2986
|
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."),
|
|
1218
|
-
appName: z.string().describe("The name users will see in ChatGPT and in the
|
|
2987
|
+
appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
|
|
1219
2988
|
tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
|
|
1220
|
-
description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the
|
|
2989
|
+
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)."),
|
|
1221
2990
|
category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
|
|
1222
|
-
developerName: z.string().describe("Developer name shown publicly on the
|
|
2991
|
+
developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
|
|
1223
2992
|
companyUrl: urlField.describe("Your company's main website URL."),
|
|
1224
2993
|
supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
|
|
1225
2994
|
privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
|
|
1226
|
-
termsOfServiceUrl: urlField.describe("URL to the
|
|
1227
|
-
demoRecordingUrl: urlField.describe("URL to a video demonstrating the
|
|
1228
|
-
appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My
|
|
2995
|
+
termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
|
|
2996
|
+
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."),
|
|
2997
|
+
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."),
|
|
1229
2998
|
serverUrl: urlField.describe("URL of the MCP server."),
|
|
1230
2999
|
authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
|
|
1231
3000
|
tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
|
|
1232
3001
|
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."),
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
3002
|
+
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."),
|
|
3003
|
+
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."),
|
|
3004
|
+
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."),
|
|
3005
|
+
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."),
|
|
1236
3006
|
translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
|
|
1237
3007
|
allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
|
|
1238
|
-
releaseNotes: z.string().describe("Publicly displayed on the
|
|
3008
|
+
releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
|
|
1239
3009
|
});
|
|
1240
3010
|
const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
|
|
1241
3011
|
tagline: z.string().optional(),
|
|
@@ -1246,23 +3016,35 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
|
|
|
1246
3016
|
demoRecordingUrl: z.string().optional(),
|
|
1247
3017
|
serverUrl: z.string().optional(),
|
|
1248
3018
|
screenshots: z.array(screenshotDraftEntrySchema).optional(),
|
|
3019
|
+
testCases: z.array(positiveTestCaseDraftSchema).optional(),
|
|
3020
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
|
|
1249
3021
|
translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
|
|
1250
3022
|
});
|
|
1251
|
-
|
|
3023
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
|
|
3024
|
+
const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1252
3025
|
appName: true,
|
|
1253
3026
|
developerName: true,
|
|
1254
3027
|
serverUrl: true,
|
|
1255
3028
|
tools: true,
|
|
3029
|
+
skills: true,
|
|
1256
3030
|
authentication: true
|
|
1257
3031
|
});
|
|
1258
|
-
|
|
3032
|
+
/** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
|
|
3033
|
+
const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1259
3034
|
tagline: true,
|
|
1260
3035
|
description: true,
|
|
1261
3036
|
category: true,
|
|
1262
3037
|
testCases: true,
|
|
1263
3038
|
negativeTestCases: true,
|
|
1264
3039
|
toolJustifications: true
|
|
1265
|
-
}).extend({
|
|
3040
|
+
}).extend({
|
|
3041
|
+
testCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.testCases),
|
|
3042
|
+
negativeTestCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.negativeTestCases)
|
|
3043
|
+
}).extend({
|
|
3044
|
+
tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
|
|
3045
|
+
testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
|
|
3046
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
|
|
3047
|
+
});
|
|
1266
3048
|
const claudeCategorySchema = z.enum([
|
|
1267
3049
|
"Productivity",
|
|
1268
3050
|
"Communication",
|
|
@@ -1385,7 +3167,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
|
|
|
1385
3167
|
categories: z.array(claudeCategorySchema).optional(),
|
|
1386
3168
|
screenshots: z.array(screenshotDraftEntrySchema).optional()
|
|
1387
3169
|
});
|
|
1388
|
-
|
|
3170
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
|
|
3171
|
+
const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
|
|
1389
3172
|
serverUrl: true,
|
|
1390
3173
|
name: true,
|
|
1391
3174
|
slug: true,
|
|
@@ -1407,27 +3190,81 @@ const claudeAiGeneratedFormDataRawSchema = z.object({
|
|
|
1407
3190
|
categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
|
|
1408
3191
|
primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
|
|
1409
3192
|
});
|
|
1410
|
-
claudeAiGeneratedFormDataRawSchema.extend({
|
|
3193
|
+
const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
|
|
1411
3194
|
oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
|
|
1412
3195
|
categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
|
|
1413
3196
|
});
|
|
3197
|
+
function provenanceByField(prefillShape, aiGeneratedShape) {
|
|
3198
|
+
const byField = {};
|
|
3199
|
+
for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
|
|
3200
|
+
for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
|
|
3201
|
+
return byField;
|
|
3202
|
+
}
|
|
3203
|
+
provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
|
|
3204
|
+
const urlVerificationOutcomeSchema = z.enum([
|
|
3205
|
+
"pass",
|
|
3206
|
+
"fail",
|
|
3207
|
+
"unverified"
|
|
3208
|
+
]);
|
|
3209
|
+
const VERIFIABLE_URL_FIELDS = {
|
|
3210
|
+
chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
|
|
3211
|
+
claudeai: ["privacyPolicy"]
|
|
3212
|
+
};
|
|
3213
|
+
const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
|
|
3214
|
+
const policyDisclosureSchema = z.enum([
|
|
3215
|
+
"dataCategories",
|
|
3216
|
+
"purposesOfUse",
|
|
3217
|
+
"recipients",
|
|
3218
|
+
"retention"
|
|
3219
|
+
]);
|
|
3220
|
+
const urlVerificationFieldResultSchema = z.object({
|
|
3221
|
+
field: verifiableUrlFieldSchema,
|
|
3222
|
+
url: z.string(),
|
|
3223
|
+
outcome: urlVerificationOutcomeSchema,
|
|
3224
|
+
reason: z.string(),
|
|
3225
|
+
concerns: z.array(z.string()).optional(),
|
|
3226
|
+
scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
|
|
3227
|
+
});
|
|
3228
|
+
const urlVerificationSchema = z.object({
|
|
3229
|
+
verifiedAt: z.coerce.date(),
|
|
3230
|
+
results: z.array(urlVerificationFieldResultSchema)
|
|
3231
|
+
});
|
|
3232
|
+
const pageKindSchema = z.enum([
|
|
3233
|
+
"expectedDocument",
|
|
3234
|
+
"errorPage",
|
|
3235
|
+
"loginWall",
|
|
3236
|
+
"parkedDomain",
|
|
3237
|
+
"comingSoon",
|
|
3238
|
+
"marketingPage",
|
|
3239
|
+
"unrelatedDocument"
|
|
3240
|
+
]);
|
|
3241
|
+
z.object({
|
|
3242
|
+
pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
|
|
3243
|
+
reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
|
|
3244
|
+
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.")
|
|
3245
|
+
});
|
|
1414
3246
|
const submissionMetaFieldsSchema = z.object({
|
|
1415
3247
|
id: z.string(),
|
|
1416
3248
|
environmentId: z.string(),
|
|
1417
3249
|
auditId: z.string().nullable(),
|
|
3250
|
+
urlVerification: urlVerificationSchema.nullable().default(null),
|
|
1418
3251
|
createdAt: z.coerce.date(),
|
|
1419
3252
|
updatedAt: z.coerce.date()
|
|
1420
3253
|
});
|
|
1421
3254
|
const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1422
3255
|
platform: z.literal("claudeai"),
|
|
1423
|
-
formData: claudeSubmissionDraftSchema
|
|
3256
|
+
formData: claudeSubmissionDraftSchema,
|
|
3257
|
+
prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
|
|
1424
3258
|
});
|
|
1425
3259
|
const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1426
3260
|
platform: z.literal("chatgpt"),
|
|
1427
|
-
formData: chatgptSubmissionDraftSchema
|
|
3261
|
+
formData: chatgptSubmissionDraftSchema,
|
|
3262
|
+
prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
|
|
1428
3263
|
});
|
|
1429
|
-
z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
3264
|
+
const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1430
3265
|
z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
|
|
3266
|
+
/** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
|
|
3267
|
+
const submissionSchema = submissionSchemaInternal;
|
|
1431
3268
|
z.literal([
|
|
1432
3269
|
100,
|
|
1433
3270
|
75,
|
|
@@ -1455,6 +3292,7 @@ const metricsQueueEventSchema = z.object({
|
|
|
1455
3292
|
tool: z.string().nullable(),
|
|
1456
3293
|
client: z.string(),
|
|
1457
3294
|
sessionId: z.string().nullable(),
|
|
3295
|
+
conversationId: z.string().nullable().optional(),
|
|
1458
3296
|
durationMs: z.number().int(),
|
|
1459
3297
|
outputTokens: z.number().int().nullable(),
|
|
1460
3298
|
errorType: z.enum([
|
|
@@ -1470,12 +3308,14 @@ z.object({
|
|
|
1470
3308
|
events: z.array(metricsQueueEventSchema)
|
|
1471
3309
|
});
|
|
1472
3310
|
z.object({ v: z.number() });
|
|
1473
|
-
const
|
|
3311
|
+
const TELEMETRY_SIGNALS = [
|
|
1474
3312
|
"logs",
|
|
1475
3313
|
"metrics",
|
|
1476
3314
|
"traces"
|
|
1477
|
-
]
|
|
1478
|
-
const
|
|
3315
|
+
];
|
|
3316
|
+
const telemetrySignalSchema = z.enum(TELEMETRY_SIGNALS);
|
|
3317
|
+
const OTLP_PROTOCOLS = ["http/protobuf", "http/json"];
|
|
3318
|
+
const otlpProtocolSchema = z.enum(OTLP_PROTOCOLS);
|
|
1479
3319
|
const otlpEndpointSchema = z.string().trim().min(1).max(2048);
|
|
1480
3320
|
const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
|
|
1481
3321
|
const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
|
|
@@ -1506,16 +3346,19 @@ z.object({
|
|
|
1506
3346
|
protocol: otlpProtocolSchema,
|
|
1507
3347
|
headers: z.array(telemetryDestinationHeaderSchema),
|
|
1508
3348
|
status: telemetryDestinationStatusSchema,
|
|
1509
|
-
lastFailureReason: otlpPushFailureReasonSchema.nullable()
|
|
3349
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable(),
|
|
3350
|
+
isScopedToIntentionalRequestsOnly: z.boolean()
|
|
1510
3351
|
});
|
|
1511
|
-
|
|
1512
|
-
|
|
3352
|
+
const hasDuplicateHeaderNames = (headers) => {
|
|
3353
|
+
const names = headers.map(({ name }) => name.trim().toLowerCase());
|
|
3354
|
+
return new Set(names).size !== names.length;
|
|
3355
|
+
};
|
|
3356
|
+
// src/auth-scope.ts
|
|
1513
3357
|
/** Accepts an API key or OAuth access token (default for most routes). */
|
|
1514
3358
|
const AUTH_SCOPE_ANY = "any";
|
|
1515
3359
|
/** Requires a user OAuth access token; API keys are not accepted. */
|
|
1516
3360
|
const AUTH_SCOPE_USER = "user";
|
|
1517
|
-
|
|
1518
|
-
//#region src/schemas.ts
|
|
3361
|
+
// src/schemas.ts
|
|
1519
3362
|
const RESERVED_KEYS = [
|
|
1520
3363
|
"_HANDLER",
|
|
1521
3364
|
"_X_AMZN_TRACE_ID",
|
|
@@ -1604,8 +3447,7 @@ const serverFieldsSchema = z.object({
|
|
|
1604
3447
|
})).optional()
|
|
1605
3448
|
})).optional()
|
|
1606
3449
|
});
|
|
1607
|
-
|
|
1608
|
-
//#region src/api.contract.ts
|
|
3450
|
+
// src/api.contract.ts
|
|
1609
3451
|
const isValidIanaTimeZone = (timeZone) => {
|
|
1610
3452
|
try {
|
|
1611
3453
|
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
@@ -1684,6 +3526,14 @@ const getEnvironmentContractV1 = base.route({
|
|
|
1684
3526
|
createdAt: z.coerce.date(),
|
|
1685
3527
|
projectId: z.string()
|
|
1686
3528
|
}));
|
|
3529
|
+
const deleteEnvironmentContractV1 = base.route({
|
|
3530
|
+
path: "/v1/environments/{environmentId}",
|
|
3531
|
+
method: "DELETE",
|
|
3532
|
+
summary: "Delete an environment",
|
|
3533
|
+
description: "All environments can be deleted except the production environment. This operation is not reversible: associated logs, analytics, and metrics are deleted as well.",
|
|
3534
|
+
tags: ["environments"],
|
|
3535
|
+
successDescription: "The environment has been deleted successfully"
|
|
3536
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.object({ success: z.literal(true) }));
|
|
1687
3537
|
const domainSchema = z.object({
|
|
1688
3538
|
domain: z.string(),
|
|
1689
3539
|
status: z.enum([
|
|
@@ -1790,6 +3640,100 @@ const environmentVariableOutputSchema = z.object({
|
|
|
1790
3640
|
isSecret: z.boolean(),
|
|
1791
3641
|
createdAt: z.coerce.date()
|
|
1792
3642
|
});
|
|
3643
|
+
const telemetryDestinationHeaderOutputSchema = z.discriminatedUnion("isSecret", [z.object({
|
|
3644
|
+
id: z.string(),
|
|
3645
|
+
name: otlpHeaderNameSchema,
|
|
3646
|
+
value: z.null(),
|
|
3647
|
+
isSecret: z.literal(true)
|
|
3648
|
+
}), z.object({
|
|
3649
|
+
id: z.string(),
|
|
3650
|
+
name: otlpHeaderNameSchema,
|
|
3651
|
+
value: otlpHeaderValueSchema,
|
|
3652
|
+
isSecret: z.literal(false)
|
|
3653
|
+
})]);
|
|
3654
|
+
const telemetryDestinationOutputSchema = z.object({
|
|
3655
|
+
id: z.string(),
|
|
3656
|
+
signal: telemetrySignalSchema,
|
|
3657
|
+
endpoint: otlpEndpointSchema,
|
|
3658
|
+
protocol: otlpProtocolSchema,
|
|
3659
|
+
headers: z.array(telemetryDestinationHeaderOutputSchema),
|
|
3660
|
+
status: telemetryDestinationStatusSchema,
|
|
3661
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable(),
|
|
3662
|
+
isScopedToIntentionalRequestsOnly: z.boolean()
|
|
3663
|
+
});
|
|
3664
|
+
const createTelemetryDestinationHeaderInputSchema = z.object({
|
|
3665
|
+
name: otlpHeaderNameSchema,
|
|
3666
|
+
value: otlpHeaderValueSchema.min(1, "Enter a header value"),
|
|
3667
|
+
isSecret: z.boolean()
|
|
3668
|
+
});
|
|
3669
|
+
const updateTelemetryDestinationHeaderInputSchema = z.object({
|
|
3670
|
+
id: z.string().optional(),
|
|
3671
|
+
name: otlpHeaderNameSchema,
|
|
3672
|
+
value: otlpHeaderValueSchema.optional(),
|
|
3673
|
+
isSecret: z.boolean()
|
|
3674
|
+
});
|
|
3675
|
+
const uniqueTelemetryHeaders = (headers) => !hasDuplicateHeaderNames(headers);
|
|
3676
|
+
const listTelemetryDestinationsContractV1 = base.route({
|
|
3677
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations",
|
|
3678
|
+
method: "GET",
|
|
3679
|
+
summary: "List telemetry destinations",
|
|
3680
|
+
description: "List the OTLP destinations configured for an environment. Secret header values are never returned.",
|
|
3681
|
+
tags: ["telemetry"],
|
|
3682
|
+
successDescription: "The list of telemetry destinations"
|
|
3683
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(telemetryDestinationOutputSchema));
|
|
3684
|
+
const createTelemetryDestinationContractV1 = base.route({
|
|
3685
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations",
|
|
3686
|
+
method: "POST",
|
|
3687
|
+
summary: "Create a telemetry destination",
|
|
3688
|
+
description: "Verify and save an OTLP destination for logs, metrics, or traces.",
|
|
3689
|
+
tags: ["telemetry"],
|
|
3690
|
+
successDescription: "The telemetry destination has been created"
|
|
3691
|
+
}).errors({
|
|
3692
|
+
NOT_FOUND: {},
|
|
3693
|
+
FORBIDDEN: {},
|
|
3694
|
+
OTLP_DESTINATION_UNVERIFIED: { status: 400 },
|
|
3695
|
+
INTERNAL_SERVER_ERROR: {}
|
|
3696
|
+
}).input(z.object({
|
|
3697
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3698
|
+
signal: telemetrySignalSchema,
|
|
3699
|
+
endpoint: otlpEndpointSchema,
|
|
3700
|
+
protocol: otlpProtocolSchema.default("http/protobuf"),
|
|
3701
|
+
isScopedToIntentionalRequestsOnly: z.boolean().default(false),
|
|
3702
|
+
headers: z.array(createTelemetryDestinationHeaderInputSchema).default([]).refine(uniqueTelemetryHeaders, "Header names must be unique")
|
|
3703
|
+
})).output(telemetryDestinationOutputSchema);
|
|
3704
|
+
const updateTelemetryDestinationContractV1 = base.route({
|
|
3705
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
|
|
3706
|
+
method: "PATCH",
|
|
3707
|
+
summary: "Update a telemetry destination",
|
|
3708
|
+
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.",
|
|
3709
|
+
tags: ["telemetry"],
|
|
3710
|
+
successDescription: "The telemetry destination has been updated"
|
|
3711
|
+
}).errors({
|
|
3712
|
+
NOT_FOUND: {},
|
|
3713
|
+
FORBIDDEN: {},
|
|
3714
|
+
OTLP_DESTINATION_UNVERIFIED: { status: 400 }
|
|
3715
|
+
}).input(z.object({
|
|
3716
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3717
|
+
destinationId: z.string().describe("The ID of the telemetry destination"),
|
|
3718
|
+
endpoint: otlpEndpointSchema.optional(),
|
|
3719
|
+
protocol: otlpProtocolSchema.optional(),
|
|
3720
|
+
isScopedToIntentionalRequestsOnly: z.boolean().optional(),
|
|
3721
|
+
headers: z.array(updateTelemetryDestinationHeaderInputSchema).refine(uniqueTelemetryHeaders, "Header names must be unique").optional()
|
|
3722
|
+
})).output(telemetryDestinationOutputSchema);
|
|
3723
|
+
const deleteTelemetryDestinationContractV1 = base.route({
|
|
3724
|
+
path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
|
|
3725
|
+
method: "DELETE",
|
|
3726
|
+
summary: "Delete a telemetry destination",
|
|
3727
|
+
description: "Delete an OTLP destination from an environment.",
|
|
3728
|
+
tags: ["telemetry"],
|
|
3729
|
+
successDescription: "The telemetry destination has been deleted"
|
|
3730
|
+
}).errors({
|
|
3731
|
+
NOT_FOUND: {},
|
|
3732
|
+
INTERNAL_SERVER_ERROR: {}
|
|
3733
|
+
}).input(z.object({
|
|
3734
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
3735
|
+
destinationId: z.string().describe("The ID of the telemetry destination")
|
|
3736
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
1793
3737
|
const listEnvironmentVariablesContractV1 = base.route({
|
|
1794
3738
|
path: "/v1/environments/{environmentId}/environment-variables",
|
|
1795
3739
|
method: "GET",
|
|
@@ -1933,7 +3877,7 @@ const getLogsContractV1 = base.route({
|
|
|
1933
3877
|
"WARNING",
|
|
1934
3878
|
"DEBUG"
|
|
1935
3879
|
])).optional().describe("Filter by log level"),
|
|
1936
|
-
search:
|
|
3880
|
+
search: logSearchSchema.optional().describe("Term to search for in log content"),
|
|
1937
3881
|
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
1938
3882
|
})).output(z.object({
|
|
1939
3883
|
logs: z.array(logEntrySchema),
|
|
@@ -1955,7 +3899,7 @@ const getLatestLogsContractV1 = base.route({
|
|
|
1955
3899
|
"WARNING",
|
|
1956
3900
|
"DEBUG"
|
|
1957
3901
|
])).optional().describe("Filter by log level"),
|
|
1958
|
-
search:
|
|
3902
|
+
search: logSearchSchema.optional().describe("Term to search for in log content")
|
|
1959
3903
|
})).output(z.object({ logs: z.array(logEntrySchema) }));
|
|
1960
3904
|
const getDeploymentLogsContractV1 = base.route({
|
|
1961
3905
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
@@ -2266,6 +4210,57 @@ const getBeaconContractV1 = base.route({
|
|
|
2266
4210
|
createdAt: z.coerce.date(),
|
|
2267
4211
|
report: auditReportWithScreenshotsSchema.nullable()
|
|
2268
4212
|
}));
|
|
4213
|
+
const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
|
|
4214
|
+
const submissionIdSchema = z.string().describe("The ID of the submission package");
|
|
4215
|
+
const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
|
|
4216
|
+
const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
|
|
4217
|
+
const createSubmissionContractV1 = base.route({
|
|
4218
|
+
path: "/v1/submissions",
|
|
4219
|
+
method: "POST",
|
|
4220
|
+
summary: "Create a submission package",
|
|
4221
|
+
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.",
|
|
4222
|
+
tags: ["submissions"],
|
|
4223
|
+
successDescription: "The created submission package, with its prefilled fields"
|
|
4224
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
4225
|
+
environmentId: z.string().describe("The ID of the environment to build the package from"),
|
|
4226
|
+
platform: platformSchema.describe(PLATFORM_DESCRIPTION)
|
|
4227
|
+
})).output(submissionSchema);
|
|
4228
|
+
const listSubmissionsContractV1 = base.route({
|
|
4229
|
+
path: "/v1/projects/{projectId}/submissions",
|
|
4230
|
+
method: "GET",
|
|
4231
|
+
summary: "List submission packages",
|
|
4232
|
+
description: "List the submission packages of a project, grouped by directory and most recently updated first, optionally narrowed to one environment or one directory",
|
|
4233
|
+
tags: ["submissions"],
|
|
4234
|
+
successDescription: "The list of submission packages"
|
|
4235
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
4236
|
+
projectId: z.string().describe("The ID of the project"),
|
|
4237
|
+
environmentId: z.string().optional().describe("Filter by environment ID"),
|
|
4238
|
+
platform: platformSchema.optional().describe(PLATFORM_DESCRIPTION)
|
|
4239
|
+
})).output(z.array(submissionSchema));
|
|
4240
|
+
const getSubmissionContractV1 = base.route({
|
|
4241
|
+
path: "/v1/submissions/{submissionId}",
|
|
4242
|
+
method: "GET",
|
|
4243
|
+
summary: "Get a submission package",
|
|
4244
|
+
description: "Get a submission package by ID, including its form data and the prefill it started from",
|
|
4245
|
+
tags: ["submissions"],
|
|
4246
|
+
successDescription: "The submission package"
|
|
4247
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
|
|
4248
|
+
const updateSubmissionContractV1 = base.route({
|
|
4249
|
+
path: "/v1/submissions/{submissionId}",
|
|
4250
|
+
method: "PUT",
|
|
4251
|
+
summary: "Update a submission package",
|
|
4252
|
+
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.",
|
|
4253
|
+
tags: ["submissions"],
|
|
4254
|
+
successDescription: "The updated submission package"
|
|
4255
|
+
}).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
|
|
4256
|
+
submissionId: submissionIdSchema,
|
|
4257
|
+
platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
|
|
4258
|
+
formData: claudeSubmissionUpdateSchema
|
|
4259
|
+
}), z.object({
|
|
4260
|
+
submissionId: submissionIdSchema,
|
|
4261
|
+
platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
|
|
4262
|
+
formData: chatgptSubmissionUpdateSchema
|
|
4263
|
+
})])).output(submissionSchema);
|
|
2269
4264
|
const contract = {
|
|
2270
4265
|
teams: {
|
|
2271
4266
|
list: { v1: listTeamsContractV1 },
|
|
@@ -2291,6 +4286,7 @@ const contract = {
|
|
|
2291
4286
|
environments: {
|
|
2292
4287
|
create: { v1: createEnvironmentContractV1 },
|
|
2293
4288
|
get: { v1: getEnvironmentContractV1 },
|
|
4289
|
+
delete: { v1: deleteEnvironmentContractV1 },
|
|
2294
4290
|
deploy: { v1: deployEnvironmentContractV1 },
|
|
2295
4291
|
getLogs: { v1: getLogsContractV1 },
|
|
2296
4292
|
getLatestLogs: { v1: getLatestLogsContractV1 }
|
|
@@ -2301,6 +4297,12 @@ const contract = {
|
|
|
2301
4297
|
update: { v1: updateEnvironmentVariableContractV1 },
|
|
2302
4298
|
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
2303
4299
|
},
|
|
4300
|
+
telemetryDestinations: {
|
|
4301
|
+
list: { v1: listTelemetryDestinationsContractV1 },
|
|
4302
|
+
create: { v1: createTelemetryDestinationContractV1 },
|
|
4303
|
+
update: { v1: updateTelemetryDestinationContractV1 },
|
|
4304
|
+
delete: { v1: deleteTelemetryDestinationContractV1 }
|
|
4305
|
+
},
|
|
2304
4306
|
projects: {
|
|
2305
4307
|
update: { v1: updateProjectContractV1 },
|
|
2306
4308
|
get: { v1: getProjectContractV1 },
|
|
@@ -2320,6 +4322,12 @@ const contract = {
|
|
|
2320
4322
|
beacon: {
|
|
2321
4323
|
create: { v1: createBeaconContractV1 },
|
|
2322
4324
|
get: { v1: getBeaconContractV1 }
|
|
4325
|
+
},
|
|
4326
|
+
submissions: {
|
|
4327
|
+
create: { v1: createSubmissionContractV1 },
|
|
4328
|
+
list: { v1: listSubmissionsContractV1 },
|
|
4329
|
+
get: { v1: getSubmissionContractV1 },
|
|
4330
|
+
update: { v1: updateSubmissionContractV1 }
|
|
2323
4331
|
}
|
|
2324
4332
|
};
|
|
2325
4333
|
const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
|
|
@@ -2327,5 +4335,25 @@ const contractForDocs = {
|
|
|
2327
4335
|
...contract,
|
|
2328
4336
|
deployments: deploymentsForDocs
|
|
2329
4337
|
};
|
|
2330
|
-
|
|
2331
|
-
|
|
4338
|
+
/** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
|
|
4339
|
+
const OPENAPI_DOC_OPTIONS = {
|
|
4340
|
+
info: {
|
|
4341
|
+
title: "Alpic API",
|
|
4342
|
+
version: "1.0.0"
|
|
4343
|
+
},
|
|
4344
|
+
servers: [{ url: "https://api.alpic.ai" }],
|
|
4345
|
+
security: [{ bearerAuth: [] }],
|
|
4346
|
+
components: { securitySchemes: { bearerAuth: {
|
|
4347
|
+
type: "http",
|
|
4348
|
+
description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
|
|
4349
|
+
scheme: "bearer"
|
|
4350
|
+
} } },
|
|
4351
|
+
commonSchemas: {
|
|
4352
|
+
Submission: { schema: submissionSchema },
|
|
4353
|
+
ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
|
|
4354
|
+
ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
|
|
4355
|
+
ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
|
|
4356
|
+
ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
|
|
4357
|
+
}
|
|
4358
|
+
};
|
|
4359
|
+
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 };
|