@relai-team/access-sdk 0.9.0 → 0.11.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/README.md +46 -2
- package/dist/index.cjs +34 -0
- package/dist/index.d.cts +79 -1
- package/dist/index.d.ts +79 -1
- package/dist/index.js +34 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,29 @@ 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
|
+
## Your end users (server only)
|
|
148
|
+
|
|
149
|
+
`relai.endUsers` reads the people using your app: name, email, and access tag.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
// On YOUR SERVER, never in the app.
|
|
153
|
+
const relai = new RelaiClient({ secretKey: "sk_sandbox_…" });
|
|
154
|
+
|
|
155
|
+
const { data, total } = await relai.endUsers.list({ limit: 50, query: "@example.com" });
|
|
156
|
+
const person = await relai.endUsers.get(data[0].id);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Secret key only, and deliberately so.** A publishable key ships inside your
|
|
160
|
+
app binary where anyone who downloads it can read it, so a `pk_` that could
|
|
161
|
+
list end users would hand every customer's email to the public. From the phone,
|
|
162
|
+
`relai.me()` returns the one person holding the session, which is what a client
|
|
163
|
+
actually needs.
|
|
164
|
+
|
|
165
|
+
The environment comes from the key, like everywhere else: a **sandbox** key
|
|
166
|
+
lists your test identities, a **production** key lists your real users. An id
|
|
167
|
+
from one environment answers `not_found` in the other, and so does an id
|
|
168
|
+
belonging to somebody else's app.
|
|
169
|
+
|
|
147
170
|
## Relai checkout: end users pay, you write no payment code
|
|
148
171
|
|
|
149
172
|
If the app is set to **Relai checkout** in the Relai portal (the default for
|
|
@@ -177,8 +200,29 @@ the reason on the console and the sheet parameters in `error.details`.
|
|
|
177
200
|
Prices are configured in the portal (per app, with per-Exchange-Zone
|
|
178
201
|
overrides), in two styles:
|
|
179
202
|
|
|
180
|
-
- **Prepaid**: one
|
|
181
|
-
|
|
203
|
+
- **Prepaid**: one price collected at the drop-off; it covers the whole order,
|
|
204
|
+
including self re-opens and the pick-up.
|
|
205
|
+
|
|
206
|
+
An app may offer up to **ten pick-up windows**, each a length of time with its
|
|
207
|
+
own price, and the end user picks one. Read the menu off the Exchange Zone and
|
|
208
|
+
pass the chosen `hours` back:
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
const ez = await relai.exchangeZones.get(ezId);
|
|
212
|
+
const windows = ez.end_user_pricing?.pickup_windows ?? [];
|
|
213
|
+
// e.g. [{ hours: 2, price_cents: 300, total_cents: 371 }, { hours: 24, … }]
|
|
214
|
+
|
|
215
|
+
const order = await relai.orders.create({
|
|
216
|
+
exchangeZoneId: ez.id,
|
|
217
|
+
pickupWindowHours: windows[1]?.hours, // what the user tapped
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`total_cents` already includes the Platform Fee and Processing lines, so show
|
|
222
|
+
it as-is. Omit `pickupWindowHours` and the shortest (cheapest) window applies.
|
|
223
|
+
An `hours` the app does not offer is rejected. When `pickup_windows` is absent
|
|
224
|
+
the app offers no choice and `prepaid_cents` is the price. Late fees start when
|
|
225
|
+
the chosen window runs out, and `order.pickup_window_hours` reports it back.
|
|
182
226
|
- **Pay-as-you-go** (self orders via `Intents.OccupyLongTerm`): a base at
|
|
183
227
|
drop-off, which may be zero (then the sheet only saves the card), plus an
|
|
184
228
|
hourly rate collected when the pick-up open is requested. Guests cannot
|
package/dist/index.cjs
CHANGED
|
@@ -360,6 +360,7 @@ var OrdersModule = class {
|
|
|
360
360
|
if (input.recipient !== void 0) body["recipient"] = input.recipient;
|
|
361
361
|
if (input.recipientUserId !== void 0) body["recipient_user_id"] = input.recipientUserId;
|
|
362
362
|
if (input.recipientEmail !== void 0) body["recipient_email"] = input.recipientEmail;
|
|
363
|
+
if (input.pickupWindowHours !== void 0) body["pickup_window_hours"] = input.pickupWindowHours;
|
|
363
364
|
if (input.promotionCode !== void 0) body["promotion_code"] = input.promotionCode;
|
|
364
365
|
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
365
366
|
return this.http.request({ method: "POST", path: "/orders", body });
|
|
@@ -445,6 +446,37 @@ var OverrideLinksModule = class {
|
|
|
445
446
|
return this.http.request({ method: "POST", path: "/override-links", body });
|
|
446
447
|
}
|
|
447
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
|
+
};
|
|
448
480
|
var TelemetryModule = class {
|
|
449
481
|
constructor(http) {
|
|
450
482
|
this.http = http;
|
|
@@ -619,6 +651,7 @@ var RelaiClient = class {
|
|
|
619
651
|
this.recipients = new RecipientsModule(this.http);
|
|
620
652
|
this.accessLinks = new AccessLinksModule(this.http);
|
|
621
653
|
this.overrideLinks = new OverrideLinksModule(this.http);
|
|
654
|
+
this.endUsers = new EndUsersModule(this.http);
|
|
622
655
|
this.telemetry = new TelemetryModule(this.http);
|
|
623
656
|
this.telemetryUploader = new TelemetryUploader(this.telemetry, options.telemetryQueue);
|
|
624
657
|
}
|
|
@@ -1047,6 +1080,7 @@ var Intents = {
|
|
|
1047
1080
|
exports.AccessLinksModule = AccessLinksModule;
|
|
1048
1081
|
exports.AuthModule = AuthModule;
|
|
1049
1082
|
exports.BleTransport = BleTransport;
|
|
1083
|
+
exports.EndUsersModule = EndUsersModule;
|
|
1050
1084
|
exports.ExchangeZonesModule = ExchangeZonesModule;
|
|
1051
1085
|
exports.GrantsModule = GrantsModule;
|
|
1052
1086
|
exports.Intents = Intents;
|
package/dist/index.d.cts
CHANGED
|
@@ -101,6 +101,8 @@ interface Order extends OrderStatusFields {
|
|
|
101
101
|
} | null;
|
|
102
102
|
/** When the pick-up window closes; late fees escalate past it. Null = no window. */
|
|
103
103
|
pickup_window_expires_at: string | null;
|
|
104
|
+
/** The pick-up window this order was created under, in hours. */
|
|
105
|
+
pickup_window_hours: number | null;
|
|
104
106
|
/** The currently assessed late pick-up fee (flat step: $5 / $15 / $30). */
|
|
105
107
|
late_fee_cents: number;
|
|
106
108
|
late_fee_settled: boolean;
|
|
@@ -124,6 +126,8 @@ interface AccessLinkTarget {
|
|
|
124
126
|
node_id: string;
|
|
125
127
|
expires_at: string;
|
|
126
128
|
pickup_window_expires_at: string | null;
|
|
129
|
+
/** The pick-up window this order was created under, in hours. */
|
|
130
|
+
pickup_window_hours: number | null;
|
|
127
131
|
late_fee_cents: number;
|
|
128
132
|
}
|
|
129
133
|
/** A single-use override access link (bypasses every paywall). */
|
|
@@ -137,6 +141,31 @@ interface OverrideLink {
|
|
|
137
141
|
billed_cents: number;
|
|
138
142
|
free_per_month: number;
|
|
139
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
|
+
}
|
|
140
169
|
/** The unlock grant carried on an Open (or returned by mint). */
|
|
141
170
|
interface UnlockGrant {
|
|
142
171
|
grant_id: string;
|
|
@@ -229,6 +258,18 @@ interface ExchangeZoneDetail extends ExchangeZone {
|
|
|
229
258
|
payg_base_cents: number;
|
|
230
259
|
payg_base_total_cents: number;
|
|
231
260
|
payg_hourly_cents: number;
|
|
261
|
+
/**
|
|
262
|
+
* The app's priced pick-up windows, shortest first. Present only when the
|
|
263
|
+
* app offers a choice; absent means `prepaid_cents` above is the price and
|
|
264
|
+
* there is nothing to pick. Each `total_cents` already includes the
|
|
265
|
+
* Platform Fee and Processing lines, so render it as-is and pass the
|
|
266
|
+
* chosen `hours` to `orders.create({ pickupWindowHours })`.
|
|
267
|
+
*/
|
|
268
|
+
pickup_windows?: {
|
|
269
|
+
hours: number;
|
|
270
|
+
price_cents: number;
|
|
271
|
+
total_cents: number;
|
|
272
|
+
}[];
|
|
232
273
|
};
|
|
233
274
|
}
|
|
234
275
|
interface TokenPair {
|
|
@@ -338,6 +379,13 @@ declare class OrdersModule {
|
|
|
338
379
|
* expired, or exhausted codes fail with `invalid_request` whose message
|
|
339
380
|
* is written for the person who typed the code.
|
|
340
381
|
*/
|
|
382
|
+
/**
|
|
383
|
+
* The pick-up window the end user chose, in hours. Must be one the app
|
|
384
|
+
* offers (see `end_user_pricing.pickup_windows` on the Exchange Zone); its
|
|
385
|
+
* price becomes this order's prepaid price. Omitted where the app offers a
|
|
386
|
+
* menu: the shortest, which is the cheapest.
|
|
387
|
+
*/
|
|
388
|
+
pickupWindowHours?: number;
|
|
341
389
|
promotionCode?: string;
|
|
342
390
|
metadata?: Record<string, string>;
|
|
343
391
|
}): Promise<Order>;
|
|
@@ -402,6 +450,34 @@ declare class OverrideLinksModule {
|
|
|
402
450
|
expiresInHours?: number;
|
|
403
451
|
}): Promise<OverrideLink>;
|
|
404
452
|
}
|
|
453
|
+
declare class EndUsersModule {
|
|
454
|
+
private readonly http;
|
|
455
|
+
constructor(http: HttpClient);
|
|
456
|
+
/**
|
|
457
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
458
|
+
*
|
|
459
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
460
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
461
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
462
|
+
* returns the one person holding the session, which is all a client needs.
|
|
463
|
+
*
|
|
464
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
465
|
+
* lists your test identities, a production key lists your real users.
|
|
466
|
+
*/
|
|
467
|
+
list(input?: {
|
|
468
|
+
/** 1 to 100. Defaults to 25. */
|
|
469
|
+
limit?: number;
|
|
470
|
+
offset?: number;
|
|
471
|
+
/** Case-insensitive substring match on email. */
|
|
472
|
+
query?: string;
|
|
473
|
+
}): Promise<EndUserPage>;
|
|
474
|
+
/**
|
|
475
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
476
|
+
* anyone outside this app and environment, including ids that exist
|
|
477
|
+
* elsewhere on the platform.
|
|
478
|
+
*/
|
|
479
|
+
get(userId: string): Promise<EndUser>;
|
|
480
|
+
}
|
|
405
481
|
declare class TelemetryModule {
|
|
406
482
|
private readonly http;
|
|
407
483
|
constructor(http: HttpClient);
|
|
@@ -706,6 +782,8 @@ declare class RelaiClient {
|
|
|
706
782
|
readonly accessLinks: AccessLinksModule;
|
|
707
783
|
/** SERVER ONLY (secret key): request paywall-bypassing override links. */
|
|
708
784
|
readonly overrideLinks: OverrideLinksModule;
|
|
785
|
+
/** SERVER ONLY (secret key): your app's end users, name, email, access tag. */
|
|
786
|
+
readonly endUsers: EndUsersModule;
|
|
709
787
|
readonly telemetry: TelemetryModule;
|
|
710
788
|
/** Queue-and-retry telemetry uploader (used by unlock; flush opportunistically). */
|
|
711
789
|
readonly telemetryUploader: TelemetryUploader;
|
|
@@ -1002,4 +1080,4 @@ declare class RelaiTransportError extends RelaiError {
|
|
|
1002
1080
|
constructor(message: string);
|
|
1003
1081
|
}
|
|
1004
1082
|
|
|
1005
|
-
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 };
|
|
1083
|
+
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
|
@@ -101,6 +101,8 @@ interface Order extends OrderStatusFields {
|
|
|
101
101
|
} | null;
|
|
102
102
|
/** When the pick-up window closes; late fees escalate past it. Null = no window. */
|
|
103
103
|
pickup_window_expires_at: string | null;
|
|
104
|
+
/** The pick-up window this order was created under, in hours. */
|
|
105
|
+
pickup_window_hours: number | null;
|
|
104
106
|
/** The currently assessed late pick-up fee (flat step: $5 / $15 / $30). */
|
|
105
107
|
late_fee_cents: number;
|
|
106
108
|
late_fee_settled: boolean;
|
|
@@ -124,6 +126,8 @@ interface AccessLinkTarget {
|
|
|
124
126
|
node_id: string;
|
|
125
127
|
expires_at: string;
|
|
126
128
|
pickup_window_expires_at: string | null;
|
|
129
|
+
/** The pick-up window this order was created under, in hours. */
|
|
130
|
+
pickup_window_hours: number | null;
|
|
127
131
|
late_fee_cents: number;
|
|
128
132
|
}
|
|
129
133
|
/** A single-use override access link (bypasses every paywall). */
|
|
@@ -137,6 +141,31 @@ interface OverrideLink {
|
|
|
137
141
|
billed_cents: number;
|
|
138
142
|
free_per_month: number;
|
|
139
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
|
+
}
|
|
140
169
|
/** The unlock grant carried on an Open (or returned by mint). */
|
|
141
170
|
interface UnlockGrant {
|
|
142
171
|
grant_id: string;
|
|
@@ -229,6 +258,18 @@ interface ExchangeZoneDetail extends ExchangeZone {
|
|
|
229
258
|
payg_base_cents: number;
|
|
230
259
|
payg_base_total_cents: number;
|
|
231
260
|
payg_hourly_cents: number;
|
|
261
|
+
/**
|
|
262
|
+
* The app's priced pick-up windows, shortest first. Present only when the
|
|
263
|
+
* app offers a choice; absent means `prepaid_cents` above is the price and
|
|
264
|
+
* there is nothing to pick. Each `total_cents` already includes the
|
|
265
|
+
* Platform Fee and Processing lines, so render it as-is and pass the
|
|
266
|
+
* chosen `hours` to `orders.create({ pickupWindowHours })`.
|
|
267
|
+
*/
|
|
268
|
+
pickup_windows?: {
|
|
269
|
+
hours: number;
|
|
270
|
+
price_cents: number;
|
|
271
|
+
total_cents: number;
|
|
272
|
+
}[];
|
|
232
273
|
};
|
|
233
274
|
}
|
|
234
275
|
interface TokenPair {
|
|
@@ -338,6 +379,13 @@ declare class OrdersModule {
|
|
|
338
379
|
* expired, or exhausted codes fail with `invalid_request` whose message
|
|
339
380
|
* is written for the person who typed the code.
|
|
340
381
|
*/
|
|
382
|
+
/**
|
|
383
|
+
* The pick-up window the end user chose, in hours. Must be one the app
|
|
384
|
+
* offers (see `end_user_pricing.pickup_windows` on the Exchange Zone); its
|
|
385
|
+
* price becomes this order's prepaid price. Omitted where the app offers a
|
|
386
|
+
* menu: the shortest, which is the cheapest.
|
|
387
|
+
*/
|
|
388
|
+
pickupWindowHours?: number;
|
|
341
389
|
promotionCode?: string;
|
|
342
390
|
metadata?: Record<string, string>;
|
|
343
391
|
}): Promise<Order>;
|
|
@@ -402,6 +450,34 @@ declare class OverrideLinksModule {
|
|
|
402
450
|
expiresInHours?: number;
|
|
403
451
|
}): Promise<OverrideLink>;
|
|
404
452
|
}
|
|
453
|
+
declare class EndUsersModule {
|
|
454
|
+
private readonly http;
|
|
455
|
+
constructor(http: HttpClient);
|
|
456
|
+
/**
|
|
457
|
+
* Your app's end users (SERVER ONLY: secret key).
|
|
458
|
+
*
|
|
459
|
+
* Returns other people's names and email addresses, so it is deliberately out
|
|
460
|
+
* of reach of a publishable key: that key ships inside your app binary where
|
|
461
|
+
* anyone can read it. Call this from your backend. From the phone, `me()`
|
|
462
|
+
* returns the one person holding the session, which is all a client needs.
|
|
463
|
+
*
|
|
464
|
+
* The environment comes from the key, like everywhere else: a sandbox key
|
|
465
|
+
* lists your test identities, a production key lists your real users.
|
|
466
|
+
*/
|
|
467
|
+
list(input?: {
|
|
468
|
+
/** 1 to 100. Defaults to 25. */
|
|
469
|
+
limit?: number;
|
|
470
|
+
offset?: number;
|
|
471
|
+
/** Case-insensitive substring match on email. */
|
|
472
|
+
query?: string;
|
|
473
|
+
}): Promise<EndUserPage>;
|
|
474
|
+
/**
|
|
475
|
+
* One end user by id (SERVER ONLY: secret key). Answers `not_found` for
|
|
476
|
+
* anyone outside this app and environment, including ids that exist
|
|
477
|
+
* elsewhere on the platform.
|
|
478
|
+
*/
|
|
479
|
+
get(userId: string): Promise<EndUser>;
|
|
480
|
+
}
|
|
405
481
|
declare class TelemetryModule {
|
|
406
482
|
private readonly http;
|
|
407
483
|
constructor(http: HttpClient);
|
|
@@ -706,6 +782,8 @@ declare class RelaiClient {
|
|
|
706
782
|
readonly accessLinks: AccessLinksModule;
|
|
707
783
|
/** SERVER ONLY (secret key): request paywall-bypassing override links. */
|
|
708
784
|
readonly overrideLinks: OverrideLinksModule;
|
|
785
|
+
/** SERVER ONLY (secret key): your app's end users, name, email, access tag. */
|
|
786
|
+
readonly endUsers: EndUsersModule;
|
|
709
787
|
readonly telemetry: TelemetryModule;
|
|
710
788
|
/** Queue-and-retry telemetry uploader (used by unlock; flush opportunistically). */
|
|
711
789
|
readonly telemetryUploader: TelemetryUploader;
|
|
@@ -1002,4 +1080,4 @@ declare class RelaiTransportError extends RelaiError {
|
|
|
1002
1080
|
constructor(message: string);
|
|
1003
1081
|
}
|
|
1004
1082
|
|
|
1005
|
-
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 };
|
|
1083
|
+
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
|
@@ -243,6 +243,7 @@ var OrdersModule = class {
|
|
|
243
243
|
if (input.recipient !== void 0) body["recipient"] = input.recipient;
|
|
244
244
|
if (input.recipientUserId !== void 0) body["recipient_user_id"] = input.recipientUserId;
|
|
245
245
|
if (input.recipientEmail !== void 0) body["recipient_email"] = input.recipientEmail;
|
|
246
|
+
if (input.pickupWindowHours !== void 0) body["pickup_window_hours"] = input.pickupWindowHours;
|
|
246
247
|
if (input.promotionCode !== void 0) body["promotion_code"] = input.promotionCode;
|
|
247
248
|
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
248
249
|
return this.http.request({ method: "POST", path: "/orders", body });
|
|
@@ -328,6 +329,37 @@ var OverrideLinksModule = class {
|
|
|
328
329
|
return this.http.request({ method: "POST", path: "/override-links", body });
|
|
329
330
|
}
|
|
330
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
|
+
};
|
|
331
363
|
var TelemetryModule = class {
|
|
332
364
|
constructor(http) {
|
|
333
365
|
this.http = http;
|
|
@@ -495,6 +527,7 @@ var RelaiClient = class {
|
|
|
495
527
|
this.recipients = new RecipientsModule(this.http);
|
|
496
528
|
this.accessLinks = new AccessLinksModule(this.http);
|
|
497
529
|
this.overrideLinks = new OverrideLinksModule(this.http);
|
|
530
|
+
this.endUsers = new EndUsersModule(this.http);
|
|
498
531
|
this.telemetry = new TelemetryModule(this.http);
|
|
499
532
|
this.telemetryUploader = new TelemetryUploader(this.telemetry, options.telemetryQueue);
|
|
500
533
|
}
|
|
@@ -910,4 +943,4 @@ var Intents = {
|
|
|
910
943
|
MakeAvailable: "make_available"
|
|
911
944
|
};
|
|
912
945
|
|
|
913
|
-
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.0",
|
|
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",
|