@zapier/zapier-sdk 0.3.1 → 0.4.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.
Files changed (162) hide show
  1. package/dist/index.cjs +1962 -0
  2. package/dist/index.d.mts +892 -0
  3. package/dist/index.d.ts +892 -20
  4. package/dist/index.mjs +1914 -0
  5. package/package.json +19 -7
  6. package/src/api/client.ts +106 -25
  7. package/src/api/polling.ts +4 -8
  8. package/src/api/types.ts +8 -1
  9. package/src/auth.ts +19 -287
  10. package/src/functions/findFirstAuthentication/schemas.ts +3 -13
  11. package/src/functions/findUniqueAuthentication/schemas.ts +3 -13
  12. package/src/functions/generateTypes/index.ts +15 -0
  13. package/src/functions/generateTypes/schemas.ts +3 -10
  14. package/src/functions/getAction/schemas.ts +3 -13
  15. package/src/functions/getApp/schemas.ts +2 -13
  16. package/src/functions/getAuthentication/index.ts +0 -1
  17. package/src/functions/getAuthentication/schemas.ts +3 -17
  18. package/src/functions/listActions/schemas.ts +3 -13
  19. package/src/functions/listApps/schemas.ts +2 -13
  20. package/src/functions/listAuthentications/index.ts +0 -1
  21. package/src/functions/listAuthentications/schemas.ts +3 -15
  22. package/src/functions/listFields/schemas.ts +3 -13
  23. package/src/functions/request/index.ts +150 -0
  24. package/src/functions/request/info.ts +11 -0
  25. package/src/functions/request/schemas.ts +53 -0
  26. package/src/functions/runAction/index.ts +0 -1
  27. package/src/functions/runAction/schemas.ts +6 -15
  28. package/src/index.ts +8 -2
  29. package/src/plugins/apps/index.ts +34 -9
  30. package/src/plugins/apps/types.ts +17 -1
  31. package/src/plugins/fetch/index.ts +50 -0
  32. package/src/plugins/fetch/types.ts +2 -0
  33. package/src/sdk.ts +19 -23
  34. package/src/types/domain.ts +16 -0
  35. package/src/types/sdk.ts +17 -2
  36. package/tsconfig.json +2 -2
  37. package/tsup.config.ts +21 -0
  38. package/dist/api/auth.d.ts +0 -8
  39. package/dist/api/auth.js +0 -29
  40. package/dist/api/client.d.ts +0 -8
  41. package/dist/api/client.js +0 -119
  42. package/dist/api/debug.d.ts +0 -12
  43. package/dist/api/debug.js +0 -50
  44. package/dist/api/index.d.ts +0 -28
  45. package/dist/api/index.js +0 -52
  46. package/dist/api/polling.d.ts +0 -17
  47. package/dist/api/polling.js +0 -34
  48. package/dist/api/types.d.ts +0 -147
  49. package/dist/api/types.js +0 -9
  50. package/dist/auth.d.ts +0 -59
  51. package/dist/auth.js +0 -261
  52. package/dist/functions/bundleCode/index.d.ts +0 -11
  53. package/dist/functions/bundleCode/index.js +0 -91
  54. package/dist/functions/bundleCode/info.d.ts +0 -27
  55. package/dist/functions/bundleCode/info.js +0 -11
  56. package/dist/functions/bundleCode/schemas.d.ts +0 -27
  57. package/dist/functions/bundleCode/schemas.js +0 -22
  58. package/dist/functions/findFirstAuthentication/index.d.ts +0 -12
  59. package/dist/functions/findFirstAuthentication/index.js +0 -21
  60. package/dist/functions/findFirstAuthentication/info.d.ts +0 -30
  61. package/dist/functions/findFirstAuthentication/info.js +0 -11
  62. package/dist/functions/findFirstAuthentication/schemas.d.ts +0 -42
  63. package/dist/functions/findFirstAuthentication/schemas.js +0 -25
  64. package/dist/functions/findUniqueAuthentication/index.d.ts +0 -13
  65. package/dist/functions/findUniqueAuthentication/index.js +0 -28
  66. package/dist/functions/findUniqueAuthentication/info.d.ts +0 -30
  67. package/dist/functions/findUniqueAuthentication/info.js +0 -11
  68. package/dist/functions/findUniqueAuthentication/schemas.d.ts +0 -42
  69. package/dist/functions/findUniqueAuthentication/schemas.js +0 -25
  70. package/dist/functions/generateTypes/index.d.ts +0 -11
  71. package/dist/functions/generateTypes/index.js +0 -305
  72. package/dist/functions/generateTypes/info.d.ts +0 -21
  73. package/dist/functions/generateTypes/info.js +0 -11
  74. package/dist/functions/generateTypes/schemas.d.ts +0 -30
  75. package/dist/functions/generateTypes/schemas.js +0 -14
  76. package/dist/functions/getAction/index.d.ts +0 -12
  77. package/dist/functions/getAction/index.js +0 -26
  78. package/dist/functions/getAction/info.d.ts +0 -18
  79. package/dist/functions/getAction/info.js +0 -11
  80. package/dist/functions/getAction/schemas.d.ts +0 -30
  81. package/dist/functions/getAction/schemas.js +0 -13
  82. package/dist/functions/getApp/index.d.ts +0 -12
  83. package/dist/functions/getApp/index.js +0 -37
  84. package/dist/functions/getApp/info.d.ts +0 -12
  85. package/dist/functions/getApp/info.js +0 -11
  86. package/dist/functions/getApp/schemas.d.ts +0 -24
  87. package/dist/functions/getApp/schemas.js +0 -11
  88. package/dist/functions/getAuthentication/index.d.ts +0 -13
  89. package/dist/functions/getAuthentication/index.js +0 -38
  90. package/dist/functions/getAuthentication/info.d.ts +0 -12
  91. package/dist/functions/getAuthentication/info.js +0 -11
  92. package/dist/functions/getAuthentication/schemas.d.ts +0 -26
  93. package/dist/functions/getAuthentication/schemas.js +0 -16
  94. package/dist/functions/listActions/index.d.ts +0 -12
  95. package/dist/functions/listActions/index.js +0 -128
  96. package/dist/functions/listActions/info.d.ts +0 -15
  97. package/dist/functions/listActions/info.js +0 -11
  98. package/dist/functions/listActions/schemas.d.ts +0 -27
  99. package/dist/functions/listActions/schemas.js +0 -14
  100. package/dist/functions/listApps/index.d.ts +0 -12
  101. package/dist/functions/listApps/index.js +0 -50
  102. package/dist/functions/listApps/info.d.ts +0 -18
  103. package/dist/functions/listApps/info.js +0 -11
  104. package/dist/functions/listApps/schemas.d.ts +0 -30
  105. package/dist/functions/listApps/schemas.js +0 -15
  106. package/dist/functions/listAuthentications/index.d.ts +0 -12
  107. package/dist/functions/listAuthentications/index.js +0 -131
  108. package/dist/functions/listAuthentications/info.d.ts +0 -30
  109. package/dist/functions/listAuthentications/info.js +0 -11
  110. package/dist/functions/listAuthentications/schemas.d.ts +0 -44
  111. package/dist/functions/listAuthentications/schemas.js +0 -25
  112. package/dist/functions/listFields/index.d.ts +0 -12
  113. package/dist/functions/listFields/index.js +0 -65
  114. package/dist/functions/listFields/info.d.ts +0 -24
  115. package/dist/functions/listFields/info.js +0 -11
  116. package/dist/functions/listFields/schemas.d.ts +0 -36
  117. package/dist/functions/listFields/schemas.js +0 -17
  118. package/dist/functions/runAction/index.d.ts +0 -12
  119. package/dist/functions/runAction/index.js +0 -86
  120. package/dist/functions/runAction/info.d.ts +0 -24
  121. package/dist/functions/runAction/info.js +0 -11
  122. package/dist/functions/runAction/schemas.d.ts +0 -38
  123. package/dist/functions/runAction/schemas.js +0 -15
  124. package/dist/index.js +0 -57
  125. package/dist/plugins/apps/index.d.ts +0 -8
  126. package/dist/plugins/apps/index.js +0 -77
  127. package/dist/plugins/apps/info.d.ts +0 -6
  128. package/dist/plugins/apps/info.js +0 -13
  129. package/dist/plugins/apps/types.d.ts +0 -21
  130. package/dist/plugins/apps/types.js +0 -2
  131. package/dist/resolvers/actionKey.d.ts +0 -8
  132. package/dist/resolvers/actionKey.js +0 -20
  133. package/dist/resolvers/actionType.d.ts +0 -8
  134. package/dist/resolvers/actionType.js +0 -21
  135. package/dist/resolvers/appKey.d.ts +0 -6
  136. package/dist/resolvers/appKey.js +0 -8
  137. package/dist/resolvers/authenticationId.d.ts +0 -8
  138. package/dist/resolvers/authenticationId.js +0 -29
  139. package/dist/resolvers/index.d.ts +0 -39
  140. package/dist/resolvers/index.js +0 -105
  141. package/dist/resolvers/inputs.d.ts +0 -7
  142. package/dist/resolvers/inputs.js +0 -15
  143. package/dist/schema-utils.d.ts +0 -44
  144. package/dist/schema-utils.js +0 -76
  145. package/dist/schemas/Action.d.ts +0 -21
  146. package/dist/schemas/Action.js +0 -31
  147. package/dist/schemas/App.d.ts +0 -19
  148. package/dist/schemas/App.js +0 -32
  149. package/dist/schemas/Auth.d.ts +0 -27
  150. package/dist/schemas/Auth.js +0 -42
  151. package/dist/schemas/Field.d.ts +0 -15
  152. package/dist/schemas/Field.js +0 -25
  153. package/dist/sdk.d.ts +0 -6
  154. package/dist/sdk.js +0 -90
  155. package/dist/types/domain.d.ts +0 -25
  156. package/dist/types/domain.js +0 -21
  157. package/dist/types/events.d.ts +0 -37
  158. package/dist/types/events.js +0 -8
  159. package/dist/types/properties.d.ts +0 -21
  160. package/dist/types/properties.js +0 -52
  161. package/dist/types/sdk.d.ts +0 -24
  162. package/dist/types/sdk.js +0 -2
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.actionKeyResolver = void 0;
4
- exports.actionKeyResolver = {
5
- type: "dynamic",
6
- depends: ["appKey", "actionType"],
7
- fetch: async (sdk, resolvedParams) => {
8
- const actions = await sdk.listActions({ appKey: resolvedParams.appKey });
9
- return actions.filter((action) => action.type === resolvedParams.actionType);
10
- },
11
- prompt: (actions) => ({
12
- type: "list",
13
- name: "actionKey",
14
- message: "Select action:",
15
- choices: actions.map((action) => ({
16
- name: `${action.name || action.key} - ${action.description || "No description"}`,
17
- value: action.key,
18
- })),
19
- }),
20
- };
@@ -1,8 +0,0 @@
1
- import type { ZapierSdk } from "../types/sdk";
2
- export interface ActionTypeResolver {
3
- type: "dynamic";
4
- depends: readonly string[];
5
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
6
- prompt: (items: any[], params: Record<string, any>) => any;
7
- }
8
- export declare const actionTypeResolver: ActionTypeResolver;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.actionTypeResolver = void 0;
4
- exports.actionTypeResolver = {
5
- type: "dynamic",
6
- depends: ["appKey"],
7
- fetch: async (sdk, resolvedParams) => {
8
- const actions = await sdk.listActions({ appKey: resolvedParams.appKey });
9
- const types = [...new Set(actions.map((action) => action.type))];
10
- return types.map((type) => ({ key: type, name: type }));
11
- },
12
- prompt: (types) => ({
13
- type: "list",
14
- name: "actionType",
15
- message: "Select action type:",
16
- choices: types.map((type) => ({
17
- name: type.name,
18
- value: type.key,
19
- })),
20
- }),
21
- };
@@ -1,6 +0,0 @@
1
- export interface AppKeyResolver {
2
- type: "static";
3
- inputType?: "text" | "password" | "email";
4
- placeholder?: string;
5
- }
6
- export declare const appKeyResolver: AppKeyResolver;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appKeyResolver = void 0;
4
- exports.appKeyResolver = {
5
- type: "static",
6
- inputType: "text",
7
- placeholder: "Enter app slug (e.g., 'slack', 'github')",
8
- };
@@ -1,8 +0,0 @@
1
- import type { ZapierSdk } from "../types/sdk";
2
- export interface AuthenticationIdResolver {
3
- type: "dynamic";
4
- depends: readonly string[];
5
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
6
- prompt: (items: any[], params: Record<string, any>) => any;
7
- }
8
- export declare const authenticationIdResolver: AuthenticationIdResolver;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authenticationIdResolver = void 0;
4
- exports.authenticationIdResolver = {
5
- type: "dynamic",
6
- depends: ["appKey"],
7
- fetch: async (sdk, resolvedParams) => {
8
- // Get auths for the specific app (owned auths will be prioritized automatically)
9
- return await sdk.listAuthentications({
10
- appKey: resolvedParams.appKey,
11
- limit: 1000,
12
- });
13
- },
14
- prompt: (auths, params) => ({
15
- type: "list",
16
- name: "authenticationId",
17
- message: `Select authentication for ${params.appKey}:`,
18
- choices: [
19
- ...auths.map((auth) => ({
20
- name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
21
- value: auth.id,
22
- })),
23
- {
24
- name: "↗ Skip authentication (may fail)",
25
- value: null,
26
- },
27
- ],
28
- }),
29
- };
@@ -1,39 +0,0 @@
1
- export declare const resolverRegistry: {
2
- readonly appKey: import("./appKey").AppKeyResolver;
3
- readonly actionType: import("./actionType").ActionTypeResolver;
4
- readonly actionKey: import("./actionKey").ActionKeyResolver;
5
- readonly authenticationId: import("./authenticationId").AuthenticationIdResolver;
6
- readonly inputs: import("./inputs").InputsResolver;
7
- };
8
- export type ResolverName = keyof typeof resolverRegistry;
9
- export type ResolverType = (typeof resolverRegistry)[ResolverName];
10
- /**
11
- * Get a resolver by name
12
- */
13
- export declare function getResolver(name: string): ResolverType | undefined;
14
- /**
15
- * Get all resolvers for a list of missing parameters
16
- */
17
- export declare function getResolversForMissingParams(missingParams: string[]): Record<string, ResolverType>;
18
- /**
19
- * Check if a parameter has a resolver
20
- */
21
- export declare function hasResolver(paramName: string): boolean;
22
- /**
23
- * Get all parameter names that have resolvers
24
- */
25
- export declare function getResolvableParams(): string[];
26
- /**
27
- * Resolve dependency chain for a parameter
28
- * Returns parameters in the order they need to be resolved
29
- */
30
- export declare function getResolutionOrder(paramName: string, resolved?: Set<string>): string[];
31
- /**
32
- * Get resolution order for multiple parameters
33
- */
34
- export declare function getResolutionOrderForParams(paramNames: string[]): string[];
35
- export { appKeyResolver } from "./appKey";
36
- export { actionTypeResolver } from "./actionType";
37
- export { actionKeyResolver } from "./actionKey";
38
- export { authenticationIdResolver } from "./authenticationId";
39
- export { inputsResolver } from "./inputs";
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inputsResolver = exports.authenticationIdResolver = exports.actionKeyResolver = exports.actionTypeResolver = exports.appKeyResolver = exports.resolverRegistry = void 0;
4
- exports.getResolver = getResolver;
5
- exports.getResolversForMissingParams = getResolversForMissingParams;
6
- exports.hasResolver = hasResolver;
7
- exports.getResolvableParams = getResolvableParams;
8
- exports.getResolutionOrder = getResolutionOrder;
9
- exports.getResolutionOrderForParams = getResolutionOrderForParams;
10
- const appKey_1 = require("./appKey");
11
- const actionType_1 = require("./actionType");
12
- const actionKey_1 = require("./actionKey");
13
- const authenticationId_1 = require("./authenticationId");
14
- const inputs_1 = require("./inputs");
15
- // Centralized resolver registry
16
- exports.resolverRegistry = {
17
- appKey: appKey_1.appKeyResolver,
18
- actionType: actionType_1.actionTypeResolver,
19
- actionKey: actionKey_1.actionKeyResolver,
20
- authenticationId: authenticationId_1.authenticationIdResolver,
21
- inputs: inputs_1.inputsResolver,
22
- };
23
- // Utility functions for working with resolvers
24
- /**
25
- * Get a resolver by name
26
- */
27
- function getResolver(name) {
28
- return exports.resolverRegistry[name];
29
- }
30
- /**
31
- * Get all resolvers for a list of missing parameters
32
- */
33
- function getResolversForMissingParams(missingParams) {
34
- const resolvers = {};
35
- for (const param of missingParams) {
36
- const resolver = exports.resolverRegistry[param];
37
- if (resolver) {
38
- resolvers[param] = resolver;
39
- }
40
- }
41
- return resolvers;
42
- }
43
- /**
44
- * Check if a parameter has a resolver
45
- */
46
- function hasResolver(paramName) {
47
- return paramName in exports.resolverRegistry;
48
- }
49
- /**
50
- * Get all parameter names that have resolvers
51
- */
52
- function getResolvableParams() {
53
- return Object.keys(exports.resolverRegistry);
54
- }
55
- /**
56
- * Resolve dependency chain for a parameter
57
- * Returns parameters in the order they need to be resolved
58
- */
59
- function getResolutionOrder(paramName, resolved = new Set()) {
60
- const resolver = getResolver(paramName);
61
- if (!resolver || resolver.type === "static") {
62
- return [paramName];
63
- }
64
- const order = [];
65
- if ("depends" in resolver && resolver.depends) {
66
- for (const dependency of resolver.depends) {
67
- if (!resolved.has(dependency)) {
68
- order.push(...getResolutionOrder(dependency, resolved));
69
- resolved.add(dependency);
70
- }
71
- }
72
- }
73
- if (!resolved.has(paramName)) {
74
- order.push(paramName);
75
- resolved.add(paramName);
76
- }
77
- return order;
78
- }
79
- /**
80
- * Get resolution order for multiple parameters
81
- */
82
- function getResolutionOrderForParams(paramNames) {
83
- const resolved = new Set();
84
- const order = [];
85
- for (const paramName of paramNames) {
86
- const paramOrder = getResolutionOrder(paramName, resolved);
87
- for (const param of paramOrder) {
88
- if (!order.includes(param)) {
89
- order.push(param);
90
- }
91
- }
92
- }
93
- return order;
94
- }
95
- // Re-export individual resolvers for direct access if needed
96
- var appKey_2 = require("./appKey");
97
- Object.defineProperty(exports, "appKeyResolver", { enumerable: true, get: function () { return appKey_2.appKeyResolver; } });
98
- var actionType_2 = require("./actionType");
99
- Object.defineProperty(exports, "actionTypeResolver", { enumerable: true, get: function () { return actionType_2.actionTypeResolver; } });
100
- var actionKey_2 = require("./actionKey");
101
- Object.defineProperty(exports, "actionKeyResolver", { enumerable: true, get: function () { return actionKey_2.actionKeyResolver; } });
102
- var authenticationId_2 = require("./authenticationId");
103
- Object.defineProperty(exports, "authenticationIdResolver", { enumerable: true, get: function () { return authenticationId_2.authenticationIdResolver; } });
104
- var inputs_2 = require("./inputs");
105
- Object.defineProperty(exports, "inputsResolver", { enumerable: true, get: function () { return inputs_2.inputsResolver; } });
@@ -1,7 +0,0 @@
1
- import type { ZapierSdk } from "../types/sdk";
2
- export interface InputsResolver {
3
- type: "fields";
4
- depends: readonly string[];
5
- fetch: (sdk: ZapierSdk, resolvedParams: Record<string, any>) => Promise<any[]>;
6
- }
7
- export declare const inputsResolver: InputsResolver;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inputsResolver = void 0;
4
- exports.inputsResolver = {
5
- type: "fields",
6
- depends: ["appKey", "actionKey", "actionType", "authenticationId"],
7
- fetch: async (sdk, resolvedParams) => {
8
- return await sdk.listFields({
9
- appKey: resolvedParams.appKey,
10
- actionKey: resolvedParams.actionKey,
11
- actionType: resolvedParams.actionType,
12
- authenticationId: resolvedParams.authenticationId,
13
- });
14
- },
15
- };
@@ -1,44 +0,0 @@
1
- import { z } from "zod";
2
- export interface FormattedItem {
3
- title: string;
4
- subtitle?: string;
5
- details: Array<{
6
- text: string;
7
- style: "normal" | "dim" | "accent" | "warning" | "success";
8
- }>;
9
- }
10
- export interface FormatMetadata {
11
- format: (item: any) => FormattedItem;
12
- }
13
- export declare function withFormatter<T extends z.ZodType>(schema: T, formatMeta: FormatMetadata): T;
14
- export declare function getFormatMetadata(schema: z.ZodType): FormatMetadata | undefined;
15
- export declare function withOutputSchema<T extends z.ZodType>(inputSchema: T, outputSchema: z.ZodType): T;
16
- export declare function getOutputSchema(inputSchema: z.ZodType): z.ZodType | undefined;
17
- export interface StaticResolver {
18
- type: "static";
19
- inputType?: "text" | "password" | "email";
20
- placeholder?: string;
21
- }
22
- export interface DynamicResolver {
23
- type: "dynamic";
24
- fetch: (sdk: any, resolvedParams: any) => Promise<any[]>;
25
- prompt: (items: any[], params: any) => any;
26
- depends?: string[];
27
- }
28
- export interface FieldsResolver {
29
- type: "fields";
30
- fetch: (sdk: any, resolvedParams: any) => Promise<any[]>;
31
- depends?: string[];
32
- }
33
- export type ResolverMetadata = StaticResolver | DynamicResolver | FieldsResolver;
34
- export interface ResolverConfig {
35
- resolver: ResolverMetadata;
36
- }
37
- export declare function withResolver<T extends z.ZodType>(schema: T, config: ResolverConfig): T;
38
- export declare function getSchemaDescription(schema: z.ZodSchema): string | undefined;
39
- export declare function getFieldDescriptions(schema: z.ZodObject<any>): Record<string, string>;
40
- export interface PositionalMetadata {
41
- positional: true;
42
- }
43
- export declare function withPositional<T extends z.ZodType>(schema: T): T;
44
- export declare function isPositional(schema: z.ZodType): boolean;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withFormatter = withFormatter;
4
- exports.getFormatMetadata = getFormatMetadata;
5
- exports.withOutputSchema = withOutputSchema;
6
- exports.getOutputSchema = getOutputSchema;
7
- exports.withResolver = withResolver;
8
- exports.getSchemaDescription = getSchemaDescription;
9
- exports.getFieldDescriptions = getFieldDescriptions;
10
- exports.withPositional = withPositional;
11
- exports.isPositional = isPositional;
12
- const zod_1 = require("zod");
13
- // Helper function to add format metadata to schemas
14
- function withFormatter(schema, formatMeta) {
15
- // Store format metadata on the schema definition
16
- schema._def.formatMeta = formatMeta;
17
- return schema;
18
- }
19
- // Helper function to get format metadata from a schema
20
- function getFormatMetadata(schema) {
21
- return schema._def.formatMeta;
22
- }
23
- // Helper function to link input schemas to output schemas
24
- function withOutputSchema(inputSchema, outputSchema) {
25
- // Store output schema reference on the input schema
26
- inputSchema._def.outputSchema = outputSchema;
27
- return inputSchema;
28
- }
29
- // Helper function to get output schema from an input schema
30
- function getOutputSchema(inputSchema) {
31
- return inputSchema._def.outputSchema;
32
- }
33
- // Helper function to add resolver metadata to schemas
34
- function withResolver(schema, config) {
35
- // Store resolver metadata on the schema definition
36
- schema._def.resolverMeta = config;
37
- return schema;
38
- }
39
- // ============================================================================
40
- // Schema Description Utilities
41
- // ============================================================================
42
- function getSchemaDescription(schema) {
43
- return schema.description;
44
- }
45
- function getFieldDescriptions(schema) {
46
- const descriptions = {};
47
- const shape = schema.shape;
48
- for (const [key, fieldSchema] of Object.entries(shape)) {
49
- if (fieldSchema instanceof zod_1.z.ZodType && fieldSchema.description) {
50
- descriptions[key] = fieldSchema.description;
51
- }
52
- }
53
- return descriptions;
54
- }
55
- // Helper function to mark a parameter as positional for CLI
56
- function withPositional(schema) {
57
- // Store positional metadata on the schema definition
58
- schema._def.positionalMeta = { positional: true };
59
- return schema;
60
- }
61
- // Helper function to check if a parameter should be positional
62
- function isPositional(schema) {
63
- // Check the current schema first
64
- if (schema._def.positionalMeta?.positional) {
65
- return true;
66
- }
67
- // If this is a ZodOptional, check the inner type
68
- if (schema instanceof zod_1.z.ZodOptional) {
69
- return isPositional(schema._def.innerType);
70
- }
71
- // If this is a ZodDefault, check the inner type
72
- if (schema instanceof zod_1.z.ZodDefault) {
73
- return isPositional(schema._def.innerType);
74
- }
75
- return false;
76
- }
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ActionItemSchema: z.ZodObject<{
3
- key: z.ZodString;
4
- name: z.ZodOptional<z.ZodString>;
5
- type: z.ZodString;
6
- appKey: z.ZodOptional<z.ZodString>;
7
- description: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- type: string;
10
- key: string;
11
- appKey?: string | undefined;
12
- name?: string | undefined;
13
- description?: string | undefined;
14
- }, {
15
- type: string;
16
- key: string;
17
- appKey?: string | undefined;
18
- name?: string | undefined;
19
- description?: string | undefined;
20
- }>;
21
- export type ActionItem = z.infer<typeof ActionItemSchema>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const schema_utils_1 = require("../schema-utils");
6
- // ============================================================================
7
- // Action Schemas
8
- // ============================================================================
9
- exports.ActionItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
10
- key: zod_1.z.string(),
11
- name: zod_1.z.string().optional(),
12
- type: zod_1.z.string(),
13
- appKey: zod_1.z.string().optional(),
14
- description: zod_1.z.string().optional(),
15
- }), {
16
- format: (item) => {
17
- const details = [];
18
- details.push({ text: `Type: ${item.type}`, style: "accent" });
19
- if (item.appKey) {
20
- details.push({ text: `App: ${item.appKey}`, style: "normal" });
21
- }
22
- if (item.description) {
23
- details.push({ text: item.description, style: "dim" });
24
- }
25
- return {
26
- title: item.name || item.key,
27
- subtitle: `(${item.key})`,
28
- details,
29
- };
30
- },
31
- });
@@ -1,19 +0,0 @@
1
- import { z } from "zod";
2
- export { FormattedItem, FormatMetadata } from "../schema-utils";
3
- export declare const AppItemSchema: z.ZodObject<{
4
- key: z.ZodString;
5
- name: z.ZodOptional<z.ZodString>;
6
- description: z.ZodOptional<z.ZodString>;
7
- category: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- key: string;
10
- name?: string | undefined;
11
- description?: string | undefined;
12
- category?: string | undefined;
13
- }, {
14
- key: string;
15
- name?: string | undefined;
16
- description?: string | undefined;
17
- category?: string | undefined;
18
- }>;
19
- export type AppItem = z.infer<typeof AppItemSchema>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const schema_utils_1 = require("../schema-utils");
6
- // ============================================================================
7
- // App Schemas
8
- // ============================================================================
9
- exports.AppItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
10
- key: zod_1.z.string(),
11
- name: zod_1.z.string().optional(),
12
- description: zod_1.z.string().optional(),
13
- category: zod_1.z.string().optional(),
14
- }), {
15
- format: (item) => {
16
- const details = [];
17
- if (item.description) {
18
- details.push({ text: item.description, style: "dim" });
19
- }
20
- if (item.category) {
21
- details.push({
22
- text: `Category: ${item.category}`,
23
- style: "accent",
24
- });
25
- }
26
- return {
27
- title: item.name || item.key,
28
- subtitle: `(${item.key})`,
29
- details,
30
- };
31
- },
32
- });
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AuthItemSchema: z.ZodObject<{
3
- id: z.ZodNumber;
4
- title: z.ZodOptional<z.ZodString>;
5
- identifier: z.ZodOptional<z.ZodString>;
6
- account_id: z.ZodOptional<z.ZodString>;
7
- is_private: z.ZodOptional<z.ZodBoolean>;
8
- shared_with_all: z.ZodOptional<z.ZodBoolean>;
9
- marked_stale_at: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- id: number;
12
- title?: string | undefined;
13
- identifier?: string | undefined;
14
- account_id?: string | undefined;
15
- is_private?: boolean | undefined;
16
- shared_with_all?: boolean | undefined;
17
- marked_stale_at?: string | undefined;
18
- }, {
19
- id: number;
20
- title?: string | undefined;
21
- identifier?: string | undefined;
22
- account_id?: string | undefined;
23
- is_private?: boolean | undefined;
24
- shared_with_all?: boolean | undefined;
25
- marked_stale_at?: string | undefined;
26
- }>;
27
- export type AuthItem = z.infer<typeof AuthItemSchema>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const schema_utils_1 = require("../schema-utils");
6
- // ============================================================================
7
- // Auth Schemas
8
- // ============================================================================
9
- exports.AuthItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
10
- id: zod_1.z.number(),
11
- title: zod_1.z.string().optional(),
12
- identifier: zod_1.z.string().optional(),
13
- account_id: zod_1.z.string().optional(),
14
- is_private: zod_1.z.boolean().optional(),
15
- shared_with_all: zod_1.z.boolean().optional(),
16
- marked_stale_at: zod_1.z.string().optional(),
17
- }), {
18
- format: (item) => {
19
- const details = [];
20
- if (item.identifier) {
21
- details.push({
22
- text: `Identifier: ${item.identifier}`,
23
- style: "accent",
24
- });
25
- }
26
- details.push({
27
- text: `Account: ${item.account_id || "unknown"} | Private: ${item.is_private || false} | Shared: ${item.shared_with_all || false}`,
28
- style: "dim",
29
- });
30
- if (item.marked_stale_at) {
31
- details.push({
32
- text: `⚠️ Marked stale: ${new Date(item.marked_stale_at).toLocaleDateString()}`,
33
- style: "warning",
34
- });
35
- }
36
- return {
37
- title: item.title || `Authentication ${item.id}`,
38
- subtitle: `(ID: ${item.id})`,
39
- details,
40
- };
41
- },
42
- });
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- export declare const FieldItemSchema: z.ZodObject<{
3
- key: z.ZodString;
4
- name: z.ZodOptional<z.ZodString>;
5
- description: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- key: string;
8
- name?: string | undefined;
9
- description?: string | undefined;
10
- }, {
11
- key: string;
12
- name?: string | undefined;
13
- description?: string | undefined;
14
- }>;
15
- export type FieldItem = z.infer<typeof FieldItemSchema>;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FieldItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const schema_utils_1 = require("../schema-utils");
6
- // ============================================================================
7
- // Field Schemas
8
- // ============================================================================
9
- exports.FieldItemSchema = (0, schema_utils_1.withFormatter)(zod_1.z.object({
10
- key: zod_1.z.string(),
11
- name: zod_1.z.string().optional(),
12
- description: zod_1.z.string().optional(),
13
- }), {
14
- format: (item) => {
15
- const details = [];
16
- if (item.description) {
17
- details.push({ text: item.description, style: "dim" });
18
- }
19
- return {
20
- title: item.name || item.key,
21
- subtitle: `(${item.key})`,
22
- details,
23
- };
24
- },
25
- });
package/dist/sdk.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { BaseSdkOptions } from "./types/domain";
2
- import type { ZapierSdk } from "./types/sdk";
3
- export type { ZapierSdk } from "./types/sdk";
4
- export interface ZapierSdkOptions extends BaseSdkOptions {
5
- }
6
- export declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;