@lossless.org/nosqldb 10.10.0 → 11.0.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.
Files changed (43) hide show
  1. package/.smartconfig.json +21 -19
  2. package/dist_rust/rustdb_linux_amd64 +0 -0
  3. package/dist_rust/rustdb_linux_amd64.tsrust-build.json +5 -5
  4. package/dist_rust/rustdb_linux_amd64_musl +0 -0
  5. package/dist_rust/rustdb_linux_amd64_musl.tsrust-build.json +5 -5
  6. package/dist_rust/rustdb_linux_arm64 +0 -0
  7. package/dist_rust/rustdb_linux_arm64.tsrust-build.json +5 -5
  8. package/dist_rust/rustdb_linux_arm64_musl +0 -0
  9. package/dist_rust/rustdb_linux_arm64_musl.tsrust-build.json +5 -5
  10. package/dist_rust/rustdb_macos_amd64 +0 -0
  11. package/dist_rust/rustdb_macos_amd64.tsrust-build.json +5 -5
  12. package/dist_rust/rustdb_macos_arm64 +0 -0
  13. package/dist_rust/rustdb_macos_arm64.tsrust-build.json +5 -5
  14. package/dist_ts/00_commitinfo_data.js +2 -2
  15. package/dist_ts/ts_local/classes.localnosqldb.d.ts +15 -4
  16. package/dist_ts/ts_local/classes.localnosqldb.js +31 -11
  17. package/dist_ts/ts_nosqldb/index.d.ts +3 -3
  18. package/dist_ts/ts_nosqldb/index.js +5 -4
  19. package/dist_ts/ts_nosqldb/rust-db-bridge.d.ts +125 -2
  20. package/dist_ts/ts_nosqldb/rust-db-bridge.js +261 -46
  21. package/dist_ts/ts_nosqldb/server/classes.nosqldbserver.d.ts +69 -3
  22. package/dist_ts/ts_nosqldb/server/classes.nosqldbserver.js +91 -12
  23. package/dist_ts/ts_nosqldb/server/index.d.ts +2 -2
  24. package/dist_ts/ts_nosqldb/server/index.js +2 -2
  25. package/dist_ts/ts_nosqldb/stopped-storage.d.ts +9 -1
  26. package/dist_ts/ts_nosqldb/stopped-storage.js +1 -1
  27. package/dist_ts/ts_nosqldb/storage-rehearsal.js +1 -1
  28. package/dist_ts/ts_nosqldb/storage-root-alignment.js +7 -3
  29. package/dist_ts/ts_nosqldb/storage-root-relocation.js +2 -2
  30. package/package.json +20 -16
  31. package/readme.md +469 -666
  32. package/third-party-notices.md +40 -8
  33. package/third_party_licenses/inventory.json +6 -6
  34. package/ts/00_commitinfo_data.ts +1 -1
  35. package/ts/ts_local/classes.localnosqldb.ts +35 -12
  36. package/ts/ts_nosqldb/index.ts +7 -2
  37. package/ts/ts_nosqldb/rust-db-bridge.ts +291 -48
  38. package/ts/ts_nosqldb/server/classes.nosqldbserver.ts +151 -15
  39. package/ts/ts_nosqldb/server/index.ts +2 -2
  40. package/ts/ts_nosqldb/stopped-storage.ts +9 -1
  41. package/ts/ts_nosqldb/storage-rehearsal.ts +1 -1
  42. package/ts/ts_nosqldb/storage-root-alignment.ts +6 -2
  43. package/ts/ts_nosqldb/storage-root-relocation.ts +1 -1
@@ -58,7 +58,7 @@ installed npm dependencies retain their own license materials.
58
58
  The Rust executables distributed with this package include
59
59
  third-party components. This document covers the complete third-party package
60
60
  set recorded by `rust/Cargo.lock`, including target-inactive and compile-time
61
- components. The twelve `rustdb*` workspace crates are covered by the package's
61
+ components. The thirteen `rustdb*` workspace crates are covered by the package's
62
62
  own MIT license and are not repeated below.
63
63
 
64
64
  ## Component Inventory
@@ -153,14 +153,12 @@ was generated from the lockfile with `cargo license --json`.
153
153
  | lazy_static | 1.5.0 | Apache-2.0 OR MIT | MIT |
154
154
  | leb128fmt | 0.1.0 | Apache-2.0 OR MIT | MIT |
155
155
  | libc | 0.2.183 | Apache-2.0 OR MIT | MIT |
156
- | libmimalloc-sys | 0.1.44 | MIT | MIT |
157
156
  | linux-raw-sys | 0.12.1 | Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT | MIT |
158
157
  | lock_api | 0.4.14 | Apache-2.0 OR MIT | MIT |
159
158
  | log | 0.4.29 | Apache-2.0 OR MIT | MIT |
160
159
  | maplit | 1.0.2 | Apache-2.0 OR MIT | MIT |
161
160
  | matchers | 0.2.0 | MIT | MIT |
162
161
  | memchr | 2.8.0 | MIT OR Unlicense | MIT |
163
- | mimalloc | 0.1.48 | MIT | MIT |
164
162
  | mio | 1.1.1 | MIT | MIT |
165
163
  | nu-ansi-term | 0.50.3 | MIT | MIT |
166
164
  | num-conv | 0.2.1 | Apache-2.0 OR MIT | MIT |
@@ -239,6 +237,8 @@ was generated from the lockfile with `cargo license --json`.
239
237
  | thiserror-impl | 1.0.69 | Apache-2.0 OR MIT | MIT |
240
238
  | thiserror-impl | 2.0.18 | Apache-2.0 OR MIT | MIT |
241
239
  | thread_local | 1.1.9 | Apache-2.0 OR MIT | MIT |
240
+ | tikv-jemalloc-sys | 0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8 | Apache-2.0 OR MIT | MIT |
241
+ | tikv-jemallocator | 0.7.0 | Apache-2.0 OR MIT | MIT |
242
242
  | time | 0.3.47 | Apache-2.0 OR MIT | MIT |
243
243
  | time-core | 0.1.8 | Apache-2.0 OR MIT | MIT |
244
244
  | time-macros | 0.2.27 | Apache-2.0 OR MIT | MIT |
@@ -324,7 +324,7 @@ Copyright (c) 2013 Nicolas Silva (android_system_properties)
324
324
 
325
325
  Copyright (c) 2013-2014 The Rust Project Developers. (hex)
326
326
 
327
- Copyright (c) 2014 Alex Crichton (cc, cfg-if, find-msvc-tools, id-arena, js-sys, socket2, wasm-bindgen, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared)
327
+ Copyright (c) 2014 Alex Crichton (cc, cfg-if, find-msvc-tools, id-arena, js-sys, socket2, tikv-jemalloc-sys, tikv-jemallocator, wasm-bindgen, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared)
328
328
 
329
329
  Copyright (c) 2014 Benjamin Sago (nu-ansi-term)
330
330
 
@@ -424,8 +424,6 @@ Copyright (c) 2018-2023 The RustCrypto Project Developers (pbkdf2)
424
424
 
425
425
  Copyright (c) 2018-2024 The rust-random Project Developers (getrandom)
426
426
 
427
- Copyright (c) 2018-2025 Microsoft Corporation, Daan Leijen (libmimalloc-sys)
428
-
429
427
  Copyright (c) 2018-2025 The rust-random Project Developers (getrandom)
430
428
 
431
429
  Copyright (c) 2018-2026 The rust-random Project Developers (getrandom)
@@ -494,8 +492,6 @@ Copyright (c) Ulrik Sverdrup "bluss" 2015-2023 (arrayvec)
494
492
 
495
493
  Copyright 2018 Developers of the Rand project (rand, rand_chacha, rand_core)
496
494
 
497
- Copyright 2019 Octavian Oncescu (mimalloc)
498
-
499
495
  Copyright 2023 The Fuchsia Authors (zerocopy, zerocopy-derive)
500
496
 
501
497
  ### MIT Provenance Notes
@@ -897,6 +893,42 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
897
893
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
898
894
  POSSIBILITY OF SUCH DAMAGE.
899
895
 
896
+ ## BSD-2-Clause Notice for jemalloc
897
+
898
+ The `tikv-jemalloc-sys` component bundles jemalloc 5.3.1, a memory allocator
899
+ compiled into the Rust executables that link it. Its `jemalloc/COPYING`
900
+ reads:
901
+
902
+ ```
903
+ Unless otherwise specified, files in the jemalloc source distribution are
904
+ subject to the following license:
905
+ --------------------------------------------------------------------------------
906
+ Copyright (C) 2002-present Jason Evans <jasone@canonware.com>.
907
+ All rights reserved.
908
+ Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
909
+ Copyright (C) 2009-present Facebook, Inc. All rights reserved.
910
+
911
+ Redistribution and use in source and binary forms, with or without
912
+ modification, are permitted provided that the following conditions are met:
913
+ 1. Redistributions of source code must retain the above copyright notice(s),
914
+ this list of conditions and the following disclaimer.
915
+ 2. Redistributions in binary form must reproduce the above copyright notice(s),
916
+ this list of conditions and the following disclaimer in the documentation
917
+ and/or other materials provided with the distribution.
918
+
919
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
920
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
921
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
922
+ EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
923
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
924
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
925
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
926
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
927
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
928
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
929
+ --------------------------------------------------------------------------------
930
+ ```
931
+
900
932
  ## Zlib Notice for foldhash
901
933
 
902
934
  Copyright (c) 2024 Orson Peters
@@ -88,14 +88,12 @@
88
88
  "lazy_static@1.5.0",
89
89
  "leb128fmt@0.1.0",
90
90
  "libc@0.2.183",
91
- "libmimalloc-sys@0.1.44",
92
91
  "linux-raw-sys@0.12.1",
93
92
  "lock_api@0.4.14",
94
93
  "log@0.4.29",
95
94
  "maplit@1.0.2",
96
95
  "matchers@0.2.0",
97
96
  "memchr@2.8.0",
98
- "mimalloc@0.1.48",
99
97
  "mio@1.1.1",
100
98
  "nu-ansi-term@0.50.3",
101
99
  "num-conv@0.2.1",
@@ -174,6 +172,8 @@
174
172
  "thiserror@1.0.69",
175
173
  "thiserror@2.0.18",
176
174
  "thread_local@1.1.9",
175
+ "tikv-jemalloc-sys@0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8",
176
+ "tikv-jemallocator@0.7.0",
177
177
  "time-core@0.1.8",
178
178
  "time-macros@0.2.27",
179
179
  "time@0.3.47",
@@ -246,13 +246,13 @@
246
246
  "zmij@1.0.21"
247
247
  ],
248
248
  "files": {
249
- ".smartconfig.json": "a6b17fae7da13c9b5f6eef7049cfd13b497ab7e80739e17446becc0edd5ccefe",
249
+ ".smartconfig.json": "aaf16e0b94160e274d9ee7e0c9a7ace7bda53fda28439738beaa65e448aa3ecf",
250
250
  "license.md": "cfa51b1d8428e453099273832dc2ec1cebdf23d7ba4eda307883158cfc77da2d",
251
251
  "rust-toolchain.toml": "8c3afbe90fa0feff766dffd92e6728a569c0a804cf49f1ecd47bf5ac262499b3",
252
- "rust/Cargo.lock": "543fc19bc27e5842b6c6326fbb66f9a52f0f0b7935d36181b8fb264a61df7d6f",
252
+ "rust/Cargo.lock": "d33a7ad4bb92ddd9b1e71012690dcaa5ac6fa6fbccc796faf0706fb10c037b34",
253
253
  "rust/notices.sources.json": "63ef24a7c81db69b1cf9f5acbf2e329f1830261ba1bfaa423dc2b8efc092d99a",
254
- "scripts/verify-native-notices.mjs": "6481fe69fb7d6e9efcc089811de4383fec8d5d83850b6d133afc65ea9e22d1ad",
255
- "third-party-notices.md": "4c58d3f7810945054e69f4da9a56f3a504137b6988f17ec6dc37e6a3b38acc1d",
254
+ "scripts/verify-native-notices.mjs": "66a7c0e1336ee5bac625d6889ab69778eda8392e7b57b5c3181cacc68117a382",
255
+ "third-party-notices.md": "ce6213c6e2d7a647692c941c9e61d27cb0f2f8b09d544a5cef89a6a05dd1fd27",
256
256
  "third_party_licenses/compiler-builtins-license.txt": "ab6eec6caf0fa5775e411c7a8bc6a45c4ef2956b0980b157ab74fc5cd62a928b",
257
257
  "third_party_licenses/gcc-gpl-3.0.txt": "8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903",
258
258
  "third_party_licenses/gcc-runtime-exception.txt": "9d6b43ce4d8de0c878bf16b54d8e7a10d9bd42b75178153e3af6a815bdc90f74",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@lossless.org/nosqldb',
6
- version: '10.10.0',
6
+ version: '11.0.0',
7
7
  description: 'A MongoDB-compatible embedded database server with wire protocol support, backed by a high-performance Rust engine.'
8
8
  }
@@ -20,6 +20,7 @@ import * as path from 'node:path';
20
20
  import * as os from 'node:os';
21
21
  import {
22
22
  NoSqlDbServer,
23
+ type NoSqlDbEngineExitError,
23
24
  type INoSqlDbAuthOptions,
24
25
  type ILocalNoSqlDbOfflinePhysicalNamespaceInspection,
25
26
  type ILocalNoSqlDbOfflinePhysicalNamespaceInspectionResult,
@@ -31,11 +32,13 @@ import {
31
32
  } from '../ts_nosqldb/index.js';
32
33
  import {
33
34
  RustDbBridge,
35
+ attachNoSqlDbEngineStderrTail,
34
36
  rustDbBridgeStorageRootRelocation,
35
37
  rustDbBridgeStorageRootAlignment,
36
38
  rustDbBridgeStorageRootAlignmentAbort,
37
39
  } from '../ts_nosqldb/rust-db-bridge.js';
38
40
  import { validateNoSqlDbStorageRehearsalStartup } from '../ts_nosqldb/storage-rehearsal.js';
41
+ import { noStopRequestResult, type INoSqlDbServerStopResult } from '../ts_nosqldb/server/classes.nosqldbserver.js';
39
42
  import {
40
43
  type TNoSqlDbFileStorageStartup,
41
44
  } from '../ts_nosqldb/file-storage-startup.js';
@@ -78,6 +81,10 @@ export interface ILocalNoSqlDbOptions {
78
81
  folderPath: string;
79
82
  /** Optional: custom socket path (default: auto-generated in /tmp) */
80
83
  socketPath?: string;
84
+ /** Receives every engine standard-error line; as `INoSqlDbServerOptions.engineLog`. */
85
+ engineLog?: (line: string) => void;
86
+ /** Called once for each unexpected engine exit; as `INoSqlDbServerOptions.onEngineExit`. */
87
+ onEngineExit?: (error: NoSqlDbEngineExitError) => void;
81
88
  }
82
89
 
83
90
  /**
@@ -396,10 +403,8 @@ export class LocalNoSqlDb {
396
403
  };
397
404
  }
398
405
  if (!await bridge.spawn(spawnOptions)) {
399
- throw new Error(
400
- 'nosqldb Rust binary not found. Set NOSQLDB_RUST_BINARY env var, ' +
401
- 'install the platform package, or build locally with `tsrust`.',
402
- );
406
+ // The bridge states what it knows: that the engine at its binaryPath did not report ready, or, without one, both meanings.
407
+ throw new Error(bridge.spawnFailureMessage ?? 'the nosqldb engine did not start: spawn() returned false');
403
408
  }
404
409
  let commandOptions = optionsArg;
405
410
  if (deadline !== undefined) {
@@ -528,9 +533,23 @@ export class LocalNoSqlDb {
528
533
  }
529
534
 
530
535
  /**
531
- * Start the local NoSQLDB server and return connection info
536
+ * Start the local NoSQLDB server and return connection info. A rejection
537
+ * carries `engineStderrTail`: the server's start sets it, and a rejection
538
+ * from before the server's start, which spawned no engine, carries an empty
539
+ * array.
532
540
  */
533
541
  async start(): Promise<ILocalNoSqlDbConnectionInfo> {
542
+ try {
543
+ return await this.startServer();
544
+ } catch (error) {
545
+ if (!(error !== null && typeof error === 'object' && Object.prototype.hasOwnProperty.call(error, 'engineStderrTail'))) {
546
+ attachNoSqlDbEngineStderrTail(error, []);
547
+ }
548
+ throw error;
549
+ }
550
+ }
551
+
552
+ private async startServer(): Promise<ILocalNoSqlDbConnectionInfo> {
534
553
  if (this.server) {
535
554
  throw new Error('LocalNoSqlDb is already running');
536
555
  }
@@ -546,6 +565,8 @@ export class LocalNoSqlDb {
546
565
  socketPath: this.generatedSocketPath,
547
566
  storage: 'file',
548
567
  storagePath: this.options.folderPath,
568
+ engineLog: this.options.engineLog,
569
+ onEngineExit: this.options.onEngineExit,
549
570
  });
550
571
  await this.server.start();
551
572
 
@@ -596,13 +617,15 @@ export class LocalNoSqlDb {
596
617
  }
597
618
 
598
619
  /**
599
- * Stop the local NoSQLDB server
620
+ * Stop the local NoSQLDB server. Resolves with the result of its
621
+ * `NoSqlDbServer.stop()`, which says how the engine ended; without a server,
622
+ * with a result saying that no stop request was sent.
600
623
  */
601
- async stop(): Promise<void> {
602
- if (this.server) {
603
- await this.server.stop();
604
- this.server = null;
605
- this.generatedSocketPath = null;
606
- }
624
+ async stop(): Promise<INoSqlDbServerStopResult> {
625
+ if (!this.server) return noStopRequestResult;
626
+ const result = await this.server.stop();
627
+ this.server = null;
628
+ this.generatedSocketPath = null;
629
+ return result;
607
630
  }
608
631
  }
@@ -15,7 +15,7 @@ export type {
15
15
  } from './storage-rehearsal.js';
16
16
 
17
17
  // Export server (the main entry point for using NoSQLDB)
18
- export { NoSqlDbServer } from './server/classes.nosqldbserver.js';
18
+ export { NoSqlDbServer, noSqlDbServerStopGraceMs } from './server/classes.nosqldbserver.js';
19
19
  export type {
20
20
  INoSqlDbCommitCursor,
21
21
  INoSqlDbCommittedNamespace,
@@ -30,13 +30,18 @@ export type {
30
30
  INoSqlDbAuthUser,
31
31
  INoSqlDbOplogOptions,
32
32
  INoSqlDbServerOptions,
33
+ INoSqlDbServerStopResult,
33
34
  INoSqlDbTlsOptions,
34
35
  } from './server/classes.nosqldbserver.js';
35
36
 
36
- // Export bridge for advanced usage and its fail-stop ownership error.
37
+ // Export bridge for advanced usage, its fail-stop ownership error, and the
38
+ // engine-exit error and standard-error tail bounds.
37
39
  export {
38
40
  RustDbBridge,
39
41
  NoSqlDbManagementOperationTerminationError,
42
+ NoSqlDbEngineExitError,
43
+ noSqlDbEngineStderrTailLimits,
44
+ NoSqlDbUnknownRootError,
40
45
  } from './rust-db-bridge.js';
41
46
 
42
47
  // Export oplog / debug types