diff --git a/src/aws.d.ts b/src/aws.d.ts new file mode 100644 index 0000000..d0fd08d --- /dev/null +++ b/src/aws.d.ts @@ -0,0 +1,16 @@ +type AccountId = `${number}`; +type Region = `${string}-${string}-${number}`; + +type Arn< + S extends string, + R extends Region | "", + T extends string +> = `arn:aws:${S}:${R}:${AccountId}:${T}`; + +type RegionalArn = Arn; +type GlobalArn = Arn; + +type RuleArn = RegionalArn<"events", `rule/${string}/${string}`>; +type RoleArn = GlobalArn<"iam", `role/${string}`>; +type SqsArn = RegionalArn<"sqs", string>; +type LambdaArn = RegionalArn<"lambda", `function:${string}`>; diff --git a/src/brand.d.ts b/src/brand.d.ts new file mode 100644 index 0000000..d46d3d9 --- /dev/null +++ b/src/brand.d.ts @@ -0,0 +1 @@ +type Brand = T & { readonly __brand: B }; \ No newline at end of file diff --git a/src/uuid.d.ts b/src/uuid.d.ts new file mode 100644 index 0000000..f9c8ac4 --- /dev/null +++ b/src/uuid.d.ts @@ -0,0 +1,6 @@ +type VariantNibble = "8" | "9" | "A" | "B"; + +type UUID = `${string}-${string}-${V}${string}-${VariantNibble}${string}-${string}` + +type UUIDv4 = UUID<'4'>; +type UUIDv7 = UUID<'7'>;