@zapier/zapier-sdk 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/CLAUDE.md +12 -14
- package/README.md +186 -192
- package/dist/api/schemas.d.ts +2 -2
- package/dist/api/schemas.js +3 -3
- package/dist/formatters/tableRecord.js +1 -1
- package/dist/index.cjs +652 -377
- package/dist/index.d.mts +468 -53
- package/dist/index.mjs +643 -378
- package/dist/plugins/apps/index.d.ts +1 -1
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +4 -8
- package/dist/plugins/apps/schemas.d.ts +2 -1
- package/dist/plugins/apps/schemas.d.ts.map +1 -1
- package/dist/plugins/apps/schemas.js +24 -8
- package/dist/plugins/fetch/index.d.ts +4 -2
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +1 -3
- package/dist/plugins/fetch/schemas.d.ts.map +1 -1
- package/dist/plugins/fetch/schemas.js +11 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +0 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts +4 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/schemas.js +2 -0
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +0 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +4 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/schemas.js +2 -0
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +8 -6
- package/dist/plugins/getAction/schemas.d.ts +58 -1
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.js +16 -4
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +6 -5
- package/dist/plugins/getApp/schemas.d.ts +19 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.js +14 -4
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +3 -5
- package/dist/plugins/getConnection/schemas.d.ts +1 -0
- package/dist/plugins/getConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getConnection/schemas.js +11 -5
- package/dist/plugins/getInputFieldsSchema/index.d.ts +2 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +18 -12
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +71 -1
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/schemas.js +39 -10
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +5 -4
- package/dist/plugins/listActions/schemas.d.ts +58 -1
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +25 -12
- package/dist/plugins/listApps/index.js +1 -1
- package/dist/plugins/listApps/schemas.d.ts +1 -0
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +6 -1
- package/dist/plugins/listConnections/index.d.ts +2 -1
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +27 -14
- package/dist/plugins/listConnections/schemas.d.ts +5 -0
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/schemas.js +22 -9
- package/dist/plugins/listInputFieldChoices/index.d.ts +2 -2
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +21 -15
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +92 -1
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +47 -23
- package/dist/plugins/listInputFields/index.d.ts +2 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +18 -13
- package/dist/plugins/listInputFields/schemas.d.ts +80 -1
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.js +40 -11
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +4 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +0 -1
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +2 -5
- package/dist/plugins/request/schemas.d.ts +2 -0
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/request/schemas.js +13 -5
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +17 -15
- package/dist/plugins/runAction/schemas.d.ts +83 -2
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.js +41 -17
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +5 -4
- package/dist/plugins/tables/createTableFields/schemas.d.ts +128 -2
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/schemas.js +23 -7
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +7 -6
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +38 -2
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/schemas.js +23 -7
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +5 -4
- package/dist/plugins/tables/deleteTable/schemas.d.ts +17 -1
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/schemas.js +14 -2
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +9 -7
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +22 -1
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/schemas.js +18 -2
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +7 -5
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +22 -1
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/schemas.js +18 -2
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +6 -5
- package/dist/plugins/tables/getTable/schemas.d.ts +16 -1
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/schemas.js +14 -2
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +9 -7
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +39 -2
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/schemas.js +20 -5
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +10 -8
- package/dist/plugins/tables/listTableFields/schemas.d.ts +27 -2
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/schemas.js +24 -8
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +7 -6
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +119 -2
- package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/schemas.js +23 -7
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +3 -2
- package/dist/plugins/tables/listTables/schemas.d.ts +5 -1
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/schemas.js +4 -1
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +7 -6
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +41 -2
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/schemas.js +23 -7
- package/dist/resolvers/actionKey.d.ts +1 -1
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionKey.js +3 -3
- package/dist/resolvers/actionType.d.ts +1 -1
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/actionType.js +2 -2
- package/dist/resolvers/connectionId.d.ts +1 -1
- package/dist/resolvers/connectionId.d.ts.map +1 -1
- package/dist/resolvers/connectionId.js +9 -9
- package/dist/resolvers/inputFieldKey.d.ts +3 -3
- package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
- package/dist/resolvers/inputFieldKey.js +6 -6
- package/dist/resolvers/inputs.d.ts +3 -3
- package/dist/resolvers/inputs.d.ts.map +1 -1
- package/dist/resolvers/inputs.js +8 -8
- package/dist/resolvers/tableFieldIds.d.ts +1 -1
- package/dist/resolvers/tableFieldIds.d.ts.map +1 -1
- package/dist/resolvers/tableFieldIds.js +3 -3
- package/dist/resolvers/tableFilters.d.ts +1 -1
- package/dist/resolvers/tableFilters.d.ts.map +1 -1
- package/dist/resolvers/tableFilters.js +4 -4
- package/dist/resolvers/tableId.js +1 -1
- package/dist/resolvers/tableRecordId.d.ts +2 -2
- package/dist/resolvers/tableRecordId.d.ts.map +1 -1
- package/dist/resolvers/tableRecordId.js +5 -5
- package/dist/resolvers/tableRecords.d.ts +2 -2
- package/dist/resolvers/tableRecords.d.ts.map +1 -1
- package/dist/resolvers/tableRecords.js +6 -6
- package/dist/resolvers/tableSort.d.ts +1 -1
- package/dist/resolvers/tableSort.d.ts.map +1 -1
- package/dist/resolvers/tableSort.js +2 -2
- package/dist/services/implementations.d.ts.map +1 -1
- package/dist/services/implementations.js +2 -3
- package/dist/types/properties.d.ts +30 -0
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +34 -1
- package/dist/types/sdk.d.ts +0 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/domain-utils.d.ts +5 -0
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +17 -3
- package/dist/utils/id-utils.d.ts +2 -0
- package/dist/utils/id-utils.d.ts.map +1 -1
- package/dist/utils/id-utils.js +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListConnectionsQuerySchema, } from "./schemas";
|
|
2
|
-
import { splitVersionedKey } from "../../utils/domain-utils";
|
|
2
|
+
import { splitVersionedKey, resolveConnectionId, } from "../../utils/domain-utils";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
5
5
|
import { appKeyResolver } from "../../resolvers";
|
|
@@ -18,9 +18,10 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
18
18
|
if (options.pageSize !== undefined) {
|
|
19
19
|
searchParams.page_size = options.pageSize.toString();
|
|
20
20
|
}
|
|
21
|
-
// Resolve appKey to implementationId if provided
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Resolve app/appKey to implementationId if provided
|
|
22
|
+
const appKey = options.app ?? options.appKey;
|
|
23
|
+
if (appKey) {
|
|
24
|
+
const implementationId = await getVersionedImplementationId(appKey);
|
|
24
25
|
if (implementationId) {
|
|
25
26
|
setMethodMetadata({ selectedApi: implementationId });
|
|
26
27
|
// Extract versionless app key to pass to handler
|
|
@@ -29,14 +30,26 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
// If we can't resolve via manifest, pass the raw appKey and let the API handle it
|
|
32
|
-
searchParams.app_key =
|
|
33
|
+
searchParams.app_key = appKey;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
// Resolve connection references (names from map, or direct IDs)
|
|
37
|
+
// Which parameter the values came from determines the resolution behavior:
|
|
38
|
+
// - connections: resolve names from map, fall back to direct IDs
|
|
39
|
+
// - connectionIds/authenticationIds: use directly (legacy behavior)
|
|
40
|
+
const connectionRefs = options.connections;
|
|
41
|
+
const legacyConnectionIds = options.connectionIds ?? options.authenticationIds;
|
|
42
|
+
if (connectionRefs && connectionRefs.length > 0) {
|
|
43
|
+
const resolvedIds = await Promise.all(connectionRefs.map((ref) => resolveConnectionId({
|
|
44
|
+
connection: ref,
|
|
45
|
+
resolveConnection: context.resolveConnection,
|
|
46
|
+
})));
|
|
47
|
+
searchParams.connection_ids = resolvedIds
|
|
48
|
+
.filter((id) => id != null)
|
|
49
|
+
.join(",");
|
|
50
|
+
}
|
|
51
|
+
else if (legacyConnectionIds && legacyConnectionIds.length > 0) {
|
|
52
|
+
searchParams.connection_ids = legacyConnectionIds.join(",");
|
|
40
53
|
}
|
|
41
54
|
if (options.search) {
|
|
42
55
|
searchParams.search = options.search;
|
|
@@ -44,8 +57,9 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
44
57
|
if (options.title) {
|
|
45
58
|
searchParams.title = options.title;
|
|
46
59
|
}
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
const accountId = options.account ?? options.accountId;
|
|
61
|
+
if (accountId) {
|
|
62
|
+
searchParams.account_id = accountId;
|
|
49
63
|
}
|
|
50
64
|
if (options.owner && options.owner !== "me" && !options.includeShared) {
|
|
51
65
|
throw new ZapierValidationError('The "owner" option requires "includeShared" to be true. Without includeShared, only your own connections are returned.');
|
|
@@ -88,9 +102,8 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
88
102
|
inputSchema: ListConnectionsQuerySchema,
|
|
89
103
|
outputSchema: ConnectionItemSchema,
|
|
90
104
|
resolvers: {
|
|
91
|
-
|
|
105
|
+
app: appKeyResolver,
|
|
92
106
|
},
|
|
93
|
-
deprecatedParameters: ["authenticationIds"],
|
|
94
107
|
},
|
|
95
108
|
},
|
|
96
109
|
},
|
|
@@ -6,11 +6,16 @@ export declare const ListConnectionsQuerySchema: z.ZodObject<{
|
|
|
6
6
|
title: z.ZodOptional<z.ZodString>;
|
|
7
7
|
search: z.ZodOptional<z.ZodString>;
|
|
8
8
|
owner: z.ZodOptional<z.ZodString>;
|
|
9
|
+
app: z.ZodOptional<z.ZodString & {
|
|
10
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
11
|
+
}>;
|
|
9
12
|
appKey: z.ZodOptional<z.ZodString & {
|
|
10
13
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
11
14
|
}>;
|
|
15
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
16
|
connectionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
17
|
authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
account: z.ZodOptional<z.ZodString>;
|
|
14
19
|
accountId: z.ZodOptional<z.ZodString>;
|
|
15
20
|
includeShared: z.ZodOptional<z.ZodBoolean>;
|
|
16
21
|
isExpired: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAErF,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;iBAqE0B,CAAC;AAGlE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAGhF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,oBAAoB,GAC5B,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;CAC/E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AppKeyPropertySchema } from "../../types/properties";
|
|
2
|
+
import { AppKeyPropertySchema, AppPropertySchema, ConnectionsPropertySchema, } from "../../types/properties";
|
|
3
3
|
import { ListConnectionsQuerySchema as ListConnectionsQueryBase } from "@zapier/zapier-sdk-core/v0/schemas/connections";
|
|
4
4
|
export const ListConnectionsQuerySchema = ListConnectionsQueryBase.omit({
|
|
5
5
|
offset: true,
|
|
@@ -11,20 +11,33 @@ export const ListConnectionsQuerySchema = ListConnectionsQueryBase.omit({
|
|
|
11
11
|
page_size: true,
|
|
12
12
|
})
|
|
13
13
|
.extend({
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// New name for appKey
|
|
15
|
+
app: AppPropertySchema.optional().describe("App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github')"),
|
|
16
|
+
/** @deprecated Use `app` instead. */
|
|
17
|
+
appKey: AppKeyPropertySchema.optional()
|
|
18
|
+
.describe("App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github')")
|
|
19
|
+
.meta({ deprecated: true }),
|
|
20
|
+
// New name for connectionIds
|
|
21
|
+
connections: ConnectionsPropertySchema.optional().describe("List of connection IDs to filter by"),
|
|
22
|
+
/** @deprecated Use `connections` instead. */
|
|
17
23
|
connectionIds: z
|
|
18
24
|
.array(z.string())
|
|
19
25
|
.optional()
|
|
20
|
-
.describe("List of connection IDs to filter by")
|
|
21
|
-
|
|
26
|
+
.describe("List of connection IDs to filter by")
|
|
27
|
+
.meta({ deprecated: true }),
|
|
28
|
+
/** @deprecated Use `connections` instead. */
|
|
22
29
|
authenticationIds: z
|
|
23
30
|
.array(z.string())
|
|
24
31
|
.optional()
|
|
25
|
-
.describe("List of authentication IDs to filter by (deprecated, use
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
.describe("List of authentication IDs to filter by (deprecated, use connections)")
|
|
33
|
+
.meta({ deprecated: true }),
|
|
34
|
+
account: z.string().optional().describe("Account to filter by"),
|
|
35
|
+
/** @deprecated Use `account` instead. */
|
|
36
|
+
accountId: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Account ID to filter by")
|
|
40
|
+
.meta({ deprecated: true }),
|
|
28
41
|
// Include shared connections (overrides default owner=me filter)
|
|
29
42
|
includeShared: z
|
|
30
43
|
.boolean()
|
|
@@ -5,6 +5,7 @@ import { ListInputFieldChoicesSchema, type ListInputFieldChoicesOptions } from "
|
|
|
5
5
|
import type { GetActionPluginProvides } from "../getAction";
|
|
6
6
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
7
7
|
import type { EventEmissionContext } from "../eventEmission";
|
|
8
|
+
import type { ConnectionsPluginProvides } from "../connections";
|
|
8
9
|
export interface ListInputFieldChoicesPluginProvides {
|
|
9
10
|
listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
|
|
10
11
|
data: InputFieldChoiceItem[];
|
|
@@ -28,6 +29,5 @@ export declare const listInputFieldChoicesPlugin: Plugin<GetSdkType<GetActionPlu
|
|
|
28
29
|
{
|
|
29
30
|
api: ApiClient;
|
|
30
31
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
31
|
-
} & EventEmissionContext
|
|
32
|
-
ListInputFieldChoicesPluginProvides>;
|
|
32
|
+
} & EventEmissionContext & ConnectionsPluginProvides["context"], ListInputFieldChoicesPluginProvides>;
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAE3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAcxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAiBhE,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE,AADqC,4BAA4B;AACjE;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,GACtB,yBAAyB,CAAC,SAAS,CAAC,EACtC,mCAAmC,CAkKpC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ListInputFieldChoicesSchema, InputFieldChoiceItemSchema, } from "./schemas";
|
|
1
|
+
import { ListInputFieldChoicesSchema, ListInputFieldChoicesInputSchema, InputFieldChoiceItemSchema, } from "./schemas";
|
|
2
2
|
import { ZapierApiError, ZapierConfigurationError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
5
5
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
6
6
|
import { fetchImplementationNeeds, fetchImplementationChoices, } from "../../services/implementations";
|
|
7
7
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
8
|
+
import { resolveConnectionId } from "../../utils/domain-utils";
|
|
8
9
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
9
10
|
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
10
11
|
// Transform NeedChoices to InputFieldChoiceItem
|
|
@@ -19,10 +20,16 @@ function transformNeedChoicesToInputFieldChoiceItem(choice) {
|
|
|
19
20
|
export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
20
21
|
async function listInputFieldChoicesPage(options) {
|
|
21
22
|
const { api, getVersionedImplementationId } = context;
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
23
|
+
const appKey = "app" in options ? options.app : options.appKey;
|
|
24
|
+
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
25
|
+
const inputFieldKey = "inputField" in options ? options.inputField : options.inputFieldKey;
|
|
26
|
+
const { actionType, connection, connectionId, authenticationId, inputs, page, cursor, } = options;
|
|
27
|
+
const resolvedConnectionId = await resolveConnectionId({
|
|
28
|
+
connection,
|
|
29
|
+
connectionId,
|
|
30
|
+
authenticationId,
|
|
31
|
+
resolveConnection: context.resolveConnection,
|
|
32
|
+
});
|
|
26
33
|
// Get versioned implementation ID for the app
|
|
27
34
|
const selectedApi = await getVersionedImplementationId(appKey);
|
|
28
35
|
if (!selectedApi) {
|
|
@@ -35,9 +42,9 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
35
42
|
});
|
|
36
43
|
// Get action details
|
|
37
44
|
const { data: action } = await sdk.getAction({
|
|
38
|
-
appKey,
|
|
45
|
+
app: appKey,
|
|
39
46
|
actionType,
|
|
40
|
-
actionKey,
|
|
47
|
+
action: actionKey,
|
|
41
48
|
});
|
|
42
49
|
// First, check for static choices by fetching implementation needs directly
|
|
43
50
|
const needsData = await fetchImplementationNeeds({
|
|
@@ -45,7 +52,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
45
52
|
selectedApi,
|
|
46
53
|
action: action.key,
|
|
47
54
|
actionType,
|
|
48
|
-
connectionId: resolvedConnectionId,
|
|
55
|
+
connectionId: resolvedConnectionId ?? null,
|
|
49
56
|
inputs,
|
|
50
57
|
});
|
|
51
58
|
// Find the specific Need by key - search through raw needs array
|
|
@@ -67,7 +74,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
67
74
|
api,
|
|
68
75
|
actionId: action.id,
|
|
69
76
|
inputFieldId: inputFieldKey,
|
|
70
|
-
connectionId: resolvedConnectionId,
|
|
77
|
+
connectionId: resolvedConnectionId ?? null,
|
|
71
78
|
inputs,
|
|
72
79
|
page: requestPage,
|
|
73
80
|
});
|
|
@@ -98,7 +105,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
98
105
|
};
|
|
99
106
|
}
|
|
100
107
|
const methodName = stripPageSuffix(listInputFieldChoicesPage.name);
|
|
101
|
-
const listInputFieldChoicesDefinition = createPaginatedFunction(listInputFieldChoicesPage,
|
|
108
|
+
const listInputFieldChoicesDefinition = createPaginatedFunction(listInputFieldChoicesPage, ListInputFieldChoicesInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
102
109
|
return {
|
|
103
110
|
listInputFieldChoices: listInputFieldChoicesDefinition,
|
|
104
111
|
context: {
|
|
@@ -110,14 +117,13 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
110
117
|
inputSchema: ListInputFieldChoicesSchema,
|
|
111
118
|
outputSchema: InputFieldChoiceItemSchema,
|
|
112
119
|
resolvers: {
|
|
113
|
-
|
|
120
|
+
app: appKeyResolver,
|
|
114
121
|
actionType: actionTypeResolver,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
action: actionKeyResolver,
|
|
123
|
+
connection: connectionIdResolver,
|
|
124
|
+
inputField: inputFieldKeyResolver,
|
|
118
125
|
inputs: inputsAllOptionalResolver,
|
|
119
126
|
},
|
|
120
|
-
deprecatedParameters: ["authenticationId"],
|
|
121
127
|
},
|
|
122
128
|
},
|
|
123
129
|
},
|
|
@@ -9,6 +9,35 @@ export declare const InputFieldChoiceItemSchema: z.ZodObject<{
|
|
|
9
9
|
}, z.core.$strip>;
|
|
10
10
|
export type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
|
|
11
11
|
export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
12
|
+
app: z.ZodString & {
|
|
13
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
14
|
+
};
|
|
15
|
+
actionType: z.ZodEnum<{
|
|
16
|
+
search: "search";
|
|
17
|
+
filter: "filter";
|
|
18
|
+
read: "read";
|
|
19
|
+
read_bulk: "read_bulk";
|
|
20
|
+
run: "run";
|
|
21
|
+
search_and_write: "search_and_write";
|
|
22
|
+
search_or_write: "search_or_write";
|
|
23
|
+
write: "write";
|
|
24
|
+
}>;
|
|
25
|
+
action: z.ZodString & {
|
|
26
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
27
|
+
};
|
|
28
|
+
inputField: z.ZodString & {
|
|
29
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
30
|
+
};
|
|
31
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
32
|
+
connectionId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
33
|
+
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
34
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
35
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare const ListInputFieldChoicesSchemaDeprecated: z.ZodObject<{
|
|
12
41
|
appKey: z.ZodString & {
|
|
13
42
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
14
43
|
};
|
|
@@ -24,6 +53,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
24
53
|
}>;
|
|
25
54
|
actionKey: z.ZodString;
|
|
26
55
|
inputFieldKey: z.ZodString;
|
|
56
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
27
57
|
connectionId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
28
58
|
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
29
59
|
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -32,7 +62,67 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
32
62
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
33
63
|
cursor: z.ZodOptional<z.ZodString>;
|
|
34
64
|
}, z.core.$strip>;
|
|
35
|
-
export
|
|
65
|
+
export declare const ListInputFieldChoicesInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
66
|
+
app: z.ZodString & {
|
|
67
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
68
|
+
};
|
|
69
|
+
actionType: z.ZodEnum<{
|
|
70
|
+
search: "search";
|
|
71
|
+
filter: "filter";
|
|
72
|
+
read: "read";
|
|
73
|
+
read_bulk: "read_bulk";
|
|
74
|
+
run: "run";
|
|
75
|
+
search_and_write: "search_and_write";
|
|
76
|
+
search_or_write: "search_or_write";
|
|
77
|
+
write: "write";
|
|
78
|
+
}>;
|
|
79
|
+
action: z.ZodString & {
|
|
80
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
81
|
+
};
|
|
82
|
+
inputField: z.ZodString & {
|
|
83
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
84
|
+
};
|
|
85
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
86
|
+
connectionId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
87
|
+
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
88
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
89
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
appKey: z.ZodString & {
|
|
95
|
+
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
96
|
+
};
|
|
97
|
+
actionType: z.ZodEnum<{
|
|
98
|
+
search: "search";
|
|
99
|
+
filter: "filter";
|
|
100
|
+
read: "read";
|
|
101
|
+
read_bulk: "read_bulk";
|
|
102
|
+
run: "run";
|
|
103
|
+
search_and_write: "search_and_write";
|
|
104
|
+
search_or_write: "search_or_write";
|
|
105
|
+
write: "write";
|
|
106
|
+
}>;
|
|
107
|
+
actionKey: z.ZodString;
|
|
108
|
+
inputFieldKey: z.ZodString;
|
|
109
|
+
connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
110
|
+
connectionId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
111
|
+
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
112
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
113
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>]>;
|
|
118
|
+
export type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema> | (Omit<z.infer<typeof ListInputFieldChoicesSchemaDeprecated>, "appKey" | "actionKey" | "inputFieldKey"> & {
|
|
119
|
+
/** @deprecated Use `app` instead. */
|
|
120
|
+
appKey: z.infer<typeof ListInputFieldChoicesSchemaDeprecated>["appKey"];
|
|
121
|
+
/** @deprecated Use `action` instead. */
|
|
122
|
+
actionKey: z.infer<typeof ListInputFieldChoicesSchemaDeprecated>["actionKey"];
|
|
123
|
+
/** @deprecated Use `inputField` instead. */
|
|
124
|
+
inputFieldKey: z.infer<typeof ListInputFieldChoicesSchemaDeprecated>["inputFieldKey"];
|
|
125
|
+
});
|
|
36
126
|
export type ListInputFieldChoicesError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
37
127
|
export interface ListInputFieldChoicesPage {
|
|
38
128
|
data: InputFieldChoiceItem[];
|
|
@@ -41,4 +131,5 @@ export interface ListInputFieldChoicesPage {
|
|
|
41
131
|
export interface ListInputFieldChoicesSdkFunction {
|
|
42
132
|
listInputFieldChoices: PaginatedSdkFunction<ListInputFieldChoicesOptions, InputFieldChoiceItem>;
|
|
43
133
|
}
|
|
134
|
+
export {};
|
|
44
135
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAM5B,eAAO,MAAM,0BAA0B;;;;;iBA0BrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AA2C9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBpC,CAAC;AAGL,QAAA,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;iBAUF,CAAC;AAG1C,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAG9C,MAAM,MAAM,4BAA4B,GACpC,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,GAC3C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,EACrD,QAAQ,GAAG,WAAW,GAAG,eAAe,CACzC,GAAG;IACF,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxE,wCAAwC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAChB,OAAO,qCAAqC,CAC7C,CAAC,WAAW,CAAC,CAAC;IACf,4CAA4C;IAC5C,aAAa,EAAE,CAAC,CAAC,KAAK,CACpB,OAAO,qCAAqC,CAC7C,CAAC,eAAe,CAAC,CAAC;CACpB,CAAC,CAAC;AAGP,MAAM,MAAM,0BAA0B,GAClC,wBAAwB,GACxB,cAAc,GACd,yBAAyB,GACzB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,oBAAoB,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,gCAAgC;IAC/C,qBAAqB,EAAE,oBAAoB,CACzC,4BAA4B,EAC5B,oBAAoB,CACrB,CAAC;CACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ConnectionIdPropertySchema, AuthenticationIdPropertySchema, AppKeyPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, InputsPropertySchema, } from "../../types/properties";
|
|
2
|
+
import { ConnectionIdPropertySchema, ConnectionPropertySchema, AuthenticationIdPropertySchema, AppKeyPropertySchema, AppPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, ActionPropertySchema, InputFieldPropertySchema, InputsPropertySchema, } from "../../types/properties";
|
|
3
3
|
import { withFormatter } from "../../utils/schema-utils";
|
|
4
4
|
import { NeedChoicesSchema } from "../../api/schemas";
|
|
5
5
|
// ============================================================================
|
|
@@ -29,23 +29,18 @@ export const InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
|
|
|
29
29
|
// ============================================================================
|
|
30
30
|
// Plugin Schema Definition
|
|
31
31
|
// ============================================================================
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
actionType: ActionTypePropertySchema,
|
|
37
|
-
actionKey: ActionKeyPropertySchema,
|
|
38
|
-
// Input field specification
|
|
39
|
-
inputFieldKey: z
|
|
40
|
-
.string()
|
|
41
|
-
.min(1)
|
|
42
|
-
.describe("Input field key to get choices for."),
|
|
43
|
-
// Common parameters
|
|
32
|
+
const ListInputFieldChoicesDescription = "Get the available choices for a dynamic dropdown input field";
|
|
33
|
+
// Base schema for shared (optional) properties
|
|
34
|
+
const ListInputFieldChoicesBaseSchema = z.object({
|
|
35
|
+
connection: ConnectionPropertySchema.optional().describe("Connection alias (string) or numeric connectionId. Strings are resolved from the connections map; numbers are used directly. Mutually exclusive with connectionId."),
|
|
44
36
|
connectionId: ConnectionIdPropertySchema.nullable()
|
|
45
37
|
.optional()
|
|
46
|
-
.describe("Connection ID to use when listing available field choices. Required if the action needs a connection to populate dynamic dropdown options.")
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
.describe("Connection ID to use when listing available field choices. Required if the action needs a connection to populate dynamic dropdown options.")
|
|
39
|
+
.meta({ deprecated: true }),
|
|
40
|
+
/** @deprecated Use connection instead */
|
|
41
|
+
authenticationId: AuthenticationIdPropertySchema.nullable()
|
|
42
|
+
.optional()
|
|
43
|
+
.meta({ deprecated: true }),
|
|
49
44
|
inputs: InputsPropertySchema.optional().describe("Current input values that may affect available choices"),
|
|
50
45
|
page: z
|
|
51
46
|
.number()
|
|
@@ -53,17 +48,46 @@ export const ListInputFieldChoicesSchema = z
|
|
|
53
48
|
.min(0)
|
|
54
49
|
.optional()
|
|
55
50
|
.describe("Page number for paginated results"),
|
|
56
|
-
|
|
57
|
-
pageSize: z
|
|
58
|
-
.number()
|
|
59
|
-
.min(1)
|
|
60
|
-
.optional()
|
|
61
|
-
.describe("Number of choices per page"),
|
|
51
|
+
pageSize: z.number().min(1).optional().describe("Number of choices per page"),
|
|
62
52
|
maxItems: z
|
|
63
53
|
.number()
|
|
64
54
|
.min(1)
|
|
65
55
|
.optional()
|
|
66
56
|
.describe("Maximum total items to return across all pages"),
|
|
67
57
|
cursor: z.string().optional().describe("Cursor to start from"),
|
|
58
|
+
});
|
|
59
|
+
// Schema for docs/registry (new param names only)
|
|
60
|
+
export const ListInputFieldChoicesSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
app: AppPropertySchema,
|
|
63
|
+
actionType: ActionTypePropertySchema,
|
|
64
|
+
action: ActionPropertySchema,
|
|
65
|
+
inputField: InputFieldPropertySchema,
|
|
66
|
+
})
|
|
67
|
+
.merge(ListInputFieldChoicesBaseSchema)
|
|
68
|
+
.describe(ListInputFieldChoicesDescription)
|
|
69
|
+
.meta({
|
|
70
|
+
aliases: {
|
|
71
|
+
appKey: "app",
|
|
72
|
+
actionKey: "action",
|
|
73
|
+
inputFieldKey: "inputField",
|
|
74
|
+
connectionId: "connection",
|
|
75
|
+
authenticationId: "connection",
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
// Deprecated schema (backward compat)
|
|
79
|
+
const ListInputFieldChoicesSchemaDeprecated = z
|
|
80
|
+
.object({
|
|
81
|
+
appKey: AppKeyPropertySchema,
|
|
82
|
+
actionType: ActionTypePropertySchema,
|
|
83
|
+
actionKey: ActionKeyPropertySchema,
|
|
84
|
+
inputFieldKey: z
|
|
85
|
+
.string()
|
|
86
|
+
.min(1)
|
|
87
|
+
.describe("Input field key to get choices for."),
|
|
68
88
|
})
|
|
69
|
-
.
|
|
89
|
+
.merge(ListInputFieldChoicesBaseSchema);
|
|
90
|
+
// Union for runtime validation (accepts either new or old names)
|
|
91
|
+
export const ListInputFieldChoicesInputSchema = z
|
|
92
|
+
.union([ListInputFieldChoicesSchema, ListInputFieldChoicesSchemaDeprecated])
|
|
93
|
+
.describe(ListInputFieldChoicesDescription);
|
|
@@ -6,6 +6,7 @@ import type { GetAppPluginProvides } from "../getApp";
|
|
|
6
6
|
import type { GetActionPluginProvides } from "../getAction";
|
|
7
7
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
8
8
|
import type { EventEmissionContext } from "../eventEmission";
|
|
9
|
+
import type { ConnectionsPluginProvides } from "../connections";
|
|
9
10
|
export interface ListInputFieldsPluginProvides {
|
|
10
11
|
listInputFields: (options?: ListInputFieldsOptions) => Promise<{
|
|
11
12
|
data: RootFieldItem[];
|
|
@@ -29,6 +30,6 @@ export declare const listInputFieldsPlugin: Plugin<GetSdkType<GetAppPluginProvid
|
|
|
29
30
|
{
|
|
30
31
|
api: ApiClient;
|
|
31
32
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
32
|
-
} & EventEmissionContext, // requires api, getVersionedImplementationId, and
|
|
33
|
+
} & EventEmissionContext & ConnectionsPluginProvides["context"], // requires api, getVersionedImplementationId, eventEmission, and resolveConnection in context
|
|
33
34
|
ListInputFieldsPluginProvides>;
|
|
34
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EAErB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAYxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AA4JhE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,aAAa,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC9D,KAAK,IAAI,aAAa,CAAC,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;KACvE,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,qBAAqB,CAAC;aAC3C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,GACtB,yBAAyB,CAAC,SAAS,CAAC,EAAE,8FAA8F;AACtI,6BAA6B,CAgG9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListInputFieldsSchema, } from "./schemas";
|
|
1
|
+
import { ListInputFieldsSchema, ListInputFieldsInputSchema, } from "./schemas";
|
|
2
2
|
import { ZapierConfigurationError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
@@ -7,6 +7,7 @@ import { RootFieldItemSchema } from "../../schemas/Field";
|
|
|
7
7
|
import { toTitleCase, stripPageSuffix } from "../../utils/string-utils";
|
|
8
8
|
import { fetchImplementationNeeds } from "../../services/implementations";
|
|
9
9
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
10
|
+
import { resolveConnectionId } from "../../utils/domain-utils";
|
|
10
11
|
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
11
12
|
// Enums for input field transformation
|
|
12
13
|
var InputFieldType;
|
|
@@ -150,10 +151,15 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
150
151
|
async function listInputFieldsPage(options) {
|
|
151
152
|
// Note: This function ignores pageSize and cursor since it's not actually paginated internally
|
|
152
153
|
const { api, getVersionedImplementationId } = context;
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
const resolvedConnectionId =
|
|
154
|
+
const appKey = "app" in options ? options.app : options.appKey;
|
|
155
|
+
const actionKey = "action" in options ? options.action : options.actionKey;
|
|
156
|
+
const { actionType, connection, connectionId, authenticationId, inputs } = options;
|
|
157
|
+
const resolvedConnectionId = await resolveConnectionId({
|
|
158
|
+
connection,
|
|
159
|
+
connectionId,
|
|
160
|
+
authenticationId,
|
|
161
|
+
resolveConnection: context.resolveConnection,
|
|
162
|
+
});
|
|
157
163
|
// Use the manifest plugin
|
|
158
164
|
const selectedApi = await getVersionedImplementationId(appKey);
|
|
159
165
|
if (!selectedApi) {
|
|
@@ -167,9 +173,9 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
167
173
|
// Need to call getAction here because it resolves both action.key AND action.id
|
|
168
174
|
// eg: `create_report` or `core:39487493`
|
|
169
175
|
const { data: action } = await sdk.getAction({
|
|
170
|
-
appKey,
|
|
176
|
+
app: appKey,
|
|
171
177
|
actionType,
|
|
172
|
-
actionKey,
|
|
178
|
+
action: actionKey,
|
|
173
179
|
});
|
|
174
180
|
// Use service layer to fetch implementation needs
|
|
175
181
|
const needsData = await fetchImplementationNeeds({
|
|
@@ -177,7 +183,7 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
177
183
|
selectedApi,
|
|
178
184
|
action: action.key,
|
|
179
185
|
actionType,
|
|
180
|
-
connectionId: resolvedConnectionId,
|
|
186
|
+
connectionId: resolvedConnectionId ?? null,
|
|
181
187
|
inputs,
|
|
182
188
|
});
|
|
183
189
|
// Transform Need objects to Root Fieldset with proper nesting
|
|
@@ -188,7 +194,7 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
188
194
|
};
|
|
189
195
|
}
|
|
190
196
|
const methodName = stripPageSuffix(listInputFieldsPage.name);
|
|
191
|
-
const listInputFieldsDefinition = createPaginatedFunction(listInputFieldsPage,
|
|
197
|
+
const listInputFieldsDefinition = createPaginatedFunction(listInputFieldsPage, ListInputFieldsInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
192
198
|
return {
|
|
193
199
|
listInputFields: listInputFieldsDefinition,
|
|
194
200
|
context: {
|
|
@@ -200,13 +206,12 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
200
206
|
inputSchema: ListInputFieldsSchema,
|
|
201
207
|
outputSchema: RootFieldItemSchema,
|
|
202
208
|
resolvers: {
|
|
203
|
-
|
|
209
|
+
app: appKeyResolver,
|
|
204
210
|
actionType: actionTypeResolver,
|
|
205
|
-
|
|
206
|
-
|
|
211
|
+
action: actionKeyResolver,
|
|
212
|
+
connection: connectionIdResolver,
|
|
207
213
|
inputs: inputsAllOptionalResolver,
|
|
208
214
|
},
|
|
209
|
-
deprecatedParameters: ["authenticationId"],
|
|
210
215
|
},
|
|
211
216
|
},
|
|
212
217
|
},
|