@bessemer/cornerstone 0.5.113 → 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.
- package/dist/array.d.ts.map +1 -1
- package/dist/array.js +28 -28
- package/dist/array.js.map +1 -1
- package/dist/aspect-ratio.d.ts +3 -3
- package/dist/aspect-ratio.d.ts.map +1 -1
- package/dist/aspect-ratio.js +13 -12
- package/dist/aspect-ratio.js.map +1 -1
- package/dist/assertion.d.ts.map +1 -1
- package/dist/assertion.js +5 -5
- package/dist/assertion.js.map +1 -1
- package/dist/async-value.js +2 -2
- package/dist/async-value.js.map +1 -1
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +2 -2
- package/dist/async.js.map +1 -1
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +11 -12
- package/dist/cache.js.map +1 -1
- package/dist/combinable.js +5 -5
- package/dist/combinable.js.map +1 -1
- package/dist/comparator.js +8 -8
- package/dist/comparator.js.map +1 -1
- package/dist/data-size.d.ts +2 -1
- package/dist/data-size.d.ts.map +1 -1
- package/dist/data-size.js +3 -3
- package/dist/data-size.js.map +1 -1
- package/dist/either.js +5 -5
- package/dist/either.js.map +1 -1
- package/dist/equalitor.d.ts.map +1 -1
- package/dist/equalitor.js +2 -2
- package/dist/equalitor.js.map +1 -1
- package/dist/error/error-cause.d.ts.map +1 -1
- package/dist/error/error-cause.js +14 -14
- package/dist/error/error-cause.js.map +1 -1
- package/dist/error/error-code.js +2 -2
- package/dist/error/error-code.js.map +1 -1
- package/dist/error/error-event.d.ts +3 -2
- package/dist/error/error-event.d.ts.map +1 -1
- package/dist/error/error-event.js +28 -28
- package/dist/error/error-event.js.map +1 -1
- package/dist/error/error-type.d.ts +2 -1
- package/dist/error/error-type.d.ts.map +1 -1
- package/dist/error/error-type.js +2 -2
- package/dist/error/error-type.js.map +1 -1
- package/dist/error/error.js +5 -5
- package/dist/error/error.js.map +1 -1
- package/dist/expression/array-expression.js +3 -3
- package/dist/expression/array-expression.js.map +1 -1
- package/dist/expression/core-expression.d.ts.map +1 -1
- package/dist/expression/core-expression.js +19 -19
- package/dist/expression/core-expression.js.map +1 -1
- package/dist/expression/expression-evaluator.js +2 -2
- package/dist/expression/expression-evaluator.js.map +1 -1
- package/dist/expression/expression-mapper.js +4 -4
- package/dist/expression/expression-mapper.js.map +1 -1
- package/dist/expression/internal.js +3 -3
- package/dist/expression/internal.js.map +1 -1
- package/dist/expression/numeric-expression.js +13 -13
- package/dist/expression/numeric-expression.js.map +1 -1
- package/dist/expression/string-expression.js +4 -4
- package/dist/expression/string-expression.js.map +1 -1
- package/dist/expression.d.ts +17 -1
- package/dist/expression.d.ts.map +1 -1
- package/dist/expression.js.map +1 -1
- package/dist/glob.d.ts +3 -3
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +11 -12
- package/dist/glob.js.map +1 -1
- package/dist/global-variable.d.ts.map +1 -1
- package/dist/global-variable.js +5 -5
- package/dist/global-variable.js.map +1 -1
- package/dist/hex-code.d.ts +3 -3
- package/dist/hex-code.d.ts.map +1 -1
- package/dist/hex-code.js +11 -10
- package/dist/hex-code.js.map +1 -1
- package/dist/index.d.ts +311 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/intl/country-code.d.ts +3 -3
- package/dist/intl/country-code.d.ts.map +1 -1
- package/dist/intl/country-code.js +9 -10
- package/dist/intl/country-code.js.map +1 -1
- package/dist/intl/country-subdivision-code.d.ts +3 -3
- package/dist/intl/country-subdivision-code.d.ts.map +1 -1
- package/dist/intl/country-subdivision-code.js +13 -11
- package/dist/intl/country-subdivision-code.js.map +1 -1
- package/dist/intl/currency-code.d.ts +3 -3
- package/dist/intl/currency-code.d.ts.map +1 -1
- package/dist/intl/currency-code.js +9 -10
- package/dist/intl/currency-code.js.map +1 -1
- package/dist/intl/language-code.d.ts +3 -3
- package/dist/intl/language-code.d.ts.map +1 -1
- package/dist/intl/language-code.js +9 -10
- package/dist/intl/language-code.js.map +1 -1
- package/dist/intl/locale.d.ts +3 -3
- package/dist/intl/locale.d.ts.map +1 -1
- package/dist/intl/locale.js +18 -19
- package/dist/intl/locale.js.map +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +2 -2
- package/dist/json.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +12 -12
- package/dist/logger.js.map +1 -1
- package/dist/map.d.ts +306 -0
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +8 -8
- package/dist/map.js.map +1 -1
- package/dist/mime-type.d.ts +3 -3
- package/dist/mime-type.d.ts.map +1 -1
- package/dist/mime-type.js +9 -10
- package/dist/mime-type.js.map +1 -1
- package/dist/misc.js +4 -4
- package/dist/misc.js.map +1 -1
- package/dist/monetary-amount.d.ts +3 -2
- package/dist/monetary-amount.d.ts.map +1 -1
- package/dist/monetary-amount.js +16 -16
- package/dist/monetary-amount.js.map +1 -1
- package/dist/net/content-type.d.ts +2 -1
- package/dist/net/content-type.d.ts.map +1 -1
- package/dist/net/content-type.js +2 -2
- package/dist/net/content-type.js.map +1 -1
- package/dist/net/domain-name.d.ts +3 -3
- package/dist/net/domain-name.d.ts.map +1 -1
- package/dist/net/domain-name.js +10 -11
- package/dist/net/domain-name.js.map +1 -1
- package/dist/net/http-method.d.ts.map +1 -1
- package/dist/net/http-method.js +9 -9
- package/dist/net/http-method.js.map +1 -1
- package/dist/net/ipv4-address.d.ts +3 -3
- package/dist/net/ipv4-address.d.ts.map +1 -1
- package/dist/net/ipv4-address.js +10 -11
- package/dist/net/ipv4-address.js.map +1 -1
- package/dist/net/ipv6-address.d.ts +3 -3
- package/dist/net/ipv6-address.d.ts.map +1 -1
- package/dist/net/ipv6-address.js +10 -11
- package/dist/net/ipv6-address.js.map +1 -1
- package/dist/net/uri-host-name.d.ts +3 -3
- package/dist/net/uri-host-name.d.ts.map +1 -1
- package/dist/net/uri-host-name.js +15 -16
- package/dist/net/uri-host-name.js.map +1 -1
- package/dist/net/uri.d.ts +1 -2
- package/dist/net/uri.d.ts.map +1 -1
- package/dist/net/uri.js +5 -3
- package/dist/net/uri.js.map +1 -1
- package/dist/net/url.d.ts.map +1 -1
- package/dist/net/url.js +6 -7
- package/dist/net/url.js.map +1 -1
- package/dist/object/object-path.d.ts.map +1 -1
- package/dist/object/object-path.js +23 -28
- package/dist/object/object-path.js.map +1 -1
- package/dist/object/type-path.js +19 -19
- package/dist/object/type-path.js.map +1 -1
- package/dist/patch.js +4 -4
- package/dist/patch.js.map +1 -1
- package/dist/promise.js +2 -2
- package/dist/promise.js.map +1 -1
- package/dist/property.d.ts.map +1 -1
- package/dist/property.js +7 -7
- package/dist/property.js.map +1 -1
- package/dist/proxy.js +2 -2
- package/dist/proxy.js.map +1 -1
- package/dist/range.js +2 -2
- package/dist/range.js.map +1 -1
- package/dist/reference.d.ts +2 -1
- package/dist/reference.d.ts.map +1 -1
- package/dist/reference.js +13 -13
- package/dist/reference.js.map +1 -1
- package/dist/resource-key.js +2 -2
- package/dist/resource-key.js.map +1 -1
- package/dist/result.js +5 -5
- package/dist/result.js.map +1 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +12 -12
- package/dist/retry.js.map +1 -1
- package/dist/rich-text.js +2 -2
- package/dist/rich-text.js.map +1 -1
- package/dist/signature.d.ts.map +1 -1
- package/dist/signature.js +9 -9
- package/dist/signature.js.map +1 -1
- package/dist/sql/sql-expression-parser.js +2 -2
- package/dist/sql/sql-expression-parser.js.map +1 -1
- package/dist/sql.d.ts +5 -1
- package/dist/sql.d.ts.map +1 -1
- package/dist/sql.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +9 -9
- package/dist/store.js.map +1 -1
- package/dist/string.js +4 -4
- package/dist/string.js.map +1 -1
- package/dist/tag.d.ts.map +1 -1
- package/dist/tag.js +10 -10
- package/dist/tag.js.map +1 -1
- package/dist/temporal/clock.d.ts +13 -13
- package/dist/temporal/clock.d.ts.map +1 -1
- package/dist/temporal/clock.js +10 -10
- package/dist/temporal/clock.js.map +1 -1
- package/dist/temporal/duration.d.ts +15 -9
- package/dist/temporal/duration.d.ts.map +1 -1
- package/dist/temporal/duration.js +30 -31
- package/dist/temporal/duration.js.map +1 -1
- package/dist/temporal/instant.d.ts +18 -15
- package/dist/temporal/instant.d.ts.map +1 -1
- package/dist/temporal/instant.js +42 -43
- package/dist/temporal/instant.js.map +1 -1
- package/dist/temporal/plain-date-time.d.ts +16 -13
- package/dist/temporal/plain-date-time.d.ts.map +1 -1
- package/dist/temporal/plain-date-time.js +36 -38
- package/dist/temporal/plain-date-time.js.map +1 -1
- package/dist/temporal/plain-date.d.ts +16 -13
- package/dist/temporal/plain-date.d.ts.map +1 -1
- package/dist/temporal/plain-date.js +35 -37
- package/dist/temporal/plain-date.js.map +1 -1
- package/dist/temporal/plain-month-day.d.ts +37 -0
- package/dist/temporal/plain-month-day.d.ts.map +1 -0
- package/dist/temporal/plain-month-day.js +84 -0
- package/dist/temporal/plain-month-day.js.map +1 -0
- package/dist/temporal/plain-time.d.ts +19 -17
- package/dist/temporal/plain-time.d.ts.map +1 -1
- package/dist/temporal/plain-time.js +43 -42
- package/dist/temporal/plain-time.js.map +1 -1
- package/dist/temporal/plain-year-month.d.ts +57 -0
- package/dist/temporal/plain-year-month.d.ts.map +1 -0
- package/dist/temporal/plain-year-month.js +109 -0
- package/dist/temporal/plain-year-month.js.map +1 -0
- package/dist/temporal/time-zone-id.d.ts +5 -4
- package/dist/temporal/time-zone-id.d.ts.map +1 -1
- package/dist/temporal/time-zone-id.js +11 -11
- package/dist/temporal/time-zone-id.js.map +1 -1
- package/dist/temporal/time-zone-offset.d.ts +12 -11
- package/dist/temporal/time-zone-offset.d.ts.map +1 -1
- package/dist/temporal/time-zone-offset.js +42 -50
- package/dist/temporal/time-zone-offset.js.map +1 -1
- package/dist/temporal/zoned-date-time.d.ts +16 -13
- package/dist/temporal/zoned-date-time.d.ts.map +1 -1
- package/dist/temporal/zoned-date-time.js +35 -36
- package/dist/temporal/zoned-date-time.js.map +1 -1
- package/dist/uuid/ulid.d.ts +3 -3
- package/dist/uuid/ulid.d.ts.map +1 -1
- package/dist/uuid/ulid.js +9 -10
- package/dist/uuid/ulid.js.map +1 -1
- package/dist/uuid/uuid-v4.d.ts +3 -3
- package/dist/uuid/uuid-v4.d.ts.map +1 -1
- package/dist/uuid/uuid-v4.js +13 -14
- package/dist/uuid/uuid-v4.js.map +1 -1
- package/dist/uuid/uuid-v7.d.ts +1 -2
- package/dist/uuid/uuid-v7.d.ts.map +1 -1
- package/dist/uuid/uuid-v7.js +1 -2
- package/dist/uuid/uuid-v7.js.map +1 -1
- package/dist/zod-util.d.ts +4 -3
- package/dist/zod-util.d.ts.map +1 -1
- package/dist/zod-util.js +21 -11
- package/dist/zod-util.js.map +1 -1
- package/package.json +6 -4
|
@@ -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
|
|
5
|
-
import
|
|
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
|
|
8
|
-
import
|
|
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:
|
|
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:
|
|
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():
|
|
37
|
-
withZone(zone: TimeZoneId):
|
|
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;
|
|
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;AAChD,OA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AAG,GAAI,SAAS,iBAAiB,EAAE,UAAU,SAAS,CAAC,YAAY,KAAG,aAElF,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,SAAS,iBAAiB,EAAE,UAAU,SAAS,CAAC,YAAY,KAAG,aAEvF,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,SAAS,iBAAiB,EAAE,OAAO,iBAAiB,KAAG,SAAS,CAAC,QAEtF,CAAA;AAED,eAAO,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
|
|
4
|
-
import
|
|
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
|
|
7
|
-
import
|
|
8
|
-
import
|
|
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
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
var Namespace = createNamespace("plain-date-time");
|
|
17
|
-
function
|
|
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
|
|
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 =
|
|
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 =
|
|
55
|
+
var now = (zone, clock = Clocks.Default) => {
|
|
57
56
|
return fromInstant(clock.instant(), zone);
|
|
58
57
|
};
|
|
59
58
|
var merge = (element, builder) => {
|
|
60
|
-
return
|
|
59
|
+
return from3(element).with(builder);
|
|
61
60
|
};
|
|
62
61
|
var add = (element, duration) => {
|
|
63
|
-
return
|
|
62
|
+
return from3(element).add(Durations.from(duration));
|
|
64
63
|
};
|
|
65
64
|
var subtract = (element, duration) => {
|
|
66
|
-
return
|
|
65
|
+
return from3(element).subtract(Durations.from(duration));
|
|
67
66
|
};
|
|
68
67
|
var until = (element, other) => {
|
|
69
|
-
return
|
|
68
|
+
return from3(element).until(from3(other));
|
|
70
69
|
};
|
|
71
70
|
var round = (element, unit) => {
|
|
72
|
-
return
|
|
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(
|
|
77
|
+
return EqualBy(from3(element), from3(other));
|
|
79
78
|
}
|
|
80
79
|
var isBefore = (element, other) => {
|
|
81
|
-
return CompareBy(
|
|
80
|
+
return CompareBy(from3(element), from3(other)) < 0;
|
|
82
81
|
};
|
|
83
82
|
var isAfter = (element, other) => {
|
|
84
|
-
return CompareBy(
|
|
83
|
+
return CompareBy(from3(element), from3(other)) > 0;
|
|
85
84
|
};
|
|
86
85
|
var format = (element, locale, options) => {
|
|
87
|
-
const plainDateTime =
|
|
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
|
|
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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d,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
|
|
5
|
-
import
|
|
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
|
|
8
|
-
import
|
|
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:
|
|
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:
|
|
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():
|
|
38
|
-
withZone(zone: TimeZoneId):
|
|
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;
|
|
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;AAChD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,WAAW,MAAM,yCAAyC,CAAA;AAGtE,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,MAAM,MAAM,sCAAsC,CAAA;AAC9D,OAAO,KAAK,SAAS,MAAM,yCAAyC,CAAA;AACpE,OAAO,KAAK,QAAQ,MAAM,wCAAwC,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAA;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE1D,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;AAC1C,eAAO,MAAM,SAAS,8CAA6C,CAAA;AACnE,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,CAAA;AACpE,MAAM,MAAM,gBAAg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AAG,QAAQ,GAAG,SAAS,CAAA;IACjD,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;IACxC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;IACvE,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,aAAa,EAAE,QAAQ,MAAM,EAAE,SAAS,iBAAiB,KAAG,MAW3F,CAAA"}
|
|
@@ -1,91 +1,89 @@
|
|
|
1
1
|
// src/temporal/plain-date.ts
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
7
|
-
import
|
|
8
|
-
import
|
|
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
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
var Namespace = createNamespace("plain-date");
|
|
17
|
-
function
|
|
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");
|
|
16
|
+
function from3(value) {
|
|
17
|
+
if (Objects.isNil(value)) {
|
|
19
18
|
return value;
|
|
20
19
|
}
|
|
21
20
|
if (value instanceof Temporal.PlainDate) {
|
|
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.PlainDate.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.PlainDate.from(value));
|
|
32
|
+
return Results.success(Temporal.PlainDate.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
|
|
41
|
+
return Instants.from(instant).toZonedDateTimeISO(zone).toPlainDate();
|
|
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 =
|
|
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 =
|
|
55
|
+
var now = (zone, clock = Clocks.Default) => {
|
|
57
56
|
return fromInstant(clock.instant(), zone);
|
|
58
57
|
};
|
|
59
58
|
var merge = (element, builder) => {
|
|
60
|
-
return
|
|
59
|
+
return from3(element).with(builder);
|
|
61
60
|
};
|
|
62
61
|
var add = (element, duration) => {
|
|
63
|
-
return
|
|
62
|
+
return from3(element).add(Durations.from(duration));
|
|
64
63
|
};
|
|
65
64
|
var subtract = (element, duration) => {
|
|
66
|
-
return
|
|
65
|
+
return from3(element).subtract(Durations.from(duration));
|
|
67
66
|
};
|
|
68
67
|
var until = (element, other) => {
|
|
69
|
-
return
|
|
68
|
+
return from3(element).until(from3(other));
|
|
70
69
|
};
|
|
71
70
|
function isEqual(element, other) {
|
|
72
|
-
if (isNil(element) || isNil(other)) {
|
|
71
|
+
if (Objects.isNil(element) || Objects.isNil(other)) {
|
|
73
72
|
return element === other;
|
|
74
73
|
}
|
|
75
|
-
return EqualBy(
|
|
74
|
+
return EqualBy(from3(element), from3(other));
|
|
76
75
|
}
|
|
77
76
|
var isBefore = (element, other) => {
|
|
78
|
-
return CompareBy(
|
|
77
|
+
return CompareBy(from3(element), from3(other)) < 0;
|
|
79
78
|
};
|
|
80
79
|
var isAfter = (element, other) => {
|
|
81
|
-
return CompareBy(
|
|
80
|
+
return CompareBy(from3(element), from3(other)) > 0;
|
|
82
81
|
};
|
|
83
82
|
var format = (element, locale, options) => {
|
|
84
|
-
const plainDate =
|
|
83
|
+
const plainDate = from3(element);
|
|
85
84
|
const date = new Date(
|
|
86
85
|
plainDate.year,
|
|
87
86
|
plainDate.month - 1,
|
|
88
|
-
// Date months are 0-based
|
|
89
87
|
plainDate.day
|
|
90
88
|
);
|
|
91
89
|
const formatter = new Intl.DateTimeFormat(locale, options);
|
|
@@ -99,7 +97,7 @@ export {
|
|
|
99
97
|
SchemaLiteral,
|
|
100
98
|
add,
|
|
101
99
|
format,
|
|
102
|
-
from,
|
|
100
|
+
from3 as from,
|
|
103
101
|
fromInstant,
|
|
104
102
|
isAfter,
|
|
105
103
|
isBefore,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/temporal/plain-date.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill'\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/temporal/plain-date.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 * as Strings from '@bessemer/cornerstone/string'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport { Locale } from '@bessemer/cornerstone/intl/locale'\n\nexport type PlainDate = Temporal.PlainDate\nexport const Namespace = ResourceKeys.createNamespace('plain-date')\nexport type PlainDateLiteral = NominalType<string, typeof Namespace>\nexport type PlainDateBuilder = {\n year: number\n month: number\n day: number\n}\n\nexport type PlainDateLike = PlainDate | PlainDateLiteral | PlainDateBuilder\n\nexport function from(value: PlainDateLike | string): PlainDate\nexport function from(value: PlainDateLike | string | null): PlainDate | null\nexport function from(value: PlainDateLike | string | undefined): PlainDate | undefined\nexport function from(value: PlainDateLike | string | null | undefined): PlainDate | null | undefined\nexport function from(value: PlainDateLike | string | null | undefined): PlainDate | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n\n if (value instanceof Temporal.PlainDate) {\n return value\n }\n\n if (Strings.isString(value)) {\n return ErrorEvents.unpackResult(parseString(value))\n }\n\n return Temporal.PlainDate.from(value)\n}\n\nexport const CompareBy: Comparator<PlainDate> = (first: PlainDate, second: PlainDate): number => Temporal.PlainDateTime.compare(first, second)\nexport const EqualBy = Equalitors.fromComparator(CompareBy)\n\nexport const parseString = (value: string): Results.Result<PlainDate, ErrorEvents.ErrorEvent> => {\n try {\n return Results.success(Temporal.PlainDate.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): PlainDate => {\n return Instants.from(instant).toZonedDateTimeISO(zone).toPlainDate()\n}\n\nexport function toLiteral(likeValue: PlainDateLike): PlainDateLiteral\nexport function toLiteral(likeValue: PlainDateLike | null): PlainDateLiteral | null\nexport function toLiteral(likeValue: PlainDateLike | undefined): PlainDateLiteral | undefined\nexport function toLiteral(likeValue: PlainDateLike | null | undefined): PlainDateLiteral | null | undefined\nexport function toLiteral(likeValue: PlainDateLike | null | undefined): PlainDateLiteral | null | undefined {\n if (Objects.isNil(likeValue)) {\n return likeValue\n }\n\n const value = from(likeValue)\n return value.toString() as PlainDateLiteral\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 PlainDate => {\n return value instanceof Temporal.PlainDateTime\n}\n\nexport const now = (zone: TimeZoneId, clock = Clocks.Default): PlainDate => {\n return fromInstant(clock.instant(), zone)\n}\n\nexport const merge = (element: PlainDateLike, builder: Partial<PlainDateBuilder>): PlainDate => {\n return from(element).with(builder)\n}\n\nexport const add = (element: PlainDateLike, duration: Durations.DurationLike): PlainDate => {\n return from(element).add(Durations.from(duration))\n}\n\nexport const subtract = (element: PlainDateLike, duration: Durations.DurationLike): PlainDate => {\n return from(element).subtract(Durations.from(duration))\n}\n\nexport const until = (element: PlainDateLike, other: PlainDateLike): Durations.Duration => {\n return from(element).until(from(other))\n}\n\nexport function isEqual(element: PlainDateLike, other: PlainDateLike): boolean\nexport function isEqual(element: PlainDateLike | null, other: PlainDateLike | null): boolean\nexport function isEqual(element: PlainDateLike | undefined, other: PlainDateLike | undefined): boolean\nexport function isEqual(element: PlainDateLike | null | undefined, other: PlainDateLike | 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: PlainDateLike, other: PlainDate): boolean => {\n return CompareBy(from(element), from(other)) < 0\n}\n\nexport const isAfter = (element: PlainDateLike, other: PlainDate): boolean => {\n return CompareBy(from(element), from(other)) > 0\n}\n\nexport type DateFormatOptions = {\n era?: 'long' | 'short' | 'narrow' | undefined\n weekday?: 'long' | 'short' | 'narrow' | undefined\n year?: 'numeric' | '2-digit' | undefined\n month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' | undefined\n day?: 'numeric' | '2-digit' | undefined\n}\n\nexport const format = (element: PlainDateLike, locale: Locale, options: DateFormatOptions): string => {\n const plainDate = from(element)\n\n const date = new Date(\n plainDate.year,\n plainDate.month - 1,\n plainDate.day\n )\n\n const formatter = new Intl.DateTimeFormat(locale, options)\n return formatter.format(date)\n}\n"],"mappings":";AAAA,SAAS,gBAA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,QAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,OAAO;AACzD,SAAO,UAAU,OAAO,IAAI;AAC9B;","names":["from","it"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
|
|
3
|
+
import { NominalType } from '@bessemer/cornerstone/types';
|
|
4
|
+
import { Comparator } from '@bessemer/cornerstone/comparator';
|
|
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';
|
|
8
|
+
import Zod from 'zod';
|
|
9
|
+
export type PlainMonthDay = Temporal.PlainMonthDay;
|
|
10
|
+
export declare const Namespace: ResourceKeys.ResourceNamespace<"plain-month-day">;
|
|
11
|
+
export type PlainMonthDayLiteral = NominalType<string, typeof Namespace>;
|
|
12
|
+
export type PlainMonthDayBuilder = {
|
|
13
|
+
month: number;
|
|
14
|
+
day: number;
|
|
15
|
+
};
|
|
16
|
+
export type PlainMonthDayLike = PlainMonthDay | PlainMonthDayLiteral | PlainMonthDayBuilder;
|
|
17
|
+
export declare function from(value: PlainMonthDayLike | string): PlainMonthDay;
|
|
18
|
+
export declare function from(value: PlainMonthDayLike | string | null): PlainMonthDay | null;
|
|
19
|
+
export declare function from(value: PlainMonthDayLike | string | undefined): PlainMonthDay | undefined;
|
|
20
|
+
export declare function from(value: PlainMonthDayLike | string | null | undefined): PlainMonthDay | null | undefined;
|
|
21
|
+
export declare const CompareBy: Comparator<PlainMonthDay>;
|
|
22
|
+
export declare const EqualBy: Equalitors.Equalitor<Temporal.PlainMonthDay>;
|
|
23
|
+
export declare const parseString: (value: string) => Results.Result<PlainMonthDay, ErrorEvents.ErrorEvent>;
|
|
24
|
+
export declare function toLiteral(likeValue: PlainMonthDayLike): PlainMonthDayLiteral;
|
|
25
|
+
export declare function toLiteral(likeValue: PlainMonthDayLike | null): PlainMonthDayLiteral | null;
|
|
26
|
+
export declare function toLiteral(likeValue: PlainMonthDayLike | undefined): PlainMonthDayLiteral | undefined;
|
|
27
|
+
export declare function toLiteral(likeValue: PlainMonthDayLike | null | undefined): PlainMonthDayLiteral | null | undefined;
|
|
28
|
+
export declare const SchemaLiteral: Zod.ZodPipe<Zod.ZodString, Zod.ZodTransform<PlainMonthDayLiteral, string>>;
|
|
29
|
+
export declare const SchemaInstance: Zod.ZodPipe<Zod.ZodString, Zod.ZodTransform<Temporal.PlainMonthDay, string>>;
|
|
30
|
+
export declare const isPlainMonthDay: (value: unknown) => value is PlainMonthDay;
|
|
31
|
+
export declare const merge: (element: PlainMonthDayLike, builder: Partial<PlainMonthDayBuilder>) => PlainMonthDay;
|
|
32
|
+
export declare function isEqual(element: PlainMonthDayLike, other: PlainMonthDayLike): boolean;
|
|
33
|
+
export declare function isEqual(element: PlainMonthDayLike | null, other: PlainMonthDayLike | null): boolean;
|
|
34
|
+
export declare function isEqual(element: PlainMonthDayLike | undefined, other: PlainMonthDayLike | undefined): boolean;
|
|
35
|
+
export declare const isBefore: (element: PlainMonthDayLike, other: PlainMonthDayLike) => boolean;
|
|
36
|
+
export declare const isAfter: (element: PlainMonthDayLike, other: PlainMonthDayLike) => boolean;
|
|
37
|
+
//# sourceMappingURL=plain-month-day.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-month-day.d.ts","sourceRoot":"","sources":["../../src/temporal/plain-month-day.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,OAA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