@myko/ui-svelte 4.4.0 → 4.4.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/{src/lib → dist}/components/ConnectionStats.svelte +8 -22
- package/dist/components/ConnectionStats.svelte.d.ts +10 -0
- package/dist/components/EntityDiffBadge.svelte +10 -0
- package/dist/components/EntityDiffBadge.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/EntityDiffFields.svelte +27 -49
- package/dist/components/EntityDiffFields.svelte.d.ts +11 -0
- package/{src/lib → dist}/components/EntityDiffNode.svelte +25 -43
- package/dist/components/EntityDiffNode.svelte.d.ts +14 -0
- package/{src/lib → dist}/components/EntityDiffTree.svelte +150 -200
- package/dist/components/EntityDiffTree.svelte.d.ts +21 -0
- package/dist/components/Logs.svelte +30 -0
- package/dist/components/Logs.svelte.d.ts +7 -0
- package/dist/components/Query.svelte +21 -0
- package/dist/components/Query.svelte.d.ts +35 -0
- package/dist/components/Report.svelte +13 -0
- package/dist/components/Report.svelte.d.ts +32 -0
- package/dist/components/Search.svelte +46 -0
- package/dist/components/Search.svelte.d.ts +56 -0
- package/dist/components/ServerView.svelte +76 -0
- package/dist/components/ServerView.svelte.d.ts +8 -0
- package/dist/components/state/resolutions.d.ts +11 -0
- package/dist/components/state/resolutions.js +129 -0
- package/dist/components/state/viewstate.svelte.d.ts +60 -0
- package/dist/components/state/viewstate.svelte.js +259 -0
- package/dist/components/state/windback.svelte.d.ts +16 -0
- package/dist/components/state/windback.svelte.js +65 -0
- package/dist/components/transactions/EntityHistory.svelte +135 -0
- package/dist/components/transactions/EntityHistory.svelte.d.ts +10 -0
- package/{src/lib → dist}/components/transactions/TimeStrip.svelte +18 -25
- package/dist/components/transactions/TimeStrip.svelte.d.ts +3 -0
- package/dist/components/transactions/TransactionDetails.svelte +24 -0
- package/dist/components/transactions/TransactionDetails.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/transactions/TransactionEvent.svelte +20 -32
- package/dist/components/transactions/TransactionEvent.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/transactions/TransactionEventGroup.svelte +8 -13
- package/dist/components/transactions/TransactionEventGroup.svelte.d.ts +8 -0
- package/dist/components/transactions/Transactions.svelte +94 -0
- package/dist/components/transactions/Transactions.svelte.d.ts +8 -0
- package/{src/lib → dist}/components/transactions/TransactonView.svelte +3 -7
- package/dist/components/transactions/TransactonView.svelte.d.ts +7 -0
- package/{src/lib → dist}/components/windback/WindbackFrame.svelte +3 -6
- package/dist/components/windback/WindbackFrame.svelte.d.ts +7 -0
- package/dist/components/windback/index.js +1 -0
- package/dist/index.d.ts +18 -0
- package/{src/lib/index.ts → dist/index.js} +2 -15
- package/dist/services/svelte-client.svelte.d.ts +278 -0
- package/dist/services/svelte-client.svelte.js +678 -0
- package/dist/utils/entity-apply.d.ts +17 -0
- package/dist/utils/entity-apply.js +35 -0
- package/dist/utils/entity-diff.d.ts +40 -0
- package/dist/utils/entity-diff.js +57 -0
- package/dist/utils/entity-tree.d.ts +24 -0
- package/dist/utils/entity-tree.js +111 -0
- package/package.json +13 -9
- package/.prettierignore +0 -4
- package/.prettierrc +0 -15
- package/src/app.d.ts +0 -13
- package/src/app.html +0 -12
- package/src/lib/components/EntityDiffBadge.svelte +0 -18
- package/src/lib/components/Logs.svelte +0 -37
- package/src/lib/components/Query.svelte +0 -34
- package/src/lib/components/Report.svelte +0 -25
- package/src/lib/components/Search.svelte +0 -85
- package/src/lib/components/ServerView.svelte +0 -95
- package/src/lib/components/state/resolutions.ts +0 -137
- package/src/lib/components/state/viewstate.svelte.ts +0 -375
- package/src/lib/components/state/windback.svelte.ts +0 -88
- package/src/lib/components/transactions/EntityHistory.svelte +0 -173
- package/src/lib/components/transactions/TransactionDetails.svelte +0 -26
- package/src/lib/components/transactions/Transactions.svelte +0 -111
- package/src/lib/services/svelte-client.svelte.ts +0 -863
- package/src/lib/utils/entity-apply.ts +0 -47
- package/src/lib/utils/entity-diff.ts +0 -105
- package/src/lib/utils/entity-tree.ts +0 -130
- package/src/routes/+page.svelte +0 -3
- package/static/favicon.png +0 -0
- package/svelte.config.js +0 -18
- package/tsconfig.json +0 -13
- package/vite.config.ts +0 -6
- /package/{src/lib/components/windback/index.ts → dist/components/windback/index.d.ts} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">import { myko as client } from "../../services/svelte-client.svelte.js";
|
|
2
|
+
import { EntitySnapshotDifference } from "@myko/core";
|
|
3
|
+
import { setContext } from "svelte";
|
|
4
|
+
import { watchResize } from "svelte-watch-resize";
|
|
5
|
+
import { TRANSACTIONS_VIEW_STATE, TransactionsViewState } from "../state/viewstate.svelte";
|
|
6
|
+
import { windbackState } from "../state/windback.svelte.js";
|
|
7
|
+
import EntityHistory from "./EntityHistory.svelte";
|
|
8
|
+
import TimeStrip from "./TimeStrip.svelte";
|
|
9
|
+
const viewstate = new TransactionsViewState(windbackState);
|
|
10
|
+
setContext(TRANSACTIONS_VIEW_STATE, viewstate);
|
|
11
|
+
let isMouseDown = $state(false);
|
|
12
|
+
const {
|
|
13
|
+
entrypointId,
|
|
14
|
+
entrypointItemType
|
|
15
|
+
} = $props();
|
|
16
|
+
const onwheel = (e) => {
|
|
17
|
+
if (e.ctrlKey || e.metaKey) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
viewstate.zoom(e.deltaY);
|
|
20
|
+
}
|
|
21
|
+
if (e.shiftKey) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
viewstate.pan(e.deltaY);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const onmousemove = (e) => {
|
|
27
|
+
viewstate.mouseX = e.clientX;
|
|
28
|
+
};
|
|
29
|
+
const onkeydown = (e) => {
|
|
30
|
+
if (e.key === "z") {
|
|
31
|
+
viewstate.zoomAllTheWayOut();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const onmousedown = (e) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
if (e.button === 0) {
|
|
37
|
+
}
|
|
38
|
+
viewstate.startDragWindback();
|
|
39
|
+
};
|
|
40
|
+
const onmouseup = (e) => {
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
viewstate.stopDragWindback();
|
|
43
|
+
};
|
|
44
|
+
const diff = client.watchReport(
|
|
45
|
+
new EntitySnapshotDifference({
|
|
46
|
+
parentType: entrypointItemType,
|
|
47
|
+
parentId: entrypointId
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<svelte:window {onkeydown} {onmousedown} {onmouseup} />
|
|
53
|
+
<div
|
|
54
|
+
class:windbackCursor={viewstate.isOverWindback}
|
|
55
|
+
class="transactions-frame extra class"
|
|
56
|
+
role="presentation"
|
|
57
|
+
use:watchResize={(e) => {
|
|
58
|
+
console.log('RESIZE', e.clientWidth);
|
|
59
|
+
viewstate.width = e.clientWidth;
|
|
60
|
+
}}
|
|
61
|
+
{onwheel}
|
|
62
|
+
{onmousemove}
|
|
63
|
+
>
|
|
64
|
+
<div class="header pad">
|
|
65
|
+
<TimeStrip></TimeStrip>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="scroll pad">
|
|
68
|
+
<EntityHistory id={entrypointId} itemType={entrypointItemType} />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<style>
|
|
73
|
+
.transactions-frame {
|
|
74
|
+
height: 100%;
|
|
75
|
+
min-height: 100%;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
justify-content: flex-start;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.scroll {
|
|
83
|
+
overflow: scroll;
|
|
84
|
+
scrollbar-width: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.header {
|
|
88
|
+
flex-shrink: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.windbackCursor {
|
|
92
|
+
cursor: ew-resize;
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ID } from '@myko/core';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
entrypointId: ID;
|
|
4
|
+
entrypointItemType: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Transactions: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Transactions = ReturnType<typeof Transactions>;
|
|
8
|
+
export default Transactions;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let open = $state(false);
|
|
6
|
-
|
|
7
|
-
const { tx }: { tx: ID } = $props();
|
|
1
|
+
<script lang="ts">import TransactionDetails from "./TransactionDetails.svelte";
|
|
2
|
+
let open = $state(false);
|
|
3
|
+
const { tx } = $props();
|
|
8
4
|
</script>
|
|
9
5
|
|
|
10
6
|
<div
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import Transactions from '../transactions/Transactions.svelte';
|
|
5
|
-
|
|
6
|
-
const { children }: { children: Snippet } = $props();
|
|
1
|
+
<script lang="ts">import { windbackState } from "../state/windback.svelte.js";
|
|
2
|
+
import Transactions from "../transactions/Transactions.svelte";
|
|
3
|
+
const { children } = $props();
|
|
7
4
|
</script>
|
|
8
5
|
|
|
9
6
|
<div class="bg"></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as WindbackFrame } from './WindbackFrame.svelte';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as ConnectionStats } from './components/ConnectionStats.svelte';
|
|
2
|
+
export { default as Logs } from './components/Logs.svelte';
|
|
3
|
+
export { default as Query } from './components/Query.svelte';
|
|
4
|
+
export { default as Report } from './components/Report.svelte';
|
|
5
|
+
export { default as Search } from './components/Search.svelte';
|
|
6
|
+
export { default as ServerView } from './components/ServerView.svelte';
|
|
7
|
+
export { default as Transactions } from './components/transactions/Transactions.svelte';
|
|
8
|
+
export { default as EntityDiffTree } from './components/EntityDiffTree.svelte';
|
|
9
|
+
export { default as EntityDiffBadge } from './components/EntityDiffBadge.svelte';
|
|
10
|
+
export { default as EntityDiffFields } from './components/EntityDiffFields.svelte';
|
|
11
|
+
export { default as EntityDiffNode } from './components/EntityDiffNode.svelte';
|
|
12
|
+
export * from './components/state/windback.svelte';
|
|
13
|
+
export * from './components/windback/index';
|
|
14
|
+
export * from './utils/entity-diff';
|
|
15
|
+
export * from './utils/entity-tree';
|
|
16
|
+
export * from './utils/entity-apply';
|
|
17
|
+
export { createMykoClient, getMykoClient, myko, myko as client, SvelteMykoClient, type CommandError, type CommandSuccess, type LiveQuery, type LiveReport } from './services/svelte-client.svelte';
|
|
18
|
+
export { ConnectionStatus, type ClientStats } from '@myko/core';
|
|
@@ -12,24 +12,11 @@ export { default as EntityDiffFields } from './components/EntityDiffFields.svelt
|
|
|
12
12
|
export { default as EntityDiffNode } from './components/EntityDiffNode.svelte';
|
|
13
13
|
export * from './components/state/windback.svelte';
|
|
14
14
|
export * from './components/windback/index';
|
|
15
|
-
|
|
16
15
|
// Utils
|
|
17
16
|
export * from './utils/entity-diff';
|
|
18
17
|
export * from './utils/entity-tree';
|
|
19
18
|
export * from './utils/entity-apply';
|
|
20
|
-
|
|
21
19
|
// Svelte-friendly Myko client
|
|
22
|
-
export {
|
|
23
|
-
createMykoClient,
|
|
24
|
-
getMykoClient,
|
|
25
|
-
myko,
|
|
26
|
-
myko as client,
|
|
27
|
-
SvelteMykoClient,
|
|
28
|
-
type CommandError,
|
|
29
|
-
type CommandSuccess,
|
|
30
|
-
type LiveQuery,
|
|
31
|
-
type LiveReport
|
|
32
|
-
} from './services/svelte-client.svelte';
|
|
33
|
-
|
|
20
|
+
export { createMykoClient, getMykoClient, myko, myko as client, SvelteMykoClient } from './services/svelte-client.svelte';
|
|
34
21
|
// Re-export useful types from @myko/core
|
|
35
|
-
export { ConnectionStatus
|
|
22
|
+
export { ConnectionStatus } from '@myko/core';
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte-friendly Myko client wrapper
|
|
3
|
+
*
|
|
4
|
+
* Provides reactive state using Svelte 5 runes and SvelteMap for efficient updates.
|
|
5
|
+
* Queries and reports are deduplicated - multiple calls with the same args share
|
|
6
|
+
* the same subscription and are only cancelled when all consumers unsubscribe.
|
|
7
|
+
*/
|
|
8
|
+
import { ConnectionStatus, MykoClient, type ClientStats, type Command, type CommandResult, type MykoError, type Query, type QueryWindow, type QueryWatchOptions, type QueryItem, type QueryWindowInfo, type QueryResult, type View, type ViewItem, type ViewResult, type Report, type ReportResult } from '@myko/core';
|
|
9
|
+
import { SvelteMap } from 'svelte/reactivity';
|
|
10
|
+
import { type Observable } from 'rxjs';
|
|
11
|
+
/** Command sent event (before response) */
|
|
12
|
+
export type CommandSent = {
|
|
13
|
+
commandId: string;
|
|
14
|
+
};
|
|
15
|
+
/** Command success event */
|
|
16
|
+
export type CommandSuccess = {
|
|
17
|
+
commandId: string;
|
|
18
|
+
response: unknown;
|
|
19
|
+
};
|
|
20
|
+
/** Command error event */
|
|
21
|
+
export type CommandError = {
|
|
22
|
+
commandId: string;
|
|
23
|
+
error: Error;
|
|
24
|
+
};
|
|
25
|
+
/** Live report result with automatic lifecycle management */
|
|
26
|
+
export type LiveReport<R extends Report<unknown>> = {
|
|
27
|
+
/** Current value (reactive via $state) */
|
|
28
|
+
readonly value: ReportResult<R> | undefined;
|
|
29
|
+
/** Current error if any */
|
|
30
|
+
readonly error: Error | undefined;
|
|
31
|
+
};
|
|
32
|
+
/** Live query result with automatic lifecycle management */
|
|
33
|
+
export type LiveQuery<Q extends Query<unknown>> = {
|
|
34
|
+
/** Reactive map of items by ID */
|
|
35
|
+
readonly items: SvelteMap<string, QueryItem<Q> & {
|
|
36
|
+
id: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** Whether the query has received its first response */
|
|
39
|
+
readonly resolved: boolean;
|
|
40
|
+
/** Current error if any */
|
|
41
|
+
readonly error: Error | undefined;
|
|
42
|
+
};
|
|
43
|
+
/** Live windowed query result with automatic lifecycle management */
|
|
44
|
+
export type LiveWindowedQuery<Q extends Query<unknown>> = {
|
|
45
|
+
/** Current windowed items */
|
|
46
|
+
readonly items: QueryResult<Q>;
|
|
47
|
+
/** Current reported total count */
|
|
48
|
+
readonly totalCount: number | null;
|
|
49
|
+
/** Current applied server window */
|
|
50
|
+
readonly window: QueryWindow | null;
|
|
51
|
+
/** Whether first response has been received */
|
|
52
|
+
readonly resolved: boolean;
|
|
53
|
+
/** Current error if any */
|
|
54
|
+
readonly error: Error | undefined;
|
|
55
|
+
/** Update server-side window without re-subscribing */
|
|
56
|
+
setWindow(window: QueryWindow | null): void;
|
|
57
|
+
};
|
|
58
|
+
/** Live view result with automatic lifecycle management */
|
|
59
|
+
export type LiveView<V extends View<unknown>> = {
|
|
60
|
+
readonly items: SvelteMap<string, ViewItem<V> & {
|
|
61
|
+
id: string;
|
|
62
|
+
}>;
|
|
63
|
+
readonly resolved: boolean;
|
|
64
|
+
readonly error: Error | undefined;
|
|
65
|
+
};
|
|
66
|
+
/** Live windowed view result with automatic lifecycle management */
|
|
67
|
+
export type LiveWindowedView<V extends View<unknown>> = {
|
|
68
|
+
readonly items: ViewResult<V>;
|
|
69
|
+
readonly totalCount: number | null;
|
|
70
|
+
readonly window: QueryWindow | null;
|
|
71
|
+
readonly resolved: boolean;
|
|
72
|
+
readonly error: Error | undefined;
|
|
73
|
+
setWindow(window: QueryWindow | null): void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Svelte-friendly Myko client
|
|
77
|
+
*
|
|
78
|
+
* Wraps MykoClient to provide reactive Svelte state with automatic lifecycle management.
|
|
79
|
+
*/
|
|
80
|
+
export declare class SvelteMykoClient {
|
|
81
|
+
#private;
|
|
82
|
+
private client;
|
|
83
|
+
private commandSentSubject;
|
|
84
|
+
private commandSuccessSubject;
|
|
85
|
+
private commandErrorSubject;
|
|
86
|
+
/** Observable of all commands when sent (before response) */
|
|
87
|
+
readonly commandSent$: Observable<CommandSent>;
|
|
88
|
+
/** Observable of all command successes */
|
|
89
|
+
readonly commandSuccess$: Observable<CommandSuccess>;
|
|
90
|
+
/** Observable of all command errors */
|
|
91
|
+
readonly commandError$: Observable<CommandError>;
|
|
92
|
+
private statsSubscription;
|
|
93
|
+
constructor();
|
|
94
|
+
/** Current connection status (reactive) */
|
|
95
|
+
get connectionStatus(): ConnectionStatus;
|
|
96
|
+
/** Whether currently connected (reactive) */
|
|
97
|
+
get isConnected(): boolean;
|
|
98
|
+
/** Current connection stats (reactive, null when disconnected) */
|
|
99
|
+
get stats(): ClientStats | null;
|
|
100
|
+
/** Set the server address and connect */
|
|
101
|
+
connect(address: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Enable automatic peer discovery via GetPeerServers query.
|
|
104
|
+
* When enabled, the client will automatically add discovered peer servers
|
|
105
|
+
* to the connection pool for redundancy and load balancing.
|
|
106
|
+
*/
|
|
107
|
+
enablePeerDiscovery(enabled: boolean, secure?: boolean): void;
|
|
108
|
+
/** Set authentication token for commands */
|
|
109
|
+
setToken(token: string | null): void;
|
|
110
|
+
/** Disconnect from the server */
|
|
111
|
+
disconnect(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Create a live report subscription with automatic lifecycle management.
|
|
114
|
+
*
|
|
115
|
+
* The subscription automatically:
|
|
116
|
+
* - Re-subscribes when dependencies in the factory function change
|
|
117
|
+
* - Cleans up when the component unmounts
|
|
118
|
+
* - No manual release() call needed
|
|
119
|
+
*
|
|
120
|
+
* If the factory returns null/undefined, no subscription is created and value remains undefined.
|
|
121
|
+
*
|
|
122
|
+
* IMPORTANT: Must be called during component initialization (in the <script> block),
|
|
123
|
+
* not inside event handlers or other callbacks.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```svelte
|
|
127
|
+
* <script>
|
|
128
|
+
* let { nodeId, sessionId } = $props()
|
|
129
|
+
* const output = client.liveReport(() =>
|
|
130
|
+
* sessionId ? new BindingNodeOutputValue({ nodeId, sessionId }) : null
|
|
131
|
+
* )
|
|
132
|
+
* </script>
|
|
133
|
+
*
|
|
134
|
+
* <div>{output.value?.datagram.data}</div>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
liveReport<R extends Report<unknown>>(factory: () => R | null | undefined): LiveReport<R>;
|
|
138
|
+
/**
|
|
139
|
+
* Create a live query subscription with automatic lifecycle management.
|
|
140
|
+
*
|
|
141
|
+
* The subscription automatically:
|
|
142
|
+
* - Re-subscribes when dependencies in the factory function change
|
|
143
|
+
* - Cleans up when the component unmounts
|
|
144
|
+
* - No manual release() call needed
|
|
145
|
+
*
|
|
146
|
+
* If the factory returns null/undefined, no subscription is created and items map is cleared.
|
|
147
|
+
*
|
|
148
|
+
* IMPORTANT: Must be called during component initialization (in the <script> block),
|
|
149
|
+
* not inside event handlers or other callbacks.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```svelte
|
|
153
|
+
* <script>
|
|
154
|
+
* let { sceneId } = $props()
|
|
155
|
+
* const nodes = client.liveQuery(() =>
|
|
156
|
+
* sceneId ? new GetBindingNodesByQuery({ sceneId }) : null
|
|
157
|
+
* )
|
|
158
|
+
* </script>
|
|
159
|
+
*
|
|
160
|
+
* {#each nodes.items as [id, node] (id)}
|
|
161
|
+
* <div>{node.name}</div>
|
|
162
|
+
* {/each}
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
liveQuery<Q extends Query<unknown>>(factory: () => Q | null | undefined): LiveQuery<Q>;
|
|
166
|
+
/** Create a live view subscription with automatic lifecycle management. */
|
|
167
|
+
liveView<V extends View<unknown>>(factory: () => V | null | undefined): LiveView<V>;
|
|
168
|
+
/**
|
|
169
|
+
* Create a live windowed query with automatic lifecycle management.
|
|
170
|
+
*
|
|
171
|
+
* Uses server-side query windows while exposing Svelte-native reactive state.
|
|
172
|
+
*/
|
|
173
|
+
liveQueryWindowed<Q extends Query<unknown>>(factory: () => Q | null | undefined, optionsFactory?: () => QueryWatchOptions | undefined): LiveWindowedQuery<Q>;
|
|
174
|
+
/** Create a live windowed view with automatic lifecycle management. */
|
|
175
|
+
liveViewWindowed<V extends View<unknown>>(factory: () => V | null | undefined, optionsFactory?: () => QueryWatchOptions | undefined): LiveWindowedView<V>;
|
|
176
|
+
/**
|
|
177
|
+
* Watch a query with Observable-based updates.
|
|
178
|
+
*
|
|
179
|
+
* Returns an Observable that emits the full array of items whenever
|
|
180
|
+
* the result set changes.
|
|
181
|
+
*
|
|
182
|
+
* @deprecated Use `liveQuery()` for component usage. This method requires manual
|
|
183
|
+
* subscription management and doesn't integrate with Svelte's lifecycle.
|
|
184
|
+
* Only use for non-component contexts (e.g., context classes).
|
|
185
|
+
*/
|
|
186
|
+
watchQuery<Q extends Query<unknown>>(queryFactory: Q): Observable<QueryResult<Q>>;
|
|
187
|
+
/**
|
|
188
|
+
* Watch a view with Observable-based updates.
|
|
189
|
+
*
|
|
190
|
+
* @deprecated Use `liveView()` for component usage. Kept for backward compatibility
|
|
191
|
+
* with existing service code paths that still consume observables.
|
|
192
|
+
*/
|
|
193
|
+
watchView<V extends View<unknown>>(viewFactory: V): Observable<ViewResult<V>>;
|
|
194
|
+
/**
|
|
195
|
+
* Watch a query with optional server-side windowing.
|
|
196
|
+
*
|
|
197
|
+
* @deprecated Use `liveQuery()` (or `liveQueryWindowed()` for runes-native windowing)
|
|
198
|
+
* in component/service rune contexts.
|
|
199
|
+
*/
|
|
200
|
+
watchQueryWithOptions<Q extends Query<unknown>>(queryFactory: Q, options?: QueryWatchOptions): Observable<QueryResult<Q>>;
|
|
201
|
+
/**
|
|
202
|
+
* Watch a view with optional server-side windowing.
|
|
203
|
+
*
|
|
204
|
+
* @deprecated Use `liveView()` in component/service rune contexts.
|
|
205
|
+
*/
|
|
206
|
+
watchViewWithOptions<V extends View<unknown>>(viewFactory: V, options?: QueryWatchOptions): Observable<ViewResult<V>>;
|
|
207
|
+
/**
|
|
208
|
+
* Watch a query and mutate its server-side window without re-subscribing.
|
|
209
|
+
*
|
|
210
|
+
* @deprecated Use `liveQueryWindowed()` in component/service rune contexts.
|
|
211
|
+
*/
|
|
212
|
+
watchQueryWindowed<Q extends Query<unknown>>(queryFactory: Q, options?: QueryWatchOptions): {
|
|
213
|
+
tx: string;
|
|
214
|
+
results$: Observable<QueryResult<Q>>;
|
|
215
|
+
windowInfo$: Observable<QueryWindowInfo>;
|
|
216
|
+
setWindow: (window: QueryWindow | null) => void;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Watch a view and mutate its server-side window without re-subscribing.
|
|
220
|
+
*
|
|
221
|
+
* @deprecated Use `liveView()` in component/service rune contexts.
|
|
222
|
+
*/
|
|
223
|
+
watchViewWindowed<V extends View<unknown>>(viewFactory: V, options?: QueryWatchOptions): {
|
|
224
|
+
tx: string;
|
|
225
|
+
results$: Observable<ViewResult<V>>;
|
|
226
|
+
windowInfo$: Observable<QueryWindowInfo>;
|
|
227
|
+
setWindow: (window: QueryWindow | null) => void;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Watch a report with Observable-based updates.
|
|
231
|
+
*
|
|
232
|
+
* Returns an Observable that emits whenever the report result changes.
|
|
233
|
+
*
|
|
234
|
+
* @deprecated Use `liveReport()` for component usage. This method requires manual
|
|
235
|
+
* subscription management and doesn't integrate with Svelte's lifecycle.
|
|
236
|
+
* Only use for non-component contexts (e.g., context classes).
|
|
237
|
+
*/
|
|
238
|
+
watchReport<R extends Report<unknown>>(reportFactory: R): Observable<ReportResult<R>>;
|
|
239
|
+
/**
|
|
240
|
+
* Send a command and wait for the response.
|
|
241
|
+
*
|
|
242
|
+
* Emits to commandSuccess$ or commandError$ observables for generic handling.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```svelte
|
|
246
|
+
* <script>
|
|
247
|
+
* async function deleteMachine(id: string) {
|
|
248
|
+
* const result = await myko.sendCommand(new DeleteMachine({ id }))
|
|
249
|
+
* console.log('Deleted:', result)
|
|
250
|
+
* }
|
|
251
|
+
* </script>
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
sendCommand<C extends Command<unknown>>(commandFactory: C): Promise<CommandResult<C>>;
|
|
255
|
+
/** Access the underlying MykoClient for advanced use cases */
|
|
256
|
+
get raw(): MykoClient;
|
|
257
|
+
/** Measure round-trip latency */
|
|
258
|
+
ping(): Promise<number>;
|
|
259
|
+
/** Observable of all errors from the server */
|
|
260
|
+
get errors(): Observable<MykoError>;
|
|
261
|
+
/**
|
|
262
|
+
* Watch command completion status.
|
|
263
|
+
* Note: This is a compatibility shim - the underlying MykoClient doesn't track
|
|
264
|
+
* command completions the same way as the legacy WSMClient.
|
|
265
|
+
*/
|
|
266
|
+
watchCommandStatus(): Observable<unknown[]>;
|
|
267
|
+
/**
|
|
268
|
+
* Clear a command completion from tracking.
|
|
269
|
+
* Note: This is a compatibility shim - no-op in the new client.
|
|
270
|
+
*/
|
|
271
|
+
clearCommandCompletion(_tx: string): void;
|
|
272
|
+
}
|
|
273
|
+
/** Global singleton client instance (auto-initialized) */
|
|
274
|
+
export declare const myko: SvelteMykoClient;
|
|
275
|
+
/** Get the global MykoClient instance */
|
|
276
|
+
export declare function getMykoClient(): SvelteMykoClient;
|
|
277
|
+
/** Create a new SvelteMykoClient instance (non-singleton, for advanced use) */
|
|
278
|
+
export declare function createMykoClient(): SvelteMykoClient;
|