@zapier/zapier-sdk 0.46.0 → 0.47.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 +18 -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 +3048 -3629
- package/dist/index.d.mts +6700 -2148
- 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 +3045 -3630
- 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 +243 -0
- package/dist/utils/plugin-utils.d.ts.map +1 -0
- package/dist/utils/plugin-utils.js +232 -0
- package/package.json +2 -1
|
@@ -1,38 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../utils/plugin-utils";
|
|
2
3
|
import { connectionIdGenericResolver } from "../../resolvers";
|
|
3
4
|
import { transformConnectionItem } from "../../utils/domain-utils";
|
|
4
5
|
import { ConnectionItemSchema } from "../../schemas/Connection";
|
|
5
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
6
6
|
import { GetConnectionParamSchema } from "./schemas";
|
|
7
|
-
export const getConnectionPlugin = (sdk) => {
|
|
8
|
-
|
|
7
|
+
export const getConnectionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
8
|
+
name: "getConnection",
|
|
9
|
+
categories: ["connection"],
|
|
10
|
+
type: "item",
|
|
11
|
+
itemType: "Connection",
|
|
12
|
+
inputSchema: GetConnectionParamSchema,
|
|
13
|
+
outputSchema: ConnectionItemSchema,
|
|
14
|
+
resolvers: { connection: connectionIdGenericResolver },
|
|
15
|
+
handler: async ({ sdk, options }) => {
|
|
9
16
|
const { api } = sdk.context;
|
|
10
|
-
const resolvedConnectionId = options.connection ??
|
|
17
|
+
const resolvedConnectionId = options.connection ??
|
|
18
|
+
options.connectionId ??
|
|
19
|
+
options.authenticationId;
|
|
11
20
|
if (!resolvedConnectionId) {
|
|
12
21
|
throw new Error("connection is required");
|
|
13
22
|
}
|
|
14
|
-
const response = await api.get(`/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const getConnectionDefinition = createFunction(getConnection, GetConnectionParamSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getConnection.name));
|
|
21
|
-
return {
|
|
22
|
-
getConnection: getConnectionDefinition,
|
|
23
|
-
context: {
|
|
24
|
-
meta: {
|
|
25
|
-
getConnection: {
|
|
26
|
-
categories: ["connection"],
|
|
27
|
-
type: "item",
|
|
28
|
-
itemType: "Connection",
|
|
29
|
-
inputSchema: GetConnectionParamSchema,
|
|
30
|
-
outputSchema: ConnectionItemSchema,
|
|
31
|
-
resolvers: {
|
|
32
|
-
connection: connectionIdGenericResolver,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
23
|
+
const response = await api.get(`/api/v0/connections/${encodeURIComponent(String(resolvedConnectionId))}`, {
|
|
24
|
+
resource: {
|
|
25
|
+
type: "connection",
|
|
26
|
+
id: String(resolvedConnectionId),
|
|
35
27
|
},
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
28
|
+
});
|
|
29
|
+
return { ...response, data: transformConnectionItem(response.data) };
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { GetConnectionResponse } from "@zapier/zapier-sdk-core/v0/schemas/connections";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import type { ZapierAuthenticationError, ZapierResourceNotFoundError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
3
|
export declare const GetConnectionParamSchema: z.ZodObject<{
|
|
5
4
|
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
6
5
|
connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
7
6
|
authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
8
7
|
}, z.core.$strip>;
|
|
9
8
|
export type GetConnectionParam = z.infer<typeof GetConnectionParamSchema>;
|
|
10
|
-
export type GetConnectionError = ZapierAuthenticationError | ZapierResourceNotFoundError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
|
|
11
9
|
export interface GetConnectionSdkFunction {
|
|
12
10
|
getConnection: (options: GetConnectionParam) => Promise<GetConnectionResponse>;
|
|
13
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB;;;;iBAUnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrC"}
|
|
@@ -1,26 +1,72 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
1
|
import type { ApiClient } from "../../api";
|
|
3
|
-
import { GetInputFieldsSchemaSchema, type GetInputFieldsSchemaOptions as GetInputFieldsSchemaOptions } from "./schemas";
|
|
4
|
-
import type { GetActionPluginProvides } from "../getAction";
|
|
5
2
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
6
|
-
import type { EventEmissionProvides } from "../eventEmission";
|
|
7
3
|
import type { ConnectionsPluginProvides } from "../connections";
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export declare const getInputFieldsSchemaPlugin: (sdk: {
|
|
5
|
+
getAction: (options?: {
|
|
6
|
+
app: string;
|
|
7
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
8
|
+
action: string;
|
|
9
|
+
} | {
|
|
10
|
+
appKey: string;
|
|
11
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
12
|
+
actionKey: string;
|
|
13
|
+
} | undefined) => Promise<{
|
|
14
|
+
data: {
|
|
15
|
+
description: string;
|
|
16
|
+
key: string;
|
|
17
|
+
app_key: string;
|
|
18
|
+
action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
19
|
+
title: string;
|
|
20
|
+
type: "action";
|
|
21
|
+
id?: string | undefined;
|
|
22
|
+
is_important?: boolean | undefined;
|
|
23
|
+
is_hidden?: boolean | undefined;
|
|
24
|
+
app_version?: string | undefined;
|
|
25
|
+
};
|
|
11
26
|
}>;
|
|
27
|
+
} & {
|
|
12
28
|
context: {
|
|
13
29
|
meta: {
|
|
14
|
-
|
|
15
|
-
inputSchema: typeof GetInputFieldsSchemaSchema;
|
|
16
|
-
};
|
|
30
|
+
getAction: import("../..").PluginMeta;
|
|
17
31
|
};
|
|
18
32
|
};
|
|
19
|
-
}
|
|
20
|
-
export declare const getInputFieldsSchemaPlugin: Plugin<GetActionPluginProvides & {
|
|
33
|
+
} & {
|
|
21
34
|
context: {
|
|
22
35
|
api: ApiClient;
|
|
23
36
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
24
37
|
} & ConnectionsPluginProvides["context"];
|
|
25
|
-
} &
|
|
38
|
+
} & {
|
|
39
|
+
context: import("../eventEmission").EventEmissionContext;
|
|
40
|
+
} & {
|
|
41
|
+
context: {
|
|
42
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
43
|
+
};
|
|
44
|
+
}) => {
|
|
45
|
+
getInputFieldsSchema: (options?: {
|
|
46
|
+
app: string;
|
|
47
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
48
|
+
action: string;
|
|
49
|
+
connection?: string | number | undefined;
|
|
50
|
+
connectionId?: string | number | null | undefined;
|
|
51
|
+
authenticationId?: string | number | null | undefined;
|
|
52
|
+
inputs?: Record<string, unknown> | undefined;
|
|
53
|
+
} | {
|
|
54
|
+
appKey: string;
|
|
55
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
56
|
+
actionKey: string;
|
|
57
|
+
connection?: string | number | undefined;
|
|
58
|
+
connectionId?: string | number | null | undefined;
|
|
59
|
+
authenticationId?: string | number | null | undefined;
|
|
60
|
+
inputs?: Record<string, unknown> | undefined;
|
|
61
|
+
} | undefined) => Promise<{
|
|
62
|
+
data: Record<string, unknown>;
|
|
63
|
+
}>;
|
|
64
|
+
} & {
|
|
65
|
+
context: {
|
|
66
|
+
meta: {
|
|
67
|
+
getInputFieldsSchema: import("../..").PluginMeta;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type GetInputFieldsSchemaPluginProvides = ReturnType<typeof getInputFieldsSchemaPlugin>;
|
|
26
72
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGxB;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;cAmBpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;CAoDhD,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,0BAA0B,CAClC,CAAC"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../utils/plugin-utils";
|
|
3
|
+
import { GetInputFieldsSchemaInputSchema } from "./schemas";
|
|
2
4
|
import { ZapierConfigurationError } from "../../types/errors";
|
|
3
|
-
import { createFunction } from "../../utils/function-utils";
|
|
4
5
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
5
6
|
import { fetchImplementationNeeds } from "../../services/implementations";
|
|
6
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
7
|
import { resolveConnectionId } from "../../utils/domain-utils";
|
|
8
8
|
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
9
|
-
export const getInputFieldsSchemaPlugin = (sdk) => {
|
|
10
|
-
|
|
9
|
+
export const getInputFieldsSchemaPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
10
|
+
name: "getInputFieldsSchema",
|
|
11
|
+
categories: ["action"],
|
|
12
|
+
type: "item",
|
|
13
|
+
itemType: "InputSchema",
|
|
14
|
+
inputSchema: GetInputFieldsSchemaInputSchema,
|
|
15
|
+
resolvers: {
|
|
16
|
+
app: appKeyResolver,
|
|
17
|
+
actionType: actionTypeResolver,
|
|
18
|
+
action: actionKeyResolver,
|
|
19
|
+
connection: connectionIdResolver,
|
|
20
|
+
inputs: inputsAllOptionalResolver,
|
|
21
|
+
},
|
|
22
|
+
handler: async ({ sdk, options, }) => {
|
|
11
23
|
const { api, getVersionedImplementationId } = sdk.context;
|
|
12
24
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
13
25
|
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
14
|
-
const { actionType, connection, connectionId, authenticationId, inputs } = options;
|
|
26
|
+
const { actionType, connection, connectionId, authenticationId, inputs, } = options;
|
|
15
27
|
const resolvedConnectionId = await resolveConnectionId({
|
|
16
28
|
connection,
|
|
17
29
|
connectionId,
|
|
@@ -40,29 +52,6 @@ export const getInputFieldsSchemaPlugin = (sdk) => {
|
|
|
40
52
|
connectionId: resolvedConnectionId ?? null,
|
|
41
53
|
inputs,
|
|
42
54
|
});
|
|
43
|
-
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
const getInputFieldsSchemaDefinition = createFunction(getInputFieldsSchema, GetInputFieldsSchemaInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getInputFieldsSchema.name));
|
|
48
|
-
return {
|
|
49
|
-
getInputFieldsSchema: getInputFieldsSchemaDefinition,
|
|
50
|
-
context: {
|
|
51
|
-
meta: {
|
|
52
|
-
getInputFieldsSchema: {
|
|
53
|
-
categories: ["action"],
|
|
54
|
-
type: "item",
|
|
55
|
-
itemType: "InputSchema",
|
|
56
|
-
inputSchema: GetInputFieldsSchemaSchema,
|
|
57
|
-
resolvers: {
|
|
58
|
-
app: appKeyResolver,
|
|
59
|
-
actionType: actionTypeResolver,
|
|
60
|
-
action: actionKeyResolver,
|
|
61
|
-
connection: connectionIdResolver,
|
|
62
|
-
inputs: inputsAllOptionalResolver,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
};
|
|
55
|
+
return { data: needsData.schema || {} };
|
|
56
|
+
},
|
|
57
|
+
}));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { ZapierConfigurationError, ZapierApiError, ZapierAuthenticationError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
3
2
|
export declare const GetInputFieldsSchemaSchema: z.ZodObject<{
|
|
4
3
|
app: z.ZodString & {
|
|
5
4
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
@@ -89,7 +88,6 @@ export type GetInputFieldsSchemaOptions = z.infer<typeof GetInputFieldsSchemaSch
|
|
|
89
88
|
/** @deprecated Use `action` instead. */
|
|
90
89
|
actionKey: z.infer<typeof GetInputFieldsSchemaSchemaDeprecated>["actionKey"];
|
|
91
90
|
});
|
|
92
|
-
export type GetInputFieldsSchemaError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
93
91
|
export interface GetInputFieldsSchemaSdkFunction {
|
|
94
92
|
getInputFieldsSchema: (options: GetInputFieldsSchemaOptions) => Promise<{
|
|
95
93
|
data: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwCxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;iBAqBnC,CAAC;AAGL,QAAA,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;iBAYF,CAAC;AAGzC,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAG7C,MAAM,MAAM,2BAA2B,GACnC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,GAC1C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,EACpD,QAAQ,GAAG,WAAW,CACvB,GAAG;IACF,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvE,wCAAwC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,oCAAoC,CAC5C,CAAC,WAAW,CAAC,CAAC;CAChB,CAAC,CAAC;AAEP,MAAM,WAAW,+BAA+B;IAC9C,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACjD"}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import type { GetProfileOptions } from "./schemas";
|
|
2
1
|
import type { ApiClient } from "../../api/types";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export declare const getProfilePlugin: (sdk: {
|
|
3
|
+
context: {
|
|
4
|
+
api: ApiClient;
|
|
5
|
+
};
|
|
6
|
+
} & {
|
|
7
|
+
context: import("../eventEmission").EventEmissionContext;
|
|
8
|
+
} & {
|
|
9
|
+
context: {
|
|
10
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
11
|
+
};
|
|
12
|
+
}) => {
|
|
13
|
+
getProfile: (options?: Record<string, never> | undefined) => Promise<{
|
|
14
|
+
data: {
|
|
15
|
+
id: string;
|
|
16
|
+
first_name: string;
|
|
17
|
+
last_name: string;
|
|
18
|
+
full_name: string;
|
|
19
|
+
email: string;
|
|
20
|
+
email_confirmed: boolean;
|
|
21
|
+
timezone: string;
|
|
22
|
+
};
|
|
10
23
|
}>;
|
|
24
|
+
} & {
|
|
11
25
|
context: {
|
|
12
26
|
meta: {
|
|
13
|
-
getProfile:
|
|
14
|
-
inputSchema: typeof GetProfileSchema;
|
|
15
|
-
};
|
|
27
|
+
getProfile: import("../..").PluginMeta;
|
|
16
28
|
};
|
|
17
29
|
};
|
|
18
|
-
}
|
|
19
|
-
export
|
|
20
|
-
context: {
|
|
21
|
-
api: ApiClient;
|
|
22
|
-
};
|
|
23
|
-
} & EventEmissionProvides, // no SDK dependencies, requires api and eventEmission in context
|
|
24
|
-
GetProfilePluginProvides>;
|
|
30
|
+
};
|
|
31
|
+
export type GetProfilePluginProvides = ReturnType<typeof getProfilePlugin>;
|
|
25
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO9D,eAAO,MAAM,gBAAgB;aAGd;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
import { createPluginMethod } from "../../utils/plugin-utils";
|
|
2
3
|
import { GetProfileSchema } from "./schemas";
|
|
3
4
|
import { UserProfileItemSchema } from "../../schemas/UserProfile";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export const getProfilePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
|
+
name: "getProfile",
|
|
7
|
+
categories: ["account"],
|
|
8
|
+
type: "item",
|
|
9
|
+
itemType: "Profile",
|
|
10
|
+
inputSchema: GetProfileSchema,
|
|
11
|
+
outputSchema: UserProfileItemSchema,
|
|
12
|
+
handler: async ({ sdk }) => {
|
|
13
|
+
const profile = await sdk.context.api.get("/zapier/api/v4/profile/", { authRequired: true });
|
|
11
14
|
return {
|
|
12
15
|
data: {
|
|
13
16
|
id: String(profile.public_id ?? profile.id),
|
|
@@ -19,21 +22,5 @@ export const getProfilePlugin = (sdk) => {
|
|
|
19
22
|
timezone: profile.timezone,
|
|
20
23
|
},
|
|
21
24
|
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Return flat structure - getProfile goes directly to SDK
|
|
25
|
-
return {
|
|
26
|
-
getProfile: getProfileDefinition,
|
|
27
|
-
context: {
|
|
28
|
-
meta: {
|
|
29
|
-
getProfile: {
|
|
30
|
-
categories: ["account"],
|
|
31
|
-
type: "item",
|
|
32
|
-
itemType: "Profile",
|
|
33
|
-
inputSchema: GetProfileSchema,
|
|
34
|
-
outputSchema: UserProfileItemSchema,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
};
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { FunctionOptions } from "../../types/functions";
|
|
3
|
-
import type { UserProfileItem } from "../../types/domain";
|
|
4
|
-
import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
5
|
-
export type GetProfileError = ZapierApiError | ZapierValidationError;
|
|
6
3
|
export declare const GetProfileSchema: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
7
4
|
export type GetProfileOptions = z.infer<typeof GetProfileSchema> & FunctionOptions;
|
|
8
|
-
export interface GetProfileSdkFunction {
|
|
9
|
-
getProfile: (options?: GetProfileOptions) => Promise<{
|
|
10
|
-
data: UserProfileItem;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
5
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,+CAGwB,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAC9D,eAAe,CAAC"}
|
|
@@ -1,32 +1,82 @@
|
|
|
1
|
-
import type { Plugin } from "../../types/plugin";
|
|
2
1
|
import type { ApiClient } from "../../api";
|
|
3
|
-
import type { ActionItem } from "../../types/domain";
|
|
4
|
-
import { ListActionsSchema, type ListActionsOptions } from "./schemas";
|
|
5
|
-
import type { ManifestPluginProvides } from "../manifest";
|
|
6
2
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
7
|
-
|
|
8
|
-
export interface ListActionsPluginProvides {
|
|
9
|
-
listActions: (options?: ListActionsOptions) => Promise<{
|
|
10
|
-
data: ActionItem[];
|
|
11
|
-
nextCursor?: string;
|
|
12
|
-
}> & AsyncIterable<{
|
|
13
|
-
data: ActionItem[];
|
|
14
|
-
nextCursor?: string;
|
|
15
|
-
}> & {
|
|
16
|
-
items(): AsyncIterable<ActionItem>;
|
|
17
|
-
};
|
|
3
|
+
export declare const listActionsPlugin: (sdk: {
|
|
18
4
|
context: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
5
|
+
getResolvedManifest: () => Promise<import("../manifest").Manifest | null>;
|
|
6
|
+
getVersionedImplementationId: (appKey: string) => Promise<string | null>;
|
|
7
|
+
resolveAppKeys: ({ appKeys }: {
|
|
8
|
+
appKeys: string[];
|
|
9
|
+
}) => Promise<import("../..").ResolvedAppLocator[]>;
|
|
10
|
+
updateManifestEntry: (options: import("../manifest").UpdateManifestEntryOptions) => Promise<import("../manifest").UpdateManifestEntryResult>;
|
|
11
|
+
addActionEntry: (options: import("../manifest").AddActionEntryOptions) => Promise<import("../manifest").AddActionEntryResult>;
|
|
12
|
+
findActionEntry: ({ name, manifest, }: {
|
|
13
|
+
name: string;
|
|
14
|
+
manifest: import("../manifest").Manifest;
|
|
15
|
+
}) => import("../manifest").ActionEntry | null;
|
|
16
|
+
listActionEntries: ({ configPath, }?: {
|
|
17
|
+
configPath?: string;
|
|
18
|
+
}) => Promise<Array<[string, import("../manifest").ActionEntry]>>;
|
|
19
|
+
deleteActionEntry: ({ name, configPath, skipWrite, }: {
|
|
20
|
+
name: string;
|
|
21
|
+
configPath?: string;
|
|
22
|
+
skipWrite?: boolean;
|
|
23
|
+
}) => Promise<import("../manifest").Manifest>;
|
|
24
|
+
hasActionEntry: ({ name, manifest, }: {
|
|
25
|
+
name: string;
|
|
26
|
+
manifest: import("../manifest").Manifest;
|
|
27
|
+
}) => boolean;
|
|
28
|
+
findManifestEntry: typeof import("../manifest").findManifestEntry;
|
|
29
|
+
readManifestFromFile: typeof import("../manifest").readManifestFromFile;
|
|
30
|
+
getManifestConnections: () => Promise<Record<string, {
|
|
31
|
+
connectionId: string | number;
|
|
32
|
+
}> | null>;
|
|
24
33
|
};
|
|
25
|
-
}
|
|
26
|
-
export declare const listActionsPlugin: Plugin<ManifestPluginProvides & {
|
|
34
|
+
} & {
|
|
27
35
|
context: {
|
|
28
36
|
api: ApiClient;
|
|
29
37
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
30
38
|
};
|
|
31
|
-
} &
|
|
39
|
+
} & {
|
|
40
|
+
context: import("../eventEmission").EventEmissionContext;
|
|
41
|
+
} & {
|
|
42
|
+
context: {
|
|
43
|
+
meta: Record<string, import("../..").PluginMeta>;
|
|
44
|
+
};
|
|
45
|
+
}) => {
|
|
46
|
+
listActions: (options?: (({
|
|
47
|
+
app: string;
|
|
48
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
49
|
+
pageSize?: number | undefined;
|
|
50
|
+
maxItems?: number | undefined;
|
|
51
|
+
cursor?: string | undefined;
|
|
52
|
+
} | {
|
|
53
|
+
appKey: string;
|
|
54
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
55
|
+
pageSize?: number | undefined;
|
|
56
|
+
maxItems?: number | undefined;
|
|
57
|
+
cursor?: string | undefined;
|
|
58
|
+
}) & {
|
|
59
|
+
cursor?: string;
|
|
60
|
+
pageSize?: number;
|
|
61
|
+
maxItems?: number;
|
|
62
|
+
}) | undefined) => import("../..").PaginatedSdkResult<{
|
|
63
|
+
description: string;
|
|
64
|
+
key: string;
|
|
65
|
+
app_key: string;
|
|
66
|
+
action_type: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
67
|
+
title: string;
|
|
68
|
+
type: "action";
|
|
69
|
+
id?: string | undefined;
|
|
70
|
+
is_important?: boolean | undefined;
|
|
71
|
+
is_hidden?: boolean | undefined;
|
|
72
|
+
app_version?: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
} & {
|
|
75
|
+
context: {
|
|
76
|
+
meta: {
|
|
77
|
+
listActions: import("../..").PluginMeta;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export type ListActionsPluginProvides = ReturnType<typeof listActionsPlugin>;
|
|
32
82
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAQ3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAKxE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;sBA8E4tW,CAAC;;;;sBAAiX,CAAC;qBAAyB,CAAC;;;;;;;;;;;;;aA3ExnX;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEN,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,83 +1,55 @@
|
|
|
1
|
+
import { definePlugin } from "../../utils/plugin-utils";
|
|
2
|
+
import { createPaginatedPluginMethod } from "../../utils/plugin-utils";
|
|
1
3
|
import { normalizeActionItem } from "../../utils/domain-utils";
|
|
2
|
-
import {
|
|
4
|
+
import { ListActionsInputSchema } from "./schemas";
|
|
3
5
|
import { ActionItemSchema } from "../../schemas/Action";
|
|
4
|
-
import { ZapierConfigurationError
|
|
5
|
-
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
6
|
+
import { ZapierConfigurationError } from "../../types/errors";
|
|
6
7
|
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
7
8
|
import { appKeyResolver, actionTypeResolver } from "../../resolvers";
|
|
8
|
-
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
9
|
-
import { stripPageSuffix } from "../../utils/string-utils";
|
|
10
9
|
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
11
|
-
export const listActionsPlugin = (sdk) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
async function listActionsPage(options) {
|
|
10
|
+
export const listActionsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
|
|
11
|
+
name: "listActions",
|
|
12
|
+
categories: ["action"],
|
|
13
|
+
type: "list",
|
|
14
|
+
itemType: "Action",
|
|
15
|
+
inputSchema: ListActionsInputSchema,
|
|
16
|
+
outputSchema: ActionItemSchema,
|
|
17
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
18
|
+
resolvers: { app: appKeyResolver, actionType: actionTypeResolver },
|
|
19
|
+
handler: async ({ sdk, options, }) => {
|
|
24
20
|
const { api, getVersionedImplementationId } = sdk.context;
|
|
25
21
|
const appKey = "app" in options ? options.app : options.appKey;
|
|
26
|
-
// Use getVersionedImplementationId (optimized to check manifest first)
|
|
27
22
|
const selectedApi = await getVersionedImplementationId(appKey);
|
|
28
23
|
if (!selectedApi) {
|
|
29
24
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
30
25
|
}
|
|
31
|
-
// operationKey
|
|
26
|
+
// operationKey intentionally omitted — listActions is a list-level
|
|
27
|
+
// operation with no specific action key.
|
|
32
28
|
setMethodMetadata({
|
|
33
29
|
selectedApi,
|
|
34
30
|
operationType: options.actionType ?? null,
|
|
35
31
|
});
|
|
36
|
-
const searchParams = {
|
|
37
|
-
global: "true",
|
|
38
|
-
public_only: "true",
|
|
39
|
-
selected_apis: selectedApi,
|
|
40
|
-
};
|
|
41
32
|
const data = await api.get("/zapier/api/v4/implementations/", {
|
|
42
|
-
searchParams
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (status === 403) {
|
|
48
|
-
return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to list implementations. (HTTP ${status})`, { statusCode: status });
|
|
49
|
-
}
|
|
50
|
-
return undefined;
|
|
33
|
+
searchParams: {
|
|
34
|
+
global: "true",
|
|
35
|
+
public_only: "true",
|
|
36
|
+
selected_apis: selectedApi,
|
|
51
37
|
},
|
|
52
38
|
});
|
|
53
39
|
let allActions = [];
|
|
54
40
|
for (const implementation of data.results || []) {
|
|
55
41
|
if (implementation.actions) {
|
|
56
42
|
for (const action of implementation.actions) {
|
|
57
|
-
|
|
43
|
+
allActions.push(normalizeActionItem({
|
|
58
44
|
...action,
|
|
59
45
|
selected_api: action.selected_api || implementation.selected_api,
|
|
60
|
-
};
|
|
61
|
-
allActions.push(normalizeActionItem(actionWithContext));
|
|
46
|
+
}));
|
|
62
47
|
}
|
|
63
48
|
}
|
|
64
49
|
}
|
|
65
50
|
if (options.actionType) {
|
|
66
51
|
allActions = allActions.filter((action) => action.action_type === options.actionType);
|
|
67
52
|
}
|
|
68
|
-
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const methodName = stripPageSuffix(listActionsPage.name);
|
|
74
|
-
const listActionsDefinition = createPaginatedFunction(listActionsPage, ListActionsInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
75
|
-
return {
|
|
76
|
-
listActions: listActionsDefinition,
|
|
77
|
-
context: {
|
|
78
|
-
meta: {
|
|
79
|
-
listActions: methodMeta,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
};
|
|
53
|
+
return { data: allActions };
|
|
54
|
+
},
|
|
55
|
+
}));
|