@zapier/zapier-sdk-core 0.13.1 → 0.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk-core
2
2
 
3
+ ## 0.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 40f208f: fix: correct OAuth bearer token authentication so valid tokens are no longer incorrectly rejected.
8
+
9
+ ## 0.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 44596c6: Add `mode` (`"manual" | "auto"`) and `reason` to `ApprovalResponseSchema`, and make `approval_url` and `poll_url` required. `mode` lets clients branch UI/UX between human-reviewed approvals and agent-reviewed (auto) approvals. `approval_url` is populated for both modes — auto-mode records point at the existing approval UI so older SDK clients that always navigate users to `approval_url` continue to work. `reason` carries the human-readable denial message when `status` is `denied`.
14
+
3
15
  ## 0.13.1
4
16
 
5
17
  ### Patch Changes
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/v0/schemas/approvals.ts
21
21
  var approvals_exports = {};
22
22
  __export(approvals_exports, {
23
+ ApprovalModeSchema: () => ApprovalModeSchema,
23
24
  ApprovalResponseSchema: () => ApprovalResponseSchema,
24
25
  ApprovalStatusSchema: () => ApprovalStatusSchema,
25
26
  GetApprovalParamSchema: () => GetApprovalParamSchema
@@ -27,17 +28,23 @@ __export(approvals_exports, {
27
28
  module.exports = __toCommonJS(approvals_exports);
28
29
  var import_zod = require("zod");
29
30
  var ApprovalStatusSchema = import_zod.z.enum(["pending_approval", "approved", "denied"]).describe("The current status of the approval request");
31
+ var ApprovalModeSchema = import_zod.z.enum(["manual", "auto"]).describe(
32
+ "How the approval will be reviewed: manual (human) or auto (agent)"
33
+ );
30
34
  var ApprovalResponseSchema = import_zod.z.object({
31
35
  status: ApprovalStatusSchema,
36
+ mode: ApprovalModeSchema,
32
37
  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")
38
+ approval_url: import_zod.z.string().describe("URL for the user to visit and approve/deny the request"),
39
+ poll_url: import_zod.z.string().describe("URL for the SDK to poll for status changes"),
40
+ reason: import_zod.z.string().optional().describe("Human-readable reason populated when status is denied")
35
41
  });
36
42
  var GetApprovalParamSchema = import_zod.z.object({
37
43
  approvalId: import_zod.z.string().describe("The unique identifier of the approval request")
38
44
  });
39
45
  // Annotate the CommonJS export names for ESM import in node:
40
46
  0 && (module.exports = {
47
+ ApprovalModeSchema,
41
48
  ApprovalResponseSchema,
42
49
  ApprovalStatusSchema,
43
50
  GetApprovalParamSchema
@@ -1 +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":[]}
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 mode enum: manual (human reviews) or auto (agent reviews).\n *\n * Surfaced in the response so consumers can branch UI/UX later. Today\n * `approval_url` is always populated regardless of mode — old SDK clients\n * that always navigate users to `approval_url` keep working against\n * auto-mode approvals, which land on the existing approval UI.\n */\nexport const ApprovalModeSchema = z\n .enum([\"manual\", \"auto\"])\n .describe(\n \"How the approval will be reviewed: manual (human) or auto (agent)\",\n );\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 mode: ApprovalModeSchema,\n approval_id: z\n .string()\n .describe(\"Unique identifier for the approval request\"),\n approval_url: z\n .string()\n .describe(\"URL for the user to visit and approve/deny the request\"),\n poll_url: z.string().describe(\"URL for the SDK to poll for status changes\"),\n reason: z\n .string()\n .optional()\n .describe(\"Human-readable reason populated when status is denied\"),\n});\n\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\nexport type ApprovalMode = z.infer<typeof ApprovalModeSchema>;\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;AAAA,iBAAkB;AASX,IAAM,uBAAuB,aACjC,KAAK,CAAC,oBAAoB,YAAY,QAAQ,CAAC,EAC/C,SAAS,4CAA4C;AAUjD,IAAM,qBAAqB,aAC/B,KAAK,CAAC,UAAU,MAAM,CAAC,EACvB;AAAA,EACC;AACF;AAKK,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa,aACV,OAAO,EACP,SAAS,4CAA4C;AAAA,EACxD,cAAc,aACX,OAAO,EACP,SAAS,wDAAwD;AAAA,EACpE,UAAU,aAAE,OAAO,EAAE,SAAS,4CAA4C;AAAA,EAC1E,QAAQ,aACL,OAAO,EACP,SAAS,EACT,SAAS,uDAAuD;AACrE,CAAC;AASM,IAAM,yBAAyB,aAAE,OAAO;AAAA,EAC7C,YAAY,aACT,OAAO,EACP,SAAS,+CAA+C;AAC7D,CAAC;","names":[]}
@@ -11,6 +11,18 @@ declare const ApprovalStatusSchema: z.ZodEnum<{
11
11
  approved: "approved";
12
12
  denied: "denied";
13
13
  }>;
14
+ /**
15
+ * Approval mode enum: manual (human reviews) or auto (agent reviews).
16
+ *
17
+ * Surfaced in the response so consumers can branch UI/UX later. Today
18
+ * `approval_url` is always populated regardless of mode — old SDK clients
19
+ * that always navigate users to `approval_url` keep working against
20
+ * auto-mode approvals, which land on the existing approval UI.
21
+ */
22
+ declare const ApprovalModeSchema: z.ZodEnum<{
23
+ manual: "manual";
24
+ auto: "auto";
25
+ }>;
14
26
  /**
15
27
  * Approval response shape returned by both the poll endpoint and the 202 proxy response.
16
28
  */
@@ -20,11 +32,17 @@ declare const ApprovalResponseSchema: z.ZodObject<{
20
32
  approved: "approved";
21
33
  denied: "denied";
22
34
  }>;
35
+ mode: z.ZodEnum<{
36
+ manual: "manual";
37
+ auto: "auto";
38
+ }>;
23
39
  approval_id: z.ZodString;
24
- approval_url: z.ZodOptional<z.ZodString>;
25
- poll_url: z.ZodOptional<z.ZodString>;
40
+ approval_url: z.ZodString;
41
+ poll_url: z.ZodString;
42
+ reason: z.ZodOptional<z.ZodString>;
26
43
  }, z.core.$strip>;
27
44
  type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;
45
+ type ApprovalMode = z.infer<typeof ApprovalModeSchema>;
28
46
  type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;
29
47
  /**
30
48
  * Path parameters for get approval
@@ -34,4 +52,4 @@ declare const GetApprovalParamSchema: z.ZodObject<{
34
52
  }, z.core.$strip>;
35
53
  type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;
36
54
 
37
- export { type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
55
+ export { type ApprovalMode, ApprovalModeSchema, type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
@@ -11,6 +11,18 @@ declare const ApprovalStatusSchema: z.ZodEnum<{
11
11
  approved: "approved";
12
12
  denied: "denied";
13
13
  }>;
14
+ /**
15
+ * Approval mode enum: manual (human reviews) or auto (agent reviews).
16
+ *
17
+ * Surfaced in the response so consumers can branch UI/UX later. Today
18
+ * `approval_url` is always populated regardless of mode — old SDK clients
19
+ * that always navigate users to `approval_url` keep working against
20
+ * auto-mode approvals, which land on the existing approval UI.
21
+ */
22
+ declare const ApprovalModeSchema: z.ZodEnum<{
23
+ manual: "manual";
24
+ auto: "auto";
25
+ }>;
14
26
  /**
15
27
  * Approval response shape returned by both the poll endpoint and the 202 proxy response.
16
28
  */
@@ -20,11 +32,17 @@ declare const ApprovalResponseSchema: z.ZodObject<{
20
32
  approved: "approved";
21
33
  denied: "denied";
22
34
  }>;
35
+ mode: z.ZodEnum<{
36
+ manual: "manual";
37
+ auto: "auto";
38
+ }>;
23
39
  approval_id: z.ZodString;
24
- approval_url: z.ZodOptional<z.ZodString>;
25
- poll_url: z.ZodOptional<z.ZodString>;
40
+ approval_url: z.ZodString;
41
+ poll_url: z.ZodString;
42
+ reason: z.ZodOptional<z.ZodString>;
26
43
  }, z.core.$strip>;
27
44
  type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;
45
+ type ApprovalMode = z.infer<typeof ApprovalModeSchema>;
28
46
  type ApprovalResponse = z.infer<typeof ApprovalResponseSchema>;
29
47
  /**
30
48
  * Path parameters for get approval
@@ -34,4 +52,4 @@ declare const GetApprovalParamSchema: z.ZodObject<{
34
52
  }, z.core.$strip>;
35
53
  type GetApprovalParam = z.infer<typeof GetApprovalParamSchema>;
36
54
 
37
- export { type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
55
+ export { type ApprovalMode, ApprovalModeSchema, type ApprovalResponse, ApprovalResponseSchema, type ApprovalStatus, ApprovalStatusSchema, type GetApprovalParam, GetApprovalParamSchema };
@@ -1,16 +1,22 @@
1
1
  // src/v0/schemas/approvals.ts
2
2
  import { z } from "zod";
3
3
  var ApprovalStatusSchema = z.enum(["pending_approval", "approved", "denied"]).describe("The current status of the approval request");
4
+ var ApprovalModeSchema = z.enum(["manual", "auto"]).describe(
5
+ "How the approval will be reviewed: manual (human) or auto (agent)"
6
+ );
4
7
  var ApprovalResponseSchema = z.object({
5
8
  status: ApprovalStatusSchema,
9
+ mode: ApprovalModeSchema,
6
10
  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")
11
+ approval_url: z.string().describe("URL for the user to visit and approve/deny the request"),
12
+ poll_url: z.string().describe("URL for the SDK to poll for status changes"),
13
+ reason: z.string().optional().describe("Human-readable reason populated when status is denied")
9
14
  });
10
15
  var GetApprovalParamSchema = z.object({
11
16
  approvalId: z.string().describe("The unique identifier of the approval request")
12
17
  });
13
18
  export {
19
+ ApprovalModeSchema,
14
20
  ApprovalResponseSchema,
15
21
  ApprovalStatusSchema,
16
22
  GetApprovalParamSchema
@@ -1 +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":[]}
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 mode enum: manual (human reviews) or auto (agent reviews).\n *\n * Surfaced in the response so consumers can branch UI/UX later. Today\n * `approval_url` is always populated regardless of mode — old SDK clients\n * that always navigate users to `approval_url` keep working against\n * auto-mode approvals, which land on the existing approval UI.\n */\nexport const ApprovalModeSchema = z\n .enum([\"manual\", \"auto\"])\n .describe(\n \"How the approval will be reviewed: manual (human) or auto (agent)\",\n );\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 mode: ApprovalModeSchema,\n approval_id: z\n .string()\n .describe(\"Unique identifier for the approval request\"),\n approval_url: z\n .string()\n .describe(\"URL for the user to visit and approve/deny the request\"),\n poll_url: z.string().describe(\"URL for the SDK to poll for status changes\"),\n reason: z\n .string()\n .optional()\n .describe(\"Human-readable reason populated when status is denied\"),\n});\n\nexport type ApprovalStatus = z.infer<typeof ApprovalStatusSchema>;\nexport type ApprovalMode = z.infer<typeof ApprovalModeSchema>;\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;AAUjD,IAAM,qBAAqB,EAC/B,KAAK,CAAC,UAAU,MAAM,CAAC,EACvB;AAAA,EACC;AACF;AAKK,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa,EACV,OAAO,EACP,SAAS,4CAA4C;AAAA,EACxD,cAAc,EACX,OAAO,EACP,SAAS,wDAAwD;AAAA,EACpE,UAAU,EAAE,OAAO,EAAE,SAAS,4CAA4C;AAAA,EAC1E,QAAQ,EACL,OAAO,EACP,SAAS,EACT,SAAS,uDAAuD;AACrE,CAAC;AASM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,YAAY,EACT,OAAO,EACP,SAAS,+CAA+C;AAC7D,CAAC;","names":[]}
package/openapi.yaml CHANGED
@@ -213,6 +213,12 @@ components:
213
213
  - approved
214
214
  - denied
215
215
  description: The current status of the approval request
216
+ mode:
217
+ type: string
218
+ enum:
219
+ - manual
220
+ - auto
221
+ description: "How the approval will be reviewed: manual (human) or auto (agent)"
216
222
  approval_id:
217
223
  type: string
218
224
  description: Unique identifier for the approval request
@@ -222,9 +228,15 @@ components:
222
228
  poll_url:
223
229
  type: string
224
230
  description: URL for the SDK to poll for status changes
231
+ reason:
232
+ type: string
233
+ description: Human-readable reason populated when status is denied
225
234
  required:
226
235
  - status
236
+ - mode
227
237
  - approval_id
238
+ - approval_url
239
+ - poll_url
228
240
  ParsedUrl:
229
241
  type: object
230
242
  properties:
@@ -1458,9 +1470,6 @@ paths:
1458
1470
  operationId: v0_create_client_credentials
1459
1471
  security:
1460
1472
  - userJwt: []
1461
- x-fastify-config:
1462
- requiredScopes:
1463
- - credentials
1464
1473
  requestBody:
1465
1474
  content:
1466
1475
  application/json:
@@ -1510,9 +1519,6 @@ paths:
1510
1519
  operationId: v0_list_client_credentials
1511
1520
  security:
1512
1521
  - userJwt: []
1513
- x-fastify-config:
1514
- requiredScopes:
1515
- - credentials
1516
1522
  parameters:
1517
1523
  - schema:
1518
1524
  type: integer
@@ -1580,9 +1586,6 @@ paths:
1580
1586
  operationId: v0_delete_client_credentials
1581
1587
  security:
1582
1588
  - userJwt: []
1583
- x-fastify-config:
1584
- requiredScopes:
1585
- - credentials
1586
1589
  parameters:
1587
1590
  - schema:
1588
1591
  type: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-core",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
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.",