@zapier/zapier-sdk 0.6.3 → 0.8.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 +73 -41
- 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 +5 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +2208 -2022
- package/dist/index.d.mts +327 -10
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.mjs +2191 -2024
- 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/getProfile/index.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/registry/index.js +3 -3
- package/dist/sdk.d.ts +93 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +7 -2
- package/package.json +1 -1
- package/src/api/schemas.ts +62 -0
- package/src/api/types.ts +14 -0
- package/src/index.ts +25 -1
- 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/getProfile/index.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/registry/index.ts +3 -3
- package/src/sdk.ts +8 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
export const registryPlugin = ({ sdk, context }) => {
|
|
3
3
|
const metaKeys = Object.keys(context.meta || {});
|
|
4
4
|
const categoryDefinitions = {
|
|
5
|
+
account: {
|
|
6
|
+
title: "Account",
|
|
7
|
+
},
|
|
5
8
|
app: {
|
|
6
9
|
title: "App",
|
|
7
10
|
titlePlural: "Apps",
|
|
@@ -15,9 +18,6 @@ export const registryPlugin = ({ sdk, context }) => {
|
|
|
15
18
|
http: {
|
|
16
19
|
title: "HTTP Request",
|
|
17
20
|
},
|
|
18
|
-
user: {
|
|
19
|
-
title: "User",
|
|
20
|
-
},
|
|
21
21
|
utility: {
|
|
22
22
|
title: "Utility",
|
|
23
23
|
titlePlural: "Utilities",
|
package/dist/sdk.d.ts
CHANGED
|
@@ -6,5 +6,98 @@ 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("./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
|
+
meta: Record<string, PluginMeta>;
|
|
11
|
+
} & {
|
|
12
|
+
api: import("./api").ApiClient;
|
|
13
|
+
} & {
|
|
14
|
+
meta: {
|
|
15
|
+
listApps: {
|
|
16
|
+
inputSchema: typeof import("./plugins/listApps/schemas").ListAppsSchema;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
} & {
|
|
20
|
+
getVersionedImplementationId: import("./plugins/manifest/schemas").GetVersionedImplementationId;
|
|
21
|
+
getManifestEntry: import("./plugins/manifest/schemas").GetManifestEntry;
|
|
22
|
+
getImplementation: import("./plugins/manifest/schemas").GetImplementation;
|
|
23
|
+
} & {
|
|
24
|
+
meta: {
|
|
25
|
+
getApp: {
|
|
26
|
+
inputSchema: typeof import("./plugins/getApp/schemas").GetAppSchema;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} & {
|
|
30
|
+
meta: {
|
|
31
|
+
listActions: {
|
|
32
|
+
inputSchema: typeof import("./plugins/listActions/schemas").ListActionsSchema;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
} & {
|
|
36
|
+
meta: {
|
|
37
|
+
getAction: {
|
|
38
|
+
inputSchema: typeof import("./plugins/getAction/schemas").GetActionSchema;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
} & {
|
|
42
|
+
meta: {
|
|
43
|
+
listInputFields: {
|
|
44
|
+
inputSchema: typeof import("./plugins/listInputFields/schemas").ListInputFieldsSchema;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
} & {
|
|
48
|
+
meta: {
|
|
49
|
+
listInputFieldChoices: {
|
|
50
|
+
inputSchema: typeof import("./plugins/listInputFieldChoices/schemas").ListInputFieldChoicesSchema;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} & {
|
|
54
|
+
meta: {
|
|
55
|
+
runAction: {
|
|
56
|
+
inputSchema: typeof import("./plugins/runAction/schemas").RunActionSchema;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
} & {
|
|
60
|
+
meta: {
|
|
61
|
+
lockVersion: {
|
|
62
|
+
inputSchema: typeof import("./plugins/lockVersion/schemas").LockVersionSchema;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
} & {
|
|
66
|
+
meta: {
|
|
67
|
+
listAuthentications: {
|
|
68
|
+
inputSchema: typeof import("./plugins/listAuthentications/schemas").ListAuthenticationsSchema;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
} & {
|
|
72
|
+
meta: {
|
|
73
|
+
getAuthentication: {
|
|
74
|
+
inputSchema: typeof import("./plugins/getAuthentication/schemas").GetAuthenticationSchema;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
} & {
|
|
78
|
+
meta: {
|
|
79
|
+
findFirstAuthentication: {
|
|
80
|
+
inputSchema: typeof import("./plugins/findFirstAuthentication/schemas").FindFirstAuthenticationSchema;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
} & {
|
|
84
|
+
meta: {
|
|
85
|
+
findUniqueAuthentication: {
|
|
86
|
+
inputSchema: typeof import("./plugins/findUniqueAuthentication/schemas").FindUniqueAuthenticationSchema;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
} & {
|
|
90
|
+
meta: {
|
|
91
|
+
request: {
|
|
92
|
+
inputSchema: typeof import(".").RelayRequestSchema;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
} & {
|
|
96
|
+
meta: {
|
|
97
|
+
getProfile: {
|
|
98
|
+
inputSchema: typeof import("./plugins/getProfile/schemas").GetProfileSchema;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}>;
|
|
9
102
|
export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
10
103
|
//# sourceMappingURL=sdk.d.ts.map
|
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";
|
|
@@ -72,7 +73,7 @@ export function createSdk(options = {}, initialSdk = {}, initialContext = { meta
|
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
export function
|
|
76
|
+
export function createZapierSdkWithoutRegistry(options = {}) {
|
|
76
77
|
return (createSdk(options)
|
|
77
78
|
// Provides the API client in context
|
|
78
79
|
.addPlugin(apiPlugin)
|
|
@@ -84,6 +85,7 @@ export function createZapierSdk(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
|
|
@@ -99,7 +101,10 @@ export function createZapierSdk(options = {}) {
|
|
|
99
101
|
// Magic apps plugin
|
|
100
102
|
.addPlugin(appsPlugin)
|
|
101
103
|
// Profile
|
|
102
|
-
.addPlugin(getProfilePlugin)
|
|
104
|
+
.addPlugin(getProfilePlugin));
|
|
105
|
+
}
|
|
106
|
+
export function createZapierSdk(options = {}) {
|
|
107
|
+
return (createZapierSdkWithoutRegistry(options)
|
|
103
108
|
// Register plugins for CLI/MCP metadata
|
|
104
109
|
.addPlugin(registryPlugin));
|
|
105
110
|
}
|
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
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
ImplementationsMetaResponseSchema,
|
|
34
34
|
ServiceSchema,
|
|
35
35
|
ServicesResponseSchema,
|
|
36
|
+
NeedChoicesRequestSchema,
|
|
37
|
+
NeedChoicesResponseSchema,
|
|
38
|
+
NeedChoicesResponseMetaSchema,
|
|
39
|
+
NeedChoicesResponseLinksSchema,
|
|
36
40
|
} from "./schemas";
|
|
37
41
|
|
|
38
42
|
// ============================================================================
|
|
@@ -136,3 +140,13 @@ export type ImplementationMeta = z.infer<typeof ImplementationMetaSchema>;
|
|
|
136
140
|
export type ImplementationsMetaResponse = z.infer<
|
|
137
141
|
typeof ImplementationsMetaResponseSchema
|
|
138
142
|
>;
|
|
143
|
+
|
|
144
|
+
// Need Choices types (for listInputFieldChoices functionality)
|
|
145
|
+
export type NeedChoicesRequest = z.infer<typeof NeedChoicesRequestSchema>;
|
|
146
|
+
export type NeedChoicesResponse = z.infer<typeof NeedChoicesResponseSchema>;
|
|
147
|
+
export type NeedChoicesResponseMeta = z.infer<
|
|
148
|
+
typeof NeedChoicesResponseMetaSchema
|
|
149
|
+
>;
|
|
150
|
+
export type NeedChoicesResponseLinks = z.infer<
|
|
151
|
+
typeof NeedChoicesResponseLinksSchema
|
|
152
|
+
>;
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,21 @@ export * from "./types/properties";
|
|
|
5
5
|
export * from "./types/errors";
|
|
6
6
|
export * from "./plugins/apps";
|
|
7
7
|
export * from "./plugins/fetch";
|
|
8
|
+
export * from "./plugins/listApps";
|
|
9
|
+
export * from "./plugins/listActions";
|
|
10
|
+
export * from "./plugins/listInputFields";
|
|
11
|
+
export * from "./plugins/listAuthentications";
|
|
12
|
+
export * from "./plugins/getApp";
|
|
13
|
+
export * from "./plugins/getAction";
|
|
14
|
+
export * from "./plugins/getAuthentication";
|
|
15
|
+
export * from "./plugins/findFirstAuthentication";
|
|
16
|
+
export * from "./plugins/findUniqueAuthentication";
|
|
17
|
+
export * from "./plugins/runAction";
|
|
18
|
+
export * from "./plugins/request";
|
|
19
|
+
export * from "./plugins/manifest";
|
|
20
|
+
export * from "./plugins/lockVersion";
|
|
21
|
+
export * from "./plugins/getProfile";
|
|
22
|
+
export * from "./plugins/api";
|
|
8
23
|
|
|
9
24
|
// Export API types directly (no longer re-exported from domain)
|
|
10
25
|
export type {
|
|
@@ -26,6 +41,7 @@ export type {
|
|
|
26
41
|
// Export schema utilities for CLI
|
|
27
42
|
export { isPositional } from "./utils/schema-utils";
|
|
28
43
|
export { hasResolver } from "./resolvers";
|
|
44
|
+
export { createFunction } from "./utils/function-utils";
|
|
29
45
|
|
|
30
46
|
// Export auth utilities for CLI use
|
|
31
47
|
export * from "./auth";
|
|
@@ -41,7 +57,12 @@ export {
|
|
|
41
57
|
} from "./plugins/request/schemas";
|
|
42
58
|
|
|
43
59
|
// Export the main combined SDK and new flexible SDK creator
|
|
44
|
-
export {
|
|
60
|
+
export {
|
|
61
|
+
createZapierSdk,
|
|
62
|
+
createZapierSdkWithoutRegistry,
|
|
63
|
+
createSdk,
|
|
64
|
+
ZapierSdkOptions,
|
|
65
|
+
} from "./sdk";
|
|
45
66
|
|
|
46
67
|
// Export SDK types from types (not sdk.ts to avoid circular imports)
|
|
47
68
|
export type { FunctionRegistryEntry } from "./types/sdk";
|
|
@@ -56,5 +77,8 @@ export type {
|
|
|
56
77
|
Sdk,
|
|
57
78
|
} from "./types/plugin";
|
|
58
79
|
|
|
80
|
+
// Export registry plugin for manual use
|
|
81
|
+
export { registryPlugin } from "./plugins/registry";
|
|
82
|
+
|
|
59
83
|
// Export ZapierSdk from sdk.ts (it's now ReturnType<typeof createZapierSdk>)
|
|
60
84
|
export type { ZapierSdk } from "./types/sdk";
|
|
@@ -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()
|