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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.2.1, Wed Oct 01 2025
11
+ * Version 4.2.3, Fri Nov 28 2025
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -13949,7 +13949,7 @@
13949
13949
  *
13950
13950
  * ==========================================================================
13951
13951
  *
13952
- * Version 4.2.1, Wed Oct 01 2025
13952
+ * Version 4.2.1, Fri Nov 28 2025
13953
13953
  *
13954
13954
  * https://dexie.org
13955
13955
  *
@@ -15838,7 +15838,8 @@
15838
15838
  if (req.type === 'put') {
15839
15839
  delete req.criteria;
15840
15840
  delete req.changeSpec;
15841
- delete req.updates;
15841
+ if (!req.upsert)
15842
+ delete req.updates;
15842
15843
  obj.$ts = Date.now();
15843
15844
  }
15844
15845
  }
@@ -16065,6 +16066,7 @@
16065
16066
  let values = 'values' in req ? req.values : [];
16066
16067
  let changeSpec = 'changeSpec' in req ? req.changeSpec : undefined;
16067
16068
  let updates = 'updates' in req ? req.updates : undefined;
16069
+ let upsert = updates && 'upsert' in req ? req.upsert : false;
16068
16070
  if (hasFailures) {
16069
16071
  keys = keys.filter((_, idx) => !failures[idx]);
16070
16072
  values = values.filter((_, idx) => !failures[idx]);
@@ -16096,29 +16098,32 @@
16096
16098
  };
16097
16099
  const validKeys = new Dexie.RangeSet();
16098
16100
  let anyChangeSpecBecameEmpty = false;
16099
- for (let i = 0, l = strippedChangeSpecs.length; i < l; ++i) {
16100
- if (Object.keys(strippedChangeSpecs[i]).length > 0) {
16101
- newUpdates.keys.push(updates.keys[i]);
16102
- newUpdates.changeSpecs.push(strippedChangeSpecs[i]);
16103
- validKeys.addKey(updates.keys[i]);
16104
- }
16105
- else {
16106
- anyChangeSpecBecameEmpty = true;
16101
+ if (!upsert) {
16102
+ for (let i = 0, l = strippedChangeSpecs.length; i < l; ++i) {
16103
+ if (Object.keys(strippedChangeSpecs[i]).length > 0) {
16104
+ newUpdates.keys.push(updates.keys[i]);
16105
+ newUpdates.changeSpecs.push(strippedChangeSpecs[i]);
16106
+ validKeys.addKey(updates.keys[i]);
16107
+ }
16108
+ else {
16109
+ anyChangeSpecBecameEmpty = true;
16110
+ }
16107
16111
  }
16108
- }
16109
- updates = newUpdates;
16110
- if (anyChangeSpecBecameEmpty) {
16111
- // Some keys were stripped. We must also strip them from keys and values
16112
- let newKeys = [];
16113
- let newValues = [];
16114
- for (let i = 0, l = keys.length; i < l; ++i) {
16115
- if (validKeys.hasKey(keys[i])) {
16116
- newKeys.push(keys[i]);
16117
- newValues.push(values[i]);
16112
+ updates = newUpdates;
16113
+ if (anyChangeSpecBecameEmpty) {
16114
+ // Some keys were stripped. We must also strip them from keys and values
16115
+ // unless this is an upsert operation in which case we want to send them all.
16116
+ let newKeys = [];
16117
+ let newValues = [];
16118
+ for (let i = 0, l = keys.length; i < l; ++i) {
16119
+ if (validKeys.hasKey(keys[i])) {
16120
+ newKeys.push(keys[i]);
16121
+ newValues.push(values[i]);
16122
+ }
16118
16123
  }
16124
+ keys = newKeys;
16125
+ values = newValues;
16119
16126
  }
16120
- keys = newKeys;
16121
- values = newValues;
16122
16127
  }
16123
16128
  }
16124
16129
  }
@@ -16160,49 +16165,59 @@
16160
16165
  userId,
16161
16166
  values,
16162
16167
  }
16163
- : criteria && changeSpec
16164
- ? {
16165
- // Common changeSpec for all keys
16166
- type: 'modify',
16167
- ts,
16168
- opNo,
16169
- keys,
16170
- criteria,
16171
- changeSpec,
16172
- txid,
16173
- userId,
16174
- }
16175
- : changeSpec
16168
+ : upsert && updates ? {
16169
+ type: 'upsert',
16170
+ ts,
16171
+ opNo,
16172
+ keys,
16173
+ values,
16174
+ changeSpecs: updates.changeSpecs.filter((_, idx) => !failures[idx]),
16175
+ txid,
16176
+ userId,
16177
+ }
16178
+ : criteria && changeSpec
16176
16179
  ? {
16177
- // In case criteria involved an unsynced property, we go for keys instead.
16178
- type: 'update',
16180
+ // Common changeSpec for all keys
16181
+ type: 'modify',
16179
16182
  ts,
16180
16183
  opNo,
16181
16184
  keys,
16182
- changeSpecs: keys.map(() => changeSpec),
16185
+ criteria,
16186
+ changeSpec,
16183
16187
  txid,
16184
16188
  userId,
16185
16189
  }
16186
- : updates
16190
+ : changeSpec
16187
16191
  ? {
16188
- // One changeSpec per key
16192
+ // In case criteria involved an unsynced property, we go for keys instead.
16189
16193
  type: 'update',
16190
16194
  ts,
16191
16195
  opNo,
16192
- keys: updates.keys,
16193
- changeSpecs: updates.changeSpecs,
16194
- txid,
16195
- userId,
16196
- }
16197
- : {
16198
- type: 'upsert',
16199
- ts,
16200
- opNo,
16201
16196
  keys,
16202
- values,
16197
+ changeSpecs: keys.map(() => changeSpec),
16203
16198
  txid,
16204
16199
  userId,
16205
- };
16200
+ }
16201
+ : updates
16202
+ ? {
16203
+ // One changeSpec per key
16204
+ type: 'update',
16205
+ ts,
16206
+ opNo,
16207
+ keys: updates.keys,
16208
+ changeSpecs: updates.changeSpecs,
16209
+ txid,
16210
+ userId,
16211
+ }
16212
+ : {
16213
+ type: 'upsert',
16214
+ ts,
16215
+ opNo,
16216
+ keys,
16217
+ values,
16218
+ txid,
16219
+ userId,
16220
+ };
16206
16221
  if ('isAdditionalChunk' in req && req.isAdditionalChunk) {
16207
16222
  mut.isAdditionalChunk = true;
16208
16223
  }
@@ -17359,34 +17374,90 @@
17359
17374
  alignItems: "center",
17360
17375
  display: "flex",
17361
17376
  justifyContent: "center",
17377
+ padding: "16px",
17378
+ boxSizing: "border-box"
17362
17379
  },
17363
17380
  DialogInner: {
17364
17381
  position: "relative",
17365
17382
  color: "#222",
17366
17383
  backgroundColor: "#fff",
17367
- padding: "30px",
17384
+ padding: "24px",
17368
17385
  marginBottom: "2em",
17369
- maxWidth: "90%",
17386
+ maxWidth: "400px",
17387
+ width: "100%",
17370
17388
  maxHeight: "90%",
17371
17389
  overflowY: "auto",
17372
17390
  border: "3px solid #3d3d5d",
17373
17391
  borderRadius: "8px",
17374
17392
  boxShadow: "0 0 80px 10px #666",
17375
- width: "auto",
17376
17393
  fontFamily: "sans-serif",
17394
+ boxSizing: "border-box"
17377
17395
  },
17378
17396
  Input: {
17379
17397
  height: "35px",
17380
- width: "17em",
17398
+ width: "100%",
17399
+ maxWidth: "100%",
17381
17400
  borderColor: "#ccf4",
17382
17401
  outline: "none",
17383
- fontSize: "17pt",
17384
- padding: "8px"
17402
+ fontSize: "16px",
17403
+ padding: "8px",
17404
+ boxSizing: "border-box",
17405
+ backgroundColor: "#f9f9f9",
17406
+ borderRadius: "4px",
17407
+ border: "1px solid #ccc",
17408
+ marginTop: "6px",
17409
+ fontFamily: "inherit"
17410
+ },
17411
+ Button: {
17412
+ padding: "10px 20px",
17413
+ margin: "0 4px",
17414
+ border: "1px solid #d1d5db",
17415
+ borderRadius: "6px",
17416
+ backgroundColor: "#ffffff",
17417
+ cursor: "pointer",
17418
+ fontSize: "14px",
17419
+ fontWeight: "500",
17420
+ color: "#374151",
17421
+ transition: "all 0.2s ease"
17422
+ },
17423
+ PrimaryButton: {
17424
+ padding: "10px 20px",
17425
+ margin: "0 4px",
17426
+ border: "1px solid #3b82f6",
17427
+ borderRadius: "6px",
17428
+ backgroundColor: "#3b82f6",
17429
+ color: "white",
17430
+ cursor: "pointer",
17431
+ fontSize: "14px",
17432
+ fontWeight: "500",
17433
+ transition: "all 0.2s ease"
17434
+ },
17435
+ ButtonsDiv: {
17436
+ display: "flex",
17437
+ justifyContent: "flex-end",
17438
+ gap: "12px",
17439
+ marginTop: "24px",
17440
+ paddingTop: "20px"
17441
+ },
17442
+ Label: {
17443
+ display: "block",
17444
+ marginBottom: "12px",
17445
+ fontSize: "14px",
17446
+ fontWeight: "500",
17447
+ color: "#333"
17448
+ },
17449
+ WindowHeader: {
17450
+ margin: "0 0 20px 0",
17451
+ fontSize: "18px",
17452
+ fontWeight: "600",
17453
+ color: "#333",
17454
+ borderBottom: "1px solid #eee",
17455
+ paddingBottom: "10px"
17385
17456
  }
17386
17457
  };
17387
17458
 
17388
17459
  function Dialog({ children, className }) {
17389
- return (h("div", { className: className },
17460
+ return (h("div", { className: `dexie-dialog ${className || ''}` },
17390
17461
  h("div", { style: Styles.Darken }),
17391
17462
  h("div", { style: Styles.DialogOuter },
17392
17463
  h("div", { style: Styles.DialogInner }, children))));
@@ -17438,7 +17509,7 @@
17438
17509
  } })))))),
17439
17510
  h("div", { style: Styles.ButtonsDiv },
17440
17511
  h(p$1, null,
17441
- h("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, submitLabel),
17512
+ h("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel),
17442
17513
  cancelLabel && (h("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
17443
17514
  }
17444
17515
  function valueTransformer(type, value) {
@@ -18069,7 +18140,7 @@
18069
18140
  const syncComplete = new rxjs.Subject();
18070
18141
  dexie.cloud = {
18071
18142
  // @ts-ignore
18072
- version: "4.2.1",
18143
+ version: "4.2.3",
18073
18144
  options: Object.assign({}, DEFAULT_OPTIONS),
18074
18145
  schema: null,
18075
18146
  get currentUserId() {
@@ -18386,7 +18457,7 @@
18386
18457
  }
18387
18458
  }
18388
18459
  // @ts-ignore
18389
- dexieCloud.version = "4.2.1";
18460
+ dexieCloud.version = "4.2.3";
18390
18461
  Dexie.Cloud = dexieCloud;
18391
18462
 
18392
18463
  // In case the SW lives for a while, let it reuse already opened connections: