@authhero/kysely-adapter 12.18.2 → 12.19.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/kysely-adapter.cjs +2 -2
- package/dist/kysely-adapter.d.ts +4 -0
- package/dist/kysely-adapter.mjs +441 -365
- package/dist/types/migrate/migrations/2026-11-05T12:00:00_session_authentication.d.ts +4 -0
- package/dist/types/migrate/migrations/2026-11-05T13:00:00_authentication_methods_totp_last_step.d.ts +4 -0
- package/dist/types/migrate/migrations/index.d.ts +4 -0
- package/dist/types/src/authenticationMethods/consumeTotpStep.d.ts +3 -0
- package/dist/types/src/db.d.ts +4 -0
- package/dist/types/src/tenants/list.d.ts +2 -2
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/kysely-adapter.mjs
CHANGED
|
@@ -1377,15 +1377,15 @@ function rn(e) {
|
|
|
1377
1377
|
return async (t, n) => {
|
|
1378
1378
|
let i = await e.selectFrom("sessions").where("sessions.tenant_id", "=", t).where("sessions.id", "=", n).selectAll().executeTakeFirst();
|
|
1379
1379
|
if (!i) return null;
|
|
1380
|
-
let { tenant_id: a, device: o, clients: s,
|
|
1381
|
-
created_at_ts:
|
|
1382
|
-
updated_at_ts:
|
|
1383
|
-
expires_at_ts:
|
|
1384
|
-
idle_expires_at_ts:
|
|
1385
|
-
authenticated_at_ts:
|
|
1386
|
-
last_interaction_at_ts:
|
|
1387
|
-
used_at_ts:
|
|
1388
|
-
revoked_at_ts:
|
|
1380
|
+
let { tenant_id: a, device: o, clients: s, authentication: c, created_at_ts: l, updated_at_ts: u, expires_at_ts: d, idle_expires_at_ts: f, authenticated_at_ts: p, last_interaction_at_ts: m, used_at_ts: h, revoked_at_ts: g, ..._ } = i, v = r({
|
|
1381
|
+
created_at_ts: l,
|
|
1382
|
+
updated_at_ts: u,
|
|
1383
|
+
expires_at_ts: d,
|
|
1384
|
+
idle_expires_at_ts: f,
|
|
1385
|
+
authenticated_at_ts: p,
|
|
1386
|
+
last_interaction_at_ts: m,
|
|
1387
|
+
used_at_ts: h,
|
|
1388
|
+
revoked_at_ts: g
|
|
1389
1389
|
}, [
|
|
1390
1390
|
"created_at_ts",
|
|
1391
1391
|
"updated_at_ts",
|
|
@@ -1398,10 +1398,11 @@ function rn(e) {
|
|
|
1398
1398
|
"revoked_at_ts"
|
|
1399
1399
|
]);
|
|
1400
1400
|
return {
|
|
1401
|
-
...g,
|
|
1402
1401
|
..._,
|
|
1402
|
+
...v,
|
|
1403
1403
|
device: JSON.parse(o),
|
|
1404
|
-
clients: JSON.parse(s)
|
|
1404
|
+
clients: JSON.parse(s),
|
|
1405
|
+
...c ? { authentication: JSON.parse(c) } : {}
|
|
1405
1406
|
};
|
|
1406
1407
|
};
|
|
1407
1408
|
}
|
|
@@ -1415,25 +1416,26 @@ function an(e) {
|
|
|
1415
1416
|
updated_at: i,
|
|
1416
1417
|
authenticated_at: i,
|
|
1417
1418
|
last_interaction_at: i
|
|
1418
|
-
}, { expires_at: o, idle_expires_at: l, used_at: u, revoked_at: d, device: f, clients: p,
|
|
1419
|
+
}, { expires_at: o, idle_expires_at: l, used_at: u, revoked_at: d, device: f, clients: p, authentication: m, ...h } = n, g = s(o), _ = s(l), v = Math.max(g ?? 0, _ ?? 0);
|
|
1419
1420
|
return await e.transaction().execute(async (e) => {
|
|
1420
1421
|
await e.insertInto("sessions").values({
|
|
1421
|
-
...
|
|
1422
|
+
...h,
|
|
1422
1423
|
tenant_id: t,
|
|
1423
1424
|
created_at_ts: r,
|
|
1424
1425
|
updated_at_ts: r,
|
|
1425
1426
|
authenticated_at_ts: r,
|
|
1426
1427
|
last_interaction_at_ts: r,
|
|
1427
|
-
expires_at_ts:
|
|
1428
|
-
idle_expires_at_ts:
|
|
1428
|
+
expires_at_ts: g,
|
|
1429
|
+
idle_expires_at_ts: _,
|
|
1429
1430
|
used_at_ts: s(u),
|
|
1430
1431
|
revoked_at_ts: s(d),
|
|
1431
1432
|
device: JSON.stringify(f),
|
|
1432
|
-
clients: JSON.stringify(p)
|
|
1433
|
-
|
|
1434
|
-
|
|
1433
|
+
clients: JSON.stringify(p),
|
|
1434
|
+
authentication: m ? JSON.stringify(m) : null
|
|
1435
|
+
}).execute(), v > 0 && n.login_session_id && await e.updateTable("login_sessions").set({
|
|
1436
|
+
expires_at_ts: v,
|
|
1435
1437
|
updated_at_ts: r
|
|
1436
|
-
}).where("tenant_id", "=", t).where("id", "=", n.login_session_id).where("expires_at_ts", "<",
|
|
1438
|
+
}).where("tenant_id", "=", t).where("id", "=", n.login_session_id).where("expires_at_ts", "<", v).execute();
|
|
1437
1439
|
}), a;
|
|
1438
1440
|
};
|
|
1439
1441
|
}
|
|
@@ -1449,7 +1451,8 @@ function sn(e) {
|
|
|
1449
1451
|
let i = Date.now(), a = {
|
|
1450
1452
|
updated_at_ts: i,
|
|
1451
1453
|
device: r.device ? JSON.stringify(r.device) : void 0,
|
|
1452
|
-
clients: r.clients ? JSON.stringify(r.clients) : void 0
|
|
1454
|
+
clients: r.clients ? JSON.stringify(r.clients) : void 0,
|
|
1455
|
+
authentication: r.authentication ? JSON.stringify(r.authentication) : void 0
|
|
1453
1456
|
}, o, c;
|
|
1454
1457
|
r.expires_at !== void 0 && (o = s(r.expires_at), a.expires_at_ts = o), r.idle_expires_at !== void 0 && (c = s(r.idle_expires_at), a.idle_expires_at_ts = c), r.authenticated_at !== void 0 && (a.authenticated_at_ts = s(r.authenticated_at)), r.last_interaction_at !== void 0 && (a.last_interaction_at_ts = s(r.last_interaction_at)), r.used_at !== void 0 && (a.used_at_ts = s(r.used_at)), r.revoked_at !== void 0 && (a.revoked_at_ts = s(r.revoked_at)), r.user_id !== void 0 && (a.user_id = r.user_id), r.login_session_id !== void 0 && (a.login_session_id = r.login_session_id);
|
|
1455
1458
|
let l = await e.updateTable("sessions").set(a).where("tenant_id", "=", t).where("sessions.id", "=", n).executeTakeFirst(), u = Math.max(o ?? 0, c ?? 0);
|
|
@@ -1466,15 +1469,15 @@ function sn(e) {
|
|
|
1466
1469
|
//#endregion
|
|
1467
1470
|
//#region src/sessions/list.ts
|
|
1468
1471
|
function cn(e) {
|
|
1469
|
-
let { tenant_id: t, device: n, clients: i,
|
|
1470
|
-
created_at_ts:
|
|
1471
|
-
updated_at_ts:
|
|
1472
|
-
expires_at_ts:
|
|
1473
|
-
idle_expires_at_ts:
|
|
1474
|
-
authenticated_at_ts:
|
|
1475
|
-
last_interaction_at_ts:
|
|
1476
|
-
used_at_ts:
|
|
1477
|
-
revoked_at_ts:
|
|
1472
|
+
let { tenant_id: t, device: n, clients: i, authentication: a, created_at_ts: o, updated_at_ts: s, expires_at_ts: c, idle_expires_at_ts: l, authenticated_at_ts: u, last_interaction_at_ts: d, used_at_ts: f, revoked_at_ts: p, ...m } = e, h = r({
|
|
1473
|
+
created_at_ts: o,
|
|
1474
|
+
updated_at_ts: s,
|
|
1475
|
+
expires_at_ts: c,
|
|
1476
|
+
idle_expires_at_ts: l,
|
|
1477
|
+
authenticated_at_ts: u,
|
|
1478
|
+
last_interaction_at_ts: d,
|
|
1479
|
+
used_at_ts: f,
|
|
1480
|
+
revoked_at_ts: p
|
|
1478
1481
|
}, [
|
|
1479
1482
|
"created_at_ts",
|
|
1480
1483
|
"updated_at_ts",
|
|
@@ -1487,10 +1490,11 @@ function cn(e) {
|
|
|
1487
1490
|
"revoked_at_ts"
|
|
1488
1491
|
]);
|
|
1489
1492
|
return {
|
|
1490
|
-
...p,
|
|
1491
1493
|
...m,
|
|
1494
|
+
...h,
|
|
1492
1495
|
device: JSON.parse(n),
|
|
1493
|
-
clients: JSON.parse(i)
|
|
1496
|
+
clients: JSON.parse(i),
|
|
1497
|
+
...a ? { authentication: JSON.parse(a) } : {}
|
|
1494
1498
|
};
|
|
1495
1499
|
}
|
|
1496
1500
|
function ln(e) {
|
|
@@ -5409,6 +5413,7 @@ function Eo(e) {
|
|
|
5409
5413
|
type: n.type,
|
|
5410
5414
|
phone_number: n.phone_number,
|
|
5411
5415
|
totp_secret: n.totp_secret,
|
|
5416
|
+
totp_last_step: n.totp_last_step,
|
|
5412
5417
|
credential_id: n.credential_id,
|
|
5413
5418
|
public_key: n.public_key,
|
|
5414
5419
|
sign_count: n.sign_count,
|
|
@@ -5424,6 +5429,7 @@ function Eo(e) {
|
|
|
5424
5429
|
type: n.type,
|
|
5425
5430
|
phone_number: n.phone_number,
|
|
5426
5431
|
totp_secret: n.totp_secret,
|
|
5432
|
+
totp_last_step: n.totp_last_step,
|
|
5427
5433
|
credential_id: n.credential_id,
|
|
5428
5434
|
public_key: n.public_key,
|
|
5429
5435
|
sign_count: n.sign_count,
|
|
@@ -5447,6 +5453,7 @@ function Do(e) {
|
|
|
5447
5453
|
type: r.type,
|
|
5448
5454
|
phone_number: r.phone_number ?? void 0,
|
|
5449
5455
|
totp_secret: r.totp_secret ?? void 0,
|
|
5456
|
+
totp_last_step: r.totp_last_step ?? void 0,
|
|
5450
5457
|
credential_id: r.credential_id ?? void 0,
|
|
5451
5458
|
public_key: r.public_key ?? void 0,
|
|
5452
5459
|
sign_count: r.sign_count ?? void 0,
|
|
@@ -5470,6 +5477,7 @@ function Oo(e) {
|
|
|
5470
5477
|
type: r.type,
|
|
5471
5478
|
phone_number: r.phone_number ?? void 0,
|
|
5472
5479
|
totp_secret: r.totp_secret ?? void 0,
|
|
5480
|
+
totp_last_step: r.totp_last_step ?? void 0,
|
|
5473
5481
|
credential_id: r.credential_id ?? void 0,
|
|
5474
5482
|
public_key: r.public_key ?? void 0,
|
|
5475
5483
|
sign_count: r.sign_count ?? void 0,
|
|
@@ -5491,6 +5499,7 @@ function ko(e) {
|
|
|
5491
5499
|
type: e.type,
|
|
5492
5500
|
phone_number: e.phone_number ?? void 0,
|
|
5493
5501
|
totp_secret: e.totp_secret ?? void 0,
|
|
5502
|
+
totp_last_step: e.totp_last_step ?? void 0,
|
|
5494
5503
|
credential_id: e.credential_id ?? void 0,
|
|
5495
5504
|
public_key: e.public_key ?? void 0,
|
|
5496
5505
|
sign_count: e.sign_count ?? void 0,
|
|
@@ -5519,20 +5528,29 @@ function jo(e) {
|
|
|
5519
5528
|
return async (t, n) => (await e.deleteFrom("authentication_methods").where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", n).executeTakeFirst()).numDeletedRows > 0;
|
|
5520
5529
|
}
|
|
5521
5530
|
//#endregion
|
|
5522
|
-
//#region src/authenticationMethods/
|
|
5531
|
+
//#region src/authenticationMethods/consumeTotpStep.ts
|
|
5523
5532
|
function Mo(e) {
|
|
5533
|
+
return async (t, n, r) => (await e.updateTable("authentication_methods").set({
|
|
5534
|
+
totp_last_step: r,
|
|
5535
|
+
updated_at_ts: Date.now()
|
|
5536
|
+
}).where("authentication_methods.tenant_id", "=", t).where("authentication_methods.id", "=", n).where((e) => e.or([e("authentication_methods.totp_last_step", "is", null), e("authentication_methods.totp_last_step", "<", r)])).executeTakeFirst()).numUpdatedRows > 0;
|
|
5537
|
+
}
|
|
5538
|
+
//#endregion
|
|
5539
|
+
//#region src/authenticationMethods/index.ts
|
|
5540
|
+
function No(e) {
|
|
5524
5541
|
return {
|
|
5525
5542
|
create: Eo(e),
|
|
5526
5543
|
get: Do(e),
|
|
5527
5544
|
getByCredentialId: Oo(e),
|
|
5528
5545
|
list: ko(e),
|
|
5529
5546
|
update: Ao(e),
|
|
5530
|
-
remove: jo(e)
|
|
5547
|
+
remove: jo(e),
|
|
5548
|
+
consumeTotpStep: Mo(e)
|
|
5531
5549
|
};
|
|
5532
5550
|
}
|
|
5533
5551
|
//#endregion
|
|
5534
5552
|
//#region src/outbox/getByIds.ts
|
|
5535
|
-
function
|
|
5553
|
+
function Po(e) {
|
|
5536
5554
|
return async (t) => t.length === 0 ? [] : (await e.selectFrom("outbox_events").selectAll().where("id", "in", t).execute()).map((e) => ({
|
|
5537
5555
|
...JSON.parse(e.payload),
|
|
5538
5556
|
id: e.id,
|
|
@@ -5545,7 +5563,7 @@ function No(e) {
|
|
|
5545
5563
|
}
|
|
5546
5564
|
//#endregion
|
|
5547
5565
|
//#region src/outbox/getUnprocessed.ts
|
|
5548
|
-
function
|
|
5566
|
+
function Fo(e) {
|
|
5549
5567
|
return async (t) => {
|
|
5550
5568
|
let n = (/* @__PURE__ */ new Date()).toISOString();
|
|
5551
5569
|
return (await e.selectFrom("outbox_events").selectAll().where("processed_at", "is", null).where((e) => e.or([e("next_retry_at", "is", null), e("next_retry_at", "<=", n)])).where((e) => e.or([e("claimed_by", "is", null), e("claim_expires_at", "<=", n)])).orderBy("created_at", "asc").orderBy("id", "asc").limit(t).execute()).map((e) => ({
|
|
@@ -5561,7 +5579,7 @@ function Po(e) {
|
|
|
5561
5579
|
}
|
|
5562
5580
|
//#endregion
|
|
5563
5581
|
//#region src/outbox/claimEvents.ts
|
|
5564
|
-
function
|
|
5582
|
+
function Io(e) {
|
|
5565
5583
|
return async (t, n, r) => {
|
|
5566
5584
|
if (t.length === 0) return [];
|
|
5567
5585
|
let i = (/* @__PURE__ */ new Date()).toISOString(), a = new Date(Date.now() + r).toISOString();
|
|
@@ -5573,7 +5591,7 @@ function Fo(e) {
|
|
|
5573
5591
|
}
|
|
5574
5592
|
//#endregion
|
|
5575
5593
|
//#region src/outbox/markProcessed.ts
|
|
5576
|
-
function
|
|
5594
|
+
function Lo(e) {
|
|
5577
5595
|
return async (t) => {
|
|
5578
5596
|
if (t.length === 0) return;
|
|
5579
5597
|
let n = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5582,7 +5600,7 @@ function Io(e) {
|
|
|
5582
5600
|
}
|
|
5583
5601
|
//#endregion
|
|
5584
5602
|
//#region src/outbox/markRetry.ts
|
|
5585
|
-
function
|
|
5603
|
+
function Ro(e) {
|
|
5586
5604
|
return async (t, n, r) => {
|
|
5587
5605
|
await e.updateTable("outbox_events").set({
|
|
5588
5606
|
error: n,
|
|
@@ -5595,7 +5613,7 @@ function Lo(e) {
|
|
|
5595
5613
|
}
|
|
5596
5614
|
//#endregion
|
|
5597
5615
|
//#region src/outbox/deadLetter.ts
|
|
5598
|
-
function
|
|
5616
|
+
function zo(e) {
|
|
5599
5617
|
return async (t, n) => {
|
|
5600
5618
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
5601
5619
|
await e.updateTable("outbox_events").set({
|
|
@@ -5607,7 +5625,7 @@ function Ro(e) {
|
|
|
5607
5625
|
}
|
|
5608
5626
|
//#endregion
|
|
5609
5627
|
//#region src/outbox/listFailed.ts
|
|
5610
|
-
function
|
|
5628
|
+
function Bo(e) {
|
|
5611
5629
|
let t;
|
|
5612
5630
|
try {
|
|
5613
5631
|
t = JSON.parse(e.payload);
|
|
@@ -5626,7 +5644,7 @@ function zo(e) {
|
|
|
5626
5644
|
final_error: e.final_error
|
|
5627
5645
|
}];
|
|
5628
5646
|
}
|
|
5629
|
-
function
|
|
5647
|
+
function Vo(e) {
|
|
5630
5648
|
return async (t, n = {}) => {
|
|
5631
5649
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1 } = n;
|
|
5632
5650
|
if (O(n)) {
|
|
@@ -5634,7 +5652,7 @@ function Bo(e) {
|
|
|
5634
5652
|
sortColumn: "dead_lettered_at",
|
|
5635
5653
|
sortOrder: "desc",
|
|
5636
5654
|
idColumn: "id"
|
|
5637
|
-
}), o = r.flatMap(
|
|
5655
|
+
}), o = r.flatMap(Bo);
|
|
5638
5656
|
return {
|
|
5639
5657
|
events: o,
|
|
5640
5658
|
start: 0,
|
|
@@ -5643,7 +5661,7 @@ function Bo(e) {
|
|
|
5643
5661
|
next: a
|
|
5644
5662
|
};
|
|
5645
5663
|
}
|
|
5646
|
-
let o = (await e.selectFrom("outbox_events").selectAll().where("tenant_id", "=", t).where("dead_lettered_at", "is not", null).orderBy("dead_lettered_at", "desc").orderBy("id", "asc").offset(r * i).limit(i).execute()).flatMap(
|
|
5664
|
+
let o = (await e.selectFrom("outbox_events").selectAll().where("tenant_id", "=", t).where("dead_lettered_at", "is not", null).orderBy("dead_lettered_at", "desc").orderBy("id", "asc").offset(r * i).limit(i).execute()).flatMap(Bo), s = o.length;
|
|
5647
5665
|
if (a) {
|
|
5648
5666
|
let [n] = await e.selectFrom("outbox_events").select((e) => e.fn.countAll().as("total")).where("tenant_id", "=", t).where("dead_lettered_at", "is not", null).execute();
|
|
5649
5667
|
s = Number(n?.total ?? o.length);
|
|
@@ -5658,7 +5676,7 @@ function Bo(e) {
|
|
|
5658
5676
|
}
|
|
5659
5677
|
//#endregion
|
|
5660
5678
|
//#region src/outbox/replay.ts
|
|
5661
|
-
function
|
|
5679
|
+
function Ho(e) {
|
|
5662
5680
|
return async (t, n) => {
|
|
5663
5681
|
let r = await e.updateTable("outbox_events").set({
|
|
5664
5682
|
processed_at: null,
|
|
@@ -5675,7 +5693,7 @@ function Vo(e) {
|
|
|
5675
5693
|
}
|
|
5676
5694
|
//#endregion
|
|
5677
5695
|
//#region src/outbox/discard.ts
|
|
5678
|
-
function
|
|
5696
|
+
function Uo(e) {
|
|
5679
5697
|
return async (t, n) => {
|
|
5680
5698
|
let r = await e.deleteFrom("outbox_events").where("id", "=", t).where("tenant_id", "=", n).where("dead_lettered_at", "is not", null).executeTakeFirst();
|
|
5681
5699
|
return Number(r.numDeletedRows) > 0;
|
|
@@ -5683,7 +5701,7 @@ function Ho(e) {
|
|
|
5683
5701
|
}
|
|
5684
5702
|
//#endregion
|
|
5685
5703
|
//#region src/outbox/cleanup.ts
|
|
5686
|
-
function
|
|
5704
|
+
function Wo(e) {
|
|
5687
5705
|
return async (t) => {
|
|
5688
5706
|
let n = await e.deleteFrom("outbox_events").where("processed_at", "is not", null).where("processed_at", "<", t).executeTakeFirst();
|
|
5689
5707
|
return Number(n.numDeletedRows);
|
|
@@ -5691,24 +5709,24 @@ function Uo(e) {
|
|
|
5691
5709
|
}
|
|
5692
5710
|
//#endregion
|
|
5693
5711
|
//#region src/outbox/index.ts
|
|
5694
|
-
function
|
|
5712
|
+
function Go(e) {
|
|
5695
5713
|
return {
|
|
5696
5714
|
create: ut(e),
|
|
5697
|
-
getByIds:
|
|
5698
|
-
getUnprocessed:
|
|
5699
|
-
claimEvents:
|
|
5700
|
-
markProcessed:
|
|
5701
|
-
markRetry:
|
|
5702
|
-
deadLetter:
|
|
5703
|
-
listFailed:
|
|
5704
|
-
replay:
|
|
5705
|
-
discard:
|
|
5706
|
-
cleanup:
|
|
5715
|
+
getByIds: Po(e),
|
|
5716
|
+
getUnprocessed: Fo(e),
|
|
5717
|
+
claimEvents: Io(e),
|
|
5718
|
+
markProcessed: Lo(e),
|
|
5719
|
+
markRetry: Ro(e),
|
|
5720
|
+
deadLetter: zo(e),
|
|
5721
|
+
listFailed: Vo(e),
|
|
5722
|
+
replay: Ho(e),
|
|
5723
|
+
discard: Uo(e),
|
|
5724
|
+
cleanup: Wo(e)
|
|
5707
5725
|
};
|
|
5708
5726
|
}
|
|
5709
5727
|
//#endregion
|
|
5710
5728
|
//#region src/log-streams/index.ts
|
|
5711
|
-
function
|
|
5729
|
+
function Ko(e) {
|
|
5712
5730
|
return {
|
|
5713
5731
|
id: e.id,
|
|
5714
5732
|
name: e.name,
|
|
@@ -5721,7 +5739,7 @@ function Go(e) {
|
|
|
5721
5739
|
updated_at: e.updated_at
|
|
5722
5740
|
};
|
|
5723
5741
|
}
|
|
5724
|
-
function
|
|
5742
|
+
function qo(e) {
|
|
5725
5743
|
return {
|
|
5726
5744
|
async create(n, r, i) {
|
|
5727
5745
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
@@ -5736,14 +5754,14 @@ function Ko(e) {
|
|
|
5736
5754
|
created_at: a?.created_at ?? o,
|
|
5737
5755
|
updated_at: a?.updated_at ?? o
|
|
5738
5756
|
};
|
|
5739
|
-
return await e.insertInto("log_streams").values(s).execute(),
|
|
5757
|
+
return await e.insertInto("log_streams").values(s).execute(), Ko(s);
|
|
5740
5758
|
},
|
|
5741
5759
|
async get(t, n) {
|
|
5742
5760
|
let r = await e.selectFrom("log_streams").where("tenant_id", "=", t).where("id", "=", n).selectAll().executeTakeFirst();
|
|
5743
|
-
return r ?
|
|
5761
|
+
return r ? Ko(r) : null;
|
|
5744
5762
|
},
|
|
5745
5763
|
async list(t) {
|
|
5746
|
-
return (await e.selectFrom("log_streams").where("tenant_id", "=", t).selectAll().execute()).map(
|
|
5764
|
+
return (await e.selectFrom("log_streams").where("tenant_id", "=", t).selectAll().execute()).map(Ko);
|
|
5747
5765
|
},
|
|
5748
5766
|
async update(t, n, r) {
|
|
5749
5767
|
let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -5756,7 +5774,7 @@ function Ko(e) {
|
|
|
5756
5774
|
}
|
|
5757
5775
|
//#endregion
|
|
5758
5776
|
//#region src/migrationSources/index.ts
|
|
5759
|
-
function
|
|
5777
|
+
function Jo(e) {
|
|
5760
5778
|
return {
|
|
5761
5779
|
id: e.id,
|
|
5762
5780
|
name: e.name,
|
|
@@ -5768,7 +5786,7 @@ function qo(e) {
|
|
|
5768
5786
|
updated_at: e.updated_at
|
|
5769
5787
|
};
|
|
5770
5788
|
}
|
|
5771
|
-
function
|
|
5789
|
+
function Yo(e) {
|
|
5772
5790
|
return {
|
|
5773
5791
|
async create(n, r, i) {
|
|
5774
5792
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = a?.id ?? r.id ?? `mig_${t()}`, c = r.enabled ?? !0, l = {
|
|
@@ -5782,14 +5800,14 @@ function Jo(e) {
|
|
|
5782
5800
|
created_at: a?.created_at ?? o,
|
|
5783
5801
|
updated_at: a?.updated_at ?? o
|
|
5784
5802
|
};
|
|
5785
|
-
return await e.insertInto("migration_sources").values(l).execute(),
|
|
5803
|
+
return await e.insertInto("migration_sources").values(l).execute(), Jo(l);
|
|
5786
5804
|
},
|
|
5787
5805
|
async get(t, n) {
|
|
5788
5806
|
let r = await e.selectFrom("migration_sources").where("tenant_id", "=", t).where("id", "=", n).selectAll().executeTakeFirst();
|
|
5789
|
-
return r ?
|
|
5807
|
+
return r ? Jo(r) : null;
|
|
5790
5808
|
},
|
|
5791
5809
|
async list(t) {
|
|
5792
|
-
return (await e.selectFrom("migration_sources").where("tenant_id", "=", t).selectAll().execute()).map(
|
|
5810
|
+
return (await e.selectFrom("migration_sources").where("tenant_id", "=", t).selectAll().execute()).map(Jo);
|
|
5793
5811
|
},
|
|
5794
5812
|
async update(t, n, r) {
|
|
5795
5813
|
let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -5802,19 +5820,19 @@ function Jo(e) {
|
|
|
5802
5820
|
}
|
|
5803
5821
|
//#endregion
|
|
5804
5822
|
//#region src/proxyRoutes/serialize.ts
|
|
5805
|
-
function
|
|
5823
|
+
function Xo(e) {
|
|
5806
5824
|
return {
|
|
5807
5825
|
id: e.id,
|
|
5808
5826
|
tenant_id: e.tenant_id,
|
|
5809
5827
|
custom_domain_id: e.custom_domain_id,
|
|
5810
5828
|
priority: e.priority,
|
|
5811
|
-
match:
|
|
5812
|
-
handlers:
|
|
5829
|
+
match: Zo(e.match),
|
|
5830
|
+
handlers: Qo(e.handlers),
|
|
5813
5831
|
created_at: e.created_at,
|
|
5814
5832
|
updated_at: e.updated_at
|
|
5815
5833
|
};
|
|
5816
5834
|
}
|
|
5817
|
-
function
|
|
5835
|
+
function Zo(e) {
|
|
5818
5836
|
if (!e) return { path: "/*" };
|
|
5819
5837
|
try {
|
|
5820
5838
|
let t = JSON.parse(e), n = fe.safeParse(t);
|
|
@@ -5822,7 +5840,7 @@ function Xo(e) {
|
|
|
5822
5840
|
} catch {}
|
|
5823
5841
|
return { path: "/*" };
|
|
5824
5842
|
}
|
|
5825
|
-
function
|
|
5843
|
+
function Qo(e) {
|
|
5826
5844
|
if (!e) return [];
|
|
5827
5845
|
try {
|
|
5828
5846
|
let t = JSON.parse(e);
|
|
@@ -5839,7 +5857,7 @@ function Zo(e) {
|
|
|
5839
5857
|
}
|
|
5840
5858
|
//#endregion
|
|
5841
5859
|
//#region src/proxyRoutes/adapter.ts
|
|
5842
|
-
function
|
|
5860
|
+
function $o(e) {
|
|
5843
5861
|
return {
|
|
5844
5862
|
async create(n, r, i) {
|
|
5845
5863
|
let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = {
|
|
@@ -5865,14 +5883,14 @@ function Qo(e) {
|
|
|
5865
5883
|
},
|
|
5866
5884
|
async get(t, n) {
|
|
5867
5885
|
let r = await e.selectFrom("proxy_routes").where("tenant_id", "=", t).where("id", "=", n).selectAll().executeTakeFirst();
|
|
5868
|
-
return r ?
|
|
5886
|
+
return r ? Xo(r) : null;
|
|
5869
5887
|
},
|
|
5870
5888
|
async list(t, n = {}) {
|
|
5871
5889
|
let r = n.page ?? 0, i = n.per_page ?? 50, a = e.selectFrom("proxy_routes").where("tenant_id", "=", t);
|
|
5872
5890
|
n.custom_domain_id && (a = a.where("custom_domain_id", "=", n.custom_domain_id));
|
|
5873
5891
|
let o = await a.selectAll().orderBy("priority", "asc").orderBy("created_at", "asc").offset(r * i).limit(i).execute();
|
|
5874
5892
|
return {
|
|
5875
|
-
proxy_routes: o.map(
|
|
5893
|
+
proxy_routes: o.map(Xo),
|
|
5876
5894
|
start: r * i,
|
|
5877
5895
|
limit: i,
|
|
5878
5896
|
length: o.length
|
|
@@ -5892,7 +5910,7 @@ function Qo(e) {
|
|
|
5892
5910
|
}
|
|
5893
5911
|
//#endregion
|
|
5894
5912
|
//#region src/proxyRoutes/resolve-host.ts
|
|
5895
|
-
async function
|
|
5913
|
+
async function es(e, t) {
|
|
5896
5914
|
let n = t.indexOf(":"), r = n === -1 ? t : t.slice(0, n), i = (r.endsWith(".") ? r.slice(0, -1) : r).toLowerCase(), a = await e.selectFrom("custom_domains").where("domain", "=", i).select([
|
|
5897
5915
|
"custom_domain_id",
|
|
5898
5916
|
"tenant_id",
|
|
@@ -5904,20 +5922,20 @@ async function $o(e, t) {
|
|
|
5904
5922
|
tenant_id: a.tenant_id,
|
|
5905
5923
|
custom_domain_id: a.custom_domain_id,
|
|
5906
5924
|
domain: a.domain,
|
|
5907
|
-
routes: o.map(
|
|
5925
|
+
routes: o.map(Xo)
|
|
5908
5926
|
};
|
|
5909
5927
|
}
|
|
5910
5928
|
//#endregion
|
|
5911
5929
|
//#region src/proxyRoutes/index.ts
|
|
5912
|
-
function
|
|
5930
|
+
function ts(e) {
|
|
5913
5931
|
return {
|
|
5914
|
-
proxyRoutes:
|
|
5915
|
-
resolveHost: (t) =>
|
|
5932
|
+
proxyRoutes: $o(e),
|
|
5933
|
+
resolveHost: (t) => es(e, t)
|
|
5916
5934
|
};
|
|
5917
5935
|
}
|
|
5918
5936
|
//#endregion
|
|
5919
5937
|
//#region src/tokenExchangeProfiles/serialize.ts
|
|
5920
|
-
function
|
|
5938
|
+
function ns(e) {
|
|
5921
5939
|
let t = {
|
|
5922
5940
|
id: e.id,
|
|
5923
5941
|
name: e.name,
|
|
@@ -5927,10 +5945,10 @@ function ts(e) {
|
|
|
5927
5945
|
updated_at: e.updated_at
|
|
5928
5946
|
};
|
|
5929
5947
|
e.action_id && (t.action_id = e.action_id);
|
|
5930
|
-
let n =
|
|
5948
|
+
let n = rs(e.jwt_verification);
|
|
5931
5949
|
return n && (t.jwt_verification = n), t;
|
|
5932
5950
|
}
|
|
5933
|
-
function
|
|
5951
|
+
function rs(e) {
|
|
5934
5952
|
if (e) try {
|
|
5935
5953
|
let t = ke.safeParse(JSON.parse(e));
|
|
5936
5954
|
return t.success ? t.data : void 0;
|
|
@@ -5940,12 +5958,12 @@ function ns(e) {
|
|
|
5940
5958
|
}
|
|
5941
5959
|
//#endregion
|
|
5942
5960
|
//#region src/tokenExchangeProfiles/adapter.ts
|
|
5943
|
-
var
|
|
5944
|
-
function
|
|
5961
|
+
var is = e("0123456789abcdefghijklmnopqrstuvwxyz", 17);
|
|
5962
|
+
function as(e) {
|
|
5945
5963
|
return {
|
|
5946
5964
|
async create(t, n, r) {
|
|
5947
5965
|
let i = r?.importMetadata, a = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
5948
|
-
id: i?.id ?? `tep_${
|
|
5966
|
+
id: i?.id ?? `tep_${is()}`,
|
|
5949
5967
|
tenant_id: t,
|
|
5950
5968
|
name: n.name,
|
|
5951
5969
|
subject_token_type: n.subject_token_type,
|
|
@@ -5955,14 +5973,14 @@ function is(e) {
|
|
|
5955
5973
|
created_at: i?.created_at ?? a,
|
|
5956
5974
|
updated_at: i?.updated_at ?? a
|
|
5957
5975
|
};
|
|
5958
|
-
return await e.insertInto("token_exchange_profiles").values(o).execute(),
|
|
5976
|
+
return await e.insertInto("token_exchange_profiles").values(o).execute(), ns(o);
|
|
5959
5977
|
},
|
|
5960
5978
|
async get(t, n) {
|
|
5961
5979
|
let r = await e.selectFrom("token_exchange_profiles").where("tenant_id", "=", t).where("id", "=", n).selectAll().executeTakeFirst();
|
|
5962
|
-
return r ?
|
|
5980
|
+
return r ? ns(r) : null;
|
|
5963
5981
|
},
|
|
5964
5982
|
async list(t) {
|
|
5965
|
-
return (await e.selectFrom("token_exchange_profiles").where("tenant_id", "=", t).selectAll().orderBy("created_at", "asc").orderBy("id", "asc").execute()).map(
|
|
5983
|
+
return (await e.selectFrom("token_exchange_profiles").where("tenant_id", "=", t).selectAll().orderBy("created_at", "asc").orderBy("id", "asc").execute()).map(ns);
|
|
5966
5984
|
},
|
|
5967
5985
|
async update(t, n, r) {
|
|
5968
5986
|
let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -5978,7 +5996,7 @@ function is(e) {
|
|
|
5978
5996
|
}
|
|
5979
5997
|
//#endregion
|
|
5980
5998
|
//#region src/scim/adapter.ts
|
|
5981
|
-
function
|
|
5999
|
+
function os(e) {
|
|
5982
6000
|
if (!e) return [];
|
|
5983
6001
|
try {
|
|
5984
6002
|
let t = JSON.parse(e);
|
|
@@ -5993,7 +6011,7 @@ function as(e) {
|
|
|
5993
6011
|
return [];
|
|
5994
6012
|
}
|
|
5995
6013
|
}
|
|
5996
|
-
function
|
|
6014
|
+
function ss(e) {
|
|
5997
6015
|
if (!e) return [];
|
|
5998
6016
|
try {
|
|
5999
6017
|
let t = JSON.parse(e);
|
|
@@ -6002,16 +6020,16 @@ function os(e) {
|
|
|
6002
6020
|
return [];
|
|
6003
6021
|
}
|
|
6004
6022
|
}
|
|
6005
|
-
function
|
|
6023
|
+
function cs(e) {
|
|
6006
6024
|
return {
|
|
6007
6025
|
connection_id: e.connection_id,
|
|
6008
6026
|
user_id_attribute: e.user_id_attribute,
|
|
6009
|
-
mapping:
|
|
6027
|
+
mapping: os(e.mapping),
|
|
6010
6028
|
created_at: e.created_at,
|
|
6011
6029
|
updated_at: e.updated_at
|
|
6012
6030
|
};
|
|
6013
6031
|
}
|
|
6014
|
-
function
|
|
6032
|
+
function ls(e) {
|
|
6015
6033
|
return {
|
|
6016
6034
|
async create(t, n) {
|
|
6017
6035
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -6032,7 +6050,7 @@ function cs(e) {
|
|
|
6032
6050
|
},
|
|
6033
6051
|
async get(t, n) {
|
|
6034
6052
|
let r = await e.selectFrom("scim_configurations").where("tenant_id", "=", t).where("connection_id", "=", n).selectAll().executeTakeFirst();
|
|
6035
|
-
return r ?
|
|
6053
|
+
return r ? cs(r) : null;
|
|
6036
6054
|
},
|
|
6037
6055
|
async update(t, n, r) {
|
|
6038
6056
|
let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -6046,18 +6064,18 @@ function cs(e) {
|
|
|
6046
6064
|
}
|
|
6047
6065
|
};
|
|
6048
6066
|
}
|
|
6049
|
-
function
|
|
6067
|
+
function us(e) {
|
|
6050
6068
|
return {
|
|
6051
6069
|
token_id: e.token_id,
|
|
6052
6070
|
connection_id: e.connection_id,
|
|
6053
6071
|
token_hash: e.token_hash,
|
|
6054
|
-
scopes:
|
|
6072
|
+
scopes: ss(e.scopes),
|
|
6055
6073
|
valid_until: e.valid_until ?? void 0,
|
|
6056
6074
|
created_at: e.created_at,
|
|
6057
6075
|
last_used_at: e.last_used_at ?? void 0
|
|
6058
6076
|
};
|
|
6059
6077
|
}
|
|
6060
|
-
function
|
|
6078
|
+
function ds(e) {
|
|
6061
6079
|
return {
|
|
6062
6080
|
async create(t, n) {
|
|
6063
6081
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -6081,14 +6099,14 @@ function us(e) {
|
|
|
6081
6099
|
},
|
|
6082
6100
|
async get(t, n) {
|
|
6083
6101
|
let r = await e.selectFrom("scim_tokens").where("tenant_id", "=", t).where("token_id", "=", n).selectAll().executeTakeFirst();
|
|
6084
|
-
return r ?
|
|
6102
|
+
return r ? us(r) : null;
|
|
6085
6103
|
},
|
|
6086
6104
|
async getByHash(t, n) {
|
|
6087
6105
|
let r = await e.selectFrom("scim_tokens").where("tenant_id", "=", t).where("token_hash", "=", n).selectAll().executeTakeFirst();
|
|
6088
|
-
return r ?
|
|
6106
|
+
return r ? us(r) : null;
|
|
6089
6107
|
},
|
|
6090
6108
|
async listByConnection(t, n) {
|
|
6091
|
-
return (await e.selectFrom("scim_tokens").where("tenant_id", "=", t).where("connection_id", "=", n).selectAll().execute()).map(
|
|
6109
|
+
return (await e.selectFrom("scim_tokens").where("tenant_id", "=", t).where("connection_id", "=", n).selectAll().execute()).map(us);
|
|
6092
6110
|
},
|
|
6093
6111
|
async markUsed(t, n, r) {
|
|
6094
6112
|
let i = await e.updateTable("scim_tokens").where("tenant_id", "=", t).where("token_id", "=", n).set({ last_used_at: r }).executeTakeFirst();
|
|
@@ -6100,7 +6118,7 @@ function us(e) {
|
|
|
6100
6118
|
}
|
|
6101
6119
|
};
|
|
6102
6120
|
}
|
|
6103
|
-
function
|
|
6121
|
+
function fs(e) {
|
|
6104
6122
|
return {
|
|
6105
6123
|
connection_id: e.connection_id,
|
|
6106
6124
|
external_id: e.external_id,
|
|
@@ -6108,7 +6126,7 @@ function ds(e) {
|
|
|
6108
6126
|
created_at: e.created_at
|
|
6109
6127
|
};
|
|
6110
6128
|
}
|
|
6111
|
-
function
|
|
6129
|
+
function ps(e) {
|
|
6112
6130
|
return {
|
|
6113
6131
|
async create(t, n) {
|
|
6114
6132
|
let r = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -6127,11 +6145,11 @@ function fs(e) {
|
|
|
6127
6145
|
},
|
|
6128
6146
|
async getByExternalId(t, n, r) {
|
|
6129
6147
|
let i = await e.selectFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("external_id", "=", r).selectAll().executeTakeFirst();
|
|
6130
|
-
return i ?
|
|
6148
|
+
return i ? fs(i) : null;
|
|
6131
6149
|
},
|
|
6132
6150
|
async getByUserId(t, n, r) {
|
|
6133
6151
|
let i = await e.selectFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("user_id", "=", r).selectAll().executeTakeFirst();
|
|
6134
|
-
return i ?
|
|
6152
|
+
return i ? fs(i) : null;
|
|
6135
6153
|
},
|
|
6136
6154
|
async remove(t, n, r) {
|
|
6137
6155
|
let i = await e.deleteFrom("scim_external_ids").where("tenant_id", "=", t).where("connection_id", "=", n).where("user_id", "=", r).executeTakeFirst();
|
|
@@ -6141,7 +6159,7 @@ function fs(e) {
|
|
|
6141
6159
|
}
|
|
6142
6160
|
//#endregion
|
|
6143
6161
|
//#region src/tenantOperations/index.ts
|
|
6144
|
-
function
|
|
6162
|
+
function ms(e) {
|
|
6145
6163
|
if (!e) return null;
|
|
6146
6164
|
try {
|
|
6147
6165
|
let t = JSON.parse(e);
|
|
@@ -6163,8 +6181,8 @@ function G(e) {
|
|
|
6163
6181
|
target_database_version: e.target_database_version,
|
|
6164
6182
|
error: e.error,
|
|
6165
6183
|
initiated_by: e.initiated_by,
|
|
6166
|
-
input:
|
|
6167
|
-
result:
|
|
6184
|
+
input: ms(e.input),
|
|
6185
|
+
result: ms(e.result),
|
|
6168
6186
|
claimed_by: e.claimed_by,
|
|
6169
6187
|
claim_expires_at: e.claim_expires_at,
|
|
6170
6188
|
created_at: e.created_at,
|
|
@@ -6172,7 +6190,7 @@ function G(e) {
|
|
|
6172
6190
|
finished_at: e.finished_at
|
|
6173
6191
|
});
|
|
6174
6192
|
}
|
|
6175
|
-
function
|
|
6193
|
+
function hs(e) {
|
|
6176
6194
|
return {
|
|
6177
6195
|
async create(n) {
|
|
6178
6196
|
let r = Te.parse(n), i = (/* @__PURE__ */ new Date()).toISOString(), a = {
|
|
@@ -6255,27 +6273,27 @@ function ms(e) {
|
|
|
6255
6273
|
}
|
|
6256
6274
|
//#endregion
|
|
6257
6275
|
//#region src/utils/monotonic-id.ts
|
|
6258
|
-
var
|
|
6259
|
-
function
|
|
6276
|
+
var gs = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", _s = 32, vs = 10, ys = 4, bs = 10;
|
|
6277
|
+
function xs(e, t) {
|
|
6260
6278
|
let n = "";
|
|
6261
|
-
for (let r = t; r > 0; r--) n =
|
|
6279
|
+
for (let r = t; r > 0; r--) n = gs.charAt(e % _s) + n, e = Math.floor(e / _s);
|
|
6262
6280
|
return n;
|
|
6263
6281
|
}
|
|
6264
|
-
function
|
|
6265
|
-
let e = new Uint8Array(
|
|
6282
|
+
function Ss() {
|
|
6283
|
+
let e = new Uint8Array(bs);
|
|
6266
6284
|
crypto.getRandomValues(e);
|
|
6267
6285
|
let t = "";
|
|
6268
|
-
for (let n = 0; n <
|
|
6286
|
+
for (let n = 0; n < bs; n++) t += gs.charAt(e[n] % _s);
|
|
6269
6287
|
return t;
|
|
6270
6288
|
}
|
|
6271
|
-
var
|
|
6272
|
-
function
|
|
6289
|
+
var Cs = 0, ws = 0;
|
|
6290
|
+
function Ts() {
|
|
6273
6291
|
let e = Date.now();
|
|
6274
|
-
return e ===
|
|
6292
|
+
return e === Cs ? ws++ : (Cs = e, ws = 0), xs(e, vs) + xs(ws, ys) + Ss();
|
|
6275
6293
|
}
|
|
6276
6294
|
//#endregion
|
|
6277
6295
|
//#region src/tenantOperationEvents/index.ts
|
|
6278
|
-
function
|
|
6296
|
+
function Es(e) {
|
|
6279
6297
|
if (!e) return null;
|
|
6280
6298
|
try {
|
|
6281
6299
|
let t = JSON.parse(e);
|
|
@@ -6283,22 +6301,22 @@ function Ts(e) {
|
|
|
6283
6301
|
} catch {}
|
|
6284
6302
|
return null;
|
|
6285
6303
|
}
|
|
6286
|
-
function
|
|
6304
|
+
function Ds(e) {
|
|
6287
6305
|
return we.parse({
|
|
6288
6306
|
id: e.id,
|
|
6289
6307
|
operation_id: e.operation_id,
|
|
6290
6308
|
step: e.step,
|
|
6291
6309
|
outcome: e.outcome,
|
|
6292
|
-
detail:
|
|
6310
|
+
detail: Es(e.detail),
|
|
6293
6311
|
attempt: e.attempt,
|
|
6294
6312
|
created_at: e.created_at
|
|
6295
6313
|
});
|
|
6296
6314
|
}
|
|
6297
|
-
function
|
|
6315
|
+
function Os(e) {
|
|
6298
6316
|
return {
|
|
6299
6317
|
async create(t) {
|
|
6300
6318
|
let n = Ce.parse(t), r = {
|
|
6301
|
-
id: `evt_${
|
|
6319
|
+
id: `evt_${Ts()}`,
|
|
6302
6320
|
operation_id: n.operation_id,
|
|
6303
6321
|
step: n.step,
|
|
6304
6322
|
outcome: n.outcome,
|
|
@@ -6306,12 +6324,12 @@ function Ds(e) {
|
|
|
6306
6324
|
attempt: n.attempt,
|
|
6307
6325
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
6308
6326
|
};
|
|
6309
|
-
return await e.insertInto("tenant_operation_events").values(r).execute(),
|
|
6327
|
+
return await e.insertInto("tenant_operation_events").values(r).execute(), Ds(r);
|
|
6310
6328
|
},
|
|
6311
6329
|
async listByOperation(t, n = {}) {
|
|
6312
6330
|
let r = n.page ?? 0, i = n.per_page ?? 100, a = await e.selectFrom("tenant_operation_events").where("operation_id", "=", t).selectAll().orderBy("created_at", "asc").orderBy("id", "asc").offset(r * i).limit(i).execute();
|
|
6313
6331
|
return {
|
|
6314
|
-
events: a.map(
|
|
6332
|
+
events: a.map(Ds),
|
|
6315
6333
|
start: r * i,
|
|
6316
6334
|
limit: i,
|
|
6317
6335
|
length: a.length
|
|
@@ -6321,16 +6339,16 @@ function Ds(e) {
|
|
|
6321
6339
|
}
|
|
6322
6340
|
//#endregion
|
|
6323
6341
|
//#region src/tenantOperationRows/index.ts
|
|
6324
|
-
var
|
|
6325
|
-
function
|
|
6342
|
+
var ks = 50;
|
|
6343
|
+
function As(e) {
|
|
6326
6344
|
let t = JSON.parse(e);
|
|
6327
6345
|
return t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t)) : {};
|
|
6328
6346
|
}
|
|
6329
|
-
function
|
|
6347
|
+
function js(e) {
|
|
6330
6348
|
return De.parse({
|
|
6331
6349
|
operation_id: e.operation_id,
|
|
6332
6350
|
seq: e.seq,
|
|
6333
|
-
payload:
|
|
6351
|
+
payload: As(e.payload),
|
|
6334
6352
|
status: e.status,
|
|
6335
6353
|
error_code: e.error_code,
|
|
6336
6354
|
error_message: e.error_message,
|
|
@@ -6340,7 +6358,7 @@ function As(e) {
|
|
|
6340
6358
|
updated_at: e.updated_at
|
|
6341
6359
|
});
|
|
6342
6360
|
}
|
|
6343
|
-
function
|
|
6361
|
+
function Ms(e) {
|
|
6344
6362
|
return {
|
|
6345
6363
|
async createMany(t) {
|
|
6346
6364
|
if (t.length === 0) return 0;
|
|
@@ -6359,11 +6377,11 @@ function js(e) {
|
|
|
6359
6377
|
updated_at: n
|
|
6360
6378
|
};
|
|
6361
6379
|
});
|
|
6362
|
-
for (let t = 0; t < r.length; t +=
|
|
6380
|
+
for (let t = 0; t < r.length; t += ks) await e.insertInto("tenant_operation_rows").values(r.slice(t, t + ks)).execute();
|
|
6363
6381
|
return r.length;
|
|
6364
6382
|
},
|
|
6365
6383
|
async claimPending(t, n) {
|
|
6366
|
-
return (await e.selectFrom("tenant_operation_rows").where("operation_id", "=", t).where("status", "=", "pending").selectAll().orderBy("seq", "asc").limit(n).execute()).map(
|
|
6384
|
+
return (await e.selectFrom("tenant_operation_rows").where("operation_id", "=", t).where("status", "=", "pending").selectAll().orderBy("seq", "asc").limit(n).execute()).map(js);
|
|
6367
6385
|
},
|
|
6368
6386
|
async recordOutcomes(t, n) {
|
|
6369
6387
|
let r = (/* @__PURE__ */ new Date()).toISOString(), i = 0;
|
|
@@ -6412,7 +6430,7 @@ function js(e) {
|
|
|
6412
6430
|
}
|
|
6413
6431
|
let o = await a.selectAll().orderBy("seq", "asc").offset(r * i).limit(i).execute();
|
|
6414
6432
|
return {
|
|
6415
|
-
rows: o.map(
|
|
6433
|
+
rows: o.map(js),
|
|
6416
6434
|
start: r * i,
|
|
6417
6435
|
limit: i,
|
|
6418
6436
|
length: o.length
|
|
@@ -6426,7 +6444,7 @@ function js(e) {
|
|
|
6426
6444
|
}
|
|
6427
6445
|
//#endregion
|
|
6428
6446
|
//#region src/rollouts/index.ts
|
|
6429
|
-
function
|
|
6447
|
+
function Ns(e) {
|
|
6430
6448
|
if (!e) return null;
|
|
6431
6449
|
try {
|
|
6432
6450
|
return JSON.parse(e);
|
|
@@ -6434,7 +6452,7 @@ function Ms(e) {
|
|
|
6434
6452
|
return null;
|
|
6435
6453
|
}
|
|
6436
6454
|
}
|
|
6437
|
-
function
|
|
6455
|
+
function Ps(e) {
|
|
6438
6456
|
return _e.parse({
|
|
6439
6457
|
id: e.id,
|
|
6440
6458
|
kind: e.kind,
|
|
@@ -6442,17 +6460,17 @@ function Ns(e) {
|
|
|
6442
6460
|
target_worker_version: e.target_worker_version,
|
|
6443
6461
|
target_database_version: e.target_database_version,
|
|
6444
6462
|
wave_size: e.wave_size,
|
|
6445
|
-
canary_tenant_ids:
|
|
6446
|
-
filter:
|
|
6463
|
+
canary_tenant_ids: Ns(e.canary_tenant_ids),
|
|
6464
|
+
filter: Ns(e.filter),
|
|
6447
6465
|
initiated_by: e.initiated_by,
|
|
6448
|
-
config:
|
|
6466
|
+
config: Ns(e.config),
|
|
6449
6467
|
paused_reason: e.paused_reason,
|
|
6450
6468
|
created_at: e.created_at,
|
|
6451
6469
|
updated_at: e.updated_at,
|
|
6452
6470
|
finished_at: e.finished_at
|
|
6453
6471
|
});
|
|
6454
6472
|
}
|
|
6455
|
-
function
|
|
6473
|
+
function Fs(e) {
|
|
6456
6474
|
return {
|
|
6457
6475
|
async create(n) {
|
|
6458
6476
|
let r = ge.parse(n), i = (/* @__PURE__ */ new Date()).toISOString(), a = {
|
|
@@ -6471,11 +6489,11 @@ function Ps(e) {
|
|
|
6471
6489
|
updated_at: i,
|
|
6472
6490
|
finished_at: null
|
|
6473
6491
|
};
|
|
6474
|
-
return await e.insertInto("rollouts").values(a).execute(),
|
|
6492
|
+
return await e.insertInto("rollouts").values(a).execute(), Ps(a);
|
|
6475
6493
|
},
|
|
6476
6494
|
async get(t) {
|
|
6477
6495
|
let n = await e.selectFrom("rollouts").where("id", "=", t).selectAll().executeTakeFirst();
|
|
6478
|
-
return n ?
|
|
6496
|
+
return n ? Ps(n) : null;
|
|
6479
6497
|
},
|
|
6480
6498
|
async list(t = {}) {
|
|
6481
6499
|
let n = t.page ?? 0, r = t.per_page ?? 50, i = e.selectFrom("rollouts");
|
|
@@ -6485,7 +6503,7 @@ function Ps(e) {
|
|
|
6485
6503
|
}
|
|
6486
6504
|
let a = await i.selectAll().orderBy("created_at", "desc").orderBy("id", "desc").offset(n * r).limit(r).execute();
|
|
6487
6505
|
return {
|
|
6488
|
-
rollouts: a.map(
|
|
6506
|
+
rollouts: a.map(Ps),
|
|
6489
6507
|
start: n * r,
|
|
6490
6508
|
limit: r,
|
|
6491
6509
|
length: a.length
|
|
@@ -6505,7 +6523,7 @@ function Ps(e) {
|
|
|
6505
6523
|
}
|
|
6506
6524
|
//#endregion
|
|
6507
6525
|
//#region migrate/ReferenceMigrationProvider.ts
|
|
6508
|
-
var
|
|
6526
|
+
var Is = class {
|
|
6509
6527
|
migrations;
|
|
6510
6528
|
constructor(e) {
|
|
6511
6529
|
this.migrations = e;
|
|
@@ -6513,10 +6531,10 @@ var Fs = class {
|
|
|
6513
6531
|
async getMigrations() {
|
|
6514
6532
|
return this.migrations;
|
|
6515
6533
|
}
|
|
6516
|
-
},
|
|
6517
|
-
down: () =>
|
|
6518
|
-
up: () =>
|
|
6519
|
-
}),
|
|
6534
|
+
}, Ls = /* @__PURE__ */ w({
|
|
6535
|
+
down: () => Vs,
|
|
6536
|
+
up: () => Bs
|
|
6537
|
+
}), Rs = [
|
|
6520
6538
|
{
|
|
6521
6539
|
table: "authentication_methods",
|
|
6522
6540
|
name: "fk_authentication_methods_tenants",
|
|
@@ -6782,7 +6800,7 @@ var Fs = class {
|
|
|
6782
6800
|
onDelete: "cascade"
|
|
6783
6801
|
}
|
|
6784
6802
|
];
|
|
6785
|
-
async function
|
|
6803
|
+
async function zs(e) {
|
|
6786
6804
|
try {
|
|
6787
6805
|
return await p`select sqlite_version()`.execute(e), !0;
|
|
6788
6806
|
} catch {
|
|
@@ -6791,14 +6809,14 @@ async function Rs(e) {
|
|
|
6791
6809
|
}
|
|
6792
6810
|
function K(e, t) {
|
|
6793
6811
|
let n = e;
|
|
6794
|
-
for (let e of
|
|
6812
|
+
for (let e of Rs) e.table === t && (n = n.addForeignKeyConstraint(e.name, e.columns, e.references, e.referencedColumns, (t) => {
|
|
6795
6813
|
let n = t;
|
|
6796
6814
|
return e.onDelete && (n = n.onDelete(e.onDelete)), e.onUpdate && (n = n.onUpdate(e.onUpdate)), n;
|
|
6797
6815
|
}));
|
|
6798
6816
|
return n;
|
|
6799
6817
|
}
|
|
6800
|
-
async function
|
|
6801
|
-
let t = await
|
|
6818
|
+
async function Bs(e) {
|
|
6819
|
+
let t = await zs(e);
|
|
6802
6820
|
await e.schema.createTable("tenants").addColumn("id", p`varchar(255)`, (e) => e.notNull()).addColumn("audience", p`varchar(255)`).addColumn("sender_email", p`varchar(255)`).addColumn("sender_name", p`varchar(255)`).addColumn("created_at", p`varchar(255)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(255)`, (e) => e.notNull()).addColumn("support_url", p`varchar(255)`).addColumn("idle_session_lifetime", p`int`).addColumn("session_lifetime", p`int`).addColumn("session_cookie", p`text`).addColumn("allowed_logout_urls", p`text`).addColumn("ephemeral_session_lifetime", p`int`).addColumn("idle_ephemeral_session_lifetime", p`int`).addColumn("default_redirection_uri", p`text`).addColumn("enabled_locales", p`text`).addColumn("default_directory", p`varchar(255)`).addColumn("error_page", p`text`).addColumn("flags", p`text`).addColumn("friendly_name", p`varchar(255)`).addColumn("picture_url", p`text`).addColumn("support_email", p`varchar(255)`).addColumn("sandbox_version", p`varchar(50)`).addColumn("sandbox_versions_available", p`text`).addColumn("legacy_sandbox_version", p`varchar(50)`).addColumn("change_password", p`text`).addColumn("guardian_mfa_page", p`text`).addColumn("device_flow", p`text`).addColumn("default_token_quota", p`text`).addColumn("default_audience", p`varchar(255)`).addColumn("default_organization", p`varchar(255)`).addColumn("sessions", p`text`).addColumn("oidc_logout", p`text`).addColumn("allow_organization_name_in_authentication_api", p`int`).addColumn("customize_mfa_in_postlogin_action", p`int`).addColumn("acr_values_supported", p`text`).addColumn("mtls", p`text`).addColumn("pushed_authorization_requests_supported", p`int`).addColumn("authorization_response_iss_parameter_supported", p`int`).addColumn("mfa", p`text`).addColumn("attack_protection", p`text`).addColumn("default_client_id", p`varchar(255)`).addColumn("deployment_type", p`varchar(16)`, (e) => e.notNull().defaultTo("shared")).addColumn("provisioning_state", p`varchar(16)`, (e) => e.notNull().defaultTo("ready")).addColumn("provisioning_error", p`varchar(2048)`).addColumn("provisioning_state_changed_at", p`varchar(35)`).addColumn("bundle_configuration", p`varchar(64)`).addColumn("worker_version", p`varchar(64)`).addColumn("worker_script_name", p`varchar(255)`).addColumn("storage_kind", p`varchar(32)`).addColumn("d1_database_id", p`varchar(64)`).addColumn("database_version", p`varchar(64)`).addPrimaryKeyConstraint("tenants_pk", ["id"]).execute(), await e.schema.createTable("action_executions").addColumn("id", p`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(191)`, (e) => e.notNull()).addColumn("trigger_id", p`varchar(64)`, (e) => e.notNull()).addColumn("status", p`varchar(32)`, (e) => e.notNull()).addColumn("results", p`text`, (e) => e.notNull()).addColumn("logs", p`text`).addColumn("created_at_ts", p`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", p`bigint`, (e) => e.notNull()).addPrimaryKeyConstraint("action_executions_pk", ["id"]).execute(), await e.schema.createTable("action_versions").addColumn("id", p`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(191)`, (e) => e.notNull()).addColumn("action_id", p`varchar(255)`, (e) => e.notNull()).addColumn("number", p`int`, (e) => e.notNull()).addColumn("code", p`text`, (e) => e.notNull()).addColumn("runtime", p`varchar(50)`).addColumn("secrets", p`text`).addColumn("dependencies", p`text`).addColumn("supported_triggers", p`text`).addColumn("deployed", p`int`, (e) => e.notNull().defaultTo(0)).addColumn("created_at_ts", p`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", p`bigint`, (e) => e.notNull()).addPrimaryKeyConstraint("action_versions_pk", ["id"]).execute(), await e.schema.createTable("actions").addColumn("id", p`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(191)`, (e) => e.notNull()).addColumn("name", p`varchar(255)`, (e) => e.notNull()).addColumn("code", p`text`, (e) => e.notNull()).addColumn("runtime", p`varchar(50)`).addColumn("status", p`varchar(50)`, (e) => e.defaultTo("built")).addColumn("secrets", p`text`).addColumn("dependencies", p`text`).addColumn("supported_triggers", p`text`).addColumn("deployed_at_ts", p`bigint`).addColumn("created_at_ts", p`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", p`bigint`, (e) => e.notNull()).addColumn("is_system", p`int`, (e) => e.notNull().defaultTo(0)).addColumn("inherit", p`int`, (e) => e.notNull().defaultTo(0)).addPrimaryKeyConstraint("actions_pk", ["id"]).execute();
|
|
6803
6821
|
{
|
|
6804
6822
|
let n = e.schema.createTable("authentication_methods").addColumn("id", p`varchar(26)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(191)`, (e) => e.notNull()).addColumn("user_id", p`varchar(255)`, (e) => e.notNull()).addColumn("type", p`varchar(32)`, (e) => e.notNull()).addColumn("phone_number", p`varchar(32)`).addColumn("totp_secret", p`varchar(255)`).addColumn("confirmed", p`int`, (e) => e.notNull().defaultTo(0)).addColumn("created_at_ts", p`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", p`bigint`, (e) => e.notNull()).addColumn("credential_id", p`varchar(512)`).addColumn("public_key", p`text`).addColumn("sign_count", p`int`).addColumn("credential_backed_up", p`int`).addColumn("transports", p`varchar(512)`).addColumn("friendly_name", p`varchar(255)`).addPrimaryKeyConstraint("authentication_methods_pk", ["id"]);
|
|
@@ -6985,40 +7003,40 @@ async function zs(e) {
|
|
|
6985
7003
|
"tenant_id",
|
|
6986
7004
|
"phone_number",
|
|
6987
7005
|
"provider"
|
|
6988
|
-
]).execute(), await e.schema.createIndex("users_user_id_tenant_id").on("users").columns(["user_id", "tenant_id"]).execute(), t && (await e.schema.createIndex("FK_codes_user_id_tenant_id_constraint").on("codes").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("grants_user_id_constraint").on("grants").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("login_sessions_session_fk").on("login_sessions").columns(["tenant_id", "session_id"]).execute(), await e.schema.createIndex("organization_connections_organization_fk").on("organization_connections").columns(["organization_id"]).execute(), await e.schema.createIndex("password_history_user_id_tenant_id_constraint").on("passwords").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("refresh_tokens_client_fk").on("refresh_tokens").columns(["tenant_id", "client_id"]).execute(), await e.schema.createIndex("sessions_user_fk").on("sessions").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("user_activity_user_id_constraint").on("user_activity").columns(["user_id", "tenant_id"]).execute()), !t) for (let t of
|
|
7006
|
+
]).execute(), await e.schema.createIndex("users_user_id_tenant_id").on("users").columns(["user_id", "tenant_id"]).execute(), t && (await e.schema.createIndex("FK_codes_user_id_tenant_id_constraint").on("codes").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("grants_user_id_constraint").on("grants").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("login_sessions_session_fk").on("login_sessions").columns(["tenant_id", "session_id"]).execute(), await e.schema.createIndex("organization_connections_organization_fk").on("organization_connections").columns(["organization_id"]).execute(), await e.schema.createIndex("password_history_user_id_tenant_id_constraint").on("passwords").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("refresh_tokens_client_fk").on("refresh_tokens").columns(["tenant_id", "client_id"]).execute(), await e.schema.createIndex("sessions_user_fk").on("sessions").columns(["user_id", "tenant_id"]).execute(), await e.schema.createIndex("user_activity_user_id_constraint").on("user_activity").columns(["user_id", "tenant_id"]).execute()), !t) for (let t of Rs) await e.schema.alterTable(t.table).addForeignKeyConstraint(t.name, t.columns, t.references, t.referencedColumns, (e) => {
|
|
6989
7007
|
let n = e;
|
|
6990
7008
|
return t.onDelete && (n = n.onDelete(t.onDelete)), t.onUpdate && (n = n.onUpdate(t.onUpdate)), n;
|
|
6991
7009
|
}).execute();
|
|
6992
7010
|
}
|
|
6993
|
-
async function
|
|
7011
|
+
async function Vs(e) {
|
|
6994
7012
|
await e.schema.dropTable("user_roles").ifExists().execute(), await e.schema.dropTable("user_permissions").ifExists().execute(), await e.schema.dropTable("user_organizations").ifExists().execute(), await e.schema.dropTable("user_activity").ifExists().execute(), await e.schema.dropTable("universal_login_templates").ifExists().execute(), await e.schema.dropTable("themes").ifExists().execute(), await e.schema.dropTable("tenant_operation_events").ifExists().execute(), await e.schema.dropTable("tenant_operations").ifExists().execute(), await e.schema.dropTable("rollouts").ifExists().execute(), await e.schema.dropTable("roles").ifExists().execute(), await e.schema.dropTable("role_permissions").ifExists().execute(), await e.schema.dropTable("resource_servers").ifExists().execute(), await e.schema.dropTable("refresh_tokens").ifExists().execute(), await e.schema.dropTable("proxy_routes").ifExists().execute(), await e.schema.dropTable("prompt_settings").ifExists().execute(), await e.schema.dropTable("passwords").ifExists().execute(), await e.schema.dropTable("outbox_events").ifExists().execute(), await e.schema.dropTable("organization_connections").ifExists().execute(), await e.schema.dropTable("organizations").ifExists().execute(), await e.schema.dropTable("migrations").ifExists().execute(), await e.schema.dropTable("migration_sources").ifExists().execute(), await e.schema.dropTable("logs").ifExists().execute(), await e.schema.dropTable("login_sessions").ifExists().execute(), await e.schema.dropTable("sessions").ifExists().execute(), await e.schema.dropTable("log_streams").ifExists().execute(), await e.schema.dropTable("keys").ifExists().execute(), await e.schema.dropTable("invites").ifExists().execute(), await e.schema.dropTable("hooks").ifExists().execute(), await e.schema.dropTable("hook_code").ifExists().execute(), await e.schema.dropTable("grants").ifExists().execute(), await e.schema.dropTable("forms").ifExists().execute(), await e.schema.dropTable("flows").ifExists().execute(), await e.schema.dropTable("email_templates").ifExists().execute(), await e.schema.dropTable("email_providers").ifExists().execute(), await e.schema.dropTable("custom_text").ifExists().execute(), await e.schema.dropTable("custom_domains").ifExists().execute(), await e.schema.dropTable("control_plane_comm_keys").ifExists().execute(), await e.schema.dropTable("connections").ifExists().execute(), await e.schema.dropTable("codes").ifExists().execute(), await e.schema.dropTable("users").ifExists().execute(), await e.schema.dropTable("client_registration_tokens").ifExists().execute(), await e.schema.dropTable("client_grants").ifExists().execute(), await e.schema.dropTable("clients").ifExists().execute(), await e.schema.dropTable("branding").ifExists().execute(), await e.schema.dropTable("authentication_methods").ifExists().execute(), await e.schema.dropTable("actions").ifExists().execute(), await e.schema.dropTable("action_versions").ifExists().execute(), await e.schema.dropTable("action_executions").ifExists().execute(), await e.schema.dropTable("tenants").ifExists().execute();
|
|
6995
7013
|
}
|
|
6996
7014
|
//#endregion
|
|
6997
7015
|
//#region migrate/log.ts
|
|
6998
|
-
var
|
|
6999
|
-
function
|
|
7000
|
-
|
|
7016
|
+
var Hs = !1;
|
|
7017
|
+
function Us(e) {
|
|
7018
|
+
Hs = e;
|
|
7001
7019
|
}
|
|
7002
7020
|
function q(...e) {
|
|
7003
|
-
|
|
7021
|
+
Hs && console.log(...e);
|
|
7004
7022
|
}
|
|
7005
7023
|
function J(...e) {
|
|
7006
7024
|
console.warn(...e);
|
|
7007
7025
|
}
|
|
7008
7026
|
//#endregion
|
|
7009
7027
|
//#region migrate/migrations/2026-07-16T15:00:00_codes_expires_at_ts.ts
|
|
7010
|
-
var
|
|
7011
|
-
down: () =>
|
|
7012
|
-
up: () =>
|
|
7013
|
-
}),
|
|
7014
|
-
async function
|
|
7028
|
+
var Ws = /* @__PURE__ */ w({
|
|
7029
|
+
down: () => tc,
|
|
7030
|
+
up: () => Qs
|
|
7031
|
+
}), Gs = 5e4, Ks = 500;
|
|
7032
|
+
async function qs(e) {
|
|
7015
7033
|
try {
|
|
7016
7034
|
return await p`SELECT VERSION()`.execute(e), "mysql";
|
|
7017
7035
|
} catch {
|
|
7018
7036
|
return "sqlite";
|
|
7019
7037
|
}
|
|
7020
7038
|
}
|
|
7021
|
-
async function
|
|
7039
|
+
async function Js(e, t, n) {
|
|
7022
7040
|
try {
|
|
7023
7041
|
await e.schema.alterTable(t).addColumn(n, "bigint").execute();
|
|
7024
7042
|
} catch (e) {
|
|
@@ -7029,7 +7047,7 @@ async function qs(e, t, n) {
|
|
|
7029
7047
|
throw e;
|
|
7030
7048
|
}
|
|
7031
7049
|
}
|
|
7032
|
-
async function
|
|
7050
|
+
async function Ys(e, t, n, r) {
|
|
7033
7051
|
try {
|
|
7034
7052
|
await e.schema.createIndex(t).on(n).column(r).execute();
|
|
7035
7053
|
} catch (e) {
|
|
@@ -7040,21 +7058,21 @@ async function Js(e, t, n, r) {
|
|
|
7040
7058
|
throw e;
|
|
7041
7059
|
}
|
|
7042
7060
|
}
|
|
7043
|
-
async function
|
|
7061
|
+
async function Xs(e, t) {
|
|
7044
7062
|
let n = (/* @__PURE__ */ new Date()).toISOString(), r = 0;
|
|
7045
7063
|
if (t === "sqlite") {
|
|
7046
7064
|
let t = await e.deleteFrom("codes").where("expires_at", "<", n).executeTakeFirst();
|
|
7047
7065
|
r = Number(t.numDeletedRows);
|
|
7048
7066
|
} else {
|
|
7049
|
-
let t =
|
|
7050
|
-
for (; t >=
|
|
7051
|
-
let i = await e.deleteFrom("codes").where("expires_at", "<", n).limit(
|
|
7067
|
+
let t = Gs;
|
|
7068
|
+
for (; t >= Gs;) {
|
|
7069
|
+
let i = await e.deleteFrom("codes").where("expires_at", "<", n).limit(Gs).executeTakeFirst();
|
|
7052
7070
|
t = Number(i.numDeletedRows), r += t, t > 0 && q(` Pruned ${r} expired codes row(s)...`);
|
|
7053
7071
|
}
|
|
7054
7072
|
}
|
|
7055
7073
|
return r;
|
|
7056
7074
|
}
|
|
7057
|
-
async function
|
|
7075
|
+
async function Zs(e) {
|
|
7058
7076
|
let t = 0;
|
|
7059
7077
|
for (;;) {
|
|
7060
7078
|
let n = await e.selectFrom("codes").select([
|
|
@@ -7062,33 +7080,33 @@ async function Xs(e) {
|
|
|
7062
7080
|
"code_type",
|
|
7063
7081
|
"tenant_id",
|
|
7064
7082
|
"expires_at"
|
|
7065
|
-
]).where("expires_at_ts", "is", null).limit(
|
|
7083
|
+
]).where("expires_at_ts", "is", null).limit(Ks).execute();
|
|
7066
7084
|
if (n.length === 0) break;
|
|
7067
7085
|
for (let t of n) {
|
|
7068
7086
|
let n = Date.parse(t.expires_at);
|
|
7069
7087
|
await e.updateTable("codes").set({ expires_at_ts: Number.isNaN(n) ? 0 : n }).where("code_id", "=", t.code_id).where("code_type", "=", t.code_type).where("tenant_id", "=", t.tenant_id).execute();
|
|
7070
7088
|
}
|
|
7071
|
-
if (t += n.length, n.length <
|
|
7089
|
+
if (t += n.length, n.length < Ks) break;
|
|
7072
7090
|
}
|
|
7073
7091
|
return t;
|
|
7074
7092
|
}
|
|
7075
|
-
async function
|
|
7076
|
-
let t = await
|
|
7093
|
+
async function Qs(e) {
|
|
7094
|
+
let t = await qs(e);
|
|
7077
7095
|
try {
|
|
7078
|
-
let n = await
|
|
7096
|
+
let n = await Xs(e, t);
|
|
7079
7097
|
q(n === 0 ? " No expired codes to prune" : ` Pruned ${n} expired codes row(s) total`);
|
|
7080
7098
|
} catch (e) {
|
|
7081
7099
|
J(` Warning: Could not prune expired codes: ${e instanceof Error ? e.message : String(e)}`);
|
|
7082
7100
|
}
|
|
7083
|
-
await
|
|
7101
|
+
await Js(e, "codes", "expires_at_ts"), await Ys(e, "idx_codes_expires_at_ts", "codes", "expires_at_ts");
|
|
7084
7102
|
try {
|
|
7085
|
-
let t = await
|
|
7103
|
+
let t = await Zs(e);
|
|
7086
7104
|
q(t === 0 ? " No codes rows needed an expires_at_ts backfill" : ` Backfilled expires_at_ts for ${t} codes row(s)`);
|
|
7087
7105
|
} catch (e) {
|
|
7088
7106
|
J(` Warning: Could not backfill codes.expires_at_ts: ${e instanceof Error ? e.message : String(e)}`);
|
|
7089
7107
|
}
|
|
7090
7108
|
}
|
|
7091
|
-
async function
|
|
7109
|
+
async function $s(e, t, n) {
|
|
7092
7110
|
try {
|
|
7093
7111
|
await e.schema.dropIndex(t).on(n).execute();
|
|
7094
7112
|
} catch (e) {
|
|
@@ -7096,7 +7114,7 @@ async function Qs(e, t, n) {
|
|
|
7096
7114
|
throw e;
|
|
7097
7115
|
}
|
|
7098
7116
|
}
|
|
7099
|
-
async function
|
|
7117
|
+
async function ec(e, t, n) {
|
|
7100
7118
|
try {
|
|
7101
7119
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7102
7120
|
} catch (e) {
|
|
@@ -7104,16 +7122,16 @@ async function $s(e, t, n) {
|
|
|
7104
7122
|
throw e;
|
|
7105
7123
|
}
|
|
7106
7124
|
}
|
|
7107
|
-
async function
|
|
7108
|
-
await
|
|
7125
|
+
async function tc(e) {
|
|
7126
|
+
await $s(e, "idx_codes_expires_at_ts", "codes"), await ec(e, "codes", "expires_at_ts");
|
|
7109
7127
|
}
|
|
7110
7128
|
//#endregion
|
|
7111
7129
|
//#region migrate/migrations/2026-08-04T12:00:00_scim_inbound_provisioning.ts
|
|
7112
|
-
var
|
|
7113
|
-
down: () =>
|
|
7114
|
-
up: () =>
|
|
7130
|
+
var nc = /* @__PURE__ */ w({
|
|
7131
|
+
down: () => ic,
|
|
7132
|
+
up: () => rc
|
|
7115
7133
|
});
|
|
7116
|
-
async function
|
|
7134
|
+
async function rc(e) {
|
|
7117
7135
|
await e.schema.createTable("scim_configurations").addColumn("connection_id", p`varchar(255)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("user_id_attribute", p`varchar(255)`, (e) => e.notNull().defaultTo("externalId")).addColumn("mapping", p`text`, (e) => e.notNull()).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("scim_configurations_pk", ["tenant_id", "connection_id"]).execute(), await e.schema.createTable("scim_tokens").addColumn("token_id", p`varchar(64)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("connection_id", p`varchar(255)`, (e) => e.notNull()).addColumn("token_hash", p`varchar(128)`, (e) => e.notNull()).addColumn("scopes", p`text`, (e) => e.notNull()).addColumn("valid_until", p`varchar(35)`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("last_used_at", p`varchar(35)`).addPrimaryKeyConstraint("scim_tokens_pk", ["tenant_id", "token_id"]).execute(), await e.schema.createIndex("scim_tokens_tenant_connection_idx").on("scim_tokens").columns(["tenant_id", "connection_id"]).execute(), await e.schema.createIndex("scim_tokens_tenant_hash_idx").on("scim_tokens").columns(["tenant_id", "token_hash"]).unique().execute(), await e.schema.createTable("scim_external_ids").addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("connection_id", p`varchar(255)`, (e) => e.notNull()).addColumn("external_id", p`varchar(255)`, (e) => e.notNull()).addColumn("user_id", p`varchar(255)`, (e) => e.notNull()).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("scim_external_ids_pk", [
|
|
7118
7136
|
"tenant_id",
|
|
7119
7137
|
"connection_id",
|
|
@@ -7124,16 +7142,16 @@ async function nc(e) {
|
|
|
7124
7142
|
"external_id"
|
|
7125
7143
|
]).unique().execute();
|
|
7126
7144
|
}
|
|
7127
|
-
async function
|
|
7145
|
+
async function ic(e) {
|
|
7128
7146
|
await e.schema.dropTable("scim_external_ids").ifExists().execute(), await e.schema.dropTable("scim_tokens").ifExists().execute(), await e.schema.dropTable("scim_configurations").ifExists().execute();
|
|
7129
7147
|
}
|
|
7130
7148
|
//#endregion
|
|
7131
7149
|
//#region migrate/migrations/2026-08-05T12:00:00_user_blocked.ts
|
|
7132
|
-
var
|
|
7133
|
-
down: () =>
|
|
7134
|
-
up: () =>
|
|
7150
|
+
var ac = /* @__PURE__ */ w({
|
|
7151
|
+
down: () => lc,
|
|
7152
|
+
up: () => sc
|
|
7135
7153
|
});
|
|
7136
|
-
async function
|
|
7154
|
+
async function oc(e, t, n) {
|
|
7137
7155
|
try {
|
|
7138
7156
|
await e.schema.alterTable(t).addColumn(n, p`tinyint(1)`).execute();
|
|
7139
7157
|
} catch (e) {
|
|
@@ -7141,10 +7159,10 @@ async function ac(e, t, n) {
|
|
|
7141
7159
|
throw e;
|
|
7142
7160
|
}
|
|
7143
7161
|
}
|
|
7144
|
-
async function
|
|
7145
|
-
await
|
|
7162
|
+
async function sc(e) {
|
|
7163
|
+
await oc(e, "users", "blocked");
|
|
7146
7164
|
}
|
|
7147
|
-
async function
|
|
7165
|
+
async function cc(e, t, n) {
|
|
7148
7166
|
try {
|
|
7149
7167
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7150
7168
|
} catch (e) {
|
|
@@ -7152,16 +7170,16 @@ async function sc(e, t, n) {
|
|
|
7152
7170
|
throw e;
|
|
7153
7171
|
}
|
|
7154
7172
|
}
|
|
7155
|
-
async function
|
|
7156
|
-
await
|
|
7173
|
+
async function lc(e) {
|
|
7174
|
+
await cc(e, "users", "blocked");
|
|
7157
7175
|
}
|
|
7158
7176
|
//#endregion
|
|
7159
7177
|
//#region migrate/migrations/2026-08-09T12:00:00_prompt_settings_last_used.ts
|
|
7160
|
-
var
|
|
7161
|
-
down: () =>
|
|
7162
|
-
up: () =>
|
|
7178
|
+
var uc = /* @__PURE__ */ w({
|
|
7179
|
+
down: () => mc,
|
|
7180
|
+
up: () => fc
|
|
7163
7181
|
});
|
|
7164
|
-
async function
|
|
7182
|
+
async function dc(e, t, n) {
|
|
7165
7183
|
try {
|
|
7166
7184
|
await e.schema.alterTable(t).addColumn(n, p`tinyint(1)`).execute();
|
|
7167
7185
|
} catch (e) {
|
|
@@ -7169,10 +7187,10 @@ async function uc(e, t, n) {
|
|
|
7169
7187
|
throw e;
|
|
7170
7188
|
}
|
|
7171
7189
|
}
|
|
7172
|
-
async function
|
|
7173
|
-
await
|
|
7190
|
+
async function fc(e) {
|
|
7191
|
+
await dc(e, "prompt_settings", "show_last_used_connection");
|
|
7174
7192
|
}
|
|
7175
|
-
async function
|
|
7193
|
+
async function pc(e, t, n) {
|
|
7176
7194
|
try {
|
|
7177
7195
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7178
7196
|
} catch (e) {
|
|
@@ -7180,16 +7198,16 @@ async function fc(e, t, n) {
|
|
|
7180
7198
|
throw e;
|
|
7181
7199
|
}
|
|
7182
7200
|
}
|
|
7183
|
-
async function
|
|
7184
|
-
await
|
|
7201
|
+
async function mc(e) {
|
|
7202
|
+
await pc(e, "prompt_settings", "show_last_used_connection");
|
|
7185
7203
|
}
|
|
7186
7204
|
//#endregion
|
|
7187
7205
|
//#region migrate/migrations/2026-08-10T12:00:00_action_executions_created_at_index.ts
|
|
7188
|
-
var
|
|
7189
|
-
down: () =>
|
|
7190
|
-
up: () =>
|
|
7206
|
+
var hc = /* @__PURE__ */ w({
|
|
7207
|
+
down: () => vc,
|
|
7208
|
+
up: () => _c
|
|
7191
7209
|
});
|
|
7192
|
-
async function
|
|
7210
|
+
async function gc(e, t, n, r) {
|
|
7193
7211
|
try {
|
|
7194
7212
|
await e.schema.createIndex(t).on(n).column(r).execute();
|
|
7195
7213
|
} catch (e) {
|
|
@@ -7200,10 +7218,10 @@ async function hc(e, t, n, r) {
|
|
|
7200
7218
|
throw e;
|
|
7201
7219
|
}
|
|
7202
7220
|
}
|
|
7203
|
-
async function gc(e) {
|
|
7204
|
-
await hc(e, "idx_action_executions_created_at_ts", "action_executions", "created_at_ts");
|
|
7205
|
-
}
|
|
7206
7221
|
async function _c(e) {
|
|
7222
|
+
await gc(e, "idx_action_executions_created_at_ts", "action_executions", "created_at_ts");
|
|
7223
|
+
}
|
|
7224
|
+
async function vc(e) {
|
|
7207
7225
|
try {
|
|
7208
7226
|
await e.schema.dropIndex("idx_action_executions_created_at_ts").on("action_executions").execute();
|
|
7209
7227
|
} catch (e) {
|
|
@@ -7213,11 +7231,11 @@ async function _c(e) {
|
|
|
7213
7231
|
}
|
|
7214
7232
|
//#endregion
|
|
7215
7233
|
//#region migrate/migrations/2026-08-11T12:00:00_page_hooks.ts
|
|
7216
|
-
var
|
|
7217
|
-
down: () =>
|
|
7218
|
-
up: () =>
|
|
7234
|
+
var yc = /* @__PURE__ */ w({
|
|
7235
|
+
down: () => Cc,
|
|
7236
|
+
up: () => xc
|
|
7219
7237
|
});
|
|
7220
|
-
async function
|
|
7238
|
+
async function bc(e, t, n, r) {
|
|
7221
7239
|
try {
|
|
7222
7240
|
await e.schema.alterTable(t).addColumn(n, r).execute();
|
|
7223
7241
|
} catch (e) {
|
|
@@ -7225,10 +7243,10 @@ async function yc(e, t, n, r) {
|
|
|
7225
7243
|
throw e;
|
|
7226
7244
|
}
|
|
7227
7245
|
}
|
|
7228
|
-
async function
|
|
7229
|
-
await
|
|
7246
|
+
async function xc(e) {
|
|
7247
|
+
await bc(e, "hooks", "page_id", p`varchar(64)`), await bc(e, "hooks", "permission_required", p`varchar(255)`);
|
|
7230
7248
|
}
|
|
7231
|
-
async function
|
|
7249
|
+
async function Sc(e, t, n) {
|
|
7232
7250
|
try {
|
|
7233
7251
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7234
7252
|
} catch (e) {
|
|
@@ -7236,22 +7254,22 @@ async function xc(e, t, n) {
|
|
|
7236
7254
|
throw e;
|
|
7237
7255
|
}
|
|
7238
7256
|
}
|
|
7239
|
-
async function
|
|
7240
|
-
await
|
|
7257
|
+
async function Cc(e) {
|
|
7258
|
+
await Sc(e, "hooks", "permission_required"), await Sc(e, "hooks", "page_id");
|
|
7241
7259
|
}
|
|
7242
7260
|
//#endregion
|
|
7243
7261
|
//#region migrate/migrations/2026-08-20T12:00:00_refresh_token_session_id.ts
|
|
7244
|
-
var
|
|
7245
|
-
down: () =>
|
|
7246
|
-
up: () =>
|
|
7247
|
-
}),
|
|
7262
|
+
var wc = /* @__PURE__ */ w({
|
|
7263
|
+
down: () => Ac,
|
|
7264
|
+
up: () => Oc
|
|
7265
|
+
}), Tc = [
|
|
7248
7266
|
["session_id", p`varchar(26)`],
|
|
7249
7267
|
["organization", p`varchar(191)`],
|
|
7250
7268
|
["auth_connection", p`varchar(255)`],
|
|
7251
7269
|
["auth_strategy_strategy", p`varchar(64)`],
|
|
7252
7270
|
["auth_strategy_strategy_type", p`varchar(64)`]
|
|
7253
7271
|
];
|
|
7254
|
-
async function
|
|
7272
|
+
async function Ec(e, t, n, r) {
|
|
7255
7273
|
try {
|
|
7256
7274
|
await e.schema.alterTable(t).addColumn(n, r).execute();
|
|
7257
7275
|
} catch (e) {
|
|
@@ -7259,7 +7277,7 @@ async function Tc(e, t, n, r) {
|
|
|
7259
7277
|
throw e;
|
|
7260
7278
|
}
|
|
7261
7279
|
}
|
|
7262
|
-
async function
|
|
7280
|
+
async function Dc(e) {
|
|
7263
7281
|
try {
|
|
7264
7282
|
await e.schema.createIndex("idx_refresh_tokens_session_id").on("refresh_tokens").columns(["tenant_id", "session_id"]).execute();
|
|
7265
7283
|
} catch (e) {
|
|
@@ -7267,11 +7285,11 @@ async function Ec(e) {
|
|
|
7267
7285
|
throw e;
|
|
7268
7286
|
}
|
|
7269
7287
|
}
|
|
7270
|
-
async function
|
|
7271
|
-
for (let [t, n] of
|
|
7272
|
-
await
|
|
7288
|
+
async function Oc(e) {
|
|
7289
|
+
for (let [t, n] of Tc) await Ec(e, "refresh_tokens", t, n);
|
|
7290
|
+
await Dc(e);
|
|
7273
7291
|
}
|
|
7274
|
-
async function
|
|
7292
|
+
async function kc(e, t, n) {
|
|
7275
7293
|
try {
|
|
7276
7294
|
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7277
7295
|
} catch (e) {
|
|
@@ -7279,23 +7297,23 @@ async function Oc(e, t, n) {
|
|
|
7279
7297
|
throw e;
|
|
7280
7298
|
}
|
|
7281
7299
|
}
|
|
7282
|
-
async function
|
|
7300
|
+
async function Ac(e) {
|
|
7283
7301
|
try {
|
|
7284
7302
|
await e.schema.dropIndex("idx_refresh_tokens_session_id").execute();
|
|
7285
7303
|
} catch {}
|
|
7286
|
-
for (let [t] of
|
|
7304
|
+
for (let [t] of Tc) await kc(e, "refresh_tokens", t);
|
|
7287
7305
|
}
|
|
7288
7306
|
//#endregion
|
|
7289
7307
|
//#region migrate/migrations/2026-08-21T12:00:00_refresh_token_session_id_backfill.ts
|
|
7290
|
-
var
|
|
7291
|
-
down: () =>
|
|
7292
|
-
up: () =>
|
|
7293
|
-
}),
|
|
7294
|
-
async function
|
|
7308
|
+
var jc = /* @__PURE__ */ w({
|
|
7309
|
+
down: () => Lc,
|
|
7310
|
+
up: () => Ic
|
|
7311
|
+
}), Mc = 500, Nc = 20, Pc = 500, Fc = "packages/kysely/migrate/data-migrations/refresh-token-session-id-backfill.sql";
|
|
7312
|
+
async function Ic(e) {
|
|
7295
7313
|
try {
|
|
7296
7314
|
let t = await e.selectFrom("refresh_tokens").innerJoin("login_sessions", "login_sessions.id", "refresh_tokens.login_id").whereRef("login_sessions.tenant_id", "=", "refresh_tokens.tenant_id").where("refresh_tokens.session_id", "is", null).where("login_sessions.session_id", "is not", null).select((e) => e.fn.countAll().as("count")).executeTakeFirst(), n = Number(t?.count ?? 0);
|
|
7297
|
-
if (n >
|
|
7298
|
-
J(`refresh_tokens backfill: ${n} rows in scope, above the in-process limit of ${
|
|
7315
|
+
if (n > Pc) {
|
|
7316
|
+
J(`refresh_tokens backfill: ${n} rows in scope, above the in-process limit of ${Pc}. SKIPPING — run the bulk path instead: ${Fc}. This must be completed before login_sessions retention is enabled, or the auth-event facts are lost for good.`);
|
|
7299
7317
|
return;
|
|
7300
7318
|
}
|
|
7301
7319
|
if (n === 0) {
|
|
@@ -7312,10 +7330,10 @@ async function Fc(e) {
|
|
|
7312
7330
|
"login_sessions.auth_strategy_strategy as ls_strategy",
|
|
7313
7331
|
"login_sessions.auth_strategy_strategy_type as ls_strategy_type",
|
|
7314
7332
|
"login_sessions.auth_params as ls_auth_params"
|
|
7315
|
-
]).limit(
|
|
7333
|
+
]).limit(Mc).execute();
|
|
7316
7334
|
if (t.length === 0) break;
|
|
7317
|
-
for (let n = 0; n < t.length; n +=
|
|
7318
|
-
let r = t.slice(n, n +
|
|
7335
|
+
for (let n = 0; n < t.length; n += Nc) {
|
|
7336
|
+
let r = t.slice(n, n + Nc);
|
|
7319
7337
|
await Promise.all(r.map(async (t) => {
|
|
7320
7338
|
let n = null;
|
|
7321
7339
|
if (t.ls_auth_params) try {
|
|
@@ -7332,19 +7350,19 @@ async function Fc(e) {
|
|
|
7332
7350
|
}).where("tenant_id", "=", t.tenant_id).where("id", "=", t.id).execute();
|
|
7333
7351
|
}));
|
|
7334
7352
|
}
|
|
7335
|
-
if (r += t.length, q(`refresh_tokens backfill: ${r} rows populated so far`), t.length <
|
|
7353
|
+
if (r += t.length, q(`refresh_tokens backfill: ${r} rows populated so far`), t.length < Mc) break;
|
|
7336
7354
|
}
|
|
7337
7355
|
q(`refresh_tokens backfill: done, ${r} rows updated`);
|
|
7338
7356
|
} catch (e) {
|
|
7339
7357
|
throw J("refresh_tokens backfill failed:", e), e;
|
|
7340
7358
|
}
|
|
7341
7359
|
}
|
|
7342
|
-
async function
|
|
7360
|
+
async function Lc() {}
|
|
7343
7361
|
//#endregion
|
|
7344
7362
|
//#region migrate/migrations/2026-09-01T12:00:00_tenant_operation_rows.ts
|
|
7345
|
-
var
|
|
7346
|
-
down: () =>
|
|
7347
|
-
up: () =>
|
|
7363
|
+
var Rc = /* @__PURE__ */ w({
|
|
7364
|
+
down: () => Vc,
|
|
7365
|
+
up: () => Bc
|
|
7348
7366
|
});
|
|
7349
7367
|
async function Y(e, t, n, r) {
|
|
7350
7368
|
try {
|
|
@@ -7354,7 +7372,7 @@ async function Y(e, t, n, r) {
|
|
|
7354
7372
|
throw e;
|
|
7355
7373
|
}
|
|
7356
7374
|
}
|
|
7357
|
-
async function
|
|
7375
|
+
async function zc(e, t, n, r) {
|
|
7358
7376
|
try {
|
|
7359
7377
|
await e.schema.createIndex(t).on(n).columns(r).execute();
|
|
7360
7378
|
} catch (e) {
|
|
@@ -7362,12 +7380,12 @@ async function Rc(e, t, n, r) {
|
|
|
7362
7380
|
throw e;
|
|
7363
7381
|
}
|
|
7364
7382
|
}
|
|
7365
|
-
async function
|
|
7366
|
-
await Y(e, "tenant_operations", "input", p`text`), await Y(e, "tenant_operations", "result", p`text`), await Y(e, "tenant_operations", "claimed_by", p`varchar(255)`), await Y(e, "tenant_operations", "claim_expires_at", p`varchar(35)`), await e.schema.createTable("tenant_operation_rows").ifNotExists().addColumn("operation_id", p`varchar(255)`, (e) => e.notNull()).addColumn("seq", p`int`, (e) => e.notNull()).addColumn("payload", p`text`, (e) => e.notNull()).addColumn("status", p`varchar(32)`, (e) => e.notNull()).addColumn("error_code", p`varchar(64)`).addColumn("error_message", p`text`).addColumn("error_path", p`varchar(255)`).addColumn("entity_id", p`varchar(255)`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("tenant_operation_rows_pk", ["operation_id", "seq"]).execute(), await
|
|
7383
|
+
async function Bc(e) {
|
|
7384
|
+
await Y(e, "tenant_operations", "input", p`text`), await Y(e, "tenant_operations", "result", p`text`), await Y(e, "tenant_operations", "claimed_by", p`varchar(255)`), await Y(e, "tenant_operations", "claim_expires_at", p`varchar(35)`), await e.schema.createTable("tenant_operation_rows").ifNotExists().addColumn("operation_id", p`varchar(255)`, (e) => e.notNull()).addColumn("seq", p`int`, (e) => e.notNull()).addColumn("payload", p`text`, (e) => e.notNull()).addColumn("status", p`varchar(32)`, (e) => e.notNull()).addColumn("error_code", p`varchar(64)`).addColumn("error_message", p`text`).addColumn("error_path", p`varchar(255)`).addColumn("entity_id", p`varchar(255)`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("tenant_operation_rows_pk", ["operation_id", "seq"]).execute(), await zc(e, "tenant_operation_rows_operation_status_seq_idx", "tenant_operation_rows", [
|
|
7367
7385
|
"operation_id",
|
|
7368
7386
|
"status",
|
|
7369
7387
|
"seq"
|
|
7370
|
-
]), await
|
|
7388
|
+
]), await zc(e, "tenant_operations_kind_status_created_at_idx", "tenant_operations", [
|
|
7371
7389
|
"kind",
|
|
7372
7390
|
"status",
|
|
7373
7391
|
"created_at"
|
|
@@ -7381,7 +7399,7 @@ async function X(e, t, n) {
|
|
|
7381
7399
|
throw e;
|
|
7382
7400
|
}
|
|
7383
7401
|
}
|
|
7384
|
-
async function
|
|
7402
|
+
async function Vc(e) {
|
|
7385
7403
|
try {
|
|
7386
7404
|
await e.schema.dropIndex("tenant_operations_kind_status_created_at_idx").on("tenant_operations").execute();
|
|
7387
7405
|
} catch {}
|
|
@@ -7389,11 +7407,11 @@ async function Bc(e) {
|
|
|
7389
7407
|
}
|
|
7390
7408
|
//#endregion
|
|
7391
7409
|
//#region migrate/migrations/2026-09-25T12:00:00_token_exchange_profiles.ts
|
|
7392
|
-
var
|
|
7393
|
-
down: () =>
|
|
7394
|
-
up: () =>
|
|
7410
|
+
var Hc = /* @__PURE__ */ w({
|
|
7411
|
+
down: () => Kc,
|
|
7412
|
+
up: () => Gc
|
|
7395
7413
|
});
|
|
7396
|
-
async function
|
|
7414
|
+
async function Uc(e, t, n, r) {
|
|
7397
7415
|
try {
|
|
7398
7416
|
await e.schema.alterTable(t).addColumn(n, r).execute();
|
|
7399
7417
|
} catch (e) {
|
|
@@ -7401,7 +7419,7 @@ async function Hc(e, t, n, r) {
|
|
|
7401
7419
|
throw e;
|
|
7402
7420
|
}
|
|
7403
7421
|
}
|
|
7404
|
-
async function
|
|
7422
|
+
async function Wc(e, t, n, r) {
|
|
7405
7423
|
try {
|
|
7406
7424
|
await e.schema.createIndex(t).on(n).columns(r).unique().execute();
|
|
7407
7425
|
} catch (e) {
|
|
@@ -7409,10 +7427,10 @@ async function Uc(e, t, n, r) {
|
|
|
7409
7427
|
throw e;
|
|
7410
7428
|
}
|
|
7411
7429
|
}
|
|
7412
|
-
async function Wc(e) {
|
|
7413
|
-
await e.schema.createTable("token_exchange_profiles").ifNotExists().addColumn("id", p`varchar(64)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("name", p`varchar(255)`, (e) => e.notNull()).addColumn("subject_token_type", p`varchar(255)`, (e) => e.notNull()).addColumn("action_id", p`varchar(255)`).addColumn("type", p`varchar(64)`, (e) => e.notNull()).addColumn("jwt_verification", p`text`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("token_exchange_profiles_pk", ["id"]).execute(), await Uc(e, "token_exchange_profiles_tenant_subject_token_type_idx", "token_exchange_profiles", ["tenant_id", "subject_token_type"]), await Hc(e, "clients", "token_exchange", p`text`);
|
|
7414
|
-
}
|
|
7415
7430
|
async function Gc(e) {
|
|
7431
|
+
await e.schema.createTable("token_exchange_profiles").ifNotExists().addColumn("id", p`varchar(64)`, (e) => e.notNull()).addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("name", p`varchar(255)`, (e) => e.notNull()).addColumn("subject_token_type", p`varchar(255)`, (e) => e.notNull()).addColumn("action_id", p`varchar(255)`).addColumn("type", p`varchar(64)`, (e) => e.notNull()).addColumn("jwt_verification", p`text`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("token_exchange_profiles_pk", ["id"]).execute(), await Wc(e, "token_exchange_profiles_tenant_subject_token_type_idx", "token_exchange_profiles", ["tenant_id", "subject_token_type"]), await Uc(e, "clients", "token_exchange", p`text`);
|
|
7432
|
+
}
|
|
7433
|
+
async function Kc(e) {
|
|
7416
7434
|
await e.schema.dropTable("token_exchange_profiles").ifExists().execute();
|
|
7417
7435
|
try {
|
|
7418
7436
|
await e.schema.alterTable("clients").dropColumn("token_exchange").execute();
|
|
@@ -7423,22 +7441,22 @@ async function Gc(e) {
|
|
|
7423
7441
|
}
|
|
7424
7442
|
//#endregion
|
|
7425
7443
|
//#region migrate/migrations/2026-10-13T12:00:00_prompt_partials.ts
|
|
7426
|
-
var
|
|
7427
|
-
down: () =>
|
|
7428
|
-
up: () =>
|
|
7444
|
+
var qc = /* @__PURE__ */ w({
|
|
7445
|
+
down: () => Yc,
|
|
7446
|
+
up: () => Jc
|
|
7429
7447
|
});
|
|
7430
|
-
async function
|
|
7448
|
+
async function Jc(e) {
|
|
7431
7449
|
await e.schema.createTable("prompt_partials").ifNotExists().addColumn("tenant_id", p`varchar(191)`, (e) => e.notNull()).addColumn("prompt", p`varchar(64)`, (e) => e.notNull()).addColumn("body", p`text`, (e) => e.notNull()).addColumn("created_at_ts", p`bigint`, (e) => e.notNull()).addColumn("updated_at_ts", p`bigint`, (e) => e.notNull()).addPrimaryKeyConstraint("prompt_partials_pk", ["tenant_id", "prompt"]).execute();
|
|
7432
7450
|
}
|
|
7433
|
-
async function
|
|
7451
|
+
async function Yc(e) {
|
|
7434
7452
|
await e.schema.dropTable("prompt_partials").ifExists().execute();
|
|
7435
7453
|
}
|
|
7436
7454
|
//#endregion
|
|
7437
7455
|
//#region migrate/migrations/2026-10-21T12:00:00_config_inheritance.ts
|
|
7438
|
-
var
|
|
7439
|
-
down: () =>
|
|
7440
|
-
up: () =>
|
|
7441
|
-
}),
|
|
7456
|
+
var Xc = /* @__PURE__ */ w({
|
|
7457
|
+
down: () => $c,
|
|
7458
|
+
up: () => Qc
|
|
7459
|
+
}), Zc = [
|
|
7442
7460
|
"connections",
|
|
7443
7461
|
"actions",
|
|
7444
7462
|
"hooks",
|
|
@@ -7463,9 +7481,9 @@ async function Q(e, t, n) {
|
|
|
7463
7481
|
throw e;
|
|
7464
7482
|
}
|
|
7465
7483
|
}
|
|
7466
|
-
async function
|
|
7484
|
+
async function Qc(e) {
|
|
7467
7485
|
await Z(e, "tenants", "parent_tenant_id", p`varchar(191)`);
|
|
7468
|
-
for (let t of
|
|
7486
|
+
for (let t of Zc) await Z(e, t, "scope", p`varchar(16)`), await Z(e, t, "override", p`varchar(16)`), await Z(e, t, "enforce", p`tinyint(1)`);
|
|
7469
7487
|
for (let t of [
|
|
7470
7488
|
"connections",
|
|
7471
7489
|
"actions",
|
|
@@ -7473,17 +7491,17 @@ async function Zc(e) {
|
|
|
7473
7491
|
]) await p`UPDATE ${p.table(t)} SET scope = 'shared', override = 'none' WHERE is_system = 1 AND scope IS NULL`.execute(e);
|
|
7474
7492
|
await p`UPDATE hooks SET scope = 'shared', override = 'none' WHERE scope IS NULL AND REPLACE(REPLACE(REPLACE(REPLACE(metadata, ' ', ''), CHAR(10), ''), CHAR(13), ''), CHAR(9), '') LIKE '%"inheritable":true%'`.execute(e);
|
|
7475
7493
|
}
|
|
7476
|
-
async function
|
|
7477
|
-
for (let t of
|
|
7494
|
+
async function $c(e) {
|
|
7495
|
+
for (let t of Zc) await Q(e, t, "enforce"), await Q(e, t, "override"), await Q(e, t, "scope");
|
|
7478
7496
|
await Q(e, "tenants", "parent_tenant_id");
|
|
7479
7497
|
}
|
|
7480
7498
|
//#endregion
|
|
7481
7499
|
//#region migrate/migrations/2026-10-26T12:00:00_config_sync_hash.ts
|
|
7482
|
-
var
|
|
7483
|
-
down: () =>
|
|
7484
|
-
up: () =>
|
|
7500
|
+
var el = /* @__PURE__ */ w({
|
|
7501
|
+
down: () => il,
|
|
7502
|
+
up: () => rl
|
|
7485
7503
|
});
|
|
7486
|
-
async function
|
|
7504
|
+
async function tl(e, t, n) {
|
|
7487
7505
|
try {
|
|
7488
7506
|
await e.schema.alterTable("tenants").addColumn(t, n).execute();
|
|
7489
7507
|
} catch (e) {
|
|
@@ -7491,7 +7509,7 @@ async function el(e, t, n) {
|
|
|
7491
7509
|
throw e;
|
|
7492
7510
|
}
|
|
7493
7511
|
}
|
|
7494
|
-
async function
|
|
7512
|
+
async function nl(e, t) {
|
|
7495
7513
|
try {
|
|
7496
7514
|
await e.schema.alterTable("tenants").dropColumn(t).execute();
|
|
7497
7515
|
} catch (e) {
|
|
@@ -7499,19 +7517,19 @@ async function tl(e, t) {
|
|
|
7499
7517
|
throw e;
|
|
7500
7518
|
}
|
|
7501
7519
|
}
|
|
7502
|
-
async function nl(e) {
|
|
7503
|
-
await el(e, "config_sync_hash", p`varchar(64)`), await el(e, "config_synced_at", p`varchar(35)`);
|
|
7504
|
-
}
|
|
7505
7520
|
async function rl(e) {
|
|
7506
|
-
await tl(e, "
|
|
7521
|
+
await tl(e, "config_sync_hash", p`varchar(64)`), await tl(e, "config_synced_at", p`varchar(35)`);
|
|
7522
|
+
}
|
|
7523
|
+
async function il(e) {
|
|
7524
|
+
await nl(e, "config_synced_at"), await nl(e, "config_sync_hash");
|
|
7507
7525
|
}
|
|
7508
7526
|
//#endregion
|
|
7509
7527
|
//#region migrate/migrations/2026-10-27T12:00:00_config_sync_mode.ts
|
|
7510
|
-
var
|
|
7511
|
-
down: () =>
|
|
7512
|
-
up: () =>
|
|
7528
|
+
var al = /* @__PURE__ */ w({
|
|
7529
|
+
down: () => ll,
|
|
7530
|
+
up: () => cl
|
|
7513
7531
|
});
|
|
7514
|
-
async function
|
|
7532
|
+
async function ol(e) {
|
|
7515
7533
|
try {
|
|
7516
7534
|
await e.schema.alterTable("tenants").addColumn("config_sync", p`varchar(16)`).execute();
|
|
7517
7535
|
} catch (e) {
|
|
@@ -7519,7 +7537,7 @@ async function al(e) {
|
|
|
7519
7537
|
throw e;
|
|
7520
7538
|
}
|
|
7521
7539
|
}
|
|
7522
|
-
async function
|
|
7540
|
+
async function sl(e) {
|
|
7523
7541
|
try {
|
|
7524
7542
|
await e.schema.alterTable("tenants").dropColumn("config_sync").execute();
|
|
7525
7543
|
} catch (e) {
|
|
@@ -7527,19 +7545,19 @@ async function ol(e) {
|
|
|
7527
7545
|
throw e;
|
|
7528
7546
|
}
|
|
7529
7547
|
}
|
|
7530
|
-
async function sl(e) {
|
|
7531
|
-
await al(e);
|
|
7532
|
-
}
|
|
7533
7548
|
async function cl(e) {
|
|
7534
7549
|
await ol(e);
|
|
7535
7550
|
}
|
|
7551
|
+
async function ll(e) {
|
|
7552
|
+
await sl(e);
|
|
7553
|
+
}
|
|
7536
7554
|
//#endregion
|
|
7537
7555
|
//#region migrate/migrations/2026-10-28T12:00:00_rollout_config.ts
|
|
7538
|
-
var
|
|
7539
|
-
down: () =>
|
|
7540
|
-
up: () =>
|
|
7556
|
+
var ul = /* @__PURE__ */ w({
|
|
7557
|
+
down: () => ml,
|
|
7558
|
+
up: () => pl
|
|
7541
7559
|
});
|
|
7542
|
-
async function
|
|
7560
|
+
async function dl(e, t, n) {
|
|
7543
7561
|
try {
|
|
7544
7562
|
await e.schema.alterTable("rollouts").addColumn(t, n).execute();
|
|
7545
7563
|
} catch (e) {
|
|
@@ -7547,7 +7565,7 @@ async function ul(e, t, n) {
|
|
|
7547
7565
|
throw e;
|
|
7548
7566
|
}
|
|
7549
7567
|
}
|
|
7550
|
-
async function
|
|
7568
|
+
async function fl(e, t) {
|
|
7551
7569
|
try {
|
|
7552
7570
|
await e.schema.alterTable("rollouts").dropColumn(t).execute();
|
|
7553
7571
|
} catch (e) {
|
|
@@ -7555,79 +7573,137 @@ async function dl(e, t) {
|
|
|
7555
7573
|
throw e;
|
|
7556
7574
|
}
|
|
7557
7575
|
}
|
|
7558
|
-
async function fl(e) {
|
|
7559
|
-
await ul(e, "config", p`text`), await ul(e, "paused_reason", p`text`);
|
|
7560
|
-
}
|
|
7561
7576
|
async function pl(e) {
|
|
7562
|
-
await dl(e, "
|
|
7577
|
+
await dl(e, "config", p`text`), await dl(e, "paused_reason", p`text`);
|
|
7578
|
+
}
|
|
7579
|
+
async function ml(e) {
|
|
7580
|
+
await fl(e, "paused_reason"), await fl(e, "config");
|
|
7563
7581
|
}
|
|
7564
7582
|
//#endregion
|
|
7565
7583
|
//#region migrate/migrations/2026-10-29T12:00:00_device_codes.ts
|
|
7566
|
-
var
|
|
7567
|
-
down: () =>
|
|
7568
|
-
up: () =>
|
|
7584
|
+
var hl = /* @__PURE__ */ w({
|
|
7585
|
+
down: () => _l,
|
|
7586
|
+
up: () => gl
|
|
7569
7587
|
});
|
|
7570
|
-
async function
|
|
7588
|
+
async function gl(e) {
|
|
7571
7589
|
await e.schema.createTable("device_codes").addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("device_code_hash", p`varchar(64)`, (e) => e.notNull()).addColumn("user_code_hash", p`varchar(64)`, (e) => e.notNull()).addColumn("client_id", p`varchar(255)`, (e) => e.notNull()).addColumn("scope", p`text`).addColumn("audience", p`text`).addColumn("status", p`varchar(16)`, (e) => e.notNull()).addColumn("login_id", p`varchar(255)`).addColumn("expires_at", p`varchar(35)`, (e) => e.notNull()).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("last_polled_at", p`varchar(35)`).addColumn("interval", "integer", (e) => e.notNull()).addColumn("version", "integer", (e) => e.notNull()).addPrimaryKeyConstraint("device_codes_pk", ["tenant_id", "device_code_hash"]).addUniqueConstraint("device_codes_user_code_idx", ["tenant_id", "user_code_hash"]).execute(), await e.schema.createIndex("device_codes_expiry_idx").on("device_codes").column("expires_at").execute(), await e.schema.createTable("device_flow_limits").addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("key", p`varchar(255)`, (e) => e.notNull()).addColumn("attempts", "integer", (e) => e.notNull()).addColumn("expires_at", p`varchar(35)`, (e) => e.notNull()).addPrimaryKeyConstraint("device_flow_limits_pk", ["tenant_id", "key"]).execute(), await e.schema.createIndex("device_flow_limits_expiry_idx").on("device_flow_limits").column("expires_at").execute();
|
|
7572
7590
|
}
|
|
7573
|
-
async function
|
|
7591
|
+
async function _l(e) {
|
|
7574
7592
|
await e.schema.dropTable("device_flow_limits").execute(), await e.schema.dropTable("device_codes").execute();
|
|
7575
7593
|
}
|
|
7576
7594
|
//#endregion
|
|
7577
7595
|
//#region migrate/migrations/2026-10-30T12:00:00_tenant_member_requests.ts
|
|
7578
|
-
var
|
|
7579
|
-
down: () =>
|
|
7580
|
-
up: () =>
|
|
7596
|
+
var vl = /* @__PURE__ */ w({
|
|
7597
|
+
down: () => bl,
|
|
7598
|
+
up: () => yl
|
|
7581
7599
|
});
|
|
7582
|
-
async function
|
|
7600
|
+
async function yl(e) {
|
|
7583
7601
|
await e.schema.createTable("tenant_member_requests").addColumn("tenant_id", p`varchar(255)`, (e) => e.notNull()).addColumn("id", p`varchar(255)`, (e) => e.notNull()).addColumn("kind", p`varchar(32)`, (e) => e.notNull()).addColumn("status", p`varchar(16)`, (e) => e.notNull()).addColumn("requested_by", p`varchar(255)`, (e) => e.notNull()).addColumn("payload", p`text`, (e) => e.notNull()).addColumn("result", p`text`).addColumn("error", p`text`).addColumn("notified_at", p`varchar(35)`).addColumn("created_at", p`varchar(35)`, (e) => e.notNull()).addColumn("updated_at", p`varchar(35)`, (e) => e.notNull()).addColumn("finished_at", p`varchar(35)`).addPrimaryKeyConstraint("tenant_member_requests_pk", ["tenant_id", "id"]).execute(), await e.schema.createIndex("tenant_member_requests_status_idx").on("tenant_member_requests").columns([
|
|
7584
7602
|
"tenant_id",
|
|
7585
7603
|
"status",
|
|
7586
7604
|
"created_at"
|
|
7587
7605
|
]).execute(), await e.schema.createIndex("tenant_member_requests_finished_idx").on("tenant_member_requests").column("finished_at").execute();
|
|
7588
7606
|
}
|
|
7589
|
-
async function
|
|
7607
|
+
async function bl(e) {
|
|
7590
7608
|
await e.schema.dropTable("tenant_member_requests").execute();
|
|
7591
7609
|
}
|
|
7592
7610
|
//#endregion
|
|
7611
|
+
//#region migrate/migrations/2026-11-05T12:00:00_session_authentication.ts
|
|
7612
|
+
var xl = /* @__PURE__ */ w({
|
|
7613
|
+
down: () => Tl,
|
|
7614
|
+
up: () => Cl
|
|
7615
|
+
});
|
|
7616
|
+
async function Sl(e, t, n) {
|
|
7617
|
+
try {
|
|
7618
|
+
await e.schema.alterTable(t).addColumn(n, p`text`).execute();
|
|
7619
|
+
} catch (e) {
|
|
7620
|
+
if (e instanceof Error && (e.message.includes("1060") || e.message.toLowerCase().includes("duplicate column"))) return;
|
|
7621
|
+
throw e;
|
|
7622
|
+
}
|
|
7623
|
+
}
|
|
7624
|
+
async function Cl(e) {
|
|
7625
|
+
await Sl(e, "sessions", "authentication");
|
|
7626
|
+
}
|
|
7627
|
+
async function wl(e, t, n) {
|
|
7628
|
+
try {
|
|
7629
|
+
await e.schema.alterTable(t).dropColumn(n).execute();
|
|
7630
|
+
} catch (e) {
|
|
7631
|
+
if (e instanceof Error && e.message.includes("1091")) return;
|
|
7632
|
+
throw e;
|
|
7633
|
+
}
|
|
7634
|
+
}
|
|
7635
|
+
async function Tl(e) {
|
|
7636
|
+
await wl(e, "sessions", "authentication");
|
|
7637
|
+
}
|
|
7638
|
+
//#endregion
|
|
7639
|
+
//#region migrate/migrations/2026-11-05T13:00:00_authentication_methods_totp_last_step.ts
|
|
7640
|
+
var El = /* @__PURE__ */ w({
|
|
7641
|
+
down: () => Al,
|
|
7642
|
+
up: () => kl
|
|
7643
|
+
});
|
|
7644
|
+
async function Dl(e) {
|
|
7645
|
+
try {
|
|
7646
|
+
await e.schema.alterTable("authentication_methods").addColumn("totp_last_step", "integer").execute();
|
|
7647
|
+
} catch (e) {
|
|
7648
|
+
if (e instanceof Error && (e.message.includes("1060") || e.message.toLowerCase().includes("duplicate column"))) return;
|
|
7649
|
+
throw e;
|
|
7650
|
+
}
|
|
7651
|
+
}
|
|
7652
|
+
async function Ol(e) {
|
|
7653
|
+
try {
|
|
7654
|
+
await e.schema.alterTable("authentication_methods").dropColumn("totp_last_step").execute();
|
|
7655
|
+
} catch (e) {
|
|
7656
|
+
if (e instanceof Error && e.message.includes("1091")) return;
|
|
7657
|
+
throw e;
|
|
7658
|
+
}
|
|
7659
|
+
}
|
|
7660
|
+
async function kl(e) {
|
|
7661
|
+
await Dl(e);
|
|
7662
|
+
}
|
|
7663
|
+
async function Al(e) {
|
|
7664
|
+
await Ol(e);
|
|
7665
|
+
}
|
|
7666
|
+
//#endregion
|
|
7593
7667
|
//#region migrate/migrations/index.ts
|
|
7594
|
-
var
|
|
7595
|
-
"2026-07-16T14:00:00_baseline":
|
|
7596
|
-
"2026-07-16T15:00:00_codes_expires_at_ts":
|
|
7597
|
-
"2026-08-04T12:00:00_scim_inbound_provisioning":
|
|
7598
|
-
"2026-08-05T12:00:00_user_blocked":
|
|
7599
|
-
"2026-08-09T12:00:00_prompt_settings_last_used":
|
|
7600
|
-
"2026-08-10T12:00:00_action_executions_created_at_index":
|
|
7601
|
-
"2026-08-11T12:00:00_page_hooks":
|
|
7602
|
-
"2026-08-20T12:00:00_refresh_token_session_id":
|
|
7603
|
-
"2026-08-21T12:00:00_refresh_token_session_id_backfill":
|
|
7604
|
-
"2026-09-01T12:00:00_tenant_operation_rows":
|
|
7605
|
-
"2026-09-25T12:00:00_token_exchange_profiles":
|
|
7606
|
-
"2026-10-13T12:00:00_prompt_partials":
|
|
7607
|
-
"2026-10-21T12:00:00_config_inheritance":
|
|
7608
|
-
"2026-10-26T12:00:00_config_sync_hash":
|
|
7609
|
-
"2026-10-27T12:00:00_config_sync_mode":
|
|
7610
|
-
"2026-10-28T12:00:00_rollout_config":
|
|
7611
|
-
"2026-10-29T12:00:00_device_codes":
|
|
7612
|
-
"2026-10-30T12:00:00_tenant_member_requests":
|
|
7668
|
+
var jl = {
|
|
7669
|
+
"2026-07-16T14:00:00_baseline": Ls,
|
|
7670
|
+
"2026-07-16T15:00:00_codes_expires_at_ts": Ws,
|
|
7671
|
+
"2026-08-04T12:00:00_scim_inbound_provisioning": nc,
|
|
7672
|
+
"2026-08-05T12:00:00_user_blocked": ac,
|
|
7673
|
+
"2026-08-09T12:00:00_prompt_settings_last_used": uc,
|
|
7674
|
+
"2026-08-10T12:00:00_action_executions_created_at_index": hc,
|
|
7675
|
+
"2026-08-11T12:00:00_page_hooks": yc,
|
|
7676
|
+
"2026-08-20T12:00:00_refresh_token_session_id": wc,
|
|
7677
|
+
"2026-08-21T12:00:00_refresh_token_session_id_backfill": jc,
|
|
7678
|
+
"2026-09-01T12:00:00_tenant_operation_rows": Rc,
|
|
7679
|
+
"2026-09-25T12:00:00_token_exchange_profiles": Hc,
|
|
7680
|
+
"2026-10-13T12:00:00_prompt_partials": qc,
|
|
7681
|
+
"2026-10-21T12:00:00_config_inheritance": Xc,
|
|
7682
|
+
"2026-10-26T12:00:00_config_sync_hash": el,
|
|
7683
|
+
"2026-10-27T12:00:00_config_sync_mode": al,
|
|
7684
|
+
"2026-10-28T12:00:00_rollout_config": ul,
|
|
7685
|
+
"2026-10-29T12:00:00_device_codes": hl,
|
|
7686
|
+
"2026-10-30T12:00:00_tenant_member_requests": vl,
|
|
7687
|
+
"2026-11-05T12:00:00_session_authentication": xl,
|
|
7688
|
+
"2026-11-05T13:00:00_authentication_methods_totp_last_step": El
|
|
7613
7689
|
};
|
|
7614
7690
|
//#endregion
|
|
7615
7691
|
//#region migrate/migrate.ts
|
|
7616
|
-
async function
|
|
7617
|
-
|
|
7692
|
+
async function Ml(e, t = !1) {
|
|
7693
|
+
Us(t), t && console.log("migrating...");
|
|
7618
7694
|
let { error: n, results: r } = await new Me({
|
|
7619
7695
|
db: e,
|
|
7620
|
-
provider: new
|
|
7696
|
+
provider: new Is(jl)
|
|
7621
7697
|
}).migrateToLatest();
|
|
7622
7698
|
if (r?.forEach((e) => {
|
|
7623
7699
|
e.status === "Success" ? t && console.log(`migration "${e.migrationName}" was executed successfully`) : e.status === "Error" && console.error(`failed to execute migration "${e.migrationName}"`);
|
|
7624
7700
|
}), n) throw console.error("failed to migrate"), console.error(n), n;
|
|
7625
7701
|
}
|
|
7626
|
-
async function
|
|
7627
|
-
|
|
7702
|
+
async function Nl(e, t = !1) {
|
|
7703
|
+
Us(t), t && console.log("migrating...");
|
|
7628
7704
|
let { error: n, results: r } = await new Me({
|
|
7629
7705
|
db: e,
|
|
7630
|
-
provider: new
|
|
7706
|
+
provider: new Is(jl)
|
|
7631
7707
|
}).migrateDown();
|
|
7632
7708
|
if (r?.forEach((e) => {
|
|
7633
7709
|
e.status === "Success" ? t && console.log(`migration "${e.migrationName}" was reverted successfully`) : e.status === "Error" && console.error(`failed to execute migration "${e.migrationName}"`);
|
|
@@ -7635,22 +7711,22 @@ async function Sl(e, t = !1) {
|
|
|
7635
7711
|
}
|
|
7636
7712
|
//#endregion
|
|
7637
7713
|
//#region migrate/plan.ts
|
|
7638
|
-
var
|
|
7639
|
-
function
|
|
7714
|
+
var Pl = 5e3, Fl = class extends Error {};
|
|
7715
|
+
function Il(e) {
|
|
7640
7716
|
if (e.query.kind === "SelectQueryNode") return !0;
|
|
7641
7717
|
if (e.query.kind !== "RawNode") return !1;
|
|
7642
7718
|
let t = e.sql.trimStart();
|
|
7643
7719
|
return /^(select|show|explain|describe|desc)\b/i.test(t) ? !0 : /^pragma\b/i.test(t) && !t.includes("=");
|
|
7644
7720
|
}
|
|
7645
|
-
var
|
|
7721
|
+
var Ll = class {
|
|
7646
7722
|
inner;
|
|
7647
7723
|
captured;
|
|
7648
7724
|
constructor(e, t) {
|
|
7649
7725
|
this.inner = e, this.captured = t;
|
|
7650
7726
|
}
|
|
7651
7727
|
async executeQuery(e) {
|
|
7652
|
-
if (
|
|
7653
|
-
if (this.captured.length >=
|
|
7728
|
+
if (Il(e)) return this.inner.executeQuery(e);
|
|
7729
|
+
if (this.captured.length >= Pl) throw new Fl(`stopped after ${Pl} statements`);
|
|
7654
7730
|
return this.captured.push({
|
|
7655
7731
|
sql: e.sql,
|
|
7656
7732
|
parameters: e.parameters
|
|
@@ -7666,7 +7742,7 @@ var El = class {
|
|
|
7666
7742
|
function $() {
|
|
7667
7743
|
throw Error("not available in a migration dry run");
|
|
7668
7744
|
}
|
|
7669
|
-
var
|
|
7745
|
+
var Rl = {
|
|
7670
7746
|
init: async () => {},
|
|
7671
7747
|
acquireConnection: $,
|
|
7672
7748
|
beginTransaction: $,
|
|
@@ -7675,25 +7751,25 @@ var Dl = {
|
|
|
7675
7751
|
releaseConnection: $,
|
|
7676
7752
|
destroy: async () => {}
|
|
7677
7753
|
};
|
|
7678
|
-
function
|
|
7679
|
-
let n = e.getExecutor(), r = n.withConnectionProvider({ provideConnection: (e) => n.provideConnection((n) => e(new
|
|
7754
|
+
function zl(e, t) {
|
|
7755
|
+
let n = e.getExecutor(), r = n.withConnectionProvider({ provideConnection: (e) => n.provideConnection((n) => e(new Ll(n, t))) }), i = {
|
|
7680
7756
|
createAdapter: () => n.adapter,
|
|
7681
|
-
createDriver: () =>
|
|
7757
|
+
createDriver: () => Rl,
|
|
7682
7758
|
createQueryCompiler: () => $(),
|
|
7683
7759
|
createIntrospector: () => $()
|
|
7684
7760
|
};
|
|
7685
7761
|
return new f({
|
|
7686
7762
|
config: { dialect: i },
|
|
7687
7763
|
dialect: i,
|
|
7688
|
-
driver:
|
|
7764
|
+
driver: Rl,
|
|
7689
7765
|
executor: r
|
|
7690
7766
|
});
|
|
7691
7767
|
}
|
|
7692
|
-
async function
|
|
7693
|
-
|
|
7768
|
+
async function Bl(e) {
|
|
7769
|
+
Us(!1);
|
|
7694
7770
|
let t = await new Me({
|
|
7695
7771
|
db: e,
|
|
7696
|
-
provider: new
|
|
7772
|
+
provider: new Is(jl)
|
|
7697
7773
|
}).getMigrations(), n = t.filter((e) => e.executedAt).map((e) => e.name), r = t.filter((e) => !e.executedAt), i = n[n.length - 1], a = i ? r.find((e) => e.name < i) : void 0;
|
|
7698
7774
|
if (a) throw Error(`pending migration "${a.name}" sorts before already-executed "${i}"; migrateToLatest would refuse to run`);
|
|
7699
7775
|
let o = [];
|
|
@@ -7703,9 +7779,9 @@ async function kl(e) {
|
|
|
7703
7779
|
statements: n
|
|
7704
7780
|
};
|
|
7705
7781
|
try {
|
|
7706
|
-
await t.migration.up(
|
|
7782
|
+
await t.migration.up(zl(e, n));
|
|
7707
7783
|
} catch (e) {
|
|
7708
|
-
r.error = e instanceof Error ? e.message : String(e), e instanceof
|
|
7784
|
+
r.error = e instanceof Error ? e.message : String(e), e instanceof Fl && (r.truncated = !0);
|
|
7709
7785
|
}
|
|
7710
7786
|
o.push(r);
|
|
7711
7787
|
}
|
|
@@ -7714,7 +7790,7 @@ async function kl(e) {
|
|
|
7714
7790
|
pending: o
|
|
7715
7791
|
};
|
|
7716
7792
|
}
|
|
7717
|
-
function
|
|
7793
|
+
function Vl(e) {
|
|
7718
7794
|
if (e.pending.length === 0) return `-- Database is up to date (${e.executed.length} migrations executed).`;
|
|
7719
7795
|
let t = [`-- ${e.pending.length} pending migration(s); ${e.executed.length} already executed.`];
|
|
7720
7796
|
for (let n of e.pending) {
|
|
@@ -7729,7 +7805,7 @@ function Al(e) {
|
|
|
7729
7805
|
}
|
|
7730
7806
|
//#endregion
|
|
7731
7807
|
//#region src/index.ts
|
|
7732
|
-
function
|
|
7808
|
+
function Hl(e, t = { useTransactions: !0 }) {
|
|
7733
7809
|
let n = {
|
|
7734
7810
|
actions: et(e),
|
|
7735
7811
|
actionExecutions: ot(e),
|
|
@@ -7754,16 +7830,16 @@ function jl(e, t = { useTransactions: !0 }) {
|
|
|
7754
7830
|
keys: Sr(e),
|
|
7755
7831
|
loginSessions: ui(e),
|
|
7756
7832
|
logs: nn(e),
|
|
7757
|
-
logStreams:
|
|
7758
|
-
migrationSources:
|
|
7759
|
-
authenticationMethods:
|
|
7833
|
+
logStreams: qo(e),
|
|
7834
|
+
migrationSources: Yo(e),
|
|
7835
|
+
authenticationMethods: No(e),
|
|
7760
7836
|
passwords: hn(e),
|
|
7761
7837
|
promptSettings: mi(e),
|
|
7762
7838
|
promptPartials: hi(e),
|
|
7763
|
-
proxyRoutes:
|
|
7764
|
-
scimConfigurations:
|
|
7765
|
-
scimTokens:
|
|
7766
|
-
scimExternalIds:
|
|
7839
|
+
proxyRoutes: $o(e),
|
|
7840
|
+
scimConfigurations: ls(e),
|
|
7841
|
+
scimTokens: ds(e),
|
|
7842
|
+
scimExternalIds: ps(e),
|
|
7767
7843
|
refreshTokens: Ri(e),
|
|
7768
7844
|
resourceServers: ea(e),
|
|
7769
7845
|
rolePermissions: ha(e),
|
|
@@ -7774,11 +7850,11 @@ function jl(e, t = { useTransactions: !0 }) {
|
|
|
7774
7850
|
sessions: un(e),
|
|
7775
7851
|
sessionCleanup: Bi(e),
|
|
7776
7852
|
tenants: qt(e),
|
|
7777
|
-
tenantOperations:
|
|
7778
|
-
tenantOperationEvents:
|
|
7779
|
-
tenantOperationRows:
|
|
7780
|
-
tokenExchangeProfiles:
|
|
7781
|
-
rollouts:
|
|
7853
|
+
tenantOperations: hs(e),
|
|
7854
|
+
tenantOperationEvents: Os(e),
|
|
7855
|
+
tenantOperationRows: Ms(e),
|
|
7856
|
+
tokenExchangeProfiles: as(e),
|
|
7857
|
+
rollouts: Fs(e),
|
|
7782
7858
|
themes: $r(e),
|
|
7783
7859
|
universalLoginTemplates: Ir(e),
|
|
7784
7860
|
customText: To(e),
|
|
@@ -7789,9 +7865,9 @@ function jl(e, t = { useTransactions: !0 }) {
|
|
|
7789
7865
|
userOrganizations: $a(e),
|
|
7790
7866
|
stats: fo(e),
|
|
7791
7867
|
analytics: wo(e),
|
|
7792
|
-
outbox:
|
|
7868
|
+
outbox: Go(e),
|
|
7793
7869
|
async transaction(r) {
|
|
7794
|
-
return t.useTransactions === !1 ? r(n) : e.transaction().execute(async (e) => r(
|
|
7870
|
+
return t.useTransactions === !1 ? r(n) : e.transaction().execute(async (e) => r(Hl(e, {
|
|
7795
7871
|
...t,
|
|
7796
7872
|
useTransactions: !1
|
|
7797
7873
|
})));
|
|
@@ -7800,4 +7876,4 @@ function jl(e, t = { useTransactions: !0 }) {
|
|
|
7800
7876
|
return n;
|
|
7801
7877
|
}
|
|
7802
7878
|
//#endregion
|
|
7803
|
-
export {
|
|
7879
|
+
export { ts as createProxyDataAdapter, $o as createProxyRoutesAdapter, Hl as default, Vl as formatMigrationPlan, Nl as migrateDown, Ml as migrateToLatest, Bl as planMigrations };
|