@awesomate/sdk 0.64.0 → 0.66.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 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.64.0";
29
+ export declare const VERSION = "0.66.0";
30
30
  /** Augmented by the generated awesomate.d.ts, so each kind's rows are typed. */
31
31
  export interface Kinds {
32
32
  }
@@ -1036,6 +1036,19 @@ export declare class AwesomateClient {
1036
1036
  * `abn`); `abn: null` clears it.
1037
1037
  */
1038
1038
  upsert: (spec: CompanySpec) => Promise<CompanyUpsertResult>;
1039
+ /**
1040
+ * Hide a company from every list, search and picker. Nothing is deleted: the people at it keep
1041
+ * their company link, and `restore` brings it back. Answers how many people are still linked.
1042
+ */
1043
+ archive: (id: string) => Promise<CompanyArchiveResult>;
1044
+ /** Bring an archived company back, under its current name, for the people still linked to it. */
1045
+ restore: (id: string) => Promise<CompanyArchiveResult>;
1046
+ /** The archived companies, newest first (up to 200; `more` says there are older ones), with how many people are still linked to each. */
1047
+ archived: () => Promise<{
1048
+ companies: ArchivedCompany[];
1049
+ more: boolean;
1050
+ note?: string;
1051
+ }>;
1039
1052
  };
1040
1053
  /**
1041
1054
  * Calls: the calls the account's phone agents took, read by person. Needs the account's token
@@ -1111,16 +1124,13 @@ export declare class AwesomateClient {
1111
1124
  * Null when there is none (an id that is not one never reaches the hub).
1112
1125
  */
1113
1126
  get: (id: string) => Promise<EmailDetail | null>;
1114
- /** A new draft to list `topic` (a key from `lists()`). `checks.blockers` must be empty before a person can approve it. */
1115
- draft: (input: {
1116
- topic: string;
1117
- doc: EmailDoc;
1118
- }) => Promise<EmailDraft>;
1127
+ /**
1128
+ * A new draft to list `topic` (a key from `lists()`). `checks.blockers` must be empty before a
1129
+ * person can approve it. `send_at` proposes when it goes (see `EmailDraftInput`).
1130
+ */
1131
+ draft: (input: EmailDraftInput) => Promise<EmailDraft>;
1119
1132
  /** Replace a draft. Once someone approved it, it is refused: a person changes it in the hub. */
1120
- update: (id: string, input: {
1121
- topic: string;
1122
- doc: EmailDoc;
1123
- }) => Promise<EmailDraft>;
1133
+ update: (id: string, input: EmailDraftInput) => Promise<EmailDraft>;
1124
1134
  /**
1125
1135
  * Throw a draft away. A draft only: an approved, sending or sent email throws `unavailable`
1126
1136
  * (server code `not_a_draft`, the case in `reason`). Nothing is deleted: the draft is stopped
@@ -3637,6 +3647,19 @@ export interface EmailSeriesWrite {
3637
3647
  pending?: true;
3638
3648
  job_id?: string;
3639
3649
  }
3650
+ /** What `emails.draft()` and `emails.update()` take. */
3651
+ export interface EmailDraftInput {
3652
+ /** The list's key, from `emails.lists()`. */
3653
+ topic: string;
3654
+ doc: EmailDoc;
3655
+ /**
3656
+ * A proposed time it goes: a date and time on the business's own clock (`'2026-10-21T09:00'`) or an
3657
+ * instant with its offset, a few minutes to 60 days ahead; `null` clears it. Only a proposal: the
3658
+ * person who approves it in the hub confirms or changes the time. Needs scheduled emails on the
3659
+ * account (`unavailable`, server code `feature_unavailable`, otherwise). A bad time saves nothing.
3660
+ */
3661
+ send_at?: string | null;
3662
+ }
3640
3663
  /** A draft, from `emails.draft()` or `emails.update()`. */
3641
3664
  export interface EmailDraft {
3642
3665
  id: string;
@@ -3655,6 +3678,13 @@ export interface EmailDraft {
3655
3678
  reviewUrl: string;
3656
3679
  /** What happens next, to tell the owner. */
3657
3680
  next: string;
3681
+ /** The proposed time, when one was given and kept. */
3682
+ send_at?: string | null;
3683
+ send_tz?: string | null;
3684
+ /** "Wed 21 Oct, 9:00 am (Sydney time)". */
3685
+ send_when?: string | null;
3686
+ /** Set when the draft was saved but the time given with it was not: why, in a sentence to pass on. */
3687
+ send_at_refused?: string;
3658
3688
  }
3659
3689
  /** One email, from `emails.get()`. */
3660
3690
  export interface EmailDetail {
@@ -3676,6 +3706,12 @@ export interface EmailDetail {
3676
3706
  reviewUrl: string;
3677
3707
  /** Opens, clicks, bounces and replies over time, once sent; null when it could not be read. */
3678
3708
  timeline: unknown;
3709
+ /** When it goes: a draft's proposed time, or the approved one. Null to go when approved. */
3710
+ send_at?: string | null;
3711
+ /** The same time in words, in the zone it was chosen in. */
3712
+ send_when?: string | null;
3713
+ /** Approved and waiting for its time. */
3714
+ scheduled?: boolean;
3679
3715
  }
3680
3716
  /** `emails.discard()`: the draft is stopped and left out of the lists. */
3681
3717
  export interface EmailDiscarded {
@@ -4377,6 +4413,21 @@ export interface CompanySpec {
4377
4413
  /** Other fields by key: website, phone, email, address, or the owner's own. */
4378
4414
  data?: Record<string, unknown>;
4379
4415
  }
4416
+ /** What companies.archive() and companies.restore() did. */
4417
+ export interface CompanyArchiveResult {
4418
+ id: string;
4419
+ /** True after archive(), false after restore(). */
4420
+ archived: boolean;
4421
+ /** How many people are still linked to the company. */
4422
+ people: number;
4423
+ }
4424
+ /** An archived company, from companies.archived(). */
4425
+ export interface ArchivedCompany {
4426
+ id: string;
4427
+ name: string | null;
4428
+ archived_at: string;
4429
+ people: number;
4430
+ }
4380
4431
  /** What companies.upsert() did. */
4381
4432
  export interface CompanyUpsertResult {
4382
4433
  id: string;
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.64.0';
29
+ export const VERSION = '0.66.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;
@@ -720,6 +720,15 @@ export class AwesomateClient {
720
720
  * `abn`); `abn: null` clears it.
721
721
  */
722
722
  upsert: (spec) => this.request('POST', '/api/my-crm/v1/companies', spec, false),
723
+ /**
724
+ * Hide a company from every list, search and picker. Nothing is deleted: the people at it keep
725
+ * their company link, and `restore` brings it back. Answers how many people are still linked.
726
+ */
727
+ archive: (id) => this.request('POST', `/api/my-crm/v1/companies/${encodeURIComponent(String(id))}/archive`, {}, false),
728
+ /** Bring an archived company back, under its current name, for the people still linked to it. */
729
+ restore: (id) => this.request('POST', `/api/my-crm/v1/companies/${encodeURIComponent(String(id))}/restore`, {}, false),
730
+ /** The archived companies, newest first (up to 200; `more` says there are older ones), with how many people are still linked to each. */
731
+ archived: () => this.request('GET', '/api/my-crm/v1/companies/archived'),
723
732
  };
724
733
  /**
725
734
  * Calls: the calls the account's phone agents took, read by person. Needs the account's token
@@ -801,7 +810,10 @@ export class AwesomateClient {
801
810
  return null;
802
811
  return nullIfMissing(this.request('GET', `/api/my-crm/v1/emails/${encodeURIComponent(String(id))}`));
803
812
  },
804
- /** A new draft to list `topic` (a key from `lists()`). `checks.blockers` must be empty before a person can approve it. */
813
+ /**
814
+ * A new draft to list `topic` (a key from `lists()`). `checks.blockers` must be empty before a
815
+ * person can approve it. `send_at` proposes when it goes (see `EmailDraftInput`).
816
+ */
805
817
  draft: (input) => this.request('POST', '/api/my-crm/v1/emails', input, false),
806
818
  /** Replace a draft. Once someone approved it, it is refused: a person changes it in the hub. */
807
819
  update: async (id, input) => this.request('PATCH', `/api/my-crm/v1/emails/${emailId(id)}`, input, false),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/sdk",
3
- "version": "0.64.0",
3
+ "version": "0.66.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",