@odoo/o-spreadsheet 15.2.5 → 15.2.7

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.
@@ -6613,7 +6613,7 @@ const POW = {
6613
6613
  base (number) ${_lt("The number to raise to the exponent power.")}
6614
6614
  exponent (number) ${_lt("The exponent to raise base to.")}
6615
6615
  `),
6616
- returns: ["BOOLEAN"],
6616
+ returns: ["NUMBER"],
6617
6617
  compute: function (base, exponent) {
6618
6618
  return POWER.compute(base, exponent);
6619
6619
  },
@@ -21297,13 +21297,9 @@ class Session extends EventBus {
21297
21297
  }
21298
21298
  loadInitialMessages(messages) {
21299
21299
  this.isReplayingInitialRevisions = true;
21300
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
21301
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
21302
- });
21303
21300
  for (const message of messages) {
21304
21301
  this.onMessageReceived(message);
21305
21302
  }
21306
- this.off("unexpected-revision-id", this);
21307
21303
  this.isReplayingInitialRevisions = false;
21308
21304
  }
21309
21305
  /**
@@ -21375,6 +21371,10 @@ class Session extends EventBus {
21375
21371
  onMessageReceived(message) {
21376
21372
  if (this.isAlreadyProcessed(message))
21377
21373
  return;
21374
+ if (this.isWrongServerRevisionId(message)) {
21375
+ this.trigger("unexpected-revision-id");
21376
+ return;
21377
+ }
21378
21378
  switch (message.type) {
21379
21379
  case "CLIENT_MOVED":
21380
21380
  this.onClientMoved(message);
@@ -21401,10 +21401,6 @@ class Session extends EventBus {
21401
21401
  });
21402
21402
  break;
21403
21403
  case "REMOTE_REVISION":
21404
- if (message.serverRevisionId !== this.serverRevisionId) {
21405
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
21406
- return;
21407
- }
21408
21404
  const { clientId, commands } = message;
21409
21405
  const revision = new Revision(message.nextRevisionId, clientId, commands);
21410
21406
  if (revision.clientId !== this.clientId) {
@@ -21533,6 +21529,17 @@ class Session extends EventBus {
21533
21529
  return false;
21534
21530
  }
21535
21531
  }
21532
+ isWrongServerRevisionId(message) {
21533
+ switch (message.type) {
21534
+ case "REMOTE_REVISION":
21535
+ case "REVISION_REDONE":
21536
+ case "REVISION_UNDONE":
21537
+ case "SNAPSHOT_CREATED":
21538
+ return message.serverRevisionId !== this.serverRevisionId;
21539
+ default:
21540
+ return false;
21541
+ }
21542
+ }
21536
21543
  dropPendingHistoryMessages() {
21537
21544
  this.waitingUndoRedoAck = false;
21538
21545
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -24694,12 +24701,9 @@ function addFormula(cell) {
24694
24701
  else {
24695
24702
  // Shouldn't we always output the value then ?
24696
24703
  const value = cell.value;
24697
- // what if value = 0? Is this condition correct?
24698
- if (value) {
24699
- const type = getCellType(value);
24700
- attrs.push(["t", type]);
24701
- node = escapeXml /*xml*/ `<v>${value}</v>`;
24702
- }
24704
+ const type = getCellType(value);
24705
+ attrs.push(["t", type]);
24706
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
24703
24707
  return { attrs, node };
24704
24708
  }
24705
24709
  }
@@ -31332,6 +31336,6 @@ exports.registries = registries;
31332
31336
  exports.setTranslationMethod = setTranslationMethod;
31333
31337
 
31334
31338
 
31335
- __info__.version = '15.2.5';
31336
- __info__.date = '2023-04-21T07:27:24.954Z';
31337
- __info__.hash = '0896859';
31339
+ __info__.version = '15.2.7';
31340
+ __info__.date = '2023-05-12T10:54:29.220Z';
31341
+ __info__.hash = 'd33fde8';
@@ -603,7 +603,6 @@ interface CollaborativeEventReceived {
603
603
  }
604
604
  interface UnexpectedRevisionIdEvent {
605
605
  type: "unexpected-revision-id";
606
- revisionId: UID;
607
606
  }
608
607
  interface NewLocalStateUpdateEvent {
609
608
  type: "new-local-state-update";
@@ -2018,6 +2017,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
2018
2017
  private sendPendingMessage;
2019
2018
  private acknowledge;
2020
2019
  private isAlreadyProcessed;
2020
+ isWrongServerRevisionId(message: CollaborationMessage): boolean;
2021
2021
  private dropPendingHistoryMessages;
2022
2022
  }
2023
2023
 
@@ -6590,7 +6590,7 @@ const POW = {
6590
6590
  base (number) ${_lt("The number to raise to the exponent power.")}
6591
6591
  exponent (number) ${_lt("The exponent to raise base to.")}
6592
6592
  `),
6593
- returns: ["BOOLEAN"],
6593
+ returns: ["NUMBER"],
6594
6594
  compute: function (base, exponent) {
6595
6595
  return POWER.compute(base, exponent);
6596
6596
  },
@@ -21274,13 +21274,9 @@ class Session extends EventBus {
21274
21274
  }
21275
21275
  loadInitialMessages(messages) {
21276
21276
  this.isReplayingInitialRevisions = true;
21277
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
21278
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
21279
- });
21280
21277
  for (const message of messages) {
21281
21278
  this.onMessageReceived(message);
21282
21279
  }
21283
- this.off("unexpected-revision-id", this);
21284
21280
  this.isReplayingInitialRevisions = false;
21285
21281
  }
21286
21282
  /**
@@ -21352,6 +21348,10 @@ class Session extends EventBus {
21352
21348
  onMessageReceived(message) {
21353
21349
  if (this.isAlreadyProcessed(message))
21354
21350
  return;
21351
+ if (this.isWrongServerRevisionId(message)) {
21352
+ this.trigger("unexpected-revision-id");
21353
+ return;
21354
+ }
21355
21355
  switch (message.type) {
21356
21356
  case "CLIENT_MOVED":
21357
21357
  this.onClientMoved(message);
@@ -21378,10 +21378,6 @@ class Session extends EventBus {
21378
21378
  });
21379
21379
  break;
21380
21380
  case "REMOTE_REVISION":
21381
- if (message.serverRevisionId !== this.serverRevisionId) {
21382
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
21383
- return;
21384
- }
21385
21381
  const { clientId, commands } = message;
21386
21382
  const revision = new Revision(message.nextRevisionId, clientId, commands);
21387
21383
  if (revision.clientId !== this.clientId) {
@@ -21510,6 +21506,17 @@ class Session extends EventBus {
21510
21506
  return false;
21511
21507
  }
21512
21508
  }
21509
+ isWrongServerRevisionId(message) {
21510
+ switch (message.type) {
21511
+ case "REMOTE_REVISION":
21512
+ case "REVISION_REDONE":
21513
+ case "REVISION_UNDONE":
21514
+ case "SNAPSHOT_CREATED":
21515
+ return message.serverRevisionId !== this.serverRevisionId;
21516
+ default:
21517
+ return false;
21518
+ }
21519
+ }
21513
21520
  dropPendingHistoryMessages() {
21514
21521
  this.waitingUndoRedoAck = false;
21515
21522
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -24671,12 +24678,9 @@ function addFormula(cell) {
24671
24678
  else {
24672
24679
  // Shouldn't we always output the value then ?
24673
24680
  const value = cell.value;
24674
- // what if value = 0? Is this condition correct?
24675
- if (value) {
24676
- const type = getCellType(value);
24677
- attrs.push(["t", type]);
24678
- node = escapeXml /*xml*/ `<v>${value}</v>`;
24679
- }
24681
+ const type = getCellType(value);
24682
+ attrs.push(["t", type]);
24683
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
24680
24684
  return { attrs, node };
24681
24685
  }
24682
24686
  }
@@ -31286,6 +31290,6 @@ const helpers = {
31286
31290
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31287
31291
 
31288
31292
 
31289
- __info__.version = '15.2.5';
31290
- __info__.date = '2023-04-21T07:27:24.954Z';
31291
- __info__.hash = '0896859';
31293
+ __info__.version = '15.2.7';
31294
+ __info__.date = '2023-05-12T10:54:29.220Z';
31295
+ __info__.hash = 'd33fde8';
@@ -6610,7 +6610,7 @@
6610
6610
  base (number) ${_lt("The number to raise to the exponent power.")}
6611
6611
  exponent (number) ${_lt("The exponent to raise base to.")}
6612
6612
  `),
6613
- returns: ["BOOLEAN"],
6613
+ returns: ["NUMBER"],
6614
6614
  compute: function (base, exponent) {
6615
6615
  return POWER.compute(base, exponent);
6616
6616
  },
@@ -21294,13 +21294,9 @@
21294
21294
  }
21295
21295
  loadInitialMessages(messages) {
21296
21296
  this.isReplayingInitialRevisions = true;
21297
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
21298
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
21299
- });
21300
21297
  for (const message of messages) {
21301
21298
  this.onMessageReceived(message);
21302
21299
  }
21303
- this.off("unexpected-revision-id", this);
21304
21300
  this.isReplayingInitialRevisions = false;
21305
21301
  }
21306
21302
  /**
@@ -21372,6 +21368,10 @@
21372
21368
  onMessageReceived(message) {
21373
21369
  if (this.isAlreadyProcessed(message))
21374
21370
  return;
21371
+ if (this.isWrongServerRevisionId(message)) {
21372
+ this.trigger("unexpected-revision-id");
21373
+ return;
21374
+ }
21375
21375
  switch (message.type) {
21376
21376
  case "CLIENT_MOVED":
21377
21377
  this.onClientMoved(message);
@@ -21398,10 +21398,6 @@
21398
21398
  });
21399
21399
  break;
21400
21400
  case "REMOTE_REVISION":
21401
- if (message.serverRevisionId !== this.serverRevisionId) {
21402
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
21403
- return;
21404
- }
21405
21401
  const { clientId, commands } = message;
21406
21402
  const revision = new Revision(message.nextRevisionId, clientId, commands);
21407
21403
  if (revision.clientId !== this.clientId) {
@@ -21530,6 +21526,17 @@
21530
21526
  return false;
21531
21527
  }
21532
21528
  }
21529
+ isWrongServerRevisionId(message) {
21530
+ switch (message.type) {
21531
+ case "REMOTE_REVISION":
21532
+ case "REVISION_REDONE":
21533
+ case "REVISION_UNDONE":
21534
+ case "SNAPSHOT_CREATED":
21535
+ return message.serverRevisionId !== this.serverRevisionId;
21536
+ default:
21537
+ return false;
21538
+ }
21539
+ }
21533
21540
  dropPendingHistoryMessages() {
21534
21541
  this.waitingUndoRedoAck = false;
21535
21542
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -24691,12 +24698,9 @@
24691
24698
  else {
24692
24699
  // Shouldn't we always output the value then ?
24693
24700
  const value = cell.value;
24694
- // what if value = 0? Is this condition correct?
24695
- if (value) {
24696
- const type = getCellType(value);
24697
- attrs.push(["t", type]);
24698
- node = escapeXml /*xml*/ `<v>${value}</v>`;
24699
- }
24701
+ const type = getCellType(value);
24702
+ attrs.push(["t", type]);
24703
+ node = escapeXml /*xml*/ `<v>${value}</v>`;
24700
24704
  return { attrs, node };
24701
24705
  }
24702
24706
  }
@@ -31331,9 +31335,9 @@
31331
31335
  Object.defineProperty(exports, '__esModule', { value: true });
31332
31336
 
31333
31337
 
31334
- __info__.version = '15.2.5';
31335
- __info__.date = '2023-04-21T07:27:24.954Z';
31336
- __info__.hash = '0896859';
31338
+ __info__.version = '15.2.7';
31339
+ __info__.date = '2023-05-12T10:54:29.220Z';
31340
+ __info__.hash = 'd33fde8';
31337
31341
 
31338
31342
 
31339
31343
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);