@quantform/core 0.7.26 → 0.7.28
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/use-execution-mode.d.ts +0 -2
- package/lib/use-execution-mode.d.ts.map +1 -1
- package/lib/use-execution-mode.js +0 -5
- package/lib/use-timestamp.d.ts.map +1 -1
- package/lib/use-timestamp.js +4 -1
- package/package.json +1 -1
- package/src/use-execution-mode.ts +1 -7
- package/src/use-timestamp.ts +6 -1
|
@@ -3,7 +3,6 @@ export declare function useExecutionMode(): {
|
|
|
3
3
|
isReplay: boolean;
|
|
4
4
|
isPaper: boolean;
|
|
5
5
|
isLive: boolean;
|
|
6
|
-
isIdle: boolean;
|
|
7
6
|
isSimulation: boolean;
|
|
8
7
|
recording: boolean;
|
|
9
8
|
};
|
|
@@ -15,6 +14,5 @@ export declare namespace useExecutionMode {
|
|
|
15
14
|
var liveOptions: (options: {
|
|
16
15
|
recording: boolean;
|
|
17
16
|
}) => Dependency;
|
|
18
|
-
var idleOptions: () => Dependency;
|
|
19
17
|
}
|
|
20
18
|
//# sourceMappingURL=use-execution-mode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-execution-mode.d.ts","sourceRoot":"","sources":["../src/use-execution-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AASrD,wBAAgB,gBAAgB
|
|
1
|
+
{"version":3,"file":"use-execution-mode.d.ts","sourceRoot":"","sources":["../src/use-execution-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AASrD,wBAAgB,gBAAgB;;;;;;EAU/B;yBAVe,gBAAgB"}
|
|
@@ -9,7 +9,6 @@ function useExecutionMode() {
|
|
|
9
9
|
isReplay: mode === 'replay',
|
|
10
10
|
isPaper: mode === 'paper',
|
|
11
11
|
isLive: mode === 'live',
|
|
12
|
-
isIdle: mode === 'idle',
|
|
13
12
|
isSimulation: mode !== 'live',
|
|
14
13
|
recording
|
|
15
14
|
};
|
|
@@ -27,7 +26,3 @@ useExecutionMode.liveOptions = (options) => ({
|
|
|
27
26
|
provide: injectionToken,
|
|
28
27
|
useValue: { mode: 'live', ...options }
|
|
29
28
|
});
|
|
30
|
-
useExecutionMode.idleOptions = () => ({
|
|
31
|
-
provide: injectionToken,
|
|
32
|
-
useValue: { mode: 'idle', recording: false }
|
|
33
|
-
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-timestamp.d.ts","sourceRoot":"","sources":["../src/use-timestamp.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;AAE5C,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI,MAAM,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"use-timestamp.d.ts","sourceRoot":"","sources":["../src/use-timestamp.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;AAE5C,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI,MAAM,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC;AAKjE,wBAAgB,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAIrC;AAED,eAAO,MAAM,EAAE,UAAW,MAAM,GAAG,MAAM,KAAG,UAAU,IAAI,CACxB,CAAC;AACnC,eAAO,MAAM,EAAE,UAAW,MAAM,GAAG,MAAM,KAAG,UAAU,IAAI,CACxB,CAAC;AACnC,eAAO,MAAM,EAAE,UAAW,MAAM,GAAG,MAAM,KAAG,UAAU,IAAI,CACxB,CAAC;AACnC,eAAO,MAAM,CAAC,UAAW,MAAM,GAAG,MAAM,KAAG,UAAU,GAAG,CACvB,CAAC;AASlC,wBAAgB,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,EACpD,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EACnB,IAAI,EAAE,CAAC,EACP,EAAE,EAAE,CAAC,GACJ,SAAS,CAAC,CAAC,CAAC,CAId;AAED,wBAAgB,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAElF;AAED,wBAAgB,YAAY,IAAI;IAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;CAAE,CAQ7D"}
|
package/lib/use-timestamp.js
CHANGED
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useTimestamp = exports.add = exports.convert = exports.s = exports.ms = exports.us = exports.ns = exports.now = void 0;
|
|
4
4
|
const use_execution_mode_1 = require("./use-execution-mode");
|
|
5
5
|
const replay_1 = require("./replay");
|
|
6
|
+
const baseMs = Date.now();
|
|
7
|
+
const baseHr = process.hrtime.bigint();
|
|
6
8
|
function now() {
|
|
7
|
-
|
|
9
|
+
const offset = process.hrtime.bigint() - baseHr;
|
|
10
|
+
return (BigInt(baseMs) * 1000000n + offset);
|
|
8
11
|
}
|
|
9
12
|
exports.now = now;
|
|
10
13
|
const ns = (value) => BigInt(value);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { Dependency, useContext } from '@lib/module';
|
|
|
3
3
|
const injectionToken = Symbol('execution-mode');
|
|
4
4
|
|
|
5
5
|
type ExecutionMode = {
|
|
6
|
-
mode: 'replay' | 'paper' | 'live'
|
|
6
|
+
mode: 'replay' | 'paper' | 'live';
|
|
7
7
|
recording: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -14,7 +14,6 @@ export function useExecutionMode() {
|
|
|
14
14
|
isReplay: mode === 'replay',
|
|
15
15
|
isPaper: mode === 'paper',
|
|
16
16
|
isLive: mode === 'live',
|
|
17
|
-
isIdle: mode === 'idle',
|
|
18
17
|
isSimulation: mode !== 'live',
|
|
19
18
|
recording
|
|
20
19
|
};
|
|
@@ -34,8 +33,3 @@ useExecutionMode.liveOptions = (options: { recording: boolean }): Dependency =>
|
|
|
34
33
|
provide: injectionToken,
|
|
35
34
|
useValue: { mode: 'live', ...options } as ExecutionMode
|
|
36
35
|
});
|
|
37
|
-
|
|
38
|
-
useExecutionMode.idleOptions = (): Dependency => ({
|
|
39
|
-
provide: injectionToken,
|
|
40
|
-
useValue: { mode: 'idle', recording: false } as ExecutionMode
|
|
41
|
-
});
|
package/src/use-timestamp.ts
CHANGED
|
@@ -6,8 +6,13 @@ export type Unit = 'ns' | 'us' | 'ms' | 's';
|
|
|
6
6
|
|
|
7
7
|
export type Timestamp<Unit> = bigint & { readonly __unit: Unit };
|
|
8
8
|
|
|
9
|
+
const baseMs = Date.now();
|
|
10
|
+
const baseHr = process.hrtime.bigint();
|
|
11
|
+
|
|
9
12
|
export function now(): Timestamp<'ns'> {
|
|
10
|
-
|
|
13
|
+
const offset = process.hrtime.bigint() - baseHr;
|
|
14
|
+
|
|
15
|
+
return (BigInt(baseMs) * 1_000_000n + offset) as Timestamp<'ns'>;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
export const ns = (value: bigint | number): Timestamp<'ns'> =>
|