@duplojs/lang 0.0.1-beta.8 → 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/dist/array/concat.d.ts +2 -2
  2. package/dist/array/flat.d.ts +1 -1
  3. package/dist/array/flatMap.d.ts +2 -2
  4. package/dist/array/from.d.ts +1 -1
  5. package/dist/array/length.d.ts +3 -2
  6. package/dist/array/push.d.ts +4 -2
  7. package/dist/chrono/operators/addTime.d.ts +2 -4
  8. package/dist/common/constraint/cast/index.d.ts +5 -5
  9. package/dist/common/constraint/cast/string.d.ts +4 -0
  10. package/dist/common/constraint/infer/index.d.ts +2 -1
  11. package/dist/common/constraint/infer/string.d.ts +1 -0
  12. package/dist/common/constraint/types/index.d.ts +1 -0
  13. package/dist/common/constraint/types/maybe.d.ts +2 -0
  14. package/dist/common/formData.d.ts +2 -1
  15. package/dist/common/memo.cjs +3 -2
  16. package/dist/common/memo.mjs +3 -2
  17. package/dist/common/memoPromise.cjs +3 -2
  18. package/dist/common/memoPromise.mjs +3 -2
  19. package/dist/common/timeout.cjs +2 -2
  20. package/dist/common/timeout.d.ts +1 -1
  21. package/dist/common/timeout.mjs +2 -2
  22. package/dist/common/types/applyPromiseIf.d.ts +1 -0
  23. package/dist/common/types/index.d.ts +2 -0
  24. package/dist/common/types/isObject.d.ts +8 -0
  25. package/dist/common/types/json.d.ts +12 -1
  26. package/dist/dataStructure/common/codec/base.cjs +2 -2
  27. package/dist/dataStructure/common/codec/base.mjs +2 -2
  28. package/dist/dataStructure/common/codec/defaults/string.cjs +1 -1
  29. package/dist/dataStructure/common/codec/defaults/string.d.ts +1 -1
  30. package/dist/dataStructure/common/codec/defaults/string.mjs +1 -1
  31. package/dist/dataStructure/common/{error.cjs → error/base.cjs} +22 -5
  32. package/dist/dataStructure/common/{error.d.ts → error/base.d.ts} +18 -9
  33. package/dist/dataStructure/common/{error.mjs → error/base.mjs} +21 -6
  34. package/dist/dataStructure/common/error/defaultInterpreter.cjs +87 -0
  35. package/dist/dataStructure/common/error/defaultInterpreter.d.ts +60 -0
  36. package/dist/dataStructure/common/error/defaultInterpreter.mjs +86 -0
  37. package/dist/dataStructure/common/error/index.d.ts +3 -0
  38. package/dist/dataStructure/common/error/interpreter.cjs +44 -0
  39. package/dist/dataStructure/common/error/interpreter.d.ts +32 -0
  40. package/dist/dataStructure/common/error/interpreter.mjs +44 -0
  41. package/dist/dataStructure/common/index.d.ts +0 -1
  42. package/dist/dataStructure/constraint/defaults/allowedCharacters.d.ts +1 -3
  43. package/dist/dataStructure/constraint/types/constraints.d.ts +1 -0
  44. package/dist/dataStructure/fundamentalType/types/fundamentalTypes.d.ts +1 -0
  45. package/dist/dataStructure/helpers/extend.cjs +1 -1
  46. package/dist/dataStructure/helpers/extend.d.ts +1 -1
  47. package/dist/dataStructure/helpers/extend.mjs +1 -1
  48. package/dist/dataStructure/helpers/index.d.ts +6 -2
  49. package/dist/dataStructure/helpers/isNullable.cjs +12 -0
  50. package/dist/dataStructure/helpers/isNullable.d.ts +2 -0
  51. package/dist/dataStructure/helpers/isNullable.mjs +12 -0
  52. package/dist/dataStructure/helpers/isOptional.cjs +12 -0
  53. package/dist/dataStructure/helpers/isOptional.d.ts +2 -0
  54. package/dist/dataStructure/helpers/isOptional.mjs +12 -0
  55. package/dist/dataStructure/helpers/partial.cjs +1 -1
  56. package/dist/dataStructure/helpers/partial.mjs +1 -1
  57. package/dist/dataStructure/helpers/required.cjs +1 -1
  58. package/dist/dataStructure/helpers/required.mjs +1 -1
  59. package/dist/dataStructure/helpers/typeStructureIdentifier.cjs +14 -0
  60. package/dist/dataStructure/helpers/typeStructureIdentifier.d.ts +6 -0
  61. package/dist/dataStructure/helpers/typeStructureIdentifier.mjs +14 -0
  62. package/dist/dataStructure/helpers/unwrapLazy.cjs +9 -0
  63. package/dist/dataStructure/helpers/unwrapLazy.d.ts +2 -0
  64. package/dist/dataStructure/helpers/unwrapLazy.mjs +9 -0
  65. package/dist/dataStructure/index.cjs +56 -35
  66. package/dist/dataStructure/index.mjs +18 -5
  67. package/dist/dataStructure/structure/base.cjs +31 -19
  68. package/dist/dataStructure/structure/base.d.ts +16 -16
  69. package/dist/dataStructure/structure/base.mjs +25 -13
  70. package/dist/dataStructure/structure/defaults/array.cjs +10 -0
  71. package/dist/dataStructure/structure/defaults/array.d.ts +1 -1
  72. package/dist/dataStructure/structure/defaults/array.mjs +10 -0
  73. package/dist/dataStructure/structure/defaults/lazy.cjs +1 -0
  74. package/dist/dataStructure/structure/defaults/lazy.d.ts +1 -1
  75. package/dist/dataStructure/structure/defaults/lazy.mjs +1 -0
  76. package/dist/dataStructure/structure/defaults/nonEncodableString.cjs +1 -0
  77. package/dist/dataStructure/structure/defaults/nonEncodableString.mjs +1 -0
  78. package/dist/dataStructure/structure/defaults/object.cjs +18 -7
  79. package/dist/dataStructure/structure/defaults/object.d.ts +3 -2
  80. package/dist/dataStructure/structure/defaults/object.mjs +18 -7
  81. package/dist/dataStructure/structure/defaults/record.cjs +20 -7
  82. package/dist/dataStructure/structure/defaults/record.d.ts +1 -1
  83. package/dist/dataStructure/structure/defaults/record.mjs +20 -7
  84. package/dist/dataStructure/structure/defaults/type.cjs +1 -0
  85. package/dist/dataStructure/structure/defaults/type.d.ts +1 -1
  86. package/dist/dataStructure/structure/defaults/type.mjs +1 -0
  87. package/dist/dataStructure/structure/defaults/union.cjs +26 -6
  88. package/dist/dataStructure/structure/defaults/union.d.ts +1 -1
  89. package/dist/dataStructure/structure/defaults/union.mjs +21 -1
  90. package/dist/dataStructure/structure/types/value.d.ts +2 -0
  91. package/dist/dataStructure/type/types/types.d.ts +1 -0
  92. package/dist/either/index.cjs +29 -7
  93. package/dist/either/index.d.ts +4 -0
  94. package/dist/either/index.mjs +22 -8
  95. package/dist/either/left/create.d.ts +2 -1
  96. package/dist/either/left/index.d.ts +3 -2
  97. package/dist/either/left/none.cjs +15 -0
  98. package/dist/either/left/none.d.ts +7 -0
  99. package/dist/either/left/none.mjs +14 -0
  100. package/dist/either/matchInformationOtherwise.d.ts +1 -1
  101. package/dist/either/rewriteInformation.cjs +22 -0
  102. package/dist/either/rewriteInformation.d.ts +14 -0
  103. package/dist/either/rewriteInformation.mjs +22 -0
  104. package/dist/either/right/asyncGroup.cjs +2 -2
  105. package/dist/either/right/asyncGroup.mjs +2 -2
  106. package/dist/either/right/create.d.ts +2 -1
  107. package/dist/either/right/group.cjs +1 -1
  108. package/dist/either/right/group.mjs +1 -1
  109. package/dist/either/right/index.d.ts +6 -5
  110. package/dist/either/right/some.cjs +15 -0
  111. package/dist/either/right/some.d.ts +7 -0
  112. package/dist/either/right/some.mjs +14 -0
  113. package/dist/either/toMaybe.cjs +12 -0
  114. package/dist/either/toMaybe.d.ts +5 -0
  115. package/dist/either/toMaybe.mjs +12 -0
  116. package/dist/either/types/index.d.ts +1 -0
  117. package/dist/either/types/mayBe.d.ts +3 -0
  118. package/dist/either/unwrapOr.cjs +14 -0
  119. package/dist/either/unwrapOr.d.ts +8 -0
  120. package/dist/either/unwrapOr.mjs +14 -0
  121. package/dist/either/unwrapOtherwise.cjs +14 -0
  122. package/dist/either/unwrapOtherwise.d.ts +8 -0
  123. package/dist/either/unwrapOtherwise.mjs +14 -0
  124. package/dist/generator/reduce.cjs +2 -1
  125. package/dist/generator/reduce.mjs +1 -1
  126. package/dist/invocation/evidence.d.ts +1 -1
  127. package/dist/invocation/flow/base.cjs +4 -4
  128. package/dist/invocation/flow/base.d.ts +1 -1
  129. package/dist/invocation/flow/base.mjs +4 -4
  130. package/dist/invocation/flow/controller/defaults/debounce.cjs +1 -1
  131. package/dist/invocation/flow/controller/defaults/debounce.mjs +1 -1
  132. package/dist/invocation/flow/controller/defaults/throttling.cjs +1 -1
  133. package/dist/invocation/flow/controller/defaults/throttling.mjs +1 -1
  134. package/dist/invocation/index.cjs +18 -8
  135. package/dist/invocation/index.d.ts +3 -1
  136. package/dist/invocation/index.mjs +12 -6
  137. package/dist/invocation/reader.cjs +30 -0
  138. package/dist/invocation/reader.d.ts +30 -0
  139. package/dist/invocation/reader.mjs +29 -0
  140. package/dist/invocation/resolver.cjs +31 -0
  141. package/dist/invocation/resolver.d.ts +14 -0
  142. package/dist/invocation/resolver.mjs +31 -0
  143. package/dist/invocation/signature.cjs +8 -0
  144. package/dist/invocation/signature.d.ts +7 -0
  145. package/dist/invocation/signature.mjs +8 -0
  146. package/dist/modeling/entity/base.cjs +22 -11
  147. package/dist/modeling/entity/base.d.ts +16 -8
  148. package/dist/modeling/entity/base.mjs +16 -5
  149. package/dist/modeling/entity/helper.d.ts +6 -8
  150. package/dist/modeling/entity/namespace.cjs +0 -2
  151. package/dist/modeling/entity/namespace.d.ts +0 -2
  152. package/dist/modeling/entity/namespace.mjs +0 -2
  153. package/dist/modeling/fact/base.cjs +36 -0
  154. package/dist/modeling/fact/base.d.ts +29 -0
  155. package/dist/modeling/fact/base.mjs +35 -0
  156. package/dist/modeling/fact/index.d.ts +1 -0
  157. package/dist/modeling/flag/base.cjs +2 -6
  158. package/dist/modeling/flag/base.d.ts +10 -11
  159. package/dist/modeling/flag/base.mjs +2 -6
  160. package/dist/modeling/index.cjs +17 -12
  161. package/dist/modeling/index.d.ts +1 -0
  162. package/dist/modeling/index.mjs +5 -2
  163. package/dist/modeling/newType/base.cjs +12 -11
  164. package/dist/modeling/newType/base.d.ts +8 -8
  165. package/dist/modeling/newType/base.mjs +6 -5
  166. package/dist/modeling/taggedObject/base.cjs +22 -11
  167. package/dist/modeling/taggedObject/base.d.ts +12 -7
  168. package/dist/modeling/taggedObject/base.mjs +16 -5
  169. package/dist/object/assign.d.ts +3 -3
  170. package/dist/object/deepOverride.cjs +33 -0
  171. package/dist/object/deepOverride.d.ts +20 -0
  172. package/dist/object/deepOverride.mjs +33 -0
  173. package/dist/object/entries.d.ts +3 -3
  174. package/dist/object/index.cjs +4 -1
  175. package/dist/object/index.d.ts +1 -0
  176. package/dist/object/index.mjs +4 -2
  177. package/dist/object/isSimple.cjs +1 -1
  178. package/dist/object/isSimple.mjs +1 -1
  179. package/dist/object/keys.d.ts +1 -1
  180. package/dist/object/override.cjs +1 -1
  181. package/dist/object/override.d.ts +5 -2
  182. package/dist/object/override.mjs +1 -1
  183. package/dist/object/types/assign.d.ts +2 -0
  184. package/dist/object/types/forbiddenKey.d.ts +1 -1
  185. package/dist/object/types/forbiddenUndefinedProps.d.ts +3 -0
  186. package/dist/object/types/hasKeySignature.d.ts +1 -0
  187. package/dist/object/types/index.d.ts +6 -2
  188. package/dist/object/types/keyofWithoutSignature.d.ts +3 -0
  189. package/dist/object/types/override.d.ts +4 -0
  190. package/dist/object/types/split.d.ts +2 -2
  191. package/dist/object/values.d.ts +1 -1
  192. package/dist/path/create.cjs +11 -0
  193. package/dist/path/create.d.ts +3 -0
  194. package/dist/path/create.mjs +11 -0
  195. package/dist/path/createAbsolute.cjs +12 -0
  196. package/dist/path/createAbsolute.d.ts +3 -0
  197. package/dist/path/createAbsolute.mjs +12 -0
  198. package/dist/path/createAbsoluteOrThrow.cjs +22 -0
  199. package/dist/path/createAbsoluteOrThrow.d.ts +9 -0
  200. package/dist/path/createAbsoluteOrThrow.mjs +21 -0
  201. package/dist/path/createOrThrow.cjs +22 -0
  202. package/dist/path/createOrThrow.d.ts +9 -0
  203. package/dist/path/createOrThrow.mjs +21 -0
  204. package/dist/path/createSegment.cjs +12 -0
  205. package/dist/path/createSegment.d.ts +3 -0
  206. package/dist/path/createSegment.mjs +12 -0
  207. package/dist/path/createSegmentOrThrow.cjs +22 -0
  208. package/dist/path/createSegmentOrThrow.d.ts +9 -0
  209. package/dist/path/createSegmentOrThrow.mjs +21 -0
  210. package/dist/path/declareAbsolutePath.cjs +6 -0
  211. package/dist/path/declareAbsolutePath.d.ts +3 -0
  212. package/dist/path/declareAbsolutePath.mjs +6 -0
  213. package/dist/path/declarePath.cjs +6 -0
  214. package/dist/path/declarePath.d.ts +3 -0
  215. package/dist/path/declarePath.mjs +6 -0
  216. package/dist/path/declareSegment.cjs +6 -0
  217. package/dist/path/declareSegment.d.ts +3 -0
  218. package/dist/path/declareSegment.mjs +6 -0
  219. package/dist/path/index.cjs +39 -3
  220. package/dist/path/index.d.ts +10 -0
  221. package/dist/path/index.mjs +27 -4
  222. package/dist/path/kind.cjs +4 -0
  223. package/dist/path/kind.d.ts +2 -0
  224. package/dist/path/kind.mjs +5 -0
  225. package/dist/pattern/index.cjs +6 -0
  226. package/dist/pattern/index.d.ts +2 -0
  227. package/dist/pattern/index.mjs +5 -1
  228. package/dist/pattern/match/builder.cjs +1 -1
  229. package/dist/pattern/match/builder.mjs +1 -1
  230. package/dist/pattern/matchWithEntityOtherwise.d.ts +2 -2
  231. package/dist/pattern/matchWithFact.cjs +12 -0
  232. package/dist/pattern/matchWithFact.d.ts +12 -0
  233. package/dist/pattern/matchWithFact.mjs +12 -0
  234. package/dist/pattern/matchWithFactOtherwise.cjs +13 -0
  235. package/dist/pattern/matchWithFactOtherwise.d.ts +14 -0
  236. package/dist/pattern/matchWithFactOtherwise.mjs +13 -0
  237. package/dist/pattern/matchWithNumber.d.ts +4 -4
  238. package/dist/pattern/matchWithNumberOtherwise.d.ts +4 -4
  239. package/dist/pattern/matchWithString.d.ts +4 -4
  240. package/dist/pattern/matchWithStringOtherwise.d.ts +4 -4
  241. package/dist/pattern/matchWithTaggedObjectOtherwise.d.ts +2 -2
  242. package/dist/pattern/types/complexUnMatchedValue/getIncompleteUnion.d.ts +8 -8
  243. package/dist/string/capitalize.d.ts +1 -1
  244. package/dist/string/concat.d.ts +2 -2
  245. package/dist/string/constraints/allowedCharacters.d.ts +3 -3
  246. package/dist/string/isComposedOf.cjs +0 -1
  247. package/dist/string/isComposedOf.d.ts +5 -8
  248. package/dist/string/isComposedOf.mjs +0 -1
  249. package/dist/string/prepend.d.ts +2 -2
  250. package/dist/string/split.cjs +1 -0
  251. package/dist/string/split.d.ts +3 -3
  252. package/dist/string/split.mjs +1 -0
  253. package/dist/string/toLowerCase.d.ts +1 -1
  254. package/dist/string/toUpperCase.d.ts +1 -1
  255. package/dist/string/types/IsAllowedString.d.ts +5 -0
  256. package/dist/string/types/index.d.ts +1 -0
  257. package/dist/string/uncapitalize.d.ts +1 -1
  258. package/dist/tuple/types/map.d.ts +1 -1
  259. package/package.json +16 -30
  260. package/dist/dataStructure/common/errorInterpreter.cjs +0 -45
  261. package/dist/dataStructure/common/errorInterpreter.d.ts +0 -32
  262. package/dist/dataStructure/common/errorInterpreter.mjs +0 -45
  263. package/dist/invocation/useCase.cjs +0 -26
  264. package/dist/invocation/useCase.d.ts +0 -28
  265. package/dist/invocation/useCase.mjs +0 -25
  266. package/dist/object/types/assignObjects.d.ts +0 -2
  267. /package/{README.md → README} +0 -0
@@ -0,0 +1,22 @@
1
+ const require_parentClass = require("../kind/parentClass.cjs");
2
+ const require_is = require("../either/left/is.cjs");
3
+ const require_unwrap = require("../either/left/unwrap.cjs");
4
+ const require_unwrap$1 = require("../either/right/unwrap.cjs");
5
+ const require_createAbsolute = require("./createAbsolute.cjs");
6
+ const require_kind = require("./kind.cjs");
7
+ //#region scripts/path/createAbsoluteOrThrow.ts
8
+ var CreateAbsolutePathError = class extends require_parentClass.parentClass(require_kind.createKind("create-absolute-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid absolute path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createAbsoluteOrThrow(value) {
16
+ const result = require_createAbsolute.createAbsolute(value);
17
+ if (require_is.isLeft(result)) throw new CreateAbsolutePathError(require_unwrap.unwrapLeft(result));
18
+ return require_unwrap$1.unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ exports.CreateAbsolutePathError = CreateAbsolutePathError;
22
+ exports.createAbsoluteOrThrow = createAbsoluteOrThrow;
@@ -0,0 +1,9 @@
1
+ import { Absolute } from './constraints';
2
+ import * as DKind from '../kind';
3
+ declare const CreateAbsolutePathError_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsLangPath/create-absolute-path-error", unknown>>, ErrorConstructor>;
4
+ export declare class CreateAbsolutePathError extends CreateAbsolutePathError_base {
5
+ value: string;
6
+ constructor(value: string);
7
+ }
8
+ export declare function createAbsoluteOrThrow(value: string): string & Absolute;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { parentClass } from "../kind/parentClass.mjs";
2
+ import { isLeft } from "../either/left/is.mjs";
3
+ import { unwrapLeft } from "../either/left/unwrap.mjs";
4
+ import { unwrapRight } from "../either/right/unwrap.mjs";
5
+ import { createAbsolute } from "./createAbsolute.mjs";
6
+ import { createKind } from "./kind.mjs";
7
+ //#region scripts/path/createAbsoluteOrThrow.ts
8
+ var CreateAbsolutePathError = class extends parentClass(createKind("create-absolute-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid absolute path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createAbsoluteOrThrow(value) {
16
+ const result = createAbsolute(value);
17
+ if (isLeft(result)) throw new CreateAbsolutePathError(unwrapLeft(result));
18
+ return unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ export { CreateAbsolutePathError, createAbsoluteOrThrow };
@@ -0,0 +1,22 @@
1
+ const require_parentClass = require("../kind/parentClass.cjs");
2
+ const require_is = require("../either/left/is.cjs");
3
+ const require_unwrap = require("../either/left/unwrap.cjs");
4
+ const require_unwrap$1 = require("../either/right/unwrap.cjs");
5
+ const require_create = require("./create.cjs");
6
+ const require_kind = require("./kind.cjs");
7
+ //#region scripts/path/createOrThrow.ts
8
+ var CreatePathError = class extends require_parentClass.parentClass(require_kind.createKind("create-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createOrThrow(value) {
16
+ const result = require_create.create(value);
17
+ if (require_is.isLeft(result)) throw new CreatePathError(require_unwrap.unwrapLeft(result));
18
+ return require_unwrap$1.unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ exports.CreatePathError = CreatePathError;
22
+ exports.createOrThrow = createOrThrow;
@@ -0,0 +1,9 @@
1
+ import { Path } from './constraints';
2
+ import * as DKind from '../kind';
3
+ declare const CreatePathError_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsLangPath/create-path-error", unknown>>, ErrorConstructor>;
4
+ export declare class CreatePathError extends CreatePathError_base {
5
+ value: string;
6
+ constructor(value: string);
7
+ }
8
+ export declare function createOrThrow(value: string): string & Path;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { parentClass } from "../kind/parentClass.mjs";
2
+ import { isLeft } from "../either/left/is.mjs";
3
+ import { unwrapLeft } from "../either/left/unwrap.mjs";
4
+ import { unwrapRight } from "../either/right/unwrap.mjs";
5
+ import { create } from "./create.mjs";
6
+ import { createKind } from "./kind.mjs";
7
+ //#region scripts/path/createOrThrow.ts
8
+ var CreatePathError = class extends parentClass(createKind("create-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createOrThrow(value) {
16
+ const result = create(value);
17
+ if (isLeft(result)) throw new CreatePathError(unwrapLeft(result));
18
+ return unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ export { CreatePathError, createOrThrow };
@@ -0,0 +1,12 @@
1
+ const require_error = require("../either/left/error.cjs");
2
+ const require_success = require("../either/right/success.cjs");
3
+ const require_normalize = require("./normalize.cjs");
4
+ const require_isSegment = require("./isSegment.cjs");
5
+ //#region scripts/path/createSegment.ts
6
+ function createSegment(value) {
7
+ const result = require_normalize.normalize(value);
8
+ if (result && require_isSegment.isSegment(result)) return require_success.success(result);
9
+ return require_error.error(value);
10
+ }
11
+ //#endregion
12
+ exports.createSegment = createSegment;
@@ -0,0 +1,3 @@
1
+ import { Segment } from './constraints';
2
+ import * as DEither from '../either';
3
+ export declare function createSegment(value: string): (DEither.Success<string & Segment> | DEither.Error<string>);
@@ -0,0 +1,12 @@
1
+ import { error } from "../either/left/error.mjs";
2
+ import { success } from "../either/right/success.mjs";
3
+ import { normalize } from "./normalize.mjs";
4
+ import { isSegment } from "./isSegment.mjs";
5
+ //#region scripts/path/createSegment.ts
6
+ function createSegment(value) {
7
+ const result = normalize(value);
8
+ if (result && isSegment(result)) return success(result);
9
+ return error(value);
10
+ }
11
+ //#endregion
12
+ export { createSegment };
@@ -0,0 +1,22 @@
1
+ const require_parentClass = require("../kind/parentClass.cjs");
2
+ const require_is = require("../either/left/is.cjs");
3
+ const require_unwrap = require("../either/left/unwrap.cjs");
4
+ const require_unwrap$1 = require("../either/right/unwrap.cjs");
5
+ const require_kind = require("./kind.cjs");
6
+ const require_createSegment = require("./createSegment.cjs");
7
+ //#region scripts/path/createSegmentOrThrow.ts
8
+ var CreateSegmentPathError = class extends require_parentClass.parentClass(require_kind.createKind("create-segment-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid segment path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createSegmentOrThrow(value) {
16
+ const result = require_createSegment.createSegment(value);
17
+ if (require_is.isLeft(result)) throw new CreateSegmentPathError(require_unwrap.unwrapLeft(result));
18
+ return require_unwrap$1.unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ exports.CreateSegmentPathError = CreateSegmentPathError;
22
+ exports.createSegmentOrThrow = createSegmentOrThrow;
@@ -0,0 +1,9 @@
1
+ import { Segment } from './constraints';
2
+ import * as DKind from '../kind';
3
+ declare const CreateSegmentPathError_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsLangPath/create-segment-path-error", unknown>>, ErrorConstructor>;
4
+ export declare class CreateSegmentPathError extends CreateSegmentPathError_base {
5
+ value: string;
6
+ constructor(value: string);
7
+ }
8
+ export declare function createSegmentOrThrow(value: string): string & Segment;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { parentClass } from "../kind/parentClass.mjs";
2
+ import { isLeft } from "../either/left/is.mjs";
3
+ import { unwrapLeft } from "../either/left/unwrap.mjs";
4
+ import { unwrapRight } from "../either/right/unwrap.mjs";
5
+ import { createKind } from "./kind.mjs";
6
+ import { createSegment } from "./createSegment.mjs";
7
+ //#region scripts/path/createSegmentOrThrow.ts
8
+ var CreateSegmentPathError = class extends parentClass(createKind("create-segment-path-error"), Error) {
9
+ value;
10
+ constructor(value) {
11
+ super(null, `Invalid segment path: ${value}`);
12
+ this.value = value;
13
+ }
14
+ };
15
+ function createSegmentOrThrow(value) {
16
+ const result = createSegment(value);
17
+ if (isLeft(result)) throw new CreateSegmentPathError(unwrapLeft(result));
18
+ return unwrapRight(result);
19
+ }
20
+ //#endregion
21
+ export { CreateSegmentPathError, createSegmentOrThrow };
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declareAbsolutePath.ts
2
+ function declareAbsolutePath(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ exports.declareAbsolutePath = declareAbsolutePath;
@@ -0,0 +1,3 @@
1
+ import { Absolute } from './constraints';
2
+ import { RequireLiteralAbsolutePath } from './types';
3
+ export declare function declareAbsolutePath<GenericValue extends string>(value: (GenericValue & RequireLiteralAbsolutePath<GenericValue>)): GenericValue & Absolute;
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declareAbsolutePath.ts
2
+ function declareAbsolutePath(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ export { declareAbsolutePath };
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declarePath.ts
2
+ function declarePath(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ exports.declarePath = declarePath;
@@ -0,0 +1,3 @@
1
+ import { Path } from './constraints';
2
+ import { RequireLiteralPath } from './types';
3
+ export declare function declarePath<GenericValue extends string>(value: (GenericValue & RequireLiteralPath<GenericValue>)): GenericValue & Path;
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declarePath.ts
2
+ function declarePath(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ export { declarePath };
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declareSegment.ts
2
+ function declareSegment(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ exports.declareSegment = declareSegment;
@@ -0,0 +1,3 @@
1
+ import { Segment } from './constraints';
2
+ import { RequireLiteralSegmentPath } from './types';
3
+ export declare function declareSegment<GenericValue extends string>(value: (GenericValue & RequireLiteralSegmentPath<GenericValue>)): GenericValue & Segment;
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/declareSegment.ts
2
+ function declareSegment(value) {
3
+ return value;
4
+ }
5
+ //#endregion
6
+ export { declareSegment };
@@ -1,17 +1,40 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  const require_computeRelative = require("./computeRelative.cjs");
3
+ const require_normalize = require("./normalize.cjs");
4
+ const require_create = require("./create.cjs");
5
+ const require_is = require("./is.cjs");
6
+ const require_isAbsolute = require("./isAbsolute.cjs");
7
+ const require_createAbsolute = require("./createAbsolute.cjs");
8
+ const require_kind = require("./kind.cjs");
9
+ const require_createAbsoluteOrThrow = require("./createAbsoluteOrThrow.cjs");
10
+ const require_createOrThrow = require("./createOrThrow.cjs");
3
11
  const require_isSegment = require("./isSegment.cjs");
12
+ const require_createSegment = require("./createSegment.cjs");
13
+ const require_createSegmentOrThrow = require("./createSegmentOrThrow.cjs");
14
+ const require_declareAbsolutePath = require("./declareAbsolutePath.cjs");
15
+ const require_declarePath = require("./declarePath.cjs");
16
+ const require_declareSegment = require("./declareSegment.cjs");
4
17
  const require_getBaseName = require("./getBaseName.cjs");
5
18
  const require_getExtensionName = require("./getExtensionName.cjs");
6
19
  const require_getParentFolderPath = require("./getParentFolderPath.cjs");
7
- const require_is = require("./is.cjs");
8
- const require_isAbsolute = require("./isAbsolute.cjs");
9
- const require_normalize = require("./normalize.cjs");
10
20
  const require_resolveRelative = require("./resolveRelative.cjs");
11
21
  const require_resolveFrom = require("./resolveFrom.cjs");
12
22
  //#region scripts/path/index.ts
13
23
  var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
24
+ CreateAbsolutePathError: () => require_createAbsoluteOrThrow.CreateAbsolutePathError,
25
+ CreatePathError: () => require_createOrThrow.CreatePathError,
26
+ CreateSegmentPathError: () => require_createSegmentOrThrow.CreateSegmentPathError,
14
27
  computeRelative: () => require_computeRelative.computeRelative,
28
+ create: () => require_create.create,
29
+ createAbsolute: () => require_createAbsolute.createAbsolute,
30
+ createAbsoluteOrThrow: () => require_createAbsoluteOrThrow.createAbsoluteOrThrow,
31
+ createKind: () => require_kind.createKind,
32
+ createOrThrow: () => require_createOrThrow.createOrThrow,
33
+ createSegment: () => require_createSegment.createSegment,
34
+ createSegmentOrThrow: () => require_createSegmentOrThrow.createSegmentOrThrow,
35
+ declareAbsolutePath: () => require_declareAbsolutePath.declareAbsolutePath,
36
+ declarePath: () => require_declarePath.declarePath,
37
+ declareSegment: () => require_declareSegment.declareSegment,
15
38
  getBaseName: () => require_getBaseName.getBaseName,
16
39
  getExtensionName: () => require_getExtensionName.getExtensionName,
17
40
  getParentFolderPath: () => require_getParentFolderPath.getParentFolderPath,
@@ -23,7 +46,20 @@ var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
23
46
  resolveRelative: () => require_resolveRelative.resolveRelative
24
47
  });
25
48
  //#endregion
49
+ exports.CreateAbsolutePathError = require_createAbsoluteOrThrow.CreateAbsolutePathError;
50
+ exports.CreatePathError = require_createOrThrow.CreatePathError;
51
+ exports.CreateSegmentPathError = require_createSegmentOrThrow.CreateSegmentPathError;
26
52
  exports.computeRelative = require_computeRelative.computeRelative;
53
+ exports.create = require_create.create;
54
+ exports.createAbsolute = require_createAbsolute.createAbsolute;
55
+ exports.createAbsoluteOrThrow = require_createAbsoluteOrThrow.createAbsoluteOrThrow;
56
+ exports.createKind = require_kind.createKind;
57
+ exports.createOrThrow = require_createOrThrow.createOrThrow;
58
+ exports.createSegment = require_createSegment.createSegment;
59
+ exports.createSegmentOrThrow = require_createSegmentOrThrow.createSegmentOrThrow;
60
+ exports.declareAbsolutePath = require_declareAbsolutePath.declareAbsolutePath;
61
+ exports.declarePath = require_declarePath.declarePath;
62
+ exports.declareSegment = require_declareSegment.declareSegment;
27
63
  exports.getBaseName = require_getBaseName.getBaseName;
28
64
  exports.getExtensionName = require_getExtensionName.getExtensionName;
29
65
  exports.getParentFolderPath = require_getParentFolderPath.getParentFolderPath;
@@ -1,11 +1,21 @@
1
1
  export * from './computeRelative';
2
2
  export type * from './constraints';
3
+ export * from './create';
4
+ export * from './createAbsolute';
5
+ export * from './createAbsoluteOrThrow';
6
+ export * from './createOrThrow';
7
+ export * from './createSegment';
8
+ export * from './createSegmentOrThrow';
9
+ export * from './declareAbsolutePath';
10
+ export * from './declarePath';
11
+ export * from './declareSegment';
3
12
  export * from './getBaseName';
4
13
  export * from './getExtensionName';
5
14
  export * from './getParentFolderPath';
6
15
  export * from './is';
7
16
  export * from './isAbsolute';
8
17
  export * from './isSegment';
18
+ export * from './kind';
9
19
  export * from './normalize';
10
20
  export * from './resolveFrom';
11
21
  export * from './resolveRelative';
@@ -1,17 +1,40 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
2
  import { computeRelative } from "./computeRelative.mjs";
3
+ import { normalize } from "./normalize.mjs";
4
+ import { create } from "./create.mjs";
5
+ import { is } from "./is.mjs";
6
+ import { isAbsolute } from "./isAbsolute.mjs";
7
+ import { createAbsolute } from "./createAbsolute.mjs";
8
+ import { createKind } from "./kind.mjs";
9
+ import { CreateAbsolutePathError, createAbsoluteOrThrow } from "./createAbsoluteOrThrow.mjs";
10
+ import { CreatePathError, createOrThrow } from "./createOrThrow.mjs";
3
11
  import { isSegment } from "./isSegment.mjs";
12
+ import { createSegment } from "./createSegment.mjs";
13
+ import { CreateSegmentPathError, createSegmentOrThrow } from "./createSegmentOrThrow.mjs";
14
+ import { declareAbsolutePath } from "./declareAbsolutePath.mjs";
15
+ import { declarePath } from "./declarePath.mjs";
16
+ import { declareSegment } from "./declareSegment.mjs";
4
17
  import { getBaseName } from "./getBaseName.mjs";
5
18
  import { getExtensionName } from "./getExtensionName.mjs";
6
19
  import { getParentFolderPath } from "./getParentFolderPath.mjs";
7
- import { is } from "./is.mjs";
8
- import { isAbsolute } from "./isAbsolute.mjs";
9
- import { normalize } from "./normalize.mjs";
10
20
  import { resolveRelative } from "./resolveRelative.mjs";
11
21
  import { resolveFrom } from "./resolveFrom.mjs";
12
22
  //#region scripts/path/index.ts
13
23
  var path_exports = /* @__PURE__ */ __exportAll({
24
+ CreateAbsolutePathError: () => CreateAbsolutePathError,
25
+ CreatePathError: () => CreatePathError,
26
+ CreateSegmentPathError: () => CreateSegmentPathError,
14
27
  computeRelative: () => computeRelative,
28
+ create: () => create,
29
+ createAbsolute: () => createAbsolute,
30
+ createAbsoluteOrThrow: () => createAbsoluteOrThrow,
31
+ createKind: () => createKind,
32
+ createOrThrow: () => createOrThrow,
33
+ createSegment: () => createSegment,
34
+ createSegmentOrThrow: () => createSegmentOrThrow,
35
+ declareAbsolutePath: () => declareAbsolutePath,
36
+ declarePath: () => declarePath,
37
+ declareSegment: () => declareSegment,
15
38
  getBaseName: () => getBaseName,
16
39
  getExtensionName: () => getExtensionName,
17
40
  getParentFolderPath: () => getParentFolderPath,
@@ -23,4 +46,4 @@ var path_exports = /* @__PURE__ */ __exportAll({
23
46
  resolveRelative: () => resolveRelative
24
47
  });
25
48
  //#endregion
26
- export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
49
+ export { CreateAbsolutePathError, CreatePathError, CreateSegmentPathError, computeRelative, create, createAbsolute, createAbsoluteOrThrow, createKind, createOrThrow, createSegment, createSegmentOrThrow, declareAbsolutePath, declarePath, declareSegment, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
@@ -0,0 +1,4 @@
1
+ //#region scripts/path/kind.ts
2
+ const createKind = require("../kind/namespace.cjs").createNamespace("DuplojsLangPath");
3
+ //#endregion
4
+ exports.createKind = createKind;
@@ -0,0 +1,2 @@
1
+ import * as DKind from '../kind';
2
+ export declare const createKind: <GenericName extends string, GenericKindValue extends unknown = unknown>(name: GenericName & import('../string').ForbiddenContain<GenericName, DKind.ForbiddenKindNameCharacter>) => DKind.Handler<DKind.Definition<`@DuplojsLangPath/${GenericName}`, GenericKindValue>>;
@@ -0,0 +1,5 @@
1
+ import { createNamespace } from "../kind/namespace.mjs";
2
+ //#region scripts/path/kind.ts
3
+ const createKind = createNamespace("DuplojsLangPath");
4
+ //#endregion
5
+ export { createKind };
@@ -16,6 +16,8 @@ const require_matchWithTaggedObject = require("./matchWithTaggedObject.cjs");
16
16
  const require_matchWithTaggedObjectOtherwise = require("./matchWithTaggedObjectOtherwise.cjs");
17
17
  const require_matchWithEntity = require("./matchWithEntity.cjs");
18
18
  const require_matchWithEntityOtherwise = require("./matchWithEntityOtherwise.cjs");
19
+ const require_matchWithFact = require("./matchWithFact.cjs");
20
+ const require_matchWithFactOtherwise = require("./matchWithFactOtherwise.cjs");
19
21
  //#region scripts/pattern/index.ts
20
22
  var pattern_exports = /* @__PURE__ */ require_runtime.__exportAll({
21
23
  InvalidExhaustivePatternError: () => require_builder.InvalidExhaustivePatternError,
@@ -26,6 +28,8 @@ var pattern_exports = /* @__PURE__ */ require_runtime.__exportAll({
26
28
  matchBuilder: () => require_builder.matchBuilder,
27
29
  matchWithEntity: () => require_matchWithEntity.matchWithEntity,
28
30
  matchWithEntityOtherwise: () => require_matchWithEntityOtherwise.matchWithEntityOtherwise,
31
+ matchWithFact: () => require_matchWithFact.matchWithFact,
32
+ matchWithFactOtherwise: () => require_matchWithFactOtherwise.matchWithFactOtherwise,
29
33
  matchWithNumber: () => require_matchWithNumber.matchWithNumber,
30
34
  matchWithNumberOtherwise: () => require_matchWithNumberOtherwise.matchWithNumberOtherwise,
31
35
  matchWithString: () => require_matchWithString.matchWithString,
@@ -47,6 +51,8 @@ exports.match = require_index.match;
47
51
  exports.matchBuilder = require_builder.matchBuilder;
48
52
  exports.matchWithEntity = require_matchWithEntity.matchWithEntity;
49
53
  exports.matchWithEntityOtherwise = require_matchWithEntityOtherwise.matchWithEntityOtherwise;
54
+ exports.matchWithFact = require_matchWithFact.matchWithFact;
55
+ exports.matchWithFactOtherwise = require_matchWithFactOtherwise.matchWithFactOtherwise;
50
56
  exports.matchWithNumber = require_matchWithNumber.matchWithNumber;
51
57
  exports.matchWithNumberOtherwise = require_matchWithNumberOtherwise.matchWithNumberOtherwise;
52
58
  exports.matchWithString = require_matchWithString.matchWithString;
@@ -15,3 +15,5 @@ export * from './matchWithTaggedObject';
15
15
  export * from './matchWithTaggedObjectOtherwise';
16
16
  export * from './matchWithEntity';
17
17
  export * from './matchWithEntityOtherwise';
18
+ export * from './matchWithFact';
19
+ export * from './matchWithFactOtherwise';
@@ -16,6 +16,8 @@ import { matchWithTaggedObject } from "./matchWithTaggedObject.mjs";
16
16
  import { matchWithTaggedObjectOtherwise } from "./matchWithTaggedObjectOtherwise.mjs";
17
17
  import { matchWithEntity } from "./matchWithEntity.mjs";
18
18
  import { matchWithEntityOtherwise } from "./matchWithEntityOtherwise.mjs";
19
+ import { matchWithFact } from "./matchWithFact.mjs";
20
+ import { matchWithFactOtherwise } from "./matchWithFactOtherwise.mjs";
19
21
  //#region scripts/pattern/index.ts
20
22
  var pattern_exports = /* @__PURE__ */ __exportAll({
21
23
  InvalidExhaustivePatternError: () => InvalidExhaustivePatternError,
@@ -26,6 +28,8 @@ var pattern_exports = /* @__PURE__ */ __exportAll({
26
28
  matchBuilder: () => matchBuilder,
27
29
  matchWithEntity: () => matchWithEntity,
28
30
  matchWithEntityOtherwise: () => matchWithEntityOtherwise,
31
+ matchWithFact: () => matchWithFact,
32
+ matchWithFactOtherwise: () => matchWithFactOtherwise,
29
33
  matchWithNumber: () => matchWithNumber,
30
34
  matchWithNumberOtherwise: () => matchWithNumberOtherwise,
31
35
  matchWithString: () => matchWithString,
@@ -39,4 +43,4 @@ var pattern_exports = /* @__PURE__ */ __exportAll({
39
43
  whenNot: () => whenNot
40
44
  });
41
45
  //#endregion
42
- export { InvalidExhaustivePatternError, exhaustive, isMatch, isResult, match, matchBuilder, matchWithEntity, matchWithEntityOtherwise, matchWithNumber, matchWithNumberOtherwise, matchWithString, matchWithStringOtherwise, matchWithTaggedObject, matchWithTaggedObjectOtherwise, otherwise, pattern_exports, result, union, when, whenNot };
46
+ export { InvalidExhaustivePatternError, exhaustive, isMatch, isResult, match, matchBuilder, matchWithEntity, matchWithEntityOtherwise, matchWithFact, matchWithFactOtherwise, matchWithNumber, matchWithNumberOtherwise, matchWithString, matchWithStringOtherwise, matchWithTaggedObject, matchWithTaggedObjectOtherwise, otherwise, pattern_exports, result, union, when, whenNot };
@@ -12,7 +12,7 @@ var InvalidExhaustivePatternError = class extends require_parentClass.parentClas
12
12
  }
13
13
  };
14
14
  const matchBuilder = require_justExec.justExec(() => {
15
- const builder = require_builder.createBuilder("@duplojs/utils/pattern/match");
15
+ const builder = require_builder.createBuilder("@duplojs/lang/pattern/match");
16
16
  builder.set("with", ({ args: [pattern, theFunction], accumulator, next }) => next({
17
17
  ...accumulator,
18
18
  matchers: [...accumulator.matchers, {
@@ -12,7 +12,7 @@ var InvalidExhaustivePatternError = class extends parentClass(createKind("invali
12
12
  }
13
13
  };
14
14
  const matchBuilder = justExec(() => {
15
- const builder = createBuilder("@duplojs/utils/pattern/match");
15
+ const builder = createBuilder("@duplojs/lang/pattern/match");
16
16
  builder.set("with", ({ args: [pattern, theFunction], accumulator, next }) => next({
17
17
  ...accumulator,
18
18
  matchers: [...accumulator.matchers, {
@@ -9,6 +9,6 @@ type ForbiddenMoreKey<GenericEntity extends DModeling.Entity, GenericMatcher ext
9
9
  type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
10
10
  type UnhandledEntity<GenericEntity extends DModeling.Entity, GenericMatcher extends object> = Exclude<GenericEntity, DModeling.ExtractByEntityName<GenericEntity, HandledKeys<GenericMatcher>>>;
11
11
  type RequireSimpleName<GenericEntity extends DModeling.Entity> = DString.RequireSimpleLiteral<DModeling.GetEntityName<GenericEntity>>;
12
- export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericEntity>, GenericMatcher>), otherwise: (value: UnhandledEntity<GenericEntity, GenericMatcher>) => GenericOutput): (input: GenericEntity & RequireSimpleName<GenericEntity>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
13
- export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(input: GenericEntity & RequireSimpleName<GenericEntity>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<GenericEntity, GenericMatcher>), otherwise: (value: UnhandledEntity<GenericEntity, GenericMatcher>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
12
+ export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericEntity>, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledEntity<GenericEntity, GenericMatcher>>) => GenericOutput): (input: GenericEntity & RequireSimpleName<GenericEntity>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
13
+ export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(input: GenericEntity & RequireSimpleName<GenericEntity>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<GenericEntity, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledEntity<GenericEntity, GenericMatcher>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
14
14
  export {};
@@ -0,0 +1,12 @@
1
+ const require_base = require("../modeling/fact/base.cjs");
2
+ //#region scripts/pattern/matchWithFact.ts
3
+ function matchWithFact(...args) {
4
+ if (args.length === 1) {
5
+ const [matcher] = args;
6
+ return (input) => matcher[require_base.factKind.getValue(input).name](input);
7
+ }
8
+ const [input, matcher] = args;
9
+ return matcher[require_base.factKind.getValue(input).name](input, require_base.factKind.getValue(input).payload);
10
+ }
11
+ //#endregion
12
+ exports.matchWithFact = matchWithFact;
@@ -0,0 +1,12 @@
1
+ import type * as DCommon from '../common';
2
+ import * as DModeling from '../modeling';
3
+ import type * as DObject from '../object';
4
+ import type * as DString from '../string';
5
+ type ComputeMatcher<GenericFact extends DModeling.Fact> = {
6
+ [Fact in GenericFact as DModeling.GetFactName<Fact>]: (value: Fact, payload: DModeling.GetFactPayload<Fact>) => unknown;
7
+ };
8
+ type ForbiddenMoreKey<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>> = DObject.ForbiddenKey<GenericMatcher, Extract<Exclude<keyof GenericMatcher, DModeling.GetFactName<GenericFact>>, string>>;
9
+ type RequireSimpleName<GenericFact extends DModeling.Fact> = DString.RequireSimpleLiteral<DModeling.GetFactName<GenericFact>>;
10
+ export declare function matchWithFact<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericFact>, GenericMatcher>)): (input: GenericFact & RequireSimpleName<GenericFact>) => ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>>;
11
+ export declare function matchWithFact<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>>(input: GenericFact & RequireSimpleName<GenericFact>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<GenericFact, GenericMatcher>)): ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>>;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import { factKind } from "../modeling/fact/base.mjs";
2
+ //#region scripts/pattern/matchWithFact.ts
3
+ function matchWithFact(...args) {
4
+ if (args.length === 1) {
5
+ const [matcher] = args;
6
+ return (input) => matcher[factKind.getValue(input).name](input);
7
+ }
8
+ const [input, matcher] = args;
9
+ return matcher[factKind.getValue(input).name](input, factKind.getValue(input).payload);
10
+ }
11
+ //#endregion
12
+ export { matchWithFact };
@@ -0,0 +1,13 @@
1
+ const require_base = require("../modeling/fact/base.cjs");
2
+ //#region scripts/pattern/matchWithFactOtherwise.ts
3
+ function matchWithFactOtherwise(...args) {
4
+ if (args.length === 2) {
5
+ const [matcher, otherwise] = args;
6
+ return (input) => matchWithFactOtherwise(input, matcher, otherwise);
7
+ }
8
+ const [input, matcher, otherwise] = args;
9
+ const factName = require_base.factKind.getValue(input).name;
10
+ return matcher[factName] === void 0 ? otherwise(input) : matcher[factName](input, require_base.factKind.getValue(input).payload);
11
+ }
12
+ //#endregion
13
+ exports.matchWithFactOtherwise = matchWithFactOtherwise;
@@ -0,0 +1,14 @@
1
+ import type * as DCommon from '../common';
2
+ import * as DModeling from '../modeling';
3
+ import type * as DObject from '../object';
4
+ import type * as DString from '../string';
5
+ type ComputeMatcher<GenericFact extends DModeling.Fact> = {
6
+ [Fact in GenericFact as DModeling.GetFactName<Fact>]?: (value: Fact, payload: DModeling.GetFactPayload<Fact>) => unknown;
7
+ };
8
+ type ForbiddenMoreKey<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>> = DObject.ForbiddenKey<GenericMatcher, Extract<Exclude<keyof GenericMatcher, DModeling.GetFactName<GenericFact>>, string>>;
9
+ type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
10
+ type UnhandledFact<GenericFact extends DModeling.Fact, GenericMatcher extends object> = GenericFact extends DModeling.Fact ? DModeling.GetFactName<GenericFact> extends HandledKeys<GenericMatcher> ? never : GenericFact : never;
11
+ type RequireSimpleName<GenericFact extends DModeling.Fact> = DString.RequireSimpleLiteral<DModeling.GetFactName<GenericFact>>;
12
+ export declare function matchWithFactOtherwise<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericFact>, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledFact<GenericFact, GenericMatcher>>) => GenericOutput): (input: GenericFact & RequireSimpleName<GenericFact>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
13
+ export declare function matchWithFactOtherwise<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>, GenericOutput>(input: GenericFact & RequireSimpleName<GenericFact>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<GenericFact, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledFact<GenericFact, GenericMatcher>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
14
+ export {};
@@ -0,0 +1,13 @@
1
+ import { factKind } from "../modeling/fact/base.mjs";
2
+ //#region scripts/pattern/matchWithFactOtherwise.ts
3
+ function matchWithFactOtherwise(...args) {
4
+ if (args.length === 2) {
5
+ const [matcher, otherwise] = args;
6
+ return (input) => matchWithFactOtherwise(input, matcher, otherwise);
7
+ }
8
+ const [input, matcher, otherwise] = args;
9
+ const factName = factKind.getValue(input).name;
10
+ return matcher[factName] === void 0 ? otherwise(input) : matcher[factName](input, factKind.getValue(input).payload);
11
+ }
12
+ //#endregion
13
+ export { matchWithFactOtherwise };
@@ -1,9 +1,9 @@
1
1
  import type * as DCommon from '../common';
2
2
  import type * as DNumber from '../number/types';
3
- type ComputeMatcher<GenericInput extends number> = {
3
+ type ComputeMatcher<GenericInput extends number> = DCommon.SimplifyType<{
4
4
  [Prop in GenericInput]: (value: Prop) => unknown;
5
- };
5
+ }>;
6
6
  type ForbiddenMoreKey<GenericInput extends number, GenericMatcher extends ComputeMatcher<GenericInput>> = Exclude<keyof GenericMatcher, GenericInput> extends infer InferredKey ? DCommon.IsEqual<InferredKey, never> extends true ? unknown : DCommon.ComputedTypeError<`Key "${Extract<InferredKey, number>}" is forbidden.`> : never;
7
- export declare function matchWithNumber<GenericInput extends number, GenericMatcher extends ComputeMatcher<GenericInput>>(matcher: GenericMatcher & ComputeMatcher<NoInfer<GenericInput>> & ForbiddenMoreKey<NoInfer<GenericInput>, GenericMatcher>): (input: GenericInput & DNumber.RequireSimpleLiteral<GenericInput>) => ReturnType<NoInfer<GenericMatcher>[keyof GenericMatcher]>;
8
- export declare function matchWithNumber<GenericInput extends number, GenericMatcher extends ComputeMatcher<GenericInput>>(input: GenericInput & DNumber.RequireSimpleLiteral<GenericInput>, matcher: DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericInput>, GenericMatcher> & ForbiddenMoreKey<GenericInput, GenericMatcher>): ReturnType<GenericMatcher[keyof GenericMatcher]>;
7
+ export declare function matchWithNumber<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>)): (input: GenericInput & DNumber.RequireSimpleLiteral<GenericClearInput>) => ReturnType<GenericMatcher[keyof GenericMatcher]>;
8
+ export declare function matchWithNumber<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>>(input: GenericInput & DNumber.RequireSimpleLiteral<GenericClearInput>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>)): ReturnType<GenericMatcher[keyof GenericMatcher]>;
9
9
  export {};