@isomorph.ai/app-sdk 1.33.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/computer-use.d.ts +2 -0
- package/dist/computer-use.js +5 -1
- package/dist/index.d.ts +64 -2
- package/dist/index.js +3 -0
- package/dist/integration-execute-input-rules.d.ts +130 -0
- package/dist/integration-execute-input-rules.js +42 -0
- package/dist/integration-operations.d.ts +35 -0
- package/dist/integration-operations.js +45 -0
- package/dist/jobs.d.ts +3 -2
- package/dist/jobs.js +6 -5
- package/dist/runtime.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -386,6 +386,7 @@ const computerUse = createComputerUseTool({ runKey: ctx.runId ?? `my-job/${ctx.s
|
|
|
386
386
|
- It calls `progress(step count, note)` on every new step and at least once a minute, so the job's lease does not run out.
|
|
387
387
|
- When `cancelled()` turns true it sends `POST /tasks/cancel` once and keeps checking until the task has `failed`.
|
|
388
388
|
- One task record per `runKey`: a retried job run sends the same key and gets the queued, running or finished task back. Only a failed task starts a new attempt.
|
|
389
|
+
- For a website account the owner has connected in the app, pass its opaque `connectionId` in the options. The SDK sends it only when starting the task, outside the model's tool arguments. The computer-use service verifies that the signed app role owns that connection; omit it for ordinary browser tasks.
|
|
389
390
|
|
|
390
391
|
(1.25.0; data plane ADR 0078)
|
|
391
392
|
|
package/dist/computer-use.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface ComputerUseFile {
|
|
|
6
6
|
export interface ComputerUseOptions {
|
|
7
7
|
/** App-authorized PDFs, at most five files and 2 MiB total. Never supplied by the model. */
|
|
8
8
|
files?: readonly ComputerUseFile[];
|
|
9
|
+
/** Owner-authorized browser session reference. Never supplied by the model. */
|
|
10
|
+
connectionId?: string;
|
|
9
11
|
/** The job's runId, or `<job name>/<scheduledAt>` for a scheduled job: one task record per job run. */
|
|
10
12
|
runKey: string;
|
|
11
13
|
/** The job's progress: called on each new step and at least once a minute, which renews the job's lease. */
|
package/dist/computer-use.js
CHANGED
|
@@ -8,6 +8,10 @@ const HEARTBEAT_MS = 60_000;
|
|
|
8
8
|
// Checks the API did not answer (a throttle, a 5xx, no connection) before the tool gives up: about a minute.
|
|
9
9
|
const MAX_MISSED_CHECKS = 12;
|
|
10
10
|
export function createComputerUseTool(options) {
|
|
11
|
+
const connectionId = options.connectionId;
|
|
12
|
+
if (connectionId !== undefined && (typeof connectionId !== 'string' || !/^[a-f0-9]{32}$/.test(connectionId))) {
|
|
13
|
+
throw new Error('Computer use needs a valid browser connection ID.');
|
|
14
|
+
}
|
|
11
15
|
const files = options.files?.map(file => ({ ...file }));
|
|
12
16
|
if (files) {
|
|
13
17
|
const names = new Set();
|
|
@@ -44,7 +48,7 @@ export function createComputerUseTool(options) {
|
|
|
44
48
|
description: 'Do one task in a web browser, such as filling in and submitting a form on a website. Describe the whole task in plain words, with the website address and any details it needs. Waits until the task ends and returns its status and a summary.',
|
|
45
49
|
inputSchema: jsonSchema({ type: 'object', properties: { task: { type: 'string', minLength: 1 } }, required: ['task'], additionalProperties: false }),
|
|
46
50
|
execute: async ({ task }) => {
|
|
47
|
-
const started = await call('/tasks', { run_key: options.runKey, task, ...(files?.length ? { files } : {}) });
|
|
51
|
+
const started = await call('/tasks', { run_key: options.runKey, task, ...(files?.length ? { files } : {}), ...(connectionId ? { connectionId } : {}) });
|
|
48
52
|
if (started.status !== 200)
|
|
49
53
|
throw refused('/tasks', started.status, started.body);
|
|
50
54
|
await options.progress(0, 'Computer use task started.');
|
package/dist/index.d.ts
CHANGED
|
@@ -1114,18 +1114,25 @@ export interface BooksLineInput {
|
|
|
1114
1114
|
export interface BooksBillLineInput extends BooksLineInput {
|
|
1115
1115
|
purchaseOrderItemId?: string;
|
|
1116
1116
|
}
|
|
1117
|
+
export interface BooksInvoiceLineInput extends BooksLineInput {
|
|
1118
|
+
salesOrderItemId?: string;
|
|
1119
|
+
}
|
|
1117
1120
|
export interface BooksDocument {
|
|
1118
1121
|
id: string;
|
|
1119
1122
|
number: string;
|
|
1120
1123
|
status: string;
|
|
1121
1124
|
currency: string;
|
|
1122
1125
|
total: string;
|
|
1126
|
+
referenceNumber?: string;
|
|
1123
1127
|
vendorId?: string;
|
|
1124
1128
|
customerId?: string;
|
|
1125
1129
|
lineItems: {
|
|
1126
1130
|
itemId: string;
|
|
1127
1131
|
lineItemId?: string;
|
|
1128
1132
|
purchaseOrderItemId?: string;
|
|
1133
|
+
sku?: string;
|
|
1134
|
+
taxId?: string;
|
|
1135
|
+
isInvoiced?: boolean;
|
|
1129
1136
|
quantity: string;
|
|
1130
1137
|
rate: string;
|
|
1131
1138
|
total: string;
|
|
@@ -1146,6 +1153,43 @@ export type ZohoBooksRequest = {
|
|
|
1146
1153
|
vendorId: string;
|
|
1147
1154
|
pageToken?: string;
|
|
1148
1155
|
};
|
|
1156
|
+
} | {
|
|
1157
|
+
operation: 'zohobooks.salesorder.list';
|
|
1158
|
+
resource: 'organization';
|
|
1159
|
+
input: {
|
|
1160
|
+
customerId: string;
|
|
1161
|
+
pageToken?: string;
|
|
1162
|
+
};
|
|
1163
|
+
} | {
|
|
1164
|
+
operation: 'zohobooks.salesorder.read' | 'zohobooks.creditnote.read';
|
|
1165
|
+
resource: 'organization';
|
|
1166
|
+
input: {
|
|
1167
|
+
documentId: string;
|
|
1168
|
+
};
|
|
1169
|
+
} | {
|
|
1170
|
+
operation: 'zohobooks.invoice.reviseDraft';
|
|
1171
|
+
resource: 'organization';
|
|
1172
|
+
idempotencyKey: string;
|
|
1173
|
+
input: {
|
|
1174
|
+
documentId: string;
|
|
1175
|
+
lineItems: {
|
|
1176
|
+
lineItemId: string;
|
|
1177
|
+
quantity: string;
|
|
1178
|
+
}[];
|
|
1179
|
+
};
|
|
1180
|
+
} | {
|
|
1181
|
+
operation: 'zohobooks.creditnote.create';
|
|
1182
|
+
resource: 'organization';
|
|
1183
|
+
idempotencyKey: string;
|
|
1184
|
+
input: {
|
|
1185
|
+
documentId: string;
|
|
1186
|
+
documentDate: string;
|
|
1187
|
+
referenceNumber?: string;
|
|
1188
|
+
lineItems: {
|
|
1189
|
+
lineItemId: string;
|
|
1190
|
+
quantity: string;
|
|
1191
|
+
}[];
|
|
1192
|
+
};
|
|
1149
1193
|
} | {
|
|
1150
1194
|
operation: 'zohobooks.purchaseorder.read';
|
|
1151
1195
|
resource: 'organization';
|
|
@@ -1178,7 +1222,7 @@ export type ZohoBooksRequest = {
|
|
|
1178
1222
|
documentDate: string;
|
|
1179
1223
|
documentNumber?: string;
|
|
1180
1224
|
referenceNumber?: string;
|
|
1181
|
-
lineItems:
|
|
1225
|
+
lineItems: BooksInvoiceLineInput[];
|
|
1182
1226
|
};
|
|
1183
1227
|
};
|
|
1184
1228
|
export type IntegrationRequest = ZohoBooksRequest | ServiceRequest | SlackChannelHistoryRequest | SlackMessagePostRequest | SlackMessageUpdateRequest | SlackMessageDeleteRequest | SlackDmSendRequest | SlackUserLookupRequest | WarehouseViewReadRequest | WarehouseTableAppendRequest | PhoneSmsListRequest | PhoneNumberGetRequest | GmailThreadListRequest | GmailThreadReadRequest | GmailMessageReadRequest | GmailAttachmentReadRequest | GmailMessageSendRequest | BasecampProjectListRequest | BasecampTodolistListRequest | BasecampTodoListRequest | BasecampTodoCreateRequest | BasecampTodoCompleteRequest | BasecampMessageListRequest | BasecampMessagePostRequest | BasecampCommentListRequest | BasecampCommentPostRequest | BasecampCampfirePostRequest | BasecampPeopleListRequest | SharePointListListRequest | SharePointItemListRequest | SharePointItemCreateRequest | SharePointItemUpdateRequest | SharePointDriveListRequest | SharePointFileListRequest | SharePointFileSearchRequest | SharePointFileReadRequest | SharePointFileUploadRequest | CalendarCalendarListRequest | CalendarEventListRequest | CalendarEventReadRequest | CalendarEventCreateRequest | CalendarEventUpdateRequest | CalendarEventCancelRequest | DriveFileListRequest | DriveFileSearchRequest | DriveFileReadRequest | DriveFileUploadRequest | DriveFolderCreateRequest | DocsDocumentReadRequest | DocsDocumentCreateRequest | DocsDocumentAppendRequest | DocsTextReplaceRequest | SheetsSpreadsheetReadRequest | SheetsValuesReadRequest | SheetsValuesAppendRequest | SheetsValuesUpdateRequest | SheetsValuesClearRequest | SheetsSpreadsheetCreateRequest | OutlookMessageListRequest | OutlookMessageReadRequest | OutlookAttachmentReadRequest | OutlookMessageSendRequest | OutlookMessageReplyRequest | OutlookEventListRequest | OutlookEventReadRequest | OutlookEventCreateRequest | OutlookEventUpdateRequest | OutlookEventCancelRequest | OneDriveFileListRequest | OneDriveFileSearchRequest | OneDriveFileReadRequest | OneDriveFileUploadRequest | OneDriveFolderCreateRequest | ExcelWorksheetListRequest | ExcelRangeReadRequest | ExcelRangeUpdateRequest | ExcelTableListRequest | ExcelRowAddRequest | ExcelWorksheetAddRequest | TeamsMessageListRequest | TeamsMessagePostRequest | TeamsReplyPostRequest;
|
|
@@ -1685,6 +1729,12 @@ export type IntegrationResult<R extends IntegrationRequest> = R extends {
|
|
|
1685
1729
|
}[];
|
|
1686
1730
|
hasMore: boolean;
|
|
1687
1731
|
nextPageToken?: string;
|
|
1732
|
+
} : R extends {
|
|
1733
|
+
operation: 'zohobooks.salesorder.list';
|
|
1734
|
+
} ? {
|
|
1735
|
+
booksSalesOrders: BooksDocument[];
|
|
1736
|
+
hasMore: boolean;
|
|
1737
|
+
nextPageToken?: string;
|
|
1688
1738
|
} : R extends {
|
|
1689
1739
|
operation: 'zohobooks.purchaseorder.list';
|
|
1690
1740
|
} ? {
|
|
@@ -1694,7 +1744,7 @@ export type IntegrationResult<R extends IntegrationRequest> = R extends {
|
|
|
1694
1744
|
} : R extends {
|
|
1695
1745
|
operation: 'zohobooks.invoice.pdf';
|
|
1696
1746
|
} ? GmailAttachmentReadResult : R extends {
|
|
1697
|
-
operation: 'zohobooks.bill.create' | 'zohobooks.invoice.create';
|
|
1747
|
+
operation: 'zohobooks.bill.create' | 'zohobooks.invoice.create' | 'zohobooks.invoice.reviseDraft' | 'zohobooks.creditnote.create';
|
|
1698
1748
|
} ? {
|
|
1699
1749
|
id: string;
|
|
1700
1750
|
} : R extends ZohoBooksRequest ? {
|
|
@@ -1935,6 +1985,11 @@ export declare function createClient(options?: ClientOptions): {
|
|
|
1935
1985
|
}) => Promise<T>;
|
|
1936
1986
|
};
|
|
1937
1987
|
jobs: {
|
|
1988
|
+
/** Select the owner's folder for a declared configurable file trigger. */
|
|
1989
|
+
configureTrigger: (name: string, configuration: {
|
|
1990
|
+
folderId: string;
|
|
1991
|
+
}) => Promise<JobTriggerStatus>;
|
|
1992
|
+
getTrigger: (name: string) => Promise<JobTriggerStatus>;
|
|
1938
1993
|
enqueue: (name: string, input?: unknown) => Promise<{
|
|
1939
1994
|
id: string;
|
|
1940
1995
|
}>;
|
|
@@ -1972,6 +2027,13 @@ export type HarbourResult<T> = IsomorphResult<T>;
|
|
|
1972
2027
|
export type HarbourClient = IsomorphClient;
|
|
1973
2028
|
/** @deprecated Internal transformation lane only; a kit app uses IsomorphCompatSource. */
|
|
1974
2029
|
export type HarbourCompatSource = import('./supabase-compat.js').IsomorphCompatSource;
|
|
2030
|
+
/** Owner-selected folder; activation still requires the owner's background consent. */
|
|
2031
|
+
export interface JobTriggerStatus {
|
|
2032
|
+
name: string;
|
|
2033
|
+
folderId?: string;
|
|
2034
|
+
state: 'configured' | 'unconfigured';
|
|
2035
|
+
updatedAt?: string;
|
|
2036
|
+
}
|
|
1975
2037
|
/** Provider file metadata delivered to a file.created job; bytes are read through its connection. */
|
|
1976
2038
|
export interface FileArrivalInput {
|
|
1977
2039
|
type: 'file.created';
|
package/dist/index.js
CHANGED
|
@@ -785,6 +785,9 @@ export function createClient(options = {}) {
|
|
|
785
785
|
},
|
|
786
786
|
},
|
|
787
787
|
jobs: {
|
|
788
|
+
/** Select the owner's folder for a declared configurable file trigger. */
|
|
789
|
+
configureTrigger: (name, configuration) => transport.json('/_harbour/integrations/trigger-config', { method: 'POST', body: JSON.stringify({ name, configuration }) }),
|
|
790
|
+
getTrigger: (name) => transport.json('/_harbour/integrations/trigger-config', { method: 'POST', body: JSON.stringify({ name }) }),
|
|
788
791
|
enqueue: (name, input) => transport.json('/_harbour/actions/isomorph-jobs-enqueue', { method: 'POST', body: JSON.stringify({ name, input: input ?? null }) }),
|
|
789
792
|
get: (id) => transport.json('/_harbour/actions/isomorph-jobs-get', { method: 'POST', body: JSON.stringify({ id }) }),
|
|
790
793
|
cancel: (id) => transport.json('/_harbour/actions/isomorph-jobs-cancel', { method: 'POST', body: JSON.stringify({ id }) }),
|
|
@@ -2386,6 +2386,13 @@ export declare const IntegrationExecuteInputRules: {
|
|
|
2386
2386
|
readonly minLength: 0;
|
|
2387
2387
|
readonly maxLength: 2000;
|
|
2388
2388
|
};
|
|
2389
|
+
readonly salesOrderItemId: {
|
|
2390
|
+
readonly kind: "string";
|
|
2391
|
+
readonly required: false;
|
|
2392
|
+
readonly minLength: 0;
|
|
2393
|
+
readonly maxLength: 32;
|
|
2394
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2395
|
+
};
|
|
2389
2396
|
};
|
|
2390
2397
|
};
|
|
2391
2398
|
};
|
|
@@ -2414,6 +2421,129 @@ export declare const IntegrationExecuteInputRules: {
|
|
|
2414
2421
|
};
|
|
2415
2422
|
};
|
|
2416
2423
|
};
|
|
2424
|
+
readonly "zohobooks.salesorder.list": {
|
|
2425
|
+
readonly idempotencyKey: false;
|
|
2426
|
+
readonly fields: {
|
|
2427
|
+
readonly customerId: {
|
|
2428
|
+
readonly kind: "string";
|
|
2429
|
+
readonly required: true;
|
|
2430
|
+
readonly minLength: 0;
|
|
2431
|
+
readonly maxLength: 32;
|
|
2432
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2433
|
+
};
|
|
2434
|
+
readonly pageToken: {
|
|
2435
|
+
readonly kind: "string";
|
|
2436
|
+
readonly required: false;
|
|
2437
|
+
readonly minLength: 1;
|
|
2438
|
+
readonly maxLength: 2048;
|
|
2439
|
+
};
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
readonly "zohobooks.salesorder.read": {
|
|
2443
|
+
readonly idempotencyKey: false;
|
|
2444
|
+
readonly fields: {
|
|
2445
|
+
readonly documentId: {
|
|
2446
|
+
readonly kind: "string";
|
|
2447
|
+
readonly required: true;
|
|
2448
|
+
readonly minLength: 0;
|
|
2449
|
+
readonly maxLength: 32;
|
|
2450
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
};
|
|
2454
|
+
readonly "zohobooks.invoice.reviseDraft": {
|
|
2455
|
+
readonly idempotencyKey: true;
|
|
2456
|
+
readonly fields: {
|
|
2457
|
+
readonly documentId: {
|
|
2458
|
+
readonly kind: "string";
|
|
2459
|
+
readonly required: true;
|
|
2460
|
+
readonly minLength: 0;
|
|
2461
|
+
readonly maxLength: 32;
|
|
2462
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2463
|
+
};
|
|
2464
|
+
readonly lineItems: {
|
|
2465
|
+
readonly kind: "object[]";
|
|
2466
|
+
readonly required: true;
|
|
2467
|
+
readonly minItems: 1;
|
|
2468
|
+
readonly maxItems: 100;
|
|
2469
|
+
readonly fields: {
|
|
2470
|
+
readonly lineItemId: {
|
|
2471
|
+
readonly kind: "string";
|
|
2472
|
+
readonly required: true;
|
|
2473
|
+
readonly minLength: 0;
|
|
2474
|
+
readonly maxLength: 32;
|
|
2475
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2476
|
+
};
|
|
2477
|
+
readonly quantity: {
|
|
2478
|
+
readonly kind: "string";
|
|
2479
|
+
readonly required: true;
|
|
2480
|
+
readonly minLength: 0;
|
|
2481
|
+
readonly maxLength: 17;
|
|
2482
|
+
readonly pattern: "^[0-9]{1,10}(\\.[0-9]{1,6})?$";
|
|
2483
|
+
};
|
|
2484
|
+
};
|
|
2485
|
+
};
|
|
2486
|
+
};
|
|
2487
|
+
};
|
|
2488
|
+
readonly "zohobooks.creditnote.create": {
|
|
2489
|
+
readonly idempotencyKey: true;
|
|
2490
|
+
readonly fields: {
|
|
2491
|
+
readonly documentId: {
|
|
2492
|
+
readonly kind: "string";
|
|
2493
|
+
readonly required: true;
|
|
2494
|
+
readonly minLength: 0;
|
|
2495
|
+
readonly maxLength: 32;
|
|
2496
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2497
|
+
};
|
|
2498
|
+
readonly documentDate: {
|
|
2499
|
+
readonly kind: "string";
|
|
2500
|
+
readonly required: true;
|
|
2501
|
+
readonly minLength: 0;
|
|
2502
|
+
readonly maxLength: 10;
|
|
2503
|
+
readonly pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
|
|
2504
|
+
};
|
|
2505
|
+
readonly referenceNumber: {
|
|
2506
|
+
readonly kind: "string";
|
|
2507
|
+
readonly required: false;
|
|
2508
|
+
readonly minLength: 1;
|
|
2509
|
+
readonly maxLength: 100;
|
|
2510
|
+
};
|
|
2511
|
+
readonly lineItems: {
|
|
2512
|
+
readonly kind: "object[]";
|
|
2513
|
+
readonly required: true;
|
|
2514
|
+
readonly minItems: 1;
|
|
2515
|
+
readonly maxItems: 100;
|
|
2516
|
+
readonly fields: {
|
|
2517
|
+
readonly lineItemId: {
|
|
2518
|
+
readonly kind: "string";
|
|
2519
|
+
readonly required: true;
|
|
2520
|
+
readonly minLength: 0;
|
|
2521
|
+
readonly maxLength: 32;
|
|
2522
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2523
|
+
};
|
|
2524
|
+
readonly quantity: {
|
|
2525
|
+
readonly kind: "string";
|
|
2526
|
+
readonly required: true;
|
|
2527
|
+
readonly minLength: 0;
|
|
2528
|
+
readonly maxLength: 17;
|
|
2529
|
+
readonly pattern: "^[0-9]{1,10}(\\.[0-9]{1,6})?$";
|
|
2530
|
+
};
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
};
|
|
2534
|
+
};
|
|
2535
|
+
readonly "zohobooks.creditnote.read": {
|
|
2536
|
+
readonly idempotencyKey: false;
|
|
2537
|
+
readonly fields: {
|
|
2538
|
+
readonly documentId: {
|
|
2539
|
+
readonly kind: "string";
|
|
2540
|
+
readonly required: true;
|
|
2541
|
+
readonly minLength: 0;
|
|
2542
|
+
readonly maxLength: 32;
|
|
2543
|
+
readonly pattern: "^[0-9]{1,32}$";
|
|
2544
|
+
};
|
|
2545
|
+
};
|
|
2546
|
+
};
|
|
2417
2547
|
};
|
|
2418
2548
|
export type IntegrationExecuteOperation = keyof typeof IntegrationExecuteInputRules;
|
|
2419
2549
|
/** The upper bound of one integer input as a literal type: integrationExecuteInputMaximum('slack.channel.history', 'limit') is 15. */
|
|
@@ -729,6 +729,7 @@ export const IntegrationExecuteInputRules = {
|
|
|
729
729
|
rate: { kind: "string", required: true, minLength: 0, maxLength: 17, pattern: "^[0-9]{1,10}(\\.[0-9]{1,6})?$" },
|
|
730
730
|
taxId: { kind: "string", required: false, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
731
731
|
description: { kind: "string", required: false, minLength: 0, maxLength: 2000 },
|
|
732
|
+
salesOrderItemId: { kind: "string", required: false, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
732
733
|
} },
|
|
733
734
|
},
|
|
734
735
|
},
|
|
@@ -744,6 +745,47 @@ export const IntegrationExecuteInputRules = {
|
|
|
744
745
|
documentId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
745
746
|
},
|
|
746
747
|
},
|
|
748
|
+
"zohobooks.salesorder.list": {
|
|
749
|
+
idempotencyKey: false,
|
|
750
|
+
fields: {
|
|
751
|
+
customerId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
752
|
+
pageToken: { kind: "string", required: false, minLength: 1, maxLength: 2048 },
|
|
753
|
+
},
|
|
754
|
+
},
|
|
755
|
+
"zohobooks.salesorder.read": {
|
|
756
|
+
idempotencyKey: false,
|
|
757
|
+
fields: {
|
|
758
|
+
documentId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
"zohobooks.invoice.reviseDraft": {
|
|
762
|
+
idempotencyKey: true,
|
|
763
|
+
fields: {
|
|
764
|
+
documentId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
765
|
+
lineItems: { kind: "object[]", required: true, minItems: 1, maxItems: 100, fields: {
|
|
766
|
+
lineItemId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
767
|
+
quantity: { kind: "string", required: true, minLength: 0, maxLength: 17, pattern: "^[0-9]{1,10}(\\.[0-9]{1,6})?$" },
|
|
768
|
+
} },
|
|
769
|
+
},
|
|
770
|
+
},
|
|
771
|
+
"zohobooks.creditnote.create": {
|
|
772
|
+
idempotencyKey: true,
|
|
773
|
+
fields: {
|
|
774
|
+
documentId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
775
|
+
documentDate: { kind: "string", required: true, minLength: 0, maxLength: 10, pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
|
|
776
|
+
referenceNumber: { kind: "string", required: false, minLength: 1, maxLength: 100 },
|
|
777
|
+
lineItems: { kind: "object[]", required: true, minItems: 1, maxItems: 100, fields: {
|
|
778
|
+
lineItemId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
779
|
+
quantity: { kind: "string", required: true, minLength: 0, maxLength: 17, pattern: "^[0-9]{1,10}(\\.[0-9]{1,6})?$" },
|
|
780
|
+
} },
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
"zohobooks.creditnote.read": {
|
|
784
|
+
idempotencyKey: false,
|
|
785
|
+
fields: {
|
|
786
|
+
documentId: { kind: "string", required: true, minLength: 0, maxLength: 32, pattern: "^[0-9]{1,32}$" },
|
|
787
|
+
},
|
|
788
|
+
},
|
|
747
789
|
};
|
|
748
790
|
/** The upper bound of one integer input as a literal type: integrationExecuteInputMaximum('slack.channel.history', 'limit') is 15. */
|
|
749
791
|
export function integrationExecuteInputMaximum(operation, field) {
|
|
@@ -623,4 +623,39 @@ export declare const IntegrationOperations: {
|
|
|
623
623
|
readonly declaredMode: false;
|
|
624
624
|
readonly idempotencyKey: false;
|
|
625
625
|
};
|
|
626
|
+
readonly "zohobooks.salesorder.list": {
|
|
627
|
+
readonly kind: "saas";
|
|
628
|
+
readonly identities: readonly ["user"];
|
|
629
|
+
readonly readOnly: true;
|
|
630
|
+
readonly declaredMode: false;
|
|
631
|
+
readonly idempotencyKey: false;
|
|
632
|
+
};
|
|
633
|
+
readonly "zohobooks.salesorder.read": {
|
|
634
|
+
readonly kind: "saas";
|
|
635
|
+
readonly identities: readonly ["user"];
|
|
636
|
+
readonly readOnly: true;
|
|
637
|
+
readonly declaredMode: false;
|
|
638
|
+
readonly idempotencyKey: false;
|
|
639
|
+
};
|
|
640
|
+
readonly "zohobooks.invoice.reviseDraft": {
|
|
641
|
+
readonly kind: "saas";
|
|
642
|
+
readonly identities: readonly ["user"];
|
|
643
|
+
readonly readOnly: false;
|
|
644
|
+
readonly declaredMode: false;
|
|
645
|
+
readonly idempotencyKey: true;
|
|
646
|
+
};
|
|
647
|
+
readonly "zohobooks.creditnote.create": {
|
|
648
|
+
readonly kind: "saas";
|
|
649
|
+
readonly identities: readonly ["user"];
|
|
650
|
+
readonly readOnly: false;
|
|
651
|
+
readonly declaredMode: false;
|
|
652
|
+
readonly idempotencyKey: true;
|
|
653
|
+
};
|
|
654
|
+
readonly "zohobooks.creditnote.read": {
|
|
655
|
+
readonly kind: "saas";
|
|
656
|
+
readonly identities: readonly ["user"];
|
|
657
|
+
readonly readOnly: true;
|
|
658
|
+
readonly declaredMode: false;
|
|
659
|
+
readonly idempotencyKey: false;
|
|
660
|
+
};
|
|
626
661
|
};
|
|
@@ -806,5 +806,50 @@ export const IntegrationOperations = {
|
|
|
806
806
|
"readOnly": true,
|
|
807
807
|
"declaredMode": false,
|
|
808
808
|
"idempotencyKey": false
|
|
809
|
+
},
|
|
810
|
+
"zohobooks.salesorder.list": {
|
|
811
|
+
"kind": "saas",
|
|
812
|
+
"identities": [
|
|
813
|
+
"user"
|
|
814
|
+
],
|
|
815
|
+
"readOnly": true,
|
|
816
|
+
"declaredMode": false,
|
|
817
|
+
"idempotencyKey": false
|
|
818
|
+
},
|
|
819
|
+
"zohobooks.salesorder.read": {
|
|
820
|
+
"kind": "saas",
|
|
821
|
+
"identities": [
|
|
822
|
+
"user"
|
|
823
|
+
],
|
|
824
|
+
"readOnly": true,
|
|
825
|
+
"declaredMode": false,
|
|
826
|
+
"idempotencyKey": false
|
|
827
|
+
},
|
|
828
|
+
"zohobooks.invoice.reviseDraft": {
|
|
829
|
+
"kind": "saas",
|
|
830
|
+
"identities": [
|
|
831
|
+
"user"
|
|
832
|
+
],
|
|
833
|
+
"readOnly": false,
|
|
834
|
+
"declaredMode": false,
|
|
835
|
+
"idempotencyKey": true
|
|
836
|
+
},
|
|
837
|
+
"zohobooks.creditnote.create": {
|
|
838
|
+
"kind": "saas",
|
|
839
|
+
"identities": [
|
|
840
|
+
"user"
|
|
841
|
+
],
|
|
842
|
+
"readOnly": false,
|
|
843
|
+
"declaredMode": false,
|
|
844
|
+
"idempotencyKey": true
|
|
845
|
+
},
|
|
846
|
+
"zohobooks.creditnote.read": {
|
|
847
|
+
"kind": "saas",
|
|
848
|
+
"identities": [
|
|
849
|
+
"user"
|
|
850
|
+
],
|
|
851
|
+
"readOnly": true,
|
|
852
|
+
"declaredMode": false,
|
|
853
|
+
"idempotencyKey": false
|
|
809
854
|
}
|
|
810
855
|
};
|
package/dist/jobs.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ export interface EmailArrivalTrigger {
|
|
|
8
8
|
subjectContains?: string;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export declare const FILE_MIME_TYPES: readonly ["application/pdf", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
|
|
11
|
+
export declare const FILE_MIME_TYPES: readonly ["application/pdf", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "image/png", "image/jpeg"];
|
|
12
12
|
export declare const providerFileId: (value: unknown) => value is string;
|
|
13
13
|
export interface FileCreatedTrigger {
|
|
14
14
|
type: 'file.created';
|
|
15
15
|
connection: string;
|
|
16
16
|
resource: string;
|
|
17
|
-
folderId
|
|
17
|
+
folderId?: string;
|
|
18
|
+
configurableFolder?: true;
|
|
18
19
|
driveId?: string;
|
|
19
20
|
mimeTypes?: string[];
|
|
20
21
|
}
|
package/dist/jobs.js
CHANGED
|
@@ -6,7 +6,7 @@ import { stripTypeScriptTypes } from 'node:module';
|
|
|
6
6
|
import { parse } from 'acorn';
|
|
7
7
|
export const JOBS_DIR = 'jobs';
|
|
8
8
|
const LOGICAL_NAME = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
9
|
-
export const FILE_MIME_TYPES = ['application/pdf', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
|
|
9
|
+
export const FILE_MIME_TYPES = ['application/pdf', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'image/png', 'image/jpeg'];
|
|
10
10
|
export const providerFileId = (value) => typeof value === 'string' && /^[A-Za-z0-9!._,=-]{1,256}$/.test(value);
|
|
11
11
|
function literalObject(node) {
|
|
12
12
|
const value = node;
|
|
@@ -30,12 +30,13 @@ function literalObject(node) {
|
|
|
30
30
|
export function eventTrigger(value) {
|
|
31
31
|
if (value?.type === 'file.created') {
|
|
32
32
|
const t = value;
|
|
33
|
-
if (Object.keys(t).some(k => !['type', 'connection', 'resource', 'folderId', 'driveId', 'mimeTypes'].includes(k))
|
|
33
|
+
if (Object.keys(t).some(k => !['type', 'connection', 'resource', 'folderId', 'configurableFolder', 'driveId', 'mimeTypes'].includes(k))
|
|
34
34
|
|| typeof t.connection !== 'string' || !LOGICAL_NAME.test(t.connection)
|
|
35
35
|
|| typeof t.resource !== 'string' || !t.resource.trim() || t.resource.length > 320
|
|
36
|
-
||
|
|
37
|
-
|| (t.
|
|
38
|
-
|
|
36
|
+
|| (t.configurableFolder !== undefined && t.configurableFolder !== true)
|
|
37
|
+
|| (t.folderId === undefined ? t.configurableFolder !== true : !providerFileId(t.folderId)) || (t.driveId !== undefined && !providerFileId(t.driveId))
|
|
38
|
+
|| (t.mimeTypes !== undefined && (!Array.isArray(t.mimeTypes) || !t.mimeTypes.length || t.mimeTypes.length > FILE_MIME_TYPES.length || new Set(t.mimeTypes).size !== t.mimeTypes.length || t.mimeTypes.some(m => !FILE_MIME_TYPES.includes(m)))))
|
|
39
|
+
throw new Error('file.created requires a connection, resource, folder ID and optional PDF/XLSX/PNG/JPEG MIME types');
|
|
39
40
|
return t;
|
|
40
41
|
}
|
|
41
42
|
const trigger = value;
|
package/dist/runtime.js
CHANGED
|
@@ -395,7 +395,7 @@ export class Runtime {
|
|
|
395
395
|
if (job.trigger.type === 'file.created') {
|
|
396
396
|
const instant = (v) => typeof v === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(v) && Number.isFinite(Date.parse(v));
|
|
397
397
|
if (Object.keys(input).some(k => !['type', 'provider', 'sourceId', 'fileId', 'folderId', 'driveId', 'name', 'mimeType', 'size', 'createdAt', 'observedAt'].includes(k))
|
|
398
|
-
|| input.type !== 'file.created' || !['drive', 'sharepoint'].includes(String(input.provider)) || !providerFileId(input.fileId) || input.folderId !== job.trigger.folderId
|
|
398
|
+
|| input.type !== 'file.created' || !['drive', 'sharepoint'].includes(String(input.provider)) || !providerFileId(input.fileId) || !providerFileId(input.folderId) || (!job.trigger.configurableFolder && input.folderId !== job.trigger.folderId)
|
|
399
399
|
|| (input.driveId !== undefined && !providerFileId(input.driveId)) || (input.provider === 'sharepoint' && !input.driveId)
|
|
400
400
|
|| (job.trigger.driveId !== undefined && input.driveId !== job.trigger.driveId)
|
|
401
401
|
|| typeof input.name !== 'string' || !input.name || input.name.length > 1024 || !Number.isSafeInteger(input.size) || Number(input.size) < 0
|