@zapier/zapier-sdk 0.73.0 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +32 -32
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +5 -0
- package/dist/experimental.cjs +218 -80
- package/dist/experimental.d.mts +160 -12
- package/dist/experimental.d.ts +158 -10
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.mjs +217 -81
- package/dist/{index-D1O7Pcex.d.mts → index-WMit6fkJ.d.mts} +22 -1
- package/dist/{index-D1O7Pcex.d.ts → index-WMit6fkJ.d.ts} +22 -1
- package/dist/index.cjs +53 -16
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +52 -17
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +42 -3
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +49 -11
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +117 -5
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +77 -14
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts +37 -2
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/index.js +10 -9
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +117 -4
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/schemas.js +38 -37
- package/dist/plugins/codeSubstrate/shared.d.ts +56 -0
- package/dist/plugins/codeSubstrate/shared.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/shared.js +100 -0
- package/dist/utils/caller-context.d.ts +21 -0
- package/dist/utils/caller-context.d.ts.map +1 -0
- package/dist/utils/caller-context.js +35 -0
- package/package.json +2 -2
|
@@ -7111,6 +7111,27 @@ declare const apiPlugin: (sdk: {
|
|
|
7111
7111
|
};
|
|
7112
7112
|
type ApiPluginProvides = ReturnType<typeof apiPlugin>;
|
|
7113
7113
|
|
|
7114
|
+
interface CallerContext {
|
|
7115
|
+
packageOperation?: string;
|
|
7116
|
+
}
|
|
7117
|
+
/**
|
|
7118
|
+
* Run `fn` with the given caller context merged onto any parent context, so
|
|
7119
|
+
* the operation that initiated the call (e.g. a CLI command or MCP tool) stays
|
|
7120
|
+
* observable through every SDK call it makes.
|
|
7121
|
+
*
|
|
7122
|
+
* Caller context is telemetry-only: reading the parent scope is wrapped so a
|
|
7123
|
+
* broken ALS store can never crash the wrapped command. Errors thrown by `fn`
|
|
7124
|
+
* itself are intentionally NOT caught — they propagate.
|
|
7125
|
+
*/
|
|
7126
|
+
declare function runWithCallerContext<T>(context: CallerContext, fn: () => T): T;
|
|
7127
|
+
/**
|
|
7128
|
+
* Read the active caller context, or an empty object outside any caller scope.
|
|
7129
|
+
*
|
|
7130
|
+
* Read on the outbound HTTP path to set a telemetry header, so a failure here
|
|
7131
|
+
* must never break the request — it falls back to an empty context.
|
|
7132
|
+
*/
|
|
7133
|
+
declare function getCallerContext(): CallerContext;
|
|
7134
|
+
|
|
7114
7135
|
/**
|
|
7115
7136
|
* Batch Operation Utilities
|
|
7116
7137
|
*
|
|
@@ -15567,4 +15588,4 @@ declare const registryPlugin: (sdk: {
|
|
|
15567
15588
|
};
|
|
15568
15589
|
}) => {};
|
|
15569
15590
|
|
|
15570
|
-
export { type ConnectionsResponse as $, type ApiClient as A, type BaseSdkOptions as B, type CoreOptions as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, AppPropertySchema as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, CoreErrorCode as aA, type Plugin as aB, type PluginProvides as aC, definePlugin as aD, createPluginMethod as aE, createPaginatedPluginMethod as aF, composePlugins as aG, type ActionItem as aH, type ActionTypeItem as aI, registryPlugin as aJ, type RequestOptions as aK, type PollOptions as aL, createZapierApi as aM, getOrCreateApiClient as aN, isPermanentHttpError as aO, type SseMessage as aP, type JsonSseMessage as aQ, type AppItem as aR, type ConnectionItem as aS, type ActionItem$1 as aT, type InputFieldItem as aU, type InfoFieldItem as aV, type RootFieldItem as aW, type UserProfileItem as aX, type SdkPage as aY, type PaginatedSdkFunction as aZ, AppKeyPropertySchema as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, toSnakeCase as ag, toTitleCase as ah, batch as ai, type BatchOptions as aj, buildCapabilityMessage as ak, logDeprecation as al, resetDeprecationWarnings as am, RelayRequestSchema as an, RelayFetchSchema as ao, createZapierSdkWithoutRegistry as ap, createSdk as aq, createOptionsPlugin as ar, createZapierCoreStack as as, type FunctionRegistryEntry as at, type FunctionDeprecation as au, BaseSdkOptionsSchema as av, isCoreError as aw, getCoreErrorCode as ax, getCoreErrorCause as ay, CORE_ERROR_SYMBOL as az, type Manifest as b, ZapierResourceNotFoundError as b$, ActionTypePropertySchema as b0, ActionKeyPropertySchema as b1, ActionPropertySchema as b2, InputFieldPropertySchema as b3, ConnectionIdPropertySchema as b4, AuthenticationIdPropertySchema as b5, ConnectionPropertySchema as b6, InputsPropertySchema as b7, LimitPropertySchema as b8, OffsetPropertySchema as b9, type LimitProperty as bA, type OffsetProperty as bB, type OutputProperty as bC, type DebugProperty as bD, type ParamsProperty as bE, type ActionTimeoutMsProperty as bF, type TableProperty as bG, type RecordProperty as bH, type RecordsProperty as bI, type FieldsProperty as bJ, type AppsProperty as bK, type TablesProperty as bL, type ConnectionsProperty as bM, type TriggerInboxProperty as bN, type TriggerInboxNameProperty as bO, type LeaseProperty as bP, type LeaseSecondsProperty as bQ, type LeaseLimitProperty as bR, type ErrorOptions as bS, ZapierError as bT, ZapierValidationError as bU, ZapierUnknownError as bV, ZapierAuthenticationError as bW, zapierAdaptError as bX, ZapierApiError as bY, ZapierAppNotFoundError as bZ, ZapierNotFoundError as b_, OutputPropertySchema as ba, DebugPropertySchema as bb, ParamsPropertySchema as bc, ActionTimeoutMsPropertySchema as bd, TablePropertySchema as be, RecordPropertySchema as bf, RecordsPropertySchema as bg, FieldsPropertySchema as bh, AppsPropertySchema as bi, TablesPropertySchema as bj, ConnectionsPropertySchema as bk, TriggerInboxPropertySchema as bl, TriggerInboxNamePropertySchema as bm, LeasePropertySchema as bn, LeaseSecondsPropertySchema as bo, LeaseLimitPropertySchema as bp, type AppKeyProperty as bq, type AppProperty as br, type ActionTypeProperty as bs, type ActionKeyProperty as bt, type ActionProperty as bu, type InputFieldProperty as bv, type ConnectionIdProperty as bw, type ConnectionProperty as bx, type AuthenticationIdProperty as by, type InputsProperty as bz, type UpdateManifestEntryResult as c, type ApiPluginProvides as c$, ZapierConfigurationError as c0, ZapierBundleError as c1, ZapierTimeoutError as c2, ZapierActionError as c3, ZapierConflictError as c4, type RateLimitInfo as c5, ZapierRateLimitError as c6, type ApprovalStatus as c7, ZapierApprovalError as c8, ZapierRelayError as c9, type DeleteClientCredentialsPluginProvides as cA, getAppPlugin as cB, type GetAppPluginProvides as cC, getActionPlugin as cD, type GetActionPluginProvides as cE, getConnectionPlugin as cF, type GetConnectionPluginProvides as cG, findFirstConnectionPlugin as cH, type FindFirstConnectionPluginProvides as cI, findUniqueConnectionPlugin as cJ, type FindUniqueConnectionPluginProvides as cK, CONTEXT_CACHE_TTL_MS as cL, CONTEXT_CACHE_MAX_SIZE as cM, runActionPlugin as cN, type RunActionPluginProvides as cO, requestPlugin as cP, type RequestPluginProvides as cQ, type ManifestPluginOptions as cR, getPreferredManifestEntryKey as cS, manifestPlugin as cT, type ManifestPluginProvides as cU, DEFAULT_CONFIG_PATH as cV, type ManifestEntry as cW, getProfilePlugin as cX, type GetProfilePluginProvides as cY, type ApiPluginOptions as cZ, apiPlugin as c_, formatErrorMessage as ca, type ApiError as cb, ZapierSignal as cc, appsPlugin as cd, type AppsPluginProvides as ce, type ActionExecutionOptions as cf, type AppFactoryInput as cg, fetchPlugin as ch, type FetchPluginProvides as ci, listAppsPlugin as cj, type ListAppsPluginProvides as ck, listActionsPlugin as cl, type ListActionsPluginProvides as cm, listActionInputFieldsPlugin as cn, type ListActionInputFieldsPluginProvides as co, listActionInputFieldChoicesPlugin as cp, type ListActionInputFieldChoicesPluginProvides as cq, getActionInputFieldsSchemaPlugin as cr, type GetActionInputFieldsSchemaPluginProvides as cs, listConnectionsPlugin as ct, type ListConnectionsPluginProvides as cu, listClientCredentialsPlugin as cv, type ListClientCredentialsPluginProvides as cw, createClientCredentialsPlugin as cx, type CreateClientCredentialsPluginProvides as cy, deleteClientCredentialsPlugin as cz, type AddActionEntryOptions as d, type CredentialsFunction as d$, appKeyResolver as d0, actionTypeResolver as d1, actionKeyResolver as d2, connectionIdResolver as d3, connectionIdGenericResolver as d4, inputsResolver as d5, inputsAllOptionalResolver as d6, inputFieldKeyResolver as d7, clientCredentialsNameResolver as d8, clientIdResolver as d9, type ZapierCacheEntry as dA, type ZapierCacheSetOptions as dB, createMemoryCache as dC, type SdkEvent as dD, type AuthEvent as dE, type ApiEvent as dF, type LoadingEvent as dG, type EventCallback as dH, type Credentials as dI, type ResolvedCredentials as dJ, type CredentialsObject as dK, type ClientCredentialsObject as dL, type PkceCredentialsObject as dM, isClientCredentials as dN, isPkceCredentials as dO, isCredentialsObject as dP, isCredentialsFunction as dQ, type ResolveCredentialsOptions as dR, resolveCredentialsFromEnv as dS, resolveCredentials as dT, getBaseUrlFromCredentials as dU, getClientIdFromCredentials as dV, ClientCredentialsObjectSchema as dW, PkceCredentialsObjectSchema as dX, CredentialsObjectSchema as dY, ResolvedCredentialsSchema as dZ, CredentialsFunctionSchema as d_, tableIdResolver as da, triggerInboxResolver as db, workflowIdResolver as dc, durableRunIdResolver as dd, workflowVersionIdResolver as de, workflowRunIdResolver as df, triggerMessagesResolver as dg, tableRecordIdResolver as dh, tableRecordIdsResolver as di, tableFieldIdsResolver as dj, tableNameResolver as dk, tableFieldsResolver as dl, tableRecordsResolver as dm, tableUpdateRecordsResolver as dn, tableFiltersResolver as dp, tableSortResolver as dq, type ResolveAuthTokenOptions as dr, clearTokenCache as ds, invalidateCachedToken as dt, injectCliLogin as du, isCliLoginAvailable as dv, getTokenFromCliLogin as dw, resolveAuthToken as dx, invalidateCredentialsToken as dy, type ZapierCache as dz, type AddActionEntryResult as e, getReleaseId as e$, CredentialsSchema as e0, ConnectionEntrySchema as e1, type ConnectionEntry as e2, ConnectionsMapSchema as e3, type ConnectionsMap as e4, connectionsPlugin as e5, type ConnectionsPluginProvides as e6, ZAPIER_BASE_URL as e7, getZapierSdkService as e8, MAX_PAGE_LIMIT as e9, getTableRecordPlugin as eA, type GetTableRecordPluginProvides as eB, listTableRecordsPlugin as eC, type ListTableRecordsPluginProvides as eD, createTableRecordsPlugin as eE, type CreateTableRecordsPluginProvides as eF, deleteTableRecordsPlugin as eG, type DeleteTableRecordsPluginProvides as eH, updateTableRecordsPlugin as eI, type UpdateTableRecordsPluginProvides as eJ, cleanupEventListeners as eK, type EventEmissionConfig as eL, eventEmissionPlugin as eM, type EventEmissionProvides as eN, type EventContext as eO, type ApplicationLifecycleEventData as eP, type EnhancedErrorEventData as eQ, type MethodCalledEventData as eR, buildApplicationLifecycleEvent as eS, buildErrorEventWithContext as eT, buildErrorEvent as eU, createBaseEvent as eV, buildMethodCalledEvent as eW, type BaseEvent as eX, type MethodCalledEvent as eY, generateEventId as eZ, getCurrentTimestamp as e_, DEFAULT_PAGE_SIZE as ea, DEFAULT_ACTION_TIMEOUT_MS as eb, ZAPIER_MAX_NETWORK_RETRIES as ec, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as ed, MAX_CONCURRENCY_LIMIT as ee, parseConcurrencyEnvVar as ef, ZAPIER_MAX_CONCURRENT_REQUESTS as eg, getZapierApprovalMode as eh, getZapierOpenAutoModeApprovalsInBrowser as ei, getZapierDefaultApprovalMode as ej, DEFAULT_APPROVAL_TIMEOUT_MS as ek, DEFAULT_MAX_APPROVAL_RETRIES as el, listTablesPlugin as em, type ListTablesPluginProvides as en, getTablePlugin as eo, type GetTablePluginProvides as ep, createTablePlugin as eq, type CreateTablePluginProvides as er, deleteTablePlugin as es, type DeleteTablePluginProvides as et, listTableFieldsPlugin as eu, type ListTableFieldsPluginProvides as ev, createTableFieldsPlugin as ew, type CreateTableFieldsPluginProvides as ex, deleteTableFieldsPlugin as ey, type DeleteTableFieldsPluginProvides as ez, type ActionEntry as f, getOsInfo as f0, getPlatformVersions as f1, isCi as f2, getCiPlatform as f3, getMemoryUsage as f4, getCpuTime as f5, getTtyContext as f6, getAgent as f7, createZapierSdk as f8, createZapierSdkStack as f9, type ZapierSdk as fa, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
|
|
15591
|
+
export { type ConnectionsResponse as $, type ApiClient as A, type BaseSdkOptions as B, type CoreOptions as C, type DrainTriggerInboxOptions as D, type EventEmissionContext as E, type FieldsetItem as F, type GetConnectionStartUrlItem as G, type Action as H, type App as I, type Field as J, type Choice as K, type LeasedTriggerMessageItem as L, type MethodHooks as M, type Need as N, type OutputFormatter as O, type PluginStack as P, type ActionExecutionResult as Q, type ResolvedAppLocator as R, type ActionField as S, type TriggerMessageStatus as T, type UpdateManifestEntryOptions as U, type ActionFieldChoice as V, type WaitForNewConnectionItem as W, type NeedsRequest as X, type NeedsResponse as Y, type ZapierSdkOptions as Z, type Connection as _, type PluginMeta as a, type SdkPage as a$, type UserProfile as a0, isPositional as a1, createFunction as a2, createPluginStack as a3, createCorePlugin as a4, addPlugin as a5, type FormattedItem as a6, type Resolver as a7, type ArrayResolver as a8, type ResolverMetadata as a9, getCoreErrorCode as aA, getCoreErrorCause as aB, CORE_ERROR_SYMBOL as aC, CoreErrorCode as aD, type Plugin as aE, type PluginProvides as aF, definePlugin as aG, createPluginMethod as aH, createPaginatedPluginMethod as aI, composePlugins as aJ, type ActionItem as aK, type ActionTypeItem as aL, registryPlugin as aM, type RequestOptions as aN, type PollOptions as aO, createZapierApi as aP, getOrCreateApiClient as aQ, isPermanentHttpError as aR, type SseMessage as aS, type JsonSseMessage as aT, type AppItem as aU, type ConnectionItem as aV, type ActionItem$1 as aW, type InputFieldItem as aX, type InfoFieldItem as aY, type RootFieldItem as aZ, type UserProfileItem as a_, type StaticResolver as aa, type DynamicListResolver as ab, type DynamicSearchResolver as ac, type FieldsResolver as ad, runInMethodScope as ae, runWithTelemetryContext as af, getCallerContext as ag, runWithCallerContext as ah, type CallerContext as ai, toSnakeCase as aj, toTitleCase as ak, batch as al, type BatchOptions as am, buildCapabilityMessage as an, logDeprecation as ao, resetDeprecationWarnings as ap, RelayRequestSchema as aq, RelayFetchSchema as ar, createZapierSdkWithoutRegistry as as, createSdk as at, createOptionsPlugin as au, createZapierCoreStack as av, type FunctionRegistryEntry as aw, type FunctionDeprecation as ax, BaseSdkOptionsSchema as ay, isCoreError as az, type Manifest as b, ZapierApiError as b$, type PaginatedSdkFunction as b0, AppKeyPropertySchema as b1, AppPropertySchema as b2, ActionTypePropertySchema as b3, ActionKeyPropertySchema as b4, ActionPropertySchema as b5, InputFieldPropertySchema as b6, ConnectionIdPropertySchema as b7, AuthenticationIdPropertySchema as b8, ConnectionPropertySchema as b9, type ConnectionProperty as bA, type AuthenticationIdProperty as bB, type InputsProperty as bC, type LimitProperty as bD, type OffsetProperty as bE, type OutputProperty as bF, type DebugProperty as bG, type ParamsProperty as bH, type ActionTimeoutMsProperty as bI, type TableProperty as bJ, type RecordProperty as bK, type RecordsProperty as bL, type FieldsProperty as bM, type AppsProperty as bN, type TablesProperty as bO, type ConnectionsProperty as bP, type TriggerInboxProperty as bQ, type TriggerInboxNameProperty as bR, type LeaseProperty as bS, type LeaseSecondsProperty as bT, type LeaseLimitProperty as bU, type ErrorOptions as bV, ZapierError as bW, ZapierValidationError as bX, ZapierUnknownError as bY, ZapierAuthenticationError as bZ, zapierAdaptError as b_, InputsPropertySchema as ba, LimitPropertySchema as bb, OffsetPropertySchema as bc, OutputPropertySchema as bd, DebugPropertySchema as be, ParamsPropertySchema as bf, ActionTimeoutMsPropertySchema as bg, TablePropertySchema as bh, RecordPropertySchema as bi, RecordsPropertySchema as bj, FieldsPropertySchema as bk, AppsPropertySchema as bl, TablesPropertySchema as bm, ConnectionsPropertySchema as bn, TriggerInboxPropertySchema as bo, TriggerInboxNamePropertySchema as bp, LeasePropertySchema as bq, LeaseSecondsPropertySchema as br, LeaseLimitPropertySchema as bs, type AppKeyProperty as bt, type AppProperty as bu, type ActionTypeProperty as bv, type ActionKeyProperty as bw, type ActionProperty as bx, type InputFieldProperty as by, type ConnectionIdProperty as bz, type UpdateManifestEntryResult as c, type GetProfilePluginProvides as c$, ZapierAppNotFoundError as c0, ZapierNotFoundError as c1, ZapierResourceNotFoundError as c2, ZapierConfigurationError as c3, ZapierBundleError as c4, ZapierTimeoutError as c5, ZapierActionError as c6, ZapierConflictError as c7, type RateLimitInfo as c8, ZapierRateLimitError as c9, createClientCredentialsPlugin as cA, type CreateClientCredentialsPluginProvides as cB, deleteClientCredentialsPlugin as cC, type DeleteClientCredentialsPluginProvides as cD, getAppPlugin as cE, type GetAppPluginProvides as cF, getActionPlugin as cG, type GetActionPluginProvides as cH, getConnectionPlugin as cI, type GetConnectionPluginProvides as cJ, findFirstConnectionPlugin as cK, type FindFirstConnectionPluginProvides as cL, findUniqueConnectionPlugin as cM, type FindUniqueConnectionPluginProvides as cN, CONTEXT_CACHE_TTL_MS as cO, CONTEXT_CACHE_MAX_SIZE as cP, runActionPlugin as cQ, type RunActionPluginProvides as cR, requestPlugin as cS, type RequestPluginProvides as cT, type ManifestPluginOptions as cU, getPreferredManifestEntryKey as cV, manifestPlugin as cW, type ManifestPluginProvides as cX, DEFAULT_CONFIG_PATH as cY, type ManifestEntry as cZ, getProfilePlugin as c_, type ApprovalStatus as ca, ZapierApprovalError as cb, ZapierRelayError as cc, formatErrorMessage as cd, type ApiError as ce, ZapierSignal as cf, appsPlugin as cg, type AppsPluginProvides as ch, type ActionExecutionOptions as ci, type AppFactoryInput as cj, fetchPlugin as ck, type FetchPluginProvides as cl, listAppsPlugin as cm, type ListAppsPluginProvides as cn, listActionsPlugin as co, type ListActionsPluginProvides as cp, listActionInputFieldsPlugin as cq, type ListActionInputFieldsPluginProvides as cr, listActionInputFieldChoicesPlugin as cs, type ListActionInputFieldChoicesPluginProvides as ct, getActionInputFieldsSchemaPlugin as cu, type GetActionInputFieldsSchemaPluginProvides as cv, listConnectionsPlugin as cw, type ListConnectionsPluginProvides as cx, listClientCredentialsPlugin as cy, type ListClientCredentialsPluginProvides as cz, type AddActionEntryOptions as d, CredentialsObjectSchema as d$, type ApiPluginOptions as d0, apiPlugin as d1, type ApiPluginProvides as d2, appKeyResolver as d3, actionTypeResolver as d4, actionKeyResolver as d5, connectionIdResolver as d6, connectionIdGenericResolver as d7, inputsResolver as d8, inputsAllOptionalResolver as d9, resolveAuthToken as dA, invalidateCredentialsToken as dB, type ZapierCache as dC, type ZapierCacheEntry as dD, type ZapierCacheSetOptions as dE, createMemoryCache as dF, type SdkEvent as dG, type AuthEvent as dH, type ApiEvent as dI, type LoadingEvent as dJ, type EventCallback as dK, type Credentials as dL, type ResolvedCredentials as dM, type CredentialsObject as dN, type ClientCredentialsObject as dO, type PkceCredentialsObject as dP, isClientCredentials as dQ, isPkceCredentials as dR, isCredentialsObject as dS, isCredentialsFunction as dT, type ResolveCredentialsOptions as dU, resolveCredentialsFromEnv as dV, resolveCredentials as dW, getBaseUrlFromCredentials as dX, getClientIdFromCredentials as dY, ClientCredentialsObjectSchema as dZ, PkceCredentialsObjectSchema as d_, inputFieldKeyResolver as da, clientCredentialsNameResolver as db, clientIdResolver as dc, tableIdResolver as dd, triggerInboxResolver as de, workflowIdResolver as df, durableRunIdResolver as dg, workflowVersionIdResolver as dh, workflowRunIdResolver as di, triggerMessagesResolver as dj, tableRecordIdResolver as dk, tableRecordIdsResolver as dl, tableFieldIdsResolver as dm, tableNameResolver as dn, tableFieldsResolver as dp, tableRecordsResolver as dq, tableUpdateRecordsResolver as dr, tableFiltersResolver as ds, tableSortResolver as dt, type ResolveAuthTokenOptions as du, clearTokenCache as dv, invalidateCachedToken as dw, injectCliLogin as dx, isCliLoginAvailable as dy, getTokenFromCliLogin as dz, type AddActionEntryResult as e, type MethodCalledEvent as e$, ResolvedCredentialsSchema as e0, CredentialsFunctionSchema as e1, type CredentialsFunction as e2, CredentialsSchema as e3, ConnectionEntrySchema as e4, type ConnectionEntry as e5, ConnectionsMapSchema as e6, type ConnectionsMap as e7, connectionsPlugin as e8, type ConnectionsPluginProvides as e9, type CreateTableFieldsPluginProvides as eA, deleteTableFieldsPlugin as eB, type DeleteTableFieldsPluginProvides as eC, getTableRecordPlugin as eD, type GetTableRecordPluginProvides as eE, listTableRecordsPlugin as eF, type ListTableRecordsPluginProvides as eG, createTableRecordsPlugin as eH, type CreateTableRecordsPluginProvides as eI, deleteTableRecordsPlugin as eJ, type DeleteTableRecordsPluginProvides as eK, updateTableRecordsPlugin as eL, type UpdateTableRecordsPluginProvides as eM, cleanupEventListeners as eN, type EventEmissionConfig as eO, eventEmissionPlugin as eP, type EventEmissionProvides as eQ, type EventContext as eR, type ApplicationLifecycleEventData as eS, type EnhancedErrorEventData as eT, type MethodCalledEventData as eU, buildApplicationLifecycleEvent as eV, buildErrorEventWithContext as eW, buildErrorEvent as eX, createBaseEvent as eY, buildMethodCalledEvent as eZ, type BaseEvent as e_, ZAPIER_BASE_URL as ea, getZapierSdkService as eb, MAX_PAGE_LIMIT as ec, DEFAULT_PAGE_SIZE as ed, DEFAULT_ACTION_TIMEOUT_MS as ee, ZAPIER_MAX_NETWORK_RETRIES as ef, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS as eg, MAX_CONCURRENCY_LIMIT as eh, parseConcurrencyEnvVar as ei, ZAPIER_MAX_CONCURRENT_REQUESTS as ej, getZapierApprovalMode as ek, getZapierOpenAutoModeApprovalsInBrowser as el, getZapierDefaultApprovalMode as em, DEFAULT_APPROVAL_TIMEOUT_MS as en, DEFAULT_MAX_APPROVAL_RETRIES as eo, listTablesPlugin as ep, type ListTablesPluginProvides as eq, getTablePlugin as er, type GetTablePluginProvides as es, createTablePlugin as et, type CreateTablePluginProvides as eu, deleteTablePlugin as ev, type DeleteTablePluginProvides as ew, listTableFieldsPlugin as ex, type ListTableFieldsPluginProvides as ey, createTableFieldsPlugin as ez, type ActionEntry as f, generateEventId as f0, getCurrentTimestamp as f1, getReleaseId as f2, getOsInfo as f3, getPlatformVersions as f4, isCi as f5, getCiPlatform as f6, getMemoryUsage as f7, getCpuTime as f8, getTtyContext as f9, getAgent as fa, createZapierSdk as fb, createZapierSdkStack as fc, type ZapierSdk as fd, findManifestEntry as g, type CapabilitiesContext as h, type PaginatedSdkResult as i, type CreateConnectionItem as j, type PositionalMetadata as k, type ZapierFetchInitOptions as l, type DynamicResolver as m, type WatchTriggerInboxOptions as n, type ActionProxy as o, type ZapierSdkApps as p, type WithAddPlugin as q, readManifestFromFile as r, ZapierAbortDrainSignal as s, ZapierReleaseTriggerMessageSignal as t, type DrainTriggerInboxCallback as u, type DrainTriggerInboxErrorObserver as v, type ListAuthenticationsPluginProvides as w, type GetAuthenticationPluginProvides as x, type FindFirstAuthenticationPluginProvides as y, type FindUniqueAuthenticationPluginProvides as z };
|
package/dist/index.cjs
CHANGED
|
@@ -475,22 +475,34 @@ function createValidator(schema, { adaptError } = {}) {
|
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
478
|
+
function createAsyncContext() {
|
|
479
|
+
let store = null;
|
|
480
|
+
try {
|
|
481
|
+
store = new async_hooks.AsyncLocalStorage();
|
|
482
|
+
} catch {
|
|
483
|
+
store = null;
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
available: store !== null,
|
|
487
|
+
run(value, fn) {
|
|
488
|
+
return store ? store.run(value, fn) : fn();
|
|
489
|
+
},
|
|
490
|
+
get() {
|
|
491
|
+
return store?.getStore();
|
|
492
|
+
}
|
|
493
|
+
};
|
|
482
494
|
}
|
|
495
|
+
var scope = createAsyncContext();
|
|
483
496
|
function getCurrentScope() {
|
|
484
|
-
|
|
485
|
-
return scopeStore.getStore();
|
|
497
|
+
return scope.get();
|
|
486
498
|
}
|
|
487
499
|
function getCurrentDepth() {
|
|
488
500
|
return getCurrentScope()?.depth ?? 0;
|
|
489
501
|
}
|
|
490
502
|
function runInMethodScope(fn) {
|
|
491
|
-
if (!
|
|
492
|
-
const currentDepth =
|
|
493
|
-
return
|
|
503
|
+
if (!scope.available) return fn();
|
|
504
|
+
const currentDepth = scope.get()?.depth ?? -1;
|
|
505
|
+
return scope.run({ depth: currentDepth + 1 }, fn);
|
|
494
506
|
}
|
|
495
507
|
var runWithTelemetryContext = runInMethodScope;
|
|
496
508
|
function normalizeError(error, adaptError) {
|
|
@@ -3607,10 +3619,10 @@ var tableSortResolver = {
|
|
|
3607
3619
|
// src/plugins/eventEmission/method-metadata.ts
|
|
3608
3620
|
var SCOPE_KEY = "methodMetadata";
|
|
3609
3621
|
function setMethodMetadata(metadata) {
|
|
3610
|
-
const
|
|
3611
|
-
if (!
|
|
3612
|
-
const existing =
|
|
3613
|
-
|
|
3622
|
+
const scope2 = getCurrentScope();
|
|
3623
|
+
if (!scope2) return;
|
|
3624
|
+
const existing = scope2[SCOPE_KEY];
|
|
3625
|
+
scope2[SCOPE_KEY] = { ...existing, ...metadata };
|
|
3614
3626
|
}
|
|
3615
3627
|
function getMethodMetadata() {
|
|
3616
3628
|
return getCurrentScope()?.[SCOPE_KEY];
|
|
@@ -6461,10 +6473,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
|
|
|
6461
6473
|
return [...scopeSet].sort();
|
|
6462
6474
|
}
|
|
6463
6475
|
async function exchangeClientCredentials(options) {
|
|
6464
|
-
const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
|
|
6476
|
+
const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
|
|
6465
6477
|
const fetchFn = options.fetch || globalThis.fetch;
|
|
6466
6478
|
const tokenUrl = getTokenEndpointUrl(baseUrl);
|
|
6467
|
-
const mergedScopes = mergeScopes(
|
|
6479
|
+
const mergedScopes = mergeScopes(scope2, requiredScopes);
|
|
6468
6480
|
const scopeString = mergedScopes.join(" ");
|
|
6469
6481
|
onEvent?.({
|
|
6470
6482
|
type: "auth_exchanging",
|
|
@@ -6729,6 +6741,25 @@ async function invalidateCredentialsToken(options) {
|
|
|
6729
6741
|
}
|
|
6730
6742
|
}
|
|
6731
6743
|
|
|
6744
|
+
// src/utils/caller-context.ts
|
|
6745
|
+
var callerContext = createAsyncContext();
|
|
6746
|
+
function runWithCallerContext(context, fn) {
|
|
6747
|
+
let parent;
|
|
6748
|
+
try {
|
|
6749
|
+
parent = callerContext.get() ?? {};
|
|
6750
|
+
} catch {
|
|
6751
|
+
return fn();
|
|
6752
|
+
}
|
|
6753
|
+
return callerContext.run({ ...parent, ...context }, fn);
|
|
6754
|
+
}
|
|
6755
|
+
function getCallerContext() {
|
|
6756
|
+
try {
|
|
6757
|
+
return callerContext.get() ?? {};
|
|
6758
|
+
} catch {
|
|
6759
|
+
return {};
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
|
|
6732
6763
|
// src/api/sse-parser.ts
|
|
6733
6764
|
async function* jsonFrames(source) {
|
|
6734
6765
|
for await (const { data } of source) {
|
|
@@ -6880,7 +6911,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6880
6911
|
}
|
|
6881
6912
|
|
|
6882
6913
|
// src/sdk-version.ts
|
|
6883
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6914
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
|
|
6884
6915
|
|
|
6885
6916
|
// src/utils/open-url.ts
|
|
6886
6917
|
var nodePrefix = "node:";
|
|
@@ -7604,6 +7635,10 @@ var ZapierApiClient = class {
|
|
|
7604
7635
|
headers.set("x-zapier-sdk-package", callerPackage.name);
|
|
7605
7636
|
headers.set("zapier-sdk-package-version", callerPackage.version);
|
|
7606
7637
|
headers.set("x-zapier-sdk-package-version", callerPackage.version);
|
|
7638
|
+
const { packageOperation } = getCallerContext();
|
|
7639
|
+
if (packageOperation) {
|
|
7640
|
+
headers.set("zapier-sdk-package-operation", packageOperation);
|
|
7641
|
+
}
|
|
7607
7642
|
}
|
|
7608
7643
|
}
|
|
7609
7644
|
// Helper to perform HTTP requests with JSON handling
|
|
@@ -10409,6 +10444,7 @@ exports.getActionPlugin = getActionPlugin;
|
|
|
10409
10444
|
exports.getAgent = getAgent;
|
|
10410
10445
|
exports.getAppPlugin = getAppPlugin;
|
|
10411
10446
|
exports.getBaseUrlFromCredentials = getBaseUrlFromCredentials;
|
|
10447
|
+
exports.getCallerContext = getCallerContext;
|
|
10412
10448
|
exports.getCiPlatform = getCiPlatform;
|
|
10413
10449
|
exports.getClientIdFromCredentials = getClientIdFromCredentials;
|
|
10414
10450
|
exports.getConnectionPlugin = getConnectionPlugin;
|
|
@@ -10467,6 +10503,7 @@ exports.resolveCredentials = resolveCredentials;
|
|
|
10467
10503
|
exports.resolveCredentialsFromEnv = resolveCredentialsFromEnv;
|
|
10468
10504
|
exports.runActionPlugin = runActionPlugin;
|
|
10469
10505
|
exports.runInMethodScope = runInMethodScope;
|
|
10506
|
+
exports.runWithCallerContext = runWithCallerContext;
|
|
10470
10507
|
exports.runWithTelemetryContext = runWithTelemetryContext;
|
|
10471
10508
|
exports.tableFieldIdsResolver = tableFieldIdsResolver;
|
|
10472
10509
|
exports.tableFieldsResolver = tableFieldsResolver;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { H as Action, f as ActionEntry, cf as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aT as ActionItem, bt as ActionKeyProperty, b1 as ActionKeyPropertySchema, bu as ActionProperty, b2 as ActionPropertySchema, aH as ActionResolverItem, bF as ActionTimeoutMsProperty, bd as ActionTimeoutMsPropertySchema, aI as ActionTypeItem, bs as ActionTypeProperty, b0 as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, cb as ApiError, dF as ApiEvent, cZ as ApiPluginOptions, c$ as ApiPluginProvides, I as App, cg as AppFactoryInput, aR as AppItem, bq as AppKeyProperty, a_ as AppKeyPropertySchema, br as AppProperty, a$ as AppPropertySchema, eP as ApplicationLifecycleEventData, c7 as ApprovalStatus, ce as AppsPluginProvides, bK as AppsProperty, bi as AppsPropertySchema, a8 as ArrayResolver, dE as AuthEvent, by as AuthenticationIdProperty, b5 as AuthenticationIdPropertySchema, eX as BaseEvent, av as BaseSdkOptionsSchema, aj as BatchOptions, cM as CONTEXT_CACHE_MAX_SIZE, cL as CONTEXT_CACHE_TTL_MS, az as CORE_ERROR_SYMBOL, K as Choice, dL as ClientCredentialsObject, dW as ClientCredentialsObjectSchema, _ as Connection, e2 as ConnectionEntry, e1 as ConnectionEntrySchema, bw as ConnectionIdProperty, b4 as ConnectionIdPropertySchema, aS as ConnectionItem, bx as ConnectionProperty, b6 as ConnectionPropertySchema, e4 as ConnectionsMap, e3 as ConnectionsMapSchema, e6 as ConnectionsPluginProvides, bM as ConnectionsProperty, bk as ConnectionsPropertySchema, $ as ConnectionsResponse, aA as CoreErrorCode, cy as CreateClientCredentialsPluginProvides, ex as CreateTableFieldsPluginProvides, er as CreateTablePluginProvides, eF as CreateTableRecordsPluginProvides, dI as Credentials, d$ as CredentialsFunction, d_ as CredentialsFunctionSchema, dK as CredentialsObject, dY as CredentialsObjectSchema, e0 as CredentialsSchema, eb as DEFAULT_ACTION_TIMEOUT_MS, ek as DEFAULT_APPROVAL_TIMEOUT_MS, cV as DEFAULT_CONFIG_PATH, el as DEFAULT_MAX_APPROVAL_RETRIES, ea as DEFAULT_PAGE_SIZE, bD as DebugProperty, bb as DebugPropertySchema, cA as DeleteClientCredentialsPluginProvides, ez as DeleteTableFieldsPluginProvides, et as DeleteTablePluginProvides, eH as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, ab as DynamicListResolver, m as DynamicResolver, ac as DynamicSearchResolver, eQ as EnhancedErrorEventData, bS as ErrorOptions, dH as EventCallback, eO as EventContext, eL as EventEmissionConfig, E as EventEmissionContext, eN as EventEmissionProvides, ci as FetchPluginProvides, J as Field, bJ as FieldsProperty, bh as FieldsPropertySchema, ad as FieldsResolver, F as FieldsetItem, y as FindFirstAuthenticationPluginProvides, cI as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cK as FindUniqueConnectionPluginProvides, a6 as FormattedItem, au as FunctionDeprecation, at as FunctionRegistryEntry, cs as GetActionInputFieldsSchemaPluginProvides, cE as GetActionPluginProvides, cC as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cG as GetConnectionPluginProvides, cY as GetProfilePluginProvides, ep as GetTablePluginProvides, eB as GetTableRecordPluginProvides, aV as InfoFieldItem, aU as InputFieldItem, bv as InputFieldProperty, b3 as InputFieldPropertySchema, bz as InputsProperty, b7 as InputsPropertySchema, aQ as JsonSseMessage, bR as LeaseLimitProperty, bp as LeaseLimitPropertySchema, bP as LeaseProperty, bn as LeasePropertySchema, bQ as LeaseSecondsProperty, bo as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bA as LimitProperty, b8 as LimitPropertySchema, cq as ListActionInputFieldChoicesPluginProvides, co as ListActionInputFieldsPluginProvides, cm as ListActionsPluginProvides, ck as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cw as ListClientCredentialsPluginProvides, cu as ListConnectionsPluginProvides, ev as ListTableFieldsPluginProvides, eD as ListTableRecordsPluginProvides, en as ListTablesPluginProvides, dG as LoadingEvent, ee as MAX_CONCURRENCY_LIMIT, e9 as MAX_PAGE_LIMIT, b as Manifest, cW as ManifestEntry, cR as ManifestPluginOptions, cU as ManifestPluginProvides, eY as MethodCalledEvent, eR as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bB as OffsetProperty, b9 as OffsetPropertySchema, O as OutputFormatter, bC as OutputProperty, ba as OutputPropertySchema, aZ as PaginatedSdkFunction, i as PaginatedSdkResult, bE as ParamsProperty, bc as ParamsPropertySchema, dM as PkceCredentialsObject, dX as PkceCredentialsObjectSchema, aB as Plugin, a as PluginMeta, aC as PluginProvides, aL as PollOptions, k as PositionalMetadata, c5 as RateLimitInfo, bH as RecordProperty, bf as RecordPropertySchema, bI as RecordsProperty, bg as RecordsPropertySchema, ao as RelayFetchSchema, an as RelayRequestSchema, aK as RequestOptions, cQ as RequestPluginProvides, dr as ResolveAuthTokenOptions, dR as ResolveCredentialsOptions, R as ResolvedAppLocator, dJ as ResolvedCredentials, dZ as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aW as RootFieldItem, cO as RunActionPluginProvides, dD as SdkEvent, aY as SdkPage, aP as SseMessage, aa as StaticResolver, bG as TableProperty, be as TablePropertySchema, bL as TablesProperty, bj as TablesPropertySchema, bO as TriggerInboxNameProperty, bm as TriggerInboxNamePropertySchema, bN as TriggerInboxProperty, bl as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eJ as UpdateTableRecordsPluginProvides, a0 as UserProfile, aX as UserProfileItem, n as WatchTriggerInboxOptions, q as WithAddPlugin, e7 as ZAPIER_BASE_URL, eg as ZAPIER_MAX_CONCURRENT_REQUESTS, ec as ZAPIER_MAX_NETWORK_RETRIES, ed as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c3 as ZapierActionError, bY as ZapierApiError, bZ as ZapierAppNotFoundError, c8 as ZapierApprovalError, bW as ZapierAuthenticationError, c1 as ZapierBundleError, dz as ZapierCache, dA as ZapierCacheEntry, dB as ZapierCacheSetOptions, c0 as ZapierConfigurationError, c4 as ZapierConflictError, bT as ZapierError, l as ZapierFetchInitOptions, b_ as ZapierNotFoundError, c6 as ZapierRateLimitError, c9 as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, b$ as ZapierResourceNotFoundError, fa as ZapierSdk, p as ZapierSdkApps, Z as ZapierSdkOptions, cc as ZapierSignal, c2 as ZapierTimeoutError, bV as ZapierUnknownError, bU as ZapierValidationError, d2 as actionKeyResolver, d1 as actionTypeResolver, a5 as addPlugin, c_ as apiPlugin, d0 as appKeyResolver, cd as appsPlugin, d4 as authenticationIdGenericResolver, d3 as authenticationIdResolver, ai as batch, eS as buildApplicationLifecycleEvent, ak as buildCapabilityMessage, eU as buildErrorEvent, eT as buildErrorEventWithContext, eW as buildMethodCalledEvent, eK as cleanupEventListeners, ds as clearTokenCache, d8 as clientCredentialsNameResolver, d9 as clientIdResolver, aG as composePlugins, d4 as connectionIdGenericResolver, d3 as connectionIdResolver, e5 as connectionsPlugin, eV as createBaseEvent, cx as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dC as createMemoryCache, ar as createOptionsPlugin, aF as createPaginatedPluginMethod, aE as createPluginMethod, a3 as createPluginStack, aq as createSdk, ew as createTableFieldsPlugin, eq as createTablePlugin, eE as createTableRecordsPlugin, aM as createZapierApi, as as createZapierCoreStack, f8 as createZapierSdk, f9 as createZapierSdkStack, ap as createZapierSdkWithoutRegistry, aD as definePlugin, cz as deleteClientCredentialsPlugin, ey as deleteTableFieldsPlugin, es as deleteTablePlugin, eG as deleteTableRecordsPlugin, dd as durableRunIdResolver, eM as eventEmissionPlugin, ch as fetchPlugin, cH as findFirstConnectionPlugin, g as findManifestEntry, cJ as findUniqueConnectionPlugin, ca as formatErrorMessage, eZ as generateEventId, cr as getActionInputFieldsSchemaPlugin, cD as getActionPlugin, f7 as getAgent, cB as getAppPlugin, dU as getBaseUrlFromCredentials, f3 as getCiPlatform, dV as getClientIdFromCredentials, cF as getConnectionPlugin, ay as getCoreErrorCause, ax as getCoreErrorCode, f5 as getCpuTime, e_ as getCurrentTimestamp, f4 as getMemoryUsage, aN as getOrCreateApiClient, f0 as getOsInfo, f1 as getPlatformVersions, cS as getPreferredManifestEntryKey, cX as getProfilePlugin, e$ as getReleaseId, eo as getTablePlugin, eA as getTableRecordPlugin, dw as getTokenFromCliLogin, f6 as getTtyContext, eh as getZapierApprovalMode, ej as getZapierDefaultApprovalMode, ei as getZapierOpenAutoModeApprovalsInBrowser, e8 as getZapierSdkService, du as injectCliLogin, d7 as inputFieldKeyResolver, d6 as inputsAllOptionalResolver, d5 as inputsResolver, dt as invalidateCachedToken, dy as invalidateCredentialsToken, f2 as isCi, dv as isCliLoginAvailable, dN as isClientCredentials, aw as isCoreError, dQ as isCredentialsFunction, dP as isCredentialsObject, aO as isPermanentHttpError, dO as isPkceCredentials, a1 as isPositional, cp as listActionInputFieldChoicesPlugin, cn as listActionInputFieldsPlugin, cl as listActionsPlugin, cj as listAppsPlugin, cv as listClientCredentialsPlugin, ct as listConnectionsPlugin, eu as listTableFieldsPlugin, eC as listTableRecordsPlugin, em as listTablesPlugin, al as logDeprecation, cT as manifestPlugin, ef as parseConcurrencyEnvVar, r as readManifestFromFile, aJ as registryPlugin, cP as requestPlugin, am as resetDeprecationWarnings, dx as resolveAuthToken, dT as resolveCredentials, dS as resolveCredentialsFromEnv, cN as runActionPlugin, ae as runInMethodScope, af as runWithTelemetryContext, dj as tableFieldIdsResolver, dl as tableFieldsResolver, dp as tableFiltersResolver, da as tableIdResolver, dk as tableNameResolver, dh as tableRecordIdResolver, di as tableRecordIdsResolver, dm as tableRecordsResolver, dq as tableSortResolver, dn as tableUpdateRecordsResolver, ag as toSnakeCase, ah as toTitleCase, db as triggerInboxResolver, dg as triggerMessagesResolver, eI as updateTableRecordsPlugin, dc as workflowIdResolver, df as workflowRunIdResolver, de as workflowVersionIdResolver, bX as zapierAdaptError } from './index-D1O7Pcex.mjs';
|
|
1
|
+
export { H as Action, f as ActionEntry, ci as ActionExecutionOptions, Q as ActionExecutionResult, S as ActionField, V as ActionFieldChoice, aW as ActionItem, bw as ActionKeyProperty, b4 as ActionKeyPropertySchema, bx as ActionProperty, b5 as ActionPropertySchema, aK as ActionResolverItem, bI as ActionTimeoutMsProperty, bg as ActionTimeoutMsPropertySchema, aL as ActionTypeItem, bv as ActionTypeProperty, b3 as ActionTypePropertySchema, d as AddActionEntryOptions, e as AddActionEntryResult, A as ApiClient, ce as ApiError, dI as ApiEvent, d0 as ApiPluginOptions, d2 as ApiPluginProvides, I as App, cj as AppFactoryInput, aU as AppItem, bt as AppKeyProperty, b1 as AppKeyPropertySchema, bu as AppProperty, b2 as AppPropertySchema, eS as ApplicationLifecycleEventData, ca as ApprovalStatus, ch as AppsPluginProvides, bN as AppsProperty, bl as AppsPropertySchema, a8 as ArrayResolver, dH as AuthEvent, bB as AuthenticationIdProperty, b8 as AuthenticationIdPropertySchema, e_ as BaseEvent, ay as BaseSdkOptionsSchema, am as BatchOptions, cP as CONTEXT_CACHE_MAX_SIZE, cO as CONTEXT_CACHE_TTL_MS, aC as CORE_ERROR_SYMBOL, ai as CallerContext, K as Choice, dO as ClientCredentialsObject, dZ as ClientCredentialsObjectSchema, _ as Connection, e5 as ConnectionEntry, e4 as ConnectionEntrySchema, bz as ConnectionIdProperty, b7 as ConnectionIdPropertySchema, aV as ConnectionItem, bA as ConnectionProperty, b9 as ConnectionPropertySchema, e7 as ConnectionsMap, e6 as ConnectionsMapSchema, e9 as ConnectionsPluginProvides, bP as ConnectionsProperty, bn as ConnectionsPropertySchema, $ as ConnectionsResponse, aD as CoreErrorCode, cB as CreateClientCredentialsPluginProvides, eA as CreateTableFieldsPluginProvides, eu as CreateTablePluginProvides, eI as CreateTableRecordsPluginProvides, dL as Credentials, e2 as CredentialsFunction, e1 as CredentialsFunctionSchema, dN as CredentialsObject, d$ as CredentialsObjectSchema, e3 as CredentialsSchema, ee as DEFAULT_ACTION_TIMEOUT_MS, en as DEFAULT_APPROVAL_TIMEOUT_MS, cY as DEFAULT_CONFIG_PATH, eo as DEFAULT_MAX_APPROVAL_RETRIES, ed as DEFAULT_PAGE_SIZE, bG as DebugProperty, be as DebugPropertySchema, cD as DeleteClientCredentialsPluginProvides, eC as DeleteTableFieldsPluginProvides, ew as DeleteTablePluginProvides, eK as DeleteTableRecordsPluginProvides, u as DrainTriggerInboxCallback, v as DrainTriggerInboxErrorObserver, D as DrainTriggerInboxOptions, ab as DynamicListResolver, m as DynamicResolver, ac as DynamicSearchResolver, eT as EnhancedErrorEventData, bV as ErrorOptions, dK as EventCallback, eR as EventContext, eO as EventEmissionConfig, E as EventEmissionContext, eQ as EventEmissionProvides, cl as FetchPluginProvides, J as Field, bM as FieldsProperty, bk as FieldsPropertySchema, ad as FieldsResolver, F as FieldsetItem, y as FindFirstAuthenticationPluginProvides, cL as FindFirstConnectionPluginProvides, z as FindUniqueAuthenticationPluginProvides, cN as FindUniqueConnectionPluginProvides, a6 as FormattedItem, ax as FunctionDeprecation, aw as FunctionRegistryEntry, cv as GetActionInputFieldsSchemaPluginProvides, cH as GetActionPluginProvides, cF as GetAppPluginProvides, x as GetAuthenticationPluginProvides, cJ as GetConnectionPluginProvides, c$ as GetProfilePluginProvides, es as GetTablePluginProvides, eE as GetTableRecordPluginProvides, aY as InfoFieldItem, aX as InputFieldItem, by as InputFieldProperty, b6 as InputFieldPropertySchema, bC as InputsProperty, ba as InputsPropertySchema, aT as JsonSseMessage, bU as LeaseLimitProperty, bs as LeaseLimitPropertySchema, bS as LeaseProperty, bq as LeasePropertySchema, bT as LeaseSecondsProperty, br as LeaseSecondsPropertySchema, L as LeasedTriggerMessageItem, bD as LimitProperty, bb as LimitPropertySchema, ct as ListActionInputFieldChoicesPluginProvides, cr as ListActionInputFieldsPluginProvides, cp as ListActionsPluginProvides, cn as ListAppsPluginProvides, w as ListAuthenticationsPluginProvides, cz as ListClientCredentialsPluginProvides, cx as ListConnectionsPluginProvides, ey as ListTableFieldsPluginProvides, eG as ListTableRecordsPluginProvides, eq as ListTablesPluginProvides, dJ as LoadingEvent, eh as MAX_CONCURRENCY_LIMIT, ec as MAX_PAGE_LIMIT, b as Manifest, cZ as ManifestEntry, cU as ManifestPluginOptions, cX as ManifestPluginProvides, e$ as MethodCalledEvent, eU as MethodCalledEventData, N as Need, X as NeedsRequest, Y as NeedsResponse, bE as OffsetProperty, bc as OffsetPropertySchema, O as OutputFormatter, bF as OutputProperty, bd as OutputPropertySchema, b0 as PaginatedSdkFunction, i as PaginatedSdkResult, bH as ParamsProperty, bf as ParamsPropertySchema, dP as PkceCredentialsObject, d_ as PkceCredentialsObjectSchema, aE as Plugin, a as PluginMeta, aF as PluginProvides, aO as PollOptions, k as PositionalMetadata, c8 as RateLimitInfo, bK as RecordProperty, bi as RecordPropertySchema, bL as RecordsProperty, bj as RecordsPropertySchema, ar as RelayFetchSchema, aq as RelayRequestSchema, aN as RequestOptions, cT as RequestPluginProvides, du as ResolveAuthTokenOptions, dU as ResolveCredentialsOptions, R as ResolvedAppLocator, dM as ResolvedCredentials, e0 as ResolvedCredentialsSchema, a7 as Resolver, a9 as ResolverMetadata, aZ as RootFieldItem, cR as RunActionPluginProvides, dG as SdkEvent, a$ as SdkPage, aS as SseMessage, aa as StaticResolver, bJ as TableProperty, bh as TablePropertySchema, bO as TablesProperty, bm as TablesPropertySchema, bR as TriggerInboxNameProperty, bp as TriggerInboxNamePropertySchema, bQ as TriggerInboxProperty, bo as TriggerInboxPropertySchema, T as TriggerMessageStatus, U as UpdateManifestEntryOptions, c as UpdateManifestEntryResult, eM as UpdateTableRecordsPluginProvides, a0 as UserProfile, a_ as UserProfileItem, n as WatchTriggerInboxOptions, q as WithAddPlugin, ea as ZAPIER_BASE_URL, ej as ZAPIER_MAX_CONCURRENT_REQUESTS, ef as ZAPIER_MAX_NETWORK_RETRIES, eg as ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, s as ZapierAbortDrainSignal, c6 as ZapierActionError, b$ as ZapierApiError, c0 as ZapierAppNotFoundError, cb as ZapierApprovalError, bZ as ZapierAuthenticationError, c4 as ZapierBundleError, dC as ZapierCache, dD as ZapierCacheEntry, dE as ZapierCacheSetOptions, c3 as ZapierConfigurationError, c7 as ZapierConflictError, bW as ZapierError, l as ZapierFetchInitOptions, c1 as ZapierNotFoundError, c9 as ZapierRateLimitError, cc as ZapierRelayError, t as ZapierReleaseTriggerMessageSignal, c2 as ZapierResourceNotFoundError, fd as ZapierSdk, p as ZapierSdkApps, Z as ZapierSdkOptions, cf as ZapierSignal, c5 as ZapierTimeoutError, bY as ZapierUnknownError, bX as ZapierValidationError, d5 as actionKeyResolver, d4 as actionTypeResolver, a5 as addPlugin, d1 as apiPlugin, d3 as appKeyResolver, cg as appsPlugin, d7 as authenticationIdGenericResolver, d6 as authenticationIdResolver, al as batch, eV as buildApplicationLifecycleEvent, an as buildCapabilityMessage, eX as buildErrorEvent, eW as buildErrorEventWithContext, eZ as buildMethodCalledEvent, eN as cleanupEventListeners, dv as clearTokenCache, db as clientCredentialsNameResolver, dc as clientIdResolver, aJ as composePlugins, d7 as connectionIdGenericResolver, d6 as connectionIdResolver, e8 as connectionsPlugin, eY as createBaseEvent, cA as createClientCredentialsPlugin, a4 as createCorePlugin, a2 as createFunction, dF as createMemoryCache, au as createOptionsPlugin, aI as createPaginatedPluginMethod, aH as createPluginMethod, a3 as createPluginStack, at as createSdk, ez as createTableFieldsPlugin, et as createTablePlugin, eH as createTableRecordsPlugin, aP as createZapierApi, av as createZapierCoreStack, fb as createZapierSdk, fc as createZapierSdkStack, as as createZapierSdkWithoutRegistry, aG as definePlugin, cC as deleteClientCredentialsPlugin, eB as deleteTableFieldsPlugin, ev as deleteTablePlugin, eJ as deleteTableRecordsPlugin, dg as durableRunIdResolver, eP as eventEmissionPlugin, ck as fetchPlugin, cK as findFirstConnectionPlugin, g as findManifestEntry, cM as findUniqueConnectionPlugin, cd as formatErrorMessage, f0 as generateEventId, cu as getActionInputFieldsSchemaPlugin, cG as getActionPlugin, fa as getAgent, cE as getAppPlugin, dX as getBaseUrlFromCredentials, ag as getCallerContext, f6 as getCiPlatform, dY as getClientIdFromCredentials, cI as getConnectionPlugin, aB as getCoreErrorCause, aA as getCoreErrorCode, f8 as getCpuTime, f1 as getCurrentTimestamp, f7 as getMemoryUsage, aQ as getOrCreateApiClient, f3 as getOsInfo, f4 as getPlatformVersions, cV as getPreferredManifestEntryKey, c_ as getProfilePlugin, f2 as getReleaseId, er as getTablePlugin, eD as getTableRecordPlugin, dz as getTokenFromCliLogin, f9 as getTtyContext, ek as getZapierApprovalMode, em as getZapierDefaultApprovalMode, el as getZapierOpenAutoModeApprovalsInBrowser, eb as getZapierSdkService, dx as injectCliLogin, da as inputFieldKeyResolver, d9 as inputsAllOptionalResolver, d8 as inputsResolver, dw as invalidateCachedToken, dB as invalidateCredentialsToken, f5 as isCi, dy as isCliLoginAvailable, dQ as isClientCredentials, az as isCoreError, dT as isCredentialsFunction, dS as isCredentialsObject, aR as isPermanentHttpError, dR as isPkceCredentials, a1 as isPositional, cs as listActionInputFieldChoicesPlugin, cq as listActionInputFieldsPlugin, co as listActionsPlugin, cm as listAppsPlugin, cy as listClientCredentialsPlugin, cw as listConnectionsPlugin, ex as listTableFieldsPlugin, eF as listTableRecordsPlugin, ep as listTablesPlugin, ao as logDeprecation, cW as manifestPlugin, ei as parseConcurrencyEnvVar, r as readManifestFromFile, aM as registryPlugin, cS as requestPlugin, ap as resetDeprecationWarnings, dA as resolveAuthToken, dW as resolveCredentials, dV as resolveCredentialsFromEnv, cQ as runActionPlugin, ae as runInMethodScope, ah as runWithCallerContext, af as runWithTelemetryContext, dm as tableFieldIdsResolver, dp as tableFieldsResolver, ds as tableFiltersResolver, dd as tableIdResolver, dn as tableNameResolver, dk as tableRecordIdResolver, dl as tableRecordIdsResolver, dq as tableRecordsResolver, dt as tableSortResolver, dr as tableUpdateRecordsResolver, aj as toSnakeCase, ak as toTitleCase, de as triggerInboxResolver, dj as triggerMessagesResolver, eL as updateTableRecordsPlugin, df as workflowIdResolver, di as workflowRunIdResolver, dh as workflowVersionIdResolver, b_ as zapierAdaptError } from './index-WMit6fkJ.mjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'zod/v4/core';
|
|
4
4
|
import '@zapier/zapier-sdk-core/v0/schemas/connections';
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { createFunction } from "kitcore";
|
|
|
34
34
|
export { createPluginStack, createCorePlugin, addPlugin } from "kitcore";
|
|
35
35
|
export type { FormattedItem, OutputFormatter, Resolver, ArrayResolver, ResolverMetadata, StaticResolver, DynamicResolver, DynamicListResolver, DynamicSearchResolver, FieldsResolver, } from "kitcore";
|
|
36
36
|
export { runInMethodScope, runWithTelemetryContext } from "kitcore";
|
|
37
|
+
export { getCallerContext, runWithCallerContext, type CallerContext, } from "./utils/caller-context";
|
|
37
38
|
export { toSnakeCase, toTitleCase } from "kitcore";
|
|
38
39
|
export { batch } from "./utils/batch-utils";
|
|
39
40
|
export type { BatchOptions } from "./utils/batch-utils";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,iBAAiB,CAAC;AAChC,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACV,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,sCAAsC,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKzC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EACV,aAAa,EACb,eAAe,EACf,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,GACf,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;
|
|
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,iBAAiB,CAAC;AAChC,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACV,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,sCAAsC,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,MAAM,EACN,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKzC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EACV,aAAa,EACb,eAAe,EACf,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,GACf,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,aAAa,GACnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAGvB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,cAAc,aAAa,CAAC;AAI5B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AAGpD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,8BAA8B,EAC9B,SAAS,EACT,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AASnD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAC3B,cAAc,GACf,MAAM,SAAS,CAAC;AAKjB,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;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGxD,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export { createPluginStack, createCorePlugin, addPlugin } from "kitcore";
|
|
|
36
36
|
// Export method-scope utilities for CLI; `runWithTelemetryContext` is kept
|
|
37
37
|
// as a back-compat alias for the previous name.
|
|
38
38
|
export { runInMethodScope, runWithTelemetryContext } from "kitcore";
|
|
39
|
+
export { getCallerContext, runWithCallerContext, } from "./utils/caller-context";
|
|
39
40
|
// Export string utilities
|
|
40
41
|
export { toSnakeCase, toTitleCase } from "kitcore";
|
|
41
42
|
// Export batch utilities
|
package/dist/index.mjs
CHANGED
|
@@ -473,22 +473,34 @@ function createValidator(schema, { adaptError } = {}) {
|
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
475
|
var validateOptions = (schema, options, { adaptError } = {}) => parseOrThrow(schema, options, { adaptError });
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
476
|
+
function createAsyncContext() {
|
|
477
|
+
let store = null;
|
|
478
|
+
try {
|
|
479
|
+
store = new AsyncLocalStorage();
|
|
480
|
+
} catch {
|
|
481
|
+
store = null;
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
available: store !== null,
|
|
485
|
+
run(value, fn) {
|
|
486
|
+
return store ? store.run(value, fn) : fn();
|
|
487
|
+
},
|
|
488
|
+
get() {
|
|
489
|
+
return store?.getStore();
|
|
490
|
+
}
|
|
491
|
+
};
|
|
480
492
|
}
|
|
493
|
+
var scope = createAsyncContext();
|
|
481
494
|
function getCurrentScope() {
|
|
482
|
-
|
|
483
|
-
return scopeStore.getStore();
|
|
495
|
+
return scope.get();
|
|
484
496
|
}
|
|
485
497
|
function getCurrentDepth() {
|
|
486
498
|
return getCurrentScope()?.depth ?? 0;
|
|
487
499
|
}
|
|
488
500
|
function runInMethodScope(fn) {
|
|
489
|
-
if (!
|
|
490
|
-
const currentDepth =
|
|
491
|
-
return
|
|
501
|
+
if (!scope.available) return fn();
|
|
502
|
+
const currentDepth = scope.get()?.depth ?? -1;
|
|
503
|
+
return scope.run({ depth: currentDepth + 1 }, fn);
|
|
492
504
|
}
|
|
493
505
|
var runWithTelemetryContext = runInMethodScope;
|
|
494
506
|
function normalizeError(error, adaptError) {
|
|
@@ -3605,10 +3617,10 @@ var tableSortResolver = {
|
|
|
3605
3617
|
// src/plugins/eventEmission/method-metadata.ts
|
|
3606
3618
|
var SCOPE_KEY = "methodMetadata";
|
|
3607
3619
|
function setMethodMetadata(metadata) {
|
|
3608
|
-
const
|
|
3609
|
-
if (!
|
|
3610
|
-
const existing =
|
|
3611
|
-
|
|
3620
|
+
const scope2 = getCurrentScope();
|
|
3621
|
+
if (!scope2) return;
|
|
3622
|
+
const existing = scope2[SCOPE_KEY];
|
|
3623
|
+
scope2[SCOPE_KEY] = { ...existing, ...metadata };
|
|
3612
3624
|
}
|
|
3613
3625
|
function getMethodMetadata() {
|
|
3614
3626
|
return getCurrentScope()?.[SCOPE_KEY];
|
|
@@ -6459,10 +6471,10 @@ function mergeScopes(credentialsScope, requiredScopes) {
|
|
|
6459
6471
|
return [...scopeSet].sort();
|
|
6460
6472
|
}
|
|
6461
6473
|
async function exchangeClientCredentials(options) {
|
|
6462
|
-
const { clientId, clientSecret, baseUrl, scope, requiredScopes, onEvent } = options;
|
|
6474
|
+
const { clientId, clientSecret, baseUrl, scope: scope2, requiredScopes, onEvent } = options;
|
|
6463
6475
|
const fetchFn = options.fetch || globalThis.fetch;
|
|
6464
6476
|
const tokenUrl = getTokenEndpointUrl(baseUrl);
|
|
6465
|
-
const mergedScopes = mergeScopes(
|
|
6477
|
+
const mergedScopes = mergeScopes(scope2, requiredScopes);
|
|
6466
6478
|
const scopeString = mergedScopes.join(" ");
|
|
6467
6479
|
onEvent?.({
|
|
6468
6480
|
type: "auth_exchanging",
|
|
@@ -6727,6 +6739,25 @@ async function invalidateCredentialsToken(options) {
|
|
|
6727
6739
|
}
|
|
6728
6740
|
}
|
|
6729
6741
|
|
|
6742
|
+
// src/utils/caller-context.ts
|
|
6743
|
+
var callerContext = createAsyncContext();
|
|
6744
|
+
function runWithCallerContext(context, fn) {
|
|
6745
|
+
let parent;
|
|
6746
|
+
try {
|
|
6747
|
+
parent = callerContext.get() ?? {};
|
|
6748
|
+
} catch {
|
|
6749
|
+
return fn();
|
|
6750
|
+
}
|
|
6751
|
+
return callerContext.run({ ...parent, ...context }, fn);
|
|
6752
|
+
}
|
|
6753
|
+
function getCallerContext() {
|
|
6754
|
+
try {
|
|
6755
|
+
return callerContext.get() ?? {};
|
|
6756
|
+
} catch {
|
|
6757
|
+
return {};
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
|
|
6730
6761
|
// src/api/sse-parser.ts
|
|
6731
6762
|
async function* jsonFrames(source) {
|
|
6732
6763
|
for await (const { data } of source) {
|
|
@@ -6878,7 +6909,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6878
6909
|
}
|
|
6879
6910
|
|
|
6880
6911
|
// src/sdk-version.ts
|
|
6881
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6912
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.74.0" : void 0) || "unknown";
|
|
6882
6913
|
|
|
6883
6914
|
// src/utils/open-url.ts
|
|
6884
6915
|
var nodePrefix = "node:";
|
|
@@ -7602,6 +7633,10 @@ var ZapierApiClient = class {
|
|
|
7602
7633
|
headers.set("x-zapier-sdk-package", callerPackage.name);
|
|
7603
7634
|
headers.set("zapier-sdk-package-version", callerPackage.version);
|
|
7604
7635
|
headers.set("x-zapier-sdk-package-version", callerPackage.version);
|
|
7636
|
+
const { packageOperation } = getCallerContext();
|
|
7637
|
+
if (packageOperation) {
|
|
7638
|
+
headers.set("zapier-sdk-package-operation", packageOperation);
|
|
7639
|
+
}
|
|
7605
7640
|
}
|
|
7606
7641
|
}
|
|
7607
7642
|
// Helper to perform HTTP requests with JSON handling
|
|
@@ -10276,4 +10311,4 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
10276
10311
|
return {};
|
|
10277
10312
|
});
|
|
10278
10313
|
|
|
10279
|
-
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
|
|
10314
|
+
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, definePlugin, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError };
|
|
@@ -56,21 +56,60 @@ export declare const publishWorkflowVersionPlugin: (sdk: {
|
|
|
56
56
|
};
|
|
57
57
|
}) => {
|
|
58
58
|
publishWorkflowVersion: (options?: {
|
|
59
|
+
workflow: string;
|
|
60
|
+
sourceFiles: Record<string, string>;
|
|
61
|
+
dependencies?: Record<string, string> | undefined;
|
|
62
|
+
zapierDurableVersion?: string | undefined;
|
|
63
|
+
zapier_durable_version?: string | undefined;
|
|
64
|
+
enabled?: boolean | undefined;
|
|
65
|
+
connections?: Record<string, {
|
|
66
|
+
connectionId?: string | number | undefined;
|
|
67
|
+
connection_id?: string | number | undefined;
|
|
68
|
+
}> | null | undefined;
|
|
69
|
+
appVersions?: Record<string, {
|
|
70
|
+
implementationName?: string | undefined;
|
|
71
|
+
implementation_name?: string | undefined;
|
|
72
|
+
version?: string | undefined;
|
|
73
|
+
}> | null | undefined;
|
|
74
|
+
app_versions?: Record<string, {
|
|
75
|
+
implementationName?: string | undefined;
|
|
76
|
+
implementation_name?: string | undefined;
|
|
77
|
+
version?: string | undefined;
|
|
78
|
+
}> | null | undefined;
|
|
79
|
+
trigger?: {
|
|
80
|
+
action: string;
|
|
81
|
+
selectedApi?: string | undefined;
|
|
82
|
+
selected_api?: string | undefined;
|
|
83
|
+
authenticationId?: string | null | undefined;
|
|
84
|
+
authentication_id?: string | null | undefined;
|
|
85
|
+
params?: Record<string, unknown> | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
} | {
|
|
59
88
|
workflow: string;
|
|
60
89
|
source_files: Record<string, string>;
|
|
61
90
|
dependencies?: Record<string, string> | undefined;
|
|
91
|
+
zapierDurableVersion?: string | undefined;
|
|
62
92
|
zapier_durable_version?: string | undefined;
|
|
63
93
|
enabled?: boolean | undefined;
|
|
64
94
|
connections?: Record<string, {
|
|
65
|
-
|
|
95
|
+
connectionId?: string | number | undefined;
|
|
96
|
+
connection_id?: string | number | undefined;
|
|
97
|
+
}> | null | undefined;
|
|
98
|
+
appVersions?: Record<string, {
|
|
99
|
+
implementationName?: string | undefined;
|
|
100
|
+
implementation_name?: string | undefined;
|
|
101
|
+
version?: string | undefined;
|
|
66
102
|
}> | null | undefined;
|
|
67
103
|
app_versions?: Record<string, {
|
|
68
|
-
|
|
104
|
+
implementationName?: string | undefined;
|
|
105
|
+
implementation_name?: string | undefined;
|
|
69
106
|
version?: string | undefined;
|
|
70
107
|
}> | null | undefined;
|
|
71
108
|
trigger?: {
|
|
72
|
-
selected_api: string;
|
|
73
109
|
action: string;
|
|
110
|
+
selectedApi?: string | undefined;
|
|
111
|
+
selected_api?: string | undefined;
|
|
112
|
+
authenticationId?: string | null | undefined;
|
|
74
113
|
authentication_id?: string | null | undefined;
|
|
75
114
|
params?: Record<string, unknown> | undefined;
|
|
76
115
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DxC,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,4BAA4B,CACpC,CAAC"}
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { definePlugin, createPluginMethod } from "kitcore";
|
|
2
|
+
import { ZapierValidationError } from "../../../types/errors";
|
|
2
3
|
import { workflowIdResolver } from "../../../resolvers/workflowId";
|
|
3
|
-
import { codeSubstrateDefaults } from "../shared";
|
|
4
|
+
import { codeSubstrateDefaults, toWireConnections, toWireAppVersions, } from "../shared";
|
|
4
5
|
import { PublishWorkflowVersionOptionsSchema, PublishWorkflowVersionResponseSchema, } from "./schemas";
|
|
6
|
+
/**
|
|
7
|
+
* Reshape the trigger config onto the wire body. `selectedApi` is the
|
|
8
|
+
* camelCase locator (with a deprecated snake_case alias) and is required
|
|
9
|
+
* when a trigger is configured, so a missing one is a client-side
|
|
10
|
+
* validation error.
|
|
11
|
+
*/
|
|
12
|
+
function toWireTrigger(trigger) {
|
|
13
|
+
const selectedApi = trigger.selectedApi ?? trigger.selected_api;
|
|
14
|
+
if (selectedApi === undefined) {
|
|
15
|
+
throw new ZapierValidationError("trigger is missing selectedApi");
|
|
16
|
+
}
|
|
17
|
+
const wire = {
|
|
18
|
+
selected_api: selectedApi,
|
|
19
|
+
action: trigger.action,
|
|
20
|
+
};
|
|
21
|
+
// Read with `in` so an explicit `null` (a no-auth trigger) is forwarded
|
|
22
|
+
// rather than collapsed into "omitted" by `??`.
|
|
23
|
+
if ("authenticationId" in trigger) {
|
|
24
|
+
wire.authentication_id = trigger.authenticationId;
|
|
25
|
+
}
|
|
26
|
+
else if ("authentication_id" in trigger) {
|
|
27
|
+
wire.authentication_id = trigger.authentication_id;
|
|
28
|
+
}
|
|
29
|
+
if (trigger.params !== undefined) {
|
|
30
|
+
wire.params = trigger.params;
|
|
31
|
+
}
|
|
32
|
+
return wire;
|
|
33
|
+
}
|
|
5
34
|
export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
35
|
...codeSubstrateDefaults,
|
|
7
36
|
name: "publishWorkflowVersion",
|
|
@@ -11,26 +40,35 @@ export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMe
|
|
|
11
40
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
12
41
|
resolvers: { workflow: workflowIdResolver },
|
|
13
42
|
handler: async ({ sdk, options }) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
43
|
+
const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
|
|
44
|
+
const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
|
|
45
|
+
// Read with `in` rather than `??` so an explicit `null` (clear the
|
|
46
|
+
// binding) survives and isn't collapsed into the deprecated alias.
|
|
47
|
+
const appVersions = "appVersions" in options ? options.appVersions : options.app_versions;
|
|
48
|
+
const body = { source_files: sourceFiles };
|
|
17
49
|
if (options.dependencies !== undefined) {
|
|
18
50
|
body.dependencies = options.dependencies;
|
|
19
51
|
}
|
|
20
|
-
if (
|
|
21
|
-
body.zapier_durable_version =
|
|
52
|
+
if (zapierDurableVersion !== undefined) {
|
|
53
|
+
body.zapier_durable_version = zapierDurableVersion;
|
|
22
54
|
}
|
|
23
55
|
if (options.enabled !== undefined) {
|
|
24
56
|
body.enabled = options.enabled;
|
|
25
57
|
}
|
|
26
|
-
if (options.connections
|
|
27
|
-
body.connections =
|
|
58
|
+
if (options.connections === null) {
|
|
59
|
+
body.connections = null;
|
|
28
60
|
}
|
|
29
|
-
if (options.
|
|
30
|
-
body.
|
|
61
|
+
else if (options.connections !== undefined) {
|
|
62
|
+
body.connections = toWireConnections(options.connections);
|
|
63
|
+
}
|
|
64
|
+
if (appVersions === null) {
|
|
65
|
+
body.app_versions = null;
|
|
66
|
+
}
|
|
67
|
+
else if (appVersions !== undefined) {
|
|
68
|
+
body.app_versions = toWireAppVersions(appVersions);
|
|
31
69
|
}
|
|
32
70
|
if (options.trigger !== undefined) {
|
|
33
|
-
body.trigger = options.trigger;
|
|
71
|
+
body.trigger = toWireTrigger(options.trigger);
|
|
34
72
|
}
|
|
35
73
|
const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, body, {
|
|
36
74
|
authRequired: true,
|