@nymphjs/nymph 1.0.0-beta.80 → 1.0.0-beta.82

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 (87) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/Entity.d.ts +3 -3
  4. package/dist/Entity.js +29 -32
  5. package/dist/Entity.js.map +1 -1
  6. package/dist/Entity.test.js +10 -11
  7. package/dist/Entity.test.js.map +1 -1
  8. package/dist/Entity.types.d.ts +2 -2
  9. package/dist/Entity.types.js +1 -2
  10. package/dist/Nymph.d.ts +5 -5
  11. package/dist/Nymph.js +8 -14
  12. package/dist/Nymph.js.map +1 -1
  13. package/dist/Nymph.types.d.ts +2 -2
  14. package/dist/Nymph.types.js +2 -5
  15. package/dist/Nymph.types.js.map +1 -1
  16. package/dist/conf/d.js +1 -2
  17. package/dist/conf/defaults.d.ts +1 -1
  18. package/dist/conf/defaults.js +5 -10
  19. package/dist/conf/defaults.js.map +1 -1
  20. package/dist/conf/index.d.ts +2 -2
  21. package/dist/conf/index.js +2 -8
  22. package/dist/conf/index.js.map +1 -1
  23. package/dist/driver/NymphDriver.d.ts +4 -4
  24. package/dist/driver/NymphDriver.js +43 -49
  25. package/dist/driver/NymphDriver.js.map +1 -1
  26. package/dist/driver/index.d.ts +2 -2
  27. package/dist/driver/index.js +3 -23
  28. package/dist/driver/index.js.map +1 -1
  29. package/dist/driver/testArtifacts.d.ts +1 -1
  30. package/dist/driver/testArtifacts.js +48 -48
  31. package/dist/driver/testArtifacts.js.map +1 -1
  32. package/dist/errors/ClassNotAvailableError.js +1 -5
  33. package/dist/errors/ClassNotAvailableError.js.map +1 -1
  34. package/dist/errors/EntityConflictError.js +1 -5
  35. package/dist/errors/EntityConflictError.js.map +1 -1
  36. package/dist/errors/EntityInvalidDataError.js +1 -5
  37. package/dist/errors/EntityInvalidDataError.js.map +1 -1
  38. package/dist/errors/EntityIsSleepingReferenceError.js +1 -5
  39. package/dist/errors/EntityIsSleepingReferenceError.js.map +1 -1
  40. package/dist/errors/EntityUniqueConstraintError.js +1 -5
  41. package/dist/errors/EntityUniqueConstraintError.js.map +1 -1
  42. package/dist/errors/InvalidParametersError.js +1 -5
  43. package/dist/errors/InvalidParametersError.js.map +1 -1
  44. package/dist/errors/InvalidStateError.js +1 -5
  45. package/dist/errors/InvalidStateError.js.map +1 -1
  46. package/dist/errors/NotConfiguredError.js +1 -5
  47. package/dist/errors/NotConfiguredError.js.map +1 -1
  48. package/dist/errors/QueryFailedError.js +1 -5
  49. package/dist/errors/QueryFailedError.js.map +1 -1
  50. package/dist/errors/UnableToConnectError.js +1 -5
  51. package/dist/errors/UnableToConnectError.js.map +1 -1
  52. package/dist/errors/index.d.ts +10 -10
  53. package/dist/errors/index.js +10 -26
  54. package/dist/errors/index.js.map +1 -1
  55. package/dist/index.d.ts +11 -11
  56. package/dist/index.js +14 -34
  57. package/dist/index.js.map +1 -1
  58. package/dist/nymphJoiProps.js +10 -15
  59. package/dist/nymphJoiProps.js.map +1 -1
  60. package/dist/testArtifacts.d.ts +1 -1
  61. package/dist/testArtifacts.js +4 -13
  62. package/dist/testArtifacts.js.map +1 -1
  63. package/dist/testMocks.d.ts +4 -4
  64. package/dist/testMocks.js +9 -17
  65. package/dist/testMocks.js.map +1 -1
  66. package/dist/utils.d.ts +2 -2
  67. package/dist/utils.js +9 -21
  68. package/dist/utils.js.map +1 -1
  69. package/jest.config.js +11 -2
  70. package/package.json +16 -15
  71. package/src/Entity.test.ts +5 -3
  72. package/src/Entity.ts +8 -9
  73. package/src/Entity.types.ts +2 -2
  74. package/src/Nymph.ts +254 -254
  75. package/src/Nymph.types.ts +2 -2
  76. package/src/conf/defaults.ts +2 -1
  77. package/src/conf/index.ts +2 -2
  78. package/src/driver/NymphDriver.ts +14 -11
  79. package/src/driver/index.ts +2 -2
  80. package/src/driver/testArtifacts.ts +19 -5
  81. package/src/errors/index.ts +10 -10
  82. package/src/index.ts +11 -11
  83. package/src/testArtifacts.ts +1 -1
  84. package/src/testMocks.ts +6 -6
  85. package/src/type/locutus.d.ts +3 -0
  86. package/src/utils.ts +4 -4
  87. package/tsconfig.json +3 -1
@@ -1,15 +1,19 @@
1
- import fs from 'fs';
2
- import strtotime from 'locutus/php/datetime/strtotime';
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';
3
5
  import { guid } from '@nymphjs/guid';
4
6
 
5
- import type Nymph from '../Nymph';
6
- import { EntityUniqueConstraintError } from '../errors';
7
+ import type Nymph from '../Nymph.js';
8
+ import { EntityUniqueConstraintError } from '../errors/index.js';
7
9
  import {
8
10
  TestBModel as TestBModelClass,
9
11
  TestModel as TestModelClass,
10
12
  TestModelData,
11
13
  TestEmptyModel as TestEmptyModelClass,
12
- } from '../testArtifacts';
14
+ } from '../testArtifacts.js';
15
+
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
17
 
14
18
  export function EntitiesTest(
15
19
  nymph: Nymph,
@@ -492,6 +496,16 @@ export function EntitiesTest(
492
496
  },
493
497
  );
494
498
  expect(testEntity.$inArray(resultEntity)).toEqual(true);
499
+
500
+ // Retrieving entity by equal...
501
+ resultEntity = await nymph.getEntities(
502
+ { class: TestModel },
503
+ {
504
+ type: '&',
505
+ equal: ['match', matchValue],
506
+ },
507
+ );
508
+ expect(testEntity.$inArray(resultEntity)).toEqual(true);
495
509
  });
496
510
 
497
511
  it('not equal', async () => {
@@ -1,19 +1,19 @@
1
- export * from './ClassNotAvailableError';
1
+ export * from './ClassNotAvailableError.js';
2
2
 
3
- export * from './EntityConflictError';
3
+ export * from './EntityConflictError.js';
4
4
 
5
- export * from './EntityInvalidDataError';
5
+ export * from './EntityInvalidDataError.js';
6
6
 
7
- export * from './EntityIsSleepingReferenceError';
7
+ export * from './EntityIsSleepingReferenceError.js';
8
8
 
9
- export * from './EntityUniqueConstraintError';
9
+ export * from './EntityUniqueConstraintError.js';
10
10
 
11
- export * from './InvalidParametersError';
11
+ export * from './InvalidParametersError.js';
12
12
 
13
- export * from './InvalidStateError';
13
+ export * from './InvalidStateError.js';
14
14
 
15
- export * from './NotConfiguredError';
15
+ export * from './NotConfiguredError.js';
16
16
 
17
- export * from './QueryFailedError';
17
+ export * from './QueryFailedError.js';
18
18
 
19
- export * from './UnableToConnectError';
19
+ export * from './UnableToConnectError.js';
package/src/index.ts CHANGED
@@ -1,20 +1,20 @@
1
- export * from './conf';
2
- export * from './driver';
3
- export * from './errors';
1
+ export * from './conf/index.js';
2
+ export * from './driver/index.js';
3
+ export * from './errors/index.js';
4
4
 
5
- export * from './Entity.types';
5
+ export * from './Entity.types.js';
6
6
 
7
- export * from './Entity';
8
- import Entity from './Entity';
7
+ export * from './Entity.js';
8
+ import Entity from './Entity.js';
9
9
  export { Entity };
10
10
 
11
- export * from './Nymph.types';
11
+ export * from './Nymph.types.js';
12
12
 
13
- export * from './Nymph';
14
- import Nymph from './Nymph';
13
+ export * from './Nymph.js';
14
+ import Nymph from './Nymph.js';
15
15
  export { Nymph };
16
16
 
17
- import nymphJoiProps from './nymphJoiProps';
17
+ import nymphJoiProps from './nymphJoiProps.js';
18
18
  export { nymphJoiProps };
19
19
 
20
- export * from './utils';
20
+ export * from './utils.js';
@@ -1,4 +1,4 @@
1
- import Entity from './Entity';
1
+ import Entity from './Entity.js';
2
2
 
3
3
  export type TestModelData = {
4
4
  name?: string;
package/src/testMocks.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { guid } from '@nymphjs/guid';
2
2
 
3
- import type Nymph from './Nymph';
4
- import type { EntityInstanceType } from './Entity';
3
+ import type Nymph from './Nymph.js';
4
+ import type { EntityInstanceType } from './Entity.js';
5
5
  import type {
6
6
  EntityConstructor,
7
7
  EntityInterface,
8
8
  EntityJson,
9
- } from './Entity.types';
10
- import { Options, Selector } from './Nymph.types';
11
- import { ClassNotAvailableError } from './errors';
12
- import Entity from './Entity';
9
+ } from './Entity.types.js';
10
+ import { Options, Selector } from './Nymph.types.js';
11
+ import { ClassNotAvailableError } from './errors/index.js';
12
+ import Entity from './Entity.js';
13
13
 
14
14
  const entities: { [k: string]: EntityJson } = {};
15
15
 
@@ -0,0 +1,3 @@
1
+ declare module 'locutus/php/datetime/strtotime.js' {
2
+ export default function (str: string, now?: number): number;
3
+ }
package/src/utils.ts CHANGED
@@ -1,7 +1,7 @@
1
- import Entity from './Entity';
2
- import { EntityReference } from './Entity.types';
3
- import Nymph from './Nymph';
4
- import { Options, Selector } from './Nymph.types';
1
+ import Entity from './Entity.js';
2
+ import { EntityReference } from './Entity.types.js';
3
+ import Nymph from './Nymph.js';
4
+ import { Options, Selector } from './Nymph.types.js';
5
5
 
6
6
  export function xor(a: any, b: any): boolean {
7
7
  return !!(a && !b) || (!a && b);
package/tsconfig.json CHANGED
@@ -2,7 +2,9 @@
2
2
  "extends": "@tsconfig/recommended/tsconfig.json",
3
3
 
4
4
  "compilerOptions": {
5
- "lib": ["ES2023"],
5
+ "module": "ES2022",
6
+ "moduleResolution": "node",
7
+ "lib": ["ES2022"],
6
8
  "target": "ES2022",
7
9
  "noImplicitAny": true,
8
10
  "removeComments": false,