@relai-team/access-sdk 0.17.0 → 0.18.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/dist/index.cjs +7 -2
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -239,6 +239,7 @@ var HttpClient = class {
|
|
|
239
239
|
if (bearer) h["authorization"] = `Bearer ${bearer}`;
|
|
240
240
|
}
|
|
241
241
|
if (idem) h["idempotency-key"] = idem;
|
|
242
|
+
if (this.cfg.analytics === false) h["x-relai-analytics"] = "off";
|
|
242
243
|
return h;
|
|
243
244
|
}
|
|
244
245
|
async parseJson(res) {
|
|
@@ -772,7 +773,10 @@ async function deliverOpen(deps, open, opts) {
|
|
|
772
773
|
action: ack.accepted ? "unlock_used" : "unlock_failed",
|
|
773
774
|
result: ack.accepted ? "success" : "failure",
|
|
774
775
|
transport: "ble",
|
|
775
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
776
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
777
|
+
// The Parent's own reject reason, so a failure is diagnosable
|
|
778
|
+
// rather than merely counted.
|
|
779
|
+
...ack.accepted ? {} : { reason: ack.rejectReason ?? "UNKNOWN" }
|
|
776
780
|
}
|
|
777
781
|
]
|
|
778
782
|
}).catch(() => void 0);
|
|
@@ -808,7 +812,8 @@ var RelaiClient = class {
|
|
|
808
812
|
...options.publishableKey !== void 0 ? { publishableKey: options.publishableKey } : {},
|
|
809
813
|
...options.secretKey !== void 0 ? { secretKey: options.secretKey } : {},
|
|
810
814
|
...options.fetchImpl !== void 0 ? { fetchImpl: options.fetchImpl } : {},
|
|
811
|
-
...options.maxRetries !== void 0 ? { maxRetries: options.maxRetries } : {}
|
|
815
|
+
...options.maxRetries !== void 0 ? { maxRetries: options.maxRetries } : {},
|
|
816
|
+
...options.analytics !== void 0 ? { analytics: options.analytics } : {}
|
|
812
817
|
};
|
|
813
818
|
this.http = new HttpClient(httpConfig);
|
|
814
819
|
auth = new AuthModule(this.http, storage);
|
package/dist/index.d.cts
CHANGED
|
@@ -12,6 +12,8 @@ interface HttpConfig {
|
|
|
12
12
|
* client drops it so `auth.isSignedIn` goes false.
|
|
13
13
|
*/
|
|
14
14
|
onTokenInvalid?: () => void;
|
|
15
|
+
/** False opts the app out of product analytics; telemetry is unaffected. */
|
|
16
|
+
analytics?: boolean | undefined;
|
|
15
17
|
fetchImpl?: typeof fetch;
|
|
16
18
|
maxRetries?: number;
|
|
17
19
|
}
|
|
@@ -341,6 +343,26 @@ interface TelemetryEvent {
|
|
|
341
343
|
result: "success" | "failure";
|
|
342
344
|
transport?: "ble" | "simulated";
|
|
343
345
|
at: string;
|
|
346
|
+
/**
|
|
347
|
+
* WHY it failed, on a failure (owner, 2026-08-11).
|
|
348
|
+
*
|
|
349
|
+
* Without this an open that did not work is a number and nothing else: the
|
|
350
|
+
* platform could say how often opens fail and never why. It is the Parent's
|
|
351
|
+
* `[AUTH] REJECT` reason (`TAG`, `NONCE`, `NOTREADY`, …), an API error code,
|
|
352
|
+
* or a transport reason like `timeout` / `not_connected`.
|
|
353
|
+
*
|
|
354
|
+
* A bounded vocabulary matters more than richness here, because this is
|
|
355
|
+
* grouped and counted, not read. Never put a raw error message in it.
|
|
356
|
+
*/
|
|
357
|
+
reason?: string;
|
|
358
|
+
/**
|
|
359
|
+
* 1 for the first try, 2 for the first retry, and so on.
|
|
360
|
+
*
|
|
361
|
+
* `NOTREADY` is retryable (firmware 1.1.0), so without this a recovered open
|
|
362
|
+
* looks identical to one that worked first time and the retry can never be
|
|
363
|
+
* shown to be worth having.
|
|
364
|
+
*/
|
|
365
|
+
attempt?: number;
|
|
344
366
|
}
|
|
345
367
|
/** One page of orders, newest first. `next_cursor` is null on the last page. */
|
|
346
368
|
interface OrderPage {
|
|
@@ -1099,6 +1121,18 @@ interface RelaiClientOptions {
|
|
|
1099
1121
|
* new RelaiClient({ publishableKey, stripe: Stripe });
|
|
1100
1122
|
*/
|
|
1101
1123
|
stripe?: StripeSdk;
|
|
1124
|
+
/**
|
|
1125
|
+
* Send `false` to opt this app out of Relai's PRODUCT ANALYTICS
|
|
1126
|
+
* (owner, 2026-08-11).
|
|
1127
|
+
*
|
|
1128
|
+
* Operational telemetry is unaffected and is not optional: Relai needs it to
|
|
1129
|
+
* reconcile orders and bill correctly, and an open that is never reported is
|
|
1130
|
+
* an order that never completes. What this turns off is the forwarding of a
|
|
1131
|
+
* curated subset to Relai's analytics tooling. Stated here rather than buried,
|
|
1132
|
+
* because "analytics" and "the thing that makes your orders work" being the
|
|
1133
|
+
* same switch would be a nasty surprise.
|
|
1134
|
+
*/
|
|
1135
|
+
analytics?: boolean;
|
|
1102
1136
|
}
|
|
1103
1137
|
interface UnlockInput {
|
|
1104
1138
|
orderId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ interface HttpConfig {
|
|
|
12
12
|
* client drops it so `auth.isSignedIn` goes false.
|
|
13
13
|
*/
|
|
14
14
|
onTokenInvalid?: () => void;
|
|
15
|
+
/** False opts the app out of product analytics; telemetry is unaffected. */
|
|
16
|
+
analytics?: boolean | undefined;
|
|
15
17
|
fetchImpl?: typeof fetch;
|
|
16
18
|
maxRetries?: number;
|
|
17
19
|
}
|
|
@@ -341,6 +343,26 @@ interface TelemetryEvent {
|
|
|
341
343
|
result: "success" | "failure";
|
|
342
344
|
transport?: "ble" | "simulated";
|
|
343
345
|
at: string;
|
|
346
|
+
/**
|
|
347
|
+
* WHY it failed, on a failure (owner, 2026-08-11).
|
|
348
|
+
*
|
|
349
|
+
* Without this an open that did not work is a number and nothing else: the
|
|
350
|
+
* platform could say how often opens fail and never why. It is the Parent's
|
|
351
|
+
* `[AUTH] REJECT` reason (`TAG`, `NONCE`, `NOTREADY`, …), an API error code,
|
|
352
|
+
* or a transport reason like `timeout` / `not_connected`.
|
|
353
|
+
*
|
|
354
|
+
* A bounded vocabulary matters more than richness here, because this is
|
|
355
|
+
* grouped and counted, not read. Never put a raw error message in it.
|
|
356
|
+
*/
|
|
357
|
+
reason?: string;
|
|
358
|
+
/**
|
|
359
|
+
* 1 for the first try, 2 for the first retry, and so on.
|
|
360
|
+
*
|
|
361
|
+
* `NOTREADY` is retryable (firmware 1.1.0), so without this a recovered open
|
|
362
|
+
* looks identical to one that worked first time and the retry can never be
|
|
363
|
+
* shown to be worth having.
|
|
364
|
+
*/
|
|
365
|
+
attempt?: number;
|
|
344
366
|
}
|
|
345
367
|
/** One page of orders, newest first. `next_cursor` is null on the last page. */
|
|
346
368
|
interface OrderPage {
|
|
@@ -1099,6 +1121,18 @@ interface RelaiClientOptions {
|
|
|
1099
1121
|
* new RelaiClient({ publishableKey, stripe: Stripe });
|
|
1100
1122
|
*/
|
|
1101
1123
|
stripe?: StripeSdk;
|
|
1124
|
+
/**
|
|
1125
|
+
* Send `false` to opt this app out of Relai's PRODUCT ANALYTICS
|
|
1126
|
+
* (owner, 2026-08-11).
|
|
1127
|
+
*
|
|
1128
|
+
* Operational telemetry is unaffected and is not optional: Relai needs it to
|
|
1129
|
+
* reconcile orders and bill correctly, and an open that is never reported is
|
|
1130
|
+
* an order that never completes. What this turns off is the forwarding of a
|
|
1131
|
+
* curated subset to Relai's analytics tooling. Stated here rather than buried,
|
|
1132
|
+
* because "analytics" and "the thing that makes your orders work" being the
|
|
1133
|
+
* same switch would be a nasty surprise.
|
|
1134
|
+
*/
|
|
1135
|
+
analytics?: boolean;
|
|
1102
1136
|
}
|
|
1103
1137
|
interface UnlockInput {
|
|
1104
1138
|
orderId: string;
|
package/dist/index.js
CHANGED
|
@@ -86,6 +86,7 @@ var HttpClient = class {
|
|
|
86
86
|
if (bearer) h["authorization"] = `Bearer ${bearer}`;
|
|
87
87
|
}
|
|
88
88
|
if (idem) h["idempotency-key"] = idem;
|
|
89
|
+
if (this.cfg.analytics === false) h["x-relai-analytics"] = "off";
|
|
89
90
|
return h;
|
|
90
91
|
}
|
|
91
92
|
async parseJson(res) {
|
|
@@ -611,7 +612,10 @@ async function deliverOpen(deps, open, opts) {
|
|
|
611
612
|
action: ack.accepted ? "unlock_used" : "unlock_failed",
|
|
612
613
|
result: ack.accepted ? "success" : "failure",
|
|
613
614
|
transport: "ble",
|
|
614
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
615
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
616
|
+
// The Parent's own reject reason, so a failure is diagnosable
|
|
617
|
+
// rather than merely counted.
|
|
618
|
+
...ack.accepted ? {} : { reason: ack.rejectReason ?? "UNKNOWN" }
|
|
615
619
|
}
|
|
616
620
|
]
|
|
617
621
|
}).catch(() => void 0);
|
|
@@ -647,7 +651,8 @@ var RelaiClient = class {
|
|
|
647
651
|
...options.publishableKey !== void 0 ? { publishableKey: options.publishableKey } : {},
|
|
648
652
|
...options.secretKey !== void 0 ? { secretKey: options.secretKey } : {},
|
|
649
653
|
...options.fetchImpl !== void 0 ? { fetchImpl: options.fetchImpl } : {},
|
|
650
|
-
...options.maxRetries !== void 0 ? { maxRetries: options.maxRetries } : {}
|
|
654
|
+
...options.maxRetries !== void 0 ? { maxRetries: options.maxRetries } : {},
|
|
655
|
+
...options.analytics !== void 0 ? { analytics: options.analytics } : {}
|
|
651
656
|
};
|
|
652
657
|
this.http = new HttpClient(httpConfig);
|
|
653
658
|
auth = new AuthModule(this.http, storage);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relai-team/access-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Official Relai Access SDK, open Relai Exchange Zone nodes over BLE, backed by the Relai Access platform (server-owns-trust).",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|