@odata2ts/odata2ts 0.40.1 → 0.40.2
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 +25 -0
- package/lib/FactoryFunctionModel.d.ts +2 -2
- package/lib/FactoryFunctionModel.js.map +1 -1
- package/lib/OptionModel.d.ts +8 -0
- package/lib/OptionModel.js.map +1 -1
- package/lib/data-model/DataModelDigestion.js +23 -5
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/QueryObjectTypes.d.ts +13 -0
- package/lib/data-model/QueryObjectTypes.js +15 -0
- package/lib/data-model/QueryObjectTypes.js.map +1 -0
- package/lib/defaultConfig.js +1 -0
- package/lib/defaultConfig.js.map +1 -1
- package/lib/generator/ImportContainer.d.ts +3 -0
- package/lib/generator/ImportContainer.js +11 -0
- package/lib/generator/ImportContainer.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.js +58 -38
- package/lib/generator/QueryObjectGenerator.js.map +1 -1
- package/lib/generator/ServiceGenerator.js +1 -1
- package/lib/generator/ServiceGenerator.js.map +1 -1
- package/lib/generator/import/ImportObjects.d.ts +0 -6
- package/lib/generator/import/ImportObjects.js +0 -6
- package/lib/generator/import/ImportObjects.js.map +1 -1
- package/lib/project/ProjectManager.js +2 -2
- package/lib/project/ProjectManager.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceGenerator.js","sourceRoot":"","sources":["../../src/generator/ServiceGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAKL,KAAK,GACN,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAgB9D,OAAO,EAAqB,KAAK,E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CAAC,WAAW,CAAC,oBAAoB;oBAClC,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC;QAE/C,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAEO,sBAAsB,CAC5B,eAAgC,EAChC,KAAkB,EAClB,YAAqB;QAErB,MAAM,MAAM,GAAgB,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAE5D,IAAI,IAAI,CAAC,OAAO,KAAK,aAAa,CAAC,EAAE,EAAE;YACrC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAgB,CAAC;gBACjE,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACzF,MAAM,WAAW,GAAG,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBACtF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,KAAK,cAAc,CAAC,WAAW,CAAC,EAAE;oBACxC,KAAK,EAAE,KAAK,CAAC,MAAM;oBACnB,UAAU,EAAE;wBACV,gDAAgD;wBAChD,cAAc,WAAW,mBAAmB,QAAQ,CAAC,MAAM,oCAAoC;qBAChG;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\nimport deepmerge from \"deepmerge\";\nimport {\n ClassDeclarationStructure,\n MethodDeclarationStructure,\n OptionalKind,\n PropertyDeclarationStructure,\n Scope,\n} from \"ts-morph\";\nimport { upperCaseFirst } from \"upper-case-first\";\nimport { firstCharLowerCase } from \"xml2js/lib/processors.js\";\nimport { DataModel } from \"../data-model/DataModel.js\";\nimport {\n ActionImportType,\n ComplexType,\n DataTypes,\n EntityContainerModel,\n EntityType,\n FunctionImportType,\n OperationType,\n OperationTypes,\n PropertyModel,\n ReturnTypeModel,\n SingletonType,\n} from \"../data-model/DataTypeModel.js\";\nimport { NamingHelper } from \"../data-model/NamingHelper.js\";\nimport { ConfigFileOptions, Modes } from \"../OptionModel.js\";\nimport { FileHandler } from \"../project/FileHandler.js\";\nimport { ProjectManager } from \"../project/ProjectManager.js\";\nimport { ClientApiImports, CoreImports, QueryObjectImports, ServiceImports } from \"./import/ImportObjects.js\";\nimport { ImportContainer } from \"./ImportContainer.js\";\n\nexport interface PropsAndOps extends Required<Pick<ClassDeclarationStructure, \"properties\" | \"methods\">> {}\n\nexport interface ServiceGeneratorOptions\n extends Pick<ConfigFileOptions, \"enablePrimitivePropertyServices\" | \"v4BigNumberAsString\" | \"enumType\"> {}\n\nexport async function generateServices(\n project: ProjectManager,\n dataModel: DataModel,\n version: ODataVersions,\n namingHelper: NamingHelper,\n options?: ServiceGeneratorOptions,\n) {\n const generator = new ServiceGenerator(project, dataModel, version, namingHelper, options);\n return generator.generate();\n}\n\nclass ServiceGenerator {\n constructor(\n private project: ProjectManager,\n private dataModel: DataModel,\n private version: ODataVersions,\n private namingHelper: NamingHelper,\n private options: ServiceGeneratorOptions = {},\n ) {}\n\n private isV4BigNumber() {\n return this.options.v4BigNumberAsString && this.version === ODataVersions.V4;\n }\n\n public async generate(): Promise<void> {\n const mainServiceName = this.namingHelper.getMainServiceName();\n this.project.initServices();\n\n await Promise.all([\n this.generateMainService(mainServiceName),\n ...this.generateEntityTypeServices(),\n ...this.generateComplexTypeServices(),\n ]);\n\n return this.project.finalizeServices();\n }\n\n private async generateMainService(mainServiceName: string) {\n const mainServiceFile = this.project.getMainServiceFile();\n const importContainer = mainServiceFile.getImports();\n const container = this.dataModel.getEntityContainer();\n const unboundOperations = [...Object.values(container.functions), ...Object.values(container.actions)];\n\n const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);\n const rootService = importContainer.addServiceObject(this.version, ServiceImports.ODataService);\n\n const { properties, methods }: PropsAndOps = deepmerge(\n this.generateMainServiceProperties(container, importContainer),\n this.generateMainServiceOperations(unboundOperations, importContainer),\n );\n\n mainServiceFile.getFile().addClass({\n isExported: true,\n name: mainServiceName,\n typeParameters: [`in out ClientType extends ${httpClient}`],\n extends: `${rootService}<ClientType>`,\n ctors: this.isV4BigNumber()\n ? [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n {\n name: \"options\",\n type: importContainer.addServiceObject(this.version, ServiceImports.ODataServiceOptions),\n hasQuestionToken: true,\n },\n ],\n statements: [`super(client, basePath, options);`, \"this.__base.options.bigNumbersAsString = true;\"],\n },\n ]\n : [],\n properties,\n methods,\n });\n }\n\n private generateMainServiceProperties(\n container: EntityContainerModel,\n importContainer: ImportContainer,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n Object.values(container.entitySets).forEach(({ name, odataName, entityType }) => {\n result.methods.push(this.generateRelatedServiceGetter(name, odataName, entityType, importContainer));\n });\n\n Object.values(container.singletons).forEach((singleton) => {\n result.properties.push(this.generateSingletonProp(importContainer, singleton));\n result.methods.push(this.generateSingletonGetter(singleton));\n });\n\n return result;\n }\n\n private generateMainServiceOperations(\n ops: Array<FunctionImportType | ActionImportType>,\n importContainer: ImportContainer,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n ops.forEach(({ operation, name }) => {\n const op = this.dataModel.getUnboundOperationType(operation);\n if (!op) {\n throw new Error(`Operation \"${operation}\" not found!`);\n }\n\n result.properties.push(this.generateQOperationProp(op));\n result.methods.push(this.generateMethod(name, op, importContainer, \"\"));\n });\n\n return result;\n }\n\n private generateRelatedServiceGetter(\n propName: string,\n odataPropName: string,\n entityType: EntityType,\n imports: ImportContainer,\n ): OptionalKind<MethodDeclarationStructure> {\n const idName = imports.addGeneratedModel(entityType.id.fqName, entityType.id.modelName);\n const idFunctionName = imports.addGeneratedQObject(entityType.id.fqName, entityType.id.qName);\n const serviceName = imports.addGeneratedService(entityType.fqName, entityType.serviceName);\n const collectionName = imports.addGeneratedService(entityType.fqName, entityType.serviceCollectionName);\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(propName),\n parameters: [\n {\n name: \"id\",\n type: `${idName} | undefined`,\n hasQuestionToken: true,\n },\n ],\n overloads: [\n {\n parameters: [],\n returnType: `${collectionName}<ClientType>`,\n },\n {\n parameters: [\n {\n name: \"id\",\n type: idName,\n },\n ],\n returnType: `${serviceName}<ClientType>`,\n },\n ],\n statements: [\n `const fieldName = \"${odataPropName}\";`,\n `const { client, path, options, isUrlNotEncoded } = this.__base;`,\n 'return typeof id === \"undefined\" || id === null',\n `? new ${collectionName}(client, path, fieldName, options)`,\n `: new ${serviceName}(client, path, new ${idFunctionName}(fieldName).buildUrl(id, isUrlNotEncoded()), options);`,\n ],\n };\n }\n\n private generateSingletonProp(\n importContainer: ImportContainer,\n singleton: SingletonType,\n ): OptionalKind<PropertyDeclarationStructure> {\n const { name, entityType } = singleton;\n const type = entityType.serviceName;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(name),\n type: `${type}<ClientType>`,\n hasQuestionToken: true,\n };\n }\n\n private generateQOperationProp = (operation: OperationType) => {\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(operation.qName),\n type: operation.qName,\n hasQuestionToken: true,\n };\n };\n\n private generateSingletonGetter(singleton: SingletonType): OptionalKind<MethodDeclarationStructure> {\n const { name, odataName, entityType } = singleton;\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(name);\n const serviceType = entityType.serviceName;\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${propName} = new ${serviceType}(client, path, \"${odataName}\", options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generateEntityTypeService(file: FileHandler, model: ComplexType, isComplexType = false) {\n const importContainer = file.getImports();\n\n const operations = this.dataModel.getEntityTypeOperations(model.fqName);\n const props = [...model.baseProps, ...model.props];\n\n const entityServiceType = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V2 && isComplexType\n ? ServiceImports.ComplexTypeService\n : ServiceImports.EntityTypeService,\n );\n const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);\n\n // note: predictable first imports => no need to take renaming into account\n const modelName = importContainer.addGeneratedModel(model.fqName, model.modelName);\n const editableModelName = importContainer.addGeneratedModel(model.fqName, model.editableName);\n const qName = importContainer.addGeneratedQObject(model.fqName, model.qName, true);\n const qObjectName = importContainer.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName));\n const serviceOptions = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V4\n ? ServiceImports.ODataServiceOptionsInternal\n : ServiceImports.ODataServiceOptions,\n );\n\n const { properties, methods }: PropsAndOps = deepmerge(\n deepmerge(\n this.generateServiceProperties(importContainer, model.serviceName, props),\n this.generateServiceOperations(importContainer, model, operations),\n ),\n this.generateCastOperations(importContainer, model, false),\n );\n\n // generate EntityTypeService\n file.getFile().addClass({\n isExported: true,\n name: model.serviceName,\n typeParameters: [`in out ClientType extends ${httpClient}`],\n extends: entityServiceType + `<ClientType, ${modelName}, ${editableModelName}, ${qName}>`,\n ctors: [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n { name: \"name\", type: \"string\" },\n { name: \"options\", type: serviceOptions, hasQuestionToken: true },\n ],\n statements: [`super(client, basePath, name, ${qObjectName}, options);`],\n },\n ],\n properties,\n methods,\n });\n }\n\n private generateServiceProperties(\n importContainer: ImportContainer,\n serviceName: string,\n props: Array<PropertyModel>,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n props.forEach((prop) => {\n // collection of ComplexTypes, ComplexTypes, or EntityTypes\n if ((prop.dataType === DataTypes.ModelType && !prop.isCollection) || prop.dataType === DataTypes.ComplexType) {\n result.properties.push(this.generateModelProp(importContainer, prop));\n result.methods.push(this.generateModelPropGetter(importContainer, prop));\n } else if (prop.isCollection) {\n // collection of EntityTypes\n if (prop.dataType === DataTypes.ModelType) {\n const entityType = this.dataModel.getEntityType(prop.fqType);\n if (!entityType) {\n throw new Error(`Entity type \"${prop.fqType}\" specified by property not found!`);\n }\n\n result.methods.push(\n this.generateRelatedServiceGetter(prop.name, prop.odataName, entityType, importContainer),\n );\n }\n // collection of primitive or enum types\n else {\n result.properties.push(this.generatePrimitiveCollectionProp(importContainer, prop));\n result.methods.push(this.generatePrimitiveCollectionGetter(importContainer, prop));\n }\n }\n // generation of services for each primitive property: turned off by default\n else if (this.options.enablePrimitivePropertyServices && prop.dataType === DataTypes.PrimitiveType) {\n result.properties.push(this.generatePrimitiveTypeProp(importContainer, prop));\n result.methods.push(this.generatePrimitiveTypeGetter(importContainer, prop));\n }\n });\n\n return result;\n }\n\n private generateServiceOperations(\n importContainer: ImportContainer,\n model: ComplexType,\n operations: Array<OperationType>,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n operations.forEach((operation) => {\n result.properties.push(this.generateQOperationProp(operation));\n result.methods.push(this.generateMethod(operation.name, operation, importContainer, model.fqName));\n });\n\n return result;\n }\n\n private generateModelProp(imports: ImportContainer, prop: PropertyModel): PropertyDeclarationStructure {\n const propModel = this.dataModel.getModel(prop.fqType) as ComplexType;\n let propModelType: string;\n\n if (prop.isCollection) {\n const modelName = imports.addGeneratedModel(propModel.fqName, propModel.modelName);\n const editableModelName = imports.addGeneratedModel(propModel.fqName, propModel.editableName);\n const qModelName = imports.addGeneratedQObject(propModel.fqName, propModel.qName, true);\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n\n propModelType = `${collectionServiceType}<ClientType, ${modelName}, ${qModelName}, ${editableModelName}>`;\n } else {\n const serviceName = imports.addGeneratedService(propModel.fqName, propModel.serviceName);\n propModelType = `${serviceName}<ClientType>`;\n }\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: propModelType,\n hasQuestionToken: true,\n } as PropertyDeclarationStructure;\n }\n\n private generatePrimitiveCollectionProp(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<PropertyDeclarationStructure> {\n if (!prop.qObject) {\n throw new Error(\"Illegal State: [qObject] must be provided for Collection types!\");\n }\n\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n const isEnum = prop.dataType === DataTypes.EnumType;\n const isNumericEnum = this.options.enumType === \"numeric\";\n let qType: string;\n let type: string;\n\n if (isEnum) {\n const propEnum = this.dataModel.getModel(prop.fqType)!;\n const propTypeModel = imports.addGeneratedModel(propEnum.fqName, propEnum.modelName, false);\n type = `${imports.addQObjectType(QueryObjectImports.EnumCollection)}<typeof ${propTypeModel}>`;\n qType = `${imports.addQObjectType(\n isNumericEnum ? QueryObjectImports.QNumericEnumCollection : QueryObjectImports.QEnumCollection,\n )}<typeof ${propTypeModel}>`;\n } else {\n // TODO refactor string concat\n type = imports.addQObjectType(`${upperCaseFirst(prop.type)}Collection`);\n qType = imports.addQObjectType(prop.qObject);\n }\n const collectionType = `${collectionServiceType}<ClientType, ${type}, ${qType}>`;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: `${collectionType}`,\n hasQuestionToken: true,\n };\n }\n\n private generatePrimitiveTypeProp(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<PropertyDeclarationStructure> {\n const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);\n const type = prop.typeModule ? imports.addCustomType(prop.typeModule, prop.type, true) : prop.type;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: `${serviceType}<ClientType, ${type}>`,\n hasQuestionToken: true,\n };\n }\n\n private generateModelPropGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const model = this.dataModel.getModel(prop.fqType) as ComplexType;\n const isComplexCollection = prop.isCollection && model.dataType === DataTypes.ComplexType;\n\n const type = isComplexCollection\n ? imports.addServiceObject(this.version, ServiceImports.CollectionService)\n : prop.isCollection\n ? model.serviceCollectionName\n : model.serviceName;\n const typeWithGenerics = isComplexCollection\n ? `${type}<ClientType, ${imports.addGeneratedModel(model.fqName, model.modelName)}, ${imports.addGeneratedQObject(\n model.fqName,\n model.qName,\n true,\n )}, ${imports.addGeneratedModel(model.fqName, model.editableName)}>`\n : `${type}<ClientType>`;\n\n const privateSrvProp = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n returnType: typeWithGenerics,\n statements: [\n `if(!${privateSrvProp}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${privateSrvProp} = new ${type}(client, path, \"${prop.odataName}\"${isComplexCollection ? `, ${imports.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName))}`: \"\"}, options)`,\n \"}\",\n `return ${privateSrvProp}`,\n ],\n };\n }\n\n private generatePrimitiveCollectionGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n const qCollectionName = imports.addQObject(prop.qObject!);\n const enumName =\n prop.dataType === DataTypes.EnumType ? imports.addGeneratedModel(prop.fqType, prop.type) : undefined;\n\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${propName} = new ${collectionServiceType}(client, path, \"${prop.odataName}\", new ${qCollectionName}(${enumName ?? \"\"}), options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generatePrimitiveTypeGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n // for V2: mapped name must be specified\n const v2MappedName =\n this.version === ODataVersions.V4 ? \"\" : prop.name !== prop.odataName ? `, \"${prop.name}\"` : \", undefined\";\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, qModel, options } = this.__base;`,\n ` ${propName} = new ${serviceType}(client, path, \"${prop.odataName}\", qModel.${prop.name}.converter${v2MappedName}, options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generateEntityCollectionService(file: FileHandler, model: EntityType) {\n const importContainer = file.getImports();\n const editableModelName = model.editableName;\n const qObjectName = firstCharLowerCase(model.qName);\n\n const entitySetServiceType = importContainer.addServiceObject(this.version, ServiceImports.EntitySetService);\n const paramsModelName = importContainer.addGeneratedModel(model.id.fqName, model.id.modelName);\n const qIdFunctionName = importContainer.addGeneratedQObject(model.id.fqName, model.id.qName);\n const serviceOptions = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V4\n ? ServiceImports.ODataServiceOptionsInternal\n : ServiceImports.ODataServiceOptions,\n );\n\n const collectionOperations = this.dataModel.getEntitySetOperations(model.fqName);\n\n const { properties, methods } = deepmerge(\n this.generateServiceOperations(importContainer, model, collectionOperations),\n this.generateCastOperations(importContainer, model, true),\n );\n\n file.getFile().addClass({\n isExported: true,\n name: model.serviceCollectionName,\n typeParameters: [\"in out ClientType extends ODataHttpClient\"],\n extends:\n entitySetServiceType +\n `<ClientType, ${model.modelName}, ${editableModelName}, ${model.qName}, ${paramsModelName}>`,\n ctors: [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n { name: \"name\", type: \"string\" },\n { name: \"options\", type: serviceOptions, hasQuestionToken: true },\n ],\n statements: [`super(client, basePath, name, ${qObjectName}, new ${qIdFunctionName}(name), options);`],\n },\n ],\n properties,\n methods,\n });\n }\n\n private generateEntityTypeServices(): Array<Promise<void>> {\n // build service file for each entity, consisting of EntityTypeService & EntityCollectionService\n return this.dataModel\n .getEntityTypes()\n .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)\n .map((model) => {\n const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [\n model.serviceName,\n model.serviceCollectionName,\n ]);\n\n // entity type service\n this.generateEntityTypeService(file, model);\n // entity collection service if this entity specified keys at all\n if (model.keyNames.length) {\n this.generateEntityCollectionService(file, model);\n }\n\n return this.project.finalizeFile(file);\n });\n }\n\n private generateComplexTypeServices(): Array<Promise<void>> {\n // build service file for complex types\n return this.dataModel\n .getComplexTypes()\n .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)\n .map((model) => {\n const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [model.serviceName]);\n\n // entity type service\n this.generateEntityTypeService(file, model, true);\n\n return this.project.finalizeFile(file);\n });\n }\n\n private generateMethod(\n name: string,\n operation: OperationType,\n importContainer: ImportContainer,\n baseFqName: string,\n ): OptionalKind<MethodDeclarationStructure> {\n const isFunc = operation.type === OperationTypes.Function;\n const returnType = operation.returnType;\n const hasParams = operation.parameters.length > 0 || operation.overrides?.length;\n const isParamsOptional = !![operation.parameters, ...(operation.overrides ?? [])].find((pSet) => pSet.length === 0);\n\n // importing dependencies\n const httpClientConfigModel = importContainer.addClientApi(ClientApiImports.ODataHttpClientConfig);\n const odataResponse = importContainer.addClientApi(ClientApiImports.HttpResponseModel);\n const responseStructure = this.importReturnType(importContainer, returnType);\n const qOperationName = importContainer.addGeneratedQObject(baseFqName, operation.qName);\n const rtType =\n returnType?.type && returnType.dataType !== DataTypes.PrimitiveType\n ? importContainer.addGeneratedModel(returnType.fqType, returnType.type)\n : returnType?.type;\n const paramsModelName = hasParams\n ? importContainer.addGeneratedModel(baseFqName, operation.paramsModelName)\n : undefined;\n\n const requestConfigParam = {\n name: \"requestConfig\",\n hasQuestionToken: true,\n type: `${httpClientConfigModel}<ClientType>`,\n };\n const qOpProp = \"this.\" + this.namingHelper.getPrivatePropName(operation.qName);\n\n return {\n scope: Scope.Public,\n isAsync: true,\n name,\n parameters: hasParams\n ? [{ name: \"params\", type: paramsModelName, hasQuestionToken: isParamsOptional }, requestConfigParam]\n : [requestConfigParam],\n returnType: `Promise<${odataResponse}<${responseStructure}<${rtType || \"void\"}>>>`,\n statements: [\n `if(!${qOpProp}) {`,\n ` ${qOpProp} = new ${qOperationName}()`,\n \"}\",\n\n `const { addFullPath, client, getDefaultHeaders, isUrlNotEncoded } = this.__base;`,\n `const url = addFullPath(${qOpProp}.buildUrl(${isFunc && hasParams ? \"params, \" : \"\"}${isFunc ? \"isUrlNotEncoded()\" : \"\"}));`,\n `${returnType ? \"const response = await \" : \"return\"} client.${\n !isFunc\n ? // actions: since V4\n `post(url, ${hasParams ? `${qOpProp}.convertUserParams(params)` : \"{}\"}, ${\n requestConfigParam.name\n }, getDefaultHeaders())`\n : operation.usePost\n ? // V2 POST => BUT values are still query params, they are not part of the request body\n `post(url, undefined, ${requestConfigParam.name}, getDefaultHeaders())`\n : // functions: since V2\n `get(url, ${requestConfigParam.name}, getDefaultHeaders())`\n };`,\n returnType ? `return ${qOpProp}.convertResponse(response);` : \"\",\n ],\n };\n }\n\n private importReturnType(imports: ImportContainer, returnType: ReturnTypeModel | undefined): string {\n const typeToImport: CoreImports = returnType?.isCollection\n ? CoreImports.ODataCollectionResponse\n : returnType?.dataType === DataTypes.PrimitiveType\n ? CoreImports.ODataValueResponse\n : this.version === ODataVersions.V4\n ? CoreImports.ODataModelResponseV4\n : CoreImports.ODataEntityModelResponseV2;\n\n return imports.addCoreLib(this.version, typeToImport);\n }\n\n private generateCastOperations(\n importContainer: ImportContainer,\n model: ComplexType,\n isCollection: boolean,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n if (this.version === ODataVersions.V4) {\n model.subtypes.forEach((subtype) => {\n const subClass = this.dataModel.getModel(subtype) as ComplexType;\n const serviceName = isCollection ? subClass.serviceCollectionName : subClass.serviceName;\n const serviceType = importContainer.addGeneratedService(subClass.fqName, serviceName);\n result.methods.push({\n name: `as${upperCaseFirst(serviceName)}`,\n scope: Scope.Public,\n statements: [\n \"const { client, path, options } = this.__base;\",\n `return new ${serviceType}(client, path, \"${subClass.fqName}\", { ...options, subtype: true });`,\n ],\n });\n });\n }\n\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ServiceGenerator.js","sourceRoot":"","sources":["../../src/generator/ServiceGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAKL,KAAK,GACN,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAgB9D,OAAO,EAAqB,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ9G,MAAM,UAAgB,gBAAgB,CACpC,OAAuB,EACvB,SAAoB,EACpB,OAAsB,EACtB,YAA0B,EAC1B,OAAiC;;QAEjC,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3F,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CAAA;AAED,MAAM,gBAAgB;IAC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QAAQ,CAAC,OAAO,CAAgB,CAAC;gBACjE,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;gBACzF,MAAM,WAAW,GAAG,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;gBACtF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;oBAClB,IAAI,EAAE,KAAK,cAAc,CAAC,WAAW,CAAC,EAAE;oBACxC,KAAK,EAAE,KAAK,CAAC,MAAM;oBACnB,UAAU,EAAE;wBACV,gDAAgD;wBAChD,cAAc,WAAW,mBAAmB,QAAQ,CAAC,MAAM,oCAAoC;qBAChG;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { ODataVersions } from \"@odata2ts/odata-core\";\nimport deepmerge from \"deepmerge\";\nimport {\n ClassDeclarationStructure,\n MethodDeclarationStructure,\n OptionalKind,\n PropertyDeclarationStructure,\n Scope,\n} from \"ts-morph\";\nimport { upperCaseFirst } from \"upper-case-first\";\nimport { firstCharLowerCase } from \"xml2js/lib/processors.js\";\nimport { DataModel } from \"../data-model/DataModel.js\";\nimport {\n ActionImportType,\n ComplexType,\n DataTypes,\n EntityContainerModel,\n EntityType,\n FunctionImportType,\n OperationType,\n OperationTypes,\n PropertyModel,\n ReturnTypeModel,\n SingletonType,\n} from \"../data-model/DataTypeModel.js\";\nimport { NamingHelper } from \"../data-model/NamingHelper.js\";\nimport { ConfigFileOptions, Modes } from \"../OptionModel.js\";\nimport { FileHandler } from \"../project/FileHandler.js\";\nimport { ProjectManager } from \"../project/ProjectManager.js\";\nimport { ClientApiImports, CoreImports, QueryObjectImports, ServiceImports } from \"./import/ImportObjects.js\";\nimport { ImportContainer } from \"./ImportContainer.js\";\n\nexport interface PropsAndOps extends Required<Pick<ClassDeclarationStructure, \"properties\" | \"methods\">> {}\n\nexport interface ServiceGeneratorOptions\n extends Pick<ConfigFileOptions, \"enablePrimitivePropertyServices\" | \"v4BigNumberAsString\" | \"enumType\"> {}\n\nexport async function generateServices(\n project: ProjectManager,\n dataModel: DataModel,\n version: ODataVersions,\n namingHelper: NamingHelper,\n options?: ServiceGeneratorOptions,\n) {\n const generator = new ServiceGenerator(project, dataModel, version, namingHelper, options);\n return generator.generate();\n}\n\nclass ServiceGenerator {\n constructor(\n private project: ProjectManager,\n private dataModel: DataModel,\n private version: ODataVersions,\n private namingHelper: NamingHelper,\n private options: ServiceGeneratorOptions = {},\n ) {}\n\n private isV4BigNumber() {\n return this.options.v4BigNumberAsString && this.version === ODataVersions.V4;\n }\n\n public async generate(): Promise<void> {\n const mainServiceName = this.namingHelper.getMainServiceName();\n this.project.initServices();\n\n await Promise.all([\n this.generateMainService(mainServiceName),\n ...this.generateEntityTypeServices(),\n ...this.generateComplexTypeServices(),\n ]);\n\n return this.project.finalizeServices();\n }\n\n private async generateMainService(mainServiceName: string) {\n const mainServiceFile = this.project.getMainServiceFile();\n const importContainer = mainServiceFile.getImports();\n const container = this.dataModel.getEntityContainer();\n const unboundOperations = [...Object.values(container.functions), ...Object.values(container.actions)];\n\n const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);\n const rootService = importContainer.addServiceObject(this.version, ServiceImports.ODataService);\n\n const { properties, methods }: PropsAndOps = deepmerge(\n this.generateMainServiceProperties(container, importContainer),\n this.generateMainServiceOperations(unboundOperations, importContainer),\n );\n\n mainServiceFile.getFile().addClass({\n isExported: true,\n name: mainServiceName,\n typeParameters: [`in out ClientType extends ${httpClient}`],\n extends: `${rootService}<ClientType>`,\n ctors: this.isV4BigNumber()\n ? [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n {\n name: \"options\",\n type: importContainer.addServiceObject(this.version, ServiceImports.ODataServiceOptions),\n hasQuestionToken: true,\n },\n ],\n statements: [`super(client, basePath, options);`, \"this.__base.options.bigNumbersAsString = true;\"],\n },\n ]\n : [],\n properties,\n methods,\n });\n }\n\n private generateMainServiceProperties(\n container: EntityContainerModel,\n importContainer: ImportContainer,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n Object.values(container.entitySets).forEach(({ name, odataName, entityType }) => {\n result.methods.push(this.generateRelatedServiceGetter(name, odataName, entityType, importContainer));\n });\n\n Object.values(container.singletons).forEach((singleton) => {\n result.properties.push(this.generateSingletonProp(importContainer, singleton));\n result.methods.push(this.generateSingletonGetter(singleton));\n });\n\n return result;\n }\n\n private generateMainServiceOperations(\n ops: Array<FunctionImportType | ActionImportType>,\n importContainer: ImportContainer,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n ops.forEach(({ operation, name }) => {\n const op = this.dataModel.getUnboundOperationType(operation);\n if (!op) {\n throw new Error(`Operation \"${operation}\" not found!`);\n }\n\n result.properties.push(this.generateQOperationProp(op));\n result.methods.push(this.generateMethod(name, op, importContainer, \"\"));\n });\n\n return result;\n }\n\n private generateRelatedServiceGetter(\n propName: string,\n odataPropName: string,\n entityType: EntityType,\n imports: ImportContainer,\n ): OptionalKind<MethodDeclarationStructure> {\n const idName = imports.addGeneratedModel(entityType.id.fqName, entityType.id.modelName);\n const idFunctionName = imports.addGeneratedQObject(entityType.id.fqName, entityType.id.qName);\n const serviceName = imports.addGeneratedService(entityType.fqName, entityType.serviceName);\n const collectionName = imports.addGeneratedService(entityType.fqName, entityType.serviceCollectionName);\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(propName),\n parameters: [\n {\n name: \"id\",\n type: `${idName} | undefined`,\n hasQuestionToken: true,\n },\n ],\n overloads: [\n {\n parameters: [],\n returnType: `${collectionName}<ClientType>`,\n },\n {\n parameters: [\n {\n name: \"id\",\n type: idName,\n },\n ],\n returnType: `${serviceName}<ClientType>`,\n },\n ],\n statements: [\n `const fieldName = \"${odataPropName}\";`,\n `const { client, path, options, isUrlNotEncoded } = this.__base;`,\n 'return typeof id === \"undefined\" || id === null',\n `? new ${collectionName}(client, path, fieldName, options)`,\n `: new ${serviceName}(client, path, new ${idFunctionName}(fieldName).buildUrl(id, isUrlNotEncoded()), options);`,\n ],\n };\n }\n\n private generateSingletonProp(\n importContainer: ImportContainer,\n singleton: SingletonType,\n ): OptionalKind<PropertyDeclarationStructure> {\n const { name, entityType } = singleton;\n const type = entityType.serviceName;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(name),\n type: `${type}<ClientType>`,\n hasQuestionToken: true,\n };\n }\n\n private generateQOperationProp = (operation: OperationType) => {\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(operation.qName),\n type: operation.qName,\n hasQuestionToken: true,\n };\n };\n\n private generateSingletonGetter(singleton: SingletonType): OptionalKind<MethodDeclarationStructure> {\n const { name, odataName, entityType } = singleton;\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(name);\n const serviceType = entityType.serviceName;\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${propName} = new ${serviceType}(client, path, \"${odataName}\", options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generateEntityTypeService(file: FileHandler, model: ComplexType, isComplexType = false) {\n const importContainer = file.getImports();\n\n const operations = this.dataModel.getEntityTypeOperations(model.fqName);\n const props = [...model.baseProps, ...model.props];\n\n const entityServiceType = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V2 && isComplexType\n ? ServiceImports.ComplexTypeService\n : ServiceImports.EntityTypeService,\n );\n const httpClient = importContainer.addClientApi(ClientApiImports.ODataHttpClient);\n\n // note: predictable first imports => no need to take renaming into account\n const modelName = importContainer.addGeneratedModel(model.fqName, model.modelName);\n const editableModelName = importContainer.addGeneratedModel(model.fqName, model.editableName);\n const qName = importContainer.addGeneratedQObject(model.fqName, model.qName, true);\n const qObjectName = importContainer.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName));\n const serviceOptions = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V4\n ? ServiceImports.ODataServiceOptionsInternal\n : ServiceImports.ODataServiceOptions,\n );\n\n const { properties, methods }: PropsAndOps = deepmerge(\n deepmerge(\n this.generateServiceProperties(importContainer, model.serviceName, props),\n this.generateServiceOperations(importContainer, model, operations),\n ),\n this.generateCastOperations(importContainer, model, false),\n );\n\n // generate EntityTypeService\n file.getFile().addClass({\n isExported: true,\n name: model.serviceName,\n typeParameters: [`in out ClientType extends ${httpClient}`],\n extends: entityServiceType + `<ClientType, ${modelName}, ${editableModelName}, ${qName}>`,\n ctors: [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n { name: \"name\", type: \"string\" },\n { name: \"options\", type: serviceOptions, hasQuestionToken: true },\n ],\n statements: [`super(client, basePath, name, ${qObjectName}, options);`],\n },\n ],\n properties,\n methods,\n });\n }\n\n private generateServiceProperties(\n importContainer: ImportContainer,\n serviceName: string,\n props: Array<PropertyModel>,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n props.forEach((prop) => {\n // collection of ComplexTypes, ComplexTypes, or EntityTypes\n if ((prop.dataType === DataTypes.ModelType && !prop.isCollection) || prop.dataType === DataTypes.ComplexType) {\n result.properties.push(this.generateModelProp(importContainer, prop));\n result.methods.push(this.generateModelPropGetter(importContainer, prop));\n } else if (prop.isCollection) {\n // collection of EntityTypes\n if (prop.dataType === DataTypes.ModelType) {\n const entityType = this.dataModel.getEntityType(prop.fqType);\n if (!entityType) {\n throw new Error(`Entity type \"${prop.fqType}\" specified by property not found!`);\n }\n\n result.methods.push(\n this.generateRelatedServiceGetter(prop.name, prop.odataName, entityType, importContainer),\n );\n }\n // collection of primitive or enum types\n else {\n result.properties.push(this.generatePrimitiveCollectionProp(importContainer, prop));\n result.methods.push(this.generatePrimitiveCollectionGetter(importContainer, prop));\n }\n }\n // generation of services for each primitive property: turned off by default\n else if (this.options.enablePrimitivePropertyServices && prop.dataType === DataTypes.PrimitiveType) {\n result.properties.push(this.generatePrimitiveTypeProp(importContainer, prop));\n result.methods.push(this.generatePrimitiveTypeGetter(importContainer, prop));\n }\n });\n\n return result;\n }\n\n private generateServiceOperations(\n importContainer: ImportContainer,\n model: ComplexType,\n operations: Array<OperationType>,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n operations.forEach((operation) => {\n result.properties.push(this.generateQOperationProp(operation));\n result.methods.push(this.generateMethod(operation.name, operation, importContainer, model.fqName));\n });\n\n return result;\n }\n\n private generateModelProp(imports: ImportContainer, prop: PropertyModel): PropertyDeclarationStructure {\n const propModel = this.dataModel.getModel(prop.fqType) as ComplexType;\n let propModelType: string;\n\n if (prop.isCollection) {\n const modelName = imports.addGeneratedModel(propModel.fqName, propModel.modelName);\n const editableModelName = imports.addGeneratedModel(propModel.fqName, propModel.editableName);\n const qModelName = imports.addGeneratedQObject(propModel.fqName, propModel.qName, true);\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n\n propModelType = `${collectionServiceType}<ClientType, ${modelName}, ${qModelName}, ${editableModelName}>`;\n } else {\n const serviceName = imports.addGeneratedService(propModel.fqName, propModel.serviceName);\n propModelType = `${serviceName}<ClientType>`;\n }\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: propModelType,\n hasQuestionToken: true,\n } as PropertyDeclarationStructure;\n }\n\n private generatePrimitiveCollectionProp(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<PropertyDeclarationStructure> {\n if (!prop.qObject) {\n throw new Error(\"Illegal State: [qObject] must be provided for Collection types!\");\n }\n\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n const isEnum = prop.dataType === DataTypes.EnumType;\n const isNumericEnum = this.options.enumType === \"numeric\";\n let qType: string;\n let type: string;\n\n if (isEnum) {\n const propEnum = this.dataModel.getModel(prop.fqType)!;\n const propTypeModel = imports.addGeneratedModel(propEnum.fqName, propEnum.modelName, false);\n type = `${imports.addQObjectType(QueryObjectImports.EnumCollection)}<typeof ${propTypeModel}>`;\n qType = `${imports.addQObjectType(prop.qObject)}<typeof ${propTypeModel}>`;\n } else {\n // TODO refactor string concat\n type = imports.addQObjectType(`${upperCaseFirst(prop.type)}Collection`);\n qType = imports.addQObjectType(prop.qObject);\n }\n const collectionType = `${collectionServiceType}<ClientType, ${type}, ${qType}>`;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: `${collectionType}`,\n hasQuestionToken: true,\n };\n }\n\n private generatePrimitiveTypeProp(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<PropertyDeclarationStructure> {\n const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);\n const type = prop.typeModule ? imports.addCustomType(prop.typeModule, prop.type, true) : prop.type;\n\n return {\n scope: Scope.Private,\n name: this.namingHelper.getPrivatePropName(prop.name),\n type: `${serviceType}<ClientType, ${type}>`,\n hasQuestionToken: true,\n };\n }\n\n private generateModelPropGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const model = this.dataModel.getModel(prop.fqType) as ComplexType;\n const isComplexCollection = prop.isCollection && model.dataType === DataTypes.ComplexType;\n\n const type = isComplexCollection\n ? imports.addServiceObject(this.version, ServiceImports.CollectionService)\n : prop.isCollection\n ? model.serviceCollectionName\n : model.serviceName;\n const typeWithGenerics = isComplexCollection\n ? `${type}<ClientType, ${imports.addGeneratedModel(model.fqName, model.modelName)}, ${imports.addGeneratedQObject(\n model.fqName,\n model.qName,\n true,\n )}, ${imports.addGeneratedModel(model.fqName, model.editableName)}>`\n : `${type}<ClientType>`;\n\n const privateSrvProp = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n returnType: typeWithGenerics,\n statements: [\n `if(!${privateSrvProp}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${privateSrvProp} = new ${type}(client, path, \"${prop.odataName}\"${isComplexCollection ? `, ${imports.addGeneratedQObject(model.fqName, firstCharLowerCase(model.qName))}`: \"\"}, options)`,\n \"}\",\n `return ${privateSrvProp}`,\n ],\n };\n }\n\n private generatePrimitiveCollectionGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const collectionServiceType = imports.addServiceObject(this.version, ServiceImports.CollectionService);\n const qCollectionName = imports.addQObject(prop.qObject!);\n const enumName =\n prop.dataType === DataTypes.EnumType ? imports.addGeneratedModel(prop.fqType, prop.type) : undefined;\n\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, options } = this.__base;`,\n // prettier-ignore\n ` ${propName} = new ${collectionServiceType}(client, path, \"${prop.odataName}\", new ${qCollectionName}(${enumName ?? \"\"}), options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generatePrimitiveTypeGetter(\n imports: ImportContainer,\n prop: PropertyModel,\n ): OptionalKind<MethodDeclarationStructure> {\n const serviceType = imports.addServiceObject(this.version, ServiceImports.PrimitiveTypeService);\n const propName = \"this.\" + this.namingHelper.getPrivatePropName(prop.name);\n // for V2: mapped name must be specified\n const v2MappedName =\n this.version === ODataVersions.V4 ? \"\" : prop.name !== prop.odataName ? `, \"${prop.name}\"` : \", undefined\";\n\n return {\n scope: Scope.Public,\n name: this.namingHelper.getRelatedServiceGetter(prop.name),\n statements: [\n `if(!${propName}) {`,\n ` const { client, path, qModel, options } = this.__base;`,\n ` ${propName} = new ${serviceType}(client, path, \"${prop.odataName}\", qModel.${prop.name}.converter${v2MappedName}, options)`,\n \"}\",\n `return ${propName}`,\n ],\n };\n }\n\n private generateEntityCollectionService(file: FileHandler, model: EntityType) {\n const importContainer = file.getImports();\n const editableModelName = model.editableName;\n const qObjectName = firstCharLowerCase(model.qName);\n\n const entitySetServiceType = importContainer.addServiceObject(this.version, ServiceImports.EntitySetService);\n const paramsModelName = importContainer.addGeneratedModel(model.id.fqName, model.id.modelName);\n const qIdFunctionName = importContainer.addGeneratedQObject(model.id.fqName, model.id.qName);\n const serviceOptions = importContainer.addServiceObject(\n this.version,\n this.version === ODataVersions.V4\n ? ServiceImports.ODataServiceOptionsInternal\n : ServiceImports.ODataServiceOptions,\n );\n\n const collectionOperations = this.dataModel.getEntitySetOperations(model.fqName);\n\n const { properties, methods } = deepmerge(\n this.generateServiceOperations(importContainer, model, collectionOperations),\n this.generateCastOperations(importContainer, model, true),\n );\n\n file.getFile().addClass({\n isExported: true,\n name: model.serviceCollectionName,\n typeParameters: [\"in out ClientType extends ODataHttpClient\"],\n extends:\n entitySetServiceType +\n `<ClientType, ${model.modelName}, ${editableModelName}, ${model.qName}, ${paramsModelName}>`,\n ctors: [\n {\n parameters: [\n { name: \"client\", type: \"ClientType\" },\n { name: \"basePath\", type: \"string\" },\n { name: \"name\", type: \"string\" },\n { name: \"options\", type: serviceOptions, hasQuestionToken: true },\n ],\n statements: [`super(client, basePath, name, ${qObjectName}, new ${qIdFunctionName}(name), options);`],\n },\n ],\n properties,\n methods,\n });\n }\n\n private generateEntityTypeServices(): Array<Promise<void>> {\n // build service file for each entity, consisting of EntityTypeService & EntityCollectionService\n return this.dataModel\n .getEntityTypes()\n .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)\n .map((model) => {\n const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [\n model.serviceName,\n model.serviceCollectionName,\n ]);\n\n // entity type service\n this.generateEntityTypeService(file, model);\n // entity collection service if this entity specified keys at all\n if (model.keyNames.length) {\n this.generateEntityCollectionService(file, model);\n }\n\n return this.project.finalizeFile(file);\n });\n }\n\n private generateComplexTypeServices(): Array<Promise<void>> {\n // build service file for complex types\n return this.dataModel\n .getComplexTypes()\n .filter((model) => model.genMode === Modes.service || model.genMode === Modes.all)\n .map((model) => {\n const file = this.project.createOrGetServiceFile(model.folderPath, model.serviceName, [model.serviceName]);\n\n // entity type service\n this.generateEntityTypeService(file, model, true);\n\n return this.project.finalizeFile(file);\n });\n }\n\n private generateMethod(\n name: string,\n operation: OperationType,\n importContainer: ImportContainer,\n baseFqName: string,\n ): OptionalKind<MethodDeclarationStructure> {\n const isFunc = operation.type === OperationTypes.Function;\n const returnType = operation.returnType;\n const hasParams = operation.parameters.length > 0 || operation.overrides?.length;\n const isParamsOptional = !![operation.parameters, ...(operation.overrides ?? [])].find((pSet) => pSet.length === 0);\n\n // importing dependencies\n const httpClientConfigModel = importContainer.addClientApi(ClientApiImports.ODataHttpClientConfig);\n const odataResponse = importContainer.addClientApi(ClientApiImports.HttpResponseModel);\n const responseStructure = this.importReturnType(importContainer, returnType);\n const qOperationName = importContainer.addGeneratedQObject(baseFqName, operation.qName);\n const rtType =\n returnType?.type && returnType.dataType !== DataTypes.PrimitiveType\n ? importContainer.addGeneratedModel(returnType.fqType, returnType.type)\n : returnType?.type;\n const paramsModelName = hasParams\n ? importContainer.addGeneratedModel(baseFqName, operation.paramsModelName)\n : undefined;\n\n const requestConfigParam = {\n name: \"requestConfig\",\n hasQuestionToken: true,\n type: `${httpClientConfigModel}<ClientType>`,\n };\n const qOpProp = \"this.\" + this.namingHelper.getPrivatePropName(operation.qName);\n\n return {\n scope: Scope.Public,\n isAsync: true,\n name,\n parameters: hasParams\n ? [{ name: \"params\", type: paramsModelName, hasQuestionToken: isParamsOptional }, requestConfigParam]\n : [requestConfigParam],\n returnType: `Promise<${odataResponse}<${responseStructure}<${rtType || \"void\"}>>>`,\n statements: [\n `if(!${qOpProp}) {`,\n ` ${qOpProp} = new ${qOperationName}()`,\n \"}\",\n\n `const { addFullPath, client, getDefaultHeaders, isUrlNotEncoded } = this.__base;`,\n `const url = addFullPath(${qOpProp}.buildUrl(${isFunc && hasParams ? \"params, \" : \"\"}${isFunc ? \"isUrlNotEncoded()\" : \"\"}));`,\n `${returnType ? \"const response = await \" : \"return\"} client.${\n !isFunc\n ? // actions: since V4\n `post(url, ${hasParams ? `${qOpProp}.convertUserParams(params)` : \"{}\"}, ${\n requestConfigParam.name\n }, getDefaultHeaders())`\n : operation.usePost\n ? // V2 POST => BUT values are still query params, they are not part of the request body\n `post(url, undefined, ${requestConfigParam.name}, getDefaultHeaders())`\n : // functions: since V2\n `get(url, ${requestConfigParam.name}, getDefaultHeaders())`\n };`,\n returnType ? `return ${qOpProp}.convertResponse(response);` : \"\",\n ],\n };\n }\n\n private importReturnType(imports: ImportContainer, returnType: ReturnTypeModel | undefined): string {\n const typeToImport: CoreImports = returnType?.isCollection\n ? CoreImports.ODataCollectionResponse\n : returnType?.dataType === DataTypes.PrimitiveType\n ? CoreImports.ODataValueResponse\n : this.version === ODataVersions.V4\n ? CoreImports.ODataModelResponseV4\n : CoreImports.ODataEntityModelResponseV2;\n\n return imports.addCoreLib(this.version, typeToImport);\n }\n\n private generateCastOperations(\n importContainer: ImportContainer,\n model: ComplexType,\n isCollection: boolean,\n ): PropsAndOps {\n const result: PropsAndOps = { properties: [], methods: [] };\n\n if (this.version === ODataVersions.V4) {\n model.subtypes.forEach((subtype) => {\n const subClass = this.dataModel.getModel(subtype) as ComplexType;\n const serviceName = isCollection ? subClass.serviceCollectionName : subClass.serviceName;\n const serviceType = importContainer.addGeneratedService(subClass.fqName, serviceName);\n result.methods.push({\n name: `as${upperCaseFirst(serviceName)}`,\n scope: Scope.Public,\n statements: [\n \"const { client, path, options } = this.__base;\",\n `return new ${serviceType}(client, path, \"${subClass.fqName}\", { ...options, subtype: true });`,\n ],\n });\n });\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -35,12 +35,6 @@ export declare enum QueryObjectImports {
|
|
|
35
35
|
QFunction = "QFunction",
|
|
36
36
|
QAction = "QAction",
|
|
37
37
|
EnumCollection = "EnumCollection",
|
|
38
|
-
QEnumCollection = "QEnumCollection",
|
|
39
|
-
QNumericEnumCollection = "QNumericEnumCollection",
|
|
40
|
-
QEnumCollectionPath = "QEnumCollectionPath",
|
|
41
|
-
QNumericEnumCollectionPath = "QNumericEnumCollectionPath",
|
|
42
|
-
QCollectionPath = "QCollectionPath",
|
|
43
|
-
QEntityCollectionPath = "QEntityCollectionPath",
|
|
44
38
|
OperationReturnType = "OperationReturnType",
|
|
45
39
|
ReturnTypes = "ReturnTypes",
|
|
46
40
|
QComplexParam = "QComplexParam"
|
|
@@ -37,12 +37,6 @@ export var QueryObjectImports;
|
|
|
37
37
|
QueryObjectImports["QFunction"] = "QFunction";
|
|
38
38
|
QueryObjectImports["QAction"] = "QAction";
|
|
39
39
|
QueryObjectImports["EnumCollection"] = "EnumCollection";
|
|
40
|
-
QueryObjectImports["QEnumCollection"] = "QEnumCollection";
|
|
41
|
-
QueryObjectImports["QNumericEnumCollection"] = "QNumericEnumCollection";
|
|
42
|
-
QueryObjectImports["QEnumCollectionPath"] = "QEnumCollectionPath";
|
|
43
|
-
QueryObjectImports["QNumericEnumCollectionPath"] = "QNumericEnumCollectionPath";
|
|
44
|
-
QueryObjectImports["QCollectionPath"] = "QCollectionPath";
|
|
45
|
-
QueryObjectImports["QEntityCollectionPath"] = "QEntityCollectionPath";
|
|
46
40
|
QueryObjectImports["OperationReturnType"] = "OperationReturnType";
|
|
47
41
|
QueryObjectImports["ReturnTypes"] = "ReturnTypes";
|
|
48
42
|
QueryObjectImports["QComplexParam"] = "QComplexParam";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportObjects.js","sourceRoot":"","sources":["../../../src/generator/import/ImportObjects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImportObjects.js","sourceRoot":"","sources":["../../../src/generator/import/ImportObjects.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,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GG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,cAAc,CAAC,iBAAiB;IAChC,cAAc,CAAC,oBAAoB;IACnC,cAAc,CAAC,iBAAiB;IAChC,cAAc,CAAC,gBAAgB;IAC/B,cAAc,CAAC,kBAAkB;CAClC,CAAC","sourcesContent":["/**\n * All module names of the main dependencies.\n */\nexport const LIB_MODULES = {\n core: \"@odata2ts/odata-core\",\n qObject: \"@odata2ts/odata-query-objects\",\n clientApi: \"@odata2ts/http-client-api\",\n service: \"@odata2ts/odata-service\",\n};\n\n/**\n * All imported entity names from the core API.\n * Includes versioned file names, i.e. according to OData version.\n */\nexport enum CoreImports {\n DeferredContent,\n ODataCollectionResponse, // versioned\n ODataModelResponseV4,\n ODataValueResponse, // versioned\n ODataEntityModelResponseV2,\n ODataComplexModelResponseV2,\n}\n\n/**\n * For all core imports that are versioned two files exist, one for V2, one for V4.\n * ODataCollectionResponse = ODataCollectionResponseV2 + ODataCollectionResponseV4\n *\n */\nexport const VERSIONED_CORE_IMPORTS = [CoreImports.ODataCollectionResponse, CoreImports.ODataValueResponse];\n\n/**\n * Most relevant, but not all imports from query objects library\n */\nexport enum QueryObjectImports {\n QueryObject = \"QueryObject\",\n ENUMERABLE_PROP_DEFINITION = \"ENUMERABLE_PROP_DEFINITION\",\n QId = \"QId\",\n QFunction = \"QFunction\",\n QAction = \"QAction\",\n EnumCollection = \"EnumCollection\",\n OperationReturnType = \"OperationReturnType\",\n ReturnTypes = \"ReturnTypes\",\n QComplexParam = \"QComplexParam\",\n}\n\n/**\n * All imports from HTTP client API.\n */\nexport enum ClientApiImports {\n ODataHttpClient,\n ODataHttpClientConfig,\n HttpResponseModel,\n}\n\n/**\n * All imports from service library.\n * Includes versioned file names, i.e. according to OData version.\n */\nexport enum ServiceImports {\n ODataService,\n ODataServiceOptions,\n ODataServiceOptionsInternal,\n EntityTypeService,\n PrimitiveTypeService,\n CollectionService,\n EntitySetService,\n ComplexTypeService,\n}\n\n/**\n * For all versioned imports two files exist, one for V2, one for V4.\n * EntityTypeService = EntityTypeServiceV2 + EntityTypeServiceV4\n */\nexport const VERSIONED_SERVICE_IMPORTS = [\n ServiceImports.EntityTypeService,\n ServiceImports.PrimitiveTypeService,\n ServiceImports.CollectionService,\n ServiceImports.EntitySetService,\n ServiceImports.ComplexTypeService,\n];\n"]}
|
|
@@ -168,14 +168,14 @@ export class ProjectManager {
|
|
|
168
168
|
return this.mainQFile;
|
|
169
169
|
}
|
|
170
170
|
createOrGetModelFile(folderPath, name, reservedNames) {
|
|
171
|
-
if (this.
|
|
171
|
+
if (this.options.bundledFileGeneration) {
|
|
172
172
|
return this.mainModelFile;
|
|
173
173
|
}
|
|
174
174
|
// model files always allow for type checking
|
|
175
175
|
return this.createFile(name, reservedNames, folderPath, true);
|
|
176
176
|
}
|
|
177
177
|
createOrGetQObjectFile(folderPath, name, reservedNames) {
|
|
178
|
-
if (this.
|
|
178
|
+
if (this.options.bundledFileGeneration) {
|
|
179
179
|
return this.mainQFile;
|
|
180
180
|
}
|
|
181
181
|
return this.createFile(name, reservedNames, folderPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectManager.js","sourceRoot":"","sources":["../../src/project/ProjectManager.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAmB,OAAO,EAAc,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAahE,MAAM,UAAgB,oBAAoB,CACxC,SAAiB,EACjB,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C,eAAgB,CAAC;SAC9B;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEY,YAAY,CAAC,IAAiB;;YACzC,gGAAgG;YAChG,IACE,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB;gBACnC,IAAI,CAAC,IAAI,KAAK,EAAE;gBAChB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EACxE;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC5B;QACH,CAAC;KAAA;CACF","sourcesContent":["import * as path from \"path\";\nimport { mkdirp } from \"mkdirp\";\nimport { CompilerOptions, Project, SourceFile } from \"ts-morph\";\nimport { firstCharLowerCase } from \"xml2js/lib/processors.js\";\nimport { DataModel } from \"../data-model/DataModel.js\";\nimport { EntityType } from \"../data-model/DataTypeModel.js\";\nimport { NamingHelper } from \"../data-model/NamingHelper.js\";\nimport { ImportContainer } from \"../generator/ImportContainer.js\";\nimport { EmitModes } from \"../OptionModel.js\";\nimport { FileHandler } from \"./FileHandler.js\";\nimport { FileFormatter } from \"./formatter/FileFormatter.js\";\nimport { createFormatter } from \"./formatter/index.js\";\nimport { loadTsMorphCompilerOptions } from \"./TsMorphHelper.js\";\n\nexport interface ProjectManagerOptions {\n usePrettier?: boolean;\n tsConfigPath?: string;\n bundledFileGeneration?: boolean;\n /**\n * for testing purposes, turn this on and retrieve all generated files via getCachedFiles\n */\n noOutput?: boolean;\n allowTypeChecking?: boolean;\n}\n\nexport async function createProjectManager(\n outputDir: string,\n emitMode: EmitModes,\n namingHelper: NamingHelper,\n dataModel: DataModel,\n options: ProjectManagerOptions,\n): Promise<ProjectManager> {\n const { usePrettier = false, tsConfigPath = \"tsconfig.json\" } = options;\n const formatter = usePrettier ? await createFormatter(outputDir, usePrettier) : undefined;\n\n const compilerOpts: CompilerOptions = await loadTsMorphCompilerOptions(tsConfigPath, emitMode, outputDir);\n\n const pm = new ProjectManager(outputDir, emitMode, namingHelper, dataModel, formatter, compilerOpts, {\n usePrettier,\n tsConfigPath,\n ...options,\n });\n\n await pm.init();\n\n return pm;\n}\n\nexport class ProjectManager {\n private project!: Project;\n\n private mainServiceFile: FileHandler | undefined;\n private mainModelFile: FileHandler | undefined;\n private mainQFile: FileHandler | undefined;\n\n private readonly cachedFiles: Map<string, SourceFile> | undefined;\n\n constructor(\n protected outputDir: string,\n protected emitMode: EmitModes,\n protected namingHelper: NamingHelper,\n protected dataModel: DataModel,\n protected formatter: FileFormatter | undefined,\n compilerOptions: CompilerOptions | undefined,\n protected options: ProjectManagerOptions,\n ) {\n // Create ts-morph project\n this.project = new Project({\n // manipulationSettings: this.formatter.getSettings(),\n skipAddingFilesFromTsConfig: true,\n compilerOptions,\n });\n\n if (options.noOutput) {\n this.cachedFiles = new Map();\n }\n }\n\n public getDataModel() {\n return this.dataModel;\n }\n\n /**\n * Only filled when noOutput=true\n */\n public getCachedFiles() {\n return this.cachedFiles!;\n }\n\n private async writeFile(fileHandler: FileHandler) {\n if (this.options.noOutput) {\n await fileHandler.write(this.emitMode, true);\n this.cachedFiles!.set(fileHandler.getFullFilePath(), fileHandler.getFile());\n\n return;\n }\n\n return fileHandler.write(this.emitMode);\n }\n\n private createFile(\n name: string,\n reservedNames?: Array<string> | undefined,\n additionalPath: string = \"\",\n forceTypeChecking = false,\n ): FileHandler {\n const fileName = path.join(this.outputDir, additionalPath, `${name}.ts`);\n const imports = new ImportContainer(\n additionalPath,\n name,\n this.dataModel,\n this.namingHelper.getFileNames(),\n !!this.options.bundledFileGeneration,\n reservedNames,\n );\n\n return new FileHandler(\n additionalPath,\n name,\n this.project.createSourceFile(fileName),\n imports,\n this.formatter,\n forceTypeChecking || !!this.options.allowTypeChecking,\n );\n }\n\n public async init() {\n if (!this.options.bundledFileGeneration) {\n // ensure folder for each model: we do this at this point for performance reasons\n await Promise.all(this.dataModel.getModelTypes().map((mt) => mkdirp(path.join(this.outputDir, mt.folderPath))));\n }\n }\n\n public initModels() {\n if (this.options.bundledFileGeneration) {\n // collect reserved names, that is names of classes we're going to create => imports must take them into account\n const reservedWords = this.dataModel.getModelTypes().reduce<Array<string>>((collector, model) => {\n const asEntityType = model as EntityType;\n collector.push(model.modelName);\n if (asEntityType.editableName) {\n collector.push(asEntityType.editableName);\n }\n if (asEntityType.id?.modelName) {\n collector.push(asEntityType.id.modelName);\n }\n this.dataModel.getAllEntityOperations(model.fqName).forEach((op) => {\n if (op.parameters.length) {\n collector.push(op.paramsModelName);\n }\n });\n\n return collector;\n }, []);\n this.dataModel.getUnboundOperationTypes().forEach((op) => {\n if (op.parameters.length) {\n reservedWords.push(op.paramsModelName);\n }\n });\n\n this.mainModelFile = this.createFile(this.namingHelper.getFileNames().model, reservedWords);\n }\n }\n\n public async finalizeModels() {\n if (\n this.mainModelFile &&\n (this.options.bundledFileGeneration || this.mainModelFile.getFile().getFullText().length)\n ) {\n await this.writeFile(this.mainModelFile);\n }\n }\n\n public initQObjects() {\n if (this.options.bundledFileGeneration) {\n // collect reserved names, that is names of classes we're going to create => imports must take them into account\n const reservedWords = this.dataModel.getModelTypes().reduce<Array<string>>((collector, model) => {\n const asEntityType = model as EntityType;\n if (asEntityType.qName) {\n collector.push(asEntityType.qName, firstCharLowerCase(asEntityType.qName));\n }\n if (asEntityType.id?.qName) {\n collector.push(asEntityType.id.qName);\n }\n this.dataModel.getAllEntityOperations(model.fqName).forEach((op) => {\n collector.push(op.qName);\n });\n\n return collector;\n }, []);\n this.dataModel.getUnboundOperationTypes().forEach((op) => {\n reservedWords.push(op.qName);\n });\n\n this.mainQFile = this.createFile(this.namingHelper.getFileNames().qObject, reservedWords);\n }\n }\n\n public async finalizeQObjects() {\n if (this.mainQFile && (this.options.bundledFileGeneration || this.mainQFile.getFile().getFullText().length)) {\n await this.writeFile(this.mainQFile);\n }\n }\n\n public initServices() {\n const mainServiceName = this.namingHelper.getMainServiceName();\n const reservedNames = [mainServiceName];\n\n if (this.options.bundledFileGeneration) {\n [...this.dataModel.getEntityTypes(), ...this.dataModel.getComplexTypes()].reduce((collector, model) => {\n collector.push(model.serviceName, model.serviceCollectionName);\n return collector;\n }, reservedNames);\n }\n\n this.mainServiceFile = this.createFile(mainServiceName, reservedNames);\n }\n\n public async finalizeServices() {\n if (this.mainServiceFile) {\n await this.writeFile(this.mainServiceFile);\n }\n }\n\n public getMainServiceFile() {\n return this.mainServiceFile!;\n }\n\n public createOrGetMainModelFile(reservedNames?: Array<string>) {\n if (!this.mainModelFile) {\n this.mainModelFile = this.createFile(this.namingHelper.getFileNames().model, reservedNames, \"\", true);\n }\n return this.mainModelFile;\n }\n\n public createOrGetMainQObjectFile(reservedNames?: Array<string>) {\n if (!this.mainQFile) {\n this.mainQFile = this.createFile(this.namingHelper.getFileNames().qObject, reservedNames);\n }\n return this.mainQFile;\n }\n\n public createOrGetModelFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.mainModelFile) {\n return this.mainModelFile;\n }\n\n // model files always allow for type checking\n return this.createFile(name, reservedNames, folderPath, true);\n }\n public createOrGetQObjectFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.mainQFile) {\n return this.mainQFile;\n }\n\n return this.createFile(name, reservedNames, folderPath);\n }\n public createOrGetServiceFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.options.bundledFileGeneration) {\n return this.mainServiceFile!;\n }\n\n return this.createFile(name, reservedNames, folderPath);\n }\n\n public async finalizeFile(file: FileHandler) {\n // write individual files in unbundled mode & if this is not one of the main files on root level\n if (\n !this.options.bundledFileGeneration &&\n file.path !== \"\" &&\n !Object.values(this.namingHelper.getFileNames()).includes(file.fileName)\n ) {\n await this.writeFile(file);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ProjectManager.js","sourceRoot":"","sources":["../../src/project/ProjectManager.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,aAAc,CAAC;SAC5B;QAED,6CAA6C;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IACM,sBAAsB,CAAC,UAAkB,EAAE,IAAY,EAAE,aAAyC;QACvG,IAAI,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;YACtC,OAAO,IAAI,CAAC,SAAU,CAAC;SACxB;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IACM,sBAAsB,CAAC,UAAkB,EAAE,IAAY,EAAE,aAAyC;QACvG,IAAI,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;YACtC,OAAO,IAAI,CAAC,eAAgB,CAAC;SAC9B;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEY,YAAY,CAAC,IAAiB;;YACzC,gGAAgG;YAChG,IACE,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB;gBACnC,IAAI,CAAC,IAAI,KAAK,EAAE;gBAChB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EACxE;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC5B;QACH,CAAC;KAAA;CACF","sourcesContent":["import * as path from \"path\";\nimport { mkdirp } from \"mkdirp\";\nimport { CompilerOptions, Project, SourceFile } from \"ts-morph\";\nimport { firstCharLowerCase } from \"xml2js/lib/processors.js\";\nimport { DataModel } from \"../data-model/DataModel.js\";\nimport { EntityType } from \"../data-model/DataTypeModel.js\";\nimport { NamingHelper } from \"../data-model/NamingHelper.js\";\nimport { ImportContainer } from \"../generator/ImportContainer.js\";\nimport { EmitModes } from \"../OptionModel.js\";\nimport { FileHandler } from \"./FileHandler.js\";\nimport { FileFormatter } from \"./formatter/FileFormatter.js\";\nimport { createFormatter } from \"./formatter/index.js\";\nimport { loadTsMorphCompilerOptions } from \"./TsMorphHelper.js\";\n\nexport interface ProjectManagerOptions {\n usePrettier?: boolean;\n tsConfigPath?: string;\n bundledFileGeneration?: boolean;\n /**\n * for testing purposes, turn this on and retrieve all generated files via getCachedFiles\n */\n noOutput?: boolean;\n allowTypeChecking?: boolean;\n}\n\nexport async function createProjectManager(\n outputDir: string,\n emitMode: EmitModes,\n namingHelper: NamingHelper,\n dataModel: DataModel,\n options: ProjectManagerOptions,\n): Promise<ProjectManager> {\n const { usePrettier = false, tsConfigPath = \"tsconfig.json\" } = options;\n const formatter = usePrettier ? await createFormatter(outputDir, usePrettier) : undefined;\n\n const compilerOpts: CompilerOptions = await loadTsMorphCompilerOptions(tsConfigPath, emitMode, outputDir);\n\n const pm = new ProjectManager(outputDir, emitMode, namingHelper, dataModel, formatter, compilerOpts, {\n usePrettier,\n tsConfigPath,\n ...options,\n });\n\n await pm.init();\n\n return pm;\n}\n\nexport class ProjectManager {\n private project!: Project;\n\n private mainServiceFile: FileHandler | undefined;\n private mainModelFile: FileHandler | undefined;\n private mainQFile: FileHandler | undefined;\n\n private readonly cachedFiles: Map<string, SourceFile> | undefined;\n\n constructor(\n protected outputDir: string,\n protected emitMode: EmitModes,\n protected namingHelper: NamingHelper,\n protected dataModel: DataModel,\n protected formatter: FileFormatter | undefined,\n compilerOptions: CompilerOptions | undefined,\n protected options: ProjectManagerOptions,\n ) {\n // Create ts-morph project\n this.project = new Project({\n // manipulationSettings: this.formatter.getSettings(),\n skipAddingFilesFromTsConfig: true,\n compilerOptions,\n });\n\n if (options.noOutput) {\n this.cachedFiles = new Map();\n }\n }\n\n public getDataModel() {\n return this.dataModel;\n }\n\n /**\n * Only filled when noOutput=true\n */\n public getCachedFiles() {\n return this.cachedFiles!;\n }\n\n private async writeFile(fileHandler: FileHandler) {\n if (this.options.noOutput) {\n await fileHandler.write(this.emitMode, true);\n this.cachedFiles!.set(fileHandler.getFullFilePath(), fileHandler.getFile());\n\n return;\n }\n\n return fileHandler.write(this.emitMode);\n }\n\n private createFile(\n name: string,\n reservedNames?: Array<string> | undefined,\n additionalPath: string = \"\",\n forceTypeChecking = false,\n ): FileHandler {\n const fileName = path.join(this.outputDir, additionalPath, `${name}.ts`);\n const imports = new ImportContainer(\n additionalPath,\n name,\n this.dataModel,\n this.namingHelper.getFileNames(),\n !!this.options.bundledFileGeneration,\n reservedNames,\n );\n\n return new FileHandler(\n additionalPath,\n name,\n this.project.createSourceFile(fileName),\n imports,\n this.formatter,\n forceTypeChecking || !!this.options.allowTypeChecking,\n );\n }\n\n public async init() {\n if (!this.options.bundledFileGeneration) {\n // ensure folder for each model: we do this at this point for performance reasons\n await Promise.all(this.dataModel.getModelTypes().map((mt) => mkdirp(path.join(this.outputDir, mt.folderPath))));\n }\n }\n\n public initModels() {\n if (this.options.bundledFileGeneration) {\n // collect reserved names, that is names of classes we're going to create => imports must take them into account\n const reservedWords = this.dataModel.getModelTypes().reduce<Array<string>>((collector, model) => {\n const asEntityType = model as EntityType;\n collector.push(model.modelName);\n if (asEntityType.editableName) {\n collector.push(asEntityType.editableName);\n }\n if (asEntityType.id?.modelName) {\n collector.push(asEntityType.id.modelName);\n }\n this.dataModel.getAllEntityOperations(model.fqName).forEach((op) => {\n if (op.parameters.length) {\n collector.push(op.paramsModelName);\n }\n });\n\n return collector;\n }, []);\n this.dataModel.getUnboundOperationTypes().forEach((op) => {\n if (op.parameters.length) {\n reservedWords.push(op.paramsModelName);\n }\n });\n\n this.mainModelFile = this.createFile(this.namingHelper.getFileNames().model, reservedWords);\n }\n }\n\n public async finalizeModels() {\n if (\n this.mainModelFile &&\n (this.options.bundledFileGeneration || this.mainModelFile.getFile().getFullText().length)\n ) {\n await this.writeFile(this.mainModelFile);\n }\n }\n\n public initQObjects() {\n if (this.options.bundledFileGeneration) {\n // collect reserved names, that is names of classes we're going to create => imports must take them into account\n const reservedWords = this.dataModel.getModelTypes().reduce<Array<string>>((collector, model) => {\n const asEntityType = model as EntityType;\n if (asEntityType.qName) {\n collector.push(asEntityType.qName, firstCharLowerCase(asEntityType.qName));\n }\n if (asEntityType.id?.qName) {\n collector.push(asEntityType.id.qName);\n }\n this.dataModel.getAllEntityOperations(model.fqName).forEach((op) => {\n collector.push(op.qName);\n });\n\n return collector;\n }, []);\n this.dataModel.getUnboundOperationTypes().forEach((op) => {\n reservedWords.push(op.qName);\n });\n\n this.mainQFile = this.createFile(this.namingHelper.getFileNames().qObject, reservedWords);\n }\n }\n\n public async finalizeQObjects() {\n if (this.mainQFile && (this.options.bundledFileGeneration || this.mainQFile.getFile().getFullText().length)) {\n await this.writeFile(this.mainQFile);\n }\n }\n\n public initServices() {\n const mainServiceName = this.namingHelper.getMainServiceName();\n const reservedNames = [mainServiceName];\n\n if (this.options.bundledFileGeneration) {\n [...this.dataModel.getEntityTypes(), ...this.dataModel.getComplexTypes()].reduce((collector, model) => {\n collector.push(model.serviceName, model.serviceCollectionName);\n return collector;\n }, reservedNames);\n }\n\n this.mainServiceFile = this.createFile(mainServiceName, reservedNames);\n }\n\n public async finalizeServices() {\n if (this.mainServiceFile) {\n await this.writeFile(this.mainServiceFile);\n }\n }\n\n public getMainServiceFile() {\n return this.mainServiceFile!;\n }\n\n public createOrGetMainModelFile(reservedNames?: Array<string>) {\n if (!this.mainModelFile) {\n this.mainModelFile = this.createFile(this.namingHelper.getFileNames().model, reservedNames, \"\", true);\n }\n return this.mainModelFile;\n }\n\n public createOrGetMainQObjectFile(reservedNames?: Array<string>) {\n if (!this.mainQFile) {\n this.mainQFile = this.createFile(this.namingHelper.getFileNames().qObject, reservedNames);\n }\n return this.mainQFile;\n }\n\n public createOrGetModelFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.options.bundledFileGeneration) {\n return this.mainModelFile!;\n }\n\n // model files always allow for type checking\n return this.createFile(name, reservedNames, folderPath, true);\n }\n public createOrGetQObjectFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.options.bundledFileGeneration) {\n return this.mainQFile!;\n }\n\n return this.createFile(name, reservedNames, folderPath);\n }\n public createOrGetServiceFile(folderPath: string, name: string, reservedNames?: Array<string> | undefined) {\n if (this.options.bundledFileGeneration) {\n return this.mainServiceFile!;\n }\n\n return this.createFile(name, reservedNames, folderPath);\n }\n\n public async finalizeFile(file: FileHandler) {\n // write individual files in unbundled mode & if this is not one of the main files on root level\n if (\n !this.options.bundledFileGeneration &&\n file.path !== \"\" &&\n !Object.values(this.namingHelper.getFileNames()).includes(file.fileName)\n ) {\n await this.writeFile(file);\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odata2ts/odata2ts",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"description": "Flexible generator to produce various TypeScript artefacts (from simple model interfaces to complete odata clients) from OData metadata files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"odata2ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@odata2ts/converter-api": "^0.2.5",
|
|
49
49
|
"@odata2ts/converter-runtime": "^0.5.5",
|
|
50
|
-
"@odata2ts/http-client-api": "^0.6.
|
|
50
|
+
"@odata2ts/http-client-api": "^0.6.5",
|
|
51
51
|
"@odata2ts/odata-core": "^0.6.1",
|
|
52
52
|
"@prettier/plugin-xml": "^3.4.1",
|
|
53
53
|
"@types/xml2js": "^0.4.11",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@odata2ts/converter-v2-to-v4": "^0.5.1",
|
|
71
|
-
"@odata2ts/odata-query-objects": "^0.28.
|
|
72
|
-
"@odata2ts/odata-service": "^0.23.
|
|
71
|
+
"@odata2ts/odata-query-objects": "^0.28.2",
|
|
72
|
+
"@odata2ts/odata-service": "^0.23.2",
|
|
73
73
|
"@odata2ts/test-converters": "^0.5.0",
|
|
74
74
|
"@types/node": "^22.4.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@odata2ts/odata-query-objects": "^0.28.
|
|
78
|
-
"@odata2ts/odata-service": "^0.23.
|
|
77
|
+
"@odata2ts/odata-query-objects": "^0.28.2",
|
|
78
|
+
"@odata2ts/odata-service": "^0.23.2",
|
|
79
79
|
"typescript": ">= 4.7"
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|