@xbbg/core 1.2.6 → 1.3.0
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 +2 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +216 -73
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ If no packaged addon is available for your platform, build from source locally i
|
|
|
28
28
|
|
|
29
29
|
Using the API requires Bloomberg Terminal, B-PIPE, or ZFP access and Bloomberg SDK runtime libraries available on the target system. Configure Bloomberg connectivity and credentials according to your Bloomberg deployment before making requests.
|
|
30
30
|
|
|
31
|
+
On Windows, `@xbbg/core` prepends the first detected Bloomberg runtime DLL directory before loading the native addon. Explicit `BLPAPI_LIB_DIR` / `BLPAPI_ROOT` values win; otherwise it probes local SDK roots plus standard Terminal DAPI installs including `C:\blp\DAPI` and `C:\Program Files (x86)\Bloomberg\Blp\DAPI`.
|
|
32
|
+
|
|
31
33
|
`@xbbg/core` is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P. or its affiliates. It does not provide Bloomberg access, credentials, entitlements, data rights, or SDK licenses; users must supply and use those under their own Bloomberg agreements and policies.
|
|
32
34
|
|
|
33
35
|
## Release integrity
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ declare class BlpRequestError extends BlpError {
|
|
|
34
34
|
readonly code?: string | number;
|
|
35
35
|
constructor(message: string, options?: BlpRequestErrorOptions);
|
|
36
36
|
}
|
|
37
|
+
declare class BlpLimitError extends BlpRequestError {
|
|
38
|
+
}
|
|
37
39
|
declare class BlpValidationError extends BlpError {
|
|
38
40
|
readonly element?: string;
|
|
39
41
|
readonly suggestion?: string;
|
|
@@ -583,7 +585,16 @@ declare class Subscription implements AsyncIterator<Tick>, AsyncIterable<Tick> {
|
|
|
583
585
|
declare class Engine {
|
|
584
586
|
private inner;
|
|
585
587
|
constructor(host?: string, port?: number);
|
|
588
|
+
/** Allocate an Engine around an already-constructed native engine. */
|
|
589
|
+
private static fromInner;
|
|
586
590
|
static withConfig(config?: EngineConfig): Engine;
|
|
591
|
+
/**
|
|
592
|
+
* Connect asynchronously: the Bloomberg session connect and service warmup
|
|
593
|
+
* run off the JS thread. The sync constructor and `withConfig` block the
|
|
594
|
+
* Node event loop for the duration of the connect (seconds, up to the 30s
|
|
595
|
+
* session timeout) — prefer this factory in servers.
|
|
596
|
+
*/
|
|
597
|
+
static connect(config?: EngineConfig): Promise<Engine>;
|
|
587
598
|
request(params: RequestInput): Promise<unknown>;
|
|
588
599
|
requestRaw(params: RequestInput): Promise<Buffer>;
|
|
589
600
|
bdp(tickers: readonly string[], fields: readonly string[], options?: BdpOptions): Promise<unknown>;
|
|
@@ -735,4 +746,4 @@ declare function version(): string;
|
|
|
735
746
|
declare const setLogLevel: (level: string) => void;
|
|
736
747
|
declare const getLogLevel: () => string;
|
|
737
748
|
|
|
738
|
-
export { type ActiveCdxOptions, ArrowSubscription, type AuthConfig, Backend, type BackendKind, type BdhOptions, type BdibOptions, type BdpOptions, type BdtickOptions, type BeqsOptions, type BfldsOptions, type BlkpOptions, BlpError, BlpInternalError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, CDX_INFO_FIELDS, CDX_PRICING_FIELDS, CDX_RISK_FIELDS, type CdxOptions, type CdxTickerInfo, type CorporateBondsOptions, type DateLike, type DateTimeLike, type DividendOptions, type DividendYieldOptions, Engine, type EngineConfig, type EtfHoldingsOptions, type ExchangeInfoResult, type ExchangeOverrideInput, FieldHandle, type FieldInfo, Format, type FormatKind, type FuturesCandidate, type FuturesCurveOptions, type FuturesResolveOptions, type FxPairInfo, type IndexMembersOptions, type MarketRule, type OverridesMap, type PreferredsOptions, type PrimitiveValue, type RecipeBackendOptions, type RequestInput, type RequestOptions, type ServerAddress, type SessionWindowsInfo, type Socks5Config, type StreamOptions, type StringPair, Subscription, type SubscriptionStats, Tick, type TickValue, type TickerParts, type TimeRange, type TlsConfig, type TurnoverOptions, type VolFieldSpec, type VolSurfaceOptions, type VolSurfacePreset, type YasOptions, abdh, abdib, abdp, abds, abdtick, asubscribe, bdh, bdib, bdp, bds, bdtick, blp, configure, connect, ext, formatDate, formatDateTime, getLogLevel, setLogLevel, subscribe, version, wrapError };
|
|
749
|
+
export { type ActiveCdxOptions, ArrowSubscription, type AuthConfig, Backend, type BackendKind, type BdhOptions, type BdibOptions, type BdpOptions, type BdtickOptions, type BeqsOptions, type BfldsOptions, type BlkpOptions, BlpError, BlpInternalError, BlpLimitError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, CDX_INFO_FIELDS, CDX_PRICING_FIELDS, CDX_RISK_FIELDS, type CdxOptions, type CdxTickerInfo, type CorporateBondsOptions, type DateLike, type DateTimeLike, type DividendOptions, type DividendYieldOptions, Engine, type EngineConfig, type EtfHoldingsOptions, type ExchangeInfoResult, type ExchangeOverrideInput, FieldHandle, type FieldInfo, Format, type FormatKind, type FuturesCandidate, type FuturesCurveOptions, type FuturesResolveOptions, type FxPairInfo, type IndexMembersOptions, type MarketRule, type OverridesMap, type PreferredsOptions, type PrimitiveValue, type RecipeBackendOptions, type RequestInput, type RequestOptions, type ServerAddress, type SessionWindowsInfo, type Socks5Config, type StreamOptions, type StringPair, Subscription, type SubscriptionStats, Tick, type TickValue, type TickerParts, type TimeRange, type TlsConfig, type TurnoverOptions, type VolFieldSpec, type VolSurfaceOptions, type VolSurfacePreset, type YasOptions, abdh, abdib, abdp, abds, abdtick, asubscribe, bdh, bdib, bdp, bds, bdtick, blp, configure, connect, ext, formatDate, formatDateTime, getLogLevel, setLogLevel, subscribe, version, wrapError };
|
package/dist/index.js
CHANGED
|
@@ -463,6 +463,8 @@ var BlpRequestError = class extends BlpError {
|
|
|
463
463
|
this.code = options.code;
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
|
+
var BlpLimitError = class extends BlpRequestError {
|
|
467
|
+
};
|
|
466
468
|
var BlpValidationError = class extends BlpError {
|
|
467
469
|
element;
|
|
468
470
|
suggestion;
|
|
@@ -476,11 +478,37 @@ var BlpTimeoutError = class extends BlpError {
|
|
|
476
478
|
};
|
|
477
479
|
var BlpInternalError = class extends BlpError {
|
|
478
480
|
};
|
|
481
|
+
var CODE_PREFIX = /^\[XBBG:([A-Z]+)\]\s*/u;
|
|
482
|
+
function fromCode(code, msg) {
|
|
483
|
+
switch (code) {
|
|
484
|
+
case "SESSION":
|
|
485
|
+
return new BlpSessionError(msg);
|
|
486
|
+
case "REQUEST":
|
|
487
|
+
return new BlpRequestError(msg, parseRequestOptions(msg));
|
|
488
|
+
case "LIMIT":
|
|
489
|
+
return new BlpLimitError(msg, parseRequestOptions(msg));
|
|
490
|
+
case "VALIDATION":
|
|
491
|
+
return new BlpValidationError(msg, parseValidationOptions(msg));
|
|
492
|
+
case "TIMEOUT":
|
|
493
|
+
return new BlpTimeoutError(msg);
|
|
494
|
+
case "CANCELLED":
|
|
495
|
+
case "INTERNAL":
|
|
496
|
+
return new BlpInternalError(msg);
|
|
497
|
+
default:
|
|
498
|
+
return new BlpError(msg);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
479
501
|
function wrapError(napiError) {
|
|
480
502
|
if (napiError instanceof BlpError) {
|
|
481
503
|
return napiError;
|
|
482
504
|
}
|
|
483
505
|
const msg = napiError instanceof Error ? napiError.message : typeof napiError === "string" ? napiError : "";
|
|
506
|
+
const codeMatch = CODE_PREFIX.exec(msg);
|
|
507
|
+
const nativeCode = codeMatch?.[1];
|
|
508
|
+
const matchedPrefix = codeMatch?.[0];
|
|
509
|
+
if (nativeCode !== void 0 && matchedPrefix !== void 0) {
|
|
510
|
+
return fromCode(nativeCode, msg.slice(matchedPrefix.length));
|
|
511
|
+
}
|
|
484
512
|
if (msg.includes("Session start failed") || msg.includes("session start failed") || msg.includes("Failed to start session") || msg.includes("Failed to open service") || msg.includes("failed to spawn worker") || msg.includes("connect event failed")) {
|
|
485
513
|
return new BlpSessionError(msg);
|
|
486
514
|
}
|
|
@@ -665,53 +693,71 @@ function resolveNativeAddon(repoRoot) {
|
|
|
665
693
|
}
|
|
666
694
|
return resolveNativeAddonCore({ exists, nativePackage, repoRoot, requirePackage });
|
|
667
695
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
696
|
+
var BLPAPI_RUNTIME_NAMES = Object.freeze([
|
|
697
|
+
"blpapi3_64.dll",
|
|
698
|
+
"blpapi3_32.dll",
|
|
699
|
+
"libblpapi3.dylib",
|
|
700
|
+
"libblpapi3_64.so",
|
|
701
|
+
"libblpapi3.so"
|
|
702
|
+
]);
|
|
703
|
+
var WINDOWS_PATH_SEPARATOR = ";";
|
|
704
|
+
var readDirectory = (target) => fs2__default.default.readdirSync(target, { withFileTypes: true });
|
|
705
|
+
function windowsPathKey(value) {
|
|
706
|
+
return path2__default.default.win32.normalize(value).toLowerCase();
|
|
676
707
|
}
|
|
677
|
-
function
|
|
678
|
-
return
|
|
708
|
+
function candidateKey(value, platform) {
|
|
709
|
+
return platform === "win32" ? windowsPathKey(value) : path2__default.default.resolve(value);
|
|
679
710
|
}
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
return loaded;
|
|
711
|
+
function pushUnique(candidates, seen, candidate, platform) {
|
|
712
|
+
if (candidate === void 0 || candidate.length === 0) {
|
|
713
|
+
return;
|
|
684
714
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
return isPlainObject(value) && typeof value.readIPC === "function";
|
|
689
|
-
}
|
|
690
|
-
function requirePolarsModule() {
|
|
691
|
-
const loaded = nodeRequire2("nodejs-polars");
|
|
692
|
-
if (isPolarsModule(loaded)) {
|
|
693
|
-
return loaded;
|
|
715
|
+
const key = candidateKey(candidate, platform);
|
|
716
|
+
if (seen.has(key)) {
|
|
717
|
+
return;
|
|
694
718
|
}
|
|
695
|
-
|
|
719
|
+
seen.add(key);
|
|
720
|
+
candidates.push(candidate);
|
|
696
721
|
}
|
|
697
|
-
function
|
|
698
|
-
|
|
722
|
+
function windowsDrive(value) {
|
|
723
|
+
if (value !== void 0 && /^[A-Za-z]:/u.test(value)) {
|
|
724
|
+
return value.slice(0, 2);
|
|
725
|
+
}
|
|
726
|
+
return "C:";
|
|
699
727
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
728
|
+
function collectWindowsDapiRootCandidates(env = process.env) {
|
|
729
|
+
const candidates = [];
|
|
730
|
+
const seen = /* @__PURE__ */ new Set();
|
|
731
|
+
const add = (candidate) => {
|
|
732
|
+
pushUnique(candidates, seen, candidate, "win32");
|
|
733
|
+
};
|
|
734
|
+
const systemDrive = windowsDrive(env.SystemDrive);
|
|
735
|
+
const systemDriveRoot = `${systemDrive}\\`;
|
|
736
|
+
add(path2__default.default.win32.join(systemDriveRoot, "blp", "DAPI"));
|
|
737
|
+
if (systemDrive.toLowerCase() !== "c:") {
|
|
738
|
+
add(path2__default.default.win32.join("C:\\", "blp", "DAPI"));
|
|
739
|
+
}
|
|
740
|
+
const programFilesRoots = [
|
|
741
|
+
env.ProgramFiles,
|
|
742
|
+
path2__default.default.win32.join(systemDriveRoot, "Program Files"),
|
|
743
|
+
env["ProgramFiles(x86)"],
|
|
744
|
+
path2__default.default.win32.join(systemDriveRoot, "Program Files (x86)")
|
|
745
|
+
];
|
|
746
|
+
for (const root of programFilesRoots) {
|
|
747
|
+
add(root === void 0 ? void 0 : path2__default.default.win32.join(root, "Bloomberg", "Blp", "DAPI"));
|
|
748
|
+
}
|
|
749
|
+
const localAppData = env.LOCALAPPDATA ?? (env.USERPROFILE === void 0 ? void 0 : path2__default.default.win32.join(env.USERPROFILE, "AppData", "Local"));
|
|
750
|
+
if (localAppData !== void 0) {
|
|
751
|
+
add(path2__default.default.win32.join(localAppData, "Bloomberg", "DAPI"));
|
|
752
|
+
add(path2__default.default.win32.join(localAppData, "Bloomberg", "Blp", "DAPI"));
|
|
753
|
+
}
|
|
754
|
+
return candidates;
|
|
702
755
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if (dir.length === 0 || !fs2__default.default.existsSync(dir)) {
|
|
756
|
+
function containsBlpapiRuntime(dir, exists2 = fs2__default.default.existsSync) {
|
|
757
|
+
if (dir.length === 0) {
|
|
706
758
|
return false;
|
|
707
759
|
}
|
|
708
|
-
return
|
|
709
|
-
"blpapi3_64.dll",
|
|
710
|
-
"blpapi3_32.dll",
|
|
711
|
-
"libblpapi3.dylib",
|
|
712
|
-
"libblpapi3_64.so",
|
|
713
|
-
"libblpapi3.so"
|
|
714
|
-
].some((name) => fs2__default.default.existsSync(path2__default.default.join(dir, name)));
|
|
760
|
+
return BLPAPI_RUNTIME_NAMES.some((name) => exists2(path2__default.default.join(dir, name)));
|
|
715
761
|
}
|
|
716
762
|
function parseVersionParts(name) {
|
|
717
763
|
const parts = name.split(".").map((part) => Number(part));
|
|
@@ -740,62 +786,141 @@ function compareSdkRoots(left, right) {
|
|
|
740
786
|
}
|
|
741
787
|
function pushSdkRuntimeCandidates(candidates, sdkRoot) {
|
|
742
788
|
const resolved = path2__default.default.resolve(sdkRoot);
|
|
743
|
-
candidates.push(
|
|
789
|
+
candidates.push(
|
|
790
|
+
resolved,
|
|
791
|
+
path2__default.default.join(resolved, "bin"),
|
|
792
|
+
path2__default.default.join(resolved, "lib"),
|
|
793
|
+
path2__default.default.join(resolved, "Lib"),
|
|
794
|
+
path2__default.default.join(resolved, "lib", "win64"),
|
|
795
|
+
path2__default.default.join(resolved, "lib", "win32")
|
|
796
|
+
);
|
|
744
797
|
}
|
|
745
|
-
function
|
|
798
|
+
function addSdkRuntimeRoot(add, sdkRoot) {
|
|
799
|
+
const sdkCandidates = [];
|
|
800
|
+
pushSdkRuntimeCandidates(sdkCandidates, sdkRoot);
|
|
801
|
+
for (const candidate of sdkCandidates) {
|
|
802
|
+
add(candidate);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function resolveVendorSdkRoot(repoRoot, exists2 = fs2__default.default.existsSync, readDir = readDirectory) {
|
|
746
806
|
const vendorDir = path2__default.default.join(repoRoot, "vendor", "blpapi-sdk");
|
|
747
|
-
if (!
|
|
807
|
+
if (!exists2(vendorDir)) {
|
|
748
808
|
return null;
|
|
749
809
|
}
|
|
750
810
|
const candidates = [vendorDir];
|
|
751
|
-
for (const entry of
|
|
811
|
+
for (const entry of readDir(vendorDir)) {
|
|
752
812
|
if (entry.isDirectory()) {
|
|
753
813
|
candidates.push(path2__default.default.join(vendorDir, entry.name));
|
|
754
814
|
}
|
|
755
815
|
}
|
|
756
816
|
candidates.sort(compareSdkRoots);
|
|
757
817
|
return candidates.find((candidate) => {
|
|
758
|
-
const dirs = [
|
|
759
|
-
|
|
818
|
+
const dirs = [
|
|
819
|
+
candidate,
|
|
820
|
+
path2__default.default.join(candidate, "bin"),
|
|
821
|
+
path2__default.default.join(candidate, "lib"),
|
|
822
|
+
path2__default.default.join(candidate, "Lib")
|
|
823
|
+
];
|
|
824
|
+
return dirs.some((dir) => containsBlpapiRuntime(dir, exists2));
|
|
760
825
|
}) ?? null;
|
|
761
826
|
}
|
|
762
|
-
function
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
827
|
+
function collectRuntimeSearchCandidates(options = {}) {
|
|
828
|
+
const env = options.env ?? process.env;
|
|
829
|
+
const exists2 = options.exists ?? fs2__default.default.existsSync;
|
|
830
|
+
const platform = options.platform ?? process.platform;
|
|
831
|
+
const readDir = options.readDir ?? readDirectory;
|
|
832
|
+
const repoRoot = options.repoRoot ?? path2__default.default.resolve(__dirname, "..", "..");
|
|
766
833
|
const candidates = [];
|
|
767
|
-
const
|
|
834
|
+
const seen = /* @__PURE__ */ new Set();
|
|
835
|
+
const add = (candidate) => {
|
|
836
|
+
pushUnique(candidates, seen, candidate, platform);
|
|
837
|
+
};
|
|
838
|
+
const libDir = env.BLPAPI_LIB_DIR;
|
|
768
839
|
if (libDir !== void 0 && libDir.length > 0) {
|
|
769
|
-
|
|
840
|
+
add(path2__default.default.resolve(libDir));
|
|
770
841
|
}
|
|
771
|
-
const root =
|
|
842
|
+
const root = env.BLPAPI_ROOT;
|
|
772
843
|
if (root !== void 0 && root.length > 0) {
|
|
773
|
-
|
|
844
|
+
addSdkRuntimeRoot(add, root);
|
|
774
845
|
}
|
|
775
|
-
const
|
|
776
|
-
const devRoot = process.env.XBBG_DEV_SDK_ROOT;
|
|
846
|
+
const devRoot = env.XBBG_DEV_SDK_ROOT;
|
|
777
847
|
if (devRoot !== void 0 && devRoot.length > 0) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
path2__default.default.isAbsolute(devRoot) ? devRoot : path2__default.default.resolve(repoRoot, devRoot)
|
|
781
|
-
);
|
|
848
|
+
const resolved = path2__default.default.isAbsolute(devRoot) ? devRoot : path2__default.default.resolve(repoRoot, devRoot);
|
|
849
|
+
addSdkRuntimeRoot(add, resolved);
|
|
782
850
|
}
|
|
783
|
-
const vendorRoot = resolveVendorSdkRoot(repoRoot);
|
|
851
|
+
const vendorRoot = resolveVendorSdkRoot(repoRoot, exists2, readDir);
|
|
784
852
|
if (vendorRoot !== null) {
|
|
785
|
-
|
|
853
|
+
addSdkRuntimeRoot(add, vendorRoot);
|
|
786
854
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
855
|
+
if (platform === "win32") {
|
|
856
|
+
for (const dapiRoot of collectWindowsDapiRootCandidates(env)) {
|
|
857
|
+
add(dapiRoot);
|
|
790
858
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
859
|
+
}
|
|
860
|
+
return candidates;
|
|
861
|
+
}
|
|
862
|
+
function prependWindowsPath(env, candidate) {
|
|
863
|
+
const key = Object.keys(env).find((envKey) => envKey.toUpperCase() === "PATH") ?? "PATH";
|
|
864
|
+
const currentPath = env[key] ?? "";
|
|
865
|
+
const currentParts = currentPath.split(WINDOWS_PATH_SEPARATOR).filter((part) => part.length > 0);
|
|
866
|
+
const candidatePathKey = windowsPathKey(candidate);
|
|
867
|
+
if (currentParts.some((part) => windowsPathKey(part) === candidatePathKey)) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
env[key] = currentPath.length > 0 ? `${candidate}${WINDOWS_PATH_SEPARATOR}${currentPath}` : candidate;
|
|
871
|
+
}
|
|
872
|
+
function configureRuntimeSearchPath(options = {}) {
|
|
873
|
+
const env = options.env ?? process.env;
|
|
874
|
+
const exists2 = options.exists ?? fs2__default.default.existsSync;
|
|
875
|
+
const platform = options.platform ?? process.platform;
|
|
876
|
+
if (platform !== "win32") {
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
879
|
+
for (const candidate of collectRuntimeSearchCandidates(options)) {
|
|
880
|
+
if (!containsBlpapiRuntime(candidate, exists2)) {
|
|
881
|
+
continue;
|
|
795
882
|
}
|
|
796
|
-
|
|
883
|
+
prependWindowsPath(env, candidate);
|
|
884
|
+
return candidate;
|
|
885
|
+
}
|
|
886
|
+
return null;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// src/index.ts
|
|
890
|
+
var nodeRequire2 = module$1.createRequire(__filename);
|
|
891
|
+
function parsePackageJsonShape(value) {
|
|
892
|
+
if (isPlainObject(value) && typeof value.version === "string") {
|
|
893
|
+
return { version: value.version };
|
|
894
|
+
}
|
|
895
|
+
throw new TypeError("@xbbg/core package.json is missing a string version field");
|
|
896
|
+
}
|
|
897
|
+
function isNativeAddon(value) {
|
|
898
|
+
return isPlainObject(value) && typeof value.JsEngine === "function" && typeof value.getLogLevel === "function" && typeof value.setLogLevel === "function";
|
|
899
|
+
}
|
|
900
|
+
function requireNativeAddon(modulePath) {
|
|
901
|
+
const loaded = nodeRequire2(modulePath);
|
|
902
|
+
if (isNativeAddon(loaded)) {
|
|
903
|
+
return loaded;
|
|
797
904
|
}
|
|
905
|
+
throw new TypeError(`Native addon ${modulePath} does not expose the expected @xbbg/core surface`);
|
|
906
|
+
}
|
|
907
|
+
function isPolarsModule(value) {
|
|
908
|
+
return isPlainObject(value) && typeof value.readIPC === "function";
|
|
909
|
+
}
|
|
910
|
+
function requirePolarsModule() {
|
|
911
|
+
const loaded = nodeRequire2("nodejs-polars");
|
|
912
|
+
if (isPolarsModule(loaded)) {
|
|
913
|
+
return loaded;
|
|
914
|
+
}
|
|
915
|
+
throw new TypeError("nodejs-polars did not expose readIPC(buffer)");
|
|
916
|
+
}
|
|
917
|
+
function isBdhOptionsInput(value) {
|
|
918
|
+
return isPlainObject(value) && !(value instanceof Date) && !hasToJSDate(value);
|
|
919
|
+
}
|
|
920
|
+
function isBdibOptionsInput(value) {
|
|
921
|
+
return isPlainObject(value) && !(value instanceof Date) && !hasToJSDate(value);
|
|
798
922
|
}
|
|
923
|
+
var packageJson = parsePackageJsonShape(nodeRequire2("../package.json"));
|
|
799
924
|
configureRuntimeSearchPath();
|
|
800
925
|
function loadNative() {
|
|
801
926
|
const root = path2__default.default.resolve(__dirname, "..", "..");
|
|
@@ -1461,18 +1586,35 @@ var Engine = class _Engine {
|
|
|
1461
1586
|
throw wrapError(error);
|
|
1462
1587
|
}
|
|
1463
1588
|
}
|
|
1464
|
-
|
|
1589
|
+
/** Allocate an Engine around an already-constructed native engine. */
|
|
1590
|
+
static fromInner(inner) {
|
|
1465
1591
|
const maybeEngine = Object.create(_Engine.prototype);
|
|
1466
1592
|
if (!(maybeEngine instanceof _Engine)) {
|
|
1467
1593
|
throw new TypeError("Failed to allocate Engine instance");
|
|
1468
1594
|
}
|
|
1469
|
-
|
|
1595
|
+
maybeEngine.inner = inner;
|
|
1596
|
+
return maybeEngine;
|
|
1597
|
+
}
|
|
1598
|
+
static withConfig(config = {}) {
|
|
1599
|
+
try {
|
|
1600
|
+
return _Engine.fromInner(native.JsEngine.withConfig(config));
|
|
1601
|
+
} catch (error) {
|
|
1602
|
+
throw wrapError(error);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Connect asynchronously: the Bloomberg session connect and service warmup
|
|
1607
|
+
* run off the JS thread. The sync constructor and `withConfig` block the
|
|
1608
|
+
* Node event loop for the duration of the connect (seconds, up to the 30s
|
|
1609
|
+
* session timeout) — prefer this factory in servers.
|
|
1610
|
+
*/
|
|
1611
|
+
static async connect(config) {
|
|
1470
1612
|
try {
|
|
1471
|
-
|
|
1613
|
+
const inner = config === void 0 ? await native.JsEngine.connect() : await native.JsEngine.connectWithConfig(config);
|
|
1614
|
+
return _Engine.fromInner(inner);
|
|
1472
1615
|
} catch (error) {
|
|
1473
1616
|
throw wrapError(error);
|
|
1474
1617
|
}
|
|
1475
|
-
return engine;
|
|
1476
1618
|
}
|
|
1477
1619
|
async request(params) {
|
|
1478
1620
|
const backend = normalizeBackend(params.backend);
|
|
@@ -2113,7 +2255,7 @@ var Engine = class _Engine {
|
|
|
2113
2255
|
}
|
|
2114
2256
|
};
|
|
2115
2257
|
async function connect(config) {
|
|
2116
|
-
return await
|
|
2258
|
+
return await Engine.connect(config);
|
|
2117
2259
|
}
|
|
2118
2260
|
function configure(configOrHost, port) {
|
|
2119
2261
|
configuredEngineConfig = normalizeConfigureArgs(configOrHost, port);
|
|
@@ -2285,6 +2427,7 @@ exports.ArrowSubscription = ArrowSubscription;
|
|
|
2285
2427
|
exports.Backend = Backend;
|
|
2286
2428
|
exports.BlpError = BlpError;
|
|
2287
2429
|
exports.BlpInternalError = BlpInternalError;
|
|
2430
|
+
exports.BlpLimitError = BlpLimitError;
|
|
2288
2431
|
exports.BlpRequestError = BlpRequestError;
|
|
2289
2432
|
exports.BlpSessionError = BlpSessionError;
|
|
2290
2433
|
exports.BlpTimeoutError = BlpTimeoutError;
|