@evolu/common 8.0.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -337,30 +337,6 @@ export type Awaitable<T> = T | PromiseLike<T>;
337
337
  * ```
338
338
  */
339
339
  export declare const isPromiseLike: <T>(value: Awaitable<T>) => value is PromiseLike<T>;
340
- /** Decimal digit from `"0"` to `"9"`. */
341
- export type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
342
- /** Decimal digit from `"1"` to `"9"`. */
343
- export type Digit1To9 = Exclude<Digit, "0">;
344
- /** Decimal string from `"1"` to `"6"`. */
345
- export type Digit1To6 = "1" | "2" | "3" | "4" | "5" | "6";
346
- /** Decimal string from `"1"` to `"23"`. */
347
- export type Digit1To23 = Digit1To9 | `1${Digit}` | `2${"0" | "1" | "2" | "3"}`;
348
- /** Decimal string from `"1"` to `"51"`. */
349
- export type Digit1To51 = Digit1To9 | `${"1" | "2" | "3" | "4"}${Digit}` | `5${"0" | "1"}`;
350
- /** Decimal string from `"1"` to `"99"`. */
351
- export type Digit1To99 = Digit1To9 | `${Digit1To9}${Digit}`;
352
- /** Decimal string from `"1"` to `"59"`. */
353
- export type Digit1To59 = Digit1To9 | `1${Digit}` | `2${Digit}` | `3${Digit}` | `4${Digit}` | `5${Digit}`;
354
- /** Numeric literal 1-99. */
355
- export type Int1To99 = NumberFromString<Digit1To99>;
356
- /** Numeric literal 1-100. */
357
- export type Int1To100 = Int1To99 | 100;
358
- /**
359
- * Parses a numeric literal type from a string literal.
360
- *
361
- * Used by {@link Int1To99}.
362
- */
363
- export type NumberFromString<T extends string> = T extends `${infer N extends number}` ? N : never;
364
340
  /** Creates a readable compiler-facing error message. */
365
341
  export type CompileTimeError<Context extends string, Message extends string> = `⛔ ${Context} error: ${Message}`;
366
342
  /** Returns whether a type is a union. */
@@ -1 +1 @@
1
- {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/Types.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EACtB,OAAO,SAAS,MAAM,IACpB,KAAK,OAAO,WAAW,OAAO,EAAE,CAAC;AAErC,yCAAyC;AACzC,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACnD,KAAK,GACL,CAAC,SAAS,KAAK,GACb,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GACjB,KAAK,GACL,IAAI,GACN,KAAK,CAAC;AAEZ,mEAAmE;AACnE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC;AAE3D,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAC3C,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAC1B,CAAC,GACD,KAAK,CAAC;AAEV,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GACzE,CAAC,GACD,OAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GACtE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,KAAK,CAAC"}
@@ -8,11 +8,13 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- import type { ArrayError, BetweenError, CapitalizedError, DateIsoError, DiscriminatedUnionError, FiniteError, GreaterThanError, GreaterThanOrEqualToError, InstanceOfError, Int64Error, IntError, JsonError, JsonValueError, LengthError, LessThanError, LessThanOrEqualToError, LiteralError, MaxLengthError, MinLengthError, MultipleOfError, NegativeError, NeverError, NonNaNError, NonNegativeError, NonPositiveError, ObjectError, ObjectTagError, PositiveDecimalStringError, PositiveError, RecordError, RegexError, TrimmedError, TupleError, TypeErrorFormatter, TypeOfError, UInt64Error, UnionError } from "../Type.ts";
11
+ import type { ArrayError, BetweenError, CapitalizedError, DateIsoError, DecimalStringError, DiscriminatedUnionError, FiniteError, GreaterThanError, GreaterThanOrEqualToError, InstanceOfError, Int64Error, IntError, JsonError, JsonValueError, LengthError, LessThanError, LessThanOrEqualToError, LiteralError, MaxLengthError, MinLengthError, MultipleOfError, NegativeDecimalStringError, NegativeError, NeverError, NonNaNError, NonNegativeDecimalStringError, NonNegativeError, NonPositiveDecimalStringError, NonPositiveError, ObjectError, ObjectTagError, PositiveDecimalStringError, PositiveError, RecordError, RegexError, TemplateLiteralError, TrimmedError, TupleError, TypeErrorFormatter, TypeOfError, UInt64Error, UnionError } from "../Type.ts";
12
12
  /** Formats a NeverError in Czech. */
13
13
  export declare const formatNeverError: TypeErrorFormatter<NeverError>;
14
14
  /** Formats a String TypeOfError in Czech. */
15
15
  export declare const formatStringError: TypeErrorFormatter<TypeOfError<"String">>;
16
+ /** Formats a TemplateLiteralError in Czech. */
17
+ export declare const formatTemplateLiteralError: TypeErrorFormatter<TemplateLiteralError>;
16
18
  /** Formats a Number TypeOfError in Czech. */
17
19
  export declare const formatNumberError: TypeErrorFormatter<TypeOfError<"Number">>;
18
20
  /** Formats a BigInt TypeOfError in Czech. */
@@ -33,6 +35,8 @@ export declare const formatLiteralError: TypeErrorFormatter<LiteralError>;
33
35
  export declare const formatUnionError: TypeErrorFormatter<UnionError>;
34
36
  /** Formats a DateIsoError in Czech. */
35
37
  export declare const formatDateIsoError: TypeErrorFormatter<DateIsoError>;
38
+ /** Formats a DecimalStringError in Czech. */
39
+ export declare const formatDecimalStringError: TypeErrorFormatter<DecimalStringError>;
36
40
  /** Formats an Int64Error in Czech. */
37
41
  export declare const formatInt64Error: TypeErrorFormatter<Int64Error>;
38
42
  /** Formats a UInt64Error in Czech. */
@@ -51,14 +55,20 @@ export declare const formatLengthError: TypeErrorFormatter<LengthError>;
51
55
  export declare const formatRegexError: TypeErrorFormatter<RegexError>;
52
56
  /** Formats a NonNegativeError in Czech. */
53
57
  export declare const formatNonNegativeError: TypeErrorFormatter<NonNegativeError>;
58
+ /** Formats a NonNegativeDecimalStringError in Czech. */
59
+ export declare const formatNonNegativeDecimalStringError: TypeErrorFormatter<NonNegativeDecimalStringError>;
54
60
  /** Formats a PositiveError in Czech. */
55
61
  export declare const formatPositiveError: TypeErrorFormatter<PositiveError>;
56
62
  /** Formats a PositiveDecimalStringError in Czech. */
57
63
  export declare const formatPositiveDecimalStringError: TypeErrorFormatter<PositiveDecimalStringError>;
58
64
  /** Formats a NonPositiveError in Czech. */
59
65
  export declare const formatNonPositiveError: TypeErrorFormatter<NonPositiveError>;
66
+ /** Formats a NonPositiveDecimalStringError in Czech. */
67
+ export declare const formatNonPositiveDecimalStringError: TypeErrorFormatter<NonPositiveDecimalStringError>;
60
68
  /** Formats a NegativeError in Czech. */
61
69
  export declare const formatNegativeError: TypeErrorFormatter<NegativeError>;
70
+ /** Formats a NegativeDecimalStringError in Czech. */
71
+ export declare const formatNegativeDecimalStringError: TypeErrorFormatter<NegativeDecimalStringError>;
62
72
  /** Formats an IntError in Czech. */
63
73
  export declare const formatIntError: TypeErrorFormatter<IntError>;
64
74
  /** Formats a GreaterThanError in Czech. */
@@ -1 +1 @@
1
- {"version":3,"file":"cs.d.ts","sourceRoot":"","sources":["../../../src/intl/cs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,cAAc,EACd,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,cAAc,E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O,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,WAAW,CACpC,CAAC;AAE3B,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,WAAW,CACiB,CAAC;AAEhF,0CAA0C;AAC1C,eAAO,MAAM,qBAAqB,EAAE,kBAAkB,CAAC,eAAe,CAG2B,CAAC;AAElG,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,EAAE,kBAAkB,CAAC,YAAY,CACkD,CAAC;AAEnH,sCAAsC;AACtC,eAAO,MAAM,gBAAgB,EAAE,kBAAkB,CAAC,UAAU,CAgB3D,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,EAAE,kBAAkB,CAAC,UAAU,CAoB3D,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,WAAW,CAsB7D,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,WAAW,CA4B7D,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAC5D,uBAAuB,CAoBxB,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,cAAc,CAyBnE,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,eAAe,EAAE,kBAAkB,CAAC,SAAS,CACyB,CAAC"}
@@ -18,6 +18,8 @@ const formatPlainObjectRootError = (reason) => reason.kind === "NotObject"
18
18
  export const formatNeverError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} není platná pro typ Never.`;
19
19
  /** Formats a String TypeOfError in Czech. */
20
20
  export const formatStringError = () => "Hodnota musí být text.";
21
+ /** Formats a TemplateLiteralError in Czech. */
22
+ export const formatTemplateLiteralError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} neodpovídá šablonovému řetězci.`;
21
23
  /** Formats a Number TypeOfError in Czech. */
22
24
  export const formatNumberError = (error) => formatValueMustBe(error.value, "číslo");
23
25
  /** Formats a BigInt TypeOfError in Czech. */
@@ -38,6 +40,8 @@ export const formatLiteralError = (error) => `Hodnota ${safelyStringifyUnknownVa
38
40
  export const formatUnionError = () => "Hodnota neodpovídá žádné z povolených variant.";
39
41
  /** Formats a DateIsoError in Czech. */
40
42
  export const formatDateIsoError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být datum a čas v kanonickém formátu ISO.`;
43
+ /** Formats a DecimalStringError in Czech. */
44
+ export const formatDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kanonický řetězec představující desetinné číslo.`;
41
45
  /** Formats an Int64Error in Czech. */
42
46
  export const formatInt64Error = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být platné 64bitové celé číslo se znaménkem (Int64).`;
43
47
  /** Formats a UInt64Error in Czech. */
@@ -58,14 +62,20 @@ export const formatLengthError = (error) => `Hodnota ${safelyStringifyUnknownVal
58
62
  export const formatRegexError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} neodpovídá regulárnímu výrazu /${error.source}/${error.flags}.`;
59
63
  /** Formats a NonNegativeError in Czech. */
60
64
  export const formatNonNegativeError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být nezáporná (>= 0).`;
65
+ /** Formats a NonNegativeDecimalStringError in Czech. */
66
+ export const formatNonNegativeDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující nezáporné desetinné číslo.`;
61
67
  /** Formats a PositiveError in Czech. */
62
68
  export const formatPositiveError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kladná (> 0).`;
63
69
  /** Formats a PositiveDecimalStringError in Czech. */
64
- export const formatPositiveDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být kanonický řetězec představující kladné desetinné číslo.`;
70
+ export const formatPositiveDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující kladné desetinné číslo.`;
65
71
  /** Formats a NonPositiveError in Czech. */
66
72
  export const formatNonPositiveError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být nekladná (<= 0).`;
73
+ /** Formats a NonPositiveDecimalStringError in Czech. */
74
+ export const formatNonPositiveDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující nekladné desetinné číslo.`;
67
75
  /** Formats a NegativeError in Czech. */
68
76
  export const formatNegativeError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být záporná (< 0).`;
77
+ /** Formats a NegativeDecimalStringError in Czech. */
78
+ export const formatNegativeDecimalStringError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být řetězec představující záporné desetinné číslo.`;
69
79
  /** Formats an IntError in Czech. */
70
80
  export const formatIntError = (error) => `Hodnota ${safelyStringifyUnknownValue(error.value)} musí být bezpečné celé číslo.`;
71
81
  /** Formats a GreaterThanError in Czech. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/common",
3
- "version": "8.0.0",
3
+ "version": "8.2.0",
4
4
  "description": "TypeScript library and local-first platform",
5
5
  "keywords": [
6
6
  "evolu",
package/src/Number.ts CHANGED
@@ -11,21 +11,86 @@ import type { Result } from "./Result.ts";
11
11
  import { err, ok } from "./Result.ts";
12
12
  import {
13
13
  brand,
14
+ Digit1To9,
15
+ Digit1To99,
14
16
  lessThanOrEqualTo,
15
17
  onePositiveInt,
16
18
  NonNegativeInt,
17
19
  PositiveInt,
18
20
  Ratio,
21
+ templateLiteral,
22
+ union,
19
23
  } from "./Type.ts";
20
- import type {
21
- Digit,
22
- Digit1To9,
23
- Digit1To99,
24
- Predicate,
25
- WidenLiteral,
26
- } from "./Types.ts";
24
+ import type { Predicate, WidenLiteral } from "./Types.ts";
25
+
26
+ /** Integer literal from `1` to `99`. */
27
+ export type Int1To99 = Digit1To99 extends `${infer Value extends number}`
28
+ ? Value
29
+ : never;
30
+
31
+ /** Integer literal from `1` to `100`. */
32
+ export type Int1To100 = Int1To99 | 100;
33
+
34
+ /**
35
+ * Integer literal from 0 to 100 or {@link NonNegativeInt}.
36
+ *
37
+ * Convenience input accepting integer literals from 0 to 100 or an
38
+ * already-validated {@link NonNegativeInt} for larger or dynamic values.
39
+ *
40
+ * ### Example
41
+ *
42
+ * ```ts
43
+ * import {
44
+ * NonNegativeInt,
45
+ * type Int0To100OrNonNegativeInt,
46
+ * } from "@evolu/common";
47
+ *
48
+ * const literal: Int0To100OrNonNegativeInt = 10;
49
+ * const validated: Int0To100OrNonNegativeInt = NonNegativeInt.orThrow(101);
50
+ *
51
+ * assert(literal === 10);
52
+ * assert(validated === 101);
53
+ * ```
54
+ */
55
+ export type Int0To100OrNonNegativeInt = 0 | Int1To100 | NonNegativeInt;
27
56
 
28
- /** Percentage represented as a readable literal or a validated ratio. */
57
+ /**
58
+ * {@link Int1To100} or {@link PositiveInt}.
59
+ *
60
+ * Convenience input accepting integer literals from 1 to 100 or an
61
+ * already-validated {@link PositiveInt} for larger or dynamic values.
62
+ *
63
+ * ### Example
64
+ *
65
+ * ```ts
66
+ * import { PositiveInt, type Int1To100OrPositiveInt } from "@evolu/common";
67
+ *
68
+ * const literal: Int1To100OrPositiveInt = 10;
69
+ * const validated: Int1To100OrPositiveInt = PositiveInt.orThrow(101);
70
+ *
71
+ * assert(literal === 10);
72
+ * assert(validated === 101);
73
+ * ```
74
+ */
75
+ export type Int1To100OrPositiveInt = Int1To100 | PositiveInt;
76
+
77
+ /**
78
+ * {@link PercentageLiteral} or {@link Ratio}.
79
+ *
80
+ * Convenience input accepting a readable {@link PercentageLiteral} or a
81
+ * validated {@link Ratio}. APIs normalize it to `Ratio`.
82
+ *
83
+ * ### Example
84
+ *
85
+ * ```ts
86
+ * import { Ratio, jitter } from "@evolu/common";
87
+ *
88
+ * const readableJitter = jitter("50%");
89
+ * const computedJitter = jitter(Ratio.orThrow(0.5));
90
+ *
91
+ * expectTypeOf(readableJitter).toEqualTypeOf(computedJitter);
92
+ * ```
93
+ */
29
94
  export type Percentage = PercentageLiteral | Ratio;
30
95
 
31
96
  /**
@@ -34,8 +99,18 @@ export type Percentage = PercentageLiteral | Ratio;
34
99
  * Decimal literals support one decimal place. Use {@link Ratio} for computed
35
100
  * values or greater precision.
36
101
  */
37
- export type PercentageLiteral =
38
- "0%" | "100%" | `${Digit1To99}%` | `${Digit | Digit1To99}.${Digit1To9}%`;
102
+ export const PercentageLiteral = /*#__PURE__*/ union(
103
+ "0%",
104
+ "100%",
105
+ /*#__PURE__*/ templateLiteral(Digit1To99, "%"),
106
+ /*#__PURE__*/ templateLiteral(
107
+ /*#__PURE__*/ union("0", Digit1To99),
108
+ ".",
109
+ Digit1To9,
110
+ "%",
111
+ ),
112
+ );
113
+ export type PercentageLiteral = typeof PercentageLiteral.Output;
39
114
 
40
115
  /** Converts a {@link Percentage} to its numeric {@link Ratio}. */
41
116
  export const percentageToRatio = (percentage: Percentage): Ratio =>
@@ -45,10 +120,6 @@ export const percentageToRatio = (percentage: Percentage): Ratio =>
45
120
 
46
121
  export const increment = (n: number): number => n + 1;
47
122
 
48
- /** Increments a positive integer, saturating at the maximum safe integer. */
49
- export const incrementPositiveInt = (n: PositiveInt): PositiveInt =>
50
- PositiveInt.orNull(increment(n)) ?? n;
51
-
52
123
  export const decrement = (n: number): number => n - 1;
53
124
 
54
125
  /** Clamps a number within a given range. */
package/src/Schedule.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  fibonacciAt,
9
9
  FibonacciIndex,
10
10
  increment,
11
+ type Int0To100OrNonNegativeInt,
11
12
  max,
12
13
  min,
13
14
  type Percentage,
@@ -28,7 +29,6 @@ import {
28
29
  } from "./Time.ts";
29
30
  import {
30
31
  assertType,
31
- type Int0To100OrNonNegativeInt,
32
32
  NonNaNNumber,
33
33
  NonNegativeFiniteNumber,
34
34
  type NonNegativeInt,
package/src/Task.ts CHANGED
@@ -42,7 +42,7 @@ import {
42
42
  type TestLeakDetectorDep,
43
43
  } from "./LeakDetector.ts";
44
44
  import { createLookupMap, type Lookup, type LookupOption } from "./Lookup.ts";
45
- import { decrement, increment, incrementPositiveInt } from "./Number.ts";
45
+ import { decrement, increment, type Int1To100OrPositiveInt } from "./Number.ts";
46
46
  import {
47
47
  emptyRecord,
48
48
  mapObject,
@@ -101,7 +101,6 @@ import {
101
101
  Unknown,
102
102
  UnknownResult,
103
103
  type Id,
104
- type Int1To100OrPositiveInt,
105
104
  type ObjectType,
106
105
  type RecordType,
107
106
  type Typed,
@@ -3871,7 +3870,7 @@ export const retry =
3871
3870
 
3872
3871
  const [output, delay] = next.value;
3873
3872
  onRetry?.({ error, attempt, output, delay });
3874
- attempt = incrementPositiveInt(attempt);
3873
+ attempt = PositiveInt.orThrow(increment(attempt));
3875
3874
  if (delay > 0) await run.ok(sleep(PositiveMillis.orThrow(delay)));
3876
3875
  }
3877
3876
  };
@@ -4000,7 +3999,7 @@ export const repeat =
4000
3999
 
4001
4000
  const [output, delay] = next.value;
4002
4001
  onRepeat?.({ value: result.value, attempt, output, delay });
4003
- attempt = incrementPositiveInt(attempt);
4002
+ attempt = PositiveInt.orThrow(increment(attempt));
4004
4003
  if (delay > 0) await run.ok(sleep(PositiveMillis.orThrow(delay)));
4005
4004
  }
4006
4005
  };
package/src/Time.ts CHANGED
@@ -10,12 +10,6 @@ import type { yieldNow } from "./Task.ts";
10
10
  import {
11
11
  brand,
12
12
  type DateIso,
13
- lessThan,
14
- type NonNaNNumber,
15
- NonNegativeInt,
16
- positive,
17
- } from "./Type.ts";
18
- import type {
19
13
  Digit,
20
14
  Digit1To23,
21
15
  Digit1To51,
@@ -23,7 +17,13 @@ import type {
23
17
  Digit1To6,
24
18
  Digit1To9,
25
19
  Digit1To99,
26
- } from "./Types.ts";
20
+ lessThan,
21
+ type NonNaNNumber,
22
+ NonNegativeInt,
23
+ positive,
24
+ templateLiteral,
25
+ union,
26
+ } from "./Type.ts";
27
27
 
28
28
  /** Time and timer operations. */
29
29
  export interface Time {
@@ -376,104 +376,150 @@ export const performanceDurationBetween = (
376
376
  };
377
377
 
378
378
  /**
379
- * Duration can be either a {@link DurationLiteral} or milliseconds as
380
- * {@link Millis}.
379
+ * {@link DurationLiteral} or {@link Millis}.
380
+ *
381
+ * Convenience input accepting a human-readable {@link DurationLiteral} or
382
+ * validated milliseconds as {@link Millis}. APIs normalize it to `Millis`.
383
+ *
384
+ * ### Example
385
+ *
386
+ * ```ts
387
+ * import { Millis, spaced } from "@evolu/common";
388
+ *
389
+ * const readableSchedule = spaced("1s");
390
+ * const validatedSchedule = spaced(Millis.orThrow(1000));
391
+ *
392
+ * expectTypeOf(readableSchedule).toEqualTypeOf(validatedSchedule);
393
+ * ```
381
394
  */
382
395
  export type Duration = DurationLiteral | Millis;
383
396
 
384
- /** Positive duration accepted by timer-based APIs. */
385
- export type PositiveDuration = DurationLiteral | PositiveMillis;
386
-
387
397
  /**
388
- * Duration literal with compile-time validation.
398
+ * {@link DurationLiteral} or {@link PositiveMillis}.
389
399
  *
390
- * Supported formats:
391
- *
392
- * - Milliseconds: `1ms`, `500ms`, `999ms` (1-999)
393
- * - Seconds: `1s`, `59s`, `12.5s` (1-59, 1.1-59.9)
394
- * - Minutes: `1m`, `59m`, `12.5m` (1-59, 1.1-59.9)
395
- * - Hours: `1h`, `23h`, `12.5h` (1-23, 1.1-23.9)
396
- * - Days: `1d`, `6d`, `1.5d` (1-6, 1.1-6.9)
397
- * - Weeks: `1w`, `51w`, `1.5w` (1-51, 1.1-51.9)
398
- * - Months: not supported (variable length)
399
- * - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
400
+ * Convenience input accepting a human-readable {@link DurationLiteral} or
401
+ * validated milliseconds as {@link PositiveMillis} for timer-based APIs.
400
402
  *
401
- * Each unit uses a bounded range. Where units convert exactly, this avoids
402
- * equivalent representations (e.g., 1000ms must be written as `"1s"`, not
403
- * `"1000ms"`).
403
+ * ### Example
404
404
  *
405
- * Decimal values cover cases like 1.5s (1500ms) or 1.5h (90 minutes) without
406
- * allowing redundant forms. For precise values that don't fit (e.g., 1050ms),
407
- * use {@link Millis} directly.
405
+ * ```ts
406
+ * import { PositiveMillis, sleep } from "@evolu/common";
408
407
  *
409
- * Zero duration (0ms) is not supported. For yielding without delay, use `await
410
- * Promise.resolve()` for microtasks or the {@link yieldNow} for macrotasks.
408
+ * const readableSleep = sleep("1s");
409
+ * const validatedSleep = sleep(PositiveMillis.orThrow(1000));
411
410
  *
412
- * See {@link Duration} for a type that also accepts {@link Millis}. Use
413
- * {@link durationToMillis} to convert to milliseconds.
411
+ * expectTypeOf(readableSleep).toEqualTypeOf(validatedSleep);
412
+ * ```
414
413
  */
415
- export type DurationLiteral =
416
- | DurationLiteralMilliseconds
417
- | DurationLiteralSeconds
418
- | DurationLiteralMinutes
419
- | DurationLiteralHours
420
- | DurationLiteralDays
421
- | DurationLiteralWeeks
422
- | DurationLiteralYears;
414
+ export type PositiveDuration = DurationLiteral | PositiveMillis;
423
415
 
424
416
  /** Milliseconds duration: `"1ms"` to `"999ms"`. See {@link DurationLiteral}. */
417
+ export const DurationLiteralMilliseconds = /*#__PURE__*/ union(
418
+ /*#__PURE__*/ templateLiteral(Digit1To9, "ms"),
419
+ /*#__PURE__*/ templateLiteral(Digit1To9, Digit, "ms"),
420
+ /*#__PURE__*/ templateLiteral(Digit1To9, Digit, Digit, "ms"),
421
+ );
425
422
  export type DurationLiteralMilliseconds =
426
- | `${Digit1To9}ms` // 1-9
427
- | `${Digit1To9}${Digit}ms` // 10-99
428
- | `${Digit1To9}${Digit}${Digit}ms`; // 100-999
423
+ typeof DurationLiteralMilliseconds.Output;
429
424
 
430
425
  /**
431
426
  * Seconds duration: `"1s"` to `"59s"` or `"1.1s"` to `"59.9s"`. See
432
427
  * {@link DurationLiteral}.
433
428
  */
434
- export type DurationLiteralSeconds =
435
- | `${Digit1To59}s` // 1-59
436
- | `${Digit1To59}.${Digit1To9}s`; // 1.1-59.9
429
+ export const DurationLiteralSeconds = /*#__PURE__*/ union(
430
+ /*#__PURE__*/ templateLiteral(Digit1To59, "s"),
431
+ /*#__PURE__*/ templateLiteral(Digit1To59, ".", Digit1To9, "s"),
432
+ );
433
+ export type DurationLiteralSeconds = typeof DurationLiteralSeconds.Output;
437
434
 
438
435
  /**
439
436
  * Minutes duration: `"1m"` to `"59m"` or `"1.1m"` to `"59.9m"`. See
440
437
  * {@link DurationLiteral}.
441
438
  */
442
- export type DurationLiteralMinutes =
443
- | `${Digit1To59}m` // 1-59
444
- | `${Digit1To59}.${Digit1To9}m`; // 1.1-59.9
439
+ export const DurationLiteralMinutes = /*#__PURE__*/ union(
440
+ /*#__PURE__*/ templateLiteral(Digit1To59, "m"),
441
+ /*#__PURE__*/ templateLiteral(Digit1To59, ".", Digit1To9, "m"),
442
+ );
443
+ export type DurationLiteralMinutes = typeof DurationLiteralMinutes.Output;
445
444
 
446
445
  /**
447
446
  * Hours duration: `"1h"` to `"23h"` or `"1.1h"` to `"23.9h"`. See
448
447
  * {@link DurationLiteral}.
449
448
  */
450
- export type DurationLiteralHours =
451
- | `${Digit1To23}h` // 1-23
452
- | `${Digit1To23}.${Digit1To9}h`; // 1.1-23.9
449
+ export const DurationLiteralHours = /*#__PURE__*/ union(
450
+ /*#__PURE__*/ templateLiteral(Digit1To23, "h"),
451
+ /*#__PURE__*/ templateLiteral(Digit1To23, ".", Digit1To9, "h"),
452
+ );
453
+ export type DurationLiteralHours = typeof DurationLiteralHours.Output;
453
454
 
454
455
  /**
455
456
  * Days duration: `"1d"` to `"6d"` or `"1.1d"` to `"6.9d"`. See
456
457
  * {@link DurationLiteral}.
457
458
  */
458
- export type DurationLiteralDays =
459
- | `${Digit1To6}d` // 1-6
460
- | `${Digit1To6}.${Digit1To9}d`; // 1.1-6.9
459
+ export const DurationLiteralDays = /*#__PURE__*/ union(
460
+ /*#__PURE__*/ templateLiteral(Digit1To6, "d"),
461
+ /*#__PURE__*/ templateLiteral(Digit1To6, ".", Digit1To9, "d"),
462
+ );
463
+ export type DurationLiteralDays = typeof DurationLiteralDays.Output;
461
464
 
462
465
  /**
463
466
  * Weeks duration: `"1w"` to `"51w"` or `"1.1w"` to `"51.9w"`. See
464
467
  * {@link DurationLiteral}.
465
468
  */
466
- export type DurationLiteralWeeks =
467
- | `${Digit1To51}w` // 1-51
468
- | `${Digit1To51}.${Digit1To9}w`; // 1.1-51.9
469
+ export const DurationLiteralWeeks = /*#__PURE__*/ union(
470
+ /*#__PURE__*/ templateLiteral(Digit1To51, "w"),
471
+ /*#__PURE__*/ templateLiteral(Digit1To51, ".", Digit1To9, "w"),
472
+ );
473
+ export type DurationLiteralWeeks = typeof DurationLiteralWeeks.Output;
469
474
 
470
475
  /**
471
476
  * Years duration: `"1y"` to `"99y"` or `"1.1y"` to `"99.9y"`. See
472
477
  * {@link DurationLiteral}.
473
478
  */
474
- export type DurationLiteralYears =
475
- | `${Digit1To99}y` // 1-99
476
- | `${Digit1To99}.${Digit1To9}y`; // 1.1-99.9
479
+ export const DurationLiteralYears = /*#__PURE__*/ union(
480
+ /*#__PURE__*/ templateLiteral(Digit1To99, "y"),
481
+ /*#__PURE__*/ templateLiteral(Digit1To99, ".", Digit1To9, "y"),
482
+ );
483
+ export type DurationLiteralYears = typeof DurationLiteralYears.Output;
484
+
485
+ /**
486
+ * Duration literal Type with compile-time and runtime validation.
487
+ *
488
+ * Supported formats:
489
+ *
490
+ * - Milliseconds: `1ms`, `500ms`, `999ms` (1-999)
491
+ * - Seconds: `1s`, `59s`, `12.5s` (1-59, 1.1-59.9)
492
+ * - Minutes: `1m`, `59m`, `12.5m` (1-59, 1.1-59.9)
493
+ * - Hours: `1h`, `23h`, `12.5h` (1-23, 1.1-23.9)
494
+ * - Days: `1d`, `6d`, `1.5d` (1-6, 1.1-6.9)
495
+ * - Weeks: `1w`, `51w`, `1.5w` (1-51, 1.1-51.9)
496
+ * - Months: not supported (variable length)
497
+ * - Years: `1y`, `99y`, `1.5y` (1-99, 1.1-99.9)
498
+ *
499
+ * Each unit uses a bounded range. Where units convert exactly, this avoids
500
+ * equivalent representations (e.g., 1000ms must be written as `"1s"`, not
501
+ * `"1000ms"`).
502
+ *
503
+ * Decimal values cover cases like 1.5s (1500ms) or 1.5h (90 minutes) without
504
+ * allowing redundant forms. For precise values that don't fit (e.g., 1050ms),
505
+ * use {@link Millis} directly.
506
+ *
507
+ * Zero duration (0ms) is not supported. For yielding without delay, use `await
508
+ * Promise.resolve()` for microtasks or the {@link yieldNow} for macrotasks.
509
+ *
510
+ * See {@link Duration} for a type that also accepts {@link Millis}. Use
511
+ * {@link durationToMillis} to convert to milliseconds.
512
+ */
513
+ export const DurationLiteral = /*#__PURE__*/ union(
514
+ DurationLiteralMilliseconds,
515
+ DurationLiteralSeconds,
516
+ DurationLiteralMinutes,
517
+ DurationLiteralHours,
518
+ DurationLiteralDays,
519
+ DurationLiteralWeeks,
520
+ DurationLiteralYears,
521
+ );
522
+ export type DurationLiteral = typeof DurationLiteral.Output;
477
523
 
478
524
  /**
479
525
  * Converts a duration to milliseconds.