Message header ID

This commit is contained in:
Wayne
2025-07-26 19:37:11 +03:00
parent 8a74838f43
commit 1d907abdbd
4 changed files with 4 additions and 122 deletions

View File

@@ -161,7 +161,7 @@ export class IngestionService {
if (connector.listAllUsers) {
// For multi-mailbox providers, dispatch a job for each user
for await (const user of connector.listAllUsers()) {
const userEmail = (user as any).primaryEmail;
const userEmail = user.primaryEmail;
if (userEmail) {
await ingestionQueue.add('process-mailbox', {
ingestionSourceId: source.id,

View File

@@ -114,7 +114,7 @@ export class ImapConnector implements IEmailConnector {
public async *fetchEmails(userEmail: string, syncState?: SyncState | null): AsyncGenerator<EmailObject | null> {
try {
const mailboxes = await this.withRetry(() => this.client.list());
console.log('fetched mailboxes:', mailboxes);
// console.log('fetched mailboxes:', mailboxes);
const processableMailboxes = mailboxes.filter(mailbox => {
// filter out trash and all mail emails
if (mailbox.specialUse) {
@@ -209,122 +209,3 @@ export class ImapConnector implements IEmailConnector {
}
/**
* Gmail:
* fetched mailboxes: [
[0] {
[0] path: 'INBOX',
[0] pathAsListed: 'INBOX',
[0] flags: Set(1) { '\\HasNoChildren' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '',
[0] parent: [],
[0] name: 'INBOX',
[0] subscribed: true,
[0] specialUse: '\\Inbox',
[0] specialUseSource: 'name'
[0] },
[0] {
[0] path: '[Gmail]/Starred',
[0] pathAsListed: '[Gmail]/Starred',
[0] flags: Set(2) { '\\Flagged', '\\HasNoChildren' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Starred',
[0] subscribed: true,
[0] specialUse: '\\Flagged',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]/Sent Mail',
[0] pathAsListed: '[Gmail]/Sent Mail',
[0] flags: Set(2) { '\\HasNoChildren', '\\Sent' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Sent Mail',
[0] subscribed: true,
[0] specialUse: '\\Sent',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]/Drafts',
[0] pathAsListed: '[Gmail]/Drafts',
[0] flags: Set(2) { '\\Drafts', '\\HasNoChildren' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Drafts',
[0] subscribed: true,
[0] specialUse: '\\Drafts',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]/All Mail',
[0] pathAsListed: '[Gmail]/All Mail',
[0] flags: Set(2) { '\\All', '\\HasNoChildren' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'All Mail',
[0] subscribed: true,
[0] specialUse: '\\All',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]/Spam',
[0] pathAsListed: '[Gmail]/Spam',
[0] flags: Set(2) { '\\HasNoChildren', '\\Junk' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Spam',
[0] subscribed: true,
[0] specialUse: '\\Junk',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]/Trash',
[0] pathAsListed: '[Gmail]/Trash',
[0] flags: Set(2) { '\\HasNoChildren', '\\Trash' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Trash',
[0] subscribed: true,
[0] specialUse: '\\Trash',
[0] specialUseSource: 'extension'
[0] },
[0] {
[0] path: '[Gmail]',
[0] pathAsListed: '[Gmail]',
[0] flags: Set(2) { '\\HasChildren', '\\Noselect' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '',
[0] parent: [],
[0] name: '[Gmail]',
[0] subscribed: true
[0] },
[0] {
[0] path: '[Gmail]/Important',
[0] pathAsListed: '[Gmail]/Important',
[0] flags: Set(2) { '\\HasNoChildren', '\\Important' },
[0] delimiter: '/',
[0] listed: true,
[0] parentPath: '[Gmail]',
[0] parent: [ '[Gmail]' ],
[0] name: 'Important',
[0] subscribed: true
[0] }
[0] ]
*/

View File

@@ -203,7 +203,7 @@ export class MicrosoftConnector implements IEmailConnector {
const response = await this.graphClient.api(requestUrl).get();
for (const message of response.value) {
if (message.id && !(message as any)['@removed']) {
if (message.id && !(message)['@removed']) {
const rawEmail = await this.getRawEmail(userEmail, message.id);
if (rawEmail) {
yield await this.parseEmail(rawEmail, message.id, userEmail);

View File

@@ -1,2 +1,3 @@
# Defines the pnpm workspace for the monorepo
packages:
- 'packages/*'