@macro-inc/sdk 0.0.1 → 0.2.2
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 +628 -21
- package/dist/{chunk-5HAKQN23.js → chunk-7LVVPVNT.js} +70 -57
- package/dist/{chunk-JXIQT5TH.js → chunk-7YJ6Y7HJ.js} +234 -16
- package/dist/chunk-LMJW65ML.js +836 -0
- package/dist/{chunk-SGAHIERJ.js → chunk-OGE7WXJE.js} +16 -0
- package/dist/chunk-PRUFPW3B.js +943 -0
- package/dist/{chunk-CTKR64MY.js → chunk-QVBNNMQS.js} +242 -367
- package/dist/{chunk-QNUS5BC5.js → chunk-SUINKDXF.js} +30 -84
- package/dist/{chunk-77EI4LSQ.js → chunk-ZQXOHNDB.js} +1518 -386
- 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 +174 -4
- package/dist/generated/agent-harness/types.gen.d.ts +2511 -189
- 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 +106 -8
- package/dist/generated/auth/types.gen.d.ts +1473 -116
- package/dist/generated/calendar/client/client.gen.d.ts +2 -0
- package/dist/generated/calendar/client/index.d.ts +10 -0
- package/dist/generated/calendar/client/types.gen.d.ts +120 -0
- package/dist/generated/calendar/client/utils.gen.d.ts +37 -0
- package/dist/generated/calendar/client.gen.d.ts +12 -0
- package/dist/generated/calendar/core/auth.gen.d.ts +25 -0
- package/dist/generated/calendar/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/calendar/core/params.gen.d.ts +43 -0
- package/dist/generated/calendar/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/calendar/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/calendar/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/calendar/core/types.gen.d.ts +83 -0
- package/dist/generated/calendar/core/utils.gen.d.ts +19 -0
- package/dist/generated/calendar/index.d.ts +2 -0
- package/dist/generated/calendar/index.js +6 -0
- package/dist/generated/calendar/sdk.gen.d.ts +95 -0
- package/dist/generated/calendar/types.gen.d.ts +1091 -0
- 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 +6 -1
- package/dist/generated/cognition/types.gen.d.ts +304 -36
- package/dist/generated/connection/types.gen.d.ts +1 -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 +32 -27
- package/dist/generated/email/types.gen.d.ts +586 -409
- package/dist/generated/notification/index.d.ts +1 -1
- package/dist/generated/notification/types.gen.d.ts +384 -19
- package/dist/generated/properties/types.gen.d.ts +8 -5
- package/dist/generated/scheduled-action/index.d.ts +1 -1
- package/dist/generated/scheduled-action/index.js +3 -842
- package/dist/generated/scheduled-action/sdk.gen.d.ts +3 -1
- package/dist/generated/scheduled-action/types.gen.d.ts +277 -41
- package/dist/generated/search/index.d.ts +1 -1
- package/dist/generated/search/types.gen.d.ts +262 -43
- 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 +678 -107
- package/dist/generated/storage/types.gen.d.ts +14827 -5995
- package/dist/generated/unfurl/index.d.ts +1 -1
- package/dist/generated/unfurl/index.js +3 -832
- package/dist/generated/unfurl/types.gen.d.ts +20 -0
- package/dist/src/config.d.ts +33 -13
- package/dist/src/entities/agent-sessions/agent-session.d.ts +150 -6
- package/dist/src/entities/agent-sessions/code-execution.d.ts +43 -0
- package/dist/src/entities/agent-sessions/conversation.d.ts +54 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +23 -5
- package/dist/src/entities/agent-sessions/queued-action.d.ts +46 -0
- package/dist/src/entities/agent-sessions/review.d.ts +107 -0
- package/dist/src/entities/agent-sessions/tool-approval.d.ts +21 -0
- package/dist/src/entities/agents/agent.d.ts +47 -0
- package/dist/src/entities/agents/namespace.d.ts +13 -0
- package/dist/src/entities/ai/namespace.d.ts +24 -0
- package/dist/src/entities/api-keys/api-key.d.ts +17 -0
- package/dist/src/entities/api-keys/namespace.d.ts +18 -0
- package/dist/src/entities/calendar/calendar.d.ts +35 -0
- package/dist/src/entities/calendar/event.d.ts +123 -0
- package/dist/src/entities/calendar/event.test.d.ts +1 -0
- package/dist/src/entities/calendar/namespace.d.ts +111 -0
- package/dist/src/entities/calendar/replacement.d.ts +15 -0
- package/dist/src/entities/calls/call-record.d.ts +62 -6
- package/dist/src/entities/calls/message.d.ts +33 -0
- package/dist/src/entities/channels/activity.d.ts +24 -0
- package/dist/src/entities/channels/channel.d.ts +44 -3
- package/dist/src/entities/channels/labels.d.ts +39 -0
- package/dist/src/entities/channels/message.d.ts +9 -17
- package/dist/src/entities/channels/namespace.d.ts +6 -0
- package/dist/src/entities/channels/picture.d.ts +11 -0
- package/dist/src/entities/channels/post.d.ts +1 -1
- package/dist/src/entities/channels/thread.d.ts +5 -0
- package/dist/src/entities/chats/chat.d.ts +11 -1
- package/dist/src/entities/chats/generation.d.ts +46 -0
- package/dist/src/entities/crm/comment.d.ts +55 -34
- package/dist/src/entities/crm/company.d.ts +42 -10
- package/dist/src/entities/crm/contact.d.ts +42 -10
- package/dist/src/entities/crm/namespace.d.ts +18 -1
- package/dist/src/entities/crm/pipeline.d.ts +122 -0
- package/dist/src/entities/crm/pipelines.d.ts +14 -0
- package/dist/src/entities/databases/column.d.ts +75 -0
- package/dist/src/entities/databases/database.d.ts +272 -0
- package/dist/src/entities/databases/namespace.d.ts +21 -0
- package/dist/src/entities/databases/query.d.ts +86 -0
- package/dist/src/entities/databases/row.d.ts +27 -0
- package/dist/src/entities/databases/table.d.ts +61 -0
- package/dist/src/entities/databases/view.d.ts +40 -0
- package/dist/src/entities/databases/webhook.d.ts +32 -0
- package/dist/src/entities/documents/anchor.d.ts +29 -0
- package/dist/src/entities/documents/comment.d.ts +25 -22
- package/dist/src/entities/documents/document.d.ts +60 -12
- package/dist/src/entities/documents/namespace.d.ts +30 -0
- package/dist/src/entities/documents/version.d.ts +22 -0
- package/dist/src/entities/email/draft.d.ts +79 -0
- package/dist/src/entities/email/filter.d.ts +34 -0
- package/dist/src/entities/email/link.d.ts +6 -4
- package/dist/src/entities/email/message.d.ts +12 -1
- package/dist/src/entities/email/namespace.d.ts +34 -1
- package/dist/src/entities/email/thread.d.ts +23 -1
- package/dist/src/entities/entity-mentions/mention.d.ts +16 -0
- package/dist/src/entities/entity-mentions/namespace.d.ts +12 -0
- package/dist/src/entities/entity.d.ts +7 -0
- package/dist/src/entities/favorites/namespace.d.ts +14 -2
- package/dist/src/entities/foreign/foreign-entity.d.ts +2 -0
- package/dist/src/entities/foreign/namespace.d.ts +40 -0
- package/dist/src/entities/forms/form.d.ts +227 -0
- package/dist/src/entities/forms/namespace.d.ts +18 -0
- package/dist/src/entities/forms/question.d.ts +37 -0
- package/dist/src/entities/forms/response.d.ts +32 -0
- package/dist/src/entities/forms/section.d.ts +19 -0
- package/dist/src/entities/github-pull-requests/namespace.d.ts +12 -0
- package/dist/src/entities/github-pull-requests/pull-request.d.ts +52 -0
- package/dist/src/entities/harnesses/harness.d.ts +19 -0
- package/dist/src/entities/harnesses/namespace.d.ts +33 -0
- package/dist/src/entities/harnesses/pairing.d.ts +39 -0
- package/dist/src/entities/initiatives/initiative.d.ts +50 -0
- package/dist/src/entities/initiatives/namespace.d.ts +13 -0
- package/dist/src/entities/meetings/meeting.d.ts +38 -0
- package/dist/src/entities/meetings/namespace.d.ts +18 -0
- package/dist/src/entities/messages/thread.d.ts +101 -0
- package/dist/src/entities/notifications/notification.d.ts +6 -3
- package/dist/src/entities/notifications/notification.test.d.ts +1 -0
- package/dist/src/entities/projects/project.d.ts +7 -0
- package/dist/src/entities/reference.d.ts +82 -0
- package/dist/src/entities/routines/namespace.d.ts +15 -0
- package/dist/src/entities/routines/routine.d.ts +115 -0
- package/dist/src/entities/sharing/access.d.ts +65 -0
- package/dist/src/entities/sharing/permissions.d.ts +13 -0
- package/dist/src/entities/tasks/namespace.d.ts +4 -0
- package/dist/src/entities/tasks/task.d.ts +6 -0
- package/dist/src/entities/unfurls/namespace.d.ts +10 -0
- package/dist/src/entities/webhooks/webhook.d.ts +3 -1
- package/dist/src/entities/workspace/items.d.ts +7 -0
- package/dist/src/entities/workspace/namespace.d.ts +83 -0
- package/dist/src/entities/workspace/query.d.ts +12 -0
- package/dist/src/entities/workspace/types.d.ts +96 -0
- package/dist/src/events/hydrate/agentSession.d.ts +192 -0
- package/dist/src/events/hydrate/channel.d.ts +2 -39
- package/dist/src/events/hydrate/message.d.ts +70 -0
- package/dist/src/events/receiver.d.ts +57 -19
- package/dist/src/events/types.d.ts +3 -1
- package/dist/src/macro.d.ts +80 -3
- package/dist/src/macro.js +8832 -2784
- package/dist/src/utils/activity.d.ts +11 -0
- package/dist/src/utils/activity.test.d.ts +1 -0
- package/dist/src/utils/client.d.ts +10 -1
- package/dist/src/utils/concurrency.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/pagination.d.ts +9 -4
- package/package.json +11 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { BookingTarget, CellValue, EntityKind, FilterGroup, FilterTest, FormDetail, FormPublicationProblem, ResponseStatus, SharePermissionV2, UnlockedBooking, UpdateForm, UpdateSharePermissionRequestV2, Widget } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import type { DatabaseColumn } from '../databases/column';
|
|
4
|
+
import { Database } from '../databases/database';
|
|
5
|
+
import { DatabaseRow } from '../databases/row';
|
|
6
|
+
import { DatabaseTable } from '../databases/table';
|
|
7
|
+
import { MacroEntity } from '../entity';
|
|
8
|
+
import { User } from '../users/user';
|
|
9
|
+
import { FormOption, FormQuestion } from './question';
|
|
10
|
+
import { FormResponse } from './response';
|
|
11
|
+
import { FormSection } from './section';
|
|
12
|
+
/** An entity handle used in a reference answer or rule. */
|
|
13
|
+
export interface FormEntityHandle {
|
|
14
|
+
/** The entity's identifier. */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
}
|
|
17
|
+
/** A typed reference read from a form answer, without fetching the referenced entity. */
|
|
18
|
+
export declare class FormReference implements FormEntityHandle {
|
|
19
|
+
/** The referenced entity's kind. */
|
|
20
|
+
readonly entityType: EntityKind;
|
|
21
|
+
/** The referenced entity's identifier. */
|
|
22
|
+
readonly id: string;
|
|
23
|
+
private constructor();
|
|
24
|
+
/** Construct a reference when its kind and identifier are known. */
|
|
25
|
+
static byId(entityType: EntityKind, id: string): FormReference;
|
|
26
|
+
}
|
|
27
|
+
/** An answer value; references use handles, and scalar values keep their cell representation. */
|
|
28
|
+
export type FormAnswerValue = Exclude<CellValue, {
|
|
29
|
+
type: 'rows' | 'options' | 'entities';
|
|
30
|
+
}> | {
|
|
31
|
+
type: 'rows';
|
|
32
|
+
value: DatabaseRow[];
|
|
33
|
+
} | {
|
|
34
|
+
type: 'options';
|
|
35
|
+
value: FormOption[];
|
|
36
|
+
} | {
|
|
37
|
+
type: 'entities';
|
|
38
|
+
value: {
|
|
39
|
+
entityType: EntityKind;
|
|
40
|
+
entity: FormEntityHandle;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
/** One question and its answer. */
|
|
44
|
+
export type FormAnswer = {
|
|
45
|
+
question: FormQuestion;
|
|
46
|
+
value: FormAnswerValue;
|
|
47
|
+
};
|
|
48
|
+
/** A form rule, with option and entity references represented by handles. */
|
|
49
|
+
export type FormRuleTest = Exclude<FilterTest, {
|
|
50
|
+
kind: 'options' | 'entities';
|
|
51
|
+
}> | {
|
|
52
|
+
kind: 'options';
|
|
53
|
+
operator: Extract<FilterTest, {
|
|
54
|
+
kind: 'options';
|
|
55
|
+
}>['operator'];
|
|
56
|
+
options: FormOption[];
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'entities';
|
|
59
|
+
operator: Extract<FilterTest, {
|
|
60
|
+
kind: 'entities';
|
|
61
|
+
}>['operator'];
|
|
62
|
+
entities: FormEntityHandle[];
|
|
63
|
+
};
|
|
64
|
+
/** Conditions over columns asked in earlier sections. */
|
|
65
|
+
export type FormRules = {
|
|
66
|
+
conjunction: FilterGroup['conjunction'];
|
|
67
|
+
conditions: ({
|
|
68
|
+
kind: 'condition';
|
|
69
|
+
column: DatabaseColumn;
|
|
70
|
+
test: FormRuleTest;
|
|
71
|
+
} | ({
|
|
72
|
+
kind: 'group';
|
|
73
|
+
} & FormRules))[];
|
|
74
|
+
};
|
|
75
|
+
/** A question placement in a layout replacement. Omit question to mint a new stable question. */
|
|
76
|
+
export type FormQuestionPlacement = {
|
|
77
|
+
question?: FormQuestion;
|
|
78
|
+
column: DatabaseColumn;
|
|
79
|
+
helpText?: string;
|
|
80
|
+
required?: boolean;
|
|
81
|
+
widget?: Widget;
|
|
82
|
+
};
|
|
83
|
+
/** A section in a layout replacement. Omit section to mint a new stable section. */
|
|
84
|
+
export type FormSectionPlacement = {
|
|
85
|
+
section?: FormSection;
|
|
86
|
+
title: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
} & ({
|
|
89
|
+
kind: 'questions';
|
|
90
|
+
questions: FormQuestionPlacement[];
|
|
91
|
+
} | {
|
|
92
|
+
kind: 'gate';
|
|
93
|
+
rules: FormRules;
|
|
94
|
+
message: string;
|
|
95
|
+
} | {
|
|
96
|
+
kind: 'booking';
|
|
97
|
+
target: BookingTarget;
|
|
98
|
+
});
|
|
99
|
+
/** A saved layout and any reason it is not yet visible to respondents. */
|
|
100
|
+
export type FormLayoutResult = {
|
|
101
|
+
form: Form;
|
|
102
|
+
publicationError?: FormPublicationProblem;
|
|
103
|
+
};
|
|
104
|
+
/** The public Macro booking destination selected by a form editor. */
|
|
105
|
+
export type FormBookingTarget = BookingTarget;
|
|
106
|
+
/** A booking step released after the form accepts the caller's answers. */
|
|
107
|
+
export type FormBookingStep = Omit<UnlockedBooking, 'section'> & {
|
|
108
|
+
section: FormSection;
|
|
109
|
+
};
|
|
110
|
+
/** The result of submitting or editing a response. A stopped submission has no row. */
|
|
111
|
+
export type FormSubmissionOutcome = {
|
|
112
|
+
outcome: 'submitted';
|
|
113
|
+
response: FormResponse;
|
|
114
|
+
row: DatabaseRow;
|
|
115
|
+
booking?: FormBookingStep;
|
|
116
|
+
} | {
|
|
117
|
+
outcome: 'stopped';
|
|
118
|
+
section: FormSection;
|
|
119
|
+
message: string;
|
|
120
|
+
};
|
|
121
|
+
/** The caller's receipt and current answers, read without access to other responses. */
|
|
122
|
+
export type MyFormResponse = {
|
|
123
|
+
booking?: FormBookingStep;
|
|
124
|
+
response: FormResponse;
|
|
125
|
+
status: ResponseStatus;
|
|
126
|
+
stoppedAtSection?: FormSection;
|
|
127
|
+
row?: DatabaseRow;
|
|
128
|
+
submittedAt: string;
|
|
129
|
+
updatedAt: string;
|
|
130
|
+
answers: FormAnswer[];
|
|
131
|
+
};
|
|
132
|
+
/** Counts from the response ledger and its linked table. */
|
|
133
|
+
export type FormResponseSummary = {
|
|
134
|
+
submitted: number;
|
|
135
|
+
stopped: number;
|
|
136
|
+
stoppedBySection: {
|
|
137
|
+
section: FormSection;
|
|
138
|
+
count: number;
|
|
139
|
+
}[];
|
|
140
|
+
rows: number;
|
|
141
|
+
};
|
|
142
|
+
/** A question's public tally. Options with no votes are retained. */
|
|
143
|
+
export type FormQuestionTally = {
|
|
144
|
+
question: FormQuestion;
|
|
145
|
+
responses: number;
|
|
146
|
+
buckets: {
|
|
147
|
+
value: {
|
|
148
|
+
kind: 'option';
|
|
149
|
+
option: FormOption;
|
|
150
|
+
} | {
|
|
151
|
+
kind: 'checkbox';
|
|
152
|
+
checked: boolean;
|
|
153
|
+
};
|
|
154
|
+
count: number;
|
|
155
|
+
}[];
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* A form over a database table. Viewers can read its questions and submit;
|
|
159
|
+
* editors can build it and read responses; owners control its audience.
|
|
160
|
+
*/
|
|
161
|
+
export declare class Form extends MacroEntity<FormDetail> {
|
|
162
|
+
protected fetch(): Promise<FormDetail>;
|
|
163
|
+
/** A form handle with details loaded on demand. */
|
|
164
|
+
static byId(client: MacroClient, id: string): Form;
|
|
165
|
+
/** Create a form, optionally over a table of a database the caller owns. */
|
|
166
|
+
static create(client: MacroClient, options: {
|
|
167
|
+
name: string;
|
|
168
|
+
table?: DatabaseTable;
|
|
169
|
+
}): Promise<Form>;
|
|
170
|
+
/** Forms shared with the caller, or live forms over a specified database. */
|
|
171
|
+
static list(client: MacroClient, database?: Database): Promise<Form[]>;
|
|
172
|
+
/** The form's presentation and column facts; this never contains response rows. */
|
|
173
|
+
schema(): Promise<FormDetail>;
|
|
174
|
+
/** The form's display name. */
|
|
175
|
+
readonly name: () => Promise<string>;
|
|
176
|
+
/** Introductory text shown to respondents. */
|
|
177
|
+
readonly description: () => Promise<string>;
|
|
178
|
+
/** The owning user. */
|
|
179
|
+
readonly owner: () => Promise<User>;
|
|
180
|
+
/** The response database. Reading its contents requires separate access. */
|
|
181
|
+
readonly database: () => Promise<Database>;
|
|
182
|
+
/** The linked table, without fetching its contents. */
|
|
183
|
+
readonly table: () => Promise<DatabaseTable>;
|
|
184
|
+
/** Who may respond. */
|
|
185
|
+
readonly audience: () => Promise<import("../../../generated/storage").Audience>;
|
|
186
|
+
/** Whether submissions are currently enabled. A closing time can also close the form. */
|
|
187
|
+
readonly status: () => Promise<import("../../../generated/storage").FormStatus>;
|
|
188
|
+
/** Scheduled closing time, when set. */
|
|
189
|
+
readonly closesAt: () => Promise<string | undefined>;
|
|
190
|
+
/** The caller's access level. */
|
|
191
|
+
readonly access: () => Promise<import("../../../generated/storage").FormAccess>;
|
|
192
|
+
/** Sections in display order. */
|
|
193
|
+
sections(): Promise<FormSection[]>;
|
|
194
|
+
/** All questions in display order, skipping gates. */
|
|
195
|
+
questions(): Promise<FormQuestion[]>;
|
|
196
|
+
/** Update presentation or owner-controlled settings; null explicitly clears the closing time. */
|
|
197
|
+
update(updates: UpdateForm): Promise<this>;
|
|
198
|
+
private assertOwns;
|
|
199
|
+
/**
|
|
200
|
+
* Save a replacement in the shared draft. Existing handles retain identity;
|
|
201
|
+
* omitted handles mint sections or questions. Column facts use the database API.
|
|
202
|
+
* A publicationError means the draft was saved but respondents still see the last
|
|
203
|
+
* valid version. Repair the reported problem or reload to retry publication.
|
|
204
|
+
*/
|
|
205
|
+
replaceLayout(sections: FormSectionPlacement[]): Promise<FormLayoutResult>;
|
|
206
|
+
private wireAnswers;
|
|
207
|
+
private unlockedBooking;
|
|
208
|
+
private outcome;
|
|
209
|
+
/** Submit answers. Signed-in respondents get at most one response; use editResponse afterwards. */
|
|
210
|
+
submit(answers: FormAnswer[]): Promise<FormSubmissionOutcome>;
|
|
211
|
+
/** Replace the caller's answers while the form is open; gates are evaluated again. */
|
|
212
|
+
editResponse(answers: FormAnswer[]): Promise<FormSubmissionOutcome>;
|
|
213
|
+
/** Read the caller's receipt and answers without reading anyone else's responses. */
|
|
214
|
+
myResponse(): Promise<MyFormResponse>;
|
|
215
|
+
/** Ledger counts and total table rows; requires edit access. */
|
|
216
|
+
responseSummary(): Promise<FormResponseSummary>;
|
|
217
|
+
/** Choice and checkbox counts, available to viewers when tally visibility is enabled. */
|
|
218
|
+
tally(): Promise<FormQuestionTally[]>;
|
|
219
|
+
/** Read the form's sharing grants. Requires ownership. */
|
|
220
|
+
sharePermissions(): Promise<SharePermissionV2>;
|
|
221
|
+
/** Update grants. Public responding is controlled by audience, not link sharing. */
|
|
222
|
+
updateSharePermissions(request: UpdateSharePermissionRequestV2): Promise<SharePermissionV2>;
|
|
223
|
+
/** Open the form's builder in Macro. */
|
|
224
|
+
webUrl(): string;
|
|
225
|
+
/** The respondent page, which public forms also expose without signing in. */
|
|
226
|
+
respondUrl(): string;
|
|
227
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { Database } from '../databases/database';
|
|
3
|
+
import type { DatabaseTable } from '../databases/table';
|
|
4
|
+
import { Form } from './form';
|
|
5
|
+
/** Forms collect answers into a database table without granting respondents table access. */
|
|
6
|
+
export declare class FormNamespace {
|
|
7
|
+
private readonly client;
|
|
8
|
+
constructor(client: MacroClient);
|
|
9
|
+
/** A form handle. Details load on first access. */
|
|
10
|
+
byId(id: string): Form;
|
|
11
|
+
/** Create a form over an existing table, or create its own Responses database. */
|
|
12
|
+
create(options: {
|
|
13
|
+
name: string;
|
|
14
|
+
table?: DatabaseTable;
|
|
15
|
+
}): Promise<Form>;
|
|
16
|
+
/** List forms shared with the caller, or forms over a database the caller can read. */
|
|
17
|
+
list(database?: Database): Promise<Form[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { FormQuestionDetail, QuestionOption } from '../../../generated/storage/types.gen';
|
|
2
|
+
import { DatabaseColumn } from '../databases/column';
|
|
3
|
+
import type { Form } from './form';
|
|
4
|
+
/** One question, backed by a column. Its details never require reading the response table. */
|
|
5
|
+
export declare class FormQuestion {
|
|
6
|
+
/** The form that asks this question. */
|
|
7
|
+
readonly form: Form;
|
|
8
|
+
/** The question's stable identifier within its form layout. */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
private constructor();
|
|
11
|
+
/** A question handle within a form. */
|
|
12
|
+
static byId(form: Form, id: string): FormQuestion;
|
|
13
|
+
/** The question's current presentation and column facts. */
|
|
14
|
+
detail(): Promise<FormQuestionDetail>;
|
|
15
|
+
/** The question's current title (its column's name). */
|
|
16
|
+
title(): Promise<string>;
|
|
17
|
+
/** The column behind the question. Reading the column itself needs database access. */
|
|
18
|
+
column(): Promise<DatabaseColumn>;
|
|
19
|
+
/** Current choices, in display order. */
|
|
20
|
+
options(): Promise<FormOption[]>;
|
|
21
|
+
}
|
|
22
|
+
/** A choice of one form question, resolved through that question's current options. */
|
|
23
|
+
export declare class FormOption {
|
|
24
|
+
/** The question offering this choice. */
|
|
25
|
+
readonly question: FormQuestion;
|
|
26
|
+
/** The backing database option's identifier. */
|
|
27
|
+
readonly id: string;
|
|
28
|
+
private constructor();
|
|
29
|
+
/** A handle to a known choice of a question. */
|
|
30
|
+
static byId(question: FormQuestion, id: string): FormOption;
|
|
31
|
+
/** The choice's label and color. */
|
|
32
|
+
detail(): Promise<QuestionOption>;
|
|
33
|
+
/** The choice's label. */
|
|
34
|
+
label(): Promise<string>;
|
|
35
|
+
/** The choice's color, when one is set. */
|
|
36
|
+
color(): Promise<string | undefined>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ResponseStatus } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { DatabaseRow } from '../databases/row';
|
|
3
|
+
import type { Form, FormAnswer, FormBookingStep } from './form';
|
|
4
|
+
type ResponseSnapshot = {
|
|
5
|
+
status: ResponseStatus;
|
|
6
|
+
booking?: FormBookingStep;
|
|
7
|
+
row?: DatabaseRow;
|
|
8
|
+
answers: FormAnswer[];
|
|
9
|
+
};
|
|
10
|
+
/** A cached receipt for the caller's response; other respondents' receipts are private. */
|
|
11
|
+
export declare class FormResponse {
|
|
12
|
+
/** The form that received this response. */
|
|
13
|
+
readonly form: Form;
|
|
14
|
+
/** The response ledger entry's identifier. */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
private detail;
|
|
17
|
+
private constructor();
|
|
18
|
+
private load;
|
|
19
|
+
/** A response handle, optionally seeded with an already returned receipt. */
|
|
20
|
+
static byId(form: Form, id: string, snapshot?: ResponseSnapshot): FormResponse;
|
|
21
|
+
/** Whether this receipt was submitted or stopped by a gate. */
|
|
22
|
+
status(): Promise<ResponseStatus>;
|
|
23
|
+
/** The receipt's row, if any. Reading that row requires database access. */
|
|
24
|
+
row(): Promise<DatabaseRow | undefined>;
|
|
25
|
+
/** Answers as submitted or last read. Refresh to include later changes to the row. */
|
|
26
|
+
answers(): Promise<FormAnswer[]>;
|
|
27
|
+
/** The booking step unlocked by this saved response, if any. */
|
|
28
|
+
booking(): Promise<FormBookingStep | undefined>;
|
|
29
|
+
/** Reload the caller's current receipt; requires a signed-in respondent. */
|
|
30
|
+
refresh(): Promise<this>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FormSectionDetail } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { Form } from './form';
|
|
3
|
+
import { FormQuestion } from './question';
|
|
4
|
+
/** An ordered group of questions, or a gate between groups. */
|
|
5
|
+
export declare class FormSection {
|
|
6
|
+
/** The owning form. */
|
|
7
|
+
readonly form: Form;
|
|
8
|
+
/** The section's stable identifier. */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
private constructor();
|
|
11
|
+
/** A section handle within a form. */
|
|
12
|
+
static byId(form: Form, id: string): FormSection;
|
|
13
|
+
/** The section's current presentation. */
|
|
14
|
+
detail(): Promise<FormSectionDetail>;
|
|
15
|
+
/** The section heading. */
|
|
16
|
+
title(): Promise<string>;
|
|
17
|
+
/** Questions in display order; gates contain no questions. */
|
|
18
|
+
questions(): Promise<FormQuestion[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import type { ForeignEntity } from '../foreign/foreign-entity';
|
|
3
|
+
import { GithubPullRequest } from './pull-request';
|
|
4
|
+
/** GitHub pull request snapshots and captured diffs. */
|
|
5
|
+
export declare class GithubPullRequestNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
/** Construct from a Macro foreign entity's identity. */
|
|
9
|
+
byId(id: string): GithubPullRequest;
|
|
10
|
+
/** Resolve a foreign entity as a pull request. */
|
|
11
|
+
forEntity(entity: ForeignEntity): GithubPullRequest;
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ChangesetDto, StoredGithubPullRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/** A stored GitHub pull request addressed by its Macro foreign entity. */
|
|
5
|
+
export declare class GithubPullRequest extends MacroEntity<StoredGithubPullRequest> {
|
|
6
|
+
/** Construct a lazy pull request handle. */
|
|
7
|
+
static byId(client: MacroClient, id: string): GithubPullRequest;
|
|
8
|
+
protected fetch(): Promise<StoredGithubPullRequest>;
|
|
9
|
+
/** Pull request title. */
|
|
10
|
+
readonly title: () => Promise<string | undefined>;
|
|
11
|
+
/** GitHub URL. */
|
|
12
|
+
readonly url: () => Promise<string>;
|
|
13
|
+
/** Current state. */
|
|
14
|
+
readonly status: () => Promise<NonNullable<"open" | "closed" | "merged" | null | undefined> | undefined>;
|
|
15
|
+
/** Captured change metadata, when available. */
|
|
16
|
+
changes(): Promise<{
|
|
17
|
+
changeset?: PullRequestChangeset;
|
|
18
|
+
error?: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** One captured diff belonging to a pull request. */
|
|
22
|
+
export declare class PullRequestChangeset {
|
|
23
|
+
private readonly client;
|
|
24
|
+
/** Parent pull request. */
|
|
25
|
+
readonly pullRequest: GithubPullRequest;
|
|
26
|
+
/** Captured metadata. */
|
|
27
|
+
readonly record: ChangesetDto;
|
|
28
|
+
constructor(client: MacroClient,
|
|
29
|
+
/** Parent pull request. */
|
|
30
|
+
pullRequest: GithubPullRequest,
|
|
31
|
+
/** Captured metadata. */
|
|
32
|
+
record: ChangesetDto);
|
|
33
|
+
/** Captured identity. */
|
|
34
|
+
get id(): string;
|
|
35
|
+
/** Read the captured unified patch. */
|
|
36
|
+
patch(): Promise<string>;
|
|
37
|
+
/** Serialize captured metadata and parent identity. */
|
|
38
|
+
toJSON(): {
|
|
39
|
+
additions: number;
|
|
40
|
+
base: import("../../../generated/storage").GitRefDto;
|
|
41
|
+
capturedAt: string;
|
|
42
|
+
deletions: number;
|
|
43
|
+
files: Array<import("../../../generated/storage").ChangedFileDto>;
|
|
44
|
+
head: import("../../../generated/storage").GitRefDto;
|
|
45
|
+
id: string;
|
|
46
|
+
patchBytes: number;
|
|
47
|
+
repository?: string | null;
|
|
48
|
+
source: import("../../../generated/storage").ChangesetSourceDto;
|
|
49
|
+
truncated: boolean;
|
|
50
|
+
pullRequestId: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Harness as HarnessRecord } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
/** A registered host for coding agents. */
|
|
5
|
+
export declare class Harness extends MacroEntity<HarnessRecord> {
|
|
6
|
+
/** Construct a lazy host handle. */
|
|
7
|
+
static byId(client: MacroClient, id: string): Harness;
|
|
8
|
+
/** Seed from a listed host. */
|
|
9
|
+
static from(client: MacroClient, record: HarnessRecord): Harness;
|
|
10
|
+
protected fetch(): Promise<HarnessRecord>;
|
|
11
|
+
/** Display name. */
|
|
12
|
+
readonly name: () => Promise<string>;
|
|
13
|
+
/** Whether the host is connected. */
|
|
14
|
+
readonly connected: () => Promise<boolean>;
|
|
15
|
+
/** Runtime kind. */
|
|
16
|
+
readonly kind: () => Promise<string>;
|
|
17
|
+
/** Remove the host. */
|
|
18
|
+
delete(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CreatePairingRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { AgentSession } from '../agent-sessions/agent-session';
|
|
4
|
+
import { Agent } from '../agents/agent';
|
|
5
|
+
import { Harness } from './harness';
|
|
6
|
+
import { DevicePairing, HarnessPairing } from './pairing';
|
|
7
|
+
/** Hosts and device pairing. Self operations require host credentials. */
|
|
8
|
+
export declare class HarnessNamespace {
|
|
9
|
+
private readonly client;
|
|
10
|
+
constructor(client: MacroClient);
|
|
11
|
+
/** Construct a lazy host handle. */
|
|
12
|
+
byId(id: string): Harness;
|
|
13
|
+
/** All hosts visible to the caller. */
|
|
14
|
+
list(): Promise<Harness[]>;
|
|
15
|
+
/** The currently authenticated host. */
|
|
16
|
+
me(): Promise<Harness>;
|
|
17
|
+
/** Revoke the currently authenticated host. */
|
|
18
|
+
deleteSelf(): Promise<void>;
|
|
19
|
+
/** Agent handles for the currently authenticated host. */
|
|
20
|
+
agents(): Promise<Agent[]>;
|
|
21
|
+
/** Session handles for the currently authenticated host. */
|
|
22
|
+
sessions(): Promise<AgentSession[]>;
|
|
23
|
+
/** Construct a lazy pairing from its displayed code. */
|
|
24
|
+
pairing(code: string): HarnessPairing;
|
|
25
|
+
/** Start pairing a device; persist the secret separately from the handles. */
|
|
26
|
+
createPairing(options: CreatePairingRequest): Promise<{
|
|
27
|
+
pairing: HarnessPairing;
|
|
28
|
+
device: DevicePairing;
|
|
29
|
+
deviceSecret: string;
|
|
30
|
+
expiresAt: string;
|
|
31
|
+
pollIntervalSeconds: number;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PairingDetails } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import type { Team } from '../teams/team';
|
|
5
|
+
import { Harness } from './harness';
|
|
6
|
+
/** A short lived host pairing, addressed by its displayed code. */
|
|
7
|
+
export declare class HarnessPairing extends MacroEntity<PairingDetails> {
|
|
8
|
+
/** Construct a lazy pairing from a pairing code. */
|
|
9
|
+
static byId(client: MacroClient, code: string): HarnessPairing;
|
|
10
|
+
protected fetch(): Promise<PairingDetails>;
|
|
11
|
+
/** Requested name. */
|
|
12
|
+
readonly name: () => Promise<string>;
|
|
13
|
+
/** Expiration time. */
|
|
14
|
+
readonly expiresAt: () => Promise<string>;
|
|
15
|
+
/** Approve this pairing. */
|
|
16
|
+
approve(options?: {
|
|
17
|
+
name?: string;
|
|
18
|
+
team?: Team;
|
|
19
|
+
allowPermissionBypass?: boolean;
|
|
20
|
+
}): Promise<Harness>;
|
|
21
|
+
}
|
|
22
|
+
/** Device side pairing identity. Keep the device secret outside the handle. */
|
|
23
|
+
export declare class DevicePairing {
|
|
24
|
+
private readonly client;
|
|
25
|
+
/** Pairing identifier. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Construct the device side handle. */
|
|
29
|
+
static byId(client: MacroClient, id: string): DevicePairing;
|
|
30
|
+
/** Attempt to claim an approved pairing. Pending claims return undefined. */
|
|
31
|
+
claim(deviceSecret: string): Promise<{
|
|
32
|
+
harness: Harness;
|
|
33
|
+
token: string;
|
|
34
|
+
} | undefined>;
|
|
35
|
+
/** Serialize identity only. */
|
|
36
|
+
toJSON(): {
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CreateInitiativeRequest, InitiativeDetail } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { MacroEntity } from '../entity';
|
|
4
|
+
import { EntityAccess } from '../sharing/access';
|
|
5
|
+
import { type SharePermissionOptions } from '../sharing/permissions';
|
|
6
|
+
import { Task } from '../tasks/task';
|
|
7
|
+
import { User } from '../users/user';
|
|
8
|
+
/** Initiative creation settings. */
|
|
9
|
+
export interface InitiativeOptions {
|
|
10
|
+
/** Initiative name. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Collaborative description. */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** Members assigned to this initiative. */
|
|
15
|
+
members?: User[];
|
|
16
|
+
/** Initial properties. */
|
|
17
|
+
propertyValues?: CreateInitiativeRequest['propertyValues'];
|
|
18
|
+
/** Whether the current team can access it. */
|
|
19
|
+
shareWithTeam?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** A group of tasks and members working toward an outcome. */
|
|
22
|
+
export declare class Initiative extends MacroEntity<InitiativeDetail> {
|
|
23
|
+
/** Access requests and direct user grants. */
|
|
24
|
+
readonly access: EntityAccess;
|
|
25
|
+
/** Construct a lazy initiative handle. */
|
|
26
|
+
static byId(client: MacroClient, id: string): Initiative;
|
|
27
|
+
/** Seed from an initiative detail response. */
|
|
28
|
+
static from(client: MacroClient, record: InitiativeDetail): Initiative;
|
|
29
|
+
protected fetch(): Promise<InitiativeDetail>;
|
|
30
|
+
/** Display name. */
|
|
31
|
+
readonly name: () => Promise<string>;
|
|
32
|
+
/** Owner. */
|
|
33
|
+
readonly owner: () => Promise<User>;
|
|
34
|
+
/** Assigned members. */
|
|
35
|
+
readonly members: () => Promise<User[]>;
|
|
36
|
+
/** Tasks in this initiative. */
|
|
37
|
+
readonly tasks: () => Promise<Task[]>;
|
|
38
|
+
/** Current user's access. */
|
|
39
|
+
readonly accessLevel: () => Promise<import("../../../generated/storage").AccessLevel>;
|
|
40
|
+
/** Sharing configuration. */
|
|
41
|
+
readonly sharePermissions: () => Promise<import("../../../generated/storage").SharePermissionV2>;
|
|
42
|
+
/** Update the name, membership or sharing configuration. */
|
|
43
|
+
update(options: {
|
|
44
|
+
name?: string;
|
|
45
|
+
members?: User[];
|
|
46
|
+
sharePermission?: SharePermissionOptions;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
/** Delete this initiative. */
|
|
49
|
+
delete(): Promise<void>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MacroClient } from '../../utils/client';
|
|
2
|
+
import { Initiative, type InitiativeOptions } from './initiative';
|
|
3
|
+
/** Initiatives in the caller's workspace. */
|
|
4
|
+
export declare class InitiativeNamespace {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: MacroClient);
|
|
7
|
+
/** Construct a lazy initiative handle. */
|
|
8
|
+
byId(id: string): Initiative;
|
|
9
|
+
/** List accessible initiatives. */
|
|
10
|
+
list(): Promise<Initiative[]>;
|
|
11
|
+
/** Create an initiative. */
|
|
12
|
+
create(options: InitiativeOptions): Promise<Initiative>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Meeting as MeetingRecord, UpdateMeetingRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { CallRecord } from '../calls/call-record';
|
|
4
|
+
import { Channel } from '../channels/channel';
|
|
5
|
+
import { MacroEntity } from '../entity';
|
|
6
|
+
import type { User } from '../users/user';
|
|
7
|
+
/** A meeting's schedule and invitation link. */
|
|
8
|
+
export declare class Meeting extends MacroEntity<MeetingRecord> {
|
|
9
|
+
private lookupToken?;
|
|
10
|
+
private constructor();
|
|
11
|
+
/** Construct a lazy meeting handle. */
|
|
12
|
+
static byId(client: MacroClient, id: string): Meeting;
|
|
13
|
+
/** Seed a meeting from a server response. */
|
|
14
|
+
static from(client: MacroClient, record: MeetingRecord): Meeting;
|
|
15
|
+
protected fetch(): Promise<MeetingRecord>;
|
|
16
|
+
/** Display title. */
|
|
17
|
+
readonly title: () => Promise<string>;
|
|
18
|
+
/** Scheduled start. */
|
|
19
|
+
readonly scheduledStart: () => Promise<string | undefined>;
|
|
20
|
+
/** Scheduled end. */
|
|
21
|
+
readonly scheduledEnd: () => Promise<string | undefined>;
|
|
22
|
+
/** Associated channel. */
|
|
23
|
+
readonly channel: () => Promise<Channel | undefined>;
|
|
24
|
+
/** Associated call record. */
|
|
25
|
+
readonly call: () => Promise<CallRecord | undefined>;
|
|
26
|
+
/** Update schedule or title. */
|
|
27
|
+
update(options: UpdateMeetingRequest): Promise<void>;
|
|
28
|
+
/** Cancel this meeting. */
|
|
29
|
+
cancel(): Promise<void>;
|
|
30
|
+
/** Whether the caller can send invitations. */
|
|
31
|
+
invitePermissions(): Promise<import("../../../generated/storage").MeetingInvitePermissions>;
|
|
32
|
+
/** Invite an email address. */
|
|
33
|
+
invite(email: string): Promise<void>;
|
|
34
|
+
/** Invite Macro users. */
|
|
35
|
+
inviteUsers(users: User[]): Promise<void>;
|
|
36
|
+
/** Shareable meeting link. */
|
|
37
|
+
webUrl(): Promise<string>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CreateMeetingRequest } from '../../../generated/storage/types.gen';
|
|
2
|
+
import type { MacroClient } from '../../utils/client';
|
|
3
|
+
import { Meeting } from './meeting';
|
|
4
|
+
/** Meeting schedules and invitation lookup. */
|
|
5
|
+
export declare class MeetingNamespace {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: MacroClient);
|
|
8
|
+
/** Construct a handle to one of the caller's newest 100 standalone meetings. Use lookup for invitations. */
|
|
9
|
+
byId(id: string): Meeting;
|
|
10
|
+
/** Create a meeting. */
|
|
11
|
+
create(options: Omit<CreateMeetingRequest, 'preparationId'>): Promise<Meeting>;
|
|
12
|
+
/** List the caller's newest 100 standalone meetings. */
|
|
13
|
+
list(): Promise<Meeting[]>;
|
|
14
|
+
/** List active meetings. */
|
|
15
|
+
active(): Promise<Meeting[]>;
|
|
16
|
+
/** Resolve a meeting's invitation token. */
|
|
17
|
+
lookup(token: string): Promise<Meeting>;
|
|
18
|
+
}
|