@looker/sdk-codegen 21.11.2 → 21.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/codeGen.js +5 -5
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGenerators.js.map +1 -1
- package/lib/csharp.gen.js +2 -2
- package/lib/csharp.gen.js.map +1 -1
- package/lib/declarationInfo.js.map +1 -1
- package/lib/esm/codeGen.js +6 -5
- package/lib/esm/codeGen.js.map +1 -1
- package/lib/esm/codeGenerators.js.map +1 -1
- package/lib/esm/csharp.gen.js +2 -2
- package/lib/esm/csharp.gen.js.map +1 -1
- package/lib/esm/declarationInfo.js.map +1 -1
- package/lib/esm/exampleInfo.js.map +1 -1
- package/lib/esm/go.gen.js +4 -3
- package/lib/esm/go.gen.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/kotlin.gen.js +2 -2
- package/lib/esm/kotlin.gen.js.map +1 -1
- package/lib/esm/pseudo.gen.js +2 -2
- package/lib/esm/pseudo.gen.js.map +1 -1
- package/lib/esm/python.gen.js +2 -2
- package/lib/esm/python.gen.js.map +1 -1
- package/lib/esm/sdkModels.js +37 -36
- package/lib/esm/sdkModels.js.map +1 -1
- package/lib/esm/specConverter.js +10 -10
- package/lib/esm/specConverter.js.map +1 -1
- package/lib/esm/specDiff.js.map +1 -1
- package/lib/esm/swift.gen.js +2 -2
- package/lib/esm/swift.gen.js.map +1 -1
- package/lib/esm/typescript.gen.js +2 -2
- package/lib/esm/typescript.gen.js.map +1 -1
- package/lib/exampleInfo.js.map +1 -1
- package/lib/go.gen.js +4 -3
- package/lib/go.gen.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/kotlin.gen.js +2 -2
- package/lib/kotlin.gen.js.map +1 -1
- package/lib/pseudo.gen.js +2 -2
- package/lib/pseudo.gen.js.map +1 -1
- package/lib/python.gen.js +2 -2
- package/lib/python.gen.js.map +1 -1
- package/lib/sdkModels.js +38 -39
- package/lib/sdkModels.js.map +1 -1
- package/lib/specConverter.js +11 -11
- package/lib/specConverter.js.map +1 -1
- package/lib/specDiff.js.map +1 -1
- package/lib/swift.gen.js +2 -2
- package/lib/swift.gen.js.map +1 -1
- package/lib/typescript.gen.js +2 -2
- package/lib/typescript.gen.js.map +1 -1
- package/package.json +3 -3
package/lib/esm/sdkModels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkModels.js","names":["OAS","md5","isEmpty","DelimArray","ResponseMode","StatusCode","responseMode","upgradeSpecObject","strBody","strRequest","strWrite","lookerValuesTag","enumTag","simpleName","TypeOfType","parseFields","fields","splitConsideringParentheses","segment","parts","currentPart","openParentheses","lastChar","charCheck","char","Error","concat","push","parseSegment","result","forEach","part","key","nestedStr","split","trim","slice","p","Array","isArray","f","typeOfType","type","intrinsic","Intrinsic","className","Hash","Enum","Complex","isSpecialName","name","test","safeName","value","replace","camelCase","$1","toLocaleUpperCase","titleCase","substring","firstCase","toLocaleLowerCase","searchIt","localeSort","a","b","localeCompare","describeParam","param","_param$type","desc","description","deprecated","match","keyValues","list","from","values","sort","mayQuote","quoteChar","arguments","length","undefined","str","toString","methodRefs","api","refs","keys","k","methods","typeRefs","ref","types","firstMethodRef","stack","Set","add","method","parents","parentTypes","parent","has","anyWriter","httpMethod","allTypes","customTypes","delete","SearchCriterion","SearchAll","argument","property","title","activityType","status","response","criteriaToSet","criteria","val","setToCriteria","MetaType","tagTypes","typeTags","Object","entries","filter","_ref","_","_ref2","first","tag","schema","tags","MethodResponse","constructor","statusCode","mediaType","mode","search","rx","searchString","Symbol","owner","_defineProperty","jsonName","snake","hasSpecialNeeds","fullName","asHashString","SchemadSymbol","deprecation","mockData","propertyName","override","_dataMocks$type$name","empty","over","stringer","mocked","String","inter","parseInt","floater","parseFloat","dater","Date","booler","Boolean","anyer","dataMocks","any","boolean","byte","binary","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","email","uuid","hostname","ipv4","ipv6","void","mockOptions","options","_options$override","_options$empty","Property","_schema$required","required","includes","nullable","readOnly","writeOnly","summary","mock","elementType","el","isString","scope","opts","JSON","stringify","data","Parameter","location","in","asSchemaObject","asProperty","signature","doEncode","Method","endpoint","params","responses","body","operationId","okays","OK","NoContent","primaryResponse","find","okResponses","returnType","id","responseModes","getResponseModes","addParam","r","addType","isFormUrlEncoded","rateLimited","isRateLimited","op","many","flag","_body$content","toUpperCase","requestBody","content","eligibleForRequestType","bodyParams","offset","optionalParams","makeTypes","getRequestType","_ref3","writer","mayGetWriteableType","custom","customType","modes","resp","unknown","size","allParams","index","requiredParams","optional","pathParams","getParams","queryParams","headerParams","cookieParams","pathArgs","argumentNames","bodyArg","queryArgs","headerArgs","cookieArgs","errorResponses","map","Map","item","set","responseIsBinary","responseIsString","responseIsBoth","locationSorter","remain","before","locations","i","hasOptionalParams","isMethodSearch","Type","metaType","RequestType","Request","WriteType","Write","EnumType","Enumerated","Specification","writeable","_writeable","setWriteable","properties","prop","w","writeProp","_objectSpread","maySetWriteable","default","every","_ref4","filterRequiredProps","filteredProps","_ref5","condition","requiredProperties","optionalProperties","_ref6","props","merge","overKeys","v","mockType","load","_ref7","propName","propSchema","propType","resolveType","instanceOf","registerEnum","_propType$elementType","_propType$elementType2","_ref8","_ref9","_ref10","isRecursive","selfType","some","_ref11","isPropSearch","_ref12","ArrayType","typeName","methodName","findName","hash","enums","getEnumList","matched","baseName","newName","_options","join","DelimArrayType","HashType","IntrinsicType","stringTypes","typeWriter","roProps","readonlyProps","obj","writes","_ref21","_ref22","specToModel","spec","parse","json","OpenApiBuilder","getSpec","ApiModel","version","_this$spec","info","_this$spec2","_this$spec2$info","_this$spec2$info$desc","fromString","specContent","fromJson","isTypeSearch","addMethodToTags","tagMethod","expression","methodCount","typeCount","ok","message","RegExp","e","_ref13","_ref14","jsonPath","path","splitter","schemaHasEnums","style","getRef","$ref","t","indexOf","lastIndexOf","deref","isReferenceObject","format","items","resolved","num","additionalProperties","requestTypeName","makeRequestType","request","enumTypes","_getRequestType","refCount","makeWriteableType","_type$elementType","_ref15","immutable","loadDynamicTypes","_ref16","sortList","sortedKeys","sortLists","typeKeys","_this$spec3","_this$spec3$component","_this$spec4","components","schemas","_ref17","complex","nested","paths","_ref18","loadMethods","addIfPresent","opSchema","methodResponses","methodParameters","get","put","post","patch","_ref19","contentSchema","_ref20","parameters","mp","req","typeSchema","media"],"sources":["../../src/sdkModels.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport * as OAS from 'openapi3-ts';\nimport md5 from 'blueimp-md5';\nimport isEmpty from 'lodash/isEmpty';\nimport type { ArgValues, HttpMethod } from '@looker/sdk-rtl';\nimport {\n DelimArray,\n ResponseMode,\n StatusCode,\n responseMode,\n} from '@looker/sdk-rtl';\nimport { upgradeSpecObject } from './specConverter';\n\n/**\n * Handy specification references\n * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object\n * https://swagger.io/docs/specification/data-models/data-types/\n */\n\nexport const strBody = 'body';\nexport const strRequest = 'Request';\nexport const strWrite = 'Write';\nexport declare type Arg = string;\n\n/**\n * Tags for types that have an `x-looker-values` or `enum` specification\n * according to https://swagger.io/docs/specification/data-models/enums/\n *\n * Ordinarily, if the OpenAPI specification is created by SDK Codegen, `x-looker-values` will already be converted to `enum`\n */\nconst lookerValuesTag = 'x-looker-values';\nconst enumTag = 'enum';\n\n/** simple symbol name pattern */\nconst simpleName = /^[a-z_][a-z_\\d]*(\\[])?$/im;\n\n/**\n * Convenience enum for exploring types\n */\nexport enum TypeOfType {\n /** This is an intrinsic type */\n Intrinsic,\n /** This is an ArrayType */\n Array,\n /** This is a HashType */\n Hash,\n /** This is a DelimArrayType */\n DelimArray,\n /** This is an EnumType */\n Enum,\n /** This is an EnumType */\n Complex,\n}\n\n/**\n * parses a fields string, creating nested keys if found\n * @param fields comma and parenthesis delimited field group expression\n */\nexport const parseFields = (fields: FieldsSpec) => {\n function splitConsideringParentheses(segment: string) {\n // builds a list of the parts of a request string from the input\n const parts: string[] = [];\n // builds up a new string of what constitutes a building block of the query\n let currentPart = '';\n // openParentheses emulates a stack to determine where\n // a parenthesis ends\n let openParentheses = 0;\n let lastChar = '';\n function charCheck(char: string) {\n if (lastChar === char) {\n if (char === '(' || (char === ')' && openParentheses < 0)) {\n throw new Error(\n `Unexpected '${char}' after '${currentPart}' parens:${openParentheses}`\n );\n }\n }\n }\n\n for (const char of segment) {\n if (char === '(') {\n openParentheses++;\n charCheck(char);\n } else if (char === ')') {\n openParentheses--;\n charCheck(char);\n }\n\n // if we hit a comma and the open parenthesis stack is empty, take the\n // currentPart and reset it, otherwise, continue building\n if (char === ',' && openParentheses === 0) {\n parts.push(currentPart);\n currentPart = '';\n } else {\n currentPart += char;\n }\n lastChar = char;\n }\n if (currentPart) {\n parts.push(currentPart);\n }\n return parts;\n }\n\n // helper function to recursively parse each segment of the string\n function parseSegment(segment: string) {\n const parts = splitConsideringParentheses(segment);\n const result: ArgValues = {};\n\n parts.forEach(part => {\n // split each part into a key and any nested string\n let [key, nestedStr] = part.split(/\\((.+)/);\n key = key.trim();\n if (nestedStr) {\n nestedStr = nestedStr.slice(0, -1); // Remove the closing parenthesis\n if (key in result) {\n throw new Error(`Duplicate '${key}' found`);\n }\n result[key] = parseSegment(nestedStr);\n } else {\n const p = part.trim();\n if (p in result) {\n throw new Error(`Duplicate '${key}' found`);\n }\n if (p) result[p] = p;\n }\n });\n return result;\n }\n\n if (typeof fields === 'string') {\n fields = fields.trim();\n if (!fields) return {};\n return parseSegment(fields);\n } else if (Array.isArray(fields)) {\n const result: ArgValues = {};\n fields.forEach(f => (result[f] = f));\n return result;\n }\n // Presume this is already a keyed collection and just return it\n return fields;\n};\n\n/**\n * Get the enum for the class of the type\n * @param type\n */\nexport const typeOfType = (type: IType): TypeOfType => {\n if (type.intrinsic) return TypeOfType.Intrinsic;\n switch (type.className) {\n case 'ArrayType':\n return TypeOfType.Array;\n case 'HashType':\n return TypeOfType.Hash;\n case 'DelimArrayType':\n return TypeOfType.DelimArray;\n case 'EnumType':\n return TypeOfType.Enum;\n default: {\n return TypeOfType.Complex;\n }\n }\n};\n\n/**\n * Does this name have special characters?\n * @param name to name check\n * @returns true if the name isn't a standard variable name, optionally ending with []\n */\nexport const isSpecialName = (name: string) => {\n if (!name) return false;\n // simple naming pattern that should theoretically just work\n const result = simpleName.test(name);\n return !result;\n};\n\n/**\n * convert string to a safe variable name\n *\n * @param value string value to convert to a safe variable name\n */\nexport const safeName = (value: string) => {\n if (!value) return '';\n // TODO need to convert unicode characters also\n return value.replace(/([-_ ]+)/g, '_');\n};\n\n/**\n * convert string to camelCase\n * @param value string value to convert to camelCase\n */\nexport const camelCase = (value: string) => {\n if (!value) return '';\n return value.replace(/(([-_ ]+)[a-z])|([-_ ]+)/gi, $1 => {\n return $1.toLocaleUpperCase().replace(/([-_ ]+)/gi, '');\n });\n};\n/**\n * convert string to TitleCase\n * @param value string value to convert to TitleCase\n */\nexport const titleCase = (value: string) => {\n if (!value) return '';\n value = camelCase(value);\n return value[0].toLocaleUpperCase() + value.substring(1);\n};\n\n/**\n * Only first character of string should be uppercase\n *\n * Values are first converted to camelCase()\n *\n * @param value of string to convert\n * @returns converted string\n */\nexport const firstCase = (value: string) => {\n if (!value) return '';\n value = camelCase(value);\n return value[0].toLocaleUpperCase() + value.substring(1).toLocaleLowerCase();\n};\n\nexport interface IModel {}\n\n/**\n * create a \"searchable\" string that can be concatenated to a larger search string\n * @param {string} value to search\n * @returns {string} value plus search delimiter\n */\nconst searchIt = (value: string) => (value ? value + '\\t' : '');\n\n/**\n * lambda function for local sorting\n * @param {string} a first string to compare\n * @param {string} b second string to compare\n * @returns {any} but should be -1, 0, or 1\n */\nconst localeSort = (a: string, b: string) => a.localeCompare(b);\n\nexport interface ISymbol {\n name: string;\n fullName: string;\n owner: string;\n /**\n * if the specification name is a \"special name\" (e.g. the name contains hyphens or is unicode), it's saved here\n * and the name property will have the supported name since not all SDK languages support special names.\n * for example, \"foo-bar\" and \"foo bar\" would be saved in jsonName, and name=\"foo_bar\"\n */\n jsonName: string;\n\n /**\n * returns True if the symbol or any symbols it contains have a \"special name\"\n */\n hasSpecialNeeds: boolean;\n\n asHashString(): string;\n\n searchString(criteria: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n}\n\nexport interface ITypedSymbol extends ISymbol {\n type: IType;\n}\n\nexport interface IParameter extends ITypedSymbol {\n location: MethodParameterLocation;\n required: boolean;\n description: string;\n deprecated: boolean;\n\n asProperty(): IProperty;\n\n signature(): string;\n\n summary(): string;\n\n asHashString(): string;\n\n doEncode(): boolean;\n}\n\n/**\n * Add generational annotations to a parameter description, like (DEPRECATED)\n * @param param to describe\n */\nexport const describeParam = (param: IParameter) => {\n let desc = param.description || param.type?.description;\n if (param.deprecated) {\n if (!param.description.match(/deprecated/gi)) {\n desc = `(DEPRECATED) ${desc}`;\n }\n }\n return desc;\n};\n\nexport type KeyedCollection<T> = Record<string, T>;\nexport type MethodList = KeyedCollection<IMethod>;\nexport type TypeList = KeyedCollection<IType>;\nexport type TagList = KeyedCollection<MethodList>;\nexport type TypeTagList = KeyedCollection<TypeList>;\nexport type PropertyList = KeyedCollection<IProperty>;\nexport type KeyList = Set<string>;\nexport type EnumValueType = string | number;\n\n/**\n * Returns sorted string array for IKeylist type\n * @param list Set of values\n * @returns sorted string array of keys\n */\nexport const keyValues = (list: KeyList): string[] => {\n if (!list) return [];\n return Array.from(list.values()).sort();\n};\n\n/**\n * Optionally quote a string if quotes are required\n * @param value to convert to string and optionally quote\n * @param quoteChar defaults to \"'\"\n * @returns the quoted or unquoted value\n */\nexport const mayQuote = (value: any, quoteChar = `'`): string => {\n const str = value.toString();\n if (!isSpecialName(str)) return str;\n return `${quoteChar}${str}${quoteChar}`;\n};\n\n/**\n * Resolve a list of method keys into an IMethod[] in alphabetical order by name\n * @param api model to use\n * @param refs references to models\n * @returns Populated method list. Anything not matched is skipped\n */\nexport const methodRefs = (api: IApiModel, refs: KeyList): IMethod[] => {\n const keys = keyValues(refs);\n const result: IMethod[] = [];\n keys.forEach(k => {\n if (k in api.methods) {\n result.push(api.methods[k]);\n }\n });\n return result;\n};\n\n/**\n * Resolve a list of method keys into an IType[] in alphabetical order by name\n * @param api model to use\n * @param refs references to models\n * @returns Populated method list. Anything not matched is skipped\n */\nexport const typeRefs = (api: IApiModel, refs: KeyList): IType[] => {\n const keys = keyValues(refs);\n const result: IType[] = [];\n keys.forEach(k => {\n const ref = api.types[k];\n if (ref) {\n result.push(ref);\n }\n });\n return result;\n};\n\n/**\n * Resolves first method ref it can find\n * @param api parsed spec\n * @param type tree to walk\n * @param stack call stack to prevent infinite recursion\n */\nexport const firstMethodRef = (\n api: ApiModel,\n type: IType,\n stack: KeyList = new Set<string>()\n): IMethod => {\n stack.add(type.name);\n\n let method = methodRefs(api, type.methodRefs)[0];\n if (!method) {\n const parents = typeRefs(api, type.parentTypes);\n for (const parent of parents) {\n if (!stack.has(parent.name)) {\n method = firstMethodRef(api, parent, stack);\n }\n if (method) break;\n }\n }\n return method;\n};\n\n/**\n * Returns the first method (if any) that uses the reference type for updating\n * @param api parsed spec\n * @param type to check for writing\n * @param stack call stack to prevent infinite recursion\n */\nconst anyWriter = (\n api: ApiModel,\n type: IType,\n stack: KeyList = new Set<string>()\n): IMethod | undefined => {\n let result: IMethod | undefined;\n if (stack.has(type.name)) return undefined;\n stack.add(type.name);\n const methods = methodRefs(api, type.methodRefs);\n for (const method of methods) {\n if (\n method.httpMethod === 'POST' ||\n method.httpMethod === 'PUT' ||\n method.httpMethod === 'PATCH'\n ) {\n result = method;\n break;\n }\n }\n if (!result) {\n const allTypes = new Set([...type.parentTypes, ...type.customTypes]);\n allTypes.delete(type.name);\n const refs = typeRefs(api, allTypes);\n\n for (const ref of refs) {\n result = anyWriter(api, ref, stack);\n if (result) {\n break;\n }\n }\n }\n return result;\n};\n\nexport interface ISymbolList {\n methods: MethodList;\n types: TypeList;\n}\n\nexport enum SearchCriterion {\n method,\n type,\n name,\n description,\n argument,\n property,\n title,\n activityType,\n status,\n response,\n}\n\nexport type SearchCriterionTerm = keyof typeof SearchCriterion;\n\nexport type SearchCriteria = Set<SearchCriterion>;\n\nexport const SearchAll: SearchCriteria = new Set([\n SearchCriterion.method,\n SearchCriterion.type,\n SearchCriterion.name,\n SearchCriterion.description,\n SearchCriterion.argument,\n SearchCriterion.property,\n SearchCriterion.title,\n SearchCriterion.activityType,\n SearchCriterion.status,\n SearchCriterion.response,\n]);\n\nexport const criteriaToSet = (criteria: string[]): SearchCriteria => {\n const result: SearchCriteria = new Set();\n criteria.forEach(name => {\n const val = SearchCriterion[name as SearchCriterionTerm];\n if (val !== undefined)\n result.add(SearchCriterion[name as SearchCriterionTerm]);\n });\n return result;\n};\n\nexport const setToCriteria = (criteria: SearchCriteria): string[] => {\n const result: string[] = [];\n criteria.forEach(value => result.push(SearchCriterion[value]));\n return result;\n};\n\nexport interface ISearchResult {\n ok: boolean;\n tags: TagList;\n types: TypeList;\n message: string;\n}\n\nexport interface ISymbolTable extends ISymbolList {\n resolveType(schema: OAS.SchemaObject): IType;\n}\n\n/** Type of type */\nexport enum MetaType {\n /** scalar type */\n Intrinsic = 'Intrinsic',\n /** from API specification */\n Specification = 'Specification',\n /** writeable type */\n Write = 'Write',\n /** Request type for API methods */\n Request = 'Request',\n /** enumerated type */\n Enumerated = 'Enumerated',\n}\n\n/**\n * Options for type and property mocks\n */\nexport interface ITypeMock {\n /**\n * Optional names of properties to be mocked for the return value.\n *\n * **Default behavior**: For a property that is *not required*,\n * the default return value is `undefined`. If the property is\n * *required* and is a complex type, the required properties of the\n * type will be returned by calling `Type.mock()` with exactly the\n * same parameters provided to `Property.mock()`, where the same\n * rules apply. If `undefined` is returned to `Type.mock()` from\n * its `Property.mock()` calls, that property will be omitted\n * from the `Type.mock()` return. If `*` is used, all fields in\n * a complex type are mocked.\n */\n fields?: FieldsSpec;\n /**\n * optional override value(s) for mocked data return. Can be either a single\n * string value, or a hash of key/value items\n */\n override?: string | ArgValues | ((response: any, mocked: any) => any);\n httpCode?: number;\n /** true to use \"empty\" values for the mock data. Applies to all mocked values */\n empty?: boolean;\n}\n\nexport interface IType extends ISymbol {\n /**\n * key/value collection of properties for this type\n */\n properties: PropertyList;\n\n /**\n * key/value collection of required properties for this type\n */\n requiredProperties: PropertyList;\n\n /**\n * key/value collection of optional properties for this type\n */\n optionalProperties: PropertyList;\n\n /**\n * List of writeable properties for this type\n */\n writeable: IProperty[];\n\n /**\n * Status like 'beta', 'experimental', 'stable'\n */\n status: string;\n\n /**\n * If this type is a collection, this is the \"item\" type\n */\n elementType?: IType;\n\n /**\n * True if this type is deprecated\n */\n deprecated: boolean;\n\n /**\n * Description of the type\n */\n description: string;\n\n /**\n * Title for the type. Dunno why OAS has this\n */\n title: string;\n\n /**\n * Default value for the type. Optional types may have default values defined\n */\n default?: string;\n\n /**\n * Is this a read-only type?\n */\n readOnly: boolean;\n\n /**\n * Number of times this type is referenced, per language, when generating methods\n * Other than for reporting purposes, this is used to generate import statements\n * Idea adopted from Delphi\n */\n refCount: number;\n\n /**\n * OAS schema for the type\n */\n schema: OAS.SchemaObject;\n\n /**\n * If this is a custom type from the API specification, it will be eponymous\n * If it's a list type, it will be customType of the item type\n * Otherwise, it will be '' (e.g. IntrinsicType)\n */\n customType: string;\n\n /**\n * names of methods referencing this type\n */\n methodRefs: KeyList;\n\n /**\n * Names of types referenced by this type\n */\n types: KeyList;\n\n /**\n * Names of custom types referenced by this type\n */\n customTypes: KeyList;\n\n /**\n * Names of custom types that have a property of this type\n */\n parentTypes: KeyList;\n\n /**\n * Hopefully temporary concession to build problems with instance of ArrayType checks etc failing\n */\n className: string;\n\n /**\n * Is this an intrinsic type?\n */\n intrinsic: boolean;\n\n /**\n * type classification\n */\n metaType: MetaType;\n\n /** Generate consistent, correctly typed mock data for the property */\n mock(options?: ITypeMock): any | undefined;\n\n /** Generate typed, consistent, correctly typed mock data for the property */\n mockType<T>(options?: ITypeMock): T;\n\n /**\n * Hacky workaround for inexplicable instanceof failures\n * @param {string} className name of class to check\n * @returns {boolean} true if class name matches this.className\n */\n instanceOf(className: string): boolean;\n\n asHashString(): string;\n\n isRecursive(): boolean;\n\n searchString(criteria: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n}\n\nexport interface IEnumType extends IType {\n values: EnumValueType[];\n}\n\nexport declare type MethodParameterLocation =\n | 'path'\n | 'body'\n | 'query'\n | 'header'\n | 'cookie';\n\nexport interface IMethodResponse {\n statusCode: number;\n mediaType: string;\n type: IType;\n mode: ResponseMode;\n description: string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n\n searchString(criteria: SearchCriteria): string;\n}\n\n/**\n * categorize all types using their method refs\n *\n * @param api parsed Api specification\n * @param types to categorize\n */\nexport const tagTypes = (api: ApiModel, types: TypeList) => {\n const typeTags: ArgValues = {};\n Object.entries(types)\n .filter(([_, type]) => !type.intrinsic)\n .forEach(([name, type]) => {\n let methods = methodRefs(api, type.methodRefs);\n // If no method is found, look up parents until you get a method\n if (methods.length === 0) {\n const first = firstMethodRef(api, type);\n if (first) methods = [first];\n }\n methods.forEach(method => {\n // The type is tagged for each method's tags\n for (const tag of method.schema.tags) {\n let list: TypeList = typeTags[tag];\n if (!list) {\n list = {};\n typeTags[tag] = list;\n }\n list[name] = type;\n }\n });\n });\n return typeTags;\n};\n\nclass MethodResponse implements IMethodResponse {\n // TODO either use this https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md\n // or turn off 'useless constructor' linting\n constructor(\n public statusCode: number,\n public mediaType: string,\n public type: IType,\n public description: string\n ) {}\n\n get mode(): ResponseMode {\n return responseMode(this.mediaType);\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n if (!criteria.has(SearchCriterion.response)) return false;\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n searchString(criteria: SearchCriteria): string {\n let result =\n searchIt(`${this.statusCode}`) + searchIt(`${ResponseMode[this.mode]}`);\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.mediaType);\n return result;\n }\n}\n\nexport type FieldsSpec = string | string[] | ArgValues;\n\nexport interface IProperty extends ITypedSymbol {\n required: boolean;\n nullable: boolean;\n description: string;\n readOnly: boolean;\n writeOnly: boolean;\n deprecated: boolean;\n schema: OAS.SchemaObject;\n owner: string;\n\n /**\n * Generate consistent, correctly typed mock data for the property\n */\n mock(options?: ITypeMock): any | undefined;\n\n searchString(include: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} include items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, include: SearchCriteria): boolean;\n\n summary(): string;\n}\n\nclass Symbol implements ISymbol {\n jsonName = '';\n readonly hasSpecialNeeds: boolean = false;\n constructor(\n public name: string,\n public type: IType,\n public owner: string = ''\n ) {\n this.jsonName = name;\n const snake = safeName(name);\n if (snake !== name) {\n this.name = snake;\n this.hasSpecialNeeds = true;\n }\n }\n\n get fullName(): string {\n return `${this.owner ? this.owner + '.' : ''}${this.name}`;\n }\n\n asHashString() {\n return `${this.name}:${this.type.name}`;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n searchString(criteria: Set<SearchCriterion>): string {\n let result = '';\n if (\n criteria.has(SearchCriterion.name) ||\n criteria.has(SearchCriterion.method)\n )\n result += searchIt(this.name) + searchIt(this.jsonName);\n return result;\n }\n}\n\ninterface ISchemadSymbol extends ITypedSymbol {\n /**\n * Original OpenAPI schema reference for this item\n */\n schema: OAS.SchemaObject;\n\n /**\n * Status indicator of this item. Typically 'stable', 'beta', 'experimental', or ''\n */\n status: string;\n\n /**\n * Description of this item\n */\n description: string;\n\n /**\n * True if this item has been deprecated\n */\n deprecated: boolean;\n\n /**\n * If deprecated, 'deprecated'. Otherwise ''\n */\n deprecation: string;\n}\n\nclass SchemadSymbol extends Symbol implements ISchemadSymbol {\n schema: OAS.SchemaObject;\n description: string;\n deprecated = false;\n\n constructor(name: string, type: IType, schema: OAS.SchemaObject, owner = '') {\n super(name, type, owner);\n this.schema = schema;\n this.description = schema.description || type.description || '';\n this.deprecated =\n schema.deprecated || schema['x-looker-deprecated'] || false;\n }\n\n get status(): string {\n return this.schema['x-looker-status'] || '';\n }\n\n get deprecation(): string {\n return this.deprecated ? 'deprecated' : '';\n }\n}\n\n/**\n * return the mocked data value for the type, or undefined\n * @param propertyName of property\n * @param type to mock\n * @param override optional data to coerce to type\n * @param empty true to make mocked value an \"empty\" value. Defaults to false\n */\nconst mockData = (\n propertyName: string,\n type: IType,\n override?: any,\n empty = false\n) => {\n const over = override !== undefined;\n const stringer = (mocked: string) => {\n if (over) {\n return String(override);\n }\n if (empty) {\n return '';\n }\n return mocked;\n };\n const inter = (mocked: number) => {\n if (over) {\n return parseInt(override, 10);\n }\n if (empty) {\n return 0;\n }\n return mocked;\n };\n\n const floater = (mocked: number) => {\n if (over) {\n return parseFloat(override);\n }\n if (empty) {\n return 0.0;\n }\n return mocked;\n };\n\n const dater = (mocked: Date) => {\n if (over) {\n return new Date(override);\n }\n if (empty) {\n return new Date(1970, 0, 1);\n }\n return mocked;\n };\n\n const booler = (mocked: boolean) => {\n if (over) {\n return Boolean(override);\n }\n if (empty) {\n return false;\n }\n return mocked;\n };\n\n const anyer = (mocked: any) => {\n if (over) {\n return override;\n }\n if (empty) {\n return {};\n }\n return mocked;\n };\n\n const dataMocks: Record<string, { value: any }> = {\n any: { value: anyer({ a: 1, b: 'two' }) },\n boolean: { value: booler(true) },\n byte: { value: stringer('A') },\n binary: { value: stringer('01') },\n date: { value: dater(new Date(2024, 0, 5)) },\n datetime: { value: dater(new Date(2024, 0, 5, 1)) },\n double: { value: floater(2.2) },\n float: { value: floater(1.1) },\n int32: { value: inter(32) },\n int64: { value: inter(64) },\n integer: { value: inter(1) },\n number: { value: inter(2) },\n object: { value: anyer({ [propertyName]: 1 }) },\n password: { value: stringer('*') },\n string: { value: stringer(propertyName) },\n uri: { value: stringer(`urn:${propertyName}`) },\n url: { value: stringer(`https://${propertyName}.mock`) },\n email: { value: stringer(`${propertyName}@example.com`) },\n uuid: { value: stringer(`uuid-${propertyName}`) },\n hostname: { value: stringer(`https://${propertyName}`) },\n ipv4: { value: stringer('127.0.0.1') },\n ipv6: { value: stringer('::1') },\n void: { value: over ? override : null },\n };\n\n return dataMocks[type.name] ?? override;\n};\n\n/**\n * Default mocking options for type and property mock\n * @param options to default for mock() call\n */\nconst mockOptions = (options: ITypeMock) => {\n return {\n fields: options?.fields ? options?.fields : '',\n override: options?.override ?? {},\n empty: options?.empty ?? false,\n };\n};\n\nexport class Property extends SchemadSymbol implements IProperty {\n required = false;\n nullable = false;\n readOnly = false;\n writeOnly = false;\n\n constructor(\n name: string,\n type: IType,\n schema: OAS.SchemaObject,\n owner = '',\n required: string[] = []\n ) {\n super(name, type, schema, owner);\n this.required = Boolean(\n required.includes(name) || schema.required?.includes(name)\n );\n this.nullable =\n this.schema.nullable || this.schema['x-looker-nullable'] || false;\n this.readOnly = this.schema.readOnly || false;\n this.writeOnly = this.schema.writeOnly || false;\n }\n\n private tag(key: string) {\n return (this as ArgValues)[key] ? ` ${key}` : '';\n }\n\n summary() {\n return `${this.fullName}:${this.type.name}${this.tag('readOnly')}${this.tag(\n 'required'\n )}${this.tag('nullable')}${this.tag('deprecated')}`;\n }\n\n asHashString() {\n return (\n super.asHashString() +\n this.tag('readOnly') +\n this.tag('required') +\n this.tag('nullable') +\n this.tag('deprecated')\n );\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = super.searchString(criteria);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n if (criteria.has(SearchCriterion.status))\n result += searchIt(this.status) + searchIt(this.deprecation);\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const { fields, override, empty } = mockOptions(options);\n if (isEmpty(fields) && !this.required) return undefined; // don't mock by default\n const keys = parseFields(fields);\n if (!isEmpty(fields) && !(this.name in keys)) return undefined; // not requested, don't mock\n const type = this.type;\n\n if (type.elementType) {\n // This is a structure with nested types.\n const el = type.elementType;\n // Default intrinsic string type values to the name of this type\n const over =\n el.intrinsic && (el as unknown as IntrinsicType).isString\n ? this.name\n : override;\n // if fields spec does not have a list of keys for this property, treat nested scope as defaulting\n const scope =\n typeof keys[this.name] === 'string' ? undefined : keys[this.name];\n // For complex types, just pass the mock call on down\n const opts = el.intrinsic\n ? { fields: el.name, override: over }\n : { fields: scope, override };\n const val = el.mock(opts);\n switch (type.className) {\n case 'ArrayType':\n return empty ? [] : [val];\n case 'HashType':\n return empty ? {} : { a: val };\n case 'DelimArrayType':\n return empty ? new DelimArray([]) : new DelimArray([val]);\n case 'EnumType':\n return (type as unknown as EnumType).values[0];\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`);\n }\n\n if (type.name) {\n if (type.intrinsic) {\n const data = mockData(this.name, type, undefined, empty);\n return data.value;\n }\n // This property is a complex type so only use overrides with default\n // property names typically don't match the case of the type name, and\n // matching must be case-sensitive\n return type.mock({ override, empty });\n } else {\n throw new Error('Cannot output a nameless type.');\n }\n }\n}\n\nexport class Parameter extends SchemadSymbol implements IParameter {\n description = '';\n location: MethodParameterLocation = 'query';\n required = false;\n\n constructor(\n param: OAS.ParameterObject | Partial<IParameter>,\n type: IType,\n owner = ''\n ) {\n super(param.name || '', type, type.schema, owner);\n this.description = param.description || type.description || '';\n if ('in' in param) {\n this.location = param.in;\n } else {\n this.location = (param as Partial<IParameter>).location || strBody;\n }\n this.deprecated = param.deprecated || this.deprecated;\n // TODO deal with the required value being the names of the columns that are required\n this.required = param.required || false;\n }\n\n asSchemaObject() {\n return {\n deprecated: this.deprecated,\n description: this.description,\n\n nullable: !this.required,\n\n readOnly: false,\n // || this.location === strBody),\n required: this.required ? [this.name] : undefined,\n type: this.type.name || this.name,\n writeOnly: false,\n } as OAS.SchemaObject;\n }\n\n asProperty() {\n return new Property(this.name, this.type, this.asSchemaObject());\n }\n\n private tag(key: string) {\n return (this as ArgValues)[key] ? ` ${key}` : '';\n }\n\n signature() {\n return (\n (this.required ? '' : '[') +\n this.name +\n ':' +\n this.type.name +\n (this.required ? '' : ']')\n );\n }\n\n summary() {\n return `${this.fullName}:${this.type.name}${this.tag('readOnly')}${this.tag(\n 'required'\n )}${this.tag('nullable')}${this.tag('deprecated')}`;\n }\n\n asHashString() {\n return `${this.name}:${this.type.name}${this.required ? '' : '?'}${\n this.location\n }`;\n }\n\n doEncode() {\n return (\n this.type.name === 'string' ||\n this.type.name === 'datetime' ||\n this.type.name === 'date'\n );\n }\n\n searchString(criteria: Set<SearchCriterion>): string {\n let result = '';\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.name);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n}\n\n/**\n * Properties and methods of an SDK method\n *\n * Everything required to generate a method declaration, and documentation for it,\n * is contained in this interface. Search functionality is also included.\n *\n */\nexport interface IMethod extends ISchemadSymbol {\n /** Lookup id */\n id: string;\n\n /** alias of ISymbol.name */\n operationId: string;\n\n /** HTTP method used for this REST request */\n httpMethod: HttpMethod;\n\n /** Relative URL of the endpoint */\n endpoint: string;\n\n /** Prefers 200 response with application/json as the response type */\n primaryResponse: IMethodResponse;\n\n /** If there's only one 200 or 204 response for this method, this is it's return type */\n returnType: IMethodResponse | undefined;\n\n /** List of all responses that can be returned by this REST call */\n responses: IMethodResponse[];\n\n /** List of all 2xx responses */\n okResponses: IMethodResponse[];\n\n /** Description (from the spec) of this method */\n description: string;\n\n /** All parameters defined for this method, in natural order from spec processing */\n params: IParameter[];\n\n /** Summary from the method's schema object */\n summary: string;\n\n /** Names of path arguments. Not in required/optional priority */\n pathArgs: string[];\n\n /** Primary body argument name ('' if it doesn't exist) */\n bodyArg: string;\n\n /** Names of query arguments. Not in required/optional priority */\n queryArgs: string[];\n\n /** Names of header arguments. Not currently used by Codegen */\n headerArgs: string[];\n\n /** Names of cookie arguments. Not currently used by Codegen */\n cookieArgs: string[];\n\n /** Responses that have HTTP error codes (4xx) */\n errorResponses: IMethodResponse[];\n\n /** All required parameters, ordered by location precedence */\n requiredParams: IParameter[];\n\n /** All optional parameters, ordered by location precedence */\n optionalParams: IParameter[];\n\n /**\n * All parameters in the correct, sorted order for the method code generator\n * Parameters are required, by location precedence, then optional, by location precedence\n */\n allParams: IParameter[];\n\n /** All body parameters in natural order */\n bodyParams: IParameter[];\n\n /** All path parameters in natural order */\n pathParams: IParameter[];\n\n /** All query parameters in natural order */\n queryParams: IParameter[];\n\n /** The types of responses returned by this method (binary and/or string) */\n responseModes: Set<ResponseMode>;\n\n /** Value of `x-looker-activity-type` from schema specification */\n activityType: string;\n\n /** all type names referenced in this method, including intrinsic types */\n types: KeyList;\n\n /** all non-instrinsic type names referenced in this method */\n customTypes: KeyList;\n\n /** true if this method is a rate-limited API endpoint */\n rateLimited: boolean;\n\n /** true if this method consumes application/x-www-form-urlencoded and is POST/PUT/PATCH */\n isFormUrlEncoded: boolean;\n\n /**\n * Get a list of parameters for location, or just all parameters\n * @param {MethodParameterLocation} location is optional. defaults to all parameters\n * @returns {IParameter[]} all parameters in natural order matching the location constraing\n */\n getParams(location?: MethodParameterLocation): IParameter[];\n\n /**\n * return the list of optional parameters, optionally for a specific location\n * @param {MethodParameterLocation} location\n * @returns {IParameter[]}\n */\n optional(location?: MethodParameterLocation): IParameter[];\n\n /**\n * return the list of required parameters, optionally for a specific location\n */\n required(location?: MethodParameterLocation): IParameter[];\n\n /**\n * Does this method have optional parameters?\n * @returns {boolean} true if optional parameters exist for this method\n */\n hasOptionalParams(): boolean;\n\n /**\n * Does this method return binary responses?\n * @returns {boolean} true if binary responses are possible\n */\n responseIsBinary(): boolean;\n\n /**\n * Does this method return string responses?\n * @returns {boolean} true if string responses are possible\n */\n responseIsString(): boolean;\n\n /**\n * Does this method return both binary and string responses\n * @returns {boolean} true if both binary and string responses are possible\n */\n responseIsBoth(): boolean;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n\n /**\n * Add a parameter to the method, tracking all cross-reference information\n * @param {IApiModel} api specification containing this method\n * @param {IParameter} param to add to the spec\n * @returns {IMethod} the defined method with parameter and references added\n */\n addParam(api: IApiModel, param: IParameter): IMethod;\n\n /**\n * Add a type to the method, tracking all cross-reference information\n * @param {IApiModel} api specification containing this method\n * @param {IType} type to add to the spec\n * @returns {IMethod} the defined method with parameter and references added\n */\n addType(api: IApiModel, type: IType): IMethod;\n\n /**\n * Sorts parameters by location precedence, then alphanumeric\n * @param {IParameter[]} list\n * @returns {IParameter[]}\n */\n sort(list?: IParameter[]): IParameter[];\n\n /**\n * If a method may need a request type for a given language, this function returns true\n */\n eligibleForRequestType(): boolean;\n\n /**\n * If any dynamic types will be required for this method, this function will make them\n *\n * Dynamic types are Request and Write types\n *\n * @param api the spec to use for making types\n * @returns {KeyList} the list of all types used by the method\n */\n makeTypes(api: IApiModel): KeyList;\n\n signature(): string;\n}\n\n/**\n * Concrete implementation of IMethod interface\n */\nexport class Method extends SchemadSymbol implements IMethod {\n readonly id: string;\n readonly httpMethod: HttpMethod;\n readonly endpoint: string;\n readonly primaryResponse: IMethodResponse;\n responses: IMethodResponse[];\n readonly okResponses: IMethodResponse[];\n readonly params: IParameter[];\n readonly responseModes: Set<ResponseMode>;\n readonly activityType: string;\n readonly customTypes: KeyList;\n readonly types: KeyList;\n readonly rateLimited: boolean;\n readonly returnType: IMethodResponse | undefined;\n\n constructor(\n api: IApiModel,\n httpMethod: HttpMethod,\n endpoint: string,\n schema: OAS.OperationObject,\n params: IParameter[],\n responses: IMethodResponse[],\n body?: IParameter\n ) {\n if (!schema.operationId) {\n throw new Error('Missing operationId');\n }\n\n const okays = responses.filter(response => {\n return (\n response.statusCode === StatusCode.OK ||\n response.statusCode === StatusCode.NoContent\n );\n });\n if (!okays) {\n throw new Error(`Missing 2xx + application/json response in ${endpoint}`);\n }\n\n const primaryResponse =\n okays.find(response => {\n // prefer json response over all other 200s\n return (\n response.statusCode === StatusCode.OK &&\n response.mediaType === 'application/json'\n );\n }) ||\n okays.find(response => {\n return response.statusCode === StatusCode.OK; // accept any mediaType for 200 if none are json\n }) ||\n okays.find(response => {\n return response.statusCode === StatusCode.NoContent;\n });\n\n if (!primaryResponse) {\n throw new Error(`Missing 2xx + application/json response in ${endpoint}`);\n }\n\n super(schema.operationId, primaryResponse.type, schema);\n this.okResponses = okays;\n if (okays.length === 1) {\n // There's only one return type for this function\n this.returnType = primaryResponse;\n }\n\n this.customTypes = new Set<string>();\n this.types = new Set<string>();\n this.httpMethod = httpMethod;\n this.endpoint = endpoint;\n this.id = `${httpMethod} ${endpoint}`;\n this.responses = responses;\n this.primaryResponse = primaryResponse;\n this.responseModes = this.getResponseModes();\n this.params = [];\n params.forEach(p => this.addParam(api, p));\n responses.forEach(r => this.addType(api, r.type));\n if (body && !this.isFormUrlEncoded) {\n this.addParam(api, body);\n }\n this.activityType = schema['x-looker-activity-type'];\n this.rateLimited = Method.isRateLimited(schema);\n }\n\n /**\n * Check the many, many ways an endpoint can be flagged as rate-limited\n *\n * Because we LOVE standards. Yes we do.\n *\n * See https://github.com/OAI/OpenAPI-Specification/issues/1539 for more color commentary\n *\n * @param op to check for rate limiting\n * @returns true if any rate limiting attribute is defined for the op\n */\n static isRateLimited(op: OAS.OperationObject): boolean {\n if (op['x-looker-rate-limited']) return true;\n\n const many = [\n 'X-RateLimit-Limit',\n 'X-RateLimit-Remaining',\n 'X-RateLimit-Reset',\n 'X-Rate-Limit-Limit',\n 'X-Rate-Limit-Remaining',\n 'X-Rate-Limit-Reset',\n ];\n for (const flag of many) {\n if (flag in op) return true;\n }\n\n return false;\n }\n\n get isFormUrlEncoded() {\n const method = this.httpMethod.toUpperCase();\n if (!['POST', 'PUT', 'PATCH'].includes(method)) return false;\n const body = this.schema.requestBody as OAS.RequestBodyObject;\n return !!body?.content?.['application/x-www-form-urlencoded'];\n }\n\n eligibleForRequestType(): boolean {\n const [body] = this.bodyParams;\n /**\n * if the body parameter is specified and is optional, at least 2 optional parameters are required\n */\n const offset = body && `required` in body && !body.required ? 1 : 0;\n return this.optionalParams.length - offset > 1;\n }\n\n makeTypes(api: IApiModel): KeyList {\n if (this.eligibleForRequestType()) {\n api.getRequestType(this);\n }\n\n Object.entries(this.params).forEach(([, param]) => {\n const writer = api.mayGetWriteableType(param.type);\n if (writer) {\n this.types.add(writer.name);\n this.customTypes.add(writer.name);\n }\n });\n\n return this.types;\n }\n\n /**\n * Adds the parameter and registers its type for the method\n * @param api current API model\n * @param {IParameter} param\n */\n addParam(api: IApiModel, param: IParameter) {\n param.owner = this.name;\n this.params.push(param);\n this.addType(api, param.type);\n return this;\n }\n\n /**\n * Adds the type to the method type xrefs and adds the method to the types xref\n * @param api ApiModel for tracking type\n * @param type Type to add\n */\n addType(api: IApiModel, type: IType) {\n this.types.add(type.name);\n // Add the method xref to the type\n type.methodRefs.add(this.name);\n\n const custom = type.customType;\n if (custom) {\n this.customTypes.add(custom);\n const customType = api.types[custom];\n customType.methodRefs.add(this.name);\n }\n return this;\n }\n\n /**\n * Determines which response modes (binary/string) this method supports\n * @returns {Set<string>} Either a set of 'string' or 'binary' or both\n */\n private getResponseModes() {\n const modes = new Set<ResponseMode>();\n for (const resp of this.responses) {\n // TODO should we use one of the mime packages like https://www.npmjs.com/package/mime-types for\n // more thorough/accurate coverage?\n const mode = resp.mode;\n if (mode !== ResponseMode.unknown) modes.add(mode);\n }\n\n if (modes.size === 0) {\n throw new Error(\n `Is ${this.operationId} ${JSON.stringify(\n this.responses\n )} binary or string?`\n );\n }\n\n return modes;\n }\n\n get operationId(): string {\n return this.name;\n }\n\n get summary(): string {\n return this.schema.summary || '';\n }\n\n signature() {\n let result = this.operationId + '(';\n const allParams = this.allParams;\n if (allParams) {\n allParams.forEach((param, index) => {\n if (index > 0) result += ', ';\n result += param.signature();\n });\n }\n result += ')';\n return result;\n }\n\n // all required parameters ordered by location declaration order\n get requiredParams() {\n return this.required('path').concat(\n this.required(strBody),\n this.required('query'),\n this.required('header'),\n this.required('cookie')\n );\n }\n\n // all required parameters ordered by location declaration order\n get optionalParams() {\n return this.optional('path').concat(\n this.optional(strBody),\n this.optional('query'),\n this.optional('header'),\n this.optional('cookie')\n );\n }\n\n // all parameters ordered by required, then optional, location declaration order\n get allParams() {\n return this.requiredParams.concat(this.optionalParams);\n }\n\n get pathParams() {\n return this.getParams('path');\n }\n\n get bodyParams() {\n return this.getParams(strBody);\n }\n\n get queryParams() {\n return this.getParams('query');\n }\n\n get headerParams() {\n return this.getParams('header');\n }\n\n get cookieParams() {\n return this.getParams('cookie');\n }\n\n get pathArgs() {\n return this.argumentNames('path');\n }\n\n get bodyArg() {\n const body = this.argumentNames(strBody);\n if (body.length === 0) return '';\n return body[0];\n }\n\n get queryArgs() {\n return this.argumentNames('query');\n }\n\n get headerArgs() {\n return this.argumentNames('header');\n }\n\n get cookieArgs() {\n return this.argumentNames('cookie');\n }\n\n get errorResponses() {\n // TODO use lodash?\n const result: IMethodResponse[] = [];\n const map = new Map();\n for (const item of this.responses.filter(r => r.statusCode >= 400)) {\n if (!map.has(item.type.name)) {\n map.set(item.type.name, true);\n result.push(item);\n }\n }\n return result;\n }\n\n getParams(location?: MethodParameterLocation): IParameter[] {\n if (location) {\n return this.params.filter(p => p.location === location);\n }\n return this.params;\n }\n\n responseIsBinary(): boolean {\n return this.responseModes.has(ResponseMode.binary);\n }\n\n responseIsString(): boolean {\n return this.responseModes.has(ResponseMode.string);\n }\n\n responseIsBoth(): boolean {\n return this.responseIsBinary() && this.responseIsString();\n }\n\n /**\n * order parameters in location precedence\n */\n private static locationSorter(a: IParameter, b: IParameter) {\n const remain = 0;\n const before = -1;\n // const after = 1\n // note: \"strBody\" is an injected location for simplifying method declarations\n // parameters should be sorted in the following location order:\n const locations = ['path', strBody, 'query', 'header', 'cookie'];\n if (a.location === b.location) return remain; // no need to re-order\n\n for (const location of locations) {\n if (a.location === location) {\n return remain; // first parameter should stay first\n }\n if (b.location === location) {\n return before; // second parameter should move up\n }\n }\n return remain;\n }\n\n sort(list?: IParameter[]) {\n if (!list) list = this.params;\n return list.sort((a, b) => Method.locationSorter(a, b));\n }\n\n /**\n * return the list of required parameters, optionally for a specific location\n */\n required(location?: MethodParameterLocation) {\n let list = this.params.filter(i => i.required);\n if (location) {\n list = list.filter(i => i.location === location);\n }\n return list;\n }\n\n // return the list of optional parameters, optionally for a specific location\n optional(location?: MethodParameterLocation) {\n let list = this.params.filter(i => !i.required);\n if (location) {\n list = list.filter(i => i.location === location);\n }\n return list;\n }\n\n hasOptionalParams() {\n return this.optional().length > 0;\n }\n\n private argumentNames(location?: MethodParameterLocation): string[] {\n return this.getParams(location).map(p => p.name);\n }\n\n isMethodSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.method) ||\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.activityType) ||\n criteria.has(SearchCriterion.name) ||\n criteria.has(SearchCriterion.argument)\n );\n }\n\n searchString(criteria: SearchCriteria = SearchAll): string {\n // Are we only searching for contained items of the method or not?\n if (!this.isMethodSearch(criteria)) return '';\n let result = super.searchString(criteria);\n result += searchIt(this.summary) + searchIt(this.endpoint);\n if (criteria.has(SearchCriterion.method)) {\n if (criteria.has(SearchCriterion.description)) {\n result += searchIt(this.description);\n }\n }\n if (criteria.has(SearchCriterion.activityType)) {\n if (this.rateLimited) {\n result += searchIt('rate_limited');\n }\n result += searchIt(this.activityType);\n }\n if (criteria.has(SearchCriterion.status)) {\n result += searchIt(this.status) + searchIt(this.deprecation);\n }\n if (criteria.has(SearchCriterion.argument)) {\n this.params.forEach(p => {\n result += p.searchString(criteria);\n });\n }\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n let result =\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria);\n if (!result && criteria.has(SearchCriterion.argument)) {\n for (const a of this.params) {\n if (a.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n if (!result && criteria.has(SearchCriterion.response)) {\n for (const r of this.responses) {\n if (r.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n return result;\n }\n}\n\nexport class Type implements IType {\n readonly properties: PropertyList = {};\n readonly methodRefs: KeyList = new Set<string>();\n readonly types: KeyList = new Set<string>();\n readonly customTypes: KeyList = new Set<string>();\n readonly parentTypes: KeyList = new Set<string>();\n private _writeable: IProperty[] = [];\n description: string;\n customType: string;\n jsonName = '';\n refCount = 0;\n\n constructor(public schema: OAS.SchemaObject, public name: string) {\n this.jsonName = name;\n const snake = safeName(name);\n if (snake !== name) {\n this.name = snake;\n }\n this.customType = name;\n this.description = this.schema.description || '';\n }\n\n get metaType(): MetaType {\n if (this.intrinsic) return MetaType.Intrinsic;\n if (this instanceof RequestType) return MetaType.Request;\n if (this instanceof WriteType) return MetaType.Write;\n if (this instanceof EnumType) return MetaType.Enumerated;\n return MetaType.Specification;\n }\n\n get fullName(): string {\n return this.name;\n }\n\n get owner(): string {\n return '';\n }\n\n get writeable(): IProperty[] {\n return this._writeable;\n }\n\n /**\n * This is intended to be a one-time call per type to determine its writeable properties\n * @param api ApiModel for type references\n */\n setWriteable(api: ApiModel) {\n const result: IProperty[] = [];\n Object.values(this.properties)\n .filter(prop => !(prop.readOnly || prop.type.readOnly))\n .forEach(prop => {\n const type = prop.type;\n const w = type.intrinsic ? undefined : api.mayGetWriteableType(type);\n if (w) {\n const writeProp = { ...prop, type: w };\n result.push(writeProp);\n } else {\n result.push(prop);\n }\n });\n this._writeable = result;\n return this._writeable;\n }\n\n /**\n * Sets writeable property collection if it's not already set\n * @param api to use for type lookup\n */\n maySetWriteable(api: ApiModel) {\n if (this._writeable.length === 0) {\n this.setWriteable(api);\n }\n return this._writeable;\n }\n\n get className(): string {\n return this.name;\n }\n\n get intrinsic(): boolean {\n return false;\n }\n\n get status(): string {\n return this.schema['x-looker-status'] || '';\n }\n\n get deprecated(): boolean {\n return (\n this.schema.deprecated || this.schema['x-looker-deprecated'] || false\n );\n }\n\n get title(): string {\n return this.schema.title || '';\n }\n\n get default(): string | undefined {\n return this.schema.default || '';\n }\n\n get readOnly(): boolean {\n return Object.entries(this.properties).every(([, prop]) => prop.readOnly);\n }\n\n private filterRequiredProps(required: boolean) {\n const filteredProps: PropertyList = {};\n Object.entries(this.properties).forEach(([key, prop]) => {\n const condition = required ? prop.required : !prop.required;\n if (condition) {\n filteredProps[key] = prop;\n }\n });\n return filteredProps;\n }\n\n get requiredProperties() {\n return this.filterRequiredProps(true);\n }\n\n get optionalProperties() {\n return this.filterRequiredProps(false);\n }\n\n get hasSpecialNeeds(): boolean {\n return !!Object.entries(this.properties).find(\n ([, prop]) => prop.hasSpecialNeeds\n );\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const { fields, override, empty } = mockOptions(options);\n const isArray = this.className === 'ArrayType';\n const props = isArray\n ? (this as unknown as ArrayType).elementType.properties\n : this.properties;\n // prune invalid keys from the override list\n if (typeof override !== 'string' && typeof override !== 'function') {\n for (const key in override) {\n if (!(key in props)) {\n delete override[key];\n } else {\n // coerce override type for scalar properties\n const prop = props[key];\n if (prop.type.intrinsic) {\n override[key] = mockData(\n key,\n prop.type,\n override[key],\n empty\n ).value;\n }\n }\n }\n }\n let keys = parseFields(fields);\n if (keys['*']) {\n // add all properties, but default their nested fields if they'd have any\n const merge: ArgValues = {};\n Object.keys(props).forEach(k => (merge[k] = k));\n keys = { ...merge, ...keys };\n delete keys['*'];\n } else if (isEmpty(fields)) {\n // default to required properties\n for (const [key, prop] of Object.entries(props)) {\n if (prop.required) {\n keys[key] = key;\n }\n }\n }\n\n const overKeys =\n typeof override === 'string' || typeof override === 'function';\n\n let result: ArgValues = {};\n Object.keys(keys).forEach(k => {\n const v = keys[k];\n const over = overKeys ? undefined : override[k];\n const p = props[k];\n // Check if there are nested values for this key or just the default\n const scope = v === k ? k : { [k]: v };\n if (!p) {\n throw new Error(`No property named '${k}' in type ${this.name}`);\n }\n // const nested = p.schema?.items?.$ref;\n\n const val =\n typeof override === 'function'\n ? p.mock({ fields: scope, empty })\n : p.mock({ fields: scope, override: over, empty });\n if (val !== undefined) {\n result[k] = val;\n }\n });\n if (typeof override !== 'string') {\n // we've got keyed values to apply to the type\n result = { ...result, ...override };\n }\n return result;\n }\n\n mockType<T>(options: ITypeMock = {}): T {\n const result = this.mock(options);\n return result as unknown as T;\n }\n\n load(api: ApiModel): void {\n Object.entries(this.schema.properties || {}).forEach(\n ([propName, propSchema]) => {\n const propType = api.resolveType(\n propSchema,\n undefined,\n propName,\n this.name\n );\n // Using class name instead of instanceof check because TypeScript\n // linting complains about declaration order\n if (propType.instanceOf('EnumType')) {\n api.registerEnum(propType, propName);\n }\n // Track the \"parent\" reference for this type from the property reference\n propType.parentTypes.add(this.name);\n if (\n propType.instanceOf('ArrayType') ||\n propType.instanceOf('HashType')\n ) {\n propType.elementType?.parentTypes.add(propType.name);\n propType.elementType?.parentTypes.add(this.name);\n propType.parentTypes.add(this.name);\n }\n this.types.add(propType.name);\n const customType = propType.customType;\n if (customType) this.customTypes.add(customType);\n this.properties[safeName(propName)] = new Property(\n propName,\n propType,\n propSchema,\n this.name, // owner name\n this.schema.required\n );\n }\n );\n }\n\n instanceOf(className: string): boolean {\n return this.className === className;\n }\n\n asHashString() {\n let result = `${this.name}:`;\n Object.entries(this.properties)\n // put properties in alphabetical order first\n .sort(([a], [b]) => a.localeCompare(b))\n .forEach(([, prop]) => {\n result += prop.asHashString() + ':';\n });\n return result;\n }\n\n /**\n * Is this type directly recursive?\n * @returns {boolean} Does this type contain references to itself as a top-level property?\n */\n isRecursive(): boolean {\n const selfType = this.name;\n // test for directly recursive type references\n return Object.entries(this.properties).some(\n ([, prop]) => prop.type.name === selfType\n );\n }\n\n private static isPropSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.property)\n );\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n if (\n !criteria.has(SearchCriterion.type) &&\n !criteria.has(SearchCriterion.status)\n )\n return false;\n let result = rx.test(this.searchString(criteria));\n if (!result && Type.isPropSearch(criteria)) {\n for (const [, prop] of Object.entries(this.properties)) {\n if (this.name !== prop.type.name) {\n /** Avoiding recursion */\n if (prop.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n }\n return result;\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = '';\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.name);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n if (criteria.has(SearchCriterion.title)) result += searchIt(this.title);\n if (criteria.has(SearchCriterion.status)) {\n result += searchIt(this.status);\n if (this.deprecated) result += searchIt('deprecated');\n }\n if (criteria.has(SearchCriterion.property)) {\n Object.entries(this.properties).forEach(([, prop]) => {\n if (this.name !== prop.type.name) {\n /** Avoiding recursion */\n result += prop.searchString(criteria);\n }\n });\n }\n return result;\n }\n}\n\nexport class ArrayType extends Type {\n constructor(public elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `${elementType.name}[]`);\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'ArrayType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const result = super.mock(options);\n if (Array.isArray(result)) {\n return result;\n }\n return [result];\n }\n}\n\nexport class EnumType extends Type implements IEnumType {\n readonly values: EnumValueType[];\n\n constructor(\n public elementType: IType,\n schema: OAS.SchemaObject,\n api: ApiModel,\n typeName?: string,\n methodName?: string\n ) {\n super(schema, schema.name);\n this.customType = elementType.customType;\n if (lookerValuesTag in schema) {\n this.values = schema[lookerValuesTag];\n } else if (enumTag in schema) {\n this.values = schema[enumTag] as EnumValueType[];\n } else {\n throw new Error(\n `${schema.name} is an enum but has no defined enum values`\n );\n }\n if (methodName) {\n this.description = `${this.description}${\n this.description ? ' ' : ''\n }(Enum defined in ${methodName})`;\n }\n\n this.name = this.findName(api, typeName, methodName);\n }\n\n private findName(api: ApiModel, typeName?: string, methodName?: string) {\n const hash = md5(this.asHashString());\n const enums = api.getEnumList();\n let name = titleCase(this.name || typeName || 'Enum');\n if (name in api.types) {\n const matched = enums[hash];\n if (matched?.name === name) {\n /**\n * this type is the same as the other enum of the same name, although description may vary.\n * The descriptions may vary, but we prioritize type name over description for identical enum values\n * since this has the same name, it will replace the previous version in the keyed collection of types\n */\n return name;\n }\n\n // Enum values don't match existing enum of this name. Pick a new name\n const baseName = methodName ? titleCase(`${methodName}_${name}`) : name;\n let newName = baseName;\n let i = 0;\n while (newName in api.types) {\n newName = `${baseName}${++i}`;\n }\n name = newName;\n }\n // register the enum hash value\n enums[hash] = this;\n return name;\n }\n\n override mock(_options: ITypeMock = {}): any | undefined {\n return this.values[0];\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = super.searchString(criteria);\n if (criteria.has(SearchCriterion.property)) {\n for (const val in this.values) {\n result += searchIt(val.toString());\n }\n }\n return result;\n }\n\n get className(): string {\n return 'EnumType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n\n asHashString() {\n return this.values.join();\n }\n}\n\nexport class DelimArrayType extends Type {\n constructor(public elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `DelimArray<${elementType.name}>`);\n this.elementType = elementType;\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'DelimArrayType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n}\n\nexport class HashType extends Type {\n elementType: IType;\n\n constructor(elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `Hash[${elementType.name}]`);\n this.elementType = elementType;\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'HashType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n}\n\nexport class IntrinsicType extends Type {\n static stringTypes = [\n 'string',\n 'uri',\n 'url',\n 'email',\n 'uuid',\n 'hostname',\n 'password',\n 'ipv4',\n 'ipv6',\n 'byte',\n 'binary',\n ];\n\n isString = false;\n\n constructor(name: string) {\n super({}, name);\n this.customType = '';\n this.isString = IntrinsicType.stringTypes.includes(name);\n }\n\n override mock(options: ITypeMock = {}) {\n const { override, empty } = mockOptions(options);\n if (this.isString && typeof override === 'string') return override;\n return mockData(this.name, this, undefined, empty).value;\n }\n\n get className(): string {\n return 'IntrinsicType';\n }\n\n get intrinsic(): boolean {\n return true;\n }\n\n get readOnly(): boolean {\n return false;\n }\n}\n\nexport class RequestType extends Type {\n constructor(\n api: IApiModel,\n name: string,\n params: IParameter[],\n description = ''\n ) {\n super({ description }, name);\n params.forEach(p => {\n const writeProp = p.asProperty();\n const typeWriter = api.mayGetWriteableType(p.type);\n if (typeWriter) writeProp.type = typeWriter;\n this.properties[p.name] = writeProp;\n });\n }\n}\n\nexport class WriteType extends Type {\n constructor(api: IApiModel, type: IType) {\n const name = `${strWrite}${type.name}`;\n const roProps = WriteType.readonlyProps(type.properties);\n const description =\n `Dynamic writeable type for ${type.name}` +\n (roProps.length > 0\n ? ` removes:\\n` + roProps.map(p => p.name).join(', ')\n : '');\n super({ description }, name);\n // Cross-reference the two types\n this.types.add(type.name);\n this.customTypes.add(type.name);\n type.types.add(this.name);\n type.customTypes.add(this.name);\n const obj = type as Type;\n const writes = obj.maySetWriteable(api as ApiModel);\n writes.forEach(p => {\n const writeProp = new Property(\n p.name,\n p.type,\n {\n description: p.description || p.type.description,\n // nullable/optional if property is nullable or property is complex type\n nullable: p.nullable || !p.type.intrinsic,\n },\n this.name, // owner name\n type.schema.required\n );\n this.properties[safeName(p.name)] = writeProp;\n });\n }\n\n private static readonlyProps = (properties: PropertyList): IProperty[] => {\n const result: IProperty[] = [];\n Object.entries(properties)\n .filter(([, prop]) => prop.readOnly || prop.type.readOnly)\n .forEach(([, prop]) => result.push(prop));\n return result;\n };\n}\n\n/**\n * load an API specification, ensure it's upgraded, and return the APIModel\n * @param spec to optionally parse and upgrade\n */\nexport const specToModel = (spec: any): ApiModel => {\n if (typeof spec === 'string') {\n spec = JSON.parse(spec);\n }\n const json = upgradeSpecObject(spec);\n const obj = new OAS.OpenApiBuilder(json).getSpec();\n return new ApiModel(obj);\n};\n\nexport interface IApiModel extends IModel {\n version: string;\n description: string;\n spec: OAS.OpenAPIObject;\n methods: MethodList;\n types: TypeList;\n tags: TagList;\n\n getRequestType(method: IMethod): IType | undefined;\n\n mayGetWriteableType(type: IType): IType | undefined;\n\n /**\n * Search this item for a regular expression pattern\n * @param {string} expression text or regex to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(expression: string, criteria: SearchCriteria): ISearchResult;\n}\n\nexport class ApiModel implements ISymbolTable, IApiModel {\n private enumTypes: TypeList = {};\n private refs: TypeList = {};\n methods: MethodList = {};\n types: TypeList = {};\n tags: TagList = {};\n typeTags: TypeTagList = {};\n\n constructor(public readonly spec: OAS.OpenAPIObject) {\n [\n 'string',\n 'integer',\n 'int64',\n 'boolean',\n 'object',\n 'float',\n 'double',\n 'void',\n 'date',\n 'datetime',\n 'binary',\n 'byte',\n 'email',\n 'uuid',\n 'uri',\n 'url',\n 'hostname',\n 'password',\n 'ipv4',\n 'ipv6',\n 'any',\n ].forEach(name => (this.types[name] = new IntrinsicType(name)));\n\n this.load();\n }\n\n public get version(): string {\n return this.spec?.info.version || '';\n }\n\n public get description(): string {\n return this.spec?.info?.description?.trim() || '';\n }\n\n static fromString(specContent: string): ApiModel {\n return specToModel(specContent);\n }\n\n static fromJson(json: any): ApiModel {\n return specToModel(json);\n }\n\n private static isMethodSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.method) ||\n criteria.has(SearchCriterion.argument) ||\n criteria.has(SearchCriterion.response) ||\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.activityType)\n );\n }\n\n private static isTypeSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.type) ||\n criteria.has(SearchCriterion.title) ||\n criteria.has(SearchCriterion.status)\n );\n }\n\n private static addMethodToTags(tags: TagList, method: IMethod): TagList {\n for (const tag of method.schema.tags) {\n let list: MethodList = tags[tag];\n if (!list) {\n list = {};\n tags[tag] = list;\n }\n list[method.name] = method;\n }\n return tags;\n }\n\n private tagMethod(method: IMethod) {\n return ApiModel.addMethodToTags(this.tags, method);\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param expression regular expression to match\n * @param criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(\n expression: string,\n criteria: SearchCriteria = SearchAll\n ): ISearchResult {\n const tags: TagList = {};\n const types: TypeList = {};\n let methodCount = 0;\n let typeCount = 0;\n const result = {\n ok: true,\n message: 'Search done',\n tags,\n types,\n };\n\n let rx: RegExp;\n try {\n rx = new RegExp(expression, 'mi'); // multi-line case insensitive, not global so first match returns\n } catch (e) {\n result.message = `Invalid search expression ${e}`;\n result.ok = false;\n return result;\n }\n\n if (ApiModel.isMethodSearch(criteria)) {\n Object.entries(this.methods).forEach(([, method]) => {\n if (method.search(rx, criteria)) {\n methodCount++;\n ApiModel.addMethodToTags(tags, method);\n }\n });\n }\n if (ApiModel.isTypeSearch(criteria)) {\n Object.entries(this.types).forEach(([key, type]) => {\n if (!rx) {\n throw Error(`${key} rx undefined`);\n }\n if (type.search(rx, criteria)) {\n typeCount++;\n types[key] = type;\n }\n });\n }\n result.message = `${methodCount} methods and ${typeCount} types found`;\n return result;\n }\n\n // TODO replace this with get from underscore?\n jsonPath(path: string | string[], item: any = this.spec, splitter = '/') {\n let keys = path;\n if (!(path instanceof Array)) {\n keys = path.split(splitter);\n }\n for (const key of keys) {\n if (key === '#') continue;\n item = item[key];\n if (item == null) return null;\n }\n return item;\n }\n\n private schemaHasEnums(schema: OAS.SchemaObject) {\n return lookerValuesTag in schema || enumTag in schema;\n }\n\n /**\n * Retrieve an api object via its JSON path\n */\n resolveType(\n schema: string | OAS.SchemaObject | OAS.ReferenceObject,\n style?: string,\n typeName?: string,\n methodName?: string\n ): IType {\n const getRef = (schema: OAS.SchemaObject | OAS.ReferenceObject) => {\n const ref = schema.$ref;\n let result = this.refs[ref];\n\n if (!result) {\n /** This must be recursive */\n const parts: string[] = ref.split('/');\n const name = parts[parts.length - 1];\n const t = new Type(schema, name);\n this.refs[ref] = t;\n result = t;\n }\n return result;\n };\n\n if (typeof schema === 'string') {\n if (schema.indexOf('/requestBodies/') < 0)\n return this.types[schema.substring(schema.lastIndexOf('/') + 1)];\n // dereference the request strBody schema reference\n const deref = this.jsonPath(schema);\n if (deref) {\n const ref = this.jsonPath(\n ['content', 'application/json', 'schema', '$ref'],\n deref\n );\n if (ref) return this.resolveType(ref, style, typeName, methodName);\n }\n } else if (OAS.isReferenceObject(schema)) {\n return getRef(schema);\n } else if (schema.type) {\n if (schema.type === 'integer' && schema.format === 'int64') {\n return this.types.int64;\n }\n if (schema.type === 'number') {\n if (schema.format) return this.types[schema.format];\n return this.types.float;\n }\n if (schema.type === 'array' && schema.items) {\n const resolved = this.resolveType(schema.items);\n if (!resolved) {\n throw new Error(`Could not resolve ${JSON.stringify(schema)}`);\n }\n if (style === 'simple' || style === 'form') {\n // FKA 'csv' .. OpenAPI converter now uses \"form\" instead of \"simple\" for this\n return new DelimArrayType(resolved, schema);\n }\n if (this.schemaHasEnums(schema)) {\n const num = new EnumType(\n resolved,\n schema,\n this,\n typeName,\n methodName\n );\n this.registerEnum(num, methodName);\n const result = new ArrayType(num, schema);\n return result;\n }\n return new ArrayType(resolved, schema);\n }\n if (this.schemaHasEnums(schema)) {\n const resolved = this.resolveType(\n schema.type,\n style,\n typeName,\n methodName\n );\n const result = new EnumType(\n resolved,\n schema,\n this,\n typeName,\n methodName\n );\n if (result) {\n // If defined, it may get reassigned\n return this.registerEnum(result, methodName);\n }\n return result;\n }\n if (schema.type === 'object' && schema.additionalProperties) {\n if (schema.additionalProperties !== true) {\n return new HashType(\n this.resolveType(schema.additionalProperties),\n schema\n );\n }\n }\n if (schema.format === 'date-time') {\n return this.types.datetime;\n }\n if (schema.format && this.types[schema.format]) {\n return this.types[schema.format];\n }\n if (this.types[schema.type]) {\n return this.types[schema.type];\n }\n }\n throw new Error(\n `Schema ${\n typeof schema === 'string' ? schema : JSON.stringify(schema)\n } must have a ref or a type`\n );\n }\n\n private requestTypeName(method: IMethod) {\n return `${strRequest}${camelCase('_' + method.name)}`;\n }\n\n // add to this.types collection with name as key\n makeRequestType(method: IMethod) {\n const name = this.requestTypeName(method);\n const request = new RequestType(\n this,\n name,\n method.allParams,\n `Dynamically generated request type for ${method.name}`\n );\n this.types[name] = request;\n method.addType(this, request);\n return request;\n }\n\n registerEnum(type: IType, methodName?: string) {\n if (!(type instanceof EnumType)) return type;\n\n if (type.name in this.types) {\n const hash = md5(type.asHashString());\n const matched = this.enumTypes[hash];\n if (matched?.name === type.name) {\n /**\n * this type is the same as the other enum of the same name, although description may vary.\n * The descriptions may vary, but we prioritize type name over description for identical enum values\n */\n return this.enumTypes[hash];\n }\n }\n\n if (methodName) {\n const method = this.methods[methodName];\n if (method) {\n // add a type reference for the method\n method.types.add(type.name);\n method.customTypes.add(type.name);\n }\n }\n this.types[type.name] = type;\n return type;\n }\n\n /**\n * only gets the request type if more than one method parameter is optional\n *\n * if needed, create the request type from method parameters\n * add to this.types collection\n *\n * @param method for request type\n * @returns returns type if request type is needed, otherwise it doesn't\n */\n private _getRequestType(method: IMethod) {\n if (method.optionalParams.length <= 1) return undefined;\n\n let result = this.types[this.requestTypeName(method)];\n if (!result) result = this.makeRequestType(method);\n return result;\n }\n\n /**\n * only gets the request type if more than one method parameter is optional\n *\n * updates refCount for the method\n *\n * @param method for request type\n * @returns {IType | undefined} returns type if request type is needed, otherwise it doesn't\n */\n getRequestType(method: IMethod) {\n const result = this._getRequestType(method);\n if (result) result.refCount++;\n return result;\n }\n\n /**\n * Read-only accessor for private enum collection used within this source file as a \"friend\"\n */\n getEnumList(): TypeList {\n return this.enumTypes;\n }\n\n makeWriteableType(type: IType) {\n const writer: WriteType = new WriteType(this, type);\n this.types[writer.name] = writer;\n return writer;\n }\n\n /**\n * a writeable type will need to be found or created if the passed type has read-only properties\n * and is used by any method that updates the structure\n * @param type to check for read-only properties\n * @returns either writeable type or undefined\n */\n mayGetWriteableType(type: IType) {\n if (type.intrinsic) return undefined;\n if (type.elementType?.intrinsic) return undefined;\n if (type instanceof WriteType) return type;\n if (!anyWriter(this, type)) return undefined;\n const props = Object.entries(type.properties).map(([, prop]) => prop);\n if (props.length === 0) return undefined;\n const obj = type as Type;\n const writes = obj.maySetWriteable(this);\n if (writes.length === 0) {\n // No writeable properties is an error\n const immutable =\n 'WARNING: no writeable properties found for POST, PUT, or PATCH';\n if (type.description.indexOf(immutable) < 0) {\n type.description += type.description.length > 0 ? '\\n' : '' + immutable;\n }\n return undefined;\n }\n if (\n writes.length === props.length &&\n JSON.stringify(writes) === JSON.stringify(props)\n )\n return undefined; // type is writeable\n const result = this.makeWriteableType(type);\n type.types.add(result.name);\n // Link the writeable type to its source type\n type.customTypes.add(result.name);\n result.parentTypes.add(type.name);\n return result;\n }\n\n /**\n * establishes any dynamically-generated request or writeable types\n */\n loadDynamicTypes() {\n Object.entries(this.methods).forEach(([, method]) => {\n method.makeTypes(this);\n });\n }\n\n /**\n * Sort a keyed collection so its keys are in sorted order\n * @param list to sort\n * @returns {KeyedCollection<T>} newly sorted list\n */\n sortList<T>(list: KeyedCollection<T>): KeyedCollection<T> {\n const result: KeyedCollection<T> = {};\n const sortedKeys = Object.keys(list).sort(localeSort);\n for (const key of sortedKeys) {\n result[key] = list[key];\n }\n return result;\n }\n\n sortLists() {\n this.methods = this.sortList(this.methods);\n this.types = this.sortList(this.types);\n // this.refs = this.sortList(this.refs)\n this.tags = this.sortList(this.tags);\n this.typeTags = this.sortList(this.typeTags);\n const typeKeys = Object.keys(this.typeTags);\n typeKeys.forEach(key => {\n this.typeTags[key] = this.sortList(this.typeTags[key]);\n });\n // commented out to leave methods in natural order within the tag\n // const keys = Object.keys(this.tags).sort(localeSort)\n // keys.forEach((key) => {\n // this.tags[key] = this.sortList(this.tags[key])\n // })\n }\n\n load(): void {\n if (this.spec?.components?.schemas) {\n Object.entries(this.spec.components.schemas).forEach(([name, schema]) => {\n const t = new Type(schema, name);\n // types[n] and corresponding refs[ref] MUST reference the same type instance!\n this.types[name] = t;\n this.refs[`#/components/schemas/${name}`] = t;\n });\n Object.keys(this.spec.components.schemas).forEach(name => {\n const resolved = this.resolveType(name) as Type;\n resolved.load(this);\n });\n // Ensure all property's nested type references point to the correct full type\n const complex = Object.values(this.types)\n .filter(t => !t.intrinsic)\n .map(t => t);\n complex.forEach(type => {\n const nested = Object.values(type.properties).filter(\n p => !p.type.intrinsic\n );\n nested.forEach(p => {\n const ref = this.types[p.type.name];\n if (ref) {\n // Could be a collection of an intrinsic type, so only assign if\n // there is an explicit type ref\n p.type = ref;\n // Try to get a good description for the property\n p.description = p.description || p.type.description;\n }\n });\n });\n }\n\n if (this.spec?.paths) {\n Object.entries(this.spec.paths).forEach(([path, schema]) => {\n const methods = this.loadMethods(path, schema);\n methods.forEach(method => {\n this.methods[method.name] = method;\n });\n });\n }\n this.loadDynamicTypes();\n this.typeTags = tagTypes(this, this.types);\n this.sortLists();\n }\n\n private loadMethods(endpoint: string, schema: OAS.PathItemObject): Method[] {\n const methods: Method[] = [];\n\n const addIfPresent = (\n httpMethod: HttpMethod,\n opSchema: OAS.OperationObject | undefined\n ) => {\n if (opSchema) {\n const responses = this.methodResponses(opSchema);\n const params = this.methodParameters(opSchema);\n const body = this.requestBody(opSchema.requestBody);\n const method = new Method(\n this,\n httpMethod,\n endpoint,\n opSchema,\n params,\n responses,\n body\n );\n methods.push(method);\n this.tagMethod(method);\n }\n };\n\n addIfPresent('GET', schema.get);\n addIfPresent('PUT', schema.put);\n addIfPresent('POST', schema.post);\n addIfPresent('PATCH', schema.patch);\n addIfPresent('DELETE', schema.delete);\n // options?: OperationObject;\n // head?: OperationObject;\n // trace?: OperationObject;\n return methods;\n }\n\n private methodResponses(schema: OAS.OperationObject): IMethodResponse[] {\n const responses: IMethodResponse[] = [];\n Object.entries(schema.responses).forEach(([statusCode, contentSchema]) => {\n const desc = contentSchema.description || '';\n if (contentSchema.content) {\n Object.entries(contentSchema.content).forEach(\n ([mediaType, response]) => {\n responses.push(\n new MethodResponse(\n parseInt(statusCode, 10),\n mediaType,\n this.resolveType(\n (response as OAS.MediaTypeObject).schema || {}\n ),\n desc\n )\n );\n }\n );\n } else if (statusCode === '204') {\n // no content - returns void\n responses.push(\n new MethodResponse(204, '', this.types.void, desc || 'No content')\n );\n }\n });\n return responses;\n }\n\n private methodParameters(schema: OAS.OperationObject): IParameter[] {\n const params: IParameter[] = [];\n if (schema.parameters) {\n for (const p of schema.parameters) {\n let type: IType;\n let param: OAS.ParameterObject;\n if (OAS.isReferenceObject(p)) {\n // TODO make this work correctly for reference objects at the parameter level\n // TODO is style resolution like below required here?\n type = this.resolveType(p);\n param = {\n in: 'query',\n name: type.name,\n };\n } else {\n type = this.resolveType(p.schema || {}, p.style);\n param = p;\n }\n // Method parameters are a chicken/egg situation and ownership will be established in the Method constructor\n const mp = new Parameter(param, type);\n params.push(mp);\n }\n }\n return params;\n }\n\n private requestBody(\n obj: OAS.RequestBodyObject | OAS.ReferenceObject | undefined\n ) {\n if (!obj) return undefined;\n\n let required = true;\n if (!OAS.isReferenceObject(obj)) {\n const req = obj as OAS.RequestBodyObject;\n if ('required' in req) {\n required = Boolean(req.required);\n }\n }\n\n const typeSchema: OAS.SchemaObject = {\n deprecated: false,\n description: '',\n nullable: false,\n readOnly: false,\n required: required ? [strBody] : [],\n writeOnly: false,\n };\n\n // default the type to a plain body\n let type: IType = new Type(typeSchema, strBody);\n\n if (OAS.isReferenceObject(obj)) {\n // get the type directly from the ref object\n type = this.resolveType(obj.$ref);\n } else if (obj.content) {\n // determine type from content\n const content = obj.content;\n // TODO need to understand headers or links\n Object.keys(content).forEach(key => {\n const media = content[key];\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const schema = media.schema!;\n if (OAS.isReferenceObject(schema)) {\n type = this.resolveType(schema.$ref);\n } else {\n type = this.resolveType(schema);\n }\n });\n } else {\n // TODO must be dynamic, create type\n }\n\n return new Parameter(\n {\n description: '',\n location: strBody,\n name: strBody,\n required, // TODO capture description\n } as Partial<IParameter>,\n type\n );\n }\n}\n"],"mappings":";;;;;AA0BA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAClC,OAAOC,GAAG,MAAM,aAAa;AAC7B,OAAOC,OAAO,MAAM,gBAAgB;AAEpC,SACEC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,YAAY,QACP,iBAAiB;AACxB,SAASC,iBAAiB,QAAQ,iBAAiB;AAQnD,OAAO,IAAMC,OAAO,GAAG,MAAM;AAC7B,OAAO,IAAMC,UAAU,GAAG,SAAS;AACnC,OAAO,IAAMC,QAAQ,GAAG,OAAO;AAS/B,IAAMC,eAAe,GAAG,iBAAiB;AAC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names":["OAS","md5","isEmpty","DelimArray","ResponseMode","StatusCode","responseMode","upgradeSpecObject","strBody","strRequest","strWrite","lookerValuesTag","enumTag","simpleName","TypeOfType","parseFields","fields","splitConsideringParentheses","segment","parts","currentPart","openParentheses","lastChar","charCheck","char","Error","concat","push","parseSegment","result","forEach","part","key","nestedStr","split","trim","slice","p","Array","isArray","f","typeOfType","type","intrinsic","Intrinsic","className","Hash","Enum","Complex","isSpecialName","name","test","safeName","value","replace","camelCase","$1","toLocaleUpperCase","titleCase","substring","firstCase","toLocaleLowerCase","searchIt","localeSort","a","b","localeCompare","describeParam","param","_param$type","desc","description","deprecated","match","keyValues","list","from","values","sort","mayQuote","quoteChar","arguments","length","undefined","str","toString","methodRefs","api","refs","keys","k","methods","typeRefs","ref","types","firstMethodRef","stack","Set","add","method","parents","parentTypes","parent","has","_firstMethodRef","anyWriter","httpMethod","allTypes","customTypes","delete","SearchCriterion","SearchAll","argument","property","title","activityType","status","response","criteriaToSet","criteria","val","setToCriteria","MetaType","tagTypes","typeTags","Object","entries","filter","_ref","_","_ref2","first","tag","schema","tags","MethodResponse","constructor","statusCode","mediaType","mode","search","rx","searchString","Symbol","owner","_defineProperty","jsonName","snake","hasSpecialNeeds","fullName","asHashString","SchemadSymbol","deprecation","mockData","propertyName","override","_dataMocks$type$name","empty","over","stringer","mocked","String","inter","parseInt","floater","parseFloat","dater","Date","booler","Boolean","anyer","dataMocks","any","boolean","byte","binary","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","email","uuid","hostname","ipv4","ipv6","void","mockOptions","options","_options$override","_options$empty","Property","_schema$required","required","includes","nullable","readOnly","writeOnly","summary","mock","elementType","el","isString","scope","opts","JSON","stringify","data","Parameter","location","in","asSchemaObject","asProperty","signature","doEncode","Method","endpoint","params","responses","body","operationId","okays","OK","NoContent","primaryResponse","find","okResponses","returnType","id","responseModes","getResponseModes","addParam","r","addType","isFormUrlEncoded","rateLimited","isRateLimited","op","many","flag","_body$content","toUpperCase","requestBody","content","eligibleForRequestType","bodyParams","offset","optionalParams","makeTypes","getRequestType","_ref3","writer","mayGetWriteableType","custom","customType","modes","resp","unknown","size","allParams","index","requiredParams","optional","pathParams","getParams","queryParams","headerParams","cookieParams","pathArgs","argumentNames","bodyArg","queryArgs","headerArgs","cookieArgs","errorResponses","map","Map","item","set","responseIsBinary","responseIsString","responseIsBoth","locationSorter","remain","before","locations","i","hasOptionalParams","isMethodSearch","Type","metaType","RequestType","Request","WriteType","Write","EnumType","Enumerated","Specification","writeable","_writeable","setWriteable","properties","prop","w","writeProp","_objectSpread","maySetWriteable","default","every","_ref4","filterRequiredProps","filteredProps","_ref5","condition","requiredProperties","optionalProperties","_ref6","props","merge","overKeys","v","mockType","load","_ref7","propName","propSchema","propType","resolveType","instanceOf","registerEnum","_propType$elementType","_propType$elementType2","_ref8","_ref9","_ref0","isRecursive","selfType","some","_ref1","isPropSearch","_ref10","ArrayType","typeName","methodName","findName","hash","enums","getEnumList","matched","baseName","newName","_options","join","DelimArrayType","HashType","IntrinsicType","stringTypes","typeWriter","roProps","readonlyProps","obj","writes","_ref19","_ref20","specToModel","spec","parse","json","OpenApiBuilder","getSpec","ApiModel","version","_this$spec","info","_this$spec2","_this$spec2$info","_this$spec2$info$desc","fromString","specContent","fromJson","isTypeSearch","addMethodToTags","tagMethod","expression","methodCount","typeCount","ok","message","RegExp","e","_ref11","_ref12","jsonPath","path","splitter","schemaHasEnums","style","getRef","$ref","t","indexOf","lastIndexOf","deref","isReferenceObject","format","items","resolved","num","additionalProperties","requestTypeName","makeRequestType","request","enumTypes","_getRequestType","refCount","makeWriteableType","_type$elementType","_ref13","immutable","loadDynamicTypes","_ref14","sortList","sortedKeys","sortLists","typeKeys","_this$spec3","_this$spec3$component","_this$spec4","components","schemas","_ref15","complex","nested","paths","_ref16","loadMethods","addIfPresent","opSchema","methodResponses","methodParameters","get","put","post","patch","_ref17","contentSchema","_ref18","parameters","mp","req","typeSchema","media"],"sources":["../../src/sdkModels.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport * as OAS from 'openapi3-ts';\nimport md5 from 'blueimp-md5';\nimport isEmpty from 'lodash/isEmpty';\nimport type { ArgValues, HttpMethod } from '@looker/sdk-rtl';\nimport {\n DelimArray,\n ResponseMode,\n StatusCode,\n responseMode,\n} from '@looker/sdk-rtl';\nimport { upgradeSpecObject } from './specConverter';\n\n/**\n * Handy specification references\n * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object\n * https://swagger.io/docs/specification/data-models/data-types/\n */\n\nexport const strBody = 'body';\nexport const strRequest = 'Request';\nexport const strWrite = 'Write';\nexport declare type Arg = string;\n\n/**\n * Tags for types that have an `x-looker-values` or `enum` specification\n * according to https://swagger.io/docs/specification/data-models/enums/\n *\n * Ordinarily, if the OpenAPI specification is created by SDK Codegen, `x-looker-values` will already be converted to `enum`\n */\nconst lookerValuesTag = 'x-looker-values';\nconst enumTag = 'enum';\n\n/** simple symbol name pattern */\nconst simpleName = /^[a-z_][a-z_\\d]*(\\[])?$/im;\n\n/**\n * Convenience enum for exploring types\n */\nexport enum TypeOfType {\n /** This is an intrinsic type */\n Intrinsic,\n /** This is an ArrayType */\n Array,\n /** This is a HashType */\n Hash,\n /** This is a DelimArrayType */\n DelimArray,\n /** This is an EnumType */\n Enum,\n /** This is an EnumType */\n Complex,\n}\n\n/**\n * parses a fields string, creating nested keys if found\n * @param fields comma and parenthesis delimited field group expression\n */\nexport const parseFields = (fields: FieldsSpec) => {\n function splitConsideringParentheses(segment: string) {\n // builds a list of the parts of a request string from the input\n const parts: string[] = [];\n // builds up a new string of what constitutes a building block of the query\n let currentPart = '';\n // openParentheses emulates a stack to determine where\n // a parenthesis ends\n let openParentheses = 0;\n let lastChar = '';\n function charCheck(char: string) {\n if (lastChar === char) {\n if (char === '(' || (char === ')' && openParentheses < 0)) {\n throw new Error(\n `Unexpected '${char}' after '${currentPart}' parens:${openParentheses}`\n );\n }\n }\n }\n\n for (const char of segment) {\n if (char === '(') {\n openParentheses++;\n charCheck(char);\n } else if (char === ')') {\n openParentheses--;\n charCheck(char);\n }\n\n // if we hit a comma and the open parenthesis stack is empty, take the\n // currentPart and reset it, otherwise, continue building\n if (char === ',' && openParentheses === 0) {\n parts.push(currentPart);\n currentPart = '';\n } else {\n currentPart += char;\n }\n lastChar = char;\n }\n if (currentPart) {\n parts.push(currentPart);\n }\n return parts;\n }\n\n // helper function to recursively parse each segment of the string\n function parseSegment(segment: string) {\n const parts = splitConsideringParentheses(segment);\n const result: ArgValues = {};\n\n parts.forEach(part => {\n // split each part into a key and any nested string\n let [key, nestedStr] = part.split(/\\((.+)/);\n key = key.trim();\n if (nestedStr) {\n nestedStr = nestedStr.slice(0, -1); // Remove the closing parenthesis\n if (key in result) {\n throw new Error(`Duplicate '${key}' found`);\n }\n result[key] = parseSegment(nestedStr);\n } else {\n const p = part.trim();\n if (p in result) {\n throw new Error(`Duplicate '${key}' found`);\n }\n if (p) result[p] = p;\n }\n });\n return result;\n }\n\n if (typeof fields === 'string') {\n fields = fields.trim();\n if (!fields) return {};\n return parseSegment(fields);\n } else if (Array.isArray(fields)) {\n const result: ArgValues = {};\n fields.forEach(f => (result[f] = f));\n return result;\n }\n // Presume this is already a keyed collection and just return it\n return fields;\n};\n\n/**\n * Get the enum for the class of the type\n * @param type\n */\nexport const typeOfType = (type: IType): TypeOfType => {\n if (type.intrinsic) return TypeOfType.Intrinsic;\n switch (type.className) {\n case 'ArrayType':\n return TypeOfType.Array;\n case 'HashType':\n return TypeOfType.Hash;\n case 'DelimArrayType':\n return TypeOfType.DelimArray;\n case 'EnumType':\n return TypeOfType.Enum;\n default: {\n return TypeOfType.Complex;\n }\n }\n};\n\n/**\n * Does this name have special characters?\n * @param name to name check\n * @returns true if the name isn't a standard variable name, optionally ending with []\n */\nexport const isSpecialName = (name: string) => {\n if (!name) return false;\n // simple naming pattern that should theoretically just work\n const result = simpleName.test(name);\n return !result;\n};\n\n/**\n * convert string to a safe variable name\n *\n * @param value string value to convert to a safe variable name\n */\nexport const safeName = (value: string) => {\n if (!value) return '';\n // TODO need to convert unicode characters also\n return value.replace(/([-_ ]+)/g, '_');\n};\n\n/**\n * convert string to camelCase\n * @param value string value to convert to camelCase\n */\nexport const camelCase = (value: string) => {\n if (!value) return '';\n return value.replace(/(([-_ ]+)[a-z])|([-_ ]+)/gi, $1 => {\n return $1.toLocaleUpperCase().replace(/([-_ ]+)/gi, '');\n });\n};\n/**\n * convert string to TitleCase\n * @param value string value to convert to TitleCase\n */\nexport const titleCase = (value: string) => {\n if (!value) return '';\n value = camelCase(value);\n return value[0].toLocaleUpperCase() + value.substring(1);\n};\n\n/**\n * Only first character of string should be uppercase\n *\n * Values are first converted to camelCase()\n *\n * @param value of string to convert\n * @returns converted string\n */\nexport const firstCase = (value: string) => {\n if (!value) return '';\n value = camelCase(value);\n return value[0].toLocaleUpperCase() + value.substring(1).toLocaleLowerCase();\n};\n\nexport interface IModel {}\n\n/**\n * create a \"searchable\" string that can be concatenated to a larger search string\n * @param {string} value to search\n * @returns {string} value plus search delimiter\n */\nconst searchIt = (value: string) => (value ? value + '\\t' : '');\n\n/**\n * lambda function for local sorting\n * @param {string} a first string to compare\n * @param {string} b second string to compare\n * @returns {any} but should be -1, 0, or 1\n */\nconst localeSort = (a: string, b: string) => a.localeCompare(b);\n\nexport interface ISymbol {\n name: string;\n fullName: string;\n owner: string;\n /**\n * if the specification name is a \"special name\" (e.g. the name contains hyphens or is unicode), it's saved here\n * and the name property will have the supported name since not all SDK languages support special names.\n * for example, \"foo-bar\" and \"foo bar\" would be saved in jsonName, and name=\"foo_bar\"\n */\n jsonName: string;\n\n /**\n * returns True if the symbol or any symbols it contains have a \"special name\"\n */\n hasSpecialNeeds: boolean;\n\n asHashString(): string;\n\n searchString(criteria: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n}\n\nexport interface ITypedSymbol extends ISymbol {\n type: IType;\n}\n\nexport interface IParameter extends ITypedSymbol {\n location: MethodParameterLocation;\n required: boolean;\n description: string;\n deprecated: boolean;\n\n asProperty(): IProperty;\n\n signature(): string;\n\n summary(): string;\n\n asHashString(): string;\n\n doEncode(): boolean;\n}\n\n/**\n * Add generational annotations to a parameter description, like (DEPRECATED)\n * @param param to describe\n */\nexport const describeParam = (param: IParameter) => {\n let desc = param.description || param.type?.description;\n if (param.deprecated) {\n if (!param.description.match(/deprecated/gi)) {\n desc = `(DEPRECATED) ${desc}`;\n }\n }\n return desc;\n};\n\nexport type KeyedCollection<T> = Record<string, T>;\nexport type MethodList = KeyedCollection<IMethod>;\nexport type TypeList = KeyedCollection<IType>;\nexport type TagList = KeyedCollection<MethodList>;\nexport type TypeTagList = KeyedCollection<TypeList>;\nexport type PropertyList = KeyedCollection<IProperty>;\nexport type KeyList = Set<string>;\nexport type EnumValueType = string | number;\n\n/**\n * Returns sorted string array for IKeylist type\n * @param list Set of values\n * @returns sorted string array of keys\n */\nexport const keyValues = (list: KeyList): string[] => {\n if (!list) return [];\n return Array.from(list.values()).sort();\n};\n\n/**\n * Optionally quote a string if quotes are required\n * @param value to convert to string and optionally quote\n * @param quoteChar defaults to \"'\"\n * @returns the quoted or unquoted value\n */\nexport const mayQuote = (value: any, quoteChar = `'`): string => {\n const str = value.toString();\n if (!isSpecialName(str)) return str;\n return `${quoteChar}${str}${quoteChar}`;\n};\n\n/**\n * Resolve a list of method keys into an IMethod[] in alphabetical order by name\n * @param api model to use\n * @param refs references to models\n * @returns Populated method list. Anything not matched is skipped\n */\nexport const methodRefs = (api: IApiModel, refs: KeyList): IMethod[] => {\n const keys = keyValues(refs);\n const result: IMethod[] = [];\n keys.forEach(k => {\n if (k in api.methods) {\n result.push(api.methods[k]);\n }\n });\n return result;\n};\n\n/**\n * Resolve a list of method keys into an IType[] in alphabetical order by name\n * @param api model to use\n * @param refs references to models\n * @returns Populated method list. Anything not matched is skipped\n */\nexport const typeRefs = (api: IApiModel, refs: KeyList): IType[] => {\n const keys = keyValues(refs);\n const result: IType[] = [];\n keys.forEach(k => {\n const ref = api.types[k];\n if (ref) {\n result.push(ref);\n }\n });\n return result;\n};\n\n/**\n * Resolves first method ref it can find\n * @param api parsed spec\n * @param type tree to walk\n * @param stack call stack to prevent infinite recursion\n */\nexport const firstMethodRef = (\n api: ApiModel,\n type: IType,\n stack: KeyList = new Set<string>()\n): IMethod => {\n stack.add(type.name);\n\n let method = methodRefs(api, type.methodRefs)[0];\n if (!method) {\n const parents = typeRefs(api, type.parentTypes);\n for (const parent of parents) {\n if (!stack.has(parent.name)) {\n method = firstMethodRef(api, parent, stack);\n }\n if (method) break;\n }\n }\n return method;\n};\n\n/**\n * Returns the first method (if any) that uses the reference type for updating\n * @param api parsed spec\n * @param type to check for writing\n * @param stack call stack to prevent infinite recursion\n */\nconst anyWriter = (\n api: ApiModel,\n type: IType,\n stack: KeyList = new Set<string>()\n): IMethod | undefined => {\n let result: IMethod | undefined;\n if (stack.has(type.name)) return undefined;\n stack.add(type.name);\n const methods = methodRefs(api, type.methodRefs);\n for (const method of methods) {\n if (\n method.httpMethod === 'POST' ||\n method.httpMethod === 'PUT' ||\n method.httpMethod === 'PATCH'\n ) {\n result = method;\n break;\n }\n }\n if (!result) {\n const allTypes = new Set([...type.parentTypes, ...type.customTypes]);\n allTypes.delete(type.name);\n const refs = typeRefs(api, allTypes);\n\n for (const ref of refs) {\n result = anyWriter(api, ref, stack);\n if (result) {\n break;\n }\n }\n }\n return result;\n};\n\nexport interface ISymbolList {\n methods: MethodList;\n types: TypeList;\n}\n\nexport enum SearchCriterion {\n method,\n type,\n name,\n description,\n argument,\n property,\n title,\n activityType,\n status,\n response,\n}\n\nexport type SearchCriterionTerm = keyof typeof SearchCriterion;\n\nexport type SearchCriteria = Set<SearchCriterion>;\n\nexport const SearchAll: SearchCriteria = new Set([\n SearchCriterion.method,\n SearchCriterion.type,\n SearchCriterion.name,\n SearchCriterion.description,\n SearchCriterion.argument,\n SearchCriterion.property,\n SearchCriterion.title,\n SearchCriterion.activityType,\n SearchCriterion.status,\n SearchCriterion.response,\n]);\n\nexport const criteriaToSet = (criteria: string[]): SearchCriteria => {\n const result: SearchCriteria = new Set();\n criteria.forEach(name => {\n const val = SearchCriterion[name as SearchCriterionTerm];\n if (val !== undefined)\n result.add(SearchCriterion[name as SearchCriterionTerm]);\n });\n return result;\n};\n\nexport const setToCriteria = (criteria: SearchCriteria): string[] => {\n const result: string[] = [];\n criteria.forEach(value => result.push(SearchCriterion[value]));\n return result;\n};\n\nexport interface ISearchResult {\n ok: boolean;\n tags: TagList;\n types: TypeList;\n message: string;\n}\n\nexport interface ISymbolTable extends ISymbolList {\n resolveType(schema: OAS.SchemaObject): IType;\n}\n\n/** Type of type */\nexport enum MetaType {\n /** scalar type */\n Intrinsic = 'Intrinsic',\n /** from API specification */\n Specification = 'Specification',\n /** writeable type */\n Write = 'Write',\n /** Request type for API methods */\n Request = 'Request',\n /** enumerated type */\n Enumerated = 'Enumerated',\n}\n\n/**\n * Options for type and property mocks\n */\nexport interface ITypeMock {\n /**\n * Optional names of properties to be mocked for the return value.\n *\n * **Default behavior**: For a property that is *not required*,\n * the default return value is `undefined`. If the property is\n * *required* and is a complex type, the required properties of the\n * type will be returned by calling `Type.mock()` with exactly the\n * same parameters provided to `Property.mock()`, where the same\n * rules apply. If `undefined` is returned to `Type.mock()` from\n * its `Property.mock()` calls, that property will be omitted\n * from the `Type.mock()` return. If `*` is used, all fields in\n * a complex type are mocked.\n */\n fields?: FieldsSpec;\n /**\n * optional override value(s) for mocked data return. Can be either a single\n * string value, or a hash of key/value items\n */\n override?: string | ArgValues | ((response: any, mocked: any) => any);\n httpCode?: number;\n /** true to use \"empty\" values for the mock data. Applies to all mocked values */\n empty?: boolean;\n}\n\nexport interface IType extends ISymbol {\n /**\n * key/value collection of properties for this type\n */\n properties: PropertyList;\n\n /**\n * key/value collection of required properties for this type\n */\n requiredProperties: PropertyList;\n\n /**\n * key/value collection of optional properties for this type\n */\n optionalProperties: PropertyList;\n\n /**\n * List of writeable properties for this type\n */\n writeable: IProperty[];\n\n /**\n * Status like 'beta', 'experimental', 'stable'\n */\n status: string;\n\n /**\n * If this type is a collection, this is the \"item\" type\n */\n elementType?: IType;\n\n /**\n * True if this type is deprecated\n */\n deprecated: boolean;\n\n /**\n * Description of the type\n */\n description: string;\n\n /**\n * Title for the type. Dunno why OAS has this\n */\n title: string;\n\n /**\n * Default value for the type. Optional types may have default values defined\n */\n default?: string;\n\n /**\n * Is this a read-only type?\n */\n readOnly: boolean;\n\n /**\n * Number of times this type is referenced, per language, when generating methods\n * Other than for reporting purposes, this is used to generate import statements\n * Idea adopted from Delphi\n */\n refCount: number;\n\n /**\n * OAS schema for the type\n */\n schema: OAS.SchemaObject;\n\n /**\n * If this is a custom type from the API specification, it will be eponymous\n * If it's a list type, it will be customType of the item type\n * Otherwise, it will be '' (e.g. IntrinsicType)\n */\n customType: string;\n\n /**\n * names of methods referencing this type\n */\n methodRefs: KeyList;\n\n /**\n * Names of types referenced by this type\n */\n types: KeyList;\n\n /**\n * Names of custom types referenced by this type\n */\n customTypes: KeyList;\n\n /**\n * Names of custom types that have a property of this type\n */\n parentTypes: KeyList;\n\n /**\n * Hopefully temporary concession to build problems with instance of ArrayType checks etc failing\n */\n className: string;\n\n /**\n * Is this an intrinsic type?\n */\n intrinsic: boolean;\n\n /**\n * type classification\n */\n metaType: MetaType;\n\n /** Generate consistent, correctly typed mock data for the property */\n mock(options?: ITypeMock): any | undefined;\n\n /** Generate typed, consistent, correctly typed mock data for the property */\n mockType<T>(options?: ITypeMock): T;\n\n /**\n * Hacky workaround for inexplicable instanceof failures\n * @param {string} className name of class to check\n * @returns {boolean} true if class name matches this.className\n */\n instanceOf(className: string): boolean;\n\n asHashString(): string;\n\n isRecursive(): boolean;\n\n searchString(criteria: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n}\n\nexport interface IEnumType extends IType {\n values: EnumValueType[];\n}\n\nexport declare type MethodParameterLocation =\n | 'path'\n | 'body'\n | 'query'\n | 'header'\n | 'cookie';\n\nexport interface IMethodResponse {\n statusCode: number;\n mediaType: string;\n type: IType;\n mode: ResponseMode;\n description: string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n\n searchString(criteria: SearchCriteria): string;\n}\n\n/**\n * categorize all types using their method refs\n *\n * @param api parsed Api specification\n * @param types to categorize\n */\nexport const tagTypes = (api: ApiModel, types: TypeList) => {\n const typeTags: ArgValues = {};\n Object.entries(types)\n .filter(([_, type]) => !type.intrinsic)\n .forEach(([name, type]) => {\n let methods = methodRefs(api, type.methodRefs);\n // If no method is found, look up parents until you get a method\n if (methods.length === 0) {\n const first = firstMethodRef(api, type);\n if (first) methods = [first];\n }\n methods.forEach(method => {\n // The type is tagged for each method's tags\n for (const tag of method.schema.tags) {\n let list: TypeList = typeTags[tag];\n if (!list) {\n list = {};\n typeTags[tag] = list;\n }\n list[name] = type;\n }\n });\n });\n return typeTags;\n};\n\nclass MethodResponse implements IMethodResponse {\n // TODO either use this https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md\n // or turn off 'useless constructor' linting\n constructor(\n public statusCode: number,\n public mediaType: string,\n public type: IType,\n public description: string\n ) {}\n\n get mode(): ResponseMode {\n return responseMode(this.mediaType);\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n if (!criteria.has(SearchCriterion.response)) return false;\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n searchString(criteria: SearchCriteria): string {\n let result =\n searchIt(`${this.statusCode}`) + searchIt(`${ResponseMode[this.mode]}`);\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.mediaType);\n return result;\n }\n}\n\nexport type FieldsSpec = string | string[] | ArgValues;\n\nexport interface IProperty extends ITypedSymbol {\n required: boolean;\n nullable: boolean;\n description: string;\n readOnly: boolean;\n writeOnly: boolean;\n deprecated: boolean;\n schema: OAS.SchemaObject;\n owner: string;\n\n /**\n * Generate consistent, correctly typed mock data for the property\n */\n mock(options?: ITypeMock): any | undefined;\n\n searchString(include: SearchCriteria): string;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} include items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, include: SearchCriteria): boolean;\n\n summary(): string;\n}\n\nclass Symbol implements ISymbol {\n jsonName = '';\n readonly hasSpecialNeeds: boolean = false;\n constructor(\n public name: string,\n public type: IType,\n public owner: string = ''\n ) {\n this.jsonName = name;\n const snake = safeName(name);\n if (snake !== name) {\n this.name = snake;\n this.hasSpecialNeeds = true;\n }\n }\n\n get fullName(): string {\n return `${this.owner ? this.owner + '.' : ''}${this.name}`;\n }\n\n asHashString() {\n return `${this.name}:${this.type.name}`;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n searchString(criteria: Set<SearchCriterion>): string {\n let result = '';\n if (\n criteria.has(SearchCriterion.name) ||\n criteria.has(SearchCriterion.method)\n )\n result += searchIt(this.name) + searchIt(this.jsonName);\n return result;\n }\n}\n\ninterface ISchemadSymbol extends ITypedSymbol {\n /**\n * Original OpenAPI schema reference for this item\n */\n schema: OAS.SchemaObject;\n\n /**\n * Status indicator of this item. Typically 'stable', 'beta', 'experimental', or ''\n */\n status: string;\n\n /**\n * Description of this item\n */\n description: string;\n\n /**\n * True if this item has been deprecated\n */\n deprecated: boolean;\n\n /**\n * If deprecated, 'deprecated'. Otherwise ''\n */\n deprecation: string;\n}\n\nclass SchemadSymbol extends Symbol implements ISchemadSymbol {\n schema: OAS.SchemaObject;\n description: string;\n deprecated = false;\n\n constructor(name: string, type: IType, schema: OAS.SchemaObject, owner = '') {\n super(name, type, owner);\n this.schema = schema;\n this.description = schema.description || type.description || '';\n this.deprecated =\n schema.deprecated || schema['x-looker-deprecated'] || false;\n }\n\n get status(): string {\n return this.schema['x-looker-status'] || '';\n }\n\n get deprecation(): string {\n return this.deprecated ? 'deprecated' : '';\n }\n}\n\n/**\n * return the mocked data value for the type, or undefined\n * @param propertyName of property\n * @param type to mock\n * @param override optional data to coerce to type\n * @param empty true to make mocked value an \"empty\" value. Defaults to false\n */\nconst mockData = (\n propertyName: string,\n type: IType,\n override?: any,\n empty = false\n) => {\n const over = override !== undefined;\n const stringer = (mocked: string) => {\n if (over) {\n return String(override);\n }\n if (empty) {\n return '';\n }\n return mocked;\n };\n const inter = (mocked: number) => {\n if (over) {\n return parseInt(override, 10);\n }\n if (empty) {\n return 0;\n }\n return mocked;\n };\n\n const floater = (mocked: number) => {\n if (over) {\n return parseFloat(override);\n }\n if (empty) {\n return 0.0;\n }\n return mocked;\n };\n\n const dater = (mocked: Date) => {\n if (over) {\n return new Date(override);\n }\n if (empty) {\n return new Date(1970, 0, 1);\n }\n return mocked;\n };\n\n const booler = (mocked: boolean) => {\n if (over) {\n return Boolean(override);\n }\n if (empty) {\n return false;\n }\n return mocked;\n };\n\n const anyer = (mocked: any) => {\n if (over) {\n return override;\n }\n if (empty) {\n return {};\n }\n return mocked;\n };\n\n const dataMocks: Record<string, { value: any }> = {\n any: { value: anyer({ a: 1, b: 'two' }) },\n boolean: { value: booler(true) },\n byte: { value: stringer('A') },\n binary: { value: stringer('01') },\n date: { value: dater(new Date(2024, 0, 5)) },\n datetime: { value: dater(new Date(2024, 0, 5, 1)) },\n double: { value: floater(2.2) },\n float: { value: floater(1.1) },\n int32: { value: inter(32) },\n int64: { value: inter(64) },\n integer: { value: inter(1) },\n number: { value: inter(2) },\n object: { value: anyer({ [propertyName]: 1 }) },\n password: { value: stringer('*') },\n string: { value: stringer(propertyName) },\n uri: { value: stringer(`urn:${propertyName}`) },\n url: { value: stringer(`https://${propertyName}.mock`) },\n email: { value: stringer(`${propertyName}@example.com`) },\n uuid: { value: stringer(`uuid-${propertyName}`) },\n hostname: { value: stringer(`https://${propertyName}`) },\n ipv4: { value: stringer('127.0.0.1') },\n ipv6: { value: stringer('::1') },\n void: { value: over ? override : null },\n };\n\n return dataMocks[type.name] ?? override;\n};\n\n/**\n * Default mocking options for type and property mock\n * @param options to default for mock() call\n */\nconst mockOptions = (options: ITypeMock) => {\n return {\n fields: options?.fields ? options?.fields : '',\n override: options?.override ?? {},\n empty: options?.empty ?? false,\n };\n};\n\nexport class Property extends SchemadSymbol implements IProperty {\n required = false;\n nullable = false;\n readOnly = false;\n writeOnly = false;\n\n constructor(\n name: string,\n type: IType,\n schema: OAS.SchemaObject,\n owner = '',\n required: string[] = []\n ) {\n super(name, type, schema, owner);\n this.required = Boolean(\n required.includes(name) || schema.required?.includes(name)\n );\n this.nullable =\n this.schema.nullable || this.schema['x-looker-nullable'] || false;\n this.readOnly = this.schema.readOnly || false;\n this.writeOnly = this.schema.writeOnly || false;\n }\n\n private tag(key: string) {\n return (this as ArgValues)[key] ? ` ${key}` : '';\n }\n\n summary() {\n return `${this.fullName}:${this.type.name}${this.tag('readOnly')}${this.tag(\n 'required'\n )}${this.tag('nullable')}${this.tag('deprecated')}`;\n }\n\n asHashString() {\n return (\n super.asHashString() +\n this.tag('readOnly') +\n this.tag('required') +\n this.tag('nullable') +\n this.tag('deprecated')\n );\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = super.searchString(criteria);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n if (criteria.has(SearchCriterion.status))\n result += searchIt(this.status) + searchIt(this.deprecation);\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const { fields, override, empty } = mockOptions(options);\n if (isEmpty(fields) && !this.required) return undefined; // don't mock by default\n const keys = parseFields(fields);\n if (!isEmpty(fields) && !(this.name in keys)) return undefined; // not requested, don't mock\n const type = this.type;\n\n if (type.elementType) {\n // This is a structure with nested types.\n const el = type.elementType;\n // Default intrinsic string type values to the name of this type\n const over =\n el.intrinsic && (el as unknown as IntrinsicType).isString\n ? this.name\n : override;\n // if fields spec does not have a list of keys for this property, treat nested scope as defaulting\n const scope =\n typeof keys[this.name] === 'string' ? undefined : keys[this.name];\n // For complex types, just pass the mock call on down\n const opts = el.intrinsic\n ? { fields: el.name, override: over }\n : { fields: scope, override };\n const val = el.mock(opts);\n switch (type.className) {\n case 'ArrayType':\n return empty ? [] : [val];\n case 'HashType':\n return empty ? {} : { a: val };\n case 'DelimArrayType':\n return empty ? new DelimArray([]) : new DelimArray([val]);\n case 'EnumType':\n return (type as unknown as EnumType).values[0];\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`);\n }\n\n if (type.name) {\n if (type.intrinsic) {\n const data = mockData(this.name, type, undefined, empty);\n return data.value;\n }\n // This property is a complex type so only use overrides with default\n // property names typically don't match the case of the type name, and\n // matching must be case-sensitive\n return type.mock({ override, empty });\n } else {\n throw new Error('Cannot output a nameless type.');\n }\n }\n}\n\nexport class Parameter extends SchemadSymbol implements IParameter {\n description = '';\n location: MethodParameterLocation = 'query';\n required = false;\n\n constructor(\n param: OAS.ParameterObject | Partial<IParameter>,\n type: IType,\n owner = ''\n ) {\n super(param.name || '', type, type.schema, owner);\n this.description = param.description || type.description || '';\n if ('in' in param) {\n this.location = param.in;\n } else {\n this.location = (param as Partial<IParameter>).location || strBody;\n }\n this.deprecated = param.deprecated || this.deprecated;\n // TODO deal with the required value being the names of the columns that are required\n this.required = param.required || false;\n }\n\n asSchemaObject() {\n return {\n deprecated: this.deprecated,\n description: this.description,\n\n nullable: !this.required,\n\n readOnly: false,\n // || this.location === strBody),\n required: this.required ? [this.name] : undefined,\n type: this.type.name || this.name,\n writeOnly: false,\n } as OAS.SchemaObject;\n }\n\n asProperty() {\n return new Property(this.name, this.type, this.asSchemaObject());\n }\n\n private tag(key: string) {\n return (this as ArgValues)[key] ? ` ${key}` : '';\n }\n\n signature() {\n return (\n (this.required ? '' : '[') +\n this.name +\n ':' +\n this.type.name +\n (this.required ? '' : ']')\n );\n }\n\n summary() {\n return `${this.fullName}:${this.type.name}${this.tag('readOnly')}${this.tag(\n 'required'\n )}${this.tag('nullable')}${this.tag('deprecated')}`;\n }\n\n asHashString() {\n return `${this.name}:${this.type.name}${this.required ? '' : '?'}${\n this.location\n }`;\n }\n\n doEncode() {\n return (\n this.type.name === 'string' ||\n this.type.name === 'datetime' ||\n this.type.name === 'date'\n );\n }\n\n searchString(criteria: Set<SearchCriterion>): string {\n let result = '';\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.name);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n return (\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria)\n );\n }\n}\n\n/**\n * Properties and methods of an SDK method\n *\n * Everything required to generate a method declaration, and documentation for it,\n * is contained in this interface. Search functionality is also included.\n *\n */\nexport interface IMethod extends ISchemadSymbol {\n /** Lookup id */\n id: string;\n\n /** alias of ISymbol.name */\n operationId: string;\n\n /** HTTP method used for this REST request */\n httpMethod: HttpMethod;\n\n /** Relative URL of the endpoint */\n endpoint: string;\n\n /** Prefers 200 response with application/json as the response type */\n primaryResponse: IMethodResponse;\n\n /** If there's only one 200 or 204 response for this method, this is it's return type */\n returnType: IMethodResponse | undefined;\n\n /** List of all responses that can be returned by this REST call */\n responses: IMethodResponse[];\n\n /** List of all 2xx responses */\n okResponses: IMethodResponse[];\n\n /** Description (from the spec) of this method */\n description: string;\n\n /** All parameters defined for this method, in natural order from spec processing */\n params: IParameter[];\n\n /** Summary from the method's schema object */\n summary: string;\n\n /** Names of path arguments. Not in required/optional priority */\n pathArgs: string[];\n\n /** Primary body argument name ('' if it doesn't exist) */\n bodyArg: string;\n\n /** Names of query arguments. Not in required/optional priority */\n queryArgs: string[];\n\n /** Names of header arguments. Not currently used by Codegen */\n headerArgs: string[];\n\n /** Names of cookie arguments. Not currently used by Codegen */\n cookieArgs: string[];\n\n /** Responses that have HTTP error codes (4xx) */\n errorResponses: IMethodResponse[];\n\n /** All required parameters, ordered by location precedence */\n requiredParams: IParameter[];\n\n /** All optional parameters, ordered by location precedence */\n optionalParams: IParameter[];\n\n /**\n * All parameters in the correct, sorted order for the method code generator\n * Parameters are required, by location precedence, then optional, by location precedence\n */\n allParams: IParameter[];\n\n /** All body parameters in natural order */\n bodyParams: IParameter[];\n\n /** All path parameters in natural order */\n pathParams: IParameter[];\n\n /** All query parameters in natural order */\n queryParams: IParameter[];\n\n /** The types of responses returned by this method (binary and/or string) */\n responseModes: Set<ResponseMode>;\n\n /** Value of `x-looker-activity-type` from schema specification */\n activityType: string;\n\n /** all type names referenced in this method, including intrinsic types */\n types: KeyList;\n\n /** all non-instrinsic type names referenced in this method */\n customTypes: KeyList;\n\n /** true if this method is a rate-limited API endpoint */\n rateLimited: boolean;\n\n /** true if this method consumes application/x-www-form-urlencoded and is POST/PUT/PATCH */\n isFormUrlEncoded: boolean;\n\n /**\n * Get a list of parameters for location, or just all parameters\n * @param {MethodParameterLocation} location is optional. defaults to all parameters\n * @returns {IParameter[]} all parameters in natural order matching the location constraing\n */\n getParams(location?: MethodParameterLocation): IParameter[];\n\n /**\n * return the list of optional parameters, optionally for a specific location\n * @param {MethodParameterLocation} location\n * @returns {IParameter[]}\n */\n optional(location?: MethodParameterLocation): IParameter[];\n\n /**\n * return the list of required parameters, optionally for a specific location\n */\n required(location?: MethodParameterLocation): IParameter[];\n\n /**\n * Does this method have optional parameters?\n * @returns {boolean} true if optional parameters exist for this method\n */\n hasOptionalParams(): boolean;\n\n /**\n * Does this method return binary responses?\n * @returns {boolean} true if binary responses are possible\n */\n responseIsBinary(): boolean;\n\n /**\n * Does this method return string responses?\n * @returns {boolean} true if string responses are possible\n */\n responseIsString(): boolean;\n\n /**\n * Does this method return both binary and string responses\n * @returns {boolean} true if both binary and string responses are possible\n */\n responseIsBoth(): boolean;\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean;\n\n /**\n * Add a parameter to the method, tracking all cross-reference information\n * @param {IApiModel} api specification containing this method\n * @param {IParameter} param to add to the spec\n * @returns {IMethod} the defined method with parameter and references added\n */\n addParam(api: IApiModel, param: IParameter): IMethod;\n\n /**\n * Add a type to the method, tracking all cross-reference information\n * @param {IApiModel} api specification containing this method\n * @param {IType} type to add to the spec\n * @returns {IMethod} the defined method with parameter and references added\n */\n addType(api: IApiModel, type: IType): IMethod;\n\n /**\n * Sorts parameters by location precedence, then alphanumeric\n * @param {IParameter[]} list\n * @returns {IParameter[]}\n */\n sort(list?: IParameter[]): IParameter[];\n\n /**\n * If a method may need a request type for a given language, this function returns true\n */\n eligibleForRequestType(): boolean;\n\n /**\n * If any dynamic types will be required for this method, this function will make them\n *\n * Dynamic types are Request and Write types\n *\n * @param api the spec to use for making types\n * @returns {KeyList} the list of all types used by the method\n */\n makeTypes(api: IApiModel): KeyList;\n\n signature(): string;\n}\n\n/**\n * Concrete implementation of IMethod interface\n */\nexport class Method extends SchemadSymbol implements IMethod {\n readonly id: string;\n readonly httpMethod: HttpMethod;\n readonly endpoint: string;\n readonly primaryResponse: IMethodResponse;\n responses: IMethodResponse[];\n readonly okResponses: IMethodResponse[];\n readonly params: IParameter[];\n readonly responseModes: Set<ResponseMode>;\n readonly activityType: string;\n readonly customTypes: KeyList;\n readonly types: KeyList;\n readonly rateLimited: boolean;\n readonly returnType: IMethodResponse | undefined;\n\n constructor(\n api: IApiModel,\n httpMethod: HttpMethod,\n endpoint: string,\n schema: OAS.OperationObject,\n params: IParameter[],\n responses: IMethodResponse[],\n body?: IParameter\n ) {\n if (!schema.operationId) {\n throw new Error('Missing operationId');\n }\n\n const okays = responses.filter(response => {\n return (\n response.statusCode === StatusCode.OK ||\n response.statusCode === StatusCode.NoContent\n );\n });\n if (!okays) {\n throw new Error(`Missing 2xx + application/json response in ${endpoint}`);\n }\n\n const primaryResponse =\n okays.find(response => {\n // prefer json response over all other 200s\n return (\n response.statusCode === StatusCode.OK &&\n response.mediaType === 'application/json'\n );\n }) ||\n okays.find(response => {\n return response.statusCode === StatusCode.OK; // accept any mediaType for 200 if none are json\n }) ||\n okays.find(response => {\n return response.statusCode === StatusCode.NoContent;\n });\n\n if (!primaryResponse) {\n throw new Error(`Missing 2xx + application/json response in ${endpoint}`);\n }\n\n super(schema.operationId, primaryResponse.type, schema);\n this.okResponses = okays;\n if (okays.length === 1) {\n // There's only one return type for this function\n this.returnType = primaryResponse;\n }\n\n this.customTypes = new Set<string>();\n this.types = new Set<string>();\n this.httpMethod = httpMethod;\n this.endpoint = endpoint;\n this.id = `${httpMethod} ${endpoint}`;\n this.responses = responses;\n this.primaryResponse = primaryResponse;\n this.responseModes = this.getResponseModes();\n this.params = [];\n params.forEach(p => this.addParam(api, p));\n responses.forEach(r => this.addType(api, r.type));\n if (body && !this.isFormUrlEncoded) {\n this.addParam(api, body);\n }\n this.activityType = schema['x-looker-activity-type'];\n this.rateLimited = Method.isRateLimited(schema);\n }\n\n /**\n * Check the many, many ways an endpoint can be flagged as rate-limited\n *\n * Because we LOVE standards. Yes we do.\n *\n * See https://github.com/OAI/OpenAPI-Specification/issues/1539 for more color commentary\n *\n * @param op to check for rate limiting\n * @returns true if any rate limiting attribute is defined for the op\n */\n static isRateLimited(op: OAS.OperationObject): boolean {\n if (op['x-looker-rate-limited']) return true;\n\n const many = [\n 'X-RateLimit-Limit',\n 'X-RateLimit-Remaining',\n 'X-RateLimit-Reset',\n 'X-Rate-Limit-Limit',\n 'X-Rate-Limit-Remaining',\n 'X-Rate-Limit-Reset',\n ];\n for (const flag of many) {\n if (flag in op) return true;\n }\n\n return false;\n }\n\n get isFormUrlEncoded() {\n const method = this.httpMethod.toUpperCase();\n if (!['POST', 'PUT', 'PATCH'].includes(method)) return false;\n const body = this.schema.requestBody as OAS.RequestBodyObject;\n return !!body?.content?.['application/x-www-form-urlencoded'];\n }\n\n eligibleForRequestType(): boolean {\n const [body] = this.bodyParams;\n /**\n * if the body parameter is specified and is optional, at least 2 optional parameters are required\n */\n const offset = body && `required` in body && !body.required ? 1 : 0;\n return this.optionalParams.length - offset > 1;\n }\n\n makeTypes(api: IApiModel): KeyList {\n if (this.eligibleForRequestType()) {\n api.getRequestType(this);\n }\n\n Object.entries(this.params).forEach(([, param]) => {\n const writer = api.mayGetWriteableType(param.type);\n if (writer) {\n this.types.add(writer.name);\n this.customTypes.add(writer.name);\n }\n });\n\n return this.types;\n }\n\n /**\n * Adds the parameter and registers its type for the method\n * @param api current API model\n * @param {IParameter} param\n */\n addParam(api: IApiModel, param: IParameter) {\n param.owner = this.name;\n this.params.push(param);\n this.addType(api, param.type);\n return this;\n }\n\n /**\n * Adds the type to the method type xrefs and adds the method to the types xref\n * @param api ApiModel for tracking type\n * @param type Type to add\n */\n addType(api: IApiModel, type: IType) {\n this.types.add(type.name);\n // Add the method xref to the type\n type.methodRefs.add(this.name);\n\n const custom = type.customType;\n if (custom) {\n this.customTypes.add(custom);\n const customType = api.types[custom];\n customType.methodRefs.add(this.name);\n }\n return this;\n }\n\n /**\n * Determines which response modes (binary/string) this method supports\n * @returns {Set<string>} Either a set of 'string' or 'binary' or both\n */\n private getResponseModes() {\n const modes = new Set<ResponseMode>();\n for (const resp of this.responses) {\n // TODO should we use one of the mime packages like https://www.npmjs.com/package/mime-types for\n // more thorough/accurate coverage?\n const mode = resp.mode;\n if (mode !== ResponseMode.unknown) modes.add(mode);\n }\n\n if (modes.size === 0) {\n throw new Error(\n `Is ${this.operationId} ${JSON.stringify(\n this.responses\n )} binary or string?`\n );\n }\n\n return modes;\n }\n\n get operationId(): string {\n return this.name;\n }\n\n get summary(): string {\n return this.schema.summary || '';\n }\n\n signature() {\n let result = this.operationId + '(';\n const allParams = this.allParams;\n if (allParams) {\n allParams.forEach((param, index) => {\n if (index > 0) result += ', ';\n result += param.signature();\n });\n }\n result += ')';\n return result;\n }\n\n // all required parameters ordered by location declaration order\n get requiredParams() {\n return this.required('path').concat(\n this.required(strBody),\n this.required('query'),\n this.required('header'),\n this.required('cookie')\n );\n }\n\n // all required parameters ordered by location declaration order\n get optionalParams() {\n return this.optional('path').concat(\n this.optional(strBody),\n this.optional('query'),\n this.optional('header'),\n this.optional('cookie')\n );\n }\n\n // all parameters ordered by required, then optional, location declaration order\n get allParams() {\n return this.requiredParams.concat(this.optionalParams);\n }\n\n get pathParams() {\n return this.getParams('path');\n }\n\n get bodyParams() {\n return this.getParams(strBody);\n }\n\n get queryParams() {\n return this.getParams('query');\n }\n\n get headerParams() {\n return this.getParams('header');\n }\n\n get cookieParams() {\n return this.getParams('cookie');\n }\n\n get pathArgs() {\n return this.argumentNames('path');\n }\n\n get bodyArg() {\n const body = this.argumentNames(strBody);\n if (body.length === 0) return '';\n return body[0];\n }\n\n get queryArgs() {\n return this.argumentNames('query');\n }\n\n get headerArgs() {\n return this.argumentNames('header');\n }\n\n get cookieArgs() {\n return this.argumentNames('cookie');\n }\n\n get errorResponses() {\n // TODO use lodash?\n const result: IMethodResponse[] = [];\n const map = new Map();\n for (const item of this.responses.filter(r => r.statusCode >= 400)) {\n if (!map.has(item.type.name)) {\n map.set(item.type.name, true);\n result.push(item);\n }\n }\n return result;\n }\n\n getParams(location?: MethodParameterLocation): IParameter[] {\n if (location) {\n return this.params.filter(p => p.location === location);\n }\n return this.params;\n }\n\n responseIsBinary(): boolean {\n return this.responseModes.has(ResponseMode.binary);\n }\n\n responseIsString(): boolean {\n return this.responseModes.has(ResponseMode.string);\n }\n\n responseIsBoth(): boolean {\n return this.responseIsBinary() && this.responseIsString();\n }\n\n /**\n * order parameters in location precedence\n */\n private static locationSorter(a: IParameter, b: IParameter) {\n const remain = 0;\n const before = -1;\n // const after = 1\n // note: \"strBody\" is an injected location for simplifying method declarations\n // parameters should be sorted in the following location order:\n const locations = ['path', strBody, 'query', 'header', 'cookie'];\n if (a.location === b.location) return remain; // no need to re-order\n\n for (const location of locations) {\n if (a.location === location) {\n return remain; // first parameter should stay first\n }\n if (b.location === location) {\n return before; // second parameter should move up\n }\n }\n return remain;\n }\n\n sort(list?: IParameter[]) {\n if (!list) list = this.params;\n return list.sort((a, b) => Method.locationSorter(a, b));\n }\n\n /**\n * return the list of required parameters, optionally for a specific location\n */\n required(location?: MethodParameterLocation) {\n let list = this.params.filter(i => i.required);\n if (location) {\n list = list.filter(i => i.location === location);\n }\n return list;\n }\n\n // return the list of optional parameters, optionally for a specific location\n optional(location?: MethodParameterLocation) {\n let list = this.params.filter(i => !i.required);\n if (location) {\n list = list.filter(i => i.location === location);\n }\n return list;\n }\n\n hasOptionalParams() {\n return this.optional().length > 0;\n }\n\n private argumentNames(location?: MethodParameterLocation): string[] {\n return this.getParams(location).map(p => p.name);\n }\n\n isMethodSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.method) ||\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.activityType) ||\n criteria.has(SearchCriterion.name) ||\n criteria.has(SearchCriterion.argument)\n );\n }\n\n searchString(criteria: SearchCriteria = SearchAll): string {\n // Are we only searching for contained items of the method or not?\n if (!this.isMethodSearch(criteria)) return '';\n let result = super.searchString(criteria);\n result += searchIt(this.summary) + searchIt(this.endpoint);\n if (criteria.has(SearchCriterion.method)) {\n if (criteria.has(SearchCriterion.description)) {\n result += searchIt(this.description);\n }\n }\n if (criteria.has(SearchCriterion.activityType)) {\n if (this.rateLimited) {\n result += searchIt('rate_limited');\n }\n result += searchIt(this.activityType);\n }\n if (criteria.has(SearchCriterion.status)) {\n result += searchIt(this.status) + searchIt(this.deprecation);\n }\n if (criteria.has(SearchCriterion.argument)) {\n this.params.forEach(p => {\n result += p.searchString(criteria);\n });\n }\n return result;\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n let result =\n rx.test(this.searchString(criteria)) || this.type.search(rx, criteria);\n if (!result && criteria.has(SearchCriterion.argument)) {\n for (const a of this.params) {\n if (a.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n if (!result && criteria.has(SearchCriterion.response)) {\n for (const r of this.responses) {\n if (r.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n return result;\n }\n}\n\nexport class Type implements IType {\n readonly properties: PropertyList = {};\n readonly methodRefs: KeyList = new Set<string>();\n readonly types: KeyList = new Set<string>();\n readonly customTypes: KeyList = new Set<string>();\n readonly parentTypes: KeyList = new Set<string>();\n private _writeable: IProperty[] = [];\n description: string;\n customType: string;\n jsonName = '';\n refCount = 0;\n\n constructor(public schema: OAS.SchemaObject, public name: string) {\n this.jsonName = name;\n const snake = safeName(name);\n if (snake !== name) {\n this.name = snake;\n }\n this.customType = name;\n this.description = this.schema.description || '';\n }\n\n get metaType(): MetaType {\n if (this.intrinsic) return MetaType.Intrinsic;\n if (this instanceof RequestType) return MetaType.Request;\n if (this instanceof WriteType) return MetaType.Write;\n if (this instanceof EnumType) return MetaType.Enumerated;\n return MetaType.Specification;\n }\n\n get fullName(): string {\n return this.name;\n }\n\n get owner(): string {\n return '';\n }\n\n get writeable(): IProperty[] {\n return this._writeable;\n }\n\n /**\n * This is intended to be a one-time call per type to determine its writeable properties\n * @param api ApiModel for type references\n */\n setWriteable(api: ApiModel) {\n const result: IProperty[] = [];\n Object.values(this.properties)\n .filter(prop => !(prop.readOnly || prop.type.readOnly))\n .forEach(prop => {\n const type = prop.type;\n const w = type.intrinsic ? undefined : api.mayGetWriteableType(type);\n if (w) {\n const writeProp = { ...prop, type: w };\n result.push(writeProp);\n } else {\n result.push(prop);\n }\n });\n this._writeable = result;\n return this._writeable;\n }\n\n /**\n * Sets writeable property collection if it's not already set\n * @param api to use for type lookup\n */\n maySetWriteable(api: ApiModel) {\n if (this._writeable.length === 0) {\n this.setWriteable(api);\n }\n return this._writeable;\n }\n\n get className(): string {\n return this.name;\n }\n\n get intrinsic(): boolean {\n return false;\n }\n\n get status(): string {\n return this.schema['x-looker-status'] || '';\n }\n\n get deprecated(): boolean {\n return (\n this.schema.deprecated || this.schema['x-looker-deprecated'] || false\n );\n }\n\n get title(): string {\n return this.schema.title || '';\n }\n\n get default(): string | undefined {\n return this.schema.default || '';\n }\n\n get readOnly(): boolean {\n return Object.entries(this.properties).every(([, prop]) => prop.readOnly);\n }\n\n private filterRequiredProps(required: boolean) {\n const filteredProps: PropertyList = {};\n Object.entries(this.properties).forEach(([key, prop]) => {\n const condition = required ? prop.required : !prop.required;\n if (condition) {\n filteredProps[key] = prop;\n }\n });\n return filteredProps;\n }\n\n get requiredProperties() {\n return this.filterRequiredProps(true);\n }\n\n get optionalProperties() {\n return this.filterRequiredProps(false);\n }\n\n get hasSpecialNeeds(): boolean {\n return !!Object.entries(this.properties).find(\n ([, prop]) => prop.hasSpecialNeeds\n );\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const { fields, override, empty } = mockOptions(options);\n const isArray = this.className === 'ArrayType';\n const props = isArray\n ? (this as unknown as ArrayType).elementType.properties\n : this.properties;\n // prune invalid keys from the override list\n if (typeof override !== 'string' && typeof override !== 'function') {\n for (const key in override) {\n if (!(key in props)) {\n delete override[key];\n } else {\n // coerce override type for scalar properties\n const prop = props[key];\n if (prop.type.intrinsic) {\n override[key] = mockData(\n key,\n prop.type,\n override[key],\n empty\n ).value;\n }\n }\n }\n }\n let keys = parseFields(fields);\n if (keys['*']) {\n // add all properties, but default their nested fields if they'd have any\n const merge: ArgValues = {};\n Object.keys(props).forEach(k => (merge[k] = k));\n keys = { ...merge, ...keys };\n delete keys['*'];\n } else if (isEmpty(fields)) {\n // default to required properties\n for (const [key, prop] of Object.entries(props)) {\n if (prop.required) {\n keys[key] = key;\n }\n }\n }\n\n const overKeys =\n typeof override === 'string' || typeof override === 'function';\n\n let result: ArgValues = {};\n Object.keys(keys).forEach(k => {\n const v = keys[k];\n const over = overKeys ? undefined : override[k];\n const p = props[k];\n // Check if there are nested values for this key or just the default\n const scope = v === k ? k : { [k]: v };\n if (!p) {\n throw new Error(`No property named '${k}' in type ${this.name}`);\n }\n // const nested = p.schema?.items?.$ref;\n\n const val =\n typeof override === 'function'\n ? p.mock({ fields: scope, empty })\n : p.mock({ fields: scope, override: over, empty });\n if (val !== undefined) {\n result[k] = val;\n }\n });\n if (typeof override !== 'string') {\n // we've got keyed values to apply to the type\n result = { ...result, ...override };\n }\n return result;\n }\n\n mockType<T>(options: ITypeMock = {}): T {\n const result = this.mock(options);\n return result as unknown as T;\n }\n\n load(api: ApiModel): void {\n Object.entries(this.schema.properties || {}).forEach(\n ([propName, propSchema]) => {\n const propType = api.resolveType(\n propSchema,\n undefined,\n propName,\n this.name\n );\n // Using class name instead of instanceof check because TypeScript\n // linting complains about declaration order\n if (propType.instanceOf('EnumType')) {\n api.registerEnum(propType, propName);\n }\n // Track the \"parent\" reference for this type from the property reference\n propType.parentTypes.add(this.name);\n if (\n propType.instanceOf('ArrayType') ||\n propType.instanceOf('HashType')\n ) {\n propType.elementType?.parentTypes.add(propType.name);\n propType.elementType?.parentTypes.add(this.name);\n propType.parentTypes.add(this.name);\n }\n this.types.add(propType.name);\n const customType = propType.customType;\n if (customType) this.customTypes.add(customType);\n this.properties[safeName(propName)] = new Property(\n propName,\n propType,\n propSchema,\n this.name, // owner name\n this.schema.required\n );\n }\n );\n }\n\n instanceOf(className: string): boolean {\n return this.className === className;\n }\n\n asHashString() {\n let result = `${this.name}:`;\n Object.entries(this.properties)\n // put properties in alphabetical order first\n .sort(([a], [b]) => a.localeCompare(b))\n .forEach(([, prop]) => {\n result += prop.asHashString() + ':';\n });\n return result;\n }\n\n /**\n * Is this type directly recursive?\n * @returns {boolean} Does this type contain references to itself as a top-level property?\n */\n isRecursive(): boolean {\n const selfType = this.name;\n // test for directly recursive type references\n return Object.entries(this.properties).some(\n ([, prop]) => prop.type.name === selfType\n );\n }\n\n private static isPropSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.property)\n );\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param {RegExp} rx regular expression to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(rx: RegExp, criteria: SearchCriteria): boolean {\n if (\n !criteria.has(SearchCriterion.type) &&\n !criteria.has(SearchCriterion.status)\n )\n return false;\n let result = rx.test(this.searchString(criteria));\n if (!result && Type.isPropSearch(criteria)) {\n for (const [, prop] of Object.entries(this.properties)) {\n if (this.name !== prop.type.name) {\n /** Avoiding recursion */\n if (prop.search(rx, criteria)) {\n result = true;\n break;\n }\n }\n }\n }\n return result;\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = '';\n if (criteria.has(SearchCriterion.name)) result += searchIt(this.name);\n if (criteria.has(SearchCriterion.description))\n result += searchIt(this.description);\n if (criteria.has(SearchCriterion.title)) result += searchIt(this.title);\n if (criteria.has(SearchCriterion.status)) {\n result += searchIt(this.status);\n if (this.deprecated) result += searchIt('deprecated');\n }\n if (criteria.has(SearchCriterion.property)) {\n Object.entries(this.properties).forEach(([, prop]) => {\n if (this.name !== prop.type.name) {\n /** Avoiding recursion */\n result += prop.searchString(criteria);\n }\n });\n }\n return result;\n }\n}\n\nexport class ArrayType extends Type {\n constructor(public elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `${elementType.name}[]`);\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'ArrayType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n\n mock(options: ITypeMock = {}): any | undefined {\n const result = super.mock(options);\n if (Array.isArray(result)) {\n return result;\n }\n return [result];\n }\n}\n\nexport class EnumType extends Type implements IEnumType {\n readonly values: EnumValueType[];\n\n constructor(\n public elementType: IType,\n schema: OAS.SchemaObject,\n api: ApiModel,\n typeName?: string,\n methodName?: string\n ) {\n super(schema, schema.name);\n this.customType = elementType.customType;\n if (lookerValuesTag in schema) {\n this.values = schema[lookerValuesTag];\n } else if (enumTag in schema) {\n this.values = schema[enumTag] as EnumValueType[];\n } else {\n throw new Error(\n `${schema.name} is an enum but has no defined enum values`\n );\n }\n if (methodName) {\n this.description = `${this.description}${\n this.description ? ' ' : ''\n }(Enum defined in ${methodName})`;\n }\n\n this.name = this.findName(api, typeName, methodName);\n }\n\n private findName(api: ApiModel, typeName?: string, methodName?: string) {\n const hash = md5(this.asHashString());\n const enums = api.getEnumList();\n let name = titleCase(this.name || typeName || 'Enum');\n if (name in api.types) {\n const matched = enums[hash];\n if (matched?.name === name) {\n /**\n * this type is the same as the other enum of the same name, although description may vary.\n * The descriptions may vary, but we prioritize type name over description for identical enum values\n * since this has the same name, it will replace the previous version in the keyed collection of types\n */\n return name;\n }\n\n // Enum values don't match existing enum of this name. Pick a new name\n const baseName = methodName ? titleCase(`${methodName}_${name}`) : name;\n let newName = baseName;\n let i = 0;\n while (newName in api.types) {\n newName = `${baseName}${++i}`;\n }\n name = newName;\n }\n // register the enum hash value\n enums[hash] = this;\n return name;\n }\n\n override mock(_options: ITypeMock = {}): any | undefined {\n return this.values[0];\n }\n\n searchString(criteria: SearchCriteria): string {\n let result = super.searchString(criteria);\n if (criteria.has(SearchCriterion.property)) {\n for (const val in this.values) {\n result += searchIt(val.toString());\n }\n }\n return result;\n }\n\n get className(): string {\n return 'EnumType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n\n asHashString() {\n return this.values.join();\n }\n}\n\nexport class DelimArrayType extends Type {\n constructor(public elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `DelimArray<${elementType.name}>`);\n this.elementType = elementType;\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'DelimArrayType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n}\n\nexport class HashType extends Type {\n elementType: IType;\n\n constructor(elementType: IType, schema: OAS.SchemaObject) {\n super(schema, `Hash[${elementType.name}]`);\n this.elementType = elementType;\n this.customType = elementType.customType;\n }\n\n get className(): string {\n return 'HashType';\n }\n\n get readOnly() {\n return this.elementType.readOnly;\n }\n}\n\nexport class IntrinsicType extends Type {\n static stringTypes = [\n 'string',\n 'uri',\n 'url',\n 'email',\n 'uuid',\n 'hostname',\n 'password',\n 'ipv4',\n 'ipv6',\n 'byte',\n 'binary',\n ];\n\n isString = false;\n\n constructor(name: string) {\n super({}, name);\n this.customType = '';\n this.isString = IntrinsicType.stringTypes.includes(name);\n }\n\n override mock(options: ITypeMock = {}) {\n const { override, empty } = mockOptions(options);\n if (this.isString && typeof override === 'string') return override;\n return mockData(this.name, this, undefined, empty).value;\n }\n\n get className(): string {\n return 'IntrinsicType';\n }\n\n get intrinsic(): boolean {\n return true;\n }\n\n get readOnly(): boolean {\n return false;\n }\n}\n\nexport class RequestType extends Type {\n constructor(\n api: IApiModel,\n name: string,\n params: IParameter[],\n description = ''\n ) {\n super({ description }, name);\n params.forEach(p => {\n const writeProp = p.asProperty();\n const typeWriter = api.mayGetWriteableType(p.type);\n if (typeWriter) writeProp.type = typeWriter;\n this.properties[p.name] = writeProp;\n });\n }\n}\n\nexport class WriteType extends Type {\n constructor(api: IApiModel, type: IType) {\n const name = `${strWrite}${type.name}`;\n const roProps = WriteType.readonlyProps(type.properties);\n const description =\n `Dynamic writeable type for ${type.name}` +\n (roProps.length > 0\n ? ` removes:\\n` + roProps.map(p => p.name).join(', ')\n : '');\n super({ description }, name);\n // Cross-reference the two types\n this.types.add(type.name);\n this.customTypes.add(type.name);\n type.types.add(this.name);\n type.customTypes.add(this.name);\n const obj = type as Type;\n const writes = obj.maySetWriteable(api as ApiModel);\n writes.forEach(p => {\n const writeProp = new Property(\n p.name,\n p.type,\n {\n description: p.description || p.type.description,\n // nullable/optional if property is nullable or property is complex type\n nullable: p.nullable || !p.type.intrinsic,\n },\n this.name, // owner name\n type.schema.required\n );\n this.properties[safeName(p.name)] = writeProp;\n });\n }\n\n private static readonlyProps = (properties: PropertyList): IProperty[] => {\n const result: IProperty[] = [];\n Object.entries(properties)\n .filter(([, prop]) => prop.readOnly || prop.type.readOnly)\n .forEach(([, prop]) => result.push(prop));\n return result;\n };\n}\n\n/**\n * load an API specification, ensure it's upgraded, and return the APIModel\n * @param spec to optionally parse and upgrade\n */\nexport const specToModel = (spec: any): ApiModel => {\n if (typeof spec === 'string') {\n spec = JSON.parse(spec);\n }\n const json = upgradeSpecObject(spec);\n const obj = new OAS.OpenApiBuilder(json).getSpec();\n return new ApiModel(obj);\n};\n\nexport interface IApiModel extends IModel {\n version: string;\n description: string;\n spec: OAS.OpenAPIObject;\n methods: MethodList;\n types: TypeList;\n tags: TagList;\n\n getRequestType(method: IMethod): IType | undefined;\n\n mayGetWriteableType(type: IType): IType | undefined;\n\n /**\n * Search this item for a regular expression pattern\n * @param {string} expression text or regex to match\n * @param {SearchCriteria} criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(expression: string, criteria: SearchCriteria): ISearchResult;\n}\n\nexport class ApiModel implements ISymbolTable, IApiModel {\n private enumTypes: TypeList = {};\n private refs: TypeList = {};\n methods: MethodList = {};\n types: TypeList = {};\n tags: TagList = {};\n typeTags: TypeTagList = {};\n\n constructor(public readonly spec: OAS.OpenAPIObject) {\n [\n 'string',\n 'integer',\n 'int64',\n 'boolean',\n 'object',\n 'float',\n 'double',\n 'void',\n 'date',\n 'datetime',\n 'binary',\n 'byte',\n 'email',\n 'uuid',\n 'uri',\n 'url',\n 'hostname',\n 'password',\n 'ipv4',\n 'ipv6',\n 'any',\n ].forEach(name => (this.types[name] = new IntrinsicType(name)));\n\n this.load();\n }\n\n public get version(): string {\n return this.spec?.info.version || '';\n }\n\n public get description(): string {\n return this.spec?.info?.description?.trim() || '';\n }\n\n static fromString(specContent: string): ApiModel {\n return specToModel(specContent);\n }\n\n static fromJson(json: any): ApiModel {\n return specToModel(json);\n }\n\n private static isMethodSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.method) ||\n criteria.has(SearchCriterion.argument) ||\n criteria.has(SearchCriterion.response) ||\n criteria.has(SearchCriterion.status) ||\n criteria.has(SearchCriterion.activityType)\n );\n }\n\n private static isTypeSearch(criteria: SearchCriteria): boolean {\n return (\n criteria.has(SearchCriterion.type) ||\n criteria.has(SearchCriterion.title) ||\n criteria.has(SearchCriterion.status)\n );\n }\n\n private static addMethodToTags(tags: TagList, method: IMethod): TagList {\n for (const tag of method.schema.tags) {\n let list: MethodList = tags[tag];\n if (!list) {\n list = {};\n tags[tag] = list;\n }\n list[method.name] = method;\n }\n return tags;\n }\n\n private tagMethod(method: IMethod) {\n return ApiModel.addMethodToTags(this.tags, method);\n }\n\n /**\n * Search this item for a regular expression pattern\n * @param expression regular expression to match\n * @param criteria items to examine for the search\n * @returns {boolean} true if the pattern is found in the specified criteria\n */\n search(\n expression: string,\n criteria: SearchCriteria = SearchAll\n ): ISearchResult {\n const tags: TagList = {};\n const types: TypeList = {};\n let methodCount = 0;\n let typeCount = 0;\n const result = {\n ok: true,\n message: 'Search done',\n tags,\n types,\n };\n\n let rx: RegExp;\n try {\n rx = new RegExp(expression, 'mi'); // multi-line case insensitive, not global so first match returns\n } catch (e) {\n result.message = `Invalid search expression ${e}`;\n result.ok = false;\n return result;\n }\n\n if (ApiModel.isMethodSearch(criteria)) {\n Object.entries(this.methods).forEach(([, method]) => {\n if (method.search(rx, criteria)) {\n methodCount++;\n ApiModel.addMethodToTags(tags, method);\n }\n });\n }\n if (ApiModel.isTypeSearch(criteria)) {\n Object.entries(this.types).forEach(([key, type]) => {\n if (!rx) {\n throw Error(`${key} rx undefined`);\n }\n if (type.search(rx, criteria)) {\n typeCount++;\n types[key] = type;\n }\n });\n }\n result.message = `${methodCount} methods and ${typeCount} types found`;\n return result;\n }\n\n // TODO replace this with get from underscore?\n jsonPath(path: string | string[], item: any = this.spec, splitter = '/') {\n let keys = path;\n if (!(path instanceof Array)) {\n keys = path.split(splitter);\n }\n for (const key of keys) {\n if (key === '#') continue;\n item = item[key];\n if (item == null) return null;\n }\n return item;\n }\n\n private schemaHasEnums(schema: OAS.SchemaObject) {\n return lookerValuesTag in schema || enumTag in schema;\n }\n\n /**\n * Retrieve an api object via its JSON path\n */\n resolveType(\n schema: string | OAS.SchemaObject | OAS.ReferenceObject,\n style?: string,\n typeName?: string,\n methodName?: string\n ): IType {\n const getRef = (schema: OAS.SchemaObject | OAS.ReferenceObject) => {\n const ref = schema.$ref;\n let result = this.refs[ref];\n\n if (!result) {\n /** This must be recursive */\n const parts: string[] = ref.split('/');\n const name = parts[parts.length - 1];\n const t = new Type(schema, name);\n this.refs[ref] = t;\n result = t;\n }\n return result;\n };\n\n if (typeof schema === 'string') {\n if (schema.indexOf('/requestBodies/') < 0)\n return this.types[schema.substring(schema.lastIndexOf('/') + 1)];\n // dereference the request strBody schema reference\n const deref = this.jsonPath(schema);\n if (deref) {\n const ref = this.jsonPath(\n ['content', 'application/json', 'schema', '$ref'],\n deref\n );\n if (ref) return this.resolveType(ref, style, typeName, methodName);\n }\n } else if (OAS.isReferenceObject(schema)) {\n return getRef(schema);\n } else if (schema.type) {\n if (schema.type === 'integer' && schema.format === 'int64') {\n return this.types.int64;\n }\n if (schema.type === 'number') {\n if (schema.format) return this.types[schema.format];\n return this.types.float;\n }\n if (schema.type === 'array' && schema.items) {\n const resolved = this.resolveType(schema.items);\n if (!resolved) {\n throw new Error(`Could not resolve ${JSON.stringify(schema)}`);\n }\n if (style === 'simple' || style === 'form') {\n // FKA 'csv' .. OpenAPI converter now uses \"form\" instead of \"simple\" for this\n return new DelimArrayType(resolved, schema);\n }\n if (this.schemaHasEnums(schema)) {\n const num = new EnumType(\n resolved,\n schema,\n this,\n typeName,\n methodName\n );\n this.registerEnum(num, methodName);\n const result = new ArrayType(num, schema);\n return result;\n }\n return new ArrayType(resolved, schema);\n }\n if (this.schemaHasEnums(schema)) {\n const resolved = this.resolveType(\n schema.type,\n style,\n typeName,\n methodName\n );\n const result = new EnumType(\n resolved,\n schema,\n this,\n typeName,\n methodName\n );\n if (result) {\n // If defined, it may get reassigned\n return this.registerEnum(result, methodName);\n }\n return result;\n }\n if (schema.type === 'object' && schema.additionalProperties) {\n if (schema.additionalProperties !== true) {\n return new HashType(\n this.resolveType(schema.additionalProperties),\n schema\n );\n }\n }\n if (schema.format === 'date-time') {\n return this.types.datetime;\n }\n if (schema.format && this.types[schema.format]) {\n return this.types[schema.format];\n }\n if (this.types[schema.type]) {\n return this.types[schema.type];\n }\n }\n throw new Error(\n `Schema ${\n typeof schema === 'string' ? schema : JSON.stringify(schema)\n } must have a ref or a type`\n );\n }\n\n private requestTypeName(method: IMethod) {\n return `${strRequest}${camelCase('_' + method.name)}`;\n }\n\n // add to this.types collection with name as key\n makeRequestType(method: IMethod) {\n const name = this.requestTypeName(method);\n const request = new RequestType(\n this,\n name,\n method.allParams,\n `Dynamically generated request type for ${method.name}`\n );\n this.types[name] = request;\n method.addType(this, request);\n return request;\n }\n\n registerEnum(type: IType, methodName?: string) {\n if (!(type instanceof EnumType)) return type;\n\n if (type.name in this.types) {\n const hash = md5(type.asHashString());\n const matched = this.enumTypes[hash];\n if (matched?.name === type.name) {\n /**\n * this type is the same as the other enum of the same name, although description may vary.\n * The descriptions may vary, but we prioritize type name over description for identical enum values\n */\n return this.enumTypes[hash];\n }\n }\n\n if (methodName) {\n const method = this.methods[methodName];\n if (method) {\n // add a type reference for the method\n method.types.add(type.name);\n method.customTypes.add(type.name);\n }\n }\n this.types[type.name] = type;\n return type;\n }\n\n /**\n * only gets the request type if more than one method parameter is optional\n *\n * if needed, create the request type from method parameters\n * add to this.types collection\n *\n * @param method for request type\n * @returns returns type if request type is needed, otherwise it doesn't\n */\n private _getRequestType(method: IMethod) {\n if (method.optionalParams.length <= 1) return undefined;\n\n let result = this.types[this.requestTypeName(method)];\n if (!result) result = this.makeRequestType(method);\n return result;\n }\n\n /**\n * only gets the request type if more than one method parameter is optional\n *\n * updates refCount for the method\n *\n * @param method for request type\n * @returns {IType | undefined} returns type if request type is needed, otherwise it doesn't\n */\n getRequestType(method: IMethod) {\n const result = this._getRequestType(method);\n if (result) result.refCount++;\n return result;\n }\n\n /**\n * Read-only accessor for private enum collection used within this source file as a \"friend\"\n */\n getEnumList(): TypeList {\n return this.enumTypes;\n }\n\n makeWriteableType(type: IType) {\n const writer: WriteType = new WriteType(this, type);\n this.types[writer.name] = writer;\n return writer;\n }\n\n /**\n * a writeable type will need to be found or created if the passed type has read-only properties\n * and is used by any method that updates the structure\n * @param type to check for read-only properties\n * @returns either writeable type or undefined\n */\n mayGetWriteableType(type: IType) {\n if (type.intrinsic) return undefined;\n if (type.elementType?.intrinsic) return undefined;\n if (type instanceof WriteType) return type;\n if (!anyWriter(this, type)) return undefined;\n const props = Object.entries(type.properties).map(([, prop]) => prop);\n if (props.length === 0) return undefined;\n const obj = type as Type;\n const writes = obj.maySetWriteable(this);\n if (writes.length === 0) {\n // No writeable properties is an error\n const immutable =\n 'WARNING: no writeable properties found for POST, PUT, or PATCH';\n if (type.description.indexOf(immutable) < 0) {\n type.description += type.description.length > 0 ? '\\n' : '' + immutable;\n }\n return undefined;\n }\n if (\n writes.length === props.length &&\n JSON.stringify(writes) === JSON.stringify(props)\n )\n return undefined; // type is writeable\n const result = this.makeWriteableType(type);\n type.types.add(result.name);\n // Link the writeable type to its source type\n type.customTypes.add(result.name);\n result.parentTypes.add(type.name);\n return result;\n }\n\n /**\n * establishes any dynamically-generated request or writeable types\n */\n loadDynamicTypes() {\n Object.entries(this.methods).forEach(([, method]) => {\n method.makeTypes(this);\n });\n }\n\n /**\n * Sort a keyed collection so its keys are in sorted order\n * @param list to sort\n * @returns {KeyedCollection<T>} newly sorted list\n */\n sortList<T>(list: KeyedCollection<T>): KeyedCollection<T> {\n const result: KeyedCollection<T> = {};\n const sortedKeys = Object.keys(list).sort(localeSort);\n for (const key of sortedKeys) {\n result[key] = list[key];\n }\n return result;\n }\n\n sortLists() {\n this.methods = this.sortList(this.methods);\n this.types = this.sortList(this.types);\n // this.refs = this.sortList(this.refs)\n this.tags = this.sortList(this.tags);\n this.typeTags = this.sortList(this.typeTags);\n const typeKeys = Object.keys(this.typeTags);\n typeKeys.forEach(key => {\n this.typeTags[key] = this.sortList(this.typeTags[key]);\n });\n // commented out to leave methods in natural order within the tag\n // const keys = Object.keys(this.tags).sort(localeSort)\n // keys.forEach((key) => {\n // this.tags[key] = this.sortList(this.tags[key])\n // })\n }\n\n load(): void {\n if (this.spec?.components?.schemas) {\n Object.entries(this.spec.components.schemas).forEach(([name, schema]) => {\n const t = new Type(schema, name);\n // types[n] and corresponding refs[ref] MUST reference the same type instance!\n this.types[name] = t;\n this.refs[`#/components/schemas/${name}`] = t;\n });\n Object.keys(this.spec.components.schemas).forEach(name => {\n const resolved = this.resolveType(name) as Type;\n resolved.load(this);\n });\n // Ensure all property's nested type references point to the correct full type\n const complex = Object.values(this.types)\n .filter(t => !t.intrinsic)\n .map(t => t);\n complex.forEach(type => {\n const nested = Object.values(type.properties).filter(\n p => !p.type.intrinsic\n );\n nested.forEach(p => {\n const ref = this.types[p.type.name];\n if (ref) {\n // Could be a collection of an intrinsic type, so only assign if\n // there is an explicit type ref\n p.type = ref;\n // Try to get a good description for the property\n p.description = p.description || p.type.description;\n }\n });\n });\n }\n\n if (this.spec?.paths) {\n Object.entries(this.spec.paths).forEach(([path, schema]) => {\n const methods = this.loadMethods(path, schema);\n methods.forEach(method => {\n this.methods[method.name] = method;\n });\n });\n }\n this.loadDynamicTypes();\n this.typeTags = tagTypes(this, this.types);\n this.sortLists();\n }\n\n private loadMethods(endpoint: string, schema: OAS.PathItemObject): Method[] {\n const methods: Method[] = [];\n\n const addIfPresent = (\n httpMethod: HttpMethod,\n opSchema: OAS.OperationObject | undefined\n ) => {\n if (opSchema) {\n const responses = this.methodResponses(opSchema);\n const params = this.methodParameters(opSchema);\n const body = this.requestBody(opSchema.requestBody);\n const method = new Method(\n this,\n httpMethod,\n endpoint,\n opSchema,\n params,\n responses,\n body\n );\n methods.push(method);\n this.tagMethod(method);\n }\n };\n\n addIfPresent('GET', schema.get);\n addIfPresent('PUT', schema.put);\n addIfPresent('POST', schema.post);\n addIfPresent('PATCH', schema.patch);\n addIfPresent('DELETE', schema.delete);\n // options?: OperationObject;\n // head?: OperationObject;\n // trace?: OperationObject;\n return methods;\n }\n\n private methodResponses(schema: OAS.OperationObject): IMethodResponse[] {\n const responses: IMethodResponse[] = [];\n Object.entries(schema.responses).forEach(([statusCode, contentSchema]) => {\n const desc = contentSchema.description || '';\n if (contentSchema.content) {\n Object.entries(contentSchema.content).forEach(\n ([mediaType, response]) => {\n responses.push(\n new MethodResponse(\n parseInt(statusCode, 10),\n mediaType,\n this.resolveType(\n (response as OAS.MediaTypeObject).schema || {}\n ),\n desc\n )\n );\n }\n );\n } else if (statusCode === '204') {\n // no content - returns void\n responses.push(\n new MethodResponse(204, '', this.types.void, desc || 'No content')\n );\n }\n });\n return responses;\n }\n\n private methodParameters(schema: OAS.OperationObject): IParameter[] {\n const params: IParameter[] = [];\n if (schema.parameters) {\n for (const p of schema.parameters) {\n let type: IType;\n let param: OAS.ParameterObject;\n if (OAS.isReferenceObject(p)) {\n // TODO make this work correctly for reference objects at the parameter level\n // TODO is style resolution like below required here?\n type = this.resolveType(p);\n param = {\n in: 'query',\n name: type.name,\n };\n } else {\n type = this.resolveType(p.schema || {}, p.style);\n param = p;\n }\n // Method parameters are a chicken/egg situation and ownership will be established in the Method constructor\n const mp = new Parameter(param, type);\n params.push(mp);\n }\n }\n return params;\n }\n\n private requestBody(\n obj: OAS.RequestBodyObject | OAS.ReferenceObject | undefined\n ) {\n if (!obj) return undefined;\n\n let required = true;\n if (!OAS.isReferenceObject(obj)) {\n const req = obj as OAS.RequestBodyObject;\n if ('required' in req) {\n required = Boolean(req.required);\n }\n }\n\n const typeSchema: OAS.SchemaObject = {\n deprecated: false,\n description: '',\n nullable: false,\n readOnly: false,\n required: required ? [strBody] : [],\n writeOnly: false,\n };\n\n // default the type to a plain body\n let type: IType = new Type(typeSchema, strBody);\n\n if (OAS.isReferenceObject(obj)) {\n // get the type directly from the ref object\n type = this.resolveType(obj.$ref);\n } else if (obj.content) {\n // determine type from content\n const content = obj.content;\n // TODO need to understand headers or links\n Object.keys(content).forEach(key => {\n const media = content[key];\n /* eslint-disable @typescript-eslint/no-non-null-assertion */\n const schema = media.schema!;\n if (OAS.isReferenceObject(schema)) {\n type = this.resolveType(schema.$ref);\n } else {\n type = this.resolveType(schema);\n }\n });\n } else {\n // TODO must be dynamic, create type\n }\n\n return new Parameter(\n {\n description: '',\n location: strBody,\n name: strBody,\n required, // TODO capture description\n } as Partial<IParameter>,\n type\n );\n }\n}\n"],"mappings":";;;;;AA0BA,OAAO,KAAKA,GAAG,MAAM,aAAa;AAClC,OAAOC,GAAG,MAAM,aAAa;AAC7B,OAAOC,OAAO,MAAM,gBAAgB;AAEpC,SACEC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,YAAY,QACP,iBAAiB;AACxB,SAASC,iBAAiB,QAAQ,iBAAiB;AAQnD,OAAO,IAAMC,OAAO,GAAG,MAAM;AAC7B,OAAO,IAAMC,UAAU,GAAG,SAAS;AACnC,OAAO,IAAMC,QAAQ,GAAG,OAAO;AAS/B,IAAMC,eAAe,GAAG,iBAAiB;AACzC,IAAMC,OAAO,GAAG,MAAM;AAGtB,IAAMC,UAAU,GAAG,2BAA2B;AAK9C,WAAYC,UAAU,aAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAmBtB,OAAO,IAA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