@macro-inc/sdk 0.2.2 → 0.4.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/README.md +177 -3
- package/dist/{chunk-OGE7WXJE.js → chunk-AZJUIUIV.js} +177 -23
- package/dist/{chunk-PRUFPW3B.js → chunk-G43PLP2U.js} +144 -0
- package/dist/{chunk-7LVVPVNT.js → chunk-K4G5VO4P.js} +76 -1
- package/dist/{chunk-PAAFJYGO.js → chunk-PPR7IWZ7.js} +77 -51
- package/dist/{chunk-QVBNNMQS.js → chunk-PTX2RV2N.js} +169 -20
- package/dist/{chunk-SUINKDXF.js → chunk-PZPTJI6F.js} +42 -0
- package/dist/{chunk-7YJ6Y7HJ.js → chunk-XFA7NCJ5.js} +207 -0
- package/dist/{chunk-ZQXOHNDB.js → chunk-ZLBDES7U.js} +789 -12
- package/dist/generated/agent-fold/index.d.ts +4332 -0
- package/dist/generated/agent-fold/index.js +0 -0
- package/dist/generated/agent-harness/index.d.ts +1 -1
- package/dist/generated/agent-harness/index.js +1 -1
- package/dist/generated/agent-harness/sdk.gen.d.ts +83 -9
- package/dist/generated/agent-harness/types.gen.d.ts +1504 -160
- package/dist/generated/agent-reviews/index.d.ts +893 -0
- package/dist/generated/agent-reviews/index.js +0 -0
- package/dist/generated/auth/index.d.ts +1 -1
- package/dist/generated/auth/index.js +1 -1
- package/dist/generated/auth/sdk.gen.d.ts +108 -2
- package/dist/generated/auth/types.gen.d.ts +799 -6
- package/dist/generated/calendar/index.d.ts +1 -1
- package/dist/generated/calendar/index.js +1 -1
- package/dist/generated/calendar/sdk.gen.d.ts +63 -1
- package/dist/generated/calendar/types.gen.d.ts +1234 -5
- package/dist/generated/cognition/index.d.ts +1 -1
- package/dist/generated/cognition/index.js +1 -1
- package/dist/generated/cognition/sdk.gen.d.ts +85 -20
- package/dist/generated/cognition/types.gen.d.ts +1040 -121
- package/dist/generated/connection/index.d.ts +1 -1
- package/dist/generated/connection/index.js +15 -0
- package/dist/generated/connection/sdk.gen.d.ts +6 -1
- package/dist/generated/connection/types.gen.d.ts +18 -1
- package/dist/generated/email/index.d.ts +1 -1
- package/dist/generated/email/index.js +1 -1
- package/dist/generated/email/sdk.gen.d.ts +44 -2
- package/dist/generated/email/types.gen.d.ts +475 -10
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/index.js +1 -1
- package/dist/generated/notification/sdk.gen.d.ts +29 -21
- package/dist/generated/notification/types.gen.d.ts +267 -73
- package/dist/generated/properties/index.d.ts +1 -1
- package/dist/generated/properties/types.gen.d.ts +21 -1
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +1 -1
- package/dist/generated/scheduled-action/sdk.gen.d.ts +8 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +669 -19
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +87 -7
- package/dist/generated/static-files/types.gen.d.ts +6 -0
- package/dist/generated/storage/index.d.ts +1 -1
- package/dist/generated/storage/index.js +1 -1
- package/dist/generated/storage/sdk.gen.d.ts +376 -13
- package/dist/generated/storage/types.gen.d.ts +12038 -5562
- package/dist/src/entities/account-managers/grant.d.ts +39 -0
- package/dist/src/entities/account-managers/namespace.d.ts +17 -0
- package/dist/src/entities/agent-sessions/activity.d.ts +39 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +148 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +5 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +54 -4
- package/dist/src/entities/agent-sessions/origin.d.ts +94 -0
- package/dist/src/entities/agent-sessions/review.d.ts +18 -62
- package/dist/src/entities/agent-sessions/view.d.ts +11 -0
- package/dist/src/entities/agents/namespace.d.ts +11 -2
- package/dist/src/entities/ai/namespace.d.ts +5 -1
- package/dist/src/entities/api-keys/namespace.d.ts +5 -1
- package/dist/src/entities/bots/bot.d.ts +108 -0
- package/dist/src/entities/bots/namespace.d.ts +17 -4
- package/dist/src/entities/bots/token.d.ts +34 -0
- package/dist/src/entities/calendar/booking-link.d.ts +49 -0
- package/dist/src/entities/calendar/booking-namespace.d.ts +130 -0
- package/dist/src/entities/calendar/booking-namespace.test.d.ts +1 -0
- package/dist/src/entities/calendar/booking.d.ts +77 -0
- package/dist/src/entities/calendar/calendar.d.ts +11 -4
- package/dist/src/entities/calendar/create-confirmed.test.d.ts +1 -0
- package/dist/src/entities/calendar/event.d.ts +104 -3
- package/dist/src/entities/calendar/namespace.d.ts +151 -7
- package/dist/src/entities/calendar/namespace.test.d.ts +1 -0
- package/dist/src/entities/calls/call-record.d.ts +34 -4
- package/dist/src/entities/calls/connection.d.ts +53 -0
- package/dist/src/entities/calls/errors.d.ts +15 -0
- package/dist/src/entities/calls/namespace.d.ts +21 -1
- package/dist/src/entities/calls/participant.d.ts +22 -0
- package/dist/src/entities/channels/access-request.d.ts +34 -0
- package/dist/src/entities/channels/channel.d.ts +47 -1
- package/dist/src/entities/channels/namespace.d.ts +21 -5
- package/dist/src/entities/channels/namespace.test.d.ts +1 -0
- package/dist/src/entities/channels/post.d.ts +14 -3
- package/dist/src/entities/channels/thread.d.ts +10 -1
- package/dist/src/entities/chats/chat.d.ts +7 -1
- package/dist/src/entities/chats/namespace.d.ts +14 -1
- package/dist/src/entities/connected-apps/connected-app.d.ts +107 -0
- package/dist/src/entities/connected-apps/connector.d.ts +56 -0
- package/dist/src/entities/connected-apps/namespace.d.ts +74 -0
- package/dist/src/entities/crm/company.d.ts +7 -3
- package/dist/src/entities/crm/contact.d.ts +4 -4
- package/dist/src/entities/crm/namespace.d.ts +34 -1
- package/dist/src/entities/crm/pipeline.d.ts +43 -2
- package/dist/src/entities/databases/database.d.ts +17 -0
- package/dist/src/entities/databases/namespace.d.ts +56 -0
- package/dist/src/entities/documents/ai-edit.d.ts +52 -0
- package/dist/src/entities/documents/document.d.ts +244 -5
- package/dist/src/entities/documents/namespace.d.ts +89 -4
- package/dist/src/entities/documents/office-files.d.ts +47 -0
- package/dist/src/entities/email/draft.d.ts +36 -7
- package/dist/src/entities/email/message.d.ts +99 -3
- package/dist/src/entities/email/namespace.d.ts +47 -4
- package/dist/src/entities/email/namespace.test.d.ts +1 -0
- package/dist/src/entities/email/thread.d.ts +55 -3
- package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
- package/dist/src/entities/external-chat/chat.d.ts +105 -0
- package/dist/src/entities/external-chat/message.d.ts +54 -0
- package/dist/src/entities/external-chat/namespace.d.ts +18 -0
- package/dist/src/entities/external-chat/participant.d.ts +28 -0
- package/dist/src/entities/external-chat/send.d.ts +32 -0
- package/dist/src/entities/external-chat/upload.d.ts +25 -0
- package/dist/src/entities/favorites/namespace.d.ts +5 -1
- package/dist/src/entities/foreign/namespace.d.ts +3 -0
- package/dist/src/entities/forms/form.d.ts +17 -2
- package/dist/src/entities/forms/namespace.d.ts +5 -1
- package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
- package/dist/src/entities/harnesses/harness.d.ts +9 -0
- package/dist/src/entities/harnesses/namespace.d.ts +5 -1
- package/dist/src/entities/images/image.d.ts +77 -0
- package/dist/src/entities/images/namespace.d.ts +48 -0
- package/dist/src/entities/images/namespace.test.d.ts +1 -0
- package/dist/src/entities/initiatives/initiative.d.ts +12 -1
- package/dist/src/entities/initiatives/namespace.d.ts +15 -2
- package/dist/src/entities/me/namespace.d.ts +43 -0
- package/dist/src/entities/meetings/meeting.d.ts +5 -0
- package/dist/src/entities/meetings/namespace.d.ts +5 -1
- package/dist/src/entities/messages/thread.d.ts +1 -1
- package/dist/src/entities/notifications/namespace.d.ts +3 -0
- package/dist/src/entities/pins/namespace.d.ts +5 -1
- package/dist/src/entities/projects/namespace.d.ts +4 -1
- package/dist/src/entities/projects/project.d.ts +9 -1
- package/dist/src/entities/properties/namespace.d.ts +2 -0
- package/dist/src/entities/referrals/namespace.d.ts +33 -0
- package/dist/src/entities/routines/namespace.d.ts +42 -2
- package/dist/src/entities/routines/routine.d.ts +84 -5
- package/dist/src/entities/search/namespace.d.ts +65 -0
- package/dist/src/entities/{search.d.ts → search/options.d.ts} +8 -2
- package/dist/src/entities/search/types.d.ts +90 -0
- package/dist/src/entities/sharing/access.d.ts +14 -0
- package/dist/src/entities/tasks/namespace.d.ts +42 -3
- package/dist/src/entities/tasks/task.d.ts +47 -6
- package/dist/src/entities/teams/invite.d.ts +30 -0
- package/dist/src/entities/teams/namespace.d.ts +3 -0
- package/dist/src/entities/teams/team.d.ts +37 -0
- package/dist/src/entities/unfurls/namespace.d.ts +5 -1
- package/dist/src/entities/users/namespace.d.ts +9 -0
- package/dist/src/entities/users/user.d.ts +8 -0
- package/dist/src/entities/web/namespace.d.ts +61 -0
- package/dist/src/entities/web/namespace.test.d.ts +1 -0
- package/dist/src/entities/webhooks/namespace.d.ts +2 -0
- package/dist/src/entities/whatsapp/account.d.ts +20 -0
- package/dist/src/entities/whatsapp/chat.d.ts +54 -0
- package/dist/src/entities/whatsapp/namespace.d.ts +23 -0
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +14 -9
- package/dist/src/entities/workspace/query.d.ts +23 -0
- package/dist/src/entities/workspace/types.d.ts +6 -3
- package/dist/src/events/hydrate/agentSession.d.ts +1 -1
- package/dist/src/events/hydrate/call.d.ts +101 -0
- package/dist/src/events/hydrate/channel.d.ts +8 -1
- package/dist/src/events/hydrate/document.d.ts +1 -1
- package/dist/src/events/hydrate/message.d.ts +1 -1
- package/dist/src/events/types.d.ts +2 -1
- package/dist/src/macro.d.ts +73 -4
- package/dist/src/macro.js +8235 -3701
- package/dist/src/mentions.d.ts +6 -1
- package/dist/src/utils/activity.d.ts +23 -2
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/unwrap.d.ts +27 -2
- package/package.json +2 -2
package/dist/src/mentions.d.ts
CHANGED
|
@@ -18,7 +18,12 @@ export interface RichMessage {
|
|
|
18
18
|
content: string;
|
|
19
19
|
mentions: SimpleMention[];
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Serialize a mention node to its `<tag>{json}</tag>` wire form. Readers take
|
|
23
|
+
* everything up to the first closing tag, so `<`, `>` and `&` in the JSON are
|
|
24
|
+
* written as `\u` escapes: a document named `</m-document-mention>` would
|
|
25
|
+
* otherwise end the tag early. Decoding the JSON restores the original text.
|
|
26
|
+
*/
|
|
22
27
|
export declare function wrapXml(tag: string, data: unknown): string;
|
|
23
28
|
/** The `@here` group mention. */
|
|
24
29
|
export declare const here: Mentionable;
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A generated SDK operation lifecycle. Contains no arguments, URLs or response
|
|
3
|
+
* data. A gated operation is `skipped` (answered without calling the API) or
|
|
4
|
+
* `refused` (rejected), with no `started` before it.
|
|
5
|
+
*/
|
|
2
6
|
export type RequestActivity = {
|
|
3
7
|
id: number;
|
|
4
8
|
service: string;
|
|
5
9
|
operation: string;
|
|
6
|
-
status: 'started' | 'completed' | 'failed';
|
|
10
|
+
status: 'started' | 'completed' | 'failed' | 'skipped' | 'refused';
|
|
11
|
+
};
|
|
12
|
+
/** What a gate decides for one operation; `undefined` lets it run. */
|
|
13
|
+
export type RequestVerdict = undefined | {
|
|
14
|
+
skip: {
|
|
15
|
+
data: unknown;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
refuse: string;
|
|
7
19
|
};
|
|
8
20
|
/** @internal Install runtime diagnostics before constructing SDK clients. */
|
|
9
21
|
export declare function setDefaultRequestObserver(observer: (event: RequestActivity) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* @internal Decide, before each generated API operation, whether it runs, is
|
|
24
|
+
* answered with a stand-in result, or is refused. Install it before
|
|
25
|
+
* constructing SDK clients.
|
|
26
|
+
*/
|
|
27
|
+
export declare function setDefaultRequestGate(gate: (operation: {
|
|
28
|
+
service: string;
|
|
29
|
+
operation: string;
|
|
30
|
+
}) => RequestVerdict): void;
|
|
10
31
|
/** @internal Observe generated API operations without changing arguments or results. */
|
|
11
32
|
export declare function observeSdk<T extends object>(sdk: T, service: string, observer?: (event: RequestActivity) => void): T;
|
|
@@ -2,4 +2,4 @@ export { MacroClient } from './client';
|
|
|
2
2
|
export { mapConcurrently } from './concurrency';
|
|
3
3
|
export { Lazy } from './lazy';
|
|
4
4
|
export { type Page, paginate } from './pagination';
|
|
5
|
-
export { MacroApiError, MacroError, MacroNotFoundError, unwrap, } from './unwrap';
|
|
5
|
+
export { MacroApiError, MacroError, MacroForbiddenError, MacroNotFoundError, unwrap, } from './unwrap';
|
|
@@ -2,19 +2,44 @@
|
|
|
2
2
|
export declare class MacroError extends Error {
|
|
3
3
|
constructor(message: string);
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* A non-2xx HTTP response (Macro API, or a raw fetch like presigned downloads).
|
|
7
|
+
* The message includes the server's explanation, such as a validation error,
|
|
8
|
+
* and `data` holds the parsed error body.
|
|
9
|
+
*/
|
|
6
10
|
export declare class MacroApiError extends MacroError {
|
|
7
11
|
readonly status: number;
|
|
8
12
|
readonly data: unknown;
|
|
9
13
|
constructor(status: number, data: unknown);
|
|
10
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A 403: the caller lacks the access the request needs. Most often the user
|
|
17
|
+
* can view the item but not edit it.
|
|
18
|
+
*
|
|
19
|
+
* Agents: tell the user they can only view the item and offer to ask its owner
|
|
20
|
+
* for edit access. Request it only with the user's go-ahead, by calling
|
|
21
|
+
* `access.request('edit')` on the item (for example
|
|
22
|
+
* `macro.initiatives.byId(id).access.request('edit')`); never request access
|
|
23
|
+
* on your own. The request grants nothing: report that it is pending and who
|
|
24
|
+
* reviews it (`access.state()` returns the `owner`), and do not claim the
|
|
25
|
+
* write succeeded. Check `access.state()` later and retry the write only once
|
|
26
|
+
* `accessLevel` allows it.
|
|
27
|
+
*
|
|
28
|
+
* The server does not say which item refused the write. A write that touches
|
|
29
|
+
* two items, such as setting a task's Project (or another property that
|
|
30
|
+
* references an item), needs edit access to both: read `access.state()` on
|
|
31
|
+
* each and request access on the one whose `accessLevel` is below `edit`.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MacroForbiddenError extends MacroApiError {
|
|
34
|
+
constructor(data: unknown);
|
|
35
|
+
}
|
|
11
36
|
/** The API succeeded but the addressed entity doesn't exist in the result. */
|
|
12
37
|
export declare class MacroNotFoundError extends MacroError {
|
|
13
38
|
constructor(message: string);
|
|
14
39
|
}
|
|
15
40
|
/**
|
|
16
41
|
* Turn a hey-api `{ data, error, response? }` result into either the success
|
|
17
|
-
* payload or a thrown MacroApiError.
|
|
42
|
+
* payload or a thrown MacroApiError (MacroForbiddenError for a 403).
|
|
18
43
|
*/
|
|
19
44
|
export declare function unwrap<TData, TError>(res: {
|
|
20
45
|
data?: TData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macro-inc/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/macro-inc/macro.git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"webhook": "bun scripts/webhook.ts",
|
|
32
32
|
"validate-webhook": "bun scripts/validate-webhook.ts",
|
|
33
33
|
"coverage": "bun src/coverage/check.ts",
|
|
34
|
-
"generate": "
|
|
34
|
+
"generate": "bun scripts/generate.ts",
|
|
35
35
|
"build:js": "bun scripts/build.ts",
|
|
36
36
|
"build:types": "tsc -p tsconfig.build.json",
|
|
37
37
|
"build": "bun run build:js && bun run build:types",
|