@primitivedotdev/sdk 0.5.1 → 0.6.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/dist/contract/index.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ declare function generateEventId(endpoint_id: string, email_id: string): string;
|
|
|
102
102
|
* result against the generated JSON Schema before returning.
|
|
103
103
|
*
|
|
104
104
|
* @param input - Producer-side data for the webhook payload.
|
|
105
|
-
* @param options - Optional overrides for
|
|
105
|
+
* @param options - Optional overrides for the attempted-at timestamp.
|
|
106
106
|
* @returns A fully constructed, schema-valid `EmailReceivedEvent`.
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
@@ -142,8 +142,6 @@ declare function generateEventId(endpoint_id: string, email_id: string): string;
|
|
|
142
142
|
* ```
|
|
143
143
|
*/
|
|
144
144
|
declare function buildEmailReceivedEvent(input: EmailReceivedEventInput, options?: {
|
|
145
|
-
/** Override the generated event ID, typically for tests. */
|
|
146
|
-
event_id?: string;
|
|
147
145
|
/** Override the attempted-at timestamp, typically for tests. */
|
|
148
146
|
attempted_at?: string;
|
|
149
147
|
}): EmailReceivedEvent;
|
|
@@ -194,7 +192,6 @@ interface BuildEventFromParsedDataOptions {
|
|
|
194
192
|
dateHeader?: string | null;
|
|
195
193
|
/** Optional overrides forwarded to `buildEmailReceivedEvent`. */
|
|
196
194
|
buildOptions?: {
|
|
197
|
-
event_id?: string;
|
|
198
195
|
attempted_at?: string;
|
|
199
196
|
};
|
|
200
197
|
}
|
package/dist/contract/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function generateEventId(endpoint_id, email_id) {
|
|
|
51
51
|
* result against the generated JSON Schema before returning.
|
|
52
52
|
*
|
|
53
53
|
* @param input - Producer-side data for the webhook payload.
|
|
54
|
-
* @param options - Optional overrides for
|
|
54
|
+
* @param options - Optional overrides for the attempted-at timestamp.
|
|
55
55
|
* @returns A fully constructed, schema-valid `EmailReceivedEvent`.
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
@@ -91,7 +91,7 @@ function generateEventId(endpoint_id, email_id) {
|
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
93
|
function buildEmailReceivedEvent(input, options) {
|
|
94
|
-
const event_id =
|
|
94
|
+
const event_id = generateEventId(input.endpoint_id, input.email_id);
|
|
95
95
|
const attempted_at = options?.attempted_at ? validateTimestamp(options.attempted_at, "attempted_at") : new Date().toISOString();
|
|
96
96
|
const raw_size_bytes = input.raw_bytes.length;
|
|
97
97
|
if (input.raw_size_bytes !== raw_size_bytes) throw new Error(`[@primitivedotdev/sdk/contract] Invalid raw_size_bytes: ${input.raw_size_bytes}. Expected ${raw_size_bytes} based on raw_bytes length`);
|
package/oclif.manifest.json
CHANGED