@shipdit/cli 0.5.0 → 0.7.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 +110 -22
- package/dist/index.mjs +582 -256
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,10 @@ import fs from "node:fs";
|
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
7
8
|
import { createJiti } from "jiti";
|
|
8
9
|
import { spawn } from "node:child_process";
|
|
10
|
+
import { isDeepStrictEqual } from "node:util";
|
|
9
11
|
|
|
10
12
|
//#region src/lib/errors.ts
|
|
11
13
|
var CliError = class extends Error {
|
|
@@ -438,10 +440,12 @@ const S$1 = (...t) => hc(...t);
|
|
|
438
440
|
const C$1 = (...t) => hc(...t);
|
|
439
441
|
const w$1 = (...t) => hc(...t);
|
|
440
442
|
const T$1 = (...t) => hc(...t);
|
|
441
|
-
|
|
443
|
+
const E$1 = (...t) => hc(...t);
|
|
444
|
+
const D$1 = (...t) => hc(...t);
|
|
445
|
+
function O$1(e) {
|
|
442
446
|
return `${e.replace(/\/+$/, ``)}/api/v1/rpc`;
|
|
443
447
|
}
|
|
444
|
-
function
|
|
448
|
+
function k$1(e) {
|
|
445
449
|
return {
|
|
446
450
|
...e.fetch ? { fetch: e.fetch } : {},
|
|
447
451
|
init: { credentials: e.client === `dashboard` ? `include` : `same-origin` },
|
|
@@ -451,193 +455,231 @@ function D$1(e) {
|
|
|
451
455
|
}
|
|
452
456
|
};
|
|
453
457
|
}
|
|
454
|
-
async function
|
|
458
|
+
async function A$1(e, t) {
|
|
455
459
|
return a$1(await e({ json: t }));
|
|
456
460
|
}
|
|
457
|
-
async function
|
|
461
|
+
async function j$1(e, t) {
|
|
458
462
|
let n = await e({ json: t });
|
|
459
463
|
return {
|
|
460
464
|
items: await a$1(n),
|
|
461
465
|
nextCursor: n.headers.get(`next-cursor`)
|
|
462
466
|
};
|
|
463
467
|
}
|
|
464
|
-
function
|
|
465
|
-
|
|
468
|
+
async function M$1(e, t, n) {
|
|
469
|
+
return a$1(await e({ json: t }, { headers: { "idempotency-key": n } }));
|
|
470
|
+
}
|
|
471
|
+
function N$1(e) {
|
|
472
|
+
let t = O$1(e.baseUrl), n = k$1(e), r = o$1(t, n), i = s$1(t, n), a = c$1(t, n), N = l$1(t, n), P = u$1(t, n), F = d$2(t, n), I = f$2(t, n), L = p$1(t, n), R = m$1(t, n), z = v$1(t, n), B = _$1(t, n), V = h$1(t, n), H = g$1(t, n), U = y$1(t, n), W = D$1(t, n), G = b$1(t, n), K = x$1(t, n), q = S$1(t, n), J = E$1(t, n), Y = C$1(t, n), X = w$1(t, n), Z = T$1(t, n);
|
|
466
473
|
return {
|
|
474
|
+
release: {
|
|
475
|
+
list: (e) => A$1(a.release.list.$post, e),
|
|
476
|
+
get: (e) => A$1(a.release.get.$post, e),
|
|
477
|
+
create: (e, t) => M$1(a.release.create.$post, e, t),
|
|
478
|
+
update: (e, t) => M$1(a.release.update.$post, e, t),
|
|
479
|
+
bindCommit: (e, t) => M$1(a.release.bindCommit.$post, e, t),
|
|
480
|
+
transition: (e, t) => M$1(a.release.transition.$post, e, t),
|
|
481
|
+
completeStage: (e, t) => M$1(a.release.completeStage.$post, e, t),
|
|
482
|
+
ingestEvidence: (e) => A$1(a.release.ingestEvidence.$post, e),
|
|
483
|
+
addEvidence: (e, t) => M$1(a.release.addEvidence.$post, e, t)
|
|
484
|
+
},
|
|
467
485
|
me: {
|
|
468
|
-
get: (e = {}) =>
|
|
469
|
-
feedback: (e) =>
|
|
486
|
+
get: (e = {}) => A$1(r.me.$post, e),
|
|
487
|
+
feedback: (e) => A$1(r.me.feedback.$post, e)
|
|
470
488
|
},
|
|
471
489
|
project: {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
490
|
+
listTransfers: (e = {}) => A$1(i.project.listTransfers.$post, e),
|
|
491
|
+
requestTransfer: (e) => A$1(i.project.requestTransfer.$post, e),
|
|
492
|
+
decideTransfer: (e) => A$1(i.project.decideTransfer.$post, e),
|
|
493
|
+
list: (e = {}) => A$1(i.project.list.$post, e),
|
|
494
|
+
create: (e) => A$1(i.project.create.$post, e),
|
|
495
|
+
update: (e) => A$1(i.project.update.$post, e),
|
|
496
|
+
archive: (e) => A$1(i.project.archive.$post, e),
|
|
497
|
+
listArchived: (e = {}) => A$1(i.project.listArchived.$post, e),
|
|
498
|
+
restore: (e) => A$1(i.project.restore.$post, e),
|
|
499
|
+
access: (e) => A$1(i.project.access.$post, e),
|
|
500
|
+
listMembers: (e) => A$1(i.project.listMembers.$post, e),
|
|
501
|
+
setMember: (e) => A$1(i.project.setMember.$post, e),
|
|
502
|
+
setTeamRole: (e) => A$1(i.project.setTeamRole.$post, e),
|
|
503
|
+
listTeams: (e) => A$1(i.project.listTeams.$post, e),
|
|
504
|
+
setTeams: (e) => A$1(i.project.setTeams.$post, e)
|
|
480
505
|
},
|
|
481
|
-
team: { listMembers: (e) =>
|
|
506
|
+
team: { listMembers: (e) => A$1(Y.team.listMembers.$post, e) },
|
|
482
507
|
environment: {
|
|
483
|
-
list: (e) =>
|
|
484
|
-
create: (e) =>
|
|
485
|
-
update: (e) =>
|
|
486
|
-
archive: (e) =>
|
|
487
|
-
listArchived: (e) =>
|
|
488
|
-
restore: (e) =>
|
|
508
|
+
list: (e) => A$1(N.environment.list.$post, e),
|
|
509
|
+
create: (e) => A$1(N.environment.create.$post, e),
|
|
510
|
+
update: (e) => A$1(N.environment.update.$post, e),
|
|
511
|
+
archive: (e) => A$1(N.environment.archive.$post, e),
|
|
512
|
+
listArchived: (e) => A$1(N.environment.listArchived.$post, e),
|
|
513
|
+
restore: (e) => A$1(N.environment.restore.$post, e)
|
|
489
514
|
},
|
|
490
515
|
flag: {
|
|
491
|
-
list: (e) =>
|
|
492
|
-
get: (e) =>
|
|
493
|
-
create: (e) =>
|
|
494
|
-
update: (e) =>
|
|
495
|
-
archive: (e) =>
|
|
496
|
-
listArchived: (e) =>
|
|
497
|
-
restore: (e) =>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
516
|
+
list: (e) => A$1(P.flag.list.$post, e),
|
|
517
|
+
get: (e) => A$1(P.flag.get.$post, e),
|
|
518
|
+
create: (e) => A$1(P.flag.create.$post, e),
|
|
519
|
+
update: (e) => A$1(P.flag.update.$post, e),
|
|
520
|
+
archive: (e) => A$1(P.flag.archive.$post, e),
|
|
521
|
+
listArchived: (e) => A$1(P.flag.listArchived.$post, e),
|
|
522
|
+
restore: (e) => A$1(P.flag.restore.$post, e),
|
|
523
|
+
publishEnvironments: (e) => A$1(P.flag.publishEnvironments.$post, e),
|
|
524
|
+
updateEnvironment: (e) => A$1(P.flag.updateEnvironment.$post, e),
|
|
525
|
+
toggleEnvironment: (e) => A$1(P.flag.toggleEnvironment.$post, e),
|
|
526
|
+
listEnvironmentStates: (e) => A$1(P.flag.listEnvironmentStates.$post, e),
|
|
527
|
+
pull: (e) => A$1(P.flag.pull.$post, e),
|
|
528
|
+
diff: (e) => A$1(P.flag.diff.$post, e),
|
|
529
|
+
push: (e) => A$1(P.flag.push.$post, e)
|
|
504
530
|
},
|
|
505
531
|
apiKey: {
|
|
506
|
-
list: (e = {}) =>
|
|
507
|
-
create: (e) =>
|
|
508
|
-
revoke: (e) =>
|
|
532
|
+
list: (e = {}) => A$1(F.apiKey.list.$post, e),
|
|
533
|
+
create: (e) => A$1(F.apiKey.create.$post, e),
|
|
534
|
+
revoke: (e) => A$1(F.apiKey.revoke.$post, e)
|
|
509
535
|
},
|
|
510
536
|
sdkKey: {
|
|
511
|
-
list: (e = {}) =>
|
|
512
|
-
create: (e) =>
|
|
513
|
-
revoke: (e) =>
|
|
537
|
+
list: (e = {}) => A$1(R.sdkKey.list.$post, e),
|
|
538
|
+
create: (e) => A$1(R.sdkKey.create.$post, e),
|
|
539
|
+
revoke: (e) => A$1(R.sdkKey.revoke.$post, e)
|
|
514
540
|
},
|
|
515
541
|
serviceAccount: {
|
|
516
|
-
list: (e = {}) =>
|
|
517
|
-
get: (e) =>
|
|
518
|
-
create: (e) =>
|
|
519
|
-
update: (e) =>
|
|
520
|
-
disable: (e) =>
|
|
521
|
-
enable: (e) =>
|
|
522
|
-
delete: (e) =>
|
|
523
|
-
createToken: (e) =>
|
|
524
|
-
listTokens: (e) =>
|
|
525
|
-
revokeToken: (e) =>
|
|
526
|
-
rotateToken: (e) =>
|
|
542
|
+
list: (e = {}) => A$1(z.serviceAccount.list.$post, e),
|
|
543
|
+
get: (e) => A$1(z.serviceAccount.get.$post, e),
|
|
544
|
+
create: (e) => A$1(z.serviceAccount.create.$post, e),
|
|
545
|
+
update: (e) => A$1(z.serviceAccount.update.$post, e),
|
|
546
|
+
disable: (e) => A$1(z.serviceAccount.disable.$post, e),
|
|
547
|
+
enable: (e) => A$1(z.serviceAccount.enable.$post, e),
|
|
548
|
+
delete: (e) => A$1(z.serviceAccount.delete.$post, e),
|
|
549
|
+
createToken: (e) => A$1(z.serviceAccount.createToken.$post, e),
|
|
550
|
+
listTokens: (e) => A$1(z.serviceAccount.listTokens.$post, e),
|
|
551
|
+
revokeToken: (e) => A$1(z.serviceAccount.revokeToken.$post, e),
|
|
552
|
+
rotateToken: (e) => A$1(z.serviceAccount.rotateToken.$post, e)
|
|
527
553
|
},
|
|
528
554
|
segment: {
|
|
529
|
-
list: (e) =>
|
|
530
|
-
get: (e) =>
|
|
531
|
-
create: (e) =>
|
|
532
|
-
update: (e) =>
|
|
533
|
-
archive: (e) =>
|
|
534
|
-
listArchived: (e) =>
|
|
535
|
-
restore: (e) =>
|
|
536
|
-
listEnvironmentStates: (e) =>
|
|
537
|
-
updateEnvironment: (e) =>
|
|
555
|
+
list: (e) => A$1(B.segment.list.$post, e),
|
|
556
|
+
get: (e) => A$1(B.segment.get.$post, e),
|
|
557
|
+
create: (e) => A$1(B.segment.create.$post, e),
|
|
558
|
+
update: (e) => A$1(B.segment.update.$post, e),
|
|
559
|
+
archive: (e) => A$1(B.segment.archive.$post, e),
|
|
560
|
+
listArchived: (e) => A$1(B.segment.listArchived.$post, e),
|
|
561
|
+
restore: (e) => A$1(B.segment.restore.$post, e),
|
|
562
|
+
listEnvironmentStates: (e) => A$1(B.segment.listEnvironmentStates.$post, e),
|
|
563
|
+
updateEnvironment: (e) => A$1(B.segment.updateEnvironment.$post, e)
|
|
538
564
|
},
|
|
539
565
|
evaluatedEntity: {
|
|
540
|
-
list: (e) =>
|
|
541
|
-
listPage: (e) =>
|
|
542
|
-
get: (e) =>
|
|
543
|
-
delete: (e) =>
|
|
566
|
+
list: (e) => A$1(V.evaluatedEntity.list.$post, e),
|
|
567
|
+
listPage: (e) => j$1(V.evaluatedEntity.list.$post, e),
|
|
568
|
+
get: (e) => A$1(V.evaluatedEntity.get.$post, e),
|
|
569
|
+
delete: (e) => A$1(V.evaluatedEntity.delete.$post, e)
|
|
544
570
|
},
|
|
545
571
|
evaluationFact: {
|
|
546
|
-
list: (e) =>
|
|
547
|
-
byRule: (e) =>
|
|
548
|
-
orgSummary: (e = {}) =>
|
|
549
|
-
projectSummary: (e) =>
|
|
550
|
-
simulate: (e) =>
|
|
572
|
+
list: (e) => A$1(H.evaluationFact.list.$post, e),
|
|
573
|
+
byRule: (e) => A$1(H.evaluationFact.byRule.$post, e),
|
|
574
|
+
orgSummary: (e = {}) => A$1(H.evaluationFact.orgSummary.$post, e),
|
|
575
|
+
projectSummary: (e) => A$1(H.evaluationFact.projectSummary.$post, e),
|
|
576
|
+
simulate: (e) => A$1(H.evaluationFact.simulate.$post, e)
|
|
551
577
|
},
|
|
552
578
|
snapshot: {
|
|
553
|
-
publish: (e) =>
|
|
554
|
-
listOutbox: (e = {}) =>
|
|
555
|
-
listOutboxPage: (e = {}) =>
|
|
556
|
-
requeue: (e) =>
|
|
557
|
-
rebuild: (e) =>
|
|
558
|
-
listPublications: (e) =>
|
|
559
|
-
listPublicationsPage: (e) =>
|
|
579
|
+
publish: (e) => A$1(U.snapshot.publish.$post, e),
|
|
580
|
+
listOutbox: (e = {}) => A$1(U.snapshot.outbox.list.$post, e),
|
|
581
|
+
listOutboxPage: (e = {}) => j$1(U.snapshot.outbox.list.$post, e),
|
|
582
|
+
requeue: (e) => A$1(U.snapshot.outbox.requeue.$post, e),
|
|
583
|
+
rebuild: (e) => A$1(U.snapshot.rebuild.$post, e),
|
|
584
|
+
listPublications: (e) => A$1(U.snapshot.publications.list.$post, e),
|
|
585
|
+
listPublicationsPage: (e) => j$1(U.snapshot.publications.list.$post, e)
|
|
586
|
+
},
|
|
587
|
+
event: { publish: (e, t) => M$1(W.event.publish.$post, e, t) },
|
|
588
|
+
eventWebhook: {
|
|
589
|
+
eventTypes: (e) => A$1(W.eventWebhook.eventTypes.$post, e),
|
|
590
|
+
list: (e) => A$1(W.eventWebhook.list.$post, e),
|
|
591
|
+
create: (e) => A$1(W.eventWebhook.create.$post, e),
|
|
592
|
+
update: (e) => A$1(W.eventWebhook.update.$post, e),
|
|
593
|
+
delete: (e) => A$1(W.eventWebhook.delete.$post, e),
|
|
594
|
+
test: (e, t) => M$1(W.eventWebhook.test.$post, e, t),
|
|
595
|
+
deliveries: (e) => A$1(W.eventWebhook.deliveries.$post, e),
|
|
596
|
+
attempts: (e) => A$1(W.eventWebhook.attempts.$post, e),
|
|
597
|
+
redeliver: (e, t) => M$1(W.eventWebhook.redeliver.$post, e, t),
|
|
598
|
+
usage: (e) => A$1(W.eventWebhook.usage.$post, e)
|
|
560
599
|
},
|
|
561
600
|
snapshotWebhook: {
|
|
562
|
-
list: (e) =>
|
|
563
|
-
create: (e) =>
|
|
564
|
-
update: (e) =>
|
|
565
|
-
delete: (e) =>
|
|
566
|
-
test: (e) =>
|
|
601
|
+
list: (e) => A$1(G.snapshotWebhook.list.$post, e),
|
|
602
|
+
create: (e) => A$1(G.snapshotWebhook.create.$post, e),
|
|
603
|
+
update: (e) => A$1(G.snapshotWebhook.update.$post, e),
|
|
604
|
+
delete: (e) => A$1(G.snapshotWebhook.delete.$post, e),
|
|
605
|
+
test: (e) => A$1(G.snapshotWebhook.test.$post, e)
|
|
567
606
|
},
|
|
568
|
-
device: { authorize: (e) =>
|
|
607
|
+
device: { authorize: (e) => A$1(K.device.authorize.$post, e) },
|
|
569
608
|
billing: {
|
|
570
|
-
get: (e = {}) =>
|
|
571
|
-
|
|
572
|
-
|
|
609
|
+
get: (e = {}) => A$1(q.billing.get.$post, e),
|
|
610
|
+
updateUsage: (e) => A$1(q.billing.updateUsage.$post, e),
|
|
611
|
+
attach: (e) => A$1(q.billing.attach.$post, e),
|
|
612
|
+
openPortal: (e) => A$1(q.billing.openPortal.$post, e)
|
|
573
613
|
},
|
|
574
|
-
usage: { get: (e = {}) =>
|
|
614
|
+
usage: { get: (e = {}) => A$1(J.usage.get.$post, e) },
|
|
575
615
|
approval: {
|
|
576
|
-
listPolicies: (e = {}) =>
|
|
577
|
-
createPolicy: (e) =>
|
|
578
|
-
updatePolicy: (e) =>
|
|
579
|
-
deletePolicy: (e) =>
|
|
580
|
-
listRequests: (e = {}) =>
|
|
581
|
-
listRequestsPage: (e = {}) =>
|
|
582
|
-
get: (e) =>
|
|
583
|
-
approve: (e) =>
|
|
584
|
-
reject: (e) =>
|
|
585
|
-
cancel: (e) =>
|
|
616
|
+
listPolicies: (e = {}) => A$1(I.approval.listPolicies.$post, e),
|
|
617
|
+
createPolicy: (e) => A$1(I.approval.createPolicy.$post, e),
|
|
618
|
+
updatePolicy: (e) => A$1(I.approval.updatePolicy.$post, e),
|
|
619
|
+
deletePolicy: (e) => A$1(I.approval.deletePolicy.$post, e),
|
|
620
|
+
listRequests: (e = {}) => A$1(I.approval.listRequests.$post, e),
|
|
621
|
+
listRequestsPage: (e = {}) => j$1(I.approval.listRequests.$post, e),
|
|
622
|
+
get: (e) => A$1(I.approval.get.$post, e),
|
|
623
|
+
approve: (e) => A$1(I.approval.approve.$post, e),
|
|
624
|
+
reject: (e) => A$1(I.approval.reject.$post, e),
|
|
625
|
+
cancel: (e) => A$1(I.approval.cancel.$post, e)
|
|
586
626
|
},
|
|
587
627
|
audit: {
|
|
588
|
-
list: (e = {}) =>
|
|
589
|
-
get: (e) =>
|
|
590
|
-
actions: (e = {}) =>
|
|
591
|
-
export: (e) =>
|
|
592
|
-
getSettings: (e = {}) =>
|
|
593
|
-
updateSettings: (e) =>
|
|
594
|
-
listDestinations: (e = {}) =>
|
|
595
|
-
createDestination: (e) =>
|
|
596
|
-
updateDestination: (e) =>
|
|
597
|
-
deleteDestination: (e) =>
|
|
598
|
-
testDestination: (e) =>
|
|
628
|
+
list: (e = {}) => A$1(L.audit.list.$post, e),
|
|
629
|
+
get: (e) => A$1(L.audit.get.$post, e),
|
|
630
|
+
actions: (e = {}) => A$1(L.audit.actions.$post, e),
|
|
631
|
+
export: (e) => A$1(L.audit.export.$post, e),
|
|
632
|
+
getSettings: (e = {}) => A$1(L.audit.getSettings.$post, e),
|
|
633
|
+
updateSettings: (e) => A$1(L.audit.updateSettings.$post, e),
|
|
634
|
+
listDestinations: (e = {}) => A$1(L.audit.listDestinations.$post, e),
|
|
635
|
+
createDestination: (e) => A$1(L.audit.createDestination.$post, e),
|
|
636
|
+
updateDestination: (e) => A$1(L.audit.updateDestination.$post, e),
|
|
637
|
+
deleteDestination: (e) => A$1(L.audit.deleteDestination.$post, e),
|
|
638
|
+
testDestination: (e) => A$1(L.audit.testDestination.$post, e)
|
|
599
639
|
},
|
|
600
640
|
sso: {
|
|
601
|
-
getSettings: (e = {}) =>
|
|
602
|
-
listProviders: (e = {}) =>
|
|
603
|
-
updateAllowedDomains: (e) =>
|
|
604
|
-
setEnforcement: (e) =>
|
|
605
|
-
setRequireTwoFactor: (e) =>
|
|
641
|
+
getSettings: (e = {}) => A$1(X.sso.getSettings.$post, e),
|
|
642
|
+
listProviders: (e = {}) => A$1(X.sso.listProviders.$post, e),
|
|
643
|
+
updateAllowedDomains: (e) => A$1(X.sso.updateAllowedDomains.$post, e),
|
|
644
|
+
setEnforcement: (e) => A$1(X.sso.setEnforcement.$post, e),
|
|
645
|
+
setRequireTwoFactor: (e) => A$1(X.sso.setRequireTwoFactor.$post, e)
|
|
606
646
|
},
|
|
607
647
|
scim: {
|
|
608
|
-
getConnection: (e = {}) =>
|
|
609
|
-
createConnection: (e = { creationRequestId: crypto.randomUUID() }) =>
|
|
610
|
-
rotateCredential: (e) =>
|
|
611
|
-
revokeCredential: (e) =>
|
|
612
|
-
decommissionConnection: (e) =>
|
|
648
|
+
getConnection: (e = {}) => A$1(Z.scim.getConnection.$post, e),
|
|
649
|
+
createConnection: (e = { creationRequestId: crypto.randomUUID() }) => A$1(Z.scim.createConnection.$post, e),
|
|
650
|
+
rotateCredential: (e) => A$1(Z.scim.rotateCredential.$post, e),
|
|
651
|
+
revokeCredential: (e) => A$1(Z.scim.revokeCredential.$post, e),
|
|
652
|
+
decommissionConnection: (e) => A$1(Z.scim.decommissionConnection.$post, e)
|
|
613
653
|
},
|
|
614
654
|
raw: {
|
|
615
655
|
me: r,
|
|
616
656
|
project: i,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
657
|
+
release: a,
|
|
658
|
+
environment: N,
|
|
659
|
+
flag: P,
|
|
660
|
+
apiKey: F,
|
|
661
|
+
approval: I,
|
|
662
|
+
audit: L,
|
|
663
|
+
sdkKey: R,
|
|
664
|
+
serviceAccount: z,
|
|
665
|
+
segment: B,
|
|
666
|
+
evaluatedEntity: V,
|
|
667
|
+
evaluationFact: H,
|
|
668
|
+
snapshot: U,
|
|
669
|
+
snapshotWebhook: G,
|
|
670
|
+
eventWebhook: W,
|
|
671
|
+
device: K,
|
|
672
|
+
billing: q,
|
|
673
|
+
usage: J,
|
|
674
|
+
team: Y,
|
|
675
|
+
sso: X,
|
|
676
|
+
scim: Z
|
|
635
677
|
}
|
|
636
678
|
};
|
|
637
679
|
}
|
|
638
680
|
|
|
639
681
|
//#endregion
|
|
640
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@
|
|
682
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/error-codes.mjs
|
|
641
683
|
function defineErrorCodes(codes) {
|
|
642
684
|
return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
|
|
643
685
|
code: key,
|
|
@@ -647,7 +689,7 @@ function defineErrorCodes(codes) {
|
|
|
647
689
|
}
|
|
648
690
|
|
|
649
691
|
//#endregion
|
|
650
|
-
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.6.
|
|
692
|
+
//#region ../../node_modules/.pnpm/better-call@1.4.0_zod@4.6.7/node_modules/better-call/dist/error.mjs
|
|
651
693
|
function isErrorStackTraceLimitWritable() {
|
|
652
694
|
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
653
695
|
if (desc === void 0) return Object.isExtensible(Error);
|
|
@@ -764,7 +806,7 @@ var InternalAPIError = class extends Error {
|
|
|
764
806
|
const APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
|
|
765
807
|
|
|
766
808
|
//#endregion
|
|
767
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@
|
|
809
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/error/index.mjs
|
|
768
810
|
var BetterAuthError = class extends Error {
|
|
769
811
|
constructor(message, options) {
|
|
770
812
|
super(message, options);
|
|
@@ -775,7 +817,7 @@ var BetterAuthError = class extends Error {
|
|
|
775
817
|
};
|
|
776
818
|
|
|
777
819
|
//#endregion
|
|
778
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
820
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/access/access.mjs
|
|
779
821
|
function unknownResourceResponse(requestedResource) {
|
|
780
822
|
return {
|
|
781
823
|
success: false,
|
|
@@ -852,7 +894,7 @@ function createAccessControl(s) {
|
|
|
852
894
|
}
|
|
853
895
|
|
|
854
896
|
//#endregion
|
|
855
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
897
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
|
|
856
898
|
const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
857
899
|
OTP_NOT_ENABLED: "OTP not enabled",
|
|
858
900
|
OTP_NOT_CONFIGURED: "OTP is not available",
|
|
@@ -870,15 +912,15 @@ const TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
|
870
912
|
});
|
|
871
913
|
|
|
872
914
|
//#endregion
|
|
873
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
915
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/package.mjs
|
|
874
916
|
var version = "1.7.7";
|
|
875
917
|
|
|
876
918
|
//#endregion
|
|
877
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
919
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/version.mjs
|
|
878
920
|
const PACKAGE_VERSION$3 = version;
|
|
879
921
|
|
|
880
922
|
//#endregion
|
|
881
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@
|
|
923
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/url.mjs
|
|
882
924
|
/**
|
|
883
925
|
* Schemes that execute or embed code when navigated to or accepted as a
|
|
884
926
|
* redirect target. These are never safe as an OAuth `redirect_uri` or as a
|
|
@@ -910,7 +952,7 @@ function isSafeUrlScheme(value) {
|
|
|
910
952
|
}
|
|
911
953
|
|
|
912
954
|
//#endregion
|
|
913
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
955
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/two-factor/client.mjs
|
|
914
956
|
const twoFactorClient = (options) => {
|
|
915
957
|
return {
|
|
916
958
|
id: "two-factor",
|
|
@@ -948,7 +990,7 @@ const twoFactorClient = (options) => {
|
|
|
948
990
|
};
|
|
949
991
|
|
|
950
992
|
//#endregion
|
|
951
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
993
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/access/statement.mjs
|
|
952
994
|
const defaultStatements$1 = {
|
|
953
995
|
user: [
|
|
954
996
|
"create",
|
|
@@ -999,7 +1041,7 @@ const defaultRoles$1 = {
|
|
|
999
1041
|
};
|
|
1000
1042
|
|
|
1001
1043
|
//#endregion
|
|
1002
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1044
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/error-codes.mjs
|
|
1003
1045
|
const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
1004
1046
|
FAILED_TO_CREATE_USER: "Failed to create user",
|
|
1005
1047
|
USER_ALREADY_EXISTS: "User already exists.",
|
|
@@ -1027,7 +1069,7 @@ const ADMIN_ERROR_CODES = defineErrorCodes({
|
|
|
1027
1069
|
});
|
|
1028
1070
|
|
|
1029
1071
|
//#endregion
|
|
1030
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@
|
|
1072
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/env/env-impl.mjs
|
|
1031
1073
|
const _envShim = Object.create(null);
|
|
1032
1074
|
const _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
|
|
1033
1075
|
const env = new Proxy(_envShim, {
|
|
@@ -1091,7 +1133,7 @@ const ENV = Object.freeze({
|
|
|
1091
1133
|
});
|
|
1092
1134
|
|
|
1093
1135
|
//#endregion
|
|
1094
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1136
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/utils/url.mjs
|
|
1095
1137
|
const SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
1096
1138
|
function trimTrailingSlashes(value) {
|
|
1097
1139
|
let end = value.length;
|
|
@@ -1170,7 +1212,7 @@ function getOrigin(url) {
|
|
|
1170
1212
|
}
|
|
1171
1213
|
|
|
1172
1214
|
//#endregion
|
|
1173
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1215
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/has-permission.mjs
|
|
1174
1216
|
const hasPermission = (input) => {
|
|
1175
1217
|
if (input.userId && input.options?.adminUserIds?.includes(input.userId)) return true;
|
|
1176
1218
|
if (!input.permissions) return false;
|
|
@@ -1772,7 +1814,7 @@ const createFetch = (config) => {
|
|
|
1772
1814
|
};
|
|
1773
1815
|
|
|
1774
1816
|
//#endregion
|
|
1775
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1817
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/parser.mjs
|
|
1776
1818
|
const PROTO_POLLUTION_PATTERNS = {
|
|
1777
1819
|
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*:/,
|
|
1778
1820
|
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*:/,
|
|
@@ -1842,7 +1884,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
1842
1884
|
}
|
|
1843
1885
|
|
|
1844
1886
|
//#endregion
|
|
1845
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1887
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/access/statement.mjs
|
|
1846
1888
|
const defaultStatements = {
|
|
1847
1889
|
organization: ["update", "delete"],
|
|
1848
1890
|
member: [
|
|
@@ -1918,7 +1960,7 @@ const defaultRoles = {
|
|
|
1918
1960
|
};
|
|
1919
1961
|
|
|
1920
1962
|
//#endregion
|
|
1921
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1963
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/permission.mjs
|
|
1922
1964
|
const hasPermissionFn = (input, acRoles) => {
|
|
1923
1965
|
if (!input.permissions) return false;
|
|
1924
1966
|
const roles = input.role.split(",");
|
|
@@ -1931,7 +1973,7 @@ const hasPermissionFn = (input, acRoles) => {
|
|
|
1931
1973
|
};
|
|
1932
1974
|
|
|
1933
1975
|
//#endregion
|
|
1934
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
1976
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/error-codes.mjs
|
|
1935
1977
|
const ORGANIZATION_ERROR_CODES = defineErrorCodes({
|
|
1936
1978
|
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: "You are not allowed to create a new organization",
|
|
1937
1979
|
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: "You have reached the maximum number of organizations",
|
|
@@ -2056,6 +2098,8 @@ const t$1 = createAccessControl({
|
|
|
2056
2098
|
evaluated_entity: [`read`, `delete`],
|
|
2057
2099
|
snapshot: [`read`],
|
|
2058
2100
|
snapshot_webhook: [`read`, `manage`],
|
|
2101
|
+
event_webhook: [`read`, `manage`],
|
|
2102
|
+
customer_event: [`publish`],
|
|
2059
2103
|
billing: [`read`, `manage`],
|
|
2060
2104
|
sso: [
|
|
2061
2105
|
`read`,
|
|
@@ -2084,6 +2128,7 @@ const n$1 = {
|
|
|
2084
2128
|
flag: [`read`],
|
|
2085
2129
|
evaluated_entity: [`read`],
|
|
2086
2130
|
snapshot_webhook: [`read`],
|
|
2131
|
+
event_webhook: [`read`],
|
|
2087
2132
|
billing: [`read`],
|
|
2088
2133
|
approval_policy: [`read`],
|
|
2089
2134
|
approval_request: [`read`]
|
|
@@ -2108,6 +2153,7 @@ const n$1 = {
|
|
|
2108
2153
|
],
|
|
2109
2154
|
evaluated_entity: [`read`],
|
|
2110
2155
|
snapshot_webhook: [`read`],
|
|
2156
|
+
event_webhook: [`read`],
|
|
2111
2157
|
billing: [`read`],
|
|
2112
2158
|
approval_policy: [`read`],
|
|
2113
2159
|
approval_request: [`read`]
|
|
@@ -2172,6 +2218,8 @@ const n$1 = {
|
|
|
2172
2218
|
evaluated_entity: [`read`, `delete`],
|
|
2173
2219
|
snapshot: [`read`],
|
|
2174
2220
|
snapshot_webhook: [`read`, `manage`],
|
|
2221
|
+
event_webhook: [`read`, `manage`],
|
|
2222
|
+
customer_event: [`publish`],
|
|
2175
2223
|
billing: [`read`, `manage`],
|
|
2176
2224
|
sso: [`read`, `manage`],
|
|
2177
2225
|
service_account: [
|
|
@@ -2247,6 +2295,8 @@ const n$1 = {
|
|
|
2247
2295
|
evaluated_entity: [`read`, `delete`],
|
|
2248
2296
|
snapshot: [`read`],
|
|
2249
2297
|
snapshot_webhook: [`read`, `manage`],
|
|
2298
|
+
event_webhook: [`read`, `manage`],
|
|
2299
|
+
customer_event: [`publish`],
|
|
2250
2300
|
billing: [`read`, `manage`],
|
|
2251
2301
|
sso: [
|
|
2252
2302
|
`read`,
|
|
@@ -2269,7 +2319,7 @@ const n$1 = {
|
|
|
2269
2319
|
};
|
|
2270
2320
|
|
|
2271
2321
|
//#endregion
|
|
2272
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2322
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
2273
2323
|
const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
2274
2324
|
const now$1 = () => Math.floor(Date.now() / 1e3);
|
|
2275
2325
|
var WindowBroadcastChannel = class {
|
|
@@ -2493,7 +2543,7 @@ let onMount = ($store, initialize) => {
|
|
|
2493
2543
|
};
|
|
2494
2544
|
|
|
2495
2545
|
//#endregion
|
|
2496
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2546
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/equality.mjs
|
|
2497
2547
|
function isPlainObject(value) {
|
|
2498
2548
|
if (typeof value !== "object" || value === null) return false;
|
|
2499
2549
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -2534,7 +2584,7 @@ function withEquality(store, isEqual) {
|
|
|
2534
2584
|
}
|
|
2535
2585
|
|
|
2536
2586
|
//#endregion
|
|
2537
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2587
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
2538
2588
|
const kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
2539
2589
|
var WindowFocusManager = class {
|
|
2540
2590
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2564,7 +2614,7 @@ function getGlobalFocusManager() {
|
|
|
2564
2614
|
}
|
|
2565
2615
|
|
|
2566
2616
|
//#endregion
|
|
2567
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2617
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/online-manager.mjs
|
|
2568
2618
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
2569
2619
|
var WindowOnlineManager = class {
|
|
2570
2620
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2597,7 +2647,7 @@ function getGlobalOnlineManager() {
|
|
|
2597
2647
|
}
|
|
2598
2648
|
|
|
2599
2649
|
//#endregion
|
|
2600
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2650
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/query-atom.mjs
|
|
2601
2651
|
const kAuthQuery = Symbol.for("better-auth:auth-query");
|
|
2602
2652
|
function createAuthQueryAtom(initialValue) {
|
|
2603
2653
|
const queryAtom = /* @__PURE__ */ atom(initialValue);
|
|
@@ -2606,7 +2656,7 @@ function createAuthQueryAtom(initialValue) {
|
|
|
2606
2656
|
}
|
|
2607
2657
|
|
|
2608
2658
|
//#endregion
|
|
2609
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2659
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/query.mjs
|
|
2610
2660
|
const isServer$1 = () => typeof window === "undefined";
|
|
2611
2661
|
function isAuthQueryStateEqual(a, b) {
|
|
2612
2662
|
return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
|
|
@@ -2737,7 +2787,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2737
2787
|
};
|
|
2738
2788
|
|
|
2739
2789
|
//#endregion
|
|
2740
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2790
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
2741
2791
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
2742
2792
|
/**
|
|
2743
2793
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -2865,7 +2915,7 @@ function createSessionRefreshManager(opts) {
|
|
|
2865
2915
|
}
|
|
2866
2916
|
|
|
2867
2917
|
//#endregion
|
|
2868
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2918
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
2869
2919
|
const redirectPlugin = {
|
|
2870
2920
|
id: "redirect",
|
|
2871
2921
|
name: "Redirect",
|
|
@@ -2881,7 +2931,7 @@ const redirectPlugin = {
|
|
|
2881
2931
|
};
|
|
2882
2932
|
|
|
2883
2933
|
//#endregion
|
|
2884
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
2934
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/session-atom.mjs
|
|
2885
2935
|
const isServer = () => typeof window === "undefined";
|
|
2886
2936
|
const SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
|
|
2887
2937
|
function hydrateSessionAtom(sessionAtom, session) {
|
|
@@ -3056,7 +3106,7 @@ function getSessionAtom($fetch, options) {
|
|
|
3056
3106
|
}
|
|
3057
3107
|
|
|
3058
3108
|
//#endregion
|
|
3059
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3109
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/config.mjs
|
|
3060
3110
|
const resolvePublicAuthUrl = (basePath) => {
|
|
3061
3111
|
if (typeof process === "undefined") return void 0;
|
|
3062
3112
|
const path = basePath ?? "/api/auth";
|
|
@@ -3162,13 +3212,13 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
3162
3212
|
};
|
|
3163
3213
|
|
|
3164
3214
|
//#endregion
|
|
3165
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3215
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
3166
3216
|
function isAtom(value) {
|
|
3167
3217
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
3168
3218
|
}
|
|
3169
3219
|
|
|
3170
3220
|
//#endregion
|
|
3171
|
-
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@
|
|
3221
|
+
//#region ../../node_modules/.pnpm/@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fetch+fetch@1.3.2_@opentelemet_0d5083f53bdf976e0320d8b98ec7aa98/node_modules/@better-auth/core/dist/utils/string.mjs
|
|
3172
3222
|
function capitalizeFirstLetter(str) {
|
|
3173
3223
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
3174
3224
|
}
|
|
@@ -3182,7 +3232,7 @@ function toKebabCase(input) {
|
|
|
3182
3232
|
}
|
|
3183
3233
|
|
|
3184
3234
|
//#endregion
|
|
3185
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3235
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/proxy.mjs
|
|
3186
3236
|
function getMethod(path, knownPathMethods, args) {
|
|
3187
3237
|
const method = knownPathMethods[path];
|
|
3188
3238
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -3258,7 +3308,7 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
3258
3308
|
}
|
|
3259
3309
|
|
|
3260
3310
|
//#endregion
|
|
3261
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3311
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/client/vanilla.mjs
|
|
3262
3312
|
function createAuthClient(options) {
|
|
3263
3313
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
3264
3314
|
const resolvedHooks = {};
|
|
@@ -3273,7 +3323,7 @@ function createAuthClient(options) {
|
|
|
3273
3323
|
}
|
|
3274
3324
|
|
|
3275
3325
|
//#endregion
|
|
3276
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3326
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/additional-fields/client.mjs
|
|
3277
3327
|
const inferAdditionalFields = (schema) => {
|
|
3278
3328
|
return {
|
|
3279
3329
|
id: "additional-fields-client",
|
|
@@ -3283,7 +3333,7 @@ const inferAdditionalFields = (schema) => {
|
|
|
3283
3333
|
};
|
|
3284
3334
|
|
|
3285
3335
|
//#endregion
|
|
3286
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3336
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/admin/client.mjs
|
|
3287
3337
|
const adminClient = (options) => {
|
|
3288
3338
|
const roles = {
|
|
3289
3339
|
admin: adminAc$1,
|
|
@@ -3318,7 +3368,7 @@ const adminClient = (options) => {
|
|
|
3318
3368
|
};
|
|
3319
3369
|
|
|
3320
3370
|
//#endregion
|
|
3321
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3371
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
|
|
3322
3372
|
const deviceAuthorizationClient = () => {
|
|
3323
3373
|
return {
|
|
3324
3374
|
id: "device-authorization",
|
|
@@ -3335,7 +3385,7 @@ const deviceAuthorizationClient = () => {
|
|
|
3335
3385
|
};
|
|
3336
3386
|
|
|
3337
3387
|
//#endregion
|
|
3338
|
-
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.
|
|
3388
|
+
//#region ../../node_modules/.pnpm/better-auth@1.7.7_@opentelemetry+api@1.9.1_drizzle-kit@1.0.0-rc.5_drizzle-orm@1.0.0-rc._8ef4619ff178d531df1451d091680cc1/node_modules/better-auth/dist/plugins/organization/client.mjs
|
|
3339
3389
|
/**
|
|
3340
3390
|
* Using the same `hasPermissionFn` function, but without the need for a `ctx` parameter or the `organizationId` parameter.
|
|
3341
3391
|
*/
|
|
@@ -3430,7 +3480,7 @@ const organizationClient = (options) => {
|
|
|
3430
3480
|
};
|
|
3431
3481
|
|
|
3432
3482
|
//#endregion
|
|
3433
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-
|
|
3483
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fet_72057e843799b0c86a3fe30aeb49ac2b/node_modules/@better-auth/api-key/dist/version-CUtTQbZf.mjs
|
|
3434
3484
|
const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
3435
3485
|
INVALID_METADATA_TYPE: "metadata must be an object or undefined",
|
|
3436
3486
|
REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided",
|
|
@@ -3467,7 +3517,7 @@ const API_KEY_ERROR_CODES = defineErrorCodes({
|
|
|
3467
3517
|
const PACKAGE_VERSION$2 = "1.7.7";
|
|
3468
3518
|
|
|
3469
3519
|
//#endregion
|
|
3470
|
-
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-
|
|
3520
|
+
//#region ../../node_modules/.pnpm/@better-auth+api-key@1.7.7_@better-auth+core@1.7.7_@better-auth+utils@0.4.2_@better-fet_72057e843799b0c86a3fe30aeb49ac2b/node_modules/@better-auth/api-key/dist/client.mjs
|
|
3471
3521
|
const apiKeyClient = () => {
|
|
3472
3522
|
return {
|
|
3473
3523
|
id: "api-key",
|
|
@@ -3483,7 +3533,7 @@ const apiKeyClient = () => {
|
|
|
3483
3533
|
};
|
|
3484
3534
|
|
|
3485
3535
|
//#endregion
|
|
3486
|
-
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.
|
|
3536
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_bb9d362000213fa473d66cafce218d0a/node_modules/@better-auth/passkey/dist/version-Bx477_EO.mjs
|
|
3487
3537
|
const PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
3488
3538
|
CHALLENGE_NOT_FOUND: "Challenge not found",
|
|
3489
3539
|
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
|
|
@@ -3973,7 +4023,7 @@ async function startAuthentication(options) {
|
|
|
3973
4023
|
}
|
|
3974
4024
|
|
|
3975
4025
|
//#endregion
|
|
3976
|
-
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.
|
|
4026
|
+
//#region ../../node_modules/.pnpm/@better-auth+passkey@1.7.7_bb9d362000213fa473d66cafce218d0a/node_modules/@better-auth/passkey/dist/client.mjs
|
|
3977
4027
|
const getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
|
|
3978
4028
|
const signInPasskey = async (opts, options) => {
|
|
3979
4029
|
const response = await $fetch("/passkey/generate-authenticate-options", {
|
|
@@ -4175,11 +4225,11 @@ const passkeyClient = () => {
|
|
|
4175
4225
|
};
|
|
4176
4226
|
|
|
4177
4227
|
//#endregion
|
|
4178
|
-
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.
|
|
4228
|
+
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_b7f969b8f4178e26300409b5e56227c3/node_modules/@better-auth/sso/dist/version-DFla2W8i.mjs
|
|
4179
4229
|
const PACKAGE_VERSION = "1.7.7";
|
|
4180
4230
|
|
|
4181
4231
|
//#endregion
|
|
4182
|
-
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.
|
|
4232
|
+
//#region ../../node_modules/.pnpm/@better-auth+sso@1.7.7_b7f969b8f4178e26300409b5e56227c3/node_modules/@better-auth/sso/dist/client.mjs
|
|
4183
4233
|
const ssoClient = (options) => {
|
|
4184
4234
|
return {
|
|
4185
4235
|
id: "sso-client",
|
|
@@ -4297,7 +4347,7 @@ async function createCliApiClient(runtime) {
|
|
|
4297
4347
|
sessionToken,
|
|
4298
4348
|
orgSlug: runtime.org
|
|
4299
4349
|
});
|
|
4300
|
-
const client =
|
|
4350
|
+
const client = N$1({
|
|
4301
4351
|
baseUrl: runtime.apiUrl,
|
|
4302
4352
|
client: "cli",
|
|
4303
4353
|
getHeaders: () => {
|
|
@@ -4578,44 +4628,38 @@ const g = z.object({
|
|
|
4578
4628
|
segmentId: z.string().min(1),
|
|
4579
4629
|
operator: z.enum([`in`, `not_in`]).optional()
|
|
4580
4630
|
});
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
]
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
for (let n of e) v(n) > 8 && t.addIssue({
|
|
4599
|
-
code: `custom`,
|
|
4600
|
-
message: `condition groups cannot nest more than 8 levels`
|
|
4601
|
-
});
|
|
4602
|
-
}
|
|
4603
|
-
const b = z.object({
|
|
4631
|
+
function _(t) {
|
|
4632
|
+
return z.lazy(() => z.union([
|
|
4633
|
+
h,
|
|
4634
|
+
m,
|
|
4635
|
+
g,
|
|
4636
|
+
d,
|
|
4637
|
+
f,
|
|
4638
|
+
p,
|
|
4639
|
+
...t < 8 ? [z.object({
|
|
4640
|
+
kind: z.literal(`group`),
|
|
4641
|
+
op: z.enum([`and`, `or`]),
|
|
4642
|
+
conditions: z.array(_(t + 1)).min(1)
|
|
4643
|
+
})] : []
|
|
4644
|
+
]));
|
|
4645
|
+
}
|
|
4646
|
+
const v = _(0);
|
|
4647
|
+
const y = z.object({
|
|
4604
4648
|
id: z.string().min(1),
|
|
4605
4649
|
description: z.string().optional(),
|
|
4606
|
-
conditions: z.array(
|
|
4650
|
+
conditions: z.array(v),
|
|
4607
4651
|
serve: u
|
|
4608
|
-
})
|
|
4609
|
-
const
|
|
4652
|
+
});
|
|
4653
|
+
const b = z.object({
|
|
4610
4654
|
id: z.string().min(1),
|
|
4611
|
-
conditions: z.array(
|
|
4612
|
-
})
|
|
4613
|
-
const
|
|
4614
|
-
const
|
|
4655
|
+
conditions: z.array(v).min(1)
|
|
4656
|
+
});
|
|
4657
|
+
const x = z.object({ projectId: z.string().min(1) });
|
|
4658
|
+
const S = z.object({
|
|
4615
4659
|
projectId: z.string().min(1),
|
|
4616
4660
|
key: z.string().min(1)
|
|
4617
4661
|
});
|
|
4618
|
-
const
|
|
4662
|
+
const C = z.object({
|
|
4619
4663
|
projectId: z.string().min(1),
|
|
4620
4664
|
key: o,
|
|
4621
4665
|
name: z.string().min(1),
|
|
@@ -4630,7 +4674,7 @@ const w = z.object({
|
|
|
4630
4674
|
message: `variant flag requires a non-empty variants array`
|
|
4631
4675
|
});
|
|
4632
4676
|
});
|
|
4633
|
-
const
|
|
4677
|
+
const w = z.object({
|
|
4634
4678
|
expectedVersion: z.number().int().positive().optional(),
|
|
4635
4679
|
flagId: z.string().min(1),
|
|
4636
4680
|
key: o.optional(),
|
|
@@ -4640,17 +4684,24 @@ const T = z.object({
|
|
|
4640
4684
|
variants: z.array(z.string()).nullable().optional(),
|
|
4641
4685
|
tags: z.array(z.string()).optional()
|
|
4642
4686
|
});
|
|
4643
|
-
const
|
|
4644
|
-
const
|
|
4645
|
-
const
|
|
4646
|
-
const
|
|
4687
|
+
const T = z.object({ flagId: z.string().min(1) });
|
|
4688
|
+
const E = z.object({ projectId: z.string().min(1) });
|
|
4689
|
+
const D = z.object({ flagId: z.string().min(1) });
|
|
4690
|
+
const O = z.object({
|
|
4647
4691
|
expectedVersion: z.number().int().positive().optional(),
|
|
4648
4692
|
flagId: z.string().min(1),
|
|
4649
4693
|
environmentId: z.string().min(1),
|
|
4650
4694
|
enabled: z.boolean().optional(),
|
|
4651
|
-
rules: z.array(
|
|
4695
|
+
rules: z.array(y).optional(),
|
|
4652
4696
|
fallthrough: u.optional()
|
|
4653
4697
|
});
|
|
4698
|
+
const k = z.object({
|
|
4699
|
+
flagId: z.string().min(1),
|
|
4700
|
+
environments: z.array(z.object({
|
|
4701
|
+
environmentId: z.string().min(1),
|
|
4702
|
+
expectedVersion: z.number().int().positive()
|
|
4703
|
+
})).min(1).refine((e) => new Set(e.map((e) => e.environmentId)).size === e.length, `Duplicate environments`)
|
|
4704
|
+
});
|
|
4654
4705
|
const A = z.object({
|
|
4655
4706
|
expectedVersion: z.number().int().positive().optional(),
|
|
4656
4707
|
flagId: z.string().min(1),
|
|
@@ -4671,7 +4722,13 @@ function P(e, t) {
|
|
|
4671
4722
|
case `number`: return Number.isFinite(e);
|
|
4672
4723
|
case `object`: {
|
|
4673
4724
|
let n = t ?? /* @__PURE__ */ new WeakSet();
|
|
4674
|
-
|
|
4725
|
+
if (n.has(e)) return !1;
|
|
4726
|
+
n.add(e);
|
|
4727
|
+
try {
|
|
4728
|
+
return Array.isArray(e) ? e.every((e) => P(e, n)) : !N(e) || Object.getOwnPropertySymbols(e).length > 0 ? !1 : Object.keys(e).every((t) => P(e[t], n));
|
|
4729
|
+
} finally {
|
|
4730
|
+
n.delete(e);
|
|
4731
|
+
}
|
|
4675
4732
|
}
|
|
4676
4733
|
default: return !1;
|
|
4677
4734
|
}
|
|
@@ -4713,7 +4770,139 @@ function I(e, t) {
|
|
|
4713
4770
|
});
|
|
4714
4771
|
}
|
|
4715
4772
|
}
|
|
4716
|
-
const L = z.
|
|
4773
|
+
const L = z.record(o, z.discriminatedUnion(`type`, [
|
|
4774
|
+
z.object({
|
|
4775
|
+
type: z.literal(`string`),
|
|
4776
|
+
values: z.tuple([z.string()], z.string()).optional(),
|
|
4777
|
+
required: z.boolean().optional()
|
|
4778
|
+
}),
|
|
4779
|
+
z.object({
|
|
4780
|
+
type: z.literal(`number`),
|
|
4781
|
+
required: z.boolean().optional()
|
|
4782
|
+
}),
|
|
4783
|
+
z.object({
|
|
4784
|
+
type: z.literal(`boolean`),
|
|
4785
|
+
required: z.boolean().optional()
|
|
4786
|
+
})
|
|
4787
|
+
])).superRefine((e, t) => {
|
|
4788
|
+
for (let n of [
|
|
4789
|
+
`userId`,
|
|
4790
|
+
`country`,
|
|
4791
|
+
`region`,
|
|
4792
|
+
`city`,
|
|
4793
|
+
`timezone`
|
|
4794
|
+
]) Object.hasOwn(e, n) && e[n]?.type !== `string` && t.addIssue({
|
|
4795
|
+
code: `custom`,
|
|
4796
|
+
path: [n, `type`],
|
|
4797
|
+
message: `built-in trait "${n}" must be a string`
|
|
4798
|
+
});
|
|
4799
|
+
});
|
|
4800
|
+
const R = z.custom((e) => typeof e == `object` && !!e && !Array.isArray(e), { message: `trait definitions must be an object` }).superRefine((e, t) => {
|
|
4801
|
+
Object.hasOwn(e, `__proto__`) && t.addIssue({
|
|
4802
|
+
code: `custom`,
|
|
4803
|
+
path: [`__proto__`],
|
|
4804
|
+
message: `trait key "__proto__" is reserved`
|
|
4805
|
+
});
|
|
4806
|
+
}).pipe(L);
|
|
4807
|
+
function z$1(e, t) {
|
|
4808
|
+
if (!e.traits || !e.targeting) return;
|
|
4809
|
+
let n = {
|
|
4810
|
+
userId: { type: `string` },
|
|
4811
|
+
country: { type: `string` },
|
|
4812
|
+
region: { type: `string` },
|
|
4813
|
+
city: { type: `string` },
|
|
4814
|
+
timezone: { type: `string` },
|
|
4815
|
+
...e.traits
|
|
4816
|
+
}, r = (e) => t.addIssue({
|
|
4817
|
+
code: `custom`,
|
|
4818
|
+
path: [`targeting`],
|
|
4819
|
+
message: e
|
|
4820
|
+
}), i = (e) => {
|
|
4821
|
+
e && !Object.hasOwn(n, e) && r(`undeclared bucketing trait "${e}"`);
|
|
4822
|
+
}, a = (e) => {
|
|
4823
|
+
if (e.kind === `group`) {
|
|
4824
|
+
e.conditions.forEach(a);
|
|
4825
|
+
return;
|
|
4826
|
+
}
|
|
4827
|
+
if (e.kind === `percentage`) {
|
|
4828
|
+
i(e.attribute);
|
|
4829
|
+
return;
|
|
4830
|
+
}
|
|
4831
|
+
if (e.kind !== `attribute`) return;
|
|
4832
|
+
if (!Object.hasOwn(n, e.attribute)) {
|
|
4833
|
+
r(`undeclared trait "${e.attribute}"`);
|
|
4834
|
+
return;
|
|
4835
|
+
}
|
|
4836
|
+
let t = n[e.attribute];
|
|
4837
|
+
if (e.operator !== `exists` && e.operator !== `not_exists` && ([
|
|
4838
|
+
`contains`,
|
|
4839
|
+
`startsWith`,
|
|
4840
|
+
`endsWith`
|
|
4841
|
+
].includes(e.operator) && t.type !== `string` && r(`operator ${e.operator} requires a string trait`), [
|
|
4842
|
+
`gt`,
|
|
4843
|
+
`gte`,
|
|
4844
|
+
`lt`,
|
|
4845
|
+
`lte`
|
|
4846
|
+
].includes(e.operator) && t.type !== `number` && t.type !== `string` && r(`operator ${e.operator} requires a number or string trait`), `value` in e)) for (let n of Array.isArray(e.value) ? e.value : [e.value]) (typeof n !== t.type || t.type === `string` && [
|
|
4847
|
+
`eq`,
|
|
4848
|
+
`neq`,
|
|
4849
|
+
`in`,
|
|
4850
|
+
`not_in`
|
|
4851
|
+
].includes(e.operator) && t.values && !t.values.includes(String(n))) && r(`invalid value for trait "${e.attribute}"`);
|
|
4852
|
+
}, o = (e) => {
|
|
4853
|
+
e.kind === `weighted` && i(e.attribute);
|
|
4854
|
+
};
|
|
4855
|
+
o(e.targeting.fallthrough), e.targeting.rules.forEach((e) => {
|
|
4856
|
+
e.conditions.forEach(a), o(e.serve);
|
|
4857
|
+
});
|
|
4858
|
+
}
|
|
4859
|
+
const B = z.object({
|
|
4860
|
+
enabled: z.boolean(),
|
|
4861
|
+
rules: z.array(y).max(500),
|
|
4862
|
+
fallthrough: u
|
|
4863
|
+
}).strict().superRefine((e, t) => {
|
|
4864
|
+
let n = /* @__PURE__ */ new Set();
|
|
4865
|
+
e.rules.forEach((e, r) => {
|
|
4866
|
+
n.has(e.id) && t.addIssue({
|
|
4867
|
+
code: `custom`,
|
|
4868
|
+
path: [
|
|
4869
|
+
`rules`,
|
|
4870
|
+
r,
|
|
4871
|
+
`id`
|
|
4872
|
+
],
|
|
4873
|
+
message: `duplicate rule id`
|
|
4874
|
+
}), n.add(e.id);
|
|
4875
|
+
});
|
|
4876
|
+
});
|
|
4877
|
+
function V(e, t) {
|
|
4878
|
+
if (!e.targeting) return;
|
|
4879
|
+
let n = (n, r) => {
|
|
4880
|
+
n.kind === `weighted` && !Number.isFinite(n.variations.reduce((e, t) => e + t.weight, 0)) && t.addIssue({
|
|
4881
|
+
code: `custom`,
|
|
4882
|
+
path: r,
|
|
4883
|
+
message: `total weight must be finite`
|
|
4884
|
+
});
|
|
4885
|
+
let i = n.kind === `weighted` ? n.variations.map((e) => e.serve) : [n];
|
|
4886
|
+
for (let n of i) n.kind !== `disabled` && (n.kind !== e.type || n.kind === `variant` && !e.variants?.includes(n.value) || n.kind === `json` && !P(n.value)) && t.addIssue({
|
|
4887
|
+
code: `custom`,
|
|
4888
|
+
path: r,
|
|
4889
|
+
message: `serve must match the flag type and declared variants and contain JSON values`
|
|
4890
|
+
});
|
|
4891
|
+
};
|
|
4892
|
+
n(e.targeting.fallthrough, [`targeting`, `fallthrough`]), e.targeting.rules.forEach((e, t) => n(e.serve, [
|
|
4893
|
+
`targeting`,
|
|
4894
|
+
`rules`,
|
|
4895
|
+
t,
|
|
4896
|
+
`serve`
|
|
4897
|
+
]));
|
|
4898
|
+
}
|
|
4899
|
+
const H = z.object({
|
|
4900
|
+
type: t,
|
|
4901
|
+
variants: z.array(z.string()).optional(),
|
|
4902
|
+
traits: R.optional(),
|
|
4903
|
+
targeting: B.optional()
|
|
4904
|
+
}).superRefine(V).superRefine(z$1);
|
|
4905
|
+
const U = z.object({
|
|
4717
4906
|
key: o,
|
|
4718
4907
|
type: t,
|
|
4719
4908
|
default: z.unknown(),
|
|
@@ -4721,28 +4910,30 @@ const L = z.object({
|
|
|
4721
4910
|
tags: z.array(z.string()).default([]),
|
|
4722
4911
|
lifecycle: M.default(`active`),
|
|
4723
4912
|
variants: z.array(z.string()).optional(),
|
|
4724
|
-
disabled: z.boolean().optional()
|
|
4913
|
+
disabled: z.boolean().optional(),
|
|
4914
|
+
targeting: B.optional(),
|
|
4915
|
+
traits: R.optional()
|
|
4725
4916
|
});
|
|
4726
|
-
const
|
|
4727
|
-
const
|
|
4917
|
+
const W = U.superRefine(I).superRefine(V).superRefine(z$1);
|
|
4918
|
+
const G = U.extend({
|
|
4728
4919
|
version: z.number().int().positive(),
|
|
4729
4920
|
environmentVersion: z.number().int().positive().optional(),
|
|
4730
4921
|
managedBy: n
|
|
4731
|
-
}).superRefine(I);
|
|
4732
|
-
const
|
|
4922
|
+
}).superRefine(I).superRefine(V).superRefine(z$1);
|
|
4923
|
+
const K = z.object({
|
|
4733
4924
|
version: z.number().int().positive(),
|
|
4734
4925
|
environmentVersion: z.number().int().positive().optional()
|
|
4735
4926
|
});
|
|
4736
|
-
const
|
|
4927
|
+
const q = z.object({
|
|
4737
4928
|
projectId: z.string().min(1),
|
|
4738
4929
|
environmentId: z.string().min(1)
|
|
4739
4930
|
});
|
|
4740
|
-
const
|
|
4931
|
+
const J = z.object({
|
|
4741
4932
|
projectId: z.string(),
|
|
4742
4933
|
environmentId: z.string(),
|
|
4743
|
-
flags: z.array(
|
|
4934
|
+
flags: z.array(G)
|
|
4744
4935
|
});
|
|
4745
|
-
function
|
|
4936
|
+
function Y(e, t) {
|
|
4746
4937
|
let n = /* @__PURE__ */ new Set();
|
|
4747
4938
|
for (let [r, i] of e.entries()) n.has(i.key) && t.addIssue({
|
|
4748
4939
|
code: `custom`,
|
|
@@ -4754,12 +4945,12 @@ function U(e, t) {
|
|
|
4754
4945
|
message: `duplicate flag key "${i.key}"`
|
|
4755
4946
|
}), n.add(i.key);
|
|
4756
4947
|
}
|
|
4757
|
-
const
|
|
4948
|
+
const X = z.object({
|
|
4758
4949
|
projectId: z.string().min(1),
|
|
4759
4950
|
environmentId: z.string().min(1),
|
|
4760
|
-
flags: z.array(
|
|
4761
|
-
}).superRefine((e, t) =>
|
|
4762
|
-
const
|
|
4951
|
+
flags: z.array(W).max(500)
|
|
4952
|
+
}).superRefine((e, t) => Y(e.flags, t));
|
|
4953
|
+
const Z = z.object({
|
|
4763
4954
|
key: z.string(),
|
|
4764
4955
|
op: z.enum([
|
|
4765
4956
|
`add`,
|
|
@@ -4767,35 +4958,36 @@ const G = z.object({
|
|
|
4767
4958
|
`remove`,
|
|
4768
4959
|
`unlinked`
|
|
4769
4960
|
]),
|
|
4770
|
-
before:
|
|
4771
|
-
after:
|
|
4961
|
+
before: G.optional(),
|
|
4962
|
+
after: W.optional(),
|
|
4772
4963
|
message: z.string().optional()
|
|
4773
4964
|
});
|
|
4774
|
-
const
|
|
4965
|
+
const Q = z.object({
|
|
4775
4966
|
projectId: z.string(),
|
|
4776
4967
|
environmentId: z.string(),
|
|
4777
|
-
changes: z.array(
|
|
4778
|
-
remoteOnly: z.array(
|
|
4968
|
+
changes: z.array(Z),
|
|
4969
|
+
remoteOnly: z.array(G).default([])
|
|
4779
4970
|
});
|
|
4780
|
-
const
|
|
4971
|
+
const $ = z.object({
|
|
4781
4972
|
projectId: z.string().min(1),
|
|
4782
4973
|
environmentId: z.string().min(1),
|
|
4783
|
-
flags: z.array(
|
|
4974
|
+
flags: z.array(W).max(500),
|
|
4784
4975
|
apply: z.boolean().default(!1),
|
|
4785
4976
|
prune: z.boolean().default(!1),
|
|
4786
4977
|
force: z.boolean().default(!1),
|
|
4787
4978
|
adopt: z.boolean().default(!1),
|
|
4788
|
-
expectedVersions: z.record(z.string(),
|
|
4789
|
-
}).superRefine((e, t) =>
|
|
4790
|
-
const
|
|
4979
|
+
expectedVersions: z.record(z.string(), K).optional()
|
|
4980
|
+
}).superRefine((e, t) => Y(e.flags, t));
|
|
4981
|
+
const ee = z.object({
|
|
4791
4982
|
projectId: z.string(),
|
|
4792
4983
|
environmentId: z.string(),
|
|
4793
4984
|
applied: z.boolean(),
|
|
4794
|
-
changes: z.array(
|
|
4795
|
-
remoteOnly: z.array(
|
|
4985
|
+
changes: z.array(Z),
|
|
4986
|
+
remoteOnly: z.array(G).default([]),
|
|
4796
4987
|
forced: z.boolean().default(!1),
|
|
4797
4988
|
adopted: z.boolean().default(!1),
|
|
4798
|
-
approvalRequests: z.array(z.string()).default([])
|
|
4989
|
+
approvalRequests: z.array(z.string()).default([]),
|
|
4990
|
+
drafts: z.array(z.string()).default([])
|
|
4799
4991
|
});
|
|
4800
4992
|
|
|
4801
4993
|
//#endregion
|
|
@@ -4958,10 +5150,32 @@ function goValue(value) {
|
|
|
4958
5150
|
if (typeof value === "object") return `map[string]any{${Object.entries(value).map(([key, entry]) => `${goString(key)}: ${goValue(entry)}`).join(", ")}}`;
|
|
4959
5151
|
return JSON.stringify(value);
|
|
4960
5152
|
}
|
|
5153
|
+
function goCondition(c) {
|
|
5154
|
+
const fields = [`Kind: ${goString(c.kind)}`];
|
|
5155
|
+
for (const [key, value] of Object.entries(c)) {
|
|
5156
|
+
if (key === "kind") continue;
|
|
5157
|
+
const name = key === "segmentId" ? "SegmentID" : key[0].toUpperCase() + key.slice(1);
|
|
5158
|
+
fields.push(`${name}: ${key === "conditions" ? `[]config.Condition{${value.map(goCondition).join(", ")}}` : goValue(value)}`);
|
|
5159
|
+
}
|
|
5160
|
+
return `{${fields.join(", ")}}`;
|
|
5161
|
+
}
|
|
5162
|
+
function goServe(s) {
|
|
5163
|
+
const fields = [`Kind: ${goString(s.kind)}`];
|
|
5164
|
+
for (const [key, value] of Object.entries(s)) {
|
|
5165
|
+
if (key === "kind") continue;
|
|
5166
|
+
fields.push(`${key[0].toUpperCase() + key.slice(1)}: ${key === "variations" ? `[]config.WeightedVariation{${value.map((v) => `{Weight: ${goNumber(v.weight)}, Serve: config.Serve${goServe(v.serve)}}`).join(", ")}}` : goValue(value)}`);
|
|
5167
|
+
}
|
|
5168
|
+
return `{${fields.join(", ")}}`;
|
|
5169
|
+
}
|
|
5170
|
+
function goTargeting(t) {
|
|
5171
|
+
return `&config.Targeting{Enabled: ${t.enabled}, Rules: []config.Rule{${t.rules.map((r) => `{ID: ${goString(r.id)}, ${r.description !== void 0 ? `Description: ${goString(r.description)}, ` : ""}Conditions: []config.Condition{${r.conditions.map(goCondition).join(", ")}}, Serve: config.Serve${goServe(r.serve)}}`).join(", ")}}, Fallthrough: config.Serve${goServe(t.fallthrough)}}`;
|
|
5172
|
+
}
|
|
4961
5173
|
/** Emits gofmt-clean Go: one block per flag, field values aligned as gofmt does. */
|
|
4962
5174
|
function generateGoConfigSource(flags, packageName = "main") {
|
|
4963
5175
|
const entries = flags.map((flag) => {
|
|
4964
5176
|
const fields = [["Type", goString(flag.type)], ["Default", goValue(flag.default)]];
|
|
5177
|
+
if (flag.traits !== void 0) fields.push(["Traits", `map[string]config.TraitDefinition{${Object.entries(flag.traits).map(([key, t]) => `${goString(key)}: {Type: ${goString(t.type)}${"values" in t && t.values ? `, Values: []string{${t.values.map(goString).join(", ")}}` : ""}${t.required ? ", Required: true" : ""}}`).join(", ")}}`]);
|
|
5178
|
+
if (flag.targeting) fields.push(["Targeting", goTargeting(flag.targeting)]);
|
|
4965
5179
|
if (flag.variants) fields.push(["Variants", `[]string{${flag.variants.map((v) => goString(v)).join(", ")}}`]);
|
|
4966
5180
|
if (flag.description !== void 0) fields.push(["Description", goString(flag.description)]);
|
|
4967
5181
|
if (flag.tags.length) fields.push(["Tags", `[]string{${flag.tags.map((v) => goString(v)).join(", ")}}`]);
|
|
@@ -4982,7 +5196,7 @@ var Config = config.ShipdConfig${entries.length ? `{\n${entries.join("\n")}\n}`
|
|
|
4982
5196
|
|
|
4983
5197
|
//#endregion
|
|
4984
5198
|
//#region src/lib/local-config.ts
|
|
4985
|
-
const localFlagsArraySchema = z.array(
|
|
5199
|
+
const localFlagsArraySchema = z.array(W).superRefine((flags, ctx) => {
|
|
4986
5200
|
const seen = /* @__PURE__ */ new Set();
|
|
4987
5201
|
for (const [index, flag] of flags.entries()) {
|
|
4988
5202
|
if (seen.has(flag.key)) ctx.addIssue({
|
|
@@ -5023,7 +5237,9 @@ async function loadLocalFlags(configFile) {
|
|
|
5023
5237
|
tags: flag.tags ?? [],
|
|
5024
5238
|
lifecycle: flag.lifecycle ?? (flag.deprecated === true ? "deprecated" : "active"),
|
|
5025
5239
|
variants: flag.variants,
|
|
5026
|
-
disabled: flag.disabled
|
|
5240
|
+
disabled: flag.disabled,
|
|
5241
|
+
targeting: flag.targeting,
|
|
5242
|
+
traits: flag.traits
|
|
5027
5243
|
}));
|
|
5028
5244
|
const parsed = localFlagsArraySchema.safeParse(candidates);
|
|
5029
5245
|
if (!parsed.success) {
|
|
@@ -5038,7 +5254,9 @@ async function loadLocalFlags(configFile) {
|
|
|
5038
5254
|
tags: flag.tags,
|
|
5039
5255
|
lifecycle: flag.lifecycle,
|
|
5040
5256
|
variants: flag.variants,
|
|
5041
|
-
disabled: flag.disabled
|
|
5257
|
+
disabled: flag.disabled,
|
|
5258
|
+
targeting: flag.targeting,
|
|
5259
|
+
traits: flag.traits
|
|
5042
5260
|
}));
|
|
5043
5261
|
}
|
|
5044
5262
|
function serializeValue(value) {
|
|
@@ -5057,6 +5275,8 @@ ${flags.map((flag) => {
|
|
|
5057
5275
|
if (flag.type === "variant" && flag.variants) lines.push(` variants: ${JSON.stringify(flag.variants)} as const,`, ` default: ${JSON.stringify(flag.default)},`);
|
|
5058
5276
|
else if (flag.type === "json") lines.push(` default: ${serializeValue(flag.default)},`);
|
|
5059
5277
|
else lines.push(` default: ${JSON.stringify(flag.default)},`);
|
|
5278
|
+
if (flag.traits !== void 0) lines.push(` traits: ${serializeValue(flag.traits)},`);
|
|
5279
|
+
if (flag.targeting !== void 0) lines.push(` targeting: ${serializeValue(flag.targeting)},`);
|
|
5060
5280
|
if (flag.description !== void 0) lines.push(` description: ${JSON.stringify(flag.description)},`);
|
|
5061
5281
|
if (flag.tags.length > 0) lines.push(` tags: ${JSON.stringify(flag.tags)},`);
|
|
5062
5282
|
if (flag.lifecycle === "deprecated") lines.push(` deprecated: true,`);
|
|
@@ -5073,6 +5293,7 @@ function generateTypesSource(flags) {
|
|
|
5073
5293
|
const variants = flag.variants && flag.variants.length > 0 ? flag.variants.map((v) => JSON.stringify(v)).join(" | ") : "string";
|
|
5074
5294
|
lines.push(` variants: ${variants};`);
|
|
5075
5295
|
}
|
|
5296
|
+
if (flag.traits !== void 0) lines.push(` traits: ${serializeTypeLiteral(flag.traits)};`);
|
|
5076
5297
|
lines.push(` default: ${serializeTypeLiteral(flag.default)};`);
|
|
5077
5298
|
lines.push(` };`);
|
|
5078
5299
|
return lines.join("\n");
|
|
@@ -5085,6 +5306,8 @@ ${flags.length === 0 ? " // No flags defined in shipd.config.ts\n" : `${entries
|
|
|
5085
5306
|
|
|
5086
5307
|
export type FlagKey = keyof FlagDefinitions;
|
|
5087
5308
|
|
|
5309
|
+
export type FlagTraits<K extends FlagKey> = import("shipdit/config").TraitsFor<FlagDefinitions[K]>;
|
|
5310
|
+
|
|
5088
5311
|
export type BooleanFlagKey = {
|
|
5089
5312
|
[K in FlagKey]: FlagDefinitions[K]["type"] extends "boolean" ? K : never;
|
|
5090
5313
|
}[FlagKey];
|
|
@@ -5123,10 +5346,12 @@ const DEFINITION_FIELDS = [
|
|
|
5123
5346
|
"type",
|
|
5124
5347
|
"default",
|
|
5125
5348
|
"disabled",
|
|
5349
|
+
"targeting",
|
|
5126
5350
|
"description",
|
|
5127
5351
|
"tags",
|
|
5128
5352
|
"lifecycle",
|
|
5129
|
-
"variants"
|
|
5353
|
+
"variants",
|
|
5354
|
+
"traits"
|
|
5130
5355
|
];
|
|
5131
5356
|
function formatValue(value) {
|
|
5132
5357
|
if (value === void 0) return "undefined";
|
|
@@ -5135,9 +5360,11 @@ function formatValue(value) {
|
|
|
5135
5360
|
function fieldChanges(before, after) {
|
|
5136
5361
|
const fields = {};
|
|
5137
5362
|
for (const field of DEFINITION_FIELDS) {
|
|
5363
|
+
if (field === "traits" && after.traits === void 0) continue;
|
|
5364
|
+
if (field === "targeting" && after.targeting === void 0) continue;
|
|
5138
5365
|
const from = before[field];
|
|
5139
5366
|
const to = after[field];
|
|
5140
|
-
if (
|
|
5367
|
+
if (!isDeepStrictEqual(from ?? null, to ?? null)) fields[field] = {
|
|
5141
5368
|
from,
|
|
5142
5369
|
to
|
|
5143
5370
|
};
|
|
@@ -5149,7 +5376,8 @@ const DEFINITION_ONLY_FIELDS = [
|
|
|
5149
5376
|
"description",
|
|
5150
5377
|
"tags",
|
|
5151
5378
|
"lifecycle",
|
|
5152
|
-
"variants"
|
|
5379
|
+
"variants",
|
|
5380
|
+
"traits"
|
|
5153
5381
|
];
|
|
5154
5382
|
function planHasDefinitionChanges(plan) {
|
|
5155
5383
|
if (plan.creates.length > 0 || plan.archives.length > 0) return true;
|
|
@@ -5378,6 +5606,70 @@ function registerProjectsCommands(program) {
|
|
|
5378
5606
|
});
|
|
5379
5607
|
}
|
|
5380
5608
|
|
|
5609
|
+
//#endregion
|
|
5610
|
+
//#region src/lib/sync-state.ts
|
|
5611
|
+
const stateSchema = z.object({
|
|
5612
|
+
version: z.literal(1),
|
|
5613
|
+
flags: z.record(o, B)
|
|
5614
|
+
}).strict();
|
|
5615
|
+
function stateFile(runtime, projectId, environmentId) {
|
|
5616
|
+
const identity = JSON.stringify([
|
|
5617
|
+
runtime.apiUrl,
|
|
5618
|
+
projectId,
|
|
5619
|
+
environmentId,
|
|
5620
|
+
path.resolve(runtime.configFile)
|
|
5621
|
+
]);
|
|
5622
|
+
const key = createHash("sha256").update(identity).digest("hex");
|
|
5623
|
+
return path.join(runtime.projectDir ?? path.dirname(runtime.configFile), ".shipd", "sync", `${key}.json`);
|
|
5624
|
+
}
|
|
5625
|
+
function canonical(value) {
|
|
5626
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
5627
|
+
if (value !== null && typeof value === "object") return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(",")}}`;
|
|
5628
|
+
return JSON.stringify(value) ?? "null";
|
|
5629
|
+
}
|
|
5630
|
+
function readSyncState(runtime, projectId, environmentId) {
|
|
5631
|
+
const file = stateFile(runtime, projectId, environmentId);
|
|
5632
|
+
if (!fs.existsSync(file)) return;
|
|
5633
|
+
try {
|
|
5634
|
+
const raw = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
5635
|
+
if (raw?.flags && Object.hasOwn(raw.flags, "__proto__")) throw new Error("reserved flag key");
|
|
5636
|
+
return stateSchema.parse(raw);
|
|
5637
|
+
} catch {
|
|
5638
|
+
throw new CliError("validation_error", `Invalid sync baseline: ${file}`);
|
|
5639
|
+
}
|
|
5640
|
+
}
|
|
5641
|
+
function writeSyncState(runtime, projectId, environmentId, flags) {
|
|
5642
|
+
const file = stateFile(runtime, projectId, environmentId);
|
|
5643
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
5644
|
+
const state = {
|
|
5645
|
+
version: 1,
|
|
5646
|
+
flags: Object.fromEntries(flags.filter((f) => f.targeting !== void 0).map((f) => [f.key, f.targeting]))
|
|
5647
|
+
};
|
|
5648
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
5649
|
+
try {
|
|
5650
|
+
fs.writeFileSync(temp, JSON.stringify(state, null, 2) + "\n", { mode: 384 });
|
|
5651
|
+
fs.renameSync(temp, file);
|
|
5652
|
+
} finally {
|
|
5653
|
+
fs.rmSync(temp, { force: true });
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
function assertNoRemoteTargetingChanges(state, changes) {
|
|
5657
|
+
if (!state) return;
|
|
5658
|
+
for (const change of changes) {
|
|
5659
|
+
if (change.after?.targeting === void 0) continue;
|
|
5660
|
+
const base = Object.hasOwn(state.flags, change.key) ? state.flags[change.key] : void 0;
|
|
5661
|
+
if (base && canonical(base) !== canonical(change.before?.targeting) && canonical(change.after.targeting) !== canonical(change.before?.targeting)) throw new CliError("conflict", `Flag "${change.key}" targeting changed in the dashboard since the last sync. Pull and reconcile, or push --force to overwrite.`, { exitCode: 3 });
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
function assertPullPreservesLocalTargeting(state, local, remote) {
|
|
5665
|
+
if (!state) return;
|
|
5666
|
+
const byKey = new Map(remote.map((f) => [f.key, f]));
|
|
5667
|
+
for (const flag of local) {
|
|
5668
|
+
const base = Object.hasOwn(state.flags, flag.key) ? state.flags[flag.key] : void 0;
|
|
5669
|
+
if (flag.targeting !== void 0 && canonical(flag.targeting) !== canonical(base) && canonical(flag.targeting) !== canonical(byKey.get(flag.key)?.targeting)) throw new CliError("conflict", `Pull would overwrite local targeting changes for "${flag.key}". Save your edits separately and reconcile them, or pull --force.`, { exitCode: 3 });
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5672
|
+
|
|
5381
5673
|
//#endregion
|
|
5382
5674
|
//#region src/lib/go-typegen.ts
|
|
5383
5675
|
const GO_KEYWORDS = new Set("break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var".split(" "));
|
|
@@ -5398,6 +5690,29 @@ function generateGoTypesSource(flags, packageName = "flags") {
|
|
|
5398
5690
|
const name = claim(goName(flag.key), flag.key);
|
|
5399
5691
|
const keyName = claim(`${name}Key`, flag.key);
|
|
5400
5692
|
const lines = [`const ${keyName} = ${goString(flag.key)}`];
|
|
5693
|
+
if (flag.traits !== void 0) {
|
|
5694
|
+
const traitsName = claim(`${name}Traits`, flag.key);
|
|
5695
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5696
|
+
const fields = [];
|
|
5697
|
+
const assignments = [];
|
|
5698
|
+
for (const [key, trait] of Object.entries(flag.traits)) {
|
|
5699
|
+
const field = goName(key);
|
|
5700
|
+
if (field === "Context" || seen.has(field)) throw new CliError("validation_error", `Go trait identifier ${field} collides for flag ${flag.key}`);
|
|
5701
|
+
seen.add(field);
|
|
5702
|
+
let type = trait.type === "string" ? "string" : trait.type === "number" ? "float64" : "bool";
|
|
5703
|
+
if (trait.type === "string" && trait.values) {
|
|
5704
|
+
type = claim(`${name}${field}Trait`, flag.key);
|
|
5705
|
+
lines.push(`type ${type} string`);
|
|
5706
|
+
for (const value of trait.values) lines.push(`const ${claim(`${type}${goName(value)}`, flag.key)} ${type} = ${goString(value)}`);
|
|
5707
|
+
}
|
|
5708
|
+
fields.push(`\t${field} *${type}`);
|
|
5709
|
+
const scalar = trait.type === "string" && trait.values ? `string(*t.${field})` : `*t.${field}`;
|
|
5710
|
+
if (trait.required) assignments.push(`\tif t.${field} == nil { return shipd.EvaluationContext{}, errors.New(${goString(`missing required trait ${key} for flag ${flag.key}`)}) }`);
|
|
5711
|
+
assignments.push(`\tif t.${field} != nil { attributes[${goString(key)}] = ${scalar} }`);
|
|
5712
|
+
}
|
|
5713
|
+
lines.push(`// ${traitsName} uses pointers to distinguish missing inputs from explicit zero values.\ntype ${traitsName} struct {\n${fields.join("\n")}\n}`);
|
|
5714
|
+
lines.push(`func (t ${traitsName}) Context(userID string) (shipd.EvaluationContext, error) {\n\tattributes := map[string]any{}\n${assignments.join("\n")}\n\treturn shipd.EvaluationContext{UserID: userID, Attributes: attributes}, nil\n}`);
|
|
5715
|
+
}
|
|
5401
5716
|
let returnType;
|
|
5402
5717
|
let expression;
|
|
5403
5718
|
switch (flag.type) {
|
|
@@ -5431,7 +5746,7 @@ package ${packageName}
|
|
|
5431
5746
|
|
|
5432
5747
|
import (
|
|
5433
5748
|
\t"encoding/json"
|
|
5434
|
-
${flags.length ? " shipd \"github.com/alasti-company/useshipd.com/sdks/go\"\n" : ""})
|
|
5749
|
+
${flags.some((f) => Object.values(f.traits ?? {}).some((t) => t.required)) ? " \"errors\"\n" : ""}${flags.length ? " shipd \"github.com/alasti-company/useshipd.com/sdks/go\"\n" : ""})
|
|
5435
5750
|
|
|
5436
5751
|
// Defaults returns a fresh map of the config's defaults for shipd.Options.
|
|
5437
5752
|
func Defaults() map[string]any {
|
|
@@ -5471,7 +5786,7 @@ function writeTypegen(prepared) {
|
|
|
5471
5786
|
//#endregion
|
|
5472
5787
|
//#region src/commands/pull.ts
|
|
5473
5788
|
function registerPullCommand(program) {
|
|
5474
|
-
program.command("pull").description("Regenerate the flag config from the server and run typegen").action(async (
|
|
5789
|
+
program.command("pull").description("Regenerate the flag config from the server and run typegen").option("--force", "Overwrite unsynced local targeting", false).action(async (opts, command) => {
|
|
5475
5790
|
const runtime = getRuntime(command);
|
|
5476
5791
|
const client = await createCliApiClient(runtime);
|
|
5477
5792
|
const { projectId, environmentId } = await resolveIds(client, runtime);
|
|
@@ -5486,8 +5801,12 @@ function registerPullCommand(program) {
|
|
|
5486
5801
|
tags: flag.tags,
|
|
5487
5802
|
lifecycle: flag.lifecycle,
|
|
5488
5803
|
variants: flag.variants,
|
|
5489
|
-
disabled: flag.disabled
|
|
5804
|
+
disabled: flag.disabled,
|
|
5805
|
+
targeting: flag.targeting,
|
|
5806
|
+
traits: flag.traits
|
|
5490
5807
|
}));
|
|
5808
|
+
const baseline = !opts.force ? readSyncState(runtime, projectId, environmentId) : void 0;
|
|
5809
|
+
if (baseline && fs.existsSync(runtime.configFile)) assertPullPreservesLocalTargeting(baseline, await loadLocalFlags(runtime.configFile), localFlags);
|
|
5491
5810
|
const packageName = path.extname(runtime.configFile) === ".go" && fs.existsSync(runtime.configFile) ? goPackageClause(fs.readFileSync(runtime.configFile, "utf8")).name : "main";
|
|
5492
5811
|
const source = path.extname(runtime.configFile) === ".json" ? generateJSONConfigSource(localFlags) : path.extname(runtime.configFile) === ".go" ? generateGoConfigSource(localFlags, packageName) : generateShipdConfigSource(localFlags);
|
|
5493
5812
|
const preparedTypes = prepareTypegen(runtime, localFlags);
|
|
@@ -5495,6 +5814,7 @@ function registerPullCommand(program) {
|
|
|
5495
5814
|
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
5496
5815
|
fs.writeFileSync(outPath, source);
|
|
5497
5816
|
const types = writeTypegen(preparedTypes);
|
|
5817
|
+
writeSyncState(runtime, projectId, environmentId, localFlags);
|
|
5498
5818
|
printResult(runtime, {
|
|
5499
5819
|
written: outPath,
|
|
5500
5820
|
flagCount: localFlags.length,
|
|
@@ -5536,11 +5856,13 @@ function registerPushCommand(program) {
|
|
|
5536
5856
|
force,
|
|
5537
5857
|
adopt
|
|
5538
5858
|
}).catch(mapApiError);
|
|
5859
|
+
if (!force && localFlags.some((f) => f.targeting !== void 0)) assertNoRemoteTargetingChanges(readSyncState(runtime, projectId, environmentId), planned.changes);
|
|
5539
5860
|
const plan = buildSyncPlan(planned.changes);
|
|
5540
5861
|
const remoteOnly = planned.remoteOnly ?? [];
|
|
5541
5862
|
warnRemoteOnly(remoteOnly.map((flag) => flag.key), runtime.json);
|
|
5542
5863
|
if (!runtime.json) console.log(planIsEmpty(plan) ? "Nothing to push." : formatSyncPlan(plan));
|
|
5543
5864
|
if (!planHasDrift(plan)) {
|
|
5865
|
+
if (localFlags.some((f) => f.targeting !== void 0)) writeSyncState(runtime, projectId, environmentId, localFlags);
|
|
5544
5866
|
if (runtime.json) console.log(JSON.stringify({
|
|
5545
5867
|
plan,
|
|
5546
5868
|
remoteOnly
|
|
@@ -5564,16 +5886,20 @@ function registerPushCommand(program) {
|
|
|
5564
5886
|
const appliedPlan = buildSyncPlan(applied.changes);
|
|
5565
5887
|
const types = writeTypegen(preparedTypes);
|
|
5566
5888
|
const approvalRequests = applied.approvalRequests ?? [];
|
|
5889
|
+
const drafts = applied.drafts ?? [];
|
|
5890
|
+
if (approvalRequests.length === 0 && drafts.length === 0 && localFlags.some((f) => f.targeting !== void 0)) writeSyncState(runtime, projectId, environmentId, localFlags);
|
|
5567
5891
|
printResult(runtime, {
|
|
5568
5892
|
plan: appliedPlan,
|
|
5569
5893
|
remoteOnly,
|
|
5570
5894
|
forced: applied.forced === true,
|
|
5571
5895
|
approvalRequests,
|
|
5572
|
-
|
|
5896
|
+
drafts,
|
|
5897
|
+
outcome: approvalRequests.length > 0 ? "pending_approval" : drafts.length > 0 ? "draft" : "applied",
|
|
5573
5898
|
types
|
|
5574
5899
|
}, [
|
|
5575
|
-
applied.changes.length > 0 ? `
|
|
5900
|
+
applied.changes.length > 0 ? `Saved ${applied.changes.length} change(s).` : null,
|
|
5576
5901
|
approvalRequests.length > 0 ? `${approvalRequests.length} environment change(s) queued for approval.` : null,
|
|
5902
|
+
drafts.length > 0 ? `${drafts.length} targeting draft(s) ready to publish from the dashboard environment plan.` : null,
|
|
5577
5903
|
applied.forced ? "Forced through version conflicts (audited)." : null,
|
|
5578
5904
|
`Wrote types for ${types.flagCount} flag(s) to ${types.written}`
|
|
5579
5905
|
].filter(Boolean).join("\n"));
|