@zapier/zapier-sdk-core 0.10.0 → 0.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk-core
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 821a368: Add `POST /api/v0/approvals` endpoint. The SDK calls this to create an approval request after receiving a `403 x-zapier-error-type: approval_required` from a proxy or handler. The body carries a typed request context (`http_request` or `action_run`).
8
+
9
+ ## 0.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - eb026a9: Add `GET /api/v0/approvals/{approvalId}` polling endpoint. The SDK uses this to poll approval status. On resolution, sdkapi invalidates the token-exchange cache so the next request re-fetches a fresh JWT with the updated `policy_urn`.
14
+
3
15
  ## 0.10.0
4
16
 
5
17
  ### Minor Changes
@@ -64,6 +64,10 @@ var tags = [
64
64
  {
65
65
  name: "Documentation",
66
66
  description: "Documentation-related routes"
67
+ },
68
+ {
69
+ name: "Approvals",
70
+ description: "Approval request management routes"
67
71
  }
68
72
  ];
69
73
  var securitySchemes = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/v0/config/metadata.ts"],"sourcesContent":["/**\n * OpenAPI specification metadata\n *\n * This file contains all the base metadata for the OpenAPI specification\n * that was previously stored in openapi-base.yaml.\n *\n * Note on 'as const' usage:\n * - We use 'as const' on literal values that should be treated as enums\n * (e.g., \"apiKey\", \"header\", \"3.1.0\") to get precise literal types\n * - We avoid 'as const' on top-level configuration objects to prevent\n * deep readonly types that can cause compatibility issues with libraries\n * expecting mutable types (like zod-to-openapi)\n * - If you encounter readonly type errors, check whether the consuming\n * library expects mutable types and remove 'as const' accordingly\n */\n\nexport const apiInfo = {\n title: \"Zapier SDK API\",\n version: \"1.0.0\",\n contact: {\n email: \"engineering@zapier.com\",\n },\n description: \"The Zapier SDK API serves as a backend for the Zapier SDK.\",\n};\n\nexport const servers: Array<{ url: string; description: string }> = [];\n\nexport const tags = [\n {\n name: \"Actions\",\n description: \"Action-related routes\",\n },\n {\n name: \"Apps\",\n description: \"App-related routes\",\n },\n {\n name: \"Authentications\",\n description: \"Authentication-related routes (deprecated, use Connections)\",\n },\n {\n name: \"Client Credentials\",\n description: \"Client credentials management routes\",\n },\n {\n name: \"Connections\",\n description: \"Connection-related routes\",\n },\n {\n name: \"Deduplication\",\n description: \"Deduplication-related routes\",\n },\n {\n name: \"Documentation\",\n description: \"Documentation-related routes\",\n },\n];\n\n/**\n * Security schemes for OpenAPI specification\n *\n * Note: 'as const' is used on enum-like literal values (\"apiKey\", \"header\")\n * to ensure TypeScript treats them as literal types rather than generic strings.\n * This provides better type safety when the OpenAPI generator validates these values.\n */\nexport const securitySchemes = {\n userJwt: {\n type: \"apiKey\" as const,\n in: \"header\" as const,\n name: \"Authorization\",\n description:\n \"Format should be `JWT <your-jwt>` (you must ensure that the JWT prefix \" +\n \"is included in your requests).\\\\n\\\\n\" +\n \"Example: `Authorization: JWT your.jwt.value.here`\",\n },\n} as const;\n\n/**\n * Complete OpenAPI metadata for document generation\n */\nexport const openApiMetadata = {\n openapi: \"3.1.0\" as const,\n info: apiInfo,\n servers,\n tags,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AACf;AAEO,IAAM,UAAuD,CAAC;AAE9D,IAAM,OAAO;AAAA,EAClB;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AASO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EAGJ;AACF;AAKO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/v0/config/metadata.ts"],"sourcesContent":["/**\n * OpenAPI specification metadata\n *\n * This file contains all the base metadata for the OpenAPI specification\n * that was previously stored in openapi-base.yaml.\n *\n * Note on 'as const' usage:\n * - We use 'as const' on literal values that should be treated as enums\n * (e.g., \"apiKey\", \"header\", \"3.1.0\") to get precise literal types\n * - We avoid 'as const' on top-level configuration objects to prevent\n * deep readonly types that can cause compatibility issues with libraries\n * expecting mutable types (like zod-to-openapi)\n * - If you encounter readonly type errors, check whether the consuming\n * library expects mutable types and remove 'as const' accordingly\n */\n\nexport const apiInfo = {\n title: \"Zapier SDK API\",\n version: \"1.0.0\",\n contact: {\n email: \"engineering@zapier.com\",\n },\n description: \"The Zapier SDK API serves as a backend for the Zapier SDK.\",\n};\n\nexport const servers: Array<{ url: string; description: string }> = [];\n\nexport const tags = [\n {\n name: \"Actions\",\n description: \"Action-related routes\",\n },\n {\n name: \"Apps\",\n description: \"App-related routes\",\n },\n {\n name: \"Authentications\",\n description: \"Authentication-related routes (deprecated, use Connections)\",\n },\n {\n name: \"Client Credentials\",\n description: \"Client credentials management routes\",\n },\n {\n name: \"Connections\",\n description: \"Connection-related routes\",\n },\n {\n name: \"Deduplication\",\n description: \"Deduplication-related routes\",\n },\n {\n name: \"Documentation\",\n description: \"Documentation-related routes\",\n },\n {\n name: \"Approvals\",\n description: \"Approval request management routes\",\n },\n];\n\n/**\n * Security schemes for OpenAPI specification\n *\n * Note: 'as const' is used on enum-like literal values (\"apiKey\", \"header\")\n * to ensure TypeScript treats them as literal types rather than generic strings.\n * This provides better type safety when the OpenAPI generator validates these values.\n */\nexport const securitySchemes = {\n userJwt: {\n type: \"apiKey\" as const,\n in: \"header\" as const,\n name: \"Authorization\",\n description:\n \"Format should be `JWT <your-jwt>` (you must ensure that the JWT prefix \" +\n \"is included in your requests).\\\\n\\\\n\" +\n \"Example: `Authorization: JWT your.jwt.value.here`\",\n },\n} as const;\n\n/**\n * Complete OpenAPI metadata for document generation\n */\nexport const openApiMetadata = {\n openapi: \"3.1.0\" as const,\n info: apiInfo,\n servers,\n tags,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AACf;AAEO,IAAM,UAAuD,CAAC;AAE9D,IAAM,OAAO;AAAA,EAClB;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AASO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EAGJ;AACF;AAKO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
@@ -36,6 +36,10 @@ var tags = [
36
36
  {
37
37
  name: "Documentation",
38
38
  description: "Documentation-related routes"
39
+ },
40
+ {
41
+ name: "Approvals",
42
+ description: "Approval request management routes"
39
43
  }
40
44
  ];
41
45
  var securitySchemes = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/v0/config/metadata.ts"],"sourcesContent":["/**\n * OpenAPI specification metadata\n *\n * This file contains all the base metadata for the OpenAPI specification\n * that was previously stored in openapi-base.yaml.\n *\n * Note on 'as const' usage:\n * - We use 'as const' on literal values that should be treated as enums\n * (e.g., \"apiKey\", \"header\", \"3.1.0\") to get precise literal types\n * - We avoid 'as const' on top-level configuration objects to prevent\n * deep readonly types that can cause compatibility issues with libraries\n * expecting mutable types (like zod-to-openapi)\n * - If you encounter readonly type errors, check whether the consuming\n * library expects mutable types and remove 'as const' accordingly\n */\n\nexport const apiInfo = {\n title: \"Zapier SDK API\",\n version: \"1.0.0\",\n contact: {\n email: \"engineering@zapier.com\",\n },\n description: \"The Zapier SDK API serves as a backend for the Zapier SDK.\",\n};\n\nexport const servers: Array<{ url: string; description: string }> = [];\n\nexport const tags = [\n {\n name: \"Actions\",\n description: \"Action-related routes\",\n },\n {\n name: \"Apps\",\n description: \"App-related routes\",\n },\n {\n name: \"Authentications\",\n description: \"Authentication-related routes (deprecated, use Connections)\",\n },\n {\n name: \"Client Credentials\",\n description: \"Client credentials management routes\",\n },\n {\n name: \"Connections\",\n description: \"Connection-related routes\",\n },\n {\n name: \"Deduplication\",\n description: \"Deduplication-related routes\",\n },\n {\n name: \"Documentation\",\n description: \"Documentation-related routes\",\n },\n];\n\n/**\n * Security schemes for OpenAPI specification\n *\n * Note: 'as const' is used on enum-like literal values (\"apiKey\", \"header\")\n * to ensure TypeScript treats them as literal types rather than generic strings.\n * This provides better type safety when the OpenAPI generator validates these values.\n */\nexport const securitySchemes = {\n userJwt: {\n type: \"apiKey\" as const,\n in: \"header\" as const,\n name: \"Authorization\",\n description:\n \"Format should be `JWT <your-jwt>` (you must ensure that the JWT prefix \" +\n \"is included in your requests).\\\\n\\\\n\" +\n \"Example: `Authorization: JWT your.jwt.value.here`\",\n },\n} as const;\n\n/**\n * Complete OpenAPI metadata for document generation\n */\nexport const openApiMetadata = {\n openapi: \"3.1.0\" as const,\n info: apiInfo,\n servers,\n tags,\n};\n"],"mappings":";AAgBO,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AACf;AAEO,IAAM,UAAuD,CAAC;AAE9D,IAAM,OAAO;AAAA,EAClB;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AASO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EAGJ;AACF;AAKO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/v0/config/metadata.ts"],"sourcesContent":["/**\n * OpenAPI specification metadata\n *\n * This file contains all the base metadata for the OpenAPI specification\n * that was previously stored in openapi-base.yaml.\n *\n * Note on 'as const' usage:\n * - We use 'as const' on literal values that should be treated as enums\n * (e.g., \"apiKey\", \"header\", \"3.1.0\") to get precise literal types\n * - We avoid 'as const' on top-level configuration objects to prevent\n * deep readonly types that can cause compatibility issues with libraries\n * expecting mutable types (like zod-to-openapi)\n * - If you encounter readonly type errors, check whether the consuming\n * library expects mutable types and remove 'as const' accordingly\n */\n\nexport const apiInfo = {\n title: \"Zapier SDK API\",\n version: \"1.0.0\",\n contact: {\n email: \"engineering@zapier.com\",\n },\n description: \"The Zapier SDK API serves as a backend for the Zapier SDK.\",\n};\n\nexport const servers: Array<{ url: string; description: string }> = [];\n\nexport const tags = [\n {\n name: \"Actions\",\n description: \"Action-related routes\",\n },\n {\n name: \"Apps\",\n description: \"App-related routes\",\n },\n {\n name: \"Authentications\",\n description: \"Authentication-related routes (deprecated, use Connections)\",\n },\n {\n name: \"Client Credentials\",\n description: \"Client credentials management routes\",\n },\n {\n name: \"Connections\",\n description: \"Connection-related routes\",\n },\n {\n name: \"Deduplication\",\n description: \"Deduplication-related routes\",\n },\n {\n name: \"Documentation\",\n description: \"Documentation-related routes\",\n },\n {\n name: \"Approvals\",\n description: \"Approval request management routes\",\n },\n];\n\n/**\n * Security schemes for OpenAPI specification\n *\n * Note: 'as const' is used on enum-like literal values (\"apiKey\", \"header\")\n * to ensure TypeScript treats them as literal types rather than generic strings.\n * This provides better type safety when the OpenAPI generator validates these values.\n */\nexport const securitySchemes = {\n userJwt: {\n type: \"apiKey\" as const,\n in: \"header\" as const,\n name: \"Authorization\",\n description:\n \"Format should be `JWT <your-jwt>` (you must ensure that the JWT prefix \" +\n \"is included in your requests).\\\\n\\\\n\" +\n \"Example: `Authorization: JWT your.jwt.value.here`\",\n },\n} as const;\n\n/**\n * Complete OpenAPI metadata for document generation\n */\nexport const openApiMetadata = {\n openapi: \"3.1.0\" as const,\n info: apiInfo,\n servers,\n tags,\n};\n"],"mappings":";AAgBO,IAAM,UAAU;AAAA,EACrB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AACf;AAEO,IAAM,UAAuD,CAAC;AAE9D,IAAM,OAAO;AAAA,EAClB;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF;AASO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,IACP,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EAGJ;AACF;AAKO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/v0/schemas/approvals.ts
21
+ var approvals_exports = {};
22
+ __export(approvals_exports, {
23
+ ApprovalResponseSchema: () => ApprovalResponseSchema,
24
+ ApprovalStatusSchema: () => ApprovalStatusSchema,
25
+ GetApprovalParamSchema: () => GetApprovalParamSchema
26
+ });
27
+ module.exports = __toCommonJS(approvals_exports);
28
+ var import_zod = require("zod");
29
+ var ApprovalStatusSchema = import_zod.z.enum(["pending_approval", "approved", "denied"]).describe("The current status of the approval request");
30
+ var ApprovalResponseSchema = import_zod.z.object({
31
+ status: ApprovalStatusSchema,
32
+ approval_id: import_zod.z.string().describe("Unique identifier for the approval request"),
33
+ approval_url: import_zod.z.string().optional().describe("URL for the user to visit and approve/deny the request"),
34
+ poll_url: import_zod.z.string().optional().describe("URL for the SDK to poll for status changes")
35
+ });
36
+ var GetApprovalParamSchema = import_zod.z.object({
37
+ approvalId: import_zod.z.string().describe("The unique identifier of the approval request")
38
+ });
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ApprovalResponseSchema,
42
+ ApprovalStatusSchema,
43
+ GetApprovalParamSchema
44
+ });
45
+ //# sourceMappingURL=approvals.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/v0/schemas/approvals.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Shared approval schemas used by both route definitions and core models.\n */\n\n/**\n * Approval status enum\n */\nexport const ApprovalStatusSchema = z\n .enum([\"pending_approval\", \"approved\", \"denied\"])\n .describe(\"The current status of the approval request\");\n\n/**\n * Approval response shape returned by both the poll endpoint and the 202 proxy response.\n */\nexport const ApprovalResponseSchema = z.object({\n status: ApprovalStatusSchema,\n approval_id: z\n .string()\n .describe(\"Unique identifier for the approval request\"),\n approval_url: z\n .string()\n .optional()\n .describe(\"URL for the user to visit and approve/deny the request\"),\n poll_url: z\n .string()\n .optional()\n .describe(\"URL for the SDK to poll for status changes\"),\n});\n\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\nexport type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;\n\n/**\n * Path parameters for get approval\n */\nexport const GetApprovalParamSchema = z.object({\n approvalId: z\n .string()\n .describe(\"The unique identifier of the approval request\"),\n});\n\nexport type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AASX,IAAM,uBAAuB,aACjC,KAAK,CAAC,oBAAoB,YAAY,QAAQ,CAAC,EAC/C,SAAS,4CAA4C;AAKjD,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,aAAa,aACV,OAAO,EACP,SAAS,4CAA4C;AAAA,EACxD,cAAc,aACX,OAAO,EACP,SAAS,EACT,SAAS,wDAAwD;AAAA,EACpE,UAAU,aACP,OAAO,EACP,SAAS,EACT,SAAS,4CAA4C;AAC1D,CAAC;AAQM,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,YAAY,aACT,OAAO,EACP,SAAS,+CAA+C;AAC7D,CAAC;","names":[]}
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Shared approval schemas used by both route definitions and core models.
5
+ */
6
+ /**
7
+ * Approval status enum
8
+ */
9
+ declare const ApprovalStatusSchema: z.ZodEnum<{
10
+ pending_approval: "pending_approval";
11
+ approved: "approved";
12
+ denied: "denied";
13
+ }>;
14
+ /**
15
+ * Approval response shape returned by both the poll endpoint and the 202 proxy response.
16
+ */
17
+ declare const ApprovalResponseSchema: z.ZodObject<{
18
+ status: z.ZodEnum<{
19
+ pending_approval: "pending_approval";
20
+ approved: "approved";
21
+ denied: "denied";
22
+ }>;
23
+ approval_id: z.ZodString;
24
+ approval_url: z.ZodOptional<z.ZodString>;
25
+ poll_url: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;
28
+ type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;
29
+ /**
30
+ * Path parameters for get approval
31
+ */
32
+ declare const GetApprovalParamSchema: z.ZodObject<{
33
+ approvalId: z.ZodString;
34
+ }, z.core.$strip>;
35
+ type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;
36
+
37
+ export { type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Shared approval schemas used by both route definitions and core models.
5
+ */
6
+ /**
7
+ * Approval status enum
8
+ */
9
+ declare const ApprovalStatusSchema: z.ZodEnum<{
10
+ pending_approval: "pending_approval";
11
+ approved: "approved";
12
+ denied: "denied";
13
+ }>;
14
+ /**
15
+ * Approval response shape returned by both the poll endpoint and the 202 proxy response.
16
+ */
17
+ declare const ApprovalResponseSchema: z.ZodObject<{
18
+ status: z.ZodEnum<{
19
+ pending_approval: "pending_approval";
20
+ approved: "approved";
21
+ denied: "denied";
22
+ }>;
23
+ approval_id: z.ZodString;
24
+ approval_url: z.ZodOptional<z.ZodString>;
25
+ poll_url: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;
28
+ type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;
29
+ /**
30
+ * Path parameters for get approval
31
+ */
32
+ declare const GetApprovalParamSchema: z.ZodObject<{
33
+ approvalId: z.ZodString;
34
+ }, z.core.$strip>;
35
+ type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;
36
+
37
+ export { type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
@@ -0,0 +1,18 @@
1
+ // src/v0/schemas/approvals.ts
2
+ import { z } from "zod";
3
+ var ApprovalStatusSchema = z.enum(["pending_approval", "approved", "denied"]).describe("The current status of the approval request");
4
+ var ApprovalResponseSchema = z.object({
5
+ status: ApprovalStatusSchema,
6
+ approval_id: z.string().describe("Unique identifier for the approval request"),
7
+ approval_url: z.string().optional().describe("URL for the user to visit and approve/deny the request"),
8
+ poll_url: z.string().optional().describe("URL for the SDK to poll for status changes")
9
+ });
10
+ var GetApprovalParamSchema = z.object({
11
+ approvalId: z.string().describe("The unique identifier of the approval request")
12
+ });
13
+ export {
14
+ ApprovalResponseSchema,
15
+ ApprovalStatusSchema,
16
+ GetApprovalParamSchema
17
+ };
18
+ //# sourceMappingURL=approvals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/v0/schemas/approvals.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Shared approval schemas used by both route definitions and core models.\n */\n\n/**\n * Approval status enum\n */\nexport const ApprovalStatusSchema = z\n .enum([\"pending_approval\", \"approved\", \"denied\"])\n .describe(\"The current status of the approval request\");\n\n/**\n * Approval response shape returned by both the poll endpoint and the 202 proxy response.\n */\nexport const ApprovalResponseSchema = z.object({\n status: ApprovalStatusSchema,\n approval_id: z\n .string()\n .describe(\"Unique identifier for the approval request\"),\n approval_url: z\n .string()\n .optional()\n .describe(\"URL for the user to visit and approve/deny the request\"),\n poll_url: z\n .string()\n .optional()\n .describe(\"URL for the SDK to poll for status changes\"),\n});\n\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\nexport type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;\n\n/**\n * Path parameters for get approval\n */\nexport const GetApprovalParamSchema = z.object({\n approvalId: z\n .string()\n .describe(\"The unique identifier of the approval request\"),\n});\n\nexport type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AASX,IAAM,uBAAuB,EACjC,KAAK,CAAC,oBAAoB,YAAY,QAAQ,CAAC,EAC/C,SAAS,4CAA4C;AAKjD,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,aAAa,EACV,OAAO,EACP,SAAS,4CAA4C;AAAA,EACxD,cAAc,EACX,OAAO,EACP,SAAS,EACT,SAAS,wDAAwD;AAAA,EACpE,UAAU,EACP,OAAO,EACP,SAAS,EACT,SAAS,4CAA4C;AAC1D,CAAC;AAQM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,YAAY,EACT,OAAO,EACP,SAAS,+CAA+C;AAC7D,CAAC;","names":[]}
package/openapi.yaml CHANGED
@@ -25,6 +25,8 @@ tags:
25
25
  description: Deduplication-related routes
26
26
  - name: Documentation
27
27
  description: Documentation-related routes
28
+ - name: Approvals
29
+ description: Approval request management routes
28
30
  components:
29
31
  schemas:
30
32
  ErrorCode:
@@ -201,6 +203,139 @@ components:
201
203
  required:
202
204
  - dedupe_key
203
205
  - parameters
206
+ ApprovalResponse:
207
+ type: object
208
+ properties:
209
+ status:
210
+ type: string
211
+ enum:
212
+ - pending_approval
213
+ - approved
214
+ - denied
215
+ description: The current status of the approval request
216
+ approval_id:
217
+ type: string
218
+ description: Unique identifier for the approval request
219
+ approval_url:
220
+ type: string
221
+ description: URL for the user to visit and approve/deny the request
222
+ poll_url:
223
+ type: string
224
+ description: URL for the SDK to poll for status changes
225
+ required:
226
+ - status
227
+ - approval_id
228
+ ParsedUrl:
229
+ type: object
230
+ properties:
231
+ scheme:
232
+ type: string
233
+ description: URL scheme (e.g. https)
234
+ host:
235
+ type: string
236
+ description: Hostname
237
+ port:
238
+ type: number
239
+ description: Port number
240
+ path:
241
+ type: string
242
+ description: URL path
243
+ query:
244
+ type: object
245
+ additionalProperties:
246
+ type: array
247
+ items:
248
+ type: string
249
+ description: Query parameters
250
+ required:
251
+ - scheme
252
+ - host
253
+ - port
254
+ - path
255
+ - query
256
+ description: Parsed URL components
257
+ HttpRequestContext:
258
+ type: object
259
+ properties:
260
+ request_type:
261
+ type: string
262
+ enum:
263
+ - http_request
264
+ description: Context type discriminator
265
+ method:
266
+ type: string
267
+ description: HTTP method
268
+ url:
269
+ $ref: "#/components/schemas/ParsedUrl"
270
+ headers:
271
+ type: object
272
+ additionalProperties:
273
+ type: string
274
+ description: Filtered headers (IGNORED_HEADERS excluded, keys lowercased)
275
+ body:
276
+ type:
277
+ - string
278
+ - "null"
279
+ description: Raw body string
280
+ body_json:
281
+ description: Parsed JSON body
282
+ connection_id:
283
+ type: string
284
+ description: Zapier connection ID used for this request
285
+ reason:
286
+ type: string
287
+ description: Human-readable reason
288
+ required:
289
+ - request_type
290
+ - method
291
+ - url
292
+ - headers
293
+ - body
294
+ ActionRunContext:
295
+ type: object
296
+ properties:
297
+ request_type:
298
+ type: string
299
+ enum:
300
+ - action_run
301
+ description: Context type discriminator
302
+ selected_api:
303
+ type: string
304
+ description: Selected API identifier
305
+ action_type:
306
+ type: string
307
+ description: Action type
308
+ action_key:
309
+ type: string
310
+ description: Action key
311
+ connection_id:
312
+ type: string
313
+ description: Zapier connection ID
314
+ inputs:
315
+ description: Action input parameters
316
+ reason:
317
+ type: string
318
+ description: Human-readable reason
319
+ required:
320
+ - request_type
321
+ - selected_api
322
+ - action_type
323
+ - action_key
324
+ CreateApprovalBody:
325
+ type: object
326
+ properties:
327
+ context:
328
+ oneOf:
329
+ - $ref: "#/components/schemas/HttpRequestContext"
330
+ - $ref: "#/components/schemas/ActionRunContext"
331
+ discriminator:
332
+ propertyName: request_type
333
+ mapping:
334
+ http_request: "#/components/schemas/HttpRequestContext"
335
+ action_run: "#/components/schemas/ActionRunContext"
336
+ description: The request context for the approval — either an HTTP request context or an action run context
337
+ required:
338
+ - context
204
339
  CreateClientCredentialsResponse:
205
340
  type: object
206
341
  properties:
@@ -1244,6 +1379,49 @@ paths:
1244
1379
  application/json: &a7
1245
1380
  schema:
1246
1381
  $ref: "#/components/schemas/ErrorsResponse"
1382
+ /api/v0/approvals:
1383
+ post:
1384
+ summary: Create an approval request
1385
+ description: Creates an approval request for the authenticated user. The SDK calls this when it decides to proceed with an approval flow after receiving an approval-required error.
1386
+ tags:
1387
+ - Approvals
1388
+ operationId: v0_create_approval
1389
+ security:
1390
+ - userJwt: []
1391
+ requestBody:
1392
+ content:
1393
+ application/json:
1394
+ schema:
1395
+ $ref: "#/components/schemas/CreateApprovalBody"
1396
+ responses:
1397
+ "202":
1398
+ description: Approval request created
1399
+ content:
1400
+ application/json:
1401
+ schema:
1402
+ $ref: "#/components/schemas/ApprovalResponse"
1403
+ "400":
1404
+ description: Bad Request
1405
+ content:
1406
+ application/json: *a1
1407
+ "401":
1408
+ description: Unauthorized
1409
+ content:
1410
+ application/json: *a2
1411
+ "429":
1412
+ description: Too Many Requests
1413
+ headers: *a3
1414
+ content:
1415
+ application/json: *a4
1416
+ "500":
1417
+ description: Server Error
1418
+ content:
1419
+ application/json: *a5
1420
+ "503":
1421
+ description: Service Unavailable
1422
+ headers: *a6
1423
+ content:
1424
+ application/json: *a7
1247
1425
  /api/v0/client-credentials:
1248
1426
  post:
1249
1427
  summary: Create client credentials
@@ -1455,6 +1633,58 @@ paths:
1455
1633
  headers: *a6
1456
1634
  content:
1457
1635
  application/json: *a7
1636
+ /api/v0/approvals/{approvalId}:
1637
+ get:
1638
+ summary: Get approval status
1639
+ description: Returns the current status of an approval request. Used by the SDK to poll for approval resolution.
1640
+ tags:
1641
+ - Approvals
1642
+ operationId: v0_get_approval
1643
+ security:
1644
+ - userJwt: []
1645
+ parameters:
1646
+ - schema:
1647
+ type: string
1648
+ description: The unique identifier of the approval request
1649
+ required: true
1650
+ description: The unique identifier of the approval request
1651
+ name: approvalId
1652
+ in: path
1653
+ responses:
1654
+ "200":
1655
+ description: Success
1656
+ content:
1657
+ application/json:
1658
+ schema:
1659
+ $ref: "#/components/schemas/ApprovalResponse"
1660
+ "400":
1661
+ description: Bad Request
1662
+ content:
1663
+ application/json: *a1
1664
+ "401":
1665
+ description: Unauthorized
1666
+ content:
1667
+ application/json: *a2
1668
+ "404":
1669
+ description: Approval not found
1670
+ content:
1671
+ application/json:
1672
+ schema:
1673
+ $ref: "#/components/schemas/ErrorsResponse"
1674
+ "429":
1675
+ description: Too Many Requests
1676
+ headers: *a3
1677
+ content:
1678
+ application/json: *a4
1679
+ "500":
1680
+ description: Server Error
1681
+ content:
1682
+ application/json: *a5
1683
+ "503":
1684
+ description: Service Unavailable
1685
+ headers: *a6
1686
+ content:
1687
+ application/json: *a7
1458
1688
  /api/v0/authentications/{authenticationId}:
1459
1689
  get:
1460
1690
  summary: Get an authentication
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-core",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Core schemas and TypeScript types for the Zapier SDK API",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Zapier, Inc.",
@@ -61,6 +61,11 @@
61
61
  "import": "./dist/v0/schemas/client-credentials.js",
62
62
  "require": "./dist/v0/schemas/client-credentials.cjs"
63
63
  },
64
+ "./v0/schemas/approvals": {
65
+ "types": "./dist/v0/schemas/approvals.d.ts",
66
+ "import": "./dist/v0/schemas/approvals.js",
67
+ "require": "./dist/v0/schemas/approvals.cjs"
68
+ },
64
69
  "./v0/common/responses": {
65
70
  "types": "./dist/v0/common/responses.d.ts",
66
71
  "import": "./dist/v0/common/responses.js",