{"version":3,"file":"LlmTypeCheckerV3_1.mjs","sources":["../../src/utils/LlmTypeCheckerV3_1.ts"],"sourcesContent":["import { ILlmSchemaV3_1 } from \"../structures/ILlmSchemaV3_1\";\nimport { OpenApiTypeCheckerBase } from \"./internal/OpenApiTypeCheckerBase\";\n\nexport namespace LlmTypeCheckerV3_1 {\n  /* -----------------------------------------------------------\n    TYPE CHECKERS\n  ----------------------------------------------------------- */\n  /**\n   * Test whether the schema is a nul type.\n   *\n   * @param schema Target schema\n   * @returns Whether null type or not\n   */\n  export const isNull = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.INull => OpenApiTypeCheckerBase.isNull(schema);\n\n  /**\n   * Test whether the schema is an unknown type.\n   *\n   * @param schema Target schema\n   * @returns Whether unknown type or not\n   */\n  export const isUnknown = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IUnknown =>\n    OpenApiTypeCheckerBase.isUnknown(schema);\n\n  /**\n   * Test whether the schema is a constant type.\n   *\n   * @param schema Target schema\n   * @returns Whether constant type or not\n   */\n  export const isConstant = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IConstant =>\n    OpenApiTypeCheckerBase.isConstant(schema);\n\n  /**\n   * Test whether the schema is a boolean type.\n   *\n   * @param schema Target schema\n   * @returns Whether boolean type or not\n   */\n  export const isBoolean = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IBoolean =>\n    OpenApiTypeCheckerBase.isBoolean(schema);\n\n  /**\n   * Test whether the schema is an integer type.\n   *\n   * @param schema Target schema\n   * @returns Whether integer type or not\n   */\n  export const isInteger = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IInteger =>\n    OpenApiTypeCheckerBase.isInteger(schema);\n\n  /**\n   * Test whether the schema is a number type.\n   *\n   * @param schema Target schema\n   * @returns Whether number type or not\n   */\n  export const isNumber = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.INumber =>\n    OpenApiTypeCheckerBase.isNumber(schema);\n\n  /**\n   * Test whether the schema is a string type.\n   *\n   * @param schema Target schema\n   * @returns Whether string type or not\n   */\n  export const isString = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IString =>\n    OpenApiTypeCheckerBase.isString(schema);\n\n  /**\n   * Test whether the schema is an array type.\n   *\n   * @param schema Target schema\n   * @returns Whether array type or not\n   */\n  export const isArray = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IArray => OpenApiTypeCheckerBase.isArray(schema);\n\n  /**\n   * Test whether the schema is an object type.\n   *\n   * @param schema Target schema\n   * @returns Whether object type or not\n   */\n  export const isObject = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IObject =>\n    OpenApiTypeCheckerBase.isObject(schema);\n\n  /**\n   * Test whether the schema is a reference type.\n   *\n   * @param schema Target schema\n   * @returns Whether reference type or not\n   */\n  export const isReference = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IReference =>\n    OpenApiTypeCheckerBase.isReference(schema);\n\n  /**\n   * Test whether the schema is an union type.\n   *\n   * @param schema Target schema\n   * @returns Whether union type or not\n   */\n  export const isOneOf = (\n    schema: ILlmSchemaV3_1,\n  ): schema is ILlmSchemaV3_1.IOneOf => OpenApiTypeCheckerBase.isOneOf(schema);\n\n  /**\n   * Test whether the schema is recursive reference type.\n   *\n   * Test whether the target schema is a reference type, and test one thing more\n   * that the reference is self-recursive or not.\n   *\n   * @param props Properties for recursive reference test\n   * @returns Whether the schema is recursive reference type or not\n   */\n  export const isRecursiveReference = (props: {\n    $defs?: Record<string, ILlmSchemaV3_1>;\n    schema: ILlmSchemaV3_1;\n  }): boolean =>\n    OpenApiTypeCheckerBase.isRecursiveReference({\n      prefix: \"#/$defs/\",\n      components: {\n        schemas: props.$defs,\n      },\n      schema: props.schema,\n    });\n\n  /* -----------------------------------------------------------\n    OPERATORS\n  ----------------------------------------------------------- */\n  /**\n   * Test whether the `x` schema covers the `y` schema.\n   *\n   * @param props Properties for testing\n   * @returns Whether the `x` schema covers the `y` schema\n   */\n  export const covers = (props: {\n    $defs?: Record<string, ILlmSchemaV3_1>;\n    x: ILlmSchemaV3_1;\n    y: ILlmSchemaV3_1;\n  }): boolean =>\n    OpenApiTypeCheckerBase.covers({\n      prefix: \"#/$defs/\",\n      components: {\n        schemas: props.$defs,\n      },\n      x: props.x,\n      y: props.y,\n    });\n\n  /**\n   * Visit every nested schemas.\n   *\n   * Visit every nested schemas of the target, and apply the `props.closure` function.\n   *\n   * Here is the list of occurring nested visitings:\n   *\n   * - {@link ILlmSchemaV3_1.IOneOf.oneOf}\n   * - {@link ILlmSchemaV3_1.IReference}\n   * - {@link ILlmSchemaV3_1.IObject.properties}\n   * - {@link ILlmSchemaV3_1.IObject.additionalProperties}\n   * - {@link ILlmSchemaV3_1.IArray.items}\n   *\n   * @param props Properties for visiting\n   */\n  export const visit = (props: {\n    closure: (schema: ILlmSchemaV3_1, accessor: string) => void;\n    $defs?: Record<string, ILlmSchemaV3_1>;\n    schema: ILlmSchemaV3_1;\n  }): void =>\n    OpenApiTypeCheckerBase.visit({\n      prefix: \"#/$defs/\",\n      components: {\n        schemas: props.$defs,\n      },\n      closure: props.closure as any,\n      schema: props.schema,\n    });\n}\n"],"names":["LlmTypeCheckerV3_1","isNull","schema","OpenApiTypeCheckerBase","isUnknown","isConstant","isBoolean","isInteger","isNumber","isString","isArray","isObject","isReference","isOneOf","isRecursiveReference","props","prefix","components","schemas","$defs","covers","x","y","visit","closure"],"mappings":";;AAGM,IAAWA;;CAAjB,SAAiBA;IAUFA,mBAAAC,SACXC,UACmCC,uBAAuBF,OAAOC;IAQtDF,mBAAAI,YACXF,UAEAC,uBAAuBC,UAAUF;IAQtBF,mBAAAK,aACXH,UAEAC,uBAAuBE,WAAWH;IAQvBF,mBAAAM,YACXJ,UAEAC,uBAAuBG,UAAUJ;IAQtBF,mBAAAO,YACXL,UAEAC,uBAAuBI,UAAUL;IAQtBF,mBAAAQ,WACXN,UAEAC,uBAAuBK,SAASN;IAQrBF,mBAAAS,WACXP,UAEAC,uBAAuBM,SAASP;IAQrBF,mBAAAU,UACXR,UACoCC,uBAAuBO,QAAQR;IAQxDF,mBAAAW,WACXT,UAEAC,uBAAuBQ,SAAST;IAQrBF,mBAAAY,cACXV,UAEAC,uBAAuBS,YAAYV;IAQxBF,mBAAAa,UACXX,UACoCC,uBAAuBU,QAAQX;IAWxDF,mBAAoBc,uBAAIC,SAInCZ,uBAAuBW,qBAAqB;QAC1CE,QAAQ;QACRC,YAAY;YACVC,SAASH,MAAMI;;QAEjBjB,QAAQa,MAAMb;;IAYLF,mBAAMoB,SAAIL,SAKrBZ,uBAAuBiB,OAAO;QAC5BJ,QAAQ;QACRC,YAAY;YACVC,SAASH,MAAMI;;QAEjBE,GAAGN,MAAMM;QACTC,GAAGP,MAAMO;;IAkBAtB,mBAAKuB,QAAIR,SAKpBZ,uBAAuBoB,MAAM;QAC3BP,QAAQ;QACRC,YAAY;YACVC,SAASH,MAAMI;;QAEjBK,SAAST,MAAMS;QACftB,QAAQa,MAAMb;;AAEnB,EAlMD,CAAiBF,uBAAAA,qBAkMhB,CAAA;;"}