Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/cds-odata-annotation-converter

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/cds-odata-annotation-converter

Converter for OData annotations in CDS format.

  • 0.3.9
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
5.3K
decreased by-77.05%
Maintainers
0
Weekly downloads
 
Created
Source

CDS OData Annotation Converter

Installation

Npm npm install --save @sap-ux/cds-odata-annotation-converter

Yarn yarn add @sap-ux/cds-odata-annotation-converter

Pnpm pnpm add @sap-ux/cds-odata-annotation-converter

Usage

Convert CDS annotationAstNodes to annotation file format from @sap-ux/odata-annotation-core-types.

import { createCdsCompilerFacade, createMetadataCollector } from '@sap/ux-cds-compiler-facade';
import { toAnnotationFile, toTargetMap  } from '@sap-ux/cds-odata-annotation-converter';
import { VocabularyService } from '@sap-ux/odata-vocabularies';

const uri = 'file://my-service.cds';
const vocabularyService = new VocabularyService(true);
const facade = createCdsCompilerFacade(compileModel);
const cdsAnnotationFile = toTargetMap(fileIndex, uri, vocabularyService, facade);
const metadataElementMap = new Map();
const metadataCollector = createMetadataCollector(metadataElementMap, facade);
const { file: annotationFile } = toAnnotationFile(
    uri,
    vocabularyService,
    cdsAnnotationFile,
    metadataCollector
);

Generate CDS annotation text fragment.

import { print } from '@sap-ux/cds-odata-annotation-converter';
import { Edm, createElementNode, createAttributeNode } from '@sap-ux/odata-annotation-core-types';

const element = createElementNode({
    name: Edm.PropertyValue,
    attributes: {
        [Edm.Property]: createAttributeNode(Edm.Property, 'Target'),
        [Edm.AnnotationPath]: createAttributeNode(Edm.AnnotationPath, '$0')
    },
});

// "Target : '$0'"
const text = print(element);

Keywords

OData CAP CDS annotations

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc