@oceanbase/seekdb-node 1.4.0 → 1.4.1
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 +88 -172
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -87
- package/package.json +18 -29
- package/dist/native-loader.d.ts +0 -2
- package/dist/native-loader.js +0 -35
package/README.md
CHANGED
|
@@ -1,57 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# seekdb Node.js binding
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
This package manages a local seekdb runtime. It starts or reuses the seekdb
|
|
4
|
+
server, returns the local MySQL-protocol endpoint, and releases the lifecycle
|
|
5
|
+
handle. SQL connections are owned by the application and its chosen client.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
The public API is written in TypeScript and is available to JavaScript and
|
|
8
|
+
TypeScript applications through one package. Node.js 22 or newer is the initial
|
|
9
|
+
supported runtime. The package uses ES modules (`import`). Bun and Deno have not
|
|
10
|
+
been validated with this package.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
[Report an issue](https://github.com/oceanbase/seekdb-bindings/issues)
|
|
12
|
+
## Build from this repository
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Initialize the repository's git submodules, install Node.js and CMake, and make
|
|
15
|
+
a compatible `seekdb` executable available on `PATH` or set `SEEKDB_BIN`:
|
|
15
16
|
|
|
16
17
|
```sh
|
|
17
|
-
|
|
18
|
+
git submodule update --init --recursive
|
|
19
|
+
cd typescript
|
|
20
|
+
npm install
|
|
21
|
+
SEEKDB_BIN=/path/to/seekdb npm test
|
|
18
22
|
```
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
`npm test` builds the package before running the tests. To build without testing,
|
|
25
|
+
run `SEEKDB_BIN=/path/to/seekdb npm run build`. The build creates `libseekdb`,
|
|
26
|
+
compiles the Node-API addon and TypeScript, then stages the addon, library, and
|
|
27
|
+
server executable under `dist/native`.
|
|
28
|
+
On Linux and macOS, staging strips debug and unused symbols from the copied
|
|
29
|
+
server executable, then runs `seekdb -V`; the source binary keeps its symbols.
|
|
30
|
+
`npm test` also opens a database through the stripped package.
|
|
31
|
+
The native files must match the host operating system and architecture. Linux
|
|
32
|
+
builds additionally require a C/C++ toolchain, `readelf` (binutils), `ldd`, and
|
|
33
|
+
`patchelf`. Staging recursively bundles non-glibc shared libraries, rejects
|
|
34
|
+
missing or conflicting dependencies, and sets their runtime search paths to
|
|
35
|
+
`$ORIGIN`. glibc and its loader remain system dependencies.
|
|
36
|
+
|
|
37
|
+
On macOS, staging recursively bundles non-system absolute-path dynamic libraries,
|
|
38
|
+
rewrites their references to `@loader_path`, and signs the staged files. Staging
|
|
39
|
+
and `npm pack` reject unresolved absolute references left in the package.
|
|
40
|
+
|
|
41
|
+
`CC`, `CXX`, and `LDFLAGS` are preserved. On macOS, unset compilers are selected
|
|
42
|
+
with `xcrun --find clang` / `clang++`, respecting the active developer SDK. The
|
|
43
|
+
same compiler selection applies to the C library and addon. Use a fresh
|
|
44
|
+
`build/node-sdk` directory when changing a compiler already cached by CMake.
|
|
45
|
+
|
|
46
|
+
## Build a Linux x64 npm tarball
|
|
47
|
+
|
|
48
|
+
Build in a glibc 2.28 environment, such as an AlmaLinux/Rocky Linux 8 builder
|
|
49
|
+
with a current compiler toolchain and Node.js 22 or 24. The existing
|
|
50
|
+
`scripts/build-seekdb-glibc228.sh` can build the server executable. Build the C
|
|
51
|
+
library, addon, and any bundled dependencies against the same glibc baseline.
|
|
52
|
+
The ordinary Debian-based `node` images may introduce newer glibc requirements;
|
|
53
|
+
Alpine/musl is not a supported target of this command.
|
|
27
54
|
|
|
28
55
|
```sh
|
|
29
|
-
npm
|
|
56
|
+
SEEKDB_BIN=/path/to/seekdb npm run build
|
|
57
|
+
npm run pack:linux -- --out-dir /path/to/artifacts
|
|
30
58
|
```
|
|
31
59
|
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
declarations. CommonJS `require()` is not an advertised entry point. Bun and
|
|
39
|
-
Deno have not been validated.
|
|
60
|
+
`pack:linux` checks the built files, dependency closure, executable permissions,
|
|
61
|
+
and every ELF's GLIBC symbol requirements, rejecting anything above 2.28. It
|
|
62
|
+
creates a publishable `@oceanbase/seekdb-node` tarball restricted to Linux/x64/glibc,
|
|
63
|
+
including the license and native runtime. The source manifest stays private;
|
|
64
|
+
the generated manifest has public npm publish settings and no build scripts or
|
|
65
|
+
development dependencies. No package is uploaded by this command.
|
|
40
66
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Windows | x86_64 (`x64`) | Tested on Windows 11; older Windows versions are not validated |
|
|
67
|
+
For testing a different compatibility target, pass `--glibc-baseline <version>`.
|
|
68
|
+
`platform.json` records the highest required glibc symbol version. Choosing a
|
|
69
|
+
lower baseline cannot make an existing binary compatible; rebuild the offending
|
|
70
|
+
binary or dependency in the target environment. `npm pack` also validates the
|
|
71
|
+
built package, so a clean checkout cannot silently produce an empty tarball.
|
|
47
72
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
73
|
+
Before publishing, install the tarball outside the source tree and verify SQL
|
|
74
|
+
with Node.js 22 and 24 on the baseline distribution and a newer distribution.
|
|
75
|
+
Confirm publish rights to the chosen npm scope. The existing `seekdb` SDK uses
|
|
76
|
+
`@seekdb/js-bindings`, whose `open/connect/execute` API differs from this package's
|
|
77
|
+
lifecycle API. Adapting that SDK is required before replacing its native package.
|
|
51
78
|
|
|
52
|
-
##
|
|
79
|
+
## Use
|
|
53
80
|
|
|
54
|
-
|
|
81
|
+
Importing the package does not load native files. `seekdb.open()` checks the
|
|
82
|
+
platform and loads the native addon on first use. Call `seekdb.checkPlatform()`
|
|
83
|
+
at startup if you want to validate and load it earlier.
|
|
55
84
|
|
|
56
85
|
```js
|
|
57
86
|
import { seekdb } from "@oceanbase/seekdb-node";
|
|
@@ -63,147 +92,34 @@ const db = await seekdb.open("./seekdb.db", {
|
|
|
63
92
|
let connection;
|
|
64
93
|
try {
|
|
65
94
|
const endpoint = db.connectionOptions();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
location = { socketPath: endpoint.unixSocket };
|
|
71
|
-
} else {
|
|
72
|
-
throw new Error("This example uses TCP or Unix sockets; configure TCP or use a named-pipe-capable client.");
|
|
73
|
-
}
|
|
95
|
+
const location = endpoint.transport === "tcp"
|
|
96
|
+
? { host: endpoint.host, port: endpoint.port }
|
|
97
|
+
: { socketPath: endpoint.transport === "unix_socket"
|
|
98
|
+
? endpoint.unixSocket : endpoint.namedPipe };
|
|
74
99
|
connection = await mysql.createConnection({
|
|
75
|
-
...location,
|
|
76
100
|
user: endpoint.user,
|
|
77
101
|
password: "",
|
|
78
102
|
database: "test",
|
|
103
|
+
...location,
|
|
79
104
|
});
|
|
80
105
|
const [rows] = await connection.query("SELECT 1 AS value");
|
|
81
|
-
console.log(rows);
|
|
106
|
+
console.log(rows);
|
|
82
107
|
} finally {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} finally {
|
|
86
|
-
db.close();
|
|
87
|
-
}
|
|
108
|
+
if (connection) await connection.end();
|
|
109
|
+
db.close();
|
|
88
110
|
}
|
|
89
111
|
```
|
|
90
112
|
|
|
91
|
-
The
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
The
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### `await seekdb.open(dbDir, options?)`
|
|
105
|
-
|
|
106
|
-
Opens a local runtime handle, starting or reusing the server for `dbDir`.
|
|
107
|
-
`dbDir` must be a nonempty string. `options.parameters` is a record of server
|
|
108
|
-
parameter names and **string** values, for example
|
|
109
|
-
`{ parameters: { memory_budget: "2G" } }`.
|
|
110
|
-
|
|
111
|
-
Ordinary server parameters apply on first initialization and are then persisted
|
|
112
|
-
by seekdb. Operational parameters such as `port` and `mysql_port_mode` apply
|
|
113
|
-
when a server is spawned. Opening another handle does not reconfigure an
|
|
114
|
-
already-running server.
|
|
115
|
-
|
|
116
|
-
### `db.connectionOptions()`
|
|
117
|
-
|
|
118
|
-
Returns one of these endpoint shapes while the handle is open:
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
type ConnectionOptions =
|
|
122
|
-
| { transport: "tcp"; user: string; host: string; port: number }
|
|
123
|
-
| { transport: "unix_socket"; user: string; unixSocket: string }
|
|
124
|
-
| { transport: "named_pipe"; user: string; namedPipe: string };
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Use the `transport` discriminator to adapt it to your SQL client. Calling this
|
|
128
|
-
method after `close()` throws an error.
|
|
129
|
-
|
|
130
|
-
### `db.close()`, `db.closed`, and `db.dbDir`
|
|
131
|
-
|
|
132
|
-
- `close()` synchronously releases this lifecycle handle. It is idempotent,
|
|
133
|
-
does not delete database files, and does not guarantee immediate server exit.
|
|
134
|
-
- Close SQL clients before releasing their lifecycle handle. Other open handles
|
|
135
|
-
can continue using the same database.
|
|
136
|
-
- `closed` reports whether this handle has been closed.
|
|
137
|
-
- `dbDir` is the absolute, normalized database directory.
|
|
138
|
-
|
|
139
|
-
Call `close()` explicitly; do not rely on garbage collection for cleanup.
|
|
140
|
-
|
|
141
|
-
### Errors
|
|
142
|
-
|
|
143
|
-
Invalid JavaScript arguments are rejected with `TypeError`. Native startup
|
|
144
|
-
failures reject `open()` with an exported `seekdbError`, whose `returnCode` and
|
|
145
|
-
`message` contain the native error code and diagnostic.
|
|
146
|
-
|
|
147
|
-
## Troubleshooting and scope
|
|
148
|
-
|
|
149
|
-
- **Missing native package:** keep optional dependencies enabled and reinstall
|
|
150
|
-
on the target machine. Verify that its OS, architecture, libc and Node.js
|
|
151
|
-
version are supported.
|
|
152
|
-
- **Startup failure:** inspect the error message, database directory permissions,
|
|
153
|
-
and available memory and disk space. Initialization and restart can take time.
|
|
154
|
-
- **SQL client failure:** use the endpoint returned by `connectionOptions()`;
|
|
155
|
-
keep the handle open while the SQL connection is in use.
|
|
156
|
-
- **Local use:** the example connects as the local `root` user with an empty
|
|
157
|
-
password. Do not expose this endpoint to untrusted networks without separately
|
|
158
|
-
configuring and validating authentication and network access controls.
|
|
159
|
-
- **Different SDK API:** this is not a drop-in replacement for
|
|
160
|
-
`@seekdb/js-bindings`. It exposes `open` / `connectionOptions` / `close`, not
|
|
161
|
-
the other SDK's `open` / `connect` / `execute` interface.
|
|
162
|
-
|
|
163
|
-
For a bug report, include your OS/version, CPU architecture, Node.js version,
|
|
164
|
-
package version, and a minimal reproduction. Remove credentials and private
|
|
165
|
-
database contents from logs before sharing them.
|
|
166
|
-
|
|
167
|
-
## Building and contributing
|
|
168
|
-
|
|
169
|
-
Normal npm users do not need a compiler. For source builds, initialize the
|
|
170
|
-
repository submodules and use Node.js, CMake and a compatible native toolchain:
|
|
171
|
-
|
|
172
|
-
```sh
|
|
173
|
-
git submodule update --init --recursive
|
|
174
|
-
cd typescript
|
|
175
|
-
npm ci --ignore-scripts
|
|
176
|
-
SEEKDB_BIN=/path/to/seekdb npm test
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
`npm test` builds the C driver, Node-API addon and TypeScript before testing.
|
|
180
|
-
Linux source builds also need `readelf`, `ldd` and `patchelf`. Compiler overrides
|
|
181
|
-
`CC`, `CXX` and `LDFLAGS` are preserved; macOS uses the active Xcode toolchain
|
|
182
|
-
when no compiler override is supplied.
|
|
183
|
-
|
|
184
|
-
Alternatively, reuse an extracted, compatible libseekdb SDK. Its public C header
|
|
185
|
-
must match the source checkout; only the Node addon and TypeScript are rebuilt:
|
|
186
|
-
|
|
187
|
-
```sh
|
|
188
|
-
SEEKDB_SDK_DIR=/path/to/libseekdb-sdk npm test
|
|
189
|
-
npm run pack:release -- --out-dir /path/to/artifacts
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
On Windows PowerShell, assign environment variables with `$env:NAME = "value"`
|
|
193
|
-
instead of the POSIX syntax above. Initialize the Windows SDK/MSVC support
|
|
194
|
-
environment and set `SEEKDB_MSVC_RUNTIME_DIR` to the x64 `Microsoft.VC143.CRT`
|
|
195
|
-
redistributable directory when staging the Windows runtime.
|
|
196
|
-
|
|
197
|
-
Release packaging produces a common package and an exact-version platform
|
|
198
|
-
runtime package. Linux binaries must remain compatible with glibc 2.28; the
|
|
199
|
-
macOS minimum is determined by the bundled binaries. Test the installed
|
|
200
|
-
tarballs outside the source checkout on Node.js 22 and 24. Packing does not
|
|
201
|
-
publish anything to npm. The standalone Linux-only `pack:linux` route is for
|
|
202
|
-
development and is not the multi-platform release layout.
|
|
203
|
-
|
|
204
|
-
## License
|
|
205
|
-
|
|
206
|
-
The bindings are licensed under
|
|
207
|
-
[Apache-2.0](https://github.com/oceanbase/seekdb-bindings/blob/main/LICENSE).
|
|
208
|
-
Bundled seekdb and third-party runtime components retain their own license and
|
|
209
|
-
notice terms; see the license and notice files included in each native package.
|
|
113
|
+
The endpoint is valid while its `seekdb` handle remains open. Close external SQL
|
|
114
|
+
connections before the handle. `close()` is idempotent and does not delete data
|
|
115
|
+
or guarantee immediate server-process termination. The returned `dbDir` is an
|
|
116
|
+
absolute, normalized path. On Windows, a named-pipe endpoint may require a
|
|
117
|
+
client-specific transport adapter; validate the chosen client before relying on
|
|
118
|
+
it. The package exposes connection information rather than a client-specific
|
|
119
|
+
configuration object.
|
|
120
|
+
|
|
121
|
+
Server parameters use the names and string values accepted by `seekdb_open`.
|
|
122
|
+
Ordinary parameters apply on first initialization; `port` and `mysql_port_mode`
|
|
123
|
+
apply on each spawn. Errors from `open()` include `returnCode` and the native
|
|
124
|
+
startup diagnostic. A native handle is also closed when garbage collected, but
|
|
125
|
+
applications should call `close()` explicitly.
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export declare class seekdb {
|
|
|
26
26
|
#private;
|
|
27
27
|
readonly dbDir: string;
|
|
28
28
|
private constructor();
|
|
29
|
+
/** Validate this package for the current runtime and load its native addon. */
|
|
30
|
+
static checkPlatform(): void;
|
|
29
31
|
static open(dbDir: string, options?: OpenOptions): Promise<seekdb>;
|
|
30
32
|
get closed(): boolean;
|
|
31
33
|
connectionOptions(): ConnectionOptions;
|
package/dist/index.js
CHANGED
|
@@ -1,90 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
// The platform packages contain the original tested JS API, addon and runtime.
|
|
2
|
+
const packages = {
|
|
3
|
+
"linux/x64": "@oceanbase/seekdb-node-linux-x64-gnu",
|
|
4
|
+
"linux/arm64": "@oceanbase/seekdb-node-linux-arm64-gnu",
|
|
5
|
+
"darwin/arm64": "@oceanbase/seekdb-node-darwin-arm64",
|
|
6
|
+
"win32/x64": "@oceanbase/seekdb-node-win32-x64",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const packageName = packages[`${process.platform}/${process.arch}`];
|
|
10
|
+
if (!packageName) {
|
|
11
|
+
throw new Error(`seekdb does not support ${process.platform}/${process.arch}`);
|
|
11
12
|
}
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
if (!report.header?.glibcVersionRuntime) {
|
|
15
|
-
throw new Error("This seekdb native package requires glibc; musl/Alpine is not supported");
|
|
16
|
-
}
|
|
13
|
+
if (process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime) {
|
|
14
|
+
throw new Error("seekdb requires glibc; musl/Alpine is not supported");
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.returnCode = returnCode;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function parameterPairs(options) {
|
|
29
|
-
if (options === undefined)
|
|
30
|
-
return [];
|
|
31
|
-
if (options === null || typeof options !== "object") {
|
|
32
|
-
throw new TypeError("options must be an object");
|
|
33
|
-
}
|
|
34
|
-
const parameters = options.parameters;
|
|
35
|
-
if (parameters === undefined)
|
|
36
|
-
return [];
|
|
37
|
-
if (parameters === null || typeof parameters !== "object" || Array.isArray(parameters)) {
|
|
38
|
-
throw new TypeError("parameters must be a record of string values");
|
|
39
|
-
}
|
|
40
|
-
const pairs = [];
|
|
41
|
-
for (const [key, value] of Object.entries(parameters)) {
|
|
42
|
-
if (!key || typeof value !== "string") {
|
|
43
|
-
throw new TypeError("parameter keys must be nonempty and values must be strings");
|
|
44
|
-
}
|
|
45
|
-
pairs.push(key, value);
|
|
46
|
-
}
|
|
47
|
-
return pairs;
|
|
48
|
-
}
|
|
49
|
-
/** An open, local seekdb runtime. Close SQL clients before closing this handle. */
|
|
50
|
-
export class seekdb {
|
|
51
|
-
dbDir;
|
|
52
|
-
#handle;
|
|
53
|
-
constructor(dbDir, handle) {
|
|
54
|
-
this.dbDir = dbDir;
|
|
55
|
-
this.#handle = handle;
|
|
56
|
-
}
|
|
57
|
-
static async open(dbDir, options) {
|
|
58
|
-
if (typeof dbDir !== "string" || dbDir.length === 0) {
|
|
59
|
-
throw new TypeError("dbDir must be a nonempty string");
|
|
60
|
-
}
|
|
61
|
-
const pairs = parameterPairs(options);
|
|
62
|
-
const normalized = resolve(dbDir);
|
|
63
|
-
try {
|
|
64
|
-
const handle = await native.open(normalized, pairs);
|
|
65
|
-
return new seekdb(normalized, handle);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (error instanceof Error && "returnCode" in error &&
|
|
69
|
-
typeof error.returnCode === "number") {
|
|
70
|
-
throw new seekdbError(error.message, error.returnCode, { cause: error });
|
|
71
|
-
}
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
get closed() {
|
|
76
|
-
return this.#handle === undefined;
|
|
77
|
-
}
|
|
78
|
-
connectionOptions() {
|
|
79
|
-
if (this.#handle === undefined) {
|
|
80
|
-
throw new Error("seekdb is closed");
|
|
81
|
-
}
|
|
82
|
-
return native.connectionOptions(this.#handle);
|
|
83
|
-
}
|
|
84
|
-
close() {
|
|
85
|
-
if (this.#handle !== undefined) {
|
|
86
|
-
native.close(this.#handle);
|
|
87
|
-
this.#handle = undefined;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
16
|
+
|
|
17
|
+
let implementation;
|
|
18
|
+
try {
|
|
19
|
+
implementation = await import(packageName);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
throw new Error(`Cannot load ${packageName}; reinstall @oceanbase/seekdb-node with optional dependencies enabled`,
|
|
22
|
+
{ cause: error });
|
|
90
23
|
}
|
|
24
|
+
|
|
25
|
+
export const seekdb = implementation.seekdb;
|
|
26
|
+
export const seekdbError = implementation.seekdbError;
|
package/package.json
CHANGED
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"version": "1.4.0",
|
|
4
|
-
"description": "Local seekdb lifecycle bindings for Node.js and TypeScript",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"type": "module",
|
|
2
|
+
"description": "Local seekdb lifecycle bindings for Node.js",
|
|
7
3
|
"engines": {
|
|
8
4
|
"node": ">=22"
|
|
9
5
|
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
6
|
"exports": {
|
|
13
7
|
".": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts"
|
|
16
10
|
}
|
|
17
11
|
},
|
|
18
12
|
"files": [
|
|
19
|
-
"dist/",
|
|
20
|
-
"
|
|
13
|
+
"dist/index.js",
|
|
14
|
+
"dist/index.d.ts",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
21
17
|
],
|
|
22
18
|
"gypfile": false,
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"name": "@oceanbase/seekdb-node",
|
|
23
22
|
"optionalDependencies": {
|
|
24
|
-
"@oceanbase/seekdb-node-
|
|
25
|
-
"@oceanbase/seekdb-node-linux-arm64-gnu": "1.4.
|
|
26
|
-
"@oceanbase/seekdb-node-
|
|
27
|
-
"@oceanbase/seekdb-node-win32-x64": "1.4.
|
|
23
|
+
"@oceanbase/seekdb-node-darwin-arm64": "1.4.1",
|
|
24
|
+
"@oceanbase/seekdb-node-linux-arm64-gnu": "1.4.1",
|
|
25
|
+
"@oceanbase/seekdb-node-linux-x64-gnu": "1.4.1",
|
|
26
|
+
"@oceanbase/seekdb-node-win32-x64": "1.4.1"
|
|
28
27
|
},
|
|
29
28
|
"publishConfig": {
|
|
30
29
|
"access": "public",
|
|
31
30
|
"registry": "https://registry.npmjs.org"
|
|
32
31
|
},
|
|
33
|
-
"homepage": "https://github.com/oceanbase/seekdb-bindings/tree/main/typescript#readme",
|
|
34
32
|
"repository": {
|
|
35
33
|
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/oceanbase/seekdb-bindings.git"
|
|
37
|
-
"directory": "typescript"
|
|
38
|
-
},
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/oceanbase/seekdb-bindings/issues"
|
|
34
|
+
"url": "git+https://github.com/oceanbase/seekdb-bindings.git"
|
|
41
35
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"database",
|
|
46
|
-
"mysql",
|
|
47
|
-
"typescript",
|
|
48
|
-
"node-api"
|
|
49
|
-
]
|
|
36
|
+
"type": "module",
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"version": "1.4.1"
|
|
50
39
|
}
|
package/dist/native-loader.d.ts
DELETED
package/dist/native-loader.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
export function nativePackageName(platform, arch) {
|
|
6
|
-
const suffixes = {
|
|
7
|
-
"linux/x64": "linux-x64-gnu",
|
|
8
|
-
"linux/arm64": "linux-arm64-gnu",
|
|
9
|
-
"darwin/arm64": "darwin-arm64",
|
|
10
|
-
"win32/x64": "win32-x64",
|
|
11
|
-
};
|
|
12
|
-
const suffix = suffixes[`${platform}/${arch}`];
|
|
13
|
-
if (!suffix)
|
|
14
|
-
throw new Error(`Unsupported seekdb platform: ${platform}/${arch}`);
|
|
15
|
-
return `@oceanbase/seekdb-node-${suffix}`;
|
|
16
|
-
}
|
|
17
|
-
export function nativeDirectory() {
|
|
18
|
-
if (process.platform === "linux") {
|
|
19
|
-
const report = process.report.getReport();
|
|
20
|
-
if (!report.header?.glibcVersionRuntime) {
|
|
21
|
-
throw new Error("This seekdb native package requires glibc; musl/Alpine is not supported");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const local = resolve(dirname(fileURLToPath(import.meta.url)), "native");
|
|
25
|
-
if (existsSync(resolve(local, "platform.json")))
|
|
26
|
-
return local;
|
|
27
|
-
const name = nativePackageName(process.platform, process.arch);
|
|
28
|
-
const require = createRequire(import.meta.url);
|
|
29
|
-
try {
|
|
30
|
-
return resolve(dirname(require.resolve(`${name}/package.json`)), "native");
|
|
31
|
-
}
|
|
32
|
-
catch (cause) {
|
|
33
|
-
throw new Error(`Missing ${name}; install seekdb with optional dependencies enabled`, { cause });
|
|
34
|
-
}
|
|
35
|
-
}
|