@nymphjs/nymph 1.0.0-beta.4 → 1.0.0-beta.40

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.
@@ -9,8 +9,9 @@ const strtotime_1 = __importDefault(require("locutus/php/datetime/strtotime"));
9
9
  const guid_1 = require("@nymphjs/guid");
10
10
  const testArtifacts_1 = require("../testArtifacts");
11
11
  function QueriesTest(nymph, it) {
12
- nymph.addEntityClass(testArtifacts_1.TestModel);
13
- nymph.addEntityClass(testArtifacts_1.TestBModel);
12
+ const TestModel = nymph.addEntityClass(testArtifacts_1.TestModel);
13
+ const TestBModel = nymph.addEntityClass(testArtifacts_1.TestBModel);
14
+ const TestEmptyModel = nymph.addEntityClass(testArtifacts_1.TestEmptyModel);
14
15
  let testEntity;
15
16
  let testGuid;
16
17
  let refGuid;
@@ -19,7 +20,7 @@ function QueriesTest(nymph, it) {
19
20
  if (testGuid != null) {
20
21
  return;
21
22
  }
22
- testEntity = await testArtifacts_1.TestModel.factory();
23
+ testEntity = await TestModel.factory();
23
24
  testEntity.name = 'Entity Test ' + new Date().toLocaleString();
24
25
  testEntity.null = null;
25
26
  testEntity.string = 'test';
@@ -28,14 +29,17 @@ function QueriesTest(nymph, it) {
28
29
 
29
30
  This one's email address is nice_hat-wednesday+newyork@im-a-hat.hat.
30
31
  This one's phone number is (555) 555-1818.
31
- This one's zip code is 92064.`;
32
+ This one's zip code is 92064.
33
+ This one's favorite emojis are 🔥❤️😊😂⭐🤔
34
+
35
+ These hats are absolutely fantastic.`;
32
36
  testEntity.number = 30;
33
37
  testEntity.numberString = '30';
34
38
  testEntity.timestamp = Date.now();
35
39
  expect(await testEntity.$save()).toEqual(true);
36
40
  expect(testEntity.guid).not.toBeNull();
37
41
  testGuid = testEntity.guid;
38
- const entityReferenceTest = new testArtifacts_1.TestModel();
42
+ const entityReferenceTest = new TestModel();
39
43
  entityReferenceTest.string = 'wrong';
40
44
  entityReferenceTest.timestamp = (0, strtotime_1.default)('-2 days') * 1000;
41
45
  expect(await entityReferenceTest.$save()).toEqual(true);
@@ -45,19 +49,20 @@ This one's zip code is 92064.`;
45
49
  expect(await testEntity.$save()).toEqual(true);
46
50
  entityReferenceTest.test = 'good';
47
51
  expect(await entityReferenceTest.$save()).toEqual(true);
48
- testEntity = nymph.driver.getEntitySync({ class: testArtifacts_1.TestModel }, testGuid);
49
- expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
52
+ testEntity = nymph.driver.getEntitySync({ class: TestModel }, testGuid);
53
+ expect(testEntity).toBeInstanceOf(TestModel);
50
54
  expect(testEntity.guid).toEqual(testGuid);
51
- testEntity = (await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
52
- expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
55
+ testEntity = (await nymph.getEntity({ class: TestModel }, testGuid));
56
+ expect(testEntity).toBeInstanceOf(TestModel);
53
57
  expect(testEntity.guid).toEqual(testGuid);
54
58
  }
55
59
  async function createMultipleTestEntities() {
56
60
  if (!createdMultiple) {
57
61
  createdMultiple = true;
58
62
  for (let i = 0; i < 100; i++) {
59
- const testEntity = await testArtifacts_1.TestModel.factory();
63
+ const testEntity = await TestModel.factory();
60
64
  testEntity.name = `Multi Test ${i}`;
65
+ testEntity.number = 100 - i;
61
66
  testEntity.$removeTag('test');
62
67
  testEntity.$addTag('multiTest');
63
68
  expect(await testEntity.$save()).toEqual(true);
@@ -66,17 +71,22 @@ This one's zip code is 92064.`;
66
71
  }
67
72
  }
68
73
  it('delete old test data', async () => {
69
- let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
74
+ let all = await nymph.getEntities({ class: TestModel });
70
75
  expect(Array.isArray(all)).toEqual(true);
71
76
  for (const cur of all) {
72
77
  expect(await cur.$delete()).toEqual(true);
73
78
  }
74
- all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
79
+ all = await nymph.getEntities({ class: TestModel });
75
80
  expect(all.length).toEqual(0);
76
81
  });
77
82
  it('create entity', async () => {
78
83
  await createTestEntities();
79
84
  });
85
+ it("doesn't create empty entity", async () => {
86
+ const testEntity = await TestEmptyModel.factory();
87
+ expect(await testEntity.$save()).toBeFalsy();
88
+ expect(testEntity.guid).toBeNull();
89
+ });
80
90
  it('update mdate on save', async () => {
81
91
  await createTestEntities();
82
92
  const oldMdate = testEntity.mdate ?? Infinity;
@@ -89,11 +99,11 @@ This one's zip code is 92064.`;
89
99
  });
90
100
  it('by guid', async () => {
91
101
  await createTestEntities();
92
- let resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
102
+ let resultEntity = await nymph.getEntity({ class: TestModel }, testGuid);
93
103
  expect(testEntity.$is(resultEntity)).toEqual(true);
94
- resultEntity = await testArtifacts_1.TestModel.factory(testGuid);
104
+ resultEntity = await TestModel.factory(testGuid);
95
105
  expect(testEntity.$is(resultEntity)).toEqual(true);
96
- resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, (0, guid_1.guid)());
106
+ resultEntity = await nymph.getEntity({ class: TestModel }, (0, guid_1.guid)());
97
107
  expect(testEntity.$is(resultEntity)).toEqual(false);
98
108
  });
99
109
  it('transactions', async () => {
@@ -116,18 +126,18 @@ This one's zip code is 92064.`;
116
126
  testEntity.$nymph = transaction;
117
127
  expect(await transaction.inTransaction()).toEqual(true);
118
128
  expect(await testEntity.$delete()).toEqual(true);
119
- const resultEntity = await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
129
+ const resultEntity = await transaction.getEntity({ class: TestModel }, testGuid);
120
130
  expect(resultEntity).toBeNull();
121
131
  await transaction.rollback('test');
122
132
  expect(await transaction.inTransaction()).toEqual(false);
123
- testEntity = (await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
133
+ testEntity = (await transaction.getEntity({ class: TestModel }, testGuid));
124
134
  expect(testEntity.guid).toEqual(testGuid);
125
- transaction = await nymph.startTransaction('test');
135
+ transaction = await nymph.startTransaction('test.1');
126
136
  testEntity.$nymph = transaction;
127
137
  expect(await transaction.inTransaction()).toEqual(true);
128
138
  testEntity.string = 'fish';
129
139
  expect(await testEntity.$save()).toEqual(true);
130
- await transaction.commit('test');
140
+ await transaction.commit('test.1');
131
141
  testEntity.$nymph = nymph;
132
142
  expect(await transaction.inTransaction()).toEqual(false);
133
143
  await testEntity.$refresh();
@@ -138,7 +148,7 @@ This one's zip code is 92064.`;
138
148
  it('options', async () => {
139
149
  await createTestEntities();
140
150
  const resultEntities = await nymph.getEntities({
141
- class: testArtifacts_1.TestModel,
151
+ class: TestModel,
142
152
  reverse: true,
143
153
  offset: 1,
144
154
  limit: 1,
@@ -149,174 +159,174 @@ This one's zip code is 92064.`;
149
159
  });
150
160
  it('guid and tags', async () => {
151
161
  await createTestEntities();
152
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: 'test' });
162
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid, tag: 'test' });
153
163
  expect(testEntity.$is(resultEntity)).toEqual(true);
154
164
  });
155
165
  it('or selector', async () => {
156
166
  await createTestEntities();
157
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [testGuid, (0, guid_1.guid)()] });
167
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '|', guid: [testGuid, (0, guid_1.guid)()] });
158
168
  expect(testEntity.$is(resultEntity)).toEqual(true);
159
169
  });
160
170
  it('wrong or selector', async () => {
161
171
  await createTestEntities();
162
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [(0, guid_1.guid)(), (0, guid_1.guid)()] });
172
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '|', guid: [(0, guid_1.guid)(), (0, guid_1.guid)()] });
163
173
  expect(testEntity.$is(resultEntity)).toEqual(false);
164
174
  });
165
175
  it('not guid', async () => {
166
176
  await createTestEntities();
167
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', '!guid': (0, guid_1.guid)(), tag: 'test' });
177
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', '!guid': (0, guid_1.guid)(), tag: 'test' });
168
178
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
169
179
  });
170
180
  it('not tags', async () => {
171
181
  await createTestEntities();
172
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
182
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
173
183
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
174
184
  });
175
185
  it('guid and wrong tags', async () => {
176
186
  await createTestEntities();
177
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
187
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
178
188
  expect(resultEntity).toBeNull();
179
189
  });
180
190
  it('tags', async () => {
181
191
  await createTestEntities();
182
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' });
192
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' });
183
193
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
184
194
  });
185
195
  it('wrong tags', async () => {
186
196
  await createTestEntities();
187
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' });
197
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles' });
188
198
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
189
199
  });
190
200
  it('inclusive tags', async () => {
191
201
  await createTestEntities();
192
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
202
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
193
203
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
194
204
  });
195
205
  it('wrong inclusive tags', async () => {
196
206
  await createTestEntities();
197
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
207
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
198
208
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
199
209
  });
200
210
  it('mixed tags', async () => {
201
211
  await createTestEntities();
202
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
212
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
203
213
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
204
214
  });
205
215
  it('wrong inclusive mixed tags', async () => {
206
216
  await createTestEntities();
207
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
217
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
208
218
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
209
219
  });
210
220
  it('wrong exclusive mixed tags', async () => {
211
221
  await createTestEntities();
212
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
222
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
213
223
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
214
224
  });
215
225
  it('defined', async () => {
216
226
  await createTestEntities();
217
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', defined: 'string' });
227
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', defined: 'string' });
218
228
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
219
229
  });
220
230
  it('not defined', async () => {
221
231
  await createTestEntities();
222
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
232
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
223
233
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
224
234
  });
225
235
  it('defined in a not and clause', async () => {
226
236
  await createTestEntities();
227
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
237
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
228
238
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
229
239
  });
230
240
  it('equal', async () => {
231
241
  await createTestEntities();
232
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', equal: ['string', 'test'] });
242
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', equal: ['string', 'test'] });
233
243
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
234
244
  });
235
245
  it('not equal', async () => {
236
246
  await createTestEntities();
237
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
247
+ const referenceEntity = await TestModel.factory(refGuid);
238
248
  expect(referenceEntity.guid).toEqual(refGuid);
239
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
249
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
240
250
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
241
251
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
242
252
  });
243
253
  it('like', async () => {
244
254
  await createTestEntities();
245
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 't_s%'] });
255
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', like: ['string', 't_s%'] });
246
256
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
247
257
  });
248
258
  it('not like', async () => {
249
259
  await createTestEntities();
250
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
260
+ const referenceEntity = await TestModel.factory(refGuid);
251
261
  expect(referenceEntity.guid).toEqual(refGuid);
252
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
262
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
253
263
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
254
264
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
255
265
  });
256
266
  it('ilike', async () => {
257
267
  await createTestEntities();
258
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
268
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
259
269
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
260
270
  });
261
271
  it('not ilike', async () => {
262
272
  await createTestEntities();
263
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
273
+ const referenceEntity = await TestModel.factory(refGuid);
264
274
  expect(referenceEntity.guid).toEqual(refGuid);
265
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
275
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
266
276
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
267
277
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
268
278
  });
269
279
  it('like with wrong case', async () => {
270
280
  await createTestEntities();
271
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 'T_s%'] });
281
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', like: ['string', 'T_s%'] });
272
282
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
273
283
  });
274
284
  it('tags and equal', async () => {
275
285
  await createTestEntities();
276
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
286
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
277
287
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
278
288
  });
279
289
  it('wrong tags right equal', async () => {
280
290
  await createTestEntities();
281
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
291
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
282
292
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
283
293
  });
284
294
  it('right tags wrong equal', async () => {
285
295
  await createTestEntities();
286
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
296
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
287
297
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
288
298
  });
289
299
  it('wrong tags wrong equal', async () => {
290
300
  await createTestEntities();
291
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
301
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
292
302
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
293
303
  });
294
304
  it('contain', async () => {
295
305
  await createTestEntities();
296
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'values'] });
306
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', 'values'] });
297
307
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
298
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'test'] });
308
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['string', 'test'] });
299
309
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
300
310
  });
301
311
  it('not contain', async () => {
302
312
  await createTestEntities();
303
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
313
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
304
314
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
305
315
  });
306
316
  it('wrong contain', async () => {
307
317
  await createTestEntities();
308
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'pickles'] });
318
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', 'pickles'] });
309
319
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
310
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'pickles'] });
320
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['string', 'pickles'] });
311
321
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
312
322
  });
313
323
  it('match', async () => {
314
324
  await createTestEntities();
315
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', '.*'] });
325
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', match: ['match', '.*'] });
316
326
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
317
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
327
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
318
328
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
319
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, {
329
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, {
320
330
  type: '|',
321
331
  match: [
322
332
  ['string', '[0-9]'],
@@ -324,13 +334,13 @@ This one's zip code is 92064.`;
324
334
  ],
325
335
  });
326
336
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
327
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
337
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
328
338
  type: '&',
329
339
  tag: 'test',
330
340
  match: ['match', '[-a-zA-Z0-9+_]+@[-a-zA-Z0-9_]+.[-a-zA-Z0-9_]{2,4}'],
331
341
  });
332
342
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
333
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
343
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
334
344
  type: '&',
335
345
  tag: 'test',
336
346
  match: ['match', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'],
@@ -339,16 +349,16 @@ This one's zip code is 92064.`;
339
349
  });
340
350
  it('imatch', async () => {
341
351
  await createTestEntities();
342
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
352
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
343
353
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
344
354
  });
345
355
  it('wrong match', async () => {
346
356
  await createTestEntities();
347
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', 'Q'] });
357
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', match: ['match', 'Q'] });
348
358
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
349
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
359
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
350
360
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
351
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
361
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
352
362
  type: '|',
353
363
  match: [
354
364
  ['string', '[0-9]'],
@@ -359,17 +369,17 @@ This one's zip code is 92064.`;
359
369
  });
360
370
  it('match wrong case', async () => {
361
371
  await createTestEntities();
362
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
372
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
363
373
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
364
374
  });
365
375
  it('match and equal inclusive', async () => {
366
376
  await createTestEntities();
367
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
377
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
368
378
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
369
379
  });
370
380
  it('greater than', async () => {
371
381
  await createTestEntities();
372
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
382
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
373
383
  type: '|',
374
384
  gt: [
375
385
  ['number', 30],
@@ -377,7 +387,7 @@ This one's zip code is 92064.`;
377
387
  ],
378
388
  });
379
389
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
380
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
390
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
381
391
  type: '|',
382
392
  gt: [
383
393
  ['number', 31],
@@ -385,7 +395,7 @@ This one's zip code is 92064.`;
385
395
  ],
386
396
  });
387
397
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
388
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
398
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
389
399
  type: '|',
390
400
  gt: [
391
401
  ['number', 29],
@@ -393,7 +403,7 @@ This one's zip code is 92064.`;
393
403
  ],
394
404
  });
395
405
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
396
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
406
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
397
407
  type: '|',
398
408
  gt: [
399
409
  ['numberString', 30],
@@ -401,7 +411,7 @@ This one's zip code is 92064.`;
401
411
  ],
402
412
  });
403
413
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
404
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
414
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
405
415
  type: '|',
406
416
  gt: [
407
417
  ['numberString', 31],
@@ -409,7 +419,7 @@ This one's zip code is 92064.`;
409
419
  ],
410
420
  });
411
421
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
412
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
422
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
413
423
  type: '|',
414
424
  gt: [
415
425
  ['numberString', 29],
@@ -420,7 +430,7 @@ This one's zip code is 92064.`;
420
430
  });
421
431
  it('greater than or equal', async () => {
422
432
  await createTestEntities();
423
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
433
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
424
434
  type: '|',
425
435
  gte: [
426
436
  ['number', 30],
@@ -428,7 +438,7 @@ This one's zip code is 92064.`;
428
438
  ],
429
439
  });
430
440
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
431
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
441
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
432
442
  type: '|',
433
443
  gte: [
434
444
  ['number', 31],
@@ -436,7 +446,7 @@ This one's zip code is 92064.`;
436
446
  ],
437
447
  });
438
448
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
439
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
449
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
440
450
  type: '|',
441
451
  gte: [
442
452
  ['number', 29],
@@ -444,7 +454,7 @@ This one's zip code is 92064.`;
444
454
  ],
445
455
  });
446
456
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
447
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
457
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
448
458
  type: '|',
449
459
  gte: [
450
460
  ['numberString', 30],
@@ -452,7 +462,7 @@ This one's zip code is 92064.`;
452
462
  ],
453
463
  });
454
464
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
455
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
465
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
456
466
  type: '|',
457
467
  gte: [
458
468
  ['numberString', 31],
@@ -460,7 +470,7 @@ This one's zip code is 92064.`;
460
470
  ],
461
471
  });
462
472
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
463
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
473
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
464
474
  type: '|',
465
475
  gte: [
466
476
  ['numberString', 29],
@@ -471,7 +481,7 @@ This one's zip code is 92064.`;
471
481
  });
472
482
  it('less than', async () => {
473
483
  await createTestEntities();
474
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
484
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
475
485
  type: '|',
476
486
  lt: [
477
487
  ['number', 30],
@@ -479,7 +489,7 @@ This one's zip code is 92064.`;
479
489
  ],
480
490
  });
481
491
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
482
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
492
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
483
493
  type: '|',
484
494
  lt: [
485
495
  ['number', 31],
@@ -487,7 +497,7 @@ This one's zip code is 92064.`;
487
497
  ],
488
498
  });
489
499
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
490
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
500
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
491
501
  type: '|',
492
502
  lt: [
493
503
  ['number', 29],
@@ -495,7 +505,7 @@ This one's zip code is 92064.`;
495
505
  ],
496
506
  });
497
507
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
498
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
508
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
499
509
  type: '|',
500
510
  lt: [
501
511
  ['numberString', 30],
@@ -503,7 +513,7 @@ This one's zip code is 92064.`;
503
513
  ],
504
514
  });
505
515
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
506
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
516
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
507
517
  type: '|',
508
518
  lt: [
509
519
  ['numberString', 31],
@@ -511,7 +521,7 @@ This one's zip code is 92064.`;
511
521
  ],
512
522
  });
513
523
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
514
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
524
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
515
525
  type: '|',
516
526
  lt: [
517
527
  ['numberString', 29],
@@ -522,7 +532,7 @@ This one's zip code is 92064.`;
522
532
  });
523
533
  it('less than or equal', async () => {
524
534
  await createTestEntities();
525
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
535
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
526
536
  type: '|',
527
537
  lte: [
528
538
  ['number', 30],
@@ -530,7 +540,7 @@ This one's zip code is 92064.`;
530
540
  ],
531
541
  });
532
542
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
533
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
543
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
534
544
  type: '|',
535
545
  lte: [
536
546
  ['number', 31],
@@ -538,7 +548,7 @@ This one's zip code is 92064.`;
538
548
  ],
539
549
  });
540
550
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
541
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
551
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
542
552
  type: '|',
543
553
  lte: [
544
554
  ['number', 29],
@@ -546,7 +556,7 @@ This one's zip code is 92064.`;
546
556
  ],
547
557
  });
548
558
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
549
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
559
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
550
560
  type: '|',
551
561
  lte: [
552
562
  ['numberString', 30],
@@ -554,7 +564,7 @@ This one's zip code is 92064.`;
554
564
  ],
555
565
  });
556
566
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
557
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
567
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
558
568
  type: '|',
559
569
  lte: [
560
570
  ['numberString', 31],
@@ -562,7 +572,7 @@ This one's zip code is 92064.`;
562
572
  ],
563
573
  });
564
574
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
565
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
575
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
566
576
  type: '|',
567
577
  lte: [
568
578
  ['numberString', 29],
@@ -573,31 +583,31 @@ This one's zip code is 92064.`;
573
583
  });
574
584
  it('not inequality', async () => {
575
585
  await createTestEntities();
576
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
586
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
577
587
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
578
588
  });
579
589
  it('wrong inequality', async () => {
580
590
  await createTestEntities();
581
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', lte: ['number', 29.99] });
591
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', lte: ['number', 29.99] });
582
592
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
583
593
  });
584
594
  it('greater than cdate', async () => {
585
595
  await createTestEntities();
586
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] });
596
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] });
587
597
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
588
598
  });
589
599
  it('wrong cdate', async () => {
590
600
  await createTestEntities();
591
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] });
601
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] });
592
602
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
593
603
  });
594
604
  it('time selector', async () => {
595
605
  await createTestEntities();
596
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
597
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-1 day'] });
606
+ const referenceEntity = await TestModel.factory(refGuid);
607
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['timestamp', null, '-1 day'] });
598
608
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
599
609
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
600
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
610
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
601
611
  type: '|',
602
612
  gt: [
603
613
  ['timestamp', null, '-1 day'],
@@ -606,23 +616,23 @@ This one's zip code is 92064.`;
606
616
  });
607
617
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
608
618
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
609
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
619
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
610
620
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
611
621
  expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
612
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
622
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
613
623
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
614
624
  expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
615
625
  });
616
626
  it('wrong time selector', async () => {
617
627
  await createTestEntities();
618
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
619
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] });
628
+ const referenceEntity = await TestModel.factory(refGuid);
629
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] });
620
630
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
621
631
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
622
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
632
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
623
633
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
624
634
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
625
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
635
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
626
636
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
627
637
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
628
638
  });
@@ -633,27 +643,27 @@ This one's zip code is 92064.`;
633
643
  });
634
644
  it('ref', async () => {
635
645
  await createTestEntities();
636
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
646
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', refGuid] });
637
647
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
638
648
  });
639
649
  it('not ref', async () => {
640
650
  await createTestEntities();
641
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', (0, guid_1.guid)()] });
651
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', (0, guid_1.guid)()] });
642
652
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
643
653
  });
644
654
  it('wrong ref', async () => {
645
655
  await createTestEntities();
646
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
656
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
647
657
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
648
658
  });
649
659
  it('nonexistent ref', async () => {
650
660
  await createTestEntities();
651
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['pickle', refGuid] });
661
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['pickle', refGuid] });
652
662
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
653
663
  });
654
664
  it('inclusive ref', async () => {
655
665
  await createTestEntities();
656
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
666
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
657
667
  type: '|',
658
668
  ref: [
659
669
  ['reference', refGuid],
@@ -664,7 +674,7 @@ This one's zip code is 92064.`;
664
674
  });
665
675
  it('wrong inclusive ref', async () => {
666
676
  await createTestEntities();
667
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
677
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
668
678
  type: '|',
669
679
  ref: [
670
680
  ['reference', (0, guid_1.guid)()],
@@ -675,12 +685,12 @@ This one's zip code is 92064.`;
675
685
  });
676
686
  it('ref in an array', async () => {
677
687
  await createTestEntities();
678
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['refArray', refGuid] });
688
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['refArray', refGuid] });
679
689
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
680
690
  });
681
691
  it('wrong ref in an array', async () => {
682
692
  await createTestEntities();
683
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
693
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
684
694
  type: '&',
685
695
  ref: [
686
696
  ['refArray', refGuid],
@@ -691,7 +701,7 @@ This one's zip code is 92064.`;
691
701
  });
692
702
  it('logic operations', async () => {
693
703
  await createTestEntities();
694
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
704
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
695
705
  type: '&',
696
706
  '!ref': [
697
707
  ['refArray', (0, guid_1.guid)()],
@@ -727,34 +737,34 @@ This one's zip code is 92064.`;
727
737
  });
728
738
  it('count return', async () => {
729
739
  await createTestEntities();
730
- const result = await nymph.getEntities({ class: testArtifacts_1.TestModel });
740
+ const result = await nymph.getEntities({ class: TestModel });
731
741
  const resultCount = await nymph.getEntities({
732
- class: testArtifacts_1.TestModel,
742
+ class: TestModel,
733
743
  return: 'count',
734
744
  });
735
745
  expect(resultCount).toBeGreaterThanOrEqual(1);
736
746
  expect(resultCount).toEqual(result.length);
737
- const resultSelectors = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
738
- const resultSelectorsCount = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'count' }, { type: '&', ref: ['reference', refGuid] });
747
+ const resultSelectors = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', refGuid] });
748
+ const resultSelectorsCount = await nymph.getEntities({ class: TestModel, return: 'count' }, { type: '&', ref: ['reference', refGuid] });
739
749
  expect(resultSelectorsCount).toBeGreaterThanOrEqual(1);
740
750
  expect(resultSelectorsCount).toEqual(resultSelectors.length);
741
751
  const resultSelectorsLimit = await nymph.getEntities({
742
- class: testArtifacts_1.TestModel,
752
+ class: TestModel,
743
753
  limit: 1,
744
754
  return: 'count',
745
755
  });
746
756
  expect(resultSelectorsLimit).toEqual(1);
747
757
  const resultSelectorsSingle = await nymph.getEntity({
748
- class: testArtifacts_1.TestModel,
758
+ class: TestModel,
749
759
  return: 'count',
750
760
  });
751
761
  expect(resultSelectorsSingle).toEqual(1);
752
- const resultSelectorsEmpty = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'count' }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
762
+ const resultSelectorsEmpty = await nymph.getEntities({ class: TestModel, return: 'count' }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
753
763
  expect(resultSelectorsEmpty).toEqual(0);
754
764
  });
755
765
  it('guid return', async () => {
756
766
  await createTestEntities();
757
- const resultGuid = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'guid' }, {
767
+ const resultGuid = await nymph.getEntities({ class: TestModel, return: 'guid' }, {
758
768
  type: '&',
759
769
  '!ref': [
760
770
  ['refArray', (0, guid_1.guid)()],
@@ -790,7 +800,7 @@ This one's zip code is 92064.`;
790
800
  });
791
801
  it('deep selector', async () => {
792
802
  await createTestEntities();
793
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
803
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
794
804
  type: '&',
795
805
  '!ref': [
796
806
  ['refArray', (0, guid_1.guid)()],
@@ -830,7 +840,7 @@ This one's zip code is 92064.`;
830
840
  ],
831
841
  });
832
842
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
833
- const resultEntity2 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
843
+ const resultEntity2 = await nymph.getEntities({ class: TestModel }, {
834
844
  type: '&',
835
845
  '!ref': [
836
846
  ['refArray', (0, guid_1.guid)()],
@@ -870,7 +880,7 @@ This one's zip code is 92064.`;
870
880
  ],
871
881
  });
872
882
  expect(testEntity.$inArray(resultEntity2)).toEqual(true);
873
- const resultEntity3 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
883
+ const resultEntity3 = await nymph.getEntities({ class: TestModel }, {
874
884
  type: '|',
875
885
  selector: [
876
886
  {
@@ -882,7 +892,7 @@ This one's zip code is 92064.`;
882
892
  ],
883
893
  });
884
894
  expect(testEntity.$inArray(resultEntity3)).toEqual(true);
885
- const resultEntity4 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
895
+ const resultEntity4 = await nymph.getEntities({ class: TestModel }, {
886
896
  type: '|',
887
897
  selector: [
888
898
  {
@@ -902,7 +912,7 @@ This one's zip code is 92064.`;
902
912
  expect(testEntity.$inArray(resultEntity4)).toEqual(true);
903
913
  });
904
914
  it('wrong deep selector', async () => {
905
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
915
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
906
916
  type: '&',
907
917
  selector: [
908
918
  {
@@ -917,62 +927,59 @@ This one's zip code is 92064.`;
917
927
  });
918
928
  it('qref', async () => {
919
929
  await createTestEntities();
920
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
930
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
921
931
  type: '&',
922
932
  qref: [
923
933
  'reference',
924
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'good'] }],
934
+ [{ class: TestModel }, { type: '&', equal: ['test', 'good'] }],
925
935
  ],
926
936
  });
927
937
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
928
938
  });
929
939
  it('not qref', async () => {
930
940
  await createTestEntities();
931
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
941
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
932
942
  type: '&',
933
943
  '!qref': [
934
944
  'reference',
935
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'pickles'] }],
945
+ [{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
936
946
  ],
937
947
  });
938
948
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
939
949
  });
940
950
  it('wrong qref class', async () => {
941
951
  await createTestEntities();
942
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
952
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
943
953
  type: '&',
944
954
  qref: [
945
955
  'reference',
946
- [{ class: testArtifacts_1.TestBModel }, { type: '&', equal: ['test', 'good'] }],
956
+ [{ class: TestBModel }, { type: '&', equal: ['test', 'good'] }],
947
957
  ],
948
958
  });
949
959
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
950
960
  });
951
961
  it('wrong qref data', async () => {
952
962
  await createTestEntities();
953
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
963
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
954
964
  type: '&',
955
965
  qref: [
956
966
  'reference',
957
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'pickles'] }],
967
+ [{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
958
968
  ],
959
969
  });
960
970
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
961
971
  });
962
- it('sort option', async () => {
972
+ it('cdate and mdate sort option', async () => {
963
973
  await createMultipleTestEntities();
964
974
  for (const sort of ['cdate', 'mdate']) {
965
- let resultEntities = await nymph.getEntities({
966
- class: testArtifacts_1.TestModel,
967
- sort: sort,
968
- });
975
+ let resultEntities = await nymph.getEntities({ class: TestModel, sort });
969
976
  expect(resultEntities.length).toBeGreaterThan(100);
970
977
  for (let i = 0; i < resultEntities.length - 1; i++) {
971
978
  expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
972
979
  }
973
980
  let resultGuids = await nymph.getEntities({
974
- class: testArtifacts_1.TestModel,
975
- sort: sort,
981
+ class: TestModel,
982
+ sort,
976
983
  return: 'guid',
977
984
  });
978
985
  expect(resultGuids.length).toBeGreaterThan(100);
@@ -980,26 +987,67 @@ This one's zip code is 92064.`;
980
987
  expect(resultGuids[i]).toEqual(resultEntities[i].guid);
981
988
  }
982
989
  resultEntities = await nymph.getEntities({
983
- class: testArtifacts_1.TestModel,
984
- sort: sort,
990
+ class: TestModel,
991
+ sort,
985
992
  reverse: true,
986
993
  });
987
994
  expect(resultEntities.length).toBeGreaterThan(100);
988
995
  for (let i = 0; i < resultEntities.length - 1; i++) {
989
996
  expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
990
997
  }
991
- resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort }, { type: '&', match: ['name', '^Multi Test '] });
998
+ resultEntities = await nymph.getEntities({ class: TestModel, sort }, { type: '&', match: ['name', '^Multi Test '] });
992
999
  expect(resultEntities.length).toEqual(100);
993
1000
  for (let i = 0; i < resultEntities.length - 1; i++) {
994
1001
  expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
995
1002
  }
996
- resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
1003
+ resultEntities = await nymph.getEntities({ class: TestModel, sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
997
1004
  expect(resultEntities.length).toEqual(100);
998
1005
  for (let i = 0; i < resultEntities.length - 1; i++) {
999
1006
  expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
1000
1007
  }
1001
1008
  }
1002
1009
  });
1010
+ it('property sort option', async () => {
1011
+ await createMultipleTestEntities();
1012
+ let resultEntities = await nymph.getEntities({
1013
+ class: TestModel,
1014
+ sort: 'number',
1015
+ });
1016
+ expect(resultEntities.length).toBeGreaterThan(100);
1017
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1018
+ expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThanOrEqual(resultEntities[i].number ?? 0);
1019
+ }
1020
+ let resultGuids = await nymph.getEntities({
1021
+ class: TestModel,
1022
+ sort: 'number',
1023
+ return: 'guid',
1024
+ });
1025
+ expect(resultGuids.length).toBeGreaterThan(100);
1026
+ for (let i = 0; i < resultGuids.length - 1; i++) {
1027
+ expect(resultGuids[i]).toEqual(resultEntities[i].guid);
1028
+ }
1029
+ resultEntities = await nymph.getEntities({
1030
+ class: TestModel,
1031
+ sort: 'number',
1032
+ reverse: true,
1033
+ });
1034
+ expect(resultEntities.length).toBeGreaterThan(100);
1035
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1036
+ expect(resultEntities[i + 1].number ?? 0).toBeLessThanOrEqual(resultEntities[i].number ?? Infinity);
1037
+ }
1038
+ resultEntities = await nymph.getEntities({ class: TestModel, sort: 'number' }, { type: '&', match: ['name', '^Multi Test '] });
1039
+ expect(resultEntities.length).toEqual(100);
1040
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1041
+ expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThan(resultEntities[i].number ?? 0);
1042
+ expect(resultEntities[i].name).toEqual(`Multi Test ${100 - (resultEntities[i].number ?? 0)}`);
1043
+ }
1044
+ resultEntities = await nymph.getEntities({ class: TestModel, sort: 'number', reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
1045
+ expect(resultEntities.length).toEqual(100);
1046
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1047
+ expect(resultEntities[i + 1].number ?? 0).toBeLessThan(resultEntities[i].number ?? Infinity);
1048
+ expect(resultEntities[i].name).toEqual(`Multi Test ${100 - (resultEntities[i].number ?? 0)}`);
1049
+ }
1050
+ });
1003
1051
  it('delete reference', async () => {
1004
1052
  await createTestEntities();
1005
1053
  expect(await testEntity.reference?.$delete()).toEqual(true);
@@ -1009,14 +1057,12 @@ This one's zip code is 92064.`;
1009
1057
  await createTestEntities();
1010
1058
  expect(await testEntity.$delete()).toEqual(true);
1011
1059
  expect(testEntity.guid).toBeNull();
1012
- const entity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid });
1060
+ const entity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid });
1013
1061
  expect(entity).toBeNull();
1014
1062
  });
1015
1063
  }
1016
1064
  exports.QueriesTest = QueriesTest;
1017
1065
  function UIDTest(nymph, it) {
1018
- nymph.addEntityClass(testArtifacts_1.TestModel);
1019
- nymph.addEntityClass(testArtifacts_1.TestBModel);
1020
1066
  it('delete old test data', async () => {
1021
1067
  expect(await nymph.deleteUID('TestUID')).toEqual(true);
1022
1068
  expect(await nymph.deleteUID('NewUID')).toEqual(true);
@@ -1049,22 +1095,22 @@ function UIDTest(nymph, it) {
1049
1095
  }
1050
1096
  exports.UIDTest = UIDTest;
1051
1097
  function ExportImportTest(nymph, it) {
1052
- nymph.addEntityClass(testArtifacts_1.TestModel);
1053
- nymph.addEntityClass(testArtifacts_1.TestBModel);
1098
+ const TestModel = nymph.addEntityClass(testArtifacts_1.TestModel);
1099
+ const TestBModel = nymph.addEntityClass(testArtifacts_1.TestBModel);
1054
1100
  async function deleteTestData() {
1055
- let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1101
+ let all = await nymph.getEntities({ class: TestModel });
1056
1102
  expect(Array.isArray(all)).toEqual(true);
1057
1103
  for (const cur of all) {
1058
1104
  expect(await cur.$delete()).toEqual(true);
1059
1105
  }
1060
- all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1106
+ all = await nymph.getEntities({ class: TestModel });
1061
1107
  expect(all.length).toEqual(0);
1062
- all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1108
+ all = await nymph.getEntities({ class: TestBModel });
1063
1109
  expect(Array.isArray(all)).toEqual(true);
1064
1110
  for (const cur of all) {
1065
1111
  expect(await cur.$delete()).toEqual(true);
1066
1112
  }
1067
- all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1113
+ all = await nymph.getEntities({ class: TestBModel });
1068
1114
  expect(all.length).toEqual(0);
1069
1115
  expect(await nymph.deleteUID('TestUID')).toEqual(true);
1070
1116
  expect(await nymph.deleteUID('TestUID2')).toEqual(true);
@@ -1072,8 +1118,8 @@ function ExportImportTest(nymph, it) {
1072
1118
  async function checkEntityDataAndCount() {
1073
1119
  expect(await nymph.getUID('TestUID')).toEqual(2);
1074
1120
  expect(await nymph.getUID('TestUID2')).toEqual(1);
1075
- const models = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1076
- const bmodels = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1121
+ const models = await nymph.getEntities({ class: TestModel });
1122
+ const bmodels = await nymph.getEntities({ class: TestBModel });
1077
1123
  expect(models.length).toEqual(30);
1078
1124
  expect(bmodels.length).toEqual(10);
1079
1125
  const all = [...models, ...bmodels];
@@ -1100,7 +1146,7 @@ function ExportImportTest(nymph, it) {
1100
1146
  expect(await nymph.newUID('TestUID')).toEqual(2);
1101
1147
  expect(await nymph.newUID('TestUID2')).toEqual(1);
1102
1148
  for (let i = 0; i < 20; i++) {
1103
- const EntityClass = i < 15 ? testArtifacts_1.TestModel : testArtifacts_1.TestBModel;
1149
+ const EntityClass = i < 15 ? TestModel : TestBModel;
1104
1150
  const testEntity = await EntityClass.factory();
1105
1151
  testEntity.name = 'Entity Test ' + new Date().toLocaleString();
1106
1152
  testEntity.null = null;
@@ -1128,8 +1174,8 @@ function ExportImportTest(nymph, it) {
1128
1174
  it('import data', async () => {
1129
1175
  expect(await nymph.getUID('TestUID')).toBeNull();
1130
1176
  expect(await nymph.getUID('TestUID2')).toBeNull();
1131
- const models = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1132
- const bmodels = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1177
+ const models = await nymph.getEntities({ class: TestModel });
1178
+ const bmodels = await nymph.getEntities({ class: TestBModel });
1133
1179
  expect(models.length).toEqual(0);
1134
1180
  expect(bmodels.length).toEqual(0);
1135
1181
  expect(await nymph.import(__dirname + '/testentityexport.nex')).toEqual(true);