@tradejs/node 3.1.4 → 3.1.6

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.
@@ -576,6 +576,23 @@ var resolveInstalledPackageVersion = async (projectRoot, packageName, manifest)
576
576
  return null;
577
577
  }
578
578
  };
579
+ var resolveStrategyPackageName = async ({
580
+ pluginSource,
581
+ projectRoot
582
+ }) => {
583
+ if (!pluginSource) return null;
584
+ if (!pluginSource.startsWith(".") && !import_node_path.default.isAbsolute(pluginSource)) {
585
+ return pluginSource;
586
+ }
587
+ try {
588
+ const packageJson = JSON.parse(
589
+ await (0, import_promises.readFile)(import_node_path.default.join(projectRoot, "package.json"), "utf8")
590
+ );
591
+ return typeof packageJson.name === "string" && packageJson.name.trim() ? packageJson.name : null;
592
+ } catch {
593
+ return null;
594
+ }
595
+ };
579
596
  var validateReleaseRuntimeCompatibility = async ({
580
597
  release,
581
598
  projectRoot,
@@ -613,7 +630,10 @@ var resolveAccountId = async ({
613
630
  provider: deployment.provider,
614
631
  universe
615
632
  });
616
- return account?.id ?? deployment.accountId;
633
+ if (!account) {
634
+ throw new Error(`Trading account not found: ${deployment.accountId}`);
635
+ }
636
+ return account.id;
617
637
  };
618
638
  var loadVersionedRuntimeStrategies = async ({
619
639
  userName,
@@ -716,7 +736,11 @@ var getRuntimeStrategyPackageMetadata = async ({
716
736
  projectRoot
717
737
  }) => {
718
738
  const packageManifest = await readPackageManifest(projectRoot);
719
- const strategyPackage = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
739
+ const pluginSource = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
740
+ const strategyPackage = await resolveStrategyPackageName({
741
+ pluginSource,
742
+ projectRoot
743
+ });
720
744
  return {
721
745
  strategyPackage,
722
746
  strategyPackageVersion: await resolveInstalledPackageVersion(
@@ -43,6 +43,23 @@ var resolveInstalledPackageVersion = async (projectRoot, packageName, manifest)
43
43
  return null;
44
44
  }
45
45
  };
46
+ var resolveStrategyPackageName = async ({
47
+ pluginSource,
48
+ projectRoot
49
+ }) => {
50
+ if (!pluginSource) return null;
51
+ if (!pluginSource.startsWith(".") && !path.isAbsolute(pluginSource)) {
52
+ return pluginSource;
53
+ }
54
+ try {
55
+ const packageJson = JSON.parse(
56
+ await readFile(path.join(projectRoot, "package.json"), "utf8")
57
+ );
58
+ return typeof packageJson.name === "string" && packageJson.name.trim() ? packageJson.name : null;
59
+ } catch {
60
+ return null;
61
+ }
62
+ };
46
63
  var validateReleaseRuntimeCompatibility = async ({
47
64
  release,
48
65
  projectRoot,
@@ -80,7 +97,10 @@ var resolveAccountId = async ({
80
97
  provider: deployment.provider,
81
98
  universe
82
99
  });
83
- return account?.id ?? deployment.accountId;
100
+ if (!account) {
101
+ throw new Error(`Trading account not found: ${deployment.accountId}`);
102
+ }
103
+ return account.id;
84
104
  };
85
105
  var loadVersionedRuntimeStrategies = async ({
86
106
  userName,
@@ -183,7 +203,11 @@ var getRuntimeStrategyPackageMetadata = async ({
183
203
  projectRoot
184
204
  }) => {
185
205
  const packageManifest = await readPackageManifest(projectRoot);
186
- const strategyPackage = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
206
+ const pluginSource = await getStrategyPluginSource(strategyName, projectRoot) ?? null;
207
+ const strategyPackage = await resolveStrategyPackageName({
208
+ pluginSource,
209
+ projectRoot
210
+ });
187
211
  return {
188
212
  strategyPackage,
189
213
  strategyPackageVersion: await resolveInstalledPackageVersion(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/node",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "Node-only runtime for the TradeJS TypeScript framework: strategies, backtests, Pine strategy loading, and plugin registries.",
5
5
  "keywords": [
6
6
  "tradejs",
@@ -85,9 +85,9 @@
85
85
  "dependencies": {
86
86
  "@langchain/core": "^1.2.3",
87
87
  "@langchain/openai": "^1.5.5",
88
- "@tradejs/core": "^3.1.4",
89
- "@tradejs/infra": "^3.1.4",
90
- "@tradejs/types": "^3.1.4",
88
+ "@tradejs/core": "^3.1.6",
89
+ "@tradejs/infra": "^3.1.6",
90
+ "@tradejs/types": "^3.1.6",
91
91
  "chalk": "4.1.2",
92
92
  "ioredis": "5.11.1",
93
93
  "lodash": "^4.18.1",