@steerprotocol/app-loader 3.0.1 → 3.0.2
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/README.md +36 -6
- package/lib/Candle.d.ts +46 -0
- package/lib/RawTradeData.d.ts +15 -0
- package/lib/WasmModule.d.ts +30 -0
- package/lib/{node.d.mts → browser.d.ts} +7 -9
- package/lib/browser.mjs.map +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +4 -6
- package/lib/index.mjs.map +1 -1
- package/lib/internal/instantiate.d.ts +20 -0
- package/lib/node.cjs.map +1 -1
- package/lib/node.d.ts +4 -6
- package/lib/node.mjs.map +1 -1
- package/lib/testUtils/wasmFixture.d.ts +12 -0
- package/lib/timestring.d.ts +19 -0
- package/package.json +4 -4
- package/lib/WasmModule-D9evRq1D.d.mts +0 -74
- package/lib/WasmModule-D9evRq1D.d.ts +0 -74
- package/lib/index.d.mts +0 -24
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for parsing duration strings into numeric values.
|
|
3
|
+
*/
|
|
4
|
+
interface TimestringOptions {
|
|
5
|
+
hoursPerDay?: number;
|
|
6
|
+
daysPerWeek?: number;
|
|
7
|
+
weeksPerMonth?: number;
|
|
8
|
+
monthsPerYear?: number;
|
|
9
|
+
daysPerYear?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parses a timestring into seconds or another requested unit.
|
|
13
|
+
* @param value - Duration string or numeric millisecond value.
|
|
14
|
+
* @param returnUnit - Optional unit to convert the parsed result into.
|
|
15
|
+
* @param opts - Calendar conversion overrides.
|
|
16
|
+
* @returns The parsed duration in seconds or the requested unit.
|
|
17
|
+
*/
|
|
18
|
+
export default function parseTimestring(value: string | number, returnUnit?: string, opts?: TimestringOptions): number;
|
|
19
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerprotocol/app-loader",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "App Loader for Steer Protocol",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"default": "./lib/index.mjs"
|
|
18
18
|
},
|
|
19
19
|
"./browser": {
|
|
20
|
-
"types": "./lib/browser.d.
|
|
20
|
+
"types": "./lib/browser.d.ts",
|
|
21
21
|
"import": "./lib/browser.mjs",
|
|
22
22
|
"default": "./lib/browser.mjs"
|
|
23
23
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsup",
|
|
35
|
+
"build": "tsup && tsc -p tsconfig.types.json",
|
|
36
36
|
"format": "prettier --write \"src/**/*.(js|ts)\"",
|
|
37
37
|
"lint": "eslint src --ext .js,.ts",
|
|
38
38
|
"lint:fix": "eslint src --fix --ext .js,.ts",
|
|
39
39
|
"test": "jest --config jest.config.js",
|
|
40
40
|
"test:consumers": "node scripts/test-consumers.mjs",
|
|
41
41
|
"prepare": "npm run build",
|
|
42
|
-
"prepublishOnly": "npm test && npm run lint",
|
|
42
|
+
"prepublishOnly": "npm test && npm run lint && npm run test:consumers",
|
|
43
43
|
"preversion": "npm run lint",
|
|
44
44
|
"version": "npm run format && git add -A src",
|
|
45
45
|
"postversion": "git push && git push --tags"
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trade point model used as candle-generation input.
|
|
3
|
-
*/
|
|
4
|
-
declare class RawTradeData {
|
|
5
|
-
timestamp: number;
|
|
6
|
-
price: number;
|
|
7
|
-
volume: number;
|
|
8
|
-
/**
|
|
9
|
-
* Creates a raw trade data point.
|
|
10
|
-
* @param timestamp - Trade timestamp.
|
|
11
|
-
* @param price - Trade price.
|
|
12
|
-
* @param volume - Trade volume.
|
|
13
|
-
*/
|
|
14
|
-
constructor(timestamp: number, price: number, volume: number);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* OHLCV candle model.
|
|
19
|
-
*/
|
|
20
|
-
declare class Candle {
|
|
21
|
-
timestamp: number;
|
|
22
|
-
high: number;
|
|
23
|
-
low: number;
|
|
24
|
-
open: number;
|
|
25
|
-
close: number;
|
|
26
|
-
volume: number;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a candle instance.
|
|
29
|
-
* @param timestamp - Candle open timestamp in milliseconds.
|
|
30
|
-
* @param high - Highest traded price.
|
|
31
|
-
* @param low - Lowest traded price.
|
|
32
|
-
* @param open - Opening price.
|
|
33
|
-
* @param close - Closing price.
|
|
34
|
-
* @param volume - Total traded volume.
|
|
35
|
-
*/
|
|
36
|
-
constructor(timestamp: number, high: number, low: number, open: number, close: number, volume: number);
|
|
37
|
-
/**
|
|
38
|
-
* Serializes the candle as JSON.
|
|
39
|
-
* @returns The candle as a JSON string.
|
|
40
|
-
*/
|
|
41
|
-
toString(): string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Type declarations for the wasm exports surfaced by this package.
|
|
46
|
-
*/
|
|
47
|
-
declare function responseHandler(body: ArrayBuffer, statusCode: number, redirected: number, callbackID: number): void;
|
|
48
|
-
declare function initialize(config: string): boolean;
|
|
49
|
-
declare function config(): string;
|
|
50
|
-
declare function version(): number;
|
|
51
|
-
declare function transform(): string;
|
|
52
|
-
declare function execute(...params: Array<number | string | ArrayBuffer | null>): Promise<string | null>;
|
|
53
|
-
declare function __new(size: number, id: number): number;
|
|
54
|
-
declare function __pin(ptr: number): number;
|
|
55
|
-
declare function __unpin(ptr: number): number;
|
|
56
|
-
declare function reset(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Public shape of the wrapped wasm exports.
|
|
59
|
-
*/
|
|
60
|
-
type WasmModule = {
|
|
61
|
-
responseHandler: typeof responseHandler;
|
|
62
|
-
initialize: typeof initialize;
|
|
63
|
-
execute: typeof execute;
|
|
64
|
-
config: typeof config;
|
|
65
|
-
version: typeof version;
|
|
66
|
-
transform: typeof transform;
|
|
67
|
-
memory: WebAssembly.Memory;
|
|
68
|
-
__new: typeof __new;
|
|
69
|
-
__pin: typeof __pin;
|
|
70
|
-
__unpin: typeof __unpin;
|
|
71
|
-
reset: typeof reset;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export { Candle as C, RawTradeData as R, type WasmModule as W };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trade point model used as candle-generation input.
|
|
3
|
-
*/
|
|
4
|
-
declare class RawTradeData {
|
|
5
|
-
timestamp: number;
|
|
6
|
-
price: number;
|
|
7
|
-
volume: number;
|
|
8
|
-
/**
|
|
9
|
-
* Creates a raw trade data point.
|
|
10
|
-
* @param timestamp - Trade timestamp.
|
|
11
|
-
* @param price - Trade price.
|
|
12
|
-
* @param volume - Trade volume.
|
|
13
|
-
*/
|
|
14
|
-
constructor(timestamp: number, price: number, volume: number);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* OHLCV candle model.
|
|
19
|
-
*/
|
|
20
|
-
declare class Candle {
|
|
21
|
-
timestamp: number;
|
|
22
|
-
high: number;
|
|
23
|
-
low: number;
|
|
24
|
-
open: number;
|
|
25
|
-
close: number;
|
|
26
|
-
volume: number;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a candle instance.
|
|
29
|
-
* @param timestamp - Candle open timestamp in milliseconds.
|
|
30
|
-
* @param high - Highest traded price.
|
|
31
|
-
* @param low - Lowest traded price.
|
|
32
|
-
* @param open - Opening price.
|
|
33
|
-
* @param close - Closing price.
|
|
34
|
-
* @param volume - Total traded volume.
|
|
35
|
-
*/
|
|
36
|
-
constructor(timestamp: number, high: number, low: number, open: number, close: number, volume: number);
|
|
37
|
-
/**
|
|
38
|
-
* Serializes the candle as JSON.
|
|
39
|
-
* @returns The candle as a JSON string.
|
|
40
|
-
*/
|
|
41
|
-
toString(): string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Type declarations for the wasm exports surfaced by this package.
|
|
46
|
-
*/
|
|
47
|
-
declare function responseHandler(body: ArrayBuffer, statusCode: number, redirected: number, callbackID: number): void;
|
|
48
|
-
declare function initialize(config: string): boolean;
|
|
49
|
-
declare function config(): string;
|
|
50
|
-
declare function version(): number;
|
|
51
|
-
declare function transform(): string;
|
|
52
|
-
declare function execute(...params: Array<number | string | ArrayBuffer | null>): Promise<string | null>;
|
|
53
|
-
declare function __new(size: number, id: number): number;
|
|
54
|
-
declare function __pin(ptr: number): number;
|
|
55
|
-
declare function __unpin(ptr: number): number;
|
|
56
|
-
declare function reset(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Public shape of the wrapped wasm exports.
|
|
59
|
-
*/
|
|
60
|
-
type WasmModule = {
|
|
61
|
-
responseHandler: typeof responseHandler;
|
|
62
|
-
initialize: typeof initialize;
|
|
63
|
-
execute: typeof execute;
|
|
64
|
-
config: typeof config;
|
|
65
|
-
version: typeof version;
|
|
66
|
-
transform: typeof transform;
|
|
67
|
-
memory: WebAssembly.Memory;
|
|
68
|
-
__new: typeof __new;
|
|
69
|
-
__pin: typeof __pin;
|
|
70
|
-
__unpin: typeof __unpin;
|
|
71
|
-
reset: typeof reset;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export { Candle as C, RawTradeData as R, type WasmModule as W };
|
package/lib/index.d.mts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { W as WasmModule } from './WasmModule-D9evRq1D.mjs';
|
|
2
|
-
export { C as Candle, R as RawTradeData } from './WasmModule-D9evRq1D.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Runtime-agnostic entrypoints for loading Steer wasm bundles.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Load a wasm bundle synchronously. Only accepts the actual binary data.
|
|
10
|
-
* @param input - Wasm bundle data
|
|
11
|
-
* @param imports - Imports
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
declare function loadWasmSync(input: ArrayBuffer, imports?: {}): WasmModule;
|
|
15
|
-
/**
|
|
16
|
-
* Load a wasm bundle asynchronously. Accepts the actual binary data or a runtime-specific string source.
|
|
17
|
-
* In browsers, string inputs are treated as URLs. In Node.js, string inputs may be URLs or filesystem paths.
|
|
18
|
-
* @param input - Wasm bundle data, URL, or filesystem path
|
|
19
|
-
* @param imports - Imports
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
declare function loadWasm(input: string | ArrayBuffer, imports?: {}): Promise<WasmModule>;
|
|
23
|
-
|
|
24
|
-
export { WasmModule, loadWasm, loadWasmSync };
|