@sap/cds-dk 9.2.1 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/bind.js +5 -8
  3. package/bin/up.js +12 -8
  4. package/lib/bind/cf.js +4 -0
  5. package/lib/bind/k8s.js +21 -0
  6. package/lib/bind/plugin.js +9 -0
  7. package/lib/build/buildTaskProviderFactory.js +8 -14
  8. package/lib/build/constants.js +1 -0
  9. package/lib/build/index.js +17 -2
  10. package/lib/build/plugin.js +5 -7
  11. package/lib/build/provider/hana/index.js +4 -4
  12. package/lib/env/schemas/cds-rc.js +2 -2
  13. package/lib/init/constants.js +3 -2
  14. package/lib/init/projectReader.js +2 -4
  15. package/lib/init/template/ams/index.js +1 -2
  16. package/lib/init/template/approuter/files/containerize.yaml.hbs +1 -1
  17. package/lib/init/template/approuter/index.js +1 -1
  18. package/lib/init/template/extension/files/.base/index.cds +6 -6
  19. package/lib/init/template/extension/index.js +5 -5
  20. package/lib/init/template/github-actions/files/{cf-github-deploy → github-deployment}/action.yaml +7 -5
  21. package/lib/init/template/github-actions/files/kyma-info/action.yaml +1 -1
  22. package/lib/init/template/github-actions/files/workflows/cf.yaml.hbs +10 -7
  23. package/lib/init/template/github-actions/files/workflows/kyma.yaml.hbs +6 -3
  24. package/lib/init/template/github-actions/files/workflows/test.yaml.hbs +5 -2
  25. package/lib/init/template/github-actions/index.js +8 -9
  26. package/lib/init/template/hana/index.js +2 -1
  27. package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -1
  28. package/lib/init/template/html5-repo/files/package.json.hbs +1 -1
  29. package/lib/init/template/html5-repo/index.js +24 -19
  30. package/lib/init/template/ias/files/mta.yaml.hbs +4 -3
  31. package/lib/init/template/ias/files/values.yaml.hbs +41 -40
  32. package/lib/init/template/mta/files/package.json +1 -1
  33. package/lib/init/template/nodejs/files/.vscode/extensions.json +0 -1
  34. package/lib/init/template/nodejs/files/package.json.hbs +3 -9
  35. package/lib/init/template/portal/files/mta.yaml.hbs +5 -1
  36. package/lib/init/template/portal/index.js +0 -1
  37. package/lib/init/template/sample/files/app/_i18n/i18n.properties +15 -0
  38. package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +15 -0
  39. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +14 -15
  40. package/lib/init/template/sample/files/app/browse/fiori-service.cds +44 -44
  41. package/lib/init/template/sample/files/app/common.cds +99 -84
  42. package/lib/init/template/sample/files/db/schema.cds +22 -17
  43. package/lib/init/template/sample/files/package.json.hbs +1 -3
  44. package/lib/init/template/sample/files/srv/admin-service.cds +4 -3
  45. package/lib/init/template/sample/files/srv/cat-service.cds +28 -11
  46. package/lib/init/template/tiny-sample/files/nodejs/db/schema.cds +3 -3
  47. package/lib/init/template/typescript/files/package.json +1 -1
  48. package/lib/init/template/ui5/index.js +22 -0
  49. package/lib/lint/eslintHelp.json +5 -3
  50. package/npm-shrinkwrap.json +13 -13
  51. package/package.json +1 -1
  52. package/lib/init/template/sample/files/javascript/admin-service.js.hbs +0 -24
  53. package/lib/init/template/sample/files/javascript/cat-service.js.hbs +0 -43
  54. package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +0 -16
  55. package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +0 -38
@@ -1,16 +0,0 @@
1
- import cds from '@sap/cds'
2
-
3
- import { Books } from '#cds-models/AdminService'
4
-
5
- export class AdminService extends cds.ApplicationService { async init() {
6
-
7
- /**
8
- * Generate primary keys for target entity in request
9
- */
10
- this.before ('NEW', Books.drafts, async req => {
11
- if (req.data.ID) return
12
- const { ID } = await SELECT.one.from(Books).columns('max(ID) as ID') ?? { ID: 0 }
13
- req.data.ID = ID! - ID! % 100 + 100 + 1
14
- })
15
- return super.init()
16
- }}
@@ -1,38 +0,0 @@
1
- import cds from '@sap/cds'
2
-
3
- import { Books } from '#cds-models/sap/capire/bookshop'
4
- import { submitOrder, OrderedBook, ListOfBooks } from '#cds-models/CatalogService'
5
-
6
- export class CatalogService extends cds.ApplicationService { async init() {
7
-
8
- // Add some discount for overstocked books
9
- this.after('each', ListOfBooks, book => {
10
- if (book?.stock === undefined || book.stock === null) return
11
- if (book?.stock > 111) book.title += ` -- 11% discount!`
12
- })
13
-
14
- // Reduce stock of ordered books if available stock suffices
15
- this.on(submitOrder, async req => {
16
- let { book:id, quantity } = req.data
17
- if(!id) return req.error (400, `Book ID missing`) // FIXED
18
- let book = await SELECT.from (Books, id, b => b.stock)
19
-
20
- // Validate input data
21
- if (!book) return req.error (404, `Book #${id} doesn't exist`)
22
- if (!quantity || quantity < 1) return req.error (400, `quantity has to be 1 or more`)
23
- if (quantity > book.stock!) return req.error (409, `${quantity} exceeds stock for book #${id}`)
24
-
25
- // Reduce stock in database and return updated stock value
26
- await UPDATE (Books, id) .with ({ stock: book.stock! -= quantity })
27
- return book
28
- })
29
-
30
- // Emit event when an order has been submitted
31
- this.after(submitOrder, async (_,req) => {
32
- let { book, quantity } = req.data
33
- await this.emit(OrderedBook, { book, quantity, buyer: req.user.id })
34
- })
35
-
36
- // Delegate requests to the underlying generic service
37
- return super.init()
38
- }}