Compare commits

..

85 Commits

Author SHA1 Message Date
dependabot[bot]
50b13f60ce Bump @sap/cds from 6.5.0 to 6.6.0
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.5.0 to 6.6.0.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 16:05:58 +01:00
dependabot[bot]
f889c27338 Bump @sap/eslint-plugin-cds from 2.6.1 to 2.6.3
Bumps [@sap/eslint-plugin-cds](https://cap.cloud.sap/) from 2.6.1 to 2.6.3.

---
updated-dependencies:
- dependency-name: "@sap/eslint-plugin-cds"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-28 11:56:46 +01:00
dependabot[bot]
624c6c5c72 Bump axios from 1.3.3 to 1.3.4
Bumps [axios](https://github.com/axios/axios) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-28 11:52:58 +01:00
Mara Kiefer
12fd91ca4f Use eslint probe, not validate in VS Code settings
- Parsing error as see in issue https://github.tools.sap/cap/issues/issues/13123
- Related to [VS Code ESLint settings options](https://github.com/microsoft/vscode-eslint/blob/main/README.md#settings-options)
- Should use `eslint.probe` instead of `eslint.validate`

eslint.probe - an array for language identifiers for which the ESLint extension should be activated and should try to validate the file. If validation fails for probed languages the extension says silent. Defaults to ["javascript", "javascriptreact", "typescript", "typescriptreact", "html", "vue", "markdown"].

eslint.validate - an array of language identifiers specifying the files for which validation is to be enforced. This is an old legacy setting and should in normal cases not be necessary anymore. Defaults to ["javascript", "javascriptreact"].
2023-02-28 11:49:01 +01:00
Daniel
535981dc7e Fixing cds lint issues 2023-02-22 13:39:05 +01:00
Daniel
d15d0535d9 Updated package-lock.json -> fixed vulnerability 2023-02-17 17:39:23 +01:00
dependabot[bot]
430d3a46c4 Bump axios from 1.3.1 to 1.3.2
Bumps [axios](https://github.com/axios/axios) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 17:55:15 +01:00
dependabot[bot]
308e6b932a Bump http-cache-semantics from 4.1.0 to 4.1.1
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/commits)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 13:38:42 +01:00
dependabot[bot]
703d45fab0 Bump axios from 1.3.0 to 1.3.1
Bumps [axios](https://github.com/axios/axios) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 13:29:01 +01:00
dependabot[bot]
63c21c5a96 Bump axios from 1.2.6 to 1.3.0
Bumps [axios](https://github.com/axios/axios) from 1.2.6 to 1.3.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.2.6...v1.3.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 13:22:51 +01:00
dependabot[bot]
e0c6b16b15 Bump axios from 1.2.4 to 1.2.6
Bumps [axios](https://github.com/axios/axios) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.2.4...v1.2.6)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 17:16:47 +01:00
dependabot[bot]
0771fc06e6 Bump @sap/cds from 6.4.0 to 6.5.0
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.4.0 to 6.5.0.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 17:14:23 +01:00
dependabot[bot]
dc90cad8f4 Bump axios from 1.2.3 to 1.2.4
Bumps [axios](https://github.com/axios/axios) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-25 13:34:30 +01:00
Christian Georgi
f731a95bd1 Fix indentation 2023-01-18 14:57:15 +01:00
dependabot[bot]
2cd092be10 Bump axios from 1.2.2 to 1.2.3
Bumps [axios](https://github.com/axios/axios) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-18 13:19:55 +01:00
Daniel Hutzel
a1c2f32408 Cleanup (#440)
* Cleanup

* minor cleanups
2023-01-13 09:08:20 +01:00
dependabot[bot]
8a6a42f109 Bump axios from 1.2.1 to 1.2.2
Bumps [axios](https://github.com/axios/axios) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.2.1...1.2.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 11:11:29 +01:00
Daniel
28cfceeaf0 Avoid dangling IO resources 2022-12-20 13:30:17 +01:00
dependabot[bot]
879546829a Bump @sap/cds from 6.3.2 to 6.4.0
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.3.2 to 6.4.0.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-16 13:10:09 +01:00
dependabot[bot]
b7e435d611 Bump sqlite3 from 5.1.3 to 5.1.4
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.1.3 to 5.1.4.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.1.3...v5.1.4)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 17:06:51 +01:00
dependabot[bot]
4f5f075697 Bump sqlite3 from 5.1.2 to 5.1.3
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.1.2 to 5.1.3.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.1.2...v5.1.3)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 14:33:59 +01:00
dependabot[bot]
710c83aa1c Bump axios from 1.2.0 to 1.2.1
Bumps [axios](https://github.com/axios/axios) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 13:39:02 +01:00
dependabot[bot]
e9fbba9f46 Bump axios from 1.1.3 to 1.2.0
Bumps [axios](https://github.com/axios/axios) from 1.1.3 to 1.2.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.1.3...v1.2.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 13:41:22 +01:00
dependabot[bot]
0d96447d4b Bump @sap/cds from 6.3.1 to 6.3.2
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.3.1 to 6.3.2.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 13:39:50 +01:00
Daniel
ed1510d173 sorting loggers 2022-11-30 17:37:51 +01:00
Daniel
d07b20a689 Added loggers sample 2022-11-28 17:54:32 +01:00
dependabot[bot]
e6584c4c15 Bump chai from 4.3.6 to 4.3.7
Bumps [chai](https://github.com/chaijs/chai) from 4.3.6 to 4.3.7.
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/4.x.x/History.md)
- [Commits](https://github.com/chaijs/chai/compare/v4.3.6...v4.3.7)

---
updated-dependencies:
- dependency-name: chai
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-09 16:17:30 +01:00
dependabot[bot]
2a6fca177b Bump axios from 1.1.2 to 1.1.3
Bumps [axios](https://github.com/axios/axios) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.1.2...v1.1.3)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 14:43:24 +01:00
Pierre Fritsch
d9058f9b51 Manage Orders: Switch to translatable texts (#424)
Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 14:38:41 +01:00
Pierre Fritsch
affd1718ef Fiori app *Manage Orders*: Hide technical UUID's (#423)
* Hide Order ID
* Hide Order Item ID

Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 13:33:25 +00:00
Pierre Fritsch
5ff72c3f02 Hide ID and ID_Texts for Books.texts (#422)
Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 13:30:28 +00:00
Pierre Fritsch
666001d564 Filter criteria: Display the Genre name (#421)
Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 13:28:36 +00:00
Pierre Fritsch
e4214b0e40 Fiori app *Browse Books*: Add missing column labels (#420)
* Add labels for `rating` and `numberOfReviews`
* Add label for `currency.symbol`
* Add label for `descr`
* Add label for `image`

Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 13:26:48 +00:00
Pierre Fritsch
ad76c699c9 Add column labels for age and lifetime (#419)
Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-11-08 13:23:44 +00:00
dependabot[bot]
0ad8baefc7 Bump @sap/cds from 6.2.2 to 6.3.1
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.2.2 to 6.3.1.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 14:21:28 +01:00
Daniel
3f7b43346f Buffer() is deprecated 2022-11-06 18:03:38 +01:00
Christian Georgi
6981841d86 Delete question--feedback-or-bug-.md 2022-10-24 09:54:48 +02:00
Christian Georgi
18c29d8b67 Create config.yml 2022-10-24 09:54:18 +02:00
Daniel
02fc1a89a1 Fixed expected tenants in odata.test.js 2022-10-19 13:00:20 +02:00
dependabot[bot]
94b74d76ad Bump @sap/cds from 6.2.1 to 6.2.2 (#413)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.2.1 to 6.2.2.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-14 15:41:17 +02:00
Daniel
b0b4412c7a Fixed genre for Eleonora 2022-10-12 14:59:10 +02:00
dependabot[bot]
70cfa82a35 Bump axios from 0.27.2 to 1.1.2 (#410)
Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.1.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.27.2...v1.1.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 14:03:08 +00:00
dependabot[bot]
d17d74f1ec Bump @sap/cds from 6.1.3 to 6.2.1 (#411)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.1.3 to 6.2.1.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 15:52:35 +02:00
dependabot[bot]
9fbf7c69c9 Bump semver from 7.3.7 to 7.3.8 (#408)
Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.3.8.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.3.8)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-05 16:15:26 +02:00
Daniel
f54a8cecb7 Revert "Extensibility Walkthrough in capire (#405)"
This reverts commit 608e16090c.
2022-10-04 12:12:30 +02:00
Daniel Hutzel
608e16090c Extensibility Walkthrough in capire (#405)
* Extension project template

* SalesRegion ->  x_SalesRegion

* enhanced order repo

* updated package-lock.json
2022-10-04 12:05:57 +02:00
Daniel Hutzel
bd0f514026 Updated workspace setup (#406) 2022-10-04 11:59:22 +02:00
Daniel
ee2fdd0989 cosmetics 2022-10-04 11:48:01 +02:00
dependabot[bot]
92f7489def Bump sqlite3 from 5.1.1 to 5.1.2 (#404)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-04 10:36:43 +02:00
Daniel
e222645935 . 2022-10-03 12:19:20 +02:00
Daniel
8676f7184d . 2022-10-03 12:18:40 +02:00
Daniel
a069f2d7de Using reflected entitites 2022-09-30 10:07:39 +02:00
Daniel
254362daa1 Fine-tuned data-service definition 2022-09-22 17:09:20 +02:00
Daniel
e419fda74e UserService entities are persistence.skipped 2022-09-21 16:33:29 +02:00
Daniel
6bb51a8807 minor 2022-09-20 21:41:59 +02:00
Daniel Hutzel
36b339a362 Re-enabling tests for cds.ql where clauses fix (#403) 2022-09-20 16:52:40 +02:00
Daniel
47655c5f48 unlock 2022-09-16 18:43:11 +02:00
Christian Georgi
aa5fda976a Support csrf tokens in Vue app (#394) 2022-09-16 15:46:20 +02:00
dependabot[bot]
b97253f266 Bump @types/node from 18.7.14 to 18.7.15 (#395)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.7.14 to 18.7.15.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-16 13:41:45 +00:00
dependabot[bot]
65379110e2 Bump sqlite3 from 5.1.0 to 5.1.1 (#401)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.1.0...v5.1.1)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-16 13:39:32 +00:00
Daniel Hutzel
b8e04027d5 Added few cds.ql tests (#402) 2022-09-16 14:55:38 +02:00
dependabot[bot]
630838a7b4 Bump sqlite3 from 5.0.11 to 5.1.0 (#399)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.11 to 5.1.0.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.0.11...v5.1.0)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-14 14:49:22 +02:00
dependabot[bot]
09c2a40c7d Bump @sap/cds from 6.1.2 to 6.1.3 (#398)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.1.2 to 6.1.3.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-14 14:47:17 +02:00
Dr. David A. Kunz
88e527adba Merge pull request #397 from SAP-samples/fix-language-parameters
fix: localized tests
2022-09-09 15:46:24 +02:00
D065023
b0d74b0ea4 fixed localized tests 2022-09-09 15:38:23 +02:00
dependabot[bot]
b4f6d5714c Bump @sap/cds from 6.1.1 to 6.1.2 (#396)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.1.1 to 6.1.2.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-05 22:33:33 +02:00
Daniel
18f9f6c3f8 Removing ts-jest complexity
-> keeping our CI/CD pipelines fast and simple
2022-09-01 11:02:12 +02:00
Lothar Bender
a0d5355f7d fix hana deploy-format configuration (#392)
Co-authored-by: Christian Georgi <chgeo@users.noreply.github.com>
2022-08-26 12:34:43 +00:00
dependabot[bot]
37538a368c Bump @sap/cds from 6.1.0 to 6.1.1 (#393)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.1.0 to 6.1.1.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-26 14:33:05 +02:00
Daniel
662f93a995 cosmetics 2022-08-18 18:02:28 +02:00
Daniel
76bed22f40 Updating .to ES2022 2022-08-18 08:01:50 +02:00
Daniel Hutzel
8ab66b4130 Fix tests to run with mocha (#389) 2022-08-15 14:11:52 +02:00
Daniel
2a37ef8be1 . 2022-08-12 02:52:03 +02:00
dependabot[bot]
de35537c04 Bump @sap/cds from 6.0.4 to 6.1.0 (#388)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.0.4 to 6.1.0.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-11 14:49:14 +02:00
Christian Georgi
e477879d71 Do not depend on cwd in test 2022-08-08 17:07:13 +02:00
Christian Georgi
38593baeb8 Expose user service for downstream usages 2022-08-04 11:03:44 +02:00
dependabot[bot]
f0e8575e5e Bump sqlite3 from 5.0.10 to 5.0.11 (#386)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.10 to 5.0.11.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.0.10...v5.0.11)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 14:22:50 +02:00
Christian Georgi
b52a9c3a21 Remove dummy auth
Gets in the way if we want to switch to MT.
Other apps don't set it either.
2022-07-25 21:19:15 +02:00
Christian Georgi
88cb9c0069 Facade model for fiori 2022-07-25 17:14:52 +02:00
dependabot[bot]
42f7e1920b Bump sqlite3 from 5.0.9 to 5.0.10 (#385)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.9 to 5.0.10.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Changelog](https://github.com/TryGhost/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.0.9...v5.0.10)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-22 16:42:12 +02:00
dependabot[bot]
dea92b54d8 Bump @sap/cds from 6.0.3 to 6.0.4 (#384)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.0.3 to 6.0.4.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-20 15:36:02 +02:00
Dr. David A. Kunz
9a98ffd298 fix(reviews): authorization restrictions (#382) 2022-07-18 14:02:43 +02:00
dependabot[bot]
57cda61b02 Bump sqlite3 from 5.0.8 to 5.0.9 (#381)
Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.8 to 5.0.9.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Changelog](https://github.com/TryGhost/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.0.8...v5.0.9)

---
updated-dependencies:
- dependency-name: sqlite3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-15 12:17:24 +00:00
dependabot[bot]
8d26fc1f45 Bump @sap/cds from 6.0.2 to 6.0.3 (#380)
Bumps [@sap/cds](https://cap.cloud.sap/) from 6.0.2 to 6.0.3.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-15 14:15:18 +02:00
Daniel Hutzel
5c4247b14c Fix usage of unqialified names with cds.db (#378) 2022-07-13 18:07:18 +02:00
140 changed files with 1616 additions and 11140 deletions

View File

@@ -1,28 +1,31 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 2020
},
"globals": {
"SELECT": true,
"INSERT": true,
"UPDATE": true,
"DELETE": true,
"CREATE": true,
"DROP": true,
"cds": true
},
"rules": {
"no-console": "off",
"require-atomic-updates": "off",
"extends": [
"plugin:@sap/cds/recommended",
"eslint:recommended"
],
"env": {
"browser": true,
"es2022": true,
"node": true,
"jest": true,
"mocha": true
},
"globals": {
"SELECT": true,
"INSERT": true,
"UPSERT": true,
"UPDATE": true,
"DELETE": true,
"CREATE": true,
"DROP": true,
"CDL": true,
"CQL": true,
"cds": true
},
"rules": {
"no-console": "off",
"require-atomic-updates": "off",
"require-await":"warn",
"no-unused-vars": ["warn", { "argsIgnorePattern": "_" }]
}
}
}

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: This channel is CLOSED.
about: Use SAP community instead
url: https://answers.sap.com/tags/9f13aee1-834c-4105-8e43-ee442775e5ce

View File

@@ -1,10 +0,0 @@
---
name: This channel is CLOSED.
about: Use our community at https://answers.sap.com/tags/9f13aee1-834c-4105-8e43-ee442775e5ce
title: ''
labels: ''
assignees: ''
---
Please use our community on https://answers.sap.com/tags/9f13aee1-834c-4105-8e43-ee442775e5ce

2
.gitignore vendored
View File

@@ -18,3 +18,5 @@ reviews/msg-box
reviews/db/test.db
*.openapi3.json
*.sqlite
*.db

View File

@@ -1 +0,0 @@
*.tgz

View File

@@ -1,81 +0,0 @@
const { exec } = require ('child_process')
const isWin = process.platform === 'win32'
const express = require ('express')
const fs = require ('fs')
const app = express()
const { PORT=4444 } = process.env
const [,,port=PORT,scope='@capire'] = process.argv
const cwd = __dirname
// clean up on start (exit handler might not complete on Windows)
exec(isWin ? 'del *.tgz' : 'rm *.tgz', {cwd})
app.use('/-/:tarball', (req,res,next) => {
console.debug ('GET', req.params)
try {
const { tarball } = req.params
const pkgFull = tarball.substring(0, tarball.lastIndexOf('-'))
const [, pkg ] = /^\w+-(.+)/.exec(pkgFull)
fs.lstat(tarball,(err => {
if (err) console.debug (`npm pack ../${pkg}`)
if (err) exec(`npm pack ../${pkg}`,{cwd},next)
else next()
}))
} catch (e) {
console.error(e)
res.sendStatus(500)
}
})
app.use('/-', express.static(__dirname))
app.get('/*', (req,res)=>{
const urlRegex = /^\/(@[\w-]+)\/(.+)/
const url = decodeURIComponent(req.url)
console.debug ('GET',url)
try {
if (!urlRegex.test(url)) return res.sendStatus(404)
const [, scpe, pkg ] = urlRegex.exec(url)
const package = require (`${scpe}/${pkg}/package.json`)
const tarball = `${scpe.slice(1)}-${pkg}-${package.version}.tgz`
// https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md
res.json({
"name": package.name,
"dist-tags": {
"latest": package.version
},
"versions": {
[package.version]: {
"name": package.name,
"version": package.version,
"dist": {
"tarball": `${server.url}/-/${tarball}`
},
}
},
})
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') return res.sendStatus(404)
console.error(e); throw e
}
})
const server = app.listen(port, ()=>{
const url = server.url = `http://localhost:${server.address().port}`
console.log (`npm set ${scope}:registry=${url}`)
exec(`npm set ${scope}:registry=${url}`)
console.log (`${scope} registry listening on ${url}`)
})
const _exit = ()=>{
server.close()
exec(`npm conf rm "${scope}:registry"`, ()=> { process.exit() })
}
process.on ('SIGTERM',_exit)
process.on ('SIGHUP',_exit)
process.on ('SIGINT',_exit)
process.on ('SIGUSR2',_exit)

20
.vscode/launch.json vendored
View File

@@ -13,7 +13,7 @@
"<node_internals>/**",
"**/node_modules/**",
"**/cds/lib/lazy.js",
"**/cds/lib/req/cls.js",
"**/cds/lib/req/cds-context.js",
"**/odata-v4/okra/**"
]
},
@@ -26,10 +26,24 @@
"<node_internals>/**",
"**/node_modules/**",
"**/cds/lib/lazy.js",
"**/cds/lib/req/cls.js",
"**/cds/lib/req/cds-context.js",
"**/odata-v4/okra/**"
]
}
},
{
"name": "Debug Mocha Tests",
"type": "node",
"request": "attach",
"port": 9229,
"continueOnAttach": true,
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/cds/lib/lazy.js",
"**/cds/lib/req/cds-context.js",
"**/odata-v4/okra/**",
]
},
],
"inputs": [
{

13
.vscode/settings.json vendored
View File

@@ -10,9 +10,18 @@
"<node_internals>/**",
"**/node_modules/**",
"**/cds/lib/lazy.js",
"**/cds/lib/req/cls.js",
"**/cds/lib/req/cds-context.js",
"**/odata-v4/okra/**"
]
},
"mochaExplorer.parallel": true
"mochaExplorer.debuggerConfig": "Debug Mocha Tests",
"mochaExplorer.parallel": true,
"eslint.probe": [
"cds",
"csn",
"csv",
"csv (semicolon)",
"tsv",
"tab"
]
}

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('')

View File

@@ -1,57 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class cuidAspect extends Base {
ID: string;
};
}
const cuidXtended = cuid(__.Entity)
export type cuid = InstanceType<typeof cuidXtended>
// the following represents the CDS aspect 'managed'
export function managed<TBase extends new (...args: any[]) => {}>(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<typeof managedXtended>
// the following represents the CDS aspect 'temporal'
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class temporalAspect extends Base {
validFrom: Date;
validTo: Date;
};
}
const temporalXtended = temporal(__.Entity)
export type temporal = InstanceType<typeof temporalXtended>
// the following represents the CDS aspect 'extensible'
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class extensibleAspect extends Base {
extensions__: string;
};
}
const extensibleXtended = extensible(__.Entity)
export type extensible = InstanceType<typeof extensibleXtended>

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,66 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class BookAspect extends Base {
ID: number;
title: string;
descr: string;
author: __.Association.to<Author>;
genre: __.Association.to<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;
};
}
const BookXtended = _.managed(Book(__.Entity))
export type Book = InstanceType<typeof BookXtended>
export class Books extends Array<Book> {
}
export function Author<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class AuthorAspect extends Base {
ID: number;
name: string;
dateOfBirth: Date;
dateOfDeath: Date;
placeOfBirth: string;
placeOfDeath: string;
books: __.Association.to.many<Books>;
};
}
const AuthorXtended = _.managed(Author(__.Entity))
export type Author = InstanceType<typeof AuthorXtended>
export class Authors extends Array<Author> {
}
/**
* Hierarchically organized Code List for Genres
*/
export function Genre<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class GenreAspect extends Base {
ID: number;
parent: __.Association.to<Genre>;
children: __.Composition.of.many<Genres>;
};
}
const GenreXtended = _sap_common.CodeList(Genre(__.Entity))
export type Genre = InstanceType<typeof GenreXtended>
export class Genres extends Array<Genre> {
}

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,68 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CodeListAspect extends Base {
name: string;
descr: string;
};
}
const CodeListXtended = CodeList(__.Entity)
export type CodeList = InstanceType<typeof CodeListXtended>
/**
* Code list for languages
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
*/
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class LanguageAspect extends Base {
/**
* Type for a language code
*/
code: Locale;
};
}
const LanguageXtended = CodeList(Language(__.Entity))
export type Language = InstanceType<typeof LanguageXtended>
export class Languages extends Array<Language> {
}
/**
* Code list for countries
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
*/
export function Country<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CountryAspect extends Base {
code: string;
};
}
const CountryXtended = CodeList(Country(__.Entity))
export type Country = InstanceType<typeof CountryXtended>
export class Countries extends Array<Country> {
}
/**
* Code list for currencies
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
*/
export function Currency<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CurrencyAspect extends Base {
code: string;
symbol: string;
};
}
const CurrencyXtended = CodeList(Currency(__.Entity))
export type Currency = InstanceType<typeof CurrencyXtended>
export class Currencies extends Array<Currency> {
}

View File

@@ -56,7 +56,7 @@ const books = Vue.createApp ({
} catch (err) { books.user = { id: err.message } }
},
}
}).mount("#app")
}).mount('#app')
books.getUserInfo()
books.fetch() // initially fill list of books
@@ -65,3 +65,25 @@ document.addEventListener('keydown', (event) => {
// hide user info on request
if (event.key === 'u') books.user = undefined
})
axios.interceptors.request.use(csrfToken)
function csrfToken (request) {
if (request.method === 'head' || request.method === 'get') return request
if ('csrfToken' in document) {
request.headers['x-csrf-token'] = document.csrfToken
return request
}
return fetchToken().then(token => {
document.csrfToken = token
request.headers['x-csrf-token'] = document.csrfToken
return request
}).catch(_ => {
document.csrfToken = null // set mark to not try again
return request
})
function fetchToken() {
return axios.get('/', { headers: { 'x-csrf-token': 'fetch' } })
.then(res => res.headers['x-csrf-token'])
}
}

View File

@@ -2,5 +2,5 @@ ID;title;descr;author_ID;stock;price;currency_code;genre_ID
201;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";101;12;11.11;GBP;11
207;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";107;11;12.34;GBP;11
251;The Raven;"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";150;333;13.13;USD;16
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD;16
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD;15
271;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;170;22;150;JPY;13
1 ID title descr author_ID stock price currency_code genre_ID
2 201 Wuthering Heights Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym "Ellis Bell". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850. 101 12 11.11 GBP 11
3 207 Jane Eyre Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name "Currer Bell", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism. 107 11 12.34 GBP 11
4 251 The Raven "The Raven" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word "Nevermore". The poem makes use of folk, mythological, religious, and classical references. 150 333 13.13 USD 16
5 252 Eleonora "Eleonora" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively "happy" ending. 150 555 14 USD 16 15
6 271 Catweazle Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts. 170 22 150 JPY 13

View File

@@ -4,21 +4,21 @@
* currencies, if not obtained through @capire/common.
*/
module.exports = async (db)=>{
module.exports = async (tx)=>{
const has_common = db.model.definitions['sap.common.Currencies'].elements.numcode
const has_common = tx.model.definitions['sap.common.Currencies']?.elements.numcode
if (has_common) return
const already_filled = await db.exists('sap.common.Currencies',{code:'EUR'})
const already_filled = await tx.exists('sap.common.Currencies',{code:'EUR'})
if (already_filled) return
await INSERT.into ('sap.common.Currencies') .columns (
'code','symbol','name'
await tx.run (INSERT.into ('sap.common.Currencies') .columns (
[ 'code', 'symbol', 'name' ]
) .rows (
[ 'EUR','€','Euro' ],
[ 'USD','$','US Dollar' ],
[ 'GBP','£','British Pound' ],
[ 'ILS','₪','Shekel' ],
[ 'JPY','¥','Yen' ],
)
[ 'EUR', '€', 'Euro' ],
[ 'USD', '$', 'US Dollar' ],
[ 'GBP', '£', 'British Pound' ],
[ 'ILS', '₪', 'Shekel' ],
[ 'JPY', '¥', 'Yen' ],
))
}

View File

@@ -2,3 +2,4 @@ namespace sap.capire.bookshop; //> important for reflection
using from './db/schema';
using from './srv/cat-service';
using from './srv/admin-service';
using from './srv/user-service';

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -21,9 +21,7 @@
},
"cds": {
"requires": {
"db": {
"kind": "sql"
}
"db": "sql"
}
}
}

View File

@@ -1,9 +1,10 @@
const cds = require('@sap/cds')
const cds = require('@sap/cds/lib')
module.exports = cds.service.impl (function(){
module.exports = class AdminService extends cds.ApplicationService { init(){
this.before ('NEW','Authors', genid)
this.before ('NEW','Books', genid)
})
return super.init()
}}
/** Generate primary keys for target entity in request */
async function genid (req) {

View File

@@ -2,8 +2,8 @@ const cds = require('@sap/cds')
class CatalogService extends cds.ApplicationService { init(){
//const { Books } = this.entities ('sap.capire.bookshop')
const { Books, Book } = require('../@types/sap/capire/bookshop')
const { Books } = cds.entities ('sap.capire.bookshop')
const { ListOfBooks } = this.entities
// Reduce stock of ordered books if available stock suffices
this.on ('submitOrder', async req => {
@@ -19,7 +19,7 @@ class CatalogService extends cds.ApplicationService { init(){
})
// Add some discount for overstocked books
this.after ('READ','ListOfBooks', each => {
this.after ('READ', ListOfBooks, each => {
if (each.stock > 111) each.title += ` -- 11% discount!`
})

View File

@@ -5,7 +5,7 @@ service UserService {
/**
* The current user
*/
@odata.singleton entity me {
@odata.singleton entity me @cds.persistence.skip {
id : String; // user id
locale : String;
tenant : String;

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,54 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<typeof BookXtended>
export class Books extends Array<Book> {
}
export function Author<TBase extends new (...args: any[]) => {}>(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<typeof AuthorXtended>
export class Authors extends Array<Author> {
}

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,72 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<typeof ListOfBookXtended>
export class ListOfBooks extends Array<ListOfBook> {
}
/**
* For display in details pages
*/
export function Book<TBase extends new (...args: any[]) => {}>(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<typeof BookXtended>
export class Books extends Array<Book> {
}
// action
export declare const submitOrder: (book: Books, quantity: number) => {};

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,40 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class EntityAspect extends Base {
name: string;
columns: {
name: string;
type: string;
isKey: boolean;
};
};
}
const EntityXtended = Entity(__.Entity)
export type Entity = InstanceType<typeof EntityXtended>
export class Entities extends Array<Entity> {
}
/**
* The actual data, organized by column name
*/
export function Data<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class DataAspect extends Base {
record: {};
};
}
const DataXtended = Data(__.Entity)
export type Data = InstanceType<typeof DataXtended>
export class Data_ extends Array<Data> {
}

View File

@@ -1,5 +0,0 @@
// 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

View File

@@ -1,39 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<typeof OrderXtended>
export class Orders extends Array<Order> {
}

View File

@@ -1,5 +0,0 @@
// 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

View File

@@ -1,35 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<typeof ReviewXtended>
export class Reviews extends Array<Review> {
}
// action
export declare const like: (review: Reviews) => {};
// action
export declare const unlike: (review: Reviews) => {};

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('')

View File

@@ -1,57 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class cuidAspect extends Base {
ID: string;
};
}
const cuidXtended = cuid(__.Entity)
export type cuid = InstanceType<typeof cuidXtended>
// the following represents the CDS aspect 'managed'
export function managed<TBase extends new (...args: any[]) => {}>(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<typeof managedXtended>
// the following represents the CDS aspect 'temporal'
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class temporalAspect extends Base {
validFrom: Date;
validTo: Date;
};
}
const temporalXtended = temporal(__.Entity)
export type temporal = InstanceType<typeof temporalXtended>
// the following represents the CDS aspect 'extensible'
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class extensibleAspect extends Base {
extensions__: string;
};
}
const extensibleXtended = extensible(__.Entity)
export type extensible = InstanceType<typeof extensibleXtended>

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,70 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class BookAspect extends Base {
ID: number;
title: string;
descr: string;
author: __.Association.to<Author>;
genre: __.Association.to<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<typeof BookXtended>
export class Books extends Array<Book> {
}
export function Author<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class AuthorAspect extends Base {
ID: number;
name: string;
dateOfBirth: Date;
dateOfDeath: Date;
placeOfBirth: string;
placeOfDeath: string;
books: __.Association.to.many<Books>;
};
}
const AuthorXtended = _.managed(Author(__.Entity))
export type Author = InstanceType<typeof AuthorXtended>
export class Authors extends Array<Author> {
}
/**
* Hierarchically organized Code List for Genres
*/
export function Genre<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class GenreAspect extends Base {
ID: number;
parent: __.Association.to<Genre>;
children: __.Composition.of.many<Genres>;
};
}
const GenreXtended = _sap_common.CodeList(Genre(__.Entity))
export type Genre = InstanceType<typeof GenreXtended>
export class Genres extends Array<Genre> {
}

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,52 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class OrderAspect extends Base {
OrderNo: string;
Items: {
ID: string;
product: __.Association.to<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<typeof OrderXtended>
export class Orders extends Array<Order> {
}
/**
* This is a stand-in for arbitrary ordered Products
*/
export function Product<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class ProductAspect extends Base {
ID: string;
};
}
const ProductXtended = Product(__.Entity)
export type Product = InstanceType<typeof ProductXtended>
export class Products extends Array<Product> {
}

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,51 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<Likes>;
liked: number;
};
}
const ReviewXtended = Review(__.Entity)
export type Review = InstanceType<typeof ReviewXtended>
export class Reviews extends Array<Review> {
}
export function Like<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class LikeAspect extends Base {
review: __.Association.to<Review>;
/**
* Canonical user ID
*/
user: _.User;
};
}
const LikeXtended = Like(__.Entity)
export type Like = InstanceType<typeof LikeXtended>
export class Likes extends Array<Like> {
}

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,47 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
import * as __ from './../../../_';
import * as _sap_common from './..';
export function Region<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class RegionAspect extends Base {
code: string;
children: __.Composition.of.many<Regions>;
cities: __.Composition.of.many<Cities>;
_parent: string;
};
}
const RegionXtended = _sap_common.CodeList(Region(__.Entity))
export type Region = InstanceType<typeof RegionXtended>
export class Regions extends Array<Region> {
}
export function City<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CityAspect extends Base {
code: string;
region: __.Association.to<Region>;
districts: __.Composition.of.many<Districts>;
};
}
const CityXtended = _sap_common.CodeList(City(__.Entity))
export type City = InstanceType<typeof CityXtended>
export class Cities extends Array<City> {
}
export function District<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class DistrictAspect extends Base {
code: string;
city: __.Association.to<City>;
};
}
const DistrictXtended = _sap_common.CodeList(District(__.Entity))
export type District = InstanceType<typeof DistrictXtended>
export class Districts extends Array<District> {
}

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,73 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CodeListAspect extends Base {
name: string;
descr: string;
};
}
const CodeListXtended = CodeList(__.Entity)
export type CodeList = InstanceType<typeof CodeListXtended>
/**
* Code list for languages
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
*/
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class LanguageAspect extends Base {
/**
* Type for a language code
*/
code: Locale;
};
}
const LanguageXtended = CodeList(Language(__.Entity))
export type Language = InstanceType<typeof LanguageXtended>
export class Languages extends Array<Language> {
}
/**
* Code list for countries
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
*/
export function Country<TBase extends new (...args: any[]) => {}>(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<typeof CountryXtended>
export class Countries extends Array<Country> {
}
/**
* Code list for currencies
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
*/
export function Currency<TBase extends new (...args: any[]) => {}>(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<typeof CurrencyXtended>
export class Currencies extends Array<Currency> {
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -19,4 +19,4 @@ module.exports = cds.server
// For didactic reasons in capire
const { ReviewsService, OrdersService } = cds.requires
if (!ReviewsService.credentials && !OrdersService.credentials) cds.requires.messaging = false
if (!ReviewsService?.credentials && !OrdersService?.credentials) cds.requires.messaging = false

View File

@@ -12,7 +12,11 @@ using { sap.capire.bookshop.Books } from '@capire/bookshop';
using { ReviewsService.Reviews } from '@capire/reviews';
extend Books with {
reviews : Composition of many Reviews on reviews.subject = $self.ID;
@Common.Label : '{i18n>Rating}'
rating : Decimal;
@Common.Label : '{i18n>NumberOfReviews}'
numberOfReviews : Integer;
}

View File

@@ -11,8 +11,7 @@ module.exports = async()=>{ // called by server.js
const db = await cds.connect.to ('db')
// reflect entity definitions used below...
//const { Books } = db.entities ('sap.capire.bookshop')
const { Books, Book } = require('../@types/sap/capire/bookshop')
const { Books } = db.entities ('sap.capire.bookshop')
//
// Delegate requests to read reviews to the ReviewsService
@@ -20,8 +19,8 @@ module.exports = async()=>{ // called by server.js
//
CatalogService.prepend (srv => srv.on ('READ', 'Books/reviews', (req) => {
console.debug ('> delegating request to ReviewsService')
const [id] = req.params, { columns, limit } = 'SELECT' in req.query ? req.query.SELECT : {columns: [], limit: { rows: 0 }}
return ReviewsService.read ('Reviews',columns).limit(limit.rows).where({subject:String(id)})
const [id] = req.params, { columns, limit } = req.query.SELECT
return ReviewsService.read ('Reviews',columns).limit(limit).where({subject:String(id)})
}))
//
@@ -29,7 +28,7 @@ module.exports = async()=>{ // called by server.js
//
CatalogService.on ('OrderedBook', async (msg) => {
const { book, quantity, buyer } = msg.data
const { title, price } = await db.tx(msg).read ('Books').where('ID = ' + book.ID).columns((/** @type {Book} */ b) => { b.title, b.price })
const { title, price } = await db.tx(msg).read (Books, book, b => { b.title, b.price })
return OrdersService.tx(msg).create ('Orders').entries({
OrderNo: 'Order at '+ (new Date).toLocaleString(),
Items: [{ product:{ID:`${book}`}, title, price, quantity }],

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('')

View File

@@ -1,57 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class cuidAspect extends Base {
ID: string;
};
}
const cuidXtended = cuid(__.Entity)
export type cuid = InstanceType<typeof cuidXtended>
// the following represents the CDS aspect 'managed'
export function managed<TBase extends new (...args: any[]) => {}>(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<typeof managedXtended>
// the following represents the CDS aspect 'temporal'
export function temporal<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class temporalAspect extends Base {
validFrom: Date;
validTo: Date;
};
}
const temporalXtended = temporal(__.Entity)
export type temporal = InstanceType<typeof temporalXtended>
// the following represents the CDS aspect 'extensible'
export function extensible<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class extensibleAspect extends Base {
extensions__: string;
};
}
const extensibleXtended = extensible(__.Entity)
export type extensible = InstanceType<typeof extensibleXtended>

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,47 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
import * as __ from './../../../_';
import * as _sap_common from './..';
export function Region<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class RegionAspect extends Base {
code: string;
children: __.Composition.of.many<Regions>;
cities: __.Composition.of.many<Cities>;
_parent: string;
};
}
const RegionXtended = _sap_common.CodeList(Region(__.Entity))
export type Region = InstanceType<typeof RegionXtended>
export class Regions extends Array<Region> {
}
export function City<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CityAspect extends Base {
code: string;
region: __.Association.to<Region>;
districts: __.Composition.of.many<Districts>;
};
}
const CityXtended = _sap_common.CodeList(City(__.Entity))
export type City = InstanceType<typeof CityXtended>
export class Cities extends Array<City> {
}
export function District<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class DistrictAspect extends Base {
code: string;
city: __.Association.to<City>;
};
}
const DistrictXtended = _sap_common.CodeList(District(__.Entity))
export type District = InstanceType<typeof DistrictXtended>
export class Districts extends Array<District> {
}

View File

@@ -1,9 +0,0 @@
// 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

View File

@@ -1,73 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class CodeListAspect extends Base {
name: string;
descr: string;
};
}
const CodeListXtended = CodeList(__.Entity)
export type CodeList = InstanceType<typeof CodeListXtended>
/**
* Code list for languages
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommonlanguages
*/
export function Language<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class LanguageAspect extends Base {
/**
* Type for a language code
*/
code: Locale;
};
}
const LanguageXtended = CodeList(Language(__.Entity))
export type Language = InstanceType<typeof LanguageXtended>
export class Languages extends Array<Language> {
}
/**
* Code list for countries
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncountries
*/
export function Country<TBase extends new (...args: any[]) => {}>(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<typeof CountryXtended>
export class Countries extends Array<Country> {
}
/**
* Code list for currencies
*
* See https://cap.cloud.sap/docs/cds/common#entity-sapcommoncurrencies
*/
export function Currency<TBase extends new (...args: any[]) => {}>(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<typeof CurrencyXtended>
export class Currencies extends Array<Currency> {
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -1,7 +0,0 @@
// 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

View File

@@ -1,40 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class EntityAspect extends Base {
name: string;
columns: {
name: string;
type: string;
isKey: boolean;
};
};
}
const EntityXtended = Entity(__.Entity)
export type Entity = InstanceType<typeof EntityXtended>
export class Entities extends Array<Entity> {
}
/**
* The actual data, organized by column name
*/
export function Data<TBase extends new (...args: any[]) => {}>(Base: TBase) {
return class DataAspect extends Base {
record: {};
};
}
const DataXtended = Data(__.Entity)
export type Data = InstanceType<typeof DataXtended>
export class Data_ extends Array<Data> {
}

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -2,12 +2,12 @@
* Exposes data + entity metadata
*/
@requires:'authenticated-user'
service DataService @( path:'-data' ) {
@odata service DataService @( path:'-data' ) {
/**
* Metadata like name and columns/elements
*/
entity Entities {
entity Entities @cds.persistence.skip {
key name : String;
columns: Composition of many {
name : String;
@@ -19,7 +19,7 @@ service DataService @( path:'-data' ) {
/**
* The actual data, organized by column name
*/
entity Data {
entity Data @cds.persistence.skip {
record : array of {
column : String;
data : String;

View File

@@ -6,16 +6,33 @@ Author = Author
AuthorID = Author ID
Stock = Stock
Name = Name
Description = Description
Image = Image
AuthorName = Author's Name
DateOfBirth = Date of Birth
DateOfDeath = Date of Death
PlaceOfBirth = Place of Birth
PlaceOfDeath = Place of Death
Age = Age
Lifetime = Lifetime
Authors = Authors
Order = Order
Orders = Orders
OrderNo = Order Number
OrderItems = Order Items
Customer = Customer
Product = Product
ProductID = Product ID
ProductTitle = Product Title
UnitPrice = Unit Price
Quantity = Quantity
Price = Price
Currency = Currency
Date = Date
Rating = Rating
NumberOfReviews = Number of Reviews
Genre = Genre
Genres = Genres

View File

@@ -43,5 +43,10 @@ extend sap.capire.bookshop.Authors with {
virtual lifetime : String;
}
annotate AdminService.Authors with {
age @Common.Label : '{i18n>Age}';
lifetime @Common.Label : '{i18n>Lifetime}'
}
// Workaround for Fiori popup for asking user to enter a new UUID on Create
annotate AdminService.Authors with { ID @Core.Computed; }

View File

@@ -62,6 +62,11 @@ annotate AdminService.Books.texts with @(
}
);
annotate AdminService.Books.texts with {
ID @UI.Hidden;
ID_texts @UI.Hidden;
};
// Add Value Help for Locales
annotate AdminService.Books.texts {
locale @(

View File

@@ -33,7 +33,7 @@ annotate CatalogService.Books with @(UI : {
////////////////////////////////////////////////////////////////////////////
//
// Books Object Page
// Books List Page
//
annotate CatalogService.Books with @(UI : {
SelectionFields : [
@@ -52,9 +52,6 @@ annotate CatalogService.Books with @(UI : {
},
{Value : genre.name},
{Value : price},
{
Value : currency.symbol,
Label : ' '
},
{Value : currency.symbol},
]
}, );

View File

@@ -4,57 +4,53 @@
using { sap.capire.bookshop as my } from '@capire/bookstore';
using { sap.common } from '@capire/common';
using { sap.common.Currencies } from '@sap/cds/common';
////////////////////////////////////////////////////////////////////////////
//
// Books Lists
//
annotate my.Books with @(
Common.SemanticKey : [ID],
UI : {
Identification : [{Value : title}],
SelectionFields : [
ID,
author_ID,
price,
currency_code
],
LineItem : [
{
Value : ID,
Label : '{i18n>Title}'
},
{
Value : author.ID,
Label : '{i18n>Author}'
},
{Value : genre.name},
{Value : stock},
{Value : price},
{
Value : currency.symbol,
Label : ' '
},
]
}
Common.SemanticKey : [ID],
UI : {
Identification : [{ Value: title }],
SelectionFields : [
ID,
author_ID,
price,
currency_code
],
LineItem : [
{ Value: ID, Label: '{i18n>Title}' },
{ Value: author.ID, Label: '{i18n>Author}' },
{ Value: genre.name },
{ Value: stock },
{ Value: price },
{ Value: currency.symbol },
]
}
) {
ID @Common: {
SemanticObject : 'Books',
Text: title,
TextArrangement : #TextOnly
};
author @ValueList.entity : 'Authors';
ID @Common: {
SemanticObject : 'Books',
Text: title,
TextArrangement : #TextOnly
};
author @ValueList.entity : 'Authors';
};
annotate Currencies with {
symbol @Common.Label : '{i18n>Currency}';
}
////////////////////////////////////////////////////////////////////////////
//
// Books Details
//
annotate my.Books with @(UI : {HeaderInfo : {
TypeName : '{i18n>Book}',
TypeNamePlural : '{i18n>Books}',
Title : {Value : title},
Description : {Value : author.name}
TypeName : '{i18n>Book}',
TypeNamePlural : '{i18n>Books}',
Title : { Value: title },
Description : { Value: author.name }
}, });
@@ -63,19 +59,14 @@ annotate my.Books with @(UI : {HeaderInfo : {
// Books Elements
//
annotate my.Books with {
ID @title : '{i18n>ID}';
title @title : '{i18n>Title}';
genre @title : '{i18n>Genre}' @Common : {
Text : genre.name,
TextArrangement : #TextOnly
};
author @title : '{i18n>Author}' @Common : {
Text : author.name,
TextArrangement : #TextOnly
};
price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code;
stock @title : '{i18n>Stock}';
descr @UI.MultiLineText;
ID @title: '{i18n>ID}';
title @title: '{i18n>Title}';
genre @title: '{i18n>Genre}' @Common: { Text: genre.name, TextArrangement: #TextOnly };
author @title: '{i18n>Author}' @Common: { Text: author.name, TextArrangement: #TextOnly };
price @title: '{i18n>Price}' @Measures.ISOCurrency : currency_code;
stock @title: '{i18n>Stock}';
descr @title: '{i18n>Description}' @UI.MultiLineText;
image @title: '{i18n>Image}';
}
////////////////////////////////////////////////////////////////////////////
@@ -83,36 +74,40 @@ annotate my.Books with {
// Genres List
//
annotate my.Genres with @(
Common.SemanticKey : [name],
UI : {
SelectionFields : [name],
LineItem : [
{Value : name},
{
Value : parent.name,
Label : 'Main Genre'
},
],
}
Common.SemanticKey : [name],
UI : {
SelectionFields : [name],
LineItem : [
{ Value: name },
{
Value : parent.name,
Label: 'Main Genre'
},
],
}
);
annotate my.Genres with {
ID @Common.Text : name @Common.TextArrangement : #TextOnly;
}
////////////////////////////////////////////////////////////////////////////
//
// Genre Details
//
annotate my.Genres with @(UI : {
Identification : [{Value : name}],
HeaderInfo : {
TypeName : '{i18n>Genre}',
TypeNamePlural : '{i18n>Genres}',
Title : {Value : name},
Description : {Value : ID}
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>SubGenres}',
Target : 'children/@UI.LineItem'
}, ],
Identification : [{ Value: name}],
HeaderInfo : {
TypeName : '{i18n>Genre}',
TypeNamePlural : '{i18n>Genres}',
Title : { Value: name },
Description : { Value: ID }
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>SubGenres}',
Target : 'children/@UI.LineItem'
}, ],
});
////////////////////////////////////////////////////////////////////////////
@@ -120,8 +115,8 @@ annotate my.Genres with @(UI : {
// Genres Elements
//
annotate my.Genres with {
ID @title : '{i18n>ID}';
name @title : '{i18n>Genre}';
ID @title: '{i18n>ID}';
name @title: '{i18n>Genre}';
}
////////////////////////////////////////////////////////////////////////////
@@ -129,24 +124,24 @@ annotate my.Genres with {
// Authors List
//
annotate my.Authors with @(
Common.SemanticKey : [ID],
UI : {
Identification : [{Value : name}],
SelectionFields : [name],
LineItem : [
{Value : ID},
{Value : dateOfBirth},
{Value : dateOfDeath},
{Value : placeOfBirth},
{Value : placeOfDeath},
],
}
Common.SemanticKey : [ID],
UI : {
Identification : [{ Value: name}],
SelectionFields : [name],
LineItem : [
{ Value: ID },
{ Value: dateOfBirth },
{ Value: dateOfDeath },
{ Value: placeOfBirth },
{ Value: placeOfDeath },
],
}
) {
ID @Common: {
SemanticObject : 'Authors',
Text: name,
TextArrangement : #TextOnly,
};
ID @Common: {
SemanticObject : 'Authors',
Text: name,
TextArrangement : #TextOnly,
};
};
////////////////////////////////////////////////////////////////////////////
@@ -154,16 +149,16 @@ annotate my.Authors with @(
// Author Details
//
annotate my.Authors with @(UI : {
HeaderInfo : {
TypeName : '{i18n>Author}',
TypeNamePlural : '{i18n>Authors}',
Title : {Value : name},
Description : {Value : dateOfBirth}
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Target : 'books/@UI.LineItem'
}, ],
HeaderInfo : {
TypeName : '{i18n>Author}',
TypeNamePlural : '{i18n>Authors}',
Title : { Value: name },
Description : { Value: dateOfBirth }
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Target : 'books/@UI.LineItem'
}, ],
});
@@ -172,12 +167,12 @@ annotate my.Authors with @(UI : {
// Authors Elements
//
annotate my.Authors with {
ID @title : '{i18n>ID}';
name @title : '{i18n>Name}';
dateOfBirth @title : '{i18n>DateOfBirth}';
dateOfDeath @title : '{i18n>DateOfDeath}';
placeOfBirth @title : '{i18n>PlaceOfBirth}';
placeOfDeath @title : '{i18n>PlaceOfDeath}';
ID @title: '{i18n>ID}';
name @title: '{i18n>Name}';
dateOfBirth @title: '{i18n>DateOfBirth}';
dateOfDeath @title: '{i18n>DateOfDeath}';
placeOfBirth @title: '{i18n>PlaceOfBirth}';
placeOfDeath @title: '{i18n>PlaceOfDeath}';
}
////////////////////////////////////////////////////////////////////////////
@@ -185,18 +180,18 @@ annotate my.Authors with {
// Languages List
//
annotate common.Languages with @(
Common.SemanticKey : [code],
Identification : [{Value : code}],
UI : {
SelectionFields : [
name,
descr
],
LineItem : [
{Value : code},
{Value : name},
],
}
Common.SemanticKey : [code],
Identification : [{ Value: code}],
UI : {
SelectionFields : [
name,
descr
],
LineItem : [
{ Value: code },
{ Value: name },
],
}
);
////////////////////////////////////////////////////////////////////////////
@@ -204,22 +199,22 @@ annotate common.Languages with @(
// Language Details
//
annotate common.Languages with @(UI : {
HeaderInfo : {
TypeName : '{i18n>Language}',
TypeNamePlural : '{i18n>Languages}',
Title : {Value : name},
Description : {Value : descr}
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Details}',
Target : '@UI.FieldGroup#Details'
}, ],
FieldGroup #Details : {Data : [
{Value : code},
{Value : name},
{Value : descr}
]},
HeaderInfo : {
TypeName : '{i18n>Language}',
TypeNamePlural : '{i18n>Languages}',
Title : { Value: name },
Description : { Value: descr }
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Details}',
Target : '@UI.FieldGroup#Details'
}, ],
FieldGroup #Details : {Data : [
{ Value: code },
{ Value: name },
{ Value: descr }
]},
});
////////////////////////////////////////////////////////////////////////////
@@ -227,19 +222,19 @@ annotate common.Languages with @(UI : {
// Currencies List
//
annotate common.Currencies with @(
Common.SemanticKey : [code],
Identification : [{Value : code}],
UI : {
SelectionFields : [
name,
descr
],
LineItem : [
{Value : descr},
{Value : symbol},
{Value : code},
],
}
Common.SemanticKey : [code],
Identification : [{ Value: code}],
UI : {
SelectionFields : [
name,
descr
],
LineItem : [
{ Value: descr },
{ Value: symbol },
{ Value: code },
],
}
);
////////////////////////////////////////////////////////////////////////////
@@ -247,35 +242,35 @@ annotate common.Currencies with @(
// Currency Details
//
annotate common.Currencies with @(UI : {
HeaderInfo : {
TypeName : '{i18n>Currency}',
TypeNamePlural : '{i18n>Currencies}',
Title : {Value : descr},
Description : {Value : code}
HeaderInfo : {
TypeName : '{i18n>Currency}',
TypeNamePlural : '{i18n>Currencies}',
Title : { Value: descr },
Description : { Value: code }
},
Facets : [
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Details}',
Target : '@UI.FieldGroup#Details'
},
Facets : [
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Details}',
Target : '@UI.FieldGroup#Details'
},
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Extended}',
Target : '@UI.FieldGroup#Extended'
},
],
FieldGroup #Details : {Data : [
{Value : name},
{Value : symbol},
{Value : code},
{Value : descr}
]},
FieldGroup #Extended : {Data : [
{Value : numcode},
{Value : minor},
{Value : exponent}
]},
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Extended}',
Target : '@UI.FieldGroup#Extended'
},
],
FieldGroup #Details : {Data : [
{ Value: name },
{ Value: symbol },
{ Value: code },
{ Value: descr }
]},
FieldGroup #Extended : {Data : [
{ Value: numcode },
{ Value: minor },
{ Value: exponent }
]},
});
////////////////////////////////////////////////////////////////////////////
@@ -283,7 +278,7 @@ annotate common.Currencies with @(UI : {
// Currencies Elements
//
annotate common.Currencies with {
numcode @title : '{i18n>NumCode}';
minor @title : '{i18n>MinorUnit}';
exponent @title : '{i18n>Exponent}';
numcode @title: '{i18n>NumCode}';
minor @title: '{i18n>MinorUnit}';
exponent @title: '{i18n>Exponent}';
}

1
fiori/index.cds Normal file
View File

@@ -0,0 +1 @@
using from './db/common';

View File

@@ -14,9 +14,6 @@
},
"cds": {
"requires": {
"auth": {
"kind": "dummy-auth"
},
"ReviewsService": {
"kind": "odata",
"model": "@capire/reviews"
@@ -46,10 +43,10 @@
"[production]": {
"model": "db/hana"
}
},
"hana": {
"deploy-format": "hdbtable"
}
},
"hana": {
"deploy-format": "hdbtable"
}
}
}

View File

@@ -1,8 +1,8 @@
const cds = require("@sap/cds")
// install OData v2 adapter
const cds = require("@sap/cds")
const proxy = require('@sap/cds-odata-v2-adapter-proxy')
const proxyOpts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
cds.on('bootstrap', app => app.use(proxy(proxyOpts)))
const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
cds.on('bootstrap', app => app.use(proxy(opts))) // install proxy
cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan`
module.exports = require('@capire/bookstore/server.js')
module.exports = require('@capire/bookstore/server.js')

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -12,23 +12,8 @@
"devDependencies": {
"@types/jest": "*",
"@types/node": "*",
"ts-jest": "^27.0.2",
"typescript": "^4.3.5"
},
"jest": {
"testEnvironment": "node",
"preset": "ts-jest",
"globals": {
"ts-jest": {
"diagnostics": {
"_comment": "see https://githubmemory.com/repo/kulshekhar/ts-jest/issues/2722",
"ignoreCodes": [
151001
]
}
}
}
},
"eslintConfig": {
"extends": "eslint:recommended",
"env": {

View File

@@ -1,3 +1,7 @@
module.exports = class say {
hello(req) { return `Hello ${req.data.to}!` }
hello(req) {
let {to} = req.data
if (to === 'me') to = require('os').userInfo().username
return `Hello ${to}!`
}
}

View File

@@ -0,0 +1,13 @@
const cds = require ('@sap/cds')
describe('Hello world!', () => {
beforeAll (()=> process.env.CDS_TYPESCRIPT = true)
afterAll (()=> delete process.env.CDS_TYPESCRIPT)
const {GET} = cds.test.in(__dirname,'../srv').run('serve', 'world.cds')
it('should say hello with class impl', async () => {
const {data} = await GET`/say/hello(to='world')`
expect(data.value).toMatch(/Hello world.*typescript.*/i)
})
})

View File

@@ -1,15 +0,0 @@
process.env.CDS_TYPESCRIPT = 'true';
import * as cds from '@sap/cds';
//@ts-ignore
const {GET} = cds.test.in(__dirname,'../srv').run('serve', 'world.cds');
describe('Hello world!', () => {
afterAll(() => { delete process.env.CDS_TYPESCRIPT; });
it('should say hello with class impl from a typescript file', async () => {
const {data} = await GET`/say/hello(to='world')`
expect(data.value).toMatch(/Hello world.*typescript.*/i)
})
})

76
loggers/app/loggers.html Normal file
View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<title> cds.log </title>
<link rel="stylesheet" href="https://unpkg.com/primitive-ui/dist/css/main.css">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
<style>
select { border-color: transparent; padding: 4px 12px; margin: 0px; }
button { padding: 2px 11px; margin: 0px 4px; font: 90% italic; }
</style>
</head>
<body class="small-container" , style="margin-top: 70px;">
<div id='app'>
<h1> Log Levels </h1>
<input type="text" placeholder="Search by ID or Log Level..." @input="fetch">
<table id='loggers'>
<thead>
<th> Module ID </th>
<th> Log Level </th>
</thead>
<tr v-for="each in list">
<td>{{ each.id }}</td>
<td><select v-bind:id="each.id" v-model="each.level" @change="set">
<option>SILENT</option>
<option>ERROR</option>
<option>WARN</option>
<option>INFO</option>
<option>DEBUG</option>
<option>TRACE</option>
</select>
</td>
</tr>
</table>
<h4>Log Format:</h4>
[ <button class="round-button" :class={'muted-button':!format.timestamp} @click="toggle_format" id="timestamp">Timestamp </button>
| <button class="round-button" :class={'muted-button':!format.level} @click="toggle_format" id="level">Log Level </button>
| <button class="round-button" :class={'muted-button':!format.tenant} @click="toggle_format" id="tenant">Tenant </button>
| <button class="round-button" :class={'muted-button':!format.reqid} @click="toggle_format" id="reqid">Request ID </button>
| <button class="round-button" :class={'muted-button':!format.id} @click="toggle_format" id="module">Logger ID </button>
] - <i>log message ...</i>
</div>
</body>
<script>
axios.defaults.headers['Content-Type'] = 'application/json'
axios.defaults.baseURL = '/log'
const loggers = Vue.createApp({ el: '#app',
data() {
return {
format: { timestamp:false, level:false, tenant:false, reqid:false, id:true, },
list: [],
}
},
methods: {
async fetch (eve) {
this.list = (await axios.get (`/Loggers${
eve && eve.target.value ? `?$search=${eve.target.value}` : ''
}`)).data
},
async set (eve) {
const { id, value:level } = eve.target
await axios.put (`/Logger/${id}`, {id,level})
},
async toggle_format (eve) {
this.format[eve.target.id] = !this.format[eve.target.id]
await axios.post (`/format`, this.format)
},
},
}).mount('#app')
loggers.fetch() // initially fill list of loggers
</script>
</html>

22
loggers/package.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "@capire/loggers",
"version": "1.0.0",
"description": "Simple sample on how to dynamically set cds.log levels and formats.",
"files": [
"app",
"srv"
],
"dependencies": {
"@sap/cds": ">=5.9",
"express": "^4.17.1"
},
"scripts": {
"start": "cds run",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": "sql"
}
}
}

11
loggers/readme.md Normal file
View File

@@ -0,0 +1,11 @@
# Dynamically Set `cds.log` Levels and Formats
### Run
```sh
cds watch
```
### Test
Either using the UI through http://localhost:4004/loggers.html, or try the requests in `test/requests.http`

3
loggers/srv/dummy.cds Normal file
View File

@@ -0,0 +1,3 @@
service Sue {
entity Dummy { key ID: UUID; title: String; }
}

20
loggers/srv/loggers.cds Normal file
View File

@@ -0,0 +1,20 @@
@rest service LogService {
@readonly entity Loggers : Logger {};
entity Logger {
key id : String;
level : String;
}
action format (
timestamp : Boolean,
level : Boolean,
tenant : Boolean,
reqid : Boolean,
id : Boolean,
);
action debug (logger : String) returns Logger;
action reset (logger : String) returns Logger;
}

56
loggers/srv/loggers.js Normal file
View File

@@ -0,0 +1,56 @@
const cds = require ('@sap/cds/lib')
const LOG = cds.log('cds.log')
module.exports = class LogService extends cds.Service {
init(){
this.on('GET','Loggers', (req)=>{
let loggers = Object.values(cds.log.loggers).map (_logger)
let {$search} = req._.req.query
if ($search) {
const re = RegExp($search,'i')
loggers = loggers.filter (l => re.test(l.id) || re.test(l.level))
}
return loggers.sort ((a,b) => a.id < b.id ? -1 : 1)
})
this.on('PUT','Logger', (req)=>{
const {id} = req.params[0] || req.data
if (!id) return req.reject('No logger id specified in request')
return _logger (cds.log (id, req.data))
})
this.on('debug', (req)=>{
const {logger:id} = req.params[0] || req.data
if (!id) return req.reject('No logger id specified in request')
return _logger (cds.log (id, {level:'debug'}))
})
this.on('reset', (req)=>{
const {logger:id} = req.params[0] || req.data
if (!id) return req.reject('No logger id specified in request')
return _logger (cds.log (id, {level:'info'}))
})
this.on('format', (req)=>{
const $ = req.data; LOG.info('format:',$)
// Set format for new loggers constructed subsequently
cds.log.format = (id, level, ...args) => {
const fmt = []
if ($.timestamp) fmt.push ('|', (new Date).toISOString())
if ($.level) fmt.push ('|', _levels[level].padEnd(5))
if ($.tenant) fmt.push ('|', cds.context && cds.context.tenant)
if ($.reqid) fmt.push ('|', cds.context && cds.context.id)
if ($.id) fmt.push ('|', id)
fmt[0] = '[', fmt.push ('] -', ...args)
return fmt
}
// Apply this format to all existing loggers
Object.values(cds.log.loggers).forEach (l => l.setFormat (cds.log.format))
})
}
}
const _logger = ({id,level}) => ({id, level:_levels[level] })
const _levels = [ 'SILENT', 'ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE' ]

View File

@@ -0,0 +1,18 @@
http://localhost:4004/loggers.html
@body: = Content-Type: application/json\n\n
###
GET http://localhost:4004/log/Loggers
###
PUT http://localhost:4004/log/Logger/sqlite
{{body:}} { "level": "debug" }
###
POST http://localhost:4004/log/debug(logger='sqlite')
###
POST http://localhost:4004/log/reset(logger='sqlite')
### Dummy request to see sqlite debug output
GET http://localhost:4004/sue/Dummy

View File

@@ -1,3 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
const cds = require('@sap/cds')
const cson = cds.entities('_')

View File

@@ -1,35 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
export namespace Association {
export type to <T> = T & ((fn:(a:T)=>any) => T)
export namespace to {
// type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export namespace Composition {
export type of <T> = T & ((fn:(a:T)=>any) => T)
export namespace of {
//type many <T> = T[] & (T extends (infer R)[] ? R[] & ((fn:(a:R)=>any) => R[]) : T[]);
export type many <T extends readonly unknown[]> = T & ((fn:(a:T[number])=>any) => T[number]);
}
}
export class Entity {
static data<T extends Entity> (this:T, input:Object) : T {
return {} as T // mock
}
}
export type EntitySet<T> = T[] & {
data (input:object[]) : T[]
data (input:object) : T
}

View File

@@ -1,5 +0,0 @@
// 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

View File

@@ -1,22 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
import * as __ from './../../../../_';
export function Media<TBase extends new (...args: any[]) => {}>(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<typeof MediaXtended>
export class Media_ extends Array<Media> {
}

View File

@@ -1,5 +0,0 @@
// 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

View File

@@ -1,22 +0,0 @@
// This is an automatically generated file. Please do not change its contents manually!
import * as __ from './../../../_';
export function Media<TBase extends new (...args: any[]) => {}>(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<typeof MediaXtended>
export class Media_ extends Array<Media> {
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"checkJs": true
}
}

View File

@@ -40,7 +40,7 @@ module.exports = srv => {
req.reject(404, 'Media not found for the ID')
return
}
const decodedMedia = new Buffer(
const decodedMedia = Buffer.from(
mediaObj.media.split(';base64,').pop(),
'base64'
)

View File

@@ -1,5 +0,0 @@
// 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

View File

@@ -1,37 +0,0 @@
// 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<TBase extends new (...args: any[]) => {}>(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<typeof OrderXtended>
export class Orders extends Array<Order> {
}

Some files were not shown because too many files have changed in this diff Show More