@zapier/zapier-sdk 0.113.0 → 0.114.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2818,7 +2818,7 @@ function logRouteOverride({
2818
2818
  }
2819
2819
 
2820
2820
  // src/sdk-version.ts
2821
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.113.0" : void 0) || "unknown";
2821
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.114.1" : void 0) || "unknown";
2822
2822
 
2823
2823
  // src/utils/open-url.ts
2824
2824
  var nodePrefix = "node:";
@@ -5429,7 +5429,7 @@ var actionKeyResolver = defineResolver({
5429
5429
  const page = await imports.listActions({ app: input.app, cursor });
5430
5430
  return {
5431
5431
  data: page.data.filter(
5432
- (action) => action.action_type === input.actionType && !action.is_hidden
5432
+ (action) => action.action_type === input.actionType
5433
5433
  ),
5434
5434
  nextCursor: page.nextCursor
5435
5435
  };
@@ -6942,6 +6942,45 @@ var actionItemFormatter = defineFormatter({
6942
6942
  format: ({ item }) => formatActionItem(item)
6943
6943
  });
6944
6944
 
6945
+ // src/plugins/listActions/fetch.ts
6946
+ async function fetchAppActions({
6947
+ imports,
6948
+ app
6949
+ }) {
6950
+ const selectedApi = await imports.manifest.getVersionedImplementationId(app);
6951
+ if (!selectedApi) {
6952
+ throw new ZapierConfigurationError(
6953
+ "No current_implementation_id found for app",
6954
+ { configType: "current_implementation_id" }
6955
+ );
6956
+ }
6957
+ const data = await imports.api.get(
6958
+ "/zapier/api/v4/implementations/",
6959
+ {
6960
+ searchParams: {
6961
+ global: "true",
6962
+ // Include private/unlisted implementations the caller has access to.
6963
+ // With public_only the API drops actions on private apps, so they
6964
+ // surface as "unknown action" downstream (COSUB-562).
6965
+ public_only: "false",
6966
+ selected_apis: selectedApi
6967
+ }
6968
+ }
6969
+ );
6970
+ const actions = [];
6971
+ for (const implementation of data.results || []) {
6972
+ for (const action of implementation.actions ?? []) {
6973
+ actions.push(
6974
+ normalizeActionItem({
6975
+ ...action,
6976
+ selected_api: action.selected_api || implementation.selected_api
6977
+ })
6978
+ );
6979
+ }
6980
+ }
6981
+ return { selectedApi, actions };
6982
+ }
6983
+
6945
6984
  // src/plugins/listActions/index.ts
6946
6985
  var listActionsPlugin = defineMethod({
6947
6986
  name: "listActions",
@@ -6961,56 +7000,26 @@ var listActionsPlugin = defineMethod({
6961
7000
  // the resolver.
6962
7001
  resolvers: { app: appKeyResolver },
6963
7002
  run: async ({ imports, input, annotate }) => {
6964
- const api = imports.api;
6965
- const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
6966
7003
  const appKey = "app" in input ? input.app : input.appKey;
6967
- const selectedApi = await getVersionedImplementationId(appKey);
6968
- if (!selectedApi) {
6969
- throw new ZapierConfigurationError(
6970
- "No current_implementation_id found for app",
6971
- { configType: "current_implementation_id" }
6972
- );
6973
- }
7004
+ const { selectedApi, actions } = await fetchAppActions({
7005
+ imports,
7006
+ app: appKey
7007
+ });
6974
7008
  annotate({ selectedApi });
6975
- const data = await api.get(
6976
- "/zapier/api/v4/implementations/",
6977
- {
6978
- searchParams: {
6979
- global: "true",
6980
- // Include private/unlisted implementations the caller has access to.
6981
- // With public_only the API drops actions on private apps, so they
6982
- // surface as "unknown action" downstream (COSUB-562).
6983
- public_only: "false",
6984
- selected_apis: selectedApi
6985
- }
6986
- }
6987
- );
6988
- let allActions = [];
6989
- for (const implementation of data.results || []) {
6990
- if (implementation.actions) {
6991
- for (const action of implementation.actions) {
6992
- allActions.push(
6993
- normalizeActionItem({
6994
- ...action,
6995
- selected_api: action.selected_api || implementation.selected_api
6996
- })
6997
- );
6998
- }
6999
- }
7000
- }
7001
- if (input.actionType) {
7002
- allActions = allActions.filter(
7003
- (action) => action.action_type === input.actionType
7004
- );
7005
- }
7006
- return { data: allActions };
7009
+ return {
7010
+ data: actions.filter(
7011
+ (action) => !action.is_hidden && (!input.actionType || action.action_type === input.actionType)
7012
+ )
7013
+ };
7007
7014
  }
7008
7015
  });
7009
7016
 
7010
7017
  // src/plugins/getAction/index.ts
7011
7018
  var getActionPlugin = defineMethod({
7012
7019
  name: "getAction",
7013
- imports: [listActionsPlugin],
7020
+ // `listActionsPlugin` is here for the action-type and action-key resolvers,
7021
+ // which reach it through a stand-in; the lookup itself doesn't use it.
7022
+ imports: [listActionsPlugin, manifestPluginRef, apiPluginRef],
7014
7023
  categories: ["action"],
7015
7024
  itemType: "Action",
7016
7025
  inputSchema: GetActionInputSchema,
@@ -7027,11 +7036,11 @@ var getActionPlugin = defineMethod({
7027
7036
  const appKey = "app" in input ? input.app : input.appKey;
7028
7037
  const actionKey = "action" in input ? input.action : input.actionKey;
7029
7038
  const { actionType } = input;
7030
- for await (const action of imports.listActions({ app: appKey }).items()) {
7031
- if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
7032
- return { data: action };
7033
- }
7034
- }
7039
+ const { actions } = await fetchAppActions({ imports, app: appKey });
7040
+ const action = actions.find(
7041
+ (candidate) => (candidate.key === actionKey || candidate.id === actionKey) && candidate.action_type === actionType
7042
+ );
7043
+ if (action) return { data: action };
7035
7044
  throw new ZapierResourceNotFoundError(
7036
7045
  `Action not found: ${actionKey} with type ${actionType}`,
7037
7046
  { resourceType: "Action", resourceId: `${actionKey} (${actionType})` }