@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
package/api/Types.d.ts
CHANGED
|
@@ -17,8 +17,16 @@ export type UnknownFunction = (...args: unknown[]) => unknown;
|
|
|
17
17
|
* A transformation from type I to type O
|
|
18
18
|
*/
|
|
19
19
|
export interface Transform<I, O> {
|
|
20
|
-
transform(
|
|
20
|
+
transform(input: I): O;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* A function that transforms type I to type O
|
|
24
|
+
*/
|
|
25
|
+
export type TransformFunction<I, O> = (input: I) => O;
|
|
26
|
+
/**
|
|
27
|
+
* A transformation type that can be a Transform or a function from type I to type O
|
|
28
|
+
*/
|
|
29
|
+
export type TransformType<I, O> = Transform<I, O> | TransformFunction<I, O>;
|
|
22
30
|
/**
|
|
23
31
|
* Check iif given value is not null or undefined
|
|
24
32
|
*
|
|
@@ -38,97 +46,58 @@ export declare function isNotPresent(value: unknown): value is null | undefined;
|
|
|
38
46
|
* @param value the value to check
|
|
39
47
|
* @returns true if value is a function and is not null or undefined
|
|
40
48
|
*/
|
|
41
|
-
export declare function
|
|
49
|
+
export declare function isFunction<T extends UnknownFunction>(value: unknown): value is RequiredType<T>;
|
|
42
50
|
/**
|
|
43
|
-
* Check if given value is a function
|
|
51
|
+
* Check if given value is a function with the given arity
|
|
52
|
+
*
|
|
44
53
|
* @param value the value to check
|
|
45
|
-
* @
|
|
54
|
+
* @param arity the arity to check
|
|
55
|
+
* @returns true if value is a function with the given arity
|
|
46
56
|
*/
|
|
47
|
-
export declare function
|
|
57
|
+
export declare function isFunctionWithArity<T extends UnknownFunction>(value: unknown, arity: number): value is RequiredType<T>;
|
|
48
58
|
/**
|
|
49
59
|
* Check if given value is an object and is not null or undefined
|
|
50
60
|
* @param value the value to check
|
|
51
61
|
* @returns true if value is an object and is not null or undefined
|
|
52
62
|
*/
|
|
53
|
-
export declare function
|
|
54
|
-
/**
|
|
55
|
-
* Check if given value is an object or null/undefined
|
|
56
|
-
* @param value the value to check
|
|
57
|
-
* @returns true if value is an object
|
|
58
|
-
*/
|
|
59
|
-
export declare function isObject(value: unknown): value is OptionalType<object>;
|
|
63
|
+
export declare function isObject(value: unknown): value is RequiredType<object>;
|
|
60
64
|
/**
|
|
61
|
-
* Check if given value is a string
|
|
62
|
-
*
|
|
63
|
-
* @returns true if value is a string and is not null or undefined
|
|
64
|
-
*/
|
|
65
|
-
export declare function isStringPresent(value: unknown): value is RequiredType<string>;
|
|
66
|
-
/**
|
|
67
|
-
* Check if given value is a string or null/undefined
|
|
65
|
+
* Check if given value is a string
|
|
66
|
+
*
|
|
68
67
|
* @param value the value to check
|
|
69
68
|
* @returns true if value is a string
|
|
70
69
|
*/
|
|
71
|
-
export declare function isString(value: unknown): value is
|
|
70
|
+
export declare function isString(value: unknown): value is RequiredType<string>;
|
|
72
71
|
/**
|
|
73
72
|
* Check if given value is a number and is not null or undefined
|
|
74
73
|
* @param value the value to check
|
|
75
74
|
* @returns true if value is a number and is not null or undefined
|
|
76
75
|
*/
|
|
77
|
-
export declare function
|
|
78
|
-
/**
|
|
79
|
-
* Check if given value is a number or null/undefined
|
|
80
|
-
* @param value the value to check
|
|
81
|
-
* @returns true if value is a number
|
|
82
|
-
*/
|
|
83
|
-
export declare function isNumber(value: unknown): value is OptionalType<number>;
|
|
76
|
+
export declare function isNumber(value: unknown): value is RequiredType<number>;
|
|
84
77
|
/**
|
|
85
78
|
* Check if given value is a symbol and is not null or undefined
|
|
86
79
|
* @param value the value to check
|
|
87
80
|
* @returns true if value is a symbol and is not null or undefined
|
|
88
81
|
*/
|
|
89
|
-
export declare function
|
|
90
|
-
/**
|
|
91
|
-
* Check if given value is a symbol or null/undefined
|
|
92
|
-
* @param value the value to check
|
|
93
|
-
* @returns true if value is a symbol
|
|
94
|
-
*/
|
|
95
|
-
export declare function isSymbol(value: unknown): value is OptionalType<symbol>;
|
|
82
|
+
export declare function isSymbol(value: unknown): value is RequiredType<symbol>;
|
|
96
83
|
/**
|
|
97
84
|
* Check if given value is a boolean and is not null or undefined
|
|
98
85
|
* @param value the value to check
|
|
99
86
|
* @returns true if value is a boolean and is not null or undefined
|
|
100
87
|
*/
|
|
101
|
-
export declare function
|
|
102
|
-
/**
|
|
103
|
-
* Check if given value is a boolean or null/undefined
|
|
104
|
-
* @param value the value to check
|
|
105
|
-
* @returns true if value is a boolean
|
|
106
|
-
*/
|
|
107
|
-
export declare function isBoolean(value: unknown): value is OptionalType<boolean>;
|
|
88
|
+
export declare function isBoolean(value: unknown): value is RequiredType<boolean>;
|
|
108
89
|
/**
|
|
109
90
|
* Check if given value is a bigint and is not null or undefined
|
|
110
91
|
* @param value the value to check
|
|
111
92
|
* @returns true if value is a bigint and is not null or undefined
|
|
112
93
|
*/
|
|
113
|
-
export declare function
|
|
114
|
-
/**
|
|
115
|
-
* Check if given value is a bigint or null/undefined
|
|
116
|
-
* @param value the value to check
|
|
117
|
-
* @returns true if value is a bigint
|
|
118
|
-
*/
|
|
119
|
-
export declare function isBigInt(value: unknown): value is OptionalType<bigint>;
|
|
94
|
+
export declare function isBigInt(value: unknown): value is RequiredType<bigint>;
|
|
120
95
|
/**
|
|
121
96
|
* Check if given value is a constructor and is not null or undefined
|
|
122
97
|
* @param value the value to check
|
|
123
98
|
* @returns true if value is a constructor and is not null or undefined
|
|
124
99
|
*/
|
|
125
|
-
export declare function
|
|
126
|
-
/**
|
|
127
|
-
* Check if given value is a constructor or null/undefined
|
|
128
|
-
* @param value the value to check
|
|
129
|
-
* @returns true if value is a constructor
|
|
130
|
-
*/
|
|
131
|
-
export declare function isConstructor<T>(value: unknown): value is OptionalType<(new () => T)>;
|
|
100
|
+
export declare function isConstructor<T>(value: unknown): value is RequiredType<(new () => T)>;
|
|
132
101
|
/**
|
|
133
102
|
* Check if given value has defined properties
|
|
134
103
|
* Note: if the value is present is required to have all the functions defined
|
|
@@ -137,13 +106,12 @@ export declare function isConstructor<T>(value: unknown): value is OptionalType<
|
|
|
137
106
|
* @param propertyNames the property names to check
|
|
138
107
|
* @returns true if property is defined
|
|
139
108
|
*/
|
|
140
|
-
export declare function
|
|
109
|
+
export declare function guardFunctions(value: unknown, ...propertyNames: (string | symbol)[]): value is RequiredType<UnknownFunction>;
|
|
141
110
|
/**
|
|
142
|
-
*
|
|
111
|
+
* Convert a TransformType to a Transform
|
|
143
112
|
*
|
|
144
|
-
* @param
|
|
145
|
-
* @
|
|
146
|
-
* @returns true if property is defined
|
|
113
|
+
* @param transform the TransformType to convert
|
|
114
|
+
* @returns the Transform
|
|
147
115
|
*/
|
|
148
|
-
export declare function
|
|
116
|
+
export declare function typeToTransform<I, O>(transform: TransformType<I, O>): RequiredType<Transform<I, O>>;
|
|
149
117
|
//# sourceMappingURL=Types.d.ts.map
|
package/api/Types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC;IAC7B,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,CAE9F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,CAEtH;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,OAAO,CAAC,CAExE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAErF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,YAAY,CAAC,eAAe,CAAC,CAW5H;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CASnG"}
|
package/api/Types.js
CHANGED
|
@@ -5,24 +5,19 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isPresent = isPresent;
|
|
7
7
|
exports.isNotPresent = isNotPresent;
|
|
8
|
-
exports.isFunctionPresent = isFunctionPresent;
|
|
9
8
|
exports.isFunction = isFunction;
|
|
10
|
-
exports.
|
|
9
|
+
exports.isFunctionWithArity = isFunctionWithArity;
|
|
11
10
|
exports.isObject = isObject;
|
|
12
|
-
exports.isStringPresent = isStringPresent;
|
|
13
11
|
exports.isString = isString;
|
|
14
|
-
exports.isNumberPresent = isNumberPresent;
|
|
15
12
|
exports.isNumber = isNumber;
|
|
16
|
-
exports.isSymbolPresent = isSymbolPresent;
|
|
17
13
|
exports.isSymbol = isSymbol;
|
|
18
|
-
exports.isBooleanPresent = isBooleanPresent;
|
|
19
14
|
exports.isBoolean = isBoolean;
|
|
20
|
-
exports.isBigIntPresent = isBigIntPresent;
|
|
21
15
|
exports.isBigInt = isBigInt;
|
|
22
|
-
exports.isConstructorPresent = isConstructorPresent;
|
|
23
16
|
exports.isConstructor = isConstructor;
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
17
|
+
exports.guardFunctions = guardFunctions;
|
|
18
|
+
exports.typeToTransform = typeToTransform;
|
|
19
|
+
const Checks_1 = require("@jonloucks/contracts-ts/auxiliary/Checks");
|
|
20
|
+
const IllegalArgumentException_1 = require("@jonloucks/contracts-ts/auxiliary/IllegalArgumentException");
|
|
26
21
|
/**
|
|
27
22
|
* Check iif given value is not null or undefined
|
|
28
23
|
*
|
|
@@ -46,128 +41,75 @@ function isNotPresent(value) {
|
|
|
46
41
|
* @param value the value to check
|
|
47
42
|
* @returns true if value is a function and is not null or undefined
|
|
48
43
|
*/
|
|
49
|
-
function
|
|
50
|
-
return
|
|
44
|
+
function isFunction(value) {
|
|
45
|
+
return isPresent(value) && typeof value === "function";
|
|
51
46
|
}
|
|
52
47
|
/**
|
|
53
|
-
* Check if given value is a function
|
|
48
|
+
* Check if given value is a function with the given arity
|
|
49
|
+
*
|
|
54
50
|
* @param value the value to check
|
|
55
|
-
* @
|
|
51
|
+
* @param arity the arity to check
|
|
52
|
+
* @returns true if value is a function with the given arity
|
|
56
53
|
*/
|
|
57
|
-
function
|
|
58
|
-
return
|
|
54
|
+
function isFunctionWithArity(value, arity) {
|
|
55
|
+
return isFunction(value) && value.length === arity;
|
|
59
56
|
}
|
|
60
57
|
/**
|
|
61
58
|
* Check if given value is an object and is not null or undefined
|
|
62
59
|
* @param value the value to check
|
|
63
60
|
* @returns true if value is an object and is not null or undefined
|
|
64
61
|
*/
|
|
65
|
-
function isObjectPresent(value) {
|
|
66
|
-
return _typeOfPresent(value, "object");
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if given value is an object or null/undefined
|
|
70
|
-
* @param value the value to check
|
|
71
|
-
* @returns true if value is an object
|
|
72
|
-
*/
|
|
73
62
|
function isObject(value) {
|
|
74
|
-
return
|
|
63
|
+
return isPresent(value) && typeof value === "object";
|
|
75
64
|
}
|
|
76
65
|
/**
|
|
77
|
-
* Check if given value is a string
|
|
78
|
-
*
|
|
79
|
-
* @returns true if value is a string and is not null or undefined
|
|
80
|
-
*/
|
|
81
|
-
function isStringPresent(value) {
|
|
82
|
-
return _typeOfPresent(value, "string");
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if given value is a string or null/undefined
|
|
66
|
+
* Check if given value is a string
|
|
67
|
+
*
|
|
86
68
|
* @param value the value to check
|
|
87
69
|
* @returns true if value is a string
|
|
88
70
|
*/
|
|
89
71
|
function isString(value) {
|
|
90
|
-
return
|
|
72
|
+
return isPresent(value) && typeof value === "string";
|
|
91
73
|
}
|
|
92
74
|
/**
|
|
93
75
|
* Check if given value is a number and is not null or undefined
|
|
94
76
|
* @param value the value to check
|
|
95
77
|
* @returns true if value is a number and is not null or undefined
|
|
96
78
|
*/
|
|
97
|
-
function isNumberPresent(value) {
|
|
98
|
-
return _typeOfPresent(value, "number");
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Check if given value is a number or null/undefined
|
|
102
|
-
* @param value the value to check
|
|
103
|
-
* @returns true if value is a number
|
|
104
|
-
*/
|
|
105
79
|
function isNumber(value) {
|
|
106
|
-
return
|
|
80
|
+
return isPresent(value) && typeof value === "number";
|
|
107
81
|
}
|
|
108
82
|
/**
|
|
109
83
|
* Check if given value is a symbol and is not null or undefined
|
|
110
84
|
* @param value the value to check
|
|
111
85
|
* @returns true if value is a symbol and is not null or undefined
|
|
112
86
|
*/
|
|
113
|
-
function isSymbolPresent(value) {
|
|
114
|
-
return _typeOfPresent(value, "symbol");
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if given value is a symbol or null/undefined
|
|
118
|
-
* @param value the value to check
|
|
119
|
-
* @returns true if value is a symbol
|
|
120
|
-
*/
|
|
121
87
|
function isSymbol(value) {
|
|
122
|
-
return
|
|
88
|
+
return isPresent(value) && typeof value === "symbol";
|
|
123
89
|
}
|
|
124
90
|
/**
|
|
125
91
|
* Check if given value is a boolean and is not null or undefined
|
|
126
92
|
* @param value the value to check
|
|
127
93
|
* @returns true if value is a boolean and is not null or undefined
|
|
128
94
|
*/
|
|
129
|
-
function isBooleanPresent(value) {
|
|
130
|
-
return _typeOfPresent(value, "boolean");
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Check if given value is a boolean or null/undefined
|
|
134
|
-
* @param value the value to check
|
|
135
|
-
* @returns true if value is a boolean
|
|
136
|
-
*/
|
|
137
95
|
function isBoolean(value) {
|
|
138
|
-
return
|
|
96
|
+
return isPresent(value) && typeof value === "boolean";
|
|
139
97
|
}
|
|
140
98
|
/**
|
|
141
99
|
* Check if given value is a bigint and is not null or undefined
|
|
142
100
|
* @param value the value to check
|
|
143
101
|
* @returns true if value is a bigint and is not null or undefined
|
|
144
102
|
*/
|
|
145
|
-
function isBigIntPresent(value) {
|
|
146
|
-
return _typeOfPresent(value, "bigint");
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Check if given value is a bigint or null/undefined
|
|
150
|
-
* @param value the value to check
|
|
151
|
-
* @returns true if value is a bigint
|
|
152
|
-
*/
|
|
153
103
|
function isBigInt(value) {
|
|
154
|
-
return
|
|
104
|
+
return isPresent(value) && typeof value === "bigint";
|
|
155
105
|
}
|
|
156
106
|
/**
|
|
157
107
|
* Check if given value is a constructor and is not null or undefined
|
|
158
108
|
* @param value the value to check
|
|
159
109
|
* @returns true if value is a constructor and is not null or undefined
|
|
160
110
|
*/
|
|
161
|
-
function isConstructorPresent(value) {
|
|
162
|
-
return isFunctionPresent(value) && 'prototype' in value && 'constructor' in value;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Check if given value is a constructor or null/undefined
|
|
166
|
-
* @param value the value to check
|
|
167
|
-
* @returns true if value is a constructor
|
|
168
|
-
*/
|
|
169
111
|
function isConstructor(value) {
|
|
170
|
-
return
|
|
112
|
+
return isFunction(value) && 'prototype' in value && 'constructor' in value;
|
|
171
113
|
}
|
|
172
114
|
/**
|
|
173
115
|
* Check if given value has defined properties
|
|
@@ -177,35 +119,40 @@ function isConstructor(value) {
|
|
|
177
119
|
* @param propertyNames the property names to check
|
|
178
120
|
* @returns true if property is defined
|
|
179
121
|
*/
|
|
180
|
-
function
|
|
181
|
-
return _hasFunctions(value, propertyNames, false);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Check if given value has defined properties
|
|
185
|
-
*
|
|
186
|
-
* @param value the value to check
|
|
187
|
-
* @param propertyNames the property names to check
|
|
188
|
-
* @returns true if property is defined
|
|
189
|
-
*/
|
|
190
|
-
function hasFunctionsPresent(value, ...propertyNames) {
|
|
191
|
-
return _hasFunctions(value, propertyNames, true);
|
|
192
|
-
}
|
|
193
|
-
function _isTypeOf(value, type) {
|
|
194
|
-
return isNotPresent(value) || _typeOfPresent(value, type);
|
|
195
|
-
}
|
|
196
|
-
function _typeOfPresent(value, type) {
|
|
197
|
-
return isPresent(value) && typeof value === type;
|
|
198
|
-
}
|
|
199
|
-
function _hasFunctions(value, propertyNames, required) {
|
|
122
|
+
function guardFunctions(value, ...propertyNames) {
|
|
200
123
|
if (isNotPresent(value)) {
|
|
201
|
-
return
|
|
124
|
+
return false;
|
|
202
125
|
}
|
|
203
126
|
const record = value;
|
|
204
127
|
for (const propertyName of propertyNames) {
|
|
205
|
-
if (!
|
|
128
|
+
if (!isFunction(record[propertyName])) {
|
|
206
129
|
return false;
|
|
207
130
|
}
|
|
208
131
|
}
|
|
209
132
|
return true;
|
|
210
133
|
}
|
|
134
|
+
function guardTransform(transform) {
|
|
135
|
+
return guardFunctions(transform, 'transform');
|
|
136
|
+
}
|
|
137
|
+
function guardTransformFunction(transform) {
|
|
138
|
+
return isFunctionWithArity(transform, 1);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Convert a TransformType to a Transform
|
|
142
|
+
*
|
|
143
|
+
* @param transform the TransformType to convert
|
|
144
|
+
* @returns the Transform
|
|
145
|
+
*/
|
|
146
|
+
function typeToTransform(transform) {
|
|
147
|
+
const validTransformType = (0, Checks_1.presentCheck)(transform, "TransformType must be present.");
|
|
148
|
+
if (guardTransform(validTransformType)) {
|
|
149
|
+
return validTransformType;
|
|
150
|
+
}
|
|
151
|
+
else if (guardTransformFunction(validTransformType)) {
|
|
152
|
+
return { transform: validTransformType };
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
throw new IllegalArgumentException_1.IllegalArgumentException("TransformType must be a Transform or a function taking one argument.");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
211
158
|
//# sourceMappingURL=Types.js.map
|
package/api/Types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":";AAAA;;GAEG;;
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OptionalType } from "@jonloucks/contracts-ts/api/Types";
|
|
1
|
+
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
3
2
|
/**
|
|
4
3
|
* Responsibility: An atomic boolean interface for thread-safe boolean operations.
|
|
5
4
|
*/
|
|
@@ -33,13 +32,5 @@ export interface AtomicBoolean {
|
|
|
33
32
|
* @param instance the instance to check
|
|
34
33
|
* @returns true if the instance implements AtomicBoolean
|
|
35
34
|
*/
|
|
36
|
-
export declare function guard(instance: unknown): instance is
|
|
37
|
-
/** @deprecated use guard instead
|
|
38
|
-
*/
|
|
39
|
-
export { guard as isAtomicBoolean };
|
|
40
|
-
/**
|
|
41
|
-
* For creating a Contract for AtomicBoolean with duck-typing checks.
|
|
42
|
-
* @deprecated create a contract using typeGuard directly
|
|
43
|
-
*/
|
|
44
|
-
export declare const LAWYER: Lawyer<AtomicBoolean>;
|
|
35
|
+
export declare function guard(instance: unknown): instance is RequiredType<AtomicBoolean>;
|
|
45
36
|
//# sourceMappingURL=AtomicBoolean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBoolean.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicBoolean.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,aAAa;IAE1B;;OAEG;IACH,GAAG,IAAI,OAAO,CAAC;IAEf;;;OAGG;IACH,GAAG,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAE7B;;;;;;OAMG;IACH,aAAa,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;IAElE;;;OAGG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACjE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,aAAa,CAAC,CAEhF"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAWYER = void 0;
|
|
4
3
|
exports.guard = guard;
|
|
5
|
-
exports.isAtomicBoolean = guard;
|
|
6
|
-
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
7
4
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
8
5
|
/**
|
|
9
6
|
* Type guard for AtomicBoolean interface.
|
|
@@ -12,27 +9,6 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
12
9
|
* @returns true if the instance implements AtomicBoolean
|
|
13
10
|
*/
|
|
14
11
|
function guard(instance) {
|
|
15
|
-
return (0, Types_1.
|
|
12
|
+
return (0, Types_1.guardFunctions)(instance, "compareAndSet", "get", "set");
|
|
16
13
|
}
|
|
17
|
-
/**
|
|
18
|
-
* For creating a Contract for AtomicBoolean with duck-typing checks.
|
|
19
|
-
* @deprecated create a contract using typeGuard directly
|
|
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.test ?? (copy.test = this.isDeliverable);
|
|
34
|
-
copy.typeName ?? (copy.typeName = "AtomicBoolean");
|
|
35
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
14
|
//# sourceMappingURL=AtomicBoolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBoolean.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicBoolean.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBoolean.ts"],"names":[],"mappings":";;AAwCA,sBAEC;AA1CD,6DAAiF;AAkCjF;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAiB;IACnC,OAAO,IAAA,sBAAc,EAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
|
|
2
|
-
import {
|
|
3
|
-
import { OptionalType, RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
2
|
+
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
4
3
|
import { AtomicBoolean } from "@jonloucks/contracts-ts/auxiliary/AtomicBoolean";
|
|
5
4
|
/**
|
|
6
5
|
* Factory interface for creating AtomicBoolean instances.
|
|
@@ -10,7 +9,7 @@ export interface AtomicBooleanFactory {
|
|
|
10
9
|
* Create a new AtomicBoolean instance.
|
|
11
10
|
* @param initialValue the initial value of the AtomicBoolean
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
createAtomicBoolean(initialValue?: boolean): RequiredType<AtomicBoolean>;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Type guard for AtomicBooleanFactory interface.
|
|
@@ -18,15 +17,7 @@ export interface AtomicBooleanFactory {
|
|
|
18
17
|
* @param instance the instance to check
|
|
19
18
|
* @returns true if the instance implements AtomicBooleanFactory
|
|
20
19
|
*/
|
|
21
|
-
export declare function guard(instance: unknown): instance is
|
|
22
|
-
/** @deprecated use guard instead
|
|
23
|
-
*/
|
|
24
|
-
export { guard as isAtomicBooleanFactory };
|
|
25
|
-
/**
|
|
26
|
-
* For creating a Contract for AtomicBoolean with duck-typing checks.
|
|
27
|
-
* @deprecated use CONTRACT instead
|
|
28
|
-
*/
|
|
29
|
-
export declare const LAWYER: Lawyer<AtomicBooleanFactory>;
|
|
20
|
+
export declare function guard(instance: unknown): instance is RequiredType<AtomicBooleanFactory>;
|
|
30
21
|
/**
|
|
31
22
|
* The factory Contract for creating new AtomicBoolean instances.
|
|
32
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBooleanFactory.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"AtomicBooleanFactory.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAEnC;;;OAGG;IACH,mBAAmB,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;CAC1E;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAEvF;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,oBAAoB,CAGlD,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
-
exports.isAtomicBooleanFactory = guard;
|
|
6
5
|
const RatifiedContract_1 = require("@jonloucks/contracts-ts/api/RatifiedContract");
|
|
7
6
|
const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
8
7
|
/**
|
|
@@ -12,29 +11,8 @@ const Types_1 = require("@jonloucks/contracts-ts/api/Types");
|
|
|
12
11
|
* @returns true if the instance implements AtomicBooleanFactory
|
|
13
12
|
*/
|
|
14
13
|
function guard(instance) {
|
|
15
|
-
return (0, Types_1.
|
|
14
|
+
return (0, Types_1.guardFunctions)(instance, "createAtomicBoolean");
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
* For creating a Contract for AtomicBoolean with duck-typing checks.
|
|
19
|
-
* @deprecated use CONTRACT 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.test ?? (copy.test = this.isDeliverable);
|
|
34
|
-
copy.typeName ?? (copy.typeName = "AtomicBooleanFactory");
|
|
35
|
-
return (0, RatifiedContract_1.create)(copy);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
16
|
/**
|
|
39
17
|
* The factory Contract for creating new AtomicBoolean instances.
|
|
40
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicBooleanFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AtomicBooleanFactory.js","sourceRoot":"","sources":["../../src/auxiliary/AtomicBooleanFactory.ts"],"names":[],"mappings":";;;AAuBA,sBAEC;AAxBD,mFAAwF;AACxF,6DAAiF;AAejF;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAiB;IACrC,OAAO,IAAA,sBAAc,EAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACU,QAAA,QAAQ,GAAmC,IAAA,yBAAc,EAAC;IACrE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OptionalType } from "@jonloucks/contracts-ts/api/Types";
|
|
1
|
+
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
3
2
|
/**
|
|
4
3
|
* Responsibility: An atomic integer interface for thread-safe integer operations.
|
|
5
4
|
*/
|
|
@@ -42,13 +41,5 @@ export interface AtomicInteger {
|
|
|
42
41
|
* @param instance the instance to check
|
|
43
42
|
* @returns true if the instance implements AtomicInteger
|
|
44
43
|
*/
|
|
45
|
-
export declare function guard(instance: unknown): instance is
|
|
46
|
-
/** @deprecated use guard instead
|
|
47
|
-
*/
|
|
48
|
-
export { guard as isAtomicInteger };
|
|
49
|
-
/**
|
|
50
|
-
* For creating a Contract for AtomicInteger with duck-typing checks.
|
|
51
|
-
* @deprecated create a contract using guard directly
|
|
52
|
-
*/
|
|
53
|
-
export declare const LAWYER: Lawyer<AtomicInteger>;
|
|
44
|
+
export declare function guard(instance: unknown): instance is RequiredType<AtomicInteger>;
|
|
54
45
|
//# sourceMappingURL=AtomicInteger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicInteger.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicInteger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AtomicInteger.d.ts","sourceRoot":"","sources":["../../src/auxiliary/AtomicInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,aAAa;IAE1B;;OAEG;IACH,GAAG,IAAI,MAAM,CAAC;IAEd;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;;;OAKG;IACH,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEhE;;;OAGG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;OAGG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;OAGG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACjE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,aAAa,CAAC,CAEhF"}
|