import type * as B from "effect/Brand" import * as S from "effect/Schema" import type * as SchemaAST from "effect/SchemaAST" import type { Simplify } from "effect/Types" import { type BrandedSchema, fromBrand, nominal } from "./brand.js" import { withDefaultMake } from "./ext.js" export type NonEmptyStringBrand = B.Brand<"NonEmptyString"> export type NonEmptyString = string & NonEmptyStringBrand export interface NonEmptyStringSchema extends BrandedSchema { (i: string, options?: SchemaAST.ParseOptions): NonEmptyString } export const NonEmptyString: NonEmptyStringSchema = S .NonEmptyString .pipe( fromBrand(nominal(), { identifier: "NonEmptyString", jsonSchema: {} }), withDefaultMake ) export interface NonEmptyString64kBrand extends Simplify & NonEmptyStringBrand> {} export type NonEmptyString64k = string & NonEmptyString64kBrand export interface NonEmptyString64kSchema extends BrandedSchema { (i: string, options?: SchemaAST.ParseOptions): NonEmptyString64k } export const NonEmptyString64k: NonEmptyString64kSchema = S .NonEmptyString .pipe( S.check(S.isMaxLength(64 * 1024)), fromBrand(nominal(), { identifier: "NonEmptyString64k", jsonSchema: {} }), withDefaultMake ) export interface NonEmptyString2kBrand extends Simplify & NonEmptyString64kBrand> {} export type NonEmptyString2k = string & NonEmptyString2kBrand export interface NonEmptyString2kSchema extends BrandedSchema { (i: string, options?: SchemaAST.ParseOptions): NonEmptyString2k } export const NonEmptyString2k: NonEmptyString2kSchema = S .NonEmptyString .pipe( S.check(S.isMaxLength(2 * 1024)), fromBrand(nominal(), { identifier: "NonEmptyString2k", jsonSchema: {} }), withDefaultMake ) export interface NonEmptyString255Brand extends Simplify & NonEmptyString2kBrand> {} export type NonEmptyString255 = string & NonEmptyString255Brand export interface NonEmptyString255Schema extends BrandedSchema { (i: string, options?: SchemaAST.ParseOptions): NonEmptyString255 } export const NonEmptyString255: NonEmptyString255Schema = S .NonEmptyString .pipe( S.check(S.isMaxLength(255)), fromBrand(nominal(), { identifier: "NonEmptyString255", jsonSchema: {} }), withDefaultMake )