Compare commits
2 Commits
eslint-fla
...
typed-samp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d41f8e4ec | ||
|
|
f891be5251 |
3
bookshop/@types/_/index.js
Normal file
3
bookshop/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
bookshop/@types/_/index.ts
Normal file
35
bookshop/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
bookshop/@types/index.js
Normal file
3
bookshop/@types/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('')
|
||||
57
bookshop/@types/index.ts
Normal file
57
bookshop/@types/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_common from './sap/common';
|
||||
import * as __ from './_';
|
||||
|
||||
export type Language = __.Association.to<_sap_common.Language>;
|
||||
export type Currency = __.Association.to<_sap_common.Currency>;
|
||||
export type Country = __.Association.to<_sap_common.Country>;
|
||||
export type User = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'cuid'
|
||||
export function cuid<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class cuidAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const cuidXtended = cuid(__.Entity)
|
||||
export type cuid = InstanceType<typeof cuidXtended>
|
||||
|
||||
// the following represents the CDS aspect 'managed'
|
||||
export function managed<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class managedAspect extends Base {
|
||||
createdAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
createdBy: User;
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
modifiedBy: User;
|
||||
};
|
||||
}
|
||||
const managedXtended = managed(__.Entity)
|
||||
export type managed = InstanceType<typeof managedXtended>
|
||||
|
||||
// the following represents the CDS aspect 'temporal'
|
||||
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class temporalAspect extends Base {
|
||||
validFrom: Date;
|
||||
validTo: Date;
|
||||
};
|
||||
}
|
||||
const temporalXtended = temporal(__.Entity)
|
||||
export type temporal = InstanceType<typeof temporalXtended>
|
||||
|
||||
// the following represents the CDS aspect 'extensible'
|
||||
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class extensibleAspect extends Base {
|
||||
extensions__: string;
|
||||
};
|
||||
}
|
||||
const extensibleXtended = extensible(__.Entity)
|
||||
export type extensible = InstanceType<typeof extensibleXtended>
|
||||
|
||||
|
||||
9
bookshop/@types/sap/capire/bookshop/index.js
Normal file
9
bookshop/@types/sap/capire/bookshop/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.bookshop')
|
||||
module.exports.Book = cson.Books
|
||||
module.exports.Books = cson.Books
|
||||
module.exports.Author = cson.Authors
|
||||
module.exports.Authors = cson.Authors
|
||||
module.exports.Genre = cson.Genres
|
||||
module.exports.Genres = cson.Genres
|
||||
66
bookshop/@types/sap/capire/bookshop/index.ts
Normal file
66
bookshop/@types/sap/capire/bookshop/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _ from './../../..';
|
||||
import * as _sap_common from './../../common';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Book<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class BookAspect extends Base {
|
||||
ID: number;
|
||||
title: string;
|
||||
descr: string;
|
||||
author: __.Association.to<Author>;
|
||||
genre: __.Association.to<Genre>;
|
||||
stock: number;
|
||||
price: number;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
image: string;
|
||||
};
|
||||
}
|
||||
const BookXtended = _.managed(Book(__.Entity))
|
||||
export type Book = InstanceType<typeof BookXtended>
|
||||
|
||||
export class Books extends Array<Book> {
|
||||
}
|
||||
|
||||
export function Author<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class AuthorAspect extends Base {
|
||||
ID: number;
|
||||
name: string;
|
||||
dateOfBirth: Date;
|
||||
dateOfDeath: Date;
|
||||
placeOfBirth: string;
|
||||
placeOfDeath: string;
|
||||
books: __.Association.to.many<Books>;
|
||||
};
|
||||
}
|
||||
const AuthorXtended = _.managed(Author(__.Entity))
|
||||
export type Author = InstanceType<typeof AuthorXtended>
|
||||
|
||||
export class Authors extends Array<Author> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hierarchically organized Code List for Genres
|
||||
*/
|
||||
export function Genre<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class GenreAspect extends Base {
|
||||
ID: number;
|
||||
parent: __.Association.to<Genre>;
|
||||
children: __.Composition.of.many<Genres>;
|
||||
};
|
||||
}
|
||||
const GenreXtended = _sap_common.CodeList(Genre(__.Entity))
|
||||
export type Genre = InstanceType<typeof GenreXtended>
|
||||
|
||||
export class Genres extends Array<Genre> {
|
||||
}
|
||||
|
||||
9
bookshop/@types/sap/common/index.js
Normal file
9
bookshop/@types/sap/common/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common')
|
||||
module.exports.Language = cson.Languages
|
||||
module.exports.Languages = cson.Languages
|
||||
module.exports.Country = cson.Countries
|
||||
module.exports.Countries = cson.Countries
|
||||
module.exports.Currency = cson.Currencies
|
||||
module.exports.Currencies = cson.Currencies
|
||||
68
bookshop/@types/sap/common/index.ts
Normal file
68
bookshop/@types/sap/common/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../_';
|
||||
|
||||
export type Locale = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'CodeList'
|
||||
export function CodeList<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CodeListAspect extends Base {
|
||||
name: string;
|
||||
descr: string;
|
||||
};
|
||||
}
|
||||
const CodeListXtended = CodeList(__.Entity)
|
||||
export type CodeList = InstanceType<typeof CodeListXtended>
|
||||
|
||||
/**
|
||||
* Code list for languages
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
|
||||
*/
|
||||
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LanguageAspect extends Base {
|
||||
/**
|
||||
* Type for a language code
|
||||
*/
|
||||
code: Locale;
|
||||
};
|
||||
}
|
||||
const LanguageXtended = CodeList(Language(__.Entity))
|
||||
export type Language = InstanceType<typeof LanguageXtended>
|
||||
|
||||
export class Languages extends Array<Language> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for countries
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
|
||||
*/
|
||||
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CountryAspect extends Base {
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
const CountryXtended = CodeList(Country(__.Entity))
|
||||
export type Country = InstanceType<typeof CountryXtended>
|
||||
|
||||
export class Countries extends Array<Country> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
|
||||
*/
|
||||
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CurrencyAspect extends Base {
|
||||
code: string;
|
||||
symbol: string;
|
||||
};
|
||||
}
|
||||
const CurrencyXtended = CodeList(Currency(__.Entity))
|
||||
export type Currency = InstanceType<typeof CurrencyXtended>
|
||||
|
||||
export class Currencies extends Array<Currency> {
|
||||
}
|
||||
|
||||
5
bookshop/jsconfig.json
Normal file
5
bookshop/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@ const cds = require('@sap/cds')
|
||||
|
||||
class CatalogService extends cds.ApplicationService { init(){
|
||||
|
||||
const { Books } = this.entities ('sap.capire.bookshop')
|
||||
//const { Books } = this.entities ('sap.capire.bookshop')
|
||||
const { Books, Book } = require('../@types/sap/capire/bookshop')
|
||||
|
||||
// Reduce stock of ordered books if available stock suffices
|
||||
this.on ('submitOrder', async req => {
|
||||
|
||||
7
bookstore/@types/AdminService/index.js
Normal file
7
bookstore/@types/AdminService/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('AdminService')
|
||||
module.exports.Book = cson.Books
|
||||
module.exports.Books = cson.Books
|
||||
module.exports.Author = cson.Authors
|
||||
module.exports.Authors = cson.Authors
|
||||
54
bookstore/@types/AdminService/index.ts
Normal file
54
bookstore/@types/AdminService/index.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_bookshop from './../sap/capire/bookshop';
|
||||
import * as __ from './../_';
|
||||
import * as _ from './..';
|
||||
import * as _ReviewsService from './../ReviewsService';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Book<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class BookAspect extends Base {
|
||||
ID: number;
|
||||
title: string;
|
||||
descr: string;
|
||||
author: __.Association.to<_sap_capire_bookshop.Author>;
|
||||
genre: __.Association.to<_sap_capire_bookshop.Genre>;
|
||||
stock: number;
|
||||
price: number;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
image: string;
|
||||
reviews: __.Composition.of.many<_ReviewsService.Reviews>;
|
||||
rating: number;
|
||||
numberOfReviews: number;
|
||||
};
|
||||
}
|
||||
const BookXtended = _.managed(Book(__.Entity))
|
||||
export type Book = InstanceType<typeof BookXtended>
|
||||
|
||||
export class Books extends Array<Book> {
|
||||
}
|
||||
|
||||
export function Author<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class AuthorAspect extends Base {
|
||||
ID: number;
|
||||
name: string;
|
||||
dateOfBirth: Date;
|
||||
dateOfDeath: Date;
|
||||
placeOfBirth: string;
|
||||
placeOfDeath: string;
|
||||
books: __.Association.to.many<_sap_capire_bookshop.Books>;
|
||||
};
|
||||
}
|
||||
const AuthorXtended = _.managed(Author(__.Entity))
|
||||
export type Author = InstanceType<typeof AuthorXtended>
|
||||
|
||||
export class Authors extends Array<Author> {
|
||||
}
|
||||
|
||||
7
bookstore/@types/CatalogService/index.js
Normal file
7
bookstore/@types/CatalogService/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('CatalogService')
|
||||
module.exports.ListOfBook = cson.ListOfBooks
|
||||
module.exports.ListOfBooks = cson.ListOfBooks
|
||||
module.exports.Book = cson.Books
|
||||
module.exports.Books = cson.Books
|
||||
72
bookstore/@types/CatalogService/index.ts
Normal file
72
bookstore/@types/CatalogService/index.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_bookshop from './../sap/capire/bookshop';
|
||||
import * as __ from './../_';
|
||||
import * as _ from './..';
|
||||
import * as _ReviewsService from './../ReviewsService';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* For displaying lists of Books
|
||||
*/
|
||||
export function ListOfBook<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ListOfBookAspect extends Base {
|
||||
ID: number;
|
||||
title: string;
|
||||
descr: string;
|
||||
author: __.Association.to<_sap_capire_bookshop.Author>;
|
||||
genre: __.Association.to<_sap_capire_bookshop.Genre>;
|
||||
stock: number;
|
||||
price: number;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
image: string;
|
||||
reviews: __.Composition.of.many<_ReviewsService.Reviews>;
|
||||
rating: number;
|
||||
numberOfReviews: number;
|
||||
};
|
||||
}
|
||||
const ListOfBookXtended = _.managed(ListOfBook(__.Entity))
|
||||
export type ListOfBook = InstanceType<typeof ListOfBookXtended>
|
||||
|
||||
export class ListOfBooks extends Array<ListOfBook> {
|
||||
}
|
||||
|
||||
/**
|
||||
* For display in details pages
|
||||
*/
|
||||
export function Book<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class BookAspect extends Base {
|
||||
ID: number;
|
||||
title: string;
|
||||
descr: string;
|
||||
author: __.Association.to<_sap_capire_bookshop.Author>;
|
||||
genre: __.Association.to<_sap_capire_bookshop.Genre>;
|
||||
stock: number;
|
||||
price: number;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
image: string;
|
||||
reviews: __.Composition.of.many<_ReviewsService.Reviews>;
|
||||
rating: number;
|
||||
numberOfReviews: number;
|
||||
};
|
||||
}
|
||||
const BookXtended = _.managed(Book(__.Entity))
|
||||
export type Book = InstanceType<typeof BookXtended>
|
||||
|
||||
export class Books extends Array<Book> {
|
||||
}
|
||||
|
||||
// action
|
||||
export declare const submitOrder: (book: Books, quantity: number) => {};
|
||||
7
bookstore/@types/DataService/index.js
Normal file
7
bookstore/@types/DataService/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('DataService')
|
||||
module.exports.Entity = cson.Entities
|
||||
module.exports.Entities = cson.Entities
|
||||
module.exports.Data = cson.Data
|
||||
module.exports.Data_ = cson.Data
|
||||
40
bookstore/@types/DataService/index.ts
Normal file
40
bookstore/@types/DataService/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Metadata like name and columns/elements
|
||||
*/
|
||||
export function Entity<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class EntityAspect extends Base {
|
||||
name: string;
|
||||
columns: {
|
||||
name: string;
|
||||
type: string;
|
||||
isKey: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
const EntityXtended = Entity(__.Entity)
|
||||
export type Entity = InstanceType<typeof EntityXtended>
|
||||
|
||||
export class Entities extends Array<Entity> {
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual data, organized by column name
|
||||
*/
|
||||
export function Data<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class DataAspect extends Base {
|
||||
record: {};
|
||||
};
|
||||
}
|
||||
const DataXtended = Data(__.Entity)
|
||||
export type Data = InstanceType<typeof DataXtended>
|
||||
|
||||
export class Data_ extends Array<Data> {
|
||||
}
|
||||
|
||||
5
bookstore/@types/OrdersService/index.js
Normal file
5
bookstore/@types/OrdersService/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('OrdersService')
|
||||
module.exports.Order = cson.Orders
|
||||
module.exports.Orders = cson.Orders
|
||||
39
bookstore/@types/OrdersService/index.ts
Normal file
39
bookstore/@types/OrdersService/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_orders from './../sap/capire/orders';
|
||||
import * as __ from './../_';
|
||||
import * as _sap_capire_bookshop from './../sap/capire/bookshop';
|
||||
import * as _ from './..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Order<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class OrderAspect extends Base {
|
||||
OrderNo: string;
|
||||
Items: {
|
||||
ID: string;
|
||||
product: __.Association.to<_sap_capire_orders.Product>;
|
||||
quantity: number;
|
||||
title: string;
|
||||
price: number;
|
||||
book: __.Association.to<_sap_capire_bookshop.Book>;
|
||||
};
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
buyer: _.User;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
};
|
||||
}
|
||||
const OrderXtended = _.cuid(_.managed(Order(__.Entity)))
|
||||
export type Order = InstanceType<typeof OrderXtended>
|
||||
|
||||
export class Orders extends Array<Order> {
|
||||
}
|
||||
|
||||
5
bookstore/@types/ReviewsService/index.js
Normal file
5
bookstore/@types/ReviewsService/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('ReviewsService')
|
||||
module.exports.Review = cson.Reviews
|
||||
module.exports.Reviews = cson.Reviews
|
||||
35
bookstore/@types/ReviewsService/index.ts
Normal file
35
bookstore/@types/ReviewsService/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_reviews from './../sap/capire/reviews';
|
||||
import * as _ from './..';
|
||||
import * as __ from './../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Review<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ReviewAspect extends Base {
|
||||
ID: string;
|
||||
subject: _sap_capire_reviews.ReviewedSubject;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
reviewer: _.User;
|
||||
rating: _sap_capire_reviews.Rating;
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
likes: __.Composition.of.many<_sap_capire_reviews.Likes>;
|
||||
liked: number;
|
||||
};
|
||||
}
|
||||
const ReviewXtended = Review(__.Entity)
|
||||
export type Review = InstanceType<typeof ReviewXtended>
|
||||
|
||||
export class Reviews extends Array<Review> {
|
||||
}
|
||||
|
||||
// action
|
||||
export declare const like: (review: Reviews) => {};
|
||||
// action
|
||||
export declare const unlike: (review: Reviews) => {};
|
||||
3
bookstore/@types/_/index.js
Normal file
3
bookstore/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
bookstore/@types/_/index.ts
Normal file
35
bookstore/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
bookstore/@types/index.js
Normal file
3
bookstore/@types/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('')
|
||||
57
bookstore/@types/index.ts
Normal file
57
bookstore/@types/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_common from './sap/common';
|
||||
import * as __ from './_';
|
||||
|
||||
export type Language = __.Association.to<_sap_common.Language>;
|
||||
export type Currency = __.Association.to<_sap_common.Currency>;
|
||||
export type Country = __.Association.to<_sap_common.Country>;
|
||||
export type User = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'cuid'
|
||||
export function cuid<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class cuidAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const cuidXtended = cuid(__.Entity)
|
||||
export type cuid = InstanceType<typeof cuidXtended>
|
||||
|
||||
// the following represents the CDS aspect 'managed'
|
||||
export function managed<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class managedAspect extends Base {
|
||||
createdAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
createdBy: User;
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
modifiedBy: User;
|
||||
};
|
||||
}
|
||||
const managedXtended = managed(__.Entity)
|
||||
export type managed = InstanceType<typeof managedXtended>
|
||||
|
||||
// the following represents the CDS aspect 'temporal'
|
||||
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class temporalAspect extends Base {
|
||||
validFrom: Date;
|
||||
validTo: Date;
|
||||
};
|
||||
}
|
||||
const temporalXtended = temporal(__.Entity)
|
||||
export type temporal = InstanceType<typeof temporalXtended>
|
||||
|
||||
// the following represents the CDS aspect 'extensible'
|
||||
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class extensibleAspect extends Base {
|
||||
extensions__: string;
|
||||
};
|
||||
}
|
||||
const extensibleXtended = extensible(__.Entity)
|
||||
export type extensible = InstanceType<typeof extensibleXtended>
|
||||
|
||||
|
||||
9
bookstore/@types/sap/capire/bookshop/index.js
Normal file
9
bookstore/@types/sap/capire/bookshop/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.bookshop')
|
||||
module.exports.Book = cson.Books
|
||||
module.exports.Books = cson.Books
|
||||
module.exports.Author = cson.Authors
|
||||
module.exports.Authors = cson.Authors
|
||||
module.exports.Genre = cson.Genres
|
||||
module.exports.Genres = cson.Genres
|
||||
70
bookstore/@types/sap/capire/bookshop/index.ts
Normal file
70
bookstore/@types/sap/capire/bookshop/index.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _ from './../../..';
|
||||
import * as _ReviewsService from './../../../ReviewsService';
|
||||
import * as _sap_common from './../../common';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Book<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class BookAspect extends Base {
|
||||
ID: number;
|
||||
title: string;
|
||||
descr: string;
|
||||
author: __.Association.to<Author>;
|
||||
genre: __.Association.to<Genre>;
|
||||
stock: number;
|
||||
price: number;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
image: string;
|
||||
reviews: __.Composition.of.many<_ReviewsService.Reviews>;
|
||||
rating: number;
|
||||
numberOfReviews: number;
|
||||
};
|
||||
}
|
||||
const BookXtended = _.managed(Book(__.Entity))
|
||||
export type Book = InstanceType<typeof BookXtended>
|
||||
|
||||
export class Books extends Array<Book> {
|
||||
}
|
||||
|
||||
export function Author<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class AuthorAspect extends Base {
|
||||
ID: number;
|
||||
name: string;
|
||||
dateOfBirth: Date;
|
||||
dateOfDeath: Date;
|
||||
placeOfBirth: string;
|
||||
placeOfDeath: string;
|
||||
books: __.Association.to.many<Books>;
|
||||
};
|
||||
}
|
||||
const AuthorXtended = _.managed(Author(__.Entity))
|
||||
export type Author = InstanceType<typeof AuthorXtended>
|
||||
|
||||
export class Authors extends Array<Author> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hierarchically organized Code List for Genres
|
||||
*/
|
||||
export function Genre<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class GenreAspect extends Base {
|
||||
ID: number;
|
||||
parent: __.Association.to<Genre>;
|
||||
children: __.Composition.of.many<Genres>;
|
||||
};
|
||||
}
|
||||
const GenreXtended = _sap_common.CodeList(Genre(__.Entity))
|
||||
export type Genre = InstanceType<typeof GenreXtended>
|
||||
|
||||
export class Genres extends Array<Genre> {
|
||||
}
|
||||
|
||||
7
bookstore/@types/sap/capire/orders/index.js
Normal file
7
bookstore/@types/sap/capire/orders/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.orders')
|
||||
module.exports.Order = cson.Orders
|
||||
module.exports.Orders = cson.Orders
|
||||
module.exports.Product = cson.Products
|
||||
module.exports.Products = cson.Products
|
||||
52
bookstore/@types/sap/capire/orders/index.ts
Normal file
52
bookstore/@types/sap/capire/orders/index.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _sap_capire_bookshop from './../bookshop';
|
||||
import * as _ from './../../..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Order<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class OrderAspect extends Base {
|
||||
OrderNo: string;
|
||||
Items: {
|
||||
ID: string;
|
||||
product: __.Association.to<Product>;
|
||||
quantity: number;
|
||||
title: string;
|
||||
price: number;
|
||||
book: __.Association.to<_sap_capire_bookshop.Book>;
|
||||
};
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
buyer: _.User;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
};
|
||||
}
|
||||
const OrderXtended = _.cuid(_.managed(Order(__.Entity)))
|
||||
export type Order = InstanceType<typeof OrderXtended>
|
||||
|
||||
export class Orders extends Array<Order> {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a stand-in for arbitrary ordered Products
|
||||
*/
|
||||
export function Product<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ProductAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const ProductXtended = Product(__.Entity)
|
||||
export type Product = InstanceType<typeof ProductXtended>
|
||||
|
||||
export class Products extends Array<Product> {
|
||||
}
|
||||
|
||||
7
bookstore/@types/sap/capire/reviews/index.js
Normal file
7
bookstore/@types/sap/capire/reviews/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.reviews')
|
||||
module.exports.Review = cson.Reviews
|
||||
module.exports.Reviews = cson.Reviews
|
||||
module.exports.Like = cson.Likes
|
||||
module.exports.Likes = cson.Likes
|
||||
51
bookstore/@types/sap/capire/reviews/index.ts
Normal file
51
bookstore/@types/sap/capire/reviews/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _ from './../../..';
|
||||
import * as __ from './../../../_';
|
||||
|
||||
export type ReviewedSubject = string;
|
||||
export enum Rating {
|
||||
Best = 5,
|
||||
Good = 4,
|
||||
Avg = 3,
|
||||
Poor = 2,
|
||||
Worst = 1,
|
||||
}
|
||||
|
||||
|
||||
export function Review<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ReviewAspect extends Base {
|
||||
ID: string;
|
||||
subject: ReviewedSubject;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
reviewer: _.User;
|
||||
rating: Rating;
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
likes: __.Composition.of.many<Likes>;
|
||||
liked: number;
|
||||
};
|
||||
}
|
||||
const ReviewXtended = Review(__.Entity)
|
||||
export type Review = InstanceType<typeof ReviewXtended>
|
||||
|
||||
export class Reviews extends Array<Review> {
|
||||
}
|
||||
|
||||
export function Like<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LikeAspect extends Base {
|
||||
review: __.Association.to<Review>;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
user: _.User;
|
||||
};
|
||||
}
|
||||
const LikeXtended = Like(__.Entity)
|
||||
export type Like = InstanceType<typeof LikeXtended>
|
||||
|
||||
export class Likes extends Array<Like> {
|
||||
}
|
||||
|
||||
9
bookstore/@types/sap/common/countries/index.js
Normal file
9
bookstore/@types/sap/common/countries/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common.countries')
|
||||
module.exports.Region = cson.Regions
|
||||
module.exports.Regions = cson.Regions
|
||||
module.exports.City = cson.Cities
|
||||
module.exports.Cities = cson.Cities
|
||||
module.exports.District = cson.Districts
|
||||
module.exports.Districts = cson.Districts
|
||||
47
bookstore/@types/sap/common/countries/index.ts
Normal file
47
bookstore/@types/sap/common/countries/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _sap_common from './..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Region<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class RegionAspect extends Base {
|
||||
code: string;
|
||||
children: __.Composition.of.many<Regions>;
|
||||
cities: __.Composition.of.many<Cities>;
|
||||
_parent: string;
|
||||
};
|
||||
}
|
||||
const RegionXtended = _sap_common.CodeList(Region(__.Entity))
|
||||
export type Region = InstanceType<typeof RegionXtended>
|
||||
|
||||
export class Regions extends Array<Region> {
|
||||
}
|
||||
|
||||
export function City<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CityAspect extends Base {
|
||||
code: string;
|
||||
region: __.Association.to<Region>;
|
||||
districts: __.Composition.of.many<Districts>;
|
||||
};
|
||||
}
|
||||
const CityXtended = _sap_common.CodeList(City(__.Entity))
|
||||
export type City = InstanceType<typeof CityXtended>
|
||||
|
||||
export class Cities extends Array<City> {
|
||||
}
|
||||
|
||||
export function District<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class DistrictAspect extends Base {
|
||||
code: string;
|
||||
city: __.Association.to<City>;
|
||||
};
|
||||
}
|
||||
const DistrictXtended = _sap_common.CodeList(District(__.Entity))
|
||||
export type District = InstanceType<typeof DistrictXtended>
|
||||
|
||||
export class Districts extends Array<District> {
|
||||
}
|
||||
|
||||
9
bookstore/@types/sap/common/index.js
Normal file
9
bookstore/@types/sap/common/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common')
|
||||
module.exports.Language = cson.Languages
|
||||
module.exports.Languages = cson.Languages
|
||||
module.exports.Country = cson.Countries
|
||||
module.exports.Countries = cson.Countries
|
||||
module.exports.Currency = cson.Currencies
|
||||
module.exports.Currencies = cson.Currencies
|
||||
73
bookstore/@types/sap/common/index.ts
Normal file
73
bookstore/@types/sap/common/index.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../_';
|
||||
import * as _sap_common_countries from './countries';
|
||||
|
||||
export type Locale = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'CodeList'
|
||||
export function CodeList<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CodeListAspect extends Base {
|
||||
name: string;
|
||||
descr: string;
|
||||
};
|
||||
}
|
||||
const CodeListXtended = CodeList(__.Entity)
|
||||
export type CodeList = InstanceType<typeof CodeListXtended>
|
||||
|
||||
/**
|
||||
* Code list for languages
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
|
||||
*/
|
||||
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LanguageAspect extends Base {
|
||||
/**
|
||||
* Type for a language code
|
||||
*/
|
||||
code: Locale;
|
||||
};
|
||||
}
|
||||
const LanguageXtended = CodeList(Language(__.Entity))
|
||||
export type Language = InstanceType<typeof LanguageXtended>
|
||||
|
||||
export class Languages extends Array<Language> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for countries
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
|
||||
*/
|
||||
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CountryAspect extends Base {
|
||||
code: string;
|
||||
regions: __.Composition.of.many<_sap_common_countries.Regions>;
|
||||
};
|
||||
}
|
||||
const CountryXtended = CodeList(Country(__.Entity))
|
||||
export type Country = InstanceType<typeof CountryXtended>
|
||||
|
||||
export class Countries extends Array<Country> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
|
||||
*/
|
||||
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CurrencyAspect extends Base {
|
||||
code: string;
|
||||
symbol: string;
|
||||
numcode: number;
|
||||
exponent: number;
|
||||
minor: string;
|
||||
};
|
||||
}
|
||||
const CurrencyXtended = CodeList(Currency(__.Entity))
|
||||
export type Currency = InstanceType<typeof CurrencyXtended>
|
||||
|
||||
export class Currencies extends Array<Currency> {
|
||||
}
|
||||
|
||||
5
bookstore/jsconfig.json
Normal file
5
bookstore/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@ module.exports = async()=>{ // called by server.js
|
||||
const db = await cds.connect.to ('db')
|
||||
|
||||
// reflect entity definitions used below...
|
||||
const { Books } = db.entities ('sap.capire.bookshop')
|
||||
//const { Books } = db.entities ('sap.capire.bookshop')
|
||||
const { Books, Book } = require('../@types/sap/capire/bookshop')
|
||||
|
||||
//
|
||||
// Delegate requests to read reviews to the ReviewsService
|
||||
@@ -19,8 +20,8 @@ module.exports = async()=>{ // called by server.js
|
||||
//
|
||||
CatalogService.prepend (srv => srv.on ('READ', 'Books/reviews', (req) => {
|
||||
console.debug ('> delegating request to ReviewsService')
|
||||
const [id] = req.params, { columns, limit } = req.query.SELECT
|
||||
return ReviewsService.read ('Reviews',columns).limit(limit).where({subject:String(id)})
|
||||
const [id] = req.params, { columns, limit } = 'SELECT' in req.query ? req.query.SELECT : {columns: [], limit: { rows: 0 }}
|
||||
return ReviewsService.read ('Reviews',columns).limit(limit.rows).where({subject:String(id)})
|
||||
}))
|
||||
|
||||
//
|
||||
@@ -28,7 +29,7 @@ module.exports = async()=>{ // called by server.js
|
||||
//
|
||||
CatalogService.on ('OrderedBook', async (msg) => {
|
||||
const { book, quantity, buyer } = msg.data
|
||||
const { title, price } = await db.tx(msg).read (Books, book, b => { b.title, b.price })
|
||||
const { title, price } = await db.tx(msg).read ('Books').where('ID = ' + book.ID).columns((/** @type {Book} */ b) => { b.title, b.price })
|
||||
return OrdersService.tx(msg).create ('Orders').entries({
|
||||
OrderNo: 'Order at '+ (new Date).toLocaleString(),
|
||||
Items: [{ product:{ID:`${book}`}, title, price, quantity }],
|
||||
|
||||
3
common/@types/_/index.js
Normal file
3
common/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
common/@types/_/index.ts
Normal file
35
common/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
common/@types/index.js
Normal file
3
common/@types/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('')
|
||||
57
common/@types/index.ts
Normal file
57
common/@types/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_common from './sap/common';
|
||||
import * as __ from './_';
|
||||
|
||||
export type Language = __.Association.to<_sap_common.Language>;
|
||||
export type Currency = __.Association.to<_sap_common.Currency>;
|
||||
export type Country = __.Association.to<_sap_common.Country>;
|
||||
export type User = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'cuid'
|
||||
export function cuid<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class cuidAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const cuidXtended = cuid(__.Entity)
|
||||
export type cuid = InstanceType<typeof cuidXtended>
|
||||
|
||||
// the following represents the CDS aspect 'managed'
|
||||
export function managed<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class managedAspect extends Base {
|
||||
createdAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
createdBy: User;
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
modifiedBy: User;
|
||||
};
|
||||
}
|
||||
const managedXtended = managed(__.Entity)
|
||||
export type managed = InstanceType<typeof managedXtended>
|
||||
|
||||
// the following represents the CDS aspect 'temporal'
|
||||
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class temporalAspect extends Base {
|
||||
validFrom: Date;
|
||||
validTo: Date;
|
||||
};
|
||||
}
|
||||
const temporalXtended = temporal(__.Entity)
|
||||
export type temporal = InstanceType<typeof temporalXtended>
|
||||
|
||||
// the following represents the CDS aspect 'extensible'
|
||||
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class extensibleAspect extends Base {
|
||||
extensions__: string;
|
||||
};
|
||||
}
|
||||
const extensibleXtended = extensible(__.Entity)
|
||||
export type extensible = InstanceType<typeof extensibleXtended>
|
||||
|
||||
|
||||
9
common/@types/sap/common/countries/index.js
Normal file
9
common/@types/sap/common/countries/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common.countries')
|
||||
module.exports.Region = cson.Regions
|
||||
module.exports.Regions = cson.Regions
|
||||
module.exports.City = cson.Cities
|
||||
module.exports.Cities = cson.Cities
|
||||
module.exports.District = cson.Districts
|
||||
module.exports.Districts = cson.Districts
|
||||
47
common/@types/sap/common/countries/index.ts
Normal file
47
common/@types/sap/common/countries/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _sap_common from './..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Region<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class RegionAspect extends Base {
|
||||
code: string;
|
||||
children: __.Composition.of.many<Regions>;
|
||||
cities: __.Composition.of.many<Cities>;
|
||||
_parent: string;
|
||||
};
|
||||
}
|
||||
const RegionXtended = _sap_common.CodeList(Region(__.Entity))
|
||||
export type Region = InstanceType<typeof RegionXtended>
|
||||
|
||||
export class Regions extends Array<Region> {
|
||||
}
|
||||
|
||||
export function City<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CityAspect extends Base {
|
||||
code: string;
|
||||
region: __.Association.to<Region>;
|
||||
districts: __.Composition.of.many<Districts>;
|
||||
};
|
||||
}
|
||||
const CityXtended = _sap_common.CodeList(City(__.Entity))
|
||||
export type City = InstanceType<typeof CityXtended>
|
||||
|
||||
export class Cities extends Array<City> {
|
||||
}
|
||||
|
||||
export function District<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class DistrictAspect extends Base {
|
||||
code: string;
|
||||
city: __.Association.to<City>;
|
||||
};
|
||||
}
|
||||
const DistrictXtended = _sap_common.CodeList(District(__.Entity))
|
||||
export type District = InstanceType<typeof DistrictXtended>
|
||||
|
||||
export class Districts extends Array<District> {
|
||||
}
|
||||
|
||||
9
common/@types/sap/common/index.js
Normal file
9
common/@types/sap/common/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common')
|
||||
module.exports.Language = cson.Languages
|
||||
module.exports.Languages = cson.Languages
|
||||
module.exports.Country = cson.Countries
|
||||
module.exports.Countries = cson.Countries
|
||||
module.exports.Currency = cson.Currencies
|
||||
module.exports.Currencies = cson.Currencies
|
||||
73
common/@types/sap/common/index.ts
Normal file
73
common/@types/sap/common/index.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../_';
|
||||
import * as _sap_common_countries from './countries';
|
||||
|
||||
export type Locale = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'CodeList'
|
||||
export function CodeList<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CodeListAspect extends Base {
|
||||
name: string;
|
||||
descr: string;
|
||||
};
|
||||
}
|
||||
const CodeListXtended = CodeList(__.Entity)
|
||||
export type CodeList = InstanceType<typeof CodeListXtended>
|
||||
|
||||
/**
|
||||
* Code list for languages
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
|
||||
*/
|
||||
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LanguageAspect extends Base {
|
||||
/**
|
||||
* Type for a language code
|
||||
*/
|
||||
code: Locale;
|
||||
};
|
||||
}
|
||||
const LanguageXtended = CodeList(Language(__.Entity))
|
||||
export type Language = InstanceType<typeof LanguageXtended>
|
||||
|
||||
export class Languages extends Array<Language> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for countries
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
|
||||
*/
|
||||
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CountryAspect extends Base {
|
||||
code: string;
|
||||
regions: __.Composition.of.many<_sap_common_countries.Regions>;
|
||||
};
|
||||
}
|
||||
const CountryXtended = CodeList(Country(__.Entity))
|
||||
export type Country = InstanceType<typeof CountryXtended>
|
||||
|
||||
export class Countries extends Array<Country> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
|
||||
*/
|
||||
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CurrencyAspect extends Base {
|
||||
code: string;
|
||||
symbol: string;
|
||||
numcode: number;
|
||||
exponent: number;
|
||||
minor: string;
|
||||
};
|
||||
}
|
||||
const CurrencyXtended = CodeList(Currency(__.Entity))
|
||||
export type Currency = InstanceType<typeof CurrencyXtended>
|
||||
|
||||
export class Currencies extends Array<Currency> {
|
||||
}
|
||||
|
||||
5
common/jsconfig.json
Normal file
5
common/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
7
data-viewer/@types/DataService/index.js
Normal file
7
data-viewer/@types/DataService/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('DataService')
|
||||
module.exports.Entity = cson.Entities
|
||||
module.exports.Entities = cson.Entities
|
||||
module.exports.Data = cson.Data
|
||||
module.exports.Data_ = cson.Data
|
||||
40
data-viewer/@types/DataService/index.ts
Normal file
40
data-viewer/@types/DataService/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Metadata like name and columns/elements
|
||||
*/
|
||||
export function Entity<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class EntityAspect extends Base {
|
||||
name: string;
|
||||
columns: {
|
||||
name: string;
|
||||
type: string;
|
||||
isKey: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
const EntityXtended = Entity(__.Entity)
|
||||
export type Entity = InstanceType<typeof EntityXtended>
|
||||
|
||||
export class Entities extends Array<Entity> {
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual data, organized by column name
|
||||
*/
|
||||
export function Data<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class DataAspect extends Base {
|
||||
record: {};
|
||||
};
|
||||
}
|
||||
const DataXtended = Data(__.Entity)
|
||||
export type Data = InstanceType<typeof DataXtended>
|
||||
|
||||
export class Data_ extends Array<Data> {
|
||||
}
|
||||
|
||||
3
data-viewer/@types/_/index.js
Normal file
3
data-viewer/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
data-viewer/@types/_/index.ts
Normal file
35
data-viewer/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5
data-viewer/jsconfig.json
Normal file
5
data-viewer/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
3
hello/@types/_/index.js
Normal file
3
hello/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
hello/@types/_/index.ts
Normal file
35
hello/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5
hello/jsconfig.json
Normal file
5
hello/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
3
media/@types/_/index.js
Normal file
3
media/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
media/@types/_/index.ts
Normal file
35
media/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5
media/@types/sap/capire/media/MediaServer/index.js
Normal file
5
media/@types/sap/capire/media/MediaServer/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.media.MediaServer')
|
||||
module.exports.Media = cson.Media
|
||||
module.exports.Media_ = cson.Media
|
||||
22
media/@types/sap/capire/media/MediaServer/index.ts
Normal file
22
media/@types/sap/capire/media/MediaServer/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Media<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class MediaAspect extends Base {
|
||||
id: number;
|
||||
content: string;
|
||||
mediaType: string;
|
||||
fileName: string;
|
||||
applicationName: string;
|
||||
};
|
||||
}
|
||||
const MediaXtended = Media(__.Entity)
|
||||
export type Media = InstanceType<typeof MediaXtended>
|
||||
|
||||
export class Media_ extends Array<Media> {
|
||||
}
|
||||
|
||||
5
media/@types/sap/capire/media/index.js
Normal file
5
media/@types/sap/capire/media/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.media')
|
||||
module.exports.Media = cson.Media
|
||||
module.exports.Media_ = cson.Media
|
||||
22
media/@types/sap/capire/media/index.ts
Normal file
22
media/@types/sap/capire/media/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Media<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class MediaAspect extends Base {
|
||||
id: number;
|
||||
content: string;
|
||||
mediaType: string;
|
||||
fileName: string;
|
||||
applicationName: string;
|
||||
};
|
||||
}
|
||||
const MediaXtended = Media(__.Entity)
|
||||
export type Media = InstanceType<typeof MediaXtended>
|
||||
|
||||
export class Media_ extends Array<Media> {
|
||||
}
|
||||
|
||||
5
media/jsconfig.json
Normal file
5
media/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
5
orders/@types/OrdersService/index.js
Normal file
5
orders/@types/OrdersService/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('OrdersService')
|
||||
module.exports.Order = cson.Orders
|
||||
module.exports.Orders = cson.Orders
|
||||
37
orders/@types/OrdersService/index.ts
Normal file
37
orders/@types/OrdersService/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_orders from './../sap/capire/orders';
|
||||
import * as __ from './../_';
|
||||
import * as _ from './..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Order<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class OrderAspect extends Base {
|
||||
OrderNo: string;
|
||||
Items: {
|
||||
ID: string;
|
||||
product: __.Association.to<_sap_capire_orders.Product>;
|
||||
quantity: number;
|
||||
title: string;
|
||||
price: number;
|
||||
};
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
buyer: _.User;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
};
|
||||
}
|
||||
const OrderXtended = _.cuid(_.managed(Order(__.Entity)))
|
||||
export type Order = InstanceType<typeof OrderXtended>
|
||||
|
||||
export class Orders extends Array<Order> {
|
||||
}
|
||||
|
||||
3
orders/@types/_/index.js
Normal file
3
orders/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
orders/@types/_/index.ts
Normal file
35
orders/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
orders/@types/index.js
Normal file
3
orders/@types/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('')
|
||||
57
orders/@types/index.ts
Normal file
57
orders/@types/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_common from './sap/common';
|
||||
import * as __ from './_';
|
||||
|
||||
export type Language = __.Association.to<_sap_common.Language>;
|
||||
export type Currency = __.Association.to<_sap_common.Currency>;
|
||||
export type Country = __.Association.to<_sap_common.Country>;
|
||||
export type User = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'cuid'
|
||||
export function cuid<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class cuidAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const cuidXtended = cuid(__.Entity)
|
||||
export type cuid = InstanceType<typeof cuidXtended>
|
||||
|
||||
// the following represents the CDS aspect 'managed'
|
||||
export function managed<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class managedAspect extends Base {
|
||||
createdAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
createdBy: User;
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
modifiedBy: User;
|
||||
};
|
||||
}
|
||||
const managedXtended = managed(__.Entity)
|
||||
export type managed = InstanceType<typeof managedXtended>
|
||||
|
||||
// the following represents the CDS aspect 'temporal'
|
||||
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class temporalAspect extends Base {
|
||||
validFrom: Date;
|
||||
validTo: Date;
|
||||
};
|
||||
}
|
||||
const temporalXtended = temporal(__.Entity)
|
||||
export type temporal = InstanceType<typeof temporalXtended>
|
||||
|
||||
// the following represents the CDS aspect 'extensible'
|
||||
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class extensibleAspect extends Base {
|
||||
extensions__: string;
|
||||
};
|
||||
}
|
||||
const extensibleXtended = extensible(__.Entity)
|
||||
export type extensible = InstanceType<typeof extensibleXtended>
|
||||
|
||||
|
||||
7
orders/@types/sap/capire/orders/index.js
Normal file
7
orders/@types/sap/capire/orders/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.orders')
|
||||
module.exports.Order = cson.Orders
|
||||
module.exports.Orders = cson.Orders
|
||||
module.exports.Product = cson.Products
|
||||
module.exports.Products = cson.Products
|
||||
50
orders/@types/sap/capire/orders/index.ts
Normal file
50
orders/@types/sap/capire/orders/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _ from './../../..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Order<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class OrderAspect extends Base {
|
||||
OrderNo: string;
|
||||
Items: {
|
||||
ID: string;
|
||||
product: __.Association.to<Product>;
|
||||
quantity: number;
|
||||
title: string;
|
||||
price: number;
|
||||
};
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
buyer: _.User;
|
||||
/**
|
||||
* Type for an association to Currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#type-currency
|
||||
*/
|
||||
currency: __.Association.to<_.Currency>;
|
||||
};
|
||||
}
|
||||
const OrderXtended = _.cuid(_.managed(Order(__.Entity)))
|
||||
export type Order = InstanceType<typeof OrderXtended>
|
||||
|
||||
export class Orders extends Array<Order> {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a stand-in for arbitrary ordered Products
|
||||
*/
|
||||
export function Product<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ProductAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const ProductXtended = Product(__.Entity)
|
||||
export type Product = InstanceType<typeof ProductXtended>
|
||||
|
||||
export class Products extends Array<Product> {
|
||||
}
|
||||
|
||||
9
orders/@types/sap/common/countries/index.js
Normal file
9
orders/@types/sap/common/countries/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common.countries')
|
||||
module.exports.Region = cson.Regions
|
||||
module.exports.Regions = cson.Regions
|
||||
module.exports.City = cson.Cities
|
||||
module.exports.Cities = cson.Cities
|
||||
module.exports.District = cson.Districts
|
||||
module.exports.Districts = cson.Districts
|
||||
47
orders/@types/sap/common/countries/index.ts
Normal file
47
orders/@types/sap/common/countries/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../../_';
|
||||
import * as _sap_common from './..';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Region<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class RegionAspect extends Base {
|
||||
code: string;
|
||||
children: __.Composition.of.many<Regions>;
|
||||
cities: __.Composition.of.many<Cities>;
|
||||
_parent: string;
|
||||
};
|
||||
}
|
||||
const RegionXtended = _sap_common.CodeList(Region(__.Entity))
|
||||
export type Region = InstanceType<typeof RegionXtended>
|
||||
|
||||
export class Regions extends Array<Region> {
|
||||
}
|
||||
|
||||
export function City<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CityAspect extends Base {
|
||||
code: string;
|
||||
region: __.Association.to<Region>;
|
||||
districts: __.Composition.of.many<Districts>;
|
||||
};
|
||||
}
|
||||
const CityXtended = _sap_common.CodeList(City(__.Entity))
|
||||
export type City = InstanceType<typeof CityXtended>
|
||||
|
||||
export class Cities extends Array<City> {
|
||||
}
|
||||
|
||||
export function District<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class DistrictAspect extends Base {
|
||||
code: string;
|
||||
city: __.Association.to<City>;
|
||||
};
|
||||
}
|
||||
const DistrictXtended = _sap_common.CodeList(District(__.Entity))
|
||||
export type District = InstanceType<typeof DistrictXtended>
|
||||
|
||||
export class Districts extends Array<District> {
|
||||
}
|
||||
|
||||
9
orders/@types/sap/common/index.js
Normal file
9
orders/@types/sap/common/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common')
|
||||
module.exports.Language = cson.Languages
|
||||
module.exports.Languages = cson.Languages
|
||||
module.exports.Country = cson.Countries
|
||||
module.exports.Countries = cson.Countries
|
||||
module.exports.Currency = cson.Currencies
|
||||
module.exports.Currencies = cson.Currencies
|
||||
73
orders/@types/sap/common/index.ts
Normal file
73
orders/@types/sap/common/index.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../_';
|
||||
import * as _sap_common_countries from './countries';
|
||||
|
||||
export type Locale = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'CodeList'
|
||||
export function CodeList<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CodeListAspect extends Base {
|
||||
name: string;
|
||||
descr: string;
|
||||
};
|
||||
}
|
||||
const CodeListXtended = CodeList(__.Entity)
|
||||
export type CodeList = InstanceType<typeof CodeListXtended>
|
||||
|
||||
/**
|
||||
* Code list for languages
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
|
||||
*/
|
||||
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LanguageAspect extends Base {
|
||||
/**
|
||||
* Type for a language code
|
||||
*/
|
||||
code: Locale;
|
||||
};
|
||||
}
|
||||
const LanguageXtended = CodeList(Language(__.Entity))
|
||||
export type Language = InstanceType<typeof LanguageXtended>
|
||||
|
||||
export class Languages extends Array<Language> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for countries
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
|
||||
*/
|
||||
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CountryAspect extends Base {
|
||||
code: string;
|
||||
regions: __.Composition.of.many<_sap_common_countries.Regions>;
|
||||
};
|
||||
}
|
||||
const CountryXtended = CodeList(Country(__.Entity))
|
||||
export type Country = InstanceType<typeof CountryXtended>
|
||||
|
||||
export class Countries extends Array<Country> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
|
||||
*/
|
||||
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CurrencyAspect extends Base {
|
||||
code: string;
|
||||
symbol: string;
|
||||
numcode: number;
|
||||
exponent: number;
|
||||
minor: string;
|
||||
};
|
||||
}
|
||||
const CurrencyXtended = CodeList(Currency(__.Entity))
|
||||
export type Currency = InstanceType<typeof CurrencyXtended>
|
||||
|
||||
export class Currencies extends Array<Currency> {
|
||||
}
|
||||
|
||||
5
orders/jsconfig.json
Normal file
5
orders/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
5
reviews/@types/ReviewsService/index.js
Normal file
5
reviews/@types/ReviewsService/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('ReviewsService')
|
||||
module.exports.Review = cson.Reviews
|
||||
module.exports.Reviews = cson.Reviews
|
||||
35
reviews/@types/ReviewsService/index.ts
Normal file
35
reviews/@types/ReviewsService/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_capire_reviews from './../sap/capire/reviews';
|
||||
import * as _ from './..';
|
||||
import * as __ from './../_';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function Review<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ReviewAspect extends Base {
|
||||
ID: string;
|
||||
subject: _sap_capire_reviews.ReviewedSubject;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
reviewer: _.User;
|
||||
rating: _sap_capire_reviews.Rating;
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
likes: __.Composition.of.many<_sap_capire_reviews.Likes>;
|
||||
liked: number;
|
||||
};
|
||||
}
|
||||
const ReviewXtended = Review(__.Entity)
|
||||
export type Review = InstanceType<typeof ReviewXtended>
|
||||
|
||||
export class Reviews extends Array<Review> {
|
||||
}
|
||||
|
||||
// action
|
||||
export declare const like: (review: Reviews) => {};
|
||||
// action
|
||||
export declare const unlike: (review: Reviews) => {};
|
||||
3
reviews/@types/_/index.js
Normal file
3
reviews/@types/_/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('_')
|
||||
35
reviews/@types/_/index.ts
Normal file
35
reviews/@types/_/index.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
|
||||
|
||||
export namespace Association {
|
||||
export type to <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace to {
|
||||
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Composition {
|
||||
export type of <T> = T & ((fn:(a:T)=>any) => T)
|
||||
export namespace of {
|
||||
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
|
||||
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
|
||||
}
|
||||
}
|
||||
|
||||
export class Entity {
|
||||
static data<T extends Entity> (this:T, input:Object) : T {
|
||||
return {} as T // mock
|
||||
}
|
||||
}
|
||||
|
||||
export type EntitySet<T> = T[] & {
|
||||
data (input:object[]) : T[]
|
||||
data (input:object) : T
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
reviews/@types/index.js
Normal file
3
reviews/@types/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('')
|
||||
57
reviews/@types/index.ts
Normal file
57
reviews/@types/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _sap_common from './sap/common';
|
||||
import * as __ from './_';
|
||||
|
||||
export type Language = __.Association.to<_sap_common.Language>;
|
||||
export type Currency = __.Association.to<_sap_common.Currency>;
|
||||
export type Country = __.Association.to<_sap_common.Country>;
|
||||
export type User = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'cuid'
|
||||
export function cuid<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class cuidAspect extends Base {
|
||||
ID: string;
|
||||
};
|
||||
}
|
||||
const cuidXtended = cuid(__.Entity)
|
||||
export type cuid = InstanceType<typeof cuidXtended>
|
||||
|
||||
// the following represents the CDS aspect 'managed'
|
||||
export function managed<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class managedAspect extends Base {
|
||||
createdAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
createdBy: User;
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
modifiedBy: User;
|
||||
};
|
||||
}
|
||||
const managedXtended = managed(__.Entity)
|
||||
export type managed = InstanceType<typeof managedXtended>
|
||||
|
||||
// the following represents the CDS aspect 'temporal'
|
||||
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class temporalAspect extends Base {
|
||||
validFrom: Date;
|
||||
validTo: Date;
|
||||
};
|
||||
}
|
||||
const temporalXtended = temporal(__.Entity)
|
||||
export type temporal = InstanceType<typeof temporalXtended>
|
||||
|
||||
// the following represents the CDS aspect 'extensible'
|
||||
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class extensibleAspect extends Base {
|
||||
extensions__: string;
|
||||
};
|
||||
}
|
||||
const extensibleXtended = extensible(__.Entity)
|
||||
export type extensible = InstanceType<typeof extensibleXtended>
|
||||
|
||||
|
||||
7
reviews/@types/sap/capire/reviews/index.js
Normal file
7
reviews/@types/sap/capire/reviews/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.capire.reviews')
|
||||
module.exports.Review = cson.Reviews
|
||||
module.exports.Reviews = cson.Reviews
|
||||
module.exports.Like = cson.Likes
|
||||
module.exports.Likes = cson.Likes
|
||||
51
reviews/@types/sap/capire/reviews/index.ts
Normal file
51
reviews/@types/sap/capire/reviews/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as _ from './../../..';
|
||||
import * as __ from './../../../_';
|
||||
|
||||
export type ReviewedSubject = string;
|
||||
export enum Rating {
|
||||
Best = 5,
|
||||
Good = 4,
|
||||
Avg = 3,
|
||||
Poor = 2,
|
||||
Worst = 1,
|
||||
}
|
||||
|
||||
|
||||
export function Review<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class ReviewAspect extends Base {
|
||||
ID: string;
|
||||
subject: ReviewedSubject;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
reviewer: _.User;
|
||||
rating: Rating;
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
likes: __.Composition.of.many<Likes>;
|
||||
liked: number;
|
||||
};
|
||||
}
|
||||
const ReviewXtended = Review(__.Entity)
|
||||
export type Review = InstanceType<typeof ReviewXtended>
|
||||
|
||||
export class Reviews extends Array<Review> {
|
||||
}
|
||||
|
||||
export function Like<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LikeAspect extends Base {
|
||||
review: __.Association.to<Review>;
|
||||
/**
|
||||
* Canonical user ID
|
||||
*/
|
||||
user: _.User;
|
||||
};
|
||||
}
|
||||
const LikeXtended = Like(__.Entity)
|
||||
export type Like = InstanceType<typeof LikeXtended>
|
||||
|
||||
export class Likes extends Array<Like> {
|
||||
}
|
||||
|
||||
9
reviews/@types/sap/common/index.js
Normal file
9
reviews/@types/sap/common/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
const cds = require('@sap/cds')
|
||||
const cson = cds.entities('sap.common')
|
||||
module.exports.Language = cson.Languages
|
||||
module.exports.Languages = cson.Languages
|
||||
module.exports.Country = cson.Countries
|
||||
module.exports.Countries = cson.Countries
|
||||
module.exports.Currency = cson.Currencies
|
||||
module.exports.Currencies = cson.Currencies
|
||||
68
reviews/@types/sap/common/index.ts
Normal file
68
reviews/@types/sap/common/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
// This is an automatically generated file. Please do not change its contents manually!
|
||||
import * as __ from './../../_';
|
||||
|
||||
export type Locale = string;
|
||||
|
||||
|
||||
// the following represents the CDS aspect 'CodeList'
|
||||
export function CodeList<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CodeListAspect extends Base {
|
||||
name: string;
|
||||
descr: string;
|
||||
};
|
||||
}
|
||||
const CodeListXtended = CodeList(__.Entity)
|
||||
export type CodeList = InstanceType<typeof CodeListXtended>
|
||||
|
||||
/**
|
||||
* Code list for languages
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
|
||||
*/
|
||||
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class LanguageAspect extends Base {
|
||||
/**
|
||||
* Type for a language code
|
||||
*/
|
||||
code: Locale;
|
||||
};
|
||||
}
|
||||
const LanguageXtended = CodeList(Language(__.Entity))
|
||||
export type Language = InstanceType<typeof LanguageXtended>
|
||||
|
||||
export class Languages extends Array<Language> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for countries
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
|
||||
*/
|
||||
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CountryAspect extends Base {
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
const CountryXtended = CodeList(Country(__.Entity))
|
||||
export type Country = InstanceType<typeof CountryXtended>
|
||||
|
||||
export class Countries extends Array<Country> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code list for currencies
|
||||
*
|
||||
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
|
||||
*/
|
||||
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
|
||||
return class CurrencyAspect extends Base {
|
||||
code: string;
|
||||
symbol: string;
|
||||
};
|
||||
}
|
||||
const CurrencyXtended = CodeList(Currency(__.Entity))
|
||||
export type Currency = InstanceType<typeof CurrencyXtended>
|
||||
|
||||
export class Currencies extends Array<Currency> {
|
||||
}
|
||||
|
||||
5
reviews/jsconfig.json
Normal file
5
reviews/jsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user