@goatlab/fluent 0.9.22 → 0.9.24
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/BaseConnector.js +13 -13
- package/dist/TypeOrmConnector/TypeOrmConnector.d.ts +1 -1
- package/dist/TypeOrmConnector/TypeOrmConnector.js +23 -23
- package/dist/TypeOrmConnector/TypeOrmConnector.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.d.ts +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js +33 -33
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoBaseAggregations.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.d.ts +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.js +5 -5
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoFindAggregatedQuery.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoOrderBy.js +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.d.ts +1 -1
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js +2 -2
- package/dist/TypeOrmConnector/queryBuilder/mongodb/getMongoWhere.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.d.ts +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js +28 -28
- package/dist/TypeOrmConnector/queryBuilder/sql/getQueryBuilderWhere.js.map +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.d.ts +1 -1
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js +23 -23
- package/dist/TypeOrmConnector/queryBuilder/sql/getTypeOrmWhere.js.map +1 -1
- package/dist/TypeOrmConnector/test/advanced/typeOrm.entity.js +3 -3
- package/dist/TypeOrmConnector/test/basic/goat.entity.js +3 -3
- package/dist/TypeOrmConnector/test/flock.js +6 -6
- package/dist/TypeOrmConnector/util/extractConditions.js +6 -6
- package/dist/TypeOrmConnector/util/extractMetadataFromKeys.js +2 -2
- package/dist/TypeOrmConnector/util/getRelationsFromModelGenerator.js +2 -2
- package/dist/core/Loopback/build-schema.js +7 -7
- package/dist/core/Loopback/common-types.js +3 -3
- package/dist/core/Loopback/common-types.js.map +1 -1
- package/dist/core/Loopback/json-to-schema.js +1 -1
- package/dist/core/Loopback/model.js +4 -4
- package/dist/core/Nestjs/types/decorators/api-property.decorator.js +5 -5
- package/dist/core/Nestjs/types/decorators/apply-is-optional.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/args-type.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/create-property.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/directive.decorator.js +2 -2
- package/dist/core/Nestjs/types/decorators/extensions.decorator.js +2 -2
- package/dist/core/Nestjs/types/decorators/field.decorator.js +3 -3
- package/dist/core/Nestjs/types/decorators/input-type.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/interface-type.decorator.js +1 -1
- package/dist/core/Nestjs/types/decorators/partial-type.helper.js +1 -1
- package/dist/core/Nestjs/types/lazy-metadata.storage.js +1 -1
- package/dist/core/Nestjs/types/object-type.decorator.js +1 -1
- package/dist/core/Nestjs/types/reflection.utils.js +4 -4
- package/dist/core/Nestjs/types/reflection.utils.js.map +1 -1
- package/dist/core/Nestjs/types/type-metadata.storage.js +5 -5
- package/dist/core/Nestjs/types/utils/get-fields-and-decorator.util.js +6 -6
- package/dist/core/Nestjs/types/utils/mapped-types.utils.js +2 -2
- package/dist/core/Nestjs/types/utils/mapped-types.utils.js.map +1 -1
- package/dist/decorators.d.ts +3 -3
- package/dist/decorators.js +17 -24
- package/dist/decorators.js.map +1 -1
- package/dist/generatorDatasource.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/loadRelations.d.ts +1 -1
- package/dist/loadRelations.js +15 -15
- package/dist/loadRelations.js.map +1 -1
- package/dist/testing/genericUnifiedTestSuite.js +20 -20
- package/dist/testing/unifiedTestFactory.js +25 -25
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
package/dist/decorators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;;AAAA,gDAAuC;AACvC,qCAAmC;AACnC,qCAegB;AAChB,mEAA+D;AAC/D,oFAAsE;AACtE,wCAKqB;AAmCrB,MAAa,eAAe;IAC1B;;;OAGG;IACI,EAAE;QACP,OAAO,IAAA,iCAAe,EACpB,IAAA,wBAAc,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAsB,EACrD,IAAA,gCAAsB,EAAC,MAAM,CAAsB,EACnD,IAAA,mBAAW,GAAE,EACb,IAAA,uBAAK,EAAC,GAAG,EAAE,CAAC,mBAAS,CAAC
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;;AAAA,gDAAuC;AACvC,qCAAmC;AACnC,qCAegB;AAChB,mEAA+D;AAC/D,oFAAsE;AACtE,wCAKqB;AAmCrB,MAAa,eAAe;IAC1B;;;OAGG;IACI,EAAE;QACP,OAAO,IAAA,iCAAe,EACpB,IAAA,wBAAc,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAsB,EACrD,IAAA,gCAAsB,EAAC,MAAM,CAAsB,EACnD,IAAA,mBAAW,GAAE,EACb,IAAA,uBAAK,EAAC,GAAG,EAAE,CAAC,mBAAS,CAAC,CAGvB,CAAA;IACH,CAAC;IAEM,OAAO;QACZ,OAAO,IAAA,iCAAe,EACpB,IAAA,wBAAc,GAAuB;QACrC,uDAAuD;QACvD,IAAA,mBAAW,GAAE,EACb,IAAA,uBAAK,EAAC,GAAG,EAAE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,EACN,OAAO,GACa;QACpB,OAAO,IAAA,iCAAe,EAAC,IAAA,mBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACpD,CAAC;CACF;AA5MD,0CA4MC;AAEY,QAAA,CAAC,GAAG,IAAI,eAAe,EAAE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,17 +22,17 @@ import type { AnyObject, Deleted, FindByIdFilter, FluentQuery, LoadedResult, Pag
|
|
|
22
22
|
import { LogicOperator } from './types';
|
|
23
23
|
export type { Relation } from 'typeorm';
|
|
24
24
|
export { DataSource } from 'typeorm';
|
|
25
|
-
export { TypeORMDataModel as TypeOrmEntity, type TypeORMDataModelInputSchema, TypeORMDataModelSchema } from './TypeOrmConnector/test/advanced/typeOrm.entity';
|
|
26
|
-
export { GoatEntity, type GoatInputSchema, GoatSchema } from './TypeOrmConnector/test/basic/goat.entity';
|
|
27
|
-
export type { TestConnector, UnifiedTestOptions } from './testing/unifiedTestFactory';
|
|
25
|
+
export { TypeORMDataModel as TypeOrmEntity, type TypeORMDataModelInputSchema, TypeORMDataModelSchema, } from './TypeOrmConnector/test/advanced/typeOrm.entity';
|
|
26
|
+
export { GoatEntity, type GoatInputSchema, GoatSchema, } from './TypeOrmConnector/test/basic/goat.entity';
|
|
27
|
+
export type { TestConnector, UnifiedTestOptions, } from './testing/unifiedTestFactory';
|
|
28
28
|
export { createUnifiedTests } from './testing/unifiedTestFactory';
|
|
29
29
|
export declare const Fluent: {
|
|
30
30
|
initialize: typeof initialize;
|
|
31
31
|
collect: typeof collect;
|
|
32
32
|
};
|
|
33
|
-
export { ApiHideProperty, ApiProperty, BaseConnector, Collection, Column, f, collect, initialize, getModelSchemaRef, getOutputKeys, HideField, InputType, loadRelations, modelGeneratorDataSource, ObjectType, OmitType, PartialType, TypeOrmConnector, Cache, getRelationsFromModelGenerator, LogicOperator, extractConditions, extractInclude, extractMetadataFromKeys, extractOrderBy, getSelectedKeysFromRawSql, nestQueryResults };
|
|
33
|
+
export { ApiHideProperty, ApiProperty, BaseConnector, Collection, Column, f, collect, initialize, getModelSchemaRef, getOutputKeys, HideField, InputType, loadRelations, modelGeneratorDataSource, ObjectType, OmitType, PartialType, TypeOrmConnector, Cache, getRelationsFromModelGenerator, LogicOperator, extractConditions, extractInclude, extractMetadataFromKeys, extractOrderBy, getSelectedKeysFromRawSql, nestQueryResults, };
|
|
34
34
|
interface ValidatedInput<T> {
|
|
35
35
|
errors: ValidationError[] | null;
|
|
36
36
|
result: Awaited<T>;
|
|
37
37
|
}
|
|
38
|
-
export type { AnyObject, Deleted, FluentConnectorInterface, PaginatedData, Paginator, Primitives, PrimitivesArray, SchemaObject, ValidatedInput, FluentQuery, QueryOutput, LoadedResult, FindByIdFilter };
|
|
38
|
+
export type { AnyObject, Deleted, FluentConnectorInterface, PaginatedData, Paginator, Primitives, PrimitivesArray, SchemaObject, ValidatedInput, FluentQuery, QueryOutput, LoadedResult, FindByIdFilter, };
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,6 @@ Object.defineProperty(exports, "createUnifiedTests", { enumerable: true, get: fu
|
|
|
60
60
|
// Export Fluent object for backward compatibility
|
|
61
61
|
exports.Fluent = {
|
|
62
62
|
initialize: Fluent_1.initialize,
|
|
63
|
-
collect: Fluent_1.collect
|
|
63
|
+
collect: Fluent_1.collect,
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=index.js.map
|
package/dist/loadRelations.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ interface RelationshipLoader {
|
|
|
8
8
|
self: any;
|
|
9
9
|
returnPivot?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare const loadRelations: ({ data, relations, modelRelations, provider, self }: RelationshipLoader) => Promise<any[]>;
|
|
11
|
+
export declare const loadRelations: ({ data, relations, modelRelations, provider, self, }: RelationshipLoader) => Promise<any[]>;
|
|
12
12
|
export {};
|
package/dist/loadRelations.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadRelations = void 0;
|
|
4
4
|
const js_utils_1 = require("@goatlab/js-utils");
|
|
5
|
-
const loadRelations = async ({ data, relations, modelRelations, provider, self }) => {
|
|
5
|
+
const loadRelations = async ({ data, relations, modelRelations, provider, self, }) => {
|
|
6
6
|
if (!relations) {
|
|
7
7
|
return data;
|
|
8
8
|
}
|
|
@@ -39,9 +39,9 @@ async function loadOneToManyRelation(data, relationModel, Repository, chunkSize)
|
|
|
39
39
|
const promises = chunks.map(relatedIds => Repository.findMany({
|
|
40
40
|
where: {
|
|
41
41
|
[relationModel.inverseSidePropertyPath]: {
|
|
42
|
-
in: relatedIds
|
|
43
|
-
}
|
|
44
|
-
}
|
|
42
|
+
in: relatedIds,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
45
|
}));
|
|
46
46
|
const relatedResults = js_utils_1.Arrays.collapse(await Promise.all(promises));
|
|
47
47
|
const grouped = js_utils_1.Arrays.groupBy(relatedResults, r => r[relationModel.inverseSidePropertyPath]);
|
|
@@ -58,9 +58,9 @@ async function loadManyToOneRelation(data, relationModel, Repository, chunkSize)
|
|
|
58
58
|
const promises = chunks.map(relatedIds => Repository.findMany({
|
|
59
59
|
where: {
|
|
60
60
|
id: {
|
|
61
|
-
in: relatedIds
|
|
62
|
-
}
|
|
63
|
-
}
|
|
61
|
+
in: relatedIds,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
64
|
}));
|
|
65
65
|
const relatedResults = js_utils_1.Arrays.collapse(await Promise.all(promises));
|
|
66
66
|
const grouped = js_utils_1.Arrays.groupBy(relatedResults, r => r.id);
|
|
@@ -103,16 +103,16 @@ function getPivotData(self, relationModel, Repository) {
|
|
|
103
103
|
pivotForeignField,
|
|
104
104
|
inverseForeignField,
|
|
105
105
|
pivotRepository,
|
|
106
|
-
calleeKey
|
|
106
|
+
calleeKey,
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
async function loadPivotResults(chunks, pivotForeignField, pivotRepository) {
|
|
110
110
|
const promises = chunks.map(pivotIds => pivotRepository.findMany({
|
|
111
111
|
where: {
|
|
112
112
|
[pivotForeignField]: {
|
|
113
|
-
in: pivotIds
|
|
114
|
-
}
|
|
115
|
-
}
|
|
113
|
+
in: pivotIds,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
116
|
}));
|
|
117
117
|
return js_utils_1.Arrays.collapse(await Promise.all(promises));
|
|
118
118
|
}
|
|
@@ -123,14 +123,14 @@ async function loadRelatedResults(pivotResults, relationModel, Repository, chunk
|
|
|
123
123
|
const relationPromises = relationChunks.map(relatedIds => Repository.findMany({
|
|
124
124
|
where: {
|
|
125
125
|
id: {
|
|
126
|
-
in: relatedIds
|
|
127
|
-
}
|
|
128
|
-
}
|
|
126
|
+
in: relatedIds,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
129
|
}));
|
|
130
130
|
const relatedResults = js_utils_1.Arrays.collapse(await Promise.all(relationPromises));
|
|
131
131
|
return relatedResults.map(r => ({
|
|
132
132
|
...r,
|
|
133
|
-
pivot: pivotResults.find(p => p[inverseForeignField] === r.id)
|
|
133
|
+
pivot: pivotResults.find(p => p[inverseForeignField] === r.id),
|
|
134
134
|
}));
|
|
135
135
|
}
|
|
136
136
|
function mapManyToManyResults(data, pivotResults, relatedResults, relationModel, calleeKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRelations.js","sourceRoot":"","sources":["../src/loadRelations.ts"],"names":[],"mappings":";;;AAAA,gDAA0C;AAcnC,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,IAAI,EACJ,SAAS,EACT,cAAc,EACd,QAAQ,EACR,IAAI,
|
|
1
|
+
{"version":3,"file":"loadRelations.js","sourceRoot":"","sources":["../src/loadRelations.ts"],"names":[],"mappings":";;;AAAA,gDAA0C;AAcnC,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,IAAI,EACJ,SAAS,EACT,cAAc,EACd,QAAQ,EACR,IAAI,G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
});
|
|
33
33
|
(0, vitest_1.expect)(typeof a.id).toBe('string');
|
|
34
34
|
(0, vitest_1.expect)(a.id).toBe(customId);
|
|
@@ -48,7 +48,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
48
48
|
(0, vitest_1.it)('findById - Should GET selected Data', async () => {
|
|
49
49
|
const goats = await GoatRepo.insertMany(flock_1.flock);
|
|
50
50
|
const goat = await GoatRepo.findById(goats[0].id, {
|
|
51
|
-
select: { name: true }
|
|
51
|
+
select: { name: true },
|
|
52
52
|
});
|
|
53
53
|
(0, vitest_1.expect)(goat?.name).toBe(goats[0].name);
|
|
54
54
|
(0, vitest_1.expect)(goat?.age).toBeUndefined();
|
|
@@ -61,7 +61,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
61
61
|
(0, vitest_1.it)('findByIds - Should GET selectedData', async () => {
|
|
62
62
|
const goats = await GoatRepo.insertMany(flock_1.flock);
|
|
63
63
|
const storedGoats = await GoatRepo.findByIds([goats[0].id, goats[1].id], {
|
|
64
|
-
select: { name: true }
|
|
64
|
+
select: { name: true },
|
|
65
65
|
});
|
|
66
66
|
(0, vitest_1.expect)(storedGoats[0]?.name).toBe(goats[0].name);
|
|
67
67
|
(0, vitest_1.expect)(storedGoats[0]?.age).toBeUndefined();
|
|
@@ -74,21 +74,21 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
74
74
|
(0, vitest_1.it)('findMany - Should FILTER data', async () => {
|
|
75
75
|
await GoatRepo.insertMany(flock_1.flock);
|
|
76
76
|
const goats = await GoatRepo.findMany({
|
|
77
|
-
where: { breed: { family: 'Angora' } }
|
|
77
|
+
where: { breed: { family: 'Angora' } },
|
|
78
78
|
});
|
|
79
79
|
(0, vitest_1.expect)(goats.length).toBe(2);
|
|
80
80
|
});
|
|
81
81
|
(0, vitest_1.it)('findMany - Should FILTER not existing data', async () => {
|
|
82
82
|
await GoatRepo.insertMany(flock_1.flock);
|
|
83
83
|
const goats = await GoatRepo.findMany({
|
|
84
|
-
where: { name: 'TESTESTEST' }
|
|
84
|
+
where: { name: 'TESTESTEST' },
|
|
85
85
|
});
|
|
86
86
|
(0, vitest_1.expect)(goats.length).toBe(0);
|
|
87
87
|
});
|
|
88
88
|
(0, vitest_1.it)('findMany - Should SELECT attributes', async () => {
|
|
89
89
|
await GoatRepo.insertMany(flock_1.flock);
|
|
90
90
|
const goats = await GoatRepo.findMany({
|
|
91
|
-
select: { name: true }
|
|
91
|
+
select: { name: true },
|
|
92
92
|
});
|
|
93
93
|
(0, vitest_1.expect)(goats[0]?.name).toBeDefined();
|
|
94
94
|
(0, vitest_1.expect)(goats[0]?.age).toBeUndefined();
|
|
@@ -103,7 +103,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
103
103
|
await GoatRepo.insertMany(flock_1.flock);
|
|
104
104
|
const goat = await GoatRepo.findFirst({
|
|
105
105
|
where: { breed: { family: 'Angora' } },
|
|
106
|
-
select: { name: true }
|
|
106
|
+
select: { name: true },
|
|
107
107
|
});
|
|
108
108
|
(0, vitest_1.expect)(goat?.name).toBeDefined();
|
|
109
109
|
(0, vitest_1.expect)(goat?.age).toBeUndefined();
|
|
@@ -151,7 +151,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
151
151
|
await TypeOrmRepo.insertMany([
|
|
152
152
|
{ test: true, order: 2 },
|
|
153
153
|
{ test: false, order: 3 },
|
|
154
|
-
{ test: true, order: 1 }
|
|
154
|
+
{ test: true, order: 1 },
|
|
155
155
|
]);
|
|
156
156
|
const plucked = await TypeOrmRepo.pluck('order');
|
|
157
157
|
(0, vitest_1.expect)(Array.isArray(plucked)).toBe(true);
|
|
@@ -163,7 +163,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
163
163
|
await TypeOrmRepo.insertMany([
|
|
164
164
|
{ test: true },
|
|
165
165
|
{ test: false },
|
|
166
|
-
{ test: true }
|
|
166
|
+
{ test: true },
|
|
167
167
|
]);
|
|
168
168
|
const results = await TypeOrmRepo.findMany({ limit: 2 });
|
|
169
169
|
(0, vitest_1.expect)(results.length).toBe(2);
|
|
@@ -172,11 +172,11 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
172
172
|
const _inserted = await TypeOrmRepo.insertMany([
|
|
173
173
|
{ test: true, order: 1 },
|
|
174
174
|
{ test: false, order: 2 },
|
|
175
|
-
{ test: true, order: 3 }
|
|
175
|
+
{ test: true, order: 3 },
|
|
176
176
|
]);
|
|
177
177
|
const results = await TypeOrmRepo.findMany({
|
|
178
178
|
offset: 1,
|
|
179
|
-
orderBy: [{ order: 'asc' }]
|
|
179
|
+
orderBy: [{ order: 'asc' }],
|
|
180
180
|
});
|
|
181
181
|
(0, vitest_1.expect)(results.length).toBe(2);
|
|
182
182
|
(0, vitest_1.expect)(results[0].order).toBe(2);
|
|
@@ -185,12 +185,12 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
185
185
|
await TypeOrmRepo.insertMany([
|
|
186
186
|
{ test: true, order: 1 },
|
|
187
187
|
{ test: false, order: 2 },
|
|
188
|
-
{ test: true, order: 3 }
|
|
188
|
+
{ test: true, order: 3 },
|
|
189
189
|
]);
|
|
190
190
|
const results = await TypeOrmRepo.findMany({
|
|
191
191
|
where: {
|
|
192
|
-
OR: [{ test: true }, { order: 2 }]
|
|
193
|
-
}
|
|
192
|
+
OR: [{ test: true }, { order: 2 }],
|
|
193
|
+
},
|
|
194
194
|
});
|
|
195
195
|
(0, vitest_1.expect)(results.length).toBe(3);
|
|
196
196
|
});
|
|
@@ -198,10 +198,10 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
198
198
|
await TypeOrmRepo.insertMany([
|
|
199
199
|
{ test: true, order: 2 },
|
|
200
200
|
{ test: false, order: 3 },
|
|
201
|
-
{ test: true, order: 1 }
|
|
201
|
+
{ test: true, order: 1 },
|
|
202
202
|
]);
|
|
203
203
|
const results = await TypeOrmRepo.findMany({
|
|
204
|
-
orderBy: [{ order: 'desc' }]
|
|
204
|
+
orderBy: [{ order: 'desc' }],
|
|
205
205
|
});
|
|
206
206
|
(0, vitest_1.expect)(results[0].order).toBe(3);
|
|
207
207
|
(0, vitest_1.expect)(results[1].order).toBe(2);
|
|
@@ -211,10 +211,10 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
211
211
|
await TypeOrmRepo.insertMany([
|
|
212
212
|
{ test: true, order: 2 },
|
|
213
213
|
{ test: false, order: 3 },
|
|
214
|
-
{ test: true, order: 1 }
|
|
214
|
+
{ test: true, order: 1 },
|
|
215
215
|
]);
|
|
216
216
|
const results = await TypeOrmRepo.findMany({
|
|
217
|
-
orderBy: [{ order: 'asc' }]
|
|
217
|
+
orderBy: [{ order: 'asc' }],
|
|
218
218
|
});
|
|
219
219
|
(0, vitest_1.expect)(results[0].order).toBe(1);
|
|
220
220
|
(0, vitest_1.expect)(results[1].order).toBe(2);
|
|
@@ -229,7 +229,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
229
229
|
const third = await TypeOrmRepo.insert({ test: true });
|
|
230
230
|
const results = await TypeOrmRepo.findMany({
|
|
231
231
|
orderBy: [{ created: 'desc' }],
|
|
232
|
-
select: { id: true, created: true }
|
|
232
|
+
select: { id: true, created: true },
|
|
233
233
|
});
|
|
234
234
|
(0, vitest_1.expect)(results[0]?.id).toBe(third.id);
|
|
235
235
|
(0, vitest_1.expect)(results[1]?.id).toBe(second.id);
|
|
@@ -243,7 +243,7 @@ const genericUnifiedTestSuite = (options) => {
|
|
|
243
243
|
await new Promise(resolve => setTimeout(resolve, 10));
|
|
244
244
|
const third = await TypeOrmRepo.insert({ test: true });
|
|
245
245
|
const results = await TypeOrmRepo.findMany({
|
|
246
|
-
orderBy: [{ created: 'desc' }]
|
|
246
|
+
orderBy: [{ created: 'desc' }],
|
|
247
247
|
});
|
|
248
248
|
(0, vitest_1.expect)(results[0]?.id).toBe(third.id);
|
|
249
249
|
(0, vitest_1.expect)(results[1]?.id).toBe(second.id);
|
|
@@ -12,7 +12,7 @@ exports.flock = [
|
|
|
12
12
|
active: true,
|
|
13
13
|
weight: 110.5,
|
|
14
14
|
balance: { id: 1234, value: 200 },
|
|
15
|
-
breed: { type: 'Sheep', family: 'Sheep' }
|
|
15
|
+
breed: { type: 'Sheep', family: 'Sheep' },
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: 'Baaah',
|
|
@@ -21,7 +21,7 @@ exports.flock = [
|
|
|
21
21
|
active: true,
|
|
22
22
|
weight: 130.5,
|
|
23
23
|
balance: { id: 1235, value: 200 },
|
|
24
|
-
breed: { type: 'Sheep', family: 'Sheep' }
|
|
24
|
+
breed: { type: 'Sheep', family: 'Sheep' },
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: 'Angor',
|
|
@@ -30,7 +30,7 @@ exports.flock = [
|
|
|
30
30
|
active: true,
|
|
31
31
|
weight: 105.5,
|
|
32
32
|
balance: { id: 1236, value: 200 },
|
|
33
|
-
breed: { type: 'Angora', family: 'Angora' }
|
|
33
|
+
breed: { type: 'Angora', family: 'Angora' },
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
name: 'Billy',
|
|
@@ -39,8 +39,8 @@ exports.flock = [
|
|
|
39
39
|
active: true,
|
|
40
40
|
weight: 140.0,
|
|
41
41
|
balance: { id: 1237, value: 200 },
|
|
42
|
-
breed: { type: 'Angora', family: 'Angora' }
|
|
43
|
-
}
|
|
42
|
+
breed: { type: 'Angora', family: 'Angora' },
|
|
43
|
+
},
|
|
44
44
|
];
|
|
45
45
|
function createUnifiedTests(options) {
|
|
46
46
|
const { createGoatConnector, createTypeOrmConnector, dbType } = options;
|
|
@@ -65,7 +65,7 @@ function createUnifiedTests(options) {
|
|
|
65
65
|
const a = await GoatRepo.insert({
|
|
66
66
|
id: customId,
|
|
67
67
|
name: 'myGoat',
|
|
68
|
-
age: 13
|
|
68
|
+
age: 13,
|
|
69
69
|
});
|
|
70
70
|
expect(typeof a.id).toBe('string');
|
|
71
71
|
expect(a.id).toBe(customId);
|
|
@@ -85,7 +85,7 @@ function createUnifiedTests(options) {
|
|
|
85
85
|
it('findById - Should GET selected Data', async () => {
|
|
86
86
|
const goats = await GoatRepo.insertMany(exports.flock);
|
|
87
87
|
const goat = await GoatRepo.findById(goats[0].id, {
|
|
88
|
-
select: { name: true }
|
|
88
|
+
select: { name: true },
|
|
89
89
|
});
|
|
90
90
|
expect(goat?.name).toBe(goats[0].name);
|
|
91
91
|
expect(goat?.age).toBeUndefined();
|
|
@@ -109,21 +109,21 @@ function createUnifiedTests(options) {
|
|
|
109
109
|
it('findMany - Should FILTER data', async () => {
|
|
110
110
|
await GoatRepo.insertMany(exports.flock);
|
|
111
111
|
const goats = await GoatRepo.findMany({
|
|
112
|
-
where: { breed: { family: 'Angora' } }
|
|
112
|
+
where: { breed: { family: 'Angora' } },
|
|
113
113
|
});
|
|
114
114
|
expect(goats.length).toBe(2);
|
|
115
115
|
});
|
|
116
116
|
it('findMany - Should FILTER not existing data', async () => {
|
|
117
117
|
await GoatRepo.insertMany(exports.flock);
|
|
118
118
|
const goats = await GoatRepo.findMany({
|
|
119
|
-
where: { name: 'TESTESTEST' }
|
|
119
|
+
where: { name: 'TESTESTEST' },
|
|
120
120
|
});
|
|
121
121
|
expect(goats.length).toBe(0);
|
|
122
122
|
});
|
|
123
123
|
it('findMany - Should SELECT attributes', async () => {
|
|
124
124
|
await GoatRepo.insertMany(exports.flock);
|
|
125
125
|
const goats = await GoatRepo.findMany({
|
|
126
|
-
select: { name: true }
|
|
126
|
+
select: { name: true },
|
|
127
127
|
});
|
|
128
128
|
expect(goats[0]?.name).toBeDefined();
|
|
129
129
|
expect(goats[0]?.age).toBeUndefined();
|
|
@@ -138,7 +138,7 @@ function createUnifiedTests(options) {
|
|
|
138
138
|
await GoatRepo.insertMany(exports.flock);
|
|
139
139
|
const goat = await GoatRepo.findFirst({
|
|
140
140
|
where: { breed: { family: 'Angora' } },
|
|
141
|
-
select: { name: true }
|
|
141
|
+
select: { name: true },
|
|
142
142
|
});
|
|
143
143
|
expect(goat?.name).toBeDefined();
|
|
144
144
|
expect(goat?.age).toBeUndefined();
|
|
@@ -190,7 +190,7 @@ function createUnifiedTests(options) {
|
|
|
190
190
|
await TypeOrmRepo.insertMany([
|
|
191
191
|
{ test: true, order: 2 },
|
|
192
192
|
{ test: false, order: 3 },
|
|
193
|
-
{ test: true, order: 1 }
|
|
193
|
+
{ test: true, order: 1 },
|
|
194
194
|
]);
|
|
195
195
|
const plucked = await TypeOrmRepo.pluck('order');
|
|
196
196
|
expect(Array.isArray(plucked)).toBe(true);
|
|
@@ -202,7 +202,7 @@ function createUnifiedTests(options) {
|
|
|
202
202
|
await TypeOrmRepo.insertMany([
|
|
203
203
|
{ test: true },
|
|
204
204
|
{ test: false },
|
|
205
|
-
{ test: true }
|
|
205
|
+
{ test: true },
|
|
206
206
|
]);
|
|
207
207
|
const results = await TypeOrmRepo.findMany({ limit: 2 });
|
|
208
208
|
expect(results.length).toBe(2);
|
|
@@ -211,11 +211,11 @@ function createUnifiedTests(options) {
|
|
|
211
211
|
const _inserted = await TypeOrmRepo.insertMany([
|
|
212
212
|
{ test: true, order: 1 },
|
|
213
213
|
{ test: false, order: 2 },
|
|
214
|
-
{ test: true, order: 3 }
|
|
214
|
+
{ test: true, order: 3 },
|
|
215
215
|
]);
|
|
216
216
|
const results = await TypeOrmRepo.findMany({
|
|
217
217
|
offset: 1,
|
|
218
|
-
orderBy: [{ order: 'asc' }]
|
|
218
|
+
orderBy: [{ order: 'asc' }],
|
|
219
219
|
});
|
|
220
220
|
expect(results.length).toBe(2);
|
|
221
221
|
expect(results[0].order).toBe(2);
|
|
@@ -224,12 +224,12 @@ function createUnifiedTests(options) {
|
|
|
224
224
|
await TypeOrmRepo.insertMany([
|
|
225
225
|
{ test: true, order: 1 },
|
|
226
226
|
{ test: false, order: 2 },
|
|
227
|
-
{ test: true, order: 3 }
|
|
227
|
+
{ test: true, order: 3 },
|
|
228
228
|
]);
|
|
229
229
|
const results = await TypeOrmRepo.findMany({
|
|
230
230
|
where: {
|
|
231
|
-
OR: [{ test: true }, { order: 2 }]
|
|
232
|
-
}
|
|
231
|
+
OR: [{ test: true }, { order: 2 }],
|
|
232
|
+
},
|
|
233
233
|
});
|
|
234
234
|
expect(results.length).toBe(3);
|
|
235
235
|
});
|
|
@@ -237,10 +237,10 @@ function createUnifiedTests(options) {
|
|
|
237
237
|
await TypeOrmRepo.insertMany([
|
|
238
238
|
{ test: true, order: 2 },
|
|
239
239
|
{ test: false, order: 3 },
|
|
240
|
-
{ test: true, order: 1 }
|
|
240
|
+
{ test: true, order: 1 },
|
|
241
241
|
]);
|
|
242
242
|
const results = await TypeOrmRepo.findMany({
|
|
243
|
-
orderBy: [{ order: 'desc' }]
|
|
243
|
+
orderBy: [{ order: 'desc' }],
|
|
244
244
|
});
|
|
245
245
|
expect(results[0].order).toBe(3);
|
|
246
246
|
expect(results[1].order).toBe(2);
|
|
@@ -250,10 +250,10 @@ function createUnifiedTests(options) {
|
|
|
250
250
|
await TypeOrmRepo.insertMany([
|
|
251
251
|
{ test: true, order: 2 },
|
|
252
252
|
{ test: false, order: 3 },
|
|
253
|
-
{ test: true, order: 1 }
|
|
253
|
+
{ test: true, order: 1 },
|
|
254
254
|
]);
|
|
255
255
|
const results = await TypeOrmRepo.findMany({
|
|
256
|
-
orderBy: [{ order: 'asc' }]
|
|
256
|
+
orderBy: [{ order: 'asc' }],
|
|
257
257
|
});
|
|
258
258
|
expect(results[0].order).toBe(1);
|
|
259
259
|
expect(results[1].order).toBe(2);
|
|
@@ -268,7 +268,7 @@ function createUnifiedTests(options) {
|
|
|
268
268
|
const third = await TypeOrmRepo.insert({ test: true });
|
|
269
269
|
const results = await TypeOrmRepo.findMany({
|
|
270
270
|
orderBy: [{ created: 'desc' }],
|
|
271
|
-
select: { id: true, created: true }
|
|
271
|
+
select: { id: true, created: true },
|
|
272
272
|
});
|
|
273
273
|
expect(results[0]?.id).toBe(third.id);
|
|
274
274
|
expect(results[1]?.id).toBe(second.id);
|
|
@@ -282,13 +282,13 @@ function createUnifiedTests(options) {
|
|
|
282
282
|
await new Promise(resolve => setTimeout(resolve, 10));
|
|
283
283
|
const third = await TypeOrmRepo.insert({ test: true });
|
|
284
284
|
const results = await TypeOrmRepo.findMany({
|
|
285
|
-
orderBy: [{ created: 'desc' }]
|
|
285
|
+
orderBy: [{ created: 'desc' }],
|
|
286
286
|
});
|
|
287
287
|
expect(results[0]?.id).toBe(third.id);
|
|
288
288
|
expect(results[1]?.id).toBe(second.id);
|
|
289
289
|
expect(results[2]?.id).toBe(first.id);
|
|
290
290
|
});
|
|
291
|
-
}
|
|
291
|
+
},
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
//# sourceMappingURL=unifiedTestFactory.js.map
|