@zapier/zapier-sdk 0.9.0 → 0.11.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/README.md +7 -7
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +14 -0
- package/dist/api/debug.d.ts +1 -0
- package/dist/api/debug.d.ts.map +1 -1
- package/dist/api/debug.js +42 -1
- package/dist/api/debug.test.d.ts +2 -0
- package/dist/api/debug.test.d.ts.map +1 -0
- package/dist/api/debug.test.js +59 -0
- package/dist/api/schemas.d.ts +451 -251
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +51 -29
- package/dist/index.cjs +968 -582
- package/dist/index.d.mts +2537 -2229
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.mjs +966 -576
- package/dist/plugins/findFirstAuthentication/index.d.ts +1 -1
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/index.js +9 -1
- package/dist/plugins/findFirstAuthentication/index.test.js +3 -4
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +5 -3
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/index.js +4 -0
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +5 -3
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +10 -0
- package/dist/plugins/getAction/schemas.d.ts +5 -3
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +8 -0
- package/dist/plugins/getApp/index.test.js +2 -2
- package/dist/plugins/getApp/schemas.d.ts +3 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.js +2 -4
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/index.js +8 -0
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +4 -0
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.js +4 -3
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +9 -0
- package/dist/plugins/listActions/schemas.d.ts +5 -3
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.js +2 -4
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +4 -0
- package/dist/plugins/listApps/index.test.js +1 -1
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.js +3 -9
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +8 -0
- package/dist/plugins/listAuthentications/schemas.d.ts +5 -3
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +14 -2
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +5 -3
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/schemas.js +10 -19
- package/dist/plugins/listInputFields/index.d.ts +4 -4
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +71 -5
- package/dist/plugins/listInputFields/index.test.js +5 -9
- package/dist/plugins/listInputFields/schemas.d.ts +8 -6
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +8 -2
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +1 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +12 -0
- package/dist/plugins/runAction/schemas.d.ts +5 -3
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/resolvers/actionKey.d.ts +13 -7
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionType.d.ts +8 -7
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/resolvers/appKey.d.ts +2 -6
- package/dist/resolvers/appKey.d.ts.map +1 -1
- package/dist/resolvers/authenticationId.d.ts +7 -7
- package/dist/resolvers/authenticationId.d.ts.map +1 -1
- package/dist/resolvers/authenticationId.js +16 -7
- package/dist/resolvers/index.d.ts +3 -35
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +4 -87
- package/dist/resolvers/inputFieldKey.d.ts +11 -0
- package/dist/resolvers/inputFieldKey.d.ts.map +1 -0
- package/dist/resolvers/inputFieldKey.js +47 -0
- package/dist/resolvers/inputs.d.ts +13 -4
- package/dist/resolvers/inputs.d.ts.map +1 -1
- package/dist/resolvers/inputs.js +36 -0
- package/dist/schemas/Action.d.ts +8 -8
- package/dist/schemas/Action.d.ts.map +1 -1
- package/dist/schemas/Action.js +8 -3
- package/dist/schemas/App.d.ts +183 -11
- package/dist/schemas/App.d.ts.map +1 -1
- package/dist/schemas/App.js +7 -9
- package/dist/schemas/Auth.d.ts +12 -12
- package/dist/schemas/Auth.js +1 -1
- package/dist/schemas/Field.d.ts +112 -97
- package/dist/schemas/Field.d.ts.map +1 -1
- package/dist/schemas/Field.js +63 -52
- package/dist/schemas/Run.d.ts +3 -0
- package/dist/schemas/Run.d.ts.map +1 -0
- package/dist/schemas/Run.js +31 -0
- package/dist/schemas/UserProfile.d.ts +11 -11
- package/dist/schemas/UserProfile.d.ts.map +1 -1
- package/dist/schemas/UserProfile.js +21 -7
- package/dist/sdk.d.ts +11 -4
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/domain.d.ts +17 -1
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +5 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +3 -1
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +5 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/domain-utils.d.ts +1 -16
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +7 -51
- package/dist/utils/schema-utils.d.ts +44 -21
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/dist/utils/schema-utils.js +17 -11
- package/dist/utils/string-utils.d.ts +12 -0
- package/dist/utils/string-utils.d.ts.map +1 -0
- package/dist/utils/string-utils.js +23 -0
- package/dist/utils/string-utils.test.d.ts +2 -0
- package/dist/utils/string-utils.test.d.ts.map +1 -0
- package/dist/utils/string-utils.test.js +36 -0
- package/package.json +1 -1
- package/src/api/client.ts +12 -0
- package/src/api/debug.test.ts +76 -0
- package/src/api/debug.ts +46 -2
- package/src/api/schemas.ts +51 -29
- package/src/index.ts +4 -5
- package/src/plugins/findFirstAuthentication/index.test.ts +8 -5
- package/src/plugins/findFirstAuthentication/index.ts +14 -2
- package/src/plugins/findUniqueAuthentication/index.ts +4 -0
- package/src/plugins/getAction/index.ts +14 -0
- package/src/plugins/getApp/index.test.ts +2 -2
- package/src/plugins/getApp/index.ts +8 -0
- package/src/plugins/getApp/schemas.ts +7 -12
- package/src/plugins/getAuthentication/index.ts +8 -0
- package/src/plugins/getProfile/index.ts +4 -0
- package/src/plugins/getProfile/schemas.ts +4 -6
- package/src/plugins/listActions/index.ts +9 -0
- package/src/plugins/listActions/schemas.ts +20 -25
- package/src/plugins/listApps/index.test.ts +1 -1
- package/src/plugins/listApps/index.ts +4 -0
- package/src/plugins/listApps/schemas.ts +17 -26
- package/src/plugins/listAuthentications/index.ts +8 -0
- package/src/plugins/listInputFieldChoices/index.ts +21 -1
- package/src/plugins/listInputFieldChoices/schemas.ts +61 -76
- package/src/plugins/listInputFields/index.test.ts +5 -9
- package/src/plugins/listInputFields/index.ts +89 -11
- package/src/plugins/listInputFields/schemas.ts +6 -3
- package/src/plugins/registry/index.ts +8 -2
- package/src/plugins/request/index.ts +1 -0
- package/src/plugins/runAction/index.ts +18 -0
- package/src/resolvers/actionKey.ts +15 -13
- package/src/resolvers/actionType.ts +10 -12
- package/src/resolvers/appKey.ts +2 -6
- package/src/resolvers/authenticationId.ts +25 -19
- package/src/resolvers/index.ts +7 -113
- package/src/resolvers/inputFieldKey.ts +70 -0
- package/src/resolvers/inputs.ts +51 -7
- package/src/schemas/Action.ts +8 -3
- package/src/schemas/App.ts +7 -9
- package/src/schemas/Auth.ts +1 -1
- package/src/schemas/Field.ts +97 -60
- package/src/schemas/Run.ts +40 -0
- package/src/schemas/UserProfile.ts +24 -7
- package/src/sdk.ts +17 -7
- package/src/types/domain.ts +24 -1
- package/src/types/plugin.ts +5 -0
- package/src/types/sdk.ts +5 -0
- package/src/utils/domain-utils.ts +9 -67
- package/src/utils/schema-utils.ts +96 -44
- package/src/utils/string-utils.test.ts +45 -0
- package/src/utils/string-utils.ts +26 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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;AAM3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,
|
|
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;AAM3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAsB5D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;KAC9B,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;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,mCAAmC,CAkHpC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ListInputFieldChoicesSchema, } from "./schemas";
|
|
1
|
+
import { ListInputFieldChoicesSchema, InputFieldChoiceItemSchema, } from "./schemas";
|
|
2
2
|
import { ZapierApiError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
|
+
import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
4
5
|
// Transform NeedChoices to InputFieldChoiceItem
|
|
5
6
|
function transformNeedChoicesToInputFieldChoiceItem(choice) {
|
|
6
7
|
return {
|
|
@@ -42,7 +43,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
42
43
|
const choices = (choicesData.choices || []).map(transformNeedChoicesToInputFieldChoiceItem);
|
|
43
44
|
// Handle pagination
|
|
44
45
|
let nextCursor;
|
|
45
|
-
if (choicesData.next_page
|
|
46
|
+
if (choicesData.next_page != null) {
|
|
46
47
|
nextCursor = choicesData.next_page.toString();
|
|
47
48
|
}
|
|
48
49
|
else if (choicesData.links?.next) {
|
|
@@ -70,7 +71,18 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
70
71
|
meta: {
|
|
71
72
|
listInputFieldChoices: {
|
|
72
73
|
categories: ["action"],
|
|
74
|
+
type: "list",
|
|
75
|
+
itemType: "InputFieldChoice",
|
|
73
76
|
inputSchema: ListInputFieldChoicesSchema,
|
|
77
|
+
outputSchema: InputFieldChoiceItemSchema,
|
|
78
|
+
resolvers: {
|
|
79
|
+
appKey: appKeyResolver,
|
|
80
|
+
actionType: actionTypeResolver,
|
|
81
|
+
actionKey: actionKeyResolver,
|
|
82
|
+
authenticationId: authenticationIdResolver,
|
|
83
|
+
inputFieldKey: inputFieldKeyResolver,
|
|
84
|
+
inputs: inputsAllOptionalResolver,
|
|
85
|
+
},
|
|
74
86
|
},
|
|
75
87
|
},
|
|
76
88
|
},
|
|
@@ -19,7 +19,9 @@ export declare const InputFieldChoiceItemSchema: z.ZodObject<{
|
|
|
19
19
|
}>;
|
|
20
20
|
export type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
|
|
21
21
|
export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
22
|
-
appKey: z.ZodString
|
|
22
|
+
appKey: z.ZodString & {
|
|
23
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
24
|
+
};
|
|
23
25
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
24
26
|
actionKey: z.ZodString;
|
|
25
27
|
inputFieldKey: z.ZodString;
|
|
@@ -30,7 +32,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
30
32
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
31
33
|
}, "strip", z.ZodTypeAny, {
|
|
32
34
|
appKey: string;
|
|
33
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
35
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
34
36
|
actionKey: string;
|
|
35
37
|
inputFieldKey: string;
|
|
36
38
|
page?: number | undefined;
|
|
@@ -40,7 +42,7 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
40
42
|
maxItems?: number | undefined;
|
|
41
43
|
}, {
|
|
42
44
|
appKey: string;
|
|
43
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
45
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
44
46
|
actionKey: string;
|
|
45
47
|
inputFieldKey: string;
|
|
46
48
|
page?: number | undefined;
|
|
@@ -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;AAUxB,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;;;;;;;;;;;;;;;EA0BrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCmC,CAAC;AAG5E,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,2BAA2B,CACnC,CAAC;AAGF,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,27 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AuthenticationIdPropertySchema, AppKeyPropertySchema, ActionTypePropertySchema, ActionKeyPropertySchema, InputsPropertySchema, } from "../../types/properties";
|
|
3
|
-
import { withFormatter
|
|
3
|
+
import { withFormatter } from "../../utils/schema-utils";
|
|
4
|
+
import { NeedChoicesSchema } from "../../api/schemas";
|
|
4
5
|
// ============================================================================
|
|
5
6
|
// Input Field Choice Item Schema
|
|
6
7
|
// ============================================================================
|
|
7
|
-
export const InputFieldChoiceItemSchema = withFormatter(
|
|
8
|
-
key: z.string().optional().describe("Unique key/value for the choice"),
|
|
9
|
-
label: z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe("Human readable label for the choice"),
|
|
13
|
-
sample: z.string().optional().describe("Sample value for the choice"),
|
|
14
|
-
value: z
|
|
15
|
-
.string()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe("Value to be submitted when selected"),
|
|
18
|
-
}), {
|
|
8
|
+
export const InputFieldChoiceItemSchema = withFormatter(NeedChoicesSchema, {
|
|
19
9
|
format: (item) => {
|
|
20
10
|
const title = item.label || item.key || "Choice";
|
|
21
|
-
const subtitle = item.label && item.key && item.label !== item.key
|
|
22
|
-
? `(${item.key})`
|
|
23
|
-
: undefined;
|
|
24
11
|
const details = [];
|
|
12
|
+
// Show key as detail if different from label
|
|
13
|
+
if (item.label && item.key && item.label !== item.key) {
|
|
14
|
+
details.push({ text: `Key: ${item.key}`, style: "dim" });
|
|
15
|
+
}
|
|
25
16
|
if (item.sample && item.sample !== item.key) {
|
|
26
17
|
details.push({ text: `Sample: ${item.sample}`, style: "dim" });
|
|
27
18
|
}
|
|
@@ -30,7 +21,7 @@ export const InputFieldChoiceItemSchema = withFormatter(z.object({
|
|
|
30
21
|
}
|
|
31
22
|
return {
|
|
32
23
|
title,
|
|
33
|
-
|
|
24
|
+
key: item.key,
|
|
34
25
|
details,
|
|
35
26
|
};
|
|
36
27
|
},
|
|
@@ -38,7 +29,7 @@ export const InputFieldChoiceItemSchema = withFormatter(z.object({
|
|
|
38
29
|
// ============================================================================
|
|
39
30
|
// Plugin Schema Definition
|
|
40
31
|
// ============================================================================
|
|
41
|
-
export const ListInputFieldChoicesSchema =
|
|
32
|
+
export const ListInputFieldChoicesSchema = z
|
|
42
33
|
.object({
|
|
43
34
|
// Required action identification
|
|
44
35
|
appKey: AppKeyPropertySchema,
|
|
@@ -70,4 +61,4 @@ export const ListInputFieldChoicesSchema = withOutputSchema(z
|
|
|
70
61
|
.optional()
|
|
71
62
|
.describe("Maximum total items to return across all pages"),
|
|
72
63
|
})
|
|
73
|
-
.describe("Get the available choices for a dynamic dropdown input field")
|
|
64
|
+
.describe("Get the available choices for a dynamic dropdown input field");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
2
2
|
import type { ApiClient } from "../../api";
|
|
3
|
-
import type { InputFieldItem } from "../../types/domain";
|
|
3
|
+
import type { InputFieldItem, InfoFieldItem, FieldsetItem, RootFieldItem } from "../../types/domain";
|
|
4
4
|
import { ListInputFieldsSchema, type ListInputFieldsOptions } from "./schemas";
|
|
5
5
|
import type { GetAppPluginProvides } from "../getApp";
|
|
6
6
|
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
7
7
|
export interface ListInputFieldsPluginProvides {
|
|
8
8
|
listInputFields: (options?: ListInputFieldsOptions) => Promise<{
|
|
9
|
-
data:
|
|
9
|
+
data: RootFieldItem[];
|
|
10
10
|
}> & AsyncIterable<{
|
|
11
|
-
data:
|
|
11
|
+
data: RootFieldItem[];
|
|
12
12
|
nextCursor?: string;
|
|
13
13
|
}> & {
|
|
14
|
-
items(): AsyncIterable<InputFieldItem>;
|
|
14
|
+
items(): AsyncIterable<InputFieldItem | InfoFieldItem | FieldsetItem>;
|
|
15
15
|
};
|
|
16
16
|
context: {
|
|
17
17
|
meta: {
|
|
@@ -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,
|
|
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,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAmKxE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,aAAa,EAAE,CAAC;KACvB,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,CAAC,EAAE,yBAAyB;AAC3D;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EAAE,2DAA2D;AAC9D,6BAA6B,CAmF9B,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ListInputFieldsSchema, } from "./schemas";
|
|
2
2
|
import { ZapierConfigurationError, ZapierApiError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
|
+
import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
5
|
+
import { RootFieldItemSchema } from "../../schemas/Field";
|
|
6
|
+
import { toTitleCase } from "../../utils/string-utils";
|
|
4
7
|
// Enums for input field transformation
|
|
5
8
|
var InputFieldType;
|
|
6
9
|
(function (InputFieldType) {
|
|
@@ -72,8 +75,8 @@ function getItemsTypeFromNeed(need) {
|
|
|
72
75
|
function transformNeedToInputFieldItem(need) {
|
|
73
76
|
const itemsType = getItemsTypeFromNeed(need);
|
|
74
77
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
type: "input_field",
|
|
79
|
+
key: need.key,
|
|
77
80
|
default_value: need.default || "",
|
|
78
81
|
depends_on: need.depends_on || [],
|
|
79
82
|
description: need.help_text || "",
|
|
@@ -86,6 +89,59 @@ function transformNeedToInputFieldItem(need) {
|
|
|
86
89
|
items: itemsType ? { type: itemsType } : undefined,
|
|
87
90
|
};
|
|
88
91
|
}
|
|
92
|
+
// Transform Need to InfoFieldItem (for copy fields)
|
|
93
|
+
function transformNeedToInfoFieldItem(need) {
|
|
94
|
+
return {
|
|
95
|
+
type: "info_field",
|
|
96
|
+
key: need.key,
|
|
97
|
+
description: need.help_text || "",
|
|
98
|
+
title: need.label,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Transform needs to fields (similar to partnerapi compute_root_fieldset_from_needs)
|
|
102
|
+
function transformNeedsToFields(needs) {
|
|
103
|
+
const rootFields = [];
|
|
104
|
+
const fieldsetMap = new Map();
|
|
105
|
+
for (const need of needs) {
|
|
106
|
+
if (need.computed) {
|
|
107
|
+
// Computed needs (i.e zap_id for CodeAPI steps) are not shown by the
|
|
108
|
+
// editor, hide them here too.
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
// If parent_key is set, we need to ensure that a corresponding
|
|
112
|
+
// fieldset exists, since we'll be adding this need to that fieldset
|
|
113
|
+
if (need.parent_key) {
|
|
114
|
+
let fieldset = fieldsetMap.get(need.parent_key);
|
|
115
|
+
if (!fieldset) {
|
|
116
|
+
fieldset = {
|
|
117
|
+
type: "fieldset",
|
|
118
|
+
key: need.parent_key,
|
|
119
|
+
title: toTitleCase(need.parent_key),
|
|
120
|
+
fields: [],
|
|
121
|
+
};
|
|
122
|
+
fieldsetMap.set(need.parent_key, fieldset);
|
|
123
|
+
rootFields.push(fieldset);
|
|
124
|
+
}
|
|
125
|
+
// Add field to fieldset
|
|
126
|
+
if (need.type === "copy" && need.help_text) {
|
|
127
|
+
fieldset.fields.push(transformNeedToInfoFieldItem(need));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
fieldset.fields.push(transformNeedToInputFieldItem(need));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// Add field to root
|
|
135
|
+
if (need.type === "copy" && need.help_text) {
|
|
136
|
+
rootFields.push(transformNeedToInfoFieldItem(need));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
rootFields.push(transformNeedToInputFieldItem(need));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return rootFields;
|
|
144
|
+
}
|
|
89
145
|
export const listInputFieldsPlugin = ({ context }) => {
|
|
90
146
|
const listInputFields = createPaginatedFunction(async function listInputFieldsPage(options) {
|
|
91
147
|
// Note: This function ignores pageSize and cursor since it's not actually paginated internally
|
|
@@ -112,10 +168,10 @@ export const listInputFieldsPlugin = ({ context }) => {
|
|
|
112
168
|
if (!needsData.success) {
|
|
113
169
|
throw new ZapierApiError(`Failed to get action fields: ${needsData.errors?.join(", ") || "Unknown error"}`);
|
|
114
170
|
}
|
|
115
|
-
// Transform Need objects to
|
|
116
|
-
const
|
|
171
|
+
// Transform Need objects to Root Fieldset with proper nesting
|
|
172
|
+
const rootFieldset = transformNeedsToFields(needsData.needs || []);
|
|
117
173
|
return {
|
|
118
|
-
data:
|
|
174
|
+
data: rootFieldset,
|
|
119
175
|
nextCursor: undefined, // No pagination needed since we return all input fields
|
|
120
176
|
};
|
|
121
177
|
}, ListInputFieldsSchema);
|
|
@@ -125,7 +181,17 @@ export const listInputFieldsPlugin = ({ context }) => {
|
|
|
125
181
|
meta: {
|
|
126
182
|
listInputFields: {
|
|
127
183
|
categories: ["action"],
|
|
184
|
+
type: "list",
|
|
185
|
+
itemType: "RootFieldItem",
|
|
128
186
|
inputSchema: ListInputFieldsSchema,
|
|
187
|
+
outputSchema: RootFieldItemSchema,
|
|
188
|
+
resolvers: {
|
|
189
|
+
appKey: appKeyResolver,
|
|
190
|
+
actionType: actionTypeResolver,
|
|
191
|
+
actionKey: actionKeyResolver,
|
|
192
|
+
authenticationId: authenticationIdResolver,
|
|
193
|
+
inputs: inputsAllOptionalResolver,
|
|
194
|
+
},
|
|
129
195
|
},
|
|
130
196
|
},
|
|
131
197
|
},
|
|
@@ -169,7 +169,7 @@ describe("listInputFields plugin", () => {
|
|
|
169
169
|
expect(result.data).toHaveLength(3);
|
|
170
170
|
// Check message field transformation
|
|
171
171
|
expect(result.data[0]).toEqual(expect.objectContaining({
|
|
172
|
-
|
|
172
|
+
key: "message",
|
|
173
173
|
title: "Message",
|
|
174
174
|
description: "The message to send",
|
|
175
175
|
is_required: true,
|
|
@@ -177,22 +177,18 @@ describe("listInputFields plugin", () => {
|
|
|
177
177
|
placeholder: "Enter your message",
|
|
178
178
|
default_value: "",
|
|
179
179
|
}));
|
|
180
|
-
// Check channel field with
|
|
180
|
+
// Check channel field with SELECT format
|
|
181
181
|
expect(result.data[1]).toEqual(expect.objectContaining({
|
|
182
|
-
|
|
182
|
+
key: "channel",
|
|
183
183
|
title: "Channel",
|
|
184
184
|
description: "The channel to send to",
|
|
185
185
|
is_required: true,
|
|
186
186
|
value_type: "STRING",
|
|
187
187
|
format: "SELECT",
|
|
188
|
-
choices: [
|
|
189
|
-
{ value: "#general", label: "General", sample: "#general" },
|
|
190
|
-
{ value: "#random", label: "Random", sample: "#random" },
|
|
191
|
-
],
|
|
192
188
|
}));
|
|
193
189
|
// Check array field
|
|
194
190
|
expect(result.data[2]).toEqual(expect.objectContaining({
|
|
195
|
-
|
|
191
|
+
key: "tags",
|
|
196
192
|
title: "Tags",
|
|
197
193
|
description: "List of tags",
|
|
198
194
|
value_type: "ARRAY",
|
|
@@ -321,7 +317,7 @@ describe("listInputFields plugin", () => {
|
|
|
321
317
|
items.push(item);
|
|
322
318
|
}
|
|
323
319
|
expect(items).toHaveLength(3);
|
|
324
|
-
expect(items[0].
|
|
320
|
+
expect(items[0].key).toBe("message");
|
|
325
321
|
});
|
|
326
322
|
});
|
|
327
323
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RootFieldItem } from "../../types/domain";
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
4
|
import type { ZapierConfigurationError, ZapierApiError, ZapierAuthenticationError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
5
5
|
export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
6
|
-
appKey: z.ZodString
|
|
6
|
+
appKey: z.ZodString & {
|
|
7
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
8
|
+
};
|
|
7
9
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
8
10
|
actionKey: z.ZodString;
|
|
9
11
|
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -12,7 +14,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
12
14
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
13
15
|
}, "strip", z.ZodTypeAny, {
|
|
14
16
|
appKey: string;
|
|
15
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
17
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
16
18
|
actionKey: string;
|
|
17
19
|
authenticationId?: number | null | undefined;
|
|
18
20
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -20,7 +22,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
20
22
|
maxItems?: number | undefined;
|
|
21
23
|
}, {
|
|
22
24
|
appKey: string;
|
|
23
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
25
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
24
26
|
actionKey: string;
|
|
25
27
|
authenticationId?: number | null | undefined;
|
|
26
28
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -30,10 +32,10 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
30
32
|
export type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
|
|
31
33
|
export type ListInputFieldsError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
32
34
|
export interface ListInputFieldsPage {
|
|
33
|
-
data:
|
|
35
|
+
data: RootFieldItem[];
|
|
34
36
|
nextCursor?: string;
|
|
35
37
|
}
|
|
36
38
|
export interface ListInputFieldsSdkFunction {
|
|
37
|
-
listInputFields: PaginatedSdkFunction<ListInputFieldsOptions,
|
|
39
|
+
listInputFields: PaginatedSdkFunction<ListInputFieldsOptions, RootFieldItem[]>;
|
|
38
40
|
}
|
|
39
41
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,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;AAG5B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBgC,CAAC;AAGnE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAG3E,MAAM,MAAM,oBAAoB,GAC5B,wBAAwB,GACxB,cAAc,GACd,yBAAyB,GACzB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,oBAAoB,CACnC,sBAAsB,EACtB,aAAa,EAAE,CAChB,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,6BAA6B;CAAG;AAEjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM;QACjB,SAAS,EAAE,qBAAqB,EAAE,CAAC;QACnC,UAAU,EAAE;YACV,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,EAAE,CAAC;SACrB,EAAE,CAAC;KACL,CAAC;CACH;AAGD,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EAAE,wBAAwB;AAC5B,EAAE,EAAE,sBAAsB;AAC1B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,6BAA6B;CAAG;AAEjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM;QACjB,SAAS,EAAE,qBAAqB,EAAE,CAAC;QACnC,UAAU,EAAE;YACV,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,EAAE,CAAC;SACrB,EAAE,CAAC;KACL,CAAC;CACH;AAGD,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EAAE,wBAAwB;AAC5B,EAAE,EAAE,sBAAsB;AAC1B,sBAAsB,CA+FvB,CAAC"}
|
|
@@ -29,10 +29,16 @@ export const registryPlugin = ({ sdk, context }) => {
|
|
|
29
29
|
const functions = metaKeys
|
|
30
30
|
.filter((key) => typeof sdk[key] === "function")
|
|
31
31
|
.map((key) => {
|
|
32
|
+
const meta = context.meta[key];
|
|
32
33
|
return {
|
|
33
|
-
...context.meta[key],
|
|
34
|
-
categories: context.meta[key].categories || [],
|
|
35
34
|
name: key,
|
|
35
|
+
type: meta.type,
|
|
36
|
+
itemType: meta.itemType,
|
|
37
|
+
returnType: meta.returnType,
|
|
38
|
+
inputSchema: meta.inputSchema,
|
|
39
|
+
outputSchema: meta.outputSchema,
|
|
40
|
+
categories: meta.categories || [],
|
|
41
|
+
resolvers: meta.resolvers,
|
|
36
42
|
};
|
|
37
43
|
})
|
|
38
44
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAmBzE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAmBzE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,OAAO,EAAE;gBACP,WAAW,EAAE,OAAO,kBAAkB,CAAC;aACxC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,qBAAqB,CAqEtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC,GACjE,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AA4ED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EAAE,0BAA0B;AAC7B,uBAAuB,CAmFxB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { RunActionSchema, } from "./schemas";
|
|
2
|
+
import { ActionResultItemSchema } from "../../schemas/Run";
|
|
2
3
|
import { ZapierValidationError, ZapierConfigurationError, ZapierActionError, } from "../../types/errors";
|
|
3
4
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
5
|
+
import { appKeyResolver, actionTypeResolver, actionKeyResolver, authenticationIdResolver, inputsResolver, } from "../../resolvers";
|
|
4
6
|
async function executeAction(actionOptions) {
|
|
5
7
|
const { api, context, appKey, actionKey, actionType, executionOptions, authenticationId, } = actionOptions;
|
|
6
8
|
// Use the manifest plugin to get the current implementation ID
|
|
@@ -78,7 +80,17 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
78
80
|
meta: {
|
|
79
81
|
runAction: {
|
|
80
82
|
categories: ["action"],
|
|
83
|
+
type: "list",
|
|
84
|
+
itemType: "ActionResult",
|
|
81
85
|
inputSchema: RunActionSchema,
|
|
86
|
+
outputSchema: ActionResultItemSchema,
|
|
87
|
+
resolvers: {
|
|
88
|
+
appKey: appKeyResolver,
|
|
89
|
+
actionType: actionTypeResolver,
|
|
90
|
+
actionKey: actionKeyResolver,
|
|
91
|
+
authenticationId: authenticationIdResolver,
|
|
92
|
+
inputs: inputsResolver,
|
|
93
|
+
},
|
|
82
94
|
},
|
|
83
95
|
},
|
|
84
96
|
},
|
|
@@ -2,7 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
3
3
|
import type { ZapierActionError, ZapierValidationError, ZapierConfigurationError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const RunActionSchema: z.ZodObject<{
|
|
5
|
-
appKey: z.ZodString
|
|
5
|
+
appKey: z.ZodString & {
|
|
6
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
7
|
+
};
|
|
6
8
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
7
9
|
actionKey: z.ZodString;
|
|
8
10
|
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -11,7 +13,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
11
13
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
12
14
|
}, "strip", z.ZodTypeAny, {
|
|
13
15
|
appKey: string;
|
|
14
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
16
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
15
17
|
actionKey: string;
|
|
16
18
|
authenticationId?: number | null | undefined;
|
|
17
19
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -19,7 +21,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
19
21
|
maxItems?: number | undefined;
|
|
20
22
|
}, {
|
|
21
23
|
appKey: string;
|
|
22
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
24
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
23
25
|
actionKey: string;
|
|
24
26
|
authenticationId?: number | null | undefined;
|
|
25
27
|
inputs?: Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB0B,CAAC;AAGvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAG/D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,oBAAoB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CAC5D"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { DynamicResolver } from "../utils/schema-utils";
|
|
2
|
+
import type { ActionTypeProperty } from "../types/properties";
|
|
3
|
+
interface ActionItem {
|
|
4
|
+
key: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
action_type: string;
|
|
7
9
|
}
|
|
8
|
-
export declare const actionKeyResolver:
|
|
10
|
+
export declare const actionKeyResolver: DynamicResolver<ActionItem, {
|
|
11
|
+
appKey: string;
|
|
12
|
+
actionType: ActionTypeProperty;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
9
15
|
//# sourceMappingURL=actionKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAuBnD,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
|
|
6
|
-
prompt: (items: any[], params: Record<string, any>) => any;
|
|
1
|
+
import type { DynamicResolver } from "../utils/schema-utils";
|
|
2
|
+
interface ActionTypeItem {
|
|
3
|
+
key: string;
|
|
4
|
+
name: string;
|
|
7
5
|
}
|
|
8
|
-
export declare const actionTypeResolver:
|
|
6
|
+
export declare const actionTypeResolver: DynamicResolver<ActionTypeItem, {
|
|
7
|
+
appKey: string;
|
|
8
|
+
}>;
|
|
9
|
+
export {};
|
|
9
10
|
//# sourceMappingURL=actionType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"actionType.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,cAAc,EACd;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAuBnB,CAAC"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
inputType?: "text" | "password" | "email";
|
|
4
|
-
placeholder?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const appKeyResolver: AppKeyResolver;
|
|
1
|
+
import type { StaticResolver } from "../utils/schema-utils";
|
|
2
|
+
export declare const appKeyResolver: StaticResolver;
|
|
7
3
|
//# sourceMappingURL=appKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/appKey.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/appKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
prompt: (items: any[], params: Record<string, any>) => any;
|
|
7
|
-
}
|
|
1
|
+
import type { DynamicResolver } from "../utils/schema-utils";
|
|
2
|
+
import type { AuthItem } from "../schemas/Auth";
|
|
3
|
+
type AuthenticationIdResolver = DynamicResolver<AuthItem, {
|
|
4
|
+
appKey?: string;
|
|
5
|
+
}>;
|
|
8
6
|
export declare const authenticationIdResolver: AuthenticationIdResolver;
|
|
7
|
+
export declare const authenticationIdGenericResolver: AuthenticationIdResolver;
|
|
8
|
+
export {};
|
|
9
9
|
//# sourceMappingURL=authenticationId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,wBAyCtC,CAAC;AAGF,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC"}
|