dexie-cloud-addon 4.1.0-beta.38 → 4.1.0-beta.40
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/modern/dexie-cloud-addon.d.ts +0 -1
- package/dist/modern/dexie-cloud-addon.js +179 -171
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/dexie-cloud-client.d.ts +1 -0
- package/dist/modern/service-worker.js +23 -15
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.d.ts +0 -1
- package/dist/umd/dexie-cloud-addon.js +179 -171
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/dexie-cloud-client.d.ts +1 -0
- package/dist/umd/service-worker.js +23 -15
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.1.0-beta.
|
|
11
|
+
* Version 4.1.0-beta.40, Mon Jan 20 2025
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -4222,7 +4222,7 @@ var numberDef = {
|
|
|
4222
4222
|
},
|
|
4223
4223
|
};
|
|
4224
4224
|
|
|
4225
|
-
const bigIntDef = {
|
|
4225
|
+
const bigIntDef$1 = {
|
|
4226
4226
|
bigint: {
|
|
4227
4227
|
replace: (realVal) => {
|
|
4228
4228
|
return { $t: "bigint", v: "" + realVal };
|
|
@@ -4465,7 +4465,7 @@ var BlobDef = {
|
|
|
4465
4465
|
|
|
4466
4466
|
const builtin = {
|
|
4467
4467
|
...numberDef,
|
|
4468
|
-
...bigIntDef,
|
|
4468
|
+
...bigIntDef$1,
|
|
4469
4469
|
...DateDef,
|
|
4470
4470
|
...SetDef,
|
|
4471
4471
|
...MapDef,
|
|
@@ -4575,7 +4575,7 @@ class FakeBigInt {
|
|
|
4575
4575
|
this.v = value;
|
|
4576
4576
|
}
|
|
4577
4577
|
}
|
|
4578
|
-
const
|
|
4578
|
+
const bigIntDef = hasBigIntSupport
|
|
4579
4579
|
? {}
|
|
4580
4580
|
: {
|
|
4581
4581
|
bigint: {
|
|
@@ -4583,17 +4583,19 @@ const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), (hasBi
|
|
|
4583
4583
|
replace: (fakeBigInt) => {
|
|
4584
4584
|
return Object.assign({ $t: 'bigint' }, fakeBigInt);
|
|
4585
4585
|
},
|
|
4586
|
-
revive: ({ v
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4586
|
+
revive: ({ v }) => new FakeBigInt(v),
|
|
4587
|
+
},
|
|
4588
|
+
};
|
|
4589
|
+
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), { PropModification: {
|
|
4589
4590
|
test: (val) => val instanceof PropModification,
|
|
4590
4591
|
replace: (propModification) => {
|
|
4591
|
-
return Object.assign({ $t: 'PropModification' }, propModification);
|
|
4592
|
+
return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
|
|
4592
4593
|
},
|
|
4593
4594
|
revive: (_a) => {
|
|
4594
|
-
var
|
|
4595
|
-
|
|
4596
|
-
|
|
4595
|
+
var propModSpec = __rest(_a, ["$t"]) // keep the rest
|
|
4596
|
+
;
|
|
4597
|
+
return new PropModification(propModSpec);
|
|
4598
|
+
},
|
|
4597
4599
|
} });
|
|
4598
4600
|
const TSON = TypesonSimplified(builtin, defs);
|
|
4599
4601
|
const BISON = Bison(defs);
|
|
@@ -4741,11 +4743,12 @@ function syncWithServer(changes, y, syncState, baseRevs, db, databaseUrl, schema
|
|
|
4741
4743
|
db.syncStateChangedEvent.next({
|
|
4742
4744
|
phase: 'pushing',
|
|
4743
4745
|
});
|
|
4746
|
+
const body = TSON.stringify(syncRequest);
|
|
4744
4747
|
const res = yield fetch(`${databaseUrl}/sync`, {
|
|
4745
4748
|
method: 'post',
|
|
4746
4749
|
headers,
|
|
4747
4750
|
credentials: 'include', // For Arr Affinity cookie only, for better Rate-Limit counting only.
|
|
4748
|
-
body
|
|
4751
|
+
body,
|
|
4749
4752
|
});
|
|
4750
4753
|
//const contentLength = Number(res.headers.get('content-length'));
|
|
4751
4754
|
db.syncStateChangedEvent.next({
|
|
@@ -5580,7 +5583,12 @@ function _sync(db_1, options_1, schema_1) {
|
|
|
5580
5583
|
const usingYProps = Object.values(schema).some(tbl => { var _a; return (_a = tbl.yProps) === null || _a === void 0 ? void 0 : _a.length; });
|
|
5581
5584
|
const serverSupportsYprops = !!res.yMessages;
|
|
5582
5585
|
if (usingYProps && serverSupportsYprops) {
|
|
5583
|
-
|
|
5586
|
+
try {
|
|
5587
|
+
yield downloadYDocsFromServer(db, databaseUrl, newSyncState);
|
|
5588
|
+
}
|
|
5589
|
+
catch (error) {
|
|
5590
|
+
console.error('Failed to download Yjs documents from server', error);
|
|
5591
|
+
}
|
|
5584
5592
|
}
|
|
5585
5593
|
console.debug('SYNC DONE', { isInitialSync });
|
|
5586
5594
|
db.syncCompleteEvent.next();
|
|
@@ -8117,6 +8125,162 @@ function getTiedObjectId(realmId) {
|
|
|
8117
8125
|
return realmId.startsWith('rlm~') ? realmId.substr(4) : null;
|
|
8118
8126
|
}
|
|
8119
8127
|
|
|
8128
|
+
const ydocTriggers = {};
|
|
8129
|
+
const docIsAlreadyHooked = new WeakSet();
|
|
8130
|
+
const middlewares = new WeakMap();
|
|
8131
|
+
const createMiddleware = (db) => ({
|
|
8132
|
+
stack: 'dbcore',
|
|
8133
|
+
level: 10,
|
|
8134
|
+
name: 'yTriggerMiddleware',
|
|
8135
|
+
create: (down) => {
|
|
8136
|
+
return Object.assign(Object.assign({}, down), { transaction: (stores, mode, options) => {
|
|
8137
|
+
const idbtrans = down.transaction(stores, mode, options);
|
|
8138
|
+
idbtrans.addEventListener('complete', onTransactionCommitted);
|
|
8139
|
+
return idbtrans;
|
|
8140
|
+
}, table: (tblName) => {
|
|
8141
|
+
const coreTable = down.table(tblName);
|
|
8142
|
+
const triggerSpec = ydocTriggers[tblName];
|
|
8143
|
+
if (!triggerSpec)
|
|
8144
|
+
return coreTable;
|
|
8145
|
+
const { trigger, parentTable, prop } = triggerSpec;
|
|
8146
|
+
return Object.assign(Object.assign({}, coreTable), { mutate(req) {
|
|
8147
|
+
switch (req.type) {
|
|
8148
|
+
case 'add': {
|
|
8149
|
+
for (const yUpdateRow of req.values) {
|
|
8150
|
+
if (yUpdateRow.k == undefined)
|
|
8151
|
+
continue; // A syncer or garbage collection state does not point to a key
|
|
8152
|
+
const primaryKey = yUpdateRow.k;
|
|
8153
|
+
const doc = DexieYProvider.getDocCache(db).find(parentTable, primaryKey, prop);
|
|
8154
|
+
if (doc) {
|
|
8155
|
+
if (!docIsAlreadyHooked.has(doc)) {
|
|
8156
|
+
hookToDoc(doc, primaryKey, trigger);
|
|
8157
|
+
docIsAlreadyHooked.add(doc);
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
else {
|
|
8161
|
+
enqueueTrigger(db, tblName, primaryKey, trigger);
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
break;
|
|
8165
|
+
}
|
|
8166
|
+
case 'delete':
|
|
8167
|
+
// @ts-ignore
|
|
8168
|
+
if (req.trans._rejecting_y_ypdate) {
|
|
8169
|
+
// The deletion came from a rejection, not garbage collection.
|
|
8170
|
+
// When that happens, let the triggers run to compute new values
|
|
8171
|
+
// based on the deleted updates.
|
|
8172
|
+
coreTable
|
|
8173
|
+
.getMany({
|
|
8174
|
+
keys: req.keys,
|
|
8175
|
+
trans: req.trans,
|
|
8176
|
+
cache: 'immutable',
|
|
8177
|
+
})
|
|
8178
|
+
.then((updates) => {
|
|
8179
|
+
const keySet = new RangeSet();
|
|
8180
|
+
for (const { k } of updates) {
|
|
8181
|
+
if (k != undefined)
|
|
8182
|
+
keySet.addKey(k);
|
|
8183
|
+
}
|
|
8184
|
+
for (const interval of keySet) {
|
|
8185
|
+
enqueueTrigger(db, tblName, interval.from, trigger);
|
|
8186
|
+
}
|
|
8187
|
+
});
|
|
8188
|
+
}
|
|
8189
|
+
break;
|
|
8190
|
+
}
|
|
8191
|
+
return coreTable.mutate(req);
|
|
8192
|
+
} });
|
|
8193
|
+
} });
|
|
8194
|
+
},
|
|
8195
|
+
});
|
|
8196
|
+
let triggerExecPromise = null;
|
|
8197
|
+
let triggerScheduled = false;
|
|
8198
|
+
let scheduledTriggers = [];
|
|
8199
|
+
function $Y(db) {
|
|
8200
|
+
const $Y = db._options.Y;
|
|
8201
|
+
if (!$Y)
|
|
8202
|
+
throw new Error('Y library not supplied to Dexie constructor');
|
|
8203
|
+
return $Y;
|
|
8204
|
+
}
|
|
8205
|
+
function executeTriggers(triggersToRun) {
|
|
8206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8207
|
+
for (const { db, parentId, trigger, updatesTable } of triggersToRun) {
|
|
8208
|
+
// Load entire document into an Y.Doc instance:
|
|
8209
|
+
const updates = yield db
|
|
8210
|
+
.table(updatesTable)
|
|
8211
|
+
.where({ k: parentId })
|
|
8212
|
+
.toArray();
|
|
8213
|
+
const Y = $Y(db);
|
|
8214
|
+
const yDoc = new Y.Doc();
|
|
8215
|
+
for (const update of updates) {
|
|
8216
|
+
Y.applyUpdateV2(yDoc, update.u);
|
|
8217
|
+
}
|
|
8218
|
+
try {
|
|
8219
|
+
yield trigger(yDoc, parentId);
|
|
8220
|
+
}
|
|
8221
|
+
catch (error) {
|
|
8222
|
+
console.error(`Error in YDocTrigger ${error}`);
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
});
|
|
8226
|
+
}
|
|
8227
|
+
function enqueueTrigger(db, updatesTable, parentId, trigger) {
|
|
8228
|
+
scheduledTriggers.push({
|
|
8229
|
+
db,
|
|
8230
|
+
updatesTable,
|
|
8231
|
+
parentId,
|
|
8232
|
+
trigger,
|
|
8233
|
+
});
|
|
8234
|
+
}
|
|
8235
|
+
function onTransactionCommitted() {
|
|
8236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8237
|
+
if (!triggerScheduled && scheduledTriggers.length > 0) {
|
|
8238
|
+
triggerScheduled = true;
|
|
8239
|
+
if (triggerExecPromise)
|
|
8240
|
+
yield triggerExecPromise.catch(() => { });
|
|
8241
|
+
setTimeout(() => {
|
|
8242
|
+
// setTimeout() is to escape from Promise.PSD zones and never run within liveQueries or transaction scopes
|
|
8243
|
+
triggerScheduled = false;
|
|
8244
|
+
const triggersToRun = scheduledTriggers;
|
|
8245
|
+
scheduledTriggers = [];
|
|
8246
|
+
triggerExecPromise = executeTriggers(triggersToRun).finally(() => (triggerExecPromise = null));
|
|
8247
|
+
}, 0);
|
|
8248
|
+
}
|
|
8249
|
+
});
|
|
8250
|
+
}
|
|
8251
|
+
function hookToDoc(doc, parentId, trigger) {
|
|
8252
|
+
// From now on, keep listening to doc updates and execute the trigger when it happens there instead
|
|
8253
|
+
doc.on('updateV2', (update, origin) => {
|
|
8254
|
+
//Dexie.ignoreTransaction(()=>{
|
|
8255
|
+
trigger(doc, parentId);
|
|
8256
|
+
//});
|
|
8257
|
+
});
|
|
8258
|
+
/*
|
|
8259
|
+
NOT NEEDED because DexieYProvider's docCache will also listen to destroy and remove it from its cache:
|
|
8260
|
+
doc.on('destroy', ()=>{
|
|
8261
|
+
docIsAlreadyHooked.delete(doc);
|
|
8262
|
+
})
|
|
8263
|
+
*/
|
|
8264
|
+
}
|
|
8265
|
+
function defineYDocTrigger(table, prop, trigger) {
|
|
8266
|
+
var _a, _b;
|
|
8267
|
+
const updatesTable = (_b = (_a = table.schema.yProps) === null || _a === void 0 ? void 0 : _a.find((p) => p.prop === prop)) === null || _b === void 0 ? void 0 : _b.updatesTable;
|
|
8268
|
+
if (!updatesTable)
|
|
8269
|
+
throw new Error(`Table ${table.name} does not have a Yjs property named ${prop}`);
|
|
8270
|
+
ydocTriggers[updatesTable] = {
|
|
8271
|
+
trigger,
|
|
8272
|
+
parentTable: table.name,
|
|
8273
|
+
prop,
|
|
8274
|
+
};
|
|
8275
|
+
const db = table.db._novip;
|
|
8276
|
+
let mw = middlewares.get(db);
|
|
8277
|
+
if (!mw) {
|
|
8278
|
+
mw = createMiddleware(db);
|
|
8279
|
+
middlewares.set(db, mw);
|
|
8280
|
+
}
|
|
8281
|
+
db.use(mw);
|
|
8282
|
+
}
|
|
8283
|
+
|
|
8120
8284
|
const DEFAULT_OPTIONS = {
|
|
8121
8285
|
nameSuffix: true,
|
|
8122
8286
|
};
|
|
@@ -8157,7 +8321,7 @@ function dexieCloud(dexie) {
|
|
|
8157
8321
|
const syncComplete = new Subject();
|
|
8158
8322
|
dexie.cloud = {
|
|
8159
8323
|
// @ts-ignore
|
|
8160
|
-
version: "4.1.0-beta.
|
|
8324
|
+
version: "4.1.0-beta.40",
|
|
8161
8325
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8162
8326
|
schema: null,
|
|
8163
8327
|
get currentUserId() {
|
|
@@ -8475,164 +8639,8 @@ function dexieCloud(dexie) {
|
|
|
8475
8639
|
}
|
|
8476
8640
|
}
|
|
8477
8641
|
// @ts-ignore
|
|
8478
|
-
dexieCloud.version = "4.1.0-beta.
|
|
8642
|
+
dexieCloud.version = "4.1.0-beta.40";
|
|
8479
8643
|
Dexie.Cloud = dexieCloud;
|
|
8480
8644
|
|
|
8481
|
-
const ydocTriggers = {};
|
|
8482
|
-
const docIsAlreadyHooked = new WeakSet();
|
|
8483
|
-
const middlewares = new WeakMap();
|
|
8484
|
-
const createMiddleware = (db) => ({
|
|
8485
|
-
stack: 'dbcore',
|
|
8486
|
-
level: 10,
|
|
8487
|
-
name: 'yTriggerMiddleware',
|
|
8488
|
-
create: (down) => {
|
|
8489
|
-
return Object.assign(Object.assign({}, down), { transaction: (stores, mode, options) => {
|
|
8490
|
-
const idbtrans = down.transaction(stores, mode, options);
|
|
8491
|
-
idbtrans.addEventListener('complete', onTransactionCommitted);
|
|
8492
|
-
return idbtrans;
|
|
8493
|
-
}, table: (tblName) => {
|
|
8494
|
-
const coreTable = down.table(tblName);
|
|
8495
|
-
const triggerSpec = ydocTriggers[tblName];
|
|
8496
|
-
if (!triggerSpec)
|
|
8497
|
-
return coreTable;
|
|
8498
|
-
const { trigger, parentTable, prop } = triggerSpec;
|
|
8499
|
-
return Object.assign(Object.assign({}, coreTable), { mutate(req) {
|
|
8500
|
-
switch (req.type) {
|
|
8501
|
-
case 'add': {
|
|
8502
|
-
for (const yUpdateRow of req.values) {
|
|
8503
|
-
if (yUpdateRow.k == undefined)
|
|
8504
|
-
continue; // A syncer or garbage collection state does not point to a key
|
|
8505
|
-
const primaryKey = yUpdateRow.k;
|
|
8506
|
-
const doc = DexieYProvider.getDocCache(db).find(parentTable, primaryKey, prop);
|
|
8507
|
-
if (doc) {
|
|
8508
|
-
if (!docIsAlreadyHooked.has(doc)) {
|
|
8509
|
-
hookToDoc(doc, primaryKey, trigger);
|
|
8510
|
-
docIsAlreadyHooked.add(doc);
|
|
8511
|
-
}
|
|
8512
|
-
}
|
|
8513
|
-
else {
|
|
8514
|
-
enqueueTrigger(db, tblName, primaryKey, trigger);
|
|
8515
|
-
}
|
|
8516
|
-
}
|
|
8517
|
-
break;
|
|
8518
|
-
}
|
|
8519
|
-
case 'delete':
|
|
8520
|
-
// @ts-ignore
|
|
8521
|
-
if (req.trans._rejecting_y_ypdate) {
|
|
8522
|
-
// The deletion came from a rejection, not garbage collection.
|
|
8523
|
-
// When that happens, let the triggers run to compute new values
|
|
8524
|
-
// based on the deleted updates.
|
|
8525
|
-
coreTable
|
|
8526
|
-
.getMany({
|
|
8527
|
-
keys: req.keys,
|
|
8528
|
-
trans: req.trans,
|
|
8529
|
-
cache: 'immutable',
|
|
8530
|
-
})
|
|
8531
|
-
.then((updates) => {
|
|
8532
|
-
const keySet = new RangeSet();
|
|
8533
|
-
for (const { k } of updates) {
|
|
8534
|
-
if (k != undefined)
|
|
8535
|
-
keySet.addKey(k);
|
|
8536
|
-
}
|
|
8537
|
-
for (const interval of keySet) {
|
|
8538
|
-
enqueueTrigger(db, tblName, interval.from, trigger);
|
|
8539
|
-
}
|
|
8540
|
-
});
|
|
8541
|
-
}
|
|
8542
|
-
break;
|
|
8543
|
-
}
|
|
8544
|
-
return coreTable.mutate(req);
|
|
8545
|
-
} });
|
|
8546
|
-
} });
|
|
8547
|
-
},
|
|
8548
|
-
});
|
|
8549
|
-
let triggerExecPromise = null;
|
|
8550
|
-
let triggerScheduled = false;
|
|
8551
|
-
let scheduledTriggers = [];
|
|
8552
|
-
function $Y(db) {
|
|
8553
|
-
const $Y = db._options.Y;
|
|
8554
|
-
if (!$Y)
|
|
8555
|
-
throw new Error('Y library not supplied to Dexie constructor');
|
|
8556
|
-
return $Y;
|
|
8557
|
-
}
|
|
8558
|
-
function executeTriggers(triggersToRun) {
|
|
8559
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8560
|
-
for (const { db, parentId, trigger, updatesTable } of triggersToRun) {
|
|
8561
|
-
// Load entire document into an Y.Doc instance:
|
|
8562
|
-
const updates = yield db
|
|
8563
|
-
.table(updatesTable)
|
|
8564
|
-
.where({ k: parentId })
|
|
8565
|
-
.toArray();
|
|
8566
|
-
const Y = $Y(db);
|
|
8567
|
-
const yDoc = new Y.Doc();
|
|
8568
|
-
for (const update of updates) {
|
|
8569
|
-
Y.applyUpdateV2(yDoc, update.u);
|
|
8570
|
-
}
|
|
8571
|
-
try {
|
|
8572
|
-
yield trigger(yDoc, parentId);
|
|
8573
|
-
}
|
|
8574
|
-
catch (error) {
|
|
8575
|
-
console.error(`Error in YDocTrigger ${error}`);
|
|
8576
|
-
}
|
|
8577
|
-
}
|
|
8578
|
-
});
|
|
8579
|
-
}
|
|
8580
|
-
function enqueueTrigger(db, updatesTable, parentId, trigger) {
|
|
8581
|
-
scheduledTriggers.push({
|
|
8582
|
-
db,
|
|
8583
|
-
updatesTable,
|
|
8584
|
-
parentId,
|
|
8585
|
-
trigger,
|
|
8586
|
-
});
|
|
8587
|
-
}
|
|
8588
|
-
function onTransactionCommitted() {
|
|
8589
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8590
|
-
if (!triggerScheduled && scheduledTriggers.length > 0) {
|
|
8591
|
-
triggerScheduled = true;
|
|
8592
|
-
if (triggerExecPromise)
|
|
8593
|
-
yield triggerExecPromise.catch(() => { });
|
|
8594
|
-
setTimeout(() => {
|
|
8595
|
-
// setTimeout() is to escape from Promise.PSD zones and never run within liveQueries or transaction scopes
|
|
8596
|
-
triggerScheduled = false;
|
|
8597
|
-
const triggersToRun = scheduledTriggers;
|
|
8598
|
-
scheduledTriggers = [];
|
|
8599
|
-
triggerExecPromise = executeTriggers(triggersToRun).finally(() => (triggerExecPromise = null));
|
|
8600
|
-
}, 0);
|
|
8601
|
-
}
|
|
8602
|
-
});
|
|
8603
|
-
}
|
|
8604
|
-
function hookToDoc(doc, parentId, trigger) {
|
|
8605
|
-
// From now on, keep listening to doc updates and execute the trigger when it happens there instead
|
|
8606
|
-
doc.on('updateV2', (update, origin) => {
|
|
8607
|
-
//Dexie.ignoreTransaction(()=>{
|
|
8608
|
-
trigger(doc, parentId);
|
|
8609
|
-
//});
|
|
8610
|
-
});
|
|
8611
|
-
/*
|
|
8612
|
-
NOT NEEDED because DexieYProvider's docCache will also listen to destroy and remove it from its cache:
|
|
8613
|
-
doc.on('destroy', ()=>{
|
|
8614
|
-
docIsAlreadyHooked.delete(doc);
|
|
8615
|
-
})
|
|
8616
|
-
*/
|
|
8617
|
-
}
|
|
8618
|
-
function defineYDocTrigger(table, prop, trigger) {
|
|
8619
|
-
var _a, _b;
|
|
8620
|
-
const updatesTable = (_b = (_a = table.schema.yProps) === null || _a === void 0 ? void 0 : _a.find((p) => p.prop === prop)) === null || _b === void 0 ? void 0 : _b.updatesTable;
|
|
8621
|
-
if (!updatesTable)
|
|
8622
|
-
throw new Error(`Table ${table.name} does not have a Yjs property named ${prop}`);
|
|
8623
|
-
ydocTriggers[updatesTable] = {
|
|
8624
|
-
trigger,
|
|
8625
|
-
parentTable: table.name,
|
|
8626
|
-
prop,
|
|
8627
|
-
};
|
|
8628
|
-
const db = table.db._novip;
|
|
8629
|
-
let mw = middlewares.get(db);
|
|
8630
|
-
if (!mw) {
|
|
8631
|
-
mw = createMiddleware(db);
|
|
8632
|
-
middlewares.set(db, mw);
|
|
8633
|
-
}
|
|
8634
|
-
db.use(mw);
|
|
8635
|
-
}
|
|
8636
|
-
|
|
8637
8645
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|
|
8638
8646
|
//# sourceMappingURL=dexie-cloud-addon.js.map
|