@bobfrankston/mailx-imap 0.1.144 → 0.1.147
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/index.js +32 -4
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -6181,7 +6181,11 @@ export class ImapManager extends EventEmitter {
|
|
|
6181
6181
|
try {
|
|
6182
6182
|
do {
|
|
6183
6183
|
const params = new URLSearchParams({
|
|
6184
|
-
|
|
6184
|
+
// The full contact card. Before 2026-08-07 this asked for
|
|
6185
|
+
// names/emails/orgs only, so phone numbers, job titles,
|
|
6186
|
+
// postal addresses, websites, notes and birthdays that
|
|
6187
|
+
// Google already held were thrown away on every sync.
|
|
6188
|
+
personFields: "names,emailAddresses,organizations,photos,phoneNumbers,addresses,urls,biographies,birthdays",
|
|
6185
6189
|
pageSize: "100",
|
|
6186
6190
|
});
|
|
6187
6191
|
if (nextPageToken)
|
|
@@ -6232,7 +6236,25 @@ export class ImapManager extends EventEmitter {
|
|
|
6232
6236
|
const names = person.names || [];
|
|
6233
6237
|
const orgs = person.organizations || [];
|
|
6234
6238
|
const name = names[0]?.displayName || "";
|
|
6235
|
-
|
|
6239
|
+
// Google returns each field as an array of typed
|
|
6240
|
+
// entries (home/work/other) ordered with the primary
|
|
6241
|
+
// first; we keep the first of each. Birthdays come as
|
|
6242
|
+
// {date:{year?,month,day}} — year is optional, and a
|
|
6243
|
+
// missing one is normal (people omit it), so format as
|
|
6244
|
+
// YYYY-MM-DD when known and --MM-DD when not.
|
|
6245
|
+
const bd = person.birthdays?.[0]?.date;
|
|
6246
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
6247
|
+
const card = {
|
|
6248
|
+
organization: orgs[0]?.name || "",
|
|
6249
|
+
title: orgs[0]?.title || "",
|
|
6250
|
+
phone: person.phoneNumbers?.[0]?.value || "",
|
|
6251
|
+
address: person.addresses?.[0]?.formattedValue || "",
|
|
6252
|
+
website: person.urls?.[0]?.value || "",
|
|
6253
|
+
notes: person.biographies?.[0]?.value || "",
|
|
6254
|
+
birthday: bd?.month && bd?.day
|
|
6255
|
+
? `${bd.year ? bd.year : "-"}-${pad(bd.month)}-${pad(bd.day)}`
|
|
6256
|
+
: "",
|
|
6257
|
+
};
|
|
6236
6258
|
for (const emailEntry of emails) {
|
|
6237
6259
|
const email = emailEntry.value?.toLowerCase();
|
|
6238
6260
|
if (!email)
|
|
@@ -6243,9 +6265,15 @@ export class ImapManager extends EventEmitter {
|
|
|
6243
6265
|
if (wasNew)
|
|
6244
6266
|
changed++;
|
|
6245
6267
|
try {
|
|
6246
|
-
this.db.db.prepare(
|
|
6268
|
+
this.db.db.prepare(`UPDATE contacts SET source = 'google', google_id = ?, organization = ?, title = ?,
|
|
6269
|
+
phone = ?, address = ?, website = ?, notes = ?, birthday = ?, updated_at = ?
|
|
6270
|
+
WHERE email = ?`).run(googleId, card.organization, card.title, card.phone, card.address, card.website, card.notes, card.birthday, now, email);
|
|
6271
|
+
}
|
|
6272
|
+
catch (e) {
|
|
6273
|
+
// Loud: a schema drift here silently reverts the
|
|
6274
|
+
// address book to name+email only.
|
|
6275
|
+
console.error(` [contacts] field update failed for ${email}: ${e?.message || e}`);
|
|
6247
6276
|
}
|
|
6248
|
-
catch { /* ignore */ }
|
|
6249
6277
|
}
|
|
6250
6278
|
}
|
|
6251
6279
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.147",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
12
|
+
"@bobfrankston/mailx-types": "^0.1.39",
|
|
13
13
|
"@bobfrankston/mailx-settings": "^0.1.48",
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.82",
|
|
15
15
|
"@bobfrankston/iflow-direct": "^0.1.65",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.8",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.9",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
".transformedSnapshot": {
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@bobfrankston/mailx-types": "^0.1.
|
|
40
|
+
"@bobfrankston/mailx-types": "^0.1.39",
|
|
41
41
|
"@bobfrankston/mailx-settings": "^0.1.48",
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.82",
|
|
43
43
|
"@bobfrankston/iflow-direct": "^0.1.65",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.8",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.9",
|