@rpcbase/db 0.138.0 → 0.139.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/migrations/20260814090000-baseline-global.d.ts.map +1 -1
- package/dist/migrations/20260814090100-baseline-tenant.d.ts.map +1 -1
- package/dist/migrations/20260816090000-runtime-rts-retention.d.ts +3 -0
- package/dist/migrations/20260816090000-runtime-rts-retention.d.ts.map +1 -0
- package/dist/migrations/baselineResources.d.ts +2 -0
- package/dist/migrations/baselineResources.d.ts.map +1 -0
- package/dist/migrations/currentResources.d.ts.map +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +119 -55
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/resources.d.ts.map +1 -1
- package/dist/migrations/runtimeRtsRetentionResources.d.ts +2 -0
- package/dist/migrations/runtimeRtsRetentionResources.d.ts.map +1 -0
- package/dist/tenantProvisioning.d.ts +3 -0
- package/dist/tenantProvisioning.d.ts.map +1 -1
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20260814090000-baseline-global.d.ts","sourceRoot":"","sources":["../../src/migrations/20260814090000-baseline-global.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"20260814090000-baseline-global.d.ts","sourceRoot":"","sources":["../../src/migrations/20260814090000-baseline-global.ts"],"names":[],"mappings":";AAGA,wBA+BE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20260814090100-baseline-tenant.d.ts","sourceRoot":"","sources":["../../src/migrations/20260814090100-baseline-tenant.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"20260814090100-baseline-tenant.d.ts","sourceRoot":"","sources":["../../src/migrations/20260814090100-baseline-tenant.ts"],"names":[],"mappings":";AAGA,wBA+BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260816090000-runtime-rts-retention.d.ts","sourceRoot":"","sources":["../../src/migrations/20260816090000-runtime-rts-retention.ts"],"names":[],"mappings":";AAGA,wBAqBE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baselineResources.d.ts","sourceRoot":"","sources":["../../src/migrations/baselineResources.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B,8CAqTxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currentResources.d.ts","sourceRoot":"","sources":["../../src/migrations/currentResources.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"currentResources.d.ts","sourceRoot":"","sources":["../../src/migrations/currentResources.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,+BAA+B,oDAyB3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAInD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAEhC,eAAO,MAAM,sBAAsB,+CAajC,CAAA;AAEF,eAAe,sBAAsB,CAAA"}
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,10 +1,91 @@
|
|
|
1
1
|
import { t as rtsChangesTtlSeconds } from "../rtsChanges-xIGFCLGa.js";
|
|
2
2
|
import { defineMigration, defineMigrationSource, defineMongoResources } from "@rpcbase/migrations";
|
|
3
|
-
//#region src/migrations/
|
|
3
|
+
//#region src/migrations/20260814090000-baseline-global.ts
|
|
4
|
+
var _20260814090000_baseline_global_default = defineMigration({
|
|
5
|
+
__rpcbaseIntegrity: "1e3bb48e914f377136a22d79a78ba4164eb457be097003a675cfb8864df8baf2",
|
|
6
|
+
id: "20260814090000-baseline-global",
|
|
7
|
+
scope: "global",
|
|
8
|
+
mode: "online",
|
|
9
|
+
rollback: "compatible",
|
|
10
|
+
resources: {
|
|
11
|
+
before: null,
|
|
12
|
+
after: "62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816"
|
|
13
|
+
},
|
|
14
|
+
async up({ helpers, resources }) {
|
|
15
|
+
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
16
|
+
for (const index of resources.after.indexes) {
|
|
17
|
+
if (index.options?.unique !== true) continue;
|
|
18
|
+
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
19
|
+
const partialFilter = index.options.partialFilterExpression;
|
|
20
|
+
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
21
|
+
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
22
|
+
...filter ? { filter } : {},
|
|
23
|
+
...index.options.collation ? { collation: index.options.collation } : {}
|
|
24
|
+
});
|
|
25
|
+
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
26
|
+
}
|
|
27
|
+
await helpers.reconcileResources(resources.after);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/migrations/20260814090100-baseline-tenant.ts
|
|
32
|
+
var _20260814090100_baseline_tenant_default = defineMigration({
|
|
33
|
+
__rpcbaseIntegrity: "0a4fed8912aa300fdd36d7a783e2c00cf5db9a84057d1287340b236edfcd89e4",
|
|
34
|
+
id: "20260814090100-baseline-tenant",
|
|
35
|
+
scope: "tenant",
|
|
36
|
+
mode: "online",
|
|
37
|
+
rollback: "compatible",
|
|
38
|
+
resources: {
|
|
39
|
+
before: null,
|
|
40
|
+
after: "62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816"
|
|
41
|
+
},
|
|
42
|
+
async up({ helpers, resources }) {
|
|
43
|
+
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
44
|
+
for (const index of resources.after.indexes) {
|
|
45
|
+
if (index.options?.unique !== true) continue;
|
|
46
|
+
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
47
|
+
const partialFilter = index.options.partialFilterExpression;
|
|
48
|
+
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
49
|
+
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
50
|
+
...filter ? { filter } : {},
|
|
51
|
+
...index.options.collation ? { collation: index.options.collation } : {}
|
|
52
|
+
});
|
|
53
|
+
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
54
|
+
}
|
|
55
|
+
await helpers.reconcileResources(resources.after);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/migrations/20260816090000-runtime-rts-retention.ts
|
|
60
|
+
var _20260816090000_runtime_rts_retention_default = defineMigration({
|
|
61
|
+
__rpcbaseIntegrity: "b9d2b856d968898563ec9089c6a77c9dab1c5ba02d0f7a0502324937fda9f999",
|
|
62
|
+
id: "20260816090000-runtime-rts-retention",
|
|
63
|
+
scope: "tenant",
|
|
64
|
+
mode: "online",
|
|
65
|
+
rollback: "compatible",
|
|
66
|
+
resources: {
|
|
67
|
+
before: "62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816",
|
|
68
|
+
after: "d2f715097972b5e8d5c444a84441e80672e2d7e8d052c0f4947b739f995511cf"
|
|
69
|
+
},
|
|
70
|
+
async up({ db, resources }) {
|
|
71
|
+
if (!resources) throw new Error("Missing RTS retention resource snapshot");
|
|
72
|
+
const retention = resources.after.indexes.find((index) => index.collection === "rbrtschanges" && index.name === "ts_1")?.runtimeOptions?.expireAfterSeconds;
|
|
73
|
+
if (typeof retention !== "number") throw new Error("Missing RTS retention value");
|
|
74
|
+
await db.command({
|
|
75
|
+
collMod: "rbrtschanges",
|
|
76
|
+
index: {
|
|
77
|
+
name: "ts_1",
|
|
78
|
+
expireAfterSeconds: retention
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/migrations/baselineResources.ts
|
|
4
85
|
var global = "global";
|
|
5
86
|
var tenant = "tenant";
|
|
6
87
|
var owner = "@rpcbase/db";
|
|
7
|
-
var
|
|
88
|
+
var rpcbaseBaselineMongoResources = defineMongoResources({
|
|
8
89
|
collections: [
|
|
9
90
|
{
|
|
10
91
|
scope: global,
|
|
@@ -286,7 +367,7 @@ var rpcbaseMongoResources = defineMongoResources({
|
|
|
286
367
|
collection: "rbrtschanges",
|
|
287
368
|
name: "ts_1",
|
|
288
369
|
key: { ts: 1 },
|
|
289
|
-
options: { expireAfterSeconds:
|
|
370
|
+
options: { expireAfterSeconds: 60 },
|
|
290
371
|
owner
|
|
291
372
|
},
|
|
292
373
|
{
|
|
@@ -416,62 +497,45 @@ var rpcbaseMongoResources = defineMongoResources({
|
|
|
416
497
|
]
|
|
417
498
|
});
|
|
418
499
|
//#endregion
|
|
500
|
+
//#region src/migrations/runtimeRtsRetentionResources.ts
|
|
501
|
+
var rpcbaseRuntimeRtsRetentionMongoResources = defineMongoResources({
|
|
502
|
+
collections: [...rpcbaseBaselineMongoResources.collections],
|
|
503
|
+
indexes: rpcbaseBaselineMongoResources.indexes.map((index) => {
|
|
504
|
+
if (index.collection !== "rbrtschanges" || index.name !== "ts_1") return index;
|
|
505
|
+
const { options: indexOptions, ...resource } = index;
|
|
506
|
+
const { expireAfterSeconds: _baselineTtl, ...options } = indexOptions ?? {};
|
|
507
|
+
return {
|
|
508
|
+
...resource,
|
|
509
|
+
...Object.keys(options).length > 0 ? { options } : {},
|
|
510
|
+
runtimeOptions: { expireAfterSeconds: rtsChangesTtlSeconds }
|
|
511
|
+
};
|
|
512
|
+
}),
|
|
513
|
+
searchIndexes: [...rpcbaseBaselineMongoResources.searchIndexes],
|
|
514
|
+
collectionValidators: [...rpcbaseBaselineMongoResources.collectionValidators]
|
|
515
|
+
});
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/migrations/resources.ts
|
|
518
|
+
var rpcbaseMongoResources = defineMongoResources({
|
|
519
|
+
collections: [...rpcbaseRuntimeRtsRetentionMongoResources.collections],
|
|
520
|
+
indexes: [...rpcbaseRuntimeRtsRetentionMongoResources.indexes],
|
|
521
|
+
searchIndexes: [...rpcbaseRuntimeRtsRetentionMongoResources.searchIndexes],
|
|
522
|
+
collectionValidators: [...rpcbaseRuntimeRtsRetentionMongoResources.collectionValidators]
|
|
523
|
+
});
|
|
524
|
+
//#endregion
|
|
419
525
|
//#region src/migrations/index.ts
|
|
420
526
|
var rpcbaseMigrationSource = defineMigrationSource({
|
|
421
527
|
name: "@rpcbase/db",
|
|
422
|
-
migrations: [
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
rollback: "compatible",
|
|
428
|
-
resources: {
|
|
429
|
-
before: null,
|
|
430
|
-
after: rpcbaseMongoResources.checksum
|
|
431
|
-
},
|
|
432
|
-
async up({ helpers, resources }) {
|
|
433
|
-
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
434
|
-
for (const index of resources.after.indexes) {
|
|
435
|
-
if (index.options?.unique !== true) continue;
|
|
436
|
-
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
437
|
-
const partialFilter = index.options.partialFilterExpression;
|
|
438
|
-
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
439
|
-
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
440
|
-
...filter ? { filter } : {},
|
|
441
|
-
...index.options.collation ? { collation: index.options.collation } : {}
|
|
442
|
-
});
|
|
443
|
-
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
444
|
-
}
|
|
445
|
-
await helpers.reconcileResources(resources.after);
|
|
446
|
-
}
|
|
447
|
-
}), defineMigration({
|
|
448
|
-
__rpcbaseIntegrity: "a4ef8480c3befadcf18ea83bd77588946ff4ee7b4bb383ab8e59a68b7dee8f85",
|
|
449
|
-
id: "20260814090100-baseline-tenant",
|
|
450
|
-
scope: "tenant",
|
|
451
|
-
mode: "online",
|
|
452
|
-
rollback: "compatible",
|
|
453
|
-
resources: {
|
|
454
|
-
before: null,
|
|
455
|
-
after: rpcbaseMongoResources.checksum
|
|
456
|
-
},
|
|
457
|
-
async up({ helpers, resources }) {
|
|
458
|
-
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
459
|
-
for (const index of resources.after.indexes) {
|
|
460
|
-
if (index.options?.unique !== true) continue;
|
|
461
|
-
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
462
|
-
const partialFilter = index.options.partialFilterExpression;
|
|
463
|
-
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
464
|
-
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
465
|
-
...filter ? { filter } : {},
|
|
466
|
-
...index.options.collation ? { collation: index.options.collation } : {}
|
|
467
|
-
});
|
|
468
|
-
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
469
|
-
}
|
|
470
|
-
await helpers.reconcileResources(resources.after);
|
|
471
|
-
}
|
|
472
|
-
})],
|
|
528
|
+
migrations: [
|
|
529
|
+
_20260814090000_baseline_global_default,
|
|
530
|
+
_20260814090100_baseline_tenant_default,
|
|
531
|
+
_20260816090000_runtime_rts_retention_default
|
|
532
|
+
],
|
|
473
533
|
resources: rpcbaseMongoResources,
|
|
474
|
-
resourceSnapshots: [
|
|
534
|
+
resourceSnapshots: [
|
|
535
|
+
rpcbaseBaselineMongoResources,
|
|
536
|
+
rpcbaseRuntimeRtsRetentionMongoResources,
|
|
537
|
+
rpcbaseMongoResources
|
|
538
|
+
]
|
|
475
539
|
});
|
|
476
540
|
//#endregion
|
|
477
541
|
export { rpcbaseMigrationSource as default, rpcbaseMigrationSource, rpcbaseMongoResources };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineMongoResources","rtsChangesTtlSeconds","global","const","tenant","owner","rpcbaseMongoResources","collections","scope","name","indexes","collection","key","expiresAt","options","expireAfterSeconds","providerId","tenantId","unique","email","sparse","phone","tenants","createdAt","deliveryId","userId","archivedAt","readAt","seenAt","topic","tag","partialFilterExpression","$exists","drawerActive","modelName","seq","ts","provider","providerEventId","$type","subscriptionId","idempotencyKey","effectiveAt","occurredAt","scopeId","uploadId","index","defineMigration","rpcbaseMongoResources","__rpcbaseIntegrity","id","scope","mode","rollback","resources","before","after","checksum","up","helpers","Error","index","indexes","options","unique","sparseFilter","sparse","$or","Object","keys","key","map","field","$exists","undefined","partialFilter","partialFilterExpression","filter","$and","duplicates","findDuplicateKeys","collection","collation","length","name","JSON","stringify","reconcileResources","defineMigration","rpcbaseMongoResources","__rpcbaseIntegrity","id","scope","mode","rollback","resources","before","after","checksum","up","helpers","Error","index","indexes","options","unique","sparseFilter","sparse","$or","Object","keys","key","map","field","$exists","undefined","partialFilter","partialFilterExpression","filter","$and","duplicates","findDuplicateKeys","collection","collation","length","name","JSON","stringify","reconcileResources","defineMigrationSource","baselineGlobal","baselineTenant","rpcbaseMongoResources","rpcbaseMigrationSource","name","migrations","resources","resourceSnapshots"],"sources":["../../src/migrations/resources.ts","../../src/migrations/20260814090000-baseline-global.ts","../../src/migrations/20260814090100-baseline-tenant.ts","../../src/migrations/index.ts"],"sourcesContent":["import { defineMongoResources } from \"@rpcbase/migrations\"\n\nimport { rtsChangesTtlSeconds } from \"./rtsChanges\"\n\n\nconst global = \"global\" as const\nconst tenant = \"tenant\" as const\nconst owner = \"@rpcbase/db\"\n\nexport const rpcbaseMongoResources = defineMongoResources({\n collections: [\n { scope: global, name: \"rboauthrequests\", owner },\n { scope: global, name: \"rbtenants\", owner },\n { scope: global, name: \"rbusers\", owner },\n { scope: tenant, name: \"rbnotificationdeliveries\", owner },\n { scope: tenant, name: \"rbnotifications\", owner },\n { scope: tenant, name: \"rbnotificationsettings\", owner },\n { scope: tenant, name: \"rbrtschanges\", owner },\n { scope: tenant, name: \"rbrtscounters\", owner },\n { scope: tenant, name: \"rbtenantsubscriptionevents\", owner },\n { scope: tenant, name: \"rbtenantsubscriptionprojections\", owner },\n { scope: tenant, name: \"rbuploadchunks\", owner },\n { scope: tenant, name: \"rbuploadsessions\", owner },\n ],\n indexes: [\n {\n scope: global,\n collection: \"rboauthrequests\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: global,\n collection: \"rboauthrequests\",\n name: \"providerId_1\",\n key: { providerId: 1 },\n owner,\n },\n {\n scope: global,\n collection: \"rbtenants\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"email_1\",\n key: { email: 1 },\n options: { unique: true, sparse: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"phone_1\",\n key: { phone: 1 },\n options: { unique: true, sparse: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"tenants_1\",\n key: { tenants: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"createdAt_1\",\n key: { createdAt: 1 },\n options: { expireAfterSeconds: 7_776_000 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"deliveryId_1\",\n key: { deliveryId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"userId_1_createdAt_-1\",\n key: { userId: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"archivedAt_1\",\n key: { archivedAt: 1 },\n options: { expireAfterSeconds: 7_776_000 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"createdAt_1\",\n key: { createdAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"readAt_1\",\n key: { readAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"seenAt_1\",\n key: { seenAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"topic_1\",\n key: { topic: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_readAt_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, readAt: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_seenAt_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, seenAt: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_tag_1\",\n key: { userId: 1, tag: 1 },\n options: {\n unique: true,\n partialFilterExpression: { tag: { $exists: true }, drawerActive: true },\n },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationsettings\",\n name: \"userId_1\",\n key: { userId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationsettings\",\n name: \"userId_1_topicPreferences.topic_1\",\n key: { userId: 1, \"topicPreferences.topic\": 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"modelName_1\",\n key: { modelName: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"seq_1\",\n key: { seq: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"ts_1\",\n key: { ts: 1 },\n options: { expireAfterSeconds: rtsChangesTtlSeconds },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"provider_1_providerEventId_1\",\n key: { provider: 1, providerEventId: 1 },\n options: {\n unique: true,\n partialFilterExpression: {\n provider: { $type: \"string\" },\n providerEventId: { $type: \"string\" },\n },\n },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"subscriptionId_1\",\n key: { subscriptionId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1_idempotencyKey_1\",\n key: { tenantId: 1, idempotencyKey: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1_subscriptionId_1_effectiveAt_1_occurredAt_1\",\n key: { tenantId: 1, subscriptionId: 1, effectiveAt: 1, occurredAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1_scope_1_scopeId_1\",\n key: { tenantId: 1, scope: 1, scopeId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1_subscriptionId_1\",\n key: { tenantId: 1, subscriptionId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"uploadId_1\",\n key: { uploadId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"uploadId_1_index_1\",\n key: { uploadId: 1, index: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadsessions\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadsessions\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n ],\n})\n","import { defineMigration } from \"@rpcbase/migrations\"\n\nimport { rpcbaseMongoResources } from \"./resources\"\n\n\nexport default defineMigration({\n __rpcbaseIntegrity: \"467b0d0dc32bcaa0e026996aaa59093f63da44ba375649b015c5204d76c881bb\",\n id: \"20260814090000-baseline-global\",\n scope: \"global\",\n mode: \"online\",\n rollback: \"compatible\",\n resources: {\n before: null,\n after: rpcbaseMongoResources.checksum,\n },\n\n async up({ helpers, resources }) {\n if (!resources) throw new Error(\"Missing baseline resource snapshot\")\n for (const index of resources.after.indexes) {\n if (index.options?.unique !== true) continue\n const sparseFilter = index.options.sparse === true\n ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) }\n : undefined\n const partialFilter = index.options.partialFilterExpression\n const filter = sparseFilter && partialFilter\n ? { $and: [partialFilter, sparseFilter] }\n : partialFilter ?? sparseFilter\n const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {\n ...(filter ? { filter } : {}),\n ...(index.options.collation ? { collation: index.options.collation } : {}),\n })\n if (duplicates.length > 0) {\n throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`)\n }\n }\n await helpers.reconcileResources(resources.after)\n },\n})\n","import { defineMigration } from \"@rpcbase/migrations\"\n\nimport { rpcbaseMongoResources } from \"./resources\"\n\n\nexport default defineMigration({\n __rpcbaseIntegrity: \"a4ef8480c3befadcf18ea83bd77588946ff4ee7b4bb383ab8e59a68b7dee8f85\",\n id: \"20260814090100-baseline-tenant\",\n scope: \"tenant\",\n mode: \"online\",\n rollback: \"compatible\",\n resources: {\n before: null,\n after: rpcbaseMongoResources.checksum,\n },\n\n async up({ helpers, resources }) {\n if (!resources) throw new Error(\"Missing baseline resource snapshot\")\n for (const index of resources.after.indexes) {\n if (index.options?.unique !== true) continue\n const sparseFilter = index.options.sparse === true\n ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) }\n : undefined\n const partialFilter = index.options.partialFilterExpression\n const filter = sparseFilter && partialFilter\n ? { $and: [partialFilter, sparseFilter] }\n : partialFilter ?? sparseFilter\n const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {\n ...(filter ? { filter } : {}),\n ...(index.options.collation ? { collation: index.options.collation } : {}),\n })\n if (duplicates.length > 0) {\n throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`)\n }\n }\n await helpers.reconcileResources(resources.after)\n },\n})\n","import { defineMigrationSource } from \"@rpcbase/migrations\"\n\nimport baselineGlobal from \"./20260814090000-baseline-global\"\nimport baselineTenant from \"./20260814090100-baseline-tenant\"\nimport { rpcbaseMongoResources } from \"./resources\"\n\n\nexport { rpcbaseMongoResources }\n\nexport const rpcbaseMigrationSource = defineMigrationSource({\n name: \"@rpcbase/db\",\n migrations: [\n baselineGlobal,\n baselineTenant,\n ],\n resources: rpcbaseMongoResources,\n resourceSnapshots: [rpcbaseMongoResources],\n})\n\nexport default rpcbaseMigrationSource\n"],"mappings":";;;AAKA,IAAME,SAAS;AACf,IAAME,SAAS;A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ources","before","after","up","helpers","Error","index","indexes","options","unique","sparseFilter","sparse","$or","Object","keys","key","map","field","$exists","undefined","partialFilter","partialFilterExpression","filter","$and","duplicates","findDuplicateKeys","collection","collation","length","name","JSON","stringify","reconcileResources","defineMigration","__rpcbaseIntegrity","id","scope","mode","rollback","resources","before","after","up","helpers","Error","index","indexes","options","unique","sparseFilter","sparse","$or","Object","keys","key","map","field","$exists","undefined","partialFilter","partialFilterExpression","filter","$and","duplicates","findDuplicateKeys","collection","collation","length","name","JSON","stringify","reconcileResources","defineMigration","__rpcbaseIntegrity","id","scope","mode","rollback","resources","before","after","up","db","Error","retention","indexes","find","index","collection","name","runtimeOptions","expireAfterSeconds","command","collMod","defineMongoResources","global","const","tenant","owner","rpcbaseBaselineMongoResources","collections","scope","name","indexes","collection","key","expiresAt","options","expireAfterSeconds","providerId","tenantId","unique","email","sparse","phone","tenants","createdAt","deliveryId","userId","archivedAt","readAt","seenAt","topic","tag","partialFilterExpression","$exists","drawerActive","modelName","seq","ts","provider","providerEventId","$type","subscriptionId","idempotencyKey","effectiveAt","occurredAt","scopeId","uploadId","index","defineMongoResources","rpcbaseBaselineMongoResources","rtsChangesTtlSeconds","rpcbaseRuntimeRtsRetentionMongoResources","collections","indexes","map","index","collection","name","options","indexOptions","resource","expireAfterSeconds","_baselineTtl","Object","keys","length","runtimeOptions","searchIndexes","collectionValidators","defineMongoResources","rpcbaseRuntimeRtsRetentionMongoResources","rpcbaseMongoResources","collections","indexes","searchIndexes","collectionValidators","defineMigrationSource","baselineGlobal","baselineTenant","runtimeRtsRetention","rpcbaseBaselineMongoResources","rpcbaseMongoResources","rpcbaseRuntimeRtsRetentionMongoResources","rpcbaseMigrationSource","name","migrations","resources","resourceSnapshots"],"sources":["../../src/migrations/20260814090000-baseline-global.ts","../../src/migrations/20260814090100-baseline-tenant.ts","../../src/migrations/20260816090000-runtime-rts-retention.ts","../../src/migrations/baselineResources.ts","../../src/migrations/runtimeRtsRetentionResources.ts","../../src/migrations/resources.ts","../../src/migrations/index.ts"],"sourcesContent":["import { defineMigration } from \"@rpcbase/migrations\"\n\n\nexport default defineMigration({\n __rpcbaseIntegrity: \"1e3bb48e914f377136a22d79a78ba4164eb457be097003a675cfb8864df8baf2\",\n id: \"20260814090000-baseline-global\",\n scope: \"global\",\n mode: \"online\",\n rollback: \"compatible\",\n resources: {\n before: null,\n after: \"62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816\",\n },\n\n async up({ helpers, resources }) {\n if (!resources) throw new Error(\"Missing baseline resource snapshot\")\n for (const index of resources.after.indexes) {\n if (index.options?.unique !== true) continue\n const sparseFilter = index.options.sparse === true\n ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) }\n : undefined\n const partialFilter = index.options.partialFilterExpression\n const filter = sparseFilter && partialFilter\n ? { $and: [partialFilter, sparseFilter] }\n : partialFilter ?? sparseFilter\n const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {\n ...(filter ? { filter } : {}),\n ...(index.options.collation ? { collation: index.options.collation } : {}),\n })\n if (duplicates.length > 0) {\n throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`)\n }\n }\n await helpers.reconcileResources(resources.after)\n },\n})\n","import { defineMigration } from \"@rpcbase/migrations\"\n\n\nexport default defineMigration({\n __rpcbaseIntegrity: \"0a4fed8912aa300fdd36d7a783e2c00cf5db9a84057d1287340b236edfcd89e4\",\n id: \"20260814090100-baseline-tenant\",\n scope: \"tenant\",\n mode: \"online\",\n rollback: \"compatible\",\n resources: {\n before: null,\n after: \"62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816\",\n },\n\n async up({ helpers, resources }) {\n if (!resources) throw new Error(\"Missing baseline resource snapshot\")\n for (const index of resources.after.indexes) {\n if (index.options?.unique !== true) continue\n const sparseFilter = index.options.sparse === true\n ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) }\n : undefined\n const partialFilter = index.options.partialFilterExpression\n const filter = sparseFilter && partialFilter\n ? { $and: [partialFilter, sparseFilter] }\n : partialFilter ?? sparseFilter\n const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {\n ...(filter ? { filter } : {}),\n ...(index.options.collation ? { collation: index.options.collation } : {}),\n })\n if (duplicates.length > 0) {\n throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`)\n }\n }\n await helpers.reconcileResources(resources.after)\n },\n})\n","import { defineMigration } from \"@rpcbase/migrations\"\n\n\nexport default defineMigration({\n __rpcbaseIntegrity: \"b9d2b856d968898563ec9089c6a77c9dab1c5ba02d0f7a0502324937fda9f999\",\n id: \"20260816090000-runtime-rts-retention\",\n scope: \"tenant\",\n mode: \"online\",\n rollback: \"compatible\",\n resources: {\n before: \"62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816\",\n after: \"d2f715097972b5e8d5c444a84441e80672e2d7e8d052c0f4947b739f995511cf\",\n },\n\n async up({ db, resources }) {\n if (!resources) throw new Error(\"Missing RTS retention resource snapshot\")\n const retention = resources.after.indexes\n .find((index) => index.collection === \"rbrtschanges\" && index.name === \"ts_1\")\n ?.runtimeOptions?.expireAfterSeconds\n if (typeof retention !== \"number\") throw new Error(\"Missing RTS retention value\")\n await db.command({\n collMod: \"rbrtschanges\",\n index: { name: \"ts_1\", expireAfterSeconds: retention },\n })\n },\n})\n","import { defineMongoResources } from \"@rpcbase/migrations\"\n\n\nconst global = \"global\" as const\nconst tenant = \"tenant\" as const\nconst owner = \"@rpcbase/db\"\n\nexport const rpcbaseBaselineMongoResources = defineMongoResources({\n collections: [\n { scope: global, name: \"rboauthrequests\", owner },\n { scope: global, name: \"rbtenants\", owner },\n { scope: global, name: \"rbusers\", owner },\n { scope: tenant, name: \"rbnotificationdeliveries\", owner },\n { scope: tenant, name: \"rbnotifications\", owner },\n { scope: tenant, name: \"rbnotificationsettings\", owner },\n { scope: tenant, name: \"rbrtschanges\", owner },\n { scope: tenant, name: \"rbrtscounters\", owner },\n { scope: tenant, name: \"rbtenantsubscriptionevents\", owner },\n { scope: tenant, name: \"rbtenantsubscriptionprojections\", owner },\n { scope: tenant, name: \"rbuploadchunks\", owner },\n { scope: tenant, name: \"rbuploadsessions\", owner },\n ],\n indexes: [\n {\n scope: global,\n collection: \"rboauthrequests\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: global,\n collection: \"rboauthrequests\",\n name: \"providerId_1\",\n key: { providerId: 1 },\n owner,\n },\n {\n scope: global,\n collection: \"rbtenants\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"email_1\",\n key: { email: 1 },\n options: { unique: true, sparse: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"phone_1\",\n key: { phone: 1 },\n options: { unique: true, sparse: true },\n owner,\n },\n {\n scope: global,\n collection: \"rbusers\",\n name: \"tenants_1\",\n key: { tenants: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"createdAt_1\",\n key: { createdAt: 1 },\n options: { expireAfterSeconds: 7_776_000 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"deliveryId_1\",\n key: { deliveryId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationdeliveries\",\n name: \"userId_1_createdAt_-1\",\n key: { userId: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"archivedAt_1\",\n key: { archivedAt: 1 },\n options: { expireAfterSeconds: 7_776_000 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"createdAt_1\",\n key: { createdAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"readAt_1\",\n key: { readAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"seenAt_1\",\n key: { seenAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"topic_1\",\n key: { topic: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_readAt_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, readAt: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_seenAt_1_archivedAt_1_createdAt_-1\",\n key: { userId: 1, seenAt: 1, archivedAt: 1, createdAt: -1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotifications\",\n name: \"userId_1_tag_1\",\n key: { userId: 1, tag: 1 },\n options: {\n unique: true,\n partialFilterExpression: { tag: { $exists: true }, drawerActive: true },\n },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationsettings\",\n name: \"userId_1\",\n key: { userId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbnotificationsettings\",\n name: \"userId_1_topicPreferences.topic_1\",\n key: { userId: 1, \"topicPreferences.topic\": 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"modelName_1\",\n key: { modelName: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"seq_1\",\n key: { seq: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbrtschanges\",\n name: \"ts_1\",\n key: { ts: 1 },\n options: { expireAfterSeconds: 60 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"provider_1_providerEventId_1\",\n key: { provider: 1, providerEventId: 1 },\n options: {\n unique: true,\n partialFilterExpression: {\n provider: { $type: \"string\" },\n providerEventId: { $type: \"string\" },\n },\n },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"subscriptionId_1\",\n key: { subscriptionId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1_idempotencyKey_1\",\n key: { tenantId: 1, idempotencyKey: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionevents\",\n name: \"tenantId_1_subscriptionId_1_effectiveAt_1_occurredAt_1\",\n key: { tenantId: 1, subscriptionId: 1, effectiveAt: 1, occurredAt: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1\",\n key: { tenantId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1_scope_1_scopeId_1\",\n key: { tenantId: 1, scope: 1, scopeId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbtenantsubscriptionprojections\",\n name: \"tenantId_1_subscriptionId_1\",\n key: { tenantId: 1, subscriptionId: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"uploadId_1\",\n key: { uploadId: 1 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadchunks\",\n name: \"uploadId_1_index_1\",\n key: { uploadId: 1, index: 1 },\n options: { unique: true },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadsessions\",\n name: \"expiresAt_1\",\n key: { expiresAt: 1 },\n options: { expireAfterSeconds: 0 },\n owner,\n },\n {\n scope: tenant,\n collection: \"rbuploadsessions\",\n name: \"userId_1\",\n key: { userId: 1 },\n owner,\n },\n ],\n})\n","import { defineMongoResources } from \"@rpcbase/migrations\"\n\nimport { rpcbaseBaselineMongoResources } from \"./baselineResources\"\nimport { rtsChangesTtlSeconds } from \"./rtsChanges\"\n\n\nexport const rpcbaseRuntimeRtsRetentionMongoResources = defineMongoResources({\n collections: [...rpcbaseBaselineMongoResources.collections],\n indexes: rpcbaseBaselineMongoResources.indexes.map((index) => {\n if (index.collection !== \"rbrtschanges\" || index.name !== \"ts_1\") return index\n const { options: indexOptions, ...resource } = index\n const { expireAfterSeconds: _baselineTtl, ...options } = indexOptions ?? {}\n return {\n ...resource,\n ...(Object.keys(options).length > 0 ? { options } : {}),\n runtimeOptions: { expireAfterSeconds: rtsChangesTtlSeconds },\n }\n }),\n searchIndexes: [...rpcbaseBaselineMongoResources.searchIndexes],\n collectionValidators: [...rpcbaseBaselineMongoResources.collectionValidators],\n})\n","import { defineMongoResources } from \"@rpcbase/migrations\"\n\nimport { rpcbaseRuntimeRtsRetentionMongoResources } from \"./runtimeRtsRetentionResources\"\n\n\nexport const rpcbaseMongoResources = defineMongoResources({\n collections: [...rpcbaseRuntimeRtsRetentionMongoResources.collections],\n indexes: [...rpcbaseRuntimeRtsRetentionMongoResources.indexes],\n searchIndexes: [...rpcbaseRuntimeRtsRetentionMongoResources.searchIndexes],\n collectionValidators: [...rpcbaseRuntimeRtsRetentionMongoResources.collectionValidators],\n})\n","import { defineMigrationSource } from \"@rpcbase/migrations\"\n\nimport baselineGlobal from \"./20260814090000-baseline-global\"\nimport baselineTenant from \"./20260814090100-baseline-tenant\"\nimport runtimeRtsRetention from \"./20260816090000-runtime-rts-retention\"\nimport { rpcbaseBaselineMongoResources } from \"./baselineResources\"\nimport { rpcbaseMongoResources } from \"./resources\"\nimport { rpcbaseRuntimeRtsRetentionMongoResources } from \"./runtimeRtsRetentionResources\"\n\n\nexport { rpcbaseMongoResources }\n\nexport const rpcbaseMigrationSource = defineMigrationSource({\n name: \"@rpcbase/db\",\n migrations: [\n baselineGlobal,\n baselineTenant,\n runtimeRtsRetention,\n ],\n resources: rpcbaseMongoResources,\n resourceSnapshots: [\n rpcbaseBaselineMongoResources,\n rpcbaseRuntimeRtsRetentionMongoResources,\n rpcbaseMongoResources,\n ],\n})\n\nexport default rpcbaseMigrationSource\n"],"mappings":";;;AAGA,IAAA,0CAAeA,gBAAgB;CAC7BC,oBAAoB;CACpBC,IAAI;CACJC,OAAO;CACPC,MAAM;CACNC,UAAU;CACVC,WAAW;EACTC,QAAQ;EACRC,OAAO;CACT;CAEA,MAAMC,GAAG,EAAEC,SAASJ,aAAa;EAC/B,IAAI,CAACA,WAAW,MAAM,IAAIK,MAAM,oCAAoC;EACpE,KAAK,MAAMC,SAASN,UAAUE,MAAMK,SAAS;GAC3C,IAAID,MAAME,SAASC,WAAW,MAAM;GACpC,MAAMC,eAAeJ,MAAME,QAAQG,WAAW,OAC1C,EAAEC,KAAKC,OAAOC,KAAKR,MAAMS,GAAG,CAAC,CAACC,KAAKC,WAAW,GAAGA,QAAQ,EAAEC,SAAS,KAAK,EAAE,EAAE,EAAE,IAC/EC,KAAAA;GACJ,MAAMC,gBAAgBd,MAAME,QAAQa;GACpC,MAAMC,SAASZ,gBAAgBU,gBAC3B,EAAEG,MAAM,CAACH,eAAeV,YAAY,EAAE,IACtCU,iBAAiBV;GACrB,MAAMc,aAAa,MAAMpB,QAAQqB,kBAAkBnB,MAAMoB,YAAYpB,MAAMS,KAAK;IAC9E,GAAIO,SAAS,EAAEA,OAAO,IAAI,CAAC;IAC3B,GAAIhB,MAAME,QAAQmB,YAAY,EAAEA,WAAWrB,MAAME,QAAQmB,UAAU,IAAI,CAAC;GAC1E,CAAC;GACD,IAAIH,WAAWI,SAAS,GACtB,MAAM,I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,sBAAsB,CAAC,GAAGnB,8BAA8BmB,oBAAoB;AAC9E,CAAC;;;ACfD,IAAaG,wBAAwBF,qBAAqB;CACxDG,aAAa,CAAC,GAAGF,yCAAyCE,WAAW;CACrEC,SAAS,CAAC,GAAGH,yCAAyCG,OAAO;CAC7DC,eAAe,CAAC,GAAGJ,yCAAyCI,aAAa;CACzEC,sBAAsB,CAAC,GAAGL,yCAAyCK,oBAAoB;AACzF,CAAC;;;ACED,IAAaQ,yBAAyBP,sBAAsB;CAC1DQ,MAAM;CACNC,YAAY;EACVR;EACAC;EACAC;CAAmB;CAErBO,WAAWL;CACXM,mBAAmB;EACjBP;EACAE;EACAD;CAAqB;AAEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/migrations/resources.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/migrations/resources.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,8CAKhC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeRtsRetentionResources.d.ts","sourceRoot":"","sources":["../../src/migrations/runtimeRtsRetentionResources.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wCAAwC,8CAcnD,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
type TenantProvisioner = (tenantId: string) => Promise<void>;
|
|
2
2
|
type TenantModel = {
|
|
3
3
|
create(document: Record<string, unknown>): Promise<unknown>;
|
|
4
|
+
findOne?(filter: Record<string, unknown>): PromiseLike<{
|
|
5
|
+
provisioningStatus?: string;
|
|
6
|
+
} | null>;
|
|
4
7
|
updateOne(filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
|
|
5
8
|
matchedCount?: number;
|
|
6
9
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenantProvisioning.d.ts","sourceRoot":"","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E,OAAO,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACtC,CAAA;AAKD,eAAO,MAAM,mCAAmC,GAAI,aAAa,iBAAiB,eAKjF,CAAA;AAMD,eAAO,MAAM,uBAAuB,GAClC,QAAQ,WAAW,EACnB,QAAQ;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,KACnE,OAAO,CAAC,IAAI,CAsCd,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.139.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
"readyWhen": {
|
|
67
67
|
"lineMatches": "^(?:\\u001b\\[[0-9;]*m)*built in .*\\.(?:\\u001b\\[[0-9;]*m)*$"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"dependencies": [
|
|
71
|
+
"../migrations:build-watch"
|
|
72
|
+
]
|
|
70
73
|
},
|
|
71
74
|
"release": {
|
|
72
75
|
"command": "../../scripts/publish.js",
|