diff --git a/bookshop/@types/_/index.js b/bookshop/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/bookshop/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/bookshop/@types/_/index.ts b/bookshop/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/bookshop/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/bookshop/@types/index.js b/bookshop/@types/index.js new file mode 100644 index 00000000..ec7b888a --- /dev/null +++ b/bookshop/@types/index.js @@ -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('') \ No newline at end of file diff --git a/bookshop/@types/index.ts b/bookshop/@types/index.ts new file mode 100644 index 00000000..b21d20ca --- /dev/null +++ b/bookshop/@types/index.ts @@ -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 {}>(Base: TBase) { + return class cuidAspect extends Base { + ID: string; + }; +} +const cuidXtended = cuid(__.Entity) +export type cuid = InstanceType + +// the following represents the CDS aspect 'managed' +export function managed {}>(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 + +// the following represents the CDS aspect 'temporal' +export function temporal {}>(Base: TBase) { + return class temporalAspect extends Base { + validFrom: Date; + validTo: Date; + }; +} +const temporalXtended = temporal(__.Entity) +export type temporal = InstanceType + +// the following represents the CDS aspect 'extensible' +export function extensible {}>(Base: TBase) { + return class extensibleAspect extends Base { + extensions__: string; + }; +} +const extensibleXtended = extensible(__.Entity) +export type extensible = InstanceType + + diff --git a/bookshop/@types/sap/capire/bookshop/index.js b/bookshop/@types/sap/capire/bookshop/index.js new file mode 100644 index 00000000..e1714d25 --- /dev/null +++ b/bookshop/@types/sap/capire/bookshop/index.js @@ -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 \ No newline at end of file diff --git a/bookshop/@types/sap/capire/bookshop/index.ts b/bookshop/@types/sap/capire/bookshop/index.ts new file mode 100644 index 00000000..f0ee6e6e --- /dev/null +++ b/bookshop/@types/sap/capire/bookshop/index.ts @@ -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 {}>(Base: TBase) { + return class BookAspect extends Base { + ID: number; + title: string; + descr: string; + author: __.Association.to; + genre: __.Association.to; + 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 + +export class Books extends Array { +} + +export function Author {}>(Base: TBase) { + return class AuthorAspect extends Base { + ID: number; + name: string; + dateOfBirth: Date; + dateOfDeath: Date; + placeOfBirth: string; + placeOfDeath: string; + books: __.Association.to.many; + }; +} +const AuthorXtended = _.managed(Author(__.Entity)) +export type Author = InstanceType + +export class Authors extends Array { +} + +/** +* Hierarchically organized Code List for Genres +*/ +export function Genre {}>(Base: TBase) { + return class GenreAspect extends Base { + ID: number; + parent: __.Association.to; + children: __.Composition.of.many; + }; +} +const GenreXtended = _sap_common.CodeList(Genre(__.Entity)) +export type Genre = InstanceType + +export class Genres extends Array { +} + diff --git a/bookshop/@types/sap/common/index.js b/bookshop/@types/sap/common/index.js new file mode 100644 index 00000000..46d0912b --- /dev/null +++ b/bookshop/@types/sap/common/index.js @@ -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 \ No newline at end of file diff --git a/bookshop/@types/sap/common/index.ts b/bookshop/@types/sap/common/index.ts new file mode 100644 index 00000000..e88b2f92 --- /dev/null +++ b/bookshop/@types/sap/common/index.ts @@ -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 {}>(Base: TBase) { + return class CodeListAspect extends Base { + name: string; + descr: string; + }; +} +const CodeListXtended = CodeList(__.Entity) +export type CodeList = InstanceType + +/** +* Code list for languages +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages +*/ +export function Language {}>(Base: TBase) { + return class LanguageAspect extends Base { + /** + * Type for a language code + */ + code: Locale; + }; +} +const LanguageXtended = CodeList(Language(__.Entity)) +export type Language = InstanceType + +export class Languages extends Array { +} + +/** +* Code list for countries +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries +*/ +export function Country {}>(Base: TBase) { + return class CountryAspect extends Base { + code: string; + }; +} +const CountryXtended = CodeList(Country(__.Entity)) +export type Country = InstanceType + +export class Countries extends Array { +} + +/** +* Code list for currencies +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies +*/ +export function Currency {}>(Base: TBase) { + return class CurrencyAspect extends Base { + code: string; + symbol: string; + }; +} +const CurrencyXtended = CodeList(Currency(__.Entity)) +export type Currency = InstanceType + +export class Currencies extends Array { +} + diff --git a/bookshop/jsconfig.json b/bookshop/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/bookshop/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/bookstore/@types/AdminService/index.js b/bookstore/@types/AdminService/index.js new file mode 100644 index 00000000..c08b4c49 --- /dev/null +++ b/bookstore/@types/AdminService/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/AdminService/index.ts b/bookstore/@types/AdminService/index.ts new file mode 100644 index 00000000..43e3dae3 --- /dev/null +++ b/bookstore/@types/AdminService/index.ts @@ -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 {}>(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 + +export class Books extends Array { +} + +export function Author {}>(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 + +export class Authors extends Array { +} + diff --git a/bookstore/@types/CatalogService/index.js b/bookstore/@types/CatalogService/index.js new file mode 100644 index 00000000..86b5cace --- /dev/null +++ b/bookstore/@types/CatalogService/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/CatalogService/index.ts b/bookstore/@types/CatalogService/index.ts new file mode 100644 index 00000000..2b228242 --- /dev/null +++ b/bookstore/@types/CatalogService/index.ts @@ -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 {}>(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 + +export class ListOfBooks extends Array { +} + +/** +* For display in details pages +*/ +export function Book {}>(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 + +export class Books extends Array { +} + +// action +export declare const submitOrder: (book: Books, quantity: number) => {}; \ No newline at end of file diff --git a/bookstore/@types/DataService/index.js b/bookstore/@types/DataService/index.js new file mode 100644 index 00000000..e6cdbfe4 --- /dev/null +++ b/bookstore/@types/DataService/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/DataService/index.ts b/bookstore/@types/DataService/index.ts new file mode 100644 index 00000000..8fedb40d --- /dev/null +++ b/bookstore/@types/DataService/index.ts @@ -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 {}>(Base: TBase) { + return class EntityAspect extends Base { + name: string; + columns: { + name: string; + type: string; + isKey: boolean; + }; + }; +} +const EntityXtended = Entity(__.Entity) +export type Entity = InstanceType + +export class Entities extends Array { +} + +/** +* The actual data, organized by column name +*/ +export function Data {}>(Base: TBase) { + return class DataAspect extends Base { + record: {}; + }; +} +const DataXtended = Data(__.Entity) +export type Data = InstanceType + +export class Data_ extends Array { +} + diff --git a/bookstore/@types/OrdersService/index.js b/bookstore/@types/OrdersService/index.js new file mode 100644 index 00000000..c98182cd --- /dev/null +++ b/bookstore/@types/OrdersService/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/OrdersService/index.ts b/bookstore/@types/OrdersService/index.ts new file mode 100644 index 00000000..3c0fcf2a --- /dev/null +++ b/bookstore/@types/OrdersService/index.ts @@ -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 {}>(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 + +export class Orders extends Array { +} + diff --git a/bookstore/@types/ReviewsService/index.js b/bookstore/@types/ReviewsService/index.js new file mode 100644 index 00000000..3fb7d97a --- /dev/null +++ b/bookstore/@types/ReviewsService/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/ReviewsService/index.ts b/bookstore/@types/ReviewsService/index.ts new file mode 100644 index 00000000..c61105bf --- /dev/null +++ b/bookstore/@types/ReviewsService/index.ts @@ -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 {}>(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 + +export class Reviews extends Array { +} + +// action +export declare const like: (review: Reviews) => {}; +// action +export declare const unlike: (review: Reviews) => {}; \ No newline at end of file diff --git a/bookstore/@types/_/index.js b/bookstore/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/bookstore/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/bookstore/@types/_/index.ts b/bookstore/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/bookstore/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/bookstore/@types/index.js b/bookstore/@types/index.js new file mode 100644 index 00000000..ec7b888a --- /dev/null +++ b/bookstore/@types/index.js @@ -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('') \ No newline at end of file diff --git a/bookstore/@types/index.ts b/bookstore/@types/index.ts new file mode 100644 index 00000000..b21d20ca --- /dev/null +++ b/bookstore/@types/index.ts @@ -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 {}>(Base: TBase) { + return class cuidAspect extends Base { + ID: string; + }; +} +const cuidXtended = cuid(__.Entity) +export type cuid = InstanceType + +// the following represents the CDS aspect 'managed' +export function managed {}>(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 + +// the following represents the CDS aspect 'temporal' +export function temporal {}>(Base: TBase) { + return class temporalAspect extends Base { + validFrom: Date; + validTo: Date; + }; +} +const temporalXtended = temporal(__.Entity) +export type temporal = InstanceType + +// the following represents the CDS aspect 'extensible' +export function extensible {}>(Base: TBase) { + return class extensibleAspect extends Base { + extensions__: string; + }; +} +const extensibleXtended = extensible(__.Entity) +export type extensible = InstanceType + + diff --git a/bookstore/@types/sap/capire/bookshop/index.js b/bookstore/@types/sap/capire/bookshop/index.js new file mode 100644 index 00000000..e1714d25 --- /dev/null +++ b/bookstore/@types/sap/capire/bookshop/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/sap/capire/bookshop/index.ts b/bookstore/@types/sap/capire/bookshop/index.ts new file mode 100644 index 00000000..c9b358e9 --- /dev/null +++ b/bookstore/@types/sap/capire/bookshop/index.ts @@ -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 {}>(Base: TBase) { + return class BookAspect extends Base { + ID: number; + title: string; + descr: string; + author: __.Association.to; + genre: __.Association.to; + 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 + +export class Books extends Array { +} + +export function Author {}>(Base: TBase) { + return class AuthorAspect extends Base { + ID: number; + name: string; + dateOfBirth: Date; + dateOfDeath: Date; + placeOfBirth: string; + placeOfDeath: string; + books: __.Association.to.many; + }; +} +const AuthorXtended = _.managed(Author(__.Entity)) +export type Author = InstanceType + +export class Authors extends Array { +} + +/** +* Hierarchically organized Code List for Genres +*/ +export function Genre {}>(Base: TBase) { + return class GenreAspect extends Base { + ID: number; + parent: __.Association.to; + children: __.Composition.of.many; + }; +} +const GenreXtended = _sap_common.CodeList(Genre(__.Entity)) +export type Genre = InstanceType + +export class Genres extends Array { +} + diff --git a/bookstore/@types/sap/capire/orders/index.js b/bookstore/@types/sap/capire/orders/index.js new file mode 100644 index 00000000..1b441782 --- /dev/null +++ b/bookstore/@types/sap/capire/orders/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/sap/capire/orders/index.ts b/bookstore/@types/sap/capire/orders/index.ts new file mode 100644 index 00000000..fba0ede4 --- /dev/null +++ b/bookstore/@types/sap/capire/orders/index.ts @@ -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 {}>(Base: TBase) { + return class OrderAspect extends Base { + OrderNo: string; + Items: { + ID: string; + product: __.Association.to; + 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 + +export class Orders extends Array { +} + +/** +* This is a stand-in for arbitrary ordered Products +*/ +export function Product {}>(Base: TBase) { + return class ProductAspect extends Base { + ID: string; + }; +} +const ProductXtended = Product(__.Entity) +export type Product = InstanceType + +export class Products extends Array { +} + diff --git a/bookstore/@types/sap/capire/reviews/index.js b/bookstore/@types/sap/capire/reviews/index.js new file mode 100644 index 00000000..fef77aa7 --- /dev/null +++ b/bookstore/@types/sap/capire/reviews/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/sap/capire/reviews/index.ts b/bookstore/@types/sap/capire/reviews/index.ts new file mode 100644 index 00000000..6a23e13e --- /dev/null +++ b/bookstore/@types/sap/capire/reviews/index.ts @@ -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 {}>(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; + liked: number; + }; +} +const ReviewXtended = Review(__.Entity) +export type Review = InstanceType + +export class Reviews extends Array { +} + +export function Like {}>(Base: TBase) { + return class LikeAspect extends Base { + review: __.Association.to; + /** + * Canonical user ID + */ + user: _.User; + }; +} +const LikeXtended = Like(__.Entity) +export type Like = InstanceType + +export class Likes extends Array { +} + diff --git a/bookstore/@types/sap/common/countries/index.js b/bookstore/@types/sap/common/countries/index.js new file mode 100644 index 00000000..0f7ec90e --- /dev/null +++ b/bookstore/@types/sap/common/countries/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/sap/common/countries/index.ts b/bookstore/@types/sap/common/countries/index.ts new file mode 100644 index 00000000..352cd25a --- /dev/null +++ b/bookstore/@types/sap/common/countries/index.ts @@ -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 {}>(Base: TBase) { + return class RegionAspect extends Base { + code: string; + children: __.Composition.of.many; + cities: __.Composition.of.many; + _parent: string; + }; +} +const RegionXtended = _sap_common.CodeList(Region(__.Entity)) +export type Region = InstanceType + +export class Regions extends Array { +} + +export function City {}>(Base: TBase) { + return class CityAspect extends Base { + code: string; + region: __.Association.to; + districts: __.Composition.of.many; + }; +} +const CityXtended = _sap_common.CodeList(City(__.Entity)) +export type City = InstanceType + +export class Cities extends Array { +} + +export function District {}>(Base: TBase) { + return class DistrictAspect extends Base { + code: string; + city: __.Association.to; + }; +} +const DistrictXtended = _sap_common.CodeList(District(__.Entity)) +export type District = InstanceType + +export class Districts extends Array { +} + diff --git a/bookstore/@types/sap/common/index.js b/bookstore/@types/sap/common/index.js new file mode 100644 index 00000000..46d0912b --- /dev/null +++ b/bookstore/@types/sap/common/index.js @@ -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 \ No newline at end of file diff --git a/bookstore/@types/sap/common/index.ts b/bookstore/@types/sap/common/index.ts new file mode 100644 index 00000000..5de1738a --- /dev/null +++ b/bookstore/@types/sap/common/index.ts @@ -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 {}>(Base: TBase) { + return class CodeListAspect extends Base { + name: string; + descr: string; + }; +} +const CodeListXtended = CodeList(__.Entity) +export type CodeList = InstanceType + +/** +* Code list for languages +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages +*/ +export function Language {}>(Base: TBase) { + return class LanguageAspect extends Base { + /** + * Type for a language code + */ + code: Locale; + }; +} +const LanguageXtended = CodeList(Language(__.Entity)) +export type Language = InstanceType + +export class Languages extends Array { +} + +/** +* Code list for countries +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries +*/ +export function Country {}>(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 + +export class Countries extends Array { +} + +/** +* Code list for currencies +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies +*/ +export function Currency {}>(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 + +export class Currencies extends Array { +} + diff --git a/bookstore/jsconfig.json b/bookstore/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/bookstore/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/common/@types/_/index.js b/common/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/common/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/common/@types/_/index.ts b/common/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/common/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/common/@types/index.js b/common/@types/index.js new file mode 100644 index 00000000..ec7b888a --- /dev/null +++ b/common/@types/index.js @@ -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('') \ No newline at end of file diff --git a/common/@types/index.ts b/common/@types/index.ts new file mode 100644 index 00000000..b21d20ca --- /dev/null +++ b/common/@types/index.ts @@ -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 {}>(Base: TBase) { + return class cuidAspect extends Base { + ID: string; + }; +} +const cuidXtended = cuid(__.Entity) +export type cuid = InstanceType + +// the following represents the CDS aspect 'managed' +export function managed {}>(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 + +// the following represents the CDS aspect 'temporal' +export function temporal {}>(Base: TBase) { + return class temporalAspect extends Base { + validFrom: Date; + validTo: Date; + }; +} +const temporalXtended = temporal(__.Entity) +export type temporal = InstanceType + +// the following represents the CDS aspect 'extensible' +export function extensible {}>(Base: TBase) { + return class extensibleAspect extends Base { + extensions__: string; + }; +} +const extensibleXtended = extensible(__.Entity) +export type extensible = InstanceType + + diff --git a/common/@types/sap/common/countries/index.js b/common/@types/sap/common/countries/index.js new file mode 100644 index 00000000..0f7ec90e --- /dev/null +++ b/common/@types/sap/common/countries/index.js @@ -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 \ No newline at end of file diff --git a/common/@types/sap/common/countries/index.ts b/common/@types/sap/common/countries/index.ts new file mode 100644 index 00000000..352cd25a --- /dev/null +++ b/common/@types/sap/common/countries/index.ts @@ -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 {}>(Base: TBase) { + return class RegionAspect extends Base { + code: string; + children: __.Composition.of.many; + cities: __.Composition.of.many; + _parent: string; + }; +} +const RegionXtended = _sap_common.CodeList(Region(__.Entity)) +export type Region = InstanceType + +export class Regions extends Array { +} + +export function City {}>(Base: TBase) { + return class CityAspect extends Base { + code: string; + region: __.Association.to; + districts: __.Composition.of.many; + }; +} +const CityXtended = _sap_common.CodeList(City(__.Entity)) +export type City = InstanceType + +export class Cities extends Array { +} + +export function District {}>(Base: TBase) { + return class DistrictAspect extends Base { + code: string; + city: __.Association.to; + }; +} +const DistrictXtended = _sap_common.CodeList(District(__.Entity)) +export type District = InstanceType + +export class Districts extends Array { +} + diff --git a/common/@types/sap/common/index.js b/common/@types/sap/common/index.js new file mode 100644 index 00000000..46d0912b --- /dev/null +++ b/common/@types/sap/common/index.js @@ -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 \ No newline at end of file diff --git a/common/@types/sap/common/index.ts b/common/@types/sap/common/index.ts new file mode 100644 index 00000000..5de1738a --- /dev/null +++ b/common/@types/sap/common/index.ts @@ -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 {}>(Base: TBase) { + return class CodeListAspect extends Base { + name: string; + descr: string; + }; +} +const CodeListXtended = CodeList(__.Entity) +export type CodeList = InstanceType + +/** +* Code list for languages +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages +*/ +export function Language {}>(Base: TBase) { + return class LanguageAspect extends Base { + /** + * Type for a language code + */ + code: Locale; + }; +} +const LanguageXtended = CodeList(Language(__.Entity)) +export type Language = InstanceType + +export class Languages extends Array { +} + +/** +* Code list for countries +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries +*/ +export function Country {}>(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 + +export class Countries extends Array { +} + +/** +* Code list for currencies +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies +*/ +export function Currency {}>(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 + +export class Currencies extends Array { +} + diff --git a/common/jsconfig.json b/common/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/common/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/data-viewer/@types/DataService/index.js b/data-viewer/@types/DataService/index.js new file mode 100644 index 00000000..e6cdbfe4 --- /dev/null +++ b/data-viewer/@types/DataService/index.js @@ -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 \ No newline at end of file diff --git a/data-viewer/@types/DataService/index.ts b/data-viewer/@types/DataService/index.ts new file mode 100644 index 00000000..8fedb40d --- /dev/null +++ b/data-viewer/@types/DataService/index.ts @@ -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 {}>(Base: TBase) { + return class EntityAspect extends Base { + name: string; + columns: { + name: string; + type: string; + isKey: boolean; + }; + }; +} +const EntityXtended = Entity(__.Entity) +export type Entity = InstanceType + +export class Entities extends Array { +} + +/** +* The actual data, organized by column name +*/ +export function Data {}>(Base: TBase) { + return class DataAspect extends Base { + record: {}; + }; +} +const DataXtended = Data(__.Entity) +export type Data = InstanceType + +export class Data_ extends Array { +} + diff --git a/data-viewer/@types/_/index.js b/data-viewer/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/data-viewer/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/data-viewer/@types/_/index.ts b/data-viewer/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/data-viewer/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/data-viewer/jsconfig.json b/data-viewer/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/data-viewer/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/hello/@types/_/index.js b/hello/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/hello/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/hello/@types/_/index.ts b/hello/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/hello/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/hello/jsconfig.json b/hello/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/hello/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/media/@types/_/index.js b/media/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/media/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/media/@types/_/index.ts b/media/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/media/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/media/@types/sap/capire/media/MediaServer/index.js b/media/@types/sap/capire/media/MediaServer/index.js new file mode 100644 index 00000000..236a8777 --- /dev/null +++ b/media/@types/sap/capire/media/MediaServer/index.js @@ -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 \ No newline at end of file diff --git a/media/@types/sap/capire/media/MediaServer/index.ts b/media/@types/sap/capire/media/MediaServer/index.ts new file mode 100644 index 00000000..4d9b3a19 --- /dev/null +++ b/media/@types/sap/capire/media/MediaServer/index.ts @@ -0,0 +1,22 @@ +// This is an automatically generated file. Please do not change its contents manually! +import * as __ from './../../../../_'; + + + + + +export function Media {}>(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 + +export class Media_ extends Array { +} + diff --git a/media/@types/sap/capire/media/index.js b/media/@types/sap/capire/media/index.js new file mode 100644 index 00000000..c52632ce --- /dev/null +++ b/media/@types/sap/capire/media/index.js @@ -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 \ No newline at end of file diff --git a/media/@types/sap/capire/media/index.ts b/media/@types/sap/capire/media/index.ts new file mode 100644 index 00000000..4c42eda2 --- /dev/null +++ b/media/@types/sap/capire/media/index.ts @@ -0,0 +1,22 @@ +// This is an automatically generated file. Please do not change its contents manually! +import * as __ from './../../../_'; + + + + + +export function Media {}>(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 + +export class Media_ extends Array { +} + diff --git a/media/jsconfig.json b/media/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/media/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/orders/@types/OrdersService/index.js b/orders/@types/OrdersService/index.js new file mode 100644 index 00000000..c98182cd --- /dev/null +++ b/orders/@types/OrdersService/index.js @@ -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 \ No newline at end of file diff --git a/orders/@types/OrdersService/index.ts b/orders/@types/OrdersService/index.ts new file mode 100644 index 00000000..d631ce86 --- /dev/null +++ b/orders/@types/OrdersService/index.ts @@ -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 {}>(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 + +export class Orders extends Array { +} + diff --git a/orders/@types/_/index.js b/orders/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/orders/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/orders/@types/_/index.ts b/orders/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/orders/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/orders/@types/index.js b/orders/@types/index.js new file mode 100644 index 00000000..ec7b888a --- /dev/null +++ b/orders/@types/index.js @@ -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('') \ No newline at end of file diff --git a/orders/@types/index.ts b/orders/@types/index.ts new file mode 100644 index 00000000..b21d20ca --- /dev/null +++ b/orders/@types/index.ts @@ -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 {}>(Base: TBase) { + return class cuidAspect extends Base { + ID: string; + }; +} +const cuidXtended = cuid(__.Entity) +export type cuid = InstanceType + +// the following represents the CDS aspect 'managed' +export function managed {}>(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 + +// the following represents the CDS aspect 'temporal' +export function temporal {}>(Base: TBase) { + return class temporalAspect extends Base { + validFrom: Date; + validTo: Date; + }; +} +const temporalXtended = temporal(__.Entity) +export type temporal = InstanceType + +// the following represents the CDS aspect 'extensible' +export function extensible {}>(Base: TBase) { + return class extensibleAspect extends Base { + extensions__: string; + }; +} +const extensibleXtended = extensible(__.Entity) +export type extensible = InstanceType + + diff --git a/orders/@types/sap/capire/orders/index.js b/orders/@types/sap/capire/orders/index.js new file mode 100644 index 00000000..1b441782 --- /dev/null +++ b/orders/@types/sap/capire/orders/index.js @@ -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 \ No newline at end of file diff --git a/orders/@types/sap/capire/orders/index.ts b/orders/@types/sap/capire/orders/index.ts new file mode 100644 index 00000000..29103a07 --- /dev/null +++ b/orders/@types/sap/capire/orders/index.ts @@ -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 {}>(Base: TBase) { + return class OrderAspect extends Base { + OrderNo: string; + Items: { + ID: string; + product: __.Association.to; + 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 + +export class Orders extends Array { +} + +/** +* This is a stand-in for arbitrary ordered Products +*/ +export function Product {}>(Base: TBase) { + return class ProductAspect extends Base { + ID: string; + }; +} +const ProductXtended = Product(__.Entity) +export type Product = InstanceType + +export class Products extends Array { +} + diff --git a/orders/@types/sap/common/countries/index.js b/orders/@types/sap/common/countries/index.js new file mode 100644 index 00000000..0f7ec90e --- /dev/null +++ b/orders/@types/sap/common/countries/index.js @@ -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 \ No newline at end of file diff --git a/orders/@types/sap/common/countries/index.ts b/orders/@types/sap/common/countries/index.ts new file mode 100644 index 00000000..352cd25a --- /dev/null +++ b/orders/@types/sap/common/countries/index.ts @@ -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 {}>(Base: TBase) { + return class RegionAspect extends Base { + code: string; + children: __.Composition.of.many; + cities: __.Composition.of.many; + _parent: string; + }; +} +const RegionXtended = _sap_common.CodeList(Region(__.Entity)) +export type Region = InstanceType + +export class Regions extends Array { +} + +export function City {}>(Base: TBase) { + return class CityAspect extends Base { + code: string; + region: __.Association.to; + districts: __.Composition.of.many; + }; +} +const CityXtended = _sap_common.CodeList(City(__.Entity)) +export type City = InstanceType + +export class Cities extends Array { +} + +export function District {}>(Base: TBase) { + return class DistrictAspect extends Base { + code: string; + city: __.Association.to; + }; +} +const DistrictXtended = _sap_common.CodeList(District(__.Entity)) +export type District = InstanceType + +export class Districts extends Array { +} + diff --git a/orders/@types/sap/common/index.js b/orders/@types/sap/common/index.js new file mode 100644 index 00000000..46d0912b --- /dev/null +++ b/orders/@types/sap/common/index.js @@ -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 \ No newline at end of file diff --git a/orders/@types/sap/common/index.ts b/orders/@types/sap/common/index.ts new file mode 100644 index 00000000..5de1738a --- /dev/null +++ b/orders/@types/sap/common/index.ts @@ -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 {}>(Base: TBase) { + return class CodeListAspect extends Base { + name: string; + descr: string; + }; +} +const CodeListXtended = CodeList(__.Entity) +export type CodeList = InstanceType + +/** +* Code list for languages +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages +*/ +export function Language {}>(Base: TBase) { + return class LanguageAspect extends Base { + /** + * Type for a language code + */ + code: Locale; + }; +} +const LanguageXtended = CodeList(Language(__.Entity)) +export type Language = InstanceType + +export class Languages extends Array { +} + +/** +* Code list for countries +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries +*/ +export function Country {}>(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 + +export class Countries extends Array { +} + +/** +* Code list for currencies +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies +*/ +export function Currency {}>(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 + +export class Currencies extends Array { +} + diff --git a/orders/jsconfig.json b/orders/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/orders/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file diff --git a/reviews/@types/ReviewsService/index.js b/reviews/@types/ReviewsService/index.js new file mode 100644 index 00000000..3fb7d97a --- /dev/null +++ b/reviews/@types/ReviewsService/index.js @@ -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 \ No newline at end of file diff --git a/reviews/@types/ReviewsService/index.ts b/reviews/@types/ReviewsService/index.ts new file mode 100644 index 00000000..c61105bf --- /dev/null +++ b/reviews/@types/ReviewsService/index.ts @@ -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 {}>(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 + +export class Reviews extends Array { +} + +// action +export declare const like: (review: Reviews) => {}; +// action +export declare const unlike: (review: Reviews) => {}; \ No newline at end of file diff --git a/reviews/@types/_/index.js b/reviews/@types/_/index.js new file mode 100644 index 00000000..ac3bdb74 --- /dev/null +++ b/reviews/@types/_/index.js @@ -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('_') \ No newline at end of file diff --git a/reviews/@types/_/index.ts b/reviews/@types/_/index.ts new file mode 100644 index 00000000..2281870a --- /dev/null +++ b/reviews/@types/_/index.ts @@ -0,0 +1,35 @@ +// This is an automatically generated file. Please do not change its contents manually! + + +export namespace Association { + export type to = T & ((fn:(a:T)=>any) => T) + export namespace to { + // type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export namespace Composition { + export type of = T & ((fn:(a:T)=>any) => T) + export namespace of { + //type many = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]); + export type many = T & ((fn:(a:T[number])=>any) => T[number]); + } +} + +export class Entity { + static data (this:T, input:Object) : T { + return {} as T // mock + } +} + +export type EntitySet = T[] & { + data (input:object[]) : T[] + data (input:object) : T +} + + + + + + diff --git a/reviews/@types/index.js b/reviews/@types/index.js new file mode 100644 index 00000000..ec7b888a --- /dev/null +++ b/reviews/@types/index.js @@ -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('') \ No newline at end of file diff --git a/reviews/@types/index.ts b/reviews/@types/index.ts new file mode 100644 index 00000000..b21d20ca --- /dev/null +++ b/reviews/@types/index.ts @@ -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 {}>(Base: TBase) { + return class cuidAspect extends Base { + ID: string; + }; +} +const cuidXtended = cuid(__.Entity) +export type cuid = InstanceType + +// the following represents the CDS aspect 'managed' +export function managed {}>(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 + +// the following represents the CDS aspect 'temporal' +export function temporal {}>(Base: TBase) { + return class temporalAspect extends Base { + validFrom: Date; + validTo: Date; + }; +} +const temporalXtended = temporal(__.Entity) +export type temporal = InstanceType + +// the following represents the CDS aspect 'extensible' +export function extensible {}>(Base: TBase) { + return class extensibleAspect extends Base { + extensions__: string; + }; +} +const extensibleXtended = extensible(__.Entity) +export type extensible = InstanceType + + diff --git a/reviews/@types/sap/capire/reviews/index.js b/reviews/@types/sap/capire/reviews/index.js new file mode 100644 index 00000000..fef77aa7 --- /dev/null +++ b/reviews/@types/sap/capire/reviews/index.js @@ -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 \ No newline at end of file diff --git a/reviews/@types/sap/capire/reviews/index.ts b/reviews/@types/sap/capire/reviews/index.ts new file mode 100644 index 00000000..6a23e13e --- /dev/null +++ b/reviews/@types/sap/capire/reviews/index.ts @@ -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 {}>(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; + liked: number; + }; +} +const ReviewXtended = Review(__.Entity) +export type Review = InstanceType + +export class Reviews extends Array { +} + +export function Like {}>(Base: TBase) { + return class LikeAspect extends Base { + review: __.Association.to; + /** + * Canonical user ID + */ + user: _.User; + }; +} +const LikeXtended = Like(__.Entity) +export type Like = InstanceType + +export class Likes extends Array { +} + diff --git a/reviews/@types/sap/common/index.js b/reviews/@types/sap/common/index.js new file mode 100644 index 00000000..46d0912b --- /dev/null +++ b/reviews/@types/sap/common/index.js @@ -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 \ No newline at end of file diff --git a/reviews/@types/sap/common/index.ts b/reviews/@types/sap/common/index.ts new file mode 100644 index 00000000..e88b2f92 --- /dev/null +++ b/reviews/@types/sap/common/index.ts @@ -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 {}>(Base: TBase) { + return class CodeListAspect extends Base { + name: string; + descr: string; + }; +} +const CodeListXtended = CodeList(__.Entity) +export type CodeList = InstanceType + +/** +* Code list for languages +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages +*/ +export function Language {}>(Base: TBase) { + return class LanguageAspect extends Base { + /** + * Type for a language code + */ + code: Locale; + }; +} +const LanguageXtended = CodeList(Language(__.Entity)) +export type Language = InstanceType + +export class Languages extends Array { +} + +/** +* Code list for countries +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries +*/ +export function Country {}>(Base: TBase) { + return class CountryAspect extends Base { + code: string; + }; +} +const CountryXtended = CodeList(Country(__.Entity)) +export type Country = InstanceType + +export class Countries extends Array { +} + +/** +* Code list for currencies +* +* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies +*/ +export function Currency {}>(Base: TBase) { + return class CurrencyAspect extends Base { + code: string; + symbol: string; + }; +} +const CurrencyXtended = CodeList(Currency(__.Entity)) +export type Currency = InstanceType + +export class Currencies extends Array { +} + diff --git a/reviews/jsconfig.json b/reviews/jsconfig.json new file mode 100644 index 00000000..90fc6061 --- /dev/null +++ b/reviews/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "checkJs": true + } +} \ No newline at end of file