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.
- package/.tsbuildinfo +1 -0
- package/dist/{types/utility/state/KeyStorage.d.ts → index.d.ts} +9780 -8195
- package/dist/index.js +687 -0
- package/dist/index.mjs +603 -0
- package/on-hold/Builder/index.ts +15 -21
- package/on-hold/types/index.ts +15 -20
- package/package.json +25 -36
- package/pnpm-lock.yaml +1680 -3233
- package/src/Mutation/index.ts +16 -18
- package/src/index.ts +15 -19
- package/src/shared/index.ts +16 -18
- package/src/types/Not.ts +3 -1
- package/src/types/Transformer.ts +1 -2
- package/src/types/Where.ts +36 -0
- package/src/types/alphabetic/PascalCase.ts +5 -4
- package/src/types/alphabetic/index.ts +16 -20
- package/src/types/dictionary/index.ts +16 -18
- package/src/types/{fluent.ts → fluent/fluent.ts} +8 -9
- package/src/types/fluent/index.ts +35 -0
- package/src/types/index.ts +18 -22
- package/src/types/kv/index.ts +16 -18
- package/src/types/lists/index.ts +16 -18
- package/src/types/ruleset-types.ts +1 -1
- package/src/types/string-literals/index.ts +16 -18
- package/src/types/tuples/index.ts +16 -18
- package/src/types/{SameKeys.ts → type-conversion/SameKeys.ts} +0 -0
- package/src/types/type-conversion/WrapValue.ts +15 -0
- package/src/types/type-conversion/index.ts +18 -18
- package/src/utility/api/index.ts +16 -18
- package/src/utility/dictionary/index.ts +16 -20
- package/src/utility/dictionary/kv/index.ts +16 -18
- package/src/utility/index.ts +16 -20
- package/src/utility/lists/index.ts +16 -18
- package/src/utility/literals/index.ts +16 -18
- package/src/utility/map-reduce/index.ts +16 -18
- package/src/utility/modelling/index.ts +16 -18
- package/src/utility/runtime/conditions/index.ts +16 -18
- package/src/utility/runtime/ifTypeOf.ts +1 -5
- package/src/utility/runtime/index.ts +16 -20
- package/src/utility/state/index.ts +16 -18
- package/tests/Where.spec.ts +39 -0
- package/tests/data/index.ts +9 -14
- package/tests/kv/dict-to-kv-and-back.spec.ts +6 -2
- package/tsconfig.json +4 -3
- package/dist/cjs/index.js +0 -1
- package/dist/es/index.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/Mutation/MutationFunction.d.ts +0 -16
- package/dist/types/Mutation/MutationIdentity.d.ts +0 -30
- package/dist/types/Mutation/index.d.ts +0 -2
- package/dist/types/errors/InferenceError.d.ts +0 -1
- package/dist/types/errors/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/shared/index.d.ts +0 -3
- package/dist/types/shared/randomString.d.ts +0 -1
- package/dist/types/shared/uuid.d.ts +0 -1
- package/dist/types/shared/valueTypes.d.ts +0 -27
- package/dist/types/types/Api.d.ts +0 -10
- package/dist/types/types/Constructor.d.ts +0 -5
- package/dist/types/types/EnumValues.d.ts +0 -14
- package/dist/types/types/ExpandRecursively.d.ts +0 -3
- package/dist/types/types/First.d.ts +0 -4
- package/dist/types/types/FunctionType.d.ts +0 -9
- package/dist/types/types/If.d.ts +0 -10
- package/dist/types/types/Include.d.ts +0 -16
- package/dist/types/types/Includes.d.ts +0 -5
- package/dist/types/types/KeyedRecord.d.ts +0 -22
- package/dist/types/types/Keys.d.ts +0 -17
- package/dist/types/types/Length.d.ts +0 -8
- package/dist/types/types/Mutable.d.ts +0 -6
- package/dist/types/types/Narrowable.d.ts +0 -5
- package/dist/types/types/Not.d.ts +0 -11
- package/dist/types/types/Numeric.d.ts +0 -14
- package/dist/types/types/Opaque.d.ts +0 -12
- package/dist/types/types/Retain.d.ts +0 -16
- package/dist/types/types/SameKeys.d.ts +0 -11
- package/dist/types/types/Transformer.d.ts +0 -11
- package/dist/types/types/TypeGuard.d.ts +0 -7
- package/dist/types/types/alphabetic/AllCaps.d.ts +0 -12
- package/dist/types/types/alphabetic/CamelCase.d.ts +0 -2
- package/dist/types/types/alphabetic/CapFirstAlpha.d.ts +0 -13
- package/dist/types/types/alphabetic/CapitalizeWords.d.ts +0 -4
- package/dist/types/types/alphabetic/DashToSnake.d.ts +0 -1
- package/dist/types/types/alphabetic/DashUppercase.d.ts +0 -14
- package/dist/types/types/alphabetic/Dasherize.d.ts +0 -15
- package/dist/types/types/alphabetic/HasUppercase.d.ts +0 -13
- package/dist/types/types/alphabetic/Intrinsic.d.ts +0 -4
- package/dist/types/types/alphabetic/IsCapitalized.d.ts +0 -15
- package/dist/types/types/alphabetic/KebabCase.d.ts +0 -12
- package/dist/types/types/alphabetic/LowerAllCaps.d.ts +0 -4
- package/dist/types/types/alphabetic/PascalCase.d.ts +0 -16
- package/dist/types/types/alphabetic/Pluralize.d.ts +0 -36
- package/dist/types/types/alphabetic/SnakeCase.d.ts +0 -14
- package/dist/types/types/alphabetic/alpha-characters.d.ts +0 -36
- package/dist/types/types/alphabetic/index.d.ts +0 -16
- package/dist/types/types/append-types.d.ts +0 -9
- package/dist/types/types/dictionary/Get.d.ts +0 -7
- package/dist/types/types/dictionary/index.d.ts +0 -1
- package/dist/types/types/fluent.d.ts +0 -51
- package/dist/types/types/index.d.ts +0 -35
- package/dist/types/types/kv/DictFromKv.d.ts +0 -6
- package/dist/types/types/kv/KeyValue.d.ts +0 -11
- package/dist/types/types/kv/KvFrom.d.ts +0 -13
- package/dist/types/types/kv/KvTuple.d.ts +0 -14
- package/dist/types/types/kv/index.d.ts +0 -4
- package/dist/types/types/lists/UniqueForProp.d.ts +0 -14
- package/dist/types/types/lists/index.d.ts +0 -1
- package/dist/types/types/maybe.d.ts +0 -8
- package/dist/types/types/props.d.ts +0 -100
- package/dist/types/types/ruleset-types.d.ts +0 -59
- package/dist/types/types/runtime.d.ts +0 -33
- package/dist/types/types/string-literals/Break.d.ts +0 -12
- package/dist/types/types/string-literals/Concat.d.ts +0 -8
- package/dist/types/types/string-literals/LeftWhitespace.d.ts +0 -9
- package/dist/types/types/string-literals/Replace.d.ts +0 -11
- package/dist/types/types/string-literals/RightWhitespace.d.ts +0 -9
- package/dist/types/types/string-literals/StringLength.d.ts +0 -10
- package/dist/types/types/string-literals/Trim.d.ts +0 -11
- package/dist/types/types/string-literals/TrimLeft.d.ts +0 -11
- package/dist/types/types/string-literals/TrimRight.d.ts +0 -11
- package/dist/types/types/string-literals/form-fields.d.ts +0 -12
- package/dist/types/types/string-literals/index.d.ts +0 -10
- package/dist/types/types/tuples/DictArray.d.ts +0 -19
- package/dist/types/types/tuples/FirstKey.d.ts +0 -8
- package/dist/types/types/tuples/FirstKeyValue.d.ts +0 -8
- package/dist/types/types/tuples/FirstOfEach.d.ts +0 -11
- package/dist/types/types/tuples/FromDictArray.d.ts +0 -10
- package/dist/types/types/tuples/SecondOfEach.d.ts +0 -10
- package/dist/types/types/tuples/index.d.ts +0 -6
- package/dist/types/types/type-conversion/TupleToUnion.d.ts +0 -10
- package/dist/types/types/type-conversion/UnionToIntersection.d.ts +0 -5
- package/dist/types/types/type-conversion/UnionToTuple.d.ts +0 -9
- package/dist/types/types/type-conversion/index.d.ts +0 -3
- package/dist/types/types/type-testing.d.ts +0 -13
- package/dist/types/utility/api/api.d.ts +0 -2
- package/dist/types/utility/api/index.d.ts +0 -1
- package/dist/types/utility/createFnWithProps.d.ts +0 -1
- package/dist/types/utility/dictionary/arrayToKeyLookup.d.ts +0 -9
- package/dist/types/utility/dictionary/dictFilter.d.ts +0 -8
- package/dist/types/utility/dictionary/dictionaryTransform.d.ts +0 -9
- package/dist/types/utility/dictionary/entries.d.ts +0 -17
- package/dist/types/utility/dictionary/index.d.ts +0 -8
- package/dist/types/utility/dictionary/kv/dictToKv.d.ts +0 -16
- package/dist/types/utility/dictionary/kv/filterDictArray.d.ts +0 -9
- package/dist/types/utility/dictionary/kv/index.d.ts +0 -4
- package/dist/types/utility/dictionary/kv/kv.d.ts +0 -10
- package/dist/types/utility/dictionary/kv/kvToDict.d.ts +0 -15
- package/dist/types/utility/dictionary/mapValues.d.ts +0 -13
- package/dist/types/utility/dictionary/strArrayToDict.d.ts +0 -6
- package/dist/types/utility/dictionary/valuesOfProp.d.ts +0 -1
- package/dist/types/utility/index.d.ts +0 -11
- package/dist/types/utility/keys.d.ts +0 -5
- package/dist/types/utility/lists/groupBy.d.ts +0 -12
- package/dist/types/utility/lists/index.d.ts +0 -1
- package/dist/types/utility/literals/ExplicitFunction.d.ts +0 -6
- package/dist/types/utility/literals/arrayToObject.d.ts +0 -41
- package/dist/types/utility/literals/defineType.d.ts +0 -8
- package/dist/types/utility/literals/identity.d.ts +0 -6
- package/dist/types/utility/literals/index.d.ts +0 -5
- package/dist/types/utility/literals/literal.d.ts +0 -41
- package/dist/types/utility/map-reduce/filter.d.ts +0 -26
- package/dist/types/utility/map-reduce/index.d.ts +0 -1
- package/dist/types/utility/modelling/Model.d.ts +0 -22
- package/dist/types/utility/modelling/index.d.ts +0 -1
- package/dist/types/utility/ruleset.d.ts +0 -18
- package/dist/types/utility/runtime/condition.d.ts +0 -3
- package/dist/types/utility/runtime/conditions/index.d.ts +0 -12
- package/dist/types/utility/runtime/conditions/isArray.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isBoolean.d.ts +0 -5
- package/dist/types/utility/runtime/conditions/isFalse.d.ts +0 -4
- package/dist/types/utility/runtime/conditions/isFunction.d.ts +0 -15
- package/dist/types/utility/runtime/conditions/isLiteral.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isNull.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isNumber.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isObject.d.ts +0 -10
- package/dist/types/utility/runtime/conditions/isString.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isSymbol.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isTrue.d.ts +0 -20
- package/dist/types/utility/runtime/conditions/isUndefined.d.ts +0 -1
- package/dist/types/utility/runtime/ifTypeOf.d.ts +0 -23
- package/dist/types/utility/runtime/index.d.ts +0 -5
- package/dist/types/utility/runtime/type.d.ts +0 -27
- package/dist/types/utility/runtime/withValue.d.ts +0 -19
- package/dist/types/utility/state/Configurator.d.ts +0 -36
- package/dist/types/utility/state/FluentConfigurator.d.ts +0 -27
- package/dist/types/utility/state/index.d.ts +0 -3
- package/src/errors/InferenceError.ts +0 -3
- package/src/errors/index.ts +0 -37
- package/src/types/alphabetic/Intrinsic.ts +0 -6
- package/tests/FluentApi-spec.ts +0 -90
- package/tests/FluentConfigurator-spec.hold +0 -88
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
// #autoindex
|
|
2
2
|
// #region autoindexed files
|
|
3
|
+
// index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
|
|
4
|
+
// hash-code: 1933921503
|
|
3
5
|
|
|
4
|
-
//
|
|
5
|
-
// export: named; exclusions: index, private.
|
|
6
|
-
// files: filter.
|
|
7
|
-
|
|
8
|
-
// local file exports
|
|
6
|
+
// file exports
|
|
9
7
|
export * from "./filter";
|
|
10
8
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// This file was created by running: "dd
|
|
14
|
-
// 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.
|
|
15
13
|
//
|
|
16
14
|
// By default it assumes that exports are named exports but this can be changed by
|
|
17
15
|
// adding a modifier to the '// #autoindex' syntax:
|
|
18
16
|
//
|
|
19
17
|
// - autoindex:named same as default, exports "named symbols"
|
|
20
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
21
|
-
//
|
|
22
|
-
// file
|
|
18
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
19
|
+
// converts the default export to the name of the file
|
|
23
20
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
24
21
|
// 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
22
|
//
|
|
28
23
|
// You may also exclude certain files or directories by adding it to the
|
|
29
24
|
// autoindex command. As an example:
|
|
30
25
|
//
|
|
31
26
|
// - autoindex:named, exclude: foo,bar,baz
|
|
32
27
|
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
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.
|
|
35
35
|
// Keep on being awesome.
|
|
36
|
-
|
|
37
|
-
// #endregion
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
// #autoindex, exclude: IoModel
|
|
2
2
|
// #region autoindexed files
|
|
3
|
+
// index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
|
|
4
|
+
// hash-code: 886488599
|
|
3
5
|
|
|
4
|
-
//
|
|
5
|
-
// export: named; exclusions: IoModel, index, private.
|
|
6
|
-
// files: Model.
|
|
7
|
-
|
|
8
|
-
// local file exports
|
|
6
|
+
// file exports
|
|
9
7
|
export * from "./Model";
|
|
10
8
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// This file was created by running: "dd
|
|
14
|
-
// 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.
|
|
15
13
|
//
|
|
16
14
|
// By default it assumes that exports are named exports but this can be changed by
|
|
17
15
|
// adding a modifier to the '// #autoindex' syntax:
|
|
18
16
|
//
|
|
19
17
|
// - autoindex:named same as default, exports "named symbols"
|
|
20
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
21
|
-
//
|
|
22
|
-
// file
|
|
18
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
19
|
+
// converts the default export to the name of the file
|
|
23
20
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
24
21
|
// 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
22
|
//
|
|
28
23
|
// You may also exclude certain files or directories by adding it to the
|
|
29
24
|
// autoindex command. As an example:
|
|
30
25
|
//
|
|
31
26
|
// - autoindex:named, exclude: foo,bar,baz
|
|
32
27
|
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
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.
|
|
35
35
|
// Keep on being awesome.
|
|
36
|
-
|
|
37
|
-
// #endregion
|
|
@@ -1,12 +1,10 @@
|
|
|
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: 2742585618
|
|
4
6
|
|
|
5
|
-
//
|
|
6
|
-
// export: named; exclusions: index, private.
|
|
7
|
-
// files: isArray, isBoolean, isFalse, isFunction, isLiteral, isNull, isNumber, isObject, isString, isSymbol, isTrue, isUndefined.
|
|
8
|
-
|
|
9
|
-
// local file exports
|
|
7
|
+
// file exports
|
|
10
8
|
export * from "./isArray";
|
|
11
9
|
export * from "./isBoolean";
|
|
12
10
|
export * from "./isFalse";
|
|
@@ -20,30 +18,30 @@ export * from "./isSymbol";
|
|
|
20
18
|
export * from "./isTrue";
|
|
21
19
|
export * from "./isUndefined";
|
|
22
20
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
// This file was created by running: "dd
|
|
26
|
-
// the 'do-devops' pkg installed as a dev dep.
|
|
21
|
+
// #endregion
|
|
22
|
+
|
|
23
|
+
// This file was created by running: "dd autoindex"; it assumes you have
|
|
24
|
+
// the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
|
|
27
25
|
//
|
|
28
26
|
// By default it assumes that exports are named exports but this can be changed by
|
|
29
27
|
// adding a modifier to the '// #autoindex' syntax:
|
|
30
28
|
//
|
|
31
29
|
// - autoindex:named same as default, exports "named symbols"
|
|
32
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
33
|
-
//
|
|
34
|
-
// file
|
|
30
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
31
|
+
// converts the default export to the name of the file
|
|
35
32
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
36
33
|
// file's symbols should be offset by the file's name
|
|
37
|
-
// (useful for files which might symbols which collide
|
|
38
|
-
// or where the namespacing helps consumers)
|
|
39
34
|
//
|
|
40
35
|
// You may also exclude certain files or directories by adding it to the
|
|
41
36
|
// autoindex command. As an example:
|
|
42
37
|
//
|
|
43
38
|
// - autoindex:named, exclude: foo,bar,baz
|
|
44
39
|
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
40
|
+
// Inversely, if you state a file to be an "orphan" then autoindex files
|
|
41
|
+
// below this file will not reference this autoindex file:
|
|
42
|
+
//
|
|
43
|
+
// - autoindex:named, orphan
|
|
44
|
+
//
|
|
45
|
+
// All content outside the "// #region" section in this file will be
|
|
46
|
+
// preserved in situations where you need to do something paricularly awesome.
|
|
47
47
|
// Keep on being awesome.
|
|
48
|
-
|
|
49
|
-
// #endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InferenceError } from "~/errors";
|
|
2
1
|
import { Narrowable } from "~/types/Narrowable";
|
|
3
2
|
import { keys } from "../keys";
|
|
4
3
|
|
|
@@ -24,10 +23,7 @@ function runtimeExtendsCheck<TValue extends any, TBase extends any>(
|
|
|
24
23
|
return true as TValue extends TBase ? true : false;
|
|
25
24
|
case "function":
|
|
26
25
|
if (narrow) {
|
|
27
|
-
throw new
|
|
28
|
-
`Use of narrowlyExtends with a function is not possible!`,
|
|
29
|
-
"ifTypeOf/not-allowed"
|
|
30
|
-
);
|
|
26
|
+
throw new Error(`Use of narrowlyExtends with a function is not possible!`);
|
|
31
27
|
}
|
|
32
28
|
return true as TValue extends TBase ? true : false;
|
|
33
29
|
case "object":
|
|
@@ -1,44 +1,40 @@
|
|
|
1
1
|
// #autoindex
|
|
2
2
|
// #region autoindexed files
|
|
3
|
+
// index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
|
|
4
|
+
// hash-code: 152540854
|
|
3
5
|
|
|
4
|
-
//
|
|
5
|
-
// export: named; exclusions: index, private.
|
|
6
|
-
// files: condition, ifTypeOf, type, withValue.
|
|
7
|
-
// directories: conditions.
|
|
8
|
-
|
|
9
|
-
// local file exports
|
|
6
|
+
// file exports
|
|
10
7
|
export * from "./condition";
|
|
11
8
|
export * from "./ifTypeOf";
|
|
12
9
|
export * from "./type";
|
|
13
10
|
export * from "./withValue";
|
|
14
|
-
|
|
15
11
|
// directory exports
|
|
16
12
|
export * from "./conditions/index";
|
|
17
13
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
// This file was created by running: "dd
|
|
21
|
-
// the 'do-devops' pkg installed as a dev dep.
|
|
14
|
+
// #endregion
|
|
15
|
+
|
|
16
|
+
// This file was created by running: "dd autoindex"; it assumes you have
|
|
17
|
+
// the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
|
|
22
18
|
//
|
|
23
19
|
// By default it assumes that exports are named exports but this can be changed by
|
|
24
20
|
// adding a modifier to the '// #autoindex' syntax:
|
|
25
21
|
//
|
|
26
22
|
// - autoindex:named same as default, exports "named symbols"
|
|
27
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
28
|
-
//
|
|
29
|
-
// file
|
|
23
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
24
|
+
// converts the default export to the name of the file
|
|
30
25
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
31
26
|
// file's symbols should be offset by the file's name
|
|
32
|
-
// (useful for files which might symbols which collide
|
|
33
|
-
// or where the namespacing helps consumers)
|
|
34
27
|
//
|
|
35
28
|
// You may also exclude certain files or directories by adding it to the
|
|
36
29
|
// autoindex command. As an example:
|
|
37
30
|
//
|
|
38
31
|
// - autoindex:named, exclude: foo,bar,baz
|
|
39
32
|
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
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
|
+
// All content outside the "// #region" section in this file will be
|
|
39
|
+
// preserved in situations where you need to do something paricularly awesome.
|
|
42
40
|
// Keep on being awesome.
|
|
43
|
-
|
|
44
|
-
// #endregion
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
// #autoindex
|
|
2
2
|
// #region autoindexed files
|
|
3
|
+
// index last changed at: 12th Dec, 2021, 09:28 AM ( GMT-8 )
|
|
4
|
+
// hash-code: 4250795496
|
|
3
5
|
|
|
4
|
-
//
|
|
5
|
-
// export: named; exclusions: index, private.
|
|
6
|
-
// files: Configurator, FluentConfigurator, KeyStorage.
|
|
7
|
-
|
|
8
|
-
// local file exports
|
|
6
|
+
// file exports
|
|
9
7
|
export * from "./Configurator";
|
|
10
8
|
export * from "./FluentConfigurator";
|
|
11
9
|
export * from "./KeyStorage";
|
|
12
10
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
// This file was created by running: "dd
|
|
16
|
-
// the 'do-devops' pkg installed as a dev dep.
|
|
11
|
+
// #endregion
|
|
12
|
+
|
|
13
|
+
// This file was created by running: "dd autoindex"; it assumes you have
|
|
14
|
+
// the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
|
|
17
15
|
//
|
|
18
16
|
// By default it assumes that exports are named exports but this can be changed by
|
|
19
17
|
// adding a modifier to the '// #autoindex' syntax:
|
|
20
18
|
//
|
|
21
19
|
// - autoindex:named same as default, exports "named symbols"
|
|
22
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
23
|
-
//
|
|
24
|
-
// file
|
|
20
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
21
|
+
// converts the default export to the name of the file
|
|
25
22
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
26
23
|
// 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
24
|
//
|
|
30
25
|
// You may also exclude certain files or directories by adding it to the
|
|
31
26
|
// autoindex command. As an example:
|
|
32
27
|
//
|
|
33
28
|
// - autoindex:named, exclude: foo,bar,baz
|
|
34
29
|
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
30
|
+
// Inversely, if you state a file to be an "orphan" then autoindex files
|
|
31
|
+
// below this file will not reference this autoindex file:
|
|
32
|
+
//
|
|
33
|
+
// - autoindex:named, orphan
|
|
34
|
+
//
|
|
35
|
+
// All content outside the "// #region" section in this file will be
|
|
36
|
+
// preserved in situations where you need to do something paricularly awesome.
|
|
37
37
|
// Keep on being awesome.
|
|
38
|
-
|
|
39
|
-
// #endregion
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Expect, Equal } from "@type-challenges/utils";
|
|
2
|
+
import { Where, WhereNot } from "../src/types/Where";
|
|
3
|
+
|
|
4
|
+
describe("Where<T,U> and WhereNot<T,U> type utility", () => {
|
|
5
|
+
|
|
6
|
+
it("readonly string array works correctly", () => {
|
|
7
|
+
const arr = ["foo", "bar", "baz"] as const;
|
|
8
|
+
type A = typeof arr;
|
|
9
|
+
type B = Where<A, `ba${string}`>;
|
|
10
|
+
type F = WhereNot<A, `ba${string}`>;
|
|
11
|
+
|
|
12
|
+
type cases = [
|
|
13
|
+
//
|
|
14
|
+
Expect<Equal<B, "bar"| "baz">>,
|
|
15
|
+
Expect<Equal<F, "foo">>
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const c: cases = [ true, true ];
|
|
19
|
+
expect(c).toBe(c);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("object with literal keys works", () => {
|
|
23
|
+
const arr = {foo: true, bar: true, baz: true} as const;
|
|
24
|
+
type A = typeof arr;
|
|
25
|
+
type B = Where<A, `ba${string}`>;
|
|
26
|
+
type F = WhereNot<A, `ba${string}`>;
|
|
27
|
+
|
|
28
|
+
type cases = [
|
|
29
|
+
//
|
|
30
|
+
Expect<Equal<B, "bar"| "baz">>,
|
|
31
|
+
Expect<Equal<F, "foo">>
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const c: cases = [ true, true ];
|
|
35
|
+
expect(c).toBe(c);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
});
|
package/tests/data/index.ts
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
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: 10th Oct, 2021, 02:38 PM ( GMT-7 )
|
|
6
|
-
// export: named; exclusions: index, private.
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
// This file was created by running: "dd
|
|
9
|
+
// #endregion
|
|
10
|
+
|
|
11
|
+
// This file was created by running: "dd autoindex"; it assumes you have
|
|
12
12
|
// the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
|
|
13
13
|
//
|
|
14
14
|
// By default it assumes that exports are named exports but this can be changed by
|
|
15
15
|
// adding a modifier to the '// #autoindex' syntax:
|
|
16
16
|
//
|
|
17
17
|
// - autoindex:named same as default, exports "named symbols"
|
|
18
|
-
// - autoindex:default assumes each file is exporting a default export
|
|
19
|
-
//
|
|
20
|
-
// file
|
|
18
|
+
// - autoindex:default assumes each file is exporting a default export and
|
|
19
|
+
// converts the default export to the name of the file
|
|
21
20
|
// - autoindex:offset assumes files export "named symbols" but that each
|
|
22
21
|
// file's symbols should be offset by the file's name
|
|
23
|
-
// (useful for files which might symbols which collide
|
|
24
|
-
// or where the namespacing helps consumers)
|
|
25
22
|
//
|
|
26
23
|
// You may also exclude certain files or directories by adding it to the
|
|
27
24
|
// autoindex command. As an example:
|
|
@@ -33,8 +30,6 @@
|
|
|
33
30
|
//
|
|
34
31
|
// - autoindex:named, orphan
|
|
35
32
|
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
33
|
+
// All content outside the "// #region" section in this file will be
|
|
34
|
+
// preserved in situations where you need to do something paricularly awesome.
|
|
38
35
|
// Keep on being awesome.
|
|
39
|
-
|
|
40
|
-
// #endregion
|
|
@@ -23,7 +23,10 @@ describe("dictToKv()", () => {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
type cases = [
|
|
26
|
-
Expect<
|
|
26
|
+
Expect<
|
|
27
|
+
Equal<
|
|
28
|
+
Val,
|
|
29
|
+
[
|
|
27
30
|
{
|
|
28
31
|
key: "id";
|
|
29
32
|
value: 123;
|
|
@@ -32,7 +35,8 @@ describe("dictToKv()", () => {
|
|
|
32
35
|
key: "foo";
|
|
33
36
|
value: "bar";
|
|
34
37
|
}
|
|
35
|
-
]
|
|
38
|
+
]
|
|
39
|
+
>
|
|
36
40
|
>
|
|
37
41
|
];
|
|
38
42
|
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"module": "
|
|
4
|
-
"target": "
|
|
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": ["
|
|
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};
|