@orangecheck/me-client 0.25.3 → 0.26.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/index.d.mts CHANGED
@@ -87,6 +87,7 @@ interface FireEventOptions {
87
87
  metadata?: Record<string, unknown>;
88
88
  is_agent?: boolean;
89
89
  signingSecret?: string;
90
+ userAddress?: string;
90
91
  bearerToken?: string;
91
92
  idempotencyKey?: string;
92
93
  }
package/dist/index.d.ts CHANGED
@@ -87,6 +87,7 @@ interface FireEventOptions {
87
87
  metadata?: Record<string, unknown>;
88
88
  is_agent?: boolean;
89
89
  signingSecret?: string;
90
+ userAddress?: string;
90
91
  bearerToken?: string;
91
92
  idempotencyKey?: string;
92
93
  }
package/dist/index.js CHANGED
@@ -362,6 +362,11 @@ async function fire(options) {
362
362
  if (!options.subtype) {
363
363
  throw new Error("event.fire requires subtype");
364
364
  }
365
+ if (options.userAddress && !options.signingSecret) {
366
+ throw new Error(
367
+ "event.fire: userAddress 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."
368
+ );
369
+ }
365
370
  const requestBody = {
366
371
  project_key: options.project_key,
367
372
  subtype: options.subtype
@@ -371,6 +376,7 @@ async function fire(options) {
371
376
  if (options.action_label !== void 0) requestBody.action_label = options.action_label;
372
377
  if (options.metadata !== void 0) requestBody.metadata = options.metadata;
373
378
  if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
379
+ if (options.userAddress !== void 0) requestBody.user_address = options.userAddress;
374
380
  const headers = {};
375
381
  if (options.idempotencyKey) headers["idempotency-key"] = options.idempotencyKey;
376
382
  if (options.signingSecret) {