Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @sap/cloud-sdk-generator

@sap/cloud-sdk-generator

Generate your own service module using a service specification (.edmx file).

Installation

npm install @sap/cloud-sdk-generator

Usage

The generator is primarily meant to be used on the command line:

generate-odata-client --inputDir path/to/your/service-specification(s) --outputDir path/where/the/modules/are/stored

Run generate-odata-client --help for further options.

You can also use the generator programatically. You will have to provide the options anyways.

import { generateProject } from '@sap/cloud-sdk-generator';

// initialize generator options based on what you want to do
const options: GeneratorOptions = initializeOptions();

// creates a Project datastructure with all sourcefiles based on your options
const project = generateProject(options);

// here you can modify you project if you need to

// save the files at the specified location
project.save();

// alternatively you can generate and save the project in one step with: generate(options)

Index

Enumerations

Classes

Interfaces

Variables

Functions

Variables

Const VALUE_IS_UNDEFINED

VALUE_IS_UNDEFINED: "VALUE_IS_UNDEFINED" = "VALUE_IS_UNDEFINED"

Const applyPrefixOnJsConfictFunctionImports

applyPrefixOnJsConfictFunctionImports: (Anonymous function) = applyPrefixOnJSReservedWords('f')

Const applyPrefixOnJsConfictParam

applyPrefixOnJsConfictParam: (Anonymous function) = applyPrefixOnJSReservedWords('p')

Const applySuffixOnConflictDash

applySuffixOnConflictDash: (Anonymous function) = applySuffixOnConflict('-')

Const applySuffixOnConflictUnderscore

applySuffixOnConflictUnderscore: (Anonymous function) = applySuffixOnConflict('_')

Functions

builderFunction

  • builderFunction(complexType: VdmComplexType): FunctionDeclarationStructure
  • Parameters

    Returns FunctionDeclarationStructure

cloudSdkVdmHack

  • cloudSdkVdmHack(name: string): string
  • Parameters

    • name: string

    Returns string

complexTypeImportDeclarations

  • complexTypeImportDeclarations(properties: VdmProperty[]): ImportDeclarationStructure[]
  • Parameters

    Returns ImportDeclarationStructure[]

complexTypeInterface

  • complexTypeInterface(complexType: VdmComplexType): InterfaceDeclarationStructure
  • Parameters

    Returns InterfaceDeclarationStructure

complexTypeNamespace

  • complexTypeNamespace(complexType: VdmComplexType): NamespaceDeclarationStructure
  • Parameters

    Returns NamespaceDeclarationStructure

complexTypeSourceFile

  • complexTypeSourceFile(complexType: VdmComplexType): SourceFileStructure
  • Parameters

    Returns SourceFileStructure

copyFile

  • copyFile(fromPath: string, toRelativePath: string, toDirectory: Directory, overwrite: boolean): void
  • Parameters

    • fromPath: string
    • toRelativePath: string
    • toDirectory: Directory
    • overwrite: boolean

    Returns void

coreImportDeclaration

  • coreImportDeclaration(namedImports: string[]): ImportDeclarationStructure
  • Parameters

    • namedImports: string[]

    Returns ImportDeclarationStructure

coreNavPropertyFieldTypeImportNames

  • Parameters

    Returns string[]

corePropertyFieldTypeImportNames

  • corePropertyFieldTypeImportNames(properties: VdmProperty[]): string[]
  • Parameters

    Returns string[]

corePropertyTypeImportNames

  • Parameters

    Returns string[]

edmToComplexPropertyType

  • edmToComplexPropertyType(edmType: string): string
  • Parameters

    • edmType: string

    Returns string

edmToFieldType

  • edmToFieldType(edmType: string): string
  • Parameters

    • edmType: string

    Returns string

edmToTsType

  • edmToTsType(edmType: string): string
  • Parameters

    • edmType: string

    Returns string

edmxPaths

  • edmxPaths(input: PathLike): PathLike[]
  • Parameters

    • input: PathLike

    Returns PathLike[]

endWithDot

  • endWithDot(text: string): string
  • Parameters

    • text: string

    Returns string

ensureString

  • ensureString(obj: any): string
  • Parameters

    • obj: any

    Returns string

entityClass

  • Parameters

    Returns ClassDeclarationStructure

entityNamespace

  • Parameters

    Returns NamespaceDeclarationStructure

entitySourceFile

entityTypeInterface

  • Parameters

    Returns InterfaceDeclarationStructure

exportStatement

  • Parameters

    Returns VariableStatementStructure

externalImportDeclaration

  • externalImportDeclaration(properties: VdmMappedEdmType[], moduleSpecifier: string, namedImports: string[]): ImportDeclarationStructure
  • Parameters

    Returns ImportDeclarationStructure

externalImportDeclarations

  • externalImportDeclarations(properties: VdmMappedEdmType[]): ImportDeclarationStructure[]
  • Parameters

    Returns ImportDeclarationStructure[]

fieldTypeClass

  • fieldTypeClass(complexType: VdmComplexType): ClassDeclarationStructure
  • Parameters

    Returns ClassDeclarationStructure

forceArray

  • forceArray(obj: any): any[]
  • Parameters

    • obj: any

    Returns any[]

functionImportFunction

functionImportParamtersInterface

  • functionImportParamtersInterface(functionImport: VdmFunctionImport): InterfaceDeclarationStructure
  • Parameters

    Returns InterfaceDeclarationStructure

functionImportSourceFile

  • Parameters

    Returns SourceFileStructure

generate

  • Parameters

    Returns Promise<void | DirectoryEmitResult[]>

generateProject

  • Parameters

    Returns Project

generateSourcesForService

Const genericDescription

  • genericDescription(packageName: string): string
  • Parameters

    • packageName: string

    Returns string

getComplexTypeFieldDescription

  • Parameters

    Returns string

getComplexTypePropertyDescription

  • getComplexTypePropertyDescription(property: VdmProperty, complexTypeName: string): string
  • Parameters

    Returns string

getEntityDescription

getFunctionDoc

  • getFunctionDoc(description: string, tags: Partial<object>): string
  • Parameters

    • description: string
    • tags: Partial<object>

    Returns string

getNavPropertyDescription

getPropertyDescription

getRequestBuilderDescription

  • getRequestBuilderDescription(entity: VdmEntity): string
  • Parameters

    Returns string

getRoot

  • getRoot(edmx: any): any
  • Parameters

    • edmx: any

    Returns any

getStaticNavPropertyDescription

getStaticPropertyDescription

  • getStaticPropertyDescription(property: VdmProperty): string
  • Parameters

    Returns string

importDeclarations

  • importDeclarations(complexType: VdmComplexType): ImportDeclarationStructure[]
  • Parameters

    Returns ImportDeclarationStructure[]

importDeclarations

  • importDeclarations(entity: VdmEntity): ImportDeclarationStructure[]
  • Parameters

    Returns ImportDeclarationStructure[]

importDeclarations

  • Parameters

    Returns ImportDeclarationStructure[]

importDeclarations

  • importDeclarations(entity: VdmEntity): ImportDeclarationStructure[]
  • Parameters

    Returns ImportDeclarationStructure[]

indexFile

  • Parameters

    Returns SourceFileStructure

inputPaths

  • Parameters

    • input: PathLike
    • useSwagger: boolean

    Returns ServiceDefinitionPaths[]

isCreatable

  • isCreatable(entity: any): boolean
  • Parameters

    • entity: any

    Returns boolean

isDeletable

  • isDeletable(entity: any): boolean
  • Parameters

    • entity: any

    Returns boolean

isFilterable

  • isFilterable(property: any): boolean
  • Parameters

    • property: any

    Returns boolean

isNullableParameter

  • isNullableParameter(parameter: any): boolean
  • Parameters

    • parameter: any

    Returns boolean

isNullableProperty

  • isNullableProperty(property: any): boolean
  • Parameters

    • property: any

    Returns boolean

isSortable

  • isSortable(property: any): boolean
  • Parameters

    • property: any

    Returns boolean

isUpdatable

  • isUpdatable(entity: any): boolean
  • Parameters

    • entity: any

    Returns boolean

linkClass

  • Parameters

    Returns string

mergeImportDeclarations

  • mergeImportDeclarations(importDeclarations: ImportDeclarationStructure[]): any[]
  • Parameters

    • importDeclarations: ImportDeclarationStructure[]

    Returns any[]

npmCompliantName

  • npmCompliantName(name: string): string
  • Takes a name and returns a transformation that is guaranteed to be compliant with npm naming rules.

    Parameters

    • name: string

      The name to be transformed if necessary.

    Returns string

    Name that is guaranteed to be compliant.

npmrc

  • npmrc(): string
  • Returns string

otherEntityImports

  • Parameters

    Returns ImportDeclarationStructure[]

otherFile

  • otherFile(directory: Directory, relativePath: string, content: string, overwrite: boolean): SourceFile
  • Parameters

    • directory: Directory
    • relativePath: string
    • content: string
    • overwrite: boolean

    Returns SourceFile

packageJson

  • packageJson(npmPackageName: string, dependencies: string[], version: string): string
  • Parameters

    • npmPackageName: string
    • dependencies: string[]
    • version: string

    Returns string

packgeJson

  • packgeJson(npmPackageName: string, version: string, description: string, sdkAfterVersionScript: boolean): string
  • Parameters

    • npmPackageName: string
    • version: string
    • description: string
    • sdkAfterVersionScript: boolean

    Returns string

parseAllServices

parseCmdArgs

parseEdmxFromPath

  • Parameters

    • edmxPath: PathLike

    Returns EdmxMetadata

parseService

parseSwaggerFromPath

  • Parameters

    • swaggerPath: PathLike

    Returns SwaggerMetadata

prefixString

  • prefixString(string: string, prefix?: string): string
  • Applies a prefix to a string if present.

    Parameters

    • string: string

      The string to be prefixed.

    • Optional prefix: string

      The optional prefix.

    Returns string

    Prefixed string.

prependPrefix

  • prependPrefix(name: string): string
  • Parameters

    • name: string

    Returns string

readServiceMapping

readme

  • Parameters

    Returns string

readme

  • Parameters

    Returns string

requestBuilderClass

  • requestBuilderClass(entity: VdmEntity): ClassDeclarationStructure
  • Parameters

    Returns ClassDeclarationStructure

requestBuilderSourceFile

  • requestBuilderSourceFile(entity: VdmEntity): SourceFileStructure
  • Parameters

    Returns SourceFileStructure

responseTransformerFunctionName

  • Parameters

    Returns string

Const s4hanaCloudDescription

  • s4hanaCloudDescription(packageName: string): string
  • Parameters

    • packageName: string

    Returns string

serviceMapping

serviceMappingFile

  • Parameters

    Returns string

sourceFile

  • sourceFile(directory: Directory, relativePath: string, content: SourceFileStructure, overwrite: boolean): SourceFile
  • Parameters

    • directory: Directory
    • relativePath: string
    • content: SourceFileStructure
    • overwrite: boolean

    Returns SourceFile

stripPrefix

  • stripPrefix(name: string): string
  • Parameters

    • name: string

    Returns string

stripType

  • stripType(name: string): string
  • Parameters

    • name: string

    Returns string

tsConfig

  • tsConfig(): string
  • Returns string

typedocJson

  • typedocJson(): string
  • Returns string