{"version":3,"sources":["../../../src/v0/schemas/actions.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Action type enum matching the internal Zapier API\n */\nexport const ActionTypeSchema = z.enum([\n  \"filter\",\n  \"read\",\n  \"read_bulk\",\n  \"run\",\n  \"search\",\n  \"search_and_write\",\n  \"search_or_write\",\n  \"write\",\n]);\n\nexport type ActionType = z.infer<typeof ActionTypeSchema>;\n\n/**\n * Base Action schema matching the internal API response from /api/v4/implementations/\n */\nexport const ActionSchema = z.object({\n  id: z.string().optional().describe(\"Unique identifier for the action\"),\n  type: ActionTypeSchema.describe(\"The type of action\"),\n  key: z.string().describe(\"Unique key identifier for the action\"),\n  name: z.string().describe(\"Display name of the action\"),\n  description: z.string().describe(\"Description of what the action does\"),\n  is_important: z\n    .boolean()\n    .optional()\n    .describe(\"Whether this action is marked as important\"),\n  is_hidden: z\n    .boolean()\n    .optional()\n    .describe(\"Whether this action is hidden from listings\"),\n  selected_api: z\n    .string()\n    .optional()\n    .describe(\"The implementation ID this action belongs to\"),\n});\n\nexport type Action = z.infer<typeof ActionSchema>;\n\n/**\n * Normalized action item returned by the list actions endpoint\n *\n * Transforms API response fields:\n * - name → title\n * - type → action_type\n * - selected_api → app_key + app_version (parsed)\n *\n * Adds computed fields:\n * - type: \"action\" (literal type identifier)\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 ActionItemSchema = z\n  .object({\n    id: z.string().optional().describe(\"Unique identifier for the action\"),\n    key: z.string().describe(\"Unique key identifier for the action\"),\n    description: z.string().describe(\"Description of what the action does\"),\n    is_important: z\n      .boolean()\n      .optional()\n      .describe(\"Whether this action is marked as important\"),\n    is_hidden: z\n      .boolean()\n      .optional()\n      .describe(\"Whether this action is hidden from listings\"),\n    app_key: z\n      .string()\n      .describe(\"App key extracted from implementation ID (without version)\"),\n    app_version: z\n      .string()\n      .optional()\n      .describe(\"App version extracted from implementation ID\"),\n    action_type: ActionTypeSchema.describe(\"The type of action\"),\n    title: z.string().describe(\"Display name of the action (mapped from name)\"),\n    type: z.literal(\"action\").describe(\"Type identifier for this item\"),\n  })\n  .describe(\"Normalized action item returned by list actions endpoint\");\n\nexport type ActionItem = z.infer<typeof ActionItemSchema>;\n\n/**\n * Implementation schema with actions array for the /api/v4/implementations/ response\n */\nexport const ImplementationWithActionsSchema = z.object({\n  selected_api: z.string().describe(\"The implementation ID\"),\n  app_id: z.number().optional().describe(\"Numeric app ID\"),\n  auth_type: z.string().optional().describe(\"Authentication type\"),\n  actions: z\n    .array(ActionSchema)\n    .optional()\n    .describe(\"Array of actions for this implementation\"),\n  is_deprecated: z\n    .boolean()\n    .optional()\n    .describe(\"Whether the implementation is deprecated\"),\n  is_private_only: z\n    .boolean()\n    .optional()\n    .describe(\"Whether the implementation is private only\"),\n  is_invite_only: z\n    .boolean()\n    .optional()\n    .describe(\"Whether the implementation is invite only\"),\n  is_beta: z\n    .boolean()\n    .optional()\n    .default(false)\n    .describe(\"Whether the implementation is in beta\"),\n  is_premium: z\n    .boolean()\n    .optional()\n    .default(false)\n    .describe(\"Whether the implementation requires premium\"),\n  name: z.string().optional().describe(\"Name of the implementation\"),\n  slug: z.string().optional().describe(\"URL-friendly slug\"),\n});\n\nexport type ImplementationWithActions = z.infer<\n  typeof ImplementationWithActionsSchema\n>;\n\n/**\n * Response schema for the /api/v4/implementations/ endpoint\n */\nexport const ImplementationsWithActionsResponseSchema = z.object({\n  count: z.number().describe(\"Total number of results\"),\n  next: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"URL for the next page of results\"),\n  previous: z\n    .string()\n    .nullable()\n    .optional()\n    .describe(\"URL for the previous page of results\"),\n  results: z\n    .array(ImplementationWithActionsSchema)\n    .describe(\"Array of implementations with their actions\"),\n});\n\nexport type ImplementationsWithActionsResponse = z.infer<\n  typeof ImplementationsWithActionsResponseSchema\n>;\n\n/**\n * Query parameters for listing actions\n */\nexport const ListActionsQuerySchema = z\n  .object({\n    /** @deprecated Use app_key instead */\n    appKey: z\n      .string()\n      .optional()\n      .describe(\n        \"Deprecated: Use app_key instead. App key to list actions for (e.g., 'SlackCLIAPI@1.21.1' or 'SlackCLIAPI')\",\n      ),\n    app_key: z\n      .string()\n      .optional()\n      .describe(\n        \"App key to list actions for (e.g., 'SlackCLIAPI@1.21.1' or 'SlackCLIAPI')\",\n      ),\n    /** @deprecated Use action_type instead */\n    actionType: ActionTypeSchema.optional().describe(\n      \"Deprecated: Use action_type instead. Filter actions by type (e.g., 'read', 'write', 'search')\",\n    ),\n    action_type: ActionTypeSchema.optional().describe(\n      \"Filter actions by type (e.g., 'read', 'write', 'search')\",\n    ),\n  })\n  .refine((data) => data.appKey || data.app_key, {\n    message: \"Either app_key or appKey is required\",\n    path: [\"app_key\"],\n  })\n  .describe(\"Query parameters for listing actions\");\n\n/**\n * Response schema for listActions\n */\nexport const ListActionsResponseSchema = z\n  .object({\n    data: z.array(ActionItemSchema).describe(\"Array of action items\"),\n  })\n  .describe(\"Response schema for listActions\");\n\n/**\n * TypeScript types for request and response\n */\nexport type ListActionsQuery = z.infer<typeof ListActionsQuerySchema>;\nexport type ListActionsResponse = z.infer<typeof ListActionsResponseSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAKX,IAAM,mBAAmB,aAAE,KAAK;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOM,IAAM,eAAe,aAAE,OAAO;AAAA,EACnC,IAAI,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,kCAAkC;AAAA,EACrE,MAAM,iBAAiB,SAAS,oBAAoB;AAAA,EACpD,KAAK,aAAE,OAAO,EAAE,SAAS,sCAAs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