inferred-types 0.16.1 → 0.18.2

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 (191) hide show
  1. package/.tsbuildinfo +1 -0
  2. package/dist/{types/utility/state/KeyStorage.d.ts → index.d.ts} +9780 -8195
  3. package/dist/index.js +687 -0
  4. package/dist/index.mjs +603 -0
  5. package/on-hold/Builder/index.ts +15 -21
  6. package/on-hold/types/index.ts +15 -20
  7. package/package.json +25 -36
  8. package/pnpm-lock.yaml +1680 -3233
  9. package/src/Mutation/index.ts +16 -18
  10. package/src/index.ts +15 -19
  11. package/src/shared/index.ts +16 -18
  12. package/src/types/Not.ts +3 -1
  13. package/src/types/Transformer.ts +1 -2
  14. package/src/types/Where.ts +36 -0
  15. package/src/types/alphabetic/PascalCase.ts +5 -4
  16. package/src/types/alphabetic/index.ts +16 -20
  17. package/src/types/dictionary/index.ts +16 -18
  18. package/src/types/{fluent.ts → fluent/fluent.ts} +8 -9
  19. package/src/types/fluent/index.ts +35 -0
  20. package/src/types/index.ts +18 -22
  21. package/src/types/kv/index.ts +16 -18
  22. package/src/types/lists/index.ts +16 -18
  23. package/src/types/ruleset-types.ts +1 -1
  24. package/src/types/string-literals/index.ts +16 -18
  25. package/src/types/tuples/index.ts +16 -18
  26. package/src/types/{SameKeys.ts → type-conversion/SameKeys.ts} +0 -0
  27. package/src/types/type-conversion/WrapValue.ts +15 -0
  28. package/src/types/type-conversion/index.ts +18 -18
  29. package/src/utility/api/index.ts +16 -18
  30. package/src/utility/dictionary/index.ts +16 -20
  31. package/src/utility/dictionary/kv/index.ts +16 -18
  32. package/src/utility/index.ts +16 -20
  33. package/src/utility/lists/index.ts +16 -18
  34. package/src/utility/literals/index.ts +16 -18
  35. package/src/utility/map-reduce/index.ts +16 -18
  36. package/src/utility/modelling/index.ts +16 -18
  37. package/src/utility/runtime/conditions/index.ts +16 -18
  38. package/src/utility/runtime/ifTypeOf.ts +1 -5
  39. package/src/utility/runtime/index.ts +16 -20
  40. package/src/utility/state/index.ts +16 -18
  41. package/tests/Where.spec.ts +39 -0
  42. package/tests/data/index.ts +9 -14
  43. package/tests/kv/dict-to-kv-and-back.spec.ts +6 -2
  44. package/tsconfig.json +4 -3
  45. package/dist/cjs/index.js +0 -1
  46. package/dist/es/index.js +0 -1
  47. package/dist/tsconfig.tsbuildinfo +0 -1
  48. package/dist/types/Mutation/MutationFunction.d.ts +0 -16
  49. package/dist/types/Mutation/MutationIdentity.d.ts +0 -30
  50. package/dist/types/Mutation/index.d.ts +0 -2
  51. package/dist/types/errors/InferenceError.d.ts +0 -1
  52. package/dist/types/errors/index.d.ts +0 -1
  53. package/dist/types/index.d.ts +0 -4
  54. package/dist/types/shared/index.d.ts +0 -3
  55. package/dist/types/shared/randomString.d.ts +0 -1
  56. package/dist/types/shared/uuid.d.ts +0 -1
  57. package/dist/types/shared/valueTypes.d.ts +0 -27
  58. package/dist/types/types/Api.d.ts +0 -10
  59. package/dist/types/types/Constructor.d.ts +0 -5
  60. package/dist/types/types/EnumValues.d.ts +0 -14
  61. package/dist/types/types/ExpandRecursively.d.ts +0 -3
  62. package/dist/types/types/First.d.ts +0 -4
  63. package/dist/types/types/FunctionType.d.ts +0 -9
  64. package/dist/types/types/If.d.ts +0 -10
  65. package/dist/types/types/Include.d.ts +0 -16
  66. package/dist/types/types/Includes.d.ts +0 -5
  67. package/dist/types/types/KeyedRecord.d.ts +0 -22
  68. package/dist/types/types/Keys.d.ts +0 -17
  69. package/dist/types/types/Length.d.ts +0 -8
  70. package/dist/types/types/Mutable.d.ts +0 -6
  71. package/dist/types/types/Narrowable.d.ts +0 -5
  72. package/dist/types/types/Not.d.ts +0 -11
  73. package/dist/types/types/Numeric.d.ts +0 -14
  74. package/dist/types/types/Opaque.d.ts +0 -12
  75. package/dist/types/types/Retain.d.ts +0 -16
  76. package/dist/types/types/SameKeys.d.ts +0 -11
  77. package/dist/types/types/Transformer.d.ts +0 -11
  78. package/dist/types/types/TypeGuard.d.ts +0 -7
  79. package/dist/types/types/alphabetic/AllCaps.d.ts +0 -12
  80. package/dist/types/types/alphabetic/CamelCase.d.ts +0 -2
  81. package/dist/types/types/alphabetic/CapFirstAlpha.d.ts +0 -13
  82. package/dist/types/types/alphabetic/CapitalizeWords.d.ts +0 -4
  83. package/dist/types/types/alphabetic/DashToSnake.d.ts +0 -1
  84. package/dist/types/types/alphabetic/DashUppercase.d.ts +0 -14
  85. package/dist/types/types/alphabetic/Dasherize.d.ts +0 -15
  86. package/dist/types/types/alphabetic/HasUppercase.d.ts +0 -13
  87. package/dist/types/types/alphabetic/Intrinsic.d.ts +0 -4
  88. package/dist/types/types/alphabetic/IsCapitalized.d.ts +0 -15
  89. package/dist/types/types/alphabetic/KebabCase.d.ts +0 -12
  90. package/dist/types/types/alphabetic/LowerAllCaps.d.ts +0 -4
  91. package/dist/types/types/alphabetic/PascalCase.d.ts +0 -16
  92. package/dist/types/types/alphabetic/Pluralize.d.ts +0 -36
  93. package/dist/types/types/alphabetic/SnakeCase.d.ts +0 -14
  94. package/dist/types/types/alphabetic/alpha-characters.d.ts +0 -36
  95. package/dist/types/types/alphabetic/index.d.ts +0 -16
  96. package/dist/types/types/append-types.d.ts +0 -9
  97. package/dist/types/types/dictionary/Get.d.ts +0 -7
  98. package/dist/types/types/dictionary/index.d.ts +0 -1
  99. package/dist/types/types/fluent.d.ts +0 -51
  100. package/dist/types/types/index.d.ts +0 -35
  101. package/dist/types/types/kv/DictFromKv.d.ts +0 -6
  102. package/dist/types/types/kv/KeyValue.d.ts +0 -11
  103. package/dist/types/types/kv/KvFrom.d.ts +0 -13
  104. package/dist/types/types/kv/KvTuple.d.ts +0 -14
  105. package/dist/types/types/kv/index.d.ts +0 -4
  106. package/dist/types/types/lists/UniqueForProp.d.ts +0 -14
  107. package/dist/types/types/lists/index.d.ts +0 -1
  108. package/dist/types/types/maybe.d.ts +0 -8
  109. package/dist/types/types/props.d.ts +0 -100
  110. package/dist/types/types/ruleset-types.d.ts +0 -59
  111. package/dist/types/types/runtime.d.ts +0 -33
  112. package/dist/types/types/string-literals/Break.d.ts +0 -12
  113. package/dist/types/types/string-literals/Concat.d.ts +0 -8
  114. package/dist/types/types/string-literals/LeftWhitespace.d.ts +0 -9
  115. package/dist/types/types/string-literals/Replace.d.ts +0 -11
  116. package/dist/types/types/string-literals/RightWhitespace.d.ts +0 -9
  117. package/dist/types/types/string-literals/StringLength.d.ts +0 -10
  118. package/dist/types/types/string-literals/Trim.d.ts +0 -11
  119. package/dist/types/types/string-literals/TrimLeft.d.ts +0 -11
  120. package/dist/types/types/string-literals/TrimRight.d.ts +0 -11
  121. package/dist/types/types/string-literals/form-fields.d.ts +0 -12
  122. package/dist/types/types/string-literals/index.d.ts +0 -10
  123. package/dist/types/types/tuples/DictArray.d.ts +0 -19
  124. package/dist/types/types/tuples/FirstKey.d.ts +0 -8
  125. package/dist/types/types/tuples/FirstKeyValue.d.ts +0 -8
  126. package/dist/types/types/tuples/FirstOfEach.d.ts +0 -11
  127. package/dist/types/types/tuples/FromDictArray.d.ts +0 -10
  128. package/dist/types/types/tuples/SecondOfEach.d.ts +0 -10
  129. package/dist/types/types/tuples/index.d.ts +0 -6
  130. package/dist/types/types/type-conversion/TupleToUnion.d.ts +0 -10
  131. package/dist/types/types/type-conversion/UnionToIntersection.d.ts +0 -5
  132. package/dist/types/types/type-conversion/UnionToTuple.d.ts +0 -9
  133. package/dist/types/types/type-conversion/index.d.ts +0 -3
  134. package/dist/types/types/type-testing.d.ts +0 -13
  135. package/dist/types/utility/api/api.d.ts +0 -2
  136. package/dist/types/utility/api/index.d.ts +0 -1
  137. package/dist/types/utility/createFnWithProps.d.ts +0 -1
  138. package/dist/types/utility/dictionary/arrayToKeyLookup.d.ts +0 -9
  139. package/dist/types/utility/dictionary/dictFilter.d.ts +0 -8
  140. package/dist/types/utility/dictionary/dictionaryTransform.d.ts +0 -9
  141. package/dist/types/utility/dictionary/entries.d.ts +0 -17
  142. package/dist/types/utility/dictionary/index.d.ts +0 -8
  143. package/dist/types/utility/dictionary/kv/dictToKv.d.ts +0 -16
  144. package/dist/types/utility/dictionary/kv/filterDictArray.d.ts +0 -9
  145. package/dist/types/utility/dictionary/kv/index.d.ts +0 -4
  146. package/dist/types/utility/dictionary/kv/kv.d.ts +0 -10
  147. package/dist/types/utility/dictionary/kv/kvToDict.d.ts +0 -15
  148. package/dist/types/utility/dictionary/mapValues.d.ts +0 -13
  149. package/dist/types/utility/dictionary/strArrayToDict.d.ts +0 -6
  150. package/dist/types/utility/dictionary/valuesOfProp.d.ts +0 -1
  151. package/dist/types/utility/index.d.ts +0 -11
  152. package/dist/types/utility/keys.d.ts +0 -5
  153. package/dist/types/utility/lists/groupBy.d.ts +0 -12
  154. package/dist/types/utility/lists/index.d.ts +0 -1
  155. package/dist/types/utility/literals/ExplicitFunction.d.ts +0 -6
  156. package/dist/types/utility/literals/arrayToObject.d.ts +0 -41
  157. package/dist/types/utility/literals/defineType.d.ts +0 -8
  158. package/dist/types/utility/literals/identity.d.ts +0 -6
  159. package/dist/types/utility/literals/index.d.ts +0 -5
  160. package/dist/types/utility/literals/literal.d.ts +0 -41
  161. package/dist/types/utility/map-reduce/filter.d.ts +0 -26
  162. package/dist/types/utility/map-reduce/index.d.ts +0 -1
  163. package/dist/types/utility/modelling/Model.d.ts +0 -22
  164. package/dist/types/utility/modelling/index.d.ts +0 -1
  165. package/dist/types/utility/ruleset.d.ts +0 -18
  166. package/dist/types/utility/runtime/condition.d.ts +0 -3
  167. package/dist/types/utility/runtime/conditions/index.d.ts +0 -12
  168. package/dist/types/utility/runtime/conditions/isArray.d.ts +0 -2
  169. package/dist/types/utility/runtime/conditions/isBoolean.d.ts +0 -5
  170. package/dist/types/utility/runtime/conditions/isFalse.d.ts +0 -4
  171. package/dist/types/utility/runtime/conditions/isFunction.d.ts +0 -15
  172. package/dist/types/utility/runtime/conditions/isLiteral.d.ts +0 -2
  173. package/dist/types/utility/runtime/conditions/isNull.d.ts +0 -1
  174. package/dist/types/utility/runtime/conditions/isNumber.d.ts +0 -1
  175. package/dist/types/utility/runtime/conditions/isObject.d.ts +0 -10
  176. package/dist/types/utility/runtime/conditions/isString.d.ts +0 -2
  177. package/dist/types/utility/runtime/conditions/isSymbol.d.ts +0 -1
  178. package/dist/types/utility/runtime/conditions/isTrue.d.ts +0 -20
  179. package/dist/types/utility/runtime/conditions/isUndefined.d.ts +0 -1
  180. package/dist/types/utility/runtime/ifTypeOf.d.ts +0 -23
  181. package/dist/types/utility/runtime/index.d.ts +0 -5
  182. package/dist/types/utility/runtime/type.d.ts +0 -27
  183. package/dist/types/utility/runtime/withValue.d.ts +0 -19
  184. package/dist/types/utility/state/Configurator.d.ts +0 -36
  185. package/dist/types/utility/state/FluentConfigurator.d.ts +0 -27
  186. package/dist/types/utility/state/index.d.ts +0 -3
  187. package/src/errors/InferenceError.ts +0 -3
  188. package/src/errors/index.ts +0 -37
  189. package/src/types/alphabetic/Intrinsic.ts +0 -6
  190. package/tests/FluentApi-spec.ts +0 -90
  191. package/tests/FluentConfigurator-spec.hold +0 -88
package/dist/index.mjs ADDED
@@ -0,0 +1,603 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/Mutation/MutationFunction.ts
22
+ function createMutationFunction(state) {
23
+ return (mutationIdentity) => {
24
+ return mutationIdentity(state);
25
+ };
26
+ }
27
+
28
+ // src/Mutation/MutationIdentity.ts
29
+ function MutationIdentity() {
30
+ return function(m) {
31
+ return m;
32
+ };
33
+ }
34
+
35
+ // src/shared/randomString.ts
36
+ function randomString() {
37
+ return Math.trunc((1 + Math.random()) * 65536).toString(16).slice(1);
38
+ }
39
+
40
+ // src/shared/uuid.ts
41
+ function uuid() {
42
+ return `${randomString()}${randomString()}-${randomString()}-${randomString()}-${randomString()}-${randomString()}-${randomString()}${randomString()}${randomString()}`;
43
+ }
44
+
45
+ // src/shared/valueTypes.ts
46
+ var valueTypes = {
47
+ string: ["", false],
48
+ boolean: [true, false],
49
+ number: [0, false],
50
+ function: [() => "", false],
51
+ object: [{}, false],
52
+ array: (arr = []) => [arr, false],
53
+ null: [null, false],
54
+ symbol: [Symbol("type"), false],
55
+ undefined: [void 0, false],
56
+ true: [true, true],
57
+ false: [false, true],
58
+ literal: (v) => {
59
+ return [v, true];
60
+ },
61
+ literalArray: (arr) => [arr, true]
62
+ };
63
+
64
+ // src/utility/keys.ts
65
+ function keys(obj, ...without) {
66
+ const v = without.length > 0 ? Object.keys(obj).filter((k) => !without.includes(k)) : Object.keys(obj);
67
+ return v;
68
+ }
69
+
70
+ // src/utility/createFnWithProps.ts
71
+ function createFnWithProps(fn, props) {
72
+ return (() => {
73
+ let combined = fn;
74
+ for (const prop of keys(props)) {
75
+ combined[prop] = props[prop];
76
+ }
77
+ return combined;
78
+ })();
79
+ }
80
+
81
+ // src/utility/ruleset.ts
82
+ function ruleSet(defn) {
83
+ return defn;
84
+ }
85
+
86
+ // src/utility/api/api.ts
87
+ var api = (priv) => (pub) => {
88
+ const surface = () => pub;
89
+ surface.prototype.priv = () => priv;
90
+ return surface;
91
+ };
92
+
93
+ // src/utility/dictionary/arrayToKeyLookup.ts
94
+ function arrayToKeyLookup(...keys2) {
95
+ const obj = {};
96
+ for (const key of keys2) {
97
+ obj[key] = true;
98
+ }
99
+ return obj;
100
+ }
101
+
102
+ // src/utility/dictionary/dictFilter.ts
103
+ import { omit } from "native-dash";
104
+ function dictFilter(obj, cb) {
105
+ const remove = keys(obj).filter((k) => !cb(k, obj));
106
+ return omit(obj, ...keys(obj).filter((k) => !cb(k, obj)));
107
+ }
108
+
109
+ // src/utility/dictionary/dictionaryTransform.ts
110
+ function dictionaryTransform(input, transform) {
111
+ return keys(input).reduce((acc, i) => {
112
+ const key = i;
113
+ return __spreadProps(__spreadValues({}, acc), { [key]: transform(input, key) });
114
+ }, {});
115
+ }
116
+
117
+ // src/utility/dictionary/entries.ts
118
+ function entries(obj) {
119
+ const iterable = {
120
+ *[Symbol.iterator]() {
121
+ for (const k of keys(obj)) {
122
+ yield [k, obj[k]];
123
+ }
124
+ }
125
+ };
126
+ return iterable;
127
+ }
128
+
129
+ // src/utility/dictionary/mapValues.ts
130
+ function mapValues(obj, valueMapper) {
131
+ return Object.fromEntries([...entries(obj)].map(([k, v]) => [k, valueMapper(v)]));
132
+ }
133
+
134
+ // src/utility/dictionary/strArrayToDict.ts
135
+ function strArrayToDict(...strings) {
136
+ return strings.reduce((acc, str) => {
137
+ acc = __spreadProps(__spreadValues({}, acc), { [str]: true });
138
+ return acc;
139
+ }, {});
140
+ }
141
+
142
+ // src/utility/dictionary/valuesOfProp.ts
143
+ function valuesOfProp() {
144
+ }
145
+
146
+ // src/utility/dictionary/kv/dictToKv.ts
147
+ function dictToKv(obj, _makeTuple = false) {
148
+ return keys(obj).map((k) => {
149
+ return { key: k, value: obj[k] };
150
+ });
151
+ }
152
+
153
+ // src/utility/state/Configurator.ts
154
+ import { omit as omit2 } from "native-dash";
155
+ function Configurator() {
156
+ let configuration = () => ({});
157
+ const api2 = () => {
158
+ return {
159
+ set(key, value) {
160
+ const keyValue = { [key]: value };
161
+ const config = configuration();
162
+ const updated = __spreadValues(__spreadValues({}, config), keyValue);
163
+ configuration = () => updated;
164
+ return updated;
165
+ },
166
+ remove(key) {
167
+ const config = configuration();
168
+ const updated = omit2(config, key);
169
+ configuration = () => updated;
170
+ return updated;
171
+ },
172
+ done() {
173
+ return configuration();
174
+ }
175
+ };
176
+ };
177
+ return api2();
178
+ }
179
+
180
+ // src/utility/state/FluentConfigurator.ts
181
+ function FluentConfigurator(initial = {}) {
182
+ const api2 = (current) => {
183
+ return {
184
+ set(key, value) {
185
+ const keyValue = { [key]: value };
186
+ const updated = __spreadValues(__spreadValues({}, keyValue), current);
187
+ return api2(updated);
188
+ },
189
+ done() {
190
+ return current;
191
+ }
192
+ };
193
+ };
194
+ if (initial && typeof initial !== "object") {
195
+ throw new Error("The FluentConfigurator was passed a non-object based value as the initial value. This is not allowed.");
196
+ }
197
+ return initial ? api2(initial) : api2({});
198
+ }
199
+
200
+ // src/utility/state/KeyStorage.ts
201
+ function KeyStorage() {
202
+ const api2 = (state) => ({
203
+ add: (...store) => {
204
+ return api2([...state, ...store]);
205
+ },
206
+ remove: (key) => api2(state.filter((i) => i !== key)),
207
+ done: () => state
208
+ });
209
+ return api2([]);
210
+ }
211
+
212
+ // src/utility/dictionary/kv/filterDictArray.ts
213
+ function filterDictArray(dictArr, cb) {
214
+ const state = Configurator();
215
+ const updated = dictArr.filter((i) => {
216
+ const [k, v] = i;
217
+ const keep = cb(k, v);
218
+ if (!keep) {
219
+ state.set(k, true);
220
+ }
221
+ return keep;
222
+ });
223
+ return updated;
224
+ }
225
+
226
+ // src/utility/dictionary/kv/kv.ts
227
+ function kv(key, value) {
228
+ return { [key]: value };
229
+ }
230
+
231
+ // src/utility/dictionary/kv/kvToDict.ts
232
+ function kvToDict(kvArr) {
233
+ const out = {};
234
+ for (const kv2 of kvArr) {
235
+ out[kv2.key] = kv2.value;
236
+ }
237
+ return out;
238
+ }
239
+
240
+ // src/utility/lists/groupBy.ts
241
+ function groupBy(_data) {
242
+ throw new Error("not implemented");
243
+ return (_groupBy) => {
244
+ };
245
+ }
246
+
247
+ // src/utility/literals/ExplicitFunction.ts
248
+ function ExplicitFunction(fn) {
249
+ return fn;
250
+ }
251
+
252
+ // src/utility/literals/arrayToObject.ts
253
+ function arrayToObject(prop, unique) {
254
+ const transform = (arr) => {
255
+ const result = unique !== false ? arr.reduce((acc, v) => __spreadProps(__spreadValues({}, acc), { [v[prop]]: v }), {}) : arr.reduce((acc, v) => {
256
+ const existing = acc[v[prop]] || [];
257
+ return __spreadProps(__spreadValues({}, acc), { [v[prop]]: [...existing, v] });
258
+ }, {});
259
+ return result;
260
+ };
261
+ return transform;
262
+ }
263
+
264
+ // src/utility/literals/defineType.ts
265
+ function defineType(literal2 = {}) {
266
+ return (wide = {}) => {
267
+ return literal2 ? __spreadValues(__spreadValues({}, wide), literal2) : wide;
268
+ };
269
+ }
270
+
271
+ // src/utility/literals/identity.ts
272
+ var identity = (v) => v;
273
+
274
+ // src/utility/literals/literal.ts
275
+ function idLiteral(o) {
276
+ return __spreadProps(__spreadValues({}, o), { id: o.id });
277
+ }
278
+ function nameLiteral(o) {
279
+ return o;
280
+ }
281
+ function kindLiteral(o) {
282
+ return o;
283
+ }
284
+ function idTypeGuard(_o) {
285
+ return true;
286
+ }
287
+ function literal(obj) {
288
+ return obj;
289
+ }
290
+
291
+ // src/utility/map-reduce/filter.ts
292
+ var equals = (field, val) => ({
293
+ kind: "Equals",
294
+ field,
295
+ val
296
+ });
297
+ var greater = (field, val) => ({
298
+ kind: "Greater",
299
+ field,
300
+ val
301
+ });
302
+ var less = (field, val) => ({
303
+ kind: "Less",
304
+ field,
305
+ val
306
+ });
307
+ var and = (a, b) => ({
308
+ kind: "And",
309
+ a,
310
+ b
311
+ });
312
+ var or = (a, b) => ({
313
+ kind: "Or",
314
+ a,
315
+ b
316
+ });
317
+
318
+ // src/utility/modelling/Model.ts
319
+ function Model(name) {
320
+ return {
321
+ required(_prop) {
322
+ return Model(name);
323
+ },
324
+ optional(_prop) {
325
+ return Model(name);
326
+ },
327
+ done() {
328
+ return {
329
+ __model__: name,
330
+ __kind__: "model"
331
+ };
332
+ }
333
+ };
334
+ }
335
+
336
+ // src/utility/runtime/condition.ts
337
+ var condition = (c, input) => {
338
+ return c(input);
339
+ };
340
+
341
+ // src/utility/runtime/ifTypeOf.ts
342
+ function runtimeExtendsCheck(val, base, narrow = false) {
343
+ if (typeof val !== typeof base) {
344
+ return false;
345
+ }
346
+ switch (typeof val) {
347
+ case "boolean":
348
+ case "string":
349
+ case "number":
350
+ case "symbol":
351
+ case "bigint":
352
+ return narrow ? val === base : true;
353
+ case "undefined":
354
+ return true;
355
+ case "function":
356
+ if (narrow) {
357
+ throw new Error(`Use of narrowlyExtends with a function is not possible!`);
358
+ }
359
+ return true;
360
+ case "object":
361
+ if (val === null && base === null) {
362
+ return true;
363
+ }
364
+ return keys(base).every((i) => runtimeExtendsCheck(val[i], base[i], narrow));
365
+ }
366
+ }
367
+ var ifTypeOf = (val) => ({
368
+ extends: (base) => {
369
+ const valid = runtimeExtendsCheck(val, base, false);
370
+ const trueFalse = valid ? true : false;
371
+ return {
372
+ then: (then) => ({
373
+ else: (elseVal) => {
374
+ return valid ? typeof then === "undefined" ? val : then : elseVal;
375
+ }
376
+ }),
377
+ else: (elseVal) => valid ? val : elseVal
378
+ } && trueFalse;
379
+ },
380
+ narrowlyExtends: (base) => {
381
+ const valid = runtimeExtendsCheck(val, base, true);
382
+ const trueFalse = valid ? true : false;
383
+ return {
384
+ then: (then) => ({
385
+ else: (elseVal) => {
386
+ return valid ? typeof then === "undefined" ? val : then : elseVal;
387
+ }
388
+ }),
389
+ else: (elseVal) => valid ? val : elseVal
390
+ } && trueFalse;
391
+ }
392
+ });
393
+
394
+ // src/utility/runtime/conditions/isArray.ts
395
+ function isArray(i) {
396
+ return Array.isArray(i) === true;
397
+ }
398
+
399
+ // src/utility/runtime/conditions/isBoolean.ts
400
+ function isBoolean(i) {
401
+ return typeof i === "boolean";
402
+ }
403
+
404
+ // src/utility/runtime/conditions/isFalse.ts
405
+ function isFalse(i) {
406
+ return typeof i === "boolean" && !i;
407
+ }
408
+
409
+ // src/utility/runtime/conditions/isFunction.ts
410
+ function isFunction(input) {
411
+ return typeof input === "function";
412
+ }
413
+
414
+ // src/utility/runtime/conditions/isLiteral.ts
415
+ function isLiteral(...allowed) {
416
+ return (i) => {
417
+ return !allowed.every((v) => i !== v);
418
+ };
419
+ }
420
+
421
+ // src/utility/runtime/conditions/isNull.ts
422
+ function isNull(i) {
423
+ return i === null;
424
+ }
425
+
426
+ // src/utility/runtime/conditions/isNumber.ts
427
+ function isNumber(i) {
428
+ return typeof i === "number";
429
+ }
430
+
431
+ // src/utility/runtime/conditions/isObject.ts
432
+ function isObject(i) {
433
+ return typeof i === "object" && i !== null && Array.isArray(i) === false;
434
+ }
435
+
436
+ // src/utility/runtime/conditions/isString.ts
437
+ function isString(i) {
438
+ return typeof i === "string";
439
+ }
440
+
441
+ // src/utility/runtime/conditions/isSymbol.ts
442
+ function isSymbol(i) {
443
+ return typeof i === "symbol";
444
+ }
445
+
446
+ // src/utility/runtime/conditions/isTrue.ts
447
+ function isTrue(i) {
448
+ return typeof i === "boolean" && i;
449
+ }
450
+
451
+ // src/utility/runtime/conditions/isUndefined.ts
452
+ function isUndefined(i) {
453
+ return typeof i === "undefined";
454
+ }
455
+
456
+ // src/utility/runtime/type.ts
457
+ var typeApi = () => ({
458
+ string: {
459
+ name: "string",
460
+ type: "",
461
+ typeGuard: (v) => isString(v),
462
+ is: isString
463
+ },
464
+ boolean: {
465
+ name: "boolean",
466
+ type: true,
467
+ typeGuard: (v) => isBoolean(v),
468
+ is: isBoolean
469
+ },
470
+ number: {
471
+ name: "number",
472
+ type: 1,
473
+ typeGuard: (v) => isNumber(v),
474
+ is: isNumber
475
+ },
476
+ function: {
477
+ name: "function",
478
+ type: Function,
479
+ typeGuard: (v) => isFunction(v),
480
+ is: isFunction
481
+ },
482
+ null: {
483
+ name: "null",
484
+ type: null,
485
+ typeGuard: (v) => isNull(v),
486
+ is: isNull
487
+ },
488
+ symbol: {
489
+ name: "symbol",
490
+ type: Symbol(),
491
+ typeGuard: (v) => isSymbol(v),
492
+ is: isSymbol
493
+ },
494
+ undefined: {
495
+ name: "undefined",
496
+ type: void 0,
497
+ typeGuard: (v) => isUndefined(v),
498
+ is: isUndefined
499
+ },
500
+ true: {
501
+ name: "true",
502
+ type: true,
503
+ typeGuard: (v) => isTrue(v),
504
+ is: isTrue
505
+ },
506
+ false: {
507
+ name: "false",
508
+ type: false,
509
+ typeGuard: (v) => isFalse(v),
510
+ is: isFalse
511
+ },
512
+ object: {
513
+ name: "object",
514
+ type: {},
515
+ typeGuard: (v) => isObject(v),
516
+ is: isObject
517
+ },
518
+ array: {
519
+ name: "array",
520
+ type: {},
521
+ typeGuard: (v) => isArray(v),
522
+ is: isObject
523
+ }
524
+ });
525
+ function isType(t) {
526
+ return typeof t === "object" && ["name", "type", "is"].every((i) => Object.keys(t).includes(i));
527
+ }
528
+ function type(fn) {
529
+ const result = fn(typeApi());
530
+ if (!isType(result)) {
531
+ throw new Error(`When using type(), the callback passed in returned an invalid type! Value returned was: ${result}`);
532
+ }
533
+ return result;
534
+ }
535
+
536
+ // src/utility/runtime/withValue.ts
537
+ function withValue(td) {
538
+ return (obj) => {
539
+ const t = type(td);
540
+ return Object.fromEntries([...entries(obj)].filter(([_key, value]) => {
541
+ return t.typeGuard(value);
542
+ }));
543
+ };
544
+ }
545
+ export {
546
+ Configurator,
547
+ ExplicitFunction,
548
+ FluentConfigurator,
549
+ KeyStorage,
550
+ Model,
551
+ MutationIdentity,
552
+ and,
553
+ api,
554
+ arrayToKeyLookup,
555
+ arrayToObject,
556
+ condition,
557
+ createFnWithProps,
558
+ createMutationFunction,
559
+ defineType,
560
+ dictFilter,
561
+ dictToKv,
562
+ dictionaryTransform,
563
+ entries,
564
+ equals,
565
+ filterDictArray,
566
+ greater,
567
+ groupBy,
568
+ idLiteral,
569
+ idTypeGuard,
570
+ identity,
571
+ ifTypeOf,
572
+ isArray,
573
+ isBoolean,
574
+ isFalse,
575
+ isFunction,
576
+ isLiteral,
577
+ isNull,
578
+ isNumber,
579
+ isObject,
580
+ isString,
581
+ isSymbol,
582
+ isTrue,
583
+ isType,
584
+ isUndefined,
585
+ keys,
586
+ kindLiteral,
587
+ kv,
588
+ kvToDict,
589
+ less,
590
+ literal,
591
+ mapValues,
592
+ nameLiteral,
593
+ or,
594
+ randomString,
595
+ ruleSet,
596
+ strArrayToDict,
597
+ type,
598
+ typeApi,
599
+ uuid,
600
+ valueTypes,
601
+ valuesOfProp,
602
+ withValue
603
+ };
@@ -1,41 +1,35 @@
1
1
  // #autoindex
2
2
 
3
3
  // #region autoindexed files
4
+ // index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
5
+ // hash-code: 3659802676
4
6
 
5
- // index last changed at: 5th May, 2021, 07:16 AM ( GMT-7 )
6
- // export: named; exclusions: index, private.
7
- // files: Builder, BuilderApi, IdentityToMutationApi, MutationToFluentApi.
8
7
 
9
- // local file exports
10
- export * from "./Builder";
11
- export * from "./BuilderApi";
12
- export * from "./IdentityToMutationApi";
13
- export * from "./MutationToFluentApi";
14
8
 
15
- // Note:
16
- // -----
17
- // This file was created by running: "dd devops autoindex"; it assumes you have
18
- // the 'do-devops' pkg installed as a dev dep.
9
+ // #endregion
10
+
11
+ // This file was created by running: "dd autoindex"; it assumes you have
12
+ // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
19
13
  //
20
14
  // By default it assumes that exports are named exports but this can be changed by
21
15
  // adding a modifier to the '// #autoindex' syntax:
22
16
  //
23
17
  // - autoindex:named same as default, exports "named symbols"
24
- // - autoindex:default assumes each file is exporting a default export
25
- // and converts the default export to the name of the
26
- // file
18
+ // - autoindex:default assumes each file is exporting a default export and
19
+ // converts the default export to the name of the file
27
20
  // - autoindex:offset assumes files export "named symbols" but that each
28
21
  // file's symbols should be offset by the file's name
29
- // (useful for files which might symbols which collide
30
- // or where the namespacing helps consumers)
31
22
  //
32
23
  // You may also exclude certain files or directories by adding it to the
33
24
  // autoindex command. As an example:
34
25
  //
35
26
  // - autoindex:named, exclude: foo,bar,baz
36
27
  //
37
- // Also be aware that all of your content outside the defined region in this file
38
- // will be preserved in situations where you need to do something paricularly awesome.
28
+ // Inversely, if you state a file to be an "orphan" then autoindex files
29
+ // below this file will not reference this autoindex file:
30
+ //
31
+ // - autoindex:named, orphan
32
+ //
33
+ // All content outside the "// #region" section in this file will be
34
+ // preserved in situations where you need to do something paricularly awesome.
39
35
  // Keep on being awesome.
40
-
41
- // #endregion
@@ -1,39 +1,34 @@
1
1
  // #autoindex
2
2
  // #region autoindexed files
3
+ // index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
4
+ // hash-code: 3659802676
3
5
 
4
- // index last changed at: 8th Aug, 2021, 10:48 AM ( GMT-7 )
5
- // export: named; exclusions: index, private.
6
- // files: object, prop, scalar.
7
6
 
8
- // local file exports
9
- export * from "./object";
10
- export * from "./prop";
11
- export * from "./scalar";
12
7
 
13
- // Note:
14
- // -----
15
- // This file was created by running: "dd devops autoindex"; it assumes you have
16
- // the 'do-devops' pkg installed as a dev dep.
8
+ // #endregion
9
+
10
+ // This file was created by running: "dd autoindex"; it assumes you have
11
+ // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
17
12
  //
18
13
  // By default it assumes that exports are named exports but this can be changed by
19
14
  // adding a modifier to the '// #autoindex' syntax:
20
15
  //
21
16
  // - autoindex:named same as default, exports "named symbols"
22
- // - autoindex:default assumes each file is exporting a default export
23
- // and converts the default export to the name of the
24
- // file
17
+ // - autoindex:default assumes each file is exporting a default export and
18
+ // converts the default export to the name of the file
25
19
  // - autoindex:offset assumes files export "named symbols" but that each
26
20
  // file's symbols should be offset by the file's name
27
- // (useful for files which might symbols which collide
28
- // or where the namespacing helps consumers)
29
21
  //
30
22
  // You may also exclude certain files or directories by adding it to the
31
23
  // autoindex command. As an example:
32
24
  //
33
25
  // - autoindex:named, exclude: foo,bar,baz
34
26
  //
35
- // Also be aware that all of your content outside the defined region in this file
36
- // will be preserved in situations where you need to do something paricularly awesome.
27
+ // Inversely, if you state a file to be an "orphan" then autoindex files
28
+ // below this file will not reference this autoindex file:
29
+ //
30
+ // - autoindex:named, orphan
31
+ //
32
+ // All content outside the "// #region" section in this file will be
33
+ // preserved in situations where you need to do something paricularly awesome.
37
34
  // Keep on being awesome.
38
-
39
- // #endregion