@infra-blocks/zod-utils 0.9.0 → 0.10.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -5
- package/lib/cjs/aws/account-id.d.ts +4 -1
- package/lib/cjs/aws/account-id.js +5 -1
- package/lib/cjs/aws/account-id.js.map +1 -1
- package/lib/cjs/aws/arn.d.ts +4 -1
- package/lib/cjs/aws/arn.js +4 -1
- package/lib/cjs/aws/arn.js.map +1 -1
- package/lib/cjs/aws/partition.d.ts +5 -0
- package/lib/cjs/aws/partition.js.map +1 -1
- package/lib/cjs/aws/region.d.ts +42 -0
- package/lib/cjs/aws/region.js.map +1 -1
- package/lib/cjs/aws/types.d.ts +4 -0
- package/lib/cjs/aws/types.js +3 -0
- package/lib/cjs/aws/types.js.map +1 -0
- package/lib/esm/aws/account-id.d.ts +4 -1
- package/lib/esm/aws/account-id.js +5 -1
- package/lib/esm/aws/account-id.js.map +1 -1
- package/lib/esm/aws/arn.d.ts +4 -1
- package/lib/esm/aws/arn.js +4 -1
- package/lib/esm/aws/arn.js.map +1 -1
- package/lib/esm/aws/partition.d.ts +5 -0
- package/lib/esm/aws/partition.js.map +1 -1
- package/lib/esm/aws/region.d.ts +42 -0
- package/lib/esm/aws/region.js.map +1 -1
- package/lib/esm/aws/types.d.ts +4 -0
- package/lib/esm/aws/types.js +2 -0
- package/lib/esm/aws/types.js.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# ts-zod-utils
|
|
2
2
|
[](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/build.yml)
|
|
3
3
|
[](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/release.yml)
|
|
4
|
-
[](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/update-from-template.yml)
|
|
5
4
|
[](https://codecov.io/gh/infra-blocks/ts-zod-utils)
|
|
6
5
|
|
|
7
6
|
This package exposes various utilities extending the [zod](https://www.npmjs.com/package/zod) package.
|
|
@@ -13,7 +12,7 @@ This package exposes various utilities extending the [zod](https://www.npmjs.com
|
|
|
13
12
|
- [json](#json)
|
|
14
13
|
- [csv](#csv)
|
|
15
14
|
- [typeGuard](#type-guard)
|
|
16
|
-
- [
|
|
15
|
+
- [isValid](#is-valid)
|
|
17
16
|
|
|
18
17
|
### AWS
|
|
19
18
|
|
|
@@ -33,6 +32,25 @@ zu.aws.partition().parse("aws");
|
|
|
33
32
|
zu.aws.region().parse("us-east-1");
|
|
34
33
|
```
|
|
35
34
|
|
|
35
|
+
#### Branded types
|
|
36
|
+
|
|
37
|
+
`aws` utilities that return primitive types are branded. Here is an example with an AWS arn:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { zu } from "@infra-blocks/zod-utils";
|
|
41
|
+
import { AwsArn } from "@infra-blocks/zod-utils/aws";
|
|
42
|
+
|
|
43
|
+
const arn = zu.aws.arn().parse("arn:aws:iam:us-east-1:123456789012:user/joe-cunt"); // The type of arn is AwsArn.
|
|
44
|
+
const splitTokensString = (x: string) => x.split(":");
|
|
45
|
+
// AwsArn is an alias for string & z.$brand<"AwsArn">. All string functionalities are still available.
|
|
46
|
+
splitTokensString(arn);
|
|
47
|
+
const splitTokensArn = (x: AwsArn) => x.split(":");
|
|
48
|
+
// Works as you'd expect.
|
|
49
|
+
splitTokensArn(arn);
|
|
50
|
+
// @ts-expect-error: string is not assignable to AwsArn
|
|
51
|
+
splitTokensArn("arn:aws:iam:us-east-1:123456789012:user/joe-cunt"); // This does not compile, as string is not assignable to AwsArn.
|
|
52
|
+
```
|
|
53
|
+
|
|
36
54
|
### GeoJson
|
|
37
55
|
|
|
38
56
|
The `geojson` module contains utilities to validate GeoJSON objects.
|
|
@@ -285,8 +303,8 @@ not as strong. In our specific case, the type guard would assert that `myString`
|
|
|
285
303
|
despite the fact that it also checked that its length has to be greater than 5. That information
|
|
286
304
|
has been lost.
|
|
287
305
|
|
|
288
|
-
###
|
|
306
|
+
### Is Valid
|
|
289
307
|
|
|
290
|
-
The
|
|
308
|
+
The `isValid` API is very similar to the [type guard](#type-guard) one, except it doesn't bind
|
|
291
309
|
to a schema. The schema is passed as argument. Where you would write `zu.typeGuard(schema)(value)`,
|
|
292
|
-
you instead write `zu.
|
|
310
|
+
you instead write `zu.isValid(schema, value)`. Both behave the same and narrow the result type.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.core.$ZodBranded<z.ZodString, "AwsAccountId">;
|
|
3
|
+
export type AwsAccountId = z.infer<typeof schema>;
|
|
2
4
|
/**
|
|
3
5
|
* Validates that a string is a valid AWS account ID.
|
|
4
6
|
*
|
|
@@ -10,4 +12,5 @@ import { z } from "zod";
|
|
|
10
12
|
*
|
|
11
13
|
* @see https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-identifiers.html
|
|
12
14
|
*/
|
|
13
|
-
export declare function accountId(): z.ZodString
|
|
15
|
+
export declare function accountId(): z.core.$ZodBranded<z.ZodString, "AwsAccountId">;
|
|
16
|
+
export {};
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.accountId = accountId;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const schema = zod_1.z
|
|
5
|
+
const schema = zod_1.z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(zod_1.z.regexes.integer)
|
|
8
|
+
.length(12)
|
|
9
|
+
.brand("AwsAccountId");
|
|
6
10
|
/**
|
|
7
11
|
* Validates that a string is a valid AWS account ID.
|
|
8
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-id.js","sourceRoot":"","sources":["../../../src/aws/account-id.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"account-id.js","sourceRoot":"","sources":["../../../src/aws/account-id.ts"],"names":[],"mappings":";;AAqBA,8BAEC;AAvBD,6BAAwB;AAExB,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,EAAE;KACR,KAAK,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;KACxB,MAAM,CAAC,EAAE,CAAC;KACV,KAAK,CAAC,cAAc,CAAC,CAAC;AAIzB;;;;;;;;;;GAUG;AACH,SAAgB,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/cjs/aws/arn.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.core.$ZodBranded<z.ZodString, "AwsArn">;
|
|
3
|
+
export type AwsArn = z.infer<typeof schema>;
|
|
2
4
|
/**
|
|
3
5
|
* Validates that a string is a valid AWS ARN.
|
|
4
6
|
*
|
|
@@ -15,4 +17,5 @@ import { z } from "zod";
|
|
|
15
17
|
*
|
|
16
18
|
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html
|
|
17
19
|
*/
|
|
18
|
-
export declare function arn(): z.ZodString
|
|
20
|
+
export declare function arn(): z.core.$ZodBranded<z.ZodString, "AwsArn">;
|
|
21
|
+
export {};
|
package/lib/cjs/aws/arn.js
CHANGED
|
@@ -32,7 +32,10 @@ function isValid(arn) {
|
|
|
32
32
|
}
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
-
const schema = zod_1.z
|
|
35
|
+
const schema = zod_1.z
|
|
36
|
+
.string()
|
|
37
|
+
.refine(isValid, { error: "invalid AWS ARN" })
|
|
38
|
+
.brand("AwsArn");
|
|
36
39
|
/**
|
|
37
40
|
* Validates that a string is a valid AWS ARN.
|
|
38
41
|
*
|
package/lib/cjs/aws/arn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/aws/arn.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/aws/arn.ts"],"names":[],"mappings":";;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G,OAAC;KACb,MAAM,EAAE;KACR,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;KAC7C,KAAK,CAAC,QAAQ,CAAC,CAAC;AAInB;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,GAAG;IACjB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.ZodEnum<{
|
|
3
|
+
[x: string]: string;
|
|
4
|
+
}>;
|
|
5
|
+
export type AwsPartition = z.infer<typeof schema>;
|
|
2
6
|
/**
|
|
3
7
|
* Validates that a string is a valid AWS partition.
|
|
4
8
|
*
|
|
@@ -12,3 +16,4 @@ import { z } from "zod";
|
|
|
12
16
|
export declare function partition(): z.ZodEnum<{
|
|
13
17
|
[x: string]: string;
|
|
14
18
|
}>;
|
|
19
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/aws/partition.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/aws/partition.ts"],"names":[],"mappings":";;AAkBA,8BAEC;AApBD,6BAAwB;AAExB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAEvD,MAAM,MAAM,GAAG,OAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAItC;;;;;;;;;GASG;AACH,SAAgB,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/cjs/aws/region.d.ts
CHANGED
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.ZodEnum<{
|
|
3
|
+
"us-east-1": "us-east-1";
|
|
4
|
+
"us-east-2": "us-east-2";
|
|
5
|
+
"us-west-1": "us-west-1";
|
|
6
|
+
"us-west-2": "us-west-2";
|
|
7
|
+
"af-south-1": "af-south-1";
|
|
8
|
+
"ap-east-1": "ap-east-1";
|
|
9
|
+
"ap-east-2": "ap-east-2";
|
|
10
|
+
"ap-south-1": "ap-south-1";
|
|
11
|
+
"ap-south-2": "ap-south-2";
|
|
12
|
+
"ap-southeast-1": "ap-southeast-1";
|
|
13
|
+
"ap-southeast-2": "ap-southeast-2";
|
|
14
|
+
"ap-southeast-3": "ap-southeast-3";
|
|
15
|
+
"ap-southeast-4": "ap-southeast-4";
|
|
16
|
+
"ap-southeast-5": "ap-southeast-5";
|
|
17
|
+
"ap-southeast-6": "ap-southeast-6";
|
|
18
|
+
"ap-southeast-7": "ap-southeast-7";
|
|
19
|
+
"ap-northeast-1": "ap-northeast-1";
|
|
20
|
+
"ap-northeast-2": "ap-northeast-2";
|
|
21
|
+
"ap-northeast-3": "ap-northeast-3";
|
|
22
|
+
"ca-central-1": "ca-central-1";
|
|
23
|
+
"ca-west-1": "ca-west-1";
|
|
24
|
+
"cn-north-1": "cn-north-1";
|
|
25
|
+
"cn-northwest-1": "cn-northwest-1";
|
|
26
|
+
"eu-central-1": "eu-central-1";
|
|
27
|
+
"eu-central-2": "eu-central-2";
|
|
28
|
+
"eu-west-1": "eu-west-1";
|
|
29
|
+
"eu-west-2": "eu-west-2";
|
|
30
|
+
"eu-west-3": "eu-west-3";
|
|
31
|
+
"eu-south-1": "eu-south-1";
|
|
32
|
+
"eu-south-2": "eu-south-2";
|
|
33
|
+
"eu-north-1": "eu-north-1";
|
|
34
|
+
"il-central-1": "il-central-1";
|
|
35
|
+
"mx-central-1": "mx-central-1";
|
|
36
|
+
"me-central-1": "me-central-1";
|
|
37
|
+
"me-south-1": "me-south-1";
|
|
38
|
+
"sa-east-1": "sa-east-1";
|
|
39
|
+
"us-gov-east-1": "us-gov-east-1";
|
|
40
|
+
"us-gov-west-1": "us-gov-west-1";
|
|
41
|
+
}>;
|
|
42
|
+
export type AwsRegion = z.infer<typeof schema>;
|
|
2
43
|
/**
|
|
3
44
|
* Validates that a string is a valid AWS region.
|
|
4
45
|
*
|
|
@@ -47,3 +88,4 @@ export declare function region(): z.ZodEnum<{
|
|
|
47
88
|
"us-gov-east-1": "us-gov-east-1";
|
|
48
89
|
"us-gov-west-1": "us-gov-west-1";
|
|
49
90
|
}>;
|
|
91
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../../src/aws/region.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../../src/aws/region.ts"],"names":[],"mappings":";;AAuDA,wBAEC;AAzDD,6BAAwB;AAExB,MAAM,WAAW,GAAG;IAClB,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,eAAe;IACf,eAAe;CACP,CAAC;AAEX,MAAM,MAAM,GAAG,OAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAInC;;;;;;;GAOG;AACH,SAAgB,MAAM;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/aws/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.core.$ZodBranded<z.ZodString, "AwsAccountId">;
|
|
3
|
+
export type AwsAccountId = z.infer<typeof schema>;
|
|
2
4
|
/**
|
|
3
5
|
* Validates that a string is a valid AWS account ID.
|
|
4
6
|
*
|
|
@@ -10,4 +12,5 @@ import { z } from "zod";
|
|
|
10
12
|
*
|
|
11
13
|
* @see https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-identifiers.html
|
|
12
14
|
*/
|
|
13
|
-
export declare function accountId(): z.ZodString
|
|
15
|
+
export declare function accountId(): z.core.$ZodBranded<z.ZodString, "AwsAccountId">;
|
|
16
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-id.js","sourceRoot":"","sources":["../../../src/aws/account-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"account-id.js","sourceRoot":"","sources":["../../../src/aws/account-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,CAAC;KACb,MAAM,EAAE;KACR,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;KACxB,MAAM,CAAC,EAAE,CAAC;KACV,KAAK,CAAC,cAAc,CAAC,CAAC;AAIzB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/esm/aws/arn.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.core.$ZodBranded<z.ZodString, "AwsArn">;
|
|
3
|
+
export type AwsArn = z.infer<typeof schema>;
|
|
2
4
|
/**
|
|
3
5
|
* Validates that a string is a valid AWS ARN.
|
|
4
6
|
*
|
|
@@ -15,4 +17,5 @@ import { z } from "zod";
|
|
|
15
17
|
*
|
|
16
18
|
* @see https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html
|
|
17
19
|
*/
|
|
18
|
-
export declare function arn(): z.ZodString
|
|
20
|
+
export declare function arn(): z.core.$ZodBranded<z.ZodString, "AwsArn">;
|
|
21
|
+
export {};
|
package/lib/esm/aws/arn.js
CHANGED
|
@@ -29,7 +29,10 @@ function isValid(arn) {
|
|
|
29
29
|
}
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
|
-
const schema = z
|
|
32
|
+
const schema = z
|
|
33
|
+
.string()
|
|
34
|
+
.refine(isValid, { error: "invalid AWS ARN" })
|
|
35
|
+
.brand("AwsArn");
|
|
33
36
|
/**
|
|
34
37
|
* Validates that a string is a valid AWS ARN.
|
|
35
38
|
*
|
package/lib/esm/aws/arn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arn.js","sourceRoot":"","sources":["../../../src/aws/arn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,SAAS,OAAO,CAAC,GAAW;IAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,+BAA+B;IAC/B,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACpB,O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AI,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,+BAA+B;IAC/B,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wBAAwB;IACxB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4BAA4B;IAC5B,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oCAAoC;IACpC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,MAAM,GAAG,CAAC;KACb,MAAM,EAAE;KACR,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;KAC7C,KAAK,CAAC,QAAQ,CAAC,CAAC;AAInB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.ZodEnum<{
|
|
3
|
+
[x: string]: string;
|
|
4
|
+
}>;
|
|
5
|
+
export type AwsPartition = z.infer<typeof schema>;
|
|
2
6
|
/**
|
|
3
7
|
* Validates that a string is a valid AWS partition.
|
|
4
8
|
*
|
|
@@ -12,3 +16,4 @@ import { z } from "zod";
|
|
|
12
16
|
export declare function partition(): z.ZodEnum<{
|
|
13
17
|
[x: string]: string;
|
|
14
18
|
}>;
|
|
19
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/aws/partition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAEvD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"partition.js","sourceRoot":"","sources":["../../../src/aws/partition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAEvD,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAItC;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/esm/aws/region.d.ts
CHANGED
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const schema: z.ZodEnum<{
|
|
3
|
+
"us-east-1": "us-east-1";
|
|
4
|
+
"us-east-2": "us-east-2";
|
|
5
|
+
"us-west-1": "us-west-1";
|
|
6
|
+
"us-west-2": "us-west-2";
|
|
7
|
+
"af-south-1": "af-south-1";
|
|
8
|
+
"ap-east-1": "ap-east-1";
|
|
9
|
+
"ap-east-2": "ap-east-2";
|
|
10
|
+
"ap-south-1": "ap-south-1";
|
|
11
|
+
"ap-south-2": "ap-south-2";
|
|
12
|
+
"ap-southeast-1": "ap-southeast-1";
|
|
13
|
+
"ap-southeast-2": "ap-southeast-2";
|
|
14
|
+
"ap-southeast-3": "ap-southeast-3";
|
|
15
|
+
"ap-southeast-4": "ap-southeast-4";
|
|
16
|
+
"ap-southeast-5": "ap-southeast-5";
|
|
17
|
+
"ap-southeast-6": "ap-southeast-6";
|
|
18
|
+
"ap-southeast-7": "ap-southeast-7";
|
|
19
|
+
"ap-northeast-1": "ap-northeast-1";
|
|
20
|
+
"ap-northeast-2": "ap-northeast-2";
|
|
21
|
+
"ap-northeast-3": "ap-northeast-3";
|
|
22
|
+
"ca-central-1": "ca-central-1";
|
|
23
|
+
"ca-west-1": "ca-west-1";
|
|
24
|
+
"cn-north-1": "cn-north-1";
|
|
25
|
+
"cn-northwest-1": "cn-northwest-1";
|
|
26
|
+
"eu-central-1": "eu-central-1";
|
|
27
|
+
"eu-central-2": "eu-central-2";
|
|
28
|
+
"eu-west-1": "eu-west-1";
|
|
29
|
+
"eu-west-2": "eu-west-2";
|
|
30
|
+
"eu-west-3": "eu-west-3";
|
|
31
|
+
"eu-south-1": "eu-south-1";
|
|
32
|
+
"eu-south-2": "eu-south-2";
|
|
33
|
+
"eu-north-1": "eu-north-1";
|
|
34
|
+
"il-central-1": "il-central-1";
|
|
35
|
+
"mx-central-1": "mx-central-1";
|
|
36
|
+
"me-central-1": "me-central-1";
|
|
37
|
+
"me-south-1": "me-south-1";
|
|
38
|
+
"sa-east-1": "sa-east-1";
|
|
39
|
+
"us-gov-east-1": "us-gov-east-1";
|
|
40
|
+
"us-gov-west-1": "us-gov-west-1";
|
|
41
|
+
}>;
|
|
42
|
+
export type AwsRegion = z.infer<typeof schema>;
|
|
2
43
|
/**
|
|
3
44
|
* Validates that a string is a valid AWS region.
|
|
4
45
|
*
|
|
@@ -47,3 +88,4 @@ export declare function region(): z.ZodEnum<{
|
|
|
47
88
|
"us-gov-east-1": "us-gov-east-1";
|
|
48
89
|
"us-gov-west-1": "us-gov-west-1";
|
|
49
90
|
}>;
|
|
91
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../../src/aws/region.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG;IAClB,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,eAAe;IACf,eAAe;CACP,CAAC;AAEX,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../../src/aws/region.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG;IAClB,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,eAAe;IACf,eAAe;CACP,CAAC;AAEX,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAInC;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/aws/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/zod-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-alpha.0",
|
|
4
4
|
"description": "Extensions to the zod package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"require": "./lib/cjs/index.js",
|
|
22
22
|
"default": "./lib/esm/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./aws": {
|
|
25
|
+
"import": "./lib/esm/aws/types.js",
|
|
26
|
+
"require": "./lib/cjs/index.js",
|
|
27
|
+
"default": "./lib/esm/aws/types.js"
|
|
28
|
+
},
|
|
24
29
|
"./json": {
|
|
25
30
|
"import": "./lib/esm/json/types.js",
|
|
26
31
|
"require": "./lib/cjs/json/types.js",
|