@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableRecords/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/deleteTableRecords/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,EAE/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAKhE,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,CAiEjC,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { DeleteTableRecordsOptionsSchema, } from "./schemas";
|
|
2
|
+
import { DeleteTableRecordsOptionsSchema, DeleteTableRecordsOptionsInputSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableRecordIdsResolver } from "../../../resolvers";
|
|
6
6
|
export const deleteTableRecordsPlugin = ({ context }) => {
|
|
7
7
|
async function deleteTableRecords(options) {
|
|
8
8
|
const { api } = context;
|
|
9
|
-
|
|
9
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
10
|
+
const recordIds = "records" in options ? options.records : options.recordIds;
|
|
11
|
+
await api.delete(`/tables/api/v1/tables/${tableId}/records`, { record_ids: recordIds }, {
|
|
10
12
|
customErrorHandler: ({ status }) => {
|
|
11
13
|
if (status === 401) {
|
|
12
14
|
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete records or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
@@ -22,7 +24,7 @@ export const deleteTableRecordsPlugin = ({ context }) => {
|
|
|
22
24
|
success: true,
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
|
-
const deleteTableRecordsDefinition = createFunction(deleteTableRecords,
|
|
27
|
+
const deleteTableRecordsDefinition = createFunction(deleteTableRecords, DeleteTableRecordsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, deleteTableRecords.name));
|
|
26
28
|
return {
|
|
27
29
|
deleteTableRecords: deleteTableRecordsDefinition,
|
|
28
30
|
context: {
|
|
@@ -33,8 +35,8 @@ export const deleteTableRecordsPlugin = ({ context }) => {
|
|
|
33
35
|
itemType: "Record",
|
|
34
36
|
inputSchema: DeleteTableRecordsOptionsSchema,
|
|
35
37
|
resolvers: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
table: tableIdResolver,
|
|
39
|
+
records: tableRecordIdsResolver,
|
|
38
40
|
},
|
|
39
41
|
confirm: "delete",
|
|
40
42
|
},
|
|
@@ -2,10 +2,30 @@ import { z } from "zod";
|
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../../types/errors";
|
|
4
4
|
export declare const DeleteTableRecordsOptionsSchema: z.ZodObject<{
|
|
5
|
+
table: z.ZodString & {
|
|
6
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
7
|
+
};
|
|
8
|
+
records: z.ZodArray<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const DeleteTableRecordsOptionsSchemaDeprecated: z.ZodObject<{
|
|
5
11
|
tableId: z.ZodString;
|
|
6
12
|
recordIds: z.ZodArray<z.ZodString>;
|
|
7
13
|
}, z.core.$strip>;
|
|
8
|
-
export
|
|
14
|
+
export declare const DeleteTableRecordsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
15
|
+
table: z.ZodString & {
|
|
16
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
17
|
+
};
|
|
18
|
+
records: z.ZodArray<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
tableId: z.ZodString;
|
|
21
|
+
recordIds: z.ZodArray<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>]>;
|
|
23
|
+
export type DeleteTableRecordsOptions = (z.infer<typeof DeleteTableRecordsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof DeleteTableRecordsOptionsSchemaDeprecated>, "tableId" | "recordIds"> & {
|
|
24
|
+
/** @deprecated Use `table` instead. */
|
|
25
|
+
tableId: z.infer<typeof DeleteTableRecordsOptionsSchemaDeprecated>["tableId"];
|
|
26
|
+
/** @deprecated Use `records` instead. */
|
|
27
|
+
recordIds: z.infer<typeof DeleteTableRecordsOptionsSchemaDeprecated>["recordIds"];
|
|
28
|
+
} & FunctionOptions);
|
|
9
29
|
export interface DeleteTableRecordsResult {
|
|
10
30
|
success: boolean;
|
|
11
31
|
}
|
|
@@ -13,4 +33,5 @@ export type DeleteTableRecordsError = ZapierAuthenticationError | ZapierApiError
|
|
|
13
33
|
export interface DeleteTableRecordsSdkFunction {
|
|
14
34
|
deleteTableRecords: (options: DeleteTableRecordsOptions) => Promise<DeleteTableRecordsResult>;
|
|
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/deleteTableRecords/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableRecords/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAS/B,eAAO,MAAM,+BAA+B;;;;;iBAMoB,CAAC;AAGjE,QAAA,MAAM,yCAAyC;;;iBAU7C,CAAC;AAGH,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,GAAG,WAAW,CACxB,GAAG;IACF,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,yCAAyC,CACjD,CAAC,SAAS,CAAC,CAAC;IACb,yCAAyC;IACzC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,yCAAyC,CACjD,CAAC,WAAW,CAAC,CAAC;CAChB,GAAG,eAAe,CAAC,CAAC;AAEzB,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;CAClB;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,6 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema, RecordsPropertySchema, } from "../../../types/properties";
|
|
3
|
+
const DeleteTableRecordsDescription = "Delete one or more records from a table";
|
|
4
|
+
// Schema for docs/registry (new param names only)
|
|
2
5
|
export const DeleteTableRecordsOptionsSchema = z
|
|
3
6
|
.object({
|
|
7
|
+
table: TablePropertySchema,
|
|
8
|
+
records: RecordsPropertySchema,
|
|
9
|
+
})
|
|
10
|
+
.describe(DeleteTableRecordsDescription)
|
|
11
|
+
.meta({ aliases: { tableId: "table", recordIds: "records" } });
|
|
12
|
+
// Deprecated schema (backward compat)
|
|
13
|
+
const DeleteTableRecordsOptionsSchemaDeprecated = z.object({
|
|
4
14
|
tableId: z
|
|
5
15
|
.string()
|
|
6
16
|
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
@@ -10,5 +20,11 @@ export const DeleteTableRecordsOptionsSchema = z
|
|
|
10
20
|
.min(1)
|
|
11
21
|
.max(100)
|
|
12
22
|
.describe("Array of record IDs to delete (max 100)"),
|
|
13
|
-
})
|
|
14
|
-
|
|
23
|
+
});
|
|
24
|
+
// Union for runtime validation
|
|
25
|
+
export const DeleteTableRecordsOptionsInputSchema = z
|
|
26
|
+
.union([
|
|
27
|
+
DeleteTableRecordsOptionsSchema,
|
|
28
|
+
DeleteTableRecordsOptionsSchemaDeprecated,
|
|
29
|
+
])
|
|
30
|
+
.describe(DeleteTableRecordsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAEL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAEL,qBAAqB,EAGrB,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAMhE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACrE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,WAAW,EAAE,OAAO,qBAAqB,CAAC;aAC3C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EACzC,sBAAsB,CA8DvB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { GetTableApiResponseSchema, GetTableOptionsSchema, TableItemSchema, } from "./schemas";
|
|
2
|
+
import { GetTableApiResponseSchema, GetTableOptionsSchema, GetTableOptionsInputSchema, TableItemSchema, } 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 @@ import { transformTableItem } from "../utils";
|
|
|
7
7
|
export const getTablePlugin = ({ context }) => {
|
|
8
8
|
async function getTable(options) {
|
|
9
9
|
const { api } = context;
|
|
10
|
-
const
|
|
10
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
+
const rawResponse = await api.get(`/tables/api/v1/tables/${tableId}`, {
|
|
11
12
|
customErrorHandler: ({ status }) => {
|
|
12
13
|
if (status === 401) {
|
|
13
14
|
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access this table or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
@@ -16,7 +17,7 @@ export const getTablePlugin = ({ context }) => {
|
|
|
16
17
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to access this table. (HTTP ${status})`, { statusCode: status });
|
|
17
18
|
}
|
|
18
19
|
if (status === 404) {
|
|
19
|
-
return new Error(`Table not found: ${
|
|
20
|
+
return new Error(`Table not found: ${tableId}`);
|
|
20
21
|
}
|
|
21
22
|
return undefined;
|
|
22
23
|
},
|
|
@@ -27,7 +28,7 @@ export const getTablePlugin = ({ context }) => {
|
|
|
27
28
|
data: transformTableItem(response.data),
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
const getTableDefinition = createFunction(getTable,
|
|
31
|
+
const getTableDefinition = createFunction(getTable, GetTableOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getTable.name));
|
|
31
32
|
return {
|
|
32
33
|
getTable: getTableDefinition,
|
|
33
34
|
context: {
|
|
@@ -39,7 +40,7 @@ export const getTablePlugin = ({ context }) => {
|
|
|
39
40
|
inputSchema: GetTableOptionsSchema,
|
|
40
41
|
outputSchema: TableItemSchema,
|
|
41
42
|
resolvers: {
|
|
42
|
-
|
|
43
|
+
table: tableIdResolver,
|
|
43
44
|
},
|
|
44
45
|
},
|
|
45
46
|
},
|
|
@@ -22,9 +22,24 @@ export declare const GetTableApiResponseSchema: z.ZodObject<{
|
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
export type GetTableApiResponse = z.infer<typeof GetTableApiResponseSchema>;
|
|
24
24
|
export declare const GetTableOptionsSchema: z.ZodObject<{
|
|
25
|
+
table: z.ZodString & {
|
|
26
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
27
|
+
};
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
declare const GetTableOptionsSchemaDeprecated: z.ZodObject<{
|
|
25
30
|
tableId: z.ZodString;
|
|
26
31
|
}, z.core.$strip>;
|
|
27
|
-
export
|
|
32
|
+
export declare const GetTableOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
33
|
+
table: z.ZodString & {
|
|
34
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
35
|
+
};
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
tableId: z.ZodString;
|
|
38
|
+
}, z.core.$strip>]>;
|
|
39
|
+
export type GetTableOptions = z.infer<typeof GetTableOptionsSchema> | (Omit<z.infer<typeof GetTableOptionsSchemaDeprecated>, "tableId"> & {
|
|
40
|
+
/** @deprecated Use `table` instead. */
|
|
41
|
+
tableId: z.infer<typeof GetTableOptionsSchemaDeprecated>["tableId"];
|
|
42
|
+
});
|
|
28
43
|
export type GetTableError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
29
44
|
export interface GetTableSdkFunction {
|
|
30
45
|
getTable: (options: GetTableOptions) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAExC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAK5E,eAAO,MAAM,qBAAqB;;;;iBAKQ,CAAC;AAG3C,QAAA,MAAM,+BAA+B;;iBAKnC,CAAC;AAGH,eAAO,MAAM,0BAA0B;;;;;;mBAEP,CAAC;AAGjC,MAAM,MAAM,eAAe,GACvB,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GACrC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,EAAE,SAAS,CAAC,GAAG;IAClE,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC,SAAS,CAAC,CAAC;CACrE,CAAC,CAAC;AAGP,MAAM,MAAM,aAAa,GACrB,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CACtE"}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TablePropertySchema } from "../../../types/properties";
|
|
2
3
|
import { TableItemSchema, TableApiItemSchema, } from "../listTables/schemas";
|
|
3
4
|
// Re-export for consumers
|
|
4
5
|
export { TableItemSchema, TableApiItemSchema };
|
|
5
6
|
export const GetTableApiResponseSchema = z.object({
|
|
6
7
|
data: TableApiItemSchema,
|
|
7
8
|
});
|
|
9
|
+
const GetTableDescription = "Get detailed information about a specific table";
|
|
10
|
+
// Schema for docs/registry (new param names only)
|
|
8
11
|
export const GetTableOptionsSchema = z
|
|
9
12
|
.object({
|
|
13
|
+
table: TablePropertySchema,
|
|
14
|
+
})
|
|
15
|
+
.describe(GetTableDescription)
|
|
16
|
+
.meta({ aliases: { tableId: "table" } });
|
|
17
|
+
// Deprecated schema (backward compat)
|
|
18
|
+
const GetTableOptionsSchemaDeprecated = z.object({
|
|
10
19
|
tableId: z
|
|
11
20
|
.string()
|
|
12
21
|
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
13
22
|
.describe("The unique identifier of the table to retrieve"),
|
|
14
|
-
})
|
|
15
|
-
|
|
23
|
+
});
|
|
24
|
+
// Union for runtime validation
|
|
25
|
+
export const GetTableOptionsInputSchema = z
|
|
26
|
+
.union([GetTableOptionsSchema, GetTableOptionsSchemaDeprecated])
|
|
27
|
+
.describe(GetTableDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTableRecord/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,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTableRecord/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,2BAA2B,EAI3B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAQhE,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,CACd,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACnC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,cAAc,EAAE;gBACd,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EACzC,4BAA4B,CA8E7B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { GetTableRecordOptionsSchema, GetTableRecordApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
2
|
+
import { GetTableRecordOptionsSchema, GetTableRecordOptionsInputSchema, GetTableRecordApiResponseSchema, RecordItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver, tableRecordIdResolver } from "../../../resolvers";
|
|
@@ -9,7 +9,9 @@ import { transformRecordItem } from "../utils";
|
|
|
9
9
|
export const getTableRecordPlugin = ({ context }) => {
|
|
10
10
|
async function getTableRecord(options) {
|
|
11
11
|
const { api } = context;
|
|
12
|
-
const
|
|
12
|
+
const tableId = "table" in options ? options.table : options.tableId;
|
|
13
|
+
const recordId = "record" in options ? options.record : options.recordId;
|
|
14
|
+
const rawResponse = await api.get(`/tables/api/v1/tables/${tableId}/records/${recordId}`, {
|
|
13
15
|
customErrorHandler: ({ status }) => {
|
|
14
16
|
if (status === 401) {
|
|
15
17
|
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access this record or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
@@ -18,7 +20,7 @@ export const getTableRecordPlugin = ({ context }) => {
|
|
|
18
20
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to access this record. (HTTP ${status})`, { statusCode: status });
|
|
19
21
|
}
|
|
20
22
|
if (status === 404) {
|
|
21
|
-
return new Error(`Record not found: ${
|
|
23
|
+
return new Error(`Record not found: ${recordId}`);
|
|
22
24
|
}
|
|
23
25
|
return undefined;
|
|
24
26
|
},
|
|
@@ -27,7 +29,7 @@ export const getTableRecordPlugin = ({ context }) => {
|
|
|
27
29
|
const response = GetTableRecordApiResponseSchema.parse(rawResponse);
|
|
28
30
|
const translator = await createFieldKeyTranslator({
|
|
29
31
|
api,
|
|
30
|
-
tableId
|
|
32
|
+
tableId,
|
|
31
33
|
keyMode: options.keyMode,
|
|
32
34
|
});
|
|
33
35
|
return {
|
|
@@ -37,7 +39,7 @@ export const getTableRecordPlugin = ({ context }) => {
|
|
|
37
39
|
},
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
|
-
const getTableRecordDefinition = createFunction(getTableRecord,
|
|
42
|
+
const getTableRecordDefinition = createFunction(getTableRecord, GetTableRecordOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getTableRecord.name));
|
|
41
43
|
return {
|
|
42
44
|
getTableRecord: getTableRecordDefinition,
|
|
43
45
|
context: {
|
|
@@ -49,8 +51,8 @@ export const getTableRecordPlugin = ({ context }) => {
|
|
|
49
51
|
inputSchema: GetTableRecordOptionsSchema,
|
|
50
52
|
outputSchema: RecordItemSchema,
|
|
51
53
|
resolvers: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
table: tableIdResolver,
|
|
55
|
+
record: tableRecordIdResolver,
|
|
54
56
|
},
|
|
55
57
|
formatter: tableRecordFormatter,
|
|
56
58
|
},
|
|
@@ -33,14 +33,50 @@ export declare const GetTableRecordApiResponseSchema: z.ZodObject<{
|
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
export type GetTableRecordApiResponse = z.infer<typeof GetTableRecordApiResponseSchema>;
|
|
35
35
|
export declare const GetTableRecordOptionsSchema: z.ZodObject<{
|
|
36
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
names: "names";
|
|
38
|
+
ids: "ids";
|
|
39
|
+
}>>>;
|
|
40
|
+
table: z.ZodString & {
|
|
41
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
42
|
+
};
|
|
43
|
+
record: z.ZodString & {
|
|
44
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
45
|
+
};
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
declare const GetTableRecordOptionsSchemaDeprecated: z.ZodObject<{
|
|
48
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
names: "names";
|
|
50
|
+
ids: "ids";
|
|
51
|
+
}>>>;
|
|
36
52
|
tableId: z.ZodString;
|
|
37
53
|
recordId: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const GetTableRecordOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
38
56
|
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
39
57
|
names: "names";
|
|
40
58
|
ids: "ids";
|
|
41
59
|
}>>>;
|
|
42
|
-
|
|
43
|
-
|
|
60
|
+
table: z.ZodString & {
|
|
61
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
62
|
+
};
|
|
63
|
+
record: z.ZodString & {
|
|
64
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
65
|
+
};
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
keyMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
names: "names";
|
|
69
|
+
ids: "ids";
|
|
70
|
+
}>>>;
|
|
71
|
+
tableId: z.ZodString;
|
|
72
|
+
recordId: z.ZodString;
|
|
73
|
+
}, z.core.$strip>]>;
|
|
74
|
+
export type GetTableRecordOptions = (z.infer<typeof GetTableRecordOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof GetTableRecordOptionsSchemaDeprecated>, "tableId" | "recordId"> & {
|
|
75
|
+
/** @deprecated Use `table` instead. */
|
|
76
|
+
tableId: z.infer<typeof GetTableRecordOptionsSchemaDeprecated>["tableId"];
|
|
77
|
+
/** @deprecated Use `record` instead. */
|
|
78
|
+
recordId: z.infer<typeof GetTableRecordOptionsSchemaDeprecated>["recordId"];
|
|
79
|
+
} & FunctionOptions);
|
|
44
80
|
export interface GetTableRecordResult {
|
|
45
81
|
data: RecordItem;
|
|
46
82
|
}
|
|
@@ -48,4 +84,5 @@ export type GetTableRecordError = ZapierAuthenticationError | ZapierApiError | Z
|
|
|
48
84
|
export interface GetTableRecordSdkFunction {
|
|
49
85
|
getTableRecord: (options: GetTableRecordOptions) => Promise<GetTableRecordResult>;
|
|
50
86
|
}
|
|
87
|
+
export {};
|
|
51
88
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTableRecord/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTableRecord/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,mBAAmB;;;;;;;;;iBAS9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAUhE,eAAO,MAAM,gBAAgB;;;;;iBAO3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,+BAA+B;;;;;;;;;;;iBAE1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAUF,eAAO,MAAM,2BAA2B;;;;;;;;;;;iBAMwB,CAAC;AAGjE,QAAA,MAAM,qCAAqC;;;;;;;iBAUvC,CAAC;AAGL,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;mBAEP,CAAC;AAGvC,MAAM,MAAM,qBAAqB,GAC7B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,GAAG,eAAe,CAAC,GAC/D,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,EACrD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1E,wCAAwC;IACxC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,OAAO,qCAAqC,CAC7C,CAAC,UAAU,CAAC,CAAC;CACf,GAAG,eAAe,CAAC,CAAC;AAEzB,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,CACd,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { withFormatter } from "../../../utils/schema-utils";
|
|
3
3
|
import { KeyModeSchema } from "../utils";
|
|
4
|
+
import { TablePropertySchema, RecordPropertySchema, } from "../../../types/properties";
|
|
4
5
|
export const RecordApiItemSchema = z.object({
|
|
5
6
|
id: z.string().regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID"),
|
|
6
7
|
data: z.record(z.string(), z.unknown()),
|
|
@@ -29,8 +30,20 @@ export const RecordItemSchema = withFormatter(RecordItemSchemaBase, {
|
|
|
29
30
|
export const GetTableRecordApiResponseSchema = z.object({
|
|
30
31
|
data: RecordApiItemSchema,
|
|
31
32
|
});
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const GetTableRecordDescription = "Get a single record from a table by ID";
|
|
34
|
+
// Base schema for shared (non-renamed) properties
|
|
35
|
+
const GetTableRecordOptionsBaseSchema = z.object({
|
|
36
|
+
keyMode: KeyModeSchema,
|
|
37
|
+
});
|
|
38
|
+
// Schema for docs/registry (new param names only)
|
|
39
|
+
export const GetTableRecordOptionsSchema = GetTableRecordOptionsBaseSchema.extend({
|
|
40
|
+
table: TablePropertySchema,
|
|
41
|
+
record: RecordPropertySchema,
|
|
42
|
+
})
|
|
43
|
+
.describe(GetTableRecordDescription)
|
|
44
|
+
.meta({ aliases: { tableId: "table", recordId: "record" } });
|
|
45
|
+
// Deprecated schema (backward compat)
|
|
46
|
+
const GetTableRecordOptionsSchemaDeprecated = GetTableRecordOptionsBaseSchema.extend({
|
|
34
47
|
tableId: z
|
|
35
48
|
.string()
|
|
36
49
|
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
@@ -39,6 +52,8 @@ export const GetTableRecordOptionsSchema = z
|
|
|
39
52
|
.string()
|
|
40
53
|
.regex(/^[A-Z0-9]{26}$/, "Record ID must be a valid ULID")
|
|
41
54
|
.describe("The unique identifier of the record"),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
});
|
|
56
|
+
// Union for runtime validation
|
|
57
|
+
export const GetTableRecordOptionsInputSchema = z
|
|
58
|
+
.union([GetTableRecordOptionsSchema, GetTableRecordOptionsSchemaDeprecated])
|
|
59
|
+
.describe(GetTableRecordDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableFields/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,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableFields/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,4BAA4B,EAI5B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAMhE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CACf,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,4BAA4B,CAAC;aAClD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,EAAE,EACF;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EACzC,6BAA6B,CA+E9B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createFunction } from "../../../utils/function-utils";
|
|
2
|
-
import { ListTableFieldsOptionsSchema, ListTableFieldsApiResponseSchema, FieldItemSchema, } from "./schemas";
|
|
2
|
+
import { ListTableFieldsOptionsSchema, ListTableFieldsOptionsInputSchema, ListTableFieldsApiResponseSchema, FieldItemSchema, } from "./schemas";
|
|
3
3
|
import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
4
4
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
5
5
|
import { tableIdResolver } from "../../../resolvers";
|
|
@@ -7,16 +7,18 @@ import { resolveFieldKeys, transformFieldItem } from "../utils";
|
|
|
7
7
|
export const listTableFieldsPlugin = ({ context }) => {
|
|
8
8
|
async function listTableFields(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 searchParams = {};
|
|
11
|
-
if (
|
|
13
|
+
if (fieldKeys && fieldKeys.length > 0) {
|
|
12
14
|
const numericIds = await resolveFieldKeys({
|
|
13
15
|
api,
|
|
14
|
-
tableId
|
|
15
|
-
fieldKeys
|
|
16
|
+
tableId,
|
|
17
|
+
fieldKeys,
|
|
16
18
|
});
|
|
17
19
|
searchParams.field_ids = numericIds.join(",");
|
|
18
20
|
}
|
|
19
|
-
const rawResponse = await api.get(`/tables/api/v1/tables/${
|
|
21
|
+
const rawResponse = await api.get(`/tables/api/v1/tables/${tableId}/fields`, {
|
|
20
22
|
searchParams: Object.keys(searchParams).length > 0 ? searchParams : undefined,
|
|
21
23
|
customErrorHandler: ({ status }) => {
|
|
22
24
|
if (status === 401) {
|
|
@@ -26,7 +28,7 @@ export const listTableFieldsPlugin = ({ context }) => {
|
|
|
26
28
|
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to access this table. (HTTP ${status})`, { statusCode: status });
|
|
27
29
|
}
|
|
28
30
|
if (status === 404) {
|
|
29
|
-
return new Error(`Table not found: ${
|
|
31
|
+
return new Error(`Table not found: ${tableId}`);
|
|
30
32
|
}
|
|
31
33
|
return undefined;
|
|
32
34
|
},
|
|
@@ -37,7 +39,7 @@ export const listTableFieldsPlugin = ({ context }) => {
|
|
|
37
39
|
data: response.data.map(transformFieldItem),
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
|
-
const listTableFieldsDefinition = createFunction(listTableFields,
|
|
42
|
+
const listTableFieldsDefinition = createFunction(listTableFields, ListTableFieldsOptionsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, listTableFields.name));
|
|
41
43
|
return {
|
|
42
44
|
listTableFields: listTableFieldsDefinition,
|
|
43
45
|
context: {
|
|
@@ -49,7 +51,7 @@ export const listTableFieldsPlugin = ({ context }) => {
|
|
|
49
51
|
inputSchema: ListTableFieldsOptionsSchema,
|
|
50
52
|
outputSchema: FieldItemSchema,
|
|
51
53
|
resolvers: {
|
|
52
|
-
|
|
54
|
+
table: tableIdResolver,
|
|
53
55
|
},
|
|
54
56
|
},
|
|
55
57
|
},
|
|
@@ -166,10 +166,34 @@ export declare const FieldItemSchema: z.ZodObject<{
|
|
|
166
166
|
}, z.core.$strip>;
|
|
167
167
|
export type FieldItem = z.infer<typeof FieldItemSchema>;
|
|
168
168
|
export declare const ListTableFieldsOptionsSchema: z.ZodObject<{
|
|
169
|
-
|
|
169
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
170
|
+
fieldKeys: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
171
|
+
table: z.ZodString & {
|
|
172
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
173
|
+
};
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
declare const ListTableFieldsOptionsSchemaDeprecated: z.ZodObject<{
|
|
176
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
170
177
|
fieldKeys: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
178
|
+
tableId: z.ZodString;
|
|
171
179
|
}, z.core.$strip>;
|
|
172
|
-
export
|
|
180
|
+
export declare const ListTableFieldsOptionsInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
181
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
182
|
+
fieldKeys: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
183
|
+
table: z.ZodString & {
|
|
184
|
+
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
185
|
+
};
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
188
|
+
fieldKeys: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
189
|
+
tableId: z.ZodString;
|
|
190
|
+
}, z.core.$strip>]>;
|
|
191
|
+
export type ListTableFieldsOptions = (z.infer<typeof ListTableFieldsOptionsSchema> & FunctionOptions) | (Omit<z.infer<typeof ListTableFieldsOptionsSchemaDeprecated>, "tableId" | "fieldKeys"> & {
|
|
192
|
+
/** @deprecated Use `table` instead. */
|
|
193
|
+
tableId: z.infer<typeof ListTableFieldsOptionsSchemaDeprecated>["tableId"];
|
|
194
|
+
/** @deprecated Use `fields` instead. */
|
|
195
|
+
fieldKeys?: z.infer<typeof ListTableFieldsOptionsSchemaDeprecated>["fieldKeys"];
|
|
196
|
+
} & FunctionOptions);
|
|
173
197
|
export interface ListTableFieldsResult {
|
|
174
198
|
data: FieldItem[];
|
|
175
199
|
}
|
|
@@ -177,4 +201,5 @@ export type ListTableFieldsError = ZapierAuthenticationError | ZapierApiError |
|
|
|
177
201
|
export interface ListTableFieldsSdkFunction {
|
|
178
202
|
listTableFields: (options: ListTableFieldsOptions) => Promise<ListTableFieldsResult>;
|
|
179
203
|
}
|
|
204
|
+
export {};
|
|
180
205
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableFields/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableFields/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,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAO/B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AAYF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAiBxD,eAAO,MAAM,4BAA4B;;;;;;iBAKwB,CAAC;AAGlE,QAAA,MAAM,sCAAsC;;;;iBAMxC,CAAC;AAGL,eAAO,MAAM,iCAAiC;;;;;;;;;;mBAEP,CAAC;AAGxC,MAAM,MAAM,sBAAsB,GAC9B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,GAAG,eAAe,CAAC,GAChE,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,EACtD,SAAS,GAAG,WAAW,CACxB,GAAG;IACF,uCAAuC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,OAAO,sCAAsC,CAC9C,CAAC,SAAS,CAAC,CAAC;IACb,wCAAwC;IACxC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CACjB,OAAO,sCAAsC,CAC9C,CAAC,WAAW,CAAC,CAAC;CAChB,GAAG,eAAe,CAAC,CAAC;AAGzB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB;AAGD,MAAM,MAAM,oBAAoB,GAC5B,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CACf,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { withFormatter } from "../../../utils/schema-utils";
|
|
3
|
+
import { TablePropertySchema, FieldsPropertySchema, } from "../../../types/properties";
|
|
3
4
|
export const FieldTypeSchema = z.enum([
|
|
4
5
|
"string",
|
|
5
6
|
"multiple_string",
|
|
@@ -63,15 +64,30 @@ export const FieldItemSchema = withFormatter(FieldItemSchemaBase, {
|
|
|
63
64
|
details: [{ text: `Type: ${item.type}`, style: "dim" }],
|
|
64
65
|
}),
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
71
|
-
.describe("The unique identifier of the table"),
|
|
67
|
+
const ListTableFieldsDescription = "List fields for a table";
|
|
68
|
+
// Base schema with optional fields (new + deprecated)
|
|
69
|
+
const ListTableFieldsOptionsBaseSchema = z.object({
|
|
70
|
+
fields: FieldsPropertySchema.optional(),
|
|
72
71
|
fieldKeys: z
|
|
73
72
|
.array(z.union([z.string(), z.number()]))
|
|
74
73
|
.optional()
|
|
75
|
-
.describe('Filter by specific fields. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).')
|
|
74
|
+
.describe('Filter by specific fields. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).')
|
|
75
|
+
.meta({ deprecated: true }),
|
|
76
|
+
});
|
|
77
|
+
// Schema for docs/registry (new param names only)
|
|
78
|
+
export const ListTableFieldsOptionsSchema = ListTableFieldsOptionsBaseSchema.extend({
|
|
79
|
+
table: TablePropertySchema,
|
|
76
80
|
})
|
|
77
|
-
.describe(
|
|
81
|
+
.describe(ListTableFieldsDescription)
|
|
82
|
+
.meta({ aliases: { tableId: "table", fieldKeys: "fields" } });
|
|
83
|
+
// Deprecated schema (backward compat)
|
|
84
|
+
const ListTableFieldsOptionsSchemaDeprecated = ListTableFieldsOptionsBaseSchema.extend({
|
|
85
|
+
tableId: z
|
|
86
|
+
.string()
|
|
87
|
+
.regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID")
|
|
88
|
+
.describe("The unique identifier of the table"),
|
|
89
|
+
});
|
|
90
|
+
// Union for runtime validation
|
|
91
|
+
export const ListTableFieldsOptionsInputSchema = z
|
|
92
|
+
.union([ListTableFieldsOptionsSchema, ListTableFieldsOptionsSchemaDeprecated])
|
|
93
|
+
.describe(ListTableFieldsDescription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,6BAA6B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,6BAA6B,EAG7B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AA6BhE,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,gBAAgB,EAAE;gBAChB,WAAW,EAAE,OAAO,6BAA6B,CAAC;aACnD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,EAAE,EACF,cAAc,CAAC,iBAAiB,CAAC,GAAG,oBAAoB,EACxD,8BAA8B,CAgH/B,CAAC"}
|