@zapier/zapier-sdk 0.9.0 → 0.10.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/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 +834 -563
- package/dist/index.d.mts +2287 -2085
- 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 +832 -557
- 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.map +1 -1
- package/dist/plugins/listInputFields/index.js +14 -2
- package/dist/plugins/listInputFields/index.test.js +5 -9
- package/dist/plugins/listInputFields/schemas.d.ts +5 -3
- 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 +23 -0
- package/dist/resolvers/inputs.d.ts +11 -6
- package/dist/resolvers/inputs.d.ts.map +1 -1
- package/dist/resolvers/inputs.js +17 -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 +5 -98
- package/dist/schemas/Field.d.ts.map +1 -1
- package/dist/schemas/Field.js +24 -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/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/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 +20 -2
- 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 +38 -0
- package/src/resolvers/inputs.ts +28 -10
- 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 +24 -57
- package/src/schemas/Run.ts +40 -0
- package/src/schemas/UserProfile.ts +24 -7
- package/src/sdk.ts +17 -7
- 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/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 +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,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,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;
|
|
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,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,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;AA0GxE,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,cAAc,EAAE,CAAC;KACxB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC/D,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,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,CAqF9B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
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 { InputFieldItemSchema } from "../../schemas/Field";
|
|
4
6
|
// Enums for input field transformation
|
|
5
7
|
var InputFieldType;
|
|
6
8
|
(function (InputFieldType) {
|
|
@@ -72,8 +74,8 @@ function getItemsTypeFromNeed(need) {
|
|
|
72
74
|
function transformNeedToInputFieldItem(need) {
|
|
73
75
|
const itemsType = getItemsTypeFromNeed(need);
|
|
74
76
|
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
// Only the final computed/mapped fields that are in InputFieldItemSchema
|
|
78
|
+
key: need.key,
|
|
77
79
|
default_value: need.default || "",
|
|
78
80
|
depends_on: need.depends_on || [],
|
|
79
81
|
description: need.help_text || "",
|
|
@@ -125,7 +127,17 @@ export const listInputFieldsPlugin = ({ context }) => {
|
|
|
125
127
|
meta: {
|
|
126
128
|
listInputFields: {
|
|
127
129
|
categories: ["action"],
|
|
130
|
+
type: "list",
|
|
131
|
+
itemType: "InputField",
|
|
128
132
|
inputSchema: ListInputFieldsSchema,
|
|
133
|
+
outputSchema: InputFieldItemSchema,
|
|
134
|
+
resolvers: {
|
|
135
|
+
appKey: appKeyResolver,
|
|
136
|
+
actionType: actionTypeResolver,
|
|
137
|
+
actionKey: actionKeyResolver,
|
|
138
|
+
authenticationId: authenticationIdResolver,
|
|
139
|
+
inputs: inputsAllOptionalResolver,
|
|
140
|
+
},
|
|
129
141
|
},
|
|
130
142
|
},
|
|
131
143
|
},
|
|
@@ -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
|
});
|
|
@@ -3,7 +3,9 @@ import type { InputFieldItem } 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;
|
|
@@ -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,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,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
|
|
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,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,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,cAAc,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;CAC/E"}
|
|
@@ -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"}
|
|
@@ -2,15 +2,17 @@ export const authenticationIdResolver = {
|
|
|
2
2
|
type: "dynamic",
|
|
3
3
|
depends: ["appKey"],
|
|
4
4
|
fetch: async (sdk, resolvedParams) => {
|
|
5
|
-
const
|
|
6
|
-
appKey: resolvedParams.appKey,
|
|
5
|
+
const listOptions = {
|
|
7
6
|
maxItems: 1000,
|
|
7
|
+
};
|
|
8
|
+
if (resolvedParams.appKey) {
|
|
9
|
+
listOptions.appKey = resolvedParams.appKey;
|
|
10
|
+
}
|
|
11
|
+
const myAuths = await sdk.listAuthentications({
|
|
12
|
+
...listOptions,
|
|
8
13
|
owner: "me",
|
|
9
14
|
});
|
|
10
|
-
const allAuths = await sdk.listAuthentications(
|
|
11
|
-
appKey: resolvedParams.appKey,
|
|
12
|
-
maxItems: 1000,
|
|
13
|
-
});
|
|
15
|
+
const allAuths = await sdk.listAuthentications(listOptions);
|
|
14
16
|
// Filter out myAuths from allAuths
|
|
15
17
|
const otherAuths = allAuths.data.filter((auth) => !myAuths.data.some((myAuth) => myAuth.id === auth.id));
|
|
16
18
|
return [...myAuths.data, ...otherAuths];
|
|
@@ -18,7 +20,9 @@ export const authenticationIdResolver = {
|
|
|
18
20
|
prompt: (auths, params) => ({
|
|
19
21
|
type: "list",
|
|
20
22
|
name: "authenticationId",
|
|
21
|
-
message:
|
|
23
|
+
message: params.appKey
|
|
24
|
+
? `Select authentication for ${params.appKey}:`
|
|
25
|
+
: "Select authentication:",
|
|
22
26
|
choices: [
|
|
23
27
|
...auths.map((auth) => ({
|
|
24
28
|
name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
|
|
@@ -31,3 +35,8 @@ export const authenticationIdResolver = {
|
|
|
31
35
|
],
|
|
32
36
|
}),
|
|
33
37
|
};
|
|
38
|
+
// Generic version without appKey dependency
|
|
39
|
+
export const authenticationIdGenericResolver = {
|
|
40
|
+
...authenticationIdResolver,
|
|
41
|
+
depends: [],
|
|
42
|
+
};
|
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
export declare const resolverRegistry: {
|
|
2
|
-
readonly appKey: import("./appKey").AppKeyResolver;
|
|
3
|
-
readonly actionType: import("./actionType").ActionTypeResolver;
|
|
4
|
-
readonly actionKey: import("./actionKey").ActionKeyResolver;
|
|
5
|
-
readonly authenticationId: import("./authenticationId").AuthenticationIdResolver;
|
|
6
|
-
readonly inputs: import("./inputs").InputsResolver;
|
|
7
|
-
};
|
|
8
|
-
export type ResolverName = keyof typeof resolverRegistry;
|
|
9
|
-
export type ResolverType = (typeof resolverRegistry)[ResolverName];
|
|
10
|
-
/**
|
|
11
|
-
* Get a resolver by name
|
|
12
|
-
*/
|
|
13
|
-
export declare function getResolver(name: string): ResolverType | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Get all resolvers for a list of missing parameters
|
|
16
|
-
*/
|
|
17
|
-
export declare function getResolversForMissingParams(missingParams: string[]): Record<string, ResolverType>;
|
|
18
|
-
/**
|
|
19
|
-
* Check if a parameter has a resolver
|
|
20
|
-
*/
|
|
21
|
-
export declare function hasResolver(paramName: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Get all parameter names that have resolvers
|
|
24
|
-
*/
|
|
25
|
-
export declare function getResolvableParams(): string[];
|
|
26
|
-
/**
|
|
27
|
-
* Resolve dependency chain for a parameter
|
|
28
|
-
* Returns parameters in the order they need to be resolved
|
|
29
|
-
*/
|
|
30
|
-
export declare function getResolutionOrder(paramName: string, resolved?: Set<string>): string[];
|
|
31
|
-
/**
|
|
32
|
-
* Get resolution order for multiple parameters
|
|
33
|
-
*/
|
|
34
|
-
export declare function getResolutionOrderForParams(paramNames: string[]): string[];
|
|
35
1
|
export { appKeyResolver } from "./appKey";
|
|
36
2
|
export { actionTypeResolver } from "./actionType";
|
|
37
3
|
export { actionKeyResolver } from "./actionKey";
|
|
38
|
-
export { authenticationIdResolver } from "./authenticationId";
|
|
4
|
+
export { authenticationIdResolver, authenticationIdGenericResolver, } from "./authenticationId";
|
|
39
5
|
export { inputsResolver } from "./inputs";
|
|
6
|
+
export { inputFieldKeyResolver } from "./inputFieldKey";
|
|
7
|
+
export { inputsAllOptionalResolver } from "./inputs";
|
|
40
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|