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