@relai-team/access-sdk 0.10.0 → 0.11.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 +56 -0
- package/dist/index.cjs +33 -0
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,62 @@ Server-side (secret key), `relai.overrideLinks.request({ nodeId })` mints a
|
|
|
144
144
|
single-use override code that opens a node with no paywall (10 free per org per
|
|
145
145
|
month, then $1.00 each). Redeem via `overrideCode` on the open.
|
|
146
146
|
|
|
147
|
+
### Guest mode: no account, no sign-in call
|
|
148
|
+
|
|
149
|
+
**There is no `signInAsGuest()`, and there is nothing missing.** A guest is not
|
|
150
|
+
a kind of session, it is the absence of one: a request counts as a guest request
|
|
151
|
+
when it carries your publishable key and no end-user bearer token. That is
|
|
152
|
+
exactly what this client sends before anyone calls `auth.verifyOtp(...)`, so a
|
|
153
|
+
fresh `RelaiClient` is already making guest calls.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const relai = new RelaiClient({ publishableKey: "pk_sandbox_..." });
|
|
157
|
+
// No auth.startOtp, no auth.verifyOtp. That is the whole trick.
|
|
158
|
+
|
|
159
|
+
const order = await relai.orders.create({ exchangeZoneId: ez.id });
|
|
160
|
+
const drop = await relai.unlock({ orderId: order.id, intent: Intents.Occupy, transport });
|
|
161
|
+
const code = drop.access_link.code; // hand this to whoever picks up
|
|
162
|
+
|
|
163
|
+
// Any device, still no account:
|
|
164
|
+
await relai.unlock({ orderId: order.id, intent: Intents.MakeAvailable, accessLink: code, transport });
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Guest mode is a **per-app setting** you turn on in the Relai portal, not
|
|
168
|
+
something the SDK can enable, and it requires open access plus the open handoff
|
|
169
|
+
mode. With it off, every call without a bearer token answers `401 unauthorized`
|
|
170
|
+
("Missing end-user bearer token (and guest mode is off for this app)"). If your
|
|
171
|
+
anonymous calls are failing, check that message before your code.
|
|
172
|
+
|
|
173
|
+
Everyone using your app anonymously shares **one** guest identity, so the access
|
|
174
|
+
link is the only thing that tells two guests apart, and it is the only thing that
|
|
175
|
+
authorizes a guest pick-up. A guest cannot pick up without one (even on an order
|
|
176
|
+
a guest created), be a directed recipient, re-open a node, start a
|
|
177
|
+
pay-as-you-go hold, or cancel an order. Late fees on a guest pick-up bill your
|
|
178
|
+
organization, since there is no individual to charge.
|
|
179
|
+
|
|
180
|
+
## Your end users (server only)
|
|
181
|
+
|
|
182
|
+
`relai.endUsers` reads the people using your app: name, email, and access tag.
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
// On YOUR SERVER, never in the app.
|
|
186
|
+
const relai = new RelaiClient({ secretKey: "sk_sandbox_…" });
|
|
187
|
+
|
|
188
|
+
const { data, total } = await relai.endUsers.list({ limit: 50, query: "@example.com" });
|
|
189
|
+
const person = await relai.endUsers.get(data[0].id);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Secret key only, and deliberately so.** A publishable key ships inside your
|
|
193
|
+
app binary where anyone who downloads it can read it, so a `pk_` that could
|
|
194
|
+
list end users would hand every customer's email to the public. From the phone,
|
|
195
|
+
`relai.me()` returns the one person holding the session, which is what a client
|
|
196
|
+
actually needs.
|
|
197
|
+
|
|
198
|
+
The environment comes from the key, like everywhere else: a **sandbox** key
|
|
199
|
+
lists your test identities, a **production** key lists your real users. An id
|
|
200
|
+
from one environment answers `not_found` in the other, and so does an id
|
|
201
|
+
belonging to somebody else's app.
|
|
202
|
+
|
|
147
203
|
## Relai checkout: end users pay, you write no payment code
|
|
148
204
|
|
|
149
205
|
If the app is set to **Relai checkout** in the Relai portal (the default for
|
package/dist/index.cjs
CHANGED
|
@@ -446,6 +446,37 @@ var OverrideLinksModule = class {
|
|
|
446
446
|
return this.http.request({ method: "POST", path: "/override-links", body });
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
|
+
var EndUsersModule = class {
|
|
450
|
+
constructor(http) {
|
|
451
|
+
this.http = http;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
455
|
+
*
|
|
456
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
457
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
458
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
459
|
+
* returns the one person holding the session, which is all a client needs.
|
|
460
|
+
*
|
|
461
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
462
|
+
* lists your test identities, a production key lists your real users.
|
|
463
|
+
*/
|
|
464
|
+
list(input) {
|
|
465
|
+
const query = {};
|
|
466
|
+
if (input?.limit !== void 0) query["limit"] = input.limit;
|
|
467
|
+
if (input?.offset !== void 0) query["offset"] = input.offset;
|
|
468
|
+
if (input?.query !== void 0) query["q"] = input.query;
|
|
469
|
+
return this.http.request({ path: "/end-users", query });
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
473
|
+
* anyone outside this app and environment, including ids that exist
|
|
474
|
+
* elsewhere on the platform.
|
|
475
|
+
*/
|
|
476
|
+
get(userId) {
|
|
477
|
+
return this.http.request({ path: `/end-users/${userId}` });
|
|
478
|
+
}
|
|
479
|
+
};
|
|
449
480
|
var TelemetryModule = class {
|
|
450
481
|
constructor(http) {
|
|
451
482
|
this.http = http;
|
|
@@ -620,6 +651,7 @@ var RelaiClient = class {
|
|
|
620
651
|
this.recipients = new RecipientsModule(this.http);
|
|
621
652
|
this.accessLinks = new AccessLinksModule(this.http);
|
|
622
653
|
this.overrideLinks = new OverrideLinksModule(this.http);
|
|
654
|
+
this.endUsers = new EndUsersModule(this.http);
|
|
623
655
|
this.telemetry = new TelemetryModule(this.http);
|
|
624
656
|
this.telemetryUploader = new TelemetryUploader(this.telemetry, options.telemetryQueue);
|
|
625
657
|
}
|
|
@@ -1048,6 +1080,7 @@ var Intents = {
|
|
|
1048
1080
|
exports.AccessLinksModule = AccessLinksModule;
|
|
1049
1081
|
exports.AuthModule = AuthModule;
|
|
1050
1082
|
exports.BleTransport = BleTransport;
|
|
1083
|
+
exports.EndUsersModule = EndUsersModule;
|
|
1051
1084
|
exports.ExchangeZonesModule = ExchangeZonesModule;
|
|
1052
1085
|
exports.GrantsModule = GrantsModule;
|
|
1053
1086
|
exports.Intents = Intents;
|
package/dist/index.d.cts
CHANGED
|
@@ -141,6 +141,31 @@ interface OverrideLink {
|
|
|
141
141
|
billed_cents: number;
|
|
142
142
|
free_per_month: number;
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* One of your app's end users, as returned by the secret-key directory. Never
|
|
146
|
+
* reachable with a publishable key: see `EndUsersModule`.
|
|
147
|
+
*/
|
|
148
|
+
interface EndUser {
|
|
149
|
+
id: string;
|
|
150
|
+
email: string;
|
|
151
|
+
name: string | null;
|
|
152
|
+
/** Their `@handle` for directed handoffs, when they have set one. */
|
|
153
|
+
access_tag: string | null;
|
|
154
|
+
first_seen_at: string | null;
|
|
155
|
+
last_seen_at: string | null;
|
|
156
|
+
/** Orders on THIS app, counted on either side of the handoff. */
|
|
157
|
+
order_count: number;
|
|
158
|
+
/** Which environment this record came from, echoing your key. */
|
|
159
|
+
environment?: "sandbox" | "production";
|
|
160
|
+
}
|
|
161
|
+
interface EndUserPage {
|
|
162
|
+
data: EndUser[];
|
|
163
|
+
/** Matching end users in total, not just on this page. */
|
|
164
|
+
total: number;
|
|
165
|
+
limit: number;
|
|
166
|
+
offset: number;
|
|
167
|
+
environment: "sandbox" | "production";
|
|
168
|
+
}
|
|
144
169
|
/** The unlock grant carried on an Open (or returned by mint). */
|
|
145
170
|
interface UnlockGrant {
|
|
146
171
|
grant_id: string;
|
|
@@ -279,6 +304,22 @@ declare class MemoryTokenStorage implements TokenStorage {
|
|
|
279
304
|
set(tokens: TokenPair): void;
|
|
280
305
|
clear(): void;
|
|
281
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* End-user identity: email OTP in, tokens held, tokens refreshed.
|
|
309
|
+
*
|
|
310
|
+
* GUEST MODE. There is deliberately no `signInAsGuest()`. A guest is not a kind
|
|
311
|
+
* of session, it is the absence of one: a request counts as a guest request when
|
|
312
|
+
* it carries the publishable key and NO end-user bearer token, which is exactly
|
|
313
|
+
* what this client sends while `isSignedIn` is false. So on an app with guest
|
|
314
|
+
* mode enabled (a portal setting, requiring open access and the open handoff
|
|
315
|
+
* mode), orders, unlocks, access-link resolution and telemetry all work without
|
|
316
|
+
* calling anything here at all. With guest mode off, those calls answer
|
|
317
|
+
* `401 unauthorized`.
|
|
318
|
+
*
|
|
319
|
+
* Every anonymous caller on an app shares ONE guest identity, so the single-use
|
|
320
|
+
* access link is the only credential that distinguishes two guests, and it is
|
|
321
|
+
* required for a guest pick-up even on an order a guest created.
|
|
322
|
+
*/
|
|
282
323
|
declare class AuthModule {
|
|
283
324
|
private readonly http;
|
|
284
325
|
private readonly storage;
|
|
@@ -425,6 +466,34 @@ declare class OverrideLinksModule {
|
|
|
425
466
|
expiresInHours?: number;
|
|
426
467
|
}): Promise<OverrideLink>;
|
|
427
468
|
}
|
|
469
|
+
declare class EndUsersModule {
|
|
470
|
+
private readonly http;
|
|
471
|
+
constructor(http: HttpClient);
|
|
472
|
+
/**
|
|
473
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
474
|
+
*
|
|
475
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
476
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
477
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
478
|
+
* returns the one person holding the session, which is all a client needs.
|
|
479
|
+
*
|
|
480
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
481
|
+
* lists your test identities, a production key lists your real users.
|
|
482
|
+
*/
|
|
483
|
+
list(input?: {
|
|
484
|
+
/** 1 to 100. Defaults to 25. */
|
|
485
|
+
limit?: number;
|
|
486
|
+
offset?: number;
|
|
487
|
+
/** Case-insensitive substring match on email. */
|
|
488
|
+
query?: string;
|
|
489
|
+
}): Promise<EndUserPage>;
|
|
490
|
+
/**
|
|
491
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
492
|
+
* anyone outside this app and environment, including ids that exist
|
|
493
|
+
* elsewhere on the platform.
|
|
494
|
+
*/
|
|
495
|
+
get(userId: string): Promise<EndUser>;
|
|
496
|
+
}
|
|
428
497
|
declare class TelemetryModule {
|
|
429
498
|
private readonly http;
|
|
430
499
|
constructor(http: HttpClient);
|
|
@@ -729,6 +798,8 @@ declare class RelaiClient {
|
|
|
729
798
|
readonly accessLinks: AccessLinksModule;
|
|
730
799
|
/** SERVER ONLY (secret key): request paywall-bypassing override links. */
|
|
731
800
|
readonly overrideLinks: OverrideLinksModule;
|
|
801
|
+
/** SERVER ONLY (secret key): your app's end users, name, email, access tag. */
|
|
802
|
+
readonly endUsers: EndUsersModule;
|
|
732
803
|
readonly telemetry: TelemetryModule;
|
|
733
804
|
/** Queue-and-retry telemetry uploader (used by unlock; flush opportunistically). */
|
|
734
805
|
readonly telemetryUploader: TelemetryUploader;
|
|
@@ -1025,4 +1096,4 @@ declare class RelaiTransportError extends RelaiError {
|
|
|
1025
1096
|
constructor(message: string);
|
|
1026
1097
|
}
|
|
1027
1098
|
|
|
1028
|
-
export { type AccessLinkTarget, AccessLinksModule, type ApiEnvironment, type ApiErrorBody, AuthModule, type BleDeviceLike, type BleManagerLike, BleTransport, type BleTransportOptions, type CommandAck, type DeliverOptions, type DiscoveredParent, type ExchangeZone, type ExchangeZoneDetail, ExchangeZonesModule, type GrantAlgorithm, GrantsModule, type HandoffMode, type Intent, Intents, type KeyValueStorage, MemoryTelemetryQueue, MemoryTokenStorage, type MintedCommand, type NotifyLine, type Open, type Order, OrdersModule, type OverrideLink, OverrideLinksModule, type ParentTransport, type PaymentRequiredDetails, type QueuedTelemetry, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, type RecipientMatch, RecipientsModule, RelaiApiError, RelaiClient, type RelaiClientOptions, RelaiError, RelaiLateFeeDue, RelaiMissingKeyError, RelaiTransportError, RelaiUnlockRejected, type SelfBillingChoice, type Session, SimAuthenticatedTransport, type SimAuthenticatedTransportOptions, type SimulatedParentConfig, SimulatedTransport, StorageTelemetryQueue, type StorageTelemetryQueueOptions, type StripeSdk, type TelemetryAction, type TelemetryEvent, TelemetryModule, type TelemetryPayload, type TelemetryQueue, TelemetryUploader, type TokenPair, type TokenStorage, type Tower, type TowerNode, type TowerTelemetry, type UnlockDeps, type UnlockGrant, type UnlockInput, type UnlockResult, type VerifyWebhookInput, asPaymentRequired, deliverOpen, parseNotifyLine, presentRelaiPaymentSheet, verifyWebhook };
|
|
1099
|
+
export { type AccessLinkTarget, AccessLinksModule, type ApiEnvironment, type ApiErrorBody, AuthModule, type BleDeviceLike, type BleManagerLike, BleTransport, type BleTransportOptions, type CommandAck, type DeliverOptions, type DiscoveredParent, type EndUser, type EndUserPage, EndUsersModule, type ExchangeZone, type ExchangeZoneDetail, ExchangeZonesModule, type GrantAlgorithm, GrantsModule, type HandoffMode, type Intent, Intents, type KeyValueStorage, MemoryTelemetryQueue, MemoryTokenStorage, type MintedCommand, type NotifyLine, type Open, type Order, OrdersModule, type OverrideLink, OverrideLinksModule, type ParentTransport, type PaymentRequiredDetails, type QueuedTelemetry, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, type RecipientMatch, RecipientsModule, RelaiApiError, RelaiClient, type RelaiClientOptions, RelaiError, RelaiLateFeeDue, RelaiMissingKeyError, RelaiTransportError, RelaiUnlockRejected, type SelfBillingChoice, type Session, SimAuthenticatedTransport, type SimAuthenticatedTransportOptions, type SimulatedParentConfig, SimulatedTransport, StorageTelemetryQueue, type StorageTelemetryQueueOptions, type StripeSdk, type TelemetryAction, type TelemetryEvent, TelemetryModule, type TelemetryPayload, type TelemetryQueue, TelemetryUploader, type TokenPair, type TokenStorage, type Tower, type TowerNode, type TowerTelemetry, type UnlockDeps, type UnlockGrant, type UnlockInput, type UnlockResult, type VerifyWebhookInput, asPaymentRequired, deliverOpen, parseNotifyLine, presentRelaiPaymentSheet, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,31 @@ interface OverrideLink {
|
|
|
141
141
|
billed_cents: number;
|
|
142
142
|
free_per_month: number;
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* One of your app's end users, as returned by the secret-key directory. Never
|
|
146
|
+
* reachable with a publishable key: see `EndUsersModule`.
|
|
147
|
+
*/
|
|
148
|
+
interface EndUser {
|
|
149
|
+
id: string;
|
|
150
|
+
email: string;
|
|
151
|
+
name: string | null;
|
|
152
|
+
/** Their `@handle` for directed handoffs, when they have set one. */
|
|
153
|
+
access_tag: string | null;
|
|
154
|
+
first_seen_at: string | null;
|
|
155
|
+
last_seen_at: string | null;
|
|
156
|
+
/** Orders on THIS app, counted on either side of the handoff. */
|
|
157
|
+
order_count: number;
|
|
158
|
+
/** Which environment this record came from, echoing your key. */
|
|
159
|
+
environment?: "sandbox" | "production";
|
|
160
|
+
}
|
|
161
|
+
interface EndUserPage {
|
|
162
|
+
data: EndUser[];
|
|
163
|
+
/** Matching end users in total, not just on this page. */
|
|
164
|
+
total: number;
|
|
165
|
+
limit: number;
|
|
166
|
+
offset: number;
|
|
167
|
+
environment: "sandbox" | "production";
|
|
168
|
+
}
|
|
144
169
|
/** The unlock grant carried on an Open (or returned by mint). */
|
|
145
170
|
interface UnlockGrant {
|
|
146
171
|
grant_id: string;
|
|
@@ -279,6 +304,22 @@ declare class MemoryTokenStorage implements TokenStorage {
|
|
|
279
304
|
set(tokens: TokenPair): void;
|
|
280
305
|
clear(): void;
|
|
281
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* End-user identity: email OTP in, tokens held, tokens refreshed.
|
|
309
|
+
*
|
|
310
|
+
* GUEST MODE. There is deliberately no `signInAsGuest()`. A guest is not a kind
|
|
311
|
+
* of session, it is the absence of one: a request counts as a guest request when
|
|
312
|
+
* it carries the publishable key and NO end-user bearer token, which is exactly
|
|
313
|
+
* what this client sends while `isSignedIn` is false. So on an app with guest
|
|
314
|
+
* mode enabled (a portal setting, requiring open access and the open handoff
|
|
315
|
+
* mode), orders, unlocks, access-link resolution and telemetry all work without
|
|
316
|
+
* calling anything here at all. With guest mode off, those calls answer
|
|
317
|
+
* `401 unauthorized`.
|
|
318
|
+
*
|
|
319
|
+
* Every anonymous caller on an app shares ONE guest identity, so the single-use
|
|
320
|
+
* access link is the only credential that distinguishes two guests, and it is
|
|
321
|
+
* required for a guest pick-up even on an order a guest created.
|
|
322
|
+
*/
|
|
282
323
|
declare class AuthModule {
|
|
283
324
|
private readonly http;
|
|
284
325
|
private readonly storage;
|
|
@@ -425,6 +466,34 @@ declare class OverrideLinksModule {
|
|
|
425
466
|
expiresInHours?: number;
|
|
426
467
|
}): Promise<OverrideLink>;
|
|
427
468
|
}
|
|
469
|
+
declare class EndUsersModule {
|
|
470
|
+
private readonly http;
|
|
471
|
+
constructor(http: HttpClient);
|
|
472
|
+
/**
|
|
473
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
474
|
+
*
|
|
475
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
476
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
477
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
478
|
+
* returns the one person holding the session, which is all a client needs.
|
|
479
|
+
*
|
|
480
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
481
|
+
* lists your test identities, a production key lists your real users.
|
|
482
|
+
*/
|
|
483
|
+
list(input?: {
|
|
484
|
+
/** 1 to 100. Defaults to 25. */
|
|
485
|
+
limit?: number;
|
|
486
|
+
offset?: number;
|
|
487
|
+
/** Case-insensitive substring match on email. */
|
|
488
|
+
query?: string;
|
|
489
|
+
}): Promise<EndUserPage>;
|
|
490
|
+
/**
|
|
491
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
492
|
+
* anyone outside this app and environment, including ids that exist
|
|
493
|
+
* elsewhere on the platform.
|
|
494
|
+
*/
|
|
495
|
+
get(userId: string): Promise<EndUser>;
|
|
496
|
+
}
|
|
428
497
|
declare class TelemetryModule {
|
|
429
498
|
private readonly http;
|
|
430
499
|
constructor(http: HttpClient);
|
|
@@ -729,6 +798,8 @@ declare class RelaiClient {
|
|
|
729
798
|
readonly accessLinks: AccessLinksModule;
|
|
730
799
|
/** SERVER ONLY (secret key): request paywall-bypassing override links. */
|
|
731
800
|
readonly overrideLinks: OverrideLinksModule;
|
|
801
|
+
/** SERVER ONLY (secret key): your app's end users, name, email, access tag. */
|
|
802
|
+
readonly endUsers: EndUsersModule;
|
|
732
803
|
readonly telemetry: TelemetryModule;
|
|
733
804
|
/** Queue-and-retry telemetry uploader (used by unlock; flush opportunistically). */
|
|
734
805
|
readonly telemetryUploader: TelemetryUploader;
|
|
@@ -1025,4 +1096,4 @@ declare class RelaiTransportError extends RelaiError {
|
|
|
1025
1096
|
constructor(message: string);
|
|
1026
1097
|
}
|
|
1027
1098
|
|
|
1028
|
-
export { type AccessLinkTarget, AccessLinksModule, type ApiEnvironment, type ApiErrorBody, AuthModule, type BleDeviceLike, type BleManagerLike, BleTransport, type BleTransportOptions, type CommandAck, type DeliverOptions, type DiscoveredParent, type ExchangeZone, type ExchangeZoneDetail, ExchangeZonesModule, type GrantAlgorithm, GrantsModule, type HandoffMode, type Intent, Intents, type KeyValueStorage, MemoryTelemetryQueue, MemoryTokenStorage, type MintedCommand, type NotifyLine, type Open, type Order, OrdersModule, type OverrideLink, OverrideLinksModule, type ParentTransport, type PaymentRequiredDetails, type QueuedTelemetry, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, type RecipientMatch, RecipientsModule, RelaiApiError, RelaiClient, type RelaiClientOptions, RelaiError, RelaiLateFeeDue, RelaiMissingKeyError, RelaiTransportError, RelaiUnlockRejected, type SelfBillingChoice, type Session, SimAuthenticatedTransport, type SimAuthenticatedTransportOptions, type SimulatedParentConfig, SimulatedTransport, StorageTelemetryQueue, type StorageTelemetryQueueOptions, type StripeSdk, type TelemetryAction, type TelemetryEvent, TelemetryModule, type TelemetryPayload, type TelemetryQueue, TelemetryUploader, type TokenPair, type TokenStorage, type Tower, type TowerNode, type TowerTelemetry, type UnlockDeps, type UnlockGrant, type UnlockInput, type UnlockResult, type VerifyWebhookInput, asPaymentRequired, deliverOpen, parseNotifyLine, presentRelaiPaymentSheet, verifyWebhook };
|
|
1099
|
+
export { type AccessLinkTarget, AccessLinksModule, type ApiEnvironment, type ApiErrorBody, AuthModule, type BleDeviceLike, type BleManagerLike, BleTransport, type BleTransportOptions, type CommandAck, type DeliverOptions, type DiscoveredParent, type EndUser, type EndUserPage, EndUsersModule, type ExchangeZone, type ExchangeZoneDetail, ExchangeZonesModule, type GrantAlgorithm, GrantsModule, type HandoffMode, type Intent, Intents, type KeyValueStorage, MemoryTelemetryQueue, MemoryTokenStorage, type MintedCommand, type NotifyLine, type Open, type Order, OrdersModule, type OverrideLink, OverrideLinksModule, type ParentTransport, type PaymentRequiredDetails, type QueuedTelemetry, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, type RecipientMatch, RecipientsModule, RelaiApiError, RelaiClient, type RelaiClientOptions, RelaiError, RelaiLateFeeDue, RelaiMissingKeyError, RelaiTransportError, RelaiUnlockRejected, type SelfBillingChoice, type Session, SimAuthenticatedTransport, type SimAuthenticatedTransportOptions, type SimulatedParentConfig, SimulatedTransport, StorageTelemetryQueue, type StorageTelemetryQueueOptions, type StripeSdk, type TelemetryAction, type TelemetryEvent, TelemetryModule, type TelemetryPayload, type TelemetryQueue, TelemetryUploader, type TokenPair, type TokenStorage, type Tower, type TowerNode, type TowerTelemetry, type UnlockDeps, type UnlockGrant, type UnlockInput, type UnlockResult, type VerifyWebhookInput, asPaymentRequired, deliverOpen, parseNotifyLine, presentRelaiPaymentSheet, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -329,6 +329,37 @@ var OverrideLinksModule = class {
|
|
|
329
329
|
return this.http.request({ method: "POST", path: "/override-links", body });
|
|
330
330
|
}
|
|
331
331
|
};
|
|
332
|
+
var EndUsersModule = class {
|
|
333
|
+
constructor(http) {
|
|
334
|
+
this.http = http;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
338
|
+
*
|
|
339
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
340
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
341
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
342
|
+
* returns the one person holding the session, which is all a client needs.
|
|
343
|
+
*
|
|
344
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
345
|
+
* lists your test identities, a production key lists your real users.
|
|
346
|
+
*/
|
|
347
|
+
list(input) {
|
|
348
|
+
const query = {};
|
|
349
|
+
if (input?.limit !== void 0) query["limit"] = input.limit;
|
|
350
|
+
if (input?.offset !== void 0) query["offset"] = input.offset;
|
|
351
|
+
if (input?.query !== void 0) query["q"] = input.query;
|
|
352
|
+
return this.http.request({ path: "/end-users", query });
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
356
|
+
* anyone outside this app and environment, including ids that exist
|
|
357
|
+
* elsewhere on the platform.
|
|
358
|
+
*/
|
|
359
|
+
get(userId) {
|
|
360
|
+
return this.http.request({ path: `/end-users/${userId}` });
|
|
361
|
+
}
|
|
362
|
+
};
|
|
332
363
|
var TelemetryModule = class {
|
|
333
364
|
constructor(http) {
|
|
334
365
|
this.http = http;
|
|
@@ -496,6 +527,7 @@ var RelaiClient = class {
|
|
|
496
527
|
this.recipients = new RecipientsModule(this.http);
|
|
497
528
|
this.accessLinks = new AccessLinksModule(this.http);
|
|
498
529
|
this.overrideLinks = new OverrideLinksModule(this.http);
|
|
530
|
+
this.endUsers = new EndUsersModule(this.http);
|
|
499
531
|
this.telemetry = new TelemetryModule(this.http);
|
|
500
532
|
this.telemetryUploader = new TelemetryUploader(this.telemetry, options.telemetryQueue);
|
|
501
533
|
}
|
|
@@ -911,4 +943,4 @@ var Intents = {
|
|
|
911
943
|
MakeAvailable: "make_available"
|
|
912
944
|
};
|
|
913
945
|
|
|
914
|
-
export { AccessLinksModule, AuthModule, BleTransport, ExchangeZonesModule, GrantsModule, Intents, MemoryTelemetryQueue, MemoryTokenStorage, OrdersModule, OverrideLinksModule, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, RecipientsModule, RelaiClient, SimAuthenticatedTransport, SimulatedTransport, StorageTelemetryQueue, TelemetryModule, TelemetryUploader, deliverOpen, parseNotifyLine, verifyWebhook };
|
|
946
|
+
export { AccessLinksModule, AuthModule, BleTransport, EndUsersModule, ExchangeZonesModule, GrantsModule, Intents, MemoryTelemetryQueue, MemoryTokenStorage, OrdersModule, OverrideLinksModule, REJECT_REASONS, RELAI_RX_CHAR, RELAI_TX_CHAR, RELAI_UART_SERVICE, RecipientsModule, RelaiClient, SimAuthenticatedTransport, SimulatedTransport, StorageTelemetryQueue, TelemetryModule, TelemetryUploader, deliverOpen, parseNotifyLine, verifyWebhook };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relai-team/access-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|