@zapier/zapier-sdk 0.30.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +23 -9
  3. package/dist/api/schemas.d.ts +2 -2
  4. package/dist/index.cjs +120 -18
  5. package/dist/index.d.mts +206 -56
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.mjs +114 -19
  10. package/dist/plugins/eventEmission/builders.js +3 -3
  11. package/dist/plugins/eventEmission/builders.test.d.ts +2 -0
  12. package/dist/plugins/eventEmission/builders.test.d.ts.map +1 -0
  13. package/dist/plugins/eventEmission/builders.test.js +56 -0
  14. package/dist/plugins/eventEmission/types.d.ts +3 -0
  15. package/dist/plugins/eventEmission/types.d.ts.map +1 -1
  16. package/dist/plugins/findFirstConnection/schemas.d.ts +1 -1
  17. package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -1
  18. package/dist/plugins/getAction/index.d.ts.map +1 -1
  19. package/dist/plugins/getAction/index.js +7 -0
  20. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  21. package/dist/plugins/getInputFieldsSchema/index.js +6 -0
  22. package/dist/plugins/listActions/index.d.ts.map +1 -1
  23. package/dist/plugins/listActions/index.js +6 -0
  24. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  25. package/dist/plugins/listConnections/index.js +2 -0
  26. package/dist/plugins/listConnections/schemas.d.ts +1 -1
  27. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  28. package/dist/plugins/listInputFieldChoices/index.js +6 -0
  29. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  30. package/dist/plugins/listInputFields/index.js +6 -0
  31. package/dist/plugins/runAction/index.d.ts.map +1 -1
  32. package/dist/plugins/runAction/index.js +12 -8
  33. package/dist/schemas/Action.d.ts +2 -2
  34. package/dist/types/credentials.d.ts +137 -17
  35. package/dist/types/credentials.d.ts.map +1 -1
  36. package/dist/types/credentials.js +80 -0
  37. package/dist/types/meta.d.ts +9 -0
  38. package/dist/types/meta.d.ts.map +1 -0
  39. package/dist/types/meta.js +3 -0
  40. package/dist/types/sdk.d.ts +61 -35
  41. package/dist/types/sdk.d.ts.map +1 -1
  42. package/dist/types/sdk.js +55 -1
  43. package/dist/utils/telemetry-context.d.ts +12 -0
  44. package/dist/utils/telemetry-context.d.ts.map +1 -1
  45. package/dist/utils/telemetry-context.js +18 -0
  46. package/dist/utils/telemetry-context.test.js +63 -1
  47. package/dist/utils/telemetry-utils.d.ts.map +1 -1
  48. package/dist/utils/telemetry-utils.js +5 -0
  49. package/dist/utils/telemetry-utils.test.js +61 -0
  50. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -305,6 +305,9 @@ interface MethodCalledEventData {
305
305
  error_type?: string | null;
306
306
  argument_count: number;
307
307
  is_paginated?: boolean;
308
+ selected_api?: string | null;
309
+ operation_type?: string | null;
310
+ operation_key?: string | null;
308
311
  }
309
312
 
310
313
  /**
@@ -399,44 +402,164 @@ interface EventEmissionProvides {
399
402
  * - PKCE: OAuth client ID for interactive login (CLI only)
400
403
  * - Function: Lazy/dynamic credential resolution
401
404
  */
405
+
402
406
  /**
403
407
  * Client credentials for OAuth client_credentials flow.
404
408
  * The SDK will exchange these for an access token.
405
409
  */
406
- interface ClientCredentialsObject {
407
- type?: "client_credentials";
408
- clientId: string;
409
- clientSecret: string;
410
- baseUrl?: string;
411
- scope?: string;
412
- }
410
+ declare const ClientCredentialsObjectSchema: z.ZodObject<{
411
+ type: z.ZodOptional<z.ZodEnum<{
412
+ client_credentials: "client_credentials";
413
+ }>>;
414
+ clientId: z.ZodString;
415
+ clientSecret: z.ZodString;
416
+ baseUrl: z.ZodOptional<z.ZodString>;
417
+ scope: z.ZodOptional<z.ZodString>;
418
+ }, z.core.$strip>;
419
+ type ClientCredentialsObject = z.infer<typeof ClientCredentialsObjectSchema>;
413
420
  /**
414
421
  * PKCE credentials for interactive OAuth flow.
415
422
  * Only works when @zapier/zapier-sdk-cli-login is available.
416
423
  */
417
- interface PkceCredentialsObject {
418
- type?: "pkce";
419
- clientId: string;
420
- baseUrl?: string;
421
- scope?: string;
422
- }
424
+ declare const PkceCredentialsObjectSchema: z.ZodObject<{
425
+ type: z.ZodOptional<z.ZodEnum<{
426
+ pkce: "pkce";
427
+ }>>;
428
+ clientId: z.ZodString;
429
+ baseUrl: z.ZodOptional<z.ZodString>;
430
+ scope: z.ZodOptional<z.ZodString>;
431
+ }, z.core.$strip>;
432
+ type PkceCredentialsObject = z.infer<typeof PkceCredentialsObjectSchema>;
423
433
  /**
424
434
  * Union of all credential object types.
425
435
  */
426
- type CredentialsObject = ClientCredentialsObject | PkceCredentialsObject;
436
+ declare const CredentialsObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
437
+ type: z.ZodOptional<z.ZodEnum<{
438
+ client_credentials: "client_credentials";
439
+ }>>;
440
+ clientId: z.ZodString;
441
+ clientSecret: z.ZodString;
442
+ baseUrl: z.ZodOptional<z.ZodString>;
443
+ scope: z.ZodOptional<z.ZodString>;
444
+ }, z.core.$strip>, z.ZodObject<{
445
+ type: z.ZodOptional<z.ZodEnum<{
446
+ pkce: "pkce";
447
+ }>>;
448
+ clientId: z.ZodString;
449
+ baseUrl: z.ZodOptional<z.ZodString>;
450
+ scope: z.ZodOptional<z.ZodString>;
451
+ }, z.core.$strip>]>;
452
+ type CredentialsObject = z.infer<typeof CredentialsObjectSchema>;
427
453
  /**
428
454
  * Resolved credentials - what a credentials function must return.
429
455
  * Either a string (token) or a credentials object.
430
456
  * Functions are not allowed to return other functions.
431
457
  */
432
- type ResolvedCredentials = string | CredentialsObject;
458
+ declare const ResolvedCredentialsSchema: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
459
+ type: z.ZodOptional<z.ZodEnum<{
460
+ client_credentials: "client_credentials";
461
+ }>>;
462
+ clientId: z.ZodString;
463
+ clientSecret: z.ZodString;
464
+ baseUrl: z.ZodOptional<z.ZodString>;
465
+ scope: z.ZodOptional<z.ZodString>;
466
+ }, z.core.$strip>, z.ZodObject<{
467
+ type: z.ZodOptional<z.ZodEnum<{
468
+ pkce: "pkce";
469
+ }>>;
470
+ clientId: z.ZodString;
471
+ baseUrl: z.ZodOptional<z.ZodString>;
472
+ scope: z.ZodOptional<z.ZodString>;
473
+ }, z.core.$strip>]>]>;
474
+ type ResolvedCredentials = z.infer<typeof ResolvedCredentialsSchema>;
475
+ /**
476
+ * Lazy/dynamic credential resolution — a function returning resolved credentials.
477
+ */
478
+ 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<{
479
+ type: z.ZodOptional<z.ZodEnum<{
480
+ client_credentials: "client_credentials";
481
+ }>>;
482
+ clientId: z.ZodString;
483
+ clientSecret: z.ZodString;
484
+ baseUrl: z.ZodOptional<z.ZodString>;
485
+ scope: z.ZodOptional<z.ZodString>;
486
+ }, z.core.$strip>, z.ZodObject<{
487
+ type: z.ZodOptional<z.ZodEnum<{
488
+ pkce: "pkce";
489
+ }>>;
490
+ clientId: z.ZodString;
491
+ baseUrl: z.ZodOptional<z.ZodString>;
492
+ scope: z.ZodOptional<z.ZodString>;
493
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
494
+ type: z.ZodOptional<z.ZodEnum<{
495
+ client_credentials: "client_credentials";
496
+ }>>;
497
+ clientId: z.ZodString;
498
+ clientSecret: z.ZodString;
499
+ baseUrl: z.ZodOptional<z.ZodString>;
500
+ scope: z.ZodOptional<z.ZodString>;
501
+ }, z.core.$strip>, z.ZodObject<{
502
+ type: z.ZodOptional<z.ZodEnum<{
503
+ pkce: "pkce";
504
+ }>>;
505
+ clientId: z.ZodString;
506
+ baseUrl: z.ZodOptional<z.ZodString>;
507
+ scope: z.ZodOptional<z.ZodString>;
508
+ }, z.core.$strip>]>]>>]>>;
509
+ type CredentialsFunction = z.infer<typeof CredentialsFunctionSchema>;
433
510
  /**
434
511
  * Credentials can be:
435
512
  * - A string (token or API key)
436
513
  * - A credentials object (client_credentials or pkce)
437
514
  * - A function that returns credentials (sync or async)
438
515
  */
439
- type Credentials = ResolvedCredentials | (() => ResolvedCredentials | Promise<ResolvedCredentials>);
516
+ declare const CredentialsSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
517
+ type: z.ZodOptional<z.ZodEnum<{
518
+ client_credentials: "client_credentials";
519
+ }>>;
520
+ clientId: z.ZodString;
521
+ clientSecret: z.ZodString;
522
+ baseUrl: z.ZodOptional<z.ZodString>;
523
+ scope: z.ZodOptional<z.ZodString>;
524
+ }, z.core.$strip>, z.ZodObject<{
525
+ type: z.ZodOptional<z.ZodEnum<{
526
+ pkce: "pkce";
527
+ }>>;
528
+ clientId: z.ZodString;
529
+ baseUrl: z.ZodOptional<z.ZodString>;
530
+ scope: z.ZodOptional<z.ZodString>;
531
+ }, 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<{
532
+ type: z.ZodOptional<z.ZodEnum<{
533
+ client_credentials: "client_credentials";
534
+ }>>;
535
+ clientId: z.ZodString;
536
+ clientSecret: z.ZodString;
537
+ baseUrl: z.ZodOptional<z.ZodString>;
538
+ scope: z.ZodOptional<z.ZodString>;
539
+ }, z.core.$strip>, z.ZodObject<{
540
+ type: z.ZodOptional<z.ZodEnum<{
541
+ pkce: "pkce";
542
+ }>>;
543
+ clientId: z.ZodString;
544
+ baseUrl: z.ZodOptional<z.ZodString>;
545
+ scope: z.ZodOptional<z.ZodString>;
546
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
547
+ type: z.ZodOptional<z.ZodEnum<{
548
+ client_credentials: "client_credentials";
549
+ }>>;
550
+ clientId: z.ZodString;
551
+ clientSecret: z.ZodString;
552
+ baseUrl: z.ZodOptional<z.ZodString>;
553
+ scope: z.ZodOptional<z.ZodString>;
554
+ }, z.core.$strip>, z.ZodObject<{
555
+ type: z.ZodOptional<z.ZodEnum<{
556
+ pkce: "pkce";
557
+ }>>;
558
+ clientId: z.ZodString;
559
+ baseUrl: z.ZodOptional<z.ZodString>;
560
+ scope: z.ZodOptional<z.ZodString>;
561
+ }, z.core.$strip>]>]>>]>>]>;
562
+ type Credentials = z.infer<typeof CredentialsSchema>;
440
563
  /**
441
564
  * Type guard for client credentials objects.
442
565
  */
@@ -452,7 +575,7 @@ declare function isCredentialsObject(credentials: ResolvedCredentials): credenti
452
575
  /**
453
576
  * Type guard for credentials functions.
454
577
  */
455
- declare function isCredentialsFunction(credentials: Credentials): credentials is () => ResolvedCredentials | Promise<ResolvedCredentials>;
578
+ declare function isCredentialsFunction(credentials: Credentials): credentials is CredentialsFunction;
456
579
 
457
580
  declare const NeedSchema: z.ZodObject<{
458
581
  key: z.ZodString;
@@ -1127,8 +1250,8 @@ declare const GetConnectionParamSchema: z.ZodObject<{
1127
1250
  type GetConnectionParam = z.infer<typeof GetConnectionParamSchema>;
1128
1251
 
1129
1252
  declare const FindFirstConnectionSchema: z.ZodObject<{
1130
- search: z.ZodOptional<z.ZodString>;
1131
1253
  title: z.ZodOptional<z.ZodString>;
1254
+ search: z.ZodOptional<z.ZodString>;
1132
1255
  appKey: z.ZodOptional<z.ZodString & {
1133
1256
  _def: z.core.$ZodStringDef & PositionalMetadata;
1134
1257
  }>;
@@ -1140,8 +1263,8 @@ declare const FindFirstConnectionSchema: z.ZodObject<{
1140
1263
  type FindFirstConnectionOptions = z.infer<typeof FindFirstConnectionSchema>;
1141
1264
 
1142
1265
  declare const FindUniqueConnectionSchema: z.ZodObject<{
1143
- search: z.ZodOptional<z.ZodString>;
1144
1266
  title: z.ZodOptional<z.ZodString>;
1267
+ search: z.ZodOptional<z.ZodString>;
1145
1268
  appKey: z.ZodOptional<z.ZodString & {
1146
1269
  _def: z.core.$ZodStringDef & PositionalMetadata;
1147
1270
  }>;
@@ -1568,8 +1691,8 @@ interface ZapierSdkApps {
1568
1691
  }
1569
1692
 
1570
1693
  declare const ListConnectionsQuerySchema: z.ZodObject<{
1571
- search: z.ZodOptional<z.ZodString>;
1572
1694
  title: z.ZodOptional<z.ZodString>;
1695
+ search: z.ZodOptional<z.ZodString>;
1573
1696
  owner: z.ZodOptional<z.ZodString>;
1574
1697
  appKey: z.ZodOptional<z.ZodString & {
1575
1698
  _def: z.core.$ZodStringDef & PositionalMetadata;
@@ -1739,8 +1862,8 @@ declare const listClientCredentialsPlugin: Plugin<{}, {
1739
1862
  declare const CreateClientCredentialsSchema: z.ZodObject<{
1740
1863
  name: z.ZodString;
1741
1864
  allowedScopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1742
- external: "external";
1743
1865
  credentials: "credentials";
1866
+ external: "external";
1744
1867
  }>>>;
1745
1868
  }, z.core.$strip>;
1746
1869
  type CreateClientCredentialsOptions = z.infer<typeof CreateClientCredentialsSchema> & FunctionOptions;
@@ -1918,39 +2041,66 @@ RequestPluginProvides>;
1918
2041
  * SDK-related types and interfaces
1919
2042
  */
1920
2043
 
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
- }
2044
+ declare const BaseSdkOptionsSchema: z.ZodObject<{
2045
+ credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
2046
+ type: z.ZodOptional<z.ZodEnum<{
2047
+ client_credentials: "client_credentials";
2048
+ }>>;
2049
+ clientId: z.ZodString;
2050
+ clientSecret: z.ZodString;
2051
+ baseUrl: z.ZodOptional<z.ZodString>;
2052
+ scope: z.ZodOptional<z.ZodString>;
2053
+ }, z.core.$strip>, z.ZodObject<{
2054
+ type: z.ZodOptional<z.ZodEnum<{
2055
+ pkce: "pkce";
2056
+ }>>;
2057
+ clientId: z.ZodString;
2058
+ baseUrl: z.ZodOptional<z.ZodString>;
2059
+ scope: z.ZodOptional<z.ZodString>;
2060
+ }, 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<{
2061
+ type: z.ZodOptional<z.ZodEnum<{
2062
+ client_credentials: "client_credentials";
2063
+ }>>;
2064
+ clientId: z.ZodString;
2065
+ clientSecret: z.ZodString;
2066
+ baseUrl: z.ZodOptional<z.ZodString>;
2067
+ scope: z.ZodOptional<z.ZodString>;
2068
+ }, z.core.$strip>, z.ZodObject<{
2069
+ type: z.ZodOptional<z.ZodEnum<{
2070
+ pkce: "pkce";
2071
+ }>>;
2072
+ clientId: z.ZodString;
2073
+ baseUrl: z.ZodOptional<z.ZodString>;
2074
+ scope: z.ZodOptional<z.ZodString>;
2075
+ }, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
2076
+ type: z.ZodOptional<z.ZodEnum<{
2077
+ client_credentials: "client_credentials";
2078
+ }>>;
2079
+ clientId: z.ZodString;
2080
+ clientSecret: z.ZodString;
2081
+ baseUrl: z.ZodOptional<z.ZodString>;
2082
+ scope: z.ZodOptional<z.ZodString>;
2083
+ }, z.core.$strip>, z.ZodObject<{
2084
+ type: z.ZodOptional<z.ZodEnum<{
2085
+ pkce: "pkce";
2086
+ }>>;
2087
+ clientId: z.ZodString;
2088
+ baseUrl: z.ZodOptional<z.ZodString>;
2089
+ scope: z.ZodOptional<z.ZodString>;
2090
+ }, z.core.$strip>]>]>>]>>]>>;
2091
+ debug: z.ZodOptional<z.ZodBoolean>;
2092
+ baseUrl: z.ZodOptional<z.ZodString>;
2093
+ trackingBaseUrl: z.ZodOptional<z.ZodString>;
2094
+ maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
2095
+ maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
2096
+ manifestPath: z.ZodOptional<z.ZodString>;
2097
+ manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
2098
+ onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
2099
+ fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
2100
+ eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
2101
+ token: z.ZodOptional<z.ZodString>;
2102
+ }, z.core.$strip>;
2103
+ type BaseSdkOptions = z.infer<typeof BaseSdkOptionsSchema>;
1954
2104
 
1955
2105
  interface FunctionRegistryEntry {
1956
2106
  name: string;
@@ -2166,8 +2316,8 @@ type ConnectionItem$1 = z.infer<typeof ConnectionItemSchema>;
2166
2316
 
2167
2317
  declare const ActionItemSchema: z.ZodObject<{
2168
2318
  description: z.ZodString;
2169
- key: z.ZodString;
2170
2319
  id: z.ZodOptional<z.ZodString>;
2320
+ key: z.ZodString;
2171
2321
  is_important: z.ZodOptional<z.ZodBoolean>;
2172
2322
  is_hidden: z.ZodOptional<z.ZodBoolean>;
2173
2323
  app_key: z.ZodString;
@@ -2799,4 +2949,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
2799
2949
  }>;
2800
2950
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
2801
2951
 
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 };
2952
+ 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;A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E,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,8BAA8B,EAC9B,0BAA0B,EAC1B,eAAe,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
@@ -469,6 +469,16 @@ function runWithTelemetryContext(fn) {
469
469
  const currentDepth = telemetryStore.getStore()?.depth ?? -1;
470
470
  return telemetryStore.run({ depth: currentDepth + 1 }, fn);
471
471
  }
472
+ function setMethodMetadata(metadata) {
473
+ if (!telemetryStore) return;
474
+ const store = telemetryStore.getStore();
475
+ if (!store) return;
476
+ store.methodMetadata = { ...store.methodMetadata, ...metadata };
477
+ }
478
+ function getMethodMetadata() {
479
+ if (!telemetryStore) return void 0;
480
+ return telemetryStore.getStore()?.methodMetadata;
481
+ }
472
482
 
473
483
  // src/plugins/fetch/index.ts
474
484
  function transformUrlToRelayPath(url) {
@@ -1021,6 +1031,7 @@ var AppItemSchema = withFormatter(AppItemSchema$1, {
1021
1031
  function createTelemetryCallback(emitMethodCalled, methodName) {
1022
1032
  return {
1023
1033
  onMethodCalled: (data) => {
1034
+ const metadata = getMethodMetadata();
1024
1035
  emitMethodCalled({
1025
1036
  method_name: methodName,
1026
1037
  execution_duration_ms: data.durationMs,
@@ -1028,7 +1039,10 @@ function createTelemetryCallback(emitMethodCalled, methodName) {
1028
1039
  error_message: data.error?.message ?? null,
1029
1040
  error_type: data.error?.constructor.name ?? null,
1030
1041
  argument_count: data.argumentCount,
1031
- is_paginated: data.isPaginated
1042
+ is_paginated: data.isPaginated,
1043
+ selected_api: metadata?.selectedApi ?? null,
1044
+ operation_type: metadata?.operationType ?? null,
1045
+ operation_key: metadata?.operationKey ?? null
1032
1046
  });
1033
1047
  }
1034
1048
  };
@@ -1768,6 +1782,10 @@ var listActionsPlugin = ({ context }) => {
1768
1782
  { configType: "current_implementation_id" }
1769
1783
  );
1770
1784
  }
1785
+ setMethodMetadata({
1786
+ selectedApi,
1787
+ operationType: options.actionType ?? null
1788
+ });
1771
1789
  const searchParams = {
1772
1790
  global: "true",
1773
1791
  public_only: "true",
@@ -2146,6 +2164,11 @@ var listInputFieldsPlugin = ({ sdk, context }) => {
2146
2164
  { configType: "current_implementation_id" }
2147
2165
  );
2148
2166
  }
2167
+ setMethodMetadata({
2168
+ selectedApi,
2169
+ operationType: actionType,
2170
+ operationKey: actionKey
2171
+ });
2149
2172
  const { data: action } = await sdk.getAction({
2150
2173
  appKey,
2151
2174
  actionType,
@@ -2265,6 +2288,7 @@ var listConnectionsPlugin = ({ context }) => {
2265
2288
  options.appKey
2266
2289
  );
2267
2290
  if (implementationId) {
2291
+ setMethodMetadata({ selectedApi: implementationId });
2268
2292
  const [versionlessSelectedApi] = splitVersionedKey(implementationId);
2269
2293
  searchParams.app_key = versionlessSelectedApi;
2270
2294
  } else {
@@ -2631,6 +2655,10 @@ var GetActionSchema = z.object({
2631
2655
  var getActionPlugin = ({ sdk, context }) => {
2632
2656
  async function getAction(options) {
2633
2657
  const { actionKey, actionType, appKey } = options;
2658
+ setMethodMetadata({
2659
+ operationType: actionType,
2660
+ operationKey: actionKey
2661
+ });
2634
2662
  for await (const action of sdk.listActions({ appKey }).items()) {
2635
2663
  if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
2636
2664
  return { data: action };
@@ -2840,8 +2868,7 @@ var RunActionSchema = z.object({
2840
2868
  async function executeAction(actionOptions) {
2841
2869
  const {
2842
2870
  api,
2843
- context,
2844
- appKey,
2871
+ selectedApi,
2845
2872
  actionId,
2846
2873
  actionKey,
2847
2874
  actionType,
@@ -2849,13 +2876,6 @@ async function executeAction(actionOptions) {
2849
2876
  connectionId,
2850
2877
  timeoutMs
2851
2878
  } = actionOptions;
2852
- const selectedApi = await context.getVersionedImplementationId(appKey);
2853
- if (!selectedApi) {
2854
- throw new ZapierConfigurationError(
2855
- "No current_implementation_id found for app",
2856
- { configType: "current_implementation_id" }
2857
- );
2858
- }
2859
2879
  const runRequestData = {
2860
2880
  selected_api: selectedApi,
2861
2881
  action_id: actionId,
@@ -2898,6 +2918,18 @@ var runActionPlugin = ({ sdk, context }) => {
2898
2918
  timeoutMs
2899
2919
  } = options;
2900
2920
  const resolvedConnectionId = connectionId ?? authenticationId;
2921
+ const selectedApi = await context.getVersionedImplementationId(appKey);
2922
+ if (!selectedApi) {
2923
+ throw new ZapierConfigurationError(
2924
+ "No current_implementation_id found for app",
2925
+ { configType: "current_implementation_id" }
2926
+ );
2927
+ }
2928
+ setMethodMetadata({
2929
+ selectedApi,
2930
+ operationType: actionType,
2931
+ operationKey: actionKey
2932
+ });
2901
2933
  const actionData = await sdk.getAction({
2902
2934
  appKey,
2903
2935
  actionKey,
@@ -2911,8 +2943,7 @@ var runActionPlugin = ({ sdk, context }) => {
2911
2943
  const actionId = actionData.data.id;
2912
2944
  const result = await executeAction({
2913
2945
  api,
2914
- context,
2915
- appKey,
2946
+ selectedApi,
2916
2947
  // Some actions require the action ID to run them, but technically the ID is not guaranteed to be available when
2917
2948
  // we retrieve actions (probably legacy reasons), so we just pass along all the things!
2918
2949
  actionId,
@@ -3897,8 +3928,34 @@ async function pollUntilComplete(options) {
3897
3928
  }
3898
3929
  }
3899
3930
  }
3900
-
3901
- // src/types/credentials.ts
3931
+ var ClientCredentialsObjectSchema = z.object({
3932
+ type: z.enum(["client_credentials"]).optional().meta({ internal: true }),
3933
+ clientId: z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3934
+ clientSecret: z.string().describe("OAuth client secret for authentication.").meta({ valueHint: "secret" }),
3935
+ baseUrl: z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3936
+ scope: z.string().optional().describe("Authentication scope.").meta({ internal: true })
3937
+ });
3938
+ var PkceCredentialsObjectSchema = z.object({
3939
+ type: z.enum(["pkce"]).optional().meta({ internal: true }),
3940
+ clientId: z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
3941
+ baseUrl: z.string().optional().describe("Override authentication base URL.").meta({ valueHint: "url" }),
3942
+ scope: z.string().optional().describe("Authentication scope.").meta({ internal: true })
3943
+ });
3944
+ var CredentialsObjectSchema = z.union([
3945
+ ClientCredentialsObjectSchema,
3946
+ PkceCredentialsObjectSchema
3947
+ ]);
3948
+ var ResolvedCredentialsSchema = z.union([
3949
+ z.string().describe("Authentication token.").meta({ valueHint: "token" }),
3950
+ CredentialsObjectSchema
3951
+ ]);
3952
+ var CredentialsFunctionSchema = z.function().input([]).output(
3953
+ z.union([ResolvedCredentialsSchema, z.promise(ResolvedCredentialsSchema)])
3954
+ );
3955
+ var CredentialsSchema = z.union([
3956
+ ResolvedCredentialsSchema,
3957
+ CredentialsFunctionSchema
3958
+ ]);
3902
3959
  function isClientCredentials(credentials) {
3903
3960
  return typeof credentials === "object" && credentials !== null && "clientId" in credentials && "clientSecret" in credentials;
3904
3961
  }
@@ -5010,6 +5067,11 @@ var getInputFieldsSchemaPlugin = ({ sdk, context }) => {
5010
5067
  { configType: "current_implementation_id" }
5011
5068
  );
5012
5069
  }
5070
+ setMethodMetadata({
5071
+ selectedApi,
5072
+ operationType: actionType,
5073
+ operationKey: actionKey
5074
+ });
5013
5075
  const { data: action } = await sdk.getAction({
5014
5076
  appKey,
5015
5077
  actionType,
@@ -5129,6 +5191,11 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
5129
5191
  { configType: "current_implementation_id" }
5130
5192
  );
5131
5193
  }
5194
+ setMethodMetadata({
5195
+ selectedApi,
5196
+ operationType: actionType,
5197
+ operationKey: actionKey
5198
+ });
5132
5199
  const { data: action } = await sdk.getAction({
5133
5200
  appKey,
5134
5201
  actionType,
@@ -5380,7 +5447,7 @@ function getCpuTime() {
5380
5447
 
5381
5448
  // package.json
5382
5449
  var package_default = {
5383
- version: "0.30.0"};
5450
+ version: "0.31.1"};
5384
5451
 
5385
5452
  // src/plugins/eventEmission/builders.ts
5386
5453
  function createBaseEvent(context = {}) {
@@ -5461,13 +5528,13 @@ function buildMethodCalledEvent(data, context = {}) {
5461
5528
  is_paginated: data.is_paginated ?? false,
5462
5529
  sdk_version: package_default.version,
5463
5530
  environment: context.environment ?? (process?.env?.NODE_ENV || null),
5464
- selected_api: context.selected_api ?? null,
5531
+ selected_api: data.selected_api ?? context.selected_api ?? null,
5465
5532
  app_id: context.app_id ?? null,
5466
5533
  app_version_id: context.app_version_id ?? null,
5467
5534
  zap_id: context.zap_id ?? null,
5468
5535
  node_id: context.node_id ?? null,
5469
- operation_type: null,
5470
- operation_key: null,
5536
+ operation_type: data.operation_type ?? null,
5537
+ operation_key: data.operation_key ?? null,
5471
5538
  call_context: null,
5472
5539
  is_retry: false,
5473
5540
  retry_attempt: null,
@@ -5839,5 +5906,33 @@ function createZapierSdkWithoutRegistry(options = {}) {
5839
5906
  function createZapierSdk(options = {}) {
5840
5907
  return createZapierSdkWithoutRegistry(options).addPlugin(registryPlugin);
5841
5908
  }
5909
+ var BaseSdkOptionsSchema = z.object({
5910
+ credentials: CredentialsSchema.optional().describe(
5911
+ "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."
5912
+ ),
5913
+ debug: z.boolean().optional().describe("Enable debug logging."),
5914
+ baseUrl: z.string().optional().describe("Base URL for Zapier API endpoints.").meta({ valueHint: "url" }),
5915
+ trackingBaseUrl: z.string().optional().describe("Base URL for Zapier tracking endpoints.").meta({ valueHint: "url" }),
5916
+ /**
5917
+ * Maximum number of retries for rate-limited requests (429 responses).
5918
+ * Set to 0 to disable retries. Default is 3.
5919
+ */
5920
+ maxNetworkRetries: z.number().optional().describe("Max retries for rate-limited requests (default: 3).").meta({ valueHint: "count" }),
5921
+ /**
5922
+ * Maximum delay in milliseconds to wait for a rate limit retry.
5923
+ * If the server requests a longer delay, the request fails immediately.
5924
+ * Default is 60000 (60 seconds).
5925
+ */
5926
+ maxNetworkRetryDelayMs: z.number().optional().describe("Max delay in ms to wait for retry (default: 60000).").meta({ valueHint: "ms" }),
5927
+ // Internal
5928
+ manifestPath: z.string().optional().describe("Path to a .zapierrc manifest file for app version locking.").meta({ internal: true }),
5929
+ manifest: z.custom().optional().describe("Manifest for app version locking.").meta({ internal: true }),
5930
+ onEvent: z.custom().optional().meta({ internal: true }),
5931
+ fetch: z.custom().optional().meta({ internal: true }),
5932
+ eventEmission: z.custom().optional().meta({ internal: true }),
5933
+ // Deprecated
5934
+ token: z.string().optional().meta({ deprecated: true })
5935
+ // Use credentials instead
5936
+ });
5842
5937
 
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 };
5938
+ 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 };