{"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/chunk-VSXG73AZ.cjs","../src/types.ts"],"names":[],"mappings":"AAAA;ACSO,SAAS,KAAA,CAAM,KAAA,EAAkF;AACtG,EAAA,OAAQ,KAAA,CAAkE,KAAA,IAAS,KAAA,CAAA;AACrF;AAMO,SAAS,OAAA,CAAQ,KAAA,EAAiF;AACvG,EAAA,OAAO,KAAA,CAAM,QAAA,IAAY,OAAA;AAC3B;AA2MO,SAAS,QAAA,CAAS,KAAA,EAAgB,wBAAA,EAA0B,KAAA,EAA8B;AAC/F,EAAA,OACG,KAAA,CAAuB,KAAA,IAAS,KAAA,EAAA,GAChC,KAAA,CAAuB,MAAA,IAAU,KAAA,EAAA,GACjC,KAAA,CAAuB,MAAA,IAAU,KAAA,EAAA,GACjC,KAAA,CAAuB,MAAA,IAAU,KAAA,EAAA,GAClC,uBAAA;AAEJ;AD5NA;AACA;AACE;AACA;AACA;AACF,8EAAC","file":"/Users/erunion/code/readme/oas/packages/oas/dist/chunk-VSXG73AZ.cjs","sourcesContent":[null,"import type { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nexport type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;\n\n/**\n * @param check Data to determine if it contains a ReferenceObject (`$ref` pointer`).\n * @returns If the supplied data has a `$ref` pointer.\n */\nexport function isRef(check: unknown): check is OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject {\n  return (check as OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject).$ref !== undefined;\n}\n\n/**\n * @param check API definition to determine if it's a 3.1 definition.\n * @returns If the definition is a 3.1 definition.\n */\nexport function isOAS31(check: OpenAPIV3_1.Document | OpenAPIV3.Document): check is OpenAPIV3_1.Document {\n  return check.openapi === '3.1.0';\n}\n\n/**\n * Data shape for taking OpenAPI operation data and converting it into HAR.\n *\n * @see {@link https://github.com/readmeio/oas/tree/main/packages/oas-to-har}\n */\nexport interface DataForHAR {\n  body?: any;\n  cookie?: Record<string, any>;\n  formData?: Record<string, any>; // `application/x-www-form-urlencoded` requests payloads.\n  header?: Record<string, any>;\n  path?: Record<string, any>;\n  query?: Record<string, any>;\n  server?: {\n    selected: number;\n    variables?: ServerVariable;\n  };\n}\n\nexport type AuthForHAR = Record<string, number | string | { pass?: string; user?: string }>;\n\nexport interface User {\n  [key: string]: unknown;\n  keys?: {\n    [key: string]: unknown;\n    name: number | string;\n    pass?: number | string;\n    user?: number | string;\n  }[];\n}\n\n/**\n * The type of security scheme. Used by `operation.getSecurityWithTypes()` and `operation.prepareSecurity()`.\n */\nexport type SecurityType = 'apiKey' | 'Basic' | 'Bearer' | 'Cookie' | 'Header' | 'http' | 'OAuth2' | 'Query';\n\nexport type HttpMethods =\n  | OpenAPIV3_1.HttpMethods\n  | OpenAPIV3.HttpMethods\n  | 'delete'\n  | 'get'\n  | 'head'\n  | 'options'\n  | 'patch'\n  | 'post'\n  | 'put'\n  | 'trace';\n\n// The following are custom OpenAPI types that we use throughout this library, sans\n// `ReferenceObject` because we assume that the API definition has been dereferenced.\n//\n// These are organized by how they're defined in the OpenAPI Specification.\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}\n */\n// eslint-disable-next-line @typescript-eslint/sort-type-constituents\nexport type OASDocument = (OpenAPIV3_1.Document | OpenAPIV3.Document) &\n  // `x-*` extensions\n  Record<string, unknown>;\n\nexport type OAS31Document = OpenAPIV3_1.Document &\n  // `x-*` extensions\n  Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object}\n */\nexport type ServerObject = OpenAPIV3_1.ServerObject | OpenAPIV3.ServerObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object}\n */\nexport type ServerVariableObject = OpenAPIV3_1.ServerVariableObject | OpenAPIV3.ServerVariableObject;\nexport type ServerVariablesObject = Record<string, ServerVariableObject>;\nexport type ServerVariable = Record<\n  string,\n  { default?: number | string }[] | Record<string, never> | number | string | { default?: number | string }\n>;\n\nexport interface Servers {\n  selected: number;\n  variables: ServerVariable;\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#components-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object}\n */\nexport type ComponentsObject = OpenAPIV3_1.ComponentsObject | OpenAPIV3.ComponentsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object}\n */\nexport type PathsObject = OpenAPIV3_1.PathsObject | OpenAPIV3.PathsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object}\n */\nexport type PathItemObject = OpenAPIV3_1.PathItemObject | OpenAPIV3.PathItemObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object}\n */\n// eslint-disable-next-line @typescript-eslint/sort-type-constituents\nexport type OperationObject = (OpenAPIV3_1.OperationObject | OpenAPIV3.OperationObject) &\n  // `x-*` extensions\n  Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object}\n */\nexport type ParameterObject = {\n  in: 'cookie' | 'header' | 'path' | 'query';\n} & (OpenAPIV3_1.ParameterObject | OpenAPIV3.ParameterObject);\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object}\n */\nexport type RequestBodyObject = OpenAPIV3_1.RequestBodyObject | OpenAPIV3.RequestBodyObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object}\n */\nexport type MediaTypeObject = OpenAPIV3_1.MediaTypeObject | OpenAPIV3.MediaTypeObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object}\n */\nexport type ResponseObject = OpenAPIV3_1.ResponseObject | OpenAPIV3.ResponseObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}\n */\nexport type CallbackObject = OpenAPIV3_1.CallbackObject | OpenAPIV3.CallbackObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.3.md#example-object}\n */\nexport type ExampleObject = OpenAPIV3_1.ExampleObject | OpenAPIV3.ExampleObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tag-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object}\n */\nexport type TagObject = OpenAPIV3_1.TagObject | OpenAPIV3.TagObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#header-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object}\n */\nexport type HeaderObject = OpenAPIV3_1.HeaderObject | OpenAPIV3.HeaderObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object}\n */\nexport type SchemaObject = {\n  // OpenAPI-specific properties\n  externalDocs?: unknown;\n  xml?: unknown;\n} & {\n  // TODO: We should split this into one type for v3 and one type for v3.1 to ensure type accuracy.\n  $schema?: string;\n\n  // We add this to the schema to help out with circular refs\n  components?: OpenAPIV3_1.ComponentsObject;\n\n  deprecated?: boolean;\n  example?: unknown;\n  examples?: unknown[];\n  nullable?: boolean;\n  readOnly?: boolean;\n  writeOnly?: boolean;\n\n  // We add this extension within our dereferencing work to preserve the origin dereferenced\n  // schemas.\n  'x-readme-ref-name'?: string;\n} & ( // eslint-disable-next-line @typescript-eslint/sort-type-constituents\n    | OpenAPIV3.SchemaObject\n    | OpenAPIV3_1.SchemaObject\n    // Adding `JSONSchema` to this because `json-schema-merge-allof` expects those.\n    | JSONSchema\n  );\n\n/**\n * @param check JSON Schema object to determine if it's a non-polymorphic schema.\n * @param isPolymorphicAllOfChild If this JSON Schema object is the child of a polymorphic `allOf`.\n * @returns If the JSON Schema object is a JSON Schema object.\n */\nexport function isSchema(check: unknown, isPolymorphicAllOfChild = false): check is SchemaObject {\n  return (\n    (check as SchemaObject).type !== undefined ||\n    (check as SchemaObject).allOf !== undefined ||\n    (check as SchemaObject).anyOf !== undefined ||\n    (check as SchemaObject).oneOf !== undefined ||\n    isPolymorphicAllOfChild\n  );\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object}\n */\nexport type SecuritySchemeObject = OpenAPIV3_1.SecuritySchemeObject | OpenAPIV3.SecuritySchemeObject;\n\nexport type SecuritySchemesObject = Record<string, SecuritySchemeObject>;\n\nexport type KeyedSecuritySchemeObject = SecuritySchemeObject & {\n  /**\n   * The key for the given security scheme object\n   */\n  _key: string;\n\n  /**\n   * An array of required scopes for the given security scheme object.\n   * Used for `oauth2` security scheme types.\n   */\n  _requirements?: string[];\n\n  // `x-default` is our custom extension for specifying auth defaults.\n  // https://docs.readme.com/docs/openapi-extensions#authentication-defaults\n  'x-default'?: number | string;\n};\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object}\n */\nexport type SecurityRequirementObject = OpenAPIV3_1.SecurityRequirementObject | OpenAPIV3.SecurityRequirementObject;\n"]}