@duplojs/lang 0.0.1-beta.2 → 0.0.1-beta.4

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 (123) hide show
  1. package/dist/common/constraint/index.d.ts +1 -0
  2. package/dist/common/constraint/remove.cjs +6 -0
  3. package/dist/common/constraint/remove.d.ts +2 -0
  4. package/dist/common/constraint/remove.mjs +6 -0
  5. package/dist/common/index.cjs +3 -0
  6. package/dist/common/index.mjs +3 -1
  7. package/dist/common/types/forward.d.ts +1 -0
  8. package/dist/common/types/index.d.ts +1 -0
  9. package/dist/dataStructure/common/codec.d.ts +1 -1
  10. package/dist/dataStructure/constraint/defaults/allowedCharacters.d.ts +1 -1
  11. package/dist/dataStructure/constraint/defaults/arrayLengthEqual.d.ts +1 -1
  12. package/dist/dataStructure/constraint/defaults/betweenThan.d.ts +1 -1
  13. package/dist/dataStructure/constraint/defaults/betweenThanOrEqual.d.ts +1 -1
  14. package/dist/dataStructure/constraint/defaults/email.d.ts +1 -1
  15. package/dist/dataStructure/constraint/defaults/even.d.ts +1 -1
  16. package/dist/dataStructure/constraint/defaults/greaterThan.d.ts +1 -1
  17. package/dist/dataStructure/constraint/defaults/greaterThanOrEqual.d.ts +1 -1
  18. package/dist/dataStructure/constraint/defaults/index.d.ts +1 -0
  19. package/dist/dataStructure/constraint/defaults/integer.d.ts +1 -1
  20. package/dist/dataStructure/constraint/defaults/lessThan.d.ts +1 -1
  21. package/dist/dataStructure/constraint/defaults/lessThanOrEqual.d.ts +1 -1
  22. package/dist/dataStructure/constraint/defaults/maxCharacters.d.ts +1 -1
  23. package/dist/dataStructure/constraint/defaults/maxElements.d.ts +1 -1
  24. package/dist/dataStructure/constraint/defaults/minCharacters.cjs +3 -3
  25. package/dist/dataStructure/constraint/defaults/minCharacters.d.ts +2 -2
  26. package/dist/dataStructure/constraint/defaults/minCharacters.mjs +3 -3
  27. package/dist/dataStructure/constraint/defaults/minElements.d.ts +1 -1
  28. package/dist/dataStructure/constraint/defaults/multipleOf.d.ts +1 -1
  29. package/dist/dataStructure/constraint/defaults/negative.d.ts +1 -1
  30. package/dist/dataStructure/constraint/defaults/notEmpty.d.ts +1 -1
  31. package/dist/dataStructure/constraint/defaults/notZero.d.ts +1 -1
  32. package/dist/dataStructure/constraint/defaults/odd.d.ts +1 -1
  33. package/dist/dataStructure/constraint/defaults/positive.d.ts +1 -1
  34. package/dist/dataStructure/constraint/defaults/refine.d.ts +1 -1
  35. package/dist/dataStructure/constraint/defaults/regex.cjs +13 -0
  36. package/dist/dataStructure/constraint/defaults/regex.d.ts +10 -0
  37. package/dist/dataStructure/constraint/defaults/regex.mjs +12 -0
  38. package/dist/dataStructure/constraint/defaults/safe.d.ts +1 -1
  39. package/dist/dataStructure/constraint/defaults/strictNegative.d.ts +1 -1
  40. package/dist/dataStructure/constraint/defaults/strictPositive.d.ts +1 -1
  41. package/dist/dataStructure/constraint/defaults/stringLengthEqual.d.ts +1 -1
  42. package/dist/dataStructure/constraint/defaults/trimmed.d.ts +1 -1
  43. package/dist/dataStructure/constraint/defaults/url.cjs +2 -2
  44. package/dist/dataStructure/constraint/defaults/url.d.ts +2 -3
  45. package/dist/dataStructure/constraint/defaults/url.mjs +2 -2
  46. package/dist/dataStructure/constraint/defaults/uuid.cjs +1 -3
  47. package/dist/dataStructure/constraint/defaults/uuid.d.ts +1 -3
  48. package/dist/dataStructure/constraint/defaults/uuid.mjs +3 -4
  49. package/dist/dataStructure/constraint/identifier.d.ts +3 -4
  50. package/dist/dataStructure/constraint/types/constraints.d.ts +18 -15
  51. package/dist/dataStructure/fundamentalType/defaults/bigint.d.ts +1 -1
  52. package/dist/dataStructure/fundamentalType/defaults/boolean.d.ts +1 -1
  53. package/dist/dataStructure/fundamentalType/defaults/date.d.ts +1 -1
  54. package/dist/dataStructure/fundamentalType/defaults/null.d.ts +1 -1
  55. package/dist/dataStructure/fundamentalType/defaults/number.d.ts +1 -1
  56. package/dist/dataStructure/fundamentalType/defaults/string.d.ts +1 -1
  57. package/dist/dataStructure/fundamentalType/defaults/time.d.ts +1 -1
  58. package/dist/dataStructure/fundamentalType/defaults/undefined.d.ts +1 -1
  59. package/dist/dataStructure/fundamentalType/identifier.d.ts +3 -4
  60. package/dist/dataStructure/helpers/index.d.ts +1 -0
  61. package/dist/dataStructure/helpers/nullable.cjs +5 -2
  62. package/dist/dataStructure/helpers/nullable.mjs +5 -2
  63. package/dist/dataStructure/helpers/optional.cjs +5 -2
  64. package/dist/dataStructure/helpers/optional.mjs +5 -2
  65. package/dist/dataStructure/helpers/partial.cjs +5 -2
  66. package/dist/dataStructure/helpers/partial.mjs +5 -2
  67. package/dist/dataStructure/helpers/regex.cjs +7 -0
  68. package/dist/dataStructure/helpers/regex.d.ts +2 -0
  69. package/dist/dataStructure/helpers/regex.mjs +7 -0
  70. package/dist/dataStructure/helpers/required.cjs +6 -3
  71. package/dist/dataStructure/helpers/required.d.ts +2 -1
  72. package/dist/dataStructure/helpers/required.mjs +6 -3
  73. package/dist/dataStructure/helpers/url.cjs +2 -2
  74. package/dist/dataStructure/helpers/url.d.ts +1 -2
  75. package/dist/dataStructure/helpers/url.mjs +2 -2
  76. package/dist/dataStructure/index.cjs +12 -6
  77. package/dist/dataStructure/index.mjs +11 -7
  78. package/dist/dataStructure/structure/defaults/array.d.ts +1 -1
  79. package/dist/dataStructure/structure/defaults/lazy.cjs +6 -1
  80. package/dist/dataStructure/structure/defaults/lazy.d.ts +1 -1
  81. package/dist/dataStructure/structure/defaults/lazy.mjs +6 -1
  82. package/dist/dataStructure/structure/defaults/nonEncodableString.d.ts +1 -1
  83. package/dist/dataStructure/structure/defaults/object.d.ts +1 -1
  84. package/dist/dataStructure/structure/defaults/record.cjs +7 -7
  85. package/dist/dataStructure/structure/defaults/record.d.ts +2 -2
  86. package/dist/dataStructure/structure/defaults/record.mjs +7 -7
  87. package/dist/dataStructure/structure/defaults/type.d.ts +1 -1
  88. package/dist/dataStructure/structure/defaults/union.cjs +11 -5
  89. package/dist/dataStructure/structure/defaults/union.d.ts +2 -2
  90. package/dist/dataStructure/structure/defaults/union.mjs +11 -5
  91. package/dist/dataStructure/structure/identifier.d.ts +3 -4
  92. package/dist/dataStructure/type/defaults/bigint.d.ts +1 -1
  93. package/dist/dataStructure/type/defaults/bigintLiteral.d.ts +1 -1
  94. package/dist/dataStructure/type/defaults/boolean.d.ts +1 -1
  95. package/dist/dataStructure/type/defaults/booleanLiteral.d.ts +1 -1
  96. package/dist/dataStructure/type/defaults/date.d.ts +1 -1
  97. package/dist/dataStructure/type/defaults/null.d.ts +1 -1
  98. package/dist/dataStructure/type/defaults/number.d.ts +1 -1
  99. package/dist/dataStructure/type/defaults/numberLiteral.d.ts +1 -1
  100. package/dist/dataStructure/type/defaults/string.d.ts +1 -1
  101. package/dist/dataStructure/type/defaults/stringLiteral.d.ts +1 -1
  102. package/dist/dataStructure/type/defaults/time.d.ts +1 -1
  103. package/dist/dataStructure/type/defaults/undefined.d.ts +1 -1
  104. package/dist/dataStructure/type/identifier.d.ts +3 -4
  105. package/dist/index.cjs +2 -0
  106. package/dist/index.mjs +2 -1
  107. package/dist/invocation/flow/base.d.ts +1 -1
  108. package/dist/invocation/flow/controller/defaults/aborter.cjs +4 -1
  109. package/dist/invocation/flow/controller/defaults/aborter.d.ts +6 -3
  110. package/dist/invocation/flow/controller/defaults/aborter.mjs +4 -1
  111. package/dist/invocation/flow/controller/defaults/debounce.d.ts +1 -1
  112. package/dist/invocation/flow/controller/defaults/filter.d.ts +1 -1
  113. package/dist/invocation/flow/controller/defaults/retry.d.ts +1 -1
  114. package/dist/invocation/flow/controller/defaults/throttling.d.ts +1 -1
  115. package/dist/invocation/flow/controller/defaults/timeout.d.ts +1 -1
  116. package/dist/kind/createIdentifier.d.ts +8 -4
  117. package/dist/modeling/entity/base.d.ts +3 -4
  118. package/dist/modeling/newType/base.d.ts +1 -1
  119. package/dist/modeling/taggedObject/base.d.ts +3 -4
  120. package/dist/string/isUrl.cjs +2 -11
  121. package/dist/string/isUrl.d.ts +1 -5
  122. package/dist/string/isUrl.mjs +2 -11
  123. package/package.json +1 -1
@@ -1,14 +1,17 @@
1
1
  import { FlowController } from '../base';
2
- import type * as DCommon from '../../../../common';
2
+ import * as DCommon from '../../../../common';
3
3
  import * as DKind from '../../../../kind';
4
4
  import * as DEither from '../../../../either';
5
5
  export declare const flowControllerAborterKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-aborter", unknown>>;
6
- export interface FlowControllerAborter<GenericInput extends unknown = unknown, GenericOutput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, Promise<Awaited<GenericOutput> | DEither.Left<"signal-aborted", AbortErrorFlowController>>> & DKind.Kind<typeof flowControllerAborterKind>> {
6
+ export interface FlowControllerAborter<GenericInput extends unknown = unknown, GenericOutput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, Promise<Awaited<GenericOutput> | DEither.Left<"signal-aborted", AbortErrorFlowController>>> & DKind.Kind<typeof flowControllerAborterKind>> {
7
7
  }
8
8
  declare const AbortErrorFlowController_base: DKind.KindClass<DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/abort-error-flow-controller", unknown>>, ErrorConstructor>;
9
9
  export declare class AbortErrorFlowController extends AbortErrorFlowController_base {
10
10
  abortController: AbortController;
11
11
  constructor(abortController: AbortController);
12
12
  }
13
- export declare const aborter: <GenericInput extends unknown, GenericOutput extends unknown>(theFunction: (input: GenericInput, aborter: AbortController) => GenericOutput) => FlowControllerAborter<GenericInput, GenericOutput>;
13
+ export interface FlowControllerAborterParams {
14
+ timeout?: DCommon.TimeInString;
15
+ }
16
+ export declare const aborter: <GenericInput extends unknown, GenericOutput extends unknown>(theFunction: (input: GenericInput, aborter: AbortController) => GenericOutput, params?: FlowControllerAborterParams) => FlowControllerAborter<GenericInput, GenericOutput>;
14
17
  export {};
@@ -1,5 +1,6 @@
1
1
  import { parentClass } from "../../../../kind/parentClass.mjs";
2
2
  import { left } from "../../../../either/left/create.mjs";
3
+ import { stringToMillisecond } from "../../../../common/stringToMillisecond.mjs";
3
4
  import { createKind } from "../../../kind.mjs";
4
5
  import { createFlowController, flowControllerExitKind } from "../base.mjs";
5
6
  //#region scripts/invocation/flow/controller/defaults/aborter.ts
@@ -11,14 +12,16 @@ var AbortErrorFlowController = class extends parentClass(createKind("abort-error
11
12
  this.abortController = abortController;
12
13
  }
13
14
  };
14
- const aborter = createFlowController(flowControllerAborterKind, ({ init, exitFlow }) => (theFunction) => {
15
+ const aborter = createFlowController(flowControllerAborterKind, ({ init, exitFlow }) => (theFunction, params) => {
15
16
  let aborter = void 0;
17
+ const formattedTimeout = params?.timeout === void 0 ? void 0 : stringToMillisecond(params.timeout);
16
18
  return init(async (previousFunction) => {
17
19
  const result = previousFunction();
18
20
  if (flowControllerExitKind.has(result)) return result;
19
21
  aborter?.abort(new AbortErrorFlowController(aborter));
20
22
  const currentAborter = new AbortController();
21
23
  aborter = currentAborter;
24
+ if (formattedTimeout !== void 0) setTimeout(() => void currentAborter.abort(new AbortErrorFlowController(currentAborter)), formattedTimeout);
22
25
  try {
23
26
  const abortResult = await theFunction(result, currentAborter);
24
27
  if (currentAborter.signal.aborted === true) return exitFlow(left("signal-aborted", currentAborter.signal.reason));
@@ -3,6 +3,6 @@ import * as DCommon from '../../../../common';
3
3
  import type * as DKind from '../../../../kind';
4
4
  import * as DEither from '../../../../either';
5
5
  export declare const flowControllerDebounceKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-debounce", unknown>>;
6
- export interface FlowControllerDebounce<GenericInput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, Promise<FlowControllerExit<DEither.Left<"debounce-reject">>>> & DKind.Kind<typeof flowControllerDebounceKind>> {
6
+ export interface FlowControllerDebounce<GenericInput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, Promise<FlowControllerExit<DEither.Left<"debounce-reject">>>> & DKind.Kind<typeof flowControllerDebounceKind>> {
7
7
  }
8
8
  export declare const debounce: <GenericInput extends unknown = unknown>(debounce: DCommon.TimeInString) => FlowControllerDebounce<GenericInput>;
@@ -3,6 +3,6 @@ import * as DCommon from '../../../../common';
3
3
  import type * as DKind from '../../../../kind';
4
4
  import * as DEither from '../../../../either';
5
5
  export declare const flowControllerFilterKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-filter", unknown>>;
6
- export interface FlowControllerFilter<GenericInput extends unknown = unknown, GenericOutput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, DCommon.SplitPromise<GenericOutput> extends infer InferredOutput ? InferredOutput extends unknown ? Awaited<InferredOutput> extends infer InferredAwaited ? (InferredAwaited extends DEither.Left ? FlowControllerExit<InferredAwaited> : InferredAwaited extends DEither.Right ? DEither.GetValue<InferredAwaited> : InferredAwaited) extends infer InferredResult ? InferredOutput extends Promise<unknown> ? Promise<InferredResult> : InferredResult : never : never : never : never> & DKind.Kind<typeof flowControllerFilterKind>> {
6
+ export interface FlowControllerFilter<GenericInput extends unknown = unknown, GenericOutput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, DCommon.SplitPromise<GenericOutput> extends infer InferredOutput ? InferredOutput extends unknown ? Awaited<InferredOutput> extends infer InferredAwaited ? (InferredAwaited extends DEither.Left ? FlowControllerExit<InferredAwaited> : InferredAwaited extends DEither.Right ? DEither.GetValue<InferredAwaited> : InferredAwaited) extends infer InferredResult ? InferredOutput extends Promise<unknown> ? Promise<InferredResult> : InferredResult : never : never : never : never> & DKind.Kind<typeof flowControllerFilterKind>> {
7
7
  }
8
8
  export declare const filter: <GenericInput extends unknown, GenericOutput extends unknown>(filterFunction: (input: GenericInput) => GenericOutput) => FlowControllerFilter<GenericInput, GenericOutput>;
@@ -2,7 +2,7 @@ import { FlowController } from '../base';
2
2
  import * as DCommon from '../../../../common';
3
3
  import type * as DKind from '../../../../kind';
4
4
  export declare const flowControllerRetryKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-retry", unknown>>;
5
- export interface FlowControllerRetry<GenericInput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, Promise<never>> & DKind.Kind<typeof flowControllerRetryKind>> {
5
+ export interface FlowControllerRetry<GenericInput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, Promise<never>> & DKind.Kind<typeof flowControllerRetryKind>> {
6
6
  }
7
7
  export interface RetryParams {
8
8
  times?: number;
@@ -3,6 +3,6 @@ import * as DCommon from '../../../../common';
3
3
  import type * as DKind from '../../../../kind';
4
4
  import * as DEither from '../../../../either';
5
5
  export declare const flowControllerThrottlingKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-throttling", unknown>>;
6
- export interface FlowControllerThrottling<GenericInput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, Promise<FlowControllerExit<DEither.Left<"throttling-reject">>>> & DKind.Kind<typeof flowControllerThrottlingKind>> {
6
+ export interface FlowControllerThrottling<GenericInput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, Promise<FlowControllerExit<DEither.Left<"throttling-reject">>>> & DKind.Kind<typeof flowControllerThrottlingKind>> {
7
7
  }
8
8
  export declare const throttling: <GenericInput extends unknown = unknown>(throttling: DCommon.TimeInString) => FlowControllerThrottling<GenericInput>;
@@ -2,6 +2,6 @@ import { FlowController } from '../base';
2
2
  import * as DCommon from '../../../../common';
3
3
  import type * as DKind from '../../../../kind';
4
4
  export declare const flowControllerTimeoutKind: DKind.Handler<DKind.Definition<"@DuplojsLangInvocation/flow-controller-timeout", unknown>>;
5
- export interface FlowControllerTimeout<GenericInput extends unknown = unknown> extends DCommon.UnionToIntersection<FlowController<GenericInput, Promise<never>> & DKind.Kind<typeof flowControllerTimeoutKind>> {
5
+ export interface FlowControllerTimeout<GenericInput extends unknown = unknown> extends DCommon.Forward<FlowController<GenericInput, Promise<never>> & DKind.Kind<typeof flowControllerTimeoutKind>> {
6
6
  }
7
7
  export declare const timeout: <GenericInput extends unknown = unknown>(timeout: DCommon.TimeInString) => FlowControllerTimeout<GenericInput>;
@@ -1,7 +1,11 @@
1
1
  import { Kind, Handler } from './base';
2
2
  import { GetHandler } from './types';
3
3
  import type * as DCommon from '../common';
4
- export declare function createKindIdentifier<GenericParent extends Kind<Handler>, GenericChildren extends GenericParent>(): {
5
- <GenericKindHandler extends GenericChildren extends infer InferredChildren ? InferredChildren extends GenericParent ? GetHandler<InferredChildren> : never : never, GenericInput extends unknown, GenericGroupedKind extends DCommon.UnionToIntersection<GenericKindHandler extends Handler ? Kind<GenericKindHandler> : never>>(kind: GenericKindHandler | GenericKindHandler[]): (input: GenericInput) => input is ((DCommon.UnionContain<GenericInput, GenericParent> extends true ? Extract<GenericChildren, GenericGroupedKind> : never) | Extract<GenericInput, GenericGroupedKind>);
6
- <GenericKindHandler extends GenericChildren extends infer InferredChildren ? InferredChildren extends GenericParent ? GetHandler<InferredChildren> : never : never, GenericInput extends unknown, GenericGroupedKind extends DCommon.UnionToIntersection<GenericKindHandler extends Handler ? Kind<GenericKindHandler> : never>>(input: GenericInput, kind: GenericKindHandler | GenericKindHandler[]): input is ((DCommon.UnionContain<GenericInput, GenericParent> extends true ? Extract<GenericChildren, GenericGroupedKind> : never) | Extract<GenericInput, GenericGroupedKind>);
7
- };
4
+ type KindIdentifierHandlers<GenericParent extends Kind<Handler>, GenericChildren extends GenericParent> = GenericChildren extends infer InferredChildren ? InferredChildren extends GenericParent ? GetHandler<InferredChildren> : never : never;
5
+ type KindIdentifierResult<GenericParent extends Kind<Handler>, GenericChildren extends GenericParent, GenericInput extends unknown, GenericGroupedKind extends unknown> = ((GenericInput extends GenericParent ? GenericChildren extends GenericInput ? GenericChildren extends GenericGroupedKind ? GenericChildren : never : never : never) | Extract<GenericInput, GenericGroupedKind>);
6
+ export interface KindIdentifier<GenericParent extends Kind<Handler>, GenericChildren extends GenericParent> {
7
+ <GenericKindHandler extends KindIdentifierHandlers<GenericParent, GenericChildren>, GenericInput extends unknown, GenericGroupedKind extends DCommon.Forward<GenericKindHandler extends Handler ? Kind<GenericKindHandler> : never>>(kind: GenericKindHandler | GenericKindHandler[]): (input: GenericInput) => input is KindIdentifierResult<GenericParent, GenericChildren, GenericInput, GenericGroupedKind>;
8
+ <GenericKindHandler extends KindIdentifierHandlers<GenericParent, GenericChildren>, GenericInput extends unknown, GenericGroupedKind extends DCommon.Forward<GenericKindHandler extends Handler ? Kind<GenericKindHandler> : never>>(input: GenericInput, kind: GenericKindHandler | GenericKindHandler[]): input is KindIdentifierResult<GenericParent, GenericChildren, GenericInput, GenericGroupedKind>;
9
+ }
10
+ export declare function createKindIdentifier<GenericParent extends Kind<Handler>, GenericChildren extends GenericParent>(): KindIdentifier<GenericParent, GenericChildren>;
11
+ export {};
@@ -1,4 +1,3 @@
1
- import { Codecs, EncodedValue } from '../../dataStructure/common';
2
1
  import { NewType, NewTypeMap } from '../newType';
3
2
  import type * as DKind from '../../kind';
4
3
  import * as DCommon from '../../common';
@@ -10,9 +9,9 @@ declare module '../../dataStructure' {
10
9
  }
11
10
  }
12
11
  declare module '../../dataStructure/common' {
13
- interface EncodeStructure<GenericValue extends unknown, GenericCodecs extends Codecs> {
12
+ interface EncodeStructure<GenericValue extends unknown, GenericCodecs extends DDataStructure.Codecs> {
14
13
  entity: GenericValue extends Entity<infer InferredName> ? (Entity<InferredName> & {
15
- [Prop in Exclude<keyof GenericValue, DKind.KeySymbol>]: EncodedValue<GenericValue[Prop], GenericCodecs>;
14
+ [Prop in Exclude<keyof GenericValue, DKind.KeySymbol>]: DDataStructure.EncodedValue<GenericValue[Prop], GenericCodecs>;
16
15
  }) : never;
17
16
  }
18
17
  }
@@ -34,7 +33,7 @@ export type EntityMap<GenericValue extends unknown, GenericRawValue = DCommon.Re
34
33
  ]> extends true ? {
35
34
  [Prop in keyof GenericRawValue]: NewTypeMap<GenericRawValue[Prop]>;
36
35
  } : GenericRawValue : GenericRawValue;
37
- export interface EntityStructure<GenericName extends string = string, GenericProperties extends Record<string, unknown> = Record<string, unknown>> extends DCommon.UnionToIntersection<DDataStructure.Structure<Entity<GenericName> & GenericProperties, EntityStructureDefinition> & DKind.Kind<typeof entityStructureKind>> {
36
+ export interface EntityStructure<GenericName extends string = string, GenericProperties extends Record<string, unknown> = Record<string, unknown>> extends DCommon.Forward<DDataStructure.Structure<Entity<GenericName> & GenericProperties, EntityStructureDefinition> & DKind.Kind<typeof entityStructureKind>> {
38
37
  readonly name: GenericName;
39
38
  "new"<GenericNewProperties extends GenericProperties>(properties: GenericNewProperties): (Entity<GenericName> & GenericNewProperties);
40
39
  decodeMap<GenericCodecs extends DDataStructure.Codecs>(codecs: GenericCodecs): (data: DDataStructure.EncodedValue<EntityMap<DKind.Remove<DDataStructure.StructureValue<this>>>, GenericCodecs>) => (DEither.Right<"map-success", DDataStructure.StructureValue<this>> | DEither.Left<"async-error", undefined> | DEither.Left<"map-error", DDataStructure.Error>);
@@ -25,7 +25,7 @@ export interface NewTypeStructureDefinition<GenericNewTypeConstraint extends rea
25
25
  readonly newTypeConstraints: GenericNewTypeConstraint;
26
26
  }
27
27
  export type ComputeNewType<GenericName extends string, GenericValue extends unknown, GenericNewTypeConstraint extends readonly DDataStructure.Constraint<GenericValue>[], GenericIntersectionConstraintValue = DDataStructure.ConstraintValue<DArray.Unwrap<GenericNewTypeConstraint>>, GenericClearValue = DCommon.NeverCoalescing<DCommon.RemoveConstraint<GenericIntersectionConstraintValue>, unknown>> = (GenericValue & GenericClearValue & NewType<GenericName, GenericIntersectionConstraintValue extends (GenericClearValue & infer InferredConstraint extends DCommon.BaseConstraint) ? InferredConstraint : never>);
28
- export interface NewTypeStructure<GenericName extends string = string, GenericValue extends unknown = unknown, GenericNewTypeConstraint extends readonly DDataStructure.Constraint<GenericValue>[] = readonly DDataStructure.Constraint<GenericValue>[]> extends DCommon.UnionToIntersection<DDataStructure.Structure<ComputeNewType<GenericName, GenericValue, GenericNewTypeConstraint>, NewTypeStructureDefinition<GenericNewTypeConstraint>> & DKind.Kind<typeof newTypeStructureKind>> {
28
+ export interface NewTypeStructure<GenericName extends string = string, GenericValue extends unknown = unknown, GenericNewTypeConstraint extends readonly DDataStructure.Constraint<GenericValue>[] = readonly DDataStructure.Constraint<GenericValue>[]> extends DCommon.Forward<DDataStructure.Structure<ComputeNewType<GenericName, GenericValue, GenericNewTypeConstraint>, NewTypeStructureDefinition<GenericNewTypeConstraint>> & DKind.Kind<typeof newTypeStructureKind>> {
29
29
  readonly name: GenericName;
30
30
  decodeMap<GenericCodecs extends DDataStructure.Codecs>(codecs: GenericCodecs): (data: DDataStructure.EncodedValue<NewTypeMap<DDataStructure.StructureValue<this>>, GenericCodecs>) => (DEither.Right<"map-success", DDataStructure.StructureValue<this>> | DEither.Left<"async-error", undefined> | DEither.Left<"map-error", DDataStructure.Error>);
31
31
  decodeMap<GenericCodecs extends DDataStructure.Codecs>(codecs: GenericCodecs, data: DDataStructure.EncodedValue<NewTypeMap<DDataStructure.StructureValue<this>>, GenericCodecs>): (DEither.Right<"map-success", DDataStructure.StructureValue<this>> | DEither.Left<"async-error", undefined> | DEither.Left<"map-error", DDataStructure.Error>);
@@ -1,4 +1,3 @@
1
- import { Codecs, EncodedValue } from '../../dataStructure/common';
2
1
  import type * as DKind from '../../kind';
3
2
  import type * as DCommon from '../../common';
4
3
  import * as DDataStructure from '../../dataStructure';
@@ -8,9 +7,9 @@ declare module '../../dataStructure' {
8
7
  }
9
8
  }
10
9
  declare module '../../dataStructure/common' {
11
- interface EncodeStructure<GenericValue extends unknown, GenericCodecs extends Codecs> {
10
+ interface EncodeStructure<GenericValue extends unknown, GenericCodecs extends DDataStructure.Codecs> {
12
11
  taggedObject: GenericValue extends ObjectTag<infer InferredName> ? (ObjectTag<InferredName> & {
13
- [Prop in Exclude<keyof GenericValue, DKind.KeySymbol>]: EncodedValue<GenericValue[Prop], GenericCodecs>;
12
+ [Prop in Exclude<keyof GenericValue, DKind.KeySymbol>]: DDataStructure.EncodedValue<GenericValue[Prop], GenericCodecs>;
14
13
  }) : never;
15
14
  }
16
15
  }
@@ -26,7 +25,7 @@ export declare const taggedObjectStructureKind: DKind.Handler<DKind.Definition<"
26
25
  export interface TaggedObjectStructureDefinition extends DDataStructure.StructureDefinition<readonly []> {
27
26
  readonly inner: DDataStructure.ObjectStructure;
28
27
  }
29
- export interface TaggedObjectStructure<GenericTaggedObject extends ObjectTag = ObjectTag> extends DCommon.UnionToIntersection<DDataStructure.Structure<GenericTaggedObject, TaggedObjectStructureDefinition> & DKind.Kind<typeof taggedObjectStructureKind>> {
28
+ export interface TaggedObjectStructure<GenericTaggedObject extends ObjectTag = ObjectTag> extends DCommon.Forward<DDataStructure.Structure<GenericTaggedObject, TaggedObjectStructureDefinition> & DKind.Kind<typeof taggedObjectStructureKind>> {
30
29
  readonly name: GetTagValue<GenericTaggedObject>;
31
30
  }
32
31
  export declare const TaggedObjectStructure: <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>;
@@ -1,16 +1,7 @@
1
1
  //#region scripts/string/isUrl.ts
2
- const regexRemoveDote = /:$/;
3
- function isUrl(string, params) {
2
+ function isUrl(string) {
4
3
  try {
5
- const url = new URL(string);
6
- if (params?.hostname) {
7
- params.hostname.lastIndex = 0;
8
- if (!params.hostname.test(url.hostname)) return false;
9
- }
10
- if (params?.protocol) {
11
- params.protocol.lastIndex = 0;
12
- if (!params.protocol.test(url.protocol.replace(regexRemoveDote, ""))) return false;
13
- }
4
+ new URL(string);
14
5
  return true;
15
6
  } catch {
16
7
  return false;
@@ -1,6 +1,2 @@
1
1
  import { Url } from './constraints';
2
- export interface IsUrlParams {
3
- hostname?: RegExp;
4
- protocol?: RegExp;
5
- }
6
- export declare function isUrl<GenericValue extends string>(string: GenericValue, params?: IsUrlParams): string is GenericValue & Url;
2
+ export declare function isUrl<GenericValue extends string>(string: GenericValue): string is GenericValue & Url;
@@ -1,16 +1,7 @@
1
1
  //#region scripts/string/isUrl.ts
2
- const regexRemoveDote = /:$/;
3
- function isUrl(string, params) {
2
+ function isUrl(string) {
4
3
  try {
5
- const url = new URL(string);
6
- if (params?.hostname) {
7
- params.hostname.lastIndex = 0;
8
- if (!params.hostname.test(url.hostname)) return false;
9
- }
10
- if (params?.protocol) {
11
- params.protocol.lastIndex = 0;
12
- if (!params.protocol.test(url.protocol.replace(regexRemoveDote, ""))) return false;
13
- }
4
+ new URL(string);
14
5
  return true;
15
6
  } catch {
16
7
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/lang",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {