0.5.54 • Published 8 months ago

@sap-ux/odata-service-inquirer v0.5.54

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

@sap-ux/odata-service-inquirer

Provides Inquirer based end-user prompting to allow selection of a service from multiple data source types. This involves acquiring a connection to backend systems and retrieving edmx metadata for services provided by the catalog, from a local file or CAP project.

Note: Current implementation is limited to metadata file and Local Cap projects as datasources only.

Installation

Npm npm install --save @sap-ux/odata-service-inquirer

Yarn yarn add @sap-ux/odata-service-inquirer

Pnpm pnpm add @sap-ux/odata-service-inquirer

Explainer

Prompts may be retrieved using getPrompts and then executed in another prompting module that supports inquirer type prompts.

getPrompts is provided to allow consumers to access prompts. There may be cases where these can be transformed to support other prompting frameworks. Most prompt configuration is possible via OdataServiceInquirerOptions and calling prompt. This is the recommended approach.

Configurability of prompts is entirely controlled using the OdataServiceInquirerOptions parameter.

See Inquirer.js for valid default properties.

Odata Service Inquirer usage example:

import type { InquirerAdapter } from '@sap-ux/inquirer-common';
import type { OdataServiceAnswers, OdataServicePromptOptions } from '@sap-ux/odata-service-inquirer';
import { DatasourceType, prompt as serviceInquirerPrompt, CapService } from '@sap-ux/odata-service-inquirer';
import { generate as generateOdataService, OdataService, ServiceType } from '@sap-ux/odata-service-writer'
...
    const promptOpts = {
        datasourceType: {
            default: DatasourceType.capProject
        },
        metadata: {
            requiredOdataVersion: OdataVersion.v4
        },
        capProject: {
            capSearchPaths: this.workspaceFolders, // Pass VSCode workspace folders, for example, or any array of path strings
            defaultChoice: `/local/cap/project/path`
        },
        capService: {
            defaultChoice: {
                projectPath: '/local/cap/project/path',
                serviceName: 'MainOnlineService'
            }
        }
    } as OdataServicePromptOptions;

    /**
     * Pass an Inquirer prompt function https://www.npmjs.com/package/inquirer#methods
     */
    const inqAdaptor = {
        prompt: this.prompt.bind(this) // the inquirer prompting function, here we use the generators reference
    };

    const serviceAnswers: OdataServiceAnswers = await serviceInquirerPrompt(
        inqAdaptor as InquirerAdapter,
        promptOpts
    );

    const odataService: OdataService = {
        type: serviceAnswers.capService ? ServiceType.CDS : ServiceType.EDMX,
        url: serviceAnswers.metadata ? undefined : 'http://localhost',
        path: serviceAnswers.servicePath,
        metadata: serviceAnswers.metadata,
        version: serviceAnswers.odataVersion
    }
    generateOdataService(serviceAnswers.capService.projectPath, odataService);

...

License

Read License.

Keywords

SAP UI5 Application Inquirer Prompting Generator

0.5.54

8 months ago

0.5.52

8 months ago

0.5.53

8 months ago

0.5.50

9 months ago

0.5.51

9 months ago

0.5.49

9 months ago

0.5.48

9 months ago

0.5.47

9 months ago

0.5.46

9 months ago

0.5.43

9 months ago

0.5.44

9 months ago

0.5.45

9 months ago

0.5.41

10 months ago

0.5.42

10 months ago

0.5.40

10 months ago

0.5.38

10 months ago

0.5.39

10 months ago

0.5.37

10 months ago

0.5.36

10 months ago

0.5.35

10 months ago

0.5.32

11 months ago

0.5.33

10 months ago

0.5.30

11 months ago

0.5.31

11 months ago

0.5.34

10 months ago

0.5.29

11 months ago

0.5.10

11 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.4.9

12 months ago

0.1.12

1 year ago

0.4.8

12 months ago

0.5.18

11 months ago

0.5.16

11 months ago

0.5.17

11 months ago

0.5.14

11 months ago

0.5.15

11 months ago

0.5.12

11 months ago

0.5.13

11 months ago

0.3.0

1 year ago

0.5.4

12 months ago

0.3.6

1 year ago

0.1.8

1 year ago

0.5.3

12 months ago

0.3.5

1 year ago

0.5.6

11 months ago

0.3.8

1 year ago

0.5.5

12 months ago

0.3.7

1 year ago

0.1.9

1 year ago

0.5.0

12 months ago

0.3.2

1 year ago

0.3.1

1 year ago

0.5.2

12 months ago

0.3.4

1 year ago

0.5.1

12 months ago

0.3.3

1 year ago

0.3.9

1 year ago

0.5.9

11 months ago

0.3.11

1 year ago

0.3.10

1 year ago

0.5.21

11 months ago

0.5.22

11 months ago

0.5.20

11 months ago

0.5.27

11 months ago

0.5.28

11 months ago

0.5.25

11 months ago

0.5.26

11 months ago

0.5.23

11 months ago

0.5.24

11 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.4.4

12 months ago

0.4.7

12 months ago

0.4.6

12 months ago

0.4.1

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago