@wxn0brp/db-core 0.11.1-alpha.0 → 0.11.1-alpha.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 CHANGED
@@ -1,17 +1,30 @@
1
1
  # @wxn0brp/db-core
2
2
 
3
- Core library for [ValtheraDB](https://github.com/wxn0brp/ValtheraDB).
3
+ Core runtime for [ValtheraDB](https://github.com/wxn0brP/ValtheraDB). This package contains the shared database logic that the higher-level Valthera packages build on.
4
4
 
5
- ## ⚠️ Disclaimer
5
+ It is usually not something you install directly unless you are:
6
6
 
7
- It is **not recommended** to install this module separately unless you plan to create your own ValtheraDB adapter.
7
+ - building a custom storage adapter
8
+ - extending the lower-level database runtime
9
+ - working on Valthera itself
8
10
 
9
- ## Installation
11
+ ## Install
10
12
 
11
13
  ```bash
12
14
  npm install @wxn0brp/db-core
13
15
  ```
14
16
 
17
+ ## What It Provides
18
+
19
+ - collection and document primitives
20
+ - query and update operators
21
+ - relation handling
22
+ - shared types used by the Valthera packages
23
+
24
+ ## Package Note
25
+
26
+ If you are building an application, you probably want `@wxn0brp/db` instead of this package. `db-core` is the internal foundation.
27
+
15
28
  ## Documentation
16
29
 
17
30
  See [typedoc](https://wxn0brp.github.io/ValtheraDB-core/).
@@ -22,4 +35,4 @@ Contributions are welcome! Please submit pull requests or open issues on GitHub.
22
35
 
23
36
  ## License
24
37
 
25
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
38
+ MIT. See [LICENSE](LICENSE).
@@ -5,27 +5,27 @@ export interface FileCpu {
5
5
  * Asynchronously adds an entry to a file.
6
6
  * @returns A promise resolving to `void`.
7
7
  */
8
- add(file: string, config: VQueryT.Add): Promise<void>;
8
+ add(file: string, config: VQueryT.Add, opts?: any): Promise<void>;
9
9
  /**
10
10
  * Asynchronously finds multiple entries in a file based on search criteria.
11
11
  * @returns A promise resolving to an array of found entries, or `false` if the file does not exist.
12
12
  */
13
- find(file: string, config: VQueryT.Find): Promise<DataInternal[]>;
13
+ find(file: string, config: VQueryT.Find, opts?: any): Promise<DataInternal[]>;
14
14
  /**
15
15
  * Asynchronously finds one entry in a file based on search criteria.
16
16
  * @returns A promise resolving to the found entry or `false` if not found.
17
17
  */
18
- findOne(file: string, config: VQueryT.FindOne): Promise<DataInternal | false>;
18
+ findOne(file: string, config: VQueryT.FindOne, opts?: any): Promise<DataInternal | false>;
19
19
  /**
20
20
  * Asynchronously removes entries from a file based on search criteria.
21
21
  * @param one If `true`, removes only the first matching entry.
22
22
  * @returns A promise resolving to `true` if at least one entry was removed, otherwise `false`.
23
23
  */
24
- remove(file: string, config: VQueryT.Remove, one: boolean): Promise<DataInternal[]>;
24
+ remove(file: string, config: VQueryT.Remove, one: boolean, opts?: any): Promise<DataInternal[]>;
25
25
  /**
26
26
  * Asynchronously updates entries in a file based on search criteria and an updater function or object.
27
27
  * @param one If `true`, updates only the first matching entry.
28
28
  * @returns A promise resolving to `true` if at least one entry was updated, otherwise `false`.
29
29
  */
30
- update(file: string, config: VQueryT.Update, one: boolean): Promise<DataInternal[]>;
30
+ update(file: string, config: VQueryT.Update, one: boolean, opts?: any): Promise<DataInternal[]>;
31
31
  }
@@ -1,4 +1,4 @@
1
1
  import { Data } from "../types/data.js";
2
2
  import { FileCpu } from "../types/fileCpu.js";
3
3
  import { VQueryT } from "../types/query.js";
4
- export declare function findUtil(query: VQueryT.Find, fileCpuOrData: FileCpu | Object[], files: string[]): Promise<Data[]>;
4
+ export declare function findUtil(query: VQueryT.Find, fileCpuOrData: FileCpu | Object[], files: string[], fileCpuOpts?: any): Promise<Data[]>;
@@ -1,5 +1,5 @@
1
1
  import { compareSafe } from "./compare.js";
2
- export async function findUtil(query, fileCpuOrData, files) {
2
+ export async function findUtil(query, fileCpuOrData, files, fileCpuOpts) {
3
3
  const { dbFindOpts = {} } = query;
4
4
  const { reverse = false, offset = 0, limit = -1, sortBy, sortAsc = true, min, max, avg, groupBy, count, } = dbFindOpts;
5
5
  const needsAllData = min || max || avg || groupBy || count || sortBy;
@@ -18,7 +18,7 @@ export async function findUtil(query, fileCpuOrData, files) {
18
18
  else {
19
19
  const filesToProcess = reverse && !sortBy ? [...files].reverse() : files;
20
20
  for (const f of filesToProcess) {
21
- let entries = await fileCpuOrData.find(f, query);
21
+ let entries = await fileCpuOrData.find(f, query, fileCpuOpts);
22
22
  if (reverse && !sortBy)
23
23
  entries.reverse();
24
24
  if (needsAllData) {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.11.1-alpha.0";
1
+ export const version = "0.11.1-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-core",
3
- "version": "0.11.1-alpha.0",
3
+ "version": "0.11.1-alpha.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "author": "wxn0brP",