@zapier/zapier-sdk 0.8.1 → 0.8.3
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/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +1 -2
- package/dist/api/polling.d.ts +36 -6
- package/dist/api/polling.d.ts.map +1 -1
- package/dist/api/polling.js +132 -28
- package/dist/api/polling.test.d.ts +2 -0
- package/dist/api/polling.test.d.ts.map +1 -0
- package/dist/api/polling.test.js +318 -0
- package/dist/api/types.d.ts +3 -4
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +144 -34
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +144 -34
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/schemas.d.ts +2 -1
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts +2 -2
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/schemas.d.ts +1 -1
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/schemas.d.ts +2 -1
- package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.d.ts +1 -1
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/listActions/index.d.ts +2 -2
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/schemas.d.ts +2 -1
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/schemas.d.ts +1 -1
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.d.ts +2 -2
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.d.ts +2 -1
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.d.ts +1 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/schemas.d.ts +2 -1
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/lockVersion/index.d.ts +1 -1
- package/dist/plugins/lockVersion/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.d.ts +4 -5
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.d.ts +1 -1
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/registry/index.d.ts +1 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/request/schemas.d.ts +2 -1
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/index.d.ts +1 -1
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/schemas.d.ts +2 -1
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/functions.d.ts +2 -1
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/functions.js +0 -3
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +17 -17
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/function-utils.d.ts +1 -1
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/client.ts +5 -4
- package/src/api/polling.test.ts +405 -0
- package/src/api/polling.ts +224 -44
- package/src/api/types.ts +3 -4
- package/src/plugins/apps/index.ts +1 -1
- package/src/plugins/fetch/index.ts +1 -1
- package/src/plugins/findFirstAuthentication/schemas.ts +10 -4
- package/src/plugins/findUniqueAuthentication/schemas.ts +12 -5
- package/src/plugins/getAction/schemas.ts +14 -6
- package/src/plugins/getApp/index.ts +2 -2
- package/src/plugins/getApp/schemas.ts +1 -1
- package/src/plugins/getAuthentication/schemas.ts +12 -5
- package/src/plugins/getProfile/schemas.ts +1 -1
- package/src/plugins/listActions/index.ts +2 -2
- package/src/plugins/listActions/schemas.ts +8 -3
- package/src/plugins/listApps/schemas.ts +1 -1
- package/src/plugins/listAuthentications/index.ts +2 -2
- package/src/plugins/listAuthentications/schemas.ts +12 -5
- package/src/plugins/listInputFields/index.ts +1 -1
- package/src/plugins/listInputFields/schemas.ts +14 -6
- package/src/plugins/lockVersion/index.ts +1 -1
- package/src/plugins/manifest/index.ts +6 -5
- package/src/plugins/manifest/schemas.ts +1 -1
- package/src/plugins/registry/index.ts +1 -1
- package/src/plugins/request/schemas.ts +8 -3
- package/src/plugins/runAction/index.ts +1 -1
- package/src/plugins/runAction/schemas.ts +10 -4
- package/src/sdk.ts +1 -1
- package/src/types/functions.ts +2 -1
- package/src/types/plugin.ts +1 -1
- package/src/types/sdk.ts +17 -17
- package/src/utils/function-utils.ts +1 -1
- package/src/utils/validation.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/api/types.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { SdkEvent } from "../types/events";
|
|
13
|
-
import { z } from "zod";
|
|
14
|
-
import {
|
|
13
|
+
import type { z } from "zod";
|
|
14
|
+
import type {
|
|
15
15
|
NeedChoicesSchema,
|
|
16
16
|
NeedSchema,
|
|
17
17
|
ActionLinksSchema,
|
|
@@ -88,9 +88,8 @@ export interface RequestOptions {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export interface PollOptions extends RequestOptions {
|
|
91
|
-
maxAttempts?: number;
|
|
92
91
|
initialDelay?: number;
|
|
93
|
-
|
|
92
|
+
timeoutMs?: number;
|
|
94
93
|
successStatus?: number;
|
|
95
94
|
pendingStatus?: number;
|
|
96
95
|
resultExtractor?: (response: unknown) => unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionExecutionOptions } from "./types";
|
|
1
|
+
import type { ActionExecutionOptions } from "./types";
|
|
2
2
|
import type { ActionProxy } from "./types";
|
|
3
3
|
import { ZapierValidationError } from "../../types/errors";
|
|
4
4
|
import type { Plugin, GetSdkType } from "../../types/plugin";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
3
|
import type { AuthenticationItem } from "../../types/domain";
|
|
4
|
+
import type {
|
|
5
|
+
ZapierAuthenticationError,
|
|
6
|
+
ZapierApiError,
|
|
7
|
+
ZapierValidationError,
|
|
8
|
+
ZapierUnknownError,
|
|
9
|
+
} from "../../types/errors";
|
|
4
10
|
|
|
5
11
|
// Pure Zod schema - no resolver metadata!
|
|
6
12
|
export const FindFirstAuthenticationSchema = z
|
|
@@ -28,10 +34,10 @@ export type FindFirstAuthenticationOptions = z.infer<
|
|
|
28
34
|
|
|
29
35
|
// Error union for this function (inherits from listAuthenticationsSafe)
|
|
30
36
|
export type FindFirstAuthenticationError =
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
37
|
+
| ZapierAuthenticationError
|
|
38
|
+
| ZapierApiError
|
|
39
|
+
| ZapierValidationError
|
|
40
|
+
| ZapierUnknownError;
|
|
35
41
|
|
|
36
42
|
// SDK function interface
|
|
37
43
|
export interface FindFirstAuthenticationSdkFunction {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
3
|
import type { AuthenticationItem } from "../../types/domain";
|
|
4
|
+
import type {
|
|
5
|
+
ZapierAuthenticationError,
|
|
6
|
+
ZapierApiError,
|
|
7
|
+
ZapierResourceNotFoundError,
|
|
8
|
+
ZapierValidationError,
|
|
9
|
+
ZapierUnknownError,
|
|
10
|
+
} from "../../types/errors";
|
|
4
11
|
|
|
5
12
|
// Pure Zod schema - no resolver metadata!
|
|
6
13
|
export const FindUniqueAuthenticationSchema = z
|
|
@@ -28,11 +35,11 @@ export type FindUniqueAuthenticationOptions = z.infer<
|
|
|
28
35
|
|
|
29
36
|
// Error union for this function
|
|
30
37
|
export type FindUniqueAuthenticationError =
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
38
|
+
| ZapierAuthenticationError
|
|
39
|
+
| ZapierApiError
|
|
40
|
+
| ZapierResourceNotFoundError
|
|
41
|
+
| ZapierValidationError
|
|
42
|
+
| ZapierUnknownError;
|
|
36
43
|
|
|
37
44
|
// SDK function interface
|
|
38
45
|
export interface FindUniqueAuthenticationSdkFunction {
|
|
@@ -5,6 +5,14 @@ import {
|
|
|
5
5
|
ActionKeyPropertySchema,
|
|
6
6
|
} from "../../types/properties";
|
|
7
7
|
import type { ActionItem } from "../../types/domain";
|
|
8
|
+
import type {
|
|
9
|
+
ZapierAuthenticationError,
|
|
10
|
+
ZapierApiError,
|
|
11
|
+
ZapierAppNotFoundError,
|
|
12
|
+
ZapierValidationError,
|
|
13
|
+
ZapierResourceNotFoundError,
|
|
14
|
+
ZapierUnknownError,
|
|
15
|
+
} from "../../types/errors";
|
|
8
16
|
|
|
9
17
|
// Pure Zod schema - no resolver metadata!
|
|
10
18
|
export const GetActionSchema = z
|
|
@@ -20,12 +28,12 @@ export type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
|
20
28
|
|
|
21
29
|
// Error union for this function (inherits from listActionsSafe + resource not found)
|
|
22
30
|
export type GetActionError =
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
31
|
+
| ZapierAuthenticationError
|
|
32
|
+
| ZapierApiError
|
|
33
|
+
| ZapierAppNotFoundError
|
|
34
|
+
| ZapierValidationError
|
|
35
|
+
| ZapierResourceNotFoundError
|
|
36
|
+
| ZapierUnknownError;
|
|
29
37
|
|
|
30
38
|
// SDK function interface
|
|
31
39
|
export interface GetActionSdkFunction {
|
|
@@ -5,8 +5,8 @@ import type { GetAppOptions } from "./schemas";
|
|
|
5
5
|
import type { AppItem } from "../../types/domain";
|
|
6
6
|
import { ZapierAppNotFoundError } from "../../types/errors";
|
|
7
7
|
import type { GetSdkType } from "../../types/plugin";
|
|
8
|
-
import { GetImplementation } from "../manifest/schemas";
|
|
9
|
-
import { ManifestPluginProvides } from "../manifest";
|
|
8
|
+
import type { GetImplementation } from "../manifest/schemas";
|
|
9
|
+
import type { ManifestPluginProvides } from "../manifest";
|
|
10
10
|
|
|
11
11
|
// GetApp plugin provides interface - getApp goes directly to SDK root
|
|
12
12
|
export interface GetAppPluginProvides {
|
|
@@ -3,7 +3,7 @@ import { AppKeyPropertySchema } from "../../types/properties";
|
|
|
3
3
|
import { withOutputSchema } from "../../utils/schema-utils";
|
|
4
4
|
import { AppItemSchema } from "../../schemas/App";
|
|
5
5
|
import type { AppItem } from "../../types/domain";
|
|
6
|
-
import {
|
|
6
|
+
import type {
|
|
7
7
|
ZapierApiError,
|
|
8
8
|
ZapierAppNotFoundError,
|
|
9
9
|
ZapierValidationError,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthenticationItem } from "../../types/domain";
|
|
3
|
+
import type {
|
|
4
|
+
ZapierAuthenticationError,
|
|
5
|
+
ZapierResourceNotFoundError,
|
|
6
|
+
ZapierApiError,
|
|
7
|
+
ZapierValidationError,
|
|
8
|
+
ZapierUnknownError,
|
|
9
|
+
} from "../../types/errors";
|
|
3
10
|
|
|
4
11
|
// Pure Zod schema - no resolver metadata!
|
|
5
12
|
export const GetAuthenticationSchema = z
|
|
@@ -17,11 +24,11 @@ export type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema>;
|
|
|
17
24
|
|
|
18
25
|
// Error union for this function
|
|
19
26
|
export type GetAuthenticationError =
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
27
|
+
| ZapierAuthenticationError
|
|
28
|
+
| ZapierResourceNotFoundError
|
|
29
|
+
| ZapierApiError
|
|
30
|
+
| ZapierValidationError
|
|
31
|
+
| ZapierUnknownError;
|
|
25
32
|
|
|
26
33
|
// SDK function interface - ready to be mixed into main SDK interface
|
|
27
34
|
export interface GetAuthenticationSdkFunction {
|
|
@@ -3,7 +3,7 @@ import { withOutputSchema } from "../../utils/schema-utils";
|
|
|
3
3
|
import { UserProfileItemSchema } from "../../schemas/UserProfile";
|
|
4
4
|
import type { FunctionOptions } from "../../types/functions";
|
|
5
5
|
import type { UserProfileItem } from "../../types/domain";
|
|
6
|
-
import { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
6
|
+
import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
7
7
|
|
|
8
8
|
// Union of all possible errors for getProfile
|
|
9
9
|
export type GetProfileError = ZapierApiError | ZapierValidationError;
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
ZapierAuthenticationError,
|
|
13
13
|
} from "../../types/errors";
|
|
14
14
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
15
|
-
import { ManifestPluginProvides } from "../manifest";
|
|
16
|
-
import { GetVersionedImplementationId } from "../manifest/schemas";
|
|
15
|
+
import type { ManifestPluginProvides } from "../manifest";
|
|
16
|
+
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
17
17
|
|
|
18
18
|
export interface ListActionsPluginProvides {
|
|
19
19
|
listActions: (options?: ListActionsOptions) => Promise<{
|
|
@@ -7,6 +7,11 @@ import { withOutputSchema } from "../../utils/schema-utils";
|
|
|
7
7
|
import { ActionItemSchema } from "../../schemas/Action";
|
|
8
8
|
import type { ActionItem } from "../../types/domain";
|
|
9
9
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
10
|
+
import type {
|
|
11
|
+
ZapierAuthenticationError,
|
|
12
|
+
ZapierValidationError,
|
|
13
|
+
ZapierUnknownError,
|
|
14
|
+
} from "../../types/errors";
|
|
10
15
|
|
|
11
16
|
// Pure Zod schema - no resolver metadata!
|
|
12
17
|
export const ListActionsSchema = withOutputSchema(
|
|
@@ -44,9 +49,9 @@ export interface ListActionsPage {
|
|
|
44
49
|
|
|
45
50
|
// Error union for this function
|
|
46
51
|
export type ListActionsError =
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
52
|
+
| ZapierAuthenticationError
|
|
53
|
+
| ZapierValidationError
|
|
54
|
+
| ZapierUnknownError;
|
|
50
55
|
|
|
51
56
|
// SDK function interface
|
|
52
57
|
export interface ListActionsSdkFunction {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AppItem } from "../../types/domain";
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
|
-
import { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
4
|
+
import type { ZapierApiError, ZapierValidationError } from "../../types/errors";
|
|
5
5
|
import { AppItemSchema } from "../../schemas/App";
|
|
6
6
|
import { withOutputSchema } from "../../utils/schema-utils";
|
|
7
7
|
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
createPaginatedFunction,
|
|
17
17
|
extractCursor,
|
|
18
18
|
} from "../../utils/function-utils";
|
|
19
|
-
import { GetVersionedImplementationId } from "../manifest/schemas";
|
|
20
|
-
import { ManifestPluginProvides } from "../manifest";
|
|
19
|
+
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
20
|
+
import type { ManifestPluginProvides } from "../manifest";
|
|
21
21
|
|
|
22
22
|
export interface ListAuthenticationsPluginProvides {
|
|
23
23
|
listAuthentications: (options?: ListAuthenticationsOptions) => Promise<{
|
|
@@ -2,6 +2,13 @@ import { z } from "zod";
|
|
|
2
2
|
import { AppKeyPropertySchema } from "../../types/properties";
|
|
3
3
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
4
4
|
import type { AuthenticationItem } from "../../types/domain";
|
|
5
|
+
import type {
|
|
6
|
+
ZapierAuthenticationError,
|
|
7
|
+
ZapierApiError,
|
|
8
|
+
ZapierAppNotFoundError,
|
|
9
|
+
ZapierValidationError,
|
|
10
|
+
ZapierUnknownError,
|
|
11
|
+
} from "../../types/errors";
|
|
5
12
|
|
|
6
13
|
// Pure Zod schema - no resolver metadata!
|
|
7
14
|
export const ListAuthenticationsSchema = z
|
|
@@ -45,11 +52,11 @@ export interface ListAuthenticationsPage {
|
|
|
45
52
|
|
|
46
53
|
// Error union for this function
|
|
47
54
|
export type ListAuthenticationsError =
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
55
|
+
| ZapierAuthenticationError
|
|
56
|
+
| ZapierApiError
|
|
57
|
+
| ZapierAppNotFoundError
|
|
58
|
+
| ZapierValidationError
|
|
59
|
+
| ZapierUnknownError;
|
|
53
60
|
|
|
54
61
|
// SDK function interface - ready to be mixed into main SDK interface
|
|
55
62
|
export interface ListAuthenticationsSdkFunction {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { ZapierConfigurationError, ZapierApiError } from "../../types/errors";
|
|
11
11
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
12
12
|
import type { GetAppPluginProvides } from "../getApp";
|
|
13
|
-
import { GetVersionedImplementationId } from "../manifest/schemas";
|
|
13
|
+
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
14
14
|
|
|
15
15
|
// Enums for input field transformation
|
|
16
16
|
enum InputFieldType {
|
|
@@ -8,6 +8,14 @@ import {
|
|
|
8
8
|
} from "../../types/properties";
|
|
9
9
|
import type { InputFieldItem } from "../../types/domain";
|
|
10
10
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
11
|
+
import type {
|
|
12
|
+
ZapierConfigurationError,
|
|
13
|
+
ZapierApiError,
|
|
14
|
+
ZapierAuthenticationError,
|
|
15
|
+
ZapierAppNotFoundError,
|
|
16
|
+
ZapierValidationError,
|
|
17
|
+
ZapierUnknownError,
|
|
18
|
+
} from "../../types/errors";
|
|
11
19
|
|
|
12
20
|
// Pure Zod schema - no resolver metadata!
|
|
13
21
|
export const ListInputFieldsSchema = z
|
|
@@ -37,12 +45,12 @@ export type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
|
|
|
37
45
|
|
|
38
46
|
// Error union for this function
|
|
39
47
|
export type ListInputFieldsError =
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
48
|
+
| ZapierConfigurationError
|
|
49
|
+
| ZapierApiError
|
|
50
|
+
| ZapierAuthenticationError
|
|
51
|
+
| ZapierAppNotFoundError
|
|
52
|
+
| ZapierValidationError
|
|
53
|
+
| ZapierUnknownError;
|
|
46
54
|
|
|
47
55
|
// Page result structure
|
|
48
56
|
export interface ListInputFieldsPage {
|
|
@@ -6,7 +6,7 @@ import type { AppItem } from "../../types/domain";
|
|
|
6
6
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
7
7
|
import { resolve } from "path";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { ListAppsPluginProvides } from "../listApps";
|
|
9
|
+
import type { ListAppsPluginProvides } from "../listApps";
|
|
10
10
|
|
|
11
11
|
export interface LockVersionPluginProvides {
|
|
12
12
|
lockVersion: (
|
|
@@ -5,13 +5,14 @@ import type {
|
|
|
5
5
|
GetManifestEntry,
|
|
6
6
|
GetVersionedImplementationId,
|
|
7
7
|
Manifest,
|
|
8
|
+
ManifestPluginOptionsSchema,
|
|
8
9
|
} from "./schemas";
|
|
9
|
-
import { ManifestSchema
|
|
10
|
+
import { ManifestSchema } from "./schemas";
|
|
10
11
|
import type { GetSdkType, Plugin } from "../../types/plugin";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import { ApiClient } from "../../api";
|
|
13
|
-
import { ListAppsPluginProvides } from "../listApps";
|
|
14
|
-
import { ImplementationsResponse } from "../../api/types";
|
|
12
|
+
import type { z } from "zod";
|
|
13
|
+
import type { ApiClient } from "../../api";
|
|
14
|
+
import type { ListAppsPluginProvides } from "../listApps";
|
|
15
|
+
import type { ImplementationsResponse } from "../../api/types";
|
|
15
16
|
import {
|
|
16
17
|
normalizeImplementationToAppItem,
|
|
17
18
|
splitVersionedKey,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type {
|
|
3
|
+
ZapierApiError,
|
|
4
|
+
ZapierValidationError,
|
|
5
|
+
ZapierUnknownError,
|
|
6
|
+
} from "../../types/errors";
|
|
2
7
|
|
|
3
8
|
// Pure Zod schema for the request function
|
|
4
9
|
export const RelayRequestSchema = z
|
|
@@ -47,9 +52,9 @@ export type RelayRequestOptions = z.infer<typeof RelayRequestSchema>;
|
|
|
47
52
|
|
|
48
53
|
// Error union for this function
|
|
49
54
|
export type RelayRequestError =
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
55
|
+
| ZapierApiError
|
|
56
|
+
| ZapierValidationError
|
|
57
|
+
| ZapierUnknownError;
|
|
53
58
|
|
|
54
59
|
// SDK function interface
|
|
55
60
|
export interface RelayRequestSdkFunction {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
14
14
|
import type { GetActionPluginProvides } from "../getAction";
|
|
15
15
|
import type { GetAppPluginProvides } from "../getApp";
|
|
16
|
-
import { GetVersionedImplementationId } from "../manifest/schemas";
|
|
16
|
+
import type { GetVersionedImplementationId } from "../manifest/schemas";
|
|
17
17
|
|
|
18
18
|
export interface RunActionPluginProvides {
|
|
19
19
|
runAction: (options?: RunActionOptions) => Promise<{ data: any[] }> &
|
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
InputsPropertySchema,
|
|
8
8
|
} from "../../types/properties";
|
|
9
9
|
import type { PaginatedSdkFunction } from "../../types/functions";
|
|
10
|
+
import type {
|
|
11
|
+
ZapierActionError,
|
|
12
|
+
ZapierValidationError,
|
|
13
|
+
ZapierConfigurationError,
|
|
14
|
+
ZapierUnknownError,
|
|
15
|
+
} from "../../types/errors";
|
|
10
16
|
|
|
11
17
|
// Pure Zod schema - no resolver metadata!
|
|
12
18
|
export const RunActionSchema = z
|
|
@@ -42,10 +48,10 @@ export interface RunActionPage {
|
|
|
42
48
|
|
|
43
49
|
// Error union for this function
|
|
44
50
|
export type RunActionError =
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
51
|
+
| ZapierActionError
|
|
52
|
+
| ZapierValidationError
|
|
53
|
+
| ZapierConfigurationError
|
|
54
|
+
| ZapierUnknownError;
|
|
49
55
|
|
|
50
56
|
// SDK function interface - ready to be mixed into main SDK interface
|
|
51
57
|
export interface RunActionSdkFunction {
|
package/src/sdk.ts
CHANGED
package/src/types/functions.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApiClient } from "../api/types";
|
|
1
2
|
/**
|
|
2
3
|
* Function-related types and interfaces
|
|
3
4
|
*/
|
|
@@ -11,7 +12,7 @@ export interface FunctionOptions {
|
|
|
11
12
|
/** Function to dynamically resolve authentication token */
|
|
12
13
|
getToken?: () => Promise<string | undefined>;
|
|
13
14
|
/** Optional pre-instantiated API client */
|
|
14
|
-
api?:
|
|
15
|
+
api?: ApiClient;
|
|
15
16
|
/** Enable debug logging */
|
|
16
17
|
debug?: boolean;
|
|
17
18
|
/** Custom fetch implementation */
|
package/src/types/plugin.ts
CHANGED
package/src/types/sdk.ts
CHANGED
|
@@ -32,23 +32,23 @@ import type { RelayRequestSdkFunction } from "../plugins/request/schemas";
|
|
|
32
32
|
import type { LockVersionPluginProvides } from "../plugins/lockVersion";
|
|
33
33
|
|
|
34
34
|
import type { z } from "zod";
|
|
35
|
-
import { RegistryPluginProvides } from "../plugins/registry";
|
|
36
|
-
import { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
37
|
-
import { AppsPluginProvides } from "../plugins/apps";
|
|
38
|
-
import { FetchPluginProvides } from "../plugins/fetch";
|
|
39
|
-
import { ListAppsPluginProvides } from "../plugins/listApps";
|
|
40
|
-
import { GetAppPluginProvides } from "../plugins/getApp";
|
|
41
|
-
import { ListActionsPluginProvides } from "../plugins/listActions";
|
|
42
|
-
import { GetActionPluginProvides } from "../plugins/getAction";
|
|
43
|
-
import { RunActionPluginProvides } from "../plugins/runAction";
|
|
44
|
-
import { ListAuthenticationsPluginProvides } from "../plugins/listAuthentications";
|
|
45
|
-
import { GetAuthenticationPluginProvides } from "../plugins/getAuthentication";
|
|
46
|
-
import { FindFirstAuthenticationPluginProvides } from "../plugins/findFirstAuthentication";
|
|
47
|
-
import { FindUniqueAuthenticationPluginProvides } from "../plugins/findUniqueAuthentication";
|
|
48
|
-
import { ListInputFieldsPluginProvides } from "../plugins/listInputFields";
|
|
49
|
-
import { RequestPluginProvides } from "../plugins/request";
|
|
50
|
-
import { GetSdkType } from "./plugin";
|
|
51
|
-
import { ManifestPluginProvides } from "../plugins/manifest";
|
|
35
|
+
import type { RegistryPluginProvides } from "../plugins/registry";
|
|
36
|
+
import type { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
37
|
+
import type { AppsPluginProvides } from "../plugins/apps";
|
|
38
|
+
import type { FetchPluginProvides } from "../plugins/fetch";
|
|
39
|
+
import type { ListAppsPluginProvides } from "../plugins/listApps";
|
|
40
|
+
import type { GetAppPluginProvides } from "../plugins/getApp";
|
|
41
|
+
import type { ListActionsPluginProvides } from "../plugins/listActions";
|
|
42
|
+
import type { GetActionPluginProvides } from "../plugins/getAction";
|
|
43
|
+
import type { RunActionPluginProvides } from "../plugins/runAction";
|
|
44
|
+
import type { ListAuthenticationsPluginProvides } from "../plugins/listAuthentications";
|
|
45
|
+
import type { GetAuthenticationPluginProvides } from "../plugins/getAuthentication";
|
|
46
|
+
import type { FindFirstAuthenticationPluginProvides } from "../plugins/findFirstAuthentication";
|
|
47
|
+
import type { FindUniqueAuthenticationPluginProvides } from "../plugins/findUniqueAuthentication";
|
|
48
|
+
import type { ListInputFieldsPluginProvides } from "../plugins/listInputFields";
|
|
49
|
+
import type { RequestPluginProvides } from "../plugins/request";
|
|
50
|
+
import type { GetSdkType } from "./plugin";
|
|
51
|
+
import type { ManifestPluginProvides } from "../plugins/manifest";
|
|
52
52
|
|
|
53
53
|
// Plugin interfaces
|
|
54
54
|
// Note: Plugin extension types removed - now using new plugin system
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Generic utility functions for creating paginated SDK functions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { z } from "zod";
|
|
5
|
+
import type { z } from "zod";
|
|
6
6
|
import { ZapierError, ZapierUnknownError } from "../types/errors";
|
|
7
7
|
import { paginate } from "./pagination-utils";
|
|
8
8
|
import { createValidator, validateOptions } from "./validation";
|
package/src/utils/validation.ts
CHANGED