@duplojs/lang 0.0.1-beta.5 → 0.0.1-beta.6

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 (49) hide show
  1. package/dist/common/constraint/cast/string.d.ts +6 -2
  2. package/dist/common/constraint/infer/string.d.ts +3 -2
  3. package/dist/dataStructure/constraint/defaults/index.d.ts +1 -0
  4. package/dist/dataStructure/constraint/defaults/segmentPath.cjs +13 -0
  5. package/dist/dataStructure/constraint/defaults/segmentPath.d.ts +10 -0
  6. package/dist/dataStructure/constraint/defaults/segmentPath.mjs +12 -0
  7. package/dist/dataStructure/constraint/types/constraints.d.ts +2 -1
  8. package/dist/dataStructure/helpers/index.d.ts +1 -0
  9. package/dist/dataStructure/helpers/segmentPath.cjs +7 -0
  10. package/dist/dataStructure/helpers/segmentPath.d.ts +2 -0
  11. package/dist/dataStructure/helpers/segmentPath.mjs +7 -0
  12. package/dist/dataStructure/index.cjs +8 -0
  13. package/dist/dataStructure/index.mjs +6 -1
  14. package/dist/modeling/entity/namespace.cjs +1 -1
  15. package/dist/modeling/entity/namespace.mjs +2 -2
  16. package/dist/modeling/index.cjs +2 -2
  17. package/dist/modeling/index.mjs +3 -3
  18. package/dist/modeling/newType/helper.cjs +2 -2
  19. package/dist/modeling/newType/helper.d.ts +1 -1
  20. package/dist/modeling/newType/helper.mjs +2 -2
  21. package/dist/modeling/taggedObject/helper.cjs +7 -2
  22. package/dist/modeling/taggedObject/helper.d.ts +1 -0
  23. package/dist/modeling/taggedObject/helper.mjs +7 -2
  24. package/dist/path/constraints/index.d.ts +2 -1
  25. package/dist/path/constraints/segment.d.ts +3 -0
  26. package/dist/path/getBaseName.cjs +3 -1
  27. package/dist/path/getBaseName.d.ts +2 -2
  28. package/dist/path/getBaseName.mjs +3 -1
  29. package/dist/path/getExtensionName.cjs +3 -1
  30. package/dist/path/getExtensionName.d.ts +2 -2
  31. package/dist/path/getExtensionName.mjs +3 -1
  32. package/dist/path/index.cjs +3 -0
  33. package/dist/path/index.d.ts +1 -0
  34. package/dist/path/index.mjs +3 -1
  35. package/dist/path/isSegment.cjs +6 -0
  36. package/dist/path/isSegment.d.ts +4 -0
  37. package/dist/path/isSegment.mjs +6 -0
  38. package/dist/path/resolveFrom.d.ts +2 -2
  39. package/dist/path/resolveRelative.d.ts +3 -3
  40. package/dist/path/types/index.d.ts +2 -0
  41. package/dist/path/types/isLiteralSegmentPath.d.ts +9 -0
  42. package/dist/path/types/requireLiteralSegmentPath.d.ts +3 -0
  43. package/dist/tuple/from.cjs +6 -0
  44. package/dist/tuple/from.d.ts +8 -0
  45. package/dist/tuple/from.mjs +6 -0
  46. package/dist/tuple/index.cjs +6 -1
  47. package/dist/tuple/index.d.ts +1 -0
  48. package/dist/tuple/index.mjs +6 -2
  49. package/package.json +1 -1
@@ -9,10 +9,14 @@ export interface ComputeCastConstraintStringRule<GenericValue extends string, Ge
9
9
  lengthEqual: GenericExpectedConstraint extends DString.LengthEqual<number> ? DCommon.NeverCoalescing<(DString.ComputeLengthEqualCompatibility<GenericValue, GenericExpectedConstraint, unknown> extends infer InferredResult extends CompatibilityConstraintResult<boolean, number, number> ? InferredResult extends CompatibilityConstraintResult<true> ? unknown : CastError<`Impossible to cast on LengthEqual<${InferredResult["to"]}> because constraint LengthEqual<${InferredResult["from"]}> from the value is not equal.`, GenericValue, GenericExpectedConstraint> : never), CastError<"Impossible to cast on LengthEqual because value does not have LengthEqual constraint.", GenericValue, GenericExpectedConstraint>> : never;
10
10
  path: DCommon.IsExtends<GenericExpectedConstraint, DPath.Path> extends true ? DCommon.Or<[
11
11
  DPath.IsLiteralPath<GenericValue>,
12
- DCommon.IsExtends<GenericValue, DPath.Path | DPath.Absolute>
12
+ DCommon.IsExtends<GenericValue, DPath.Path | DPath.Absolute | DPath.Segment>
13
13
  ]> extends true ? unknown : CastError<`Impossible to cast on Path because value ${GenericValue} is not path.`, GenericValue, GenericExpectedConstraint> : never;
14
14
  absolutePath: DCommon.IsExtends<GenericExpectedConstraint, DPath.Absolute> extends true ? DCommon.Or<[
15
15
  DPath.IsLiteralAbsolutePath<GenericValue>,
16
16
  DCommon.IsExtends<GenericValue, DPath.Absolute>
17
- ]> extends true ? unknown : CastError<`Impossible to cast on Absolute Path because value ${GenericValue} is not absolute path.`, GenericValue, GenericExpectedConstraint> : never;
17
+ ]> extends true ? unknown : CastError<`Impossible to cast on AbsolutePath because value ${GenericValue} is not absolute path.`, GenericValue, GenericExpectedConstraint> : never;
18
+ segment: DCommon.IsExtends<GenericExpectedConstraint, DPath.Segment> extends true ? DCommon.Or<[
19
+ DPath.IsLiteralSegmentPath<GenericValue>,
20
+ DCommon.IsExtends<GenericValue, DPath.Segment>
21
+ ]> extends true ? unknown : CastError<`Impossible to cast on SegmentPath because value ${GenericValue} is not segment path.`, GenericValue, GenericExpectedConstraint> : never;
18
22
  }
@@ -5,6 +5,7 @@ export interface ComputeInferConstraintStringRule<GenericInput extends string, G
5
5
  maxCharacters: DString.ComputeMaxCharactersCompatibility<GenericInput, GenericOutput, unknown> extends infer InferredResult extends DCommon.CompatibilityConstraintResult<boolean, number, number> ? InferredResult extends DCommon.CompatibilityConstraintResult<true> ? DString.MaxCharacters<InferredResult["to"]> : DCommon.ComputedTypeError<`Impossible to cast on MaxCharacters<${InferredResult["to"]}> because constraint MaxCharacters<${InferredResult["from"]}> from the value is more than.`> : never;
6
6
  minCharacters: DString.ComputeMinCharactersCompatibility<GenericInput, GenericOutput, unknown> extends infer InferredResult extends DCommon.CompatibilityConstraintResult<boolean, number, number> ? InferredResult extends DCommon.CompatibilityConstraintResult<true> ? DString.MinCharacters<InferredResult["to"]> : DCommon.ComputedTypeError<`Impossible to cast on MinCharacters<${InferredResult["to"]}> because constraint MinCharacters<${InferredResult["from"]}> from the value is less than.`> : never;
7
7
  lengthEqual: DString.ComputeLengthEqualCompatibility<GenericInput, GenericOutput, unknown> extends infer InferredResult extends DCommon.CompatibilityConstraintResult<boolean, number, number> ? InferredResult extends DCommon.CompatibilityConstraintResult<true> ? DString.LengthEqual<InferredResult["to"]> : DCommon.ComputedTypeError<`Impossible to cast on LengthEqual<${InferredResult["to"]}> because constraint LengthEqual<${InferredResult["from"]}> from the value is not equal.`> : never;
8
- path: DCommon.IsExtends<GenericOutput, DPath.Path | DPath.Absolute> extends true ? DPath.IsLiteralPath<GenericInput> extends true ? DPath.Path : DCommon.ComputedTypeError<`Impossible to cast on Path because value ${GenericInput} is not path.`> : never;
9
- absolutePath: DCommon.IsExtends<GenericOutput, DPath.Absolute> extends true ? DPath.IsLiteralAbsolutePath<GenericInput> extends true ? DPath.Absolute : DCommon.ComputedTypeError<`Impossible to cast on Absolute Path because value ${GenericInput} is not absolute path.`> : never;
8
+ path: DCommon.IsExtends<GenericOutput, DPath.Path> extends true ? DPath.IsLiteralPath<GenericInput> extends true ? DPath.Path : DCommon.ComputedTypeError<`Impossible to cast on Path because value ${GenericInput} is not path.`> : never;
9
+ absolutePath: DCommon.IsExtends<GenericOutput, DPath.Absolute> extends true ? DPath.IsLiteralAbsolutePath<GenericInput> extends true ? DPath.Absolute : DCommon.ComputedTypeError<`Impossible to cast on AbsolutePath because value ${GenericInput} is not absolute path.`> : never;
10
+ segment: DCommon.IsExtends<GenericOutput, DPath.Segment> extends true ? DPath.IsLiteralSegmentPath<GenericInput> extends true ? DPath.Segment : DCommon.ComputedTypeError<`Impossible to cast on SegmentPath because value ${GenericInput} is not segment path.`> : never;
10
11
  }
@@ -23,6 +23,7 @@ export * from './path';
23
23
  export * from './positive';
24
24
  export * from './refine';
25
25
  export * from './safe';
26
+ export * from './segmentPath';
26
27
  export * from './strictNegative';
27
28
  export * from './strictPositive';
28
29
  export * from './stringLengthEqual';
@@ -0,0 +1,13 @@
1
+ const require_kind = require("../../kind.cjs");
2
+ const require_resultSymbol = require("../../common/resultSymbol.cjs");
3
+ const require_base = require("../base.cjs");
4
+ const require_isSegment = require("../../../path/isSegment.cjs");
5
+ //#region scripts/dataStructure/constraint/defaults/segmentPath.ts
6
+ const segmentPathConstraintKind = require_kind.createKind("segment-path-constraint");
7
+ const SegmentPathConstraint = require_base.createConstraint(segmentPathConstraintKind, ({ init }) => () => init({}, {
8
+ executeCheck: (_self, data) => require_isSegment.isSegment(data) ? require_resultSymbol.SuccessSymbol : require_resultSymbol.ErrorSymbol,
9
+ isAsynchronous: () => false
10
+ }));
11
+ //#endregion
12
+ exports.SegmentPathConstraint = SegmentPathConstraint;
13
+ exports.segmentPathConstraintKind = segmentPathConstraintKind;
@@ -0,0 +1,10 @@
1
+ import { ConstraintDefinition, Constraint } from '../base';
2
+ import type * as DCommon from '../../../common';
3
+ import type * as DKind from '../../../kind';
4
+ import * as DPath from '../../../path';
5
+ export declare const segmentPathConstraintKind: DKind.Handler<DKind.Definition<"@DuplojsLangDataStructure/segment-path-constraint", unknown>>;
6
+ export interface SegmentPathConstraintDefinition extends ConstraintDefinition {
7
+ }
8
+ export interface SegmentPathConstraint extends DCommon.Forward<Constraint<string, string & DPath.Segment, SegmentPathConstraintDefinition> & DKind.Kind<typeof segmentPathConstraintKind>> {
9
+ }
10
+ export declare const SegmentPathConstraint: () => SegmentPathConstraint;
@@ -0,0 +1,12 @@
1
+ import { createKind } from "../../kind.mjs";
2
+ import { ErrorSymbol, SuccessSymbol } from "../../common/resultSymbol.mjs";
3
+ import { createConstraint } from "../base.mjs";
4
+ import { isSegment } from "../../../path/isSegment.mjs";
5
+ //#region scripts/dataStructure/constraint/defaults/segmentPath.ts
6
+ const segmentPathConstraintKind = createKind("segment-path-constraint");
7
+ const SegmentPathConstraint = createConstraint(segmentPathConstraintKind, ({ init }) => () => init({}, {
8
+ executeCheck: (_self, data) => isSegment(data) ? SuccessSymbol : ErrorSymbol,
9
+ isAsynchronous: () => false
10
+ }));
11
+ //#endregion
12
+ export { SegmentPathConstraint, segmentPathConstraintKind };
@@ -1,7 +1,6 @@
1
1
  import { Constraint } from '../base';
2
2
  import type * as DDefaults from "../defaults";
3
3
  export interface ConstraintsStore {
4
- absolutePath: DDefaults.AbsolutePathConstraint;
5
4
  allowedCharacters: DDefaults.AllowedCharactersConstraint;
6
5
  email: DDefaults.EmailConstraint;
7
6
  url: DDefaults.UrlConstraint;
@@ -31,7 +30,9 @@ export interface ConstraintsStore {
31
30
  greaterThanOrEqual: DDefaults.GreaterThanOrEqualConstraint;
32
31
  lessThan: DDefaults.LessThanConstraint;
33
32
  lessThanOrEqual: DDefaults.LessThanOrEqualConstraint;
33
+ absolutePath: DDefaults.AbsolutePathConstraint;
34
34
  path: DDefaults.PathConstraint;
35
+ segmentPath: DDefaults.SegmentPathConstraint;
35
36
  refine: DDefaults.RefineConstraint;
36
37
  }
37
38
  export type Constraints = Extract<ConstraintsStore[keyof ConstraintsStore], Constraint>;
@@ -40,6 +40,7 @@ export * from './record';
40
40
  export * from './refine';
41
41
  export * from './required';
42
42
  export * from './safe';
43
+ export * from './segmentPath';
43
44
  export * from './string';
44
45
  export * from './strictNegative';
45
46
  export * from './strictPositive';
@@ -0,0 +1,7 @@
1
+ const require_segmentPath = require("../constraint/defaults/segmentPath.cjs");
2
+ //#region scripts/dataStructure/helpers/segmentPath.ts
3
+ function segmentPath() {
4
+ return require_segmentPath.SegmentPathConstraint();
5
+ }
6
+ //#endregion
7
+ exports.segmentPath = segmentPath;
@@ -0,0 +1,2 @@
1
+ import { SegmentPathConstraint } from '../constraint';
2
+ export declare function segmentPath(): SegmentPathConstraint;
@@ -0,0 +1,7 @@
1
+ import { SegmentPathConstraint } from "../constraint/defaults/segmentPath.mjs";
2
+ //#region scripts/dataStructure/helpers/segmentPath.ts
3
+ function segmentPath() {
4
+ return SegmentPathConstraint();
5
+ }
6
+ //#endregion
7
+ export { segmentPath };
@@ -30,6 +30,7 @@ const require_path = require("./constraint/defaults/path.cjs");
30
30
  const require_positive = require("./constraint/defaults/positive.cjs");
31
31
  const require_refine = require("./constraint/defaults/refine.cjs");
32
32
  const require_safe = require("./constraint/defaults/safe.cjs");
33
+ const require_segmentPath = require("./constraint/defaults/segmentPath.cjs");
33
34
  const require_strictNegative = require("./constraint/defaults/strictNegative.cjs");
34
35
  const require_strictPositive = require("./constraint/defaults/strictPositive.cjs");
35
36
  const require_stringLengthEqual = require("./constraint/defaults/stringLengthEqual.cjs");
@@ -115,6 +116,7 @@ const require_record$1 = require("./helpers/record.cjs");
115
116
  const require_refine$1 = require("./helpers/refine.cjs");
116
117
  const require_required = require("./helpers/required.cjs");
117
118
  const require_safe$1 = require("./helpers/safe.cjs");
119
+ const require_segmentPath$1 = require("./helpers/segmentPath.cjs");
118
120
  const require_string$2 = require("./helpers/string.cjs");
119
121
  const require_strictNegative$1 = require("./helpers/strictNegative.cjs");
120
122
  const require_strictPositive$1 = require("./helpers/strictPositive.cjs");
@@ -166,6 +168,7 @@ var dataStructure_exports = /* @__PURE__ */ require_runtime.__exportAll({
166
168
  RefineConstraint: () => require_refine.RefineConstraint,
167
169
  RegexConstraint: () => require_regex.RegexConstraint,
168
170
  SafeConstraint: () => require_safe.SafeConstraint,
171
+ SegmentPathConstraint: () => require_segmentPath.SegmentPathConstraint,
169
172
  StrictNegativeConstraint: () => require_strictNegative.StrictNegativeConstraint,
170
173
  StrictPositiveConstraint: () => require_strictPositive.StrictPositiveConstraint,
171
174
  StringLengthEqualConstraint: () => require_stringLengthEqual.StringLengthEqualConstraint,
@@ -294,6 +297,8 @@ var dataStructure_exports = /* @__PURE__ */ require_runtime.__exportAll({
294
297
  required: () => require_required.required,
295
298
  safe: () => require_safe$1.safe,
296
299
  safeConstraintKind: () => require_safe.safeConstraintKind,
300
+ segmentPath: () => require_segmentPath$1.segmentPath,
301
+ segmentPathConstraintKind: () => require_segmentPath.segmentPathConstraintKind,
297
302
  strictNegative: () => require_strictNegative$1.strictNegative,
298
303
  strictNegativeConstraintKind: () => require_strictNegative.strictNegativeConstraintKind,
299
304
  strictPositive: () => require_strictPositive$1.strictPositive,
@@ -365,6 +370,7 @@ exports.RecordStructure = require_record.RecordStructure;
365
370
  exports.RefineConstraint = require_refine.RefineConstraint;
366
371
  exports.RegexConstraint = require_regex.RegexConstraint;
367
372
  exports.SafeConstraint = require_safe.SafeConstraint;
373
+ exports.SegmentPathConstraint = require_segmentPath.SegmentPathConstraint;
368
374
  exports.StrictNegativeConstraint = require_strictNegative.StrictNegativeConstraint;
369
375
  exports.StrictPositiveConstraint = require_strictPositive.StrictPositiveConstraint;
370
376
  exports.StringLengthEqualConstraint = require_stringLengthEqual.StringLengthEqualConstraint;
@@ -499,6 +505,8 @@ exports.regexConstraintKind = require_regex.regexConstraintKind;
499
505
  exports.required = require_required.required;
500
506
  exports.safe = require_safe$1.safe;
501
507
  exports.safeConstraintKind = require_safe.safeConstraintKind;
508
+ exports.segmentPath = require_segmentPath$1.segmentPath;
509
+ exports.segmentPathConstraintKind = require_segmentPath.segmentPathConstraintKind;
502
510
  exports.strictNegative = require_strictNegative$1.strictNegative;
503
511
  exports.strictNegativeConstraintKind = require_strictNegative.strictNegativeConstraintKind;
504
512
  exports.strictPositive = require_strictPositive$1.strictPositive;
@@ -30,6 +30,7 @@ import { PathConstraint, pathConstraintKind } from "./constraint/defaults/path.m
30
30
  import { PositiveConstraint, positiveConstraintKind } from "./constraint/defaults/positive.mjs";
31
31
  import { RefineConstraint, refineConstraintKind } from "./constraint/defaults/refine.mjs";
32
32
  import { SafeConstraint, safeConstraintKind } from "./constraint/defaults/safe.mjs";
33
+ import { SegmentPathConstraint, segmentPathConstraintKind } from "./constraint/defaults/segmentPath.mjs";
33
34
  import { StrictNegativeConstraint, strictNegativeConstraintKind } from "./constraint/defaults/strictNegative.mjs";
34
35
  import { StrictPositiveConstraint, strictPositiveConstraintKind } from "./constraint/defaults/strictPositive.mjs";
35
36
  import { StringLengthEqualConstraint, stringLengthEqualConstraintKind } from "./constraint/defaults/stringLengthEqual.mjs";
@@ -115,6 +116,7 @@ import { record } from "./helpers/record.mjs";
115
116
  import { refine } from "./helpers/refine.mjs";
116
117
  import { required } from "./helpers/required.mjs";
117
118
  import { safe } from "./helpers/safe.mjs";
119
+ import { segmentPath } from "./helpers/segmentPath.mjs";
118
120
  import { string } from "./helpers/string.mjs";
119
121
  import { strictNegative } from "./helpers/strictNegative.mjs";
120
122
  import { strictPositive } from "./helpers/strictPositive.mjs";
@@ -166,6 +168,7 @@ var dataStructure_exports = /* @__PURE__ */ __exportAll({
166
168
  RefineConstraint: () => RefineConstraint,
167
169
  RegexConstraint: () => RegexConstraint,
168
170
  SafeConstraint: () => SafeConstraint,
171
+ SegmentPathConstraint: () => SegmentPathConstraint,
169
172
  StrictNegativeConstraint: () => StrictNegativeConstraint,
170
173
  StrictPositiveConstraint: () => StrictPositiveConstraint,
171
174
  StringLengthEqualConstraint: () => StringLengthEqualConstraint,
@@ -294,6 +297,8 @@ var dataStructure_exports = /* @__PURE__ */ __exportAll({
294
297
  required: () => required,
295
298
  safe: () => safe,
296
299
  safeConstraintKind: () => safeConstraintKind,
300
+ segmentPath: () => segmentPath,
301
+ segmentPathConstraintKind: () => segmentPathConstraintKind,
297
302
  strictNegative: () => strictNegative,
298
303
  strictNegativeConstraintKind: () => strictNegativeConstraintKind,
299
304
  strictPositive: () => strictPositive,
@@ -325,4 +330,4 @@ var dataStructure_exports = /* @__PURE__ */ __exportAll({
325
330
  uuidConstraintKind: () => uuidConstraintKind
326
331
  });
327
332
  //#endregion
328
- export { AbsolutePathConstraint, AllowedCharactersConstraint, ArrayLengthEqualConstraint, ArrayStructure, BetweenThanConstraint, BetweenThanOrEqualConstraint, BigintLiteralType, BigintType, BooleanLiteralType, BooleanType, DateType, EmailConstraint, ErrorSymbol, EvenConstraint, GreaterThanConstraint, GreaterThanOrEqualConstraint, IntegerConstraint, LazyStructure, LessThanConstraint, LessThanOrEqualConstraint, MaxCharactersConstraint, MaxElementsConstraint, MinCharactersConstraint, MinElementsConstraint, MultipleOfConstraint, NegativeConstraint, NonEncodableStringStructure, NotEmptyConstraint, NotZeroConstraint, NullType, NumberLiteralType, NumberType, ObjectStructure, OddConstraint, PathConstraint, PositiveConstraint, RecordStructure, RefineConstraint, RegexConstraint, SafeConstraint, StrictNegativeConstraint, StrictPositiveConstraint, StringLengthEqualConstraint, StringLiteralType, StringType, StructureClass, SuccessSymbol, TheBigint, TheBoolean, TheDate, TheNull, TheNumber, TheString, TheTime, TheUndefined, TimeType, TrimmedConstraint, TypeStructure, UndefinedType, UnionStructure, UrlConstraint, UuidConstraint, absolutePath, absolutePathConstraintKind, allowedCharacters, allowedCharactersConstraintKind, array, arrayLengthEqual, arrayLengthEqualConstraintKind, arrayStructureKind, betweenThan, betweenThanConstraintKind, betweenThanOrEqual, betweenThanOrEqualConstraintKind, bigint, bigintFundamentalTypeKind, bigintLiteralTypeKind, bigintTypeKind, boolean, booleanFundamentalTypeKind, booleanLiteralTypeKind, booleanTypeKind, codecKind, codecsKind, constraintIdentifier, constraintKind, createCodec, createCodecs, createConstraint, createErrorHandler, createErrorInterpreter, createFundamentalType, createGetErrorHandler, createKind, createStructure, createType, dataStructure_exports, date, dateFundamentalTypeKind, dateTypeKind, decodeIssueKind, email, emailConstraintKind, encodeIssueKind, even, evenConstraintKind, extend, fundamentalTypeIdentifier, fundamentalTypeKind, greaterThan, greaterThanConstraintKind, greaterThanOrEqual, greaterThanOrEqualConstraintKind, integer, integerConstraintKind, isNullStructure, isUndefinedStructure, issueKind, lazy, lazyStructureKind, lessThan, lessThanConstraintKind, lessThanOrEqual, lessThanOrEqualConstraintKind, literal, maxCharacters, maxCharactersConstraintKind, maxElements, maxElementsConstraintKind, minCharacters, minCharactersConstraintKind, minElements, minElementsConstraintKind, multipleOf, multipleOfConstraintKind, negative, negativeConstraintKind, nonEncodableStringStructureKind, notEmpty, notEmptyConstraintKind, notZero, notZeroConstraintKind, nullHelper as null, nullFundamentalTypeKind, nullTypeKind, nullable, number, numberFundamentalTypeKind, numberLiteralTypeKind, numberTypeKind, object, objectStructureKind, odd, oddConstraintKind, optional, partial, path, pathConstraintKind, positive, positiveConstraintKind, record, recordStructureKind, refine, refineConstraintKind, regex, regexConstraintKind, required, safe, safeConstraintKind, strictNegative, strictNegativeConstraintKind, strictPositive, strictPositiveConstraintKind, string, stringFundamentalTypeKind, stringLengthEqual, stringLengthEqualConstraintKind, stringLiteralTypeKind, stringTypeKind, structureIdentifier, structureKind, time, timeFundamentalTypeKind, timeTypeKind, trimmed, trimmedConstraintKind, typeIdentifier, typeKind, typeStructureKind, undefinedHelper as undefined, undefinedFundamentalTypeKind, undefinedTypeKind, union, unionStructureKind, url, urlConstraintKind, uuid, uuidConstraintKind };
333
+ export { AbsolutePathConstraint, AllowedCharactersConstraint, ArrayLengthEqualConstraint, ArrayStructure, BetweenThanConstraint, BetweenThanOrEqualConstraint, BigintLiteralType, BigintType, BooleanLiteralType, BooleanType, DateType, EmailConstraint, ErrorSymbol, EvenConstraint, GreaterThanConstraint, GreaterThanOrEqualConstraint, IntegerConstraint, LazyStructure, LessThanConstraint, LessThanOrEqualConstraint, MaxCharactersConstraint, MaxElementsConstraint, MinCharactersConstraint, MinElementsConstraint, MultipleOfConstraint, NegativeConstraint, NonEncodableStringStructure, NotEmptyConstraint, NotZeroConstraint, NullType, NumberLiteralType, NumberType, ObjectStructure, OddConstraint, PathConstraint, PositiveConstraint, RecordStructure, RefineConstraint, RegexConstraint, SafeConstraint, SegmentPathConstraint, StrictNegativeConstraint, StrictPositiveConstraint, StringLengthEqualConstraint, StringLiteralType, StringType, StructureClass, SuccessSymbol, TheBigint, TheBoolean, TheDate, TheNull, TheNumber, TheString, TheTime, TheUndefined, TimeType, TrimmedConstraint, TypeStructure, UndefinedType, UnionStructure, UrlConstraint, UuidConstraint, absolutePath, absolutePathConstraintKind, allowedCharacters, allowedCharactersConstraintKind, array, arrayLengthEqual, arrayLengthEqualConstraintKind, arrayStructureKind, betweenThan, betweenThanConstraintKind, betweenThanOrEqual, betweenThanOrEqualConstraintKind, bigint, bigintFundamentalTypeKind, bigintLiteralTypeKind, bigintTypeKind, boolean, booleanFundamentalTypeKind, booleanLiteralTypeKind, booleanTypeKind, codecKind, codecsKind, constraintIdentifier, constraintKind, createCodec, createCodecs, createConstraint, createErrorHandler, createErrorInterpreter, createFundamentalType, createGetErrorHandler, createKind, createStructure, createType, dataStructure_exports, date, dateFundamentalTypeKind, dateTypeKind, decodeIssueKind, email, emailConstraintKind, encodeIssueKind, even, evenConstraintKind, extend, fundamentalTypeIdentifier, fundamentalTypeKind, greaterThan, greaterThanConstraintKind, greaterThanOrEqual, greaterThanOrEqualConstraintKind, integer, integerConstraintKind, isNullStructure, isUndefinedStructure, issueKind, lazy, lazyStructureKind, lessThan, lessThanConstraintKind, lessThanOrEqual, lessThanOrEqualConstraintKind, literal, maxCharacters, maxCharactersConstraintKind, maxElements, maxElementsConstraintKind, minCharacters, minCharactersConstraintKind, minElements, minElementsConstraintKind, multipleOf, multipleOfConstraintKind, negative, negativeConstraintKind, nonEncodableStringStructureKind, notEmpty, notEmptyConstraintKind, notZero, notZeroConstraintKind, nullHelper as null, nullFundamentalTypeKind, nullTypeKind, nullable, number, numberFundamentalTypeKind, numberLiteralTypeKind, numberTypeKind, object, objectStructureKind, odd, oddConstraintKind, optional, partial, path, pathConstraintKind, positive, positiveConstraintKind, record, recordStructureKind, refine, refineConstraintKind, regex, regexConstraintKind, required, safe, safeConstraintKind, segmentPath, segmentPathConstraintKind, strictNegative, strictNegativeConstraintKind, strictPositive, strictPositiveConstraintKind, string, stringFundamentalTypeKind, stringLengthEqual, stringLengthEqualConstraintKind, stringLiteralTypeKind, stringTypeKind, structureIdentifier, structureKind, time, timeFundamentalTypeKind, timeTypeKind, trimmed, trimmedConstraintKind, typeIdentifier, typeKind, typeStructureKind, undefinedHelper as undefined, undefinedFundamentalTypeKind, undefinedTypeKind, union, unionStructureKind, url, urlConstraintKind, uuid, uuidConstraintKind };
@@ -7,7 +7,7 @@ const namespaceKind = require_kind.createKind("namespace");
7
7
  function createEntityNamespace(entityName) {
8
8
  return {
9
9
  name: entityName,
10
- createNewType: (name, structure, newTypeConstraints = []) => require_helper$1.createNewEntity(`${entityName}${name}`, structure, newTypeConstraints),
10
+ createNewType: (name, structure, newTypeConstraints = []) => require_helper$1.createNewType(`${entityName}${name}`, structure, newTypeConstraints),
11
11
  createEntity: (shape) => require_helper.createEntity(entityName, shape),
12
12
  createFlag: (entityStructure, name, valueStructure) => require_base.createFlag(entityStructure, `${entityName}${name}`, valueStructure),
13
13
  [namespaceKind.runTimeKey]: null
@@ -1,13 +1,13 @@
1
1
  import { createKind } from "../kind.mjs";
2
2
  import { createEntity } from "./helper.mjs";
3
- import { createNewEntity } from "../newType/helper.mjs";
3
+ import { createNewType } from "../newType/helper.mjs";
4
4
  import { createFlag } from "../flag/base.mjs";
5
5
  //#region scripts/modeling/entity/namespace.ts
6
6
  const namespaceKind = createKind("namespace");
7
7
  function createEntityNamespace(entityName) {
8
8
  return {
9
9
  name: entityName,
10
- createNewType: (name, structure, newTypeConstraints = []) => createNewEntity(`${entityName}${name}`, structure, newTypeConstraints),
10
+ createNewType: (name, structure, newTypeConstraints = []) => createNewType(`${entityName}${name}`, structure, newTypeConstraints),
11
11
  createEntity: (shape) => createEntity(entityName, shape),
12
12
  createFlag: (entityStructure, name, valueStructure) => createFlag(entityStructure, `${entityName}${name}`, valueStructure),
13
13
  [namespaceKind.runTimeKey]: null
@@ -17,7 +17,7 @@ var modeling_exports = /* @__PURE__ */ require_runtime.__exportAll({
17
17
  createEntityNamespace: () => require_namespace.createEntityNamespace,
18
18
  createFlag: () => require_base$2.createFlag,
19
19
  createKind: () => require_kind.createKind,
20
- createNewEntity: () => require_helper$1.createNewEntity,
20
+ createNewType: () => require_helper$1.createNewType,
21
21
  createTaggedObject: () => require_helper$2.createTaggedObject,
22
22
  entityKind: () => require_base.entityKind,
23
23
  entityStructureKind: () => require_base.entityStructureKind,
@@ -38,7 +38,7 @@ exports.createEntity = require_helper.createEntity;
38
38
  exports.createEntityNamespace = require_namespace.createEntityNamespace;
39
39
  exports.createFlag = require_base$2.createFlag;
40
40
  exports.createKind = require_kind.createKind;
41
- exports.createNewEntity = require_helper$1.createNewEntity;
41
+ exports.createNewType = require_helper$1.createNewType;
42
42
  exports.createTaggedObject = require_helper$2.createTaggedObject;
43
43
  exports.entityKind = require_base.entityKind;
44
44
  exports.entityStructureKind = require_base.entityStructureKind;
@@ -3,7 +3,7 @@ import { createKind } from "./kind.mjs";
3
3
  import { EntityStructure, entityKind, entityStructureKind } from "./entity/base.mjs";
4
4
  import { createEntity } from "./entity/helper.mjs";
5
5
  import { NewTypeStructure, newTypeStructureKind } from "./newType/base.mjs";
6
- import { createNewEntity } from "./newType/helper.mjs";
6
+ import { createNewType } from "./newType/helper.mjs";
7
7
  import { createFlag, flagKind } from "./flag/base.mjs";
8
8
  import { createEntityNamespace, namespaceKind } from "./entity/namespace.mjs";
9
9
  import { TaggedObjectStructure, objectTagKind, taggedObjectStructureKind } from "./taggedObject/base.mjs";
@@ -17,7 +17,7 @@ var modeling_exports = /* @__PURE__ */ __exportAll({
17
17
  createEntityNamespace: () => createEntityNamespace,
18
18
  createFlag: () => createFlag,
19
19
  createKind: () => createKind,
20
- createNewEntity: () => createNewEntity,
20
+ createNewType: () => createNewType,
21
21
  createTaggedObject: () => createTaggedObject,
22
22
  entityKind: () => entityKind,
23
23
  entityStructureKind: () => entityStructureKind,
@@ -31,4 +31,4 @@ var modeling_exports = /* @__PURE__ */ __exportAll({
31
31
  taggedObjectStructureKind: () => taggedObjectStructureKind
32
32
  });
33
33
  //#endregion
34
- export { EntityStructure, NewTypeStructure, TaggedObjectStructure, createEntity, createEntityNamespace, createFlag, createKind, createNewEntity, createTaggedObject, entityKind, entityStructureKind, flagKind, getTagValue, hasTagValue, modeling_exports, namespaceKind, newTypeStructureKind, objectTagKind, taggedObject, taggedObjectStructureKind };
34
+ export { EntityStructure, NewTypeStructure, TaggedObjectStructure, createEntity, createEntityNamespace, createFlag, createKind, createNewType, createTaggedObject, entityKind, entityStructureKind, flagKind, getTagValue, hasTagValue, modeling_exports, namespaceKind, newTypeStructureKind, objectTagKind, taggedObject, taggedObjectStructureKind };
@@ -1,7 +1,7 @@
1
1
  const require_base = require("./base.cjs");
2
2
  //#region scripts/modeling/newType/helper.ts
3
- function createNewEntity(name, structure, newTypeConstraints = []) {
3
+ function createNewType(name, structure, newTypeConstraints = []) {
4
4
  return require_base.NewTypeStructure(name, structure, newTypeConstraints);
5
5
  }
6
6
  //#endregion
7
- exports.createNewEntity = createNewEntity;
7
+ exports.createNewType = createNewType;
@@ -2,4 +2,4 @@ import { NewType, NewTypeStructure } from './base';
2
2
  import type * as DCommon from '../../common';
3
3
  import type * as DDataStructure from '../../dataStructure';
4
4
  export type ForbiddenTopLevelNewType<GenericValue extends unknown> = GenericValue extends NewType ? DCommon.ComputedTypeError<"NewType on top level of NewType declaration is forbidden."> : never;
5
- export declare function createNewEntity<GenericName extends Capitalize<string>, GenericStructure extends DDataStructure.Structure, const GenericNewTypeConstraint extends readonly DDataStructure.Constraint<DDataStructure.StructureValue<GenericStructure>>[] = readonly []>(name: (GenericName & DCommon.NeverCoalescing<ForbiddenTopLevelNewType<DDataStructure.StructureValue<GenericStructure>>, unknown>), structure: GenericStructure, newTypeConstraints?: GenericNewTypeConstraint): NewTypeStructure<GenericName & DCommon.NeverCoalescing<ForbiddenTopLevelNewType<DDataStructure.StructureValue<GenericStructure>>, unknown>, DDataStructure.StructureValue<GenericStructure>, GenericNewTypeConstraint>;
5
+ export declare function createNewType<GenericName extends Capitalize<string>, GenericStructure extends DDataStructure.Structure, const GenericNewTypeConstraint extends readonly DDataStructure.Constraint<DDataStructure.StructureValue<GenericStructure>>[] = readonly []>(name: (GenericName & DCommon.NeverCoalescing<ForbiddenTopLevelNewType<DDataStructure.StructureValue<GenericStructure>>, unknown>), structure: GenericStructure, newTypeConstraints?: GenericNewTypeConstraint): NewTypeStructure<GenericName & DCommon.NeverCoalescing<ForbiddenTopLevelNewType<DDataStructure.StructureValue<GenericStructure>>, unknown>, DDataStructure.StructureValue<GenericStructure>, GenericNewTypeConstraint>;
@@ -1,7 +1,7 @@
1
1
  import { NewTypeStructure } from "./base.mjs";
2
2
  //#region scripts/modeling/newType/helper.ts
3
- function createNewEntity(name, structure, newTypeConstraints = []) {
3
+ function createNewType(name, structure, newTypeConstraints = []) {
4
4
  return NewTypeStructure(name, structure, newTypeConstraints);
5
5
  }
6
6
  //#endregion
7
- export { createNewEntity };
7
+ export { createNewType };
@@ -19,8 +19,13 @@ function taggedObject(tag, props) {
19
19
  [require_base.objectTagKind.runTimeKey]: tag
20
20
  };
21
21
  }
22
- function createTaggedObject(name) {
23
- return (shape) => require_base.TaggedObjectStructure(name, shape);
22
+ function createTaggedObject(...args) {
23
+ if (args.length === 1) {
24
+ const [name] = args;
25
+ return (shape) => createTaggedObject(name, shape);
26
+ }
27
+ const [name, shape] = args;
28
+ return require_base.TaggedObjectStructure(name, shape);
24
29
  }
25
30
  //#endregion
26
31
  exports.createTaggedObject = createTaggedObject;
@@ -12,3 +12,4 @@ export declare function taggedObject<GenericTaggedObject extends ObjectTag>(...a
12
12
  ] : never): GenericTaggedObject;
13
13
  export type RequireTaggedObjectSameShape<GenericTaggedObject extends ObjectTag, GenericTaggedObjectShape extends ShapeTaggedObjectStructure> = DCommon.IsEqual<DCommon.SimplifyTopLevel<DObject.DeepReadonly<DKind.Remove<GenericTaggedObject>>>, DCommon.SimplifyTopLevel<DObject.DeepReadonly<DDataStructure.ShapeObjectStructureValue<GenericTaggedObjectShape>>>> extends true ? unknown : DCommon.ComputedTypeError<"Shape do not match.">;
14
14
  export declare function createTaggedObject<GenericTaggedObject extends ObjectTag>(name: GetTagValue<GenericTaggedObject>): <GenericShape extends ShapeTaggedObjectStructure<GenericTaggedObject>>(shape: (GenericShape & RequireTaggedObjectSameShape<GenericTaggedObject, GenericShape>)) => TaggedObjectStructure<GenericTaggedObject>;
15
+ export declare function createTaggedObject<GenericTaggedObject extends ObjectTag, GenericName extends string = never, GenericShape extends DDataStructure.ShapeObjectStructure = never>(name: GetTagValue<GenericTaggedObject> | GenericName, shape: ShapeTaggedObjectStructure<GenericTaggedObject> | GenericShape): TaggedObjectStructure<ObjectTag extends GenericTaggedObject ? (ObjectTag<GenericName> & DDataStructure.ShapeObjectStructureValue<GenericShape>) : GenericTaggedObject>;
@@ -19,8 +19,13 @@ function taggedObject(tag, props) {
19
19
  [objectTagKind.runTimeKey]: tag
20
20
  };
21
21
  }
22
- function createTaggedObject(name) {
23
- return (shape) => TaggedObjectStructure(name, shape);
22
+ function createTaggedObject(...args) {
23
+ if (args.length === 1) {
24
+ const [name] = args;
25
+ return (shape) => createTaggedObject(name, shape);
26
+ }
27
+ const [name, shape] = args;
28
+ return TaggedObjectStructure(name, shape);
24
29
  }
25
30
  //#endregion
26
31
  export { createTaggedObject, getTagValue, hasTagValue, taggedObject };
@@ -1,2 +1,3 @@
1
- export type * from './path';
2
1
  export type * from './absolute';
2
+ export type * from './path';
3
+ export type * from './segment';
@@ -0,0 +1,3 @@
1
+ import type * as DCommon from '../../common';
2
+ export interface Segment extends DCommon.Constraint<"path-segment"> {
3
+ }
@@ -1,10 +1,12 @@
1
+ const require_isSegment = require("./isSegment.cjs");
1
2
  //#region scripts/path/getBaseName.ts
2
3
  const baseNameRegex = /([^/]+)$/;
3
4
  const extensionNameRegex = /(?<!^)\.[^./]+$/;
4
5
  function getBaseName(path, params) {
5
6
  const baseName = baseNameRegex.exec(path)?.[1];
6
7
  if (baseName === void 0) return null;
7
- return params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
8
+ const result = params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
9
+ return require_isSegment.isSegment(result) ? result : null;
8
10
  }
9
11
  //#endregion
10
12
  exports.getBaseName = getBaseName;
@@ -1,5 +1,5 @@
1
- import { Absolute, Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  export interface GetBaseNameParams {
3
3
  removeExtension?: boolean;
4
4
  }
5
- export declare function getBaseName<GenericPath extends string & (Path | Absolute)>(path: GenericPath, params?: GetBaseNameParams): string | null;
5
+ export declare function getBaseName<GenericPath extends string & (Path | Absolute | Segment)>(path: GenericPath, params?: GetBaseNameParams): (string & Segment) | null;
@@ -1,10 +1,12 @@
1
+ import { isSegment } from "./isSegment.mjs";
1
2
  //#region scripts/path/getBaseName.ts
2
3
  const baseNameRegex = /([^/]+)$/;
3
4
  const extensionNameRegex = /(?<!^)\.[^./]+$/;
4
5
  function getBaseName(path, params) {
5
6
  const baseName = baseNameRegex.exec(path)?.[1];
6
7
  if (baseName === void 0) return null;
7
- return params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
8
+ const result = params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
9
+ return isSegment(result) ? result : null;
8
10
  }
9
11
  //#endregion
10
12
  export { getBaseName };
@@ -1,3 +1,4 @@
1
+ const require_isSegment = require("./isSegment.cjs");
1
2
  //#region scripts/path/getExtensionName.ts
2
3
  const basenameRegex = /([^/]+)$/;
3
4
  function getExtensionName(path, params) {
@@ -6,7 +7,8 @@ function getExtensionName(path, params) {
6
7
  const dotIndex = baseName.lastIndexOf(".");
7
8
  if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
8
9
  const extension = baseName.slice(dotIndex + 1);
9
- return params?.withDot ? `.${extension}` : extension;
10
+ const result = params?.withDot ? `.${extension}` : extension;
11
+ return require_isSegment.isSegment(result) ? result : null;
10
12
  }
11
13
  //#endregion
12
14
  exports.getExtensionName = getExtensionName;
@@ -1,5 +1,5 @@
1
- import { Absolute, Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  export interface GetExtensionNameParams {
3
3
  withDot?: boolean;
4
4
  }
5
- export declare function getExtensionName<GenericPath extends string & (Path | Absolute)>(path: GenericPath, params?: GetExtensionNameParams): string | null;
5
+ export declare function getExtensionName<GenericPath extends string & (Path | Absolute | Segment)>(path: GenericPath, params?: GetExtensionNameParams): (string & Segment) | null;
@@ -1,3 +1,4 @@
1
+ import { isSegment } from "./isSegment.mjs";
1
2
  //#region scripts/path/getExtensionName.ts
2
3
  const basenameRegex = /([^/]+)$/;
3
4
  function getExtensionName(path, params) {
@@ -6,7 +7,8 @@ function getExtensionName(path, params) {
6
7
  const dotIndex = baseName.lastIndexOf(".");
7
8
  if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
8
9
  const extension = baseName.slice(dotIndex + 1);
9
- return params?.withDot ? `.${extension}` : extension;
10
+ const result = params?.withDot ? `.${extension}` : extension;
11
+ return isSegment(result) ? result : null;
10
12
  }
11
13
  //#endregion
12
14
  export { getExtensionName };
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  const require_computeRelative = require("./computeRelative.cjs");
3
+ const require_isSegment = require("./isSegment.cjs");
3
4
  const require_getBaseName = require("./getBaseName.cjs");
4
5
  const require_getExtensionName = require("./getExtensionName.cjs");
5
6
  const require_getParentFolderPath = require("./getParentFolderPath.cjs");
@@ -16,6 +17,7 @@ var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
16
17
  getParentFolderPath: () => require_getParentFolderPath.getParentFolderPath,
17
18
  is: () => require_is.is,
18
19
  isAbsolute: () => require_isAbsolute.isAbsolute,
20
+ isSegment: () => require_isSegment.isSegment,
19
21
  normalize: () => require_normalize.normalize,
20
22
  resolveFrom: () => require_resolveFrom.resolveFrom,
21
23
  resolveRelative: () => require_resolveRelative.resolveRelative
@@ -27,6 +29,7 @@ exports.getExtensionName = require_getExtensionName.getExtensionName;
27
29
  exports.getParentFolderPath = require_getParentFolderPath.getParentFolderPath;
28
30
  exports.is = require_is.is;
29
31
  exports.isAbsolute = require_isAbsolute.isAbsolute;
32
+ exports.isSegment = require_isSegment.isSegment;
30
33
  exports.normalize = require_normalize.normalize;
31
34
  Object.defineProperty(exports, "path_exports", {
32
35
  enumerable: true,
@@ -5,6 +5,7 @@ export * from './getExtensionName';
5
5
  export * from './getParentFolderPath';
6
6
  export * from './is';
7
7
  export * from './isAbsolute';
8
+ export * from './isSegment';
8
9
  export * from './normalize';
9
10
  export * from './resolveFrom';
10
11
  export * from './resolveRelative';
@@ -1,5 +1,6 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
2
  import { computeRelative } from "./computeRelative.mjs";
3
+ import { isSegment } from "./isSegment.mjs";
3
4
  import { getBaseName } from "./getBaseName.mjs";
4
5
  import { getExtensionName } from "./getExtensionName.mjs";
5
6
  import { getParentFolderPath } from "./getParentFolderPath.mjs";
@@ -16,9 +17,10 @@ var path_exports = /* @__PURE__ */ __exportAll({
16
17
  getParentFolderPath: () => getParentFolderPath,
17
18
  is: () => is,
18
19
  isAbsolute: () => isAbsolute,
20
+ isSegment: () => isSegment,
19
21
  normalize: () => normalize,
20
22
  resolveFrom: () => resolveFrom,
21
23
  resolveRelative: () => resolveRelative
22
24
  });
23
25
  //#endregion
24
- export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, normalize, path_exports, resolveFrom, resolveRelative };
26
+ export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/isSegment.ts
2
+ function isSegment(value) {
3
+ return value !== "" && value !== "." && value !== ".." && !value.includes("/") && !value.includes("\0");
4
+ }
5
+ //#endregion
6
+ exports.isSegment = isSegment;
@@ -0,0 +1,4 @@
1
+ import { Segment } from './constraints';
2
+ import { IsLiteralSegmentPath } from './types';
3
+ import type * as DString from '../string';
4
+ export declare function isSegment<GenericValue extends string>(value: GenericValue): value is (GenericValue extends Segment ? GenericValue : IsLiteralSegmentPath<GenericValue> extends true ? GenericValue : DString.IsLiteral<GenericValue> extends true ? never : GenericValue & Segment);
@@ -0,0 +1,6 @@
1
+ //#region scripts/path/isSegment.ts
2
+ function isSegment(value) {
3
+ return value !== "" && value !== "." && value !== ".." && !value.includes("/") && !value.includes("\0");
4
+ }
5
+ //#endregion
6
+ export { isSegment };
@@ -1,10 +1,10 @@
1
- import { Absolute, Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  import { RequireSegments } from './types';
3
3
  import type * as DCommon from '../common';
4
4
  export interface ResolveFromParams {
5
5
  stayInOrigin?: boolean;
6
6
  }
7
- export declare function resolveFrom<const GenericSegments extends readonly (string & (Path | Absolute))[], const GenericParams extends ResolveFromParams>(origin: string & Absolute, segments: GenericSegments & RequireSegments<GenericSegments>, params?: GenericParams): (string & Absolute) | (DCommon.BreakGenericLink<DCommon.Or<[
7
+ export declare function resolveFrom<const GenericSegments extends readonly (string & (Path | Absolute | Segment))[], const GenericParams extends ResolveFromParams>(origin: string & Absolute, segments: GenericSegments & RequireSegments<GenericSegments>, params?: GenericParams): (string & Absolute) | (DCommon.BreakGenericLink<DCommon.Or<[
8
8
  DCommon.IsEqual<GenericParams["stayInOrigin"], ResolveFromParams["stayInOrigin"]>,
9
9
  DCommon.IsEqual<GenericParams["stayInOrigin"], false>,
10
10
  DCommon.IsEqual<GenericParams["stayInOrigin"], unknown>
@@ -1,10 +1,10 @@
1
- import { Absolute, Path } from './constraints';
1
+ import { Absolute, Path, Segment } from './constraints';
2
2
  import { RequireSegments } from './types';
3
3
  import type * as DCommon from '../common';
4
- type HasAbsolutePath<GenericSegments extends readonly (string & (Path | Absolute))[]> = DCommon.ContainExtends<{
4
+ type HasAbsolutePath<GenericSegments extends readonly (string & (Path | Absolute | Segment))[]> = DCommon.ContainExtends<{
5
5
  [Prop in keyof GenericSegments]: [DCommon.IsExtends<GenericSegments[Prop], Absolute>];
6
6
  }[Extract<keyof GenericSegments, number>], [
7
7
  true
8
8
  ]>;
9
- export declare function resolveRelative<const GenericSegments extends readonly (string & (Path | Absolute))[]>(segments: GenericSegments & RequireSegments<GenericSegments>): string & Path & (DCommon.BreakGenericLink<HasAbsolutePath<GenericSegments> extends true ? Absolute : unknown>);
9
+ export declare function resolveRelative<const GenericSegments extends readonly (string & (Path | Absolute | Segment))[]>(segments: GenericSegments & RequireSegments<GenericSegments>): string & Path & (DCommon.BreakGenericLink<HasAbsolutePath<GenericSegments> extends true ? Absolute : unknown>);
10
10
  export {};
@@ -1,5 +1,7 @@
1
1
  export type * from './isLiteralAbsolutePath';
2
2
  export type * from './isLiteralPath';
3
+ export type * from './isLiteralSegmentPath';
3
4
  export type * from './requireLiteralAbsolutePath';
4
5
  export type * from './requireLiteralPath';
6
+ export type * from './requireLiteralSegmentPath';
5
7
  export type * from './requireSegments';
@@ -0,0 +1,9 @@
1
+ import type * as DCommon from '../../common';
2
+ import type * as DString from '../../string';
3
+ export type IsLiteralSegmentPath<GenericValue extends string> = DString.IsLiteral<GenericValue> extends true ? DCommon.Not<DCommon.Or<[
4
+ DCommon.IsEqual<GenericValue, ".">,
5
+ DCommon.IsEqual<GenericValue, "..">,
6
+ DCommon.IsEqual<GenericValue, "">,
7
+ DString.Includes<GenericValue, "/">,
8
+ DString.Includes<GenericValue, "\0">
9
+ ]>> : false;
@@ -0,0 +1,3 @@
1
+ import { IsLiteralSegmentPath } from './isLiteralSegmentPath';
2
+ import type * as DCommon from '../../common';
3
+ export type RequireLiteralSegmentPath<GenericValue extends string> = IsLiteralSegmentPath<GenericValue> extends true ? unknown : DCommon.ComputedTypeError<"Value is not a segment path.">;
@@ -0,0 +1,6 @@
1
+ //#region scripts/tuple/from.ts
2
+ function from(source) {
3
+ return source;
4
+ }
5
+ //#endregion
6
+ exports.from = from;
@@ -0,0 +1,8 @@
1
+ import { Create } from './types';
2
+ import type * as DArray from '../array';
3
+ type FromOutput<GenericArray extends readonly unknown[]> = DArray.ExtractLengthEqual<GenericArray, unknown> extends DArray.LengthEqual<infer InferredLength extends number> ? DArray.ReapplyCompatiblesConstraints<GenericArray, Create<GenericArray[number], InferredLength>, "maxElements"> : DArray.ExtractMinElements<GenericArray, unknown> extends DArray.MinElements<infer InferredMin extends number> ? DArray.ReapplyCompatiblesConstraints<GenericArray, readonly [
4
+ ...Create<GenericArray[number], InferredMin>,
5
+ ...GenericArray[number][]
6
+ ], "maxElements"> : GenericArray;
7
+ export declare function from<GenericArray extends readonly unknown[]>(source: GenericArray): FromOutput<GenericArray>;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ //#region scripts/tuple/from.ts
2
+ function from(source) {
3
+ return source;
4
+ }
5
+ //#endregion
6
+ export { from };
@@ -1,8 +1,13 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  const require_map = require("./map.cjs");
3
+ const require_from = require("./from.cjs");
3
4
  //#region scripts/tuple/index.ts
4
- var tuple_exports = /* @__PURE__ */ require_runtime.__exportAll({ map: () => require_map.map });
5
+ var tuple_exports = /* @__PURE__ */ require_runtime.__exportAll({
6
+ from: () => require_from.from,
7
+ map: () => require_map.map
8
+ });
5
9
  //#endregion
10
+ exports.from = require_from.from;
6
11
  exports.map = require_map.map;
7
12
  Object.defineProperty(exports, "tuple_exports", {
8
13
  enumerable: true,
@@ -1,2 +1,3 @@
1
1
  export type * from './types';
2
2
  export * from './map';
3
+ export * from './from';
@@ -1,6 +1,10 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
2
  import { map } from "./map.mjs";
3
+ import { from } from "./from.mjs";
3
4
  //#region scripts/tuple/index.ts
4
- var tuple_exports = /* @__PURE__ */ __exportAll({ map: () => map });
5
+ var tuple_exports = /* @__PURE__ */ __exportAll({
6
+ from: () => from,
7
+ map: () => map
8
+ });
5
9
  //#endregion
6
- export { map, tuple_exports };
10
+ export { from, map, tuple_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/lang",
3
- "version": "0.0.1-beta.5",
3
+ "version": "0.0.1-beta.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {