@opengeni/api-router 3.0.1-canary.2 → 3.0.1-canary.3

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/dist/app.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  withDefaultEnabledCapabilityMcpTools,
25
25
  workflowIdForSession,
26
26
  workspaceActorContextExempt
27
- } from "./chunk-PRCUIL5L.js";
27
+ } from "./chunk-ICAFSKJY.js";
28
28
  export {
29
29
  API_MAX_REQUEST_BODY_BYTES,
30
30
  allowedCorsOrigin,
@@ -83692,6 +83692,7 @@ import {
83692
83692
  getConnectionMetadata as getConnectionMetadata13,
83693
83693
  getInstalledPluginPackage,
83694
83694
  getPluginPackageUninstallPreview,
83695
+ PluginUninstallPreviewChangedError,
83695
83696
  integrationBindingKey,
83696
83697
  installApiIntegration as installApiIntegration3,
83697
83698
  installPluginMcpReference,
@@ -83943,9 +83944,14 @@ function registerPluginRoutes(app, deps, overrides = {}) {
83943
83944
  });
83944
83945
  app.get("/v1/workspaces/:workspaceId/plugins/:pluginKey/uninstall-preview", async (c) => {
83945
83946
  const workspaceId = c.req.param("workspaceId");
83946
- await requireAccessGrant26(c, deps, workspaceId, "workspace:read");
83947
+ const grant = await requireAccessGrant26(c, deps, workspaceId, "workspace:read");
83947
83948
  const pluginKey = decodeURIComponent(c.req.param("pluginKey"));
83948
- const preview = await getPluginPackageUninstallPreview(deps.db, workspaceId, pluginKey);
83949
+ const preview = await getPluginPackageUninstallPreview(
83950
+ deps.db,
83951
+ workspaceId,
83952
+ pluginKey,
83953
+ grant.subjectId
83954
+ );
83949
83955
  return c.json(PluginUninstallPreview.parse({ pluginKey, ...preview }));
83950
83956
  });
83951
83957
  app.delete("/v1/workspaces/:workspaceId/plugins/:pluginKey", async (c) => {
@@ -83971,11 +83977,31 @@ function registerPluginRoutes(app, deps, overrides = {}) {
83971
83977
  subjectId: grant.subjectId,
83972
83978
  pluginKey,
83973
83979
  expectedInstallationVersion: payload.expectedInstallationVersion,
83980
+ ...payload.expectedPreviewToken ? { expectedPreviewToken: payload.expectedPreviewToken } : {},
83974
83981
  idempotencyKey: payload.idempotencyKey
83975
83982
  })
83976
83983
  })
83977
83984
  );
83978
83985
  } catch (error) {
83986
+ if (error instanceof PluginUninstallPreviewChangedError) {
83987
+ const preview = error.preview ?? {
83988
+ pluginKey,
83989
+ ...await getPluginPackageUninstallPreview(
83990
+ deps.db,
83991
+ workspaceId,
83992
+ pluginKey,
83993
+ grant.subjectId
83994
+ )
83995
+ };
83996
+ return c.json(
83997
+ {
83998
+ code: error.code,
83999
+ message: error.message,
84000
+ preview: PluginUninstallPreview.parse(preview)
84001
+ },
84002
+ 409
84003
+ );
84004
+ }
83979
84005
  throw pluginMutationHttpError(error);
83980
84006
  }
83981
84007
  });
@@ -106841,4 +106867,4 @@ export {
106841
106867
  withDefaultEnabledCapabilityMcpTools,
106842
106868
  workflowIdForSession4 as workflowIdForSession
106843
106869
  };
106844
- //# sourceMappingURL=chunk-PRCUIL5L.js.map
106870
+ //# sourceMappingURL=chunk-ICAFSKJY.js.map