wenay-common2 1.0.62 → 1.0.63
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/lib/Common/Observe/index.d.ts +2 -1
- package/lib/Common/Observe/index.js +2 -1
- package/lib/Common/Observe/reactive.d.ts +21 -0
- package/lib/Common/Observe/reactive.js +374 -0
- package/lib/Common/Observe/reactive2.d.ts +1 -21
- package/lib/Common/Observe/reactive2.js +15 -372
- package/lib/Common/Observe/store-manager.d.ts +123 -0
- package/lib/Common/Observe/store-manager.js +227 -0
- package/lib/Common/Observe/store-offline.d.ts +10 -10
- package/lib/Common/Observe/store-offline.js +2 -2
- package/lib/Common/Observe/store.d.ts +1 -1
- package/lib/Common/Observe/store.js +13 -13
- package/lib/Common/async/promiseProgress.d.ts +2 -2
- package/lib/Common/events/Listen.d.ts +129 -1
- package/lib/Common/events/Listen.js +243 -15
- package/lib/Common/events/Listen3.d.ts +1 -129
- package/lib/Common/events/Listen3.js +15 -243
- package/lib/Common/events/SocketBuffer.d.ts +4 -4
- package/lib/Common/events/SocketServerHook.d.ts +2 -2
- package/lib/Common/events/replay-conflate.d.ts +2 -2
- package/lib/Common/events/replay-conflate.js +2 -2
- package/lib/Common/events/replay-history.d.ts +1 -1
- package/lib/Common/events/replay-listen.d.ts +9 -9
- package/lib/Common/events/replay-listen.js +4 -4
- package/lib/Common/events/replay-wire.d.ts +1 -1
- package/package.json +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizeTuple } from './
|
|
1
|
+
import { NormalizeTuple } from './Listen';
|
|
2
2
|
import { ListenReplayApi, ReplayEvent } from './replay-listen';
|
|
3
3
|
export type ConflateOpts<Z extends any[] = any[]> = {
|
|
4
4
|
pending: () => number;
|
|
@@ -10,7 +10,7 @@ export type ConflateOpts<Z extends any[] = any[]> = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function conflateReplay<T>(replay: ListenReplayApi<T>, opts: ConflateOpts<NormalizeTuple<T>>): {
|
|
12
12
|
api: {
|
|
13
|
-
line: import("./
|
|
13
|
+
line: import("./Listen").ListenApi<[ReplayEvent<NormalizeTuple<T>>]>;
|
|
14
14
|
since: (seq: number) => ReplayEvent<NormalizeTuple<T>>[] | null;
|
|
15
15
|
keyframe: () => ReplayEvent<NormalizeTuple<T>> | null;
|
|
16
16
|
frame: (seq: number, hint?: unknown) => ReplayEvent<NormalizeTuple<T>>[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.conflateReplay = conflateReplay;
|
|
4
|
-
const
|
|
4
|
+
const Listen_1 = require("./Listen");
|
|
5
5
|
function conflateReplay(replay, opts) {
|
|
6
6
|
const { pending, highWater, lowWater = 0, pollMs = 25, keyOf, maxKeys = 1024 } = opts;
|
|
7
7
|
if (!replay.hasKeyframe)
|
|
8
8
|
throw new TypeError('conflateReplay: нужен current-провайдер (keyframe recovery)');
|
|
9
|
-
const gate = (0,
|
|
9
|
+
const gate = (0, Listen_1.createListen)(() => { });
|
|
10
10
|
gate.run();
|
|
11
11
|
let conflating = false;
|
|
12
12
|
let closed = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Listener, NormalizeTuple } from './
|
|
1
|
+
import { Listener, NormalizeTuple } from './Listen';
|
|
2
2
|
import { ListenOnReplay, ListenReplayApi, ReplayEvent } from './replay-listen';
|
|
3
3
|
export type ReplayStorage<Z extends any[] = any[]> = {
|
|
4
4
|
putEvent: (ev: ReplayEvent<Z>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Listener, ListenApi, ListenCurrent, ListenCurrentProvider, ListenOnBrand, ListenOptions, NormalizeTuple } from './
|
|
1
|
+
import { Listener, ListenApi, ListenCurrent, ListenCurrentProvider, ListenOnBrand, ListenOptions, NormalizeTuple } from './Listen';
|
|
2
2
|
type key = string | symbol;
|
|
3
3
|
type cbClose = () => void;
|
|
4
4
|
export declare const IS_REPLAY_LISTEN: unique symbol;
|
|
@@ -47,13 +47,13 @@ export declare function withReplayListen<T>(base: ListenApi<T>, options?: Replay
|
|
|
47
47
|
key?: key;
|
|
48
48
|
current?: ListenCurrent<NormalizeTuple<T>>;
|
|
49
49
|
}) => () => void;
|
|
50
|
-
has(key: import("./
|
|
51
|
-
off(keyOrCallback: import("./
|
|
50
|
+
has(key: import("./Listen").ListenKey): boolean;
|
|
51
|
+
off(keyOrCallback: import("./Listen").ListenKey | Listener<NormalizeTuple<T>> | null): void;
|
|
52
52
|
count(): number;
|
|
53
|
-
keys(): import("./
|
|
53
|
+
keys(): import("./Listen").ListenKey[];
|
|
54
54
|
isRunning(): boolean;
|
|
55
55
|
run(): void;
|
|
56
|
-
onClose(cb: () => void): import("./
|
|
56
|
+
onClose(cb: () => void): import("./Listen").ListenOff;
|
|
57
57
|
};
|
|
58
58
|
export type ListenReplayApi<T> = ReturnType<typeof withReplayListen<T>>;
|
|
59
59
|
export type ReplayListenUseOptions<T> = ListenOptions<T> & ReplayListenOptions<NormalizeTuple<T>>;
|
|
@@ -73,12 +73,12 @@ export declare function replayListen<T>(options?: ReplayListenUseOptions<T>): re
|
|
|
73
73
|
key?: key;
|
|
74
74
|
current?: ListenCurrent<NormalizeTuple<T>> | undefined;
|
|
75
75
|
}) => () => void;
|
|
76
|
-
has(key: import("./
|
|
77
|
-
off(keyOrCallback: import("./
|
|
76
|
+
has(key: import("./Listen").ListenKey): boolean;
|
|
77
|
+
off(keyOrCallback: import("./Listen").ListenKey | Listener<NormalizeTuple<T>> | null): void;
|
|
78
78
|
count(): number;
|
|
79
|
-
keys(): import("./
|
|
79
|
+
keys(): import("./Listen").ListenKey[];
|
|
80
80
|
isRunning(): boolean;
|
|
81
81
|
run(): void;
|
|
82
|
-
onClose(cb: () => void): import("./
|
|
82
|
+
onClose(cb: () => void): import("./Listen").ListenOff;
|
|
83
83
|
}];
|
|
84
84
|
export {};
|
|
@@ -4,7 +4,7 @@ exports.IS_REPLAY_LISTEN = void 0;
|
|
|
4
4
|
exports.isReplayListen = isReplayListen;
|
|
5
5
|
exports.withReplayListen = withReplayListen;
|
|
6
6
|
exports.replayListen = replayListen;
|
|
7
|
-
const
|
|
7
|
+
const Listen_1 = require("./Listen");
|
|
8
8
|
exports.IS_REPLAY_LISTEN = Symbol.for('isReplayListen');
|
|
9
9
|
function isReplayListen(obj) {
|
|
10
10
|
return !!obj && typeof obj == 'object' && Object.prototype.hasOwnProperty.call(obj, exports.IS_REPLAY_LISTEN);
|
|
@@ -16,7 +16,7 @@ function withReplayListen(base, options = {}) {
|
|
|
16
16
|
let head = 0;
|
|
17
17
|
const ring = [];
|
|
18
18
|
let emitting = null;
|
|
19
|
-
const line = (0,
|
|
19
|
+
const line = (0, Listen_1.createListen)(() => { });
|
|
20
20
|
line.run();
|
|
21
21
|
function journalSince(seq) {
|
|
22
22
|
if (getSince)
|
|
@@ -179,13 +179,13 @@ function withReplayListen(base, options = {}) {
|
|
|
179
179
|
},
|
|
180
180
|
};
|
|
181
181
|
Object.defineProperty(api, exports.IS_REPLAY_LISTEN, { value: true });
|
|
182
|
-
(0,
|
|
182
|
+
(0, Listen_1.registerListenOn)(api.on, api);
|
|
183
183
|
return api;
|
|
184
184
|
}
|
|
185
185
|
function replayListen(options = {}) {
|
|
186
186
|
const { current, frame, history, getSince, onJournal, now, staleMs, onStale, ...listenOptions } = options;
|
|
187
187
|
let t;
|
|
188
|
-
const base = (0,
|
|
188
|
+
const base = (0, Listen_1.createListen)((e) => { t = e; }, { fast: true, ...listenOptions });
|
|
189
189
|
const listen = withReplayListen(base, { current, frame, history, getSince, onJournal, now, staleMs, onStale });
|
|
190
190
|
base.run();
|
|
191
191
|
t = listen.emit;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Listener, NormalizeTuple } from './
|
|
1
|
+
import { Listener, NormalizeTuple } from './Listen';
|
|
2
2
|
import { ListenReplayApi, ReplayEvent, StaleInfo } from './replay-listen';
|
|
3
3
|
import { conflateReplay, ConflateOpts } from './replay-conflate';
|
|
4
4
|
export type ReplayExpose<T> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wenay-common2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Common library",
|
|
5
5
|
"strict": true,
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -30,5 +30,8 @@
|
|
|
30
30
|
"./client": "./lib/client.js",
|
|
31
31
|
"./server": "./lib/server.js",
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"express": "^5.2.1"
|
|
33
36
|
}
|
|
34
37
|
}
|