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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.2.1, Wed Oct 01 2025
11
+ * Version 4.2.2, Sat Oct 04 2025
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -14253,7 +14253,7 @@
14253
14253
  *
14254
14254
  * ==========================================================================
14255
14255
  *
14256
- * Version 4.2.1, Wed Oct 01 2025
14256
+ * Version 4.2.1, Sat Oct 04 2025
14257
14257
  *
14258
14258
  * https://dexie.org
14259
14259
  *
@@ -16065,6 +16065,7 @@
16065
16065
  let values = 'values' in req ? req.values : [];
16066
16066
  let changeSpec = 'changeSpec' in req ? req.changeSpec : undefined;
16067
16067
  let updates = 'updates' in req ? req.updates : undefined;
16068
+ let upsert = updates && 'upsert' in req ? req.upsert : false;
16068
16069
  if (hasFailures) {
16069
16070
  keys = keys.filter((_, idx) => !failures[idx]);
16070
16071
  values = values.filter((_, idx) => !failures[idx]);
@@ -16096,29 +16097,32 @@
16096
16097
  };
16097
16098
  const validKeys = new Dexie.RangeSet();
16098
16099
  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;
16100
+ if (!upsert) {
16101
+ for (let i = 0, l = strippedChangeSpecs.length; i < l; ++i) {
16102
+ if (Object.keys(strippedChangeSpecs[i]).length > 0) {
16103
+ newUpdates.keys.push(updates.keys[i]);
16104
+ newUpdates.changeSpecs.push(strippedChangeSpecs[i]);
16105
+ validKeys.addKey(updates.keys[i]);
16106
+ }
16107
+ else {
16108
+ anyChangeSpecBecameEmpty = true;
16109
+ }
16107
16110
  }
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]);
16111
+ updates = newUpdates;
16112
+ if (anyChangeSpecBecameEmpty) {
16113
+ // Some keys were stripped. We must also strip them from keys and values
16114
+ // unless this is an upsert operation in which case we want to send them all.
16115
+ let newKeys = [];
16116
+ let newValues = [];
16117
+ for (let i = 0, l = keys.length; i < l; ++i) {
16118
+ if (validKeys.hasKey(keys[i])) {
16119
+ newKeys.push(keys[i]);
16120
+ newValues.push(values[i]);
16121
+ }
16118
16122
  }
16123
+ keys = newKeys;
16124
+ values = newValues;
16119
16125
  }
16120
- keys = newKeys;
16121
- values = newValues;
16122
16126
  }
16123
16127
  }
16124
16128
  }
@@ -16160,49 +16164,59 @@
16160
16164
  userId,
16161
16165
  values,
16162
16166
  }
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
16167
+ : upsert ? {
16168
+ type: 'upsert',
16169
+ ts,
16170
+ opNo,
16171
+ keys,
16172
+ values,
16173
+ changeSpecs: updates.changeSpecs.filter((_, idx) => !failures[idx]),
16174
+ txid,
16175
+ userId,
16176
+ }
16177
+ : criteria && changeSpec
16176
16178
  ? {
16177
- // In case criteria involved an unsynced property, we go for keys instead.
16178
- type: 'update',
16179
+ // Common changeSpec for all keys
16180
+ type: 'modify',
16179
16181
  ts,
16180
16182
  opNo,
16181
16183
  keys,
16182
- changeSpecs: keys.map(() => changeSpec),
16184
+ criteria,
16185
+ changeSpec,
16183
16186
  txid,
16184
16187
  userId,
16185
16188
  }
16186
- : updates
16189
+ : changeSpec
16187
16190
  ? {
16188
- // One changeSpec per key
16191
+ // In case criteria involved an unsynced property, we go for keys instead.
16189
16192
  type: 'update',
16190
16193
  ts,
16191
16194
  opNo,
16192
- keys: updates.keys,
16193
- changeSpecs: updates.changeSpecs,
16194
- txid,
16195
- userId,
16196
- }
16197
- : {
16198
- type: 'upsert',
16199
- ts,
16200
- opNo,
16201
16195
  keys,
16202
- values,
16196
+ changeSpecs: keys.map(() => changeSpec),
16203
16197
  txid,
16204
16198
  userId,
16205
- };
16199
+ }
16200
+ : updates
16201
+ ? {
16202
+ // One changeSpec per key
16203
+ type: 'update',
16204
+ ts,
16205
+ opNo,
16206
+ keys: updates.keys,
16207
+ changeSpecs: updates.changeSpecs,
16208
+ txid,
16209
+ userId,
16210
+ }
16211
+ : {
16212
+ type: 'upsert',
16213
+ ts,
16214
+ opNo,
16215
+ keys,
16216
+ values,
16217
+ txid,
16218
+ userId,
16219
+ };
16206
16220
  if ('isAdditionalChunk' in req && req.isAdditionalChunk) {
16207
16221
  mut.isAdditionalChunk = true;
16208
16222
  }
@@ -17359,34 +17373,85 @@
17359
17373
  alignItems: "center",
17360
17374
  display: "flex",
17361
17375
  justifyContent: "center",
17376
+ padding: "16px",
17377
+ boxSizing: "border-box"
17362
17378
  },
17363
17379
  DialogInner: {
17364
17380
  position: "relative",
17365
17381
  color: "#222",
17366
17382
  backgroundColor: "#fff",
17367
- padding: "30px",
17383
+ padding: "24px",
17368
17384
  marginBottom: "2em",
17369
- maxWidth: "90%",
17385
+ maxWidth: "400px",
17386
+ width: "100%",
17370
17387
  maxHeight: "90%",
17371
17388
  overflowY: "auto",
17372
17389
  border: "3px solid #3d3d5d",
17373
17390
  borderRadius: "8px",
17374
17391
  boxShadow: "0 0 80px 10px #666",
17375
- width: "auto",
17376
17392
  fontFamily: "sans-serif",
17393
+ boxSizing: "border-box"
17377
17394
  },
17378
17395
  Input: {
17379
17396
  height: "35px",
17380
- width: "17em",
17397
+ width: "100%",
17398
+ maxWidth: "100%",
17381
17399
  borderColor: "#ccf4",
17382
17400
  outline: "none",
17383
- fontSize: "17pt",
17384
- padding: "8px"
17401
+ fontSize: "16px",
17402
+ padding: "8px",
17403
+ boxSizing: "border-box"
17404
+ },
17405
+ Button: {
17406
+ padding: "10px 20px",
17407
+ margin: "0 4px",
17408
+ border: "1px solid #d1d5db",
17409
+ borderRadius: "6px",
17410
+ backgroundColor: "#ffffff",
17411
+ cursor: "pointer",
17412
+ fontSize: "14px",
17413
+ fontWeight: "500",
17414
+ color: "#374151",
17415
+ transition: "all 0.2s ease"
17416
+ },
17417
+ PrimaryButton: {
17418
+ padding: "10px 20px",
17419
+ margin: "0 4px",
17420
+ border: "1px solid #3b82f6",
17421
+ borderRadius: "6px",
17422
+ backgroundColor: "#3b82f6",
17423
+ color: "white",
17424
+ cursor: "pointer",
17425
+ fontSize: "14px",
17426
+ fontWeight: "500",
17427
+ transition: "all 0.2s ease"
17428
+ },
17429
+ ButtonsDiv: {
17430
+ display: "flex",
17431
+ justifyContent: "flex-end",
17432
+ gap: "12px",
17433
+ marginTop: "24px",
17434
+ paddingTop: "20px"
17435
+ },
17436
+ Label: {
17437
+ display: "block",
17438
+ marginBottom: "12px",
17439
+ fontSize: "14px",
17440
+ fontWeight: "500",
17441
+ color: "#333"
17442
+ },
17443
+ WindowHeader: {
17444
+ margin: "0 0 20px 0",
17445
+ fontSize: "18px",
17446
+ fontWeight: "600",
17447
+ color: "#333",
17448
+ borderBottom: "1px solid #eee",
17449
+ paddingBottom: "10px"
17385
17450
  }
17386
17451
  };
17387
17452
 
17388
17453
  function Dialog({ children, className }) {
17389
- return (h("div", { className: className },
17454
+ return (h("div", { className: `dexie-dialog ${className || ''}` },
17390
17455
  h("div", { style: Styles.Darken }),
17391
17456
  h("div", { style: Styles.DialogOuter },
17392
17457
  h("div", { style: Styles.DialogInner }, children))));
@@ -17438,7 +17503,7 @@
17438
17503
  } })))))),
17439
17504
  h("div", { style: Styles.ButtonsDiv },
17440
17505
  h(p$1, null,
17441
- h("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, submitLabel),
17506
+ h("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel),
17442
17507
  cancelLabel && (h("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
17443
17508
  }
17444
17509
  function valueTransformer(type, value) {
@@ -18240,7 +18305,7 @@
18240
18305
  const syncComplete = new rxjs.Subject();
18241
18306
  dexie.cloud = {
18242
18307
  // @ts-ignore
18243
- version: "4.2.1",
18308
+ version: "4.2.2",
18244
18309
  options: Object.assign({}, DEFAULT_OPTIONS),
18245
18310
  schema: null,
18246
18311
  get currentUserId() {
@@ -18557,7 +18622,7 @@
18557
18622
  }
18558
18623
  }
18559
18624
  // @ts-ignore
18560
- dexieCloud.version = "4.2.1";
18625
+ dexieCloud.version = "4.2.2";
18561
18626
  Dexie.Cloud = dexieCloud;
18562
18627
 
18563
18628
  exports.default = dexieCloud;