@lunora/client 1.0.0-alpha.4 → 1.0.0-alpha.40
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.md +6 -0
- package/README.md +2 -0
- package/dist/auth/index.d.mts +11 -10
- package/dist/auth/index.d.ts +11 -10
- package/dist/auth/index.mjs +1 -60
- package/dist/index.d.mts +736 -172
- package/dist/index.d.ts +736 -172
- package/dist/index.mjs +1 -14
- package/dist/packem_shared/CONFLICT_ERROR_CODE-B2SU0CaJ.mjs +1 -0
- package/dist/packem_shared/ClientServiceWorker-CRQ5yl7-.mjs +1 -0
- package/dist/packem_shared/DEFAULT_MAX_BUFFER-TBn2s7Rz.mjs +1 -0
- package/dist/packem_shared/LunoraClient-Cz-RavLT.mjs +1 -0
- package/dist/packem_shared/OfflineQueue-y4mymc5n.mjs +1 -0
- package/dist/packem_shared/RETIRE_AFTER_DURABLE_SEQ_ADVANCE-D96iRJDY.mjs +1 -0
- package/dist/packem_shared/SKIP-CArzT3Vl.mjs +1 -0
- package/dist/packem_shared/SubscriptionRegistry-C72rCp44.mjs +1 -0
- package/dist/packem_shared/TabCoordinator-CMFYQCL-.mjs +1 -0
- package/dist/packem_shared/anyApi-BD4dgvDY.mjs +1 -0
- package/dist/packem_shared/applyDelta-DXqQORbM.mjs +1 -0
- package/dist/packem_shared/createAsyncStoragePersistence-BRLqeXsC.mjs +1 -0
- package/dist/packem_shared/createClientQuery-CrdRoicO.mjs +1 -0
- package/dist/packem_shared/createInMemoryBookmarkStorage-DCd5Ej-t.mjs +1 -0
- package/dist/packem_shared/createInMemoryPersistence-CQYXy8UP.mjs +1 -0
- package/dist/packem_shared/createInMemoryQueryCache-DjCKrLjk.mjs +1 -0
- package/dist/packem_shared/createLocalStore-CwuKPK9x.mjs +1 -0
- package/dist/packem_shared/createMutationRunner-lQXH8Amk.mjs +1 -0
- package/dist/packem_shared/createMutatorRunner-BVzo0FBZ.mjs +1 -0
- package/dist/packem_shared/createReconnect-CFT7YRSR.mjs +1 -0
- package/dist/packem_shared/createReply-DF0jRsv-.mjs +1 -0
- package/dist/packem_shared/createServerClient-CQf6XOk3.mjs +1 -0
- package/dist/packem_shared/createSnapshotPrecondition-CKvCNKyD.mjs +1 -0
- package/dist/packem_shared/deserializePreloaded-CHfOFpka.mjs +1 -0
- package/dist/packem_shared/getServerSession-CGjgRBAE.mjs +1 -0
- package/dist/packem_shared/httpStream-Cz4_QyjV.mjs +11 -0
- package/dist/packem_shared/idb-utility-C-DR8nG1.mjs +1 -0
- package/dist/packem_shared/local-store-DFMSEM2j.mjs +1 -0
- package/dist/packem_shared/lunora-client.d-B23myJYW.d.ts +2168 -0
- package/dist/packem_shared/lunora-client.d-BRXKXo0T.d.mts +2168 -0
- package/dist/packem_shared/offline-queue-BeWay5u5.mjs +1 -0
- package/dist/packem_shared/preload.d-BgoF8JQZ.d.mts +21 -0
- package/dist/packem_shared/preload.d-cq7evweX.d.ts +21 -0
- package/dist/packem_shared/preloadQuery-DjwSjFwt.mjs +1 -0
- package/dist/packem_shared/types.d-CA7ZeJm9.d.mts +942 -0
- package/dist/packem_shared/types.d-CA7ZeJm9.d.ts +942 -0
- package/dist/packem_shared/wire-codec-D_fiax9d.mjs +1 -0
- package/dist/packem_shared/wire-key-j8BZ65HQ.mjs +1 -0
- package/dist/pagination/index.d.mts +42 -42
- package/dist/pagination/index.d.ts +42 -42
- package/dist/pagination/index.mjs +1 -61
- package/dist/query/index.d.mts +43 -42
- package/dist/query/index.d.ts +43 -42
- package/dist/query/index.mjs +1 -1
- package/dist/service.d.mts +49 -0
- package/dist/service.d.ts +49 -0
- package/dist/service.mjs +1 -0
- package/dist/ssr/index.d.mts +80 -79
- package/dist/ssr/index.d.ts +80 -79
- package/dist/ssr/index.mjs +1 -4
- package/dist/upload.d.mts +35 -0
- package/dist/upload.d.ts +35 -0
- package/dist/upload.mjs +1 -0
- package/package.json +13 -1
- package/dist/packem_shared/CONFLICT_ERROR_CODE-aUdVbEDw.mjs +0 -4
- package/dist/packem_shared/DEFAULT_MAX_BUFFER-BDkqO5PW.mjs +0 -107
- package/dist/packem_shared/LunoraClient-DHMV-94j.mjs +0 -2198
- package/dist/packem_shared/OfflineQueue-D5p_QgF_.mjs +0 -127
- package/dist/packem_shared/SKIP-vItZChkw.mjs +0 -50
- package/dist/packem_shared/SubscriptionRegistry-Dn-7k7eo.mjs +0 -1
- package/dist/packem_shared/applyDelta-4jFGTPA3.mjs +0 -61
- package/dist/packem_shared/createAsyncStoragePersistence-1Z5BZ8RC.mjs +0 -45
- package/dist/packem_shared/createInMemoryBookmarkStorage-BoN7a7TH.mjs +0 -11
- package/dist/packem_shared/createInMemoryPersistence-CW82inU5.mjs +0 -105
- package/dist/packem_shared/createInMemoryQueryCache-B1PQ9Twl.mjs +0 -138
- package/dist/packem_shared/createLocalStore-DSUfoLqY.mjs +0 -36
- package/dist/packem_shared/createMutationRunner-BqsavzvG.mjs +0 -21
- package/dist/packem_shared/createReconnect-Di_-oHH7.mjs +0 -22
- package/dist/packem_shared/createServerClient-DMh-2UDv.mjs +0 -11
- package/dist/packem_shared/deserializePreloaded-C0eJTY_W.mjs +0 -4
- package/dist/packem_shared/getServerSession-8jXewqxd.mjs +0 -13
- package/dist/packem_shared/lunora-client.d-CbnxmuqG.d.mts +0 -1623
- package/dist/packem_shared/lunora-client.d-CbnxmuqG.d.ts +0 -1623
- package/dist/packem_shared/preload.d-Bhq6DBSe.d.mts +0 -20
- package/dist/packem_shared/preload.d-C73DT6bL.d.ts +0 -20
- package/dist/packem_shared/preloadQuery-lobFkD2Z.mjs +0 -13
- package/dist/packem_shared/subscription-C1Jy7HiF.mjs +0 -55
package/dist/ssr/index.d.mts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { P as Preloaded
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded } from "../packem_shared/types.d-CA7ZeJm9.mjs";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/types.d-CA7ZeJm9.mjs";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-BgoF8JQZ.mjs";
|
|
4
|
+
import { L as LunoraClient } from "../packem_shared/lunora-client.d-BRXKXo0T.mjs";
|
|
4
5
|
import '@lunora/runtime';
|
|
5
6
|
/**
|
|
6
|
-
* Structural shape of a better-auth `getSession` call's resolved value.
|
|
7
|
-
*
|
|
8
|
-
* better-auth's `auth.api.getSession({ headers })` returns `{ user, session }`
|
|
9
|
-
* when a valid session cookie is present, or `null` otherwise. We keep `user`
|
|
10
|
-
* and `session` as open records so `@lunora/client/ssr` carries no hard dependency on
|
|
11
|
-
* better-auth's concrete `User`/`Session` types — the adapter passing the real
|
|
12
|
-
* `auth` instance keeps full inference, while this package stays decoupled.
|
|
13
|
-
*/
|
|
7
|
+
* Structural shape of a better-auth `getSession` call's resolved value.
|
|
8
|
+
*
|
|
9
|
+
* better-auth's `auth.api.getSession({ headers })` returns `{ user, session }`
|
|
10
|
+
* when a valid session cookie is present, or `null` otherwise. We keep `user`
|
|
11
|
+
* and `session` as open records so `@lunora/client/ssr` carries no hard dependency on
|
|
12
|
+
* better-auth's concrete `User`/`Session` types — the adapter passing the real
|
|
13
|
+
* `auth` instance keeps full inference, while this package stays decoupled.
|
|
14
|
+
*/
|
|
14
15
|
interface ServerSession<User extends Record<string, unknown> = Record<string, unknown>, Session extends Record<string, unknown> = Record<string, unknown>> {
|
|
15
16
|
readonly session: Session;
|
|
16
17
|
readonly user: User;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* Structural subset of a better-auth instance: just the one endpoint
|
|
20
|
-
* `getServerSession` needs. Typing it this way (rather than importing
|
|
21
|
-
* `@lunora/auth`'s `LunoraAuth`) means `@lunora/client/ssr` does not depend on
|
|
22
|
-
* better-auth internals — any object exposing `api.getSession` works, including
|
|
23
|
-
* a test stub. The concrete return type is inferred from the passed instance.
|
|
24
|
-
*/
|
|
20
|
+
* Structural subset of a better-auth instance: just the one endpoint
|
|
21
|
+
* `getServerSession` needs. Typing it this way (rather than importing
|
|
22
|
+
* `@lunora/auth`'s `LunoraAuth`) means `@lunora/client/ssr` does not depend on
|
|
23
|
+
* better-auth internals — any object exposing `api.getSession` works, including
|
|
24
|
+
* a test stub. The concrete return type is inferred from the passed instance.
|
|
25
|
+
*/
|
|
25
26
|
interface AuthLike<Result = ServerSession | null> {
|
|
26
27
|
readonly api: {
|
|
27
28
|
getSession: (input: {
|
|
@@ -30,86 +31,86 @@ interface AuthLike<Result = ServerSession | null> {
|
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
* Anything `getServerSession` can read request headers from: a `Request`, a
|
|
34
|
-
* `Headers` object, or a plain object exposing `headers`. SSR loaders across
|
|
35
|
-
* meta-frameworks hand back slightly different request objects, so accept the
|
|
36
|
-
* common shapes rather than forcing the caller to unwrap.
|
|
37
|
-
*/
|
|
34
|
+
* Anything `getServerSession` can read request headers from: a `Request`, a
|
|
35
|
+
* `Headers` object, or a plain object exposing `headers`. SSR loaders across
|
|
36
|
+
* meta-frameworks hand back slightly different request objects, so accept the
|
|
37
|
+
* common shapes rather than forcing the caller to unwrap.
|
|
38
|
+
*/
|
|
38
39
|
type HeadersSource = Headers | Request | {
|
|
39
40
|
readonly headers: Headers;
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
|
-
* Resolve the signed-in session from a request inside an SSR loader.
|
|
43
|
-
*
|
|
44
|
-
* Wraps `auth.api.getSession({ headers })` — the helper every meta-framework
|
|
45
|
-
* app otherwise hand-rolls — so a loader can read identity off the inbound
|
|
46
|
-
* cookies in one call. Returns `{ user, session }` when a valid session cookie
|
|
47
|
-
* is present, or `null` for anonymous requests.
|
|
48
|
-
*
|
|
49
|
-
* The `auth` parameter is structurally typed ({@link AuthLike}), so this
|
|
50
|
-
* package does not depend on better-auth internals; pass a real
|
|
51
|
-
* `@lunora/auth` instance to keep full type inference on `user`/`session`.
|
|
52
|
-
* Forward the resolved session's token to `createServerClient` to run the
|
|
53
|
-
* server-side load (and the later WS subscription) as the same identity.
|
|
54
|
-
*/
|
|
43
|
+
* Resolve the signed-in session from a request inside an SSR loader.
|
|
44
|
+
*
|
|
45
|
+
* Wraps `auth.api.getSession({ headers })` — the helper every meta-framework
|
|
46
|
+
* app otherwise hand-rolls — so a loader can read identity off the inbound
|
|
47
|
+
* cookies in one call. Returns `{ user, session }` when a valid session cookie
|
|
48
|
+
* is present, or `null` for anonymous requests.
|
|
49
|
+
*
|
|
50
|
+
* The `auth` parameter is structurally typed ({@link AuthLike}), so this
|
|
51
|
+
* package does not depend on better-auth internals; pass a real
|
|
52
|
+
* `@lunora/auth` instance to keep full type inference on `user`/`session`.
|
|
53
|
+
* Forward the resolved session's token to `createServerClient` to run the
|
|
54
|
+
* server-side load (and the later WS subscription) as the same identity.
|
|
55
|
+
*/
|
|
55
56
|
declare const getServerSession: <Result>(request: HeadersSource, auth: AuthLike<Result>) => Promise<NonNullable<Result> | null>;
|
|
56
57
|
/**
|
|
57
|
-
* Serialize a {@link Preloaded} token to a JSON string for embedding in the
|
|
58
|
-
* rendered HTML (e.g. a
|
|
59
|
-
* reads on hydration). Every field of `Preloaded` is JSON-serializable by
|
|
60
|
-
* construction — `preloadQuery` only captures the query args, function path,
|
|
61
|
-
* optional shard key, and the resolved value — so this is a thin, explicit
|
|
62
|
-
* `JSON.stringify` that documents the dehydration seam and keeps callers from
|
|
63
|
-
* accidentally stringifying a non-serializable wrapper.
|
|
64
|
-
*
|
|
65
|
-
* The
|
|
66
|
-
*
|
|
67
|
-
* it — the standard XSS-safe script-embedding precaution. This escaping is NOT
|
|
68
|
-
* sufficient for an HTML *attribute* sink (which also needs the quote and
|
|
69
|
-
* characters escaped); embed the output in a raw-text script element, not a
|
|
70
|
-
* data attribute.
|
|
71
|
-
*/
|
|
58
|
+
* Serialize a {@link Preloaded} token to a JSON string for embedding in the
|
|
59
|
+
* rendered HTML (e.g. a `<script>` payload the client
|
|
60
|
+
* reads on hydration). Every field of `Preloaded` is JSON-serializable by
|
|
61
|
+
* construction — `preloadQuery` only captures the query args, function path,
|
|
62
|
+
* optional shard key, and the resolved value — so this is a thin, explicit
|
|
63
|
+
* `JSON.stringify` that documents the dehydration seam and keeps callers from
|
|
64
|
+
* accidentally stringifying a non-serializable wrapper.
|
|
65
|
+
*
|
|
66
|
+
* The `<` is escaped to `<` so the payload is safe to inline inside a
|
|
67
|
+
* `<script>` tag without a stray `<\/script>` (or `<!--`) prematurely closing
|
|
68
|
+
* it — the standard XSS-safe script-embedding precaution. This escaping is NOT
|
|
69
|
+
* sufficient for an HTML *attribute* sink (which also needs the quote and `&`
|
|
70
|
+
* characters escaped); embed the output in a raw-text script element, not a
|
|
71
|
+
* data attribute.
|
|
72
|
+
*/
|
|
72
73
|
declare const serializePreloaded: <T>(preloaded: Preloaded<T>) => string;
|
|
73
74
|
/**
|
|
74
|
-
* Inverse of {@link serializePreloaded}: parse a serialized token back into a
|
|
75
|
-
* {@link Preloaded} value on the client. The
|
|
76
|
-
* is transparent to `JSON.parse`, so no un-escaping step is needed.
|
|
77
|
-
*/
|
|
75
|
+
* Inverse of {@link serializePreloaded}: parse a serialized token back into a
|
|
76
|
+
* {@link Preloaded} value on the client. The `<` escape from serialization
|
|
77
|
+
* is transparent to `JSON.parse`, so no un-escaping step is needed.
|
|
78
|
+
*/
|
|
78
79
|
declare const deserializePreloaded: <T = unknown>(serialized: string) => Preloaded<T>;
|
|
79
80
|
/** Options accepted by {@link createServerClient}. */
|
|
80
81
|
interface ServerClientOptions {
|
|
81
82
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
* `fetch` implementation used for HTTP RPC. Defaults to the ambient global
|
|
84
|
+
* `fetch` (present in Node 18+, Workers, and meta-framework SSR runtimes).
|
|
85
|
+
* Pass one explicitly to forward cookies/headers or to use an instrumented
|
|
86
|
+
* fetch.
|
|
87
|
+
*/
|
|
87
88
|
fetch?: typeof fetch;
|
|
88
89
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
* Bearer token sent as `Authorization: Bearer <token>` on every RPC. In an
|
|
91
|
+
* SSR loader you typically read this from the request (e.g. the session
|
|
92
|
+
* resolved by `getServerSession`) and pass it here so the server-side
|
|
93
|
+
* load runs as the signed-in user — and so the client subscription that
|
|
94
|
+
* resumes after hydration carries the same identity.
|
|
95
|
+
*/
|
|
95
96
|
token?: string;
|
|
96
97
|
/** Base URL of the deployed Lunora worker, e.g. `https://app.example.workers.dev`. */
|
|
97
98
|
url: string;
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
|
-
* Build a request-scoped {@link LunoraClient} for use inside an SSR loader. SSR
|
|
101
|
-
* data loading only ever calls `.query()` (HTTP RPC over `fetch`); a
|
|
102
|
-
* `LunoraClient` opens a socket lazily on `.subscribe()`/`.stream()` and those
|
|
103
|
-
* are never called server-side, so no live connection is established even if the
|
|
104
|
-
* server runtime happens to expose a global `WebSocket`.
|
|
105
|
-
*
|
|
106
|
-
* Create one per request rather than sharing a module-level instance: the bearer
|
|
107
|
-
* token (and any forwarded cookies in `fetch`) are per-user, and a shared client
|
|
108
|
-
* would leak one request's identity into another.
|
|
109
|
-
*
|
|
110
|
-
* This is the framework-neutral home of the helper that previously lived only in
|
|
111
|
-
* `@lunora/react/server`; the React server module re-exports the same surface so
|
|
112
|
-
* existing imports keep working.
|
|
113
|
-
*/
|
|
101
|
+
* Build a request-scoped {@link LunoraClient} for use inside an SSR loader. SSR
|
|
102
|
+
* data loading only ever calls `.query()` (HTTP RPC over `fetch`); a
|
|
103
|
+
* `LunoraClient` opens a socket lazily on `.subscribe()`/`.stream()` and those
|
|
104
|
+
* are never called server-side, so no live connection is established even if the
|
|
105
|
+
* server runtime happens to expose a global `WebSocket`.
|
|
106
|
+
*
|
|
107
|
+
* Create one per request rather than sharing a module-level instance: the bearer
|
|
108
|
+
* token (and any forwarded cookies in `fetch`) are per-user, and a shared client
|
|
109
|
+
* would leak one request's identity into another.
|
|
110
|
+
*
|
|
111
|
+
* This is the framework-neutral home of the helper that previously lived only in
|
|
112
|
+
* `@lunora/react/server`; the React server module re-exports the same surface so
|
|
113
|
+
* existing imports keep working.
|
|
114
|
+
*/
|
|
114
115
|
declare const createServerClient: (options: ServerClientOptions) => LunoraClient;
|
|
115
116
|
export { type AuthLike, type HeadersSource, type Preloaded, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, serializePreloaded };
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { P as Preloaded
|
|
2
|
-
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/
|
|
3
|
-
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-
|
|
1
|
+
import { P as Preloaded } from "../packem_shared/types.d-CA7ZeJm9.js";
|
|
2
|
+
export type { A as ArgsOf, F as FunctionReference, R as ReturnOf } from "../packem_shared/types.d-CA7ZeJm9.js";
|
|
3
|
+
export { p as preloadQuery, a as preloadedQueryResult } from "../packem_shared/preload.d-cq7evweX.js";
|
|
4
|
+
import { L as LunoraClient } from "../packem_shared/lunora-client.d-B23myJYW.js";
|
|
4
5
|
import '@lunora/runtime';
|
|
5
6
|
/**
|
|
6
|
-
* Structural shape of a better-auth `getSession` call's resolved value.
|
|
7
|
-
*
|
|
8
|
-
* better-auth's `auth.api.getSession({ headers })` returns `{ user, session }`
|
|
9
|
-
* when a valid session cookie is present, or `null` otherwise. We keep `user`
|
|
10
|
-
* and `session` as open records so `@lunora/client/ssr` carries no hard dependency on
|
|
11
|
-
* better-auth's concrete `User`/`Session` types — the adapter passing the real
|
|
12
|
-
* `auth` instance keeps full inference, while this package stays decoupled.
|
|
13
|
-
*/
|
|
7
|
+
* Structural shape of a better-auth `getSession` call's resolved value.
|
|
8
|
+
*
|
|
9
|
+
* better-auth's `auth.api.getSession({ headers })` returns `{ user, session }`
|
|
10
|
+
* when a valid session cookie is present, or `null` otherwise. We keep `user`
|
|
11
|
+
* and `session` as open records so `@lunora/client/ssr` carries no hard dependency on
|
|
12
|
+
* better-auth's concrete `User`/`Session` types — the adapter passing the real
|
|
13
|
+
* `auth` instance keeps full inference, while this package stays decoupled.
|
|
14
|
+
*/
|
|
14
15
|
interface ServerSession<User extends Record<string, unknown> = Record<string, unknown>, Session extends Record<string, unknown> = Record<string, unknown>> {
|
|
15
16
|
readonly session: Session;
|
|
16
17
|
readonly user: User;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* Structural subset of a better-auth instance: just the one endpoint
|
|
20
|
-
* `getServerSession` needs. Typing it this way (rather than importing
|
|
21
|
-
* `@lunora/auth`'s `LunoraAuth`) means `@lunora/client/ssr` does not depend on
|
|
22
|
-
* better-auth internals — any object exposing `api.getSession` works, including
|
|
23
|
-
* a test stub. The concrete return type is inferred from the passed instance.
|
|
24
|
-
*/
|
|
20
|
+
* Structural subset of a better-auth instance: just the one endpoint
|
|
21
|
+
* `getServerSession` needs. Typing it this way (rather than importing
|
|
22
|
+
* `@lunora/auth`'s `LunoraAuth`) means `@lunora/client/ssr` does not depend on
|
|
23
|
+
* better-auth internals — any object exposing `api.getSession` works, including
|
|
24
|
+
* a test stub. The concrete return type is inferred from the passed instance.
|
|
25
|
+
*/
|
|
25
26
|
interface AuthLike<Result = ServerSession | null> {
|
|
26
27
|
readonly api: {
|
|
27
28
|
getSession: (input: {
|
|
@@ -30,86 +31,86 @@ interface AuthLike<Result = ServerSession | null> {
|
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
* Anything `getServerSession` can read request headers from: a `Request`, a
|
|
34
|
-
* `Headers` object, or a plain object exposing `headers`. SSR loaders across
|
|
35
|
-
* meta-frameworks hand back slightly different request objects, so accept the
|
|
36
|
-
* common shapes rather than forcing the caller to unwrap.
|
|
37
|
-
*/
|
|
34
|
+
* Anything `getServerSession` can read request headers from: a `Request`, a
|
|
35
|
+
* `Headers` object, or a plain object exposing `headers`. SSR loaders across
|
|
36
|
+
* meta-frameworks hand back slightly different request objects, so accept the
|
|
37
|
+
* common shapes rather than forcing the caller to unwrap.
|
|
38
|
+
*/
|
|
38
39
|
type HeadersSource = Headers | Request | {
|
|
39
40
|
readonly headers: Headers;
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
|
-
* Resolve the signed-in session from a request inside an SSR loader.
|
|
43
|
-
*
|
|
44
|
-
* Wraps `auth.api.getSession({ headers })` — the helper every meta-framework
|
|
45
|
-
* app otherwise hand-rolls — so a loader can read identity off the inbound
|
|
46
|
-
* cookies in one call. Returns `{ user, session }` when a valid session cookie
|
|
47
|
-
* is present, or `null` for anonymous requests.
|
|
48
|
-
*
|
|
49
|
-
* The `auth` parameter is structurally typed ({@link AuthLike}), so this
|
|
50
|
-
* package does not depend on better-auth internals; pass a real
|
|
51
|
-
* `@lunora/auth` instance to keep full type inference on `user`/`session`.
|
|
52
|
-
* Forward the resolved session's token to `createServerClient` to run the
|
|
53
|
-
* server-side load (and the later WS subscription) as the same identity.
|
|
54
|
-
*/
|
|
43
|
+
* Resolve the signed-in session from a request inside an SSR loader.
|
|
44
|
+
*
|
|
45
|
+
* Wraps `auth.api.getSession({ headers })` — the helper every meta-framework
|
|
46
|
+
* app otherwise hand-rolls — so a loader can read identity off the inbound
|
|
47
|
+
* cookies in one call. Returns `{ user, session }` when a valid session cookie
|
|
48
|
+
* is present, or `null` for anonymous requests.
|
|
49
|
+
*
|
|
50
|
+
* The `auth` parameter is structurally typed ({@link AuthLike}), so this
|
|
51
|
+
* package does not depend on better-auth internals; pass a real
|
|
52
|
+
* `@lunora/auth` instance to keep full type inference on `user`/`session`.
|
|
53
|
+
* Forward the resolved session's token to `createServerClient` to run the
|
|
54
|
+
* server-side load (and the later WS subscription) as the same identity.
|
|
55
|
+
*/
|
|
55
56
|
declare const getServerSession: <Result>(request: HeadersSource, auth: AuthLike<Result>) => Promise<NonNullable<Result> | null>;
|
|
56
57
|
/**
|
|
57
|
-
* Serialize a {@link Preloaded} token to a JSON string for embedding in the
|
|
58
|
-
* rendered HTML (e.g. a
|
|
59
|
-
* reads on hydration). Every field of `Preloaded` is JSON-serializable by
|
|
60
|
-
* construction — `preloadQuery` only captures the query args, function path,
|
|
61
|
-
* optional shard key, and the resolved value — so this is a thin, explicit
|
|
62
|
-
* `JSON.stringify` that documents the dehydration seam and keeps callers from
|
|
63
|
-
* accidentally stringifying a non-serializable wrapper.
|
|
64
|
-
*
|
|
65
|
-
* The
|
|
66
|
-
*
|
|
67
|
-
* it — the standard XSS-safe script-embedding precaution. This escaping is NOT
|
|
68
|
-
* sufficient for an HTML *attribute* sink (which also needs the quote and
|
|
69
|
-
* characters escaped); embed the output in a raw-text script element, not a
|
|
70
|
-
* data attribute.
|
|
71
|
-
*/
|
|
58
|
+
* Serialize a {@link Preloaded} token to a JSON string for embedding in the
|
|
59
|
+
* rendered HTML (e.g. a `<script>` payload the client
|
|
60
|
+
* reads on hydration). Every field of `Preloaded` is JSON-serializable by
|
|
61
|
+
* construction — `preloadQuery` only captures the query args, function path,
|
|
62
|
+
* optional shard key, and the resolved value — so this is a thin, explicit
|
|
63
|
+
* `JSON.stringify` that documents the dehydration seam and keeps callers from
|
|
64
|
+
* accidentally stringifying a non-serializable wrapper.
|
|
65
|
+
*
|
|
66
|
+
* The `<` is escaped to `<` so the payload is safe to inline inside a
|
|
67
|
+
* `<script>` tag without a stray `<\/script>` (or `<!--`) prematurely closing
|
|
68
|
+
* it — the standard XSS-safe script-embedding precaution. This escaping is NOT
|
|
69
|
+
* sufficient for an HTML *attribute* sink (which also needs the quote and `&`
|
|
70
|
+
* characters escaped); embed the output in a raw-text script element, not a
|
|
71
|
+
* data attribute.
|
|
72
|
+
*/
|
|
72
73
|
declare const serializePreloaded: <T>(preloaded: Preloaded<T>) => string;
|
|
73
74
|
/**
|
|
74
|
-
* Inverse of {@link serializePreloaded}: parse a serialized token back into a
|
|
75
|
-
* {@link Preloaded} value on the client. The
|
|
76
|
-
* is transparent to `JSON.parse`, so no un-escaping step is needed.
|
|
77
|
-
*/
|
|
75
|
+
* Inverse of {@link serializePreloaded}: parse a serialized token back into a
|
|
76
|
+
* {@link Preloaded} value on the client. The `<` escape from serialization
|
|
77
|
+
* is transparent to `JSON.parse`, so no un-escaping step is needed.
|
|
78
|
+
*/
|
|
78
79
|
declare const deserializePreloaded: <T = unknown>(serialized: string) => Preloaded<T>;
|
|
79
80
|
/** Options accepted by {@link createServerClient}. */
|
|
80
81
|
interface ServerClientOptions {
|
|
81
82
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
* `fetch` implementation used for HTTP RPC. Defaults to the ambient global
|
|
84
|
+
* `fetch` (present in Node 18+, Workers, and meta-framework SSR runtimes).
|
|
85
|
+
* Pass one explicitly to forward cookies/headers or to use an instrumented
|
|
86
|
+
* fetch.
|
|
87
|
+
*/
|
|
87
88
|
fetch?: typeof fetch;
|
|
88
89
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
* Bearer token sent as `Authorization: Bearer <token>` on every RPC. In an
|
|
91
|
+
* SSR loader you typically read this from the request (e.g. the session
|
|
92
|
+
* resolved by `getServerSession`) and pass it here so the server-side
|
|
93
|
+
* load runs as the signed-in user — and so the client subscription that
|
|
94
|
+
* resumes after hydration carries the same identity.
|
|
95
|
+
*/
|
|
95
96
|
token?: string;
|
|
96
97
|
/** Base URL of the deployed Lunora worker, e.g. `https://app.example.workers.dev`. */
|
|
97
98
|
url: string;
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
|
-
* Build a request-scoped {@link LunoraClient} for use inside an SSR loader. SSR
|
|
101
|
-
* data loading only ever calls `.query()` (HTTP RPC over `fetch`); a
|
|
102
|
-
* `LunoraClient` opens a socket lazily on `.subscribe()`/`.stream()` and those
|
|
103
|
-
* are never called server-side, so no live connection is established even if the
|
|
104
|
-
* server runtime happens to expose a global `WebSocket`.
|
|
105
|
-
*
|
|
106
|
-
* Create one per request rather than sharing a module-level instance: the bearer
|
|
107
|
-
* token (and any forwarded cookies in `fetch`) are per-user, and a shared client
|
|
108
|
-
* would leak one request's identity into another.
|
|
109
|
-
*
|
|
110
|
-
* This is the framework-neutral home of the helper that previously lived only in
|
|
111
|
-
* `@lunora/react/server`; the React server module re-exports the same surface so
|
|
112
|
-
* existing imports keep working.
|
|
113
|
-
*/
|
|
101
|
+
* Build a request-scoped {@link LunoraClient} for use inside an SSR loader. SSR
|
|
102
|
+
* data loading only ever calls `.query()` (HTTP RPC over `fetch`); a
|
|
103
|
+
* `LunoraClient` opens a socket lazily on `.subscribe()`/`.stream()` and those
|
|
104
|
+
* are never called server-side, so no live connection is established even if the
|
|
105
|
+
* server runtime happens to expose a global `WebSocket`.
|
|
106
|
+
*
|
|
107
|
+
* Create one per request rather than sharing a module-level instance: the bearer
|
|
108
|
+
* token (and any forwarded cookies in `fetch`) are per-user, and a shared client
|
|
109
|
+
* would leak one request's identity into another.
|
|
110
|
+
*
|
|
111
|
+
* This is the framework-neutral home of the helper that previously lived only in
|
|
112
|
+
* `@lunora/react/server`; the React server module re-exports the same surface so
|
|
113
|
+
* existing imports keep working.
|
|
114
|
+
*/
|
|
114
115
|
declare const createServerClient: (options: ServerClientOptions) => LunoraClient;
|
|
115
116
|
export { type AuthLike, type HeadersSource, type Preloaded, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, serializePreloaded };
|
package/dist/ssr/index.mjs
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { deserializePreloaded, serializePreloaded } from '../packem_shared/deserializePreloaded-C0eJTY_W.mjs';
|
|
3
|
-
export { createServerClient } from '../packem_shared/createServerClient-DMh-2UDv.mjs';
|
|
4
|
-
export { preloadQuery, preloadedQueryResult } from '../packem_shared/preloadQuery-lobFkD2Z.mjs';
|
|
1
|
+
import{getServerSession as o}from"../packem_shared/getServerSession-CGjgRBAE.mjs";import{deserializePreloaded as l,serializePreloaded as t}from"../packem_shared/deserializePreloaded-CHfOFpka.mjs";import{createServerClient as i}from"../packem_shared/createServerClient-CQf6XOk3.mjs";import{preloadQuery as s,preloadedQueryResult as f}from"../packem_shared/preloadQuery-DjwSjFwt.mjs";export{i as createServerClient,l as deserializePreloaded,o as getServerSession,s as preloadQuery,f as preloadedQueryResult,t as serializePreloaded};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UploadControl, HeadersResolver, UploadRestrictions, ChunkedRestAdapter, MultipartAdapter, TusAdapter } from '@visulima/storage-client';
|
|
2
|
+
export { type ChunkedRestAdapter, type ChunkedRestAdapterOptions, type FingerprintFunction, type HeadersResolver, LocalStorageUrlStorage, MemoryUrlStorage, type MultipartAdapter, type MultipartAdapterOptions, type OnBeforeRequest, type RequestOptions, RestrictionError, type TusAdapter, type TusAdapterOptions, type UploadControl, UploadError, type UploadMethod, type UploadRestrictions, type UploadResult, type Uploader, type UrlStorage, createChunkedRestAdapter, createMultipartAdapter, createTusAdapter, putFile, validateFile, validateFiles } from '@visulima/storage-client';
|
|
3
|
+
/** Resumable upload wire protocols {@link createUpload} can drive. */
|
|
4
|
+
type UploadProtocol = "chunked-rest" | "multipart" | "tus";
|
|
5
|
+
/** The adapter shape {@link createUpload} returns — a `.upload(file)` driver plus lifecycle callbacks. */
|
|
6
|
+
type UploadAdapter = ChunkedRestAdapter | MultipartAdapter | TusAdapter;
|
|
7
|
+
/** Options for {@link createUpload}. */
|
|
8
|
+
interface CreateUploadOptions {
|
|
9
|
+
/** Chunk size in bytes (TUS / chunked-REST only). */
|
|
10
|
+
chunkSize?: number;
|
|
11
|
+
/** A shared {@link UploadControl} for pause/resume/cancel (TUS / chunked-REST). */
|
|
12
|
+
control?: UploadControl;
|
|
13
|
+
/** The upload endpoint — a route backed by `@lunora/storage/upload`'s handler. */
|
|
14
|
+
endpoint: string;
|
|
15
|
+
/** Static or dynamically-resolved request headers (e.g. an `Authorization` token). */
|
|
16
|
+
headers?: HeadersResolver;
|
|
17
|
+
/** Maximum retry attempts (TUS / chunked-REST, when `retry` is on). */
|
|
18
|
+
maxRetries?: number;
|
|
19
|
+
/** Extra metadata sent with the upload. */
|
|
20
|
+
metadata?: Record<string, string>;
|
|
21
|
+
/** Which protocol to speak. Default `"tus"` (resumable, pause/resume-capable). */
|
|
22
|
+
protocol?: UploadProtocol;
|
|
23
|
+
/** Client-side size/type restrictions, validated before any network request. */
|
|
24
|
+
restrictions?: UploadRestrictions;
|
|
25
|
+
/** Enable automatic retry on failure (TUS / chunked-REST). */
|
|
26
|
+
retry?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a protocol-appropriate upload adapter against an RLS-gated endpoint.
|
|
30
|
+
* Defaults to TUS — the resumable path that survives pause/resume and a dropped
|
|
31
|
+
* connection. Call `.upload(file)` to start; use the shared {@link UploadControl}
|
|
32
|
+
* (or the adapter's `pause`/`resume`/`abort`) to steer it.
|
|
33
|
+
*/
|
|
34
|
+
declare const createUpload: (options: CreateUploadOptions) => UploadAdapter;
|
|
35
|
+
export { CreateUploadOptions, UploadAdapter, UploadProtocol, createUpload };
|
package/dist/upload.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UploadControl, HeadersResolver, UploadRestrictions, ChunkedRestAdapter, MultipartAdapter, TusAdapter } from '@visulima/storage-client';
|
|
2
|
+
export { type ChunkedRestAdapter, type ChunkedRestAdapterOptions, type FingerprintFunction, type HeadersResolver, LocalStorageUrlStorage, MemoryUrlStorage, type MultipartAdapter, type MultipartAdapterOptions, type OnBeforeRequest, type RequestOptions, RestrictionError, type TusAdapter, type TusAdapterOptions, type UploadControl, UploadError, type UploadMethod, type UploadRestrictions, type UploadResult, type Uploader, type UrlStorage, createChunkedRestAdapter, createMultipartAdapter, createTusAdapter, putFile, validateFile, validateFiles } from '@visulima/storage-client';
|
|
3
|
+
/** Resumable upload wire protocols {@link createUpload} can drive. */
|
|
4
|
+
type UploadProtocol = "chunked-rest" | "multipart" | "tus";
|
|
5
|
+
/** The adapter shape {@link createUpload} returns — a `.upload(file)` driver plus lifecycle callbacks. */
|
|
6
|
+
type UploadAdapter = ChunkedRestAdapter | MultipartAdapter | TusAdapter;
|
|
7
|
+
/** Options for {@link createUpload}. */
|
|
8
|
+
interface CreateUploadOptions {
|
|
9
|
+
/** Chunk size in bytes (TUS / chunked-REST only). */
|
|
10
|
+
chunkSize?: number;
|
|
11
|
+
/** A shared {@link UploadControl} for pause/resume/cancel (TUS / chunked-REST). */
|
|
12
|
+
control?: UploadControl;
|
|
13
|
+
/** The upload endpoint — a route backed by `@lunora/storage/upload`'s handler. */
|
|
14
|
+
endpoint: string;
|
|
15
|
+
/** Static or dynamically-resolved request headers (e.g. an `Authorization` token). */
|
|
16
|
+
headers?: HeadersResolver;
|
|
17
|
+
/** Maximum retry attempts (TUS / chunked-REST, when `retry` is on). */
|
|
18
|
+
maxRetries?: number;
|
|
19
|
+
/** Extra metadata sent with the upload. */
|
|
20
|
+
metadata?: Record<string, string>;
|
|
21
|
+
/** Which protocol to speak. Default `"tus"` (resumable, pause/resume-capable). */
|
|
22
|
+
protocol?: UploadProtocol;
|
|
23
|
+
/** Client-side size/type restrictions, validated before any network request. */
|
|
24
|
+
restrictions?: UploadRestrictions;
|
|
25
|
+
/** Enable automatic retry on failure (TUS / chunked-REST). */
|
|
26
|
+
retry?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a protocol-appropriate upload adapter against an RLS-gated endpoint.
|
|
30
|
+
* Defaults to TUS — the resumable path that survives pause/resume and a dropped
|
|
31
|
+
* connection. Call `.upload(file)` to start; use the shared {@link UploadControl}
|
|
32
|
+
* (or the adapter's `pause`/`resume`/`abort`) to steer it.
|
|
33
|
+
*/
|
|
34
|
+
declare const createUpload: (options: CreateUploadOptions) => UploadAdapter;
|
|
35
|
+
export { CreateUploadOptions, UploadAdapter, UploadProtocol, createUpload };
|
package/dist/upload.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createMultipartAdapter as l,createChunkedRestAdapter as u,createTusAdapter as m}from"@visulima/storage-client";import{LocalStorageUrlStorage as x,MemoryUrlStorage as S,RestrictionError as U,UploadControl as y,UploadError as f,createChunkedRestAdapter as g,createMultipartAdapter as C,createTusAdapter as F,putFile as M,validateFile as v,validateFiles as z}from"@visulima/storage-client";const A=e=>{const t=e.protocol??"tus",{chunkSize:c,control:p,endpoint:r,headers:a,maxRetries:o,metadata:i,restrictions:d,retry:n}=e;if(t==="multipart")return l({endpoint:r,headers:a,maxRetries:o,metadata:i,restrictions:d,retry:n});const s={chunkSize:c,control:p,endpoint:r,headers:a,maxRetries:o,metadata:i,restrictions:d,retry:n};return t==="chunked-rest"?u(s):m(s)};export{x as LocalStorageUrlStorage,S as MemoryUrlStorage,U as RestrictionError,y as UploadControl,f as UploadError,g as createChunkedRestAdapter,C as createMultipartAdapter,F as createTusAdapter,A as createUpload,M as putFile,v as validateFile,z as validateFiles};
|
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.40",
|
|
4
4
|
"description": "Lunora browser SDK: WebSocket transport, optimistic updates, and an offline mutation queue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -56,11 +56,23 @@
|
|
|
56
56
|
"types": "./dist/ssr/index.d.ts",
|
|
57
57
|
"import": "./dist/ssr/index.mjs"
|
|
58
58
|
},
|
|
59
|
+
"./upload": {
|
|
60
|
+
"types": "./dist/upload.d.ts",
|
|
61
|
+
"import": "./dist/upload.mjs"
|
|
62
|
+
},
|
|
63
|
+
"./service": {
|
|
64
|
+
"types": "./dist/service.d.ts",
|
|
65
|
+
"import": "./dist/service.mjs"
|
|
66
|
+
},
|
|
59
67
|
"./package.json": "./package.json"
|
|
60
68
|
},
|
|
61
69
|
"publishConfig": {
|
|
62
70
|
"access": "public"
|
|
63
71
|
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@lunora/errors": "1.0.0-alpha.14",
|
|
74
|
+
"@visulima/storage-client": "1.0.0"
|
|
75
|
+
},
|
|
64
76
|
"engines": {
|
|
65
77
|
"node": "^22.15.0 || >=24.11.0"
|
|
66
78
|
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const DEFAULT_MAX_BUFFER = 1024;
|
|
2
|
-
const createStream = (options) => {
|
|
3
|
-
const maxBuffer = options.maxBuffer ?? DEFAULT_MAX_BUFFER;
|
|
4
|
-
const buffer = [];
|
|
5
|
-
const pending = [];
|
|
6
|
-
let done = false;
|
|
7
|
-
let failure;
|
|
8
|
-
let cancelled = false;
|
|
9
|
-
const flushOne = () => {
|
|
10
|
-
const waiter = pending.shift();
|
|
11
|
-
if (!waiter) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (failure) {
|
|
15
|
-
waiter.reject(failure);
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
if (buffer.length > 0) {
|
|
19
|
-
const value = buffer.shift();
|
|
20
|
-
waiter.resolve({ done: false, value });
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
if (done) {
|
|
24
|
-
waiter.resolve({ done: true, value: void 0 });
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
pending.unshift(waiter);
|
|
28
|
-
return false;
|
|
29
|
-
};
|
|
30
|
-
const handle = {
|
|
31
|
-
complete() {
|
|
32
|
-
if (done || failure) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
done = true;
|
|
36
|
-
while (flushOne()) {
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
fail(error) {
|
|
40
|
-
if (done || failure) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
failure = error;
|
|
44
|
-
buffer.length = 0;
|
|
45
|
-
while (flushOne()) {
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
push(value) {
|
|
49
|
-
if (done || failure || cancelled) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (buffer.length >= maxBuffer) {
|
|
53
|
-
handle.fail(
|
|
54
|
-
Object.assign(new Error(`stream buffer overflow (max=${maxBuffer.toString()}); the consumer cannot keep up with the producer`), {
|
|
55
|
-
code: "STREAM_BACKPRESSURE"
|
|
56
|
-
})
|
|
57
|
-
);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
buffer.push(value);
|
|
61
|
-
flushOne();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const cancel = () => {
|
|
65
|
-
if (cancelled) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
cancelled = true;
|
|
69
|
-
done = true;
|
|
70
|
-
buffer.length = 0;
|
|
71
|
-
try {
|
|
72
|
-
options.onCancel();
|
|
73
|
-
} catch {
|
|
74
|
-
}
|
|
75
|
-
while (flushOne()) {
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const iterable = {
|
|
79
|
-
cancel,
|
|
80
|
-
[Symbol.asyncIterator]() {
|
|
81
|
-
return {
|
|
82
|
-
next() {
|
|
83
|
-
if (failure) {
|
|
84
|
-
return Promise.reject(failure);
|
|
85
|
-
}
|
|
86
|
-
if (buffer.length > 0) {
|
|
87
|
-
const value = buffer.shift();
|
|
88
|
-
return Promise.resolve({ done: false, value });
|
|
89
|
-
}
|
|
90
|
-
if (done) {
|
|
91
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
92
|
-
}
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
pending.push({ reject, resolve });
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
return() {
|
|
98
|
-
cancel();
|
|
99
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
return { handle, iterable };
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export { DEFAULT_MAX_BUFFER, createStream };
|