@cosmicdrift/kumiko-headless 0.158.2 → 0.160.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-headless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.0",
|
|
4
4
|
"description": "Headless UI logic for Kumiko — Dispatcher contract, Form-Controller, View-Model, Nav-Resolver. Plattform- und React-frei; jeder Renderer (renderer, renderer-web, renderer-native, …) komponiert darauf.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
39
|
+
"@cosmicdrift/kumiko-framework": "0.160.0",
|
|
40
40
|
"temporal-polyfill": "^0.3.2",
|
|
41
41
|
"zod": "^4.4.3"
|
|
42
42
|
},
|
|
@@ -60,6 +60,9 @@ function createFakeDispatcher(options?: {
|
|
|
60
60
|
return result;
|
|
61
61
|
},
|
|
62
62
|
statusStore,
|
|
63
|
+
async *stream() {
|
|
64
|
+
// streams unsupported in the sync fake — empty generator
|
|
65
|
+
},
|
|
63
66
|
pendingWrites: () => pendingWritesStore,
|
|
64
67
|
pendingFiles: () => pendingFilesStore,
|
|
65
68
|
setStatus(next) {
|
package/src/dispatcher/index.ts
CHANGED
package/src/dispatcher/types.ts
CHANGED
|
@@ -149,6 +149,10 @@ export type QueryOpts = {
|
|
|
149
149
|
readonly signal?: AbortSignal;
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
export type StreamOpts = {
|
|
153
|
+
readonly signal?: AbortSignal;
|
|
154
|
+
};
|
|
155
|
+
|
|
152
156
|
// ---------------------------------------------------------------------------
|
|
153
157
|
// The contract
|
|
154
158
|
// ---------------------------------------------------------------------------
|
|
@@ -173,6 +177,17 @@ export type Dispatcher = {
|
|
|
173
177
|
|
|
174
178
|
batch(commands: readonly Command[], opts?: WriteOpts): Promise<BatchResult>;
|
|
175
179
|
|
|
180
|
+
// Dispatcher-driven SSE (`POST /api/stream`, #1380/#1382). Yields one
|
|
181
|
+
// value per `chunk` frame. Terminal `done` ends the generator; terminal
|
|
182
|
+
// `error` rejects with a DispatcherError (thrown). Heartbeat `ping`
|
|
183
|
+
// frames are swallowed. Abort via opts.signal cancels the fetch and
|
|
184
|
+
// rejects with code `aborted`.
|
|
185
|
+
stream<TChunk = unknown>(
|
|
186
|
+
type: string,
|
|
187
|
+
payload: unknown,
|
|
188
|
+
opts?: StreamOpts,
|
|
189
|
+
): AsyncGenerator<TChunk, void, undefined>;
|
|
190
|
+
|
|
176
191
|
// --- Status ---
|
|
177
192
|
|
|
178
193
|
// Subscribe/Emit-Store für Online/Offline/Syncing-Transitions. Konsumenten
|
|
@@ -21,6 +21,7 @@ function makeDispatcher(response?: WriteResult): Dispatcher & {
|
|
|
21
21
|
async batch() {
|
|
22
22
|
return { isSuccess: true, results: [] };
|
|
23
23
|
},
|
|
24
|
+
async *stream() {},
|
|
24
25
|
statusStore: createStore("online"),
|
|
25
26
|
pendingWrites: () => [],
|
|
26
27
|
pendingFiles: () => [],
|
|
@@ -166,6 +167,7 @@ describe("createFormController — submit()", () => {
|
|
|
166
167
|
return { isSuccess: true as const, results: [] };
|
|
167
168
|
},
|
|
168
169
|
statusStore: createStore("online"),
|
|
170
|
+
async *stream() {},
|
|
169
171
|
pendingWrites: () => [],
|
|
170
172
|
pendingFiles: () => [],
|
|
171
173
|
};
|
|
@@ -269,6 +271,7 @@ describe("createFormController — submit()", () => {
|
|
|
269
271
|
return { isSuccess: true as const, results: [] };
|
|
270
272
|
},
|
|
271
273
|
statusStore: createStore("online"),
|
|
274
|
+
async *stream() {},
|
|
272
275
|
pendingWrites: () => [],
|
|
273
276
|
pendingFiles: () => [],
|
|
274
277
|
};
|