@primitivedotdev/sdk 0.8.0 → 0.10.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/README.md +22 -0
- package/dist/{address-parser-CfPHs3mE.js → address-parser-BYn8oW5r.js} +1 -3
- package/dist/api/generated/index.js +1 -1
- package/dist/api/generated/sdk.gen.js +26 -0
- package/dist/api/index.d.ts +2 -4
- package/dist/api/index.js +72 -33
- package/dist/{api-BH8PnmHs.js → api-CLLpjjWy.js} +142 -113
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/contract/index.d.ts +6 -9
- package/dist/contract/index.js +28 -17
- package/dist/{index-CuuP1JkG.d.ts → index-CbEivn3S.d.ts} +7 -31
- package/dist/{index-D9lanVFt.d.ts → index-K4KbjppU.d.ts} +266 -56
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -8
- package/dist/oclif/api-command.js +89 -1
- package/dist/openapi/index.d.ts +8 -3
- package/dist/openapi/openapi.generated.js +191 -5
- package/dist/openapi/operations.generated.js +288 -0
- package/dist/parser/index.d.ts +4 -19
- package/dist/parser/index.js +7 -18
- package/dist/{received-email-Q6Cha3wc.js → received-email-D6tKtWwW.js} +2 -4
- package/dist/{received-email-C67Z7Dha.d.ts → received-email-DNjpq_Wt.d.ts} +4 -3
- package/dist/{types-CIOzt1FY.d.ts → types-9vXGZjPd.d.ts} +3 -19
- package/dist/webhook/index.d.ts +3 -3
- package/dist/webhook/index.js +3 -5
- package/dist/{webhook-2TALcBQz.js → webhook-zkN4wUTs.js} +107 -84
- package/oclif.manifest.json +63 -9
- package/package.json +2 -2
- package/dist/chunk-Cl8Af3a2.js +0 -11
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReceivedEmail } from "./received-email-
|
|
1
|
+
import { N as WebhookEvent, j as ValidateEmailAuthResult, l as EmailAuth, u as EmailReceivedEvent } from "./types-9vXGZjPd.js";
|
|
2
|
+
import { t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
|
|
3
3
|
import { ErrorObject } from "ajv";
|
|
4
4
|
|
|
5
5
|
//#region src/webhook/errors.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Verification error definitions.
|
|
8
|
-
* Use these for documentation, dashboards, and i18n.
|
|
9
|
-
*/
|
|
10
6
|
/**
|
|
11
7
|
* Verification error definitions.
|
|
12
8
|
* Use these for documentation, dashboards, and i18n.
|
|
@@ -211,7 +207,8 @@ declare class RawEmailDecodeError extends PrimitiveWebhookError {
|
|
|
211
207
|
readonly code: RawEmailDecodeErrorCode;
|
|
212
208
|
readonly suggestion: string;
|
|
213
209
|
constructor(code: RawEmailDecodeErrorCode, message?: string);
|
|
214
|
-
}
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
215
212
|
//#region src/validation.d.ts
|
|
216
213
|
interface ValidationSuccess<T> {
|
|
217
214
|
success: true;
|
|
@@ -224,7 +221,6 @@ interface ValidationFailure {
|
|
|
224
221
|
type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
|
|
225
222
|
declare function validateEmailReceivedEvent(input: unknown): EmailReceivedEvent;
|
|
226
223
|
declare function safeValidateEmailReceivedEvent(input: unknown): ValidationResult<EmailReceivedEvent>;
|
|
227
|
-
|
|
228
224
|
//#endregion
|
|
229
225
|
//#region src/webhook/download-tokens.d.ts
|
|
230
226
|
/**
|
|
@@ -313,7 +309,6 @@ type VerifyDownloadTokenResult = {
|
|
|
313
309
|
* @returns Whether the token is valid, plus a reason on failure.
|
|
314
310
|
*/
|
|
315
311
|
declare function verifyDownloadToken(params: VerifyDownloadTokenOptions): VerifyDownloadTokenResult;
|
|
316
|
-
|
|
317
312
|
//#endregion
|
|
318
313
|
//#region src/webhook/signing.d.ts
|
|
319
314
|
/**
|
|
@@ -406,7 +401,6 @@ declare function signWebhookPayload(rawBody: string | Buffer, secret: string | B
|
|
|
406
401
|
* ```
|
|
407
402
|
*/
|
|
408
403
|
declare function verifyWebhookSignature(opts: VerifyOptions): true;
|
|
409
|
-
|
|
410
404
|
//#endregion
|
|
411
405
|
//#region src/webhook/standard-webhooks.d.ts
|
|
412
406
|
/**
|
|
@@ -458,15 +452,6 @@ interface StandardWebhooksVerifyOptions {
|
|
|
458
452
|
/** Override current time for testing (unix seconds) */
|
|
459
453
|
nowSeconds?: number;
|
|
460
454
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Prepare a Standard Webhooks secret for HMAC computation.
|
|
463
|
-
*
|
|
464
|
-
* Strips the "whsec_" prefix if present, then base64-decodes the remainder
|
|
465
|
-
* to produce the raw HMAC key bytes.
|
|
466
|
-
*
|
|
467
|
-
* @internal
|
|
468
|
-
*/
|
|
469
|
-
|
|
470
455
|
/**
|
|
471
456
|
* Sign a webhook payload using the Standard Webhooks format.
|
|
472
457
|
*
|
|
@@ -482,7 +467,6 @@ declare function signStandardWebhooksPayload(rawBody: string | Buffer, secret: s
|
|
|
482
467
|
* Throws `WebhookVerificationError` on failure with a specific error code.
|
|
483
468
|
*/
|
|
484
469
|
declare function verifyStandardWebhooksSignature(opts: StandardWebhooksVerifyOptions): true;
|
|
485
|
-
|
|
486
470
|
//#endregion
|
|
487
471
|
//#region src/schema.generated.d.ts
|
|
488
472
|
/**
|
|
@@ -1274,7 +1258,8 @@ declare const emailReceivedEventJsonSchema: {
|
|
|
1274
1258
|
readonly description: "DKIM signature verification result for a single signature.";
|
|
1275
1259
|
};
|
|
1276
1260
|
};
|
|
1277
|
-
};
|
|
1261
|
+
};
|
|
1262
|
+
//#endregion
|
|
1278
1263
|
//#region src/webhook/auth.d.ts
|
|
1279
1264
|
/**
|
|
1280
1265
|
* Validate email authentication and compute a verdict.
|
|
@@ -1336,7 +1321,6 @@ declare const emailReceivedEventJsonSchema: {
|
|
|
1336
1321
|
* ```
|
|
1337
1322
|
*/
|
|
1338
1323
|
declare function validateEmailAuth(auth: EmailAuth): ValidateEmailAuthResult;
|
|
1339
|
-
|
|
1340
1324
|
//#endregion
|
|
1341
1325
|
//#region src/webhook/version.d.ts
|
|
1342
1326
|
/**
|
|
@@ -1352,15 +1336,8 @@ declare function validateEmailAuth(auth: EmailAuth): ValidateEmailAuthResult;
|
|
|
1352
1336
|
* need to handle version-specific behavior.
|
|
1353
1337
|
*/
|
|
1354
1338
|
declare const WEBHOOK_VERSION = "2025-12-14";
|
|
1355
|
-
|
|
1356
1339
|
//#endregion
|
|
1357
1340
|
//#region src/webhook/index.d.ts
|
|
1358
|
-
/**
|
|
1359
|
-
* Valid webhook version format (YYYY-MM-DD date string).
|
|
1360
|
-
* The SDK accepts any valid date-formatted version, not just the current one,
|
|
1361
|
-
* for forward and backward compatibility.
|
|
1362
|
-
*/
|
|
1363
|
-
|
|
1364
1341
|
/**
|
|
1365
1342
|
* Parse a webhook payload, returning typed events for known types
|
|
1366
1343
|
* and UnknownEvent for future event types.
|
|
@@ -1646,6 +1623,5 @@ declare function decodeRawEmail(event: EmailReceivedEvent, options?: DecodeRawEm
|
|
|
1646
1623
|
* ```
|
|
1647
1624
|
*/
|
|
1648
1625
|
declare function verifyRawEmailDownload(downloaded: Buffer | ArrayBuffer | Uint8Array, event: EmailReceivedEvent): Buffer;
|
|
1649
|
-
|
|
1650
1626
|
//#endregion
|
|
1651
|
-
export {
|
|
1627
|
+
export { VerifyOptions as A, PAYLOAD_ERRORS as B, signStandardWebhooksPayload as C, PRIMITIVE_CONFIRMED_HEADER as D, LEGACY_SIGNATURE_HEADER as E, VerifyDownloadTokenResult as F, VERIFICATION_ERRORS as G, RAW_EMAIL_ERRORS as H, generateDownloadToken as I, WebhookPayloadErrorCode as J, WebhookErrorCode as K, verifyDownloadToken as L, verifyWebhookSignature as M, GenerateDownloadTokenOptions as N, PRIMITIVE_SIGNATURE_HEADER as O, VerifyDownloadTokenOptions as P, WebhookVerificationErrorCode as Q, safeValidateEmailReceivedEvent as R, StandardWebhooksVerifyOptions as S, LEGACY_CONFIRMED_HEADER as T, RawEmailDecodeError as U, PrimitiveWebhookError as V, RawEmailDecodeErrorCode as W, WebhookValidationErrorCode as X, WebhookValidationError as Y, WebhookVerificationError as Z, emailReceivedEventJsonSchema as _, confirmedHeaders as a, STANDARD_WEBHOOK_TIMESTAMP_HEADER as b, handleWebhook as c, isRawIncluded as d, parseWebhookEvent as f, validateEmailAuth as g, WEBHOOK_VERSION as h, WebhookHeaders as i, signWebhookPayload as j, SignResult as k, isDownloadExpired as l, verifyRawEmailDownload as m, HandleWebhookOptions as n, decodeRawEmail as o, receive as p, WebhookPayloadError as q, ReceiveRequestOptions as r, getDownloadTimeRemaining as s, DecodeRawEmailOptions as t, isEmailReceivedEvent as u, STANDARD_WEBHOOK_ID_HEADER as v, verifyStandardWebhooksSignature as w, StandardWebhooksSignResult as x, STANDARD_WEBHOOK_SIGNATURE_HEADER as y, validateEmailReceivedEvent as z };
|