@macro-inc/sdk 0.0.1
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/README.md +177 -0
- package/dist/chunk-5HAKQN23.js +1263 -0
- package/dist/chunk-77EI4LSQ.js +2492 -0
- package/dist/chunk-CTKR64MY.js +1436 -0
- package/dist/chunk-JXIQT5TH.js +1467 -0
- package/dist/chunk-P4DTO6VD.js +830 -0
- package/dist/chunk-PAAFJYGO.js +967 -0
- package/dist/chunk-QNUS5BC5.js +913 -0
- package/dist/chunk-SGAHIERJ.js +1235 -0
- package/dist/chunk-V45LUJDI.js +838 -0
- package/dist/chunk-YRUXFEZM.js +1044 -0
- package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
- package/dist/generated/agent-harness/client/index.d.ts +10 -0
- package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
- package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
- package/dist/generated/agent-harness/client.gen.d.ts +12 -0
- package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
- package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
- package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
- package/dist/generated/agent-harness/index.d.ts +2 -0
- package/dist/generated/agent-harness/index.js +6 -0
- package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
- package/dist/generated/agent-harness/types.gen.d.ts +539 -0
- package/dist/generated/auth/client/client.gen.d.ts +2 -0
- package/dist/generated/auth/client/index.d.ts +10 -0
- package/dist/generated/auth/client/types.gen.d.ts +120 -0
- package/dist/generated/auth/client/utils.gen.d.ts +37 -0
- package/dist/generated/auth/client.gen.d.ts +12 -0
- package/dist/generated/auth/core/auth.gen.d.ts +25 -0
- package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/auth/core/params.gen.d.ts +43 -0
- package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/auth/core/types.gen.d.ts +83 -0
- package/dist/generated/auth/core/utils.gen.d.ts +19 -0
- package/dist/generated/auth/index.d.ts +2 -0
- package/dist/generated/auth/index.js +6 -0
- package/dist/generated/auth/sdk.gen.d.ts +383 -0
- package/dist/generated/auth/types.gen.d.ts +2175 -0
- package/dist/generated/cognition/client/client.gen.d.ts +2 -0
- package/dist/generated/cognition/client/index.d.ts +10 -0
- package/dist/generated/cognition/client/types.gen.d.ts +120 -0
- package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
- package/dist/generated/cognition/client.gen.d.ts +12 -0
- package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
- package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/cognition/core/params.gen.d.ts +43 -0
- package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/cognition/core/types.gen.d.ts +83 -0
- package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
- package/dist/generated/cognition/index.d.ts +2 -0
- package/dist/generated/cognition/index.js +6 -0
- package/dist/generated/cognition/sdk.gen.d.ts +224 -0
- package/dist/generated/cognition/types.gen.d.ts +2484 -0
- package/dist/generated/connection/client/client.gen.d.ts +2 -0
- package/dist/generated/connection/client/index.d.ts +10 -0
- package/dist/generated/connection/client/types.gen.d.ts +120 -0
- package/dist/generated/connection/client/utils.gen.d.ts +37 -0
- package/dist/generated/connection/client.gen.d.ts +12 -0
- package/dist/generated/connection/core/auth.gen.d.ts +25 -0
- package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/connection/core/params.gen.d.ts +43 -0
- package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/connection/core/types.gen.d.ts +83 -0
- package/dist/generated/connection/core/utils.gen.d.ts +19 -0
- package/dist/generated/connection/index.d.ts +2 -0
- package/dist/generated/connection/index.js +839 -0
- package/dist/generated/connection/sdk.gen.d.ts +38 -0
- package/dist/generated/connection/types.gen.d.ts +235 -0
- package/dist/generated/contacts/client/client.gen.d.ts +2 -0
- package/dist/generated/contacts/client/index.d.ts +10 -0
- package/dist/generated/contacts/client/types.gen.d.ts +120 -0
- package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
- package/dist/generated/contacts/client.gen.d.ts +12 -0
- package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
- package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/contacts/core/params.gen.d.ts +43 -0
- package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/contacts/core/types.gen.d.ts +83 -0
- package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
- package/dist/generated/contacts/index.d.ts +2 -0
- package/dist/generated/contacts/index.js +6 -0
- package/dist/generated/contacts/sdk.gen.d.ts +43 -0
- package/dist/generated/contacts/types.gen.d.ts +52 -0
- package/dist/generated/email/client/client.gen.d.ts +2 -0
- package/dist/generated/email/client/index.d.ts +10 -0
- package/dist/generated/email/client/types.gen.d.ts +120 -0
- package/dist/generated/email/client/utils.gen.d.ts +37 -0
- package/dist/generated/email/client.gen.d.ts +12 -0
- package/dist/generated/email/core/auth.gen.d.ts +25 -0
- package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/email/core/params.gen.d.ts +43 -0
- package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/email/core/types.gen.d.ts +83 -0
- package/dist/generated/email/core/utils.gen.d.ts +19 -0
- package/dist/generated/email/index.d.ts +2 -0
- package/dist/generated/email/index.js +6 -0
- package/dist/generated/email/sdk.gen.d.ts +254 -0
- package/dist/generated/email/types.gen.d.ts +2614 -0
- package/dist/generated/notification/client/client.gen.d.ts +2 -0
- package/dist/generated/notification/client/index.d.ts +10 -0
- package/dist/generated/notification/client/types.gen.d.ts +120 -0
- package/dist/generated/notification/client/utils.gen.d.ts +37 -0
- package/dist/generated/notification/client.gen.d.ts +12 -0
- package/dist/generated/notification/core/auth.gen.d.ts +25 -0
- package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/notification/core/params.gen.d.ts +43 -0
- package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/notification/core/types.gen.d.ts +83 -0
- package/dist/generated/notification/core/utils.gen.d.ts +19 -0
- package/dist/generated/notification/index.d.ts +2 -0
- package/dist/generated/notification/index.js +6 -0
- package/dist/generated/notification/sdk.gen.d.ts +118 -0
- package/dist/generated/notification/types.gen.d.ts +1352 -0
- package/dist/generated/properties/client/client.gen.d.ts +2 -0
- package/dist/generated/properties/client/index.d.ts +10 -0
- package/dist/generated/properties/client/types.gen.d.ts +120 -0
- package/dist/generated/properties/client/utils.gen.d.ts +37 -0
- package/dist/generated/properties/client.gen.d.ts +12 -0
- package/dist/generated/properties/core/auth.gen.d.ts +25 -0
- package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/properties/core/params.gen.d.ts +43 -0
- package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/properties/core/types.gen.d.ts +83 -0
- package/dist/generated/properties/core/utils.gen.d.ts +19 -0
- package/dist/generated/properties/index.d.ts +2 -0
- package/dist/generated/properties/index.js +6 -0
- package/dist/generated/properties/sdk.gen.d.ts +158 -0
- package/dist/generated/properties/types.gen.d.ts +1288 -0
- package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
- package/dist/generated/scheduled-action/client/index.d.ts +10 -0
- package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
- package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
- package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
- package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
- package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
- package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
- package/dist/generated/scheduled-action/index.d.ts +2 -0
- package/dist/generated/scheduled-action/index.js +845 -0
- package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
- package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
- package/dist/generated/search/client/client.gen.d.ts +2 -0
- package/dist/generated/search/client/index.d.ts +10 -0
- package/dist/generated/search/client/types.gen.d.ts +120 -0
- package/dist/generated/search/client/utils.gen.d.ts +37 -0
- package/dist/generated/search/client.gen.d.ts +12 -0
- package/dist/generated/search/core/auth.gen.d.ts +25 -0
- package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/search/core/params.gen.d.ts +43 -0
- package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/search/core/types.gen.d.ts +83 -0
- package/dist/generated/search/core/utils.gen.d.ts +19 -0
- package/dist/generated/search/index.d.ts +2 -0
- package/dist/generated/search/index.js +6 -0
- package/dist/generated/search/sdk.gen.d.ts +44 -0
- package/dist/generated/search/types.gen.d.ts +2194 -0
- package/dist/generated/static-files/client/client.gen.d.ts +2 -0
- package/dist/generated/static-files/client/index.d.ts +10 -0
- package/dist/generated/static-files/client/types.gen.d.ts +120 -0
- package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
- package/dist/generated/static-files/client.gen.d.ts +12 -0
- package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
- package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/static-files/core/params.gen.d.ts +43 -0
- package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/static-files/core/types.gen.d.ts +83 -0
- package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
- package/dist/generated/static-files/index.d.ts +2 -0
- package/dist/generated/static-files/index.js +842 -0
- package/dist/generated/static-files/sdk.gen.d.ts +43 -0
- package/dist/generated/static-files/types.gen.d.ts +214 -0
- package/dist/generated/storage/client/client.gen.d.ts +2 -0
- package/dist/generated/storage/client/index.d.ts +10 -0
- package/dist/generated/storage/client/types.gen.d.ts +120 -0
- package/dist/generated/storage/client/utils.gen.d.ts +37 -0
- package/dist/generated/storage/client.gen.d.ts +12 -0
- package/dist/generated/storage/core/auth.gen.d.ts +25 -0
- package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/storage/core/params.gen.d.ts +43 -0
- package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/storage/core/types.gen.d.ts +83 -0
- package/dist/generated/storage/core/utils.gen.d.ts +19 -0
- package/dist/generated/storage/index.d.ts +2 -0
- package/dist/generated/storage/index.js +6 -0
- package/dist/generated/storage/sdk.gen.d.ts +858 -0
- package/dist/generated/storage/types.gen.d.ts +12105 -0
- package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
- package/dist/generated/unfurl/client/index.d.ts +10 -0
- package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
- package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
- package/dist/generated/unfurl/client.gen.d.ts +12 -0
- package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
- package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
- package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
- package/dist/generated/unfurl/index.d.ts +2 -0
- package/dist/generated/unfurl/index.js +835 -0
- package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
- package/dist/generated/unfurl/types.gen.d.ts +125 -0
- package/dist/src/config.d.ts +51 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
- package/dist/src/entities/bots/namespace.d.ts +25 -0
- package/dist/src/entities/calls/call-record.d.ts +55 -0
- package/dist/src/entities/calls/namespace.d.ts +9 -0
- package/dist/src/entities/channels/channel.d.ts +88 -0
- package/dist/src/entities/channels/message.d.ts +64 -0
- package/dist/src/entities/channels/namespace.d.ts +30 -0
- package/dist/src/entities/channels/post.d.ts +20 -0
- package/dist/src/entities/channels/thread.d.ts +30 -0
- package/dist/src/entities/chats/chat.d.ts +55 -0
- package/dist/src/entities/chats/namespace.d.ts +14 -0
- package/dist/src/entities/crm/comment.d.ts +43 -0
- package/dist/src/entities/crm/company.d.ts +70 -0
- package/dist/src/entities/crm/contact.d.ts +48 -0
- package/dist/src/entities/crm/namespace.d.ts +22 -0
- package/dist/src/entities/documents/comment.d.ts +41 -0
- package/dist/src/entities/documents/document.d.ts +130 -0
- package/dist/src/entities/documents/namespace.d.ts +43 -0
- package/dist/src/entities/documents/system-skill.d.ts +16 -0
- package/dist/src/entities/email/attachment.d.ts +36 -0
- package/dist/src/entities/email/label.d.ts +31 -0
- package/dist/src/entities/email/link.d.ts +29 -0
- package/dist/src/entities/email/message.d.ts +58 -0
- package/dist/src/entities/email/namespace.d.ts +49 -0
- package/dist/src/entities/email/thread.d.ts +88 -0
- package/dist/src/entities/entity.d.ts +101 -0
- package/dist/src/entities/favorites/namespace.d.ts +19 -0
- package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
- package/dist/src/entities/foreign/namespace.d.ts +7 -0
- package/dist/src/entities/notifications/namespace.d.ts +29 -0
- package/dist/src/entities/notifications/notification.d.ts +50 -0
- package/dist/src/entities/pins/namespace.d.ts +19 -0
- package/dist/src/entities/projects/namespace.d.ts +13 -0
- package/dist/src/entities/projects/project.d.ts +42 -0
- package/dist/src/entities/properties/namespace.d.ts +47 -0
- package/dist/src/entities/properties/property-definition.d.ts +45 -0
- package/dist/src/entities/properties/property-option.d.ts +32 -0
- package/dist/src/entities/search.d.ts +23 -0
- package/dist/src/entities/tasks/namespace.d.ts +21 -0
- package/dist/src/entities/tasks/task.d.ts +34 -0
- package/dist/src/entities/teams/namespace.d.ts +12 -0
- package/dist/src/entities/teams/team.d.ts +40 -0
- package/dist/src/entities/users/namespace.d.ts +10 -0
- package/dist/src/entities/users/user.d.ts +43 -0
- package/dist/src/entities/webhooks/namespace.d.ts +31 -0
- package/dist/src/entities/webhooks/webhook.d.ts +88 -0
- package/dist/src/events/hydrate/channel.d.ts +85 -0
- package/dist/src/events/hydrate/document.d.ts +54 -0
- package/dist/src/events/receiver.d.ts +51 -0
- package/dist/src/events/types.d.ts +40 -0
- package/dist/src/events/verify.d.ts +13 -0
- package/dist/src/local-portmap.d.ts +8 -0
- package/dist/src/macro.d.ts +62 -0
- package/dist/src/macro.js +4215 -0
- package/dist/src/mentions.d.ts +37 -0
- package/dist/src/raw.d.ts +12 -0
- package/dist/src/utils/client.d.ts +53 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/lazy.d.ts +18 -0
- package/dist/src/utils/pagination.d.ts +7 -0
- package/dist/src/utils/unwrap.d.ts +23 -0
- package/package.json +49 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ApiSortMethod } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { SearchOpts } from '../search';
|
|
4
|
+
import { EmailAttachment } from './attachment';
|
|
5
|
+
import { Label } from './label';
|
|
6
|
+
import { Link } from './link';
|
|
7
|
+
import { EmailMessage, type SendEmailOptions } from './message';
|
|
8
|
+
import { EmailThread } from './thread';
|
|
9
|
+
/** Options for listing inbox threads. */
|
|
10
|
+
export interface InboxOptions {
|
|
11
|
+
/** Page size (default 20, max 500). */
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
/** Sort order. Defaults to `viewed_updated`. */
|
|
14
|
+
sort?: ApiSortMethod;
|
|
15
|
+
}
|
|
16
|
+
export declare class EmailNamespace {
|
|
17
|
+
private readonly client;
|
|
18
|
+
constructor(client: MacroClient);
|
|
19
|
+
/** A handle to an email thread by id. */
|
|
20
|
+
byId(id: string): EmailThread;
|
|
21
|
+
/** A handle to an email message by id. */
|
|
22
|
+
message(id: string): EmailMessage;
|
|
23
|
+
/** A handle to an email attachment by id. */
|
|
24
|
+
attachment(id: string): EmailAttachment;
|
|
25
|
+
/** A handle to a connected inbox (email link) by id. */
|
|
26
|
+
link(id: string): Link;
|
|
27
|
+
/** The caller's connected inboxes (email links). */
|
|
28
|
+
links(): Promise<Link[]>;
|
|
29
|
+
/** Send a new email message. */
|
|
30
|
+
send(opts: SendEmailOptions): Promise<EmailMessage | undefined>;
|
|
31
|
+
/** Search email threads by subject and content. */
|
|
32
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<EmailThread>;
|
|
33
|
+
/** The threads in the inbox, most recent first, auto-paginated. */
|
|
34
|
+
inbox(opts?: InboxOptions): AsyncGenerator<EmailThread>;
|
|
35
|
+
/** A handle to a label by id. */
|
|
36
|
+
label(id: string): Label;
|
|
37
|
+
/** All labels across the user's inboxes. */
|
|
38
|
+
labels(): Promise<Label[]>;
|
|
39
|
+
/** Create a user label. Returns the created label. */
|
|
40
|
+
createLabel(name: string): Promise<Label>;
|
|
41
|
+
/** Delete a label. */
|
|
42
|
+
deleteLabel(label: Label): Promise<void>;
|
|
43
|
+
/** Block an email sender. */
|
|
44
|
+
blockSender(email: string): Promise<void>;
|
|
45
|
+
/** Unblock a previously blocked sender. */
|
|
46
|
+
unblockSender(email: string): Promise<void>;
|
|
47
|
+
/** The email addresses currently blocked. */
|
|
48
|
+
blockedSenders(): Promise<string[]>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ApiContactInfo, ApiDraftContactInfo, GetThreadResponses } from '../../../generated/email/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { PropertiedEntity } from '../entity';
|
|
4
|
+
import { Project } from '../projects/project';
|
|
5
|
+
import { EmailAttachment } from './attachment';
|
|
6
|
+
import type { Label } from './label';
|
|
7
|
+
import { Link } from './link';
|
|
8
|
+
import { EmailMessage } from './message';
|
|
9
|
+
type ThreadDetail = GetThreadResponses[200]['thread'];
|
|
10
|
+
/** Options for replying within an email thread. */
|
|
11
|
+
export interface ReplyEmailOptions {
|
|
12
|
+
/** Recipients. */
|
|
13
|
+
to: ApiDraftContactInfo[];
|
|
14
|
+
/** Cc recipients. */
|
|
15
|
+
cc?: ApiDraftContactInfo[];
|
|
16
|
+
/** Bcc recipients. */
|
|
17
|
+
bcc?: ApiDraftContactInfo[];
|
|
18
|
+
/** Plain-text body. */
|
|
19
|
+
bodyText: string;
|
|
20
|
+
/** Subject line. Defaults to the subject of the thread's first message. */
|
|
21
|
+
subject?: string;
|
|
22
|
+
/** The message being replied to. */
|
|
23
|
+
replyingTo?: EmailMessage;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An email thread. A free-to-construct handle: the detail record (including
|
|
27
|
+
* up to the first 100 messages) loads lazily on first field access.
|
|
28
|
+
*/
|
|
29
|
+
export declare class EmailThread extends PropertiedEntity<ThreadDetail> {
|
|
30
|
+
/** Favorites identify email threads as `email_thread`. */
|
|
31
|
+
readonly entityType = "email_thread";
|
|
32
|
+
/** The properties service identifies email threads as `THREAD`. */
|
|
33
|
+
protected readonly propertyEntityType = "THREAD";
|
|
34
|
+
protected fetch(): Promise<ThreadDetail>;
|
|
35
|
+
/** A handle to a thread by id. Details load on first access. */
|
|
36
|
+
static byId(client: MacroClient, id: string): EmailThread;
|
|
37
|
+
/** When the thread was created. */
|
|
38
|
+
readonly createdAt: () => Promise<string>;
|
|
39
|
+
/** When the thread was last updated. */
|
|
40
|
+
readonly updatedAt: () => Promise<string>;
|
|
41
|
+
/** Whether the thread has been read. */
|
|
42
|
+
readonly isRead: () => Promise<boolean>;
|
|
43
|
+
/** Whether the thread is visible in the inbox (i.e. not archived). */
|
|
44
|
+
readonly inboxVisible: () => Promise<boolean>;
|
|
45
|
+
/** The viewer's access level to this thread. */
|
|
46
|
+
readonly accessLevel: () => Promise<import("../../../generated/email").AccessLevel>;
|
|
47
|
+
/** The provider-internal thread id (e.g. Gmail/Outlook), if any. */
|
|
48
|
+
readonly providerId: () => Promise<string | undefined>;
|
|
49
|
+
/** The inbox (email link) that owns this thread. */
|
|
50
|
+
readonly link: () => Promise<Link>;
|
|
51
|
+
/** The project this thread is attached to, if any. */
|
|
52
|
+
readonly project: () => Promise<Project | undefined>;
|
|
53
|
+
/** Timestamp of the latest inbound message, if any. */
|
|
54
|
+
readonly latestInboundAt: () => Promise<string | undefined>;
|
|
55
|
+
/** Timestamp of the latest outbound message, if any. */
|
|
56
|
+
readonly latestOutboundAt: () => Promise<string | undefined>;
|
|
57
|
+
/** Timestamp of the latest non-spam message, if any. */
|
|
58
|
+
readonly latestNonSpamAt: () => Promise<string | undefined>;
|
|
59
|
+
/** The thread's subject, from its first message with one. */
|
|
60
|
+
subject(): Promise<string | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Everyone on the thread (senders and recipients), deduped by email.
|
|
63
|
+
* Derived from the thread's first 100 messages.
|
|
64
|
+
*/
|
|
65
|
+
participants(): Promise<ApiContactInfo[]>;
|
|
66
|
+
/** The messages in this thread, pre-seeded from the list endpoint. */
|
|
67
|
+
messages(opts?: {
|
|
68
|
+
since?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}): Promise<EmailMessage[]>;
|
|
71
|
+
/** The attachments across this thread's first 100 messages, pre-seeded from the thread detail. */
|
|
72
|
+
attachments(): Promise<EmailAttachment[]>;
|
|
73
|
+
/** Send a reply within this thread. Returns a handle when the API reports the created message's id. */
|
|
74
|
+
reply(opts: ReplyEmailOptions): Promise<EmailMessage | undefined>;
|
|
75
|
+
/** Archive the thread (or unarchive with `false`). */
|
|
76
|
+
archive(archived?: boolean): Promise<void>;
|
|
77
|
+
/** Mark the thread as seen. */
|
|
78
|
+
markSeen(): Promise<void>;
|
|
79
|
+
/** Add a label to every message in the thread. */
|
|
80
|
+
addLabel(label: Label): Promise<void>;
|
|
81
|
+
/** Remove a label from every message in the thread. */
|
|
82
|
+
removeLabel(label: Label): Promise<void>;
|
|
83
|
+
/** Attach the thread to a project, or clear the project with `null`. */
|
|
84
|
+
moveToProject(project: Project | null): Promise<void>;
|
|
85
|
+
/** Search email threads by subject and content, most relevant first, auto-paginated. */
|
|
86
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<EmailThread, any, any>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { BulkUpdateEntityPropertyOptionsResponse, EntityPropertyWithDefinition, PropertyTargetEntityType as PropertyEntityType, PropertyTargetReference, SetPropertyValue } from '../../generated/properties/types.gen';
|
|
2
|
+
import type { FavoriteEntityRef } from '../../generated/storage/types.gen';
|
|
3
|
+
import { Lazy } from '../utils';
|
|
4
|
+
import type { MacroClient } from '../utils/client';
|
|
5
|
+
import type { PropertyDefinition } from './properties/property-definition';
|
|
6
|
+
import type { PropertyOption } from './properties/property-option';
|
|
7
|
+
/** How the entity-addressed APIs (favorites) identify an entity's type. */
|
|
8
|
+
export type MacroEntityType = FavoriteEntityRef['entityType'];
|
|
9
|
+
/** An entity that can be added to and removed from the user's favorites. */
|
|
10
|
+
export interface Favoritable {
|
|
11
|
+
favorite(): Promise<this>;
|
|
12
|
+
unfavorite(): Promise<this>;
|
|
13
|
+
}
|
|
14
|
+
/** A favoritable entity that also carries user-defined properties. */
|
|
15
|
+
export interface Propertied extends Favoritable {
|
|
16
|
+
properties(opts?: {
|
|
17
|
+
includeMetadata?: boolean;
|
|
18
|
+
}): Promise<EntityPropertyWithDefinition[]>;
|
|
19
|
+
setProperty(property: PropertyDefinition, value?: SetPropertyValue): Promise<void>;
|
|
20
|
+
deleteProperty(assignment: EntityPropertyWithDefinition): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/** A delta to apply to one multi-select property. */
|
|
23
|
+
export interface PropertyOptionDelta {
|
|
24
|
+
/** The multi-select property definition to update. */
|
|
25
|
+
property: PropertyDefinition;
|
|
26
|
+
/** Options to add to the property's current selection. */
|
|
27
|
+
add?: PropertyOption[];
|
|
28
|
+
/** Options to remove from the property's current selection. */
|
|
29
|
+
remove?: PropertyOption[];
|
|
30
|
+
}
|
|
31
|
+
/** `null` folded into `undefined`, so optional API fields read naturally. */
|
|
32
|
+
type Normalized<V> = null extends V ? NonNullable<V> | undefined : undefined extends V ? NonNullable<V> | undefined : V;
|
|
33
|
+
/**
|
|
34
|
+
* Base for entity handles: a free-to-construct `(client, id)` pair whose
|
|
35
|
+
* detail record loads lazily on first field access and is dropped after any
|
|
36
|
+
* mutation. Subclasses implement {@link fetch} and build their surface from
|
|
37
|
+
* {@link field} and {@link mutate}.
|
|
38
|
+
*/
|
|
39
|
+
export declare abstract class MacroEntity<Detail> {
|
|
40
|
+
protected readonly client: MacroClient;
|
|
41
|
+
readonly id: string;
|
|
42
|
+
protected readonly detail: Lazy<Detail>;
|
|
43
|
+
protected constructor(client: MacroClient, id: string, seed?: Detail);
|
|
44
|
+
/** Load the detail record backing {@link field} accessors. */
|
|
45
|
+
protected abstract fetch(): Promise<Detail>;
|
|
46
|
+
/** A lazy accessor for one detail field, `null` normalized to `undefined`. */
|
|
47
|
+
protected field<K extends keyof Detail>(key: K): () => Promise<Normalized<Detail[K]>>;
|
|
48
|
+
/**
|
|
49
|
+
* Like {@link field}, but maps the raw value through `map` before returning.
|
|
50
|
+
* Used to expose an id field as a handle to the entity it references, e.g.
|
|
51
|
+
* `this.mappedField('owner', (id) => User.byId(this.client, id))`.
|
|
52
|
+
*/
|
|
53
|
+
protected mappedField<K extends keyof Detail, T>(key: K, map: (value: Normalized<Detail[K]>) => T): () => Promise<T>;
|
|
54
|
+
toJSON(): {
|
|
55
|
+
id: string;
|
|
56
|
+
detail?: Detail;
|
|
57
|
+
};
|
|
58
|
+
/** Run a write, unwrap it, and drop the cached detail so reads refetch. */
|
|
59
|
+
protected mutate<TData>(fn: (client: MacroClient) => Promise<{
|
|
60
|
+
data?: TData;
|
|
61
|
+
error?: unknown;
|
|
62
|
+
response?: Response;
|
|
63
|
+
}>): Promise<TData>;
|
|
64
|
+
}
|
|
65
|
+
/** An entity the favorites API can address, and so can be (un)favorited. */
|
|
66
|
+
export declare abstract class FavoritableEntity<Detail> extends MacroEntity<Detail> implements Favoritable {
|
|
67
|
+
/** How the entity-addressed APIs (favorites) identify this entity's type. */
|
|
68
|
+
abstract readonly entityType: MacroEntityType;
|
|
69
|
+
/**
|
|
70
|
+
* Add this entity to the user's favorites. Returns this handle for chaining.
|
|
71
|
+
* Plain unwrap: favoriting alters the user's favorites collection, not this
|
|
72
|
+
* entity's own detail, so there's nothing cached to invalidate.
|
|
73
|
+
*/
|
|
74
|
+
favorite(): Promise<this>;
|
|
75
|
+
/** Remove this entity from the user's favorites. Returns this handle for chaining. */
|
|
76
|
+
unfavorite(): Promise<this>;
|
|
77
|
+
}
|
|
78
|
+
/** A favoritable entity that also carries user-defined properties. */
|
|
79
|
+
export declare abstract class PropertiedEntity<Detail> extends FavoritableEntity<Detail> implements Propertied {
|
|
80
|
+
/**
|
|
81
|
+
* This entity's type in the properties service, which names types
|
|
82
|
+
* differently from {@link entityType} (e.g. `THREAD` for `email_thread`).
|
|
83
|
+
*/
|
|
84
|
+
protected abstract readonly propertyEntityType: PropertyEntityType;
|
|
85
|
+
/** This entity's reference for bulk property operations. */
|
|
86
|
+
propertyReference(): PropertyTargetReference;
|
|
87
|
+
/** The properties set on this entity, each with its definition, value, and options. */
|
|
88
|
+
properties(opts?: {
|
|
89
|
+
includeMetadata?: boolean;
|
|
90
|
+
}): Promise<EntityPropertyWithDefinition[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Set a property value on this entity, or attach the property without a
|
|
93
|
+
* value when `value` is omitted.
|
|
94
|
+
*/
|
|
95
|
+
setProperty(property: PropertyDefinition, value?: SetPropertyValue): Promise<void>;
|
|
96
|
+
/** Apply multi-select option deltas atomically across this entity's properties. */
|
|
97
|
+
updatePropertyOptions(changes: PropertyOptionDelta[]): Promise<BulkUpdateEntityPropertyOptionsResponse>;
|
|
98
|
+
/** Remove a property from this entity, given its {@link properties} entry. */
|
|
99
|
+
deleteProperty(assignment: EntityPropertyWithDefinition): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Favorite, FavoriteEntityRef } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { FavoritableEntity } from '../entity';
|
|
4
|
+
export type { Favorite, FavoriteEntityRef };
|
|
5
|
+
/** The user's favorites: a manually ordered collection of entity references. */
|
|
6
|
+
export declare class FavoritesNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
/** The user's favorites, in manual order. */
|
|
10
|
+
list(): Promise<Favorite[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Favorite an entity. Returns the favorite record.
|
|
13
|
+
*/
|
|
14
|
+
add(entity: FavoritableEntity<unknown>): Promise<Favorite>;
|
|
15
|
+
/** Remove an entity from the user's favorites. */
|
|
16
|
+
remove(entity: FavoritableEntity<unknown>): Promise<void>;
|
|
17
|
+
/** Reorder the favorites: pass every favorited entity in the desired order. */
|
|
18
|
+
reorder(favorites: FavoriteEntityRef[]): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GetForeignEntityResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { FavoritableEntity } from '../entity';
|
|
4
|
+
type ForeignEntityDetail = GetForeignEntityResponses[200];
|
|
5
|
+
/**
|
|
6
|
+
* A read-only mapping to an entity owned by an external system (e.g. a
|
|
7
|
+
* GitHub pull request). Keyed by the internal foreign-entity record id.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ForeignEntity extends FavoritableEntity<ForeignEntityDetail> {
|
|
10
|
+
/** Favorites identify foreign entities as `foreign_entity`. */
|
|
11
|
+
readonly entityType = "foreign_entity";
|
|
12
|
+
protected fetch(): Promise<ForeignEntityDetail>;
|
|
13
|
+
/** A handle to a foreign entity by its internal record id. Details load on first access. */
|
|
14
|
+
static byId(client: MacroClient, id: string): ForeignEntity;
|
|
15
|
+
/** The identifier assigned by the external system. */
|
|
16
|
+
readonly foreignEntityId: () => Promise<string>;
|
|
17
|
+
/** The source system that owns the external identifier (e.g. `github_pull_request`). */
|
|
18
|
+
readonly source: () => Promise<string>;
|
|
19
|
+
/** The internal entity id this foreign entity is stored for. */
|
|
20
|
+
readonly storedForId: () => Promise<string>;
|
|
21
|
+
/** The internal auth entity namespace this foreign entity is stored for. */
|
|
22
|
+
readonly storedForAuthEntity: () => Promise<string>;
|
|
23
|
+
/** When the record was created (ISO timestamp). */
|
|
24
|
+
readonly createdAt: () => Promise<string>;
|
|
25
|
+
/** When the record was last updated (ISO timestamp). */
|
|
26
|
+
readonly updatedAt: () => Promise<string>;
|
|
27
|
+
/** Arbitrary source-specific metadata stored with the mapping. */
|
|
28
|
+
metadata(): Promise<unknown>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GetNotificationTypePreferencesResponses, NotifEvent } from '../../../generated/notification/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Notification } from './notification';
|
|
4
|
+
/** A notification event type name, e.g. `channel_mention`. */
|
|
5
|
+
export type NotificationType = NotifEvent['tag'];
|
|
6
|
+
type NotificationTypePreferences = GetNotificationTypePreferencesResponses[200];
|
|
7
|
+
export declare class NotificationNamespace {
|
|
8
|
+
private readonly client;
|
|
9
|
+
constructor(client: MacroClient);
|
|
10
|
+
/** A handle to a notification by id. */
|
|
11
|
+
byId(id: string): Notification;
|
|
12
|
+
/** The viewer's notification feed, most recent first, auto-paginated. */
|
|
13
|
+
list(opts?: {
|
|
14
|
+
pageSize?: number;
|
|
15
|
+
}): AsyncGenerator<Notification>;
|
|
16
|
+
/** Mark a batch of notifications as seen. */
|
|
17
|
+
markSeen(ids: string[]): Promise<void>;
|
|
18
|
+
/** Mark a batch of notifications as done. */
|
|
19
|
+
markDone(ids: string[]): Promise<void>;
|
|
20
|
+
/** Delete a batch of notifications. */
|
|
21
|
+
delete(ids: string[]): Promise<void>;
|
|
22
|
+
/** The viewer's notification type preferences (disabled types). */
|
|
23
|
+
preferences(): Promise<NotificationTypePreferences>;
|
|
24
|
+
/** Re-enable delivery of a notification type. */
|
|
25
|
+
enableType(type: NotificationType): Promise<void>;
|
|
26
|
+
/** Disable delivery of a notification type. */
|
|
27
|
+
disableType(type: NotificationType): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GetTypedNotificationByIdResponses } from '../../../generated/notification/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { User } from '../users/user';
|
|
5
|
+
type NotificationDetail = GetTypedNotificationByIdResponses[200];
|
|
6
|
+
/**
|
|
7
|
+
* A notification in the viewer's feed.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Notification extends MacroEntity<NotificationDetail> {
|
|
10
|
+
protected fetch(): Promise<NotificationDetail>;
|
|
11
|
+
/** A handle to a notification by id. Details load on first access. */
|
|
12
|
+
static byId(client: MacroClient, id: string): Notification;
|
|
13
|
+
/** Build a notification from a list-endpoint record (pre-seeded, no fetch). */
|
|
14
|
+
static from(client: MacroClient, data: NotificationDetail): Notification;
|
|
15
|
+
/** The viewer's notification feed, most recent first, auto-paginated. */
|
|
16
|
+
static list(client: MacroClient, opts?: {
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
}): AsyncGenerator<Notification>;
|
|
19
|
+
/** The notification event type (e.g. `channel_mention`). */
|
|
20
|
+
readonly type: () => Promise<string>;
|
|
21
|
+
/** When the notification was created. */
|
|
22
|
+
readonly createdAt: () => Promise<string>;
|
|
23
|
+
/** When the notification was last updated. */
|
|
24
|
+
readonly updatedAt: () => Promise<string>;
|
|
25
|
+
/** Whether the notification is marked as done. */
|
|
26
|
+
readonly done: () => Promise<boolean>;
|
|
27
|
+
/** Whether the notification has been sent (delivered out of band). */
|
|
28
|
+
readonly sent: () => Promise<boolean>;
|
|
29
|
+
/** When the notification was viewed, if it has been seen. */
|
|
30
|
+
readonly viewedAt: () => Promise<string | undefined>;
|
|
31
|
+
/** When the notification was deleted, if it has been. */
|
|
32
|
+
readonly deletedAt: () => Promise<string | undefined>;
|
|
33
|
+
/** The user who owns (receives) this notification. */
|
|
34
|
+
readonly owner: () => Promise<User>;
|
|
35
|
+
/** The user who triggered the notification, if any. */
|
|
36
|
+
readonly sender: () => Promise<User | undefined>;
|
|
37
|
+
/** The typed notification payload (tagged by event type). */
|
|
38
|
+
readonly metadata: () => Promise<import("../../../generated/notification").NotifEvent>;
|
|
39
|
+
/** Whether the notification has been seen (viewed at least once). */
|
|
40
|
+
seen(): Promise<boolean>;
|
|
41
|
+
/** Mark the notification as seen. */
|
|
42
|
+
markSeen(): Promise<void>;
|
|
43
|
+
/** Mark the notification as done. */
|
|
44
|
+
markDone(): Promise<void>;
|
|
45
|
+
/** Move the notification back to not-done. */
|
|
46
|
+
markUndone(): Promise<void>;
|
|
47
|
+
/** Delete the notification. */
|
|
48
|
+
delete(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PinnedItem, ReorderPinRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { FavoritableEntity } from '../entity';
|
|
4
|
+
export type { PinnedItem, ReorderPinRequest };
|
|
5
|
+
/** The user's pins: items pinned to fixed slots in the home view. */
|
|
6
|
+
export declare class PinsNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
/** The user's pinned items, with their pin indices. */
|
|
10
|
+
list(): Promise<PinnedItem[]>;
|
|
11
|
+
/** Pin an entity to a slot. `index` is the slot to put it in. */
|
|
12
|
+
add(entity: FavoritableEntity<unknown>, opts: {
|
|
13
|
+
index: number;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
/** Unpin an entity. */
|
|
16
|
+
remove(entity: FavoritableEntity<unknown>): Promise<void>;
|
|
17
|
+
/** Reorder pins: pass each pinned item with its type and new index. */
|
|
18
|
+
reorder(pins: ReorderPinRequest[]): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { SearchOpts } from '../search';
|
|
3
|
+
import { Project } from './project';
|
|
4
|
+
export declare class ProjectNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
byId(id: string): Project;
|
|
8
|
+
create(opts: {
|
|
9
|
+
name: string;
|
|
10
|
+
parent?: Project;
|
|
11
|
+
}): Promise<Project>;
|
|
12
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<Project>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { GetProjectContentHandlerResponses, GetProjectHandlerResponses } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { PropertiedEntity } from '../entity';
|
|
4
|
+
type ProjectDetail = GetProjectHandlerResponses[200]['data']['projectMetadata'];
|
|
5
|
+
type ProjectItem = GetProjectContentHandlerResponses[200]['data'][number]['item'];
|
|
6
|
+
/** A Macro project: a folder-like container for documents, chats, and subprojects. */
|
|
7
|
+
export declare class Project extends PropertiedEntity<ProjectDetail> {
|
|
8
|
+
/** Favorites identify projects as `project`. */
|
|
9
|
+
readonly entityType = "project";
|
|
10
|
+
/** The properties service identifies projects as `PROJECT`. */
|
|
11
|
+
protected readonly propertyEntityType = "PROJECT";
|
|
12
|
+
protected fetch(): Promise<ProjectDetail>;
|
|
13
|
+
/** A handle to a project by id. Details load on first access. */
|
|
14
|
+
static byId(client: MacroClient, id: string): Project;
|
|
15
|
+
/** Create a project, optionally nested inside a parent project. */
|
|
16
|
+
static create(client: MacroClient, opts: {
|
|
17
|
+
name: string;
|
|
18
|
+
parent?: Project;
|
|
19
|
+
}): Promise<Project>;
|
|
20
|
+
/** The project's display name. */
|
|
21
|
+
readonly name: () => Promise<string>;
|
|
22
|
+
/** The parent project, if this project is nested. */
|
|
23
|
+
readonly parent: () => Promise<Project | undefined>;
|
|
24
|
+
/** When the project was created (RFC 3339 timestamp). */
|
|
25
|
+
readonly createdAt: () => Promise<string | undefined>;
|
|
26
|
+
/** The items (documents, chats, subprojects) directly inside this project. */
|
|
27
|
+
items(): Promise<ProjectItem[]>;
|
|
28
|
+
/** Rename the project. */
|
|
29
|
+
rename(name: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete the project and its contents. Soft by default (reversible with
|
|
32
|
+
* {@link restore}); pass `permanent: true` to delete irreversibly.
|
|
33
|
+
*/
|
|
34
|
+
delete(opts?: {
|
|
35
|
+
permanent?: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
/** Restore a soft-deleted project. */
|
|
38
|
+
restore(): Promise<void>;
|
|
39
|
+
/** Search projects by name and content, most relevant first, auto-paginated. */
|
|
40
|
+
static search: (client: MacroClient, query: string, searchOpts?: import("../search").SearchOpts) => AsyncGenerator<Project, any, any>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { BulkEntityOptionUpdateResult, BulkEntityPropertiesRequest, CreatePropertyScope, EntityPropertiesResponse, PropertyDataType, PropertyDefinition as PropertyDefinitionRecord, PropertyTargetEntityType as PropertyEntityType, PropertyScope, TagSetResponse } from '../../../generated/properties/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { PropertiedEntity, PropertyOptionDelta } from '../entity';
|
|
4
|
+
import { PropertyDefinition } from './property-definition';
|
|
5
|
+
import { PropertyOption } from './property-option';
|
|
6
|
+
export type { BulkEntityPropertiesRequest, CreatePropertyScope, EntityPropertiesResponse, PropertyDataType, PropertyDefinitionRecord, PropertyEntityType, PropertyScope, TagSetResponse, };
|
|
7
|
+
export { PropertyDefinition, PropertyOption };
|
|
8
|
+
/**
|
|
9
|
+
* Property definitions and tag sets. Entity-level reads and writes live on
|
|
10
|
+
* the entity handles ({@link PropertiedEntity.properties}, `setProperty`,
|
|
11
|
+
* `deleteProperty`).
|
|
12
|
+
*/
|
|
13
|
+
export declare class PropertiesNamespace {
|
|
14
|
+
private readonly client;
|
|
15
|
+
constructor(client: MacroClient);
|
|
16
|
+
/** List property definitions visible to the user, pre-hydrated with their records. */
|
|
17
|
+
list(opts?: {
|
|
18
|
+
scope?: PropertyScope;
|
|
19
|
+
forEntityType?: PropertyEntityType;
|
|
20
|
+
}): Promise<PropertyDefinition[]>;
|
|
21
|
+
/** Create a new custom property definition. */
|
|
22
|
+
create(opts: {
|
|
23
|
+
displayName: string;
|
|
24
|
+
scope: CreatePropertyScope;
|
|
25
|
+
dataType: PropertyDataType;
|
|
26
|
+
}): Promise<PropertyDefinition>;
|
|
27
|
+
/** A handle to an existing property definition by id. */
|
|
28
|
+
definition(id: string): PropertyDefinition;
|
|
29
|
+
/** Get properties for multiple entities in a single request. */
|
|
30
|
+
bulkEntityProperties(request: BulkEntityPropertiesRequest): Promise<Record<string, EntityPropertiesResponse>>;
|
|
31
|
+
/** Apply one multi-select option delta to several entity handles. */
|
|
32
|
+
updateEntityPropertyOptions(entities: PropertiedEntity<unknown>[], change: PropertyOptionDelta): Promise<BulkEntityOptionUpdateResult[]>;
|
|
33
|
+
/** Add a select option to a multi-select property value on an entity. */
|
|
34
|
+
addEntityPropertyOption(opts: {
|
|
35
|
+
entity: PropertiedEntity<unknown>;
|
|
36
|
+
property: PropertyDefinition;
|
|
37
|
+
option: PropertyOption;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
/** Remove a select option from a multi-select property value on an entity. */
|
|
40
|
+
removeEntityPropertyOption(opts: {
|
|
41
|
+
entity: PropertiedEntity<unknown>;
|
|
42
|
+
property: PropertyDefinition;
|
|
43
|
+
option: PropertyOption;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
/** The user's tag sets: their personal set, plus their team's when on a team. */
|
|
46
|
+
tags(): Promise<TagSetResponse[]>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AddPropertyOptionRequest, DataType, PropertyDefinition as PropertyDefinitionRecord, PropertyOwner } from '../../../generated/properties/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { CreatePropertyScope, PropertyDataType } from './namespace';
|
|
4
|
+
import { PropertyOption, type UpdatePropertyOptionRequest } from './property-option';
|
|
5
|
+
export type { AddPropertyOptionRequest, UpdatePropertyOptionRequest };
|
|
6
|
+
export { PropertyOption };
|
|
7
|
+
/**
|
|
8
|
+
* A property definition: schema for a custom field that can be attached to
|
|
9
|
+
* entities. Obtain instances via {@link PropertiesNamespace.create},
|
|
10
|
+
* {@link PropertiesNamespace.list}, or {@link PropertiesNamespace.definition}.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PropertyDefinition {
|
|
13
|
+
private readonly client;
|
|
14
|
+
readonly id: string;
|
|
15
|
+
private readonly detail;
|
|
16
|
+
private constructor();
|
|
17
|
+
private fetch;
|
|
18
|
+
/** Create a new property definition. */
|
|
19
|
+
static create(client: MacroClient, opts: {
|
|
20
|
+
displayName: string;
|
|
21
|
+
scope: CreatePropertyScope;
|
|
22
|
+
dataType: PropertyDataType;
|
|
23
|
+
}): Promise<PropertyDefinition>;
|
|
24
|
+
/** A handle to an existing definition by id. Fields load lazily on first access. */
|
|
25
|
+
static byId(client: MacroClient, id: string): PropertyDefinition;
|
|
26
|
+
/** Wrap a record already in hand (e.g. from a list response). */
|
|
27
|
+
static fromRecord(client: MacroClient, record: PropertyDefinitionRecord): PropertyDefinition;
|
|
28
|
+
get displayName(): Promise<string>;
|
|
29
|
+
get dataType(): Promise<DataType>;
|
|
30
|
+
get owner(): Promise<PropertyOwner>;
|
|
31
|
+
get isSystem(): Promise<boolean>;
|
|
32
|
+
get isMultiSelect(): Promise<boolean>;
|
|
33
|
+
get createdAt(): Promise<string>;
|
|
34
|
+
get updatedAt(): Promise<string>;
|
|
35
|
+
/** Delete this property definition. */
|
|
36
|
+
delete(): Promise<void>;
|
|
37
|
+
/** The selectable options for this definition (select-type properties). */
|
|
38
|
+
options(): Promise<PropertyOption[]>;
|
|
39
|
+
/** Add an option to this select-type property. */
|
|
40
|
+
addOption(option: AddPropertyOptionRequest): Promise<PropertyOption>;
|
|
41
|
+
/** Update an option (label, color, display order). */
|
|
42
|
+
updateOption(option: PropertyOption, updates: UpdatePropertyOptionRequest): Promise<PropertyOption>;
|
|
43
|
+
/** Delete an option from this property. */
|
|
44
|
+
deleteOption(option: PropertyOption): Promise<void>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PropertyOption as PropertyOptionRecord, UpdatePropertyOptionRequest } from '../../../generated/properties/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
export type { UpdatePropertyOptionRequest };
|
|
4
|
+
/**
|
|
5
|
+
* A selectable option on a select-type property definition. There is no
|
|
6
|
+
* single-option GET, so instances are only built from a seed record — via
|
|
7
|
+
* {@link PropertyDefinition.options} or {@link PropertyDefinition.addOption}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PropertyOption {
|
|
10
|
+
private readonly client;
|
|
11
|
+
/** The property definition this option belongs to. */
|
|
12
|
+
readonly definitionId: string;
|
|
13
|
+
readonly id: string;
|
|
14
|
+
private record;
|
|
15
|
+
private constructor();
|
|
16
|
+
/** Wrap a record already in hand (e.g. from a list or create response). */
|
|
17
|
+
static from(client: MacroClient, definitionId: string, record: PropertyOptionRecord): PropertyOption;
|
|
18
|
+
/** The option's value (string or number, per the property's data type). */
|
|
19
|
+
get value(): PropertyOptionRecord['value'];
|
|
20
|
+
/** The option's display color, if set. */
|
|
21
|
+
get color(): string | undefined;
|
|
22
|
+
/** The option's position among its definition's options. */
|
|
23
|
+
get displayOrder(): number;
|
|
24
|
+
/** When the option was created. */
|
|
25
|
+
get createdAt(): string;
|
|
26
|
+
/** When the option was last updated. */
|
|
27
|
+
get updatedAt(): string;
|
|
28
|
+
/** Update this option's label, color, or display order. */
|
|
29
|
+
update(updates: UpdatePropertyOptionRequest): Promise<this>;
|
|
30
|
+
/** Delete this option from its property definition. */
|
|
31
|
+
delete(): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EntityFilters, UnifiedSearchResponseItem } from '../../generated/search/types.gen';
|
|
2
|
+
import type { MacroClient } from '../utils/client';
|
|
3
|
+
type Hit = UnifiedSearchResponseItem;
|
|
4
|
+
export type SearchOn = 'name' | 'content' | 'name_content';
|
|
5
|
+
export interface SearchOpts {
|
|
6
|
+
searchOn?: SearchOn;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build a `search(client, query, opts?)` function for one entity type: unified
|
|
11
|
+
* search hits narrowed to `type`, each mapped through `make`.
|
|
12
|
+
* Most relevant first, auto-paginated.
|
|
13
|
+
*/
|
|
14
|
+
export declare function entitySearch<T, K extends Hit['type']>(opts: {
|
|
15
|
+
filters?: EntityFilters;
|
|
16
|
+
type: K;
|
|
17
|
+
make: (client: MacroClient, hit: Extract<Hit, {
|
|
18
|
+
type: K;
|
|
19
|
+
}>) => T;
|
|
20
|
+
/** Opt in to CRM results (off by default server-side; required for company hits). */
|
|
21
|
+
includeCrm?: boolean;
|
|
22
|
+
}): (client: MacroClient, query: string, searchOpts?: SearchOpts) => AsyncGenerator<T>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { Project } from '../projects/project';
|
|
3
|
+
import type { SearchOpts } from '../search';
|
|
4
|
+
import type { Team } from '../teams/team';
|
|
5
|
+
import { Task } from './task';
|
|
6
|
+
export declare class TaskNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
/** A handle to a task by document id. Details load on first access. */
|
|
10
|
+
byId(id: string): Task;
|
|
11
|
+
/** Create a task. */
|
|
12
|
+
create(opts: {
|
|
13
|
+
name: string;
|
|
14
|
+
markdown?: string;
|
|
15
|
+
project?: Project;
|
|
16
|
+
team?: Team;
|
|
17
|
+
shareWithTeam?: boolean;
|
|
18
|
+
}): Promise<Task>;
|
|
19
|
+
/** Search tasks by name and content, most relevant first, auto-paginated. */
|
|
20
|
+
search(query: string, opts?: SearchOpts): AsyncGenerator<Task>;
|
|
21
|
+
}
|