@mitralab.io/sdk-core 0.1.0 → 0.2.0-beta.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/CHANGELOG.md +51 -0
- package/README.md +203 -11
- package/contracts/README.md +40 -11
- package/contracts/manifest.json +10 -1
- package/contracts/v0.2.0-beta.0/mcp-alpha-tools.json +1409 -0
- package/contracts/v0.2.0-beta.0/mcp-tool-parity.json +818 -0
- package/contracts/v0.2.0-beta.0/sdk-parity.json +2563 -0
- package/dist/index.cjs +3467 -192
- package/dist/index.d.cts +1660 -12
- package/dist/index.d.ts +1660 -12
- package/dist/index.js +3439 -191
- package/package.json +7 -4
package/dist/index.d.cts
CHANGED
|
@@ -12,8 +12,9 @@ declare class SdkCoreResponseError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
declare const defaultSdkCoreErrorFactory: SdkCoreErrorFactory;
|
|
14
14
|
|
|
15
|
-
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
16
|
-
type
|
|
15
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
16
|
+
type QueryParamPrimitive = string | number | boolean;
|
|
17
|
+
type QueryParamValue = QueryParamPrimitive | readonly QueryParamPrimitive[] | undefined;
|
|
17
18
|
interface TransportRequestOptions {
|
|
18
19
|
method?: HttpMethod;
|
|
19
20
|
body?: unknown;
|
|
@@ -24,17 +25,24 @@ interface Transport {
|
|
|
24
25
|
request<T>(path: string, options?: TransportRequestOptions): Promise<T>;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
interface
|
|
28
|
+
interface PlanPrice {
|
|
29
|
+
currency: string;
|
|
30
|
+
amountMinorUnits: number;
|
|
31
|
+
interval: string;
|
|
32
|
+
}
|
|
33
|
+
interface UserPlan {
|
|
28
34
|
id: string;
|
|
35
|
+
code: string;
|
|
29
36
|
name: string;
|
|
30
|
-
|
|
37
|
+
maxUsers: number;
|
|
38
|
+
prices: PlanPrice[];
|
|
31
39
|
}
|
|
32
40
|
interface Tenant {
|
|
33
41
|
id: string;
|
|
34
42
|
shortId: string;
|
|
35
43
|
legacyId: number | null;
|
|
36
44
|
slug: string;
|
|
37
|
-
|
|
45
|
+
clusterType: "SHARED" | "DEDICATED";
|
|
38
46
|
name: string;
|
|
39
47
|
description: string | null;
|
|
40
48
|
hexColor: string | null;
|
|
@@ -49,7 +57,11 @@ interface User {
|
|
|
49
57
|
name: string;
|
|
50
58
|
email: string;
|
|
51
59
|
imageUrl: string | null;
|
|
60
|
+
/** Plan selected for the authenticated user in the current tenant. */
|
|
61
|
+
planId: string;
|
|
52
62
|
onboardingCompleted: boolean;
|
|
63
|
+
/** User language preference returned by IAM. */
|
|
64
|
+
language: string;
|
|
53
65
|
}
|
|
54
66
|
interface EntityListOptions {
|
|
55
67
|
sort?: string;
|
|
@@ -58,8 +70,8 @@ interface EntityListOptions {
|
|
|
58
70
|
fields?: string[];
|
|
59
71
|
}
|
|
60
72
|
interface EntityTable<T = Record<string, unknown>> {
|
|
61
|
-
list(sortOrOptions?: string | EntityListOptions, limit?: number, skip?: number, fields?: string[]): Promise<T
|
|
62
|
-
filter(query: Record<string, unknown>, sort?: string, limit?: number, skip?: number, fields?: string[]): Promise<T
|
|
73
|
+
list(sortOrOptions?: string | EntityListOptions, limit?: number, skip?: number, fields?: string[]): Promise<EntityListResponse<T>>;
|
|
74
|
+
filter(query: Record<string, unknown>, sort?: string, limit?: number, skip?: number, fields?: string[]): Promise<EntityListResponse<T>>;
|
|
63
75
|
get(id: string | number): Promise<T>;
|
|
64
76
|
create(data: Partial<T>): Promise<T>;
|
|
65
77
|
bulkCreate(data: Partial<T>[]): Promise<T[]>;
|
|
@@ -69,11 +81,26 @@ interface EntityTable<T = Record<string, unknown>> {
|
|
|
69
81
|
deleted: number;
|
|
70
82
|
}>;
|
|
71
83
|
}
|
|
84
|
+
interface EntityListResponse<T> {
|
|
85
|
+
/** Records in the requested window. */
|
|
86
|
+
data: T[];
|
|
87
|
+
/** Effective maximum number of records returned. */
|
|
88
|
+
limit: number;
|
|
89
|
+
/** Effective number of records skipped. */
|
|
90
|
+
skip: number;
|
|
91
|
+
/** Total records matching the request. */
|
|
92
|
+
total: number;
|
|
93
|
+
/** Whether another window is available after this one. */
|
|
94
|
+
hasMore: boolean;
|
|
95
|
+
}
|
|
72
96
|
interface QueryResult {
|
|
73
97
|
rows: Record<string, unknown>[];
|
|
74
98
|
affectedRows?: number | null;
|
|
75
99
|
durationMs: number;
|
|
76
100
|
}
|
|
101
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
102
|
+
[key: string]: JsonValue;
|
|
103
|
+
};
|
|
77
104
|
interface FunctionExecution {
|
|
78
105
|
id: string;
|
|
79
106
|
functionId: string;
|
|
@@ -86,7 +113,7 @@ interface FunctionExecution {
|
|
|
86
113
|
durationMs: number | null;
|
|
87
114
|
startedAt: string | null;
|
|
88
115
|
finishedAt: string | null;
|
|
89
|
-
createdAt: string;
|
|
116
|
+
createdAt: string | null;
|
|
90
117
|
}
|
|
91
118
|
interface ProxyInput {
|
|
92
119
|
method: string;
|
|
@@ -102,12 +129,1337 @@ interface ProxyResult {
|
|
|
102
129
|
durationMs: number;
|
|
103
130
|
executionId: string;
|
|
104
131
|
}
|
|
132
|
+
interface DdlStatement {
|
|
133
|
+
/** One DDL command. Batch execution is ordered and stops after the first failure. */
|
|
134
|
+
sql: string;
|
|
135
|
+
}
|
|
136
|
+
interface DmlStatement {
|
|
137
|
+
/** One DML command using named parameters instead of interpolated values. */
|
|
138
|
+
sql: string;
|
|
139
|
+
/** Values bound by the database driver. Defaults to an empty object. */
|
|
140
|
+
parameters?: Record<string, unknown>;
|
|
141
|
+
}
|
|
142
|
+
interface BatchStatementResult {
|
|
143
|
+
index: number;
|
|
144
|
+
/** Reported for DML statements only. The DDL path omits the field entirely. */
|
|
145
|
+
affectedRows?: number;
|
|
146
|
+
durationMs: number;
|
|
147
|
+
}
|
|
148
|
+
interface BatchExecution {
|
|
149
|
+
results: BatchStatementResult[];
|
|
150
|
+
executedCount: number;
|
|
151
|
+
totalDurationMs: number;
|
|
152
|
+
}
|
|
153
|
+
type SchemaScope = "APP" | "SHARED";
|
|
154
|
+
interface ListTablesOptions {
|
|
155
|
+
/** APP, SHARED, or omission for both scopes. */
|
|
156
|
+
scope?: SchemaScope;
|
|
157
|
+
/** Includes column and foreign-key metadata. Defaults to false. */
|
|
158
|
+
includeColumns?: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface TableColumn {
|
|
161
|
+
name: string;
|
|
162
|
+
type: string;
|
|
163
|
+
primaryKey: boolean;
|
|
164
|
+
nullable: boolean;
|
|
165
|
+
defaultValue: string | null;
|
|
166
|
+
}
|
|
167
|
+
interface TableForeignKey {
|
|
168
|
+
columns: string[];
|
|
169
|
+
referencedTable: string;
|
|
170
|
+
referencedColumns: string[];
|
|
171
|
+
}
|
|
172
|
+
interface TableDefinition {
|
|
173
|
+
tableName: string;
|
|
174
|
+
columns: TableColumn[];
|
|
175
|
+
foreignKeys: TableForeignKey[];
|
|
176
|
+
}
|
|
177
|
+
interface SchemaTables {
|
|
178
|
+
schema: string;
|
|
179
|
+
tables: TableDefinition[];
|
|
180
|
+
}
|
|
181
|
+
/** Core authoring APIs create and mutate EXTERNAL Data Sources only. */
|
|
182
|
+
type DataSourceInstanceType = "MITRA_SHARED" | "MITRA_DEDICATED" | "EXTERNAL";
|
|
183
|
+
type DataSourceDbType = "POSTGRES" | "MYSQL" | "SQLSERVER" | "ORACLE";
|
|
184
|
+
interface ConnectionConfig {
|
|
185
|
+
host: string;
|
|
186
|
+
port: number;
|
|
187
|
+
schema?: string;
|
|
188
|
+
databaseName: string;
|
|
189
|
+
username: string;
|
|
190
|
+
/** Write-only. The service never returns it, and an update that omits it keeps the stored one. */
|
|
191
|
+
credential?: string;
|
|
192
|
+
/** Maximum pool size. Defaults to 10. */
|
|
193
|
+
maxPoolSize?: number;
|
|
194
|
+
/** Connection acquisition timeout in milliseconds. Defaults to 30000. */
|
|
195
|
+
connectionTimeoutMs?: number;
|
|
196
|
+
/** Idle connection timeout in milliseconds. Defaults to 600000. */
|
|
197
|
+
idleTimeoutMs?: number;
|
|
198
|
+
/** Minimum idle connections. Defaults to 2. */
|
|
199
|
+
minimumIdle?: number;
|
|
200
|
+
/** Maximum connection lifetime in milliseconds. Defaults to 1800000. */
|
|
201
|
+
maxLifetimeMs?: number;
|
|
202
|
+
additionalParams?: Record<string, string>;
|
|
203
|
+
}
|
|
204
|
+
interface DataSourceCreateInput {
|
|
205
|
+
legacyId?: number;
|
|
206
|
+
name: string;
|
|
207
|
+
instanceType: DataSourceInstanceType;
|
|
208
|
+
dbType: DataSourceDbType;
|
|
209
|
+
writeConnectionConfig: ConnectionConfig;
|
|
210
|
+
readConnectionConfig?: ConnectionConfig;
|
|
211
|
+
}
|
|
212
|
+
interface DataSourceUpdateInput {
|
|
213
|
+
dataSourceId: string;
|
|
214
|
+
name: string;
|
|
215
|
+
instanceType: DataSourceInstanceType;
|
|
216
|
+
dbType: DataSourceDbType;
|
|
217
|
+
writeConnectionConfig: ConnectionConfig;
|
|
218
|
+
readConnectionConfig?: ConnectionConfig;
|
|
219
|
+
}
|
|
220
|
+
interface DataSourceBulkItemResult {
|
|
221
|
+
index: number;
|
|
222
|
+
success: boolean;
|
|
223
|
+
dataSourceId: string | null;
|
|
224
|
+
errorCode: string | null;
|
|
225
|
+
message: string | null;
|
|
226
|
+
}
|
|
227
|
+
interface DataSourceBulkResult {
|
|
228
|
+
results: DataSourceBulkItemResult[];
|
|
229
|
+
processedCount: number;
|
|
230
|
+
succeededCount: number;
|
|
231
|
+
failedCount: number;
|
|
232
|
+
}
|
|
233
|
+
interface DataSourceDefinition {
|
|
234
|
+
id: string;
|
|
235
|
+
/** Legacy identifier when the Data Source was migrated from the previous platform. */
|
|
236
|
+
legacyId: number | null;
|
|
237
|
+
/** Owning app, or null for a tenant-level Data Source. */
|
|
238
|
+
appId: string | null;
|
|
239
|
+
name: string;
|
|
240
|
+
instanceType: DataSourceInstanceType;
|
|
241
|
+
dbType: DataSourceDbType;
|
|
242
|
+
/** Write connection metadata. Stored credentials are always returned as null. */
|
|
243
|
+
writeConnectionConfig: ConnectionConfigResponse;
|
|
244
|
+
/** Read connection metadata when a separate read connection is configured. */
|
|
245
|
+
readConnectionConfig: ConnectionConfigResponse | null;
|
|
246
|
+
/** Result of the most recent connection check. */
|
|
247
|
+
connectionStatus: "CONNECTED" | "ERROR" | null;
|
|
248
|
+
lastCheckedAt: string | null;
|
|
249
|
+
/** Latest measured storage usage, or null when no measurement exists. */
|
|
250
|
+
storageQuota: {
|
|
251
|
+
status: "NORMAL" | "WATCH" | "BLOCKED" | null;
|
|
252
|
+
usedBytes: number | null;
|
|
253
|
+
limitBytes: number | null;
|
|
254
|
+
measuredAt: string | null;
|
|
255
|
+
measurementVersion: number | null;
|
|
256
|
+
} | null;
|
|
257
|
+
}
|
|
258
|
+
interface ConnectionConfigResponse {
|
|
259
|
+
host: string | null;
|
|
260
|
+
port: number | null;
|
|
261
|
+
schema: string | null;
|
|
262
|
+
databaseName: string | null;
|
|
263
|
+
username: string | null;
|
|
264
|
+
/** Write-only in requests. Producer responses serialize it as null. */
|
|
265
|
+
credential: null;
|
|
266
|
+
maxPoolSize: number | null;
|
|
267
|
+
connectionTimeoutMs: number | null;
|
|
268
|
+
idleTimeoutMs: number | null;
|
|
269
|
+
minimumIdle: number | null;
|
|
270
|
+
maxLifetimeMs: number | null;
|
|
271
|
+
additionalParams: Record<string, string> | null;
|
|
272
|
+
}
|
|
273
|
+
type FunctionRuntime = "JAVASCRIPT" | "PYTHON" | "SQL" | "API";
|
|
274
|
+
/**
|
|
275
|
+
* Creates a Function and optionally composes its schedule in the same operation.
|
|
276
|
+
*
|
|
277
|
+
* `cronExpression`, `cronInputJson`, and `cronEnabled` are one scheduling unit. Omit all three to
|
|
278
|
+
* create no schedule. Supplying any one requires a non-blank `cronExpression`; the new schedule is
|
|
279
|
+
* evaluated in UTC and starts enabled unless `cronEnabled` is false.
|
|
280
|
+
*/
|
|
281
|
+
interface FunctionCreateInput {
|
|
282
|
+
legacyId?: number;
|
|
283
|
+
name: string;
|
|
284
|
+
description?: string;
|
|
285
|
+
runtime: FunctionRuntime;
|
|
286
|
+
/** Required for the SQL runtime and rejected for every other runtime. */
|
|
287
|
+
dataSourceId?: string;
|
|
288
|
+
code: string;
|
|
289
|
+
inputSchema?: Record<string, unknown>;
|
|
290
|
+
outputSchema?: Record<string, unknown>;
|
|
291
|
+
secrets?: string[];
|
|
292
|
+
/** Optional six-field schedule expression including seconds. */
|
|
293
|
+
cronExpression?: string;
|
|
294
|
+
/** Input supplied to scheduled executions. Requires `cronExpression` on create. */
|
|
295
|
+
cronInputJson?: Record<string, JsonValue>;
|
|
296
|
+
/** Initial schedule state. Defaults to true and requires `cronExpression` on create. */
|
|
297
|
+
cronEnabled?: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface FunctionUpdateInput {
|
|
300
|
+
name: string;
|
|
301
|
+
description?: string;
|
|
302
|
+
code: string;
|
|
303
|
+
inputSchema?: Record<string, unknown>;
|
|
304
|
+
outputSchema?: Record<string, unknown>;
|
|
305
|
+
secrets?: string[];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Partial Function update used by PATCH endpoints.
|
|
309
|
+
*
|
|
310
|
+
* Omitted and null fields preserve the stored value. Empty strings, objects, and arrays are sent
|
|
311
|
+
* as explicit replacements when the service accepts them.
|
|
312
|
+
*
|
|
313
|
+
* `cronExpression`, `cronInputJson`, and `cronEnabled` are one composed scheduling unit. A blank
|
|
314
|
+
* expression removes the schedule. A non-blank expression creates a missing schedule in UTC;
|
|
315
|
+
* otherwise patching a missing schedule fails. An empty input object clears the scheduled input,
|
|
316
|
+
* and `cronEnabled` explicitly pauses or resumes the schedule.
|
|
317
|
+
*/
|
|
318
|
+
interface FunctionPatchInput {
|
|
319
|
+
/** New name, 3 to 255 characters. */
|
|
320
|
+
name?: string | null;
|
|
321
|
+
/** New description, at most 1000 characters. */
|
|
322
|
+
description?: string | null;
|
|
323
|
+
/** New non-blank source code. */
|
|
324
|
+
code?: string | null;
|
|
325
|
+
/** Complete replacement input schema. */
|
|
326
|
+
inputSchema?: Record<string, unknown> | null;
|
|
327
|
+
/** Complete replacement output schema. */
|
|
328
|
+
outputSchema?: Record<string, unknown> | null;
|
|
329
|
+
/** Complete replacement secret-name list. */
|
|
330
|
+
secrets?: string[] | null;
|
|
331
|
+
/** Six-field schedule expression. Blank removes the schedule; null or omission preserves it. */
|
|
332
|
+
cronExpression?: string | null;
|
|
333
|
+
/** Complete scheduled-input replacement. Null or omission preserves it; an empty object clears it. */
|
|
334
|
+
cronInputJson?: Record<string, JsonValue> | null;
|
|
335
|
+
/** Enables or pauses the schedule. Null or omission preserves its state. */
|
|
336
|
+
cronEnabled?: boolean | null;
|
|
337
|
+
}
|
|
338
|
+
/** Bulk create does not compose schedule changes; use the single-Function create endpoint. */
|
|
339
|
+
type FunctionBulkCreateInput = Omit<FunctionCreateInput, "cronExpression" | "cronInputJson" | "cronEnabled">;
|
|
340
|
+
/** Bulk patch does not compose schedule changes; use the single-Function patch endpoint. */
|
|
341
|
+
type FunctionBulkPatchInput = Omit<FunctionPatchInput, "cronExpression" | "cronInputJson" | "cronEnabled">;
|
|
342
|
+
interface FunctionBulkUpdateItem {
|
|
343
|
+
id: string;
|
|
344
|
+
update: FunctionUpdateInput;
|
|
345
|
+
}
|
|
346
|
+
interface FunctionBulkPatchItem {
|
|
347
|
+
id: string;
|
|
348
|
+
update: FunctionBulkPatchInput;
|
|
349
|
+
}
|
|
350
|
+
type FunctionBulkDeleteInput = {
|
|
351
|
+
ids: string[];
|
|
352
|
+
allInApp?: undefined;
|
|
353
|
+
} | {
|
|
354
|
+
allInApp: true;
|
|
355
|
+
ids?: undefined;
|
|
356
|
+
};
|
|
357
|
+
interface FunctionBulkDeleteResult {
|
|
358
|
+
deleted: string[];
|
|
359
|
+
notFound: string[];
|
|
360
|
+
deletedCount: number;
|
|
361
|
+
}
|
|
362
|
+
interface FunctionVersion {
|
|
363
|
+
id: string;
|
|
364
|
+
functionId: string;
|
|
365
|
+
status: string;
|
|
366
|
+
code: string;
|
|
367
|
+
inputSchema: Record<string, unknown> | null;
|
|
368
|
+
outputSchema: Record<string, unknown> | null;
|
|
369
|
+
secrets: string[] | null;
|
|
370
|
+
createdAt: string;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Complete Function detail. On Function get responses, the three cron fields are populated only
|
|
374
|
+
* with `SCHEDULE_READ`; all three are also null when no schedule exists.
|
|
375
|
+
*/
|
|
376
|
+
interface FunctionDefinition {
|
|
377
|
+
id: string;
|
|
378
|
+
tenantId: string;
|
|
379
|
+
appId: string | null;
|
|
380
|
+
legacyId: number | null;
|
|
381
|
+
name: string;
|
|
382
|
+
description: string | null;
|
|
383
|
+
runtime: string;
|
|
384
|
+
dataSourceId: string | null;
|
|
385
|
+
visibility: string;
|
|
386
|
+
currentVersion: FunctionVersion | null;
|
|
387
|
+
cronExpression: string | null;
|
|
388
|
+
cronInputJson: Record<string, JsonValue> | null;
|
|
389
|
+
cronEnabled: boolean | null;
|
|
390
|
+
createdAt: string | null;
|
|
391
|
+
updatedAt: string;
|
|
392
|
+
}
|
|
393
|
+
interface TemplateConfigCreateInput {
|
|
394
|
+
/** Integration template UUID. */
|
|
395
|
+
templateId: string;
|
|
396
|
+
/** App-unique alias used by proxy execution. */
|
|
397
|
+
alias: string;
|
|
398
|
+
legacyId?: number;
|
|
399
|
+
/** Complete credential and configuration map. Values are write-only. */
|
|
400
|
+
values: Record<string, JsonValue>;
|
|
401
|
+
}
|
|
402
|
+
interface TemplateConfigUpdateInput {
|
|
403
|
+
configId: string;
|
|
404
|
+
alias: string;
|
|
405
|
+
/** Omitting it keeps the stored configuration. Sending it replaces the whole map. */
|
|
406
|
+
values?: Record<string, JsonValue>;
|
|
407
|
+
}
|
|
408
|
+
interface TemplateConfigBulkItemResult {
|
|
409
|
+
index: number;
|
|
410
|
+
success: boolean;
|
|
411
|
+
configId: string | null;
|
|
412
|
+
errorCode: string | null;
|
|
413
|
+
message: string | null;
|
|
414
|
+
}
|
|
415
|
+
interface TemplateConfigBulkResult {
|
|
416
|
+
results: TemplateConfigBulkItemResult[];
|
|
417
|
+
processedCount: number;
|
|
418
|
+
succeededCount: number;
|
|
419
|
+
failedCount: number;
|
|
420
|
+
}
|
|
421
|
+
interface TemplateConfigSummary {
|
|
422
|
+
id: string;
|
|
423
|
+
appId: string | null;
|
|
424
|
+
legacyId: number | null;
|
|
425
|
+
templateId: string;
|
|
426
|
+
alias: string;
|
|
427
|
+
status: IntegrationConnectionStatus | null;
|
|
428
|
+
lastCheckedAt: string | null;
|
|
429
|
+
}
|
|
430
|
+
interface TemplateConfig extends TemplateConfigSummary {
|
|
431
|
+
tenantId: string;
|
|
432
|
+
config: Record<string, JsonValue>;
|
|
433
|
+
lastCheckMessage: string | null;
|
|
434
|
+
createdAt: string;
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
type TemplateConfigPage = LegacyPage<TemplateConfigSummary>;
|
|
438
|
+
interface ListTemplateConfigsOptions {
|
|
439
|
+
page?: number;
|
|
440
|
+
size?: number;
|
|
441
|
+
sort?: string;
|
|
442
|
+
}
|
|
443
|
+
interface TestCredentialsInput {
|
|
444
|
+
templateId: string;
|
|
445
|
+
values: Record<string, JsonValue>;
|
|
446
|
+
}
|
|
447
|
+
interface ConnectionTestResult {
|
|
448
|
+
status: IntegrationConnectionStatus;
|
|
449
|
+
durationMs: number;
|
|
450
|
+
checkedAt: string;
|
|
451
|
+
message: string | null;
|
|
452
|
+
}
|
|
453
|
+
interface AppMember {
|
|
454
|
+
userId: string;
|
|
455
|
+
name: string;
|
|
456
|
+
email: string;
|
|
457
|
+
accessLevel: string;
|
|
458
|
+
accessSource: string;
|
|
459
|
+
}
|
|
460
|
+
interface InviteAppUserInput {
|
|
461
|
+
/** Email receiving app access. */
|
|
462
|
+
email: string;
|
|
463
|
+
/** Display name used only if a new Mitra identity must be created. */
|
|
464
|
+
name?: string;
|
|
465
|
+
}
|
|
466
|
+
interface BulkUnsubscribeResult {
|
|
467
|
+
revoked: string[];
|
|
468
|
+
notFound: string[];
|
|
469
|
+
revokedCount: number;
|
|
470
|
+
}
|
|
471
|
+
/** Stable Spring page returned by services using VIA_DTO serialization. */
|
|
472
|
+
interface Page<T> {
|
|
473
|
+
content: T[];
|
|
474
|
+
/** Pagination metadata nested by Spring's stable DTO representation. */
|
|
475
|
+
page: {
|
|
476
|
+
size: number;
|
|
477
|
+
totalElements: number;
|
|
478
|
+
totalPages: number;
|
|
479
|
+
number: number;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
/** Legacy Spring PageImpl shape still returned by mitra-integration. */
|
|
483
|
+
interface LegacyPage<T> {
|
|
484
|
+
content: T[];
|
|
485
|
+
totalElements: number;
|
|
486
|
+
totalPages?: number;
|
|
487
|
+
size?: number;
|
|
488
|
+
number?: number;
|
|
489
|
+
[key: string]: unknown;
|
|
490
|
+
}
|
|
491
|
+
/** Common zero-based pagination accepted by builder list methods. */
|
|
492
|
+
interface PageOptions {
|
|
493
|
+
/** Zero-based page number. Defaults to 0 in the service. */
|
|
494
|
+
page?: number;
|
|
495
|
+
/** Items per page. Service defaults vary by resource; the maximum is 100 unless documented. */
|
|
496
|
+
size?: number;
|
|
497
|
+
/** Spring sort expression, for example `createdAt,desc`. */
|
|
498
|
+
sort?: string;
|
|
499
|
+
}
|
|
500
|
+
type AppColor = {
|
|
501
|
+
type: "SOLID";
|
|
502
|
+
hex: string;
|
|
503
|
+
} | {
|
|
504
|
+
type: "GRADIENT";
|
|
505
|
+
startHex: string;
|
|
506
|
+
endHex: string;
|
|
507
|
+
};
|
|
508
|
+
type AppVersionStatus = "DRAFT" | "PUBLISHED";
|
|
509
|
+
interface AppListOptions extends PageOptions {
|
|
510
|
+
/** Optional case-insensitive app name search. Blank values are ignored by the service. */
|
|
511
|
+
search?: string;
|
|
512
|
+
/** Filters apps by the status of their current version. */
|
|
513
|
+
version?: AppVersionStatus;
|
|
514
|
+
/** Filters apps by their lowercase brand identifier. Blank values are ignored. */
|
|
515
|
+
brand?: string;
|
|
516
|
+
}
|
|
517
|
+
interface AppGetOptions {
|
|
518
|
+
/** Returns the selected DRAFT or PUBLISHED version instead of the default current version. */
|
|
519
|
+
version?: AppVersionStatus;
|
|
520
|
+
}
|
|
521
|
+
interface AppPublishOptions {
|
|
522
|
+
/** Updates external access as part of the publish request when supplied. */
|
|
523
|
+
externalAccess?: boolean;
|
|
524
|
+
}
|
|
525
|
+
interface AppCreateInput {
|
|
526
|
+
/** Optional positive identifier preserved while migrating a legacy app. */
|
|
527
|
+
legacyId?: number;
|
|
528
|
+
/** App name, at most 100 characters. */
|
|
529
|
+
name: string;
|
|
530
|
+
/** Optional context shown to builders and coding agents. */
|
|
531
|
+
description?: string;
|
|
532
|
+
/** Solid or gradient presentation color. Defaults to solid `#7839EE`. */
|
|
533
|
+
color?: AppColor;
|
|
534
|
+
/** Optional icon identifier, at most 50 characters. Blank values are stored as null. */
|
|
535
|
+
icon?: string;
|
|
536
|
+
/** Optional data source UUID bound to the app. */
|
|
537
|
+
dataSourceId?: string;
|
|
538
|
+
/** Optional IAM app plan UUID. */
|
|
539
|
+
planId?: string;
|
|
540
|
+
/** Initial file template. Defaults to `react-vite-shadcn`. */
|
|
541
|
+
template?: string;
|
|
542
|
+
/** Optional vanity subdomain, 3 to 51 lowercase alphanumeric or hyphen characters. */
|
|
543
|
+
subdomain?: string;
|
|
544
|
+
/** Optional lowercase brand identifier, at most 32 characters. */
|
|
545
|
+
brand?: string;
|
|
546
|
+
/** Whether users may sign up through this app. Defaults to true. */
|
|
547
|
+
allowSignup?: boolean;
|
|
548
|
+
}
|
|
549
|
+
interface AppUpdateInput {
|
|
550
|
+
/** New name, at most 100 characters. Omission preserves the current value. */
|
|
551
|
+
name?: string;
|
|
552
|
+
/** New description, at most 1000 characters. Omission preserves the current value. */
|
|
553
|
+
description?: string;
|
|
554
|
+
/** New solid or gradient color. Omission preserves the current value. */
|
|
555
|
+
color?: AppColor;
|
|
556
|
+
/** New icon identifier, at most 50 characters. Omission preserves the current value. */
|
|
557
|
+
icon?: string;
|
|
558
|
+
/** Whether users may sign up through this app. Omission preserves the current value. */
|
|
559
|
+
allowSignup?: boolean;
|
|
560
|
+
}
|
|
561
|
+
interface AppDomain {
|
|
562
|
+
hostname: string;
|
|
563
|
+
kind: "PLATFORM" | "CUSTOM";
|
|
564
|
+
status: "ACTIVE" | "PENDING" | "INACTIVE";
|
|
565
|
+
}
|
|
566
|
+
interface AppSummary {
|
|
567
|
+
id: string;
|
|
568
|
+
tenantId: string;
|
|
569
|
+
shortId: string;
|
|
570
|
+
subdomain: string;
|
|
571
|
+
brand: string;
|
|
572
|
+
domains: AppDomain[];
|
|
573
|
+
legacyId: number | null;
|
|
574
|
+
name: string;
|
|
575
|
+
description: string | null;
|
|
576
|
+
color: AppColor;
|
|
577
|
+
icon: string | null;
|
|
578
|
+
template: string | null;
|
|
579
|
+
planId: string;
|
|
580
|
+
allowSignup: boolean;
|
|
581
|
+
externalAccessEnabled: boolean;
|
|
582
|
+
currentVersion: AppVersion | null;
|
|
583
|
+
createdAt: string;
|
|
584
|
+
updatedAt: string;
|
|
585
|
+
}
|
|
586
|
+
interface AppDefinition {
|
|
587
|
+
id: string;
|
|
588
|
+
shortId: string;
|
|
589
|
+
subdomain: string;
|
|
590
|
+
brand: string;
|
|
591
|
+
domains: AppDomain[];
|
|
592
|
+
legacyId: number | null;
|
|
593
|
+
name: string;
|
|
594
|
+
description: string | null;
|
|
595
|
+
color: AppColor;
|
|
596
|
+
icon: string | null;
|
|
597
|
+
dataSourceId: string | null;
|
|
598
|
+
planId: string;
|
|
599
|
+
template: string | null;
|
|
600
|
+
allowSignup: boolean;
|
|
601
|
+
externalAccessEnabled: boolean;
|
|
602
|
+
currentVersion: AppVersion | null;
|
|
603
|
+
createdAt: string;
|
|
604
|
+
updatedAt: string;
|
|
605
|
+
}
|
|
606
|
+
interface AppFiles {
|
|
607
|
+
files: Record<string, string>;
|
|
608
|
+
[key: string]: unknown;
|
|
609
|
+
}
|
|
610
|
+
interface AppDeploy {
|
|
611
|
+
id: string;
|
|
612
|
+
appId: string;
|
|
613
|
+
appVersionId: string;
|
|
614
|
+
status: "PENDING" | "BUILDING" | "DEPLOYED" | "FAILED" | "CANCELLED";
|
|
615
|
+
deployUrl: string | null;
|
|
616
|
+
errorMessage: string | null;
|
|
617
|
+
logs: string | null;
|
|
618
|
+
durationMs: number | null;
|
|
619
|
+
startedAt: string | null;
|
|
620
|
+
finishedAt: string | null;
|
|
621
|
+
createdAt: string;
|
|
622
|
+
}
|
|
623
|
+
interface AppVersion {
|
|
624
|
+
id: string;
|
|
625
|
+
appId: string;
|
|
626
|
+
status: AppVersionStatus;
|
|
627
|
+
currentDeploy: AppDeploy | null;
|
|
628
|
+
createdAt: string;
|
|
629
|
+
}
|
|
630
|
+
interface PublicFunctionResult {
|
|
631
|
+
success: boolean;
|
|
632
|
+
output: Record<string, unknown> | null;
|
|
633
|
+
error: string | null;
|
|
634
|
+
}
|
|
635
|
+
interface PublicFunctionAsyncResult {
|
|
636
|
+
id: string;
|
|
637
|
+
status: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Function list item. The three cron fields are populated only with `SCHEDULE_READ`; all three are
|
|
641
|
+
* also null when no schedule exists.
|
|
642
|
+
*/
|
|
643
|
+
interface FunctionSummary {
|
|
644
|
+
id: string;
|
|
645
|
+
tenantId: string;
|
|
646
|
+
appId: string | null;
|
|
647
|
+
legacyId: number | null;
|
|
648
|
+
name: string;
|
|
649
|
+
description: string | null;
|
|
650
|
+
runtime: string;
|
|
651
|
+
dataSourceId: string | null;
|
|
652
|
+
visibility: string;
|
|
653
|
+
cronExpression: string | null;
|
|
654
|
+
cronInputJson: Record<string, JsonValue> | null;
|
|
655
|
+
cronEnabled: boolean | null;
|
|
656
|
+
createdAt: string;
|
|
657
|
+
updatedAt: string;
|
|
658
|
+
}
|
|
659
|
+
interface FunctionListOptions extends PageOptions {
|
|
660
|
+
/** Optional case-insensitive name search. Blank values are ignored by the service. */
|
|
661
|
+
search?: string;
|
|
662
|
+
}
|
|
663
|
+
type FunctionVersionListOptions = PageOptions;
|
|
664
|
+
type FunctionVisibility = "PRIVATE" | "PUBLIC";
|
|
665
|
+
interface FunctionSecrets {
|
|
666
|
+
secrets: string[];
|
|
667
|
+
}
|
|
668
|
+
interface ColumnInput {
|
|
669
|
+
/** Column name in snake_case. */
|
|
670
|
+
name: string;
|
|
671
|
+
/** STRING, TEXT, INTEGER, DECIMAL, BOOLEAN, TIMESTAMP, UUID, or AUTO_INCREMENT. */
|
|
672
|
+
type: string;
|
|
673
|
+
/** Whether this column is the primary key. Defaults to false. */
|
|
674
|
+
primaryKey?: boolean;
|
|
675
|
+
/** Whether null values are accepted. Defaults to false. */
|
|
676
|
+
nullable?: boolean;
|
|
677
|
+
/** Optional database default expression or value. */
|
|
678
|
+
defaultValue?: string;
|
|
679
|
+
}
|
|
680
|
+
interface CustomQueryInput {
|
|
681
|
+
/** Unique lowercase name; underscores are accepted. */
|
|
682
|
+
name: string;
|
|
683
|
+
/** SELECT statement saved by the Data Manager. */
|
|
684
|
+
sql: string;
|
|
685
|
+
/** Whether the query is exposed as a Virtual Table. Defaults to false. */
|
|
686
|
+
isVirtualTable?: boolean;
|
|
687
|
+
/** Optional external connection for a Virtual Table. Omit for the app managed database. */
|
|
688
|
+
connectionId?: string;
|
|
689
|
+
}
|
|
690
|
+
interface CustomQueryUpdateInput {
|
|
691
|
+
name: string;
|
|
692
|
+
sql: string;
|
|
693
|
+
/** Defaults to false when omitted by the Data Manager producer. */
|
|
694
|
+
isVirtualTable?: boolean;
|
|
695
|
+
connectionId?: string;
|
|
696
|
+
}
|
|
697
|
+
interface CustomQuerySummary {
|
|
698
|
+
id: string;
|
|
699
|
+
name: string;
|
|
700
|
+
isVirtualTable: boolean;
|
|
701
|
+
connectionId: string | null;
|
|
702
|
+
createdAt: string | null;
|
|
703
|
+
updatedAt: string;
|
|
704
|
+
}
|
|
705
|
+
interface CustomQueryDefinition extends CustomQuerySummary {
|
|
706
|
+
sql: string;
|
|
707
|
+
}
|
|
708
|
+
type ImportSource = {
|
|
709
|
+
type: "SQL";
|
|
710
|
+
/** SELECT query executed against the current app's managed Data Source. */
|
|
711
|
+
query: string;
|
|
712
|
+
} | {
|
|
713
|
+
type: "CSV";
|
|
714
|
+
/** File key returned by the upload endpoint. */
|
|
715
|
+
fileKey: string;
|
|
716
|
+
/** CSV separator. Defaults to comma. */
|
|
717
|
+
separator?: string;
|
|
718
|
+
};
|
|
719
|
+
interface ImportTarget {
|
|
720
|
+
/** Target table name in the current app's managed Data Source, at most 255 characters. */
|
|
721
|
+
tableName: string;
|
|
722
|
+
/** REPLACE truncates first, APPEND inserts, and UPSERT inserts or updates. */
|
|
723
|
+
mode: "REPLACE" | "APPEND" | "UPSERT";
|
|
724
|
+
/** Columns used to match existing rows in UPSERT mode. */
|
|
725
|
+
upsertKeyColumns?: string[];
|
|
726
|
+
}
|
|
727
|
+
interface ImportProcessing {
|
|
728
|
+
/** CHUNKED is parallel and default; STREAMING uses one worker. */
|
|
729
|
+
mode?: "CHUNKED" | "STREAMING";
|
|
730
|
+
/** Column used to order and split CHUNKED work. */
|
|
731
|
+
orderColumn?: string;
|
|
732
|
+
/** Rows per chunk. Defaults to 10000. */
|
|
733
|
+
chunkSize?: number;
|
|
734
|
+
}
|
|
735
|
+
interface ImportInput {
|
|
736
|
+
/** Optional identifier used when importing a definition from the legacy platform. */
|
|
737
|
+
legacyId?: number;
|
|
738
|
+
/** Display name of the reusable import definition. */
|
|
739
|
+
name: string;
|
|
740
|
+
/** SQL or uploaded CSV source read by the import. */
|
|
741
|
+
source: ImportSource;
|
|
742
|
+
/** Destination table and write behavior. */
|
|
743
|
+
target: ImportTarget;
|
|
744
|
+
/** Chunking strategy. Defaults to CHUNKED with chunks of 10000 rows. */
|
|
745
|
+
processing?: ImportProcessing;
|
|
746
|
+
/** Optional recurring schedule. Omission disables scheduling. */
|
|
747
|
+
schedule?: ImportSchedule;
|
|
748
|
+
/** Optional source-to-target column mapping. */
|
|
749
|
+
columnMappings?: ImportColumnMapping[];
|
|
750
|
+
}
|
|
751
|
+
interface ImportSchedule {
|
|
752
|
+
/** Cron expression evaluated by the Data Manager scheduler. */
|
|
753
|
+
cron?: string;
|
|
754
|
+
/** Whether the schedule is active. Defaults to false. */
|
|
755
|
+
enabled?: boolean;
|
|
756
|
+
}
|
|
757
|
+
interface ImportColumnMapping {
|
|
758
|
+
/** Column name in the source rows. */
|
|
759
|
+
source: string;
|
|
760
|
+
/** Column name in the target table. */
|
|
761
|
+
target: string;
|
|
762
|
+
/** Optional conversion type applied while importing. */
|
|
763
|
+
type?: string | null;
|
|
764
|
+
}
|
|
765
|
+
interface ImportDefinition {
|
|
766
|
+
id: string;
|
|
767
|
+
/** Legacy identifier when the import was migrated from the previous platform. */
|
|
768
|
+
legacyId: number | null;
|
|
769
|
+
name: string;
|
|
770
|
+
source: ImportSourceResponse;
|
|
771
|
+
target: Required<Pick<ImportTarget, "tableName" | "mode">> & {
|
|
772
|
+
upsertKeyColumns: string[] | null;
|
|
773
|
+
};
|
|
774
|
+
processing: {
|
|
775
|
+
mode: "CHUNKED" | "STREAMING";
|
|
776
|
+
orderColumn: string | null;
|
|
777
|
+
chunkSize: number;
|
|
778
|
+
};
|
|
779
|
+
schedule: {
|
|
780
|
+
cron: string | null;
|
|
781
|
+
enabled: boolean;
|
|
782
|
+
};
|
|
783
|
+
columnMappings: ImportColumnMapping[] | null;
|
|
784
|
+
createdAt: string;
|
|
785
|
+
updatedAt: string;
|
|
786
|
+
}
|
|
787
|
+
type ImportSourceResponse = {
|
|
788
|
+
type: "SQL";
|
|
789
|
+
query: string;
|
|
790
|
+
} | {
|
|
791
|
+
type: "CSV";
|
|
792
|
+
fileKey: string;
|
|
793
|
+
separator: string;
|
|
794
|
+
};
|
|
795
|
+
interface ImportExecution {
|
|
796
|
+
id: string;
|
|
797
|
+
importDefinitionId: string;
|
|
798
|
+
/** Definition name captured for display, when available. */
|
|
799
|
+
importName: string | null;
|
|
800
|
+
status: "PENDING" | "PREPARING" | "RUNNING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
|
|
801
|
+
triggerType: "MANUAL" | "SCHEDULED" | "API";
|
|
802
|
+
totalChunks: number | null;
|
|
803
|
+
completedChunks: number;
|
|
804
|
+
failedChunks: number;
|
|
805
|
+
progressPercent: number | null;
|
|
806
|
+
rowsTotal: number | null;
|
|
807
|
+
rowsProcessed: number;
|
|
808
|
+
queuedAt: string;
|
|
809
|
+
startedAt: string | null;
|
|
810
|
+
completedAt: string | null;
|
|
811
|
+
durationSeconds: number | null;
|
|
812
|
+
errorMessage: string | null;
|
|
813
|
+
}
|
|
814
|
+
interface AgentInput {
|
|
815
|
+
/** Agent name, 3 to 255 characters. */
|
|
816
|
+
name: string;
|
|
817
|
+
/** Optional description, at most 1000 characters. */
|
|
818
|
+
description?: string;
|
|
819
|
+
/** System instructions used for the agent. */
|
|
820
|
+
instructions?: string;
|
|
821
|
+
/** Complete list of Function UUIDs available to the agent. */
|
|
822
|
+
functionIds?: string[];
|
|
823
|
+
/** Shared provider connection used by the agent. */
|
|
824
|
+
connectionId?: string;
|
|
825
|
+
/**
|
|
826
|
+
* @deprecated The platform ignores the agent-level flag: autonomy is asked per chat
|
|
827
|
+
* through `AgentTaskCreateInput.autonomous`. Accepted and stored for compatibility.
|
|
828
|
+
*/
|
|
829
|
+
autonomous?: boolean;
|
|
830
|
+
}
|
|
831
|
+
interface AgentDefinition extends AgentInput {
|
|
832
|
+
id: string;
|
|
833
|
+
functionIds: string[];
|
|
834
|
+
autonomous: boolean;
|
|
835
|
+
createdAt: string;
|
|
836
|
+
updatedAt: string;
|
|
837
|
+
}
|
|
838
|
+
interface AgentUpdateItem {
|
|
839
|
+
id: string;
|
|
840
|
+
/** Complete replacement. Omitted optionals are reset by the Functions service. */
|
|
841
|
+
update: AgentInput;
|
|
842
|
+
}
|
|
843
|
+
interface AgentBulkDeleteResult {
|
|
844
|
+
deleted: string[];
|
|
845
|
+
notFound: string[];
|
|
846
|
+
deletedCount: number;
|
|
847
|
+
}
|
|
848
|
+
interface WorkflowInput {
|
|
849
|
+
/** Workflow name, 3 to 255 characters. */
|
|
850
|
+
name: string;
|
|
851
|
+
/** Complete workflow definition including steps, conditions, context, and goto targets. */
|
|
852
|
+
definition: Record<string, unknown>;
|
|
853
|
+
}
|
|
854
|
+
interface WorkflowDefinition extends WorkflowInput {
|
|
855
|
+
id: string;
|
|
856
|
+
tenantId: string;
|
|
857
|
+
appId: string | null;
|
|
858
|
+
createdAt: string;
|
|
859
|
+
updatedAt: string;
|
|
860
|
+
}
|
|
861
|
+
interface WorkflowSummary {
|
|
862
|
+
id: string;
|
|
863
|
+
tenantId: string;
|
|
864
|
+
appId: string | null;
|
|
865
|
+
name: string;
|
|
866
|
+
createdAt: string;
|
|
867
|
+
updatedAt: string;
|
|
868
|
+
}
|
|
869
|
+
interface WorkflowExecution {
|
|
870
|
+
id: string;
|
|
871
|
+
tenantId: string;
|
|
872
|
+
appId: string | null;
|
|
873
|
+
workflowId: string;
|
|
874
|
+
triggerType: "MANUAL" | "SCHEDULED";
|
|
875
|
+
triggeredBy: string | null;
|
|
876
|
+
status: "PENDING" | "RUNNING" | "SUCCESS" | "FAILED" | "CANCELLED";
|
|
877
|
+
currentStepId: string | null;
|
|
878
|
+
context: Record<string, JsonValue> | null;
|
|
879
|
+
errorMessage: string | null;
|
|
880
|
+
startedAt: string | null;
|
|
881
|
+
finishedAt: string | null;
|
|
882
|
+
createdAt: string;
|
|
883
|
+
}
|
|
884
|
+
interface IntegrationResourceParam {
|
|
885
|
+
type: string;
|
|
886
|
+
required: boolean;
|
|
887
|
+
defaultValue: JsonValue;
|
|
888
|
+
description: string | null;
|
|
889
|
+
}
|
|
890
|
+
interface IntegrationResourceInput {
|
|
891
|
+
/** Template config UUID that owns the resource. */
|
|
892
|
+
templateConfigId: string;
|
|
893
|
+
/** Resource name, unique per tenant and at most 100 characters. */
|
|
894
|
+
name: string;
|
|
895
|
+
/** HTTP method used by the resource. */
|
|
896
|
+
method: string;
|
|
897
|
+
/** Endpoint with optional `{{params.name}}` placeholders. */
|
|
898
|
+
endpoint: string;
|
|
899
|
+
/** Optional request body containing placeholders. */
|
|
900
|
+
body?: Record<string, JsonValue>;
|
|
901
|
+
/** Optional parameter schema. */
|
|
902
|
+
params?: Record<string, IntegrationResourceParam>;
|
|
903
|
+
}
|
|
904
|
+
type IntegrationResourceUpdateInput = Omit<IntegrationResourceInput, "templateConfigId">;
|
|
905
|
+
interface IntegrationResource {
|
|
906
|
+
id: string;
|
|
907
|
+
tenantId: string;
|
|
908
|
+
templateConfigId: string;
|
|
909
|
+
name: string;
|
|
910
|
+
method: string;
|
|
911
|
+
endpoint: string;
|
|
912
|
+
body: Record<string, JsonValue> | null;
|
|
913
|
+
params: Record<string, IntegrationResourceParam>;
|
|
914
|
+
createdAt: string;
|
|
915
|
+
updatedAt: string;
|
|
916
|
+
}
|
|
917
|
+
interface IntegrationResourceSummary {
|
|
918
|
+
id: string;
|
|
919
|
+
name: string;
|
|
920
|
+
method: string;
|
|
921
|
+
endpoint: string;
|
|
922
|
+
}
|
|
923
|
+
type IntegrationProxyMode = "OPEN" | "RESOURCE_ONLY";
|
|
924
|
+
type IntegrationTemplateType = "GENERIC_AUTH" | "PROVIDER";
|
|
925
|
+
type IntegrationConnectionStatus = "unchecked" | "connected" | "error";
|
|
926
|
+
interface IntegrationTemplateSummary {
|
|
927
|
+
id: string;
|
|
928
|
+
name: string;
|
|
929
|
+
baseUrl: string | null;
|
|
930
|
+
proxyMode: IntegrationProxyMode;
|
|
931
|
+
logoUrl: string | null;
|
|
932
|
+
templateType: IntegrationTemplateType;
|
|
933
|
+
}
|
|
934
|
+
interface IntegrationTokenExtraction {
|
|
935
|
+
source: string | null;
|
|
936
|
+
path: string | null;
|
|
937
|
+
name: string | null;
|
|
938
|
+
}
|
|
939
|
+
interface IntegrationLoginConfig {
|
|
940
|
+
url: string | null;
|
|
941
|
+
method: string | null;
|
|
942
|
+
headers: Record<string, JsonValue> | null;
|
|
943
|
+
query_params: Record<string, JsonValue> | null;
|
|
944
|
+
body_form: Record<string, JsonValue> | null;
|
|
945
|
+
body: Record<string, JsonValue> | null;
|
|
946
|
+
token_extraction: IntegrationTokenExtraction | null;
|
|
947
|
+
token_ttl_seconds: number | null;
|
|
948
|
+
}
|
|
949
|
+
interface IntegrationCredentialRule {
|
|
950
|
+
placement: "HEADER" | "QUERY" | "COOKIE" | "BODY" | "BASIC" | null;
|
|
951
|
+
name: string | null;
|
|
952
|
+
path: string | null;
|
|
953
|
+
value: string | null;
|
|
954
|
+
}
|
|
955
|
+
interface IntegrationRequestConfig {
|
|
956
|
+
headers: Record<string, JsonValue> | null;
|
|
957
|
+
credential_rules: IntegrationCredentialRule[] | null;
|
|
958
|
+
}
|
|
959
|
+
interface IntegrationFieldSchema {
|
|
960
|
+
key: string;
|
|
961
|
+
label: string;
|
|
962
|
+
type: "url" | "text" | "secret";
|
|
963
|
+
required: boolean;
|
|
964
|
+
placeholder: string | null;
|
|
965
|
+
default: string | null;
|
|
966
|
+
}
|
|
967
|
+
interface IntegrationTemplate extends IntegrationTemplateSummary {
|
|
968
|
+
loginConfig: IntegrationLoginConfig | null;
|
|
969
|
+
requestConfig: IntegrationRequestConfig;
|
|
970
|
+
fieldsSchema: IntegrationFieldSchema[];
|
|
971
|
+
documentationUrl: string | null;
|
|
972
|
+
}
|
|
973
|
+
interface IntegrationExecution {
|
|
974
|
+
id: string;
|
|
975
|
+
templateConfigId: string;
|
|
976
|
+
appId: string | null;
|
|
977
|
+
method: string;
|
|
978
|
+
endpoint: string;
|
|
979
|
+
requestBody: JsonValue;
|
|
980
|
+
responseStatus: number | null;
|
|
981
|
+
responseBody: JsonValue;
|
|
982
|
+
durationMs: number | null;
|
|
983
|
+
success: boolean;
|
|
984
|
+
errorMessage: string | null;
|
|
985
|
+
source: string | null;
|
|
986
|
+
createdAt: string;
|
|
987
|
+
}
|
|
988
|
+
type CopilotProvider = "ANTHROPIC" | "OPENAI" | (string & {});
|
|
989
|
+
interface AgentTaskCreateInput {
|
|
990
|
+
/** Optional title, at most 255 characters. */
|
|
991
|
+
title?: string;
|
|
992
|
+
/** Model harness accepted by Copilot, for example CLAUDE or CODEX. */
|
|
993
|
+
agentType: string;
|
|
994
|
+
/** Optional business agent UUID. */
|
|
995
|
+
agentId?: string;
|
|
996
|
+
/** Optional reasoning setting supported by the selected model. */
|
|
997
|
+
reasoningEffort?: string;
|
|
998
|
+
/** Owner for an on-behalf chat. Requires AGENT_WRITE in the current app. */
|
|
999
|
+
userId?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Opens an ownerless chat that belongs to the named agent. Requires AGENT_WRITE and an
|
|
1002
|
+
* agent holding a connection; mutually exclusive with `userId`.
|
|
1003
|
+
*/
|
|
1004
|
+
autonomous?: boolean;
|
|
1005
|
+
}
|
|
1006
|
+
interface AgentTask {
|
|
1007
|
+
id: string;
|
|
1008
|
+
appId: string | null;
|
|
1009
|
+
agentId: string | null;
|
|
1010
|
+
userId: string | null;
|
|
1011
|
+
title: string | null;
|
|
1012
|
+
agentType: string;
|
|
1013
|
+
reasoningEffort: string | null;
|
|
1014
|
+
archived: boolean;
|
|
1015
|
+
createdAt: string | null;
|
|
1016
|
+
updatedAt: string;
|
|
1017
|
+
}
|
|
1018
|
+
interface AgentTaskListOptions extends PageOptions {
|
|
1019
|
+
/** Include archived chats. Defaults to false. */
|
|
1020
|
+
archived?: boolean;
|
|
1021
|
+
/** Restrict to chats for one business agent. */
|
|
1022
|
+
agentId?: string;
|
|
1023
|
+
/** Search chat titles. */
|
|
1024
|
+
search?: string;
|
|
1025
|
+
/** Read another user's chats. Requires AGENT_WRITE in the current app. */
|
|
1026
|
+
userId?: string;
|
|
1027
|
+
}
|
|
1028
|
+
type AgentTaskInput = {
|
|
1029
|
+
type: "message";
|
|
1030
|
+
content: string;
|
|
1031
|
+
agentType?: string;
|
|
1032
|
+
reasoningEffort?: string;
|
|
1033
|
+
} | {
|
|
1034
|
+
type: "interrupt";
|
|
1035
|
+
} | {
|
|
1036
|
+
type: "approval_response";
|
|
1037
|
+
approved: boolean;
|
|
1038
|
+
};
|
|
1039
|
+
interface AgentTaskEvent {
|
|
1040
|
+
/** Event names are open and can grow without a client release. */
|
|
1041
|
+
type: string;
|
|
1042
|
+
payload: unknown;
|
|
1043
|
+
timestamp: number;
|
|
1044
|
+
/** Present only on persisted structural events; live deltas omit it. */
|
|
1045
|
+
sequence?: number;
|
|
1046
|
+
}
|
|
1047
|
+
interface AgentMessage {
|
|
1048
|
+
id: string;
|
|
1049
|
+
sender: string;
|
|
1050
|
+
type: string;
|
|
1051
|
+
content: string;
|
|
1052
|
+
createdAt: string;
|
|
1053
|
+
}
|
|
1054
|
+
interface AgentModel {
|
|
1055
|
+
model: string;
|
|
1056
|
+
name: string;
|
|
1057
|
+
provider: CopilotProvider;
|
|
1058
|
+
agentType: string;
|
|
1059
|
+
reasoningOptions: string[];
|
|
1060
|
+
}
|
|
1061
|
+
interface CredentialStatus {
|
|
1062
|
+
provider: CopilotProvider;
|
|
1063
|
+
connected: boolean;
|
|
1064
|
+
credentialType: string | null;
|
|
1065
|
+
accountEmail: string | null;
|
|
1066
|
+
maskedApiKey: string | null;
|
|
1067
|
+
}
|
|
1068
|
+
interface OAuthStartResult {
|
|
1069
|
+
authUrl: string;
|
|
1070
|
+
state: string;
|
|
1071
|
+
}
|
|
1072
|
+
interface OAuthExchangeInput {
|
|
1073
|
+
/** Authorization code returned by the provider. */
|
|
1074
|
+
code: string;
|
|
1075
|
+
/** Opaque state returned unchanged by `startOAuth`. */
|
|
1076
|
+
state: string;
|
|
1077
|
+
}
|
|
1078
|
+
interface AuthenticationResult {
|
|
1079
|
+
connected: boolean;
|
|
1080
|
+
email: string | null;
|
|
1081
|
+
}
|
|
1082
|
+
interface DeviceAuthorization {
|
|
1083
|
+
deviceAuthId: string;
|
|
1084
|
+
userCode: string;
|
|
1085
|
+
verificationUri: string;
|
|
1086
|
+
intervalSeconds: number;
|
|
1087
|
+
}
|
|
1088
|
+
interface AgentConnectionCreateInput {
|
|
1089
|
+
/** Connection name, at most 255 characters. */
|
|
1090
|
+
name: string;
|
|
1091
|
+
/** Provider to connect during creation. Must be paired with `apiKey`. */
|
|
1092
|
+
provider?: CopilotProvider;
|
|
1093
|
+
/** Write-only key. Must be paired with `provider`. */
|
|
1094
|
+
apiKey?: string;
|
|
1095
|
+
}
|
|
1096
|
+
interface ProviderCredentialStatus {
|
|
1097
|
+
provider: CopilotProvider;
|
|
1098
|
+
connected: boolean;
|
|
1099
|
+
credentialType: string | null;
|
|
1100
|
+
accountEmail: string | null;
|
|
1101
|
+
}
|
|
1102
|
+
interface AgentConnection {
|
|
1103
|
+
id: string;
|
|
1104
|
+
name: string;
|
|
1105
|
+
createdAt: string;
|
|
1106
|
+
updatedAt: string;
|
|
1107
|
+
credentials: ProviderCredentialStatus[];
|
|
1108
|
+
}
|
|
1109
|
+
interface MessageAccepted {
|
|
1110
|
+
/** Identifier assigned by Messenger to the accepted notification. */
|
|
1111
|
+
messageId: string;
|
|
1112
|
+
}
|
|
1113
|
+
interface AppContext {
|
|
1114
|
+
appId: string;
|
|
1115
|
+
app: AppDefinition;
|
|
1116
|
+
tables: SchemaTables[];
|
|
1117
|
+
functions: FunctionSummary[];
|
|
1118
|
+
functionsTotal: number;
|
|
1119
|
+
functionsTruncated: boolean;
|
|
1120
|
+
agents: AgentDefinition[];
|
|
1121
|
+
agentsTotal: number;
|
|
1122
|
+
agentsTruncated: boolean;
|
|
1123
|
+
files: string[];
|
|
1124
|
+
integrations: TemplateConfigSummary[];
|
|
1125
|
+
integrationsTotal: number;
|
|
1126
|
+
integrationsTruncated: boolean;
|
|
1127
|
+
connections: AgentConnection[];
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
interface AgentConnectionsModule {
|
|
1131
|
+
/** Lists app connections with safe per-provider status and no credentials. */
|
|
1132
|
+
list(): Promise<AgentConnection[]>;
|
|
1133
|
+
get(id: string): Promise<AgentConnection>;
|
|
1134
|
+
/** Creates an unauthenticated provider container. */
|
|
1135
|
+
create(name: string): Promise<AgentConnection>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Creates 1 to 100 connections atomically. A provider and API key must be supplied together;
|
|
1138
|
+
* when present, the item is created and authenticated as one operation.
|
|
1139
|
+
*/
|
|
1140
|
+
bulkCreate(inputs: AgentConnectionCreateInput[]): Promise<AgentConnection[]>;
|
|
1141
|
+
delete(id: string): Promise<void>;
|
|
1142
|
+
/** Validates and saves a write-only API key for one provider. */
|
|
1143
|
+
saveApiKey(id: string, provider: CopilotProvider, apiKey: string): Promise<void>;
|
|
1144
|
+
/** Disconnects one provider without deleting the connection container. */
|
|
1145
|
+
disconnectProvider(id: string, provider: CopilotProvider): Promise<void>;
|
|
1146
|
+
startOAuth(id: string, provider: CopilotProvider): Promise<OAuthStartResult>;
|
|
1147
|
+
exchangeOAuth(id: string, provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
|
|
1148
|
+
startDeviceAuthorization(id: string, provider: CopilotProvider): Promise<DeviceAuthorization>;
|
|
1149
|
+
pollDeviceAuthorization(id: string, provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
|
|
1150
|
+
}
|
|
1151
|
+
declare function createAgentConnectionsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentConnectionsModule;
|
|
1152
|
+
|
|
1153
|
+
interface AgentCredentialsModule {
|
|
1154
|
+
/** Lists safe credential status. Raw credentials never leave Copilot. */
|
|
1155
|
+
list(): Promise<CredentialStatus[]>;
|
|
1156
|
+
/** Lists models backed by a usable credential, optionally through a business agent connection. */
|
|
1157
|
+
listModels(agentId?: string): Promise<AgentModel[]>;
|
|
1158
|
+
/** Validates and stores a write-only API key. */
|
|
1159
|
+
saveApiKey(provider: CopilotProvider, apiKey: string): Promise<void>;
|
|
1160
|
+
/** Permanently removes the current credential for a provider. */
|
|
1161
|
+
remove(provider: CopilotProvider): Promise<void>;
|
|
1162
|
+
/** Starts provider OAuth and returns an opaque state that must be preserved. */
|
|
1163
|
+
startOAuth(provider: CopilotProvider): Promise<OAuthStartResult>;
|
|
1164
|
+
/** Exchanges provider OAuth code and state, saving the resulting credential. */
|
|
1165
|
+
exchangeOAuth(provider: CopilotProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
|
|
1166
|
+
/** Starts a provider device flow and returns its polling interval. */
|
|
1167
|
+
startDeviceAuthorization(provider: CopilotProvider): Promise<DeviceAuthorization>;
|
|
1168
|
+
/** Polls one device authorization. Respect the returned start interval between calls. */
|
|
1169
|
+
pollDeviceAuthorization(provider: CopilotProvider, deviceAuthId: string): Promise<AuthenticationResult>;
|
|
1170
|
+
}
|
|
1171
|
+
declare function createAgentCredentialsModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentCredentialsModule;
|
|
1172
|
+
|
|
1173
|
+
interface AgentsModule {
|
|
1174
|
+
/** Lists the current app's business agents. Defaults: page 0, size 20, sort name. */
|
|
1175
|
+
list(options?: PageOptions): Promise<Page<AgentDefinition>>;
|
|
1176
|
+
get(id: string): Promise<AgentDefinition>;
|
|
1177
|
+
create(input: AgentInput): Promise<AgentDefinition>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Fully replaces an agent. Omitted `functionIds` becomes empty and omitted `autonomous` becomes false.
|
|
1180
|
+
* The complete `functionIds` list replaces the previous association list.
|
|
1181
|
+
*/
|
|
1182
|
+
update(id: string, input: AgentInput): Promise<AgentDefinition>;
|
|
1183
|
+
delete(id: string): Promise<void>;
|
|
1184
|
+
/** Creates 1 to 100 agents atomically. */
|
|
1185
|
+
bulkCreate(inputs: AgentInput[]): Promise<AgentDefinition[]>;
|
|
1186
|
+
/** Updates 1 to 100 agents atomically using complete replacement payloads. */
|
|
1187
|
+
bulkUpdate(items: AgentUpdateItem[]): Promise<AgentDefinition[]>;
|
|
1188
|
+
/** Deletes 1 to 100 unique ids and reports missing ids without failing the batch. */
|
|
1189
|
+
bulkDelete(ids: string[]): Promise<AgentBulkDeleteResult>;
|
|
1190
|
+
/** Lists models the named agent's connection can actually execute. */
|
|
1191
|
+
listModels(agentId: string): Promise<AgentModel[]>;
|
|
1192
|
+
}
|
|
1193
|
+
declare function createAgentsModule(functionsTransport: Transport, copilotTransport: Transport, errors?: SdkCoreErrorFactory): AgentsModule;
|
|
1194
|
+
|
|
1195
|
+
interface AgentTasksModule {
|
|
1196
|
+
/** Lists chats newest first. `userId` on-behalf reads require AGENT_WRITE in the current app. */
|
|
1197
|
+
list(options?: AgentTaskListOptions): Promise<Page<AgentTask>>;
|
|
1198
|
+
get(id: string): Promise<AgentTask>;
|
|
1199
|
+
/** Opens a chat. `autonomous: true` produces an ownerless chat that belongs to the agent. */
|
|
1200
|
+
create(input: AgentTaskCreateInput): Promise<AgentTask>;
|
|
1201
|
+
/** Renames a chat. Title is required and at most 255 characters. */
|
|
1202
|
+
rename(id: string, title: string): Promise<AgentTask>;
|
|
1203
|
+
/** Archives a chat and cleans up its live relay. */
|
|
1204
|
+
archive(id: string): Promise<void>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Sends a message, interrupt, or approval response through Copilot's HTTP channel.
|
|
1207
|
+
* Replay is intentionally excluded: HTTP recovery reads persisted messages instead.
|
|
1208
|
+
*/
|
|
1209
|
+
sendInput(id: string, input: AgentTaskInput): Promise<void>;
|
|
1210
|
+
/** Lists persisted messages. Defaults: page 0, size 50, sort createdAt. */
|
|
1211
|
+
listMessages(id: string, options?: PageOptions): Promise<Page<AgentMessage>>;
|
|
1212
|
+
}
|
|
1213
|
+
declare function createAgentTasksModule(transport: Transport, errors?: SdkCoreErrorFactory): AgentTasksModule;
|
|
1214
|
+
|
|
1215
|
+
interface AppsModule {
|
|
1216
|
+
/** Lists tenant apps. App-scoped tokens cannot call this collection operation. */
|
|
1217
|
+
list(options?: AppListOptions): Promise<Page<AppSummary>>;
|
|
1218
|
+
/** Gets one app, optionally selecting its DRAFT or PUBLISHED version. */
|
|
1219
|
+
get(appId: string, options?: AppGetOptions): Promise<AppDefinition>;
|
|
1220
|
+
/** Creates an app with an initial DRAFT version. App-scoped tokens cannot call this method. */
|
|
1221
|
+
create(input: AppCreateInput): Promise<AppDefinition>;
|
|
1222
|
+
/** Permanently deletes an app, every version, and every deployed artifact. */
|
|
1223
|
+
delete(appId: string): Promise<void>;
|
|
1224
|
+
/** Patches app metadata. Omitted fields are preserved. */
|
|
1225
|
+
update(appId: string, input: AppUpdateInput): Promise<AppDefinition>;
|
|
1226
|
+
/** Gets the complete file map for the current app version. */
|
|
1227
|
+
getFiles(appId: string): Promise<AppFiles>;
|
|
1228
|
+
/** Replaces the complete DRAFT file map. Files omitted from the input are deleted. */
|
|
1229
|
+
replaceFiles(appId: string, files: Record<string, string>): Promise<AppFiles>;
|
|
1230
|
+
/** Merges DRAFT files. Null deletes one path; omitted paths are preserved. */
|
|
1231
|
+
mergeFiles(appId: string, files: Record<string, string | null>): Promise<AppFiles>;
|
|
1232
|
+
/** Starts an asynchronous preview build from a snapshot of the current DRAFT. */
|
|
1233
|
+
build(appId: string): Promise<AppDeploy>;
|
|
1234
|
+
/** Starts an asynchronous build and publishes only after its successful callback. */
|
|
1235
|
+
publish(appId: string, options?: AppPublishOptions): Promise<AppDefinition>;
|
|
1236
|
+
/** Gets a deploy by id. Prefer this stable id for polling. */
|
|
1237
|
+
getDeploy(appId: string, deployId: string): Promise<AppDeploy>;
|
|
1238
|
+
/** Gets the deploy currently referenced by the app version, or null. */
|
|
1239
|
+
getCurrentDeploy(appId: string): Promise<AppDeploy | null>;
|
|
1240
|
+
/** Logically cancels a BUILDING deploy. Late callbacks cannot publish it. */
|
|
1241
|
+
cancelBuild(appId: string, deployId: string): Promise<AppDeploy>;
|
|
1242
|
+
/** Instantly points the app at a previous DEPLOYED version without rebuilding. */
|
|
1243
|
+
rollback(appId: string, targetVersionId: string): Promise<AppDefinition>;
|
|
1244
|
+
/** Lists deploy history. Defaults to page 0, size 20, and `createdAt,desc`; maximum size is 100. */
|
|
1245
|
+
listDeploys(appId: string, options?: PageOptions): Promise<Page<AppDeploy>>;
|
|
1246
|
+
/** Lists immutable versions. Defaults to page 0, size 20, and `createdAt,desc`; maximum size is 100. */
|
|
1247
|
+
listVersions(appId: string, options?: PageOptions): Promise<Page<AppVersion>>;
|
|
1248
|
+
}
|
|
1249
|
+
declare function createAppsModule(transport: Transport, errors?: SdkCoreErrorFactory): AppsModule;
|
|
105
1250
|
|
|
106
1251
|
interface AuthModule {
|
|
107
1252
|
me(): Promise<User>;
|
|
1253
|
+
/** Lists user plans available for identity provisioning. */
|
|
1254
|
+
listUserPlans(): Promise<UserPlan[]>;
|
|
108
1255
|
}
|
|
109
1256
|
declare function createAuthModule(transport: Transport, errors?: SdkCoreErrorFactory): AuthModule;
|
|
110
1257
|
|
|
1258
|
+
interface FunctionsAdminModule {
|
|
1259
|
+
/**
|
|
1260
|
+
* Lists app Functions. Defaults: page 0, size 20, sort name.
|
|
1261
|
+
*
|
|
1262
|
+
* With `SCHEDULE_READ`, each item includes its composed cron fields. Without that permission,
|
|
1263
|
+
* all three fields are null, which is also the shape of a Function without a schedule.
|
|
1264
|
+
*/
|
|
1265
|
+
list(options?: FunctionListOptions): Promise<Page<FunctionSummary>>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Gets one Function. Its composed cron fields follow the same permission-dependent semantics as
|
|
1268
|
+
* `list`: all null can mean either no schedule or no `SCHEDULE_READ` permission.
|
|
1269
|
+
*/
|
|
1270
|
+
get(id: string): Promise<FunctionDefinition>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Creates a Function and optionally configures its schedule through the same request.
|
|
1273
|
+
*
|
|
1274
|
+
* Supplying any of `cronExpression`, `cronInputJson`, or `cronEnabled` requires a non-blank
|
|
1275
|
+
* expression. The new schedule uses UTC and starts enabled unless `cronEnabled` is false.
|
|
1276
|
+
* Scheduling also requires `SCHEDULE_WRITE` and `FUNCTION_EXECUTE`.
|
|
1277
|
+
*/
|
|
1278
|
+
create(input: FunctionCreateInput): Promise<FunctionDefinition>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Partially updates mutable fields.
|
|
1281
|
+
*
|
|
1282
|
+
* Omitted and null fields preserve their stored values. Empty values are applied when accepted
|
|
1283
|
+
* by the field. The three cron fields form one composed scheduling unit: a blank expression
|
|
1284
|
+
* removes the schedule, a non-blank expression can create a missing schedule in UTC, an empty
|
|
1285
|
+
* input object clears it, and `cronEnabled` explicitly pauses or resumes it. Schedule changes
|
|
1286
|
+
* require `SCHEDULE_WRITE` and `FUNCTION_EXECUTE`.
|
|
1287
|
+
*/
|
|
1288
|
+
patch(id: string, input: FunctionPatchInput): Promise<FunctionDefinition>;
|
|
1289
|
+
delete(id: string): Promise<void>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Creates 1 to 100 Functions in a single transaction. Any failure creates none of them.
|
|
1292
|
+
*
|
|
1293
|
+
* SQL Functions require `dataSourceId`; every other runtime rejects it. Requires a token with an
|
|
1294
|
+
* `app_id` claim. Embedded cron fields are prohibited in every bulk operation; compose a schedule
|
|
1295
|
+
* through single-Function `create` instead.
|
|
1296
|
+
*/
|
|
1297
|
+
bulkCreate(functions: FunctionBulkCreateInput[]): Promise<FunctionDefinition[]>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Updates 1 to 100 Functions.
|
|
1300
|
+
*
|
|
1301
|
+
* WARNING: each `update` is a FULL REPLACEMENT, not a patch. An optional field you omit is
|
|
1302
|
+
* CLEARED, not preserved: leave out `description`, `inputSchema`, `outputSchema`, or `secrets`
|
|
1303
|
+
* and the stored value becomes empty. `name` and `code` are required on every item. This is the
|
|
1304
|
+
* opposite of the legacy `updateServerFunctionMitra`, which preserved whatever it did not
|
|
1305
|
+
* receive. Always send the complete desired state.
|
|
1306
|
+
*
|
|
1307
|
+
* Embedded cron fields are prohibited in every bulk operation. Requires a token with an `app_id`
|
|
1308
|
+
* claim.
|
|
1309
|
+
*/
|
|
1310
|
+
bulkUpdate(functions: FunctionBulkUpdateItem[]): Promise<FunctionDefinition[]>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Partially updates 1 to 100 Functions while preserving omitted and null fields. Embedded cron
|
|
1313
|
+
* fields are prohibited in every bulk operation; compose schedule changes through
|
|
1314
|
+
* single-Function `patch` instead.
|
|
1315
|
+
*/
|
|
1316
|
+
bulkPatch(functions: FunctionBulkPatchItem[]): Promise<FunctionDefinition[]>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Deletes Functions by id, or every Function in the app with `{ allInApp: true }`.
|
|
1319
|
+
*
|
|
1320
|
+
* The two selectors are mutually exclusive: pass exactly one. `allInApp` deletes nothing and
|
|
1321
|
+
* fails when the app holds more than 100 Functions.
|
|
1322
|
+
*/
|
|
1323
|
+
bulkDelete(selector: FunctionBulkDeleteInput): Promise<FunctionBulkDeleteResult>;
|
|
1324
|
+
/** Publishes the current DRAFT version. */
|
|
1325
|
+
publish(id: string): Promise<FunctionDefinition>;
|
|
1326
|
+
/** Creates a new current version from an earlier version UUID. */
|
|
1327
|
+
rollback(id: string, versionId: string): Promise<FunctionDefinition>;
|
|
1328
|
+
listVersions(id: string, options?: FunctionVersionListOptions): Promise<Page<FunctionVersion>>;
|
|
1329
|
+
/** Changes PRIVATE/PUBLIC visibility without replacing the Function. */
|
|
1330
|
+
setVisibility(id: string, visibility: FunctionVisibility): Promise<FunctionDefinition>;
|
|
1331
|
+
listExecutions(id: string, options?: PageOptions): Promise<Page<FunctionExecution>>;
|
|
1332
|
+
getExecution(functionId: string, executionId: string): Promise<FunctionExecution>;
|
|
1333
|
+
/** Lists secret names only. Secret values never leave Functions. */
|
|
1334
|
+
listSecrets(id: string): Promise<FunctionSecrets>;
|
|
1335
|
+
/** Creates or replaces a write-only secret value. */
|
|
1336
|
+
createSecret(id: string, name: string, value: string): Promise<void>;
|
|
1337
|
+
/** Permanently deletes a secret by name. */
|
|
1338
|
+
deleteSecret(id: string, name: string): Promise<void>;
|
|
1339
|
+
}
|
|
1340
|
+
declare function createFunctionsAdminModule(transport: Transport, errors?: SdkCoreErrorFactory): FunctionsAdminModule;
|
|
1341
|
+
|
|
1342
|
+
interface IntegrationAdminModule {
|
|
1343
|
+
/** Creates one integration config. Secret values are write-only. */
|
|
1344
|
+
create(input: TemplateConfigCreateInput): Promise<TemplateConfig>;
|
|
1345
|
+
/** Updates one config. Omitting `values` preserves stored credentials. */
|
|
1346
|
+
update(id: string, input: Omit<TemplateConfigUpdateInput, "configId">): Promise<TemplateConfig>;
|
|
1347
|
+
/** Permanently deletes one config and its stored credentials. */
|
|
1348
|
+
delete(id: string): Promise<void>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Creates 1 to 100 integration template configs.
|
|
1351
|
+
*
|
|
1352
|
+
* The whole batch is validated first, then items run in order, NOT atomically: read `results`
|
|
1353
|
+
* for the outcome of each one. `values` hold credentials and never come back in any response.
|
|
1354
|
+
*/
|
|
1355
|
+
bulkCreate(configs: TemplateConfigCreateInput[]): Promise<TemplateConfigBulkResult>;
|
|
1356
|
+
/**
|
|
1357
|
+
* Updates 1 to 100 integration template configs, in order and NOT atomically.
|
|
1358
|
+
*
|
|
1359
|
+
* Note the exception to the platform's bulk update rule: omitting `values` PRESERVES the stored
|
|
1360
|
+
* configuration instead of clearing it, unlike `functionsAdmin.bulkUpdate`, where an omitted
|
|
1361
|
+
* field is wiped. Sending `values` replaces the whole map.
|
|
1362
|
+
*/
|
|
1363
|
+
bulkUpdate(configs: TemplateConfigUpdateInput[]): Promise<TemplateConfigBulkResult>;
|
|
1364
|
+
/** Deletes 1 to 100 template configs by id, in order and NOT atomically. */
|
|
1365
|
+
bulkDelete(configIds: string[]): Promise<TemplateConfigBulkResult>;
|
|
1366
|
+
/** Tests provisional credentials against a template without storing anything. */
|
|
1367
|
+
testCredentials(request: TestCredentialsInput): Promise<ConnectionTestResult>;
|
|
1368
|
+
/** Tests a stored template config using the credentials it already holds. */
|
|
1369
|
+
testConfig(configId: string): Promise<ConnectionTestResult>;
|
|
1370
|
+
/** Lists the app's template configs, one page at a time. Credentials are never included. */
|
|
1371
|
+
list(options?: ListTemplateConfigsOptions): Promise<TemplateConfigPage>;
|
|
1372
|
+
/** Lists proxy executions for one config. Defaults: page 0, size 20, newest first. */
|
|
1373
|
+
listExecutions(configId: string, options?: ListTemplateConfigsOptions): Promise<LegacyPage<IntegrationExecution>>;
|
|
1374
|
+
getExecution(configId: string, executionId: string): Promise<IntegrationExecution>;
|
|
1375
|
+
}
|
|
1376
|
+
declare function createIntegrationAdminModule(transport: Transport, errors?: SdkCoreErrorFactory): IntegrationAdminModule;
|
|
1377
|
+
|
|
1378
|
+
interface SchemaModule {
|
|
1379
|
+
/** Creates a table in the current app schema. */
|
|
1380
|
+
createTable(tableName: string, columns: ColumnInput[]): Promise<void>;
|
|
1381
|
+
/** Lists APP and/or SHARED tables. Column details are omitted unless requested. */
|
|
1382
|
+
listTables(options?: ListTablesOptions): Promise<SchemaTables[]>;
|
|
1383
|
+
/** Lightweight alias for `listTables({ scope: "APP" })`. */
|
|
1384
|
+
listAppTables(options?: Pick<ListTablesOptions, "includeColumns">): Promise<SchemaTables[]>;
|
|
1385
|
+
/** Gets columns, primary keys, and foreign keys for one table. */
|
|
1386
|
+
getTable(tableName: string): Promise<TableDefinition>;
|
|
1387
|
+
/** Permanently drops a table and all of its rows. */
|
|
1388
|
+
dropTable(tableName: string): Promise<void>;
|
|
1389
|
+
/** Permanently deletes every row while keeping the table definition. */
|
|
1390
|
+
truncateTable(tableName: string): Promise<void>;
|
|
1391
|
+
/** Adds one column to an existing table. */
|
|
1392
|
+
addColumn(tableName: string, column: ColumnInput): Promise<void>;
|
|
1393
|
+
/** Permanently drops one column and its stored values. */
|
|
1394
|
+
dropColumn(tableName: string, columnName: string): Promise<void>;
|
|
1395
|
+
}
|
|
1396
|
+
declare function createSchemaModule(transport: Transport, errors?: SdkCoreErrorFactory): SchemaModule;
|
|
1397
|
+
|
|
1398
|
+
interface ContextModule {
|
|
1399
|
+
/**
|
|
1400
|
+
* Reads safe authoring context sequentially and fails on the first unavailable capability.
|
|
1401
|
+
*
|
|
1402
|
+
* Function code, file contents, integration secrets, and connection credentials are excluded.
|
|
1403
|
+
* Summary lists are capped at 2000 and report total and truncation metadata.
|
|
1404
|
+
*/
|
|
1405
|
+
getAppContext(): Promise<AppContext>;
|
|
1406
|
+
}
|
|
1407
|
+
interface ContextModuleDependencies {
|
|
1408
|
+
apps: AppsModule;
|
|
1409
|
+
schema: SchemaModule;
|
|
1410
|
+
functionsAdmin: FunctionsAdminModule;
|
|
1411
|
+
agents: AgentsModule;
|
|
1412
|
+
integrationAdmin: IntegrationAdminModule;
|
|
1413
|
+
agentConnections: AgentConnectionsModule;
|
|
1414
|
+
getAppId?: (() => string | undefined) | undefined;
|
|
1415
|
+
}
|
|
1416
|
+
declare function createContextModule(dependencies: ContextModuleDependencies, errors?: SdkCoreErrorFactory): ContextModule;
|
|
1417
|
+
|
|
1418
|
+
interface CustomQueriesModule {
|
|
1419
|
+
/** Lists reusable SELECT queries without SQL. Defaults: page 0, size 20, sort name. */
|
|
1420
|
+
list(options?: PageOptions): Promise<Page<CustomQuerySummary>>;
|
|
1421
|
+
get(id: string): Promise<CustomQueryDefinition>;
|
|
1422
|
+
/** Creates a named SELECT query. */
|
|
1423
|
+
create(input: CustomQueryInput): Promise<CustomQueryDefinition>;
|
|
1424
|
+
/** Fully replaces name, SQL, and Virtual Table settings. */
|
|
1425
|
+
update(id: string, input: CustomQueryUpdateInput): Promise<CustomQueryDefinition>;
|
|
1426
|
+
/** Permanently deletes a saved query. */
|
|
1427
|
+
delete(id: string): Promise<void>;
|
|
1428
|
+
/** Executes a saved query using driver-bound named parameters. */
|
|
1429
|
+
execute(id: string, parameters?: Record<string, unknown>): Promise<QueryResult>;
|
|
1430
|
+
}
|
|
1431
|
+
declare function createCustomQueriesModule(transport: Transport, errors?: SdkCoreErrorFactory): CustomQueriesModule;
|
|
1432
|
+
|
|
1433
|
+
interface DataSourcesModule {
|
|
1434
|
+
/** Lists safe Data Source metadata. Stored credentials are never returned. */
|
|
1435
|
+
list(options?: PageOptions): Promise<Page<DataSourceDefinition>>;
|
|
1436
|
+
get(id: string): Promise<DataSourceDefinition>;
|
|
1437
|
+
/** Creates one external Data Source. */
|
|
1438
|
+
create(input: DataSourceCreateInput): Promise<DataSourceDefinition>;
|
|
1439
|
+
/** Updates one external Data Source. Omitting credentials preserves stored values. */
|
|
1440
|
+
update(id: string, input: Omit<DataSourceUpdateInput, "dataSourceId">): Promise<DataSourceDefinition>;
|
|
1441
|
+
/** Permanently deletes one external Data Source. */
|
|
1442
|
+
delete(id: string): Promise<void>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Registers 1 to 100 `EXTERNAL` data sources. Mitra-managed instance types are rejected.
|
|
1445
|
+
*
|
|
1446
|
+
* The SDK composes the existing singular API in order, best effort and NOT atomically: metadata
|
|
1447
|
+
* and the credential land per item, so a later failure leaves earlier items created. Read
|
|
1448
|
+
* `results` to find out what happened to each one.
|
|
1449
|
+
*/
|
|
1450
|
+
bulkCreate(dataSources: DataSourceCreateInput[]): Promise<DataSourceBulkResult>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Updates 1 to 100 data sources, best effort and NOT atomically, like `bulkCreate`.
|
|
1453
|
+
*
|
|
1454
|
+
* Credentials are write-only. Omitting `credential` on a connection config PRESERVES the stored
|
|
1455
|
+
* secret; sending one replaces it. Credentials never come back in responses, errors, or logs.
|
|
1456
|
+
*/
|
|
1457
|
+
bulkUpdate(dataSources: DataSourceUpdateInput[]): Promise<DataSourceBulkResult>;
|
|
1458
|
+
/** Deletes 1 to 100 data sources by id, best effort and NOT atomically. */
|
|
1459
|
+
bulkDelete(dataSourceIds: string[]): Promise<DataSourceBulkResult>;
|
|
1460
|
+
}
|
|
1461
|
+
declare function createDataSourcesModule(transport: Transport, errors?: SdkCoreErrorFactory): DataSourcesModule;
|
|
1462
|
+
|
|
111
1463
|
interface EntitiesModule {
|
|
112
1464
|
getTable<T = Record<string, unknown>>(tableName: string): EntityTable<T>;
|
|
113
1465
|
}
|
|
@@ -130,42 +1482,338 @@ interface FunctionsModule {
|
|
|
130
1482
|
}
|
|
131
1483
|
declare function createFunctionsModule(transport: Transport, options?: FunctionsModuleOptions, errors?: SdkCoreErrorFactory): FunctionsModule;
|
|
132
1484
|
|
|
1485
|
+
interface ImportExecutionListOptions extends PageOptions {
|
|
1486
|
+
/** Import definition UUID. */
|
|
1487
|
+
definitionId: string;
|
|
1488
|
+
}
|
|
1489
|
+
interface ImportsModule {
|
|
1490
|
+
/** Lists import definitions. Defaults: page 0, size 20, sort name. */
|
|
1491
|
+
list(options?: PageOptions): Promise<Page<ImportDefinition>>;
|
|
1492
|
+
get(id: string): Promise<ImportDefinition>;
|
|
1493
|
+
create(input: ImportInput): Promise<ImportDefinition>;
|
|
1494
|
+
/** Fully replaces an import definition. */
|
|
1495
|
+
update(id: string, input: Omit<ImportInput, "legacyId">): Promise<ImportDefinition>;
|
|
1496
|
+
/** Permanently deletes an import definition. */
|
|
1497
|
+
delete(id: string): Promise<void>;
|
|
1498
|
+
/** Queues an import and returns its execution. */
|
|
1499
|
+
execute(id: string): Promise<ImportExecution>;
|
|
1500
|
+
/** Lists executions for one definition, newest queued first. */
|
|
1501
|
+
listExecutions(options: ImportExecutionListOptions): Promise<Page<ImportExecution>>;
|
|
1502
|
+
/** Requests cancellation. A terminal execution cannot be changed. */
|
|
1503
|
+
cancelExecution(executionId: string): Promise<ImportExecution>;
|
|
1504
|
+
}
|
|
1505
|
+
declare function createImportsModule(transport: Transport, errors?: SdkCoreErrorFactory): ImportsModule;
|
|
1506
|
+
|
|
133
1507
|
interface IntegrationModule {
|
|
134
1508
|
executeResource(resourceId: string, params?: Record<string, unknown>): Promise<ProxyResult>;
|
|
135
1509
|
execute(configId: string, request: ProxyInput): Promise<ProxyResult>;
|
|
1510
|
+
executeByAlias(alias: string, request: ProxyInput): Promise<ProxyResult>;
|
|
136
1511
|
}
|
|
137
1512
|
declare function createIntegrationModule(transport: Transport, errors?: SdkCoreErrorFactory): IntegrationModule;
|
|
138
1513
|
|
|
1514
|
+
interface IntegrationResourcesModule {
|
|
1515
|
+
/** Lists resources. Defaults: page 0, size 20, sort name ascending. */
|
|
1516
|
+
list(options?: PageOptions): Promise<LegacyPage<IntegrationResourceSummary>>;
|
|
1517
|
+
/** Gets one complete resource, including body, parameter schema, owner, and timestamps. */
|
|
1518
|
+
get(id: string): Promise<IntegrationResource>;
|
|
1519
|
+
create(input: IntegrationResourceInput): Promise<IntegrationResource>;
|
|
1520
|
+
/** Fully replaces resource request settings. */
|
|
1521
|
+
update(id: string, input: IntegrationResourceUpdateInput): Promise<IntegrationResource>;
|
|
1522
|
+
delete(id: string): Promise<void>;
|
|
1523
|
+
}
|
|
1524
|
+
declare function createIntegrationResourcesModule(transport: Transport, errors?: SdkCoreErrorFactory): IntegrationResourcesModule;
|
|
1525
|
+
|
|
1526
|
+
interface IntegrationTemplatesModule {
|
|
1527
|
+
/** Lists template summaries. Defaults: page 0, size 20, sort name. */
|
|
1528
|
+
list(options?: PageOptions): Promise<LegacyPage<IntegrationTemplateSummary>>;
|
|
1529
|
+
/** Gets the complete login, request, and credential field schema for one template. */
|
|
1530
|
+
get(id: string): Promise<IntegrationTemplate>;
|
|
1531
|
+
/** Lists saved config summaries. Credentials and secret values are never returned. */
|
|
1532
|
+
listConfigs(options?: PageOptions): Promise<TemplateConfigPage>;
|
|
1533
|
+
/** Gets one saved config with its stored safe config references and connection metadata. */
|
|
1534
|
+
getConfig(id: string): Promise<TemplateConfig>;
|
|
1535
|
+
}
|
|
1536
|
+
declare function createIntegrationTemplatesModule(transport: Transport, errors?: SdkCoreErrorFactory): IntegrationTemplatesModule;
|
|
1537
|
+
|
|
1538
|
+
interface MembersModule {
|
|
1539
|
+
/**
|
|
1540
|
+
* Lists the users with effective access to the token's app: owners, admins, and managers whose
|
|
1541
|
+
* access is derived from their tenant role, plus users holding an explicit app grant.
|
|
1542
|
+
*
|
|
1543
|
+
* Read only. Requires the `MEMBER_READ` resource and a token with an `app_id` claim.
|
|
1544
|
+
*/
|
|
1545
|
+
list(): Promise<AppMember[]>;
|
|
1546
|
+
/** Invites one user to an app. Requires an app-scoped token bound to the same `appId`. */
|
|
1547
|
+
invite(appId: string, input: InviteAppUserInput): Promise<void>;
|
|
1548
|
+
/** Revokes one user's app access. This does not delete the user's tenant identity. */
|
|
1549
|
+
unsubscribe(appId: string, userId: string): Promise<void>;
|
|
1550
|
+
/** Invites 1 to 100 users atomically. */
|
|
1551
|
+
bulkInvite(appId: string, users: InviteAppUserInput[]): Promise<void>;
|
|
1552
|
+
/** Revokes 1 to 100 unique users and reports ids not currently subscribed. */
|
|
1553
|
+
bulkUnsubscribe(appId: string, userIds: string[]): Promise<BulkUnsubscribeResult>;
|
|
1554
|
+
}
|
|
1555
|
+
declare function createMembersModule(transport: Transport, errors?: SdkCoreErrorFactory): MembersModule;
|
|
1556
|
+
|
|
1557
|
+
interface MessengerModule {
|
|
1558
|
+
/** Sends plain text to the authenticated user; channel rendering may support markdown. */
|
|
1559
|
+
notify(content: string): Promise<MessageAccepted>;
|
|
1560
|
+
}
|
|
1561
|
+
declare function createMessengerModule(transport: Transport, errors?: SdkCoreErrorFactory): MessengerModule;
|
|
1562
|
+
|
|
1563
|
+
interface PublicFunctionsModule {
|
|
1564
|
+
/**
|
|
1565
|
+
* Executes a PUBLIC Function anonymously and waits for the terminal outcome.
|
|
1566
|
+
*
|
|
1567
|
+
* The response deliberately excludes input, logs, version, and timing information.
|
|
1568
|
+
*/
|
|
1569
|
+
execute(id: string, input?: Record<string, unknown>): Promise<PublicFunctionResult>;
|
|
1570
|
+
/** Queues a PUBLIC Function anonymously as fire-and-forget and returns its initial status. */
|
|
1571
|
+
executeAsync(id: string, input?: Record<string, unknown>): Promise<PublicFunctionAsyncResult>;
|
|
1572
|
+
}
|
|
1573
|
+
declare function createPublicFunctionsModule(transport: Transport | undefined, errors?: SdkCoreErrorFactory): PublicFunctionsModule;
|
|
1574
|
+
|
|
139
1575
|
interface QueriesModule {
|
|
140
1576
|
execute(id: string, parameters?: Record<string, unknown>): Promise<QueryResult>;
|
|
141
1577
|
}
|
|
142
|
-
declare function createQueriesModule(transport: Transport,
|
|
1578
|
+
declare function createQueriesModule(transport: Transport, errors?: SdkCoreErrorFactory): QueriesModule;
|
|
1579
|
+
|
|
1580
|
+
interface SqlModule {
|
|
1581
|
+
/**
|
|
1582
|
+
* Executes one parameterized SELECT, INSERT, UPDATE, or DELETE statement.
|
|
1583
|
+
* Values must use named parameters and must not be interpolated into SQL.
|
|
1584
|
+
*/
|
|
1585
|
+
executeQuery(sql: string, parameters?: Record<string, unknown>): Promise<QueryResult>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Runs 1 to 20 DDL statements in one transaction, in order, on the app's managed data source.
|
|
1588
|
+
*
|
|
1589
|
+
* The batch is atomic: any failure rolls the whole list back, and the error carries the
|
|
1590
|
+
* `failedIndex` of the offending statement. Responses omit `affectedRows` on this path.
|
|
1591
|
+
*/
|
|
1592
|
+
executeDdl(statements: DdlStatement[]): Promise<BatchExecution>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Runs 1 to 20 DML statements in one transaction, in order, on the app's managed data source.
|
|
1595
|
+
*
|
|
1596
|
+
* Named parameters are preserved per statement. `RETURNING` is rejected in a batch. The batch is
|
|
1597
|
+
* atomic: any failure rolls the whole list back, and the error carries the `failedIndex`.
|
|
1598
|
+
*/
|
|
1599
|
+
executeDml(statements: DmlStatement[]): Promise<BatchExecution>;
|
|
1600
|
+
/** Lists the app's tables grouped by schema. Column details arrive only with `includeColumns`. */
|
|
1601
|
+
listTables(options?: ListTablesOptions): Promise<SchemaTables[]>;
|
|
1602
|
+
}
|
|
1603
|
+
declare function createSqlModule(transport: Transport, errors?: SdkCoreErrorFactory): SqlModule;
|
|
1604
|
+
|
|
1605
|
+
interface WorkflowsModule {
|
|
1606
|
+
/** Lists app workflows. Defaults: page 0, size 20, sort name. */
|
|
1607
|
+
list(options?: PageOptions): Promise<Page<WorkflowSummary>>;
|
|
1608
|
+
get(id: string): Promise<WorkflowDefinition>;
|
|
1609
|
+
create(input: WorkflowInput): Promise<WorkflowDefinition>;
|
|
1610
|
+
/** Fully replaces both the name and complete workflow definition. */
|
|
1611
|
+
update(id: string, input: WorkflowInput): Promise<WorkflowDefinition>;
|
|
1612
|
+
delete(id: string): Promise<void>;
|
|
1613
|
+
/** Queues a workflow and returns the PENDING execution. */
|
|
1614
|
+
execute(id: string, input?: Record<string, unknown>): Promise<WorkflowExecution>;
|
|
1615
|
+
/** Lists complete execution state. Defaults: page 0, size 20, service-defined creation sort. */
|
|
1616
|
+
listExecutions(workflowId: string, options?: PageOptions): Promise<Page<WorkflowExecution>>;
|
|
1617
|
+
/** Gets one execution with trigger, current step, context, error, and timestamps. */
|
|
1618
|
+
getExecution(workflowId: string, executionId: string): Promise<WorkflowExecution>;
|
|
1619
|
+
/** Requests cancellation. The service returns no body. */
|
|
1620
|
+
cancelExecution(workflowId: string, executionId: string): Promise<void>;
|
|
1621
|
+
}
|
|
1622
|
+
declare function createWorkflowsModule(transport: Transport, errors?: SdkCoreErrorFactory): WorkflowsModule;
|
|
143
1623
|
|
|
144
1624
|
interface SdkCoreTransports {
|
|
145
1625
|
auth: Transport;
|
|
146
1626
|
dataManager: Transport;
|
|
147
1627
|
functions: Transport;
|
|
148
1628
|
integration: Transport;
|
|
1629
|
+
/** Code Studio transport. App-scoped adapters must prevent callers from targeting another app. */
|
|
1630
|
+
codeStudio?: Transport;
|
|
1631
|
+
/** Copilot transport for tasks, credentials, models, and app connections. */
|
|
1632
|
+
copilot?: Transport;
|
|
1633
|
+
/** Messenger transport for current-user notifications. */
|
|
1634
|
+
messenger?: Transport;
|
|
1635
|
+
/**
|
|
1636
|
+
* Anonymous Functions transport. It must not add Authorization or X-App-Id headers.
|
|
1637
|
+
* No fallback to the authenticated Functions transport is performed.
|
|
1638
|
+
*/
|
|
1639
|
+
publicFunctions?: Transport;
|
|
149
1640
|
}
|
|
150
1641
|
interface SdkCoreOptions {
|
|
151
1642
|
transports: SdkCoreTransports;
|
|
152
|
-
|
|
1643
|
+
/** Resolves the app fixed by the concrete client without inspecting tokens in core. */
|
|
1644
|
+
getAppId?: () => string | undefined;
|
|
153
1645
|
functions?: FunctionsModuleOptions;
|
|
154
1646
|
errors?: SdkCoreErrorFactory;
|
|
155
1647
|
}
|
|
156
1648
|
interface SdkCore {
|
|
1649
|
+
readonly agentConnections: AgentConnectionsModule;
|
|
1650
|
+
readonly agentCredentials: AgentCredentialsModule;
|
|
1651
|
+
readonly agents: AgentsModule;
|
|
1652
|
+
readonly agentTasks: AgentTasksModule;
|
|
1653
|
+
readonly apps: AppsModule;
|
|
157
1654
|
readonly auth: AuthModule;
|
|
1655
|
+
readonly context: ContextModule;
|
|
1656
|
+
readonly customQueries: CustomQueriesModule;
|
|
1657
|
+
readonly dataSources: DataSourcesModule;
|
|
158
1658
|
readonly entities: EntitiesProxy;
|
|
159
1659
|
readonly functions: FunctionsModule;
|
|
1660
|
+
readonly functionsAdmin: FunctionsAdminModule;
|
|
1661
|
+
readonly imports: ImportsModule;
|
|
160
1662
|
readonly integration: IntegrationModule;
|
|
1663
|
+
readonly integrationAdmin: IntegrationAdminModule;
|
|
1664
|
+
readonly integrationResources: IntegrationResourcesModule;
|
|
1665
|
+
readonly integrationTemplates: IntegrationTemplatesModule;
|
|
1666
|
+
readonly members: MembersModule;
|
|
1667
|
+
readonly messenger: MessengerModule;
|
|
1668
|
+
readonly publicFunctions: PublicFunctionsModule;
|
|
161
1669
|
readonly queries: QueriesModule;
|
|
1670
|
+
readonly sql: SqlModule;
|
|
1671
|
+
readonly schema: SchemaModule;
|
|
1672
|
+
readonly workflows: WorkflowsModule;
|
|
162
1673
|
}
|
|
163
1674
|
declare function createSdkCore(options: SdkCoreOptions): SdkCore;
|
|
164
1675
|
|
|
1676
|
+
interface AgentTaskEventObserver {
|
|
1677
|
+
onEvent(event: AgentTaskEvent): void;
|
|
1678
|
+
onDisconnect(error?: unknown): void;
|
|
1679
|
+
}
|
|
1680
|
+
interface AgentTaskEventConnection {
|
|
1681
|
+
close(): void;
|
|
1682
|
+
}
|
|
1683
|
+
/** Streaming boundary implemented by concrete SDKs. Core never opens HTTP or WebSocket itself. */
|
|
1684
|
+
interface AgentTaskEventSource {
|
|
1685
|
+
open(taskId: string, observer: AgentTaskEventObserver, signal?: AbortSignal, transport?: AgentSessionTransport): Promise<AgentTaskEventConnection>;
|
|
1686
|
+
}
|
|
1687
|
+
type AgentSessionTransport = "auto" | "websocket" | "http";
|
|
1688
|
+
interface NewAgentTaskSessionOptions {
|
|
1689
|
+
create: true;
|
|
1690
|
+
agentType: string;
|
|
1691
|
+
title?: string;
|
|
1692
|
+
agentId?: string;
|
|
1693
|
+
reasoningEffort?: string;
|
|
1694
|
+
userId?: string;
|
|
1695
|
+
/** Adapter preference. Server adapters support `http`; browser adapters may support all values. */
|
|
1696
|
+
transport?: AgentSessionTransport;
|
|
1697
|
+
}
|
|
1698
|
+
interface ExistingAgentTaskSessionOptions {
|
|
1699
|
+
taskId: string;
|
|
1700
|
+
transport?: AgentSessionTransport;
|
|
1701
|
+
}
|
|
1702
|
+
type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSessionOptions;
|
|
1703
|
+
interface AgentSendOptions {
|
|
1704
|
+
agentType?: string;
|
|
1705
|
+
reasoningEffort?: string;
|
|
1706
|
+
}
|
|
1707
|
+
interface AgentSendAndWaitOptions extends AgentSendOptions {
|
|
1708
|
+
signal?: AbortSignal;
|
|
1709
|
+
timeoutMs?: number;
|
|
1710
|
+
}
|
|
1711
|
+
type AgentTaskSessionStatus = "opening" | "idle" | "streaming" | "cancelled" | "error" | "closed";
|
|
1712
|
+
interface AgentQueueItem extends AgentSendOptions {
|
|
1713
|
+
id: string;
|
|
1714
|
+
text: string;
|
|
1715
|
+
createdAt: number;
|
|
1716
|
+
}
|
|
1717
|
+
interface AgentToolEvent {
|
|
1718
|
+
tool: string;
|
|
1719
|
+
toolId?: string;
|
|
1720
|
+
phase: "call" | "result";
|
|
1721
|
+
input?: unknown;
|
|
1722
|
+
content?: unknown;
|
|
1723
|
+
timestamp?: number;
|
|
1724
|
+
}
|
|
1725
|
+
type AgentTimelineItem = {
|
|
1726
|
+
id: string;
|
|
1727
|
+
kind: "user" | "agent";
|
|
1728
|
+
text: string;
|
|
1729
|
+
at: string;
|
|
1730
|
+
} | {
|
|
1731
|
+
id: string;
|
|
1732
|
+
kind: "tool";
|
|
1733
|
+
tool: AgentToolEvent;
|
|
1734
|
+
at: string;
|
|
1735
|
+
};
|
|
1736
|
+
interface AgentTurnResult {
|
|
1737
|
+
task: AgentTask;
|
|
1738
|
+
content: string;
|
|
1739
|
+
reason: string;
|
|
1740
|
+
}
|
|
1741
|
+
declare class AgentTaskTurnError extends Error {
|
|
1742
|
+
readonly code: string | undefined;
|
|
1743
|
+
constructor(message: string, code?: string);
|
|
1744
|
+
}
|
|
1745
|
+
interface AgentTaskSessionEventMap {
|
|
1746
|
+
statusChange: {
|
|
1747
|
+
status: AgentTaskSessionStatus;
|
|
1748
|
+
};
|
|
1749
|
+
historyLoaded: {
|
|
1750
|
+
history: readonly AgentTimelineItem[];
|
|
1751
|
+
};
|
|
1752
|
+
taskCreated: {
|
|
1753
|
+
task: AgentTask;
|
|
1754
|
+
};
|
|
1755
|
+
turnStart: Record<string, never>;
|
|
1756
|
+
delta: {
|
|
1757
|
+
delta: string;
|
|
1758
|
+
kind: "text" | "thinking";
|
|
1759
|
+
};
|
|
1760
|
+
tool: AgentToolEvent;
|
|
1761
|
+
workspace: {
|
|
1762
|
+
payload: unknown;
|
|
1763
|
+
timestamp: number;
|
|
1764
|
+
};
|
|
1765
|
+
turnEnd: AgentTurnResult;
|
|
1766
|
+
cancelled: Record<string, never>;
|
|
1767
|
+
queueChange: {
|
|
1768
|
+
queue: readonly AgentQueueItem[];
|
|
1769
|
+
};
|
|
1770
|
+
error: {
|
|
1771
|
+
code?: string;
|
|
1772
|
+
error: string;
|
|
1773
|
+
};
|
|
1774
|
+
raw: AgentTaskEvent;
|
|
1775
|
+
}
|
|
1776
|
+
interface AgentTaskSession {
|
|
1777
|
+
readonly taskId: string | null;
|
|
1778
|
+
readonly task: AgentTask | null;
|
|
1779
|
+
readonly isNew: boolean;
|
|
1780
|
+
readonly status: AgentTaskSessionStatus;
|
|
1781
|
+
readonly history: readonly AgentTimelineItem[];
|
|
1782
|
+
readonly content: string;
|
|
1783
|
+
readonly queue: readonly AgentQueueItem[];
|
|
1784
|
+
send(prompt: string, options?: AgentSendOptions): void;
|
|
1785
|
+
sendAndWait(prompt: string, options?: AgentSendAndWaitOptions): Promise<AgentTurnResult>;
|
|
1786
|
+
cancel(): Promise<void>;
|
|
1787
|
+
respondApproval(approved: boolean): void;
|
|
1788
|
+
loadHistory(options?: {
|
|
1789
|
+
limit?: number;
|
|
1790
|
+
}): Promise<readonly AgentTimelineItem[]>;
|
|
1791
|
+
editQueueItem(id: string, text: string): void;
|
|
1792
|
+
removeQueueItem(id: string): void;
|
|
1793
|
+
clearQueue(): void;
|
|
1794
|
+
on<K extends keyof AgentTaskSessionEventMap>(event: K, handler: (payload: AgentTaskSessionEventMap[K]) => void): () => void;
|
|
1795
|
+
close(): void;
|
|
1796
|
+
}
|
|
1797
|
+
interface AgentTaskSessionManager {
|
|
1798
|
+
session(options: AgentTaskSessionOptions): AgentTaskSession;
|
|
1799
|
+
}
|
|
1800
|
+
type AgentTasksWithSessions = AgentTasksModule & AgentTaskSessionManager;
|
|
1801
|
+
interface AgentTaskSessionManagerOptions {
|
|
1802
|
+
tasks: AgentTasksModule;
|
|
1803
|
+
eventSource: AgentTaskEventSource;
|
|
1804
|
+
}
|
|
1805
|
+
declare function toAgentTimelineItem(message: AgentMessage): AgentTimelineItem;
|
|
1806
|
+
declare function createAgentTaskSessionManager(options: AgentTaskSessionManagerOptions): AgentTaskSessionManager;
|
|
1807
|
+
declare function withAgentTaskSessions(tasks: AgentTasksModule, manager: AgentTaskSessionManager): AgentTasksWithSessions;
|
|
1808
|
+
|
|
165
1809
|
declare function encodePathSegment(value: string | number, name: string, errors?: SdkCoreErrorFactory): string;
|
|
166
1810
|
|
|
167
1811
|
declare function expectObject<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory): T;
|
|
168
|
-
declare function expectObjectArray<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory): T[];
|
|
1812
|
+
declare function expectObjectArray<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): T[];
|
|
1813
|
+
declare function expectNullableObject<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory): T | null;
|
|
1814
|
+
declare function expectStringArray(value: unknown, context: string, errors?: SdkCoreErrorFactory): string[];
|
|
1815
|
+
declare function expectPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): Page<T>;
|
|
1816
|
+
declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
|
|
169
1817
|
declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
|
|
170
1818
|
|
|
171
|
-
export { type AuthModule, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityTable, type FunctionExecution, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type IntegrationModule, type InvocationType, type
|
|
1819
|
+
export { type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionsModule, type AgentCredentialsModule, type AgentDefinition, type AgentInput, type AgentMessage, type AgentModel, type AgentQueueItem, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentTask, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskListOptions, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentToolEvent, type AgentTurnResult, type AgentUpdateItem, type AgentsModule, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, toAgentTimelineItem, withAgentTaskSessions };
|