@zapier/zapier-sdk 0.13.5 → 0.13.7

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 (129) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/api/schemas.d.ts +38 -38
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.mts +170 -177
  5. package/dist/index.mjs +1 -1
  6. package/dist/plugins/fetch/schemas.d.ts +4 -4
  7. package/dist/plugins/getAction/schemas.d.ts +2 -2
  8. package/dist/plugins/listActions/schemas.d.ts +6 -6
  9. package/dist/plugins/listApps/schemas.d.ts +6 -6
  10. package/dist/plugins/listAuthentications/schemas.d.ts +4 -4
  11. package/dist/plugins/listInputFieldChoices/schemas.d.ts +8 -8
  12. package/dist/plugins/listInputFields/schemas.d.ts +8 -8
  13. package/dist/plugins/request/schemas.d.ts +8 -8
  14. package/dist/plugins/runAction/schemas.d.ts +8 -8
  15. package/dist/schemas/Action.d.ts +2 -2
  16. package/dist/schemas/App.d.ts +8 -8
  17. package/dist/types/sdk.d.ts +2 -8
  18. package/dist/types/sdk.d.ts.map +1 -1
  19. package/package.json +8 -3
  20. package/src/api/auth.ts +0 -28
  21. package/src/api/client.ts +0 -491
  22. package/src/api/debug.test.ts +0 -76
  23. package/src/api/debug.ts +0 -154
  24. package/src/api/index.ts +0 -90
  25. package/src/api/polling.test.ts +0 -405
  26. package/src/api/polling.ts +0 -253
  27. package/src/api/schemas.ts +0 -465
  28. package/src/api/types.ts +0 -152
  29. package/src/auth.ts +0 -72
  30. package/src/constants.ts +0 -16
  31. package/src/index.ts +0 -111
  32. package/src/plugins/api/index.ts +0 -43
  33. package/src/plugins/apps/index.ts +0 -203
  34. package/src/plugins/apps/schemas.ts +0 -64
  35. package/src/plugins/eventEmission/builders.ts +0 -115
  36. package/src/plugins/eventEmission/index.test.ts +0 -169
  37. package/src/plugins/eventEmission/index.ts +0 -294
  38. package/src/plugins/eventEmission/transport.test.ts +0 -214
  39. package/src/plugins/eventEmission/transport.ts +0 -135
  40. package/src/plugins/eventEmission/types.ts +0 -58
  41. package/src/plugins/eventEmission/utils.ts +0 -121
  42. package/src/plugins/fetch/index.ts +0 -83
  43. package/src/plugins/fetch/schemas.ts +0 -37
  44. package/src/plugins/findFirstAuthentication/index.test.ts +0 -209
  45. package/src/plugins/findFirstAuthentication/index.ts +0 -68
  46. package/src/plugins/findFirstAuthentication/schemas.ts +0 -47
  47. package/src/plugins/findUniqueAuthentication/index.test.ts +0 -197
  48. package/src/plugins/findUniqueAuthentication/index.ts +0 -77
  49. package/src/plugins/findUniqueAuthentication/schemas.ts +0 -49
  50. package/src/plugins/getAction/index.test.ts +0 -239
  51. package/src/plugins/getAction/index.ts +0 -75
  52. package/src/plugins/getAction/schemas.ts +0 -41
  53. package/src/plugins/getApp/index.test.ts +0 -181
  54. package/src/plugins/getApp/index.ts +0 -60
  55. package/src/plugins/getApp/schemas.ts +0 -33
  56. package/src/plugins/getAuthentication/index.test.ts +0 -294
  57. package/src/plugins/getAuthentication/index.ts +0 -95
  58. package/src/plugins/getAuthentication/schemas.ts +0 -38
  59. package/src/plugins/getProfile/index.ts +0 -60
  60. package/src/plugins/getProfile/schemas.ts +0 -24
  61. package/src/plugins/listActions/index.test.ts +0 -526
  62. package/src/plugins/listActions/index.ts +0 -132
  63. package/src/plugins/listActions/schemas.ts +0 -55
  64. package/src/plugins/listApps/index.test.ts +0 -378
  65. package/src/plugins/listApps/index.ts +0 -159
  66. package/src/plugins/listApps/schemas.ts +0 -41
  67. package/src/plugins/listAuthentications/index.test.ts +0 -739
  68. package/src/plugins/listAuthentications/index.ts +0 -152
  69. package/src/plugins/listAuthentications/schemas.ts +0 -77
  70. package/src/plugins/listInputFieldChoices/index.test.ts +0 -653
  71. package/src/plugins/listInputFieldChoices/index.ts +0 -173
  72. package/src/plugins/listInputFieldChoices/schemas.ts +0 -125
  73. package/src/plugins/listInputFields/index.test.ts +0 -439
  74. package/src/plugins/listInputFields/index.ts +0 -294
  75. package/src/plugins/listInputFields/schemas.ts +0 -68
  76. package/src/plugins/manifest/index.test.ts +0 -776
  77. package/src/plugins/manifest/index.ts +0 -461
  78. package/src/plugins/manifest/schemas.ts +0 -60
  79. package/src/plugins/registry/index.ts +0 -160
  80. package/src/plugins/request/index.test.ts +0 -333
  81. package/src/plugins/request/index.ts +0 -105
  82. package/src/plugins/request/schemas.ts +0 -69
  83. package/src/plugins/runAction/index.test.ts +0 -388
  84. package/src/plugins/runAction/index.ts +0 -215
  85. package/src/plugins/runAction/schemas.ts +0 -60
  86. package/src/resolvers/actionKey.ts +0 -37
  87. package/src/resolvers/actionType.ts +0 -34
  88. package/src/resolvers/appKey.ts +0 -7
  89. package/src/resolvers/authenticationId.ts +0 -54
  90. package/src/resolvers/index.ts +0 -11
  91. package/src/resolvers/inputFieldKey.ts +0 -70
  92. package/src/resolvers/inputs.ts +0 -69
  93. package/src/schemas/Action.ts +0 -52
  94. package/src/schemas/App.ts +0 -45
  95. package/src/schemas/Auth.ts +0 -59
  96. package/src/schemas/Field.ts +0 -169
  97. package/src/schemas/Run.ts +0 -40
  98. package/src/schemas/UserProfile.ts +0 -60
  99. package/src/sdk.test.ts +0 -212
  100. package/src/sdk.ts +0 -178
  101. package/src/types/domain.test.ts +0 -50
  102. package/src/types/domain.ts +0 -66
  103. package/src/types/errors.ts +0 -278
  104. package/src/types/events.ts +0 -43
  105. package/src/types/functions.ts +0 -28
  106. package/src/types/optional-zapier-sdk-cli-login.d.ts +0 -37
  107. package/src/types/plugin.ts +0 -125
  108. package/src/types/properties.ts +0 -80
  109. package/src/types/sdk.ts +0 -117
  110. package/src/types/telemetry-events.ts +0 -85
  111. package/src/utils/array-utils.test.ts +0 -131
  112. package/src/utils/array-utils.ts +0 -41
  113. package/src/utils/domain-utils.test.ts +0 -433
  114. package/src/utils/domain-utils.ts +0 -267
  115. package/src/utils/file-utils.test.ts +0 -73
  116. package/src/utils/file-utils.ts +0 -94
  117. package/src/utils/function-utils.test.ts +0 -141
  118. package/src/utils/function-utils.ts +0 -245
  119. package/src/utils/pagination-utils.test.ts +0 -620
  120. package/src/utils/pagination-utils.ts +0 -242
  121. package/src/utils/schema-utils.ts +0 -207
  122. package/src/utils/string-utils.test.ts +0 -45
  123. package/src/utils/string-utils.ts +0 -54
  124. package/src/utils/validation.test.ts +0 -51
  125. package/src/utils/validation.ts +0 -44
  126. package/tsconfig.build.json +0 -18
  127. package/tsconfig.json +0 -20
  128. package/tsconfig.tsbuildinfo +0 -1
  129. package/tsup.config.ts +0 -23
@@ -1,278 +0,0 @@
1
- /**
2
- * Standard error format returned by the Zapier API
3
- */
4
- export interface ApiError {
5
- status: number;
6
- code: string;
7
- title: string;
8
- detail: string;
9
- source?: unknown;
10
- meta?: unknown;
11
- }
12
-
13
- /**
14
- * Base options for all error constructors
15
- */
16
- export interface ErrorOptions {
17
- statusCode?: number;
18
- errors?: ApiError[];
19
- cause?: unknown;
20
- response?: unknown;
21
- }
22
-
23
- /**
24
- * Base class for all Zapier SDK errors
25
- * Use instanceof ZapierError to check if an error is from the SDK
26
- */
27
- export abstract class ZapierError extends Error {
28
- abstract readonly name: string;
29
- public statusCode?: number;
30
- public errors?: ApiError[];
31
- public cause?: unknown;
32
- public response?: unknown;
33
-
34
- constructor(message: string, options: ErrorOptions = {}) {
35
- super(message);
36
- this.statusCode = options.statusCode;
37
- this.errors = options.errors;
38
- this.cause = options.cause;
39
- this.response = options.response;
40
- // Maintain proper prototype chain for instanceof checks
41
- Object.setPrototypeOf(this, new.target.prototype);
42
- }
43
- }
44
-
45
- /**
46
- * Error thrown when API requests fail
47
- */
48
- export class ZapierApiError extends ZapierError {
49
- readonly name = "ZapierApiError";
50
-
51
- constructor(message: string, options: ErrorOptions = {}) {
52
- super(message, options);
53
- }
54
- }
55
-
56
- /**
57
- * Error thrown when an app is not found
58
- */
59
- export class ZapierAppNotFoundError extends ZapierError {
60
- readonly name = "ZapierAppNotFoundError";
61
- public appKey?: string;
62
-
63
- constructor(
64
- message: string,
65
- options: ErrorOptions & { appKey?: string } = {},
66
- ) {
67
- super(message, options);
68
- this.appKey = options.appKey;
69
- }
70
- }
71
-
72
- /**
73
- * Error thrown when validation fails (e.g., invalid parameters)
74
- */
75
- export class ZapierValidationError extends ZapierError {
76
- readonly name = "ZapierValidationError";
77
- public details?: unknown;
78
-
79
- constructor(
80
- message: string,
81
- options: ErrorOptions & { details?: unknown } = {},
82
- ) {
83
- super(message, options);
84
- this.details = options.details;
85
- }
86
- }
87
-
88
- /**
89
- * Error for unrecognized/unknown errors that get wrapped by safe functions
90
- */
91
- export class ZapierUnknownError extends ZapierError {
92
- readonly name = "ZapierUnknownError";
93
-
94
- constructor(message: string, options: ErrorOptions = {}) {
95
- super(message, options);
96
- }
97
- }
98
-
99
- /**
100
- * Error thrown for authentication and authorization failures (401/403)
101
- */
102
- export class ZapierAuthenticationError extends ZapierError {
103
- readonly name = "ZapierAuthenticationError";
104
-
105
- constructor(message: string, options: ErrorOptions = {}) {
106
- super(message, options);
107
- }
108
- }
109
-
110
- /**
111
- * Error thrown when a requested resource is not found
112
- */
113
- export class ZapierResourceNotFoundError extends ZapierError {
114
- readonly name = "ZapierResourceNotFoundError";
115
- public resourceType?: string;
116
- public resourceId?: string;
117
-
118
- constructor(
119
- message: string,
120
- options: ErrorOptions & { resourceType?: string; resourceId?: string } = {},
121
- ) {
122
- super(message, options);
123
- this.resourceType = options.resourceType;
124
- this.resourceId = options.resourceId;
125
- }
126
- }
127
-
128
- /**
129
- * Error thrown when required app or implementation configuration is missing
130
- */
131
- export class ZapierConfigurationError extends ZapierError {
132
- readonly name = "ZapierConfigurationError";
133
- public configType?: string;
134
-
135
- constructor(
136
- message: string,
137
- options: ErrorOptions & { configType?: string } = {},
138
- ) {
139
- super(message, options);
140
- this.configType = options.configType;
141
- }
142
- }
143
-
144
- /**
145
- * Error thrown when code bundling or compilation fails
146
- */
147
- export class ZapierBundleError extends ZapierError {
148
- readonly name = "ZapierBundleError";
149
- public buildErrors?: string[];
150
-
151
- constructor(
152
- message: string,
153
- options: ErrorOptions & { buildErrors?: string[] } = {},
154
- ) {
155
- super(message, options);
156
- this.buildErrors = options.buildErrors;
157
- }
158
- }
159
-
160
- /**
161
- * Error thrown when operations timeout or exceed retry limits
162
- */
163
- export class ZapierTimeoutError extends ZapierError {
164
- readonly name = "ZapierTimeoutError";
165
- public attempts?: number;
166
- public maxAttempts?: number;
167
-
168
- constructor(
169
- message: string,
170
- options: ErrorOptions & { attempts?: number; maxAttempts?: number } = {},
171
- ) {
172
- super(message, options);
173
- this.attempts = options.attempts;
174
- this.maxAttempts = options.maxAttempts;
175
- }
176
- }
177
-
178
- /**
179
- * Error thrown when action execution fails due to errors returned from the third-party service
180
- * This happens when the Actions API returns a 200 status but includes errors in the response
181
- */
182
- export class ZapierActionError extends ZapierError {
183
- readonly name = "ZapierActionError";
184
- public appKey?: string;
185
- public actionKey?: string;
186
-
187
- constructor(
188
- message: string,
189
- options: ErrorOptions & { appKey?: string; actionKey?: string } = {},
190
- ) {
191
- super(message, options);
192
- this.appKey = options.appKey;
193
- this.actionKey = options.actionKey;
194
- }
195
-
196
- // Legacy accessor for backward compatibility
197
- get actionErrors() {
198
- return this.errors;
199
- }
200
- }
201
-
202
- /**
203
- * Error thrown when a resource is not found (404)
204
- */
205
- export class ZapierNotFoundError extends ZapierError {
206
- readonly name = "ZapierNotFoundError";
207
-
208
- constructor(message: string, options: ErrorOptions = {}) {
209
- super(message, options);
210
- }
211
- }
212
-
213
- /**
214
- * Utility function to format error messages for display
215
- */
216
- export function formatErrorMessage(error: ZapierError): string {
217
- let message = error.message;
218
-
219
- // Add additional context from errors array if available
220
- if (error.errors && error.errors.length > 0) {
221
- const additionalErrors = error.errors.slice(1); // Skip first error (already in message)
222
- if (additionalErrors.length > 0) {
223
- const errorDetails = additionalErrors
224
- .map((err) => ` • ${err.detail || err.title || err.code}`)
225
- .join("\n");
226
- message += "\n\nAdditional errors:\n" + errorDetails;
227
- }
228
- }
229
-
230
- // Add error-specific context
231
- if (error instanceof ZapierAppNotFoundError && error.appKey) {
232
- message += `\nApp key: ${error.appKey}`;
233
- }
234
-
235
- if (error instanceof ZapierActionError && (error.appKey || error.actionKey)) {
236
- const context = [];
237
- if (error.appKey) context.push(`App: ${error.appKey}`);
238
- if (error.actionKey) context.push(`Action: ${error.actionKey}`);
239
- message += `\n${context.join(", ")}`;
240
- }
241
-
242
- if (
243
- error instanceof ZapierResourceNotFoundError &&
244
- (error.resourceType || error.resourceId)
245
- ) {
246
- const context = [];
247
- if (error.resourceType) context.push(`Type: ${error.resourceType}`);
248
- if (error.resourceId) context.push(`ID: ${error.resourceId}`);
249
- message += `\n${context.join(", ")}`;
250
- }
251
-
252
- if (
253
- error instanceof ZapierTimeoutError &&
254
- (error.attempts || error.maxAttempts)
255
- ) {
256
- const context = [];
257
- if (error.attempts) context.push(`Attempts: ${error.attempts}`);
258
- if (error.maxAttempts) context.push(`Max attempts: ${error.maxAttempts}`);
259
- message += `\n${context.join(", ")}`;
260
- }
261
-
262
- if (
263
- error instanceof ZapierBundleError &&
264
- error.buildErrors &&
265
- error.buildErrors.length > 0
266
- ) {
267
- message +=
268
- "\n\nBuild errors:\n" +
269
- error.buildErrors.map((err) => ` • ${err}`).join("\n");
270
- }
271
-
272
- // Add status code if available and not already obvious from the message
273
- if (error.statusCode && !message.includes(`${error.statusCode}`)) {
274
- message += `\nHTTP Status: ${error.statusCode}`;
275
- }
276
-
277
- return message;
278
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * SDK Event System
3
- *
4
- * This module provides common event type definitions for the SDK's
5
- * event system, including authentication, API, and loading events.
6
- */
7
-
8
- // Generic event system
9
- export interface SdkEvent {
10
- type: string;
11
- payload?: Record<string, unknown>;
12
- timestamp?: number;
13
- }
14
-
15
- export interface AuthEvent extends SdkEvent {
16
- type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
17
- payload?: {
18
- message?: string;
19
- error?: string;
20
- operation?: string;
21
- };
22
- }
23
-
24
- export interface ApiEvent extends SdkEvent {
25
- type: "api_request" | "api_response" | "api_error";
26
- payload?: {
27
- url?: string;
28
- method?: string;
29
- status?: number;
30
- duration?: number;
31
- error?: string;
32
- };
33
- }
34
-
35
- export interface LoadingEvent extends SdkEvent {
36
- type: "loading_start" | "loading_end";
37
- payload?: {
38
- operation?: string;
39
- resource?: string;
40
- };
41
- }
42
-
43
- export type EventCallback = (event: SdkEvent) => void;
@@ -1,28 +0,0 @@
1
- import type { ApiClient } from "../api/types";
2
- /**
3
- * Function-related types and interfaces
4
- */
5
-
6
- // Common options shared across all function types
7
- export interface FunctionOptions {
8
- /** Base URL for Zapier API */
9
- baseUrl?: string;
10
- /** Authentication token */
11
- token?: string;
12
- /** Function to dynamically resolve authentication token */
13
- getToken?: () => Promise<string | undefined>;
14
- /** Optional pre-instantiated API client */
15
- api?: ApiClient;
16
- /** Enable debug logging */
17
- debug?: boolean;
18
- /** Custom fetch implementation */
19
- fetch?: typeof globalThis.fetch;
20
- }
21
-
22
- // Generic type helper for paginated SDK functions
23
- export type PaginatedSdkFunction<TOptions, TItem> = (
24
- options: TOptions,
25
- ) => Promise<{ data: TItem[] }> &
26
- AsyncIterable<{ data: TItem[]; nextCursor?: string }> & {
27
- items(): AsyncIterable<TItem>;
28
- };
@@ -1,37 +0,0 @@
1
- // packages/zapier-sdk/types/cli-login-shim.d.ts
2
- declare module '@zapier/zapier-sdk-cli-login' {
3
- export interface AuthOptions {
4
- onEvent?: (event: {
5
- type: string;
6
- payload: Record<string, any>;
7
- timestamp: number;
8
- }) => void;
9
- fetch?: typeof globalThis.fetch;
10
- }
11
-
12
- export interface LoginData {
13
- access_token: string;
14
- refresh_token: string;
15
- expires_in: number;
16
- }
17
-
18
- // Minimal API — include only what your SDK actually uses.
19
- // (Keeping a few extra exports here is harmless and future-proofs a bit.)
20
- export function getToken(
21
- options?: AuthOptions
22
- ): Promise<string | undefined>;
23
-
24
- export function getValidJwt(
25
- options?: AuthOptions
26
- ): Promise<string | undefined>;
27
-
28
- export function getLoggedInUser(
29
- options?: AuthOptions
30
- ): Promise<{ accountId: number; customUserId: number; email: string }>;
31
-
32
- export function logout(options?: Pick<AuthOptions, 'onEvent'>): void;
33
-
34
- export function updateLogin(loginData: LoginData): void;
35
-
36
- export function getConfigPath(): string;
37
- }
@@ -1,125 +0,0 @@
1
- /**
2
- * ------------------------------
3
- * Plugin Type System with Explicit Context Dependencies
4
- * ------------------------------
5
- *
6
- * This system makes context dependencies explicit to restore TypeScript's
7
- * ability to catch missing context at compile time.
8
- */
9
-
10
- import type { z } from "zod";
11
- import type { BaseSdkOptions } from "./sdk";
12
-
13
- export interface PluginDependencies<TSdk = {}, TContext = {}> {
14
- sdk: TSdk;
15
- context: TContext;
16
- }
17
-
18
- // Plugin provides = sdk properties + optional context
19
- export interface PluginProvides extends Record<string, any> {
20
- context?: Record<string, any>;
21
- }
22
-
23
- export interface PluginMeta {
24
- categories: string[];
25
- type?: "list" | "item";
26
- itemType?: string;
27
- returnType?: string;
28
- inputSchema: z.ZodSchema;
29
- outputSchema?: z.ZodSchema;
30
- resolvers?: Record<string, any>;
31
- [key: string]: any;
32
- }
33
-
34
- // Utility type to extract SDK properties (everything except 'context')
35
- export type ExtractSdkProperties<T extends Record<string, any>> = Omit<
36
- T,
37
- "context"
38
- >;
39
-
40
- // Utility type to extract context properties from plugin
41
- export type ExtractContextProperties<T extends PluginProvides> = T["context"];
42
-
43
- // Helper type to create SDK type with properly typed getContext method
44
- export type GetSdkType<TPluginProvides extends PluginProvides> =
45
- ExtractSdkProperties<TPluginProvides> & {
46
- getContext(): NonNullable<ExtractContextProperties<TPluginProvides>>;
47
- };
48
-
49
- export type GetContextType<TPluginProvides extends PluginProvides> =
50
- NonNullable<ExtractContextProperties<TPluginProvides>>;
51
-
52
- // Helper type for standard plugin options with SDK dependency and meta context
53
- export type PluginOptions<TSdk = {}, TContext = {}> = {
54
- sdk: TSdk;
55
- context: TContext & { meta: Record<string, any> };
56
- };
57
-
58
- /**
59
- * Plugin interface — now has 3 type params:
60
- *
61
- * TRequiresContext = what this plugin *needs* in context
62
- * TProvides = what this plugin *returns* (sdk + context)
63
- * TSdk = current sdk shape when plugin runs
64
- */
65
- export interface Plugin<
66
- TSdk = {},
67
- TRequiresContext = {},
68
- TProvides extends PluginProvides = PluginProvides,
69
- > {
70
- (params: {
71
- sdk: TSdk;
72
- context: TRequiresContext & {
73
- meta: Record<string, PluginMeta>;
74
- options: BaseSdkOptions;
75
- };
76
- }): TProvides;
77
- }
78
-
79
- // Helper type to get missing keys from required context
80
- type MissingContextKeys<TRequired, TCurrent> =
81
- TRequired extends Record<string, any>
82
- ? TCurrent extends Record<string, any>
83
- ? {
84
- [K in keyof TRequired]: K extends keyof TCurrent ? never : K;
85
- }[keyof TRequired]
86
- : keyof TRequired
87
- : never;
88
-
89
- // Helper type to create detailed error message
90
- type ContextError<TRequired, TCurrent> =
91
- MissingContextKeys<TRequired, TCurrent> extends never
92
- ? never
93
- : MissingContextKeys<TRequired, TCurrent> extends infer Missing
94
- ? Missing extends string
95
- ? `❌ Missing required context: { ${Missing}: any }`
96
- : Missing extends number
97
- ? `❌ Missing required context: { ${Missing}: any }`
98
- : `❌ Missing required context properties. Required: ${keyof TRequired extends string ? keyof TRequired : "unknown"}, Available: ${keyof TCurrent extends string ? keyof TCurrent : "unknown"}`
99
- : "❌ Context requirement not satisfied";
100
-
101
- /**
102
- * SDK interface — result of createSdk()
103
- *
104
- * addPlugin now enforces that TRequiresContext is assignable to TCurrentContext.
105
- * If not, TypeScript will emit a detailed error showing missing properties.
106
- */
107
- export type Sdk<
108
- TCurrentSdk = {},
109
- TCurrentContext = { meta: Record<string, PluginMeta> },
110
- > = TCurrentSdk & {
111
- addPlugin<TRequiresContext, TProvides extends PluginProvides>(
112
- plugin: Plugin<
113
- TCurrentSdk & { getContext(): TCurrentContext },
114
- TRequiresContext,
115
- TProvides
116
- >,
117
- options?: any,
118
- ): TCurrentContext extends TRequiresContext
119
- ? Sdk<
120
- TCurrentSdk & ExtractSdkProperties<TProvides>,
121
- TCurrentContext & NonNullable<ExtractContextProperties<TProvides>>
122
- >
123
- : ContextError<TRequiresContext, TCurrentContext>;
124
- getContext(): TCurrentContext;
125
- };
@@ -1,80 +0,0 @@
1
- import { z } from "zod";
2
- import { withPositional } from "../utils/schema-utils";
3
- import { MAX_PAGE_LIMIT } from "../constants";
4
-
5
- // Shared property definitions for common parameters across functions
6
- // These can be reused in function schemas without duplication
7
-
8
- export const AppKeyPropertySchema = withPositional(
9
- z
10
- .string()
11
- .min(1)
12
- .describe("App key (e.g., 'SlackCLIAPI' or slug like 'github')"),
13
- );
14
-
15
- export const ActionTypePropertySchema = z
16
- .enum([
17
- "read",
18
- "read_bulk",
19
- "write",
20
- "run",
21
- "search",
22
- "search_or_write",
23
- "search_and_write",
24
- "filter",
25
- ])
26
- .describe("Action type that matches the action's defined type");
27
-
28
- export const ActionKeyPropertySchema = z
29
- .string()
30
- .min(1)
31
- .describe("Action key to execute");
32
-
33
- export const AuthenticationIdPropertySchema = z
34
- .number()
35
- .int()
36
- .describe("Authentication ID to use for this action");
37
-
38
- export const InputsPropertySchema = z
39
- .record(z.unknown())
40
- .describe("Input parameters for the action");
41
-
42
- export const LimitPropertySchema = z
43
- .number()
44
- .int()
45
- .min(1)
46
- .max(MAX_PAGE_LIMIT)
47
- .default(50)
48
- .describe("Maximum number of items to return");
49
-
50
- export const OffsetPropertySchema = z
51
- .number()
52
- .int()
53
- .min(0)
54
- .default(0)
55
- .describe("Number of items to skip for pagination");
56
-
57
- export const OutputPropertySchema = z.string().describe("Output file path");
58
-
59
- export const DebugPropertySchema = z
60
- .boolean()
61
- .default(false)
62
- .describe("Enable debug logging");
63
-
64
- export const ParamsPropertySchema = z
65
- .record(z.unknown())
66
- .describe("Additional parameters");
67
-
68
- // Inferred TypeScript types for the properties
69
- export type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
70
- export type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
71
- export type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
72
- export type AuthenticationIdProperty = z.infer<
73
- typeof AuthenticationIdPropertySchema
74
- >;
75
- export type InputsProperty = z.infer<typeof InputsPropertySchema>;
76
- export type LimitProperty = z.infer<typeof LimitPropertySchema>;
77
- export type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
78
- export type OutputProperty = z.infer<typeof OutputPropertySchema>;
79
- export type DebugProperty = z.infer<typeof DebugPropertySchema>;
80
- export type ParamsProperty = z.infer<typeof ParamsPropertySchema>;