@zapier/zapier-sdk 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/client.d.ts.map +1 -1
  3. package/dist/api/client.js +10 -3
  4. package/dist/index.cjs +41 -18
  5. package/dist/index.d.mts +11 -6
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.mjs +41 -18
  9. package/dist/plugins/api/index.d.ts +1 -1
  10. package/dist/plugins/listApps/index.d.ts +1 -1
  11. package/dist/plugins/tables/createTable/index.d.ts +1 -1
  12. package/dist/plugins/tables/createTableFields/index.d.ts +1 -1
  13. package/dist/plugins/tables/createTableRecords/index.d.ts +1 -1
  14. package/dist/plugins/tables/deleteTable/index.d.ts +1 -1
  15. package/dist/plugins/tables/deleteTableFields/index.d.ts +1 -1
  16. package/dist/plugins/tables/deleteTableRecords/index.d.ts +1 -1
  17. package/dist/plugins/tables/getTable/index.d.ts +1 -1
  18. package/dist/plugins/tables/getTableRecord/index.d.ts +1 -1
  19. package/dist/plugins/tables/listTableFields/index.d.ts +1 -1
  20. package/dist/plugins/tables/listTableRecords/index.d.ts +1 -1
  21. package/dist/plugins/tables/listTables/index.d.ts +1 -1
  22. package/dist/plugins/tables/updateTableRecords/index.d.ts +1 -1
  23. package/dist/sdk.d.ts.map +1 -1
  24. package/dist/sdk.js +36 -15
  25. package/dist/types/plugin.d.ts +3 -0
  26. package/dist/types/plugin.d.ts.map +1 -1
  27. package/dist/utils/plugin-utils.d.ts +7 -5
  28. package/dist/utils/plugin-utils.d.ts.map +1 -1
  29. package/dist/utils/plugin-utils.js +7 -5
  30. package/dist/utils/url-utils.d.ts +6 -0
  31. package/dist/utils/url-utils.d.ts.map +1 -1
  32. package/dist/utils/url-utils.js +17 -0
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.48.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c7cff63: Adds an extension mechanism that lets the CLI and MCP server load additional plugin packages at runtime. Set `ZAPIER_SDK_EXTENSIONS` to a comma-separated list of package specifiers, or pass them via the new `extensions` option — methods they contribute show up automatically as CLI commands and MCP tools, no per-project wiring required.
8
+
9
+ When a plugin tries to register a method, context field, or meta entry that's already registered by another plugin in the chain, `addPlugin` now logs a warning and skips the duplicate plugin's contribution rather than silently overwriting. This catches the common foot-gun of an extension accidentally shadowing a built-in SDK method. Intentional duplicates can be expressed via `composePlugins(...)`, and meta-only overrides (e.g. tagging a built-in method as deprecated) continue to work unchanged.
10
+
11
+ ## 0.47.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 4ab820a: Skip the approval `poll_url` and `approval_url` origin checks when `baseUrl` (or `ZAPIER_BASE_URL`) points at `localhost` / `127.0.0.1`. Local dev runs sdkapi, approvalsapi, and the approval frontend on different ports, so the origin pin can never match. The check is intended to stop a compromised sdkapi from redirecting bearer-token traffic to an attacker host — a threat that doesn't apply when the developer owns every service on the machine.
16
+
3
17
  ## 0.47.0
4
18
 
5
19
  ### Minor Changes
@@ -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;AAqiCjB,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;AAgjCjB,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,SAW3D,CAAC"}
@@ -8,7 +8,7 @@ import { getAuthorizationHeader } from "./auth";
8
8
  import { createDebugLogger, createDebugFetch } from "./debug";
9
9
  import { pollUntilComplete } from "./polling";
10
10
  import { resolveAuthToken, invalidateCredentialsToken, isCliLoginAvailable, } from "../auth";
11
- import { getZapierBaseUrl } from "../utils/url-utils";
11
+ import { getZapierBaseUrl, isLocalhostBaseUrl } 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, ZapierResourceNotFoundError, ZapierRateLimitError, } from "../types/errors";
@@ -711,8 +711,15 @@ class ZapierApiClient {
711
711
  throw new ZapierApiError(`Approval ${label} origin ${parsed.origin} does not match expected ${expectedOrigin}`, { statusCode: approvalResponse.status, response: body });
712
712
  }
713
713
  };
714
- assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
715
- assertApprovalOrigin(approval.approval_url, browserOrigin, "approval_url");
714
+ // In local dev the SDK API, approvalsapi, and approval frontend run on
715
+ // different localhost ports, so neither origin can match. The check
716
+ // exists to stop a compromised sdkapi from redirecting bearer-token
717
+ // traffic to an attacker host — that threat model doesn't apply when
718
+ // the dev owns every service on the machine.
719
+ if (!isLocalhostBaseUrl(this.options.baseUrl)) {
720
+ assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
721
+ assertApprovalOrigin(approval.approval_url, browserOrigin, "approval_url");
722
+ }
716
723
  this.emitEvent("approval:required", {
717
724
  approvalId: approval.approval_id,
718
725
  approvalUrl: approval.approval_url,
package/dist/index.cjs CHANGED
@@ -5207,6 +5207,17 @@ function getZapierBaseUrl(baseUrl) {
5207
5207
  return void 0;
5208
5208
  }
5209
5209
  }
5210
+ function isLocalhostBaseUrl(baseUrl) {
5211
+ if (!baseUrl) {
5212
+ return false;
5213
+ }
5214
+ try {
5215
+ const { hostname } = new URL(baseUrl);
5216
+ return hostname === "localhost" || hostname === "127.0.0.1";
5217
+ } catch {
5218
+ return false;
5219
+ }
5220
+ }
5210
5221
  function getTrackingBaseUrl({
5211
5222
  trackingBaseUrl,
5212
5223
  baseUrl
@@ -5620,7 +5631,7 @@ async function invalidateCredentialsToken(options) {
5620
5631
  }
5621
5632
 
5622
5633
  // src/sdk-version.ts
5623
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.47.0" : void 0) || "unknown";
5634
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.48.0" : void 0) || "unknown";
5624
5635
 
5625
5636
  // src/utils/open-url.ts
5626
5637
  var nodePrefix = "node:";
@@ -6286,8 +6297,14 @@ var ZapierApiClient = class {
6286
6297
  );
6287
6298
  }
6288
6299
  };
6289
- assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
6290
- assertApprovalOrigin(approval.approval_url, browserOrigin, "approval_url");
6300
+ if (!isLocalhostBaseUrl(this.options.baseUrl)) {
6301
+ assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
6302
+ assertApprovalOrigin(
6303
+ approval.approval_url,
6304
+ browserOrigin,
6305
+ "approval_url"
6306
+ );
6307
+ }
6291
6308
  this.emitEvent("approval:required", {
6292
6309
  approvalId: approval.approval_id,
6293
6310
  approvalUrl: approval.approval_url
@@ -8468,24 +8485,30 @@ function buildSdk(properties, context) {
8468
8485
  context: frozenContext
8469
8486
  });
8470
8487
  const { context: pluginContext, ...pluginProperties } = pluginResult;
8488
+ const { meta: pluginMeta, ...pluginContextRest } = pluginContext ?? {};
8489
+ const existingProperties = properties;
8490
+ const existingContext = context;
8491
+ const existingMeta = context.meta ?? {};
8492
+ const collisions = [];
8493
+ for (const key of Object.keys(pluginProperties)) {
8494
+ if (key in existingProperties) collisions.push(`method "${key}"`);
8495
+ }
8496
+ for (const key of Object.keys(pluginContextRest)) {
8497
+ if (key in existingContext) collisions.push(`context.${key}`);
8498
+ }
8499
+ if (collisions.length > 0) {
8500
+ const name = plugin.name || "anonymous plugin";
8501
+ console.warn(
8502
+ `[zapier-sdk] Skipping "${name}" \u2014 duplicate registration of: ${collisions.join(", ")}. If the duplicate is intentional, wrap with composePlugins(...). Otherwise rename the method or remove the duplicate.`
8503
+ );
8504
+ return buildSdk(properties, context);
8505
+ }
8471
8506
  const mergedProperties = { ...properties, ...pluginProperties };
8472
- let mergedContext = {
8507
+ const mergedContext = {
8473
8508
  ...context,
8474
- meta: context.meta || {}
8509
+ ...pluginContextRest,
8510
+ meta: { ...existingMeta, ...pluginMeta ?? {} }
8475
8511
  };
8476
- if (pluginContext) {
8477
- const { meta: pluginMeta, ...pluginContextRest } = pluginContext;
8478
- mergedContext = {
8479
- ...mergedContext,
8480
- ...pluginContextRest
8481
- };
8482
- if (pluginMeta) {
8483
- mergedContext = {
8484
- ...mergedContext,
8485
- meta: { ...mergedContext.meta, ...pluginMeta }
8486
- };
8487
- }
8488
- }
8489
8512
  return buildSdk(
8490
8513
  mergedProperties,
8491
8514
  mergedContext
package/dist/index.d.mts CHANGED
@@ -1457,6 +1457,9 @@ interface Plugin<TSdk = {}, TProvides extends PluginProvides = PluginProvides> {
1457
1457
  /**
1458
1458
  * Takes an SDK shape and adds addPlugin and getRegistry methods to it.
1459
1459
  * addPlugin merges a plugin's result into the shape, producing a new SDK.
1460
+ * Use composePlugins(...) to bundle multiple plugins into one before
1461
+ * adding — addPlugin itself is single-plugin only, which keeps inference
1462
+ * stable through long chains.
1460
1463
  * getRegistry is a lazy view over context.meta, available on every sdk
1461
1464
  * produced by buildSdk regardless of plugin order.
1462
1465
  */
@@ -8529,11 +8532,13 @@ type ComposeProvides<T extends readonly Plugin<any, any>[]> = IntersectAll<Provi
8529
8532
  * once). Works fine for homogeneous-deps groups; widens slightly for
8530
8533
  * heterogeneous ones, which keeps the variadic types tractable.
8531
8534
  * 3. **Collision detection.** Throws on duplicate root keys, duplicate
8532
- * `context.meta` keys, and duplicate non-meta `context.*` keys. Note
8533
- * this only applies *inside* a single `composePlugins(...)` call
8534
- * cross-`addPlugin` overrides (e.g. a CLI plugin overriding meta from
8535
- * a core SDK plugin) still go through `addPlugin`'s last-write-wins
8536
- * merge unchanged.
8535
+ * `context.meta` keys, and duplicate non-meta `context.*` keys
8536
+ * *inside* a single `composePlugins(...)` call. Cross-`addPlugin`
8537
+ * collisions are handled separately by `addPlugin` itself, which
8538
+ * warns-and-skips the colliding plugin (the first registration
8539
+ * wins). Pure meta-only overrides (e.g. `cliOverridesPlugin`
8540
+ * patching `meta.fetch.deprecated` without re-registering `fetch`)
8541
+ * stay legitimate in both code paths.
8537
8542
  *
8538
8543
  * Why prefer this over an `addPlugin([...])` array overload: TypeScript's
8539
8544
  * overload resolution interacts badly with arrays carrying a mix of
@@ -8554,4 +8559,4 @@ declare const registryPlugin: (sdk: {
8554
8559
  };
8555
8560
  }) => {};
8556
8561
 
8557
- 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 ActionItem as ActionResolverItem, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeItem, 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 PaginatedSdkResult, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginMeta, type PluginProvides, type PositionalMetadata, type RateLimitInfo, type RecordProperty, RecordPropertySchema, type RecordsProperty, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedAppLocator, 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, type ZapierCache, type ZapierCacheEntry, type ZapierCacheSetOptions, 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, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, 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 };
8562
+ 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 ActionItem as ActionResolverItem, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeItem, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiClient, 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 PaginatedSdkResult, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginMeta, type PluginProvides, type PollOptions, type PositionalMetadata, type RateLimitInfo, type RecordProperty, RecordPropertySchema, type RecordsProperty, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, type RequestOptions, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedAppLocator, 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, type ZapierCache, type ZapierCacheEntry, type ZapierCacheSetOptions, 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, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, definePlugin, 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.d.ts CHANGED
@@ -60,6 +60,7 @@ export { definePlugin, createPluginMethod, createPaginatedPluginMethod, composeP
60
60
  export type { ActionItem as ActionResolverItem } from "./resolvers/actionKey";
61
61
  export type { ActionTypeItem } from "./resolvers/actionType";
62
62
  export type { ResolvedAppLocator } from "./utils/domain-utils";
63
+ export type { ApiClient, RequestOptions, PollOptions } from "./api/types";
63
64
  export { registryPlugin } from "./plugins/registry";
64
65
  export type { ZapierSdk } from "./sdk";
65
66
  export type { BaseEvent, MethodCalledEvent } from "./types/telemetry-events";
@@ -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;AA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EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,YAAY,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,GACf,MAAM,sBAAsB,CAAC;AAK9B,YAAY,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,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.mjs CHANGED
@@ -5205,6 +5205,17 @@ function getZapierBaseUrl(baseUrl) {
5205
5205
  return void 0;
5206
5206
  }
5207
5207
  }
5208
+ function isLocalhostBaseUrl(baseUrl) {
5209
+ if (!baseUrl) {
5210
+ return false;
5211
+ }
5212
+ try {
5213
+ const { hostname } = new URL(baseUrl);
5214
+ return hostname === "localhost" || hostname === "127.0.0.1";
5215
+ } catch {
5216
+ return false;
5217
+ }
5218
+ }
5208
5219
  function getTrackingBaseUrl({
5209
5220
  trackingBaseUrl,
5210
5221
  baseUrl
@@ -5618,7 +5629,7 @@ async function invalidateCredentialsToken(options) {
5618
5629
  }
5619
5630
 
5620
5631
  // src/sdk-version.ts
5621
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.47.0" : void 0) || "unknown";
5632
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.48.0" : void 0) || "unknown";
5622
5633
 
5623
5634
  // src/utils/open-url.ts
5624
5635
  var nodePrefix = "node:";
@@ -6284,8 +6295,14 @@ var ZapierApiClient = class {
6284
6295
  );
6285
6296
  }
6286
6297
  };
6287
- assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
6288
- assertApprovalOrigin(approval.approval_url, browserOrigin, "approval_url");
6298
+ if (!isLocalhostBaseUrl(this.options.baseUrl)) {
6299
+ assertApprovalOrigin(approval.poll_url, sdkapiOrigin, "poll_url");
6300
+ assertApprovalOrigin(
6301
+ approval.approval_url,
6302
+ browserOrigin,
6303
+ "approval_url"
6304
+ );
6305
+ }
6289
6306
  this.emitEvent("approval:required", {
6290
6307
  approvalId: approval.approval_id,
6291
6308
  approvalUrl: approval.approval_url
@@ -8466,24 +8483,30 @@ function buildSdk(properties, context) {
8466
8483
  context: frozenContext
8467
8484
  });
8468
8485
  const { context: pluginContext, ...pluginProperties } = pluginResult;
8486
+ const { meta: pluginMeta, ...pluginContextRest } = pluginContext ?? {};
8487
+ const existingProperties = properties;
8488
+ const existingContext = context;
8489
+ const existingMeta = context.meta ?? {};
8490
+ const collisions = [];
8491
+ for (const key of Object.keys(pluginProperties)) {
8492
+ if (key in existingProperties) collisions.push(`method "${key}"`);
8493
+ }
8494
+ for (const key of Object.keys(pluginContextRest)) {
8495
+ if (key in existingContext) collisions.push(`context.${key}`);
8496
+ }
8497
+ if (collisions.length > 0) {
8498
+ const name = plugin.name || "anonymous plugin";
8499
+ console.warn(
8500
+ `[zapier-sdk] Skipping "${name}" \u2014 duplicate registration of: ${collisions.join(", ")}. If the duplicate is intentional, wrap with composePlugins(...). Otherwise rename the method or remove the duplicate.`
8501
+ );
8502
+ return buildSdk(properties, context);
8503
+ }
8469
8504
  const mergedProperties = { ...properties, ...pluginProperties };
8470
- let mergedContext = {
8505
+ const mergedContext = {
8471
8506
  ...context,
8472
- meta: context.meta || {}
8507
+ ...pluginContextRest,
8508
+ meta: { ...existingMeta, ...pluginMeta ?? {} }
8473
8509
  };
8474
- if (pluginContext) {
8475
- const { meta: pluginMeta, ...pluginContextRest } = pluginContext;
8476
- mergedContext = {
8477
- ...mergedContext,
8478
- ...pluginContextRest
8479
- };
8480
- if (pluginMeta) {
8481
- mergedContext = {
8482
- ...mergedContext,
8483
- meta: { ...mergedContext.meta, ...pluginMeta }
8484
- };
8485
- }
8486
- }
8487
8510
  return buildSdk(
8488
8511
  mergedProperties,
8489
8512
  mergedContext
@@ -11,7 +11,7 @@ export declare const apiPlugin: (sdk: {
11
11
  };
12
12
  }) => {
13
13
  context: {
14
- api: import("../../api").ApiClient;
14
+ api: import("../..").ApiClient;
15
15
  resolveCredentials: () => Promise<string | {
16
16
  clientId: string;
17
17
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const listAppsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../api").ApiClient;
3
+ api: import("../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const createTablePlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const createTableFieldsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const createTableRecordsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,7 +1,7 @@
1
1
  import type { CapabilitiesContext } from "../../capabilities";
2
2
  export declare const deleteTablePlugin: (sdk: {
3
3
  context: {
4
- api: import("../../../api").ApiClient;
4
+ api: import("../../..").ApiClient;
5
5
  resolveCredentials: () => Promise<string | {
6
6
  clientId: string;
7
7
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const deleteTableFieldsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const deleteTableRecordsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const getTablePlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const getTableRecordPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const listTableFieldsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const listTableRecordsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
@@ -1,7 +1,7 @@
1
1
  import type { CapabilitiesContext } from "../../capabilities";
2
2
  export declare const listTablesPlugin: (sdk: {
3
3
  context: {
4
- api: import("../../../api").ApiClient;
4
+ api: import("../../..").ApiClient;
5
5
  resolveCredentials: () => Promise<string | {
6
6
  clientId: string;
7
7
  clientSecret: string;
@@ -1,6 +1,6 @@
1
1
  export declare const updateTableRecordsPlugin: (sdk: {
2
2
  context: {
3
- api: import("../../../api").ApiClient;
3
+ api: import("../../..").ApiClient;
4
4
  resolveCredentials: () => Promise<string | {
5
5
  clientId: string;
6
6
  clientSecret: string;
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AA8ChE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB;;;;EAE5D;AAED,wBAAgB,SAAS;;cACW,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;cAA1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;kBAqBxB,MAAM;oBAAK,cAAc;cAcjD,SAAS,SAAS,cAAc;;kBAnCV,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;kBAA1B,MAAM,CAAC,MAAM,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAH/3K;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
package/dist/sdk.js CHANGED
@@ -71,24 +71,45 @@ function buildSdk(properties, context) {
71
71
  context: frozenContext,
72
72
  });
73
73
  const { context: pluginContext, ...pluginProperties } = pluginResult;
74
+ const { meta: pluginMeta, ...pluginContextRest } = pluginContext ?? {};
75
+ const existingProperties = properties;
76
+ const existingContext = context;
77
+ const existingMeta = context.meta ?? {};
78
+ // Detect collisions on the two shapes that matter: root-level
79
+ // methods and non-meta context fields. Meta entries don't need
80
+ // their own check — by convention a method comes with its meta,
81
+ // so a method-bearing meta collision is already caught by the
82
+ // root-key loop above. Pure meta-only overrides (e.g.
83
+ // cliOverridesPlugin tagging `meta.fetch.deprecated`) stay
84
+ // legitimate and last-win because their pluginProperties is
85
+ // empty, so no method collision fires.
86
+ const collisions = [];
87
+ for (const key of Object.keys(pluginProperties)) {
88
+ if (key in existingProperties)
89
+ collisions.push(`method "${key}"`);
90
+ }
91
+ for (const key of Object.keys(pluginContextRest)) {
92
+ if (key in existingContext)
93
+ collisions.push(`context.${key}`);
94
+ }
95
+ if (collisions.length > 0) {
96
+ const name = plugin.name || "anonymous plugin";
97
+ console.warn(`[zapier-sdk] Skipping "${name}" — duplicate registration of: ${collisions.join(", ")}. ` +
98
+ `If the duplicate is intentional, wrap with composePlugins(...). ` +
99
+ `Otherwise rename the method or remove the duplicate.`);
100
+ // Whole-plugin skip: return the chain unchanged. The type
101
+ // assertion lies about the skipped contributions; getRegistry-based
102
+ // consumers (CLI, MCP) see an unchanged surface, and direct
103
+ // typed callers will see TypeError on the missing method (the
104
+ // upstream warn names the cause).
105
+ return buildSdk(properties, context);
106
+ }
74
107
  const mergedProperties = { ...properties, ...pluginProperties };
75
- let mergedContext = {
108
+ const mergedContext = {
76
109
  ...context,
77
- meta: context.meta || {},
110
+ ...pluginContextRest,
111
+ meta: { ...existingMeta, ...(pluginMeta ?? {}) },
78
112
  };
79
- if (pluginContext) {
80
- const { meta: pluginMeta, ...pluginContextRest } = pluginContext;
81
- mergedContext = {
82
- ...mergedContext,
83
- ...pluginContextRest,
84
- };
85
- if (pluginMeta) {
86
- mergedContext = {
87
- ...mergedContext,
88
- meta: { ...mergedContext.meta, ...pluginMeta },
89
- };
90
- }
91
- }
92
113
  return buildSdk(mergedProperties, mergedContext);
93
114
  },
94
115
  };
@@ -54,6 +54,9 @@ export interface Plugin<TSdk = {}, TProvides extends PluginProvides = PluginProv
54
54
  /**
55
55
  * Takes an SDK shape and adds addPlugin and getRegistry methods to it.
56
56
  * addPlugin merges a plugin's result into the shape, producing a new SDK.
57
+ * Use composePlugins(...) to bundle multiple plugins into one before
58
+ * adding — addPlugin itself is single-plugin only, which keeps inference
59
+ * stable through long chains.
57
60
  * getRegistry is a lazy view over context.meta, available on every sdk
58
61
  * produced by buildSdk regardless of plugin order.
59
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,C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AAE,GAAG,cAAc,CAAC;CAC7D,CAAC"}
@@ -226,11 +226,13 @@ type ComposeProvides<T extends readonly Plugin<any, any>[]> = IntersectAll<Provi
226
226
  * once). Works fine for homogeneous-deps groups; widens slightly for
227
227
  * heterogeneous ones, which keeps the variadic types tractable.
228
228
  * 3. **Collision detection.** Throws on duplicate root keys, duplicate
229
- * `context.meta` keys, and duplicate non-meta `context.*` keys. Note
230
- * this only applies *inside* a single `composePlugins(...)` call
231
- * cross-`addPlugin` overrides (e.g. a CLI plugin overriding meta from
232
- * a core SDK plugin) still go through `addPlugin`'s last-write-wins
233
- * merge unchanged.
229
+ * `context.meta` keys, and duplicate non-meta `context.*` keys
230
+ * *inside* a single `composePlugins(...)` call. Cross-`addPlugin`
231
+ * collisions are handled separately by `addPlugin` itself, which
232
+ * warns-and-skips the colliding plugin (the first registration
233
+ * wins). Pure meta-only overrides (e.g. `cliOverridesPlugin`
234
+ * patching `meta.fetch.deprecated` without re-registering `fetch`)
235
+ * stay legitimate in both code paths.
234
236
  *
235
237
  * Why prefer this over an `addPlugin([...])` array overload: TypeScript's
236
238
  * overload resolution interacts badly with arrays carrying a mix of
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-utils.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAM1E;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,SAAS,cAAc,EACjE,EAAE,EAAE,CACF,GAAG,EAAE,IAAI,GAAG;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,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;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EACzE,GAAG,OAAO,EAAE,EAAE,GACb,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CA4B7C"}
@@ -198,11 +198,13 @@ function mergeContextKeysWithCollisionCheck(target, source, seen) {
198
198
  * once). Works fine for homogeneous-deps groups; widens slightly for
199
199
  * heterogeneous ones, which keeps the variadic types tractable.
200
200
  * 3. **Collision detection.** Throws on duplicate root keys, duplicate
201
- * `context.meta` keys, and duplicate non-meta `context.*` keys. Note
202
- * this only applies *inside* a single `composePlugins(...)` call
203
- * cross-`addPlugin` overrides (e.g. a CLI plugin overriding meta from
204
- * a core SDK plugin) still go through `addPlugin`'s last-write-wins
205
- * merge unchanged.
201
+ * `context.meta` keys, and duplicate non-meta `context.*` keys
202
+ * *inside* a single `composePlugins(...)` call. Cross-`addPlugin`
203
+ * collisions are handled separately by `addPlugin` itself, which
204
+ * warns-and-skips the colliding plugin (the first registration
205
+ * wins). Pure meta-only overrides (e.g. `cliOverridesPlugin`
206
+ * patching `meta.fetch.deprecated` without re-registering `fetch`)
207
+ * stay legitimate in both code paths.
206
208
  *
207
209
  * Why prefer this over an `addPlugin([...])` array overload: TypeScript's
208
210
  * overload resolution interacts badly with arrays carrying a mix of
@@ -4,6 +4,12 @@
4
4
  * This combines domain checking and URL extraction logic.
5
5
  */
6
6
  export declare function getZapierBaseUrl(baseUrl?: string): string | undefined;
7
+ /**
8
+ * Returns true if the baseUrl points at a developer's local machine
9
+ * (`localhost` or `127.0.0.1`). Used to relax checks that don't make sense
10
+ * when the SDK API and other services run on different localhost ports.
11
+ */
12
+ export declare function isLocalhostBaseUrl(baseUrl?: string): boolean;
7
13
  /**
8
14
  * Gets tracking base URL with the following precedence:
9
15
  * 1. Explicit trackingBaseUrl parameter
@@ -1 +1 @@
1
- {"version":3,"file":"url-utils.d.ts","sourceRoot":"","sources":["../../src/utils/url-utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA+BrE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,GACR,EAAE;IACD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CA0BT"}
1
+ {"version":3,"file":"url-utils.d.ts","sourceRoot":"","sources":["../../src/utils/url-utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA+BrE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAU5D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,GACR,EAAE;IACD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CA0BT"}
@@ -29,6 +29,23 @@ export function getZapierBaseUrl(baseUrl) {
29
29
  return undefined;
30
30
  }
31
31
  }
32
+ /**
33
+ * Returns true if the baseUrl points at a developer's local machine
34
+ * (`localhost` or `127.0.0.1`). Used to relax checks that don't make sense
35
+ * when the SDK API and other services run on different localhost ports.
36
+ */
37
+ export function isLocalhostBaseUrl(baseUrl) {
38
+ if (!baseUrl) {
39
+ return false;
40
+ }
41
+ try {
42
+ const { hostname } = new URL(baseUrl);
43
+ return hostname === "localhost" || hostname === "127.0.0.1";
44
+ }
45
+ catch {
46
+ return false;
47
+ }
48
+ }
32
49
  /**
33
50
  * Gets tracking base URL with the following precedence:
34
51
  * 1. Explicit trackingBaseUrl parameter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",