@zapier/zapier-sdk 0.45.0 → 0.45.2

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,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.45.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 783e180: Convert API query params from camelCase to snake_case (appKeys -> app_keys, pageSize -> page_size) to match the updated API contract. Also updated all `zapier-sdk-*` packages to Zod to 4.3.6
8
+
9
+ ## 0.45.1
10
+
11
+ ### Patch Changes
12
+
13
+ - cb0d898: Added telemetry headers so sdkapi can attribute traffic to the SDK entry point that produced it. Every outbound request now includes `x-zapier-sdk-version`, with `x-zapier-service` added when `ZAPIER_SDK_SERVICE` is set. Requests originating from `createZapierCliSdk` or `createZapierMcpServer` additionally include `x-zapier-sdk-package` and `x-zapier-sdk-package-version` identifying the wrapping package; direct `createZapierSdk` callers omit those two. Headers are applied after caller-supplied header merging, so they can't be spoofed via per-request `options.headers`.
14
+
3
15
  ## 0.45.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1081,11 +1081,11 @@ Delete one or more fields from a table
1081
1081
 
1082
1082
  **Parameters:**
1083
1083
 
1084
- | Name | Type | Required | Default | Possible Values | Description |
1085
- | ---------- | -------- | -------- | ------- | --------------- | ---------------------------------- |
1086
- | `options` | `object` | ✅ | — | — | |
1087
- | ↳ `table` | `string` | ✅ | — | — | The unique identifier of the table |
1088
- | ↳ `fields` | `array` | ✅ | — | — | |
1084
+ | Name | Type | Required | Default | Possible Values | Description |
1085
+ | ---------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------- |
1086
+ | `options` | `object` | ✅ | — | — | |
1087
+ | ↳ `table` | `string` | ✅ | — | — | The unique identifier of the table |
1088
+ | ↳ `fields` | `array` | ✅ | — | — | Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
1089
1089
 
1090
1090
  **Returns:** `Promise<any>`
1091
1091
 
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AA2/BjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAihCjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
@@ -12,7 +12,8 @@ import { getZapierBaseUrl } from "../utils/url-utils";
12
12
  import { sleep, calculateExponentialBackoffMs } from "../utils/retry-utils";
13
13
  import { isPlainObject } from "../utils/type-guard-utils";
14
14
  import { ZapierApiError, ZapierApprovalError, ZapierAuthenticationError, ZapierTimeoutError, ZapierValidationError, ZapierNotFoundError, ZapierRateLimitError, } from "../types/errors";
15
- import { ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, getZapierIsInteractive, getZapierApprovalMode, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_MAX_APPROVAL_RETRIES, } from "../constants";
15
+ import { ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, getZapierIsInteractive, getZapierApprovalMode, getZapierSdkService, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_MAX_APPROVAL_RETRIES, } from "../constants";
16
+ import { SDK_VERSION } from "../sdk-version";
16
17
  import { openApproval } from "../utils/open-approval";
17
18
  import { z } from "zod";
18
19
  const ApprovalStatusSchema = z.enum(["pending_approval", "approved", "denied"]);
@@ -124,6 +125,7 @@ class ZapierApiClient {
124
125
  inputHeaders.forEach((value, key) => {
125
126
  mergedHeaders.set(key, value);
126
127
  });
128
+ this.applyTelemetryHeaders(mergedHeaders);
127
129
  let retries = 0;
128
130
  // Retry loop for rate limiting (429)
129
131
  while (true) {
@@ -573,6 +575,22 @@ class ZapierApiClient {
573
575
  }
574
576
  return headers;
575
577
  }
578
+ // Telemetry headers consumed by sdkapi's ApiRequestCompletedEvent.
579
+ // Applied at the outbound layer (after caller-supplied header merging) so
580
+ // they always reflect the SDK's actual identity and can't be spoofed via
581
+ // options.headers.
582
+ applyTelemetryHeaders(headers) {
583
+ headers.set("x-zapier-sdk-version", SDK_VERSION);
584
+ const sdkService = getZapierSdkService();
585
+ if (sdkService) {
586
+ headers.set("x-zapier-service", sdkService);
587
+ }
588
+ const callerPackage = this.options.callerPackage;
589
+ if (callerPackage) {
590
+ headers.set("x-zapier-sdk-package", callerPackage.name);
591
+ headers.set("x-zapier-sdk-package-version", callerPackage.version);
592
+ }
593
+ }
576
594
  // Helper to perform HTTP requests with JSON handling
577
595
  async fetchJson(method, path, data, options = {}) {
578
596
  const headers = { ...options.headers };
@@ -60,6 +60,17 @@ export interface ApiClientOptions {
60
60
  * keeps returning approval_required. Default: 2.
61
61
  */
62
62
  maxApprovalRetries?: number;
63
+ /**
64
+ * Identifies the wrapping package that built this client (e.g., the CLI or
65
+ * MCP server). When set, emitted as `x-zapier-sdk-package` /
66
+ * `x-zapier-sdk-package-version` telemetry headers. Omitted by direct
67
+ * `createZapierSdk` callers — their identity is captured by
68
+ * `x-zapier-sdk-version` alone.
69
+ */
70
+ callerPackage?: {
71
+ name: string;
72
+ version: string;
73
+ };
63
74
  }
64
75
  export interface ApiClient {
65
76
  get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB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kB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
@@ -7,6 +7,12 @@
7
7
  * Base URL for Zapier API endpoints
8
8
  */
9
9
  export declare const ZAPIER_BASE_URL: string;
10
+ /**
11
+ * Calling service name for telemetry headers.
12
+ *
13
+ * Read lazily so tests can stub the env var after module import.
14
+ */
15
+ export declare function getZapierSdkService(): string | undefined;
10
16
  /**
11
17
  * Maximum number of items that can be requested per page across all paginated functions
12
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACsC,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS,CAInE;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACsC,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAExD;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,MAAM,GAAG,SAAS,CAInE;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC"}
package/dist/constants.js CHANGED
@@ -7,6 +7,14 @@
7
7
  * Base URL for Zapier API endpoints
8
8
  */
9
9
  export const ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
10
+ /**
11
+ * Calling service name for telemetry headers.
12
+ *
13
+ * Read lazily so tests can stub the env var after module import.
14
+ */
15
+ export function getZapierSdkService() {
16
+ return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
17
+ }
10
18
  /**
11
19
  * Maximum number of items that can be requested per page across all paginated functions
12
20
  */
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var zod = require('zod');
4
4
  var policyContext = require('@zapier/policy-context');
5
+ var async_hooks = require('async_hooks');
5
6
  var apps = require('@zapier/zapier-sdk-core/v0/schemas/apps');
6
7
  var connections = require('@zapier/zapier-sdk-core/v0/schemas/connections');
7
8
  var clientCredentials = require('@zapier/zapier-sdk-core/v0/schemas/client-credentials');
@@ -42,6 +43,9 @@ function isPositional(schema) {
42
43
 
43
44
  // src/constants.ts
44
45
  var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
46
+ function getZapierSdkService() {
47
+ return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
48
+ }
45
49
  var MAX_PAGE_LIMIT = 1e4;
46
50
  var DEFAULT_PAGE_SIZE = 100;
47
51
  var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
@@ -834,12 +838,9 @@ function isPlainObject(value) {
834
838
  const proto = Object.getPrototypeOf(value);
835
839
  return proto === Object.prototype || proto === null;
836
840
  }
837
-
838
- // src/utils/telemetry-context.ts
839
841
  var telemetryStore = null;
840
842
  try {
841
- const mod = __require("async_hooks");
842
- telemetryStore = new mod.AsyncLocalStorage();
843
+ telemetryStore = new async_hooks.AsyncLocalStorage();
843
844
  } catch {
844
845
  }
845
846
  function isTelemetryNested() {
@@ -1545,7 +1546,9 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
1545
1546
  return namedFunctions[functionName];
1546
1547
  }
1547
1548
  var ListAppsSchema = apps.ListAppsQuerySchema.omit({
1548
- offset: true
1549
+ offset: true,
1550
+ app_keys: true,
1551
+ page_size: true
1549
1552
  }).extend({
1550
1553
  // New name for appKeys
1551
1554
  apps: AppsPropertySchema.optional().describe(
@@ -1655,10 +1658,10 @@ var listAppsPlugin = (sdk) => {
1655
1658
  });
1656
1659
  return await api.get("/api/v0/apps", {
1657
1660
  searchParams: {
1658
- appKeys: implementationIds.join(","),
1661
+ app_keys: implementationIds.join(","),
1659
1662
  ...options.search && { search: options.search },
1660
1663
  ...options.pageSize !== void 0 && {
1661
- pageSize: options.pageSize.toString()
1664
+ page_size: options.pageSize.toString()
1662
1665
  },
1663
1666
  ...options.cursor && { offset: options.cursor }
1664
1667
  }
@@ -3598,7 +3601,8 @@ var listConnectionsPlugin = (sdk) => {
3598
3601
  };
3599
3602
  };
3600
3603
  var ListClientCredentialsQuerySchema = clientCredentials.ListClientCredentialsQuerySchema.omit({
3601
- offset: true
3604
+ offset: true,
3605
+ page_size: true
3602
3606
  }).extend({
3603
3607
  // Override pageSize to make optional
3604
3608
  pageSize: zod.z.number().min(1).optional().describe("Number of credentials per page"),
@@ -3656,7 +3660,7 @@ var listClientCredentialsPlugin = (sdk) => {
3656
3660
  const { api } = sdk.context;
3657
3661
  const searchParams = {};
3658
3662
  if (options.pageSize !== void 0) {
3659
- searchParams.pageSize = options.pageSize.toString();
3663
+ searchParams.page_size = options.pageSize.toString();
3660
3664
  }
3661
3665
  if (options.cursor) {
3662
3666
  searchParams.offset = options.cursor;
@@ -3854,7 +3858,7 @@ var getAppPlugin = (sdk) => {
3854
3858
  async function getApp(options) {
3855
3859
  const appKey = "app" in options ? options.app : options.appKey;
3856
3860
  const appsIterable = sdk.listApps({
3857
- appKeys: [appKey]
3861
+ apps: [appKey]
3858
3862
  }).items();
3859
3863
  for await (const app of appsIterable) {
3860
3864
  return {
@@ -5744,6 +5748,9 @@ async function invalidateCredentialsToken(options) {
5744
5748
  }
5745
5749
  }
5746
5750
 
5751
+ // src/sdk-version.ts
5752
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.45.2" : void 0) || "unknown";
5753
+
5747
5754
  // src/utils/open-url.ts
5748
5755
  var nodePrefix = "node:";
5749
5756
  async function loadChildProcess() {
@@ -5916,6 +5923,7 @@ var ZapierApiClient = class {
5916
5923
  inputHeaders.forEach((value, key) => {
5917
5924
  mergedHeaders.set(key, value);
5918
5925
  });
5926
+ this.applyTelemetryHeaders(mergedHeaders);
5919
5927
  let retries = 0;
5920
5928
  while (true) {
5921
5929
  const response = await this.options.fetch(url, {
@@ -6285,6 +6293,22 @@ var ZapierApiClient = class {
6285
6293
  }
6286
6294
  return headers;
6287
6295
  }
6296
+ // Telemetry headers consumed by sdkapi's ApiRequestCompletedEvent.
6297
+ // Applied at the outbound layer (after caller-supplied header merging) so
6298
+ // they always reflect the SDK's actual identity and can't be spoofed via
6299
+ // options.headers.
6300
+ applyTelemetryHeaders(headers) {
6301
+ headers.set("x-zapier-sdk-version", SDK_VERSION);
6302
+ const sdkService = getZapierSdkService();
6303
+ if (sdkService) {
6304
+ headers.set("x-zapier-service", sdkService);
6305
+ }
6306
+ const callerPackage = this.options.callerPackage;
6307
+ if (callerPackage) {
6308
+ headers.set("x-zapier-sdk-package", callerPackage.name);
6309
+ headers.set("x-zapier-sdk-package-version", callerPackage.version);
6310
+ }
6311
+ }
6288
6312
  // Helper to perform HTTP requests with JSON handling
6289
6313
  async fetchJson(method, path, data, options = {}) {
6290
6314
  const headers = { ...options.headers };
@@ -6490,7 +6514,8 @@ var apiPlugin = (sdk) => {
6490
6514
  isInteractive,
6491
6515
  approvalTimeoutMs,
6492
6516
  maxApprovalRetries,
6493
- approvalMode
6517
+ approvalMode,
6518
+ callerPackage
6494
6519
  } = sdk.context.options;
6495
6520
  const api = createZapierApi({
6496
6521
  baseUrl,
@@ -6504,7 +6529,8 @@ var apiPlugin = (sdk) => {
6504
6529
  isInteractive,
6505
6530
  approvalTimeoutMs,
6506
6531
  maxApprovalRetries,
6507
- approvalMode
6532
+ approvalMode,
6533
+ callerPackage
6508
6534
  });
6509
6535
  return {
6510
6536
  context: {
@@ -8493,7 +8519,6 @@ function getCpuTime() {
8493
8519
  }
8494
8520
 
8495
8521
  // src/plugins/eventEmission/builders.ts
8496
- var SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
8497
8522
  function createBaseEvent(context = {}) {
8498
8523
  return {
8499
8524
  event_id: generateEventId(),
@@ -9047,6 +9072,7 @@ var BaseSdkOptionsSchema = zod.z.object({
9047
9072
  onEvent: zod.z.custom().optional().meta({ internal: true }),
9048
9073
  fetch: zod.z.custom().optional().meta({ internal: true }),
9049
9074
  eventEmission: zod.z.custom().optional().meta({ internal: true }),
9075
+ callerPackage: zod.z.custom().optional().meta({ internal: true }),
9050
9076
  canIncludeSharedConnections: zod.z.boolean().optional().describe("Allow listing shared connections."),
9051
9077
  canIncludeSharedTables: zod.z.boolean().optional().describe("Allow listing shared tables."),
9052
9078
  canDeleteTables: zod.z.boolean().optional().describe("Allow deleting tables."),
@@ -9181,6 +9207,7 @@ exports.getTableRecordPlugin = getTableRecordPlugin;
9181
9207
  exports.getTokenFromCliLogin = getTokenFromCliLogin;
9182
9208
  exports.getZapierApprovalMode = getZapierApprovalMode;
9183
9209
  exports.getZapierIsInteractive = getZapierIsInteractive;
9210
+ exports.getZapierSdkService = getZapierSdkService;
9184
9211
  exports.injectCliLogin = injectCliLogin;
9185
9212
  exports.inputFieldKeyResolver = inputFieldKeyResolver;
9186
9213
  exports.inputsAllOptionalResolver = inputsAllOptionalResolver;
package/dist/index.d.mts CHANGED
@@ -1456,6 +1456,13 @@ declare const BaseSdkOptionsSchema: z.ZodObject<{
1456
1456
  onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
1457
1457
  fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
1458
1458
  eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
1459
+ callerPackage: z.ZodOptional<z.ZodCustom<{
1460
+ name: string;
1461
+ version: string;
1462
+ }, {
1463
+ name: string;
1464
+ version: string;
1465
+ }>>;
1459
1466
  canIncludeSharedConnections: z.ZodOptional<z.ZodBoolean>;
1460
1467
  canIncludeSharedTables: z.ZodOptional<z.ZodBoolean>;
1461
1468
  canDeleteTables: z.ZodOptional<z.ZodBoolean>;
@@ -2099,6 +2106,9 @@ declare const ConnectionItemSchema: z.ZodObject<{
2099
2106
  groups: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
2100
2107
  members: z.ZodOptional<z.ZodString>;
2101
2108
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
2109
+ public_id: z.ZodOptional<z.ZodString>;
2110
+ account_public_id: z.ZodOptional<z.ZodString>;
2111
+ customuser_public_id: z.ZodOptional<z.ZodString>;
2102
2112
  id: z.ZodString;
2103
2113
  account_id: z.ZodString;
2104
2114
  implementation_id: z.ZodOptional<z.ZodString>;
@@ -3389,6 +3399,12 @@ declare function resetDeprecationWarnings(): void;
3389
3399
  * Base URL for Zapier API endpoints
3390
3400
  */
3391
3401
  declare const ZAPIER_BASE_URL: string;
3402
+ /**
3403
+ * Calling service name for telemetry headers.
3404
+ *
3405
+ * Read lazily so tests can stub the env var after module import.
3406
+ */
3407
+ declare function getZapierSdkService(): string | undefined;
3392
3408
  /**
3393
3409
  * Maximum number of items that can be requested per page across all paginated functions
3394
3410
  */
@@ -3916,4 +3932,4 @@ declare const updateTableRecordsPlugin: Plugin<ApiPluginProvides & EventEmission
3916
3932
  */
3917
3933
  declare const registryPlugin: Plugin<{}, {}>;
3918
3934
 
3919
- export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionProperty, ActionPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppFactoryInput, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type AppProperty, AppPropertySchema, type ApplicationLifecycleEventData, type ApprovalStatus, type AppsPluginProvides, type AppsProperty, AppsPropertySchema, type ArrayResolver, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionEntry, ConnectionEntrySchema, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionProperty, ConnectionPropertySchema, type ConnectionsMap, ConnectionsMapSchema, type ConnectionsPluginProvides, type ConnectionsProperty, ConnectionsPropertySchema, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type CreateTableFieldsPluginProvides, type CreateTablePluginProvides, type CreateTableRecordsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type DeleteTableFieldsPluginProvides, type DeleteTablePluginProvides, type DeleteTableRecordsPluginProvides, type DynamicResolver, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type EventEmissionProvides, type FetchPluginProvides, type Field, type FieldsProperty, FieldsPropertySchema, type FieldsResolver, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionDeprecation, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetProfilePluginProvides, type GetTablePluginProvides, type GetTableRecordPluginProvides, type InfoFieldItem, type InputFieldItem, type InputFieldProperty, InputFieldPropertySchema, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type ListTableFieldsPluginProvides, type ListTableRecordsPluginProvides, type ListTablesPluginProvides, 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 OutputFormatter, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginProvides, type PositionalMetadata, type RateLimitInfo, type RecordProperty, RecordPropertySchema, type RecordsProperty, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type Resolver, type ResolverMetadata, type RootFieldItem, type RunActionPluginProvides, type SdkEvent, type SdkPage, type StaticResolver, type TableProperty, TablePropertySchema, type TablesProperty, TablesPropertySchema, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UpdateTableRecordsPluginProvides, type UserProfile, type UserProfileItem, type WithAddPlugin, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createOptionsPlugin, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierIsInteractive, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
3935
+ export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionProperty, ActionPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppFactoryInput, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type AppProperty, AppPropertySchema, type ApplicationLifecycleEventData, type ApprovalStatus, type AppsPluginProvides, type AppsProperty, AppsPropertySchema, type ArrayResolver, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionEntry, ConnectionEntrySchema, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionProperty, ConnectionPropertySchema, type ConnectionsMap, ConnectionsMapSchema, type ConnectionsPluginProvides, type ConnectionsProperty, ConnectionsPropertySchema, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type CreateTableFieldsPluginProvides, type CreateTablePluginProvides, type CreateTableRecordsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type DeleteTableFieldsPluginProvides, type DeleteTablePluginProvides, type DeleteTableRecordsPluginProvides, type DynamicResolver, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type EventEmissionProvides, type FetchPluginProvides, type Field, type FieldsProperty, FieldsPropertySchema, type FieldsResolver, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionDeprecation, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetProfilePluginProvides, type GetTablePluginProvides, type GetTableRecordPluginProvides, type InfoFieldItem, type InputFieldItem, type InputFieldProperty, InputFieldPropertySchema, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type ListTableFieldsPluginProvides, type ListTableRecordsPluginProvides, type ListTablesPluginProvides, 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 OutputFormatter, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginProvides, type PositionalMetadata, type RateLimitInfo, type RecordProperty, RecordPropertySchema, type RecordsProperty, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type Resolver, type ResolverMetadata, type RootFieldItem, type RunActionPluginProvides, type SdkEvent, type SdkPage, type StaticResolver, type TableProperty, TablePropertySchema, type TablesProperty, TablesPropertySchema, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UpdateTableRecordsPluginProvides, type UserProfile, type UserProfileItem, type WithAddPlugin, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createOptionsPlugin, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierIsInteractive, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { buildHttpRequestContext, buildActionRunContext } from '@zapier/policy-context';
3
+ import { AsyncLocalStorage } from 'async_hooks';
3
4
  import { ListAppsQuerySchema, AppItemSchema as AppItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/apps';
4
5
  import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionItemSchema as ConnectionItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/connections';
5
6
  import { ListClientCredentialsQuerySchema as ListClientCredentialsQuerySchema$1, CreateClientCredentialsRequestSchema, ClientCredentialsItemSchema as ClientCredentialsItemSchema$1, ClientCredentialsCreatedItemSchema as ClientCredentialsCreatedItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/client-credentials';
@@ -40,6 +41,9 @@ function isPositional(schema) {
40
41
 
41
42
  // src/constants.ts
42
43
  var ZAPIER_BASE_URL = globalThis.process?.env?.ZAPIER_BASE_URL || "https://zapier.com";
44
+ function getZapierSdkService() {
45
+ return globalThis.process?.env?.ZAPIER_SDK_SERVICE;
46
+ }
43
47
  var MAX_PAGE_LIMIT = 1e4;
44
48
  var DEFAULT_PAGE_SIZE = 100;
45
49
  var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
@@ -832,12 +836,9 @@ function isPlainObject(value) {
832
836
  const proto = Object.getPrototypeOf(value);
833
837
  return proto === Object.prototype || proto === null;
834
838
  }
835
-
836
- // src/utils/telemetry-context.ts
837
839
  var telemetryStore = null;
838
840
  try {
839
- const mod = __require("async_hooks");
840
- telemetryStore = new mod.AsyncLocalStorage();
841
+ telemetryStore = new AsyncLocalStorage();
841
842
  } catch {
842
843
  }
843
844
  function isTelemetryNested() {
@@ -1543,7 +1544,9 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
1543
1544
  return namedFunctions[functionName];
1544
1545
  }
1545
1546
  var ListAppsSchema = ListAppsQuerySchema.omit({
1546
- offset: true
1547
+ offset: true,
1548
+ app_keys: true,
1549
+ page_size: true
1547
1550
  }).extend({
1548
1551
  // New name for appKeys
1549
1552
  apps: AppsPropertySchema.optional().describe(
@@ -1653,10 +1656,10 @@ var listAppsPlugin = (sdk) => {
1653
1656
  });
1654
1657
  return await api.get("/api/v0/apps", {
1655
1658
  searchParams: {
1656
- appKeys: implementationIds.join(","),
1659
+ app_keys: implementationIds.join(","),
1657
1660
  ...options.search && { search: options.search },
1658
1661
  ...options.pageSize !== void 0 && {
1659
- pageSize: options.pageSize.toString()
1662
+ page_size: options.pageSize.toString()
1660
1663
  },
1661
1664
  ...options.cursor && { offset: options.cursor }
1662
1665
  }
@@ -3596,7 +3599,8 @@ var listConnectionsPlugin = (sdk) => {
3596
3599
  };
3597
3600
  };
3598
3601
  var ListClientCredentialsQuerySchema = ListClientCredentialsQuerySchema$1.omit({
3599
- offset: true
3602
+ offset: true,
3603
+ page_size: true
3600
3604
  }).extend({
3601
3605
  // Override pageSize to make optional
3602
3606
  pageSize: z.number().min(1).optional().describe("Number of credentials per page"),
@@ -3654,7 +3658,7 @@ var listClientCredentialsPlugin = (sdk) => {
3654
3658
  const { api } = sdk.context;
3655
3659
  const searchParams = {};
3656
3660
  if (options.pageSize !== void 0) {
3657
- searchParams.pageSize = options.pageSize.toString();
3661
+ searchParams.page_size = options.pageSize.toString();
3658
3662
  }
3659
3663
  if (options.cursor) {
3660
3664
  searchParams.offset = options.cursor;
@@ -3852,7 +3856,7 @@ var getAppPlugin = (sdk) => {
3852
3856
  async function getApp(options) {
3853
3857
  const appKey = "app" in options ? options.app : options.appKey;
3854
3858
  const appsIterable = sdk.listApps({
3855
- appKeys: [appKey]
3859
+ apps: [appKey]
3856
3860
  }).items();
3857
3861
  for await (const app of appsIterable) {
3858
3862
  return {
@@ -5742,6 +5746,9 @@ async function invalidateCredentialsToken(options) {
5742
5746
  }
5743
5747
  }
5744
5748
 
5749
+ // src/sdk-version.ts
5750
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.45.2" : void 0) || "unknown";
5751
+
5745
5752
  // src/utils/open-url.ts
5746
5753
  var nodePrefix = "node:";
5747
5754
  async function loadChildProcess() {
@@ -5914,6 +5921,7 @@ var ZapierApiClient = class {
5914
5921
  inputHeaders.forEach((value, key) => {
5915
5922
  mergedHeaders.set(key, value);
5916
5923
  });
5924
+ this.applyTelemetryHeaders(mergedHeaders);
5917
5925
  let retries = 0;
5918
5926
  while (true) {
5919
5927
  const response = await this.options.fetch(url, {
@@ -6283,6 +6291,22 @@ var ZapierApiClient = class {
6283
6291
  }
6284
6292
  return headers;
6285
6293
  }
6294
+ // Telemetry headers consumed by sdkapi's ApiRequestCompletedEvent.
6295
+ // Applied at the outbound layer (after caller-supplied header merging) so
6296
+ // they always reflect the SDK's actual identity and can't be spoofed via
6297
+ // options.headers.
6298
+ applyTelemetryHeaders(headers) {
6299
+ headers.set("x-zapier-sdk-version", SDK_VERSION);
6300
+ const sdkService = getZapierSdkService();
6301
+ if (sdkService) {
6302
+ headers.set("x-zapier-service", sdkService);
6303
+ }
6304
+ const callerPackage = this.options.callerPackage;
6305
+ if (callerPackage) {
6306
+ headers.set("x-zapier-sdk-package", callerPackage.name);
6307
+ headers.set("x-zapier-sdk-package-version", callerPackage.version);
6308
+ }
6309
+ }
6286
6310
  // Helper to perform HTTP requests with JSON handling
6287
6311
  async fetchJson(method, path, data, options = {}) {
6288
6312
  const headers = { ...options.headers };
@@ -6488,7 +6512,8 @@ var apiPlugin = (sdk) => {
6488
6512
  isInteractive,
6489
6513
  approvalTimeoutMs,
6490
6514
  maxApprovalRetries,
6491
- approvalMode
6515
+ approvalMode,
6516
+ callerPackage
6492
6517
  } = sdk.context.options;
6493
6518
  const api = createZapierApi({
6494
6519
  baseUrl,
@@ -6502,7 +6527,8 @@ var apiPlugin = (sdk) => {
6502
6527
  isInteractive,
6503
6528
  approvalTimeoutMs,
6504
6529
  maxApprovalRetries,
6505
- approvalMode
6530
+ approvalMode,
6531
+ callerPackage
6506
6532
  });
6507
6533
  return {
6508
6534
  context: {
@@ -8491,7 +8517,6 @@ function getCpuTime() {
8491
8517
  }
8492
8518
 
8493
8519
  // src/plugins/eventEmission/builders.ts
8494
- var SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
8495
8520
  function createBaseEvent(context = {}) {
8496
8521
  return {
8497
8522
  event_id: generateEventId(),
@@ -9045,6 +9070,7 @@ var BaseSdkOptionsSchema = z.object({
9045
9070
  onEvent: z.custom().optional().meta({ internal: true }),
9046
9071
  fetch: z.custom().optional().meta({ internal: true }),
9047
9072
  eventEmission: z.custom().optional().meta({ internal: true }),
9073
+ callerPackage: z.custom().optional().meta({ internal: true }),
9048
9074
  canIncludeSharedConnections: z.boolean().optional().describe("Allow listing shared connections."),
9049
9075
  canIncludeSharedTables: z.boolean().optional().describe("Allow listing shared tables."),
9050
9076
  canDeleteTables: z.boolean().optional().describe("Allow deleting tables."),
@@ -9061,4 +9087,4 @@ var registryPlugin = () => {
9061
9087
  return {};
9062
9088
  };
9063
9089
 
9064
- export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createOptionsPlugin, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierIsInteractive, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
9090
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createOptionsPlugin, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getZapierApprovalMode, getZapierIsInteractive, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,kBAAkB,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAC5B;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,CAAA;CAAE,EACxC,iBAAiB,CA8ClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,kBAAkB,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAC5B;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,CAAA;CAAE,EACxC,iBAAiB,CAgDlB,CAAC"}
@@ -3,7 +3,7 @@ import { resolveCredentials } from "../../credentials";
3
3
  import { ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, } from "../../constants";
4
4
  export const apiPlugin = (sdk) => {
5
5
  // Extract all options - everything passed to the plugin
6
- const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, isInteractive, approvalTimeoutMs, maxApprovalRetries, approvalMode, } = sdk.context.options;
6
+ const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, isInteractive, approvalTimeoutMs, maxApprovalRetries, approvalMode, callerPackage, } = sdk.context.options;
7
7
  // Create the API client - it will handle token resolution internally
8
8
  const api = createZapierApi({
9
9
  baseUrl,
@@ -18,6 +18,7 @@ export const apiPlugin = (sdk) => {
18
18
  approvalTimeoutMs,
19
19
  maxApprovalRetries,
20
20
  approvalMode,
21
+ callerPackage,
21
22
  });
22
23
  // Return flat structure with context only
23
24
  return {
@@ -5,7 +5,7 @@
5
5
  * schema compliance for all event types.
6
6
  */
7
7
  import { generateEventId, getCurrentTimestamp, getReleaseId, getOsInfo, getPlatformVersions, getMemoryUsage, getCpuTime, isCi, getCiPlatform, } from "./utils";
8
- const SDK_VERSION = globalThis.process?.env?.SDK_VERSION || "unknown";
8
+ import { SDK_VERSION } from "../../sdk-version";
9
9
  // Create base event with auto-populated common fields
10
10
  // Kept for backward compatibility but can be replaced with direct construction
11
11
  export function createBaseEvent(context = {}) {
@@ -10,7 +10,7 @@ export const getAppPlugin = (sdk) => {
10
10
  const appKey = "app" in options ? options.app : options.appKey;
11
11
  const appsIterable = sdk
12
12
  .listApps({
13
- appKeys: [appKey],
13
+ apps: [appKey],
14
14
  })
15
15
  .items();
16
16
  for await (const app of appsIterable) {
@@ -42,10 +42,10 @@ export const listAppsPlugin = (sdk) => {
42
42
  });
43
43
  return await api.get("/api/v0/apps", {
44
44
  searchParams: {
45
- appKeys: implementationIds.join(","),
45
+ app_keys: implementationIds.join(","),
46
46
  ...(options.search && { search: options.search }),
47
47
  ...(options.pageSize !== undefined && {
48
- pageSize: options.pageSize.toString(),
48
+ page_size: options.pageSize.toString(),
49
49
  }),
50
50
  ...(options.cursor && { offset: options.cursor }),
51
51
  },
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,sBAAsB,IAAI,0BAA0B,EAEpD,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACtB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAE,iBAAiB,IAAI,aAAa,EAAE,CAAC;AAC9C,OAAO,EAAE,0BAA0B,IAAI,sBAAsB,EAAE,CAAC;AAChE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;iBA4BmC,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,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BAAoB,CAAC,eAAe,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC;CACtE"}
@@ -27,6 +27,8 @@ export { ListAppsResponseSchemaBase as ListAppsResponseSchema };
27
27
  */
28
28
  export const ListAppsSchema = ListAppsQueryBase.omit({
29
29
  offset: true,
30
+ app_keys: true,
31
+ page_size: true,
30
32
  })
31
33
  .extend({
32
34
  // New name for appKeys
@@ -10,7 +10,7 @@ export const listClientCredentialsPlugin = (sdk) => {
10
10
  const { api } = sdk.context;
11
11
  const searchParams = {};
12
12
  if (options.pageSize !== undefined) {
13
- searchParams.pageSize = options.pageSize.toString();
13
+ searchParams.page_size = options.pageSize.toString();
14
14
  }
15
15
  if (options.cursor) {
16
16
  searchParams.offset = options.cursor;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,gCAAgC;;;;iBAoBsB,CAAC;AAGpE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,gCAAgC,CACxC,CAAC;AAGF,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,0BAA0B,GAClC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,gCAAgC;IAC/C,qBAAqB,EAAE,oBAAoB,CACzC,4BAA4B,EAC5B,qBAAqB,CACtB,CAAC;CACH"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listClientCredentials/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAEnG,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,eAAO,MAAM,gCAAgC;;;;iBAqBsB,CAAC;AAGpE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,gCAAgC,CACxC,CAAC;AAGF,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,0BAA0B,GAClC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,gCAAgC;IAC/C,qBAAqB,EAAE,oBAAoB,CACzC,4BAA4B,EAC5B,qBAAqB,CACtB,CAAC;CACH"}
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { ListClientCredentialsQuerySchema as ListClientCredentialsQueryBase } from "@zapier/zapier-sdk-core/v0/schemas/client-credentials";
3
3
  export const ListClientCredentialsQuerySchema = ListClientCredentialsQueryBase.omit({
4
4
  offset: true,
5
+ page_size: true,
5
6
  })
6
7
  .extend({
7
8
  // Override pageSize to make optional
@@ -16,6 +16,9 @@ export declare const ConnectionItemSchema: z.ZodObject<{
16
16
  groups: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
17
17
  members: z.ZodOptional<z.ZodString>;
18
18
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
19
+ public_id: z.ZodOptional<z.ZodString>;
20
+ account_public_id: z.ZodOptional<z.ZodString>;
21
+ customuser_public_id: z.ZodOptional<z.ZodString>;
19
22
  id: z.ZodString;
20
23
  account_id: z.ZodString;
21
24
  implementation_id: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/schemas/Connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B/B,CAAC;AAMH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/schemas/Connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B/B,CAAC;AAMH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * SDK package version, injected at build time.
3
+ *
4
+ * tsup's `define` (see `tsup.config.ts`) replaces the literal
5
+ * `process.env.SDK_VERSION` token with the package version string when the
6
+ * dist bundle is produced. That dist is what NPM publishes and what external
7
+ * consumers resolve via the `main`/`module` exports.
8
+ *
9
+ * In source-mode consumers (anything resolving the `source` export
10
+ * condition) tsup never runs, so the read falls through to a real
11
+ * `process.env.SDK_VERSION` env-var lookup — usually unset, hence the
12
+ * "unknown" fallback. The `typeof process` guard keeps the source-mode read
13
+ * safe in browsers where `process` is undefined; the additional
14
+ * `process.env` check covers oddly-shimmed environments where `process`
15
+ * exists but `process.env` doesn't (some bundler polyfills), preventing a
16
+ * TypeError on member access.
17
+ *
18
+ * The literal `process.env.SDK_VERSION` member access has to stay textually
19
+ * intact in this expression so esbuild's `define` matches and substitutes
20
+ * it; the surrounding guards don't interfere with that match.
21
+ *
22
+ * This pattern is intentionally different from the runtime env reads in
23
+ * `constants.ts` (`globalThis.process?.env?.X`): those must NOT be inlined
24
+ * because they're per-consumer config; this one MUST be inlined because
25
+ * it's a fixed, package-published value.
26
+ */
27
+ export declare const SDK_VERSION: string;
28
+ //# sourceMappingURL=sdk-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-version.d.ts","sourceRoot":"","sources":["../src/sdk-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,WAAW,QAGK,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * SDK package version, injected at build time.
3
+ *
4
+ * tsup's `define` (see `tsup.config.ts`) replaces the literal
5
+ * `process.env.SDK_VERSION` token with the package version string when the
6
+ * dist bundle is produced. That dist is what NPM publishes and what external
7
+ * consumers resolve via the `main`/`module` exports.
8
+ *
9
+ * In source-mode consumers (anything resolving the `source` export
10
+ * condition) tsup never runs, so the read falls through to a real
11
+ * `process.env.SDK_VERSION` env-var lookup — usually unset, hence the
12
+ * "unknown" fallback. The `typeof process` guard keeps the source-mode read
13
+ * safe in browsers where `process` is undefined; the additional
14
+ * `process.env` check covers oddly-shimmed environments where `process`
15
+ * exists but `process.env` doesn't (some bundler polyfills), preventing a
16
+ * TypeError on member access.
17
+ *
18
+ * The literal `process.env.SDK_VERSION` member access has to stay textually
19
+ * intact in this expression so esbuild's `define` matches and substitutes
20
+ * it; the surrounding guards don't interfere with that match.
21
+ *
22
+ * This pattern is intentionally different from the runtime env reads in
23
+ * `constants.ts` (`globalThis.process?.env?.X`): those must NOT be inlined
24
+ * because they're per-consumer config; this one MUST be inlined because
25
+ * it's a fixed, package-published value.
26
+ */
27
+ export const SDK_VERSION = (typeof process !== "undefined" && process.env
28
+ ? process.env.SDK_VERSION
29
+ : undefined) || "unknown";
@@ -69,6 +69,13 @@ export declare const BaseSdkOptionsSchema: z.ZodObject<{
69
69
  onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
70
70
  fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
71
71
  eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
72
+ callerPackage: z.ZodOptional<z.ZodCustom<{
73
+ name: string;
74
+ version: string;
75
+ }, {
76
+ name: string;
77
+ version: string;
78
+ }>>;
72
79
  canIncludeSharedConnections: z.ZodOptional<z.ZodBoolean>;
73
80
  canIncludeSharedTables: z.ZodOptional<z.ZodBoolean>;
74
81
  canDeleteTables: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,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;AAIpD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4F/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,+BAA+B,EA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,EAChC,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB;CAAG"}
package/dist/types/sdk.js CHANGED
@@ -73,6 +73,10 @@ export const BaseSdkOptionsSchema = z.object({
73
73
  .custom()
74
74
  .optional()
75
75
  .meta({ internal: true }),
76
+ callerPackage: z
77
+ .custom()
78
+ .optional()
79
+ .meta({ internal: true }),
76
80
  canIncludeSharedConnections: z
77
81
  .boolean()
78
82
  .optional()
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-context.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAoBD,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAIzD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAKhE;AAED,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAG9D"}
1
+ {"version":3,"file":"telemetry-context.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAwBD,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAIzD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAKhE;AAED,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAG9D"}
@@ -3,16 +3,23 @@
3
3
  * SDK method call runs in its own ALS scope (via runWithTelemetryContext), isolating
4
4
  * its depth counter and method metadata from concurrent calls.
5
5
  */
6
- // Intentional dynamic require one-time environment detection for AsyncLocalStorage
7
- // availability (e.g., unavailable in browsers). This is NOT lazy loading.
6
+ import { AsyncLocalStorage, } from "node:async_hooks";
7
+ // Static import of `AsyncLocalStorage` works in both CJS and ESM tsup bundles
8
+ // because tsup converts the import statement directly (to `require()` in CJS,
9
+ // kept as native `import` in ESM), bypassing the `__require` shim that
10
+ // silently broke the previous `require("node:async_hooks")` pattern in ESM —
11
+ // the bug that left ESM consumers (notably the CLI) without a telemetry
12
+ // store and dropped nested-call detection on every call.
13
+ //
14
+ // Browsers can't resolve `node:async_hooks` at bundle time; consumers who
15
+ // bundle the SDK for browsers need to mark this module external or polyfill
16
+ // it. The try/catch covers any other instantiation failure.
8
17
  let telemetryStore = null;
9
18
  try {
10
- const mod = require("node:async_hooks");
11
- telemetryStore = new mod.AsyncLocalStorage();
19
+ telemetryStore = new AsyncLocalStorage();
12
20
  }
13
21
  catch {
14
- // In non-Node environments, telemetry is disabled entirely (isTelemetryNested
15
- // always returns true) since we can't reliably deduplicate nested calls.
22
+ // Non-Node environment (browser, etc.) — telemetry context disabled.
16
23
  }
17
24
  export function isTelemetryNested() {
18
25
  if (!telemetryStore)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -42,7 +42,11 @@
42
42
  },
43
43
  "browser": {
44
44
  "@zapier/zapier-sdk-cli/login": false,
45
- "@zapier/zapier-sdk-cli-login": false
45
+ "@zapier/zapier-sdk-cli-login": false,
46
+ "async_hooks": false,
47
+ "node:async_hooks": false,
48
+ "os": false,
49
+ "node:os": false
46
50
  },
47
51
  "files": [
48
52
  "dist",
@@ -71,8 +75,8 @@
71
75
  "dependencies": {
72
76
  "@zapier/policy-context": "0.7.0",
73
77
  "@zapier/policy-schema": "0.11.0",
74
- "@zapier/zapier-sdk-core": "^0.8.0",
75
- "zod": "4.2.1"
78
+ "@zapier/zapier-sdk-core": "0.12.0",
79
+ "zod": "4.3.6"
76
80
  },
77
81
  "devDependencies": {
78
82
  "@types/node": "^24.0.1",