@wxn0brp/db-core 0.2.6-alpha.0 → 0.2.8
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/base/actions.d.ts +2 -0
- package/dist/base/actions.js +7 -0
- package/dist/base/custom.d.ts +1 -1
- package/dist/base/custom.js +5 -5
- package/dist/customFileCpu.d.ts +4 -4
- package/dist/customFileCpu.js +10 -9
- package/dist/db/valthera.d.ts +5 -1
- package/dist/db/valthera.js +8 -0
- package/dist/helpers/addId.d.ts +3 -0
- package/dist/helpers/addId.js +24 -0
- package/dist/helpers/executor.d.ts +3 -2
- package/dist/helpers/executor.js +3 -2
- package/dist/helpers/relation.js +1 -1
- package/dist/types/fileCpu.d.ts +8 -8
- package/dist/types/options.d.ts +1 -0
- package/dist/types/query.d.ts +0 -1
- package/dist/types/searchOpts.d.ts +4 -0
- package/dist/types/updater.d.ts +4 -1
- package/dist/utils/action.js +1 -1
- package/dist/utils/hasFieldsAdvanced.js +51 -133
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/id.js +10 -3
- package/dist/utils/merge.d.ts +1 -0
- package/dist/utils/merge.js +22 -0
- package/dist/utils/updateObject.d.ts +2 -2
- package/dist/utils/updateObject.js +76 -105
- package/dist/version.js +1 -1
- package/package.json +35 -37
- /package/dist/utils/{sort.d.ts → compare.d.ts} +0 -0
- /package/dist/utils/{sort.js → compare.js} +0 -0
package/dist/base/actions.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import Data from "../types/data.js";
|
|
|
2
2
|
import { VQuery } from "../types/query.js";
|
|
3
3
|
declare class ActionsBase {
|
|
4
4
|
_inited: boolean;
|
|
5
|
+
numberId: boolean;
|
|
5
6
|
init(...args: any[]): Promise<void>;
|
|
6
7
|
getCollections(): Promise<string[]>;
|
|
7
8
|
ensureCollection(config: VQuery): Promise<boolean>;
|
|
@@ -15,5 +16,6 @@ declare class ActionsBase {
|
|
|
15
16
|
removeOne(config: VQuery): Promise<boolean>;
|
|
16
17
|
removeCollection(config: VQuery): Promise<boolean>;
|
|
17
18
|
updateOneOrAdd(config: VQuery): Promise<boolean>;
|
|
19
|
+
toggleOne(config: VQuery): Promise<boolean>;
|
|
18
20
|
}
|
|
19
21
|
export default ActionsBase;
|
package/dist/base/actions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { setDataUsingUpdateOneOrAdd } from "../helpers/updateOneOrAdd.js";
|
|
2
2
|
class ActionsBase {
|
|
3
3
|
_inited = true;
|
|
4
|
+
numberId = false;
|
|
4
5
|
async init(...args) { }
|
|
5
6
|
async getCollections() {
|
|
6
7
|
throw new Error("Not implemented");
|
|
@@ -54,5 +55,11 @@ class ActionsBase {
|
|
|
54
55
|
}
|
|
55
56
|
return res;
|
|
56
57
|
}
|
|
58
|
+
async toggleOne(config) {
|
|
59
|
+
const res = await this.removeOne(config);
|
|
60
|
+
if (!res)
|
|
61
|
+
await this.add(config);
|
|
62
|
+
return res;
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
export default ActionsBase;
|
package/dist/base/custom.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class CustomActionsBase extends ActionsBase {
|
|
|
8
8
|
/**
|
|
9
9
|
* Add a new entry to the specified database.
|
|
10
10
|
*/
|
|
11
|
-
add(
|
|
11
|
+
add(query: VQuery): Promise<import("../types/arg.js").Arg>;
|
|
12
12
|
/**
|
|
13
13
|
* Find entries in the specified database based on search criteria.
|
|
14
14
|
*/
|
package/dist/base/custom.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { addId } from "../helpers/addId.js";
|
|
2
2
|
import { findUtil } from "../utils/action.js";
|
|
3
3
|
import ActionsBase from "./actions.js";
|
|
4
4
|
export class CustomActionsBase extends ActionsBase {
|
|
@@ -9,10 +9,10 @@ export class CustomActionsBase extends ActionsBase {
|
|
|
9
9
|
/**
|
|
10
10
|
* Add a new entry to the specified database.
|
|
11
11
|
*/
|
|
12
|
-
async add(
|
|
13
|
-
await this.ensureCollection(
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
async add(query) {
|
|
13
|
+
await this.ensureCollection(query);
|
|
14
|
+
await addId(query, this);
|
|
15
|
+
const { collection, data } = query;
|
|
16
16
|
await this.fileCpu.add(collection, data);
|
|
17
17
|
return data;
|
|
18
18
|
}
|
package/dist/customFileCpu.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ declare class CustomFileCpu implements FileCpu {
|
|
|
11
11
|
_writeFile: WriteFile;
|
|
12
12
|
constructor(readFile: ReadFile, writeFile: WriteFile);
|
|
13
13
|
add(file: string, data: Data): Promise<void>;
|
|
14
|
-
find(file: string,
|
|
15
|
-
findOne(file: string,
|
|
16
|
-
remove(file: string, one: boolean,
|
|
17
|
-
update(file: string, one: boolean,
|
|
14
|
+
find(file: string, search: Search, context?: VContext, findOpts?: FindOpts): Promise<any[] | false>;
|
|
15
|
+
findOne(file: string, search: Search, context?: VContext, findOpts?: FindOpts): Promise<any | false>;
|
|
16
|
+
remove(file: string, one: boolean, search: Search, context?: VContext): Promise<boolean>;
|
|
17
|
+
update(file: string, one: boolean, search: Search, updater: Updater, context?: VContext): Promise<boolean>;
|
|
18
18
|
}
|
|
19
19
|
export default CustomFileCpu;
|
package/dist/customFileCpu.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import hasFieldsAdvanced from "./utils/hasFieldsAdvanced.js";
|
|
2
2
|
import updateFindObject from "./utils/updateFindObject.js";
|
|
3
|
+
import updateObjectAdvanced from "./utils/updateObject.js";
|
|
3
4
|
export function pathRepair(path) {
|
|
4
5
|
return path.replaceAll("//", "/");
|
|
5
6
|
}
|
|
@@ -16,26 +17,26 @@ class CustomFileCpu {
|
|
|
16
17
|
entries.push(data);
|
|
17
18
|
await this._writeFile(file, entries);
|
|
18
19
|
}
|
|
19
|
-
async find(file,
|
|
20
|
+
async find(file, search, context = {}, findOpts = {}) {
|
|
20
21
|
file = pathRepair(file);
|
|
21
22
|
const entries = await this._readFile(file);
|
|
22
|
-
const results = entries.filter(entry => typeof
|
|
23
|
+
const results = entries.filter(entry => typeof search === "function" ? search(entry, context) : hasFieldsAdvanced(entry, search));
|
|
23
24
|
return results.length ? results.map(res => updateFindObject(res, findOpts)) : [];
|
|
24
25
|
}
|
|
25
|
-
async findOne(file,
|
|
26
|
+
async findOne(file, search, context = {}, findOpts = {}) {
|
|
26
27
|
file = pathRepair(file);
|
|
27
28
|
const entries = await this._readFile(file);
|
|
28
|
-
const result = entries.find(entry => typeof
|
|
29
|
+
const result = entries.find(entry => typeof search === "function" ? search(entry, context) : hasFieldsAdvanced(entry, search));
|
|
29
30
|
return result ? updateFindObject(result, findOpts) : false;
|
|
30
31
|
}
|
|
31
|
-
async remove(file, one,
|
|
32
|
+
async remove(file, one, search, context = {}) {
|
|
32
33
|
file = pathRepair(file);
|
|
33
34
|
let entries = await this._readFile(file);
|
|
34
35
|
let removed = false;
|
|
35
36
|
entries = entries.filter(entry => {
|
|
36
37
|
if (removed && one)
|
|
37
38
|
return true;
|
|
38
|
-
let match = typeof
|
|
39
|
+
let match = typeof search === "function" ? search(entry, context) : hasFieldsAdvanced(entry, search);
|
|
39
40
|
if (match) {
|
|
40
41
|
removed = true;
|
|
41
42
|
return false;
|
|
@@ -47,17 +48,17 @@ class CustomFileCpu {
|
|
|
47
48
|
await this._writeFile(file, entries);
|
|
48
49
|
return true;
|
|
49
50
|
}
|
|
50
|
-
async update(file, one,
|
|
51
|
+
async update(file, one, search, updater, context = {}) {
|
|
51
52
|
file = pathRepair(file);
|
|
52
53
|
let entries = await this._readFile(file);
|
|
53
54
|
let updated = false;
|
|
54
55
|
entries = entries.map(entry => {
|
|
55
56
|
if (updated && one)
|
|
56
57
|
return entry;
|
|
57
|
-
let match = typeof
|
|
58
|
+
let match = typeof search === "function" ? search(entry, context) : hasFieldsAdvanced(entry, search);
|
|
58
59
|
if (match) {
|
|
59
60
|
updated = true;
|
|
60
|
-
return typeof updater === "function" ? updater(entry, context) :
|
|
61
|
+
return typeof updater === "function" ? updater(entry, context) : updateObjectAdvanced(entry, updater);
|
|
61
62
|
}
|
|
62
63
|
return entry;
|
|
63
64
|
});
|
package/dist/db/valthera.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { VEE } from "@wxn0brp/event-emitter";
|
|
|
2
2
|
import ActionsBase from "../base/actions.js";
|
|
3
3
|
import CollectionManager from "../helpers/CollectionManager.js";
|
|
4
4
|
import executorC from "../helpers/executor.js";
|
|
5
|
-
import { Search, Updater } from "../types/arg.js";
|
|
5
|
+
import { Arg, Search, Updater } from "../types/arg.js";
|
|
6
6
|
import Data from "../types/data.js";
|
|
7
7
|
import { DbFindOpts, DbOpts, FindOpts } from "../types/options.js";
|
|
8
8
|
import { VQuery } from "../types/query.js";
|
|
@@ -74,6 +74,10 @@ declare class ValtheraClass implements ValtheraCompatible {
|
|
|
74
74
|
* Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
|
|
75
75
|
*/
|
|
76
76
|
updateOneOrAdd<T = Data>(collection: string, search: Search<T>, updater: Updater<T>, { add_arg, context, id_gen }?: UpdateOneOrAdd<T>): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
79
|
+
*/
|
|
80
|
+
toggleOne<T = Data>(collection: string, search: Search<T>, data: Arg<T>, context?: VContext): Promise<boolean>;
|
|
77
81
|
/**
|
|
78
82
|
* Removes a database collection from the file system.
|
|
79
83
|
*/
|
package/dist/db/valthera.js
CHANGED
|
@@ -16,6 +16,8 @@ class ValtheraClass {
|
|
|
16
16
|
this.dbAction = options.dbAction || new ActionsBase();
|
|
17
17
|
this.executor = options.executor || new executorC();
|
|
18
18
|
this.emiter = new VEE();
|
|
19
|
+
if (options.numberId)
|
|
20
|
+
this.dbAction.numberId = true;
|
|
19
21
|
}
|
|
20
22
|
async init(...args) {
|
|
21
23
|
if (this.dbAction._inited)
|
|
@@ -105,6 +107,12 @@ class ValtheraClass {
|
|
|
105
107
|
async updateOneOrAdd(collection, search, updater, { add_arg = {}, context = {}, id_gen = true } = {}) {
|
|
106
108
|
return await this.execute("updateOneOrAdd", { collection, search, updater, add_arg, context, id_gen });
|
|
107
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
|
|
112
|
+
*/
|
|
113
|
+
async toggleOne(collection, search, data, context = {}) {
|
|
114
|
+
return await this.execute("toggleOne", { collection, search, data, context, id_gen: false });
|
|
115
|
+
}
|
|
108
116
|
/**
|
|
109
117
|
* Removes a database collection from the file system.
|
|
110
118
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import genId from "./gen.js";
|
|
2
|
+
export async function addId(query, actions, defaultGen = true) {
|
|
3
|
+
const { collection, data } = query;
|
|
4
|
+
const id_gen = query.id_gen ?? defaultGen;
|
|
5
|
+
if (!id_gen)
|
|
6
|
+
return data;
|
|
7
|
+
if (data._id)
|
|
8
|
+
return data;
|
|
9
|
+
const { numberId } = actions;
|
|
10
|
+
if (!numberId) {
|
|
11
|
+
data._id = genId();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const find = await actions.findOne({ collection: "__vdb_id", search: { c: collection } });
|
|
15
|
+
data._id = find ? find.i + 1 : 1;
|
|
16
|
+
await actions.updateOneOrAdd({
|
|
17
|
+
collection: "__vdb_id",
|
|
18
|
+
search: { c: collection },
|
|
19
|
+
updater: {
|
|
20
|
+
$inc: { i: 1 }
|
|
21
|
+
},
|
|
22
|
+
id_gen: false,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -8,7 +8,7 @@ interface Task {
|
|
|
8
8
|
* A simple executor for queuing and executing asynchronous operations sequentially.
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
|
-
declare class
|
|
11
|
+
declare class ExecutorC {
|
|
12
12
|
quote: Task[];
|
|
13
13
|
isExecuting: boolean;
|
|
14
14
|
/**
|
|
@@ -25,4 +25,5 @@ declare class executorC {
|
|
|
25
25
|
*/
|
|
26
26
|
execute(): Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
export default
|
|
28
|
+
export default ExecutorC;
|
|
29
|
+
export { ExecutorC as executorC };
|
package/dist/helpers/executor.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A simple executor for queuing and executing asynchronous operations sequentially.
|
|
3
3
|
* @class
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
class ExecutorC {
|
|
6
6
|
quote;
|
|
7
7
|
isExecuting;
|
|
8
8
|
/**
|
|
@@ -42,4 +42,5 @@ class executorC {
|
|
|
42
42
|
this.isExecuting = false;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
export default
|
|
45
|
+
export default ExecutorC;
|
|
46
|
+
export { ExecutorC as executorC };
|
package/dist/helpers/relation.js
CHANGED
|
@@ -111,7 +111,7 @@ async function processRelations(dbs, cfg, data, parentList = null) {
|
|
|
111
111
|
const pivotDb = dbs[through.db || dbKey];
|
|
112
112
|
const pivots = await pivotDb.find(through.table, { [through.pk]: item[pk] });
|
|
113
113
|
const ids = pivots.map(p => p[through.fk]);
|
|
114
|
-
const related = await db.find(coll, { $in: { [fk]: ids } }, {}, {
|
|
114
|
+
const related = await db.find(coll, { $in: { [fk]: ids } }, {}, { select });
|
|
115
115
|
item[as] = related;
|
|
116
116
|
if (rel.relations) {
|
|
117
117
|
await Promise.all(related.map(row => processRelations(dbs, rel.relations, row)));
|
package/dist/types/fileCpu.d.ts
CHANGED
|
@@ -13,39 +13,39 @@ interface FileCpu {
|
|
|
13
13
|
/**
|
|
14
14
|
* Asynchronously finds multiple entries in a file based on search criteria.
|
|
15
15
|
* @param file The path to the file.
|
|
16
|
-
* @param
|
|
16
|
+
* @param search The search criteria.
|
|
17
17
|
* @param context Additional context for the search.
|
|
18
18
|
* @param findOpts Additional options for searching.
|
|
19
19
|
* @returns A promise resolving to an array of found entries, or `false` if the file does not exist.
|
|
20
20
|
*/
|
|
21
|
-
find(file: string,
|
|
21
|
+
find(file: string, search: Search, context?: VContext, findOpts?: FindOpts): Promise<any[] | false>;
|
|
22
22
|
/**
|
|
23
23
|
* Asynchronously finds one entry in a file based on search criteria.
|
|
24
24
|
* @param file The path to the file.
|
|
25
|
-
* @param
|
|
25
|
+
* @param search The search criteria.
|
|
26
26
|
* @param context Additional context for the search.
|
|
27
27
|
* @param findOpts Additional options for searching.
|
|
28
28
|
* @returns A promise resolving to the found entry or `false` if not found.
|
|
29
29
|
*/
|
|
30
|
-
findOne(file: string,
|
|
30
|
+
findOne(file: string, search: Search, context?: VContext, findOpts?: FindOpts): Promise<any | false>;
|
|
31
31
|
/**
|
|
32
32
|
* Asynchronously removes entries from a file based on search criteria.
|
|
33
33
|
* @param file The path to the file.
|
|
34
|
-
* @param
|
|
34
|
+
* @param search The search criteria.
|
|
35
35
|
* @param context Additional context for the operation.
|
|
36
36
|
* @param one If `true`, removes only the first matching entry.
|
|
37
37
|
* @returns A promise resolving to `true` if at least one entry was removed, otherwise `false`.
|
|
38
38
|
*/
|
|
39
|
-
remove(file: string, one: boolean,
|
|
39
|
+
remove(file: string, one: boolean, search: Search, context?: VContext): Promise<boolean>;
|
|
40
40
|
/**
|
|
41
41
|
* Asynchronously updates entries in a file based on search criteria and an updater function or object.
|
|
42
42
|
* @param file The path to the file.
|
|
43
|
-
* @param
|
|
43
|
+
* @param search The search criteria.
|
|
44
44
|
* @param updater The updater function or object.
|
|
45
45
|
* @param context Additional context for the operation.
|
|
46
46
|
* @param one If `true`, updates only the first matching entry.
|
|
47
47
|
* @returns A promise resolving to `true` if at least one entry was updated, otherwise `false`.
|
|
48
48
|
*/
|
|
49
|
-
update(file: string, one: boolean,
|
|
49
|
+
update(file: string, one: boolean, search: Search, updater: Updater, context?: VContext): Promise<boolean>;
|
|
50
50
|
}
|
|
51
51
|
export default FileCpu;
|
package/dist/types/options.d.ts
CHANGED
package/dist/types/query.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export type ComparisonOperators<T = any> = {
|
|
|
33
33
|
$between?: PartialOfType<T, [number, number], number>;
|
|
34
34
|
$in?: Partial<Record<keyof T, T[keyof T][]>>;
|
|
35
35
|
$nin?: Partial<Record<keyof T, T[keyof T][]>>;
|
|
36
|
+
$idGt?: PartialOfType<T, string | number>;
|
|
37
|
+
$idLt?: PartialOfType<T, string | number>;
|
|
38
|
+
$idGte?: PartialOfType<T, string | number>;
|
|
39
|
+
$idLte?: PartialOfType<T, string | number>;
|
|
36
40
|
};
|
|
37
41
|
/** Type and Existence Operators */
|
|
38
42
|
export type TypeAndExistenceOperators<T = any> = {
|
package/dist/types/updater.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export type ArrayUpdater<T = any> = {
|
|
|
13
13
|
};
|
|
14
14
|
/** Objects */
|
|
15
15
|
export type ObjectUpdater<T = any> = {
|
|
16
|
-
$merge?: PartialOfType<T, any
|
|
16
|
+
$merge?: PartialOfType<T, any>;
|
|
17
|
+
$deepMerge?: PartialOfType<T, any>;
|
|
17
18
|
};
|
|
18
19
|
/** Values */
|
|
19
20
|
export type ValueUpdater<T = any> = {
|
|
@@ -21,5 +22,7 @@ export type ValueUpdater<T = any> = {
|
|
|
21
22
|
$dec?: PartialOfType<T, number>;
|
|
22
23
|
$unset?: PartialOfType<T, any>;
|
|
23
24
|
$rename?: PartialOfType<T, any>;
|
|
25
|
+
/** same as { name: value } */
|
|
26
|
+
$set?: PartialOfType<T, any>;
|
|
24
27
|
};
|
|
25
28
|
export type UpdaterArg<T = any> = ArrayUpdater<T> & ObjectUpdater<T> & ValueUpdater<T> & Arg<T>;
|
package/dist/utils/action.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareSafe } from "./
|
|
1
|
+
import { compareSafe } from "./compare.js";
|
|
2
2
|
export async function findUtil(query, fileCpu, files) {
|
|
3
3
|
const { search, context = {}, dbFindOpts = {}, findOpts = {} } = query;
|
|
4
4
|
const { reverse = false, max = -1, offset = 0, sortBy, sortAsc = true } = dbFindOpts;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import hasFields from "./hasFields.js";
|
|
2
|
+
import { compareIds } from "./id.js";
|
|
2
3
|
/**
|
|
3
4
|
* Checks if an object meets the criteria specified in the fields with operators.
|
|
4
5
|
*/
|
|
@@ -6,161 +7,66 @@ export default function hasFieldsAdvanced(obj, fields) {
|
|
|
6
7
|
if (typeof fields !== "object" || fields === null) {
|
|
7
8
|
throw new Error("Fields must be an object");
|
|
8
9
|
}
|
|
10
|
+
if (Object.keys(fields).length === 0)
|
|
11
|
+
return true;
|
|
9
12
|
if ("$and" in fields) {
|
|
10
|
-
return fields["$and"].every(subFields => hasFieldsAdvanced(obj, subFields));
|
|
13
|
+
return fields["$and"].every((subFields) => hasFieldsAdvanced(obj, subFields));
|
|
11
14
|
}
|
|
12
15
|
if ("$or" in fields) {
|
|
13
|
-
return fields["$or"].some(subFields => hasFieldsAdvanced(obj, subFields));
|
|
16
|
+
return fields["$or"].some((subFields) => hasFieldsAdvanced(obj, subFields));
|
|
14
17
|
}
|
|
15
18
|
// Check various conditions
|
|
16
19
|
if (!checkConditions(obj, fields))
|
|
17
20
|
return false;
|
|
18
|
-
const fieldsSubset =
|
|
21
|
+
const fieldsSubset = { ...fields };
|
|
22
|
+
Object.keys(fieldsSubset).filter(key => key.startsWith("$")).forEach(key => delete fieldsSubset[key]);
|
|
23
|
+
if (!Object.keys(fieldsSubset).length)
|
|
24
|
+
return true;
|
|
19
25
|
return hasFields(obj, fieldsSubset);
|
|
20
26
|
}
|
|
21
|
-
function removeAdvancedOperators(fields) {
|
|
22
|
-
const advancedOperators = [
|
|
23
|
-
"and", "or",
|
|
24
|
-
"gt", "lt", "gte", "lte", "in", "nin",
|
|
25
|
-
"exists",
|
|
26
|
-
"type",
|
|
27
|
-
"regex",
|
|
28
|
-
"arrinc", "arrincall", "size",
|
|
29
|
-
"startsWith", "endsWith",
|
|
30
|
-
"between",
|
|
31
|
-
"not",
|
|
32
|
-
"subset"
|
|
33
|
-
].map(operator => "$" + operator);
|
|
34
|
-
advancedOperators.forEach(operator => delete fields[operator]);
|
|
35
|
-
return fields;
|
|
36
|
-
}
|
|
37
27
|
function checkConditions(obj, fields) {
|
|
38
|
-
return (
|
|
39
|
-
checkExistence(obj, fields) &&
|
|
40
|
-
checkType(obj, fields) &&
|
|
41
|
-
checkRegex(obj, fields) &&
|
|
42
|
-
checkArrayConditions(obj, fields) &&
|
|
43
|
-
checkStringConditions(obj, fields) &&
|
|
44
|
-
checkBetween(obj, fields) &&
|
|
28
|
+
return (mainCheck(obj, fields) &&
|
|
45
29
|
checkNot(obj, fields) &&
|
|
46
30
|
checkSubset(obj, fields));
|
|
47
31
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
break;
|
|
59
|
-
case "$lt":
|
|
60
|
-
if (!(obj[key] < value))
|
|
61
|
-
return false;
|
|
62
|
-
break;
|
|
63
|
-
case "$gte":
|
|
64
|
-
if (!(obj[key] >= value))
|
|
65
|
-
return false;
|
|
66
|
-
break;
|
|
67
|
-
case "$lte":
|
|
68
|
-
if (!(obj[key] <= value))
|
|
69
|
-
return false;
|
|
70
|
-
break;
|
|
71
|
-
case "$in":
|
|
72
|
-
if (!value.includes(obj[key]))
|
|
73
|
-
return false;
|
|
74
|
-
break;
|
|
75
|
-
case "$nin":
|
|
76
|
-
if (value.includes(obj[key]))
|
|
77
|
-
return false;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
function checkExistence(obj, fields) {
|
|
86
|
-
if ("$exists" in fields) {
|
|
87
|
-
for (const [key, shouldExist] of Object.entries(fields["$exists"])) {
|
|
32
|
+
function mainCheck(obj, fields) {
|
|
33
|
+
return _for(fields, obj, {
|
|
34
|
+
gt: (data, value) => data > value,
|
|
35
|
+
lt: (data, value) => data < value,
|
|
36
|
+
gte: (data, value) => data >= value,
|
|
37
|
+
lte: (data, value) => data <= value,
|
|
38
|
+
in: (data, value) => value.includes(data),
|
|
39
|
+
nin: (data, value) => !value.includes(data),
|
|
40
|
+
type: (data, value) => typeof data === value,
|
|
41
|
+
exists: (_, shouldExist, key) => {
|
|
88
42
|
if (shouldExist && !(key in obj))
|
|
89
43
|
return false;
|
|
90
44
|
if (!shouldExist && (key in obj))
|
|
91
45
|
return false;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
function checkType(obj, fields) {
|
|
97
|
-
if ("$type" in fields) {
|
|
98
|
-
for (const [key, type] of Object.entries(fields["$type"])) {
|
|
99
|
-
if (typeof obj[key] !== type)
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
function checkRegex(obj, fields) {
|
|
106
|
-
if ("$regex" in fields) {
|
|
107
|
-
for (const [key, regexData] of Object.entries(fields["$regex"])) {
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
regex: (data, regexData) => {
|
|
108
49
|
const regex = typeof regexData === "string" ? new RegExp(regexData) : regexData;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
function checkArrayConditions(obj, fields) {
|
|
116
|
-
if ("$arrinc" in fields) {
|
|
117
|
-
for (const [key, values] of Object.entries(fields["$arrinc"])) {
|
|
118
|
-
if (!Array.isArray(obj[key]) || !values.some(val => obj[key].includes(val)))
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if ("$arrincall" in fields) {
|
|
123
|
-
for (const [key, values] of Object.entries(fields["$arrincall"])) {
|
|
124
|
-
if (!Array.isArray(obj[key]) || !values.every(val => obj[key].includes(val)))
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if ("$size" in fields) {
|
|
129
|
-
for (const [key, size] of Object.entries(fields["$size"])) {
|
|
130
|
-
if (Array.isArray(obj[key]) || typeof obj[key] === "string") {
|
|
131
|
-
if (obj[key].length !== size)
|
|
132
|
-
return false;
|
|
50
|
+
return regex.test(data);
|
|
51
|
+
},
|
|
52
|
+
size: (data, size) => {
|
|
53
|
+
if (Array.isArray(data) || typeof data === "string") {
|
|
54
|
+
return data.length === size;
|
|
133
55
|
}
|
|
134
56
|
else {
|
|
135
57
|
return false;
|
|
136
58
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
if ("$endsWith" in fields) {
|
|
149
|
-
for (const [key, value] of Object.entries(fields["$endsWith"])) {
|
|
150
|
-
if (typeof obj[key] !== "string" || !obj[key].endsWith(value))
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
function checkBetween(obj, fields) {
|
|
157
|
-
if ("$between" in fields) {
|
|
158
|
-
for (const [key, [min, max]] of Object.entries(fields["$between"])) {
|
|
159
|
-
if (typeof obj[key] !== "number" || obj[key] < min || obj[key] > max)
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return true;
|
|
59
|
+
},
|
|
60
|
+
startsWith: (data, value) => typeof data === "string" && data.startsWith(value),
|
|
61
|
+
endsWith: (data, value) => typeof data === "string" && data.endsWith(value),
|
|
62
|
+
between: (data, [min, max]) => typeof data === "number" && data >= min && data <= max,
|
|
63
|
+
arrinc: (data, values) => Array.isArray(data) && values.some((val) => data.includes(val)),
|
|
64
|
+
arrincall: (data, values) => Array.isArray(data) && values.every((val) => data.includes(val)),
|
|
65
|
+
idGt: (data, value) => compareIds(data, value) > 0,
|
|
66
|
+
idLt: (data, value) => compareIds(data, value) < 0,
|
|
67
|
+
idGte: (data, value) => compareIds(data, value) >= 0,
|
|
68
|
+
idLte: (data, value) => compareIds(data, value) <= 0,
|
|
69
|
+
});
|
|
164
70
|
}
|
|
165
71
|
function checkNot(obj, fields) {
|
|
166
72
|
if ("$not" in fields) {
|
|
@@ -175,3 +81,15 @@ function checkSubset(obj, fields) {
|
|
|
175
81
|
}
|
|
176
82
|
return true;
|
|
177
83
|
}
|
|
84
|
+
function _for(fields, obj, opts) {
|
|
85
|
+
for (const [fieldRaw, fieldFn] of Object.entries(opts)) {
|
|
86
|
+
const field = "$" + fieldRaw;
|
|
87
|
+
if (field in fields) {
|
|
88
|
+
for (const [key, value] of Object.entries(fields[field])) {
|
|
89
|
+
if (!fieldFn(obj?.[key], value, key))
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
package/dist/utils/id.d.ts
CHANGED
package/dist/utils/id.js
CHANGED
|
@@ -2,7 +2,14 @@ export function convertIdToUnix(id) {
|
|
|
2
2
|
return parseInt(id.split("-")[0], 36);
|
|
3
3
|
}
|
|
4
4
|
export function sortByIds(objects) {
|
|
5
|
-
return objects.slice().sort((a, b) =>
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
return objects.slice().sort((a, b) => compareIds(a._id, b._id));
|
|
6
|
+
}
|
|
7
|
+
export function compareIds(a, b) {
|
|
8
|
+
if (typeof a === "string" && typeof b === "string")
|
|
9
|
+
return convertIdToUnix(a) - convertIdToUnix(b) || a.localeCompare(b);
|
|
10
|
+
if (typeof a === "number" && typeof b === "number")
|
|
11
|
+
return a - b;
|
|
12
|
+
const timeA = typeof a === "string" ? convertIdToUnix(a) : a;
|
|
13
|
+
const timeB = typeof b === "string" ? convertIdToUnix(b) : b;
|
|
14
|
+
return timeA - timeB;
|
|
8
15
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepMerge(target: any, source: any): any;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function deepMerge(target, source) {
|
|
2
|
+
const output = { ...target };
|
|
3
|
+
if (isObject(target) && isObject(source)) {
|
|
4
|
+
for (const key in source) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6
|
+
if (isObject(source[key])) {
|
|
7
|
+
if (!target[key]) {
|
|
8
|
+
output[key] = {};
|
|
9
|
+
}
|
|
10
|
+
output[key] = deepMerge(target[key], source[key]);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
output[key] = source[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return output;
|
|
19
|
+
}
|
|
20
|
+
function isObject(item) {
|
|
21
|
+
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
22
|
+
}
|
|
@@ -2,6 +2,6 @@ import { UpdaterArg } from "../types/updater.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Updates an object with new values.
|
|
4
4
|
* @param obj - The object to update.
|
|
5
|
-
* @param
|
|
5
|
+
* @param field - An object containing new values to update in the target object.
|
|
6
6
|
*/
|
|
7
|
-
export default function updateObjectAdvanced(obj: Object,
|
|
7
|
+
export default function updateObjectAdvanced(obj: Object, field: UpdaterArg): Object;
|
|
@@ -1,117 +1,86 @@
|
|
|
1
|
+
import { deepMerge } from "./merge.js";
|
|
1
2
|
/**
|
|
2
3
|
* Updates an object with new values.
|
|
3
4
|
* @param obj - The object to update.
|
|
4
|
-
* @param
|
|
5
|
+
* @param field - An object containing new values to update in the target object.
|
|
5
6
|
*/
|
|
6
|
-
export default function updateObjectAdvanced(obj,
|
|
7
|
-
if (typeof
|
|
7
|
+
export default function updateObjectAdvanced(obj, field) {
|
|
8
|
+
if (typeof field !== "object" || field === null) {
|
|
8
9
|
throw new Error("Fields must be an object or object array");
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (typeof field !== "object" || field === null) {
|
|
13
|
-
throw new Error("Fields must be an object or object array");
|
|
14
|
-
}
|
|
15
|
-
updateAdvanced(obj, field);
|
|
16
|
-
const fieldsSubset = removeAdvancedOperators({ ...field });
|
|
17
|
-
updateObject(obj, fieldsSubset);
|
|
11
|
+
if (typeof field !== "object" || field === null) {
|
|
12
|
+
throw new Error("Fields must be an object or object array");
|
|
18
13
|
}
|
|
14
|
+
updateAdvanced(obj, field);
|
|
15
|
+
const fieldsSubset = { ...field };
|
|
16
|
+
Object.keys(fieldsSubset).filter(key => key.startsWith("$")).forEach(key => delete fieldsSubset[key]);
|
|
17
|
+
updateObject(obj, fieldsSubset);
|
|
19
18
|
return obj;
|
|
20
19
|
}
|
|
21
20
|
function updateAdvanced(obj, fields) {
|
|
22
|
-
|
|
23
|
-
updateNested(obj, fields);
|
|
24
|
-
updateIncrement(obj, fields);
|
|
21
|
+
mainUpdate(obj, fields);
|
|
25
22
|
updateUnset(obj, fields);
|
|
26
|
-
updateRename(obj, fields);
|
|
27
|
-
}
|
|
28
|
-
function removeAdvancedOperators(fields) {
|
|
29
|
-
const advancedOperators = [
|
|
30
|
-
"push", "pushset", "pull", "pullall",
|
|
31
|
-
"inc", "dec",
|
|
32
|
-
"unset",
|
|
33
|
-
"merge",
|
|
34
|
-
"rename"
|
|
35
|
-
].map(operator => "$" + operator);
|
|
36
|
-
advancedOperators.forEach(operator => delete fields[operator]);
|
|
37
|
-
return fields;
|
|
38
|
-
}
|
|
39
|
-
function updateArray(obj, fields) {
|
|
40
|
-
if ("$push" in fields) {
|
|
41
|
-
for (const [key, value] of Object.entries(fields["$push"])) {
|
|
42
|
-
if (Array.isArray(obj[key])) {
|
|
43
|
-
obj[key].push(value);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
obj[key] = [value];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if ("$pushset" in fields) {
|
|
51
|
-
for (const [key, value] of Object.entries(fields["$pushset"])) {
|
|
52
|
-
if (Array.isArray(obj[key])) {
|
|
53
|
-
obj[key].push(value);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
obj[key] = [value];
|
|
57
|
-
}
|
|
58
|
-
obj[key] = [...new Set(obj[key])];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if ("$pull" in fields) {
|
|
62
|
-
for (const [key, value] of Object.entries(fields["$pull"])) {
|
|
63
|
-
if (Array.isArray(obj[key])) {
|
|
64
|
-
obj[key] = obj[key].filter(item => item !== value);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if ("$pullall" in fields) {
|
|
69
|
-
for (const [key, values] of Object.entries(fields["$pullall"])) {
|
|
70
|
-
if (Array.isArray(obj[key])) {
|
|
71
|
-
obj[key] = obj[key].filter(item => !values.includes(item));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
23
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
24
|
+
function mainUpdate(obj, fields) {
|
|
25
|
+
_for(fields, obj, {
|
|
26
|
+
push: (item, updater) => {
|
|
27
|
+
if (Array.isArray(item)) {
|
|
28
|
+
item.push(updater);
|
|
29
|
+
return item;
|
|
81
30
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
function updateIncrement(obj, fields) {
|
|
89
|
-
if ("$inc" in fields) {
|
|
90
|
-
for (const [key, value] of Object.entries(fields["$inc"])) {
|
|
91
|
-
if (typeof obj[key] === "number" && typeof value === "number") {
|
|
92
|
-
obj[key] += value;
|
|
31
|
+
return [updater];
|
|
32
|
+
},
|
|
33
|
+
pushSet: (item, updater) => {
|
|
34
|
+
if (Array.isArray(item)) {
|
|
35
|
+
item.push(updater);
|
|
36
|
+
return [...new Set(item)];
|
|
93
37
|
}
|
|
94
|
-
|
|
95
|
-
|
|
38
|
+
return [updater];
|
|
39
|
+
},
|
|
40
|
+
pull: (item, updater) => {
|
|
41
|
+
if (Array.isArray(item))
|
|
42
|
+
return item.filter(i => i !== updater);
|
|
43
|
+
},
|
|
44
|
+
pullall: (item, updater) => {
|
|
45
|
+
if (Array.isArray(item))
|
|
46
|
+
return item.filter(i => !updater.includes(i));
|
|
47
|
+
},
|
|
48
|
+
merge: (item, updater) => {
|
|
49
|
+
if (typeof item === "object" && typeof updater === "object") {
|
|
50
|
+
return { ...item, ...updater };
|
|
96
51
|
}
|
|
97
|
-
|
|
98
|
-
|
|
52
|
+
return updater;
|
|
53
|
+
},
|
|
54
|
+
deepMerge: (item, updater) => {
|
|
55
|
+
if (typeof item === "object" && typeof updater === "object") {
|
|
56
|
+
return deepMerge(item, updater);
|
|
99
57
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
obj[key] -= value;
|
|
58
|
+
return updater;
|
|
59
|
+
},
|
|
60
|
+
inc: (item, updater, key) => {
|
|
61
|
+
if (typeof item === "number" && typeof updater === "number") {
|
|
62
|
+
return item + updater;
|
|
106
63
|
}
|
|
107
|
-
|
|
108
|
-
|
|
64
|
+
if (!(key in obj))
|
|
65
|
+
return updater;
|
|
66
|
+
throw new Error(`Cannot increment non-numeric value at key: ${key}`);
|
|
67
|
+
},
|
|
68
|
+
dec: (item, updater, key) => {
|
|
69
|
+
if (typeof item === "number" && typeof updater === "number") {
|
|
70
|
+
return item - updater;
|
|
109
71
|
}
|
|
110
|
-
|
|
111
|
-
|
|
72
|
+
if (!(key in obj))
|
|
73
|
+
return -updater;
|
|
74
|
+
throw new Error(`Cannot decrement non-numeric value at key: ${key}`);
|
|
75
|
+
},
|
|
76
|
+
rename: (_, newKey, oldKey) => {
|
|
77
|
+
if (oldKey in obj) {
|
|
78
|
+
obj[newKey] = obj[oldKey];
|
|
79
|
+
delete obj[oldKey];
|
|
112
80
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
81
|
+
},
|
|
82
|
+
set: (_, value) => value
|
|
83
|
+
});
|
|
115
84
|
}
|
|
116
85
|
function updateUnset(obj, fields) {
|
|
117
86
|
if ("$unset" in fields) {
|
|
@@ -120,16 +89,6 @@ function updateUnset(obj, fields) {
|
|
|
120
89
|
}
|
|
121
90
|
}
|
|
122
91
|
}
|
|
123
|
-
function updateRename(obj, fields) {
|
|
124
|
-
if ("$rename" in fields) {
|
|
125
|
-
for (const [oldKey, newKey] of Object.entries(fields["$rename"])) {
|
|
126
|
-
if (oldKey in obj) {
|
|
127
|
-
obj[newKey] = obj[oldKey];
|
|
128
|
-
delete obj[oldKey];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
92
|
/**
|
|
134
93
|
* Updates an object with new values.
|
|
135
94
|
* @param obj - The object to update.
|
|
@@ -143,3 +102,15 @@ function updateObject(obj, newVal) {
|
|
|
143
102
|
}
|
|
144
103
|
return obj;
|
|
145
104
|
}
|
|
105
|
+
function _for(fields, obj, opts) {
|
|
106
|
+
for (const [fieldRaw, fieldFn] of Object.entries(opts)) {
|
|
107
|
+
const field = "$" + fieldRaw;
|
|
108
|
+
if (field in fields) {
|
|
109
|
+
for (const [key, value] of Object.entries(fields[field])) {
|
|
110
|
+
const res = fieldFn(obj?.[key], value, key);
|
|
111
|
+
if (res !== undefined)
|
|
112
|
+
obj[key] = res;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.2.
|
|
1
|
+
export const version = "0.2.8";
|
package/package.json
CHANGED
|
@@ -1,41 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "@wxn0brp/db-core",
|
|
3
|
+
"version": "0.2.8",
|
|
4
|
+
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"author": "wxn0brP",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"description": "ValtheraDB Core",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/wxn0brP/ValtheraDB-core.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/wxn0brP/ValtheraDB",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@wxn0brp/event-emitter": "^0.0.3"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/bun": "*",
|
|
20
|
+
"@types/node": "*",
|
|
21
|
+
"tsc-alias": "*",
|
|
22
|
+
"typescript": "*"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
13
32
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@wxn0brp/event-emitter": "^0.0.3"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/node": "*",
|
|
23
|
-
"tsc-alias": "*",
|
|
24
|
-
"typescript": "*"
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"dist"
|
|
28
|
-
],
|
|
29
|
-
"exports": {
|
|
30
|
-
".": {
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.js",
|
|
33
|
-
"default": "./dist/index.js"
|
|
34
|
-
},
|
|
35
|
-
"./*": {
|
|
36
|
-
"types": "./dist/*.d.ts",
|
|
37
|
-
"import": "./dist/*.js",
|
|
38
|
-
"default": "./dist/*.js"
|
|
39
|
-
}
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./dist/*.d.ts",
|
|
35
|
+
"import": "./dist/*.js",
|
|
36
|
+
"default": "./dist/*.js"
|
|
40
37
|
}
|
|
38
|
+
}
|
|
41
39
|
}
|
|
File without changes
|
|
File without changes
|