@rpcbase/db 0.138.0 → 0.140.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/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 +2 -2
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +130 -54
- package/dist/migrations/index.js.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
|
@@ -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":"AAKA,eAAO,MAAM,6BAA6B,8CAYxC,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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { rpcbaseMongoResources };
|
|
1
|
+
import { rpcbaseRuntimeRtsRetentionMongoResources } from './runtimeRtsRetentionResources';
|
|
2
|
+
export { rpcbaseRuntimeRtsRetentionMongoResources as rpcbaseMongoResources };
|
|
3
3
|
export declare const rpcbaseMigrationSource: import('@rpcbase/migrations').MigrationSource;
|
|
4
4
|
export default rpcbaseMigrationSource;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,wCAAwC,EAAE,MAAM,gCAAgC,CAAA;AAGzF,OAAO,EAAE,wCAAwC,IAAI,qBAAqB,EAAE,CAAA;AAO5E,eAAO,MAAM,sBAAsB,+CAYjC,CAAA;AAEF,eAAe,sBAAsB,CAAA"}
|
package/dist/migrations/index.js
CHANGED
|
@@ -416,64 +416,140 @@ var rpcbaseMongoResources = defineMongoResources({
|
|
|
416
416
|
]
|
|
417
417
|
});
|
|
418
418
|
//#endregion
|
|
419
|
-
//#region src/migrations/
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
419
|
+
//#region src/migrations/20260814090000-baseline-global.ts
|
|
420
|
+
var _20260814090000_baseline_global_default = defineMigration({
|
|
421
|
+
__rpcbaseIntegrity: "467b0d0dc32bcaa0e026996aaa59093f63da44ba375649b015c5204d76c881bb",
|
|
422
|
+
id: "20260814090000-baseline-global",
|
|
423
|
+
scope: "global",
|
|
424
|
+
mode: "online",
|
|
425
|
+
rollback: "compatible",
|
|
426
|
+
resources: {
|
|
427
|
+
before: null,
|
|
428
|
+
after: rpcbaseMongoResources.checksum
|
|
429
|
+
},
|
|
430
|
+
async up({ helpers, resources }) {
|
|
431
|
+
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
432
|
+
for (const index of resources.after.indexes) {
|
|
433
|
+
if (index.options?.unique !== true) continue;
|
|
434
|
+
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
435
|
+
const partialFilter = index.options.partialFilterExpression;
|
|
436
|
+
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
437
|
+
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
438
|
+
...filter ? { filter } : {},
|
|
439
|
+
...index.options.collation ? { collation: index.options.collation } : {}
|
|
440
|
+
});
|
|
441
|
+
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
442
|
+
}
|
|
443
|
+
await helpers.reconcileResources(resources.after);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/migrations/20260814090100-baseline-tenant.ts
|
|
448
|
+
var _20260814090100_baseline_tenant_default = defineMigration({
|
|
449
|
+
__rpcbaseIntegrity: "a4ef8480c3befadcf18ea83bd77588946ff4ee7b4bb383ab8e59a68b7dee8f85",
|
|
450
|
+
id: "20260814090100-baseline-tenant",
|
|
451
|
+
scope: "tenant",
|
|
452
|
+
mode: "online",
|
|
453
|
+
rollback: "compatible",
|
|
454
|
+
resources: {
|
|
455
|
+
before: null,
|
|
456
|
+
after: rpcbaseMongoResources.checksum
|
|
457
|
+
},
|
|
458
|
+
async up({ helpers, resources }) {
|
|
459
|
+
if (!resources) throw new Error("Missing baseline resource snapshot");
|
|
460
|
+
for (const index of resources.after.indexes) {
|
|
461
|
+
if (index.options?.unique !== true) continue;
|
|
462
|
+
const sparseFilter = index.options.sparse === true ? { $or: Object.keys(index.key).map((field) => ({ [field]: { $exists: true } })) } : void 0;
|
|
463
|
+
const partialFilter = index.options.partialFilterExpression;
|
|
464
|
+
const filter = sparseFilter && partialFilter ? { $and: [partialFilter, sparseFilter] } : partialFilter ?? sparseFilter;
|
|
465
|
+
const duplicates = await helpers.findDuplicateKeys(index.collection, index.key, {
|
|
466
|
+
...filter ? { filter } : {},
|
|
467
|
+
...index.options.collation ? { collation: index.options.collation } : {}
|
|
468
|
+
});
|
|
469
|
+
if (duplicates.length > 0) throw new Error(`Cannot create unique index ${index.collection}.${index.name}: ${JSON.stringify(duplicates)}`);
|
|
446
470
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
471
|
+
await helpers.reconcileResources(resources.after);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/migrations/20260816090000-runtime-rts-retention.ts
|
|
476
|
+
var _20260816090000_runtime_rts_retention_default = defineMigration({
|
|
477
|
+
__rpcbaseIntegrity: "b9d2b856d968898563ec9089c6a77c9dab1c5ba02d0f7a0502324937fda9f999",
|
|
478
|
+
id: "20260816090000-runtime-rts-retention",
|
|
479
|
+
scope: "tenant",
|
|
480
|
+
mode: "online",
|
|
481
|
+
rollback: "compatible",
|
|
482
|
+
resources: {
|
|
483
|
+
before: "62e2e625d7af99bec6bb635ae75aeb3654db151a2162ec375f039664a9638816",
|
|
484
|
+
after: "d2f715097972b5e8d5c444a84441e80672e2d7e8d052c0f4947b739f995511cf"
|
|
485
|
+
},
|
|
486
|
+
async up({ db, resources }) {
|
|
487
|
+
if (!resources) throw new Error("Missing RTS retention resource snapshot");
|
|
488
|
+
const retention = resources.after.indexes.find((index) => index.collection === "rbrtschanges" && index.name === "ts_1")?.runtimeOptions?.expireAfterSeconds;
|
|
489
|
+
if (typeof retention !== "number") throw new Error("Missing RTS retention value");
|
|
490
|
+
await db.command({
|
|
491
|
+
collMod: "rbrtschanges",
|
|
492
|
+
index: {
|
|
493
|
+
name: "ts_1",
|
|
494
|
+
expireAfterSeconds: retention
|
|
469
495
|
}
|
|
470
|
-
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/migrations/baselineResources.ts
|
|
501
|
+
var rpcbaseBaselineMongoResources = defineMongoResources({
|
|
502
|
+
collections: [...rpcbaseMongoResources.collections],
|
|
503
|
+
indexes: rpcbaseMongoResources.indexes.map((index) => index.collection === "rbrtschanges" && index.name === "ts_1" ? {
|
|
504
|
+
...index,
|
|
505
|
+
options: {
|
|
506
|
+
...index.options,
|
|
507
|
+
expireAfterSeconds: 60
|
|
471
508
|
}
|
|
472
|
-
})
|
|
473
|
-
|
|
474
|
-
|
|
509
|
+
} : index),
|
|
510
|
+
searchIndexes: [...rpcbaseMongoResources.searchIndexes],
|
|
511
|
+
collectionValidators: [...rpcbaseMongoResources.collectionValidators]
|
|
512
|
+
});
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/migrations/runtimeRtsRetentionResources.ts
|
|
515
|
+
var rpcbaseRuntimeRtsRetentionMongoResources = defineMongoResources({
|
|
516
|
+
collections: [...rpcbaseBaselineMongoResources.collections],
|
|
517
|
+
indexes: rpcbaseBaselineMongoResources.indexes.map((index) => {
|
|
518
|
+
if (index.collection !== "rbrtschanges" || index.name !== "ts_1") return index;
|
|
519
|
+
const { options: indexOptions, ...resource } = index;
|
|
520
|
+
const { expireAfterSeconds: _baselineTtl, ...options } = indexOptions ?? {};
|
|
521
|
+
return {
|
|
522
|
+
...resource,
|
|
523
|
+
...Object.keys(options).length > 0 ? { options } : {},
|
|
524
|
+
runtimeOptions: { expireAfterSeconds: rtsChangesTtlSeconds }
|
|
525
|
+
};
|
|
526
|
+
}),
|
|
527
|
+
searchIndexes: [...rpcbaseBaselineMongoResources.searchIndexes],
|
|
528
|
+
collectionValidators: [...rpcbaseBaselineMongoResources.collectionValidators]
|
|
529
|
+
});
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/migrations/index.ts
|
|
532
|
+
var baselineResources = {
|
|
533
|
+
before: null,
|
|
534
|
+
after: rpcbaseBaselineMongoResources.checksum
|
|
535
|
+
};
|
|
536
|
+
var rpcbaseMigrationSource = defineMigrationSource({
|
|
537
|
+
name: "@rpcbase/db",
|
|
538
|
+
migrations: [
|
|
539
|
+
{
|
|
540
|
+
..._20260814090000_baseline_global_default,
|
|
541
|
+
resources: baselineResources
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
..._20260814090100_baseline_tenant_default,
|
|
545
|
+
resources: baselineResources
|
|
546
|
+
},
|
|
547
|
+
_20260816090000_runtime_rts_retention_default
|
|
548
|
+
],
|
|
549
|
+
resources: rpcbaseRuntimeRtsRetentionMongoResources,
|
|
550
|
+
resourceSnapshots: [rpcbaseBaselineMongoResources, rpcbaseRuntimeRtsRetentionMongoResources]
|
|
475
551
|
});
|
|
476
552
|
//#endregion
|
|
477
|
-
export { rpcbaseMigrationSource as default, rpcbaseMigrationSource, rpcbaseMongoResources };
|
|
553
|
+
export { rpcbaseMigrationSource as default, rpcbaseMigrationSource, rpcbaseRuntimeRtsRetentionMongoResources as rpcbaseMongoResources };
|
|
478
554
|
|
|
479
555
|
//# sourceMappingURL=index.js.map
|
|
@@ -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;AACf,IAAMC,QAAQ;AAEd,IAAaC,wBAAwBN,qBAAqB;CACxDO,aAAa;EACX;GAAEC,OAAON;GAAQO,MAAM;GAAmBJ;EAAM;EAChD;GAAEG,OAAON;GAAQO,MAAM;GAAaJ;EAAM;EAC1C;GAAEG,OAAON;GAAQO,MAAM;GAAWJ;EAAM;EACxC;GAAEG,OAAOJ;GAAQK,MAAM;GAA4BJ;EAAM;EACzD;GAAEG,OAAOJ;GAAQK,MAAM;GAAmBJ;EAAM;EAChD;GAAEG,OAAOJ;GAAQK,MAAM;GAA0BJ;EAAM;EACvD;GAAEG,OAAOJ;GAAQK,MAAM;GAAg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AC1C,EAAEC,KAAKC,OAAOC,KAAKR,MAAMS,GAAG,CAAC,CAACC,KAAKC,WAAW,GAAGA,QAAQ,EAAEC,SAAS,KAAK,EAAE,EAAE,EAAE,IAC/EC,KAAAA;IACJ,MAAMC,gBAAgBd,MAAME,QAAQa;IACpC,MAAMC,SAASZ,gBAAgBU,gBAC3B,EAAEG,MAAM,CAACH,eAAeV,YAAY,EAAE,IACtCU,iBAAiBV;IACrB,MAAMc,aAAa,MAAMpB,QAAQqB,kBAAkBnB,MAAMoB,YAAYpB,MAAMS,KAAK;KAC9E,GAAIO,SAAS,EAAEA,OAAO,IAAI,CAAC;KAC3B,GAAIhB,MAAME,QAAQmB,YAAY,EAAEA,WAAWrB,MAAME,QAAQmB,UAAU,IAAI,CAAC;IAC1E,CAAC;IACD,IAAIH,WAAWI,SAAS,GACtB,MAAM,IAAIvB,MAAM,8BAA8BC,MAAMoB,WAAU,GAAIpB,MAAMuB,KAAI,IAAKC,KAAKC,UAAUP,UAAU,GAAG;GAEjH;GACA,MAAMpB,QAAQ4B,mBAAmBjC,UAAUE,KAAK;EAClD;CACF,CCxBIkC,CAAc;CAEhBK,WAAWJ;CACXK,mBAAmB,CAACL,qBAAqB;AAC3C,CAAC"}
|
|
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","defineMigration","__rpcbaseIntegrity","id","scope","mode","rollback","resources","before","after","up","db","Error","retention","indexes","find","index","collection","name","runtimeOptions","expireAfterSeconds","command","collMod","defineMongoResources","rpcbaseMongoResources","rpcbaseBaselineMongoResources","collections","indexes","map","index","collection","name","options","expireAfterSeconds","searchIndexes","collectionValidators","defineMongoResources","rpcbaseBaselineMongoResources","rtsChangesTtlSeconds","rpcbaseRuntimeRtsRetentionMongoResources","collections","indexes","map","index","collection","name","options","indexOptions","resource","expireAfterSeconds","_baselineTtl","Object","keys","length","runtimeOptions","searchIndexes","collectionValidators","defineMigrationSource","baselineGlobal","baselineTenant","runtimeRtsRetention","rpcbaseBaselineMongoResources","rpcbaseRuntimeRtsRetentionMongoResources","rpcbaseMongoResources","baselineResources","before","after","checksum","rpcbaseMigrationSource","name","migrations","resources","resourceSnapshots"],"sources":["../../src/migrations/resources.ts","../../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/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 { 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\nimport { rpcbaseMongoResources } from \"./resources\"\n\n\nexport const rpcbaseBaselineMongoResources = defineMongoResources({\n collections: [...rpcbaseMongoResources.collections],\n indexes: rpcbaseMongoResources.indexes.map((index) => (\n index.collection === \"rbrtschanges\" && index.name === \"ts_1\"\n ? {\n ...index,\n options: { ...index.options, expireAfterSeconds: 60 },\n }\n : index\n )),\n searchIndexes: [...rpcbaseMongoResources.searchIndexes],\n collectionValidators: [...rpcbaseMongoResources.collectionValidators],\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 { 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 { rpcbaseRuntimeRtsRetentionMongoResources } from \"./runtimeRtsRetentionResources\"\n\n\nexport { rpcbaseRuntimeRtsRetentionMongoResources as rpcbaseMongoResources }\n\nconst baselineResources = {\n before: null,\n after: rpcbaseBaselineMongoResources.checksum,\n}\n\nexport const rpcbaseMigrationSource = defineMigrationSource({\n name: \"@rpcbase/db\",\n migrations: [\n { ...baselineGlobal, resources: baselineResources },\n { ...baselineTenant, resources: baselineResources },\n runtimeRtsRetention,\n ],\n resources: rpcbaseRuntimeRtsRetentionMongoResources,\n resourceSnapshots: [\n rpcbaseBaselineMongoResources,\n rpcbaseRuntimeRtsRetentionMongoResources,\n ],\n})\n\nexport default rpcbaseMigrationSource\n"],"mappings":";;;AAKA,IAAME,SAAS;AACf,IAAME,SAAS;AACf,IAAMC,QAAQ;AAEd,IAAaC,wBAAwBN,qBAAqB;CACxDO,aAAa;EACX;GAAEC,OAAON;GAAQO,MAAM;GAAmBJ;EAAM;EAChD;GAAEG,OAAON;GAAQO,MAAM;GAAaJ;EAAM;EAC1C;GAAEG,OAAON;GAAQO,MAAM;GAAWJ;EAAM;EACxC;GAAEG,OAAOJ;GAAQK,MAAM;GAA4BJ;EAAM;EACzD;GAAEG,OAAOJ;GAAQK,MAAM;GAAmBJ;EAAM;EAChD;GAAEG,OAAOJ;GAAQK,MAAM;GAA0BJ;EAAM;EACvD;GAAEG,OAAOJ;GAAQK,MAAM;GAAgBJ;EAAM;EAC7C;GAAEG,OAAOJ;GAAQK,MAAM;GAAiBJ;EAAM;EAC9C;GAAEG,OAAOJ;GAAQK,MAAM;GAA8BJ;EAAM;EAC3D;GAAEG,OAAOJ;GAAQK,MAAM;GAAmCJ;EAAM;EAChE;GAAEG,OAAOJ;GAAQK,MAAM;GAAkBJ;EAAM;EAC/C;GAAEG,OAAOJ;GAAQK,MAAM;GAAoBJ;EAAM;CAAC;CAEpDK,SAAS;EACP;GACEF,OAAON;GACPS,YAAY;GACZF,MAAM;GACNG,KAAK,EAAEC,WAAW,EAAE;GACpBC,SAAS,EAAEC,oBAAoB,EAAE;GACjCV;EACF;EACA;GACEG,OAAON;GACPS,YAAY;GACZF,MAAM;GACNG,KAAK,EAAEI,YAAY,EAAE;GACrBX;EACF;EACA;GACEG,OAAON;GACPS,YAAY;GACZF,MAAM;GACNG,KAAK,EAAEK,UAAU,EAAE;GACnBH,SAAS,EAAEI,QAAQ,KAAK;GACxBb;EACF;EAC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O;GACL,GAAGC;GACH,GAAIG,OAAOC,KAAKN,OAAO,CAAC,CAACO,SAAS,IAAI,EAAEP,QAAQ,IAAI,CAAC;GACrDQ,gBAAgB,EAAEL,oBAAoBX,qBAAqB;EAC7D;CACF,CAAC;CACDiB,eAAe,CAAC,GAAGlB,8BAA8BkB,aAAa;CAC9DC,sBAAsB,CAAC,GAAGnB,8BAA8BmB,oBAAoB;AAC9E,CAAC;;;ACTD,IAAMQ,oBAAoB;CACxBC,QAAQ;CACRC,OAAOL,8BAA8BM;AACvC;AAEA,IAAaC,yBAAyBX,sBAAsB;CAC1DY,MAAM;CACNC,YAAY;EACV;GAAE,GAAGZ;GAAgBa,WAAWP;EAAkB;EAClD;GAAE,GAAGL;GAAgBY,WAAWP;EAAkB;EAClDJ;CAAmB;CAErBW,WAAWT;CACXU,mBAAmB,CACjBX,+BACAC,wCAAwC;AAE5C,CAAC"}
|
|
@@ -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":"","sources":["../src/tenantProvisioning.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CA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AC,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.140.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",
|