@zapier/zapier-sdk-core 0.11.0 → 0.13.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/openapi.yaml +203 -22
  3. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @zapier/zapier-sdk-core
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - eb48f58: Adopt canonical resource-shaped `ActionRunContext` for the
8
+ `POST /api/v0/approvals` request body.
9
+
10
+ The inline `RequestContext` / `ActionRunContext` / `HttpRequestContext`
11
+ Zod mirrors in `create-approval.ts` are deleted in favor of importing
12
+ the canonical `RequestContextSchema` directly from `@zapier/policy-context`
13
+ (now a runtime dependency). Action identity is now carried in a single
14
+ canonical `resource` field of the form
15
+ `action/{selected_api}/{action_type}/{action_key}`; the legacy
16
+ `{selected_api, action_type, action_key}` triple is still accepted on
17
+ input during the migration window and normalized to the canonical shape
18
+ before storage. No wire-level breaking change for existing callers.
19
+
20
+ ## 0.12.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 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`).
25
+
3
26
  ## 0.11.0
4
27
 
5
28
  ### Minor Changes
package/openapi.yaml CHANGED
@@ -203,6 +203,166 @@ components:
203
203
  required:
204
204
  - dedupe_key
205
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, e.g. "api.example.com"
237
+ port:
238
+ type: integer
239
+ description: Port number (defaults to 443 for https, 80 for http)
240
+ path:
241
+ type: string
242
+ description: URL path, e.g. "/v1/foo"
243
+ query:
244
+ type: object
245
+ additionalProperties:
246
+ type: array
247
+ items:
248
+ type: string
249
+ description: Query parameters as key to string array mapping
250
+ required:
251
+ - scheme
252
+ - host
253
+ - port
254
+ - path
255
+ - query
256
+ description: Parsed URL components for policy condition matching
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
+ maxLength: 10
268
+ description: HTTP method
269
+ url:
270
+ $ref: "#/components/schemas/ParsedUrl"
271
+ headers:
272
+ type: object
273
+ additionalProperties:
274
+ type: string
275
+ description: Filtered headers (IGNORED_HEADERS excluded, keys lowercased)
276
+ body:
277
+ type:
278
+ - string
279
+ - "null"
280
+ maxLength: 65536
281
+ description: Raw body string
282
+ body_json:
283
+ description: Parsed JSON body (if applicable)
284
+ connection_id:
285
+ type: string
286
+ maxLength: 255
287
+ description: Zapier connection ID used for this request
288
+ reason:
289
+ type: string
290
+ maxLength: 1024
291
+ description: Optional human-readable reason for the request
292
+ required:
293
+ - request_type
294
+ - method
295
+ - url
296
+ - headers
297
+ - body
298
+ - body_json
299
+ action_type:
300
+ type: string
301
+ enum:
302
+ - filter
303
+ - read
304
+ - read_bulk
305
+ - run
306
+ - search
307
+ - search_and_write
308
+ - search_or_write
309
+ - write
310
+ description: "Legacy: canonical Zapier action type. Prefer `resource`."
311
+ deprecated: true
312
+ ActionRunContext:
313
+ type: object
314
+ properties:
315
+ request_type:
316
+ type: string
317
+ enum:
318
+ - action_run
319
+ description: Context type discriminator
320
+ resource:
321
+ type: string
322
+ maxLength: 1024
323
+ description: Canonical action resource, e.g. action/Slack@1.0.0/write/send_message
324
+ selected_api:
325
+ type: string
326
+ maxLength: 255
327
+ deprecated: true
328
+ description: "Legacy: app identifier, e.g. Slack@1.0.0. Prefer `resource`."
329
+ action_type:
330
+ $ref: "#/components/schemas/action_type"
331
+ action_key:
332
+ type: string
333
+ maxLength: 255
334
+ deprecated: true
335
+ description: "Legacy: action key, e.g. send_message. Prefer `resource`."
336
+ connection_id:
337
+ type: string
338
+ maxLength: 255
339
+ description: Zapier connection ID used for this request
340
+ inputs:
341
+ description: Action input parameters
342
+ reason:
343
+ type: string
344
+ maxLength: 1024
345
+ description: Optional human-readable reason for the request
346
+ required:
347
+ - request_type
348
+ description: Action run context. The canonical shape carries the action identity in a single `resource` field of the form `action/{selected_api}/{action_type}/{action_key}`. The legacy `{selected_api, action_type, action_key}` shape is also accepted on input during the migration window — approvalsapi normalizes it to the canonical form before storage.
349
+ RequestContext:
350
+ anyOf:
351
+ - $ref: "#/components/schemas/HttpRequestContext"
352
+ - $ref: "#/components/schemas/ActionRunContext"
353
+ description: Union of request context shapes, keyed on `request_type`.
354
+ discriminator:
355
+ propertyName: request_type
356
+ mapping:
357
+ http_request: "#/components/schemas/HttpRequestContext"
358
+ action_run: "#/components/schemas/ActionRunContext"
359
+ CreateApprovalBody:
360
+ type: object
361
+ properties:
362
+ context:
363
+ $ref: "#/components/schemas/RequestContext"
364
+ required:
365
+ - context
206
366
  CreateClientCredentialsResponse:
207
367
  type: object
208
368
  properties:
@@ -251,28 +411,6 @@ components:
251
411
  - name
252
412
  - allowed_scopes
253
413
  description: Request body for creating client credentials
254
- ApprovalResponse:
255
- type: object
256
- properties:
257
- status:
258
- type: string
259
- enum:
260
- - pending_approval
261
- - approved
262
- - denied
263
- description: The current status of the approval request
264
- approval_id:
265
- type: string
266
- description: Unique identifier for the approval request
267
- approval_url:
268
- type: string
269
- description: URL for the user to visit and approve/deny the request
270
- poll_url:
271
- type: string
272
- description: URL for the SDK to poll for status changes
273
- required:
274
- - status
275
- - approval_id
276
414
  AuthenticationItem:
277
415
  type: object
278
416
  properties:
@@ -1268,6 +1406,49 @@ paths:
1268
1406
  application/json: &a7
1269
1407
  schema:
1270
1408
  $ref: "#/components/schemas/ErrorsResponse"
1409
+ /api/v0/approvals:
1410
+ post:
1411
+ summary: Create an approval request
1412
+ 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.
1413
+ tags:
1414
+ - Approvals
1415
+ operationId: v0_create_approval
1416
+ security:
1417
+ - userJwt: []
1418
+ requestBody:
1419
+ content:
1420
+ application/json:
1421
+ schema:
1422
+ $ref: "#/components/schemas/CreateApprovalBody"
1423
+ responses:
1424
+ "202":
1425
+ description: Approval request created
1426
+ content:
1427
+ application/json:
1428
+ schema:
1429
+ $ref: "#/components/schemas/ApprovalResponse"
1430
+ "400":
1431
+ description: Bad Request
1432
+ content:
1433
+ application/json: *a1
1434
+ "401":
1435
+ description: Unauthorized
1436
+ content:
1437
+ application/json: *a2
1438
+ "429":
1439
+ description: Too Many Requests
1440
+ headers: *a3
1441
+ content:
1442
+ application/json: *a4
1443
+ "500":
1444
+ description: Server Error
1445
+ content:
1446
+ application/json: *a5
1447
+ "503":
1448
+ description: Service Unavailable
1449
+ headers: *a6
1450
+ content:
1451
+ application/json: *a7
1271
1452
  /api/v0/client-credentials:
1272
1453
  post:
1273
1454
  summary: Create client credentials
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-core",
3
- "version": "0.11.0",
3
+ "version": "0.13.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.",
@@ -88,6 +88,7 @@
88
88
  "LICENSE"
89
89
  ],
90
90
  "dependencies": {
91
+ "@zapier/policy-context": "1.1.0",
91
92
  "zod": "4.3.6"
92
93
  },
93
94
  "devDependencies": {