@nymphjs/nymph 1.0.0-beta.81 → 1.0.0-beta.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/Entity.d.ts +3 -3
- package/dist/Entity.js +29 -32
- package/dist/Entity.js.map +1 -1
- package/dist/Entity.test.js +10 -11
- package/dist/Entity.test.js.map +1 -1
- package/dist/Entity.types.d.ts +2 -2
- package/dist/Entity.types.js +1 -2
- package/dist/Nymph.d.ts +5 -5
- package/dist/Nymph.js +8 -14
- package/dist/Nymph.js.map +1 -1
- package/dist/Nymph.types.d.ts +2 -2
- package/dist/Nymph.types.js +2 -5
- package/dist/Nymph.types.js.map +1 -1
- package/dist/conf/d.d.ts +8 -0
- package/dist/conf/d.js +1 -2
- package/dist/conf/defaults.d.ts +1 -1
- package/dist/conf/defaults.js +6 -10
- package/dist/conf/defaults.js.map +1 -1
- package/dist/conf/index.d.ts +2 -2
- package/dist/conf/index.js +2 -8
- package/dist/conf/index.js.map +1 -1
- package/dist/driver/NymphDriver.d.ts +4 -4
- package/dist/driver/NymphDriver.js +46 -50
- package/dist/driver/NymphDriver.js.map +1 -1
- package/dist/driver/index.d.ts +2 -2
- package/dist/driver/index.js +3 -23
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/testArtifacts.d.ts +1 -1
- package/dist/driver/testArtifacts.js +42 -48
- package/dist/driver/testArtifacts.js.map +1 -1
- package/dist/errors/ClassNotAvailableError.js +1 -5
- package/dist/errors/ClassNotAvailableError.js.map +1 -1
- package/dist/errors/EntityConflictError.js +1 -5
- package/dist/errors/EntityConflictError.js.map +1 -1
- package/dist/errors/EntityInvalidDataError.js +1 -5
- package/dist/errors/EntityInvalidDataError.js.map +1 -1
- package/dist/errors/EntityIsSleepingReferenceError.js +1 -5
- package/dist/errors/EntityIsSleepingReferenceError.js.map +1 -1
- package/dist/errors/EntityUniqueConstraintError.js +1 -5
- package/dist/errors/EntityUniqueConstraintError.js.map +1 -1
- package/dist/errors/InvalidParametersError.js +1 -5
- package/dist/errors/InvalidParametersError.js.map +1 -1
- package/dist/errors/InvalidStateError.js +1 -5
- package/dist/errors/InvalidStateError.js.map +1 -1
- package/dist/errors/NotConfiguredError.js +1 -5
- package/dist/errors/NotConfiguredError.js.map +1 -1
- package/dist/errors/QueryFailedError.js +1 -5
- package/dist/errors/QueryFailedError.js.map +1 -1
- package/dist/errors/UnableToConnectError.js +1 -5
- package/dist/errors/UnableToConnectError.js.map +1 -1
- package/dist/errors/index.d.ts +10 -10
- package/dist/errors/index.js +10 -26
- package/dist/errors/index.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +14 -34
- package/dist/index.js.map +1 -1
- package/dist/nymphJoiProps.js +10 -15
- package/dist/nymphJoiProps.js.map +1 -1
- package/dist/testArtifacts.d.ts +1 -1
- package/dist/testArtifacts.js +4 -13
- package/dist/testArtifacts.js.map +1 -1
- package/dist/testMocks.d.ts +4 -4
- package/dist/testMocks.js +9 -17
- package/dist/testMocks.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +9 -21
- package/dist/utils.js.map +1 -1
- package/jest.config.js +11 -2
- package/package.json +16 -15
- package/src/Entity.test.ts +5 -3
- package/src/Entity.ts +8 -9
- package/src/Entity.types.ts +2 -2
- package/src/Nymph.ts +254 -254
- package/src/Nymph.types.ts +2 -2
- package/src/conf/d.ts +8 -0
- package/src/conf/defaults.ts +3 -1
- package/src/conf/index.ts +2 -2
- package/src/driver/NymphDriver.ts +17 -12
- package/src/driver/index.ts +2 -2
- package/src/driver/testArtifacts.ts +9 -5
- package/src/errors/index.ts +10 -10
- package/src/index.ts +11 -11
- package/src/testArtifacts.ts +1 -1
- package/src/testMocks.ts +6 -6
- package/src/type/locutus.d.ts +3 -0
- package/src/utils.ts +4 -4
- package/tsconfig.json +3 -1
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { difference } from 'lodash';
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { difference } from 'lodash-es';
|
|
3
3
|
import ReadLines from 'n-readlines';
|
|
4
|
-
import strtotime from 'locutus/php/datetime/strtotime';
|
|
4
|
+
import strtotime from 'locutus/php/datetime/strtotime.js';
|
|
5
5
|
import { guid } from '@nymphjs/guid';
|
|
6
6
|
|
|
7
|
-
import type Nymph from '../Nymph';
|
|
8
|
-
import type { Selector, Options, FormattedSelector } from '../Nymph.types';
|
|
9
|
-
import Entity, { type EntityInstanceType } from '../Entity';
|
|
7
|
+
import type Nymph from '../Nymph.js';
|
|
8
|
+
import type { Selector, Options, FormattedSelector } from '../Nymph.types.js';
|
|
9
|
+
import Entity, { type EntityInstanceType } from '../Entity.js';
|
|
10
10
|
import type {
|
|
11
11
|
EntityConstructor,
|
|
12
12
|
EntityData,
|
|
13
13
|
EntityInterface,
|
|
14
14
|
EntityReference,
|
|
15
15
|
SerializedEntityData,
|
|
16
|
-
} from '../Entity.types';
|
|
17
|
-
import {
|
|
18
|
-
|
|
16
|
+
} from '../Entity.types.js';
|
|
17
|
+
import {
|
|
18
|
+
InvalidParametersError,
|
|
19
|
+
UnableToConnectError,
|
|
20
|
+
} from '../errors/index.js';
|
|
21
|
+
import { xor } from '../utils.js';
|
|
19
22
|
|
|
20
23
|
// from: https://stackoverflow.com/a/6969486/664915
|
|
21
24
|
function escapeRegExp(string: string): string {
|
|
@@ -910,8 +913,8 @@ export default abstract class NymphDriver {
|
|
|
910
913
|
? 1
|
|
911
914
|
: 0
|
|
912
915
|
: options.return === 'guid'
|
|
913
|
-
|
|
914
|
-
|
|
916
|
+
? [guid]
|
|
917
|
+
: [entity],
|
|
915
918
|
};
|
|
916
919
|
}
|
|
917
920
|
}
|
|
@@ -1035,7 +1038,9 @@ export default abstract class NymphDriver {
|
|
|
1035
1038
|
| null = null,
|
|
1036
1039
|
) {
|
|
1037
1040
|
// Get a modified date.
|
|
1038
|
-
const mdate =
|
|
1041
|
+
const mdate = this.nymph.config.updateMDate
|
|
1042
|
+
? Date.now()
|
|
1043
|
+
: (entity.mdate ?? Date.now());
|
|
1039
1044
|
const tags = difference(entity.tags, ['']);
|
|
1040
1045
|
const data = entity.$getData();
|
|
1041
1046
|
const sdata = entity.$getSData();
|
package/src/driver/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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,
|
package/src/errors/index.ts
CHANGED
|
@@ -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';
|
package/src/testArtifacts.ts
CHANGED
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
|
|
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