@opengeni/api-router 3.0.0-canary.0 → 3.0.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.
package/dist/app.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  withDefaultEnabledCapabilityMcpTools,
25
25
  workflowIdForSession,
26
26
  workspaceActorContextExempt
27
- } from "./chunk-7IAWEYBH.js";
27
+ } from "./chunk-AJ62T5QN.js";
28
28
  export {
29
29
  API_MAX_REQUEST_BODY_BYTES,
30
30
  allowedCorsOrigin,
@@ -63503,6 +63503,14 @@ function registerConnectRoutes(app, deps) {
63503
63503
  ownership: ["workspace"],
63504
63504
  setup: ["oauth"]
63505
63505
  }),
63506
+ ConnectProvider.parse({
63507
+ id: "gmail",
63508
+ label: "Gmail",
63509
+ family: "google",
63510
+ readiness: !external || !canWrite2 || !personal ? "unsupported" : mcpConfigured ? "available" : "needs_configuration",
63511
+ ownership: personal ? ["personal"] : [],
63512
+ setup: ["oauth"]
63513
+ }),
63506
63514
  ConnectProvider.parse({
63507
63515
  id: "slack-personal",
63508
63516
  label: "My Slack account",
@@ -63706,7 +63714,7 @@ function registerConnectRoutes(app, deps) {
63706
63714
  ConnectAccount.parse({
63707
63715
  id: connection.id,
63708
63716
  version: connection.version,
63709
- providerId: connection.metadata.mcpUrl === OPENGENI_PERSONAL_SLACK_MCP_URL2 ? "slack-personal" : "mcp-oauth",
63717
+ providerId: connection.metadata.mcpUrl === OPENGENI_PERSONAL_SLACK_MCP_URL2 ? "slack-personal" : connection.metadata.mcpUrl === OFFICIAL_GMAIL_MCP_URL ? "gmail" : "mcp-oauth",
63710
63718
  label: connection.providerDomain,
63711
63719
  ownership: connection.subjectId === null ? "workspace" : "personal",
63712
63720
  status: connection.status === "revoked" ? "disabled" : connection.status === "active" ? "connected" : "auth_needed"
@@ -64062,10 +64070,10 @@ function registerConnectRoutes(app, deps) {
64062
64070
  })
64063
64071
  );
64064
64072
  }
64065
- if (["mcp-oauth", "slack-personal"].includes(before.providerId)) {
64073
+ if (["mcp-oauth", "slack-personal", "gmail"].includes(before.providerId)) {
64066
64074
  if (action.type !== "credentials")
64067
64075
  throw new HTTPException38(422, { message: "MCP OAuth requires a server URL" });
64068
- const values = before.providerId === "slack-personal" ? { mcpUrl: OPENGENI_PERSONAL_SLACK_MCP_URL2 } : z18.object({ mcpUrl: z18.string().url().max(4096) }).strict().parse(action.values);
64076
+ const values = before.providerId === "slack-personal" ? { mcpUrl: OPENGENI_PERSONAL_SLACK_MCP_URL2 } : before.providerId === "gmail" ? { mcpUrl: OFFICIAL_GMAIL_MCP_URL } : z18.object({ mcpUrl: z18.string().url().max(4096) }).strict().parse(action.values);
64069
64077
  return c.json(
64070
64078
  await executeConnectOperation({
64071
64079
  db: deps.db,
@@ -64501,6 +64509,7 @@ function registerConnectRoutes(app, deps) {
64501
64509
  if (input.installationTarget && [
64502
64510
  "mcp-oauth",
64503
64511
  "slack-personal",
64512
+ "gmail",
64504
64513
  "mcp-bearer",
64505
64514
  "mcp-headers",
64506
64515
  "fiken-token",
@@ -64514,17 +64523,26 @@ function registerConnectRoutes(app, deps) {
64514
64523
  throw new HTTPException38(422, {
64515
64524
  message: "MCP credential setup does not install an API integration instance"
64516
64525
  });
64517
- if (["mcp-oauth", "slack-personal", "mcp-bearer", "mcp-headers", "fiken-token"].includes(
64518
- input.providerId
64519
- )) {
64526
+ if ([
64527
+ "mcp-oauth",
64528
+ "slack-personal",
64529
+ "gmail",
64530
+ "mcp-bearer",
64531
+ "mcp-headers",
64532
+ "fiken-token"
64533
+ ].includes(input.providerId)) {
64520
64534
  if (input.providerId === "slack-personal" && input.ownership !== "personal")
64521
64535
  throw new HTTPException38(422, {
64522
64536
  message: "Hosted Slack MCP requires personal ownership"
64523
64537
  });
64538
+ if (input.providerId === "gmail" && input.ownership !== "personal")
64539
+ throw new HTTPException38(422, {
64540
+ message: "Gmail requires personal ownership; each user connects their own account"
64541
+ });
64524
64542
  if (input.providerId === "fiken-token" && input.ownership !== "workspace")
64525
64543
  throw new HTTPException38(422, { message: "Fiken is workspace-owned" });
64526
64544
  requireEnvironmentEncryption11(deps.settings);
64527
- if (["mcp-oauth", "slack-personal"].includes(input.providerId))
64545
+ if (["mcp-oauth", "slack-personal", "gmail"].includes(input.providerId))
64528
64546
  requireIntegrationsStateSecret(deps.settings);
64529
64547
  const existing = input.reconnectAccountId ? await getConnectionMetadata10(
64530
64548
  tx,
@@ -64532,7 +64550,7 @@ function registerConnectRoutes(app, deps) {
64532
64550
  input.reconnectAccountId,
64533
64551
  scope.subjectId
64534
64552
  ) : null;
64535
- if (input.reconnectAccountId && (!existing || (input.providerId === "fiken-token" ? !isFikenConnection2(existing) : ["mcp-oauth", "slack-personal"].includes(input.providerId) ? existing.kind !== "oauth2" || !existing.metadata.oauthDiscovery || input.providerId === "slack-personal" && existing.metadata.mcpUrl !== OPENGENI_PERSONAL_SLACK_MCP_URL2 : existing.kind !== "api_key" || existing.metadata.connectAdapter !== input.providerId) || (existing.subjectId === null ? "workspace" : "personal") !== input.ownership))
64553
+ if (input.reconnectAccountId && (!existing || (input.providerId === "fiken-token" ? !isFikenConnection2(existing) : ["mcp-oauth", "slack-personal", "gmail"].includes(input.providerId) ? existing.kind !== "oauth2" || !existing.metadata.oauthDiscovery || input.providerId === "slack-personal" && existing.metadata.mcpUrl !== OPENGENI_PERSONAL_SLACK_MCP_URL2 || input.providerId === "gmail" && existing.metadata.mcpUrl !== OFFICIAL_GMAIL_MCP_URL : existing.kind !== "api_key" || existing.metadata.connectAdapter !== input.providerId) || (existing.subjectId === null ? "workspace" : "personal") !== input.ownership))
64536
64554
  throw new HTTPException38(404, { message: "MCP account not found for this ownership" });
64537
64555
  if (input.ownership === "personal" && !isPersonalConnectionOwnerPrincipal(authorization))
64538
64556
  throw new HTTPException38(403, { message: "personal ownership unavailable" });
@@ -64563,7 +64581,7 @@ function registerConnectRoutes(app, deps) {
64563
64581
  } : {},
64564
64582
  nextAction: {
64565
64583
  type: "credentials",
64566
- fields: input.providerId === "slack-personal" ? [] : input.providerId === "fiken-token" ? [
64584
+ fields: ["slack-personal", "gmail"].includes(input.providerId) ? [] : input.providerId === "fiken-token" ? [
64567
64585
  {
64568
64586
  name: "apiToken",
64569
64587
  label: "Fiken API token",
@@ -105677,4 +105695,4 @@ export {
105677
105695
  withDefaultEnabledCapabilityMcpTools,
105678
105696
  workflowIdForSession4 as workflowIdForSession
105679
105697
  };
105680
- //# sourceMappingURL=chunk-7IAWEYBH.js.map
105698
+ //# sourceMappingURL=chunk-AJ62T5QN.js.map