@jonloucks/contracts-ts 0.5.0 → 1.0.1
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/api/AutoClose.d.ts +3 -5
- package/api/AutoClose.d.ts.map +1 -1
- package/api/AutoClose.js +14 -7
- package/api/AutoClose.js.map +1 -1
- package/api/AutoCloseFactory.d.ts +2 -11
- package/api/AutoCloseFactory.d.ts.map +1 -1
- package/api/AutoCloseFactory.js +4 -25
- package/api/AutoCloseFactory.js.map +1 -1
- package/api/AutoOpen.d.ts +3 -5
- package/api/AutoOpen.d.ts.map +1 -1
- package/api/AutoOpen.js +1 -2
- package/api/AutoOpen.js.map +1 -1
- package/api/BasicContract.d.ts +8 -2
- package/api/BasicContract.d.ts.map +1 -1
- package/api/BasicContract.js +35 -7
- package/api/BasicContract.js.map +1 -1
- package/api/BindStrategy.d.ts +0 -3
- package/api/BindStrategy.d.ts.map +1 -1
- package/api/BindStrategy.js +0 -1
- package/api/BindStrategy.js.map +1 -1
- package/api/Contract.d.ts +15 -13
- package/api/Contract.d.ts.map +1 -1
- package/api/Contract.js +1 -1
- package/api/Contract.js.map +1 -1
- package/api/ContractFactory.d.ts +2 -2
- package/api/ContractFactory.d.ts.map +1 -1
- package/api/ContractFactory.js +1 -1
- package/api/ContractFactory.js.map +1 -1
- package/api/Contracts.d.ts +4 -4
- package/api/Contracts.d.ts.map +1 -1
- package/api/Contracts.js +2 -2
- package/api/Contracts.js.map +1 -1
- package/api/ContractsFactory.d.ts +2 -2
- package/api/ContractsFactory.d.ts.map +1 -1
- package/api/ContractsFactory.js +1 -1
- package/api/ContractsFactory.js.map +1 -1
- package/api/Open.d.ts +20 -0
- package/api/Open.d.ts.map +1 -0
- package/api/Open.js +14 -0
- package/api/Open.js.map +1 -0
- package/api/Promisor.d.ts +1 -10
- package/api/Promisor.d.ts.map +1 -1
- package/api/Promisor.js +2 -26
- package/api/Promisor.js.map +1 -1
- package/api/PromisorFactory.d.ts +3 -9
- package/api/PromisorFactory.d.ts.map +1 -1
- package/api/PromisorFactory.js +4 -24
- package/api/PromisorFactory.js.map +1 -1
- package/api/RatifiedContract.d.ts +2 -2
- package/api/RatifiedContract.d.ts.map +1 -1
- package/api/RatifiedContract.js +1 -4
- package/api/RatifiedContract.js.map +1 -1
- package/api/Repository.d.ts +4 -9
- package/api/Repository.d.ts.map +1 -1
- package/api/Repository.js +2 -25
- package/api/Repository.js.map +1 -1
- package/api/RepositoryFactory.d.ts +2 -8
- package/api/RepositoryFactory.d.ts.map +1 -1
- package/api/RepositoryFactory.js +2 -23
- package/api/RepositoryFactory.js.map +1 -1
- package/api/Types.d.ts +29 -61
- package/api/Types.d.ts.map +1 -1
- package/api/Types.js +49 -102
- package/api/Types.js.map +1 -1
- package/auxiliary/AtomicBoolean.d.ts +2 -11
- package/auxiliary/AtomicBoolean.d.ts.map +1 -1
- package/auxiliary/AtomicBoolean.js +1 -25
- package/auxiliary/AtomicBoolean.js.map +1 -1
- package/auxiliary/AtomicBooleanFactory.d.ts +3 -12
- package/auxiliary/AtomicBooleanFactory.d.ts.map +1 -1
- package/auxiliary/AtomicBooleanFactory.js +2 -24
- package/auxiliary/AtomicBooleanFactory.js.map +1 -1
- package/auxiliary/AtomicInteger.d.ts +2 -11
- package/auxiliary/AtomicInteger.d.ts.map +1 -1
- package/auxiliary/AtomicInteger.js +1 -25
- package/auxiliary/AtomicInteger.js.map +1 -1
- package/auxiliary/AtomicIntegerFactory.d.ts +3 -12
- package/auxiliary/AtomicIntegerFactory.d.ts.map +1 -1
- package/auxiliary/AtomicIntegerFactory.js +2 -24
- package/auxiliary/AtomicIntegerFactory.js.map +1 -1
- package/auxiliary/AtomicReference.d.ts +2 -11
- package/auxiliary/AtomicReference.d.ts.map +1 -1
- package/auxiliary/AtomicReference.js +1 -25
- package/auxiliary/AtomicReference.js.map +1 -1
- package/auxiliary/AtomicReferenceFactory.d.ts +2 -11
- package/auxiliary/AtomicReferenceFactory.d.ts.map +1 -1
- package/auxiliary/AtomicReferenceFactory.js +2 -24
- package/auxiliary/AtomicReferenceFactory.js.map +1 -1
- package/impl/AtomicBooleanFactory.impl.js +2 -2
- package/impl/AtomicBooleanFactory.impl.js.map +1 -1
- package/impl/AtomicIntegerFactory.impl.js +2 -2
- package/impl/AtomicIntegerFactory.impl.js.map +1 -1
- package/impl/AtomicReferenceFactory.impl.js +2 -2
- package/impl/AtomicReferenceFactory.impl.js.map +1 -1
- package/impl/ContractFactory.impl.js +2 -2
- package/impl/ContractFactory.impl.js.map +1 -1
- package/impl/Contracts.impl.d.ts.map +1 -1
- package/impl/Contracts.impl.js +7 -1
- package/impl/Contracts.impl.js.map +1 -1
- package/impl/ContractsFactory.impl.js +4 -4
- package/impl/ContractsFactory.impl.js.map +1 -1
- package/impl/ContractsWrapper.impl.d.ts.map +1 -1
- package/impl/ContractsWrapper.impl.js +3 -0
- package/impl/ContractsWrapper.impl.js.map +1 -1
- package/impl/Events.d.ts +2 -2
- package/impl/Events.d.ts.map +1 -1
- package/impl/Events.impl.d.ts.map +1 -1
- package/impl/Events.impl.js +3 -0
- package/impl/Events.impl.js.map +1 -1
- package/impl/ExtractorPromisor.impl.d.ts.map +1 -1
- package/impl/ExtractorPromisor.impl.js +8 -1
- package/impl/ExtractorPromisor.impl.js.map +1 -1
- package/impl/LifeCyclePromisor.impl.js +2 -2
- package/impl/LifeCyclePromisor.impl.js.map +1 -1
- package/impl/PromisorFactory.impl.d.ts.map +1 -1
- package/impl/PromisorFactory.impl.js +2 -1
- package/impl/PromisorFactory.impl.js.map +1 -1
- package/impl/Repository.impl.d.ts.map +1 -1
- package/impl/Repository.impl.js +7 -1
- package/impl/Repository.impl.js.map +1 -1
- package/impl/RepositoryFactory.impl.js +1 -1
- package/impl/RepositoryFactory.impl.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/index.js +7 -7
- package/index.js.map +1 -1
- package/package.json +4 -2
- package/version.d.ts +1 -0
- package/version.d.ts.map +1 -1
- package/version.js +4 -20
- package/version.js.map +1 -1
- package/api/Lawyer.d.ts +0 -20
- package/api/Lawyer.d.ts.map +0 -1
- package/api/Lawyer.js +0 -3
- package/api/Lawyer.js.map +0 -1
- package/auxiliary/ClassCastException.d.ts +0 -8
- package/auxiliary/ClassCastException.d.ts.map +0 -1
- package/auxiliary/ClassCastException.js +0 -18
- package/auxiliary/ClassCastException.js.map +0 -1
|
@@ -12,7 +12,7 @@ export interface ContractsFactory {
|
|
|
12
12
|
* @param config the Contracts configuration
|
|
13
13
|
* @return the new Contracts
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
createContracts(config?: Config): RequiredType<Contracts>;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Type guard for ContractsFactory
|
|
@@ -20,5 +20,5 @@ export interface ContractsFactory {
|
|
|
20
20
|
* @param value the value to check
|
|
21
21
|
* @return true if value is ContractsFactory, false otherwise
|
|
22
22
|
*/
|
|
23
|
-
export declare function guard(value: unknown): value is ContractsFactory
|
|
23
|
+
export declare function guard(value: unknown): value is RequiredType<ContractsFactory>;
|
|
24
24
|
//# sourceMappingURL=ContractsFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractsFactory.d.ts","sourceRoot":"","sources":["../../src/api/ContractsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"ContractsFactory.d.ts","sourceRoot":"","sources":["../../src/api/ContractsFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAkB,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAE/B;;;;;;OAMG;IACH,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;CAC3D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAE7E"}
|
package/api/ContractsFactory.js
CHANGED
|
@@ -9,6 +9,6 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
9
9
|
* @return true if value is ContractsFactory, false otherwise
|
|
10
10
|
*/
|
|
11
11
|
function guard(value) {
|
|
12
|
-
return (0, Types_1.
|
|
12
|
+
return (0, Types_1.guardFunctions)(value, 'createContracts');
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=ContractsFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractsFactory.js","sourceRoot":"","sources":["../../src/api/ContractsFactory.ts"],"names":[],"mappings":";;AAyBA,sBAEC;AA1BD,
|
|
1
|
+
{"version":3,"file":"ContractsFactory.js","sourceRoot":"","sources":["../../src/api/ContractsFactory.ts"],"names":[],"mappings":";;AAyBA,sBAEC;AA1BD,6DAAiF;AAkBjF;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,IAAA,sBAAc,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAClD,CAAC"}
|
package/api/Open.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AutoClose } from "./AutoClose";
|
|
2
|
+
import { RequiredType } from "./AutoCloseFactory";
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing an entity that can be opened, returning an AutoClose mechanism.
|
|
5
|
+
*/
|
|
6
|
+
export interface Open {
|
|
7
|
+
/**
|
|
8
|
+
* Open this instance.
|
|
9
|
+
* @return the mechanism to close
|
|
10
|
+
*/
|
|
11
|
+
open(): AutoClose;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Duck-typing check for Open interface.
|
|
15
|
+
*
|
|
16
|
+
* @param value the value to check
|
|
17
|
+
* @returns true if the value implements Open, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
export declare function guard(value: unknown): value is RequiredType<Open>;
|
|
20
|
+
//# sourceMappingURL=Open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Open.d.ts","sourceRoot":"","sources":["../../src/api/Open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,IAAI;IAEnB;;;OAGG;IACH,IAAI,IAAI,SAAS,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,CAEjE"}
|
package/api/Open.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guard = guard;
|
|
4
|
+
const Types_1 = require("./Types");
|
|
5
|
+
/**
|
|
6
|
+
* Duck-typing check for Open interface.
|
|
7
|
+
*
|
|
8
|
+
* @param value the value to check
|
|
9
|
+
* @returns true if the value implements Open, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
function guard(value) {
|
|
12
|
+
return (0, Types_1.guardFunctions)(value, 'open');
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Open.js.map
|
package/api/Open.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Open.js","sourceRoot":"","sources":["../../src/api/Open.ts"],"names":[],"mappings":";;AAsBA,sBAEC;AAvBD,mCAAyC;AAezC;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,IAAA,sBAAc,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
package/api/Promisor.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
|
|
2
1
|
import { OptionalType, RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
3
2
|
/**
|
|
4
3
|
* Interface for providing a deliverable for a Contract
|
|
@@ -34,15 +33,7 @@ export interface Promisor<T> {
|
|
|
34
33
|
* @param instance the instance to check
|
|
35
34
|
* @returns true if the instance is a Promisor, false otherwise
|
|
36
35
|
*/
|
|
37
|
-
export declare function guard<T>(instance: unknown): instance is Promisor<T
|
|
38
|
-
/** @deprecated use guard instead
|
|
39
|
-
*/
|
|
40
|
-
export { guard as isPromisor };
|
|
41
|
-
/**
|
|
42
|
-
* For creating a Contract for Promisor with duck-typing checks.
|
|
43
|
-
* @deprecated use createContract with guard instead
|
|
44
|
-
*/
|
|
45
|
-
export declare const LAWYER: Lawyer<Promisor<unknown>>;
|
|
36
|
+
export declare function guard<T>(instance: unknown): instance is RequiredType<Promisor<T>>;
|
|
46
37
|
/**
|
|
47
38
|
* A type that can be converted to a Promisor
|
|
48
39
|
*/
|
package/api/Promisor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Promisor.d.ts","sourceRoot":"","sources":["../../src/api/Promisor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Promisor.d.ts","sourceRoot":"","sources":["../../src/api/Promisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAA+C,MAAM,mCAAmC,CAAC;AAG5H;;;;;GAKG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IAEzB;;;OAGG;IACH,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAE1B;;;;;;OAMG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,cAAc,IAAI,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAEjF;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAE7H;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAYlF;AA+BD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAQxG"}
|
package/api/Promisor.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAWYER = void 0;
|
|
4
3
|
exports.guard = guard;
|
|
5
|
-
exports.isPromisor = guard;
|
|
6
4
|
exports.typeToPromisor = typeToPromisor;
|
|
7
5
|
exports.unwrapPromisorType = unwrapPromisorType;
|
|
8
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
9
6
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
10
7
|
const Checks_1 = require("@jonloucks/contracts-ts/auxiliary/Checks");
|
|
11
8
|
/**
|
|
@@ -14,29 +11,8 @@ const Checks_1 = require("@jonloucks/contracts-ts/auxiliary/Checks");
|
|
|
14
11
|
* @returns true if the instance is a Promisor, false otherwise
|
|
15
12
|
*/
|
|
16
13
|
function guard(instance) {
|
|
17
|
-
return (0, Types_1.
|
|
14
|
+
return (0, Types_1.guardFunctions)(instance, 'demand', 'incrementUsage', 'decrementUsage');
|
|
18
15
|
}
|
|
19
|
-
/**
|
|
20
|
-
* For creating a Contract for Promisor with duck-typing checks.
|
|
21
|
-
* @deprecated use createContract with guard instead
|
|
22
|
-
*/
|
|
23
|
-
exports.LAWYER = new class {
|
|
24
|
-
/**
|
|
25
|
-
* Lawyer.isDeliverable override
|
|
26
|
-
*/
|
|
27
|
-
isDeliverable(instance) {
|
|
28
|
-
return guard(instance);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Lawyer.createContract override
|
|
32
|
-
*/
|
|
33
|
-
createContract(config) {
|
|
34
|
-
const copy = { ...config ?? {} };
|
|
35
|
-
copy.test ?? (copy.test = this.isDeliverable);
|
|
36
|
-
copy.typeName ?? (copy.typeName = "Promisor");
|
|
37
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
16
|
/**
|
|
41
17
|
* Convert a PromisorType to a Promisor
|
|
42
18
|
*
|
|
@@ -47,7 +23,7 @@ function typeToPromisor(type) {
|
|
|
47
23
|
if ((0, Types_1.isNotPresent)(type)) {
|
|
48
24
|
return wrapPromisor(type, () => type); // supplier of null or undefined
|
|
49
25
|
}
|
|
50
|
-
else if ((0, Types_1.
|
|
26
|
+
else if ((0, Types_1.isConstructor)(type)) {
|
|
51
27
|
return wrapPromisor(type, () => new type()); // supplier of new instance
|
|
52
28
|
}
|
|
53
29
|
else if (guard(type)) {
|
package/api/Promisor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Promisor.js","sourceRoot":"","sources":["../../src/api/Promisor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Promisor.js","sourceRoot":"","sources":["../../src/api/Promisor.ts"],"names":[],"mappings":";;AAyCA,sBAEC;AAaD,wCAYC;AAqCD,gDAQC;AAjHD,6DAA4H;AAC5H,qEAAwE;AAmCxE;;;;GAIG;AACH,SAAgB,KAAK,CAAI,QAAiB;IACxC,OAAO,IAAA,sBAAc,EAAC,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;AAChF,CAAC;AAOD;;;;;GAKG;AACH,SAAgB,cAAc,CAAI,IAAqB;IACrD,IAAI,IAAA,oBAAY,EAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,YAAY,CAAI,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,gCAAgC;IAC5E,CAAC;SAAM,IAAI,IAAA,qBAAa,EAAI,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO,YAAY,CAAI,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,2BAA2B;IAC7E,CAAC;SAAM,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,CAAC,qBAAqB;IACpC,CAAC;SAAM,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QACtC,OAAO,YAAY,CAAI,IAAI,EAAE,IAAe,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,CAAI,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,sDAAsD;IAClG,CAAC;AACH,CAAC;AAaD;;;;;;GAMG;AACH,SAAS,YAAY,CAAI,IAAqB,EAAE,MAA6B;IAC3E,MAAM,WAAW,GAAG,IAAA,qBAAY,EAAC,MAAM,EAAE,2CAA2C,CAAC,CAAC;IACtF,IAAI,UAAU,GAAW,CAAC,CAAC;IAC3B,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU;QAClC,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU;QAClC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;KAC/B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAI,QAAmC;IACrE,IAAI,IAAA,oBAAY,EAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,IAAI,oBAAoB,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;QACxF,OAAO,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACzC,CAAC;IACD,OAAO,QAAQ,CAAA;AACnB,CAAC"}
|
package/api/PromisorFactory.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
|
|
2
|
-
import { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
|
|
3
2
|
import { Promisor, PromisorType } from "@jonloucks/contracts-ts/api/Promisor";
|
|
4
|
-
import { OptionalType, RequiredType,
|
|
3
|
+
import { OptionalType, RequiredType, TransformType } from "@jonloucks/contracts-ts/api/Types";
|
|
5
4
|
/**
|
|
6
5
|
* Helper methods for creating and chaining Promisors used for {@link Contractss#bind(Contract, Promisor)}
|
|
7
6
|
*/
|
|
@@ -43,7 +42,7 @@ export interface PromisorFactory {
|
|
|
43
42
|
* @param <T> the type of deliverable
|
|
44
43
|
* @param <R> the new Promisor deliverable type
|
|
45
44
|
*/
|
|
46
|
-
createExtractor<T, R>(promisor: PromisorType<T>, extractor:
|
|
45
|
+
createExtractor<T, R>(promisor: PromisorType<T>, extractor: TransformType<T, R>): RequiredType<Promisor<R>>;
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
48
|
* Type guard for PromisorFactory
|
|
@@ -51,12 +50,7 @@ export interface PromisorFactory {
|
|
|
51
50
|
* @param value the value to check
|
|
52
51
|
* @return true if value is PromisorFactory, false otherwise
|
|
53
52
|
*/
|
|
54
|
-
export declare function guard(instance: unknown): instance is PromisorFactory
|
|
55
|
-
/**
|
|
56
|
-
* For creating a Contract for PromisorFactory with duck-typing checks.
|
|
57
|
-
* @deprecated use createContract directly
|
|
58
|
-
*/
|
|
59
|
-
export declare const LAWYER: Lawyer<PromisorFactory>;
|
|
53
|
+
export declare function guard(instance: unknown): instance is RequiredType<PromisorFactory>;
|
|
60
54
|
/**
|
|
61
55
|
* The Contract for PromisorFactory implementation.
|
|
62
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromisorFactory.d.ts","sourceRoot":"","sources":["../../src/api/PromisorFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"PromisorFactory.d.ts","sourceRoot":"","sources":["../../src/api/PromisorFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAkB,MAAM,mCAAmC,CAAC;AAE9G;;GAEG;AACH,MAAM,WAAW,eAAe;IAE9B;;;;;;OAMG;IACH,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzE;;;;;;;OAOG;IACH,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzE;;;;;;;;;OASG;IACH,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7G;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,eAAe,CAAC,CAElF;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAI7C,CAAC"}
|
package/api/PromisorFactory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTRACT =
|
|
3
|
+
exports.CONTRACT = void 0;
|
|
4
4
|
exports.guard = guard;
|
|
5
5
|
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
6
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
@@ -11,34 +11,14 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
11
11
|
* @return true if value is PromisorFactory, false otherwise
|
|
12
12
|
*/
|
|
13
13
|
function guard(instance) {
|
|
14
|
-
return (0, Types_1.
|
|
14
|
+
return (0, Types_1.guardFunctions)(instance, 'createExtractor', 'createLifeCycle', 'createSingleton', 'createValue');
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* For creating a Contract for PromisorFactory with duck-typing checks.
|
|
18
|
-
* @deprecated use createContract directly
|
|
19
|
-
*/
|
|
20
|
-
exports.LAWYER = new class {
|
|
21
|
-
/**
|
|
22
|
-
* Lawyer.isDeliverable override
|
|
23
|
-
*/
|
|
24
|
-
isDeliverable(instance) {
|
|
25
|
-
return guard(instance);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Lawyer.createContract override
|
|
29
|
-
*/
|
|
30
|
-
createContract(config) {
|
|
31
|
-
const copy = { ...config ?? {} };
|
|
32
|
-
copy.test ?? (copy.test = this.isDeliverable);
|
|
33
|
-
copy.typeName ?? (copy.typeName = "PromisorFactory");
|
|
34
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
16
|
/**
|
|
38
17
|
* The Contract for PromisorFactory implementation.
|
|
39
18
|
*/
|
|
40
19
|
exports.CONTRACT = (0, RatifiedContract_1.create)({
|
|
41
20
|
test: guard,
|
|
42
|
-
name: "PromisorFactory"
|
|
21
|
+
name: "PromisorFactory",
|
|
22
|
+
typeName: "PromisorFactory"
|
|
43
23
|
});
|
|
44
24
|
//# sourceMappingURL=PromisorFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromisorFactory.js","sourceRoot":"","sources":["../../src/api/PromisorFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PromisorFactory.js","sourceRoot":"","sources":["../../src/api/PromisorFactory.ts"],"names":[],"mappings":";;;AA2DA,sBAEC;AA3DD,mFAAwF;AACxF,6DAA8G;AAkD9G;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAiB;IACrC,OAAO,IAAA,sBAAc,EAAC,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAC1G,CAAC;AAED;;GAEG;AACU,QAAA,QAAQ,GAA8B,IAAA,yBAAc,EAAC;IAChE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,iBAAiB;CAC5B,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { OptionalType, RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
|
10
10
|
* @param config the configuration for the RatifiedContract
|
|
11
11
|
* @returns the created RatifiedContract
|
|
12
12
|
*/
|
|
13
|
-
export declare function create<T>(config?: Config<T> |
|
|
13
|
+
export declare function create<T>(config?: Config<T> | undefined): Contract<T>;
|
|
14
14
|
/**
|
|
15
15
|
* Checks if the given instance is a RatifiedContract.
|
|
16
16
|
* @param instance the instance to check
|
|
@@ -39,7 +39,7 @@ declare class RatifiedContract<T> extends BasicContract<T> {
|
|
|
39
39
|
* @param <T> the type of deliverable for this Contract
|
|
40
40
|
* @return the new Contract
|
|
41
41
|
*/
|
|
42
|
-
static create<T>(config?: Config<T> |
|
|
42
|
+
static create<T>(config?: Config<T> | undefined): Contract<T>;
|
|
43
43
|
static isRatifiedContract(instance: unknown): instance is RatifiedContract<unknown>;
|
|
44
44
|
/**
|
|
45
45
|
* Being a RatifiedContract means something special. It is not something that you proclaim
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatifiedContract.d.ts","sourceRoot":"","sources":["../../src/api/RatifiedContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,YAAY,EAA2B,MAAM,mCAAmC,CAAC;AAExG;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"RatifiedContract.d.ts","sourceRoot":"","sources":["../../src/api/RatifiedContract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,YAAY,EAA2B,MAAM,mCAAmC,CAAC;AAExG;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAErE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAE3F;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAEzG;AAED;;;;;GAKG;AACH,cAAM,gBAAgB,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;;IAEhD;;;;;;QAMI;IACJ,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC;IAI7D,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,gBAAgB,CAAC,OAAO,CAAC;IAYnF;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAMtB,OAAO;IAMP,OAAO,CAAC,MAAM,CAAC,cAAc;CAS9B"}
|
package/api/RatifiedContract.js
CHANGED
|
@@ -39,10 +39,7 @@ function isRatifiedContract(instance) {
|
|
|
39
39
|
* @returns true if the configuration is ratifiable, false otherwise
|
|
40
40
|
*/
|
|
41
41
|
function isRatifiableConfig(config) {
|
|
42
|
-
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return (0, Types_1.isPresent)(config.test) || (0, Types_1.isPresent)(config.cast);
|
|
42
|
+
return (0, Types_1.isPresent)(config) && (0, Types_1.isPresent)(config.test);
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
45
|
* A RatifiedContract is a Contract that has been verified to have either a test or cast function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatifiedContract.js","sourceRoot":"","sources":["../../src/api/RatifiedContract.ts"],"names":[],"mappings":";;;;;;;;AAcA,wBAEC;AAOD,gDAEC;AAQD,
|
|
1
|
+
{"version":3,"file":"RatifiedContract.js","sourceRoot":"","sources":["../../src/api/RatifiedContract.ts"],"names":[],"mappings":";;;;;;;;AAcA,wBAEC;AAOD,gDAEC;AAQD,gDAEC;AAnCD,6EAA0E;AAE1E,qFAAkF;AAClF,6DAAwG;AAExG;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAI,MAA8B;IACtD,OAAO,gBAAgB,CAAC,MAAM,CAAI,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,QAAiB;IAClD,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAI,MAAgC;IACpE,OAAO,IAAA,iBAAS,EAAC,MAAM,CAAC,IAAI,IAAA,iBAAS,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,gBAAoB,SAAQ,6BAAgB;IAEhD;;;;;;QAMI;IACJ,MAAM,CAAC,MAAM,CAAI,MAA8B;QAC7C,OAAO,IAAI,EAAgB,CAAI,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,QAAiB;QACzC,IAAI,IAAA,oBAAY,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,QAAqC,CAAC;YACxD,OAAO,uBAAA,SAAS,gCAAQ,KAAK,uBAAA,EAAgB,oCAAQ,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;;;;;;OASG;IACK,cAAc;QACpB,IAAI,uBAAA,IAAI,gCAAQ,KAAK,uBAAA,EAAgB,oCAAQ,EAAE,CAAC;YAC9C,MAAM,IAAI,qCAAiB,CAAC,sDAAsD,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;IAED,YAAoB,MAAgC;QAClD,KAAK,CAAC,EAAgB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;QAaxC,mCAAkB,uBAAA,EAAgB,oCAAQ,EAAC;QAZlD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,MAAM,CAAC,cAAc,CAAI,MAAgC;QAC/D,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,OAAO,MAAiC,CAAC;QAC3C,CAAC;QACD,MAAM,IAAI,qCAAiB,CAAC,2EAA2E,CAAC,CAAC;IAC3G,CAAC;;;AAEe,oCAAkB,MAAM,CAAC,UAAU,CAAC,EAA7B,CAA8B"}
|
package/api/Repository.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AutoClose } from "@jonloucks/contracts-ts/api/AutoClose";
|
|
2
|
-
import {
|
|
2
|
+
import { Open } from "@jonloucks/contracts-ts/api/Open";
|
|
3
3
|
import { BindStrategy } from "@jonloucks/contracts-ts/api/BindStrategy";
|
|
4
4
|
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
|
|
5
|
-
import { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
|
|
6
5
|
import { PromisorType } from "@jonloucks/contracts-ts/api/Promisor";
|
|
6
|
+
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
7
7
|
/**
|
|
8
8
|
* A repository for multiple contract promisors
|
|
9
9
|
* This is an opt-in feature to simplify the managing of many contract bindings.
|
|
10
10
|
* 1. Optional feature to register required contracts.
|
|
11
11
|
* 2. Optional feature to manage multiple contract bindings.
|
|
12
12
|
*/
|
|
13
|
-
export interface Repository extends
|
|
13
|
+
export interface Repository extends Open {
|
|
14
14
|
/**
|
|
15
15
|
* Store the binding.
|
|
16
16
|
* Note: Replacing a Contract already promised in this Repository is forbidden after the Repository is opened.
|
|
@@ -54,10 +54,5 @@ export interface Repository extends AutoOpen {
|
|
|
54
54
|
* @param value the value to check
|
|
55
55
|
* @return true if value is Repository, false otherwise
|
|
56
56
|
*/
|
|
57
|
-
export declare function guard(value: unknown): value is Repository
|
|
58
|
-
/**
|
|
59
|
-
* For creating a Contract for Repository with duck-typing checks.
|
|
60
|
-
* @deprecated use createContract with guard instead
|
|
61
|
-
*/
|
|
62
|
-
export declare const LAWYER: Lawyer<Repository>;
|
|
57
|
+
export declare function guard(value: unknown): value is RequiredType<Repository>;
|
|
63
58
|
//# sourceMappingURL=Repository.d.ts.map
|
package/api/Repository.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.d.ts","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Repository.d.ts","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAsB,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAkB,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI;IAEtC;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IAElG;;;;;;;;;;OAUG;IACH,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAE7F;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACzC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,UAAU,CAAC,CAEvE"}
|
package/api/Repository.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAWYER = void 0;
|
|
4
3
|
exports.guard = guard;
|
|
5
|
-
const
|
|
6
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
4
|
+
const Open_1 = require("@jonloucks/contracts-ts/api/Open");
|
|
7
5
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
8
6
|
/**
|
|
9
7
|
* Type guard for Repository
|
|
@@ -12,27 +10,6 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
12
10
|
* @return true if value is Repository, false otherwise
|
|
13
11
|
*/
|
|
14
12
|
function guard(value) {
|
|
15
|
-
return (0, Types_1.
|
|
13
|
+
return (0, Types_1.guardFunctions)(value, 'store', 'keep', 'check', 'require') && (0, Open_1.guard)(value);
|
|
16
14
|
}
|
|
17
|
-
/**
|
|
18
|
-
* For creating a Contract for Repository with duck-typing checks.
|
|
19
|
-
* @deprecated use createContract with guard instead
|
|
20
|
-
*/
|
|
21
|
-
exports.LAWYER = new class {
|
|
22
|
-
/**
|
|
23
|
-
* Lawyer.isDeliverable override
|
|
24
|
-
*/
|
|
25
|
-
isDeliverable(instance) {
|
|
26
|
-
return guard(instance);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Lawyer.createContract override
|
|
30
|
-
*/
|
|
31
|
-
createContract(config) {
|
|
32
|
-
const copy = { ...config };
|
|
33
|
-
copy.typeName ?? (copy.typeName = "Repository");
|
|
34
|
-
copy.test ?? (copy.test = this.isDeliverable);
|
|
35
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
15
|
//# sourceMappingURL=Repository.js.map
|
package/api/Repository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/api/Repository.ts"],"names":[],"mappings":";;AA8DA,sBAEC;AA/DD,2DAA4E;AAI5E,6DAAiF;AAmDjF;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,IAAA,sBAAc,EAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,IAAA,YAAS,EAAC,KAAK,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
|
|
2
|
-
import { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
|
|
3
2
|
import { Repository } from "@jonloucks/contracts-ts/api/Repository";
|
|
4
3
|
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
5
4
|
/**
|
|
@@ -9,7 +8,7 @@ export interface RepositoryFactory {
|
|
|
9
8
|
/**
|
|
10
9
|
* Create a new Repository instance.
|
|
11
10
|
*/
|
|
12
|
-
|
|
11
|
+
createRepository(): RequiredType<Repository>;
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Type guard for RepositoryFactory
|
|
@@ -17,12 +16,7 @@ export interface RepositoryFactory {
|
|
|
17
16
|
* @param value the value to check
|
|
18
17
|
* @return true if value is RepositoryFactory, false otherwise
|
|
19
18
|
*/
|
|
20
|
-
export declare function guard(value: unknown): value is RepositoryFactory
|
|
21
|
-
/**
|
|
22
|
-
* For creating a Contract for RepositoryFactory with duck-typing checks.
|
|
23
|
-
* @deprecated use createContract with guard instead
|
|
24
|
-
*/
|
|
25
|
-
export declare const LAWYER: Lawyer<RepositoryFactory>;
|
|
19
|
+
export declare function guard(value: unknown): value is RequiredType<RepositoryFactory>;
|
|
26
20
|
/**
|
|
27
21
|
* The factory Contract for creating new Repository instances.
|
|
28
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepositoryFactory.d.ts","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"RepositoryFactory.d.ts","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAEhC;;OAEG;IACH,gBAAgB,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,iBAAiB,CAAC,CAE9E;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAG7D,CAAC"}
|
package/api/RepositoryFactory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONTRACT =
|
|
3
|
+
exports.CONTRACT = void 0;
|
|
4
4
|
exports.guard = guard;
|
|
5
5
|
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
6
6
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
@@ -11,29 +11,8 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
11
11
|
* @return true if value is RepositoryFactory, false otherwise
|
|
12
12
|
*/
|
|
13
13
|
function guard(value) {
|
|
14
|
-
return (0, Types_1.
|
|
14
|
+
return (0, Types_1.guardFunctions)(value, "createRepository");
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* For creating a Contract for RepositoryFactory with duck-typing checks.
|
|
18
|
-
* @deprecated use createContract with guard instead
|
|
19
|
-
*/
|
|
20
|
-
exports.LAWYER = new class {
|
|
21
|
-
/**
|
|
22
|
-
* Lawyer.isDeliverable override
|
|
23
|
-
*/
|
|
24
|
-
isDeliverable(instance) {
|
|
25
|
-
return guard(instance);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Lawyer.createContract override
|
|
29
|
-
*/
|
|
30
|
-
createContract(config) {
|
|
31
|
-
const copy = { ...config ?? {} };
|
|
32
|
-
copy.test ?? (copy.test = this.isDeliverable);
|
|
33
|
-
copy.typeName ?? (copy.typeName = "RepositoryFactory");
|
|
34
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
16
|
/**
|
|
38
17
|
* The factory Contract for creating new Repository instances.
|
|
39
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepositoryFactory.js","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RepositoryFactory.js","sourceRoot":"","sources":["../../src/api/RepositoryFactory.ts"],"names":[],"mappings":";;;AAsBA,sBAEC;AAvBD,mFAAwF;AAExF,6DAAiF;AAajF;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,IAAA,sBAAc,EAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACU,QAAA,QAAQ,GAA8C,IAAA,yBAAc,EAAC;IAChF,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAC"}
|