@bessemer/cornerstone 0.5.114 → 0.5.116
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/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 +10 -0
- 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.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/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 -21
- 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 +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipv4-address.d.ts","sourceRoot":"","sources":["../../src/net/ipv4-address.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ipv4-address.d.ts","sourceRoot":"","sources":["../../src/net/ipv4-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AAGpE,eAAO,MAAM,SAAS,gDAA+C,CAAA;AACrE,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,CAAA;AAI/D,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAAM,CAAC,WAAW,EAAE,UAAU,CAWzE,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,KAAG,WAEpC,CAAA;AAED,eAAO,MAAM,MAAM,iMAA0E,CAAA"}
|
package/dist/net/ipv4-address.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
// src/net/ipv4-address.ts
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
var Namespace = createNamespace("ipv4-address");
|
|
2
|
+
import * as Results from "@bessemer/cornerstone/result";
|
|
3
|
+
import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
|
|
4
|
+
import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
|
|
5
|
+
import * as ZodUtil from "@bessemer/cornerstone/zod-util";
|
|
6
|
+
var Namespace = ResourceKeys.createNamespace("ipv4-address");
|
|
8
7
|
var regex = /^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/;
|
|
9
8
|
var parseString = (value) => {
|
|
10
9
|
if (!regex.test(value)) {
|
|
11
|
-
return failure(
|
|
12
|
-
invalidValue(value, {
|
|
10
|
+
return Results.failure(
|
|
11
|
+
ErrorEvents.invalidValue(value, {
|
|
13
12
|
namespace: Namespace,
|
|
14
13
|
message: `[${Namespace}]: Invalid characters for IpV4Address in string: [${value}]`
|
|
15
14
|
})
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
|
-
return success(value);
|
|
17
|
+
return Results.success(value);
|
|
19
18
|
};
|
|
20
19
|
var from = (value) => {
|
|
21
|
-
return unpackResult(parseString(value));
|
|
20
|
+
return ErrorEvents.unpackResult(parseString(value));
|
|
22
21
|
};
|
|
23
|
-
var Schema = structuredTransform(
|
|
22
|
+
var Schema = ZodUtil.structuredTransform(ZodUtil.string(), parseString);
|
|
24
23
|
export {
|
|
25
24
|
Namespace,
|
|
26
25
|
Schema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/net/ipv4-address.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/net/ipv4-address.ts"],"sourcesContent":["import { NominalType } from '@bessemer/cornerstone/types'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { Result } from '@bessemer/cornerstone/result'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport { ErrorEvent } from '@bessemer/cornerstone/error/error-event'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\n\nexport const Namespace = ResourceKeys.createNamespace('ipv4-address')\nexport type IpV4Address = NominalType<string, typeof Namespace>\n\nconst regex = /^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$/\n\nexport const parseString = (value: string): Result<IpV4Address, ErrorEvent> => {\n if (!regex.test(value)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for IpV4Address in string: [${value}]`,\n })\n )\n }\n\n return Results.success(value as IpV4Address)\n}\n\nexport const from = (value: string): IpV4Address => {\n return ErrorEvents.unpackResult(parseString(value))\n}\n\nexport const Schema = ZodUtil.structuredTransform<IpV4Address>(ZodUtil.string(), parseString)\n"],"mappings":";AACA,YAAY,aAAa;AAEzB,YAAY,kBAAkB;AAC9B,YAAY,iBAAiB;AAE7B,YAAY,aAAa;AAElB,IAAM,YAAyB,6BAAgB,cAAc;AAGpE,IAAM,QAAQ;AAEP,IAAM,cAAc,CAAC,UAAmD;AAC7E,MAAI,CAAC,MAAM,KAAK,KAAK,GAAG;AACtB,WAAe;AAAA,MACD,yBAAa,OAAO;AAAA,QAC9B,WAAW;AAAA,QACX,SAAS,IAAI,SAAS,qDAAqD,KAAK;AAAA,MAClF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAe,gBAAQ,KAAoB;AAC7C;AAEO,IAAM,OAAO,CAAC,UAA+B;AAClD,SAAmB,yBAAa,YAAY,KAAK,CAAC;AACpD;AAEO,IAAM,SAAiB,4BAAyC,eAAO,GAAG,WAAW;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Zod from 'zod';
|
|
2
1
|
import { NominalType } from '@bessemer/cornerstone/types';
|
|
3
2
|
import { Result } from '@bessemer/cornerstone/result';
|
|
3
|
+
import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
|
|
4
4
|
import { ErrorEvent } from '@bessemer/cornerstone/error/error-event';
|
|
5
|
-
export declare const Namespace:
|
|
5
|
+
export declare const Namespace: ResourceKeys.ResourceNamespace<"ipv6-address">;
|
|
6
6
|
export type IpV6Address = NominalType<string, typeof Namespace>;
|
|
7
7
|
export declare const parseString: (value: string) => Result<IpV6Address, ErrorEvent>;
|
|
8
8
|
export declare const from: (value: string) => IpV6Address;
|
|
9
|
-
export declare const Schema:
|
|
9
|
+
export declare const Schema: import("zod").ZodPipe<import("zod").ZodType<IpV6Address, IpV6Address, import("zod/v4/core").$ZodTypeInternals<IpV6Address, IpV6Address>>, import("zod").ZodTransform<IpV6Address, IpV6Address>>;
|
|
10
10
|
//# sourceMappingURL=ipv6-address.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipv6-address.d.ts","sourceRoot":"","sources":["../../src/net/ipv6-address.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ipv6-address.d.ts","sourceRoot":"","sources":["../../src/net/ipv6-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AAGpE,eAAO,MAAM,SAAS,gDAA+C,CAAA;AACrE,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,CAAA;AAK/D,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAAM,CAAC,WAAW,EAAE,UAAU,CAWzE,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,KAAG,WAEpC,CAAA;AAED,eAAO,MAAM,MAAM,iMAA0E,CAAA"}
|
package/dist/net/ipv6-address.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
// src/net/ipv6-address.ts
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
var Namespace = createNamespace("ipv6-address");
|
|
2
|
+
import * as Results from "@bessemer/cornerstone/result";
|
|
3
|
+
import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
|
|
4
|
+
import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
|
|
5
|
+
import * as ZodUtil from "@bessemer/cornerstone/zod-util";
|
|
6
|
+
var Namespace = ResourceKeys.createNamespace("ipv6-address");
|
|
8
7
|
var regex = /^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|[a-fA-F\d]{1,4}:(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|:(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:))(?:%[0-9a-zA-Z]+)?$/;
|
|
9
8
|
var parseString = (value) => {
|
|
10
9
|
if (!regex.test(value)) {
|
|
11
|
-
return failure(
|
|
12
|
-
invalidValue(value, {
|
|
10
|
+
return Results.failure(
|
|
11
|
+
ErrorEvents.invalidValue(value, {
|
|
13
12
|
namespace: Namespace,
|
|
14
13
|
message: `[${Namespace}]: Invalid characters for IpV6Address in string: [${value}]`
|
|
15
14
|
})
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
|
-
return success(value);
|
|
17
|
+
return Results.success(value);
|
|
19
18
|
};
|
|
20
19
|
var from = (value) => {
|
|
21
|
-
return unpackResult(parseString(value));
|
|
20
|
+
return ErrorEvents.unpackResult(parseString(value));
|
|
22
21
|
};
|
|
23
|
-
var Schema = structuredTransform(
|
|
22
|
+
var Schema = ZodUtil.structuredTransform(ZodUtil.string(), parseString);
|
|
24
23
|
export {
|
|
25
24
|
Namespace,
|
|
26
25
|
Schema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/net/ipv6-address.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/net/ipv6-address.ts"],"sourcesContent":["import { NominalType } from '@bessemer/cornerstone/types'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { Result } from '@bessemer/cornerstone/result'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport { ErrorEvent } from '@bessemer/cornerstone/error/error-event'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\n\nexport const Namespace = ResourceKeys.createNamespace('ipv6-address')\nexport type IpV6Address = NominalType<string, typeof Namespace>\n\nconst regex =\n /^(?:(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|[a-fA-F\\d]{1,4}:(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|:(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))(?:%[0-9a-zA-Z]+)?$/\n\nexport const parseString = (value: string): Result<IpV6Address, ErrorEvent> => {\n if (!regex.test(value)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for IpV6Address in string: [${value}]`,\n })\n )\n }\n\n return Results.success(value as IpV6Address)\n}\n\nexport const from = (value: string): IpV6Address => {\n return ErrorEvents.unpackResult(parseString(value))\n}\n\nexport const Schema = ZodUtil.structuredTransform<IpV6Address>(ZodUtil.string(), parseString)\n"],"mappings":";AACA,YAAY,aAAa;AAEzB,YAAY,kBAAkB;AAC9B,YAAY,iBAAiB;AAE7B,YAAY,aAAa;AAElB,IAAM,YAAyB,6BAAgB,cAAc;AAGpE,IAAM,QACJ;AAEK,IAAM,cAAc,CAAC,UAAmD;AAC7E,MAAI,CAAC,MAAM,KAAK,KAAK,GAAG;AACtB,WAAe;AAAA,MACD,yBAAa,OAAO;AAAA,QAC9B,WAAW;AAAA,QACX,SAAS,IAAI,SAAS,qDAAqD,KAAK;AAAA,MAClF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAe,gBAAQ,KAAoB;AAC7C;AAEO,IAAM,OAAO,CAAC,UAA+B;AAClD,SAAmB,yBAAa,YAAY,KAAK,CAAC;AACpD;AAEO,IAAM,SAAiB,4BAAyC,eAAO,GAAG,WAAW;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
|
|
2
2
|
import { ErrorEvent } from '@bessemer/cornerstone/error/error-event';
|
|
3
3
|
import { DomainName } from '@bessemer/cornerstone/net/domain-name';
|
|
4
4
|
import { IpV4Address } from '@bessemer/cornerstone/net/ipv4-address';
|
|
5
5
|
import { IpV6Address } from '@bessemer/cornerstone/net/ipv6-address';
|
|
6
6
|
import { Result } from '@bessemer/cornerstone/result';
|
|
7
|
-
export declare const Namespace:
|
|
7
|
+
export declare const Namespace: ResourceKeys.ResourceNamespace<"uri-host-name">;
|
|
8
8
|
export type UriHostName = DomainName | IpV4Address | `[${IpV6Address}]`;
|
|
9
9
|
export declare const parseString: (value: string) => Result<UriHostName, ErrorEvent>;
|
|
10
10
|
export declare const from: (value: string) => UriHostName;
|
|
11
|
-
export declare const Schema:
|
|
11
|
+
export declare const Schema: import("zod").ZodPipe<import("zod").ZodType<UriHostName, UriHostName, import("zod/v4/core").$ZodTypeInternals<UriHostName, UriHostName>>, import("zod").ZodTransform<UriHostName, UriHostName>>;
|
|
12
12
|
//# sourceMappingURL=uri-host-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uri-host-name.d.ts","sourceRoot":"","sources":["../../src/net/uri-host-name.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"uri-host-name.d.ts","sourceRoot":"","sources":["../../src/net/uri-host-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAGpE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,eAAO,MAAM,SAAS,iDAAgD,CAAA;AACtE,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI,WAAW,GAAG,CAAA;AAEvE,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAAM,CAAC,WAAW,EAAE,UAAU,CAuBzE,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,KAAG,WAEpC,CAAA;AAED,eAAO,MAAM,MAAM,iMAA0E,CAAA"}
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
// src/net/uri-host-name.ts
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { parseString as parseIpV6Address } from "@bessemer/cornerstone/net/ipv6-address";
|
|
2
|
+
import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
|
|
3
|
+
import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
|
|
4
|
+
import * as ZodUtil from "@bessemer/cornerstone/zod-util";
|
|
5
|
+
import * as DomainNames from "@bessemer/cornerstone/net/domain-name";
|
|
6
|
+
import * as IpV4Addresses from "@bessemer/cornerstone/net/ipv4-address";
|
|
7
|
+
import * as IpV6Addresses from "@bessemer/cornerstone/net/ipv6-address";
|
|
9
8
|
import * as Strings from "@bessemer/cornerstone/string";
|
|
10
9
|
import * as Results from "@bessemer/cornerstone/result";
|
|
11
|
-
var Namespace = createNamespace("uri-host-name");
|
|
12
|
-
var
|
|
10
|
+
var Namespace = ResourceKeys.createNamespace("uri-host-name");
|
|
11
|
+
var parseString4 = (value) => {
|
|
13
12
|
if (value.startsWith("[") && value.endsWith("]")) {
|
|
14
|
-
const ipV6Address =
|
|
13
|
+
const ipV6Address = IpV6Addresses.parseString(Strings.removeEnd(Strings.removeStart(value, "["), "]"));
|
|
15
14
|
if (Results.isSuccess(ipV6Address)) {
|
|
16
15
|
return Results.success(`[${ipV6Address}]`);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
const domainName =
|
|
18
|
+
const domainName = DomainNames.parseString(value);
|
|
20
19
|
if (Results.isSuccess(domainName)) {
|
|
21
20
|
return domainName;
|
|
22
21
|
}
|
|
23
|
-
const ipV4Address =
|
|
22
|
+
const ipV4Address = IpV4Addresses.parseString(value);
|
|
24
23
|
if (Results.isSuccess(ipV4Address)) {
|
|
25
24
|
return ipV4Address;
|
|
26
25
|
}
|
|
27
26
|
return Results.failure(
|
|
28
|
-
invalidValue(value, {
|
|
27
|
+
ErrorEvents.invalidValue(value, {
|
|
29
28
|
namespace: Namespace,
|
|
30
29
|
message: `[${Namespace}]: Invalid characters for UriHostName in string: [${value}]`
|
|
31
30
|
})
|
|
32
31
|
);
|
|
33
32
|
};
|
|
34
33
|
var from = (value) => {
|
|
35
|
-
return unpackResult(
|
|
34
|
+
return ErrorEvents.unpackResult(parseString4(value));
|
|
36
35
|
};
|
|
37
|
-
var Schema = structuredTransform(
|
|
36
|
+
var Schema = ZodUtil.structuredTransform(ZodUtil.string(), parseString4);
|
|
38
37
|
export {
|
|
39
38
|
Namespace,
|
|
40
39
|
Schema,
|
|
41
40
|
from,
|
|
42
|
-
parseString
|
|
41
|
+
parseString4 as parseString
|
|
43
42
|
};
|
|
44
43
|
//# sourceMappingURL=uri-host-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/net/uri-host-name.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/net/uri-host-name.ts"],"sourcesContent":["import * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport { ErrorEvent } from '@bessemer/cornerstone/error/error-event'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport * as DomainNames from '@bessemer/cornerstone/net/domain-name'\nimport { DomainName } from '@bessemer/cornerstone/net/domain-name'\nimport * as IpV4Addresses from '@bessemer/cornerstone/net/ipv4-address'\nimport { IpV4Address } from '@bessemer/cornerstone/net/ipv4-address'\nimport * as IpV6Addresses from '@bessemer/cornerstone/net/ipv6-address'\nimport { IpV6Address } from '@bessemer/cornerstone/net/ipv6-address'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { Result } from '@bessemer/cornerstone/result'\n\nexport const Namespace = ResourceKeys.createNamespace('uri-host-name')\nexport type UriHostName = DomainName | IpV4Address | `[${IpV6Address}]`\n\nexport const parseString = (value: string): Result<UriHostName, ErrorEvent> => {\n if (value.startsWith('[') && value.endsWith(']')) {\n const ipV6Address = IpV6Addresses.parseString(Strings.removeEnd(Strings.removeStart(value, '['), ']'))\n if (Results.isSuccess(ipV6Address)) {\n return Results.success(`[${ipV6Address}]` as UriHostName)\n }\n }\n\n const domainName = DomainNames.parseString(value)\n if (Results.isSuccess(domainName)) {\n return domainName\n }\n const ipV4Address = IpV4Addresses.parseString(value)\n if (Results.isSuccess(ipV4Address)) {\n return ipV4Address\n }\n\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriHostName in string: [${value}]`,\n })\n )\n}\n\nexport const from = (value: string): UriHostName => {\n return ErrorEvents.unpackResult(parseString(value))\n}\n\nexport const Schema = ZodUtil.structuredTransform<UriHostName>(ZodUtil.string(), parseString)\n"],"mappings":";AAAA,YAAY,kBAAkB;AAC9B,YAAY,iBAAiB;AAE7B,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAE7B,YAAY,mBAAmB;AAE/B,YAAY,mBAAmB;AAE/B,YAAY,aAAa;AACzB,YAAY,aAAa;AAGlB,IAAM,YAAyB,6BAAgB,eAAe;AAG9D,IAAMA,eAAc,CAAC,UAAmD;AAC7E,MAAI,MAAM,WAAW,GAAG,KAAK,MAAM,SAAS,GAAG,GAAG;AAChD,UAAM,cAA4B,0BAAoB,kBAAkB,oBAAY,OAAO,GAAG,GAAG,GAAG,CAAC;AACrG,QAAY,kBAAU,WAAW,GAAG;AAClC,aAAe,gBAAQ,IAAI,WAAW,GAAkB;AAAA,IAC1D;AAAA,EACF;AAEA,QAAM,aAAyB,wBAAY,KAAK;AAChD,MAAY,kBAAU,UAAU,GAAG;AACjC,WAAO;AAAA,EACT;AACA,QAAM,cAA4B,0BAAY,KAAK;AACnD,MAAY,kBAAU,WAAW,GAAG;AAClC,WAAO;AAAA,EACT;AAEA,SAAe;AAAA,IACD,yBAAa,OAAO;AAAA,MAC9B,WAAW;AAAA,MACX,SAAS,IAAI,SAAS,qDAAqD,KAAK;AAAA,IAClF,CAAC;AAAA,EACH;AACF;AAEO,IAAM,OAAO,CAAC,UAA+B;AAClD,SAAmB,yBAAaA,aAAY,KAAK,CAAC;AACpD;AAEO,IAAM,SAAiB,4BAAyC,eAAO,GAAGA,YAAW;","names":["parseString"]}
|
package/dist/net/uri.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { NominalType, TaggedType } from '@bessemer/cornerstone/types';
|
|
|
2
2
|
import * as ResourceKeys from '@bessemer/cornerstone/resource-key';
|
|
3
3
|
import { Result } from '@bessemer/cornerstone/result';
|
|
4
4
|
import { ErrorEvent } from '@bessemer/cornerstone/error/error-event';
|
|
5
|
-
import Zod from 'zod';
|
|
6
5
|
import { ValueOf } from 'type-fest';
|
|
7
6
|
import { Equalitor } from '@bessemer/cornerstone/equalitor';
|
|
8
7
|
import { UriHostName } from '@bessemer/cornerstone/net/uri-host-name';
|
|
@@ -149,7 +148,7 @@ export declare function toLiteral(likeValue: UriLike): UriLiteral;
|
|
|
149
148
|
export declare function toLiteral(likeValue: UriLike | null): UriLiteral | null;
|
|
150
149
|
export declare function toLiteral(likeValue: UriLike | undefined): UriLiteral | undefined;
|
|
151
150
|
export declare function toLiteral(likeValue: UriLike | null | undefined): UriLiteral | null | undefined;
|
|
152
|
-
export declare const SchemaLiteral:
|
|
151
|
+
export declare const SchemaLiteral: import("zod").ZodPipe<import("zod").ZodType<UriLiteral, UriLiteral, import("zod/v4/core").$ZodTypeInternals<UriLiteral, UriLiteral>>, import("zod").ZodTransform<UriLiteral, UriLiteral>>;
|
|
153
152
|
export declare const empty: () => Uri;
|
|
154
153
|
/**
|
|
155
154
|
* Tests if the provided value is a Uri.
|
package/dist/net/uri.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../../src/net/uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAKrE,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../../src/net/uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAKrE,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AAGpE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAErE,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AACvD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,MAAM,MAAM,SAAS,GAAG,MAA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,8 +5,7 @@ import * as Arrays from "@bessemer/cornerstone/array";
|
|
|
5
5
|
import * as ResourceKeys from "@bessemer/cornerstone/resource-key";
|
|
6
6
|
import * as Results from "@bessemer/cornerstone/result";
|
|
7
7
|
import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
|
|
8
|
-
import
|
|
9
|
-
import Zod from "zod";
|
|
8
|
+
import * as ZodUtil from "@bessemer/cornerstone/zod-util";
|
|
10
9
|
import * as IpV6Addresses from "@bessemer/cornerstone/net/ipv6-address";
|
|
11
10
|
import * as Equalitors from "@bessemer/cornerstone/equalitor";
|
|
12
11
|
import * as UriHostNames from "@bessemer/cornerstone/net/uri-host-name";
|
|
@@ -77,7 +76,10 @@ function toLiteral(likeValue) {
|
|
|
77
76
|
const value = from2(likeValue);
|
|
78
77
|
return format(value);
|
|
79
78
|
}
|
|
80
|
-
var SchemaLiteral = structuredTransform(
|
|
79
|
+
var SchemaLiteral = ZodUtil.structuredTransform(
|
|
80
|
+
ZodUtil.string(),
|
|
81
|
+
(it) => Results.map(parseString3(it), (it2) => toLiteral(it2))
|
|
82
|
+
);
|
|
81
83
|
var empty = () => {
|
|
82
84
|
return {
|
|
83
85
|
_type: Namespace,
|
package/dist/net/uri.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/net/uri.ts"],"sourcesContent":["import { NominalType, TaggedType } from '@bessemer/cornerstone/types'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport { StringSplitResult } from '@bessemer/cornerstone/string'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { Result } from '@bessemer/cornerstone/result'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport { ErrorEvent } from '@bessemer/cornerstone/error/error-event'\nimport { structuredTransform } from '@bessemer/cornerstone/zod-util'\nimport Zod from 'zod'\nimport * as IpV6Addresses from '@bessemer/cornerstone/net/ipv6-address'\nimport { ValueOf } from 'type-fest'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport { Equalitor } from '@bessemer/cornerstone/equalitor'\nimport * as UriHostNames from '@bessemer/cornerstone/net/uri-host-name'\nimport { UriHostName } from '@bessemer/cornerstone/net/uri-host-name'\n\nexport type UriString = TaggedType<string, 'UriString'>\nexport type UriComponent = string\n\nexport type UriScheme = string\n\nexport type UriAuthentication = {\n principal: string\n password: string | null\n}\n\nexport type UriHost = {\n value: UriHostName\n port: number | null\n}\n\nexport interface UriLocation {\n path: string | null\n query: string | null\n fragment: string | null\n}\n\nexport const Namespace = ResourceKeys.createNamespace('uri')\nexport const UrlNamespace = ResourceKeys.createNamespace('url')\nexport const EqualBy: Equalitor<Uri> = Equalitors.deepNatural()\n\nexport type UriLiteral = NominalType<string, typeof Namespace>\n\nexport interface UriStructure {\n _type: typeof Namespace | typeof UrlNamespace\n scheme: UriScheme | null\n host: UriHost | null\n authentication: UriAuthentication | null\n location: UriLocation\n}\n\nexport interface Uri extends UriStructure {\n href: UriLiteral\n}\n\ntype UriBuilderAuthentication =\n | {\n principal: string\n password?: string | null\n }\n | string\n\ntype UriBuilderHost =\n | {\n value: string\n port?: number | null\n }\n | string\n\ntype UriBuilderLocation =\n | {\n path?: string | null\n query?: string | null\n fragment?: string | null\n }\n | string\n\nexport type UriBuilder = {\n scheme?: string | null | undefined\n authentication?: UriBuilderAuthentication | null | undefined\n host?: UriBuilderHost | null | undefined\n location?: UriBuilderLocation | null | undefined\n}\n\nexport type UriLike = Uri | UriLiteral | UriBuilder\n\n/**\n * Parses a string into a Uri object, handling all URI components including scheme,\n * authority (host and authentication), and location (path, query, fragment).\n * Returns a Result containing either the parsed Uri or an ErrorEvent on failure.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Parse a complete HTTPS URI\n * const result = Uris.parseString('https://user:pass@example.com:8080/api/v1?q=test#section')\n * if (result.isSuccess) {\n * console.log(result.value.scheme) // 'https'\n * console.log(result.value.host?.value) // 'example.com'\n * console.log(result.value.authentication?.principal) // 'user'\n * }\n *\n * // Parse a simple URI without authority\n * const urnResult = Uris.parseString('urn:isbn:0451450523')\n * if (urnResult.isSuccess) {\n * console.log(urnResult.value.scheme) // 'urn'\n * console.log(urnResult.value.location.path) // 'isbn:0451450523'\n * }\n * ```\n *\n * @category parsing\n */\nexport const parseString = (value: string, mode: UriParseMode = UriParseMode.Strict): Result<Uri, ErrorEvent> => {\n // JOHN we want to improve the syntax burden of handling a series of Result objects like this\n if (Strings.isBlank(value)) {\n return Results.success(empty())\n }\n\n const schemeResult = parseSchemePart(value)\n if (Results.isFailure(schemeResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Uri from string: [${value}]`,\n causes: schemeResult.value.causes,\n })\n )\n }\n\n const [scheme, rest1] = schemeResult\n\n const authorityPartResult = parseAuthorityPart(rest1, mode)\n if (Results.isFailure(authorityPartResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Uri from string: [${value}]`,\n causes: authorityPartResult.value.causes,\n })\n )\n }\n const [authority, rest2] = authorityPartResult\n\n const location = parseLocation(rest2)\n\n const structure: UriStructure = {\n _type: Namespace,\n scheme,\n host: authority.host,\n authentication: authority.authentication,\n location,\n }\n\n return Results.success({\n ...structure,\n href: formatInternal(structure),\n })\n}\n\nexport const UriParseMode = {\n // Normal href-style url parsing\n Strict: 'strict',\n // Will parse 'www.google.com' as a hostname rather than a path, but loses support for relative urls\n Permissive: 'permissive',\n} as const\nexport type UriParseMode = ValueOf<typeof UriParseMode>\n\n/**\n * Converts various URI-like inputs into a Uri object. Handles Uri instances,\n * string literals, and builder objects, returning them as-is when already a Uri\n * or converting them appropriately.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // String literal parsed into Uri\n * const fromString = Uris.from('https://api.example.com/v1')\n * console.log(fromString.scheme) // 'https'\n * console.log(fromString.host?.value) // 'api.example.com'\n *\n * // Builder object converted to Uri\n * const fromBuilder = Uris.from({\n * scheme: 'https',\n * host: { value: 'example.com', port: 8080 },\n * location: { path: '/api' }\n * })\n * console.log(fromBuilder.host?.port) // 8080\n *\n * @category conversion\n */\nexport function from(value: UriLike | string): Uri\nexport function from(value: UriLike | string | null): Uri | null\nexport function from(value: UriLike | string | undefined): Uri | undefined\nexport function from(value: UriLike | string | null | undefined): Uri | null | undefined\nexport function from(value: UriLike | string | null | undefined): Uri | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n if (isUri(value)) {\n return value\n }\n if (Strings.isString(value)) {\n return ErrorEvents.unpackResult(parseString(value))\n }\n\n return build(value as UriBuilder)\n}\n\n/**\n * Converts various URI-like inputs into a normalized string literal representation.\n * Takes any URI-like value and returns its canonical string form\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Convert Uri instance to string literal\n * const uri = Uris.build({ scheme: 'https', host: 'example.com', location: { path: '/api' } })\n * const literal = Uris.toLiteral(uri)\n * console.log(literal) // \"https://example.com/api\"\n *\n * // Convert builder object to string literal\n * const fromBuilder = Uris.toLiteral({\n * scheme: 'https',\n * host: { value: 'api.example.com', port: 8080 },\n * authentication: { principal: 'user', password: 'pass' },\n * location: { path: '/v1', parameters: { q: 'search' } }\n * })\n * console.log(fromBuilder) // \"https://user:pass@api.example.com:8080/v1?q=search\"\n * ```\n *\n * @category serialization\n */\nexport function toLiteral(likeValue: UriLike): UriLiteral\nexport function toLiteral(likeValue: UriLike | null): UriLiteral | null\nexport function toLiteral(likeValue: UriLike | undefined): UriLiteral | undefined\nexport function toLiteral(likeValue: UriLike | null | undefined): UriLiteral | null | undefined\nexport function toLiteral(likeValue: UriLike | null | undefined): UriLiteral | null | undefined {\n if (Objects.isNil(likeValue)) {\n return likeValue\n }\n\n const value = from(likeValue)\n return format(value) as UriLiteral\n}\n\nexport const SchemaLiteral = structuredTransform(Zod.string(), (it: string) => Results.map(parseString(it), (it) => toLiteral(it)))\n// JOHN need a schema for the object version...\n// export const SchemaInstance = structuredTransform(Zod.string(), parseString)\n\nexport const empty = (): Uri => {\n return {\n _type: Namespace,\n href: '' as UriLiteral,\n scheme: null,\n authentication: null,\n host: null,\n location: {\n path: null,\n query: null,\n fragment: null,\n },\n }\n}\n\n/**\n * Tests if the provided value is a Uri.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Check if unknown value is a Uri\n * function processValue(value: unknown) {\n * if (Uris.isUri(value)) {\n * console.log(value.scheme) // Type-safe access\n * console.log(value.location.path)\n * }\n * }\n * ```\n *\n * @category type-guards\n */\nexport const isUri = (value: unknown): value is Uri => {\n if (!Objects.isObject(value)) {\n return false\n }\n\n const uriValue = value as any as Uri\n return uriValue._type === Namespace || uriValue._type === UrlNamespace\n}\n\n/**\n * Updates an existing URI with partial changes to create a new URI instance.\n * Allows selective updates without replacing the entire URI.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Start with a base URI\n * const baseUri = Uris.build({\n * scheme: 'https',\n * host: { value: 'api.example.com', port: 443 },\n * authentication: { principal: 'user', password: 'pass' },\n * location: { path: '/v1', parameters: { format: 'json' } }\n * })\n *\n * // Change just the host and add query parameter\n * const updatedUri = Uris.update(baseUri, {\n * host: { value: 'api.production.com' }, // Port preserved from original\n * location: {\n * parameters: { version: '2.0' } // Merges with existing parameters\n * }\n * })\n *\n * console.log(updatedUri.host?.value) // 'api.production.com'\n * console.log(updatedUri.host?.port) // 443 (preserved)\n * console.log(updatedUri.location.parameters) // { format: 'json', version: '2.0' }\n * ```\n *\n * @category transformation\n */\nexport const update = (element: UriLike, builder: UriBuilder): Uri => {\n const uri = from(element)\n\n let location: UriBuilderLocation | null | undefined\n if (Strings.isString(builder.location) || Objects.isNull(builder.location)) {\n location = builder.location\n } else {\n location = {\n path: Objects.isUndefined(builder.location?.path) ? uri.location.path : builder.location?.path,\n query: Objects.isUndefined(builder.location?.query) ? uri.location.query : builder.location?.query,\n fragment: Objects.isUndefined(builder.location?.fragment) ? uri.location.fragment : builder.location?.fragment,\n }\n }\n\n const uriBuilder: UriBuilder = {\n scheme: Objects.isUndefined(builder.scheme) ? uri.scheme : builder.scheme,\n host: Objects.isUndefined(builder.host) ? uri.host : builder.host,\n authentication: Objects.isUndefined(builder.authentication) ? uri.authentication : builder.authentication,\n location,\n }\n\n return from(uriBuilder)\n}\n\nexport const merge = (...uris: Array<UriLike>): Uri => {\n if (uris.length === 0) {\n return empty()\n }\n if (uris.length === 1) {\n return from(uris[0]!)\n }\n\n return uris.reduce<Uri>((aggregate, next) => {\n const nextUri = from(next)\n\n const builder: UriBuilder = {\n scheme: nextUri.scheme ?? undefined,\n host: nextUri.host ?? undefined,\n authentication: nextUri.authentication ?? undefined,\n location: {\n path: nextUri.location.path ?? undefined,\n query: nextUri.location.query ?? undefined,\n fragment: nextUri.location.fragment ?? undefined,\n },\n }\n\n const uri = update(aggregate, builder)\n return uri\n }, from(uris[0]!))\n}\n\nconst parseSchemePart = (url: UriComponent): Result<[UriScheme | null, UriComponent], ErrorEvent> => {\n // Search for the colon or double slash\n const schemeMatch = Strings.splitFirst(url, /(\\/\\/|:)/)\n\n // If we don't find either, or we hit the double slash before finding a colon, there is no scheme\n if (Objects.isNil(schemeMatch.selection) || schemeMatch.separator === '//') {\n return Results.success([null, url])\n }\n\n // This means the string started with :, so no protocol\n if (Strings.isEmpty(schemeMatch.selection)) {\n return Results.success([null, ':' + schemeMatch.rest])\n } else {\n const schemeResult = parseScheme(schemeMatch.selection)\n if (Results.isFailure(schemeResult)) {\n return schemeResult\n }\n\n return Results.success([schemeResult, schemeMatch.rest])\n }\n}\n\nconst parseScheme = (scheme: UriComponent): Result<UriScheme, ErrorEvent> => {\n // RFC 3986: scheme = ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n const schemeRegex = /^[a-zA-Z][a-zA-Z0-9+.-]*$/\n if (!schemeRegex.test(scheme)) {\n return Results.failure(\n ErrorEvents.invalidValue(scheme, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters in Scheme.`,\n })\n )\n }\n\n return Results.success(scheme)\n}\n\nconst parseAuthorityPart = (\n initialUrl: UriComponent,\n mode: UriParseMode\n): Result<[{ host: UriHost | null; authentication: UriAuthentication | null }, UriComponent], ErrorEvent> => {\n if (mode === UriParseMode.Strict && !initialUrl.startsWith('//')) {\n return Results.success([{ host: null, authentication: null }, initialUrl])\n }\n if (mode === UriParseMode.Permissive && initialUrl.startsWith('/')) {\n return Results.success([{ host: null, authentication: null }, initialUrl])\n }\n\n const url = Strings.removeStart(initialUrl, '//')\n\n const authenticationPartResult = parseAuthenticationPart(url)\n if (Results.isFailure(authenticationPartResult)) {\n return authenticationPartResult\n }\n const [authentication, rest1] = authenticationPartResult\n\n const hostPartResult = parseHostPart(rest1)\n if (Results.isFailure(hostPartResult)) {\n return hostPartResult\n }\n const [host, rest2] = hostPartResult\n\n return Results.success([{ host, authentication }, rest2])\n}\n\nconst parseAuthenticationPart = (url: UriComponent): Result<[UriAuthentication | null, UriComponent], ErrorEvent> => {\n let targetPart = url\n const queryMatch = Strings.splitFirst(targetPart, '?')\n const fragmentMatch = Strings.splitFirst(targetPart, '#')\n if (Objects.isPresent(queryMatch.selection)) {\n targetPart = queryMatch.selection\n } else if (Objects.isPresent(fragmentMatch.selection)) {\n targetPart = fragmentMatch.selection\n }\n\n const { selection: authentication } = Strings.splitFirst(targetPart, '@')\n\n // If there is no @, then we don't have an authentication\n if (Objects.isNil(authentication)) {\n return Results.success([null, url])\n }\n\n const { rest } = Strings.splitFirst(url, '@')\n\n const authenticationParseResult = parseAuthentication(authentication)\n if (Results.isFailure(authenticationParseResult)) {\n return authenticationParseResult\n }\n\n return Results.success([authenticationParseResult, rest])\n}\n\nconst parseAuthentication = (authentication: UriComponent): Result<UriAuthentication, ErrorEvent> => {\n const { selection: principal, rest: authenticationRest } = Strings.splitFirst(authentication, ':')\n\n // If there isn't a colon, then there is no password but there is a username\n if (Objects.isNil(principal)) {\n if (!isAuthenticationComponentValid(authenticationRest)) {\n return Results.failure(\n ErrorEvents.invalidValue(authenticationRest, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in principal string: [${authenticationRest}]`,\n })\n )\n }\n\n return Results.success({ principal: decode(authenticationRest), password: null })\n }\n\n // The authentication section started with a :, don't know what to make of this... password but no username?\n if (Strings.isEmpty(principal)) {\n return Results.failure(\n ErrorEvents.invalidValue(authentication, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse UriAuthentication from authentication string: [${authentication}]`,\n })\n )\n }\n\n if (!isAuthenticationComponentValid(principal)) {\n return Results.failure(\n ErrorEvents.invalidValue(principal, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in principal string: [${principal}]`,\n })\n )\n }\n\n if (!isAuthenticationComponentValid(authenticationRest)) {\n return Results.failure(\n ErrorEvents.invalidValue(authenticationRest, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in password string: [${authenticationRest}]`,\n })\n )\n }\n\n // Otherwise, we have both, so return the complete authentication object and the rest\n return Results.success({ principal: decode(principal), password: decode(authenticationRest) })\n}\n\nconst isAuthenticationComponentValid = (component: UriComponent): boolean => {\n const userinfoRegex = /^[A-Za-z0-9\\-._~!$&'()*+,;=%]*$/\n\n if (component.includes('%')) {\n const percentEncodingRegex = /%[0-9A-Fa-f]{2}/g\n const percentMatches = component.match(/%/g) || []\n const validEncodingMatches = component.match(percentEncodingRegex) || []\n\n if (percentMatches.length !== validEncodingMatches.length) {\n return false\n }\n }\n\n return userinfoRegex.test(component)\n}\n\nconst parseHostPart = (url: UriComponent): Result<[UriHost | null, UriComponent], ErrorEvent> => {\n // Check if the host is starting with reserved characters, if so we should just bail on trying to parse\n if (url.startsWith('?') || url.startsWith('#')) {\n return Results.success([null, url])\n }\n\n // Lets grab everything to the left of the first / ? or #, this is the remainder of our authority (if any)\n const urlMatch = Strings.splitFirst(url, /[\\/?#]/)\n let host = urlMatch.rest\n let rest = ''\n\n if (Objects.isPresent(urlMatch.selection)) {\n host = urlMatch.selection\n rest = urlMatch.separator + urlMatch.rest\n }\n\n if (Strings.isEmpty(host)) {\n return Results.success([null, rest])\n }\n\n const parseHostResult = parseHost(host)\n if (Results.isFailure(parseHostResult)) {\n return parseHostResult\n }\n\n return Results.success([parseHostResult, rest])\n}\n\nconst parseHost = (host: UriComponent): Result<UriHost, ErrorEvent> => {\n // Try to see if we have an ipv6 address like the form [2001:db8::7] and handle it\n if (host.startsWith('[')) {\n const ipMatch = Strings.splitFirst(Strings.removeStart(host, '['), ']')\n\n if (Objects.isPresent(ipMatch.selection)) {\n const ipV6Result = IpV6Addresses.parseString(ipMatch.selection)\n if (Results.isFailure(ipV6Result)) {\n return ipV6Result\n }\n\n const portMatch = Strings.splitFirst(ipMatch.rest, ':')\n if (Objects.isPresent(portMatch.selection) && Strings.isEmpty(portMatch.selection)) {\n if (!Strings.isNumber(portMatch.rest)) {\n return Results.failure(ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host: [${host}]` }))\n }\n\n return Results.success({ value: `[${ipMatch.selection}]` as UriHostName, port: Number(portMatch.rest) })\n } else {\n return Results.success({ value: `[${ipMatch.selection}]` as UriHostName, port: null })\n }\n }\n }\n\n let hostMatch: StringSplitResult = Strings.splitFirst(host, ':')\n\n // We have no :, which means no port, so treat the rest as the hostname\n if (Objects.isNil(hostMatch.selection)) {\n const hostNameResult = UriHostNames.parseString(hostMatch.rest)\n if (Results.isFailure(hostNameResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Host from host string: [${host}]`,\n causes: hostNameResult.value.causes,\n })\n )\n }\n\n return Results.success({ value: hostNameResult, port: null })\n }\n\n // The host started with a :, this is odd\n if (Strings.isEmpty(hostMatch.selection)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host from host string: [${host}]` })\n )\n }\n\n const hostName = hostMatch.selection\n\n if (!Strings.isNumber(hostMatch.rest)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host from host string: [${host}]` })\n )\n }\n\n // Otherwise, we have both, so return the complete authentication object and the rest\n const hostNameResult = UriHostNames.parseString(hostName)\n if (Results.isFailure(hostNameResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Host from host string: [${host}]`,\n causes: hostNameResult.value.causes,\n })\n )\n }\n\n return Results.success({ value: hostNameResult, port: Number(hostMatch.rest) })\n}\n\nconst parseLocation = (url: UriComponent): UriLocation => {\n const location: UriLocation = { path: null, query: null, fragment: null }\n\n // Lets see if we have a fragment and parse it off the end\n const fragmentMatch = Strings.splitFirst(url, '#')\n if (Objects.isPresent(fragmentMatch.selection) && !Strings.isEmpty(fragmentMatch.rest)) {\n location.fragment = encodeWhitespace(fragmentMatch.rest)\n }\n\n // Lets see if we have a query string and parse it off the remainder\n const queryMatch = Strings.splitFirst(fragmentMatch.selection ?? fragmentMatch.rest, '?')\n if (Objects.isPresent(queryMatch.selection) && !Strings.isEmpty(queryMatch.rest)) {\n location.query = encodeWhitespace(queryMatch.rest)\n }\n\n const path = Strings.emptyToNull(queryMatch.selection ?? queryMatch.rest)\n if (Objects.isPresent(path)) {\n location.path = encodeWhitespace(path)\n }\n return location\n}\n\nconst build = (builder: UriBuilder): Uri => {\n const scheme = Objects.isPresent(builder.scheme) ? ErrorEvents.unpackResult(parseScheme(builder.scheme)) : null\n let host: UriHost | null = null\n let authentication: UriAuthentication | null = null\n\n if (Objects.isPresent(builder.host)) {\n if (Strings.isString(builder.host)) {\n host = ErrorEvents.unpackResult(parseHost(builder.host))\n } else {\n host = {\n value: UriHostNames.from(builder.host.value),\n port: builder.host.port ?? null,\n }\n }\n\n if (Objects.isPresent(builder.authentication)) {\n if (Strings.isString(builder.authentication)) {\n authentication = ErrorEvents.unpackResult(parseAuthentication(builder.authentication))\n } else {\n authentication = {\n principal: builder.authentication.principal,\n password: builder.authentication.password ?? null,\n }\n }\n }\n }\n\n let location: UriLocation = {\n path: null,\n query: null,\n fragment: null,\n }\n\n if (Objects.isPresent(builder.location)) {\n if (Strings.isString(builder.location)) {\n let locationString = builder.location\n if (Objects.isPresent(builder.host) && !locationString.startsWith('/') && !locationString.startsWith('?') && !locationString.startsWith('#')) {\n locationString = '/' + locationString\n }\n\n location = parseLocation(locationString)\n } else {\n let path = builder.location.path ?? null\n if (Objects.isPresent(path) && !path.startsWith('/') && Objects.isPresent(builder.host)) {\n path = '/' + path\n }\n\n location = {\n path: Objects.isPresent(path) ? encodeWhitespace(path) : null,\n query: Objects.isPresent(builder.location.query) ? encodeWhitespace(builder.location.query) : null,\n fragment: Objects.isPresent(builder.location.fragment) ? encodeWhitespace(builder.location.fragment) : null,\n }\n }\n }\n\n const structure: UriStructure = {\n _type: Namespace,\n scheme,\n host,\n authentication,\n location,\n }\n\n return {\n ...structure,\n href: formatInternal(structure),\n }\n}\n\nexport const UriComponentType = {\n Scheme: 'Scheme',\n Authentication: 'Authentication',\n Host: 'Host',\n Location: 'Location',\n Path: 'Path',\n Query: 'Query',\n Fragment: 'Fragment',\n} as const\n\nexport type UriComponentType = ValueOf<typeof UriComponentType>\n\n/**\n * Converts a URI object into its string representation, with optional exclusion of specific URI components.\n *\n * **Example**\n *\n * ```ts\n * import { Uris, UriComponentType } from \"@bessemer/cornerstone\"\n *\n * const uri = Uris.build({\n * scheme: 'https',\n * authentication: { principal: 'user', password: 'secret' },\n * host: { value: 'api.example.com', port: 8080 },\n * location: { path: '/v1/data', parameters: { format: 'json' }, fragment: 'results' }\n * })\n *\n * // Format complete URI\n * const fullUri = Uris.format(uri)\n * console.log(fullUri) // \"https://user:secret@api.example.com:8080/v1/data?format=json#results\"\n *\n * // Exclude authentication for public sharing\n * const publicUri = Uris.format(uri, [UriComponentType.Authentication])\n * console.log(publicUri) // \"https://api.example.com:8080/v1/data?format=json#results\"\n *\n * // Format path-only URI\n * const pathOnly = Uris.format(uri, [\n * UriComponentType.Scheme,\n * UriComponentType.Host,\n * UriComponentType.Authentication\n * ])\n * console.log(pathOnly) // \"/v1/data?format=json#results\"\n * ```\n *\n * @category serialization\n */\nexport const format = (uriLike: UriLike, excludedUriComponents: Array<UriComponentType> = []): UriLiteral => {\n return formatInternal(from(uriLike), excludedUriComponents)\n}\n\nexport const isComplete = (uri: Uri): boolean => {\n return Objects.isPresent(uri.scheme) && Objects.isPresent(uri.host)\n}\n\nconst formatInternal = (uri: UriStructure, excludedUriComponents: Array<UriComponentType> = []): UriLiteral => {\n let urlString = ''\n if (Objects.isPresent(uri.scheme) && !Arrays.contains(excludedUriComponents, UriComponentType.Scheme)) {\n urlString = urlString + uri.scheme + ':'\n }\n\n if (Objects.isPresent(uri.host) && !Arrays.contains(excludedUriComponents, UriComponentType.Host)) {\n urlString = urlString + '//'\n\n if (Objects.isPresent(uri.authentication) && !Arrays.contains(excludedUriComponents, UriComponentType.Authentication)) {\n urlString = urlString + encode(uri.authentication.principal)\n\n if (Objects.isPresent(uri.authentication.password)) {\n urlString = urlString + ':' + encode(uri.authentication.password)\n }\n\n urlString = urlString + '@'\n }\n\n urlString = urlString + uri.host.value\n if (Objects.isPresent(uri.host.port)) {\n urlString = urlString + ':' + uri.host.port\n }\n }\n\n if (!Arrays.contains(excludedUriComponents, UriComponentType.Location)) {\n urlString = urlString + formatLocation(uri.location, excludedUriComponents)\n }\n\n return urlString as UriLiteral\n}\n\nconst formatLocation = (location: UriLocation, excludedUriComponents: Array<UriComponentType> = []): string => {\n let urlString = ''\n\n if (Objects.isPresent(location.path) && !Arrays.contains(excludedUriComponents, UriComponentType.Path)) {\n urlString = urlString + location.path\n }\n\n if (Objects.isPresent(location.query) && !Arrays.contains(excludedUriComponents, UriComponentType.Query)) {\n urlString = urlString + '?' + location.query\n }\n\n if (Objects.isPresent(location.fragment) && !Arrays.contains(excludedUriComponents, UriComponentType.Fragment)) {\n urlString = urlString + '#' + location.fragment\n }\n\n return urlString\n}\n\nconst encodeWhitespace = (uriComponent: UriComponent) => {\n return uriComponent.replaceAll(' ', '%20')\n}\n\nexport const encode = (uriComponent: UriComponent) => {\n return encodeURIComponent(uriComponent)\n}\n\nexport const decode = (uriComponent: UriComponent) => {\n return decodeURIComponent(uriComponent)\n}\n"],"mappings":";AACA,YAAY,aAAa;AAEzB,YAAY,aAAa;AACzB,YAAY,YAAY;AACxB,YAAY,kBAAkB;AAC9B,YAAY,aAAa;AAEzB,YAAY,iBAAiB;AAE7B,SAAS,2BAA2B;AACpC,OAAO,SAAS;AAChB,YAAY,mBAAmB;AAE/B,YAAY,gBAAgB;AAE5B,YAAY,kBAAkB;AAwBvB,IAAM,YAAyB,6BAAgB,KAAK;AACpD,IAAM,eAA4B,6BAAgB,KAAK;AACvD,IAAM,UAAqC,uBAAY;AA2EvD,IAAMA,eAAc,CAAC,OAAe,OAAqB,aAAa,WAAoC;AAE/G,MAAY,gBAAQ,KAAK,GAAG;AAC1B,WAAe,gBAAQ,MAAM,CAAC;AAAA,EAChC;AAEA,QAAM,eAAe,gBAAgB,KAAK;AAC1C,MAAY,kBAAU,YAAY,GAAG;AACnC,WAAe;AAAA,MACD,yBAAa,OAAO;AAAA,QAC9B,WAAW;AAAA,QACX,SAAS,IAAI,SAAS,wCAAwC,KAAK;AAAA,QACnE,QAAQ,aAAa,MAAM;AAAA,MAC7B,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,CAAC,QAAQ,KAAK,IAAI;AAExB,QAAM,sBAAsB,mBAAmB,OAAO,IAAI;AAC1D,MAAY,kBAAU,mBAAmB,GAAG;AAC1C,WAAe;AAAA,MACD,yBAAa,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,KAAK,CAAQ,gBAAS,uBAAuB,iBAAiB,QAAQ,GAAG;AAC9G,gBAAY,YAAY,MAAM,SAAS;AAAA,EACzC;AAEA,SAAO;AACT;AAEA,IAAM,mBAAmB,CAAC,iBAA+B;AACvD,SAAO,aAAa,WAAW,KAAK,KAAK;AAC3C;AAEO,IAAM,SAAS,CAAC,iBAA+B;AACpD,SAAO,mBAAmB,YAAY;AACxC;AAEO,IAAM,SAAS,CAAC,iBAA+B;AACpD,SAAO,mBAAmB,YAAY;AACxC;","names":["parseString","from","it","hostNameResult"]}
|
|
1
|
+
{"version":3,"sources":["../../src/net/uri.ts"],"sourcesContent":["import { NominalType, TaggedType } from '@bessemer/cornerstone/types'\nimport * as Strings from '@bessemer/cornerstone/string'\nimport { StringSplitResult } from '@bessemer/cornerstone/string'\nimport * as Objects from '@bessemer/cornerstone/object'\nimport * as Arrays from '@bessemer/cornerstone/array'\nimport * as ResourceKeys from '@bessemer/cornerstone/resource-key'\nimport * as Results from '@bessemer/cornerstone/result'\nimport { Result } from '@bessemer/cornerstone/result'\nimport * as ErrorEvents from '@bessemer/cornerstone/error/error-event'\nimport { ErrorEvent } from '@bessemer/cornerstone/error/error-event'\nimport * as ZodUtil from '@bessemer/cornerstone/zod-util'\nimport * as IpV6Addresses from '@bessemer/cornerstone/net/ipv6-address'\nimport { ValueOf } from 'type-fest'\nimport * as Equalitors from '@bessemer/cornerstone/equalitor'\nimport { Equalitor } from '@bessemer/cornerstone/equalitor'\nimport * as UriHostNames from '@bessemer/cornerstone/net/uri-host-name'\nimport { UriHostName } from '@bessemer/cornerstone/net/uri-host-name'\n\nexport type UriString = TaggedType<string, 'UriString'>\nexport type UriComponent = string\n\nexport type UriScheme = string\n\nexport type UriAuthentication = {\n principal: string\n password: string | null\n}\n\nexport type UriHost = {\n value: UriHostName\n port: number | null\n}\n\nexport interface UriLocation {\n path: string | null\n query: string | null\n fragment: string | null\n}\n\nexport const Namespace = ResourceKeys.createNamespace('uri')\nexport const UrlNamespace = ResourceKeys.createNamespace('url')\nexport const EqualBy: Equalitor<Uri> = Equalitors.deepNatural()\n\nexport type UriLiteral = NominalType<string, typeof Namespace>\n\nexport interface UriStructure {\n _type: typeof Namespace | typeof UrlNamespace\n scheme: UriScheme | null\n host: UriHost | null\n authentication: UriAuthentication | null\n location: UriLocation\n}\n\nexport interface Uri extends UriStructure {\n href: UriLiteral\n}\n\ntype UriBuilderAuthentication =\n | {\n principal: string\n password?: string | null\n }\n | string\n\ntype UriBuilderHost =\n | {\n value: string\n port?: number | null\n }\n | string\n\ntype UriBuilderLocation =\n | {\n path?: string | null\n query?: string | null\n fragment?: string | null\n }\n | string\n\nexport type UriBuilder = {\n scheme?: string | null | undefined\n authentication?: UriBuilderAuthentication | null | undefined\n host?: UriBuilderHost | null | undefined\n location?: UriBuilderLocation | null | undefined\n}\n\nexport type UriLike = Uri | UriLiteral | UriBuilder\n\n/**\n * Parses a string into a Uri object, handling all URI components including scheme,\n * authority (host and authentication), and location (path, query, fragment).\n * Returns a Result containing either the parsed Uri or an ErrorEvent on failure.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Parse a complete HTTPS URI\n * const result = Uris.parseString('https://user:pass@example.com:8080/api/v1?q=test#section')\n * if (result.isSuccess) {\n * console.log(result.value.scheme) // 'https'\n * console.log(result.value.host?.value) // 'example.com'\n * console.log(result.value.authentication?.principal) // 'user'\n * }\n *\n * // Parse a simple URI without authority\n * const urnResult = Uris.parseString('urn:isbn:0451450523')\n * if (urnResult.isSuccess) {\n * console.log(urnResult.value.scheme) // 'urn'\n * console.log(urnResult.value.location.path) // 'isbn:0451450523'\n * }\n * ```\n *\n * @category parsing\n */\nexport const parseString = (value: string, mode: UriParseMode = UriParseMode.Strict): Result<Uri, ErrorEvent> => {\n // JOHN we want to improve the syntax burden of handling a series of Result objects like this\n if (Strings.isBlank(value)) {\n return Results.success(empty())\n }\n\n const schemeResult = parseSchemePart(value)\n if (Results.isFailure(schemeResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Uri from string: [${value}]`,\n causes: schemeResult.value.causes,\n })\n )\n }\n\n const [scheme, rest1] = schemeResult\n\n const authorityPartResult = parseAuthorityPart(rest1, mode)\n if (Results.isFailure(authorityPartResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(value, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Uri from string: [${value}]`,\n causes: authorityPartResult.value.causes,\n })\n )\n }\n const [authority, rest2] = authorityPartResult\n\n const location = parseLocation(rest2)\n\n const structure: UriStructure = {\n _type: Namespace,\n scheme,\n host: authority.host,\n authentication: authority.authentication,\n location,\n }\n\n return Results.success({\n ...structure,\n href: formatInternal(structure),\n })\n}\n\nexport const UriParseMode = {\n // Normal href-style url parsing\n Strict: 'strict',\n // Will parse 'www.google.com' as a hostname rather than a path, but loses support for relative urls\n Permissive: 'permissive',\n} as const\nexport type UriParseMode = ValueOf<typeof UriParseMode>\n\n/**\n * Converts various URI-like inputs into a Uri object. Handles Uri instances,\n * string literals, and builder objects, returning them as-is when already a Uri\n * or converting them appropriately.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // String literal parsed into Uri\n * const fromString = Uris.from('https://api.example.com/v1')\n * console.log(fromString.scheme) // 'https'\n * console.log(fromString.host?.value) // 'api.example.com'\n *\n * // Builder object converted to Uri\n * const fromBuilder = Uris.from({\n * scheme: 'https',\n * host: { value: 'example.com', port: 8080 },\n * location: { path: '/api' }\n * })\n * console.log(fromBuilder.host?.port) // 8080\n *\n * @category conversion\n */\nexport function from(value: UriLike | string): Uri\nexport function from(value: UriLike | string | null): Uri | null\nexport function from(value: UriLike | string | undefined): Uri | undefined\nexport function from(value: UriLike | string | null | undefined): Uri | null | undefined\nexport function from(value: UriLike | string | null | undefined): Uri | null | undefined {\n if (Objects.isNil(value)) {\n return value\n }\n if (isUri(value)) {\n return value\n }\n if (Strings.isString(value)) {\n return ErrorEvents.unpackResult(parseString(value))\n }\n\n return build(value as UriBuilder)\n}\n\n/**\n * Converts various URI-like inputs into a normalized string literal representation.\n * Takes any URI-like value and returns its canonical string form\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Convert Uri instance to string literal\n * const uri = Uris.build({ scheme: 'https', host: 'example.com', location: { path: '/api' } })\n * const literal = Uris.toLiteral(uri)\n * console.log(literal) // \"https://example.com/api\"\n *\n * // Convert builder object to string literal\n * const fromBuilder = Uris.toLiteral({\n * scheme: 'https',\n * host: { value: 'api.example.com', port: 8080 },\n * authentication: { principal: 'user', password: 'pass' },\n * location: { path: '/v1', parameters: { q: 'search' } }\n * })\n * console.log(fromBuilder) // \"https://user:pass@api.example.com:8080/v1?q=search\"\n * ```\n *\n * @category serialization\n */\nexport function toLiteral(likeValue: UriLike): UriLiteral\nexport function toLiteral(likeValue: UriLike | null): UriLiteral | null\nexport function toLiteral(likeValue: UriLike | undefined): UriLiteral | undefined\nexport function toLiteral(likeValue: UriLike | null | undefined): UriLiteral | null | undefined\nexport function toLiteral(likeValue: UriLike | null | undefined): UriLiteral | null | undefined {\n if (Objects.isNil(likeValue)) {\n return likeValue\n }\n\n const value = from(likeValue)\n return format(value) as UriLiteral\n}\n\nexport const SchemaLiteral = ZodUtil.structuredTransform<UriLiteral>(ZodUtil.string(), (it: string) =>\n Results.map(parseString(it), (it) => toLiteral(it))\n)\n// JOHN need a schema for the object version...\n// export const SchemaInstance = structuredTransform(Zod.string(), parseString)\n\nexport const empty = (): Uri => {\n return {\n _type: Namespace,\n href: '' as UriLiteral,\n scheme: null,\n authentication: null,\n host: null,\n location: {\n path: null,\n query: null,\n fragment: null,\n },\n }\n}\n\n/**\n * Tests if the provided value is a Uri.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Check if unknown value is a Uri\n * function processValue(value: unknown) {\n * if (Uris.isUri(value)) {\n * console.log(value.scheme) // Type-safe access\n * console.log(value.location.path)\n * }\n * }\n * ```\n *\n * @category type-guards\n */\nexport const isUri = (value: unknown): value is Uri => {\n if (!Objects.isObject(value)) {\n return false\n }\n\n const uriValue = value as any as Uri\n return uriValue._type === Namespace || uriValue._type === UrlNamespace\n}\n\n/**\n * Updates an existing URI with partial changes to create a new URI instance.\n * Allows selective updates without replacing the entire URI.\n *\n * **Example**\n *\n * ```ts\n * import { Uris } from \"@bessemer/cornerstone\"\n *\n * // Start with a base URI\n * const baseUri = Uris.build({\n * scheme: 'https',\n * host: { value: 'api.example.com', port: 443 },\n * authentication: { principal: 'user', password: 'pass' },\n * location: { path: '/v1', parameters: { format: 'json' } }\n * })\n *\n * // Change just the host and add query parameter\n * const updatedUri = Uris.update(baseUri, {\n * host: { value: 'api.production.com' }, // Port preserved from original\n * location: {\n * parameters: { version: '2.0' } // Merges with existing parameters\n * }\n * })\n *\n * console.log(updatedUri.host?.value) // 'api.production.com'\n * console.log(updatedUri.host?.port) // 443 (preserved)\n * console.log(updatedUri.location.parameters) // { format: 'json', version: '2.0' }\n * ```\n *\n * @category transformation\n */\nexport const update = (element: UriLike, builder: UriBuilder): Uri => {\n const uri = from(element)\n\n let location: UriBuilderLocation | null | undefined\n if (Strings.isString(builder.location) || Objects.isNull(builder.location)) {\n location = builder.location\n } else {\n location = {\n path: Objects.isUndefined(builder.location?.path) ? uri.location.path : builder.location?.path,\n query: Objects.isUndefined(builder.location?.query) ? uri.location.query : builder.location?.query,\n fragment: Objects.isUndefined(builder.location?.fragment) ? uri.location.fragment : builder.location?.fragment,\n }\n }\n\n const uriBuilder: UriBuilder = {\n scheme: Objects.isUndefined(builder.scheme) ? uri.scheme : builder.scheme,\n host: Objects.isUndefined(builder.host) ? uri.host : builder.host,\n authentication: Objects.isUndefined(builder.authentication) ? uri.authentication : builder.authentication,\n location,\n }\n\n return from(uriBuilder)\n}\n\nexport const merge = (...uris: Array<UriLike>): Uri => {\n if (uris.length === 0) {\n return empty()\n }\n if (uris.length === 1) {\n return from(uris[0]!)\n }\n\n return uris.reduce<Uri>((aggregate, next) => {\n const nextUri = from(next)\n\n const builder: UriBuilder = {\n scheme: nextUri.scheme ?? undefined,\n host: nextUri.host ?? undefined,\n authentication: nextUri.authentication ?? undefined,\n location: {\n path: nextUri.location.path ?? undefined,\n query: nextUri.location.query ?? undefined,\n fragment: nextUri.location.fragment ?? undefined,\n },\n }\n\n const uri = update(aggregate, builder)\n return uri\n }, from(uris[0]!))\n}\n\nconst parseSchemePart = (url: UriComponent): Result<[UriScheme | null, UriComponent], ErrorEvent> => {\n // Search for the colon or double slash\n const schemeMatch = Strings.splitFirst(url, /(\\/\\/|:)/)\n\n // If we don't find either, or we hit the double slash before finding a colon, there is no scheme\n if (Objects.isNil(schemeMatch.selection) || schemeMatch.separator === '//') {\n return Results.success([null, url])\n }\n\n // This means the string started with :, so no protocol\n if (Strings.isEmpty(schemeMatch.selection)) {\n return Results.success([null, ':' + schemeMatch.rest])\n } else {\n const schemeResult = parseScheme(schemeMatch.selection)\n if (Results.isFailure(schemeResult)) {\n return schemeResult\n }\n\n return Results.success([schemeResult, schemeMatch.rest])\n }\n}\n\nconst parseScheme = (scheme: UriComponent): Result<UriScheme, ErrorEvent> => {\n // RFC 3986: scheme = ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n const schemeRegex = /^[a-zA-Z][a-zA-Z0-9+.-]*$/\n if (!schemeRegex.test(scheme)) {\n return Results.failure(\n ErrorEvents.invalidValue(scheme, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters in Scheme.`,\n })\n )\n }\n\n return Results.success(scheme)\n}\n\nconst parseAuthorityPart = (\n initialUrl: UriComponent,\n mode: UriParseMode\n): Result<[{ host: UriHost | null; authentication: UriAuthentication | null }, UriComponent], ErrorEvent> => {\n if (mode === UriParseMode.Strict && !initialUrl.startsWith('//')) {\n return Results.success([{ host: null, authentication: null }, initialUrl])\n }\n if (mode === UriParseMode.Permissive && initialUrl.startsWith('/')) {\n return Results.success([{ host: null, authentication: null }, initialUrl])\n }\n\n const url = Strings.removeStart(initialUrl, '//')\n\n const authenticationPartResult = parseAuthenticationPart(url)\n if (Results.isFailure(authenticationPartResult)) {\n return authenticationPartResult\n }\n const [authentication, rest1] = authenticationPartResult\n\n const hostPartResult = parseHostPart(rest1)\n if (Results.isFailure(hostPartResult)) {\n return hostPartResult\n }\n const [host, rest2] = hostPartResult\n\n return Results.success([{ host, authentication }, rest2])\n}\n\nconst parseAuthenticationPart = (url: UriComponent): Result<[UriAuthentication | null, UriComponent], ErrorEvent> => {\n let targetPart = url\n const queryMatch = Strings.splitFirst(targetPart, '?')\n const fragmentMatch = Strings.splitFirst(targetPart, '#')\n if (Objects.isPresent(queryMatch.selection)) {\n targetPart = queryMatch.selection\n } else if (Objects.isPresent(fragmentMatch.selection)) {\n targetPart = fragmentMatch.selection\n }\n\n const { selection: authentication } = Strings.splitFirst(targetPart, '@')\n\n // If there is no @, then we don't have an authentication\n if (Objects.isNil(authentication)) {\n return Results.success([null, url])\n }\n\n const { rest } = Strings.splitFirst(url, '@')\n\n const authenticationParseResult = parseAuthentication(authentication)\n if (Results.isFailure(authenticationParseResult)) {\n return authenticationParseResult\n }\n\n return Results.success([authenticationParseResult, rest])\n}\n\nconst parseAuthentication = (authentication: UriComponent): Result<UriAuthentication, ErrorEvent> => {\n const { selection: principal, rest: authenticationRest } = Strings.splitFirst(authentication, ':')\n\n // If there isn't a colon, then there is no password but there is a username\n if (Objects.isNil(principal)) {\n if (!isAuthenticationComponentValid(authenticationRest)) {\n return Results.failure(\n ErrorEvents.invalidValue(authenticationRest, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in principal string: [${authenticationRest}]`,\n })\n )\n }\n\n return Results.success({ principal: decode(authenticationRest), password: null })\n }\n\n // The authentication section started with a :, don't know what to make of this... password but no username?\n if (Strings.isEmpty(principal)) {\n return Results.failure(\n ErrorEvents.invalidValue(authentication, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse UriAuthentication from authentication string: [${authentication}]`,\n })\n )\n }\n\n if (!isAuthenticationComponentValid(principal)) {\n return Results.failure(\n ErrorEvents.invalidValue(principal, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in principal string: [${principal}]`,\n })\n )\n }\n\n if (!isAuthenticationComponentValid(authenticationRest)) {\n return Results.failure(\n ErrorEvents.invalidValue(authenticationRest, {\n namespace: Namespace,\n message: `[${Namespace}]: Invalid characters for UriAuthentication in password string: [${authenticationRest}]`,\n })\n )\n }\n\n // Otherwise, we have both, so return the complete authentication object and the rest\n return Results.success({ principal: decode(principal), password: decode(authenticationRest) })\n}\n\nconst isAuthenticationComponentValid = (component: UriComponent): boolean => {\n const userinfoRegex = /^[A-Za-z0-9\\-._~!$&'()*+,;=%]*$/\n\n if (component.includes('%')) {\n const percentEncodingRegex = /%[0-9A-Fa-f]{2}/g\n const percentMatches = component.match(/%/g) || []\n const validEncodingMatches = component.match(percentEncodingRegex) || []\n\n if (percentMatches.length !== validEncodingMatches.length) {\n return false\n }\n }\n\n return userinfoRegex.test(component)\n}\n\nconst parseHostPart = (url: UriComponent): Result<[UriHost | null, UriComponent], ErrorEvent> => {\n // Check if the host is starting with reserved characters, if so we should just bail on trying to parse\n if (url.startsWith('?') || url.startsWith('#')) {\n return Results.success([null, url])\n }\n\n // Lets grab everything to the left of the first / ? or #, this is the remainder of our authority (if any)\n const urlMatch = Strings.splitFirst(url, /[\\/?#]/)\n let host = urlMatch.rest\n let rest = ''\n\n if (Objects.isPresent(urlMatch.selection)) {\n host = urlMatch.selection\n rest = urlMatch.separator + urlMatch.rest\n }\n\n if (Strings.isEmpty(host)) {\n return Results.success([null, rest])\n }\n\n const parseHostResult = parseHost(host)\n if (Results.isFailure(parseHostResult)) {\n return parseHostResult\n }\n\n return Results.success([parseHostResult, rest])\n}\n\nconst parseHost = (host: UriComponent): Result<UriHost, ErrorEvent> => {\n // Try to see if we have an ipv6 address like the form [2001:db8::7] and handle it\n if (host.startsWith('[')) {\n const ipMatch = Strings.splitFirst(Strings.removeStart(host, '['), ']')\n\n if (Objects.isPresent(ipMatch.selection)) {\n const ipV6Result = IpV6Addresses.parseString(ipMatch.selection)\n if (Results.isFailure(ipV6Result)) {\n return ipV6Result\n }\n\n const portMatch = Strings.splitFirst(ipMatch.rest, ':')\n if (Objects.isPresent(portMatch.selection) && Strings.isEmpty(portMatch.selection)) {\n if (!Strings.isNumber(portMatch.rest)) {\n return Results.failure(ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host: [${host}]` }))\n }\n\n return Results.success({ value: `[${ipMatch.selection}]` as UriHostName, port: Number(portMatch.rest) })\n } else {\n return Results.success({ value: `[${ipMatch.selection}]` as UriHostName, port: null })\n }\n }\n }\n\n let hostMatch: StringSplitResult = Strings.splitFirst(host, ':')\n\n // We have no :, which means no port, so treat the rest as the hostname\n if (Objects.isNil(hostMatch.selection)) {\n const hostNameResult = UriHostNames.parseString(hostMatch.rest)\n if (Results.isFailure(hostNameResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Host from host string: [${host}]`,\n causes: hostNameResult.value.causes,\n })\n )\n }\n\n return Results.success({ value: hostNameResult, port: null })\n }\n\n // The host started with a :, this is odd\n if (Strings.isEmpty(hostMatch.selection)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host from host string: [${host}]` })\n )\n }\n\n const hostName = hostMatch.selection\n\n if (!Strings.isNumber(hostMatch.rest)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, { namespace: Namespace, message: `[${Namespace}]: Unable to parse Host from host string: [${host}]` })\n )\n }\n\n // Otherwise, we have both, so return the complete authentication object and the rest\n const hostNameResult = UriHostNames.parseString(hostName)\n if (Results.isFailure(hostNameResult)) {\n return Results.failure(\n ErrorEvents.invalidValue(host, {\n namespace: Namespace,\n message: `[${Namespace}]: Unable to parse Host from host string: [${host}]`,\n causes: hostNameResult.value.causes,\n })\n )\n }\n\n return Results.success({ value: hostNameResult, port: Number(hostMatch.rest) })\n}\n\nconst parseLocation = (url: UriComponent): UriLocation => {\n const location: UriLocation = { path: null, query: null, fragment: null }\n\n // Lets see if we have a fragment and parse it off the end\n const fragmentMatch = Strings.splitFirst(url, '#')\n if (Objects.isPresent(fragmentMatch.selection) && !Strings.isEmpty(fragmentMatch.rest)) {\n location.fragment = encodeWhitespace(fragmentMatch.rest)\n }\n\n // Lets see if we have a query string and parse it off the remainder\n const queryMatch = Strings.splitFirst(fragmentMatch.selection ?? fragmentMatch.rest, '?')\n if (Objects.isPresent(queryMatch.selection) && !Strings.isEmpty(queryMatch.rest)) {\n location.query = encodeWhitespace(queryMatch.rest)\n }\n\n const path = Strings.emptyToNull(queryMatch.selection ?? queryMatch.rest)\n if (Objects.isPresent(path)) {\n location.path = encodeWhitespace(path)\n }\n return location\n}\n\nconst build = (builder: UriBuilder): Uri => {\n const scheme = Objects.isPresent(builder.scheme) ? ErrorEvents.unpackResult(parseScheme(builder.scheme)) : null\n let host: UriHost | null = null\n let authentication: UriAuthentication | null = null\n\n if (Objects.isPresent(builder.host)) {\n if (Strings.isString(builder.host)) {\n host = ErrorEvents.unpackResult(parseHost(builder.host))\n } else {\n host = {\n value: UriHostNames.from(builder.host.value),\n port: builder.host.port ?? null,\n }\n }\n\n if (Objects.isPresent(builder.authentication)) {\n if (Strings.isString(builder.authentication)) {\n authentication = ErrorEvents.unpackResult(parseAuthentication(builder.authentication))\n } else {\n authentication = {\n principal: builder.authentication.principal,\n password: builder.authentication.password ?? null,\n }\n }\n }\n }\n\n let location: UriLocation = {\n path: null,\n query: null,\n fragment: null,\n }\n\n if (Objects.isPresent(builder.location)) {\n if (Strings.isString(builder.location)) {\n let locationString = builder.location\n if (Objects.isPresent(builder.host) && !locationString.startsWith('/') && !locationString.startsWith('?') && !locationString.startsWith('#')) {\n locationString = '/' + locationString\n }\n\n location = parseLocation(locationString)\n } else {\n let path = builder.location.path ?? null\n if (Objects.isPresent(path) && !path.startsWith('/') && Objects.isPresent(builder.host)) {\n path = '/' + path\n }\n\n location = {\n path: Objects.isPresent(path) ? encodeWhitespace(path) : null,\n query: Objects.isPresent(builder.location.query) ? encodeWhitespace(builder.location.query) : null,\n fragment: Objects.isPresent(builder.location.fragment) ? encodeWhitespace(builder.location.fragment) : null,\n }\n }\n }\n\n const structure: UriStructure = {\n _type: Namespace,\n scheme,\n host,\n authentication,\n location,\n }\n\n return {\n ...structure,\n href: formatInternal(structure),\n }\n}\n\nexport const UriComponentType = {\n Scheme: 'Scheme',\n Authentication: 'Authentication',\n Host: 'Host',\n Location: 'Location',\n Path: 'Path',\n Query: 'Query',\n Fragment: 'Fragment',\n} as const\n\nexport type UriComponentType = ValueOf<typeof UriComponentType>\n\n/**\n * Converts a URI object into its string representation, with optional exclusion of specific URI components.\n *\n * **Example**\n *\n * ```ts\n * import { Uris, UriComponentType } from \"@bessemer/cornerstone\"\n *\n * const uri = Uris.build({\n * scheme: 'https',\n * authentication: { principal: 'user', password: 'secret' },\n * host: { value: 'api.example.com', port: 8080 },\n * location: { path: '/v1/data', parameters: { format: 'json' }, fragment: 'results' }\n * })\n *\n * // Format complete URI\n * const fullUri = Uris.format(uri)\n * console.log(fullUri) // \"https://user:secret@api.example.com:8080/v1/data?format=json#results\"\n *\n * // Exclude authentication for public sharing\n * const publicUri = Uris.format(uri, [UriComponentType.Authentication])\n * console.log(publicUri) // \"https://api.example.com:8080/v1/data?format=json#results\"\n *\n * // Format path-only URI\n * const pathOnly = Uris.format(uri, [\n * UriComponentType.Scheme,\n * UriComponentType.Host,\n * UriComponentType.Authentication\n * ])\n * console.log(pathOnly) // \"/v1/data?format=json#results\"\n * ```\n *\n * @category serialization\n */\nexport const format = (uriLike: UriLike, excludedUriComponents: Array<UriComponentType> = []): UriLiteral => {\n return formatInternal(from(uriLike), excludedUriComponents)\n}\n\nexport const isComplete = (uri: Uri): boolean => {\n return Objects.isPresent(uri.scheme) && Objects.isPresent(uri.host)\n}\n\nconst formatInternal = (uri: UriStructure, excludedUriComponents: Array<UriComponentType> = []): UriLiteral => {\n let urlString = ''\n if (Objects.isPresent(uri.scheme) && !Arrays.contains(excludedUriComponents, UriComponentType.Scheme)) {\n urlString = urlString + uri.scheme + ':'\n }\n\n if (Objects.isPresent(uri.host) && !Arrays.contains(excludedUriComponents, UriComponentType.Host)) {\n urlString = urlString + '//'\n\n if (Objects.isPresent(uri.authentication) && !Arrays.contains(excludedUriComponents, UriComponentType.Authentication)) {\n urlString = urlString + encode(uri.authentication.principal)\n\n if (Objects.isPresent(uri.authentication.password)) {\n urlString = urlString + ':' + encode(uri.authentication.password)\n }\n\n urlString = urlString + '@'\n }\n\n urlString = urlString + uri.host.value\n if (Objects.isPresent(uri.host.port)) {\n urlString = urlString + ':' + uri.host.port\n }\n }\n\n if (!Arrays.contains(excludedUriComponents, UriComponentType.Location)) {\n urlString = urlString + formatLocation(uri.location, excludedUriComponents)\n }\n\n return urlString as UriLiteral\n}\n\nconst formatLocation = (location: UriLocation, excludedUriComponents: Array<UriComponentType> = []): string => {\n let urlString = ''\n\n if (Objects.isPresent(location.path) && !Arrays.contains(excludedUriComponents, UriComponentType.Path)) {\n urlString = urlString + location.path\n }\n\n if (Objects.isPresent(location.query) && !Arrays.contains(excludedUriComponents, UriComponentType.Query)) {\n urlString = urlString + '?' + location.query\n }\n\n if (Objects.isPresent(location.fragment) && !Arrays.contains(excludedUriComponents, UriComponentType.Fragment)) {\n urlString = urlString + '#' + location.fragment\n }\n\n return urlString\n}\n\nconst encodeWhitespace = (uriComponent: UriComponent) => {\n return uriComponent.replaceAll(' ', '%20')\n}\n\nexport const encode = (uriComponent: UriComponent) => {\n return encodeURIComponent(uriComponent)\n}\n\nexport const decode = (uriComponent: UriComponent) => {\n return decodeURIComponent(uriComponent)\n}\n"],"mappings":";AACA,YAAY,aAAa;AAEzB,YAAY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uri";
|
|
3
3
|
import { UriParseMode } from "@bessemer/cornerstone/net/uri";
|
|
4
4
|
import * as Results from "@bessemer/cornerstone/result";
|
|
5
|
-
import
|
|
5
|
+
import * as ErrorEvents from "@bessemer/cornerstone/error/error-event";
|
|
6
6
|
import * as Strings from "@bessemer/cornerstone/string";
|
|
7
7
|
import * as Arrays from "@bessemer/cornerstone/array";
|
|
8
|
-
import
|
|
9
|
-
import { structuredTransform } from "@bessemer/cornerstone/zod-util";
|
|
8
|
+
import * as ZodUtil from "@bessemer/cornerstone/zod-util";
|
|
10
9
|
import Zod from "zod";
|
|
11
10
|
import * as Equalitors from "@bessemer/cornerstone/equalitor";
|
|
12
11
|
import * as Objects from "@bessemer/cornerstone/object";
|
|
@@ -28,7 +27,7 @@ function from2(value) {
|
|
|
28
27
|
return fromUri(value);
|
|
29
28
|
}
|
|
30
29
|
if (Strings.isString(value)) {
|
|
31
|
-
return unpackResult(parseString2(value));
|
|
30
|
+
return ErrorEvents.unpackResult(parseString2(value));
|
|
32
31
|
}
|
|
33
32
|
return build(value);
|
|
34
33
|
}
|
|
@@ -39,7 +38,7 @@ function toLiteral(likeValue) {
|
|
|
39
38
|
const value = from2(likeValue);
|
|
40
39
|
return format2(value);
|
|
41
40
|
}
|
|
42
|
-
var SchemaLiteral = structuredTransform(Zod.string(), (it) => Results.map(parseString2(it), (it2) => toLiteral(it2)));
|
|
41
|
+
var SchemaLiteral = ZodUtil.structuredTransform(Zod.string(), (it) => Results.map(parseString2(it), (it2) => toLiteral(it2)));
|
|
43
42
|
var empty2 = () => {
|
|
44
43
|
const result = Uris.empty();
|
|
45
44
|
return {
|
|
@@ -156,7 +155,7 @@ var fromUri = (uri) => {
|
|
|
156
155
|
if (Objects.isPresent(uri.location.query)) {
|
|
157
156
|
uri.location.query.split("&").forEach((parameterPair) => {
|
|
158
157
|
let splitParameters = parameterPair.split("=");
|
|
159
|
-
if (!Strings.isBlank(first(splitParameters))) {
|
|
158
|
+
if (!Strings.isBlank(Arrays.first(splitParameters))) {
|
|
160
159
|
let key = decode2(splitParameters[0]);
|
|
161
160
|
let value = "";
|
|
162
161
|
if (splitParameters.length === 2) {
|
|
@@ -202,7 +201,7 @@ var formatPathSegments = (pathSegments, hasHost, relative) => {
|
|
|
202
201
|
};
|
|
203
202
|
var formatQueryParameters = (parameters) => {
|
|
204
203
|
const parameterEntries = Object.entries(parameters);
|
|
205
|
-
if (
|
|
204
|
+
if (Arrays.isEmpty(parameterEntries)) {
|
|
206
205
|
return null;
|
|
207
206
|
}
|
|
208
207
|
return Object.entries(parameters).flatMap(([key, value]) => {
|