Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose outbox features #12

Merged
merged 5 commits into from
Jan 22, 2024
Merged
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
3 changes: 3 additions & 0 deletions apis/services.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,6 @@ export const update: Service['update']
export const transaction: Service['transaction']
export const db: DatabaseService
// export const upsert: Service['upsert']

export const outboxed: (service: Service) => Service
export const unboxed: (service: Service) => Service
5 changes: 5 additions & 0 deletions test/typescript/apis/project/cds-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,8 @@ await cds.tx (async (tx) => {
await tx.run(SELECT(1).from(Books,201).forUpdate())
})
cds.db.entities('draftModelAuth')

//tests outbox
const outboxedService = cds.outboxed(srv)
await outboxedService.send({ event: 'feeEstimation', entity: networkGroups, data: {name:'Volta'}})
await cds.unboxed(outboxedService).send({ event: 'feeEstimation', entity: networkGroups, data: {name:'Volta'}})