@venizia/ignis-helpers 0.2.2-2 → 0.2.2-3

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 (195) hide show
  1. package/dist/cjs/modules/temporal/abstract.d.ts +295 -0
  2. package/dist/cjs/modules/temporal/abstract.d.ts.map +1 -0
  3. package/dist/cjs/modules/temporal/abstract.js +330 -0
  4. package/dist/cjs/modules/temporal/abstract.js.map +1 -0
  5. package/dist/cjs/modules/temporal/adapters/dayjs.d.ts +1 -1
  6. package/dist/cjs/modules/temporal/adapters/dayjs.d.ts.map +1 -1
  7. package/dist/cjs/modules/temporal/adapters/dayjs.js +3 -3
  8. package/dist/cjs/modules/temporal/adapters/dayjs.js.map +1 -1
  9. package/dist/cjs/modules/temporal/adapters/intl.d.ts +1 -1
  10. package/dist/cjs/modules/temporal/adapters/intl.d.ts.map +1 -1
  11. package/dist/cjs/modules/temporal/adapters/intl.js +7 -7
  12. package/dist/cjs/modules/temporal/adapters/intl.js.map +1 -1
  13. package/dist/cjs/modules/temporal/adapters/luxon.d.ts +1 -1
  14. package/dist/cjs/modules/temporal/adapters/luxon.d.ts.map +1 -1
  15. package/dist/cjs/modules/temporal/adapters/luxon.js +3 -3
  16. package/dist/cjs/modules/temporal/adapters/luxon.js.map +1 -1
  17. package/dist/cjs/modules/temporal/adapters/native.d.ts +3 -1
  18. package/dist/cjs/modules/temporal/adapters/native.d.ts.map +1 -1
  19. package/dist/cjs/modules/temporal/adapters/native.js +13 -5
  20. package/dist/cjs/modules/temporal/adapters/native.js.map +1 -1
  21. package/dist/cjs/modules/temporal/calendar/calendar.d.ts +56 -0
  22. package/dist/cjs/modules/temporal/calendar/calendar.d.ts.map +1 -0
  23. package/dist/cjs/modules/temporal/calendar/calendar.js +166 -0
  24. package/dist/cjs/modules/temporal/calendar/calendar.js.map +1 -0
  25. package/dist/cjs/modules/temporal/calendar/index.d.ts +2 -0
  26. package/dist/cjs/modules/temporal/calendar/index.d.ts.map +1 -0
  27. package/dist/cjs/modules/temporal/calendar/index.js +18 -0
  28. package/dist/cjs/modules/temporal/calendar/index.js.map +1 -0
  29. package/dist/cjs/modules/temporal/common/constants.d.ts +14 -3
  30. package/dist/cjs/modules/temporal/common/constants.d.ts.map +1 -1
  31. package/dist/cjs/modules/temporal/common/constants.js +23 -4
  32. package/dist/cjs/modules/temporal/common/constants.js.map +1 -1
  33. package/dist/cjs/modules/temporal/common/types.d.ts +258 -5
  34. package/dist/cjs/modules/temporal/common/types.d.ts.map +1 -1
  35. package/dist/cjs/modules/temporal/{duration.d.ts → duration/duration.d.ts} +9 -2
  36. package/dist/cjs/modules/temporal/duration/duration.d.ts.map +1 -0
  37. package/dist/cjs/modules/temporal/duration/duration.js +135 -0
  38. package/dist/cjs/modules/temporal/duration/duration.js.map +1 -0
  39. package/dist/cjs/modules/temporal/duration/index.d.ts +2 -0
  40. package/dist/cjs/modules/temporal/duration/index.d.ts.map +1 -0
  41. package/dist/cjs/modules/temporal/duration/index.js +18 -0
  42. package/dist/cjs/modules/temporal/duration/index.js.map +1 -0
  43. package/dist/cjs/modules/temporal/helper.d.ts +105 -77
  44. package/dist/cjs/modules/temporal/helper.d.ts.map +1 -1
  45. package/dist/cjs/modules/temporal/helper.js +209 -258
  46. package/dist/cjs/modules/temporal/helper.js.map +1 -1
  47. package/dist/cjs/modules/temporal/index.d.ts +1 -0
  48. package/dist/cjs/modules/temporal/index.d.ts.map +1 -1
  49. package/dist/cjs/modules/temporal/index.js +1 -0
  50. package/dist/cjs/modules/temporal/index.js.map +1 -1
  51. package/dist/cjs/modules/temporal/locale/index.d.ts +2 -0
  52. package/dist/cjs/modules/temporal/locale/index.d.ts.map +1 -0
  53. package/dist/cjs/modules/temporal/locale/index.js +18 -0
  54. package/dist/cjs/modules/temporal/locale/index.js.map +1 -0
  55. package/dist/{esm/modules/temporal → cjs/modules/temporal/locale}/locale.d.ts +3 -2
  56. package/dist/cjs/modules/temporal/locale/locale.d.ts.map +1 -0
  57. package/dist/cjs/modules/temporal/{locale.js → locale/locale.js} +3 -3
  58. package/dist/cjs/modules/temporal/locale/locale.js.map +1 -0
  59. package/dist/cjs/modules/temporal/pattern/common/index.d.ts +2 -0
  60. package/dist/cjs/modules/temporal/pattern/common/index.d.ts.map +1 -0
  61. package/dist/cjs/modules/temporal/pattern/common/index.js +18 -0
  62. package/dist/cjs/modules/temporal/pattern/common/index.js.map +1 -0
  63. package/dist/cjs/modules/temporal/pattern/common/types.d.ts +26 -0
  64. package/dist/cjs/modules/temporal/pattern/common/types.d.ts.map +1 -0
  65. package/dist/cjs/modules/temporal/pattern/common/types.js +3 -0
  66. package/dist/cjs/modules/temporal/pattern/common/types.js.map +1 -0
  67. package/dist/cjs/modules/temporal/pattern/index.d.ts +4 -0
  68. package/dist/cjs/modules/temporal/pattern/index.d.ts.map +1 -0
  69. package/dist/cjs/modules/temporal/pattern/index.js +20 -0
  70. package/dist/cjs/modules/temporal/pattern/index.js.map +1 -0
  71. package/dist/{esm/modules/temporal → cjs/modules/temporal/pattern}/pattern.d.ts +2 -1
  72. package/dist/cjs/modules/temporal/pattern/pattern.d.ts.map +1 -0
  73. package/dist/cjs/modules/temporal/{pattern.js → pattern/pattern.js} +19 -14
  74. package/dist/cjs/modules/temporal/pattern/pattern.js.map +1 -0
  75. package/dist/cjs/modules/temporal/pattern/tokens.d.ts +59 -0
  76. package/dist/cjs/modules/temporal/pattern/tokens.d.ts.map +1 -0
  77. package/dist/cjs/modules/temporal/pattern/tokens.js +195 -0
  78. package/dist/cjs/modules/temporal/pattern/tokens.js.map +1 -0
  79. package/dist/esm/modules/temporal/abstract.d.ts +295 -0
  80. package/dist/esm/modules/temporal/abstract.d.ts.map +1 -0
  81. package/dist/esm/modules/temporal/abstract.js +326 -0
  82. package/dist/esm/modules/temporal/abstract.js.map +1 -0
  83. package/dist/esm/modules/temporal/adapters/dayjs.d.ts +1 -1
  84. package/dist/esm/modules/temporal/adapters/dayjs.d.ts.map +1 -1
  85. package/dist/esm/modules/temporal/adapters/dayjs.js +3 -3
  86. package/dist/esm/modules/temporal/adapters/dayjs.js.map +1 -1
  87. package/dist/esm/modules/temporal/adapters/intl.d.ts +1 -1
  88. package/dist/esm/modules/temporal/adapters/intl.d.ts.map +1 -1
  89. package/dist/esm/modules/temporal/adapters/intl.js +7 -7
  90. package/dist/esm/modules/temporal/adapters/intl.js.map +1 -1
  91. package/dist/esm/modules/temporal/adapters/luxon.d.ts +1 -1
  92. package/dist/esm/modules/temporal/adapters/luxon.d.ts.map +1 -1
  93. package/dist/esm/modules/temporal/adapters/luxon.js +3 -3
  94. package/dist/esm/modules/temporal/adapters/luxon.js.map +1 -1
  95. package/dist/esm/modules/temporal/adapters/native.d.ts +3 -1
  96. package/dist/esm/modules/temporal/adapters/native.d.ts.map +1 -1
  97. package/dist/esm/modules/temporal/adapters/native.js +13 -5
  98. package/dist/esm/modules/temporal/adapters/native.js.map +1 -1
  99. package/dist/esm/modules/temporal/calendar/calendar.d.ts +56 -0
  100. package/dist/esm/modules/temporal/calendar/calendar.d.ts.map +1 -0
  101. package/dist/esm/modules/temporal/calendar/calendar.js +162 -0
  102. package/dist/esm/modules/temporal/calendar/calendar.js.map +1 -0
  103. package/dist/esm/modules/temporal/calendar/index.d.ts +2 -0
  104. package/dist/esm/modules/temporal/calendar/index.d.ts.map +1 -0
  105. package/dist/esm/modules/temporal/calendar/index.js +2 -0
  106. package/dist/esm/modules/temporal/calendar/index.js.map +1 -0
  107. package/dist/esm/modules/temporal/common/constants.d.ts +14 -3
  108. package/dist/esm/modules/temporal/common/constants.d.ts.map +1 -1
  109. package/dist/esm/modules/temporal/common/constants.js +21 -3
  110. package/dist/esm/modules/temporal/common/constants.js.map +1 -1
  111. package/dist/esm/modules/temporal/common/types.d.ts +258 -5
  112. package/dist/esm/modules/temporal/common/types.d.ts.map +1 -1
  113. package/dist/esm/modules/temporal/{duration.d.ts → duration/duration.d.ts} +9 -2
  114. package/dist/esm/modules/temporal/duration/duration.d.ts.map +1 -0
  115. package/dist/esm/modules/temporal/duration/duration.js +131 -0
  116. package/dist/esm/modules/temporal/duration/duration.js.map +1 -0
  117. package/dist/esm/modules/temporal/duration/index.d.ts +2 -0
  118. package/dist/esm/modules/temporal/duration/index.d.ts.map +1 -0
  119. package/dist/esm/modules/temporal/duration/index.js +2 -0
  120. package/dist/esm/modules/temporal/duration/index.js.map +1 -0
  121. package/dist/esm/modules/temporal/helper.d.ts +105 -77
  122. package/dist/esm/modules/temporal/helper.d.ts.map +1 -1
  123. package/dist/esm/modules/temporal/helper.js +214 -263
  124. package/dist/esm/modules/temporal/helper.js.map +1 -1
  125. package/dist/esm/modules/temporal/index.d.ts +1 -0
  126. package/dist/esm/modules/temporal/index.d.ts.map +1 -1
  127. package/dist/esm/modules/temporal/index.js +1 -0
  128. package/dist/esm/modules/temporal/index.js.map +1 -1
  129. package/dist/esm/modules/temporal/locale/index.d.ts +2 -0
  130. package/dist/esm/modules/temporal/locale/index.d.ts.map +1 -0
  131. package/dist/esm/modules/temporal/locale/index.js +2 -0
  132. package/dist/esm/modules/temporal/locale/index.js.map +1 -0
  133. package/dist/{cjs/modules/temporal → esm/modules/temporal/locale}/locale.d.ts +3 -2
  134. package/dist/esm/modules/temporal/locale/locale.d.ts.map +1 -0
  135. package/dist/esm/modules/temporal/{locale.js → locale/locale.js} +3 -3
  136. package/dist/esm/modules/temporal/locale/locale.js.map +1 -0
  137. package/dist/esm/modules/temporal/pattern/common/index.d.ts +2 -0
  138. package/dist/esm/modules/temporal/pattern/common/index.d.ts.map +1 -0
  139. package/dist/esm/modules/temporal/pattern/common/index.js +2 -0
  140. package/dist/esm/modules/temporal/pattern/common/index.js.map +1 -0
  141. package/dist/esm/modules/temporal/pattern/common/types.d.ts +26 -0
  142. package/dist/esm/modules/temporal/pattern/common/types.d.ts.map +1 -0
  143. package/dist/esm/modules/temporal/pattern/common/types.js +2 -0
  144. package/dist/esm/modules/temporal/pattern/common/types.js.map +1 -0
  145. package/dist/esm/modules/temporal/pattern/index.d.ts +4 -0
  146. package/dist/esm/modules/temporal/pattern/index.d.ts.map +1 -0
  147. package/dist/esm/modules/temporal/pattern/index.js +4 -0
  148. package/dist/esm/modules/temporal/pattern/index.js.map +1 -0
  149. package/dist/{cjs/modules/temporal → esm/modules/temporal/pattern}/pattern.d.ts +2 -1
  150. package/dist/esm/modules/temporal/pattern/pattern.d.ts.map +1 -0
  151. package/dist/esm/modules/temporal/{pattern.js → pattern/pattern.js} +20 -15
  152. package/dist/esm/modules/temporal/pattern/pattern.js.map +1 -0
  153. package/dist/esm/modules/temporal/pattern/tokens.d.ts +59 -0
  154. package/dist/esm/modules/temporal/pattern/tokens.d.ts.map +1 -0
  155. package/dist/esm/modules/temporal/pattern/tokens.js +191 -0
  156. package/dist/esm/modules/temporal/pattern/tokens.js.map +1 -0
  157. package/package.json +1 -1
  158. package/dist/cjs/modules/temporal/adapters/guards.d.ts +0 -4
  159. package/dist/cjs/modules/temporal/adapters/guards.d.ts.map +0 -1
  160. package/dist/cjs/modules/temporal/adapters/guards.js +0 -14
  161. package/dist/cjs/modules/temporal/adapters/guards.js.map +0 -1
  162. package/dist/cjs/modules/temporal/calendar.d.ts +0 -52
  163. package/dist/cjs/modules/temporal/calendar.d.ts.map +0 -1
  164. package/dist/cjs/modules/temporal/calendar.js +0 -151
  165. package/dist/cjs/modules/temporal/calendar.js.map +0 -1
  166. package/dist/cjs/modules/temporal/duration.d.ts.map +0 -1
  167. package/dist/cjs/modules/temporal/duration.js +0 -64
  168. package/dist/cjs/modules/temporal/duration.js.map +0 -1
  169. package/dist/cjs/modules/temporal/locale.d.ts.map +0 -1
  170. package/dist/cjs/modules/temporal/locale.js.map +0 -1
  171. package/dist/cjs/modules/temporal/pattern.d.ts.map +0 -1
  172. package/dist/cjs/modules/temporal/pattern.js.map +0 -1
  173. package/dist/cjs/modules/temporal/tokens.d.ts +0 -78
  174. package/dist/cjs/modules/temporal/tokens.d.ts.map +0 -1
  175. package/dist/cjs/modules/temporal/tokens.js +0 -145
  176. package/dist/cjs/modules/temporal/tokens.js.map +0 -1
  177. package/dist/esm/modules/temporal/adapters/guards.d.ts +0 -4
  178. package/dist/esm/modules/temporal/adapters/guards.d.ts.map +0 -1
  179. package/dist/esm/modules/temporal/adapters/guards.js +0 -10
  180. package/dist/esm/modules/temporal/adapters/guards.js.map +0 -1
  181. package/dist/esm/modules/temporal/calendar.d.ts +0 -52
  182. package/dist/esm/modules/temporal/calendar.d.ts.map +0 -1
  183. package/dist/esm/modules/temporal/calendar.js +0 -138
  184. package/dist/esm/modules/temporal/calendar.js.map +0 -1
  185. package/dist/esm/modules/temporal/duration.d.ts.map +0 -1
  186. package/dist/esm/modules/temporal/duration.js +0 -60
  187. package/dist/esm/modules/temporal/duration.js.map +0 -1
  188. package/dist/esm/modules/temporal/locale.d.ts.map +0 -1
  189. package/dist/esm/modules/temporal/locale.js.map +0 -1
  190. package/dist/esm/modules/temporal/pattern.d.ts.map +0 -1
  191. package/dist/esm/modules/temporal/pattern.js.map +0 -1
  192. package/dist/esm/modules/temporal/tokens.d.ts +0 -78
  193. package/dist/esm/modules/temporal/tokens.d.ts.map +0 -1
  194. package/dist/esm/modules/temporal/tokens.js +0 -133
  195. package/dist/esm/modules/temporal/tokens.js.map +0 -1
@@ -0,0 +1,295 @@
1
+ import { BaseHelper } from '../base';
2
+ import type { TTemporalDurationStyle, TTemporalInclusivity, TTemporalUnit } from './common/constants';
3
+ import type { ITemporalAdapter, ITemporalDurationParts, ITemporalLocaleNames, ITemporalParts, TTemporalFields, IZonedTemporalParts, TTemporalInput, ITemporalHelper } from './common/types';
4
+ export declare abstract class AbstractTemporalHelper extends BaseHelper implements ITemporalHelper {
5
+ /** Validated once per process: `Intl` answers the same for a zone name every time. */
6
+ protected static readonly knownTzs: Set<string>;
7
+ protected readonly adapter: ITemporalAdapter;
8
+ protected readonly tz: string;
9
+ protected readonly locale: string;
10
+ protected readonly names: Record<string, ITemporalLocaleNames>;
11
+ /**
12
+ * `locale` (default `en-US`) spells month and weekday names, AM/PM, relative time and durations,
13
+ * unless a call passes its own. `names` replaces `Intl`'s wording for a locale - month and weekday
14
+ * names, the AM/PM marker - keyed by the locale tag a call writes in.
15
+ */
16
+ constructor(opts?: {
17
+ adapter?: ITemporalAdapter;
18
+ tz?: string;
19
+ locale?: string;
20
+ names?: Record<string, ITemporalLocaleNames>;
21
+ scope?: string;
22
+ });
23
+ /**
24
+ * The zone a `Date`'s local getters use on this runtime - the browser's or the server's. The one
25
+ * place this helper reads the host zone, and only when a wall-clock bridge is not given one.
26
+ */
27
+ static getHostTz(): string;
28
+ /** The instant whose wall clock in `to` reads what `value`'s wall clock reads in `from`. */
29
+ protected moveWallClock(opts: {
30
+ value: TTemporalInput;
31
+ from: string;
32
+ to: string;
33
+ }): Date;
34
+ /** Every list the right length, so a bad table fails when the helper is built, not on a screen. */
35
+ protected static ensureNames(opts: {
36
+ names: Record<string, ITemporalLocaleNames>;
37
+ }): Record<string, ITemporalLocaleNames>;
38
+ /** The wording this helper holds for `locale`, if any. */
39
+ protected namesOf(opts: {
40
+ locale: string;
41
+ }): ITemporalLocaleNames | undefined;
42
+ /** The runtime's `Temporal` where it has one; `Intl`, which every runtime has, everywhere else. */
43
+ protected static defaultAdapter(): ITemporalAdapter;
44
+ protected static ensureLocale(opts: {
45
+ locale: string;
46
+ }): string;
47
+ /** A parse or input error the caller may treat as "not a date"; anything else is a bug and still throws. */
48
+ protected static isRefusal(error: unknown): boolean;
49
+ protected static ensureTz(opts: {
50
+ tz: string;
51
+ statusCode: number;
52
+ }): string;
53
+ protected static ensureUnit(opts: {
54
+ unit: string;
55
+ amount?: number;
56
+ }): void;
57
+ /** Every result passes here: an overflowing `add` is refused, never an Invalid Date. */
58
+ protected static ensureInstant(opts: {
59
+ epoch: number;
60
+ }): Date;
61
+ protected static ensureYear(opts: {
62
+ parts: ITemporalParts;
63
+ }): void;
64
+ protected resolveTz(opts: {
65
+ tz?: string;
66
+ }): string;
67
+ /** The adapter's one answer, rounded: an offset is whole milliseconds, a library's float may not be. */
68
+ protected offsetAt(opts: {
69
+ epoch: number;
70
+ tz: string;
71
+ }): number;
72
+ protected zonedParts(opts: {
73
+ epoch: number;
74
+ tz: string;
75
+ }): IZonedTemporalParts;
76
+ /**
77
+ * Every instant whose wall clock reads `parts` in the zone, earliest first: one as a rule, two
78
+ * when the clock goes back, none when it jumps forward. `forward` is where a skipped time lands -
79
+ * read with the offset from before the jump, so it moves past the gap.
80
+ */
81
+ protected instantsOf(opts: {
82
+ parts: ITemporalParts;
83
+ tz: string;
84
+ }): {
85
+ instants: Array<number>;
86
+ forward: number;
87
+ };
88
+ /** The instant wall-clock `parts` name: a skipped time moves forward, a repeated one takes the earlier. */
89
+ protected earliestOf(opts: {
90
+ parts: ITemporalParts;
91
+ tz: string;
92
+ }): number;
93
+ /**
94
+ * `[start, end)` of the unit holding `epoch`. A day or longer starts at its first instant. An hour
95
+ * or less repeats when the clock goes back, so it starts at the latest start not after `epoch`,
96
+ * and ends where the wall clock next shows either the following unit or this one's start again.
97
+ */
98
+ protected unitBounds(opts: {
99
+ epoch: number;
100
+ unit: TTemporalUnit;
101
+ tz: string;
102
+ }): {
103
+ start: number;
104
+ end: number;
105
+ };
106
+ getTz(): string;
107
+ getLocale(): string;
108
+ now(): Date;
109
+ /** The instant a value names. An ISO string without an offset is read as wall clock in the zone. */
110
+ toDate(opts: {
111
+ value: TTemporalInput;
112
+ tz?: string;
113
+ }): Date;
114
+ protected static notADate(opts: {
115
+ value: unknown;
116
+ }): import("../error").ApplicationError;
117
+ /** `toDate`, answering `null` where `toDate` refuses the value: null, undefined, bad text, NaN. */
118
+ tryToDate(opts: {
119
+ value: TTemporalInput | null | undefined;
120
+ tz?: string;
121
+ }): Date | null;
122
+ /** The wall clock the value shows in the zone, with its ISO weekday and UTC offset. */
123
+ parts(opts: {
124
+ value: TTemporalInput;
125
+ tz?: string;
126
+ }): IZonedTemporalParts;
127
+ /**
128
+ * Fractional months from `other` to `value` (dayjs and moment's month difference): anchored on the
129
+ * date with the later day of the month, whole months by `add`, the rest as a share of the month
130
+ * it falls in.
131
+ */
132
+ protected monthGap(opts: {
133
+ value: number;
134
+ other: number;
135
+ tz: string;
136
+ }): number;
137
+ /** `add` by months without the 1-9999 check: an anchor one month past the range is still a number. */
138
+ protected shiftMonthsFrom(opts: {
139
+ parts: IZonedTemporalParts;
140
+ months: number;
141
+ tz: string;
142
+ }): number;
143
+ abstract fromWallClock(opts: {
144
+ value: TTemporalInput;
145
+ sourceTz?: string;
146
+ tz?: string;
147
+ }): Date;
148
+ abstract toWallClock(opts: {
149
+ value: TTemporalInput;
150
+ targetTz?: string;
151
+ tz?: string;
152
+ }): Date;
153
+ abstract clone(opts: {
154
+ locale?: string;
155
+ tz?: string;
156
+ }): ITemporalHelper;
157
+ abstract parse(opts: {
158
+ value: string;
159
+ pattern?: string;
160
+ tz?: string;
161
+ }): Date;
162
+ abstract tryParse(opts: {
163
+ value: string;
164
+ pattern?: string;
165
+ tz?: string;
166
+ }): Date | null;
167
+ abstract isValid(opts: {
168
+ value: TTemporalInput | null | undefined;
169
+ pattern?: string;
170
+ tz?: string;
171
+ }): boolean;
172
+ abstract format(opts: {
173
+ value: TTemporalInput | null | undefined;
174
+ pattern?: string;
175
+ tz?: string;
176
+ locale?: string;
177
+ fallback?: string;
178
+ }): string;
179
+ abstract formatIntl(opts: {
180
+ value: TTemporalInput;
181
+ options?: Omit<Intl.DateTimeFormatOptions, 'timeZone'>;
182
+ tz?: string;
183
+ locale?: string;
184
+ }): string;
185
+ abstract add(opts: {
186
+ value: TTemporalInput;
187
+ amount: number;
188
+ unit: TTemporalUnit;
189
+ tz?: string;
190
+ }): Date;
191
+ abstract subtract(opts: {
192
+ value: TTemporalInput;
193
+ amount: number;
194
+ unit: TTemporalUnit;
195
+ tz?: string;
196
+ }): Date;
197
+ abstract startOf(opts: {
198
+ value: TTemporalInput;
199
+ unit: TTemporalUnit;
200
+ tz?: string;
201
+ }): Date;
202
+ abstract endOf(opts: {
203
+ value: TTemporalInput;
204
+ unit: TTemporalUnit;
205
+ tz?: string;
206
+ }): Date;
207
+ abstract isWeekday(opts: {
208
+ value: TTemporalInput;
209
+ tz?: string;
210
+ }): boolean;
211
+ abstract nextWeekday(opts: {
212
+ value: TTemporalInput;
213
+ tz?: string;
214
+ }): Date;
215
+ abstract previousWeekday(opts: {
216
+ value: TTemporalInput;
217
+ tz?: string;
218
+ }): Date;
219
+ abstract set(opts: {
220
+ value: TTemporalInput;
221
+ tz?: string;
222
+ } & TTemporalFields): Date;
223
+ abstract isBefore(opts: {
224
+ value: TTemporalInput;
225
+ other: TTemporalInput;
226
+ unit?: TTemporalUnit;
227
+ tz?: string;
228
+ }): boolean;
229
+ abstract isAfter(opts: {
230
+ value: TTemporalInput;
231
+ other: TTemporalInput;
232
+ unit?: TTemporalUnit;
233
+ tz?: string;
234
+ }): boolean;
235
+ abstract isSame(opts: {
236
+ value: TTemporalInput;
237
+ other: TTemporalInput;
238
+ unit?: TTemporalUnit;
239
+ tz?: string;
240
+ }): boolean;
241
+ abstract isSameOrBefore(opts: {
242
+ value: TTemporalInput;
243
+ other: TTemporalInput;
244
+ unit?: TTemporalUnit;
245
+ tz?: string;
246
+ }): boolean;
247
+ abstract isSameOrAfter(opts: {
248
+ value: TTemporalInput;
249
+ other: TTemporalInput;
250
+ unit?: TTemporalUnit;
251
+ tz?: string;
252
+ }): boolean;
253
+ abstract isBetween(opts: {
254
+ value: TTemporalInput;
255
+ from: TTemporalInput;
256
+ to: TTemporalInput;
257
+ unit?: TTemporalUnit;
258
+ inclusivity?: TTemporalInclusivity;
259
+ tz?: string;
260
+ }): boolean;
261
+ abstract diff(opts: {
262
+ value: TTemporalInput;
263
+ other: TTemporalInput;
264
+ unit: TTemporalUnit;
265
+ tz?: string;
266
+ }): number;
267
+ abstract compare(opts: {
268
+ value: TTemporalInput;
269
+ other: TTemporalInput;
270
+ unit?: TTemporalUnit;
271
+ tz?: string;
272
+ }): -1 | 0 | 1;
273
+ abstract relative(opts: {
274
+ value: TTemporalInput;
275
+ base?: TTemporalInput;
276
+ unit?: TTemporalUnit;
277
+ numeric?: Intl.RelativeTimeFormatNumeric;
278
+ style?: Intl.RelativeTimeFormatStyle;
279
+ tz?: string;
280
+ locale?: string;
281
+ }): string;
282
+ abstract durationParts(opts: {
283
+ milliseconds: number;
284
+ }): ITemporalDurationParts;
285
+ abstract formatDuration(opts: {
286
+ milliseconds: number;
287
+ style?: TTemporalDurationStyle;
288
+ /** A clock face instead of words: `HH:mm:ss`, `mm:ss`, `D[d] HH:mm`. The largest token carries the rest. */
289
+ pattern?: string;
290
+ /** Only the largest units that are not zero: `1` writes `2 giờ` for 2 hours 5 minutes. */
291
+ maxUnits?: number;
292
+ locale?: string;
293
+ }): string;
294
+ }
295
+ //# sourceMappingURL=abstract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../../../src/modules/temporal/abstract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAU5C,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,gBAAgB,CAAC;AA0BxB,8BAAsB,sBAAuB,SAAQ,UAAW,YAAW,eAAe;IACxF,sFAAsF;IACtF,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAqB;IAEvD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,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require("../../common/constants/http");
5
+ const base_1 = require("../base");
6
+ const error_1 = require("../error");
7
+ const intl_1 = require("./adapters/intl");
8
+ const native_1 = require("./adapters/native");
9
+ const calendar_1 = require("./calendar");
10
+ const constants_1 = require("./common/constants");
11
+ const locale_1 = require("./locale");
12
+ const DAY_MILLISECONDS = 86_400_000;
13
+ /** 0001-01-01T00:00:00.000Z and 9999-12-31T23:59:59.999Z. */
14
+ const MIN_INSTANT = -62_135_596_800_000;
15
+ const MAX_INSTANT = 253_402_300_799_999;
16
+ const MAX_KNOWN_TIME_ZONES = 256;
17
+ /** How many entries each `names` list must hold. */
18
+ const NAME_LENGTHS = {
19
+ months: 12,
20
+ monthsShort: 12,
21
+ weekdays: 7,
22
+ weekdaysShort: 7,
23
+ weekdaysMin: 7,
24
+ meridiem: 2,
25
+ };
26
+ const OUT_OF_RANGE = `outside the years ${calendar_1.TemporalCalendar.MIN_YEAR}-${calendar_1.TemporalCalendar.MAX_YEAR}`; /**
27
+ * The machinery every temporal helper shares: the adapter, the zone and locale it holds, reading a
28
+ * zone's offset, turning wall clocks into instants across daylight-saving gaps and repeats, and the
29
+ * input checks. A helper extends this and supplies the operations in `ITemporalHelper`.
30
+ */
31
+ class AbstractTemporalHelper extends base_1.BaseHelper {
32
+ /** Validated once per process: `Intl` answers the same for a zone name every time. */
33
+ static { this.knownTzs = new Set(); }
34
+ /**
35
+ * `locale` (default `en-US`) spells month and weekday names, AM/PM, relative time and durations,
36
+ * unless a call passes its own. `names` replaces `Intl`'s wording for a locale - month and weekday
37
+ * names, the AM/PM marker - keyed by the locale tag a call writes in.
38
+ */
39
+ constructor(opts) {
40
+ super({ scope: opts?.scope ?? new.target.name });
41
+ this.tz = AbstractTemporalHelper.ensureTz({
42
+ tz: opts?.tz ?? constants_1.DEFAULT_TEMPORAL_TZ,
43
+ statusCode: http_1.HTTP.ResultCodes.RS_5.InternalServerError,
44
+ });
45
+ this.locale = AbstractTemporalHelper.ensureLocale({
46
+ locale: opts?.locale ?? constants_1.DEFAULT_TEMPORAL_LOCALE,
47
+ });
48
+ this.adapter = opts?.adapter ?? AbstractTemporalHelper.defaultAdapter();
49
+ this.names = AbstractTemporalHelper.ensureNames({ names: opts?.names ?? {} });
50
+ }
51
+ /**
52
+ * The zone a `Date`'s local getters use on this runtime - the browser's or the server's. The one
53
+ * place this helper reads the host zone, and only when a wall-clock bridge is not given one.
54
+ */
55
+ static getHostTz() {
56
+ return new Intl.DateTimeFormat().resolvedOptions().timeZone;
57
+ }
58
+ /** The instant whose wall clock in `to` reads what `value`'s wall clock reads in `from`. */
59
+ moveWallClock(opts) {
60
+ const from = this.resolveTz({ tz: opts.from });
61
+ const to = this.resolveTz({ tz: opts.to });
62
+ const date = this.toDate({ value: opts.value, tz: from });
63
+ const wall = calendar_1.TemporalCalendar.wallClockOf({
64
+ parts: this.zonedParts({ epoch: date.getTime(), tz: from }),
65
+ });
66
+ return AbstractTemporalHelper.ensureInstant({
67
+ epoch: this.earliestOf({ parts: wall, tz: to }),
68
+ });
69
+ }
70
+ /** Every list the right length, so a bad table fails when the helper is built, not on a screen. */
71
+ static ensureNames(opts) {
72
+ for (const [locale, names] of Object.entries(opts.names)) {
73
+ AbstractTemporalHelper.ensureLocale({ locale });
74
+ for (const [key, length] of Object.entries(NAME_LENGTHS)) {
75
+ const list = Reflect.get(names, key);
76
+ if (list === undefined) {
77
+ continue;
78
+ }
79
+ if (!Array.isArray(list) ||
80
+ list.length !== length ||
81
+ !list.every(entry => typeof entry === 'string')) {
82
+ throw (0, error_1.getError)({
83
+ statusCode: http_1.HTTP.ResultCodes.RS_5.InternalServerError,
84
+ message: `[TemporalHelper] names['${locale}'].${key} must hold ${length} strings`,
85
+ });
86
+ }
87
+ }
88
+ }
89
+ return opts.names;
90
+ }
91
+ /** The wording this helper holds for `locale`, if any. */
92
+ namesOf(opts) {
93
+ return Object.hasOwn(this.names, opts.locale) ? this.names[opts.locale] : undefined;
94
+ }
95
+ /** The runtime's `Temporal` where it has one; `Intl`, which every runtime has, everywhere else. */
96
+ static defaultAdapter() {
97
+ return native_1.NativeTemporalAdapter.isTemporalNamespace(Reflect.get(globalThis, 'Temporal'))
98
+ ? new native_1.NativeTemporalAdapter()
99
+ : new intl_1.IntlTemporalAdapter();
100
+ }
101
+ static ensureLocale(opts) {
102
+ locale_1.TemporalLocale.of({ locale: opts.locale });
103
+ return opts.locale;
104
+ }
105
+ /** A parse or input error the caller may treat as "not a date"; anything else is a bug and still throws. */
106
+ static isRefusal(error) {
107
+ return (0, error_1.isApplicationError)(error) && error.statusCode === http_1.HTTP.ResultCodes.RS_4.BadRequest;
108
+ }
109
+ static ensureTz(opts) {
110
+ const { tz, statusCode } = opts;
111
+ if (AbstractTemporalHelper.knownTzs.has(tz)) {
112
+ return tz;
113
+ }
114
+ try {
115
+ new Intl.DateTimeFormat('en-US', { timeZone: tz });
116
+ }
117
+ catch (error) {
118
+ throw (0, error_1.getError)({
119
+ statusCode,
120
+ message: `[TemporalHelper] unknown time zone '${tz}' | ${error instanceof Error ? error.message : String(error)}`,
121
+ });
122
+ }
123
+ if (AbstractTemporalHelper.knownTzs.size < MAX_KNOWN_TIME_ZONES) {
124
+ AbstractTemporalHelper.knownTzs.add(tz);
125
+ }
126
+ return tz;
127
+ }
128
+ static ensureUnit(opts) {
129
+ const { unit, amount } = opts;
130
+ if (!constants_1.TemporalUnits.isValid(unit)) {
131
+ throw (0, error_1.getError)({
132
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
133
+ message: `[TemporalHelper] unknown unit '${unit}' | Supported: ${[...constants_1.TemporalUnits.SCHEME_SET].join(', ')}`,
134
+ });
135
+ }
136
+ if (amount === undefined) {
137
+ return;
138
+ }
139
+ // Elapsed time takes a fraction (1.5 hours is 90 minutes); a calendar unit has no half.
140
+ const isElapsed = calendar_1.TemporalCalendar.EXACT_UNIT_MILLISECONDS[unit] !== undefined;
141
+ if (isElapsed ? !Number.isFinite(amount) : !Number.isInteger(amount)) {
142
+ throw (0, error_1.getError)({
143
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
144
+ message: isElapsed
145
+ ? `[TemporalHelper] amount must be a finite number - received ${amount}`
146
+ : `[TemporalHelper] amount must be an integer for '${unit}' - received ${amount}`,
147
+ });
148
+ }
149
+ }
150
+ /** Every result passes here: an overflowing `add` is refused, never an Invalid Date. */
151
+ static ensureInstant(opts) {
152
+ const { epoch } = opts;
153
+ if (!(epoch >= MIN_INSTANT && epoch <= MAX_INSTANT)) {
154
+ throw (0, error_1.getError)({
155
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
156
+ message: `[TemporalHelper] ${Number.isNaN(epoch) ? 'invalid date' : OUT_OF_RANGE} - received ${epoch}`,
157
+ });
158
+ }
159
+ return new Date(epoch);
160
+ }
161
+ static ensureYear(opts) {
162
+ if (!calendar_1.TemporalCalendar.isSupportedYear({ year: opts.parts.year })) {
163
+ throw (0, error_1.getError)({
164
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
165
+ message: `[TemporalHelper] year ${opts.parts.year} is ${OUT_OF_RANGE}`,
166
+ });
167
+ }
168
+ }
169
+ resolveTz(opts) {
170
+ return opts.tz === undefined
171
+ ? this.tz
172
+ : AbstractTemporalHelper.ensureTz({
173
+ tz: opts.tz,
174
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
175
+ });
176
+ }
177
+ /** The adapter's one answer, rounded: an offset is whole milliseconds, a library's float may not be. */
178
+ offsetAt(opts) {
179
+ return Math.round(this.adapter.getOffsetMilliseconds({ value: new Date(opts.epoch), tz: opts.tz }));
180
+ }
181
+ zonedParts(opts) {
182
+ const parts = calendar_1.TemporalCalendar.wallClockAt({
183
+ epoch: opts.epoch,
184
+ offsetMilliseconds: this.offsetAt(opts),
185
+ });
186
+ AbstractTemporalHelper.ensureYear({ parts });
187
+ return parts;
188
+ }
189
+ /**
190
+ * Every instant whose wall clock reads `parts` in the zone, earliest first: one as a rule, two
191
+ * when the clock goes back, none when it jumps forward. `forward` is where a skipped time lands -
192
+ * read with the offset from before the jump, so it moves past the gap.
193
+ */
194
+ instantsOf(opts) {
195
+ const { parts, tz } = opts;
196
+ const local = calendar_1.TemporalCalendar.epochAtOffset({ parts, offsetMilliseconds: 0 });
197
+ const before = this.offsetAt({ epoch: local - DAY_MILLISECONDS, tz });
198
+ const after = this.offsetAt({ epoch: local + DAY_MILLISECONDS, tz });
199
+ const offsets = before === after ? [before] : [before, after];
200
+ const instants = [];
201
+ for (const offset of offsets) {
202
+ const candidate = local - offset;
203
+ if (this.offsetAt({ epoch: candidate, tz }) === offset) {
204
+ instants.push(candidate);
205
+ }
206
+ }
207
+ instants.sort((left, right) => left - right);
208
+ return { instants, forward: local - before };
209
+ }
210
+ /** The instant wall-clock `parts` name: a skipped time moves forward, a repeated one takes the earlier. */
211
+ earliestOf(opts) {
212
+ const { instants, forward } = this.instantsOf(opts);
213
+ return instants[0] ?? forward;
214
+ }
215
+ /**
216
+ * `[start, end)` of the unit holding `epoch`. A day or longer starts at its first instant. An hour
217
+ * or less repeats when the clock goes back, so it starts at the latest start not after `epoch`,
218
+ * and ends where the wall clock next shows either the following unit or this one's start again.
219
+ */
220
+ unitBounds(opts) {
221
+ const { epoch, unit, tz } = opts;
222
+ const startParts = calendar_1.TemporalCalendar.truncate({
223
+ parts: this.zonedParts({ epoch, tz }),
224
+ unit,
225
+ });
226
+ const nextParts = calendar_1.TemporalCalendar.shift({ parts: startParts, amount: 1, unit });
227
+ AbstractTemporalHelper.ensureYear({ parts: nextParts });
228
+ const starts = this.instantsOf({ parts: startParts, tz });
229
+ if (calendar_1.TemporalCalendar.EXACT_UNIT_MILLISECONDS[unit] === undefined) {
230
+ const start = starts.instants[0] ?? starts.forward;
231
+ return { start, end: this.earliestOf({ parts: nextParts, tz }) };
232
+ }
233
+ const started = starts.instants.filter(instant => instant <= epoch);
234
+ const start = started.at(-1) ?? starts.instants[0] ?? starts.forward;
235
+ const nexts = this.instantsOf({ parts: nextParts, tz });
236
+ const following = nexts.instants.find(instant => instant > start) ?? nexts.forward;
237
+ const repeated = starts.instants.find(instant => instant > start);
238
+ return { start, end: repeated === undefined ? following : Math.min(repeated, following) };
239
+ }
240
+ getTz() {
241
+ return this.tz;
242
+ }
243
+ getLocale() {
244
+ return this.locale;
245
+ }
246
+ now() {
247
+ return new Date();
248
+ }
249
+ /** The instant a value names. An ISO string without an offset is read as wall clock in the zone. */
250
+ toDate(opts) {
251
+ const { value } = opts;
252
+ if (typeof value === 'string') {
253
+ return this.parse({ value, tz: opts.tz });
254
+ }
255
+ if (value instanceof Date) {
256
+ return AbstractTemporalHelper.ensureInstant({ epoch: value.getTime() });
257
+ }
258
+ if (typeof value === 'number') {
259
+ return AbstractTemporalHelper.ensureInstant({ epoch: value });
260
+ }
261
+ // `null` above all: read as a number it would be 1970, a date nobody meant.
262
+ throw AbstractTemporalHelper.notADate({ value });
263
+ }
264
+ static notADate(opts) {
265
+ const { value } = opts;
266
+ return (0, error_1.getError)({
267
+ statusCode: http_1.HTTP.ResultCodes.RS_4.BadRequest,
268
+ message: `[TemporalHelper] not a date - received ${value === null ? 'null' : typeof value}`,
269
+ });
270
+ }
271
+ /** `toDate`, answering `null` where `toDate` refuses the value: null, undefined, bad text, NaN. */
272
+ tryToDate(opts) {
273
+ const { value } = opts;
274
+ // Outside the try: a bad zone is the caller's bug, not an unreadable value.
275
+ const tz = this.resolveTz({ tz: opts.tz });
276
+ if (value === null || value === undefined) {
277
+ return null;
278
+ }
279
+ try {
280
+ return this.toDate({ value, tz });
281
+ }
282
+ catch (error) {
283
+ if (AbstractTemporalHelper.isRefusal(error)) {
284
+ return null;
285
+ }
286
+ throw error;
287
+ }
288
+ }
289
+ /** The wall clock the value shows in the zone, with its ISO weekday and UTC offset. */
290
+ parts(opts) {
291
+ const tz = this.resolveTz({ tz: opts.tz });
292
+ const date = this.toDate({ value: opts.value, tz });
293
+ return this.zonedParts({ epoch: date.getTime(), tz });
294
+ }
295
+ /**
296
+ * Fractional months from `other` to `value` (dayjs and moment's month difference): anchored on the
297
+ * date with the later day of the month, whole months by `add`, the rest as a share of the month
298
+ * it falls in.
299
+ */
300
+ monthGap(opts) {
301
+ const { value, other, tz } = opts;
302
+ const valueParts = this.zonedParts({ epoch: value, tz });
303
+ const otherParts = this.zonedParts({ epoch: other, tz });
304
+ if (valueParts.day < otherParts.day) {
305
+ return -this.monthGap({ value: other, other: value, tz });
306
+ }
307
+ const whole = (otherParts.year - valueParts.year) * 12 + (otherParts.month - valueParts.month);
308
+ const anchor = this.shiftMonthsFrom({ parts: valueParts, months: whole, tz });
309
+ const isBelow = other - anchor < 0;
310
+ const nextAnchor = this.shiftMonthsFrom({
311
+ parts: valueParts,
312
+ months: whole + (isBelow ? -1 : 1),
313
+ tz,
314
+ });
315
+ const span = isBelow ? anchor - nextAnchor : nextAnchor - anchor;
316
+ return -(whole + (other - anchor) / span) || 0;
317
+ }
318
+ /** `add` by months without the 1-9999 check: an anchor one month past the range is still a number. */
319
+ shiftMonthsFrom(opts) {
320
+ const { parts, months, tz } = opts;
321
+ const shifted = calendar_1.TemporalCalendar.shift({
322
+ parts: calendar_1.TemporalCalendar.wallClockOf({ parts }),
323
+ amount: months,
324
+ unit: constants_1.TemporalUnits.MONTH,
325
+ });
326
+ return this.earliestOf({ parts: shifted, tz });
327
+ }
328
+ }
329
+ exports.AbstractTemporalHelper = AbstractTemporalHelper;
330
+ //# sourceMappingURL=abstract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../../../src/modules/temporal/abstract.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAC/C,yCAA4C;AAC5C,2CAA+D;AAC/D,0CAAsD;AACtD,8CAA0D;AAC1D,yCAA8C;AAC9C,kDAI4B;AAgB5B,qCAA0C;AAE1C,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAEpC,6DAA6D;AAC7D,MAAM,WAAW,GAAG,CAAC,kBAAkB,CAAC;AACxC,MAAM,WAAW,GAAG,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AAE,EAAE,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,OAAO,GAAG,2BAAgB,CAAC,KAAK,CAAC;YACrC,KAAK,EAAE,2BAAgB,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAa,CAAC,KAAK;SAC1B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;;AA1WH,wDAofC"}
@@ -15,7 +15,7 @@ export declare class DayjsTemporalAdapter implements ITemporalAdapter {
15
15
  });
16
16
  getOffsetMilliseconds(opts: {
17
17
  value: Date;
18
- timeZone: string;
18
+ tz: string;
19
19
  }): number;
20
20
  }
21
21
  //# sourceMappingURL=dayjs.d.ts.map