shuttlepro-shared 1.5.17 → 1.5.19

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.
@@ -57,7 +57,29 @@ const conversationSchema = new mongoose.Schema(
57
57
  },
58
58
  labels: [{ type: Schema.Types.ObjectId, ref: "Label" }],
59
59
  title: { type: String },
60
- platformTimestamp: { type: String, default: "" },
60
+ // Always store epoch-ms string so list sort works across channels.
61
+ // SMTP/email Date values otherwise become "Fri Jul 31 2026 ..." via String(date).
62
+ platformTimestamp: {
63
+ type: String,
64
+ default: "",
65
+ set(value) {
66
+ if (value == null || value === "") return "";
67
+ if (value instanceof Date) {
68
+ const ms = value.getTime();
69
+ return Number.isNaN(ms) ? "" : String(ms);
70
+ }
71
+ if (typeof value === "number") {
72
+ return Number.isFinite(value) && value > 0
73
+ ? String(Math.trunc(value))
74
+ : "";
75
+ }
76
+ const asString = String(value).trim();
77
+ if (!asString) return "";
78
+ if (/^\d+$/.test(asString)) return asString;
79
+ const parsed = new Date(asString).getTime();
80
+ return Number.isNaN(parsed) ? asString : String(parsed);
81
+ },
82
+ },
61
83
  status: {
62
84
  type: String,
63
85
  enum: ["open", "processing", "hold", "closed"],
@@ -125,6 +147,7 @@ const conversationSchema = new mongoose.Schema(
125
147
  type: {
126
148
  id: { type: String, default: "" },
127
149
  threadId: { type: String, default: "" },
150
+ title: { type: String, default: "" },
128
151
  },
129
152
  default: null,
130
153
  },
@@ -133,6 +156,7 @@ const conversationSchema = new mongoose.Schema(
133
156
  {
134
157
  id: { type: String, default: "" },
135
158
  threadId: { type: String, default: "" },
159
+ title: { type: String, default: "" },
136
160
  },
137
161
  ],
138
162
  default: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.5.17",
3
+ "version": "1.5.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {