@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.
Files changed (139) hide show
  1. package/api/AutoClose.d.ts +3 -5
  2. package/api/AutoClose.d.ts.map +1 -1
  3. package/api/AutoClose.js +14 -7
  4. package/api/AutoClose.js.map +1 -1
  5. package/api/AutoCloseFactory.d.ts +2 -11
  6. package/api/AutoCloseFactory.d.ts.map +1 -1
  7. package/api/AutoCloseFactory.js +4 -25
  8. package/api/AutoCloseFactory.js.map +1 -1
  9. package/api/AutoOpen.d.ts +3 -5
  10. package/api/AutoOpen.d.ts.map +1 -1
  11. package/api/AutoOpen.js +1 -2
  12. package/api/AutoOpen.js.map +1 -1
  13. package/api/BasicContract.d.ts +8 -2
  14. package/api/BasicContract.d.ts.map +1 -1
  15. package/api/BasicContract.js +35 -7
  16. package/api/BasicContract.js.map +1 -1
  17. package/api/BindStrategy.d.ts +0 -3
  18. package/api/BindStrategy.d.ts.map +1 -1
  19. package/api/BindStrategy.js +0 -1
  20. package/api/BindStrategy.js.map +1 -1
  21. package/api/Contract.d.ts +15 -13
  22. package/api/Contract.d.ts.map +1 -1
  23. package/api/Contract.js +1 -1
  24. package/api/Contract.js.map +1 -1
  25. package/api/ContractFactory.d.ts +2 -2
  26. package/api/ContractFactory.d.ts.map +1 -1
  27. package/api/ContractFactory.js +1 -1
  28. package/api/ContractFactory.js.map +1 -1
  29. package/api/Contracts.d.ts +4 -4
  30. package/api/Contracts.d.ts.map +1 -1
  31. package/api/Contracts.js +2 -2
  32. package/api/Contracts.js.map +1 -1
  33. package/api/ContractsFactory.d.ts +2 -2
  34. package/api/ContractsFactory.d.ts.map +1 -1
  35. package/api/ContractsFactory.js +1 -1
  36. package/api/ContractsFactory.js.map +1 -1
  37. package/api/Open.d.ts +20 -0
  38. package/api/Open.d.ts.map +1 -0
  39. package/api/Open.js +14 -0
  40. package/api/Open.js.map +1 -0
  41. package/api/Promisor.d.ts +1 -10
  42. package/api/Promisor.d.ts.map +1 -1
  43. package/api/Promisor.js +2 -26
  44. package/api/Promisor.js.map +1 -1
  45. package/api/PromisorFactory.d.ts +3 -9
  46. package/api/PromisorFactory.d.ts.map +1 -1
  47. package/api/PromisorFactory.js +4 -24
  48. package/api/PromisorFactory.js.map +1 -1
  49. package/api/RatifiedContract.d.ts +2 -2
  50. package/api/RatifiedContract.d.ts.map +1 -1
  51. package/api/RatifiedContract.js +1 -4
  52. package/api/RatifiedContract.js.map +1 -1
  53. package/api/Repository.d.ts +4 -9
  54. package/api/Repository.d.ts.map +1 -1
  55. package/api/Repository.js +2 -25
  56. package/api/Repository.js.map +1 -1
  57. package/api/RepositoryFactory.d.ts +2 -8
  58. package/api/RepositoryFactory.d.ts.map +1 -1
  59. package/api/RepositoryFactory.js +2 -23
  60. package/api/RepositoryFactory.js.map +1 -1
  61. package/api/Types.d.ts +29 -61
  62. package/api/Types.d.ts.map +1 -1
  63. package/api/Types.js +49 -102
  64. package/api/Types.js.map +1 -1
  65. package/auxiliary/AtomicBoolean.d.ts +2 -11
  66. package/auxiliary/AtomicBoolean.d.ts.map +1 -1
  67. package/auxiliary/AtomicBoolean.js +1 -25
  68. package/auxiliary/AtomicBoolean.js.map +1 -1
  69. package/auxiliary/AtomicBooleanFactory.d.ts +3 -12
  70. package/auxiliary/AtomicBooleanFactory.d.ts.map +1 -1
  71. package/auxiliary/AtomicBooleanFactory.js +2 -24
  72. package/auxiliary/AtomicBooleanFactory.js.map +1 -1
  73. package/auxiliary/AtomicInteger.d.ts +2 -11
  74. package/auxiliary/AtomicInteger.d.ts.map +1 -1
  75. package/auxiliary/AtomicInteger.js +1 -25
  76. package/auxiliary/AtomicInteger.js.map +1 -1
  77. package/auxiliary/AtomicIntegerFactory.d.ts +3 -12
  78. package/auxiliary/AtomicIntegerFactory.d.ts.map +1 -1
  79. package/auxiliary/AtomicIntegerFactory.js +2 -24
  80. package/auxiliary/AtomicIntegerFactory.js.map +1 -1
  81. package/auxiliary/AtomicReference.d.ts +2 -11
  82. package/auxiliary/AtomicReference.d.ts.map +1 -1
  83. package/auxiliary/AtomicReference.js +1 -25
  84. package/auxiliary/AtomicReference.js.map +1 -1
  85. package/auxiliary/AtomicReferenceFactory.d.ts +2 -11
  86. package/auxiliary/AtomicReferenceFactory.d.ts.map +1 -1
  87. package/auxiliary/AtomicReferenceFactory.js +2 -24
  88. package/auxiliary/AtomicReferenceFactory.js.map +1 -1
  89. package/impl/AtomicBooleanFactory.impl.js +2 -2
  90. package/impl/AtomicBooleanFactory.impl.js.map +1 -1
  91. package/impl/AtomicIntegerFactory.impl.js +2 -2
  92. package/impl/AtomicIntegerFactory.impl.js.map +1 -1
  93. package/impl/AtomicReferenceFactory.impl.js +2 -2
  94. package/impl/AtomicReferenceFactory.impl.js.map +1 -1
  95. package/impl/ContractFactory.impl.js +2 -2
  96. package/impl/ContractFactory.impl.js.map +1 -1
  97. package/impl/Contracts.impl.d.ts.map +1 -1
  98. package/impl/Contracts.impl.js +7 -1
  99. package/impl/Contracts.impl.js.map +1 -1
  100. package/impl/ContractsFactory.impl.js +4 -4
  101. package/impl/ContractsFactory.impl.js.map +1 -1
  102. package/impl/ContractsWrapper.impl.d.ts.map +1 -1
  103. package/impl/ContractsWrapper.impl.js +3 -0
  104. package/impl/ContractsWrapper.impl.js.map +1 -1
  105. package/impl/Events.d.ts +2 -2
  106. package/impl/Events.d.ts.map +1 -1
  107. package/impl/Events.impl.d.ts.map +1 -1
  108. package/impl/Events.impl.js +3 -0
  109. package/impl/Events.impl.js.map +1 -1
  110. package/impl/ExtractorPromisor.impl.d.ts.map +1 -1
  111. package/impl/ExtractorPromisor.impl.js +8 -1
  112. package/impl/ExtractorPromisor.impl.js.map +1 -1
  113. package/impl/LifeCyclePromisor.impl.js +2 -2
  114. package/impl/LifeCyclePromisor.impl.js.map +1 -1
  115. package/impl/PromisorFactory.impl.d.ts.map +1 -1
  116. package/impl/PromisorFactory.impl.js +2 -1
  117. package/impl/PromisorFactory.impl.js.map +1 -1
  118. package/impl/Repository.impl.d.ts.map +1 -1
  119. package/impl/Repository.impl.js +7 -1
  120. package/impl/Repository.impl.js.map +1 -1
  121. package/impl/RepositoryFactory.impl.js +1 -1
  122. package/impl/RepositoryFactory.impl.js.map +1 -1
  123. package/index.d.ts +3 -3
  124. package/index.d.ts.map +1 -1
  125. package/index.js +7 -7
  126. package/index.js.map +1 -1
  127. package/package.json +4 -2
  128. package/version.d.ts +1 -0
  129. package/version.d.ts.map +1 -1
  130. package/version.js +4 -20
  131. package/version.js.map +1 -1
  132. package/api/Lawyer.d.ts +0 -20
  133. package/api/Lawyer.d.ts.map +0 -1
  134. package/api/Lawyer.js +0 -3
  135. package/api/Lawyer.js.map +0 -1
  136. package/auxiliary/ClassCastException.d.ts +0 -8
  137. package/auxiliary/ClassCastException.d.ts.map +0 -1
  138. package/auxiliary/ClassCastException.js +0 -18
  139. 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(I: OptionalType<I>): OptionalType<O>;
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 isFunctionPresent<T extends UnknownFunction>(value: unknown): value is RequiredType<T>;
49
+ export declare function isFunction<T extends UnknownFunction>(value: unknown): value is RequiredType<T>;
42
50
  /**
43
- * Check if given value is a function or null/undefined
51
+ * Check if given value is a function with the given arity
52
+ *
44
53
  * @param value the value to check
45
- * @returns true if value is a function
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 isFunction(value: unknown): value is OptionalType<UnknownFunction>;
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 isObjectPresent(value: unknown): value is RequiredType<object>;
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 and is not null or undefined
62
- * @param value the value to check
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 OptionalType<string>;
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 isNumberPresent(value: unknown): value is RequiredType<number>;
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 isSymbolPresent(value: unknown): value is RequiredType<symbol>;
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 isBooleanPresent(value: unknown): value is RequiredType<boolean>;
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 isBigIntPresent(value: unknown): value is RequiredType<bigint>;
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 isConstructorPresent<T>(value: unknown): value is RequiredType<(new () => T)>;
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 hasFunctions(value: unknown, ...propertyNames: (string | symbol)[]): value is RequiredType<UnknownFunction>;
109
+ export declare function guardFunctions(value: unknown, ...propertyNames: (string | symbol)[]): value is RequiredType<UnknownFunction>;
141
110
  /**
142
- * Check if given value has defined properties
111
+ * Convert a TransformType to a Transform
143
112
  *
144
- * @param value the value to check
145
- * @param propertyNames the property names to check
146
- * @returns true if property is defined
113
+ * @param transform the TransformType to convert
114
+ * @returns the Transform
147
115
  */
148
- export declare function hasFunctionsPresent(value: unknown, ...propertyNames: (string | symbol)[]): value is RequiredType<UnknownFunction>;
116
+ export declare function typeToTransform<I, O>(transform: TransformType<I, O>): RequiredType<Transform<I, O>>;
149
117
  //# sourceMappingURL=Types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/api/Types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;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,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;;;;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,iBAAiB,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,OA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,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.isObjectPresent = isObjectPresent;
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.hasFunctions = hasFunctions;
25
- exports.hasFunctionsPresent = hasFunctionsPresent;
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 isFunctionPresent(value) {
50
- return _typeOfPresent(value, "function");
44
+ function isFunction(value) {
45
+ return isPresent(value) && typeof value === "function";
51
46
  }
52
47
  /**
53
- * Check if given value is a function or null/undefined
48
+ * Check if given value is a function with the given arity
49
+ *
54
50
  * @param value the value to check
55
- * @returns true if value is a function
51
+ * @param arity the arity to check
52
+ * @returns true if value is a function with the given arity
56
53
  */
57
- function isFunction(value) {
58
- return _isTypeOf(value, "function");
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 _isTypeOf(value, "object");
63
+ return isPresent(value) && typeof value === "object";
75
64
  }
76
65
  /**
77
- * Check if given value is a string and is not null or undefined
78
- * @param value the value to check
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 _isTypeOf(value, "string");
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 _isTypeOf(value, "number");
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 _isTypeOf(value, "symbol");
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 _isTypeOf(value, "boolean");
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 _isTypeOf(value, "bigint");
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 isNotPresent(value) || isConstructorPresent(value);
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 hasFunctions(value, ...propertyNames) {
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 !required;
124
+ return false;
202
125
  }
203
126
  const record = value;
204
127
  for (const propertyName of propertyNames) {
205
- if (!isFunctionPresent(record[propertyName])) {
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;;AA8BH,8BAEC;AAQD,oCAEC;AAOD,8CAEC;AAOD,gCAEC;AAOD,0CAEC;AAOD,4BAEC;AAOD,0CAEC;AAOD,4BAEC;AAOD,0CAEC;AAOD,4BAEC;AAOD,0CAEC;AAOD,4BAEC;AAOD,4CAEC;AAOD,8BAEC;AAOD,0CAEC;AAOD,4BAEC;AAOD,oDAEC;AAOD,sCAEC;AAUD,oCAEC;AASD,kDAEC;AAzLD;;;;;GAKG;AACH,SAAgB,SAAS,CAAI,KAAc;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAA4B,KAAc;IACzE,OAAO,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAc;IACvC,OAAO,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;;;GAI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AAgB,eAAe,CAAO,SAA8B;IAClE,MAAM,kBAAkB,GAAG,IAAA,qBAAY,EAAC,SAAS,EAAE,gCAAgC,CAAC,CAAC;IACrF,IAAI,cAAc,CAAO,kBAAkB,CAAC,EAAE,CAAC;QAC7C,OAAO,kBAAkB,CAAC;IAC5B,CAAC;SAAM,IAAI,sBAAsB,CAAO,kBAAkB,CAAC,EAAE,CAAC;QAC5D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,mDAAwB,CAAC,sEAAsE,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC"}
@@ -1,5 +1,4 @@
1
- import { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
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 OptionalType<AtomicBoolean>;
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":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAgB,MAAM,mCAAmC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,aAAa;IA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
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.hasFunctions)(instance, "compareAndSet", "get", "set");
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":";;;AA2CA,sBAEC;AAIiB,gCAAe;AA/CjC,mFAAwF;AACxF,6DAA+E;AAkC/E;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAiB;IACnC,OAAO,IAAA,oBAAY,EAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC;AAMD;;;GAGG;AACU,QAAA,MAAM,GAA0B,IAAI;IAE7C;;OAEG;IACH,aAAa,CAA0B,QAAiB;QACpD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,cAAc,CAA0B,MAA0B;QAC9D,MAAM,IAAI,GAAsB,EAAE,GAAG,MAAM,IAAI,EAAE,EAAE,CAAC;QAEpD,IAAI,CAAC,IAAI,KAAT,IAAI,CAAC,IAAI,GAAK,IAAI,CAAC,aAAa,EAAC;QACjC,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,eAAe,EAAC;QAElC,OAAO,IAAA,yBAAc,EAAI,IAAI,CAAC,CAAC;IACnC,CAAC;CACJ,CAAC"}
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 { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
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
- create(initialValue?: boolean): RequiredType<AtomicBoolean>;
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 OptionalType<AtomicBooleanFactory>;
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,EAA4B,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAEnC;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;CAC7D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAEvF;AAED;GACG;AACH,OAAO,EAAE,KAAK,IAAI,sBAAsB,EAAE,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAoB/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,oBAAoB,CAGlD,CAAC"}
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 = exports.LAWYER = void 0;
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.hasFunctions)(instance, "create");
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":";;;AAwBA,sBAEC;AAIiB,uCAAsB;AA5BxC,mFAAwF;AACxF,6DAA6F;AAe7F;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,QAAiB;IACrC,OAAO,IAAA,oBAAY,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAMD;;;GAGG;AACU,QAAA,MAAM,GAAiC,IAAI;IAEtD;;OAEG;IACH,aAAa,CAAiC,QAAiB;QAC7D,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,cAAc,CAAiC,MAA0B;QACvE,MAAM,IAAI,GAAsB,EAAE,GAAG,MAAM,IAAI,EAAE,EAAE,CAAC;QAEpD,IAAI,CAAC,IAAI,KAAT,IAAI,CAAC,IAAI,GAAK,IAAI,CAAC,aAAa,EAAC;QACjC,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,sBAAsB,EAAC;QAEzC,OAAO,IAAA,yBAAc,EAAI,IAAI,CAAC,CAAC;IACjC,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,QAAQ,GAAmC,IAAA,yBAAc,EAAC;IACrE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAC"}
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 { Lawyer } from "@jonloucks/contracts-ts/api/Lawyer";
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 OptionalType<AtomicInteger>;
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":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAgB,MAAM,mCAAmC,CAAC;AAE/E;;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,eA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