@zapier/zapier-sdk 0.45.2 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +24 -7
- package/dist/api/schemas.d.ts +5 -5
- package/dist/api/types.d.ts +17 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/auth.d.ts +27 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +130 -92
- package/dist/cache.d.ts +50 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +47 -0
- package/dist/index.cjs +3108 -3695
- package/dist/index.d.mts +6735 -2188
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +3105 -3696
- package/dist/plugins/api/index.d.ts +22 -10
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +4 -4
- package/dist/plugins/apps/index.d.ts +108 -7
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +3 -4
- package/dist/plugins/capabilities/index.d.ts +9 -6
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +3 -2
- package/dist/plugins/connections/index.d.ts +15 -9
- package/dist/plugins/connections/index.d.ts.map +1 -1
- package/dist/plugins/connections/index.js +3 -2
- package/dist/plugins/createClientCredentials/index.d.ts +26 -14
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +16 -39
- package/dist/plugins/createClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.d.ts +20 -14
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +18 -37
- package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.d.ts +597 -41
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +9 -8
- package/dist/plugins/eventEmission/index.d.ts +9 -6
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +3 -2
- package/dist/plugins/fetch/index.d.ts +40 -17
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +6 -4
- package/dist/plugins/findFirstConnection/index.d.ts +109 -14
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +14 -26
- package/dist/plugins/findFirstConnection/schemas.d.ts +0 -2
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.d.ts +109 -14
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +14 -26
- package/dist/plugins/findUniqueConnection/schemas.d.ts +0 -2
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/index.d.ts +68 -15
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +21 -31
- package/dist/plugins/getAction/schemas.d.ts +4 -6
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts +140 -14
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +16 -38
- package/dist/plugins/getApp/schemas.d.ts +0 -2
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.d.ts +50 -16
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +22 -29
- package/dist/plugins/getConnection/schemas.d.ts +0 -2
- package/dist/plugins/getConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts +59 -13
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +21 -32
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +4 -6
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.d.ts +25 -18
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +13 -26
- package/dist/plugins/getProfile/schemas.d.ts +0 -8
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.js +0 -1
- package/dist/plugins/listActions/index.d.ts +73 -23
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +25 -53
- package/dist/plugins/listActions/schemas.d.ts +4 -15
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/index.d.ts +121 -13
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +22 -31
- package/dist/plugins/listApps/schemas.d.ts +0 -2
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.d.ts +29 -16
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +17 -37
- package/dist/plugins/listClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.d.ts +95 -17
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +25 -49
- package/dist/plugins/listConnections/schemas.d.ts +0 -2
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts +77 -22
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +27 -50
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -6
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.d.ts +154 -22
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +28 -41
- package/dist/plugins/listInputFields/schemas.d.ts +4 -6
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/index.d.ts +40 -36
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +3 -2
- package/dist/plugins/registry/index.d.ts +11 -9
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +3 -2
- package/dist/plugins/request/index.d.ts +61 -15
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +14 -22
- package/dist/plugins/request/schemas.d.ts +0 -2
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/index.d.ts +137 -23
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +65 -78
- package/dist/plugins/runAction/schemas.d.ts +4 -14
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.d.ts +43 -11
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.js +16 -44
- package/dist/plugins/tables/createTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.d.ts +54 -11
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +17 -41
- package/dist/plugins/tables/createTableFields/schemas.d.ts +21 -23
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.d.ts +47 -11
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +17 -43
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.d.ts +36 -13
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +18 -40
- package/dist/plugins/tables/deleteTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.d.ts +36 -11
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +17 -39
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +36 -11
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +18 -41
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.d.ts +43 -12
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +18 -43
- package/dist/plugins/tables/getTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.d.ts +43 -11
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +18 -42
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +0 -2
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.d.ts +46 -11
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +17 -41
- package/dist/plugins/tables/listTableFields/schemas.d.ts +12 -14
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.d.ts +66 -18
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +27 -50
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +6 -8
- package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.d.ts +53 -20
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +24 -51
- package/dist/plugins/tables/listTables/schemas.d.ts +0 -2
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/shared.d.ts +10 -0
- package/dist/plugins/tables/shared.d.ts.map +1 -0
- package/dist/plugins/tables/shared.js +9 -0
- package/dist/plugins/tables/updateTableRecords/index.d.ts +49 -11
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +20 -43
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/utils.d.ts.map +1 -1
- package/dist/plugins/tables/utils.js +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +21 -1
- package/dist/resolvers/actionKey.d.ts +1 -2
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionType.d.ts +1 -2
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/schemas/Action.d.ts +1 -1
- package/dist/sdk.d.ts +2942 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/credentials.d.ts +2 -1
- package/dist/types/credentials.d.ts.map +1 -1
- package/dist/types/credentials.js +2 -1
- package/dist/types/errors.d.ts +13 -10
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +15 -12
- package/dist/types/functions.d.ts +18 -2
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +1 -1
- package/dist/types/registry.d.ts +1 -1
- package/dist/types/registry.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +1 -0
- package/dist/utils/function-utils.d.ts +11 -12
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/plugin-utils.d.ts +168 -0
- package/dist/utils/plugin-utils.d.ts.map +1 -0
- package/dist/utils/plugin-utils.js +132 -0
- package/package.json +2 -4
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../../types/errors";
|
|
4
3
|
import { RecordItemSchema, type RecordItem } from "../getTableRecord/schemas";
|
|
5
4
|
export { RecordItemSchema };
|
|
6
5
|
export type { RecordItem };
|
|
@@ -86,7 +85,6 @@ export type CreateTableRecordsOptions = (z.infer<typeof CreateTableRecordsOption
|
|
|
86
85
|
export interface CreateTableRecordsResult {
|
|
87
86
|
data: RecordItem[];
|
|
88
87
|
}
|
|
89
|
-
export type CreateTableRecordsError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
90
88
|
export interface CreateTableRecordsSdkFunction {
|
|
91
89
|
createTableRecords: (options: CreateTableRecordsOptions) => Promise<CreateTableRecordsResult>;
|
|
92
90
|
}
|
|
@@ -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;AAEhE,OAAO,
|
|
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,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;;;;;;;;;;;iBAMF,CAAC;AAG3C,QAAA,MAAM,yCAAyC;;;;;;;;;iBAOf,CAAC;AAGjC,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,WAAW,6BAA6B;IAC5C,kBAAkB,EAAE,CAClB,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACxC"}
|
|
@@ -1,19 +1,42 @@
|
|
|
1
|
-
import type { Plugin } from "../../../types/plugin";
|
|
2
|
-
import { DeleteTableOptionsSchema, type DeleteTableOptions, type DeleteTableResult } from "./schemas";
|
|
3
|
-
import type { ApiPluginProvides } from "../../api";
|
|
4
|
-
import type { EventEmissionProvides } from "../../eventEmission";
|
|
5
1
|
import type { CapabilitiesContext } from "../../capabilities";
|
|
6
|
-
export
|
|
7
|
-
|
|
2
|
+
export declare const deleteTablePlugin: (sdk: {
|
|
3
|
+
context: {
|
|
4
|
+
api: import("../../../api").ApiClient;
|
|
5
|
+
resolveCredentials: () => Promise<string | {
|
|
6
|
+
clientId: string;
|
|
7
|
+
clientSecret: string;
|
|
8
|
+
type?: "client_credentials" | undefined;
|
|
9
|
+
baseUrl?: string | undefined;
|
|
10
|
+
scope?: string | undefined;
|
|
11
|
+
} | {
|
|
12
|
+
clientId: string;
|
|
13
|
+
type?: "pkce" | undefined;
|
|
14
|
+
baseUrl?: string | undefined;
|
|
15
|
+
scope?: string | undefined;
|
|
16
|
+
} | undefined>;
|
|
17
|
+
};
|
|
18
|
+
} & {
|
|
19
|
+
context: import("../../eventEmission").EventEmissionContext;
|
|
20
|
+
} & {
|
|
21
|
+
context: CapabilitiesContext;
|
|
22
|
+
} & {
|
|
23
|
+
context: {
|
|
24
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
25
|
+
};
|
|
26
|
+
}) => {
|
|
27
|
+
deleteTable: (options?: {
|
|
28
|
+
table: string;
|
|
29
|
+
} | {
|
|
30
|
+
tableId: string;
|
|
31
|
+
} | undefined) => Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
} & {
|
|
8
35
|
context: {
|
|
9
36
|
meta: {
|
|
10
|
-
deleteTable:
|
|
11
|
-
inputSchema: typeof DeleteTableOptionsSchema;
|
|
12
|
-
};
|
|
37
|
+
deleteTable: import("../../..").PluginMeta;
|
|
13
38
|
};
|
|
14
39
|
};
|
|
15
|
-
}
|
|
16
|
-
export
|
|
17
|
-
context: CapabilitiesContext;
|
|
18
|
-
}, DeleteTablePluginProvides>;
|
|
40
|
+
};
|
|
41
|
+
export type DeleteTablePluginProvides = ReturnType<typeof deleteTablePlugin>;
|
|
19
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTable/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTable/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;aAGW,mBAAmB;;;;;;;;;;;;;;;;;;;CAwB3D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,45 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
1
|
+
import { definePlugin } from "../../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../../utils/plugin-utils";
|
|
3
|
+
import { DeleteTableOptionsInputSchema } from "./schemas";
|
|
5
4
|
import { tableIdResolver } from "../../../resolvers";
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { tablesDefaults } from "../shared";
|
|
6
|
+
export const deleteTablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
7
|
+
...tablesDefaults,
|
|
8
|
+
name: "deleteTable",
|
|
9
|
+
type: "delete",
|
|
10
|
+
itemType: "Table",
|
|
11
|
+
inputSchema: DeleteTableOptionsInputSchema,
|
|
12
|
+
resolvers: { table: tableIdResolver },
|
|
13
|
+
confirm: "delete",
|
|
14
|
+
handler: async ({ sdk, options }) => {
|
|
8
15
|
await sdk.context.checkCapability("canDeleteTables");
|
|
9
|
-
const { api } = sdk.context;
|
|
10
16
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
-
await api.delete(`/tables/api/v1/tables/${tableId}`, undefined, {
|
|
12
|
-
customErrorHandler: ({ status }) => {
|
|
13
|
-
if (status === 401) {
|
|
14
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete tables or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
15
|
-
}
|
|
16
|
-
if (status === 403) {
|
|
17
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to delete tables. (HTTP ${status})`, { statusCode: status });
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
},
|
|
17
|
+
await sdk.context.api.delete(`/tables/api/v1/tables/${tableId}`, undefined, {
|
|
21
18
|
authRequired: true,
|
|
19
|
+
resource: { type: "table", id: tableId },
|
|
22
20
|
});
|
|
23
|
-
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const deleteTableDefinition = createFunction(deleteTable, DeleteTableOptionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, deleteTable.name));
|
|
28
|
-
return {
|
|
29
|
-
deleteTable: deleteTableDefinition,
|
|
30
|
-
context: {
|
|
31
|
-
meta: {
|
|
32
|
-
deleteTable: {
|
|
33
|
-
categories: ["table"],
|
|
34
|
-
type: "delete",
|
|
35
|
-
itemType: "Table",
|
|
36
|
-
inputSchema: DeleteTableOptionsSchema,
|
|
37
|
-
resolvers: {
|
|
38
|
-
table: tableIdResolver,
|
|
39
|
-
},
|
|
40
|
-
confirm: "delete",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
};
|
|
21
|
+
return { success: true };
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierNotFoundError, ZapierUnknownError } from "../../../types/errors";
|
|
4
3
|
export declare const DeleteTableOptionsSchema: z.ZodObject<{
|
|
5
4
|
table: z.ZodString & {
|
|
6
5
|
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
@@ -23,7 +22,6 @@ export type DeleteTableOptions = (z.infer<typeof DeleteTableOptionsSchema> & Fun
|
|
|
23
22
|
export interface DeleteTableResult {
|
|
24
23
|
success: boolean;
|
|
25
24
|
}
|
|
26
|
-
export type DeleteTableError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierNotFoundError | ZapierUnknownError;
|
|
27
25
|
export interface DeleteTableSdkFunction {
|
|
28
26
|
deleteTable: (options: DeleteTableOptions) => Promise<DeleteTableResult>;
|
|
29
27
|
}
|
|
@@ -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;AAMhE,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,WAAW,sBAAsB;IACrC,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1E"}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export declare const deleteTableFieldsPlugin: (sdk: {
|
|
2
|
+
context: {
|
|
3
|
+
api: import("../../../api").ApiClient;
|
|
4
|
+
resolveCredentials: () => Promise<string | {
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
type?: "client_credentials" | undefined;
|
|
8
|
+
baseUrl?: string | undefined;
|
|
9
|
+
scope?: string | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
clientId: string;
|
|
12
|
+
type?: "pkce" | undefined;
|
|
13
|
+
baseUrl?: string | undefined;
|
|
14
|
+
scope?: string | undefined;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
};
|
|
17
|
+
} & {
|
|
18
|
+
context: import("../../eventEmission").EventEmissionContext;
|
|
19
|
+
} & {
|
|
20
|
+
context: {
|
|
21
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
22
|
+
};
|
|
23
|
+
}) => {
|
|
24
|
+
deleteTableFields: (options?: {
|
|
25
|
+
table: string;
|
|
26
|
+
fields: (string | number)[];
|
|
27
|
+
} | {
|
|
28
|
+
tableId: string;
|
|
29
|
+
fieldKeys: (string | number)[];
|
|
30
|
+
} | undefined) => Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
} & {
|
|
7
34
|
context: {
|
|
8
35
|
meta: {
|
|
9
|
-
deleteTableFields:
|
|
10
|
-
inputSchema: typeof DeleteTableFieldsOptionsSchema;
|
|
11
|
-
};
|
|
36
|
+
deleteTableFields: import("../../..").PluginMeta;
|
|
12
37
|
};
|
|
13
38
|
};
|
|
14
|
-
}
|
|
15
|
-
export
|
|
39
|
+
};
|
|
40
|
+
export type DeleteTableFieldsPluginProvides = ReturnType<typeof deleteTableFieldsPlugin>;
|
|
16
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableFields/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCnC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,uBAAuB,CAC/B,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
1
|
+
import { definePlugin } from "../../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../../utils/plugin-utils";
|
|
3
|
+
import { DeleteTableFieldsOptionsInputSchema } from "./schemas";
|
|
5
4
|
import { tableIdResolver, tableFieldIdsResolver } from "../../../resolvers";
|
|
6
5
|
import { resolveFieldKeys } from "../utils";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { tablesDefaults } from "../shared";
|
|
7
|
+
export const deleteTableFieldsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
8
|
+
...tablesDefaults,
|
|
9
|
+
name: "deleteTableFields",
|
|
10
|
+
type: "delete",
|
|
11
|
+
itemType: "Field",
|
|
12
|
+
inputSchema: DeleteTableFieldsOptionsInputSchema,
|
|
13
|
+
resolvers: { table: tableIdResolver, fields: tableFieldIdsResolver },
|
|
14
|
+
confirm: "delete",
|
|
15
|
+
handler: async ({ sdk, options }) => {
|
|
9
16
|
const { api } = sdk.context;
|
|
10
17
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
18
|
const fieldKeys = "fields" in options ? options.fields : options.fieldKeys;
|
|
@@ -15,38 +22,9 @@ export const deleteTableFieldsPlugin = (sdk) => {
|
|
|
15
22
|
fieldKeys,
|
|
16
23
|
});
|
|
17
24
|
await api.delete(`/tables/api/v1/tables/${tableId}/fields`, { field_ids: numericFieldIds }, {
|
|
18
|
-
customErrorHandler: ({ status }) => {
|
|
19
|
-
if (status === 401) {
|
|
20
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete fields or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
21
|
-
}
|
|
22
|
-
if (status === 403) {
|
|
23
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to delete fields. (HTTP ${status})`, { statusCode: status });
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
26
|
-
},
|
|
27
25
|
authRequired: true,
|
|
26
|
+
resource: { type: "table", id: tableId },
|
|
28
27
|
});
|
|
29
|
-
return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
const deleteTableFieldsDefinition = createFunction(deleteTableFields, DeleteTableFieldsOptionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, deleteTableFields.name));
|
|
34
|
-
return {
|
|
35
|
-
deleteTableFields: deleteTableFieldsDefinition,
|
|
36
|
-
context: {
|
|
37
|
-
meta: {
|
|
38
|
-
deleteTableFields: {
|
|
39
|
-
categories: ["table"],
|
|
40
|
-
type: "delete",
|
|
41
|
-
itemType: "Field",
|
|
42
|
-
inputSchema: DeleteTableFieldsOptionsSchema,
|
|
43
|
-
resolvers: {
|
|
44
|
-
table: tableIdResolver,
|
|
45
|
-
fields: tableFieldIdsResolver,
|
|
46
|
-
},
|
|
47
|
-
confirm: "delete",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
};
|
|
28
|
+
return { success: true };
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierNotFoundError, ZapierUnknownError } from "../../../types/errors";
|
|
4
3
|
export declare const DeleteTableFieldsOptionsSchema: z.ZodObject<{
|
|
5
4
|
table: z.ZodString & {
|
|
6
5
|
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
@@ -29,7 +28,6 @@ export type DeleteTableFieldsOptions = (z.infer<typeof DeleteTableFieldsOptionsS
|
|
|
29
28
|
export interface DeleteTableFieldsResult {
|
|
30
29
|
success: boolean;
|
|
31
30
|
}
|
|
32
|
-
export type DeleteTableFieldsError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierNotFoundError | ZapierUnknownError;
|
|
33
31
|
export interface DeleteTableFieldsSdkFunction {
|
|
34
32
|
deleteTableFields: (options: DeleteTableFieldsOptions) => Promise<DeleteTableFieldsResult>;
|
|
35
33
|
}
|
|
@@ -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;
|
|
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;AAShE,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,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvC"}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export declare const deleteTableRecordsPlugin: (sdk: {
|
|
2
|
+
context: {
|
|
3
|
+
api: import("../../../api").ApiClient;
|
|
4
|
+
resolveCredentials: () => Promise<string | {
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
type?: "client_credentials" | undefined;
|
|
8
|
+
baseUrl?: string | undefined;
|
|
9
|
+
scope?: string | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
clientId: string;
|
|
12
|
+
type?: "pkce" | undefined;
|
|
13
|
+
baseUrl?: string | undefined;
|
|
14
|
+
scope?: string | undefined;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
};
|
|
17
|
+
} & {
|
|
18
|
+
context: import("../../eventEmission").EventEmissionContext;
|
|
19
|
+
} & {
|
|
20
|
+
context: {
|
|
21
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
22
|
+
};
|
|
23
|
+
}) => {
|
|
24
|
+
deleteTableRecords: (options?: {
|
|
25
|
+
table: string;
|
|
26
|
+
records: string[];
|
|
27
|
+
} | {
|
|
28
|
+
tableId: string;
|
|
29
|
+
recordIds: string[];
|
|
30
|
+
} | undefined) => Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
} & {
|
|
7
34
|
context: {
|
|
8
35
|
meta: {
|
|
9
|
-
deleteTableRecords:
|
|
10
|
-
inputSchema: typeof DeleteTableRecordsOptionsSchema;
|
|
11
|
-
};
|
|
36
|
+
deleteTableRecords: import("../../..").PluginMeta;
|
|
12
37
|
};
|
|
13
38
|
};
|
|
14
|
-
}
|
|
15
|
-
export
|
|
39
|
+
};
|
|
40
|
+
export type DeleteTableRecordsPluginProvides = ReturnType<typeof deleteTableRecordsPlugin>;
|
|
16
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableRecords/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/deleteTableRecords/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC"}
|
|
@@ -1,46 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
1
|
+
import { definePlugin } from "../../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../../utils/plugin-utils";
|
|
3
|
+
import { DeleteTableRecordsOptionsInputSchema } from "./schemas";
|
|
5
4
|
import { tableIdResolver, tableRecordIdsResolver } from "../../../resolvers";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { tablesDefaults } from "../shared";
|
|
6
|
+
export const deleteTableRecordsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
7
|
+
...tablesDefaults,
|
|
8
|
+
name: "deleteTableRecords",
|
|
9
|
+
type: "delete",
|
|
10
|
+
itemType: "Record",
|
|
11
|
+
inputSchema: DeleteTableRecordsOptionsInputSchema,
|
|
12
|
+
resolvers: { table: tableIdResolver, records: tableRecordIdsResolver },
|
|
13
|
+
confirm: "delete",
|
|
14
|
+
handler: async ({ sdk, options }) => {
|
|
9
15
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
10
16
|
const recordIds = "records" in options ? options.records : options.recordIds;
|
|
11
|
-
await api.delete(`/tables/api/v1/tables/${tableId}/records`, { record_ids: recordIds }, {
|
|
12
|
-
customErrorHandler: ({ status }) => {
|
|
13
|
-
if (status === 401) {
|
|
14
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete records or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
15
|
-
}
|
|
16
|
-
if (status === 403) {
|
|
17
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to delete records. (HTTP ${status})`, { statusCode: status });
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
},
|
|
17
|
+
await sdk.context.api.delete(`/tables/api/v1/tables/${tableId}/records`, { record_ids: recordIds }, {
|
|
21
18
|
authRequired: true,
|
|
19
|
+
resource: { type: "table", id: tableId },
|
|
22
20
|
});
|
|
23
|
-
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const deleteTableRecordsDefinition = createFunction(deleteTableRecords, DeleteTableRecordsOptionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, deleteTableRecords.name));
|
|
28
|
-
return {
|
|
29
|
-
deleteTableRecords: deleteTableRecordsDefinition,
|
|
30
|
-
context: {
|
|
31
|
-
meta: {
|
|
32
|
-
deleteTableRecords: {
|
|
33
|
-
categories: ["table"],
|
|
34
|
-
type: "delete",
|
|
35
|
-
itemType: "Record",
|
|
36
|
-
inputSchema: DeleteTableRecordsOptionsSchema,
|
|
37
|
-
resolvers: {
|
|
38
|
-
table: tableIdResolver,
|
|
39
|
-
records: tableRecordIdsResolver,
|
|
40
|
-
},
|
|
41
|
-
confirm: "delete",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
};
|
|
21
|
+
return { success: true };
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../../types/functions";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../../types/errors";
|
|
4
3
|
export declare const DeleteTableRecordsOptionsSchema: z.ZodObject<{
|
|
5
4
|
table: z.ZodString & {
|
|
6
5
|
_def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
|
|
@@ -29,7 +28,6 @@ export type DeleteTableRecordsOptions = (z.infer<typeof DeleteTableRecordsOption
|
|
|
29
28
|
export interface DeleteTableRecordsResult {
|
|
30
29
|
success: boolean;
|
|
31
30
|
}
|
|
32
|
-
export type DeleteTableRecordsError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
33
31
|
export interface DeleteTableRecordsSdkFunction {
|
|
34
32
|
deleteTableRecords: (options: DeleteTableRecordsOptions) => Promise<DeleteTableRecordsResult>;
|
|
35
33
|
}
|
|
@@ -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;
|
|
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;AAShE,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,WAAW,6BAA6B;IAC5C,kBAAkB,EAAE,CAClB,OAAO,EAAE,yBAAyB,KAC/B,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACxC"}
|
|
@@ -1,18 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export declare const getTablePlugin: (sdk: {
|
|
2
|
+
context: {
|
|
3
|
+
api: import("../../../api").ApiClient;
|
|
4
|
+
resolveCredentials: () => Promise<string | {
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
type?: "client_credentials" | undefined;
|
|
8
|
+
baseUrl?: string | undefined;
|
|
9
|
+
scope?: string | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
clientId: string;
|
|
12
|
+
type?: "pkce" | undefined;
|
|
13
|
+
baseUrl?: string | undefined;
|
|
14
|
+
scope?: string | undefined;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
};
|
|
17
|
+
} & {
|
|
18
|
+
context: import("../../eventEmission").EventEmissionContext;
|
|
19
|
+
} & {
|
|
20
|
+
context: {
|
|
21
|
+
meta: Record<string, import("../../..").PluginMeta>;
|
|
22
|
+
};
|
|
23
|
+
}) => {
|
|
24
|
+
getTable: (options?: {
|
|
25
|
+
table: string;
|
|
26
|
+
} | {
|
|
27
|
+
tableId: string;
|
|
28
|
+
} | undefined) => Promise<{
|
|
29
|
+
data: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
created_at: string;
|
|
33
|
+
edited_at: string;
|
|
34
|
+
kind: "table" | "virtual_table";
|
|
35
|
+
account_id: string;
|
|
36
|
+
profile_id: string;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
parent_table_id?: string | undefined;
|
|
39
|
+
};
|
|
8
40
|
}>;
|
|
41
|
+
} & {
|
|
9
42
|
context: {
|
|
10
43
|
meta: {
|
|
11
|
-
getTable:
|
|
12
|
-
inputSchema: typeof GetTableOptionsSchema;
|
|
13
|
-
};
|
|
44
|
+
getTable: import("../../..").PluginMeta;
|
|
14
45
|
};
|
|
15
46
|
};
|
|
16
|
-
}
|
|
17
|
-
export
|
|
47
|
+
};
|
|
48
|
+
export type GetTablePluginProvides = ReturnType<typeof getTablePlugin>;
|
|
18
49
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/getTable/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -1,49 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
1
|
+
import { definePlugin } from "../../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../../utils/plugin-utils";
|
|
3
|
+
import { GetTableApiResponseSchema, GetTableOptionsInputSchema, TableItemSchema, } from "./schemas";
|
|
5
4
|
import { tableIdResolver } from "../../../resolvers";
|
|
6
5
|
import { transformTableItem } from "../utils";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { tablesDefaults } from "../shared";
|
|
7
|
+
export const getTablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
8
|
+
...tablesDefaults,
|
|
9
|
+
name: "getTable",
|
|
10
|
+
type: "item",
|
|
11
|
+
itemType: "Table",
|
|
12
|
+
inputSchema: GetTableOptionsInputSchema,
|
|
13
|
+
outputSchema: TableItemSchema,
|
|
14
|
+
resolvers: { table: tableIdResolver },
|
|
15
|
+
handler: async ({ sdk, options }) => {
|
|
10
16
|
const tableId = "table" in options ? options.table : options.tableId;
|
|
11
|
-
const rawResponse = await api.get(`/tables/api/v1/tables/${tableId}`, {
|
|
12
|
-
customErrorHandler: ({ status }) => {
|
|
13
|
-
if (status === 401) {
|
|
14
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access this table or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
15
|
-
}
|
|
16
|
-
if (status === 403) {
|
|
17
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to access this table. (HTTP ${status})`, { statusCode: status });
|
|
18
|
-
}
|
|
19
|
-
if (status === 404) {
|
|
20
|
-
return new Error(`Table not found: ${tableId}`);
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
},
|
|
17
|
+
const rawResponse = await sdk.context.api.get(`/tables/api/v1/tables/${tableId}`, {
|
|
24
18
|
authRequired: true,
|
|
19
|
+
resource: { type: "table", id: tableId },
|
|
25
20
|
});
|
|
26
21
|
const response = GetTableApiResponseSchema.parse(rawResponse);
|
|
27
|
-
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
const getTableDefinition = createFunction(getTable, GetTableOptionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getTable.name));
|
|
32
|
-
return {
|
|
33
|
-
getTable: getTableDefinition,
|
|
34
|
-
context: {
|
|
35
|
-
meta: {
|
|
36
|
-
getTable: {
|
|
37
|
-
categories: ["table"],
|
|
38
|
-
type: "item",
|
|
39
|
-
itemType: "Table",
|
|
40
|
-
inputSchema: GetTableOptionsSchema,
|
|
41
|
-
outputSchema: TableItemSchema,
|
|
42
|
-
resolvers: {
|
|
43
|
-
table: tableIdResolver,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
22
|
+
return { data: transformTableItem(response.data) };
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../../types/errors";
|
|
3
2
|
import { TableItemSchema, TableApiItemSchema, type TableItem, type TableApiItem } from "../listTables/schemas";
|
|
4
3
|
export { TableItemSchema, TableApiItemSchema };
|
|
5
4
|
export type { TableItem, TableApiItem };
|
|
@@ -42,7 +41,6 @@ export type GetTableOptions = z.infer<typeof GetTableOptionsSchema> | (Omit<z.in
|
|
|
42
41
|
/** @deprecated Use `table` instead. */
|
|
43
42
|
tableId: z.infer<typeof GetTableOptionsSchemaDeprecated>["tableId"];
|
|
44
43
|
});
|
|
45
|
-
export type GetTableError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
46
44
|
export interface GetTableSdkFunction {
|
|
47
45
|
getTable: (options: GetTableOptions) => Promise<{
|
|
48
46
|
data: TableItem;
|