@quantform/core 0.7.0-beta.33 → 0.7.0-beta.35
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/dist/cli/pull.d.ts.map +1 -1
- package/dist/cli/pull.js +4 -81
- package/dist/cli/replay.d.ts.map +1 -1
- package/dist/cli/replay.js +3 -35
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +3 -37
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/replay/index.d.ts +6 -4
- package/dist/replay/index.d.ts.map +1 -1
- package/dist/replay/index.js +6 -4
- package/dist/replay/replay-guard.d.ts +10 -0
- package/dist/replay/replay-guard.d.ts.map +1 -0
- package/dist/replay/replay-guard.js +8 -0
- package/dist/replay/replay.d.ts +10 -0
- package/dist/replay/replay.d.ts.map +1 -0
- package/dist/replay/replay.js +9 -0
- package/dist/replay/use-replay-breakpoint.d.ts +3 -0
- package/dist/replay/use-replay-breakpoint.d.ts.map +1 -0
- package/dist/replay/use-replay-breakpoint.js +22 -0
- package/dist/replay/use-replay-manager.d.ts +12 -0
- package/dist/replay/use-replay-manager.d.ts.map +1 -0
- package/dist/replay/use-replay-manager.js +88 -0
- package/dist/replay/use-replay-storage-buffer.d.ts +15 -0
- package/dist/replay/use-replay-storage-buffer.d.ts.map +1 -0
- package/dist/replay/use-replay-storage-buffer.js +50 -0
- package/dist/replay/use-replay-storage.d.ts +11 -8
- package/dist/replay/use-replay-storage.d.ts.map +1 -1
- package/dist/replay/use-replay-storage.js +34 -5
- package/dist/replay/use-replay-storage.spec.d.ts +2 -0
- package/dist/replay/use-replay-storage.spec.d.ts.map +1 -0
- package/dist/replay/use-replay-storage.spec.js +74 -0
- package/dist/replay/use-replay.d.ts +2 -2
- package/dist/replay/use-replay.d.ts.map +1 -1
- package/dist/replay/use-replay.js +8 -20
- package/dist/replay/use-replay.spec.js +125 -101
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -0
- package/dist/use-execution-mode.d.ts +6 -1
- package/dist/use-execution-mode.d.ts.map +1 -1
- package/dist/use-execution-mode.js +16 -8
- package/dist/use-timestamp.js +2 -2
- package/package.json +1 -1
- package/src/cli/pull.ts +6 -63
- package/src/cli/replay.ts +4 -16
- package/src/cli/run.ts +4 -18
- package/src/index.ts +1 -4
- package/src/replay/index.ts +6 -4
- package/src/replay/replay-guard.ts +11 -0
- package/src/replay/replay.ts +13 -0
- package/src/replay/use-replay-breakpoint.ts +29 -0
- package/src/replay/use-replay-manager.ts +106 -0
- package/src/replay/use-replay-storage-buffer.ts +43 -0
- package/src/replay/use-replay-storage.spec.ts +85 -0
- package/src/replay/use-replay-storage.ts +26 -5
- package/src/replay/use-replay.spec.ts +10 -3
- package/src/replay/use-replay.ts +11 -17
- package/src/storage/index.ts +1 -0
- package/src/use-execution-mode.ts +16 -8
- package/src/use-timestamp.ts +2 -2
- package/dist/replay/use-replay-coordinator.d.ts +0 -10
- package/dist/replay/use-replay-coordinator.d.ts.map +0 -1
- package/dist/replay/use-replay-coordinator.js +0 -119
- package/dist/replay/use-replay-reader.d.ts +0 -7
- package/dist/replay/use-replay-reader.d.ts.map +0 -1
- package/dist/replay/use-replay-reader.js +0 -32
- package/dist/replay/use-replay-reader.spec.d.ts +0 -2
- package/dist/replay/use-replay-reader.spec.d.ts.map +0 -1
- package/dist/replay/use-replay-reader.spec.js +0 -58
- package/dist/replay/use-replay-writer.d.ts +0 -6
- package/dist/replay/use-replay-writer.d.ts.map +0 -1
- package/dist/replay/use-replay-writer.js +0 -14
- package/dist/replay/use-replay-writer.spec.d.ts +0 -2
- package/dist/replay/use-replay-writer.spec.d.ts.map +0 -1
- package/dist/replay/use-replay-writer.spec.js +0 -53
- package/dist/replay/with-replay.d.ts +0 -4
- package/dist/replay/with-replay.d.ts.map +0 -1
- package/dist/replay/with-replay.js +0 -8
- package/src/replay/use-replay-coordinator.ts +0 -142
- package/src/replay/use-replay-reader.spec.ts +0 -64
- package/src/replay/use-replay-reader.ts +0 -23
- package/src/replay/use-replay-writer.spec.ts +0 -56
- package/src/replay/use-replay-writer.ts +0 -17
- package/src/replay/with-replay.ts +0 -10
package/dist/cli/pull.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/cli/pull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/cli/pull.ts"],"names":[],"mappings":"AAKA,yBAA+B,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAS5E"}
|
package/dist/cli/pull.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,71 +12,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
13
|
};
|
|
37
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const path_1 = require("path");
|
|
39
15
|
const build_1 = __importDefault(require("../cli/build"));
|
|
40
|
-
const workspace_1 = require("../cli/internal/workspace");
|
|
41
|
-
const core_1 = require("../core");
|
|
42
|
-
const module_1 = require("../module");
|
|
43
16
|
const use_execution_mode_1 = require("../use-execution-mode");
|
|
17
|
+
const script_1 = require("./internal/script");
|
|
44
18
|
function default_1(name, instrument, options) {
|
|
45
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
20
|
if (yield (0, build_1.default)()) {
|
|
47
21
|
return;
|
|
48
22
|
}
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
...(0, core_1.core)(),
|
|
53
|
-
...script.module,
|
|
54
|
-
(0, use_execution_mode_1.paperExecutionMode)({ recording: false })
|
|
55
|
-
]);
|
|
56
|
-
const { act } = yield module.awake();
|
|
57
|
-
const output = yield act(() => script.default());
|
|
58
|
-
/*const builder = new SessionBuilder().useSessionId(
|
|
59
|
-
options.id ? Number(options.id) : now()
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
await spawn(name, builder);
|
|
63
|
-
|
|
64
|
-
const session = builder.paper();
|
|
65
|
-
|
|
66
|
-
console.time('Pulling completed in');
|
|
67
|
-
|
|
68
|
-
await session.awake();
|
|
69
|
-
|
|
70
|
-
const bar = new SingleBar(
|
|
71
|
-
{
|
|
72
|
-
format: `Pulling ${instrument} [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}`
|
|
73
|
-
},
|
|
74
|
-
Presets.rect
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const feed = new Feed(builder.storage('feed'));
|
|
78
|
-
const from = options.from ? Date.parse(options.from) : builder.period.from;
|
|
79
|
-
const to = options.to ? Date.parse(options.to) : builder.period.to;
|
|
80
|
-
|
|
81
|
-
bar.start(100, 0);
|
|
82
|
-
|
|
83
|
-
await session.aggregate.feed(
|
|
84
|
-
instrumentOf(instrument),
|
|
85
|
-
from,
|
|
86
|
-
to,
|
|
87
|
-
async (timestamp, events) => {
|
|
88
|
-
const duration = to - from;
|
|
89
|
-
const completed = timestamp - from;
|
|
90
|
-
|
|
91
|
-
await feed.save(events);
|
|
92
|
-
|
|
93
|
-
bar.update(Math.floor((completed / duration) * 100));
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
bar.update(100);
|
|
98
|
-
bar.stop();
|
|
99
|
-
|
|
100
|
-
await session.dispose();
|
|
101
|
-
|
|
102
|
-
console.timeLog('Pulling completed in');*/
|
|
23
|
+
const script = new script_1.Script(name, [(0, use_execution_mode_1.idleExecutionMode)()]);
|
|
24
|
+
//const output = await script.run();
|
|
25
|
+
//console.log(output);
|
|
103
26
|
});
|
|
104
27
|
}
|
|
105
28
|
exports.default = default_1;
|
package/dist/cli/replay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/cli/replay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/cli/replay.ts"],"names":[],"mappings":"AAMA,yBAA+B,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBAYxD"}
|
package/dist/cli/replay.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,29 +12,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
13
|
};
|
|
37
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const path_1 = require("path");
|
|
39
|
-
const rxjs_1 = require("rxjs");
|
|
40
15
|
const build_1 = __importDefault(require("../cli/build"));
|
|
41
|
-
const workspace_1 = require("../cli/internal/workspace");
|
|
42
|
-
const core_1 = require("../core");
|
|
43
|
-
const module_1 = require("../module");
|
|
44
16
|
const replay_1 = require("../replay");
|
|
45
17
|
const use_execution_mode_1 = require("../use-execution-mode");
|
|
18
|
+
const script_1 = require("./internal/script");
|
|
46
19
|
function default_1(name, options) {
|
|
47
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
21
|
if (yield (0, build_1.default)()) {
|
|
49
22
|
return;
|
|
50
23
|
}
|
|
51
|
-
const script =
|
|
52
|
-
const dependencies = script.module2;
|
|
53
|
-
const module = new module_1.Module([
|
|
54
|
-
...(0, core_1.core)(),
|
|
55
|
-
...dependencies,
|
|
24
|
+
const script = new script_1.Script(name, [
|
|
56
25
|
(0, replay_1.replayOptions)({ from: 0, to: Number.MAX_VALUE }),
|
|
57
26
|
(0, use_execution_mode_1.replayExecutionMode)()
|
|
58
27
|
]);
|
|
59
|
-
const
|
|
60
|
-
const output = yield act(() => (0, rxjs_1.lastValueFrom)(script.default(options)));
|
|
28
|
+
const output = yield script.run();
|
|
61
29
|
console.log(output);
|
|
62
30
|
});
|
|
63
31
|
}
|
package/dist/cli/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAKA,yBAA+B,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,iBASxD"}
|
package/dist/cli/run.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,27 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
13
|
};
|
|
37
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const path_1 = require("path");
|
|
39
|
-
const rxjs_1 = require("rxjs");
|
|
40
15
|
const build_1 = __importDefault(require("../cli/build"));
|
|
41
|
-
const workspace_1 = require("../cli/internal/workspace");
|
|
42
|
-
const core_1 = require("../core");
|
|
43
|
-
const module_1 = require("../module");
|
|
44
16
|
const use_execution_mode_1 = require("../use-execution-mode");
|
|
17
|
+
const script_1 = require("./internal/script");
|
|
45
18
|
function default_1(name, options) {
|
|
46
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
20
|
if (yield (0, build_1.default)()) {
|
|
48
21
|
return;
|
|
49
22
|
}
|
|
50
|
-
const script =
|
|
51
|
-
const
|
|
52
|
-
const module = new module_1.Module([
|
|
53
|
-
...(0, core_1.core)(),
|
|
54
|
-
...dependencies,
|
|
55
|
-
(0, use_execution_mode_1.liveExecutionMode)({ recording: true })
|
|
56
|
-
]);
|
|
57
|
-
const { act } = yield module.awake();
|
|
58
|
-
const output = yield act(() => (0, rxjs_1.lastValueFrom)(script.default(options)));
|
|
23
|
+
const script = new script_1.Script(name, [(0, use_execution_mode_1.liveExecutionMode)({ recording: true })]);
|
|
24
|
+
const output = yield script.run();
|
|
59
25
|
console.log(output);
|
|
60
26
|
});
|
|
61
27
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,13 +7,10 @@ export * from './use-timestamp';
|
|
|
7
7
|
export * from './simulator';
|
|
8
8
|
export * from './make-test-module';
|
|
9
9
|
export * from './core';
|
|
10
|
-
export * from './replay/use-replay-coordinator';
|
|
11
10
|
export * from './use-execution-mode';
|
|
12
|
-
export * from './storage
|
|
13
|
-
export * from './storage/use-cache';
|
|
11
|
+
export * from './storage';
|
|
14
12
|
export * from './use-logger';
|
|
15
13
|
export * from './replay';
|
|
16
|
-
export * from './replay/use-replay-coordinator';
|
|
17
14
|
export * from './when-socket';
|
|
18
15
|
export * from './with-request';
|
|
19
16
|
export * from './with-memo';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,13 +23,10 @@ __exportStar(require("./use-timestamp"), exports);
|
|
|
23
23
|
__exportStar(require("./simulator"), exports);
|
|
24
24
|
__exportStar(require("./make-test-module"), exports);
|
|
25
25
|
__exportStar(require("./core"), exports);
|
|
26
|
-
__exportStar(require("./replay/use-replay-coordinator"), exports);
|
|
27
26
|
__exportStar(require("./use-execution-mode"), exports);
|
|
28
|
-
__exportStar(require("./storage
|
|
29
|
-
__exportStar(require("./storage/use-cache"), exports);
|
|
27
|
+
__exportStar(require("./storage"), exports);
|
|
30
28
|
__exportStar(require("./use-logger"), exports);
|
|
31
29
|
__exportStar(require("./replay"), exports);
|
|
32
|
-
__exportStar(require("./replay/use-replay-coordinator"), exports);
|
|
33
30
|
__exportStar(require("./when-socket"), exports);
|
|
34
31
|
__exportStar(require("./with-request"), exports);
|
|
35
32
|
__exportStar(require("./with-memo"), exports);
|
package/dist/replay/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './use-replay';
|
|
2
|
-
export * from './use-replay-
|
|
2
|
+
export * from './use-replay-breakpoint';
|
|
3
3
|
export * from './use-replay-options';
|
|
4
|
-
export * from './use-replay-
|
|
5
|
-
export * from './use-replay-
|
|
6
|
-
export * from './
|
|
4
|
+
export * from './use-replay-storage';
|
|
5
|
+
export * from './use-replay-storage-buffer';
|
|
6
|
+
export * from './use-replay-manager';
|
|
7
|
+
export * from './replay';
|
|
8
|
+
export * from './replay-guard';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/replay/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/replay/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/replay/index.js
CHANGED
|
@@ -15,8 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./use-replay"), exports);
|
|
18
|
-
__exportStar(require("./use-replay-
|
|
18
|
+
__exportStar(require("./use-replay-breakpoint"), exports);
|
|
19
19
|
__exportStar(require("./use-replay-options"), exports);
|
|
20
|
-
__exportStar(require("./use-replay-
|
|
21
|
-
__exportStar(require("./use-replay-
|
|
22
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./use-replay-storage"), exports);
|
|
21
|
+
__exportStar(require("./use-replay-storage-buffer"), exports);
|
|
22
|
+
__exportStar(require("./use-replay-manager"), exports);
|
|
23
|
+
__exportStar(require("./replay"), exports);
|
|
24
|
+
__exportStar(require("./replay-guard"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { dependency } from '../use-hash';
|
|
3
|
+
export declare function replayGuard<T extends Array<dependency>, K>(fn: (...args: T) => Observable<{
|
|
4
|
+
timestamp: number;
|
|
5
|
+
payload: K;
|
|
6
|
+
}>): (...args: T) => Observable<{
|
|
7
|
+
timestamp: number;
|
|
8
|
+
payload: K;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=replay-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-guard.d.ts","sourceRoot":"","sources":["../../src/replay/replay-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,wBAAgB,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EACxD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,GAChE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAE/D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replayGuard = void 0;
|
|
4
|
+
const use_replay_breakpoint_1 = require("./use-replay-breakpoint");
|
|
5
|
+
function replayGuard(fn) {
|
|
6
|
+
return (...args) => (0, use_replay_breakpoint_1.useReplayBreakpoint)(fn(...args));
|
|
7
|
+
}
|
|
8
|
+
exports.replayGuard = replayGuard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { dependency } from '../use-hash';
|
|
3
|
+
export declare function replay<T extends Array<dependency>, K>(fn: (...args: T) => Observable<{
|
|
4
|
+
timestamp: number;
|
|
5
|
+
payload: K;
|
|
6
|
+
}>, dependencies: dependency[]): (...args: T) => Observable<{
|
|
7
|
+
timestamp: number;
|
|
8
|
+
payload: K;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/replay/replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,wBAAgB,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EACnD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,EACjE,YAAY,EAAE,UAAU,EAAE,GACzB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAE/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replay = void 0;
|
|
4
|
+
const with_memo_1 = require("../with-memo");
|
|
5
|
+
const use_replay_1 = require("./use-replay");
|
|
6
|
+
function replay(fn, dependencies) {
|
|
7
|
+
return (0, with_memo_1.withMemo)((...args) => (0, use_replay_1.useReplay)(fn(...args), [...dependencies, ...args]));
|
|
8
|
+
}
|
|
9
|
+
exports.replay = replay;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-replay-breakpoint.d.ts","sourceRoot":"","sources":["../../src/replay/use-replay-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,MAAM,MAAM,CAAC;AAO5C,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAqB1E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useReplayBreakpoint = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const use_execution_mode_1 = require("../use-execution-mode");
|
|
6
|
+
const use_logger_1 = require("../use-logger");
|
|
7
|
+
const use_replay_manager_1 = require("./use-replay-manager");
|
|
8
|
+
function useReplayBreakpoint(input) {
|
|
9
|
+
const { isReplay } = (0, use_execution_mode_1.useExecutionMode)();
|
|
10
|
+
if (!isReplay) {
|
|
11
|
+
return input;
|
|
12
|
+
}
|
|
13
|
+
const { info } = (0, use_logger_1.useLogger)('useReplayBreakpoint');
|
|
14
|
+
const { stop, tryContinue } = (0, use_replay_manager_1.useReplayManager)();
|
|
15
|
+
info('locking resource...');
|
|
16
|
+
stop();
|
|
17
|
+
return input.pipe((0, rxjs_1.finalize)(() => {
|
|
18
|
+
info('unlocking resource');
|
|
19
|
+
tryContinue();
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
exports.useReplayBreakpoint = useReplayBreakpoint;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { dependency } from '../use-hash';
|
|
3
|
+
export declare const useReplayManager: () => {
|
|
4
|
+
timestamp(): number;
|
|
5
|
+
stop(): void;
|
|
6
|
+
tryContinue: () => void;
|
|
7
|
+
when<T>(dependencies: dependency[]): Observable<{
|
|
8
|
+
timestamp: number;
|
|
9
|
+
payload: T;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=use-replay-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-replay-manager.d.ts","sourceRoot":"","sources":["../../src/replay/use-replay-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAW,MAAM,MAAM,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAOpD,eAAO,MAAM,gBAAgB;;;;0BA8EH,UAAU,EAAE;mBAA2B,MAAM;;;CAkBrE,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useReplayManager = void 0;
|
|
13
|
+
const rxjs_1 = require("rxjs");
|
|
14
|
+
const use_hash_1 = require("../use-hash");
|
|
15
|
+
const use_logger_1 = require("../use-logger");
|
|
16
|
+
const with_memo_1 = require("../with-memo");
|
|
17
|
+
const use_replay_options_1 = require("./use-replay-options");
|
|
18
|
+
const use_replay_storage_buffer_1 = require("./use-replay-storage-buffer");
|
|
19
|
+
exports.useReplayManager = (0, with_memo_1.withMemo)(() => {
|
|
20
|
+
const { from, to } = (0, use_replay_options_1.useReplayOptions)();
|
|
21
|
+
const { info } = (0, use_logger_1.useLogger)('useReplayManager');
|
|
22
|
+
let timestamp = from;
|
|
23
|
+
let stopAcquire = 1;
|
|
24
|
+
const subscriptions = Array.of();
|
|
25
|
+
const stream$ = new rxjs_1.Subject();
|
|
26
|
+
const getNextStorage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
let next;
|
|
28
|
+
for (const cursor of subscriptions) {
|
|
29
|
+
if (cursor.size() == 0 && !cursor.completed()) {
|
|
30
|
+
yield cursor.fetchNextPage(timestamp, to + 1);
|
|
31
|
+
}
|
|
32
|
+
if (cursor.peek()) {
|
|
33
|
+
if (!next || next.peek().timestamp > cursor.peek().timestamp) {
|
|
34
|
+
next = cursor;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return next;
|
|
39
|
+
});
|
|
40
|
+
const processNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const cursor = yield getNextStorage();
|
|
42
|
+
if (!cursor || !cursor.peek()) {
|
|
43
|
+
stream$.complete();
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const sample = cursor.dequeue();
|
|
47
|
+
timestamp = sample.timestamp;
|
|
48
|
+
stream$.next([cursor, sample]);
|
|
49
|
+
return true;
|
|
50
|
+
});
|
|
51
|
+
const next = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
if (yield processNext()) {
|
|
53
|
+
if (stopAcquire === 0) {
|
|
54
|
+
setImmediate(next);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const tryContinue = () => {
|
|
59
|
+
if (stopAcquire == 0) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
stopAcquire = Math.max(0, stopAcquire - 1);
|
|
63
|
+
if (stopAcquire != 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
next();
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
timestamp() {
|
|
70
|
+
return timestamp;
|
|
71
|
+
},
|
|
72
|
+
stop() {
|
|
73
|
+
stopAcquire++;
|
|
74
|
+
},
|
|
75
|
+
tryContinue,
|
|
76
|
+
when(dependencies) {
|
|
77
|
+
const storage = (0, use_replay_storage_buffer_1.useReplayStorageBuffer)(dependencies);
|
|
78
|
+
if (!subscriptions.includes(storage)) {
|
|
79
|
+
info('subscribing to replay', (0, use_hash_1.useHash)(dependencies));
|
|
80
|
+
subscriptions.push(storage);
|
|
81
|
+
}
|
|
82
|
+
return (0, rxjs_1.defer)(() => {
|
|
83
|
+
tryContinue();
|
|
84
|
+
return stream$.pipe((0, rxjs_1.filter)(([cur]) => cur === storage), (0, rxjs_1.map)(([, it]) => ({ timestamp: it.timestamp, payload: it.payload })));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { dependency } from '../use-hash';
|
|
2
|
+
export declare const useReplayStorageBuffer: <T>(dependencies: dependency[]) => {
|
|
3
|
+
size(): number;
|
|
4
|
+
peek(): {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
payload: T;
|
|
7
|
+
};
|
|
8
|
+
dequeue(): {
|
|
9
|
+
timestamp: number;
|
|
10
|
+
payload: T;
|
|
11
|
+
};
|
|
12
|
+
completed(): boolean;
|
|
13
|
+
fetchNextPage(from: number, to: number): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-replay-storage-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-replay-storage-buffer.d.ts","sourceRoot":"","sources":["../../src/replay/use-replay-storage-buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,eAAO,MAAM,sBAAsB;;;mBAGC,MAAM;;;;mBAAN,MAAM;;;;wBAiBZ,MAAM,MAAM,MAAM;CAgB9C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useReplayStorageBuffer = void 0;
|
|
13
|
+
const storage_1 = require("../storage");
|
|
14
|
+
const with_memo_1 = require("../with-memo");
|
|
15
|
+
const use_replay_storage_1 = require("./use-replay-storage");
|
|
16
|
+
exports.useReplayStorageBuffer = (0, with_memo_1.withMemo)((dependencies) => {
|
|
17
|
+
const { query } = (0, use_replay_storage_1.useReplayStorage)(dependencies);
|
|
18
|
+
let page = new Array();
|
|
19
|
+
let index = 0;
|
|
20
|
+
let completed = false;
|
|
21
|
+
return {
|
|
22
|
+
size() {
|
|
23
|
+
return page.length - index;
|
|
24
|
+
},
|
|
25
|
+
peek() {
|
|
26
|
+
return page[index];
|
|
27
|
+
},
|
|
28
|
+
dequeue() {
|
|
29
|
+
return page[index++];
|
|
30
|
+
},
|
|
31
|
+
completed() {
|
|
32
|
+
return completed;
|
|
33
|
+
},
|
|
34
|
+
fetchNextPage(from, to) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
if (completed) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
index = 0;
|
|
40
|
+
page = yield query({
|
|
41
|
+
where: {
|
|
42
|
+
timestamp: (0, storage_1.between)(from, to)
|
|
43
|
+
},
|
|
44
|
+
limit: 10000
|
|
45
|
+
});
|
|
46
|
+
completed = page.length == 0;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
});
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
timestamp:
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import { Query, QueryObject } from '../storage';
|
|
2
|
+
import { dependency } from '../use-hash';
|
|
3
|
+
export declare function useReplayStorage<T>(dependencies: dependency[]): {
|
|
4
|
+
query(query: Query<QueryObject>): Promise<{
|
|
5
|
+
timestamp: number;
|
|
6
|
+
payload: T;
|
|
7
|
+
}[]>;
|
|
8
|
+
save(objects: {
|
|
9
|
+
timestamp: number;
|
|
10
|
+
payload: T;
|
|
11
|
+
}[]): Promise<void>;
|
|
8
12
|
};
|
|
9
|
-
export declare function useReplayStorage(): Storage;
|
|
10
13
|
//# sourceMappingURL=use-replay-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-replay-storage.d.ts","sourceRoot":"","sources":["../../src/replay/use-replay-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-replay-storage.d.ts","sourceRoot":"","sources":["../../src/replay/use-replay-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAEpD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE;iBASvC,MAAM,WAAW,CAAC;;;;kBAMvB;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC,CAAA;KAAE,EAAE;EAUpD"}
|