@orangecheck/me-client 0.29.0 → 0.30.1
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 +2 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -354,9 +354,13 @@ async function fire(options) {
|
|
|
354
354
|
if (!options.subtype) {
|
|
355
355
|
throw new Error("event.fire requires subtype");
|
|
356
356
|
}
|
|
357
|
-
if (options.userAddress &&
|
|
357
|
+
if (options.accountId !== void 0 && options.userAddress !== void 0 && options.accountId !== options.userAddress) {
|
|
358
|
+
throw new Error("event.fire: accountId and userAddress name different earners");
|
|
359
|
+
}
|
|
360
|
+
const earner = options.accountId ?? options.userAddress;
|
|
361
|
+
if (earner && !options.signingSecret) {
|
|
358
362
|
throw new Error(
|
|
359
|
-
"event.fire:
|
|
363
|
+
"event.fire: accountId names who earns, so it requires signingSecret \u2014 the signature over the request body is what authorises that earner. Without the secret, pass bearerToken (or rely on the oc_session cookie) and the caller earns instead."
|
|
360
364
|
);
|
|
361
365
|
}
|
|
362
366
|
const requestBody = {
|
|
@@ -368,7 +372,7 @@ async function fire(options) {
|
|
|
368
372
|
if (options.action_label !== void 0) requestBody.action_label = options.action_label;
|
|
369
373
|
if (options.metadata !== void 0) requestBody.metadata = options.metadata;
|
|
370
374
|
if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
|
|
371
|
-
if (
|
|
375
|
+
if (earner !== void 0) requestBody.user_address = earner;
|
|
372
376
|
const headers = {};
|
|
373
377
|
if (options.idempotencyKey) headers["idempotency-key"] = options.idempotencyKey;
|
|
374
378
|
if (options.signingSecret) {
|