@zapier/zapier-sdk 0.46.0 → 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 +6 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +17 -6
- package/dist/api/types.d.ts +11 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +2994 -3633
- package/dist/index.d.mts +6532 -2055
- 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 +2992 -3634
- 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 +0 -2
- 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 +0 -2
- 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 +0 -11
- 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 +0 -2
- 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 +0 -2
- 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 +0 -10
- 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 +0 -2
- 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 +0 -2
- 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 +0 -2
- 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/sdk.d.ts +2942 -2
- package/dist/sdk.d.ts.map +1 -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/registry.d.ts +1 -1
- package/dist/types/registry.d.ts.map +1 -1
- 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 +1 -1
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import type { ApiClient } from "../../api/types";
|
|
2
1
|
import type { BaseSdkOptions } from "../../types/sdk";
|
|
3
|
-
import type { Plugin } from "../../types/plugin";
|
|
4
|
-
import type { ResolvedCredentials } from "../../types/credentials";
|
|
5
2
|
export interface ApiPluginOptions extends BaseSdkOptions {
|
|
6
3
|
}
|
|
7
|
-
export
|
|
4
|
+
export declare const apiPlugin: (sdk: {
|
|
8
5
|
context: {
|
|
9
|
-
|
|
10
|
-
resolveCredentials: () => Promise<ResolvedCredentials | undefined>;
|
|
6
|
+
options: BaseSdkOptions;
|
|
11
7
|
};
|
|
12
|
-
}
|
|
13
|
-
export declare const apiPlugin: Plugin<{
|
|
8
|
+
} & {
|
|
14
9
|
context: {
|
|
15
|
-
|
|
10
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
11
|
+
};
|
|
12
|
+
}) => {
|
|
13
|
+
context: {
|
|
14
|
+
api: import("../../api").ApiClient;
|
|
15
|
+
resolveCredentials: () => Promise<string | {
|
|
16
|
+
clientId: string;
|
|
17
|
+
clientSecret: string;
|
|
18
|
+
type?: "client_credentials" | undefined;
|
|
19
|
+
baseUrl?: string | undefined;
|
|
20
|
+
scope?: string | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
clientId: string;
|
|
23
|
+
type?: "pkce" | undefined;
|
|
24
|
+
baseUrl?: string | undefined;
|
|
25
|
+
scope?: string | undefined;
|
|
26
|
+
} | undefined>;
|
|
16
27
|
};
|
|
17
|
-
}
|
|
28
|
+
};
|
|
29
|
+
export type ApiPluginProvides = ReturnType<typeof apiPlugin>;
|
|
18
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAStD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,eAAO,MAAM,SAAS;aACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;CA+C7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createZapierApi } from "../../api";
|
|
2
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
3
|
import { resolveCredentials } from "../../credentials";
|
|
3
4
|
import { ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, } from "../../constants";
|
|
4
|
-
export const apiPlugin = (sdk) => {
|
|
5
|
+
export const apiPlugin = definePlugin((sdk) => {
|
|
5
6
|
// Extract all options - everything passed to the plugin
|
|
6
7
|
const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, isInteractive, approvalTimeoutMs, maxApprovalRetries, approvalMode, callerPackage, } = sdk.context.options;
|
|
7
8
|
// Create the API client - it will handle token resolution internally
|
|
@@ -20,10 +21,9 @@ export const apiPlugin = (sdk) => {
|
|
|
20
21
|
approvalMode,
|
|
21
22
|
callerPackage,
|
|
22
23
|
});
|
|
23
|
-
// Return flat structure with context only
|
|
24
24
|
return {
|
|
25
25
|
context: {
|
|
26
|
-
api,
|
|
26
|
+
api,
|
|
27
27
|
resolveCredentials: () => resolveCredentials({
|
|
28
28
|
credentials,
|
|
29
29
|
token,
|
|
@@ -31,4 +31,4 @@ export const apiPlugin = (sdk) => {
|
|
|
31
31
|
}),
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
|
-
};
|
|
34
|
+
});
|
|
@@ -1,12 +1,113 @@
|
|
|
1
1
|
import type { ActionProxy } from "./schemas";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export declare const appsPlugin: (sdk: {
|
|
3
|
+
fetch: (url: string | URL, init?: import("../..").ZapierFetchInitOptions) => Promise<Response>;
|
|
4
|
+
context: {
|
|
5
|
+
meta: {
|
|
6
|
+
fetch: {
|
|
7
|
+
description: string;
|
|
8
|
+
packages: string[];
|
|
9
|
+
categories: string[];
|
|
10
|
+
returnType: string;
|
|
11
|
+
inputParameters: ({
|
|
12
|
+
name: string;
|
|
13
|
+
schema: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodCustom<URL, URL>]>;
|
|
14
|
+
} | {
|
|
15
|
+
name: string;
|
|
16
|
+
schema: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
17
|
+
method: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
18
|
+
POST: "POST";
|
|
19
|
+
GET: "GET";
|
|
20
|
+
DELETE: "DELETE";
|
|
21
|
+
PUT: "PUT";
|
|
22
|
+
PATCH: "PATCH";
|
|
23
|
+
HEAD: "HEAD";
|
|
24
|
+
OPTIONS: "OPTIONS";
|
|
25
|
+
}>>;
|
|
26
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
27
|
+
body: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodCustom<FormData, FormData>, import("zod").ZodCustom<URLSearchParams, URLSearchParams>, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>]>>;
|
|
28
|
+
connectionId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
29
|
+
connection: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
30
|
+
authenticationId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
31
|
+
callbackUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
maxTime: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
33
|
+
}, import("zod/v4/core").$strip>>;
|
|
34
|
+
})[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} & {
|
|
39
|
+
runAction: (options?: (({
|
|
40
|
+
app: string;
|
|
41
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
42
|
+
action: string;
|
|
43
|
+
connection?: string | number | undefined;
|
|
44
|
+
connectionId?: string | number | null | undefined;
|
|
45
|
+
authenticationId?: string | number | null | undefined;
|
|
46
|
+
inputs?: Record<string, unknown> | undefined;
|
|
47
|
+
timeoutMs?: number | undefined;
|
|
48
|
+
pageSize?: number | undefined;
|
|
49
|
+
maxItems?: number | undefined;
|
|
50
|
+
cursor?: string | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
appKey: string;
|
|
53
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
54
|
+
actionKey: string;
|
|
55
|
+
connection?: string | number | undefined;
|
|
56
|
+
connectionId?: string | number | null | undefined;
|
|
57
|
+
authenticationId?: string | number | null | undefined;
|
|
58
|
+
inputs?: Record<string, unknown> | undefined;
|
|
59
|
+
timeoutMs?: number | undefined;
|
|
60
|
+
pageSize?: number | undefined;
|
|
61
|
+
maxItems?: number | undefined;
|
|
62
|
+
cursor?: string | undefined;
|
|
63
|
+
}) & {
|
|
64
|
+
cursor?: string;
|
|
65
|
+
pageSize?: number;
|
|
66
|
+
maxItems?: number;
|
|
67
|
+
}) | undefined) => import("../..").PaginatedSdkResult<unknown>;
|
|
68
|
+
} & {
|
|
69
|
+
context: {
|
|
70
|
+
meta: {
|
|
71
|
+
runAction: import("../..").PluginMeta;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
context: {
|
|
76
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
77
|
+
};
|
|
78
|
+
}) => {
|
|
6
79
|
apps: ActionProxy & ZapierSdkApps;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
80
|
+
context: {
|
|
81
|
+
meta: {
|
|
82
|
+
"apps.{appKey}": {
|
|
83
|
+
categories: string[];
|
|
84
|
+
packages: string[];
|
|
85
|
+
type: "function";
|
|
86
|
+
inputSchema: import("zod").ZodObject<{
|
|
87
|
+
connectionId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
88
|
+
connection: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
89
|
+
authenticationId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
90
|
+
}, import("zod/v4/core").$strip>;
|
|
91
|
+
returnType: string;
|
|
92
|
+
};
|
|
93
|
+
"apps.{appKey}.{actionType}.{actionKey}": {
|
|
94
|
+
categories: string[];
|
|
95
|
+
packages: string[];
|
|
96
|
+
type: "list";
|
|
97
|
+
inputSchema: import("zod").ZodObject<{
|
|
98
|
+
inputs: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
99
|
+
connectionId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
100
|
+
connection: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
101
|
+
authenticationId: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
|
|
102
|
+
timeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
103
|
+
}, import("zod/v4/core").$strip>;
|
|
104
|
+
itemType: string;
|
|
105
|
+
outputSchema: import("zod").ZodUnknown;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export type AppsPluginProvides = ReturnType<typeof appsPlugin>;
|
|
10
111
|
export type { ActionExecutionOptions, AppFactoryInput } from "./schemas";
|
|
11
112
|
export type { ActionExecutionResult } from "../../api/types";
|
|
12
113
|
export interface ZapierSdkApps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AA4OnB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAOiB,WAAW,GAAG,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBlE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAG/D,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActionExecutionInputSchema, AppFactoryInputSchema } from "./schemas";
|
|
2
2
|
import { ZapierValidationError } from "../../types/errors";
|
|
3
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
3
4
|
import { ActionResultItemSchema } from "../../schemas/Run";
|
|
4
5
|
/**
|
|
5
6
|
* Resolves which connection params to forward, choosing per-call values over pinned (factory) values.
|
|
@@ -125,9 +126,7 @@ function createAppsProxy(options) {
|
|
|
125
126
|
});
|
|
126
127
|
return appsProxy;
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
-
export const appsPlugin = (sdk) => {
|
|
130
|
-
// Return flat structure - apps goes directly to SDK
|
|
129
|
+
export const appsPlugin = definePlugin((sdk) => {
|
|
131
130
|
return {
|
|
132
131
|
// Cast: ZapierSdkApps is augmented by user-generated .d.ts files to
|
|
133
132
|
// give specific types like `slack: SlackAppWithFactory`. At runtime
|
|
@@ -154,4 +153,4 @@ export const appsPlugin = (sdk) => {
|
|
|
154
153
|
},
|
|
155
154
|
},
|
|
156
155
|
};
|
|
157
|
-
};
|
|
156
|
+
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
1
|
import type { Manifest } from "../manifest/schemas";
|
|
3
2
|
export declare function buildCapabilityMessage(key: string): string;
|
|
4
3
|
declare const GATED_FLAGS: readonly ["canIncludeSharedConnections", "canIncludeSharedTables", "canDeleteTables"];
|
|
@@ -7,10 +6,7 @@ export interface CapabilitiesContext {
|
|
|
7
6
|
checkCapability: (key: GatedFlag) => Promise<void>;
|
|
8
7
|
hasCapability: (key: GatedFlag) => Promise<boolean>;
|
|
9
8
|
}
|
|
10
|
-
export
|
|
11
|
-
context: CapabilitiesContext;
|
|
12
|
-
}
|
|
13
|
-
export declare const capabilitiesPlugin: Plugin<{
|
|
9
|
+
export declare const capabilitiesPlugin: (sdk: {
|
|
14
10
|
context: {
|
|
15
11
|
options?: {
|
|
16
12
|
canIncludeSharedConnections?: boolean;
|
|
@@ -19,6 +15,13 @@ export declare const capabilitiesPlugin: Plugin<{
|
|
|
19
15
|
};
|
|
20
16
|
getResolvedManifest: () => Promise<Manifest | null>;
|
|
21
17
|
};
|
|
22
|
-
}
|
|
18
|
+
} & {
|
|
19
|
+
context: {
|
|
20
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
21
|
+
};
|
|
22
|
+
}) => {
|
|
23
|
+
context: CapabilitiesContext;
|
|
24
|
+
};
|
|
25
|
+
export type CapabilitiesPluginProvides = ReturnType<typeof capabilitiesPlugin>;
|
|
23
26
|
export {};
|
|
24
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/capabilities/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/capabilities/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAqBpD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED,QAAA,MAAM,WAAW,uFAIP,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAUrD,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,aAAa,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,kBAAkB;aAElB;QACP,OAAO,CAAC,EAAE;YACR,2BAA2B,CAAC,EAAE,OAAO,CAAC;YACtC,sBAAsB,CAAC,EAAE,OAAO,CAAC;YACjC,eAAe,CAAC,EAAE,OAAO,CAAC;SAC3B,CAAC;QACF,mBAAmB,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;KACrD;;;;;;aACY,mBAAmB;CA8CnC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
1
2
|
import { ZapierConfigurationError } from "../../types/errors";
|
|
2
3
|
function toDescription(key) {
|
|
3
4
|
// "canDeleteTables" -> "To delete tables"
|
|
@@ -36,7 +37,7 @@ function isEnabledByEnv(key) {
|
|
|
36
37
|
return false;
|
|
37
38
|
return undefined;
|
|
38
39
|
}
|
|
39
|
-
export const capabilitiesPlugin = (sdk) => {
|
|
40
|
+
export const capabilitiesPlugin = definePlugin((sdk) => {
|
|
40
41
|
const options = sdk.context.options ?? {};
|
|
41
42
|
let cached;
|
|
42
43
|
/**
|
|
@@ -71,4 +72,4 @@ export const capabilitiesPlugin = (sdk) => {
|
|
|
71
72
|
},
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
|
-
};
|
|
75
|
+
});
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
|
-
import type { ConnectionEntry, ConnectionsMap } from "../../types/connections";
|
|
3
1
|
import type { ManifestPluginProvides } from "../manifest";
|
|
4
|
-
export
|
|
2
|
+
export declare const connectionsPlugin: (sdk: {
|
|
3
|
+
context: Pick<ManifestPluginProvides["context"], "getManifestConnections">;
|
|
4
|
+
} & {
|
|
5
5
|
context: {
|
|
6
|
-
|
|
7
|
-
getConnectionsMap: () => Promise<ConnectionsMap | null>;
|
|
6
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
8
7
|
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
}) => {
|
|
9
|
+
context: {
|
|
10
|
+
resolveConnection: (name: string) => Promise<{
|
|
11
|
+
connectionId: string | number;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
getConnectionsMap: () => Promise<Record<string, {
|
|
14
|
+
connectionId: string | number;
|
|
15
|
+
}> | null>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type ConnectionsPluginProvides = ReturnType<typeof connectionsPlugin>;
|
|
13
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/connections/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/connections/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,eAAO,MAAM,iBAAiB;aAEjB,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,wBAAwB,CAAC;;;;;;;kCAatC,MAAM;;;;;;;CAU7C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
export const connectionsPlugin = definePlugin((sdk) => {
|
|
2
3
|
let cachedMap;
|
|
3
4
|
async function loadConnectionsMap() {
|
|
4
5
|
if (cachedMap === undefined) {
|
|
@@ -17,4 +18,4 @@ export const connectionsPlugin = (sdk) => {
|
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
};
|
|
20
|
-
};
|
|
21
|
+
});
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
1
|
import type { ApiClient } from "../../api";
|
|
3
|
-
|
|
4
|
-
import type { EventEmissionProvides } from "../eventEmission";
|
|
5
|
-
export interface CreateClientCredentialsPluginProvides {
|
|
6
|
-
createClientCredentials: (options: CreateClientCredentialsOptions) => Promise<CreateClientCredentialsResult>;
|
|
2
|
+
export declare const createClientCredentialsPlugin: (sdk: {
|
|
7
3
|
context: {
|
|
8
|
-
|
|
9
|
-
createClientCredentials: {
|
|
10
|
-
inputSchema: typeof CreateClientCredentialsSchema;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
4
|
+
api: ApiClient;
|
|
13
5
|
};
|
|
14
|
-
}
|
|
15
|
-
|
|
6
|
+
} & {
|
|
7
|
+
context: import("../eventEmission").EventEmissionContext;
|
|
8
|
+
} & {
|
|
16
9
|
context: {
|
|
17
|
-
|
|
10
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
11
|
+
};
|
|
12
|
+
}) => {
|
|
13
|
+
createClientCredentials: (options?: {
|
|
14
|
+
name: string;
|
|
15
|
+
allowedScopes: ("external" | "credentials")[];
|
|
16
|
+
policy?: Record<string, unknown> | undefined;
|
|
17
|
+
} | undefined) => Promise<{
|
|
18
|
+
data: {
|
|
19
|
+
client_id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
client_secret: string;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
} & {
|
|
25
|
+
context: {
|
|
26
|
+
meta: {
|
|
27
|
+
createClientCredentials: import("../..").PluginMeta;
|
|
28
|
+
};
|
|
18
29
|
};
|
|
19
|
-
}
|
|
30
|
+
};
|
|
31
|
+
export type CreateClientCredentialsPluginProvides = ReturnType<typeof createClientCredentialsPlugin>;
|
|
20
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C,eAAO,MAAM,6BAA6B;aACvB;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;CA2BpC,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG,UAAU,CAC5D,OAAO,6BAA6B,CACrC,CAAC"}
|
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../utils/plugin-utils";
|
|
3
|
+
import { CreateClientCredentialsSchema } from "./schemas";
|
|
3
4
|
import { ClientCredentialsCreatedItemSchema } from "../../schemas/ClientCredentials";
|
|
4
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
5
|
-
import { ZapierAuthenticationError } from "../../types/errors";
|
|
6
5
|
import { clientCredentialsNameResolver } from "../../resolvers";
|
|
7
|
-
export const createClientCredentialsPlugin = (sdk) => {
|
|
8
|
-
|
|
6
|
+
export const createClientCredentialsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
7
|
+
name: "createClientCredentials",
|
|
8
|
+
categories: ["client-credentials"],
|
|
9
|
+
type: "create",
|
|
10
|
+
itemType: "ClientCredentials",
|
|
11
|
+
inputSchema: CreateClientCredentialsSchema,
|
|
12
|
+
outputSchema: ClientCredentialsCreatedItemSchema,
|
|
13
|
+
confirm: "create-secret",
|
|
14
|
+
resolvers: { name: clientCredentialsNameResolver },
|
|
15
|
+
handler: async ({ sdk, options }) => {
|
|
9
16
|
const { api } = sdk.context;
|
|
10
17
|
const response = await api.post("/api/v0/client-credentials", {
|
|
11
18
|
name: options.name,
|
|
12
19
|
allowed_scopes: options.allowedScopes,
|
|
13
20
|
...(options.policy && { policy: options.policy }),
|
|
14
21
|
}, {
|
|
15
|
-
customErrorHandler: ({ status }) => {
|
|
16
|
-
if (status === 401) {
|
|
17
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to create client credentials or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
18
|
-
}
|
|
19
|
-
if (status === 403) {
|
|
20
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to create client credentials. (HTTP ${status})`, { statusCode: status });
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
},
|
|
24
22
|
authRequired: true,
|
|
25
23
|
requiredScopes: ["credentials"],
|
|
26
24
|
});
|
|
27
|
-
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
const createClientCredentialsDefinition = createFunction(createClientCredentials, CreateClientCredentialsSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, createClientCredentials.name));
|
|
32
|
-
return {
|
|
33
|
-
createClientCredentials: createClientCredentialsDefinition,
|
|
34
|
-
context: {
|
|
35
|
-
meta: {
|
|
36
|
-
createClientCredentials: {
|
|
37
|
-
categories: ["client-credentials"],
|
|
38
|
-
type: "create",
|
|
39
|
-
itemType: "ClientCredentials",
|
|
40
|
-
inputSchema: CreateClientCredentialsSchema,
|
|
41
|
-
outputSchema: ClientCredentialsCreatedItemSchema,
|
|
42
|
-
confirm: "create-secret",
|
|
43
|
-
resolvers: {
|
|
44
|
-
name: clientCredentialsNameResolver,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
};
|
|
25
|
+
return { data: response.data };
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../types/functions";
|
|
3
3
|
import type { ClientCredentialsCreatedItem } from "@zapier/zapier-sdk-core/v0/schemas/client-credentials";
|
|
4
|
-
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
5
4
|
export declare const CreateClientCredentialsSchema: z.ZodObject<{
|
|
6
5
|
name: z.ZodString;
|
|
7
6
|
allowedScopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
@@ -14,7 +13,6 @@ export type CreateClientCredentialsOptions = z.infer<typeof CreateClientCredenti
|
|
|
14
13
|
export interface CreateClientCredentialsResult {
|
|
15
14
|
data: ClientCredentialsCreatedItem;
|
|
16
15
|
}
|
|
17
|
-
export type CreateClientCredentialsError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
18
16
|
export interface CreateClientCredentialsSdkFunction {
|
|
19
17
|
createClientCredentials: (options: CreateClientCredentialsOptions) => Promise<CreateClientCredentialsResult>;
|
|
20
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AAE1G,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/createClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AAE1G,eAAO,MAAM,6BAA6B;;;;;;;iBAc+B,CAAC;AAG1E,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,4BAA4B,CAAC;CACpC;AAGD,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
1
|
import type { ApiClient } from "../../api";
|
|
3
|
-
|
|
4
|
-
import type { EventEmissionProvides } from "../eventEmission";
|
|
5
|
-
export interface DeleteClientCredentialsPluginProvides {
|
|
6
|
-
deleteClientCredentials: (options: DeleteClientCredentialsOptions) => Promise<DeleteClientCredentialsResult>;
|
|
2
|
+
export declare const deleteClientCredentialsPlugin: (sdk: {
|
|
7
3
|
context: {
|
|
8
|
-
|
|
9
|
-
deleteClientCredentials: {
|
|
10
|
-
inputSchema: typeof DeleteClientCredentialsSchema;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
4
|
+
api: ApiClient;
|
|
13
5
|
};
|
|
14
|
-
}
|
|
15
|
-
|
|
6
|
+
} & {
|
|
7
|
+
context: import("../eventEmission").EventEmissionContext;
|
|
8
|
+
} & {
|
|
16
9
|
context: {
|
|
17
|
-
|
|
10
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
11
|
+
};
|
|
12
|
+
}) => {
|
|
13
|
+
deleteClientCredentials: (options?: {
|
|
14
|
+
clientId: string;
|
|
15
|
+
} | undefined) => Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
} & {
|
|
19
|
+
context: {
|
|
20
|
+
meta: {
|
|
21
|
+
deleteClientCredentials: import("../..").PluginMeta;
|
|
22
|
+
};
|
|
18
23
|
};
|
|
19
|
-
}
|
|
24
|
+
};
|
|
25
|
+
export type DeleteClientCredentialsPluginProvides = ReturnType<typeof deleteClientCredentialsPlugin>;
|
|
20
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,eAAO,MAAM,6BAA6B;aACvB;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;CAyBpC,CAAC;AAEF,MAAM,MAAM,qCAAqC,GAAG,UAAU,CAC5D,OAAO,6BAA6B,CACrC,CAAC"}
|
|
@@ -1,43 +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 { DeleteClientCredentialsSchema } from "./schemas";
|
|
5
4
|
import { clientIdResolver } from "../../resolvers";
|
|
6
|
-
export const deleteClientCredentialsPlugin = (sdk) => {
|
|
7
|
-
|
|
5
|
+
export const deleteClientCredentialsPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
|
+
name: "deleteClientCredentials",
|
|
7
|
+
categories: ["client-credentials"],
|
|
8
|
+
type: "delete",
|
|
9
|
+
itemType: "ClientCredentials",
|
|
10
|
+
inputSchema: DeleteClientCredentialsSchema,
|
|
11
|
+
resolvers: { clientId: clientIdResolver },
|
|
12
|
+
handler: async ({ sdk, options }) => {
|
|
8
13
|
const { api } = sdk.context;
|
|
9
14
|
await api.delete(`/api/v0/client-credentials/${options.clientId}`, undefined, {
|
|
10
|
-
customErrorHandler: ({ status }) => {
|
|
11
|
-
if (status === 401) {
|
|
12
|
-
return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to delete client credentials or may be expired. (HTTP ${status})`, { statusCode: status });
|
|
13
|
-
}
|
|
14
|
-
if (status === 403) {
|
|
15
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to delete client credentials. (HTTP ${status})`, { statusCode: status });
|
|
16
|
-
}
|
|
17
|
-
return undefined;
|
|
18
|
-
},
|
|
19
15
|
authRequired: true,
|
|
20
16
|
requiredScopes: ["credentials"],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const deleteClientCredentialsDefinition = createFunction(deleteClientCredentials, DeleteClientCredentialsSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, deleteClientCredentials.name));
|
|
27
|
-
return {
|
|
28
|
-
deleteClientCredentials: deleteClientCredentialsDefinition,
|
|
29
|
-
context: {
|
|
30
|
-
meta: {
|
|
31
|
-
deleteClientCredentials: {
|
|
32
|
-
categories: ["client-credentials"],
|
|
33
|
-
type: "delete",
|
|
34
|
-
itemType: "ClientCredentials",
|
|
35
|
-
inputSchema: DeleteClientCredentialsSchema,
|
|
36
|
-
resolvers: {
|
|
37
|
-
clientId: clientIdResolver,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
17
|
+
resource: {
|
|
18
|
+
type: "client-credential",
|
|
19
|
+
id: options.clientId,
|
|
40
20
|
},
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
21
|
+
});
|
|
22
|
+
return { success: true };
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
@@ -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 DeleteClientCredentialsSchema: z.ZodObject<{
|
|
5
4
|
clientId: z.ZodString;
|
|
6
5
|
}, z.core.$strip>;
|
|
@@ -8,7 +7,6 @@ export type DeleteClientCredentialsOptions = z.infer<typeof DeleteClientCredenti
|
|
|
8
7
|
export interface DeleteClientCredentialsResult {
|
|
9
8
|
success: boolean;
|
|
10
9
|
}
|
|
11
|
-
export type DeleteClientCredentialsError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierNotFoundError | ZapierUnknownError;
|
|
12
10
|
export interface DeleteClientCredentialsSdkFunction {
|
|
13
11
|
deleteClientCredentials: (options: DeleteClientCredentialsOptions) => Promise<DeleteClientCredentialsResult>;
|
|
14
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/deleteClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,eAAO,MAAM,6BAA6B;;iBAMW,CAAC;AAGtD,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,GACC,eAAe,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AAGD,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC7C"}
|