@zapier/zapier-sdk 0.8.3 → 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 +18 -0
- package/README.md +17 -40
- 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 +1149 -751
- package/dist/index.d.mts +2359 -2161
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.mjs +1143 -743
- package/dist/plugins/apps/index.d.ts +4 -0
- package/dist/plugins/apps/index.d.ts.map +1 -1
- 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 +2 -7
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +17 -9
- package/dist/plugins/getApp/index.test.js +3 -3
- 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/getAuthentication/index.test.js +1 -1
- 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 +2 -4
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +10 -1
- package/dist/plugins/listActions/index.test.js +4 -4
- 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 +4 -7
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +37 -17
- package/dist/plugins/listApps/index.test.js +23 -3
- 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 +2 -4
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +12 -0
- package/dist/plugins/listAuthentications/index.test.js +39 -13
- package/dist/plugins/listAuthentications/schemas.d.ts +8 -3
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +4 -0
- 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/manifest/index.d.ts +25 -9
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +239 -67
- package/dist/plugins/manifest/index.test.js +426 -171
- package/dist/plugins/manifest/schemas.d.ts +5 -1
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +1 -0
- 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 +15 -14
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +1 -4
- package/dist/types/plugin.d.ts +6 -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 +11 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/domain-utils.d.ts +17 -16
- package/dist/utils/domain-utils.d.ts.map +1 -1
- package/dist/utils/domain-utils.js +53 -78
- package/dist/utils/domain-utils.test.js +157 -3
- package/dist/utils/file-utils.d.ts +4 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +74 -0
- package/dist/utils/file-utils.test.d.ts +2 -0
- package/dist/utils/file-utils.test.d.ts.map +1 -0
- package/dist/utils/file-utils.test.js +51 -0
- 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 +5 -6
- package/src/plugins/apps/index.ts +9 -2
- 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 +3 -3
- package/src/plugins/getApp/index.ts +20 -14
- package/src/plugins/getApp/schemas.ts +7 -12
- package/src/plugins/getAuthentication/index.test.ts +1 -1
- 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.test.ts +8 -7
- package/src/plugins/listActions/index.ts +12 -3
- package/src/plugins/listActions/schemas.ts +20 -25
- package/src/plugins/listApps/index.test.ts +24 -3
- package/src/plugins/listApps/index.ts +50 -25
- package/src/plugins/listApps/schemas.ts +17 -26
- package/src/plugins/listAuthentications/index.test.ts +52 -15
- package/src/plugins/listAuthentications/index.ts +15 -2
- package/src/plugins/listAuthentications/schemas.ts +4 -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/manifest/index.test.ts +503 -197
- package/src/plugins/manifest/index.ts +338 -82
- package/src/plugins/manifest/schemas.ts +9 -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 +18 -12
- package/src/types/plugin.ts +8 -0
- package/src/types/sdk.ts +31 -21
- package/src/utils/domain-utils.test.ts +196 -2
- package/src/utils/domain-utils.ts +77 -102
- package/src/utils/file-utils.test.ts +73 -0
- package/src/utils/file-utils.ts +94 -0
- package/src/utils/schema-utils.ts +96 -44
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/plugins/lockVersion/index.d.ts +0 -24
- package/dist/plugins/lockVersion/index.d.ts.map +0 -1
- package/dist/plugins/lockVersion/index.js +0 -72
- package/dist/plugins/lockVersion/index.test.d.ts +0 -2
- package/dist/plugins/lockVersion/index.test.d.ts.map +0 -1
- package/dist/plugins/lockVersion/index.test.js +0 -129
- package/dist/plugins/lockVersion/schemas.d.ts +0 -10
- package/dist/plugins/lockVersion/schemas.d.ts.map +0 -1
- package/dist/plugins/lockVersion/schemas.js +0 -6
- package/src/plugins/lockVersion/index.test.ts +0 -176
- package/src/plugins/lockVersion/index.ts +0 -112
- package/src/plugins/lockVersion/schemas.ts +0 -9
|
@@ -8,4 +8,8 @@ export interface AppsPluginProvides {
|
|
|
8
8
|
export declare const appsPlugin: Plugin<GetSdkType<FetchPluginProvides & RunActionPluginProvides>, // requires fetch + runAction in SDK
|
|
9
9
|
{}, // no context requirements
|
|
10
10
|
AppsPluginProvides>;
|
|
11
|
+
export type { ActionExecutionOptions } from "./types";
|
|
12
|
+
export type { ActionExecutionResult } from "../../api/types";
|
|
13
|
+
export interface ZapierSdkApps {
|
|
14
|
+
}
|
|
11
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA4JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAMnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
|
|
@@ -4,7 +4,7 @@ import { FindFirstAuthenticationSchema, type FindFirstAuthenticationOptions } fr
|
|
|
4
4
|
import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
|
|
5
5
|
export interface FindFirstAuthenticationPluginProvides {
|
|
6
6
|
findFirstAuthentication: (options?: FindFirstAuthenticationOptions) => Promise<{
|
|
7
|
-
data: AuthenticationItem
|
|
7
|
+
data: AuthenticationItem;
|
|
8
8
|
}>;
|
|
9
9
|
context: {
|
|
10
10
|
meta: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,6BAA6B,EAC7B,KAAK,8BAA8B,EACpC,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,6BAA6B,EAC7B,KAAK,8BAA8B,EACpC,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAIhF,MAAM,WAAW,qCAAqC;IACpD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,uBAAuB,EAAE;gBACvB,WAAW,EAAE,OAAO,6BAA6B,CAAC;aACnD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAChD,UAAU,CAAC,iCAAiC,CAAC,EAAE,sCAAsC;AACrF,EAAE,EAAE,0BAA0B;AAC9B,qCAAqC,CAwCtC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FindFirstAuthenticationSchema, } from "./schemas";
|
|
2
2
|
import { createFunction } from "../../utils/function-utils";
|
|
3
|
+
import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
4
|
+
import { ZapierResourceNotFoundError } from "../../types/errors";
|
|
3
5
|
export const findFirstAuthenticationPlugin = ({ sdk }) => {
|
|
4
6
|
const findFirstAuthentication = createFunction(async function findFirstAuthentication(options = {}) {
|
|
5
7
|
// Use listAuthentications with maxItems 1 to get the first result
|
|
@@ -7,8 +9,11 @@ export const findFirstAuthenticationPlugin = ({ sdk }) => {
|
|
|
7
9
|
...options,
|
|
8
10
|
maxItems: 1,
|
|
9
11
|
});
|
|
12
|
+
if (authsResponse.data.length === 0) {
|
|
13
|
+
throw new ZapierResourceNotFoundError("No authentication found matching the specified criteria", { resourceType: "Authentication" });
|
|
14
|
+
}
|
|
10
15
|
return {
|
|
11
|
-
data: authsResponse.data
|
|
16
|
+
data: authsResponse.data[0],
|
|
12
17
|
};
|
|
13
18
|
}, FindFirstAuthenticationSchema);
|
|
14
19
|
return {
|
|
@@ -17,7 +22,10 @@ export const findFirstAuthenticationPlugin = ({ sdk }) => {
|
|
|
17
22
|
meta: {
|
|
18
23
|
findFirstAuthentication: {
|
|
19
24
|
categories: ["authentication"],
|
|
25
|
+
type: "item",
|
|
26
|
+
itemType: "Authentication",
|
|
20
27
|
inputSchema: FindFirstAuthenticationSchema,
|
|
28
|
+
outputSchema: AuthenticationItemSchema,
|
|
21
29
|
},
|
|
22
30
|
},
|
|
23
31
|
},
|
|
@@ -109,15 +109,14 @@ describe("findFirstAuthentication plugin", () => {
|
|
|
109
109
|
});
|
|
110
110
|
expect(result.data).toEqual(mockAuth);
|
|
111
111
|
});
|
|
112
|
-
it("should
|
|
112
|
+
it("should throw error when no authentications found", async () => {
|
|
113
113
|
mockListAuthentications.mockResolvedValue({
|
|
114
114
|
data: [],
|
|
115
115
|
});
|
|
116
116
|
const sdk = createTestSdk();
|
|
117
|
-
|
|
117
|
+
await expect(sdk.findFirstAuthentication({
|
|
118
118
|
appKey: "nonexistent",
|
|
119
|
-
});
|
|
120
|
-
expect(result.data).toBeNull();
|
|
119
|
+
})).rejects.toThrow("No authentication found matching the specified criteria");
|
|
121
120
|
});
|
|
122
121
|
it("should return first authentication when multiple found", async () => {
|
|
123
122
|
const mockAuth = mockAuthentications[0];
|
|
@@ -2,20 +2,22 @@ import { z } from "zod";
|
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
5
|
-
appKey: z.ZodOptional<z.ZodString
|
|
5
|
+
appKey: z.ZodOptional<z.ZodString & {
|
|
6
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
7
|
+
}>;
|
|
6
8
|
search: z.ZodOptional<z.ZodString>;
|
|
7
9
|
title: z.ZodOptional<z.ZodString>;
|
|
8
10
|
accountId: z.ZodOptional<z.ZodString>;
|
|
9
11
|
owner: z.ZodOptional<z.ZodString>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
title?: string | undefined;
|
|
12
13
|
search?: string | undefined;
|
|
14
|
+
title?: string | undefined;
|
|
13
15
|
appKey?: string | undefined;
|
|
14
16
|
accountId?: string | undefined;
|
|
15
17
|
owner?: string | undefined;
|
|
16
18
|
}, {
|
|
17
|
-
title?: string | undefined;
|
|
18
19
|
search?: string | undefined;
|
|
20
|
+
title?: string | undefined;
|
|
19
21
|
appKey?: string | undefined;
|
|
20
22
|
accountId?: string | undefined;
|
|
21
23
|
owner?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;EAgBwB,CAAC;AAGnE,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,KAAK,+BAA+B,EACrC,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,KAAK,+BAA+B,EACrC,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAGhF,MAAM,WAAW,sCAAsC;IACrD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,wBAAwB,EAAE;gBACxB,WAAW,EAAE,OAAO,8BAA8B,CAAC;aACpD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,UAAU,CAAC,iCAAiC,CAAC,EAAE,sCAAsC;AACrF,EAAE,EAAE,0BAA0B;AAC9B,sCAAsC,CA8CvC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FindUniqueAuthenticationSchema, } from "./schemas";
|
|
2
2
|
import { ZapierResourceNotFoundError, ZapierValidationError, } from "../../types/errors";
|
|
3
3
|
import { createFunction } from "../../utils/function-utils";
|
|
4
|
+
import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
4
5
|
export const findUniqueAuthenticationPlugin = ({ sdk }) => {
|
|
5
6
|
const findUniqueAuthentication = createFunction(async function findUniqueAuthentication(options = {}) {
|
|
6
7
|
// Use listAuthentications with maxItems 2 to check for uniqueness
|
|
@@ -24,7 +25,10 @@ export const findUniqueAuthenticationPlugin = ({ sdk }) => {
|
|
|
24
25
|
meta: {
|
|
25
26
|
findUniqueAuthentication: {
|
|
26
27
|
categories: ["authentication"],
|
|
28
|
+
type: "item",
|
|
29
|
+
itemType: "Authentication",
|
|
27
30
|
inputSchema: FindUniqueAuthenticationSchema,
|
|
31
|
+
outputSchema: AuthenticationItemSchema,
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
},
|
|
@@ -2,20 +2,22 @@ import { z } from "zod";
|
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
5
|
-
appKey: z.ZodOptional<z.ZodString
|
|
5
|
+
appKey: z.ZodOptional<z.ZodString & {
|
|
6
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
7
|
+
}>;
|
|
6
8
|
search: z.ZodOptional<z.ZodString>;
|
|
7
9
|
title: z.ZodOptional<z.ZodString>;
|
|
8
10
|
accountId: z.ZodOptional<z.ZodString>;
|
|
9
11
|
owner: z.ZodOptional<z.ZodString>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
title?: string | undefined;
|
|
12
13
|
search?: string | undefined;
|
|
14
|
+
title?: string | undefined;
|
|
13
15
|
appKey?: string | undefined;
|
|
14
16
|
accountId?: string | undefined;
|
|
15
17
|
owner?: string | undefined;
|
|
16
18
|
}, {
|
|
17
|
-
title?: string | undefined;
|
|
18
19
|
search?: string | undefined;
|
|
20
|
+
title?: string | undefined;
|
|
19
21
|
appKey?: string | undefined;
|
|
20
22
|
accountId?: string | undefined;
|
|
21
23
|
owner?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;EAgBsB,CAAC;AAGlE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,MAAM,6BAA6B,GACrC,yBAAyB,GACzB,cAAc,GACd,2BAA2B,GAC3B,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mCAAmC;IAClD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/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,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/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,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAQhE,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,yBAAyB,CAAC,EAAE,8BAA8B;AACrE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,uBAAuB,CA2CxB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { GetActionSchema } from "./schemas";
|
|
2
2
|
import { ZapierResourceNotFoundError } from "../../types/errors";
|
|
3
3
|
import { createFunction } from "../../utils/function-utils";
|
|
4
|
+
import { appKeyResolver, actionTypeResolver, actionKeyResolver, } from "../../resolvers";
|
|
5
|
+
import { ActionItemSchema } from "../../schemas/Action";
|
|
4
6
|
export const getActionPlugin = ({ sdk }) => {
|
|
5
7
|
const getAction = createFunction(async function getAction(options) {
|
|
6
8
|
const { actionKey, actionType, appKey } = options;
|
|
@@ -21,7 +23,15 @@ export const getActionPlugin = ({ sdk }) => {
|
|
|
21
23
|
meta: {
|
|
22
24
|
getAction: {
|
|
23
25
|
categories: ["action"],
|
|
26
|
+
type: "item",
|
|
27
|
+
itemType: "Action",
|
|
24
28
|
inputSchema: GetActionSchema,
|
|
29
|
+
outputSchema: ActionItemSchema,
|
|
30
|
+
resolvers: {
|
|
31
|
+
appKey: appKeyResolver,
|
|
32
|
+
actionType: actionTypeResolver,
|
|
33
|
+
actionKey: actionKeyResolver,
|
|
34
|
+
},
|
|
25
35
|
},
|
|
26
36
|
},
|
|
27
37
|
},
|
|
@@ -2,16 +2,18 @@ import { z } from "zod";
|
|
|
2
2
|
import type { ActionItem } from "../../types/domain";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierResourceNotFoundError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const GetActionSchema: 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
|
}, "strip", z.ZodTypeAny, {
|
|
9
11
|
appKey: string;
|
|
10
|
-
actionType: "filter" | "read" | "read_bulk" | "
|
|
12
|
+
actionType: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write";
|
|
11
13
|
actionKey: string;
|
|
12
14
|
}, {
|
|
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
|
}>;
|
|
17
19
|
export type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;EAMmC,CAAC;AAGhE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAG/D,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,2BAA2B,GAC3B,kBAAkB,CAAC;AAGvB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CACzE"}
|
|
@@ -3,8 +3,7 @@ import { GetAppSchema } from "./schemas";
|
|
|
3
3
|
import type { GetAppOptions } from "./schemas";
|
|
4
4
|
import type { AppItem } from "../../types/domain";
|
|
5
5
|
import type { GetSdkType } from "../../types/plugin";
|
|
6
|
-
import type {
|
|
7
|
-
import type { ManifestPluginProvides } from "../manifest";
|
|
6
|
+
import type { ListAppsPluginProvides } from "../listApps";
|
|
8
7
|
export interface GetAppPluginProvides {
|
|
9
8
|
getApp: (options: GetAppOptions) => Promise<{
|
|
10
9
|
data: AppItem;
|
|
@@ -17,9 +16,5 @@ export interface GetAppPluginProvides {
|
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
export declare const getAppPlugin: Plugin<GetSdkType<
|
|
21
|
-
{
|
|
22
|
-
getImplementation: GetImplementation;
|
|
23
|
-
}, //
|
|
24
|
-
GetAppPluginProvides>;
|
|
19
|
+
export declare const getAppPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, {}, GetAppPluginProvides>;
|
|
25
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI1D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,WAAW,EAAE,OAAO,YAAY,CAAC;aAClC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,UAAU,CAAC,sBAAsB,CAAC,EAClC,EAAE,EACF,oBAAoB,CAgCrB,CAAC"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { createFunction } from "../../utils/function-utils";
|
|
2
2
|
import { GetAppSchema } from "./schemas";
|
|
3
|
+
import { AppItemSchema } from "../../schemas/App";
|
|
3
4
|
import { ZapierAppNotFoundError } from "../../types/errors";
|
|
5
|
+
import { appKeyResolver } from "../../resolvers";
|
|
4
6
|
// GetApp plugin depends on listApps SDK function
|
|
5
|
-
export const getAppPlugin = ({
|
|
7
|
+
export const getAppPlugin = ({ sdk }) => {
|
|
6
8
|
const getApp = createFunction(async function getApp(options) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
const appsIterator = sdk.listApps({ appKeys: [options.appKey] }).items();
|
|
10
|
+
for await (const app of appsIterator) {
|
|
11
|
+
return {
|
|
12
|
+
data: app,
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
15
|
+
throw new ZapierAppNotFoundError("App not found", {
|
|
16
|
+
appKey: options.appKey,
|
|
17
|
+
});
|
|
16
18
|
}, GetAppSchema);
|
|
17
19
|
// Return flat structure - getApp goes directly to SDK
|
|
18
20
|
return {
|
|
@@ -21,7 +23,13 @@ export const getAppPlugin = ({ context }) => {
|
|
|
21
23
|
meta: {
|
|
22
24
|
getApp: {
|
|
23
25
|
categories: ["app"],
|
|
26
|
+
type: "item",
|
|
27
|
+
itemType: "App",
|
|
24
28
|
inputSchema: GetAppSchema,
|
|
29
|
+
outputSchema: AppItemSchema,
|
|
30
|
+
resolvers: {
|
|
31
|
+
appKey: appKeyResolver,
|
|
32
|
+
},
|
|
25
33
|
},
|
|
26
34
|
},
|
|
27
35
|
},
|
|
@@ -8,8 +8,8 @@ import { manifestPlugin } from "../manifest";
|
|
|
8
8
|
function createTestSdk() {
|
|
9
9
|
return createSdk()
|
|
10
10
|
.addPlugin(apiPlugin, { fetch: global.fetch })
|
|
11
|
-
.addPlugin(listAppsPlugin)
|
|
12
11
|
.addPlugin(manifestPlugin)
|
|
12
|
+
.addPlugin(listAppsPlugin)
|
|
13
13
|
.addPlugin(getAppPlugin);
|
|
14
14
|
}
|
|
15
15
|
describe("getApp plugin", () => {
|
|
@@ -54,7 +54,7 @@ describe("getApp plugin", () => {
|
|
|
54
54
|
});
|
|
55
55
|
expect(result.data.title).toBe("Slack");
|
|
56
56
|
expect(result.data.key).toBe("SlackCLIAPI");
|
|
57
|
-
expect(result.data.
|
|
57
|
+
expect(result.data.implementation_id).toBe("SlackCLIAPI@1.0.0");
|
|
58
58
|
expect(result.data.version).toBe("1.0.0");
|
|
59
59
|
});
|
|
60
60
|
});
|
|
@@ -94,7 +94,7 @@ describe("getApp plugin", () => {
|
|
|
94
94
|
});
|
|
95
95
|
expect(result.data.title).toBeDefined();
|
|
96
96
|
expect(result.data.key).toBeDefined();
|
|
97
|
-
expect(result.data.
|
|
97
|
+
expect(result.data.implementation_id).toBeDefined();
|
|
98
98
|
expect(result.data.title).toBe("Test App");
|
|
99
99
|
expect(result.data.key).toBe("TestCLIAPI");
|
|
100
100
|
});
|
|
@@ -3,7 +3,9 @@ import type { AppItem } from "../../types/domain";
|
|
|
3
3
|
import type { ZapierApiError, ZapierAppNotFoundError, ZapierValidationError } from "../../types/errors";
|
|
4
4
|
export type GetAppError = ZapierAppNotFoundError | ZapierApiError | ZapierValidationError;
|
|
5
5
|
export declare const GetAppSchema: z.ZodObject<{
|
|
6
|
-
appKey: z.ZodString
|
|
6
|
+
appKey: z.ZodString & {
|
|
7
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
8
|
+
};
|
|
7
9
|
}, "strip", z.ZodTypeAny, {
|
|
8
10
|
appKey: string;
|
|
9
11
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAK5B,MAAM,MAAM,WAAW,GACnB,sBAAsB,GACtB,cAAc,GACd,qBAAqB,CAAC;AAG1B,eAAO,MAAM,YAAY;;;;;;;;EAMmC,CAAC;AAG7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAGzD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAChE"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
|
-
import { withOutputSchema } from "../../utils/schema-utils";
|
|
4
|
-
import { AppItemSchema } from "../../schemas/App";
|
|
5
3
|
// Pure Zod schema - no resolver metadata!
|
|
6
|
-
export const GetAppSchema =
|
|
4
|
+
export const GetAppSchema = z
|
|
7
5
|
.object({
|
|
8
6
|
appKey: AppKeyPropertySchema.describe("App key of app to fetch (e.g., 'SlackCLIAPI')"),
|
|
9
7
|
})
|
|
10
|
-
.describe("Get detailed information about a specific app")
|
|
8
|
+
.describe("Get detailed information about a specific app");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AAUnB,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,CACjB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,iBAAiB,EAAE;gBACjB,WAAW,EAAE,OAAO,uBAAuB,CAAC;aAC7C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,+BAA+B,CA6DhC,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { GetAuthenticationSchema, } from "./schemas";
|
|
|
2
2
|
import { ZapierAuthenticationError, ZapierResourceNotFoundError, } from "../../types/errors";
|
|
3
3
|
import { createFunction } from "../../utils/function-utils";
|
|
4
4
|
import { normalizeAuthenticationItem } from "../../utils/domain-utils";
|
|
5
|
+
import { authenticationIdGenericResolver } from "../../resolvers";
|
|
6
|
+
import { AuthenticationItemSchema } from "../../schemas/Auth";
|
|
5
7
|
export const getAuthenticationPlugin = ({ context }) => {
|
|
6
8
|
const getAuthentication = createFunction(async function getAuthentication(options) {
|
|
7
9
|
const { api } = context;
|
|
@@ -34,7 +36,13 @@ export const getAuthenticationPlugin = ({ context }) => {
|
|
|
34
36
|
meta: {
|
|
35
37
|
getAuthentication: {
|
|
36
38
|
categories: ["authentication"],
|
|
39
|
+
type: "item",
|
|
40
|
+
itemType: "Authentication",
|
|
37
41
|
inputSchema: GetAuthenticationSchema,
|
|
42
|
+
outputSchema: AuthenticationItemSchema,
|
|
43
|
+
resolvers: {
|
|
44
|
+
authenticationId: authenticationIdGenericResolver,
|
|
45
|
+
},
|
|
38
46
|
},
|
|
39
47
|
},
|
|
40
48
|
},
|
|
@@ -33,8 +33,8 @@ describe("getAuthentication plugin", () => {
|
|
|
33
33
|
function createTestSdk() {
|
|
34
34
|
return createSdk()
|
|
35
35
|
.addPlugin(apiPlugin)
|
|
36
|
-
.addPlugin(listAppsPlugin)
|
|
37
36
|
.addPlugin(manifestPlugin)
|
|
37
|
+
.addPlugin(listAppsPlugin)
|
|
38
38
|
.addPlugin(getAuthenticationPlugin);
|
|
39
39
|
}
|
|
40
40
|
describe("schema validation", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;IACxC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,gBAAgB,CAAC;aACtC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,wBAAwB,CAiCzB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createFunction } from "../../utils/function-utils";
|
|
2
2
|
import { GetProfileSchema } from "./schemas";
|
|
3
|
+
import { UserProfileItemSchema } from "../../schemas/UserProfile";
|
|
3
4
|
// Direct plugin function - takes options + sdk + context in one object
|
|
4
5
|
export const getProfilePlugin = ({ context }) => {
|
|
5
6
|
const getProfile = createFunction(async function getProfile() {
|
|
@@ -22,7 +23,10 @@ export const getProfilePlugin = ({ context }) => {
|
|
|
22
23
|
meta: {
|
|
23
24
|
getProfile: {
|
|
24
25
|
categories: ["account"],
|
|
26
|
+
type: "item",
|
|
27
|
+
itemType: "Profile",
|
|
25
28
|
inputSchema: GetProfileSchema,
|
|
29
|
+
outputSchema: UserProfileItemSchema,
|
|
26
30
|
},
|
|
27
31
|
},
|
|
28
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAGrE,eAAO,MAAM,gBAAgB,+DAGwB,CAAC;AAGtD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAC9D,eAAe,CAAC;AAGlB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CACV,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;CACzC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { withOutputSchema } from "../../utils/schema-utils";
|
|
3
|
-
import { UserProfileItemSchema } from "../../schemas/UserProfile";
|
|
4
2
|
// Pure Zod schema - no resolver metadata!
|
|
5
|
-
export const GetProfileSchema =
|
|
3
|
+
export const GetProfileSchema = z
|
|
4
|
+
.object({})
|
|
5
|
+
.optional()
|
|
6
|
+
.describe("Get current user's profile information");
|
|
@@ -21,10 +21,8 @@ export interface ListActionsPluginProvides {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
export declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>,
|
|
25
|
-
{
|
|
24
|
+
export declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
|
|
26
25
|
api: ApiClient;
|
|
27
26
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
28
|
-
},
|
|
29
|
-
ListActionsPluginProvides>;
|
|
27
|
+
}, ListActionsPluginProvides>;
|
|
30
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;KACpB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,iBAAiB,CAAC;aACvC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EACD,yBAAyB,CAyF1B,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { normalizeActionItem } from "../../utils/domain-utils";
|
|
2
2
|
import { ListActionsSchema, } from "./schemas";
|
|
3
|
+
import { ActionItemSchema } from "../../schemas/Action";
|
|
3
4
|
import { ZapierConfigurationError, ZapierAuthenticationError, } from "../../types/errors";
|
|
4
5
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
6
|
+
import { appKeyResolver, actionTypeResolver } from "../../resolvers";
|
|
5
7
|
export const listActionsPlugin = ({ context }) => {
|
|
6
8
|
const listActions = createPaginatedFunction(async function listActionsPage(options) {
|
|
7
9
|
const { api, getVersionedImplementationId } = context;
|
|
8
|
-
// Use
|
|
10
|
+
// Use getVersionedImplementationId (optimized to check manifest first)
|
|
9
11
|
const selectedApi = await getVersionedImplementationId(options.appKey);
|
|
10
12
|
if (!selectedApi) {
|
|
11
13
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
@@ -53,7 +55,14 @@ export const listActionsPlugin = ({ context }) => {
|
|
|
53
55
|
meta: {
|
|
54
56
|
listActions: {
|
|
55
57
|
categories: ["action"],
|
|
58
|
+
type: "list",
|
|
59
|
+
itemType: "Action",
|
|
56
60
|
inputSchema: ListActionsSchema,
|
|
61
|
+
outputSchema: ActionItemSchema,
|
|
62
|
+
resolvers: {
|
|
63
|
+
appKey: appKeyResolver,
|
|
64
|
+
actionType: actionTypeResolver,
|
|
65
|
+
},
|
|
57
66
|
},
|
|
58
67
|
},
|
|
59
68
|
},
|
|
@@ -55,6 +55,7 @@ describe("listActions plugin", () => {
|
|
|
55
55
|
.fn()
|
|
56
56
|
.mockResolvedValue("SlackCLIAPI@1.21.1");
|
|
57
57
|
});
|
|
58
|
+
const mockResolveAppKeys = vi.fn().mockResolvedValue([]);
|
|
58
59
|
function createTestSdk() {
|
|
59
60
|
// Create a proper plugin chain with context dependencies
|
|
60
61
|
// Build SDK with proper plugin composition, providing API in initial context
|
|
@@ -62,18 +63,17 @@ describe("listActions plugin", () => {
|
|
|
62
63
|
.addPlugin(() => ({
|
|
63
64
|
context: {
|
|
64
65
|
api: mockApiClient,
|
|
65
|
-
getVersionedImplementationId: mockGetVersionedImplementationId,
|
|
66
66
|
},
|
|
67
67
|
}))
|
|
68
|
-
.addPlugin(listAppsPlugin)
|
|
69
68
|
.addPlugin(() => ({
|
|
70
69
|
context: {
|
|
71
70
|
manifest: null,
|
|
72
|
-
getManifestEntry: () => null,
|
|
73
71
|
getVersionedImplementationId: mockGetVersionedImplementationId,
|
|
74
|
-
|
|
72
|
+
resolveAppKeys: mockResolveAppKeys,
|
|
73
|
+
updateManifestEntry: vi.fn().mockResolvedValue(["test-key", {}]),
|
|
75
74
|
},
|
|
76
75
|
}))
|
|
76
|
+
.addPlugin(listAppsPlugin)
|
|
77
77
|
.addPlugin(listActionsPlugin);
|
|
78
78
|
}
|
|
79
79
|
describe("schema validation", () => {
|
|
@@ -3,18 +3,20 @@ import type { ActionItem } from "../../types/domain";
|
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
4
|
import type { ZapierAuthenticationError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
5
5
|
export declare const ListActionsSchema: z.ZodObject<{
|
|
6
|
-
appKey: z.ZodString
|
|
6
|
+
appKey: z.ZodString & {
|
|
7
|
+
_def: z.ZodStringDef & import("../..").PositionalMetadata;
|
|
8
|
+
};
|
|
7
9
|
actionType: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
8
10
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
9
11
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
13
|
appKey: string;
|
|
12
|
-
actionType?: "filter" | "read" | "read_bulk" | "
|
|
14
|
+
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | undefined;
|
|
13
15
|
pageSize?: number | undefined;
|
|
14
16
|
maxItems?: number | undefined;
|
|
15
17
|
}, {
|
|
16
18
|
appKey: string;
|
|
17
|
-
actionType?: "filter" | "read" | "read_bulk" | "
|
|
19
|
+
actionType?: "filter" | "read" | "read_bulk" | "write" | "run" | "search" | "search_or_write" | "search_and_write" | undefined;
|
|
18
20
|
pageSize?: number | undefined;
|
|
19
21
|
maxItems?: number | undefined;
|
|
20
22
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;EAmBoB,CAAC;AAGnD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAGnE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,oBAAoB,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;CACnE"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AppKeyPropertySchema, ActionTypePropertySchema, } from "../../types/properties";
|
|
3
|
-
import { withOutputSchema } from "../../utils/schema-utils";
|
|
4
|
-
import { ActionItemSchema } from "../../schemas/Action";
|
|
5
3
|
// Pure Zod schema - no resolver metadata!
|
|
6
|
-
export const ListActionsSchema =
|
|
4
|
+
export const ListActionsSchema = z
|
|
7
5
|
.object({
|
|
8
6
|
appKey: AppKeyPropertySchema.describe("App key of actions to list (e.g., 'SlackCLIAPI')"),
|
|
9
7
|
actionType: ActionTypePropertySchema.optional().describe("Filter actions by type"),
|
|
@@ -18,4 +16,4 @@ export const ListActionsSchema = withOutputSchema(z
|
|
|
18
16
|
.optional()
|
|
19
17
|
.describe("Maximum total items to return across all pages"),
|
|
20
18
|
})
|
|
21
|
-
.describe("List all actions for a specific app")
|
|
19
|
+
.describe("List all actions for a specific app");
|