@odoo/o-spreadsheet 19.1.1 → 19.1.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.
@@ -2535,6 +2535,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
2535
2535
  private onClientJoined;
2536
2536
  private onClientLeft;
2537
2537
  private sendUpdateMessage;
2538
+ private sendToTransport;
2538
2539
  /**
2539
2540
  * Send the next pending message
2540
2541
  */
@@ -3,8 +3,8 @@
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
5
  * @version 19.1.0-alpha.3
6
- * @date 2025-12-26T10:26:09.971Z
7
- * @hash e6313bd
6
+ * @date 2026-01-07T16:20:59.139Z
7
+ * @hash febc3e9
8
8
  */
9
9
 
10
10
  class FunctionCodeBuilder {
@@ -18112,7 +18112,7 @@ class ReadonlyTransportFilter {
18112
18112
  if (message.type === "CLIENT_JOINED" ||
18113
18113
  message.type === "CLIENT_LEFT" ||
18114
18114
  message.type === "CLIENT_MOVED") {
18115
- this.transportService.sendMessage(message);
18115
+ await this.transportService.sendMessage(message);
18116
18116
  }
18117
18117
  // ignore all other messages
18118
18118
  }
@@ -20731,7 +20731,7 @@ class Session extends EventBus {
20731
20731
  }
20732
20732
  delete this.clients[this.clientId];
20733
20733
  this.transportService.leave(this.clientId);
20734
- this.transportService.sendMessage({
20734
+ this.sendToTransport({
20735
20735
  type: "CLIENT_LEFT",
20736
20736
  clientId: this.clientId,
20737
20737
  version: MESSAGE_VERSION,
@@ -20745,7 +20745,7 @@ class Session extends EventBus {
20745
20745
  return;
20746
20746
  }
20747
20747
  const snapshotId = this.uuidGenerator.uuidv4();
20748
- await this.transportService.sendMessage({
20748
+ await this.sendToTransport({
20749
20749
  type: "SNAPSHOT",
20750
20750
  nextRevisionId: snapshotId,
20751
20751
  serverRevisionId: this.serverRevisionId,
@@ -20793,10 +20793,14 @@ class Session extends EventBus {
20793
20793
  const type = currentPosition ? "CLIENT_MOVED" : "CLIENT_JOINED";
20794
20794
  const client = this.getCurrentClient();
20795
20795
  this.clients[this.clientId] = { ...client, position };
20796
- this.transportService.sendMessage({
20796
+ this.sendToTransport({
20797
20797
  type,
20798
20798
  version: MESSAGE_VERSION,
20799
20799
  client: { ...client, position },
20800
+ }).then(() => {
20801
+ if (this.pendingMessages.length > 0 && !this.waitingAck) {
20802
+ this.sendPendingMessage();
20803
+ }
20800
20804
  });
20801
20805
  }
20802
20806
  /**
@@ -20877,7 +20881,7 @@ class Session extends EventBus {
20877
20881
  if (client) {
20878
20882
  const { position } = client;
20879
20883
  if (position) {
20880
- this.transportService.sendMessage({
20884
+ this.sendToTransport({
20881
20885
  type: "CLIENT_MOVED",
20882
20886
  version: MESSAGE_VERSION,
20883
20887
  client: { ...client, position },
@@ -20898,6 +20902,10 @@ class Session extends EventBus {
20898
20902
  }
20899
20903
  this.sendPendingMessage();
20900
20904
  }
20905
+ async sendToTransport(message) {
20906
+ // wrap in an async function to ensure it returns a promise
20907
+ return this.transportService.sendMessage(message);
20908
+ }
20901
20909
  /**
20902
20910
  * Send the next pending message
20903
20911
  */
@@ -20926,9 +20934,14 @@ class Session extends EventBus {
20926
20934
  ${JSON.stringify(message)}`);
20927
20935
  }
20928
20936
  this.waitingAck = true;
20929
- this.transportService.sendMessage({
20937
+ this.sendToTransport({
20930
20938
  ...message,
20931
20939
  serverRevisionId: this.serverRevisionId,
20940
+ }).catch((e) => {
20941
+ if (!(e instanceof ClientDisconnectedError)) {
20942
+ throw e.cause || e;
20943
+ }
20944
+ this.waitingAck = false;
20932
20945
  });
20933
20946
  }
20934
20947
  acknowledge(message) {
@@ -23910,17 +23923,41 @@ function toCriterionDateNumber(dateValue) {
23910
23923
  const today = DateTime.now();
23911
23924
  switch (dateValue) {
23912
23925
  case "today":
23913
- return jsDateToNumber(today);
23914
- case "yesterday":
23915
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 1)));
23916
- case "tomorrow":
23917
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() + 1)));
23926
+ return Math.floor(jsDateToNumber(today));
23927
+ case "yesterday": {
23928
+ today.setDate(today.getDate() - 1);
23929
+ return Math.floor(jsDateToNumber(today));
23930
+ }
23931
+ case "tomorrow": {
23932
+ today.setDate(today.getDate() + 1);
23933
+ return Math.floor(jsDateToNumber(today));
23934
+ }
23918
23935
  case "lastWeek":
23919
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 7)));
23920
- case "lastMonth":
23921
- return jsDateToNumber(DateTime.fromTimestamp(today.setMonth(today.getMonth() - 1)));
23936
+ today.setDate(today.getDate() - 6);
23937
+ return Math.floor(jsDateToNumber(today));
23938
+ case "lastMonth": {
23939
+ const lastMonth = today.getMonth() === 0 ? 11 : today.getMonth() - 1;
23940
+ const dateInLastMonth = new DateTime(today.getFullYear(), lastMonth, 1);
23941
+ if (today.getDate() > getDaysInMonth(dateInLastMonth)) {
23942
+ today.setDate(1);
23943
+ }
23944
+ else {
23945
+ today.setDate(today.getDate() + 1);
23946
+ today.setMonth(today.getMonth() - 1);
23947
+ }
23948
+ return Math.floor(jsDateToNumber(today));
23949
+ }
23922
23950
  case "lastYear":
23923
- return jsDateToNumber(DateTime.fromTimestamp(today.setFullYear(today.getFullYear() - 1)));
23951
+ // Handle leap year case
23952
+ if (today.getMonth() === 1 && today.getDate() === 29) {
23953
+ today.setDate(28);
23954
+ today.setFullYear(today.getFullYear() - 1);
23955
+ }
23956
+ else {
23957
+ today.setDate(today.getDate() + 1);
23958
+ today.setFullYear(today.getFullYear() - 1);
23959
+ }
23960
+ return Math.floor(jsDateToNumber(today));
23924
23961
  }
23925
23962
  }
23926
23963
  /** Get all the dates values of a criterion converted to numbers, converting date values such as "today" to actual dates */
@@ -28945,7 +28982,7 @@ criterionEvaluatorRegistry.add("dateIs", {
28945
28982
  return false;
28946
28983
  }
28947
28984
  if (["lastWeek", "lastMonth", "lastYear"].includes(criterion.dateValue)) {
28948
- const today = jsDateToRoundNumber(DateTime.now());
28985
+ const today = Math.floor(jsDateToNumber(DateTime.now()));
28949
28986
  return isDateBetween(dateValue, today, criterionValue);
28950
28987
  }
28951
28988
  return areDatesSameDay(dateValue, criterionValue);
@@ -51523,5 +51560,5 @@ export { BadExpressionError, BasePlugin, CellErrorType, CircularDependencyError,
51523
51560
 
51524
51561
 
51525
51562
  __info__.version = "19.1.0-alpha.3";
51526
- __info__.date = "2025-12-26T10:26:09.971Z";
51527
- __info__.hash = "e6313bd";
51563
+ __info__.date = "2026-01-07T16:20:59.139Z";
51564
+ __info__.hash = "febc3e9";
@@ -3,8 +3,8 @@
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
5
  * @version 19.1.0-alpha.3
6
- * @date 2025-12-26T10:26:09.971Z
7
- * @hash e6313bd
6
+ * @date 2026-01-07T16:20:59.139Z
7
+ * @hash febc3e9
8
8
  */
9
9
 
10
10
  (function (exports) {
@@ -18115,7 +18115,7 @@
18115
18115
  if (message.type === "CLIENT_JOINED" ||
18116
18116
  message.type === "CLIENT_LEFT" ||
18117
18117
  message.type === "CLIENT_MOVED") {
18118
- this.transportService.sendMessage(message);
18118
+ await this.transportService.sendMessage(message);
18119
18119
  }
18120
18120
  // ignore all other messages
18121
18121
  }
@@ -20734,7 +20734,7 @@
20734
20734
  }
20735
20735
  delete this.clients[this.clientId];
20736
20736
  this.transportService.leave(this.clientId);
20737
- this.transportService.sendMessage({
20737
+ this.sendToTransport({
20738
20738
  type: "CLIENT_LEFT",
20739
20739
  clientId: this.clientId,
20740
20740
  version: MESSAGE_VERSION,
@@ -20748,7 +20748,7 @@
20748
20748
  return;
20749
20749
  }
20750
20750
  const snapshotId = this.uuidGenerator.uuidv4();
20751
- await this.transportService.sendMessage({
20751
+ await this.sendToTransport({
20752
20752
  type: "SNAPSHOT",
20753
20753
  nextRevisionId: snapshotId,
20754
20754
  serverRevisionId: this.serverRevisionId,
@@ -20796,10 +20796,14 @@
20796
20796
  const type = currentPosition ? "CLIENT_MOVED" : "CLIENT_JOINED";
20797
20797
  const client = this.getCurrentClient();
20798
20798
  this.clients[this.clientId] = { ...client, position };
20799
- this.transportService.sendMessage({
20799
+ this.sendToTransport({
20800
20800
  type,
20801
20801
  version: MESSAGE_VERSION,
20802
20802
  client: { ...client, position },
20803
+ }).then(() => {
20804
+ if (this.pendingMessages.length > 0 && !this.waitingAck) {
20805
+ this.sendPendingMessage();
20806
+ }
20803
20807
  });
20804
20808
  }
20805
20809
  /**
@@ -20880,7 +20884,7 @@
20880
20884
  if (client) {
20881
20885
  const { position } = client;
20882
20886
  if (position) {
20883
- this.transportService.sendMessage({
20887
+ this.sendToTransport({
20884
20888
  type: "CLIENT_MOVED",
20885
20889
  version: MESSAGE_VERSION,
20886
20890
  client: { ...client, position },
@@ -20901,6 +20905,10 @@
20901
20905
  }
20902
20906
  this.sendPendingMessage();
20903
20907
  }
20908
+ async sendToTransport(message) {
20909
+ // wrap in an async function to ensure it returns a promise
20910
+ return this.transportService.sendMessage(message);
20911
+ }
20904
20912
  /**
20905
20913
  * Send the next pending message
20906
20914
  */
@@ -20929,9 +20937,14 @@
20929
20937
  ${JSON.stringify(message)}`);
20930
20938
  }
20931
20939
  this.waitingAck = true;
20932
- this.transportService.sendMessage({
20940
+ this.sendToTransport({
20933
20941
  ...message,
20934
20942
  serverRevisionId: this.serverRevisionId,
20943
+ }).catch((e) => {
20944
+ if (!(e instanceof ClientDisconnectedError)) {
20945
+ throw e.cause || e;
20946
+ }
20947
+ this.waitingAck = false;
20935
20948
  });
20936
20949
  }
20937
20950
  acknowledge(message) {
@@ -23913,17 +23926,41 @@
23913
23926
  const today = DateTime.now();
23914
23927
  switch (dateValue) {
23915
23928
  case "today":
23916
- return jsDateToNumber(today);
23917
- case "yesterday":
23918
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 1)));
23919
- case "tomorrow":
23920
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() + 1)));
23929
+ return Math.floor(jsDateToNumber(today));
23930
+ case "yesterday": {
23931
+ today.setDate(today.getDate() - 1);
23932
+ return Math.floor(jsDateToNumber(today));
23933
+ }
23934
+ case "tomorrow": {
23935
+ today.setDate(today.getDate() + 1);
23936
+ return Math.floor(jsDateToNumber(today));
23937
+ }
23921
23938
  case "lastWeek":
23922
- return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 7)));
23923
- case "lastMonth":
23924
- return jsDateToNumber(DateTime.fromTimestamp(today.setMonth(today.getMonth() - 1)));
23939
+ today.setDate(today.getDate() - 6);
23940
+ return Math.floor(jsDateToNumber(today));
23941
+ case "lastMonth": {
23942
+ const lastMonth = today.getMonth() === 0 ? 11 : today.getMonth() - 1;
23943
+ const dateInLastMonth = new DateTime(today.getFullYear(), lastMonth, 1);
23944
+ if (today.getDate() > getDaysInMonth(dateInLastMonth)) {
23945
+ today.setDate(1);
23946
+ }
23947
+ else {
23948
+ today.setDate(today.getDate() + 1);
23949
+ today.setMonth(today.getMonth() - 1);
23950
+ }
23951
+ return Math.floor(jsDateToNumber(today));
23952
+ }
23925
23953
  case "lastYear":
23926
- return jsDateToNumber(DateTime.fromTimestamp(today.setFullYear(today.getFullYear() - 1)));
23954
+ // Handle leap year case
23955
+ if (today.getMonth() === 1 && today.getDate() === 29) {
23956
+ today.setDate(28);
23957
+ today.setFullYear(today.getFullYear() - 1);
23958
+ }
23959
+ else {
23960
+ today.setDate(today.getDate() + 1);
23961
+ today.setFullYear(today.getFullYear() - 1);
23962
+ }
23963
+ return Math.floor(jsDateToNumber(today));
23927
23964
  }
23928
23965
  }
23929
23966
  /** Get all the dates values of a criterion converted to numbers, converting date values such as "today" to actual dates */
@@ -28948,7 +28985,7 @@
28948
28985
  return false;
28949
28986
  }
28950
28987
  if (["lastWeek", "lastMonth", "lastYear"].includes(criterion.dateValue)) {
28951
- const today = jsDateToRoundNumber(DateTime.now());
28988
+ const today = Math.floor(jsDateToNumber(DateTime.now()));
28952
28989
  return isDateBetween(dateValue, today, criterionValue);
28953
28990
  }
28954
28991
  return areDatesSameDay(dateValue, criterionValue);
@@ -51635,8 +51672,8 @@
51635
51672
 
51636
51673
 
51637
51674
  __info__.version = "19.1.0-alpha.3";
51638
- __info__.date = "2025-12-26T10:26:09.971Z";
51639
- __info__.hash = "e6313bd";
51675
+ __info__.date = "2026-01-07T16:20:59.139Z";
51676
+ __info__.hash = "febc3e9";
51640
51677
 
51641
51678
 
51642
51679
  })(this.o_spreadsheet_engine = this.o_spreadsheet_engine || {});