fauna-api 1.0.771 → 1.0.773

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.
@@ -1,3 +1,4 @@
1
+ import { Cicada } from "./index.js";
1
2
  import { Credentials, ApiKey } from "../authentification.js";
2
3
  export type AddressKind = 'email' | 'phone' | 'discord';
3
4
  export type Address = {
@@ -14,6 +15,19 @@ export type Contact = {
14
15
  /** That Fauna account's picture. */
15
16
  icon?: string;
16
17
  };
18
+ /** One of the inbox's owners, behind one of their verified addresses: show "You" when
19
+ * `owner` is your own email, else their name. */
20
+ export type Owner = {
21
+ /** The owner's email. */
22
+ owner: string;
23
+ displayName?: string;
24
+ icon?: string;
25
+ /** The address as it appeared. */
26
+ address: string;
27
+ };
28
+ export declare const Owner: {
29
+ fromJSON(json: any): Owner;
30
+ };
17
31
  /** Every contact, sorted by display name. */
18
32
  export declare function list(authorization: Credentials | ApiKey): Promise<Contact[]>;
19
33
  /** Creates a contact, or with `id` renames one and replaces its addresses. */
@@ -1,4 +1,14 @@
1
1
  import { Cicada } from "./index.js";
2
+ export const Owner = {
3
+ fromJSON(json) {
4
+ return {
5
+ owner: String(json.owner),
6
+ ...(json.displayName ? { displayName: String(json.displayName) } : {}),
7
+ ...(json.icon ? { icon: String(json.icon) } : {}),
8
+ address: String(json.address ?? ''),
9
+ };
10
+ },
11
+ };
2
12
  /** Every contact, sorted by display name. */
3
13
  export async function list(authorization) {
4
14
  const response = await fetch(`${Cicada.getURL()}/cicada/contacts`, {
@@ -1,11 +1,11 @@
1
- import { Contact } from "./contacts.js";
1
+ import { Contact, Owner } from "./contacts.js";
2
2
  import { Platform } from "../integrations.js";
3
3
  import { Credentials, ApiKey } from "../authentification.js";
4
4
  import { File as FaunaFile } from "../drive.js";
5
5
  export type Conversation = {
6
6
  id: string;
7
7
  inboxId?: string;
8
- participants: (Contact | string)[];
8
+ participants: (Contact | Owner | string)[];
9
9
  activeAt: Date;
10
10
  unread: number;
11
11
  };
@@ -22,14 +22,14 @@ export type ScheduledSend = {
22
22
  conversation: string;
23
23
  platform?: Platform;
24
24
  } | {
25
- recipients: (Contact | string)[];
25
+ recipients: (Contact | Owner | string)[];
26
26
  mode: 'broadcast' | 'group';
27
27
  platform: Platform;
28
28
  };
29
29
  };
30
30
  export type Message = {
31
31
  id: string;
32
- author: Contact | string;
32
+ author: Contact | Owner | string;
33
33
  platform: Platform;
34
34
  createdAt: Date;
35
35
  message: string;
@@ -1,4 +1,5 @@
1
1
  import { Cicada } from "./index.js";
2
+ import { Owner } from "./contacts.js";
2
3
  import { Credentials, ApiKey } from "../authentification.js";
3
4
  import WebSocket from "isomorphic-ws";
4
5
  export type CallEnd = {
@@ -65,6 +66,8 @@ export type CallRecord = {
65
66
  direction: 'IN' | 'OUT';
66
67
  /** The other party, E.164. */
67
68
  peer: string;
69
+ /** When `peer` is one of the inbox's owners: who they are. */
70
+ peerOwner?: Owner;
68
71
  /** The inbox's line, E.164. */
69
72
  line: string;
70
73
  status: string;
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _PhoneCall_instances, _PhoneCall_ws, _PhoneCall_statusListeners, _PhoneCall_queue, _PhoneCall_wake, _PhoneCall_closed, _PhoneCall_ended, _PhoneCall_setStatus, _IncomingCall_authorization, _IncomingCall_ringing, _IncomingCall_accepted;
13
13
  import { Cicada } from "./index.js";
14
+ import { Owner } from "./contacts.js";
14
15
  import WebSocket from "isomorphic-ws";
15
16
  function toBytes(data) {
16
17
  if (data instanceof Uint8Array)
@@ -310,6 +311,7 @@ export const CallRecord = {
310
311
  id: String(json.id),
311
312
  direction: json.direction === 'in' ? 'IN' : 'OUT',
312
313
  peer: String(json.peer ?? ''),
314
+ ...(json.peerOwner ? { peerOwner: Owner.fromJSON(json.peerOwner) } : {}),
313
315
  line: String(json.line ?? ''),
314
316
  status: String(json.status ?? ''),
315
317
  startedAt: new Date(json.startedAt),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fauna-api",
3
- "version": "1.0.771",
3
+ "version": "1.0.773",
4
4
  "description": "The Fauna SDK: accounts, Drive, groups, calendar, chats, payments and every Fauna app (Parrot, Marmot, Magpie, Cicada, Ant, Termite), plus React UI.",
5
5
  "homepage": "https://docs.faunakit.com",
6
6
  "repository": {