@c9up/eon 0.2.7 → 0.2.9
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/dist/EonProvider.d.ts +11 -0
- package/dist/EonProvider.d.ts.map +1 -1
- package/dist/EonProvider.js +15 -0
- package/dist/EonProvider.js.map +1 -1
- package/dist/augmentations.d.ts +29 -0
- package/dist/augmentations.d.ts.map +1 -0
- package/dist/augmentations.js +18 -0
- package/dist/augmentations.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/query/native.d.ts.map +1 -1
- package/dist/query/native.js +11 -27
- package/dist/query/native.js.map +1 -1
- package/dist/vendor/nativeBinary.d.ts +43 -0
- package/dist/vendor/nativeBinary.d.ts.map +1 -0
- package/dist/vendor/nativeBinary.js +99 -0
- package/dist/vendor/nativeBinary.js.map +1 -0
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +10 -4
- package/scripts/build-napi-types.mjs +4 -3
- package/scripts/generate-napi-types.mjs +9 -6
- package/src/EonProvider.ts +26 -0
- package/src/augmentations.ts +32 -0
- package/src/index.ts +2 -0
- package/src/query/native.ts +18 -31
- package/src/vendor/nativeBinary.ts +110 -0
package/dist/EonProvider.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* never imports `@c9up/ream`. Any context exposing `config.get(key)` and
|
|
12
12
|
* `container.singleton(token, factory)` satisfies the contract.
|
|
13
13
|
*/
|
|
14
|
+
import "./augmentations.js";
|
|
14
15
|
import type { EonConnectionConfig } from "./connection/config.js";
|
|
15
16
|
import type { EonConnection } from "./connection/EonConnection.js";
|
|
16
17
|
import { type CompiledStatement, type EonDialect } from "./query/native.js";
|
|
@@ -33,6 +34,16 @@ export interface EonAppContext {
|
|
|
33
34
|
config: {
|
|
34
35
|
get<T = unknown>(key: string): T | undefined;
|
|
35
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Optional reader — present on ream's real application.
|
|
39
|
+
*
|
|
40
|
+
* `'warmup'` means the application was assembled to be INSPECTED rather than
|
|
41
|
+
* run: a route listing, a codegen pass, a config dump. Providers register,
|
|
42
|
+
* boot and start on that path too, so anything that opens a socket or
|
|
43
|
+
* creates a database has to ask first. A host that does not implement it is
|
|
44
|
+
* treated as running.
|
|
45
|
+
*/
|
|
46
|
+
getMode?(): string;
|
|
36
47
|
}
|
|
37
48
|
/**
|
|
38
49
|
* The transport-independent compiler service registered under `eon.compiler`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EonProvider.d.ts","sourceRoot":"","sources":["../src/EonProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAa,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,UAAU,EACf,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,SAAS,EAAE;QACV,SAAS,CACR,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,EAC5D,OAAO,EAAE,MAAM,OAAO,GACpB,IAAI,CAAC;QACR;;;;WAIG;QACH,OAAO,CAAC,CACP,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,GAC1D,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE;QAAE,GAAG,CAAC,CAAC,GAAG,OAAO,E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5B,qBAAa,WAAW;;gBAQX,GAAG,EAAE,aAAa,EAAE,OAAO,GAAE,YAA2B;IAKpE,QAAQ,IAAI,IAAI;IAOV,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA6IrB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAgF/B;AAID,eAAe,WAAW,CAAC"}
|
package/dist/EonProvider.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* never imports `@c9up/ream`. Any context exposing `config.get(key)` and
|
|
12
12
|
* `container.singleton(token, factory)` satisfies the contract.
|
|
13
13
|
*/
|
|
14
|
+
import "./augmentations.js";
|
|
14
15
|
import { ensureDatabase } from "./connection/ensureDatabase.js";
|
|
15
16
|
import { connectWsEon } from "./connection/websocket.js";
|
|
16
17
|
import { compileStatementNative, } from "./query/native.js";
|
|
@@ -26,7 +27,15 @@ export class EonProvider {
|
|
|
26
27
|
this.#connect = connect;
|
|
27
28
|
}
|
|
28
29
|
register() { }
|
|
30
|
+
/** True when the application was assembled to be inspected rather than run. */
|
|
31
|
+
#isInspecting() {
|
|
32
|
+
return this.#app.getMode?.() === "warmup";
|
|
33
|
+
}
|
|
29
34
|
async boot() {
|
|
35
|
+
// An inspection opens no WebSocket and creates no database. `warmUp()`
|
|
36
|
+
// runs boot, so a route listing reached TDengine — and could CREATE a
|
|
37
|
+
// database there — while `shutdown()` never fires on that path, leaving
|
|
38
|
+
// the sockets open. The compiler binding below is pure and stays.
|
|
30
39
|
if (this.#booted) {
|
|
31
40
|
throw new Error("EonProvider: boot() has already opened connections; a second boot would overwrite and leak them. Call shutdown() first, or construct a new provider.");
|
|
32
41
|
}
|
|
@@ -35,6 +44,12 @@ export class EonProvider {
|
|
|
35
44
|
compile: (spec, dialect) => compileStatementNative(spec, dialect),
|
|
36
45
|
};
|
|
37
46
|
this.#app.container.singleton("eon.compiler", () => service);
|
|
47
|
+
// Everything past here opens a socket or creates a database, so an
|
|
48
|
+
// inspection stops at the compiler. `warmUp()` runs boot, so a route
|
|
49
|
+
// listing reached TDengine — and could CREATE a database there — while
|
|
50
|
+
// `shutdown()` never fires on that path, leaving the sockets open.
|
|
51
|
+
if (this.#isInspecting())
|
|
52
|
+
return;
|
|
38
53
|
const config = this.#app.config.get("timeseries") ??
|
|
39
54
|
this.#app.config.get("eon");
|
|
40
55
|
if (!config)
|
package/dist/EonProvider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EonProvider.js","sourceRoot":"","sources":["../src/EonProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"EonProvider.js","sourceRoot":"","sources":["../src/EonProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAEN,sBAAsB,GAEtB,MAAM,mBAAmB,CAAC;AAoD3B,MAAM,OAAO,WAAW;IACd,IAAI,CAAgB;IACpB,QAAQ,CAAe;IAChC,4DAA4D;IACnD,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IACzD,kFAAkF;IAClF,OAAO,GAAG,KAAK,CAAC;IAEhB,YAAY,GAAkB,EAAE,UAAwB,YAAY;QACnE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,KAAU,CAAC;IAEnB,+EAA+E;IAC/E,aAAa;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,QAAQ,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,IAAI;QACT,uEAAuE;QACvE,sEAAsE;QACtE,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAA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ings` what `container.make(...)` returns for the
|
|
3
|
+
* tokens eon binds.
|
|
4
|
+
*
|
|
5
|
+
* ream declares that interface open on purpose: it registers its own entries
|
|
6
|
+
* and expects each package to contribute the ones it owns. Nothing filled
|
|
7
|
+
* these in, so resolving by the string token answered `unknown` and every call
|
|
8
|
+
* site had to assert a type it could not prove.
|
|
9
|
+
*
|
|
10
|
+
* Loaded from the package barrel and from the provider, so registering eon is
|
|
11
|
+
* enough — nobody writes a `declare module` of their own.
|
|
12
|
+
*
|
|
13
|
+
* Type-only, and ream stays an OPTIONAL peer: nothing here reaches a runtime
|
|
14
|
+
* import, and a `declare module` for a specifier that does not resolve is
|
|
15
|
+
* simply inert.
|
|
16
|
+
*/
|
|
17
|
+
import type { EonConnection } from "./connection/EonConnection.js";
|
|
18
|
+
import type { EonService } from "./EonProvider.js";
|
|
19
|
+
declare module "@c9up/ream/types" {
|
|
20
|
+
interface ContainerBindings {
|
|
21
|
+
/** The default connection, bound by `EonProvider`. */
|
|
22
|
+
eon: EonConnection;
|
|
23
|
+
/** The default connection, under the longer name. */
|
|
24
|
+
"eon.connection": EonConnection;
|
|
25
|
+
/** The compiler service, bound by `EonProvider`. */
|
|
26
|
+
"eon.compiler": EonService;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=augmentations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augmentations.d.ts","sourceRoot":"","sources":["../src/augmentations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,QAAQ,kBAAkB,CAAC;IACjC,UAAU,iBAAiB;QAC1B,sDAAsD;QACtD,GAAG,EAAE,aAAa,CAAC;QACnB,qDAAqD;QACrD,gBAAgB,EAAE,aAAa,CAAC;QAChC,oDAAoD;QACpD,cAAc,EAAE,UAAU,CAAC;KAC3B;CACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teach ream's `ContainerBindings` what `container.make(...)` returns for the
|
|
3
|
+
* tokens eon binds.
|
|
4
|
+
*
|
|
5
|
+
* ream declares that interface open on purpose: it registers its own entries
|
|
6
|
+
* and expects each package to contribute the ones it owns. Nothing filled
|
|
7
|
+
* these in, so resolving by the string token answered `unknown` and every call
|
|
8
|
+
* site had to assert a type it could not prove.
|
|
9
|
+
*
|
|
10
|
+
* Loaded from the package barrel and from the provider, so registering eon is
|
|
11
|
+
* enough — nobody writes a `declare module` of their own.
|
|
12
|
+
*
|
|
13
|
+
* Type-only, and ream stays an OPTIONAL peer: nothing here reaches a runtime
|
|
14
|
+
* import, and a `declare module` for a specifier that does not resolve is
|
|
15
|
+
* simply inert.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=augmentations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"augmentations.js","sourceRoot":"","sources":["../src/augmentations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./augmentations.js";
|
|
1
2
|
import "reflect-metadata";
|
|
2
3
|
export { defineConfig, type EonConfig, type EonConnectionConfig, } from "./connection/config.js";
|
|
3
4
|
export { type EonBindKind, type EonBoundColumn, type EonChildBatch, type EonColumnarIngest, type EonConnection, EonConnectionError, type EonLineProtocol, type EonSchemalessOptions, type EonSchemalessPrecision, } from "./connection/EonConnection.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EACN,YAAY,EACZ,KAAK,SAAS,EACd,K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,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EACN,YAAY,GAGZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAMN,kBAAkB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACN,YAAY,EACZ,mBAAmB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,MAAM,EAKN,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,UAAU,EAEV,GAAG,EACH,SAAS,GACT,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACN,kBAAkB,GAElB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,mBAAmB,EAEnB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EAGZ,UAAU,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,sBAAsB,EAEtB,gBAAgB,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EASN,eAAe,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,oBAAoB,GAEpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAgBN,aAAa,GACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,uBAAuB,EACvB,qBAAqB,GAErB,MAAM,qBAAqB,CAAC;A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,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EASN,eAAe,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,oBAAoB,GAEpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAgBN,aAAa,GACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,uBAAuB,EACvB,qBAAqB,GAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,kBAAkB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,kBAAkB,EAElB,iBAAiB,EACjB,SAAS,EACT,aAAa,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAEN,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,gBAAgB,GAIhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/query/native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/query/native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,OAAO,EAAE,CAAC;CAClB;AA0HD;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,UAAuB,GAC9B,iBAAiB,CAKnB;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/dist/query/native.js
CHANGED
|
@@ -7,19 +7,7 @@
|
|
|
7
7
|
* throws a descriptive error naming the attempted path — never a silent `null`.
|
|
8
8
|
*/
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
|
-
import {
|
|
11
|
-
import { dirname, join } from "node:path";
|
|
12
|
-
import { arch, platform } from "node:process";
|
|
13
|
-
import { fileURLToPath } from "node:url";
|
|
14
|
-
const require2 = createRequire(import.meta.url);
|
|
15
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const platformMap = {
|
|
17
|
-
"linux-x64": "linux-x64-gnu",
|
|
18
|
-
"linux-arm64": "linux-arm64-gnu",
|
|
19
|
-
"darwin-x64": "darwin-x64",
|
|
20
|
-
"darwin-arm64": "darwin-arm64",
|
|
21
|
-
"win32-x64": "win32-x64-msvc",
|
|
22
|
-
};
|
|
10
|
+
import { loadNativeBinary, muslHint, supportedTargets, } from "../vendor/nativeBinary.js";
|
|
23
11
|
let native;
|
|
24
12
|
/**
|
|
25
13
|
* Resolve and cache the NAPI binding. Throws a descriptive error on an
|
|
@@ -30,21 +18,17 @@ let native;
|
|
|
30
18
|
function loadNative() {
|
|
31
19
|
if (native)
|
|
32
20
|
return native;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
binding = require2(binaryPath);
|
|
42
|
-
}
|
|
43
|
-
catch (cause) {
|
|
44
|
-
throw new Error(`[E_EON_NAPI_NOT_FOUND] eon-query native binary not found at '${binaryPath}'. Build it with: pnpm --filter @c9up/eon build:napi`, cause !== undefined ? { cause } : undefined);
|
|
21
|
+
// The resolution is shared; the refusal is not. Both codes below are eon's,
|
|
22
|
+
// and a caller branches on them.
|
|
23
|
+
const attempt = loadNativeBinary();
|
|
24
|
+
if (!attempt.loaded) {
|
|
25
|
+
if (attempt.suffix === undefined) {
|
|
26
|
+
throw new Error(`[E_EON_NAPI_UNSUPPORTED] no eon-query native binary for this platform. Supported: ${supportedTargets().join(", ")}.`);
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`[E_EON_NAPI_NOT_FOUND] eon-query native binary 'index.${attempt.suffix}.node' not found or unloadable.${muslHint()} Build it with: pnpm --filter @c9up/eon build:napi`, attempt.cause !== undefined ? { cause: attempt.cause } : undefined);
|
|
45
29
|
}
|
|
46
|
-
native =
|
|
47
|
-
return
|
|
30
|
+
native = attempt.binary;
|
|
31
|
+
return attempt.binary;
|
|
48
32
|
}
|
|
49
33
|
/**
|
|
50
34
|
* i64 / nanosecond-timestamp precision guard for the JSON compile boundary.
|
package/dist/query/native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/query/native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/query/native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AAmBnC,IAAI,MAAiC,CAAC;AAEtC;;;;;GAKG;AACH,SAAS,UAAU;IAClB,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,iCAAiC;IACjC,MAAM,OAAO,GAAG,gBAAgB,EAAiB,CAAC;IAClD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACrB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACd,qFAAqF,gBAAgB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACrH,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CACd,yDAAyD,OAAO,CAAC,MAAM,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B,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,OAAO,UAAU,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every `platform-arch` a binary is built for.
|
|
3
|
+
*
|
|
4
|
+
* For the message a package raises when it refuses: "no binary for
|
|
5
|
+
* linux-riscv64" is only actionable next to the list of what there IS.
|
|
6
|
+
*/
|
|
7
|
+
export declare function supportedTargets(): readonly string[];
|
|
8
|
+
/** The suffix a given `platform-arch` builds under, or `undefined`. */
|
|
9
|
+
export declare function nativeTargetSuffix(target: string): string | undefined;
|
|
10
|
+
/** The suffix for THIS platform, or `undefined` where no binary is built. */
|
|
11
|
+
export declare function nativeBinarySuffix(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Why the binary is not there, phrased for whoever has to fix it.
|
|
14
|
+
*
|
|
15
|
+
* "not found" and "not built for your platform" call for different actions,
|
|
16
|
+
* and a single "unavailable" leaves the reader to guess which one they are
|
|
17
|
+
* looking at.
|
|
18
|
+
*/
|
|
19
|
+
export declare function unavailableReason(cause?: unknown): string;
|
|
20
|
+
/**
|
|
21
|
+
* `musl` builds under a different suffix, and the failure is otherwise
|
|
22
|
+
* baffling: the file is there, and `require` still refuses it. Worth saying so
|
|
23
|
+
* in a message rather than leaving a reader to discover glibc.
|
|
24
|
+
*/
|
|
25
|
+
export declare function muslHint(): string;
|
|
26
|
+
/** What a load attempt did, so the caller can apply its own policy. */
|
|
27
|
+
export type NativeBinaryResult<T> = {
|
|
28
|
+
loaded: true;
|
|
29
|
+
binary: T;
|
|
30
|
+
} | {
|
|
31
|
+
loaded: false;
|
|
32
|
+
suffix: string | undefined;
|
|
33
|
+
cause?: unknown;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Load `<package root>/index.<suffix>.node`.
|
|
37
|
+
*
|
|
38
|
+
* The path is fixed rather than passed: this file is generated into
|
|
39
|
+
* `<package>/src/vendor/`, so the package root is always two levels up, from
|
|
40
|
+
* `src` and from `dist` alike.
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadNativeBinary<T>(): NativeBinaryResult<T>;
|
|
43
|
+
//# sourceMappingURL=nativeBinary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeBinary.d.ts","sourceRoot":"","sources":["../../src/vendor/nativeBinary.ts"],"names":[],"mappings":"AAoCA;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,MAAM,EAAE,CAEpD;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAErE;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAQzD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAIjC;AAED,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC7B;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,GAC3B;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAa3D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Generated from scripts/vendor/nativeBinary.ts — do not edit.
|
|
2
|
+
//
|
|
3
|
+
// This package is published and built from its own repository, so the file
|
|
4
|
+
// has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
|
|
5
|
+
// and `pnpm vendor:check` fails if this copy has drifted from the original.
|
|
6
|
+
/**
|
|
7
|
+
* Finding the NAPI binary a package ships beside itself.
|
|
8
|
+
*
|
|
9
|
+
* Every package with a Rust engine repeats the same table: napi-rs names its
|
|
10
|
+
* artefacts `index.<platform>-<arch>-<abi>.node`, and the mapping from Node's
|
|
11
|
+
* `platform`/`arch` to that suffix is the part that must never differ between
|
|
12
|
+
* packages. Adding a target means adding it everywhere, and a package that
|
|
13
|
+
* missed the edit fails only on that platform — which is exactly the failure
|
|
14
|
+
* nobody reproduces.
|
|
15
|
+
*
|
|
16
|
+
* What is NOT here is the policy. Some packages degrade when the binary is
|
|
17
|
+
* absent and answer `undefined`; others refuse loudly with build instructions.
|
|
18
|
+
* Both are right for their package, so the loader reports what happened and
|
|
19
|
+
* the caller decides.
|
|
20
|
+
*/
|
|
21
|
+
import { createRequire } from "node:module";
|
|
22
|
+
import { dirname, join } from "node:path";
|
|
23
|
+
import { arch, platform } from "node:process";
|
|
24
|
+
import { fileURLToPath } from "node:url";
|
|
25
|
+
/** Node's `platform-arch` → the suffix napi-rs builds under. */
|
|
26
|
+
const TARGETS = {
|
|
27
|
+
"linux-x64": "linux-x64-gnu",
|
|
28
|
+
"linux-arm64": "linux-arm64-gnu",
|
|
29
|
+
"darwin-x64": "darwin-x64",
|
|
30
|
+
"darwin-arm64": "darwin-arm64",
|
|
31
|
+
"win32-x64": "win32-x64-msvc",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Every `platform-arch` a binary is built for.
|
|
35
|
+
*
|
|
36
|
+
* For the message a package raises when it refuses: "no binary for
|
|
37
|
+
* linux-riscv64" is only actionable next to the list of what there IS.
|
|
38
|
+
*/
|
|
39
|
+
export function supportedTargets() {
|
|
40
|
+
return Object.keys(TARGETS);
|
|
41
|
+
}
|
|
42
|
+
/** The suffix a given `platform-arch` builds under, or `undefined`. */
|
|
43
|
+
export function nativeTargetSuffix(target) {
|
|
44
|
+
return TARGETS[target];
|
|
45
|
+
}
|
|
46
|
+
/** The suffix for THIS platform, or `undefined` where no binary is built. */
|
|
47
|
+
export function nativeBinarySuffix() {
|
|
48
|
+
return nativeTargetSuffix(`${platform}-${arch}`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Why the binary is not there, phrased for whoever has to fix it.
|
|
52
|
+
*
|
|
53
|
+
* "not found" and "not built for your platform" call for different actions,
|
|
54
|
+
* and a single "unavailable" leaves the reader to guess which one they are
|
|
55
|
+
* looking at.
|
|
56
|
+
*/
|
|
57
|
+
export function unavailableReason(cause) {
|
|
58
|
+
if (cause !== undefined) {
|
|
59
|
+
return `failed to load (${cause instanceof Error ? cause.message : String(cause)})`;
|
|
60
|
+
}
|
|
61
|
+
const target = `${platform}-${arch}`;
|
|
62
|
+
return nativeTargetSuffix(target) !== undefined
|
|
63
|
+
? "binary not found"
|
|
64
|
+
: `no prebuilt binary for ${target}`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* `musl` builds under a different suffix, and the failure is otherwise
|
|
68
|
+
* baffling: the file is there, and `require` still refuses it. Worth saying so
|
|
69
|
+
* in a message rather than leaving a reader to discover glibc.
|
|
70
|
+
*/
|
|
71
|
+
export function muslHint() {
|
|
72
|
+
return platform === "linux"
|
|
73
|
+
? " On Alpine/musl, the gnu binary will not load — build the musl target."
|
|
74
|
+
: "";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Load `<package root>/index.<suffix>.node`.
|
|
78
|
+
*
|
|
79
|
+
* The path is fixed rather than passed: this file is generated into
|
|
80
|
+
* `<package>/src/vendor/`, so the package root is always two levels up, from
|
|
81
|
+
* `src` and from `dist` alike.
|
|
82
|
+
*/
|
|
83
|
+
export function loadNativeBinary() {
|
|
84
|
+
const suffix = nativeBinarySuffix();
|
|
85
|
+
if (suffix === undefined)
|
|
86
|
+
return { loaded: false, suffix };
|
|
87
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
88
|
+
try {
|
|
89
|
+
const nodeRequire = createRequire(import.meta.url);
|
|
90
|
+
return {
|
|
91
|
+
loaded: true,
|
|
92
|
+
binary: nodeRequire(join(here, `../../index.${suffix}.node`)),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (cause) {
|
|
96
|
+
return { loaded: false, suffix, cause };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=nativeBinary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeBinary.js","sourceRoot":"","sources":["../../src/vendor/nativeBinary.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAE5E;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,gEAAgE;AAChE,MAAM,OAAO,GAA2B;IACvC,WAAW,EAAE,eAAe;IAC5B,aAAa,EAAE,iBAAiB;IAChC,YAAY,EAAE,YAAY;IAC1B,cAAc,EAAE,cAAc;IAC9B,WAAW,EAAE,gBAAgB;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAChD,OAAO,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E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACzC,CAAC;AACF,CAAC"}
|
package/index.darwin-arm64.node
CHANGED
|
Binary file
|
package/index.darwin-x64.node
CHANGED
|
Binary file
|
|
Binary file
|
package/index.linux-x64-gnu.node
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/eon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Eon — time-series data layer for the Ream framework (TDengine-backed)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -59,9 +59,11 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@biomejs/biome": "^2.4.10",
|
|
61
61
|
"@types/node": "^22",
|
|
62
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
62
63
|
"tsx": "^4.19.0",
|
|
63
64
|
"typescript": "^6.0.2",
|
|
64
|
-
"vitest": "^4.1.2"
|
|
65
|
+
"vitest": "^4.1.2",
|
|
66
|
+
"@c9up/ream": "^0.2.0"
|
|
65
67
|
},
|
|
66
68
|
"engines": {
|
|
67
69
|
"node": ">=22.0.0"
|
|
@@ -74,11 +76,15 @@
|
|
|
74
76
|
"url": "git+https://github.com/C9up/eon.git"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
|
-
"vitest": ">=3"
|
|
79
|
+
"vitest": ">=3",
|
|
80
|
+
"@c9up/ream": "^0.2.0"
|
|
78
81
|
},
|
|
79
82
|
"peerDependenciesMeta": {
|
|
80
83
|
"vitest": {
|
|
81
84
|
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@c9up/ream": {
|
|
87
|
+
"optional": true
|
|
82
88
|
}
|
|
83
89
|
},
|
|
84
90
|
"scripts": {
|
|
@@ -88,7 +94,7 @@
|
|
|
88
94
|
"build:napi-types": "node scripts/build-napi-types.mjs",
|
|
89
95
|
"test": "vitest run",
|
|
90
96
|
"test:rust": "cargo test -p eon-query",
|
|
91
|
-
"lint": "biome check src/",
|
|
97
|
+
"lint": "biome check src/ tests/",
|
|
92
98
|
"test:coverage": "vitest run --coverage",
|
|
93
99
|
"typecheck": "tsc --noEmit"
|
|
94
100
|
}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* cargo a `/tmp/...` path the native proc-macro cannot write to, so the
|
|
8
8
|
* type-def file comes back empty and the build fails for no visible reason.
|
|
9
9
|
*
|
|
10
|
-
* One crate at a time on purpose: napi-derive
|
|
10
|
+
* One crate at a time on purpose: with napi-derive 2 the writes all went to a
|
|
11
|
+
* single `TYPE_DEF_TMP_PATH` and a parallel build interleaved them
|
|
11
12
|
* while cargo compiles, and a parallel build interleaves the writes —
|
|
12
13
|
* definitions go missing, silently, and the generated file comes out short.
|
|
13
14
|
*/
|
|
@@ -28,11 +29,11 @@ const scratch = mkdtempSync(join(tmpdir(), 'napi-types-'))
|
|
|
28
29
|
try {
|
|
29
30
|
const lines = []
|
|
30
31
|
for (const crate of CRATES) {
|
|
31
|
-
const perCrate = join(scratch,
|
|
32
|
+
const perCrate = join(scratch, crate)
|
|
32
33
|
writeFileSync(perCrate, '')
|
|
33
34
|
execFileSync('cargo', ['build', '-p', crate], {
|
|
34
35
|
cwd: packageRoot,
|
|
35
|
-
env: { ...process.env,
|
|
36
|
+
env: { ...process.env, NAPI_TYPE_DEF_TMP_FOLDER: scratch },
|
|
36
37
|
stdio: ['ignore', 'ignore', 'inherit'],
|
|
37
38
|
})
|
|
38
39
|
const emitted = readFileSync(perCrate, 'utf8').split('\n').filter(Boolean)
|
|
@@ -130,12 +130,15 @@ for (const fn of fns) {
|
|
|
130
130
|
// napi-derive emits the whole declaration for a function, unlike a struct
|
|
131
131
|
// where `def` holds only the members.
|
|
132
132
|
const declaration = fn.def.trim()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
// napi-derive 3 emits a bare `function name(...)` where 2 emitted the
|
|
134
|
+
// signature after the name; concatenating onto the former produced
|
|
135
|
+
// `function xfunction x(...)`.
|
|
136
|
+
const rendered = declaration.startsWith('export declare function')
|
|
137
|
+
? declaration
|
|
138
|
+
: declaration.startsWith('function ')
|
|
139
|
+
? `export declare ${declaration}`
|
|
140
|
+
: `export declare function ${fn.name}${declaration}`
|
|
141
|
+
out.push(`${rendered};`, '')
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
const stale = Object.keys(CALLBACK_REFINEMENTS).filter((k) => !used.has(k))
|
package/src/EonProvider.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* `container.singleton(token, factory)` satisfies the contract.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import "./augmentations.js";
|
|
15
16
|
import type { EonConfig, EonConnectionConfig } from "./connection/config.js";
|
|
16
17
|
import type { EonConnection } from "./connection/EonConnection.js";
|
|
17
18
|
import { ensureDatabase } from "./connection/ensureDatabase.js";
|
|
@@ -44,6 +45,16 @@ export interface EonAppContext {
|
|
|
44
45
|
): unknown | Promise<unknown>;
|
|
45
46
|
};
|
|
46
47
|
config: { get<T = unknown>(key: string): T | undefined };
|
|
48
|
+
/**
|
|
49
|
+
* Optional reader — present on ream's real application.
|
|
50
|
+
*
|
|
51
|
+
* `'warmup'` means the application was assembled to be INSPECTED rather than
|
|
52
|
+
* run: a route listing, a codegen pass, a config dump. Providers register,
|
|
53
|
+
* boot and start on that path too, so anything that opens a socket or
|
|
54
|
+
* creates a database has to ask first. A host that does not implement it is
|
|
55
|
+
* treated as running.
|
|
56
|
+
*/
|
|
57
|
+
getMode?(): string;
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
/**
|
|
@@ -77,7 +88,16 @@ export class EonProvider {
|
|
|
77
88
|
|
|
78
89
|
register(): void {}
|
|
79
90
|
|
|
91
|
+
/** True when the application was assembled to be inspected rather than run. */
|
|
92
|
+
#isInspecting(): boolean {
|
|
93
|
+
return this.#app.getMode?.() === "warmup";
|
|
94
|
+
}
|
|
95
|
+
|
|
80
96
|
async boot(): Promise<void> {
|
|
97
|
+
// An inspection opens no WebSocket and creates no database. `warmUp()`
|
|
98
|
+
// runs boot, so a route listing reached TDengine — and could CREATE a
|
|
99
|
+
// database there — while `shutdown()` never fires on that path, leaving
|
|
100
|
+
// the sockets open. The compiler binding below is pure and stays.
|
|
81
101
|
if (this.#booted) {
|
|
82
102
|
throw new Error(
|
|
83
103
|
"EonProvider: boot() has already opened connections; a second boot would overwrite and leak them. Call shutdown() first, or construct a new provider.",
|
|
@@ -89,6 +109,12 @@ export class EonProvider {
|
|
|
89
109
|
};
|
|
90
110
|
this.#app.container.singleton("eon.compiler", () => service);
|
|
91
111
|
|
|
112
|
+
// Everything past here opens a socket or creates a database, so an
|
|
113
|
+
// inspection stops at the compiler. `warmUp()` runs boot, so a route
|
|
114
|
+
// listing reached TDengine — and could CREATE a database there — while
|
|
115
|
+
// `shutdown()` never fires on that path, leaving the sockets open.
|
|
116
|
+
if (this.#isInspecting()) return;
|
|
117
|
+
|
|
92
118
|
const config =
|
|
93
119
|
this.#app.config.get<EonConfig>("timeseries") ??
|
|
94
120
|
this.#app.config.get<EonConfig>("eon");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teach ream's `ContainerBindings` what `container.make(...)` returns for the
|
|
3
|
+
* tokens eon binds.
|
|
4
|
+
*
|
|
5
|
+
* ream declares that interface open on purpose: it registers its own entries
|
|
6
|
+
* and expects each package to contribute the ones it owns. Nothing filled
|
|
7
|
+
* these in, so resolving by the string token answered `unknown` and every call
|
|
8
|
+
* site had to assert a type it could not prove.
|
|
9
|
+
*
|
|
10
|
+
* Loaded from the package barrel and from the provider, so registering eon is
|
|
11
|
+
* enough — nobody writes a `declare module` of their own.
|
|
12
|
+
*
|
|
13
|
+
* Type-only, and ream stays an OPTIONAL peer: nothing here reaches a runtime
|
|
14
|
+
* import, and a `declare module` for a specifier that does not resolve is
|
|
15
|
+
* simply inert.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// Referenced so the augmentation below resolves the module it augments.
|
|
19
|
+
import type {} from "@c9up/ream/types";
|
|
20
|
+
import type { EonConnection } from "./connection/EonConnection.js";
|
|
21
|
+
import type { EonService } from "./EonProvider.js";
|
|
22
|
+
|
|
23
|
+
declare module "@c9up/ream/types" {
|
|
24
|
+
interface ContainerBindings {
|
|
25
|
+
/** The default connection, bound by `EonProvider`. */
|
|
26
|
+
eon: EonConnection;
|
|
27
|
+
/** The default connection, under the longer name. */
|
|
28
|
+
"eon.connection": EonConnection;
|
|
29
|
+
/** The compiler service, bound by `EonProvider`. */
|
|
30
|
+
"eon.compiler": EonService;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
package/src/query/native.ts
CHANGED
|
@@ -8,21 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const require2 = createRequire(import.meta.url);
|
|
17
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
|
|
19
|
-
const platformMap: Record<string, string> = {
|
|
20
|
-
"linux-x64": "linux-x64-gnu",
|
|
21
|
-
"linux-arm64": "linux-arm64-gnu",
|
|
22
|
-
"darwin-x64": "darwin-x64",
|
|
23
|
-
"darwin-arm64": "darwin-arm64",
|
|
24
|
-
"win32-x64": "win32-x64-msvc",
|
|
25
|
-
};
|
|
11
|
+
import {
|
|
12
|
+
loadNativeBinary,
|
|
13
|
+
muslHint,
|
|
14
|
+
supportedTargets,
|
|
15
|
+
} from "../vendor/nativeBinary.js";
|
|
26
16
|
|
|
27
17
|
/**
|
|
28
18
|
* The compiler's surface, as the Rust declares it.
|
|
@@ -51,25 +41,22 @@ let native: NativeBinding | undefined;
|
|
|
51
41
|
*/
|
|
52
42
|
function loadNative(): NativeBinding {
|
|
53
43
|
if (native) return native;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
binding = require2(binaryPath);
|
|
65
|
-
} catch (cause) {
|
|
44
|
+
// The resolution is shared; the refusal is not. Both codes below are eon's,
|
|
45
|
+
// and a caller branches on them.
|
|
46
|
+
const attempt = loadNativeBinary<NativeBinding>();
|
|
47
|
+
if (!attempt.loaded) {
|
|
48
|
+
if (attempt.suffix === undefined) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`[E_EON_NAPI_UNSUPPORTED] no eon-query native binary for this platform. Supported: ${supportedTargets().join(", ")}.`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
66
53
|
throw new Error(
|
|
67
|
-
`[E_EON_NAPI_NOT_FOUND] eon-query native binary not found
|
|
68
|
-
cause !== undefined ? { cause } : undefined,
|
|
54
|
+
`[E_EON_NAPI_NOT_FOUND] eon-query native binary 'index.${attempt.suffix}.node' not found or unloadable.${muslHint()} Build it with: pnpm --filter @c9up/eon build:napi`,
|
|
55
|
+
attempt.cause !== undefined ? { cause: attempt.cause } : undefined,
|
|
69
56
|
);
|
|
70
57
|
}
|
|
71
|
-
native =
|
|
72
|
-
return
|
|
58
|
+
native = attempt.binary;
|
|
59
|
+
return attempt.binary;
|
|
73
60
|
}
|
|
74
61
|
|
|
75
62
|
/**
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Generated from scripts/vendor/nativeBinary.ts — do not edit.
|
|
2
|
+
//
|
|
3
|
+
// This package is published and built from its own repository, so the file
|
|
4
|
+
// has to exist here rather than be imported. `pnpm vendor:sync` rewrites it,
|
|
5
|
+
// and `pnpm vendor:check` fails if this copy has drifted from the original.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Finding the NAPI binary a package ships beside itself.
|
|
9
|
+
*
|
|
10
|
+
* Every package with a Rust engine repeats the same table: napi-rs names its
|
|
11
|
+
* artefacts `index.<platform>-<arch>-<abi>.node`, and the mapping from Node's
|
|
12
|
+
* `platform`/`arch` to that suffix is the part that must never differ between
|
|
13
|
+
* packages. Adding a target means adding it everywhere, and a package that
|
|
14
|
+
* missed the edit fails only on that platform — which is exactly the failure
|
|
15
|
+
* nobody reproduces.
|
|
16
|
+
*
|
|
17
|
+
* What is NOT here is the policy. Some packages degrade when the binary is
|
|
18
|
+
* absent and answer `undefined`; others refuse loudly with build instructions.
|
|
19
|
+
* Both are right for their package, so the loader reports what happened and
|
|
20
|
+
* the caller decides.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { createRequire } from "node:module";
|
|
24
|
+
import { dirname, join } from "node:path";
|
|
25
|
+
import { arch, platform } from "node:process";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
|
|
28
|
+
/** Node's `platform-arch` → the suffix napi-rs builds under. */
|
|
29
|
+
const TARGETS: Record<string, string> = {
|
|
30
|
+
"linux-x64": "linux-x64-gnu",
|
|
31
|
+
"linux-arm64": "linux-arm64-gnu",
|
|
32
|
+
"darwin-x64": "darwin-x64",
|
|
33
|
+
"darwin-arm64": "darwin-arm64",
|
|
34
|
+
"win32-x64": "win32-x64-msvc",
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Every `platform-arch` a binary is built for.
|
|
39
|
+
*
|
|
40
|
+
* For the message a package raises when it refuses: "no binary for
|
|
41
|
+
* linux-riscv64" is only actionable next to the list of what there IS.
|
|
42
|
+
*/
|
|
43
|
+
export function supportedTargets(): readonly string[] {
|
|
44
|
+
return Object.keys(TARGETS);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The suffix a given `platform-arch` builds under, or `undefined`. */
|
|
48
|
+
export function nativeTargetSuffix(target: string): string | undefined {
|
|
49
|
+
return TARGETS[target];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The suffix for THIS platform, or `undefined` where no binary is built. */
|
|
53
|
+
export function nativeBinarySuffix(): string | undefined {
|
|
54
|
+
return nativeTargetSuffix(`${platform}-${arch}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Why the binary is not there, phrased for whoever has to fix it.
|
|
59
|
+
*
|
|
60
|
+
* "not found" and "not built for your platform" call for different actions,
|
|
61
|
+
* and a single "unavailable" leaves the reader to guess which one they are
|
|
62
|
+
* looking at.
|
|
63
|
+
*/
|
|
64
|
+
export function unavailableReason(cause?: unknown): string {
|
|
65
|
+
if (cause !== undefined) {
|
|
66
|
+
return `failed to load (${cause instanceof Error ? cause.message : String(cause)})`;
|
|
67
|
+
}
|
|
68
|
+
const target = `${platform}-${arch}`;
|
|
69
|
+
return nativeTargetSuffix(target) !== undefined
|
|
70
|
+
? "binary not found"
|
|
71
|
+
: `no prebuilt binary for ${target}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `musl` builds under a different suffix, and the failure is otherwise
|
|
76
|
+
* baffling: the file is there, and `require` still refuses it. Worth saying so
|
|
77
|
+
* in a message rather than leaving a reader to discover glibc.
|
|
78
|
+
*/
|
|
79
|
+
export function muslHint(): string {
|
|
80
|
+
return platform === "linux"
|
|
81
|
+
? " On Alpine/musl, the gnu binary will not load — build the musl target."
|
|
82
|
+
: "";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** What a load attempt did, so the caller can apply its own policy. */
|
|
86
|
+
export type NativeBinaryResult<T> =
|
|
87
|
+
| { loaded: true; binary: T }
|
|
88
|
+
| { loaded: false; suffix: string | undefined; cause?: unknown };
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Load `<package root>/index.<suffix>.node`.
|
|
92
|
+
*
|
|
93
|
+
* The path is fixed rather than passed: this file is generated into
|
|
94
|
+
* `<package>/src/vendor/`, so the package root is always two levels up, from
|
|
95
|
+
* `src` and from `dist` alike.
|
|
96
|
+
*/
|
|
97
|
+
export function loadNativeBinary<T>(): NativeBinaryResult<T> {
|
|
98
|
+
const suffix = nativeBinarySuffix();
|
|
99
|
+
if (suffix === undefined) return { loaded: false, suffix };
|
|
100
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
101
|
+
try {
|
|
102
|
+
const nodeRequire = createRequire(import.meta.url);
|
|
103
|
+
return {
|
|
104
|
+
loaded: true,
|
|
105
|
+
binary: nodeRequire(join(here, `../../index.${suffix}.node`)) as T,
|
|
106
|
+
};
|
|
107
|
+
} catch (cause) {
|
|
108
|
+
return { loaded: false, suffix, cause };
|
|
109
|
+
}
|
|
110
|
+
}
|