@proappstore/sdk 1.16.4 → 1.16.6
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/auth.d.ts +75 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +219 -0
- package/dist/auth.js.map +1 -0
- package/dist/base-types.d.ts +22 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/base-types.js +2 -0
- package/dist/base-types.js.map +1 -0
- package/dist/counters.d.ts +21 -0
- package/dist/counters.d.ts.map +1 -0
- package/dist/counters.js +57 -0
- package/dist/counters.js.map +1 -0
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/kv.d.ts +30 -0
- package/dist/kv.d.ts.map +1 -0
- package/dist/kv.js +123 -0
- package/dist/kv.js.map +1 -0
- package/dist/roles.d.ts +53 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +121 -0
- package/dist/roles.js.map +1 -0
- package/dist/rooms.d.ts +68 -0
- package/dist/rooms.d.ts.map +1 -0
- package/dist/rooms.js +177 -0
- package/dist/rooms.js.map +1 -0
- package/dist/ui-primitives.d.ts +1 -1
- package/dist/ui-primitives.d.ts.map +1 -1
- package/package.json +1 -4
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Unsubscribe, User } from './base-types.js';
|
|
2
|
+
export type AuthProvider = 'github' | 'google' | 'email';
|
|
3
|
+
/** OAuth authentication — sign in, sign out, session management. */
|
|
4
|
+
export declare class Auth {
|
|
5
|
+
private readonly appId;
|
|
6
|
+
private readonly apiBase;
|
|
7
|
+
private session;
|
|
8
|
+
private listeners;
|
|
9
|
+
constructor(appId: string, apiBase: string);
|
|
10
|
+
/** Current signed-in user, or null if not authenticated. */
|
|
11
|
+
get user(): User | null;
|
|
12
|
+
/** Current session token, or null if not authenticated. */
|
|
13
|
+
get token(): string | null;
|
|
14
|
+
/** Subscribe to auth state changes. Fires immediately with current user, then on every change. */
|
|
15
|
+
onChange(listener: (user: User | null) => void): Unsubscribe;
|
|
16
|
+
/**
|
|
17
|
+
* Redirect-based GitHub OAuth. Opens the platform's hosted OAuth start URL,
|
|
18
|
+
* which redirects back to the current page with a session token in the hash.
|
|
19
|
+
*
|
|
20
|
+
* The current page's `location.hash` is dropped from `return_to` because
|
|
21
|
+
* the OAuth callback writes its own `#fas_session=…` and would clobber any
|
|
22
|
+
* hash-based router state otherwise.
|
|
23
|
+
*/
|
|
24
|
+
signIn(provider?: AuthProvider): void;
|
|
25
|
+
/**
|
|
26
|
+
* Email magic-link sign-in. Sends the user an email with a one-time link
|
|
27
|
+
* that completes auth and redirects back here with `#fas_session=…`.
|
|
28
|
+
*
|
|
29
|
+
* Resolves once the email has been queued. The caller should show a
|
|
30
|
+
* "check your inbox" message — the actual sign-in happens later when
|
|
31
|
+
* the user clicks the link.
|
|
32
|
+
*
|
|
33
|
+
* Throws on validation or server errors. Resolves with `{ ok: true }`
|
|
34
|
+
* regardless of whether the email is already registered (no account-
|
|
35
|
+
* enumeration leak).
|
|
36
|
+
*/
|
|
37
|
+
signInWithEmail(email: string): Promise<void>;
|
|
38
|
+
/** Clear the session and notify listeners. */
|
|
39
|
+
signOut(): void;
|
|
40
|
+
/**
|
|
41
|
+
* @internal Called by Kv and ApiProxy on 401 responses.
|
|
42
|
+
* Clears the stale session so the UI reacts immediately.
|
|
43
|
+
* Do not call directly — use `signOut()` instead.
|
|
44
|
+
*/
|
|
45
|
+
handleUnauthorized(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Call this once at app start, before rendering anything that depends on
|
|
48
|
+
* auth state. If the page was loaded via an auth callback (e.g. after
|
|
49
|
+
* `signIn()` returned from GitHub), this captures the session from the
|
|
50
|
+
* URL hash, persists it to localStorage, and clears the hash. On a normal
|
|
51
|
+
* page load it's a no-op — the constructor already restored any cached
|
|
52
|
+
* session from localStorage.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const fas = initApp({ appId: 'my-app' });
|
|
56
|
+
* await fas.auth.init();
|
|
57
|
+
* render();
|
|
58
|
+
*/
|
|
59
|
+
init(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Set the user's platform-level date of birth. Set-once: throws if it's
|
|
62
|
+
* already set (status 409 from the backend) or if age < 13. After success
|
|
63
|
+
* the cached user is updated and listeners are notified.
|
|
64
|
+
*
|
|
65
|
+
* @param dateOfBirth ISO 'YYYY-MM-DD' string.
|
|
66
|
+
*/
|
|
67
|
+
setDateOfBirth(dateOfBirth: string): Promise<User>;
|
|
68
|
+
private fetchUser;
|
|
69
|
+
/** Fire-and-forget: ensure the user has at least 'member' role in this app. */
|
|
70
|
+
private ensureMember;
|
|
71
|
+
private readStorage;
|
|
72
|
+
private writeStorage;
|
|
73
|
+
private emit;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAazD,oEAAoE;AACpE,qBAAa,IAAI;IAKb,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAA0C;gBAGxC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM;IAMlC,4DAA4D;IAC5D,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,CAEtB;IAED,2DAA2D;IAC3D,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAEzB;IAED,kGAAkG;IAClG,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,WAAW;IAM5D;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,GAAE,YAAuB,GAAG,IAAI;IAa/C;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAenD,8CAA8C;IAC9C,OAAO,IAAI,IAAI;IAQf;;;;OAIG;IACH,kBAAkB,IAAI,IAAI;IAI1B;;;;;;;;;;;;OAYG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B3B;;;;;;OAMG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YA4B1C,SAAS;IAQvB,+EAA+E;IAC/E,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,IAAI;CAGb"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared across all FAS apps on the same origin — this is intentional SSO.
|
|
3
|
+
* A user signed in on one FAS app is signed in on all of them.
|
|
4
|
+
*/
|
|
5
|
+
const STORAGE_KEY = 'fas:session';
|
|
6
|
+
/** OAuth authentication — sign in, sign out, session management. */
|
|
7
|
+
export class Auth {
|
|
8
|
+
appId;
|
|
9
|
+
apiBase;
|
|
10
|
+
session = null;
|
|
11
|
+
listeners = new Set();
|
|
12
|
+
constructor(appId, apiBase) {
|
|
13
|
+
this.appId = appId;
|
|
14
|
+
this.apiBase = apiBase;
|
|
15
|
+
this.session = this.readStorage();
|
|
16
|
+
if (this.session)
|
|
17
|
+
this.ensureMember();
|
|
18
|
+
}
|
|
19
|
+
/** Current signed-in user, or null if not authenticated. */
|
|
20
|
+
get user() {
|
|
21
|
+
return this.session?.user ?? null;
|
|
22
|
+
}
|
|
23
|
+
/** Current session token, or null if not authenticated. */
|
|
24
|
+
get token() {
|
|
25
|
+
return this.session?.token ?? null;
|
|
26
|
+
}
|
|
27
|
+
/** Subscribe to auth state changes. Fires immediately with current user, then on every change. */
|
|
28
|
+
onChange(listener) {
|
|
29
|
+
this.listeners.add(listener);
|
|
30
|
+
listener(this.user);
|
|
31
|
+
return () => this.listeners.delete(listener);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Redirect-based GitHub OAuth. Opens the platform's hosted OAuth start URL,
|
|
35
|
+
* which redirects back to the current page with a session token in the hash.
|
|
36
|
+
*
|
|
37
|
+
* The current page's `location.hash` is dropped from `return_to` because
|
|
38
|
+
* the OAuth callback writes its own `#fas_session=…` and would clobber any
|
|
39
|
+
* hash-based router state otherwise.
|
|
40
|
+
*/
|
|
41
|
+
signIn(provider = 'github') {
|
|
42
|
+
if (typeof window === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
if (provider === 'email') {
|
|
45
|
+
throw new Error('Use signInWithEmail(email) for email magic-link sign-in.');
|
|
46
|
+
}
|
|
47
|
+
const here = new URL(window.location.href);
|
|
48
|
+
here.hash = '';
|
|
49
|
+
const url = new URL(`/v1/auth/${provider}/start`, this.apiBase);
|
|
50
|
+
url.searchParams.set('app_id', this.appId);
|
|
51
|
+
url.searchParams.set('return_to', here.toString());
|
|
52
|
+
window.location.assign(url.toString());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Email magic-link sign-in. Sends the user an email with a one-time link
|
|
56
|
+
* that completes auth and redirects back here with `#fas_session=…`.
|
|
57
|
+
*
|
|
58
|
+
* Resolves once the email has been queued. The caller should show a
|
|
59
|
+
* "check your inbox" message — the actual sign-in happens later when
|
|
60
|
+
* the user clicks the link.
|
|
61
|
+
*
|
|
62
|
+
* Throws on validation or server errors. Resolves with `{ ok: true }`
|
|
63
|
+
* regardless of whether the email is already registered (no account-
|
|
64
|
+
* enumeration leak).
|
|
65
|
+
*/
|
|
66
|
+
async signInWithEmail(email) {
|
|
67
|
+
if (typeof window === 'undefined')
|
|
68
|
+
return;
|
|
69
|
+
const here = new URL(window.location.href);
|
|
70
|
+
here.hash = '';
|
|
71
|
+
const res = await fetch(new URL('/v1/auth/email/start', this.apiBase), {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'Content-Type': 'application/json' },
|
|
74
|
+
body: JSON.stringify({ email, appId: this.appId, returnTo: here.toString() }),
|
|
75
|
+
});
|
|
76
|
+
if (!res.ok) {
|
|
77
|
+
const body = await res.text();
|
|
78
|
+
throw new Error(`Magic-link request failed: ${res.status} ${body}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Clear the session and notify listeners. */
|
|
82
|
+
signOut() {
|
|
83
|
+
this.session = null;
|
|
84
|
+
if (typeof window !== 'undefined') {
|
|
85
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
86
|
+
}
|
|
87
|
+
this.emit();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @internal Called by Kv and ApiProxy on 401 responses.
|
|
91
|
+
* Clears the stale session so the UI reacts immediately.
|
|
92
|
+
* Do not call directly — use `signOut()` instead.
|
|
93
|
+
*/
|
|
94
|
+
handleUnauthorized() {
|
|
95
|
+
if (this.session)
|
|
96
|
+
this.signOut();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Call this once at app start, before rendering anything that depends on
|
|
100
|
+
* auth state. If the page was loaded via an auth callback (e.g. after
|
|
101
|
+
* `signIn()` returned from GitHub), this captures the session from the
|
|
102
|
+
* URL hash, persists it to localStorage, and clears the hash. On a normal
|
|
103
|
+
* page load it's a no-op — the constructor already restored any cached
|
|
104
|
+
* session from localStorage.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* const fas = initApp({ appId: 'my-app' });
|
|
108
|
+
* await fas.auth.init();
|
|
109
|
+
* render();
|
|
110
|
+
*/
|
|
111
|
+
async init() {
|
|
112
|
+
if (typeof window === 'undefined')
|
|
113
|
+
return;
|
|
114
|
+
const hash = window.location.hash;
|
|
115
|
+
if (!hash.startsWith('#fas_session='))
|
|
116
|
+
return;
|
|
117
|
+
// Always clear the hash before doing anything else — even on failure.
|
|
118
|
+
// Otherwise a bad token gets re-tried on every reload and the user is
|
|
119
|
+
// permanently stuck on a "broken" URL.
|
|
120
|
+
history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
121
|
+
let token;
|
|
122
|
+
try {
|
|
123
|
+
token = decodeURIComponent(hash.slice('#fas_session='.length));
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Malformed hash (% with nothing after, etc.). Hash already cleared.
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!token)
|
|
130
|
+
return;
|
|
131
|
+
try {
|
|
132
|
+
const user = await this.fetchUser(token);
|
|
133
|
+
this.session = { token, user };
|
|
134
|
+
this.writeStorage(this.session);
|
|
135
|
+
this.emit();
|
|
136
|
+
this.ensureMember();
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Token was invalid or network failed. Hash already cleared so the user
|
|
140
|
+
// won't get stuck in a retry loop. Silently remain signed out.
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Set the user's platform-level date of birth. Set-once: throws if it's
|
|
145
|
+
* already set (status 409 from the backend) or if age < 13. After success
|
|
146
|
+
* the cached user is updated and listeners are notified.
|
|
147
|
+
*
|
|
148
|
+
* @param dateOfBirth ISO 'YYYY-MM-DD' string.
|
|
149
|
+
*/
|
|
150
|
+
async setDateOfBirth(dateOfBirth) {
|
|
151
|
+
if (!this.session)
|
|
152
|
+
throw new Error('Not signed in.');
|
|
153
|
+
const response = await fetch(new URL('/v1/auth/me/date-of-birth', this.apiBase), {
|
|
154
|
+
method: 'PATCH',
|
|
155
|
+
headers: {
|
|
156
|
+
Authorization: `Bearer ${this.session.token}`,
|
|
157
|
+
'Content-Type': 'application/json',
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify({ dateOfBirth }),
|
|
160
|
+
});
|
|
161
|
+
if (response.status === 401) {
|
|
162
|
+
this.handleUnauthorized();
|
|
163
|
+
throw new Error('Not signed in.');
|
|
164
|
+
}
|
|
165
|
+
if (response.status === 409) {
|
|
166
|
+
throw new Error('Date of birth already set.');
|
|
167
|
+
}
|
|
168
|
+
if (!response.ok) {
|
|
169
|
+
const body = await response.text();
|
|
170
|
+
throw new Error(`setDateOfBirth failed (${response.status}): ${body}`);
|
|
171
|
+
}
|
|
172
|
+
const user = (await response.json());
|
|
173
|
+
this.session = { ...this.session, user };
|
|
174
|
+
this.writeStorage(this.session);
|
|
175
|
+
this.emit();
|
|
176
|
+
return user;
|
|
177
|
+
}
|
|
178
|
+
async fetchUser(token) {
|
|
179
|
+
const response = await fetch(new URL('/v1/auth/me', this.apiBase), {
|
|
180
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
181
|
+
});
|
|
182
|
+
if (!response.ok)
|
|
183
|
+
throw new Error(`Auth failed: ${response.status}`);
|
|
184
|
+
return (await response.json());
|
|
185
|
+
}
|
|
186
|
+
/** Fire-and-forget: ensure the user has at least 'member' role in this app. */
|
|
187
|
+
ensureMember() {
|
|
188
|
+
if (typeof fetch === 'undefined')
|
|
189
|
+
return; // SSR / test env
|
|
190
|
+
const t = this.session?.token;
|
|
191
|
+
if (!t)
|
|
192
|
+
return;
|
|
193
|
+
fetch(`${this.apiBase}/v1/apps/${encodeURIComponent(this.appId)}/roles/ensure-member`, {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
headers: { Authorization: `Bearer ${t}` },
|
|
196
|
+
}).catch(() => { }); // silent — non-blocking
|
|
197
|
+
}
|
|
198
|
+
readStorage() {
|
|
199
|
+
if (typeof window === 'undefined')
|
|
200
|
+
return null;
|
|
201
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
202
|
+
if (!raw)
|
|
203
|
+
return null;
|
|
204
|
+
try {
|
|
205
|
+
return JSON.parse(raw);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
writeStorage(session) {
|
|
212
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(session));
|
|
213
|
+
}
|
|
214
|
+
emit() {
|
|
215
|
+
for (const listener of this.listeners)
|
|
216
|
+
listener(this.user);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC;AAOlC,oEAAoE;AACpE,MAAM,OAAO,IAAI;IAKI;IACA;IALX,OAAO,GAAmB,IAAI,CAAC;IAC/B,SAAS,GAAG,IAAI,GAAG,EAA+B,CAAC;IAE3D,YACmB,KAAa,EACb,OAAe;QADf,UAAK,GAAL,KAAK,CAAQ;QACb,YAAO,GAAP,OAAO,CAAQ;QAEhC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED,4DAA4D;IAC5D,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC;IACpC,CAAC;IAED,2DAA2D;IAC3D,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC;IACrC,CAAC;IAED,kGAAkG;IAClG,QAAQ,CAAC,QAAqC;QAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,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K,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC9C,CAAC;IAEO,WAAW;QACjB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,OAAgB;QACnC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAEO,IAAI;QACV,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS;YAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Authenticated user profile from GitHub OAuth. */
|
|
2
|
+
export interface User {
|
|
3
|
+
id: string;
|
|
4
|
+
login: string;
|
|
5
|
+
avatarUrl: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Platform-level date of birth in `YYYY-MM-DD` form. Null until the user
|
|
8
|
+
* has set it through any app — once set, it propagates across the
|
|
9
|
+
* platform and cannot be changed without contacting support.
|
|
10
|
+
*/
|
|
11
|
+
dateOfBirth: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** Options for initializing the SDK via `initApp()`. */
|
|
14
|
+
export interface FasInitOptions {
|
|
15
|
+
/** The app's unique identifier (e.g. "tuner", "quicknotes"). */
|
|
16
|
+
appId: string;
|
|
17
|
+
/** Override the API base URL (defaults to https://api.freeappstore.online). */
|
|
18
|
+
apiBase?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Callback returned by subscribe methods — call to unsubscribe. */
|
|
21
|
+
export type Unsubscribe = () => void;
|
|
22
|
+
//# sourceMappingURL=base-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;OAIG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oEAAoE;AACpE,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.js","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Auth } from './auth.js';
|
|
2
|
+
/**
|
|
3
|
+
* Shared atomic counters — not user-scoped.
|
|
4
|
+
* Any authenticated user can increment; anyone can read.
|
|
5
|
+
* Use for: vote tallies, view counts, leaderboards.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Counters {
|
|
8
|
+
private readonly appId;
|
|
9
|
+
private readonly apiBase;
|
|
10
|
+
private readonly auth;
|
|
11
|
+
constructor(appId: string, apiBase: string, auth: Auth);
|
|
12
|
+
/** Get all counters (or filter by prefix). Public — no auth required. */
|
|
13
|
+
list(opts?: {
|
|
14
|
+
prefix?: string;
|
|
15
|
+
}): Promise<Record<string, number>>;
|
|
16
|
+
/** Get a single counter value. Public — no auth required. */
|
|
17
|
+
get(key: string): Promise<number>;
|
|
18
|
+
/** Increment (or decrement) a counter. Requires auth. Returns new value. */
|
|
19
|
+
increment(key: string, amount?: number): Promise<number>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=counters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counters.d.ts","sourceRoot":"","sources":["../src/counters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;GAIG;AACH,qBAAa,QAAQ;IAEjB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI;IAG7B,yEAAyE;IACnE,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAQvE,6DAA6D;IACvD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWvC,4EAA4E;IACtE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,MAAM,CAAC;CAsB1D"}
|
package/dist/counters.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared atomic counters — not user-scoped.
|
|
3
|
+
* Any authenticated user can increment; anyone can read.
|
|
4
|
+
* Use for: vote tallies, view counts, leaderboards.
|
|
5
|
+
*/
|
|
6
|
+
export class Counters {
|
|
7
|
+
appId;
|
|
8
|
+
apiBase;
|
|
9
|
+
auth;
|
|
10
|
+
constructor(appId, apiBase, auth) {
|
|
11
|
+
this.appId = appId;
|
|
12
|
+
this.apiBase = apiBase;
|
|
13
|
+
this.auth = auth;
|
|
14
|
+
}
|
|
15
|
+
/** Get all counters (or filter by prefix). Public — no auth required. */
|
|
16
|
+
async list(opts) {
|
|
17
|
+
const url = new URL(`/v1/apps/${encodeURIComponent(this.appId)}/counters`, this.apiBase);
|
|
18
|
+
if (opts?.prefix)
|
|
19
|
+
url.searchParams.set('prefix', opts.prefix);
|
|
20
|
+
const response = await fetch(url);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
throw new Error(`counters.list failed: ${response.status}`);
|
|
23
|
+
return (await response.json());
|
|
24
|
+
}
|
|
25
|
+
/** Get a single counter value. Public — no auth required. */
|
|
26
|
+
async get(key) {
|
|
27
|
+
const url = new URL(`/v1/apps/${encodeURIComponent(this.appId)}/counters/${encodeURIComponent(key)}`, this.apiBase);
|
|
28
|
+
const response = await fetch(url);
|
|
29
|
+
if (!response.ok)
|
|
30
|
+
throw new Error(`counters.get failed: ${response.status}`);
|
|
31
|
+
const data = (await response.json());
|
|
32
|
+
return data.value;
|
|
33
|
+
}
|
|
34
|
+
/** Increment (or decrement) a counter. Requires auth. Returns new value. */
|
|
35
|
+
async increment(key, amount = 1) {
|
|
36
|
+
if (!this.auth.token)
|
|
37
|
+
throw new Error('Not signed in.');
|
|
38
|
+
const url = new URL(`/v1/apps/${encodeURIComponent(this.appId)}/counters/${encodeURIComponent(key)}`, this.apiBase);
|
|
39
|
+
const response = await fetch(url, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: {
|
|
42
|
+
Authorization: `Bearer ${this.auth.token}`,
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
},
|
|
45
|
+
body: JSON.stringify({ increment: amount }),
|
|
46
|
+
});
|
|
47
|
+
if (response.status === 401) {
|
|
48
|
+
this.auth.handleUnauthorized();
|
|
49
|
+
throw new Error('Not signed in.');
|
|
50
|
+
}
|
|
51
|
+
if (!response.ok)
|
|
52
|
+
throw new Error(`counters.increment failed: ${response.status}`);
|
|
53
|
+
const data = (await response.json());
|
|
54
|
+
return data.value;
|
|
55
|
+
}
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@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProAppStore } from './index.js';
|
|
2
2
|
import type { Subscription } from './types.js';
|
|
3
|
-
export type { User } from '
|
|
3
|
+
export type { User } from './base-types.js';
|
|
4
4
|
export type { NotificationPayload, SendResult } from './notifications.js';
|
|
5
5
|
type ThemePreference = 'light' | 'dark' | 'system';
|
|
6
6
|
type ResolvedTheme = 'light' | 'dark';
|
|
@@ -25,7 +25,7 @@ export declare function useTheme(): {
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export declare function useProAuth(app: ProAppStore): {
|
|
28
|
-
user: import("
|
|
28
|
+
user: import("./base-types.js").User | null;
|
|
29
29
|
loading: boolean;
|
|
30
30
|
signIn: () => void;
|
|
31
31
|
signOut: () => void;
|
|
@@ -85,7 +85,7 @@ export declare function useProGate(app: ProAppStore, opts?: {
|
|
|
85
85
|
allowFree?: boolean;
|
|
86
86
|
}): {
|
|
87
87
|
gate: "loading" | "signed-out" | "no-subscription" | "ready";
|
|
88
|
-
user: import("
|
|
88
|
+
user: import("./base-types.js").User | null;
|
|
89
89
|
subscription: Subscription | null;
|
|
90
90
|
isPro: boolean;
|
|
91
91
|
signIn: () => void;
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,YAAY,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAO1E,KAAK,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AACnD,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AA2DtC;;;GAGG;AACH,wBAAgB,QAAQ;;;0BAGmB,eAAe;EASzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW;;;;;;EAuB1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW;;;;wBAiBJ,MAAM;;EAapD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW;;;;;;EAoCnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;wBAhF5B,MAAM;;EA+GpD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Auth } from './auth.js';
|
|
2
|
+
import { Kv } from './kv.js';
|
|
3
|
+
import { Counters } from './counters.js';
|
|
4
|
+
import { Rooms } from './rooms.js';
|
|
5
|
+
import { Roles } from './roles.js';
|
|
6
|
+
import { ApiProxy } from './proxy.js';
|
|
2
7
|
import { AI } from './ai.js';
|
|
3
8
|
import { Database } from './db.js';
|
|
4
9
|
import { Maps } from './maps.js';
|
|
@@ -11,7 +16,11 @@ import { Usage } from './usage.js';
|
|
|
11
16
|
import { Email } from './email.js';
|
|
12
17
|
import { Webhooks } from './webhooks.js';
|
|
13
18
|
import type { ProInitOptions } from './types.js';
|
|
14
|
-
export type { User, Unsubscribe
|
|
19
|
+
export type { User, Unsubscribe } from './base-types.js';
|
|
20
|
+
export type { AuthProvider } from './auth.js';
|
|
21
|
+
export type { ConnectionState, Room, RoomMessage, RoomPeer } from './rooms.js';
|
|
22
|
+
export type { DefaultRole, RoleAssignment } from './roles.js';
|
|
23
|
+
export { DEFAULT_ROLES } from './roles.js';
|
|
15
24
|
export type { ProInitOptions, Subscription, SubscriptionStatus, CheckoutRequest, LicenseInfo, } from './types.js';
|
|
16
25
|
export type { QueryResult, ExecuteResult, Migration, MigrateResult } from './db.js';
|
|
17
26
|
export type { NotificationPayload, SendResult } from './notifications.js';
|
|
@@ -24,12 +33,20 @@ export { Email } from './email.js';
|
|
|
24
33
|
export { Webhooks } from './webhooks.js';
|
|
25
34
|
export type { WebhookConfig, WebhookTestResult } from './webhooks.js';
|
|
26
35
|
/**
|
|
27
|
-
* Pro SDK instance —
|
|
28
|
-
*
|
|
36
|
+
* Pro SDK instance — the free primitives (auth, kv, counters, rooms, proxy,
|
|
37
|
+
* roles) PLUS the Pro features (db, storage, maps, notifications, sms, ai, usage,
|
|
38
|
+
* email, webhooks, subscription, license). One import, one instance, all features.
|
|
29
39
|
*
|
|
30
|
-
*
|
|
40
|
+
* auth/kv/counters/rooms/roles are FAS-backed (shared identity + free tier);
|
|
41
|
+
* proxy + every Pro feature hit the PAS backend.
|
|
31
42
|
*/
|
|
32
|
-
export declare class ProAppStore
|
|
43
|
+
export declare class ProAppStore {
|
|
44
|
+
readonly auth: Auth;
|
|
45
|
+
readonly kv: Kv;
|
|
46
|
+
readonly counters: Counters;
|
|
47
|
+
readonly rooms: Rooms;
|
|
48
|
+
readonly roles: Roles;
|
|
49
|
+
readonly proxy: ApiProxy;
|
|
33
50
|
readonly subscription: SubscriptionApi;
|
|
34
51
|
readonly license: LicenseApi;
|
|
35
52
|
readonly db: Database;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.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AAE,IAAI,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,IAAI,EAAE,cAAc;CA6BjC;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,CAEzD"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// Self-contained PAS SDK — no runtime dependency on @freeappstore/sdk. The free
|
|
2
|
+
// primitives (auth, kv, counters, rooms, proxy, roles) are VENDORED here (copied
|
|
3
|
+
// from the FAS SDK source, per the workspace "vendor, don't depend" rule), so a
|
|
4
|
+
// published @proappstore/sdk stands alone and never lags a separate package.
|
|
5
|
+
import { Auth } from './auth.js';
|
|
6
|
+
import { Kv } from './kv.js';
|
|
7
|
+
import { Counters } from './counters.js';
|
|
8
|
+
import { Rooms } from './rooms.js';
|
|
9
|
+
import { Roles } from './roles.js';
|
|
2
10
|
import { ApiProxy } from './proxy.js';
|
|
3
11
|
import { AI } from './ai.js';
|
|
4
12
|
import { Database } from './db.js';
|
|
@@ -11,17 +19,28 @@ import { LicenseApi } from './license.js';
|
|
|
11
19
|
import { Usage } from './usage.js';
|
|
12
20
|
import { Email } from './email.js';
|
|
13
21
|
import { Webhooks } from './webhooks.js';
|
|
22
|
+
export { DEFAULT_ROLES } from './roles.js';
|
|
14
23
|
export { TenantScope } from './tenant.js';
|
|
15
24
|
export { Usage } from './usage.js';
|
|
16
25
|
export { Email } from './email.js';
|
|
17
26
|
export { Webhooks } from './webhooks.js';
|
|
18
27
|
/**
|
|
19
|
-
* Pro SDK instance —
|
|
20
|
-
*
|
|
28
|
+
* Pro SDK instance — the free primitives (auth, kv, counters, rooms, proxy,
|
|
29
|
+
* roles) PLUS the Pro features (db, storage, maps, notifications, sms, ai, usage,
|
|
30
|
+
* email, webhooks, subscription, license). One import, one instance, all features.
|
|
21
31
|
*
|
|
22
|
-
*
|
|
32
|
+
* auth/kv/counters/rooms/roles are FAS-backed (shared identity + free tier);
|
|
33
|
+
* proxy + every Pro feature hit the PAS backend.
|
|
23
34
|
*/
|
|
24
|
-
export class ProAppStore
|
|
35
|
+
export class ProAppStore {
|
|
36
|
+
// Free primitives (FAS-backed)
|
|
37
|
+
auth;
|
|
38
|
+
kv;
|
|
39
|
+
counters;
|
|
40
|
+
rooms;
|
|
41
|
+
roles;
|
|
42
|
+
proxy;
|
|
43
|
+
// Pro features (PAS-backed)
|
|
25
44
|
subscription;
|
|
26
45
|
license;
|
|
27
46
|
db;
|
|
@@ -34,10 +53,15 @@ export class ProAppStore extends FreeAppStore {
|
|
|
34
53
|
email;
|
|
35
54
|
webhooks;
|
|
36
55
|
constructor(opts) {
|
|
37
|
-
|
|
56
|
+
const fasApiBase = opts.fasApiBase ?? 'https://api.freeappstore.online';
|
|
38
57
|
const proApiBase = opts.proApiBase ?? 'https://api.proappstore.online';
|
|
39
|
-
//
|
|
40
|
-
|
|
58
|
+
// Free primitives + identity live on FAS (shared auth/kv/counters/rooms/roles).
|
|
59
|
+
this.auth = new Auth(opts.appId, fasApiBase);
|
|
60
|
+
this.kv = new Kv(opts.appId, fasApiBase, this.auth);
|
|
61
|
+
this.counters = new Counters(opts.appId, fasApiBase, this.auth);
|
|
62
|
+
this.rooms = new Rooms(opts.appId, fasApiBase, this.auth);
|
|
63
|
+
this.roles = new Roles(opts.appId, fasApiBase, this.auth);
|
|
64
|
+
// proxy + Pro features hit the PAS backend (its own proxy/secrets/allowlist).
|
|
41
65
|
this.proxy = new ApiProxy(opts.appId, proApiBase, this.auth);
|
|
42
66
|
this.subscription = new SubscriptionApi(opts.appId, proApiBase, this.auth);
|
|
43
67
|
this.license = new LicenseApi(opts.appId, proApiBase, this.auth);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,6EAA6E;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAsB3C,OAAO,EAA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CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,qEAAqE;QACrE,qEAAqE;QACrE,kCAAkC;QAClC,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC;gBAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,iDAAiD,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,IAAoB;IAC1C,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/kv.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Auth } from './auth.js';
|
|
2
|
+
export declare class Kv {
|
|
3
|
+
private readonly appId;
|
|
4
|
+
private readonly apiBase;
|
|
5
|
+
private readonly auth;
|
|
6
|
+
constructor(appId: string, apiBase: string, auth: Auth);
|
|
7
|
+
/** List all keys for this user. Optionally filter by prefix. */
|
|
8
|
+
list(opts?: {
|
|
9
|
+
prefix?: string;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}): Promise<string[]>;
|
|
12
|
+
/** Fetch multiple keys in parallel. Returns a Map of found key-value pairs (skips failures and missing keys). */
|
|
13
|
+
getMany<T = unknown>(keys: string[], opts?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}): Promise<Map<string, T>>;
|
|
16
|
+
/** Get a value by key. Returns null if not found. */
|
|
17
|
+
get<T = unknown>(key: string, opts?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<T | null>;
|
|
20
|
+
/** Store a JSON-serializable value under the given key. */
|
|
21
|
+
set<T = unknown>(key: string, value: T, opts?: {
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
/** Delete a key. No-op if the key doesn't exist. */
|
|
25
|
+
delete(key: string, opts?: {
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
private request;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=kv.d.ts.map
|