Port to elysia, tailwind (no effect)
This commit is contained in:
@@ -1,33 +1,22 @@
|
||||
import { Schema as S } from "@effect/schema";
|
||||
import { Brand as B, pipe } from "effect";
|
||||
import * as Brand from "./Brand";
|
||||
|
||||
export const AttachmentId = pipe(S.ULID, S.brand("AttachmentId"));
|
||||
export const PieceId = pipe(S.ULID, S.brand("PieceId"));
|
||||
export const RequestId = pipe(S.ULID, S.brand("RequestId"));
|
||||
export const SessionId = pipe(S.NonEmptyString, S.brand("SessionId"));
|
||||
export const UserId = pipe(S.ULID, S.brand("UserId"));
|
||||
export type UUID = Brand.Branded<string, "UUID">;
|
||||
export const UUID = Brand.nominal<UUID>();
|
||||
|
||||
export type AttachmentId = typeof AttachmentId.Type;
|
||||
export type PieceId = typeof PieceId.Type;
|
||||
export type RequestId = typeof RequestId.Type;
|
||||
export type SessionId = typeof SessionId.Type;
|
||||
export type UserId = typeof UserId.Type;
|
||||
export type Sha256 = Brand.Branded<Uint8Array, "Sha256">;
|
||||
export const Sha256 = Brand.nominal<Sha256>();
|
||||
|
||||
export type Sha256 = B.Branded<Uint8Array, "Sha256">;
|
||||
export const Sha256 = pipe(
|
||||
S.Uint8ArrayFromSelf,
|
||||
S.fromBrand(B.refined<Sha256>(
|
||||
(array) => array.byteLength === 32,
|
||||
() => B.error(`Expected Uint8Array to be 32 bytes long`),
|
||||
)),
|
||||
).annotations({ identifier: "SHA-256" });
|
||||
export type AttachmentId = Brand.Branded<UUID, "AttachmentId">;
|
||||
export const AttachmentId = Brand.nominal<AttachmentId>();
|
||||
|
||||
export class BooleanFromNumber extends S.transform(
|
||||
S.Number,
|
||||
S.Boolean,
|
||||
{
|
||||
strict: true,
|
||||
decode: (a) => a !== 0,
|
||||
encode: (i) => i ? 1 : 0,
|
||||
},
|
||||
).annotations({ identifier: "BooleanFromNumber" }) { }
|
||||
export type PieceId = Brand.Branded<UUID, "PieceId">;
|
||||
export const PieceId = Brand.nominal<PieceId>();
|
||||
|
||||
export type RequestId = Brand.Branded<UUID, "RequestId">;
|
||||
export const RequestId = Brand.nominal<RequestId>();
|
||||
|
||||
export type SessionId = Brand.Branded<string, "SessionId">;
|
||||
export const SessionId = Brand.nominal<SessionId>();
|
||||
|
||||
export type UserId = Brand.Branded<UUID, "UserId">;
|
||||
export const UserId = Brand.nominal<UserId>();
|
||||
|
||||
Reference in New Issue
Block a user