@xbbg/core 1.1.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 +145 -0
- package/errors.js +160 -0
- package/index.d.ts +792 -0
- package/index.js +1427 -0
- package/lib/platform-map.js +14 -0
- package/lib/resolve-native.js +49 -0
- package/package.json +58 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const platformPackages = {
|
|
2
|
+
'darwin-arm64': '@xbbg/core-darwin-arm64',
|
|
3
|
+
'linux-x64': '@xbbg/core-linux-x64',
|
|
4
|
+
'win32-x64': '@xbbg/core-win32-x64',
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
function platformKey(platform = process.platform, arch = process.arch) {
|
|
8
|
+
return `${platform}-${arch}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
platformKey,
|
|
13
|
+
platformPackages,
|
|
14
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const fs = require('node:fs');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { platformKey, platformPackages } = require('./platform-map');
|
|
4
|
+
|
|
5
|
+
function exists(target) {
|
|
6
|
+
try {
|
|
7
|
+
fs.accessSync(target);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function requireLocalPackage(repoRoot, packageName) {
|
|
15
|
+
const dirName = packageName.replace('@xbbg/', 'xbbg-');
|
|
16
|
+
const localIndex = path.join(repoRoot, 'packages', dirName, 'index.js');
|
|
17
|
+
if (!exists(localIndex)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return require(localIndex);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resolveNativeAddon(repoRoot) {
|
|
24
|
+
const key = platformKey();
|
|
25
|
+
const packageName = platformPackages[key];
|
|
26
|
+
if (!packageName) {
|
|
27
|
+
return { key, packageName: null, binaryPath: null };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const resolved = require(packageName);
|
|
32
|
+
if (resolved?.binaryPath && exists(resolved.binaryPath)) {
|
|
33
|
+
return { key, packageName, binaryPath: resolved.binaryPath };
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
// Ignore and try local workspace fallback.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const local = requireLocalPackage(repoRoot, packageName);
|
|
40
|
+
if (local?.binaryPath && exists(local.binaryPath)) {
|
|
41
|
+
return { key, packageName, binaryPath: local.binaryPath };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return { key, packageName, binaryPath: null };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
resolveNativeAddon,
|
|
49
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xbbg/core",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Bloomberg data API for Node.js powered by Rust xbbg engine",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"errors.js",
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"index.js",
|
|
11
|
+
"lib",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "node ./scripts/build-native.js",
|
|
16
|
+
"stage:native-package": "node ./scripts/stage-native-package.js",
|
|
17
|
+
"stamp:version": "node ./scripts/stamp-version.js",
|
|
18
|
+
"smoke:packaged-install": "node ./scripts/smoke-packaged-install.js",
|
|
19
|
+
"lint": "biome check .",
|
|
20
|
+
"format": "biome check --write .",
|
|
21
|
+
"test": "node ./test.js",
|
|
22
|
+
"test:live": "node --test --test-timeout=120000 ./test-live.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"bloomberg",
|
|
26
|
+
"finance",
|
|
27
|
+
"market-data",
|
|
28
|
+
"arrow"
|
|
29
|
+
],
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"apache-arrow": "^21.1.0"
|
|
33
|
+
},
|
|
34
|
+
"optionalDependencies": {
|
|
35
|
+
"@xbbg/core-darwin-arm64": "1.1.2",
|
|
36
|
+
"@xbbg/core-linux-x64": "1.1.2",
|
|
37
|
+
"@xbbg/core-win32-x64": "1.1.2"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@biomejs/biome": "2.2.4"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"nodejs-polars": ">=0.10.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"nodejs-polars": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "https://github.com/alpha-xone/xbbg.git",
|
|
53
|
+
"directory": "js-xbbg"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=18"
|
|
57
|
+
}
|
|
58
|
+
}
|