@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 { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { CreateTableFieldsOptionsSchema, CreateTableFieldsApiResponseSchema, FieldItemSchema, } from "./schemas";
|
|
2
|
+
import { CreateTableFieldsOptionsSchema, CreateTableFieldsOptionsInputSchema, CreateTableFieldsApiResponseSchema, FieldItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableFieldsResolver } from "../../../resolvers";
|
|
@@ -7,7 +7,8 @@ import { transformFieldItem } from "../utils";
|
|
|
7
7
|
export const createTableFieldsPlugin = ({ context }) => {
|
|
8
8
|
async function createTableFields(options) {
|
|
9
9
|
const { api } = context;
|
|
10
|
-
const
|
|
10
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
+
const rawResponse = await api.post(`/tables/api/v1/tables/${tableId}/fields`, {
|
|
11
12
|
new_fields: options.fields,
|
|
12
13
|
}, {
|
|
13
14
|
customErrorHandler: ({ status }) => {
|
|
@@ -27,7 +28,7 @@ export const createTableFieldsPlugin = ({ context }) => {
|
|
|
27
28
|
data: response.data.map((changeset) => transformFieldItem(changeset.new)),
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
const createTableFieldsDefinition = createFunction(createTableFields,
|
|
31
|
+
const createTableFieldsDefinition = createFunction(createTableFields, CreateTableFieldsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, createTableFields.name));
|
|
31
32
|
return {
|
|
32
33
|
createTableFields: createTableFieldsDefinition,
|
|
33
34
|
context: {
|
|
@@ -39,7 +40,7 @@ export const createTableFieldsPlugin = ({ context }) => {
|
|
|
39
40
|
inputSchema: CreateTableFieldsOptionsSchema,
|
|
40
41
|
outputSchema: FieldItemSchema,
|
|
41
42
|
resolvers: {
|
|
42
|
-
|
|
43
|
+
table: tableIdResolver,
|
|
43
44
|
fields: tableFieldsResolver,
|
|
44
45
|
},
|
|
45
46
|
},
|
|
@@ -142,7 +142,6 @@ export declare const NewFieldSchema: z.ZodObject<{
|
|
|
142
142
|
}, z.core.$strip>;
|
|
143
143
|
export type NewField = z.infer<typeof NewFieldSchema>;
|
|
144
144
|
export declare const CreateTableFieldsOptionsSchema: z.ZodObject<{
|
|
145
|
-
tableId: z.ZodString;
|
|
146
145
|
fields: z.ZodArray<z.ZodObject<{
|
|
147
146
|
type: z.ZodEnum<{
|
|
148
147
|
string: "string";
|
|
@@ -180,8 +179,135 @@ export declare const CreateTableFieldsOptionsSchema: z.ZodObject<{
|
|
|
180
179
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
181
180
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
182
181
|
}, z.core.$strip>>;
|
|
182
|
+
table: z.ZodString & {
|
|
183
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
184
|
+
};
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
declare const CreateTableFieldsOptionsSchemaDeprecated: z.ZodObject<{
|
|
187
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
188
|
+
type: z.ZodEnum<{
|
|
189
|
+
string: "string";
|
|
190
|
+
number: "number";
|
|
191
|
+
boolean: "boolean";
|
|
192
|
+
link: "link";
|
|
193
|
+
email: "email";
|
|
194
|
+
uuid: "uuid";
|
|
195
|
+
text: "text";
|
|
196
|
+
datetime: "datetime";
|
|
197
|
+
decimal: "decimal";
|
|
198
|
+
json: "json";
|
|
199
|
+
multiple_string: "multiple_string";
|
|
200
|
+
labeled_string: "labeled_string";
|
|
201
|
+
multiple_labeled_string: "multiple_labeled_string";
|
|
202
|
+
multiple_text: "multiple_text";
|
|
203
|
+
multiple_boolean: "multiple_boolean";
|
|
204
|
+
multiple_number: "multiple_number";
|
|
205
|
+
multiple_decimal: "multiple_decimal";
|
|
206
|
+
multiple_datetime: "multiple_datetime";
|
|
207
|
+
multiple_uuid: "multiple_uuid";
|
|
208
|
+
multiple_json: "multiple_json";
|
|
209
|
+
formula: "formula";
|
|
210
|
+
button_trigger_zap: "button_trigger_zap";
|
|
211
|
+
button_continue_zap: "button_continue_zap";
|
|
212
|
+
multiple_email: "multiple_email";
|
|
213
|
+
multiple_link: "multiple_link";
|
|
214
|
+
currency: "currency";
|
|
215
|
+
phone_number: "phone_number";
|
|
216
|
+
ai_formula: "ai_formula";
|
|
217
|
+
linked_record: "linked_record";
|
|
218
|
+
multiple_linked_record: "multiple_linked_record";
|
|
219
|
+
}>;
|
|
220
|
+
name: z.ZodString;
|
|
221
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
222
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
+
}, z.core.$strip>>;
|
|
224
|
+
tableId: z.ZodString;
|
|
183
225
|
}, z.core.$strip>;
|
|
184
|
-
export
|
|
226
|
+
export declare const CreateTableFieldsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
227
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
228
|
+
type: z.ZodEnum<{
|
|
229
|
+
string: "string";
|
|
230
|
+
number: "number";
|
|
231
|
+
boolean: "boolean";
|
|
232
|
+
link: "link";
|
|
233
|
+
email: "email";
|
|
234
|
+
uuid: "uuid";
|
|
235
|
+
text: "text";
|
|
236
|
+
datetime: "datetime";
|
|
237
|
+
decimal: "decimal";
|
|
238
|
+
json: "json";
|
|
239
|
+
multiple_string: "multiple_string";
|
|
240
|
+
labeled_string: "labeled_string";
|
|
241
|
+
multiple_labeled_string: "multiple_labeled_string";
|
|
242
|
+
multiple_text: "multiple_text";
|
|
243
|
+
multiple_boolean: "multiple_boolean";
|
|
244
|
+
multiple_number: "multiple_number";
|
|
245
|
+
multiple_decimal: "multiple_decimal";
|
|
246
|
+
multiple_datetime: "multiple_datetime";
|
|
247
|
+
multiple_uuid: "multiple_uuid";
|
|
248
|
+
multiple_json: "multiple_json";
|
|
249
|
+
formula: "formula";
|
|
250
|
+
button_trigger_zap: "button_trigger_zap";
|
|
251
|
+
button_continue_zap: "button_continue_zap";
|
|
252
|
+
multiple_email: "multiple_email";
|
|
253
|
+
multiple_link: "multiple_link";
|
|
254
|
+
currency: "currency";
|
|
255
|
+
phone_number: "phone_number";
|
|
256
|
+
ai_formula: "ai_formula";
|
|
257
|
+
linked_record: "linked_record";
|
|
258
|
+
multiple_linked_record: "multiple_linked_record";
|
|
259
|
+
}>;
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
262
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
table: z.ZodString & {
|
|
265
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
266
|
+
};
|
|
267
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
268
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
269
|
+
type: z.ZodEnum<{
|
|
270
|
+
string: "string";
|
|
271
|
+
number: "number";
|
|
272
|
+
boolean: "boolean";
|
|
273
|
+
link: "link";
|
|
274
|
+
email: "email";
|
|
275
|
+
uuid: "uuid";
|
|
276
|
+
text: "text";
|
|
277
|
+
datetime: "datetime";
|
|
278
|
+
decimal: "decimal";
|
|
279
|
+
json: "json";
|
|
280
|
+
multiple_string: "multiple_string";
|
|
281
|
+
labeled_string: "labeled_string";
|
|
282
|
+
multiple_labeled_string: "multiple_labeled_string";
|
|
283
|
+
multiple_text: "multiple_text";
|
|
284
|
+
multiple_boolean: "multiple_boolean";
|
|
285
|
+
multiple_number: "multiple_number";
|
|
286
|
+
multiple_decimal: "multiple_decimal";
|
|
287
|
+
multiple_datetime: "multiple_datetime";
|
|
288
|
+
multiple_uuid: "multiple_uuid";
|
|
289
|
+
multiple_json: "multiple_json";
|
|
290
|
+
formula: "formula";
|
|
291
|
+
button_trigger_zap: "button_trigger_zap";
|
|
292
|
+
button_continue_zap: "button_continue_zap";
|
|
293
|
+
multiple_email: "multiple_email";
|
|
294
|
+
multiple_link: "multiple_link";
|
|
295
|
+
currency: "currency";
|
|
296
|
+
phone_number: "phone_number";
|
|
297
|
+
ai_formula: "ai_formula";
|
|
298
|
+
linked_record: "linked_record";
|
|
299
|
+
multiple_linked_record: "multiple_linked_record";
|
|
300
|
+
}>;
|
|
301
|
+
name: z.ZodString;
|
|
302
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
303
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
304
|
+
}, z.core.$strip>>;
|
|
305
|
+
tableId: z.ZodString;
|
|
306
|
+
}, z.core.$strip>]>;
|
|
307
|
+
export type CreateTableFieldsOptions = (z.infer<typeof CreateTableFieldsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof CreateTableFieldsOptionsSchemaDeprecated>, "tableId"> & FunctionOptions & {
|
|
308
|
+
/** @deprecated Use `table` instead. */
|
|
309
|
+
tableId: z.infer<typeof CreateTableFieldsOptionsSchemaDeprecated>["tableId"];
|
|
310
|
+
});
|
|
185
311
|
export interface CreateTableFieldsResult {
|
|
186
312
|
data: FieldItem[];
|
|
187
313
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/createTableFields/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/createTableFields/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,EACL,eAAe,EAEf,eAAe,EACf,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,CAAC;AAS1B,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,kCAAkC,CAC1C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAYtD,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAID,CAAC;AAG3C,QAAA,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK5C,CAAC;AAGH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKP,CAAC;AAG1C,MAAM,MAAM,wBAAwB,GAChC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,GAAG,eAAe,CAAC,GAClE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,EAAE,SAAS,CAAC,GACxE,eAAe,GAAG;IAChB,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,wCAAwC,CAChD,CAAC,SAAS,CAAC,CAAC;CACd,CAAC,CAAC;AAGT,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB;AAGD,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema } from "../../../types/properties";
|
|
2
3
|
import { FieldTypeSchema, FieldApiItemSchema, FieldItemSchema, } from "../listTableFields/schemas";
|
|
3
4
|
// Re-export for consumers
|
|
4
5
|
export { FieldTypeSchema, FieldItemSchema };
|
|
@@ -28,15 +29,30 @@ export const NewFieldSchema = z.object({
|
|
|
28
29
|
.optional()
|
|
29
30
|
.describe("Display configuration for the field"),
|
|
30
31
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
tableId: z
|
|
34
|
-
.string()
|
|
35
|
-
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
36
|
-
.describe("The unique identifier of the table"),
|
|
32
|
+
const CreateTableFieldsDescription = "Create one or more fields in a table";
|
|
33
|
+
const CreateTableFieldsBase = z.object({
|
|
37
34
|
fields: z
|
|
38
35
|
.array(NewFieldSchema)
|
|
39
36
|
.min(1)
|
|
40
37
|
.describe("Array of field definitions to create"),
|
|
38
|
+
});
|
|
39
|
+
// Schema for docs/registry (new param names only)
|
|
40
|
+
export const CreateTableFieldsOptionsSchema = CreateTableFieldsBase.extend({
|
|
41
|
+
table: TablePropertySchema,
|
|
41
42
|
})
|
|
42
|
-
.describe(
|
|
43
|
+
.describe(CreateTableFieldsDescription)
|
|
44
|
+
.meta({ aliases: { tableId: "table" } });
|
|
45
|
+
// Deprecated schema (backward compat)
|
|
46
|
+
const CreateTableFieldsOptionsSchemaDeprecated = CreateTableFieldsBase.extend({
|
|
47
|
+
tableId: z
|
|
48
|
+
.string()
|
|
49
|
+
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
50
|
+
.describe("The unique identifier of the table"),
|
|
51
|
+
});
|
|
52
|
+
// Union for runtime validation
|
|
53
|
+
export const CreateTableFieldsOptionsInputSchema = z
|
|
54
|
+
.union([
|
|
55
|
+
CreateTableFieldsOptionsSchema,
|
|
56
|
+
CreateTableFieldsOptionsSchemaDeprecated,
|
|
57
|
+
])
|
|
58
|
+
.describe(CreateTableFieldsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/createTableRecords/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/createTableRecords/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;AAYhE,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,CAuFjC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { CreateTableRecordsOptionsSchema, CreateTableRecordsApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
2
|
+
import { CreateTableRecordsOptionsSchema, CreateTableRecordsOptionsInputSchema, CreateTableRecordsApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableRecordsResolver } from "../../../resolvers";
|
|
@@ -8,12 +8,13 @@ import { createFieldKeyTranslator, transformRecordItem, throwOnRecordErrors, thr
|
|
|
8
8
|
export const createTableRecordsPlugin = ({ context }) => {
|
|
9
9
|
async function createTableRecords(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.post(`/tables/api/v1/tables/${
|
|
17
|
+
const rawResponse = await api.post(`/tables/api/v1/tables/${tableId}/records`, {
|
|
17
18
|
new_records: options.records.map((record) => ({
|
|
18
19
|
data: translator.translateInput(record.data),
|
|
19
20
|
})),
|
|
@@ -26,7 +27,7 @@ export const createTableRecordsPlugin = ({ context }) => {
|
|
|
26
27
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to create records. (HTTP ${status})`, { statusCode: status });
|
|
27
28
|
}
|
|
28
29
|
if (status === 404) {
|
|
29
|
-
return new Error(`Table not found: ${
|
|
30
|
+
return new Error(`Table not found: ${tableId}`);
|
|
30
31
|
}
|
|
31
32
|
return undefined;
|
|
32
33
|
},
|
|
@@ -44,7 +45,7 @@ export const createTableRecordsPlugin = ({ context }) => {
|
|
|
44
45
|
})),
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
const createTableRecordsDefinition = createFunction(createTableRecords,
|
|
48
|
+
const createTableRecordsDefinition = createFunction(createTableRecords, CreateTableRecordsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, createTableRecords.name));
|
|
48
49
|
return {
|
|
49
50
|
createTableRecords: createTableRecordsDefinition,
|
|
50
51
|
context: {
|
|
@@ -56,7 +57,7 @@ export const createTableRecordsPlugin = ({ context }) => {
|
|
|
56
57
|
inputSchema: CreateTableRecordsOptionsSchema,
|
|
57
58
|
outputSchema: RecordItemSchema,
|
|
58
59
|
resolvers: {
|
|
59
|
-
|
|
60
|
+
table: tableIdResolver,
|
|
60
61
|
records: tableRecordsResolver,
|
|
61
62
|
},
|
|
62
63
|
formatter: tableRecordFormatter,
|
|
@@ -37,7 +37,6 @@ export declare const NewRecordSchema: z.ZodObject<{
|
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export type NewRecord = z.infer<typeof NewRecordSchema>;
|
|
39
39
|
export declare const CreateTableRecordsOptionsSchema: z.ZodObject<{
|
|
40
|
-
tableId: z.ZodString;
|
|
41
40
|
records: z.ZodArray<z.ZodObject<{
|
|
42
41
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
43
42
|
}, z.core.$strip>>;
|
|
@@ -45,8 +44,45 @@ export declare const CreateTableRecordsOptionsSchema: z.ZodObject<{
|
|
|
45
44
|
names: "names";
|
|
46
45
|
ids: "ids";
|
|
47
46
|
}>>>;
|
|
47
|
+
table: z.ZodString & {
|
|
48
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
49
|
+
};
|
|
48
50
|
}, z.core.$strip>;
|
|
49
|
-
|
|
51
|
+
declare const CreateTableRecordsOptionsSchemaDeprecated: z.ZodObject<{
|
|
52
|
+
records: z.ZodArray<z.ZodObject<{
|
|
53
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
names: "names";
|
|
57
|
+
ids: "ids";
|
|
58
|
+
}>>>;
|
|
59
|
+
tableId: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export declare const CreateTableRecordsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
62
|
+
records: z.ZodArray<z.ZodObject<{
|
|
63
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
names: "names";
|
|
67
|
+
ids: "ids";
|
|
68
|
+
}>>>;
|
|
69
|
+
table: z.ZodString & {
|
|
70
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
71
|
+
};
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
records: z.ZodArray<z.ZodObject<{
|
|
74
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
names: "names";
|
|
78
|
+
ids: "ids";
|
|
79
|
+
}>>>;
|
|
80
|
+
tableId: z.ZodString;
|
|
81
|
+
}, z.core.$strip>]>;
|
|
82
|
+
export type CreateTableRecordsOptions = (z.infer<typeof CreateTableRecordsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof CreateTableRecordsOptionsSchemaDeprecated>, "tableId"> & FunctionOptions & {
|
|
83
|
+
/** @deprecated Use `table` instead. */
|
|
84
|
+
tableId: z.infer<typeof CreateTableRecordsOptionsSchemaDeprecated>["tableId"];
|
|
85
|
+
});
|
|
50
86
|
export interface CreateTableRecordsResult {
|
|
51
87
|
data: RecordItem[];
|
|
52
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/createTableRecords/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/createTableRecords/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;AAW3B,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,eAAe;;iBAI1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAcxD,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 NewRecordSchema = z.object({
|
|
|
19
20
|
.record(z.string(), z.unknown())
|
|
20
21
|
.describe("The field values for the record, keyed by field ID"),
|
|
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 CreateTableRecordsDescription = "Create one or more records in a table";
|
|
24
|
+
const CreateTableRecordsBase = z.object({
|
|
28
25
|
records: z
|
|
29
26
|
.array(NewRecordSchema)
|
|
30
27
|
.min(1)
|
|
31
28
|
.max(100)
|
|
32
29
|
.describe("Array of records to create (max 100)"),
|
|
33
30
|
keyMode: KeyModeSchema,
|
|
31
|
+
});
|
|
32
|
+
// Schema for docs/registry (new param names only)
|
|
33
|
+
export const CreateTableRecordsOptionsSchema = CreateTableRecordsBase.extend({
|
|
34
|
+
table: TablePropertySchema,
|
|
34
35
|
})
|
|
35
|
-
.describe(
|
|
36
|
+
.describe(CreateTableRecordsDescription)
|
|
37
|
+
.meta({ aliases: { tableId: "table" } });
|
|
38
|
+
// Deprecated schema (backward compat)
|
|
39
|
+
const CreateTableRecordsOptionsSchemaDeprecated = CreateTableRecordsBase.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 CreateTableRecordsOptionsInputSchema = z
|
|
47
|
+
.union([
|
|
48
|
+
CreateTableRecordsOptionsSchema,
|
|
49
|
+
CreateTableRecordsOptionsSchemaDeprecated,
|
|
50
|
+
])
|
|
51
|
+
.describe(CreateTableRecordsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTable/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,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTable/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,wBAAwB,EAExB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,wBAAwB,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,GAAG,mBAAmB,EAC/D,yBAAyB,CA2D1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { DeleteTableOptionsSchema, } from "./schemas";
|
|
2
|
+
import { DeleteTableOptionsSchema, DeleteTableOptionsInputSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver } from "../../../resolvers";
|
|
@@ -7,7 +7,8 @@ export const deleteTablePlugin = ({ context }) => {
|
|
|
7
7
|
async function deleteTable(options) {
|
|
8
8
|
await context.checkCapability("canDeleteTables");
|
|
9
9
|
const { api } = context;
|
|
10
|
-
|
|
10
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
+
await api.delete(`/tables/api/v1/tables/${tableId}`, undefined, {
|
|
11
12
|
customErrorHandler: ({ status }) => {
|
|
12
13
|
if (status === 401) {
|
|
13
14
|
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete tables or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
@@ -23,7 +24,7 @@ export const deleteTablePlugin = ({ context }) => {
|
|
|
23
24
|
success: true,
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
const deleteTableDefinition = createFunction(deleteTable,
|
|
27
|
+
const deleteTableDefinition = createFunction(deleteTable, DeleteTableOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, deleteTable.name));
|
|
27
28
|
return {
|
|
28
29
|
deleteTable: deleteTableDefinition,
|
|
29
30
|
context: {
|
|
@@ -34,7 +35,7 @@ export const deleteTablePlugin = ({ context }) => {
|
|
|
34
35
|
itemType: "Table",
|
|
35
36
|
inputSchema: DeleteTableOptionsSchema,
|
|
36
37
|
resolvers: {
|
|
37
|
-
|
|
38
|
+
table: tableIdResolver,
|
|
38
39
|
},
|
|
39
40
|
confirm: "delete",
|
|
40
41
|
},
|
|
@@ -2,9 +2,24 @@ import { z } from "zod";
|
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierNotFoundError, ZapierUnknownError } from "../../../types/errors";
|
|
4
4
|
export declare const DeleteTableOptionsSchema: z.ZodObject<{
|
|
5
|
+
table: z.ZodString & {
|
|
6
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
7
|
+
};
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const DeleteTableOptionsSchemaDeprecated: z.ZodObject<{
|
|
5
10
|
tableId: z.ZodString;
|
|
6
11
|
}, z.core.$strip>;
|
|
7
|
-
export
|
|
12
|
+
export declare const DeleteTableOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
13
|
+
table: z.ZodString & {
|
|
14
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
15
|
+
};
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
tableId: z.ZodString;
|
|
18
|
+
}, z.core.$strip>]>;
|
|
19
|
+
export type DeleteTableOptions = (z.infer<typeof DeleteTableOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof DeleteTableOptionsSchemaDeprecated>, "tableId"> & FunctionOptions & {
|
|
20
|
+
/** @deprecated Use `table` instead. */
|
|
21
|
+
tableId: z.infer<typeof DeleteTableOptionsSchemaDeprecated>["tableId"];
|
|
22
|
+
});
|
|
8
23
|
export interface DeleteTableResult {
|
|
9
24
|
success: boolean;
|
|
10
25
|
}
|
|
@@ -12,4 +27,5 @@ export type DeleteTableError = ZapierAuthenticationError | ZapierApiError | Zapi
|
|
|
12
27
|
export interface DeleteTableSdkFunction {
|
|
13
28
|
deleteTable: (options: DeleteTableOptions) => Promise<DeleteTableResult>;
|
|
14
29
|
}
|
|
30
|
+
export {};
|
|
15
31
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTable/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/deleteTable/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,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,wBAAwB;;;;iBAKK,CAAC;AAG3C,QAAA,MAAM,kCAAkC;;iBAKtC,CAAC;AAGH,eAAO,MAAM,6BAA6B;;;;;;mBAEP,CAAC;AAGpC,MAAM,MAAM,kBAAkB,GAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,GAAG,eAAe,CAAC,GAC5D,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,EAAE,SAAS,CAAC,GAClE,eAAe,GAAG;IAChB,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC,SAAS,CAAC,CAAC;CACxE,CAAC,CAAC;AAGT,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1E"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema } from "../../../types/properties";
|
|
3
|
+
const DeleteTableDescription = "Delete a table by its ID";
|
|
4
|
+
// Schema for docs/registry (new param names only)
|
|
2
5
|
export const DeleteTableOptionsSchema = z
|
|
3
6
|
.object({
|
|
7
|
+
table: TablePropertySchema,
|
|
8
|
+
})
|
|
9
|
+
.describe(DeleteTableDescription)
|
|
10
|
+
.meta({ aliases: { tableId: "table" } });
|
|
11
|
+
// Deprecated schema (backward compat)
|
|
12
|
+
const DeleteTableOptionsSchemaDeprecated = z.object({
|
|
4
13
|
tableId: z
|
|
5
14
|
.string()
|
|
6
15
|
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
7
16
|
.describe("The unique identifier of the table to delete"),
|
|
8
|
-
})
|
|
9
|
-
|
|
17
|
+
});
|
|
18
|
+
// Union for runtime validation
|
|
19
|
+
export const DeleteTableOptionsInputSchema = z
|
|
20
|
+
.union([DeleteTableOptionsSchema, DeleteTableOptionsSchemaDeprecated])
|
|
21
|
+
.describe(DeleteTableDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/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,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/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,8BAA8B,EAE9B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAMhE,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,iBAAiB,EAAE;gBACjB,WAAW,EAAE,OAAO,8BAA8B,CAAC;aACpD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EACzC,+BAA+B,CAsEhC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { DeleteTableFieldsOptionsSchema, } from "./schemas";
|
|
2
|
+
import { DeleteTableFieldsOptionsSchema, DeleteTableFieldsOptionsInputSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableFieldIdsResolver } from "../../../resolvers";
|
|
@@ -7,12 +7,14 @@ import { resolveFieldKeys } from "../utils";
|
|
|
7
7
|
export const deleteTableFieldsPlugin = ({ context }) => {
|
|
8
8
|
async function deleteTableFields(options) {
|
|
9
9
|
const { api } = context;
|
|
10
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
+
const fieldKeys = "fields" in options ? options.fields : options.fieldKeys;
|
|
10
12
|
const numericFieldIds = await resolveFieldKeys({
|
|
11
13
|
api,
|
|
12
|
-
tableId
|
|
13
|
-
fieldKeys
|
|
14
|
+
tableId,
|
|
15
|
+
fieldKeys,
|
|
14
16
|
});
|
|
15
|
-
await api.delete(`/tables/api/v1/tables/${
|
|
17
|
+
await api.delete(`/tables/api/v1/tables/${tableId}/fields`, { field_ids: numericFieldIds }, {
|
|
16
18
|
customErrorHandler: ({ status }) => {
|
|
17
19
|
if (status === 401) {
|
|
18
20
|
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete fields or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
@@ -28,7 +30,7 @@ export const deleteTableFieldsPlugin = ({ context }) => {
|
|
|
28
30
|
success: true,
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
|
-
const deleteTableFieldsDefinition = createFunction(deleteTableFields,
|
|
33
|
+
const deleteTableFieldsDefinition = createFunction(deleteTableFields, DeleteTableFieldsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, deleteTableFields.name));
|
|
32
34
|
return {
|
|
33
35
|
deleteTableFields: deleteTableFieldsDefinition,
|
|
34
36
|
context: {
|
|
@@ -39,8 +41,8 @@ export const deleteTableFieldsPlugin = ({ context }) => {
|
|
|
39
41
|
itemType: "Field",
|
|
40
42
|
inputSchema: DeleteTableFieldsOptionsSchema,
|
|
41
43
|
resolvers: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
table: tableIdResolver,
|
|
45
|
+
fields: tableFieldIdsResolver,
|
|
44
46
|
},
|
|
45
47
|
confirm: "delete",
|
|
46
48
|
},
|
|
@@ -2,10 +2,30 @@ import { z } from "zod";
|
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierNotFoundError, ZapierUnknownError } from "../../../types/errors";
|
|
4
4
|
export declare const DeleteTableFieldsOptionsSchema: z.ZodObject<{
|
|
5
|
+
table: z.ZodString & {
|
|
6
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
7
|
+
};
|
|
8
|
+
fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const DeleteTableFieldsOptionsSchemaDeprecated: z.ZodObject<{
|
|
5
11
|
tableId: z.ZodString;
|
|
6
12
|
fieldKeys: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
7
13
|
}, z.core.$strip>;
|
|
8
|
-
export
|
|
14
|
+
export declare const DeleteTableFieldsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
15
|
+
table: z.ZodString & {
|
|
16
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
17
|
+
};
|
|
18
|
+
fields: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
tableId: z.ZodString;
|
|
21
|
+
fieldKeys: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
22
|
+
}, z.core.$strip>]>;
|
|
23
|
+
export type DeleteTableFieldsOptions = (z.infer<typeof DeleteTableFieldsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof DeleteTableFieldsOptionsSchemaDeprecated>, "tableId" | "fieldKeys"> & {
|
|
24
|
+
/** @deprecated Use `table` instead. */
|
|
25
|
+
tableId: z.infer<typeof DeleteTableFieldsOptionsSchemaDeprecated>["tableId"];
|
|
26
|
+
/** @deprecated Use `fields` instead. */
|
|
27
|
+
fieldKeys: z.infer<typeof DeleteTableFieldsOptionsSchemaDeprecated>["fieldKeys"];
|
|
28
|
+
} & FunctionOptions);
|
|
9
29
|
export interface DeleteTableFieldsResult {
|
|
10
30
|
success: boolean;
|
|
11
31
|
}
|
|
@@ -13,4 +33,5 @@ export type DeleteTableFieldsError = ZapierAuthenticationError | ZapierApiError
|
|
|
13
33
|
export interface DeleteTableFieldsSdkFunction {
|
|
14
34
|
deleteTableFields: (options: DeleteTableFieldsOptions) => Promise<DeleteTableFieldsResult>;
|
|
15
35
|
}
|
|
36
|
+
export {};
|
|
16
37
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAS/B,eAAO,MAAM,8BAA8B;;;;;iBAMoB,CAAC;AAGhE,QAAA,MAAM,wCAAwC;;;iBAW5C,CAAC;AAGH,eAAO,MAAM,mCAAmC;;;;;;;;mBAKP,CAAC;AAG1C,MAAM,MAAM,wBAAwB,GAChC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,GAAG,eAAe,CAAC,GAClE,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,EACxD,SAAS,GAAG,WAAW,CACxB,GAAG;IACF,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,wCAAwC,CAChD,CAAC,SAAS,CAAC,CAAC;IACb,wCAAwC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,wCAAwC,CAChD,CAAC,WAAW,CAAC,CAAC;CAChB,GAAG,eAAe,CAAC,CAAC;AAGzB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvC"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema, FieldsPropertySchema, } from "../../../types/properties";
|
|
3
|
+
const DeleteTableFieldsDescription = "Delete one or more fields from a table";
|
|
4
|
+
// Schema for docs/registry (new param names only)
|
|
2
5
|
export const DeleteTableFieldsOptionsSchema = z
|
|
3
6
|
.object({
|
|
7
|
+
table: TablePropertySchema,
|
|
8
|
+
fields: FieldsPropertySchema.min(1),
|
|
9
|
+
})
|
|
10
|
+
.describe(DeleteTableFieldsDescription)
|
|
11
|
+
.meta({ aliases: { tableId: "table", fieldKeys: "fields" } });
|
|
12
|
+
// Deprecated schema (backward compat)
|
|
13
|
+
const DeleteTableFieldsOptionsSchemaDeprecated = z.object({
|
|
4
14
|
tableId: z
|
|
5
15
|
.string()
|
|
6
16
|
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
@@ -9,5 +19,11 @@ export const DeleteTableFieldsOptionsSchema = z
|
|
|
9
19
|
.array(z.union([z.string(), z.number()]))
|
|
10
20
|
.min(1)
|
|
11
21
|
.describe('Fields to delete. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'),
|
|
12
|
-
})
|
|
13
|
-
|
|
22
|
+
});
|
|
23
|
+
// Union for runtime validation
|
|
24
|
+
export const DeleteTableFieldsOptionsInputSchema = z
|
|
25
|
+
.union([
|
|
26
|
+
DeleteTableFieldsOptionsSchema,
|
|
27
|
+
DeleteTableFieldsOptionsSchemaDeprecated,
|
|
28
|
+
])
|
|
29
|
+
.describe(DeleteTableFieldsDescription);
|