@elaraai/east 0.0.1-beta.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.
- package/LICENSE.md +682 -0
- package/README.md +276 -0
- package/dist/src/analyze.d.ts +95 -0
- package/dist/src/analyze.d.ts.map +1 -0
- package/dist/src/analyze.js +1110 -0
- package/dist/src/analyze.js.map +1 -0
- package/dist/src/ast.d.ts +263 -0
- package/dist/src/ast.d.ts.map +1 -0
- package/dist/src/ast.js +151 -0
- package/dist/src/ast.js.map +1 -0
- package/dist/src/ast_to_ir.d.ts +24 -0
- package/dist/src/ast_to_ir.d.ts.map +1 -0
- package/dist/src/ast_to_ir.js +834 -0
- package/dist/src/ast_to_ir.js.map +1 -0
- package/dist/src/builtins.d.ts +18 -0
- package/dist/src/builtins.d.ts.map +1 -0
- package/dist/src/builtins.js +1105 -0
- package/dist/src/builtins.js.map +1 -0
- package/dist/src/comparison.d.ts +28 -0
- package/dist/src/comparison.d.ts.map +1 -0
- package/dist/src/comparison.js +1017 -0
- package/dist/src/comparison.js.map +1 -0
- package/dist/src/compile.d.ts +22 -0
- package/dist/src/compile.d.ts.map +1 -0
- package/dist/src/compile.js +3260 -0
- package/dist/src/compile.js.map +1 -0
- package/dist/src/containers/ref.d.ts +106 -0
- package/dist/src/containers/ref.d.ts.map +1 -0
- package/dist/src/containers/ref.js +100 -0
- package/dist/src/containers/ref.js.map +1 -0
- package/dist/src/containers/sortedmap.d.ts +165 -0
- package/dist/src/containers/sortedmap.d.ts.map +1 -0
- package/dist/src/containers/sortedmap.js +237 -0
- package/dist/src/containers/sortedmap.js.map +1 -0
- package/dist/src/containers/sortedset.d.ts +185 -0
- package/dist/src/containers/sortedset.d.ts.map +1 -0
- package/dist/src/containers/sortedset.js +312 -0
- package/dist/src/containers/sortedset.js.map +1 -0
- package/dist/src/containers/variant.d.ts +131 -0
- package/dist/src/containers/variant.d.ts.map +1 -0
- package/dist/src/containers/variant.js +68 -0
- package/dist/src/containers/variant.js.map +1 -0
- package/dist/src/datetime_format/parse.d.ts +50 -0
- package/dist/src/datetime_format/parse.d.ts.map +1 -0
- package/dist/src/datetime_format/parse.js +908 -0
- package/dist/src/datetime_format/parse.js.map +1 -0
- package/dist/src/datetime_format/print.d.ts +35 -0
- package/dist/src/datetime_format/print.d.ts.map +1 -0
- package/dist/src/datetime_format/print.js +157 -0
- package/dist/src/datetime_format/print.js.map +1 -0
- package/dist/src/datetime_format/tokenize.d.ts +76 -0
- package/dist/src/datetime_format/tokenize.d.ts.map +1 -0
- package/dist/src/datetime_format/tokenize.js +271 -0
- package/dist/src/datetime_format/tokenize.js.map +1 -0
- package/dist/src/datetime_format/types.d.ts +99 -0
- package/dist/src/datetime_format/types.d.ts.map +1 -0
- package/dist/src/datetime_format/types.js +103 -0
- package/dist/src/datetime_format/types.js.map +1 -0
- package/dist/src/datetime_format/validate.d.ts +51 -0
- package/dist/src/datetime_format/validate.d.ts.map +1 -0
- package/dist/src/datetime_format/validate.js +208 -0
- package/dist/src/datetime_format/validate.js.map +1 -0
- package/dist/src/default.d.ts +21 -0
- package/dist/src/default.d.ts.map +1 -0
- package/dist/src/default.js +82 -0
- package/dist/src/default.js.map +1 -0
- package/dist/src/eastir.d.ts +33 -0
- package/dist/src/eastir.d.ts.map +1 -0
- package/dist/src/eastir.js +92 -0
- package/dist/src/eastir.js.map +1 -0
- package/dist/src/error.d.ts +13 -0
- package/dist/src/error.d.ts.map +1 -0
- package/dist/src/error.js +8 -0
- package/dist/src/error.js.map +1 -0
- package/dist/src/expr/array.d.ts +1711 -0
- package/dist/src/expr/array.d.ts.map +1 -0
- package/dist/src/expr/array.js +1805 -0
- package/dist/src/expr/array.js.map +1 -0
- package/dist/src/expr/ast.d.ts +17 -0
- package/dist/src/expr/ast.d.ts.map +1 -0
- package/dist/src/expr/ast.js +302 -0
- package/dist/src/expr/ast.js.map +1 -0
- package/dist/src/expr/blob.d.ts +141 -0
- package/dist/src/expr/blob.d.ts.map +1 -0
- package/dist/src/expr/blob.js +198 -0
- package/dist/src/expr/blob.js.map +1 -0
- package/dist/src/expr/block.d.ts +201 -0
- package/dist/src/expr/block.d.ts.map +1 -0
- package/dist/src/expr/block.js +1505 -0
- package/dist/src/expr/block.js.map +1 -0
- package/dist/src/expr/boolean.d.ts +207 -0
- package/dist/src/expr/boolean.d.ts.map +1 -0
- package/dist/src/expr/boolean.js +261 -0
- package/dist/src/expr/boolean.js.map +1 -0
- package/dist/src/expr/datetime.d.ts +544 -0
- package/dist/src/expr/datetime.d.ts.map +1 -0
- package/dist/src/expr/datetime.js +980 -0
- package/dist/src/expr/datetime.js.map +1 -0
- package/dist/src/expr/dict.d.ts +1242 -0
- package/dist/src/expr/dict.d.ts.map +1 -0
- package/dist/src/expr/dict.js +1492 -0
- package/dist/src/expr/dict.js.map +1 -0
- package/dist/src/expr/expr.d.ts +95 -0
- package/dist/src/expr/expr.d.ts.map +1 -0
- package/dist/src/expr/expr.js +171 -0
- package/dist/src/expr/expr.js.map +1 -0
- package/dist/src/expr/float.d.ts +357 -0
- package/dist/src/expr/float.d.ts.map +1 -0
- package/dist/src/expr/float.js +637 -0
- package/dist/src/expr/float.js.map +1 -0
- package/dist/src/expr/function.d.ts +46 -0
- package/dist/src/expr/function.d.ts.map +1 -0
- package/dist/src/expr/function.js +58 -0
- package/dist/src/expr/function.js.map +1 -0
- package/dist/src/expr/index.d.ts +450 -0
- package/dist/src/expr/index.d.ts.map +1 -0
- package/dist/src/expr/index.js +423 -0
- package/dist/src/expr/index.js.map +1 -0
- package/dist/src/expr/integer.d.ts +256 -0
- package/dist/src/expr/integer.d.ts.map +1 -0
- package/dist/src/expr/integer.js +311 -0
- package/dist/src/expr/integer.js.map +1 -0
- package/dist/src/expr/libs/array.d.ts +106 -0
- package/dist/src/expr/libs/array.d.ts.map +1 -0
- package/dist/src/expr/libs/array.js +140 -0
- package/dist/src/expr/libs/array.js.map +1 -0
- package/dist/src/expr/libs/blob.d.ts +42 -0
- package/dist/src/expr/libs/blob.d.ts.map +1 -0
- package/dist/src/expr/libs/blob.js +70 -0
- package/dist/src/expr/libs/blob.js.map +1 -0
- package/dist/src/expr/libs/datetime.d.ts +479 -0
- package/dist/src/expr/libs/datetime.d.ts.map +1 -0
- package/dist/src/expr/libs/datetime.js +624 -0
- package/dist/src/expr/libs/datetime.js.map +1 -0
- package/dist/src/expr/libs/dict.d.ts +66 -0
- package/dist/src/expr/libs/dict.d.ts.map +1 -0
- package/dist/src/expr/libs/dict.js +77 -0
- package/dist/src/expr/libs/dict.js.map +1 -0
- package/dist/src/expr/libs/float.d.ts +299 -0
- package/dist/src/expr/libs/float.d.ts.map +1 -0
- package/dist/src/expr/libs/float.js +564 -0
- package/dist/src/expr/libs/float.js.map +1 -0
- package/dist/src/expr/libs/integer.d.ts +228 -0
- package/dist/src/expr/libs/integer.d.ts.map +1 -0
- package/dist/src/expr/libs/integer.js +398 -0
- package/dist/src/expr/libs/integer.js.map +1 -0
- package/dist/src/expr/libs/set.d.ts +59 -0
- package/dist/src/expr/libs/set.d.ts.map +1 -0
- package/dist/src/expr/libs/set.js +69 -0
- package/dist/src/expr/libs/set.js.map +1 -0
- package/dist/src/expr/libs/string.d.ts +71 -0
- package/dist/src/expr/libs/string.d.ts.map +1 -0
- package/dist/src/expr/libs/string.js +75 -0
- package/dist/src/expr/libs/string.js.map +1 -0
- package/dist/src/expr/never.d.ts +15 -0
- package/dist/src/expr/never.d.ts.map +1 -0
- package/dist/src/expr/never.js +12 -0
- package/dist/src/expr/never.js.map +1 -0
- package/dist/src/expr/null.d.ts +15 -0
- package/dist/src/expr/null.d.ts.map +1 -0
- package/dist/src/expr/null.js +12 -0
- package/dist/src/expr/null.js.map +1 -0
- package/dist/src/expr/ref.d.ts +103 -0
- package/dist/src/expr/ref.d.ts.map +1 -0
- package/dist/src/expr/ref.js +131 -0
- package/dist/src/expr/ref.js.map +1 -0
- package/dist/src/expr/regex_validation.d.ts +25 -0
- package/dist/src/expr/regex_validation.d.ts.map +1 -0
- package/dist/src/expr/regex_validation.js +130 -0
- package/dist/src/expr/regex_validation.js.map +1 -0
- package/dist/src/expr/set.d.ts +1071 -0
- package/dist/src/expr/set.d.ts.map +1 -0
- package/dist/src/expr/set.js +1137 -0
- package/dist/src/expr/set.js.map +1 -0
- package/dist/src/expr/string.d.ts +414 -0
- package/dist/src/expr/string.d.ts.map +1 -0
- package/dist/src/expr/string.js +683 -0
- package/dist/src/expr/string.js.map +1 -0
- package/dist/src/expr/struct.d.ts +48 -0
- package/dist/src/expr/struct.d.ts.map +1 -0
- package/dist/src/expr/struct.js +65 -0
- package/dist/src/expr/struct.js.map +1 -0
- package/dist/src/expr/types.d.ts +68 -0
- package/dist/src/expr/types.d.ts.map +1 -0
- package/dist/src/expr/types.js +6 -0
- package/dist/src/expr/types.js.map +1 -0
- package/dist/src/expr/variant.d.ts +137 -0
- package/dist/src/expr/variant.d.ts.map +1 -0
- package/dist/src/expr/variant.js +105 -0
- package/dist/src/expr/variant.js.map +1 -0
- package/dist/src/fuzz.d.ts +80 -0
- package/dist/src/fuzz.d.ts.map +1 -0
- package/dist/src/fuzz.js +300 -0
- package/dist/src/fuzz.js.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal.d.ts +36 -0
- package/dist/src/internal.d.ts.map +1 -0
- package/dist/src/internal.js +11 -0
- package/dist/src/internal.js.map +1 -0
- package/dist/src/ir.d.ts +1571 -0
- package/dist/src/ir.d.ts.map +1 -0
- package/dist/src/ir.js +56 -0
- package/dist/src/ir.js.map +1 -0
- package/dist/src/location.d.ts +48 -0
- package/dist/src/location.d.ts.map +1 -0
- package/dist/src/location.js +62 -0
- package/dist/src/location.js.map +1 -0
- package/dist/src/platform.d.ts +21 -0
- package/dist/src/platform.d.ts.map +1 -0
- package/dist/src/platform.js +8 -0
- package/dist/src/platform.js.map +1 -0
- package/dist/src/serialization/beast.d.ts +39 -0
- package/dist/src/serialization/beast.d.ts.map +1 -0
- package/dist/src/serialization/beast.js +555 -0
- package/dist/src/serialization/beast.js.map +1 -0
- package/dist/src/serialization/beast2-stream.d.ts +38 -0
- package/dist/src/serialization/beast2-stream.d.ts.map +1 -0
- package/dist/src/serialization/beast2-stream.js +665 -0
- package/dist/src/serialization/beast2-stream.js.map +1 -0
- package/dist/src/serialization/beast2.d.ts +41 -0
- package/dist/src/serialization/beast2.d.ts.map +1 -0
- package/dist/src/serialization/beast2.js +489 -0
- package/dist/src/serialization/beast2.js.map +1 -0
- package/dist/src/serialization/binary-utils.d.ts +151 -0
- package/dist/src/serialization/binary-utils.d.ts.map +1 -0
- package/dist/src/serialization/binary-utils.js +929 -0
- package/dist/src/serialization/binary-utils.js.map +1 -0
- package/dist/src/serialization/east.d.ts +84 -0
- package/dist/src/serialization/east.d.ts.map +1 -0
- package/dist/src/serialization/east.js +1802 -0
- package/dist/src/serialization/east.js.map +1 -0
- package/dist/src/serialization/index.d.ts +11 -0
- package/dist/src/serialization/index.d.ts.map +1 -0
- package/dist/src/serialization/index.js +12 -0
- package/dist/src/serialization/index.js.map +1 -0
- package/dist/src/serialization/json.d.ts +36 -0
- package/dist/src/serialization/json.d.ts.map +1 -0
- package/dist/src/serialization/json.js +849 -0
- package/dist/src/serialization/json.js.map +1 -0
- package/dist/src/type_of_type.d.ts +115 -0
- package/dist/src/type_of_type.d.ts.map +1 -0
- package/dist/src/type_of_type.js +362 -0
- package/dist/src/type_of_type.js.map +1 -0
- package/dist/src/types.d.ts +648 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1631 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Datetime formatting support for East.
|
|
7
|
+
*
|
|
8
|
+
* This module defines the structured representation of datetime format strings.
|
|
9
|
+
* Format strings are parsed once in the TypeScript SDK and serialized as structured
|
|
10
|
+
* tokens, ensuring consistent formatting behavior across all East backends.
|
|
11
|
+
*/
|
|
12
|
+
import { NullType, StringType, VariantType } from "../types.js";
|
|
13
|
+
import { variant } from "../containers/variant.js";
|
|
14
|
+
/**
|
|
15
|
+
* Structured representation of a datetime format string.
|
|
16
|
+
*
|
|
17
|
+
* Format strings are parsed into an array of tokens at AST construction time.
|
|
18
|
+
* Each token represents either a datetime component (year, month, day, etc.)
|
|
19
|
+
* or a literal string to be included verbatim in the output.
|
|
20
|
+
*
|
|
21
|
+
* This structured representation serves as East's "narrow waist" for datetime
|
|
22
|
+
* formatting - the TypeScript SDK parses format strings once, and all backends
|
|
23
|
+
* implement formatting from the same token structure, guaranteeing identical
|
|
24
|
+
* behavior across JavaScript, Julia, and other future backends.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Formats do not support timezones or locales.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Format string "YYYY-MM-DD" parses to:
|
|
32
|
+
* [
|
|
33
|
+
* variant("year4", null),
|
|
34
|
+
* variant("literal", "-"),
|
|
35
|
+
* variant("month2", null),
|
|
36
|
+
* variant("literal", "-"),
|
|
37
|
+
* variant("day2", null)
|
|
38
|
+
* ]
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const DateTimeFormatTokenType: VariantType<{
|
|
42
|
+
/**
|
|
43
|
+
* Literal text to include verbatim in formatted output.
|
|
44
|
+
* Any characters in the format string that are not recognized as format
|
|
45
|
+
* codes are treated as literals.
|
|
46
|
+
*/
|
|
47
|
+
literal: StringType;
|
|
48
|
+
/** Four-digit year (e.g., "2025") - Format: YYYY */
|
|
49
|
+
year4: NullType;
|
|
50
|
+
/** Two-digit year (e.g., "25") - Format: YY */
|
|
51
|
+
year2: NullType;
|
|
52
|
+
/** Month as 1-12 without zero-padding (e.g., "1", "12") - Format: M */
|
|
53
|
+
month1: NullType;
|
|
54
|
+
/** Month as 01-12 with zero-padding (e.g., "01", "12") - Format: MM */
|
|
55
|
+
month2: NullType;
|
|
56
|
+
/** Short month name (e.g., "Jan", "Feb") - Format: MMM */
|
|
57
|
+
monthNameShort: NullType;
|
|
58
|
+
/** Full month name (e.g., "January", "February") - Format: MMMM */
|
|
59
|
+
monthNameFull: NullType;
|
|
60
|
+
/** Day of month as 1-31 without zero-padding (e.g., "1", "31") - Format: D */
|
|
61
|
+
day1: NullType;
|
|
62
|
+
/** Day of month as 01-31 with zero-padding (e.g., "01", "31") - Format: DD */
|
|
63
|
+
day2: NullType;
|
|
64
|
+
/** Minimal weekday name (e.g., "Su", "Mo") - Format: dd */
|
|
65
|
+
weekdayNameMin: NullType;
|
|
66
|
+
/** Short weekday name (e.g., "Sun", "Mon") - Format: ddd */
|
|
67
|
+
weekdayNameShort: NullType;
|
|
68
|
+
/** Full weekday name (e.g., "Sunday", "Monday") - Format: dddd */
|
|
69
|
+
weekdayNameFull: NullType;
|
|
70
|
+
/** Hour 0-23 without zero-padding (e.g., "0", "23") - Format: H */
|
|
71
|
+
hour24_1: NullType;
|
|
72
|
+
/** Hour 00-23 with zero-padding (e.g., "00", "23") - Format: HH */
|
|
73
|
+
hour24_2: NullType;
|
|
74
|
+
/** Hour 1-12 without zero-padding (e.g., "1", "12") - Format: h */
|
|
75
|
+
hour12_1: NullType;
|
|
76
|
+
/** Hour 01-12 with zero-padding (e.g., "01", "12") - Format: hh */
|
|
77
|
+
hour12_2: NullType;
|
|
78
|
+
/** Minute 0-59 without zero-padding (e.g., "0", "59") - Format: m */
|
|
79
|
+
minute1: NullType;
|
|
80
|
+
/** Minute 00-59 with zero-padding (e.g., "00", "59") - Format: mm */
|
|
81
|
+
minute2: NullType;
|
|
82
|
+
/** Second 0-59 without zero-padding (e.g., "0", "59") - Format: s */
|
|
83
|
+
second1: NullType;
|
|
84
|
+
/** Second 00-59 with zero-padding (e.g., "00", "59") - Format: ss */
|
|
85
|
+
second2: NullType;
|
|
86
|
+
/** Millisecond 000-999 with zero-padding (e.g., "000", "999") - Format: SSS */
|
|
87
|
+
millisecond3: NullType;
|
|
88
|
+
/** Uppercase AM/PM (e.g., "AM", "PM") - Format: A */
|
|
89
|
+
ampmUpper: NullType;
|
|
90
|
+
/** Lowercase am/pm (e.g., "am", "pm") - Format: a */
|
|
91
|
+
ampmLower: NullType;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* TypeScript type for datetime format tokens.
|
|
95
|
+
*
|
|
96
|
+
* This is a union of all possible datetime format token variants.
|
|
97
|
+
*/
|
|
98
|
+
export type DateTimeFormatToken = variant<"literal", string> | variant<"year4", null> | variant<"year2", null> | variant<"month1", null> | variant<"month2", null> | variant<"monthNameShort", null> | variant<"monthNameFull", null> | variant<"day1", null> | variant<"day2", null> | variant<"weekdayNameMin", null> | variant<"weekdayNameShort", null> | variant<"weekdayNameFull", null> | variant<"hour24_1", null> | variant<"hour24_2", null> | variant<"hour12_1", null> | variant<"hour12_2", null> | variant<"minute1", null> | variant<"minute2", null> | variant<"second1", null> | variant<"second2", null> | variant<"millisecond3", null> | variant<"ampmUpper", null> | variant<"ampmLower", null>;
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/datetime_format/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;OAIG;;IAIH,oDAAoD;;IAEpD,+CAA+C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,IAAI,CAAC,GACxB,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,GAC7B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,GAC1B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Datetime formatting support for East.
|
|
7
|
+
*
|
|
8
|
+
* This module defines the structured representation of datetime format strings.
|
|
9
|
+
* Format strings are parsed once in the TypeScript SDK and serialized as structured
|
|
10
|
+
* tokens, ensuring consistent formatting behavior across all East backends.
|
|
11
|
+
*/
|
|
12
|
+
import { NullType, StringType, VariantType } from "../types.js";
|
|
13
|
+
import { variant } from "../containers/variant.js";
|
|
14
|
+
/**
|
|
15
|
+
* Structured representation of a datetime format string.
|
|
16
|
+
*
|
|
17
|
+
* Format strings are parsed into an array of tokens at AST construction time.
|
|
18
|
+
* Each token represents either a datetime component (year, month, day, etc.)
|
|
19
|
+
* or a literal string to be included verbatim in the output.
|
|
20
|
+
*
|
|
21
|
+
* This structured representation serves as East's "narrow waist" for datetime
|
|
22
|
+
* formatting - the TypeScript SDK parses format strings once, and all backends
|
|
23
|
+
* implement formatting from the same token structure, guaranteeing identical
|
|
24
|
+
* behavior across JavaScript, Julia, and other future backends.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Formats do not support timezones or locales.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Format string "YYYY-MM-DD" parses to:
|
|
32
|
+
* [
|
|
33
|
+
* variant("year4", null),
|
|
34
|
+
* variant("literal", "-"),
|
|
35
|
+
* variant("month2", null),
|
|
36
|
+
* variant("literal", "-"),
|
|
37
|
+
* variant("day2", null)
|
|
38
|
+
* ]
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const DateTimeFormatTokenType = VariantType({
|
|
42
|
+
/**
|
|
43
|
+
* Literal text to include verbatim in formatted output.
|
|
44
|
+
* Any characters in the format string that are not recognized as format
|
|
45
|
+
* codes are treated as literals.
|
|
46
|
+
*/
|
|
47
|
+
literal: StringType,
|
|
48
|
+
// Year
|
|
49
|
+
/** Four-digit year (e.g., "2025") - Format: YYYY */
|
|
50
|
+
year4: NullType,
|
|
51
|
+
/** Two-digit year (e.g., "25") - Format: YY */
|
|
52
|
+
year2: NullType,
|
|
53
|
+
// Month
|
|
54
|
+
/** Month as 1-12 without zero-padding (e.g., "1", "12") - Format: M */
|
|
55
|
+
month1: NullType,
|
|
56
|
+
/** Month as 01-12 with zero-padding (e.g., "01", "12") - Format: MM */
|
|
57
|
+
month2: NullType,
|
|
58
|
+
/** Short month name (e.g., "Jan", "Feb") - Format: MMM */
|
|
59
|
+
monthNameShort: NullType,
|
|
60
|
+
/** Full month name (e.g., "January", "February") - Format: MMMM */
|
|
61
|
+
monthNameFull: NullType,
|
|
62
|
+
// Day of month
|
|
63
|
+
/** Day of month as 1-31 without zero-padding (e.g., "1", "31") - Format: D */
|
|
64
|
+
day1: NullType,
|
|
65
|
+
/** Day of month as 01-31 with zero-padding (e.g., "01", "31") - Format: DD */
|
|
66
|
+
day2: NullType,
|
|
67
|
+
// Day of week
|
|
68
|
+
/** Minimal weekday name (e.g., "Su", "Mo") - Format: dd */
|
|
69
|
+
weekdayNameMin: NullType,
|
|
70
|
+
/** Short weekday name (e.g., "Sun", "Mon") - Format: ddd */
|
|
71
|
+
weekdayNameShort: NullType,
|
|
72
|
+
/** Full weekday name (e.g., "Sunday", "Monday") - Format: dddd */
|
|
73
|
+
weekdayNameFull: NullType,
|
|
74
|
+
// Hour (24-hour)
|
|
75
|
+
/** Hour 0-23 without zero-padding (e.g., "0", "23") - Format: H */
|
|
76
|
+
hour24_1: NullType,
|
|
77
|
+
/** Hour 00-23 with zero-padding (e.g., "00", "23") - Format: HH */
|
|
78
|
+
hour24_2: NullType,
|
|
79
|
+
// Hour (12-hour)
|
|
80
|
+
/** Hour 1-12 without zero-padding (e.g., "1", "12") - Format: h */
|
|
81
|
+
hour12_1: NullType,
|
|
82
|
+
/** Hour 01-12 with zero-padding (e.g., "01", "12") - Format: hh */
|
|
83
|
+
hour12_2: NullType,
|
|
84
|
+
// Minute
|
|
85
|
+
/** Minute 0-59 without zero-padding (e.g., "0", "59") - Format: m */
|
|
86
|
+
minute1: NullType,
|
|
87
|
+
/** Minute 00-59 with zero-padding (e.g., "00", "59") - Format: mm */
|
|
88
|
+
minute2: NullType,
|
|
89
|
+
// Second
|
|
90
|
+
/** Second 0-59 without zero-padding (e.g., "0", "59") - Format: s */
|
|
91
|
+
second1: NullType,
|
|
92
|
+
/** Second 00-59 with zero-padding (e.g., "00", "59") - Format: ss */
|
|
93
|
+
second2: NullType,
|
|
94
|
+
// Millisecond
|
|
95
|
+
/** Millisecond 000-999 with zero-padding (e.g., "000", "999") - Format: SSS */
|
|
96
|
+
millisecond3: NullType,
|
|
97
|
+
// AM/PM
|
|
98
|
+
/** Uppercase AM/PM (e.g., "AM", "PM") - Format: A */
|
|
99
|
+
ampmUpper: NullType,
|
|
100
|
+
/** Lowercase am/pm (e.g., "am", "pm") - Format: a */
|
|
101
|
+
ampmLower: NullType,
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/datetime_format/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,uBAAuB,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4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Validation for datetime format tokens to ensure they form a valid
|
|
7
|
+
* contiguous prefix of components (can't skip from year to hour without month/day).
|
|
8
|
+
*/
|
|
9
|
+
import type { DateTimeFormatToken } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Result of validating datetime format tokens.
|
|
12
|
+
*/
|
|
13
|
+
export type DateTimeFormatValidationResult = {
|
|
14
|
+
valid: true;
|
|
15
|
+
} | {
|
|
16
|
+
valid: false;
|
|
17
|
+
error: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Validates that datetime format tokens form a valid contiguous prefix.
|
|
21
|
+
*
|
|
22
|
+
* The component hierarchy is: Year → Month → Day → Hour → Minute → Second → Millisecond
|
|
23
|
+
*
|
|
24
|
+
* Valid prefixes:
|
|
25
|
+
* - (empty) - for time-only formats like "HH:mm"
|
|
26
|
+
* - Year - e.g., "YYYY"
|
|
27
|
+
* - Year, Month - e.g., "YYYY-MM"
|
|
28
|
+
* - Year, Month, Day - e.g., "YYYY-MM-DD"
|
|
29
|
+
* - Year, Month, Day, Hour - e.g., "YYYY-MM-DD HH"
|
|
30
|
+
* - Year, Month, Day, Hour, Minute - e.g., "YYYY-MM-DD HH:mm"
|
|
31
|
+
* - etc.
|
|
32
|
+
*
|
|
33
|
+
* Invalid combinations:
|
|
34
|
+
* - Year, Hour (skipped Month and Day) - e.g., "YYYY HH:mm"
|
|
35
|
+
* - Month without Year - e.g., "MM-DD"
|
|
36
|
+
* - Day without Year and Month - e.g., "DD"
|
|
37
|
+
*
|
|
38
|
+
* @param tokens - Array of format tokens to validate
|
|
39
|
+
* @returns Validation result indicating success or error
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const tokens = tokenizeDateTimeFormat("YYYY HH:mm");
|
|
44
|
+
* const result = validateDateTimeFormatTokens(tokens);
|
|
45
|
+
* if (!result.valid) {
|
|
46
|
+
* console.error(result.error); // "Invalid format: cannot have hour without month and day..."
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateDateTimeFormatTokens(tokens: DateTimeFormatToken[]): DateTimeFormatValidationResult;
|
|
51
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/datetime_format/validate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACf;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,8BAA8B,CA4L1G"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Validates that datetime format tokens form a valid contiguous prefix.
|
|
7
|
+
*
|
|
8
|
+
* The component hierarchy is: Year → Month → Day → Hour → Minute → Second → Millisecond
|
|
9
|
+
*
|
|
10
|
+
* Valid prefixes:
|
|
11
|
+
* - (empty) - for time-only formats like "HH:mm"
|
|
12
|
+
* - Year - e.g., "YYYY"
|
|
13
|
+
* - Year, Month - e.g., "YYYY-MM"
|
|
14
|
+
* - Year, Month, Day - e.g., "YYYY-MM-DD"
|
|
15
|
+
* - Year, Month, Day, Hour - e.g., "YYYY-MM-DD HH"
|
|
16
|
+
* - Year, Month, Day, Hour, Minute - e.g., "YYYY-MM-DD HH:mm"
|
|
17
|
+
* - etc.
|
|
18
|
+
*
|
|
19
|
+
* Invalid combinations:
|
|
20
|
+
* - Year, Hour (skipped Month and Day) - e.g., "YYYY HH:mm"
|
|
21
|
+
* - Month without Year - e.g., "MM-DD"
|
|
22
|
+
* - Day without Year and Month - e.g., "DD"
|
|
23
|
+
*
|
|
24
|
+
* @param tokens - Array of format tokens to validate
|
|
25
|
+
* @returns Validation result indicating success or error
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const tokens = tokenizeDateTimeFormat("YYYY HH:mm");
|
|
30
|
+
* const result = validateDateTimeFormatTokens(tokens);
|
|
31
|
+
* if (!result.valid) {
|
|
32
|
+
* console.error(result.error); // "Invalid format: cannot have hour without month and day..."
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function validateDateTimeFormatTokens(tokens) {
|
|
37
|
+
// Check which component categories are present
|
|
38
|
+
let hasYear = false;
|
|
39
|
+
let hasMonth = false;
|
|
40
|
+
let hasDay = false;
|
|
41
|
+
let hasHour = false;
|
|
42
|
+
let hasMinute = false;
|
|
43
|
+
let hasSecond = false;
|
|
44
|
+
let hasMillisecond = false;
|
|
45
|
+
for (const token of tokens) {
|
|
46
|
+
switch (token.type) {
|
|
47
|
+
case "year4":
|
|
48
|
+
case "year2":
|
|
49
|
+
hasYear = true;
|
|
50
|
+
break;
|
|
51
|
+
case "month2":
|
|
52
|
+
case "month1":
|
|
53
|
+
case "monthNameFull":
|
|
54
|
+
case "monthNameShort":
|
|
55
|
+
hasMonth = true;
|
|
56
|
+
break;
|
|
57
|
+
case "day2":
|
|
58
|
+
case "day1":
|
|
59
|
+
hasDay = true;
|
|
60
|
+
break;
|
|
61
|
+
case "hour24_2":
|
|
62
|
+
case "hour24_1":
|
|
63
|
+
case "hour12_2":
|
|
64
|
+
case "hour12_1":
|
|
65
|
+
hasHour = true;
|
|
66
|
+
break;
|
|
67
|
+
case "minute2":
|
|
68
|
+
case "minute1":
|
|
69
|
+
hasMinute = true;
|
|
70
|
+
break;
|
|
71
|
+
case "second2":
|
|
72
|
+
case "second1":
|
|
73
|
+
hasSecond = true;
|
|
74
|
+
break;
|
|
75
|
+
case "millisecond3":
|
|
76
|
+
hasMillisecond = true;
|
|
77
|
+
break;
|
|
78
|
+
// Weekday, AM/PM, and literals don't affect the hierarchy
|
|
79
|
+
case "weekdayNameFull":
|
|
80
|
+
case "weekdayNameShort":
|
|
81
|
+
case "weekdayNameMin":
|
|
82
|
+
case "ampmUpper":
|
|
83
|
+
case "ampmLower":
|
|
84
|
+
case "literal":
|
|
85
|
+
break;
|
|
86
|
+
default: {
|
|
87
|
+
// TypeScript exhaustiveness check
|
|
88
|
+
const _exhaustive = token;
|
|
89
|
+
return {
|
|
90
|
+
valid: false,
|
|
91
|
+
error: `Unknown token type: ${_exhaustive.type}`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Validate the "contiguous prefix" invariant
|
|
97
|
+
// The hierarchy is: Year → Month → Day → Hour → Minute → Second → Millisecond
|
|
98
|
+
// If we have month, we must have year
|
|
99
|
+
if (hasMonth && !hasYear) {
|
|
100
|
+
return {
|
|
101
|
+
valid: false,
|
|
102
|
+
error: "Invalid format: cannot have month without year. Use YYYY or YY before month tokens."
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// If we have day, we must have year and month
|
|
106
|
+
if (hasDay && !hasYear) {
|
|
107
|
+
return {
|
|
108
|
+
valid: false,
|
|
109
|
+
error: "Invalid format: cannot have day without year. Use YYYY or YY before day tokens."
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (hasDay && !hasMonth) {
|
|
113
|
+
return {
|
|
114
|
+
valid: false,
|
|
115
|
+
error: "Invalid format: cannot have day without month. Use MM or M before day tokens."
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// If we have hour, we must have year, month, and day (or none of them for time-only)
|
|
119
|
+
if (hasHour && hasYear && !hasMonth) {
|
|
120
|
+
return {
|
|
121
|
+
valid: false,
|
|
122
|
+
error: "Invalid format: cannot skip from year to hour. Include month (MM or M) and day (DD or D) tokens, or remove year for time-only format."
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (hasHour && hasYear && hasMonth && !hasDay) {
|
|
126
|
+
return {
|
|
127
|
+
valid: false,
|
|
128
|
+
error: "Invalid format: cannot skip from year/month to hour. Include day (DD or D) token, or remove year/month for time-only format."
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// If we have minute, we must have hour (and if we have date components, all of them)
|
|
132
|
+
if (hasMinute && !hasHour) {
|
|
133
|
+
return {
|
|
134
|
+
valid: false,
|
|
135
|
+
error: "Invalid format: cannot have minute without hour. Use HH or H before minute tokens."
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (hasMinute && hasYear && !hasMonth) {
|
|
139
|
+
return {
|
|
140
|
+
valid: false,
|
|
141
|
+
error: "Invalid format: cannot skip from year to minute. Include month and day tokens, or remove year for time-only format."
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (hasMinute && hasYear && hasMonth && !hasDay) {
|
|
145
|
+
return {
|
|
146
|
+
valid: false,
|
|
147
|
+
error: "Invalid format: cannot skip from year/month to minute. Include day token, or remove year/month for time-only format."
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// If we have second, we must have hour and minute
|
|
151
|
+
if (hasSecond && !hasHour) {
|
|
152
|
+
return {
|
|
153
|
+
valid: false,
|
|
154
|
+
error: "Invalid format: cannot have second without hour. Use HH or H before second tokens."
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (hasSecond && !hasMinute) {
|
|
158
|
+
return {
|
|
159
|
+
valid: false,
|
|
160
|
+
error: "Invalid format: cannot have second without minute. Use mm or m before second tokens."
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if (hasSecond && hasYear && !hasMonth) {
|
|
164
|
+
return {
|
|
165
|
+
valid: false,
|
|
166
|
+
error: "Invalid format: cannot skip from year to second. Include month and day tokens, or remove year for time-only format."
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (hasSecond && hasYear && hasMonth && !hasDay) {
|
|
170
|
+
return {
|
|
171
|
+
valid: false,
|
|
172
|
+
error: "Invalid format: cannot skip from year/month to second. Include day token, or remove year/month for time-only format."
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// If we have millisecond, we must have hour, minute, and second
|
|
176
|
+
if (hasMillisecond && !hasHour) {
|
|
177
|
+
return {
|
|
178
|
+
valid: false,
|
|
179
|
+
error: "Invalid format: cannot have millisecond without hour. Use HH or H before millisecond tokens."
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (hasMillisecond && !hasMinute) {
|
|
183
|
+
return {
|
|
184
|
+
valid: false,
|
|
185
|
+
error: "Invalid format: cannot have millisecond without minute. Use mm or m before millisecond tokens."
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (hasMillisecond && !hasSecond) {
|
|
189
|
+
return {
|
|
190
|
+
valid: false,
|
|
191
|
+
error: "Invalid format: cannot have millisecond without second. Use ss or s before millisecond tokens."
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (hasMillisecond && hasYear && !hasMonth) {
|
|
195
|
+
return {
|
|
196
|
+
valid: false,
|
|
197
|
+
error: "Invalid format: cannot skip from year to millisecond. Include month and day tokens, or remove year for time-only format."
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (hasMillisecond && hasYear && hasMonth && !hasDay) {
|
|
201
|
+
return {
|
|
202
|
+
valid: false,
|
|
203
|
+
error: "Invalid format: cannot skip from year/month to millisecond. Include day token, or remove year/month for time-only format."
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return { valid: true };
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/datetime_format/validate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAA6B;IACxE,+CAA+C;IAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,OAAO,CAAC;YACb,KAAK,OAAO;gBACV,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YAER,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,eAAe,CAAC;YACrB,KAAK,gBAAgB;gBACnB,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM;YAER,KAAK,MAAM,CAAC;YACZ,KAAK,MAAM;gBACT,MAAM,GAAG,IAAI,CAAC;gBACd,MAAM;YAER,KAAK,UAAU,CAAC;YAChB,KAAK,UAAU,CAAC;YAChB,KAAK,UAAU,CAAC;YAChB,KAAK,UAAU;gBACb,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YAER,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;YAER,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;YAER,KAAK,cAAc;gBACjB,cAAc,GAAG,IAAI,CAAC;gBACtB,MAAM;YAER,0DAA0D;YAC1D,KA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IACJ,CAAC;IACD,IAAI,cAAc,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,gGAAgG;SACxG,CAAC;IACJ,CAAC;IACD,IAAI,cAAc,IAAI,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3C,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,0HAA0H;SAClI,CAAC;IACJ,CAAC;IACD,IAAI,cAAc,IAAI,OAAO,IAAI,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,2HAA2H;SACnI,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type EastTypeValue } from "./type_of_type.js";
|
|
6
|
+
import type { EastType, ValueTypeOf } from "./types.js";
|
|
7
|
+
/** Provide a default value for a given {@link EastType}, such as `0.0` for floats and `""` for strings.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link defaultValue} to create a typical default value, like `0.0` for floats.
|
|
10
|
+
*/
|
|
11
|
+
export declare function defaultValue(type: EastTypeValue): any;
|
|
12
|
+
export declare function defaultValue<T extends EastType>(type: EastType): ValueTypeOf<T>;
|
|
13
|
+
/** Provide the minimal possible value for a given {@link EastType}, such as `-Infinity` for floats and `""` for strings.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link defaultValue} to create a typical default value, like `0.0` for floats.
|
|
16
|
+
*
|
|
17
|
+
* Note that there is no maximal value for unbounded types - including strings, blobs, arrays, sets and dicts, so no `maximalValue` function is provided.
|
|
18
|
+
*/
|
|
19
|
+
export declare function minimalValue(type: EastTypeValue): any;
|
|
20
|
+
export declare function minimalValue<T extends EastType>(type: T): ValueTypeOf<T>;
|
|
21
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/default.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIxD;;;EAGE;AACF,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAA;AACtD,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAwChF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAA;AACtD,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { toEastTypeValue } from "./type_of_type.js";
|
|
6
|
+
import { isVariant, match, variant } from "./containers/variant.js";
|
|
7
|
+
import { ref } from "./containers/ref.js";
|
|
8
|
+
export function defaultValue(type) {
|
|
9
|
+
// convert EastTypeValue to EastType if needed
|
|
10
|
+
if (!isVariant(type)) {
|
|
11
|
+
type = toEastTypeValue(type);
|
|
12
|
+
}
|
|
13
|
+
return match(type, {
|
|
14
|
+
Never: _ => { throw new Error(`Cannot create a default value of type .Never`); },
|
|
15
|
+
Null: _ => null,
|
|
16
|
+
Boolean: _ => false,
|
|
17
|
+
Integer: _ => 0n,
|
|
18
|
+
Float: _ => 0.0,
|
|
19
|
+
String: _ => "",
|
|
20
|
+
DateTime: _ => new Date(0),
|
|
21
|
+
Blob: _ => new Uint8Array(),
|
|
22
|
+
Ref: t => ref(defaultValue(t)),
|
|
23
|
+
Array: _ => [],
|
|
24
|
+
Set: _ => new Set(),
|
|
25
|
+
Dict: _ => new Map(),
|
|
26
|
+
Struct: field_types => {
|
|
27
|
+
const obj = {};
|
|
28
|
+
for (const { name, type } of field_types) {
|
|
29
|
+
obj[name] = defaultValue(type);
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
},
|
|
33
|
+
Variant: case_types => {
|
|
34
|
+
const first_case = case_types[0];
|
|
35
|
+
if (first_case === undefined) {
|
|
36
|
+
throw new Error(`Cannot create a value of an empty variant`);
|
|
37
|
+
}
|
|
38
|
+
const { name, type } = first_case;
|
|
39
|
+
return variant(name, defaultValue(type));
|
|
40
|
+
},
|
|
41
|
+
Recursive: _ => { throw new Error("Cannot create a default value of type .Recursive"); },
|
|
42
|
+
Function: _ => { throw new Error(`Cannot create a default value of type .Function`); },
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function minimalValue(type) {
|
|
46
|
+
// convert EastTypeValue to EastType if needed
|
|
47
|
+
if (!isVariant(type)) {
|
|
48
|
+
type = toEastTypeValue(type);
|
|
49
|
+
}
|
|
50
|
+
return match(type, {
|
|
51
|
+
Never: _ => { throw new Error(`Cannot create a default value of type .Never`); },
|
|
52
|
+
Null: _ => null,
|
|
53
|
+
Boolean: _ => false,
|
|
54
|
+
Integer: _ => 0n,
|
|
55
|
+
Float: _ => 0.0,
|
|
56
|
+
String: _ => "",
|
|
57
|
+
DateTime: _ => new Date(0),
|
|
58
|
+
Blob: _ => new Uint8Array(),
|
|
59
|
+
Ref: t => ref(minimalValue(t)),
|
|
60
|
+
Array: _ => [],
|
|
61
|
+
Set: _ => new Set(),
|
|
62
|
+
Dict: _ => new Map(),
|
|
63
|
+
Struct: field_types => {
|
|
64
|
+
const obj = {};
|
|
65
|
+
for (const { name, type } of field_types) {
|
|
66
|
+
obj[name] = defaultValue(type);
|
|
67
|
+
}
|
|
68
|
+
return obj;
|
|
69
|
+
},
|
|
70
|
+
Variant: case_types => {
|
|
71
|
+
const first_case = case_types[0];
|
|
72
|
+
if (first_case === undefined) {
|
|
73
|
+
throw new Error(`Cannot create a value of an empty variant`);
|
|
74
|
+
}
|
|
75
|
+
const { name, type } = first_case;
|
|
76
|
+
return variant(name, defaultValue(type));
|
|
77
|
+
},
|
|
78
|
+
Recursive: _ => { throw new Error("Cannot create a default value of type .Recursive"); },
|
|
79
|
+
Function: _ => { throw new Error(`Cannot create a default value of type .Function`); },
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/default.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAQ1C,MAAM,UAAU,YAAY,CAAC,IAA8B;IACzD,8CAA8C;IAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,KAAK,CAAC,IAAqB,EAAE;QAClC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA,CAAC,CAAC;QAC/E,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI;QACf,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK;QACnB,OAAO,EAAE,CAAC,CAAC,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CAAC;YACjC,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,EAAE,UAAU,CAAC,EAAE;YACpB,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC/D,CAAC;YACD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YAClC,OAAO,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC,CAAC,CAAC;QACxF,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA,CAAC,CAAC;KACtF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type ValueTypeOf } from "./types.js";
|
|
6
|
+
import type { FunctionIR } from "./ir.js";
|
|
7
|
+
import type { PlatformFunction } from "./platform.js";
|
|
8
|
+
/** A helper class wrapping East's "intermediate representation" (IR) for a free function.
|
|
9
|
+
* The IR can be serialized and saved, or compiled so that the function can be executed.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EastIR<Inputs extends any[], Output extends any> {
|
|
12
|
+
ir: FunctionIR;
|
|
13
|
+
constructor(ir: FunctionIR);
|
|
14
|
+
/** Compile the function for execution in JavaScript using a closure-compiler technique.
|
|
15
|
+
* Platform functions must be provided for the function to evaluate.
|
|
16
|
+
*
|
|
17
|
+
* This method is for synchronous platforms only. Use compileAsync() if any platform function is async.
|
|
18
|
+
* @throws {Error} if any platform function is async
|
|
19
|
+
*/
|
|
20
|
+
compile(platform: PlatformFunction[]): (...inputs: {
|
|
21
|
+
[K in keyof Inputs]: ValueTypeOf<Inputs[K]>;
|
|
22
|
+
}) => ValueTypeOf<Output>;
|
|
23
|
+
/** Compile the function for execution in JavaScript using a closure-compiler technique.
|
|
24
|
+
* Platform functions must be provided for the function to evaluate.
|
|
25
|
+
*
|
|
26
|
+
* This method is for platforms with async functions. Use compile() if all platform functions are sync.
|
|
27
|
+
* @throws {Error} if no platform functions are async
|
|
28
|
+
*/
|
|
29
|
+
compileAsync(platform: PlatformFunction[]): (...inputs: {
|
|
30
|
+
[K in keyof Inputs]: ValueTypeOf<Inputs[K]>;
|
|
31
|
+
}) => Promise<ValueTypeOf<Output>>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=eastir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eastir.d.ts","sourceRoot":"","sources":["../../src/eastir.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;GAEG;AACH,qBAAa,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,EAAE,MAAM,SAAS,GAAG;IACvC,EAAE,EAAE,UAAU;gBAAd,EAAE,EAAE,UAAU;IASjC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE;SAAG,CAAC,IAAI,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAAE,KAAK,WAAW,CAAC,MAAM,CAAC;IAmC1H;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE;SAAG,CAAC,IAAI,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAAE,KAAK,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAmCzI"}
|