@luxalgo/vela-pinets 0.2.4 → 0.2.5
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 +9 -0
- package/dist/index.cjs +335 -61
- package/dist/index.d.cts +60 -2
- package/dist/index.d.ts +60 -2
- package/dist/index.js +337 -63
- package/dist/vela-pinets.global.js +3800 -3416
- package/dist/vela-pinets.global.min.js +28 -27
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
import { ScriptingEngine, EngineCapabilities, PreparedScript, ExecutionRequest, ExecutionHandlers, ExecutionSession } from '@luxalgo/vela/plugin';
|
|
1
|
+
import { ScriptingEngine, EngineCapabilities, InputValue, PreparedScript, ExecutionRequest, ExecutionHandlers, ExecutionSession } from '@luxalgo/vela/plugin';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Which scripts publish a declaration-props schema (the settings dialog's
|
|
5
|
+
* "Properties" tab): every script, only `strategy()` scripts, or none.
|
|
6
|
+
* Presentation-only — hidden props keep their source/spec values at run time,
|
|
7
|
+
* and programmatic `setProps` overrides still apply.
|
|
8
|
+
*/
|
|
9
|
+
type PropsVisibility = 'all' | 'strategy' | 'none';
|
|
10
|
+
/**
|
|
11
|
+
* What the engines' `props` option accepts: a visibility mode, or an explicit
|
|
12
|
+
* WHITELIST of prop keys — only those entries are published, in the LIST's
|
|
13
|
+
* order, so the host controls both the subset and the layout of the Properties
|
|
14
|
+
* tab. A script owning none of the whitelisted keys (e.g. an `indicator()`
|
|
15
|
+
* under a strategy-only list) publishes no schema and gets no tab at all.
|
|
16
|
+
*/
|
|
17
|
+
type PropsFilter = PropsVisibility | readonly string[];
|
|
18
|
+
|
|
19
|
+
/** Options for {@link PineEngine}. */
|
|
20
|
+
interface PineEngineOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Host-level defaults for declaration props (`initial_capital`, `precision`, …),
|
|
23
|
+
* applied BENEATH source-declared values: a script that declares the prop keeps
|
|
24
|
+
* its own value; a script that omits it gets the host's default instead of the
|
|
25
|
+
* Pine spec one. Folded into the props schema's `defval`s at prepare, so the
|
|
26
|
+
* settings dialog opens on them and "Reset defaults" restores them.
|
|
27
|
+
*/
|
|
28
|
+
defaultProps?: Record<string, InputValue>;
|
|
29
|
+
/**
|
|
30
|
+
* Which scripts publish the declaration-props schema (drives whether the
|
|
31
|
+
* settings dialog shows a "Properties" tab): `'all'` (default) every script,
|
|
32
|
+
* `'strategy'` only `strategy()` scripts, `'none'` no script — or an explicit
|
|
33
|
+
* WHITELIST of prop keys, published in the list's order (a script owning none
|
|
34
|
+
* of the listed keys gets no tab). Presentation-only: hidden props keep their
|
|
35
|
+
* source/spec values, and `setProps` still applies.
|
|
36
|
+
*/
|
|
37
|
+
props?: PropsFilter;
|
|
38
|
+
}
|
|
3
39
|
/**
|
|
4
40
|
* The in-process PineTS implementation of `ScriptingEngine`. Both the static run
|
|
5
41
|
* and the live stream go through the shared `runtime` — the same code the
|
|
@@ -10,6 +46,9 @@ import { ScriptingEngine, EngineCapabilities, PreparedScript, ExecutionRequest,
|
|
|
10
46
|
declare class PineEngine implements ScriptingEngine {
|
|
11
47
|
readonly language = "pine";
|
|
12
48
|
readonly capabilities: EngineCapabilities;
|
|
49
|
+
private readonly defaultProps;
|
|
50
|
+
private readonly propsVisibility;
|
|
51
|
+
constructor(opts?: PineEngineOptions);
|
|
13
52
|
prepare(source: string, instanceId: string): Promise<PreparedScript>;
|
|
14
53
|
execute(req: ExecutionRequest, handlers: ExecutionHandlers): ExecutionSession;
|
|
15
54
|
}
|
|
@@ -32,6 +71,23 @@ interface PineWorkerOptions {
|
|
|
32
71
|
workerUrl?: string;
|
|
33
72
|
/** Worker factory — tests inject a fake; defaults to the inlined Blob worker. */
|
|
34
73
|
createWorker?: () => WorkerLike;
|
|
74
|
+
/**
|
|
75
|
+
* Host-level defaults for declaration props (`initial_capital`, `precision`, …),
|
|
76
|
+
* applied BENEATH source-declared values: a script that declares the prop keeps
|
|
77
|
+
* its own value; a script that omits it gets the host's default instead of the
|
|
78
|
+
* Pine spec one. Folded into the props schema's `defval`s at prepare, so the
|
|
79
|
+
* settings dialog opens on them and "Reset defaults" restores them.
|
|
80
|
+
*/
|
|
81
|
+
defaultProps?: Record<string, InputValue>;
|
|
82
|
+
/**
|
|
83
|
+
* Which scripts publish the declaration-props schema (drives whether the
|
|
84
|
+
* settings dialog shows a "Properties" tab): `'all'` (default) every script,
|
|
85
|
+
* `'strategy'` only `strategy()` scripts, `'none'` no script — or an explicit
|
|
86
|
+
* WHITELIST of prop keys, published in the list's order (a script owning none
|
|
87
|
+
* of the listed keys gets no tab). Presentation-only: hidden props keep their
|
|
88
|
+
* source/spec values, and `setProps` still applies.
|
|
89
|
+
*/
|
|
90
|
+
props?: PropsFilter;
|
|
35
91
|
}
|
|
36
92
|
/**
|
|
37
93
|
* A worker-backed PineTS engine: identical Pine semantics to `PineEngine`, but the
|
|
@@ -52,6 +108,8 @@ declare class PineWorkerEngine implements ScriptingEngine {
|
|
|
52
108
|
readonly capabilities: EngineCapabilities;
|
|
53
109
|
private worker;
|
|
54
110
|
private readonly spawn;
|
|
111
|
+
private readonly defaultProps;
|
|
112
|
+
private readonly propsVisibility;
|
|
55
113
|
private readonly prepares;
|
|
56
114
|
private readonly sessions;
|
|
57
115
|
private reqId;
|
|
@@ -90,4 +148,4 @@ declare class PineWorkerEngine implements ScriptingEngine {
|
|
|
90
148
|
private serveFetch;
|
|
91
149
|
}
|
|
92
150
|
|
|
93
|
-
export { PineEngine, PineWorkerEngine, type PineWorkerOptions };
|
|
151
|
+
export { PineEngine, type PineEngineOptions, PineWorkerEngine, type PineWorkerOptions, type PropsFilter, type PropsVisibility };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
import { ScriptingEngine, EngineCapabilities, PreparedScript, ExecutionRequest, ExecutionHandlers, ExecutionSession } from '@luxalgo/vela/plugin';
|
|
1
|
+
import { ScriptingEngine, EngineCapabilities, InputValue, PreparedScript, ExecutionRequest, ExecutionHandlers, ExecutionSession } from '@luxalgo/vela/plugin';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Which scripts publish a declaration-props schema (the settings dialog's
|
|
5
|
+
* "Properties" tab): every script, only `strategy()` scripts, or none.
|
|
6
|
+
* Presentation-only — hidden props keep their source/spec values at run time,
|
|
7
|
+
* and programmatic `setProps` overrides still apply.
|
|
8
|
+
*/
|
|
9
|
+
type PropsVisibility = 'all' | 'strategy' | 'none';
|
|
10
|
+
/**
|
|
11
|
+
* What the engines' `props` option accepts: a visibility mode, or an explicit
|
|
12
|
+
* WHITELIST of prop keys — only those entries are published, in the LIST's
|
|
13
|
+
* order, so the host controls both the subset and the layout of the Properties
|
|
14
|
+
* tab. A script owning none of the whitelisted keys (e.g. an `indicator()`
|
|
15
|
+
* under a strategy-only list) publishes no schema and gets no tab at all.
|
|
16
|
+
*/
|
|
17
|
+
type PropsFilter = PropsVisibility | readonly string[];
|
|
18
|
+
|
|
19
|
+
/** Options for {@link PineEngine}. */
|
|
20
|
+
interface PineEngineOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Host-level defaults for declaration props (`initial_capital`, `precision`, …),
|
|
23
|
+
* applied BENEATH source-declared values: a script that declares the prop keeps
|
|
24
|
+
* its own value; a script that omits it gets the host's default instead of the
|
|
25
|
+
* Pine spec one. Folded into the props schema's `defval`s at prepare, so the
|
|
26
|
+
* settings dialog opens on them and "Reset defaults" restores them.
|
|
27
|
+
*/
|
|
28
|
+
defaultProps?: Record<string, InputValue>;
|
|
29
|
+
/**
|
|
30
|
+
* Which scripts publish the declaration-props schema (drives whether the
|
|
31
|
+
* settings dialog shows a "Properties" tab): `'all'` (default) every script,
|
|
32
|
+
* `'strategy'` only `strategy()` scripts, `'none'` no script — or an explicit
|
|
33
|
+
* WHITELIST of prop keys, published in the list's order (a script owning none
|
|
34
|
+
* of the listed keys gets no tab). Presentation-only: hidden props keep their
|
|
35
|
+
* source/spec values, and `setProps` still applies.
|
|
36
|
+
*/
|
|
37
|
+
props?: PropsFilter;
|
|
38
|
+
}
|
|
3
39
|
/**
|
|
4
40
|
* The in-process PineTS implementation of `ScriptingEngine`. Both the static run
|
|
5
41
|
* and the live stream go through the shared `runtime` — the same code the
|
|
@@ -10,6 +46,9 @@ import { ScriptingEngine, EngineCapabilities, PreparedScript, ExecutionRequest,
|
|
|
10
46
|
declare class PineEngine implements ScriptingEngine {
|
|
11
47
|
readonly language = "pine";
|
|
12
48
|
readonly capabilities: EngineCapabilities;
|
|
49
|
+
private readonly defaultProps;
|
|
50
|
+
private readonly propsVisibility;
|
|
51
|
+
constructor(opts?: PineEngineOptions);
|
|
13
52
|
prepare(source: string, instanceId: string): Promise<PreparedScript>;
|
|
14
53
|
execute(req: ExecutionRequest, handlers: ExecutionHandlers): ExecutionSession;
|
|
15
54
|
}
|
|
@@ -32,6 +71,23 @@ interface PineWorkerOptions {
|
|
|
32
71
|
workerUrl?: string;
|
|
33
72
|
/** Worker factory — tests inject a fake; defaults to the inlined Blob worker. */
|
|
34
73
|
createWorker?: () => WorkerLike;
|
|
74
|
+
/**
|
|
75
|
+
* Host-level defaults for declaration props (`initial_capital`, `precision`, …),
|
|
76
|
+
* applied BENEATH source-declared values: a script that declares the prop keeps
|
|
77
|
+
* its own value; a script that omits it gets the host's default instead of the
|
|
78
|
+
* Pine spec one. Folded into the props schema's `defval`s at prepare, so the
|
|
79
|
+
* settings dialog opens on them and "Reset defaults" restores them.
|
|
80
|
+
*/
|
|
81
|
+
defaultProps?: Record<string, InputValue>;
|
|
82
|
+
/**
|
|
83
|
+
* Which scripts publish the declaration-props schema (drives whether the
|
|
84
|
+
* settings dialog shows a "Properties" tab): `'all'` (default) every script,
|
|
85
|
+
* `'strategy'` only `strategy()` scripts, `'none'` no script — or an explicit
|
|
86
|
+
* WHITELIST of prop keys, published in the list's order (a script owning none
|
|
87
|
+
* of the listed keys gets no tab). Presentation-only: hidden props keep their
|
|
88
|
+
* source/spec values, and `setProps` still applies.
|
|
89
|
+
*/
|
|
90
|
+
props?: PropsFilter;
|
|
35
91
|
}
|
|
36
92
|
/**
|
|
37
93
|
* A worker-backed PineTS engine: identical Pine semantics to `PineEngine`, but the
|
|
@@ -52,6 +108,8 @@ declare class PineWorkerEngine implements ScriptingEngine {
|
|
|
52
108
|
readonly capabilities: EngineCapabilities;
|
|
53
109
|
private worker;
|
|
54
110
|
private readonly spawn;
|
|
111
|
+
private readonly defaultProps;
|
|
112
|
+
private readonly propsVisibility;
|
|
55
113
|
private readonly prepares;
|
|
56
114
|
private readonly sessions;
|
|
57
115
|
private reqId;
|
|
@@ -90,4 +148,4 @@ declare class PineWorkerEngine implements ScriptingEngine {
|
|
|
90
148
|
private serveFetch;
|
|
91
149
|
}
|
|
92
150
|
|
|
93
|
-
export { PineEngine, PineWorkerEngine, type PineWorkerOptions };
|
|
151
|
+
export { PineEngine, type PineEngineOptions, PineWorkerEngine, type PineWorkerOptions, type PropsFilter, type PropsVisibility };
|