@primitivedotdev/sdk 0.18.0 → 0.19.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.
@@ -274,6 +274,183 @@ export const operationManifest = [
274
274
  "tag": "Account",
275
275
  "tagCommand": "account"
276
276
  },
277
+ {
278
+ "binaryResponse": false,
279
+ "bodyRequired": false,
280
+ "command": "cli-logout",
281
+ "description": "Revokes the API key used to authenticate the request. CLI clients use\nthis endpoint during `primitive logout` before removing local credentials.\n",
282
+ "hasJsonBody": true,
283
+ "method": "POST",
284
+ "operationId": "cliLogout",
285
+ "path": "/cli/logout",
286
+ "pathParams": [],
287
+ "queryParams": [],
288
+ "requestSchema": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "properties": {
292
+ "key_id": {
293
+ "type": "string",
294
+ "format": "uuid",
295
+ "description": "Optional key id guard; when provided it must match the authenticated API key"
296
+ }
297
+ }
298
+ },
299
+ "responseSchema": {
300
+ "type": "object",
301
+ "properties": {
302
+ "revoked": {
303
+ "type": "boolean",
304
+ "const": true
305
+ },
306
+ "key_id": {
307
+ "type": "string",
308
+ "format": "uuid"
309
+ }
310
+ },
311
+ "required": [
312
+ "revoked",
313
+ "key_id"
314
+ ]
315
+ },
316
+ "sdkName": "cliLogout",
317
+ "summary": "Revoke the current CLI API key",
318
+ "tag": "CLI",
319
+ "tagCommand": "cli"
320
+ },
321
+ {
322
+ "binaryResponse": false,
323
+ "bodyRequired": true,
324
+ "command": "poll-cli-login",
325
+ "description": "Polls a CLI login session until the browser approval either succeeds,\nis denied, expires, or is polled too quickly. The API key is generated\nonly after approval and is returned exactly once.\n",
326
+ "hasJsonBody": true,
327
+ "method": "POST",
328
+ "operationId": "pollCliLogin",
329
+ "path": "/cli/login/poll",
330
+ "pathParams": [],
331
+ "queryParams": [],
332
+ "requestSchema": {
333
+ "type": "object",
334
+ "additionalProperties": false,
335
+ "properties": {
336
+ "device_code": {
337
+ "type": "string",
338
+ "minLength": 1
339
+ }
340
+ },
341
+ "required": [
342
+ "device_code"
343
+ ]
344
+ },
345
+ "responseSchema": {
346
+ "type": "object",
347
+ "properties": {
348
+ "api_key": {
349
+ "type": "string",
350
+ "description": "Newly-created API key for CLI authentication"
351
+ },
352
+ "key_id": {
353
+ "type": "string",
354
+ "format": "uuid"
355
+ },
356
+ "key_prefix": {
357
+ "type": "string"
358
+ },
359
+ "org_id": {
360
+ "type": "string",
361
+ "format": "uuid"
362
+ },
363
+ "org_name": {
364
+ "type": [
365
+ "string",
366
+ "null"
367
+ ]
368
+ }
369
+ },
370
+ "required": [
371
+ "api_key",
372
+ "key_id",
373
+ "key_prefix",
374
+ "org_id",
375
+ "org_name"
376
+ ]
377
+ },
378
+ "sdkName": "pollCliLogin",
379
+ "summary": "Poll CLI browser login",
380
+ "tag": "CLI",
381
+ "tagCommand": "cli"
382
+ },
383
+ {
384
+ "binaryResponse": false,
385
+ "bodyRequired": false,
386
+ "command": "start-cli-login",
387
+ "description": "Starts a browser-assisted CLI login session. The response includes a\ndevice code for polling and a user code that the user approves in the\nbrowser. This endpoint does not require an API key.\n",
388
+ "hasJsonBody": true,
389
+ "method": "POST",
390
+ "operationId": "startCliLogin",
391
+ "path": "/cli/login/start",
392
+ "pathParams": [],
393
+ "queryParams": [],
394
+ "requestSchema": {
395
+ "type": "object",
396
+ "additionalProperties": false,
397
+ "properties": {
398
+ "device_name": {
399
+ "type": "string",
400
+ "minLength": 1,
401
+ "maxLength": 80,
402
+ "description": "Human-readable device name shown during browser approval"
403
+ },
404
+ "metadata": {
405
+ "type": "object",
406
+ "additionalProperties": true,
407
+ "description": "Optional client metadata stored with the login session; serialized JSON must be 2048 bytes or fewer"
408
+ }
409
+ }
410
+ },
411
+ "responseSchema": {
412
+ "type": "object",
413
+ "properties": {
414
+ "device_code": {
415
+ "type": "string",
416
+ "description": "Opaque code used by the CLI to poll for approval"
417
+ },
418
+ "user_code": {
419
+ "type": "string",
420
+ "pattern": "^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$",
421
+ "description": "Short code the user confirms in the browser"
422
+ },
423
+ "verification_uri": {
424
+ "type": "string",
425
+ "description": "Browser URL where the user approves the login"
426
+ },
427
+ "verification_uri_complete": {
428
+ "type": "string",
429
+ "description": "Browser URL with the user code prefilled"
430
+ },
431
+ "expires_in": {
432
+ "type": "integer",
433
+ "description": "Seconds until the login session expires"
434
+ },
435
+ "interval": {
436
+ "type": "integer",
437
+ "description": "Minimum seconds between poll requests"
438
+ }
439
+ },
440
+ "required": [
441
+ "device_code",
442
+ "user_code",
443
+ "verification_uri",
444
+ "verification_uri_complete",
445
+ "expires_in",
446
+ "interval"
447
+ ]
448
+ },
449
+ "sdkName": "startCliLogin",
450
+ "summary": "Start CLI browser login",
451
+ "tag": "CLI",
452
+ "tagCommand": "cli"
453
+ },
277
454
  {
278
455
  "binaryResponse": false,
279
456
  "bodyRequired": true,
@@ -668,7 +845,7 @@ export const operationManifest = [
668
845
  "binaryResponse": false,
669
846
  "bodyRequired": false,
670
847
  "command": "discard-email-content",
671
- "description": "Permanently deletes the email's raw bytes, parsed body (text + HTML),\nand attachments while preserving metadata (sender, recipient,\nsubject, timestamps, hashes, attachment manifest) for audit logs.\nIdempotent: a second call returns success with\n`already_discarded: true` and does no work.\n\n**Gated** on the customer's discard-content opt-in (managed in the\ndashboard at Settings > Webhooks). When the toggle is off, this\nendpoint returns `403` with code `discard_not_enabled` and a\nmessage pointing the human at the dashboard. There is intentionally\nno API to flip this toggle opting in to a destructive,\nnon-reversible operation must be a deliberate human click in the\nUI.\n",
848
+ "description": "Permanently deletes the email's raw bytes, parsed body (text + HTML),\nand attachments while preserving metadata (sender, recipient,\nsubject, timestamps, hashes, attachment manifest) for audit logs.\nIdempotent: a second call returns success with\n`already_discarded: true` and does no work.\n\n**Gated** on the customer's discard-content opt-in (managed in the\ndashboard at Settings > Webhooks). When the toggle is off, this\nendpoint returns `403` with code `discard_not_enabled` and a\nmessage pointing the human at the dashboard. There is intentionally\nno API to flip this toggle. Opting in to a destructive,\nnon-reversible operation must be a deliberate human click in the\nUI.\n",
672
849
  "hasJsonBody": false,
673
850
  "method": "POST",
674
851
  "operationId": "discardEmailContent",
@@ -1,4 +1,4 @@
1
1
  import { A as UnknownEvent, C as ParsedDataFailed, D as RawContentDownloadOnly, E as RawContent, M as WebhookAttachment, N as WebhookEvent, O as RawContentInline, S as ParsedDataComplete, T as ParsedStatus, _ as ForwardResultInline, a as DmarcPolicy, b as KnownWebhookEvent, c as EmailAnalysis, d as EventType, f as ForwardAnalysis, g as ForwardResultAttachmentSkipped, h as ForwardResultAttachmentAnalyzed, i as DkimSignature, j as ValidateEmailAuthResult, k as SpfResult, l as EmailAuth, m as ForwardResult, n as AuthVerdict, o as DmarcResult, p as ForwardOriginalSender, r as DkimResult, s as EmailAddress, t as AuthConfidence, u as EmailReceivedEvent, v as ForwardVerdict, w as ParsedError, x as ParsedData, y as ForwardVerification } from "../types-9vXGZjPd.js";
2
2
  import { a as buildReplySubject, c as parseHeaderAddress, i as buildForwardSubject, n as ReceivedEmailAddress, o as formatAddress, r as ReceivedEmailThread, s as normalizeReceivedEmail, t as ReceivedEmail } from "../received-email-DNjpq_Wt.js";
3
- import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "../index-CbEivn3S.js";
3
+ import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "../index-CDlwyxdp.js";
4
4
  export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, buildForwardSubject, buildReplySubject, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
@@ -1,3 +1,3 @@
1
1
  import { a as parseHeaderAddress, i as normalizeReceivedEmail, n as buildReplySubject, r as formatAddress, t as buildForwardSubject } from "../received-email-D6tKtWwW.js";
2
- import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "../webhook-zkN4wUTs.js";
2
+ import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "../webhook-rUjGV6Zu.js";
3
3
  export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, buildForwardSubject, buildReplySubject, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
@@ -6045,10 +6045,10 @@ function safeValidateEmailReceivedEvent(input) {
6045
6045
  * specific email's raw bytes or attachment bundle from a per-deployment
6046
6046
  * download endpoint. It binds:
6047
6047
  *
6048
- * - `email_id` the specific email the token authorizes.
6049
- * - `aud` a caller-chosen audience label (e.g. the resource kind being
6048
+ * - `email_id`: the specific email the token authorizes.
6049
+ * - `aud`: a caller-chosen audience label (e.g. the resource kind being
6050
6050
  * downloaded). Tokens minted for one audience will not verify under another.
6051
- * - `exp` an absolute expiration time (unix seconds).
6051
+ * - `exp`: an absolute expiration time (unix seconds).
6052
6052
  *
6053
6053
  * Format: `<base64url(payload)>.<base64url(signature)>` where `signature`
6054
6054
  * is HMAC-SHA256 over the base64url-encoded payload using the shared secret.
@@ -6087,7 +6087,7 @@ function generateDownloadToken(params) {
6087
6087
  * Verify a signed download token.
6088
6088
  *
6089
6089
  * Returns a discriminated-union result. The function never throws for
6090
- * verification failures only malformed inputs at the crypto layer would
6090
+ * verification failures. Only malformed inputs at the crypto layer would
6091
6091
  * surface. Callers should check `result.valid` and log `result.error`.
6092
6092
  *
6093
6093
  * @param params - Verification inputs.