Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apis/linked.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as csn from './csn'
import { IterableMap } from './internal/util'
import { Definitions, any_, entity, service_ } from './linked/classes'

// TODO: the function usage for services is not documented and will be removed with cds^10
export type ModelPart<T extends any_> = IterableMap<T> & ((namespace: string) => IterableMap<T>)
type Visitor = (def: any_, name: string, parent: any_, defs: Definitions) => void
type Filter = string | (<T extends any_ = any_>(def: T) => boolean)
Expand Down
18 changes: 16 additions & 2 deletions test/typescript/apis/project/cds-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ cds.connect({kind: 'odata', model:'some/imported/model', service: 'BusinessPartn
// basic properties
srv.name.length
srv.entities[0] = Books // same type
srv.events[0] = ???
srv.types[0] = ???
srv.actions[0] = ???

// TODO: function usage was never official, is now deprecated, and will be removed with cds^10
srv.entities('namespace')
srv.events('namespace')
srv.types('namespace')
srv.operations('namespace')
srv.operations('namespace') //> should be .actions()
srv.actions('namespace')

await srv.init()

Expand Down Expand Up @@ -469,6 +475,14 @@ srv.entities('namespace');
// @ts-expect-error
srv.entities('namespace')('and again')

// TODO: function usage was never official, is now deprecated, and will be removed with cds^10
// @ts-expect-deprecated -> is there such a thing? :D
srv.entities('namespace')
srv.events('namespace')
srv.types('namespace')
srv.operations('namespace') //> should be .actions()
srv.actions('namespace')

type ActionType = HandlerFunction<typeof unboundAction>
srv.on(unboundAction, externalActionHandler)
function externalActionHandler(req: ActionType['parameters']['req']): ActionType['returns'] {
Expand Down Expand Up @@ -499,4 +513,4 @@ asrv.on('', (req) => {
asrv.dispatch([req])
})
asrv.dispatch('foo')
asrv.dispatch(['foo', 'bar'])
asrv.dispatch(['foo', 'bar'])
Loading