@zapier/zapier-sdk 0.34.1 → 0.36.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 +12 -0
- package/README.md +341 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +10 -2
- package/dist/api/types.d.ts +2 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +1 -0
- package/dist/formatters/tableRecord.d.ts +6 -0
- package/dist/formatters/tableRecord.d.ts.map +1 -0
- package/dist/formatters/tableRecord.js +23 -0
- package/dist/index.cjs +2054 -191
- package/dist/index.d.mts +639 -59
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.mjs +2030 -192
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +1 -1
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +2 -1
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +5 -2
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +6 -4
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +6 -4
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +2 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +2 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +4 -0
- package/dist/plugins/runAction/index.d.ts +2 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +73 -14
- package/dist/plugins/tables/createTable/index.d.ts +18 -0
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -0
- package/dist/plugins/tables/createTable/index.js +48 -0
- package/dist/plugins/tables/createTable/schemas.d.ts +37 -0
- package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/createTable/schemas.js +16 -0
- package/dist/plugins/tables/createTableFields/index.d.ts +18 -0
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -0
- package/dist/plugins/tables/createTableFields/index.js +49 -0
- package/dist/plugins/tables/createTableFields/schemas.d.ts +192 -0
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/createTableFields/schemas.js +42 -0
- package/dist/plugins/tables/createTableRecords/index.d.ts +18 -0
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -0
- package/dist/plugins/tables/createTableRecords/index.js +67 -0
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +57 -0
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/createTableRecords/schemas.js +35 -0
- package/dist/plugins/tables/deleteTable/index.d.ts +18 -0
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTable/index.js +43 -0
- package/dist/plugins/tables/deleteTable/schemas.d.ts +15 -0
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTable/schemas.js +9 -0
- package/dist/plugins/tables/deleteTableFields/index.d.ts +18 -0
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTableFields/index.js +50 -0
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +16 -0
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTableFields/schemas.js +13 -0
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +18 -0
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTableRecords/index.js +44 -0
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +16 -0
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/deleteTableRecords/schemas.js +14 -0
- package/dist/plugins/tables/getTable/index.d.ts +20 -0
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -0
- package/dist/plugins/tables/getTable/index.js +48 -0
- package/dist/plugins/tables/getTable/schemas.d.ts +34 -0
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/getTable/schemas.js +15 -0
- package/dist/plugins/tables/getTableRecord/index.d.ts +18 -0
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -0
- package/dist/plugins/tables/getTableRecord/index.js +60 -0
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +51 -0
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/getTableRecord/schemas.js +44 -0
- package/dist/plugins/tables/listTableFields/index.d.ts +18 -0
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -0
- package/dist/plugins/tables/listTableFields/index.js +58 -0
- package/dist/plugins/tables/listTableFields/schemas.d.ts +180 -0
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/listTableFields/schemas.js +77 -0
- package/dist/plugins/tables/listTableRecords/index.d.ts +24 -0
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -0
- package/dist/plugins/tables/listTableRecords/index.js +97 -0
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +120 -0
- package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/listTableRecords/schemas.js +74 -0
- package/dist/plugins/tables/listTables/index.d.ts +24 -0
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -0
- package/dist/plugins/tables/listTables/index.js +85 -0
- package/dist/plugins/tables/listTables/schemas.d.ts +78 -0
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/listTables/schemas.js +63 -0
- package/dist/plugins/tables/updateTableRecords/index.d.ts +18 -0
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -0
- package/dist/plugins/tables/updateTableRecords/index.js +68 -0
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +59 -0
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -0
- package/dist/plugins/tables/updateTableRecords/schemas.js +35 -0
- package/dist/plugins/tables/utils.d.ts +63 -0
- package/dist/plugins/tables/utils.d.ts.map +1 -0
- package/dist/plugins/tables/utils.js +262 -0
- package/dist/resolvers/index.d.ts +8 -0
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +8 -0
- package/dist/resolvers/tableFieldIds.d.ts +6 -0
- package/dist/resolvers/tableFieldIds.d.ts.map +1 -0
- package/dist/resolvers/tableFieldIds.js +19 -0
- package/dist/resolvers/tableFields.d.ts +3 -0
- package/dist/resolvers/tableFields.d.ts.map +1 -0
- package/dist/resolvers/tableFields.js +31 -0
- package/dist/resolvers/tableFilters.d.ts +5 -0
- package/dist/resolvers/tableFilters.d.ts.map +1 -0
- package/dist/resolvers/tableFilters.js +74 -0
- package/dist/resolvers/tableId.d.ts +4 -0
- package/dist/resolvers/tableId.d.ts.map +1 -0
- package/dist/resolvers/tableId.js +19 -0
- package/dist/resolvers/tableName.d.ts +3 -0
- package/dist/resolvers/tableName.d.ts.map +1 -0
- package/dist/resolvers/tableName.js +5 -0
- package/dist/resolvers/tableRecordId.d.ts +9 -0
- package/dist/resolvers/tableRecordId.d.ts.map +1 -0
- package/dist/resolvers/tableRecordId.js +48 -0
- package/dist/resolvers/tableRecords.d.ts +8 -0
- package/dist/resolvers/tableRecords.d.ts.map +1 -0
- package/dist/resolvers/tableRecords.js +77 -0
- package/dist/resolvers/tableSort.d.ts +5 -0
- package/dist/resolvers/tableSort.d.ts.map +1 -0
- package/dist/resolvers/tableSort.js +43 -0
- package/dist/sdk.d.ts +73 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +25 -0
- package/dist/types/sdk.d.ts +16 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/function-utils.d.ts +2 -2
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +2 -3
- package/dist/utils/pagination-utils.d.ts +24 -0
- package/dist/utils/pagination-utils.d.ts.map +1 -1
- package/dist/utils/pagination-utils.js +78 -0
- package/dist/utils/schema-utils.d.ts +33 -5
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -34,6 +34,19 @@
|
|
|
34
34
|
- [`listConnections`](#listconnections)
|
|
35
35
|
- [HTTP Requests](#http-requests)
|
|
36
36
|
- [`fetch`](#fetch)
|
|
37
|
+
- [Tables](#tables)
|
|
38
|
+
- [`createTable`](#createtable)
|
|
39
|
+
- [`createTableFields`](#createtablefields)
|
|
40
|
+
- [`createTableRecords`](#createtablerecords)
|
|
41
|
+
- [`deleteTable`](#deletetable)
|
|
42
|
+
- [`deleteTableFields`](#deletetablefields)
|
|
43
|
+
- [`deleteTableRecords`](#deletetablerecords)
|
|
44
|
+
- [`getTable`](#gettable)
|
|
45
|
+
- [`getTableRecord`](#gettablerecord)
|
|
46
|
+
- [`listTableFields`](#listtablefields)
|
|
47
|
+
- [`listTableRecords`](#listtablerecords)
|
|
48
|
+
- [`listTables`](#listtables)
|
|
49
|
+
- [`updateTableRecords`](#updatetablerecords)
|
|
37
50
|
|
|
38
51
|
## Closed Beta
|
|
39
52
|
|
|
@@ -916,3 +929,331 @@ Make authenticated HTTP requests to any API through Zapier. Pass a connectionId
|
|
|
916
929
|
```typescript
|
|
917
930
|
const result = await zapier.fetch("example-value", { key: "value" });
|
|
918
931
|
```
|
|
932
|
+
|
|
933
|
+
### Tables
|
|
934
|
+
|
|
935
|
+
#### `createTable`
|
|
936
|
+
|
|
937
|
+
Create a new table
|
|
938
|
+
|
|
939
|
+
**Parameters:**
|
|
940
|
+
|
|
941
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
942
|
+
| --------------- | -------- | -------- | ------- | --------------- | ------------------------------------ |
|
|
943
|
+
| `options` | `object` | ✅ | — | — | |
|
|
944
|
+
| ↳ `name` | `string` | ✅ | — | — | The name for the new table |
|
|
945
|
+
| ↳ `description` | `string` | ❌ | — | — | An optional description of the table |
|
|
946
|
+
|
|
947
|
+
**Returns:** `Promise<any>`
|
|
948
|
+
|
|
949
|
+
**Example:**
|
|
950
|
+
|
|
951
|
+
```typescript
|
|
952
|
+
const result = await zapier.createTable({
|
|
953
|
+
name: "example-value",
|
|
954
|
+
});
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
#### `createTableFields`
|
|
958
|
+
|
|
959
|
+
Create one or more fields in a table
|
|
960
|
+
|
|
961
|
+
**Parameters:**
|
|
962
|
+
|
|
963
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
964
|
+
| ----------- | -------- | -------- | ------- | --------------- | ------------------------------------ |
|
|
965
|
+
| `options` | `object` | ✅ | — | — | |
|
|
966
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
967
|
+
| ↳ `fields` | `array` | ✅ | — | — | Array of field definitions to create |
|
|
968
|
+
|
|
969
|
+
**Returns:** `Promise<any>`
|
|
970
|
+
|
|
971
|
+
**Example:**
|
|
972
|
+
|
|
973
|
+
```typescript
|
|
974
|
+
const result = await zapier.createTableFields({
|
|
975
|
+
tableId: "example-id",
|
|
976
|
+
fields: ["example-item"],
|
|
977
|
+
});
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
#### `createTableRecords`
|
|
981
|
+
|
|
982
|
+
Create one or more records in a table
|
|
983
|
+
|
|
984
|
+
**Parameters:**
|
|
985
|
+
|
|
986
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
987
|
+
| ----------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
988
|
+
| `options` | `object` | ✅ | — | — | |
|
|
989
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
990
|
+
| ↳ `records` | `array` | ✅ | — | — | Array of records to create (max 100) |
|
|
991
|
+
| ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
992
|
+
|
|
993
|
+
**Returns:** `Promise<any>`
|
|
994
|
+
|
|
995
|
+
**Example:**
|
|
996
|
+
|
|
997
|
+
```typescript
|
|
998
|
+
const result = await zapier.createTableRecords({
|
|
999
|
+
tableId: "example-id",
|
|
1000
|
+
records: ["example-item"],
|
|
1001
|
+
});
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
#### `deleteTable`
|
|
1005
|
+
|
|
1006
|
+
Delete a table by its ID
|
|
1007
|
+
|
|
1008
|
+
**Parameters:**
|
|
1009
|
+
|
|
1010
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1011
|
+
| ----------- | -------- | -------- | ------- | --------------- | -------------------------------------------- |
|
|
1012
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1013
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table to delete |
|
|
1014
|
+
|
|
1015
|
+
**Returns:** `Promise<any>`
|
|
1016
|
+
|
|
1017
|
+
**Example:**
|
|
1018
|
+
|
|
1019
|
+
```typescript
|
|
1020
|
+
const result = await zapier.deleteTable({
|
|
1021
|
+
tableId: "example-id",
|
|
1022
|
+
});
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
#### `deleteTableFields`
|
|
1026
|
+
|
|
1027
|
+
Delete one or more fields from a table
|
|
1028
|
+
|
|
1029
|
+
**Parameters:**
|
|
1030
|
+
|
|
1031
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1032
|
+
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------- |
|
|
1033
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1034
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1035
|
+
| ↳ `fieldKeys` | `array` | ✅ | — | — | Fields to delete. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
|
|
1036
|
+
|
|
1037
|
+
**Returns:** `Promise<any>`
|
|
1038
|
+
|
|
1039
|
+
**Example:**
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
const result = await zapier.deleteTableFields({
|
|
1043
|
+
tableId: "example-id",
|
|
1044
|
+
fieldKeys: ["example-item"],
|
|
1045
|
+
});
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
#### `deleteTableRecords`
|
|
1049
|
+
|
|
1050
|
+
Delete one or more records from a table
|
|
1051
|
+
|
|
1052
|
+
**Parameters:**
|
|
1053
|
+
|
|
1054
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1055
|
+
| ------------- | -------- | -------- | ------- | --------------- | --------------------------------------- |
|
|
1056
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1057
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1058
|
+
| ↳ `recordIds` | `array` | ✅ | — | — | Array of record IDs to delete (max 100) |
|
|
1059
|
+
|
|
1060
|
+
**Returns:** `Promise<any>`
|
|
1061
|
+
|
|
1062
|
+
**Example:**
|
|
1063
|
+
|
|
1064
|
+
```typescript
|
|
1065
|
+
const result = await zapier.deleteTableRecords({
|
|
1066
|
+
tableId: "example-id",
|
|
1067
|
+
recordIds: ["example-item"],
|
|
1068
|
+
});
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
#### `getTable`
|
|
1072
|
+
|
|
1073
|
+
Get detailed information about a specific table
|
|
1074
|
+
|
|
1075
|
+
**Parameters:**
|
|
1076
|
+
|
|
1077
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1078
|
+
| ----------- | -------- | -------- | ------- | --------------- | ---------------------------------------------- |
|
|
1079
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1080
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table to retrieve |
|
|
1081
|
+
|
|
1082
|
+
**Returns:** `Promise<TableItem>`
|
|
1083
|
+
|
|
1084
|
+
**Example:**
|
|
1085
|
+
|
|
1086
|
+
```typescript
|
|
1087
|
+
const { data: table } = await zapier.getTable({
|
|
1088
|
+
tableId: "example-id",
|
|
1089
|
+
});
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
#### `getTableRecord`
|
|
1093
|
+
|
|
1094
|
+
Get a single record from a table by ID
|
|
1095
|
+
|
|
1096
|
+
**Parameters:**
|
|
1097
|
+
|
|
1098
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1099
|
+
| ------------ | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
1100
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1101
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1102
|
+
| ↳ `recordId` | `string` | ✅ | — | — | The unique identifier of the record |
|
|
1103
|
+
| ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
1104
|
+
|
|
1105
|
+
**Returns:** `Promise<RecordItem>`
|
|
1106
|
+
|
|
1107
|
+
**Example:**
|
|
1108
|
+
|
|
1109
|
+
```typescript
|
|
1110
|
+
const { data: record } = await zapier.getTableRecord({
|
|
1111
|
+
tableId: "example-id",
|
|
1112
|
+
recordId: "example-id",
|
|
1113
|
+
});
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
#### `listTableFields`
|
|
1117
|
+
|
|
1118
|
+
List fields for a table
|
|
1119
|
+
|
|
1120
|
+
**Parameters:**
|
|
1121
|
+
|
|
1122
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1123
|
+
| ------------- | -------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------- |
|
|
1124
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1125
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1126
|
+
| ↳ `fieldKeys` | `array` | ❌ | — | — | Filter by specific fields. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
|
|
1127
|
+
|
|
1128
|
+
**Returns:** `Promise<PaginatedResult<FieldItem>>`
|
|
1129
|
+
|
|
1130
|
+
**Example:**
|
|
1131
|
+
|
|
1132
|
+
```typescript
|
|
1133
|
+
// Get first page and a cursor for the second page
|
|
1134
|
+
const { data: fields, nextCursor } = await zapier.listTableFields({
|
|
1135
|
+
tableId: "example-id",
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
// Or iterate over all pages
|
|
1139
|
+
for await (const page of zapier.listTableFields({
|
|
1140
|
+
tableId: "example-id",
|
|
1141
|
+
})) {
|
|
1142
|
+
// Do something with each page
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// Or iterate over individual items across all pages
|
|
1146
|
+
for await (const field of zapier
|
|
1147
|
+
.listTableFields({
|
|
1148
|
+
tableId: "example-id",
|
|
1149
|
+
})
|
|
1150
|
+
.items()) {
|
|
1151
|
+
// Do something with each field
|
|
1152
|
+
}
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
#### `listTableRecords`
|
|
1156
|
+
|
|
1157
|
+
List records in a table with optional filtering and sorting
|
|
1158
|
+
|
|
1159
|
+
**Parameters:**
|
|
1160
|
+
|
|
1161
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1162
|
+
| ------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
1163
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1164
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1165
|
+
| ↳ `filters` | `array` | ❌ | — | — | Filter conditions for the query |
|
|
1166
|
+
| ↳ `sort` | `object` | ❌ | — | — | Sort records by a field |
|
|
1167
|
+
| ↳ `fieldKey` | `string` | ✅ | — | — | The field key to sort by |
|
|
1168
|
+
| ↳ `direction` | `string` | ❌ | `"asc"` | — | Sort direction |
|
|
1169
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of records per page (max 1000) |
|
|
1170
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
1171
|
+
| ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
1172
|
+
| ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
1173
|
+
|
|
1174
|
+
**Returns:** `Promise<PaginatedResult<RecordItem>>`
|
|
1175
|
+
|
|
1176
|
+
**Example:**
|
|
1177
|
+
|
|
1178
|
+
```typescript
|
|
1179
|
+
// Get first page and a cursor for the second page
|
|
1180
|
+
const { data: records, nextCursor } = await zapier.listTableRecords({
|
|
1181
|
+
tableId: "example-id",
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
// Or iterate over all pages
|
|
1185
|
+
for await (const page of zapier.listTableRecords({
|
|
1186
|
+
tableId: "example-id",
|
|
1187
|
+
})) {
|
|
1188
|
+
// Do something with each page
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Or iterate over individual items across all pages
|
|
1192
|
+
for await (const record of zapier
|
|
1193
|
+
.listTableRecords({
|
|
1194
|
+
tableId: "example-id",
|
|
1195
|
+
})
|
|
1196
|
+
.items()) {
|
|
1197
|
+
// Do something with each record
|
|
1198
|
+
}
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
#### `listTables`
|
|
1202
|
+
|
|
1203
|
+
List tables available to the authenticated user
|
|
1204
|
+
|
|
1205
|
+
**Parameters:**
|
|
1206
|
+
|
|
1207
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1208
|
+
| ------------ | -------- | -------- | ------- | -------------------------------- | --------------------------------------------------------------------------- |
|
|
1209
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1210
|
+
| ↳ `tableIds` | `array` | ❌ | — | — | Filter by specific table IDs |
|
|
1211
|
+
| ↳ `kind` | `string` | ❌ | — | `table`, `virtual_table`, `both` | Filter by table type |
|
|
1212
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter tables by name |
|
|
1213
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by table owner. Use "me" for the current user, or a numeric user ID. |
|
|
1214
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of tables per page |
|
|
1215
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
1216
|
+
| ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
|
|
1217
|
+
|
|
1218
|
+
**Returns:** `Promise<PaginatedResult<TableItem>>`
|
|
1219
|
+
|
|
1220
|
+
**Example:**
|
|
1221
|
+
|
|
1222
|
+
```typescript
|
|
1223
|
+
// Get first page and a cursor for the second page
|
|
1224
|
+
const { data: tables, nextCursor } = await zapier.listTables();
|
|
1225
|
+
|
|
1226
|
+
// Or iterate over all pages
|
|
1227
|
+
for await (const page of zapier.listTables()) {
|
|
1228
|
+
// Do something with each page
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// Or iterate over individual items across all pages
|
|
1232
|
+
for await (const table of zapier.listTables().items()) {
|
|
1233
|
+
// Do something with each table
|
|
1234
|
+
}
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
#### `updateTableRecords`
|
|
1238
|
+
|
|
1239
|
+
Update one or more records in a table
|
|
1240
|
+
|
|
1241
|
+
**Parameters:**
|
|
1242
|
+
|
|
1243
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
1244
|
+
| ----------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
1245
|
+
| `options` | `object` | ✅ | — | — | |
|
|
1246
|
+
| ↳ `tableId` | `string` | ✅ | — | — | The unique identifier of the table |
|
|
1247
|
+
| ↳ `records` | `array` | ✅ | — | — | Array of records to update (max 100) |
|
|
1248
|
+
| ↳ `keyMode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
|
|
1249
|
+
|
|
1250
|
+
**Returns:** `Promise<any>`
|
|
1251
|
+
|
|
1252
|
+
**Example:**
|
|
1253
|
+
|
|
1254
|
+
```typescript
|
|
1255
|
+
const result = await zapier.updateTableRecords({
|
|
1256
|
+
tableId: "example-id",
|
|
1257
|
+
records: ["example-item"],
|
|
1258
|
+
});
|
|
1259
|
+
```
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AA0pBjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
|
package/dist/api/client.js
CHANGED
|
@@ -76,6 +76,11 @@ const pathConfig = {
|
|
|
76
76
|
authHeader: "Authorization",
|
|
77
77
|
pathPrefix: "/api/v0/sdk/zapier",
|
|
78
78
|
},
|
|
79
|
+
// e.g. /tables -> https://sdkapi.zapier.com/api/v0/sdk/tables/...
|
|
80
|
+
"/tables": {
|
|
81
|
+
authHeader: "Authorization",
|
|
82
|
+
pathPrefix: "/api/v0/sdk/tables",
|
|
83
|
+
},
|
|
79
84
|
};
|
|
80
85
|
class ZapierApiClient {
|
|
81
86
|
constructor(options) {
|
|
@@ -145,8 +150,11 @@ class ZapierApiClient {
|
|
|
145
150
|
this.put = async (path, data, options = {}) => {
|
|
146
151
|
return this.fetchJson("PUT", path, data, options);
|
|
147
152
|
};
|
|
148
|
-
this.
|
|
149
|
-
return this.fetchJson("
|
|
153
|
+
this.patch = async (path, data, options = {}) => {
|
|
154
|
+
return this.fetchJson("PATCH", path, data, options);
|
|
155
|
+
};
|
|
156
|
+
this.delete = async (path, data, options = {}) => {
|
|
157
|
+
return this.fetchJson("DELETE", path, data, options);
|
|
150
158
|
};
|
|
151
159
|
this.poll = async (path, options = {}) => {
|
|
152
160
|
return pollUntilComplete({
|
package/dist/api/types.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ export interface ApiClient {
|
|
|
43
43
|
get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
|
|
44
44
|
post: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
45
45
|
put: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
46
|
-
|
|
46
|
+
patch: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
47
|
+
delete: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
47
48
|
poll: <T = unknown>(path: string, options?: PollOptions) => Promise<T>;
|
|
48
49
|
fetch: (path: string, init?: RequestInit & {
|
|
49
50
|
searchParams?: Record<string, string>;
|
package/dist/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACV,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,oDAAoD,CAAC;AAC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CAAC,CAAC;AAClE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare const ZAPIER_BASE_URL: string;
|
|
|
11
11
|
* Maximum number of items that can be requested per page across all paginated functions
|
|
12
12
|
*/
|
|
13
13
|
export declare const MAX_PAGE_LIMIT = 10000;
|
|
14
|
+
/**
|
|
15
|
+
* Default number of items per page for paginated functions
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_PAGE_SIZE = 100;
|
|
14
18
|
/**
|
|
15
19
|
* Default timeout for action execution (in milliseconds)
|
|
16
20
|
*/
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACyB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACyB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -11,6 +11,10 @@ export const ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.co
|
|
|
11
11
|
* Maximum number of items that can be requested per page across all paginated functions
|
|
12
12
|
*/
|
|
13
13
|
export const MAX_PAGE_LIMIT = 10000;
|
|
14
|
+
/**
|
|
15
|
+
* Default number of items per page for paginated functions
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_PAGE_SIZE = 100;
|
|
14
18
|
/**
|
|
15
19
|
* Default timeout for action execution (in milliseconds)
|
|
16
20
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { tableRecordFormatter } from "./tableRecord";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OutputFormatter } from "../utils/schema-utils";
|
|
2
|
+
import type { RecordItem } from "../plugins/tables/getTableRecord/schemas";
|
|
3
|
+
export declare const tableRecordFormatter: OutputFormatter<RecordItem, {
|
|
4
|
+
tableId: string;
|
|
5
|
+
}, Record<string, string>>;
|
|
6
|
+
//# sourceMappingURL=tableRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableRecord.d.ts","sourceRoot":"","sources":["../../src/formatters/tableRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAG3E,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAChD,UAAU,EACV;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EACnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBvB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isFieldId, formatFieldValue } from "../plugins/tables/utils";
|
|
2
|
+
export const tableRecordFormatter = {
|
|
3
|
+
fetch: async (sdk, params, item, context) => {
|
|
4
|
+
if (context)
|
|
5
|
+
return context;
|
|
6
|
+
const hasFieldIds = Object.keys(item.data).some(isFieldId);
|
|
7
|
+
if (!hasFieldIds)
|
|
8
|
+
return {};
|
|
9
|
+
const { data: fields } = await sdk.listTableFields({
|
|
10
|
+
tableId: params.tableId,
|
|
11
|
+
});
|
|
12
|
+
return Object.fromEntries(fields.map((f) => [f.id, f.name]));
|
|
13
|
+
},
|
|
14
|
+
format: (item, fieldLabels) => ({
|
|
15
|
+
title: `Record ${item.id}`,
|
|
16
|
+
id: item.id,
|
|
17
|
+
details: Object.entries(item.data).map(([k, v]) => ({
|
|
18
|
+
label: fieldLabels?.[k] ?? k,
|
|
19
|
+
text: formatFieldValue(v),
|
|
20
|
+
style: "normal",
|
|
21
|
+
})),
|
|
22
|
+
}),
|
|
23
|
+
};
|