@phibac/sdk 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +53 -2
- package/dist/auth.d.ts +104 -0
- package/dist/auth.js +343 -0
- package/dist/auth.js.map +1 -0
- package/dist/brand.d.ts +7 -0
- package/dist/brand.js +8 -0
- package/dist/brand.js.map +1 -0
- package/dist/cache.d.ts +170 -0
- package/dist/cache.js +293 -0
- package/dist/cache.js.map +1 -0
- package/dist/collection.d.ts +119 -0
- package/dist/collection.js +511 -0
- package/dist/collection.js.map +1 -0
- package/dist/dpop.d.ts +50 -0
- package/dist/dpop.js +105 -0
- package/dist/dpop.js.map +1 -0
- package/dist/errors.d.ts +22 -0
- package/dist/errors.js +55 -0
- package/dist/errors.js.map +1 -0
- package/dist/files.d.ts +25 -0
- package/dist/files.js +65 -0
- package/dist/files.js.map +1 -0
- package/dist/http.d.ts +53 -0
- package/dist/http.js +130 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +209 -0
- package/dist/index.js.map +1 -0
- package/dist/live.d.ts +116 -0
- package/dist/live.js +448 -0
- package/dist/live.js.map +1 -0
- package/dist/queue.d.ts +103 -0
- package/dist/queue.js +397 -0
- package/dist/queue.js.map +1 -0
- package/package.json +45 -4
- package/src/auth.ts +371 -0
- package/src/brand.ts +8 -0
- package/src/cache.ts +379 -0
- package/src/collection.ts +533 -0
- package/src/dpop.ts +132 -0
- package/src/errors.ts +61 -0
- package/src/files.ts +60 -0
- package/src/http.ts +154 -0
- package/src/index.ts +238 -0
- package/src/live.ts +434 -0
- package/src/queue.ts +419 -0
package/dist/queue.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// The offline write queue's flusher: queued writes are sent in order
|
|
2
|
+
// through POST /v1/batch while online, by one tab at a time, and each
|
|
3
|
+
// result is applied to the cache. Also Net, which tracks whether the
|
|
4
|
+
// server is reachable and the problems the app should tell the user about.
|
|
5
|
+
import { opKey, fold } from "./cache.js";
|
|
6
|
+
import { PbError } from "./errors.js";
|
|
7
|
+
/** At most this many operations per batch (the server's BatchMax). */
|
|
8
|
+
const BATCH_OPS = 100;
|
|
9
|
+
/** About this many bytes of JSON per batch (the server allows 4 MiB). */
|
|
10
|
+
const BATCH_BYTES = 3.5 * 1024 * 1024;
|
|
11
|
+
const BACKOFF_START_MS = 1000;
|
|
12
|
+
const BACKOFF_MAX_MS = 60_000;
|
|
13
|
+
/**
|
|
14
|
+
* Errors that a retry can never fix: the op is dropped and reported
|
|
15
|
+
* through onConflict. Codes not listed here or in TRANSIENT are treated as
|
|
16
|
+
* permanent too, so an unknown error can never block the queue forever
|
|
17
|
+
* (the data is handed to onConflict, not lost).
|
|
18
|
+
*/
|
|
19
|
+
const PERMANENT = new Set([
|
|
20
|
+
"record_deleted", "forbidden", "schema_violation", "version_unsupported", "not_found",
|
|
21
|
+
"invalid_request", "payload_too_large", "consent_required",
|
|
22
|
+
]);
|
|
23
|
+
/** Errors that are retried with backoff, keeping the op and everything after it. */
|
|
24
|
+
const TRANSIENT = new Set([
|
|
25
|
+
"network", "internal", "invalid_response", "rate_limited", "storage_full", "trial_ended", "unauthorized", "app_suspended",
|
|
26
|
+
]);
|
|
27
|
+
/** Transient errors the user can act on: surfaced as status().problem. */
|
|
28
|
+
const USER_FIXABLE = new Set(["storage_full", "trial_ended", "app_suspended"]);
|
|
29
|
+
/**
|
|
30
|
+
* Errors on the whole /v1/batch request that one of its operations can
|
|
31
|
+
* cause; the queue then sends operations one at a time to find it. Any
|
|
32
|
+
* other whole-request error (e.g. forbidden for the page's origin) says
|
|
33
|
+
* nothing about the operations: the queue is kept and retried.
|
|
34
|
+
*/
|
|
35
|
+
function causedByAnOp(e) {
|
|
36
|
+
// With several ops the culprit is searched for one op at a time; a request
|
|
37
|
+
// of exactly one op refused this way is that op's own failure.
|
|
38
|
+
return e.code === "payload_too_large" || e.code === "invalid_request";
|
|
39
|
+
}
|
|
40
|
+
/** Whole-request failures worth showing: everything but the plain outages. */
|
|
41
|
+
function worthShowing(e) {
|
|
42
|
+
const status = e.extra.status;
|
|
43
|
+
return !["network", "internal", "rate_limited"].includes(e.code) && !(typeof status === "number" && status >= 500);
|
|
44
|
+
}
|
|
45
|
+
export function isTransient(e) {
|
|
46
|
+
if (PERMANENT.has(e.code))
|
|
47
|
+
return false;
|
|
48
|
+
const status = e.extra.status;
|
|
49
|
+
return TRANSIENT.has(e.code) || (typeof status === "number" && status >= 500);
|
|
50
|
+
}
|
|
51
|
+
export function asPbError(e) {
|
|
52
|
+
if (e instanceof PbError)
|
|
53
|
+
return e;
|
|
54
|
+
return new PbError("internal", e instanceof Error ? e.message : String(e), "Retry later.");
|
|
55
|
+
}
|
|
56
|
+
// ---- reachability ----
|
|
57
|
+
/**
|
|
58
|
+
* Net makes every API call for the SDK's background work and remembers
|
|
59
|
+
* whether the last one reached the server. problem() is the first
|
|
60
|
+
* condition the app should show the user (storage_full, trial_ended,
|
|
61
|
+
* app_suspended, account_closed, consent_required for live updates), or
|
|
62
|
+
* undefined.
|
|
63
|
+
*/
|
|
64
|
+
export class Net {
|
|
65
|
+
http;
|
|
66
|
+
reached = true;
|
|
67
|
+
problems = new Map();
|
|
68
|
+
/** Aborted by abort(): cancels every request in flight (signOut). */
|
|
69
|
+
ac = new AbortController();
|
|
70
|
+
constructor(http) {
|
|
71
|
+
this.http = http;
|
|
72
|
+
}
|
|
73
|
+
/** Whether the device says it is online and the last call reached the server. */
|
|
74
|
+
get online() {
|
|
75
|
+
const nav = typeof navigator === "undefined" ? undefined : navigator;
|
|
76
|
+
return this.reached && nav?.onLine !== false;
|
|
77
|
+
}
|
|
78
|
+
/** Whether the device says it is online (requests are worth trying). */
|
|
79
|
+
get deviceOnline() {
|
|
80
|
+
return typeof navigator === "undefined" || navigator.onLine !== false;
|
|
81
|
+
}
|
|
82
|
+
set online(v) {
|
|
83
|
+
this.reached = v;
|
|
84
|
+
}
|
|
85
|
+
async request(method, path, body, headers) {
|
|
86
|
+
try {
|
|
87
|
+
const out = await this.http.request(method, path, body, headers, this.ac.signal);
|
|
88
|
+
this.reached = true;
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
const err = asPbError(e);
|
|
93
|
+
if (err.code === "network")
|
|
94
|
+
this.reached = false;
|
|
95
|
+
else
|
|
96
|
+
this.reached = true;
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** abort cancels every request in flight and every later one. */
|
|
101
|
+
abort() {
|
|
102
|
+
this.ac.abort();
|
|
103
|
+
}
|
|
104
|
+
problem() {
|
|
105
|
+
return this.problems.values().next().value;
|
|
106
|
+
}
|
|
107
|
+
setProblem(source, e) {
|
|
108
|
+
if (e)
|
|
109
|
+
this.problems.set(source, e);
|
|
110
|
+
else
|
|
111
|
+
this.problems.delete(source);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function wireOp(op) {
|
|
115
|
+
const out = { kind: op.kind, collection: op.collection, rkey: op.rkey, opId: op.opId };
|
|
116
|
+
const { schemaMajor, baseRev, data } = op.input;
|
|
117
|
+
if (schemaMajor !== undefined)
|
|
118
|
+
out.schemaMajor = schemaMajor;
|
|
119
|
+
if (baseRev !== undefined)
|
|
120
|
+
out.baseRev = baseRev;
|
|
121
|
+
if (data !== undefined)
|
|
122
|
+
out.data = data;
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
const byteLength = (v) => new TextEncoder().encode(JSON.stringify(v)).length;
|
|
126
|
+
function resultError(e) {
|
|
127
|
+
const { code, message, hint, ...extra } = e;
|
|
128
|
+
return new PbError(typeof code === "string" ? code : "internal", typeof message === "string" ? message : "", typeof hint === "string" ? hint : "", extra);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Flusher sends the queue in order through /v1/batch: chunks of at most
|
|
132
|
+
* 100 operations and about 3.5 MiB, only while the device is online, and
|
|
133
|
+
* only in the tab holding the queue's Web Lock. A success stores the
|
|
134
|
+
* server's record; a permanent error drops the op through onConflict and
|
|
135
|
+
* reverts the record; a transient error keeps the op and everything after
|
|
136
|
+
* it and retries with backoff (1 s doubling to 60 s, at least Retry-After).
|
|
137
|
+
*/
|
|
138
|
+
export class Flusher {
|
|
139
|
+
d;
|
|
140
|
+
/** The number of queued writes, as last counted. */
|
|
141
|
+
pending = 0;
|
|
142
|
+
timer;
|
|
143
|
+
attempt = 0;
|
|
144
|
+
running = false;
|
|
145
|
+
again = false;
|
|
146
|
+
stopped = false;
|
|
147
|
+
/** The flush in progress (awaited by idle()). */
|
|
148
|
+
current = null;
|
|
149
|
+
/** Send one op alone next: a whole batch was refused for good. */
|
|
150
|
+
solo = false;
|
|
151
|
+
localTail = Promise.resolve();
|
|
152
|
+
constructor(d) {
|
|
153
|
+
this.d = d;
|
|
154
|
+
}
|
|
155
|
+
/** count re-reads the queue length. */
|
|
156
|
+
async count() {
|
|
157
|
+
this.pending = await this.d.cache.queueLength();
|
|
158
|
+
this.d.counted?.();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* kick asks for a flush. While a retry is scheduled the retry runs instead,
|
|
162
|
+
* unless now is true (the device just came online), which retries at once
|
|
163
|
+
* with the backoff reset.
|
|
164
|
+
*/
|
|
165
|
+
kick(now = false) {
|
|
166
|
+
if (this.stopped)
|
|
167
|
+
return;
|
|
168
|
+
if (this.timer !== undefined) {
|
|
169
|
+
if (!now)
|
|
170
|
+
return;
|
|
171
|
+
clearTimeout(this.timer);
|
|
172
|
+
this.timer = undefined;
|
|
173
|
+
this.attempt = 0;
|
|
174
|
+
}
|
|
175
|
+
if (!this.d.net.deviceOnline)
|
|
176
|
+
return;
|
|
177
|
+
if (this.running) {
|
|
178
|
+
this.again = true;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.running = true;
|
|
182
|
+
this.current = this.withLock(() => this.flushLocked())
|
|
183
|
+
.catch(() => undefined)
|
|
184
|
+
.finally(() => {
|
|
185
|
+
this.running = false;
|
|
186
|
+
this.current = null;
|
|
187
|
+
if (this.again && this.timer === undefined) {
|
|
188
|
+
this.again = false;
|
|
189
|
+
this.kick();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
stop() {
|
|
194
|
+
this.stopped = true;
|
|
195
|
+
if (this.timer !== undefined)
|
|
196
|
+
clearTimeout(this.timer);
|
|
197
|
+
this.timer = undefined;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* idle resolves once no flush is in progress (after stop(), none starts).
|
|
201
|
+
* It can wait on another tab holding the lock: callers bound the wait.
|
|
202
|
+
*/
|
|
203
|
+
async idle() {
|
|
204
|
+
while (this.current)
|
|
205
|
+
await this.current;
|
|
206
|
+
}
|
|
207
|
+
withLock(fn) {
|
|
208
|
+
const locks = typeof navigator === "undefined" ? undefined : navigator.locks;
|
|
209
|
+
if (locks)
|
|
210
|
+
return locks.request(this.d.lockName, () => (this.stopped ? undefined : fn()));
|
|
211
|
+
// Without Web Locks flushes are serialised in this tab only; two tabs
|
|
212
|
+
// may then send the same op, which the server applies once (opId).
|
|
213
|
+
const run = this.localTail.then(fn, fn);
|
|
214
|
+
this.localTail = run.catch(() => undefined);
|
|
215
|
+
return run;
|
|
216
|
+
}
|
|
217
|
+
retryLater(e) {
|
|
218
|
+
if (this.stopped)
|
|
219
|
+
return;
|
|
220
|
+
const backoff = Math.min(BACKOFF_MAX_MS, BACKOFF_START_MS * 2 ** this.attempt);
|
|
221
|
+
this.attempt++;
|
|
222
|
+
const ra = e.code === "rate_limited" && typeof e.extra.retryAfter === "number" ? e.extra.retryAfter * 1000 : 0;
|
|
223
|
+
this.timer = setTimeout(() => {
|
|
224
|
+
this.timer = undefined;
|
|
225
|
+
this.kick();
|
|
226
|
+
}, Math.max(backoff, ra));
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* chunk takes the first ops of the queue that fit in one batch, cut before
|
|
230
|
+
* the second op on any record. The server runs every op of a batch even
|
|
231
|
+
* after one fails, so two ops on one record in one batch could be applied
|
|
232
|
+
* out of order when the first fails transiently and is retried.
|
|
233
|
+
*/
|
|
234
|
+
chunk(queued) {
|
|
235
|
+
if (this.solo)
|
|
236
|
+
return queued.slice(0, 1);
|
|
237
|
+
const out = [];
|
|
238
|
+
const records = new Set();
|
|
239
|
+
let bytes = 0;
|
|
240
|
+
for (const s of queued) {
|
|
241
|
+
const n = byteLength(wireOp(s.op)) + 1;
|
|
242
|
+
if (out.length >= BATCH_OPS || (out.length > 0 && bytes + n > BATCH_BYTES) || records.has(opKey(s.op)))
|
|
243
|
+
break;
|
|
244
|
+
out.push(s);
|
|
245
|
+
records.add(opKey(s.op));
|
|
246
|
+
bytes += n;
|
|
247
|
+
}
|
|
248
|
+
return out;
|
|
249
|
+
}
|
|
250
|
+
async flushLocked() {
|
|
251
|
+
this.again = false;
|
|
252
|
+
for (;;) {
|
|
253
|
+
if (this.stopped || !this.d.net.deviceOnline)
|
|
254
|
+
return;
|
|
255
|
+
// Read inside the lock: another tab may have flushed meanwhile.
|
|
256
|
+
const queued = await this.d.cache.queued();
|
|
257
|
+
this.pending = queued.length;
|
|
258
|
+
this.d.counted?.();
|
|
259
|
+
if (queued.length === 0) {
|
|
260
|
+
this.attempt = 0;
|
|
261
|
+
this.d.net.setProblem("queue", undefined);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const chunk = this.chunk(queued);
|
|
265
|
+
let body;
|
|
266
|
+
try {
|
|
267
|
+
body = (await this.d.net.request("POST", "/v1/batch", { ops: chunk.map((s) => wireOp(s.op)) })) ?? {};
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
if (this.stopped)
|
|
271
|
+
return;
|
|
272
|
+
const err = asPbError(e);
|
|
273
|
+
if (!causedByAnOp(err)) {
|
|
274
|
+
// Not about any op (an outage, or e.g. forbidden for this
|
|
275
|
+
// origin): keep the whole queue, retry, and tell the app.
|
|
276
|
+
if (worthShowing(err))
|
|
277
|
+
this.d.net.setProblem("queue", err);
|
|
278
|
+
else
|
|
279
|
+
this.noteProblem(err);
|
|
280
|
+
this.retryLater(err);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
// An op made the whole request fail: find it by sending ops alone.
|
|
284
|
+
if (chunk.length > 1) {
|
|
285
|
+
this.solo = true;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
await this.conflict(chunk[0], err);
|
|
289
|
+
this.solo = false;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (this.stopped)
|
|
293
|
+
return;
|
|
294
|
+
this.solo = false;
|
|
295
|
+
const results = Array.isArray(body.results) ? body.results : null;
|
|
296
|
+
if (!results || results.length !== chunk.length) {
|
|
297
|
+
const err = new PbError("invalid_response", `The batch response does not match the request.`, "Check that baseUrl points at the server; the queue keeps retrying.");
|
|
298
|
+
this.d.net.setProblem("queue", err);
|
|
299
|
+
this.retryLater(err);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
let stop;
|
|
303
|
+
for (const [i, s] of chunk.entries()) {
|
|
304
|
+
const r = results[i];
|
|
305
|
+
if (r.opId !== s.op.opId) {
|
|
306
|
+
stop = new PbError("invalid_response", "The batch results are out of order.", "Retry later.");
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
if (r.error && typeof r.error === "object") {
|
|
310
|
+
const err = resultError(r.error);
|
|
311
|
+
if (isTransient(err)) {
|
|
312
|
+
stop = err;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
await this.conflict(s, err);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
await this.success(s, r.record);
|
|
319
|
+
}
|
|
320
|
+
if (stop) {
|
|
321
|
+
this.noteProblem(stop);
|
|
322
|
+
await this.count();
|
|
323
|
+
this.retryLater(stop);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this.attempt = 0;
|
|
327
|
+
this.d.net.setProblem("queue", undefined);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
noteProblem(e) {
|
|
331
|
+
if (USER_FIXABLE.has(e.code))
|
|
332
|
+
this.d.net.setProblem("queue", e);
|
|
333
|
+
}
|
|
334
|
+
/** success stores the server's result of s and removes s from the queue. */
|
|
335
|
+
async success(s, record) {
|
|
336
|
+
const { collection, rkey } = s.op;
|
|
337
|
+
if (this.stopped)
|
|
338
|
+
return;
|
|
339
|
+
await this.d.cache.write(async (w) => {
|
|
340
|
+
await w.dequeue(s.seq);
|
|
341
|
+
const e = (await w.entry(collection, rkey)) ?? w.newEntry(collection, rkey);
|
|
342
|
+
if (s.op.kind === "delete") {
|
|
343
|
+
e.deleted = true;
|
|
344
|
+
e.server = null;
|
|
345
|
+
}
|
|
346
|
+
else if (record && !e.deleted && record.rev > e.rev) {
|
|
347
|
+
// A replayed op may return an older state than the cache already
|
|
348
|
+
// has (from a later change); the newer one is kept.
|
|
349
|
+
e.server = record;
|
|
350
|
+
e.rev = record.rev;
|
|
351
|
+
}
|
|
352
|
+
await w.save(e);
|
|
353
|
+
});
|
|
354
|
+
this.pending = Math.max(0, this.pending - 1);
|
|
355
|
+
this.d.counted?.();
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* conflict drops s (and, when s is a create, every later op on the same
|
|
359
|
+
* record, which cannot succeed without it), reverts the record to its
|
|
360
|
+
* server state and reports each dropped op with the data the app had.
|
|
361
|
+
*/
|
|
362
|
+
async conflict(s, error) {
|
|
363
|
+
const { collection, rkey } = s.op;
|
|
364
|
+
const events = [];
|
|
365
|
+
if (this.stopped)
|
|
366
|
+
return;
|
|
367
|
+
await this.d.cache.write(async (w) => {
|
|
368
|
+
const e = (await w.entry(collection, rkey)) ?? w.newEntry(collection, rkey);
|
|
369
|
+
const ops = await w.opsFor(collection, rkey);
|
|
370
|
+
const at = ops.findIndex((o) => o.seq === s.seq);
|
|
371
|
+
// Already handled (another tab, without Web Locks): report it once.
|
|
372
|
+
if (at < 0)
|
|
373
|
+
return;
|
|
374
|
+
const dropped = s.op.kind === "create" ? ops.filter((o) => o.seq >= s.seq) : [s];
|
|
375
|
+
for (const d of dropped) {
|
|
376
|
+
const i = ops.findIndex((o) => o.seq === d.seq);
|
|
377
|
+
const upTo = d.op.kind === "delete" ? i : i + 1;
|
|
378
|
+
const local = fold(e.server, e.deleted, ops.slice(0, Math.max(upTo, 0)));
|
|
379
|
+
events.push({ op: d.op, error, localData: local ? local.data : (e.server?.data ?? null) });
|
|
380
|
+
await w.dequeue(d.seq);
|
|
381
|
+
}
|
|
382
|
+
if (error.code === "record_deleted") {
|
|
383
|
+
e.deleted = true;
|
|
384
|
+
e.server = null;
|
|
385
|
+
}
|
|
386
|
+
else if (error.code === "not_found") {
|
|
387
|
+
e.server = null;
|
|
388
|
+
}
|
|
389
|
+
await w.save(e);
|
|
390
|
+
});
|
|
391
|
+
this.pending = Math.max(0, this.pending - events.length);
|
|
392
|
+
this.d.counted?.();
|
|
393
|
+
for (const ev of events)
|
|
394
|
+
this.d.conflict(ev);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sEAAsE;AACtE,qEAAqE;AACrE,2EAA2E;AAC3E,OAAO,EAAE,KAAK,EAAE,IAAI,EAA8C,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,sEAAsE;AACtE,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,yEAAyE;AACzE,MAAM,WAAW,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACtC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,S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,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAI,CAAC,CAAC;YAC1B,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBACpC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;gBACjB,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;YAClB,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBACtC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB,KAAK,MAAM,EAAE,IAAI,MAAM;YAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phibac/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Web SDK for phibac: one private database per user, shared by the apps they approve. Sign-in, offline-first records, live queries and files.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://phibac.com/docs",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"phibac",
|
|
9
|
+
"backend",
|
|
10
|
+
"sdk",
|
|
11
|
+
"offline-first",
|
|
12
|
+
"local-first",
|
|
13
|
+
"passkeys",
|
|
14
|
+
"personal-data"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"prepublishOnly": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npm run build && npm test"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"idb": "^8.0.4"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"fake-indexeddb": "^6.2.8",
|
|
40
|
+
"happy-dom": "^21.0.4",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vitest": "^5.1.0"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|