@odata2ts/odata2ts 0.36.3 → 0.38.0

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.
Files changed (133) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/FactoryFunctionModel.d.ts +7 -7
  3. package/lib/FactoryFunctionModel.js +1 -2
  4. package/lib/FactoryFunctionModel.js.map +1 -1
  5. package/lib/NamingModel.js +2 -5
  6. package/lib/NamingModel.js.map +1 -1
  7. package/lib/OptionModel.d.ts +7 -2
  8. package/lib/OptionModel.js +4 -7
  9. package/lib/OptionModel.js.map +1 -1
  10. package/lib/TypeModel.js +2 -5
  11. package/lib/TypeModel.js.map +1 -1
  12. package/lib/app.d.ts +2 -2
  13. package/lib/app.js +23 -27
  14. package/lib/app.js.map +1 -1
  15. package/lib/cli/cli.d.ts +1 -0
  16. package/lib/cli/cli.js +27 -0
  17. package/lib/cli/cli.js.map +1 -0
  18. package/lib/cli/index.d.ts +4 -0
  19. package/lib/cli/index.js +5 -0
  20. package/lib/cli/index.js.map +1 -0
  21. package/lib/cli/processCliArgs.d.ts +2 -0
  22. package/lib/cli/processCliArgs.js +57 -0
  23. package/lib/cli/processCliArgs.js.map +1 -0
  24. package/lib/cli/processConfigFile.d.ts +2 -0
  25. package/lib/cli/processConfigFile.js +24 -0
  26. package/lib/cli/processConfigFile.js.map +1 -0
  27. package/lib/cli/serviceGenerationRun.d.ts +2 -0
  28. package/lib/cli/serviceGenerationRun.js +77 -0
  29. package/lib/cli/serviceGenerationRun.js.map +1 -0
  30. package/lib/data-model/DataModel.d.ts +2 -2
  31. package/lib/data-model/DataModel.js +5 -10
  32. package/lib/data-model/DataModel.js.map +1 -1
  33. package/lib/data-model/DataModelDigestion.d.ts +10 -10
  34. package/lib/data-model/DataModelDigestion.js +27 -27
  35. package/lib/data-model/DataModelDigestion.js.map +1 -1
  36. package/lib/data-model/DataModelDigestionV2.d.ts +2 -2
  37. package/lib/data-model/DataModelDigestionV2.js +27 -31
  38. package/lib/data-model/DataModelDigestionV2.js.map +1 -1
  39. package/lib/data-model/DataModelDigestionV4.d.ts +2 -2
  40. package/lib/data-model/DataModelDigestionV4.js +33 -37
  41. package/lib/data-model/DataModelDigestionV4.js.map +1 -1
  42. package/lib/data-model/DataTypeModel.d.ts +5 -2
  43. package/lib/data-model/DataTypeModel.js +2 -5
  44. package/lib/data-model/DataTypeModel.js.map +1 -1
  45. package/lib/data-model/NamingHelper.d.ts +2 -2
  46. package/lib/data-model/NamingHelper.js +12 -19
  47. package/lib/data-model/NamingHelper.js.map +1 -1
  48. package/lib/data-model/ServiceConfigHelper.d.ts +3 -3
  49. package/lib/data-model/ServiceConfigHelper.js +18 -22
  50. package/lib/data-model/ServiceConfigHelper.js.map +1 -1
  51. package/lib/data-model/edmx/ODataEdmxModelBase.js +1 -2
  52. package/lib/data-model/edmx/ODataEdmxModelV3.d.ts +1 -1
  53. package/lib/data-model/edmx/ODataEdmxModelV3.js +1 -2
  54. package/lib/data-model/edmx/ODataEdmxModelV3.js.map +1 -1
  55. package/lib/data-model/edmx/ODataEdmxModelV4.d.ts +1 -1
  56. package/lib/data-model/edmx/ODataEdmxModelV4.js +1 -2
  57. package/lib/data-model/edmx/ODataEdmxModelV4.js.map +1 -1
  58. package/lib/data-model/validation/NameClashValidator.d.ts +5 -4
  59. package/lib/data-model/validation/NameClashValidator.js +16 -18
  60. package/lib/data-model/validation/NameClashValidator.js.map +1 -1
  61. package/lib/data-model/validation/NameValidator.d.ts +3 -2
  62. package/lib/data-model/validation/NameValidator.js +1 -2
  63. package/lib/data-model/validation/NameValidator.js.map +1 -1
  64. package/lib/data-model/validation/NoopValidator.d.ts +4 -3
  65. package/lib/data-model/validation/NoopValidator.js +5 -9
  66. package/lib/data-model/validation/NoopValidator.js.map +1 -1
  67. package/lib/defaultConfig.d.ts +1 -1
  68. package/lib/defaultConfig.js +22 -26
  69. package/lib/defaultConfig.js.map +1 -1
  70. package/lib/download/downloadMetadata.d.ts +1 -1
  71. package/lib/download/downloadMetadata.js +6 -10
  72. package/lib/download/downloadMetadata.js.map +1 -1
  73. package/lib/download/index.d.ts +2 -2
  74. package/lib/download/index.js +2 -7
  75. package/lib/download/index.js.map +1 -1
  76. package/lib/download/storeMetadata.js +15 -17
  77. package/lib/download/storeMetadata.js.map +1 -1
  78. package/lib/evaluateConfig.d.ts +1 -1
  79. package/lib/evaluateConfig.js +14 -18
  80. package/lib/evaluateConfig.js.map +1 -1
  81. package/lib/generator/ImportContainer.d.ts +3 -3
  82. package/lib/generator/ImportContainer.js +40 -27
  83. package/lib/generator/ImportContainer.js.map +1 -1
  84. package/lib/generator/ImportedNameValidator.js +1 -5
  85. package/lib/generator/ImportedNameValidator.js.map +1 -1
  86. package/lib/generator/ModelGenerator.d.ts +1 -1
  87. package/lib/generator/ModelGenerator.js +13 -13
  88. package/lib/generator/ModelGenerator.js.map +1 -1
  89. package/lib/generator/QueryObjectGenerator.d.ts +1 -1
  90. package/lib/generator/QueryObjectGenerator.js +41 -31
  91. package/lib/generator/QueryObjectGenerator.js.map +1 -1
  92. package/lib/generator/ServiceGenerator.d.ts +5 -5
  93. package/lib/generator/ServiceGenerator.js +62 -65
  94. package/lib/generator/ServiceGenerator.js.map +1 -1
  95. package/lib/generator/import/ImportObjects.d.ts +3 -1
  96. package/lib/generator/import/ImportObjects.js +14 -15
  97. package/lib/generator/import/ImportObjects.js.map +1 -1
  98. package/lib/generator/index.d.ts +3 -3
  99. package/lib/generator/index.js +3 -9
  100. package/lib/generator/index.js.map +1 -1
  101. package/lib/index.d.ts +4 -4
  102. package/lib/index.js +4 -7
  103. package/lib/index.js.map +1 -1
  104. package/lib/project/FileHandler.d.ts +3 -3
  105. package/lib/project/FileHandler.js +12 -16
  106. package/lib/project/FileHandler.js.map +1 -1
  107. package/lib/project/ProjectManager.d.ts +5 -5
  108. package/lib/project/ProjectManager.js +25 -32
  109. package/lib/project/ProjectManager.js.map +1 -1
  110. package/lib/project/TsMorphHelper.d.ts +1 -1
  111. package/lib/project/TsMorphHelper.js +21 -22
  112. package/lib/project/TsMorphHelper.js.map +1 -1
  113. package/lib/project/formatter/BaseFormatter.d.ts +1 -1
  114. package/lib/project/formatter/BaseFormatter.js +1 -5
  115. package/lib/project/formatter/BaseFormatter.js.map +1 -1
  116. package/lib/project/formatter/FileFormatter.js +1 -2
  117. package/lib/project/formatter/NoopFormatter.d.ts +1 -1
  118. package/lib/project/formatter/NoopFormatter.js +5 -9
  119. package/lib/project/formatter/NoopFormatter.js.map +1 -1
  120. package/lib/project/formatter/PrettierFormatter.d.ts +1 -1
  121. package/lib/project/formatter/PrettierFormatter.js +20 -25
  122. package/lib/project/formatter/PrettierFormatter.js.map +1 -1
  123. package/lib/project/formatter/index.d.ts +1 -1
  124. package/lib/project/formatter/index.js +6 -10
  125. package/lib/project/formatter/index.js.map +1 -1
  126. package/lib/project/logger/logFilePath.js +4 -9
  127. package/lib/project/logger/logFilePath.js.map +1 -1
  128. package/lib/run-cli.js +2 -4
  129. package/lib/run-cli.js.map +1 -1
  130. package/package.json +55 -64
  131. package/lib/cli.d.ts +0 -3
  132. package/lib/cli.js +0 -176
  133. package/lib/cli.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"QueryObjectGenerator.js","sourceRoot":"","sources":["../../src/generator/QueryObjectGenerator.ts"],"names":[],"mappings":";;;;AACA,qDAAqD;AACrD,uCAAsG;AACtG,sDAA2D;AAgB3D,0DAA4D;AAGrD,MAAM,oBAAoB,GAAiC,CAChE,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,EAAE;IACF,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC;AATW,QAAA,oBAAoB,wBAS/B;AAEF,MAAM,oBAAoB;IACxB,YACU,OAAuB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CAAC,CAAC,EAAE,CAAC;YAC9D,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,gBAAK,CAAC,OAAO;oBACpB,UAAU,EAAE,IAAI;oBAChB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;oBAClC,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC;iBACzF;aACF;YACD,KAAK,EAAE;gBACL;oBACE,UAAU,EAAE;wBACV,UAAU,SAAS,CAAC,SAAS,IAAI,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,GACrG,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAChC,GAAG;qBACJ;iBACF;aACF;YACD,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,WAAW;oBACjB,UAAU,EAAE,CAAC,oBAAoB,CAAC;iBACnC;gBACD,+GAA+G;gBAC/G,GAAG,CAAC,SAAS,CAAC,IAAI,6CAA4B,IAAI,CAAC,SAAS;oBAC1D,CAAC,CAAC;wBACE;4BACE,IAAI,EAAE,UAAU;4BAChB,UAAU,EAAE,CAAC,kCAAkC,CAAC;yBACjD;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ValueConverterImport } from \"@odata2ts/converter-runtime\";\r\nimport { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { OptionalKind, PropertyDeclarationStructure, Scope, VariableDeclarationKind } from \"ts-morph\";\r\nimport { firstCharLowerCase } from \"xml2js/lib/processors\";\r\n\r\nimport { DataModel } from \"../data-model/DataModel\";\r\nimport {\r\n ComplexType,\r\n DataTypes,\r\n EntityType,\r\n OperationType,\r\n OperationTypes,\r\n PropertyModel,\r\n} from \"../data-model/DataTypeModel\";\r\nimport { NamingHelper } from \"../data-model/NamingHelper\";\r\nimport { EntityBasedGeneratorFunction, GeneratorFunctionOptions } from \"../FactoryFunctionModel\";\r\nimport { Modes } from \"../OptionModel\";\r\nimport { FileHandler } from \"../project/FileHandler\";\r\nimport { ProjectManager } from \"../project/ProjectManager\";\r\nimport { QueryObjectImports } from \"./import/ImportObjects\";\r\nimport { ImportContainer } from \"./ImportContainer\";\r\n\r\nexport const generateQueryObjects: EntityBasedGeneratorFunction = (\r\n project,\r\n dataModel,\r\n version,\r\n options,\r\n namingHelper\r\n) => {\r\n const generator = new QueryObjectGenerator(project, dataModel, version, options, namingHelper);\r\n return generator.generate();\r\n};\r\n\r\nclass QueryObjectGenerator {\r\n constructor(\r\n private project: ProjectManager,\r\n private dataModel: DataModel,\r\n private version: ODataVersions,\r\n private options: GeneratorFunctionOptions,\r\n private namingHelper: NamingHelper\r\n ) {}\r\n\r\n public async generate(): Promise<void> {\r\n this.project.initQObjects();\r\n\r\n // process EntityType & ComplexType\r\n const promises: Array<Promise<void>> = [...this.generateEntityTypes(), ...this.generateComplexTypes()];\r\n if (!this.options.skipOperations) {\r\n // process unbound operations\r\n promises.push(this.generateUnboundOperations());\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n return this.project.finalizeQObjects();\r\n }\r\n\r\n private generateEntityTypes() {\r\n return this.dataModel.getEntityTypes().map((model) => {\r\n const file = this.project.createOrGetQObjectFile(model.folderPath, model.qName, [\r\n model.qName,\r\n firstCharLowerCase(model.qName),\r\n model.id.qName,\r\n ]);\r\n\r\n // q object\r\n this.generateModel(file, model);\r\n\r\n // qId function\r\n if (!this.options.skipIdModels && model.generateId) {\r\n this.generateIdFunction(file, model);\r\n }\r\n\r\n // bound q operations\r\n if (!this.options.skipOperations) {\r\n [\r\n ...this.dataModel.getEntityTypeOperations(model.fqName),\r\n ...this.dataModel.getEntitySetOperations(model.fqName),\r\n ].forEach((operation) => {\r\n this.generateOperation(file, operation, model.fqName);\r\n });\r\n }\r\n\r\n return this.project.finalizeFile(file);\r\n });\r\n }\r\n\r\n private generateComplexTypes() {\r\n return this.dataModel.getComplexTypes().map((model) => {\r\n const file = this.project.createOrGetQObjectFile(model.folderPath, model.qName, [\r\n model.qName,\r\n firstCharLowerCase(model.qName),\r\n ]);\r\n\r\n this.generateModel(file, model);\r\n\r\n return this.project.finalizeFile(file);\r\n });\r\n }\r\n\r\n private generateModel(file: FileHandler, model: ComplexType) {\r\n const imports = file.getImports();\r\n\r\n let extendsClause: string;\r\n if (model.baseClasses.length) {\r\n const baseClass = model.baseClasses[0];\r\n const baseModel = this.dataModel.getModel(baseClass) as ComplexType;\r\n if (!baseModel) {\r\n throw new Error(`Entity or complex type \"${baseClass}\" from baseClass attribute not found!`);\r\n }\r\n extendsClause = imports.addGeneratedQObject(baseClass, baseModel.qName);\r\n } else {\r\n extendsClause = imports.addQObject(QueryObjectImports.QueryObject);\r\n }\r\n\r\n file.getFile().addClass({\r\n name: model.qName,\r\n isExported: true,\r\n extends: extendsClause,\r\n // isAbstract: model.abstract,\r\n properties: this.generateQueryObjectProps(file.getImports(), model.props),\r\n });\r\n\r\n file.getFile().addVariableStatement({\r\n declarationKind: VariableDeclarationKind.Const,\r\n isExported: true,\r\n declarations: [\r\n {\r\n name: firstCharLowerCase(model.qName),\r\n initializer: `new ${model.qName}()`,\r\n },\r\n ],\r\n });\r\n }\r\n\r\n private generateQueryObjectProps(\r\n importContainer: ImportContainer,\r\n props: Array<PropertyModel>\r\n ): Array<OptionalKind<PropertyDeclarationStructure>> {\r\n return props.map((prop) => {\r\n const { odataName } = prop;\r\n const name = this.namingHelper.getQPropName(prop.name);\r\n const isModelType = prop.dataType === DataTypes.ModelType || prop.dataType === DataTypes.ComplexType;\r\n let qPathInit: string;\r\n\r\n // factor in collections\r\n if (prop.isCollection) {\r\n const qPath = importContainer.addQObject(\r\n isModelType ? QueryObjectImports.QEntityCollectionPath : QueryObjectImports.QCollectionPath\r\n );\r\n const qObject = isModelType\r\n ? importContainer.addGeneratedQObject(prop.fqType, prop.qObject!)\r\n : importContainer.addQObject(prop.qObject!);\r\n\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\"), () => ${qObject})`;\r\n } else {\r\n // add import for data type\r\n const qPath = importContainer.addQObject(prop.qPath);\r\n if (isModelType) {\r\n const qObject = importContainer.addGeneratedQObject(prop.fqType, prop.qObject!);\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\"), () => ${qObject})`;\r\n } else {\r\n let converterStmt = this.generateConverterStmt(importContainer, prop.converters);\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\")${converterStmt ? `, ${converterStmt}` : \"\"})`;\r\n }\r\n }\r\n\r\n return {\r\n name,\r\n scope: Scope.Public,\r\n isReadonly: true,\r\n initializer: qPathInit,\r\n } as OptionalKind<PropertyDeclarationStructure>;\r\n });\r\n }\r\n\r\n private generateConverterStmt(importContainer: ImportContainer, converters: Array<ValueConverterImport> | undefined) {\r\n if (!converters?.length) {\r\n return undefined;\r\n }\r\n const converterIds = converters.map((converter) => {\r\n return importContainer.addCustomType(converter.package, converter.converterId);\r\n });\r\n\r\n if (converterIds.length === 1) {\r\n return converterIds[0];\r\n } else {\r\n const createChain = importContainer.addCustomType(\"@odata2ts/converter-runtime\", \"createChain\");\r\n\r\n const [first, second, ...moreConverters] = converterIds;\r\n return moreConverters.reduce((stmt, convId) => `${stmt}.chain(${convId})`, `${createChain}(${first}, ${second})`);\r\n }\r\n }\r\n\r\n private generateIdFunction(file: FileHandler, model: EntityType) {\r\n const importContainer = file.getImports();\r\n const qFunc = importContainer.addQObject(QueryObjectImports.QId);\r\n const idModelName = importContainer.addGeneratedModel(model.fqName, model.id.modelName);\r\n\r\n file.getFile().addClass({\r\n name: model.id.qName,\r\n isExported: true,\r\n extends: `${qFunc}<${idModelName}>`,\r\n properties: [\r\n {\r\n name: \"params\",\r\n scope: Scope.Private,\r\n isReadonly: true,\r\n initializer: this.getParamInitString(importContainer, model.keys),\r\n },\r\n ],\r\n methods: [\r\n {\r\n name: \"getParams\",\r\n statements: [\"return this.params\"],\r\n },\r\n ],\r\n });\r\n }\r\n\r\n private getParamInitString(\r\n importContainer: ImportContainer,\r\n props: Array<PropertyModel>,\r\n overloads?: Array<Array<PropertyModel>>\r\n ) {\r\n const allParams = [props, ...(overloads ?? [])].map((paramSet) => {\r\n const pString = paramSet\r\n .map((prop) => {\r\n let complexQParam = \"\";\r\n if (prop.dataType === DataTypes.ModelType || prop.dataType === DataTypes.ComplexType) {\r\n const importedQObject = importContainer.addGeneratedQObject(prop.fqType, prop.qObject!);\r\n complexQParam = `, new ${importedQObject}()`;\r\n }\r\n\r\n const qParam = importContainer.addQObject(prop.qParam!);\r\n const isMappedNameNecessary = prop.odataName !== prop.name;\r\n const mappedName = isMappedNameNecessary\r\n ? `\"${prop.name}\"`\r\n : prop.converters?.length\r\n ? \"undefined\"\r\n : undefined;\r\n const converterStmt = this.generateConverterStmt(importContainer, prop.converters);\r\n const mappedNameParam = mappedName ? `, ${mappedName}` : \"\";\r\n const converterParam = converterStmt ? `, ${converterStmt}` : \"\";\r\n return `new ${qParam}(\"${prop.odataName}\"${complexQParam}${mappedNameParam}${converterParam})`;\r\n })\r\n .join(\",\");\r\n return `[${pString}]`;\r\n });\r\n\r\n return allParams.length === 1 ? allParams[0] : `[${allParams.join(\",\")}]`;\r\n }\r\n\r\n private async generateUnboundOperations() {\r\n const unboundOps = this.dataModel.getUnboundOperationTypes();\r\n const reservedNames = unboundOps.map((op) => op.qName);\r\n const file = this.project.createOrGetMainQObjectFile(reservedNames);\r\n\r\n unboundOps.forEach((operation) => {\r\n this.generateOperation(file, operation, \"\");\r\n });\r\n }\r\n\r\n private generateOperation(file: FileHandler, operation: OperationType, baseFqName: string) {\r\n const imports = file.getImports();\r\n const isV2 = this.version === ODataVersions.V2;\r\n const returnType = operation.returnType;\r\n const hasParams = operation.parameters.length > 0 || operation.overrides?.length;\r\n const isParamsOptional = !![operation.parameters, ...(operation.overrides ?? [])].find((pSet) => pSet.length === 0);\r\n\r\n // imports\r\n const qOp = operation.type === OperationTypes.Action ? QueryObjectImports.QAction : QueryObjectImports.QFunction;\r\n const qOperation = imports.addQObject(qOp);\r\n const paramModelName = hasParams ? imports.addGeneratedModel(baseFqName, operation.paramsModelName) : undefined;\r\n\r\n let returnTypeOpStmt: string = \"\";\r\n if (returnType) {\r\n const collectionSuffix = returnType.isCollection ? \"_COLLECTION\" : \"\";\r\n if (returnType.dataType === DataTypes.ComplexType || returnType.dataType === DataTypes.ModelType) {\r\n if (returnType.qObject) {\r\n const opRt = imports.addQObject(QueryObjectImports.OperationReturnType);\r\n const rts = imports.addQObject(QueryObjectImports.ReturnTypes);\r\n const qComplexParam = imports.addQObject(QueryObjectImports.QComplexParam);\r\n const returnQName = imports.addGeneratedQObject(returnType.fqType, returnType.qObject);\r\n\r\n returnTypeOpStmt = `new ${opRt}(${rts}.COMPLEX${collectionSuffix}, new ${qComplexParam}(\"NONE\", new ${returnQName}))`;\r\n }\r\n }\r\n // currently, it only makes sense to add the OperationReturnType if a converter is present\r\n else if (returnType.converters && returnType.qParam) {\r\n const rtClass = imports.addQObject(QueryObjectImports.OperationReturnType);\r\n const rtTypes = imports.addQObject(QueryObjectImports.ReturnTypes);\r\n const qParam = imports.addQObject(returnType.qParam);\r\n\r\n // TODO: some constants with string concat\r\n const rtKind = `${rtTypes}.VALUE${collectionSuffix}`;\r\n\r\n const converterParam = returnType.converters\r\n ? \", \" + this.generateConverterStmt(imports, returnType.converters)\r\n : \"\";\r\n returnTypeOpStmt = `new ${rtClass}(${rtKind}, new ${qParam}(\"NONE\", undefined${converterParam}))`;\r\n }\r\n }\r\n\r\n file.getFile().addClass({\r\n name: operation.qName,\r\n isExported: true,\r\n extends: qOperation + (hasParams ? `<${paramModelName}>` : \"\"),\r\n properties: [\r\n {\r\n name: \"params\",\r\n scope: Scope.Private,\r\n isReadonly: true,\r\n type: hasParams ? undefined : \"[]\",\r\n initializer: this.getParamInitString(imports, operation.parameters, operation.overrides),\r\n },\r\n ],\r\n ctors: [\r\n {\r\n statements: [\r\n `super(\"${operation.odataName}\"${returnTypeOpStmt ? \", \" + returnTypeOpStmt : isV2 ? \", undefined\" : \"\"}${\r\n isV2 ? \", { v2Mode: true }\" : \"\"\r\n })`,\r\n ],\r\n },\r\n ],\r\n methods: [\r\n {\r\n name: \"getParams\",\r\n statements: [\"return this.params\"],\r\n },\r\n // functions without params: add an overriding buildUrl() to not force users to have to pass undefined as param\r\n ...(operation.type === OperationTypes.Function && !hasParams\r\n ? [\r\n {\r\n name: \"buildUrl\",\r\n statements: [\"return super.buildUrl(undefined)\"],\r\n },\r\n ]\r\n : []),\r\n ],\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"QueryObjectGenerator.js","sourceRoot":"","sources":["../../src/generator/QueryObjectGenerator.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAA8C,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAc9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,MAAM,CAAC,MAAM,oBAAoB,GAAiC,CAChE,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,EAAE;IACF,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,oBAAoB;IACxB,YACU,OAAuB,EACvB,SAAoB,EACpB,OAAsB,EACtB,OAAiC,EACjC,YAA0B;QAJ1B,YAAO,GAAP,OAAO,CAAgB;QACvB,cAAS,GAAT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AAC;iBACnC;gBACD,+GAA+G;gBAC/G,GAAG,CAAC,SAAS,CAAC,IAAI,6CAA4B,IAAI,CAAC,SAAS;oBAC1D,CAAC,CAAC;wBACE;4BACE,IAAI,EAAE,UAAU;4BAChB,UAAU,EAAE,CAAC,kCAAkC,CAAC;yBACjD;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ValueConverterImport } from \"@odata2ts/converter-runtime\";\r\nimport { ODataVersions } from \"@odata2ts/odata-core\";\r\nimport { OptionalKind, PropertyDeclarationStructure, Scope, VariableDeclarationKind } from \"ts-morph\";\r\nimport { firstCharLowerCase } from \"xml2js/lib/processors.js\";\r\nimport { DataModel } from \"../data-model/DataModel.js\";\r\nimport {\r\n ComplexType,\r\n DataTypes,\r\n EntityType,\r\n OperationType,\r\n OperationTypes,\r\n PropertyModel,\r\n} from \"../data-model/DataTypeModel.js\";\r\nimport { NamingHelper } from \"../data-model/NamingHelper.js\";\r\nimport { EntityBasedGeneratorFunction, GeneratorFunctionOptions } from \"../FactoryFunctionModel.js\";\r\nimport { FileHandler } from \"../project/FileHandler.js\";\r\nimport { ProjectManager } from \"../project/ProjectManager.js\";\r\nimport { QueryObjectImports } from \"./import/ImportObjects.js\";\r\nimport { ImportContainer } from \"./ImportContainer.js\";\r\n\r\nexport const generateQueryObjects: EntityBasedGeneratorFunction = (\r\n project,\r\n dataModel,\r\n version,\r\n options,\r\n namingHelper,\r\n) => {\r\n const generator = new QueryObjectGenerator(project, dataModel, version, options, namingHelper);\r\n return generator.generate();\r\n};\r\n\r\nclass QueryObjectGenerator {\r\n constructor(\r\n private project: ProjectManager,\r\n private dataModel: DataModel,\r\n private version: ODataVersions,\r\n private options: GeneratorFunctionOptions,\r\n private namingHelper: NamingHelper,\r\n ) {}\r\n\r\n public async generate(): Promise<void> {\r\n this.project.initQObjects();\r\n\r\n // process EntityType & ComplexType\r\n const promises: Array<Promise<void>> = [...this.generateEntityTypes(), ...this.generateComplexTypes()];\r\n if (!this.options.skipOperations) {\r\n // process unbound operations\r\n promises.push(this.generateUnboundOperations());\r\n }\r\n\r\n await Promise.all(promises);\r\n\r\n return this.project.finalizeQObjects();\r\n }\r\n\r\n private generateEntityTypes() {\r\n return this.dataModel.getEntityTypes().map((model) => {\r\n const file = this.project.createOrGetQObjectFile(model.folderPath, model.qName, [\r\n model.qName,\r\n firstCharLowerCase(model.qName),\r\n model.id.qName,\r\n ]);\r\n\r\n // q object\r\n this.generateModel(file, model);\r\n\r\n // qId function\r\n if (!this.options.skipIdModels && model.generateId) {\r\n this.generateIdFunction(file, model);\r\n }\r\n\r\n // bound q operations\r\n if (!this.options.skipOperations) {\r\n [\r\n ...this.dataModel.getEntityTypeOperations(model.fqName),\r\n ...this.dataModel.getEntitySetOperations(model.fqName),\r\n ].forEach((operation) => {\r\n this.generateOperation(file, operation, model.fqName);\r\n });\r\n }\r\n\r\n return this.project.finalizeFile(file);\r\n });\r\n }\r\n\r\n private generateComplexTypes() {\r\n return this.dataModel.getComplexTypes().map((model) => {\r\n const file = this.project.createOrGetQObjectFile(model.folderPath, model.qName, [\r\n model.qName,\r\n firstCharLowerCase(model.qName),\r\n ]);\r\n\r\n this.generateModel(file, model);\r\n\r\n return this.project.finalizeFile(file);\r\n });\r\n }\r\n\r\n private generateModel(file: FileHandler, model: ComplexType) {\r\n const imports = file.getImports();\r\n\r\n let extendsClause: string;\r\n if (model.baseClasses.length) {\r\n const baseClass = model.baseClasses[0];\r\n const baseModel = this.dataModel.getModel(baseClass) as ComplexType;\r\n if (!baseModel) {\r\n throw new Error(`Entity or complex type \"${baseClass}\" from baseClass attribute not found!`);\r\n }\r\n extendsClause = imports.addGeneratedQObject(baseClass, baseModel.qName);\r\n } else {\r\n extendsClause = imports.addQObject(QueryObjectImports.QueryObject);\r\n }\r\n\r\n file.getFile().addClass({\r\n name: model.qName,\r\n isExported: true,\r\n extends: extendsClause,\r\n // isAbstract: model.abstract,\r\n properties: this.generateQueryObjectProps(file.getImports(), model.props),\r\n });\r\n\r\n file.getFile().addVariableStatement({\r\n declarationKind: VariableDeclarationKind.Const,\r\n isExported: true,\r\n declarations: [\r\n {\r\n name: firstCharLowerCase(model.qName),\r\n initializer: `new ${model.qName}()`,\r\n },\r\n ],\r\n });\r\n }\r\n\r\n private generateQueryObjectProps(\r\n importContainer: ImportContainer,\r\n props: Array<PropertyModel>,\r\n ): Array<OptionalKind<PropertyDeclarationStructure>> {\r\n return props.map((prop) => {\r\n const { odataName } = prop;\r\n const name = this.namingHelper.getQPropName(prop.name);\r\n const isModelType = prop.dataType === DataTypes.ModelType || prop.dataType === DataTypes.ComplexType;\r\n const isEnumType = prop.dataType === DataTypes.EnumType;\r\n const isNumericEnum = this.options.numericEnums;\r\n\r\n let qPathInit: string;\r\n\r\n // factor in collections\r\n if (prop.isCollection) {\r\n const qPath = importContainer.addQObject(\r\n isModelType\r\n ? QueryObjectImports.QEntityCollectionPath\r\n : isEnumType\r\n ? isNumericEnum\r\n ? QueryObjectImports.QNumericEnumCollectionPath\r\n : QueryObjectImports.QEnumCollectionPath\r\n : QueryObjectImports.QCollectionPath,\r\n );\r\n const qObject = isModelType\r\n ? importContainer.addGeneratedQObject(prop.fqType, prop.qObject!)\r\n : isEnumType\r\n ? importContainer.addGeneratedModel(prop.fqType, prop.type, false)\r\n : importContainer.addQObject(prop.qObject!);\r\n\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\"), ${isEnumType ? qObject : `() => ${qObject}`})`;\r\n } else {\r\n // add import for data type\r\n const qPath = importContainer.addQObject(prop.qPath);\r\n if (isModelType) {\r\n const qObject = importContainer.addGeneratedQObject(prop.fqType, prop.qObject!);\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\"), () => ${qObject})`;\r\n } else if (isEnumType) {\r\n const qObject = importContainer.addGeneratedModel(prop.fqType, prop.type, false);\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\"), ${qObject})`;\r\n } else {\r\n let converterStmt = this.generateConverterStmt(importContainer, prop.converters);\r\n qPathInit = `new ${qPath}(this.withPrefix(\"${odataName}\")${converterStmt ? `, ${converterStmt}` : \"\"})`;\r\n }\r\n }\r\n\r\n return {\r\n name,\r\n scope: Scope.Public,\r\n isReadonly: true,\r\n initializer: qPathInit,\r\n } as OptionalKind<PropertyDeclarationStructure>;\r\n });\r\n }\r\n\r\n private generateConverterStmt(importContainer: ImportContainer, converters: Array<ValueConverterImport> | undefined) {\r\n if (!converters?.length) {\r\n return undefined;\r\n }\r\n const converterIds = converters.map((converter) => {\r\n return importContainer.addCustomType(converter.package, converter.converterId);\r\n });\r\n\r\n if (converterIds.length === 1) {\r\n return converterIds[0];\r\n } else {\r\n const createChain = importContainer.addCustomType(\"@odata2ts/converter-runtime\", \"createChain\");\r\n\r\n const [first, second, ...moreConverters] = converterIds;\r\n return moreConverters.reduce((stmt, convId) => `${stmt}.chain(${convId})`, `${createChain}(${first}, ${second})`);\r\n }\r\n }\r\n\r\n private generateIdFunction(file: FileHandler, model: EntityType) {\r\n const importContainer = file.getImports();\r\n const qFunc = importContainer.addQObject(QueryObjectImports.QId);\r\n const idModelName = importContainer.addGeneratedModel(model.fqName, model.id.modelName);\r\n\r\n file.getFile().addClass({\r\n name: model.id.qName,\r\n isExported: true,\r\n extends: `${qFunc}<${idModelName}>`,\r\n properties: [\r\n {\r\n name: \"params\",\r\n scope: Scope.Private,\r\n isReadonly: true,\r\n initializer: this.getParamInitString(importContainer, model.keys),\r\n },\r\n ],\r\n methods: [\r\n {\r\n name: \"getParams\",\r\n statements: [\"return this.params\"],\r\n },\r\n ],\r\n });\r\n }\r\n\r\n private getParamInitString(\r\n importContainer: ImportContainer,\r\n props: Array<PropertyModel>,\r\n overloads?: Array<Array<PropertyModel>>,\r\n ) {\r\n const allParams = [props, ...(overloads ?? [])].map((paramSet) => {\r\n const pString = paramSet\r\n .map((prop) => {\r\n let complexQParam = \"\";\r\n if (prop.dataType === DataTypes.ModelType || prop.dataType === DataTypes.ComplexType) {\r\n const importedQObject = importContainer.addGeneratedQObject(prop.fqType, prop.qObject!);\r\n complexQParam = `, new ${importedQObject}()`;\r\n }\r\n\r\n const qParam = importContainer.addQObject(prop.qParam!);\r\n const isMappedNameNecessary = prop.odataName !== prop.name;\r\n const mappedName = isMappedNameNecessary\r\n ? `\"${prop.name}\"`\r\n : prop.converters?.length\r\n ? \"undefined\"\r\n : undefined;\r\n const converterStmt = this.generateConverterStmt(importContainer, prop.converters);\r\n const mappedNameParam = mappedName ? `, ${mappedName}` : \"\";\r\n const converterParam = converterStmt ? `, ${converterStmt}` : \"\";\r\n return `new ${qParam}(\"${prop.odataName}\"${complexQParam}${mappedNameParam}${converterParam})`;\r\n })\r\n .join(\",\");\r\n return `[${pString}]`;\r\n });\r\n\r\n return allParams.length === 1 ? allParams[0] : `[${allParams.join(\",\")}]`;\r\n }\r\n\r\n private async generateUnboundOperations() {\r\n const unboundOps = this.dataModel.getUnboundOperationTypes();\r\n const reservedNames = unboundOps.map((op) => op.qName);\r\n const file = this.project.createOrGetMainQObjectFile(reservedNames);\r\n\r\n unboundOps.forEach((operation) => {\r\n this.generateOperation(file, operation, \"\");\r\n });\r\n }\r\n\r\n private generateOperation(file: FileHandler, operation: OperationType, baseFqName: string) {\r\n const imports = file.getImports();\r\n const isV2 = this.version === ODataVersions.V2;\r\n const returnType = operation.returnType;\r\n const hasParams = operation.parameters.length > 0 || operation.overrides?.length;\r\n const isParamsOptional = !![operation.parameters, ...(operation.overrides ?? [])].find((pSet) => pSet.length === 0);\r\n\r\n // imports\r\n const qOp = operation.type === OperationTypes.Action ? QueryObjectImports.QAction : QueryObjectImports.QFunction;\r\n const qOperation = imports.addQObject(qOp);\r\n const paramModelName = hasParams ? imports.addGeneratedModel(baseFqName, operation.paramsModelName) : undefined;\r\n\r\n let returnTypeOpStmt: string = \"\";\r\n if (returnType) {\r\n const collectionSuffix = returnType.isCollection ? \"_COLLECTION\" : \"\";\r\n if (returnType.dataType === DataTypes.ComplexType || returnType.dataType === DataTypes.ModelType) {\r\n if (returnType.qObject) {\r\n const opRt = imports.addQObject(QueryObjectImports.OperationReturnType);\r\n const rts = imports.addQObject(QueryObjectImports.ReturnTypes);\r\n const qComplexParam = imports.addQObject(QueryObjectImports.QComplexParam);\r\n const returnQName = imports.addGeneratedQObject(returnType.fqType, returnType.qObject);\r\n\r\n returnTypeOpStmt = `new ${opRt}(${rts}.COMPLEX${collectionSuffix}, new ${qComplexParam}(\"NONE\", new ${returnQName}))`;\r\n }\r\n }\r\n // currently, it only makes sense to add the OperationReturnType if a converter is present\r\n else if (returnType.converters && returnType.qParam) {\r\n const rtClass = imports.addQObject(QueryObjectImports.OperationReturnType);\r\n const rtTypes = imports.addQObject(QueryObjectImports.ReturnTypes);\r\n const qParam = imports.addQObject(returnType.qParam);\r\n\r\n // TODO: some constants with string concat\r\n const rtKind = `${rtTypes}.VALUE${collectionSuffix}`;\r\n\r\n const converterParam = returnType.converters\r\n ? \", \" + this.generateConverterStmt(imports, returnType.converters)\r\n : \"\";\r\n returnTypeOpStmt = `new ${rtClass}(${rtKind}, new ${qParam}(\"NONE\", undefined${converterParam}))`;\r\n }\r\n }\r\n\r\n file.getFile().addClass({\r\n name: operation.qName,\r\n isExported: true,\r\n extends: qOperation + (hasParams ? `<${paramModelName}>` : \"\"),\r\n properties: [\r\n {\r\n name: \"params\",\r\n scope: Scope.Private,\r\n isReadonly: true,\r\n type: hasParams ? undefined : \"[]\",\r\n initializer: this.getParamInitString(imports, operation.parameters, operation.overrides),\r\n },\r\n ],\r\n ctors: [\r\n {\r\n statements: [\r\n `super(\"${operation.odataName}\"${returnTypeOpStmt ? \", \" + returnTypeOpStmt : isV2 ? \", undefined\" : \"\"}${\r\n isV2 ? \", { v2Mode: true }\" : \"\"\r\n })`,\r\n ],\r\n },\r\n ],\r\n methods: [\r\n {\r\n name: \"getParams\",\r\n statements: [\"return this.params\"],\r\n },\r\n // functions without params: add an overriding buildUrl() to not force users to have to pass undefined as param\r\n ...(operation.type === OperationTypes.Function && !hasParams\r\n ? [\r\n {\r\n name: \"buildUrl\",\r\n statements: [\"return super.buildUrl(undefined)\"],\r\n },\r\n ]\r\n : []),\r\n ],\r\n });\r\n }\r\n}\r\n"]}
@@ -1,11 +1,11 @@
1
1
  import { ODataVersions } from "@odata2ts/odata-core";
2
2
  import { ClassDeclarationStructure } from "ts-morph";
3
- import { DataModel } from "../data-model/DataModel";
4
- import { NamingHelper } from "../data-model/NamingHelper";
5
- import { ConfigFileOptions } from "../OptionModel";
6
- import { ProjectManager } from "../project/ProjectManager";
3
+ import { DataModel } from "../data-model/DataModel.js";
4
+ import { NamingHelper } from "../data-model/NamingHelper.js";
5
+ import { ConfigFileOptions } from "../OptionModel.js";
6
+ import { ProjectManager } from "../project/ProjectManager.js";
7
7
  export interface PropsAndOps extends Required<Pick<ClassDeclarationStructure, "properties" | "methods">> {
8
8
  }
9
- export interface ServiceGeneratorOptions extends Pick<ConfigFileOptions, "enablePrimitivePropertyServices" | "v4BigNumberAsString"> {
9
+ export interface ServiceGeneratorOptions extends Pick<ConfigFileOptions, "enablePrimitivePropertyServices" | "v4BigNumberAsString" | "numericEnums"> {
10
10
  }
11
11
  export declare function generateServices(project: ProjectManager, dataModel: DataModel, version: ODataVersions, namingHelper: NamingHelper, options?: ServiceGeneratorOptions): Promise<void>;
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateServices = void 0;
4
- const tslib_1 = require("tslib");
5
- const odata_core_1 = require("@odata2ts/odata-core");
6
- const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
7
- const ts_morph_1 = require("ts-morph");
8
- const upper_case_first_1 = require("upper-case-first");
9
- const processors_1 = require("xml2js/lib/processors");
10
- const OptionModel_1 = require("../OptionModel");
11
- const ImportObjects_1 = require("./import/ImportObjects");
12
- function generateServices(project, dataModel, version, namingHelper, options) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
1
+ import { __awaiter } from "tslib";
2
+ import { ODataVersions } from "@odata2ts/odata-core";
3
+ import deepmerge from "deepmerge";
4
+ import { Scope, } from "ts-morph";
5
+ import { upperCaseFirst } from "upper-case-first";
6
+ import { firstCharLowerCase } from "xml2js/lib/processors.js";
7
+ import { Modes } from "../OptionModel.js";
8
+ import { ClientApiImports, CoreImports, QueryObjectImports, ServiceImports } from "./import/ImportObjects.js";
9
+ export function generateServices(project, dataModel, version, namingHelper, options) {
10
+ return __awaiter(this, void 0, void 0, function* () {
14
11
  const generator = new ServiceGenerator(project, dataModel, version, namingHelper, options);
15
12
  return generator.generate();
16
13
  });
17
14
  }
18
- exports.generateServices = generateServices;
19
15
  class ServiceGenerator {
20
16
  constructor(project, dataModel, version, namingHelper, options = {}) {
21
17
  this.project = project;
@@ -25,7 +21,7 @@ class ServiceGenerator {
25
21
  this.options = options;
26
22
  this.generateQOperationProp = (operation) => {
27
23
  return {
28
- scope: ts_morph_1.Scope.Private,
24
+ scope: Scope.Private,
29
25
  name: this.namingHelper.getPrivatePropName(operation.qName),
30
26
  type: operation.qName,
31
27
  hasQuestionToken: true,
@@ -33,10 +29,10 @@ class ServiceGenerator {
33
29
  };
34
30
  }
35
31
  isV4BigNumber() {
36
- return this.options.v4BigNumberAsString && this.version === odata_core_1.ODataVersions.V4;
32
+ return this.options.v4BigNumberAsString && this.version === ODataVersions.V4;
37
33
  }
38
34
  generate() {
39
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ return __awaiter(this, void 0, void 0, function* () {
40
36
  const mainServiceName = this.namingHelper.getMainServiceName();
41
37
  this.project.initServices();
42
38
  yield Promise.all([
@@ -48,14 +44,14 @@ class ServiceGenerator {
48
44
  });
49
45
  }
50
46
  generateMainService(mainServiceName) {
51
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ return __awaiter(this, void 0, void 0, function* () {
52
48
  const mainServiceFile = this.project.getMainServiceFile();
53
49
  const importContainer = mainServiceFile.getImports();
54
50
  const container = this.dataModel.getEntityContainer();
55
51
  const unboundOperations = [...Object.values(container.functions), ...Object.values(container.actions)];
56
- const httpClient = importContainer.addClientApi(ImportObjects_1.ClientApiImports.ODataHttpClient);
57
- const rootService = importContainer.addServiceObject(this.version, ImportObjects_1.ServiceImports.ODataService);
58
- const { properties, methods } = (0, deepmerge_1.default)(this.generateMainServiceProperties(container, importContainer), this.generateMainServiceOperations(unboundOperations, importContainer));
52
+ const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);
53
+ const rootService = importContainer.addServiceObject(this.version, ServiceImports.ODataService);
54
+ const { properties, methods } = deepmerge(this.generateMainServiceProperties(container, importContainer), this.generateMainServiceOperations(unboundOperations, importContainer));
59
55
  mainServiceFile.getFile().addClass({
60
56
  isExported: true,
61
57
  name: mainServiceName,
@@ -106,7 +102,7 @@ class ServiceGenerator {
106
102
  const serviceName = imports.addGeneratedService(entityType.fqName, entityType.serviceName);
107
103
  const collectionName = imports.addGeneratedService(entityType.fqName, entityType.serviceCollectionName);
108
104
  return {
109
- scope: ts_morph_1.Scope.Public,
105
+ scope: Scope.Public,
110
106
  name: this.namingHelper.getRelatedServiceGetter(propName),
111
107
  parameters: [
112
108
  {
@@ -143,7 +139,7 @@ class ServiceGenerator {
143
139
  const { name, entityType } = singleton;
144
140
  const type = entityType.serviceName;
145
141
  return {
146
- scope: ts_morph_1.Scope.Private,
142
+ scope: Scope.Private,
147
143
  name: this.namingHelper.getPrivatePropName(name),
148
144
  type: `${type}<ClientType>`,
149
145
  hasQuestionToken: true,
@@ -154,7 +150,7 @@ class ServiceGenerator {
154
150
  const propName = "this." + this.namingHelper.getPrivatePropName(name);
155
151
  const serviceType = entityType.serviceName;
156
152
  return {
157
- scope: ts_morph_1.Scope.Public,
153
+ scope: Scope.Public,
158
154
  name: this.namingHelper.getRelatedServiceGetter(name),
159
155
  statements: [
160
156
  `if(!${propName}) {`,
@@ -170,14 +166,14 @@ class ServiceGenerator {
170
166
  const importContainer = file.getImports();
171
167
  const operations = this.dataModel.getEntityTypeOperations(model.fqName);
172
168
  const props = [...model.baseProps, ...model.props];
173
- const entityServiceType = importContainer.addServiceObject(this.version, ImportObjects_1.ServiceImports.EntityTypeService);
174
- const httpClient = importContainer.addClientApi(ImportObjects_1.ClientApiImports.ODataHttpClient);
169
+ const entityServiceType = importContainer.addServiceObject(this.version, ServiceImports.EntityTypeService);
170
+ const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);
175
171
  // note: predictable first imports => no need to take renaming into account
176
172
  const modelName = importContainer.addGeneratedModel(model.fqName, model.modelName);
177
173
  const editableModelName = importContainer.addGeneratedModel(model.fqName, model.editableName);
178
174
  const qName = importContainer.addGeneratedQObject(model.fqName, model.qName, true);
179
- const qObjectName = importContainer.addGeneratedQObject(model.fqName, (0, processors_1.firstCharLowerCase)(model.qName));
180
- const { properties, methods } = (0, deepmerge_1.default)(this.generateServiceProperties(importContainer, model.serviceName, props), this.generateServiceOperations(importContainer, model, operations));
175
+ const qObjectName = importContainer.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName));
176
+ const { properties, methods } = deepmerge(this.generateServiceProperties(importContainer, model.serviceName, props), this.generateServiceOperations(importContainer, model, operations));
181
177
  // generate EntityTypeService
182
178
  file.getFile().addClass({
183
179
  isExported: true,
@@ -201,13 +197,13 @@ class ServiceGenerator {
201
197
  generateServiceProperties(importContainer, serviceName, props) {
202
198
  const result = { properties: [], methods: [] };
203
199
  props.forEach((prop) => {
204
- // complex types, collection of complex types or entityTypes
200
+ // collection of ComplexTypes, ComplexTypes, or EntityTypes
205
201
  if ((prop.dataType === "ModelType" /* DataTypes.ModelType */ && !prop.isCollection) || prop.dataType === "ComplexType" /* DataTypes.ComplexType */) {
206
202
  result.properties.push(this.generateModelProp(importContainer, prop));
207
203
  result.methods.push(this.generateModelPropGetter(importContainer, prop));
208
204
  }
209
205
  else if (prop.isCollection) {
210
- // collection of entity types
206
+ // collection of EntityTypes
211
207
  if (prop.dataType === "ModelType" /* DataTypes.ModelType */) {
212
208
  const entityType = this.dataModel.getEntityType(prop.fqType);
213
209
  if (!entityType) {
@@ -244,7 +240,7 @@ class ServiceGenerator {
244
240
  const modelName = imports.addGeneratedModel(propModel.fqName, propModel.modelName);
245
241
  const editableModelName = imports.addGeneratedModel(propModel.fqName, propModel.editableName);
246
242
  const qModelName = imports.addGeneratedQObject(propModel.fqName, propModel.qName, true);
247
- const collectionServiceType = imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.CollectionService);
243
+ const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);
248
244
  propModelType = `${collectionServiceType}<ClientType, ${modelName}, ${qModelName}, ${editableModelName}>`;
249
245
  }
250
246
  else {
@@ -252,7 +248,7 @@ class ServiceGenerator {
252
248
  propModelType = `${serviceName}<ClientType>`;
253
249
  }
254
250
  return {
255
- scope: ts_morph_1.Scope.Private,
251
+ scope: Scope.Private,
256
252
  name: this.namingHelper.getPrivatePropName(prop.name),
257
253
  type: propModelType,
258
254
  hasQuestionToken: true,
@@ -262,34 +258,35 @@ class ServiceGenerator {
262
258
  if (!prop.qObject) {
263
259
  throw new Error("Illegal State: [qObject] must be provided for Collection types!");
264
260
  }
265
- const collectionServiceType = imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.CollectionService);
261
+ const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);
266
262
  const isEnum = prop.dataType === "EnumType" /* DataTypes.EnumType */;
263
+ const isNumericEnum = this.options.numericEnums;
267
264
  let qType;
268
265
  let type;
269
- if (!isEnum) {
270
- // TODO refactor string concat
271
- type = imports.addQObjectType(`${(0, upper_case_first_1.upperCaseFirst)(prop.type)}Collection`);
272
- qType = imports.addQObjectType(prop.qObject);
266
+ if (isEnum) {
267
+ const propEnum = this.dataModel.getModel(prop.fqType);
268
+ const propTypeModel = imports.addGeneratedModel(propEnum.fqName, propEnum.modelName, false);
269
+ type = `${imports.addQObjectType(QueryObjectImports.EnumCollection)}<typeof ${propTypeModel}>`;
270
+ qType = `${imports.addQObjectType(isNumericEnum ? QueryObjectImports.QNumericEnumCollection : QueryObjectImports.QEnumCollection)}<typeof ${propTypeModel}>`;
273
271
  }
274
272
  else {
275
- const propEnum = this.dataModel.getModel(prop.fqType);
276
- const propTypeModel = imports.addGeneratedModel(propEnum.fqName, propEnum.modelName);
277
- type = `${imports.addQObjectType(ImportObjects_1.QueryObjectImports.EnumCollection)}<${propTypeModel}>`;
278
- qType = imports.addQObjectType(ImportObjects_1.QueryObjectImports.QEnumCollection);
273
+ // TODO refactor string concat
274
+ type = imports.addQObjectType(`${upperCaseFirst(prop.type)}Collection`);
275
+ qType = imports.addQObjectType(prop.qObject);
279
276
  }
280
277
  const collectionType = `${collectionServiceType}<ClientType, ${type}, ${qType}>`;
281
278
  return {
282
- scope: ts_morph_1.Scope.Private,
279
+ scope: Scope.Private,
283
280
  name: this.namingHelper.getPrivatePropName(prop.name),
284
281
  type: `${collectionType}`,
285
282
  hasQuestionToken: true,
286
283
  };
287
284
  }
288
285
  generatePrimitiveTypeProp(imports, prop) {
289
- const serviceType = imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.PrimitiveTypeService);
286
+ const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);
290
287
  const type = prop.typeModule ? imports.addCustomType(prop.typeModule, prop.type, true) : prop.type;
291
288
  return {
292
- scope: ts_morph_1.Scope.Private,
289
+ scope: Scope.Private,
293
290
  name: this.namingHelper.getPrivatePropName(prop.name),
294
291
  type: `${serviceType}<ClientType, ${type}>`,
295
292
  hasQuestionToken: true,
@@ -299,7 +296,7 @@ class ServiceGenerator {
299
296
  const model = this.dataModel.getModel(prop.fqType);
300
297
  const isComplexCollection = prop.isCollection && model.dataType === "ComplexType" /* DataTypes.ComplexType */;
301
298
  const type = isComplexCollection
302
- ? imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.CollectionService)
299
+ ? imports.addServiceObject(this.version, ServiceImports.CollectionService)
303
300
  : prop.isCollection
304
301
  ? model.serviceCollectionName
305
302
  : model.serviceName;
@@ -308,47 +305,47 @@ class ServiceGenerator {
308
305
  : `${type}<ClientType>`;
309
306
  const privateSrvProp = "this." + this.namingHelper.getPrivatePropName(prop.name);
310
307
  return {
311
- scope: ts_morph_1.Scope.Public,
308
+ scope: Scope.Public,
312
309
  name: this.namingHelper.getRelatedServiceGetter(prop.name),
313
310
  returnType: typeWithGenerics,
314
311
  statements: [
315
312
  `if(!${privateSrvProp}) {`,
316
313
  ` const { client, path } = this.__base;`,
317
314
  // prettier-ignore
318
- ` ${privateSrvProp} = new ${type}(client, path, "${prop.odataName}"${isComplexCollection ? `, ${imports.addGeneratedQObject(model.fqName, (0, processors_1.firstCharLowerCase)(model.qName))}` : ""})`,
315
+ ` ${privateSrvProp} = new ${type}(client, path, "${prop.odataName}"${isComplexCollection ? `, ${imports.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName))}` : ""})`,
319
316
  "}",
320
317
  `return ${privateSrvProp}`,
321
318
  ],
322
319
  };
323
320
  }
324
321
  generatePrimitiveCollectionGetter(imports, prop) {
325
- const collectionServiceType = imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.CollectionService);
326
- const instanceName = (0, processors_1.firstCharLowerCase)(prop.qObject);
327
- const qInstanceName = imports.addQObject(instanceName);
322
+ const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);
323
+ const qCollectionName = imports.addQObject(prop.qObject);
324
+ const enumName = prop.dataType === "EnumType" /* DataTypes.EnumType */ ? imports.addGeneratedModel(prop.fqType, prop.type) : undefined;
328
325
  const propName = "this." + this.namingHelper.getPrivatePropName(prop.name);
329
326
  return {
330
- scope: ts_morph_1.Scope.Public,
327
+ scope: Scope.Public,
331
328
  name: this.namingHelper.getRelatedServiceGetter(prop.name),
332
329
  statements: [
333
330
  `if(!${propName}) {`,
334
331
  ` const { client, path } = this.__base;`,
335
332
  // prettier-ignore
336
- ` ${propName} = new ${collectionServiceType}(client, path, "${prop.odataName}", ${qInstanceName}${this.isV4BigNumber() ? ", true" : ""})`,
333
+ ` ${propName} = new ${collectionServiceType}(client, path, "${prop.odataName}", new ${qCollectionName}(${enumName !== null && enumName !== void 0 ? enumName : ""})${this.isV4BigNumber() ? ", true" : ""})`,
337
334
  "}",
338
335
  `return ${propName}`,
339
336
  ],
340
337
  };
341
338
  }
342
339
  generatePrimitiveTypeGetter(imports, prop) {
343
- const serviceType = imports.addServiceObject(this.version, ImportObjects_1.ServiceImports.PrimitiveTypeService);
340
+ const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);
344
341
  const propName = "this." + this.namingHelper.getPrivatePropName(prop.name);
345
342
  // for V2: mapped name must be specified
346
- const useMappedName = this.version === odata_core_1.ODataVersions.V2 && prop.name !== prop.odataName;
343
+ const useMappedName = this.version === ODataVersions.V2 && prop.name !== prop.odataName;
347
344
  // for V4: big number support
348
345
  const useBigNumber = this.isV4BigNumber();
349
346
  const addParamString = useMappedName ? `, "${prop.name}"` : useBigNumber ? ", true" : "";
350
347
  return {
351
- scope: ts_morph_1.Scope.Public,
348
+ scope: Scope.Public,
352
349
  name: this.namingHelper.getRelatedServiceGetter(prop.name),
353
350
  statements: [
354
351
  `if(!${propName}) {`,
@@ -362,8 +359,8 @@ class ServiceGenerator {
362
359
  generateEntityCollectionService(file, model) {
363
360
  const importContainer = file.getImports();
364
361
  const editableModelName = model.editableName;
365
- const qObjectName = (0, processors_1.firstCharLowerCase)(model.qName);
366
- const entitySetServiceType = importContainer.addServiceObject(this.version, ImportObjects_1.ServiceImports.EntitySetService);
362
+ const qObjectName = firstCharLowerCase(model.qName);
363
+ const entitySetServiceType = importContainer.addServiceObject(this.version, ServiceImports.EntitySetService);
367
364
  const paramsModelName = importContainer.addGeneratedModel(model.id.fqName, model.id.modelName);
368
365
  const qIdFunctionName = importContainer.addGeneratedQObject(model.id.fqName, model.id.qName);
369
366
  const collectionOperations = this.dataModel.getEntitySetOperations(model.fqName);
@@ -394,7 +391,7 @@ class ServiceGenerator {
394
391
  // build service file for each entity, consisting of EntityTypeService & EntityCollectionService
395
392
  return this.dataModel
396
393
  .getEntityTypes()
397
- .filter((model) => model.genMode === OptionModel_1.Modes.service || model.genMode === OptionModel_1.Modes.all)
394
+ .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)
398
395
  .map((model) => {
399
396
  const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [
400
397
  model.serviceName,
@@ -413,7 +410,7 @@ class ServiceGenerator {
413
410
  // build service file for complex types
414
411
  return this.dataModel
415
412
  .getComplexTypes()
416
- .filter((model) => model.genMode === OptionModel_1.Modes.service || model.genMode === OptionModel_1.Modes.all)
413
+ .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)
417
414
  .map((model) => {
418
415
  const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [model.serviceName]);
419
416
  // entity type service
@@ -428,8 +425,8 @@ class ServiceGenerator {
428
425
  const hasParams = operation.parameters.length > 0 || ((_a = operation.overrides) === null || _a === void 0 ? void 0 : _a.length);
429
426
  const isParamsOptional = !![operation.parameters, ...((_b = operation.overrides) !== null && _b !== void 0 ? _b : [])].find((pSet) => pSet.length === 0);
430
427
  // importing dependencies
431
- const httpClientConfigModel = importContainer.addClientApi(ImportObjects_1.ClientApiImports.ODataHttpClientConfig);
432
- const odataResponse = importContainer.addClientApi(ImportObjects_1.ClientApiImports.HttpResponseModel);
428
+ const httpClientConfigModel = importContainer.addClientApi(ClientApiImports.ODataHttpClientConfig);
429
+ const odataResponse = importContainer.addClientApi(ClientApiImports.HttpResponseModel);
433
430
  const responseStructure = this.importReturnType(importContainer, returnType);
434
431
  const qOperationName = importContainer.addGeneratedQObject(baseFqName, operation.qName);
435
432
  const rtType = (returnType === null || returnType === void 0 ? void 0 : returnType.type) && returnType.dataType !== "PrimitiveType" /* DataTypes.PrimitiveType */
@@ -445,7 +442,7 @@ class ServiceGenerator {
445
442
  };
446
443
  const qOpProp = "this." + this.namingHelper.getPrivatePropName(operation.qName);
447
444
  return {
448
- scope: ts_morph_1.Scope.Public,
445
+ scope: Scope.Public,
449
446
  isAsync: true,
450
447
  name,
451
448
  parameters: hasParams
@@ -472,10 +469,10 @@ class ServiceGenerator {
472
469
  }
473
470
  importReturnType(imports, returnType) {
474
471
  const typeToImport = (returnType === null || returnType === void 0 ? void 0 : returnType.isCollection)
475
- ? ImportObjects_1.CoreImports.ODataCollectionResponse
472
+ ? CoreImports.ODataCollectionResponse
476
473
  : (returnType === null || returnType === void 0 ? void 0 : returnType.dataType) === "PrimitiveType" /* DataTypes.PrimitiveType */
477
- ? ImportObjects_1.CoreImports.ODataValueResponse
478
- : ImportObjects_1.CoreImports.ODataModelResponse;
474
+ ? CoreImports.ODataValueResponse
475
+ : CoreImports.ODataModelResponse;
479
476
  return imports.addCoreLib(this.version, typeToImport);
480
477
  }
481
478
  }