@zapier/zapier-sdk 0.30.0 → 0.31.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.31.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4a874c6: Add Zod schema for base SDK options, autodoc generation for SDK factory options and CLI base command options
8
+
3
9
  ## 0.30.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  - [Documentation](#documentation)
7
7
  - [Installation](#installation)
8
8
  - [Quick Start](#quick-start)
9
+ - [Factory](#factory)
9
10
  - [Available Functions](#available-functions)
10
11
  - [Accounts](#accounts)
11
12
  - [`getProfile`](#getprofile)
@@ -289,6 +290,19 @@ const emojiData = await emojiResponse.json();
289
290
  console.log(emojiData.emoji);
290
291
  ```
291
292
 
293
+ ## Factory
294
+
295
+ The `createZapierSdk(...)` factory function is the main entry point for the SDK. It provides methods for managing connections, listing apps, running actions, and more.
296
+
297
+ | Name | Type | Required | Default | Possible Values | Description |
298
+ | ------------------------ | -------------------------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
299
+ | `credentials` | `string, object, function` | ❌ | — | — | Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those. |
300
+ | `debug` | `boolean` | ❌ | — | — | Enable debug logging. |
301
+ | `baseUrl` | `string` | ❌ | — | — | Base URL for Zapier API endpoints. |
302
+ | `trackingBaseUrl` | `string` | ❌ | — | — | Base URL for Zapier tracking endpoints. |
303
+ | `maxNetworkRetries` | `number` | ❌ | — | — | Max retries for rate-limited requests (default: 3). |
304
+ | `maxNetworkRetryDelayMs` | `number` | ❌ | — | — | Max delay in ms to wait for retry (default: 60000). |
305
+
292
306
  ## Available Functions
293
307
 
294
308
  ### Accounts
@@ -872,15 +886,15 @@ Make authenticated HTTP requests to any API through Zapier. Pass a connectionId
872
886
 
873
887
  **Parameters:**
874
888
 
875
- | Name | Type | Required | Default | Possible Values | Description |
876
- | ---------------- | -------------------------------- | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
877
- | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
878
- | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
879
- | ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
880
- | ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
881
- | ↳ `body` | `string, custom, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
882
- | ↳ `connectionId` | `string, number` | ❌ | — | — | Connection ID to use for this action |
883
- | ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
889
+ | Name | Type | Required | Default | Possible Values | Description |
890
+ | ---------------- | ------------------------ | -------- | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
891
+ | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's Relay service) |
892
+ | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
893
+ | ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
894
+ | ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
895
+ | ↳ `body` | `string, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
896
+ | ↳ `connectionId` | `string, number` | ❌ | — | — | Connection ID to use for this action |
897
+ | ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
884
898
 
885
899
  **Returns:** `Promise<Response>`
886
900
 
@@ -42,8 +42,8 @@ export declare const NeedSchema: z.ZodObject<{
42
42
  type: z.ZodOptional<z.ZodEnum<{
43
43
  string: "string";
44
44
  boolean: "boolean";
45
- filter: "filter";
46
45
  file: "file";
46
+ filter: "filter";
47
47
  integer: "integer";
48
48
  text: "text";
49
49
  datetime: "datetime";
@@ -286,8 +286,8 @@ export declare const NeedsResponseSchema: z.ZodObject<{
286
286
  type: z.ZodOptional<z.ZodEnum<{
287
287
  string: "string";
288
288
  boolean: "boolean";
289
- filter: "filter";
290
289
  file: "file";
290
+ filter: "filter";
291
291
  integer: "integer";
292
292
  text: "text";
293
293
  datetime: "datetime";
package/dist/index.cjs CHANGED
@@ -3919,8 +3919,34 @@ async function pollUntilComplete(options) {
3919
3919
  }
3920
3920
  }
3921
3921
  }
3922
-
3923
- // src/types/credentials.ts
3922
+ var ClientCredentialsObjectSchema = zod.z.object({
3923
+ type: zod.z.enum(["client_credentials"]).optional().meta({ internal: true }),
3924
+ clientId: zod.z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3925
+ clientSecret: zod.z.string().describe("OAuth client secret for authentication.").meta({ valueHint: "secret" }),
3926
+ baseUrl: zod.z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3927
+ scope: zod.z.string().optional().describe("Authentication scope.").meta({ internal: true })
3928
+ });
3929
+ var PkceCredentialsObjectSchema = zod.z.object({
3930
+ type: zod.z.enum(["pkce"]).optional().meta({ internal: true }),
3931
+ clientId: zod.z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3932
+ baseUrl: zod.z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3933
+ scope: zod.z.string().optional().describe("Authentication scope.").meta({ internal: true })
3934
+ });
3935
+ var CredentialsObjectSchema = zod.z.union([
3936
+ ClientCredentialsObjectSchema,
3937
+ PkceCredentialsObjectSchema
3938
+ ]);
3939
+ var ResolvedCredentialsSchema = zod.z.union([
3940
+ zod.z.string().describe("Authentication token.").meta({ valueHint: "token" }),
3941
+ CredentialsObjectSchema
3942
+ ]);
3943
+ var CredentialsFunctionSchema = zod.z.function().input([]).output(
3944
+ zod.z.union([ResolvedCredentialsSchema, zod.z.promise(ResolvedCredentialsSchema)])
3945
+ );
3946
+ var CredentialsSchema = zod.z.union([
3947
+ ResolvedCredentialsSchema,
3948
+ CredentialsFunctionSchema
3949
+ ]);
3924
3950
  function isClientCredentials(credentials) {
3925
3951
  return typeof credentials === "object" && credentials !== null && "clientId" in credentials && "clientSecret" in credentials;
3926
3952
  }
@@ -5402,7 +5428,7 @@ function getCpuTime() {
5402
5428
 
5403
5429
  // package.json
5404
5430
  var package_default = {
5405
- version: "0.30.0"};
5431
+ version: "0.31.0"};
5406
5432
 
5407
5433
  // src/plugins/eventEmission/builders.ts
5408
5434
  function createBaseEvent(context = {}) {
@@ -5861,13 +5887,46 @@ function createZapierSdkWithoutRegistry(options = {}) {
5861
5887
  function createZapierSdk(options = {}) {
5862
5888
  return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
5863
5889
  }
5890
+ var BaseSdkOptionsSchema = zod.z.object({
5891
+ credentials: CredentialsSchema.optional().describe(
5892
+ "Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those."
5893
+ ),
5894
+ debug: zod.z.boolean().optional().describe("Enable debug logging."),
5895
+ baseUrl: zod.z.string().optional().describe("Base URL for Zapier API endpoints.").meta({ valueHint: "url" }),
5896
+ trackingBaseUrl: zod.z.string().optional().describe("Base URL for Zapier tracking endpoints.").meta({ valueHint: "url" }),
5897
+ /**
5898
+ * Maximum number of retries for rate-limited requests (429 responses).
5899
+ * Set to 0 to disable retries. Default is 3.
5900
+ */
5901
+ maxNetworkRetries: zod.z.number().optional().describe("Max retries for rate-limited requests (default: 3).").meta({ valueHint: "count" }),
5902
+ /**
5903
+ * Maximum delay in milliseconds to wait for a rate limit retry.
5904
+ * If the server requests a longer delay, the request fails immediately.
5905
+ * Default is 60000 (60 seconds).
5906
+ */
5907
+ maxNetworkRetryDelayMs: zod.z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
5908
+ // Internal
5909
+ manifestPath: zod.z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
5910
+ manifest: zod.z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
5911
+ onEvent: zod.z.custom().optional().meta({ internal: true }),
5912
+ fetch: zod.z.custom().optional().meta({ internal: true }),
5913
+ eventEmission: zod.z.custom().optional().meta({ internal: true }),
5914
+ // Deprecated
5915
+ token: zod.z.string().optional().meta({ deprecated: true })
5916
+ // Use credentials instead
5917
+ });
5864
5918
 
5865
5919
  exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
5866
5920
  exports.ActionTimeoutMsPropertySchema = ActionTimeoutMsPropertySchema;
5867
5921
  exports.ActionTypePropertySchema = ActionTypePropertySchema;
5868
5922
  exports.AppKeyPropertySchema = AppKeyPropertySchema;
5869
5923
  exports.AuthenticationIdPropertySchema = AuthenticationIdPropertySchema;
5924
+ exports.BaseSdkOptionsSchema = BaseSdkOptionsSchema;
5925
+ exports.ClientCredentialsObjectSchema = ClientCredentialsObjectSchema;
5870
5926
  exports.ConnectionIdPropertySchema = ConnectionIdPropertySchema;
5927
+ exports.CredentialsFunctionSchema = CredentialsFunctionSchema;
5928
+ exports.CredentialsObjectSchema = CredentialsObjectSchema;
5929
+ exports.CredentialsSchema = CredentialsSchema;
5871
5930
  exports.DEFAULT_ACTION_TIMEOUT_MS = DEFAULT_ACTION_TIMEOUT_MS;
5872
5931
  exports.DEFAULT_CONFIG_PATH = DEFAULT_CONFIG_PATH;
5873
5932
  exports.DebugPropertySchema = DebugPropertySchema;
@@ -5877,8 +5936,10 @@ exports.MAX_PAGE_LIMIT = MAX_PAGE_LIMIT;
5877
5936
  exports.OffsetPropertySchema = OffsetPropertySchema;
5878
5937
  exports.OutputPropertySchema = OutputPropertySchema;
5879
5938
  exports.ParamsPropertySchema = ParamsPropertySchema;
5939
+ exports.PkceCredentialsObjectSchema = PkceCredentialsObjectSchema;
5880
5940
  exports.RelayFetchSchema = RelayFetchSchema;
5881
5941
  exports.RelayRequestSchema = RelayRequestSchema;
5942
+ exports.ResolvedCredentialsSchema = ResolvedCredentialsSchema;
5882
5943
  exports.ZAPIER_AUTH_BASE_URL = ZAPIER_AUTH_BASE_URL;
5883
5944
  exports.ZAPIER_AUTH_CLIENT_ID = ZAPIER_AUTH_CLIENT_ID;
5884
5945
  exports.ZAPIER_BASE_URL = ZAPIER_BASE_URL;
package/dist/index.d.mts CHANGED
@@ -399,44 +399,164 @@ interface EventEmissionProvides {
399
399
  * - PKCE: OAuth client ID for interactive login (CLI only)
400
400
  * - Function: Lazy/dynamic credential resolution
401
401
  */
402
+
402
403
  /**
403
404
  * Client credentials for OAuth client_credentials flow.
404
405
  * The SDK will exchange these for an access token.
405
406
  */
406
- interface ClientCredentialsObject {
407
- type?: "client_credentials";
408
- clientId: string;
409
- clientSecret: string;
410
- baseUrl?: string;
411
- scope?: string;
412
- }
407
+ declare const ClientCredentialsObjectSchema: z.ZodObject<{
408
+ type: z.ZodOptional<z.ZodEnum<{
409
+ client_credentials: "client_credentials";
410
+ }>>;
411
+ clientId: z.ZodString;
412
+ clientSecret: z.ZodString;
413
+ baseUrl: z.ZodOptional<z.ZodString>;
414
+ scope: z.ZodOptional<z.ZodString>;
415
+ }, z.core.$strip>;
416
+ type ClientCredentialsObject = z.infer<typeof ClientCredentialsObjectSchema>;
413
417
  /**
414
418
  * PKCE credentials for interactive OAuth flow.
415
419
  * Only works when @zapier/zapier-sdk-cli-login is available.
416
420
  */
417
- interface PkceCredentialsObject {
418
- type?: "pkce";
419
- clientId: string;
420
- baseUrl?: string;
421
- scope?: string;
422
- }
421
+ declare const PkceCredentialsObjectSchema: z.ZodObject<{
422
+ type: z.ZodOptional<z.ZodEnum<{
423
+ pkce: "pkce";
424
+ }>>;
425
+ clientId: z.ZodString;
426
+ baseUrl: z.ZodOptional<z.ZodString>;
427
+ scope: z.ZodOptional<z.ZodString>;
428
+ }, z.core.$strip>;
429
+ type PkceCredentialsObject = z.infer<typeof PkceCredentialsObjectSchema>;
423
430
  /**
424
431
  * Union of all credential object types.
425
432
  */
426
- type CredentialsObject = ClientCredentialsObject | PkceCredentialsObject;
433
+ declare const CredentialsObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
434
+ type: z.ZodOptional<z.ZodEnum<{
435
+ client_credentials: "client_credentials";
436
+ }>>;
437
+ clientId: z.ZodString;
438
+ clientSecret: z.ZodString;
439
+ baseUrl: z.ZodOptional<z.ZodString>;
440
+ scope: z.ZodOptional<z.ZodString>;
441
+ }, z.core.$strip>, z.ZodObject<{
442
+ type: z.ZodOptional<z.ZodEnum<{
443
+ pkce: "pkce";
444
+ }>>;
445
+ clientId: z.ZodString;
446
+ baseUrl: z.ZodOptional<z.ZodString>;
447
+ scope: z.ZodOptional<z.ZodString>;
448
+ }, z.core.$strip>]>;
449
+ type CredentialsObject = z.infer<typeof CredentialsObjectSchema>;
427
450
  /**
428
451
  * Resolved credentials - what a credentials function must return.
429
452
  * Either a string (token) or a credentials object.
430
453
  * Functions are not allowed to return other functions.
431
454
  */
432
- type ResolvedCredentials = string | CredentialsObject;
455
+ declare const ResolvedCredentialsSchema: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
456
+ type: z.ZodOptional<z.ZodEnum<{
457
+ client_credentials: "client_credentials";
458
+ }>>;
459
+ clientId: z.ZodString;
460
+ clientSecret: z.ZodString;
461
+ baseUrl: z.ZodOptional<z.ZodString>;
462
+ scope: z.ZodOptional<z.ZodString>;
463
+ }, z.core.$strip>, z.ZodObject<{
464
+ type: z.ZodOptional<z.ZodEnum<{
465
+ pkce: "pkce";
466
+ }>>;
467
+ clientId: z.ZodString;
468
+ baseUrl: z.ZodOptional<z.ZodString>;
469
+ scope: z.ZodOptional<z.ZodString>;
470
+ }, z.core.$strip>]>]>;
471
+ type ResolvedCredentials = z.infer<typeof ResolvedCredentialsSchema>;
472
+ /**
473
+ * Lazy/dynamic credential resolution — a function returning resolved credentials.
474
+ */
475
+ declare const CredentialsFunctionSchema: z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
476
+ type: z.ZodOptional<z.ZodEnum<{
477
+ client_credentials: "client_credentials";
478
+ }>>;
479
+ clientId: z.ZodString;
480
+ clientSecret: z.ZodString;
481
+ baseUrl: z.ZodOptional<z.ZodString>;
482
+ scope: z.ZodOptional<z.ZodString>;
483
+ }, z.core.$strip>, z.ZodObject<{
484
+ type: z.ZodOptional<z.ZodEnum<{
485
+ pkce: "pkce";
486
+ }>>;
487
+ clientId: z.ZodString;
488
+ baseUrl: z.ZodOptional<z.ZodString>;
489
+ scope: z.ZodOptional<z.ZodString>;
490
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
491
+ type: z.ZodOptional<z.ZodEnum<{
492
+ client_credentials: "client_credentials";
493
+ }>>;
494
+ clientId: z.ZodString;
495
+ clientSecret: z.ZodString;
496
+ baseUrl: z.ZodOptional<z.ZodString>;
497
+ scope: z.ZodOptional<z.ZodString>;
498
+ }, z.core.$strip>, z.ZodObject<{
499
+ type: z.ZodOptional<z.ZodEnum<{
500
+ pkce: "pkce";
501
+ }>>;
502
+ clientId: z.ZodString;
503
+ baseUrl: z.ZodOptional<z.ZodString>;
504
+ scope: z.ZodOptional<z.ZodString>;
505
+ }, z.core.$strip>]>]>>]>>;
506
+ type CredentialsFunction = z.infer<typeof CredentialsFunctionSchema>;
433
507
  /**
434
508
  * Credentials can be:
435
509
  * - A string (token or API key)
436
510
  * - A credentials object (client_credentials or pkce)
437
511
  * - A function that returns credentials (sync or async)
438
512
  */
439
- type Credentials = ResolvedCredentials | (() => ResolvedCredentials | Promise<ResolvedCredentials>);
513
+ declare const CredentialsSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
514
+ type: z.ZodOptional<z.ZodEnum<{
515
+ client_credentials: "client_credentials";
516
+ }>>;
517
+ clientId: z.ZodString;
518
+ clientSecret: z.ZodString;
519
+ baseUrl: z.ZodOptional<z.ZodString>;
520
+ scope: z.ZodOptional<z.ZodString>;
521
+ }, z.core.$strip>, z.ZodObject<{
522
+ type: z.ZodOptional<z.ZodEnum<{
523
+ pkce: "pkce";
524
+ }>>;
525
+ clientId: z.ZodString;
526
+ baseUrl: z.ZodOptional<z.ZodString>;
527
+ scope: z.ZodOptional<z.ZodString>;
528
+ }, z.core.$strip>]>]>, z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
529
+ type: z.ZodOptional<z.ZodEnum<{
530
+ client_credentials: "client_credentials";
531
+ }>>;
532
+ clientId: z.ZodString;
533
+ clientSecret: z.ZodString;
534
+ baseUrl: z.ZodOptional<z.ZodString>;
535
+ scope: z.ZodOptional<z.ZodString>;
536
+ }, z.core.$strip>, z.ZodObject<{
537
+ type: z.ZodOptional<z.ZodEnum<{
538
+ pkce: "pkce";
539
+ }>>;
540
+ clientId: z.ZodString;
541
+ baseUrl: z.ZodOptional<z.ZodString>;
542
+ scope: z.ZodOptional<z.ZodString>;
543
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
544
+ type: z.ZodOptional<z.ZodEnum<{
545
+ client_credentials: "client_credentials";
546
+ }>>;
547
+ clientId: z.ZodString;
548
+ clientSecret: z.ZodString;
549
+ baseUrl: z.ZodOptional<z.ZodString>;
550
+ scope: z.ZodOptional<z.ZodString>;
551
+ }, z.core.$strip>, z.ZodObject<{
552
+ type: z.ZodOptional<z.ZodEnum<{
553
+ pkce: "pkce";
554
+ }>>;
555
+ clientId: z.ZodString;
556
+ baseUrl: z.ZodOptional<z.ZodString>;
557
+ scope: z.ZodOptional<z.ZodString>;
558
+ }, z.core.$strip>]>]>>]>>]>;
559
+ type Credentials = z.infer<typeof CredentialsSchema>;
440
560
  /**
441
561
  * Type guard for client credentials objects.
442
562
  */
@@ -452,7 +572,7 @@ declare function isCredentialsObject(credentials: ResolvedCredentials): credenti
452
572
  /**
453
573
  * Type guard for credentials functions.
454
574
  */
455
- declare function isCredentialsFunction(credentials: Credentials): credentials is () => ResolvedCredentials | Promise<ResolvedCredentials>;
575
+ declare function isCredentialsFunction(credentials: Credentials): credentials is CredentialsFunction;
456
576
 
457
577
  declare const NeedSchema: z.ZodObject<{
458
578
  key: z.ZodString;
@@ -1127,8 +1247,8 @@ declare const GetConnectionParamSchema: z.ZodObject<{
1127
1247
  type GetConnectionParam = z.infer<typeof GetConnectionParamSchema>;
1128
1248
 
1129
1249
  declare const FindFirstConnectionSchema: z.ZodObject<{
1130
- search: z.ZodOptional<z.ZodString>;
1131
1250
  title: z.ZodOptional<z.ZodString>;
1251
+ search: z.ZodOptional<z.ZodString>;
1132
1252
  appKey: z.ZodOptional<z.ZodString & {
1133
1253
  _def: z.core.$ZodStringDef & PositionalMetadata;
1134
1254
  }>;
@@ -1140,8 +1260,8 @@ declare const FindFirstConnectionSchema: z.ZodObject<{
1140
1260
  type FindFirstConnectionOptions = z.infer<typeof FindFirstConnectionSchema>;
1141
1261
 
1142
1262
  declare const FindUniqueConnectionSchema: z.ZodObject<{
1143
- search: z.ZodOptional<z.ZodString>;
1144
1263
  title: z.ZodOptional<z.ZodString>;
1264
+ search: z.ZodOptional<z.ZodString>;
1145
1265
  appKey: z.ZodOptional<z.ZodString & {
1146
1266
  _def: z.core.$ZodStringDef & PositionalMetadata;
1147
1267
  }>;
@@ -1568,8 +1688,8 @@ interface ZapierSdkApps {
1568
1688
  }
1569
1689
 
1570
1690
  declare const ListConnectionsQuerySchema: z.ZodObject<{
1571
- search: z.ZodOptional<z.ZodString>;
1572
1691
  title: z.ZodOptional<z.ZodString>;
1692
+ search: z.ZodOptional<z.ZodString>;
1573
1693
  owner: z.ZodOptional<z.ZodString>;
1574
1694
  appKey: z.ZodOptional<z.ZodString & {
1575
1695
  _def: z.core.$ZodStringDef & PositionalMetadata;
@@ -1739,8 +1859,8 @@ declare const listClientCredentialsPlugin: Plugin<{}, {
1739
1859
  declare const CreateClientCredentialsSchema: z.ZodObject<{
1740
1860
  name: z.ZodString;
1741
1861
  allowedScopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1742
- external: "external";
1743
1862
  credentials: "credentials";
1863
+ external: "external";
1744
1864
  }>>>;
1745
1865
  }, z.core.$strip>;
1746
1866
  type CreateClientCredentialsOptions = z.infer<typeof CreateClientCredentialsSchema> & FunctionOptions;
@@ -1918,39 +2038,66 @@ RequestPluginProvides>;
1918
2038
  * SDK-related types and interfaces
1919
2039
  */
1920
2040
 
1921
- interface BaseSdkOptions {
1922
- /**
1923
- * Authentication credentials. Can be:
1924
- * - A string (token or API key)
1925
- * - An object with clientId/clientSecret for client_credentials flow
1926
- * - An object with clientId (no secret) for PKCE flow
1927
- * - A function returning any of the above
1928
- */
1929
- credentials?: Credentials;
1930
- /**
1931
- * @deprecated Use `credentials` instead.
1932
- */
1933
- token?: string;
1934
- onEvent?: EventCallback;
1935
- fetch?: typeof fetch;
1936
- baseUrl?: string;
1937
- trackingBaseUrl?: string;
1938
- debug?: boolean;
1939
- manifestPath?: string;
1940
- manifest?: Manifest;
1941
- eventEmission?: EventEmissionConfig;
1942
- /**
1943
- * Maximum number of retries for rate-limited requests (429 responses).
1944
- * Set to 0 to disable retries. Default is 3.
1945
- */
1946
- maxNetworkRetries?: number;
1947
- /**
1948
- * Maximum delay in milliseconds to wait for a rate limit retry.
1949
- * If the server requests a longer delay, the request fails immediately.
1950
- * Default is 60000 (60 seconds).
1951
- */
1952
- maxNetworkRetryDelayMs?: number;
1953
- }
2041
+ declare const BaseSdkOptionsSchema: z.ZodObject<{
2042
+ credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
2043
+ type: z.ZodOptional<z.ZodEnum<{
2044
+ client_credentials: "client_credentials";
2045
+ }>>;
2046
+ clientId: z.ZodString;
2047
+ clientSecret: z.ZodString;
2048
+ baseUrl: z.ZodOptional<z.ZodString>;
2049
+ scope: z.ZodOptional<z.ZodString>;
2050
+ }, z.core.$strip>, z.ZodObject<{
2051
+ type: z.ZodOptional<z.ZodEnum<{
2052
+ pkce: "pkce";
2053
+ }>>;
2054
+ clientId: z.ZodString;
2055
+ baseUrl: z.ZodOptional<z.ZodString>;
2056
+ scope: z.ZodOptional<z.ZodString>;
2057
+ }, z.core.$strip>]>]>, z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
2058
+ type: z.ZodOptional<z.ZodEnum<{
2059
+ client_credentials: "client_credentials";
2060
+ }>>;
2061
+ clientId: z.ZodString;
2062
+ clientSecret: z.ZodString;
2063
+ baseUrl: z.ZodOptional<z.ZodString>;
2064
+ scope: z.ZodOptional<z.ZodString>;
2065
+ }, z.core.$strip>, z.ZodObject<{
2066
+ type: z.ZodOptional<z.ZodEnum<{
2067
+ pkce: "pkce";
2068
+ }>>;
2069
+ clientId: z.ZodString;
2070
+ baseUrl: z.ZodOptional<z.ZodString>;
2071
+ scope: z.ZodOptional<z.ZodString>;
2072
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
2073
+ type: z.ZodOptional<z.ZodEnum<{
2074
+ client_credentials: "client_credentials";
2075
+ }>>;
2076
+ clientId: z.ZodString;
2077
+ clientSecret: z.ZodString;
2078
+ baseUrl: z.ZodOptional<z.ZodString>;
2079
+ scope: z.ZodOptional<z.ZodString>;
2080
+ }, z.core.$strip>, z.ZodObject<{
2081
+ type: z.ZodOptional<z.ZodEnum<{
2082
+ pkce: "pkce";
2083
+ }>>;
2084
+ clientId: z.ZodString;
2085
+ baseUrl: z.ZodOptional<z.ZodString>;
2086
+ scope: z.ZodOptional<z.ZodString>;
2087
+ }, z.core.$strip>]>]>>]>>]>>;
2088
+ debug: z.ZodOptional<z.ZodBoolean>;
2089
+ baseUrl: z.ZodOptional<z.ZodString>;
2090
+ trackingBaseUrl: z.ZodOptional<z.ZodString>;
2091
+ maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
2092
+ maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
2093
+ manifestPath: z.ZodOptional<z.ZodString>;
2094
+ manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
2095
+ onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
2096
+ fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
2097
+ eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
2098
+ token: z.ZodOptional<z.ZodString>;
2099
+ }, z.core.$strip>;
2100
+ type BaseSdkOptions = z.infer<typeof BaseSdkOptionsSchema>;
1954
2101
 
1955
2102
  interface FunctionRegistryEntry {
1956
2103
  name: string;
@@ -2166,8 +2313,8 @@ type ConnectionItem$1 = z.infer<typeof ConnectionItemSchema>;
2166
2313
 
2167
2314
  declare const ActionItemSchema: z.ZodObject<{
2168
2315
  description: z.ZodString;
2169
- key: z.ZodString;
2170
2316
  id: z.ZodOptional<z.ZodString>;
2317
+ key: z.ZodString;
2171
2318
  is_important: z.ZodOptional<z.ZodBoolean>;
2172
2319
  is_hidden: z.ZodOptional<z.ZodBoolean>;
2173
2320
  app_key: z.ZodString;
@@ -2799,4 +2946,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
2799
2946
  }>;
2800
2947
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
2801
2948
 
2802
- export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, type BatchOptions, type Choice, type ClientCredentialsObject, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type Credentials, type CredentialsObject, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UserProfile, type UserProfileItem, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
2949
+ export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UserProfile, type UserProfileItem, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./constants";
38
38
  export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas";
39
39
  export { createZapierSdk, createZapierSdkWithoutRegistry, createSdk, ZapierSdkOptions, } from "./sdk";
40
40
  export type { FunctionRegistryEntry } from "./types/sdk";
41
+ export { BaseSdkOptionsSchema } from "./types/sdk";
41
42
  export type { Plugin, PluginProvides, PluginDependencies, PluginOptions, GetSdkType, GetContextType, Sdk, } from "./types/plugin";
42
43
  export { registryPlugin } from "./plugins/registry";
43
44
  export type { ZapierSdk } from "./types/sdk";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,sCAAsC,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,aAAa,CAAC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,EACf,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ export * from "./constants";
45
45
  export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas";
46
46
  // Export the main combined SDK and new flexible SDK creator
47
47
  export { createZapierSdk, createZapierSdkWithoutRegistry, createSdk, } from "./sdk";
48
+ export { BaseSdkOptionsSchema } from "./types/sdk";
48
49
  // Export registry plugin for manual use
49
50
  export { registryPlugin } from "./plugins/registry";
50
51
  export { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, isCi, getCiPlatform, getMemoryUsage, getCpuTime, buildApplicationLifecycleEvent, buildErrorEventWithContext, buildErrorEvent, createBaseEvent, buildMethodCalledEvent, } from "./plugins/eventEmission";
package/dist/index.mjs CHANGED
@@ -3897,8 +3897,34 @@ async function pollUntilComplete(options) {
3897
3897
  }
3898
3898
  }
3899
3899
  }
3900
-
3901
- // src/types/credentials.ts
3900
+ var ClientCredentialsObjectSchema = z.object({
3901
+ type: z.enum(["client_credentials"]).optional().meta({ internal: true }),
3902
+ clientId: z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3903
+ clientSecret: z.string().describe("OAuth client secret for authentication.").meta({ valueHint: "secret" }),
3904
+ baseUrl: z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3905
+ scope: z.string().optional().describe("Authentication scope.").meta({ internal: true })
3906
+ });
3907
+ var PkceCredentialsObjectSchema = z.object({
3908
+ type: z.enum(["pkce"]).optional().meta({ internal: true }),
3909
+ clientId: z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3910
+ baseUrl: z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3911
+ scope: z.string().optional().describe("Authentication scope.").meta({ internal: true })
3912
+ });
3913
+ var CredentialsObjectSchema = z.union([
3914
+ ClientCredentialsObjectSchema,
3915
+ PkceCredentialsObjectSchema
3916
+ ]);
3917
+ var ResolvedCredentialsSchema = z.union([
3918
+ z.string().describe("Authentication token.").meta({ valueHint: "token" }),
3919
+ CredentialsObjectSchema
3920
+ ]);
3921
+ var CredentialsFunctionSchema = z.function().input([]).output(
3922
+ z.union([ResolvedCredentialsSchema, z.promise(ResolvedCredentialsSchema)])
3923
+ );
3924
+ var CredentialsSchema = z.union([
3925
+ ResolvedCredentialsSchema,
3926
+ CredentialsFunctionSchema
3927
+ ]);
3902
3928
  function isClientCredentials(credentials) {
3903
3929
  return typeof credentials === "object" && credentials !== null && "clientId" in credentials && "clientSecret" in credentials;
3904
3930
  }
@@ -5380,7 +5406,7 @@ function getCpuTime() {
5380
5406
 
5381
5407
  // package.json
5382
5408
  var package_default = {
5383
- version: "0.30.0"};
5409
+ version: "0.31.0"};
5384
5410
 
5385
5411
  // src/plugins/eventEmission/builders.ts
5386
5412
  function createBaseEvent(context = {}) {
@@ -5839,5 +5865,33 @@ function createZapierSdkWithoutRegistry(options = {}) {
5839
5865
  function createZapierSdk(options = {}) {
5840
5866
  return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
5841
5867
  }
5868
+ var BaseSdkOptionsSchema = z.object({
5869
+ credentials: CredentialsSchema.optional().describe(
5870
+ "Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those."
5871
+ ),
5872
+ debug: z.boolean().optional().describe("Enable debug logging."),
5873
+ baseUrl: z.string().optional().describe("Base URL for Zapier API endpoints.").meta({ valueHint: "url" }),
5874
+ trackingBaseUrl: z.string().optional().describe("Base URL for Zapier tracking endpoints.").meta({ valueHint: "url" }),
5875
+ /**
5876
+ * Maximum number of retries for rate-limited requests (429 responses).
5877
+ * Set to 0 to disable retries. Default is 3.
5878
+ */
5879
+ maxNetworkRetries: z.number().optional().describe("Max retries for rate-limited requests (default: 3).").meta({ valueHint: "count" }),
5880
+ /**
5881
+ * Maximum delay in milliseconds to wait for a rate limit retry.
5882
+ * If the server requests a longer delay, the request fails immediately.
5883
+ * Default is 60000 (60 seconds).
5884
+ */
5885
+ maxNetworkRetryDelayMs: z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
5886
+ // Internal
5887
+ manifestPath: z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
5888
+ manifest: z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
5889
+ onEvent: z.custom().optional().meta({ internal: true }),
5890
+ fetch: z.custom().optional().meta({ internal: true }),
5891
+ eventEmission: z.custom().optional().meta({ internal: true }),
5892
+ // Deprecated
5893
+ token: z.string().optional().meta({ deprecated: true })
5894
+ // Use credentials instead
5895
+ });
5842
5896
 
5843
- export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, ConnectionIdPropertySchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, RelayFetchSchema, RelayRequestSchema, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
5897
+ export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, ClientCredentialsObjectSchema, ConnectionIdPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, ZAPIER_AUTH_BASE_URL, ZAPIER_AUTH_CLIENT_ID, ZAPIER_BASE_URL, ZAPIER_CREDENTIALS, ZAPIER_CREDENTIALS_BASE_URL, ZAPIER_CREDENTIALS_CLIENT_ID, ZAPIER_CREDENTIALS_CLIENT_SECRET, ZAPIER_CREDENTIALS_SCOPE, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZAPIER_TOKEN, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, toSnakeCase, toTitleCase };
@@ -2,8 +2,8 @@ import type { z } from "zod";
2
2
  import type { ConnectionItem } from "../../types/domain";
3
3
  import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
4
4
  export declare const FindFirstConnectionSchema: z.ZodObject<{
5
- search: z.ZodOptional<z.ZodString>;
6
5
  title: z.ZodOptional<z.ZodString>;
6
+ search: z.ZodOptional<z.ZodString>;
7
7
  appKey: z.ZodOptional<z.ZodString & {
8
8
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
9
9
  }>;
@@ -2,8 +2,8 @@ import type { z } from "zod";
2
2
  import type { ConnectionItem } from "../../types/domain";
3
3
  import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
4
4
  export declare const FindUniqueConnectionSchema: z.ZodObject<{
5
- search: z.ZodOptional<z.ZodString>;
6
5
  title: z.ZodOptional<z.ZodString>;
6
+ search: z.ZodOptional<z.ZodString>;
7
7
  appKey: z.ZodOptional<z.ZodString & {
8
8
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
9
9
  }>;
@@ -3,8 +3,8 @@ import type { PaginatedSdkFunction } from "../../types/functions";
3
3
  import type { ConnectionItem } from "@zapier/zapier-sdk-core/v0/schemas/connections";
4
4
  import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
5
5
  export declare const ListConnectionsQuerySchema: z.ZodObject<{
6
- search: z.ZodOptional<z.ZodString>;
7
6
  title: z.ZodOptional<z.ZodString>;
7
+ search: z.ZodOptional<z.ZodString>;
8
8
  owner: z.ZodOptional<z.ZodString>;
9
9
  appKey: z.ZodOptional<z.ZodString & {
10
10
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const ActionItemSchema: z.ZodObject<{
3
- key: z.ZodString;
4
- description: z.ZodString;
5
3
  id: z.ZodOptional<z.ZodString>;
4
+ description: z.ZodString;
5
+ key: z.ZodString;
6
6
  is_important: z.ZodOptional<z.ZodBoolean>;
7
7
  is_hidden: z.ZodOptional<z.ZodBoolean>;
8
8
  app_key: z.ZodString;
@@ -8,44 +8,164 @@
8
8
  * - PKCE: OAuth client ID for interactive login (CLI only)
9
9
  * - Function: Lazy/dynamic credential resolution
10
10
  */
11
+ import { z } from "zod";
11
12
  /**
12
13
  * Client credentials for OAuth client_credentials flow.
13
14
  * The SDK will exchange these for an access token.
14
15
  */
15
- export interface ClientCredentialsObject {
16
- type?: "client_credentials";
17
- clientId: string;
18
- clientSecret: string;
19
- baseUrl?: string;
20
- scope?: string;
21
- }
16
+ export declare const ClientCredentialsObjectSchema: z.ZodObject<{
17
+ type: z.ZodOptional<z.ZodEnum<{
18
+ client_credentials: "client_credentials";
19
+ }>>;
20
+ clientId: z.ZodString;
21
+ clientSecret: z.ZodString;
22
+ baseUrl: z.ZodOptional<z.ZodString>;
23
+ scope: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ export type ClientCredentialsObject = z.infer<typeof ClientCredentialsObjectSchema>;
22
26
  /**
23
27
  * PKCE credentials for interactive OAuth flow.
24
28
  * Only works when @zapier/zapier-sdk-cli-login is available.
25
29
  */
26
- export interface PkceCredentialsObject {
27
- type?: "pkce";
28
- clientId: string;
29
- baseUrl?: string;
30
- scope?: string;
31
- }
30
+ export declare const PkceCredentialsObjectSchema: z.ZodObject<{
31
+ type: z.ZodOptional<z.ZodEnum<{
32
+ pkce: "pkce";
33
+ }>>;
34
+ clientId: z.ZodString;
35
+ baseUrl: z.ZodOptional<z.ZodString>;
36
+ scope: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strip>;
38
+ export type PkceCredentialsObject = z.infer<typeof PkceCredentialsObjectSchema>;
32
39
  /**
33
40
  * Union of all credential object types.
34
41
  */
35
- export type CredentialsObject = ClientCredentialsObject | PkceCredentialsObject;
42
+ export declare const CredentialsObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
43
+ type: z.ZodOptional<z.ZodEnum<{
44
+ client_credentials: "client_credentials";
45
+ }>>;
46
+ clientId: z.ZodString;
47
+ clientSecret: z.ZodString;
48
+ baseUrl: z.ZodOptional<z.ZodString>;
49
+ scope: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ type: z.ZodOptional<z.ZodEnum<{
52
+ pkce: "pkce";
53
+ }>>;
54
+ clientId: z.ZodString;
55
+ baseUrl: z.ZodOptional<z.ZodString>;
56
+ scope: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>]>;
58
+ export type CredentialsObject = z.infer<typeof CredentialsObjectSchema>;
36
59
  /**
37
60
  * Resolved credentials - what a credentials function must return.
38
61
  * Either a string (token) or a credentials object.
39
62
  * Functions are not allowed to return other functions.
40
63
  */
41
- export type ResolvedCredentials = string | CredentialsObject;
64
+ export declare const ResolvedCredentialsSchema: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
65
+ type: z.ZodOptional<z.ZodEnum<{
66
+ client_credentials: "client_credentials";
67
+ }>>;
68
+ clientId: z.ZodString;
69
+ clientSecret: z.ZodString;
70
+ baseUrl: z.ZodOptional<z.ZodString>;
71
+ scope: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ type: z.ZodOptional<z.ZodEnum<{
74
+ pkce: "pkce";
75
+ }>>;
76
+ clientId: z.ZodString;
77
+ baseUrl: z.ZodOptional<z.ZodString>;
78
+ scope: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>]>]>;
80
+ export type ResolvedCredentials = z.infer<typeof ResolvedCredentialsSchema>;
81
+ /**
82
+ * Lazy/dynamic credential resolution — a function returning resolved credentials.
83
+ */
84
+ export declare const CredentialsFunctionSchema: z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
85
+ type: z.ZodOptional<z.ZodEnum<{
86
+ client_credentials: "client_credentials";
87
+ }>>;
88
+ clientId: z.ZodString;
89
+ clientSecret: z.ZodString;
90
+ baseUrl: z.ZodOptional<z.ZodString>;
91
+ scope: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>, z.ZodObject<{
93
+ type: z.ZodOptional<z.ZodEnum<{
94
+ pkce: "pkce";
95
+ }>>;
96
+ clientId: z.ZodString;
97
+ baseUrl: z.ZodOptional<z.ZodString>;
98
+ scope: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
100
+ type: z.ZodOptional<z.ZodEnum<{
101
+ client_credentials: "client_credentials";
102
+ }>>;
103
+ clientId: z.ZodString;
104
+ clientSecret: z.ZodString;
105
+ baseUrl: z.ZodOptional<z.ZodString>;
106
+ scope: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strip>, z.ZodObject<{
108
+ type: z.ZodOptional<z.ZodEnum<{
109
+ pkce: "pkce";
110
+ }>>;
111
+ clientId: z.ZodString;
112
+ baseUrl: z.ZodOptional<z.ZodString>;
113
+ scope: z.ZodOptional<z.ZodString>;
114
+ }, z.core.$strip>]>]>>]>>;
115
+ export type CredentialsFunction = z.infer<typeof CredentialsFunctionSchema>;
42
116
  /**
43
117
  * Credentials can be:
44
118
  * - A string (token or API key)
45
119
  * - A credentials object (client_credentials or pkce)
46
120
  * - A function that returns credentials (sync or async)
47
121
  */
48
- export type Credentials = ResolvedCredentials | (() => ResolvedCredentials | Promise<ResolvedCredentials>);
122
+ export declare const CredentialsSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
123
+ type: z.ZodOptional<z.ZodEnum<{
124
+ client_credentials: "client_credentials";
125
+ }>>;
126
+ clientId: z.ZodString;
127
+ clientSecret: z.ZodString;
128
+ baseUrl: z.ZodOptional<z.ZodString>;
129
+ scope: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ type: z.ZodOptional<z.ZodEnum<{
132
+ pkce: "pkce";
133
+ }>>;
134
+ clientId: z.ZodString;
135
+ baseUrl: z.ZodOptional<z.ZodString>;
136
+ scope: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>]>]>, z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
138
+ type: z.ZodOptional<z.ZodEnum<{
139
+ client_credentials: "client_credentials";
140
+ }>>;
141
+ clientId: z.ZodString;
142
+ clientSecret: z.ZodString;
143
+ baseUrl: z.ZodOptional<z.ZodString>;
144
+ scope: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>, z.ZodObject<{
146
+ type: z.ZodOptional<z.ZodEnum<{
147
+ pkce: "pkce";
148
+ }>>;
149
+ clientId: z.ZodString;
150
+ baseUrl: z.ZodOptional<z.ZodString>;
151
+ scope: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
153
+ type: z.ZodOptional<z.ZodEnum<{
154
+ client_credentials: "client_credentials";
155
+ }>>;
156
+ clientId: z.ZodString;
157
+ clientSecret: z.ZodString;
158
+ baseUrl: z.ZodOptional<z.ZodString>;
159
+ scope: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ type: z.ZodOptional<z.ZodEnum<{
162
+ pkce: "pkce";
163
+ }>>;
164
+ clientId: z.ZodString;
165
+ baseUrl: z.ZodOptional<z.ZodString>;
166
+ scope: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strip>]>]>>]>>]>;
168
+ export type Credentials = z.infer<typeof CredentialsSchema>;
49
169
  /**
50
170
  * Type guard for client credentials objects.
51
171
  */
@@ -61,5 +181,5 @@ export declare function isCredentialsObject(credentials: ResolvedCredentials): c
61
181
  /**
62
182
  * Type guard for credentials functions.
63
183
  */
64
- export declare function isCredentialsFunction(credentials: Credentials): credentials is () => ResolvedCredentials | Promise<ResolvedCredentials>;
184
+ export declare function isCredentialsFunction(credentials: Credentials): credentials is CredentialsFunction;
65
185
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/types/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,qBAAqB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,mBAAmB,GACnB,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,uBAAuB,CAOxC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,qBAAqB,CAO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;;;;;;2BAG5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,uBAAuB,CAOxC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,qBAAqB,CAOtC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,mBAAmB,GAC/B,WAAW,IAAI,iBAAiB,CAMlC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,mBAAmB,CAEpC"}
@@ -8,6 +8,86 @@
8
8
  * - PKCE: OAuth client ID for interactive login (CLI only)
9
9
  * - Function: Lazy/dynamic credential resolution
10
10
  */
11
+ import { z } from "zod";
12
+ /**
13
+ * Client credentials for OAuth client_credentials flow.
14
+ * The SDK will exchange these for an access token.
15
+ */
16
+ export const ClientCredentialsObjectSchema = z.object({
17
+ type: z.enum(["client_credentials"]).optional().meta({ internal: true }),
18
+ clientId: z
19
+ .string()
20
+ .describe("OAuth client ID for authentication.")
21
+ .meta({ valueHint: "id" }),
22
+ clientSecret: z
23
+ .string()
24
+ .describe("OAuth client secret for authentication.")
25
+ .meta({ valueHint: "secret" }),
26
+ baseUrl: z
27
+ .string()
28
+ .optional()
29
+ .describe("Override authentication base URL.")
30
+ .meta({ valueHint: "url" }),
31
+ scope: z
32
+ .string()
33
+ .optional()
34
+ .describe("Authentication scope.")
35
+ .meta({ internal: true }),
36
+ });
37
+ /**
38
+ * PKCE credentials for interactive OAuth flow.
39
+ * Only works when @zapier/zapier-sdk-cli-login is available.
40
+ */
41
+ export const PkceCredentialsObjectSchema = z.object({
42
+ type: z.enum(["pkce"]).optional().meta({ internal: true }),
43
+ clientId: z
44
+ .string()
45
+ .describe("OAuth client ID for authentication.")
46
+ .meta({ valueHint: "id" }),
47
+ baseUrl: z
48
+ .string()
49
+ .optional()
50
+ .describe("Override authentication base URL.")
51
+ .meta({ valueHint: "url" }),
52
+ scope: z
53
+ .string()
54
+ .optional()
55
+ .describe("Authentication scope.")
56
+ .meta({ internal: true }),
57
+ });
58
+ /**
59
+ * Union of all credential object types.
60
+ */
61
+ export const CredentialsObjectSchema = z.union([
62
+ ClientCredentialsObjectSchema,
63
+ PkceCredentialsObjectSchema,
64
+ ]);
65
+ /**
66
+ * Resolved credentials - what a credentials function must return.
67
+ * Either a string (token) or a credentials object.
68
+ * Functions are not allowed to return other functions.
69
+ */
70
+ export const ResolvedCredentialsSchema = z.union([
71
+ z.string().describe("Authentication token.").meta({ valueHint: "token" }),
72
+ CredentialsObjectSchema,
73
+ ]);
74
+ /**
75
+ * Lazy/dynamic credential resolution — a function returning resolved credentials.
76
+ */
77
+ export const CredentialsFunctionSchema = z
78
+ .function()
79
+ .input([])
80
+ .output(z.union([ResolvedCredentialsSchema, z.promise(ResolvedCredentialsSchema)]));
81
+ /**
82
+ * Credentials can be:
83
+ * - A string (token or API key)
84
+ * - A credentials object (client_credentials or pkce)
85
+ * - A function that returns credentials (sync or async)
86
+ */
87
+ export const CredentialsSchema = z.union([
88
+ ResolvedCredentialsSchema,
89
+ CredentialsFunctionSchema,
90
+ ]);
11
91
  /**
12
92
  * Type guard for client credentials objects.
13
93
  */
@@ -0,0 +1,9 @@
1
+ declare module "zod" {
2
+ interface GlobalMeta {
3
+ internal?: boolean;
4
+ deprecated?: boolean;
5
+ valueHint?: string;
6
+ }
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/meta.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,UAAU;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF;AAGD,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Augment the Zod Metadata Registry
2
+ // https://zod.dev/metadata?id=metadata
3
+ export {};
@@ -1,49 +1,75 @@
1
1
  /**
2
2
  * SDK-related types and interfaces
3
3
  */
4
+ import { z } from "zod";
4
5
  import type { EventCallback } from "./events";
5
6
  import type { EventEmissionConfig } from "../plugins/eventEmission";
6
7
  import type { Manifest } from "../plugins/manifest";
7
- import type { Credentials } from "./credentials";
8
- export interface BaseSdkOptions {
9
- /**
10
- * Authentication credentials. Can be:
11
- * - A string (token or API key)
12
- * - An object with clientId/clientSecret for client_credentials flow
13
- * - An object with clientId (no secret) for PKCE flow
14
- * - A function returning any of the above
15
- */
16
- credentials?: Credentials;
17
- /**
18
- * @deprecated Use `credentials` instead.
19
- */
20
- token?: string;
21
- onEvent?: EventCallback;
22
- fetch?: typeof fetch;
23
- baseUrl?: string;
24
- trackingBaseUrl?: string;
25
- debug?: boolean;
26
- manifestPath?: string;
27
- manifest?: Manifest;
28
- eventEmission?: EventEmissionConfig;
29
- /**
30
- * Maximum number of retries for rate-limited requests (429 responses).
31
- * Set to 0 to disable retries. Default is 3.
32
- */
33
- maxNetworkRetries?: number;
34
- /**
35
- * Maximum delay in milliseconds to wait for a rate limit retry.
36
- * If the server requests a longer delay, the request fails immediately.
37
- * Default is 60000 (60 seconds).
38
- */
39
- maxNetworkRetryDelayMs?: number;
40
- }
8
+ export declare const BaseSdkOptionsSchema: z.ZodObject<{
9
+ credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
10
+ type: z.ZodOptional<z.ZodEnum<{
11
+ client_credentials: "client_credentials";
12
+ }>>;
13
+ clientId: z.ZodString;
14
+ clientSecret: z.ZodString;
15
+ baseUrl: z.ZodOptional<z.ZodString>;
16
+ scope: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ type: z.ZodOptional<z.ZodEnum<{
19
+ pkce: "pkce";
20
+ }>>;
21
+ clientId: z.ZodString;
22
+ baseUrl: z.ZodOptional<z.ZodString>;
23
+ scope: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>]>]>, z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
25
+ type: z.ZodOptional<z.ZodEnum<{
26
+ client_credentials: "client_credentials";
27
+ }>>;
28
+ clientId: z.ZodString;
29
+ clientSecret: z.ZodString;
30
+ baseUrl: z.ZodOptional<z.ZodString>;
31
+ scope: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>, z.ZodObject<{
33
+ type: z.ZodOptional<z.ZodEnum<{
34
+ pkce: "pkce";
35
+ }>>;
36
+ clientId: z.ZodString;
37
+ baseUrl: z.ZodOptional<z.ZodString>;
38
+ scope: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
40
+ type: z.ZodOptional<z.ZodEnum<{
41
+ client_credentials: "client_credentials";
42
+ }>>;
43
+ clientId: z.ZodString;
44
+ clientSecret: z.ZodString;
45
+ baseUrl: z.ZodOptional<z.ZodString>;
46
+ scope: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ type: z.ZodOptional<z.ZodEnum<{
49
+ pkce: "pkce";
50
+ }>>;
51
+ clientId: z.ZodString;
52
+ baseUrl: z.ZodOptional<z.ZodString>;
53
+ scope: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>]>]>>]>>]>>;
55
+ debug: z.ZodOptional<z.ZodBoolean>;
56
+ baseUrl: z.ZodOptional<z.ZodString>;
57
+ trackingBaseUrl: z.ZodOptional<z.ZodString>;
58
+ maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
59
+ maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
60
+ manifestPath: z.ZodOptional<z.ZodString>;
61
+ manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
62
+ onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
63
+ fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
64
+ eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
65
+ token: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type BaseSdkOptions = z.infer<typeof BaseSdkOptionsSchema>;
41
68
  import type { ListInputFieldsSdkFunction } from "../plugins/listInputFields/schemas";
42
69
  import type { GetConnectionSdkFunction } from "../plugins/getConnection/schemas";
43
70
  import type { FindFirstConnectionSdkFunction } from "../plugins/findFirstConnection/schemas";
44
71
  import type { FindUniqueConnectionSdkFunction } from "../plugins/findUniqueConnection/schemas";
45
72
  import type { RelayRequestSdkFunction } from "../plugins/request/schemas";
46
- import type { z } from "zod";
47
73
  import type { RegistryPluginProvides } from "../plugins/registry";
48
74
  import type { GetProfilePluginProvides } from "../plugins/getProfile";
49
75
  import type { EventEmissionProvides } from "../plugins/eventEmission";
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;OAEG;IACH,KAAK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CAAiC,GACjC,+BAA+B,GAC/B,qCAAqC,GACrC,sCAAsC,GACtC,mCAAmC,GACnC,qCAAqC,GACrC,qCAAqC,GACrC,6BAA6B,GAC7B,kCAAkC,GAClC,mCAAmC,GACnC,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,iBAAiB,CACpB;IAED,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC"}
package/dist/types/sdk.js CHANGED
@@ -1,4 +1,58 @@
1
1
  /**
2
2
  * SDK-related types and interfaces
3
3
  */
4
- export {};
4
+ import { z } from "zod";
5
+ import { CredentialsSchema } from "./credentials";
6
+ // SDK Configuration Types
7
+ export const BaseSdkOptionsSchema = z.object({
8
+ credentials: CredentialsSchema.optional().describe("Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those."),
9
+ debug: z.boolean().optional().describe("Enable debug logging."),
10
+ baseUrl: z
11
+ .string()
12
+ .optional()
13
+ .describe("Base URL for Zapier API endpoints.")
14
+ .meta({ valueHint: "url" }),
15
+ trackingBaseUrl: z
16
+ .string()
17
+ .optional()
18
+ .describe("Base URL for Zapier tracking endpoints.")
19
+ .meta({ valueHint: "url" }),
20
+ /**
21
+ * Maximum number of retries for rate-limited requests (429 responses).
22
+ * Set to 0 to disable retries. Default is 3.
23
+ */
24
+ maxNetworkRetries: z
25
+ .number()
26
+ .optional()
27
+ .describe("Max retries for rate-limited requests (default: 3).")
28
+ .meta({ valueHint: "count" }),
29
+ /**
30
+ * Maximum delay in milliseconds to wait for a rate limit retry.
31
+ * If the server requests a longer delay, the request fails immediately.
32
+ * Default is 60000 (60 seconds).
33
+ */
34
+ maxNetworkRetryDelayMs: z
35
+ .number()
36
+ .optional()
37
+ .describe("Max delay in ms to wait for retry (default: 60000).")
38
+ .meta({ valueHint: "ms" }),
39
+ // Internal
40
+ manifestPath: z
41
+ .string()
42
+ .optional()
43
+ .describe("Path to a .zapierrc manifest file for app version locking.")
44
+ .meta({ internal: true }),
45
+ manifest: z
46
+ .custom()
47
+ .optional()
48
+ .describe("Manifest for app version locking.")
49
+ .meta({ internal: true }),
50
+ onEvent: z.custom().optional().meta({ internal: true }),
51
+ fetch: z.custom().optional().meta({ internal: true }),
52
+ eventEmission: z
53
+ .custom()
54
+ .optional()
55
+ .meta({ internal: true }),
56
+ // Deprecated
57
+ token: z.string().optional().meta({ deprecated: true }), // Use credentials instead
58
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",