@nymphjs/nymph 1.0.0-beta.1 → 1.0.0-beta.100

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +535 -0
  2. package/README.md +14 -22
  3. package/dist/Entity.d.ts +293 -10
  4. package/dist/Entity.js +571 -149
  5. package/dist/Entity.js.map +1 -1
  6. package/dist/Entity.test.js +67 -26
  7. package/dist/Entity.test.js.map +1 -1
  8. package/dist/Entity.types.d.ts +256 -23
  9. package/dist/Entity.types.js +1 -2
  10. package/dist/Nymph.d.ts +497 -13
  11. package/dist/Nymph.js +761 -188
  12. package/dist/Nymph.js.map +1 -1
  13. package/dist/Nymph.types.d.ts +95 -26
  14. package/dist/Nymph.types.js +3 -5
  15. package/dist/Nymph.types.js.map +1 -1
  16. package/dist/conf/d.d.ts +43 -0
  17. package/dist/conf/d.js +1 -2
  18. package/dist/conf/defaults.d.ts +1 -1
  19. package/dist/conf/defaults.js +26 -3
  20. package/dist/conf/defaults.js.map +1 -1
  21. package/dist/conf/index.d.ts +2 -2
  22. package/dist/conf/index.js +2 -8
  23. package/dist/conf/index.js.map +1 -1
  24. package/dist/driver/NymphDriver.d.ts +181 -43
  25. package/dist/driver/NymphDriver.js +532 -285
  26. package/dist/driver/NymphDriver.js.map +1 -1
  27. package/dist/driver/index.d.ts +2 -2
  28. package/dist/driver/index.js +3 -23
  29. package/dist/driver/index.js.map +1 -1
  30. package/dist/driver/testArtifacts.d.ts +2 -2
  31. package/dist/driver/testArtifacts.js +939 -219
  32. package/dist/driver/testArtifacts.js.map +1 -1
  33. package/dist/errors/ClassNotAvailableError.js +1 -5
  34. package/dist/errors/ClassNotAvailableError.js.map +1 -1
  35. package/dist/errors/EntityConflictError.js +1 -5
  36. package/dist/errors/EntityConflictError.js.map +1 -1
  37. package/dist/errors/EntityInvalidDataError.d.ts +6 -0
  38. package/dist/errors/EntityInvalidDataError.js +8 -6
  39. package/dist/errors/EntityInvalidDataError.js.map +1 -1
  40. package/dist/errors/EntityIsSleepingReferenceError.js +1 -5
  41. package/dist/errors/EntityIsSleepingReferenceError.js.map +1 -1
  42. package/dist/errors/EntityUniqueConstraintError.d.ts +3 -0
  43. package/dist/errors/EntityUniqueConstraintError.js +7 -0
  44. package/dist/errors/EntityUniqueConstraintError.js.map +1 -0
  45. package/dist/errors/InvalidParametersError.js +1 -5
  46. package/dist/errors/InvalidParametersError.js.map +1 -1
  47. package/dist/errors/InvalidStateError.d.ts +3 -0
  48. package/dist/errors/InvalidStateError.js +7 -0
  49. package/dist/errors/InvalidStateError.js.map +1 -0
  50. package/dist/errors/NotConfiguredError.js +1 -5
  51. package/dist/errors/NotConfiguredError.js.map +1 -1
  52. package/dist/errors/QueryFailedError.js +2 -5
  53. package/dist/errors/QueryFailedError.js.map +1 -1
  54. package/dist/errors/UnableToConnectError.js +1 -5
  55. package/dist/errors/UnableToConnectError.js.map +1 -1
  56. package/dist/errors/index.d.ts +10 -8
  57. package/dist/errors/index.js +10 -24
  58. package/dist/errors/index.js.map +1 -1
  59. package/dist/index.d.ts +11 -11
  60. package/dist/index.js +14 -34
  61. package/dist/index.js.map +1 -1
  62. package/dist/nymphJoiProps.js +10 -15
  63. package/dist/nymphJoiProps.js.map +1 -1
  64. package/dist/testArtifacts.d.ts +19 -6
  65. package/dist/testArtifacts.js +32 -37
  66. package/dist/testArtifacts.js.map +1 -1
  67. package/dist/testMocks.d.ts +28 -11
  68. package/dist/testMocks.js +44 -28
  69. package/dist/testMocks.js.map +1 -1
  70. package/dist/utils.d.ts +4 -4
  71. package/dist/utils.js +40 -29
  72. package/dist/utils.js.map +1 -1
  73. package/jest.config.js +11 -2
  74. package/package.json +24 -20
  75. package/src/Entity.test.ts +63 -13
  76. package/src/Entity.ts +498 -156
  77. package/src/Entity.types.ts +72 -74
  78. package/src/Nymph.ts +904 -336
  79. package/src/Nymph.types.ts +179 -44
  80. package/src/conf/d.ts +25 -0
  81. package/src/conf/defaults.ts +34 -1
  82. package/src/conf/index.ts +2 -2
  83. package/src/driver/NymphDriver.ts +650 -460
  84. package/src/driver/index.ts +2 -2
  85. package/src/driver/testArtifacts.ts +966 -196
  86. package/src/errors/EntityUniqueConstraintError.ts +6 -0
  87. package/src/errors/InvalidStateError.ts +6 -0
  88. package/src/errors/index.ts +12 -8
  89. package/src/index.ts +11 -11
  90. package/src/nymphJoiProps.ts +2 -2
  91. package/src/testArtifacts.ts +20 -20
  92. package/src/testMocks.ts +85 -37
  93. package/src/type/locutus.d.ts +3 -0
  94. package/src/utils.ts +39 -18
  95. package/tsconfig.json +5 -3
  96. package/typedoc.json +4 -0
@@ -1,43 +1,49 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ExportImportTest = exports.UIDTest = exports.QueriesTest = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const strtotime_1 = __importDefault(require("locutus/php/datetime/strtotime"));
9
- const guid_1 = require("@nymphjs/guid");
10
- const testArtifacts_1 = require("../testArtifacts");
11
- function QueriesTest(nymph, it) {
12
- nymph.addEntityClass(testArtifacts_1.TestModel);
13
- nymph.addEntityClass(testArtifacts_1.TestBModel);
1
+ import { dirname } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import fs from 'node:fs';
4
+ import strtotime from 'locutus/php/datetime/strtotime.js';
5
+ import { guid } from '@nymphjs/guid';
6
+ import { EntityUniqueConstraintError } from '../errors/index.js';
7
+ import { TestBModel as TestBModelClass, TestModel as TestModelClass, TestEmptyModel as TestEmptyModelClass, } from '../testArtifacts.js';
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ export function EntitiesTest(nymph, it) {
10
+ const TestModel = nymph.addEntityClass(TestModelClass);
11
+ const TestBModel = nymph.addEntityClass(TestBModelClass);
12
+ const TestEmptyModel = nymph.addEntityClass(TestEmptyModelClass);
14
13
  let testEntity;
15
14
  let testGuid;
16
15
  let refGuid;
17
16
  let createdMultiple = false;
17
+ // The entities created by this function are required by many of the tests.
18
18
  async function createTestEntities() {
19
19
  if (testGuid != null) {
20
20
  return;
21
21
  }
22
- testEntity = await testArtifacts_1.TestModel.factory();
22
+ // Creating entity...
23
+ testEntity = await TestModel.factory();
24
+ // Saving entity...
23
25
  testEntity.name = 'Entity Test ' + new Date().toLocaleString();
24
26
  testEntity.null = null;
25
27
  testEntity.string = 'test';
26
- testEntity.array = ['full', 'of', 'values', 500];
27
- testEntity.match = `Hello, my name is Edward McCheese. It is a pleasure to meet you. As you can see, I have several hats of the most pleasant nature.
28
-
29
- This one's email address is nice_hat-wednesday+newyork@im-a-hat.hat.
30
- This one's phone number is (555) 555-1818.
31
- This one's zip code is 92064.`;
28
+ testEntity.array = [
29
+ 'full',
30
+ 'of',
31
+ 'values',
32
+ 500,
33
+ { test: true },
34
+ { nullbyte: '\\\x00\u0000 \x00' },
35
+ ];
36
+ testEntity.match = matchValue;
37
+ testEntity.search = searchValue;
32
38
  testEntity.number = 30;
33
39
  testEntity.numberString = '30';
34
40
  testEntity.timestamp = Date.now();
35
41
  expect(await testEntity.$save()).toEqual(true);
36
42
  expect(testEntity.guid).not.toBeNull();
37
43
  testGuid = testEntity.guid;
38
- const entityReferenceTest = new testArtifacts_1.TestModel();
44
+ const entityReferenceTest = new TestModel();
39
45
  entityReferenceTest.string = 'wrong';
40
- entityReferenceTest.timestamp = (0, strtotime_1.default)('-2 days') * 1000;
46
+ entityReferenceTest.timestamp = strtotime('-2 days') * 1000;
41
47
  expect(await entityReferenceTest.$save()).toEqual(true);
42
48
  refGuid = entityReferenceTest.guid;
43
49
  testEntity.reference = entityReferenceTest;
@@ -45,38 +51,53 @@ This one's zip code is 92064.`;
45
51
  expect(await testEntity.$save()).toEqual(true);
46
52
  entityReferenceTest.test = 'good';
47
53
  expect(await entityReferenceTest.$save()).toEqual(true);
48
- testEntity = nymph.driver.getEntitySync({ class: testArtifacts_1.TestModel }, testGuid);
49
- expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
50
- expect(testEntity.guid).toEqual(testGuid);
51
- testEntity = (await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
52
- expect(testEntity).toBeInstanceOf(testArtifacts_1.TestModel);
54
+ // Test asynchronous getEntity.
55
+ testEntity = (await nymph.getEntity({ class: TestModel }, testGuid));
56
+ expect(testEntity).toBeInstanceOf(TestModel);
53
57
  expect(testEntity.guid).toEqual(testGuid);
54
58
  }
59
+ // The entities created by this function are required by many of the tests.
55
60
  async function createMultipleTestEntities() {
56
61
  if (!createdMultiple) {
57
62
  createdMultiple = true;
63
+ // Creating 100 entities...
58
64
  for (let i = 0; i < 100; i++) {
59
- const testEntity = await testArtifacts_1.TestModel.factory();
65
+ const testEntity = await TestModel.factory();
60
66
  testEntity.name = `Multi Test ${i}`;
67
+ // Reverse the number for sort testing.
68
+ testEntity.number = 100 - i;
61
69
  testEntity.$removeTag('test');
62
70
  testEntity.$addTag('multiTest');
63
71
  expect(await testEntity.$save()).toEqual(true);
72
+ // Pause for a few milliseconds so the cdate and mdate can be sorted.
64
73
  await new Promise((res) => setTimeout(() => res(1), 5));
65
74
  }
66
75
  }
67
76
  }
68
77
  it('delete old test data', async () => {
69
- let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
70
- expect(Array.isArray(all)).toEqual(true);
71
- for (const cur of all) {
78
+ let amodels = await nymph.getEntities({ class: TestModel });
79
+ expect(Array.isArray(amodels)).toEqual(true);
80
+ for (const cur of amodels) {
72
81
  expect(await cur.$delete()).toEqual(true);
73
82
  }
74
- all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
75
- expect(all.length).toEqual(0);
83
+ amodels = await nymph.getEntities({ class: TestModel });
84
+ expect(amodels.length).toEqual(0);
85
+ let bmodels = await nymph.getEntities({ class: TestBModel });
86
+ expect(Array.isArray(bmodels)).toEqual(true);
87
+ for (const cur of bmodels) {
88
+ expect(await cur.$delete()).toEqual(true);
89
+ }
90
+ bmodels = await nymph.getEntities({ class: TestBModel });
91
+ expect(bmodels.length).toEqual(0);
76
92
  });
77
93
  it('create entity', async () => {
78
94
  await createTestEntities();
79
95
  });
96
+ it("doesn't create empty entity", async () => {
97
+ const testEntity = await TestEmptyModel.factory();
98
+ expect(await testEntity.$save()).toBeFalsy();
99
+ expect(testEntity.guid).toBeNull();
100
+ });
80
101
  it('update mdate on save', async () => {
81
102
  await createTestEntities();
82
103
  const oldMdate = testEntity.mdate ?? Infinity;
@@ -89,15 +110,42 @@ This one's zip code is 92064.`;
89
110
  });
90
111
  it('by guid', async () => {
91
112
  await createTestEntities();
92
- let resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
113
+ // Retrieving entity by GUID...
114
+ let resultEntity = await nymph.getEntity({ class: TestModel }, testGuid);
93
115
  expect(testEntity.$is(resultEntity)).toEqual(true);
94
- resultEntity = await testArtifacts_1.TestModel.factory(testGuid);
116
+ // Using class constructor...
117
+ resultEntity = await TestModel.factory(testGuid);
95
118
  expect(testEntity.$is(resultEntity)).toEqual(true);
96
- resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, (0, guid_1.guid)());
119
+ // Testing wrong GUID...
120
+ resultEntity = await nymph.getEntity({ class: TestModel }, guid());
97
121
  expect(testEntity.$is(resultEntity)).toEqual(false);
98
122
  });
123
+ it('guaranteed guid', async () => {
124
+ // Creating entity...
125
+ const testEntity = await TestModel.factory();
126
+ // Saving entity...
127
+ testEntity.name = 'Entity Test ' + new Date().toLocaleString();
128
+ testEntity.null = null;
129
+ testEntity.string = 'test';
130
+ testEntity.array = [];
131
+ testEntity.match = matchValue;
132
+ testEntity.number = 30;
133
+ testEntity.numberString = '30';
134
+ testEntity.timestamp = Date.now();
135
+ // Get the guaranteed GUID.
136
+ const testGuid = testEntity.$getGuaranteedGUID();
137
+ expect(await testEntity.$save()).toEqual(true);
138
+ expect(testEntity.guid).not.toBeNull();
139
+ expect(testEntity.guid).toEqual(testGuid);
140
+ // Retrieving entity by GUID...
141
+ let resultEntity = await nymph.getEntity({ class: TestModel }, testGuid);
142
+ expect(testEntity.$is(resultEntity)).toEqual(true);
143
+ // Delete the entity.
144
+ expect(await testEntity.$delete()).toEqual(true);
145
+ });
99
146
  it('transactions', async () => {
100
147
  await createTestEntities();
148
+ // Verify not in a transaction.
101
149
  expect(await nymph.inTransaction()).toEqual(false);
102
150
  let transaction = await nymph.startTransaction('test');
103
151
  testEntity.$nymph = transaction;
@@ -106,39 +154,58 @@ This one's zip code is 92064.`;
106
154
  await transaction.rollback('test');
107
155
  return;
108
156
  }
157
+ // Change a value in the test entity.
109
158
  testEntity.string = 'bad value';
110
159
  expect(await testEntity.$save()).toEqual(true);
160
+ // Rollback the transaction.
111
161
  await transaction.rollback('test');
162
+ // Verify not in a transaction.
112
163
  expect(await transaction.inTransaction()).toEqual(false);
164
+ // Verify the value is correct.
113
165
  await testEntity.$refresh();
114
166
  expect(testEntity.string).toEqual('test');
167
+ // Start a new transaction.
115
168
  transaction = await nymph.startTransaction('test');
116
169
  testEntity.$nymph = transaction;
170
+ // Verify in a transaction.
117
171
  expect(await transaction.inTransaction()).toEqual(true);
172
+ // Delete the entity.
118
173
  expect(await testEntity.$delete()).toEqual(true);
119
- const resultEntity = await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid);
174
+ const resultEntity = await transaction.getEntity({ class: TestModel }, testGuid);
120
175
  expect(resultEntity).toBeNull();
176
+ // Rollback the transaction.
121
177
  await transaction.rollback('test');
178
+ // Verify not in a transaction.
122
179
  expect(await transaction.inTransaction()).toEqual(false);
123
- testEntity = (await transaction.getEntity({ class: testArtifacts_1.TestModel }, testGuid));
180
+ // Verify it's back.
181
+ testEntity = (await transaction.getEntity({ class: TestModel }, testGuid));
124
182
  expect(testEntity.guid).toEqual(testGuid);
125
- transaction = await nymph.startTransaction('test');
183
+ // Start a new transaction with a dot in the name.
184
+ transaction = await nymph.startTransaction('test.1');
126
185
  testEntity.$nymph = transaction;
186
+ // Verify in a transaction.
127
187
  expect(await transaction.inTransaction()).toEqual(true);
188
+ // Make a change.
128
189
  testEntity.string = 'fish';
129
190
  expect(await testEntity.$save()).toEqual(true);
130
- await transaction.commit('test');
191
+ // Commit the transaction.
192
+ await transaction.commit('test.1');
131
193
  testEntity.$nymph = nymph;
194
+ // Verify not in a transaction.
132
195
  expect(await transaction.inTransaction()).toEqual(false);
196
+ // Verify the value is correct.
133
197
  await testEntity.$refresh();
134
198
  expect(testEntity.string).toEqual('fish');
199
+ // Finally, change it back.
135
200
  testEntity.string = 'test';
136
201
  expect(await testEntity.$save()).toEqual(true);
202
+ // TODO: nested transactions
137
203
  });
138
204
  it('options', async () => {
139
205
  await createTestEntities();
206
+ // Testing entity order, offset, limit...
140
207
  const resultEntities = await nymph.getEntities({
141
- class: testArtifacts_1.TestModel,
208
+ class: TestModel,
142
209
  reverse: true,
143
210
  offset: 1,
144
211
  limit: 1,
@@ -149,174 +216,241 @@ This one's zip code is 92064.`;
149
216
  });
150
217
  it('guid and tags', async () => {
151
218
  await createTestEntities();
152
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: 'test' });
219
+ // Retrieving entity by GUID and tags...
220
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid, tag: 'test' });
153
221
  expect(testEntity.$is(resultEntity)).toEqual(true);
154
222
  });
155
223
  it('or selector', async () => {
156
224
  await createTestEntities();
157
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [testGuid, (0, guid_1.guid)()] });
225
+ // Retrieving entity by GUID and tags...
226
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '|', guid: [testGuid, guid()] });
158
227
  expect(testEntity.$is(resultEntity)).toEqual(true);
159
228
  });
160
229
  it('wrong or selector', async () => {
161
230
  await createTestEntities();
162
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '|', guid: [(0, guid_1.guid)(), (0, guid_1.guid)()] });
231
+ // Retrieving entity by GUID and tags...
232
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '|', guid: [guid(), guid()] });
163
233
  expect(testEntity.$is(resultEntity)).toEqual(false);
164
234
  });
165
235
  it('not guid', async () => {
166
236
  await createTestEntities();
167
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', '!guid': (0, guid_1.guid)(), tag: 'test' });
237
+ // Retrieving entity by !GUID...
238
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', '!guid': guid(), tag: 'test' });
168
239
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
169
240
  });
170
241
  it('not tags', async () => {
171
242
  await createTestEntities();
172
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
243
+ // Retrieving entity by !tags...
244
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', guid: testGuid, '!tag': ['barbecue', 'pickles'] });
173
245
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
174
246
  });
175
247
  it('guid and wrong tags', async () => {
176
248
  await createTestEntities();
177
- const resultEntity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
249
+ // Testing GUID and wrong tags...
250
+ const resultEntity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid, tag: ['pickles'] });
178
251
  expect(resultEntity).toBeNull();
179
252
  });
180
253
  it('tags', async () => {
181
254
  await createTestEntities();
182
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' });
255
+ // Retrieving entity by tags...
256
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' });
183
257
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
184
258
  });
185
259
  it('wrong tags', async () => {
186
260
  await createTestEntities();
187
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' });
261
+ // Testing wrong tags...
262
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles' });
188
263
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
189
264
  });
190
265
  it('inclusive tags', async () => {
191
266
  await createTestEntities();
192
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
267
+ // Retrieving entity by tags inclusively...
268
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
193
269
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
194
270
  });
195
271
  it('wrong inclusive tags', async () => {
196
272
  await createTestEntities();
197
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
273
+ // Testing wrong inclusive tags...
274
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '|', tag: ['pickles', 'barbecue'] });
198
275
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
199
276
  });
200
277
  it('mixed tags', async () => {
201
278
  await createTestEntities();
202
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
279
+ // Retrieving entity by mixed tags...
280
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'test', 'barbecue'] });
203
281
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
204
282
  });
205
283
  it('wrong inclusive mixed tags', async () => {
206
284
  await createTestEntities();
207
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
285
+ // Testing wrong inclusive mixed tags...
286
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', tag: ['pickles', 'barbecue'] });
208
287
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
209
288
  });
210
289
  it('wrong exclusive mixed tags', async () => {
211
290
  await createTestEntities();
212
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
291
+ // Testing wrong exclusive mixed tags...
292
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles' }, { type: '|', tag: ['test', 'barbecue'] });
213
293
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
214
294
  });
215
295
  it('defined', async () => {
216
296
  await createTestEntities();
217
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', defined: 'string' });
297
+ // Retrieving entity by defined...
298
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', defined: 'string' });
218
299
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
219
300
  });
220
301
  it('not defined', async () => {
221
302
  await createTestEntities();
222
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
303
+ // Retrieving entity by !defined...
304
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!defined': 'pickles' });
223
305
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
224
306
  });
225
307
  it('defined in a not and clause', async () => {
226
308
  await createTestEntities();
227
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
309
+ // Retrieving entity by defined in not and clause...
310
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '!&', defined: 'pickles' }, { type: '&', tag: 'test' });
228
311
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
229
312
  });
230
313
  it('equal', async () => {
231
314
  await createTestEntities();
232
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', equal: ['string', 'test'] });
315
+ // Retrieving entity by equal...
316
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', equal: ['string', 'test'] });
317
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
318
+ // Retrieving entity by equal...
319
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', equal: ['null', null] });
320
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
321
+ // Retrieving entity by equal...
322
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', equal: ['boolean', true] });
323
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
324
+ // Retrieving entity by equal...
325
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', equal: ['number', 30] });
326
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
327
+ // Retrieving entity by equal...
328
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
329
+ type: '&',
330
+ equal: [
331
+ 'array',
332
+ [
333
+ 'full',
334
+ 'of',
335
+ 'values',
336
+ 500,
337
+ { test: true },
338
+ { nullbyte: '\\\x00\u0000 \x00' },
339
+ ],
340
+ ],
341
+ });
342
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
343
+ // Retrieving entity by equal...
344
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
345
+ type: '&',
346
+ equal: ['match', matchValue],
347
+ });
233
348
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
234
349
  });
235
350
  it('not equal', async () => {
236
351
  await createTestEntities();
237
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
352
+ const referenceEntity = await TestModel.factory(refGuid);
238
353
  expect(referenceEntity.guid).toEqual(refGuid);
239
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
354
+ // Retrieving entity by !equal...
355
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!equal': ['string', 'wrong'] });
240
356
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
241
357
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
242
358
  });
243
359
  it('like', async () => {
244
360
  await createTestEntities();
245
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 't_s%'] });
361
+ // Retrieving entity by like...
362
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', like: ['string', 't_s%'] });
246
363
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
247
364
  });
248
365
  it('not like', async () => {
249
366
  await createTestEntities();
250
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
367
+ const referenceEntity = await TestModel.factory(refGuid);
251
368
  expect(referenceEntity.guid).toEqual(refGuid);
252
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
369
+ // Retrieving entity by !like...
370
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!like': ['string', 'wr_n%'] });
253
371
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
254
372
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
255
373
  });
256
374
  it('ilike', async () => {
257
375
  await createTestEntities();
258
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
376
+ // Retrieving entity by ilike...
377
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ilike: ['string', 'T_s%'] });
259
378
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
260
379
  });
261
380
  it('not ilike', async () => {
262
381
  await createTestEntities();
263
- const referenceEntity = await testArtifacts_1.TestModel.factory(refGuid);
382
+ const referenceEntity = await TestModel.factory(refGuid);
264
383
  expect(referenceEntity.guid).toEqual(refGuid);
265
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
384
+ // Retrieving entity by !ilike...
385
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', '!ilike': ['string', 'wr_n%'] });
266
386
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
267
387
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
268
388
  });
269
389
  it('like with wrong case', async () => {
270
390
  await createTestEntities();
271
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', like: ['string', 'T_s%'] });
391
+ // Retrieving entity by like...
392
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', like: ['string', 'T_s%'] });
272
393
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
273
394
  });
274
395
  it('tags and equal', async () => {
275
396
  await createTestEntities();
276
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
397
+ // Retrieving entity by tags and equal...
398
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', equal: ['string', 'test'] });
277
399
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
278
400
  });
279
401
  it('wrong tags right equal', async () => {
280
402
  await createTestEntities();
281
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
403
+ // Testing wrong tags and right equal...
404
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'test'] });
282
405
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
283
406
  });
284
407
  it('right tags wrong equal', async () => {
285
408
  await createTestEntities();
286
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
409
+ // Testing right tags and wrong equal...
410
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', equal: ['string', 'pickles'] });
287
411
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
288
412
  });
289
413
  it('wrong tags wrong equal', async () => {
290
414
  await createTestEntities();
291
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
415
+ // Testing wrong tags and wrong equal...
416
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickles', equal: ['string', 'pickles'] });
292
417
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
293
418
  });
294
419
  it('contain', async () => {
295
420
  await createTestEntities();
296
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'values'] });
421
+ // Retrieving entity by contain...
422
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', 'values'] });
423
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
424
+ // Retrieving entity by contain...
425
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', 500] });
297
426
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
298
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'test'] });
427
+ // Retrieving entity by contain...
428
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', { test: true }] });
299
429
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
300
430
  });
301
431
  it('not contain', async () => {
302
432
  await createTestEntities();
303
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
433
+ // Retrieving entity by !contain...
434
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', contain: ['array', 'pickles'] });
304
435
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
305
436
  });
306
437
  it('wrong contain', async () => {
307
438
  await createTestEntities();
308
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['array', 'pickles'] });
439
+ // Testing wrong contain...
440
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['array', 'pickles'] });
309
441
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
310
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', contain: ['string', 'pickles'] });
442
+ // Testing wrong contain...
443
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', contain: ['string', 'pickles'] });
311
444
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
312
445
  });
313
446
  it('match', async () => {
314
447
  await createTestEntities();
315
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', '.*'] });
448
+ // Retrieving entity by regex match...
449
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', match: ['match', '.*'] });
316
450
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
317
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
451
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', match: ['match', 'Edward McCheese'] });
318
452
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
319
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, {
453
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, {
320
454
  type: '|',
321
455
  match: [
322
456
  ['string', '[0-9]'],
@@ -324,13 +458,13 @@ This one's zip code is 92064.`;
324
458
  ],
325
459
  });
326
460
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
327
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
461
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
328
462
  type: '&',
329
463
  tag: 'test',
330
464
  match: ['match', '[-a-zA-Z0-9+_]+@[-a-zA-Z0-9_]+.[-a-zA-Z0-9_]{2,4}'],
331
465
  });
332
466
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
333
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
467
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
334
468
  type: '&',
335
469
  tag: 'test',
336
470
  match: ['match', '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'],
@@ -339,16 +473,18 @@ This one's zip code is 92064.`;
339
473
  });
340
474
  it('imatch', async () => {
341
475
  await createTestEntities();
342
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
476
+ // Retrieving entity by regex match...
477
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', imatch: ['match', 'edward mccheese'] });
343
478
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
344
479
  });
345
480
  it('wrong match', async () => {
346
481
  await createTestEntities();
347
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', match: ['match', 'Q'] });
482
+ // Testing wrong regex match...
483
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', match: ['match', '='] });
348
484
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
349
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
485
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickle', match: ['match', '.*'] });
350
486
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
351
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
487
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
352
488
  type: '|',
353
489
  match: [
354
490
  ['string', '[0-9]'],
@@ -359,17 +495,134 @@ This one's zip code is 92064.`;
359
495
  });
360
496
  it('match wrong case', async () => {
361
497
  await createTestEntities();
362
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
498
+ // Retrieving entity by regex match...
499
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', match: ['match', 'edward mccheese'] });
363
500
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
364
501
  });
365
502
  it('match and equal inclusive', async () => {
366
503
  await createTestEntities();
367
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
504
+ // Retrieving entity by regex + equal inclusively...
505
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], match: ['string', 'test'] });
506
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
507
+ });
508
+ it('basic search', async () => {
509
+ await createTestEntities();
510
+ // Retrieving entity by full text search...
511
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
512
+ type: '&',
513
+ tag: 'test',
514
+ search: [
515
+ 'search',
516
+ 'Declaration of the thirteen united States of America',
517
+ ],
518
+ });
519
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
520
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, {
521
+ type: '|',
522
+ search: [
523
+ ['string', 'pickle'],
524
+ ['search', 'Declaration of the thirteen united States of America'],
525
+ ],
526
+ });
527
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
528
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
529
+ type: '&',
530
+ tag: 'test',
531
+ search: ['search', 'July 4, 1776'],
532
+ });
533
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
534
+ });
535
+ it('or search', async () => {
536
+ await createTestEntities();
537
+ // Retrieving entity by full text search...
538
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
539
+ type: '&',
540
+ tag: 'test',
541
+ search: ['search', 'Declaration or pickles'],
542
+ });
543
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
544
+ });
545
+ it('series search', async () => {
546
+ await createTestEntities();
547
+ // Retrieving entity by full text search...
548
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
549
+ type: '&',
550
+ tag: 'test',
551
+ search: ['search', '"excited domestic insurrections"'],
552
+ });
553
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
554
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
555
+ type: '&',
556
+ tag: 'test',
557
+ search: ['search', "'exciting domestic insurrected'"],
558
+ });
559
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
560
+ });
561
+ it('negated search', async () => {
562
+ await createTestEntities();
563
+ // Retrieving entity by full text search...
564
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
565
+ type: '&',
566
+ tag: 'test',
567
+ search: ['search', '-pickle'],
568
+ });
569
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
570
+ });
571
+ it('combined search', async () => {
572
+ await createTestEntities();
573
+ // Retrieving entity by full text search...
574
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
575
+ type: '&',
576
+ tag: 'test',
577
+ search: ['search', 'Declaration -pickle'],
578
+ });
579
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
580
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
581
+ type: '&',
582
+ tag: 'test',
583
+ search: ['search', 'Declaration "General Congress"'],
584
+ });
585
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
586
+ });
587
+ it('wrong search', async () => {
588
+ await createTestEntities();
589
+ // Testing wrong search...
590
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', search: ['search', 'pickles'] });
591
+ expect(testEntity.$inArray(resultEntity)).toEqual(false);
592
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'pickle', search: ['search', 'Declaration'] });
593
+ expect(testEntity.$inArray(resultEntity)).toEqual(false);
594
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
595
+ type: '|',
596
+ search: [
597
+ ['string', 'pickle'],
598
+ ['search', 'Hawaii'],
599
+ ],
600
+ });
601
+ expect(testEntity.$inArray(resultEntity)).toEqual(false);
602
+ });
603
+ it('search must be case insensitive', async () => {
604
+ await createTestEntities();
605
+ // Retrieving entity by full text search...
606
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
607
+ type: '&',
608
+ tag: 'test',
609
+ search: [
610
+ 'search',
611
+ 'DECLARATION OF THE THIRTEEN UNITED STATES OF AMERICA',
612
+ ],
613
+ });
614
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
615
+ });
616
+ it('search and equal inclusive', async () => {
617
+ await createTestEntities();
618
+ // Retrieving entity by fts + equal inclusively...
619
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '|', equal: ['string', 'pickles'], search: ['string', 'test'] });
368
620
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
369
621
  });
370
622
  it('greater than', async () => {
371
623
  await createTestEntities();
372
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
624
+ // Retrieving entity by inequality...
625
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
373
626
  type: '|',
374
627
  gt: [
375
628
  ['number', 30],
@@ -377,7 +630,8 @@ This one's zip code is 92064.`;
377
630
  ],
378
631
  });
379
632
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
380
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
633
+ // Retrieving entity by inequality...
634
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
381
635
  type: '|',
382
636
  gt: [
383
637
  ['number', 31],
@@ -385,7 +639,8 @@ This one's zip code is 92064.`;
385
639
  ],
386
640
  });
387
641
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
388
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
642
+ // Retrieving entity by inequality...
643
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
389
644
  type: '|',
390
645
  gt: [
391
646
  ['number', 29],
@@ -393,7 +648,8 @@ This one's zip code is 92064.`;
393
648
  ],
394
649
  });
395
650
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
396
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
651
+ // Retrieving entity by inequality...
652
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
397
653
  type: '|',
398
654
  gt: [
399
655
  ['numberString', 30],
@@ -401,7 +657,8 @@ This one's zip code is 92064.`;
401
657
  ],
402
658
  });
403
659
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
404
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
660
+ // Retrieving entity by inequality...
661
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
405
662
  type: '|',
406
663
  gt: [
407
664
  ['numberString', 31],
@@ -409,7 +666,8 @@ This one's zip code is 92064.`;
409
666
  ],
410
667
  });
411
668
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
412
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
669
+ // Retrieving entity by inequality...
670
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
413
671
  type: '|',
414
672
  gt: [
415
673
  ['numberString', 29],
@@ -420,7 +678,8 @@ This one's zip code is 92064.`;
420
678
  });
421
679
  it('greater than or equal', async () => {
422
680
  await createTestEntities();
423
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
681
+ // Retrieving entity by inequality...
682
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
424
683
  type: '|',
425
684
  gte: [
426
685
  ['number', 30],
@@ -428,7 +687,8 @@ This one's zip code is 92064.`;
428
687
  ],
429
688
  });
430
689
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
431
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
690
+ // Retrieving entity by inequality...
691
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
432
692
  type: '|',
433
693
  gte: [
434
694
  ['number', 31],
@@ -436,7 +696,8 @@ This one's zip code is 92064.`;
436
696
  ],
437
697
  });
438
698
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
439
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
699
+ // Retrieving entity by inequality...
700
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
440
701
  type: '|',
441
702
  gte: [
442
703
  ['number', 29],
@@ -444,7 +705,8 @@ This one's zip code is 92064.`;
444
705
  ],
445
706
  });
446
707
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
447
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
708
+ // Retrieving entity by inequality...
709
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
448
710
  type: '|',
449
711
  gte: [
450
712
  ['numberString', 30],
@@ -452,7 +714,8 @@ This one's zip code is 92064.`;
452
714
  ],
453
715
  });
454
716
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
455
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
717
+ // Retrieving entity by inequality...
718
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
456
719
  type: '|',
457
720
  gte: [
458
721
  ['numberString', 31],
@@ -460,7 +723,8 @@ This one's zip code is 92064.`;
460
723
  ],
461
724
  });
462
725
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
463
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
726
+ // Retrieving entity by inequality...
727
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
464
728
  type: '|',
465
729
  gte: [
466
730
  ['numberString', 29],
@@ -471,7 +735,8 @@ This one's zip code is 92064.`;
471
735
  });
472
736
  it('less than', async () => {
473
737
  await createTestEntities();
474
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
738
+ // Retrieving entity by inequality...
739
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
475
740
  type: '|',
476
741
  lt: [
477
742
  ['number', 30],
@@ -479,7 +744,8 @@ This one's zip code is 92064.`;
479
744
  ],
480
745
  });
481
746
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
482
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
747
+ // Retrieving entity by inequality...
748
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
483
749
  type: '|',
484
750
  lt: [
485
751
  ['number', 31],
@@ -487,7 +753,8 @@ This one's zip code is 92064.`;
487
753
  ],
488
754
  });
489
755
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
490
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
756
+ // Retrieving entity by inequality...
757
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
491
758
  type: '|',
492
759
  lt: [
493
760
  ['number', 29],
@@ -495,7 +762,8 @@ This one's zip code is 92064.`;
495
762
  ],
496
763
  });
497
764
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
498
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
765
+ // Retrieving entity by inequality...
766
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
499
767
  type: '|',
500
768
  lt: [
501
769
  ['numberString', 30],
@@ -503,7 +771,8 @@ This one's zip code is 92064.`;
503
771
  ],
504
772
  });
505
773
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
506
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
774
+ // Retrieving entity by inequality...
775
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
507
776
  type: '|',
508
777
  lt: [
509
778
  ['numberString', 31],
@@ -511,7 +780,8 @@ This one's zip code is 92064.`;
511
780
  ],
512
781
  });
513
782
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
514
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
783
+ // Retrieving entity by inequality...
784
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
515
785
  type: '|',
516
786
  lt: [
517
787
  ['numberString', 29],
@@ -522,7 +792,8 @@ This one's zip code is 92064.`;
522
792
  });
523
793
  it('less than or equal', async () => {
524
794
  await createTestEntities();
525
- let resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
795
+ // Retrieving entity by inequality...
796
+ let resultEntity = await nymph.getEntities({ class: TestModel }, {
526
797
  type: '|',
527
798
  lte: [
528
799
  ['number', 30],
@@ -530,7 +801,8 @@ This one's zip code is 92064.`;
530
801
  ],
531
802
  });
532
803
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
533
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
804
+ // Retrieving entity by inequality...
805
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
534
806
  type: '|',
535
807
  lte: [
536
808
  ['number', 31],
@@ -538,7 +810,8 @@ This one's zip code is 92064.`;
538
810
  ],
539
811
  });
540
812
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
541
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
813
+ // Retrieving entity by inequality...
814
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
542
815
  type: '|',
543
816
  lte: [
544
817
  ['number', 29],
@@ -546,7 +819,8 @@ This one's zip code is 92064.`;
546
819
  ],
547
820
  });
548
821
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
549
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
822
+ // Retrieving entity by inequality...
823
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
550
824
  type: '|',
551
825
  lte: [
552
826
  ['numberString', 30],
@@ -554,7 +828,8 @@ This one's zip code is 92064.`;
554
828
  ],
555
829
  });
556
830
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
557
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
831
+ // Retrieving entity by inequality...
832
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
558
833
  type: '|',
559
834
  lte: [
560
835
  ['numberString', 31],
@@ -562,7 +837,8 @@ This one's zip code is 92064.`;
562
837
  ],
563
838
  });
564
839
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
565
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
840
+ // Retrieving entity by inequality...
841
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
566
842
  type: '|',
567
843
  lte: [
568
844
  ['numberString', 29],
@@ -573,31 +849,37 @@ This one's zip code is 92064.`;
573
849
  });
574
850
  it('not inequality', async () => {
575
851
  await createTestEntities();
576
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
852
+ // Retrieving entity by !inequality...
853
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', gte: ['number', 60] });
577
854
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
578
855
  });
579
856
  it('wrong inequality', async () => {
580
857
  await createTestEntities();
581
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', lte: ['number', 29.99] });
858
+ // Testing wrong inequality...
859
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', lte: ['number', 29.99] });
582
860
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
583
861
  });
584
862
  it('greater than cdate', async () => {
585
863
  await createTestEntities();
586
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] });
864
+ // Retrieving entity by time...
865
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['cdate', (testEntity.cdate ?? 0) - 120] });
587
866
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
588
867
  });
589
868
  it('wrong cdate', async () => {
590
869
  await createTestEntities();
591
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] });
870
+ // Testing wrong time...
871
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gte: ['cdate', (testEntity.cdate ?? 0) + 1] });
592
872
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
593
873
  });
594
874
  it('time selector', async () => {
595
875
  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'] });
876
+ const referenceEntity = await TestModel.factory(refGuid);
877
+ // Retrieving entity by relative time...
878
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['timestamp', null, '-1 day'] });
598
879
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
599
880
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
600
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
881
+ // Retrieving entity by relative time inclusively...
882
+ resultEntity = await nymph.getEntities({ class: TestModel }, {
601
883
  type: '|',
602
884
  gt: [
603
885
  ['timestamp', null, '-1 day'],
@@ -606,96 +888,114 @@ This one's zip code is 92064.`;
606
888
  });
607
889
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
608
890
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
609
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
891
+ // Retrieving entity by relative time...
892
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['timestamp', null, '-3 days'] });
610
893
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
611
894
  expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
612
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
895
+ // Retrieving entity by relative time...
896
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', gt: ['cdate', null, '-1 day'] });
613
897
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
614
898
  expect(referenceEntity.$inArray(resultEntity)).toEqual(true);
615
899
  });
616
900
  it('wrong time selector', async () => {
617
901
  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'] });
902
+ const referenceEntity = await TestModel.factory(refGuid);
903
+ // Retrieving entity by relative time...
904
+ let resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['timestamp', null, '+1 day'] });
620
905
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
621
906
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
622
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
907
+ // Retrieving entity by relative time...
908
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', lt: ['timestamp', null, '-3 days'] });
623
909
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
624
910
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
625
- resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
911
+ // Retrieving entity by relative time...
912
+ resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test', gt: ['cdate', null, '+1 day'] });
626
913
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
627
914
  expect(referenceEntity.$inArray(resultEntity)).toEqual(false);
628
915
  });
629
916
  it('references', async () => {
630
917
  await createTestEntities();
918
+ // Testing referenced entities...
919
+ await testEntity.reference?.$wake();
631
920
  expect(testEntity.reference?.test).toEqual('good');
921
+ // Testing referenced entity arrays...
922
+ await Promise.all(testEntity.refArray?.map((e) => e.$wake()) || []);
632
923
  expect(testEntity.refArray?.[0].test).toEqual('good');
633
924
  });
634
925
  it('ref', async () => {
635
926
  await createTestEntities();
636
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', refGuid] });
927
+ // Retrieving entity by reference...
928
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', refGuid] });
637
929
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
638
930
  });
639
931
  it('not ref', async () => {
640
932
  await createTestEntities();
641
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', (0, guid_1.guid)()] });
933
+ // Retrieving entity by !reference...
934
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', tag: 'test' }, { type: '!&', ref: ['reference', guid()] });
642
935
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
643
936
  });
644
937
  it('wrong ref', async () => {
645
938
  await createTestEntities();
646
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
939
+ // Testing wrong reference...
940
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', guid()] });
647
941
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
648
942
  });
649
943
  it('nonexistent ref', async () => {
650
944
  await createTestEntities();
651
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['pickle', refGuid] });
945
+ // Testing non-existent reference...
946
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['pickle', refGuid] });
652
947
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
653
948
  });
654
949
  it('inclusive ref', async () => {
655
950
  await createTestEntities();
656
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
951
+ // Retrieving entity by inclusive reference...
952
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
657
953
  type: '|',
658
954
  ref: [
659
955
  ['reference', refGuid],
660
- ['reference', (0, guid_1.guid)()],
956
+ ['reference', guid()],
661
957
  ],
662
958
  });
663
959
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
664
960
  });
665
961
  it('wrong inclusive ref', async () => {
666
962
  await createTestEntities();
667
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
963
+ // Testing wrong inclusive reference...
964
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
668
965
  type: '|',
669
966
  ref: [
670
- ['reference', (0, guid_1.guid)()],
671
- ['reference', (0, guid_1.guid)()],
967
+ ['reference', guid()],
968
+ ['reference', guid()],
672
969
  ],
673
970
  });
674
971
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
675
972
  });
676
973
  it('ref in an array', async () => {
677
974
  await createTestEntities();
678
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, { type: '&', ref: ['refArray', refGuid] });
975
+ // Retrieving entity by array reference...
976
+ const resultEntity = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['refArray', refGuid] });
679
977
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
680
978
  });
681
979
  it('wrong ref in an array', async () => {
682
980
  await createTestEntities();
683
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
981
+ // Testing wrong array reference...
982
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
684
983
  type: '&',
685
984
  ref: [
686
985
  ['refArray', refGuid],
687
- ['refArray', (0, guid_1.guid)()],
986
+ ['refArray', guid()],
688
987
  ],
689
988
  });
690
989
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
691
990
  });
692
991
  it('logic operations', async () => {
693
992
  await createTestEntities();
694
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
993
+ // Testing logic operations...
994
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
695
995
  type: '&',
696
996
  '!ref': [
697
- ['refArray', (0, guid_1.guid)()],
698
- ['refArray', (0, guid_1.guid)()],
997
+ ['refArray', guid()],
998
+ ['refArray', guid()],
699
999
  ],
700
1000
  '!lte': ['number', 29.99],
701
1001
  }, {
@@ -712,6 +1012,8 @@ This one's zip code is 92064.`;
712
1012
  ['array', 'of'],
713
1013
  ['array', 'values'],
714
1014
  ['array', 500],
1015
+ ['array', { test: true }],
1016
+ ['array', { nullbyte: '\\\x00\u0000 \x00' }],
715
1017
  ],
716
1018
  }, {
717
1019
  type: '!|',
@@ -727,38 +1029,44 @@ This one's zip code is 92064.`;
727
1029
  });
728
1030
  it('count return', async () => {
729
1031
  await createTestEntities();
730
- const result = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1032
+ const result = await nymph.getEntities({ class: TestModel });
1033
+ // Testing count return...
731
1034
  const resultCount = await nymph.getEntities({
732
- class: testArtifacts_1.TestModel,
1035
+ class: TestModel,
733
1036
  return: 'count',
734
1037
  });
735
1038
  expect(resultCount).toBeGreaterThanOrEqual(1);
736
1039
  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] });
1040
+ const resultSelectors = await nymph.getEntities({ class: TestModel }, { type: '&', ref: ['reference', refGuid] });
1041
+ // Testing count return with selectors...
1042
+ const resultSelectorsCount = await nymph.getEntities({ class: TestModel, return: 'count' }, { type: '&', ref: ['reference', refGuid] });
739
1043
  expect(resultSelectorsCount).toBeGreaterThanOrEqual(1);
740
1044
  expect(resultSelectorsCount).toEqual(resultSelectors.length);
1045
+ // Testing count return with limit...
741
1046
  const resultSelectorsLimit = await nymph.getEntities({
742
- class: testArtifacts_1.TestModel,
1047
+ class: TestModel,
743
1048
  limit: 1,
744
1049
  return: 'count',
745
1050
  });
746
1051
  expect(resultSelectorsLimit).toEqual(1);
1052
+ // Testing count return with limit...
747
1053
  const resultSelectorsSingle = await nymph.getEntity({
748
- class: testArtifacts_1.TestModel,
1054
+ class: TestModel,
749
1055
  return: 'count',
750
1056
  });
751
1057
  expect(resultSelectorsSingle).toEqual(1);
752
- const resultSelectorsEmpty = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'count' }, { type: '&', ref: ['reference', (0, guid_1.guid)()] });
1058
+ // Testing empty count...
1059
+ const resultSelectorsEmpty = await nymph.getEntities({ class: TestModel, return: 'count' }, { type: '&', ref: ['reference', guid()] });
753
1060
  expect(resultSelectorsEmpty).toEqual(0);
754
1061
  });
755
1062
  it('guid return', async () => {
756
1063
  await createTestEntities();
757
- const resultGuid = await nymph.getEntities({ class: testArtifacts_1.TestModel, return: 'guid' }, {
1064
+ // Testing guid return using logic operations...
1065
+ const resultGuid = await nymph.getEntities({ class: TestModel, return: 'guid' }, {
758
1066
  type: '&',
759
1067
  '!ref': [
760
- ['refArray', (0, guid_1.guid)()],
761
- ['refArray', (0, guid_1.guid)()],
1068
+ ['refArray', guid()],
1069
+ ['refArray', guid()],
762
1070
  ],
763
1071
  '!lte': ['number', 29.99],
764
1072
  }, {
@@ -775,6 +1083,8 @@ This one's zip code is 92064.`;
775
1083
  ['array', 'of'],
776
1084
  ['array', 'values'],
777
1085
  ['array', 500],
1086
+ ['array', { test: true }],
1087
+ ['array', { nullbyte: '\\\x00\u0000 \x00' }],
778
1088
  ],
779
1089
  }, {
780
1090
  type: '!|',
@@ -788,13 +1098,57 @@ This one's zip code is 92064.`;
788
1098
  });
789
1099
  expect(resultGuid.indexOf(testEntity.guid ?? '')).toBeGreaterThan(-1);
790
1100
  });
1101
+ it('object return', async () => {
1102
+ await createTestEntities();
1103
+ // Testing object return using logic operations...
1104
+ const resultObjects = await nymph.getEntities({ class: TestModel, return: 'object' }, {
1105
+ type: '&',
1106
+ '!ref': [
1107
+ ['refArray', guid()],
1108
+ ['refArray', guid()],
1109
+ ],
1110
+ '!lte': ['number', 29.99],
1111
+ }, {
1112
+ type: '|',
1113
+ '!lte': [
1114
+ ['number', 29.99],
1115
+ ['number', 30],
1116
+ ],
1117
+ }, {
1118
+ type: '!&',
1119
+ '!equal': ['string', 'test'],
1120
+ '!contain': [
1121
+ ['array', 'full'],
1122
+ ['array', 'of'],
1123
+ ['array', 'values'],
1124
+ ['array', 500],
1125
+ ['array', { test: true }],
1126
+ ['array', { nullbyte: '\\\x00\u0000 \x00' }],
1127
+ ],
1128
+ }, {
1129
+ type: '!|',
1130
+ '!equal': ['string', 'test'],
1131
+ contain: [
1132
+ ['array', 'full'],
1133
+ ['array', 'of'],
1134
+ ['array', 'values'],
1135
+ ['array', 500],
1136
+ ],
1137
+ });
1138
+ const resultObject = resultObjects.find((entity) => entity.guid === testEntity.guid);
1139
+ expect(resultObject).toBeInstanceOf(Object);
1140
+ expect(resultObject).not.toBeInstanceOf(TestModel);
1141
+ expect(Array.isArray(resultObject?.tags)).toBeTruthy();
1142
+ expect(resultObject?.string).toEqual('test');
1143
+ });
791
1144
  it('deep selector', async () => {
792
1145
  await createTestEntities();
793
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1146
+ // Testing deep selectors...
1147
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
794
1148
  type: '&',
795
1149
  '!ref': [
796
- ['refArray', (0, guid_1.guid)()],
797
- ['refArray', (0, guid_1.guid)()],
1150
+ ['refArray', guid()],
1151
+ ['refArray', guid()],
798
1152
  ],
799
1153
  '!lte': ['number', 29.99],
800
1154
  }, {
@@ -815,6 +1169,8 @@ This one's zip code is 92064.`;
815
1169
  ['array', 'of'],
816
1170
  ['array', 'values'],
817
1171
  ['array', 500],
1172
+ ['array', { test: true }],
1173
+ ['array', { nullbyte: '\\\x00\u0000 \x00' }],
818
1174
  ],
819
1175
  },
820
1176
  {
@@ -830,11 +1186,11 @@ This one's zip code is 92064.`;
830
1186
  ],
831
1187
  });
832
1188
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
833
- const resultEntity2 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1189
+ const resultEntity2 = await nymph.getEntities({ class: TestModel }, {
834
1190
  type: '&',
835
1191
  '!ref': [
836
- ['refArray', (0, guid_1.guid)()],
837
- ['refArray', (0, guid_1.guid)()],
1192
+ ['refArray', guid()],
1193
+ ['refArray', guid()],
838
1194
  ],
839
1195
  '!lte': ['number', 29.99],
840
1196
  }, {
@@ -855,6 +1211,8 @@ This one's zip code is 92064.`;
855
1211
  ['array', 'of'],
856
1212
  ['array', 'values'],
857
1213
  ['array', 500],
1214
+ ['array', { test: true }],
1215
+ ['array', { nullbyte: '\\\x00\u0000 \x00' }],
858
1216
  ],
859
1217
  },
860
1218
  {
@@ -870,24 +1228,24 @@ This one's zip code is 92064.`;
870
1228
  ],
871
1229
  });
872
1230
  expect(testEntity.$inArray(resultEntity2)).toEqual(true);
873
- const resultEntity3 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1231
+ const resultEntity3 = await nymph.getEntities({ class: TestModel }, {
874
1232
  type: '|',
875
1233
  selector: [
876
1234
  {
877
1235
  type: '&',
878
- '!ref': ['refArray', (0, guid_1.guid)()],
1236
+ '!ref': ['refArray', guid()],
879
1237
  '!lte': ['number', 29.99],
880
1238
  },
881
1239
  { type: '&', gte: ['number', 16000] },
882
1240
  ],
883
1241
  });
884
1242
  expect(testEntity.$inArray(resultEntity3)).toEqual(true);
885
- const resultEntity4 = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1243
+ const resultEntity4 = await nymph.getEntities({ class: TestModel }, {
886
1244
  type: '|',
887
1245
  selector: [
888
1246
  {
889
1247
  type: '&',
890
- '!ref': ['refArray', (0, guid_1.guid)()],
1248
+ '!ref': ['refArray', guid()],
891
1249
  '!lte': ['number', 29.99],
892
1250
  },
893
1251
  {
@@ -902,12 +1260,13 @@ This one's zip code is 92064.`;
902
1260
  expect(testEntity.$inArray(resultEntity4)).toEqual(true);
903
1261
  });
904
1262
  it('wrong deep selector', async () => {
905
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1263
+ // Testing wrong deep selectors...
1264
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
906
1265
  type: '&',
907
1266
  selector: [
908
1267
  {
909
1268
  type: '&',
910
- '!ref': ['refArray', (0, guid_1.guid)()],
1269
+ '!ref': ['refArray', guid()],
911
1270
  '!lte': ['number', 29.99],
912
1271
  },
913
1272
  { type: '&', gte: ['number', 16000] },
@@ -917,106 +1276,234 @@ This one's zip code is 92064.`;
917
1276
  });
918
1277
  it('qref', async () => {
919
1278
  await createTestEntities();
920
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1279
+ // Retrieving entity by qref...
1280
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
921
1281
  type: '&',
922
1282
  qref: [
923
1283
  'reference',
924
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'good'] }],
1284
+ [{ class: TestModel }, { type: '&', equal: ['test', 'good'] }],
925
1285
  ],
926
1286
  });
927
1287
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
928
1288
  });
929
1289
  it('not qref', async () => {
930
1290
  await createTestEntities();
931
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1291
+ // Retrieving entity by !qref...
1292
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
932
1293
  type: '&',
933
1294
  '!qref': [
934
1295
  'reference',
935
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'pickles'] }],
1296
+ [{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
936
1297
  ],
937
1298
  });
938
1299
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
939
1300
  });
940
1301
  it('wrong qref class', async () => {
941
1302
  await createTestEntities();
942
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1303
+ // Testing wrong qref...
1304
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
943
1305
  type: '&',
944
1306
  qref: [
945
1307
  'reference',
946
- [{ class: testArtifacts_1.TestBModel }, { type: '&', equal: ['test', 'good'] }],
1308
+ [{ class: TestBModel }, { type: '&', equal: ['test', 'good'] }],
947
1309
  ],
948
1310
  });
949
1311
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
950
1312
  });
951
1313
  it('wrong qref data', async () => {
952
1314
  await createTestEntities();
953
- const resultEntity = await nymph.getEntities({ class: testArtifacts_1.TestModel }, {
1315
+ // Testing wrong qref...
1316
+ const resultEntity = await nymph.getEntities({ class: TestModel }, {
954
1317
  type: '&',
955
1318
  qref: [
956
1319
  'reference',
957
- [{ class: testArtifacts_1.TestModel }, { type: '&', equal: ['test', 'pickles'] }],
1320
+ [{ class: TestModel }, { type: '&', equal: ['test', 'pickles'] }],
958
1321
  ],
959
1322
  });
960
1323
  expect(testEntity.$inArray(resultEntity)).toEqual(false);
961
1324
  });
962
- it('sort option', async () => {
1325
+ it('cdate and mdate sort option', async () => {
963
1326
  await createMultipleTestEntities();
964
1327
  for (const sort of ['cdate', 'mdate']) {
965
- let resultEntities = await nymph.getEntities({
966
- class: testArtifacts_1.TestModel,
967
- sort: sort,
968
- });
1328
+ // Retrieving entities sorted...
1329
+ let resultEntities = await nymph.getEntities({ class: TestModel, sort });
969
1330
  expect(resultEntities.length).toBeGreaterThan(100);
970
1331
  for (let i = 0; i < resultEntities.length - 1; i++) {
971
1332
  expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
972
1333
  }
1334
+ // And test the same with guid return...
973
1335
  let resultGuids = await nymph.getEntities({
974
- class: testArtifacts_1.TestModel,
975
- sort: sort,
1336
+ class: TestModel,
1337
+ sort,
976
1338
  return: 'guid',
977
1339
  });
978
1340
  expect(resultGuids.length).toBeGreaterThan(100);
979
1341
  for (let i = 0; i < resultGuids.length - 1; i++) {
980
1342
  expect(resultGuids[i]).toEqual(resultEntities[i].guid);
981
1343
  }
1344
+ // Retrieving entities reverse sorted...
982
1345
  resultEntities = await nymph.getEntities({
983
- class: testArtifacts_1.TestModel,
984
- sort: sort,
1346
+ class: TestModel,
1347
+ sort,
985
1348
  reverse: true,
986
1349
  });
987
1350
  expect(resultEntities.length).toBeGreaterThan(100);
988
1351
  for (let i = 0; i < resultEntities.length - 1; i++) {
989
1352
  expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
990
1353
  }
991
- resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort }, { type: '&', match: ['name', '^Multi Test '] });
1354
+ // And again with other selectors.
1355
+ // Retrieving entities sorted...
1356
+ resultEntities = await nymph.getEntities({ class: TestModel, sort }, { type: '&', match: ['name', '^Multi Test '] });
992
1357
  expect(resultEntities.length).toEqual(100);
993
1358
  for (let i = 0; i < resultEntities.length - 1; i++) {
994
1359
  expect(resultEntities[i + 1][sort]).toBeGreaterThan(resultEntities[i][sort] ?? 0);
995
1360
  }
996
- resultEntities = await nymph.getEntities({ class: testArtifacts_1.TestModel, sort: sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
1361
+ // Retrieving entities reverse sorted...
1362
+ resultEntities = await nymph.getEntities({ class: TestModel, sort, reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
997
1363
  expect(resultEntities.length).toEqual(100);
998
1364
  for (let i = 0; i < resultEntities.length - 1; i++) {
999
1365
  expect(resultEntities[i + 1][sort]).toBeLessThan(resultEntities[i][sort] ?? 0);
1000
1366
  }
1001
1367
  }
1002
1368
  });
1369
+ it('property sort option', async () => {
1370
+ await createMultipleTestEntities();
1371
+ // Retrieving entities sorted...
1372
+ let resultEntities = await nymph.getEntities({
1373
+ class: TestModel,
1374
+ sort: 'number',
1375
+ });
1376
+ expect(resultEntities.length).toBeGreaterThan(100);
1377
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1378
+ expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThanOrEqual(resultEntities[i].number ?? 0);
1379
+ }
1380
+ // And test the same with guid return...
1381
+ let resultGuids = await nymph.getEntities({
1382
+ class: TestModel,
1383
+ sort: 'number',
1384
+ return: 'guid',
1385
+ });
1386
+ expect(resultGuids.length).toBeGreaterThan(100);
1387
+ for (let i = 0; i < resultGuids.length - 1; i++) {
1388
+ expect(resultGuids[i]).toEqual(resultEntities[i].guid);
1389
+ }
1390
+ // Retrieving entities reverse sorted...
1391
+ resultEntities = await nymph.getEntities({
1392
+ class: TestModel,
1393
+ sort: 'number',
1394
+ reverse: true,
1395
+ });
1396
+ expect(resultEntities.length).toBeGreaterThan(100);
1397
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1398
+ expect(resultEntities[i + 1].number ?? 0).toBeLessThanOrEqual(resultEntities[i].number ?? Infinity);
1399
+ }
1400
+ // And again with other selectors.
1401
+ // Retrieving entities sorted...
1402
+ resultEntities = await nymph.getEntities({ class: TestModel, sort: 'number' }, { type: '&', match: ['name', '^Multi Test '] });
1403
+ expect(resultEntities.length).toEqual(100);
1404
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1405
+ expect(resultEntities[i + 1].number ?? Infinity).toBeGreaterThan(resultEntities[i].number ?? 0);
1406
+ expect(resultEntities[i].name).toEqual(`Multi Test ${100 - (resultEntities[i].number ?? 0)}`);
1407
+ }
1408
+ // Retrieving entities reverse sorted...
1409
+ resultEntities = await nymph.getEntities({ class: TestModel, sort: 'number', reverse: true }, { type: '&', match: ['name', '^Multi Test '] });
1410
+ expect(resultEntities.length).toEqual(100);
1411
+ for (let i = 0; i < resultEntities.length - 1; i++) {
1412
+ expect(resultEntities[i + 1].number ?? 0).toBeLessThan(resultEntities[i].number ?? Infinity);
1413
+ expect(resultEntities[i].name).toEqual(`Multi Test ${100 - (resultEntities[i].number ?? 0)}`);
1414
+ }
1415
+ });
1003
1416
  it('delete reference', async () => {
1004
1417
  await createTestEntities();
1418
+ // Deleting referenced entities...
1419
+ await testEntity.reference?.$wake();
1005
1420
  expect(await testEntity.reference?.$delete()).toEqual(true);
1421
+ await Promise.all(testEntity.refArray?.map((e) => e.$wake()) || []);
1006
1422
  expect(testEntity.reference?.guid).toBeNull();
1007
1423
  });
1008
1424
  it('delete', async () => {
1009
1425
  await createTestEntities();
1426
+ // Deleting entity...
1010
1427
  expect(await testEntity.$delete()).toEqual(true);
1011
1428
  expect(testEntity.guid).toBeNull();
1012
- const entity = await nymph.getEntity({ class: testArtifacts_1.TestModel }, { type: '&', guid: testGuid });
1429
+ const entity = await nymph.getEntity({ class: TestModel }, { type: '&', guid: testGuid });
1013
1430
  expect(entity).toBeNull();
1014
1431
  });
1432
+ it('allows non-duplicate unique strings', async () => {
1433
+ // Creating entity...
1434
+ const uniqueEntityA = await TestModel.factory();
1435
+ uniqueEntityA.name = 'Entity Test ' + new Date().toLocaleString();
1436
+ uniqueEntityA.uniques = ['test a'];
1437
+ // Saving entity...
1438
+ expect(await uniqueEntityA.$save()).toEqual(true);
1439
+ expect(uniqueEntityA.guid).not.toBeNull();
1440
+ // Creating entity...
1441
+ const uniqueEntityB = await TestModel.factory();
1442
+ uniqueEntityB.name = 'Entity Test ' + new Date().toLocaleString();
1443
+ uniqueEntityB.uniques = ['test b'];
1444
+ // Saving entity...
1445
+ expect(await uniqueEntityB.$save()).toEqual(true);
1446
+ expect(uniqueEntityB.guid).not.toBeNull();
1447
+ expect(uniqueEntityA.guid).not.toEqual(uniqueEntityB.guid);
1448
+ expect(await uniqueEntityA.$delete()).toEqual(true);
1449
+ expect(await uniqueEntityB.$delete()).toEqual(true);
1450
+ });
1451
+ it('throws on duplicate unique strings', async () => {
1452
+ // Creating entity...
1453
+ const uniqueEntityA = await TestModel.factory();
1454
+ uniqueEntityA.name = 'Entity Test ' + new Date().toLocaleString();
1455
+ uniqueEntityA.uniques = ['test a'];
1456
+ // Saving entity...
1457
+ expect(await uniqueEntityA.$save()).toEqual(true);
1458
+ expect(uniqueEntityA.guid).not.toBeNull();
1459
+ // Creating entity...
1460
+ const uniqueEntityB = await TestModel.factory();
1461
+ uniqueEntityB.name = 'Entity Test ' + new Date().toLocaleString();
1462
+ uniqueEntityB.uniques = ['test a'];
1463
+ // Saving entity...
1464
+ try {
1465
+ await uniqueEntityB.$save();
1466
+ throw Error("Shouldn't get past the uniqueness check.");
1467
+ }
1468
+ catch (e) {
1469
+ expect(e).toBeInstanceOf(EntityUniqueConstraintError);
1470
+ }
1471
+ expect(uniqueEntityB.guid).toBeNull();
1472
+ expect(await uniqueEntityA.$delete()).toEqual(true);
1473
+ });
1474
+ it('allows duplicate unique string if first transaction is rolled back', async () => {
1475
+ // Creating transaction entity...
1476
+ const tnymphA = await nymph.startTransaction('test-unique-a');
1477
+ const TestModelA = tnymphA.getEntityClass(TestModel);
1478
+ const uniqueEntityA = await TestModelA.factory();
1479
+ uniqueEntityA.name = 'Entity Test ' + new Date().toLocaleString();
1480
+ uniqueEntityA.uniques = ['test a'];
1481
+ // Saving entity...
1482
+ expect(await uniqueEntityA.$save()).toEqual(true);
1483
+ expect(uniqueEntityA.guid).not.toBeNull();
1484
+ // Rolling back transaction...
1485
+ expect(await tnymphA.rollback('test-unique-a')).toEqual(true);
1486
+ // Creating transaction entity...
1487
+ const tnymphB = await nymph.startTransaction('test-unique-b');
1488
+ const TestModelB = tnymphB.getEntityClass(TestModel);
1489
+ const uniqueEntityB = await TestModelB.factory();
1490
+ uniqueEntityB.name = 'Entity Test ' + new Date().toLocaleString();
1491
+ uniqueEntityB.uniques = ['test a'];
1492
+ // Saving entity...
1493
+ expect(await uniqueEntityB.$save()).toEqual(true);
1494
+ expect(uniqueEntityB.guid).not.toBeNull();
1495
+ expect(uniqueEntityA.guid).not.toEqual(uniqueEntityB.guid);
1496
+ expect(await tnymphB.commit('test-unique-b')).toEqual(true);
1497
+ const uniqueEntityACheck = await nymph.getEntity({ class: TestModel }, { type: '&', guid: uniqueEntityA.guid ?? '' });
1498
+ expect(uniqueEntityACheck).toBeNull();
1499
+ const uniqueEntityBCheck = await nymph.getEntity({ class: TestModel }, { type: '&', guid: uniqueEntityB.guid ?? '' });
1500
+ expect(uniqueEntityBCheck).not.toBeNull();
1501
+ if (uniqueEntityBCheck != null) {
1502
+ expect(await uniqueEntityBCheck.$delete()).toEqual(true);
1503
+ }
1504
+ });
1015
1505
  }
1016
- exports.QueriesTest = QueriesTest;
1017
- function UIDTest(nymph, it) {
1018
- nymph.addEntityClass(testArtifacts_1.TestModel);
1019
- nymph.addEntityClass(testArtifacts_1.TestBModel);
1506
+ export function UIDTest(nymph, it) {
1020
1507
  it('delete old test data', async () => {
1021
1508
  expect(await nymph.deleteUID('TestUID')).toEqual(true);
1022
1509
  expect(await nymph.deleteUID('NewUID')).toEqual(true);
@@ -1047,24 +1534,23 @@ function UIDTest(nymph, it) {
1047
1534
  expect(await nymph.getUID('TestUID')).toBeNull();
1048
1535
  });
1049
1536
  }
1050
- exports.UIDTest = UIDTest;
1051
- function ExportImportTest(nymph, it) {
1052
- nymph.addEntityClass(testArtifacts_1.TestModel);
1053
- nymph.addEntityClass(testArtifacts_1.TestBModel);
1537
+ export function ExportImportTest(nymph, it) {
1538
+ const TestModel = nymph.addEntityClass(TestModelClass);
1539
+ const TestBModel = nymph.addEntityClass(TestBModelClass);
1054
1540
  async function deleteTestData() {
1055
- let all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1541
+ let all = await nymph.getEntities({ class: TestModel });
1056
1542
  expect(Array.isArray(all)).toEqual(true);
1057
1543
  for (const cur of all) {
1058
1544
  expect(await cur.$delete()).toEqual(true);
1059
1545
  }
1060
- all = await nymph.getEntities({ class: testArtifacts_1.TestModel });
1546
+ all = await nymph.getEntities({ class: TestModel });
1061
1547
  expect(all.length).toEqual(0);
1062
- all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1548
+ all = await nymph.getEntities({ class: TestBModel });
1063
1549
  expect(Array.isArray(all)).toEqual(true);
1064
1550
  for (const cur of all) {
1065
1551
  expect(await cur.$delete()).toEqual(true);
1066
1552
  }
1067
- all = await nymph.getEntities({ class: testArtifacts_1.TestBModel });
1553
+ all = await nymph.getEntities({ class: TestBModel });
1068
1554
  expect(all.length).toEqual(0);
1069
1555
  expect(await nymph.deleteUID('TestUID')).toEqual(true);
1070
1556
  expect(await nymph.deleteUID('TestUID2')).toEqual(true);
@@ -1072,24 +1558,37 @@ function ExportImportTest(nymph, it) {
1072
1558
  async function checkEntityDataAndCount() {
1073
1559
  expect(await nymph.getUID('TestUID')).toEqual(2);
1074
1560
  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 });
1561
+ const models = await nymph.getEntities({ class: TestModel });
1562
+ const bmodels = await nymph.getEntities({ class: TestBModel });
1077
1563
  expect(models.length).toEqual(30);
1078
- expect(bmodels.length).toEqual(10);
1079
- const all = [...models, ...bmodels];
1080
- for (const model of all) {
1081
- if (model.index?.match(/^\d+a$/)) {
1082
- expect(model.null).toBeNull();
1083
- expect(model.string).toEqual('test');
1084
- expect(model.array).toEqual(['full', 'of', 'values', 500]);
1085
- expect(model.number).toEqual(30);
1086
- expect(model.timestamp).toBeGreaterThanOrEqual((0, strtotime_1.default)('-2 minutes'));
1087
- expect(model.reference?.guid).not.toBeNull();
1088
- expect(model.reference?.string).toEqual('another');
1089
- expect(model.reference?.index?.match(/^\d+b$/)).toBeTruthy();
1090
- expect(model.refArray?.[0].guid).not.toBeNull();
1091
- expect(model.refArray?.[0].guid).toEqual(model.reference?.guid);
1092
- }
1564
+ expect(bmodels.length).toEqual(30);
1565
+ for (const model of models) {
1566
+ expect(model.name).toMatch(/^Entity Test /);
1567
+ expect(model.null).toBeDefined();
1568
+ expect(model.null).toBeNull();
1569
+ expect(model.string).toEqual('test');
1570
+ expect(model.array).toEqual([
1571
+ 'full',
1572
+ 'of',
1573
+ 'values',
1574
+ 500,
1575
+ { test: true },
1576
+ { nullbyte: '\\\x00\u0000 \x00' },
1577
+ ]);
1578
+ expect(model.match).toEqual(matchValue);
1579
+ expect(model.number).toEqual(30);
1580
+ expect(model.numberString).toEqual('30');
1581
+ expect(model.timestamp).toBeGreaterThanOrEqual(strtotime('-2 minutes'));
1582
+ expect(model.index).toMatch(/^\d+a$/);
1583
+ await model.reference?.$wake();
1584
+ expect(model.reference?.guid).not.toBeNull();
1585
+ expect(model.reference?.string).toEqual('another');
1586
+ expect(model.reference?.index).toMatch(/^\d+b$/);
1587
+ expect(model.index?.substring(0, -1)).toEqual(model.reference?.index?.substring(0, -1));
1588
+ expect(model.reference?.$inArray(bmodels)).toEqual(true);
1589
+ await Promise.all(model.refArray?.map((e) => e.$wake()) || []);
1590
+ expect(model.refArray?.[0].guid).not.toBeNull();
1591
+ expect(model.refArray?.[0].guid).toEqual(model.reference?.guid);
1093
1592
  }
1094
1593
  }
1095
1594
  it('delete old test data', async () => {
@@ -1099,17 +1598,27 @@ function ExportImportTest(nymph, it) {
1099
1598
  expect(await nymph.newUID('TestUID')).toEqual(1);
1100
1599
  expect(await nymph.newUID('TestUID')).toEqual(2);
1101
1600
  expect(await nymph.newUID('TestUID2')).toEqual(1);
1102
- for (let i = 0; i < 20; i++) {
1103
- const EntityClass = i < 15 ? testArtifacts_1.TestModel : testArtifacts_1.TestBModel;
1104
- const testEntity = await EntityClass.factory();
1601
+ for (let i = 0; i < 30; i++) {
1602
+ // Creating entity...
1603
+ const testEntity = await TestModel.factory();
1604
+ // Saving entity...
1105
1605
  testEntity.name = 'Entity Test ' + new Date().toLocaleString();
1106
1606
  testEntity.null = null;
1107
1607
  testEntity.string = 'test';
1108
- testEntity.array = ['full', 'of', 'values', 500];
1608
+ testEntity.array = [
1609
+ 'full',
1610
+ 'of',
1611
+ 'values',
1612
+ 500,
1613
+ { test: true },
1614
+ { nullbyte: '\\\x00\u0000 \x00' },
1615
+ ];
1616
+ testEntity.match = matchValue;
1109
1617
  testEntity.number = 30;
1618
+ testEntity.numberString = '30';
1110
1619
  testEntity.timestamp = Date.now();
1111
1620
  testEntity.index = i + 'a';
1112
- const entityReferenceTest = await EntityClass.factory();
1621
+ const entityReferenceTest = await TestBModel.factory();
1113
1622
  entityReferenceTest.string = 'another';
1114
1623
  entityReferenceTest.index = i + 'b';
1115
1624
  expect(await entityReferenceTest.$save()).toEqual(true);
@@ -1119,6 +1628,9 @@ function ExportImportTest(nymph, it) {
1119
1628
  }
1120
1629
  await checkEntityDataAndCount();
1121
1630
  });
1631
+ it('needs migration', async () => {
1632
+ expect(await nymph.needsMigration()).toEqual(false);
1633
+ });
1122
1634
  it('export data', async () => {
1123
1635
  expect(await nymph.export(__dirname + '/testentityexport.nex')).toEqual(true);
1124
1636
  });
@@ -1128,14 +1640,222 @@ function ExportImportTest(nymph, it) {
1128
1640
  it('import data', async () => {
1129
1641
  expect(await nymph.getUID('TestUID')).toBeNull();
1130
1642
  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 });
1643
+ const models = await nymph.getEntities({ class: TestModel });
1644
+ const bmodels = await nymph.getEntities({ class: TestBModel });
1133
1645
  expect(models.length).toEqual(0);
1134
1646
  expect(bmodels.length).toEqual(0);
1135
1647
  expect(await nymph.import(__dirname + '/testentityexport.nex')).toEqual(true);
1136
1648
  await checkEntityDataAndCount();
1137
- fs_1.default.unlinkSync(__dirname + '/testentityexport.nex');
1649
+ fs.unlinkSync(__dirname + '/testentityexport.nex');
1650
+ });
1651
+ it('import tokens only', async () => {
1652
+ const model = await nymph.getEntity({ class: TestModel });
1653
+ expect(model).not.toBeNull();
1654
+ if (model != null) {
1655
+ const data = model.$getData(true);
1656
+ // These should not actually be saved in the DB.
1657
+ data.number = 424242424242;
1658
+ // But this should become searchable.
1659
+ data.search = 'peanuts and pickles on a hot bun';
1660
+ const sdata = Object.fromEntries(Object.entries(data).map(([name, value]) => [
1661
+ name,
1662
+ JSON.stringify(value),
1663
+ ]));
1664
+ if (model.guid == null || model.cdate == null || model.mdate == null) {
1665
+ throw new Error('Model data is wrong.');
1666
+ }
1667
+ await nymph.importEntityTokens({
1668
+ guid: model.guid,
1669
+ // Again, these should not actually be changed in the DB.
1670
+ cdate: model.cdate + 1000,
1671
+ mdate: model.mdate + 1000,
1672
+ tags: [...model.tags, 'helicopter'],
1673
+ sdata,
1674
+ etype: TestModel.ETYPE,
1675
+ });
1676
+ const modelCheck = await nymph.getEntity({ class: TestModel }, { type: '&', search: ['search', '"peanuts and pickles on a hot bun"'] });
1677
+ expect(modelCheck?.guid).toEqual(model.guid);
1678
+ expect(modelCheck?.cdate).toEqual(model.cdate);
1679
+ expect(modelCheck?.mdate).toEqual(model.mdate);
1680
+ expect(modelCheck?.$hasTag('helicopter')).toEqual(false);
1681
+ expect(modelCheck?.number).not.toEqual(424242424242);
1682
+ expect(modelCheck?.search).not.toEqual('peanuts and pickles on a hot bun');
1683
+ }
1138
1684
  });
1139
1685
  }
1140
- exports.ExportImportTest = ExportImportTest;
1686
+ const matchValue = `Hello, my name is Edward McCheese. It is a pleasure to meet you. As you can see, I have several hats of the most pleasant nature.
1687
+
1688
+ This one's email address is nice_hat-wednesday+newyork@im-a-hat.hat.
1689
+ This one's phone number is (555) 555-1818.
1690
+ This one's zip code is 92064.
1691
+ This one's favorite emojis are 🔥❤️😊😂⭐🤔
1692
+
1693
+ These hats are absolutely fantastic.
1694
+
1695
+ \x00\x00\x00
1696
+
1697
+ Lorem ipsum odor amet, consectetuer adipiscing elit. Metus ad mattis sit pretium per, dignissim imperdiet luctus. Congue rhoncus turpis etiam aenean ultricies dapibus justo nunc. Netus non primis quis habitasse lacus. Nascetur dapibus sociosqu ridiculus primis; elementum netus consectetur ridiculus litora. Tristique facilisis erat ex class nulla cursus amet. Metus vitae tempor euismod vel; ullamcorper ac quisque vestibulum. Mauris libero pulvinar facilisi eros natoque massa.
1698
+
1699
+ Nunc vel hac nec tristique vivamus. Leo volutpat convallis eget integer tellus cubilia tincidunt malesuada? Consequat elit nisi tristique vehicula cubilia maecenas metus facilisi malesuada. In mattis euismod ad magnis fusce. Nisi congue sociosqu rhoncus lobortis fringilla sollicitudin at platea. Iaculis ut et varius metus eleifend laoreet hac odio libero. Non ridiculus tempus ultricies nullam curabitur.
1700
+
1701
+ Amet pellentesque aliquam placerat; vestibulum blandit platea porttitor pulvinar. Tellus tristique ad morbi in ac placerat luctus. Ante efficitur inceptos commodo lacus sodales sit varius nunc consequat. Senectus non vel est convallis mauris. Venenatis feugiat massa nostra, purus class primis sodales odio. Risus nulla integer feugiat ridiculus porta nascetur. Rutrum tincidunt enim parturient libero nisl ante sagittis nisi. Cubilia massa non vehicula vehicula amet parturient pellentesque. Habitant dapibus fames lectus pretium rhoncus.
1702
+
1703
+ Ridiculus nascetur mauris iaculis hendrerit ridiculus gravida auctor in. Class suscipit augue finibus semper vulputate nec. Tristique mi eu praesent commodo fermentum inceptos penatibus lobortis. Libero enim orci ultricies egestas ut pellentesque. Laoreet massa ad curabitur tellus libero laoreet habitasse enim nascetur. Iaculis euismod a euismod conubia purus. Commodo condimentum ultrices lorem ligula aenean; netus mattis sem non.
1704
+
1705
+ Curabitur duis imperdiet mus integer vel bibendum; fusce malesuada. Dignissim duis himenaeos primis odio, congue pharetra? Egestas mus sit eget proin quis. Neque dapibus dapibus nam sociosqu; maecenas viverra himenaeos. Himenaeos faucibus himenaeos faucibus ex litora eros faucibus cras. Maximus scelerisque nullam nunc congue fringilla. Nisi eu magna erat morbi cras enim amet litora. Nostra primis vitae arcu, accumsan sollicitudin curabitur. Potenti sit vel vehicula metus leo id. Etiam blandit quisque nam orci; neque lacinia rutrum.
1706
+
1707
+ Aliquam mollis varius hendrerit sem eleifend fermentum. Sapien rutrum condimentum inceptos ex feugiat consectetur mollis magna diam. Natoque enim nisi, ex risus finibus lacinia conubia vivamus suscipit. Habitasse interdum lorem ante, bibendum posuere dis. Lacus porttitor sapien proin; consequat velit ipsum venenatis. Vivamus porta mattis morbi nunc torquent neque. Senectus vehicula tincidunt parturient fringilla id amet urna libero pharetra.
1708
+
1709
+ Faucibus netus tincidunt et viverra augue ligula est quis. Ipsum tempus vehicula tortor dis tortor ad. Ex tincidunt torquent eleifend aenean urna commodo. Quam nullam imperdiet volutpat vel condimentum cubilia sociosqu. Etiam tempor sapien mattis, venenatis aptent id risus. Efficitur luctus vel; nam ut commodo sociosqu hendrerit. Quisque placerat gravida rhoncus blandit vitae. Himenaeos id risus est mollis aliquet nam curabitur.
1710
+
1711
+ Habitasse sed est fames quis lobortis leo mattis. Nisl cursus tincidunt cursus felis porttitor. Ante integer turpis non class lobortis suscipit. Condimentum velit vulputate quis sapien, lacus magna adipiscing nec primis. Blandit consequat ipsum nostra dignissim; tincidunt torquent fames. Ac faucibus elit iaculis duis lobortis. Euismod facilisi massa turpis mus neque. Class vulputate quisque elementum suscipit nostra tempus adipiscing. Malesuada himenaeos finibus ad inceptos volutpat scelerisque inceptos.
1712
+
1713
+ Natoque platea at feugiat cras tellus facilisi suspendisse lacinia maximus. Duis vestibulum eget molestie turpis risus dapibus dignissim torquent? Nulla nibh aptent fringilla scelerisque euismod mauris ornare. Orci finibus taciti habitasse fringilla laoreet convallis. Class sed fringilla eget quisque sit auctor. Id cursus mauris praesent maecenas iaculis. Ullamcorper luctus habitant ultrices pharetra etiam mattis morbi fringilla lorem.
1714
+
1715
+ Pharetra porta orci ridiculus inceptos eleifend sem ante quis. Molestie velit penatibus libero per sem litora congue. Porta quis egestas vivamus vitae potenti ornare. Elit molestie nullam vitae quam viverra. Nisl fringilla massa ridiculus donec ridiculus sed magnis. Cursus ad enim consequat ultricies tortor rhoncus pellentesque augue. Netus facilisis tempor elementum interdum at sagittis habitasse. Pretium imperdiet duis diam ullamcorper donec at suscipit. Id per inceptos ac luctus massa imperdiet tempor. Parturient libero suscipit non tempor ligula ullamcorper placerat varius.
1716
+
1717
+ Libero duis suspendisse cubilia rhoncus scelerisque faucibus mattis. Leo fusce urna at per inceptos vel lobortis. Quisque ex duis euismod dictum hac nibh eros. Penatibus eleifend tellus donec elit primis phasellus habitant dictum. Imperdiet consequat facilisi massa, lacus gravida sodales id sapien. Ornare sapien sit convallis suscipit nunc enim. Tempus at vitae class sollicitudin proin. Dolor aenean felis netus consectetur mattis phasellus vestibulum. Orci fringilla sodales montes sed himenaeos ex massa natoque porttitor.
1718
+
1719
+ Mus condimentum dui mollis dolor accumsan ligula pretium? Est phasellus platea iaculis vehicula et eros vel rutrum placerat. Nulla laoreet faucibus; congue netus magna senectus lectus dictum. Sodales aliquam eget himenaeos adipiscing, tempor feugiat. Lorem pellentesque iaculis fames lectus cubilia ornare sagittis rhoncus? Bibendum viverra tellus libero congue dignissim metus tellus aenean ultrices. Sollicitudin cras sollicitudin mattis lacus facilisis fermentum scelerisque porttitor rutrum.
1720
+
1721
+ Sapien aptent fames curae, consectetur dapibus mauris sollicitudin tellus. Laoreet etiam dignissim, suscipit platea libero vitae taciti eu nec. Donec lobortis metus nisi; est enim himenaeos molestie tellus sapien. Sapien tellus rhoncus blandit fusce hendrerit feugiat. Maximus sit hendrerit tincidunt nec imperdiet hendrerit semper suscipit. Quam augue proin netus rutrum et sem. Neque penatibus cubilia nec metus porta. Ornare pulvinar quam auctor, elit curae ad donec dis. Egestas aptent non tortor potenti morbi mauris.
1722
+
1723
+ Montes dui in pharetra primis consequat ante integer. Vulputate libero gravida rutrum tortor suscipit massa! Netus rhoncus platea torquent dapibus consectetur suspendisse etiam sociosqu. Quis placerat mauris et quam nascetur. Dictumst mi rutrum justo vitae ultricies feugiat nulla faucibus morbi. Consectetur nec condimentum euismod sodales nisi purus; finibus elementum facilisi.
1724
+
1725
+ Senectus mus faucibus ut morbi eu maximus. Turpis tincidunt sodales sociosqu lorem amet pulvinar laoreet faucibus. Mus bibendum vulputate hendrerit sollicitudin eu ridiculus posuere augue leo? Cubilia nostra consequat; fusce egestas himenaeos class ornare nec. Est montes tortor vivamus congue inceptos erat mi eget pellentesque. Amet vulputate fringilla aliquet fames tristique. Rutrum malesuada dapibus vehicula risus nunc torquent habitant turpis habitant. Ipsum proin viverra adipiscing cras et augue hendrerit. Efficitur euismod aliquam habitant; sit nisl potenti.
1726
+
1727
+ Conubia dignissim metus phasellus tristique augue, nullam quam finibus. Dignissim vel enim mattis praesent penatibus. Sapien pharetra curae torquent turpis fermentum feugiat facilisis nisi. Lacinia justo ante mauris finibus vitae ante efficitur dis. Urna gravida conubia amet rhoncus felis ut lorem placerat. Quisque fermentum suscipit aenean nisi suscipit ac? Quis ornare faucibus amet conubia justo maximus hendrerit phasellus aenean. Ex vivamus vulputate in mollis mauris praesent vehicula erat neque.
1728
+
1729
+ Orci nullam commodo habitant volutpat per tincidunt mus sit. Nisi cubilia fringilla viverra at orci magnis massa nam orci. Duis iaculis sapien nulla nascetur elit porta fermentum. Amus libero vivamus vel finibus magnis placerat himenaeos. Integer posuere suscipit non vulputate enim. Conubia id lobortis habitasse luctus odio maecenas enim conubia non. Mus egestas massa platea nullam sociosqu, magnis cras. Quam placerat nisi dui gravida ultricies, facilisis eu pharetra vivamus.
1730
+
1731
+ Fusce maecenas dis finibus senectus nascetur tortor. Nec rhoncus pretium vivamus donec vel ligula curabitur. Velit dis laoreet aenean, fusce metus blandit erat. Ligula purus natoque, arcu finibus tincidunt efficitur dolor curabitur. Ac risus et ipsum; consequat integer phasellus diam. Praesent ipsum gravida placerat porta volutpat tincidunt maximus sapien. Phasellus gravida orci enim velit condimentum.
1732
+
1733
+ Dui id laoreet penatibus orci sit a. Iaculis dis porttitor luctus; lacus dignissim quam commodo lorem. Nullam dictum quisque accumsan porttitor tortor fusce aenean. Aliquet quisque ultricies malesuada auctor facilisi tristique. Dolor nulla conubia ultricies odio ad. Nunc consectetur venenatis consequat nisi habitant. Praesent accumsan scelerisque morbi aliquam sociosqu auctor, nostra aenean.
1734
+
1735
+ Mauris amet conubia egestas eu posuere nullam. Est neque dictum in, lacus aliquam ultrices vestibulum. Dapibus dis habitasse cras conubia felis nibh. Egestas nisl iaculis nostra neque enim, ridiculus praesent. Consectetur eleifend eu mus; elit sed pellentesque fringilla. Ullamcorper hendrerit nibh aptent per congue libero ultrices eget. Mollis velit ad tortor lobortis ipsum.
1736
+
1737
+ Tristique neque justo potenti himenaeos; pellentesque nam vehicula. Maximus etiam ut nullam semper; fames curabitur quam ad morbi. Interdum curabitur platea augue porttitor a gravida. Leo imperdiet id aenean sit; habitasse quam tempus pellentesque? Nostra leo aenean amet lectus ultricies ridiculus nascetur ullamcorper. Taciti in iaculis quam nascetur proin varius eget vehicula.
1738
+
1739
+ Mattis hendrerit tempus interdum diam elementum primis augue phasellus sociosqu. Imperdiet pulvinar imperdiet lacinia posuere class magnis. Montes viverra scelerisque laoreet sociosqu proin lacus. Nam id justo praesent curabitur nam accumsan imperdiet commodo. Sociosqu netus sapien proin interdum ac. Dapibus tempor et sodales, natoque consequat torquent.
1740
+
1741
+ Lectus ultricies amet bibendum blandit finibus erat pellentesque. Nam quis ultrices curae; lorem gravida malesuada velit taciti enim. Facilisis fermentum suspendisse leo tristique litora dapibus rhoncus convallis. Netus iaculis eleifend viverra urna, vulputate ac convallis. Faucibus torquent dictum, nisl sed parturient libero. Ornare class habitant per consequat adipiscing rhoncus feugiat.
1742
+
1743
+ Proin molestie nullam eros parturient parturient curabitur aliquet. Rhoncus mus aenean sem aliquet sem finibus neque rutrum commodo. Efficitur litora lobortis nascetur adipiscing curae faucibus? Bibendum leo velit augue; potenti primis malesuada lacus ipsum. Facilisi potenti facilisis nam tempor consequat. Magnis suspendisse primis duis quam; suscipit quis fermentum phasellus. Massa ridiculus habitasse ipsum arcu sit maecenas gravida nisi? Dolor egestas lacinia lacinia libero nam curae suspendisse purus. Tristique inceptos curae netus scelerisque magna hendrerit commodo quis parturient. Eget accumsan erat sociosqu vestibulum platea turpis habitasse.
1744
+
1745
+ Maximus dignissim sed conubia a ipsum nullam condimentum dictumst. Suspendisse congue phasellus congue lacus sollicitudin senectus curae. Consequat sagittis in fringilla suscipit scelerisque suscipit. Rhoncus pharetra sodales malesuada sollicitudin lectus. Est primis pretium finibus felis pharetra nulla sapien lacinia. Nunc lorem aptent tristique quisque etiam posuere non ullamcorper. Potenti mus sed mus; non id eleifend pellentesque magnis.
1746
+
1747
+ Iaculis morbi mattis; ornare tincidunt neque mus egestas consectetur ultrices. Porta dapibus pretium, vulputate dis amet neque. Posuere auctor lacinia maecenas ridiculus ullamcorper tempus egestas cubilia nec. Cursus nulla lacinia mi facilisi, nisl tempor. Tempus elementum laoreet magnis neque morbi felis per. Suspendisse lectus vitae nunc amet himenaeos euismod aliquam. Quisque integer dictum aenean fermentum dictumst torquent.
1748
+
1749
+ Sociosqu per suspendisse augue phasellus velit dapibus parturient. At sit eu finibus posuere tincidunt. Phasellus duis scelerisque scelerisque taciti est venenatis. Arcu habitant augue amet eget maximus torquent. Eget gravida ut quisque ligula vel mus. Erat quis himenaeos; velit eget varius viverra interdum. Neque dapibus malesuada est a gravida libero integer aptent. Semper eleifend per at magnis, laoreet nibh orci vel ligula.
1750
+
1751
+ Odio purus finibus inceptos malesuada duis. Neque magnis est laoreet nibh gravida sagittis ullamcorper sodales. Parturient ultricies mattis lacus risus laoreet praesent. Tincidunt eleifend quis sagittis id nascetur. Nam scelerisque varius feugiat phasellus enim mauris nam. Tortor iaculis et cras; blandit sollicitudin pellentesque justo. Nam lacinia volutpat fusce nibh mollis; himenaeos iaculis. Vulputate dictum mattis sollicitudin accumsan at hendrerit.
1752
+
1753
+ Ipsum augue faucibus senectus porta dapibus metus. Netus sem amet nullam fermentum in dolor bibendum. Lacus quis enim vivamus enim risus elit suspendisse arcu. Penatibus proin pellentesque consequat nibh turpis fusce. Potenti sociosqu nunc tempor amet torquent. Aliquet porttitor adipiscing parturient curabitur hac? Condimentum morbi netus erat class hendrerit aptent. Placerat viverra molestie at eget donec quisque. Varius sem erat dolor, urna nunc ac duis inceptos maximus.
1754
+
1755
+ Nostra adipiscing dapibus eros vivamus accumsan elementum curae dignissim dignissim. Iaculis quisque fusce at conubia est habitant ipsum. Porttitor libero lobortis lobortis habitasse quis quisque nunc euismod aenean. Bibendum nullam volutpat quam vitae felis sit. Mauris bibendum nulla litora nec id, elit lacinia. Orci odio nunc est ante commodo dis quis diam convallis? Mattis a per cras amet egestas ex pellentesque nascetur augue. Egestas per massa per non metus hendrerit feugiat eu?
1756
+
1757
+ Praesent habitasse est elementum mattis potenti. Fermentum interdum enim orci dui faucibus sodales nisi mus. Tortor facilisi nunc potenti; dignissim magna varius! Risus cursus ornare tincidunt a feugiat massa cubilia. Sociosqu quis pharetra efficitur lorem ornare sapien arcu euismod. Elementum donec maecenas praesent scelerisque viverra mi natoque. Lacinia nibh eu commodo ut class blandit magnis.
1758
+
1759
+ Ullamcorper himenaeos mollis nostra placerat quam pellentesque nibh. Curae posuere cras dis senectus fringilla congue ipsum sit. Eros maecenas duis morbi consequat himenaeos ridiculus purus erat. Nascetur maximus massa eros class phasellus integer sed gravida. Vel donec lacinia donec curabitur penatibus integer ornare. Varius quam lectus magna per a mauris.
1760
+
1761
+ Imperdiet tempus malesuada ultrices egestas taciti nibh elit lacus. Nunc tempus tellus vitae duis rhoncus leo facilisis. Sapien nec mi lacus mi aliquet. Diam convallis fringilla libero duis integer integer dictum vel. Dolor montes nibh sapien dapibus ultrices praesent. Aeuismod phasellus taciti elit vehicula sit sociosqu. Lobortis neque urna dignissim penatibus felis vulputate. Primis magnis placerat, ligula massa facilisis nec.
1762
+
1763
+ Duis interdum himenaeos dis nisl et tortor condimentum accumsan. Laoreet amet fusce dis malesuada iaculis maximus fringilla. Conubia mus nibh felis vestibulum ad convallis mollis. Metus vivamus lobortis habitasse id nam. Egestas pretium eu penatibus consectetur malesuada congue tempus fusce. Rutrum neque pulvinar duis ligula fermentum malesuada. Tincidunt mollis molestie imperdiet ridiculus pharetra maximus sodales curabitur.
1764
+
1765
+ Sem nec integer fusce neque sagittis. Rutrum ipsum ante; urna enim primis consectetur nulla. Arcu ligula lectus varius magna ipsum, et dictum. Pharetra dignissim inceptos tristique natoque tempor volutpat. Luctus tristique himenaeos duis orci maecenas vel morbi. Habitasse a lacinia dignissim commodo elementum maecenas eu mollis. Fermentum tellus sem condimentum mattis elit lectus. Platea fusce arcu cras varius natoque? Volutpat tincidunt ridiculus mus massa ante dis sem ornare magna. Bibendum ornare ultrices proin efficitur; nascetur risus arcu.
1766
+
1767
+ Orci erat orci amet mollis venenatis. Feugiat torquent ex mattis, inceptos etiam integer. Class senectus aptent vivamus, semper dolor nisi at pretium volutpat. Natoque semper enim enim primis ultricies, pharetra pulvinar. Natoque litora tortor accumsan ridiculus lacinia integer; aliquet penatibus ridiculus. Placerat vestibulum justo tristique sapien senectus, et interdum et ridiculus. Urna aenean vel himenaeos; finibus a est efficitur donec. Dictum egestas quis fusce arcu; sapien himenaeos pretium congue. Semper et sapien nisi nascetur venenatis eros integer blandit.
1768
+
1769
+ Arcu per phasellus vehicula ad molestie? Eget arcu eget inceptos, eu ullamcorper diam. Gravida placerat elit ut hendrerit odio. Est lobortis imperdiet venenatis primis a. Facilisis integer maecenas adipiscing metus, rutrum curabitur. Dolor adipiscing himenaeos senectus tempus faucibus cras.
1770
+
1771
+ Massa torquent torquent ullamcorper erat nisl parturient primis eu pulvinar! Ridiculus sollicitudin dis eu, laoreet praesent hendrerit platea euismod. Lacinia dignissim suspendisse sagittis eu rutrum himenaeos curae massa diam. Platea ornare ridiculus consequat curabitur augue vestibulum ridiculus. Vel consectetur vivamus accumsan risus elementum? Imperdiet nascetur efficitur aliquam habitasse nascetur. Hendrerit quisque magnis in lacinia quis mauris.
1772
+
1773
+ Molestie fermentum blandit, viverra condimentum purus himenaeos. Fermentum congue a suspendisse ornare semper laoreet. Pharetra lacus non, iaculis ad taciti varius. Etiam nam risus vestibulum curabitur facilisis mattis, lorem hac id. Dignissim nibh tempor quam porta lectus nunc tincidunt aliquet. Tortor maximus maximus natoque nam magna torquent nec lectus mus. Vel fermentum semper vulputate penatibus vel purus.
1774
+
1775
+ Fermentum tincidunt penatibus platea himenaeos etiam sodales ad erat posuere. Vehicula vulputate sem blandit nullam sem. Condimentum eget lacus ad malesuada augue dui justo. Lobortis quis mauris pellentesque quam interdum sagittis. Nulla ullamcorper aptent hendrerit fusce hendrerit, cras cras magna. Ex quam torquent, congue dis est vulputate lacinia. Dignissim proin lacinia platea tortor elementum nullam. Purus natoque scelerisque habitant vestibulum; metus dui neque ipsum. Pellentesque augue montes fringilla et, maecenas habitant a.
1776
+
1777
+ Quam sapien eu scelerisque tristique, integer in rutrum gravida. Egestas lacinia nisi praesent turpis lacus maximus mus gravida. Dolor eget ultrices rhoncus velit; mollis id. Mi vulputate sed blandit nullam parturient venenatis. Neque vulputate iaculis nascetur felis fames ipsum adipiscing nullam? Vitae faucibus elit congue himenaeos orci volutpat nam. Magna tempus convallis vivamus eu semper. Egestas curabitur integer quis habitasse id taciti hac sociosqu morbi. Duis felis cursus potenti blandit cras dolor pharetra.
1778
+
1779
+ Ultricies vel primis nec mus malesuada congue? Habitasse semper mus ultricies; fermentum himenaeos placerat sodales. Platea sapien malesuada dignissim suscipit dis cras. Etiam odio pharetra metus donec odio natoque. Cras diam curae dapibus accumsan tortor mi laoreet. Ex mollis massa inceptos inceptos adipiscing. Cras rhoncus natoque accumsan augue enim. Parturient porttitor habitant semper platea elementum dictum ornare? Sociosqu blandit nullam vivamus elementum semper himenaeos.
1780
+
1781
+ Orci elit aliquam luctus habitant interdum. Tellus sollicitudin aliquam donec potenti praesent augue magnis auctor. Mattis faucibus iaculis etiam imperdiet lectus ad habitasse sollicitudin ac. Consequat maecenas quam dis adipiscing neque sociosqu. Ullamcorper in praesent himenaeos purus blandit nibh. Dignissim platea amet urna laoreet sociosqu lacinia accumsan consectetur risus. Adipiscing nullam arcu lobortis mi scelerisque feugiat non. Accumsan lacinia urna sit urna tincidunt nam pulvinar urna. Tellus cursus ac himenaeos sed aptent phasellus.
1782
+
1783
+ Scelerisque curabitur eget morbi leo phasellus morbi magnis. Elit nunc non vulputate eget at. Viverra efficitur dignissim fames ut condimentum tincidunt elementum lacus egestas. Dictum phasellus leo auctor dui diam. Sollicitudin placerat elit vehicula vulputate et at eleifend ullamcorper. Primis diam hac class leo justo etiam magnis. Justo maximus venenatis facilisis egestas hendrerit aptent arcu tortor consectetur. Consequat mus curabitur nisl; blandit enim at bibendum tempor bibendum. Ad nam arcu vehicula himenaeos sociosqu eu faucibus accumsan.
1784
+
1785
+ Maximus malesuada faucibus phasellus donec ligula. Rutrum pellentesque ultricies nullam; aenean scelerisque elementum. Porta luctus consectetur pharetra consequat varius. Ut dapibus senectus venenatis scelerisque fames ligula congue. Magna hendrerit faucibus ultricies tincidunt phasellus pellentesque, maecenas consequat! Malesuada senectus praesent sed condimentum aenean mi. Interdum sollicitudin mattis, purus vitae netus gravida. Nullam magna risus leo sit urna aenean.
1786
+
1787
+ Ut lacinia potenti vel varius habitant mus nullam adipiscing. Commodo potenti conubia hendrerit enim massa ad blandit. Nisl a massa nunc risus, condimentum enim. Hac aenean massa lacinia lobortis ad dolor sem. Nisl ex interdum blandit pulvinar pellentesque lorem. Sapien proin malesuada netus parturient pulvinar nec. Ex semper amet sem maximus blandit cras felis. Donec tellus auctor eleifend placerat natoque. Rutrum maecenas sollicitudin nisl consectetur in nulla rhoncus. Id rhoncus nec mi non lacinia leo efficitur nisi.
1788
+
1789
+ Dolor non phasellus id nascetur id nisi litora cubilia interdum. Lectus dolor sodales eu nulla porttitor placerat vulputate. Praesent ullamcorper consequat nulla torquent facilisis nunc. Rhoncus augue eleifend mauris erat duis varius felis. Dignissim nunc pulvinar vehicula dignissim maximus elit metus senectus. Venenatis conubia pulvinar commodo dui montes cubilia.
1790
+
1791
+ Cursus velit lacus aenean elit conubia. Velit in inceptos enim, elit lobortis est facilisis. Suscipit cursus dictum enim libero neque dolor himenaeos eu. Porta in integer praesent quisque quis sit. Primis velit tempus sit curae vehicula porttitor. Scelerisque nisi diam vehicula mi fusce dictum. Tincidunt mus eleifend commodo ridiculus adipiscing.
1792
+
1793
+ Pellentesque quis dignissim euismod in fermentum quam lobortis porta. Dis euismod ultricies montes odio sapien condimentum integer per. Torquent nascetur ante ante; diam ultrices nec habitant. Augue congue a conubia commodo ultricies tortor. Quis ridiculus netus vivamus dictumst efficitur parturient hendrerit. Facilisis ultrices suspendisse elit sodales eleifend maecenas tempor. Habitasse platea congue ac, pretium augue odio interdum netus. Mattis odio mi leo integer nisi diam phasellus elementum. Tortor himenaeos curabitur enim sit ac mi dictumst faucibus sociosqu.
1794
+
1795
+ Duis ex viverra auctor praesent elit ac. Sit ex at cubilia aenean scelerisque finibus ridiculus. Hendrerit imperdiet potenti erat risus commodo. Sit donec ullamcorper facilisi neque varius, suscipit malesuada hac. Nulla lacinia pulvinar non volutpat pellentesque lobortis ultrices dis. Faucibus luctus fusce, aliquam magnis pharetra sed dui nulla viverra. Lectus hendrerit eu pellentesque nostra mauris suspendisse himenaeos. Lectus bibendum inceptos commodo nulla magnis proin.`;
1796
+ const searchValue = `In Congress, July 4, 1776
1797
+
1798
+ The unanimous Declaration of the thirteen united States of America, When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.
1799
+
1800
+ We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness.--That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, --That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn, that mankind are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security.--Such has been the patient sufferance of these Colonies; and such is now the necessity which constrains them to alter their former Systems of Government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.
1801
+
1802
+ He has refused his Assent to Laws, the most wholesome and necessary for the public good.
1803
+
1804
+ He has forbidden his Governors to pass Laws of immediate and pressing importance, unless suspended in their operation till his Assent should be obtained; and when so suspended, he has utterly neglected to attend to them.
1805
+
1806
+ He has refused to pass other Laws for the accommodation of large districts of people, unless those people would relinquish the right of Representation in the Legislature, a right inestimable to them and formidable to tyrants only.
1807
+
1808
+ He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their public Records, for the sole purpose of fatiguing them into compliance with his measures.
1809
+
1810
+ He has dissolved Representative Houses repeatedly, for opposing with manly firmness his invasions on the rights of the people.
1811
+
1812
+ He has refused for a long time, after such dissolutions, to cause others to be elected; whereby the Legislative powers, incapable of Annihilation, have returned to the People at large for their exercise; the State remaining in the mean time exposed to all the dangers of invasion from without, and convulsions within.
1813
+
1814
+ He has endeavoured to prevent the population of these States; for that purpose obstructing the Laws for Naturalization of Foreigners; refusing to pass others to encourage their migrations hither, and raising the conditions of new Appropriations of Lands.
1815
+
1816
+ He has obstructed the Administration of Justice, by refusing his Assent to Laws for establishing Judiciary powers.
1817
+
1818
+ He has made Judges dependent on his Will alone, for the tenure of their offices, and the amount and payment of their salaries.
1819
+
1820
+ He has erected a multitude of New Offices, and sent hither swarms of Officers to harrass our people, and eat out their substance.
1821
+
1822
+ He has kept among us, in times of peace, Standing Armies without the Consent of our legislatures.
1823
+
1824
+ He has affected to render the Military independent of and superior to the Civil power.
1825
+
1826
+ He has combined with others to subject us to a jurisdiction foreign to our constitution, and unacknowledged by our laws; giving his Assent to their Acts of pretended Legislation:
1827
+
1828
+ For Quartering large bodies of armed troops among us:
1829
+
1830
+ For protecting them, by a mock Trial, from punishment for any Murders which they should commit on the Inhabitants of these States:
1831
+
1832
+ For cutting off our Trade with all parts of the world:
1833
+
1834
+ For imposing Taxes on us without our Consent:
1835
+
1836
+ For depriving us in many cases, of the benefits of Trial by Jury:
1837
+
1838
+ For transporting us beyond Seas to be tried for pretended offences:
1839
+
1840
+ For abolishing the free System of English Laws in a neighbouring Province, establishing therein an Arbitrary government, and enlarging its Boundaries so as to render it at once an example and fit instrument for introducing the same absolute rule into these Colonies:
1841
+
1842
+ For taking away our Charters, abolishing our most valuable Laws, and altering fundamentally the Forms of our Governments:
1843
+
1844
+ For suspending our own Legislatures, and declaring themselves invested with power to legislate for us in all cases whatsoever.
1845
+
1846
+ He has abdicated Government here, by declaring us out of his Protection and waging War against us.
1847
+
1848
+ He has plundered our seas, ravaged our Coasts, burnt our towns, and destroyed the lives of our people.
1849
+
1850
+ He is at this time transporting large Armies of foreign Mercenaries to compleat the works of death, desolation and tyranny, already begun with circumstances of Cruelty & perfidy scarcely paralleled in the most barbarous ages, and totally unworthy the Head of a civilized nation.
1851
+
1852
+ He has constrained our fellow Citizens taken Captive on the high Seas to bear Arms against their Country, to become the executioners of their friends and Brethren, or to fall themselves by their Hands.
1853
+
1854
+ He has excited domestic insurrections amongst us, and has endeavoured to bring on the inhabitants of our frontiers, the merciless Indian Savages, whose known rule of warfare, is an undistinguished destruction of all ages, sexes and conditions.
1855
+
1856
+ In every stage of these Oppressions We have Petitioned for Redress in the most humble terms: Our repeated Petitions have been answered only by repeated injury. A Prince, whose character is thus marked by every act which may define a Tyrant, is unfit to be the ruler of a free people.
1857
+
1858
+ Nor have We been wanting in attentions to our Brittish brethren. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have reminded them of the circumstances of our emigration and settlement here. We have appealed to their native justice and magnanimity, and we have conjured them by the ties of our common kindred to disavow these usurpations, which, would inevitably interrupt our connections and correspondence. They too have been deaf to the voice of justice and of consanguinity. We must, therefore, acquiesce in the necessity, which denounces our Separation, and hold them, as we hold the rest of mankind, Enemies in War, in Peace Friends.
1859
+
1860
+ We, therefore, the Representatives of the united States of America, in General Congress, Assembled, appealing to the Supreme Judge of the world for the rectitude of our intentions, do, in the Name, and by Authority of the good People of these Colonies, solemnly publish and declare, That these United Colonies are, and of Right ought to be Free and Independent States; that they are Absolved from all Allegiance to the British Crown, and that all political connection between them and the State of Great Britain, is and ought to be totally dissolved; and that as Free and Independent States, they have full Power to levy War, conclude Peace, contract Alliances, establish Commerce, and to do all other Acts and Things which Independent States may of right do. And for the support of this Declaration, with a firm reliance on the protection of divine Providence, we mutually pledge to each other our Lives, our Fortunes and our sacred Honor.`;
1141
1861
  //# sourceMappingURL=testArtifacts.js.map