{"version":3,"file":"schema.cjs","names":["isFunction","isObject","isString","isNumber","isInteger","isBoolean","isArray"],"sources":["../../../src/common/schema/schema.ts"],"sourcesContent":["// With many, many inspiration from https://github.com/badrap/valita MIT License as of 2024-09-10\n\nimport type { StandardSchemaV1 } from './schema-standard'\nimport { isArray, isBoolean, isFunction, isInteger, isNumber, isObject, isString } from '../data/is'\n\n/**\n * Metadata interface for type descriptions and additional properties\n */\nexport interface TypeMeta {\n  desc?: string\n}\n\n/**\n * Core Type class for schema validation and type inference\n * Implements StandardSchemaV1 for cross-library compatibility\n */\nexport class Type<T = unknown> {\n  readonly type: string\n\n  _default?: any\n  _optional?: boolean\n  _meta?: TypeMeta\n  _check?: (obj: any) => boolean\n  _object?: any\n  _type?: any\n  _union?: any\n  _enumValues?: any\n  _args?: any\n  _ret?: any\n  _info?: any\n\n  // [key: `_${string}`]: any // Allow only optional dynamic properties starting with an underscore\n\n  constructor(name: string, options: Partial<Type<T>> = {}) {\n    this.type = name\n    Object.assign(this, options)\n  }\n\n  /**\n   * Standard Schema V1 compliance property\n   * Provides a standard interface for validation and type inference\n   */\n  get '~standard'(): any {\n    return {\n      version: 1,\n      vendor: 'zeed',\n      validate: (value: unknown): StandardSchemaV1.Result<T> => {\n        return this.validate(value)\n      },\n      types: {\n        input: undefined as any as T,\n        output: undefined as any as T,\n      },\n    }\n  }\n\n  /**\n   * Validation method for standard-schema compliance\n   */\n  validate(value: any): any {\n    // const messages: Array<{ path: string, message: string, type: string, valid: boolean }> = []\n\n    // Handle null/undefined cases\n    if (value == null) {\n      if (this._optional) {\n        return { value: undefined as any as T }\n      }\n      if (this._default !== undefined) {\n        const defaultValue = isFunction(this._default) ? this._default(this) : this._default\n        return { value: defaultValue }\n      }\n      return {\n        issues: [{\n          message: `Required value is missing`,\n          path: [],\n        }],\n      }\n    }\n\n    // Handle literal types\n    if (this.type === 'literal' && this._default !== value) {\n      return {\n        issues: [{\n          message: `Expected literal value ${this._default}, got ${value}`,\n          path: [],\n        }],\n      }\n    }\n\n    // Handle string literals (enums)\n    if (this._enumValues && Array.isArray(this._enumValues)) {\n      if (!this._enumValues.includes(value)) {\n        return {\n          issues: [{\n            message: `Expected one of [${this._enumValues.join(', ')}], got ${value}`,\n            path: [],\n          }],\n        }\n      }\n    }\n\n    // Handle union types\n    if (this._union && Array.isArray(this._union)) {\n      for (const option of this._union) {\n        const result = (option as Type<any>).validate(value)\n        if (!result.issues) {\n          return result\n        }\n      }\n      return {\n        issues: [{\n          message: `Value does not match any union variant`,\n          path: [],\n        }],\n      }\n    }\n\n    // Handle array types\n    if (this.type === 'array' || this.type === 'tuple') {\n      if (!Array.isArray(value)) {\n        return {\n          issues: [{\n            message: `Expected array, got ${typeof value}`,\n            path: [],\n          }],\n        }\n      }\n\n      if (this.type === 'tuple' && this._type) {\n        const items = this._type as Type<any>[]\n        if (value.length !== items.length) {\n          return {\n            issues: [{\n              message: `Expected tuple of length ${items.length}, got ${value.length}`,\n              path: [],\n            }],\n          }\n        }\n\n        const issues: StandardSchemaV1.Issue[] = []\n        for (let i = 0; i < items.length; i++) {\n          const itemResult = items[i].validate(value[i])\n          if (itemResult.issues) {\n            for (const issue of itemResult.issues) {\n              issues.push({\n                message: issue.message,\n                path: [i, ...(issue.path || [])],\n              })\n            }\n          }\n        }\n\n        if (issues.length > 0) {\n          return { issues }\n        }\n      }\n      else if (this._type) {\n        // Regular array with item type\n        const itemType = this._type as Type<any>\n        const issues: StandardSchemaV1.Issue[] = []\n\n        for (let i = 0; i < value.length; i++) {\n          const itemResult = itemType.validate(value[i])\n          if (itemResult.issues) {\n            for (const issue of itemResult.issues) {\n              issues.push({\n                message: issue.message,\n                path: [i, ...(issue.path || [])],\n              })\n            }\n          }\n        }\n\n        if (issues.length > 0) {\n          return { issues }\n        }\n      }\n    }\n\n    // Handle object types\n    if (this._object) {\n      if (!isObject(value)) {\n        return {\n          issues: [{\n            message: `Expected object, got ${typeof value}`,\n            path: [],\n          }],\n        }\n      }\n\n      const issues: StandardSchemaV1.Issue[] = []\n      const obj = value as Record<string, any>\n\n      for (const key in this._object) {\n        const propSchema = this._object[key] as Type<any>\n        const propValue = obj[key]\n        const propResult = propSchema.validate(propValue)\n\n        if (propResult.issues) {\n          for (const issue of propResult.issues) {\n            issues.push({\n              message: issue.message,\n              path: [key, ...(issue.path || [])],\n            })\n          }\n        }\n      }\n\n      if (issues.length > 0) {\n        return { issues }\n      }\n\n      return { value: value as T, issues: undefined }\n    }\n\n    // Handle record types\n    if (this.type === 'record' && this._type) {\n      if (!isObject(value)) {\n        return {\n          issues: [{\n            message: `Expected object, got ${typeof value}`,\n            path: [],\n          }],\n        }\n      }\n\n      const valueType = this._type as Type<any>\n      const issues: StandardSchemaV1.Issue[] = []\n      const obj = value as Record<string, any>\n\n      for (const key in obj) {\n        const propResult = valueType.validate(obj[key])\n        if (propResult.issues) {\n          for (const issue of propResult.issues) {\n            issues.push({\n              message: issue.message,\n              path: [key, ...(issue.path || [])],\n            })\n          }\n        }\n      }\n\n      if (issues.length > 0) {\n        return { issues }\n      }\n    }\n\n    // Check primitive types\n    if (this._check && !this._check(value)) {\n      return {\n        issues: [{\n          message: `Expected ${this.type}, got ${typeof value}`,\n          path: [],\n        }],\n      }\n    }\n\n    // Success - return the value\n    return { value: value as T }\n  }\n\n  /**\n   * Creates a copy of the type with new properties merged\n   */\n  private _cloneWithProps<U = T>(newProps: Partial<Type<any>> = {}): Type<U> {\n    const cloned = new Type<U>(this.type)\n    // Copy all existing properties\n    const propertiesToCopy = ['_default', '_optional', '_meta', '_check', '_object', '_type', '_union', '_enumValues', '_args', '_ret', '_info']\n    for (const prop of propertiesToCopy) {\n      if ((this as any)[prop] !== undefined) {\n        (cloned as any)[prop] = (this as any)[prop]\n      }\n    }\n    // Apply new properties\n    Object.assign(cloned, newProps)\n    return cloned\n  }\n\n  /**\n   * Helper to copy type properties when creating new type instances\n   */\n  private static _copyTypeProperties(source: Type<any>, target: Type<any>): void {\n    const properties = ['_check', '_default', '_meta', '_object', '_type', '_enumValues']\n    for (const prop of properties) {\n      if ((source as any)[prop] !== undefined) {\n        (target as any)[prop] = (source as any)[prop]\n      }\n    }\n  }\n\n  /**\n   * Marks the type as optional, meaning it can be undefined\n   * This is useful for properties that are not required.\n   */\n  optional(): Type<T | undefined> {\n    return this._cloneWithProps<T | undefined>({ _optional: true })\n  }\n\n  /**\n   * Sets a default value for the type, which will be used if the value is not provided\n   * The default value can be a function that receives the schema as argument, or a static value.\n   */\n  default(value: T | ((schema?: this) => T)): Type<T> {\n    return this._cloneWithProps<T>({ _default: value })\n  }\n\n  /**\n   * Props / Metadata for the type, like description or other properties\n   */\n  meta(meta: TypeMeta): Type<T> {\n    return this._cloneWithProps<T>({ _meta: meta })\n  }\n\n  /**\n   * Sets the `desc` property for the type, which is a human-readable description\n   */\n  describe(msg: string): Type<T> {\n    const meta = this._meta || {}\n    meta.desc = msg\n    return this._cloneWithProps<T>({ _meta: meta })\n  }\n\n  /**\n   * Extends the type with an object, merging the properties\n   */\n  extend<O>(obj: O): Type<T & TypeObject<O>> {\n    if (!this._object) {\n      throw new Error('extend() can only be used on object schemas')\n    }\n    const newObj = { ...this._object, ...obj }\n    return object(newObj) as any\n  }\n\n  /**\n   * Picks certain keys from an object schema\n   */\n  pick<K extends keyof T>(keys: Record<K, true>): Type<Pick<T, K>> {\n    if (!this._object) {\n      throw new Error('pick() can only be used on object schemas')\n    }\n    const pickedObj: any = {}\n    for (const key of Object.keys(keys)) {\n      if (key in this._object) {\n        pickedObj[key] = (this._object as any)[key]\n      }\n    }\n    return object(pickedObj) as any\n  }\n\n  /**\n   * Omits certain keys from an object schema\n   */\n  omit<K extends keyof T>(keys: Record<K, true>): Type<Omit<T, K>> {\n    if (!this._object) {\n      throw new Error('omit() can only be used on object schemas')\n    }\n    const omittedObj: any = { ...this._object }\n    for (const key of Object.keys(keys)) {\n      delete omittedObj[key]\n    }\n    return object(omittedObj) as any\n  }\n\n  /**\n   * Helper method to modify object properties with a transformation function\n   */\n  private _transformObjectProperties(\n    transform: (key: string, type: Type<any>, shouldTransform: boolean) => Type<any>,\n    keys?: Record<string, true>,\n  ): any {\n    if (!this._object) {\n      throw new Error('This operation can only be used on object schemas')\n    }\n\n    const transformedObj: any = {}\n    const originalObj = this._object as any\n\n    for (const [key, typeInstance] of Object.entries(originalObj)) {\n      const shouldTransform = !keys || key in keys\n      transformedObj[key] = transform(key, typeInstance as Type<any>, shouldTransform)\n    }\n\n    return object(transformedObj)\n  }\n\n  /**\n   * Makes some or all properties of an object schema optional\n   */\n  partial(): Type<Partial<T>>\n  partial<K extends keyof T>(keys: Record<K, true>): Type<Partial<Pick<T, K>> & Omit<T, K>>\n  partial<K extends keyof T>(keys?: Record<K, true>): Type<Partial<T> | (Partial<Pick<T, K>> & Omit<T, K>)> {\n    if (!this._object) {\n      throw new Error('partial() can only be used on object schemas')\n    }\n    return this._transformObjectProperties((key, type, shouldTransform) => {\n      if (!shouldTransform)\n        return type\n      return Type._cloneTypeWithOptional(type, true)\n    }, keys)\n  }\n\n  /**\n   * Makes some or all properties of an object schema required\n   */\n  required(): Type<Required<T>>\n  required<K extends keyof T>(keys: Record<K, true>): Type<Required<Pick<T, K>> & Omit<T, K>>\n  required<K extends keyof T>(keys?: Record<K, true>): Type<Required<T> | (Required<Pick<T, K>> & Omit<T, K>)> {\n    if (!this._object) {\n      throw new Error('required() can only be used on object schemas')\n    }\n    return this._transformObjectProperties((key, type, shouldTransform) => {\n      if (!shouldTransform)\n        return type\n      return Type._cloneTypeWithOptional(type, false)\n    }, keys)\n  }\n\n  /**\n   * Helper method to clone a type with optional flag\n   */\n  private static _cloneTypeWithOptional(originalType: Type<any>, optional: boolean): Type<any> {\n    const newType = new Type(originalType.type)\n    Type._copyTypeProperties(originalType, newType)\n    newType._optional = optional\n    return newType\n  }\n}\n\n/**\n * Type inference utility for extracting the TypeScript type from a schema Type\n */\nexport type Infer<T> = T extends Type<infer TT> ? TT : never\n\n// =============================================================================\n// Primitive Types\n// =============================================================================\n\n/**\n * Creates a string type validator\n */\nexport function string(): Type<string> {\n  return new Type('string', {\n    _check: isString,\n  })\n}\n\n/**\n * Creates a number type validator\n */\nexport function number(): Type<number> {\n  return new Type('number', {\n    _check: isNumber,\n  })\n}\n\n/**\n * Creates an integer type validator\n */\nexport function int(): Type<number> {\n  return new Type('int', {\n    _check: isInteger,\n  })\n}\n\n/**\n * Creates a boolean type validator\n */\nexport function boolean(): Type<boolean> {\n  return new Type('boolean', {\n    _check: isBoolean,\n  })\n}\n\n/**\n * Creates a none type validator (undefined | null)\n * Like undefined | null in TS and nil in Swift\n */\nexport function none(): Type<undefined> {\n  return new Type('none', {\n    _check: (v: any) => v == null,\n    _optional: true,\n  })\n}\n\n/**\n * Creates an any type validator that accepts any non-null value\n */\nexport function any<T = any>(): Type<T> {\n  return new Type('any', {\n    _check: (v: any) => v != null,\n  })\n}\n\n// Aliases for number types\nexport const float = number\nexport const double = number\nexport const real = number\n\n// =============================================================================\n// Object Types\n// =============================================================================\n\n/**\n * Utility type to make object properties optional if their value type includes undefined.\n * @category Schema\n */\nexport type TypeObjectFixOptional<T> = {\n  [K in keyof T as undefined extends T[K] ? K : never]?: T[K] & {}\n} & {\n  [K in keyof T as undefined extends T[K] ? never : K]: T[K] & {}\n}\n\n/**\n * Utility type for pretty-printing object types\n */\ntype TypeObjectPretty<V> = Extract<{ [K in keyof V]: V[K] }, unknown>\n\n/**\n * Main object type utility\n */\ntype TypeObject<T> = TypeObjectPretty<TypeObjectFixOptional<{\n  [K in keyof T]: Infer<T[K]>\n}>>\n\n/**\n * Creates an object type validator with specified properties\n */\nexport function object<T>(tobj: T): Type<TypeObject<T>> {\n  return new Type('object', {\n    _check: isObject,\n    _object: tobj,\n  })\n}\n\n/**\n * Creates a record type validator (object with string keys and uniform value type)\n */\nexport function record<T extends Type>(valueType: T): Type<Record<string, Infer<T>>> {\n  return new Type('record', {\n    _check: isObject,\n    _type: valueType,\n  })\n}\n\n// =============================================================================\n// Union Types\n// =============================================================================\n\n/**\n * Utility type for union of types.\n * @category Schema\n */\nexport type TypeUnion<T extends Type<any>[]> = {\n  [K in keyof T]: T[K] extends Type<infer U> ? U : never\n}[number]\n\n/**\n * Creates a union type validator (like `string | number | boolean`)\n */\nexport function union<T extends Type<any>[]>(options: T): Type<TypeUnion<T>> {\n  return new Type('union', {\n    _check: (v: any) => options.some(option => option._check?.(v) ?? false),\n    _union: options,\n  })\n}\n\n// =============================================================================\n// Literal Types\n// =============================================================================\n\n/**\n * Utility type for literal types.\n * @category Schema\n */\nexport type TypeLiterals = string | number | bigint | boolean\n\n/**\n * Creates a literal value validator\n */\nexport function literal<T extends TypeLiterals>(value: T): Type<T> {\n  return new Type('literal', {\n    _check: (v: any) => v === value,\n    _default: value,\n  })\n}\n\n/**\n * Creates a string literal union validator (like `\"a\" | \"b\" | \"c\"`)\n */\nexport function stringLiterals<const T extends readonly string[]>(values: T): Type<T[number]> {\n  return new Type('string', {\n    _check: (v: any) => typeof v === 'string' && (values as readonly string[]).includes(v),\n    _enumValues: values,\n  })\n}\n\n// =============================================================================\n// Collection Types\n// =============================================================================\n\n/**\n * Utility type for tuple types.\n * @category Schema\n */\nexport type TypeTuple<T extends readonly Type[]> = {\n  -readonly [K in keyof T]: T[K] extends Type<infer U> ? U : never\n}\n\n/**\n * Output type for TypeArray.\n * @category Schema\n */\nexport type TypeArrayOutput<Head extends Type[], Rest extends Type | undefined> = [\n  ...TypeTuple<Head>,\n  ...(Rest extends Type ? Infer<Rest>[] : []),\n]\n\n/**\n * Utility type for array types.\n * @category Schema\n */\nexport type TypeArray<Head extends Type[] = Type[], Rest extends Type | undefined = Type | undefined> = Type<TypeArrayOutput<Head, Rest>>\n\n/**\n * Creates a tuple type validator with fixed length and types e.g. [string, number, boolean]\n */\nexport function tuple<const T extends readonly Type[]>(items: T): Type<TypeTuple<T>> {\n  return new Type('tuple', {\n    _check: (v: any) => Array.isArray(v) && v.length === items.length && items.every((item, i) => (item as Type)._check?.(v[i]) ?? false),\n    _type: items,\n  })\n}\n\n/**\n * Creates an array type validator for a specific item type\n */\nexport function array<T>(itemType: Type<T>): Type<T[]> {\n  return new Type('array', {\n    _check: isArray,\n    _type: itemType,\n  })\n}\n\n// =============================================================================\n// Function Types\n// =============================================================================\n\n/**\n * Creates a regular function type validator\n */\nexport function func<\n  TypeFuncArgs extends [Type<unknown>, ...Type<any>[]] | [],\n  TypeFuncRet = Type,\n  T = (...args: TypeTuple<TypeFuncArgs>) => Infer<TypeFuncRet>,\n>(args: TypeFuncArgs, ret: TypeFuncRet): Type<T> {\n  return new Type('function', {\n    _check: isFunction,\n    _args: args,\n    _ret: ret,\n  })\n}\n\n/**\n * Creates an RPC function type validator that takes one argument and returns a promise\n */\nexport function rpc<\n  TypeRpcInfo extends Type<unknown> | undefined = undefined,\n  TypeRpcRet extends Type<unknown> = Type<void>,\n  T = TypeRpcInfo extends undefined\n    ? () => Infer<TypeRpcRet>\n    : (info: Infer<TypeRpcInfo>) => Infer<TypeRpcRet> | Promise<Infer<TypeRpcRet>>,\n>(info?: TypeRpcInfo, ret?: TypeRpcRet): Type<T> {\n  return new Type('rpc', {\n    _check: isFunction,\n    _info: info,\n    _ret: ret ?? none(),\n  })\n}\n"],"mappings":";;;;;;;;AAgBA,IAAa,OAAb,MAAa,KAAkB;CAC7B,AAAS;CAET;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA,YAAY,MAAc,UAA4B,EAAE,EAAE;AACxD,OAAK,OAAO;AACZ,SAAO,OAAO,MAAM,QAAQ;;;;;;CAO9B,IAAI,cAAmB;AACrB,SAAO;GACL,SAAS;GACT,QAAQ;GACR,WAAW,UAA+C;AACxD,WAAO,KAAK,SAAS,MAAM;;GAE7B,OAAO;IACL,OAAO;IACP,QAAQ;IACT;GACF;;;;;CAMH,SAAS,OAAiB;AAIxB,MAAI,SAAS,MAAM;AACjB,OAAI,KAAK,UACP,QAAO,EAAE,OAAO,QAAuB;AAEzC,OAAI,KAAK,aAAa,OAEpB,QAAO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