@zapier/zapier-sdk 0.54.0 → 0.55.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 (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +10 -9
  3. package/dist/experimental.cjs +77 -48
  4. package/dist/experimental.d.mts +3 -2
  5. package/dist/experimental.d.ts +1 -0
  6. package/dist/experimental.d.ts.map +1 -1
  7. package/dist/experimental.mjs +77 -48
  8. package/dist/{index-SDDmBk2j.d.mts → index-DjQ4XDAV.d.mts} +7 -0
  9. package/dist/{index-SDDmBk2j.d.ts → index-DjQ4XDAV.d.ts} +7 -0
  10. package/dist/index.cjs +22 -13
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +22 -13
  13. package/dist/plugins/triggers/createTriggerInbox/index.d.ts +1 -0
  14. package/dist/plugins/triggers/createTriggerInbox/index.d.ts.map +1 -1
  15. package/dist/plugins/triggers/createTriggerInbox/index.js +18 -3
  16. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts +1 -0
  17. package/dist/plugins/triggers/createTriggerInbox/schemas.d.ts.map +1 -1
  18. package/dist/plugins/triggers/createTriggerInbox/schemas.js +3 -2
  19. package/dist/plugins/triggers/ensureTriggerInbox/index.d.ts.map +1 -1
  20. package/dist/plugins/triggers/ensureTriggerInbox/index.js +1 -12
  21. package/dist/plugins/triggers/utils.d.ts +6 -0
  22. package/dist/plugins/triggers/utils.d.ts.map +1 -1
  23. package/dist/plugins/triggers/utils.js +17 -0
  24. package/dist/resolvers/actionKey.d.ts.map +1 -1
  25. package/dist/resolvers/actionKey.js +2 -1
  26. package/dist/resolvers/appKey.d.ts.map +1 -1
  27. package/dist/resolvers/appKey.js +2 -3
  28. package/dist/resolvers/clientId.js +1 -1
  29. package/dist/resolvers/connectionId.js +1 -1
  30. package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
  31. package/dist/resolvers/inputFieldKey.js +5 -1
  32. package/dist/resolvers/tableFieldIds.d.ts.map +1 -1
  33. package/dist/resolvers/tableFieldIds.js +2 -1
  34. package/dist/resolvers/tableId.js +1 -1
  35. package/dist/resolvers/tableRecordId.d.ts.map +1 -1
  36. package/dist/resolvers/tableRecordId.js +4 -3
  37. package/dist/resolvers/triggerInbox.d.ts.map +1 -1
  38. package/dist/resolvers/triggerInbox.js +2 -1
  39. package/dist/resolvers/triggerMessages.d.ts.map +1 -1
  40. package/dist/resolvers/triggerMessages.js +2 -1
  41. package/dist/utils/schema-utils.d.ts +7 -0
  42. package/dist/utils/schema-utils.d.ts.map +1 -1
  43. package/package.json +1 -1
@@ -5236,6 +5236,13 @@ interface PromptConfig {
5236
5236
  choices?: Array<{
5237
5237
  name: string;
5238
5238
  value: unknown;
5239
+ /**
5240
+ * Optional secondary info shown after `name`. The CLI wraps it in
5241
+ * dimmed parens; an array is joined with ", ". Use for keys, ids, or
5242
+ * other context that's useful but shouldn't compete visually with
5243
+ * the primary label.
5244
+ */
5245
+ hint?: string | string[];
5239
5246
  }>;
5240
5247
  default?: unknown;
5241
5248
  filter?: (value: unknown) => unknown;
@@ -5236,6 +5236,13 @@ interface PromptConfig {
5236
5236
  choices?: Array<{
5237
5237
  name: string;
5238
5238
  value: unknown;
5239
+ /**
5240
+ * Optional secondary info shown after `name`. The CLI wraps it in
5241
+ * dimmed parens; an array is joined with ", ". Use for keys, ids, or
5242
+ * other context that's useful but shouldn't compete visually with
5243
+ * the primary label.
5244
+ */
5245
+ hint?: string | string[];
5239
5246
  }>;
5240
5247
  default?: unknown;
5241
5248
  filter?: (value: unknown) => unknown;
package/dist/index.cjs CHANGED
@@ -2298,7 +2298,8 @@ var appKeyResolver = {
2298
2298
  name: "app",
2299
2299
  message: "Select app:",
2300
2300
  choices: apps.map((app) => ({
2301
- name: app.title ? `${app.title} (${getAppKeyList(app).join(", ")})` : app.key,
2301
+ name: app.title || app.key,
2302
+ hint: app.title ? getAppKeyList(app) : void 0,
2302
2303
  value: app.key
2303
2304
  }))
2304
2305
  })
@@ -2346,7 +2347,8 @@ var actionKeyResolver = {
2346
2347
  name: "action",
2347
2348
  message: "Select action:",
2348
2349
  choices: actions.map((action) => ({
2349
- name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
2350
+ name: action.title || action.name || action.key,
2351
+ hint: action.description || void 0,
2350
2352
  value: action.key
2351
2353
  }))
2352
2354
  })
@@ -2371,7 +2373,7 @@ function promptForConnection(connections, params) {
2371
2373
  name: "connection",
2372
2374
  message: params.app ? `Select connection for ${params.app}:` : "Select connection:",
2373
2375
  choices: connections.map((connection) => ({
2374
- name: `${connection.title || connection.label || "Connection"} (ID: ${connection.id})`,
2376
+ name: connection.title || connection.label || "Connection",
2375
2377
  value: connection.id
2376
2378
  }))
2377
2379
  };
@@ -2486,7 +2488,11 @@ var inputFieldKeyResolver = {
2486
2488
  name: "inputField",
2487
2489
  message: "Select input field:",
2488
2490
  choices: fields.map((field) => ({
2489
- name: `${field.title || field.key} - ${field.value_type || "No type"} ${field.is_required ? "(required)" : "(optional)"}`,
2491
+ name: field.title || field.key,
2492
+ hint: [
2493
+ field.value_type,
2494
+ field.is_required ? "required" : "optional"
2495
+ ].filter(Boolean),
2490
2496
  value: field.key
2491
2497
  }))
2492
2498
  })
@@ -2511,7 +2517,7 @@ var clientIdResolver = {
2511
2517
  name: "clientId",
2512
2518
  message: "Select client credentials to delete:",
2513
2519
  choices: credentials.map((cred) => ({
2514
- name: `${cred.name} (${cred.client_id})`,
2520
+ name: cred.name,
2515
2521
  value: cred.client_id
2516
2522
  }))
2517
2523
  })
@@ -2544,7 +2550,7 @@ var tableIdResolver = {
2544
2550
  name: "table",
2545
2551
  message: "Select a table:",
2546
2552
  choices: tables.map((table) => ({
2547
- name: `${table.name} (${table.id})`,
2553
+ name: table.name,
2548
2554
  value: table.id
2549
2555
  }))
2550
2556
  })
@@ -2561,7 +2567,8 @@ var triggerInboxResolver = {
2561
2567
  // `deleting` inboxes are on their way out — no operation against them
2562
2568
  // is useful (delete is a no-op, pause/resume/update are rejected).
2563
2569
  choices: inboxes.filter((inbox) => inbox.status !== "deleting").map((inbox) => ({
2564
- name: `${inbox.name ?? inbox.id} (${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status})`,
2570
+ name: inbox.name ?? inbox.id,
2571
+ hint: `${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status}`,
2565
2572
  value: inbox.id
2566
2573
  }))
2567
2574
  })
@@ -2584,7 +2591,8 @@ var triggerMessagesResolver = {
2584
2591
  // are gone from the inbox already; available/quarantined ones can't be
2585
2592
  // operated on by these methods.
2586
2593
  choices: messages.filter((message) => message.status === "leased").map((message) => ({
2587
- name: `${message.id} (${message.status}, lease_count: ${message.message_attributes.lease_count})`,
2594
+ name: message.id,
2595
+ hint: `${message.status}, lease_count: ${message.message_attributes.lease_count}`,
2588
2596
  value: message.id
2589
2597
  }))
2590
2598
  })
@@ -2830,8 +2838,8 @@ async function createFieldKeyTranslator({
2830
2838
  function summarizeRecord(record) {
2831
2839
  const values = Object.values(record.data);
2832
2840
  const preview = values.slice(0, 3).map((v) => formatFieldValue(v).replace(/\s+/g, " ").trim()).filter((s) => s.length > 0).join(", ");
2833
- const truncated = preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
2834
- return truncated ? `${record.id} \u2014 ${truncated}` : record.id;
2841
+ if (!preview) return void 0;
2842
+ return preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
2835
2843
  }
2836
2844
  function fetchRecords(sdk, params) {
2837
2845
  return sdk.listTableRecords({
@@ -2841,7 +2849,7 @@ function fetchRecords(sdk, params) {
2841
2849
  }
2842
2850
  function recordChoices(records) {
2843
2851
  return records.map((record) => ({
2844
- name: summarizeRecord(record),
2852
+ name: summarizeRecord(record) || record.id,
2845
2853
  value: record.id
2846
2854
  }));
2847
2855
  }
@@ -2881,7 +2889,8 @@ var tableFieldIdsResolver = {
2881
2889
  name: "fields",
2882
2890
  message: "Select fields:",
2883
2891
  choices: fields.map((field) => ({
2884
- name: `${field.name} (${field.id}, ${field.type})`,
2892
+ name: field.name,
2893
+ hint: [field.id, field.type],
2885
2894
  value: field.id
2886
2895
  })),
2887
2896
  validate: (value) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
@@ -6309,7 +6318,7 @@ async function invalidateCredentialsToken(options) {
6309
6318
  }
6310
6319
 
6311
6320
  // src/sdk-version.ts
6312
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.54.0" : void 0) || "unknown";
6321
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.55.0" : void 0) || "unknown";
6313
6322
 
6314
6323
  // src/utils/open-url.ts
6315
6324
  var nodePrefix = "node:";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { u as Action, d as ActionEntry, ci as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aW as ActionItem, bx as ActionKeyProperty, b5 as ActionKeyPropertySchema, by as ActionProperty, b6 as ActionPropertySchema, as as ActionResolverItem, bJ as ActionTimeoutMsProperty, bh as ActionTimeoutMsPropertySchema, at as ActionTypeItem, bw as ActionTypeProperty, b4 as ActionTypePropertySchema, b as AddActionEntryOptions, c as AddActionEntryResult, A as ApiClient, bW as ApiError, dE as ApiEvent, d0 as ApiPluginOptions, d2 as ApiPluginProvides, v as App, cj as AppFactoryInput, aU as AppItem, bu as AppKeyProperty, b2 as AppKeyPropertySchema, bv as AppProperty, b3 as AppPropertySchema, aD as ApplicationLifecycleEventData, cb as ApprovalStatus, ch as AppsPluginProvides, bO as AppsProperty, bm as AppsPropertySchema, a0 as ArrayResolver, dD as AuthEvent, bC as AuthenticationIdProperty, b9 as AuthenticationIdPropertySchema, az as BaseEvent, al as BaseSdkOptionsSchema, aa as BatchOptions, cP as CONTEXT_CACHE_MAX_SIZE, cO as CONTEXT_CACHE_TTL_MS, x as Choice, dK as ClientCredentialsObject, dV as ClientCredentialsObjectSchema, K as Connection, e1 as ConnectionEntry, e0 as ConnectionEntrySchema, bA as ConnectionIdProperty, b8 as ConnectionIdPropertySchema, aV as ConnectionItem, bB as ConnectionProperty, ba as ConnectionPropertySchema, e3 as ConnectionsMap, e2 as ConnectionsMapSchema, e5 as ConnectionsPluginProvides, bQ as ConnectionsProperty, bo as ConnectionsPropertySchema, O as ConnectionsResponse, cB as CreateClientCredentialsPluginProvides, eu as CreateTableFieldsPluginProvides, eo as CreateTablePluginProvides, eC as CreateTableRecordsPluginProvides, dH as Credentials, d_ as CredentialsFunction, dZ as CredentialsFunctionSchema, dJ as CredentialsObject, dX as CredentialsObjectSchema, d$ as CredentialsSchema, ea as DEFAULT_ACTION_TIMEOUT_MS, eh as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, ei as DEFAULT_MAX_APPROVAL_RETRIES, e9 as DEFAULT_PAGE_SIZE, bH as DebugProperty, bf as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, ew as DeleteTableFieldsPluginProvides, eq as DeleteTablePluginProvides, eE as DeleteTableRecordsPluginProvides, o as DrainTriggerInboxCallback, p as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, a3 as DynamicListResolver, i as DynamicResolver, a4 as DynamicSearchResolver, aE as EnhancedErrorEventData, bX as ErrorOptions, dG as EventCallback, aC as EventContext, E as EventEmissionContext, aB as EventEmissionProvides, cl as FetchPluginProvides, w as Field, bN as FieldsProperty, bl as FieldsPropertySchema, a5 as FieldsResolver, F as FieldsetItem, s as FindFirstAuthenticationPluginProvides, cL as FindFirstConnectionPluginProvides, t as FindUniqueAuthenticationPluginProvides, cN as FindUniqueConnectionPluginProvides, Y as FormatMetadata, X as FormattedItem, ak as FunctionDeprecation, a$ as FunctionOptions, aj as FunctionRegistryEntry, cv as GetActionInputFieldsSchemaPluginProvides, cH as GetActionPluginProvides, cF as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cJ as GetConnectionPluginProvides, c$ as GetProfilePluginProvides, em as GetTablePluginProvides, ey as GetTableRecordPluginProvides, aY as InfoFieldItem, aX as InputFieldItem, bz as InputFieldProperty, b7 as InputFieldPropertySchema, bD as InputsProperty, bb as InputsPropertySchema, bV as LeaseLimitProperty, bt as LeaseLimitPropertySchema, bT as LeaseProperty, br as LeasePropertySchema, bU as LeaseSecondsProperty, bs as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bE as LimitProperty, bc as LimitPropertySchema, ct as ListActionInputFieldChoicesPluginProvides, cr as ListActionInputFieldsPluginProvides, cp as ListActionsPluginProvides, cn as ListAppsPluginProvides, q as ListAuthenticationsPluginProvides, cz as ListClientCredentialsPluginProvides, cx as ListConnectionsPluginProvides, es as ListTableFieldsPluginProvides, eA as ListTableRecordsPluginProvides, ek as ListTablesPluginProvides, dF as LoadingEvent, ed as MAX_CONCURRENCY_LIMIT, e8 as MAX_PAGE_LIMIT, M as Manifest, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, aA as MethodCalledEvent, aF as MethodCalledEventData, N as Need, I as NeedsRequest, J as NeedsResponse, bF as OffsetProperty, bd as OffsetPropertySchema, _ as OutputFormatter, bG as OutputProperty, be as OutputPropertySchema, b1 as PaginatedSdkFunction, e as PaginatedSdkResult, bI as ParamsProperty, bg as ParamsPropertySchema, dL as PkceCredentialsObject, dW as PkceCredentialsObjectSchema, am as Plugin, P as PluginMeta, an as PluginProvides, aw as PollOptions, g as PositionalMetadata, c9 as RateLimitInfo, bL as RecordProperty, bj as RecordPropertySchema, bM as RecordsProperty, bk as RecordsPropertySchema, af as RelayFetchSchema, ae as RelayRequestSchema, av as RequestOptions, cT as RequestPluginProvides, dq as ResolveAuthTokenOptions, dQ as ResolveCredentialsOptions, R as ResolvedAppLocator, dI as ResolvedCredentials, dY as ResolvedCredentialsSchema, $ as Resolver, a1 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dC as SdkEvent, b0 as SdkPage, a2 as StaticResolver, bK as TableProperty, bi as TablePropertySchema, bP as TablesProperty, bn as TablesPropertySchema, bS as TriggerInboxNameProperty, bq as TriggerInboxNamePropertySchema, bR as TriggerInboxProperty, bp as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, a as UpdateManifestEntryResult, eG as UpdateTableRecordsPluginProvides, Q as UserProfile, a_ as UserProfileItem, j as WatchTriggerInboxOptions, W as WithAddPlugin, e6 as ZAPIER_BASE_URL, ef as ZAPIER_MAX_CONCURRENT_REQUESTS, eb as ZAPIER_MAX_NETWORK_RETRIES, ec as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, m as ZapierAbortDrainSignal, c7 as ZapierActionError, bZ as ZapierApiError, b_ as ZapierAppNotFoundError, cc as ZapierApprovalError, c1 as ZapierAuthenticationError, c5 as ZapierBundleError, dy as ZapierCache, dz as ZapierCacheEntry, dA as ZapierCacheSetOptions, c4 as ZapierConfigurationError, c8 as ZapierConflictError, bY as ZapierError, h as ZapierFetchInitOptions, c2 as ZapierNotFoundError, ca as ZapierRateLimitError, cd as ZapierRelayError, n as ZapierReleaseTriggerMessageSignal, c3 as ZapierResourceNotFoundError, eI as ZapierSdk, l as ZapierSdkApps, Z as ZapierSdkOptions, cf as ZapierSignal, c6 as ZapierTimeoutError, c0 as ZapierUnknownError, b$ as ZapierValidationError, d5 as actionKeyResolver, d4 as actionTypeResolver, d1 as apiPlugin, d3 as appKeyResolver, cg as appsPlugin, d7 as authenticationIdGenericResolver, d6 as authenticationIdResolver, a9 as batch, aP as buildApplicationLifecycleEvent, ab as buildCapabilityMessage, aR as buildErrorEvent, aQ as buildErrorEventWithContext, aT as buildMethodCalledEvent, dr as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, ar as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, e4 as connectionsPlugin, aS as createBaseEvent, cA as createClientCredentialsPlugin, V as createFunction, dB as createMemoryCache, ai as createOptionsPlugin, aq as createPaginatedPluginMethod, ap as createPluginMethod, ah as createSdk, et as createTableFieldsPlugin, en as createTablePlugin, eB as createTableRecordsPlugin, ax as createZapierApi, eH as createZapierSdk, ag as createZapierSdkWithoutRegistry, ao as definePlugin, cC as deleteClientCredentialsPlugin, ev as deleteTableFieldsPlugin, ep as deleteTablePlugin, eD as deleteTableRecordsPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, f as findManifestEntry, cM as findUniqueConnectionPlugin, ce as formatErrorMessage, aG as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, cE as getAppPlugin, dT as getBaseUrlFromCredentials, aM as getCiPlatform, dU as getClientIdFromCredentials, cI as getConnectionPlugin, aO as getCpuTime, aH as getCurrentTimestamp, aN as getMemoryUsage, ay as getOrCreateApiClient, aJ as getOsInfo, aK as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, aI as getReleaseId, el as getTablePlugin, ex as getTableRecordPlugin, dv as getTokenFromCliLogin, eg as getZapierApprovalMode, e7 as getZapierSdkService, dt as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, ds as invalidateCachedToken, dx as invalidateCredentialsToken, aL as isCi, du as isCliLoginAvailable, dM as isClientCredentials, dP as isCredentialsFunction, dO as isCredentialsObject, dN as isPkceCredentials, S as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, er as listTableFieldsPlugin, ez as listTableRecordsPlugin, ej as listTablesPlugin, ac as logDeprecation, cW as manifestPlugin, ee as parseConcurrencyEnvVar, r as readManifestFromFile, au as registryPlugin, cS as requestPlugin, ad as resetDeprecationWarnings, dw as resolveAuthToken, dS as resolveCredentials, dR as resolveCredentialsFromEnv, cQ as runActionPlugin, a6 as runWithTelemetryContext, di as tableFieldIdsResolver, dk as tableFieldsResolver, dn as tableFiltersResolver, dd as tableIdResolver, dj as tableNameResolver, dg as tableRecordIdResolver, dh as tableRecordIdsResolver, dl as tableRecordsResolver, dp as tableSortResolver, dm as tableUpdateRecordsResolver, a7 as toSnakeCase, a8 as toTitleCase, de as triggerInboxResolver, df as triggerMessagesResolver, eF as updateTableRecordsPlugin } from './index-SDDmBk2j.mjs';
1
+ export { u as Action, d as ActionEntry, ci as ActionExecutionOptions, y as ActionExecutionResult, z as ActionField, H as ActionFieldChoice, aW as ActionItem, bx as ActionKeyProperty, b5 as ActionKeyPropertySchema, by as ActionProperty, b6 as ActionPropertySchema, as as ActionResolverItem, bJ as ActionTimeoutMsProperty, bh as ActionTimeoutMsPropertySchema, at as ActionTypeItem, bw as ActionTypeProperty, b4 as ActionTypePropertySchema, b as AddActionEntryOptions, c as AddActionEntryResult, A as ApiClient, bW as ApiError, dE as ApiEvent, d0 as ApiPluginOptions, d2 as ApiPluginProvides, v as App, cj as AppFactoryInput, aU as AppItem, bu as AppKeyProperty, b2 as AppKeyPropertySchema, bv as AppProperty, b3 as AppPropertySchema, aD as ApplicationLifecycleEventData, cb as ApprovalStatus, ch as AppsPluginProvides, bO as AppsProperty, bm as AppsPropertySchema, a0 as ArrayResolver, dD as AuthEvent, bC as AuthenticationIdProperty, b9 as AuthenticationIdPropertySchema, az as BaseEvent, al as BaseSdkOptionsSchema, aa as BatchOptions, cP as CONTEXT_CACHE_MAX_SIZE, cO as CONTEXT_CACHE_TTL_MS, x as Choice, dK as ClientCredentialsObject, dV as ClientCredentialsObjectSchema, K as Connection, e1 as ConnectionEntry, e0 as ConnectionEntrySchema, bA as ConnectionIdProperty, b8 as ConnectionIdPropertySchema, aV as ConnectionItem, bB as ConnectionProperty, ba as ConnectionPropertySchema, e3 as ConnectionsMap, e2 as ConnectionsMapSchema, e5 as ConnectionsPluginProvides, bQ as ConnectionsProperty, bo as ConnectionsPropertySchema, O as ConnectionsResponse, cB as CreateClientCredentialsPluginProvides, eu as CreateTableFieldsPluginProvides, eo as CreateTablePluginProvides, eC as CreateTableRecordsPluginProvides, dH as Credentials, d_ as CredentialsFunction, dZ as CredentialsFunctionSchema, dJ as CredentialsObject, dX as CredentialsObjectSchema, d$ as CredentialsSchema, ea as DEFAULT_ACTION_TIMEOUT_MS, eh as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, ei as DEFAULT_MAX_APPROVAL_RETRIES, e9 as DEFAULT_PAGE_SIZE, bH as DebugProperty, bf as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, ew as DeleteTableFieldsPluginProvides, eq as DeleteTablePluginProvides, eE as DeleteTableRecordsPluginProvides, o as DrainTriggerInboxCallback, p as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, a3 as DynamicListResolver, i as DynamicResolver, a4 as DynamicSearchResolver, aE as EnhancedErrorEventData, bX as ErrorOptions, dG as EventCallback, aC as EventContext, E as EventEmissionContext, aB as EventEmissionProvides, cl as FetchPluginProvides, w as Field, bN as FieldsProperty, bl as FieldsPropertySchema, a5 as FieldsResolver, F as FieldsetItem, s as FindFirstAuthenticationPluginProvides, cL as FindFirstConnectionPluginProvides, t as FindUniqueAuthenticationPluginProvides, cN as FindUniqueConnectionPluginProvides, Y as FormatMetadata, X as FormattedItem, ak as FunctionDeprecation, a$ as FunctionOptions, aj as FunctionRegistryEntry, cv as GetActionInputFieldsSchemaPluginProvides, cH as GetActionPluginProvides, cF as GetAppPluginProvides, G as GetAuthenticationPluginProvides, cJ as GetConnectionPluginProvides, c$ as GetProfilePluginProvides, em as GetTablePluginProvides, ey as GetTableRecordPluginProvides, aY as InfoFieldItem, aX as InputFieldItem, bz as InputFieldProperty, b7 as InputFieldPropertySchema, bD as InputsProperty, bb as InputsPropertySchema, bV as LeaseLimitProperty, bt as LeaseLimitPropertySchema, bT as LeaseProperty, br as LeasePropertySchema, bU as LeaseSecondsProperty, bs as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bE as LimitProperty, bc as LimitPropertySchema, ct as ListActionInputFieldChoicesPluginProvides, cr as ListActionInputFieldsPluginProvides, cp as ListActionsPluginProvides, cn as ListAppsPluginProvides, q as ListAuthenticationsPluginProvides, cz as ListClientCredentialsPluginProvides, cx as ListConnectionsPluginProvides, es as ListTableFieldsPluginProvides, eA as ListTableRecordsPluginProvides, ek as ListTablesPluginProvides, dF as LoadingEvent, ed as MAX_CONCURRENCY_LIMIT, e8 as MAX_PAGE_LIMIT, M as Manifest, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, aA as MethodCalledEvent, aF as MethodCalledEventData, N as Need, I as NeedsRequest, J as NeedsResponse, bF as OffsetProperty, bd as OffsetPropertySchema, _ as OutputFormatter, bG as OutputProperty, be as OutputPropertySchema, b1 as PaginatedSdkFunction, e as PaginatedSdkResult, bI as ParamsProperty, bg as ParamsPropertySchema, dL as PkceCredentialsObject, dW as PkceCredentialsObjectSchema, am as Plugin, P as PluginMeta, an as PluginProvides, aw as PollOptions, g as PositionalMetadata, c9 as RateLimitInfo, bL as RecordProperty, bj as RecordPropertySchema, bM as RecordsProperty, bk as RecordsPropertySchema, af as RelayFetchSchema, ae as RelayRequestSchema, av as RequestOptions, cT as RequestPluginProvides, dq as ResolveAuthTokenOptions, dQ as ResolveCredentialsOptions, R as ResolvedAppLocator, dI as ResolvedCredentials, dY as ResolvedCredentialsSchema, $ as Resolver, a1 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dC as SdkEvent, b0 as SdkPage, a2 as StaticResolver, bK as TableProperty, bi as TablePropertySchema, bP as TablesProperty, bn as TablesPropertySchema, bS as TriggerInboxNameProperty, bq as TriggerInboxNamePropertySchema, bR as TriggerInboxProperty, bp as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, a as UpdateManifestEntryResult, eG as UpdateTableRecordsPluginProvides, Q as UserProfile, a_ as UserProfileItem, j as WatchTriggerInboxOptions, W as WithAddPlugin, e6 as ZAPIER_BASE_URL, ef as ZAPIER_MAX_CONCURRENT_REQUESTS, eb as ZAPIER_MAX_NETWORK_RETRIES, ec as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, m as ZapierAbortDrainSignal, c7 as ZapierActionError, bZ as ZapierApiError, b_ as ZapierAppNotFoundError, cc as ZapierApprovalError, c1 as ZapierAuthenticationError, c5 as ZapierBundleError, dy as ZapierCache, dz as ZapierCacheEntry, dA as ZapierCacheSetOptions, c4 as ZapierConfigurationError, c8 as ZapierConflictError, bY as ZapierError, h as ZapierFetchInitOptions, c2 as ZapierNotFoundError, ca as ZapierRateLimitError, cd as ZapierRelayError, n as ZapierReleaseTriggerMessageSignal, c3 as ZapierResourceNotFoundError, eI as ZapierSdk, l as ZapierSdkApps, Z as ZapierSdkOptions, cf as ZapierSignal, c6 as ZapierTimeoutError, c0 as ZapierUnknownError, b$ as ZapierValidationError, d5 as actionKeyResolver, d4 as actionTypeResolver, d1 as apiPlugin, d3 as appKeyResolver, cg as appsPlugin, d7 as authenticationIdGenericResolver, d6 as authenticationIdResolver, a9 as batch, aP as buildApplicationLifecycleEvent, ab as buildCapabilityMessage, aR as buildErrorEvent, aQ as buildErrorEventWithContext, aT as buildMethodCalledEvent, dr as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, ar as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, e4 as connectionsPlugin, aS as createBaseEvent, cA as createClientCredentialsPlugin, V as createFunction, dB as createMemoryCache, ai as createOptionsPlugin, aq as createPaginatedPluginMethod, ap as createPluginMethod, ah as createSdk, et as createTableFieldsPlugin, en as createTablePlugin, eB as createTableRecordsPlugin, ax as createZapierApi, eH as createZapierSdk, ag as createZapierSdkWithoutRegistry, ao as definePlugin, cC as deleteClientCredentialsPlugin, ev as deleteTableFieldsPlugin, ep as deleteTablePlugin, eD as deleteTableRecordsPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, f as findManifestEntry, cM as findUniqueConnectionPlugin, ce as formatErrorMessage, aG as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, cE as getAppPlugin, dT as getBaseUrlFromCredentials, aM as getCiPlatform, dU as getClientIdFromCredentials, cI as getConnectionPlugin, aO as getCpuTime, aH as getCurrentTimestamp, aN as getMemoryUsage, ay as getOrCreateApiClient, aJ as getOsInfo, aK as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, aI as getReleaseId, el as getTablePlugin, ex as getTableRecordPlugin, dv as getTokenFromCliLogin, eg as getZapierApprovalMode, e7 as getZapierSdkService, dt as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, ds as invalidateCachedToken, dx as invalidateCredentialsToken, aL as isCi, du as isCliLoginAvailable, dM as isClientCredentials, dP as isCredentialsFunction, dO as isCredentialsObject, dN as isPkceCredentials, S as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, er as listTableFieldsPlugin, ez as listTableRecordsPlugin, ej as listTablesPlugin, ac as logDeprecation, cW as manifestPlugin, ee as parseConcurrencyEnvVar, r as readManifestFromFile, au as registryPlugin, cS as requestPlugin, ad as resetDeprecationWarnings, dw as resolveAuthToken, dS as resolveCredentials, dR as resolveCredentialsFromEnv, cQ as runActionPlugin, a6 as runWithTelemetryContext, di as tableFieldIdsResolver, dk as tableFieldsResolver, dn as tableFiltersResolver, dd as tableIdResolver, dj as tableNameResolver, dg as tableRecordIdResolver, dh as tableRecordIdsResolver, dl as tableRecordsResolver, dp as tableSortResolver, dm as tableUpdateRecordsResolver, a7 as toSnakeCase, a8 as toTitleCase, de as triggerInboxResolver, df as triggerMessagesResolver, eF as updateTableRecordsPlugin } from './index-DjQ4XDAV.mjs';
2
2
  import 'zod';
3
3
  import '@zapier/zapier-sdk-core/v0/schemas/connections';
4
4
  import '@zapier/policy-context';
package/dist/index.mjs CHANGED
@@ -2296,7 +2296,8 @@ var appKeyResolver = {
2296
2296
  name: "app",
2297
2297
  message: "Select app:",
2298
2298
  choices: apps.map((app) => ({
2299
- name: app.title ? `${app.title} (${getAppKeyList(app).join(", ")})` : app.key,
2299
+ name: app.title || app.key,
2300
+ hint: app.title ? getAppKeyList(app) : void 0,
2300
2301
  value: app.key
2301
2302
  }))
2302
2303
  })
@@ -2344,7 +2345,8 @@ var actionKeyResolver = {
2344
2345
  name: "action",
2345
2346
  message: "Select action:",
2346
2347
  choices: actions.map((action) => ({
2347
- name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
2348
+ name: action.title || action.name || action.key,
2349
+ hint: action.description || void 0,
2348
2350
  value: action.key
2349
2351
  }))
2350
2352
  })
@@ -2369,7 +2371,7 @@ function promptForConnection(connections, params) {
2369
2371
  name: "connection",
2370
2372
  message: params.app ? `Select connection for ${params.app}:` : "Select connection:",
2371
2373
  choices: connections.map((connection) => ({
2372
- name: `${connection.title || connection.label || "Connection"} (ID: ${connection.id})`,
2374
+ name: connection.title || connection.label || "Connection",
2373
2375
  value: connection.id
2374
2376
  }))
2375
2377
  };
@@ -2484,7 +2486,11 @@ var inputFieldKeyResolver = {
2484
2486
  name: "inputField",
2485
2487
  message: "Select input field:",
2486
2488
  choices: fields.map((field) => ({
2487
- name: `${field.title || field.key} - ${field.value_type || "No type"} ${field.is_required ? "(required)" : "(optional)"}`,
2489
+ name: field.title || field.key,
2490
+ hint: [
2491
+ field.value_type,
2492
+ field.is_required ? "required" : "optional"
2493
+ ].filter(Boolean),
2488
2494
  value: field.key
2489
2495
  }))
2490
2496
  })
@@ -2509,7 +2515,7 @@ var clientIdResolver = {
2509
2515
  name: "clientId",
2510
2516
  message: "Select client credentials to delete:",
2511
2517
  choices: credentials.map((cred) => ({
2512
- name: `${cred.name} (${cred.client_id})`,
2518
+ name: cred.name,
2513
2519
  value: cred.client_id
2514
2520
  }))
2515
2521
  })
@@ -2542,7 +2548,7 @@ var tableIdResolver = {
2542
2548
  name: "table",
2543
2549
  message: "Select a table:",
2544
2550
  choices: tables.map((table) => ({
2545
- name: `${table.name} (${table.id})`,
2551
+ name: table.name,
2546
2552
  value: table.id
2547
2553
  }))
2548
2554
  })
@@ -2559,7 +2565,8 @@ var triggerInboxResolver = {
2559
2565
  // `deleting` inboxes are on their way out — no operation against them
2560
2566
  // is useful (delete is a no-op, pause/resume/update are rejected).
2561
2567
  choices: inboxes.filter((inbox) => inbox.status !== "deleting").map((inbox) => ({
2562
- name: `${inbox.name ?? inbox.id} (${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status})`,
2568
+ name: inbox.name ?? inbox.id,
2569
+ hint: `${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status}`,
2563
2570
  value: inbox.id
2564
2571
  }))
2565
2572
  })
@@ -2582,7 +2589,8 @@ var triggerMessagesResolver = {
2582
2589
  // are gone from the inbox already; available/quarantined ones can't be
2583
2590
  // operated on by these methods.
2584
2591
  choices: messages.filter((message) => message.status === "leased").map((message) => ({
2585
- name: `${message.id} (${message.status}, lease_count: ${message.message_attributes.lease_count})`,
2592
+ name: message.id,
2593
+ hint: `${message.status}, lease_count: ${message.message_attributes.lease_count}`,
2586
2594
  value: message.id
2587
2595
  }))
2588
2596
  })
@@ -2828,8 +2836,8 @@ async function createFieldKeyTranslator({
2828
2836
  function summarizeRecord(record) {
2829
2837
  const values = Object.values(record.data);
2830
2838
  const preview = values.slice(0, 3).map((v) => formatFieldValue(v).replace(/\s+/g, " ").trim()).filter((s) => s.length > 0).join(", ");
2831
- const truncated = preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
2832
- return truncated ? `${record.id} \u2014 ${truncated}` : record.id;
2839
+ if (!preview) return void 0;
2840
+ return preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
2833
2841
  }
2834
2842
  function fetchRecords(sdk, params) {
2835
2843
  return sdk.listTableRecords({
@@ -2839,7 +2847,7 @@ function fetchRecords(sdk, params) {
2839
2847
  }
2840
2848
  function recordChoices(records) {
2841
2849
  return records.map((record) => ({
2842
- name: summarizeRecord(record),
2850
+ name: summarizeRecord(record) || record.id,
2843
2851
  value: record.id
2844
2852
  }));
2845
2853
  }
@@ -2879,7 +2887,8 @@ var tableFieldIdsResolver = {
2879
2887
  name: "fields",
2880
2888
  message: "Select fields:",
2881
2889
  choices: fields.map((field) => ({
2882
- name: `${field.name} (${field.id}, ${field.type})`,
2890
+ name: field.name,
2891
+ hint: [field.id, field.type],
2883
2892
  value: field.id
2884
2893
  })),
2885
2894
  validate: (value) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
@@ -6307,7 +6316,7 @@ async function invalidateCredentialsToken(options) {
6307
6316
  }
6308
6317
 
6309
6318
  // src/sdk-version.ts
6310
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.54.0" : void 0) || "unknown";
6319
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.55.0" : void 0) || "unknown";
6311
6320
 
6312
6321
  // src/utils/open-url.ts
6313
6322
  var nodePrefix = "node:";
@@ -31,6 +31,7 @@ export declare const createTriggerInboxPlugin: (sdk: {
31
31
  createTriggerInbox: (options?: {
32
32
  app: string;
33
33
  action: string;
34
+ name?: string | undefined;
34
35
  connection?: string | number | null | undefined;
35
36
  inputs?: Record<string, unknown> | undefined;
36
37
  notificationUrl?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,WAAW,CAAC;AAU7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAInE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;aAIpB;QACP,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2E/C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,WAAW,CAAC;AAa7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAKnE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;aAIpB;QACP,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+F/C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
2
  import { CreateTriggerInboxSchema, TriggerInboxItemSchema } from "./schemas";
3
- import { ZapierConfigurationError } from "../../../types/errors";
3
+ import { ZapierConfigurationError, ZapierConflictError, } from "../../../types/errors";
4
4
  import { appKeyResolver, actionKeyResolver, connectionIdResolver, inputsResolver, } from "../../../resolvers";
5
5
  import { resolveConnectionId } from "../../../utils/domain-utils";
6
6
  import { triggersDefaults } from "../shared";
7
+ import { extractErrorDetail } from "../utils";
7
8
  export const createTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
8
9
  ...triggersDefaults,
9
10
  name: "createTriggerInbox",
@@ -16,6 +17,7 @@ export const createTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod
16
17
  // seeded into resolvedParams without polluting the user-facing schema
17
18
  // (where it would leak into the SDK method signature and CLI flags).
18
19
  resolvers: {
20
+ name: { type: "static", inputType: "text" },
19
21
  app: appKeyResolver,
20
22
  action: actionKeyResolver,
21
23
  connection: connectionIdResolver,
@@ -24,7 +26,7 @@ export const createTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod
24
26
  },
25
27
  handler: async ({ sdk, options }) => {
26
28
  const { api } = sdk.context;
27
- const { app: appKey, action: actionKey, connection, inputs = {}, notificationUrl, } = options;
29
+ const { name, app: appKey, action: actionKey, connection, inputs = {}, notificationUrl, } = options;
28
30
  const resolvedConnectionId = await resolveConnectionId({
29
31
  connection,
30
32
  resolveConnection: sdk.context.resolveConnection,
@@ -41,10 +43,23 @@ export const createTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod
41
43
  connection_id: resolvedConnectionId ?? null,
42
44
  },
43
45
  };
46
+ if (name !== undefined) {
47
+ requestBody.name = name;
48
+ }
44
49
  if (notificationUrl !== undefined) {
45
50
  requestBody.notification_url = notificationUrl;
46
51
  }
47
- const rawResponse = await api.post("/trigger-inbox/api/v1/inboxes", requestBody, { authRequired: true });
52
+ const rawResponse = await api.post("/trigger-inbox/api/v1/inboxes", requestBody, {
53
+ authRequired: true,
54
+ customErrorHandler: ({ status, data }) => {
55
+ if (status === 409) {
56
+ const detail = extractErrorDetail(data);
57
+ return new ZapierConflictError(detail ??
58
+ `An inbox named "${name}" already exists with a different subscription.`, { statusCode: status, resourceType: "trigger_inbox" });
59
+ }
60
+ return undefined;
61
+ },
62
+ });
48
63
  return { data: TriggerInboxItemSchema.parse(rawResponse) };
49
64
  },
50
65
  }));
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import type { FunctionOptions } from "../../../types/functions";
3
3
  import { TriggerInboxItemSchema, type TriggerInboxItem } from "../../../schemas/TriggerInbox";
4
4
  export declare const CreateTriggerInboxSchema: z.ZodObject<{
5
+ name: z.ZodOptional<z.ZodString>;
5
6
  app: z.ZodString & {
6
7
  _def: z.core.$ZodStringDef & import("../../..").PositionalMetadata;
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOhE,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAKvC,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAkBK,CAAC;AAE3C,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,wBAAwB,CAChC,GACC,eAAe,CAAC;AAElB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/createTriggerInbox/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAQhE,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAKvC,eAAO,MAAM,wBAAwB;;;;;;;;;;;iBAqBK,CAAC;AAE3C,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,wBAAwB,CAChC,GACC,eAAe,CAAC;AAElB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { z } from "zod";
2
- import { AppPropertySchema, ActionPropertySchema, ConnectionPropertySchema, InputsPropertySchema, } from "../../../types/properties";
2
+ import { AppPropertySchema, ActionPropertySchema, ConnectionPropertySchema, InputsPropertySchema, TriggerInboxNamePropertySchema, } from "../../../types/properties";
3
3
  import { TriggerInboxItemSchema, } from "../../../schemas/TriggerInbox";
4
- const CreateTriggerInboxDescription = "Create a new trigger inbox subscription with an auto-generated name. Always creates; use ensureTriggerInbox for get-or-create on a stable name.";
4
+ const CreateTriggerInboxDescription = "Create a new trigger inbox subscription. Always creates a new inbox; use ensureTriggerInbox for get-or-create on a stable name.";
5
5
  export const CreateTriggerInboxSchema = z
6
6
  .object({
7
+ name: TriggerInboxNamePropertySchema.optional().describe("Optional inbox name. Auto-generated when omitted. Throws a conflict error if the name is already in use by another subscription."),
7
8
  app: AppPropertySchema,
8
9
  action: ActionPropertySchema,
9
10
  connection: ConnectionPropertySchema.nullable()
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/ensureTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,WAAW,CAAC;AAa7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAcnE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;aAIpB;QACP,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2F/C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/ensureTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,WAAW,CAAC;AAa7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAKnE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;aAIpB;QACP,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2F/C,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -4,18 +4,7 @@ import { ZapierConfigurationError, ZapierConflictError, } from "../../../types/e
4
4
  import { appKeyResolver, actionKeyResolver, connectionIdResolver, inputsResolver, } from "../../../resolvers";
5
5
  import { resolveConnectionId } from "../../../utils/domain-utils";
6
6
  import { triggersDefaults } from "../shared";
7
- function extractErrorDetail(data) {
8
- if (typeof data !== "object" || data === null)
9
- return undefined;
10
- const errors = data.errors;
11
- if (!Array.isArray(errors) || errors.length === 0)
12
- return undefined;
13
- const first = errors[0];
14
- if (typeof first !== "object" || first === null)
15
- return undefined;
16
- const detail = first.detail;
17
- return typeof detail === "string" ? detail : undefined;
18
- }
7
+ import { extractErrorDetail } from "../utils";
19
8
  export const ensureTriggerInboxPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
20
9
  ...triggersDefaults,
21
10
  name: "ensureTriggerInbox",
@@ -14,4 +14,10 @@ export declare function resolveTriggerInboxId({ api, inbox, }: {
14
14
  api: ApiClient;
15
15
  inbox: string;
16
16
  }): Promise<string>;
17
+ /**
18
+ * Pulls `errors[0].detail` off a JSON:API-style error response body.
19
+ * Returns `undefined` for any shape that doesn't match, so callers can
20
+ * fall back to a default message.
21
+ */
22
+ export declare function extractErrorDetail(data: unknown): string | undefined;
17
23
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/triggers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,GACN,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/triggers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,GACN,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBlB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQpE"}
@@ -26,3 +26,20 @@ export async function resolveTriggerInboxId({ api, inbox, }) {
26
26
  }
27
27
  return id;
28
28
  }
29
+ /**
30
+ * Pulls `errors[0].detail` off a JSON:API-style error response body.
31
+ * Returns `undefined` for any shape that doesn't match, so callers can
32
+ * fall back to a default message.
33
+ */
34
+ export function extractErrorDetail(data) {
35
+ if (typeof data !== "object" || data === null)
36
+ return undefined;
37
+ const errors = data.errors;
38
+ if (!Array.isArray(errors) || errors.length === 0)
39
+ return undefined;
40
+ const first = errors[0];
41
+ if (typeof first !== "object" || first === null)
42
+ return undefined;
43
+ const detail = first.detail;
44
+ return typeof detail === "string" ? detail : undefined;
45
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAwBhD,CAAC"}
1
+ {"version":3,"file":"actionKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/actionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,UAAU,EACV;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,CAuBhD,CAAC"}
@@ -12,7 +12,8 @@ export const actionKeyResolver = {
12
12
  name: "action",
13
13
  message: "Select action:",
14
14
  choices: actions.map((action) => ({
15
- name: `${action.title || action.name || action.key} - ${action.description || "No description"}`,
15
+ name: action.title || action.name || action.key,
16
+ hint: action.description || undefined,
16
17
  value: action.key,
17
18
  })),
18
19
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/appKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,KAAK,cAAc,GAAG,eAAe,CAAC,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEpE,eAAO,MAAM,cAAc,EAAE,cA6C5B,CAAC"}
1
+ {"version":3,"file":"appKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/appKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,KAAK,cAAc,GAAG,eAAe,CAAC,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEpE,eAAO,MAAM,cAAc,EAAE,cA4C5B,CAAC"}
@@ -39,9 +39,8 @@ export const appKeyResolver = {
39
39
  name: "app",
40
40
  message: "Select app:",
41
41
  choices: apps.map((app) => ({
42
- name: app.title
43
- ? `${app.title} (${getAppKeyList(app).join(", ")})`
44
- : app.key,
42
+ name: app.title || app.key,
43
+ hint: app.title ? getAppKeyList(app) : undefined,
45
44
  value: app.key,
46
45
  })),
47
46
  }),
@@ -9,7 +9,7 @@ export const clientIdResolver = {
9
9
  name: "clientId",
10
10
  message: "Select client credentials to delete:",
11
11
  choices: credentials.map((cred) => ({
12
- name: `${cred.name} (${cred.client_id})`,
12
+ name: cred.name,
13
13
  value: cred.client_id,
14
14
  })),
15
15
  }),
@@ -15,7 +15,7 @@ function promptForConnection(connections, params) {
15
15
  ? `Select connection for ${params.app}:`
16
16
  : "Select connection:",
17
17
  choices: connections.map((connection) => ({
18
- name: `${connection.title || connection.label || "Connection"} (ID: ${connection.id})`,
18
+ name: connection.title || connection.label || "Connection",
19
19
  value: connection.id,
20
20
  })),
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"inputFieldKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/inputFieldKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiC9D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,cAAc,EACd;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CA0BF,CAAC"}
1
+ {"version":3,"file":"inputFieldKey.d.ts","sourceRoot":"","sources":["../../src/resolvers/inputFieldKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiC9D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,cAAc,EACd;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CA4BF,CAAC"}
@@ -40,7 +40,11 @@ export const inputFieldKeyResolver = {
40
40
  name: "inputField",
41
41
  message: "Select input field:",
42
42
  choices: fields.map((field) => ({
43
- name: `${field.title || field.key} - ${field.value_type || "No type"} ${field.is_required ? "(required)" : "(optional)"}`,
43
+ name: field.title || field.key,
44
+ hint: [
45
+ field.value_type,
46
+ field.is_required ? "required" : "optional",
47
+ ].filter(Boolean),
44
48
  value: field.key,
45
49
  })),
46
50
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"tableFieldIds.d.ts","sourceRoot":"","sources":["../../src/resolvers/tableFieldIds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAE3E,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,SAAS,EACT;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAoBlB,CAAC"}
1
+ {"version":3,"file":"tableFieldIds.d.ts","sourceRoot":"","sources":["../../src/resolvers/tableFieldIds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAE3E,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,SAAS,EACT;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAqBlB,CAAC"}
@@ -9,7 +9,8 @@ export const tableFieldIdsResolver = {
9
9
  name: "fields",
10
10
  message: "Select fields:",
11
11
  choices: fields.map((field) => ({
12
- name: `${field.name} (${field.id}, ${field.type})`,
12
+ name: field.name,
13
+ hint: [field.id, field.type],
13
14
  value: field.id,
14
15
  })),
15
16
  validate: (value) => Array.isArray(value) && value.length > 0
@@ -23,7 +23,7 @@ export const tableIdResolver = {
23
23
  name: "table",
24
24
  message: "Select a table:",
25
25
  choices: tables.map((table) => ({
26
- name: `${table.name} (${table.id})`,
26
+ name: table.name,
27
27
  value: table.id,
28
28
  })),
29
29
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"tableRecordId.d.ts","sourceRoot":"","sources":["../../src/resolvers/tableRecordId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAgC3E,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,UAAU,EACV;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAWlB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAAe,CAClD,UAAU,EACV;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAelB,CAAC"}
1
+ {"version":3,"file":"tableRecordId.d.ts","sourceRoot":"","sources":["../../src/resolvers/tableRecordId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AA+B3E,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,UAAU,EACV;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAWlB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAAe,CAClD,UAAU,EACV;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAelB,CAAC"}
@@ -6,8 +6,9 @@ function summarizeRecord(record) {
6
6
  .map((v) => formatFieldValue(v).replace(/\s+/g, " ").trim())
7
7
  .filter((s) => s.length > 0)
8
8
  .join(", ");
9
- const truncated = preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
10
- return truncated ? `${record.id} — ${truncated}` : record.id;
9
+ if (!preview)
10
+ return undefined;
11
+ return preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
11
12
  }
12
13
  function fetchRecords(sdk, params) {
13
14
  return sdk.listTableRecords({
@@ -17,7 +18,7 @@ function fetchRecords(sdk, params) {
17
18
  }
18
19
  function recordChoices(records) {
19
20
  return records.map((record) => ({
20
- name: summarizeRecord(record),
21
+ name: summarizeRecord(record) || record.id,
21
22
  value: record.id,
22
23
  }));
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"triggerInbox.d.ts","sourceRoot":"","sources":["../../src/resolvers/triggerInbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAchE,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC,gBAAgB,EAAE,EAAE,CAiBtE,CAAC"}
1
+ {"version":3,"file":"triggerInbox.d.ts","sourceRoot":"","sources":["../../src/resolvers/triggerInbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAchE,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC,gBAAgB,EAAE,EAAE,CAkBtE,CAAC"}
@@ -11,7 +11,8 @@ export const triggerInboxResolver = {
11
11
  choices: inboxes
12
12
  .filter((inbox) => inbox.status !== "deleting")
13
13
  .map((inbox) => ({
14
- name: `${inbox.name ?? inbox.id} (${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status})`,
14
+ name: inbox.name ?? inbox.id,
15
+ hint: `${inbox.subscription.app_key} / ${inbox.subscription.action_key}, ${inbox.status}`,
15
16
  value: inbox.id,
16
17
  })),
17
18
  }),