@stripe/link-cli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -1
- package/dist/cli.js +1295 -524
- package/package.json +8 -8
package/dist/cli.js
CHANGED
|
@@ -3095,9 +3095,9 @@ var require_data = __commonJS({
|
|
|
3095
3095
|
}
|
|
3096
3096
|
});
|
|
3097
3097
|
|
|
3098
|
-
// ../../node_modules/.pnpm/fast-uri@3.1.
|
|
3098
|
+
// ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
|
|
3099
3099
|
var require_utils = __commonJS({
|
|
3100
|
-
"../../node_modules/.pnpm/fast-uri@3.1.
|
|
3100
|
+
"../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
3101
3101
|
"use strict";
|
|
3102
3102
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3103
3103
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
@@ -3408,9 +3408,9 @@ var require_utils = __commonJS({
|
|
|
3408
3408
|
}
|
|
3409
3409
|
});
|
|
3410
3410
|
|
|
3411
|
-
// ../../node_modules/.pnpm/fast-uri@3.1.
|
|
3411
|
+
// ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
|
|
3412
3412
|
var require_schemes = __commonJS({
|
|
3413
|
-
"../../node_modules/.pnpm/fast-uri@3.1.
|
|
3413
|
+
"../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
3414
3414
|
"use strict";
|
|
3415
3415
|
var { isUUID } = require_utils();
|
|
3416
3416
|
var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
@@ -3618,9 +3618,9 @@ var require_schemes = __commonJS({
|
|
|
3618
3618
|
}
|
|
3619
3619
|
});
|
|
3620
3620
|
|
|
3621
|
-
// ../../node_modules/.pnpm/fast-uri@3.1.
|
|
3621
|
+
// ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js
|
|
3622
3622
|
var require_fast_uri = __commonJS({
|
|
3623
|
-
"../../node_modules/.pnpm/fast-uri@3.1.
|
|
3623
|
+
"../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports, module) {
|
|
3624
3624
|
"use strict";
|
|
3625
3625
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3626
3626
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
@@ -3636,7 +3636,12 @@ var require_fast_uri = __commonJS({
|
|
|
3636
3636
|
}
|
|
3637
3637
|
function resolve(baseURI, relativeURI, options) {
|
|
3638
3638
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3639
|
-
const
|
|
3639
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
3640
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
3641
|
+
if (baseMalformed || relativeMalformed) {
|
|
3642
|
+
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
3643
|
+
}
|
|
3644
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
3640
3645
|
schemelessOptions.skipEscape = true;
|
|
3641
3646
|
return serialize(resolved, schemelessOptions);
|
|
3642
3647
|
}
|
|
@@ -3761,6 +3766,8 @@ var require_fast_uri = __commonJS({
|
|
|
3761
3766
|
return uriTokens.join("");
|
|
3762
3767
|
}
|
|
3763
3768
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3769
|
+
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
3770
|
+
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
3764
3771
|
function getParseError(parsed, matches) {
|
|
3765
3772
|
if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
|
|
3766
3773
|
return 'URI path must start with "/" when authority is present.';
|
|
@@ -3790,6 +3797,25 @@ var require_fast_uri = __commonJS({
|
|
|
3790
3797
|
uri = "//" + uri;
|
|
3791
3798
|
}
|
|
3792
3799
|
}
|
|
3800
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
3801
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
3802
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
3803
|
+
malformedAuthorityOrPort = true;
|
|
3804
|
+
}
|
|
3805
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
3806
|
+
if (introducerMatch !== null) {
|
|
3807
|
+
const region = introducerMatch[1];
|
|
3808
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
3809
|
+
if (normalizedRegion.length >= 2) {
|
|
3810
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
3811
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
3812
|
+
malformedAuthorityOrPort = true;
|
|
3813
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
3814
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
3815
|
+
malformedAuthorityOrPort = true;
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
}
|
|
3793
3819
|
const matches = uri.match(URI_PARSE);
|
|
3794
3820
|
if (matches) {
|
|
3795
3821
|
parsed.scheme = matches[1];
|
|
@@ -3833,7 +3859,7 @@ var require_fast_uri = __commonJS({
|
|
|
3833
3859
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3834
3860
|
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
3835
3861
|
try {
|
|
3836
|
-
parsed.host = URL
|
|
3862
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
3837
3863
|
} catch (e) {
|
|
3838
3864
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
3839
3865
|
}
|
|
@@ -7705,9 +7731,9 @@ var require_dist = __commonJS({
|
|
|
7705
7731
|
}
|
|
7706
7732
|
});
|
|
7707
7733
|
|
|
7708
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7734
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
7709
7735
|
var require_constants = __commonJS({
|
|
7710
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7736
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js"(exports, module) {
|
|
7711
7737
|
"use strict";
|
|
7712
7738
|
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
7713
7739
|
var MAX_LENGTH = 256;
|
|
@@ -7737,9 +7763,9 @@ var require_constants = __commonJS({
|
|
|
7737
7763
|
}
|
|
7738
7764
|
});
|
|
7739
7765
|
|
|
7740
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7766
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
7741
7767
|
var require_debug = __commonJS({
|
|
7742
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7768
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js"(exports, module) {
|
|
7743
7769
|
"use strict";
|
|
7744
7770
|
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
7745
7771
|
};
|
|
@@ -7747,9 +7773,9 @@ var require_debug = __commonJS({
|
|
|
7747
7773
|
}
|
|
7748
7774
|
});
|
|
7749
7775
|
|
|
7750
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7776
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
7751
7777
|
var require_re = __commonJS({
|
|
7752
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7778
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js"(exports, module) {
|
|
7753
7779
|
"use strict";
|
|
7754
7780
|
var {
|
|
7755
7781
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -7835,9 +7861,9 @@ var require_re = __commonJS({
|
|
|
7835
7861
|
}
|
|
7836
7862
|
});
|
|
7837
7863
|
|
|
7838
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7864
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
7839
7865
|
var require_parse_options = __commonJS({
|
|
7840
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7866
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js"(exports, module) {
|
|
7841
7867
|
"use strict";
|
|
7842
7868
|
var looseOption = Object.freeze({ loose: true });
|
|
7843
7869
|
var emptyOpts = Object.freeze({});
|
|
@@ -7854,9 +7880,9 @@ var require_parse_options = __commonJS({
|
|
|
7854
7880
|
}
|
|
7855
7881
|
});
|
|
7856
7882
|
|
|
7857
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7883
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
7858
7884
|
var require_identifiers = __commonJS({
|
|
7859
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7885
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
7860
7886
|
"use strict";
|
|
7861
7887
|
var numeric = /^[0-9]+$/;
|
|
7862
7888
|
var compareIdentifiers = (a, b) => {
|
|
@@ -7879,15 +7905,27 @@ var require_identifiers = __commonJS({
|
|
|
7879
7905
|
}
|
|
7880
7906
|
});
|
|
7881
7907
|
|
|
7882
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
7908
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
7883
7909
|
var require_semver = __commonJS({
|
|
7884
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
7910
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js"(exports, module) {
|
|
7885
7911
|
"use strict";
|
|
7886
7912
|
var debug = require_debug();
|
|
7887
7913
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
7888
7914
|
var { safeRe: re, t } = require_re();
|
|
7889
7915
|
var parseOptions = require_parse_options();
|
|
7890
7916
|
var { compareIdentifiers } = require_identifiers();
|
|
7917
|
+
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
7918
|
+
const identifiers = identifier.split(".");
|
|
7919
|
+
if (identifiers.length > prerelease.length) {
|
|
7920
|
+
return false;
|
|
7921
|
+
}
|
|
7922
|
+
for (let i = 0; i < identifiers.length; i++) {
|
|
7923
|
+
if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
|
|
7924
|
+
return false;
|
|
7925
|
+
}
|
|
7926
|
+
}
|
|
7927
|
+
return true;
|
|
7928
|
+
};
|
|
7891
7929
|
var SemVer = class _SemVer {
|
|
7892
7930
|
constructor(version, options) {
|
|
7893
7931
|
options = parseOptions(options);
|
|
@@ -8134,8 +8172,9 @@ var require_semver = __commonJS({
|
|
|
8134
8172
|
if (identifierBase === false) {
|
|
8135
8173
|
prerelease = [identifier];
|
|
8136
8174
|
}
|
|
8137
|
-
if (
|
|
8138
|
-
|
|
8175
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
8176
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
8177
|
+
if (isNaN(prereleaseBase)) {
|
|
8139
8178
|
this.prerelease = prerelease;
|
|
8140
8179
|
}
|
|
8141
8180
|
} else {
|
|
@@ -8158,9 +8197,9 @@ var require_semver = __commonJS({
|
|
|
8158
8197
|
}
|
|
8159
8198
|
});
|
|
8160
8199
|
|
|
8161
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8200
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
8162
8201
|
var require_parse = __commonJS({
|
|
8163
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8202
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module) {
|
|
8164
8203
|
"use strict";
|
|
8165
8204
|
var SemVer = require_semver();
|
|
8166
8205
|
var parse = (version, options, throwErrors = false) => {
|
|
@@ -8180,9 +8219,9 @@ var require_parse = __commonJS({
|
|
|
8180
8219
|
}
|
|
8181
8220
|
});
|
|
8182
8221
|
|
|
8183
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8222
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
8184
8223
|
var require_valid = __commonJS({
|
|
8185
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8224
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module) {
|
|
8186
8225
|
"use strict";
|
|
8187
8226
|
var parse = require_parse();
|
|
8188
8227
|
var valid = (version, options) => {
|
|
@@ -8193,9 +8232,9 @@ var require_valid = __commonJS({
|
|
|
8193
8232
|
}
|
|
8194
8233
|
});
|
|
8195
8234
|
|
|
8196
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8235
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js
|
|
8197
8236
|
var require_clean = __commonJS({
|
|
8198
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8237
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js"(exports, module) {
|
|
8199
8238
|
"use strict";
|
|
8200
8239
|
var parse = require_parse();
|
|
8201
8240
|
var clean = (version, options) => {
|
|
@@ -8206,9 +8245,9 @@ var require_clean = __commonJS({
|
|
|
8206
8245
|
}
|
|
8207
8246
|
});
|
|
8208
8247
|
|
|
8209
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8248
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js
|
|
8210
8249
|
var require_inc = __commonJS({
|
|
8211
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8250
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js"(exports, module) {
|
|
8212
8251
|
"use strict";
|
|
8213
8252
|
var SemVer = require_semver();
|
|
8214
8253
|
var inc = (version, release, options, identifier, identifierBase) => {
|
|
@@ -8230,9 +8269,9 @@ var require_inc = __commonJS({
|
|
|
8230
8269
|
}
|
|
8231
8270
|
});
|
|
8232
8271
|
|
|
8233
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8272
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js
|
|
8234
8273
|
var require_diff = __commonJS({
|
|
8235
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8274
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js"(exports, module) {
|
|
8236
8275
|
"use strict";
|
|
8237
8276
|
var parse = require_parse();
|
|
8238
8277
|
var diff = (version1, version2) => {
|
|
@@ -8274,9 +8313,9 @@ var require_diff = __commonJS({
|
|
|
8274
8313
|
}
|
|
8275
8314
|
});
|
|
8276
8315
|
|
|
8277
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8316
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js
|
|
8278
8317
|
var require_major = __commonJS({
|
|
8279
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8318
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js"(exports, module) {
|
|
8280
8319
|
"use strict";
|
|
8281
8320
|
var SemVer = require_semver();
|
|
8282
8321
|
var major = (a, loose) => new SemVer(a, loose).major;
|
|
@@ -8284,9 +8323,9 @@ var require_major = __commonJS({
|
|
|
8284
8323
|
}
|
|
8285
8324
|
});
|
|
8286
8325
|
|
|
8287
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8326
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js
|
|
8288
8327
|
var require_minor = __commonJS({
|
|
8289
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8328
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js"(exports, module) {
|
|
8290
8329
|
"use strict";
|
|
8291
8330
|
var SemVer = require_semver();
|
|
8292
8331
|
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
@@ -8294,9 +8333,9 @@ var require_minor = __commonJS({
|
|
|
8294
8333
|
}
|
|
8295
8334
|
});
|
|
8296
8335
|
|
|
8297
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8336
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js
|
|
8298
8337
|
var require_patch = __commonJS({
|
|
8299
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8338
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js"(exports, module) {
|
|
8300
8339
|
"use strict";
|
|
8301
8340
|
var SemVer = require_semver();
|
|
8302
8341
|
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
@@ -8304,9 +8343,9 @@ var require_patch = __commonJS({
|
|
|
8304
8343
|
}
|
|
8305
8344
|
});
|
|
8306
8345
|
|
|
8307
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8346
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
|
|
8308
8347
|
var require_prerelease = __commonJS({
|
|
8309
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8348
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
8310
8349
|
"use strict";
|
|
8311
8350
|
var parse = require_parse();
|
|
8312
8351
|
var prerelease = (version, options) => {
|
|
@@ -8317,9 +8356,9 @@ var require_prerelease = __commonJS({
|
|
|
8317
8356
|
}
|
|
8318
8357
|
});
|
|
8319
8358
|
|
|
8320
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8359
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
8321
8360
|
var require_compare = __commonJS({
|
|
8322
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8361
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js"(exports, module) {
|
|
8323
8362
|
"use strict";
|
|
8324
8363
|
var SemVer = require_semver();
|
|
8325
8364
|
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
@@ -8327,9 +8366,9 @@ var require_compare = __commonJS({
|
|
|
8327
8366
|
}
|
|
8328
8367
|
});
|
|
8329
8368
|
|
|
8330
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8369
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
|
|
8331
8370
|
var require_rcompare = __commonJS({
|
|
8332
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8371
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js"(exports, module) {
|
|
8333
8372
|
"use strict";
|
|
8334
8373
|
var compare = require_compare();
|
|
8335
8374
|
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
@@ -8337,9 +8376,9 @@ var require_rcompare = __commonJS({
|
|
|
8337
8376
|
}
|
|
8338
8377
|
});
|
|
8339
8378
|
|
|
8340
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8379
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js
|
|
8341
8380
|
var require_compare_loose = __commonJS({
|
|
8342
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8381
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js"(exports, module) {
|
|
8343
8382
|
"use strict";
|
|
8344
8383
|
var compare = require_compare();
|
|
8345
8384
|
var compareLoose = (a, b) => compare(a, b, true);
|
|
@@ -8347,9 +8386,9 @@ var require_compare_loose = __commonJS({
|
|
|
8347
8386
|
}
|
|
8348
8387
|
});
|
|
8349
8388
|
|
|
8350
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8389
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js
|
|
8351
8390
|
var require_compare_build = __commonJS({
|
|
8352
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8391
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js"(exports, module) {
|
|
8353
8392
|
"use strict";
|
|
8354
8393
|
var SemVer = require_semver();
|
|
8355
8394
|
var compareBuild = (a, b, loose) => {
|
|
@@ -8361,9 +8400,9 @@ var require_compare_build = __commonJS({
|
|
|
8361
8400
|
}
|
|
8362
8401
|
});
|
|
8363
8402
|
|
|
8364
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8403
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js
|
|
8365
8404
|
var require_sort = __commonJS({
|
|
8366
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8405
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js"(exports, module) {
|
|
8367
8406
|
"use strict";
|
|
8368
8407
|
var compareBuild = require_compare_build();
|
|
8369
8408
|
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
@@ -8371,9 +8410,9 @@ var require_sort = __commonJS({
|
|
|
8371
8410
|
}
|
|
8372
8411
|
});
|
|
8373
8412
|
|
|
8374
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8413
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js
|
|
8375
8414
|
var require_rsort = __commonJS({
|
|
8376
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8415
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js"(exports, module) {
|
|
8377
8416
|
"use strict";
|
|
8378
8417
|
var compareBuild = require_compare_build();
|
|
8379
8418
|
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
@@ -8381,9 +8420,9 @@ var require_rsort = __commonJS({
|
|
|
8381
8420
|
}
|
|
8382
8421
|
});
|
|
8383
8422
|
|
|
8384
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8423
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
|
|
8385
8424
|
var require_gt = __commonJS({
|
|
8386
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8425
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js"(exports, module) {
|
|
8387
8426
|
"use strict";
|
|
8388
8427
|
var compare = require_compare();
|
|
8389
8428
|
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
@@ -8391,9 +8430,9 @@ var require_gt = __commonJS({
|
|
|
8391
8430
|
}
|
|
8392
8431
|
});
|
|
8393
8432
|
|
|
8394
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8433
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
|
|
8395
8434
|
var require_lt = __commonJS({
|
|
8396
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8435
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js"(exports, module) {
|
|
8397
8436
|
"use strict";
|
|
8398
8437
|
var compare = require_compare();
|
|
8399
8438
|
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
@@ -8401,9 +8440,9 @@ var require_lt = __commonJS({
|
|
|
8401
8440
|
}
|
|
8402
8441
|
});
|
|
8403
8442
|
|
|
8404
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8443
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
|
|
8405
8444
|
var require_eq = __commonJS({
|
|
8406
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8445
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js"(exports, module) {
|
|
8407
8446
|
"use strict";
|
|
8408
8447
|
var compare = require_compare();
|
|
8409
8448
|
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
@@ -8411,9 +8450,9 @@ var require_eq = __commonJS({
|
|
|
8411
8450
|
}
|
|
8412
8451
|
});
|
|
8413
8452
|
|
|
8414
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8453
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
|
|
8415
8454
|
var require_neq = __commonJS({
|
|
8416
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8455
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js"(exports, module) {
|
|
8417
8456
|
"use strict";
|
|
8418
8457
|
var compare = require_compare();
|
|
8419
8458
|
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
@@ -8421,9 +8460,9 @@ var require_neq = __commonJS({
|
|
|
8421
8460
|
}
|
|
8422
8461
|
});
|
|
8423
8462
|
|
|
8424
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8463
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
|
|
8425
8464
|
var require_gte = __commonJS({
|
|
8426
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8465
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js"(exports, module) {
|
|
8427
8466
|
"use strict";
|
|
8428
8467
|
var compare = require_compare();
|
|
8429
8468
|
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
@@ -8431,9 +8470,9 @@ var require_gte = __commonJS({
|
|
|
8431
8470
|
}
|
|
8432
8471
|
});
|
|
8433
8472
|
|
|
8434
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8473
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
|
|
8435
8474
|
var require_lte = __commonJS({
|
|
8436
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8475
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js"(exports, module) {
|
|
8437
8476
|
"use strict";
|
|
8438
8477
|
var compare = require_compare();
|
|
8439
8478
|
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
@@ -8441,9 +8480,9 @@ var require_lte = __commonJS({
|
|
|
8441
8480
|
}
|
|
8442
8481
|
});
|
|
8443
8482
|
|
|
8444
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8483
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
|
|
8445
8484
|
var require_cmp = __commonJS({
|
|
8446
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8485
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js"(exports, module) {
|
|
8447
8486
|
"use strict";
|
|
8448
8487
|
var eq = require_eq();
|
|
8449
8488
|
var neq = require_neq();
|
|
@@ -8491,9 +8530,9 @@ var require_cmp = __commonJS({
|
|
|
8491
8530
|
}
|
|
8492
8531
|
});
|
|
8493
8532
|
|
|
8494
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8533
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js
|
|
8495
8534
|
var require_coerce = __commonJS({
|
|
8496
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8535
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js"(exports, module) {
|
|
8497
8536
|
"use strict";
|
|
8498
8537
|
var SemVer = require_semver();
|
|
8499
8538
|
var parse = require_parse();
|
|
@@ -8537,9 +8576,9 @@ var require_coerce = __commonJS({
|
|
|
8537
8576
|
}
|
|
8538
8577
|
});
|
|
8539
8578
|
|
|
8540
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8579
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js
|
|
8541
8580
|
var require_truncate = __commonJS({
|
|
8542
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8581
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js"(exports, module) {
|
|
8543
8582
|
"use strict";
|
|
8544
8583
|
var parse = require_parse();
|
|
8545
8584
|
var constants2 = require_constants();
|
|
@@ -8578,9 +8617,9 @@ var require_truncate = __commonJS({
|
|
|
8578
8617
|
}
|
|
8579
8618
|
});
|
|
8580
8619
|
|
|
8581
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8620
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
|
|
8582
8621
|
var require_lrucache = __commonJS({
|
|
8583
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8622
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js"(exports, module) {
|
|
8584
8623
|
"use strict";
|
|
8585
8624
|
var LRUCache = class {
|
|
8586
8625
|
constructor() {
|
|
@@ -8616,9 +8655,9 @@ var require_lrucache = __commonJS({
|
|
|
8616
8655
|
}
|
|
8617
8656
|
});
|
|
8618
8657
|
|
|
8619
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
8658
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
|
|
8620
8659
|
var require_range = __commonJS({
|
|
8621
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
8660
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js"(exports, module) {
|
|
8622
8661
|
"use strict";
|
|
8623
8662
|
var SPACE_CHARACTERS = /\s+/g;
|
|
8624
8663
|
var Range = class _Range {
|
|
@@ -8805,20 +8844,22 @@ var require_range = __commonJS({
|
|
|
8805
8844
|
return comp;
|
|
8806
8845
|
};
|
|
8807
8846
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
8847
|
+
var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
8808
8848
|
var replaceTildes = (comp, options) => {
|
|
8809
8849
|
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
8810
8850
|
};
|
|
8811
8851
|
var replaceTilde = (comp, options) => {
|
|
8812
8852
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
8853
|
+
const z13 = options.includePrerelease ? "-0" : "";
|
|
8813
8854
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
8814
8855
|
debug("tilde", comp, _, M, m, p, pr);
|
|
8815
8856
|
let ret;
|
|
8816
8857
|
if (isX(M)) {
|
|
8817
8858
|
ret = "";
|
|
8818
8859
|
} else if (isX(m)) {
|
|
8819
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
8860
|
+
ret = `>=${M}.0.0${z13} <${+M + 1}.0.0-0`;
|
|
8820
8861
|
} else if (isX(p)) {
|
|
8821
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
8862
|
+
ret = `>=${M}.${m}.0${z13} <${M}.${+m + 1}.0-0`;
|
|
8822
8863
|
} else if (pr) {
|
|
8823
8864
|
debug("replaceTilde pr", pr);
|
|
8824
8865
|
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
@@ -8864,9 +8905,9 @@ var require_range = __commonJS({
|
|
|
8864
8905
|
debug("no pr");
|
|
8865
8906
|
if (M === "0") {
|
|
8866
8907
|
if (m === "0") {
|
|
8867
|
-
ret = `>=${M}.${m}.${p}
|
|
8908
|
+
ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
8868
8909
|
} else {
|
|
8869
|
-
ret = `>=${M}.${m}.${p}
|
|
8910
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
8870
8911
|
}
|
|
8871
8912
|
} else {
|
|
8872
8913
|
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
@@ -8885,6 +8926,9 @@ var require_range = __commonJS({
|
|
|
8885
8926
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
8886
8927
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
8887
8928
|
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
8929
|
+
if (invalidXRangeOrder(M, m, p)) {
|
|
8930
|
+
return comp;
|
|
8931
|
+
}
|
|
8888
8932
|
const xM = isX(M);
|
|
8889
8933
|
const xm = xM || isX(m);
|
|
8890
8934
|
const xp = xm || isX(p);
|
|
@@ -8996,9 +9040,9 @@ var require_range = __commonJS({
|
|
|
8996
9040
|
}
|
|
8997
9041
|
});
|
|
8998
9042
|
|
|
8999
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9043
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
|
|
9000
9044
|
var require_comparator = __commonJS({
|
|
9001
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9045
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js"(exports, module) {
|
|
9002
9046
|
"use strict";
|
|
9003
9047
|
var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
|
|
9004
9048
|
var Comparator = class _Comparator {
|
|
@@ -9109,9 +9153,9 @@ var require_comparator = __commonJS({
|
|
|
9109
9153
|
}
|
|
9110
9154
|
});
|
|
9111
9155
|
|
|
9112
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9156
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
|
|
9113
9157
|
var require_satisfies = __commonJS({
|
|
9114
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9158
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
9115
9159
|
"use strict";
|
|
9116
9160
|
var Range = require_range();
|
|
9117
9161
|
var satisfies = (version, range, options) => {
|
|
@@ -9126,9 +9170,9 @@ var require_satisfies = __commonJS({
|
|
|
9126
9170
|
}
|
|
9127
9171
|
});
|
|
9128
9172
|
|
|
9129
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9173
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js
|
|
9130
9174
|
var require_to_comparators = __commonJS({
|
|
9131
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9175
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
9132
9176
|
"use strict";
|
|
9133
9177
|
var Range = require_range();
|
|
9134
9178
|
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
@@ -9136,9 +9180,9 @@ var require_to_comparators = __commonJS({
|
|
|
9136
9180
|
}
|
|
9137
9181
|
});
|
|
9138
9182
|
|
|
9139
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9183
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js
|
|
9140
9184
|
var require_max_satisfying = __commonJS({
|
|
9141
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9185
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js"(exports, module) {
|
|
9142
9186
|
"use strict";
|
|
9143
9187
|
var SemVer = require_semver();
|
|
9144
9188
|
var Range = require_range();
|
|
@@ -9165,9 +9209,9 @@ var require_max_satisfying = __commonJS({
|
|
|
9165
9209
|
}
|
|
9166
9210
|
});
|
|
9167
9211
|
|
|
9168
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9212
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js
|
|
9169
9213
|
var require_min_satisfying = __commonJS({
|
|
9170
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9214
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js"(exports, module) {
|
|
9171
9215
|
"use strict";
|
|
9172
9216
|
var SemVer = require_semver();
|
|
9173
9217
|
var Range = require_range();
|
|
@@ -9194,9 +9238,9 @@ var require_min_satisfying = __commonJS({
|
|
|
9194
9238
|
}
|
|
9195
9239
|
});
|
|
9196
9240
|
|
|
9197
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9241
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js
|
|
9198
9242
|
var require_min_version = __commonJS({
|
|
9199
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9243
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js"(exports, module) {
|
|
9200
9244
|
"use strict";
|
|
9201
9245
|
var SemVer = require_semver();
|
|
9202
9246
|
var Range = require_range();
|
|
@@ -9253,9 +9297,9 @@ var require_min_version = __commonJS({
|
|
|
9253
9297
|
}
|
|
9254
9298
|
});
|
|
9255
9299
|
|
|
9256
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9300
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
|
|
9257
9301
|
var require_valid2 = __commonJS({
|
|
9258
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9302
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js"(exports, module) {
|
|
9259
9303
|
"use strict";
|
|
9260
9304
|
var Range = require_range();
|
|
9261
9305
|
var validRange = (range, options) => {
|
|
@@ -9269,9 +9313,9 @@ var require_valid2 = __commonJS({
|
|
|
9269
9313
|
}
|
|
9270
9314
|
});
|
|
9271
9315
|
|
|
9272
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9316
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js
|
|
9273
9317
|
var require_outside = __commonJS({
|
|
9274
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9318
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js"(exports, module) {
|
|
9275
9319
|
"use strict";
|
|
9276
9320
|
var SemVer = require_semver();
|
|
9277
9321
|
var Comparator = require_comparator();
|
|
@@ -9338,9 +9382,9 @@ var require_outside = __commonJS({
|
|
|
9338
9382
|
}
|
|
9339
9383
|
});
|
|
9340
9384
|
|
|
9341
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9385
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js
|
|
9342
9386
|
var require_gtr = __commonJS({
|
|
9343
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9387
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
9344
9388
|
"use strict";
|
|
9345
9389
|
var outside = require_outside();
|
|
9346
9390
|
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
@@ -9348,9 +9392,9 @@ var require_gtr = __commonJS({
|
|
|
9348
9392
|
}
|
|
9349
9393
|
});
|
|
9350
9394
|
|
|
9351
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9395
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js
|
|
9352
9396
|
var require_ltr = __commonJS({
|
|
9353
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9397
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
9354
9398
|
"use strict";
|
|
9355
9399
|
var outside = require_outside();
|
|
9356
9400
|
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
@@ -9358,9 +9402,9 @@ var require_ltr = __commonJS({
|
|
|
9358
9402
|
}
|
|
9359
9403
|
});
|
|
9360
9404
|
|
|
9361
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9405
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js
|
|
9362
9406
|
var require_intersects = __commonJS({
|
|
9363
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9407
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js"(exports, module) {
|
|
9364
9408
|
"use strict";
|
|
9365
9409
|
var Range = require_range();
|
|
9366
9410
|
var intersects = (r1, r2, options) => {
|
|
@@ -9372,9 +9416,9 @@ var require_intersects = __commonJS({
|
|
|
9372
9416
|
}
|
|
9373
9417
|
});
|
|
9374
9418
|
|
|
9375
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9419
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js
|
|
9376
9420
|
var require_simplify = __commonJS({
|
|
9377
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9421
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
9378
9422
|
"use strict";
|
|
9379
9423
|
var satisfies = require_satisfies();
|
|
9380
9424
|
var compare = require_compare();
|
|
@@ -9422,9 +9466,9 @@ var require_simplify = __commonJS({
|
|
|
9422
9466
|
}
|
|
9423
9467
|
});
|
|
9424
9468
|
|
|
9425
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9469
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js
|
|
9426
9470
|
var require_subset = __commonJS({
|
|
9427
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9471
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js"(exports, module) {
|
|
9428
9472
|
"use strict";
|
|
9429
9473
|
var Range = require_range();
|
|
9430
9474
|
var Comparator = require_comparator();
|
|
@@ -9584,9 +9628,9 @@ var require_subset = __commonJS({
|
|
|
9584
9628
|
}
|
|
9585
9629
|
});
|
|
9586
9630
|
|
|
9587
|
-
// ../../node_modules/.pnpm/semver@7.8.
|
|
9631
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js
|
|
9588
9632
|
var require_semver2 = __commonJS({
|
|
9589
|
-
"../../node_modules/.pnpm/semver@7.8.
|
|
9633
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js"(exports, module) {
|
|
9590
9634
|
"use strict";
|
|
9591
9635
|
var internalRe = require_re();
|
|
9592
9636
|
var constants2 = require_constants();
|
|
@@ -9685,7 +9729,7 @@ var require_semver2 = __commonJS({
|
|
|
9685
9729
|
import fs3 from "fs";
|
|
9686
9730
|
import path5 from "path";
|
|
9687
9731
|
|
|
9688
|
-
// ../../node_modules/.pnpm/conf@
|
|
9732
|
+
// ../../node_modules/.pnpm/conf@15.1.0/node_modules/conf/dist/source/index.js
|
|
9689
9733
|
import { isDeepStrictEqual } from "util";
|
|
9690
9734
|
import process7 from "process";
|
|
9691
9735
|
import fs2 from "fs";
|
|
@@ -9693,7 +9737,7 @@ import path4 from "path";
|
|
|
9693
9737
|
import crypto from "crypto";
|
|
9694
9738
|
import assert from "assert";
|
|
9695
9739
|
|
|
9696
|
-
// ../../node_modules/.pnpm/dot-prop@
|
|
9740
|
+
// ../../node_modules/.pnpm/dot-prop@10.2.0/node_modules/dot-prop/index.js
|
|
9697
9741
|
var isObject = (value) => {
|
|
9698
9742
|
const type = typeof value;
|
|
9699
9743
|
return value !== null && (type === "object" || type === "function");
|
|
@@ -9703,110 +9747,144 @@ var disallowedKeys = /* @__PURE__ */ new Set([
|
|
|
9703
9747
|
"prototype",
|
|
9704
9748
|
"constructor"
|
|
9705
9749
|
]);
|
|
9706
|
-
var
|
|
9707
|
-
|
|
9750
|
+
var maxDisallowedKeyLength = Math.max(...[...disallowedKeys].map((key) => key.length));
|
|
9751
|
+
var MAX_ARRAY_INDEX = 1e6;
|
|
9752
|
+
var isDigit = (character) => character >= "0" && character <= "9";
|
|
9753
|
+
function shouldCoerceToNumber(segment) {
|
|
9754
|
+
if (segment === "0") {
|
|
9755
|
+
return true;
|
|
9756
|
+
}
|
|
9757
|
+
if (/^[1-9]\d*$/.test(segment)) {
|
|
9758
|
+
const parsedNumber = Number.parseInt(segment, 10);
|
|
9759
|
+
return parsedNumber <= Number.MAX_SAFE_INTEGER && parsedNumber <= MAX_ARRAY_INDEX;
|
|
9760
|
+
}
|
|
9761
|
+
return false;
|
|
9762
|
+
}
|
|
9763
|
+
function processSegment(segment, parts) {
|
|
9764
|
+
if (disallowedKeys.has(segment)) {
|
|
9765
|
+
return false;
|
|
9766
|
+
}
|
|
9767
|
+
if (segment && shouldCoerceToNumber(segment)) {
|
|
9768
|
+
parts.push(Number.parseInt(segment, 10));
|
|
9769
|
+
} else {
|
|
9770
|
+
parts.push(segment);
|
|
9771
|
+
}
|
|
9772
|
+
return true;
|
|
9773
|
+
}
|
|
9774
|
+
function parsePath(path7) {
|
|
9775
|
+
if (typeof path7 !== "string") {
|
|
9776
|
+
throw new TypeError(`Expected a string, got ${typeof path7}`);
|
|
9777
|
+
}
|
|
9708
9778
|
const parts = [];
|
|
9709
9779
|
let currentSegment = "";
|
|
9780
|
+
let indexSegment = "";
|
|
9781
|
+
let hadProperty = false;
|
|
9710
9782
|
let currentPart = "start";
|
|
9711
|
-
let
|
|
9783
|
+
let isEscaping = false;
|
|
9784
|
+
let position = 0;
|
|
9712
9785
|
for (const character of path7) {
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
currentSegment += character;
|
|
9723
|
-
}
|
|
9724
|
-
currentPart = "property";
|
|
9725
|
-
isIgnoring = !isIgnoring;
|
|
9726
|
-
break;
|
|
9786
|
+
position++;
|
|
9787
|
+
if (isEscaping) {
|
|
9788
|
+
currentSegment += character;
|
|
9789
|
+
isEscaping = false;
|
|
9790
|
+
continue;
|
|
9791
|
+
}
|
|
9792
|
+
if (character === "\\") {
|
|
9793
|
+
if (currentPart === "index") {
|
|
9794
|
+
throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
9727
9795
|
}
|
|
9796
|
+
if (currentPart === "indexEnd") {
|
|
9797
|
+
throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
9798
|
+
}
|
|
9799
|
+
isEscaping = true;
|
|
9800
|
+
currentPart = currentPart === "start" ? "property" : currentPart;
|
|
9801
|
+
continue;
|
|
9802
|
+
}
|
|
9803
|
+
switch (character) {
|
|
9728
9804
|
case ".": {
|
|
9729
9805
|
if (currentPart === "index") {
|
|
9730
|
-
throw new Error(
|
|
9806
|
+
throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
9731
9807
|
}
|
|
9732
9808
|
if (currentPart === "indexEnd") {
|
|
9733
9809
|
currentPart = "property";
|
|
9734
9810
|
break;
|
|
9735
9811
|
}
|
|
9736
|
-
if (
|
|
9737
|
-
isIgnoring = false;
|
|
9738
|
-
currentSegment += character;
|
|
9739
|
-
break;
|
|
9740
|
-
}
|
|
9741
|
-
if (disallowedKeys.has(currentSegment)) {
|
|
9812
|
+
if (!processSegment(currentSegment, parts)) {
|
|
9742
9813
|
return [];
|
|
9743
9814
|
}
|
|
9744
|
-
parts.push(currentSegment);
|
|
9745
9815
|
currentSegment = "";
|
|
9746
9816
|
currentPart = "property";
|
|
9747
9817
|
break;
|
|
9748
9818
|
}
|
|
9749
9819
|
case "[": {
|
|
9750
9820
|
if (currentPart === "index") {
|
|
9751
|
-
throw new Error(
|
|
9821
|
+
throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
9752
9822
|
}
|
|
9753
9823
|
if (currentPart === "indexEnd") {
|
|
9754
9824
|
currentPart = "index";
|
|
9755
9825
|
break;
|
|
9756
9826
|
}
|
|
9757
|
-
if (
|
|
9758
|
-
|
|
9759
|
-
currentSegment += character;
|
|
9760
|
-
break;
|
|
9761
|
-
}
|
|
9762
|
-
if (currentPart === "property") {
|
|
9763
|
-
if (disallowedKeys.has(currentSegment)) {
|
|
9764
|
-
return [];
|
|
9765
|
-
}
|
|
9766
|
-
parts.push(currentSegment);
|
|
9767
|
-
currentSegment = "";
|
|
9827
|
+
if (currentPart === "property" && currentSegment.length <= maxDisallowedKeyLength && disallowedKeys.has(currentSegment)) {
|
|
9828
|
+
return [];
|
|
9768
9829
|
}
|
|
9830
|
+
hadProperty = currentPart === "property";
|
|
9769
9831
|
currentPart = "index";
|
|
9770
9832
|
break;
|
|
9771
9833
|
}
|
|
9772
9834
|
case "]": {
|
|
9773
|
-
if (currentPart === "
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9835
|
+
if (currentPart === "indexEnd") {
|
|
9836
|
+
throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
9837
|
+
}
|
|
9838
|
+
if (currentPart !== "index") {
|
|
9839
|
+
if (currentPart === "start") {
|
|
9840
|
+
currentPart = "property";
|
|
9841
|
+
}
|
|
9842
|
+
currentSegment += character;
|
|
9777
9843
|
break;
|
|
9778
9844
|
}
|
|
9779
|
-
if (
|
|
9780
|
-
|
|
9845
|
+
if (indexSegment === "") {
|
|
9846
|
+
currentSegment += "[]";
|
|
9847
|
+
currentPart = "property";
|
|
9848
|
+
break;
|
|
9781
9849
|
}
|
|
9850
|
+
if ((currentSegment !== "" || hadProperty) && !processSegment(currentSegment, parts)) {
|
|
9851
|
+
return [];
|
|
9852
|
+
}
|
|
9853
|
+
currentSegment = "";
|
|
9854
|
+
hadProperty = false;
|
|
9855
|
+
const parsedNumber = Number.parseInt(indexSegment, 10);
|
|
9856
|
+
const isValidInteger = parsedNumber <= MAX_ARRAY_INDEX && indexSegment === String(parsedNumber);
|
|
9857
|
+
parts.push(isValidInteger ? parsedNumber : indexSegment);
|
|
9858
|
+
indexSegment = "";
|
|
9859
|
+
currentPart = "indexEnd";
|
|
9860
|
+
break;
|
|
9782
9861
|
}
|
|
9783
9862
|
default: {
|
|
9784
|
-
if (currentPart === "index"
|
|
9785
|
-
|
|
9863
|
+
if (currentPart === "index") {
|
|
9864
|
+
if (!isDigit(character)) {
|
|
9865
|
+
throw new Error(`Invalid character '${character}' in an index at position ${position}`);
|
|
9866
|
+
}
|
|
9867
|
+
indexSegment += character;
|
|
9868
|
+
break;
|
|
9786
9869
|
}
|
|
9787
9870
|
if (currentPart === "indexEnd") {
|
|
9788
|
-
throw new Error(
|
|
9871
|
+
throw new Error(`Invalid character '${character}' after an index at position ${position}`);
|
|
9789
9872
|
}
|
|
9790
9873
|
if (currentPart === "start") {
|
|
9791
9874
|
currentPart = "property";
|
|
9792
9875
|
}
|
|
9793
|
-
if (isIgnoring) {
|
|
9794
|
-
isIgnoring = false;
|
|
9795
|
-
currentSegment += "\\";
|
|
9796
|
-
}
|
|
9797
9876
|
currentSegment += character;
|
|
9798
9877
|
}
|
|
9799
9878
|
}
|
|
9800
9879
|
}
|
|
9801
|
-
if (
|
|
9880
|
+
if (isEscaping) {
|
|
9802
9881
|
currentSegment += "\\";
|
|
9803
9882
|
}
|
|
9804
9883
|
switch (currentPart) {
|
|
9805
9884
|
case "property": {
|
|
9806
|
-
if (
|
|
9885
|
+
if (!processSegment(currentSegment, parts)) {
|
|
9807
9886
|
return [];
|
|
9808
9887
|
}
|
|
9809
|
-
parts.push(currentSegment);
|
|
9810
9888
|
break;
|
|
9811
9889
|
}
|
|
9812
9890
|
case "index": {
|
|
@@ -9819,33 +9897,43 @@ function getPathSegments(path7) {
|
|
|
9819
9897
|
}
|
|
9820
9898
|
return parts;
|
|
9821
9899
|
}
|
|
9822
|
-
function
|
|
9823
|
-
if (typeof
|
|
9824
|
-
|
|
9825
|
-
return Number.isInteger(index) && object[index] === object[key];
|
|
9900
|
+
function normalizePath(path7) {
|
|
9901
|
+
if (typeof path7 === "string") {
|
|
9902
|
+
return parsePath(path7);
|
|
9826
9903
|
}
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9904
|
+
if (Array.isArray(path7)) {
|
|
9905
|
+
const normalized = [];
|
|
9906
|
+
for (const [index, segment] of path7.entries()) {
|
|
9907
|
+
if (typeof segment !== "string" && typeof segment !== "number") {
|
|
9908
|
+
throw new TypeError(`Expected a string or number for path segment at index ${index}, got ${typeof segment}`);
|
|
9909
|
+
}
|
|
9910
|
+
if (typeof segment === "number" && !Number.isFinite(segment)) {
|
|
9911
|
+
throw new TypeError(`Path segment at index ${index} must be a finite number, got ${segment}`);
|
|
9912
|
+
}
|
|
9913
|
+
if (disallowedKeys.has(segment)) {
|
|
9914
|
+
return [];
|
|
9915
|
+
}
|
|
9916
|
+
if (typeof segment === "string" && shouldCoerceToNumber(segment)) {
|
|
9917
|
+
normalized.push(Number.parseInt(segment, 10));
|
|
9918
|
+
} else {
|
|
9919
|
+
normalized.push(segment);
|
|
9920
|
+
}
|
|
9921
|
+
}
|
|
9922
|
+
return normalized;
|
|
9832
9923
|
}
|
|
9924
|
+
return [];
|
|
9833
9925
|
}
|
|
9834
9926
|
function getProperty(object, path7, value) {
|
|
9835
|
-
if (!isObject(object) || typeof path7 !== "string") {
|
|
9927
|
+
if (!isObject(object) || typeof path7 !== "string" && !Array.isArray(path7)) {
|
|
9836
9928
|
return value === void 0 ? object : value;
|
|
9837
9929
|
}
|
|
9838
|
-
const pathArray =
|
|
9930
|
+
const pathArray = normalizePath(path7);
|
|
9839
9931
|
if (pathArray.length === 0) {
|
|
9840
9932
|
return value;
|
|
9841
9933
|
}
|
|
9842
9934
|
for (let index = 0; index < pathArray.length; index++) {
|
|
9843
9935
|
const key = pathArray[index];
|
|
9844
|
-
|
|
9845
|
-
object = index === pathArray.length - 1 ? void 0 : null;
|
|
9846
|
-
} else {
|
|
9847
|
-
object = object[key];
|
|
9848
|
-
}
|
|
9936
|
+
object = object[key];
|
|
9849
9937
|
if (object === void 0 || object === null) {
|
|
9850
9938
|
if (index !== pathArray.length - 1) {
|
|
9851
9939
|
return value;
|
|
@@ -9856,51 +9944,67 @@ function getProperty(object, path7, value) {
|
|
|
9856
9944
|
return object === void 0 ? value : object;
|
|
9857
9945
|
}
|
|
9858
9946
|
function setProperty(object, path7, value) {
|
|
9859
|
-
if (!isObject(object) || typeof path7 !== "string") {
|
|
9947
|
+
if (!isObject(object) || typeof path7 !== "string" && !Array.isArray(path7)) {
|
|
9860
9948
|
return object;
|
|
9861
9949
|
}
|
|
9862
9950
|
const root = object;
|
|
9863
|
-
const pathArray =
|
|
9951
|
+
const pathArray = normalizePath(path7);
|
|
9952
|
+
if (pathArray.length === 0) {
|
|
9953
|
+
return object;
|
|
9954
|
+
}
|
|
9864
9955
|
for (let index = 0; index < pathArray.length; index++) {
|
|
9865
9956
|
const key = pathArray[index];
|
|
9866
|
-
assertNotStringIndex(object, key);
|
|
9867
9957
|
if (index === pathArray.length - 1) {
|
|
9868
9958
|
object[key] = value;
|
|
9869
|
-
|
|
9870
|
-
object[key] = typeof pathArray[index + 1] === "number" ? [] : {};
|
|
9959
|
+
continue;
|
|
9871
9960
|
}
|
|
9961
|
+
const existingValue = object[key];
|
|
9962
|
+
if (isObject(existingValue)) {
|
|
9963
|
+
object = existingValue;
|
|
9964
|
+
continue;
|
|
9965
|
+
}
|
|
9966
|
+
const nextKey = pathArray[index + 1];
|
|
9967
|
+
const shouldCreateArray = typeof nextKey === "number";
|
|
9968
|
+
object[key] = shouldCreateArray ? [] : {};
|
|
9872
9969
|
object = object[key];
|
|
9873
9970
|
}
|
|
9874
9971
|
return root;
|
|
9875
9972
|
}
|
|
9876
9973
|
function deleteProperty(object, path7) {
|
|
9877
|
-
if (!isObject(object) || typeof path7 !== "string") {
|
|
9974
|
+
if (!isObject(object) || typeof path7 !== "string" && !Array.isArray(path7)) {
|
|
9975
|
+
return false;
|
|
9976
|
+
}
|
|
9977
|
+
const pathArray = normalizePath(path7);
|
|
9978
|
+
if (pathArray.length === 0) {
|
|
9878
9979
|
return false;
|
|
9879
9980
|
}
|
|
9880
|
-
const pathArray = getPathSegments(path7);
|
|
9881
9981
|
for (let index = 0; index < pathArray.length; index++) {
|
|
9882
9982
|
const key = pathArray[index];
|
|
9883
|
-
assertNotStringIndex(object, key);
|
|
9884
9983
|
if (index === pathArray.length - 1) {
|
|
9984
|
+
const existed = Object.hasOwn(object, key);
|
|
9985
|
+
if (!existed) {
|
|
9986
|
+
return false;
|
|
9987
|
+
}
|
|
9885
9988
|
delete object[key];
|
|
9886
9989
|
return true;
|
|
9887
9990
|
}
|
|
9888
|
-
|
|
9889
|
-
if (!isObject(
|
|
9991
|
+
const existingValue = object[key];
|
|
9992
|
+
if (!isObject(existingValue)) {
|
|
9890
9993
|
return false;
|
|
9891
9994
|
}
|
|
9995
|
+
object = existingValue;
|
|
9892
9996
|
}
|
|
9893
9997
|
}
|
|
9894
9998
|
function hasProperty(object, path7) {
|
|
9895
|
-
if (!isObject(object) || typeof path7 !== "string") {
|
|
9999
|
+
if (!isObject(object) || typeof path7 !== "string" && !Array.isArray(path7)) {
|
|
9896
10000
|
return false;
|
|
9897
10001
|
}
|
|
9898
|
-
const pathArray =
|
|
10002
|
+
const pathArray = normalizePath(path7);
|
|
9899
10003
|
if (pathArray.length === 0) {
|
|
9900
10004
|
return false;
|
|
9901
10005
|
}
|
|
9902
10006
|
for (const key of pathArray) {
|
|
9903
|
-
if (!isObject(object) || !(key in object)
|
|
10007
|
+
if (!isObject(object) || !(key in object)) {
|
|
9904
10008
|
return false;
|
|
9905
10009
|
}
|
|
9906
10010
|
object = object[key];
|
|
@@ -10364,7 +10468,7 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
10364
10468
|
}
|
|
10365
10469
|
}
|
|
10366
10470
|
|
|
10367
|
-
// ../../node_modules/.pnpm/conf@
|
|
10471
|
+
// ../../node_modules/.pnpm/conf@15.1.0/node_modules/conf/dist/source/index.js
|
|
10368
10472
|
var import__ = __toESM(require__(), 1);
|
|
10369
10473
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
10370
10474
|
|
|
@@ -10482,7 +10586,7 @@ var debounceFunction = (inputFunction, options = {}) => {
|
|
|
10482
10586
|
};
|
|
10483
10587
|
var debounce_fn_default = debounceFunction;
|
|
10484
10588
|
|
|
10485
|
-
// ../../node_modules/.pnpm/conf@
|
|
10589
|
+
// ../../node_modules/.pnpm/conf@15.1.0/node_modules/conf/dist/source/index.js
|
|
10486
10590
|
var import_semver = __toESM(require_semver2(), 1);
|
|
10487
10591
|
|
|
10488
10592
|
// ../../node_modules/.pnpm/uint8array-extras@1.5.0/node_modules/uint8array-extras/index.js
|
|
@@ -10551,11 +10655,16 @@ function stringToUint8Array(string) {
|
|
|
10551
10655
|
}
|
|
10552
10656
|
var byteToHexLookupTable = Array.from({ length: 256 }, (_, index) => index.toString(16).padStart(2, "0"));
|
|
10553
10657
|
|
|
10554
|
-
// ../../node_modules/.pnpm/conf@
|
|
10555
|
-
var
|
|
10556
|
-
var
|
|
10658
|
+
// ../../node_modules/.pnpm/conf@15.1.0/node_modules/conf/dist/source/index.js
|
|
10659
|
+
var defaultEncryptionAlgorithm = "aes-256-cbc";
|
|
10660
|
+
var supportedEncryptionAlgorithms = /* @__PURE__ */ new Set([
|
|
10661
|
+
"aes-256-cbc",
|
|
10662
|
+
"aes-256-gcm",
|
|
10663
|
+
"aes-256-ctr"
|
|
10664
|
+
]);
|
|
10665
|
+
var isSupportedEncryptionAlgorithm = (value) => typeof value === "string" && supportedEncryptionAlgorithms.has(value);
|
|
10557
10666
|
var createPlainObject = () => /* @__PURE__ */ Object.create(null);
|
|
10558
|
-
var isExist = (data) => data !== void 0
|
|
10667
|
+
var isExist = (data) => data !== void 0;
|
|
10559
10668
|
var checkValueType = (key, value) => {
|
|
10560
10669
|
const nonJsonTypes = /* @__PURE__ */ new Set([
|
|
10561
10670
|
"undefined",
|
|
@@ -10574,77 +10683,24 @@ var Conf = class {
|
|
|
10574
10683
|
events;
|
|
10575
10684
|
#validator;
|
|
10576
10685
|
#encryptionKey;
|
|
10686
|
+
#encryptionAlgorithm;
|
|
10577
10687
|
#options;
|
|
10578
10688
|
#defaultValues = {};
|
|
10689
|
+
#isInMigration = false;
|
|
10690
|
+
#watcher;
|
|
10691
|
+
#watchFile;
|
|
10692
|
+
#debouncedChangeHandler;
|
|
10579
10693
|
constructor(partialOptions = {}) {
|
|
10580
|
-
const options =
|
|
10581
|
-
configName: "config",
|
|
10582
|
-
fileExtension: "json",
|
|
10583
|
-
projectSuffix: "nodejs",
|
|
10584
|
-
clearInvalidConfig: false,
|
|
10585
|
-
accessPropertiesByDotNotation: true,
|
|
10586
|
-
configFileMode: 438,
|
|
10587
|
-
...partialOptions
|
|
10588
|
-
};
|
|
10589
|
-
if (!options.cwd) {
|
|
10590
|
-
if (!options.projectName) {
|
|
10591
|
-
throw new Error("Please specify the `projectName` option.");
|
|
10592
|
-
}
|
|
10593
|
-
options.cwd = envPaths(options.projectName, { suffix: options.projectSuffix }).config;
|
|
10594
|
-
}
|
|
10694
|
+
const options = this.#prepareOptions(partialOptions);
|
|
10595
10695
|
this.#options = options;
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
}
|
|
10600
|
-
const ajv = new import__.Ajv2020({
|
|
10601
|
-
allErrors: true,
|
|
10602
|
-
useDefaults: true,
|
|
10603
|
-
...options.ajvOptions
|
|
10604
|
-
});
|
|
10605
|
-
ajvFormats(ajv);
|
|
10606
|
-
const schema = {
|
|
10607
|
-
...options.rootSchema,
|
|
10608
|
-
type: "object",
|
|
10609
|
-
properties: options.schema
|
|
10610
|
-
};
|
|
10611
|
-
this.#validator = ajv.compile(schema);
|
|
10612
|
-
for (const [key, value] of Object.entries(options.schema ?? {})) {
|
|
10613
|
-
if (value?.default) {
|
|
10614
|
-
this.#defaultValues[key] = value.default;
|
|
10615
|
-
}
|
|
10616
|
-
}
|
|
10617
|
-
}
|
|
10618
|
-
if (options.defaults) {
|
|
10619
|
-
this.#defaultValues = {
|
|
10620
|
-
...this.#defaultValues,
|
|
10621
|
-
...options.defaults
|
|
10622
|
-
};
|
|
10623
|
-
}
|
|
10624
|
-
if (options.serialize) {
|
|
10625
|
-
this._serialize = options.serialize;
|
|
10626
|
-
}
|
|
10627
|
-
if (options.deserialize) {
|
|
10628
|
-
this._deserialize = options.deserialize;
|
|
10629
|
-
}
|
|
10696
|
+
this.#setupValidator(options);
|
|
10697
|
+
this.#applyDefaultValues(options);
|
|
10698
|
+
this.#configureSerialization(options);
|
|
10630
10699
|
this.events = new EventTarget();
|
|
10631
10700
|
this.#encryptionKey = options.encryptionKey;
|
|
10632
|
-
|
|
10633
|
-
this.path =
|
|
10634
|
-
|
|
10635
|
-
const store = Object.assign(createPlainObject(), options.defaults, fileStore);
|
|
10636
|
-
if (options.migrations) {
|
|
10637
|
-
if (!options.projectVersion) {
|
|
10638
|
-
throw new Error("Please specify the `projectVersion` option.");
|
|
10639
|
-
}
|
|
10640
|
-
this._migrate(options.migrations, options.projectVersion, options.beforeEachMigration);
|
|
10641
|
-
}
|
|
10642
|
-
this._validate(store);
|
|
10643
|
-
try {
|
|
10644
|
-
assert.deepEqual(fileStore, store);
|
|
10645
|
-
} catch {
|
|
10646
|
-
this.store = store;
|
|
10647
|
-
}
|
|
10701
|
+
this.#encryptionAlgorithm = options.encryptionAlgorithm ?? defaultEncryptionAlgorithm;
|
|
10702
|
+
this.path = this.#resolvePath(options);
|
|
10703
|
+
this.#initializeStore(options);
|
|
10648
10704
|
if (options.watch) {
|
|
10649
10705
|
this._watch();
|
|
10650
10706
|
}
|
|
@@ -10672,6 +10728,9 @@ var Conf = class {
|
|
|
10672
10728
|
if (this.#options.accessPropertiesByDotNotation) {
|
|
10673
10729
|
setProperty(store, key2, value2);
|
|
10674
10730
|
} else {
|
|
10731
|
+
if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") {
|
|
10732
|
+
return;
|
|
10733
|
+
}
|
|
10675
10734
|
store[key2] = value2;
|
|
10676
10735
|
}
|
|
10677
10736
|
};
|
|
@@ -10685,17 +10744,20 @@ var Conf = class {
|
|
|
10685
10744
|
}
|
|
10686
10745
|
this.store = store;
|
|
10687
10746
|
}
|
|
10688
|
-
/**
|
|
10689
|
-
Check if an item exists.
|
|
10690
|
-
|
|
10691
|
-
@param key - The key of the item to check.
|
|
10692
|
-
*/
|
|
10693
10747
|
has(key) {
|
|
10694
10748
|
if (this.#options.accessPropertiesByDotNotation) {
|
|
10695
10749
|
return hasProperty(this.store, key);
|
|
10696
10750
|
}
|
|
10697
10751
|
return key in this.store;
|
|
10698
10752
|
}
|
|
10753
|
+
appendToArray(key, value) {
|
|
10754
|
+
checkValueType(key, value);
|
|
10755
|
+
const array = this.#options.accessPropertiesByDotNotation ? this._get(key, []) : key in this.store ? this.store[key] : [];
|
|
10756
|
+
if (!Array.isArray(array)) {
|
|
10757
|
+
throw new TypeError(`The key \`${key}\` is already set to a non-array value`);
|
|
10758
|
+
}
|
|
10759
|
+
this.set(key, [...array, value]);
|
|
10760
|
+
}
|
|
10699
10761
|
/**
|
|
10700
10762
|
Reset items to their default values, as defined by the `defaults` or `schema` option.
|
|
10701
10763
|
|
|
@@ -10725,18 +10787,19 @@ var Conf = class {
|
|
|
10725
10787
|
This resets known items to their default values, if defined by the `defaults` or `schema` option.
|
|
10726
10788
|
*/
|
|
10727
10789
|
clear() {
|
|
10728
|
-
|
|
10790
|
+
const newStore = createPlainObject();
|
|
10729
10791
|
for (const key of Object.keys(this.#defaultValues)) {
|
|
10730
|
-
this
|
|
10792
|
+
if (isExist(this.#defaultValues[key])) {
|
|
10793
|
+
checkValueType(key, this.#defaultValues[key]);
|
|
10794
|
+
if (this.#options.accessPropertiesByDotNotation) {
|
|
10795
|
+
setProperty(newStore, key, this.#defaultValues[key]);
|
|
10796
|
+
} else {
|
|
10797
|
+
newStore[key] = this.#defaultValues[key];
|
|
10798
|
+
}
|
|
10799
|
+
}
|
|
10731
10800
|
}
|
|
10801
|
+
this.store = newStore;
|
|
10732
10802
|
}
|
|
10733
|
-
/**
|
|
10734
|
-
Watches the given `key`, calling `callback` on any changes.
|
|
10735
|
-
|
|
10736
|
-
@param key - The key to watch.
|
|
10737
|
-
@param callback - A callback function that is called on any changes. When a `key` is first set `oldValue` will be `undefined`, and when a key is deleted `newValue` will be `undefined`.
|
|
10738
|
-
@returns A function, that when called, will unsubscribe.
|
|
10739
|
-
*/
|
|
10740
10803
|
onDidChange(key, callback) {
|
|
10741
10804
|
if (typeof key !== "string") {
|
|
10742
10805
|
throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof key}`);
|
|
@@ -10744,7 +10807,7 @@ var Conf = class {
|
|
|
10744
10807
|
if (typeof callback !== "function") {
|
|
10745
10808
|
throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof callback}`);
|
|
10746
10809
|
}
|
|
10747
|
-
return this.
|
|
10810
|
+
return this._handleValueChange(() => this.get(key), callback);
|
|
10748
10811
|
}
|
|
10749
10812
|
/**
|
|
10750
10813
|
Watches the whole config object, calling `callback` on any changes.
|
|
@@ -10756,56 +10819,171 @@ var Conf = class {
|
|
|
10756
10819
|
if (typeof callback !== "function") {
|
|
10757
10820
|
throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof callback}`);
|
|
10758
10821
|
}
|
|
10759
|
-
return this.
|
|
10822
|
+
return this._handleStoreChange(callback);
|
|
10760
10823
|
}
|
|
10761
10824
|
get size() {
|
|
10762
|
-
|
|
10825
|
+
const entries = Object.keys(this.store);
|
|
10826
|
+
return entries.filter((key) => !this._isReservedKeyPath(key)).length;
|
|
10763
10827
|
}
|
|
10828
|
+
/**
|
|
10829
|
+
Get all the config as an object or replace the current config with an object.
|
|
10830
|
+
|
|
10831
|
+
@example
|
|
10832
|
+
```
|
|
10833
|
+
console.log(config.store);
|
|
10834
|
+
//=> {name: 'John', age: 30}
|
|
10835
|
+
```
|
|
10836
|
+
|
|
10837
|
+
@example
|
|
10838
|
+
```
|
|
10839
|
+
config.store = {
|
|
10840
|
+
hello: 'world'
|
|
10841
|
+
};
|
|
10842
|
+
```
|
|
10843
|
+
*/
|
|
10764
10844
|
get store() {
|
|
10765
10845
|
try {
|
|
10766
10846
|
const data = fs2.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
|
|
10767
|
-
const dataString = this.
|
|
10768
|
-
const
|
|
10769
|
-
|
|
10770
|
-
|
|
10847
|
+
const dataString = this._decryptData(data);
|
|
10848
|
+
const parseStore = (value) => {
|
|
10849
|
+
const deserializedData = this._deserialize(value);
|
|
10850
|
+
if (!this.#isInMigration) {
|
|
10851
|
+
this._validate(deserializedData);
|
|
10852
|
+
}
|
|
10853
|
+
return Object.assign(createPlainObject(), deserializedData);
|
|
10854
|
+
};
|
|
10855
|
+
return parseStore(dataString);
|
|
10771
10856
|
} catch (error) {
|
|
10772
10857
|
if (error?.code === "ENOENT") {
|
|
10773
10858
|
this._ensureDirectory();
|
|
10774
10859
|
return createPlainObject();
|
|
10775
10860
|
}
|
|
10776
|
-
if (this.#options.clearInvalidConfig
|
|
10777
|
-
|
|
10861
|
+
if (this.#options.clearInvalidConfig) {
|
|
10862
|
+
const errorInstance = error;
|
|
10863
|
+
if (errorInstance.name === "SyntaxError") {
|
|
10864
|
+
return createPlainObject();
|
|
10865
|
+
}
|
|
10866
|
+
if (errorInstance.message?.startsWith("Config schema violation:")) {
|
|
10867
|
+
return createPlainObject();
|
|
10868
|
+
}
|
|
10869
|
+
if (errorInstance.message === "Failed to decrypt config data.") {
|
|
10870
|
+
return createPlainObject();
|
|
10871
|
+
}
|
|
10778
10872
|
}
|
|
10779
10873
|
throw error;
|
|
10780
10874
|
}
|
|
10781
10875
|
}
|
|
10782
10876
|
set store(value) {
|
|
10783
10877
|
this._ensureDirectory();
|
|
10784
|
-
|
|
10878
|
+
if (!hasProperty(value, INTERNAL_KEY)) {
|
|
10879
|
+
try {
|
|
10880
|
+
const data = fs2.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
|
|
10881
|
+
const dataString = this._decryptData(data);
|
|
10882
|
+
const currentStore = this._deserialize(dataString);
|
|
10883
|
+
if (hasProperty(currentStore, INTERNAL_KEY)) {
|
|
10884
|
+
setProperty(value, INTERNAL_KEY, getProperty(currentStore, INTERNAL_KEY));
|
|
10885
|
+
}
|
|
10886
|
+
} catch {
|
|
10887
|
+
}
|
|
10888
|
+
}
|
|
10889
|
+
if (!this.#isInMigration) {
|
|
10890
|
+
this._validate(value);
|
|
10891
|
+
}
|
|
10785
10892
|
this._write(value);
|
|
10786
10893
|
this.events.dispatchEvent(new Event("change"));
|
|
10787
10894
|
}
|
|
10788
10895
|
*[Symbol.iterator]() {
|
|
10789
10896
|
for (const [key, value] of Object.entries(this.store)) {
|
|
10790
|
-
|
|
10897
|
+
if (!this._isReservedKeyPath(key)) {
|
|
10898
|
+
yield [key, value];
|
|
10899
|
+
}
|
|
10791
10900
|
}
|
|
10792
10901
|
}
|
|
10793
|
-
|
|
10794
|
-
|
|
10902
|
+
/**
|
|
10903
|
+
Close the file watcher if one exists. This is useful in tests to prevent the process from hanging.
|
|
10904
|
+
*/
|
|
10905
|
+
_closeWatcher() {
|
|
10906
|
+
if (this.#watcher) {
|
|
10907
|
+
this.#watcher.close();
|
|
10908
|
+
this.#watcher = void 0;
|
|
10909
|
+
}
|
|
10910
|
+
if (this.#watchFile) {
|
|
10911
|
+
fs2.unwatchFile(this.path);
|
|
10912
|
+
this.#watchFile = false;
|
|
10913
|
+
}
|
|
10914
|
+
this.#debouncedChangeHandler = void 0;
|
|
10915
|
+
}
|
|
10916
|
+
_decryptData(data) {
|
|
10917
|
+
const encryptionKey = this.#encryptionKey;
|
|
10918
|
+
if (!encryptionKey) {
|
|
10795
10919
|
return typeof data === "string" ? data : uint8ArrayToString(data);
|
|
10796
10920
|
}
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10921
|
+
const encryptionAlgorithm = this.#encryptionAlgorithm;
|
|
10922
|
+
const authenticationTagLength = encryptionAlgorithm === "aes-256-gcm" ? 16 : 0;
|
|
10923
|
+
const separatorCodePoint = ":".codePointAt(0);
|
|
10924
|
+
const separatorByte = typeof data === "string" ? data.codePointAt(16) : data[16];
|
|
10925
|
+
const hasSeparator = separatorCodePoint !== void 0 && separatorByte === separatorCodePoint;
|
|
10926
|
+
if (!hasSeparator) {
|
|
10927
|
+
if (encryptionAlgorithm === "aes-256-cbc") {
|
|
10928
|
+
return typeof data === "string" ? data : uint8ArrayToString(data);
|
|
10929
|
+
}
|
|
10930
|
+
throw new Error("Failed to decrypt config data.");
|
|
10931
|
+
}
|
|
10932
|
+
const getEncryptedPayload = (dataUpdate2) => {
|
|
10933
|
+
if (authenticationTagLength === 0) {
|
|
10934
|
+
return { ciphertext: dataUpdate2 };
|
|
10935
|
+
}
|
|
10936
|
+
const authenticationTagStart = dataUpdate2.length - authenticationTagLength;
|
|
10937
|
+
if (authenticationTagStart < 0) {
|
|
10938
|
+
throw new Error("Invalid authentication tag length.");
|
|
10939
|
+
}
|
|
10940
|
+
return {
|
|
10941
|
+
ciphertext: dataUpdate2.slice(0, authenticationTagStart),
|
|
10942
|
+
authenticationTag: dataUpdate2.slice(authenticationTagStart)
|
|
10943
|
+
};
|
|
10944
|
+
};
|
|
10945
|
+
const initializationVector = data.slice(0, 16);
|
|
10946
|
+
const slice = data.slice(17);
|
|
10947
|
+
const dataUpdate = typeof slice === "string" ? stringToUint8Array(slice) : slice;
|
|
10948
|
+
const decrypt = (salt) => {
|
|
10949
|
+
const { ciphertext, authenticationTag } = getEncryptedPayload(dataUpdate);
|
|
10950
|
+
const password = crypto.pbkdf2Sync(encryptionKey, salt, 1e4, 32, "sha512");
|
|
10800
10951
|
const decipher = crypto.createDecipheriv(encryptionAlgorithm, password, initializationVector);
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10952
|
+
if (authenticationTag) {
|
|
10953
|
+
decipher.setAuthTag(authenticationTag);
|
|
10954
|
+
}
|
|
10955
|
+
return uint8ArrayToString(concatUint8Arrays([decipher.update(ciphertext), decipher.final()]));
|
|
10956
|
+
};
|
|
10957
|
+
try {
|
|
10958
|
+
return decrypt(initializationVector);
|
|
10804
10959
|
} catch {
|
|
10960
|
+
try {
|
|
10961
|
+
return decrypt(initializationVector.toString());
|
|
10962
|
+
} catch {
|
|
10963
|
+
}
|
|
10964
|
+
}
|
|
10965
|
+
if (encryptionAlgorithm === "aes-256-cbc") {
|
|
10966
|
+
return typeof data === "string" ? data : uint8ArrayToString(data);
|
|
10805
10967
|
}
|
|
10806
|
-
|
|
10968
|
+
throw new Error("Failed to decrypt config data.");
|
|
10807
10969
|
}
|
|
10808
|
-
|
|
10970
|
+
_handleStoreChange(callback) {
|
|
10971
|
+
let currentValue = this.store;
|
|
10972
|
+
const onChange = () => {
|
|
10973
|
+
const oldValue = currentValue;
|
|
10974
|
+
const newValue = this.store;
|
|
10975
|
+
if (isDeepStrictEqual(newValue, oldValue)) {
|
|
10976
|
+
return;
|
|
10977
|
+
}
|
|
10978
|
+
currentValue = newValue;
|
|
10979
|
+
callback.call(this, newValue, oldValue);
|
|
10980
|
+
};
|
|
10981
|
+
this.events.addEventListener("change", onChange);
|
|
10982
|
+
return () => {
|
|
10983
|
+
this.events.removeEventListener("change", onChange);
|
|
10984
|
+
};
|
|
10985
|
+
}
|
|
10986
|
+
_handleValueChange(getter, callback) {
|
|
10809
10987
|
let currentValue = getter();
|
|
10810
10988
|
const onChange = () => {
|
|
10811
10989
|
const oldValue = currentValue;
|
|
@@ -10839,11 +11017,17 @@ var Conf = class {
|
|
|
10839
11017
|
}
|
|
10840
11018
|
_write(value) {
|
|
10841
11019
|
let data = this._serialize(value);
|
|
10842
|
-
|
|
11020
|
+
const encryptionKey = this.#encryptionKey;
|
|
11021
|
+
if (encryptionKey) {
|
|
10843
11022
|
const initializationVector = crypto.randomBytes(16);
|
|
10844
|
-
const password = crypto.pbkdf2Sync(
|
|
10845
|
-
const cipher = crypto.createCipheriv(encryptionAlgorithm, password, initializationVector);
|
|
10846
|
-
|
|
11023
|
+
const password = crypto.pbkdf2Sync(encryptionKey, initializationVector, 1e4, 32, "sha512");
|
|
11024
|
+
const cipher = crypto.createCipheriv(this.#encryptionAlgorithm, password, initializationVector);
|
|
11025
|
+
const encryptedData = concatUint8Arrays([cipher.update(stringToUint8Array(data)), cipher.final()]);
|
|
11026
|
+
const encryptedParts = [initializationVector, stringToUint8Array(":"), encryptedData];
|
|
11027
|
+
if (this.#encryptionAlgorithm === "aes-256-gcm") {
|
|
11028
|
+
encryptedParts.push(cipher.getAuthTag());
|
|
11029
|
+
}
|
|
11030
|
+
data = concatUint8Arrays(encryptedParts);
|
|
10847
11031
|
}
|
|
10848
11032
|
if (process7.env.SNAP) {
|
|
10849
11033
|
fs2.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
@@ -10864,20 +11048,36 @@ var Conf = class {
|
|
|
10864
11048
|
if (!fs2.existsSync(this.path)) {
|
|
10865
11049
|
this._write(createPlainObject());
|
|
10866
11050
|
}
|
|
10867
|
-
if (process7.platform === "win32") {
|
|
10868
|
-
|
|
11051
|
+
if (process7.platform === "win32" || process7.platform === "darwin") {
|
|
11052
|
+
this.#debouncedChangeHandler ??= debounce_fn_default(() => {
|
|
10869
11053
|
this.events.dispatchEvent(new Event("change"));
|
|
10870
|
-
}, { wait: 100 })
|
|
11054
|
+
}, { wait: 100 });
|
|
11055
|
+
const directory = path4.dirname(this.path);
|
|
11056
|
+
const basename = path4.basename(this.path);
|
|
11057
|
+
this.#watcher = fs2.watch(directory, { persistent: false, encoding: "utf8" }, (_eventType, filename) => {
|
|
11058
|
+
if (filename && filename !== basename) {
|
|
11059
|
+
return;
|
|
11060
|
+
}
|
|
11061
|
+
if (typeof this.#debouncedChangeHandler === "function") {
|
|
11062
|
+
this.#debouncedChangeHandler();
|
|
11063
|
+
}
|
|
11064
|
+
});
|
|
10871
11065
|
} else {
|
|
10872
|
-
|
|
11066
|
+
this.#debouncedChangeHandler ??= debounce_fn_default(() => {
|
|
10873
11067
|
this.events.dispatchEvent(new Event("change"));
|
|
10874
|
-
}, { wait:
|
|
11068
|
+
}, { wait: 1e3 });
|
|
11069
|
+
fs2.watchFile(this.path, { persistent: false }, (_current, _previous) => {
|
|
11070
|
+
if (typeof this.#debouncedChangeHandler === "function") {
|
|
11071
|
+
this.#debouncedChangeHandler();
|
|
11072
|
+
}
|
|
11073
|
+
});
|
|
11074
|
+
this.#watchFile = true;
|
|
10875
11075
|
}
|
|
10876
11076
|
}
|
|
10877
11077
|
_migrate(migrations, versionToMigrate, beforeEachMigration) {
|
|
10878
11078
|
let previousMigratedVersion = this._get(MIGRATION_KEY, "0.0.0");
|
|
10879
11079
|
const newerVersions = Object.keys(migrations).filter((candidateVersion) => this._shouldPerformMigration(candidateVersion, previousMigratedVersion, versionToMigrate));
|
|
10880
|
-
let storeBackup =
|
|
11080
|
+
let storeBackup = structuredClone(this.store);
|
|
10881
11081
|
for (const version of newerVersions) {
|
|
10882
11082
|
try {
|
|
10883
11083
|
if (beforeEachMigration) {
|
|
@@ -10892,10 +11092,11 @@ var Conf = class {
|
|
|
10892
11092
|
migration?.(this);
|
|
10893
11093
|
this._set(MIGRATION_KEY, version);
|
|
10894
11094
|
previousMigratedVersion = version;
|
|
10895
|
-
storeBackup =
|
|
11095
|
+
storeBackup = structuredClone(this.store);
|
|
10896
11096
|
} catch (error) {
|
|
10897
11097
|
this.store = storeBackup;
|
|
10898
|
-
|
|
11098
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11099
|
+
throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${errorMessage}`);
|
|
10899
11100
|
}
|
|
10900
11101
|
}
|
|
10901
11102
|
if (this._isVersionInRangeFormat(previousMigratedVersion) || !import_semver.default.eq(previousMigratedVersion, versionToMigrate)) {
|
|
@@ -10903,23 +11104,31 @@ var Conf = class {
|
|
|
10903
11104
|
}
|
|
10904
11105
|
}
|
|
10905
11106
|
_containsReservedKey(key) {
|
|
10906
|
-
if (typeof key === "
|
|
10907
|
-
|
|
10908
|
-
if (firsKey === INTERNAL_KEY) {
|
|
10909
|
-
return true;
|
|
10910
|
-
}
|
|
11107
|
+
if (typeof key === "string") {
|
|
11108
|
+
return this._isReservedKeyPath(key);
|
|
10911
11109
|
}
|
|
10912
|
-
if (typeof key !== "
|
|
11110
|
+
if (!key || typeof key !== "object") {
|
|
10913
11111
|
return false;
|
|
10914
11112
|
}
|
|
10915
|
-
|
|
10916
|
-
|
|
11113
|
+
return this._objectContainsReservedKey(key);
|
|
11114
|
+
}
|
|
11115
|
+
_objectContainsReservedKey(value) {
|
|
11116
|
+
if (!value || typeof value !== "object") {
|
|
11117
|
+
return false;
|
|
11118
|
+
}
|
|
11119
|
+
for (const [candidateKey, candidateValue] of Object.entries(value)) {
|
|
11120
|
+
if (this._isReservedKeyPath(candidateKey)) {
|
|
11121
|
+
return true;
|
|
11122
|
+
}
|
|
11123
|
+
if (this._objectContainsReservedKey(candidateValue)) {
|
|
10917
11124
|
return true;
|
|
10918
11125
|
}
|
|
10919
|
-
return false;
|
|
10920
11126
|
}
|
|
10921
11127
|
return false;
|
|
10922
11128
|
}
|
|
11129
|
+
_isReservedKeyPath(candidate) {
|
|
11130
|
+
return candidate === INTERNAL_KEY || candidate.startsWith(`${INTERNAL_KEY}.`);
|
|
11131
|
+
}
|
|
10923
11132
|
_isVersionInRangeFormat(version) {
|
|
10924
11133
|
return import_semver.default.clean(version) === null;
|
|
10925
11134
|
}
|
|
@@ -10946,32 +11155,150 @@ var Conf = class {
|
|
|
10946
11155
|
setProperty(store, key, value);
|
|
10947
11156
|
this.store = store;
|
|
10948
11157
|
}
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
};
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
}
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
11158
|
+
#prepareOptions(partialOptions) {
|
|
11159
|
+
const options = {
|
|
11160
|
+
configName: "config",
|
|
11161
|
+
fileExtension: "json",
|
|
11162
|
+
projectSuffix: "nodejs",
|
|
11163
|
+
clearInvalidConfig: false,
|
|
11164
|
+
accessPropertiesByDotNotation: true,
|
|
11165
|
+
configFileMode: 438,
|
|
11166
|
+
...partialOptions
|
|
11167
|
+
};
|
|
11168
|
+
options.encryptionAlgorithm ??= defaultEncryptionAlgorithm;
|
|
11169
|
+
if (!isSupportedEncryptionAlgorithm(options.encryptionAlgorithm)) {
|
|
11170
|
+
throw new TypeError(`The \`encryptionAlgorithm\` option must be one of: ${[...supportedEncryptionAlgorithms].join(", ")}`);
|
|
11171
|
+
}
|
|
11172
|
+
if (!options.cwd) {
|
|
11173
|
+
if (!options.projectName) {
|
|
11174
|
+
throw new Error("Please specify the `projectName` option.");
|
|
11175
|
+
}
|
|
11176
|
+
options.cwd = envPaths(options.projectName, { suffix: options.projectSuffix }).config;
|
|
11177
|
+
}
|
|
11178
|
+
if (typeof options.fileExtension === "string") {
|
|
11179
|
+
options.fileExtension = options.fileExtension.replace(/^\.+/, "");
|
|
11180
|
+
}
|
|
11181
|
+
return options;
|
|
10970
11182
|
}
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
11183
|
+
#setupValidator(options) {
|
|
11184
|
+
if (!(options.schema ?? options.ajvOptions ?? options.rootSchema)) {
|
|
11185
|
+
return;
|
|
11186
|
+
}
|
|
11187
|
+
if (options.schema && typeof options.schema !== "object") {
|
|
11188
|
+
throw new TypeError("The `schema` option must be an object.");
|
|
11189
|
+
}
|
|
11190
|
+
const ajvFormats = import_ajv_formats.default.default;
|
|
11191
|
+
const ajv = new import__.Ajv2020({
|
|
11192
|
+
allErrors: true,
|
|
11193
|
+
useDefaults: true,
|
|
11194
|
+
...options.ajvOptions
|
|
11195
|
+
});
|
|
11196
|
+
ajvFormats(ajv);
|
|
11197
|
+
const schema = {
|
|
11198
|
+
...options.rootSchema,
|
|
11199
|
+
type: "object",
|
|
11200
|
+
properties: options.schema
|
|
11201
|
+
};
|
|
11202
|
+
this.#validator = ajv.compile(schema);
|
|
11203
|
+
this.#captureSchemaDefaults(options.schema);
|
|
11204
|
+
}
|
|
11205
|
+
#captureSchemaDefaults(schemaConfig) {
|
|
11206
|
+
const schemaEntries = Object.entries(schemaConfig ?? {});
|
|
11207
|
+
for (const [key, schemaDefinition] of schemaEntries) {
|
|
11208
|
+
if (!schemaDefinition || typeof schemaDefinition !== "object") {
|
|
11209
|
+
continue;
|
|
11210
|
+
}
|
|
11211
|
+
if (!Object.hasOwn(schemaDefinition, "default")) {
|
|
11212
|
+
continue;
|
|
11213
|
+
}
|
|
11214
|
+
const { default: defaultValue } = schemaDefinition;
|
|
11215
|
+
if (defaultValue === void 0) {
|
|
11216
|
+
continue;
|
|
11217
|
+
}
|
|
11218
|
+
this.#defaultValues[key] = defaultValue;
|
|
11219
|
+
}
|
|
11220
|
+
}
|
|
11221
|
+
#applyDefaultValues(options) {
|
|
11222
|
+
if (options.defaults) {
|
|
11223
|
+
Object.assign(this.#defaultValues, options.defaults);
|
|
11224
|
+
}
|
|
11225
|
+
}
|
|
11226
|
+
#configureSerialization(options) {
|
|
11227
|
+
if (options.serialize) {
|
|
11228
|
+
this._serialize = options.serialize;
|
|
11229
|
+
}
|
|
11230
|
+
if (options.deserialize) {
|
|
11231
|
+
this._deserialize = options.deserialize;
|
|
11232
|
+
}
|
|
11233
|
+
}
|
|
11234
|
+
#resolvePath(options) {
|
|
11235
|
+
const normalizedFileExtension = typeof options.fileExtension === "string" ? options.fileExtension : void 0;
|
|
11236
|
+
const fileExtension = normalizedFileExtension ? `.${normalizedFileExtension}` : "";
|
|
11237
|
+
return path4.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
|
|
11238
|
+
}
|
|
11239
|
+
#initializeStore(options) {
|
|
11240
|
+
if (options.migrations) {
|
|
11241
|
+
this.#runMigrations(options);
|
|
11242
|
+
this._validate(this.store);
|
|
11243
|
+
return;
|
|
11244
|
+
}
|
|
11245
|
+
const fileStore = this.store;
|
|
11246
|
+
const storeWithDefaults = Object.assign(createPlainObject(), options.defaults ?? {}, fileStore);
|
|
11247
|
+
this._validate(storeWithDefaults);
|
|
11248
|
+
try {
|
|
11249
|
+
assert.deepEqual(fileStore, storeWithDefaults);
|
|
11250
|
+
} catch {
|
|
11251
|
+
this.store = storeWithDefaults;
|
|
11252
|
+
}
|
|
11253
|
+
}
|
|
11254
|
+
#runMigrations(options) {
|
|
11255
|
+
const { migrations, projectVersion } = options;
|
|
11256
|
+
if (!migrations) {
|
|
11257
|
+
return;
|
|
11258
|
+
}
|
|
11259
|
+
if (!projectVersion) {
|
|
11260
|
+
throw new Error("Please specify the `projectVersion` option.");
|
|
11261
|
+
}
|
|
11262
|
+
this.#isInMigration = true;
|
|
11263
|
+
try {
|
|
11264
|
+
const fileStore = this.store;
|
|
11265
|
+
const storeWithDefaults = Object.assign(createPlainObject(), options.defaults ?? {}, fileStore);
|
|
11266
|
+
try {
|
|
11267
|
+
assert.deepEqual(fileStore, storeWithDefaults);
|
|
11268
|
+
} catch {
|
|
11269
|
+
this._write(storeWithDefaults);
|
|
11270
|
+
}
|
|
11271
|
+
this._migrate(migrations, projectVersion, options.beforeEachMigration);
|
|
11272
|
+
} finally {
|
|
11273
|
+
this.#isInMigration = false;
|
|
11274
|
+
}
|
|
11275
|
+
}
|
|
11276
|
+
};
|
|
11277
|
+
|
|
11278
|
+
// ../sdk/dist/index.js
|
|
11279
|
+
var LinkSdkError = class extends Error {
|
|
11280
|
+
code;
|
|
11281
|
+
cause;
|
|
11282
|
+
constructor(message, options) {
|
|
11283
|
+
super(message);
|
|
11284
|
+
this.name = new.target.name;
|
|
11285
|
+
this.code = options?.code ?? "sdk_error";
|
|
11286
|
+
this.cause = options?.cause;
|
|
11287
|
+
}
|
|
11288
|
+
};
|
|
11289
|
+
var LinkConfigurationError = class extends LinkSdkError {
|
|
11290
|
+
constructor(message, options) {
|
|
11291
|
+
super(message, { code: "configuration_error", ...options });
|
|
11292
|
+
}
|
|
11293
|
+
};
|
|
11294
|
+
var LinkAuthenticationError = class extends LinkSdkError {
|
|
11295
|
+
constructor(message, options) {
|
|
11296
|
+
super(message, { code: "not_authenticated", ...options });
|
|
11297
|
+
}
|
|
11298
|
+
};
|
|
11299
|
+
var LinkTransportError = class extends LinkSdkError {
|
|
11300
|
+
constructor(message, options) {
|
|
11301
|
+
super(message, { code: "transport_error", ...options });
|
|
10975
11302
|
}
|
|
10976
11303
|
};
|
|
10977
11304
|
var LinkAuthorizationDeclinedError = class extends LinkSdkError {
|
|
@@ -11394,10 +11721,8 @@ var PaymentMethodsResource = class {
|
|
|
11394
11721
|
url: this.paymentDetailsEndpoint
|
|
11395
11722
|
});
|
|
11396
11723
|
if (status < 200 || status >= 300) {
|
|
11397
|
-
const body2 = data;
|
|
11398
|
-
const msg = body2?.error ?? body2?.message ?? (rawBody || "unknown error");
|
|
11399
11724
|
throw new LinkApiError(
|
|
11400
|
-
`Failed to list payment methods (${status}): ${
|
|
11725
|
+
`Failed to list payment methods (${status}): ${extractErrorMessage(data, rawBody)}`,
|
|
11401
11726
|
{ status, rawBody, details: data }
|
|
11402
11727
|
);
|
|
11403
11728
|
}
|
|
@@ -11479,10 +11804,8 @@ var ShippingAddressResource = class {
|
|
|
11479
11804
|
url: this.shippingAddressesEndpoint
|
|
11480
11805
|
});
|
|
11481
11806
|
if (status < 200 || status >= 300) {
|
|
11482
|
-
const body2 = data;
|
|
11483
|
-
const msg = body2?.error ?? body2?.message ?? (rawBody || "unknown error");
|
|
11484
11807
|
throw new LinkApiError(
|
|
11485
|
-
`Failed to list shipping addresses (${status}): ${
|
|
11808
|
+
`Failed to list shipping addresses (${status}): ${extractErrorMessage(data, rawBody)}`,
|
|
11486
11809
|
{ status, rawBody, details: data }
|
|
11487
11810
|
);
|
|
11488
11811
|
}
|
|
@@ -11963,15 +12286,9 @@ var UserInfoResource = class {
|
|
|
11963
12286
|
url: this.userInfoEndpoint
|
|
11964
12287
|
});
|
|
11965
12288
|
if (status < 200 || status >= 300) {
|
|
11966
|
-
const body2 = data;
|
|
11967
|
-
const msg = body2?.error ?? body2?.message ?? (rawBody || "unknown error");
|
|
11968
12289
|
throw new LinkApiError(
|
|
11969
|
-
`Failed to retrieve user info (${status}): ${
|
|
11970
|
-
{
|
|
11971
|
-
status,
|
|
11972
|
-
rawBody,
|
|
11973
|
-
details: data
|
|
11974
|
-
}
|
|
12290
|
+
`Failed to retrieve user info (${status}): ${extractErrorMessage(data, rawBody)}`,
|
|
12291
|
+
{ status, rawBody, details: data }
|
|
11975
12292
|
);
|
|
11976
12293
|
}
|
|
11977
12294
|
const body = data;
|
|
@@ -12112,10 +12429,8 @@ var WebBotAuthResource = class {
|
|
|
12112
12429
|
body: JSON.stringify({ url })
|
|
12113
12430
|
});
|
|
12114
12431
|
if (status < 200 || status >= 300) {
|
|
12115
|
-
const body2 = data;
|
|
12116
|
-
const msg = body2?.error ?? body2?.message ?? (rawBody || "unknown error");
|
|
12117
12432
|
throw new LinkApiError(
|
|
12118
|
-
`Failed to get web bot auth headers (${status}): ${
|
|
12433
|
+
`Failed to get web bot auth headers (${status}): ${extractErrorMessage(data, rawBody)}`,
|
|
12119
12434
|
{ status, rawBody, details: data }
|
|
12120
12435
|
);
|
|
12121
12436
|
}
|
|
@@ -12280,6 +12595,98 @@ function normalizeScopeInput(scope) {
|
|
|
12280
12595
|
return normalized.length > 0 ? normalized.join(" ") : void 0;
|
|
12281
12596
|
}
|
|
12282
12597
|
|
|
12598
|
+
// src/auth/merge-access.ts
|
|
12599
|
+
var DEFAULT_SCOPE_TOKENS = DEFAULT_SCOPE.split(" ");
|
|
12600
|
+
function dedupePreserveOrder(values) {
|
|
12601
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12602
|
+
const deduped = [];
|
|
12603
|
+
for (const value of values) {
|
|
12604
|
+
if (seen.has(value)) {
|
|
12605
|
+
continue;
|
|
12606
|
+
}
|
|
12607
|
+
seen.add(value);
|
|
12608
|
+
deduped.push(value);
|
|
12609
|
+
}
|
|
12610
|
+
return deduped;
|
|
12611
|
+
}
|
|
12612
|
+
function unionPreserveOrder(current, additional) {
|
|
12613
|
+
return dedupePreserveOrder([...current, ...additional]);
|
|
12614
|
+
}
|
|
12615
|
+
function isRecord2(value) {
|
|
12616
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12617
|
+
}
|
|
12618
|
+
function getDetailType(detail) {
|
|
12619
|
+
if (!isRecord2(detail) || typeof detail.type !== "string") {
|
|
12620
|
+
return void 0;
|
|
12621
|
+
}
|
|
12622
|
+
return detail.type;
|
|
12623
|
+
}
|
|
12624
|
+
function getStringArray(value) {
|
|
12625
|
+
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) {
|
|
12626
|
+
return null;
|
|
12627
|
+
}
|
|
12628
|
+
return value;
|
|
12629
|
+
}
|
|
12630
|
+
function scopeTokens(scope, fallbackToDefault) {
|
|
12631
|
+
const tokens = (scope ?? "").trim().split(/[\s,]+/).filter(Boolean);
|
|
12632
|
+
if (tokens.length > 0) {
|
|
12633
|
+
return tokens;
|
|
12634
|
+
}
|
|
12635
|
+
return fallbackToDefault ? [...DEFAULT_SCOPE_TOKENS] : [];
|
|
12636
|
+
}
|
|
12637
|
+
function grantedActions(detail) {
|
|
12638
|
+
if (!isRecord2(detail)) {
|
|
12639
|
+
return null;
|
|
12640
|
+
}
|
|
12641
|
+
const actions = getStringArray(detail.actions);
|
|
12642
|
+
return actions ? dedupePreserveOrder(actions) : null;
|
|
12643
|
+
}
|
|
12644
|
+
function computeMergedAccess({
|
|
12645
|
+
requestedScope,
|
|
12646
|
+
requestedAuthorizationDetails,
|
|
12647
|
+
existingScope,
|
|
12648
|
+
existingAuthorizationDetails
|
|
12649
|
+
}) {
|
|
12650
|
+
const requestedTokens = scopeTokens(requestedScope, true);
|
|
12651
|
+
const existingTokens = scopeTokens(existingScope, true);
|
|
12652
|
+
const missingScopes = existingTokens.filter(
|
|
12653
|
+
(token) => !requestedTokens.includes(token)
|
|
12654
|
+
);
|
|
12655
|
+
const mergedScope = unionPreserveOrder(requestedTokens, missingScopes).join(
|
|
12656
|
+
" "
|
|
12657
|
+
);
|
|
12658
|
+
const actionsByType = /* @__PURE__ */ new Map();
|
|
12659
|
+
const seenOpaque = /* @__PURE__ */ new Set();
|
|
12660
|
+
const layout = [];
|
|
12661
|
+
const absorb = (details) => {
|
|
12662
|
+
for (const detail of details) {
|
|
12663
|
+
const type = getDetailType(detail);
|
|
12664
|
+
const actions = grantedActions(detail);
|
|
12665
|
+
if (type && actions) {
|
|
12666
|
+
if (!actionsByType.has(type)) {
|
|
12667
|
+
layout.push({ kind: "actions", type });
|
|
12668
|
+
}
|
|
12669
|
+
actionsByType.set(
|
|
12670
|
+
type,
|
|
12671
|
+
unionPreserveOrder(actionsByType.get(type) ?? [], actions)
|
|
12672
|
+
);
|
|
12673
|
+
} else {
|
|
12674
|
+
const key = JSON.stringify(detail);
|
|
12675
|
+
if (!seenOpaque.has(key)) {
|
|
12676
|
+
seenOpaque.add(key);
|
|
12677
|
+
layout.push({ kind: "opaque", detail });
|
|
12678
|
+
}
|
|
12679
|
+
}
|
|
12680
|
+
}
|
|
12681
|
+
};
|
|
12682
|
+
absorb(requestedAuthorizationDetails ?? []);
|
|
12683
|
+
absorb(existingAuthorizationDetails ?? []);
|
|
12684
|
+
const mergedAuthorizationDetails = layout.map(
|
|
12685
|
+
(entry) => entry.kind === "actions" ? { type: entry.type, actions: actionsByType.get(entry.type) ?? [] } : entry.detail
|
|
12686
|
+
);
|
|
12687
|
+
return { mergedScope, mergedAuthorizationDetails };
|
|
12688
|
+
}
|
|
12689
|
+
|
|
12283
12690
|
// src/utils/poll-until.ts
|
|
12284
12691
|
async function* pollUntil(options) {
|
|
12285
12692
|
const { fn, isTerminal, interval, timeout, maxAttempts } = options;
|
|
@@ -12400,6 +12807,7 @@ var Login = ({
|
|
|
12400
12807
|
sourceActions,
|
|
12401
12808
|
authorizationDetails,
|
|
12402
12809
|
authStorage: authStorage2 = storage,
|
|
12810
|
+
revokeRefreshTokenOnSuccess,
|
|
12403
12811
|
onComplete
|
|
12404
12812
|
}) => {
|
|
12405
12813
|
const storage2 = authStorage2;
|
|
@@ -12446,6 +12854,10 @@ var Login = ({
|
|
|
12446
12854
|
if (tokens) {
|
|
12447
12855
|
clearInterval(pollInterval);
|
|
12448
12856
|
storage2.setAuth(tokens);
|
|
12857
|
+
if (revokeRefreshTokenOnSuccess) {
|
|
12858
|
+
authResource.revokeToken(revokeRefreshTokenOnSuccess).catch(() => {
|
|
12859
|
+
});
|
|
12860
|
+
}
|
|
12449
12861
|
setStatus("success");
|
|
12450
12862
|
setTimeout(onComplete, DISPLAY_DELAY_MS);
|
|
12451
12863
|
}
|
|
@@ -12464,7 +12876,14 @@ var Login = ({
|
|
|
12464
12876
|
};
|
|
12465
12877
|
const timeout = setTimeout(startPolling, 1e3);
|
|
12466
12878
|
return () => clearTimeout(timeout);
|
|
12467
|
-
}, [
|
|
12879
|
+
}, [
|
|
12880
|
+
status,
|
|
12881
|
+
deviceCode,
|
|
12882
|
+
authResource,
|
|
12883
|
+
onComplete,
|
|
12884
|
+
storage2,
|
|
12885
|
+
revokeRefreshTokenOnSuccess
|
|
12886
|
+
]);
|
|
12468
12887
|
if (status === "initiating") {
|
|
12469
12888
|
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
|
|
12470
12889
|
/* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
@@ -12559,7 +12978,7 @@ function useAsyncAction(action, onComplete) {
|
|
|
12559
12978
|
);
|
|
12560
12979
|
} catch (err) {
|
|
12561
12980
|
if (cancelled) return;
|
|
12562
|
-
const message = err instanceof Error ? err.message :
|
|
12981
|
+
const message = err instanceof Error ? err.message : JSON.stringify(err);
|
|
12563
12982
|
setError(message);
|
|
12564
12983
|
setStatus("error");
|
|
12565
12984
|
timeoutId = setTimeout(
|
|
@@ -12729,6 +13148,39 @@ async function* pollAuthStatus(authResource, storage2, opts, update) {
|
|
|
12729
13148
|
for await (const result of pollUntil({
|
|
12730
13149
|
fn: async () => {
|
|
12731
13150
|
const pending = storage2.getPendingDeviceAuth();
|
|
13151
|
+
if (pending?.replaces_existing_session) {
|
|
13152
|
+
const previousRefreshToken = storage2.getAuth()?.refresh_token;
|
|
13153
|
+
const tokens = await authResource.pollDeviceAuth(pending.device_code);
|
|
13154
|
+
if (tokens) {
|
|
13155
|
+
storage2.setAuth(tokens);
|
|
13156
|
+
storage2.clearPendingDeviceAuth();
|
|
13157
|
+
if (previousRefreshToken) {
|
|
13158
|
+
try {
|
|
13159
|
+
await authResource.revokeToken(previousRefreshToken);
|
|
13160
|
+
} catch {
|
|
13161
|
+
}
|
|
13162
|
+
}
|
|
13163
|
+
return {
|
|
13164
|
+
authenticated: true,
|
|
13165
|
+
access_token: `${tokens.access_token.substring(0, 20)}...`,
|
|
13166
|
+
token_type: tokens.token_type,
|
|
13167
|
+
credentials_path: storage2.getPath(),
|
|
13168
|
+
...tokens.scope && { scope: tokens.scope },
|
|
13169
|
+
...tokens.authorization_details && {
|
|
13170
|
+
authorization_details: tokens.authorization_details
|
|
13171
|
+
},
|
|
13172
|
+
...update && { update }
|
|
13173
|
+
};
|
|
13174
|
+
}
|
|
13175
|
+
return {
|
|
13176
|
+
authenticated: false,
|
|
13177
|
+
credentials_path: storage2.getPath(),
|
|
13178
|
+
...update && { update },
|
|
13179
|
+
pending: true,
|
|
13180
|
+
verification_url: pending.verification_url,
|
|
13181
|
+
phrase: pending.phrase
|
|
13182
|
+
};
|
|
13183
|
+
}
|
|
12732
13184
|
if (pending && !storage2.isAuthenticated()) {
|
|
12733
13185
|
const tokens = await authResource.pollDeviceAuth(pending.device_code);
|
|
12734
13186
|
if (tokens) {
|
|
@@ -12781,6 +13233,44 @@ async function maybeRevokeAndClearAuth(authResource, storage2) {
|
|
|
12781
13233
|
storage2.clearAuth();
|
|
12782
13234
|
storage2.clearPendingDeviceAuth();
|
|
12783
13235
|
}
|
|
13236
|
+
async function* startDeviceAuthAndPoll(authResource, storage2, params, opts, warning) {
|
|
13237
|
+
const authRequest = await authResource.initiateDeviceAuth({
|
|
13238
|
+
clientName: params.clientName,
|
|
13239
|
+
scope: params.scope,
|
|
13240
|
+
sourceActions: params.sourceActions,
|
|
13241
|
+
authorizationDetails: params.authorizationDetails
|
|
13242
|
+
});
|
|
13243
|
+
storage2.setPendingDeviceAuth({
|
|
13244
|
+
device_code: authRequest.device_code,
|
|
13245
|
+
interval: authRequest.interval,
|
|
13246
|
+
expires_at: Date.now() + authRequest.expires_in * 1e3,
|
|
13247
|
+
verification_url: authRequest.verification_url_complete,
|
|
13248
|
+
phrase: authRequest.user_code,
|
|
13249
|
+
...params.replacesExistingSession ? { replaces_existing_session: true } : {}
|
|
13250
|
+
});
|
|
13251
|
+
const warningField = warning ? { warning } : {};
|
|
13252
|
+
if (opts.interval <= 0) {
|
|
13253
|
+
yield sanitizeDeep({
|
|
13254
|
+
...warningField,
|
|
13255
|
+
verification_url: authRequest.verification_url_complete,
|
|
13256
|
+
phrase: authRequest.user_code,
|
|
13257
|
+
instruction: "Present the verification_url to the user and ask them to approve in the Link app. Then call `auth status --interval 5 --max-attempts 60` to poll until authenticated. Do not wait for the user to reply \u2014 start polling immediately.",
|
|
13258
|
+
_next: {
|
|
13259
|
+
command: "auth status --interval 5 --max-attempts 60",
|
|
13260
|
+
poll_interval_seconds: authRequest.interval,
|
|
13261
|
+
until: "authenticated is true"
|
|
13262
|
+
}
|
|
13263
|
+
});
|
|
13264
|
+
return;
|
|
13265
|
+
}
|
|
13266
|
+
yield sanitizeDeep({
|
|
13267
|
+
...warningField,
|
|
13268
|
+
verification_url: authRequest.verification_url_complete,
|
|
13269
|
+
phrase: authRequest.user_code,
|
|
13270
|
+
instruction: "Present the verification_url to the user and ask them to approve in the Link app. Polling has started automatically \u2014 no further action needed."
|
|
13271
|
+
});
|
|
13272
|
+
yield* pollAuthStatus(authResource, storage2, opts);
|
|
13273
|
+
}
|
|
12784
13274
|
function createAuthCli(authResource, getUpdateInfo2, authStorage2, envAccessToken2) {
|
|
12785
13275
|
const storage2 = authStorage2 ?? storage;
|
|
12786
13276
|
const cli2 = Cli.create("auth", {
|
|
@@ -12858,43 +13348,116 @@ function createAuthCli(authResource, getUpdateInfo2, authStorage2, envAccessToke
|
|
|
12858
13348
|
() => ({ authenticated: true, token_type: "Bearer" })
|
|
12859
13349
|
);
|
|
12860
13350
|
}
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
13351
|
+
yield* startDeviceAuthAndPoll(
|
|
13352
|
+
authResource,
|
|
13353
|
+
storage2,
|
|
13354
|
+
{
|
|
13355
|
+
clientName,
|
|
13356
|
+
scope,
|
|
13357
|
+
sourceActions: c.options.sourceActions,
|
|
13358
|
+
authorizationDetails
|
|
13359
|
+
},
|
|
13360
|
+
{
|
|
13361
|
+
interval: c.options.interval,
|
|
13362
|
+
maxAttempts: c.options.maxAttempts,
|
|
13363
|
+
timeout: c.options.timeout
|
|
13364
|
+
}
|
|
13365
|
+
);
|
|
13366
|
+
}
|
|
13367
|
+
});
|
|
13368
|
+
cli2.command("upgrade", {
|
|
13369
|
+
description: "Re-authenticate with Link, merging the requested access with your current access so the new session is a superset",
|
|
13370
|
+
options: loginOptions,
|
|
13371
|
+
outputPolicy: "agent-only",
|
|
13372
|
+
async *run(c) {
|
|
13373
|
+
const clientName = c.options.clientName?.trim();
|
|
13374
|
+
const requestedScope = normalizeScopeInput(c.options.scope);
|
|
13375
|
+
if (!clientName || clientName.length === 0) {
|
|
13376
|
+
return c.error({
|
|
13377
|
+
code: "INVALID_INPUT",
|
|
13378
|
+
message: "client-name must be a non-empty string"
|
|
12885
13379
|
});
|
|
12886
|
-
return;
|
|
12887
13380
|
}
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
13381
|
+
if (c.options.scope !== void 0 && !requestedScope) {
|
|
13382
|
+
return c.error({
|
|
13383
|
+
code: "INVALID_INPUT",
|
|
13384
|
+
message: "scope must be a non-empty string when provided"
|
|
13385
|
+
});
|
|
13386
|
+
}
|
|
13387
|
+
let requestedAuthorizationDetails;
|
|
13388
|
+
try {
|
|
13389
|
+
requestedAuthorizationDetails = buildAuthorizationDetails(
|
|
13390
|
+
c.options.sourceActions,
|
|
13391
|
+
parseAuthorizationDetails(c.options.authorizationDetail)
|
|
13392
|
+
);
|
|
13393
|
+
} catch (error) {
|
|
13394
|
+
return c.error({
|
|
13395
|
+
code: "INVALID_INPUT",
|
|
13396
|
+
message: error.message
|
|
13397
|
+
});
|
|
13398
|
+
}
|
|
13399
|
+
let scope = requestedScope;
|
|
13400
|
+
let authorizationDetails = requestedAuthorizationDetails;
|
|
13401
|
+
let previousRefreshToken;
|
|
13402
|
+
let warning;
|
|
13403
|
+
const existingAuth = storage2.getAuth();
|
|
13404
|
+
if (existingAuth?.refresh_token) {
|
|
13405
|
+
try {
|
|
13406
|
+
const refreshed = await authResource.refreshToken(
|
|
13407
|
+
existingAuth.refresh_token
|
|
13408
|
+
);
|
|
13409
|
+
storage2.setAuth(refreshed);
|
|
13410
|
+
previousRefreshToken = refreshed.refresh_token;
|
|
13411
|
+
const merged = computeMergedAccess({
|
|
13412
|
+
requestedScope,
|
|
13413
|
+
requestedAuthorizationDetails,
|
|
13414
|
+
existingScope: refreshed.scope ?? existingAuth.scope,
|
|
13415
|
+
existingAuthorizationDetails: refreshed.authorization_details ?? existingAuth.authorization_details
|
|
13416
|
+
});
|
|
13417
|
+
scope = merged.mergedScope;
|
|
13418
|
+
authorizationDetails = merged.mergedAuthorizationDetails;
|
|
13419
|
+
} catch {
|
|
13420
|
+
storage2.clearAuth();
|
|
13421
|
+
storage2.clearPendingDeviceAuth();
|
|
13422
|
+
warning = "could not refresh the existing session; continuing with only the requested access.";
|
|
13423
|
+
process.stderr.write(`warning: ${warning}
|
|
13424
|
+
`);
|
|
13425
|
+
}
|
|
13426
|
+
} else {
|
|
13427
|
+
warning = "no active session to upgrade; continuing with only the requested access.";
|
|
13428
|
+
process.stderr.write(`warning: ${warning}
|
|
13429
|
+
`);
|
|
13430
|
+
}
|
|
13431
|
+
const replacesExistingSession = previousRefreshToken !== void 0;
|
|
13432
|
+
if (!c.agent && !c.formatExplicit) {
|
|
13433
|
+
return renderInteractive(
|
|
13434
|
+
/* @__PURE__ */ jsx4(
|
|
13435
|
+
Login,
|
|
13436
|
+
{
|
|
13437
|
+
authResource,
|
|
13438
|
+
clientName,
|
|
13439
|
+
scope,
|
|
13440
|
+
authorizationDetails,
|
|
13441
|
+
authStorage: storage2,
|
|
13442
|
+
revokeRefreshTokenOnSuccess: previousRefreshToken,
|
|
13443
|
+
onComplete: () => {
|
|
13444
|
+
}
|
|
13445
|
+
}
|
|
13446
|
+
),
|
|
13447
|
+
() => ({ authenticated: true, token_type: "Bearer" })
|
|
13448
|
+
);
|
|
13449
|
+
}
|
|
13450
|
+
yield* startDeviceAuthAndPoll(
|
|
13451
|
+
authResource,
|
|
13452
|
+
storage2,
|
|
13453
|
+
{ clientName, scope, authorizationDetails, replacesExistingSession },
|
|
13454
|
+
{
|
|
13455
|
+
interval: c.options.interval,
|
|
13456
|
+
maxAttempts: c.options.maxAttempts,
|
|
13457
|
+
timeout: c.options.timeout
|
|
13458
|
+
},
|
|
13459
|
+
warning
|
|
13460
|
+
);
|
|
12898
13461
|
}
|
|
12899
13462
|
});
|
|
12900
13463
|
cli2.command("logout", {
|
|
@@ -13032,6 +13595,8 @@ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
13032
13595
|
var COLUMN_GAP = " ";
|
|
13033
13596
|
var SOURCE_ID_MIN = 16;
|
|
13034
13597
|
var SOURCE_ID_MAX = 48;
|
|
13598
|
+
var NAME_MIN = 12;
|
|
13599
|
+
var NAME_MAX = 30;
|
|
13035
13600
|
var TYPE_WIDTH = 12;
|
|
13036
13601
|
var CURRENT_WIDTH = 15;
|
|
13037
13602
|
var CURRENCY_WIDTH = 8;
|
|
@@ -13057,6 +13622,15 @@ function sourceIdWidth(balances) {
|
|
|
13057
13622
|
const maxLen = Math.max(...balances.map((b) => (b.source_id ?? "").length));
|
|
13058
13623
|
return Math.min(SOURCE_ID_MAX, Math.max(SOURCE_ID_MIN, maxLen));
|
|
13059
13624
|
}
|
|
13625
|
+
function accountName(balance) {
|
|
13626
|
+
const name = balance.name;
|
|
13627
|
+
return typeof name === "string" && name.length > 0 ? name : "-";
|
|
13628
|
+
}
|
|
13629
|
+
function nameWidth(balances) {
|
|
13630
|
+
if (balances.length === 0) return NAME_MIN;
|
|
13631
|
+
const maxLen = Math.max(...balances.map((b) => accountName(b).length));
|
|
13632
|
+
return Math.min(NAME_MAX, Math.max(NAME_MIN, maxLen));
|
|
13633
|
+
}
|
|
13060
13634
|
var BalancesList = ({
|
|
13061
13635
|
resource,
|
|
13062
13636
|
params,
|
|
@@ -13070,7 +13644,9 @@ var BalancesList = ({
|
|
|
13070
13644
|
const balances = page?.data ?? [];
|
|
13071
13645
|
const nextCursor = page?.has_more && balances.length > 0 ? balances[balances.length - 1].source_id : null;
|
|
13072
13646
|
const idWidth = sourceIdWidth(balances);
|
|
13647
|
+
const accountNameWidth = nameWidth(balances);
|
|
13073
13648
|
const headerRow = [
|
|
13649
|
+
formatCell("Source name", accountNameWidth),
|
|
13074
13650
|
formatCell("Source ID", idWidth),
|
|
13075
13651
|
formatCell("Balance type", TYPE_WIDTH),
|
|
13076
13652
|
formatCell("Current balance", CURRENT_WIDTH),
|
|
@@ -13079,6 +13655,7 @@ var BalancesList = ({
|
|
|
13079
13655
|
const separatorRow = "-".repeat(headerRow.length);
|
|
13080
13656
|
const rows = balances.map(
|
|
13081
13657
|
(balance) => [
|
|
13658
|
+
formatCell(accountName(balance), accountNameWidth),
|
|
13082
13659
|
formatCell(balance.source_id ?? "-", idWidth),
|
|
13083
13660
|
formatCell(balance.type ?? "-", TYPE_WIDTH),
|
|
13084
13661
|
formatCell(
|
|
@@ -13133,7 +13710,7 @@ var listOptions = z2.object({
|
|
|
13133
13710
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
13134
13711
|
function createBalancesCli(createResource, authStorage2, envAccessToken2) {
|
|
13135
13712
|
const cli2 = Cli2.create("balances", {
|
|
13136
|
-
description: "List balances from your Link wallet"
|
|
13713
|
+
description: "[beta] List balances from your Link wallet"
|
|
13137
13714
|
});
|
|
13138
13715
|
cli2.command("list", {
|
|
13139
13716
|
description: "List balances from your Link wallet",
|
|
@@ -13877,7 +14454,7 @@ function decodeStripeChallenge(challengeHeader) {
|
|
|
13877
14454
|
const { challenge, networkId, request } = resolveStripeChallenge(
|
|
13878
14455
|
Challenge.deserializeList(challengeHeader)
|
|
13879
14456
|
);
|
|
13880
|
-
return {
|
|
14457
|
+
return sanitizeDeep({
|
|
13881
14458
|
id: challenge.id,
|
|
13882
14459
|
realm: challenge.realm,
|
|
13883
14460
|
method: "stripe",
|
|
@@ -13887,7 +14464,7 @@ function decodeStripeChallenge(challengeHeader) {
|
|
|
13887
14464
|
expires: challenge.expires,
|
|
13888
14465
|
network_id: networkId,
|
|
13889
14466
|
request_json: request
|
|
13890
|
-
};
|
|
14467
|
+
});
|
|
13891
14468
|
}
|
|
13892
14469
|
|
|
13893
14470
|
// src/commands/mpp/pay.tsx
|
|
@@ -15590,7 +16167,7 @@ function sourceRow(source, index) {
|
|
|
15590
16167
|
const external = formatExternalConnection(source);
|
|
15591
16168
|
return {
|
|
15592
16169
|
key: sourceId(source, index),
|
|
15593
|
-
name: source.name ?? "
|
|
16170
|
+
name: source.name ?? "-",
|
|
15594
16171
|
type: source.type ?? "-",
|
|
15595
16172
|
id: sourceId(source, index),
|
|
15596
16173
|
capabilities,
|
|
@@ -15599,7 +16176,7 @@ function sourceRow(source, index) {
|
|
|
15599
16176
|
}
|
|
15600
16177
|
function tableColumns() {
|
|
15601
16178
|
return [
|
|
15602
|
-
{ label: "Name", value: (row) => row.name, minWidth: 14, maxWidth:
|
|
16179
|
+
{ label: "Name", value: (row) => row.name, minWidth: 14, maxWidth: 36 },
|
|
15603
16180
|
{ label: "Type", value: (row) => row.type, minWidth: 10, maxWidth: 14 },
|
|
15604
16181
|
{ label: "ID", value: (row) => row.id, minWidth: 16, maxWidth: 48 },
|
|
15605
16182
|
{
|
|
@@ -15713,7 +16290,7 @@ var listOptions2 = z8.object({
|
|
|
15713
16290
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
15714
16291
|
function createSourcesCli(createResource, authStorage2, envAccessToken2) {
|
|
15715
16292
|
const cli2 = Cli10.create("sources", {
|
|
15716
|
-
description: "List sources from your Link wallet"
|
|
16293
|
+
description: "[beta] List sources from your Link wallet"
|
|
15717
16294
|
});
|
|
15718
16295
|
cli2.command("list", {
|
|
15719
16296
|
description: "List sources from your Link wallet",
|
|
@@ -15907,7 +16484,7 @@ var CancelSpendRequest = ({
|
|
|
15907
16484
|
};
|
|
15908
16485
|
|
|
15909
16486
|
// src/commands/spend-request/create.tsx
|
|
15910
|
-
import { Box as Box18, Text as Text20, useApp as useApp4 } from "ink";
|
|
16487
|
+
import { Box as Box18, Text as Text20, useApp as useApp4, useInput as useInput8 } from "ink";
|
|
15911
16488
|
import Spinner10 from "ink-spinner";
|
|
15912
16489
|
import { useCallback as useCallback8, useEffect as useEffect9, useState as useState9 } from "react";
|
|
15913
16490
|
|
|
@@ -16019,15 +16596,16 @@ var CreateSpendRequest = ({
|
|
|
16019
16596
|
force,
|
|
16020
16597
|
onComplete
|
|
16021
16598
|
}) => {
|
|
16599
|
+
const { exit } = useApp4();
|
|
16022
16600
|
const [status, setStatus] = useState9("creating");
|
|
16023
16601
|
const [request, setRequest] = useState9(null);
|
|
16024
16602
|
const [error, setError] = useState9("");
|
|
16025
16603
|
const [verificationUrl, setVerificationUrl] = useState9("");
|
|
16026
16604
|
const [supportUrl, setSupportUrl] = useState9("");
|
|
16605
|
+
const [countdown, setCountdown] = useState9(30);
|
|
16027
16606
|
const [outputFilePath, setOutputFilePath] = useState9(null);
|
|
16028
16607
|
const [fileError, setFileError] = useState9("");
|
|
16029
16608
|
const approvalUrl = request?.approval_url ?? "";
|
|
16030
|
-
const { exit } = useApp4();
|
|
16031
16609
|
const completeAndExit = useCallback8(
|
|
16032
16610
|
(result) => {
|
|
16033
16611
|
onComplete(result);
|
|
@@ -16050,6 +16628,22 @@ var CreateSpendRequest = ({
|
|
|
16050
16628
|
onSuccess,
|
|
16051
16629
|
onError
|
|
16052
16630
|
});
|
|
16631
|
+
useInput8((_, key) => {
|
|
16632
|
+
if (key.return && (verificationUrl || supportUrl) && status === "verification_required") {
|
|
16633
|
+
openUrl(verificationUrl || supportUrl);
|
|
16634
|
+
setStatus("opened");
|
|
16635
|
+
setTimeout(() => completeAndExit(null), DISPLAY_DELAY_MS);
|
|
16636
|
+
}
|
|
16637
|
+
});
|
|
16638
|
+
useEffect9(() => {
|
|
16639
|
+
if (status !== "verification_required") return;
|
|
16640
|
+
if (countdown <= 0) {
|
|
16641
|
+
completeAndExit(null);
|
|
16642
|
+
return;
|
|
16643
|
+
}
|
|
16644
|
+
const timer = setTimeout(() => setCountdown((c) => c - 1), 1e3);
|
|
16645
|
+
return () => clearTimeout(timer);
|
|
16646
|
+
}, [status, countdown, completeAndExit]);
|
|
16053
16647
|
useEffect9(() => {
|
|
16054
16648
|
const create = async () => {
|
|
16055
16649
|
try {
|
|
@@ -16069,6 +16663,10 @@ var CreateSpendRequest = ({
|
|
|
16069
16663
|
setVerificationUrl(errDetail.error.verification_url);
|
|
16070
16664
|
if (errDetail?.error?.support_url)
|
|
16071
16665
|
setSupportUrl(errDetail.error.support_url);
|
|
16666
|
+
if (errDetail?.error?.verification_url || errDetail?.error?.support_url) {
|
|
16667
|
+
setStatus("verification_required");
|
|
16668
|
+
return;
|
|
16669
|
+
}
|
|
16072
16670
|
}
|
|
16073
16671
|
setStatus("error");
|
|
16074
16672
|
setTimeout(() => completeAndExit(null), DISPLAY_DELAY_MS);
|
|
@@ -16088,6 +16686,44 @@ var CreateSpendRequest = ({
|
|
|
16088
16686
|
};
|
|
16089
16687
|
writeCredentialFile(outputFile, fileData, force ?? false).then((path7) => setOutputFilePath(path7)).catch((err) => setFileError(err.message));
|
|
16090
16688
|
}, [status, outputFile, force, request]);
|
|
16689
|
+
if (status === "verification_required") {
|
|
16690
|
+
const url = verificationUrl || supportUrl;
|
|
16691
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
|
|
16692
|
+
/* @__PURE__ */ jsx27(Text20, { color: "red", children: "\u2717 Failed to create spend request" }),
|
|
16693
|
+
/* @__PURE__ */ jsx27(Text20, { color: "red", children: error }),
|
|
16694
|
+
/* @__PURE__ */ jsxs18(
|
|
16695
|
+
Box18,
|
|
16696
|
+
{
|
|
16697
|
+
flexDirection: "column",
|
|
16698
|
+
borderStyle: "round",
|
|
16699
|
+
borderColor: "cyan",
|
|
16700
|
+
paddingX: 2,
|
|
16701
|
+
paddingY: 1,
|
|
16702
|
+
marginTop: 1,
|
|
16703
|
+
children: [
|
|
16704
|
+
/* @__PURE__ */ jsxs18(Text20, { children: [
|
|
16705
|
+
"Open:",
|
|
16706
|
+
" ",
|
|
16707
|
+
/* @__PURE__ */ jsx27(Text20, { bold: true, color: "cyan", children: url })
|
|
16708
|
+
] }),
|
|
16709
|
+
/* @__PURE__ */ jsx27(Text20, { dimColor: true, children: "Press Enter to open in browser" }),
|
|
16710
|
+
/* @__PURE__ */ jsxs18(Text20, { dimColor: true, children: [
|
|
16711
|
+
"Exiting in ",
|
|
16712
|
+
countdown,
|
|
16713
|
+
"s..."
|
|
16714
|
+
] })
|
|
16715
|
+
]
|
|
16716
|
+
}
|
|
16717
|
+
)
|
|
16718
|
+
] });
|
|
16719
|
+
}
|
|
16720
|
+
if (status === "opened") {
|
|
16721
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
|
|
16722
|
+
/* @__PURE__ */ jsx27(Text20, { color: "red", children: "\u2717 Failed to create spend request" }),
|
|
16723
|
+
/* @__PURE__ */ jsx27(Text20, { color: "red", children: error }),
|
|
16724
|
+
/* @__PURE__ */ jsx27(Text20, { color: "green", children: "\u2713 Opened verification URL in browser" })
|
|
16725
|
+
] });
|
|
16726
|
+
}
|
|
16091
16727
|
if (status === "creating") {
|
|
16092
16728
|
return /* @__PURE__ */ jsx27(Box18, { children: /* @__PURE__ */ jsxs18(Text20, { color: "cyan", children: [
|
|
16093
16729
|
/* @__PURE__ */ jsx27(Spinner10, { type: "dots" }),
|
|
@@ -16097,15 +16733,7 @@ var CreateSpendRequest = ({
|
|
|
16097
16733
|
if (status === "error") {
|
|
16098
16734
|
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", children: [
|
|
16099
16735
|
/* @__PURE__ */ jsx27(Text20, { color: "red", children: "\u2717 Failed to create spend request" }),
|
|
16100
|
-
/* @__PURE__ */ jsx27(Text20, { color: "red", children: error })
|
|
16101
|
-
verificationUrl && /* @__PURE__ */ jsxs18(Text20, { color: "red", children: [
|
|
16102
|
-
"Complete additional verification at: ",
|
|
16103
|
-
verificationUrl
|
|
16104
|
-
] }),
|
|
16105
|
-
supportUrl && /* @__PURE__ */ jsxs18(Text20, { color: "red", children: [
|
|
16106
|
-
"Identity verification failed. Contact support at: ",
|
|
16107
|
-
supportUrl
|
|
16108
|
-
] })
|
|
16736
|
+
/* @__PURE__ */ jsx27(Text20, { color: "red", children: error })
|
|
16109
16737
|
] });
|
|
16110
16738
|
}
|
|
16111
16739
|
if (status === "success") {
|
|
@@ -16260,7 +16888,7 @@ var SpendRequestList = ({
|
|
|
16260
16888
|
};
|
|
16261
16889
|
|
|
16262
16890
|
// src/commands/spend-request/request-approval.tsx
|
|
16263
|
-
import { Box as Box20, Text as Text22, useApp as useApp6 } from "ink";
|
|
16891
|
+
import { Box as Box20, Text as Text22, useApp as useApp6, useInput as useInput9 } from "ink";
|
|
16264
16892
|
import Spinner12 from "ink-spinner";
|
|
16265
16893
|
import { useCallback as useCallback10, useEffect as useEffect10, useState as useState10 } from "react";
|
|
16266
16894
|
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
@@ -16269,12 +16897,6 @@ var RequestApproval = ({
|
|
|
16269
16897
|
id,
|
|
16270
16898
|
onComplete
|
|
16271
16899
|
}) => {
|
|
16272
|
-
const [status, setStatus] = useState10("requesting");
|
|
16273
|
-
const [approvalUrl, setApprovalUrl] = useState10("");
|
|
16274
|
-
const [result, setResult] = useState10(null);
|
|
16275
|
-
const [error, setError] = useState10("");
|
|
16276
|
-
const [verificationUrl, setVerificationUrl] = useState10("");
|
|
16277
|
-
const [supportUrl, setSupportUrl] = useState10("");
|
|
16278
16900
|
const { exit } = useApp6();
|
|
16279
16901
|
const completeAndExit = useCallback10(
|
|
16280
16902
|
(result2) => {
|
|
@@ -16283,6 +16905,13 @@ var RequestApproval = ({
|
|
|
16283
16905
|
},
|
|
16284
16906
|
[onComplete, exit]
|
|
16285
16907
|
);
|
|
16908
|
+
const [status, setStatus] = useState10("requesting");
|
|
16909
|
+
const [approvalUrl, setApprovalUrl] = useState10("");
|
|
16910
|
+
const [result, setResult] = useState10(null);
|
|
16911
|
+
const [error, setError] = useState10("");
|
|
16912
|
+
const [verificationUrl, setVerificationUrl] = useState10("");
|
|
16913
|
+
const [supportUrl, setSupportUrl] = useState10("");
|
|
16914
|
+
const [countdown, setCountdown] = useState10(30);
|
|
16286
16915
|
const onSuccess = useCallback10((r) => setResult(r), []);
|
|
16287
16916
|
const onError = useCallback10((msg) => setError(msg), []);
|
|
16288
16917
|
useApprovalPolling({
|
|
@@ -16295,6 +16924,22 @@ var RequestApproval = ({
|
|
|
16295
16924
|
onSuccess,
|
|
16296
16925
|
onError
|
|
16297
16926
|
});
|
|
16927
|
+
useInput9((_, key) => {
|
|
16928
|
+
if (key.return && (verificationUrl || supportUrl) && status === "verification_required") {
|
|
16929
|
+
openUrl(verificationUrl || supportUrl);
|
|
16930
|
+
setStatus("opened");
|
|
16931
|
+
setTimeout(() => completeAndExit(null), DISPLAY_DELAY_MS);
|
|
16932
|
+
}
|
|
16933
|
+
});
|
|
16934
|
+
useEffect10(() => {
|
|
16935
|
+
if (status !== "verification_required") return;
|
|
16936
|
+
if (countdown <= 0) {
|
|
16937
|
+
completeAndExit(null);
|
|
16938
|
+
return;
|
|
16939
|
+
}
|
|
16940
|
+
const timer = setTimeout(() => setCountdown((c) => c - 1), 1e3);
|
|
16941
|
+
return () => clearTimeout(timer);
|
|
16942
|
+
}, [status, countdown, completeAndExit]);
|
|
16298
16943
|
useEffect10(() => {
|
|
16299
16944
|
const request = async () => {
|
|
16300
16945
|
try {
|
|
@@ -16309,6 +16954,10 @@ var RequestApproval = ({
|
|
|
16309
16954
|
setVerificationUrl(errDetail.error.verification_url);
|
|
16310
16955
|
if (errDetail?.error?.support_url)
|
|
16311
16956
|
setSupportUrl(errDetail.error.support_url);
|
|
16957
|
+
if (errDetail?.error?.verification_url || errDetail?.error?.support_url) {
|
|
16958
|
+
setStatus("verification_required");
|
|
16959
|
+
return;
|
|
16960
|
+
}
|
|
16312
16961
|
}
|
|
16313
16962
|
setStatus("error");
|
|
16314
16963
|
setTimeout(() => {
|
|
@@ -16318,7 +16967,45 @@ var RequestApproval = ({
|
|
|
16318
16967
|
}
|
|
16319
16968
|
};
|
|
16320
16969
|
request();
|
|
16321
|
-
}, [repository, id,
|
|
16970
|
+
}, [repository, id, onComplete, exit]);
|
|
16971
|
+
if (status === "verification_required") {
|
|
16972
|
+
const url = verificationUrl || supportUrl;
|
|
16973
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
|
|
16974
|
+
/* @__PURE__ */ jsx29(Text22, { color: "red", children: "\u2717 Failed to request approval" }),
|
|
16975
|
+
/* @__PURE__ */ jsx29(Text22, { color: "red", children: error }),
|
|
16976
|
+
/* @__PURE__ */ jsxs20(
|
|
16977
|
+
Box20,
|
|
16978
|
+
{
|
|
16979
|
+
flexDirection: "column",
|
|
16980
|
+
borderStyle: "round",
|
|
16981
|
+
borderColor: "cyan",
|
|
16982
|
+
paddingX: 2,
|
|
16983
|
+
paddingY: 1,
|
|
16984
|
+
marginTop: 1,
|
|
16985
|
+
children: [
|
|
16986
|
+
/* @__PURE__ */ jsxs20(Text22, { children: [
|
|
16987
|
+
"Open:",
|
|
16988
|
+
" ",
|
|
16989
|
+
/* @__PURE__ */ jsx29(Text22, { bold: true, color: "cyan", children: url })
|
|
16990
|
+
] }),
|
|
16991
|
+
/* @__PURE__ */ jsx29(Text22, { dimColor: true, children: "Press Enter to open in browser" }),
|
|
16992
|
+
/* @__PURE__ */ jsxs20(Text22, { dimColor: true, children: [
|
|
16993
|
+
"Exiting in ",
|
|
16994
|
+
countdown,
|
|
16995
|
+
"s..."
|
|
16996
|
+
] })
|
|
16997
|
+
]
|
|
16998
|
+
}
|
|
16999
|
+
)
|
|
17000
|
+
] });
|
|
17001
|
+
}
|
|
17002
|
+
if (status === "opened") {
|
|
17003
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
|
|
17004
|
+
/* @__PURE__ */ jsx29(Text22, { color: "red", children: "\u2717 Failed to request approval" }),
|
|
17005
|
+
/* @__PURE__ */ jsx29(Text22, { color: "red", children: error }),
|
|
17006
|
+
/* @__PURE__ */ jsx29(Text22, { color: "green", children: "\u2713 Opened verification URL in browser" })
|
|
17007
|
+
] });
|
|
17008
|
+
}
|
|
16322
17009
|
if (status === "requesting") {
|
|
16323
17010
|
return /* @__PURE__ */ jsx29(Box20, { children: /* @__PURE__ */ jsxs20(Text22, { color: "cyan", children: [
|
|
16324
17011
|
/* @__PURE__ */ jsx29(Spinner12, { type: "dots" }),
|
|
@@ -16328,15 +17015,7 @@ var RequestApproval = ({
|
|
|
16328
17015
|
if (status === "error") {
|
|
16329
17016
|
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
|
|
16330
17017
|
/* @__PURE__ */ jsx29(Text22, { color: "red", children: "\u2717 Failed to request approval" }),
|
|
16331
|
-
/* @__PURE__ */ jsx29(Text22, { color: "red", children: error })
|
|
16332
|
-
verificationUrl && /* @__PURE__ */ jsxs20(Text22, { color: "red", children: [
|
|
16333
|
-
"Complete additional verification at: ",
|
|
16334
|
-
verificationUrl
|
|
16335
|
-
] }),
|
|
16336
|
-
supportUrl && /* @__PURE__ */ jsxs20(Text22, { color: "red", children: [
|
|
16337
|
-
"Identity verification failed. Contact support at: ",
|
|
16338
|
-
supportUrl
|
|
16339
|
-
] })
|
|
17018
|
+
/* @__PURE__ */ jsx29(Text22, { color: "red", children: error })
|
|
16340
17019
|
] });
|
|
16341
17020
|
}
|
|
16342
17021
|
if (status === "success") {
|
|
@@ -16793,6 +17472,20 @@ var RetrieveSpendRequest = ({
|
|
|
16793
17472
|
] })
|
|
16794
17473
|
] })
|
|
16795
17474
|
] }),
|
|
17475
|
+
!request?.card && (request?.card_brand || request?.card_last4) && /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", marginTop: 1, children: [
|
|
17476
|
+
/* @__PURE__ */ jsx30(Text23, { bold: true, children: "Card:" }),
|
|
17477
|
+
/* @__PURE__ */ jsxs21(Text23, { children: [
|
|
17478
|
+
" ",
|
|
17479
|
+
[
|
|
17480
|
+
request?.card_brand,
|
|
17481
|
+
request?.card_last4 && `\xB7\xB7\xB7\xB7${request.card_last4}`
|
|
17482
|
+
].filter(Boolean).join(" ")
|
|
17483
|
+
] }),
|
|
17484
|
+
/* @__PURE__ */ jsxs21(Text23, { color: "gray", children: [
|
|
17485
|
+
" ",
|
|
17486
|
+
"Use --include card to expand full card details"
|
|
17487
|
+
] })
|
|
17488
|
+
] }),
|
|
16796
17489
|
request?.card && outputFile && /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", marginTop: 1, children: [
|
|
16797
17490
|
outputFilePath && /* @__PURE__ */ jsxs21(Text23, { color: "green", children: [
|
|
16798
17491
|
"Card credentials written to ",
|
|
@@ -16812,18 +17505,24 @@ import { z as z10 } from "incur";
|
|
|
16812
17505
|
var createOptions = z10.object({
|
|
16813
17506
|
paymentMethodId: z10.string().optional().describe("Payment method ID"),
|
|
16814
17507
|
credentialType: z10.enum(["shared_payment_token", "card"]).default("card").describe(
|
|
16815
|
-
'"card" for checkout forms
|
|
17508
|
+
'"card" for checkout forms and Link Pay Token; "shared_payment_token" for HTTP 402/machine payment flows'
|
|
16816
17509
|
),
|
|
16817
17510
|
networkId: z10.string().optional().describe(
|
|
16818
17511
|
"Network ID (required for shared_payment_token) \u2014 use `link-cli mpp decode` to extract"
|
|
16819
17512
|
),
|
|
17513
|
+
executionMethod: z10.enum(["link_pay_token"]).optional().describe(
|
|
17514
|
+
"Use link_pay_token only with merchant_account_id read from the checkout AI-agent steering DOM"
|
|
17515
|
+
),
|
|
17516
|
+
merchantAccountId: z10.string().optional().describe(
|
|
17517
|
+
"Stripe account ID from data-stripe-merchant-account; required with execution_method link_pay_token"
|
|
17518
|
+
),
|
|
16820
17519
|
amount: z10.coerce.number().int().positive().max(5e5).describe("Amount in cents, max 500000 ($5,000.00)"),
|
|
16821
17520
|
currency: z10.string().length(3).default("usd").describe("Currency code"),
|
|
16822
17521
|
merchantName: z10.string().optional().describe(
|
|
16823
|
-
"Merchant name (required for card;
|
|
17522
|
+
"Merchant name (required for regular card requests; omit for link_pay_token and shared_payment_token)"
|
|
16824
17523
|
),
|
|
16825
17524
|
merchantUrl: z10.string().optional().describe(
|
|
16826
|
-
"Merchant URL (required for card;
|
|
17525
|
+
"Merchant URL (required for regular card requests; omit for link_pay_token and shared_payment_token)"
|
|
16827
17526
|
),
|
|
16828
17527
|
context: z10.string().min(100).describe(
|
|
16829
17528
|
"Min 100 chars \u2014 describe the purchase and rationale; the user reads this when approving"
|
|
@@ -17004,6 +17703,53 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17004
17703
|
const requestApproval = !!opts.requestApproval;
|
|
17005
17704
|
const credentialType = opts.credentialType;
|
|
17006
17705
|
const networkId = opts.networkId;
|
|
17706
|
+
const executionMethod = opts.executionMethod;
|
|
17707
|
+
const merchantAccountId = opts.merchantAccountId?.trim();
|
|
17708
|
+
const lptExecutionRequested = executionMethod !== void 0 || merchantAccountId !== void 0;
|
|
17709
|
+
if (lptExecutionRequested) {
|
|
17710
|
+
if (executionMethod !== "link_pay_token") {
|
|
17711
|
+
return c.error({
|
|
17712
|
+
code: "INVALID_INPUT",
|
|
17713
|
+
message: "execution-method link_pay_token is required when merchant-account-id is provided"
|
|
17714
|
+
});
|
|
17715
|
+
}
|
|
17716
|
+
if (!merchantAccountId) {
|
|
17717
|
+
return c.error({
|
|
17718
|
+
code: "INVALID_INPUT",
|
|
17719
|
+
message: "merchant-account-id is required when execution-method is link_pay_token"
|
|
17720
|
+
});
|
|
17721
|
+
}
|
|
17722
|
+
if (credentialType !== "card") {
|
|
17723
|
+
return c.error({
|
|
17724
|
+
code: "INVALID_INPUT",
|
|
17725
|
+
message: "credential-type must be card when execution-method is link_pay_token"
|
|
17726
|
+
});
|
|
17727
|
+
}
|
|
17728
|
+
if (networkId) {
|
|
17729
|
+
return c.error({
|
|
17730
|
+
code: "INVALID_INPUT",
|
|
17731
|
+
message: "network-id cannot be used when execution-method is link_pay_token"
|
|
17732
|
+
});
|
|
17733
|
+
}
|
|
17734
|
+
if (opts.test) {
|
|
17735
|
+
return c.error({
|
|
17736
|
+
code: "INVALID_INPUT",
|
|
17737
|
+
message: "test cannot be used when execution-method is link_pay_token"
|
|
17738
|
+
});
|
|
17739
|
+
}
|
|
17740
|
+
if (opts.approve) {
|
|
17741
|
+
return c.error({
|
|
17742
|
+
code: "INVALID_INPUT",
|
|
17743
|
+
message: "approve cannot be used when execution-method is link_pay_token; use request-approval instead"
|
|
17744
|
+
});
|
|
17745
|
+
}
|
|
17746
|
+
if (opts.merchantName || opts.merchantUrl) {
|
|
17747
|
+
return c.error({
|
|
17748
|
+
code: "INVALID_INPUT",
|
|
17749
|
+
message: "merchant-name and merchant-url cannot be used when execution-method is link_pay_token; Link resolves the merchant identity from merchant-account-id"
|
|
17750
|
+
});
|
|
17751
|
+
}
|
|
17752
|
+
}
|
|
17007
17753
|
if (credentialType === "shared_payment_token" && !networkId) {
|
|
17008
17754
|
return c.error({
|
|
17009
17755
|
code: "INVALID_INPUT",
|
|
@@ -17024,13 +17770,13 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17024
17770
|
message: "network-id can only be used when credential-type is shared_payment_token"
|
|
17025
17771
|
});
|
|
17026
17772
|
}
|
|
17027
|
-
if (credentialType !== "shared_payment_token" && !opts.merchantName) {
|
|
17773
|
+
if (!lptExecutionRequested && credentialType !== "shared_payment_token" && !opts.merchantName) {
|
|
17028
17774
|
return c.error({
|
|
17029
17775
|
code: "INVALID_INPUT",
|
|
17030
17776
|
message: "merchant-name is required when credential-type is card"
|
|
17031
17777
|
});
|
|
17032
17778
|
}
|
|
17033
|
-
if (credentialType !== "shared_payment_token" && !opts.merchantUrl) {
|
|
17779
|
+
if (!lptExecutionRequested && credentialType !== "shared_payment_token" && !opts.merchantUrl) {
|
|
17034
17780
|
return c.error({
|
|
17035
17781
|
code: "INVALID_INPUT",
|
|
17036
17782
|
message: "merchant-url is required when credential-type is card"
|
|
@@ -17057,6 +17803,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17057
17803
|
payment_details: opts.paymentMethodId,
|
|
17058
17804
|
credential_type: credentialType,
|
|
17059
17805
|
network_id: networkId,
|
|
17806
|
+
execution_method: executionMethod,
|
|
17807
|
+
merchant_account_id: merchantAccountId,
|
|
17060
17808
|
amount: opts.amount,
|
|
17061
17809
|
currency: opts.currency,
|
|
17062
17810
|
merchant_name: opts.merchantName,
|
|
@@ -17503,7 +18251,7 @@ var listOptions4 = z12.object({
|
|
|
17503
18251
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
17504
18252
|
function createTransactionsCli(createResource, authStorage2, envAccessToken2) {
|
|
17505
18253
|
const cli2 = Cli12.create("transactions", {
|
|
17506
|
-
description: "List transactions from Link and external accounts"
|
|
18254
|
+
description: "[beta] List transactions from Link and external accounts"
|
|
17507
18255
|
});
|
|
17508
18256
|
cli2.command("list", {
|
|
17509
18257
|
description: "List transactions from Link and external accounts, including non-Link activity",
|
|
@@ -17654,9 +18402,22 @@ function requireFetchImplementation2(config) {
|
|
|
17654
18402
|
|
|
17655
18403
|
// src/auth/auth-resource.ts
|
|
17656
18404
|
var CLIENT_ID = "lwlpk_U7Qy7ThG69STZk";
|
|
18405
|
+
function extractOAuthErrorMessage(err) {
|
|
18406
|
+
if (!err) return void 0;
|
|
18407
|
+
if (err.error_description != null) return err.error_description;
|
|
18408
|
+
if (typeof err.error === "string") return err.error;
|
|
18409
|
+
if (typeof err.error === "object" && err.error !== null) {
|
|
18410
|
+
return err.error.message ?? JSON.stringify(err.error);
|
|
18411
|
+
}
|
|
18412
|
+
return void 0;
|
|
18413
|
+
}
|
|
18414
|
+
function extractOAuthErrorCode(err) {
|
|
18415
|
+
if (!err) return void 0;
|
|
18416
|
+
return typeof err.error === "string" ? err.error : void 0;
|
|
18417
|
+
}
|
|
17657
18418
|
function formatOAuthError(prefix, status, data, rawBody) {
|
|
17658
18419
|
const err = data;
|
|
17659
|
-
return `${prefix} (${status}): ${err
|
|
18420
|
+
return `${prefix} (${status}): ${extractOAuthErrorMessage(err) ?? (rawBody || "unknown error")}`;
|
|
17660
18421
|
}
|
|
17661
18422
|
function appendAuthorizationDetailValue(params, key, value) {
|
|
17662
18423
|
if (Array.isArray(value)) {
|
|
@@ -17799,19 +18560,24 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17799
18560
|
}
|
|
17800
18561
|
if (status === 400) {
|
|
17801
18562
|
const err = data;
|
|
17802
|
-
switch (err
|
|
18563
|
+
switch (extractOAuthErrorCode(err)) {
|
|
17803
18564
|
case "authorization_pending":
|
|
17804
18565
|
case "slow_down":
|
|
17805
18566
|
return null;
|
|
17806
18567
|
case "expired_token":
|
|
17807
18568
|
throw new LinkApiError(
|
|
17808
18569
|
"Device code expired. Please restart the login flow.",
|
|
17809
|
-
{
|
|
18570
|
+
{
|
|
18571
|
+
status,
|
|
18572
|
+
code: extractOAuthErrorCode(err),
|
|
18573
|
+
rawBody,
|
|
18574
|
+
details: data
|
|
18575
|
+
}
|
|
17810
18576
|
);
|
|
17811
18577
|
case "access_denied":
|
|
17812
18578
|
throw new LinkApiError("Authorization denied by user.", {
|
|
17813
18579
|
status,
|
|
17814
|
-
code: err
|
|
18580
|
+
code: extractOAuthErrorCode(err),
|
|
17815
18581
|
rawBody,
|
|
17816
18582
|
details: data
|
|
17817
18583
|
});
|
|
@@ -17823,7 +18589,7 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17823
18589
|
formatOAuthError("Token poll failed", status, data, rawBody),
|
|
17824
18590
|
{
|
|
17825
18591
|
status,
|
|
17826
|
-
code: data
|
|
18592
|
+
code: extractOAuthErrorCode(data),
|
|
17827
18593
|
rawBody,
|
|
17828
18594
|
details: data
|
|
17829
18595
|
}
|
|
@@ -17842,7 +18608,7 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17842
18608
|
formatOAuthError("Token revocation failed", status, data, rawBody),
|
|
17843
18609
|
{
|
|
17844
18610
|
status,
|
|
17845
|
-
code: data
|
|
18611
|
+
code: extractOAuthErrorCode(data),
|
|
17846
18612
|
rawBody,
|
|
17847
18613
|
details: data
|
|
17848
18614
|
}
|
|
@@ -17863,7 +18629,7 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17863
18629
|
formatOAuthError("Token refresh failed", status, data, rawBody),
|
|
17864
18630
|
{
|
|
17865
18631
|
status,
|
|
17866
|
-
code: data
|
|
18632
|
+
code: extractOAuthErrorCode(data),
|
|
17867
18633
|
rawBody,
|
|
17868
18634
|
details: data
|
|
17869
18635
|
}
|
|
@@ -18199,7 +18965,7 @@ function cacheUpdateInfo(value, ttlMs = UPDATE_CACHE_TTL_MS) {
|
|
|
18199
18965
|
}
|
|
18200
18966
|
|
|
18201
18967
|
// src/cli.tsx
|
|
18202
|
-
var cliVersion = "0.
|
|
18968
|
+
var cliVersion = "0.12.0";
|
|
18203
18969
|
var cliName = "@stripe/link-cli";
|
|
18204
18970
|
var defaultHeaders = {
|
|
18205
18971
|
"User-Agent": `link-cli/${cliVersion}`
|
|
@@ -18228,26 +18994,12 @@ var factory = new ResourceFactory({
|
|
|
18228
18994
|
});
|
|
18229
18995
|
var authRepo = factory.createAuthResource();
|
|
18230
18996
|
var spendRequestRepo = factory.createSpendRequestResource();
|
|
18231
|
-
var
|
|
18232
|
-
var hiddenCli = requestedCommand === "transactions" ? createTransactionsCli(
|
|
18233
|
-
() => factory.createTransactionsResource(),
|
|
18234
|
-
authStorage,
|
|
18235
|
-
envAccessToken
|
|
18236
|
-
) : requestedCommand === "sources" ? createSourcesCli(
|
|
18237
|
-
() => factory.createSourcesResource(),
|
|
18238
|
-
authStorage,
|
|
18239
|
-
envAccessToken
|
|
18240
|
-
) : requestedCommand === "balances" ? createBalancesCli(
|
|
18241
|
-
() => factory.createBalancesResource(),
|
|
18242
|
-
authStorage,
|
|
18243
|
-
envAccessToken
|
|
18244
|
-
) : null;
|
|
18245
|
-
if (hiddenCli) {
|
|
18246
|
-
process.argv.splice(2, 1);
|
|
18247
|
-
}
|
|
18248
|
-
var cli = hiddenCli ?? Cli14.create("link-cli", {
|
|
18997
|
+
var cli = Cli14.create("link-cli", {
|
|
18249
18998
|
description: "Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.",
|
|
18250
|
-
version: cliVersion
|
|
18999
|
+
version: cliVersion,
|
|
19000
|
+
sync: {
|
|
19001
|
+
include: ["skills/*"]
|
|
19002
|
+
}
|
|
18251
19003
|
});
|
|
18252
19004
|
var isAgent = process.argv.includes("--format") || process.argv.includes("--mcp");
|
|
18253
19005
|
var agentUpdateInfoProvider = createAgentUpdateInfoProvider(
|
|
@@ -18262,67 +19014,86 @@ if (!isAgent && process.stdout.isTTY) {
|
|
|
18262
19014
|
process.stderr.write(renderInteractiveUpdateNotice(updateInfo));
|
|
18263
19015
|
}
|
|
18264
19016
|
}
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
19017
|
+
cli.command(
|
|
19018
|
+
createAuthCli(authRepo, getUpdateInfo, authStorage, envAccessToken)
|
|
19019
|
+
);
|
|
19020
|
+
cli.command(
|
|
19021
|
+
createSpendRequestCli(spendRequestRepo, authStorage, envAccessToken)
|
|
19022
|
+
);
|
|
19023
|
+
cli.command(
|
|
19024
|
+
createPaymentMethodsCli(
|
|
19025
|
+
() => factory.createPaymentMethodsResource(),
|
|
19026
|
+
authStorage,
|
|
19027
|
+
envAccessToken
|
|
19028
|
+
)
|
|
19029
|
+
);
|
|
19030
|
+
cli.command(
|
|
19031
|
+
createShippingAddressCli(
|
|
19032
|
+
() => factory.createShippingAddressResource(),
|
|
19033
|
+
authStorage,
|
|
19034
|
+
envAccessToken
|
|
19035
|
+
)
|
|
19036
|
+
);
|
|
19037
|
+
cli.command(
|
|
19038
|
+
createUserInfoCli(
|
|
19039
|
+
() => factory.createUserInfoResource(),
|
|
19040
|
+
authStorage,
|
|
19041
|
+
envAccessToken
|
|
19042
|
+
)
|
|
19043
|
+
);
|
|
19044
|
+
cli.command(
|
|
19045
|
+
createMppCli(
|
|
19046
|
+
spendRequestRepo,
|
|
19047
|
+
() => factory.createPaymentMethodsResource(),
|
|
19048
|
+
authStorage,
|
|
19049
|
+
envAccessToken
|
|
19050
|
+
)
|
|
19051
|
+
);
|
|
19052
|
+
cli.command(
|
|
19053
|
+
createReportCli(
|
|
19054
|
+
() => factory.createReportResource(),
|
|
19055
|
+
authStorage,
|
|
19056
|
+
envAccessToken
|
|
19057
|
+
)
|
|
19058
|
+
);
|
|
19059
|
+
cli.command(
|
|
19060
|
+
createBalancesCli(
|
|
19061
|
+
() => factory.createBalancesResource(),
|
|
19062
|
+
authStorage,
|
|
19063
|
+
envAccessToken
|
|
19064
|
+
)
|
|
19065
|
+
);
|
|
19066
|
+
cli.command(
|
|
19067
|
+
createSourcesCli(
|
|
19068
|
+
() => factory.createSourcesResource(),
|
|
19069
|
+
authStorage,
|
|
19070
|
+
envAccessToken
|
|
19071
|
+
)
|
|
19072
|
+
);
|
|
19073
|
+
cli.command(
|
|
19074
|
+
createTransactionsCli(
|
|
19075
|
+
() => factory.createTransactionsResource(),
|
|
19076
|
+
authStorage,
|
|
19077
|
+
envAccessToken
|
|
19078
|
+
)
|
|
19079
|
+
);
|
|
19080
|
+
cli.command(
|
|
19081
|
+
createDemoCli(
|
|
19082
|
+
authRepo,
|
|
19083
|
+
spendRequestRepo,
|
|
19084
|
+
() => factory.createPaymentMethodsResource(),
|
|
19085
|
+
authStorage
|
|
19086
|
+
)
|
|
19087
|
+
);
|
|
19088
|
+
cli.command(
|
|
19089
|
+
createOnboardCli(
|
|
19090
|
+
authRepo,
|
|
19091
|
+
spendRequestRepo,
|
|
19092
|
+
() => factory.createPaymentMethodsResource(),
|
|
19093
|
+
authStorage
|
|
19094
|
+
)
|
|
19095
|
+
);
|
|
19096
|
+
cli.command(createServeCli(cli));
|
|
18326
19097
|
cli.serve();
|
|
18327
19098
|
var cli_default = cli;
|
|
18328
19099
|
export {
|