@noego/wood 0.0.1 → 0.0.3
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/bin/wood.js +1 -0
- package/dist/bridge/backend_entry.cjs +23 -4
- package/dist/bridge/backend_entry.cjs.map +1 -1
- package/dist/bridge/backend_entry.d.cts +8 -2
- package/dist/bridge/backend_entry.d.ts +8 -2
- package/dist/bridge/backend_entry.js +22 -4
- package/dist/bridge/backend_entry.js.map +1 -1
- package/dist/bridge/buffered_ipc_sender.cjs +120 -0
- package/dist/bridge/buffered_ipc_sender.cjs.map +1 -0
- package/dist/bridge/buffered_ipc_sender.d.cts +49 -0
- package/dist/bridge/buffered_ipc_sender.d.ts +49 -0
- package/dist/bridge/buffered_ipc_sender.js +95 -0
- package/dist/bridge/buffered_ipc_sender.js.map +1 -0
- package/dist/client/controller_contract.cjs.map +1 -1
- package/dist/client/controller_contract.d.cts +3 -5
- package/dist/client/controller_contract.d.ts +3 -5
- package/dist/client/index.cjs +18 -20
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1 -2
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +18 -19
- package/dist/client/index.js.map +1 -1
- package/dist/codegen/preload_generator.cjs +10 -4
- package/dist/codegen/preload_generator.cjs.map +1 -1
- package/dist/codegen/preload_generator.js +10 -4
- package/dist/codegen/preload_generator.js.map +1 -1
- package/dist/main/index.cjs +9 -0
- package/dist/main/index.cjs.map +1 -1
- package/dist/main/index.d.cts +4 -0
- package/dist/main/index.d.ts +4 -0
- package/dist/main/index.js +9 -0
- package/dist/main/index.js.map +1 -1
- package/dist/router/wood_router.cjs +1 -1
- package/dist/router/wood_router.cjs.map +1 -1
- package/dist/router/wood_router.d.cts +1 -1
- package/dist/router/wood_router.d.ts +1 -1
- package/dist/router/wood_router.js +1 -1
- package/dist/router/wood_router.js.map +1 -1
- package/dist/runtime/runtime.cjs +35 -24
- package/dist/runtime/runtime.cjs.map +1 -1
- package/dist/runtime/runtime.d.cts +5 -0
- package/dist/runtime/runtime.d.ts +5 -0
- package/dist/runtime/runtime.js +35 -24
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/tracing/index.cjs +6 -2
- package/dist/tracing/index.cjs.map +1 -1
- package/dist/tracing/index.d.cts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +5 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/trace_hub.cjs +37 -8
- package/dist/tracing/trace_hub.cjs.map +1 -1
- package/dist/tracing/trace_hub.d.cts +3 -1
- package/dist/tracing/trace_hub.d.ts +3 -1
- package/dist/tracing/trace_hub.js +34 -7
- package/dist/tracing/trace_hub.js.map +1 -1
- package/dist/tracing/trace_provider.cjs +12 -0
- package/dist/tracing/trace_provider.cjs.map +1 -1
- package/dist/tracing/trace_provider.d.cts +4 -1
- package/dist/tracing/trace_provider.d.ts +4 -1
- package/dist/tracing/trace_provider.js +15 -1
- package/dist/tracing/trace_provider.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/wood_controller.svelte.cjs +0 -110
- package/dist/client/wood_controller.svelte.cjs.map +0 -1
- package/dist/client/wood_controller.svelte.d.cts +0 -30
- package/dist/client/wood_controller.svelte.d.ts +0 -30
- package/dist/client/wood_controller.svelte.js +0 -86
- package/dist/client/wood_controller.svelte.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Subscription, Unsubscribable } from 'rxjs';
|
|
2
|
-
import { ControllerState, ControllerInput, ControllerEvents, PageController } from './controller_contract.js';
|
|
3
|
-
|
|
4
|
-
type ActionConcurrency = 'exhaust' | 'switch' | 'concat' | 'merge' | 'sync';
|
|
5
|
-
declare abstract class WoodController<S extends ControllerState, I extends ControllerInput, E extends ControllerEvents> implements PageController<S, I, E> {
|
|
6
|
-
private _state;
|
|
7
|
-
private _input;
|
|
8
|
-
private _events;
|
|
9
|
-
private destroyed;
|
|
10
|
-
protected readonly subscriptions: Subscription;
|
|
11
|
-
/**
|
|
12
|
-
* Controller state. Subclasses should define this as a class field
|
|
13
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
14
|
-
*
|
|
15
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
16
|
-
* will have it called lazily via this getter.
|
|
17
|
-
*/
|
|
18
|
-
get state(): S;
|
|
19
|
-
get input(): I;
|
|
20
|
-
get events(): E;
|
|
21
|
-
protected abstract createInput(): I;
|
|
22
|
-
protected abstract createEvents(): E;
|
|
23
|
-
protected get isDestroyed(): boolean;
|
|
24
|
-
protected track(teardown: Unsubscribable | (() => void)): void;
|
|
25
|
-
protected createAction<T = void>(actionName: string, strategy: ActionConcurrency, handler: (payload: T) => Promise<void> | void): (payload: T) => void;
|
|
26
|
-
protected handleActionError(actionName: string, error: unknown): void;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { type ActionConcurrency, WoodController };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Subject, Subscription, from, EMPTY } from "rxjs";
|
|
2
|
-
import { exhaustMap, concatMap, switchMap, mergeMap, tap, catchError } from "rxjs/operators";
|
|
3
|
-
class WoodController {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._state = null;
|
|
6
|
-
this._input = null;
|
|
7
|
-
this._events = null;
|
|
8
|
-
this.destroyed = false;
|
|
9
|
-
this.subscriptions = new Subscription();
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Controller state. Subclasses should define this as a class field
|
|
13
|
-
* (e.g. `readonly state = $state({...})`). The field shadows this getter.
|
|
14
|
-
*
|
|
15
|
-
* For backward compatibility, subclasses that implement `createState()`
|
|
16
|
-
* will have it called lazily via this getter.
|
|
17
|
-
*/
|
|
18
|
-
get state() {
|
|
19
|
-
if (!this._state) {
|
|
20
|
-
if (typeof this.createState === "function") {
|
|
21
|
-
this._state = this.createState();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return this._state;
|
|
25
|
-
}
|
|
26
|
-
get input() {
|
|
27
|
-
if (!this._input) {
|
|
28
|
-
this._input = this.createInput();
|
|
29
|
-
}
|
|
30
|
-
return this._input;
|
|
31
|
-
}
|
|
32
|
-
get events() {
|
|
33
|
-
if (!this._events) {
|
|
34
|
-
this._events = this.createEvents();
|
|
35
|
-
}
|
|
36
|
-
return this._events;
|
|
37
|
-
}
|
|
38
|
-
get isDestroyed() {
|
|
39
|
-
return this.destroyed;
|
|
40
|
-
}
|
|
41
|
-
track(teardown) {
|
|
42
|
-
this.subscriptions.add(teardown);
|
|
43
|
-
}
|
|
44
|
-
createAction(actionName, strategy, handler) {
|
|
45
|
-
const subject = new Subject();
|
|
46
|
-
let pipeline$;
|
|
47
|
-
if (strategy === "sync") {
|
|
48
|
-
pipeline$ = subject.pipe(
|
|
49
|
-
tap((payload) => {
|
|
50
|
-
try {
|
|
51
|
-
handler(payload);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
this.handleActionError(actionName, e);
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
);
|
|
57
|
-
} else {
|
|
58
|
-
const mapOp = strategy === "exhaust" ? exhaustMap : strategy === "switch" ? switchMap : strategy === "concat" ? concatMap : mergeMap;
|
|
59
|
-
pipeline$ = subject.pipe(
|
|
60
|
-
mapOp(
|
|
61
|
-
(payload) => from((async () => {
|
|
62
|
-
await handler(payload);
|
|
63
|
-
})()).pipe(
|
|
64
|
-
catchError((error) => {
|
|
65
|
-
this.handleActionError(actionName, error);
|
|
66
|
-
return EMPTY;
|
|
67
|
-
})
|
|
68
|
-
)
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
this.track(pipeline$.subscribe());
|
|
73
|
-
return (payload) => subject.next(payload);
|
|
74
|
-
}
|
|
75
|
-
handleActionError(actionName, error) {
|
|
76
|
-
console.error(`[WoodController] Action '${actionName}' failed:`, error);
|
|
77
|
-
}
|
|
78
|
-
destroy() {
|
|
79
|
-
this.destroyed = true;
|
|
80
|
-
this.subscriptions.unsubscribe();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export {
|
|
84
|
-
WoodController
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=wood_controller.svelte.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/wood_controller.svelte.ts"],"sourcesContent":["import { Subject, Subscription, from, EMPTY, Observable, type Unsubscribable } from 'rxjs';\nimport { exhaustMap, concatMap, switchMap, mergeMap, tap, catchError } from 'rxjs/operators';\nimport type {\n ControllerEvents,\n ControllerInput,\n ControllerState,\n PageController,\n} from './controller_contract';\n\nexport type ActionConcurrency = \n | 'exhaust' \n | 'switch' \n | 'concat' \n | 'merge' \n | 'sync'; \n\nexport abstract class WoodController<\n S extends ControllerState,\n I extends ControllerInput,\n E extends ControllerEvents,\n> implements PageController<S, I, E> {\n private _state: S | null = null;\n private _input: I | null = null;\n private _events: E | null = null;\n private destroyed = false;\n protected readonly subscriptions = new Subscription();\n\n /**\n * Controller state. Subclasses should define this as a class field\n * (e.g. `readonly state = $state({...})`). The field shadows this getter.\n *\n * For backward compatibility, subclasses that implement `createState()`\n * will have it called lazily via this getter.\n */\n get state(): S {\n if (!this._state) {\n if (typeof (this as any).createState === 'function') {\n this._state = (this as any).createState();\n }\n }\n return this._state!;\n }\n\n get input(): I {\n if (!this._input) {\n this._input = this.createInput();\n }\n return this._input;\n }\n\n get events(): E {\n if (!this._events) {\n this._events = this.createEvents();\n }\n return this._events;\n }\n\n protected abstract createInput(): I;\n\n protected abstract createEvents(): E;\n\n protected get isDestroyed(): boolean {\n return this.destroyed;\n }\n\n protected track(teardown: Unsubscribable | (() => void)): void {\n this.subscriptions.add(teardown);\n }\n\n protected createAction<T = void>(\n actionName: string,\n strategy: ActionConcurrency,\n handler: (payload: T) => Promise<void> | void\n ): (payload: T) => void {\n const subject = new Subject<T>();\n let pipeline$: Observable<any>;\n\n if (strategy === 'sync') {\n pipeline$ = subject.pipe(\n tap((payload) => {\n try {\n handler(payload);\n } catch (e) {\n this.handleActionError(actionName, e);\n }\n })\n );\n } else {\n const mapOp = \n strategy === 'exhaust' ? exhaustMap :\n strategy === 'switch' ? switchMap :\n strategy === 'concat' ? concatMap :\n mergeMap;\n\n pipeline$ = subject.pipe(\n mapOp((payload) => \n from((async () => {\n await handler(payload);\n })()).pipe(\n catchError((error) => {\n this.handleActionError(actionName, error);\n return EMPTY; \n })\n )\n )\n );\n }\n\n this.track(pipeline$.subscribe());\n\n return (payload: T) => subject.next(payload);\n }\n\n protected handleActionError(actionName: string, error: unknown): void {\n console.error(`[WoodController] Action '${actionName}' failed:`, error);\n }\n\n destroy(): void {\n this.destroyed = true;\n this.subscriptions.unsubscribe();\n }\n}\n"],"mappings":"AAAA,SAAS,SAAS,cAAc,MAAM,aAA8C;AACpF,SAAS,YAAY,WAAW,WAAW,UAAU,KAAK,kBAAkB;AAerE,MAAe,eAIe;AAAA,EAJ9B;AAKL,SAAQ,SAAmB;AAC3B,SAAQ,SAAmB;AAC3B,SAAQ,UAAoB;AAC5B,SAAQ,YAAY;AACpB,SAAmB,gBAAgB,IAAI,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpD,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,UAAI,OAAQ,KAAa,gBAAgB,YAAY;AACnD,aAAK,SAAU,KAAa,YAAY;AAAA,MAC1C;AAAA,IACF;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,QAAW;AACb,QAAI,CAAC,KAAK,QAAQ;AAChB,WAAK,SAAS,KAAK,YAAY;AAAA,IACjC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAY;AACd,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,UAAU,KAAK,aAAa;AAAA,IACnC;AACA,WAAO,KAAK;AAAA,EACd;AAAA,EAMA,IAAc,cAAuB;AACnC,WAAO,KAA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