@zapier/zapier-sdk 0.39.0 → 0.40.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/CLAUDE.md +12 -14
- package/README.md +186 -192
- package/dist/api/schemas.d.ts +2 -2
- package/dist/api/schemas.js +3 -3
- package/dist/formatters/tableRecord.js +1 -1
- package/dist/index.cjs +652 -377
- package/dist/index.d.mts +468 -53
- package/dist/index.mjs +643 -378
- package/dist/plugins/apps/index.d.ts +1 -1
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +4 -8
- package/dist/plugins/apps/schemas.d.ts +2 -1
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/apps/schemas.js +24 -8
- package/dist/plugins/fetch/index.d.ts +4 -2
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +1 -3
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +11 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +0 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts +4 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/schemas.js +2 -0
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +0 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +4 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.js +2 -0
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +8 -6
- package/dist/plugins/getAction/schemas.d.ts +58 -1
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.js +16 -4
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +6 -5
- package/dist/plugins/getApp/schemas.d.ts +19 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.js +14 -4
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +3 -5
- package/dist/plugins/getConnection/schemas.d.ts +1 -0
- package/dist/plugins/getConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getConnection/schemas.js +11 -5
- package/dist/plugins/getInputFieldsSchema/index.d.ts +2 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +18 -12
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +71 -1
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/schemas.js +39 -10
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +5 -4
- package/dist/plugins/listActions/schemas.d.ts +58 -1
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +25 -12
- package/dist/plugins/listApps/index.js +1 -1
- package/dist/plugins/listApps/schemas.d.ts +1 -0
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +6 -1
- package/dist/plugins/listConnections/index.d.ts +2 -1
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +27 -14
- package/dist/plugins/listConnections/schemas.d.ts +5 -0
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +22 -9
- package/dist/plugins/listInputFieldChoices/index.d.ts +2 -2
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +21 -15
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +92 -1
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +47 -23
- package/dist/plugins/listInputFields/index.d.ts +2 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +18 -13
- package/dist/plugins/listInputFields/schemas.d.ts +80 -1
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.js +40 -11
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +4 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +0 -1
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +2 -5
- package/dist/plugins/request/schemas.d.ts +2 -0
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +13 -5
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +17 -15
- package/dist/plugins/runAction/schemas.d.ts +83 -2
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.js +41 -17
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +5 -4
- package/dist/plugins/tables/createTableFields/schemas.d.ts +128 -2
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/schemas.js +23 -7
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +7 -6
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +38 -2
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/schemas.js +23 -7
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +5 -4
- package/dist/plugins/tables/deleteTable/schemas.d.ts +17 -1
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/schemas.js +14 -2
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +9 -7
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +22 -1
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/schemas.js +18 -2
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +7 -5
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +22 -1
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/schemas.js +18 -2
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +6 -5
- package/dist/plugins/tables/getTable/schemas.d.ts +16 -1
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/schemas.js +14 -2
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +9 -7
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +39 -2
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/schemas.js +20 -5
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +10 -8
- package/dist/plugins/tables/listTableFields/schemas.d.ts +27 -2
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/schemas.js +24 -8
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +7 -6
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +119 -2
- package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/schemas.js +23 -7
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +3 -2
- package/dist/plugins/tables/listTables/schemas.d.ts +5 -1
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/schemas.js +4 -1
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +7 -6
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +41 -2
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/schemas.js +23 -7
- package/dist/resolvers/actionKey.d.ts +1 -1
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionKey.js +3 -3
- package/dist/resolvers/actionType.d.ts +1 -1
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/actionType.js +2 -2
- package/dist/resolvers/connectionId.d.ts +1 -1
- package/dist/resolvers/connectionId.d.ts.map +1 -1
- package/dist/resolvers/connectionId.js +9 -9
- package/dist/resolvers/inputFieldKey.d.ts +3 -3
- package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
- package/dist/resolvers/inputFieldKey.js +6 -6
- package/dist/resolvers/inputs.d.ts +3 -3
- package/dist/resolvers/inputs.d.ts.map +1 -1
- package/dist/resolvers/inputs.js +8 -8
- package/dist/resolvers/tableFieldIds.d.ts +1 -1
- package/dist/resolvers/tableFieldIds.d.ts.map +1 -1
- package/dist/resolvers/tableFieldIds.js +3 -3
- package/dist/resolvers/tableFilters.d.ts +1 -1
- package/dist/resolvers/tableFilters.d.ts.map +1 -1
- package/dist/resolvers/tableFilters.js +4 -4
- package/dist/resolvers/tableId.js +1 -1
- package/dist/resolvers/tableRecordId.d.ts +2 -2
- package/dist/resolvers/tableRecordId.d.ts.map +1 -1
- package/dist/resolvers/tableRecordId.js +5 -5
- package/dist/resolvers/tableRecords.d.ts +2 -2
- package/dist/resolvers/tableRecords.d.ts.map +1 -1
- package/dist/resolvers/tableRecords.js +6 -6
- package/dist/resolvers/tableSort.d.ts +1 -1
- package/dist/resolvers/tableSort.d.ts.map +1 -1
- package/dist/resolvers/tableSort.js +2 -2
- package/dist/services/implementations.d.ts.map +1 -1
- package/dist/services/implementations.js +2 -3
- package/dist/types/properties.d.ts +30 -0
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +34 -1
- package/dist/types/sdk.d.ts +0 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/domain-utils.d.ts +5 -0
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +17 -3
- package/dist/utils/id-utils.d.ts +2 -0
- package/dist/utils/id-utils.d.ts.map +1 -1
- package/dist/utils/id-utils.js +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPaginatedFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { ListTableRecordsApiResponseSchema, ListTableRecordsOptionsSchema, RecordItemSchema, } from "./schemas";
|
|
2
|
+
import { ListTableRecordsApiResponseSchema, ListTableRecordsOptionsSchema, ListTableRecordsOptionsInputSchema, RecordItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { stripPageSuffix } from "../../../utils/string-utils";
|
|
5
5
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
@@ -16,9 +16,10 @@ function extractNextCursor(meta) {
|
|
|
16
16
|
export const listTableRecordsPlugin = ({ context }) => {
|
|
17
17
|
async function listTableRecordsPage(options) {
|
|
18
18
|
const { api } = context;
|
|
19
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
19
20
|
const translator = await createFieldKeyTranslator({
|
|
20
21
|
api,
|
|
21
|
-
tableId
|
|
22
|
+
tableId,
|
|
22
23
|
keyMode: options.keyMode,
|
|
23
24
|
});
|
|
24
25
|
const body = {};
|
|
@@ -46,7 +47,7 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
46
47
|
start_cursor: options.cursor,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
const rawResponse = await api.post(`/tables/api/v1/tables/${
|
|
50
|
+
const rawResponse = await api.post(`/tables/api/v1/tables/${tableId}/records/query`, body, {
|
|
50
51
|
searchParams: { allow_nested_queries: "true" },
|
|
51
52
|
customErrorHandler: ({ status }) => {
|
|
52
53
|
if (status === 401) {
|
|
@@ -56,7 +57,7 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
56
57
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to access this table. (HTTP ${status})`, { statusCode: status });
|
|
57
58
|
}
|
|
58
59
|
if (status === 404) {
|
|
59
|
-
return new Error(`Table not found: ${
|
|
60
|
+
return new Error(`Table not found: ${tableId}`);
|
|
60
61
|
}
|
|
61
62
|
return undefined;
|
|
62
63
|
},
|
|
@@ -73,7 +74,7 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
76
|
const methodName = stripPageSuffix(listTableRecordsPage.name);
|
|
76
|
-
const listTableRecordsDefinition = createPaginatedFunction(listTableRecordsPage,
|
|
77
|
+
const listTableRecordsDefinition = createPaginatedFunction(listTableRecordsPage, ListTableRecordsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
77
78
|
return {
|
|
78
79
|
listTableRecords: listTableRecordsDefinition,
|
|
79
80
|
context: {
|
|
@@ -85,7 +86,7 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
85
86
|
inputSchema: ListTableRecordsOptionsSchema,
|
|
86
87
|
outputSchema: RecordItemSchema,
|
|
87
88
|
resolvers: {
|
|
88
|
-
|
|
89
|
+
table: tableIdResolver,
|
|
89
90
|
filters: tableFiltersResolver,
|
|
90
91
|
sort: tableSortResolver,
|
|
91
92
|
},
|
|
@@ -72,7 +72,6 @@ export declare const SortConditionSchema: z.ZodObject<{
|
|
|
72
72
|
}, z.core.$strip>;
|
|
73
73
|
export type SortCondition = z.infer<typeof SortConditionSchema>;
|
|
74
74
|
export declare const ListTableRecordsOptionsSchema: z.ZodObject<{
|
|
75
|
-
tableId: z.ZodString;
|
|
76
75
|
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
76
|
fieldKey: z.ZodString;
|
|
78
77
|
operator: z.ZodEnum<{
|
|
@@ -107,8 +106,126 @@ export declare const ListTableRecordsOptionsSchema: z.ZodObject<{
|
|
|
107
106
|
names: "names";
|
|
108
107
|
ids: "ids";
|
|
109
108
|
}>>>;
|
|
109
|
+
table: z.ZodString & {
|
|
110
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
111
|
+
};
|
|
110
112
|
}, z.core.$strip>;
|
|
111
|
-
|
|
113
|
+
declare const ListTableRecordsOptionsSchemaDeprecated: z.ZodObject<{
|
|
114
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
|
+
fieldKey: z.ZodString;
|
|
116
|
+
operator: z.ZodEnum<{
|
|
117
|
+
in: "in";
|
|
118
|
+
search: "search";
|
|
119
|
+
contains: "contains";
|
|
120
|
+
gt: "gt";
|
|
121
|
+
gte: "gte";
|
|
122
|
+
lt: "lt";
|
|
123
|
+
lte: "lte";
|
|
124
|
+
exact: "exact";
|
|
125
|
+
different: "different";
|
|
126
|
+
icontains: "icontains";
|
|
127
|
+
range: "range";
|
|
128
|
+
isnull: "isnull";
|
|
129
|
+
startswith: "startswith";
|
|
130
|
+
is_within: "is_within";
|
|
131
|
+
}>;
|
|
132
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
133
|
+
}, z.core.$strip>>>;
|
|
134
|
+
sort: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
fieldKey: z.ZodString;
|
|
136
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
137
|
+
asc: "asc";
|
|
138
|
+
desc: "desc";
|
|
139
|
+
}>>>;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
144
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
145
|
+
names: "names";
|
|
146
|
+
ids: "ids";
|
|
147
|
+
}>>>;
|
|
148
|
+
tableId: z.ZodString;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
export declare const ListTableRecordsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
151
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
152
|
+
fieldKey: z.ZodString;
|
|
153
|
+
operator: z.ZodEnum<{
|
|
154
|
+
in: "in";
|
|
155
|
+
search: "search";
|
|
156
|
+
contains: "contains";
|
|
157
|
+
gt: "gt";
|
|
158
|
+
gte: "gte";
|
|
159
|
+
lt: "lt";
|
|
160
|
+
lte: "lte";
|
|
161
|
+
exact: "exact";
|
|
162
|
+
different: "different";
|
|
163
|
+
icontains: "icontains";
|
|
164
|
+
range: "range";
|
|
165
|
+
isnull: "isnull";
|
|
166
|
+
startswith: "startswith";
|
|
167
|
+
is_within: "is_within";
|
|
168
|
+
}>;
|
|
169
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
170
|
+
}, z.core.$strip>>>;
|
|
171
|
+
sort: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
fieldKey: z.ZodString;
|
|
173
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
asc: "asc";
|
|
175
|
+
desc: "desc";
|
|
176
|
+
}>>>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
181
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
182
|
+
names: "names";
|
|
183
|
+
ids: "ids";
|
|
184
|
+
}>>>;
|
|
185
|
+
table: z.ZodString & {
|
|
186
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
187
|
+
};
|
|
188
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
189
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
190
|
+
fieldKey: z.ZodString;
|
|
191
|
+
operator: z.ZodEnum<{
|
|
192
|
+
in: "in";
|
|
193
|
+
search: "search";
|
|
194
|
+
contains: "contains";
|
|
195
|
+
gt: "gt";
|
|
196
|
+
gte: "gte";
|
|
197
|
+
lt: "lt";
|
|
198
|
+
lte: "lte";
|
|
199
|
+
exact: "exact";
|
|
200
|
+
different: "different";
|
|
201
|
+
icontains: "icontains";
|
|
202
|
+
range: "range";
|
|
203
|
+
isnull: "isnull";
|
|
204
|
+
startswith: "startswith";
|
|
205
|
+
is_within: "is_within";
|
|
206
|
+
}>;
|
|
207
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
208
|
+
}, z.core.$strip>>>;
|
|
209
|
+
sort: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
fieldKey: z.ZodString;
|
|
211
|
+
direction: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
212
|
+
asc: "asc";
|
|
213
|
+
desc: "desc";
|
|
214
|
+
}>>>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
219
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
220
|
+
names: "names";
|
|
221
|
+
ids: "ids";
|
|
222
|
+
}>>>;
|
|
223
|
+
tableId: z.ZodString;
|
|
224
|
+
}, z.core.$strip>]>;
|
|
225
|
+
export type ListTableRecordsOptions = z.infer<typeof ListTableRecordsOptionsSchema> | (Omit<z.infer<typeof ListTableRecordsOptionsSchemaDeprecated>, "tableId"> & {
|
|
226
|
+
/** @deprecated Use `table` instead. */
|
|
227
|
+
tableId: z.infer<typeof ListTableRecordsOptionsSchemaDeprecated>["tableId"];
|
|
228
|
+
});
|
|
112
229
|
export interface ListTableRecordsPage {
|
|
113
230
|
data: RecordItem[];
|
|
114
231
|
nextCursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,gBAAgB,EAChB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;iBAc5C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;EAexB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAIzB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIpE,eAAO,MAAM,mBAAmB;;;;;;iBAK9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AA2BhE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIA,CAAC;AAG3C,QAAA,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK3C,CAAC;AAGH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKP,CAAC;AAGzC,MAAM,MAAM,uBAAuB,GAC/B,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,GAC7C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,EACvD,SAAS,CACV,GAAG;IACF,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,uCAAuC,CAC/C,CAAC,SAAS,CAAC,CAAC;CACd,CAAC,CAAC;AAEP,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,qBAAqB,GAC7B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,oBAAoB,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;CAC7E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema } from "../../../types/properties";
|
|
2
3
|
import { RecordApiItemSchema, RecordItemSchema, } from "../getTableRecord/schemas";
|
|
3
4
|
import { KeyModeSchema } from "../utils";
|
|
4
5
|
// Re-export for consumers
|
|
@@ -46,12 +47,8 @@ export const SortConditionSchema = z.object({
|
|
|
46
47
|
.default("asc")
|
|
47
48
|
.describe("Sort direction"),
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
tableId: z
|
|
52
|
-
.string()
|
|
53
|
-
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
54
|
-
.describe("The unique identifier of the table"),
|
|
50
|
+
const ListTableRecordsDescription = "List records in a table with optional filtering and sorting";
|
|
51
|
+
const ListTableRecordsBase = z.object({
|
|
55
52
|
filters: z
|
|
56
53
|
.array(FilterConditionSchema)
|
|
57
54
|
.optional()
|
|
@@ -70,5 +67,24 @@ export const ListTableRecordsOptionsSchema = z
|
|
|
70
67
|
.describe("Maximum total items to return across all pages"),
|
|
71
68
|
cursor: z.string().optional().describe("Cursor to start from"),
|
|
72
69
|
keyMode: KeyModeSchema,
|
|
70
|
+
});
|
|
71
|
+
// Schema for docs/registry (new param names only)
|
|
72
|
+
export const ListTableRecordsOptionsSchema = ListTableRecordsBase.extend({
|
|
73
|
+
table: TablePropertySchema,
|
|
73
74
|
})
|
|
74
|
-
.describe(
|
|
75
|
+
.describe(ListTableRecordsDescription)
|
|
76
|
+
.meta({ aliases: { tableId: "table" } });
|
|
77
|
+
// Deprecated schema (backward compat)
|
|
78
|
+
const ListTableRecordsOptionsSchemaDeprecated = ListTableRecordsBase.extend({
|
|
79
|
+
tableId: z
|
|
80
|
+
.string()
|
|
81
|
+
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
82
|
+
.describe("The unique identifier of the table"),
|
|
83
|
+
});
|
|
84
|
+
// Union for runtime validation
|
|
85
|
+
export const ListTableRecordsOptionsInputSchema = z
|
|
86
|
+
.union([
|
|
87
|
+
ListTableRecordsOptionsSchema,
|
|
88
|
+
ListTableRecordsOptionsSchemaDeprecated,
|
|
89
|
+
])
|
|
90
|
+
.describe(ListTableRecordsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,uBAAuB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAOhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAmB9D,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC;QACnD,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC1D,KAAK,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;KACnC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,uBAAuB,CAAC;aAC7C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EACF,cAAc,CAAC,iBAAiB,CAAC,GAC/B,oBAAoB,GACpB,mBAAmB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,uBAAuB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAOhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAmB9D,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC;QACnD,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC1D,KAAK,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;KACnC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,uBAAuB,CAAC;aAC7C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EACF,cAAc,CAAC,iBAAiB,CAAC,GAC/B,oBAAoB,GACpB,mBAAmB,EACrB,wBAAwB,CAmGzB,CAAC"}
|
|
@@ -28,8 +28,9 @@ export const listTablesPlugin = ({ context }) => {
|
|
|
28
28
|
if (options.pageSize !== undefined) {
|
|
29
29
|
searchParams.limit = options.pageSize.toString();
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const tableIds = "tables" in options && options.tables ? options.tables : options.tableIds;
|
|
32
|
+
if (tableIds && tableIds.length > 0) {
|
|
33
|
+
searchParams.ids = tableIds.join(",");
|
|
33
34
|
}
|
|
34
35
|
if (options?.kind) {
|
|
35
36
|
searchParams.kind = options.kind;
|
|
@@ -54,6 +54,7 @@ export declare const TableItemSchema: z.ZodObject<{
|
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
export type TableItem = z.infer<typeof TableItemSchema>;
|
|
56
56
|
export declare const ListTablesOptionsSchema: z.ZodObject<{
|
|
57
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
58
|
tableIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
59
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
59
60
|
table: "table";
|
|
@@ -67,7 +68,10 @@ export declare const ListTablesOptionsSchema: z.ZodObject<{
|
|
|
67
68
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
68
69
|
cursor: z.ZodOptional<z.ZodString>;
|
|
69
70
|
}, z.core.$strip>;
|
|
70
|
-
export type ListTablesOptions = z.infer<typeof ListTablesOptionsSchema
|
|
71
|
+
export type ListTablesOptions = Omit<z.infer<typeof ListTablesOptionsSchema>, "tableIds"> & {
|
|
72
|
+
/** @deprecated Use `tables` instead. */
|
|
73
|
+
tableIds?: z.infer<typeof ListTablesOptionsSchema>["tableIds"];
|
|
74
|
+
};
|
|
71
75
|
export interface ListTablesPage {
|
|
72
76
|
data: TableItem[];
|
|
73
77
|
nextCursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBAW7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;iBAOtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,eAAe;;;;;;;;;;;;;iBAU1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;iBAwC0B,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,EACvC,UAAU,CACX,GAAG;IACF,wCAAwC;IACxC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC,UAAU,CAAC,CAAC;CAChE,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,eAAe,GACvB,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,oBAAoB,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;CAChE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablesPropertySchema } from "../../../types/properties";
|
|
2
3
|
export const TableApiItemSchema = z.object({
|
|
3
4
|
id: z.string(),
|
|
4
5
|
name: z.string(),
|
|
@@ -32,10 +33,12 @@ export const TableItemSchema = z.object({
|
|
|
32
33
|
});
|
|
33
34
|
export const ListTablesOptionsSchema = z
|
|
34
35
|
.object({
|
|
36
|
+
tables: TablesPropertySchema.optional(),
|
|
35
37
|
tableIds: z
|
|
36
38
|
.array(z.string())
|
|
37
39
|
.optional()
|
|
38
|
-
.describe("Filter by specific table IDs")
|
|
40
|
+
.describe("Filter by specific table IDs")
|
|
41
|
+
.meta({ deprecated: true }),
|
|
39
42
|
kind: z
|
|
40
43
|
.enum(["table", "virtual_table", "both"])
|
|
41
44
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/updateTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/updateTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,+BAA+B,EAI/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAehE,MAAM,WAAW,gCAAgC;IAC/C,kBAAkB,EAAE,CAClB,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACvC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,kBAAkB,EAAE;gBAClB,WAAW,EAAE,OAAO,+BAA+B,CAAC;aACrD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EACzC,gCAAgC,CAwFjC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { UpdateTableRecordsOptionsSchema, UpdateTableRecordsApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
2
|
+
import { UpdateTableRecordsOptionsSchema, UpdateTableRecordsOptionsInputSchema, UpdateTableRecordsApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableUpdateRecordsResolver, } from "../../../resolvers";
|
|
@@ -8,12 +8,13 @@ import { createFieldKeyTranslator, transformRecordItem, throwOnRecordErrors, thr
|
|
|
8
8
|
export const updateTableRecordsPlugin = ({ context }) => {
|
|
9
9
|
async function updateTableRecords(options) {
|
|
10
10
|
const { api } = context;
|
|
11
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
12
|
const translator = await createFieldKeyTranslator({
|
|
12
13
|
api,
|
|
13
|
-
tableId
|
|
14
|
+
tableId,
|
|
14
15
|
keyMode: options.keyMode,
|
|
15
16
|
});
|
|
16
|
-
const rawResponse = await api.patch(`/tables/api/v1/tables/${
|
|
17
|
+
const rawResponse = await api.patch(`/tables/api/v1/tables/${tableId}/records`, {
|
|
17
18
|
updated_records: options.records.map((record) => ({
|
|
18
19
|
id: record.id,
|
|
19
20
|
data: translator.translateInput(record.data),
|
|
@@ -27,7 +28,7 @@ export const updateTableRecordsPlugin = ({ context }) => {
|
|
|
27
28
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to update records. (HTTP ${status})`, { statusCode: status });
|
|
28
29
|
}
|
|
29
30
|
if (status === 404) {
|
|
30
|
-
return new Error(`Table not found: ${
|
|
31
|
+
return new Error(`Table not found: ${tableId}`);
|
|
31
32
|
}
|
|
32
33
|
return undefined;
|
|
33
34
|
},
|
|
@@ -45,7 +46,7 @@ export const updateTableRecordsPlugin = ({ context }) => {
|
|
|
45
46
|
})),
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
const updateTableRecordsDefinition = createFunction(updateTableRecords,
|
|
49
|
+
const updateTableRecordsDefinition = createFunction(updateTableRecords, UpdateTableRecordsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, updateTableRecords.name));
|
|
49
50
|
return {
|
|
50
51
|
updateTableRecords: updateTableRecordsDefinition,
|
|
51
52
|
context: {
|
|
@@ -57,7 +58,7 @@ export const updateTableRecordsPlugin = ({ context }) => {
|
|
|
57
58
|
inputSchema: UpdateTableRecordsOptionsSchema,
|
|
58
59
|
outputSchema: RecordItemSchema,
|
|
59
60
|
resolvers: {
|
|
60
|
-
|
|
61
|
+
table: tableIdResolver,
|
|
61
62
|
records: tableUpdateRecordsResolver,
|
|
62
63
|
},
|
|
63
64
|
formatter: tableRecordFormatter,
|
|
@@ -38,7 +38,6 @@ export declare const UpdateRecordSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
export type UpdateRecord = z.infer<typeof UpdateRecordSchema>;
|
|
40
40
|
export declare const UpdateTableRecordsOptionsSchema: z.ZodObject<{
|
|
41
|
-
tableId: z.ZodString;
|
|
42
41
|
records: z.ZodArray<z.ZodObject<{
|
|
43
42
|
id: z.ZodString;
|
|
44
43
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -47,8 +46,48 @@ export declare const UpdateTableRecordsOptionsSchema: z.ZodObject<{
|
|
|
47
46
|
names: "names";
|
|
48
47
|
ids: "ids";
|
|
49
48
|
}>>>;
|
|
49
|
+
table: z.ZodString & {
|
|
50
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
51
|
+
};
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const UpdateTableRecordsOptionsSchemaDeprecated: z.ZodObject<{
|
|
54
|
+
records: z.ZodArray<z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
names: "names";
|
|
60
|
+
ids: "ids";
|
|
61
|
+
}>>>;
|
|
62
|
+
tableId: z.ZodString;
|
|
50
63
|
}, z.core.$strip>;
|
|
51
|
-
export
|
|
64
|
+
export declare const UpdateTableRecordsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
65
|
+
records: z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
names: "names";
|
|
71
|
+
ids: "ids";
|
|
72
|
+
}>>>;
|
|
73
|
+
table: z.ZodString & {
|
|
74
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
75
|
+
};
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
records: z.ZodArray<z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
names: "names";
|
|
83
|
+
ids: "ids";
|
|
84
|
+
}>>>;
|
|
85
|
+
tableId: z.ZodString;
|
|
86
|
+
}, z.core.$strip>]>;
|
|
87
|
+
export type UpdateTableRecordsOptions = (z.infer<typeof UpdateTableRecordsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof UpdateTableRecordsOptionsSchemaDeprecated>, "tableId"> & FunctionOptions & {
|
|
88
|
+
/** @deprecated Use `table` instead. */
|
|
89
|
+
tableId: z.infer<typeof UpdateTableRecordsOptionsSchemaDeprecated>["tableId"];
|
|
90
|
+
});
|
|
52
91
|
export interface UpdateTableRecordsResult {
|
|
53
92
|
data: RecordItem[];
|
|
54
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/updateTableRecords/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/updateTableRecords/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,gBAAgB,EAChB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,CAAC;AAU3B,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;iBAK7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAc9D,eAAO,MAAM,+BAA+B;;;;;;;;;;;;iBAIF,CAAC;AAG3C,QAAA,MAAM,yCAAyC;;;;;;;;;;iBAO9C,CAAC;AAGF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;mBAKP,CAAC;AAG3C,MAAM,MAAM,yBAAyB,GACjC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,GAAG,eAAe,CAAC,GACnE,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,EACzD,SAAS,CACV,GACC,eAAe,GAAG;IAChB,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,yCAAyC,CACjD,CAAC,SAAS,CAAC,CAAC;CACd,CAAC,CAAC;AAET,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,UAAU,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,uBAAuB,GAC/B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,EAAE,CAClB,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACxC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema } from "../../../types/properties";
|
|
2
3
|
import { RecordApiItemSchema, RecordItemSchema, } from "../getTableRecord/schemas";
|
|
3
4
|
import { KeyModeSchema } from "../utils";
|
|
4
5
|
// Re-export for consumers
|
|
@@ -19,17 +20,32 @@ export const UpdateRecordSchema = z.object({
|
|
|
19
20
|
.record(z.string(), z.unknown())
|
|
20
21
|
.describe("The field values to update, keyed by field key"),
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tableId: z
|
|
25
|
-
.string()
|
|
26
|
-
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
27
|
-
.describe("The unique identifier of the table"),
|
|
23
|
+
const UpdateTableRecordsDescription = "Update one or more records in a table";
|
|
24
|
+
const UpdateTableRecordsBase = z.object({
|
|
28
25
|
records: z
|
|
29
26
|
.array(UpdateRecordSchema)
|
|
30
27
|
.min(1)
|
|
31
28
|
.max(100)
|
|
32
29
|
.describe("Array of records to update (max 100)"),
|
|
33
30
|
keyMode: KeyModeSchema,
|
|
31
|
+
});
|
|
32
|
+
// Schema for docs/registry (new param names only)
|
|
33
|
+
export const UpdateTableRecordsOptionsSchema = UpdateTableRecordsBase.extend({
|
|
34
|
+
table: TablePropertySchema,
|
|
34
35
|
})
|
|
35
|
-
.describe(
|
|
36
|
+
.describe(UpdateTableRecordsDescription)
|
|
37
|
+
.meta({ aliases: { tableId: "table" } });
|
|
38
|
+
// Deprecated schema (backward compat)
|
|
39
|
+
const UpdateTableRecordsOptionsSchemaDeprecated = UpdateTableRecordsBase.extend({
|
|
40
|
+
tableId: z
|
|
41
|
+
.string()
|
|
42
|
+
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
43
|
+
.describe("The unique identifier of the table"),
|
|
44
|
+
});
|
|
45
|
+
// Union for runtime validation
|
|
46
|
+
export const UpdateTableRecordsOptionsInputSchema = z
|
|
47
|
+
.union([
|
|
48
|
+
UpdateTableRecordsOptionsSchema,
|
|
49
|
+
UpdateTableRecordsOptionsSchemaDeprecated,
|
|
50
|
+
])
|
|
51
|
+
.describe(UpdateTableRecordsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,
|
|
1
|
+
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAuBhD,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export const actionKeyResolver = {
|
|
2
2
|
type: "dynamic",
|
|
3
|
-
depends: ["
|
|
3
|
+
depends: ["app", "actionType"],
|
|
4
4
|
fetch: async (sdk, resolvedParams) => {
|
|
5
5
|
const actionsResponse = await sdk.listActions({
|
|
6
|
-
|
|
6
|
+
app: resolvedParams.app,
|
|
7
7
|
});
|
|
8
8
|
return actionsResponse.data.filter((action) => action.action_type === resolvedParams.actionType);
|
|
9
9
|
},
|
|
10
10
|
prompt: (actions) => ({
|
|
11
11
|
type: "list",
|
|
12
|
-
name: "
|
|
12
|
+
name: "action",
|
|
13
13
|
message: "Select action:",
|
|
14
14
|
choices: actions.map((action) => ({
|
|
15
15
|
name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,
|
|
1
|
+
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAwBhB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const actionTypeResolver = {
|
|
2
2
|
type: "dynamic",
|
|
3
|
-
depends: ["
|
|
3
|
+
depends: ["app"],
|
|
4
4
|
fetch: async (sdk, resolvedParams) => {
|
|
5
5
|
const actionsResponse = await sdk.listActions({
|
|
6
|
-
|
|
6
|
+
app: resolvedParams.app,
|
|
7
7
|
});
|
|
8
8
|
const actionTypes = actionsResponse.data.map((action) => action.action_type);
|
|
9
9
|
const types = [...new Set(actionTypes)];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DynamicResolver } from "../utils/schema-utils";
|
|
2
2
|
import type { ConnectionItem } from "../schemas/Connection";
|
|
3
3
|
type ConnectionIdResolver = DynamicResolver<ConnectionItem, {
|
|
4
|
-
|
|
4
|
+
app?: string;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const connectionIdResolver: ConnectionIdResolver;
|
|
7
7
|
export declare const connectionIdGenericResolver: ConnectionIdResolver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionId.d.ts","sourceRoot":"","sources":["../../src/resolvers/connectionId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,KAAK,oBAAoB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"connectionId.d.ts","sourceRoot":"","sources":["../../src/resolvers/connectionId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,KAAK,oBAAoB,GAAG,eAAe,CAAC,cAAc,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAoC9E,eAAO,MAAM,oBAAoB,EAAE,oBAkBlC,CAAC;AAIF,eAAO,MAAM,2BAA2B,EAAE,oBAMzC,CAAC"}
|
|
@@ -3,16 +3,16 @@ async function fetchConnections(sdk, resolvedParams) {
|
|
|
3
3
|
const context = sdk.getContext();
|
|
4
4
|
const includeShared = await context.hasCapability?.("canIncludeSharedConnections");
|
|
5
5
|
return toIterable(sdk.listConnections({
|
|
6
|
-
|
|
6
|
+
app: resolvedParams.app,
|
|
7
7
|
includeShared: includeShared || undefined,
|
|
8
8
|
}));
|
|
9
9
|
}
|
|
10
10
|
function promptForConnection(connections, params) {
|
|
11
11
|
return {
|
|
12
12
|
type: "list",
|
|
13
|
-
name: "
|
|
14
|
-
message: params.
|
|
15
|
-
? `Select connection for ${params.
|
|
13
|
+
name: "connection",
|
|
14
|
+
message: params.app
|
|
15
|
+
? `Select connection for ${params.app}:`
|
|
16
16
|
: "Select connection:",
|
|
17
17
|
choices: connections.map((connection) => ({
|
|
18
18
|
name: `${connection.title || connection.label || "Connection"} (ID: ${connection.id})`,
|
|
@@ -22,13 +22,13 @@ function promptForConnection(connections, params) {
|
|
|
22
22
|
}
|
|
23
23
|
export const connectionIdResolver = {
|
|
24
24
|
type: "dynamic",
|
|
25
|
-
depends: ["
|
|
25
|
+
depends: ["app"],
|
|
26
26
|
requireCapabilities: ["canIncludeSharedConnections"],
|
|
27
27
|
tryResolveWithoutPrompt: async (sdk, params) => {
|
|
28
|
-
if (!params.
|
|
28
|
+
if (!params.app)
|
|
29
29
|
return null;
|
|
30
30
|
try {
|
|
31
|
-
const app = await sdk.getApp({
|
|
31
|
+
const app = await sdk.getApp({ app: params.app });
|
|
32
32
|
if (!app.data.auth_type) {
|
|
33
33
|
return { resolvedValue: null };
|
|
34
34
|
}
|
|
@@ -41,8 +41,8 @@ export const connectionIdResolver = {
|
|
|
41
41
|
fetch: fetchConnections,
|
|
42
42
|
prompt: promptForConnection,
|
|
43
43
|
};
|
|
44
|
-
// Generic version without
|
|
45
|
-
// absent: without
|
|
44
|
+
// Generic version without app dependency. tryResolveWithoutPrompt is intentionally
|
|
45
|
+
// absent: without app we cannot look up auth_type to determine if auth is required.
|
|
46
46
|
export const connectionIdGenericResolver = {
|
|
47
47
|
type: "dynamic",
|
|
48
48
|
depends: [],
|
|
@@ -2,10 +2,10 @@ import type { DynamicResolver } from "../utils/schema-utils";
|
|
|
2
2
|
import type { InputFieldItem } from "../schemas/Field";
|
|
3
3
|
import type { ActionTypeProperty } from "../types/properties";
|
|
4
4
|
export declare const inputFieldKeyResolver: DynamicResolver<InputFieldItem, {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
app: string;
|
|
6
|
+
action: string;
|
|
7
7
|
actionType: ActionTypeProperty;
|
|
8
|
-
|
|
8
|
+
connection: string | number;
|
|
9
9
|
inputs?: Record<string, unknown>;
|
|
10
10
|
}>;
|
|
11
11
|
//# sourceMappingURL=inputFieldKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputFieldKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/inputFieldKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiC9D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,cAAc,EACd;IACE,
|
|
1
|
+
{"version":3,"file":"inputFieldKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/inputFieldKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiC9D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,cAAc,EACd;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CA0BF,CAAC"}
|