@happyvertical/smrt-messages 0.35.2 → 0.35.4
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.
- package/dist/collections/AccountCollection.d.ts.map +1 -1
- package/dist/collections/EmailAccountCollection.d.ts +2 -2
- package/dist/collections/EmailAccountCollection.d.ts.map +1 -1
- package/dist/index.js +33 -31
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +28 -28
- package/dist/models/Account.d.ts +4 -4
- package/dist/models/Account.d.ts.map +1 -1
- package/dist/models/Attachment.d.ts +1 -1
- package/dist/models/Blacklist.d.ts +2 -1
- package/dist/models/Blacklist.d.ts.map +1 -1
- package/dist/models/Email.d.ts +2 -2
- package/dist/models/Email.d.ts.map +1 -1
- package/dist/models/EmailAccount.d.ts +3 -3
- package/dist/models/EmailAccount.d.ts.map +1 -1
- package/dist/models/EmailAttachment.d.ts +1 -1
- package/dist/models/EmailFolder.d.ts +3 -3
- package/dist/models/EmailFolder.d.ts.map +1 -1
- package/dist/models/Message.d.ts +4 -4
- package/dist/models/Message.d.ts.map +1 -1
- package/dist/models/SlackMessage.d.ts +1 -1
- package/dist/models/SlackMessage.d.ts.map +1 -1
- package/dist/models/Whitelist.d.ts +2 -1
- package/dist/models/Whitelist.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +4 -4
- package/dist/svelte/components/MessageFilters.svelte +8 -2
- package/dist/svelte/components/MessageFilters.svelte.d.ts.map +1 -1
- package/dist/svelte/types.d.ts +1 -1
- package/dist/svelte/types.d.ts.map +1 -1
- package/dist/types.d.ts +20 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountCollection.d.ts","sourceRoot":"","sources":["../../src/collections/AccountCollection.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAA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IACG,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIvC;;OAEG;IACG,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIjE;;;;;OAKG;IACG,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAWxD;;OAEG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,OAAO,EAAE,CAAC;IA8BrB;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAuBI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAMlD,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIhC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAG5D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmailAccount } from '../models/EmailAccount';
|
|
2
|
-
import { EmailAccountSearchFilters, ProviderType } from '../types';
|
|
2
|
+
import { EmailAccountSearchFilters, ProviderType, SyncOptions } from '../types';
|
|
3
3
|
import { AccountCollection } from './AccountCollection';
|
|
4
4
|
export declare class EmailAccountCollection extends AccountCollection {
|
|
5
5
|
static readonly _itemClass: typeof EmailAccount;
|
|
@@ -50,7 +50,7 @@ export declare class EmailAccountCollection extends AccountCollection {
|
|
|
50
50
|
/**
|
|
51
51
|
* Sync all active email accounts
|
|
52
52
|
*/
|
|
53
|
-
syncAll(options?:
|
|
53
|
+
syncAll(options?: SyncOptions): Promise<Map<string, {
|
|
54
54
|
success: boolean;
|
|
55
55
|
error?: Error;
|
|
56
56
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailAccountCollection.d.ts","sourceRoot":"","sources":["../../src/collections/EmailAccountCollection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"EmailAccountCollection.d.ts","sourceRoot":"","sources":["../../src/collections/EmailAccountCollection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EACV,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,gBAAyB,UAAU,sBAAgB;IAEnD;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAK7D;;OAEG;IACG,sBAAsB,CAC1B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,YAAY,EAAE,CAAC;IAI1B;;OAEG;IACY,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAInD;;OAEG;IACY,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAIrD;;OAEG;IACG,cAAc,CAAC,aAAa,SAAK,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IASjE;;;OAGG;IACY,MAAM,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,YAAY,EAAE,CAAC;IAI1B;;;OAGG;IACY,iBAAiB,CAC9B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,EAAE,CAAC;IAI1B;;;OAGG;IACY,QAAQ,IAAI,OAAO,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAUF;;OAEG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,YAAY,EAAE,CAAC;IAkC1B;;OAEG;IACG,OAAO,CACX,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;IAqB5D;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAW5C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC;QAC7B,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;KAC1C,CAAC;IA6Ba,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAQvD,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAIrC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAO1E"}
|
package/dist/index.js
CHANGED
|
@@ -1167,15 +1167,16 @@ let EmailAccount = class extends Account {
|
|
|
1167
1167
|
result.folders = foldersToSync;
|
|
1168
1168
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
1169
1169
|
const { EmailFolderCollection: EmailFolderCollection2 } = await Promise.resolve().then(() => EmailFolderCollection$1);
|
|
1170
|
-
const emailCollection = await EmailCollection2.create(
|
|
1171
|
-
|
|
1172
|
-
)
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1170
|
+
const emailCollection = await EmailCollection2.create(this.options);
|
|
1171
|
+
const folderCollection = await EmailFolderCollection2.create(this.options);
|
|
1172
|
+
if (!this.id) {
|
|
1173
|
+
throw new Error(
|
|
1174
|
+
"EmailAccount.syncFrom requires a persisted account (missing id)"
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
const accountId = this.id;
|
|
1176
1178
|
for (const folderName of foldersToSync) {
|
|
1177
1179
|
try {
|
|
1178
|
-
const accountId = this.id ?? "";
|
|
1179
1180
|
let folder = await folderCollection.getByPath(accountId, folderName);
|
|
1180
1181
|
if (!folder) {
|
|
1181
1182
|
const { EmailFolder: EmailFolder2 } = await Promise.resolve().then(() => EmailFolder$1);
|
|
@@ -1203,7 +1204,7 @@ let EmailAccount = class extends Account {
|
|
|
1203
1204
|
result.messagesProcessed++;
|
|
1204
1205
|
try {
|
|
1205
1206
|
const existingEmail = await emailCollection.getByMessageId(
|
|
1206
|
-
|
|
1207
|
+
accountId,
|
|
1207
1208
|
msg.messageId || ""
|
|
1208
1209
|
);
|
|
1209
1210
|
if (existingEmail && !options.fullSync) {
|
|
@@ -1234,7 +1235,7 @@ let EmailAccount = class extends Account {
|
|
|
1234
1235
|
email.textBody = msg.text || "";
|
|
1235
1236
|
email.htmlBody = msg.html || "";
|
|
1236
1237
|
email.body = msg.text || "";
|
|
1237
|
-
email.folderId = folder.id;
|
|
1238
|
+
email.folderId = folder.id ?? "";
|
|
1238
1239
|
email.folderPath = folderName;
|
|
1239
1240
|
email.labels = JSON.stringify(msg.labels || []);
|
|
1240
1241
|
email.flags = JSON.stringify(msg.flags || []);
|
|
@@ -1262,10 +1263,9 @@ let EmailAccount = class extends Account {
|
|
|
1262
1263
|
}
|
|
1263
1264
|
}
|
|
1264
1265
|
}
|
|
1265
|
-
|
|
1266
|
-
folder.
|
|
1267
|
-
|
|
1268
|
-
);
|
|
1266
|
+
const folderId = folder.id ?? "";
|
|
1267
|
+
folder.messageCount = await emailCollection.countByFolder(folderId);
|
|
1268
|
+
folder.unreadCount = await emailCollection.countUnreadByFolder(folderId);
|
|
1269
1269
|
await folder.save();
|
|
1270
1270
|
} catch (error) {
|
|
1271
1271
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1294,9 +1294,7 @@ let EmailAccount = class extends Account {
|
|
|
1294
1294
|
*/
|
|
1295
1295
|
async getFolders() {
|
|
1296
1296
|
const { EmailFolderCollection: EmailFolderCollection2 } = await Promise.resolve().then(() => EmailFolderCollection$1);
|
|
1297
|
-
const collection = await EmailFolderCollection2.create(
|
|
1298
|
-
this.options
|
|
1299
|
-
);
|
|
1297
|
+
const collection = await EmailFolderCollection2.create(this.options);
|
|
1300
1298
|
return await collection.list({ where: { accountId: this.id } });
|
|
1301
1299
|
}
|
|
1302
1300
|
/**
|
|
@@ -1305,7 +1303,9 @@ let EmailAccount = class extends Account {
|
|
|
1305
1303
|
async getEmails(limit) {
|
|
1306
1304
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
1307
1305
|
const collection = await EmailCollection2.create(this.options);
|
|
1308
|
-
const options = {
|
|
1306
|
+
const options = {
|
|
1307
|
+
where: { accountId: this.id }
|
|
1308
|
+
};
|
|
1309
1309
|
if (limit) {
|
|
1310
1310
|
options.limit = limit;
|
|
1311
1311
|
}
|
|
@@ -1317,7 +1317,7 @@ let EmailAccount = class extends Account {
|
|
|
1317
1317
|
async getUnreadCount() {
|
|
1318
1318
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
1319
1319
|
const collection = await EmailCollection2.create(this.options);
|
|
1320
|
-
return await collection.countUnreadByAccount(this.id);
|
|
1320
|
+
return await collection.countUnreadByAccount(this.id ?? "");
|
|
1321
1321
|
}
|
|
1322
1322
|
/**
|
|
1323
1323
|
* Store credentials securely using smrt-secrets (email-specific)
|
|
@@ -1783,9 +1783,7 @@ let Email = class extends Message {
|
|
|
1783
1783
|
async getAccount() {
|
|
1784
1784
|
if (!this.accountId) return null;
|
|
1785
1785
|
const { EmailAccountCollection: EmailAccountCollection2 } = await Promise.resolve().then(() => EmailAccountCollection$1);
|
|
1786
|
-
const collection = await EmailAccountCollection2.create(
|
|
1787
|
-
this.options
|
|
1788
|
-
);
|
|
1786
|
+
const collection = await EmailAccountCollection2.create(this.options);
|
|
1789
1787
|
return await collection.get({ id: this.accountId });
|
|
1790
1788
|
}
|
|
1791
1789
|
/**
|
|
@@ -1794,9 +1792,7 @@ let Email = class extends Message {
|
|
|
1794
1792
|
async getFolder() {
|
|
1795
1793
|
if (!this.folderId) return null;
|
|
1796
1794
|
const { EmailFolderCollection: EmailFolderCollection2 } = await Promise.resolve().then(() => EmailFolderCollection$1);
|
|
1797
|
-
const collection = await EmailFolderCollection2.create(
|
|
1798
|
-
this.options
|
|
1799
|
-
);
|
|
1795
|
+
const collection = await EmailFolderCollection2.create(this.options);
|
|
1800
1796
|
return await collection.get({ id: this.folderId });
|
|
1801
1797
|
}
|
|
1802
1798
|
/**
|
|
@@ -1806,7 +1802,7 @@ let Email = class extends Message {
|
|
|
1806
1802
|
if (!this.threadId) return [this];
|
|
1807
1803
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
1808
1804
|
const collection = await EmailCollection2.create(this.options);
|
|
1809
|
-
return await collection.
|
|
1805
|
+
return await collection.getByThread(this.threadId);
|
|
1810
1806
|
}
|
|
1811
1807
|
/**
|
|
1812
1808
|
* Get a short preview of the email body
|
|
@@ -2221,9 +2217,7 @@ let EmailFolder = class extends SmrtObject {
|
|
|
2221
2217
|
async getAccount() {
|
|
2222
2218
|
if (!this.accountId) return null;
|
|
2223
2219
|
const { EmailAccountCollection: EmailAccountCollection2 } = await Promise.resolve().then(() => EmailAccountCollection$1);
|
|
2224
|
-
const collection = await EmailAccountCollection2.create(
|
|
2225
|
-
this.options
|
|
2226
|
-
);
|
|
2220
|
+
const collection = await EmailAccountCollection2.create(this.options);
|
|
2227
2221
|
return await collection.get({ id: this.accountId });
|
|
2228
2222
|
}
|
|
2229
2223
|
/**
|
|
@@ -2232,7 +2226,9 @@ let EmailFolder = class extends SmrtObject {
|
|
|
2232
2226
|
async getEmails(limit) {
|
|
2233
2227
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
2234
2228
|
const collection = await EmailCollection2.create(this.options);
|
|
2235
|
-
const options = {
|
|
2229
|
+
const options = {
|
|
2230
|
+
where: { folderId: this.id }
|
|
2231
|
+
};
|
|
2236
2232
|
if (limit) {
|
|
2237
2233
|
options.limit = limit;
|
|
2238
2234
|
}
|
|
@@ -2256,10 +2252,16 @@ let EmailFolder = class extends SmrtObject {
|
|
|
2256
2252
|
* Update message counts from database
|
|
2257
2253
|
*/
|
|
2258
2254
|
async refreshCounts() {
|
|
2255
|
+
if (!this.id) {
|
|
2256
|
+
throw new Error(
|
|
2257
|
+
"EmailFolder.refreshCounts requires a persisted folder (missing id)"
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2260
|
+
const folderId = this.id;
|
|
2259
2261
|
const { EmailCollection: EmailCollection2 } = await Promise.resolve().then(() => EmailCollection$1);
|
|
2260
2262
|
const collection = await EmailCollection2.create(this.options);
|
|
2261
|
-
this.messageCount = await collection.countByFolder(
|
|
2262
|
-
this.unreadCount = await collection.countUnreadByFolder(
|
|
2263
|
+
this.messageCount = await collection.countByFolder(folderId);
|
|
2264
|
+
this.unreadCount = await collection.countUnreadByFolder(folderId);
|
|
2263
2265
|
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2264
2266
|
await this.save();
|
|
2265
2267
|
}
|