@shipdit/cli 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1032 -191
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command, CommanderError } from "commander";
|
|
2
|
+
import { Command, CommanderError, Option } from "commander";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
@@ -51,7 +51,7 @@ function findProjectRoot(start = process.cwd()) {
|
|
|
51
51
|
function loadProjectConfig(projectRoot, configPath) {
|
|
52
52
|
return readJsonFile(configPath ?? path.join(projectRoot, ".shipd", "config.json")) ?? {};
|
|
53
53
|
}
|
|
54
|
-
function resolveRuntimeConfig(flags) {
|
|
54
|
+
function resolveRuntimeConfig(flags, options) {
|
|
55
55
|
const cwd = process.cwd();
|
|
56
56
|
const projectRoot = findProjectRoot(cwd);
|
|
57
57
|
const projectConfig = loadProjectConfig(projectRoot, flags.config);
|
|
@@ -60,7 +60,7 @@ function resolveRuntimeConfig(flags) {
|
|
|
60
60
|
const ci = flags.ci === true || flags.yes === true || process.env.CI === "1" || process.env.CI === "true" || process.env.SHIPD_CI === "1";
|
|
61
61
|
const defaultConfigFile = fs.existsSync(path.join(projectRoot, "shipd.config.ts")) ? path.join(projectRoot, "shipd.config.ts") : path.join(cwd, "shipd.config.ts");
|
|
62
62
|
return {
|
|
63
|
-
apiUrl: flags.apiUrl ?? process.env.SHIPD_API_URL ?? projectConfig.apiUrl ?? globalConfig.apiUrl ?? credentials.apiUrl ?? "http://localhost:8000",
|
|
63
|
+
apiUrl: flags.apiUrl ?? process.env.SHIPD_API_URL ?? projectConfig.apiUrl ?? globalConfig.apiUrl ?? credentials.apiUrl ?? options?.defaultApiUrl ?? "http://localhost:8000",
|
|
64
64
|
appUrl: process.env.SHIPD_APP_URL ?? projectConfig.appUrl ?? globalConfig.appUrl ?? "http://localhost:5173",
|
|
65
65
|
apiKey: process.env.SHIPD_API_KEY ?? credentials.apiKey,
|
|
66
66
|
org: flags.org ?? process.env.SHIPD_ORG ?? projectConfig.org ?? globalConfig.org,
|
|
@@ -365,16 +365,20 @@ async function i$1(e) {
|
|
|
365
365
|
const a$1 = (...t) => hc(...t);
|
|
366
366
|
const o$1 = (...t) => hc(...t);
|
|
367
367
|
const s$1 = (...t) => hc(...t);
|
|
368
|
-
const c$
|
|
369
|
-
const l$
|
|
370
|
-
const u$
|
|
371
|
-
const d$
|
|
368
|
+
const c$1 = (...t) => hc(...t);
|
|
369
|
+
const l$1 = (...t) => hc(...t);
|
|
370
|
+
const u$2 = (...t) => hc(...t);
|
|
371
|
+
const d$2 = (...t) => hc(...t);
|
|
372
372
|
const f$1 = (...t) => hc(...t);
|
|
373
373
|
const p$1 = (...t) => hc(...t);
|
|
374
|
-
|
|
374
|
+
const m$1 = (...t) => hc(...t);
|
|
375
|
+
const h$1 = (...t) => hc(...t);
|
|
376
|
+
const g$1 = (...t) => hc(...t);
|
|
377
|
+
const _$1 = (...t) => hc(...t);
|
|
378
|
+
function v$1(e) {
|
|
375
379
|
return `${e.replace(/\/+$/, ``)}/api/v1/rpc`;
|
|
376
380
|
}
|
|
377
|
-
function
|
|
381
|
+
function y$1(e) {
|
|
378
382
|
return {
|
|
379
383
|
...e.fetch ? { fetch: e.fetch } : {},
|
|
380
384
|
init: { credentials: e.client === `dashboard` ? `include` : `same-origin` },
|
|
@@ -384,70 +388,100 @@ function h$1(e) {
|
|
|
384
388
|
}
|
|
385
389
|
};
|
|
386
390
|
}
|
|
387
|
-
async function
|
|
391
|
+
async function b$1(e, t) {
|
|
388
392
|
return i$1(await e({ json: t }));
|
|
389
393
|
}
|
|
390
|
-
function
|
|
391
|
-
let t =
|
|
394
|
+
function x$1(e) {
|
|
395
|
+
let t = v$1(e.baseUrl), n = y$1(e), r = a$1(t, n), i = o$1(t, n), x = s$1(t, n), S = c$1(t, n), C = l$1(t, n), w = u$2(t, n), T = d$2(t, n), E = m$1(t, n), D = f$1(t, n), O = p$1(t, n), k = h$1(t, n), A = g$1(t, n), j = _$1(t, n);
|
|
392
396
|
return {
|
|
393
|
-
me: {
|
|
397
|
+
me: {
|
|
398
|
+
get: (e = {}) => b$1(r.me.$post, e),
|
|
399
|
+
feedback: (e) => b$1(r.me.feedback.$post, e)
|
|
400
|
+
},
|
|
394
401
|
project: {
|
|
395
|
-
list: (e = {}) =>
|
|
396
|
-
create: (e) =>
|
|
397
|
-
update: (e) =>
|
|
398
|
-
archive: (e) =>
|
|
402
|
+
list: (e = {}) => b$1(i.project.list.$post, e),
|
|
403
|
+
create: (e) => b$1(i.project.create.$post, e),
|
|
404
|
+
update: (e) => b$1(i.project.update.$post, e),
|
|
405
|
+
archive: (e) => b$1(i.project.archive.$post, e)
|
|
399
406
|
},
|
|
400
407
|
environment: {
|
|
401
|
-
list: (e) =>
|
|
402
|
-
create: (e) =>
|
|
403
|
-
update: (e) =>
|
|
404
|
-
archive: (e) =>
|
|
408
|
+
list: (e) => b$1(x.environment.list.$post, e),
|
|
409
|
+
create: (e) => b$1(x.environment.create.$post, e),
|
|
410
|
+
update: (e) => b$1(x.environment.update.$post, e),
|
|
411
|
+
archive: (e) => b$1(x.environment.archive.$post, e)
|
|
405
412
|
},
|
|
406
413
|
flag: {
|
|
407
|
-
list: (e) =>
|
|
408
|
-
get: (e) =>
|
|
409
|
-
create: (e) =>
|
|
410
|
-
update: (e) =>
|
|
411
|
-
archive: (e) =>
|
|
412
|
-
updateEnvironment: (e) =>
|
|
413
|
-
toggleEnvironment: (e) =>
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
list: (e) => b$1(S.flag.list.$post, e),
|
|
415
|
+
get: (e) => b$1(S.flag.get.$post, e),
|
|
416
|
+
create: (e) => b$1(S.flag.create.$post, e),
|
|
417
|
+
update: (e) => b$1(S.flag.update.$post, e),
|
|
418
|
+
archive: (e) => b$1(S.flag.archive.$post, e),
|
|
419
|
+
updateEnvironment: (e) => b$1(S.flag.updateEnvironment.$post, e),
|
|
420
|
+
toggleEnvironment: (e) => b$1(S.flag.toggleEnvironment.$post, e),
|
|
421
|
+
listEnvironmentStates: (e) => b$1(S.flag.listEnvironmentStates.$post, e),
|
|
422
|
+
pull: (e) => b$1(S.flag.pull.$post, e),
|
|
423
|
+
diff: (e) => b$1(S.flag.diff.$post, e),
|
|
424
|
+
push: (e) => b$1(S.flag.push.$post, e)
|
|
417
425
|
},
|
|
418
426
|
apiKey: {
|
|
419
|
-
list: (e = {}) =>
|
|
420
|
-
create: (e) =>
|
|
421
|
-
revoke: (e) =>
|
|
427
|
+
list: (e = {}) => b$1(C.apiKey.list.$post, e),
|
|
428
|
+
create: (e) => b$1(C.apiKey.create.$post, e),
|
|
429
|
+
revoke: (e) => b$1(C.apiKey.revoke.$post, e)
|
|
422
430
|
},
|
|
423
431
|
sdkKey: {
|
|
424
|
-
list: (e = {}) =>
|
|
425
|
-
create: (e) =>
|
|
426
|
-
revoke: (e) =>
|
|
432
|
+
list: (e = {}) => b$1(T.sdkKey.list.$post, e),
|
|
433
|
+
create: (e) => b$1(T.sdkKey.create.$post, e),
|
|
434
|
+
revoke: (e) => b$1(T.sdkKey.revoke.$post, e)
|
|
435
|
+
},
|
|
436
|
+
segment: {
|
|
437
|
+
list: (e) => b$1(E.segment.list.$post, e),
|
|
438
|
+
get: (e) => b$1(E.segment.get.$post, e),
|
|
439
|
+
create: (e) => b$1(E.segment.create.$post, e),
|
|
440
|
+
update: (e) => b$1(E.segment.update.$post, e),
|
|
441
|
+
archive: (e) => b$1(E.segment.archive.$post, e),
|
|
442
|
+
listEnvironmentStates: (e) => b$1(E.segment.listEnvironmentStates.$post, e),
|
|
443
|
+
updateEnvironment: (e) => b$1(E.segment.updateEnvironment.$post, e)
|
|
427
444
|
},
|
|
428
445
|
evaluatedEntity: {
|
|
429
|
-
list: (e) =>
|
|
430
|
-
get: (e) =>
|
|
431
|
-
delete: (e) =>
|
|
446
|
+
list: (e) => b$1(D.evaluatedEntity.list.$post, e),
|
|
447
|
+
get: (e) => b$1(D.evaluatedEntity.get.$post, e),
|
|
448
|
+
delete: (e) => b$1(D.evaluatedEntity.delete.$post, e)
|
|
449
|
+
},
|
|
450
|
+
evaluationFact: {
|
|
451
|
+
list: (e) => b$1(O.evaluationFact.list.$post, e),
|
|
452
|
+
byRule: (e) => b$1(O.evaluationFact.byRule.$post, e),
|
|
453
|
+
orgSummary: (e = {}) => b$1(O.evaluationFact.orgSummary.$post, e),
|
|
454
|
+
projectSummary: (e) => b$1(O.evaluationFact.projectSummary.$post, e),
|
|
455
|
+
simulate: (e) => b$1(O.evaluationFact.simulate.$post, e)
|
|
432
456
|
},
|
|
433
|
-
snapshot: { publish: (e) =>
|
|
434
|
-
device: { authorize: (e) =>
|
|
457
|
+
snapshot: { publish: (e) => b$1(k.snapshot.publish.$post, e) },
|
|
458
|
+
device: { authorize: (e) => b$1(A.device.authorize.$post, e) },
|
|
459
|
+
billing: {
|
|
460
|
+
get: (e = {}) => b$1(j.billing.get.$post, e),
|
|
461
|
+
attach: (e) => b$1(j.billing.attach.$post, e),
|
|
462
|
+
openPortal: (e) => b$1(j.billing.openPortal.$post, e)
|
|
463
|
+
},
|
|
464
|
+
audit: { list: (e = {}) => b$1(w.audit.list.$post, e) },
|
|
435
465
|
raw: {
|
|
436
466
|
me: r,
|
|
437
467
|
project: i,
|
|
438
|
-
environment:
|
|
439
|
-
flag:
|
|
440
|
-
apiKey:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
468
|
+
environment: x,
|
|
469
|
+
flag: S,
|
|
470
|
+
apiKey: C,
|
|
471
|
+
audit: w,
|
|
472
|
+
sdkKey: T,
|
|
473
|
+
segment: E,
|
|
474
|
+
evaluatedEntity: D,
|
|
475
|
+
evaluationFact: O,
|
|
476
|
+
snapshot: k,
|
|
477
|
+
device: A,
|
|
478
|
+
billing: j
|
|
445
479
|
}
|
|
446
480
|
};
|
|
447
481
|
}
|
|
448
482
|
|
|
449
483
|
//#endregion
|
|
450
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@
|
|
484
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@openteleme_92516152aeaed9865e4d3971447ef996/node_modules/@better-auth/core/dist/utils/error-codes.mjs
|
|
451
485
|
function defineErrorCodes(codes) {
|
|
452
486
|
return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
|
|
453
487
|
code: key,
|
|
@@ -570,7 +604,7 @@ var InternalAPIError = class extends Error {
|
|
|
570
604
|
const APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
|
|
571
605
|
|
|
572
606
|
//#endregion
|
|
573
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@
|
|
607
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@openteleme_92516152aeaed9865e4d3971447ef996/node_modules/@better-auth/core/dist/error/index.mjs
|
|
574
608
|
var BetterAuthError = class extends Error {
|
|
575
609
|
constructor(message, options) {
|
|
576
610
|
super(message, options);
|
|
@@ -581,7 +615,7 @@ var BetterAuthError = class extends Error {
|
|
|
581
615
|
};
|
|
582
616
|
|
|
583
617
|
//#endregion
|
|
584
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
618
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/access/access.mjs
|
|
585
619
|
function unknownResourceResponse(requestedResource) {
|
|
586
620
|
return {
|
|
587
621
|
success: false,
|
|
@@ -658,15 +692,30 @@ function createAccessControl(s) {
|
|
|
658
692
|
}
|
|
659
693
|
|
|
660
694
|
//#endregion
|
|
661
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
695
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
|
|
696
|
+
const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
697
|
+
OTP_NOT_ENABLED: "OTP not enabled",
|
|
698
|
+
OTP_HAS_EXPIRED: "OTP has expired",
|
|
699
|
+
TOTP_NOT_ENABLED: "TOTP not enabled",
|
|
700
|
+
TWO_FACTOR_NOT_ENABLED: "Two factor isn't enabled",
|
|
701
|
+
BACKUP_CODES_NOT_ENABLED: "Backup codes aren't enabled",
|
|
702
|
+
INVALID_BACKUP_CODE: "Invalid backup code",
|
|
703
|
+
INVALID_CODE: "Invalid code",
|
|
704
|
+
TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: "Too many attempts. Please request a new code.",
|
|
705
|
+
ACCOUNT_TEMPORARILY_LOCKED: "Too many failed verification attempts. Your account is temporarily locked. Please try again later.",
|
|
706
|
+
INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/package.mjs
|
|
662
711
|
var version = "1.6.26";
|
|
663
712
|
|
|
664
713
|
//#endregion
|
|
665
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
666
|
-
const PACKAGE_VERSION$
|
|
714
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/version.mjs
|
|
715
|
+
const PACKAGE_VERSION$2 = version;
|
|
667
716
|
|
|
668
717
|
//#endregion
|
|
669
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@
|
|
718
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@openteleme_92516152aeaed9865e4d3971447ef996/node_modules/@better-auth/core/dist/utils/url.mjs
|
|
670
719
|
/**
|
|
671
720
|
* Schemes that execute or embed code when navigated to or accepted as a
|
|
672
721
|
* redirect target. These are never safe as an OAuth `redirect_uri` or as a
|
|
@@ -698,7 +747,45 @@ function isSafeUrlScheme(value) {
|
|
|
698
747
|
}
|
|
699
748
|
|
|
700
749
|
//#endregion
|
|
701
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
750
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/two-factor/client.mjs
|
|
751
|
+
const twoFactorClient = (options) => {
|
|
752
|
+
return {
|
|
753
|
+
id: "two-factor",
|
|
754
|
+
version: PACKAGE_VERSION$2,
|
|
755
|
+
$InferServerPlugin: {},
|
|
756
|
+
atomListeners: [{
|
|
757
|
+
matcher: (path) => path.startsWith("/two-factor/"),
|
|
758
|
+
signal: "$sessionSignal"
|
|
759
|
+
}],
|
|
760
|
+
pathMethods: {
|
|
761
|
+
"/two-factor/disable": "POST",
|
|
762
|
+
"/two-factor/enable": "POST",
|
|
763
|
+
"/two-factor/send-otp": "POST",
|
|
764
|
+
"/two-factor/generate-backup-codes": "POST",
|
|
765
|
+
"/two-factor/get-totp-uri": "POST",
|
|
766
|
+
"/two-factor/verify-totp": "POST",
|
|
767
|
+
"/two-factor/verify-otp": "POST",
|
|
768
|
+
"/two-factor/verify-backup-code": "POST"
|
|
769
|
+
},
|
|
770
|
+
fetchPlugins: [{
|
|
771
|
+
id: "two-factor",
|
|
772
|
+
name: "two-factor",
|
|
773
|
+
hooks: { async onSuccess(context) {
|
|
774
|
+
if (context.data?.twoFactorRedirect) {
|
|
775
|
+
if (options?.onTwoFactorRedirect) {
|
|
776
|
+
await options.onTwoFactorRedirect({ twoFactorMethods: context.data.twoFactorMethods });
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (options?.twoFactorPage && typeof window !== "undefined" && isSafeUrlScheme(options.twoFactorPage)) window.location.href = options.twoFactorPage;
|
|
780
|
+
}
|
|
781
|
+
} }
|
|
782
|
+
}],
|
|
783
|
+
$ERROR_CODES: TWO_FACTOR_ERROR_CODES
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/admin/access/statement.mjs
|
|
702
789
|
const defaultStatements$1 = {
|
|
703
790
|
user: [
|
|
704
791
|
"create",
|
|
@@ -749,7 +836,7 @@ const defaultRoles$1 = {
|
|
|
749
836
|
};
|
|
750
837
|
|
|
751
838
|
//#endregion
|
|
752
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
839
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/admin/error-codes.mjs
|
|
753
840
|
const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
754
841
|
FAILED_TO_CREATE_USER: "Failed to create user",
|
|
755
842
|
USER_ALREADY_EXISTS: "User already exists.",
|
|
@@ -777,7 +864,7 @@ const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
|
777
864
|
});
|
|
778
865
|
|
|
779
866
|
//#endregion
|
|
780
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@
|
|
867
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@openteleme_92516152aeaed9865e4d3971447ef996/node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
781
868
|
const _envShim = Object.create(null);
|
|
782
869
|
const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
783
870
|
const env = new Proxy(_envShim, {
|
|
@@ -841,7 +928,7 @@ const ENV = Object.freeze({
|
|
|
841
928
|
});
|
|
842
929
|
|
|
843
930
|
//#endregion
|
|
844
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
931
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/utils/url.mjs
|
|
845
932
|
const SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
846
933
|
function trimTrailingSlashes(value) {
|
|
847
934
|
let end = value.length;
|
|
@@ -920,7 +1007,7 @@ function getOrigin(url) {
|
|
|
920
1007
|
}
|
|
921
1008
|
|
|
922
1009
|
//#endregion
|
|
923
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1010
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/admin/has-permission.mjs
|
|
924
1011
|
const hasPermission = (input) => {
|
|
925
1012
|
if (input.userId && input.options?.adminUserIds?.includes(input.userId)) return true;
|
|
926
1013
|
if (!input.permissions) return false;
|
|
@@ -1449,7 +1536,7 @@ var betterFetch = async (url, options) => {
|
|
|
1449
1536
|
};
|
|
1450
1537
|
|
|
1451
1538
|
//#endregion
|
|
1452
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1539
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/parser.mjs
|
|
1453
1540
|
const PROTO_POLLUTION_PATTERNS = {
|
|
1454
1541
|
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
1455
1542
|
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
@@ -1519,7 +1606,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
1519
1606
|
}
|
|
1520
1607
|
|
|
1521
1608
|
//#endregion
|
|
1522
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1609
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
|
|
1523
1610
|
const defaultStatements = {
|
|
1524
1611
|
organization: ["update", "delete"],
|
|
1525
1612
|
member: [
|
|
@@ -1595,7 +1682,7 @@ const defaultRoles = {
|
|
|
1595
1682
|
};
|
|
1596
1683
|
|
|
1597
1684
|
//#endregion
|
|
1598
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1685
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/organization/permission.mjs
|
|
1599
1686
|
const hasPermissionFn = (input, acRoles) => {
|
|
1600
1687
|
if (!input.permissions) return false;
|
|
1601
1688
|
const roles = input.role.split(",");
|
|
@@ -1608,7 +1695,7 @@ const hasPermissionFn = (input, acRoles) => {
|
|
|
1608
1695
|
};
|
|
1609
1696
|
|
|
1610
1697
|
//#endregion
|
|
1611
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1698
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
|
|
1612
1699
|
const ORGANIZATION_ERROR_CODES = defineErrorCodes({
|
|
1613
1700
|
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
|
|
1614
1701
|
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
|
|
@@ -1677,9 +1764,11 @@ const t$1 = createAccessControl({
|
|
|
1677
1764
|
organization: [`update`, `delete`],
|
|
1678
1765
|
member: [
|
|
1679
1766
|
`create`,
|
|
1767
|
+
`read`,
|
|
1680
1768
|
`update`,
|
|
1681
1769
|
`delete`
|
|
1682
1770
|
],
|
|
1771
|
+
audit: [`read`],
|
|
1683
1772
|
project: [
|
|
1684
1773
|
`create`,
|
|
1685
1774
|
`read`,
|
|
@@ -1711,16 +1800,20 @@ const t$1 = createAccessControl({
|
|
|
1711
1800
|
`read`,
|
|
1712
1801
|
`revoke`
|
|
1713
1802
|
],
|
|
1714
|
-
evaluated_entity: [`read`, `delete`]
|
|
1803
|
+
evaluated_entity: [`read`, `delete`],
|
|
1804
|
+
billing: [`read`, `manage`]
|
|
1715
1805
|
});
|
|
1716
1806
|
const n$1 = {
|
|
1717
1807
|
viewer: t$1.newRole({
|
|
1808
|
+
member: [`read`],
|
|
1718
1809
|
project: [`read`],
|
|
1719
1810
|
environment: [`read`],
|
|
1720
1811
|
flag: [`read`],
|
|
1721
|
-
evaluated_entity: [`read`]
|
|
1812
|
+
evaluated_entity: [`read`],
|
|
1813
|
+
billing: [`read`]
|
|
1722
1814
|
}),
|
|
1723
1815
|
editor: t$1.newRole({
|
|
1816
|
+
member: [`read`],
|
|
1724
1817
|
project: [`read`, `update`],
|
|
1725
1818
|
environment: [`read`],
|
|
1726
1819
|
flag: [
|
|
@@ -1732,11 +1825,17 @@ const n$1 = {
|
|
|
1732
1825
|
flag_state: [`update`],
|
|
1733
1826
|
apiKey: [`read`],
|
|
1734
1827
|
sdk_key: [`read`],
|
|
1735
|
-
evaluated_entity: [`read`]
|
|
1828
|
+
evaluated_entity: [`read`],
|
|
1829
|
+
billing: [`read`]
|
|
1736
1830
|
}),
|
|
1737
1831
|
admin: t$1.newRole({
|
|
1738
1832
|
organization: [`update`],
|
|
1739
|
-
member: [
|
|
1833
|
+
member: [
|
|
1834
|
+
`create`,
|
|
1835
|
+
`read`,
|
|
1836
|
+
`update`
|
|
1837
|
+
],
|
|
1838
|
+
audit: [`read`],
|
|
1740
1839
|
project: [
|
|
1741
1840
|
`create`,
|
|
1742
1841
|
`read`,
|
|
@@ -1768,15 +1867,18 @@ const n$1 = {
|
|
|
1768
1867
|
`read`,
|
|
1769
1868
|
`revoke`
|
|
1770
1869
|
],
|
|
1771
|
-
evaluated_entity: [`read`, `delete`]
|
|
1870
|
+
evaluated_entity: [`read`, `delete`],
|
|
1871
|
+
billing: [`read`, `manage`]
|
|
1772
1872
|
}),
|
|
1773
1873
|
owner: t$1.newRole({
|
|
1774
1874
|
organization: [`update`, `delete`],
|
|
1775
1875
|
member: [
|
|
1776
1876
|
`create`,
|
|
1877
|
+
`read`,
|
|
1777
1878
|
`update`,
|
|
1778
1879
|
`delete`
|
|
1779
1880
|
],
|
|
1881
|
+
audit: [`read`],
|
|
1780
1882
|
project: [
|
|
1781
1883
|
`create`,
|
|
1782
1884
|
`read`,
|
|
@@ -1808,12 +1910,13 @@ const n$1 = {
|
|
|
1808
1910
|
`read`,
|
|
1809
1911
|
`revoke`
|
|
1810
1912
|
],
|
|
1811
|
-
evaluated_entity: [`read`, `delete`]
|
|
1913
|
+
evaluated_entity: [`read`, `delete`],
|
|
1914
|
+
billing: [`read`, `manage`]
|
|
1812
1915
|
})
|
|
1813
1916
|
};
|
|
1814
1917
|
|
|
1815
1918
|
//#endregion
|
|
1816
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
1919
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
1817
1920
|
const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
1818
1921
|
const now$1 = () => Math.floor(Date.now() / 1e3);
|
|
1819
1922
|
var WindowBroadcastChannel = class {
|
|
@@ -2030,7 +2133,7 @@ let onMount = ($store, initialize) => {
|
|
|
2030
2133
|
};
|
|
2031
2134
|
|
|
2032
2135
|
//#endregion
|
|
2033
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2136
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/equality.mjs
|
|
2034
2137
|
function isPlainObject(value) {
|
|
2035
2138
|
if (typeof value !== "object" || value === null) return false;
|
|
2036
2139
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -2071,7 +2174,7 @@ function withEquality(store, isEqual) {
|
|
|
2071
2174
|
}
|
|
2072
2175
|
|
|
2073
2176
|
//#endregion
|
|
2074
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2177
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
2075
2178
|
const kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
2076
2179
|
var WindowFocusManager = class {
|
|
2077
2180
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2101,7 +2204,7 @@ function getGlobalFocusManager() {
|
|
|
2101
2204
|
}
|
|
2102
2205
|
|
|
2103
2206
|
//#endregion
|
|
2104
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2207
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/online-manager.mjs
|
|
2105
2208
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
2106
2209
|
var WindowOnlineManager = class {
|
|
2107
2210
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2134,7 +2237,7 @@ function getGlobalOnlineManager() {
|
|
|
2134
2237
|
}
|
|
2135
2238
|
|
|
2136
2239
|
//#endregion
|
|
2137
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2240
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/query.mjs
|
|
2138
2241
|
const isServer$1 = () => typeof window === "undefined";
|
|
2139
2242
|
function isAuthQueryStateEqual(a, b) {
|
|
2140
2243
|
return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
|
|
@@ -2256,7 +2359,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2256
2359
|
};
|
|
2257
2360
|
|
|
2258
2361
|
//#endregion
|
|
2259
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2362
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
2260
2363
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
2261
2364
|
/**
|
|
2262
2365
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -2384,7 +2487,7 @@ function createSessionRefreshManager(opts) {
|
|
|
2384
2487
|
}
|
|
2385
2488
|
|
|
2386
2489
|
//#endregion
|
|
2387
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2490
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
2388
2491
|
const redirectPlugin = {
|
|
2389
2492
|
id: "redirect",
|
|
2390
2493
|
name: "Redirect",
|
|
@@ -2400,7 +2503,7 @@ const redirectPlugin = {
|
|
|
2400
2503
|
};
|
|
2401
2504
|
|
|
2402
2505
|
//#endregion
|
|
2403
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2506
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/session-atom.mjs
|
|
2404
2507
|
const isServer = () => typeof window === "undefined";
|
|
2405
2508
|
/**
|
|
2406
2509
|
* Normalize $fetch response: `throw: true` returns data directly,
|
|
@@ -2551,7 +2654,7 @@ function getSessionAtom($fetch, options) {
|
|
|
2551
2654
|
}
|
|
2552
2655
|
|
|
2553
2656
|
//#endregion
|
|
2554
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2657
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/config.mjs
|
|
2555
2658
|
const resolvePublicAuthUrl = (basePath) => {
|
|
2556
2659
|
if (typeof process === "undefined") return void 0;
|
|
2557
2660
|
const path = basePath ?? "/api/auth";
|
|
@@ -2650,13 +2753,13 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
2650
2753
|
};
|
|
2651
2754
|
|
|
2652
2755
|
//#endregion
|
|
2653
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2756
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
2654
2757
|
function isAtom(value) {
|
|
2655
2758
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
2656
2759
|
}
|
|
2657
2760
|
|
|
2658
2761
|
//#endregion
|
|
2659
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@
|
|
2762
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.1_@openteleme_92516152aeaed9865e4d3971447ef996/node_modules/@better-auth/core/dist/utils/string.mjs
|
|
2660
2763
|
function capitalizeFirstLetter(str) {
|
|
2661
2764
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2662
2765
|
}
|
|
@@ -2670,7 +2773,7 @@ function toKebabCase(input) {
|
|
|
2670
2773
|
}
|
|
2671
2774
|
|
|
2672
2775
|
//#endregion
|
|
2673
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2776
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/proxy.mjs
|
|
2674
2777
|
function getMethod(path, knownPathMethods, args) {
|
|
2675
2778
|
const method = knownPathMethods[path];
|
|
2676
2779
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -2746,7 +2849,7 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
2746
2849
|
}
|
|
2747
2850
|
|
|
2748
2851
|
//#endregion
|
|
2749
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2852
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/client/vanilla.mjs
|
|
2750
2853
|
function createAuthClient(options) {
|
|
2751
2854
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
2752
2855
|
const resolvedHooks = {};
|
|
@@ -2760,17 +2863,17 @@ function createAuthClient(options) {
|
|
|
2760
2863
|
}
|
|
2761
2864
|
|
|
2762
2865
|
//#endregion
|
|
2763
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2866
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/additional-fields/client.mjs
|
|
2764
2867
|
const inferAdditionalFields = (schema) => {
|
|
2765
2868
|
return {
|
|
2766
2869
|
id: "additional-fields-client",
|
|
2767
|
-
version: PACKAGE_VERSION$
|
|
2870
|
+
version: PACKAGE_VERSION$2,
|
|
2768
2871
|
$InferServerPlugin: {}
|
|
2769
2872
|
};
|
|
2770
2873
|
};
|
|
2771
2874
|
|
|
2772
2875
|
//#endregion
|
|
2773
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2876
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/admin/client.mjs
|
|
2774
2877
|
const adminClient = (options) => {
|
|
2775
2878
|
const roles = {
|
|
2776
2879
|
admin: adminAc$1,
|
|
@@ -2779,7 +2882,7 @@ const adminClient = (options) => {
|
|
|
2779
2882
|
};
|
|
2780
2883
|
return {
|
|
2781
2884
|
id: "admin-client",
|
|
2782
|
-
version: PACKAGE_VERSION$
|
|
2885
|
+
version: PACKAGE_VERSION$2,
|
|
2783
2886
|
$InferServerPlugin: {},
|
|
2784
2887
|
getActions: () => ({ admin: { checkRolePermission: (data) => {
|
|
2785
2888
|
return hasPermission({
|
|
@@ -2805,11 +2908,11 @@ const adminClient = (options) => {
|
|
|
2805
2908
|
};
|
|
2806
2909
|
|
|
2807
2910
|
//#endregion
|
|
2808
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2911
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
|
|
2809
2912
|
const deviceAuthorizationClient = () => {
|
|
2810
2913
|
return {
|
|
2811
2914
|
id: "device-authorization",
|
|
2812
|
-
version: PACKAGE_VERSION$
|
|
2915
|
+
version: PACKAGE_VERSION$2,
|
|
2813
2916
|
$InferServerPlugin: {},
|
|
2814
2917
|
pathMethods: {
|
|
2815
2918
|
"/device/code": "POST",
|
|
@@ -2822,7 +2925,7 @@ const deviceAuthorizationClient = () => {
|
|
|
2822
2925
|
};
|
|
2823
2926
|
|
|
2824
2927
|
//#endregion
|
|
2825
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@
|
|
2928
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.26_@opentelemetry+api@1.9.1_drizzle-orm@1.0.0-rc.4_@opentelemetry+api@1_20fb48331ea10f84b14a69b42b690fe2/node_modules/better-auth/dist/plugins/organization/client.mjs
|
|
2826
2929
|
/**
|
|
2827
2930
|
* Using the same `hasPermissionFn` function, but without the need for a `ctx` parameter or the `organizationId` parameter.
|
|
2828
2931
|
*/
|
|
@@ -2842,7 +2945,7 @@ const organizationClient = (options) => {
|
|
|
2842
2945
|
};
|
|
2843
2946
|
return {
|
|
2844
2947
|
id: "organization",
|
|
2845
|
-
version: PACKAGE_VERSION$
|
|
2948
|
+
version: PACKAGE_VERSION$2,
|
|
2846
2949
|
$InferServerPlugin: {},
|
|
2847
2950
|
getActions: ($fetch, _$store, co) => ({
|
|
2848
2951
|
$Infer: {
|
|
@@ -2920,7 +3023,7 @@ const organizationClient = (options) => {
|
|
|
2920
3023
|
};
|
|
2921
3024
|
|
|
2922
3025
|
//#endregion
|
|
2923
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-
|
|
3026
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-f_26c063546df2762d5214ad7424a4d563/node_modules/@better-auth/api-key/dist/version-vgVyvied.mjs
|
|
2924
3027
|
const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
2925
3028
|
INVALID_METADATA_TYPE: "metadata must be an object or undefined",
|
|
2926
3029
|
REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided",
|
|
@@ -2954,14 +3057,14 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
|
2954
3057
|
NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: "No default api-key configuration found.",
|
|
2955
3058
|
ORGANIZATION_PLUGIN_REQUIRED: "Organization plugin is required for organization-owned API keys. Please install and configure the organization plugin."
|
|
2956
3059
|
});
|
|
2957
|
-
const PACKAGE_VERSION = "1.6.26";
|
|
3060
|
+
const PACKAGE_VERSION$1 = "1.6.26";
|
|
2958
3061
|
|
|
2959
3062
|
//#endregion
|
|
2960
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-
|
|
3063
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-f_26c063546df2762d5214ad7424a4d563/node_modules/@better-auth/api-key/dist/client.mjs
|
|
2961
3064
|
const apiKeyClient = () => {
|
|
2962
3065
|
return {
|
|
2963
3066
|
id: "api-key",
|
|
2964
|
-
version: PACKAGE_VERSION,
|
|
3067
|
+
version: PACKAGE_VERSION$1,
|
|
2965
3068
|
$InferServerPlugin: {},
|
|
2966
3069
|
pathMethods: {
|
|
2967
3070
|
"/api-key/create": "POST",
|
|
@@ -2972,13 +3075,704 @@ const apiKeyClient = () => {
|
|
|
2972
3075
|
};
|
|
2973
3076
|
};
|
|
2974
3077
|
|
|
3078
|
+
//#endregion
|
|
3079
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-f_b9d6999fc8dc623532f797abb6d4608d/node_modules/@better-auth/passkey/dist/version-BE4wdr64.mjs
|
|
3080
|
+
const PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
3081
|
+
CHALLENGE_NOT_FOUND: "Challenge not found",
|
|
3082
|
+
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
|
|
3083
|
+
FAILED_TO_VERIFY_REGISTRATION: "Failed to verify registration",
|
|
3084
|
+
PASSKEY_NOT_FOUND: "Passkey not found",
|
|
3085
|
+
AUTHENTICATION_FAILED: "Authentication failed",
|
|
3086
|
+
UNABLE_TO_CREATE_SESSION: "Unable to create session",
|
|
3087
|
+
FAILED_TO_UPDATE_PASSKEY: "Failed to update passkey",
|
|
3088
|
+
PREVIOUSLY_REGISTERED: "Previously registered",
|
|
3089
|
+
REGISTRATION_CANCELLED: "Registration cancelled",
|
|
3090
|
+
AUTH_CANCELLED: "Auth cancelled",
|
|
3091
|
+
UNKNOWN_ERROR: "Unknown error",
|
|
3092
|
+
SESSION_REQUIRED: "Passkey registration requires an authenticated session",
|
|
3093
|
+
RESOLVE_USER_REQUIRED: "Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false",
|
|
3094
|
+
RESOLVED_USER_INVALID: "Resolved user is invalid"
|
|
3095
|
+
});
|
|
3096
|
+
const PACKAGE_VERSION = "1.6.26";
|
|
3097
|
+
|
|
3098
|
+
//#endregion
|
|
3099
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
|
|
3100
|
+
/**
|
|
3101
|
+
* Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various
|
|
3102
|
+
* credential response ArrayBuffers to string for sending back to the server as JSON.
|
|
3103
|
+
*
|
|
3104
|
+
* Helper method to compliment `base64URLStringToBuffer`
|
|
3105
|
+
*/
|
|
3106
|
+
function bufferToBase64URLString(buffer) {
|
|
3107
|
+
const bytes = new Uint8Array(buffer);
|
|
3108
|
+
let str = "";
|
|
3109
|
+
for (const charCode of bytes) str += String.fromCharCode(charCode);
|
|
3110
|
+
return btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
//#endregion
|
|
3114
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
3115
|
+
/**
|
|
3116
|
+
* Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a
|
|
3117
|
+
* credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
|
|
3118
|
+
* excludeCredentials
|
|
3119
|
+
*
|
|
3120
|
+
* Helper method to compliment `bufferToBase64URLString`
|
|
3121
|
+
*/
|
|
3122
|
+
function base64URLStringToBuffer(base64URLString) {
|
|
3123
|
+
const base64 = base64URLString.replace(/-/g, "+").replace(/_/g, "/");
|
|
3124
|
+
/**
|
|
3125
|
+
* Pad with '=' until it's a multiple of four
|
|
3126
|
+
* (4 - (85 % 4 = 1) = 3) % 4 = 3 padding
|
|
3127
|
+
* (4 - (86 % 4 = 2) = 2) % 4 = 2 padding
|
|
3128
|
+
* (4 - (87 % 4 = 3) = 1) % 4 = 1 padding
|
|
3129
|
+
* (4 - (88 % 4 = 0) = 4) % 4 = 0 padding
|
|
3130
|
+
*/
|
|
3131
|
+
const padLength = (4 - base64.length % 4) % 4;
|
|
3132
|
+
const padded = base64.padEnd(base64.length + padLength, "=");
|
|
3133
|
+
const binary = atob(padded);
|
|
3134
|
+
const buffer = new ArrayBuffer(binary.length);
|
|
3135
|
+
const bytes = new Uint8Array(buffer);
|
|
3136
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
3137
|
+
return buffer;
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
//#endregion
|
|
3141
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
3142
|
+
/**
|
|
3143
|
+
* Determine if the browser is capable of Webauthn
|
|
3144
|
+
*/
|
|
3145
|
+
function browserSupportsWebAuthn() {
|
|
3146
|
+
return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential === "function");
|
|
3147
|
+
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Make it possible to stub the return value during testing
|
|
3150
|
+
* @ignore Don't include this in docs output
|
|
3151
|
+
*/
|
|
3152
|
+
const _browserSupportsWebAuthnInternals = { stubThis: (value) => value };
|
|
3153
|
+
|
|
3154
|
+
//#endregion
|
|
3155
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
3156
|
+
function toPublicKeyCredentialDescriptor(descriptor) {
|
|
3157
|
+
const { id } = descriptor;
|
|
3158
|
+
return {
|
|
3159
|
+
...descriptor,
|
|
3160
|
+
id: base64URLStringToBuffer(id),
|
|
3161
|
+
/**
|
|
3162
|
+
* `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer
|
|
3163
|
+
* transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports
|
|
3164
|
+
* are fine to pass to WebAuthn since browsers will recognize the new value.
|
|
3165
|
+
*/
|
|
3166
|
+
transports: descriptor.transports
|
|
3167
|
+
};
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
//#endregion
|
|
3171
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
3172
|
+
/**
|
|
3173
|
+
* A simple test to determine if a hostname is a properly-formatted domain name
|
|
3174
|
+
*
|
|
3175
|
+
* A "valid domain" is defined here: https://url.spec.whatwg.org/#valid-domain
|
|
3176
|
+
*
|
|
3177
|
+
* Regex was originally sourced from here, then remixed to add punycode support:
|
|
3178
|
+
* https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html
|
|
3179
|
+
*/
|
|
3180
|
+
function isValidDomain(hostname) {
|
|
3181
|
+
return hostname === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname);
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
//#endregion
|
|
3185
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js
|
|
3186
|
+
/**
|
|
3187
|
+
* A custom Error used to return a more nuanced error detailing _why_ one of the eight documented
|
|
3188
|
+
* errors in the spec was raised after calling `navigator.credentials.create()` or
|
|
3189
|
+
* `navigator.credentials.get()`:
|
|
3190
|
+
*
|
|
3191
|
+
* - `AbortError`
|
|
3192
|
+
* - `ConstraintError`
|
|
3193
|
+
* - `InvalidStateError`
|
|
3194
|
+
* - `NotAllowedError`
|
|
3195
|
+
* - `NotSupportedError`
|
|
3196
|
+
* - `SecurityError`
|
|
3197
|
+
* - `TypeError`
|
|
3198
|
+
* - `UnknownError`
|
|
3199
|
+
*
|
|
3200
|
+
* Error messages were determined through investigation of the spec to determine under which
|
|
3201
|
+
* scenarios a given error would be raised.
|
|
3202
|
+
*/
|
|
3203
|
+
var WebAuthnError = class extends Error {
|
|
3204
|
+
constructor({ message, code, cause, name }) {
|
|
3205
|
+
super(message, { cause });
|
|
3206
|
+
Object.defineProperty(this, "code", {
|
|
3207
|
+
enumerable: true,
|
|
3208
|
+
configurable: true,
|
|
3209
|
+
writable: true,
|
|
3210
|
+
value: void 0
|
|
3211
|
+
});
|
|
3212
|
+
this.name = name ?? cause.name;
|
|
3213
|
+
this.code = code;
|
|
3214
|
+
}
|
|
3215
|
+
};
|
|
3216
|
+
|
|
3217
|
+
//#endregion
|
|
3218
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
3219
|
+
/**
|
|
3220
|
+
* Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`
|
|
3221
|
+
*/
|
|
3222
|
+
function identifyRegistrationError({ error, options }) {
|
|
3223
|
+
const { publicKey } = options;
|
|
3224
|
+
if (!publicKey) throw Error("options was missing required publicKey property");
|
|
3225
|
+
if (error.name === "AbortError") {
|
|
3226
|
+
if (options.signal instanceof AbortSignal) return new WebAuthnError({
|
|
3227
|
+
message: "Registration ceremony was sent an abort signal",
|
|
3228
|
+
code: "ERROR_CEREMONY_ABORTED",
|
|
3229
|
+
cause: error
|
|
3230
|
+
});
|
|
3231
|
+
} else if (error.name === "ConstraintError") {
|
|
3232
|
+
if (publicKey.authenticatorSelection?.requireResidentKey === true) return new WebAuthnError({
|
|
3233
|
+
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
3234
|
+
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
3235
|
+
cause: error
|
|
3236
|
+
});
|
|
3237
|
+
else if (options.mediation === "conditional" && publicKey.authenticatorSelection?.userVerification === "required") return new WebAuthnError({
|
|
3238
|
+
message: "User verification was required during automatic registration but it could not be performed",
|
|
3239
|
+
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
3240
|
+
cause: error
|
|
3241
|
+
});
|
|
3242
|
+
else if (publicKey.authenticatorSelection?.userVerification === "required") return new WebAuthnError({
|
|
3243
|
+
message: "User verification was required but no available authenticator supported it",
|
|
3244
|
+
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
3245
|
+
cause: error
|
|
3246
|
+
});
|
|
3247
|
+
} else if (error.name === "InvalidStateError") return new WebAuthnError({
|
|
3248
|
+
message: "The authenticator was previously registered",
|
|
3249
|
+
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
3250
|
+
cause: error
|
|
3251
|
+
});
|
|
3252
|
+
else if (error.name === "NotAllowedError")
|
|
3253
|
+
/**
|
|
3254
|
+
* Pass the error directly through. Platforms are overloading this error beyond what the spec
|
|
3255
|
+
* defines and we don't want to overwrite potentially useful error messages.
|
|
3256
|
+
*/
|
|
3257
|
+
return new WebAuthnError({
|
|
3258
|
+
message: error.message,
|
|
3259
|
+
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
3260
|
+
cause: error
|
|
3261
|
+
});
|
|
3262
|
+
else if (error.name === "NotSupportedError") {
|
|
3263
|
+
if (publicKey.pubKeyCredParams.filter((param) => param.type === "public-key").length === 0) return new WebAuthnError({
|
|
3264
|
+
message: "No entry in pubKeyCredParams was of type \"public-key\"",
|
|
3265
|
+
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
3266
|
+
cause: error
|
|
3267
|
+
});
|
|
3268
|
+
return new WebAuthnError({
|
|
3269
|
+
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
3270
|
+
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
3271
|
+
cause: error
|
|
3272
|
+
});
|
|
3273
|
+
} else if (error.name === "SecurityError") {
|
|
3274
|
+
const effectiveDomain = globalThis.location.hostname;
|
|
3275
|
+
if (!isValidDomain(effectiveDomain)) return new WebAuthnError({
|
|
3276
|
+
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3277
|
+
code: "ERROR_INVALID_DOMAIN",
|
|
3278
|
+
cause: error
|
|
3279
|
+
});
|
|
3280
|
+
else if (publicKey.rp.id !== effectiveDomain) return new WebAuthnError({
|
|
3281
|
+
message: `The RP ID "${publicKey.rp.id}" is invalid for this domain`,
|
|
3282
|
+
code: "ERROR_INVALID_RP_ID",
|
|
3283
|
+
cause: error
|
|
3284
|
+
});
|
|
3285
|
+
} else if (error.name === "TypeError") {
|
|
3286
|
+
if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) return new WebAuthnError({
|
|
3287
|
+
message: "User ID was not between 1 and 64 characters",
|
|
3288
|
+
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
3289
|
+
cause: error
|
|
3290
|
+
});
|
|
3291
|
+
} else if (error.name === "UnknownError") return new WebAuthnError({
|
|
3292
|
+
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
3293
|
+
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
3294
|
+
cause: error
|
|
3295
|
+
});
|
|
3296
|
+
return error;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
//#endregion
|
|
3300
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js
|
|
3301
|
+
var BaseWebAuthnAbortService = class {
|
|
3302
|
+
constructor() {
|
|
3303
|
+
Object.defineProperty(this, "controller", {
|
|
3304
|
+
enumerable: true,
|
|
3305
|
+
configurable: true,
|
|
3306
|
+
writable: true,
|
|
3307
|
+
value: void 0
|
|
3308
|
+
});
|
|
3309
|
+
}
|
|
3310
|
+
createNewAbortSignal() {
|
|
3311
|
+
if (this.controller) {
|
|
3312
|
+
const abortError = /* @__PURE__ */ new Error("Cancelling existing WebAuthn API call for new one");
|
|
3313
|
+
abortError.name = "AbortError";
|
|
3314
|
+
this.controller.abort(abortError);
|
|
3315
|
+
}
|
|
3316
|
+
const newController = new AbortController();
|
|
3317
|
+
this.controller = newController;
|
|
3318
|
+
return newController.signal;
|
|
3319
|
+
}
|
|
3320
|
+
cancelCeremony() {
|
|
3321
|
+
if (this.controller) {
|
|
3322
|
+
const abortError = /* @__PURE__ */ new Error("Manually cancelling existing WebAuthn API call");
|
|
3323
|
+
abortError.name = "AbortError";
|
|
3324
|
+
this.controller.abort(abortError);
|
|
3325
|
+
this.controller = void 0;
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
};
|
|
3329
|
+
/**
|
|
3330
|
+
* A service singleton to help ensure that only a single WebAuthn ceremony is active at a time.
|
|
3331
|
+
*
|
|
3332
|
+
* Users of **@simplewebauthn/browser** shouldn't typically need to use this, but it can help e.g.
|
|
3333
|
+
* developers building projects that use client-side routing to better control the behavior of
|
|
3334
|
+
* their UX in response to router navigation events.
|
|
3335
|
+
*/
|
|
3336
|
+
const WebAuthnAbortService = new BaseWebAuthnAbortService();
|
|
3337
|
+
|
|
3338
|
+
//#endregion
|
|
3339
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js
|
|
3340
|
+
const attachments = ["cross-platform", "platform"];
|
|
3341
|
+
/**
|
|
3342
|
+
* If possible coerce a `string` value into a known `AuthenticatorAttachment`
|
|
3343
|
+
*/
|
|
3344
|
+
function toAuthenticatorAttachment(attachment) {
|
|
3345
|
+
if (!attachment) return;
|
|
3346
|
+
if (attachments.indexOf(attachment) < 0) return;
|
|
3347
|
+
return attachment;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
//#endregion
|
|
3351
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
3352
|
+
/**
|
|
3353
|
+
* Begin authenticator "registration" via WebAuthn attestation
|
|
3354
|
+
*
|
|
3355
|
+
* @param optionsJSON Output from **@simplewebauthn/server**'s `generateRegistrationOptions()`
|
|
3356
|
+
* @param useAutoRegister (Optional) Try to silently create a passkey with the password manager that the user just signed in with. Defaults to `false`.
|
|
3357
|
+
*/
|
|
3358
|
+
async function startRegistration(options) {
|
|
3359
|
+
if (!options.optionsJSON && options.challenge) {
|
|
3360
|
+
console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.");
|
|
3361
|
+
options = { optionsJSON: options };
|
|
3362
|
+
}
|
|
3363
|
+
const { optionsJSON, useAutoRegister = false } = options;
|
|
3364
|
+
if (!browserSupportsWebAuthn()) throw new Error("WebAuthn is not supported in this browser");
|
|
3365
|
+
const publicKey = {
|
|
3366
|
+
...optionsJSON,
|
|
3367
|
+
challenge: base64URLStringToBuffer(optionsJSON.challenge),
|
|
3368
|
+
user: {
|
|
3369
|
+
...optionsJSON.user,
|
|
3370
|
+
id: base64URLStringToBuffer(optionsJSON.user.id)
|
|
3371
|
+
},
|
|
3372
|
+
excludeCredentials: optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor)
|
|
3373
|
+
};
|
|
3374
|
+
const createOptions = {};
|
|
3375
|
+
/**
|
|
3376
|
+
* Try to use conditional create to register a passkey for the user with the password manager
|
|
3377
|
+
* the user just used to authenticate with. The user won't be shown any prominent UI by the
|
|
3378
|
+
* browser.
|
|
3379
|
+
*/
|
|
3380
|
+
if (useAutoRegister) createOptions.mediation = "conditional";
|
|
3381
|
+
createOptions.publicKey = publicKey;
|
|
3382
|
+
createOptions.signal = WebAuthnAbortService.createNewAbortSignal();
|
|
3383
|
+
let credential;
|
|
3384
|
+
try {
|
|
3385
|
+
credential = await navigator.credentials.create(createOptions);
|
|
3386
|
+
} catch (err) {
|
|
3387
|
+
throw identifyRegistrationError({
|
|
3388
|
+
error: err,
|
|
3389
|
+
options: createOptions
|
|
3390
|
+
});
|
|
3391
|
+
}
|
|
3392
|
+
if (!credential) throw new Error("Registration was not completed");
|
|
3393
|
+
const { id, rawId, response, type } = credential;
|
|
3394
|
+
let transports = void 0;
|
|
3395
|
+
if (typeof response.getTransports === "function") transports = response.getTransports();
|
|
3396
|
+
let responsePublicKeyAlgorithm = void 0;
|
|
3397
|
+
if (typeof response.getPublicKeyAlgorithm === "function") try {
|
|
3398
|
+
responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
|
|
3399
|
+
} catch (error) {
|
|
3400
|
+
warnOnBrokenImplementation("getPublicKeyAlgorithm()", error);
|
|
3401
|
+
}
|
|
3402
|
+
let responsePublicKey = void 0;
|
|
3403
|
+
if (typeof response.getPublicKey === "function") try {
|
|
3404
|
+
const _publicKey = response.getPublicKey();
|
|
3405
|
+
if (_publicKey !== null) responsePublicKey = bufferToBase64URLString(_publicKey);
|
|
3406
|
+
} catch (error) {
|
|
3407
|
+
warnOnBrokenImplementation("getPublicKey()", error);
|
|
3408
|
+
}
|
|
3409
|
+
let responseAuthenticatorData;
|
|
3410
|
+
if (typeof response.getAuthenticatorData === "function") try {
|
|
3411
|
+
responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());
|
|
3412
|
+
} catch (error) {
|
|
3413
|
+
warnOnBrokenImplementation("getAuthenticatorData()", error);
|
|
3414
|
+
}
|
|
3415
|
+
return {
|
|
3416
|
+
id,
|
|
3417
|
+
rawId: bufferToBase64URLString(rawId),
|
|
3418
|
+
response: {
|
|
3419
|
+
attestationObject: bufferToBase64URLString(response.attestationObject),
|
|
3420
|
+
clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
|
|
3421
|
+
transports,
|
|
3422
|
+
publicKeyAlgorithm: responsePublicKeyAlgorithm,
|
|
3423
|
+
publicKey: responsePublicKey,
|
|
3424
|
+
authenticatorData: responseAuthenticatorData
|
|
3425
|
+
},
|
|
3426
|
+
type,
|
|
3427
|
+
clientExtensionResults: credential.getClientExtensionResults(),
|
|
3428
|
+
authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment)
|
|
3429
|
+
};
|
|
3430
|
+
}
|
|
3431
|
+
/**
|
|
3432
|
+
* Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API
|
|
3433
|
+
* calls
|
|
3434
|
+
*/
|
|
3435
|
+
function warnOnBrokenImplementation(methodName, cause) {
|
|
3436
|
+
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\n`, cause);
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
//#endregion
|
|
3440
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
3441
|
+
/**
|
|
3442
|
+
* Determine if the browser supports conditional UI, so that WebAuthn credentials can
|
|
3443
|
+
* be shown to the user in the browser's typical password autofill popup.
|
|
3444
|
+
*/
|
|
3445
|
+
function browserSupportsWebAuthnAutofill() {
|
|
3446
|
+
if (!browserSupportsWebAuthn()) return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
|
|
3447
|
+
/**
|
|
3448
|
+
* I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in
|
|
3449
|
+
* TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I
|
|
3450
|
+
* want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types
|
|
3451
|
+
* have a chance to catch up.
|
|
3452
|
+
*/
|
|
3453
|
+
const globalPublicKeyCredential = globalThis.PublicKeyCredential;
|
|
3454
|
+
if (globalPublicKeyCredential?.isConditionalMediationAvailable === void 0) return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
|
|
3455
|
+
return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());
|
|
3456
|
+
}
|
|
3457
|
+
const _browserSupportsWebAuthnAutofillInternals = { stubThis: (value) => value };
|
|
3458
|
+
|
|
3459
|
+
//#endregion
|
|
3460
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
3461
|
+
/**
|
|
3462
|
+
* Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`
|
|
3463
|
+
*/
|
|
3464
|
+
function identifyAuthenticationError({ error, options }) {
|
|
3465
|
+
const { publicKey } = options;
|
|
3466
|
+
if (!publicKey) throw Error("options was missing required publicKey property");
|
|
3467
|
+
if (error.name === "AbortError") {
|
|
3468
|
+
if (options.signal instanceof AbortSignal) return new WebAuthnError({
|
|
3469
|
+
message: "Authentication ceremony was sent an abort signal",
|
|
3470
|
+
code: "ERROR_CEREMONY_ABORTED",
|
|
3471
|
+
cause: error
|
|
3472
|
+
});
|
|
3473
|
+
} else if (error.name === "NotAllowedError")
|
|
3474
|
+
/**
|
|
3475
|
+
* Pass the error directly through. Platforms are overloading this error beyond what the spec
|
|
3476
|
+
* defines and we don't want to overwrite potentially useful error messages.
|
|
3477
|
+
*/
|
|
3478
|
+
return new WebAuthnError({
|
|
3479
|
+
message: error.message,
|
|
3480
|
+
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
3481
|
+
cause: error
|
|
3482
|
+
});
|
|
3483
|
+
else if (error.name === "SecurityError") {
|
|
3484
|
+
const effectiveDomain = globalThis.location.hostname;
|
|
3485
|
+
if (!isValidDomain(effectiveDomain)) return new WebAuthnError({
|
|
3486
|
+
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3487
|
+
code: "ERROR_INVALID_DOMAIN",
|
|
3488
|
+
cause: error
|
|
3489
|
+
});
|
|
3490
|
+
else if (publicKey.rpId !== effectiveDomain) return new WebAuthnError({
|
|
3491
|
+
message: `The RP ID "${publicKey.rpId}" is invalid for this domain`,
|
|
3492
|
+
code: "ERROR_INVALID_RP_ID",
|
|
3493
|
+
cause: error
|
|
3494
|
+
});
|
|
3495
|
+
} else if (error.name === "UnknownError") return new WebAuthnError({
|
|
3496
|
+
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
3497
|
+
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
3498
|
+
cause: error
|
|
3499
|
+
});
|
|
3500
|
+
return error;
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
//#endregion
|
|
3504
|
+
//#region ../../node_modules/.pnpm/@simplewebauthn+browser@13.3.0/node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3505
|
+
/**
|
|
3506
|
+
* Begin authenticator "login" via WebAuthn assertion
|
|
3507
|
+
*
|
|
3508
|
+
* @param optionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`
|
|
3509
|
+
* @param useBrowserAutofill (Optional) Initialize conditional UI to enable logging in via browser autofill prompts. Defaults to `false`.
|
|
3510
|
+
* @param verifyBrowserAutofillInput (Optional) Ensure a suitable `<input>` element is present when `useBrowserAutofill` is `true`. Defaults to `true`.
|
|
3511
|
+
*/
|
|
3512
|
+
async function startAuthentication(options) {
|
|
3513
|
+
if (!options.optionsJSON && options.challenge) {
|
|
3514
|
+
console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.");
|
|
3515
|
+
options = { optionsJSON: options };
|
|
3516
|
+
}
|
|
3517
|
+
const { optionsJSON, useBrowserAutofill = false, verifyBrowserAutofillInput = true } = options;
|
|
3518
|
+
if (!browserSupportsWebAuthn()) throw new Error("WebAuthn is not supported in this browser");
|
|
3519
|
+
let allowCredentials;
|
|
3520
|
+
if (optionsJSON.allowCredentials?.length !== 0) allowCredentials = optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);
|
|
3521
|
+
const publicKey = {
|
|
3522
|
+
...optionsJSON,
|
|
3523
|
+
challenge: base64URLStringToBuffer(optionsJSON.challenge),
|
|
3524
|
+
allowCredentials
|
|
3525
|
+
};
|
|
3526
|
+
const getOptions = {};
|
|
3527
|
+
/**
|
|
3528
|
+
* Set up the page to prompt the user to select a credential for authentication via the browser's
|
|
3529
|
+
* input autofill mechanism.
|
|
3530
|
+
*/
|
|
3531
|
+
if (useBrowserAutofill) {
|
|
3532
|
+
if (!await browserSupportsWebAuthnAutofill()) throw Error("Browser does not support WebAuthn autofill");
|
|
3533
|
+
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && verifyBrowserAutofillInput) throw Error("No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected");
|
|
3534
|
+
getOptions.mediation = "conditional";
|
|
3535
|
+
publicKey.allowCredentials = [];
|
|
3536
|
+
}
|
|
3537
|
+
getOptions.publicKey = publicKey;
|
|
3538
|
+
getOptions.signal = WebAuthnAbortService.createNewAbortSignal();
|
|
3539
|
+
let credential;
|
|
3540
|
+
try {
|
|
3541
|
+
credential = await navigator.credentials.get(getOptions);
|
|
3542
|
+
} catch (err) {
|
|
3543
|
+
throw identifyAuthenticationError({
|
|
3544
|
+
error: err,
|
|
3545
|
+
options: getOptions
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
if (!credential) throw new Error("Authentication was not completed");
|
|
3549
|
+
const { id, rawId, response, type } = credential;
|
|
3550
|
+
let userHandle = void 0;
|
|
3551
|
+
if (response.userHandle) userHandle = bufferToBase64URLString(response.userHandle);
|
|
3552
|
+
return {
|
|
3553
|
+
id,
|
|
3554
|
+
rawId: bufferToBase64URLString(rawId),
|
|
3555
|
+
response: {
|
|
3556
|
+
authenticatorData: bufferToBase64URLString(response.authenticatorData),
|
|
3557
|
+
clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
|
|
3558
|
+
signature: bufferToBase64URLString(response.signature),
|
|
3559
|
+
userHandle
|
|
3560
|
+
},
|
|
3561
|
+
type,
|
|
3562
|
+
clientExtensionResults: credential.getClientExtensionResults(),
|
|
3563
|
+
authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment)
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3567
|
+
//#endregion
|
|
3568
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.6.26_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-f_b9d6999fc8dc623532f797abb6d4608d/node_modules/@better-auth/passkey/dist/client.mjs
|
|
3569
|
+
const getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
|
|
3570
|
+
const signInPasskey = async (opts, options) => {
|
|
3571
|
+
const response = await $fetch("/passkey/generate-authenticate-options", {
|
|
3572
|
+
method: "GET",
|
|
3573
|
+
throw: false
|
|
3574
|
+
});
|
|
3575
|
+
if (!response.data) return response;
|
|
3576
|
+
const mergedExtensions = response.data.extensions || opts?.extensions ? {
|
|
3577
|
+
...response.data.extensions || {},
|
|
3578
|
+
...opts?.extensions || {}
|
|
3579
|
+
} : void 0;
|
|
3580
|
+
let res;
|
|
3581
|
+
try {
|
|
3582
|
+
res = await startAuthentication({
|
|
3583
|
+
optionsJSON: {
|
|
3584
|
+
...response.data,
|
|
3585
|
+
extensions: mergedExtensions
|
|
3586
|
+
},
|
|
3587
|
+
useBrowserAutofill: opts?.autoFill
|
|
3588
|
+
});
|
|
3589
|
+
} catch (err) {
|
|
3590
|
+
return {
|
|
3591
|
+
data: null,
|
|
3592
|
+
error: {
|
|
3593
|
+
code: err instanceof WebAuthnError ? err.code : "AUTH_CANCELLED",
|
|
3594
|
+
message: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,
|
|
3595
|
+
status: 400,
|
|
3596
|
+
statusText: "BAD_REQUEST"
|
|
3597
|
+
}
|
|
3598
|
+
};
|
|
3599
|
+
}
|
|
3600
|
+
try {
|
|
3601
|
+
const { clientExtensionResults, ...responseBody } = res;
|
|
3602
|
+
const verified = await $fetch("/passkey/verify-authentication", {
|
|
3603
|
+
body: { response: responseBody },
|
|
3604
|
+
...opts?.fetchOptions,
|
|
3605
|
+
...options,
|
|
3606
|
+
method: "POST",
|
|
3607
|
+
throw: false
|
|
3608
|
+
});
|
|
3609
|
+
$listPasskeys.set(Math.random());
|
|
3610
|
+
$store.notify("$sessionSignal");
|
|
3611
|
+
if (opts?.returnWebAuthnResponse) return {
|
|
3612
|
+
...verified,
|
|
3613
|
+
webauthn: {
|
|
3614
|
+
response: res,
|
|
3615
|
+
clientExtensionResults
|
|
3616
|
+
}
|
|
3617
|
+
};
|
|
3618
|
+
return verified;
|
|
3619
|
+
} catch (err) {
|
|
3620
|
+
console.error(`[Better Auth] Error verifying passkey`, err);
|
|
3621
|
+
return {
|
|
3622
|
+
data: null,
|
|
3623
|
+
error: {
|
|
3624
|
+
code: "AUTH_CANCELLED",
|
|
3625
|
+
message: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,
|
|
3626
|
+
status: 400,
|
|
3627
|
+
statusText: "BAD_REQUEST"
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
}
|
|
3631
|
+
};
|
|
3632
|
+
const registerPasskey = async (opts, fetchOpts) => {
|
|
3633
|
+
const options = await $fetch("/passkey/generate-register-options", {
|
|
3634
|
+
method: "GET",
|
|
3635
|
+
query: {
|
|
3636
|
+
...opts?.authenticatorAttachment && { authenticatorAttachment: opts.authenticatorAttachment },
|
|
3637
|
+
...opts?.name && { name: opts.name },
|
|
3638
|
+
...opts?.context && { context: opts.context }
|
|
3639
|
+
},
|
|
3640
|
+
throw: false
|
|
3641
|
+
});
|
|
3642
|
+
if (!options.data) return options;
|
|
3643
|
+
try {
|
|
3644
|
+
const mergedExtensions = options.data.extensions || opts?.extensions ? {
|
|
3645
|
+
...options.data.extensions || {},
|
|
3646
|
+
...opts?.extensions || {}
|
|
3647
|
+
} : void 0;
|
|
3648
|
+
const res = await startRegistration({
|
|
3649
|
+
optionsJSON: {
|
|
3650
|
+
...options.data,
|
|
3651
|
+
extensions: mergedExtensions
|
|
3652
|
+
},
|
|
3653
|
+
useAutoRegister: opts?.useAutoRegister
|
|
3654
|
+
});
|
|
3655
|
+
const { clientExtensionResults, ...responseBody } = res;
|
|
3656
|
+
const verified = await $fetch("/passkey/verify-registration", {
|
|
3657
|
+
...opts?.fetchOptions,
|
|
3658
|
+
...fetchOpts,
|
|
3659
|
+
body: {
|
|
3660
|
+
response: responseBody,
|
|
3661
|
+
name: opts?.name
|
|
3662
|
+
},
|
|
3663
|
+
method: "POST",
|
|
3664
|
+
throw: false
|
|
3665
|
+
});
|
|
3666
|
+
if (!verified.data) return verified;
|
|
3667
|
+
$listPasskeys.set(Math.random());
|
|
3668
|
+
if (opts?.returnWebAuthnResponse) return {
|
|
3669
|
+
...verified,
|
|
3670
|
+
webauthn: {
|
|
3671
|
+
response: res,
|
|
3672
|
+
clientExtensionResults
|
|
3673
|
+
}
|
|
3674
|
+
};
|
|
3675
|
+
return verified;
|
|
3676
|
+
} catch (e) {
|
|
3677
|
+
if (e instanceof WebAuthnError) {
|
|
3678
|
+
if (e.code === "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED") return {
|
|
3679
|
+
data: null,
|
|
3680
|
+
error: {
|
|
3681
|
+
code: e.code,
|
|
3682
|
+
message: PASSKEY_ERROR_CODES.PREVIOUSLY_REGISTERED.message,
|
|
3683
|
+
status: 400,
|
|
3684
|
+
statusText: "BAD_REQUEST"
|
|
3685
|
+
}
|
|
3686
|
+
};
|
|
3687
|
+
if (e.code === "ERROR_CEREMONY_ABORTED") return {
|
|
3688
|
+
data: null,
|
|
3689
|
+
error: {
|
|
3690
|
+
code: e.code,
|
|
3691
|
+
message: PASSKEY_ERROR_CODES.REGISTRATION_CANCELLED.message,
|
|
3692
|
+
status: 400,
|
|
3693
|
+
statusText: "BAD_REQUEST"
|
|
3694
|
+
}
|
|
3695
|
+
};
|
|
3696
|
+
return {
|
|
3697
|
+
data: null,
|
|
3698
|
+
error: {
|
|
3699
|
+
code: e.code,
|
|
3700
|
+
message: e.message,
|
|
3701
|
+
status: 400,
|
|
3702
|
+
statusText: "BAD_REQUEST"
|
|
3703
|
+
}
|
|
3704
|
+
};
|
|
3705
|
+
}
|
|
3706
|
+
return {
|
|
3707
|
+
data: null,
|
|
3708
|
+
error: {
|
|
3709
|
+
code: "UNKNOWN_ERROR",
|
|
3710
|
+
message: e instanceof Error ? e.message : PASSKEY_ERROR_CODES.UNKNOWN_ERROR.message,
|
|
3711
|
+
status: 500,
|
|
3712
|
+
statusText: "INTERNAL_SERVER_ERROR"
|
|
3713
|
+
}
|
|
3714
|
+
};
|
|
3715
|
+
}
|
|
3716
|
+
};
|
|
3717
|
+
return {
|
|
3718
|
+
signIn: {
|
|
3719
|
+
/**
|
|
3720
|
+
* Sign in with a registered passkey
|
|
3721
|
+
*/
|
|
3722
|
+
passkey: signInPasskey },
|
|
3723
|
+
passkey: {
|
|
3724
|
+
/**
|
|
3725
|
+
* Add a passkey to the user account
|
|
3726
|
+
*/
|
|
3727
|
+
addPasskey: registerPasskey },
|
|
3728
|
+
/**
|
|
3729
|
+
* Inferred Internal Types
|
|
3730
|
+
*/
|
|
3731
|
+
$Infer: {}
|
|
3732
|
+
};
|
|
3733
|
+
};
|
|
3734
|
+
const passkeyClient = () => {
|
|
3735
|
+
const $listPasskeys = /* @__PURE__ */ atom();
|
|
3736
|
+
return {
|
|
3737
|
+
id: "passkey",
|
|
3738
|
+
version: PACKAGE_VERSION,
|
|
3739
|
+
$InferServerPlugin: {},
|
|
3740
|
+
getActions: ($fetch, $store) => getPasskeyActions($fetch, {
|
|
3741
|
+
$listPasskeys,
|
|
3742
|
+
$store
|
|
3743
|
+
}),
|
|
3744
|
+
getAtoms($fetch) {
|
|
3745
|
+
return {
|
|
3746
|
+
listPasskeys: useAuthQuery($listPasskeys, "/passkey/list-user-passkeys", $fetch, { method: "GET" }),
|
|
3747
|
+
$listPasskeys
|
|
3748
|
+
};
|
|
3749
|
+
},
|
|
3750
|
+
pathMethods: {
|
|
3751
|
+
"/passkey/register": "POST",
|
|
3752
|
+
"/passkey/authenticate": "POST"
|
|
3753
|
+
},
|
|
3754
|
+
atomListeners: [{
|
|
3755
|
+
matcher(path) {
|
|
3756
|
+
return path === "/passkey/verify-registration" || path === "/passkey/delete-passkey" || path === "/passkey/update-passkey" || path === "/sign-out";
|
|
3757
|
+
},
|
|
3758
|
+
signal: "$listPasskeys"
|
|
3759
|
+
}, {
|
|
3760
|
+
matcher: (path) => path === "/passkey/verify-authentication",
|
|
3761
|
+
signal: "$sessionSignal"
|
|
3762
|
+
}],
|
|
3763
|
+
$ERROR_CODES: PASSKEY_ERROR_CODES
|
|
3764
|
+
};
|
|
3765
|
+
};
|
|
3766
|
+
|
|
2975
3767
|
//#endregion
|
|
2976
3768
|
//#region ../auth/dist/client.mjs
|
|
2977
|
-
function
|
|
3769
|
+
function u$1(n) {
|
|
2978
3770
|
return [
|
|
2979
3771
|
apiKeyClient(),
|
|
2980
3772
|
adminClient(),
|
|
2981
3773
|
deviceAuthorizationClient(),
|
|
3774
|
+
twoFactorClient({ twoFactorPage: n?.twoFactorPage ?? `/auth/two-factor` }),
|
|
3775
|
+
passkeyClient(),
|
|
2982
3776
|
organizationClient({
|
|
2983
3777
|
ac: t$1,
|
|
2984
3778
|
roles: n$1
|
|
@@ -2986,10 +3780,11 @@ function c$1() {
|
|
|
2986
3780
|
inferAdditionalFields()
|
|
2987
3781
|
];
|
|
2988
3782
|
}
|
|
2989
|
-
const
|
|
3783
|
+
const d$1 = (e) => createAuthClient({
|
|
2990
3784
|
baseURL: e.baseURL,
|
|
2991
3785
|
basePath: e.basePath,
|
|
2992
|
-
|
|
3786
|
+
fetchOptions: e.fetchOptions,
|
|
3787
|
+
plugins: u$1(e)
|
|
2993
3788
|
});
|
|
2994
3789
|
|
|
2995
3790
|
//#endregion
|
|
@@ -3015,7 +3810,7 @@ function exitCodeForError(error) {
|
|
|
3015
3810
|
//#region src/lib/client.ts
|
|
3016
3811
|
const AUTH_BASE_PATH = "/api/v1/auth";
|
|
3017
3812
|
function createCliAuthClient(apiUrl) {
|
|
3018
|
-
return
|
|
3813
|
+
return d$1({
|
|
3019
3814
|
baseURL: apiUrl,
|
|
3020
3815
|
basePath: AUTH_BASE_PATH
|
|
3021
3816
|
});
|
|
@@ -3079,7 +3874,7 @@ async function createCliApiClient(runtime) {
|
|
|
3079
3874
|
sessionToken,
|
|
3080
3875
|
orgSlug: runtime.org
|
|
3081
3876
|
});
|
|
3082
|
-
const client =
|
|
3877
|
+
const client = x$1({
|
|
3083
3878
|
baseUrl: runtime.apiUrl,
|
|
3084
3879
|
client: "cli",
|
|
3085
3880
|
getHeaders: () => {
|
|
@@ -3140,9 +3935,9 @@ async function resolveIds(client, runtime) {
|
|
|
3140
3935
|
|
|
3141
3936
|
//#endregion
|
|
3142
3937
|
//#region src/lib/output.ts
|
|
3143
|
-
function getRuntime(command) {
|
|
3938
|
+
function getRuntime(command, options) {
|
|
3144
3939
|
const opts = command.optsWithGlobals();
|
|
3145
|
-
return resolveRuntimeConfig(opts);
|
|
3940
|
+
return resolveRuntimeConfig(opts, options);
|
|
3146
3941
|
}
|
|
3147
3942
|
function printResult(runtime, data, human) {
|
|
3148
3943
|
if (runtime.json) {
|
|
@@ -3178,9 +3973,10 @@ function e(e) {
|
|
|
3178
3973
|
//#region src/commands/auth.ts
|
|
3179
3974
|
const CLIENT_ID = "shipd-cli";
|
|
3180
3975
|
const MANAGEMENT_KEY_PREFIX = "shipd_mgmt_";
|
|
3976
|
+
const DEFAULT_API_URL = "https://api.useshipd.com";
|
|
3181
3977
|
function registerAuthCommands(program) {
|
|
3182
|
-
program.command("login").description("Authenticate via browser device authorization").action(async (_opts, command) => {
|
|
3183
|
-
const runtime = getRuntime(command);
|
|
3978
|
+
program.command("login").description("Authenticate via browser device authorization").addOption(new Option("--api-url <url>", `API origin (default: ${DEFAULT_API_URL})`).env("SHIPD_API_URL")).action(async (_opts, command) => {
|
|
3979
|
+
const runtime = getRuntime(command, { defaultApiUrl: DEFAULT_API_URL });
|
|
3184
3980
|
const auth = e(createCliAuthClient(runtime.apiUrl));
|
|
3185
3981
|
const codeResult = await auth.device.code({ client_id: CLIENT_ID });
|
|
3186
3982
|
if (codeResult.error) throw new CliError("unauthenticated", codeResult.error.error_description ?? "Failed to start device authorization");
|
|
@@ -3286,7 +4082,12 @@ function a(e) {
|
|
|
3286
4082
|
return i.has(e);
|
|
3287
4083
|
}
|
|
3288
4084
|
const o = z.string().min(1).refine((e) => e.trim().length > 0, { message: `flag key must not be empty or whitespace-only` }).refine((e) => !a(e), { message: `flag key "__proto__" is reserved` });
|
|
3289
|
-
const s = z.
|
|
4085
|
+
const s = z.union([
|
|
4086
|
+
z.string(),
|
|
4087
|
+
z.number(),
|
|
4088
|
+
z.boolean()
|
|
4089
|
+
]);
|
|
4090
|
+
const c = z.discriminatedUnion(`kind`, [
|
|
3290
4091
|
z.object({
|
|
3291
4092
|
kind: z.literal(`boolean`),
|
|
3292
4093
|
value: z.boolean()
|
|
@@ -3305,45 +4106,93 @@ const s = z.discriminatedUnion(`kind`, [
|
|
|
3305
4106
|
}),
|
|
3306
4107
|
z.object({ kind: z.literal(`disabled`) })
|
|
3307
4108
|
]);
|
|
3308
|
-
const
|
|
3309
|
-
z.
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
4109
|
+
const l = z.object({
|
|
4110
|
+
kind: z.literal(`weighted`),
|
|
4111
|
+
variations: z.array(z.object({
|
|
4112
|
+
weight: z.number().positive(),
|
|
4113
|
+
serve: c
|
|
4114
|
+
})).min(1),
|
|
4115
|
+
seed: z.string().min(1).optional(),
|
|
4116
|
+
attribute: z.string().min(1).optional()
|
|
4117
|
+
});
|
|
4118
|
+
const u = z.union([c, l]);
|
|
4119
|
+
const d = z.object({
|
|
4120
|
+
kind: z.literal(`attribute`),
|
|
4121
|
+
attribute: z.string().min(1),
|
|
4122
|
+
operator: z.enum([`exists`, `not_exists`])
|
|
4123
|
+
});
|
|
4124
|
+
const f = z.object({
|
|
4125
|
+
kind: z.literal(`attribute`),
|
|
4126
|
+
attribute: z.string().min(1),
|
|
4127
|
+
operator: z.enum([
|
|
4128
|
+
`eq`,
|
|
4129
|
+
`neq`,
|
|
4130
|
+
`contains`,
|
|
4131
|
+
`startsWith`,
|
|
4132
|
+
`endsWith`,
|
|
4133
|
+
`gt`,
|
|
4134
|
+
`gte`,
|
|
4135
|
+
`lt`,
|
|
4136
|
+
`lte`
|
|
4137
|
+
]),
|
|
4138
|
+
value: s
|
|
4139
|
+
});
|
|
4140
|
+
const p = z.object({
|
|
4141
|
+
kind: z.literal(`attribute`),
|
|
4142
|
+
attribute: z.string().min(1),
|
|
4143
|
+
operator: z.enum([`in`, `not_in`]),
|
|
4144
|
+
value: z.array(s).min(1)
|
|
4145
|
+
});
|
|
4146
|
+
const m = z.object({
|
|
4147
|
+
kind: z.literal(`percentage`),
|
|
4148
|
+
rollout: z.number().min(0).max(100),
|
|
4149
|
+
seed: z.string().min(1).optional(),
|
|
4150
|
+
attribute: z.string().min(1).optional()
|
|
4151
|
+
});
|
|
4152
|
+
const h = z.object({ kind: z.literal(`always`) });
|
|
4153
|
+
const g = z.object({
|
|
4154
|
+
kind: z.literal(`segment`),
|
|
4155
|
+
segmentId: z.string().min(1),
|
|
4156
|
+
operator: z.enum([`in`, `not_in`]).optional()
|
|
4157
|
+
});
|
|
4158
|
+
const _ = z.lazy(() => z.union([
|
|
4159
|
+
h,
|
|
4160
|
+
m,
|
|
4161
|
+
g,
|
|
4162
|
+
d,
|
|
4163
|
+
f,
|
|
4164
|
+
p,
|
|
3329
4165
|
z.object({
|
|
3330
|
-
kind: z.literal(`
|
|
3331
|
-
|
|
3332
|
-
|
|
4166
|
+
kind: z.literal(`group`),
|
|
4167
|
+
op: z.enum([`and`, `or`]),
|
|
4168
|
+
conditions: z.array(_).min(1)
|
|
3333
4169
|
})
|
|
3334
|
-
]);
|
|
3335
|
-
|
|
4170
|
+
]));
|
|
4171
|
+
function v(e, t = 0) {
|
|
4172
|
+
return e.kind !== `group` || !Array.isArray(e.conditions) ? t : Math.max(t + 1, ...e.conditions.map((e) => v(e, t + 1)));
|
|
4173
|
+
}
|
|
4174
|
+
function y(e, t) {
|
|
4175
|
+
for (let n of e) v(n) > 8 && t.addIssue({
|
|
4176
|
+
code: `custom`,
|
|
4177
|
+
message: `condition groups cannot nest more than 8 levels`
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
const b = z.object({
|
|
3336
4181
|
id: z.string().min(1),
|
|
3337
4182
|
description: z.string().optional(),
|
|
3338
|
-
conditions: z.array(
|
|
3339
|
-
serve:
|
|
3340
|
-
});
|
|
3341
|
-
const
|
|
3342
|
-
|
|
4183
|
+
conditions: z.array(_),
|
|
4184
|
+
serve: u
|
|
4185
|
+
}).superRefine((e, t) => y(e.conditions, t));
|
|
4186
|
+
const x = z.object({
|
|
4187
|
+
id: z.string().min(1),
|
|
4188
|
+
conditions: z.array(_).min(1)
|
|
4189
|
+
}).superRefine((e, t) => y(e.conditions, t));
|
|
4190
|
+
const S = z.object({ projectId: z.string().min(1) });
|
|
4191
|
+
const C = z.object({
|
|
3343
4192
|
projectId: z.string().min(1),
|
|
3344
4193
|
key: z.string().min(1)
|
|
3345
4194
|
});
|
|
3346
|
-
const
|
|
4195
|
+
const w = z.object({
|
|
3347
4196
|
projectId: z.string().min(1),
|
|
3348
4197
|
key: o,
|
|
3349
4198
|
name: z.string().min(1),
|
|
@@ -3358,7 +4207,7 @@ const f = z.object({
|
|
|
3358
4207
|
message: `variant flag requires a non-empty variants array`
|
|
3359
4208
|
});
|
|
3360
4209
|
});
|
|
3361
|
-
const
|
|
4210
|
+
const T = z.object({
|
|
3362
4211
|
flagId: z.string().min(1),
|
|
3363
4212
|
key: o.optional(),
|
|
3364
4213
|
name: z.string().min(1).optional(),
|
|
@@ -3367,25 +4216,26 @@ const p = z.object({
|
|
|
3367
4216
|
variants: z.array(z.string()).nullable().optional(),
|
|
3368
4217
|
tags: z.array(z.string()).optional()
|
|
3369
4218
|
});
|
|
3370
|
-
const
|
|
3371
|
-
const
|
|
4219
|
+
const E = z.object({ flagId: z.string().min(1) });
|
|
4220
|
+
const D = z.object({
|
|
3372
4221
|
flagId: z.string().min(1),
|
|
3373
4222
|
environmentId: z.string().min(1),
|
|
3374
4223
|
enabled: z.boolean().optional(),
|
|
3375
|
-
rules: z.array(
|
|
3376
|
-
fallthrough:
|
|
4224
|
+
rules: z.array(b).optional(),
|
|
4225
|
+
fallthrough: u.optional()
|
|
3377
4226
|
});
|
|
3378
|
-
const
|
|
4227
|
+
const O = z.object({
|
|
3379
4228
|
flagId: z.string().min(1),
|
|
3380
4229
|
environmentId: z.string().min(1),
|
|
3381
4230
|
enabled: z.boolean()
|
|
3382
4231
|
});
|
|
3383
|
-
const
|
|
3384
|
-
|
|
4232
|
+
const k = z.object({ flagId: z.string().min(1) });
|
|
4233
|
+
const A = z.enum([`active`, `deprecated`]);
|
|
4234
|
+
function j(e) {
|
|
3385
4235
|
let t = Object.getPrototypeOf(e);
|
|
3386
4236
|
return t === Object.prototype || t === null;
|
|
3387
4237
|
}
|
|
3388
|
-
function
|
|
4238
|
+
function M(e, t) {
|
|
3389
4239
|
if (e === null) return !0;
|
|
3390
4240
|
switch (typeof e) {
|
|
3391
4241
|
case `boolean`:
|
|
@@ -3393,13 +4243,13 @@ function y(e, t) {
|
|
|
3393
4243
|
case `number`: return Number.isFinite(e);
|
|
3394
4244
|
case `object`: {
|
|
3395
4245
|
let n = t ?? /* @__PURE__ */ new WeakSet();
|
|
3396
|
-
return !n.has(e) && (n.add(e), Array.isArray(e) ? e.every((e) =>
|
|
4246
|
+
return !n.has(e) && (n.add(e), Array.isArray(e) ? e.every((e) => M(e, n)) : !j(e) || Object.getOwnPropertySymbols(e).length > 0 ? !1 : Object.keys(e).every((t) => M(e[t], n)));
|
|
3397
4247
|
}
|
|
3398
4248
|
default: return !1;
|
|
3399
4249
|
}
|
|
3400
4250
|
}
|
|
3401
|
-
const
|
|
3402
|
-
function
|
|
4251
|
+
const N = z.custom(M, { message: `default must be JSON-serializable` });
|
|
4252
|
+
function P(e, t) {
|
|
3403
4253
|
switch (e.type) {
|
|
3404
4254
|
case `boolean`:
|
|
3405
4255
|
typeof e.default != `boolean` && t.addIssue({
|
|
@@ -3428,43 +4278,43 @@ function x(e, t) {
|
|
|
3428
4278
|
});
|
|
3429
4279
|
break;
|
|
3430
4280
|
}
|
|
3431
|
-
case `json`:
|
|
4281
|
+
case `json`: N.safeParse(e.default).success || t.addIssue({
|
|
3432
4282
|
code: `custom`,
|
|
3433
4283
|
path: [`default`],
|
|
3434
4284
|
message: `json flag default must be JSON-serializable`
|
|
3435
4285
|
});
|
|
3436
4286
|
}
|
|
3437
4287
|
}
|
|
3438
|
-
const
|
|
4288
|
+
const F = z.object({
|
|
3439
4289
|
key: o,
|
|
3440
4290
|
type: t,
|
|
3441
4291
|
default: z.unknown(),
|
|
3442
4292
|
description: z.string().optional(),
|
|
3443
4293
|
tags: z.array(z.string()).default([]),
|
|
3444
|
-
lifecycle:
|
|
4294
|
+
lifecycle: A.default(`active`),
|
|
3445
4295
|
variants: z.array(z.string()).optional(),
|
|
3446
4296
|
disabled: z.boolean().optional()
|
|
3447
4297
|
});
|
|
3448
|
-
const
|
|
3449
|
-
const
|
|
4298
|
+
const I = F.superRefine(P);
|
|
4299
|
+
const L = F.extend({
|
|
3450
4300
|
version: z.number().int().positive(),
|
|
3451
4301
|
environmentVersion: z.number().int().positive().optional(),
|
|
3452
4302
|
managedBy: n
|
|
3453
|
-
}).superRefine(
|
|
3454
|
-
const
|
|
4303
|
+
}).superRefine(P);
|
|
4304
|
+
const R = z.object({
|
|
3455
4305
|
version: z.number().int().positive(),
|
|
3456
4306
|
environmentVersion: z.number().int().positive().optional()
|
|
3457
4307
|
});
|
|
3458
|
-
const
|
|
4308
|
+
const z$1 = z.object({
|
|
3459
4309
|
projectId: z.string().min(1),
|
|
3460
4310
|
environmentId: z.string().min(1)
|
|
3461
4311
|
});
|
|
3462
|
-
const
|
|
4312
|
+
const B = z.object({
|
|
3463
4313
|
projectId: z.string(),
|
|
3464
4314
|
environmentId: z.string(),
|
|
3465
|
-
flags: z.array(
|
|
4315
|
+
flags: z.array(L)
|
|
3466
4316
|
});
|
|
3467
|
-
function
|
|
4317
|
+
function V(e, t) {
|
|
3468
4318
|
let n = /* @__PURE__ */ new Set();
|
|
3469
4319
|
for (let [r, i] of e.entries()) n.has(i.key) && t.addIssue({
|
|
3470
4320
|
code: `custom`,
|
|
@@ -3476,12 +4326,12 @@ function O(e, t) {
|
|
|
3476
4326
|
message: `duplicate flag key "${i.key}"`
|
|
3477
4327
|
}), n.add(i.key);
|
|
3478
4328
|
}
|
|
3479
|
-
const
|
|
4329
|
+
const H = z.object({
|
|
3480
4330
|
projectId: z.string().min(1),
|
|
3481
4331
|
environmentId: z.string().min(1),
|
|
3482
|
-
flags: z.array(
|
|
3483
|
-
}).superRefine((e, t) =>
|
|
3484
|
-
const
|
|
4332
|
+
flags: z.array(I)
|
|
4333
|
+
}).superRefine((e, t) => V(e.flags, t));
|
|
4334
|
+
const U = z.object({
|
|
3485
4335
|
key: z.string(),
|
|
3486
4336
|
op: z.enum([
|
|
3487
4337
|
`add`,
|
|
@@ -3489,39 +4339,39 @@ const A = z.object({
|
|
|
3489
4339
|
`remove`,
|
|
3490
4340
|
`unlinked`
|
|
3491
4341
|
]),
|
|
3492
|
-
before:
|
|
3493
|
-
after:
|
|
4342
|
+
before: L.optional(),
|
|
4343
|
+
after: I.optional(),
|
|
3494
4344
|
message: z.string().optional()
|
|
3495
4345
|
});
|
|
3496
|
-
const
|
|
4346
|
+
const W = z.object({
|
|
3497
4347
|
projectId: z.string(),
|
|
3498
4348
|
environmentId: z.string(),
|
|
3499
|
-
changes: z.array(
|
|
3500
|
-
remoteOnly: z.array(
|
|
4349
|
+
changes: z.array(U),
|
|
4350
|
+
remoteOnly: z.array(L).default([])
|
|
3501
4351
|
});
|
|
3502
|
-
const
|
|
4352
|
+
const G = z.object({
|
|
3503
4353
|
projectId: z.string().min(1),
|
|
3504
4354
|
environmentId: z.string().min(1),
|
|
3505
|
-
flags: z.array(
|
|
4355
|
+
flags: z.array(I),
|
|
3506
4356
|
apply: z.boolean().default(!1),
|
|
3507
4357
|
prune: z.boolean().default(!1),
|
|
3508
4358
|
force: z.boolean().default(!1),
|
|
3509
4359
|
adopt: z.boolean().default(!1),
|
|
3510
|
-
expectedVersions: z.record(z.string(),
|
|
3511
|
-
}).superRefine((e, t) =>
|
|
3512
|
-
const
|
|
4360
|
+
expectedVersions: z.record(z.string(), R).optional()
|
|
4361
|
+
}).superRefine((e, t) => V(e.flags, t));
|
|
4362
|
+
const K = z.object({
|
|
3513
4363
|
projectId: z.string(),
|
|
3514
4364
|
environmentId: z.string(),
|
|
3515
4365
|
applied: z.boolean(),
|
|
3516
|
-
changes: z.array(
|
|
3517
|
-
remoteOnly: z.array(
|
|
4366
|
+
changes: z.array(U),
|
|
4367
|
+
remoteOnly: z.array(L).default([]),
|
|
3518
4368
|
forced: z.boolean().default(!1),
|
|
3519
4369
|
adopted: z.boolean().default(!1)
|
|
3520
4370
|
});
|
|
3521
4371
|
|
|
3522
4372
|
//#endregion
|
|
3523
4373
|
//#region src/lib/local-config.ts
|
|
3524
|
-
const localFlagsArraySchema = z.array(
|
|
4374
|
+
const localFlagsArraySchema = z.array(I).superRefine((flags, ctx) => {
|
|
3525
4375
|
const seen = /* @__PURE__ */ new Set();
|
|
3526
4376
|
for (const [index, flag] of flags.entries()) {
|
|
3527
4377
|
if (seen.has(flag.key)) ctx.addIssue({
|
|
@@ -3675,10 +4525,7 @@ const DEFINITION_ONLY_FIELDS = [
|
|
|
3675
4525
|
];
|
|
3676
4526
|
function planHasDefinitionChanges(plan) {
|
|
3677
4527
|
if (plan.creates.length > 0 || plan.archives.length > 0) return true;
|
|
3678
|
-
for (const update of plan.updates)
|
|
3679
|
-
if (update.before.managedBy && update.before.managedBy !== "code") return true;
|
|
3680
|
-
for (const field of DEFINITION_ONLY_FIELDS) if (update.fields[field]) return true;
|
|
3681
|
-
}
|
|
4528
|
+
for (const update of plan.updates) for (const field of DEFINITION_ONLY_FIELDS) if (update.fields[field]) return true;
|
|
3682
4529
|
return false;
|
|
3683
4530
|
}
|
|
3684
4531
|
function buildSyncPlan(changes) {
|
|
@@ -3761,7 +4608,7 @@ function formatSyncPlan(plan) {
|
|
|
3761
4608
|
}
|
|
3762
4609
|
if (planHasDefinitionChanges(plan)) {
|
|
3763
4610
|
lines.push("");
|
|
3764
|
-
lines.push("Note: definition changes (type, variants, tags, lifecycle, description)
|
|
4611
|
+
lines.push("Note: definition changes (type, variants, tags, lifecycle, description) apply to all environments.");
|
|
3765
4612
|
}
|
|
3766
4613
|
return lines.join("\n").trimEnd();
|
|
3767
4614
|
}
|
|
@@ -3966,7 +4813,7 @@ function warnRemoteOnly(keys, json) {
|
|
|
3966
4813
|
for (const key of keys) console.error(` - ${key}`);
|
|
3967
4814
|
}
|
|
3968
4815
|
function registerPushCommand(program) {
|
|
3969
|
-
program.command("push").description("Plan and apply local flag definitions to the server").option("--prune", "Archive remote flags missing from local config", false).option("--force", "Override stale-version conflicts (audited)
|
|
4816
|
+
program.command("push").description("Plan and apply local flag definitions to the server").option("--prune", "Archive remote flags missing from local config", false).option("--force", "Override stale-version conflicts (audited)", false).option("--adopt", "Deprecated no-op. managedBy is last-touch attribution, not a lock.", false).action(async (opts, command) => {
|
|
3970
4817
|
const runtime = getRuntime(command);
|
|
3971
4818
|
const client = await createCliApiClient(runtime);
|
|
3972
4819
|
const { projectId, environmentId } = await resolveIds(client, runtime);
|
|
@@ -3987,11 +4834,7 @@ function registerPushCommand(program) {
|
|
|
3987
4834
|
const remoteOnly = planned.remoteOnly ?? [];
|
|
3988
4835
|
warnRemoteOnly(remoteOnly.map((flag) => flag.key), runtime.json);
|
|
3989
4836
|
if (!runtime.json) console.log(planIsEmpty(plan) ? "Nothing to push." : formatSyncPlan(plan));
|
|
3990
|
-
if (
|
|
3991
|
-
exitCode: 4,
|
|
3992
|
-
details: { keys: plan.unlinked.map((item) => item.key) }
|
|
3993
|
-
});
|
|
3994
|
-
if (!(planHasDrift(plan) || adopt && plan.updates.length > 0)) {
|
|
4837
|
+
if (!planHasDrift(plan)) {
|
|
3995
4838
|
if (runtime.json) console.log(JSON.stringify({
|
|
3996
4839
|
plan,
|
|
3997
4840
|
remoteOnly
|
|
@@ -4017,12 +4860,10 @@ function registerPushCommand(program) {
|
|
|
4017
4860
|
plan: appliedPlan,
|
|
4018
4861
|
remoteOnly,
|
|
4019
4862
|
forced: applied.forced === true,
|
|
4020
|
-
adopted: applied.adopted === true,
|
|
4021
4863
|
types
|
|
4022
4864
|
}, [
|
|
4023
4865
|
`Applied ${applied.changes.length} change(s).`,
|
|
4024
4866
|
applied.forced ? "Forced through version conflicts (audited)." : null,
|
|
4025
|
-
applied.adopted ? "Adopted remote ownership to code." : null,
|
|
4026
4867
|
`Wrote types for ${types.flagCount} flag(s) to ${types.written}`
|
|
4027
4868
|
].filter(Boolean).join("\n"));
|
|
4028
4869
|
});
|