@lunora/client 1.0.0-alpha.22 → 1.0.0-alpha.24
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/index.d.mts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/index.d.mts +66 -4
- package/dist/index.d.ts +66 -4
- package/dist/index.mjs +8 -7
- package/dist/packem_shared/{LunoraClient-Clb118SU.mjs → LunoraClient-D3h4P7hg.mjs} +143 -247
- package/dist/packem_shared/{OfflineQueue-B4HUF7rt.mjs → OfflineQueue-BgarnAub.mjs} +1 -1
- package/dist/packem_shared/{SubscriptionRegistry-D4jfIzZu.mjs → SubscriptionRegistry-CxS_Inha.mjs} +2 -2
- package/dist/packem_shared/{TabCoordinator-BwRR8H06.mjs → TabCoordinator-D_5oNTTt.mjs} +48 -12
- package/dist/packem_shared/{createClientQuery-CQ51bWAE.mjs → createClientQuery-dJZg1ohm.mjs} +15 -6
- package/dist/packem_shared/createLocalStore-BtqUmOQA.mjs +2 -0
- package/dist/packem_shared/{createServerClient-Dxemst5C.mjs → createServerClient-DzeC2J3A.mjs} +1 -1
- package/dist/packem_shared/{createSnapshotPrecondition-CBwnVz6r.mjs → createSnapshotPrecondition-CxQ1T4ZP.mjs} +3 -3
- package/dist/packem_shared/httpStream-DIdL8NEw.mjs +168 -0
- package/dist/packem_shared/{local-store-DtcIW4c0.mjs → local-store-DIq-UWfD.mjs} +1 -1
- package/dist/packem_shared/{lunora-client.d-pw-9sLl0.d.mts → lunora-client.d-B8bdwHLr.d.mts} +132 -18
- package/dist/packem_shared/{lunora-client.d-pw-9sLl0.d.ts → lunora-client.d-B8bdwHLr.d.ts} +132 -18
- package/dist/packem_shared/{offline-queue-CF4_Co5k.mjs → offline-queue-N-1JvYb4.mjs} +14 -2
- package/dist/packem_shared/{preload.d-BkQr-3Vh.d.ts → preload.d-BPy9qajK.d.ts} +1 -1
- package/dist/packem_shared/{preload.d-6ME5ubgq.d.mts → preload.d-Ccrgw2z0.d.mts} +1 -1
- package/dist/packem_shared/wire-key-Djie6aaR.mjs +266 -0
- package/dist/query/index.d.mts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/ssr/index.d.mts +3 -3
- package/dist/ssr/index.d.ts +3 -3
- package/dist/ssr/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/packem_shared/createLocalStore-BDbbkoXw.mjs +0 -2
- package/dist/packem_shared/stable-key-wv6eP48B.mjs +0 -40
|
@@ -79,6 +79,16 @@ class OfflineQueue {
|
|
|
79
79
|
* gone after a reload). No-op when no persistence adapter is configured.
|
|
80
80
|
* Returns the distinct shard keys of the restored writes so the caller can
|
|
81
81
|
* open their sockets to trigger a flush.
|
|
82
|
+
*
|
|
83
|
+
* `hydrate()` runs post-construction (the caller awaits an async durable-store
|
|
84
|
+
* load), so a mutation issued while offline during that boot window is
|
|
85
|
+
* enqueued into `items` *before* this method's `await` resolves. Restored
|
|
86
|
+
* records are therefore `unshift`-ed ahead of whatever is already queued
|
|
87
|
+
* rather than `push`-ed to the end: the durable store's persist order is
|
|
88
|
+
* authoritative (a prior-session write is always older than anything from
|
|
89
|
+
* this session), so replaying a same-session boot-time write before an
|
|
90
|
+
* older restored write on the same document would let last-writer-wins
|
|
91
|
+
* silently clobber the newer data with the stale one.
|
|
82
92
|
*/
|
|
83
93
|
async hydrate() {
|
|
84
94
|
if (!this.persistence) {
|
|
@@ -92,8 +102,9 @@ class OfflineQueue {
|
|
|
92
102
|
throw error;
|
|
93
103
|
}
|
|
94
104
|
const shardKeys = /* @__PURE__ */ new Set();
|
|
105
|
+
const restored = [];
|
|
95
106
|
for (const mutation of persisted) {
|
|
96
|
-
if (this.items.some((item) => item.id === mutation.id)) {
|
|
107
|
+
if (this.items.some((item) => item.id === mutation.id) || restored.some((item) => item.id === mutation.id)) {
|
|
97
108
|
continue;
|
|
98
109
|
}
|
|
99
110
|
if (isStaleVersion(this.version, mutation.version)) {
|
|
@@ -102,7 +113,7 @@ class OfflineQueue {
|
|
|
102
113
|
});
|
|
103
114
|
continue;
|
|
104
115
|
}
|
|
105
|
-
|
|
116
|
+
restored.push({
|
|
106
117
|
args: mutation.args,
|
|
107
118
|
functionPath: mutation.functionPath,
|
|
108
119
|
id: mutation.id,
|
|
@@ -113,6 +124,7 @@ class OfflineQueue {
|
|
|
113
124
|
});
|
|
114
125
|
shardKeys.add(mutation.shardKey);
|
|
115
126
|
}
|
|
127
|
+
this.items.unshift(...restored);
|
|
116
128
|
this.notifySize();
|
|
117
129
|
return [...shardKeys];
|
|
118
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-
|
|
1
|
+
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-B8bdwHLr.js";
|
|
2
2
|
/**
|
|
3
3
|
* Run a query once on the server (during SSR) and capture its result in a
|
|
4
4
|
* serializable {@link Preloaded} token. Embed the token in the rendered HTML and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-
|
|
1
|
+
import { F as FunctionReference, L as LunoraClient, A as ArgsOf, R as ReturnOf, P as Preloaded } from "./lunora-client.d-B8bdwHLr.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Run a query once on the server (during SSR) and capture its result in a
|
|
4
4
|
* serializable {@link Preloaded} token. Embed the token in the rendered HTML and
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
const compareKeys = (a, b) => {
|
|
2
|
+
if (a < b) {
|
|
3
|
+
return -1;
|
|
4
|
+
}
|
|
5
|
+
return a > b ? 1 : 0;
|
|
6
|
+
};
|
|
7
|
+
const stableStringify = (value) => {
|
|
8
|
+
if (value === void 0) {
|
|
9
|
+
return "null";
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === "bigint") {
|
|
12
|
+
throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");
|
|
13
|
+
}
|
|
14
|
+
if (value === null || typeof value !== "object") {
|
|
15
|
+
return JSON.stringify(value);
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(value)) {
|
|
18
|
+
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
19
|
+
}
|
|
20
|
+
const proto = Object.getPrototypeOf(value);
|
|
21
|
+
if (proto !== null && proto !== Object.prototype) {
|
|
22
|
+
const name = value.constructor?.name ?? "value";
|
|
23
|
+
throw new TypeError(
|
|
24
|
+
`stableStringify: cannot use a ${name} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const record = value;
|
|
28
|
+
const keys = Object.keys(record).toSorted(compareKeys);
|
|
29
|
+
const parts = [];
|
|
30
|
+
for (const key of keys) {
|
|
31
|
+
const raw = record[key];
|
|
32
|
+
if (raw === void 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
parts.push(`${JSON.stringify(key)}:${stableStringify(raw)}`);
|
|
36
|
+
}
|
|
37
|
+
return `{${parts.join(",")}}`;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const toBase64 = (bytes) => {
|
|
41
|
+
let binary = "";
|
|
42
|
+
const chunk = 32768;
|
|
43
|
+
for (let index = 0; index < bytes.length; index += chunk) {
|
|
44
|
+
binary += String.fromCharCode(...bytes.subarray(index, index + chunk));
|
|
45
|
+
}
|
|
46
|
+
return btoa(binary);
|
|
47
|
+
};
|
|
48
|
+
const fromBase64 = (base64) => {
|
|
49
|
+
const binary = atob(base64);
|
|
50
|
+
const bytes = new Uint8Array(binary.length);
|
|
51
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
52
|
+
bytes[index] = binary.codePointAt(index) ?? 0;
|
|
53
|
+
}
|
|
54
|
+
return bytes;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const TAG = "$lunora.wire$";
|
|
58
|
+
const MAX_DEPTH = 64;
|
|
59
|
+
const MAX_BIGINT_DIGITS = 1024;
|
|
60
|
+
const UNSAFE_KEY = "__proto__";
|
|
61
|
+
const TYPED_ARRAY_CTORS = {
|
|
62
|
+
BigInt64Array,
|
|
63
|
+
BigUint64Array,
|
|
64
|
+
Float32Array,
|
|
65
|
+
Float64Array,
|
|
66
|
+
Int8Array,
|
|
67
|
+
Int16Array,
|
|
68
|
+
Int32Array,
|
|
69
|
+
Uint8Array,
|
|
70
|
+
Uint8ClampedArray,
|
|
71
|
+
Uint16Array,
|
|
72
|
+
Uint32Array
|
|
73
|
+
};
|
|
74
|
+
const ERROR_CTORS = {
|
|
75
|
+
Error,
|
|
76
|
+
EvalError,
|
|
77
|
+
RangeError,
|
|
78
|
+
ReferenceError,
|
|
79
|
+
SyntaxError,
|
|
80
|
+
TypeError,
|
|
81
|
+
URIError
|
|
82
|
+
};
|
|
83
|
+
const encodeWire = (value, depth = 0) => {
|
|
84
|
+
if (depth > MAX_DEPTH) {
|
|
85
|
+
throw new RangeError(`wire-codec: value nesting exceeds the ${MAX_DEPTH}-level limit`);
|
|
86
|
+
}
|
|
87
|
+
if (value === void 0) {
|
|
88
|
+
return [TAG, "undefined"];
|
|
89
|
+
}
|
|
90
|
+
if (value === null) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const kind = typeof value;
|
|
94
|
+
if (kind === "bigint") {
|
|
95
|
+
return [TAG, "bigint", value.toString()];
|
|
96
|
+
}
|
|
97
|
+
if (kind === "number") {
|
|
98
|
+
const numeric = value;
|
|
99
|
+
if (Number.isNaN(numeric)) {
|
|
100
|
+
return [TAG, "nan"];
|
|
101
|
+
}
|
|
102
|
+
if (numeric === Infinity) {
|
|
103
|
+
return [TAG, "inf"];
|
|
104
|
+
}
|
|
105
|
+
if (numeric === -Infinity) {
|
|
106
|
+
return [TAG, "-inf"];
|
|
107
|
+
}
|
|
108
|
+
return numeric;
|
|
109
|
+
}
|
|
110
|
+
if (kind !== "object") {
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
if (value instanceof Date) {
|
|
114
|
+
return [TAG, "date", encodeWire(value.getTime(), depth + 1)];
|
|
115
|
+
}
|
|
116
|
+
if (value instanceof Error) {
|
|
117
|
+
const error = value;
|
|
118
|
+
const properties = {};
|
|
119
|
+
for (const key of Object.keys(error)) {
|
|
120
|
+
if (error[key] !== void 0) {
|
|
121
|
+
properties[key] = encodeWire(error[key], depth + 1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const encodedError = [TAG, "error", error.name, error.message, properties];
|
|
125
|
+
if (error.cause !== void 0) {
|
|
126
|
+
encodedError.push(encodeWire(error.cause, depth + 1));
|
|
127
|
+
}
|
|
128
|
+
return encodedError;
|
|
129
|
+
}
|
|
130
|
+
if (value instanceof URL) {
|
|
131
|
+
return [TAG, "url", value.href];
|
|
132
|
+
}
|
|
133
|
+
if (value instanceof Map) {
|
|
134
|
+
return [TAG, "map", [...value.entries()].map(([k, v]) => [encodeWire(k, depth + 1), encodeWire(v, depth + 1)])];
|
|
135
|
+
}
|
|
136
|
+
if (value instanceof Set) {
|
|
137
|
+
return [TAG, "set", [...value].map((item) => encodeWire(item, depth + 1))];
|
|
138
|
+
}
|
|
139
|
+
if (value instanceof ArrayBuffer) {
|
|
140
|
+
return [TAG, "bytes", toBase64(new Uint8Array(value)), "ArrayBuffer"];
|
|
141
|
+
}
|
|
142
|
+
if (ArrayBuffer.isView(value)) {
|
|
143
|
+
const view = value;
|
|
144
|
+
const ctorName = view.constructor.name;
|
|
145
|
+
const bytes = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
146
|
+
return ctorName === "Uint8Array" ? [TAG, "bytes", toBase64(bytes)] : [TAG, "bytes", toBase64(bytes), ctorName];
|
|
147
|
+
}
|
|
148
|
+
if (Array.isArray(value)) {
|
|
149
|
+
const encoded = value.map((item) => encodeWire(item, depth + 1));
|
|
150
|
+
return encoded.length > 0 && encoded[0] === TAG ? [TAG, "arr", encoded] : encoded;
|
|
151
|
+
}
|
|
152
|
+
const proto = Object.getPrototypeOf(value);
|
|
153
|
+
if (proto !== null && proto !== Object.prototype) {
|
|
154
|
+
const name = value.constructor?.name ?? "value";
|
|
155
|
+
throw new TypeError(
|
|
156
|
+
`wire-codec: cannot encode a ${name} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
const source = value;
|
|
160
|
+
const result = {};
|
|
161
|
+
for (const key of Object.keys(source)) {
|
|
162
|
+
const field = source[key];
|
|
163
|
+
if (field !== void 0) {
|
|
164
|
+
result[key] = encodeWire(field, depth + 1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
};
|
|
169
|
+
const decodeWire = (value, depth = 0) => {
|
|
170
|
+
if (depth > MAX_DEPTH) {
|
|
171
|
+
throw new RangeError(`wire-codec: value nesting exceeds the ${MAX_DEPTH}-level limit`);
|
|
172
|
+
}
|
|
173
|
+
if (value === null || typeof value !== "object") {
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(value)) {
|
|
177
|
+
if (value[0] === TAG) {
|
|
178
|
+
const tag = value[1];
|
|
179
|
+
switch (tag) {
|
|
180
|
+
case "-inf": {
|
|
181
|
+
return -Infinity;
|
|
182
|
+
}
|
|
183
|
+
case "arr": {
|
|
184
|
+
return value[2].map((item) => decodeWire(item, depth + 1));
|
|
185
|
+
}
|
|
186
|
+
case "bigint": {
|
|
187
|
+
const raw = value[2];
|
|
188
|
+
if (typeof raw !== "string" || raw.length > MAX_BIGINT_DIGITS || !/^-?\d+$/.test(raw)) {
|
|
189
|
+
throw new RangeError(`wire-codec: invalid or over-long bigint (max ${MAX_BIGINT_DIGITS} digits)`);
|
|
190
|
+
}
|
|
191
|
+
return BigInt(raw);
|
|
192
|
+
}
|
|
193
|
+
case "date": {
|
|
194
|
+
return new Date(decodeWire(value[2], depth + 1));
|
|
195
|
+
}
|
|
196
|
+
case "map": {
|
|
197
|
+
return new Map(value[2].map(([k, v]) => [decodeWire(k, depth + 1), decodeWire(v, depth + 1)]));
|
|
198
|
+
}
|
|
199
|
+
case "set": {
|
|
200
|
+
return new Set(value[2].map((item) => decodeWire(item, depth + 1)));
|
|
201
|
+
}
|
|
202
|
+
case "url": {
|
|
203
|
+
return new URL(value[2]);
|
|
204
|
+
}
|
|
205
|
+
case "error": {
|
|
206
|
+
const name = value[2];
|
|
207
|
+
const message = value[3];
|
|
208
|
+
const Ctor = (Object.hasOwn(ERROR_CTORS, name) ? ERROR_CTORS[name] : void 0) ?? Error;
|
|
209
|
+
const error = new Ctor(message);
|
|
210
|
+
if (error.name !== name) {
|
|
211
|
+
Object.defineProperty(error, "name", { configurable: true, value: name, writable: true });
|
|
212
|
+
}
|
|
213
|
+
const props = decodeWire(value[4], depth + 1);
|
|
214
|
+
for (const key of Object.keys(props)) {
|
|
215
|
+
if (key === UNSAFE_KEY) {
|
|
216
|
+
Object.defineProperty(error, key, { configurable: true, enumerable: true, value: props[key], writable: true });
|
|
217
|
+
} else {
|
|
218
|
+
error[key] = props[key];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (value.length > 5) {
|
|
222
|
+
Object.defineProperty(error, "cause", { configurable: true, value: decodeWire(value[5], depth + 1), writable: true });
|
|
223
|
+
}
|
|
224
|
+
return error;
|
|
225
|
+
}
|
|
226
|
+
case "bytes": {
|
|
227
|
+
const bytes = fromBase64(value[2]);
|
|
228
|
+
const ctorName = value[3] ?? "Uint8Array";
|
|
229
|
+
if (ctorName === "ArrayBuffer") {
|
|
230
|
+
return bytes.buffer.byteLength === bytes.byteLength ? bytes.buffer : bytes.slice().buffer;
|
|
231
|
+
}
|
|
232
|
+
const Ctor = Object.hasOwn(TYPED_ARRAY_CTORS, ctorName) ? TYPED_ARRAY_CTORS[ctorName] : void 0;
|
|
233
|
+
return Ctor ? new Ctor(bytes.slice().buffer) : bytes;
|
|
234
|
+
}
|
|
235
|
+
case "inf": {
|
|
236
|
+
return Infinity;
|
|
237
|
+
}
|
|
238
|
+
case "nan": {
|
|
239
|
+
return Number.NaN;
|
|
240
|
+
}
|
|
241
|
+
case "undefined": {
|
|
242
|
+
return void 0;
|
|
243
|
+
}
|
|
244
|
+
default: {
|
|
245
|
+
return value.map((item) => decodeWire(item, depth + 1));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return value.map((item) => decodeWire(item, depth + 1));
|
|
250
|
+
}
|
|
251
|
+
const source = value;
|
|
252
|
+
const result = {};
|
|
253
|
+
for (const key of Object.keys(source)) {
|
|
254
|
+
const decoded = decodeWire(source[key], depth + 1);
|
|
255
|
+
if (key === UNSAFE_KEY) {
|
|
256
|
+
Object.defineProperty(result, key, { configurable: true, enumerable: true, value: decoded, writable: true });
|
|
257
|
+
} else {
|
|
258
|
+
result[key] = decoded;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return result;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const stableWireKey = (value) => stableStringify(encodeWire(value));
|
|
265
|
+
|
|
266
|
+
export { decodeWire as d, encodeWire as e, stableWireKey as s };
|
package/dist/query/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-B8bdwHLr.mjs";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-B8bdwHLr.mjs";
|
|
3
3
|
import '@lunora/runtime';
|
|
4
4
|
/**
|
|
5
5
|
* The sentinel a framework adapter resolves its reactive args to when it wants
|
package/dist/query/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-
|
|
1
|
+
import { S as SubscriptionError, F as FunctionReference, A as ArgsOf, R as ReturnOf, L as LunoraClient, a as Unsubscribe } from "../packem_shared/lunora-client.d-B8bdwHLr.js";
|
|
2
|
+
export type { b as SubscriptionErrorCallback } from "../packem_shared/lunora-client.d-B8bdwHLr.js";
|
|
3
3
|
import '@lunora/runtime';
|
|
4
4
|
/**
|
|
5
5
|
* The sentinel a framework adapter resolves its reactive args to when it wants
|
package/dist/ssr/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-B8bdwHLr.mjs";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-B8bdwHLr.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-Ccrgw2z0.mjs";
|
|
4
4
|
import '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* Structural shape of a better-auth `getSession` call's resolved value.
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded, L as LunoraClient } from "../packem_shared/lunora-client.d-B8bdwHLr.js";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/lunora-client.d-B8bdwHLr.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-BPy9qajK.js";
|
|
4
4
|
import '@lunora/runtime';
|
|
5
5
|
/**
|
|
6
6
|
* Structural shape of a better-auth `getSession` call's resolved value.
|
package/dist/ssr/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { getServerSession } from '../packem_shared/getServerSession-8jXewqxd.mjs';
|
|
2
2
|
export { deserializePreloaded, serializePreloaded } from '../packem_shared/deserializePreloaded-C0eJTY_W.mjs';
|
|
3
|
-
export { createServerClient } from '../packem_shared/createServerClient-
|
|
3
|
+
export { createServerClient } from '../packem_shared/createServerClient-DzeC2J3A.mjs';
|
|
4
4
|
export { preloadQuery, preloadedQueryResult } from '../packem_shared/preloadQuery-lobFkD2Z.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/client",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.24",
|
|
4
4
|
"description": "Lunora browser SDK: WebSocket transport, optimistic updates, and an offline mutation queue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
65
|
+
"@lunora/errors": "1.0.0-alpha.5"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": "^22.15.0 || >=24.11.0"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const compareKeys = (a, b) => {
|
|
2
|
-
if (a < b) {
|
|
3
|
-
return -1;
|
|
4
|
-
}
|
|
5
|
-
return a > b ? 1 : 0;
|
|
6
|
-
};
|
|
7
|
-
const stableStringify = (value) => {
|
|
8
|
-
if (value === void 0) {
|
|
9
|
-
return "null";
|
|
10
|
-
}
|
|
11
|
-
if (typeof value === "bigint") {
|
|
12
|
-
throw new TypeError("stableStringify: cannot use a bigint in a cache key (query/subscription/shape args) — pass it as a string");
|
|
13
|
-
}
|
|
14
|
-
if (value === null || typeof value !== "object") {
|
|
15
|
-
return JSON.stringify(value);
|
|
16
|
-
}
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
19
|
-
}
|
|
20
|
-
const proto = Object.getPrototypeOf(value);
|
|
21
|
-
if (proto !== null && proto !== Object.prototype) {
|
|
22
|
-
const name = value.constructor?.name ?? "value";
|
|
23
|
-
throw new TypeError(
|
|
24
|
-
`stableStringify: cannot use a ${name} in a cache key (query/subscription/shape args) — only plain objects, arrays, and JSON primitives are supported`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
const record = value;
|
|
28
|
-
const keys = Object.keys(record).toSorted(compareKeys);
|
|
29
|
-
const parts = [];
|
|
30
|
-
for (const key of keys) {
|
|
31
|
-
const raw = record[key];
|
|
32
|
-
if (raw === void 0) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
parts.push(`${JSON.stringify(key)}:${stableStringify(raw)}`);
|
|
36
|
-
}
|
|
37
|
-
return `{${parts.join(",")}}`;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { stableStringify as s };
|