@oneaddress/partner-sdk 1.6.1 → 1.6.3
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 +123 -0
- package/README.md +25 -12
- package/dist/index.d.mts +35 -8
- package/dist/index.d.ts +35 -8
- package/package.json +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,129 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.6.3] - 2026-08-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **A CommonJS TypeScript project could not resolve the types at all.** Found
|
|
15
|
+
by scaffolding `npx @oneaddress/setup`'s own `ts-node` template and running
|
|
16
|
+
`tsc` on what it produced:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/server.ts(32,8): error TS1479: The current file is a CommonJS module
|
|
20
|
+
whose imports will produce 'require' calls; however, the referenced file is
|
|
21
|
+
an ECMAScript module and cannot be imported with 'require'.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The cause was the SHAPE of the exports map, not a missing file. `types` sat
|
|
25
|
+
at the top of the `"."` condition pointing at `index.d.mts`, so a `require`
|
|
26
|
+
consumer matched the runtime on `index.js` (correct, CommonJS) and the types
|
|
27
|
+
on `index.d.mts` (ESM). **`dist/index.d.ts` was being built and published the
|
|
28
|
+
whole time and was simply unreachable.** Conditions now nest, with `types`
|
|
29
|
+
inside `import` and `require`, one declaration file per format.
|
|
30
|
+
|
|
31
|
+
Runtime was never affected: `require('@oneaddress/partner-sdk')` returned all
|
|
32
|
+
34 exports before this change and returns them after. Only type resolution
|
|
33
|
+
was broken, which is why it survived — and our own setup wizard emits a
|
|
34
|
+
CommonJS project, so the scaffolded happy path produced the one configuration
|
|
35
|
+
that fails.
|
|
36
|
+
|
|
37
|
+
Note TS1479's own suggested remedies make it worse here. "Use a dynamic
|
|
38
|
+
`import()`" and "add `type: module`" are advice for a package that is
|
|
39
|
+
genuinely ESM-only, and this one is dual-format.
|
|
40
|
+
|
|
41
|
+
**This is the second time the published declarations have been unusable to
|
|
42
|
+
TypeScript partners while every runtime path worked** (the first was
|
|
43
|
+
`TS2307` on unresolved workspace re-exports, 27 Jul 2026). Both were
|
|
44
|
+
invisible from inside the monorepo, where every test imports from source and
|
|
45
|
+
both apps are ESM. `src/dist-exports.test.ts` now compiles a real CommonJS
|
|
46
|
+
consumer and a real ESM consumer against the built artifacts, rather than
|
|
47
|
+
asserting on the shape of the JSON — the resolution rules connecting an
|
|
48
|
+
exports map to "a partner can type-check" are precisely the part that was got
|
|
49
|
+
wrong. Mutation-checked: restoring the old map reproduces TS1479 on the
|
|
50
|
+
CommonJS case and leaves the ESM case green.
|
|
51
|
+
|
|
52
|
+
## [1.6.2] - 2026-08-21
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- **The quick start did not compile.** The first code block in the README — the
|
|
57
|
+
one every partner copies — read `event.customer.name`,
|
|
58
|
+
`event.customer.known_names`, and passed `event.customer.account_number` into
|
|
59
|
+
a `(n: string)` parameter. `customer` is `customer?:` on the address events
|
|
60
|
+
(it is absent entirely under blind-index matching) and `account_number` is
|
|
61
|
+
`string | null`, so compiled verbatim under `strict` that block is four
|
|
62
|
+
errors: three `TS18048: 'event.customer' is possibly 'undefined'` and one
|
|
63
|
+
`TS2345: 'string | null' is not assignable to 'string'`.
|
|
64
|
+
|
|
65
|
+
Marlowe wrote JavaScript throughout the engagement and so never met it, which
|
|
66
|
+
is why 126 issues over seven days did not surface the opening example of the
|
|
67
|
+
document being unbuildable for a TypeScript partner.
|
|
68
|
+
|
|
69
|
+
The narrowing is now shown rather than elided, because **both checks are real
|
|
70
|
+
rather than defensive noise** and a reader who deletes them gets the errors
|
|
71
|
+
back. The same fix is applied to the account-verify, D5 and KMS examples.
|
|
72
|
+
|
|
73
|
+
- **The SDK's own doc comments carried the same two mistakes, in the
|
|
74
|
+
higher-traffic copy.** `src/index.ts` is what an editor shows on hover and on
|
|
75
|
+
autocomplete, so a partner meets it without opening the README:
|
|
76
|
+
- `confirmUpdate`'s `@example` passed `dispatchId: event.dispatch_id`, and the
|
|
77
|
+
prose above `ConfirmUpdateOptions.dispatchId` stated in plain English that
|
|
78
|
+
the handler "surfaces it as `event.dispatch_id`". It does not, and never
|
|
79
|
+
did. Fixing the README and leaving this is how one bug gets reported twice.
|
|
80
|
+
- The module-level usage example dereferenced `event.customer` unguarded,
|
|
81
|
+
exactly as the quick start did.
|
|
82
|
+
|
|
83
|
+
- **The module-level usage example told partners to do the thing the README
|
|
84
|
+
spends a paragraph warning against.** It showed
|
|
85
|
+
`app.post('/webhook/oneaddress', express.raw(...), handler)` — passing the
|
|
86
|
+
Fetch-shaped handler straight into Express, which throws `req.text is not a
|
|
87
|
+
function` on the first delivery. It now shows `toExpressHandler(handler)` and
|
|
88
|
+
says why the adapter exists.
|
|
89
|
+
|
|
90
|
+
- **`transformAddress`'s example keyed a datastore on a field that is always
|
|
91
|
+
empty.** It called `db.storeEncryptedAddress(event.customer.email, kmsBlob)`.
|
|
92
|
+
`customer.email` is `''` on every dispatch (OneAddress never learns a
|
|
93
|
+
consumer's email for a dispatch it is not sent for) — a fact stated twelve
|
|
94
|
+
hundred lines above in the same file. Copied as written, that files every
|
|
95
|
+
address under one empty-string row, with no error and no exception: it works,
|
|
96
|
+
and it is wrong. Now keys on `account_number`.
|
|
97
|
+
|
|
98
|
+
`src/readme-event-fields.test.ts` was widened to cover both files and to fail
|
|
99
|
+
on an optional event field dereferenced without narrowing, not just on a field
|
|
100
|
+
that does not exist.
|
|
101
|
+
|
|
102
|
+
- **The README's `confirmUpdate` examples read a field that does not exist.**
|
|
103
|
+
Both passed `dispatchId: event.dispatch_id`. The field is **`event.dispatchId`**.
|
|
104
|
+
`event.dispatch_id` is `undefined`, so `confirmUpdate` refuses to send and
|
|
105
|
+
returns `{ ok: false, error: 'dispatchId must be a positive integer, received
|
|
106
|
+
undefined' }`. It fails safely, and it fails — in the flagship snippet of the
|
|
107
|
+
section written to stop partners hand-rolling the confirm callback.
|
|
108
|
+
|
|
109
|
+
The README used the correct spelling five times elsewhere, so it contradicted
|
|
110
|
+
itself, and the wrong one was in the example most likely to be copied.
|
|
111
|
+
|
|
112
|
+
**Why the mistake is easy to make, which is the part worth knowing:** the
|
|
113
|
+
event object deliberately mixes naming conventions. `partner_id`, `loa_ref`,
|
|
114
|
+
`batch_id` and `user_id` are wire fields passed through as they arrive;
|
|
115
|
+
**`dispatchId` is camelCase because it is derived from the
|
|
116
|
+
`X-OneAddress-Dispatch` HEADER, not from the body.** Nothing on the page said
|
|
117
|
+
so, so both spellings looked equally plausible.
|
|
118
|
+
|
|
119
|
+
Now guarded by `src/readme-event-fields.test.ts`, which parses the field names
|
|
120
|
+
off the four event interfaces and fails if the README reads one that is not
|
|
121
|
+
there. Parsed rather than hand-listed, because a hand-listed set stops
|
|
122
|
+
covering a field the moment one is added.
|
|
123
|
+
|
|
124
|
+
### Notes
|
|
125
|
+
|
|
126
|
+
- No runtime change. `confirmUpdate` was already correct: it coerces a string
|
|
127
|
+
`dispatchId` to a number, validates it is a positive integer, and posts the
|
|
128
|
+
number — `/api/confirm` requires a JSON integer and rejects a numeric string
|
|
129
|
+
with `400 dispatch_id must be a positive integer`. That coercion is exactly
|
|
130
|
+
what a hand-rolled confirm has to remember, and is the reason the helper
|
|
131
|
+
exists.
|
|
132
|
+
|
|
10
133
|
## [1.6.1] - 2026-08-21
|
|
11
134
|
|
|
12
135
|
### Fixed
|
package/README.md
CHANGED
|
@@ -34,8 +34,17 @@ export const handler = createOneAddressHandler({
|
|
|
34
34
|
// event.address is already decrypted. event.customer.email is always ''
|
|
35
35
|
// on this event (OneAddress never learns a consumer's email for a
|
|
36
36
|
// dispatch it isn't sent for) - match on account_number and/or name.
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
//
|
|
38
|
+
// BOTH CHECKS BELOW ARE REAL, not defensive noise. `customer` is absent
|
|
39
|
+
// entirely if you have opted into blind-index matching, and
|
|
40
|
+
// `account_number` is null when the consumer did not supply one. Under
|
|
41
|
+
// `strict` TypeScript neither compiles without narrowing.
|
|
42
|
+
const customer = event.customer;
|
|
43
|
+
if (!customer?.account_number) {
|
|
44
|
+
throw new Error('Dispatch carried no account number to match on');
|
|
45
|
+
}
|
|
46
|
+
const providedNames = [customer.name, ...customer.known_names];
|
|
47
|
+
const record = await db.findByAccountNumber(customer.account_number);
|
|
39
48
|
if (!record || !namePoolMatches(providedNames, record.fullName)) {
|
|
40
49
|
throw new Error('No matching customer for this dispatch');
|
|
41
50
|
}
|
|
@@ -134,7 +143,7 @@ if (!(await verifyD5LOA(loa, loaKey))) throw new Error('LOA signature invalid');
|
|
|
134
143
|
// a valid signed consent. It carries no name in the clear.
|
|
135
144
|
await confirmUpdate({
|
|
136
145
|
partnerId, secret: process.env.OA_CONFIRM_SECRET!,
|
|
137
|
-
dispatchId: event.
|
|
146
|
+
dispatchId: event.dispatchId,
|
|
138
147
|
status: 'confirmed', loaRef: d5LoaRef(loa),
|
|
139
148
|
});
|
|
140
149
|
```
|
|
@@ -258,7 +267,7 @@ import { confirmUpdate } from '@oneaddress/partner-sdk';
|
|
|
258
267
|
const res = await confirmUpdate({
|
|
259
268
|
partnerId: process.env.OA_PARTNER_ID!,
|
|
260
269
|
secret: process.env.OA_CONFIRM_SECRET!, // see "which secret" below
|
|
261
|
-
dispatchId: event.
|
|
270
|
+
dispatchId: event.dispatchId, // from X-OneAddress-Dispatch
|
|
262
271
|
status: 'confirmed',
|
|
263
272
|
note: 'Address updated in CRM',
|
|
264
273
|
});
|
|
@@ -303,7 +312,7 @@ async onUpdate(event) {
|
|
|
303
312
|
if (seen) return; // idempotent no-op
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
await db.updateAddress({ accountNumber: event.customer
|
|
315
|
+
await db.updateAddress({ accountNumber: event.customer?.account_number, ...event.address });
|
|
307
316
|
|
|
308
317
|
if (event.dispatchId) {
|
|
309
318
|
await db.dispatches.insert({ dispatchId: event.dispatchId });
|
|
@@ -345,7 +354,7 @@ export const handler = createOneAddressHandler({
|
|
|
345
354
|
}),
|
|
346
355
|
|
|
347
356
|
async onUpdate(event) {
|
|
348
|
-
await db.updateAddress({ accountNumber: event.customer
|
|
357
|
+
await db.updateAddress({ accountNumber: event.customer?.account_number, ...event.address });
|
|
349
358
|
},
|
|
350
359
|
});
|
|
351
360
|
```
|
|
@@ -538,16 +547,20 @@ export const handler = createOneAddressHandler({
|
|
|
538
547
|
async onUpdate(event) { /* ... */ },
|
|
539
548
|
|
|
540
549
|
async onAccountVerify(event) {
|
|
541
|
-
// event.customer = { email, name, known_names, account_number }
|
|
550
|
+
// event.customer = { email, name, known_names, account_number }, and is
|
|
551
|
+
// OPTIONAL - absent under blind-index matching. Narrow once, then use it.
|
|
552
|
+
const customer = event.customer;
|
|
553
|
+
if (!customer) return { status: 'no_account' };
|
|
554
|
+
|
|
542
555
|
const row = await db.findCustomer({
|
|
543
|
-
accountNumber:
|
|
544
|
-
email:
|
|
556
|
+
accountNumber: customer.account_number,
|
|
557
|
+
email: customer.email,
|
|
545
558
|
});
|
|
546
559
|
|
|
547
560
|
if (!row) return { status: 'no_account' };
|
|
548
561
|
|
|
549
562
|
// Use namePoolMatches, not a naive string comparison - see "Name matching" above.
|
|
550
|
-
const providedNames = [
|
|
563
|
+
const providedNames = [customer.name, ...customer.known_names];
|
|
551
564
|
const nameOk = namePoolMatches(providedNames, row.full_name);
|
|
552
565
|
|
|
553
566
|
return nameOk ? { status: 'match' } : { status: 'no_match' };
|
|
@@ -647,7 +660,7 @@ async onUpdate(event) {
|
|
|
647
660
|
event.partner_id,
|
|
648
661
|
process.env.KMS_PUBLIC_KEY_SPKI_PEM!, // your KMS/HSM SPKI PEM public key
|
|
649
662
|
);
|
|
650
|
-
await db.storeEncryptedAddress(event.customer
|
|
663
|
+
await db.storeEncryptedAddress(event.customer?.account_number, kmsBlob);
|
|
651
664
|
}
|
|
652
665
|
```
|
|
653
666
|
|
|
@@ -676,7 +689,7 @@ async onUpdate(event) {
|
|
|
676
689
|
);
|
|
677
690
|
// Use event.customer (decrypted by the handler), not body.customer - under
|
|
678
691
|
// D5 the raw webhook body carries no cleartext customer block at all.
|
|
679
|
-
await db.storeEncryptedAddress(event.customer
|
|
692
|
+
await db.storeEncryptedAddress(event.customer?.account_number, kmsBlob);
|
|
680
693
|
}
|
|
681
694
|
```
|
|
682
695
|
|
package/dist/index.d.mts
CHANGED
|
@@ -95,20 +95,40 @@ declare const SUPPORTED_VERSIONS: readonly ["2026.1"];
|
|
|
95
95
|
* Official Node.js SDK for OneAddress partner integrations.
|
|
96
96
|
*
|
|
97
97
|
* Usage:
|
|
98
|
-
* import { createOneAddressHandler } from '@oneaddress/partner-sdk';
|
|
98
|
+
* import { createOneAddressHandler, toExpressHandler } from '@oneaddress/partner-sdk';
|
|
99
99
|
*
|
|
100
100
|
* export const handler = createOneAddressHandler({
|
|
101
101
|
* webhookSecret: process.env.OA_WEBHOOK_SECRET!,
|
|
102
102
|
* privateKeyPem: process.env.OA_PRIVATE_KEY_PEM!,
|
|
103
103
|
* async onUpdate(event) {
|
|
104
|
-
* //
|
|
105
|
-
*
|
|
104
|
+
* // `customer` is ABSENT under blind-index matching and `account_number`
|
|
105
|
+
* // is null when the consumer supplied none, so both checks are real
|
|
106
|
+
* // rather than defensive noise: under `strict` this does not compile
|
|
107
|
+
* // without them. `email` is always '' here - match on account_number
|
|
108
|
+
* // and/or name.
|
|
109
|
+
* const customer = event.customer;
|
|
110
|
+
* if (!customer?.account_number) throw new Error('no account number to match on');
|
|
111
|
+
* const record = await db.findByAccountNumber(customer.account_number);
|
|
112
|
+
* if (!record) throw new Error('no matching customer');
|
|
106
113
|
* await db.updateAddress({ id: record.id, ...event.address });
|
|
107
114
|
* },
|
|
108
115
|
* });
|
|
109
116
|
*
|
|
110
|
-
* //
|
|
111
|
-
* //
|
|
117
|
+
* // Next.js App Router: export { handler as POST };
|
|
118
|
+
* //
|
|
119
|
+
* // Express needs the adapter. The handler is Fetch-shaped (it reads
|
|
120
|
+
* // req.text() and returns a Response), which is what lets one piece of code
|
|
121
|
+
* // run on App Router, Workers, Deno and Bun; Express gives neither, so
|
|
122
|
+
* // passing `handler` in directly throws "req.text is not a function" on
|
|
123
|
+
* // your first delivery. express.raw on this route is also not optional:
|
|
124
|
+
* // the signature is an HMAC over the raw bytes, and express.json() has
|
|
125
|
+
* // already thrown them away.
|
|
126
|
+
* //
|
|
127
|
+
* // app.post(
|
|
128
|
+
* // '/webhook/oneaddress',
|
|
129
|
+
* // express.raw({ type: 'application/json' }),
|
|
130
|
+
* // toExpressHandler(handler),
|
|
131
|
+
* // );
|
|
112
132
|
*/
|
|
113
133
|
|
|
114
134
|
/**
|
|
@@ -814,7 +834,10 @@ declare function decryptSession(share: SessionKeyShare, envelopeB64: string, pri
|
|
|
814
834
|
* event.partner_id,
|
|
815
835
|
* process.env.KMS_PUBLIC_KEY_SPKI_PEM!,
|
|
816
836
|
* );
|
|
817
|
-
*
|
|
837
|
+
* // Key on the account number, NOT on `customer.email`: that field is always
|
|
838
|
+
* // '' on a dispatch, so keying on it files every partner's addresses under
|
|
839
|
+
* // one empty-string row, silently and without an error.
|
|
840
|
+
* await db.storeEncryptedAddress(event.customer?.account_number, kmsBlob);
|
|
818
841
|
*/
|
|
819
842
|
declare function transformAddress(payload: EncryptedPayload, privateKeyPem: string, partnerId: string, recipientSpkiPem: string): Promise<EncryptedPayload>;
|
|
820
843
|
/**
|
|
@@ -884,7 +907,11 @@ interface ConfirmUpdateOptions {
|
|
|
884
907
|
* From the `X-OneAddress-Dispatch` header on the webhook you are confirming.
|
|
885
908
|
*
|
|
886
909
|
* Not in the body and not in the envelope: capture it when the request
|
|
887
|
-
* arrives. `createOneAddressHandler` surfaces it as `event.
|
|
910
|
+
* arrives. `createOneAddressHandler` surfaces it as `event.dispatchId` -
|
|
911
|
+
* camelCase, unlike the snake_case wire fields beside it, precisely because
|
|
912
|
+
* it is header-derived rather than part of the body. There is no snake_case
|
|
913
|
+
* twin of it on the event; reading one yields `undefined` and this helper
|
|
914
|
+
* then refuses to send.
|
|
888
915
|
*/
|
|
889
916
|
dispatchId: number | string;
|
|
890
917
|
/** Defaults to `'confirmed'`. See {@link OneAddressConfirmStatus}. */
|
|
@@ -941,7 +968,7 @@ interface ConfirmUpdateResult {
|
|
|
941
968
|
* const res = await confirmUpdate({
|
|
942
969
|
* partnerId: process.env.OA_PARTNER_ID!,
|
|
943
970
|
* secret: process.env.OA_CONFIRM_SECRET!,
|
|
944
|
-
* dispatchId: event.
|
|
971
|
+
* dispatchId: event.dispatchId,
|
|
945
972
|
* status: 'confirmed',
|
|
946
973
|
* note: 'Address updated in CRM',
|
|
947
974
|
* });
|
package/dist/index.d.ts
CHANGED
|
@@ -95,20 +95,40 @@ declare const SUPPORTED_VERSIONS: readonly ["2026.1"];
|
|
|
95
95
|
* Official Node.js SDK for OneAddress partner integrations.
|
|
96
96
|
*
|
|
97
97
|
* Usage:
|
|
98
|
-
* import { createOneAddressHandler } from '@oneaddress/partner-sdk';
|
|
98
|
+
* import { createOneAddressHandler, toExpressHandler } from '@oneaddress/partner-sdk';
|
|
99
99
|
*
|
|
100
100
|
* export const handler = createOneAddressHandler({
|
|
101
101
|
* webhookSecret: process.env.OA_WEBHOOK_SECRET!,
|
|
102
102
|
* privateKeyPem: process.env.OA_PRIVATE_KEY_PEM!,
|
|
103
103
|
* async onUpdate(event) {
|
|
104
|
-
* //
|
|
105
|
-
*
|
|
104
|
+
* // `customer` is ABSENT under blind-index matching and `account_number`
|
|
105
|
+
* // is null when the consumer supplied none, so both checks are real
|
|
106
|
+
* // rather than defensive noise: under `strict` this does not compile
|
|
107
|
+
* // without them. `email` is always '' here - match on account_number
|
|
108
|
+
* // and/or name.
|
|
109
|
+
* const customer = event.customer;
|
|
110
|
+
* if (!customer?.account_number) throw new Error('no account number to match on');
|
|
111
|
+
* const record = await db.findByAccountNumber(customer.account_number);
|
|
112
|
+
* if (!record) throw new Error('no matching customer');
|
|
106
113
|
* await db.updateAddress({ id: record.id, ...event.address });
|
|
107
114
|
* },
|
|
108
115
|
* });
|
|
109
116
|
*
|
|
110
|
-
* //
|
|
111
|
-
* //
|
|
117
|
+
* // Next.js App Router: export { handler as POST };
|
|
118
|
+
* //
|
|
119
|
+
* // Express needs the adapter. The handler is Fetch-shaped (it reads
|
|
120
|
+
* // req.text() and returns a Response), which is what lets one piece of code
|
|
121
|
+
* // run on App Router, Workers, Deno and Bun; Express gives neither, so
|
|
122
|
+
* // passing `handler` in directly throws "req.text is not a function" on
|
|
123
|
+
* // your first delivery. express.raw on this route is also not optional:
|
|
124
|
+
* // the signature is an HMAC over the raw bytes, and express.json() has
|
|
125
|
+
* // already thrown them away.
|
|
126
|
+
* //
|
|
127
|
+
* // app.post(
|
|
128
|
+
* // '/webhook/oneaddress',
|
|
129
|
+
* // express.raw({ type: 'application/json' }),
|
|
130
|
+
* // toExpressHandler(handler),
|
|
131
|
+
* // );
|
|
112
132
|
*/
|
|
113
133
|
|
|
114
134
|
/**
|
|
@@ -814,7 +834,10 @@ declare function decryptSession(share: SessionKeyShare, envelopeB64: string, pri
|
|
|
814
834
|
* event.partner_id,
|
|
815
835
|
* process.env.KMS_PUBLIC_KEY_SPKI_PEM!,
|
|
816
836
|
* );
|
|
817
|
-
*
|
|
837
|
+
* // Key on the account number, NOT on `customer.email`: that field is always
|
|
838
|
+
* // '' on a dispatch, so keying on it files every partner's addresses under
|
|
839
|
+
* // one empty-string row, silently and without an error.
|
|
840
|
+
* await db.storeEncryptedAddress(event.customer?.account_number, kmsBlob);
|
|
818
841
|
*/
|
|
819
842
|
declare function transformAddress(payload: EncryptedPayload, privateKeyPem: string, partnerId: string, recipientSpkiPem: string): Promise<EncryptedPayload>;
|
|
820
843
|
/**
|
|
@@ -884,7 +907,11 @@ interface ConfirmUpdateOptions {
|
|
|
884
907
|
* From the `X-OneAddress-Dispatch` header on the webhook you are confirming.
|
|
885
908
|
*
|
|
886
909
|
* Not in the body and not in the envelope: capture it when the request
|
|
887
|
-
* arrives. `createOneAddressHandler` surfaces it as `event.
|
|
910
|
+
* arrives. `createOneAddressHandler` surfaces it as `event.dispatchId` -
|
|
911
|
+
* camelCase, unlike the snake_case wire fields beside it, precisely because
|
|
912
|
+
* it is header-derived rather than part of the body. There is no snake_case
|
|
913
|
+
* twin of it on the event; reading one yields `undefined` and this helper
|
|
914
|
+
* then refuses to send.
|
|
888
915
|
*/
|
|
889
916
|
dispatchId: number | string;
|
|
890
917
|
/** Defaults to `'confirmed'`. See {@link OneAddressConfirmStatus}. */
|
|
@@ -941,7 +968,7 @@ interface ConfirmUpdateResult {
|
|
|
941
968
|
* const res = await confirmUpdate({
|
|
942
969
|
* partnerId: process.env.OA_PARTNER_ID!,
|
|
943
970
|
* secret: process.env.OA_CONFIRM_SECRET!,
|
|
944
|
-
* dispatchId: event.
|
|
971
|
+
* dispatchId: event.dispatchId,
|
|
945
972
|
* status: 'confirmed',
|
|
946
973
|
* note: 'Address updated in CRM',
|
|
947
974
|
* });
|
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneaddress/partner-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Official OneAddress partner integration SDK — webhook verification, address decryption (legacy + D5 session-envelope), LOA validation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/index.d.mts",
|
|
11
|
+
"default": "./dist/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
12
17
|
},
|
|
13
18
|
"./edge": {
|
|
14
|
-
"
|
|
15
|
-
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./dist/edge.d.mts",
|
|
21
|
+
"default": "./dist/edge.mjs"
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
},
|
|
18
25
|
"files": [
|