dexie-cloud-addon 4.2.1 → 4.2.2
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.js +125 -60
- 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/service-worker.js +125 -60
- 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.js +126 -61
- 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/service-worker.js +126 -61
- 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 +3 -3
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.2.
|
|
11
|
+
* Version 4.2.2, Sat Oct 04 2025
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -4284,6 +4284,7 @@ function createMutationTrackingMiddleware({ currentUserObservable, db, }) {
|
|
|
4284
4284
|
let values = 'values' in req ? req.values : [];
|
|
4285
4285
|
let changeSpec = 'changeSpec' in req ? req.changeSpec : undefined;
|
|
4286
4286
|
let updates = 'updates' in req ? req.updates : undefined;
|
|
4287
|
+
let upsert = updates && 'upsert' in req ? req.upsert : false;
|
|
4287
4288
|
if (hasFailures) {
|
|
4288
4289
|
keys = keys.filter((_, idx) => !failures[idx]);
|
|
4289
4290
|
values = values.filter((_, idx) => !failures[idx]);
|
|
@@ -4315,29 +4316,32 @@ function createMutationTrackingMiddleware({ currentUserObservable, db, }) {
|
|
|
4315
4316
|
};
|
|
4316
4317
|
const validKeys = new RangeSet();
|
|
4317
4318
|
let anyChangeSpecBecameEmpty = false;
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4319
|
+
if (!upsert) {
|
|
4320
|
+
for (let i = 0, l = strippedChangeSpecs.length; i < l; ++i) {
|
|
4321
|
+
if (Object.keys(strippedChangeSpecs[i]).length > 0) {
|
|
4322
|
+
newUpdates.keys.push(updates.keys[i]);
|
|
4323
|
+
newUpdates.changeSpecs.push(strippedChangeSpecs[i]);
|
|
4324
|
+
validKeys.addKey(updates.keys[i]);
|
|
4325
|
+
}
|
|
4326
|
+
else {
|
|
4327
|
+
anyChangeSpecBecameEmpty = true;
|
|
4328
|
+
}
|
|
4326
4329
|
}
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4330
|
+
updates = newUpdates;
|
|
4331
|
+
if (anyChangeSpecBecameEmpty) {
|
|
4332
|
+
// Some keys were stripped. We must also strip them from keys and values
|
|
4333
|
+
// unless this is an upsert operation in which case we want to send them all.
|
|
4334
|
+
let newKeys = [];
|
|
4335
|
+
let newValues = [];
|
|
4336
|
+
for (let i = 0, l = keys.length; i < l; ++i) {
|
|
4337
|
+
if (validKeys.hasKey(keys[i])) {
|
|
4338
|
+
newKeys.push(keys[i]);
|
|
4339
|
+
newValues.push(values[i]);
|
|
4340
|
+
}
|
|
4337
4341
|
}
|
|
4342
|
+
keys = newKeys;
|
|
4343
|
+
values = newValues;
|
|
4338
4344
|
}
|
|
4339
|
-
keys = newKeys;
|
|
4340
|
-
values = newValues;
|
|
4341
4345
|
}
|
|
4342
4346
|
}
|
|
4343
4347
|
}
|
|
@@ -4379,49 +4383,59 @@ function createMutationTrackingMiddleware({ currentUserObservable, db, }) {
|
|
|
4379
4383
|
userId,
|
|
4380
4384
|
values,
|
|
4381
4385
|
}
|
|
4382
|
-
:
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
}
|
|
4394
|
-
: changeSpec
|
|
4386
|
+
: upsert ? {
|
|
4387
|
+
type: 'upsert',
|
|
4388
|
+
ts,
|
|
4389
|
+
opNo,
|
|
4390
|
+
keys,
|
|
4391
|
+
values,
|
|
4392
|
+
changeSpecs: updates.changeSpecs.filter((_, idx) => !failures[idx]),
|
|
4393
|
+
txid,
|
|
4394
|
+
userId,
|
|
4395
|
+
}
|
|
4396
|
+
: criteria && changeSpec
|
|
4395
4397
|
? {
|
|
4396
|
-
//
|
|
4397
|
-
type: '
|
|
4398
|
+
// Common changeSpec for all keys
|
|
4399
|
+
type: 'modify',
|
|
4398
4400
|
ts,
|
|
4399
4401
|
opNo,
|
|
4400
4402
|
keys,
|
|
4401
|
-
|
|
4403
|
+
criteria,
|
|
4404
|
+
changeSpec,
|
|
4402
4405
|
txid,
|
|
4403
4406
|
userId,
|
|
4404
4407
|
}
|
|
4405
|
-
:
|
|
4408
|
+
: changeSpec
|
|
4406
4409
|
? {
|
|
4407
|
-
//
|
|
4410
|
+
// In case criteria involved an unsynced property, we go for keys instead.
|
|
4408
4411
|
type: 'update',
|
|
4409
4412
|
ts,
|
|
4410
4413
|
opNo,
|
|
4411
|
-
keys: updates.keys,
|
|
4412
|
-
changeSpecs: updates.changeSpecs,
|
|
4413
|
-
txid,
|
|
4414
|
-
userId,
|
|
4415
|
-
}
|
|
4416
|
-
: {
|
|
4417
|
-
type: 'upsert',
|
|
4418
|
-
ts,
|
|
4419
|
-
opNo,
|
|
4420
4414
|
keys,
|
|
4421
|
-
|
|
4415
|
+
changeSpecs: keys.map(() => changeSpec),
|
|
4422
4416
|
txid,
|
|
4423
4417
|
userId,
|
|
4424
|
-
}
|
|
4418
|
+
}
|
|
4419
|
+
: updates
|
|
4420
|
+
? {
|
|
4421
|
+
// One changeSpec per key
|
|
4422
|
+
type: 'update',
|
|
4423
|
+
ts,
|
|
4424
|
+
opNo,
|
|
4425
|
+
keys: updates.keys,
|
|
4426
|
+
changeSpecs: updates.changeSpecs,
|
|
4427
|
+
txid,
|
|
4428
|
+
userId,
|
|
4429
|
+
}
|
|
4430
|
+
: {
|
|
4431
|
+
type: 'upsert',
|
|
4432
|
+
ts,
|
|
4433
|
+
opNo,
|
|
4434
|
+
keys,
|
|
4435
|
+
values,
|
|
4436
|
+
txid,
|
|
4437
|
+
userId,
|
|
4438
|
+
};
|
|
4425
4439
|
if ('isAdditionalChunk' in req && req.isAdditionalChunk) {
|
|
4426
4440
|
mut.isAdditionalChunk = true;
|
|
4427
4441
|
}
|
|
@@ -5316,34 +5330,85 @@ const Styles = {
|
|
|
5316
5330
|
alignItems: "center",
|
|
5317
5331
|
display: "flex",
|
|
5318
5332
|
justifyContent: "center",
|
|
5333
|
+
padding: "16px",
|
|
5334
|
+
boxSizing: "border-box"
|
|
5319
5335
|
},
|
|
5320
5336
|
DialogInner: {
|
|
5321
5337
|
position: "relative",
|
|
5322
5338
|
color: "#222",
|
|
5323
5339
|
backgroundColor: "#fff",
|
|
5324
|
-
padding: "
|
|
5340
|
+
padding: "24px",
|
|
5325
5341
|
marginBottom: "2em",
|
|
5326
|
-
maxWidth: "
|
|
5342
|
+
maxWidth: "400px",
|
|
5343
|
+
width: "100%",
|
|
5327
5344
|
maxHeight: "90%",
|
|
5328
5345
|
overflowY: "auto",
|
|
5329
5346
|
border: "3px solid #3d3d5d",
|
|
5330
5347
|
borderRadius: "8px",
|
|
5331
5348
|
boxShadow: "0 0 80px 10px #666",
|
|
5332
|
-
width: "auto",
|
|
5333
5349
|
fontFamily: "sans-serif",
|
|
5350
|
+
boxSizing: "border-box"
|
|
5334
5351
|
},
|
|
5335
5352
|
Input: {
|
|
5336
5353
|
height: "35px",
|
|
5337
|
-
width: "
|
|
5354
|
+
width: "100%",
|
|
5355
|
+
maxWidth: "100%",
|
|
5338
5356
|
borderColor: "#ccf4",
|
|
5339
5357
|
outline: "none",
|
|
5340
|
-
fontSize: "
|
|
5341
|
-
padding: "8px"
|
|
5358
|
+
fontSize: "16px",
|
|
5359
|
+
padding: "8px",
|
|
5360
|
+
boxSizing: "border-box"
|
|
5361
|
+
},
|
|
5362
|
+
Button: {
|
|
5363
|
+
padding: "10px 20px",
|
|
5364
|
+
margin: "0 4px",
|
|
5365
|
+
border: "1px solid #d1d5db",
|
|
5366
|
+
borderRadius: "6px",
|
|
5367
|
+
backgroundColor: "#ffffff",
|
|
5368
|
+
cursor: "pointer",
|
|
5369
|
+
fontSize: "14px",
|
|
5370
|
+
fontWeight: "500",
|
|
5371
|
+
color: "#374151",
|
|
5372
|
+
transition: "all 0.2s ease"
|
|
5373
|
+
},
|
|
5374
|
+
PrimaryButton: {
|
|
5375
|
+
padding: "10px 20px",
|
|
5376
|
+
margin: "0 4px",
|
|
5377
|
+
border: "1px solid #3b82f6",
|
|
5378
|
+
borderRadius: "6px",
|
|
5379
|
+
backgroundColor: "#3b82f6",
|
|
5380
|
+
color: "white",
|
|
5381
|
+
cursor: "pointer",
|
|
5382
|
+
fontSize: "14px",
|
|
5383
|
+
fontWeight: "500",
|
|
5384
|
+
transition: "all 0.2s ease"
|
|
5385
|
+
},
|
|
5386
|
+
ButtonsDiv: {
|
|
5387
|
+
display: "flex",
|
|
5388
|
+
justifyContent: "flex-end",
|
|
5389
|
+
gap: "12px",
|
|
5390
|
+
marginTop: "24px",
|
|
5391
|
+
paddingTop: "20px"
|
|
5392
|
+
},
|
|
5393
|
+
Label: {
|
|
5394
|
+
display: "block",
|
|
5395
|
+
marginBottom: "12px",
|
|
5396
|
+
fontSize: "14px",
|
|
5397
|
+
fontWeight: "500",
|
|
5398
|
+
color: "#333"
|
|
5399
|
+
},
|
|
5400
|
+
WindowHeader: {
|
|
5401
|
+
margin: "0 0 20px 0",
|
|
5402
|
+
fontSize: "18px",
|
|
5403
|
+
fontWeight: "600",
|
|
5404
|
+
color: "#333",
|
|
5405
|
+
borderBottom: "1px solid #eee",
|
|
5406
|
+
paddingBottom: "10px"
|
|
5342
5407
|
}
|
|
5343
5408
|
};
|
|
5344
5409
|
|
|
5345
5410
|
function Dialog({ children, className }) {
|
|
5346
|
-
return (h("div", { className: className },
|
|
5411
|
+
return (h("div", { className: `dexie-dialog ${className || ''}` },
|
|
5347
5412
|
h("div", { style: Styles.Darken }),
|
|
5348
5413
|
h("div", { style: Styles.DialogOuter },
|
|
5349
5414
|
h("div", { style: Styles.DialogInner }, children))));
|
|
@@ -5395,7 +5460,7 @@ function LoginDialog({ title, type, alerts, fields, submitLabel, cancelLabel, on
|
|
|
5395
5460
|
} })))))),
|
|
5396
5461
|
h("div", { style: Styles.ButtonsDiv },
|
|
5397
5462
|
h(p$1, null,
|
|
5398
|
-
h("button", { type: "submit", style: Styles.
|
|
5463
|
+
h("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel),
|
|
5399
5464
|
cancelLabel && (h("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
|
|
5400
5465
|
}
|
|
5401
5466
|
function valueTransformer(type, value) {
|
|
@@ -6026,7 +6091,7 @@ function dexieCloud(dexie) {
|
|
|
6026
6091
|
const syncComplete = new Subject();
|
|
6027
6092
|
dexie.cloud = {
|
|
6028
6093
|
// @ts-ignore
|
|
6029
|
-
version: "4.2.
|
|
6094
|
+
version: "4.2.2",
|
|
6030
6095
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6031
6096
|
schema: null,
|
|
6032
6097
|
get currentUserId() {
|
|
@@ -6343,7 +6408,7 @@ function dexieCloud(dexie) {
|
|
|
6343
6408
|
}
|
|
6344
6409
|
}
|
|
6345
6410
|
// @ts-ignore
|
|
6346
|
-
dexieCloud.version = "4.2.
|
|
6411
|
+
dexieCloud.version = "4.2.2";
|
|
6347
6412
|
Dexie.Cloud = dexieCloud;
|
|
6348
6413
|
|
|
6349
6414
|
// In case the SW lives for a while, let it reuse already opened connections:
|