declare module '@sap/cds' {
export * from "@sap/cds-dk";
export type __any_ = classes.any_
export type __array = classes.array
export type __aspect = classes.aspect
export type __Association = classes.Association
export type __Binary = classes.Binary
export type __Boolean = classes.Boolean
export type __Composition = classes.Composition
export type __context_ = classes.context_
export type __Date = classes.Date
export type __date = classes.date
export type __DateTime = classes.DateTime
export type __Decimal = classes.Decimal
export type __Double = classes.Double
export type __entity = classes.entity
export type __Float = classes.Float
export type __Int16 = classes.Int16
export type __Int32 = classes.Int32
export type __Int64 = classes.Int64
export type __Integer = classes.Integer
export type __LargeBinary = classes.LargeBinary
export type __LargeString = classes.LargeString
export type __scalar = classes.scalar
export type __service = classes.service_
export type __String = classes.String
export type __struct = classes.struct
export type __Time = classes.Time
export type __TimeStamp = classes.TimeStamp
export type __type = classes.type
export type __UInt8 = classes.UInt8
export type __UUID = classes.UUID
export type __Vector = classes.Vector
class action extends any__2<'action' | 'function'> {}
export interface ActionEventHandler {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
(req: ActionRequest
, next: Function): Promise | R
}
export type ActionRequest = Omit & { data: P, subject: S }
interface And {
and: TaggedTemplateQueryPart
& ((predicate: object) => this)
& ((...expr: any[]) => this)
}
/**
* Subclass representing unauthenticated users.
*/
export class Anonymous extends User {
constructor ()
is (): boolean
}
const any: typeof any__2;
interface any_ {
kind?: kinds
/**
* only available when compiled with docs:true
* @see [capire docs](https://cap.cloud.sap/docs/cds/cdl#comments)
*/
doc?: string
}
interface any__2 extends csn.any_ {}
class any__2 {
private _: K // break covariance
constructor (...aspects: any[])
readonly name: string
// parked, might be deprecated
// is (kind: kinds | 'Association' | 'Composition'): boolean
}
/**
* The {@link https://expressjs.com/en/4x/api.html#app| express.js application} constructed by the server implementation.
*
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-server#cds-app)
*/
export const app: import('express').Application;
export class ApplicationService extends Service {
new(draft: T, data: {[K in keyof InstanceType]?: InstanceType[K]}): Promise
new(draft: T): {
for(keys: Key[]): Promise,
}
discard(draft: Constructable, keys: Key[]): Promise
edit(draft: Constructable, keys: Key[]): Promise
save(draft: Constructable, keys: Key[]): Promise
}
export class array extends type<'type' | 'elements'> { }
interface ArrayConstructable {
new(...args: any[]): T[]
}
class aspect extends type implements WithElements {
elements: Definitions>
}
/**
* @see [capire](https://cap.cloud.sap/docs/node.js/cds-reflect#cds-association)
*/
export interface Association extends Omit {}
export class Association extends type {
_target: entity
isAssociation: true
is2one: boolean
is2many: boolean
}
interface Association_2 extends type_2 {
target: FQN
/**
* The specified cardinality. to-one = `{max:1}`, to-many = `{max:'*'}`
*/
cardinality?: { src?: 1, min?: 1 | 0, max?: 1 | '*' }
/**
* The parsed on condition in case of unmanaged Associations
*/
on?: predicate
/**
* The optionally specified keys in case of managed Associations
*/
keys?: (ref & { as: string })[]
}
type Awaitable = T & Promise
class Axios {
get axios (): import('axios').AxiosInstance
get: import('axios').AxiosInstance['get'] & TaggedTemplateRequest
put: import('axios').AxiosInstance['put'] & TaggedTemplateRequest
post: import('axios').AxiosInstance['post'] & TaggedTemplateRequest
patch: import('axios').AxiosInstance['patch'] & TaggedTemplateRequest
delete: import('axios').AxiosInstance['delete'] & TaggedTemplateRequest
options: import('axios').AxiosInstance['options'] & TaggedTemplateRequest
get GET (): Axios['get']
get PUT (): Axios['put']
get POST (): Axios['post']
get PATCH (): Axios['patch']
get DELETE (): Axios['delete']
get OPTIONS (): Axios['options']
}
class Binary extends string { }
const boolean: typeof boolean_;
class boolean_ extends scalar { }
class Boolean_2 extends boolean { }
export const builtin: {
/**
* @see {@link models.linked.classes}
*/
classes: typeof models.linked.classes,
types: Record, // FIXME: value should be any class part of linked.classes
};
interface ByKey {
byKey (primaryKey?: PK): this
}
export type CDL = string
namespace cds {
export {
log,
debug,
test,
ql,
QLExtensions,
csn,
delete_ as delete,
version,
home,
root,
cli,
requires,
extend,
lazify,
lazified,
entity,
event,
type,
array,
struct,
Association,
Composition,
builtin,
on,
once,
exit,
error,
_cds,
cds_services,
connect,
server,
serve,
services,
service,
cds_serve_fluent,
cds_connect_options,
Middlewares,
middlewares,
app,
env,
_TODO,
get,
load,
resolve,
minify,
reflect,
_flavor,
_odata_options,
_options,
JSON_2 as JSON,
YAML,
CDL,
SQL,
XML,
EDM,
EDMX,
filename,
model,
parse,
linked,
__type,
__aspect,
__any_,
__scalar,
__Boolean,
__UUID,
__String,
__LargeString,
__Binary,
__LargeBinary,
__Vector,
__Integer,
__UInt8,
__Int16,
__Int32,
__Int64,
__Float,
__Double,
__Decimal,
__date,
__Date,
__Time,
__DateTime,
__TimeStamp,
__array,
__struct,
__context_,
__service,
__entity,
__Association,
__Composition,
compile,
spawn,
Key,
QueryAPI,
PropertiesOf,
Send,
FluentScheduling,
Service,
ApplicationService,
MessagingService,
RemoteService,
DatabaseService,
Transaction,
ResultSet,
ServiceImpl,
EventHandler,
OnEventHandler,
OnErrorHandler,
Partial_2 as Partial,
OneOrMany,
CdsFunction,
CdsFunctions,
HandlerFunction,
CRUDEventHandler,
ActionRequest,
ActionEventHandler,
ResultsHandler,
SpawnEvents,
SpawnEventEmitter,
types,
SpawnOptions,
context,
tx,
run,
foreach,
stream,
read,
create,
insert,
update,
transaction,
db,
entities,
queued,
unqueued,
outboxed,
unboxed,
EventContext,
Event_2 as Event,
Request_2 as Request,
GetRequest,
PostRequest,
User,
Anonymous,
Privileged,
utils,
Query,
SELECT_2 as SELECT,
INSERT_2 as INSERT,
UPSERT_2 as UPSERT,
UPDATE_2 as UPDATE,
DELETE_2 as DELETE,
CREATE_2 as CREATE,
DROP_2 as DROP,
primitive,
data,
name,
source,
column_expr,
predicate,
ordering_term,
expr,
ref,
_segment,
_named,
val,
list,
xpr,
_xpr,
operator,
function_call,
enum_literal,
expr_literal,
Texts,
I18nBundle,
I18nFacade,
I18nFilesOptions,
I18nFiles,
i18n
}
}
export default cds;
export type _cds = typeof cds_2
namespace cds_2 {
export {
cds as default,
log,
debug,
test,
ql,
QLExtensions,
csn,
delete_ as delete,
version,
home,
root,
cli,
requires,
extend,
lazify,
lazified,
entity,
event,
type,
array,
struct,
Association,
Composition,
builtin,
on,
once,
exit,
error,
_cds,
cds_services,
connect,
server,
serve,
services,
service,
cds_serve_fluent,
cds_connect_options,
Middlewares,
middlewares,
app,
env,
_TODO,
get,
load,
resolve,
minify,
reflect,
_flavor,
_odata_options,
_options,
JSON_2 as JSON,
YAML,
CDL,
SQL,
XML,
EDM,
EDMX,
filename,
model,
parse,
linked,
__type,
__aspect,
__any_,
__scalar,
__Boolean,
__UUID,
__String,
__LargeString,
__Binary,
__LargeBinary,
__Vector,
__Integer,
__UInt8,
__Int16,
__Int32,
__Int64,
__Float,
__Double,
__Decimal,
__date,
__Date,
__Time,
__DateTime,
__TimeStamp,
__array,
__struct,
__context_,
__service,
__entity,
__Association,
__Composition,
compile,
spawn,
Key,
QueryAPI,
PropertiesOf,
Send,
FluentScheduling,
Service,
ApplicationService,
MessagingService,
RemoteService,
DatabaseService,
Transaction,
ResultSet,
ServiceImpl,
EventHandler,
OnEventHandler,
OnErrorHandler,
Partial_2 as Partial,
OneOrMany,
CdsFunction,
CdsFunctions,
HandlerFunction,
CRUDEventHandler,
ActionRequest,
ActionEventHandler,
ResultsHandler,
SpawnEvents,
SpawnEventEmitter,
types,
SpawnOptions,
context,
tx,
run,
foreach,
stream,
read,
create,
insert,
update,
transaction,
db,
entities,
queued,
unqueued,
outboxed,
unboxed,
EventContext,
Event_2 as Event,
Request_2 as Request,
GetRequest,
PostRequest,
User,
Anonymous,
Privileged,
utils,
Query,
SELECT_2 as SELECT,
INSERT_2 as INSERT,
UPSERT_2 as UPSERT,
UPDATE_2 as UPDATE,
DELETE_2 as DELETE,
CREATE_2 as CREATE,
DROP_2 as DROP,
primitive,
data,
name,
source,
column_expr,
predicate,
ordering_term,
expr,
ref,
_segment,
_named,
val,
list,
xpr,
_xpr,
operator,
function_call,
enum_literal,
expr_literal,
Texts,
I18nBundle,
I18nFacade,
I18nFilesOptions,
I18nFiles,
i18n
}
}
type _cds_2 = typeof cds_2
export interface cds_connect_options {
impl?: string
service?: string
kind?: string
model?: string | CSN
credentials?: object
}
export interface cds_serve_fluent {
from (model: string | CSN): cds_serve_fluent
to (protocol: string): cds_serve_fluent
at (path: string): cds_serve_fluent
in (app: import('express').Application): cds_serve_fluent
with (impl: ServiceImpl | string): cds_serve_fluent
// (req,res) : void
}
export interface cds_services {
[name: string]: Service
}
/**
* @beta helper
*/
export type CdsFunction = {
(...args: any[]): any,
__parameters: object,
__returns: any,
__self?: any, // the entity the function is bound to, in case of bound functions
}
/**
* @beta helper
*/
export type CdsFunctions = Pick
namespace classes {
export {
mixin,
Protocol,
Column,
Definitions,
WithElements,
any__2 as any_,
any,
aspect,
type,
scalar,
boolean,
Boolean_2 as Boolean,
string,
UUID,
String_2 as String,
LargeString,
Binary,
LargeBinary,
Vector,
number,
Integer,
UInt8,
Int16,
Int32,
Int64,
Float,
Double,
Decimal,
date,
Date_2 as Date,
Time,
DateTime,
TimeStamp,
array,
struct,
Map_3 as Map,
context_,
service_,
action,
event,
entity,
Association,
Composition,
ManagedAssociation,
MixedIn
}
}
/**
* The parsed effective `cds` CLI command and arguments.
* May be undefined if not started from the `cds` CLI.
* @see https://cap.cloud.sap/docs/node.js/cds-facade#cds-cli
*/
export const cli: {
/** Basic command like `serve` */ command?: CliCommands,
/** Positional arguments */ argv?: string[],
/** Named arguments */ options?: Record,
} | undefined;
type CliCommands = 'add' | 'build' | 'compile' | 'deploy' | 'import' | 'init' | 'serve' | (string & {})
type Column = { ref: [string], as?: string }
export type column_expr = UnionToIntersection & { as?: name, cast?: any, expand?: column_expr[], inline?: column_expr[] }
interface Columns {
columns:
((...col: KeyOfSingular[]) => This extends undefined ? this : This)
& ((col: KeyOfSingular[]) => This extends undefined ? this : This)
& ((...col: (string | column_expr)[]) => This extends undefined ? this : This)
& ((col: (string | column_expr)[]) => This extends undefined ? this : This)
& TaggedTemplateQueryPart
}
type ColumnValue = Primitive | Readonly | SELECT
/**
* Provides a set of methods to parse a given model, query or expression.
* You can also use `cds.compile(csn).to('