@bessemer/cornerstone 0.5.114 → 0.5.115

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 (247) hide show
  1. package/dist/array.d.ts.map +1 -1
  2. package/dist/array.js +28 -28
  3. package/dist/array.js.map +1 -1
  4. package/dist/aspect-ratio.d.ts +3 -3
  5. package/dist/aspect-ratio.d.ts.map +1 -1
  6. package/dist/aspect-ratio.js +13 -12
  7. package/dist/aspect-ratio.js.map +1 -1
  8. package/dist/assertion.d.ts.map +1 -1
  9. package/dist/assertion.js +5 -5
  10. package/dist/assertion.js.map +1 -1
  11. package/dist/async-value.js +2 -2
  12. package/dist/async-value.js.map +1 -1
  13. package/dist/async.d.ts.map +1 -1
  14. package/dist/async.js +2 -2
  15. package/dist/async.js.map +1 -1
  16. package/dist/cache.d.ts.map +1 -1
  17. package/dist/cache.js +11 -12
  18. package/dist/cache.js.map +1 -1
  19. package/dist/combinable.js +5 -5
  20. package/dist/combinable.js.map +1 -1
  21. package/dist/comparator.js +8 -8
  22. package/dist/comparator.js.map +1 -1
  23. package/dist/data-size.d.ts +2 -1
  24. package/dist/data-size.d.ts.map +1 -1
  25. package/dist/data-size.js +3 -3
  26. package/dist/data-size.js.map +1 -1
  27. package/dist/either.js +5 -5
  28. package/dist/either.js.map +1 -1
  29. package/dist/equalitor.d.ts.map +1 -1
  30. package/dist/equalitor.js +2 -2
  31. package/dist/equalitor.js.map +1 -1
  32. package/dist/error/error-cause.d.ts.map +1 -1
  33. package/dist/error/error-cause.js +14 -14
  34. package/dist/error/error-cause.js.map +1 -1
  35. package/dist/error/error-code.js +2 -2
  36. package/dist/error/error-code.js.map +1 -1
  37. package/dist/error/error-event.d.ts +3 -2
  38. package/dist/error/error-event.d.ts.map +1 -1
  39. package/dist/error/error-event.js +28 -28
  40. package/dist/error/error-event.js.map +1 -1
  41. package/dist/error/error-type.d.ts +2 -1
  42. package/dist/error/error-type.d.ts.map +1 -1
  43. package/dist/error/error-type.js +2 -2
  44. package/dist/error/error-type.js.map +1 -1
  45. package/dist/error/error.js +5 -5
  46. package/dist/error/error.js.map +1 -1
  47. package/dist/expression/array-expression.js +3 -3
  48. package/dist/expression/array-expression.js.map +1 -1
  49. package/dist/expression/core-expression.d.ts.map +1 -1
  50. package/dist/expression/core-expression.js +19 -19
  51. package/dist/expression/core-expression.js.map +1 -1
  52. package/dist/expression/expression-evaluator.js +2 -2
  53. package/dist/expression/expression-evaluator.js.map +1 -1
  54. package/dist/expression/expression-mapper.js +4 -4
  55. package/dist/expression/expression-mapper.js.map +1 -1
  56. package/dist/expression/internal.js +3 -3
  57. package/dist/expression/internal.js.map +1 -1
  58. package/dist/expression/numeric-expression.js +13 -13
  59. package/dist/expression/numeric-expression.js.map +1 -1
  60. package/dist/expression/string-expression.js +4 -4
  61. package/dist/expression/string-expression.js.map +1 -1
  62. package/dist/glob.d.ts +3 -3
  63. package/dist/glob.d.ts.map +1 -1
  64. package/dist/glob.js +11 -12
  65. package/dist/glob.js.map +1 -1
  66. package/dist/global-variable.d.ts.map +1 -1
  67. package/dist/global-variable.js +5 -5
  68. package/dist/global-variable.js.map +1 -1
  69. package/dist/hex-code.d.ts +3 -3
  70. package/dist/hex-code.d.ts.map +1 -1
  71. package/dist/hex-code.js +11 -10
  72. package/dist/hex-code.js.map +1 -1
  73. package/dist/index.d.ts +10 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +4 -0
  76. package/dist/index.js.map +1 -1
  77. package/dist/intl/country-code.d.ts +3 -3
  78. package/dist/intl/country-code.d.ts.map +1 -1
  79. package/dist/intl/country-code.js +9 -10
  80. package/dist/intl/country-code.js.map +1 -1
  81. package/dist/intl/country-subdivision-code.d.ts +3 -3
  82. package/dist/intl/country-subdivision-code.d.ts.map +1 -1
  83. package/dist/intl/country-subdivision-code.js +13 -11
  84. package/dist/intl/country-subdivision-code.js.map +1 -1
  85. package/dist/intl/currency-code.d.ts +3 -3
  86. package/dist/intl/currency-code.d.ts.map +1 -1
  87. package/dist/intl/currency-code.js +9 -10
  88. package/dist/intl/currency-code.js.map +1 -1
  89. package/dist/intl/language-code.d.ts +3 -3
  90. package/dist/intl/language-code.d.ts.map +1 -1
  91. package/dist/intl/language-code.js +9 -10
  92. package/dist/intl/language-code.js.map +1 -1
  93. package/dist/intl/locale.d.ts +3 -3
  94. package/dist/intl/locale.d.ts.map +1 -1
  95. package/dist/intl/locale.js +18 -19
  96. package/dist/intl/locale.js.map +1 -1
  97. package/dist/json.d.ts.map +1 -1
  98. package/dist/json.js +2 -2
  99. package/dist/json.js.map +1 -1
  100. package/dist/logger.d.ts.map +1 -1
  101. package/dist/logger.js +12 -12
  102. package/dist/logger.js.map +1 -1
  103. package/dist/map.js +8 -8
  104. package/dist/map.js.map +1 -1
  105. package/dist/mime-type.d.ts +3 -3
  106. package/dist/mime-type.d.ts.map +1 -1
  107. package/dist/mime-type.js +9 -10
  108. package/dist/mime-type.js.map +1 -1
  109. package/dist/misc.js +4 -4
  110. package/dist/misc.js.map +1 -1
  111. package/dist/monetary-amount.d.ts +3 -2
  112. package/dist/monetary-amount.d.ts.map +1 -1
  113. package/dist/monetary-amount.js +16 -16
  114. package/dist/monetary-amount.js.map +1 -1
  115. package/dist/net/content-type.d.ts +2 -1
  116. package/dist/net/content-type.d.ts.map +1 -1
  117. package/dist/net/content-type.js +2 -2
  118. package/dist/net/content-type.js.map +1 -1
  119. package/dist/net/domain-name.d.ts +3 -3
  120. package/dist/net/domain-name.d.ts.map +1 -1
  121. package/dist/net/domain-name.js +10 -11
  122. package/dist/net/domain-name.js.map +1 -1
  123. package/dist/net/http-method.d.ts.map +1 -1
  124. package/dist/net/http-method.js +9 -9
  125. package/dist/net/http-method.js.map +1 -1
  126. package/dist/net/ipv4-address.d.ts +3 -3
  127. package/dist/net/ipv4-address.d.ts.map +1 -1
  128. package/dist/net/ipv4-address.js +10 -11
  129. package/dist/net/ipv4-address.js.map +1 -1
  130. package/dist/net/ipv6-address.d.ts +3 -3
  131. package/dist/net/ipv6-address.d.ts.map +1 -1
  132. package/dist/net/ipv6-address.js +10 -11
  133. package/dist/net/ipv6-address.js.map +1 -1
  134. package/dist/net/uri-host-name.d.ts +3 -3
  135. package/dist/net/uri-host-name.d.ts.map +1 -1
  136. package/dist/net/uri-host-name.js +15 -16
  137. package/dist/net/uri-host-name.js.map +1 -1
  138. package/dist/net/uri.d.ts +1 -2
  139. package/dist/net/uri.d.ts.map +1 -1
  140. package/dist/net/uri.js +5 -3
  141. package/dist/net/uri.js.map +1 -1
  142. package/dist/net/url.d.ts.map +1 -1
  143. package/dist/net/url.js +6 -7
  144. package/dist/net/url.js.map +1 -1
  145. package/dist/object/object-path.d.ts.map +1 -1
  146. package/dist/object/object-path.js +23 -28
  147. package/dist/object/object-path.js.map +1 -1
  148. package/dist/object/type-path.js +19 -19
  149. package/dist/object/type-path.js.map +1 -1
  150. package/dist/patch.js +4 -4
  151. package/dist/patch.js.map +1 -1
  152. package/dist/promise.js +2 -2
  153. package/dist/promise.js.map +1 -1
  154. package/dist/property.d.ts.map +1 -1
  155. package/dist/property.js +7 -7
  156. package/dist/property.js.map +1 -1
  157. package/dist/proxy.js +2 -2
  158. package/dist/proxy.js.map +1 -1
  159. package/dist/range.js +2 -2
  160. package/dist/range.js.map +1 -1
  161. package/dist/reference.d.ts +2 -1
  162. package/dist/reference.d.ts.map +1 -1
  163. package/dist/reference.js +13 -13
  164. package/dist/reference.js.map +1 -1
  165. package/dist/resource-key.js +2 -2
  166. package/dist/resource-key.js.map +1 -1
  167. package/dist/result.js +5 -5
  168. package/dist/result.js.map +1 -1
  169. package/dist/retry.d.ts.map +1 -1
  170. package/dist/retry.js +12 -12
  171. package/dist/retry.js.map +1 -1
  172. package/dist/rich-text.js +2 -2
  173. package/dist/rich-text.js.map +1 -1
  174. package/dist/signature.d.ts.map +1 -1
  175. package/dist/signature.js +9 -9
  176. package/dist/signature.js.map +1 -1
  177. package/dist/sql/sql-expression-parser.js +2 -2
  178. package/dist/sql/sql-expression-parser.js.map +1 -1
  179. package/dist/store.d.ts.map +1 -1
  180. package/dist/store.js +9 -9
  181. package/dist/store.js.map +1 -1
  182. package/dist/string.js +4 -4
  183. package/dist/string.js.map +1 -1
  184. package/dist/tag.d.ts.map +1 -1
  185. package/dist/tag.js +10 -10
  186. package/dist/tag.js.map +1 -1
  187. package/dist/temporal/clock.d.ts +13 -13
  188. package/dist/temporal/clock.d.ts.map +1 -1
  189. package/dist/temporal/clock.js +10 -10
  190. package/dist/temporal/clock.js.map +1 -1
  191. package/dist/temporal/duration.d.ts +15 -9
  192. package/dist/temporal/duration.d.ts.map +1 -1
  193. package/dist/temporal/duration.js +30 -31
  194. package/dist/temporal/duration.js.map +1 -1
  195. package/dist/temporal/instant.d.ts +18 -15
  196. package/dist/temporal/instant.d.ts.map +1 -1
  197. package/dist/temporal/instant.js +42 -43
  198. package/dist/temporal/instant.js.map +1 -1
  199. package/dist/temporal/plain-date-time.d.ts +16 -13
  200. package/dist/temporal/plain-date-time.d.ts.map +1 -1
  201. package/dist/temporal/plain-date-time.js +36 -38
  202. package/dist/temporal/plain-date-time.js.map +1 -1
  203. package/dist/temporal/plain-date.d.ts +16 -13
  204. package/dist/temporal/plain-date.d.ts.map +1 -1
  205. package/dist/temporal/plain-date.js +35 -37
  206. package/dist/temporal/plain-date.js.map +1 -1
  207. package/dist/temporal/plain-month-day.d.ts +37 -0
  208. package/dist/temporal/plain-month-day.d.ts.map +1 -0
  209. package/dist/temporal/plain-month-day.js +84 -0
  210. package/dist/temporal/plain-month-day.js.map +1 -0
  211. package/dist/temporal/plain-time.d.ts +19 -17
  212. package/dist/temporal/plain-time.d.ts.map +1 -1
  213. package/dist/temporal/plain-time.js +43 -42
  214. package/dist/temporal/plain-time.js.map +1 -1
  215. package/dist/temporal/plain-year-month.d.ts +57 -0
  216. package/dist/temporal/plain-year-month.d.ts.map +1 -0
  217. package/dist/temporal/plain-year-month.js +109 -0
  218. package/dist/temporal/plain-year-month.js.map +1 -0
  219. package/dist/temporal/time-zone-id.d.ts +5 -4
  220. package/dist/temporal/time-zone-id.d.ts.map +1 -1
  221. package/dist/temporal/time-zone-id.js +11 -11
  222. package/dist/temporal/time-zone-id.js.map +1 -1
  223. package/dist/temporal/time-zone-offset.d.ts +12 -11
  224. package/dist/temporal/time-zone-offset.d.ts.map +1 -1
  225. package/dist/temporal/time-zone-offset.js +42 -50
  226. package/dist/temporal/time-zone-offset.js.map +1 -1
  227. package/dist/temporal/zoned-date-time.d.ts +16 -13
  228. package/dist/temporal/zoned-date-time.d.ts.map +1 -1
  229. package/dist/temporal/zoned-date-time.js +35 -36
  230. package/dist/temporal/zoned-date-time.js.map +1 -1
  231. package/dist/uuid/ulid.d.ts +3 -3
  232. package/dist/uuid/ulid.d.ts.map +1 -1
  233. package/dist/uuid/ulid.js +9 -10
  234. package/dist/uuid/ulid.js.map +1 -1
  235. package/dist/uuid/uuid-v4.d.ts +3 -3
  236. package/dist/uuid/uuid-v4.d.ts.map +1 -1
  237. package/dist/uuid/uuid-v4.js +13 -14
  238. package/dist/uuid/uuid-v4.js.map +1 -1
  239. package/dist/uuid/uuid-v7.d.ts +1 -2
  240. package/dist/uuid/uuid-v7.d.ts.map +1 -1
  241. package/dist/uuid/uuid-v7.js +1 -2
  242. package/dist/uuid/uuid-v7.js.map +1 -1
  243. package/dist/zod-util.d.ts +4 -21
  244. package/dist/zod-util.d.ts.map +1 -1
  245. package/dist/zod-util.js +21 -11
  246. package/dist/zod-util.js.map +1 -1
  247. package/package.json +2 -2
@@ -1,95 +1,94 @@
1
1
  // src/temporal/instant.ts
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
- import { createNamespace } from "@bessemer/cornerstone/resource-key";
4
- import { fromComparator } from "@bessemer/cornerstone/equalitor";
5
- import { failure, success } from "@bessemer/cornerstone/result";
6
- import { invalidValue, unpackResult } from "@bessemer/cornerstone/error/error-event";
7
- import { isError } from "@bessemer/cornerstone/error/error";
8
- import { structuredTransform } from "@bessemer/cornerstone/zod-util";
3
+ import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
4
+ import * as Equalitors from "@bessemer/cornerstone/equalitor";
5
+ import * as Results from "@bessemer/cornerstone/result";
6
+ import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
7
+ import * as Errors from "@bessemer/cornerstone/error/error";
8
+ import * as ZodUtil from "@bessemer/cornerstone/zod-util";
9
9
  import Zod from "zod";
10
- import { Default as DefaultClock } from "@bessemer/cornerstone/temporal/clock";
11
- import { from as fromDuration } from "@bessemer/cornerstone/temporal/duration";
12
- import { _isInstant, instantToLiteral } from "@bessemer/cornerstone/temporal/chrono";
13
- import { isString } from "@bessemer/cornerstone/string";
14
- import { isNil } from "@bessemer/cornerstone/object";
15
- import { format as formatPlainDateTime, fromInstant } from "@bessemer/cornerstone/temporal/plain-date-time";
16
- import { Results } from "@bessemer/cornerstone";
17
- var Namespace = createNamespace("instant");
18
- function from(value) {
19
- if (isNil(value)) {
10
+ import * as Clocks from "@bessemer/cornerstone/temporal/clock";
11
+ import * as Durations from "@bessemer/cornerstone/temporal/duration";
12
+ import * as Chrono from "@bessemer/cornerstone/temporal/chrono";
13
+ import * as Strings from "@bessemer/cornerstone/string";
14
+ import * as Objects from "@bessemer/cornerstone/object";
15
+ import * as PlainDateTimes from "@bessemer/cornerstone/temporal/plain-date-time";
16
+ var Namespace = ResourceKeys.createNamespace("instant");
17
+ function from2(value) {
18
+ if (Objects.isNil(value)) {
20
19
  return value;
21
20
  }
22
21
  if (value instanceof Temporal.Instant) {
23
22
  return value;
24
23
  }
25
- if (isString(value)) {
26
- return unpackResult(parseString(value));
24
+ if (Strings.isString(value)) {
25
+ return ErrorEvents.unpackResult(parseString(value));
27
26
  }
28
27
  return Temporal.Instant.fromEpochMilliseconds(value.getTime());
29
28
  }
30
29
  var CompareBy = (first, second) => Temporal.Instant.compare(first, second);
31
- var EqualBy = fromComparator(CompareBy);
30
+ var EqualBy = Equalitors.fromComparator(CompareBy);
32
31
  var parseString = (value) => {
33
32
  try {
34
- return success(Temporal.Instant.from(value));
33
+ return Results.success(Temporal.Instant.from(value));
35
34
  } catch (e) {
36
- if (!isError(e)) {
35
+ if (!Errors.isError(e)) {
37
36
  throw e;
38
37
  }
39
- return failure(invalidValue(value, { namespace: Namespace, message: e.message }));
38
+ return Results.failure(ErrorEvents.invalidValue(value, { namespace: Namespace, message: e.message }));
40
39
  }
41
40
  };
42
41
  function toLiteral(value) {
43
- if (isNil(value)) {
42
+ if (Objects.isNil(value)) {
44
43
  return value;
45
44
  }
46
- return instantToLiteral(from(value));
45
+ return Chrono.instantToLiteral(from2(value));
47
46
  }
48
47
  function toDate(value) {
49
- if (isNil(value)) {
48
+ if (Objects.isNil(value)) {
50
49
  return value;
51
50
  }
52
- return new Date(from(value).epochMilliseconds);
51
+ return new Date(from2(value).epochMilliseconds);
53
52
  }
54
- var SchemaLiteral = structuredTransform(Zod.string(), (it) => Results.map(parseString(it), (it2) => toLiteral(it2))).meta({
53
+ var SchemaLiteral = ZodUtil.structuredTransform(Zod.string(), (it) => Results.map(parseString(it), (it2) => toLiteral(it2))).meta({
55
54
  type: "string",
56
55
  format: "date-time"
57
56
  });
58
- var SchemaInstance = structuredTransform(Zod.string(), parseString).meta({
57
+ var SchemaInstance = ZodUtil.structuredTransform(Zod.string(), parseString).meta({
59
58
  type: "string",
60
59
  format: "date-time"
61
60
  });
62
- var isInstant = _isInstant;
63
- var now = (clock = DefaultClock) => {
61
+ var isInstant = Chrono._isInstant;
62
+ var now = (clock = Clocks.Default) => {
64
63
  return clock.instant();
65
64
  };
66
65
  var add = (element, duration) => {
67
- return from(element).add(fromDuration(duration));
66
+ return from2(element).add(Durations.from(duration));
68
67
  };
69
68
  var subtract = (element, duration) => {
70
- return from(element).subtract(fromDuration(duration));
69
+ return from2(element).subtract(Durations.from(duration));
71
70
  };
72
71
  var until = (element, other) => {
73
- return from(element).until(from(other));
72
+ return from2(element).until(from2(other));
74
73
  };
75
74
  var round = (element, unit) => {
76
- return from(element).round({ smallestUnit: unit });
75
+ return from2(element).round({ smallestUnit: unit });
77
76
  };
78
77
  function isEqual(element, other) {
79
- if (isNil(element) || isNil(other)) {
78
+ if (Objects.isNil(element) || Objects.isNil(other)) {
80
79
  return element === other;
81
80
  }
82
- return EqualBy(from(element), from(other));
81
+ return EqualBy(from2(element), from2(other));
83
82
  }
84
83
  var isBefore = (element, other) => {
85
- return CompareBy(from(element), from(other)) < 0;
84
+ return CompareBy(from2(element), from2(other)) < 0;
86
85
  };
87
86
  var isAfter = (element, other) => {
88
- return CompareBy(from(element), from(other)) > 0;
87
+ return CompareBy(from2(element), from2(other)) > 0;
89
88
  };
90
- var format = (element, timeZone, locale, options) => {
91
- const plainDateTime = fromInstant(from(element), timeZone);
92
- return formatPlainDateTime(plainDateTime, locale, options);
89
+ var format2 = (element, timeZone, locale, options) => {
90
+ const plainDateTime = PlainDateTimes.fromInstant(from2(element), timeZone);
91
+ return PlainDateTimes.format(plainDateTime, locale, options);
93
92
  };
94
93
  export {
95
94
  CompareBy,
@@ -98,8 +97,8 @@ export {
98
97
  SchemaInstance,
99
98
  SchemaLiteral,
100
99
  add,
101
- format,
102
- from,
100
+ format2 as format,
101
+ from2 as from,
103
102
  isAfter,
104
103
  isBefore,
105
104
  isEqual,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/temporal/instant.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill'\nimport { createNamespace } from '@bessemer/cornerstone/resource-key'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Comparator } from '@bessemer/cornerstone/comparator'\nimport { fromComparator } from '@bessemer/cornerstone/equalitor'\nimport { failure, Result, success } from '@bessemer/cornerstone/result'\nimport { ErrorEvent, invalidValue, unpackResult } from '@bessemer/cornerstone/error/error-event'\nimport { isError } from '@bessemer/cornerstone/error/error'\nimport { structuredTransform } from '@bessemer/cornerstone/zod-util'\nimport Zod from 'zod'\nimport { Default as DefaultClock } from '@bessemer/cornerstone/temporal/clock'\nimport { Duration, DurationLike, from as fromDuration } from '@bessemer/cornerstone/temporal/duration'\nimport { _isInstant, instantToLiteral, TimeUnit } from '@bessemer/cornerstone/temporal/chrono'\nimport { isString } from '@bessemer/cornerstone/string'\nimport { isNil } from '@bessemer/cornerstone/object'\nimport { Locale } from '@bessemer/cornerstone/intl/locale'\nimport { DateTimeFormatOptions, format as formatPlainDateTime, fromInstant } from '@bessemer/cornerstone/temporal/plain-date-time'\nimport { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id'\nimport { Results } from '@bessemer/cornerstone'\n\nexport type Instant = Temporal.Instant\nexport const Namespace = createNamespace('instant')\nexport type InstantLiteral = NominalType<string, typeof Namespace>\nexport type InstantLike = Instant | Date | InstantLiteral\n\nexport function from(value: InstantLike | string): Instant\nexport function from(value: InstantLike | string | null): Instant | null\nexport function from(value: InstantLike | string | undefined): Instant | undefined\nexport function from(value: InstantLike | string | null | undefined): Instant | null | undefined\nexport function from(value: InstantLike | string | null | undefined): Instant | null | undefined {\n if (isNil(value)) {\n return value\n }\n\n if (value instanceof Temporal.Instant) {\n return value\n }\n if (isString(value)) {\n return unpackResult(parseString(value))\n }\n\n return Temporal.Instant.fromEpochMilliseconds(value.getTime())\n}\n\nexport const CompareBy: Comparator<Instant> = (first: Instant, second: Instant): number => Temporal.Instant.compare(first, second)\nexport const EqualBy = fromComparator(CompareBy)\n\nexport const parseString = (value: string): Result<Instant, ErrorEvent> => {\n try {\n return success(Temporal.Instant.from(value))\n } catch (e) {\n if (!isError(e)) {\n throw e\n }\n\n return failure(invalidValue(value, { namespace: Namespace, message: e.message }))\n }\n}\n\nexport function toLiteral(value: InstantLike): InstantLiteral\nexport function toLiteral(value: InstantLike | null): InstantLiteral | null\nexport function toLiteral(value: InstantLike | undefined): InstantLiteral | undefined\nexport function toLiteral(value: InstantLike | null | undefined): InstantLiteral | null | undefined\nexport function toLiteral(value: InstantLike | null | undefined): InstantLiteral | null | undefined {\n if (isNil(value)) {\n return value\n }\n\n return instantToLiteral(from(value))\n}\n\nexport function toDate(value: InstantLike): Date\nexport function toDate(value: InstantLike | null): Date | null\nexport function toDate(value: InstantLike | undefined): Date | undefined\nexport function toDate(value: InstantLike | null | undefined): Date | null | undefined\nexport function toDate(value: InstantLike | null | undefined): Date | null | undefined {\n if (isNil(value)) {\n return value\n }\n\n return new Date(from(value).epochMilliseconds)\n}\n\nexport const SchemaLiteral = structuredTransform(Zod.string(), (it: string) => Results.map(parseString(it), (it) => toLiteral(it))).meta({\n type: 'string',\n format: 'date-time',\n})\n\nexport const SchemaInstance = structuredTransform(Zod.string(), parseString).meta({\n type: 'string',\n format: 'date-time',\n})\n\nexport const isInstant = _isInstant\n\nexport const now = (clock = DefaultClock): Instant => {\n return clock.instant()\n}\n\nexport const add = (element: InstantLike, duration: DurationLike): Instant => {\n return from(element).add(fromDuration(duration))\n}\n\nexport const subtract = (element: InstantLike, duration: DurationLike): Instant => {\n return from(element).subtract(fromDuration(duration))\n}\n\nexport const until = (element: InstantLike, other: InstantLike): Duration => {\n return from(element).until(from(other))\n}\n\nexport const round = (element: InstantLike, unit: TimeUnit): Instant => {\n return from(element).round({ smallestUnit: unit })\n}\n\nexport function isEqual(element: InstantLike, other: InstantLike): boolean\nexport function isEqual(element: InstantLike | null, other: InstantLike | null): boolean\nexport function isEqual(element: InstantLike | undefined, other: InstantLike | undefined): boolean\nexport function isEqual(element: InstantLike | null | undefined, other: InstantLike | null | undefined): boolean {\n if (isNil(element) || isNil(other)) {\n return element === other\n }\n\n return EqualBy(from(element), from(other))\n}\n\nexport const isBefore = (element: InstantLike, other: InstantLike): boolean => {\n return CompareBy(from(element), from(other)) < 0\n}\n\nexport const isAfter = (element: InstantLike, other: InstantLike): boolean => {\n return CompareBy(from(element), from(other)) > 0\n}\n\nexport const format = (element: InstantLike, timeZone: TimeZoneId, locale: Locale, options: DateTimeFormatOptions): string => {\n const plainDateTime = fromInstant(from(element), timeZone)\n return formatPlainDateTime(plainDateTime, locale, options)\n}\n"],"mappings":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,IAAI;AACjD;AAEO,IAAM,SAAS,CAAC,SAAsB,UAAsB,QAAgB,YAA2C;AAC5H,QAAM,gBAAgB,YAAY,KAAK,OAAO,GAAG,QAAQ;AACzD,SAAO,oBAAoB,eAAe,QAAQ,OAAO;AAC3D;","names":["it"]}
1
+ {"version":3,"sources":["../../src/temporal/instant.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Comparator } from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport * as Errors from '@bessemer/cornerstone/error/error'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport Zod from 'zod'\nimport * as Clocks from '@bessemer/cornerstone/temporal/clock'\nimport * as Durations from '@bessemer/cornerstone/temporal/duration'\nimport * as Chrono from '@bessemer/cornerstone/temporal/chrono'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id'\nimport * as PlainDateTimes from '@bessemer/cornerstone/temporal/plain-date-time'\nimport { Locale } from '@bessemer/cornerstone/intl/locale'\n\nexport type Instant = Temporal.Instant\nexport const Namespace = ResourceKeys.createNamespace('instant')\nexport type InstantLiteral = NominalType<string, typeof Namespace>\nexport type InstantLike = Instant | Date | InstantLiteral\n\nexport function from(value: InstantLike | string): Instant\nexport function from(value: InstantLike | string | null): Instant | null\nexport function from(value: InstantLike | string | undefined): Instant | undefined\nexport function from(value: InstantLike | string | null | undefined): Instant | null | undefined\nexport function from(value: InstantLike | string | null | undefined): Instant | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n\n if (value instanceof Temporal.Instant) {\n return value\n }\n if (Strings.isString(value)) {\n return ErrorEvents.unpackResult(parseString(value))\n }\n\n return Temporal.Instant.fromEpochMilliseconds(value.getTime())\n}\n\nexport const CompareBy: Comparator<Instant> = (first: Instant, second: Instant): number => Temporal.Instant.compare(first, second)\nexport const EqualBy = Equalitors.fromComparator(CompareBy)\n\nexport const parseString = (value: string): Results.Result<Instant, ErrorEvents.ErrorEvent> => {\n try {\n return Results.success(Temporal.Instant.from(value))\n } catch (e) {\n if (!Errors.isError(e)) {\n throw e\n }\n\n return Results.failure(ErrorEvents.invalidValue(value, { namespace: Namespace, message: e.message }))\n }\n}\n\nexport function toLiteral(value: InstantLike): InstantLiteral\nexport function toLiteral(value: InstantLike | null): InstantLiteral | null\nexport function toLiteral(value: InstantLike | undefined): InstantLiteral | undefined\nexport function toLiteral(value: InstantLike | null | undefined): InstantLiteral | null | undefined\nexport function toLiteral(value: InstantLike | null | undefined): InstantLiteral | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n\n return Chrono.instantToLiteral(from(value))\n}\n\nexport function toDate(value: InstantLike): Date\nexport function toDate(value: InstantLike | null): Date | null\nexport function toDate(value: InstantLike | undefined): Date | undefined\nexport function toDate(value: InstantLike | null | undefined): Date | null | undefined\nexport function toDate(value: InstantLike | null | undefined): Date | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n\n return new Date(from(value).epochMilliseconds)\n}\n\nexport const SchemaLiteral = ZodUtil.structuredTransform(Zod.string(), (it: string) => Results.map(parseString(it), (it) => toLiteral(it))).meta({\n type: 'string',\n format: 'date-time',\n})\n\nexport const SchemaInstance = ZodUtil.structuredTransform(Zod.string(), parseString).meta({\n type: 'string',\n format: 'date-time',\n})\n\nexport const isInstant = Chrono._isInstant\n\nexport const now = (clock = Clocks.Default): Instant => {\n return clock.instant()\n}\n\nexport const add = (element: InstantLike, duration: Durations.DurationLike): Instant => {\n return from(element).add(Durations.from(duration))\n}\n\nexport const subtract = (element: InstantLike, duration: Durations.DurationLike): Instant => {\n return from(element).subtract(Durations.from(duration))\n}\n\nexport const until = (element: InstantLike, other: InstantLike): Durations.Duration => {\n return from(element).until(from(other))\n}\n\nexport const round = (element: InstantLike, unit: Chrono.TimeUnit): Instant => {\n return from(element).round({ smallestUnit: unit })\n}\n\nexport function isEqual(element: InstantLike, other: InstantLike): boolean\nexport function isEqual(element: InstantLike | null, other: InstantLike | null): boolean\nexport function isEqual(element: InstantLike | undefined, other: InstantLike | undefined): boolean\nexport function isEqual(element: InstantLike | null | undefined, other: InstantLike | null | undefined): boolean {\n if (Objects.isNil(element) || Objects.isNil(other)) {\n return element === other\n }\n\n return EqualBy(from(element), from(other))\n}\n\nexport const isBefore = (element: InstantLike, other: InstantLike): boolean => {\n return CompareBy(from(element), from(other)) < 0\n}\n\nexport const isAfter = (element: InstantLike, other: InstantLike): boolean => {\n return CompareBy(from(element), from(other)) > 0\n}\n\nexport const format = (element: InstantLike, timeZone: TimeZoneId, locale: Locale, options: PlainDateTimes.DateTimeFormatOptions): string => {\n const plainDateTime = PlainDateTimes.fromInstant(from(element), timeZone)\n return PlainDateTimes.format(plainDateTime, locale, options)\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,YAAY,kBAAkB;AAG9B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,OAAO,SAAS;AAChB,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,YAAY,aAAa;AAEzB,YAAY,oBAAoB;AAIzB,IAAM,YAAyB,6BAAgB,SAAS;AAQxD,SAASA,MAAK,OAA4E;AAC/F,MAAY,cAAM,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO;AAAA,EACT;AACA,MAAY,iBAAS,KAAK,GAAG;AAC3B,WAAmB,yBAAa,YAAY,KAAK,CAAC;AAAA,EACpD;AAEA,SAAO,SAAS,QAAQ,sBAAsB,MAAM,QAAQ,C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AQ,CAAC;AACxD;AAEO,IAAM,QAAQ,CAAC,SAAsB,UAA2C;AACrF,SAAOA,MAAK,OAAO,EAAE,MAAMA,MAAK,KAAK,CAAC;AACxC;AAEO,IAAM,QAAQ,CAAC,SAAsB,SAAmC;AAC7E,SAAOA,MAAK,OAAO,EAAE,MAAM,EAAE,cAAc,KAAK,CAAC;AACnD;AAKO,SAAS,QAAQ,SAAyC,OAAgD;AAC/G,MAAY,cAAM,OAAO,KAAa,cAAM,KAAK,GAAG;AAClD,WAAO,YAAY;AAAA,EACrB;AAEA,SAAO,QAAQA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC;AAC3C;AAEO,IAAM,WAAW,CAAC,SAAsB,UAAgC;AAC7E,SAAO,UAAUA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC,IAAI;AACjD;AAEO,IAAM,UAAU,CAAC,SAAsB,UAAgC;AAC5E,SAAO,UAAUA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC,IAAI;AACjD;AAEO,IAAME,UAAS,CAAC,SAAsB,UAAsB,QAAgB,YAA0D;AAC3I,QAAM,gBAA+B,2BAAYF,MAAK,OAAO,GAAG,QAAQ;AACxE,SAAsB,sBAAO,eAAe,QAAQ,OAAO;AAC7D;","names":["from","it","format"]}
@@ -1,18 +1,21 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
+ import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
2
3
  import { NominalType } from '@bessemer/cornerstone/types';
3
4
  import { Comparator } from '@bessemer/cornerstone/comparator';
4
- import { Result } from '@bessemer/cornerstone/result';
5
- import { ErrorEvent } from '@bessemer/cornerstone/error/error-event';
5
+ import * as Equalitors from '@bessemer/cornerstone/equalitor';
6
+ import * as Results from '@bessemer/cornerstone/result';
7
+ import * as ErrorEvents from '@bessemer/cornerstone/error/error-event';
6
8
  import Zod from 'zod';
7
- import { Duration, DurationLike } from '@bessemer/cornerstone/temporal/duration';
8
- import { InstantLike } from '@bessemer/cornerstone/temporal/instant';
9
+ import * as Clocks from '@bessemer/cornerstone/temporal/clock';
10
+ import * as Durations from '@bessemer/cornerstone/temporal/duration';
11
+ import * as Instants from '@bessemer/cornerstone/temporal/instant';
9
12
  import { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id';
10
13
  import { TimeUnit } from '@bessemer/cornerstone/temporal/chrono';
11
14
  import { PlainTimeBuilder, TimeFormatOptions } from '@bessemer/cornerstone/temporal/plain-time';
12
15
  import { Locale } from '@bessemer/cornerstone/intl/locale';
13
16
  import { DateFormatOptions, PlainDateBuilder } from '@bessemer/cornerstone/temporal/plain-date';
14
17
  export type PlainDateTime = Temporal.PlainDateTime;
15
- export declare const Namespace: import("@bessemer/cornerstone/resource-key").ResourceNamespace<"plain-date-time">;
18
+ export declare const Namespace: ResourceKeys.ResourceNamespace<"plain-date-time">;
16
19
  export type PlainDateTimeLiteral = NominalType<string, typeof Namespace>;
17
20
  export type PlainDateTimeBuilder = PlainDateBuilder & PlainTimeBuilder;
18
21
  export type PlainDateTimeLike = PlainDateTime | PlainDateTimeLiteral | PlainDateTimeBuilder;
@@ -21,9 +24,9 @@ export declare function from(value: PlainDateTimeLike | string | null): PlainDat
21
24
  export declare function from(value: PlainDateTimeLike | string | undefined): PlainDateTime | undefined;
22
25
  export declare function from(value: PlainDateTimeLike | string | null | undefined): PlainDateTime | null | undefined;
23
26
  export declare const CompareBy: Comparator<PlainDateTime>;
24
- export declare const EqualBy: import("@bessemer/cornerstone/equalitor").Equalitor<Temporal.PlainDateTime>;
25
- export declare const parseString: (value: string) => Result<PlainDateTime, ErrorEvent>;
26
- export declare const fromInstant: (instant: InstantLike, zone: TimeZoneId) => PlainDateTime;
27
+ export declare const EqualBy: Equalitors.Equalitor<Temporal.PlainDateTime>;
28
+ export declare const parseString: (value: string) => Results.Result<PlainDateTime, ErrorEvents.ErrorEvent>;
29
+ export declare const fromInstant: (instant: Instants.InstantLike, zone: TimeZoneId) => PlainDateTime;
27
30
  export declare function toLiteral(likeValue: PlainDateTimeLike): PlainDateTimeLiteral;
28
31
  export declare function toLiteral(likeValue: PlainDateTimeLike | null): PlainDateTimeLiteral | null;
29
32
  export declare function toLiteral(likeValue: PlainDateTimeLike | undefined): PlainDateTimeLiteral | undefined;
@@ -33,13 +36,13 @@ export declare const SchemaInstance: Zod.ZodPipe<Zod.ZodString, Zod.ZodTransform
33
36
  export declare const isPlainDateTime: (value: unknown) => value is PlainDateTime;
34
37
  export declare const now: (zone: TimeZoneId, clock?: {
35
38
  readonly zone: TimeZoneId;
36
- instant(): import("@bessemer/cornerstone/temporal/instant").Instant;
37
- withZone(zone: TimeZoneId): import("@bessemer/cornerstone/temporal/clock").Clock;
39
+ instant(): Instants.Instant;
40
+ withZone(zone: TimeZoneId): Clocks.Clock;
38
41
  }) => PlainDateTime;
39
42
  export declare const merge: (element: PlainDateTimeLike, builder: PlainDateTimeBuilder) => PlainDateTime;
40
- export declare const add: (element: PlainDateTimeLike, duration: DurationLike) => PlainDateTime;
41
- export declare const subtract: (element: PlainDateTimeLike, duration: DurationLike) => PlainDateTime;
42
- export declare const until: (element: PlainDateTimeLike, other: PlainDateTimeLike) => Duration;
43
+ export declare const add: (element: PlainDateTimeLike, duration: Durations.DurationLike) => PlainDateTime;
44
+ export declare const subtract: (element: PlainDateTimeLike, duration: Durations.DurationLike) => PlainDateTime;
45
+ export declare const until: (element: PlainDateTimeLike, other: PlainDateTimeLike) => Durations.Duration;
43
46
  export declare const round: (element: PlainDateTimeLike, unit: TimeUnit) => PlainDateTime;
44
47
  export declare function isEqual(element: PlainDateTimeLike, other: PlainDateTimeLike): boolean;
45
48
  export declare function isEqual(element: PlainDateTimeLike | null, other: PlainDateTimeLike | null): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"plain-date-time.d.ts","sourceRoot":"","sources":["../../src/temporal/plain-date-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,WAAW,E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,MAAM,KAAK,GAAI,SAAS,iBAAiB,EAAE,MAAM,QAAQ,KAAG,aAElE,CAAA;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAA;AACtF,wBAAgB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAA;AACpG,wBAAgB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAA;AAS9G,eAAO,MAAM,QAAQ,GAAI,SAAS,iBAAiB,EAAE,OAAO,iBAAiB,KAAG,OAE/E,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,SAAS,iBAAiB,EAAE,OAAO,iBAAiB,KAAG,OAE9E,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAEzE,eAAO,MAAM,MAAM,GAAI,SAAS,iBAAiB,EAAE,QAAQ,MAAM,EAAE,SAAS,qBAAqB,KAAG,MAenG,CAAA"}
@@ -1,94 +1,92 @@
1
1
  // src/temporal/plain-date-time.ts
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
- import { createNamespace } from "@bessemer/cornerstone/resource-key";
4
- import { fromComparator } from "@bessemer/cornerstone/equalitor";
3
+ import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
4
+ import * as Equalitors from "@bessemer/cornerstone/equalitor";
5
5
  import * as Results from "@bessemer/cornerstone/result";
6
- import { failure, success } from "@bessemer/cornerstone/result";
7
- import { invalidValue, unpackResult } from "@bessemer/cornerstone/error/error-event";
8
- import { isError } from "@bessemer/cornerstone/error/error";
9
- import { structuredTransform } from "@bessemer/cornerstone/zod-util";
6
+ import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
7
+ import * as Errors from "@bessemer/cornerstone/error/error";
8
+ import * as ZodUtil from "@bessemer/cornerstone/zod-util";
10
9
  import Zod from "zod";
11
- import { Default as DefaultClock } from "@bessemer/cornerstone/temporal/clock";
12
- import { from as _fromDuration } from "@bessemer/cornerstone/temporal/duration";
13
- import { from as _fromInstant } from "@bessemer/cornerstone/temporal/instant";
14
- import { isString } from "@bessemer/cornerstone/string";
15
- import { isNil } from "@bessemer/cornerstone/object";
16
- var Namespace = createNamespace("plain-date-time");
17
- function from(value) {
18
- if (isNil(value)) {
10
+ import * as Clocks from "@bessemer/cornerstone/temporal/clock";
11
+ import * as Durations from "@bessemer/cornerstone/temporal/duration";
12
+ import * as Instants from "@bessemer/cornerstone/temporal/instant";
13
+ import * as Strings from "@bessemer/cornerstone/string";
14
+ import * as Objects from "@bessemer/cornerstone/object";
15
+ var Namespace = ResourceKeys.createNamespace("plain-date-time");
16
+ function from3(value) {
17
+ if (Objects.isNil(value)) {
19
18
  return value;
20
19
  }
21
20
  if (value instanceof Temporal.PlainDateTime) {
22
21
  return value;
23
22
  }
24
- if (isString(value)) {
25
- return unpackResult(parseString(value));
23
+ if (Strings.isString(value)) {
24
+ return ErrorEvents.unpackResult(parseString(value));
26
25
  }
27
26
  return Temporal.PlainDateTime.from(value);
28
27
  }
29
28
  var CompareBy = (first, second) => Temporal.PlainDateTime.compare(first, second);
30
- var EqualBy = fromComparator(CompareBy);
29
+ var EqualBy = Equalitors.fromComparator(CompareBy);
31
30
  var parseString = (value) => {
32
31
  try {
33
- return success(Temporal.PlainDateTime.from(value));
32
+ return Results.success(Temporal.PlainDateTime.from(value));
34
33
  } catch (e) {
35
- if (!isError(e)) {
34
+ if (!Errors.isError(e)) {
36
35
  throw e;
37
36
  }
38
- return failure(invalidValue(value, { namespace: Namespace, message: e.message }));
37
+ return Results.failure(ErrorEvents.invalidValue(value, { namespace: Namespace, message: e.message }));
39
38
  }
40
39
  };
41
40
  var fromInstant = (instant, zone) => {
42
- return _fromInstant(instant).toZonedDateTimeISO(zone).toPlainDateTime();
41
+ return Instants.from(instant).toZonedDateTimeISO(zone).toPlainDateTime();
43
42
  };
44
43
  function toLiteral(likeValue) {
45
- if (isNil(likeValue)) {
44
+ if (Objects.isNil(likeValue)) {
46
45
  return likeValue;
47
46
  }
48
- const value = from(likeValue);
47
+ const value = from3(likeValue);
49
48
  return value.toString();
50
49
  }
51
- var SchemaLiteral = structuredTransform(Zod.string(), (it) => Results.map(parseString(it), (it2) => toLiteral(it2)));
52
- var SchemaInstance = structuredTransform(Zod.string(), parseString);
50
+ var SchemaLiteral = ZodUtil.structuredTransform(Zod.string(), (it) => Results.map(parseString(it), (it2) => toLiteral(it2)));
51
+ var SchemaInstance = ZodUtil.structuredTransform(Zod.string(), parseString);
53
52
  var isPlainDateTime = (value) => {
54
53
  return value instanceof Temporal.PlainDateTime;
55
54
  };
56
- var now = (zone, clock = DefaultClock) => {
55
+ var now = (zone, clock = Clocks.Default) => {
57
56
  return fromInstant(clock.instant(), zone);
58
57
  };
59
58
  var merge = (element, builder) => {
60
- return from(element).with(builder);
59
+ return from3(element).with(builder);
61
60
  };
62
61
  var add = (element, duration) => {
63
- return from(element).add(_fromDuration(duration));
62
+ return from3(element).add(Durations.from(duration));
64
63
  };
65
64
  var subtract = (element, duration) => {
66
- return from(element).subtract(_fromDuration(duration));
65
+ return from3(element).subtract(Durations.from(duration));
67
66
  };
68
67
  var until = (element, other) => {
69
- return from(element).until(from(other));
68
+ return from3(element).until(from3(other));
70
69
  };
71
70
  var round = (element, unit) => {
72
- return from(element).round({ smallestUnit: unit });
71
+ return from3(element).round({ smallestUnit: unit });
73
72
  };
74
73
  function isEqual(element, other) {
75
- if (isNil(element) || isNil(other)) {
74
+ if (Objects.isNil(element) || Objects.isNil(other)) {
76
75
  return element === other;
77
76
  }
78
- return EqualBy(from(element), from(other));
77
+ return EqualBy(from3(element), from3(other));
79
78
  }
80
79
  var isBefore = (element, other) => {
81
- return CompareBy(from(element), from(other)) < 0;
80
+ return CompareBy(from3(element), from3(other)) < 0;
82
81
  };
83
82
  var isAfter = (element, other) => {
84
- return CompareBy(from(element), from(other)) > 0;
83
+ return CompareBy(from3(element), from3(other)) > 0;
85
84
  };
86
85
  var format = (element, locale, options) => {
87
- const plainDateTime = from(element);
86
+ const plainDateTime = from3(element);
88
87
  const date = new Date(
89
88
  plainDateTime.year,
90
89
  plainDateTime.month - 1,
91
- // Date months are 0-based
92
90
  plainDateTime.day,
93
91
  plainDateTime.hour,
94
92
  plainDateTime.minute,
@@ -106,7 +104,7 @@ export {
106
104
  SchemaLiteral,
107
105
  add,
108
106
  format,
109
- from,
107
+ from3 as from,
110
108
  fromInstant,
111
109
  isAfter,
112
110
  isBefore,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/temporal/plain-date-time.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill'\nimport { createNamespace } from '@bessemer/cornerstone/resource-key'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Comparator } from '@bessemer/cornerstone/comparator'\nimport { fromComparator } from '@bessemer/cornerstone/equalitor'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { failure, Result, success } from '@bessemer/cornerstone/result'\nimport { ErrorEvent, invalidValue, unpackResult } from '@bessemer/cornerstone/error/error-event'\nimport { isError } from '@bessemer/cornerstone/error/error'\nimport { structuredTransform } from '@bessemer/cornerstone/zod-util'\nimport Zod from 'zod'\nimport { Default as DefaultClock } from '@bessemer/cornerstone/temporal/clock'\nimport { Duration, DurationLike, from as _fromDuration } from '@bessemer/cornerstone/temporal/duration'\nimport { from as _fromInstant, InstantLike } from '@bessemer/cornerstone/temporal/instant'\nimport { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id'\nimport { TimeUnit } from '@bessemer/cornerstone/temporal/chrono'\nimport { isString } from '@bessemer/cornerstone/string'\nimport { isNil } from '@bessemer/cornerstone/object'\nimport { PlainTimeBuilder, TimeFormatOptions } from '@bessemer/cornerstone/temporal/plain-time'\nimport { Locale } from '@bessemer/cornerstone/intl/locale'\nimport { DateFormatOptions, PlainDateBuilder } from '@bessemer/cornerstone/temporal/plain-date'\n\nexport type PlainDateTime = Temporal.PlainDateTime\nexport const Namespace = createNamespace('plain-date-time')\nexport type PlainDateTimeLiteral = NominalType<string, typeof Namespace>\nexport type PlainDateTimeBuilder = PlainDateBuilder & PlainTimeBuilder\n\nexport type PlainDateTimeLike = PlainDateTime | PlainDateTimeLiteral | PlainDateTimeBuilder\n\nexport function from(value: PlainDateTimeLike | string): PlainDateTime\nexport function from(value: PlainDateTimeLike | string | null): PlainDateTime | null\nexport function from(value: PlainDateTimeLike | string | undefined): PlainDateTime | undefined\nexport function from(value: PlainDateTimeLike | string | null | undefined): PlainDateTime | null | undefined\nexport function from(value: PlainDateTimeLike | string | null | undefined): PlainDateTime | null | undefined {\n if (isNil(value)) {\n return value\n }\n\n if (value instanceof Temporal.PlainDateTime) {\n return value\n }\n\n if (isString(value)) {\n return unpackResult(parseString(value))\n }\n\n return Temporal.PlainDateTime.from(value)\n}\n\nexport const CompareBy: Comparator<PlainDateTime> = (first: PlainDateTime, second: PlainDateTime): number =>\n Temporal.PlainDateTime.compare(first, second)\nexport const EqualBy = fromComparator(CompareBy)\n\nexport const parseString = (value: string): Result<PlainDateTime, ErrorEvent> => {\n try {\n return success(Temporal.PlainDateTime.from(value))\n } catch (e) {\n if (!isError(e)) {\n throw e\n }\n\n return failure(invalidValue(value, { namespace: Namespace, message: e.message }))\n }\n}\n\nexport const fromInstant = (instant: InstantLike, zone: TimeZoneId): PlainDateTime => {\n return _fromInstant(instant).toZonedDateTimeISO(zone).toPlainDateTime()\n}\n\nexport function toLiteral(likeValue: PlainDateTimeLike): PlainDateTimeLiteral\nexport function toLiteral(likeValue: PlainDateTimeLike | null): PlainDateTimeLiteral | null\nexport function toLiteral(likeValue: PlainDateTimeLike | undefined): PlainDateTimeLiteral | undefined\nexport function toLiteral(likeValue: PlainDateTimeLike | null | undefined): PlainDateTimeLiteral | null | undefined\nexport function toLiteral(likeValue: PlainDateTimeLike | null | undefined): PlainDateTimeLiteral | null | undefined {\n if (isNil(likeValue)) {\n return likeValue\n }\n\n const value = from(likeValue)\n return value.toString() as PlainDateTimeLiteral\n}\n\nexport const SchemaLiteral = structuredTransform(Zod.string(), (it: string) => Results.map(parseString(it), (it) => toLiteral(it)))\nexport const SchemaInstance = structuredTransform(Zod.string(), parseString)\n\nexport const isPlainDateTime = (value: unknown): value is PlainDateTime => {\n return value instanceof Temporal.PlainDateTime\n}\n\nexport const now = (zone: TimeZoneId, clock = DefaultClock): PlainDateTime => {\n return fromInstant(clock.instant(), zone)\n}\n\nexport const merge = (element: PlainDateTimeLike, builder: PlainDateTimeBuilder): PlainDateTime => {\n return from(element).with(builder)\n}\n\nexport const add = (element: PlainDateTimeLike, duration: DurationLike): PlainDateTime => {\n return from(element).add(_fromDuration(duration))\n}\n\nexport const subtract = (element: PlainDateTimeLike, duration: DurationLike): PlainDateTime => {\n return from(element).subtract(_fromDuration(duration))\n}\n\nexport const until = (element: PlainDateTimeLike, other: PlainDateTimeLike): Duration => {\n return from(element).until(from(other))\n}\n\nexport const round = (element: PlainDateTimeLike, unit: TimeUnit): PlainDateTime => {\n return from(element).round({ smallestUnit: unit })\n}\n\nexport function isEqual(element: PlainDateTimeLike, other: PlainDateTimeLike): boolean\nexport function isEqual(element: PlainDateTimeLike | null, other: PlainDateTimeLike | null): boolean\nexport function isEqual(element: PlainDateTimeLike | undefined, other: PlainDateTimeLike | undefined): boolean\nexport function isEqual(element: PlainDateTimeLike | null | undefined, other: PlainDateTimeLike | null | undefined): boolean {\n if (isNil(element) || isNil(other)) {\n return element === other\n }\n\n return EqualBy(from(element), from(other))\n}\n\nexport const isBefore = (element: PlainDateTimeLike, other: PlainDateTimeLike): boolean => {\n return CompareBy(from(element), from(other)) < 0\n}\n\nexport const isAfter = (element: PlainDateTimeLike, other: PlainDateTimeLike): boolean => {\n return CompareBy(from(element), from(other)) > 0\n}\n\nexport type DateTimeFormatOptions = DateFormatOptions & TimeFormatOptions\n\nexport const format = (element: PlainDateTimeLike, locale: Locale, options: DateTimeFormatOptions): string => {\n const plainDateTime = from(element)\n\n // Convert PlainDateTime to Date\n const date = new Date(\n plainDateTime.year,\n plainDateTime.month - 1, // Date months are 0-based\n plainDateTime.day,\n plainDateTime.hour,\n plainDateTime.minute,\n plainDateTime.second,\n plainDateTime.millisecond\n )\n\n const formatter = new Intl.DateTimeFormat(locale, options)\n return formatter.format(date)\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAGhC,SAAS,sBAAsB;AAC/B,YAAY,aAAa;AACzB,SAAS,SAAiB,eAAe;AACzC,SAAqB,cAAc,oBAAoB;AACvD,SAAS,eAAe;AACxB,SAAS,2BAA2B;AACpC,OAAO,SAAS;AAChB,SAAS,WAAW,oBAAoB;AACxC,SAAiC,QAAQ,qBAAqB;AAC9D,SAAS,QAAQ,oBAAiC;AAGlD,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAMf,IAAM,YAAY,gBAAgB,iBAAiB;AAUnD,SAAS,KAAK,OAAwF;AAC3G,MAAI,MAAM,KAAK,GAAG;AAChB,WAAO;AAAA,EACT;AAEA,MAAI,iBAAiB,SAAS,eAAe;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,aAAa,YAAY,KAAK,CAAC;AAAA,EACxC;AAEA,SAAO,SAAS,cAAc,KAAK,KAAK;AAC1C;AAEO,IAAM,YAAuC,CAAC,OAAsB,WACzE,SAAS,cAAc,QAAQ,OAAO,MAAM;AACvC,IAAM,UAAU,eAAe,SAAS;AAExC,IAAM,cAAc,CAAC,UAAqD;AAC/E,MAAI;AACF,WAAO,QAAQ,SAAS,cAAc,KAAK,KAAK,CAAC;AAAA,EACnD,SAAS,GAAG;AACV,QAAI,CAAC,QAAQ,CAAC,GAAG;AACf,YAAM;AAAA,IACR;AAEA,WAAO,QAAQ,aAAa,OAAO,EAAE,WAAW,WAAW,SAAS,EAAE,QAAQ,CAAC,CAAC;A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K,OAAO,GAAG,KAAK,KAAK,CAAC;AAC3C;AAEO,IAAM,WAAW,CAAC,SAA4B,UAAsC;AACzF,SAAO,UAAU,KAAK,OAAO,GAAG,KAAK,KAAK,CAAC,IAAI;AACjD;AAEO,IAAM,UAAU,CAAC,SAA4B,UAAsC;AACxF,SAAO,UAAU,KAAK,OAAO,GAAG,KAAK,KAAK,CAAC,IAAI;AACjD;AAIO,IAAM,SAAS,CAAC,SAA4B,QAAgB,YAA2C;AAC5G,QAAM,gBAAgB,KAAK,OAAO;AAGlC,QAAM,OAAO,IAAI;AAAA,IACf,cAAc;AAAA,IACd,cAAc,QAAQ;AAAA;AAAA,IACtB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AAEA,QAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,OAAO;AACzD,SAAO,UAAU,OAAO,IAAI;AAC9B;","names":["it"]}
1
+ {"version":3,"sources":["../../src/temporal/plain-date-time.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport { NominalType } from '@bessemer/cornerstone/types'\nimport { Comparator } from '@bessemer/cornerstone/comparator'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport * as Results from '@bessemer/cornerstone/result'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport * as Errors from '@bessemer/cornerstone/error/error'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport Zod from 'zod'\nimport * as Clocks from '@bessemer/cornerstone/temporal/clock'\nimport * as Durations from '@bessemer/cornerstone/temporal/duration'\nimport * as Instants from '@bessemer/cornerstone/temporal/instant'\nimport { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id'\nimport { TimeUnit } from '@bessemer/cornerstone/temporal/chrono'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport { PlainTimeBuilder, TimeFormatOptions } from '@bessemer/cornerstone/temporal/plain-time'\nimport { Locale } from '@bessemer/cornerstone/intl/locale'\nimport { DateFormatOptions, PlainDateBuilder } from '@bessemer/cornerstone/temporal/plain-date'\n\nexport type PlainDateTime = Temporal.PlainDateTime\nexport const Namespace = ResourceKeys.createNamespace('plain-date-time')\nexport type PlainDateTimeLiteral = NominalType<string, typeof Namespace>\nexport type PlainDateTimeBuilder = PlainDateBuilder & PlainTimeBuilder\n\nexport type PlainDateTimeLike = PlainDateTime | PlainDateTimeLiteral | PlainDateTimeBuilder\n\nexport function from(value: PlainDateTimeLike | string): PlainDateTime\nexport function from(value: PlainDateTimeLike | string | null): PlainDateTime | null\nexport function from(value: PlainDateTimeLike | string | undefined): PlainDateTime | undefined\nexport function from(value: PlainDateTimeLike | string | null | undefined): PlainDateTime | null | undefined\nexport function from(value: PlainDateTimeLike | string | null | undefined): PlainDateTime | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n\n if (value instanceof Temporal.PlainDateTime) {\n return value\n }\n\n if (Strings.isString(value)) {\n return ErrorEvents.unpackResult(parseString(value))\n }\n\n return Temporal.PlainDateTime.from(value)\n}\n\nexport const CompareBy: Comparator<PlainDateTime> = (first: PlainDateTime, second: PlainDateTime): number =>\n Temporal.PlainDateTime.compare(first, second)\nexport const EqualBy = Equalitors.fromComparator(CompareBy)\n\nexport const parseString = (value: string): Results.Result<PlainDateTime, ErrorEvents.ErrorEvent> => {\n try {\n return Results.success(Temporal.PlainDateTime.from(value))\n } catch (e) {\n if (!Errors.isError(e)) {\n throw e\n }\n\n return Results.failure(ErrorEvents.invalidValue(value, { namespace: Namespace, message: e.message }))\n }\n}\n\nexport const fromInstant = (instant: Instants.InstantLike, zone: TimeZoneId): PlainDateTime => {\n return Instants.from(instant).toZonedDateTimeISO(zone).toPlainDateTime()\n}\n\nexport function toLiteral(likeValue: PlainDateTimeLike): PlainDateTimeLiteral\nexport function toLiteral(likeValue: PlainDateTimeLike | null): PlainDateTimeLiteral | null\nexport function toLiteral(likeValue: PlainDateTimeLike | undefined): PlainDateTimeLiteral | undefined\nexport function toLiteral(likeValue: PlainDateTimeLike | null | undefined): PlainDateTimeLiteral | null | undefined\nexport function toLiteral(likeValue: PlainDateTimeLike | null | undefined): PlainDateTimeLiteral | null | undefined {\n if (Objects.isNil(likeValue)) {\n return likeValue\n }\n\n const value = from(likeValue)\n return value.toString() as PlainDateTimeLiteral\n}\n\nexport const SchemaLiteral = ZodUtil.structuredTransform(Zod.string(), (it: string) => Results.map(parseString(it), (it) => toLiteral(it)))\nexport const SchemaInstance = ZodUtil.structuredTransform(Zod.string(), parseString)\n\nexport const isPlainDateTime = (value: unknown): value is PlainDateTime => {\n return value instanceof Temporal.PlainDateTime\n}\n\nexport const now = (zone: TimeZoneId, clock = Clocks.Default): PlainDateTime => {\n return fromInstant(clock.instant(), zone)\n}\n\nexport const merge = (element: PlainDateTimeLike, builder: PlainDateTimeBuilder): PlainDateTime => {\n return from(element).with(builder)\n}\n\nexport const add = (element: PlainDateTimeLike, duration: Durations.DurationLike): PlainDateTime => {\n return from(element).add(Durations.from(duration))\n}\n\nexport const subtract = (element: PlainDateTimeLike, duration: Durations.DurationLike): PlainDateTime => {\n return from(element).subtract(Durations.from(duration))\n}\n\nexport const until = (element: PlainDateTimeLike, other: PlainDateTimeLike): Durations.Duration => {\n return from(element).until(from(other))\n}\n\nexport const round = (element: PlainDateTimeLike, unit: TimeUnit): PlainDateTime => {\n return from(element).round({ smallestUnit: unit })\n}\n\nexport function isEqual(element: PlainDateTimeLike, other: PlainDateTimeLike): boolean\nexport function isEqual(element: PlainDateTimeLike | null, other: PlainDateTimeLike | null): boolean\nexport function isEqual(element: PlainDateTimeLike | undefined, other: PlainDateTimeLike | undefined): boolean\nexport function isEqual(element: PlainDateTimeLike | null | undefined, other: PlainDateTimeLike | null | undefined): boolean {\n if (Objects.isNil(element) || Objects.isNil(other)) {\n return element === other\n }\n\n return EqualBy(from(element), from(other))\n}\n\nexport const isBefore = (element: PlainDateTimeLike, other: PlainDateTimeLike): boolean => {\n return CompareBy(from(element), from(other)) < 0\n}\n\nexport const isAfter = (element: PlainDateTimeLike, other: PlainDateTimeLike): boolean => {\n return CompareBy(from(element), from(other)) > 0\n}\n\nexport type DateTimeFormatOptions = DateFormatOptions & TimeFormatOptions\n\nexport const format = (element: PlainDateTimeLike, locale: Locale, options: DateTimeFormatOptions): string => {\n const plainDateTime = from(element)\n\n const date = new Date(\n plainDateTime.year,\n plainDateTime.month - 1,\n plainDateTime.day,\n plainDateTime.hour,\n plainDateTime.minute,\n plainDateTime.second,\n plainDateTime.millisecond\n )\n\n const formatter = new Intl.DateTimeFormat(locale, options)\n return formatter.format(date)\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,YAAY,kBAAkB;AAG9B,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,YAAY;AACxB,YAAY,aAAa;AACzB,OAAO,SAAS;AAChB,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,YAAY,cAAc;AAG1B,YAAY,aAAa;AACzB,YAAY,aAAa;AAMlB,IAAM,YAAyB,6BAAgB,iBAAiB;AAUhE,SAASA,MAAK,OAAwF;AAC3G,MAAY,cAAM,KAAK,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,MAAI,iBAAiB,SAAS,eAAe;AAC3C,WAAO;AAAA,EACT;AAEA,MAAY,iBAAS,KAAK,GAAG;AAC3B,WAAmB,yBAAa,YAAY,KAAK,CAAC;AAAA,EACpD;AAEA,SAAO,SAAS,cAAc,KAAK,KAAK;AAC1C;AAEO,IAAM,YAAuC,CAAC,OAAsB,WACzE,SAAS,cAAc,QAAQ,OAAO,MAAM;AACvC,IAAM,UAAqB,0BAAe,SAAS;AAEnD,IAAM,cAAc,CAAC,UAAyE;AACnG,MAAI;AACF,WAAe,gBAAQ,SAAS,cAAc,KAAK,KAAK,CAAC;AAAA,EAC3D,SAAS,GAAG;A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AK,CAAC;AACnD;AAKO,SAAS,QAAQ,SAA+C,OAAsD;AAC3H,MAAY,cAAM,OAAO,KAAa,cAAM,KAAK,GAAG;AAClD,WAAO,YAAY;AAAA,EACrB;AAEA,SAAO,QAAQA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC;AAC3C;AAEO,IAAM,WAAW,CAAC,SAA4B,UAAsC;AACzF,SAAO,UAAUA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC,IAAI;AACjD;AAEO,IAAM,UAAU,CAAC,SAA4B,UAAsC;AACxF,SAAO,UAAUA,MAAK,OAAO,GAAGA,MAAK,KAAK,CAAC,IAAI;AACjD;AAIO,IAAM,SAAS,CAAC,SAA4B,QAAgB,YAA2C;AAC5G,QAAM,gBAAgBA,MAAK,OAAO;AAElC,QAAM,OAAO,IAAI;AAAA,IACf,cAAc;AAAA,IACd,cAAc,QAAQ;AAAA,IACtB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AAEA,QAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,OAAO;AACzD,SAAO,UAAU,OAAO,IAAI;AAC9B;","names":["from","it"]}
@@ -1,15 +1,18 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
+ import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
2
3
  import { NominalType } from '@bessemer/cornerstone/types';
3
4
  import { Comparator } from '@bessemer/cornerstone/comparator';
4
- import { Result } from '@bessemer/cornerstone/result';
5
- import { ErrorEvent } from '@bessemer/cornerstone/error/error-event';
5
+ import * as Equalitors from '@bessemer/cornerstone/equalitor';
6
+ import * as Results from '@bessemer/cornerstone/result';
7
+ import * as ErrorEvents from '@bessemer/cornerstone/error/error-event';
6
8
  import Zod from 'zod';
7
- import { Duration, DurationLike } from '@bessemer/cornerstone/temporal/duration';
8
- import { InstantLike } from '@bessemer/cornerstone/temporal/instant';
9
+ import * as Clocks from '@bessemer/cornerstone/temporal/clock';
10
+ import * as Durations from '@bessemer/cornerstone/temporal/duration';
11
+ import * as Instants from '@bessemer/cornerstone/temporal/instant';
9
12
  import { TimeZoneId } from '@bessemer/cornerstone/temporal/time-zone-id';
10
13
  import { Locale } from '@bessemer/cornerstone/intl/locale';
11
14
  export type PlainDate = Temporal.PlainDate;
12
- export declare const Namespace: import("@bessemer/cornerstone/resource-key").ResourceNamespace<"plain-date">;
15
+ export declare const Namespace: ResourceKeys.ResourceNamespace<"plain-date">;
13
16
  export type PlainDateLiteral = NominalType<string, typeof Namespace>;
14
17
  export type PlainDateBuilder = {
15
18
  year: number;
@@ -22,9 +25,9 @@ export declare function from(value: PlainDateLike | string | null): PlainDate |
22
25
  export declare function from(value: PlainDateLike | string | undefined): PlainDate | undefined;
23
26
  export declare function from(value: PlainDateLike | string | null | undefined): PlainDate | null | undefined;
24
27
  export declare const CompareBy: Comparator<PlainDate>;
25
- export declare const EqualBy: import("@bessemer/cornerstone/equalitor").Equalitor<Temporal.PlainDate>;
26
- export declare const parseString: (value: string) => Result<PlainDate, ErrorEvent>;
27
- export declare const fromInstant: (instant: InstantLike, zone: TimeZoneId) => PlainDate;
28
+ export declare const EqualBy: Equalitors.Equalitor<Temporal.PlainDate>;
29
+ export declare const parseString: (value: string) => Results.Result<PlainDate, ErrorEvents.ErrorEvent>;
30
+ export declare const fromInstant: (instant: Instants.InstantLike, zone: TimeZoneId) => PlainDate;
28
31
  export declare function toLiteral(likeValue: PlainDateLike): PlainDateLiteral;
29
32
  export declare function toLiteral(likeValue: PlainDateLike | null): PlainDateLiteral | null;
30
33
  export declare function toLiteral(likeValue: PlainDateLike | undefined): PlainDateLiteral | undefined;
@@ -34,13 +37,13 @@ export declare const SchemaInstance: Zod.ZodPipe<Zod.ZodString, Zod.ZodTransform
34
37
  export declare const isPlainDateTime: (value: unknown) => value is PlainDate;
35
38
  export declare const now: (zone: TimeZoneId, clock?: {
36
39
  readonly zone: TimeZoneId;
37
- instant(): import("@bessemer/cornerstone/temporal/instant").Instant;
38
- withZone(zone: TimeZoneId): import("@bessemer/cornerstone/temporal/clock").Clock;
40
+ instant(): Instants.Instant;
41
+ withZone(zone: TimeZoneId): Clocks.Clock;
39
42
  }) => PlainDate;
40
43
  export declare const merge: (element: PlainDateLike, builder: Partial<PlainDateBuilder>) => PlainDate;
41
- export declare const add: (element: PlainDateLike, duration: DurationLike) => PlainDate;
42
- export declare const subtract: (element: PlainDateLike, duration: DurationLike) => PlainDate;
43
- export declare const until: (element: PlainDateLike, other: PlainDateLike) => Duration;
44
+ export declare const add: (element: PlainDateLike, duration: Durations.DurationLike) => PlainDate;
45
+ export declare const subtract: (element: PlainDateLike, duration: Durations.DurationLike) => PlainDate;
46
+ export declare const until: (element: PlainDateLike, other: PlainDateLike) => Durations.Duration;
44
47
  export declare function isEqual(element: PlainDateLike, other: PlainDateLike): boolean;
45
48
  export declare function isEqual(element: PlainDateLike | null, other: PlainDateLike | null): boolean;
46
49
  export declare function isEqual(element: PlainDateLike | undefined, other: PlainDateLike | undefined): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"plain-date.d.ts","sourceRoot":"","sources":["../../src/temporal/plain-date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAG7D,OAAO,EAAW,MAAM,EAAW,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,UAAU,EAA8B,MAAM,yCAAyC,CAAA;AAGhG,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAyB,MAAM,yCAAyC,CAAA;AACvG,OAAO,EAAwB,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAA;AAGxE,OAAO,EAAE,MAAM,EAAE,MA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