unconventional 1.0.3 → 1.1.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.
|
@@ -15,7 +15,7 @@ export declare class BaseModel extends Document {
|
|
|
15
15
|
static keyField?: string;
|
|
16
16
|
static ownerField?: string;
|
|
17
17
|
static db: DB;
|
|
18
|
-
id: number;
|
|
18
|
+
id: number | string;
|
|
19
19
|
static create<T extends typeof BaseModel>(this: T, data: Partial<InstanceType<T>>, upsertConfig?: UpsertConfig<T>): Promise<InstanceType<T> | null>;
|
|
20
20
|
static createMany<T extends typeof BaseModel>(this: T, data: Partial<InstanceType<T>>[], upsertConfig?: UpsertConfig<T>): Promise<InstanceType<T>[] | null>;
|
|
21
21
|
static findById<T extends typeof BaseModel>(this: T, id: string | number, config?: FilterConfig): Promise<InstanceType<T> | null>;
|
package/dist/core/base.model.js
CHANGED
|
@@ -180,7 +180,7 @@ class BaseModel extends Document {
|
|
|
180
180
|
exports.BaseModel = BaseModel;
|
|
181
181
|
__decorate([
|
|
182
182
|
(0, prop_decorator_1.prop)({ required: true, unique: true }),
|
|
183
|
-
__metadata("design:type",
|
|
183
|
+
__metadata("design:type", Object)
|
|
184
184
|
], BaseModel.prototype, "id", void 0);
|
|
185
185
|
let TimeStamped = class TimeStamped extends BaseModel {
|
|
186
186
|
createdAt;
|
|
@@ -6,15 +6,16 @@ const equalArrays = (a, b) => {
|
|
|
6
6
|
if (a.length !== b.length)
|
|
7
7
|
return false;
|
|
8
8
|
const clone = [...b];
|
|
9
|
-
for (const
|
|
10
|
-
const idx =
|
|
11
|
-
if (idx > -1)
|
|
12
|
-
clone.splice(idx, 1);
|
|
9
|
+
for (const item of a) {
|
|
10
|
+
const idx = clone.indexOf(item); // Use clone here for checking
|
|
11
|
+
if (idx > -1) {
|
|
12
|
+
clone.splice(idx, 1); // Correctly removes the item from clone
|
|
13
|
+
}
|
|
13
14
|
else {
|
|
14
|
-
|
|
15
|
+
return false; // If an item is not found, arrays are not equal
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
return clone.length === 0;
|
|
18
|
+
return clone.length === 0; // If clone is empty, arrays are equal
|
|
18
19
|
};
|
|
19
20
|
exports.equalArrays = equalArrays;
|
|
20
21
|
/** Checks whether an object has no keys and/or the value for every key is undefined */
|