@awesomate/sdk 0.92.0 → 0.93.0
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/index.d.ts +79 -1
- package/dist/index.js +26 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* Docs: https://hub.awesomate.ai/docs/sdk/
|
|
27
27
|
*/
|
|
28
28
|
/** This package's version, sent to the hub with every server call. */
|
|
29
|
-
export declare const VERSION = "0.
|
|
29
|
+
export declare const VERSION = "0.93.0";
|
|
30
30
|
/** Augmented by the generated awesomate.d.ts, so each kind's rows are typed. */
|
|
31
31
|
export interface Kinds {
|
|
32
32
|
}
|
|
@@ -1385,6 +1385,30 @@ export declare class AwesomateClient {
|
|
|
1385
1385
|
}) => Promise<EmailBrief>;
|
|
1386
1386
|
/** The result of a `brief()` that answered `pending`: still `pending`, or the questions or the draft. */
|
|
1387
1387
|
briefStatus: (jobId: string) => Promise<EmailBrief>;
|
|
1388
|
+
/**
|
|
1389
|
+
* The addresses an email can go from (needs `own_address` on the account): the sending name, then
|
|
1390
|
+
* each of the account's own ready addresses with its uses and whether it fits an email to a list,
|
|
1391
|
+
* or to `picked` people picked by hand (50 or fewer is one-to-one). Null when there are no own
|
|
1392
|
+
* addresses: every email goes from the sending name. Pass a choice's `value` as `from` on `draft()`.
|
|
1393
|
+
*
|
|
1394
|
+
* @example
|
|
1395
|
+
* const choices = await db.emails.fromChoices({ picked: 1 });
|
|
1396
|
+
* const own = choices?.find((c) => c.own && c.allowed);
|
|
1397
|
+
*/
|
|
1398
|
+
fromChoices: (opts?: {
|
|
1399
|
+
picked?: number;
|
|
1400
|
+
}) => Promise<EmailFromChoice[] | null>;
|
|
1401
|
+
/**
|
|
1402
|
+
* The usual From for each kind of email (`one_to_one`: an email to one person; `automation`: an
|
|
1403
|
+
* automation's service email that names no From), and the owner's own addresses it can be. Needs crm:read.
|
|
1404
|
+
*/
|
|
1405
|
+
fromDefaults: () => Promise<EmailFromDefaults>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Set the usual From for a kind of email to one of the owner's own ready addresses set up for it,
|
|
1408
|
+
* or `'sending_name'` to go back to the sending name. Only the account owner's key (needs crm:draft
|
|
1409
|
+
* and `own_address`). It never adds or proves an address: the owner does that in the hub.
|
|
1410
|
+
*/
|
|
1411
|
+
setFromDefault: (kind: EmailFromDefaultKind, from: string) => Promise<EmailFromDefaults>;
|
|
1388
1412
|
};
|
|
1389
1413
|
/**
|
|
1390
1414
|
* Email series: emails that go to one person at a time over days, starting when something
|
|
@@ -5383,6 +5407,52 @@ export interface EmailDraftInput {
|
|
|
5383
5407
|
* is saved.
|
|
5384
5408
|
*/
|
|
5385
5409
|
record?: string | null;
|
|
5410
|
+
/**
|
|
5411
|
+
* Which address it goes from (needs `own_address`): `'sending_name'`, or one of the account's own
|
|
5412
|
+
* ready addresses from `fromChoices()`. Left out, a new one-to-one email from the owner's key goes from
|
|
5413
|
+
* the account's usual one-to-one From, and anything else keeps the From it has. Approval refuses an
|
|
5414
|
+
* address not set up for the email.
|
|
5415
|
+
*/
|
|
5416
|
+
from?: string;
|
|
5417
|
+
}
|
|
5418
|
+
/** The kinds of email a usual From is set for. */
|
|
5419
|
+
export type EmailFromDefaultKind = 'one_to_one' | 'automation';
|
|
5420
|
+
/** One address an email can go from, from `emails.fromChoices()` (and `from_choices` on `get()` and `preview()`). */
|
|
5421
|
+
export interface EmailFromChoice {
|
|
5422
|
+
/** `'sending_name'`, or the own address itself: what to pass as `from`. */
|
|
5423
|
+
value: string;
|
|
5424
|
+
address: string;
|
|
5425
|
+
/** An address of the business's own, at its own domain (not its sending name). */
|
|
5426
|
+
own: boolean;
|
|
5427
|
+
/** Whether this email could go from it now. */
|
|
5428
|
+
allowed: boolean;
|
|
5429
|
+
/** When it can't: the use it isn't switched on for. */
|
|
5430
|
+
needs?: 'one_to_one' | 'invites' | 'lists';
|
|
5431
|
+
/** When it can't: list emails from it are stopped for now. */
|
|
5432
|
+
paused?: boolean;
|
|
5433
|
+
/** An own address's uses, as the owner switched them on. */
|
|
5434
|
+
uses?: Array<'one_to_one' | 'invites' | 'lists'>;
|
|
5435
|
+
/** The name on its From line; null for the personal name. */
|
|
5436
|
+
name?: string | null;
|
|
5437
|
+
label: string;
|
|
5438
|
+
/** Why it can't be chosen for this email, in a sentence. */
|
|
5439
|
+
note?: string;
|
|
5440
|
+
/** For an own address on an email to many people: what the owner should know first. */
|
|
5441
|
+
warning?: string;
|
|
5442
|
+
}
|
|
5443
|
+
/** From `emails.fromDefaults()` and `emails.setFromDefault()`. */
|
|
5444
|
+
export interface EmailFromDefaults {
|
|
5445
|
+
/** Each kind: the address (null: the sending name), and whether it is used now (false: it no longer fits, so the sending name goes). */
|
|
5446
|
+
defaults: Array<{
|
|
5447
|
+
kind: EmailFromDefaultKind;
|
|
5448
|
+
address: string | null;
|
|
5449
|
+
applies: boolean;
|
|
5450
|
+
}>;
|
|
5451
|
+
/** The owner's own ready addresses, each with its uses: what a usual From can be. */
|
|
5452
|
+
addresses: Array<{
|
|
5453
|
+
address: string;
|
|
5454
|
+
uses: Array<'one_to_one' | 'invites' | 'lists'>;
|
|
5455
|
+
}>;
|
|
5386
5456
|
}
|
|
5387
5457
|
/** Who a picked-people email reaches, as a model may see it. */
|
|
5388
5458
|
export interface EmailReach {
|
|
@@ -5459,6 +5529,10 @@ export interface EmailPreview {
|
|
|
5459
5529
|
checks: EmailSeriesChecks | null;
|
|
5460
5530
|
reviewUrl: string;
|
|
5461
5531
|
next: string;
|
|
5532
|
+
/** The addresses it could go from (only when the account has its own ready addresses). */
|
|
5533
|
+
from_choices?: EmailFromChoice[];
|
|
5534
|
+
/** True when the choices could not be read just now. */
|
|
5535
|
+
from_choices_unread?: true;
|
|
5462
5536
|
}
|
|
5463
5537
|
/** From `emails.test()`. */
|
|
5464
5538
|
export interface EmailTestSent {
|
|
@@ -5530,6 +5604,10 @@ export interface EmailDetail {
|
|
|
5530
5604
|
shape?: 'direct';
|
|
5531
5605
|
/** A one-to-one email's record (the id of the job, booking or quote it is about), or null. */
|
|
5532
5606
|
record?: string | null;
|
|
5607
|
+
/** The addresses it could go from (only when the account has its own ready addresses). */
|
|
5608
|
+
from_choices?: EmailFromChoice[];
|
|
5609
|
+
/** True when the choices could not be read just now. */
|
|
5610
|
+
from_choices_unread?: true;
|
|
5533
5611
|
}
|
|
5534
5612
|
/** `emails.discard()`: the draft is stopped and left out of the lists. */
|
|
5535
5613
|
export interface EmailDiscarded {
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* Docs: https://hub.awesomate.ai/docs/sdk/
|
|
27
27
|
*/
|
|
28
28
|
/** This package's version, sent to the hub with every server call. */
|
|
29
|
-
export const VERSION = '0.
|
|
29
|
+
export const VERSION = '0.93.0';
|
|
30
30
|
const DEFAULT_BASE = 'https://hub.awesomate.ai';
|
|
31
31
|
/** The one check for a platform `watch_url` (mirrored in the hub's awesomate-knowledge.ts and its MCP). */
|
|
32
32
|
const WATCH_URL = /^https:\/\/[^\s"'<>]+$/i;
|
|
@@ -1108,6 +1108,31 @@ export class AwesomateClient {
|
|
|
1108
1108
|
},
|
|
1109
1109
|
/** The result of a `brief()` that answered `pending`: still `pending`, or the questions or the draft. */
|
|
1110
1110
|
briefStatus: async (jobId) => briefFromWire(await this.request('GET', `/api/my-crm/v1/emails/brief/${encodeURIComponent(jobId)}`)),
|
|
1111
|
+
/**
|
|
1112
|
+
* The addresses an email can go from (needs `own_address` on the account): the sending name, then
|
|
1113
|
+
* each of the account's own ready addresses with its uses and whether it fits an email to a list,
|
|
1114
|
+
* or to `picked` people picked by hand (50 or fewer is one-to-one). Null when there are no own
|
|
1115
|
+
* addresses: every email goes from the sending name. Pass a choice's `value` as `from` on `draft()`.
|
|
1116
|
+
*
|
|
1117
|
+
* @example
|
|
1118
|
+
* const choices = await db.emails.fromChoices({ picked: 1 });
|
|
1119
|
+
* const own = choices?.find((c) => c.own && c.allowed);
|
|
1120
|
+
*/
|
|
1121
|
+
fromChoices: async (opts = {}) => {
|
|
1122
|
+
const q = opts.picked !== undefined ? `?people=${encodeURIComponent(String(opts.picked))}` : '';
|
|
1123
|
+
return (await this.request('GET', `/api/my-crm/v1/emails/from-choices${q}`)).from?.choices ?? null;
|
|
1124
|
+
},
|
|
1125
|
+
/**
|
|
1126
|
+
* The usual From for each kind of email (`one_to_one`: an email to one person; `automation`: an
|
|
1127
|
+
* automation's service email that names no From), and the owner's own addresses it can be. Needs crm:read.
|
|
1128
|
+
*/
|
|
1129
|
+
fromDefaults: async () => this.request('GET', '/api/my-crm/v1/emails/from-defaults'),
|
|
1130
|
+
/**
|
|
1131
|
+
* Set the usual From for a kind of email to one of the owner's own ready addresses set up for it,
|
|
1132
|
+
* or `'sending_name'` to go back to the sending name. Only the account owner's key (needs crm:draft
|
|
1133
|
+
* and `own_address`). It never adds or proves an address: the owner does that in the hub.
|
|
1134
|
+
*/
|
|
1135
|
+
setFromDefault: async (kind, from) => this.request('PUT', '/api/my-crm/v1/emails/from-defaults', { kind, from }, false),
|
|
1111
1136
|
};
|
|
1112
1137
|
/**
|
|
1113
1138
|
* Email series: emails that go to one person at a time over days, starting when something
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesomate/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"description": "Your own Awesomate data from Node and the browser: query contacts and app data with generated types, and sign your app's own users in",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|