{"version":3,"sources":["jsdelivr-header.js","/npm/@thisisagile/easy@17.25.1/src/index.ts","/npm/@thisisagile/easy@17.25.1/src/types/Is.ts","/npm/@thisisagile/easy@17.25.1/src/types/Primitive.ts","/npm/@thisisagile/easy@17.25.1/src/types/Func.ts","/npm/@thisisagile/easy@17.25.1/src/types/Constructor.ts","/npm/@thisisagile/easy@17.25.1/src/types/IsA.ts","/npm/@thisisagile/easy@17.25.1/src/types/Get.ts","/npm/@thisisagile/easy@17.25.1/src/types/Array.ts","/npm/@thisisagile/easy@17.25.1/src/types/Text.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Traverse.ts","/npm/@thisisagile/easy@17.25.1/src/types/List.ts","/npm/@thisisagile/easy@17.25.1/src/utils/If.ts","/npm/@thisisagile/easy@17.25.1/src/types/Object.ts","/npm/@thisisagile/easy@17.25.1/src/types/Json.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Convert.ts","/npm/@thisisagile/easy@17.25.1/src/data/Condition.ts","/npm/@thisisagile/easy@17.25.1/src/types/Meta.ts","/npm/@thisisagile/easy@17.25.1/src/types/Enum.ts","/npm/@thisisagile/easy@17.25.1/src/types/Template.ts","/npm/@thisisagile/easy@17.25.1/src/types/ToText.ts","/npm/@thisisagile/easy@17.25.1/src/types/Exception.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Promise.ts","/npm/@thisisagile/easy@17.25.1/src/types/Gateway.ts","/npm/@thisisagile/easy@17.25.1/src/validation/When.ts","/npm/@thisisagile/easy@17.25.1/src/types/Context.ts","/npm/@thisisagile/easy@17.25.1/src/types/Result.ts","/npm/@thisisagile/easy@17.25.1/src/types/Results.ts","/npm/@thisisagile/easy@17.25.1/src/types/Value.ts","/npm/@thisisagile/easy@17.25.1/src/types/Validatable.ts","/npm/@thisisagile/easy@17.25.1/src/validation/Validate.ts","/npm/@thisisagile/easy@17.25.1/src/types/Try.ts","/npm/@thisisagile/easy@17.25.1/src/types/Case.ts","/npm/@thisisagile/easy@17.25.1/src/types/PageList.ts","/npm/@thisisagile/easy@17.25.1/src/data/InMemoryGateway.ts","/npm/@thisisagile/easy@17.25.1/src/data/Database.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Property.ts","/npm/@thisisagile/easy@17.25.1/src/data/Field.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Struct.ts","/npm/@thisisagile/easy@17.25.1/src/domain/DateTime.ts","/npm/@thisisagile/easy@17.25.1/src/types/IsDate.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Seconds.ts","/npm/@thisisagile/easy@17.25.1/src/validation/Contraints.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Audit.ts","/npm/@thisisagile/easy@17.25.1/src/types/Uuid.ts","/npm/@thisisagile/easy@17.25.1/src/types/Id.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Child.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Entity.ts","/npm/@thisisagile/easy@17.25.1/src/types/Repository.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Repo.ts","/npm/@thisisagile/easy@17.25.1/src/domain/Typo.ts","/npm/@thisisagile/easy@17.25.1/src/types/Number.ts","/npm/@thisisagile/easy@17.25.1/src/types/CacheAge.ts","/npm/@thisisagile/easy@17.25.1/src/http/CacheControl.ts","/npm/@thisisagile/easy@17.25.1/src/http/ContentType.ts","/npm/@thisisagile/easy@17.25.1/src/http/HttpHeader.ts","/npm/@thisisagile/easy@17.25.1/src/http/HttpStatus.ts","/npm/@thisisagile/easy@17.25.1/src/http/HttpVerb.ts","/npm/@thisisagile/easy@17.25.1/src/http/RequestOptions.ts","/npm/@thisisagile/easy@17.25.1/src/http/Response.ts","/npm/@thisisagile/easy@17.25.1/src/http/RestResult.ts","/npm/@thisisagile/easy@17.25.1/src/http/toResponse.ts","/npm/@thisisagile/easy@17.25.1/src/process/Scope.ts","/npm/@thisisagile/easy@17.25.1/src/process/App.ts","/npm/@thisisagile/easy@17.25.1/src/process/Search.ts","/npm/@thisisagile/easy@17.25.1/src/process/Manage.ts","/npm/@thisisagile/easy@17.25.1/src/process/UseCase.ts","/npm/@thisisagile/easy@17.25.1/src/resources/Req.ts","/npm/node_modules/jwt-decode/build/esm/index.js","/npm/@thisisagile/easy@17.25.1/src/security/Jwt.ts","/npm/@thisisagile/easy@17.25.1/src/services/AxiosProvider.ts","/npm/@thisisagile/easy@17.25.1/src/services/Api.ts","/npm/@thisisagile/easy@17.25.1/src/services/ApiGateway.ts","/npm/@thisisagile/easy@17.25.1/src/services/RouteGateway.ts","/npm/@thisisagile/easy@17.25.1/src/utils/State.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Mapper.ts","/npm/@thisisagile/easy@17.25.1/src/services/MappedRouteGateway.ts","/npm/@thisisagile/easy@17.25.1/src/types/IsEqual.ts","/npm/@thisisagile/easy@17.25.1/src/utils/View.ts","/npm/@thisisagile/easy@17.25.1/src/services/ViewRouteGateway.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Clause.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Column.ts","/npm/@thisisagile/easy@17.25.1/src/sql/SqlQuery.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Delete.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Insert.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Join.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Select.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Update.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Count.ts","/npm/@thisisagile/easy@17.25.1/src/sql/Table.ts","/npm/@thisisagile/easy@17.25.1/src/sql/TableGateway.ts","/npm/@thisisagile/easy@17.25.1/src/types/Builder.ts","/npm/@thisisagile/easy@17.25.1/src/types/Cache.ts","/npm/@thisisagile/easy@17.25.1/src/types/Currency.ts","/npm/@thisisagile/easy@17.25.1/src/types/Environment.ts","/npm/@thisisagile/easy@17.25.1/src/types/Falsy.ts","/npm/@thisisagile/easy@17.25.1/src/types/Indexed.ts","/npm/@thisisagile/easy@17.25.1/src/types/Message.ts","/npm/@thisisagile/easy@17.25.1/src/types/Nullish.ts","/npm/@thisisagile/easy@17.25.1/src/types/Parser.ts","/npm/@thisisagile/easy@17.25.1/src/types/Sort.ts","/npm/@thisisagile/easy@17.25.1/src/types/Tag.ts","/npm/@thisisagile/easy@17.25.1/src/types/Uri.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Base64.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Loading.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Log.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Sentence.ts","/npm/@thisisagile/easy@17.25.1/src/utils/Wait.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,65BCNA,YAAA,GAAA,SAAA,YAAA,CAAA,MAAA,IAAA,MAAA,IAAA,IAAA,IAAA,WAAA,IAAA,WAAA,IAAA,IAAA,IAAA,MAAA,IAAA,MAAA,cAAA,IAAA,cAAA,YAAA,IAAA,YAAA,mBAAA,IAAA,mBAAA,aAAA,IAAA,aAAA,MAAA,IAAA,MAAA,OAAA,IAAA,OAAA,OAAA,IAAA,OAAA,UAAA,IAAA,UAAA,YAAA,IAAA,YAAA,QAAA,IAAA,QAAA,QAAA,IAAA,QAAA,SAAA,IAAA,SAAA,SAAA,IAAA,SAAA,gBAAA,IAAA,gBAAA,OAAA,IAAA,OAAA,cAAA,IAAA,cAAA,QAAA,IAAA,QAAA,OAAA,IAAA,OAAA,KAAA,IAAA,KAAA,YAAA,IAAA,YAAA,UAAA,IAAA,UAAA,MAAA,IAAA,MAAA,QAAA,IAAA,QAAA,WAAA,IAAA,WAAA,WAAA,IAAA,WAAA,SAAA,IAAA,SAAA,gBAAA,IAAA,gBAAA,OAAA,IAAA,OAAA,KAAA,IAAA,KAAA,IAAA,IAAA,IAAA,KAAA,IAAA,KAAA,iBAAA,IAAA,iBAAA,OAAA,IAAA,OAAA,mBAAA,IAAA,mBAAA,OAAA,IAAA,OAAA,YAAA,IAAA,YAAA,SAAA,IAA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B,IAAI,SAAS,MAAM,GAAW,SAAU,MACjE,IAAO,GAAoB,IAAI,SAAS,OAAO,GAAY,UAAW,OAGlE,KAAN,cAAmB,SACjB,IAAM,IAAI,MAAM,MAAO,MACvB,MAAQ,IAAI,MAAM,QAAS,MAC3B,MAAQ,IAAI,MAAM,QAAS,MAC3B,KAAO,IAAI,MAAM,OAAQ,MACzB,KAAO,IAAI,MAAM,OAAQ,MACzB,QAAU,IAAI,MAAM,UAAW,MAC/B,OAAS,IAAI,MAAM,SAAU,MAC7B,UAAY,IAAI,MAAM,YAAa,MACnC,OAAS,IAAI,MAAM,SAAU,MAC7B,SAAW,IAAI,MAAM,WAAY,OAG7B,IAAN,cAAkB,OAEZ,YAAN,cAA0B,KACxB,IAAM,IAAI,IAAI,MAAO,OAGjB,GAAN,cAAiB,SACf,MAAQ,IAAI,YAAY,QAAS,MACjC,IAAM,IAAI,YAAY,MAAO,MAE7B,MAAQ,IAAI,MAAM,QAAS,MAC3B,QAAU,IAAI,MAAM,UAAW,MAC/B,QAAU,IAAI,MAAM,UAAW,MAC/B,MAAQ,IAAI,MAAM,QAAS,MAC3B,MAAQ,IAAI,MAAM,QAAS,MAC3B,UAAY,IAAI,MAAM,YAAa,MACnC,QAAU,IAAI,MAAM,UAAW,MAC/B,WAAa,IAAI,MAAM,aAAc,MACrC,QAAU,IAAI,MAAM,UAAW,MAC/B,UAAY,IAAI,MAAM,YAAa,OAGxB,GAAK,IAAI,GAAG,MC7DZ,KAAN,MACL,WAAO,CAAK,EAAK,GACf,OAAO,IAAI,SAAQ,GAAW,WAAW,EAAS,IACpD,CAEA,cAAO,CAAQ,EAAI,GACjB,OAAO,KAAK,KAAS,IAAJ,EACnB,GAGW,KAAQ,GAAmB,KAAK,KAAK","file":"/npm/@thisisagile/easy@17.25.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@thisisagile/easy@17.25.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export * from './data/Condition';\nexport * from './data/InMemoryGateway';\nexport * from './data/Database';\nexport * from './data/DataProvider';\nexport * from './data/Field';\nexport * from './data/Query';\nexport * from './data/QueryProvider';\n\nexport * from './domain/Audit';\nexport * from './domain/Child';\nexport * from './domain/DateTime';\nexport * from './domain/Entity';\nexport * from './domain/Struct';\nexport * from './domain/Repo';\nexport * from './domain/Typo';\n\nexport * from './http/CacheControl';\nexport * from './http/ContentType';\nexport * from './http/HttpHeader';\nexport * from './http/HttpStatus';\nexport * from './http/HttpVerb';\nexport * from './http/Request';\nexport * from './http/RequestOptions';\nexport * from './http/RequestProvider';\nexport * from './http/Response';\nexport * from './http/RestResult';\nexport * from './http/toResponse';\n\nexport * from './process/App';\nexport * from './process/Manage';\nexport * from './process/Scope';\nexport * from './process/Search';\nexport * from './process/UseCase';\n\nexport * from './resources/Req';\n\nexport * from './security/Jwt';\n\nexport * from './services/Api';\nexport * from './services/ApiGateway';\nexport * from './services/AxiosProvider';\nexport * from './services/MappedRouteGateway';\nexport * from './services/RouteGateway';\nexport * from './services/ViewRouteGateway';\n\nexport * from './sql/Clause';\nexport * from './sql/Column';\nexport * from './sql/Delete';\nexport * from './sql/Insert';\nexport * from './sql/Join';\nexport * from './sql/SqlQuery';\nexport * from './sql/Select';\nexport * from './sql/Table';\nexport * from './sql/TableGateway';\nexport * from './sql/Update';\n\nexport * from './types/AnyKey';\nexport * from './types/Array';\nexport * from './types/Builder';\nexport * from './types/Cache';\nexport * from './types/CacheAge';\nexport * from './types/Case';\nexport * from './types/Constructor';\nexport * from './types/Context';\nexport * from './types/Currency';\nexport * from './types/Enum';\nexport * from './types/Environment';\nexport * from './types/ErrorOrigin';\nexport * from './types/Exception';\nexport * from './types/Falsy';\nexport * from './types/Func';\nexport * from './types/Gateway';\nexport * from './types/Get';\nexport * from './types/Id';\nexport * from './types/Identity';\nexport * from './types/IdName';\nexport * from './types/Indexed';\nexport * from './types/Is';\nexport * from './types/IsA';\nexport * from './types/IsDate';\nexport * from './types/IsEqual';\nexport * from './types/Json';\nexport * from './types/List';\nexport * from './types/Message';\nexport * from './types/Meta';\nexport * from './types/Nullish';\nexport * from './types/Number';\nexport * from './types/Object';\nexport * from './types/PageList';\nexport * from './types/Parser';\nexport * from './types/Primitive';\nexport * from './types/Repository';\nexport * from './types/Result';\nexport * from './types/Results';\nexport * from './types/Sort';\nexport * from './types/Tag';\nexport * from './types/Template';\nexport * from './types/Text';\nexport * from './types/Try';\nexport * from './types/TypeGuard';\nexport * from './types/Types';\nexport * from './types/Uri';\nexport * from './types/Uuid';\nexport * from './types/Validatable';\nexport * from './types/Value';\n\nexport * from './utils/Base64';\nexport * from './utils/Convert';\nexport * from './utils/If';\nexport * from './utils/Loading';\nexport * from './utils/Log';\nexport * from './utils/Mapper';\nexport * from './utils/Promise';\nexport * from './utils/Property';\nexport * from './utils/Seconds';\nexport * from './utils/State';\nexport * from './utils/Sentence';\nexport * from './utils/Traverse';\nexport * from './utils/View';\nexport * from './utils/Wait';\nexport * from './validation/Contraints';\nexport * from './validation/Validate';\nexport * from './validation/When';\nexport * from './types/ToText';\n","export const isDefined = <T = unknown>(o?: T): o is NonNullable<T> => o !== undefined && o !== null;\n\nexport const isUndefined = (v?: unknown): v is never => v === undefined || v === null;\n\nexport const isEmpty = (o?: unknown): boolean => o === '' || o === null || o === undefined || (isArray(o) && o.length === 0);\n\nexport const isNotEmpty = <T = unknown>(o?: unknown): o is NonNullable<T> => o !== '' && o !== null && o !== undefined && (!isArray(o) || o.length > 0);\n\nexport const isString = (o?: unknown): o is string => o instanceof String || typeof o === 'string';\n\nexport const isIsoDateString = (o?: unknown): o is string =>\n  isString(o) && /^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)$/.test(o);\n\nexport const isBoolean = (o?: unknown): o is boolean => isDefined(o) && typeof o === 'boolean';\n\nexport const isTrue = (o?: unknown): o is true => (isFunction(o) ? isTrue(o()) : isBoolean(o) ? o : !!o);\n\nexport const isNumber = (o?: unknown): o is number => isDefined(o) && typeof o === 'number' && !Number.isNaN(o);\n\nexport const isObject = (o?: unknown): o is Record<string, unknown> => o != null && typeof o === 'object' && !isArray(o);\n\nexport const isEmptyObject = (o?: unknown): boolean => isObject(o) && Object.getOwnPropertyNames(o).length === 0;\n\nexport const isFunction = (o?: unknown): o is (...params: unknown[]) => unknown => isDefined(o) && typeof o === 'function';\n\nexport const isArray = <T = any>(o?: unknown): o is Array<T> => isDefined(o) && o instanceof Array;\n\nexport const isIn = (o: unknown, values: unknown[]): boolean => isArray(values) && values.some(v => v === o);\n\nexport const isIntersecting = (o?: unknown[], values?: unknown[]): boolean => isArray(o) && isArray(values) && o.some(ov => isIn(ov, values));\n\nexport const isError = (e: unknown): e is Error => isDefined(e) && e instanceof Error;\n\nexport const isNotPresent = (...os: unknown[]): boolean =>\n  os.some(\n    o =>\n      o === null ||\n      o === undefined ||\n      o === '' ||\n      (o instanceof Array && o.length === 0) ||\n      (typeof o === 'object' && Object.getOwnPropertyNames(o).length === 0)\n  );\n\nexport const isPresent = (...os: unknown[]): boolean => !isNotPresent(...os);\n","import { isIn } from './Is';\n\nexport type Primitive = string | number | bigint | boolean | symbol | null | undefined;\n\nexport const isPrimitive = (v?: unknown): v is Primitive => {\n  return v === null || v === undefined || isIn(typeof v, ['string', 'number', 'bigint', 'boolean', 'symbol']);\n};\n","export type Func<T, Args = unknown> = (...args: Args[]) => T;\n\nexport const isFunc = <T, Args>(o?: unknown): o is (...params: Args[]) => T => !!o && typeof o === 'function';\n","import { Get } from './Get';\nimport { isFunc } from './Func';\nimport { isDefined, isFunction } from './Is';\nimport { isPrimitive } from './Primitive';\nimport { Optional } from './Types';\n\nexport type Constructor<T = unknown> = { new (...args: any[]): T };\n\nexport type Construct<Out, In = any> = Get<Out, In> | Constructor<Out>;\n\nexport const isConstructor = <T>(c?: unknown): c is Constructor<T> => (isDefined(c) && isFunc<T, unknown>(c) && c.prototype && c.prototype.constructor) === c;\n\nexport const isInstance = <T>(ctor: Constructor<T>, o?: unknown): o is T => isFunction(ctor) && o instanceof ctor;\n\nexport const ofConstruct = <T>(c: Construct<T>, ...args: unknown[]): T => (isConstructor<T>(c) ? new c(...args) : isFunc<T, unknown>(c) ? c(...args) : c);\n\nexport const toName = (subject?: unknown, postfix = ''): string => (subject as any)?.constructor?.name?.replace(postfix, '').toLowerCase() ?? '';\n\nconst isPromise = <T>(value: unknown): value is Promise<T> => {\n  return value instanceof Promise;\n};\n\nexport const on = <T, R>(t: T, f: (t: T) => R): R extends Promise<unknown> ? Promise<T> : T => {\n  const result = f(t);\n  return (isPromise(result) ? result.then(() => t) : t) as R extends Promise<unknown> ? Promise<T> : T;\n};\n\nexport const use = <T, Out>(t: T, f: (t: T) => Out): Out => f(t);\n\nexport const ifA = <T>(c: Constructor<T>, t?: unknown, alt?: unknown): Optional<T> => (!isPrimitive(t) && t instanceof c ? t : alt ? ifA(c, alt) : undefined);\n\nexport type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &\n  {\n    [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n  }[Keys];\n","import { isPrimitive } from './Primitive';\nimport { Identity } from './Identity';\nimport { use } from './Constructor';\nimport { isDefined, isObject } from './Is';\n\nexport const isA = <T>(t?: unknown, ...properties: (keyof T)[]): t is T => !isPrimitive(t) && properties.every(p => p.toString() in (t as any));\nexport const isAn = isA;\nexport const isIdentity = (by: unknown): by is Identity => use(by as Identity, b => isObject(b) && isDefined(b.id));\n","import { Func, isFunc } from './Func';\n\nexport type Get<T = any, Args = any> = Func<T, Args> | T;\nexport type Predicate<Args = unknown> = Get<boolean, Args>;\nexport const ofGet = <T, Args = any>(g: Get<T, Args>, ...args: Args[]): T => (isFunc<T, Args>(g) ? g(...args) : g);\nexport const ifGet = <T>(pred: Get, valid: Get<T>, invalid: Get<T>): T => (ofGet(pred) ? ofGet(valid) : ofGet(invalid));\nexport type GetProperty<T, Prop> = keyof T | Func<Prop, T>;\nexport const ofProperty = <T, Prop>(t: T, p: GetProperty<T, Prop>): Prop => (isFunc<Prop, T>(p) ? p(t) : ((t as any)[p] as Prop));\n","import { isArray, isDefined } from './Is';\nimport { on, use } from './Constructor';\n\nexport type OneOrMore<T> = T | Array<T>;\nexport type ArrayLike<T> = OneOrMore<T>[];\n\nexport const toArray = <T>(...items: ArrayLike<T>): T[] =>\n  items.length > 1 ? (items as T[]) : isArray(items[0]) ? items[0] : isDefined(items[0]) ? [items[0]] : [];\n\nexport const toObject = <T>(key: keyof T, ...items: ArrayLike<T>): Record<string | number | symbol, T> =>\n  toArray(...items).reduce((o: any, i) => {\n    o[i[key]] = i;\n    return o;\n  }, {});\n\nexport const array = {\n  merge: (first: any[] = [], second: any[] = [], firstKey = 'id', secondKey = 'id'): any[] =>\n    first.map(f => ({\n      ...f,\n      ...second.find(s => isDefined(s[secondKey]) && isDefined(f[firstKey]) && s[secondKey] === f[firstKey]),\n    })),\n  switch: <T>(items: T[] = [], item: T): T[] =>\n    use([...items], res => {\n      on(res.indexOf(item), i => (i !== -1 ? res.splice(i, 1) : res.push(item)));\n      return res;\n    }),\n  splitIn: <T>(items: T[] = [], length = 2): T[][] => {\n    const res: T[][] = Array.from({ length }, () => []);\n    items.forEach((i, index) => res[index % length].push(i));\n    return res;\n  },\n  chunk: <T>(items: T[] = [], length = 2): T[][] => {\n    const chunks = Math.ceil(items.length / length);\n    const res: T[][] = Array.from({ length: chunks }, () => []);\n    items.forEach((i, index) => res[Math.floor(index / chunks)].push(i));\n    return res;\n  },\n};\n","import { isDefined } from './Is';\nimport { isFunc } from './Func';\nimport { Get, ofGet } from './Get';\n\nexport type Text = { toString(): string };\n\nexport const isText = (t?: unknown): t is Text => isDefined(t) && isFunc<string, any>((t as any).toString);\n\nexport const asString = (t?: unknown, alt: Get<Text> = ''): string => (isText(t) ? t : ofGet(alt)).toString();\n\nexport const replaceAll = (origin: Text, search: Text, replace: Text = ''): string => asString(origin).split(asString(search)).join(asString(replace));\n\nexport const toWords = (input: unknown): string[] => {\n  return asString(input)\n    .replace(/(\\p{Lower})(\\p{Upper})/gu, '$1 $2')\n    .replace(/(\\p{Upper})(\\p{Upper}\\p{Lower})/gu, '$1 $2')\n    .split(/[_\\W]+/g)\n    .filter(Boolean);\n};\n\nexport const kebab = (s = ''): string => toWords(s).join('-').toLowerCase();\n\nexport const capitalize = (s = ''): string => s.charAt(0).toUpperCase() + s.slice(1);\n","import { AnyKey } from '../types/AnyKey';\n\nexport const traverse = (subject: unknown, property = ''): unknown => {\n  subject ??= {};\n  const props = property.split('.');\n  const p = props.shift() as string;\n  return props.length === 0 ? (subject as any)[p] : traverse((subject as any)[p], props.join('.'));\n};\n\nexport const traverseSet = <T>(subject: T, property: AnyKey<T>, value: unknown): unknown => {\n  const props = property.split('.');\n  const p = props.shift() as string;\n  return {\n    ...(subject as any),\n    [p]: props.length === 0 ? value : traverseSet((subject as any)[p], props.join('.'), value),\n  } as T;\n};\n\nexport const accumulate = <T>(items: T[], ...keys: AnyKey<T>[]): T[] =>\n  items.map((t, i, arr) => {\n    const acc = keys.reduce(\n      (acc, v) => traverseSet(acc, v, i === 0 ? traverse(t, v) : (traverse(arr[i - 1], v) as number) + (traverse(t, v) as number)) as T,\n      t\n    );\n    arr[i] = acc;\n    return acc;\n  });\n","import { ArrayLike, toArray } from './Array';\nimport { Constructor, on, use } from './Constructor';\nimport type { Json } from './Json';\nimport { isArray, isDefined, isEmpty } from './Is';\nimport { isA } from './IsA';\nimport { Get, GetProperty, ofGet, ofProperty } from './Get';\nimport type { Id } from './Id';\nimport { asString } from './Text';\nimport { Optional } from './Types';\nimport { ifDefined, ifTrue } from '../utils/If';\nimport { AnyKey } from './AnyKey';\nimport { traverse } from '../utils/Traverse';\nimport { Indexed } from './Indexed';\n\ntype Pred<T> = (value: T, index: number, obj: T[]) => unknown;\n\nexport class List<T = unknown> extends Array<T> {\n  get ids(): List<Id> {\n    return this.mapDefined(i => (i as any).id as Id);\n  }\n\n  get indexed(): List<Indexed<T>> {\n    return this.map((v, index) => ({ ...v, index }));\n  }\n\n  isSubSetOf(...items: ArrayLike<T>): boolean {\n    return this.diff(items).length === 0;\n  }\n\n  isSuperSetOf(...items: ArrayLike<T>): boolean {\n    return this.length > items.length && toList(...items).isSubSetOf(...this);\n  }\n\n  isIntersectingWith(...items: ArrayLike<T>): boolean {\n    return this.intersect(items).length > 0;\n  }\n\n  isDisjointWith(...items: ArrayLike<T>): boolean {\n    return !this.isIntersectingWith(...items);\n  }\n\n  areEqual(...items: ArrayLike<T>): boolean {\n    return this.isSubSetOf(...items) && toList(...items).isSubSetOf(...this);\n  }\n\n  asc(p: GetProperty<T, any>): List<T> {\n    return this.sort((e1, e2) => (ofProperty(e1, p) > ofProperty(e2, p) ? 1 : -1));\n  }\n\n  desc(p: GetProperty<T, any>): List<T> {\n    return this.sort((e1, e2) => (ofProperty(e1, p) < ofProperty(e2, p) ? 1 : -1));\n  }\n\n  first(p?: Pred<T>, params?: unknown): T {\n    return (p ? this.find(p, params) : this[0]) as T;\n  }\n\n  firstValue<V>(f: (t: T) => V, alt?: Get<V, T>): Optional<V> {\n    return ifDefined(\n      this.first(t => !!f(t)),\n      f,\n      v => ofGet(alt, v)\n    );\n  }\n\n  isFirst(value: T): boolean {\n    return value === this.first();\n  }\n\n  next(p?: Pred<T>, params?: unknown): T {\n    return p ? this[this.findIndex(p, params) + 1] : this[0];\n  }\n\n  prev(p?: Pred<T>, params?: unknown): T {\n    return p ? this[this.findIndex(p, params) - 1] : this[0];\n  }\n\n  last(p?: Pred<T>, params?: unknown): T {\n    return p ? this.filter(p, params).last() : this[this.length - 1];\n  }\n\n  isLast(value: T): boolean {\n    return value === this.last();\n  }\n\n  overlaps(...items: ArrayLike<T>): boolean {\n    return toList<T>(...items).some(i => this.some(t => i === t));\n  }\n\n  diff(others: ArrayLike<T>): List<T> {\n    return this.filter(i => !others.includes(i));\n  }\n\n  diffByKey<U = T>(others: ArrayLike<U>, key: keyof T & keyof U): List<T> {\n    return this.filter((i: any) => !others.some((o: any) => o[key] === i[key]));\n  }\n\n  symmetricDiff(others: ArrayLike<T>): List<T> {\n    return this.diff(others).concat(toList<T>(...others).diff(this));\n  }\n\n  symmetricDiffByKey(others: ArrayLike<T>, key: keyof T): List<T> {\n    return this.diffByKey(others, key).concat(toList<T>(...others).diffByKey(this, key));\n  }\n\n  intersect(others: ArrayLike<T>): List<T> {\n    return this.filter(i => others.includes(i));\n  }\n\n  intersectByKey<U>(others: ArrayLike<U>, key: keyof T & keyof U): List<T> {\n    return this.filter((i: any) => others.some((o: any) => o[key] === i[key]));\n  }\n\n  intersectBy<U>(others: ArrayLike<U>, f: (value: T, value2: U) => boolean): List<T> {\n    return this.filter(i => others.some(o => f(i, o as U)));\n  }\n\n  accumulate(...keys: (keyof T)[]): List<T> {\n    return this.map((d, i, arr) => {\n      const acc = keys.reduce((acc, v) => {\n        (acc as any)[v] = i === 0 ? d[v] : (arr[i - 1][v] as number) + (d[v] as number);\n        return acc;\n      }, d);\n      arr[i] = acc;\n      return acc;\n    });\n  }\n\n  toJSON(): Json[] {\n    return this.reduce((a, i) => {\n      a.push(JSON.parse(JSON.stringify(i ?? {})));\n      return a;\n    }, new Array<Json>());\n  }\n\n  map<U>(f: (value: T, index: number, array: T[]) => U, params?: unknown): List<U> {\n    return toList<U>(super.map(f, params));\n  }\n\n  flatMap<U, This = unknown>(f: (this: This, value: T, index: number, array: T[]) => ReadonlyArray<U> | U, params?: This): List<U> {\n    return toList<U>(super.flatMap(f, params));\n  }\n\n  mapDefined<U>(f: (value: T, index: number, array: T[]) => U, params?: unknown): List<NonNullable<U>> {\n    return this.map(f, params).defined();\n  }\n\n  mapAsync(f: (i: T) => Promise<T>): Promise<List<T>> {\n    return Promise.all(super.map(e => f(e))).then(a => toList<T>(a));\n  }\n\n  mapSerial<U>(f: (i: T) => Promise<U>): Promise<List<U>> {\n    return super.reduce((p, item) => p.then(results => on(results, async r => r.push(await f(item)))), Promise.resolve(toList<U>()));\n  }\n\n  distinct(): List<T> {\n    return this.filter((i, index) => this.indexOf(i) === index);\n  }\n\n  distinctByKey(key: keyof T): List<T> {\n    const seen = new Set<T[keyof T]>();\n    return this.filter(item => !seen.has(item[key]) && seen.add(item[key]));\n  }\n\n  distinctByValue(): List<T> {\n    const seen = new Set<string>();\n    return this.filter(item => !seen.has(JSON.stringify(item)) && seen.add(JSON.stringify(item)));\n  }\n\n  filter(p: Pred<T>, params?: unknown): List<T> {\n    return toList<T>(super.filter(p, params));\n  }\n\n  sum(p: (t: T) => number): number {\n    return this.reduce((sum: number, i) => sum + p(i), 0);\n  }\n\n  max(p: (value: T) => any): T;\n\n  max(key: keyof T): T;\n\n  max(p: keyof T | ((value: T) => any)): T {\n    return typeof p === 'function' ? this.sort((e1, e2) => (p(e1) < p(e2) ? 1 : -1)).first() : this.desc(p).first();\n  }\n\n  min(key: keyof T): T;\n\n  min(p: (value: T) => any): T;\n\n  min(p: keyof T | ((value: T) => any)): T {\n    return typeof p === 'function' ? this.sort((e1, e2) => (p(e1) > p(e2) ? 1 : -1)).first() : this.asc(p).first();\n  }\n\n  byId(id: Id): T {\n    return this.first(i => asString((i as any).id) === asString(id));\n  }\n\n  byKey(key: keyof T, value: unknown): T {\n    return this.first(i => i[key] == value);\n  }\n\n  add(...items: ArrayLike<T>): this {\n    super.push(...toArray(...items));\n    return this;\n  }\n\n  concat(...items: ConcatArray<T>[]): List<T>;\n\n  concat(...items: (T | ConcatArray<T>)[]): List<T>;\n\n  concat(...items: (T | ConcatArray<T>)[]): List<T> {\n    return toList<T>(super.concat(...items));\n  }\n\n  reverse(): List<T> {\n    return toList<T>(super.reverse());\n  }\n\n  splice(start: number, deleteCount?: number): List<T>;\n\n  splice(start: number, deleteCount: number, ...items: T[]): List<T>;\n\n  splice(start: number, deleteCount: number, ...items: T[]): List<T> {\n    return toList<T>(super.splice(start, deleteCount, ...items));\n  }\n\n  remove(item: T): List<T> {\n    const index = this.indexOf(item);\n    if (index > -1) {\n      this.splice(index, 1);\n    }\n    return this;\n  }\n\n  replace(key: keyof T, item: T): List<T> {\n    const index = this.findIndex(i => i[key] === item?.[key]);\n    ifTrue(index != -1, () => this.splice(index, 1, item));\n    return this;\n  }\n\n  switch(item: T): List<T> {\n    return this.includes(item) ? this.remove(item) : this.add(item);\n  }\n\n  switchOn<U = T>(item: U, on: AnyKey<U>): List<T>;\n\n  switchOn<T>(item: T, on: Pred<T>): List<T>;\n\n  switchOn<U = T>(item: T, on: AnyKey<U> | Pred<T>): List<T> {\n    return use(typeof on === 'function' ? this.find(on) : use(traverse(item, on), v => this.find(i => traverse(i, on) === v)), i =>\n      i ? this.remove(i) : this.add(item)\n    );\n  }\n\n  defined(): List<NonNullable<T>> {\n    return this.reduce((l, v) => (isDefined(v) ? l.add(v) : l), toList<NonNullable<T>>());\n  }\n\n  toObject(key: keyof T, options: { deleteKey?: boolean } = {}): Record<string | number | symbol, T> {\n    return this.reduce((o: any, i) => {\n      o[i[key]] = i;\n      if (options.deleteKey) delete o[i[key]][key];\n      return o;\n    }, {});\n  }\n\n  toObjectList(key: keyof T): Record<string | number | symbol, List<T>> {\n    return this.reduce(\n      (a, t) => {\n        const k = t[key] as unknown as string | number | symbol;\n        a[k] = a[k] ?? toList();\n        a[k].push(t);\n        return a;\n      },\n      {} as Record<string | number | symbol, List<T>>\n    );\n  }\n\n  orElse(...alt: ArrayLike<T>): Optional<List<T>> {\n    return !isEmpty(this) ? this : !isEmpty(...alt) ? toList<T>(...alt) : undefined;\n  }\n\n  weave(insertFrom: T[], interval: number): this {\n    for (let i = interval, n = 0; i <= this.length && n < insertFrom.length; i += interval + 1) {\n      this.splice(i, 0, insertFrom[n++]);\n    }\n    return this;\n  }\n\n  slice(start?: number, end?: number): List<T> {\n    return toList(super.slice(start, end));\n  }\n\n  none(p: (t: T) => boolean): boolean {\n    return !this.some(p);\n  }\n\n  chunk(chunkSize: number): List<List<T>> {\n    return this.reduce((acc, _, index) => (index % chunkSize === 0 ? on(acc, a => a.push(this.slice(index, index + chunkSize))) : acc), toList<List<T>>());\n  }\n\n  //we needed to add U because of a Typescript issue with generics\n  update<U = T>(p: Pred<T>, val: T | ((v: U) => T)): List<T> {\n    return this.map((v, i, a) => (p(v, i, a) ? ofGet<T>(val, v, i, a) : v));\n  }\n\n  updateFirst<U = T>(p: Pred<T>, val: T | ((v: U) => T)) {\n    const index = this.findIndex(p);\n    return this.update((t, i) => p(t, i, this) && i == index, val);\n  }\n\n  updateFirstById<U = T>(id: Id, val: T | ((v: U) => T)) {\n    return this.updateFirst(i => asString((i as any)?.id) === asString(id), val);\n  }\n\n  updateById<U = T>(id: Id, val: T | ((v: U) => T)) {\n    return this.update(i => asString((i as any)?.id) === asString(id), val);\n  }\n}\n\nexport const toList = <T = unknown>(...items: ArrayLike<T>): List<T> => new List<T>().add(...items);\n\nexport const isList = <T>(l?: unknown): l is List<T> => isDefined(l) && isArray(l) && isA<List<T>>(l, 'first', 'last', 'asc', 'desc');\n\nexport const asList = <T>(c: Constructor<T>, items: unknown = []): List<T> => toList<T>(toArray(items).map(i => new c(i)));\n\nexport const maxValue = <T>(l: List<T>, key: keyof T): T[keyof T] | undefined => l.desc(key).first()?.[key];\n\nexport const minValue = <T>(l: List<T>, key: keyof T): T[keyof T] | undefined => l.asc(key).first()?.[key];\n","import { isDefined, isNotEmpty, isPresent, isTrue } from '../types/Is';\nimport { Optional } from '../types/Types';\nimport { Construct, ofConstruct, use } from '../types/Constructor';\nimport { OneOrMore } from '../types/Array';\nimport { toList } from '../types/List';\n\nexport function ifTrue<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;\nexport function ifTrue<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifTrue<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out> {\n  return isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o);\n}\n\nexport function ifFalse<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;\nexport function ifFalse<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifFalse<Out, In = unknown>(o: unknown, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out> {\n  return !isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o);\n}\n\nexport function ifDefined<Out, In = unknown>(o: Optional<In>, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;\nexport function ifDefined<Out, In = unknown>(o: Optional<In>, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifDefined<Out, In = unknown>(o: Optional<In>, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out> {\n  return isDefined(o) ? ofConstruct(f, o) : ofConstruct(alt);\n}\n\nexport function ifNotEmpty<Out, In = unknown>(o: In, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;\nexport function ifNotEmpty<Out, In = unknown>(o: In, f?: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifNotEmpty<Out, In = unknown>(o: In, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifNotEmpty<Out, In = unknown>(o: In, f: Construct<Out, NonNullable<In>> = o => o as Out, alt?: Construct<Out>): Optional<Out> {\n  return isNotEmpty(o) ? ofConstruct(f, o) : ofConstruct(alt, o);\n}\n\nexport function ifEither<Out, In = unknown>(os: OneOrMore<In>, f: Construct<Out, NonNullable<In>>, alt: Construct<Out>): Out;\nexport function ifEither<Out, In = unknown>(os: OneOrMore<In>, f?: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifEither<Out, In = unknown>(os: OneOrMore<In>, f: Construct<Out, NonNullable<In>>, alt?: Construct<Out>): Optional<Out>;\nexport function ifEither<Out, In = unknown>(os: OneOrMore<In>, f: Construct<Out, NonNullable<In>> = o => o as Out, alt?: Construct<Out>): Optional<Out> {\n  return use(\n    toList(os).first(o => isPresent(o)),\n    o => (isDefined(o) ? ofConstruct(f, o) : ofConstruct(alt, o))\n  );\n}\n","import { List, toList } from './List';\nimport { ifDefined } from '../utils/If';\n\nexport type Entry<T = unknown> = [key: string, value: T];\n\nexport function entries<T = unknown>(subject: { [p: string]: T } | ArrayLike<T>): List<Entry<T>> {\n  return ifDefined(\n    subject,\n    () => toList<Entry<T>>([...Object.entries(subject), ...Object.entries(Object.getPrototypeOf(subject))] as Entry<T>[]),\n    () => toList<Entry<T>>()\n  );\n}\n\nexport function values<T = unknown>(subject: { [p: string]: T } | ArrayLike<T>): List<T> {\n  return toList([...Object.values<T>(subject), ...Object.values<T>(Object.getPrototypeOf(subject))]);\n}\n\nexport function keys<T = unknown>(subject: { [p: string]: T } | ArrayLike<T>): List<string> {\n  return toList([...Object.keys(subject), ...Object.keys(Object.getPrototypeOf(subject))]);\n}\n\nexport function extractKeys<T extends Record<string | number, unknown>, K extends keyof T>(\n  obj: T,\n  keys: K[] | readonly (keyof T)[]\n): {\n  keys: Pick<T, K>;\n} & Omit<T, K> {\n  return keys\n    .filter((k): k is K => k in obj)\n    .reduce(\n      (acc, key) => {\n        (acc.keys as T)[key] = obj[key];\n        delete acc[key];\n        return acc;\n      },\n      { keys: {} as Pick<T, K>, ...obj }\n    );\n}\n","import { isA } from './IsA';\nimport { isDefined, isEmpty, isObject } from './Is';\nimport { Get, ofGet } from './Get';\nimport { ifDefined } from '../utils/If';\nimport { TypeGuard } from './TypeGuard';\nimport { entries } from './Object';\n\nexport type JsonValue = string | number | boolean | null | Json | JsonValue[];\nexport type Json = { [key: string]: JsonValue };\n\nexport const isJson: TypeGuard<{ toJSON: () => Json }> = (subject?: unknown): subject is { toJSON: () => Json } =>\n  isA<{ toJSON: () => Json }>(subject, 'toJSON');\n\nexport const json = {\n  parse: <T extends Json = Json>(subject: unknown): T => JSON.parse(JSON.stringify(subject ?? {})),\n  merge: (...subjects: unknown[]): Json => json.parse(subjects.map(s => asJson(s, s => json.parse(s))).reduce((js, j) => ({ ...js, ...j }), {})),\n  delete: <T extends Json = Json>(subject: T, key: string): T => {\n    ifDefined(subject, () => delete (subject as any)[key]);\n    return subject;\n  },\n  set: <T extends Json = Json>(subject: T, key = '', value?: unknown): T =>\n    isEmpty(key) ? subject : value !== undefined ? { ...(subject as any), ...{ [key]: value as JsonValue } } : json.delete(subject, key),\n  omit: <T extends Json = Json>(subject: T, ...keys: string[]): T => keys.reduce((js, k) => json.delete(js, k), json.parse<T>(subject)),\n  pick: <T extends Json = Json>(subject: T, ...keys: string[]): T => keys.reduce((js, k) => json.set(js, k, (subject as any)[k]), {} as T),\n  defaults: <T extends Json = Json>(options: Partial<T> = {}, defaults: Partial<T> = {}): T => json.merge(defaults, options) as T,\n  isSubset: (subject: Json, subset: Json): boolean => !entries(subset).some(([k, v]) => subject[k] !== v),\n  split: <T extends Record<string, unknown>, K extends string = 'extracted'>(\n    t: T,\n    keys: readonly (keyof T)[],\n    prop: K = 'extracted' as K\n  ): {\n    [P in K]: Partial<T>;\n  } => {\n    const extracted = {} as Partial<T>;\n    const rest = { ...t };\n    keys.forEach(key => {\n      if (key in t) {\n        ifDefined(t[key], v => (extracted[key] = v));\n        delete rest[key as string];\n      }\n    });\n    return { [prop]: extracted, ...rest };\n  },\n};\n\nexport const toJson = json.merge;\n\nexport const asJson = (j?: unknown, alt: Get<Json> = {}): Json => (isJson(j) ? j.toJSON() : isObject(j) ? (j as Json) : ofGet(alt, j));\n\nclass Any<T extends Json> {\n  constructor(readonly value: T) {}\n\n  merge = (...subjects: T[]): Any<T> => any<T>(json.merge(this.value, ...subjects) as T);\n  delete = (key: keyof T): Any<T> => any<T>(json.delete<T>(this.value, key as string));\n  omit = (...keys: (keyof T)[]): Any<T> => any<T>(json.omit<T>(this.value, ...(keys as string[])));\n  set = (key: keyof T, value?: unknown): Any<T> => any<T>(json.set(this.value, key as string, value));\n\n  toJSON(): Json {\n    return this.value;\n  }\n}\n\nexport const takeFirstKey = (j: unknown, alt: string = ''): string => entries(asJson(j)).first(([, v]) => isDefined(v))?.[0] ?? alt;\n\nexport const any = <T extends Json = Json>(value: T): Any<T> => new Any<T>(value);\n","import { asString } from '../types/Text';\n\nexport class Convert<From = unknown, To = unknown> {\n  constructor(\n    public readonly from: (f: From) => To,\n    public readonly to: (t: To) => From\n  ) {}\n}\n\nexport const convert = {\n  default: new Convert<any, any>(\n    a => a,\n    a => a\n  ),\n  ignore: new Convert<any, any>(\n    () => undefined,\n    () => undefined\n  ),\n  toBool: {\n    fromNumber: new Convert<boolean, number>(\n      b => (b ? 1 : 0),\n      n => n !== 0\n    ),\n    fromString: new Convert<boolean, string>(\n      b => (b ? 'true' : 'false'),\n      s => s === 'true'\n    ),\n  },\n  toDate: {\n    fromString: new Convert<string, string>(\n      s => new Date(s).toISOString(),\n      s => s\n    ),\n  },\n  toNumber: {\n    fromString: new Convert<number, string>(\n      n => asString(n),\n      s => parseInt(s)\n    ),\n  },\n};\n","import { json, Json, JsonValue } from '../types/Json';\nimport { Sort } from '../types/Sort';\nimport { convert, Convert } from '../utils/Convert';\nimport { isDefined } from '../types/Is';\n\nexport class Condition {\n  constructor(\n    readonly key: string,\n    readonly operator: string,\n    readonly value: unknown\n  ) {}\n\n  and = (...others: Condition[]): LogicalCondition => new LogicalCondition('and', [this, ...others]);\n  or = (...others: Condition[]): LogicalCondition => new LogicalCondition('or', [this, ...others]);\n\n  toJSON(): Json {\n    return { [this.key]: { [`$${this.operator}`]: json.parse(this.value) } };\n  }\n}\n\nexport class LogicalCondition {\n  constructor(\n    readonly operator: string,\n    readonly conditions: Condition[]\n  ) {}\n\n  toJSON(): Json {\n    return { [`$${this.operator}`]: this.conditions.map(c => c.toJSON()) };\n  }\n}\n\nexport class SortCondition extends Condition implements Sort {\n  constructor(\n    readonly key: string,\n    readonly value: -1 | 1\n  ) {\n    super(key, '', value);\n  }\n\n  toJSON(): Json {\n    return { [this.key]: this.value };\n  }\n}\n\nexport const toCondition = (field: string, operator: string, value: unknown, conv: Convert = convert.default): Condition =>\n  new Condition(field, operator, conv.from(value) as JsonValue);\n\nexport const isSortCondition = (s?: unknown): s is SortCondition => isDefined(s) && s instanceof SortCondition;\n","import 'reflect-metadata';\nimport { List, toList } from './List';\nimport { isDefined } from './Is';\nimport { on, use } from './Constructor';\nimport { Optional } from './Types';\nimport { Entry, entries, values } from './Object';\n\ntype MetaParseOptions = { initial?: any; skipUndefined?: boolean };\n\nclass ClassMeta {\n  constructor(\n    readonly subject: any,\n    private readonly data: any = (subject.prototype ?? subject).constructor\n  ) {}\n\n  get = <T>(key: string): T => Reflect.getMetadata(key, this.data) as T;\n\n  set = <T>(key: string, value: T): T => {\n    Reflect.defineMetadata(key, value, this.data);\n    return value;\n  };\n\n  entries = <T = unknown>(): List<Entry<T>> => entries<T>(this.subject);\n\n  parse = <Out, Value>(f: (v: Value) => Out, options: MetaParseOptions = {}): Record<string, Out> => {\n    const { initial = {}, skipUndefined = false } = options;\n    return this.entries<Value>().reduce((a, [k, val]) => use(f(val), v => (isDefined(v) || !skipUndefined ? on(a, a => (a[k] = v)) : a)), initial);\n  };\n\n  properties = (key?: string): List<PropertyMeta> =>\n    toList([...Object.getOwnPropertyNames(this.subject), ...Object.getOwnPropertyNames(Object.getPrototypeOf(this.subject))])\n      .map(p => this.property(p))\n      .filter(p => (key ? p.get(key) : p));\n\n  keys = <T = any>(key: string): List<T> =>\n    this.properties()\n      .map(p => p.get<T>(key))\n      .reduce((list, u) => (u ? list.add(u) : list), toList<T>());\n\n  values = <T = unknown>(): List<T> => values<T>(this.subject);\n\n  property = (property: string | symbol): PropertyMeta => new PropertyMeta(this.subject, property);\n}\n\nclass PropertyMeta {\n  constructor(\n    readonly subject: any,\n    readonly property: string | symbol,\n    private readonly data = Reflect.getMetadata(property, subject)\n  ) {}\n\n  get value(): any {\n    return this.subject[this.property];\n  }\n\n  get = <T>(key: string): Optional<T> => (isDefined(this.data) && isDefined(this.data[key]) ? (this.data[key] as T) : undefined);\n\n  set = <T>(key: string, value: T): T => {\n    Reflect.defineMetadata(this.property, { ...this.data, [key]: value }, this.subject);\n    return value;\n  };\n}\n\nexport const meta = (subject: unknown): ClassMeta => new ClassMeta(subject ?? {});\n","import { Id } from './Id';\nimport { List, toList } from './List';\nimport { isAn } from './IsA';\nimport { meta } from './Meta';\nimport { isDefined, isFunction } from './Is';\nimport { Validatable } from './Validatable';\nimport { JsonValue } from './Json';\nimport { Get, ofGet } from './Get';\nimport { TypeGuard } from './TypeGuard';\n\nexport type EnumConstructor<E = unknown> = {\n  byIds<E extends Enum>(ids: Id[]): List<E>;\n  byId<E extends Enum>(id: Id, alt?: Get<E, unknown>): E;\n  isEnum: boolean;\n};\n\nexport const isEnumConstructor = <E = unknown>(c: unknown): c is EnumConstructor<E> => isFunction(c) && (c as any).isEnum;\n\nexport abstract class Enum implements Validatable {\n  static isEnum = true;\n\n  protected constructor(\n    readonly name: string,\n    readonly id: Id = name.toLowerCase(),\n    readonly code: string = id.toString()\n  ) {}\n\n  get isValid(): boolean {\n    return isDefined(this.id);\n  }\n\n  static all<E extends Enum>(): List<E> {\n    return meta(this.allTuple<E>()).values<E>();\n  }\n\n  static filter<E extends Enum>(p: (value: E, index: number, array: E[]) => unknown, params?: unknown): List<E> {\n    return this.all<E>().filter(p, params);\n  }\n\n  static first<E extends Enum>(p?: (value: E, index: number, array: E[]) => unknown, params?: unknown): E {\n    return this.all<E>().first(p, params);\n  }\n\n  static byIds<E extends Enum>(ids: Id[] = []): List<E> {\n    return toList(ids)\n      .mapDefined(id => this.byId<E>(id))\n      .distinct();\n  }\n\n  static byId<E extends Enum>(id: Id, alt?: Get<E, unknown>): E {\n    return this.allTuple<E>()[id] ?? ofGet(alt);\n  }\n\n  protected static allTuple<E extends Enum>(): Record<Id, E> {\n    return meta(this).get(`all-${this.name}`) ?? meta(this).set(`all-${this.name}`, meta(this).values<E>().filter(isEnum).toObject('id'));\n  }\n\n  equals<E extends Enum>(other: E | Id): other is E {\n    return this.id === (isEnum(other) ? other.id : other);\n  }\n\n  isIn<E extends Enum>(...items: E[] | Id[]): boolean {\n    return items.some(i => this.equals(i));\n  }\n\n  toJSON(): JsonValue {\n    return this.id;\n  }\n\n  toString(): string {\n    return this.id.toString();\n  }\n}\n\nexport const isEnum: TypeGuard<Enum> = (e?: unknown): e is Enum => isDefined(e) && e instanceof Enum && isAn<Enum>(e, 'name', 'id', 'code');\n","import { List, toList } from './List';\nimport { asString, Text } from './Text';\nimport { toName } from './Constructor';\nimport { entries } from './Object';\nimport { text, textValue } from './ToText';\n\nexport type TemplateOptions = { type?: Text; property?: Text; actual?: Text; subject?: Text };\n\nexport class Template implements Text {\n  constructor(\n    private readonly template: string,\n    private readonly subject: unknown = {},\n    private readonly options: TemplateOptions = {}\n  ) {}\n\n  toString = (): string => {\n    return entries(this.options)\n      .reduce((t, [k]) => this.option(t, k), this.object())\n      .replace('  ', ' ');\n  };\n\n  private readonly props = (tmpl: string, key: string, result: List<string> = toList()): string[] => {\n    const i1 = tmpl.indexOf(`{${key}`);\n    if (i1 < 0) {\n      return result;\n    }\n    const i2 = tmpl.indexOf('}', i1);\n    return this.props(tmpl.slice(i2 + 1), key, result.add(tmpl.substring(i1 + 1, i2)));\n  };\n\n  private readonly object = (): string => {\n    return this.props(this.template, 'this').reduce((t: string, p) => t.replace(`{${p}}`, textValue(this.subject, p.replace('this.', ''))), this.template);\n  };\n\n  private readonly option = (tmpl: string, prop: string): string => {\n    return this.props(tmpl, prop).reduce((t: string, p) => t.replace(`{${p}}`, textValue(this.options, p)), tmpl);\n  };\n}\n\nexport function template(tmpl: Text, subject: unknown, options: TemplateOptions = {}): Text {\n  return new Template(asString(tmpl), subject, {\n    type: toName(subject),\n    subject: text(JSON.stringify(subject)),\n    ...options,\n  });\n}\n","import { asString, capitalize, replaceAll, Text } from './Text';\nimport { toName } from './Constructor';\nimport { Optional } from './Types';\nimport { Get, ofGet } from './Get';\nimport { isEmpty, isNotEmpty } from './Is';\nimport { List, toList } from './List';\nimport { JsonValue } from './Json';\nimport { template } from './Template';\n\nexport class ToText implements Text {\n  constructor(readonly subject: string) {}\n\n  get cap(): ToText {\n    return this.map(s => capitalize(s?.toLowerCase()));\n  }\n\n  get capFirst(): ToText {\n    return this.map(s => capitalize(s));\n  }\n\n  get title(): ToText {\n    return this.map(s =>\n      s\n        .split(' ')\n        .map(w => text(w).cap)\n        .join(' ')\n    );\n  }\n\n  get pascal(): ToText {\n    return this.title.replace(' ', '');\n  }\n\n  get lower(): ToText {\n    return this.map(s => s.toLowerCase());\n  }\n\n  get upper(): ToText {\n    return this.map(s => s.toUpperCase());\n  }\n\n  get camel(): ToText {\n    return this.title.trim.map(s => `${s.charAt(0).toLowerCase()}${s.slice(1)}`);\n  }\n\n  get kebab(): ToText {\n    return this.lower.replace(' ', '-');\n  }\n\n  get strictKebab(): ToText {\n    return this.map(s => s.replace(/[^a-z\\d]+/gi, ' ').trim()).kebab;\n  }\n\n  get slug(): ToText {\n    return this.map(s =>\n      s\n        .replace(/ß/g, 'ss')\n        .normalize('NFKD')\n        .replace(/[\\u0300-\\u036F]/g, '')\n        .toLowerCase()\n        .replace(/[^a-z\\d]+/g, '-')\n        .replace(/(^-)|(-$)/g, '')\n    );\n  }\n\n  get snake(): ToText {\n    return this.upper.replace(' ', '_');\n  }\n\n  get plural(): ToText {\n    return this.ifLike('') ?? this.add('s');\n  }\n\n  get space(): ToText {\n    return this.map(s => s.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]/g, ' '));\n  }\n\n  get sentence(): ToText {\n    return this.isEmpty ? this : this.map(s => `${s.charAt(0).toUpperCase()}${s.slice(1)}.`);\n  }\n\n  get initials(): ToText {\n    return this.map(s =>\n      s\n        .split(' ')\n        .map(w => w[0])\n        .join('')\n    );\n  }\n\n  get trim(): ToText {\n    return this.map(s => s.replace(/[- ,_#]/g, ''));\n  }\n\n  get trimSentence(): ToText {\n    return this.map(s =>\n      s\n        .replace(/[\\u200B-\\u200D\\uFEFF]/g, '')\n        .replace(/[\\s\\u00A0]+/g, ' ')\n        .replace(/\\s+([.,;:!?])/g, '$1')\n        .trim()\n    );\n  }\n\n  get isEmpty(): boolean {\n    return isEmpty(this.toString());\n  }\n\n  parse = (subject: unknown, options = {}): ToText => text(template(this.subject, subject, { type: toName(subject), ...options }));\n\n  is = (...others: unknown[]): boolean => others.some(o => this.toString() === text(o).toString());\n\n  equals = this.is;\n\n  isLike = (...others: unknown[]): boolean => others.some(o => this.trim.lower.is(text(o).trim.lower));\n\n  ifLike = (...others: unknown[]): Optional<this> => (this.isLike(...others) ? this : undefined);\n\n  endsWith = (end?: unknown): boolean => this.subject.endsWith(asString(end));\n\n  startsWith = (end?: unknown): boolean => this.subject.startsWith(asString(end));\n\n  first = (n: number): ToText => this.map(s => s.substring(0, n));\n\n  last = (n: number): ToText => this.map(s => s.substring(s.length - n));\n\n  map = (func: Get<string, string>): ToText => text(ofGet(func, this.subject));\n\n  replace = (search: Text, replace: Text): ToText => this.map(s => replaceAll(s, search, replace));\n\n  add = (add?: unknown, separator = ''): ToText => this.map(s => (isNotEmpty(add) ? `${s}${separator}${text(add)}` : s));\n\n  with = (separator: string, ...other: unknown[]): ToText =>\n    this.map(s =>\n      toList(s)\n        .add(...other.map(u => text(u).toString()))\n        .filter(s => isNotEmpty(s))\n        .join(separator)\n    );\n\n  split = (separator: string = ' '): List<string> => toList(this.subject.split(separator));\n\n  toString(): string {\n    return this.subject;\n  }\n\n  toJSON(): JsonValue {\n    return this.subject;\n  }\n}\n\nexport function text(subject?: unknown, alt = ''): ToText {\n  const sub = subject ? asString(subject) : alt;\n  return new ToText(sub !== '[object Object]' ? sub : '');\n}\n\nexport function textValue(subject: any, prop: string): string {\n  const p = prop.split('.');\n  const root = subject?.[p[0]];\n  const initial = typeof root === 'object' && root !== null ? root : text(root);\n  return (\n    p\n      .splice(1)\n      .reduce((t, s) => t?.[s], initial)\n      ?.toString() ?? ''\n  );\n}\n","import { asString, Text } from './Text';\nimport { Enum } from './Enum';\nimport { isDefined } from './Is';\nimport { Id } from './Id';\n\nimport { text } from './ToText';\n\nexport class Exception extends Enum {\n  static readonly AlreadyExists = new Exception('Subject already exists');\n  static readonly DoesNotExist = new Exception('Does not exist');\n  static readonly IsMissingId = new Exception('Subject is missing an id');\n  static readonly IsNotImplemented = new Exception('Is not implemented');\n  static readonly IsNotValid = new Exception('Is not valid');\n  static readonly Unknown = new Exception('Unknown error');\n\n  constructor(\n    readonly message: string,\n    id?: Id,\n    readonly reason?: Text\n  ) {\n    super(message, id ?? text(message).pascal.toString());\n  }\n\n  static readonly CouldNotExecute = (target: Text): Exception => new Exception(`Could not execute ${target}.`, 'CouldNotExecute');\n\n  static readonly CouldNotValidate = (target: Text): Exception => new Exception(`Could not validate ${target}.`, 'CouldNotValidate');\n\n  static readonly EnvironmentVariableNotFound = (variable: Text): Exception =>\n    new Exception(`Environment variable ${text(variable).upper} could not be found.`, 'EnvironmentVariableNotFound');\n\n  because = (reason: Text): Exception => new Exception(this.message, this.id, reason);\n}\n\nexport const isException = (e?: unknown, t?: Text): e is Exception => e instanceof Exception && (isDefined(t) ? e.equals(asString(t)) : true);\nexport const isDoesNotExist = (e?: unknown): e is Exception => e instanceof Exception && Exception.DoesNotExist.equals(e);\n","import { toArray } from '../types/Array';\nimport { ErrorOrigin } from '../types/ErrorOrigin';\nimport { List, toList } from '../types/List';\nimport { asString } from '../types/Text';\nimport { on, use } from '../types/Constructor';\nimport { keys, values } from '../types/Object';\n\ntype Pro<A> = A | PromiseLike<A>;\ntype Aw<A> = Awaited<A>;\n\nexport const resolve = <S = unknown>(subject: S | PromiseLike<S>): Promise<S> => Promise.resolve(subject);\nexport const reject = <S = never>(e: ErrorOrigin): Promise<S> => Promise.reject(e);\n\nexport const tuple = {\n  2: <F, S>(first: Pro<F>, second: Pro<S>): Promise<[Aw<F>, Aw<S>]> => Promise.all([first, second]),\n  3: <F, S, T>(first: Pro<F>, second: Pro<S>, third: Pro<T>): Promise<[Aw<F>, Aw<S>, Aw<T>]> => Promise.all([first, second, third]),\n  4: <F, S, T, Fo>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>): Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>]> =>\n    Promise.all([first, second, third, forth]),\n  5: <F, S, T, Fo, Fi>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>, fifth: Pro<Fi>): Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>, Aw<Fi>]> =>\n    Promise.all([first, second, third, forth, fifth]),\n  all: <F, S>(first: Pro<F>, second: Pro<S>[]): Promise<[Aw<F>, Aw<S[]>]> => Promise.all([first, Promise.all(second)]),\n  spread: <F, S>(first: Pro<F>, ...second: Pro<S>[]): Promise<[Aw<F>, Aw<S[]>]> => Promise.all([first, Promise.all(toArray(second))]),\n  list: <T>(list: Pro<T>[]): Promise<List<Aw<T>>> => Promise.all([...list]).then(toList),\n  settled: <T>(list: Pro<T>[]): Promise<{ fulfilled: List<Aw<T>>; rejected: List<string> }> =>\n    Promise.allSettled([...list]).then(rs => ({\n      fulfilled: toList(...rs.filter(r => r.status === 'fulfilled').map(r => r.value)),\n      rejected: toList(...rs.filter(r => r.status === 'rejected').map(r => asString(r.reason))),\n    })),\n  object: <T extends Record<string, unknown>>(obj: T): Promise<{ [K in keyof T]: Aw<T[K]> }> =>\n    use(keys(obj), ks => tuple.list(values(obj)).then(vs => vs.reduce((acc: any, v, i) => on(acc, a => (a[ks[i]] = v)), {}) as { [K in keyof T]: Aw<T[K]> })),\n};\n\nexport const tuple2 = tuple[2];\nexport const tuple3 = tuple[3];\nexport const tuple4 = tuple[4];\nexport const tuple5 = tuple[5];\nexport const tupleO = tuple.object;\nexport const settled = tuple.settled;\n","import { Json, JsonValue } from './Json';\nimport { Id } from './Id';\nimport { Exception } from './Exception';\nimport { PageList, PageOptions } from './PageList';\nimport { List } from './List';\nimport { Optional } from './Types';\nimport { reject } from '../utils/Promise';\n\nexport type FetchOptions = PageOptions;\n\nexport abstract class Gateway<Options = FetchOptions> {\n  all(options?: Options): Promise<PageList<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  byId(id: Id, options?: Options): Promise<Optional<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  by(_key: string, _value: JsonValue, _options?: Options): Promise<PageList<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  byIds(..._ids: Id[]): Promise<List<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  search(q: JsonValue, options?: Options): Promise<PageList<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  filter(options?: Options): Promise<PageList<Json>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  exists(id: Id, options?: Options): Promise<boolean> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  add(item: Json, options?: Options): Promise<Json> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  update(item: Json, options?: Options): Promise<Json> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  remove(id: Id, options?: Options): Promise<boolean> {\n    return reject(Exception.IsNotImplemented);\n  }\n}\n","import { validate } from './Validate';\nimport { Results } from '../types/Results';\nimport { Constructor } from '../types/Constructor';\nimport { Get, ofGet, Predicate } from '../types/Get';\nimport { isDefined, isEmpty, isIn } from '../types/Is';\nimport { toArray } from '../types/Array';\nimport { ErrorOrigin } from '../types/ErrorOrigin';\nimport { reject, resolve } from '../utils/Promise';\nimport { Exception } from '../types/Exception';\n\nexport class When<W> {\n  constructor(\n    readonly subject: W,\n    readonly valid = true,\n    private results?: Results\n  ) {}\n\n  get not(): When<W> {\n    return this.clone(!this.valid);\n  }\n\n  get and(): When<W> {\n    return this.clone(this.valid);\n  }\n\n  get isDefined(): When<W> {\n    return this.clone(this.valid === isDefined(this.subject));\n  }\n\n  get isEmpty(): When<W> {\n    return this.clone(this.valid === isEmpty(this.subject));\n  }\n\n  get isTrue(): When<W> {\n    return this.clone(this.valid === !!this.subject);\n  }\n\n  get isValid(): When<W> {\n    this.results = validate(this.subject);\n    return this.clone(this.valid === this.results.isValid);\n  }\n\n  isInstance = <U>(c: Constructor<U>): When<W> => this.clone(this.valid === this.subject instanceof c);\n\n  with = (pred: Predicate<W>): When<W> => this.clone(this.valid === ofGet(pred, this.subject));\n\n  contains = (property: (w: W) => unknown): When<W> => this.clone(this.valid === isDefined(ofGet(property, this.subject)));\n\n  in = (...items: W[]): When<W> => this.clone(this.valid === isIn(this.subject, toArray(...items)));\n\n  is = (item: W): When<W> => this.clone(this.valid === (this.subject === item));\n\n  reject = (error?: Get<ErrorOrigin, W>): Promise<NonNullable<W>> =>\n    !this.valid ? resolve(this.subject as NonNullable<W>) : reject(ofGet(error, this.subject) ?? this.results ?? Exception.Unknown);\n\n  recover = (f: (item: W) => W | Promise<W>): Promise<W> => resolve(!this.valid ? this.subject : f(this.subject));\n\n  protected clone = (result = true): When<W> => new When(this.subject, result, this.results);\n}\n\nexport const when = <T>(subject: T): When<T> => new When<T>(subject);\n","import { Uuid } from './Uuid';\nimport { Identity } from './Identity';\nimport { Optional } from './Types';\n\nimport { text } from './ToText';\n\nexport interface EnvContext {\n  readonly domain: string;\n  readonly name: string;\n  readonly host: string;\n  readonly port: number;\n  readonly app: string;\n\n  get(key: string, alt?: string): Optional<string>;\n}\n\nexport class DotEnvContext implements EnvContext {\n  readonly domain = process.env.DOMAIN ?? 'easy';\n  readonly name = process.env.ENVIRONMENT_NAME ?? '';\n  readonly host = process.env.HOST ?? '';\n  readonly port = Number.parseInt(process.env.PORT ?? '8080');\n  readonly app = process.env.APP ?? '';\n\n  readonly get = (key: string, alt?: string): Optional<string> => {\n    const k = text(key)\n      .map(k => k.replace(/([a-z])([A-Z])/g, '$1 $2'))\n      .snake.toString();\n    return process.env[k] ?? alt;\n  };\n}\n\nexport interface RequestContext {\n  token?: any;\n  identity?: Identity;\n  jwt: string;\n  correlationId?: Uuid;\n  lastError?: string;\n  lastErrorStack?: string;\n  create: (f: () => void) => void;\n\n  get<T>(key: string): T;\n\n  set<T>(key: string, value: T): T;\n\n  wrap<T>(f: () => Promise<T>): Promise<T>;\n}\n\nexport class BaseRequestContext implements RequestContext {\n  private state: any = {};\n\n  get token(): any {\n    return this.get('token');\n  }\n\n  set token(token: any) {\n    this.set('token', token);\n  }\n\n  get identity(): Identity {\n    return this.token as Identity;\n  }\n\n  get jwt(): string {\n    return this.get('jwt');\n  }\n\n  set jwt(jwt: string) {\n    this.set('jwt', jwt);\n  }\n\n  get correlationId(): Uuid {\n    return this.get('correlationId');\n  }\n\n  set correlationId(id: Uuid) {\n    this.set('correlationId', id);\n  }\n\n  get lastError(): Optional<string> {\n    return this.get('lastError');\n  }\n\n  set lastError(error: Optional<string>) {\n    this.set('lastError', error);\n  }\n\n  public get<T>(key: string): T {\n    return this.state[key] as T;\n  }\n\n  public set<T>(key: string, value: T): T {\n    return (this.state[key] = value);\n  }\n\n  public readonly create = (f: () => void): void => f();\n\n  public readonly wrap = <T>(f: () => Promise<T>): Promise<T> => f();\n}\n\n/**\n * @deprecated Renamed to BaseRequestContext\n */\nexport class BaseContext extends BaseRequestContext {}\n\nexport interface Contexts {\n  env?: EnvContext;\n  request?: RequestContext;\n  other?: any;\n}\n\nexport class Context {\n  constructor(protected state: Contexts = {}) {\n    this.state = {\n      ...{\n        env: new DotEnvContext(),\n        request: new BaseRequestContext(),\n        other: {},\n      },\n      ...this.state,\n    };\n  }\n\n  get env(): EnvContext {\n    return this.state.env as EnvContext;\n  }\n\n  set env(env: EnvContext) {\n    this.state.env = env;\n  }\n\n  get request(): RequestContext {\n    return this.state.request as RequestContext;\n  }\n\n  set request(request: RequestContext) {\n    this.state.request = request;\n  }\n\n  get other(): any {\n    return this.state.other;\n  }\n}\n\nexport const ctx = new Context();\n","import { isA } from './IsA';\nimport { Text } from './Text';\nimport { ctx } from './Context';\nimport { TypeGuard } from './TypeGuard';\n\nexport type Result = { message: string; location?: string; domain?: string };\n\nexport const toResult = (message: Text, location?: Text, domain: Text = ctx.env.domain): Result => ({\n  message: message.toString(),\n  location: location?.toString(),\n  domain: domain?.toString(),\n});\n\nexport const isResult: TypeGuard<Result> = (r?: unknown): r is Result => isA<Result>(r, 'message');\n","import { Text } from './Text';\nimport { isResult, Result, toResult } from './Result';\nimport { Validatable } from './Validatable';\nimport { isDefined } from './Is';\nimport { toArray } from './Array';\n\nconst parse = (...rs: (Text | Result)[]): Result[] => toArray(...rs).map(r => (isResult(r) ? r : toResult(r)));\n\nexport class Results implements Validatable {\n  public readonly results: Result[];\n\n  constructor(...rs: (Text | Result)[]) {\n    this.results = parse(...rs);\n  }\n\n  get length(): number {\n    return this.results.length;\n  }\n\n  get isValid(): boolean {\n    return this.results.length === 0;\n  }\n\n  add = (...rs: (Text | Result)[]): Results => toResults(...this.results, ...parse(...rs));\n}\n\nexport const toResults = (...r: (Text | Result)[]): Results => new Results(...r);\n\nexport const isResults = (r?: unknown): r is Results => isDefined(r) && r instanceof Results;\n","import { Validatable } from './Validatable';\nimport { isDefined } from './Is';\nimport { JsonValue } from './Json';\nimport { asString } from './Text';\n\nexport class Value<V = string> implements Validatable {\n  constructor(readonly value: V) {\n    this.value = value;\n  }\n\n  get isValid(): boolean {\n    return isDefined(this.value);\n  }\n\n  toJSON(): JsonValue {\n    return this.value as unknown as JsonValue;\n  }\n\n  toString(): string {\n    return asString(this.value);\n  }\n}\n\nexport const isValue = (v?: unknown): v is Value => v instanceof Value;\n","import { isA } from './IsA';\nimport { TypeGuard } from './TypeGuard';\n\nexport interface Validatable {\n  isValid: boolean;\n}\n\nexport const isValidatable: TypeGuard<Validatable> = (v?: unknown): v is Validatable => isA<Validatable>(v, 'isValid');\n","import { Constraint } from './Contraints';\nimport { when } from './When';\nimport type { TemplateOptions } from '../types/Template';\nimport { isResults, Results, toResults } from '../types/Results';\nimport { toName } from '../types/Constructor';\nimport { toResult } from '../types/Result';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isArray, isFunction } from '../types/Is';\nimport type { Text } from '../types/Text';\nimport { asString } from '../types/Text';\nimport { choose } from '../types/Case';\nimport { isEnum } from '../types/Enum';\nimport { isValue } from '../types/Value';\nimport { isValidatable } from '../types/Validatable';\nimport { text } from '../types/ToText';\n\nexport type Validator = { property: string | symbol; constraint: Constraint; text: Text; actual?: Text };\n\nexport const asResults = (subject: unknown, template: Text, options: TemplateOptions = {}): Results =>\n  toResults(toResult(text(template).parse(subject, options), toName(subject)));\n\nconst validators = (subject: unknown): List<Validator> =>\n  meta(subject)\n    .keys<List<Validator>>('constraint')\n    .reduce((list, vs) => list.add(vs), toList<Validator>());\n\nconst runValidator = (v: Validator, subject?: unknown): Results => {\n  try {\n    const actual = isFunction((subject as any)[v.property]) ? (subject as any)[v.property]() : (subject as any)[v.property];\n    const constraint = v.constraint(actual);\n    return isResults(constraint)\n      ? constraint\n      : !constraint\n        ? asResults(subject, v.text, {\n            ...v,\n            actual,\n          })\n        : toResults();\n  } catch (e) {\n    return asResults(subject, asString(e));\n  }\n};\n\nconst constraints = (subject?: unknown): Results =>\n  validators(subject)\n    .map(vs => runValidator(vs, subject))\n    .reduce((rs, r) => rs.add(...r.results), toResults());\n\nexport const validate = (subject?: unknown): Results =>\n  choose(subject)\n    .is.not.defined(\n      s => s,\n      () => toResults('Subject is not defined.')\n    )\n    .type(isEnum, e => (e.isValid ? toResults() : asResults(e, 'This is not a valid {type}.')))\n    .type(isValue, v => (v.isValid ? toResults() : asResults(v, 'This is not a valid {type}.')))\n    .type(isArray, a => a.map(i => validate(i)).reduce((rs, r) => rs.add(...r.results), toResults()))\n    .type(isValidatable, v => constraints(v))\n    .else(toResults());\n\nexport const validateReject = <T>(subject: T): Promise<T> => when(subject).not.isValid.reject();\n\nexport const isValid = <T>(t: T): boolean => validate(t).isValid;\n","import { isDefined, isEmpty, isTrue } from './Is';\nimport { validate } from '../validation/Validate';\nimport { Construct, Constructor, ofConstruct } from './Constructor';\nimport { Validatable } from './Validatable';\nimport { Get, ofGet } from './Get';\nimport { Func } from './Func';\nimport { Optional } from './Types';\n\nexport abstract class Try<T = unknown> implements Validatable {\n  is = {\n    defined: (prop?: Func<unknown, T>): Try<T> => this.filter(v => isDefined(prop ? prop(v) : v)),\n    empty: (prop?: Func<unknown, T>): Try<T> => this.filter(v => isEmpty(prop ? prop(v) : v)),\n    valid: (prop?: Func<unknown, T>): Try<T> => this.filter(v => validate(prop ? prop(v) : v).isValid),\n    true: (prop?: Func<unknown, T>): Try<T> => this.filter(v => isTrue(prop ? prop(v) : v)),\n    false: (prop?: Func<unknown, T>): Try<T> => this.filter(v => !isTrue(prop ? prop(v) : v)),\n    not: {\n      defined: (prop?: Func<unknown, T>): Try<T> => this.filter(v => !isDefined(prop ? prop(v) : v)),\n      empty: (prop?: Func<unknown, T>): Try<T> => this.filter(v => !isEmpty(prop ? prop(v) : v)),\n      valid: (prop?: Func<unknown, T>): Try<T> => this.filter(v => !validate(prop ? prop(v) : v).isValid),\n    },\n  };\n\n  if = this.is;\n\n  abstract get value(): T;\n\n  abstract get error(): Error;\n\n  abstract get isValid(): boolean;\n\n  static of = <T>(c: Get<T | Try<T>>, ...args: unknown[]): Try<T> => {\n    try {\n      const out = ofGet(c, ...args);\n      return new Success(out instanceof Try ? out.value : out);\n    } catch (e) {\n      return new Failure(e as Error);\n    }\n  };\n\n  abstract map<U>(f: Func<U | Try<U>, T>): Try<U>;\n\n  abstract recover(f: Func<T | Try<T>, Error>): Try<T>;\n\n  abstract recoverFrom(type: Constructor<Error>, f: Func<T | Try<T>, Error>): Try<T>;\n\n  abstract accept(f: Func<void, T>): Try<T>;\n\n  abstract filter(predicate: Func<boolean, T>): Try<T>;\n\n  abstract or(value: Get<T>): T;\n\n  abstract orElse(value?: Get<T>): Optional<T>;\n\n  abstract orThrow(error: Construct<Error>): T;\n}\n\nclass Success<T> extends Try<T> {\n  constructor(readonly value: T) {\n    super();\n  }\n\n  get error(): Error {\n    throw new Error('No error found');\n  }\n\n  get isValid(): boolean {\n    return true;\n  }\n\n  map<U>(f: Func<U | Try<U>, T>): Try<U> {\n    return tryTo<U>(f, this.value);\n  }\n\n  recover(f: Func<T | Try<T>, Error>): Try<T> {\n    return this;\n  }\n\n  recoverFrom(type: Constructor<Error>, f: Func<T | Try<T>, Error>): Try<T> {\n    return this;\n  }\n\n  accept(f: Func<void, T>): Try<T> {\n    return tryTo(() => {\n      f(this.value);\n      return this;\n    });\n  }\n\n  filter(predicate: Func<boolean, T>): Try<T> {\n    return tryTo(() => {\n      if (predicate(this.value)) return this;\n      throw new Error(`Applying filter(${predicate.toString()}) failed.`);\n    });\n  }\n\n  or(value: Get<T>): T {\n    return this.value;\n  }\n\n  orElse(value?: Get<T>): Optional<T> {\n    return this.value;\n  }\n\n  orThrow(_error: Construct<Error>): T {\n    return this.value;\n  }\n}\n\nclass Failure<T> extends Try<T> {\n  constructor(readonly error: Error) {\n    super();\n  }\n\n  get value(): T {\n    throw this.error;\n  }\n\n  get isValid(): boolean {\n    return false;\n  }\n\n  map<U>(f: Func<U | Try<U>, T>): Try<U> {\n    return new Failure<U>(this.error);\n  }\n\n  recover<U>(f: Func<U | Try<U>, Error>): Try<U> {\n    return tryTo<U>(f, this.error);\n  }\n\n  recoverFrom<U>(type: Constructor<Error>, f: Func<T | Try<T>, Error>): Try<T> {\n    return tryTo(() => (this.error instanceof type ? this.recover(f) : this));\n  }\n\n  accept(f: Func<void, T>): Try<T> {\n    return this;\n  }\n\n  filter(predicate: Func<boolean, T>): Try<T> {\n    return this;\n  }\n\n  or(value: Get<T>): T {\n    return ofGet(value);\n  }\n\n  orElse(value?: Get<T>): Optional<T> {\n    return ofGet(value);\n  }\n\n  orThrow(error: Construct<Error>): T {\n    throw ofConstruct(error);\n  }\n}\n\nexport const tryTo = <T>(c: Get<T | Try<T>>, ...args: unknown[]) => Try.of<T>(c, ...args);\n","import { Get, ofGet, Predicate } from './Get';\nimport { TypeGuard } from './TypeGuard';\nimport { Func } from './Func';\nimport { isDefined, isEmpty } from './Is';\nimport { validate } from '../validation/Validate';\nimport { tryTo } from './Try';\n\nclass CaseBuilder<V> {\n  is = {\n    defined: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(isDefined(prop(this.v)), out),\n    empty: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(isEmpty(prop(this.v)), out),\n    valid: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(validate(prop(this.v)).isValid, out),\n    in: <T>(prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(ofGet(prop, this.v).includes(this.v), out),\n    not: {\n      defined: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!isDefined(prop(this.v)), out),\n      empty: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!isEmpty(prop(this.v)), out),\n      valid: <T>(prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!validate(prop(this.v)).isValid, out),\n      in: <T>(prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.v).case(!ofGet(prop, this.v).includes(this.v), out),\n    },\n  };\n  if = this.is;\n\n  constructor(readonly v: V) {}\n\n  case<T>(pred: Predicate<V>, out: Get<T, V>): Case<T, V> {\n    return new Case<T, V>(this.v).case(pred, out);\n  }\n\n  type<T, U = unknown>(guard: TypeGuard<U>, out: Func<T, U>): Case<T, V> {\n    return new Case<T, V>(this.v).type<U>(guard, out);\n  }\n\n  equals<T>(value: V, out: Get<T, V>): Case<T, V> {\n    return new Case<T, V>(this.v).equals(value, out);\n  }\n}\n\nclass Case<T, V = unknown> {\n  is = {\n    defined: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(isDefined(prop(this.value)), out),\n    empty: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(isEmpty(prop(this.value)), out),\n    valid: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(validate(prop(this.value)).isValid, out),\n    in: (prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(ofGet(prop, this.value).includes(this.value), out),\n    not: {\n      defined: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!isDefined(prop(this.value)), out),\n      empty: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!isEmpty(prop(this.value)), out),\n      valid: (prop: Func<unknown, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!validate(prop(this.value)).isValid, out),\n      in: (prop: Get<Array<V>, V>, out: Get<T, V>): Case<T, V> => new Case<T, V>(this.value).case(!ofGet(prop, this.value).includes(this.value), out),\n    },\n  };\n  if = this.is;\n\n  constructor(\n    protected value: V,\n    protected outcome?: T\n  ) {}\n\n  case(pred: Predicate<V>, out: Get<T, V>): Case<T, V> {\n    return tryTo(pred, this.value)\n      .is.true()\n      .map(() => ofGet(out, this.value))\n      .map(res => new Found(this.value, res) as Case<T, V>)\n      .or(this);\n  }\n\n  type<U>(guard: TypeGuard<U>, out: Func<T, U>): Case<T, V> {\n    return tryTo(guard, this.value)\n      .is.true()\n      .map(() => out(this.value as unknown as U))\n      .map(res => new Found(this.value, res) as Case<T, V>)\n      .or(this);\n  }\n\n  equals(value: V, out: Get<T, V>): Case<T, V> {\n    return this.case(this.value === value, out);\n  }\n\n  else(alt: Get<T, V>): T {\n    return ofGet<T, V>(alt, this.value);\n  }\n}\n\nclass Found<T, V> extends Case<T, V> {\n  is = {\n    defined: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n    empty: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n    valid: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n    in: (_prop: Get<Array<V>, V>, _out: Get<T, V>): Case<T, V> => this,\n    not: {\n      defined: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n      empty: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n      valid: (_prop: Func<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n      in: (_prop: Get<unknown, V>, _out: Get<T, V>): Case<T, V> => this,\n    },\n  };\n  if = this.is;\n\n  constructor(\n    protected value: V,\n    protected outcome: T\n  ) {\n    super(value, outcome);\n  }\n\n  case(pred: Predicate<V>, out: Get<T, V>): this {\n    return this;\n  }\n\n  type<U>(guard: TypeGuard<U>, out: Func<T, U>): Case<T, V> {\n    return this;\n  }\n\n  equals(value: V, out: Get<T, V>): Case<T, V> {\n    return this;\n  }\n\n  else(alt: Get<T, V>): T {\n    return this.outcome;\n  }\n}\n\nexport const choose = <V>(value: V) => new CaseBuilder<V>(value);\n","import { isList, List, toList } from './List';\nimport { Construct, ofConstruct } from './Constructor';\nimport { isA } from './IsA';\nimport { PlainSort, Sort } from './Sort';\nimport { GetProperty } from './Get';\nimport { ArrayLike } from './Array';\nimport { Optional } from './Types';\nimport { isNumber } from './Is';\nimport { choose } from './Case';\nimport type { Id } from './Id';\n\nexport type FilterValue = { label?: string; value: any; count?: number };\nexport type Filter = { label?: string; field: string; shortField?: string; values: FilterValue[] };\n\nexport const toFilter = (field: string, value: any): Filter => toShortFilter(field, field, value);\nexport const toShortFilter = (field: string, shortField: string, value: any): Filter => ({\n  field,\n  shortField,\n  values: [{ value }],\n});\n\nexport type PageOptions = { take?: number; skip?: number; sort?: Sort[]; sorts?: PlainSort; filters?: Filter[] };\nexport type PageListOptions = Exclude<PageOptions, 'sort'> & { total?: number };\n\nexport class PageList<T = unknown> extends List<T> {\n  private _options?: PageListOptions;\n\n  get options(): Optional<PageListOptions> {\n    return this._options;\n  }\n\n  get take(): number {\n    return this._options?.take ?? 250;\n  }\n\n  get skip(): number {\n    return this._options?.skip ?? 0;\n  }\n\n  get total(): Optional<number> {\n    return this._options?.total;\n  }\n\n  get sorts(): Optional<PlainSort> {\n    return this._options?.sorts;\n  }\n\n  get filters(): Optional<Filter[]> {\n    return this._options?.filters;\n  }\n\n  get meta(): PageListOptions {\n    return {\n      take: this.take,\n      skip: this.skip,\n      total: this.total,\n      sorts: this.sorts,\n      filters: this.filters,\n    };\n  }\n\n  get ids(): PageList<Id> {\n    return this.mapDefined(i => (i as any).id as Id);\n  }\n\n  asc(p: GetProperty<T, any>): PageList<T> {\n    return toPageList(super.asc(p), this);\n  }\n\n  desc(p: GetProperty<T, any>): PageList<T> {\n    return toPageList(super.desc(p), this);\n  }\n\n  diff(others: ArrayLike<T>): PageList<T> {\n    return toPageList(super.diff(others), this);\n  }\n\n  diffByKey<U = T>(others: ArrayLike<U>, key: keyof T & keyof U): PageList<T> {\n    return toPageList(super.diffByKey(others, key), this);\n  }\n\n  symmetricDiff(others: ArrayLike<T>): PageList<T> {\n    return toPageList(super.symmetricDiff(others), this);\n  }\n\n  symmetricDiffByKey(others: ArrayLike<T>, key: keyof T): PageList<T> {\n    return toPageList(super.symmetricDiffByKey(others, key), this);\n  }\n\n  intersect(others: ArrayLike<T>): PageList<T> {\n    return toPageList(super.intersect(others), this);\n  }\n\n  intersectByKey<U>(others: ArrayLike<U>, key: keyof T & keyof U): PageList<T> {\n    return toPageList(super.intersectByKey(others, key), this);\n  }\n\n  map<U>(f: (value: T, index: number, array: T[]) => U, params?: unknown): PageList<U> {\n    const items = super.map(f, params);\n    return toPageList(items, this);\n  }\n\n  flatMap<U, This = unknown>(f: (this: This, value: T, index: number, array: T[]) => ReadonlyArray<U> | U, params?: This): PageList<U> {\n    return toPageList(super.flatMap(f, params), this);\n  }\n\n  mapDefined<U>(f: (value: T, index: number, array: T[]) => U, params?: unknown): PageList<NonNullable<U>> {\n    return toPageList(super.mapDefined(f, params), this);\n  }\n\n  mapAsync(f: (i: T) => Promise<T>): Promise<PageList<T>> {\n    return super.mapAsync(f).then(r => toPageList(r, this));\n  }\n\n  areEqual(...items: ArrayLike<T>): boolean {\n    return this.isSubSetOf(...items) && toList(...items).isSubSetOf(...this);\n  }\n\n  distinct(): PageList<T> {\n    return toPageList(super.distinct(), this);\n  }\n\n  distinctByKey(key: keyof T): PageList<T> {\n    return toPageList(super.distinctByKey(key), this);\n  }\n\n  distinctByValue(): PageList<T> {\n    return toPageList(super.distinctByValue(), this);\n  }\n\n  filter(p: (value: T, index: number, array: T[]) => unknown, params?: unknown): PageList<T> {\n    return toPageList(super.filter(p, params), this);\n  }\n\n  accumulate(...keys: (keyof T)[]): PageList<T> {\n    return toPageList(super.accumulate(...keys), this);\n  }\n\n  concat(...items: ConcatArray<T>[]): PageList<T>;\n\n  concat(...items: (T | ConcatArray<T>)[]): PageList<T>;\n\n  concat(...items: (T | ConcatArray<T>)[]): PageList<T> {\n    return toPageList(super.concat(...items), this);\n  }\n\n  reverse(): PageList<T> {\n    return toPageList(super.reverse(), this);\n  }\n\n  splice(start: number, deleteCount?: number): PageList<T>;\n\n  splice(start: number, deleteCount: number, ...items: T[]): PageList<T>;\n\n  splice(start: number, deleteCount: number, ...items: T[]): PageList<T> {\n    return toPageList(super.splice(start, deleteCount, ...items), this);\n  }\n\n  remove(item: T): PageList<T> {\n    return toPageList(super.remove(item), this);\n  }\n\n  replace(key: keyof T, item: T): PageList<T> {\n    return toPageList(super.replace(key, item), this);\n  }\n\n  switch(item: T): PageList<T> {\n    return toPageList(super.switch(item), this);\n  }\n\n  defined(): PageList<NonNullable<T>> {\n    return toPageList(super.defined(), this);\n  }\n\n  orElse(...alt: ArrayLike<T>): Optional<PageList<T>> {\n    return toPageList(super.orElse(...alt), this);\n  }\n\n  slice(start?: number, end?: number): PageList<T> {\n    return toPageList(super.slice(start, end), this);\n  }\n\n  //we needed to add U because of a Typescript issue with generics\n  update<U = T>(p: (value: T, index: number, array: T[]) => unknown, val: T | ((v: U) => T)): PageList<T> {\n    return toPageList(super.update(p, val), this);\n  }\n\n  updateFirst<U = T>(p: (value: T, index: number, array: T[]) => unknown, val: T | ((v: U) => T)): PageList<T> {\n    return toPageList(super.updateFirst(p, val), this);\n  }\n\n  updateFirstById<U = T>(id: Id, val: T | ((v: U) => T)): PageList<T> {\n    return toPageList(super.updateFirstById(id, val), this);\n  }\n\n  updateById<U = T>(id: Id, val: T | ((v: U) => T)): PageList<T> {\n    return toPageList(super.updateById(id, val), this);\n  }\n\n  private setPageOptions(options?: PageListOptions): this {\n    this._options = options;\n    return this;\n  }\n}\n\nexport const isPageList = <T>(l?: unknown): l is PageList<T> => isList<T>(l) && isA(l, 'total');\n\nexport const toPageList = <T>(items: T[] = [], options?: PageListOptions | PageList): PageList<T> => {\n  return (\n    choose(items)\n      .case(\n        i => i.length === 1 && isNumber(i[0]),\n        i => new PageList<T>().add(...i)\n      )\n      .else(i => new PageList<T>(...i)) as any\n  ).setPageOptions(isPageList(options) ? options.options : options);\n};\n\n/* @deprecated No longer needed as the PageList is now a class that extends from List, use the map function */\nexport const asPageList = <T, U>(c: Construct<T>, items = toPageList<U>()): PageList<T> => items.map(i => ofConstruct(c, i));\n","import { FetchOptions, Gateway } from '../types/Gateway';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Json, JsonValue } from '../types/Json';\nimport { Id } from '../types/Id';\nimport { Optional } from '../types/Types';\nimport { isDefined } from '../types/Is';\nimport { when } from '../validation/When';\nimport { Exception } from '../types/Exception';\n\nexport class InMemoryGateway extends Gateway {\n  constructor(private readonly data: Promise<PageList<Json>>) {\n    super();\n  }\n\n  all(options?: FetchOptions): Promise<PageList<Json>> {\n    return this.data.then(d => toPageList(d, d));\n  }\n\n  byId(id: Id): Promise<Optional<Json>> {\n    return this.data.then(d => d.byId(id)).then(d => (d ? { ...d } : undefined));\n  }\n\n  by = (key: string, value: JsonValue): Promise<PageList<Json>> => {\n    return this.data.then(d => d.filter(i => i[key] === value));\n  };\n\n  exists(id: Id): Promise<boolean> {\n    return this.byId(id).then(d => isDefined(d));\n  }\n\n  add(item: Json): Promise<Json> {\n    return when(item)\n      .not.contains(i => i.id)\n      .reject(Exception.IsMissingId)\n      .then(i => this.exists(i.id as Id))\n      .then(ex => when(ex).isTrue.reject(Exception.AlreadyExists))\n      .then(() => this.data.then(d => d.add(item)))\n      .then(() => ({ ...item }));\n  }\n\n  remove(id: Id): Promise<true> {\n    return this.data\n      .then(d =>\n        when(d.findIndex(i => i.id === id))\n          .with(i => i < 0)\n          .reject(Exception.DoesNotExist)\n          .then(i => d.splice(i, 1))\n      )\n      .then(() => true);\n  }\n\n  update(item: Json): Promise<Json> {\n    return when(item)\n      .not.contains(i => i.id)\n      .reject(Exception.IsMissingId)\n      .then(i => this.remove(i.id as Id).then(() => this.add(i)));\n  }\n}\n","import { DataProvider } from './DataProvider';\nimport { Enum } from '../types/Enum';\nimport { Constructor, ofConstruct } from '../types/Constructor';\n\nexport type DatabaseOptions = {\n  user?: string;\n  password?: string;\n  host?: string;\n  port?: number;\n  cluster?: string;\n  connectionString?: string;\n  maxPoolSize?: number;\n  minPoolSize?: number;\n  maxIdleTimeMS?: number;\n  socketTimeoutMS?: number;\n  // Query specific options\n  queryTimeoutMS?: number;\n};\n\nexport class DefaultProvider implements DataProvider {}\n\nexport class Database extends Enum {\n  static readonly Default = new Database('Default', DefaultProvider);\n\n  constructor(\n    name: string,\n    readonly provider: Constructor<DataProvider> | DataProvider,\n    readonly options?: DatabaseOptions\n  ) {\n    super(name);\n  }\n\n  provide = <P>(): P => ofConstruct(this.provider, this);\n}\n","import { convert, Convert } from './Convert';\nimport { Mapping } from './Mapper';\nimport { Get, ofGet } from '../types/Get';\nimport { Json, JsonValue } from '../types/Json';\n\nexport type PropertyOptions<T = unknown> = {\n  convert?: Convert<any, any>;\n  dflt?: Get<T>;\n  format?: string;\n};\n\nexport class Property<T = unknown> implements Mapping {\n  constructor(\n    readonly property: string,\n    readonly options?: PropertyOptions\n  ) {\n    this.options = { ...options, convert: options?.convert ?? convert.default };\n  }\n\n  in = (source: Json = {}): JsonValue => this.options?.convert?.to(source[this.property] ?? ofGet(this.options?.dflt));\n  out = (source: Json = {}, key = ''): JsonValue => this.options?.convert?.from(source[key]);\n\n  toString() {\n    return this.property;\n  }\n}\n","import { Condition, SortCondition, toCondition } from './Condition';\nimport { Property } from '../utils/Property';\nimport { toArray } from '../types/Array';\nimport { isDefined } from '../types/Is';\n\nexport class Field extends Property {\n  is = (value: unknown): Condition => this.condition('eq', value);\n\n  isNot = (value: unknown): Condition => this.condition('ne', value);\n\n  isIn = (...value: unknown[]): Condition => this.condition('in', toArray(value));\n\n  notIn = (...value: unknown[]): Condition => this.condition('nin', toArray(value));\n\n  exists = (does: boolean): Condition => this.condition('exists', does);\n\n  greater = (value: unknown): Condition => this.condition('gt', value);\n\n  greaterEqual = (value: unknown): Condition => this.condition('gte', value);\n\n  less = (value: unknown): Condition => this.condition('lt', value);\n\n  lessEqual = (value: unknown): Condition => this.condition('lte', value);\n\n  asc = (): SortCondition => new SortCondition(this.property, 1);\n\n  desc = (): SortCondition => new SortCondition(this.property, -1);\n\n  protected condition = (operator: string, value: unknown): Condition => toCondition(this.property, operator, value, this.options?.convert);\n}\n\nexport const isField = (f?: unknown): f is Field => isDefined(f) && f instanceof Field;\n","import { Validatable } from '../types/Validatable';\nimport { validate } from '../validation/Validate';\nimport { json, Json } from '../types/Json';\nimport { isDefined } from '../types/Is';\n\nexport abstract class Struct implements Validatable {\n  constructor(protected readonly state: any = {}) {}\n\n  get isValid(): boolean {\n    return validate(this).isValid;\n  }\n\n  toJSON(): Json {\n    return json.delete(json.parse({ ...this }), 'state');\n  }\n\n  toString(): string {\n    return this.constructor.name;\n  }\n\n  update(_add: Json): Struct {\n    return this;\n  }\n\n  protected merge(a: unknown): Json {\n    return json.merge(this, a);\n  }\n}\n\nexport function isStruct(s?: unknown): s is Struct {\n  return isDefined(s) && s instanceof Struct;\n}\n","import { DateTime as LuxonDateTime, DateTimeUnit as LuxonDateTimeUnit, DurationUnit as LuxonDurationUnit, Settings } from 'luxon';\nimport { Value } from '../types/Value';\nimport { Optional } from '../types/Types';\nimport { choose } from '../types/Case';\nimport { isDefined, isNumber, isString } from '../types/Is';\nimport { isDate } from '../types/IsDate';\nimport { isA } from '../types/IsA';\nimport { ifDefined } from '../utils/If';\nimport { JsonValue } from '../types/Json';\nimport { seconds } from '../utils/Seconds';\nimport { tryTo } from '../types/Try';\nimport { use } from '../types/Constructor';\n\nSettings.defaultZone = 'utc';\n\nexport type DateTimeUnit = LuxonDateTimeUnit;\nexport type DurationUnit = LuxonDurationUnit;\nexport type Duration = Partial<Record<DurationUnit, number>>;\n\nexport type DiffOptions = {\n  rounding: 'floor' | 'ceil' | 'round';\n};\n\nexport type DatetimeInput = string | number | Date | DateTime | null;\n\nexport class DateTime extends Value<Optional<string>> {\n  protected readonly luxon: LuxonDateTime;\n\n  constructor(value?: DatetimeInput);\n  constructor(value?: string, format?: string);\n  constructor(value?: DatetimeInput, format?: string) {\n    const luxon = choose(value)\n      .type(isString, v => (format ? LuxonDateTime.fromFormat(v, format, { setZone: true }) : LuxonDateTime.fromISO(v, { setZone: true })))\n      .type(isNumber, v => LuxonDateTime.fromMillis(v))\n      .type(isDate, v => LuxonDateTime.fromJSDate(v))\n      .type(isDateTime, v => v.luxon)\n      // Allow constructing with LuxonDateTime without exposing types\n      .else(value instanceof LuxonDateTime ? value : LuxonDateTime.fromISO(undefined as any));\n\n    super(luxon.toISO() ?? undefined);\n    this.luxon = luxon;\n  }\n\n  static get now(): DateTime {\n    return new DateTime(LuxonDateTime.utc() as any);\n  }\n\n  get isValid(): boolean {\n    return isDefined(this.value) && this.utc.isValid;\n  }\n\n  /**\n   * @deprecated Deprecated in favor for DateTime.from as that also accepts locales and another DateTime\n   */\n  get fromNow(): string {\n    return this.from();\n  }\n\n  get inAmsterdam(): DateTime {\n    return this.withZone('Europe/Amsterdam');\n  }\n\n  get inNewYork(): DateTime {\n    return this.withZone('America/New_York');\n  }\n\n  get inLondon(): DateTime {\n    return this.withZone('Europe/London');\n  }\n\n  get inWarsaw(): DateTime {\n    return this.withZone('Europe/Warsaw');\n  }\n\n  protected get utc(): LuxonDateTime {\n    return this.luxon.setZone('utc');\n  }\n\n  from(locale?: string): string;\n\n  from(date?: DateTime, locale?: string): string;\n\n  from(dateOrLocale?: string | DateTime, maybeLocale?: string): string {\n    return (\n      use((isString(dateOrLocale) ? dateOrLocale : maybeLocale) ?? 'en', locale =>\n        ifDefined(\n          isA<DateTime>(dateOrLocale) ? dateOrLocale : undefined,\n          d => this.utc.setLocale(locale).toRelative({ base: d.utc }),\n          () => this.utc.setLocale(locale).toRelative()\n        )\n      ) ?? ''\n    );\n  }\n\n  isAfter(dt: DateTime): boolean {\n    return this.utc > dt.utc;\n  }\n\n  isBefore(dt: DateTime): boolean {\n    return this.utc < dt.utc;\n  }\n\n  equals(dt: DateTime): boolean {\n    return this.utc.hasSame(dt.utc, 'millisecond');\n  }\n\n  add(n: number, unit?: DurationUnit): DateTime;\n\n  add(duration: Duration): DateTime;\n\n  add(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n    return new DateTime(this.luxon.plus(isNumber(n) ? { [unit]: n } : n) as any);\n  }\n\n  subtract(n: number, unit?: DurationUnit): DateTime;\n\n  subtract(duration: Duration): DateTime;\n\n  subtract(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n    return new DateTime(this.luxon.minus(isNumber(n) ? { [unit]: n } : n) as any);\n  }\n\n  diff(other: DateTime, unit: DateTimeUnit = 'day', opts?: DiffOptions): number {\n    return Math[opts?.rounding ?? 'floor'](this.utc.diff(other.utc).as(unit));\n  }\n\n  startOf(unit: DateTimeUnit = 'day'): DateTime {\n    return new DateTime(this.luxon.startOf(unit) as any);\n  }\n\n  endOf(unit: DateTimeUnit = 'day'): DateTime {\n    return new DateTime(this.luxon.endOf(unit) as any);\n  }\n\n  isWeekend(): boolean {\n    return this.luxon.isWeekend;\n  }\n\n  withZone(zone: string): DateTime {\n    return new DateTime(this.luxon.setZone(zone) as any);\n  }\n\n  toString(): string {\n    return this.value ?? '';\n  }\n\n  toJSON(): JsonValue {\n    return this.utc.toISO();\n  }\n\n  toFormat(format: string): string {\n    return this.luxon.toFormat(format);\n  }\n\n  toLocale(locale = 'nl-NL', format = 'D'): string {\n    return this.luxon.setLocale(locale).toFormat(format);\n  }\n\n  toFull(locale?: string): string {\n    return this.toLocale(locale, 'DDD');\n  }\n\n  toDate(): Optional<Date> {\n    return this.isValid ? this.utc.toJSDate() : undefined;\n  }\n\n  toEpoch(): number {\n    return this.luxon.toMillis();\n  }\n\n  ago(end: DateTime = DateTime.now): string {\n    return seconds.toText(end.diff(this, 'second'));\n  }\n\n  withClock(clock: DateTime): DateTime {\n    return tryTo(() => [this.toDate() as Date, clock.toDate() as Date])\n      .map(([td, cd]) => new Date(td.getFullYear(), td.getMonth(), td.getDate(), cd.getHours(), cd.getMinutes(), cd.getSeconds()))\n      .map(d => new DateTime(d)).value;\n  }\n}\n\nexport const isDateTime = (dt?: unknown): dt is DateTime => isDefined(dt) && dt instanceof DateTime;\n\nexport const dt = (dt?: DatetimeInput): DateTime => new DateTime(dt);\n","export const isDate = (o?: unknown): o is Date => o instanceof Date && !isNaN(o.getTime());\n\nexport const days = {\n  add: (date: Date, days: number): Date => {\n    date.setDate(date.getDate() + days);\n    return date;\n  },\n  today: (): Date => new Date(),\n  yesterday: (): Date => days.add(days.today(), -1),\n  tomorrow: (): Date => days.add(days.today(), 1),\n};\n\nexport const inPast = (o?: unknown): boolean => isDate(o) && o <= days.today();\n\nexport const inFuture = (o?: unknown): boolean => isDate(o) && o > days.today();\n","import { ifTrue } from './If';\nimport { toList } from '../types/List';\n\nexport const seconds = {\n  toDuration: (s: number) => {\n    const seconds = s % 60;\n    const minutes = Math.floor(s / 60) % 60;\n    const hours = Math.floor(s / 3600) % 24;\n    const days = Math.floor(s / 86400);\n    return { days, hours, minutes, seconds };\n  },\n\n  toText: (s: number): string => {\n    const { days, hours, minutes, seconds: secs } = seconds.toDuration(s);\n    return toList(ifTrue(days, `${days}d`), ifTrue(hours, `${hours}h`), ifTrue(minutes, `${minutes}m`), ifTrue(days + hours + minutes === 0, `${secs}s`))\n      .mapDefined(s => s)\n      .join(' ');\n  },\n};\n","import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n  <T>(c: Constraint, message: Text): PropertyDecorator =>\n  (subject: unknown, property: string | symbol): void => {\n    const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n    meta(subject)\n      .property(property)\n      .set('constraint', cs.add({ property, constraint: c, text: message }));\n  };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n  constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n  constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n  constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n  constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n  constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n  constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n  constraint(\n    v =>\n      tryTo(() => v)\n        .is.defined()\n        .map(v => text(v).toString().length >= length)\n        .orElse(true) as boolean,\n    message ?? `Value {actual} must be at least '${length}' characters long.`\n  );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n  constraint(\n    v =>\n      tryTo(() => v)\n        .is.defined()\n        .map(v => text(v).toString().length <= length)\n        .orElse(true) as boolean,\n    message ?? `Value {actual} cannot be longer than '${length}' characters.`\n  );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n  constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n","import { Struct } from './Struct';\nimport { DateTime } from './DateTime';\nimport { required, valid } from '../validation/Contraints';\nimport { Identity } from '../types/Identity';\nimport { Json } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { isIdentity } from '../types/IsA';\nimport { ctx } from '../types/Context';\n\nexport class Audit extends Struct {\n  @required() readonly by: Identity = { id: this.state.by?.id, user: this.state.by?.user };\n  @valid() readonly when: DateTime = new DateTime(this.state.when);\n\n  constructor(json?: Json) {\n    super(\n      choose(json)\n        .is.defined(\n          j => j,\n          j => j\n        )\n        .else({\n          by: isIdentity(ctx.request?.identity) ? ctx.request?.identity : { id: 0, user: 'easy' },\n          when: DateTime.now.toJSON(),\n        })\n    );\n  }\n}\n","import { v4 as uuid } from 'uuid';\nimport { isString } from './Is';\nimport { asString } from './Text';\n\nexport type Uuid = string;\nexport const toUuid = (): Uuid => uuid();\n\nconst isValidUuid = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i);\nexport const isUuid = (id?: unknown): id is Uuid => isString(id) && isValidUuid.test(id);\n\nconst includeUuid = new RegExp(/\\b[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\\b/i);\nexport const includesUuid = (value?: unknown): boolean => includeUuid.test(asString(value));\n","import { toUuid } from './Uuid';\n\nexport type Id = string | number;\nexport type Key = Id;\nexport type Code = Id;\nexport type HasId = { id: Id };\n\nexport const toId = (): Id => toUuid();\n","import { Struct } from './Struct';\nimport { required } from '../validation/Contraints';\nimport { Id, toId } from '../types/Id';\nimport { json, Json } from '../types/Json';\n\nexport abstract class Child extends Struct {\n  @required() readonly id: Id = this.state.id ?? toId();\n\n  protected merge(a: unknown): Json {\n    return json.merge(this, a, { id: this.id });\n  }\n}\n","import { Struct } from './Struct';\nimport { Audit } from './Audit';\nimport { required } from '../validation/Contraints';\nimport { Id, toId } from '../types/Id';\nimport { json, Json } from '../types/Json';\n\nexport abstract class Entity extends Struct {\n  @required() readonly id: Id = this.state.id ?? toId();\n  @required() readonly created: Audit = new Audit(this.state.created);\n  @required() readonly lastModified: Audit = new Audit(this.state.lastModified);\n\n  protected merge(a: unknown): Json {\n    return json.merge(this, a, {\n      id: this.id,\n      created: this.created,\n      lastModified: new Audit(),\n    });\n  }\n}\n","import { FetchOptions } from './Gateway';\nimport { PageList } from './PageList';\nimport { Exception } from './Exception';\nimport { reject } from '../utils/Promise';\nimport { Id, Key } from './Id';\nimport { List } from './List';\nimport { Json, JsonValue } from './Json';\n\nexport class Repository<T, Options = FetchOptions> {\n  all(options?: Options): Promise<PageList<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  byId(id: Id): Promise<T> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  byIds(...ids: Id[]): Promise<List<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  byKey(key: Key, options?: Options): Promise<PageList<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  filter(options?: Options): Promise<PageList<T>> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  add(t: Partial<T> | Json): Promise<T> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  update(id: Id, json: Partial<T> | Json): Promise<T> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  remove(id: Id): Promise<boolean> {\n    return reject(Exception.IsNotImplemented);\n  }\n\n  upsert(id: Id, item: Partial<T> | Json): Promise<T> {\n    return reject(Exception.IsNotImplemented);\n  }\n}\n","import { Struct } from './Struct';\nimport { FetchOptions, Gateway } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { Constructor } from '../types/Constructor';\nimport { Json, JsonValue, toJson } from '../types/Json';\nimport { isValidatable } from '../types/Validatable';\nimport { PageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { when } from '../validation/When';\nimport { Exception } from '../types/Exception';\nimport { asList, List } from '../types/List';\nimport { reject, resolve } from '../utils/Promise';\n\nexport type RepoAction = 'add' | 'update' | 'remove';\n\nexport class Repo<T extends Struct, Options = FetchOptions> extends Repository<T, Options> {\n  constructor(\n    protected ctor: Constructor<T>,\n    private readonly gateway: Gateway<Options>\n  ) {\n    super();\n  }\n\n  create = (item: T | Json): T => (isValidatable(item) ? item : new this.ctor(item));\n\n  all(options?: Options): Promise<PageList<T>> {\n    return this.gateway.all(options).then(js => js.map(i => new this.ctor(i)));\n  }\n\n  byId(id: Id): Promise<T> {\n    return this.gateway\n      .byId(id)\n      .then(j => when(j).not.isDefined.reject(Exception.DoesNotExist))\n      .then(j => new this.ctor(j));\n  }\n\n  byIds(...ids: Id[]): Promise<List<T>> {\n    return this.gateway.byIds(...ids).then(j => asList(this.ctor, j));\n  }\n\n  byKey(key: Key, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by('key', key, options).then(js => js.map(i => new this.ctor(i)));\n  }\n\n  by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by(key.toString(), value, options).then(js => js.map(i => new this.ctor(i)));\n  }\n\n  search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.search(q, options).then(js => js.map(i => new this.ctor(i)));\n  }\n\n  filter(options?: Options): Promise<PageList<T>> {\n    return this.gateway.filter(options).then(js => js.map(i => new this.ctor(i)));\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return this.gateway.exists(id);\n  }\n\n  add(t: T | Json): Promise<T> {\n    return this.extend(this.create(t), 'add')\n      .then(i => when(i).not.isValid.reject())\n      .then(i => this.validate(i, 'add'))\n      .then(i => this.gateway.add(toJson(i)))\n      .then(j => new this.ctor(j));\n  }\n\n  update(id: Id, json: Json): Promise<T> {\n    return this.gateway\n      .byId(id)\n      .then(j => when(j).not.isDefined.reject(Exception.DoesNotExist))\n      .then(j => new this.ctor(j).update(json) as T)\n      .then(i => this.extend(i, 'update'))\n      .then(i => when(i).not.isValid.reject())\n      .then(i => this.validate(i, 'update'))\n      .then(i => this.gateway.update(toJson(i)))\n      .then(j => new this.ctor(j));\n  }\n\n  remove(id: Id): Promise<boolean> {\n    return this.gateway.remove(id);\n  }\n\n  extend(item: T, _action?: RepoAction): Promise<T> {\n    return resolve(item);\n  }\n\n  validate(item: T, _action?: RepoAction): Promise<T> {\n    return resolve(item);\n  }\n\n  upsert(id: Id, item: Json): Promise<T> {\n    return this.update(id, item).catch(e => (Exception.DoesNotExist.equals(e) ? this.add(item) : reject(e)));\n  }\n}\n","import { View } from '../utils/View';\nimport { FetchOptions, Gateway } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { Json, JsonValue, toJson } from '../types/Json';\nimport { PageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { when } from '../validation/When';\nimport { Exception } from '../types/Exception';\nimport { List } from '../types/List';\nimport { RouteGateway } from '../services/RouteGateway';\nimport { RouteOptions } from '../services/Api';\n\nexport class Typo<T, Options extends RouteOptions = RouteOptions> extends Repository<T, Options> {\n  constructor(\n    protected view: View<T>,\n    private readonly gateway: Gateway<Options>\n  ) {\n    super();\n  }\n\n  create = (j: Json): T => this.view.from(j);\n\n  all(options?: Options): Promise<PageList<T>> {\n    return this.gateway.all(options).then(js => js.map(this.create));\n  }\n\n  byId(id: Id): Promise<T> {\n    return this.gateway\n      .byId(id)\n      .then(j => when(j).not.isDefined.reject(Exception.DoesNotExist))\n      .then(j => this.create(j));\n  }\n\n  byIds(...ids: Id[]): Promise<List<T>> {\n    return this.gateway.byIds(...ids).then(js => js.map(this.create));\n  }\n\n  byKey(key: Key, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by('key', key, options).then(js => js.map(this.create));\n  }\n\n  by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by(key.toString(), value, options).then(js => js.map(this.create));\n  }\n\n  search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.search(q, options).then(js => js.map(this.create));\n  }\n\n  filter(options?: Options): Promise<PageList<T>> {\n    return this.gateway.filter(options).then(js => js.map(j => this.create(j)));\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return this.gateway.exists(id);\n  }\n}\n\nexport class Agent<T, Options extends FetchOptions = FetchOptions> extends Repository<T, Options> {\n  constructor(private gateway: RouteGateway) {\n    super();\n  }\n\n  all(options?: Options): Promise<PageList<T>> {\n    return this.gateway.all(options) as Promise<PageList<T>>;\n  }\n\n  byId(id: Id): Promise<T> {\n    return this.gateway.byId(id) as Promise<T>;\n  }\n\n  byIds(...ids: Id[]): Promise<List<T>> {\n    return this.gateway.byIds(...ids) as Promise<List<T>>;\n  }\n\n  byKey(key: Key, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by('key', key, options) as Promise<PageList<T>>;\n  }\n\n  by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.by(key.toString(), value, options) as Promise<PageList<T>>;\n  }\n\n  search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n    return this.gateway.search(q, options) as Promise<PageList<T>>;\n  }\n\n  filter(options?: Options): Promise<PageList<T>> {\n    return this.gateway.filter(options) as Promise<PageList<T>>;\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return this.gateway.exists(id);\n  }\n\n  add(t: Partial<T>): Promise<T> {\n    return this.gateway.add(toJson(t)) as Promise<T>;\n  }\n\n  update(id: Id, t: Partial<T>): Promise<T> {\n    return this.gateway.update({ ...toJson(t), id }) as Promise<T>;\n  }\n\n  upsert(id: Id, t: Partial<T>): Promise<T> {\n    return this.gateway.upsert({ ...toJson(t), id }) as Promise<T>;\n  }\n\n  remove(id: Id): Promise<boolean> {\n    return this.gateway.remove(id);\n  }\n}\n","import { Get, ofGet } from './Get';\nimport { tryTo } from './Try';\nimport { isNumber } from './Is';\nimport { asString } from './Text';\n\nexport const asNumber = (n: unknown, alt?: Get<number>): number =>\n  tryTo(() => asString(n))\n    .map(s => parseInt(s))\n    .filter(n => isNumber(n))\n    .or(ofGet(alt) ?? NaN);\n","import { asNumber } from './Number';\nimport { choose } from './Case';\nimport { asString } from './Text';\nimport { isNumber, isString } from './Is';\n\nexport type CacheAge = `${number}${'ms' | 's' | 'm' | 'h' | 'd'}` | number;\n\nconst ageNumber = (s: string): number => asNumber(s.replace(/[a-z]/g, ''));\n\nexport const cacheAge = {\n  toMilliseconds: (ca: CacheAge): number =>\n    choose(asString(ca))\n      .case(\n        c => c.endsWith('ms'),\n        c => ageNumber(c)\n      )\n      .case(\n        c => c.endsWith('s'),\n        c => ageNumber(c) * 1000\n      )\n      .case(\n        c => c.endsWith('m'),\n        c => ageNumber(c) * 60 * 1000\n      )\n      .case(\n        c => c.endsWith('h'),\n        c => ageNumber(c) * 3600 * 1000\n      )\n      .case(\n        c => c.endsWith('d'),\n        c => ageNumber(c) * 24 * 3600 * 1000\n      )\n      .else(ca as number),\n\n  toSeconds: (ca: CacheAge): number =>\n    choose(asString(ca))\n      .case(\n        c => c.endsWith('ms'),\n        c => ageNumber(c) / 1000\n      )\n      .case(\n        c => c.endsWith('s'),\n        c => ageNumber(c)\n      )\n      .case(\n        c => c.endsWith('m'),\n        c => ageNumber(c) * 60\n      )\n      .case(\n        c => c.endsWith('h'),\n        c => ageNumber(c) * 3600\n      )\n      .case(\n        c => c.endsWith('d'),\n        c => ageNumber(c) * 24 * 3600\n      )\n      .else(ca as number),\n};\n\nexport const isCacheAge = (ca?: unknown): ca is CacheAge => isString(ca) || isNumber(ca);\n","import { cacheAge, CacheAge, isCacheAge } from '../types/CacheAge';\nimport { on } from '../types/Constructor';\nimport { entries } from '../types/Object';\nimport { ifDefined } from '../utils/If';\n\nexport class CacheControl {\n  name = 'Cache-Control';\n\n  protected constructor(\n    readonly enabled = true,\n    private directives: Record<string, boolean | CacheAge | undefined> = {}\n  ) {}\n\n  static disabled = () => new CacheControl(false);\n\n  static OneSecond = () => new CacheControl().maxAge(1).staleWhileRevalidate(1);\n\n  static fiveSeconds = () => new CacheControl().maxAge(5).staleWhileRevalidate(5);\n\n  static tenSeconds = () => new CacheControl().maxAge(10).staleWhileRevalidate(10);\n\n  static thirtySeconds = () => new CacheControl().maxAge(30).staleWhileRevalidate(30);\n\n  static sixtySeconds = () => new CacheControl().maxAge(60).staleWhileRevalidate(60);\n\n  static custom = (maxAge?: CacheAge, staleWhileRevalidate?: CacheAge) => new CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);\n\n  readonly maxAge = (ca?: CacheAge): this => on(this, t => (t.directives['max-age'] = ca));\n\n  readonly sharedMaxAge = (ca?: CacheAge): this => on(this, t => (t.directives['s-maxage'] = ca));\n\n  readonly noCache = (a?: boolean): this => on(this, t => (t.directives['no-cache'] = a));\n\n  readonly mustRevalidate = (a?: boolean): this => on(this, t => (t.directives['must-revalidate'] = a));\n\n  readonly private = (a?: boolean): this => on(this, t => (t.directives['private'] = a));\n\n  readonly public = (a?: boolean): this => on(this, t => (t.directives['public'] = a));\n\n  readonly immutable = (a?: boolean): this => on(this, t => (t.directives['immutable'] = a));\n\n  readonly staleWhileRevalidate = (ca?: CacheAge): this => on(this, t => (t.directives['stale-while-revalidate'] = ca));\n\n  value = (): string => this.toString();\n\n  toString(): string {\n    return entries(this.directives)\n      .mapDefined(([k, v]) => ifDefined(v, isCacheAge(v) ? `${k}=${cacheAge.toSeconds(v)}` : k))\n      .join(',');\n  }\n}\n","import formUrlEncoded from 'form-urlencoded';\nimport { Enum } from '../types/Enum';\nimport { Get, ofGet } from '../types/Get';\nimport { asString } from '../types/Text';\n\nexport class ContentType extends Enum {\n  static Form = new ContentType('form', 'application/x-www-form-urlencoded', b => formUrlEncoded(b));\n  static Json = new ContentType('json', 'application/json', b => b);\n  static RawJson = new ContentType('rawJson', 'application/json', b => b);\n  static Stream = new ContentType('stream', 'application/octet-stream');\n  static Text = new ContentType('text', 'text/plain');\n  static Xml = new ContentType('xml', 'application/xml');\n\n  private constructor(\n    name: string,\n    readonly type: string,\n    protected readonly encoder: Get<string> = b => asString(b)\n  ) {\n    super(name, type);\n  }\n\n  encode = (body?: unknown): string => ofGet(this.encoder, body);\n}\n","export const HttpHeader = {\n  ContentType: 'Content-Type',\n  Correlation: 'X-Correlation-Id',\n};\n","import { Enum } from '../types/Enum';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isAn } from '../types/IsA';\nimport { Code } from '../types/Id';\n\nexport class HttpStatus extends Enum {\n  static Continue = new HttpStatus('Continue', 100);\n  static SwitchingProtocols = new HttpStatus('Switching protocols', 101);\n  static Processing = new HttpStatus('Processing', 102);\n  static EarlyHints = new HttpStatus('Early hints', 103);\n  static Ok = new HttpStatus('Ok', 200);\n  static Created = new HttpStatus('Created', 201);\n  static Accepted = new HttpStatus('Accepted', 202);\n  static NonAuthoritativeInformation = new HttpStatus('Non-authoritative information', 203);\n  static NoContent = new HttpStatus('No content', 204);\n  static ResetContent = new HttpStatus('Reset content', 205);\n  static PartialContent = new HttpStatus('Partial content', 206);\n  static MultiStatus = new HttpStatus('Multi-status', 207);\n  static AlreadyReported = new HttpStatus('Already reported', 208);\n  static ImUsed = new HttpStatus('IM used', 226);\n  static MultipleChoices = new HttpStatus('Multiple Choices', 300);\n  static MovedPermanently = new HttpStatus('Moved Permanently', 301);\n  static Found = new HttpStatus('Found', 302);\n  static SeeOther = new HttpStatus('See other', 303);\n  static NotModified = new HttpStatus('Not modified', 304);\n  static UseProxy = new HttpStatus('Use proxy', 305);\n  static SwitchProxy = new HttpStatus('Switch proxy', 306);\n  static TemporaryRedirect = new HttpStatus('Temporary redirect', 307);\n  static PermanentRedirect = new HttpStatus('Permanent redirect', 308);\n  static BadRequest = new HttpStatus('Bad request', 400);\n  static NotAuthorized = new HttpStatus('Not authorized', 401);\n  static PaymentRequired = new HttpStatus('Payment required', 402);\n  static Forbidden = new HttpStatus('Forbidden', 403);\n  static NotFound = new HttpStatus('Not found', 404);\n  static MethodNotAllowed = new HttpStatus('Method not allowed', 405);\n  static NotAcceptable = new HttpStatus('Not acceptable', 406);\n  static ProxyAuthenticationRequired = new HttpStatus('Proxy authentication required', 407);\n  static RequestTimeout = new HttpStatus('Request timeout', 408);\n  static Conflict = new HttpStatus('Conflict', 409);\n  static Gone = new HttpStatus('Gone', 410);\n  static LengthRequired = new HttpStatus('Length required', 411);\n  static PreconditionFailed = new HttpStatus('Precondition failed', 412);\n  static PayloadTooLarge = new HttpStatus('Payload too large', 413);\n  static UriTooLong = new HttpStatus('URI too long', 414);\n  static UnsupportedMediaType = new HttpStatus('Unsupported media type', 415);\n  static RangeNotSatisfiable = new HttpStatus('Range not satisfiable', 416);\n  static ExpectationFailed = new HttpStatus('Expectation failed', 417);\n  static ImATeapot = new HttpStatus(\"I'm a teapot\", 418);\n  static MisdirectedRequest = new HttpStatus('Misdirected request', 421);\n  static UnprocessableEntity = new HttpStatus('Unprocessable entity', 422);\n  static Locked = new HttpStatus('Locked', 423);\n  static FailedDependency = new HttpStatus('Failed dependency', 424);\n  static TooEarly = new HttpStatus('Too early', 425);\n  static UpgradeRequired = new HttpStatus('Upgrade required', 426);\n  static PreconditionRequired = new HttpStatus('Precondition required', 428);\n  static TooManyRequests = new HttpStatus('Too many requests', 429);\n  static RequestHeaderFieldsTooLarge = new HttpStatus('Request header fields too large', 431);\n  static UnavailableForLegalReasons = new HttpStatus('Unavailable for legal reasons', 451);\n  static InternalServerError = new HttpStatus('Internal server error', 500);\n  static NotImplemented = new HttpStatus('Not implemented', 501);\n  static BadGateway = new HttpStatus('Bad gateway', 502);\n  static ServiceUnavailable = new HttpStatus('Service unavailable', 503);\n  static GatewayTimeout = new HttpStatus('Gateway timeout', 504);\n  static HTTPVersionNotSupported = new HttpStatus('Http version not supported', 505);\n  static VariantAlsoNegotiates = new HttpStatus('Variant also negotiates', 506);\n  static InsufficientStorage = new HttpStatus('Insufficient storage', 507);\n  static LoopDetected = new HttpStatus('Loop detected', 508);\n  static NotExtended = new HttpStatus('Not extended', 510);\n  static NetworkAuthenticationRequired = new HttpStatus('Network authentication required', 511);\n\n  get isError(): boolean {\n    return this.isClientError || this.isServerError;\n  }\n\n  get isClientError(): boolean {\n    return (this.id as number) >= 400 && (this.id as number) < 500;\n  }\n\n  get isServerError(): boolean {\n    return (this.id as number) >= 500 && (this.id as number) < 600;\n  }\n\n  get status(): number {\n    return this.id as number;\n  }\n}\n\nexport const isHttpStatus: TypeGuard<HttpStatus> = (s?: unknown): s is HttpStatus => isAn<HttpStatus>(s, 'id', 'status');\n\nexport const toHttpStatus = (s: HttpStatus | Code): HttpStatus => (isHttpStatus(s) ? s : HttpStatus.byId(s));\n","import { Enum } from '../types/Enum';\n\nexport class HttpVerb extends Enum {\n  static Get = new HttpVerb('Get');\n  static Put = new HttpVerb('Put');\n  static Patch = new HttpVerb('Patch');\n  static Post = new HttpVerb('Post');\n  static Delete = new HttpVerb('Delete');\n\n  constructor(name: string) {\n    super(name, name.toLowerCase(), name.toUpperCase());\n  }\n}\n","import { HttpHeader } from './HttpHeader';\nimport { ContentType } from './ContentType';\nimport { PageOptions } from '../types/PageList';\nimport { Optional } from '../types/Types';\nimport { Text } from '../types/Text';\nimport { Enum } from '../types/Enum';\nimport { CacheAge } from '../types/CacheAge';\nimport { ctx } from '../types/Context';\nimport { toUuid } from '../types/Uuid';\nimport { Id } from '../types/Id';\nimport { on } from '../types/Constructor';\nimport { asString } from '../types/Text';\nimport { isDefined, isNotEmpty } from '../types/Is';\n\nexport const toPageOptions = (options?: RequestOptions | PageOptions): Optional<PageOptions> =>\n  options instanceof RequestOptions ? options.pageOptions : options;\n\nexport class RequestOptions extends Enum {\n  public requestOptions: { maxRedirects?: number; validateStatus?: (status: number) => boolean; timeout?: CacheAge } = {};\n\n  constructor(\n    readonly type: ContentType = ContentType.Json,\n    readonly headers: { [key: string]: any } = {},\n    public pageOptions?: PageOptions\n  ) {\n    super(type.name);\n    this.headers['Content-Type'] = type.id;\n    this.headers[HttpHeader.Correlation] = ctx.request.correlationId ?? toUuid();\n  }\n\n  static get Form(): RequestOptions {\n    return new RequestOptions(ContentType.Form);\n  }\n\n  static get Json(): RequestOptions {\n    return new RequestOptions(ContentType.Json);\n  }\n\n  static get Stream(): RequestOptions {\n    return new RequestOptions(ContentType.Stream);\n  }\n\n  static get Text(): RequestOptions {\n    return new RequestOptions(ContentType.Text);\n  }\n\n  static get Xml(): RequestOptions {\n    return new RequestOptions(ContentType.Xml);\n  }\n\n  page = (options: PageOptions): this => {\n    this.pageOptions = options;\n    return this;\n  };\n\n  authorization = (auth: string): this => this.setHeader('Authorization', auth);\n\n  apiKey = (apiKey: string): this => this.setHeader('apiKey', apiKey);\n\n  setHeader = (key: Text, value: Id | boolean): this => on(this, t => (t.headers[asString(key)] = value));\n\n  setHeaderUnlessPresent = (key: string, value?: Id | boolean): this => (value ? this.setHeader(key, this.headers[key] ?? value) : this);\n\n  accept = (type: ContentType): this => this.setHeader('Accept', type.id);\n\n  bearer = (jwt: Text): this => {\n    return isNotEmpty(jwt) ? this.authorization(`Bearer ${jwt}`) : this;\n  };\n\n  basic = (username: Text, password: Text): this => {\n    const basicAuth = Buffer.from(`${username}:${password}`, 'utf8').toString('base64');\n    return this.authorization(`Basic ${basicAuth}`);\n  };\n\n  maxRedirects = (max?: number): this => {\n    this.requestOptions.maxRedirects = max;\n    return this;\n  };\n\n  validateStatus = (validate?: (status: number) => boolean): this => {\n    this.requestOptions.validateStatus = validate;\n    return this;\n  };\n\n  timeout = (t?: CacheAge): this => {\n    this.requestOptions.timeout = t;\n    return this;\n  };\n}\n\nexport const isRequestOptions = (o?: unknown): o is RequestOptions => isDefined(o) && o instanceof RequestOptions;\n","import { HttpStatus } from './HttpStatus';\nimport type { RestResult } from './RestResult';\nimport { isA } from '../types/IsA';\nimport { TypeGuard } from '../types/TypeGuard';\n\nexport type Response = {\n  status: HttpStatus;\n  headers?: { [key: string]: any };\n  body: RestResult;\n};\n\nexport const isResponse: TypeGuard<Response> = (r?: unknown): r is Response => isA<Response>(r, 'status', 'body');\n","import { HttpStatus, isHttpStatus } from './HttpStatus';\nimport { isResponse } from './Response';\nimport { List, toList } from '../types/List';\nimport { Json } from '../types/Json';\nimport { isResult, Result, toResult } from '../types/Result';\nimport { isDefined, isError } from '../types/Is';\nimport { choose } from '../types/Case';\nimport { isResults } from '../types/Results';\nimport { Id } from '../types/Id';\n\nexport type RestResult = {\n  data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };\n  error?: { code: number; message: string; errorCount: number; errors: List<Result> };\n};\n\nconst hasErrors = (a: any): a is { error: { code: number; errors: List<Result> } } => isDefined(a?.error?.errors);\nconst hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number; meta?: Json } } => isDefined(a?.data.items);\n\nexport const rest = {\n  toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({\n    data: {\n      code: status.status,\n      items: toList(items),\n      itemCount: items.length,\n      totalItems,\n      meta,\n    },\n  }),\n  toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({\n    error: {\n      code: status.status,\n      message: status.name ?? errors[0].message ?? 'Unknown',\n      errors: toList(errors),\n      errorCount: errors.length,\n    },\n  }),\n  to: (payload?: any | any[], status?: HttpStatus): RestResult =>\n    choose(payload)\n      .is.not.defined(p => p, undefined as unknown as RestResult)\n      .type(isHttpStatus, h => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)]))\n      .type(isResult, r => rest.toError(status ?? HttpStatus.BadRequest, [r]))\n      .type(isError, e => rest.toError(status ?? HttpStatus.BadRequest, [e]))\n      .type(isResults, r => rest.toError(status ?? HttpStatus.BadRequest, r.results))\n      .type(isResponse, r => rest.toError(status ?? HttpStatus.byId(r.body.error?.code as Id), r.body.error?.errors))\n      .type(hasErrors, e => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors))\n      .type(hasItems, d => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta))\n      .else(p => rest.toData(status ?? HttpStatus.Ok, toList(p))),\n};\n\nexport const isRestResult = (r: unknown): r is RestResult => isDefined(r) && (isDefined((r as RestResult).data) || isDefined((r as RestResult).error));\n","import { HttpStatus, toHttpStatus } from './HttpStatus';\nimport { rest } from './RestResult';\nimport { Response } from './Response';\nimport { Code } from '../types/Id';\n\nexport function toResponse(status: HttpStatus | Code, body?: unknown, headers?: { [key: string]: any }): Response {\n  return {\n    status: toHttpStatus(status),\n    headers,\n    body: rest.to(body),\n  };\n}\n","import { Enum } from '../types/Enum';\nimport type { Text } from '../types/Text';\nimport { kebab } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class Scope extends Enum {\n  protected constructor(\n    readonly name: string,\n    id: Text = text(name).kebab,\n    readonly subs: List<Scope> = toList()\n  ) {\n    super(name, id.toString());\n  }\n\n  for(item: string | IdNamePlain): Scope {\n    return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n  }\n\n  combines(...scopes: Scope[]): this {\n    this.subs.add(scopes);\n    return this;\n  }\n\n  expand(): List<Scope> {\n    return this.subs\n      .flatMap(s => s.expand())\n      .add(this)\n      .distinct();\n  }\n}\n","import { Scope } from './Scope';\n\nexport class App extends Scope {\n  constructor(name: string) {\n    super(name);\n  }\n\n  static readonly Main = new App('Main');\n}\n","import { FetchOptions } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { List } from '../types/List';\nimport { Req } from '../resources/Req';\nimport { JsonValue } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { resolve } from '../utils/Promise';\n\nexport class Search<T, Options = FetchOptions> {\n  constructor(protected repo: Repository<T, Options>) {}\n\n  all(options?: Options): Promise<PageList<T>> {\n    return this.repo.all(options);\n  }\n\n  byId(id: Id): Promise<T> {\n    return this.repo.byId(id);\n  }\n\n  byIds(...ids: Id[]): Promise<List<T>> {\n    return this.repo.byIds(...ids);\n  }\n\n  byKey(key: Key, options?: Options): Promise<PageList<T>> {\n    return this.repo.byKey(key, options);\n  }\n\n  query({ query, skip, take }: Req): Promise<PageList<T>> {\n    return this.search(query, { skip, take } as Options);\n  }\n\n  search(query: JsonValue, options?: Options): Promise<PageList<T>> {\n    return choose(query)\n      .is.not.empty(\n        q => q,\n        q => this.repo.search(q, options)\n      )\n      .else(() => resolve(toPageList<T>()));\n  }\n\n  filter(options?: Options): Promise<PageList<T>> {\n    return this.repo.filter(options);\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return this.repo.exists(id);\n  }\n}\n","import { Search } from './Search';\nimport { FetchOptions } from '../types/Gateway';\nimport { Json } from '../types/Json';\nimport { Id } from '../types/Id';\n\nexport class Manage<T, Options = FetchOptions> extends Search<T, Options> {\n  add(json: Json): Promise<T> {\n    return this.repo.add(json);\n  }\n\n  update(id: Id, json: Json): Promise<T> {\n    return this.repo.update(id, json);\n  }\n\n  upsert(id: Id, json: Json): Promise<T> {\n    return this.repo.upsert(id, json);\n  }\n\n  remove(id: Id): Promise<boolean> {\n    return this.repo.remove(id);\n  }\n}\n","import { Scope } from './Scope';\nimport { App } from './App';\nimport { Enum } from '../types/Enum';\nimport { kebab, Text } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isIn, isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class UseCase extends Enum {\n  constructor(\n    readonly app: App,\n    name: string,\n    id: Text = text(name).kebab,\n    readonly scopes: List<Scope> = toList<Scope>()\n  ) {\n    super(name, id.toString());\n  }\n\n  static byScopes<U extends UseCase>(...s: Scope[]): List<U> {\n    return this.filter(u => u.scopes.some(us => isIn(us, s)));\n  }\n\n  with(...s: Scope[]): this {\n    this.scopes.add(\n      ...toList(s)\n        .flatMap(s => s.expand())\n        .distinct()\n    );\n    return this;\n  }\n\n  for(item: string | IdNamePlain): UseCase {\n    return new UseCase(this.app, `${this.name} ${isString(item) ? item : item?.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`)).with(\n      ...this.scopes.map(s => s?.for(item))\n    );\n  }\n}\n","import { PageOptions } from '../types/PageList';\nimport { Optional } from '../types/Types';\nimport { Json, JsonValue } from '../types/Json';\nimport { OneOrMore } from '../types/Array';\nimport { ifDefined } from '../utils/If';\nimport { asNumber } from '../types/Number';\nimport { Id } from '../types/Id';\nimport type { Text } from '../types/Text';\n\nexport class Req<T = unknown> implements Omit<PageOptions, 'sort'> {\n  readonly skip: Optional<number>;\n  readonly take: Optional<number>;\n  constructor(\n    readonly path: Json = {},\n    readonly query: Json = {},\n    readonly body: T,\n    readonly headers: Record<string, OneOrMore<string>>\n  ) {\n    this.skip = ifDefined(query.skip, s => asNumber(s));\n    this.take = ifDefined(query.take, t => asNumber(t));\n  }\n\n  get id(): Id {\n    return this.get('id');\n  }\n\n  get q(): JsonValue {\n    return this.get('q');\n  }\n\n  get = (key: Text): any => this.path[key.toString()] ?? this.query[key.toString()];\n}\n\nexport function toReq<T = unknown>(req: { params?: { id?: unknown }; query?: { q?: unknown }; body?: T; headers?: unknown }): Req {\n  return new Req(req.params as Json, req.query as Json, req.body as Json, req.headers as Record<string, OneOrMore<string>>);\n}\n","export class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n    return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {\n        let code = p.charCodeAt(0).toString(16).toUpperCase();\n        if (code.length < 2) {\n            code = \"0\" + code;\n        }\n        return \"%\" + code;\n    }));\n}\nfunction base64UrlDecode(str) {\n    let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n    switch (output.length % 4) {\n        case 0:\n            break;\n        case 2:\n            output += \"==\";\n            break;\n        case 3:\n            output += \"=\";\n            break;\n        default:\n            throw new Error(\"base64 string is not of the correct length\");\n    }\n    try {\n        return b64DecodeUnicode(output);\n    }\n    catch (err) {\n        return atob(output);\n    }\n}\nexport function jwtDecode(token, options) {\n    if (typeof token !== \"string\") {\n        throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n    }\n    options || (options = {});\n    const pos = options.header === true ? 0 : 1;\n    const part = token.split(\".\")[pos];\n    if (typeof part !== \"string\") {\n        throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);\n    }\n    let decoded;\n    try {\n        decoded = base64UrlDecode(part);\n    }\n    catch (e) {\n        throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);\n    }\n    try {\n        return JSON.parse(decoded);\n    }\n    catch (e) {\n        throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);\n    }\n}\n","import { jwtDecode as decode } from 'jwt-decode';\nimport { Json } from '../types/Json';\nimport {Value} from \"../types/Value\";\n\nexport class Jwt extends Value {\n  static of = (a: { jwt: string }): Jwt => new Jwt(a.jwt);\n\n  decode = (): Json => decode(this.value);\n\n  toJSON(): Json {\n    return { jwt: this.value };\n  }\n}\n","import axios, { AxiosError, AxiosInstance, AxiosResponse, Method } from 'axios';\nimport { toResponse } from '../http/toResponse';\nimport { isDefined, isEmpty } from '../types/Is';\nimport { Uri } from '../types/Uri';\nimport { HttpVerb } from '../http/HttpVerb';\nimport { choose } from '../types/Case';\nimport { isRestResult } from '../http/RestResult';\nimport { toResult } from '../types/Result';\nimport { HttpStatus } from '../http/HttpStatus';\nimport { RequestProvider } from '../http/RequestProvider';\nimport { RequestOptions } from '../http/RequestOptions';\nimport { ctx } from '../types/Context';\nimport { cacheAge } from '../types/CacheAge';\nimport { Response } from '../http/Response';\nimport { Request } from '../http/Request';\n\nconst isResponse = (a: unknown): a is { response: AxiosResponse } => isDefined((a as any)?.response);\nconst isRequest = (a: unknown): a is { request: any } => isDefined((a as any)?.request);\n\nconst asResponse = (uri: Uri, verb: HttpVerb, error: AxiosError): Response =>\n  choose(error)\n    .type(isResponse, r =>\n      toResponse(r.response.status, isRestResult(r.response.data) ? r.response.data : toResult(r.response.statusText, uri.path, uri), r.response.headers)\n    )\n    .type(isRequest, r => toResponse(r.request.status, toResult(r.request.message, uri.path, uri)))\n    .else(e => toResponse(HttpStatus.InternalServerError, toResult(e.message, uri.path, uri)));\n\nexport class AxiosProvider implements RequestProvider {\n  constructor(readonly ai: AxiosInstance = axios) {}\n\n  execute = ({ uri, verb, body, transform = (r: any) => r, transformError = (r: any) => r, options = RequestOptions.Json }: Request): Promise<Response> =>\n    this.ai\n      .request({\n        url: uri.toString(),\n        method: verb.toString() as Method,\n        headers: uri.isInternal && isEmpty(options.headers.Authorization) ? options.bearer(ctx.request.jwt).headers : options.headers,\n        data: options.type.encode(body),\n        maxRedirects: options.requestOptions.maxRedirects,\n        ...(options.requestOptions.timeout && { timeout: cacheAge.toMilliseconds(options?.requestOptions.timeout) }),\n        ...(options.requestOptions.validateStatus && { validateStatus: options.requestOptions.validateStatus }),\n      })\n      .then(r => toResponse(r.status, transform(r.data), r.headers))\n      .catch(e => Promise.reject(asResponse(uri, verb, transformError(e))));\n}\n","import { AxiosProvider } from './AxiosProvider';\nimport { RequestOptions, toPageOptions } from '../http/RequestOptions';\nimport { FetchOptions } from '../types/Gateway';\nimport { RequestProvider } from '../http/RequestProvider';\nimport { Store } from '../types/Cache';\nimport { Uri } from '../types/Uri';\nimport { HttpVerb } from '../http/HttpVerb';\nimport { Request } from '../http/Request';\nimport { Response } from '../http/Response';\n\nexport type RouteOptions = RequestOptions | FetchOptions;\n\nexport class Api {\n  constructor(\n    readonly provider: RequestProvider = new AxiosProvider(),\n    protected store?: Store<Response, Request>\n  ) {}\n\n  get(uri: Uri, options?: RouteOptions, transform?: (r: any) => any, transformError = (r: any) => r): Promise<Response> {\n    return this.execute({\n      uri: uri.skip(toPageOptions(options)?.skip).take(toPageOptions(options)?.take),\n      verb: HttpVerb.Get,\n      transform,\n      transformError,\n      options: this.options(HttpVerb.Get, options),\n    });\n  }\n\n  post(uri: Uri, body?: unknown, options: RouteOptions = RequestOptions.Json, transform?: (r: any) => any, transformError = (r: any) => r): Promise<Response> {\n    return this.execute({\n      uri,\n      verb: HttpVerb.Post,\n      body,\n      transform,\n      transformError,\n      options: this.options(HttpVerb.Post, options),\n    });\n  }\n\n  put(uri: Uri, body?: unknown, options: RouteOptions = RequestOptions.Json, transform?: (r: any) => any, transformError = (r: any) => r): Promise<Response> {\n    return this.execute({\n      uri,\n      verb: HttpVerb.Put,\n      body,\n      transform,\n      transformError,\n      options: this.options(HttpVerb.Put, options),\n    });\n  }\n\n  patch(uri: Uri, body?: unknown, options: RouteOptions = RequestOptions.Json, transform?: (r: any) => any, transformError = (r: any) => r): Promise<Response> {\n    return this.execute({\n      uri,\n      verb: HttpVerb.Patch,\n      body,\n      transform,\n      transformError,\n      options: this.options(HttpVerb.Patch, options),\n    });\n  }\n\n  delete(uri: Uri, options: RouteOptions = RequestOptions.Json, transform?: (b: any) => any, transformError = (r: any) => r): Promise<Response> {\n    return this.execute({\n      uri,\n      verb: HttpVerb.Delete,\n      transform,\n      transformError,\n      options: this.options(HttpVerb.Delete, options),\n    });\n  }\n\n  options(verb: HttpVerb, options?: RouteOptions): RequestOptions {\n    return options instanceof RequestOptions ? options : RequestOptions.Json;\n  }\n\n  execute(req: Request): Promise<Response> {\n    return this.store ? this.store.execute(req, () => this.provider.execute(req)) : this.provider.execute(req);\n  }\n}\n\nexport const api: Api = new Api();\n","import { Api, RouteOptions } from './Api';\nimport { FetchOptions, Gateway } from '../types/Gateway';\nimport { Uri } from '../types/Uri';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Json } from '../types/Json';\nimport { use } from '../types/Constructor';\nimport { Optional } from '../types/Types';\nimport { RequestOptions } from '../http/RequestOptions';\n\nexport class ApiGateway extends Gateway<RouteOptions> {\n  constructor(readonly api: Api = new Api()) {\n    super();\n  }\n\n  get(uri: Uri, options?: RouteOptions): Promise<PageList<Json>> {\n    return this.api.get(uri, options).then(r => use(r.body.data, d => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));\n  }\n\n  getOne(uri: Uri, options?: RouteOptions): Promise<Optional<Json>> {\n    return this.get(uri, options).then(r => r.first());\n  }\n\n  post(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n    return this.api.post(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n  }\n\n  postSearch(uri: Uri, options?: RequestOptions | FetchOptions): Promise<PageList<Json>> {\n    return this.api.post(uri, options).then(r => use(r.body.data, d => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));\n  }\n\n  patch(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n    return this.api.patch(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n  }\n\n  put(uri: Uri, item?: Json, options?: RouteOptions): Promise<Json> {\n    return this.api.put(uri, item, options).then(r => r.body.data?.items.first() ?? {});\n  }\n\n  delete(uri: Uri, options?: RouteOptions): Promise<boolean> {\n    return this.api.delete(uri, options).then(() => true);\n  }\n}\n","import { Api } from './Api';\nimport { ApiGateway } from './ApiGateway';\nimport { Func } from '../types/Func';\nimport { Uri, UriExpandProps } from '../types/Uri';\nimport { PageList } from '../types/PageList';\nimport { Json, JsonValue } from '../types/Json';\nimport { Id } from '../types/Id';\nimport { Optional } from '../types/Types';\nimport { List } from '../types/List';\nimport { toArray } from '../types/Array';\nimport { HttpStatus } from '../http/HttpStatus';\nimport { isDefined } from '../types/Is';\n\nexport class RouteGateway<Props extends UriExpandProps = UriExpandProps> extends ApiGateway {\n  constructor(\n    readonly route: Func<Uri<Props>>,\n    readonly routeId: Func<Uri<Props>>,\n    readonly api: Api = new Api()\n  ) {\n    super(api);\n  }\n\n  all(options?: Props): Promise<PageList<Json>> {\n    return this.get(this.route().expand(options ?? {}) as Uri, options);\n  }\n\n  byId(id: Id): Promise<Optional<Json>> {\n    return this.getOne(this.routeId().id(id) as Uri);\n  }\n\n  byIds(...ids: Id[]): Promise<List<Json>> {\n    return this.get(this.route().ids(toArray(...ids)) as Uri);\n  }\n\n  search(q: JsonValue, options?: Props): Promise<PageList<Json>> {\n    return this.get(this.route().expand({ ...options, q } as Props) as Uri);\n  }\n\n  exists(id: Id): Promise<boolean> {\n    return this.byId(id)\n      .then(r => isDefined(r))\n      .catch(r => (HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r)));\n  }\n\n  add(item: Json): Promise<Json> {\n    return this.post(this.route() as Uri, item);\n  }\n\n  filter(options?: Props): Promise<PageList<Json>> {\n    return this.postSearch(this.route().expand(options ?? {}) as Uri);\n  }\n\n  update(item: Json): Promise<Json> {\n    return this.patch(this.routeId().id(item.id) as Uri, item);\n  }\n\n  upsert(item: Json): Promise<Json> {\n    return this.put(this.routeId().id(item.id) as Uri, item);\n  }\n\n  remove(id: Id): Promise<boolean> {\n    return this.delete(this.routeId().id(id) as Uri);\n  }\n}\n","import { Construct, ofConstruct } from '../types/Constructor';\n\nexport class State {\n  constructor(protected readonly state: any = {}) {}\n\n  protected get = <T>(key: string, alt?: Construct<T>): T => this.state[key] ?? (this.state[key] = ofConstruct(alt));\n  protected set = <T>(key: string, value: Construct<T>): T => this.get(key, value);\n}\n","import { Property, PropertyOptions } from './Property';\nimport { State } from './State';\nimport { ifNotEmpty } from './If';\nimport { json, Json, JsonValue } from '../types/Json';\nimport { Optional } from '../types/Types';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isEmpty } from '../types/Is';\nimport { Get, ofGet } from '../types/Get';\nimport { Construct, ofConstruct } from '../types/Constructor';\n\nexport type Mapping = {\n  property: string;\n  in: (source?: Json, key?: string) => Optional<JsonValue>;\n  out: (source?: Json, key?: string) => Optional<JsonValue>;\n};\nexport const isMapping: TypeGuard<Mapping> = (m?: unknown): m is Mapping => isA<Mapping>(m, 'in', 'out');\n\nexport type MapStartFrom = 'scratch' | 'source';\nexport type MapOptions = { startFrom: MapStartFrom };\n\nexport class Mapper extends State implements Mapping {\n  protected readonly map = mappings;\n\n  constructor(\n    readonly options: MapOptions = { startFrom: 'scratch' },\n    readonly property = ''\n  ) {\n    super();\n  }\n\n  // All properties that are a mapping\n  get properties(): List<[string, Mapping]> {\n    return this.get('props', () =>\n      meta(this)\n        .entries<Mapping>()\n        .filter(([, v]) => isMapping(v))\n    );\n  }\n\n  // All names of properties (in target) that have a Mapping\n  get keys(): List<string> {\n    return this.get('keys', () => this.properties.map(([k]) => k));\n  }\n\n  // All names of properties (in source) that are named in a Mapping\n  get columns(): List<string> {\n    return this.get('columns', () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();\n  }\n\n  // All names of properties (in source) that are NOT properties in target\n  private get droppedIn(): List<string> {\n    return this.get('droppedIn', () => this.columns.filter(c => !this.keys.some(k => k === c)));\n  }\n\n  // All names op properties (in target) that are NOT properties in source\n  private get droppedOut(): List<string> {\n    return this.get('droppedOut', () => this.properties.filter(([, p]) => !this.keys.some(k => k === p.property)).map(([k]) => k));\n  }\n\n  public in(from: Json = {}): Json {\n    return json.omit(\n      this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === 'source' ? from : {}),\n      ...this.droppedIn\n    );\n  }\n\n  public out(to: Json = {}): Json {\n    return json.omit(\n      this.properties.reduce(\n        (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? '']: p.out({ ...a, ...to }, k) }),\n        this.options.startFrom === 'source' ? to : {}\n      ),\n      ...this.droppedOut\n    );\n  }\n\n  toString(): string {\n    return this.constructor.name;\n  }\n}\n\nexport const mappings = {\n  item: (property: string, options?: PropertyOptions): Property => new Property(property, options),\n  ignore: (property = ''): Mapping => ({\n    property,\n    in: (): Optional<JsonValue> => undefined,\n    out: (): Optional<JsonValue> => undefined,\n  }),\n  skipIn: (property: string): Mapping => ({\n    property,\n    in: (): Optional<JsonValue> => undefined,\n    out: (source: Json = {}): JsonValue => source[property],\n  }),\n  skipOut: (property: string): Mapping => ({\n    property,\n    in: (source: Json = {}): JsonValue => source[property],\n    out: (): Optional<JsonValue> => undefined,\n  }),\n  func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>): Mapping => ({\n    property,\n    in: (source: Json = {}): Optional<JsonValue> => ofGet(funcIn, source),\n    out: (source: Json = {}): Optional<JsonValue> => ofGet(funcOut, source),\n  }),\n  add: (funcIn: Get<JsonValue, Json>): Mapping => ({\n    property: '',\n    in: (source: Json = {}): JsonValue => ofGet(funcIn, source),\n    out: (): Optional<JsonValue> => undefined,\n  }),\n  map: (mapper: Construct<Mapper>, property = ''): Mapping => ({\n    property,\n    in: (source: Json = {}): JsonValue => ofConstruct(mapper).in(isEmpty(property) ? source : (source[property] as Json)),\n    out: (source: Json = {}, key = ''): JsonValue => ofConstruct(mapper).out(isEmpty(key) ? source : (source[key] as Json)),\n  }),\n  propsToList: (...maps: Mapping[]): Mapping => ({\n    property: '',\n    in: (source: Json = {}): JsonValue => toList(maps.map(m => ofConstruct(m).in(source))).toJSON(),\n    out: (source: Json = {}, key = ''): JsonValue =>\n      maps.reduce((a: Json, m, i) => {\n        const res = toList(source[key])[i];\n        const out = m.out(res as Json);\n        return { ...a, [m.property]: out ?? {} };\n      }, {}),\n  }),\n  list: (mapper: Mapping, property: string): Mapping => ({\n    property,\n    in: (source: Json = {}): JsonValue =>\n      toList(source[property])\n        .map((v: any) => mapper.in(v))\n        .toJSON(),\n    out: (source: Json = {}, key = ''): JsonValue =>\n      toList(isEmpty(key) ? source : (source[key] as Json))\n        .map((v: any) => mapper.out(v))\n        .toJSON(),\n  }),\n};\n","import { Api } from './Api';\nimport { RouteGateway } from './RouteGateway';\nimport { Func } from '../types/Func';\nimport { Uri } from '../types/Uri';\nimport { Mapper } from '../utils/Mapper';\nimport { RequestOptions } from '../http/RequestOptions';\nimport { PageList } from '../types/PageList';\nimport { Json } from '../types/Json';\nimport { Optional } from '../types/Types';\n\nexport class MappedRouteGateway extends RouteGateway {\n  constructor(\n    readonly route: Func<Uri>,\n    readonly routeId: Func<Uri>,\n    readonly map = new Mapper(),\n    readonly api: Api = new Api()\n  ) {\n    super(route, routeId, api);\n  }\n\n  get(uri: Uri, options?: RequestOptions): Promise<PageList<Json>> {\n    return super.get(uri, options).then(is => is.map(i => this.map.in(i)));\n  }\n\n  getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {\n    return super\n      .get(uri, options)\n      .then(is => is.first())\n      .then(i => this.map.in(i));\n  }\n\n  add(item: Json): Promise<Json> {\n    return super.add(this.map.out(item));\n  }\n\n  update(item: Json): Promise<Json> {\n    return super.update(this.map.out(item));\n  }\n}\n","import { isArray, isObject } from './Is';\nimport { choose } from './Case';\n\nconst isEqualArray = (one: unknown[], another: unknown[]): boolean =>\n  choose([one, another])\n    .case(([o, a]) => !isArray(o) || !isArray(a), false)\n    .case(([o, a]) => o?.length !== a?.length, false)\n    .else(([o, a]) => !o.some((v, i) => !isEqual(v, a[i])));\n\nconst isEqualObject = (one: any, another: any): boolean =>\n  choose([Object.keys(one), Object.keys(another)])\n    .case(([keysO, keysA]) => keysO.length !== keysA.length, false)\n    .case(([keysO, keysA]) => keysO.some(k => !keysA.includes(k)), false)\n    .case(([keysO]) => keysO.some(k => !isEqual(one[k], another[k])), false)\n    .else(true);\n\nexport const isEqual = (one?: unknown, another?: unknown): boolean =>\n  choose([one, another])\n    .case(([o, a]) => o === a, true)\n    .case(\n      ([o, a]) => isArray(o) || isArray(a),\n      ([o, a]) => isEqualArray(o as [], a as [])\n    )\n    .case(\n      ([o, a]) => o == null || a == null || (!isObject(o) && !isObject(a)),\n      ([o, a]) => o !== o && a !== a\n    )\n    .else(([o, a]) => isEqualObject(o, a));\n","import { traverse } from './Traverse';\nimport { ifDefined } from './If';\nimport { Primitive } from '../types/Primitive';\nimport { Constructor, isConstructor, use } from '../types/Constructor';\nimport { asJson, json as typesJson } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { isArray, isBoolean, isFunction, isString } from '../types/Is';\nimport { meta } from '../types/Meta';\nimport { isPageList, PageList, toPageList } from '../types/PageList';\nimport { List } from '../types/List';\nimport { isEqual } from '../types/IsEqual';\nimport { DontInfer } from '../types/Types';\nimport { EnumConstructor, isEnumConstructor } from '../types/Enum';\nimport { Id } from '../types/Id';\n\ntype Func<T = unknown> = (a: any, key?: string) => T;\ntype Viewer = { key: string; f: Func };\n\ntype ViewType<V = any> = Primitive | EnumConstructor | Constructor | Func | View<V> | undefined;\ntype ViewRecord<V = any> = Partial<Record<keyof V, ViewType>>;\n\nconst ignore = Symbol('view.ignore');\nconst keep = Symbol('view.keep');\nconst json = Symbol('view.json');\nconst spread = 'view.spread';\n\nexport const toViewer = (key: string, value: ViewType): Viewer =>\n  choose(value)\n    .is.not.defined(v => v, { key, f: () => undefined } as Viewer)\n    .type(isBoolean, b => ({ key, f: () => b }))\n    .equals(ignore, { key, f: () => undefined })\n    .equals(keep, { key, f: (a: any) => traverse(a, key) })\n    .equals(json, { key, f: (a: any) => asJson(traverse(a, key)) })\n    .type(isString, s => ({ key, f: (a: any) => traverse(a, s) }))\n    .type(isEnumConstructor, c => ({\n      key,\n      f: (a, key) => use(traverse(a, key), v => (isArray(v) ? c.byIds(v) : c.byId(v as Id))),\n    }))\n    .type(isConstructor, c => ({\n      key,\n      f: (a, key) => use(traverse(a, key), v => (isArray(v) ? v.map(i => optional(c, i)) : optional(c, v))),\n    }))\n    .type(isSimpleView, f => ({ key, f: (a: any) => ifDefined(traverse(a, key), v => f.from(v)) }))\n    .type(isFunction, f => ({ key, f }))\n    .else(v => ({ key, f: () => v }));\n\nconst optional = (c: Constructor, v: any) =>\n  ifDefined(\n    v,\n    i => new c(i),\n    () => v\n  );\n\nconst toViewers = (views: ViewRecord): Viewer[] =>\n  meta(views)\n    .entries<ViewType>()\n    .map(([k, v]) => toViewer(k, v));\n\nexport class View<V = any> {\n  constructor(\n    private views = {} as ViewRecord<V>,\n    readonly startsFrom: 'scratch' | 'source' = 'scratch',\n    readonly viewers: Viewer[] = toViewers(views)\n  ) {}\n\n  get fromSource(): View<V> {\n    return new View(this.views, 'source', this.viewers);\n  }\n\n  from<T = unknown>(source: PageList<T>): PageList<V>;\n  from<T = unknown>(source: List<T>): List<V>;\n  from<T = unknown>(source: T[]): V[];\n  from<T = unknown>(source: T): V;\n  from<T = unknown>(source: PageList<T> | List<T> | T[] | T): PageList<V> | List<V> | V[] | V {\n    if (isPageList(source))\n      return toPageList(\n        source.map(s => this.reduce(s)),\n        source.options\n      );\n    if (isArray(source)) return source.map(s => this.reduce(s));\n    return this.reduce(source);\n  }\n\n  same = (one?: unknown, another?: unknown): boolean => isEqual(this.from(one), this.from(another));\n\n  private reduce = (source: any): any =>\n    use(asJson(source), src =>\n      this.viewers.reduce(\n        (acc, v) => (v.key === spread ? { ...acc, ...asJson(v.f(src, v.key)) } : typesJson.set(acc, v.key, v.f(src, v.key))),\n        this.startsFrom === 'scratch' ? {} : src\n      )\n    );\n}\n\nexport const isSimpleView = (a: unknown): a is View => a instanceof View;\n\nexport const view = <V = any>(views: ViewRecord<DontInfer<V>>): View<V> => new View<V>(views);\n\nexport const views = {\n  ignore,\n  keep,\n  json,\n  spread,\n  skip: ignore,\n  value: (value: unknown) => () => value,\n  or: {\n    key: (altKey: string) => (a: unknown, key?: string) => traverse(a, key) ?? traverse(a, altKey),\n    value: (altValue: unknown) => (a: unknown, key?: string) => traverse(a, key) ?? altValue,\n    func: (altFunc: Func) => (a: unknown, key?: string) => traverse(a, key) ?? altFunc(a, key),\n  },\n};\n\n// spread: (a: any, key: string) => ({...a, ...(use(traverse(a, key), v => isObject(v) ? v : ({[key]: v})))}),\n","import { Api } from './Api';\nimport { RouteGateway } from './RouteGateway';\nimport { Func } from '../types/Func';\nimport { Uri } from '../types/Uri';\nimport { view } from '../utils/View';\nimport { RequestOptions } from '../http/RequestOptions';\nimport { PageList } from '../types/PageList';\nimport { Json } from '../types/Json';\nimport { Optional } from '../types/Types';\n\nexport class ViewRouteGateway extends RouteGateway {\n  constructor(\n    readonly route: Func<Uri>,\n    readonly routeId: Func<Uri>,\n    readonly views = {\n      in: view({}).fromSource,\n      out: view({}).fromSource,\n    },\n    readonly api: Api = new Api()\n  ) {\n    super(route, routeId, api);\n  }\n\n  get(uri: Uri, options?: RequestOptions): Promise<PageList<Json>> {\n    return super.get(uri, options).then(is => is.map(i => this.views.in.from(i)));\n  }\n\n  getOne(uri: Uri, options?: RequestOptions): Promise<Optional<Json>> {\n    return super\n      .get(uri, options)\n      .then(is => is.first())\n      .then(i => this.views.in.from(i));\n  }\n\n  add(item: Json): Promise<Json> {\n    return super.add(this.views.out.from(item));\n  }\n\n  update(item: Json): Promise<Json> {\n    return super.update(this.views.out.from(item));\n  }\n}\n","import { isBoolean, isNumber } from '../types/Is';\nimport { convert, Convert } from '../utils/Convert';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport type { Text } from '../types/Text';\n\nexport const quote = (a: unknown): string => (isNumber(a) || isBoolean(a) || isClause(a) ? a.toString() : `'${a as string}'`);\n\nexport class Clause implements Text {\n  constructor(\n    readonly first: unknown,\n    readonly operator: string,\n    readonly second: unknown\n  ) {}\n\n  and = (other: Clause): Clause => new ParathesizedClause(this, 'AND', other);\n  or = (other: Clause): Clause => new ParathesizedClause(this, 'OR', other);\n\n  toString(): string {\n    return `${this.first} ${this.operator} ${quote(this.second)}`;\n  }\n}\n\nexport class ParathesizedClause extends Clause {\n  toString(): string {\n    return `(${this.first} ${this.operator} ${quote(this.second)})`;\n  }\n}\n\nexport const toClause = (first: unknown, operator: string, second: unknown, conv: Convert = convert.default): Clause =>\n  new Clause(first, operator, conv.from(second));\n\nexport const isClause: TypeGuard<Clause> = (c?: unknown): c is Clause => isA<Clause>(c, 'and', 'or');\n","import { Clause, toClause } from './Clause';\nimport { Table } from './Table';\nimport { Property, PropertyOptions } from '../utils/Property';\nimport { Json, JsonValue } from '../types/Json';\nimport { tryTo } from '../types/Try';\nimport { ofGet } from '../types/Get';\nimport type { Text } from '../types/Text';\n\nexport class Column extends Property implements Text {\n  constructor(\n    readonly owner: Table,\n    property: string,\n    options?: PropertyOptions\n  ) {\n    super(property, options);\n  }\n\n  get count(): Column {\n    return this.function('COUNT');\n  }\n\n  get max(): Column {\n    return this.function('MAX');\n  }\n\n  get min(): Column {\n    return this.function('MIN');\n  }\n\n  get sum(): Column {\n    return this.function('SUM');\n  }\n\n  get average(): Column {\n    return this.function('AVG');\n  }\n\n  get length(): Column {\n    return this.function('LEN');\n  }\n\n  get asc(): OrderColumn {\n    return this.format('$col ASC') as OrderColumn;\n  }\n\n  get desc(): OrderColumn {\n    return this.format('$col DESC') as OrderColumn;\n  }\n\n  in = (source: Json = {}): JsonValue =>\n    tryTo(source)\n      .map(s => s[this.property] ?? ofGet(this.options?.dflt))\n      .map(v => this.options?.convert?.to(v))\n      .orElse();\n\n  out = (source: Json = {}, key = ''): JsonValue =>\n    tryTo(source)\n      .map(s => this.options?.convert?.from(s[key]))\n      .orElse();\n\n  function = (func: string): Column => this.format(`${func}($name)`);\n\n  format = (pattern: string): Column => new PatternColumn(this, pattern);\n\n  is = (value: unknown): Clause => this.clause('=', value);\n\n  not = (value: unknown): Clause => this.clause('<>', value);\n\n  like = (value: unknown): Clause => this.clause('LIKE', `%${value}%`);\n\n  startsLike = (value: unknown): Clause => this.clause('LIKE', `${value}%`);\n\n  endsLike = (value: unknown): Clause => this.clause('LIKE', `%${value}`);\n\n  unlike = (value: unknown): Clause => this.clause('NOT LIKE', `%${value}%`);\n\n  less = (value: unknown): Clause => this.clause('<', value);\n\n  lessEqual = (value: unknown): Clause => this.clause('<=', value);\n\n  greater = (value: unknown): Clause => this.clause('>', value);\n\n  greaterEqual = (value: unknown): Clause => this.clause('>=', value);\n\n  as = (as: string): Column => this.format(`$col AS ${as}`);\n\n  toString(): string {\n    return `${this.owner}.${this.property}`;\n  }\n\n  protected clause = (operator: string, value: unknown): Clause => toClause(this, operator, value, this?.options?.convert);\n}\n\nexport class PatternColumn extends Column {\n  constructor(\n    protected col: Column,\n    protected pattern: string\n  ) {\n    super(col.owner, col.property);\n  }\n\n  toString(): string {\n    return this.pattern.replace('$col', this.col.toString()).replace('$table', this.col.owner.toString).replace('$name', this.col.property);\n  }\n}\n\nexport class OrderColumn extends PatternColumn {}\n","import { Query } from '../data/Query';\nimport { Table } from './Table';\nimport { Join } from './Join';\nimport { List, toList } from '../types/List';\nimport { Clause } from './Clause';\n\nexport class SqlQuery implements Query {\n  constructor(\n    protected table: Table | Join,\n    readonly clauses: List<Clause> = toList()\n  ) {}\n\n  where = (...clauses: Clause[]): this => {\n    this.clauses.add(clauses);\n    return this;\n  };\n}\n","import { SqlQuery } from './SqlQuery';\nimport { ifGet } from '../types/Get';\n\nexport class Delete extends SqlQuery {\n  toString(): string {\n    return `DELETE FROM ${this.table}` + ifGet(this.clauses.length, ` WHERE ${this.clauses.join(' AND ')};`, ';');\n  }\n}\n","import { SqlQuery } from './SqlQuery';\nimport { quote } from './Clause';\nimport { Table } from './Table';\nimport { Json } from '../types/Json';\n\nexport class Insert extends SqlQuery {\n  constructor(\n    protected table: Table,\n    protected fields: Json\n  ) {\n    super(table);\n  }\n\n  toString(): string {\n    return (\n      `INSERT INTO ${this.table} ` +\n      `(${Object.keys(this.fields).join(', ')}) OUTPUT INSERTED.* ` +\n      `VALUES (${Object.values(this.fields)\n        .map(v => quote(v))\n        .join(', ')});`\n    );\n  }\n}\n","import { Column } from './Column';\nimport { Table } from './Table';\n\nexport class Join {\n  readonly db;\n  constructor(private first: Table, private second: Table, private c?: Column, private c2?: Column) {\n    this.db = this.first.db;\n  }\n\n  on(c: Column, c2: Column): this {\n    this.c = c;\n    this.c2 = c2;\n    return this;\n  }\n\n  toString(): string {\n    return `${this.first} JOIN ${this.second} ON ${this.c} = ${this.c2}`;\n  }\n}\n","import { Column, OrderColumn } from './Column';\nimport { Join } from './Join';\nimport { SqlQuery } from './SqlQuery';\nimport { Table } from './Table';\nimport { List, toList } from '../types/List';\nimport { ifGet } from '../types/Get';\n\nexport class Select extends SqlQuery {\n  protected ordered: List<OrderColumn> = toList();\n  protected grouped: List<Column> = toList();\n  protected _top = 0;\n  protected _limit = 0;\n  protected _offset = 0;\n\n  constructor(\n    table: Table | Join,\n    readonly columns: List<Column> = toList()\n  ) {\n    super(table);\n  }\n\n  from(t?: Table | Join): this {\n    this.table = t ?? this.table;\n    return this;\n  }\n\n  orderBy = (...ordered: OrderColumn[]): this => {\n    this.ordered.add(ordered);\n    return this;\n  };\n\n  groupBy(...grouped: Column[]): this {\n    this.grouped.add(grouped);\n    return this;\n  }\n\n  top(t: number): this {\n    this._top = t;\n    return this;\n  }\n\n  limit(l: number): this {\n    this._limit = l;\n    return this;\n  }\n\n  offset(o: number): this {\n    this._offset = o;\n    return this;\n  }\n\n  toString(): string {\n    return (\n      `SELECT ` +\n      ifGet(this._top, `TOP ${this._top} `, '') +\n      ifGet(this.columns.length, this.columns.join(', '), '*') +\n      ` FROM ${this.table}` +\n      ifGet(this.clauses.length, ` WHERE ${this.clauses.join(' AND ')}`, '') +\n      ifGet(this.grouped.length, ` GROUP BY ${this.grouped.join(', ')}`, '') +\n      ifGet(this.ordered.length, ` ORDERED BY ${this.ordered.join(', ')}`, '') +\n      ifGet(this._limit, ` LIMIT ${this._limit}`, '') +\n      ifGet(this._offset, ` OFFSET ${this._offset};`, ';')\n    );\n  }\n}\n","import { SqlQuery } from './SqlQuery';\nimport { toClause } from './Clause';\nimport { Table } from './Table';\nimport { Json } from '../types/Json';\nimport { ifGet } from '../types/Get';\n\nexport class Update extends SqlQuery {\n  constructor(\n    protected table: Table,\n    protected fields: Json\n  ) {\n    super(table);\n  }\n\n  toString(): string {\n    return (\n      `UPDATE ${this.table} ` +\n      `SET ${Object.entries(this.fields)\n        .map(([k, v]) => toClause(k, '=', v))\n        .join(', ')} ` +\n      'OUTPUT INSERTED.*' +\n      ifGet(this.clauses.length, ` WHERE ${this.clauses.join(' AND ')};`, ';')\n    );\n  }\n}\n","import { Select } from './Select';\nimport { ifGet } from '../types/Get';\n\nexport class Count extends Select {\n  toString(): string {\n    return (\n      `SELECT COUNT(*)` +\n      ifGet(this._top, ` TOP ${this._top}`, '') +\n      ` FROM ${this.table}` +\n      ifGet(this.clauses.length, ` WHERE ${this.clauses.join(' AND ')}`, '') +\n      ifGet(this.grouped.length, ` GROUP BY ${this.grouped.join(', ')}`, '') +\n      ';'\n    );\n  }\n}\n","import { Column } from './Column';\nimport { Select } from './Select';\nimport { Insert } from './Insert';\nimport { Update } from './Update';\nimport { Delete } from './Delete';\nimport { Join } from './Join';\nimport { Count } from './Count';\nimport { MapOptions, Mapper, mappings } from '../utils/Mapper';\nimport { PropertyOptions } from '../utils/Property';\nimport { toUuid } from '../types/Uuid';\nimport { Database } from '../data/Database';\nimport { toList } from '../types/List';\nimport { Json } from '../types/Json';\n\nexport class Table extends Mapper {\n  protected readonly map = {\n    ...mappings,\n    column: <T = unknown>(name: string, options?: PropertyOptions<T>): Column => new Column(this, name, options),\n  };\n\n  readonly id = this.map.column('', { dflt: toUuid });\n\n  constructor(options: MapOptions = { startFrom: 'source' }) {\n    super(options);\n  }\n\n  get db(): Database {\n    return Database.Default;\n  }\n\n  get count(): Count {\n    return new Count(this);\n  }\n\n  /**\n   * @deprecated Deprecated since version 6.2. Please use map.column instead.\n   */\n  prop = <T = unknown>(name: string, options?: PropertyOptions<T>): Column => this.map.column(name, options);\n\n  select = (...columns: Column[]): Select => new Select(this, toList(columns));\n\n  insert = (fields: Json): Insert => new Insert(this, this.out(fields));\n  update = (fields: Json): Update => new Update(this, this.out(fields));\n  delete = (): Delete => new Delete(this, toList());\n\n  readonly join = (t: Table): Join => new Join(this, t);\n}\n","import { Table } from './Table';\nimport { PageList, PageOptions, toPageList } from '../types/PageList';\nimport { QueryProvider } from '../data/QueryProvider';\nimport { Gateway } from '../types/Gateway';\nimport { Json } from '../types/Json';\nimport { Id } from '../types/Id';\nimport { Optional } from '../types/Types';\nimport { ifDefined } from '../utils/If';\nimport { isDefined } from '../types/Is';\nimport { when } from '../validation/When';\n\nexport type TableOptions = PageOptions & { provider?: QueryProvider };\n\nexport class TableGateway<T extends Table> extends Gateway<PageOptions> {\n  constructor(\n    readonly table: T,\n    readonly provider = table.db.provide<QueryProvider>()\n  ) {\n    super();\n  }\n\n  protected provide = ({ provider }: TableOptions = {}): QueryProvider => provider ?? this.provider;\n\n  all(options?: TableOptions): Promise<PageList<Json>> {\n    return this.provide(options)\n      .query(this.table.select())\n      .then(js =>\n        toPageList(\n          js.map(j => this.table.in(j)),\n          options\n        )\n      );\n  }\n\n  byId(id: Id, options?: TableOptions): Promise<Optional<Json>> {\n    return this.provide(options)\n      .query(this.table.select().where(this.table.id.is(id)))\n      .then(js => js.first())\n      .then(j => ifDefined(j, this.table.in(j)));\n  }\n\n  exists(id: Id, options?: TableOptions): Promise<boolean> {\n    return this.byId(id).then(j => isDefined(j));\n  }\n\n  add(item: Json, options?: TableOptions): Promise<Json> {\n    return this.provide(options)\n      .query(this.table.insert(item))\n      .then(js => when(js.first()).not.isDefined.reject(`Could not add items with id ${item.id}`))\n      .then(j => this.table.in(j));\n  }\n\n  remove(id: Id, options?: TableOptions): Promise<boolean> {\n    return this.provide(options)\n      .command(this.table.delete().where(this.table.id.is(id)))\n      .then(() => true);\n  }\n\n  update(item: Json, options?: TableOptions): Promise<Json> {\n    return this.provide(options)\n      .query(this.table.update(item).where(this.table.id.is(item.id)))\n      .then(js => when(js.first()).not.isDefined.reject(`Could not update item with id ${item.id}`))\n      .then(j => this.table.in(j));\n  }\n}\n","import { Constructor } from './Constructor';\nimport { asString } from './Text';\n\nclass builder {\n  private static state: any = {};\n  static singleton = <T>(ctr: Constructor<T>, ...args: any[]): T => builder.state[asString(ctr)] ?? (builder.state[asString(ctr)] = new ctr(...args));\n  static reset = (): void => {\n    builder.state = {};\n  };\n}\n\nexport const build = {\n  singleton: <T>(ctr: Constructor<T>, ...args: any[]): T => builder.singleton(ctr, ...args),\n  reset: (): void => builder.reset(),\n};\n\nexport const singleton = <T>(ctr: Constructor<T>, ...args: any[]): T => build.singleton(ctr, ...args);\n","import { Func } from './Func';\nimport { CacheAge } from './CacheAge';\nimport { Construct } from './Constructor';\nimport { meta } from './Meta';\n\nexport interface Store<To = any, From = any> {\n  execute: (fetch: From, f: Func<Promise<To>, From>) => Promise<To>;\n}\n\nexport type CacheOptions = {\n  expiresIn?: CacheAge;\n  store?: Construct<Store>;\n};\n\nexport const toCacheOptions = (co: Partial<CacheOptions>): CacheOptions => ({\n  expiresIn: co.expiresIn ?? '5m',\n  store: co.store,\n});\n\nexport const cache =\n  (options: Partial<CacheOptions>): ClassDecorator =>\n  (subject: unknown): void => {\n    meta(subject).set('cache', toCacheOptions(options));\n  };\n","import { isA } from './IsA';\n\nexport type Currency = {\n  id: string;\n  name: string;\n  digits: number;\n  code: string;\n};\n\nexport const isCurrency = (c?: unknown): c is Currency => isA<Currency>(c, 'id', 'name', 'digits', 'code');\n","import { Enum } from './Enum';\n\nexport class Environment extends Enum {\n  static readonly Dev = new Environment('Development', 'dev');\n  static readonly Tst = new Environment('Test', 'tst');\n  static readonly Acc = new Environment('Acceptance', 'acc');\n  static readonly Prd = new Environment('Production', 'prd');\n}\n","type Falsy = false | 0 | 0n | '' | null | undefined;\ntype Truthy<T = unknown> = Exclude<T, Falsy>;\n\nexport const isFalsy = (v?: unknown): v is Falsy => !v;\nexport const isTruthy = (v?: unknown): v is Truthy => !isFalsy(v);\n","import { isA } from './IsA';\n\nexport type Indexed<T> = T & { index: number };\n\nexport const isIndexed = <T>(u: unknown): u is Indexed<T> => isA<Indexed<T>>(u, 'index');\n","import { Func, isFunc } from './Func';\n\nexport type Message<Args> = string | Func<string, Args>;\n\nexport const ofMessage = <Args>(g: Message<Args>, ...params: Args[]): string => (isFunc<string, Args>(g) ? g(...params) : g);\n","export type Nullish = null | undefined;\n\nexport const isNullish = (v?: unknown): v is Nullish => v == null;\n","import { Get, ofGet, Predicate } from './Get';\nimport { isDefined, isEmpty, isIn, isObject, isString, isTrue } from './Is';\nimport { isValid } from '../validation/Validate';\nimport { Constructor, on } from './Constructor';\nimport { toArray } from './Array';\n\nexport class Parser<T, V> {\n  if = {\n    equals: (pred?: Predicate<T>): this => this.evaluate(isTrue, pred),\n    empty: <U>(pred?: Get<U, T>): this => this.evaluate(isEmpty, pred),\n    defined: <U>(pred?: Get<U, T>): this => this.evaluate(isDefined, pred),\n    valid: <U>(pred?: Get<U, T>): this => this.evaluate(isValid, pred),\n    in: (...items: T[]): this => this.evaluate(() => isIn(this.value, toArray(...items))),\n    is: {\n      object: <U>(pred?: Get<U, T>): this => this.evaluate(isObject, pred),\n      string: <U>(pred?: Get<U, T>): this => this.evaluate(isString, pred),\n      instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => this.value instanceof c, pred),\n    },\n    not: {\n      empty: <U>(pred?: Get<U, T>): this => this.evaluateNot(isEmpty, pred),\n      defined: <U>(pred?: Get<U, T>): this => this.evaluateNot(isDefined, pred),\n      valid: <U>(pred?: Get<U, T>): this => this.evaluateNot(isValid, pred),\n      isObject: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n      in: (...items: T[]): this => this.evaluate(() => !isIn(this.value, toArray(...items))),\n      is: {\n        object: <U>(pred?: Get<U, T>): this => this.evaluateNot(isObject, pred),\n        string: <U>(pred?: Get<U, T>): this => this.evaluateNot(isString, pred),\n        instance: <U>(c: Constructor<U>, pred?: Get<U, T>): this => this.evaluate(() => !(this.value instanceof c), pred),\n      },\n    },\n  };\n\n  constructor(\n    protected value: T,\n    protected valid = true\n  ) {}\n\n  protected evaluate<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n    return on(this, t => (t.valid = ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n  }\n\n  protected evaluateNot<U>(meta: Get<boolean>, pred?: Get<U, T>): this {\n    return on(this, t => (t.valid = !ofGet(meta, pred ? ofGet(pred, this.value) : this.value)));\n  }\n}\n","export const asc = 1;\nexport const desc = -1;\nexport type SortDirection = typeof asc | typeof desc;\nexport type Sort = { key: string; value: SortDirection };\nexport type PlainSort = Record<string, SortDirection> | string[];\n","import { meta } from './Meta';\n\nexport const tag =\n  (name: string): PropertyDecorator =>\n  (subject: unknown, property: string | symbol): void => {\n    meta(subject).property(property).set(name, property);\n  };\n\nexport const searchable = (): PropertyDecorator => tag(searchable.name);\n","import { isBoolean, isNotEmpty, isTrue } from './Is';\nimport { asString, Text } from './Text';\nimport { toName } from './Constructor';\nimport { ctx } from './Context';\nimport { List, toList } from './List';\nimport { meta } from './Meta';\nimport { tryTo } from './Try';\nimport { Optional } from './Types';\nimport { OneOrMore, toArray } from './Array';\nimport { entries } from './Object';\n\nexport type Segment = Text & { key?: string; segment?: string; query?: (value: unknown) => string };\n\nexport const toSegment = (\n  key?: Text,\n  {\n    segment,\n    query,\n  }: {\n    segment?: string;\n    query?: (value: unknown) => string;\n  } = {}\n): Segment => ({\n  key: key as string,\n  segment,\n  query,\n  toString: () => asString(key),\n});\n\nexport const uri = {\n  host: (key?: string): Segment => toSegment(key, { segment: key ?? ctx.env.host ?? '$host' }),\n  resource: <Props extends UriExpandProps>(resource: Uri<Props>): Segment => toSegment(toName(resource, 'Uri'), { segment: toName(resource, 'Uri') }),\n  segment: (key?: Text): Segment => toSegment(key, { segment: key as string }),\n  path: (key: Text): Segment => toSegment(key, { segment: `:${key}` }),\n  query: (key: Text): Segment =>\n    toSegment(key, {\n      query: (value: unknown): string =>\n        tryTo(value)\n          .is.defined()\n          .map(v => encodeURIComponent(asString(v)))\n          .map(v => `${key}=${v}`)\n          .orElse('') ?? '',\n    }),\n  boolean: (key: Text): Segment => toSegment(key, { query: (value: unknown): string => (isTrue(value) ? `${key}` : '') }),\n};\n\ntype Prop = { segment: Segment; value: any };\n\nconst toRoute = (...segments: Segment[]): string =>\n  toList(segments)\n    .mapDefined(s => s.segment)\n    .join('/');\n\nexport type Uri<Props extends UriExpandProps = UriExpandProps> = {\n  id: (id?: unknown) => Uri<Props>;\n  ids: (ids: OneOrMore<unknown>) => Uri<Props>;\n  query: (q?: unknown) => Uri<Props>;\n  sort: (q?: any) => Uri<Props>;\n  skip: (n?: number) => Uri<Props>;\n  take: (n?: number) => Uri<Props>;\n  path: string;\n  route: (resource: string) => string;\n  isInternal: boolean;\n  toString: () => string;\n  expand: (props: Partial<Props>) => Uri<Props>;\n};\n\nexport type UriExpandProps = { q?: string; s?: string; skip?: number; take?: number };\n\nexport class EasyUri<Props extends UriExpandProps = UriExpandProps> implements Uri<Props> {\n  static readonly id = uri.path('id');\n  static readonly ids = uri.query('ids');\n  static readonly query = uri.query('q');\n  static readonly sort = uri.query('s');\n  static readonly skip = uri.query('skip');\n  static readonly take = uri.query('take');\n\n  readonly host = uri.host();\n  protected resource: Segment = uri.resource(this);\n\n  protected state: any = {};\n\n  constructor(readonly segments: Segment[] = []) {}\n\n  get path(): string {\n    return toRoute(uri.segment(''), this.resource, ...this.segments);\n  }\n\n  get complete(): string {\n    return toRoute(this.host, this.resource, ...this.segments);\n  }\n\n  get isInternal(): boolean {\n    return toRoute(this.host) === (ctx.env.host ?? '$host');\n  }\n\n  protected get props(): List<Prop> {\n    return meta(this.state).values<Prop>();\n  }\n\n  route = (resource: Optional<string> = this.resource.key): string => toRoute(uri.segment(''), uri.segment(resource?.toLowerCase()), ...this.segments);\n\n  set = (segment: Segment, value?: unknown): this => {\n    tryTo(value)\n      .is.defined()\n      .accept(value => (this.state[segment.key ?? ''] = { segment, value }));\n    return this;\n  };\n\n  toString(): string {\n    return tryTo(() => this.props)\n      .map(ps => ps.filter(p => p.segment?.segment))\n      .map(ps => ps.reduce((r: string, p: Prop) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete))\n      .map(route => ({\n        route,\n        query: this.props.mapDefined(p => (p.segment?.query ? p.segment?.query(p.value) : undefined))?.join('&'),\n      }))\n      .map(({ route, query }) => (isNotEmpty(query) ? `${route}?${query}` : route)).value;\n  }\n\n  id = (id?: unknown): this => this.set(EasyUri.id, id);\n  ids = (ids: OneOrMore<unknown>): this => this.set(EasyUri.ids, toArray(ids).join(','));\n  query = (q?: unknown): this => this.set(EasyUri.query, q);\n  sort = (s?: any): this => this.set(EasyUri.sort, asString(s));\n\n  skip = (index?: number): this => this.set(EasyUri.skip, index);\n  take = (items?: number): this => this.set(EasyUri.take, items);\n\n  expand(props: Partial<Props>): this {\n    return entries(props as any)\n      .filter(([_, v]) => isNotEmpty(v))\n      .reduce((u, [k, v]) => (isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(','))), this);\n  }\n}\n\nexport const clipUri = (uri?: EasyUri | string | null): string =>\n  tryTo(() => asString(uri))\n    .map(uri => uri.replace(/^(https?:\\/\\/)?(www\\.)?/, ''))\n    .map(uri => uri.replace(/\\/$/, '')).value;\n","import type { Json } from '../types/Json';\n\nexport const base64 = {\n  decode: (data: string): string => Buffer.from(data, 'base64').toString('utf-8'),\n  encode: (data: string): string => Buffer.from(data, 'utf-8').toString('base64'),\n  toJson: (data: string): Json => JSON.parse(base64.decode(data)),\n};\n","import { isNotPresent } from '../types/Is';\n\nexport const isLoading = (...targets: unknown[]): boolean => isNotPresent(...targets);\n","import { Optional } from '../types/Types';\n\nexport function log<T>(t: T): T;\nexport function log<T>(label: string, t: T): T;\nexport function log<T>(labelOrT: string | T, t?: T): T {\n  if (t) {\n    console.log(labelOrT as string, t);\n    return t;\n  } else {\n    console.log(labelOrT);\n    return labelOrT as T;\n  }\n}\nexport function dir<T>(t?: T): Optional<T> {\n  console.dir(t, { depth: 200 });\n  return t;\n}\n","import type { Text } from '../types/Text';\nimport { Id } from '../types/Id';\nimport { text } from '../types/ToText';\n\nexport class Sentence implements Text {\n  constructor(\n    word: Text,\n    pre?: Sentence,\n    private sentence: Text[] = (pre?.sentence ?? []).concat(word)\n  ) {}\n\n  toString(): string {\n    return text(this.sentence.join(' ')).sentence.toString();\n  }\n}\n\nclass Topic extends Sentence {\n  it = new Sentence('it', this);\n  anything = new Sentence('anything', this);\n  id = (id: Id) => new Sentence(`id '${id}'`, this);\n  your = (subject?: Text) => new Sentence(`your ${subject ?? 'item'}`, this);\n  a = (subject?: Text) => new Sentence(subject ? `a ${subject}` : 'an item', this);\n  an = (subject?: Text) => new Sentence(`an ${subject ?? 'item'}`, this);\n  any = (subjects?: Text) => new Sentence(`any ${subjects ?? 'items'}`, this);\n}\n\nclass Verb extends Sentence {\n  add = new Topic('add', this);\n  check = new Topic('check', this);\n  fetch = new Topic('fetch', this);\n  find = new Topic('find', this);\n  like = new Topic('like', this);\n  process = new Topic('process', this);\n  remove = new Topic('remove', this);\n  translate = new Topic('translate', this);\n  update = new Topic('update', this);\n  validate = new Topic('validate', this);\n}\n\nclass Not extends Verb {}\n\nclass SupportVerb extends Verb {\n  not = new Not('not', this);\n}\n\nclass We extends Sentence {\n  could = new SupportVerb('could', this);\n  did = new SupportVerb('did', this);\n\n  added = new Topic('added', this);\n  checked = new Topic('checked', this);\n  fetched = new Topic('fetched', this);\n  found = new Topic('found', this);\n  liked = new Topic('liked', this);\n  processed = new Topic('processed', this);\n  removed = new Topic('removed', this);\n  translated = new Topic('translated', this);\n  updated = new Topic('updated', this);\n  validated = new Topic('validated', this);\n}\n\nexport const we = new We('we');\n","export class Wait {\n  static wait(ms = 0): Promise<void> {\n    return new Promise(resolve => setTimeout(resolve, ms));\n  }\n\n  static seconds(s = 0) {\n    return this.wait(s * 1000);\n  }\n}\n\nexport const wait = (millis: number) => Wait.wait(millis);\n"]}