@zapier/zapier-sdk-core 0.11.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,11 @@
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
+
3
9
  ## 0.11.0
4
10
 
5
11
  ### Minor Changes
package/openapi.yaml CHANGED
@@ -203,6 +203,139 @@ 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
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
206
339
  CreateClientCredentialsResponse:
207
340
  type: object
208
341
  properties:
@@ -251,28 +384,6 @@ components:
251
384
  - name
252
385
  - allowed_scopes
253
386
  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
387
  AuthenticationItem:
277
388
  type: object
278
389
  properties:
@@ -1268,6 +1379,49 @@ paths:
1268
1379
  application/json: &a7
1269
1380
  schema:
1270
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
1271
1425
  /api/v0/client-credentials:
1272
1426
  post:
1273
1427
  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.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.",