inferred-types 0.17.0 → 0.18.0

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 (164) hide show
  1. package/.tsbuildinfo +1 -0
  2. package/dist/{types/utility/state/KeyStorage.d.ts → index.d.ts} +9767 -8195
  3. package/dist/index.js +659 -0
  4. package/dist/index.mjs +577 -0
  5. package/package.json +12 -21
  6. package/pnpm-lock.yaml +1221 -1240
  7. package/src/types/Transformer.ts +1 -2
  8. package/src/types/alphabetic/PascalCase.ts +5 -4
  9. package/src/types/alphabetic/index.ts +9 -5
  10. package/src/types/{fluent.ts → fluent/fluent.ts} +8 -9
  11. package/src/types/fluent/index.ts +42 -0
  12. package/src/types/index.ts +4 -5
  13. package/src/types/ruleset-types.ts +1 -1
  14. package/src/types/{SameKeys.ts → type-conversion/SameKeys.ts} +0 -0
  15. package/src/types/type-conversion/WrapValue.ts +15 -0
  16. package/src/types/type-conversion/index.ts +11 -4
  17. package/tests/data/index.ts +1 -1
  18. package/tsconfig.json +4 -3
  19. package/dist/cjs/index.js +0 -1
  20. package/dist/es/index.js +0 -1
  21. package/dist/tsconfig.tsbuildinfo +0 -1
  22. package/dist/types/Mutation/MutationFunction.d.ts +0 -16
  23. package/dist/types/Mutation/MutationIdentity.d.ts +0 -30
  24. package/dist/types/Mutation/index.d.ts +0 -2
  25. package/dist/types/errors/InferenceError.d.ts +0 -1
  26. package/dist/types/errors/index.d.ts +0 -1
  27. package/dist/types/index.d.ts +0 -4
  28. package/dist/types/shared/index.d.ts +0 -3
  29. package/dist/types/shared/randomString.d.ts +0 -1
  30. package/dist/types/shared/uuid.d.ts +0 -1
  31. package/dist/types/shared/valueTypes.d.ts +0 -27
  32. package/dist/types/types/Api.d.ts +0 -10
  33. package/dist/types/types/Constructor.d.ts +0 -5
  34. package/dist/types/types/EnumValues.d.ts +0 -14
  35. package/dist/types/types/ExpandRecursively.d.ts +0 -3
  36. package/dist/types/types/First.d.ts +0 -4
  37. package/dist/types/types/FunctionType.d.ts +0 -9
  38. package/dist/types/types/If.d.ts +0 -10
  39. package/dist/types/types/Include.d.ts +0 -16
  40. package/dist/types/types/Includes.d.ts +0 -5
  41. package/dist/types/types/KeyedRecord.d.ts +0 -22
  42. package/dist/types/types/Keys.d.ts +0 -17
  43. package/dist/types/types/Length.d.ts +0 -8
  44. package/dist/types/types/Mutable.d.ts +0 -6
  45. package/dist/types/types/Narrowable.d.ts +0 -5
  46. package/dist/types/types/Not.d.ts +0 -13
  47. package/dist/types/types/Numeric.d.ts +0 -14
  48. package/dist/types/types/Opaque.d.ts +0 -12
  49. package/dist/types/types/Retain.d.ts +0 -16
  50. package/dist/types/types/SameKeys.d.ts +0 -11
  51. package/dist/types/types/Transformer.d.ts +0 -11
  52. package/dist/types/types/TypeGuard.d.ts +0 -7
  53. package/dist/types/types/Where.d.ts +0 -29
  54. package/dist/types/types/alphabetic/AllCaps.d.ts +0 -12
  55. package/dist/types/types/alphabetic/CamelCase.d.ts +0 -2
  56. package/dist/types/types/alphabetic/CapFirstAlpha.d.ts +0 -13
  57. package/dist/types/types/alphabetic/CapitalizeWords.d.ts +0 -4
  58. package/dist/types/types/alphabetic/DashToSnake.d.ts +0 -1
  59. package/dist/types/types/alphabetic/DashUppercase.d.ts +0 -14
  60. package/dist/types/types/alphabetic/Dasherize.d.ts +0 -15
  61. package/dist/types/types/alphabetic/HasUppercase.d.ts +0 -13
  62. package/dist/types/types/alphabetic/Intrinsic.d.ts +0 -4
  63. package/dist/types/types/alphabetic/IsCapitalized.d.ts +0 -15
  64. package/dist/types/types/alphabetic/KebabCase.d.ts +0 -12
  65. package/dist/types/types/alphabetic/LowerAllCaps.d.ts +0 -4
  66. package/dist/types/types/alphabetic/PascalCase.d.ts +0 -16
  67. package/dist/types/types/alphabetic/Pluralize.d.ts +0 -36
  68. package/dist/types/types/alphabetic/SnakeCase.d.ts +0 -14
  69. package/dist/types/types/alphabetic/alpha-characters.d.ts +0 -36
  70. package/dist/types/types/alphabetic/index.d.ts +0 -16
  71. package/dist/types/types/append-types.d.ts +0 -9
  72. package/dist/types/types/dictionary/Get.d.ts +0 -7
  73. package/dist/types/types/dictionary/index.d.ts +0 -1
  74. package/dist/types/types/fluent.d.ts +0 -51
  75. package/dist/types/types/index.d.ts +0 -36
  76. package/dist/types/types/kv/DictFromKv.d.ts +0 -6
  77. package/dist/types/types/kv/KeyValue.d.ts +0 -11
  78. package/dist/types/types/kv/KvFrom.d.ts +0 -13
  79. package/dist/types/types/kv/KvTuple.d.ts +0 -14
  80. package/dist/types/types/kv/index.d.ts +0 -4
  81. package/dist/types/types/lists/UniqueForProp.d.ts +0 -14
  82. package/dist/types/types/lists/index.d.ts +0 -1
  83. package/dist/types/types/maybe.d.ts +0 -8
  84. package/dist/types/types/props.d.ts +0 -100
  85. package/dist/types/types/ruleset-types.d.ts +0 -59
  86. package/dist/types/types/runtime.d.ts +0 -33
  87. package/dist/types/types/string-literals/Break.d.ts +0 -12
  88. package/dist/types/types/string-literals/Concat.d.ts +0 -8
  89. package/dist/types/types/string-literals/LeftWhitespace.d.ts +0 -9
  90. package/dist/types/types/string-literals/Replace.d.ts +0 -11
  91. package/dist/types/types/string-literals/RightWhitespace.d.ts +0 -9
  92. package/dist/types/types/string-literals/StringLength.d.ts +0 -10
  93. package/dist/types/types/string-literals/Trim.d.ts +0 -11
  94. package/dist/types/types/string-literals/TrimLeft.d.ts +0 -11
  95. package/dist/types/types/string-literals/TrimRight.d.ts +0 -11
  96. package/dist/types/types/string-literals/form-fields.d.ts +0 -12
  97. package/dist/types/types/string-literals/index.d.ts +0 -10
  98. package/dist/types/types/tuples/DictArray.d.ts +0 -19
  99. package/dist/types/types/tuples/FirstKey.d.ts +0 -8
  100. package/dist/types/types/tuples/FirstKeyValue.d.ts +0 -8
  101. package/dist/types/types/tuples/FirstOfEach.d.ts +0 -11
  102. package/dist/types/types/tuples/FromDictArray.d.ts +0 -10
  103. package/dist/types/types/tuples/SecondOfEach.d.ts +0 -10
  104. package/dist/types/types/tuples/index.d.ts +0 -6
  105. package/dist/types/types/type-conversion/TupleToUnion.d.ts +0 -10
  106. package/dist/types/types/type-conversion/UnionToIntersection.d.ts +0 -5
  107. package/dist/types/types/type-conversion/UnionToTuple.d.ts +0 -9
  108. package/dist/types/types/type-conversion/index.d.ts +0 -3
  109. package/dist/types/types/type-testing.d.ts +0 -13
  110. package/dist/types/utility/api/api.d.ts +0 -2
  111. package/dist/types/utility/api/index.d.ts +0 -1
  112. package/dist/types/utility/createFnWithProps.d.ts +0 -1
  113. package/dist/types/utility/dictionary/arrayToKeyLookup.d.ts +0 -9
  114. package/dist/types/utility/dictionary/dictFilter.d.ts +0 -8
  115. package/dist/types/utility/dictionary/dictionaryTransform.d.ts +0 -9
  116. package/dist/types/utility/dictionary/entries.d.ts +0 -17
  117. package/dist/types/utility/dictionary/index.d.ts +0 -8
  118. package/dist/types/utility/dictionary/kv/dictToKv.d.ts +0 -16
  119. package/dist/types/utility/dictionary/kv/filterDictArray.d.ts +0 -9
  120. package/dist/types/utility/dictionary/kv/index.d.ts +0 -4
  121. package/dist/types/utility/dictionary/kv/kv.d.ts +0 -10
  122. package/dist/types/utility/dictionary/kv/kvToDict.d.ts +0 -15
  123. package/dist/types/utility/dictionary/mapValues.d.ts +0 -13
  124. package/dist/types/utility/dictionary/strArrayToDict.d.ts +0 -6
  125. package/dist/types/utility/dictionary/valuesOfProp.d.ts +0 -1
  126. package/dist/types/utility/index.d.ts +0 -11
  127. package/dist/types/utility/keys.d.ts +0 -5
  128. package/dist/types/utility/lists/groupBy.d.ts +0 -12
  129. package/dist/types/utility/lists/index.d.ts +0 -1
  130. package/dist/types/utility/literals/ExplicitFunction.d.ts +0 -6
  131. package/dist/types/utility/literals/arrayToObject.d.ts +0 -41
  132. package/dist/types/utility/literals/defineType.d.ts +0 -8
  133. package/dist/types/utility/literals/identity.d.ts +0 -6
  134. package/dist/types/utility/literals/index.d.ts +0 -5
  135. package/dist/types/utility/literals/literal.d.ts +0 -41
  136. package/dist/types/utility/map-reduce/filter.d.ts +0 -26
  137. package/dist/types/utility/map-reduce/index.d.ts +0 -1
  138. package/dist/types/utility/modelling/Model.d.ts +0 -22
  139. package/dist/types/utility/modelling/index.d.ts +0 -1
  140. package/dist/types/utility/ruleset.d.ts +0 -18
  141. package/dist/types/utility/runtime/condition.d.ts +0 -3
  142. package/dist/types/utility/runtime/conditions/index.d.ts +0 -12
  143. package/dist/types/utility/runtime/conditions/isArray.d.ts +0 -2
  144. package/dist/types/utility/runtime/conditions/isBoolean.d.ts +0 -5
  145. package/dist/types/utility/runtime/conditions/isFalse.d.ts +0 -4
  146. package/dist/types/utility/runtime/conditions/isFunction.d.ts +0 -15
  147. package/dist/types/utility/runtime/conditions/isLiteral.d.ts +0 -2
  148. package/dist/types/utility/runtime/conditions/isNull.d.ts +0 -1
  149. package/dist/types/utility/runtime/conditions/isNumber.d.ts +0 -1
  150. package/dist/types/utility/runtime/conditions/isObject.d.ts +0 -10
  151. package/dist/types/utility/runtime/conditions/isString.d.ts +0 -2
  152. package/dist/types/utility/runtime/conditions/isSymbol.d.ts +0 -1
  153. package/dist/types/utility/runtime/conditions/isTrue.d.ts +0 -20
  154. package/dist/types/utility/runtime/conditions/isUndefined.d.ts +0 -1
  155. package/dist/types/utility/runtime/ifTypeOf.d.ts +0 -23
  156. package/dist/types/utility/runtime/index.d.ts +0 -5
  157. package/dist/types/utility/runtime/type.d.ts +0 -27
  158. package/dist/types/utility/runtime/withValue.d.ts +0 -19
  159. package/dist/types/utility/state/Configurator.d.ts +0 -36
  160. package/dist/types/utility/state/FluentConfigurator.d.ts +0 -27
  161. package/dist/types/utility/state/index.d.ts +0 -3
  162. package/src/types/alphabetic/Intrinsic.ts +0 -6
  163. package/tests/FluentApi-spec.ts +0 -90
  164. package/tests/FluentConfigurator-spec.hold +0 -88
@@ -1,4 +1,4 @@
1
- import { SameKeys } from "./SameKeys";
1
+ import { SameKeys } from "./type-conversion/SameKeys";
2
2
 
3
3
  /**
4
4
  * **Transformer**
@@ -13,4 +13,3 @@ export type Transformer<I extends object, O extends SameKeys<I>, K extends keyof
13
13
  input: I,
14
14
  key: K
15
15
  ) => O[K];
16
-
@@ -1,5 +1,5 @@
1
1
  /* eslint @typescript-eslint/no-unused-vars: "off" */
2
- import type { Capitalize, LowerAllCaps, Trim } from "~/types";
2
+ import type { LowerAllCaps, Trim } from "~/types";
3
3
 
4
4
  type Delimiter = "_" | "-" | " ";
5
5
 
@@ -10,7 +10,7 @@ type DashDelim<T extends string> = T extends `${infer Begin}${" "}${infer Rest}`
10
10
  ? DashDelim<`${Begin}-${Rest}`>
11
11
  : T;
12
12
 
13
- /**
13
+ /**
14
14
  * Converts a string literal type to a **PascalCase** representation.
15
15
  * ```ts
16
16
  * // "FooBar"
@@ -20,7 +20,8 @@ type DashDelim<T extends string> = T extends `${infer Begin}${" "}${infer Rest}`
20
20
  * type T = PascalCase<"\n foo_bar \t">;
21
21
  * ```
22
22
  */
23
- export type PascalCase<S extends string> = string extends S ? string :
24
- Trim<DashDelim<LowerAllCaps<S>>> extends `${infer Begin}${Delimiter}${infer Rest}`
23
+ export type PascalCase<S extends string> = string extends S
24
+ ? string
25
+ : Trim<DashDelim<LowerAllCaps<S>>> extends `${infer Begin}${Delimiter}${infer Rest}`
25
26
  ? PascalCase<`${Capitalize<Begin>}${Capitalize<Rest>}`>
26
27
  : Capitalize<Trim<LowerAllCaps<S>>>;
@@ -1,9 +1,9 @@
1
1
  // #autoindex, exclude: Alpha
2
2
  // #region autoindexed files
3
3
 
4
- // index last changed at: 7th Jul, 2021, 01:59 PM ( GMT-7 )
4
+ // index last changed at: 12th Dec, 2021, 12:24 PM ( GMT-8 )
5
5
  // export: named; exclusions: Alpha, index, private.
6
- // files: AllCaps, CamelCase, CapFirstAlpha, CapitalizeWords, DashToSnake, DashUppercase, Dasherize, HasUppercase, Intrinsic, IsCapitalized, KebabCase, LowerAllCaps, PascalCase, Pluralize, SnakeCase, alpha-characters.
6
+ // files: AllCaps, CamelCase, CapFirstAlpha, CapitalizeWords, DashToSnake, DashUppercase, Dasherize, HasUppercase, IsCapitalized, KebabCase, LowerAllCaps, PascalCase, Pluralize, SnakeCase, alpha-characters.
7
7
 
8
8
  // local file exports
9
9
  export * from "./AllCaps";
@@ -14,7 +14,6 @@ export * from "./DashToSnake";
14
14
  export * from "./DashUppercase";
15
15
  export * from "./Dasherize";
16
16
  export * from "./HasUppercase";
17
- export * from "./Intrinsic";
18
17
  export * from "./IsCapitalized";
19
18
  export * from "./KebabCase";
20
19
  export * from "./LowerAllCaps";
@@ -26,7 +25,7 @@ export * from "./alpha-characters";
26
25
  // Note:
27
26
  // -----
28
27
  // This file was created by running: "dd devops autoindex"; it assumes you have
29
- // the 'do-devops' pkg installed as a dev dep.
28
+ // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
30
29
  //
31
30
  // By default it assumes that exports are named exports but this can be changed by
32
31
  // adding a modifier to the '// #autoindex' syntax:
@@ -45,7 +44,12 @@ export * from "./alpha-characters";
45
44
  //
46
45
  // - autoindex:named, exclude: foo,bar,baz
47
46
  //
48
- // Also be aware that all of your content outside the defined region in this file
47
+ // Inversely, if you state a file to be an "orphan" then autoindex files
48
+ // below this file will not reference this autoindex file:
49
+ //
50
+ // - autoindex:named, orphan
51
+ //
52
+ // Also be aware that all of your content outside the "// #region" section in this file
49
53
  // will be preserved in situations where you need to do something paricularly awesome.
50
54
  // Keep on being awesome.
51
55
 
@@ -14,8 +14,7 @@ export type ToFluent<
14
14
  X extends object = {}
15
15
  > = {
16
16
  [K in keyof T]: (...args: Parameters<T[K]>) => ToFluent<T, X> & X;
17
- } &
18
- X;
17
+ } & X;
19
18
 
20
19
  /**
21
20
  * A _pure_ Fluent API which promotes an API surface where _every_ API endpoint must be a function
@@ -53,10 +52,10 @@ export type PureFluentApi<
53
52
  * pass out the interior state which has been configured by the fluent parts of the API
54
53
  * - `TExclude` represents part of the API which -- due to the internal state -- should be hidden
55
54
  */
56
- export type FluentApi<
57
- TFluent extends {
58
- [K in keyof TFluent]: (...args: Parameters<TFluent[K]>) => FluentApi<TFluent, TEscape>;
59
- },
60
- TEscape extends object = {},
61
- TExclude extends string = ""
62
- > = Omit<TFluent & TEscape, TExclude>;
55
+ // export type FluentApi<
56
+ // TFluent extends {
57
+ // [K in keyof TFluent]: (...args: Parameters<TFluent[K]>) => FluentApi<TFluent, TEscape>;
58
+ // },
59
+ // TEscape extends object = {},
60
+ // TExclude extends string = ""
61
+ // > = Omit<TFluent & TEscape, TExclude>;
@@ -0,0 +1,42 @@
1
+ // #autoindex
2
+ // #region autoindexed files
3
+
4
+ // index last changed at: 12th Dec, 2021, 12:28 PM ( GMT-8 )
5
+ // export: named; exclusions: index, private.
6
+ // files: fluent.
7
+
8
+ // local file exports
9
+ export * from "./fluent";
10
+
11
+ // Note:
12
+ // -----
13
+ // This file was created by running: "dd devops autoindex"; it assumes you have
14
+ // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
15
+ //
16
+ // By default it assumes that exports are named exports but this can be changed by
17
+ // adding a modifier to the '// #autoindex' syntax:
18
+ //
19
+ // - autoindex:named same as default, exports "named symbols"
20
+ // - autoindex:default assumes each file is exporting a default export
21
+ // and converts the default export to the name of the
22
+ // file
23
+ // - autoindex:offset assumes files export "named symbols" but that each
24
+ // file's symbols should be offset by the file's name
25
+ // (useful for files which might symbols which collide
26
+ // or where the namespacing helps consumers)
27
+ //
28
+ // You may also exclude certain files or directories by adding it to the
29
+ // autoindex command. As an example:
30
+ //
31
+ // - autoindex:named, exclude: foo,bar,baz
32
+ //
33
+ // Inversely, if you state a file to be an "orphan" then autoindex files
34
+ // below this file will not reference this autoindex file:
35
+ //
36
+ // - autoindex:named, orphan
37
+ //
38
+ // Also be aware that all of your content outside the "// #region" section in this file
39
+ // will be preserved in situations where you need to do something paricularly awesome.
40
+ // Keep on being awesome.
41
+
42
+ // #endregion
@@ -1,10 +1,10 @@
1
1
  // #autoindex
2
2
  // #region autoindexed files
3
3
 
4
- // index last changed at: 10th Oct, 2021, 03:14 PM ( GMT-7 )
4
+ // index last changed at: 10th Oct, 2021, 08:32 PM ( GMT-7 )
5
5
  // export: named; exclusions: index, private.
6
- // files: Api, Constructor, EnumValues, ExpandRecursively, First, FunctionType, If, Include, Includes, KeyedRecord, Keys, Length, Mutable, Narrowable, Not, Numeric, Opaque, Retain, SameKeys, Transformer, TypeGuard, Where, append-types, fluent, maybe, props, ruleset-types, runtime, type-testing.
7
- // directories: alphabetic, dictionary, kv, lists, string-literals, tuples, type-conversion.
6
+ // files: Api, Constructor, EnumValues, ExpandRecursively, First, FunctionType, If, Include, Includes, KeyedRecord, Keys, Length, Mutable, Narrowable, Not, Numeric, Opaque, Retain, Transformer, TypeGuard, Where, append-types, maybe, props, ruleset-types, runtime, type-testing.
7
+ // directories: alphabetic, dictionary, fluent, kv, lists, string-literals, tuples, type-conversion.
8
8
 
9
9
  // local file exports
10
10
  export * from "./Api";
@@ -25,12 +25,10 @@ export * from "./Not";
25
25
  export * from "./Numeric";
26
26
  export * from "./Opaque";
27
27
  export * from "./Retain";
28
- export * from "./SameKeys";
29
28
  export * from "./Transformer";
30
29
  export * from "./TypeGuard";
31
30
  export * from "./Where";
32
31
  export * from "./append-types";
33
- export * from "./fluent";
34
32
  export * from "./maybe";
35
33
  export * from "./props";
36
34
  export * from "./ruleset-types";
@@ -40,6 +38,7 @@ export * from "./type-testing";
40
38
  // directory exports
41
39
  export * from "./alphabetic/index";
42
40
  export * from "./dictionary/index";
41
+ export * from "./fluent/index";
43
42
  export * from "./kv/index";
44
43
  export * from "./lists/index";
45
44
  export * from "./string-literals/index";
@@ -1,6 +1,6 @@
1
1
  import type { TypeCondition } from "~/utility/runtime/ifTypeOf";
2
2
  import { OptionalKeys } from "./props";
3
- import { SameKeys } from "./SameKeys";
3
+ import { SameKeys } from "./type-conversion/SameKeys";
4
4
 
5
5
  /**
6
6
  * **RuleDefinition**
@@ -0,0 +1,15 @@
1
+ type ValueFunction<T extends any> = <R extends any>(v: T) => R;
2
+
3
+ /**
4
+ * **SameKeys**
5
+ *
6
+ * Given a dictionary `T` and a type-strong wrapper function `F`, returns a dictionary with the
7
+ * same keys but
8
+ *
9
+ * Note: meant to be used as part of an _extends_ clause in most cases.
10
+ */
11
+ export type WrapValue<T extends {}, F extends ValueFunction<T>> = {
12
+ [P in keyof T]: ReturnType<F>;
13
+ };
14
+
15
+
@@ -2,19 +2,21 @@
2
2
 
3
3
  // #region autoindexed files
4
4
 
5
- // index last changed at: 8th Aug, 2021, 04:13 PM ( GMT-7 )
5
+ // index last changed at: 10th Oct, 2021, 08:32 PM ( GMT-7 )
6
6
  // export: named; exclusions: index, private.
7
- // files: TupleToUnion, UnionToIntersection, UnionToTuple.
7
+ // files: SameKeys, TupleToUnion, UnionToIntersection, UnionToTuple, WrapValue.
8
8
 
9
9
  // local file exports
10
+ export * from "./SameKeys";
10
11
  export * from "./TupleToUnion";
11
12
  export * from "./UnionToIntersection";
12
13
  export * from "./UnionToTuple";
14
+ export * from "./WrapValue";
13
15
 
14
16
  // Note:
15
17
  // -----
16
18
  // This file was created by running: "dd devops autoindex"; it assumes you have
17
- // the 'do-devops' pkg installed as a dev dep.
19
+ // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
18
20
  //
19
21
  // By default it assumes that exports are named exports but this can be changed by
20
22
  // adding a modifier to the '// #autoindex' syntax:
@@ -33,7 +35,12 @@ export * from "./UnionToTuple";
33
35
  //
34
36
  // - autoindex:named, exclude: foo,bar,baz
35
37
  //
36
- // Also be aware that all of your content outside the defined region in this file
38
+ // Inversely, if you state a file to be an "orphan" then autoindex files
39
+ // below this file will not reference this autoindex file:
40
+ //
41
+ // - autoindex:named, orphan
42
+ //
43
+ // Also be aware that all of your content outside the "// #region" section in this file
37
44
  // will be preserved in situations where you need to do something paricularly awesome.
38
45
  // Keep on being awesome.
39
46
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  // #region autoindexed files
4
4
 
5
- // index last changed at: 10th Oct, 2021, 03:14 PM ( GMT-7 )
5
+ // index last changed at: 12th Dec, 2021, 12:35 PM ( GMT-8 )
6
6
  // export: named; exclusions: index, private.
7
7
 
8
8
 
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "ES2018",
3
+ "module": "ESNEXT",
4
+ "target": "ESNEXT",
5
5
  "moduleResolution": "node",
6
6
 
7
7
  "sourceMap": true,
@@ -16,11 +16,12 @@
16
16
  "noImplicitReturns": true,
17
17
  "allowSyntheticDefaultImports": true,
18
18
 
19
- "lib": ["ES2019"],
19
+ "lib": ["ES2020"],
20
20
 
21
21
  "baseUrl": ".",
22
22
  "declaration": true,
23
23
  "outDir": "dist",
24
+ "tsBuildInfoFile": ".tsbuildinfo",
24
25
 
25
26
  "paths": {
26
27
  "~/*": ["src/*"],
package/dist/cjs/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={exports:{}};const e=()=>{const t=Error.prepareStackTrace;Error.prepareStackTrace=(t,e)=>e;const e=(new Error).stack.slice(1);return Error.prepareStackTrace=t,e};t.exports=e,t.exports.default=e;var r=t.exports;function n(t){return t instanceof Error&&"BrilliantError"===t.kind}function o(t){return t.map((t=>{const e=(t.getFileName()||"[file unknown]").split("/").slice(-2).join("/"),r=t.getFunctionName()||t.getMethodName()||"unknown",n=t.getLineNumber();return`\t- ${e}, ${r}()${n?`, at line ${n}`:""}`})).join("\n")}var s=(t,e)=>(r,n,s)=>{t.message=`[ ${n} ]: ${r} \n\n${o(t.structuredStack)}`,t.classification=n;const i=n.split("/");t.code=i[0],t.subType=i[1],(s?.httpStatusCode||e.configOptions.defaultHttpStatus)&&(t.httpStatus=s?.httpStatusCode||e.configOptions.defaultHttpStatus)},i=(t,e)=>(e,r,n)=>{t.classification=r,n?.httpErrorCode&&(t.httpStatus=n.httpErrorCode),t.message=n?.message?`${n?.message} [ ${r} ]: ${e.message}\n\n${o(t.structuredStack)}`:`${e.message} [ ${r} ]: wrapped error ${e.name}\n\n${o(t.structuredStack)}`},u=(t,e)=>(r,n,s)=>{t.httpStatus=r;const i=s?.classification||`${e.configOptions.defaultType||e.app}/${e.configOptions.defaultSubType} || "unspecified"`;t.classification=i,t.message=`${n} [ ${r}, ${i} ]\n\n${o(t.structuredStack)}`};const[a,c]=((t,e)=>(...o)=>(...a)=>(...c)=>p=>[class extends Error{constructor(...n){var l;super(""),this.kind="BrilliantError",this.constructorType=p?.constructorType||"standard",this.name=t,this.app=e,this.structuredStack=r().slice(1)||[],this.filename=(this.structuredStack[0].getFileName()||"").split("/").slice(-2).join("/"),this.line=this.structuredStack[0].getLineNumber(),this.fn=this.structuredStack[0].getMethodName()||this.structuredStack[0].getFunctionName(),(0,{standard:s(this,l={name:t,app:e,types:o,subTypes:a,httpCodes:c,configOptions:p||{}}),wrapper:i(this),network:u(this,l)}[this.constructorType])(...n)}toJSON(){return{app:this.app,name:this.name,message:this.message,classification:this.classification,httpStatus:this.httpStatus,code:this.code,subType:this.subType,fn:this.fn,line:this.line}}},r=>n(r)&&r.name===t&&r.app===e,n])("InferenceError","inferred-types")()()()();function p(t,...e){return e.length>0?Object.keys(t).filter((t=>!e.includes(t))):Object.keys(t)}var l,f,d;function y(t,...e){const r=e;return Object.fromEntries(Object.entries(t).filter((([t])=>!r.includes(t))))}function m(t){return{*[Symbol.iterator](){for(const e of p(t))yield[e,t[e]]}}}function x(){let t=()=>({});return{set(e,r){const n={[e]:r},o={...t(),...n};return t=()=>o,o},remove(e){const r=y(t(),e);return t=()=>r,r},done:()=>t()}}!function(t){t.null="null",t.string="string",t.number="number",t.bigint="bigint",t.symbol="symbol",t.boolean="boolean",t.function="function",t[void 0]="undefined",t.dictionary="dictionary",t.object="object",t.array="array",t.stringArray="string[]",t.numberArray="number[]",t.booleanArray="boolean[]",t.symbolArray="symbol[]",t.functionArray="function[]",t.undefinedArray="undefined[]",t.nullArray="null[]",t.objectArray="object[]",t.dictionaryArray="dictionary[]"}(l||(l={})),function(t){t[t.regex=0]="regex",t[t.fn=1]="fn",t[t.exceptions=2]="exceptions"}(f||(f={})),function(t){t[t.singular=0]="singular",t[t.plural=1]="plural"}(d||(d={}));function b(t,e,r=!1){if(typeof t!=typeof e)return!1;switch(typeof t){case"boolean":case"string":case"number":case"symbol":case"bigint":return!r||t===e;case"undefined":return!0;case"function":if(r)throw new a("Use of narrowlyExtends with a function is not possible!","ifTypeOf/not-allowed");return!0;case"object":return null===t&&null===e||p(e).every((n=>b(t[n],e[n],r)))}}function h(t){return!0===Array.isArray(t)}function g(t){return"boolean"==typeof t}function k(t){return"boolean"==typeof t&&!t}function v(t){return"function"==typeof t}function S(t){return null===t}function T(t){return"number"==typeof t}function j(t){return"object"==typeof t&&null!==t&&!1===Array.isArray(t)}function w(t){return"string"==typeof t}function E(t){return"symbol"==typeof t}function $(t){return"boolean"==typeof t&&t}function O(t){return void 0===t}const A=()=>({string:{name:"string",type:"",typeGuard:t=>w(t),is:w},boolean:{name:"boolean",type:!0,typeGuard:t=>g(t),is:g},number:{name:"number",type:1,typeGuard:t=>T(t),is:T},function:{name:"function",type:Function,typeGuard:t=>v(t),is:v},null:{name:"null",type:null,typeGuard:t=>S(t),is:S},symbol:{name:"symbol",type:Symbol(),typeGuard:t=>E(t),is:E},undefined:{name:"undefined",type:void 0,typeGuard:t=>O(t),is:O},true:{name:"true",type:!0,typeGuard:t=>$(t),is:$},false:{name:"false",type:!1,typeGuard:t=>k(t),is:k},object:{name:"object",type:{},typeGuard:t=>j(t),is:j},array:{name:"array",type:{},typeGuard:t=>h(t),is:j}});function G(t){return"object"==typeof t&&["name","type","is"].every((e=>Object.keys(t).includes(e)))}function F(t){const e=t(A());if(!G(e))throw new Error(`When using type(), the callback passed in returned an invalid type! Value returned was: ${e}`);return e}exports.Configurator=x,exports.ExplicitFunction=function(t){return t},exports.FluentConfigurator=function(t={}){const e=t=>({set(r,n){const o={...{[r]:n},...t};return e(o)},done:()=>t});if(t&&"object"!=typeof t)throw new Error("The FluentConfigurator was passed a non-object based value as the initial value. This is not allowed.");return e(t||{})},exports.InferenceError=a,exports.KeyStorage=function(){const t=e=>({add:(...r)=>t([...e,...r]),remove:r=>t(e.filter((t=>t!==r))),done:()=>e});return t([])},exports.Model=function t(e){return{required:r=>t(e),optional:r=>t(e),done:()=>({__model__:e,__kind__:"model"})}},exports.MutationIdentity=function(){return function(t){return t}},exports.and=(t,e)=>({kind:"And",a:t,b:e}),exports.api=t=>e=>{const r=()=>e;return r.prototype.priv=()=>t,r},exports.arrayToKeyLookup=function(...t){const e={};for(const r of t)e[r]=!0;return e},exports.arrayToObject=function(t,e){return r=>!1!==e?r.reduce(((e,r)=>({...e,[r[t]]:r})),{}):r.reduce(((e,r)=>{const n=e[r[t]]||[];return{...e,[r[t]]:[...n,r]}}),{})},exports.condition=(t,e)=>t(e),exports.createFnWithProps=function(t,e){return(()=>{let r=t;for(const t of p(e))r[t]=e[t];return r})()},exports.createMutationFunction=function(t){return e=>e(t)},exports.defineType=function(t={}){return(e={})=>t?{...e,...t}:e},exports.dictFilter=function(t,e){return p(t).filter((r=>!e(r,t))),y(t,...p(t).filter((r=>!e(r,t))))},exports.dictToKv=function(t,e=!1){return p(t).map((e=>({key:e,value:t[e]})))},exports.dictionaryTransform=function(t,e){return p(t).reduce(((r,n)=>({...r,[n]:e(t,n)})),{})},exports.entries=m,exports.equals=(t,e)=>({kind:"Equals",field:t,val:e}),exports.filterDictArray=function(t,e){const r=x(),n=t.filter((t=>{const[n,o]=t,s=e(n,o);return s||r.set(n,!0),s}));return n},exports.greater=(t,e)=>({kind:"Greater",field:t,val:e}),exports.groupBy=function(t){throw new Error("not implemented")},exports.idLiteral=function(t){return{...t,id:t.id}},exports.idTypeGuard=function(t){return!0},exports.identity=t=>t,exports.ifTypeOf=t=>({extends:e=>{const r=b(t,e,!1);return{then:e=>({else:n=>r?void 0===e?t:e:n}),else:e=>r?t:e}&&!!r},narrowlyExtends:e=>{const r=b(t,e,!0);return{then:e=>({else:n=>r?void 0===e?t:e:n}),else:e=>r?t:e}&&!!r}}),exports.isArray=h,exports.isBoolean=g,exports.isFalse=k,exports.isFunction=v,exports.isInferenceError=c,exports.isLiteral=function(...t){return e=>!t.every((t=>e!==t))},exports.isNull=S,exports.isNumber=T,exports.isObject=j,exports.isString=w,exports.isSymbol=E,exports.isTrue=$,exports.isType=G,exports.isUndefined=O,exports.keys=p,exports.kindLiteral=function(t){return t},exports.kv=function(t,e){return{[t]:e}},exports.kvToDict=function(t){const e={};for(const r of t)e[r.key]=r.value;return e},exports.less=(t,e)=>({kind:"Less",field:t,val:e}),exports.literal=function(t){return t},exports.mapValues=function(t,e){return Object.fromEntries([...m(t)].map((([t,r])=>[t,e(r)])))},exports.nameLiteral=function(t){return t},exports.or=(t,e)=>({kind:"Or",a:t,b:e}),exports.ruleSet=function(t){return t},exports.strArrayToDict=function(...t){return t.reduce(((t,e)=>t={...t,[e]:!0}),{})},exports.type=F,exports.typeApi=A,exports.valuesOfProp=function(){},exports.withValue=function(t){return e=>{const r=F(t);return Object.fromEntries([...m(e)].filter((([t,e])=>r.typeGuard(e))))}};
package/dist/es/index.js DELETED
@@ -1 +0,0 @@
1
- function t(t){return n=>n(t)}function n(){return function(t){return t}}var e={exports:{}};const r=()=>{const t=Error.prepareStackTrace;Error.prepareStackTrace=(t,n)=>n;const n=(new Error).stack.slice(1);return Error.prepareStackTrace=t,n};e.exports=r,e.exports.default=r;var o=e.exports;function i(t){return t instanceof Error&&"BrilliantError"===t.kind}function u(t){return t.map((t=>{const n=(t.getFileName()||"[file unknown]").split("/").slice(-2).join("/"),e=t.getFunctionName()||t.getMethodName()||"unknown",r=t.getLineNumber();return`\t- ${n}, ${e}()${r?`, at line ${r}`:""}`})).join("\n")}var s=(t,n)=>(e,r,o)=>{t.message=`[ ${r} ]: ${e} \n\n${u(t.structuredStack)}`,t.classification=r;const i=r.split("/");t.code=i[0],t.subType=i[1],(o?.httpStatusCode||n.configOptions.defaultHttpStatus)&&(t.httpStatus=o?.httpStatusCode||n.configOptions.defaultHttpStatus)},c=(t,n)=>(n,e,r)=>{t.classification=e,r?.httpErrorCode&&(t.httpStatus=r.httpErrorCode),t.message=r?.message?`${r?.message} [ ${e} ]: ${n.message}\n\n${u(t.structuredStack)}`:`${n.message} [ ${e} ]: wrapped error ${n.name}\n\n${u(t.structuredStack)}`},a=(t,n)=>(e,r,o)=>{t.httpStatus=e;const i=o?.classification||`${n.configOptions.defaultType||n.app}/${n.configOptions.defaultSubType} || "unspecified"`;t.classification=i,t.message=`${r} [ ${e}, ${i} ]\n\n${u(t.structuredStack)}`};const[f,l]=((t,n)=>(...e)=>(...r)=>(...u)=>f=>[class extends Error{constructor(...i){var l;super(""),this.kind="BrilliantError",this.constructorType=f?.constructorType||"standard",this.name=t,this.app=n,this.structuredStack=o().slice(1)||[],this.filename=(this.structuredStack[0].getFileName()||"").split("/").slice(-2).join("/"),this.line=this.structuredStack[0].getLineNumber(),this.fn=this.structuredStack[0].getMethodName()||this.structuredStack[0].getFunctionName(),(0,{standard:s(this,l={name:t,app:n,types:e,subTypes:r,httpCodes:u,configOptions:f||{}}),wrapper:c(this),network:a(this,l)}[this.constructorType])(...i)}toJSON(){return{app:this.app,name:this.name,message:this.message,classification:this.classification,httpStatus:this.httpStatus,code:this.code,subType:this.subType,fn:this.fn,line:this.line}}},e=>i(e)&&e.name===t&&e.app===n,i])("InferenceError","inferred-types")()()()();function p(t,...n){return n.length>0?Object.keys(t).filter((t=>!n.includes(t))):Object.keys(t)}function d(t,n){return(()=>{let e=t;for(const t of p(n))e[t]=n[t];return e})()}function y(t){return t}const m=t=>n=>{const e=()=>n;return e.prototype.priv=()=>t,e};function b(...t){const n={};for(const e of t)n[e]=!0;return n}var h,g,k;function S(t,...n){const e=n;return Object.fromEntries(Object.entries(t).filter((([t])=>!e.includes(t))))}function v(t,n){return p(t).filter((e=>!n(e,t))),S(t,...p(t).filter((e=>!n(e,t))))}function w(t,n){return p(t).reduce(((e,r)=>({...e,[r]:n(t,r)})),{})}function $(t){return{*[Symbol.iterator](){for(const n of p(t))yield[n,t[n]]}}}function j(t,n){return Object.fromEntries([...$(t)].map((([t,e])=>[t,n(e)])))}function E(...t){return t.reduce(((t,n)=>t={...t,[n]:!0}),{})}function O(){}function T(t,n=!1){return p(t).map((n=>({key:n,value:t[n]})))}function A(){let t=()=>({});return{set(n,e){const r={[n]:e},o={...t(),...r};return t=()=>o,o},remove(n){const e=S(t(),n);return t=()=>e,e},done:()=>t()}}function x(t={}){const n=t=>({set(e,r){const o={...{[e]:r},...t};return n(o)},done:()=>t});if(t&&"object"!=typeof t)throw new Error("The FluentConfigurator was passed a non-object based value as the initial value. This is not allowed.");return n(t||{})}function G(){const t=n=>({add:(...e)=>t([...n,...e]),remove:e=>t(n.filter((t=>t!==e))),done:()=>n});return t([])}function N(t,n){const e=A(),r=t.filter((t=>{const[r,o]=t,i=n(r,o);return i||e.set(r,!0),i}));return r}function _(t,n){return{[t]:n}}function C(t){const n={};for(const e of t)n[e.key]=e.value;return n}function F(t){throw new Error("not implemented")}function L(t){return t}function q(t,n){return e=>!1!==n?e.reduce(((n,e)=>({...n,[e[t]]:e})),{}):e.reduce(((n,e)=>{const r=n[e[t]]||[];return{...n,[e[t]]:[...r,e]}}),{})}function B(t={}){return(n={})=>t?{...n,...t}:n}!function(t){t.null="null",t.string="string",t.number="number",t.bigint="bigint",t.symbol="symbol",t.boolean="boolean",t.function="function",t[void 0]="undefined",t.dictionary="dictionary",t.object="object",t.array="array",t.stringArray="string[]",t.numberArray="number[]",t.booleanArray="boolean[]",t.symbolArray="symbol[]",t.functionArray="function[]",t.undefinedArray="undefined[]",t.nullArray="null[]",t.objectArray="object[]",t.dictionaryArray="dictionary[]"}(h||(h={})),function(t){t[t.regex=0]="regex",t[t.fn=1]="fn",t[t.exceptions=2]="exceptions"}(g||(g={})),function(t){t[t.singular=0]="singular",t[t.plural=1]="plural"}(k||(k={}));const H=t=>t;function M(t){return{...t,id:t.id}}function I(t){return t}function J(t){return t}function U(t){return!0}function V(t){return t}const W=(t,n)=>({kind:"Equals",field:t,val:n}),z=(t,n)=>({kind:"Greater",field:t,val:n}),D=(t,n)=>({kind:"Less",field:t,val:n}),K=(t,n)=>({kind:"And",a:t,b:n}),P=(t,n)=>({kind:"Or",a:t,b:n});function Q(t){return{required:n=>Q(t),optional:n=>Q(t),done:()=>({__model__:t,__kind__:"model"})}}const R=(t,n)=>t(n);function X(t,n,e=!1){if(typeof t!=typeof n)return!1;switch(typeof t){case"boolean":case"string":case"number":case"symbol":case"bigint":return!e||t===n;case"undefined":return!0;case"function":if(e)throw new f("Use of narrowlyExtends with a function is not possible!","ifTypeOf/not-allowed");return!0;case"object":return null===t&&null===n||p(n).every((r=>X(t[r],n[r],e)))}}const Y=t=>({extends:n=>{const e=X(t,n,!1);return{then:n=>({else:r=>e?void 0===n?t:n:r}),else:n=>e?t:n}&&!!e},narrowlyExtends:n=>{const e=X(t,n,!0);return{then:n=>({else:r=>e?void 0===n?t:n:r}),else:n=>e?t:n}&&!!e}});function Z(t){return!0===Array.isArray(t)}function tt(t){return"boolean"==typeof t}function nt(t){return"boolean"==typeof t&&!t}function et(t){return"function"==typeof t}function rt(...t){return n=>!t.every((t=>n!==t))}function ot(t){return null===t}function it(t){return"number"==typeof t}function ut(t){return"object"==typeof t&&null!==t&&!1===Array.isArray(t)}function st(t){return"string"==typeof t}function ct(t){return"symbol"==typeof t}function at(t){return"boolean"==typeof t&&t}function ft(t){return void 0===t}const lt=()=>({string:{name:"string",type:"",typeGuard:t=>st(t),is:st},boolean:{name:"boolean",type:!0,typeGuard:t=>tt(t),is:tt},number:{name:"number",type:1,typeGuard:t=>it(t),is:it},function:{name:"function",type:Function,typeGuard:t=>et(t),is:et},null:{name:"null",type:null,typeGuard:t=>ot(t),is:ot},symbol:{name:"symbol",type:Symbol(),typeGuard:t=>ct(t),is:ct},undefined:{name:"undefined",type:void 0,typeGuard:t=>ft(t),is:ft},true:{name:"true",type:!0,typeGuard:t=>at(t),is:at},false:{name:"false",type:!1,typeGuard:t=>nt(t),is:nt},object:{name:"object",type:{},typeGuard:t=>ut(t),is:ut},array:{name:"array",type:{},typeGuard:t=>Z(t),is:ut}});function pt(t){return"object"==typeof t&&["name","type","is"].every((n=>Object.keys(t).includes(n)))}function dt(t){const n=t(lt());if(!pt(n))throw new Error(`When using type(), the callback passed in returned an invalid type! Value returned was: ${n}`);return n}function yt(t){return n=>{const e=dt(t);return Object.fromEntries([...$(n)].filter((([t,n])=>e.typeGuard(n))))}}export{A as Configurator,L as ExplicitFunction,x as FluentConfigurator,f as InferenceError,G as KeyStorage,Q as Model,n as MutationIdentity,K as and,m as api,b as arrayToKeyLookup,q as arrayToObject,R as condition,d as createFnWithProps,t as createMutationFunction,B as defineType,v as dictFilter,T as dictToKv,w as dictionaryTransform,$ as entries,W as equals,N as filterDictArray,z as greater,F as groupBy,M as idLiteral,U as idTypeGuard,H as identity,Y as ifTypeOf,Z as isArray,tt as isBoolean,nt as isFalse,et as isFunction,l as isInferenceError,rt as isLiteral,ot as isNull,it as isNumber,ut as isObject,st as isString,ct as isSymbol,at as isTrue,pt as isType,ft as isUndefined,p as keys,J as kindLiteral,_ as kv,C as kvToDict,D as less,V as literal,j as mapValues,I as nameLiteral,P as or,y as ruleSet,E as strArrayToDict,dt as type,lt as typeApi,O as valuesOfProp,yt as withValue};