{"version":3,"sources":["../../../src/v0/schemas/connections.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Base Connection schema matching the API response\n * (internally uses the same v4 authentications API)\n */\nexport const ConnectionSchema = z.object({\n  id: z.number().describe(\"Unique identifier for the connection\"),\n  date: z.string().describe(\"Date created\"),\n  lastchanged: z.string().optional().describe(\"Date last changed\"),\n  account_id: z.number().describe(\"Account ID associated with this connection\"),\n  customuser_id: z\n    .number()\n    .optional()\n    .describe(\"Custom user ID (if applicable)\"),\n  selected_api: z.string().describe(\"Selected API key (internal identifier)\"),\n  slug: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\n      \"Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app.\",\n    ),\n  destination_selected_api: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"Destination API key (if applicable)\"),\n  is_invite_only: z.boolean().describe(\"Whether the connection is invite-only\"),\n  is_private: z.boolean().describe(\"Whether the connection is private\"),\n  shared_with_all: z\n    .boolean()\n    .describe(\"Whether the connection is shared with all users\"),\n  is_stale: z.string().optional().describe(\"Stale status string\"),\n  is_shared: z.string().optional().describe(\"Shared status string\"),\n  marked_stale_at: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"Date when marked stale\"),\n  label: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"User label for the connection\"),\n  identifier: z.string().nullable().optional().describe(\"Identifier\"),\n  title: z.string().nullable().optional().describe(\"Title of the connection\"),\n  url: z.string().optional().describe(\"URL to the connection resource\"),\n  groups: z\n    .array(\n      z\n        .record(z.string(), z.unknown())\n        .describe(\"Groups associated with the connection\"),\n    )\n    .optional()\n    .describe(\"Array of groups associated with the connection\"),\n  members: z\n    .string()\n    .optional()\n    .describe(\"Members associated with the connection\"),\n  permissions: z\n    .record(z.string(), z.boolean())\n    .optional()\n    .describe(\"Permissions for the connection\"),\n  public_id: z.string().optional().describe(\"Public UUID for the connection\"),\n  account_public_id: z\n    .string()\n    .optional()\n    .describe(\"Public UUID for the associated account\"),\n  customuser_public_id: z\n    .string()\n    .optional()\n    .describe(\"Public UUID for the associated custom user\"),\n});\n\n/**\n * Normalized connection item returned by getConnection handler\n *\n * Transforms API response fields:\n * - selected_api → implementation_id\n * - customuser_id → profile_id\n * - is_stale → is_expired (preserved as is_stale too)\n * - marked_stale_at → expired_at (preserved as marked_stale_at too)\n *\n * Adds computed fields:\n * - app_key: Extracted from selected_api (e.g., \"SlackCLIAPI@1.0.0\" → \"SlackCLIAPI\")\n * - app_version: Extracted from selected_api (e.g., \"SlackCLIAPI@1.0.0\" → \"1.0.0\")\n */\nexport const ConnectionItemSchema = ConnectionSchema.omit({\n  selected_api: true,\n  customuser_id: true,\n}).extend({\n  // Override numeric IDs with string versions (converted by normalizeConnectionItem)\n  id: z.string().describe(\"Unique identifier for the connection\"),\n  account_id: z.string().describe(\"Account ID associated with this connection\"),\n\n  // Renamed fields\n  implementation_id: z\n    .string()\n    .optional()\n    .describe(\"Implementation ID (was selected_api)\"),\n  profile_id: z.string().optional().describe(\"Profile ID (was customuser_id)\"),\n\n  // Mapped fields (originals preserved in ...restOfAuth)\n  is_expired: z\n    .string()\n    .optional()\n    .describe(\"Whether the connection is expired (mapped from is_stale)\"),\n  expired_at: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"Date when connection expired (mapped from marked_stale_at)\"),\n\n  // Computed fields\n  app_key: z\n    .string()\n    .optional()\n    .describe(\"App Key extracted from implementation_id\"),\n  app_version: z\n    .string()\n    .optional()\n    .describe(\"App Version extracted from implementation_id\"),\n});\n\nexport const ConnectionsResponseSchema = z.object({\n  count: z.number().describe(\"Total number of items\"),\n  next: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"Cursor for the next page of results (if available)\"),\n  previous: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"Cursor for the previous page of results (if available)\"),\n  results: z.array(ConnectionSchema).describe(\"Array of connection items\"),\n});\n\nexport type Connection = z.infer<typeof ConnectionSchema>;\nexport type ConnectionItem = z.infer<typeof ConnectionItemSchema>;\nexport type ConnectionsResponse = z.infer<typeof ConnectionsResponseSchema>;\n\n/**\n * Path parameters schema for getConnection endpoint.\n */\nexport const GetConnectionParamSchema = z\n  .object({\n    connectionId: z.string().describe(\"Connection ID to retrieve\"),\n  })\n  .describe(\"Get a specific connection by ID\");\n\nexport type GetConnectionParam = z.infer<typeof GetConnectionParamSchema>;\n\n/**\n * Response type for getConnection endpoint.\n * Wraps ConnectionItem in the standard API response envelope.\n */\nexport type GetConnectionResponse = { data: ConnectionItem };\n\n/**\n * Query parameters for listing connections\n */\nexport const ListConnectionsQuerySchema = z\n  .object({\n    app_key: z\n      .string()\n      .optional()\n      .describe(\n        \"Filter connections by app key (e.g., 'SlackCLIAPI' or slug like 'github')\",\n      ),\n    connection_ids: z\n      .string()\n      .optional()\n      .describe(\"Comma-separated list of connection IDs to filter by\"),\n    search: z\n      .string()\n      .optional()\n      .describe(\"Search term to filter connections by title\"),\n    title: z\n      .string()\n      .optional()\n      .describe(\n        \"Filter connections by exact title match (searches first, then filters locally)\",\n      ),\n    account_id: z\n      .string()\n      .optional()\n      .describe(\"Filter connections by account ID\"),\n    owner: z\n      .string()\n      .optional()\n      .describe(\n        \"Filter by owner, 'me' for your own connections or a specific user ID\",\n      ),\n    is_expired: z\n      .boolean()\n      .optional()\n      .describe(\n        \"Filter by expired status (true = expired only, false = non-expired only)\",\n      ),\n    page_size: z\n      .number()\n      .min(1)\n      .optional()\n      .describe(\"Number of connections per page\"),\n    offset: z\n      .string()\n      .optional()\n      .describe(\"Pagination offset from previous response\"),\n  })\n  .describe(\"Query parameters for listing connections\");\n\n/**\n * Response schema for listConnections\n */\nexport const ListConnectionsResponseSchema = z\n  .object({\n    data: z.array(ConnectionItemSchema).describe(\"Array of connection items\"),\n    links: z\n      .object({\n        next: z\n          .string()\n          .nullable()\n          .optional()\n          .describe(\n            \"Fully qualified URL for the next page of results (if available), e.g. https://sdkapi.zapier.com/api/v0/connections?offset=100&page_size=50\",\n          ),\n      })\n      .describe(\"Pagination links for navigating through results\"),\n    meta: z\n      .object({\n        count: z.number().describe(\"Total number of items\"),\n        limit: z.number().describe(\"Number of items per page\"),\n        offset: z.number().describe(\"Offset of the current page\"),\n      })\n      .describe(\"Metadata for the paginated result set\"),\n  })\n  .describe(\"Response schema for listing connections\");\n\n/**\n * TypeScript types for request and response\n */\nexport type ListConnectionsQuery = z.infer<typeof ListConnectionsQuerySchema>;\nexport type ListConnectionsResponse = z.infer<\n  typeof ListConnectionsResponseSchema\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAMX,IAAM,mBAAmB,aAAE,OAAO;AAAA,EACvC,IAAI,aAAE,OAAO,EAAE,SAAS,sCAAsC;AAAA,EAC9D,MAAM,aAAE,OAAO,EAAE,SAAS,cAAc;AAAA,EACxC,aAAa,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,mBAAmB;AAAA,EAC/D,YAAY,aAAE,OAAO,EAAE,SAAS,4CAA4C;AAAA,EAC5E,eAAe,aACZ,OAAO,EACP,SAAS,EACT,SAAS,gCAAgC;AAAA,EAC5C,cAAc,aAAE,OAAO,EAAE,SAAS,wCAAwC;AAAA,EAC1E,MAAM,aACH,OAAO,EACP,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,0BAA0B,aACvB,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,qCAAqC;AAAA,EACjD,gBAAgB,aAAE,QAAQ,EAAE,SAAS,uCAAuC;AAAA,EAC5E,YAAY,aAAE,QAAQ,EAAE,SAAS,mCAAmC;AAAA,EACpE,iBAAiB,aACd,QAAQ,EACR,SAAS,iDAAiD;AAAA,EAC7D,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,qBAAqB;AAAA,EAC9D,WAAW,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS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