@nymphjs/nymph 1.0.0-beta.13 → 1.0.0-beta.131
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 +650 -0
- package/README.md +34 -24
- package/dist/Entity.d.ts +306 -15
- package/dist/Entity.js +688 -226
- package/dist/Entity.js.map +1 -1
- package/dist/Entity.test.js +75 -29
- package/dist/Entity.test.js.map +1 -1
- package/dist/Entity.types.d.ts +275 -28
- package/dist/Entity.types.js +1 -2
- package/dist/Nymph.d.ts +575 -11
- package/dist/Nymph.js +825 -288
- package/dist/Nymph.js.map +1 -1
- package/dist/Nymph.types.d.ts +117 -7
- package/dist/Nymph.types.js +47 -5
- package/dist/Nymph.types.js.map +1 -1
- package/dist/conf/defaults.d.ts +1 -1
- package/dist/conf/defaults.js +26 -3
- package/dist/conf/defaults.js.map +1 -1
- package/dist/conf/index.d.ts +50 -2
- package/dist/conf/index.js +2 -8
- package/dist/conf/index.js.map +1 -1
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.js +2 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/transactional.d.ts +12 -0
- package/dist/decorators/transactional.js +45 -0
- package/dist/decorators/transactional.js.map +1 -0
- package/dist/driver/NymphDriver.d.ts +209 -41
- package/dist/driver/NymphDriver.js +737 -242
- package/dist/driver/NymphDriver.js.map +1 -1
- package/dist/driver/index.d.ts +1 -2
- package/dist/driver/index.js +2 -23
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/testArtifacts.d.ts +4 -4
- package/dist/driver/testArtifacts.js +2016 -1086
- 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.d.ts +6 -0
- package/dist/errors/EntityInvalidDataError.js +8 -6
- 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.d.ts +3 -0
- package/dist/errors/EntityUniqueConstraintError.js +7 -0
- package/dist/errors/EntityUniqueConstraintError.js.map +1 -0
- package/dist/errors/HttpError.d.ts +5 -0
- package/dist/errors/HttpError.js +11 -0
- package/dist/errors/HttpError.js.map +1 -0
- package/dist/errors/InvalidParametersError.js +1 -5
- package/dist/errors/InvalidParametersError.js.map +1 -1
- package/dist/errors/InvalidStateError.d.ts +3 -0
- package/dist/errors/InvalidStateError.js +7 -0
- package/dist/errors/InvalidStateError.js.map +1 -0
- package/dist/errors/MethodFailedError.d.ts +3 -0
- package/dist/errors/MethodFailedError.js +7 -0
- package/dist/errors/MethodFailedError.js.map +1 -0
- package/dist/errors/NotConfiguredError.js +1 -5
- package/dist/errors/NotConfiguredError.js.map +1 -1
- package/dist/errors/QueryFailedError.d.ts +2 -1
- package/dist/errors/QueryFailedError.js +5 -6
- 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 +12 -8
- package/dist/errors/index.js +12 -24
- package/dist/errors/index.js.map +1 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +2 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/transaction.d.ts +15 -0
- package/dist/helpers/transaction.js +47 -0
- package/dist/helpers/transaction.js.map +1 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +16 -34
- package/dist/index.js.map +1 -1
- package/dist/nymphJoiProps.d.ts +1 -1
- package/dist/nymphJoiProps.js +10 -15
- package/dist/nymphJoiProps.js.map +1 -1
- package/dist/testArtifacts.d.ts +21 -6
- package/dist/testArtifacts.js +124 -50
- package/dist/testArtifacts.js.map +1 -1
- package/dist/testMocks.d.ts +27 -12
- package/dist/testMocks.js +44 -33
- package/dist/testMocks.js.map +1 -1
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +106 -68
- package/dist/utils.js.map +1 -1
- package/jest.config.js +31 -5
- package/package.json +43 -24
- package/src/Entity.test.ts +73 -23
- package/src/Entity.ts +646 -252
- package/src/Entity.types.ts +102 -90
- package/src/Nymph.ts +930 -517
- package/src/Nymph.types.ts +145 -39
- package/src/conf/defaults.ts +34 -1
- package/src/conf/index.ts +50 -2
- package/src/decorators/index.ts +1 -0
- package/src/decorators/transactional.ts +63 -0
- package/src/driver/NymphDriver.ts +987 -417
- package/src/driver/index.ts +1 -3
- package/src/driver/testArtifacts.ts +2699 -1628
- package/src/errors/EntityUniqueConstraintError.ts +6 -0
- package/src/errors/HttpError.ts +12 -0
- package/src/errors/InvalidStateError.ts +6 -0
- package/src/errors/MethodFailedError.ts +6 -0
- package/src/errors/QueryFailedError.ts +3 -1
- package/src/errors/index.ts +16 -8
- package/src/helpers/index.ts +1 -0
- package/src/helpers/transaction.ts +65 -0
- package/src/index.ts +13 -11
- package/src/nymphJoiProps.ts +2 -2
- package/src/testArtifacts.ts +69 -20
- package/src/testMocks.ts +107 -41
- package/src/utils.ts +102 -67
- package/tsconfig.json +6 -3
- package/typedoc.json +4 -0
- package/dist/conf/d.d.ts +0 -6
- package/dist/conf/d.js +0 -3
- package/dist/conf/d.js.map +0 -1
- package/src/conf/d.ts +0 -24
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export * from './ClassNotAvailableError';
|
|
2
|
-
export * from './EntityConflictError';
|
|
3
|
-
export * from './EntityInvalidDataError';
|
|
4
|
-
export * from './EntityIsSleepingReferenceError';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
1
|
+
export * from './ClassNotAvailableError.js';
|
|
2
|
+
export * from './EntityConflictError.js';
|
|
3
|
+
export * from './EntityInvalidDataError.js';
|
|
4
|
+
export * from './EntityIsSleepingReferenceError.js';
|
|
5
|
+
export * from './EntityUniqueConstraintError.js';
|
|
6
|
+
export * from './HttpError.js';
|
|
7
|
+
export * from './InvalidParametersError.js';
|
|
8
|
+
export * from './InvalidStateError.js';
|
|
9
|
+
export * from './MethodFailedError.js';
|
|
10
|
+
export * from './NotConfiguredError.js';
|
|
11
|
+
export * from './QueryFailedError.js';
|
|
12
|
+
export * from './UnableToConnectError.js';
|
package/dist/errors/index.js
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ClassNotAvailableError"), exports);
|
|
18
|
-
__exportStar(require("./EntityConflictError"), exports);
|
|
19
|
-
__exportStar(require("./EntityInvalidDataError"), exports);
|
|
20
|
-
__exportStar(require("./EntityIsSleepingReferenceError"), exports);
|
|
21
|
-
__exportStar(require("./InvalidParametersError"), exports);
|
|
22
|
-
__exportStar(require("./NotConfiguredError"), exports);
|
|
23
|
-
__exportStar(require("./QueryFailedError"), exports);
|
|
24
|
-
__exportStar(require("./UnableToConnectError"), exports);
|
|
1
|
+
export * from './ClassNotAvailableError.js';
|
|
2
|
+
export * from './EntityConflictError.js';
|
|
3
|
+
export * from './EntityInvalidDataError.js';
|
|
4
|
+
export * from './EntityIsSleepingReferenceError.js';
|
|
5
|
+
export * from './EntityUniqueConstraintError.js';
|
|
6
|
+
export * from './HttpError.js';
|
|
7
|
+
export * from './InvalidParametersError.js';
|
|
8
|
+
export * from './InvalidStateError.js';
|
|
9
|
+
export * from './MethodFailedError.js';
|
|
10
|
+
export * from './NotConfiguredError.js';
|
|
11
|
+
export * from './QueryFailedError.js';
|
|
12
|
+
export * from './UnableToConnectError.js';
|
|
25
13
|
//# sourceMappingURL=index.js.map
|
package/dist/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,qCAAqC,CAAC;AAEpD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,gBAAgB,CAAC;AAE/B,cAAc,6BAA6B,CAAC;AAE5C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,yBAAyB,CAAC;AAExC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './transaction.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Nymph from '../Nymph.js';
|
|
2
|
+
/**
|
|
3
|
+
* Run a function inside of a transaction.
|
|
4
|
+
*
|
|
5
|
+
* @param nymph The instance of Nymph to start the transaction on.
|
|
6
|
+
* @param name The name of the transaction.
|
|
7
|
+
* @param fn The function that runs inside the transaction. It is passed the
|
|
8
|
+
* transactional instance of Nymph. If it resolves, the transaction is
|
|
9
|
+
* committed, and if it throws, the transaction is rolled back.
|
|
10
|
+
* @param finallyFn An optional function to run after the transaction is
|
|
11
|
+
* committed or rolled back. It is passed the original instance
|
|
12
|
+
* of Nymph. It SHOULD NOT throw.
|
|
13
|
+
* @returns The return value of the function.
|
|
14
|
+
*/
|
|
15
|
+
export declare function transaction<T>(nymph: Nymph, name: string, fn: (nymph: Nymph) => Promise<T>, finallyFn?: (nymph: Nymph, committed?: boolean) => Promise<void>): Promise<T>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a function inside of a transaction.
|
|
3
|
+
*
|
|
4
|
+
* @param nymph The instance of Nymph to start the transaction on.
|
|
5
|
+
* @param name The name of the transaction.
|
|
6
|
+
* @param fn The function that runs inside the transaction. It is passed the
|
|
7
|
+
* transactional instance of Nymph. If it resolves, the transaction is
|
|
8
|
+
* committed, and if it throws, the transaction is rolled back.
|
|
9
|
+
* @param finallyFn An optional function to run after the transaction is
|
|
10
|
+
* committed or rolled back. It is passed the original instance
|
|
11
|
+
* of Nymph. It SHOULD NOT throw.
|
|
12
|
+
* @returns The return value of the function.
|
|
13
|
+
*/
|
|
14
|
+
export async function transaction(nymph, name, fn, finallyFn) {
|
|
15
|
+
nymph.config.debugInfo('nymph:transaction', `Starting transaction ${name}`);
|
|
16
|
+
const tnymph = await nymph.startTransaction(name);
|
|
17
|
+
try {
|
|
18
|
+
const result = await fn(tnymph);
|
|
19
|
+
nymph.config.debugInfo('nymph:transaction', `Committing transaction ${name}`);
|
|
20
|
+
if (!(await tnymph.commit(name))) {
|
|
21
|
+
throw new Error('Transaction could not be committed.');
|
|
22
|
+
}
|
|
23
|
+
if (finallyFn) {
|
|
24
|
+
await finallyFn(nymph, true);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
try {
|
|
30
|
+
nymph.config.debugInfo('nymph:transaction', `Rolling back transaction ${name}, reason: ${e.message}`);
|
|
31
|
+
await tnymph.rollback(name);
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
nymph.config.debugError('nymph:transaction', `Rollback of transaction ${name} failed, reason: ${e.message}`);
|
|
35
|
+
}
|
|
36
|
+
if (finallyFn) {
|
|
37
|
+
try {
|
|
38
|
+
await finallyFn(nymph, false);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
nymph.config.debugError('nymph:transaction', `Finally function of transaction ${name} threw error: ${e.message}, this is a mistake and should be fixed, finally functions should never throw`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/helpers/transaction.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAY,EACZ,IAAY,EACZ,EAAgC,EAChC,SAAgE;IAEhE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,wBAAwB,IAAI,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QAEhC,KAAK,CAAC,MAAM,CAAC,SAAS,CACpB,mBAAmB,EACnB,0BAA0B,IAAI,EAAE,CACjC,CAAC;QACF,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,SAAS,CACpB,mBAAmB,EACnB,4BAA4B,IAAI,aAAa,CAAC,CAAC,OAAO,EAAE,CACzD,CAAC;YACF,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,KAAK,CAAC,MAAM,CAAC,UAAU,CACrB,mBAAmB,EACnB,2BAA2B,IAAI,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;QACJ,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAChC,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,KAAK,CAAC,MAAM,CAAC,UAAU,CACrB,mBAAmB,EACnB,mCAAmC,IAAI,iBAAiB,CAAC,CAAC,OAAO,+EAA+E,CACjJ,CAAC;YACJ,CAAC;QACH,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export * from './conf';
|
|
2
|
-
export * from './driver';
|
|
3
|
-
export * from './errors';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
|
|
1
|
+
export * from './conf/index.js';
|
|
2
|
+
export * from './driver/index.js';
|
|
3
|
+
export * from './errors/index.js';
|
|
4
|
+
export * from './decorators/index.js';
|
|
5
|
+
export * from './helpers/index.js';
|
|
6
|
+
export * from './Entity.types.js';
|
|
7
|
+
export * from './Entity.js';
|
|
8
|
+
import Entity from './Entity.js';
|
|
7
9
|
export { Entity };
|
|
8
|
-
export * from './Nymph.types';
|
|
9
|
-
export * from './Nymph';
|
|
10
|
-
import Nymph from './Nymph';
|
|
10
|
+
export * from './Nymph.types.js';
|
|
11
|
+
export * from './Nymph.js';
|
|
12
|
+
import Nymph from './Nymph.js';
|
|
11
13
|
export { Nymph };
|
|
12
|
-
import nymphJoiProps from './nymphJoiProps';
|
|
14
|
+
import nymphJoiProps from './nymphJoiProps.js';
|
|
13
15
|
export { nymphJoiProps };
|
|
14
|
-
export * from './utils';
|
|
16
|
+
export * from './utils.js';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.nymphJoiProps = exports.Nymph = exports.Entity = void 0;
|
|
21
|
-
__exportStar(require("./conf"), exports);
|
|
22
|
-
__exportStar(require("./driver"), exports);
|
|
23
|
-
__exportStar(require("./errors"), exports);
|
|
24
|
-
__exportStar(require("./Entity.types"), exports);
|
|
25
|
-
__exportStar(require("./Entity"), exports);
|
|
26
|
-
const Entity_1 = __importDefault(require("./Entity"));
|
|
27
|
-
exports.Entity = Entity_1.default;
|
|
28
|
-
__exportStar(require("./Nymph.types"), exports);
|
|
29
|
-
__exportStar(require("./Nymph"), exports);
|
|
30
|
-
const Nymph_1 = __importDefault(require("./Nymph"));
|
|
31
|
-
exports.Nymph = Nymph_1.default;
|
|
32
|
-
const nymphJoiProps_1 = __importDefault(require("./nymphJoiProps"));
|
|
33
|
-
exports.nymphJoiProps = nymphJoiProps_1.default;
|
|
34
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from './conf/index.js';
|
|
2
|
+
export * from './driver/index.js';
|
|
3
|
+
export * from './errors/index.js';
|
|
4
|
+
export * from './decorators/index.js';
|
|
5
|
+
export * from './helpers/index.js';
|
|
6
|
+
export * from './Entity.types.js';
|
|
7
|
+
export * from './Entity.js';
|
|
8
|
+
import Entity from './Entity.js';
|
|
9
|
+
export { Entity };
|
|
10
|
+
export * from './Nymph.types.js';
|
|
11
|
+
export * from './Nymph.js';
|
|
12
|
+
import Nymph from './Nymph.js';
|
|
13
|
+
export { Nymph };
|
|
14
|
+
import nymphJoiProps from './nymphJoiProps.js';
|
|
15
|
+
export { nymphJoiProps };
|
|
16
|
+
export * from './utils.js';
|
|
35
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mBAAmB,CAAC;AAElC,cAAc,aAAa,CAAC;AAC5B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,kBAAkB,CAAC;AAEjC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,cAAc,YAAY,CAAC"}
|
package/dist/nymphJoiProps.d.ts
CHANGED
package/dist/nymphJoiProps.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const joi_1 = __importDefault(require("joi"));
|
|
7
|
-
exports.default = {
|
|
8
|
-
guid: joi_1.default.alternatives()
|
|
9
|
-
.try(joi_1.default.any().only().allow(null), joi_1.default.string().trim(false).length(24).hex())
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
export default {
|
|
3
|
+
guid: Joi.alternatives()
|
|
4
|
+
.try(Joi.any().only().allow(null), Joi.string().trim(false).length(24).hex())
|
|
10
5
|
.required(),
|
|
11
|
-
cdate:
|
|
12
|
-
.try(
|
|
6
|
+
cdate: Joi.alternatives()
|
|
7
|
+
.try(Joi.any().only().allow(null), Joi.number())
|
|
13
8
|
.required(),
|
|
14
|
-
mdate:
|
|
15
|
-
.try(
|
|
9
|
+
mdate: Joi.alternatives()
|
|
10
|
+
.try(Joi.any().only().allow(null), Joi.number())
|
|
16
11
|
.required(),
|
|
17
|
-
tags:
|
|
18
|
-
.items(
|
|
12
|
+
tags: Joi.array()
|
|
13
|
+
.items(Joi.string().pattern(/[[\x01-\x1F\x7F]]/, {
|
|
19
14
|
name: 'control characters',
|
|
20
15
|
invert: true,
|
|
21
16
|
}))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nymphJoiProps.js","sourceRoot":"","sources":["../src/nymphJoiProps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nymphJoiProps.js","sourceRoot":"","sources":["../src/nymphJoiProps.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,eAAe;IACb,IAAI,EAAE,GAAG,CAAC,YAAY,EAAE;SACrB,GAAG,CACF,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAC5B,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAC1C;SACA,QAAQ,EAAE;IACb,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE;SACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;SAC/C,QAAQ,EAAE;IACb,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE;SACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;SAC/C,QAAQ,EAAE;IACb,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE;SACd,KAAK,CACJ,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE;QACxC,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,IAAI;KACb,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC"}
|
package/dist/testArtifacts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Entity from './Entity';
|
|
1
|
+
import Entity from './Entity.js';
|
|
2
2
|
export type TestModelData = {
|
|
3
3
|
name?: string;
|
|
4
4
|
null?: null;
|
|
@@ -6,6 +6,7 @@ export type TestModelData = {
|
|
|
6
6
|
test?: string;
|
|
7
7
|
array?: any[];
|
|
8
8
|
match?: string;
|
|
9
|
+
search?: string;
|
|
9
10
|
number?: number;
|
|
10
11
|
numberString?: string;
|
|
11
12
|
timestamp?: Number;
|
|
@@ -17,7 +18,11 @@ export type TestModelData = {
|
|
|
17
18
|
};
|
|
18
19
|
parent?: TestModel & TestModelData;
|
|
19
20
|
index?: string;
|
|
21
|
+
uniques?: string[];
|
|
20
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* This class is a test class that extends the Entity class.
|
|
25
|
+
*/
|
|
21
26
|
export declare class TestModel extends Entity<TestModelData> {
|
|
22
27
|
static ETYPE: string;
|
|
23
28
|
static class: string;
|
|
@@ -26,14 +31,24 @@ export declare class TestModel extends Entity<TestModelData> {
|
|
|
26
31
|
protected $allowlistData?: string[] | undefined;
|
|
27
32
|
protected $protectedTags: string[];
|
|
28
33
|
protected $allowlistTags?: string[] | undefined;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
constructor(guid?: string);
|
|
34
|
+
constructor();
|
|
35
|
+
$getUniques(): Promise<string[]>;
|
|
32
36
|
$useProtectedData(): () => void;
|
|
37
|
+
$testTransactionalDecorator(throwError: boolean): Promise<string>;
|
|
38
|
+
$testTransactionHelper(throwError: boolean): Promise<string>;
|
|
33
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* This class is a test class that extends the Entity class.
|
|
42
|
+
*/
|
|
34
43
|
export declare class TestBModel extends TestModel {
|
|
35
44
|
static ETYPE: string;
|
|
36
45
|
static class: string;
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
}
|
|
47
|
+
export type TestEmptyModelData = {};
|
|
48
|
+
/**
|
|
49
|
+
* This class is a test class that extends the Entity class.
|
|
50
|
+
*/
|
|
51
|
+
export declare class TestEmptyModel extends Entity<TestEmptyModelData> {
|
|
52
|
+
static ETYPE: string;
|
|
53
|
+
static class: string;
|
|
39
54
|
}
|
package/dist/testArtifacts.js
CHANGED
|
@@ -1,58 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TestBModel = exports.TestModel = void 0;
|
|
7
|
-
const Entity_1 = __importDefault(require("./Entity"));
|
|
8
|
-
class TestModel extends Entity_1.default {
|
|
9
|
-
static async factory(guid) {
|
|
10
|
-
return (await super.factory(guid));
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
11
5
|
}
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
14
31
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import Entity from './Entity.js';
|
|
36
|
+
import { transactional } from './decorators/index.js';
|
|
37
|
+
import { transaction } from './helpers/index.js';
|
|
38
|
+
/**
|
|
39
|
+
* This class is a test class that extends the Entity class.
|
|
40
|
+
*/
|
|
41
|
+
let TestModel = (() => {
|
|
42
|
+
let _classSuper = Entity;
|
|
43
|
+
let _instanceExtraInitializers = [];
|
|
44
|
+
let _$testTransactionalDecorator_decorators;
|
|
45
|
+
return class TestModel extends _classSuper {
|
|
46
|
+
static {
|
|
47
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
48
|
+
_$testTransactionalDecorator_decorators = [transactional];
|
|
49
|
+
__esDecorate(this, null, _$testTransactionalDecorator_decorators, { kind: "method", name: "$testTransactionalDecorator", static: false, private: false, access: { has: obj => "$testTransactionalDecorator" in obj, get: obj => obj.$testTransactionalDecorator }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
50
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
51
|
+
}
|
|
52
|
+
static ETYPE = 'test_model';
|
|
53
|
+
static class = 'TestModel';
|
|
54
|
+
$privateData = (__runInitializers(this, _instanceExtraInitializers), ['boolean']);
|
|
55
|
+
static searchRestrictedData = ['fish'];
|
|
56
|
+
$allowlistData = ['string', 'array', 'mdate'];
|
|
57
|
+
$protectedTags = ['test', 'notag'];
|
|
58
|
+
$allowlistTags = ['newtag'];
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
22
61
|
this.$addTag('test');
|
|
23
62
|
this.$data.boolean = true;
|
|
63
|
+
this.$data.uniques = [];
|
|
24
64
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.$
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
async $getUniques() {
|
|
66
|
+
return this.$data.uniques ?? [];
|
|
67
|
+
}
|
|
68
|
+
$useProtectedData() {
|
|
69
|
+
const $allowlistData = this.$allowlistData;
|
|
70
|
+
const $allowlistTags = this.$allowlistTags;
|
|
71
|
+
const $protectedData = this.$protectedData;
|
|
72
|
+
const $protectedTags = this.$protectedTags;
|
|
73
|
+
delete this.$allowlistData;
|
|
74
|
+
delete this.$allowlistTags;
|
|
75
|
+
this.$protectedData = ['number'];
|
|
76
|
+
this.$protectedTags = [];
|
|
77
|
+
return () => {
|
|
78
|
+
this.$allowlistData = $allowlistData;
|
|
79
|
+
this.$allowlistTags = $allowlistTags;
|
|
80
|
+
this.$protectedData = $protectedData;
|
|
81
|
+
this.$protectedTags = $protectedTags;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async $testTransactionalDecorator(throwError) {
|
|
85
|
+
this.$data.string = 'this has been changed';
|
|
86
|
+
if (this.$data.reference) {
|
|
87
|
+
await this.$data.reference.$wake();
|
|
88
|
+
this.$data.reference.string = 'this has been changed too';
|
|
89
|
+
await this.$data.reference.$save();
|
|
90
|
+
}
|
|
91
|
+
await this.$save();
|
|
92
|
+
if (throwError) {
|
|
93
|
+
throw Error('An error.');
|
|
94
|
+
}
|
|
95
|
+
return 'Success.';
|
|
96
|
+
}
|
|
97
|
+
async $testTransactionHelper(throwError) {
|
|
98
|
+
return await transaction(this.$nymph, 'test-transaction', async (nymph) => {
|
|
99
|
+
this.$setNymph(nymph);
|
|
100
|
+
this.$data.string = 'this has been changed';
|
|
101
|
+
if (this.$data.reference) {
|
|
102
|
+
await this.$data.reference.$wake();
|
|
103
|
+
this.$data.reference.string = 'this has been changed too';
|
|
104
|
+
await this.$data.reference.$save();
|
|
105
|
+
}
|
|
106
|
+
await this.$save();
|
|
107
|
+
if (throwError) {
|
|
108
|
+
throw Error('An error.');
|
|
109
|
+
}
|
|
110
|
+
return 'Success.';
|
|
111
|
+
}, async (nymph) => {
|
|
112
|
+
this.$setNymph(nymph);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
})();
|
|
117
|
+
export { TestModel };
|
|
118
|
+
/**
|
|
119
|
+
* This class is a test class that extends the Entity class.
|
|
120
|
+
*/
|
|
121
|
+
export class TestBModel extends TestModel {
|
|
122
|
+
static ETYPE = 'test_b_model';
|
|
123
|
+
static class = 'TestBModel';
|
|
42
124
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
static
|
|
49
|
-
return (await super.factory(guid));
|
|
50
|
-
}
|
|
51
|
-
static factorySync(guid) {
|
|
52
|
-
return super.factorySync(guid);
|
|
53
|
-
}
|
|
125
|
+
/**
|
|
126
|
+
* This class is a test class that extends the Entity class.
|
|
127
|
+
*/
|
|
128
|
+
export class TestEmptyModel extends Entity {
|
|
129
|
+
static ETYPE = 'test_empty_model';
|
|
130
|
+
static class = 'TestEmptyModel';
|
|
54
131
|
}
|
|
55
|
-
exports.TestBModel = TestBModel;
|
|
56
|
-
TestBModel.ETYPE = 'test_b_model';
|
|
57
|
-
TestBModel.class = 'TestBModel';
|
|
58
132
|
//# sourceMappingURL=testArtifacts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testArtifacts.js","sourceRoot":"","sources":["../src/testArtifacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testArtifacts.js","sourceRoot":"","sources":["../src/testArtifacts.ts"],"names":[],"mappings":"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"}
|
package/dist/testMocks.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type { EntityInstanceType, EntityObjectType } from './Entity.js';
|
|
2
|
+
import type { EntityConstructor, EntityInterface } from './Entity.types.js';
|
|
3
|
+
import { Options, Selector } from './Nymph.types.js';
|
|
4
|
+
import Entity from './Entity.js';
|
|
4
5
|
export declare class MockNymphDriver {
|
|
5
6
|
private nymph;
|
|
6
7
|
constructor(nymph: MockNymph);
|
|
7
|
-
|
|
8
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
8
9
|
return: 'guid';
|
|
9
|
-
}, ...selectors: Selector[]): string | null
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
}, ...selectors: Selector[]): Promise<string | null>;
|
|
11
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
12
|
+
return: 'object';
|
|
13
|
+
}, ...selectors: Selector[]): Promise<EntityObjectType<T> | null>;
|
|
14
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T>, ...selectors: Selector[]): Promise<EntityInstanceType<T> | null>;
|
|
15
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
12
16
|
return: 'guid';
|
|
13
|
-
}, guid: string): string | null
|
|
14
|
-
|
|
17
|
+
}, guid: string): Promise<string | null>;
|
|
18
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
19
|
+
return: 'object';
|
|
20
|
+
}, guid: string): Promise<EntityObjectType<T> | null>;
|
|
21
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T>, guid: string): Promise<EntityInstanceType<T> | null>;
|
|
15
22
|
}
|
|
16
23
|
export declare class MockNymph {
|
|
17
24
|
private entityClasses;
|
|
@@ -19,16 +26,24 @@ export declare class MockNymph {
|
|
|
19
26
|
Tilmeld: any;
|
|
20
27
|
Entity: typeof Entity;
|
|
21
28
|
constructor();
|
|
22
|
-
addEntityClass<T extends EntityConstructor>(
|
|
29
|
+
addEntityClass<T extends EntityConstructor>(EntityClass: T): T;
|
|
23
30
|
getEntityClass(className: string): EntityConstructor;
|
|
31
|
+
getEntityClass<T extends EntityConstructor>(className: T): T;
|
|
32
|
+
getEntityClassByEtype(etype: string): EntityConstructor;
|
|
24
33
|
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
25
34
|
return: 'guid';
|
|
26
35
|
}, ...selectors: Selector[]): Promise<string | null>;
|
|
27
|
-
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T
|
|
36
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
37
|
+
return: 'object';
|
|
38
|
+
}, ...selectors: Selector[]): Promise<EntityObjectType<T> | null>;
|
|
39
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T>, ...selectors: Selector[]): Promise<EntityInstanceType<T> | null>;
|
|
28
40
|
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
29
41
|
return: 'guid';
|
|
30
42
|
}, guid: string): Promise<string | null>;
|
|
31
|
-
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T
|
|
43
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T> & {
|
|
44
|
+
return: 'object';
|
|
45
|
+
}, guid: string): Promise<EntityObjectType<T> | null>;
|
|
46
|
+
getEntity<T extends EntityConstructor = EntityConstructor>(options: Options<T>, guid: string): Promise<EntityInstanceType<T> | null>;
|
|
32
47
|
saveEntity(entity: EntityInterface): Promise<boolean>;
|
|
33
48
|
deleteEntity(entity: EntityInterface): Promise<boolean>;
|
|
34
49
|
}
|