@zapier/zapier-sdk 0.6.4 → 0.8.1
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 +55 -23
- package/dist/api/schemas.d.ts +114 -0
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +45 -0
- package/dist/api/types.d.ts +8 -3
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +173 -9
- package/dist/index.d.mts +516 -442
- package/dist/index.mjs +173 -9
- package/dist/plugins/findFirstAuthentication/index.test.js +3 -3
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +3 -3
- package/dist/plugins/findFirstAuthentication/schemas.js +1 -1
- package/dist/plugins/findUniqueAuthentication/index.test.js +3 -3
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +3 -3
- package/dist/plugins/findUniqueAuthentication/schemas.js +1 -1
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +2 -3
- package/dist/plugins/listAuthentications/index.test.js +5 -5
- package/dist/plugins/listAuthentications/schemas.d.ts +3 -3
- package/dist/plugins/listAuthentications/schemas.js +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts +28 -0
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/index.js +78 -0
- package/dist/plugins/listInputFieldChoices/index.test.d.ts +2 -0
- package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/index.test.js +537 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +61 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/schemas.js +73 -0
- package/dist/plugins/listInputFields/schemas.d.ts +3 -3
- package/dist/plugins/runAction/schemas.d.ts +5 -5
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/sdk.d.ts +7 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +2 -0
- package/dist/types/functions.d.ts +1 -1
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +2 -2
- package/package.json +1 -1
- package/src/api/schemas.ts +62 -0
- package/src/api/types.ts +17 -2
- package/src/plugins/findFirstAuthentication/index.test.ts +3 -3
- package/src/plugins/findFirstAuthentication/schemas.ts +1 -1
- package/src/plugins/findUniqueAuthentication/index.test.ts +3 -3
- package/src/plugins/findUniqueAuthentication/schemas.ts +1 -1
- package/src/plugins/listAuthentications/index.test.ts +5 -5
- package/src/plugins/listAuthentications/index.ts +2 -3
- package/src/plugins/listAuthentications/schemas.ts +1 -1
- package/src/plugins/listInputFieldChoices/index.test.ts +653 -0
- package/src/plugins/listInputFieldChoices/index.ts +152 -0
- package/src/plugins/listInputFieldChoices/schemas.ts +139 -0
- package/src/plugins/runAction/schemas.ts +2 -2
- package/src/sdk.ts +2 -0
- package/src/types/functions.ts +1 -1
- package/src/types/properties.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,7 +6,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
6
6
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
7
7
|
actionKey: z.ZodString;
|
|
8
8
|
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
9
|
-
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
9
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
10
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -14,7 +14,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
14
14
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
15
15
|
actionKey: string;
|
|
16
16
|
authenticationId?: number | null | undefined;
|
|
17
|
-
inputs?: Record<string,
|
|
17
|
+
inputs?: Record<string, unknown> | undefined;
|
|
18
18
|
pageSize?: number | undefined;
|
|
19
19
|
maxItems?: number | undefined;
|
|
20
20
|
}, {
|
|
@@ -22,7 +22,7 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
22
22
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
23
23
|
actionKey: string;
|
|
24
24
|
authenticationId?: number | null | undefined;
|
|
25
|
-
inputs?: Record<string,
|
|
25
|
+
inputs?: Record<string, unknown> | undefined;
|
|
26
26
|
pageSize?: number | undefined;
|
|
27
27
|
maxItems?: number | undefined;
|
|
28
28
|
}>;
|
|
@@ -5,7 +5,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
5
5
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
6
6
|
actionKey: z.ZodString;
|
|
7
7
|
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
8
|
-
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.
|
|
8
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
9
9
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -13,7 +13,7 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
13
13
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
14
14
|
actionKey: string;
|
|
15
15
|
authenticationId?: number | null | undefined;
|
|
16
|
-
inputs?: Record<string,
|
|
16
|
+
inputs?: Record<string, unknown> | undefined;
|
|
17
17
|
pageSize?: number | undefined;
|
|
18
18
|
maxItems?: number | undefined;
|
|
19
19
|
}, {
|
|
@@ -21,17 +21,17 @@ export declare const RunActionSchema: z.ZodObject<{
|
|
|
21
21
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
22
22
|
actionKey: string;
|
|
23
23
|
authenticationId?: number | null | undefined;
|
|
24
|
-
inputs?: Record<string,
|
|
24
|
+
inputs?: Record<string, unknown> | undefined;
|
|
25
25
|
pageSize?: number | undefined;
|
|
26
26
|
maxItems?: number | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
export type RunActionOptions = z.infer<typeof RunActionSchema>;
|
|
29
29
|
export interface RunActionPage {
|
|
30
|
-
data:
|
|
30
|
+
data: unknown[];
|
|
31
31
|
nextCursor?: string;
|
|
32
32
|
}
|
|
33
33
|
export type RunActionError = import("../../types/errors").ZapierActionError | import("../../types/errors").ZapierValidationError | import("../../types/errors").ZapierConfigurationError | import("../../types/errors").ZapierUnknownError;
|
|
34
34
|
export interface RunActionSdkFunction {
|
|
35
|
-
runAction: PaginatedSdkFunction<RunActionOptions,
|
|
35
|
+
runAction: PaginatedSdkFunction<RunActionOptions, unknown>;
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -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;AAGlE,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,
|
|
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;AAGlE,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,OAAO,oBAAoB,EAAE,iBAAiB,GAC9C,OAAO,oBAAoB,EAAE,qBAAqB,GAClD,OAAO,oBAAoB,EAAE,wBAAwB,GACrD,OAAO,oBAAoB,EAAE,kBAAkB,CAAC;AAGpD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,oBAAoB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CAC5D"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
|
6
6
|
export declare function createSdk<TCurrentSdk = {}, TCurrentContext = {
|
|
7
7
|
meta: Record<string, PluginMeta>;
|
|
8
8
|
}>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
|
|
9
|
-
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<import("./types/plugin").ExtractSdkProperties<import(".").ApiPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListAppsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ManifestPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetAppPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListActionsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetActionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").RunActionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").LockVersionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").RequestPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FetchPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").AppsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
|
|
9
|
+
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<import("./types/plugin").ExtractSdkProperties<import(".").ApiPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListAppsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ManifestPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetAppPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListActionsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetActionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListInputFieldsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").RunActionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").LockVersionPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").ListAuthenticationsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FindFirstAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FindUniqueAuthenticationPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").RequestPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").FetchPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").AppsPluginProvides> & import("./types/plugin").ExtractSdkProperties<import(".").GetProfilePluginProvides>, {
|
|
10
10
|
meta: Record<string, PluginMeta>;
|
|
11
11
|
} & {
|
|
12
12
|
api: import("./api").ApiClient;
|
|
@@ -44,6 +44,12 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
|
|
|
44
44
|
inputSchema: typeof import("./plugins/listInputFields/schemas").ListInputFieldsSchema;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
+
} & {
|
|
48
|
+
meta: {
|
|
49
|
+
listInputFieldChoices: {
|
|
50
|
+
inputSchema: typeof import("./plugins/listInputFieldChoices/schemas").ListInputFieldChoicesSchema;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
47
53
|
} & {
|
|
48
54
|
meta: {
|
|
49
55
|
runAction: {
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EAIH,UAAU,EACX,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EAIH,UAAU,EACX,MAAM,gBAAgB,CAAC;AA0BxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,EAEtD,OAAO,GAAE,gBAAqB,EAC9B,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD,GAChE,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,CAqEnC;AAED,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;UA5EjD,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHrD;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
|
package/dist/sdk.js
CHANGED
|
@@ -14,6 +14,7 @@ import { getAuthenticationPlugin } from "./plugins/getAuthentication";
|
|
|
14
14
|
import { findFirstAuthenticationPlugin } from "./plugins/findFirstAuthentication";
|
|
15
15
|
import { findUniqueAuthenticationPlugin } from "./plugins/findUniqueAuthentication";
|
|
16
16
|
import { listInputFieldsPlugin } from "./plugins/listInputFields";
|
|
17
|
+
import { listInputFieldChoicesPlugin } from "./plugins/listInputFieldChoices";
|
|
17
18
|
import { requestPlugin } from "./plugins/request";
|
|
18
19
|
import { manifestPlugin } from "./plugins/manifest";
|
|
19
20
|
import { lockVersionPlugin } from "./plugins/lockVersion";
|
|
@@ -84,6 +85,7 @@ export function createZapierSdkWithoutRegistry(options = {}) {
|
|
|
84
85
|
.addPlugin(listActionsPlugin)
|
|
85
86
|
.addPlugin(getActionPlugin)
|
|
86
87
|
.addPlugin(listInputFieldsPlugin)
|
|
88
|
+
.addPlugin(listInputFieldChoicesPlugin)
|
|
87
89
|
// Run action
|
|
88
90
|
.addPlugin(runActionPlugin)
|
|
89
91
|
// Version locking
|
|
@@ -9,7 +9,7 @@ export interface FunctionOptions {
|
|
|
9
9
|
/** Function to dynamically resolve authentication token */
|
|
10
10
|
getToken?: () => Promise<string | undefined>;
|
|
11
11
|
/** Optional pre-instantiated API client */
|
|
12
|
-
api?:
|
|
12
|
+
api?: import("../api/types").ApiClient;
|
|
13
13
|
/** Enable debug logging */
|
|
14
14
|
debug?: boolean;
|
|
15
15
|
/** Custom fetch implementation */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,2CAA2C;IAC3C,GAAG,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,2CAA2C;IAC3C,GAAG,CAAC,EAAE,OAAO,cAAc,EAAE,SAAS,CAAC;IACvC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAGD,MAAM,MAAM,oBAAoB,CAAC,QAAQ,EAAE,KAAK,IAAI,CAClD,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC,GAC7B,aAAa,CAAC;IAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IACtD,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B,CAAC"}
|
|
@@ -3,12 +3,12 @@ export declare const AppKeyPropertySchema: z.ZodString;
|
|
|
3
3
|
export declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
4
4
|
export declare const ActionKeyPropertySchema: z.ZodString;
|
|
5
5
|
export declare const AuthenticationIdPropertySchema: z.ZodNumber;
|
|
6
|
-
export declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.
|
|
6
|
+
export declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
7
7
|
export declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
8
8
|
export declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
|
|
9
9
|
export declare const OutputPropertySchema: z.ZodString;
|
|
10
10
|
export declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
-
export declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.
|
|
11
|
+
export declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
12
12
|
export type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
|
|
13
13
|
export type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
|
|
14
14
|
export type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB,aAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,6GAW4B,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAGA,CAAC;AAErC,eAAO,MAAM,8BAA8B,aAGY,CAAC;AAExD,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/types/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,oBAAoB,aAEhC,CAAC;AAEF,eAAO,MAAM,wBAAwB,6GAW4B,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAGA,CAAC;AAErC,eAAO,MAAM,8BAA8B,aAGY,CAAC;AAExD,eAAO,MAAM,oBAAoB,wCAEa,CAAC;AAE/C,eAAO,MAAM,mBAAmB,2BAMgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,2BAKoB,CAAC;AAEtD,eAAO,MAAM,oBAAoB,aAA0C,CAAC;AAE5E,eAAO,MAAM,mBAAmB,4BAGG,CAAC;AAEpC,eAAO,MAAM,oBAAoB,wCAEG,CAAC;AAGrC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/types/properties.js
CHANGED
|
@@ -25,7 +25,7 @@ export const AuthenticationIdPropertySchema = z
|
|
|
25
25
|
.int()
|
|
26
26
|
.describe("Authentication ID to use for this action");
|
|
27
27
|
export const InputsPropertySchema = z
|
|
28
|
-
.record(z.
|
|
28
|
+
.record(z.unknown())
|
|
29
29
|
.describe("Input parameters for the action");
|
|
30
30
|
export const LimitPropertySchema = z
|
|
31
31
|
.number()
|
|
@@ -46,5 +46,5 @@ export const DebugPropertySchema = z
|
|
|
46
46
|
.default(false)
|
|
47
47
|
.describe("Enable debug logging");
|
|
48
48
|
export const ParamsPropertySchema = z
|
|
49
|
-
.record(z.
|
|
49
|
+
.record(z.unknown())
|
|
50
50
|
.describe("Additional parameters");
|
package/package.json
CHANGED
package/src/api/schemas.ts
CHANGED
|
@@ -385,3 +385,65 @@ export const ImplementationsMetaResponseSchema = z.object({
|
|
|
385
385
|
previous: z.string().nullable().optional(),
|
|
386
386
|
results: z.array(ImplementationMetaSchema),
|
|
387
387
|
});
|
|
388
|
+
|
|
389
|
+
// ============================================================================
|
|
390
|
+
// Need Choices Schemas (for listInputFieldChoices functionality)
|
|
391
|
+
// ============================================================================
|
|
392
|
+
|
|
393
|
+
export const NeedChoicesResponseMetaSchema = z.object({
|
|
394
|
+
page: z.string().nullable().optional(),
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
export const NeedChoicesResponseLinksSchema = z.object({
|
|
398
|
+
next: z.string().nullable().optional(),
|
|
399
|
+
prev: z.string().nullable().optional(),
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
export const NeedChoicesRequestSchema = z.object({
|
|
403
|
+
selected_api: z
|
|
404
|
+
.string()
|
|
405
|
+
.optional()
|
|
406
|
+
.describe(
|
|
407
|
+
"Something like `SlackAPI` (for Python apps) or `SplitwiseCLIAPI@1.0.0` (for CLI apps). Non-public apps are fine as long as the authed user can access them.",
|
|
408
|
+
),
|
|
409
|
+
authentication_id: z
|
|
410
|
+
.number()
|
|
411
|
+
.optional()
|
|
412
|
+
.describe(
|
|
413
|
+
"If the app needs auth, provide an `authentication_id` that has the `selected_api` of the app you want to run. Can be any auth visible to the user (including shared).",
|
|
414
|
+
),
|
|
415
|
+
params: z
|
|
416
|
+
.record(z.any())
|
|
417
|
+
.optional()
|
|
418
|
+
.describe(
|
|
419
|
+
"Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action.",
|
|
420
|
+
),
|
|
421
|
+
page: z.number().optional().default(0),
|
|
422
|
+
prefill: z
|
|
423
|
+
.string()
|
|
424
|
+
.optional()
|
|
425
|
+
.describe(
|
|
426
|
+
"The prefill string to indicate what we're fetching choices for. Likely something like `spreadsheet.id.title`. Must be provided alongside `selected_api` if both `action_id` and `input_field_id` are not.",
|
|
427
|
+
),
|
|
428
|
+
action_id: z
|
|
429
|
+
.string()
|
|
430
|
+
.optional()
|
|
431
|
+
.describe(
|
|
432
|
+
"The id that will be used to lookup the Action for prefill lookup. If provided, `input_field_id` is required, else `prefill` must be provided.",
|
|
433
|
+
),
|
|
434
|
+
input_field_id: z
|
|
435
|
+
.string()
|
|
436
|
+
.optional()
|
|
437
|
+
.describe(
|
|
438
|
+
"The id (key) of the input field (Need) that dynamic choices are being retrieved for. If provided, `action_id` is required, else `prefill` must be provided.",
|
|
439
|
+
),
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
export const NeedChoicesResponseSchema = z.object({
|
|
443
|
+
success: z.boolean(),
|
|
444
|
+
choices: z.array(NeedChoicesSchema).optional(),
|
|
445
|
+
next_page: z.number().optional(),
|
|
446
|
+
errors: z.array(z.string()).optional(),
|
|
447
|
+
meta: NeedChoicesResponseMetaSchema.optional(),
|
|
448
|
+
links: NeedChoicesResponseLinksSchema.optional(),
|
|
449
|
+
});
|
package/src/api/types.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* to ensure a single source of truth and eliminate duplication.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import type { SdkEvent } from "../types/events";
|
|
12
13
|
import { z } from "zod";
|
|
13
14
|
import {
|
|
14
15
|
NeedChoicesSchema,
|
|
@@ -33,6 +34,10 @@ import {
|
|
|
33
34
|
ImplementationsMetaResponseSchema,
|
|
34
35
|
ServiceSchema,
|
|
35
36
|
ServicesResponseSchema,
|
|
37
|
+
NeedChoicesRequestSchema,
|
|
38
|
+
NeedChoicesResponseSchema,
|
|
39
|
+
NeedChoicesResponseMetaSchema,
|
|
40
|
+
NeedChoicesResponseLinksSchema,
|
|
36
41
|
} from "./schemas";
|
|
37
42
|
|
|
38
43
|
// ============================================================================
|
|
@@ -45,7 +50,7 @@ export interface ApiClientOptions {
|
|
|
45
50
|
getToken?: () => Promise<string | undefined>;
|
|
46
51
|
debug?: boolean;
|
|
47
52
|
fetch?: typeof globalThis.fetch;
|
|
48
|
-
onEvent?: (event:
|
|
53
|
+
onEvent?: (event: SdkEvent) => void;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
export interface ApiClient {
|
|
@@ -92,7 +97,7 @@ export interface PollOptions extends RequestOptions {
|
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
export interface DebugLogger {
|
|
95
|
-
(message: string, data?:
|
|
100
|
+
(message: string, data?: unknown): void;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
// ============================================================================
|
|
@@ -136,3 +141,13 @@ export type ImplementationMeta = z.infer<typeof ImplementationMetaSchema>;
|
|
|
136
141
|
export type ImplementationsMetaResponse = z.infer<
|
|
137
142
|
typeof ImplementationsMetaResponseSchema
|
|
138
143
|
>;
|
|
144
|
+
|
|
145
|
+
// Need Choices types (for listInputFieldChoices functionality)
|
|
146
|
+
export type NeedChoicesRequest = z.infer<typeof NeedChoicesRequestSchema>;
|
|
147
|
+
export type NeedChoicesResponse = z.infer<typeof NeedChoicesResponseSchema>;
|
|
148
|
+
export type NeedChoicesResponseMeta = z.infer<
|
|
149
|
+
typeof NeedChoicesResponseMetaSchema
|
|
150
|
+
>;
|
|
151
|
+
export type NeedChoicesResponseLinks = z.infer<
|
|
152
|
+
typeof NeedChoicesResponseLinksSchema
|
|
153
|
+
>;
|
|
@@ -97,7 +97,7 @@ describe("findFirstAuthentication plugin", () => {
|
|
|
97
97
|
await expect(
|
|
98
98
|
sdk.findFirstAuthentication({
|
|
99
99
|
title: 123 as any,
|
|
100
|
-
|
|
100
|
+
accountId: 456 as any,
|
|
101
101
|
owner: true as any,
|
|
102
102
|
}),
|
|
103
103
|
).rejects.toThrow(ZapierValidationError);
|
|
@@ -109,7 +109,7 @@ describe("findFirstAuthentication plugin", () => {
|
|
|
109
109
|
appKey: "slack",
|
|
110
110
|
search: "workspace",
|
|
111
111
|
title: "My Slack Workspace",
|
|
112
|
-
|
|
112
|
+
accountId: "acc_123",
|
|
113
113
|
owner: "me",
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -167,7 +167,7 @@ describe("findFirstAuthentication plugin", () => {
|
|
|
167
167
|
appKey: "slack",
|
|
168
168
|
search: "workspace",
|
|
169
169
|
title: "My Slack Workspace",
|
|
170
|
-
|
|
170
|
+
accountId: "acc_123",
|
|
171
171
|
owner: "me",
|
|
172
172
|
};
|
|
173
173
|
|
|
@@ -16,7 +16,7 @@ export const FindFirstAuthenticationSchema = z
|
|
|
16
16
|
.string()
|
|
17
17
|
.optional()
|
|
18
18
|
.describe("Filter authentications by exact title match"),
|
|
19
|
-
|
|
19
|
+
accountId: z.string().optional().describe("Filter by account ID"),
|
|
20
20
|
owner: z.string().optional().describe("Filter by owner"),
|
|
21
21
|
})
|
|
22
22
|
.describe("Find the first authentication matching the criteria");
|
|
@@ -88,7 +88,7 @@ describe("findUniqueAuthentication plugin", () => {
|
|
|
88
88
|
sdk.findUniqueAuthentication({
|
|
89
89
|
search: 123 as any,
|
|
90
90
|
title: 456 as any,
|
|
91
|
-
|
|
91
|
+
accountId: 789 as any,
|
|
92
92
|
owner: false as any,
|
|
93
93
|
}),
|
|
94
94
|
).rejects.toThrow(ZapierValidationError);
|
|
@@ -100,7 +100,7 @@ describe("findUniqueAuthentication plugin", () => {
|
|
|
100
100
|
appKey: "slack",
|
|
101
101
|
search: "Workspace",
|
|
102
102
|
title: "My Slack",
|
|
103
|
-
|
|
103
|
+
accountId: "acc_123",
|
|
104
104
|
owner: "me",
|
|
105
105
|
});
|
|
106
106
|
|
|
@@ -172,7 +172,7 @@ describe("findUniqueAuthentication plugin", () => {
|
|
|
172
172
|
appKey: "slack",
|
|
173
173
|
search: "workspace",
|
|
174
174
|
title: "My Slack Workspace",
|
|
175
|
-
|
|
175
|
+
accountId: "acc_123",
|
|
176
176
|
owner: "me",
|
|
177
177
|
};
|
|
178
178
|
|
|
@@ -16,7 +16,7 @@ export const FindUniqueAuthenticationSchema = z
|
|
|
16
16
|
.string()
|
|
17
17
|
.optional()
|
|
18
18
|
.describe("Filter authentications by exact title match"),
|
|
19
|
-
|
|
19
|
+
accountId: z.string().optional().describe("Filter by account ID"),
|
|
20
20
|
owner: z.string().optional().describe("Filter by owner"),
|
|
21
21
|
})
|
|
22
22
|
.describe("Find a unique authentication matching the criteria");
|
|
@@ -134,11 +134,11 @@ describe("listAuthentications plugin", () => {
|
|
|
134
134
|
}).toThrow(ZapierValidationError);
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
it("should throw validation error for invalid
|
|
137
|
+
it("should throw validation error for invalid accountId type", () => {
|
|
138
138
|
const sdk = createTestSdk();
|
|
139
139
|
expect(() => {
|
|
140
140
|
sdk.listAuthentications({
|
|
141
|
-
|
|
141
|
+
accountId: 123 as any,
|
|
142
142
|
});
|
|
143
143
|
}).toThrow(ZapierValidationError);
|
|
144
144
|
});
|
|
@@ -188,7 +188,7 @@ describe("listAuthentications plugin", () => {
|
|
|
188
188
|
appKey: "slack",
|
|
189
189
|
search: "workspace",
|
|
190
190
|
title: "My Slack Workspace",
|
|
191
|
-
|
|
191
|
+
accountId: "acc_123",
|
|
192
192
|
owner: "me",
|
|
193
193
|
pageSize: 10,
|
|
194
194
|
maxItems: 50,
|
|
@@ -309,9 +309,9 @@ describe("listAuthentications plugin", () => {
|
|
|
309
309
|
);
|
|
310
310
|
});
|
|
311
311
|
|
|
312
|
-
it("should pass
|
|
312
|
+
it("should pass accountId filter to API", async () => {
|
|
313
313
|
const sdk = createTestSdk();
|
|
314
|
-
await sdk.listAuthentications({
|
|
314
|
+
await sdk.listAuthentications({ accountId: "acc_123" });
|
|
315
315
|
|
|
316
316
|
expect(mockApiClient.get).toHaveBeenCalledWith(
|
|
317
317
|
"/api/v4/authentications/",
|
|
@@ -71,8 +71,8 @@ export const listAuthenticationsPlugin: Plugin<
|
|
|
71
71
|
} else if (options.title) {
|
|
72
72
|
searchParams.search = options.title;
|
|
73
73
|
}
|
|
74
|
-
if (options.
|
|
75
|
-
searchParams.account_id = options.
|
|
74
|
+
if (options.accountId) {
|
|
75
|
+
searchParams.account_id = options.accountId;
|
|
76
76
|
}
|
|
77
77
|
if (options.owner) {
|
|
78
78
|
searchParams.owner = options.owner;
|
|
@@ -83,7 +83,6 @@ export const listAuthenticationsPlugin: Plugin<
|
|
|
83
83
|
// Convert cursor back to offset for the API
|
|
84
84
|
searchParams.offset = options.cursor;
|
|
85
85
|
}
|
|
86
|
-
console.log({ searchParams });
|
|
87
86
|
const data: AuthenticationsResponse = await api.get(
|
|
88
87
|
"/api/v4/authentications/",
|
|
89
88
|
{
|
|
@@ -17,7 +17,7 @@ export const ListAuthenticationsSchema = z
|
|
|
17
17
|
.string()
|
|
18
18
|
.optional()
|
|
19
19
|
.describe("Filter authentications by exact title match"),
|
|
20
|
-
|
|
20
|
+
accountId: z.string().optional().describe("Filter by account ID"),
|
|
21
21
|
owner: z.string().optional().describe("Filter by owner"),
|
|
22
22
|
pageSize: z
|
|
23
23
|
.number()
|