@furystack/core 10.3.6 → 10.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"physical-store.d.ts","sourceRoot":"","sources":["../../src/models/physical-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,eAAO,MAAM,yBAAyB,yCAA0C,CAAA;AAChF,eAAO,MAAM,yBAAyB,yBAA0B,CAAA;AAEhE,eAAO,MAAM,wBAAwB,0BAA2B,CAAA;AAChE,eAAO,MAAM,gBAAgB,0CAA2C,CAAA;AAExE,eAAO,MAAM,YAAY,+GAMf,CAAA;AAEV,oBAAY,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EACX,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC,GACnD,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG;SAAG,GAAG,IAAI,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAAE,GAAG,KAAK,CAAC,GAC5F;SAAG,GAAG,IAAI,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAAE,GAC5D;SAAG,GAAG,IAAI,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE;CACvE,GAAG;KAAG,EAAE,IAAI,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAC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AAE,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3D;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE9C;;;;OAIG;IACH,IAAI,CAAC,OAAO,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IAErH;;;;OAIG;IACH,GAAG,CAAC,OAAO,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,EAChC,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,EACnB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAA;IAEjD;;;;OAIG;IACH,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selectFields = exports.t = exports.isOperator = exports.allOperators = exports.LogicalOperators = exports.ArrayComparisonOperators = exports.SingleComparisonOperators = exports.NumberComparisonOperators = void 0;
3
+ exports.selectFields = exports.t = exports.isOperator = exports.isLogicalOperator = exports.allOperators = exports.LogicalOperators = exports.ArrayComparisonOperators = exports.SingleComparisonOperators = exports.NumberComparisonOperators = void 0;
4
4
  exports.NumberComparisonOperators = ['$gt', '$gte', '$lt', '$lte'];
5
5
  exports.SingleComparisonOperators = ['$eq', '$ne'];
6
6
  exports.ArrayComparisonOperators = ['$in', '$nin'];
@@ -12,6 +12,8 @@ exports.allOperators = [
12
12
  ...exports.LogicalOperators,
13
13
  '$regex',
14
14
  ];
15
+ const isLogicalOperator = (propertyString) => exports.LogicalOperators.includes(propertyString);
16
+ exports.isLogicalOperator = isLogicalOperator;
15
17
  const isOperator = (propertyString) => exports.allOperators.includes(propertyString);
16
18
  exports.isOperator = isOperator;
17
19
  exports.t = {
@@ -1 +1 @@
1
- {"version":3,"file":"physical-store.js","sourceRoot":"","sources":["../../src/models/physical-store.ts"],"names":[],"mappings":";;;AAGa,QAAA,yBAAyB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA;AACnE,QAAA,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAA;AAEnD,QAAA,wBAAwB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAA;AACnD,QAAA,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAA;AAE3D,QAAA,YAAY,GAAG;IAC1B,GAAG,iCAAyB;IAC5B,GAAG,iCAAyB;IAC5B,GAAG,gCAAwB;IAC3B,GAAG,wBAAgB;IACnB,QAAQ;CACA,CAAA;AASH,MAAM,UAAU,GAAG,CAAC,cAAsB,EAAiD,EAAE,CAClG,oBAAY,CAAC,QAAQ,CAAC,cAA6C,CAAC,CAAA;AADzD,QAAA,UAAU,cAC+C;AAEzD,QAAA,CAAC,GAAqD;IACjE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;IACb,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IAC3B,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;CAC1B,CAAA;AAwCM,MAAM,YAAY,GAAG,CAAmC,KAAQ,EAAE,GAAG,MAAc,EAAE,EAAE;IAC5F,MAAM,WAAW,GAA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lD;;;;;OAKG;IACI,QAAQ,CAAC,CAAC,EAAE,WAAW,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC;gBAKjE,QAAQ,EAAE,QAAQ;CACtC"}
1
+ {"version":3,"file":"store-manager.d.ts","sourceRoot":"","sources":["../src/store-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD;;GAEG;AACH,qBACa,YAAa,YAAW,UAAU;IAoD1B,QAAQ,EAAE,QAAQ;IAnDrC;;OAEG;IACU,OAAO;IAWpB,OAAO,CAAC,MAAM,CAAkE;IAEhF;;;;;;;;OAQG;IACI,WAAW,CAChB,CAAC,EACD,WAAW,SAAS,MAAM,CAAC,EAC3B,KAAK,SAAS,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,EAC3E,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW;IAWlD;;;;;OAKG;IACI,QAAQ,CAAC,CAAC,EAAE,WAAW,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC;gBAKjE,QAAQ,EAAE,QAAQ;CACtC"}
@@ -19,7 +19,7 @@ let StoreManager = class StoreManager {
19
19
  const result = await Promise.allSettled([...this.stores.entries()].map(async ([_model, store]) => store.dispose()));
20
20
  const fails = result.filter((r) => r.status === 'rejected');
21
21
  if (fails && fails.length) {
22
- const error = new errors_1.AggregatedError(`There was an error during disposing ${fails.length} stores.`, fails);
22
+ const error = new errors_1.AggregatedError(`There was an error during disposing ${fails.length} stores: ${fails.map((f) => f.reason)}`, fails);
23
23
  throw error;
24
24
  }
25
25
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;SACZ;IACH,CAAC;IAGD;;;;;;;;OAQG;IACI,WAAW,CAIhB,KAAuB,EAAE,UAAuB;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAA;SACnD;QACD,IAAI,UAAU,KAAK,QAAQ,CAAC,UAAU,EAAE;YACtC,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAA;SACtC;QACD,OAAO,QAAiB,CAAA;IAC1B,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAiC,KAAoC;QAClF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAgC,CAAC,CAAA;QAC9D,OAAO,IAAI,CAAA;IACb,CAAC;CAGF,CAAA;AArDY,YAAY;IADxB,IAAA,mBAAU,EAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;kDAqDP,iBAAQ;GApD1B,YAAY,CAqDxB;AArDY,oCAAY"}
@@ -50,6 +50,7 @@ describe('StoreManager', () => {
50
50
  expect(error).toBeInstanceOf(errors_1.AggregatedError);
51
51
  expect(error.rejections).toHaveLength(1);
52
52
  }
53
+ i.cachedSingletons.clear();
53
54
  });
54
55
  });
55
56
  });
@@ -1 +1 @@
1
- {"version":3,"file":"store-manager.spec.js","sourceRoot":"","sources":["../src/store-manager.spec.ts"],"names":[],"mappings":";;AAAA,4CAAoD;AACpD,8CAA4C;AAC5C,mDAA8C;AAC9C,uDAAiD;AACjD,iCAA8B;AAC9B,qCAA0C;AAE1C,MAAM,IAAI;CAGT;AAED,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,IAAA,aAAK,EAAC,IAAI,iBAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE;YA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AM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,wBAAe,CAAC,CAAA;gBAC7C,MAAM,CAAE,KAAyB,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;aAC9D;YACD,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furystack/core",
3
- "version": "10.3.6",
3
+ "version": "10.4.1",
4
4
  "description": "Core FuryStack package",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -28,15 +28,15 @@
28
28
  },
29
29
  "homepage": "https://github.com/furystack/furystack",
30
30
  "devDependencies": {
31
- "@types/jest": "^27.0.2",
32
- "@types/node": "^16.11.7"
31
+ "@types/jest": "^27.0.3",
32
+ "@types/node": "^16.11.12"
33
33
  },
34
34
  "dependencies": {
35
- "@furystack/inject": "^4.0.75",
36
- "@furystack/utils": "^1.2.45",
35
+ "@furystack/inject": "^5.0.0",
36
+ "@furystack/utils": "^2.0.0",
37
37
  "semaphore-async-await": "^1.5.1",
38
38
  "tslib": "^2.3.1"
39
39
  },
40
40
  "typings": "./dist/index.d.ts",
41
- "gitHead": "6813165dee08114fdc108b5147125a87c5068300"
41
+ "gitHead": "8a1860a227691def1a94e8de5e95a7c5067356cc"
42
42
  }
@@ -1,5 +1,6 @@
1
1
  import { PhysicalStore } from './models/physical-store'
2
2
  import { usingAsync } from '@furystack/utils'
3
+ import { Injector } from '@furystack/inject'
3
4
 
4
5
  export class TestClass {
5
6
  id!: number
@@ -26,7 +27,7 @@ export const createMockEntity = (part?: Partial<TestClass>) =>
26
27
 
27
28
  export interface StoreTestOptions<T, TPrimaryKey extends keyof T> {
28
29
  typeName: string
29
- createStore: () => PhysicalStore<T, TPrimaryKey>
30
+ createStore: (i: Injector) => PhysicalStore<T, TPrimaryKey>
30
31
  skipRegexTests?: boolean
31
32
  }
32
33
 
@@ -34,14 +35,16 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
34
35
  describe(`Standard Physical Store tests for '${options.typeName}'`, () => {
35
36
  describe('General CRUD', () => {
36
37
  it('Should be created with empty by default', async () => {
37
- await usingAsync(options.createStore(), async (store) => {
38
+ await usingAsync(new Injector(), async (i) => {
39
+ const store = options.createStore(i)
38
40
  const count = await store.count()
39
41
  expect(count).toBe(0)
40
42
  })
41
43
  })
42
44
 
43
45
  it('Should be able to store an entity', async () => {
44
- await usingAsync(options.createStore(), async (store) => {
46
+ await usingAsync(new Injector(), async (i) => {
47
+ const store = options.createStore(i)
45
48
  const entity = createMockEntity()
46
49
  await store.add(entity)
47
50
  const count = await store.count()
@@ -50,7 +53,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
50
53
  })
51
54
 
52
55
  it('Should be able to store an entity without providing an unique Id', async () => {
53
- await usingAsync(options.createStore(), async (store) => {
56
+ await usingAsync(new Injector(), async (i) => {
57
+ const store = options.createStore(i)
54
58
  const { id, ...entityWithoutId } = createMockEntity()
55
59
  const { created } = await store.add(entityWithoutId)
56
60
  expect(created.length).toBe(1)
@@ -62,7 +66,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
62
66
  })
63
67
 
64
68
  it('Should be able to store multiple entities', async () => {
65
- await usingAsync(options.createStore(), async (store) => {
69
+ await usingAsync(new Injector(), async (i) => {
70
+ const store = options.createStore(i)
66
71
  const entity1 = createMockEntity()
67
72
  const entity2 = createMockEntity()
68
73
  await store.add(entity1, entity2)
@@ -72,7 +77,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
72
77
  })
73
78
 
74
79
  it('Add should throw and skip adding on duplicate IDs', async () => {
75
- await usingAsync(options.createStore(), async (store) => {
80
+ await usingAsync(new Injector(), async (i) => {
81
+ const store = options.createStore(i)
76
82
  const entity = createMockEntity()
77
83
  await store.add(entity)
78
84
  await expect(store.add(entity)).rejects.toThrow()
@@ -82,14 +88,16 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
82
88
  })
83
89
 
84
90
  it('Should return undefined if no entry has been found', async () => {
85
- await usingAsync(options.createStore(), async (store) => {
91
+ await usingAsync(new Injector(), async (i) => {
92
+ const store = options.createStore(i)
86
93
  const entity = await store.get(1)
87
94
  expect(entity).toBeUndefined()
88
95
  })
89
96
  })
90
97
 
91
98
  it('Should be able to retrieve an added entity', async () => {
92
- await usingAsync(options.createStore(), async (store) => {
99
+ await usingAsync(new Injector(), async (i) => {
100
+ const store = options.createStore(i)
93
101
  const entity = createMockEntity()
94
102
  await store.add(entity)
95
103
  const retrieved = await store.get(entity.id)
@@ -98,7 +106,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
98
106
  })
99
107
 
100
108
  it('Should be able to retrieve an added entity with projection', async () => {
101
- await usingAsync(options.createStore(), async (store) => {
109
+ await usingAsync(new Injector(), async (i) => {
110
+ const store = options.createStore(i)
102
111
  const entity = createMockEntity()
103
112
  await store.add(entity)
104
113
  const retrieved = await store.get(entity.id, ['id', 'stringValue1'])
@@ -110,7 +119,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
110
119
  })
111
120
 
112
121
  it('Should be able to update an added entity', async () => {
113
- await usingAsync(options.createStore(), async (store) => {
122
+ await usingAsync(new Injector(), async (i) => {
123
+ const store = options.createStore(i)
114
124
  const entity = createMockEntity()
115
125
  await store.add(entity)
116
126
  await store.update(entity.id, { stringValue1: 'modified' })
@@ -120,14 +130,16 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
120
130
  })
121
131
 
122
132
  it('Update should throw an error if the entity does not exists', async () => {
123
- await usingAsync(options.createStore(), async (store) => {
133
+ await usingAsync(new Injector(), async (i) => {
134
+ const store = options.createStore(i)
124
135
  const entity = createMockEntity()
125
136
  await expect(store.update(entity.id, entity)).rejects.toThrow('Entity not found')
126
137
  })
127
138
  })
128
139
 
129
140
  it('Should remove an entity', async () => {
130
- await usingAsync(options.createStore(), async (store) => {
141
+ await usingAsync(new Injector(), async (i) => {
142
+ const store = options.createStore(i)
131
143
  const entity = createMockEntity()
132
144
  await store.add(entity)
133
145
  const count = await store.count()
@@ -139,7 +151,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
139
151
  })
140
152
 
141
153
  it('Should remove multiple entities at once', async () => {
142
- await usingAsync(options.createStore(), async (store) => {
154
+ await usingAsync(new Injector(), async (i) => {
155
+ const store = options.createStore(i)
143
156
  const entity1 = createMockEntity()
144
157
  const entity2 = createMockEntity()
145
158
  const entity3 = createMockEntity()
@@ -158,7 +171,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
158
171
 
159
172
  describe('Top, skip', () => {
160
173
  it('Should respect top and skip', async () => {
161
- await usingAsync(options.createStore(), async (store) => {
174
+ await usingAsync(new Injector(), async (injector) => {
175
+ const store = options.createStore(injector)
162
176
  for (let i = 0; i < 10; i++) {
163
177
  await store.add(createMockEntity({ id: i }))
164
178
  }
@@ -175,7 +189,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
175
189
  })
176
190
  describe('Ordering', () => {
177
191
  it('Should sort by numeric values', async () => {
178
- await usingAsync(options.createStore(), async (store) => {
192
+ await usingAsync(new Injector(), async (injector) => {
193
+ const store = options.createStore(injector)
179
194
  for (let i = 0; i < 10; i++) {
180
195
  await store.add(createMockEntity({ id: i, numberValue1: Math.random(), numberValue2: Math.random() }))
181
196
  }
@@ -205,7 +220,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
205
220
  })
206
221
  describe('Filtering', () => {
207
222
  it('should filter strings with $eq', async () => {
208
- await usingAsync(options.createStore(), async (store) => {
223
+ await usingAsync(new Injector(), async (i) => {
224
+ const store = options.createStore(i)
209
225
  await store.add(
210
226
  createMockEntity({ id: 1, stringValue1: 'asd' }),
211
227
  createMockEntity({ id: 2, stringValue1: 'def' }),
@@ -217,7 +233,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
217
233
  })
218
234
 
219
235
  it('should filter numbers with $eq', async () => {
220
- await usingAsync(options.createStore(), async (store) => {
236
+ await usingAsync(new Injector(), async (i) => {
237
+ const store = options.createStore(i)
221
238
  await store.add(
222
239
  createMockEntity({ id: 1, numberValue1: 1 }),
223
240
  createMockEntity({ id: 2, numberValue1: 2 }),
@@ -229,7 +246,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
229
246
  })
230
247
 
231
248
  it('filter should return the corresponding entries for multiple props', async () => {
232
- await usingAsync(options.createStore(), async (store) => {
249
+ await usingAsync(new Injector(), async (i) => {
250
+ const store = options.createStore(i)
233
251
  await store.add(
234
252
  createMockEntity({ id: 1, stringValue1: 'asd' }),
235
253
  createMockEntity({ id: 2, stringValue1: 'def', stringValue2: 'def' }),
@@ -242,7 +260,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
242
260
  })
243
261
 
244
262
  it('filter should return the corresponding entries with $in statement', async () => {
245
- await usingAsync(options.createStore(), async (store) => {
263
+ await usingAsync(new Injector(), async (i) => {
264
+ const store = options.createStore(i)
246
265
  await store.add(
247
266
  createMockEntity({ stringValue1: 'asd' }),
248
267
  createMockEntity({ stringValue1: 'def' }),
@@ -256,7 +275,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
256
275
  })
257
276
 
258
277
  it('filter should return the corresponding entries with $nin statement', async () => {
259
- await usingAsync(options.createStore(), async (store) => {
278
+ await usingAsync(new Injector(), async (i) => {
279
+ const store = options.createStore(i)
260
280
  await store.add(
261
281
  createMockEntity({ id: 1, stringValue1: 'asd' }),
262
282
  createMockEntity({ id: 2, stringValue1: 'def' }),
@@ -270,7 +290,8 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
270
290
  })
271
291
 
272
292
  it('filter should return the corresponding entries with $ne statement', async () => {
273
- await usingAsync(options.createStore(), async (store) => {
293
+ await usingAsync(new Injector(), async (i) => {
294
+ const store = options.createStore(i)
274
295
  await store.add(
275
296
  createMockEntity({ id: 1, stringValue1: 'asd' }),
276
297
  createMockEntity({ id: 2, stringValue1: 'def' }),
@@ -283,8 +304,69 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
283
304
  })
284
305
  })
285
306
 
307
+ it('filter should return the corresponding entries with $lt statement', async () => {
308
+ await usingAsync(new Injector(), async (i) => {
309
+ const store = options.createStore(i)
310
+ const { created } = await store.add(
311
+ createMockEntity({ id: 1, numberValue1: 1 }),
312
+ createMockEntity({ id: 2, numberValue1: 2 }),
313
+ createMockEntity({ id: 3, numberValue1: 3 }),
314
+ )
315
+
316
+ const result = await store.find({ filter: { numberValue1: { $lt: 2 } } })
317
+ expect(result.length).toBe(1)
318
+ expect(result).toEqual([created[0]])
319
+ })
320
+ })
321
+
322
+ it('filter should return the corresponding entries with $lte statement', async () => {
323
+ await usingAsync(new Injector(), async (i) => {
324
+ const store = options.createStore(i)
325
+ const { created } = await store.add(
326
+ createMockEntity({ id: 1, numberValue1: 1 }),
327
+ createMockEntity({ id: 2, numberValue1: 2 }),
328
+ createMockEntity({ id: 3, numberValue1: 3 }),
329
+ )
330
+
331
+ const result = await store.find({ filter: { numberValue1: { $lte: 2 } } })
332
+ expect(result.length).toBe(2)
333
+ expect(result).toEqual([created[0], created[1]])
334
+ })
335
+ })
336
+
337
+ it('filter should return the corresponding entries with $gt statement', async () => {
338
+ await usingAsync(new Injector(), async (i) => {
339
+ const store = options.createStore(i)
340
+ const { created } = await store.add(
341
+ createMockEntity({ id: 1, numberValue1: 1 }),
342
+ createMockEntity({ id: 2, numberValue1: 2 }),
343
+ createMockEntity({ id: 3, numberValue1: 3 }),
344
+ )
345
+
346
+ const result = await store.find({ filter: { numberValue1: { $gt: 2 } } })
347
+ expect(result.length).toBe(1)
348
+ expect(result).toEqual([created[2]])
349
+ })
350
+ })
351
+
352
+ it('filter should return the corresponding entries with $gte statement', async () => {
353
+ await usingAsync(new Injector(), async (i) => {
354
+ const store = options.createStore(i)
355
+ const { created } = await store.add(
356
+ createMockEntity({ id: 1, numberValue1: 1 }),
357
+ createMockEntity({ id: 2, numberValue1: 2 }),
358
+ createMockEntity({ id: 3, numberValue1: 3 }),
359
+ )
360
+
361
+ const result = await store.find({ filter: { numberValue1: { $gte: 2 } } })
362
+ expect(result.length).toBe(2)
363
+ expect(result).toEqual([created[1], created[2]])
364
+ })
365
+ })
366
+
286
367
  it('filter should return the corresponding entries with $in AND $eq statement', async () => {
287
- await usingAsync(options.createStore(), async (store) => {
368
+ await usingAsync(new Injector(), async (i) => {
369
+ const store = options.createStore(i)
288
370
  await store.add(
289
371
  createMockEntity({ id: 1, stringValue1: 'asd' }),
290
372
  createMockEntity({ id: 2, stringValue1: 'def' }),
@@ -297,9 +379,140 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
297
379
  })
298
380
  })
299
381
 
382
+ describe('logical $and statements', () => {
383
+ it('should filter $and logical statements with $eq statements', async () => {
384
+ await usingAsync(new Injector(), async (i) => {
385
+ const store = options.createStore(i)
386
+ const { created } = await store.add(
387
+ createMockEntity({ id: 1, numberValue1: 1, numberValue2: 1 }),
388
+ createMockEntity({ id: 2, numberValue1: 2, numberValue2: 1 }),
389
+ createMockEntity({ id: 3, numberValue1: 3, numberValue2: 1 }),
390
+ )
391
+ const result = await store.find({
392
+ filter: { $and: [{ numberValue1: { $eq: 2 } }, { numberValue2: { $eq: 1 } }] },
393
+ })
394
+ expect(result.length).toBe(1)
395
+ expect(result[0]).toEqual(created[1])
396
+ })
397
+ })
398
+
399
+ it('should filter $and logical statements with $ne statements', async () => {
400
+ await usingAsync(new Injector(), async (i) => {
401
+ const store = options.createStore(i)
402
+ const { created } = await store.add(
403
+ createMockEntity({ id: 1, numberValue1: 1, numberValue2: 2 }),
404
+ createMockEntity({ id: 2, numberValue1: 2, numberValue2: 3 }),
405
+ createMockEntity({ id: 3, numberValue1: 3, numberValue2: 1 }),
406
+ )
407
+ const result = await store.find({
408
+ filter: { $and: [{ numberValue1: { $ne: 2 } }, { numberValue2: { $ne: 1 } }] },
409
+ })
410
+ expect(result.length).toBe(1)
411
+ expect(result[0]).toEqual(created[0])
412
+ })
413
+ })
414
+
415
+ it('should filter $and logical statements with $lt/$gt statements', async () => {
416
+ await usingAsync(new Injector(), async (i) => {
417
+ const store = options.createStore(i)
418
+ const { created } = await store.add(
419
+ createMockEntity({ id: 1, numberValue1: 1, numberValue2: 2 }),
420
+ createMockEntity({ id: 2, numberValue1: 2, numberValue2: 3 }),
421
+ createMockEntity({ id: 3, numberValue1: 3, numberValue2: 1 }),
422
+ )
423
+ const result = await store.find({
424
+ filter: { $and: [{ numberValue1: { $lt: 3 } }, { numberValue2: { $gt: 2 } }] },
425
+ })
426
+ expect(result.length).toBe(1)
427
+ expect(result[0]).toEqual(created[1])
428
+ })
429
+ })
430
+
431
+ it('should filter $and logical statements with $lte/$gte statements', async () => {
432
+ await usingAsync(new Injector(), async (i) => {
433
+ const store = options.createStore(i)
434
+ const { created } = await store.add(
435
+ createMockEntity({ id: 1, numberValue1: 1, numberValue2: 1 }),
436
+ createMockEntity({ id: 2, numberValue1: 2, numberValue2: 2 }),
437
+ createMockEntity({ id: 3, numberValue1: 3, numberValue2: 3 }),
438
+ )
439
+ const result = await store.find({
440
+ filter: { $and: [{ numberValue1: { $lte: 2 } }, { numberValue2: { $gte: 2 } }] },
441
+ })
442
+ expect(result.length).toBe(1)
443
+ expect(result[0]).toEqual(created[1])
444
+ })
445
+ })
446
+ })
447
+
448
+ describe('logical $or statements', () => {
449
+ it('should filter logical $or statements with $eq statements', async () => {
450
+ await usingAsync(new Injector(), async (i) => {
451
+ const store = options.createStore(i)
452
+ const { created } = await store.add(
453
+ createMockEntity({ id: 1, stringValue1: 'asd' }),
454
+ createMockEntity({ id: 2, stringValue1: 'aaa' }),
455
+ createMockEntity({ id: 3, stringValue1: 'bbb' }),
456
+ )
457
+
458
+ const result = await store.find({
459
+ filter: { $or: [{ stringValue1: { $eq: 'aaa' } }, { stringValue1: { $eq: 'bbb' } }] },
460
+ })
461
+ expect(result.length).toBe(2)
462
+ expect(result).toEqual([created[1], created[2]])
463
+ })
464
+ })
465
+
466
+ it('should filter logical $or statements with $neq statements', async () => {
467
+ await usingAsync(new Injector(), async (i) => {
468
+ const store = options.createStore(i)
469
+ const { created } = await store.add(
470
+ createMockEntity({ id: 1, stringValue1: 'asd' }),
471
+ createMockEntity({ id: 2, stringValue1: 'aaa' }),
472
+ createMockEntity({ id: 3, stringValue1: 'bbb' }),
473
+ )
474
+
475
+ const result = await store.find({
476
+ filter: { $or: [{ stringValue1: { $ne: 'aaa' } }, { stringValue1: { $ne: 'bbb' } }] },
477
+ })
478
+ expect(result.length).toBe(3)
479
+ expect(result).toEqual(created)
480
+ })
481
+ })
482
+ })
483
+
484
+ describe('Nested $or and $and logical operators', () => {
485
+ it('should filter $and operators inside $or-s', async () => {
486
+ await usingAsync(new Injector(), async (i) => {
487
+ const store = options.createStore(i)
488
+ const { created } = await store.add(
489
+ createMockEntity({ id: 1, numberValue1: 1, numberValue2: 3, booleanValue: true }),
490
+ createMockEntity({ id: 2, numberValue1: 2, numberValue2: 2, booleanValue: false }),
491
+ createMockEntity({ id: 3, numberValue1: 3, numberValue2: 1, booleanValue: true }),
492
+ )
493
+
494
+ const result = await store.find({
495
+ filter: {
496
+ $or: [
497
+ {
498
+ $and: [{ numberValue1: { $ne: 2 } }, { numberValue2: { $eq: 1 } }],
499
+ },
500
+ {
501
+ $and: [{ numberValue1: { $ne: 3 } }, { booleanValue: { $ne: true } }],
502
+ },
503
+ ],
504
+ },
505
+ })
506
+ expect(result.length).toBe(2)
507
+ expect(result).toEqual([created[1], created[2]])
508
+ })
509
+ })
510
+ })
511
+
300
512
  if (!options.skipRegexTests) {
301
513
  it('filter should return the corresponding entries with $regex', async () => {
302
- await usingAsync(options.createStore(), async (store) => {
514
+ await usingAsync(new Injector(), async (i) => {
515
+ const store = options.createStore(i)
303
516
  await store.add(
304
517
  createMockEntity({ id: 1, stringValue1: 'asd' }),
305
518
  createMockEntity({ id: 2, stringValue1: 'aaa' }),
@@ -316,14 +529,16 @@ export const createStoreTest = (options: StoreTestOptions<TestClass, 'id'>) => {
316
529
 
317
530
  describe('Count', () => {
318
531
  it('Should return the count', async () => {
319
- await usingAsync(options.createStore(), async (store) => {
532
+ await usingAsync(new Injector(), async (i) => {
533
+ const store = options.createStore(i)
320
534
  await store.add(createMockEntity(), createMockEntity(), createMockEntity())
321
535
  const count = await store.count()
322
536
  expect(count).toBe(3)
323
537
  })
324
538
  })
325
539
  it('Should respect filters', async () => {
326
- await usingAsync(options.createStore(), async (store) => {
540
+ await usingAsync(new Injector(), async (i) => {
541
+ const store = options.createStore(i)
327
542
  await store.add(
328
543
  createMockEntity({ numberValue1: 1 }),
329
544
  createMockEntity({ numberValue1: 1 }),
@@ -7,6 +7,7 @@ describe('InMemoryStore', () => {
7
7
  createStoreTest({
8
8
  createStore,
9
9
  typeName: 'InMemoryStore',
10
+ // skipAdvancedTests: true, // TODO
10
11
  })
11
12
 
12
13
  it('dispose should empty the cache', async () => {
@@ -9,6 +9,7 @@ import {
9
9
  isOperator,
10
10
  CreateResult,
11
11
  WithOptionalId,
12
+ isLogicalOperator,
12
13
  } from './models/physical-store'
13
14
 
14
15
  export class InMemoryStore<T, TPrimaryKey extends keyof T> implements PhysicalStore<T, TPrimaryKey> {
@@ -47,7 +48,23 @@ export class InMemoryStore<T, TPrimaryKey extends keyof T> implements PhysicalSt
47
48
  }
48
49
  return values.filter((item) => {
49
50
  for (const key in filter) {
50
- if (typeof (filter as any)[key] === 'object') {
51
+ if (isLogicalOperator(key)) {
52
+ const filterValue = (filter as any)[key] as Array<FilterType<T>>
53
+ switch (key) {
54
+ case '$and':
55
+ if (filterValue.some((v: FilterType<T>) => !this.filterInternal([item], v).length)) {
56
+ return false
57
+ }
58
+ break
59
+ case '$or':
60
+ if (filterValue.some((v: FilterType<T>) => this.filterInternal([item], v).length)) {
61
+ break
62
+ }
63
+ return false
64
+ default:
65
+ throw new Error(`The logical operation '${key}' is not a valid operation`)
66
+ }
67
+ } else if (typeof (filter as any)[key] === 'object') {
51
68
  for (const filterKey in (filter as any)[key]) {
52
69
  if (isOperator(filterKey)) {
53
70
  const itemValue = (item as any)[key]
@@ -74,13 +91,33 @@ export class InMemoryStore<T, TPrimaryKey extends keyof T> implements PhysicalSt
74
91
  return false
75
92
  }
76
93
  break
94
+ case '$lt':
95
+ if (itemValue < filterValue) {
96
+ break
97
+ }
98
+ return false
99
+ case '$lte':
100
+ if (itemValue <= filterValue) {
101
+ break
102
+ }
103
+ return false
104
+ case '$gt':
105
+ if (itemValue > filterValue) {
106
+ break
107
+ }
108
+ return false
109
+ case '$gte':
110
+ if (itemValue >= filterValue) {
111
+ break
112
+ }
113
+ return false
77
114
  case '$regex':
78
115
  if (!new RegExp(filterValue).test((itemValue as any).toString())) {
79
116
  return false
80
117
  }
81
118
  break
82
119
  default:
83
- throw new Error(`The expression (${key}) is not supported by '${this.constructor.name}'!`)
120
+ throw new Error(`The expression (${filterKey}) is not supported by '${this.constructor.name}'!`)
84
121
  }
85
122
  } else {
86
123
  throw new Error(`The filter key '${filterKey}' is not a valid operation`)
@@ -22,6 +22,10 @@ export type FilterType<T> = {
22
22
  | { [SCO in typeof SingleComparisonOperators[number]]?: T[K] }
23
23
  | { [ACO in typeof ArrayComparisonOperators[number]]?: Array<T[K]> }
24
24
  } & { [LO in typeof LogicalOperators[number]]?: Array<FilterType<T>> }
25
+
26
+ export const isLogicalOperator = (propertyString: string): propertyString is typeof LogicalOperators[number] =>
27
+ LogicalOperators.includes(propertyString as typeof LogicalOperators[number])
28
+
25
29
  export const isOperator = (propertyString: string): propertyString is typeof allOperators[number] =>
26
30
  allOperators.includes(propertyString as typeof allOperators[number])
27
31
 
@@ -65,6 +65,7 @@ describe('StoreManager', () => {
65
65
  expect(error).toBeInstanceOf(AggregatedError)
66
66
  expect((error as AggregatedError).rejections).toHaveLength(1)
67
67
  }
68
+ i.cachedSingletons.clear()
68
69
  })
69
70
  })
70
71
  })