@sap/cds 7.0.2 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +60 -3
  2. package/_i18n/i18n_ar.properties +3 -0
  3. package/_i18n/i18n_cs.properties +4 -1
  4. package/_i18n/i18n_da.properties +3 -0
  5. package/_i18n/i18n_de.properties +3 -0
  6. package/_i18n/i18n_en.properties +3 -0
  7. package/_i18n/i18n_es.properties +3 -0
  8. package/_i18n/i18n_fi.properties +3 -0
  9. package/_i18n/i18n_fr.properties +3 -0
  10. package/_i18n/i18n_it.properties +3 -0
  11. package/_i18n/i18n_ja.properties +3 -0
  12. package/_i18n/i18n_ko.properties +3 -0
  13. package/_i18n/i18n_ms.properties +3 -0
  14. package/_i18n/i18n_nl.properties +3 -0
  15. package/_i18n/i18n_no.properties +3 -0
  16. package/_i18n/i18n_pl.properties +3 -0
  17. package/_i18n/i18n_pt.properties +3 -0
  18. package/_i18n/i18n_ro.properties +3 -0
  19. package/_i18n/i18n_ru.properties +3 -0
  20. package/_i18n/i18n_sv.properties +3 -0
  21. package/_i18n/i18n_th.properties +3 -0
  22. package/_i18n/i18n_zh_CN.properties +3 -0
  23. package/_i18n/i18n_zh_TW.properties +3 -0
  24. package/apis/core.d.ts +26 -30
  25. package/apis/cqn.d.ts +1 -0
  26. package/apis/ql.d.ts +2 -0
  27. package/apis/serve.d.ts +9 -0
  28. package/apis/services.d.ts +3 -2
  29. package/lib/compile/for/lean_drafts.js +22 -19
  30. package/lib/compile/to/srvinfo.js +7 -19
  31. package/lib/dbs/cds-deploy.js +11 -6
  32. package/lib/env/cds-env.js +3 -4
  33. package/lib/env/presets.js +14 -9
  34. package/lib/env/schemas/cds-package.json +3 -1
  35. package/lib/env/schemas/cds-rc.json +0 -4
  36. package/lib/linked/classes.js +112 -12
  37. package/lib/linked/entities.js +3 -0
  38. package/lib/linked/models.js +2 -1
  39. package/lib/ql/SELECT.js +1 -0
  40. package/lib/ql/Whereable.js +1 -0
  41. package/lib/srv/cds-serve.js +2 -1
  42. package/lib/srv/protocols/_legacy.js +7 -6
  43. package/lib/srv/protocols/index.js +30 -55
  44. package/lib/utils/tar.js +2 -2
  45. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +2 -1
  46. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +13 -4
  47. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/format/ResponseContentNegotiator.js +12 -0
  48. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/SerializerFactory.js +3 -1
  49. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/MetadataCache.js +1 -1
  50. package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +1 -4
  51. package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +10 -4
  52. package/libx/_runtime/cds-services/services/utils/columns.js +8 -2
  53. package/libx/_runtime/cds-services/services/utils/differ.js +1 -1
  54. package/libx/_runtime/common/composition/data.js +49 -29
  55. package/libx/_runtime/common/composition/update.js +0 -1
  56. package/libx/_runtime/common/composition/utils.js +1 -1
  57. package/libx/_runtime/common/generic/crud.js +1 -1
  58. package/libx/_runtime/common/generic/input.js +18 -13
  59. package/libx/_runtime/common/utils/cqn2cqn4sql.js +1 -1
  60. package/libx/_runtime/common/utils/resolveView.js +115 -35
  61. package/libx/_runtime/common/utils/rewriteAsterisks.js +21 -0
  62. package/libx/_runtime/common/utils/search2cqn4sql.js +1 -1
  63. package/libx/_runtime/db/generic/rewrite.js +5 -4
  64. package/libx/_runtime/db/query/read.js +10 -9
  65. package/libx/_runtime/db/query/update.js +9 -18
  66. package/libx/_runtime/db/utils/deep.js +6 -5
  67. package/libx/_runtime/db/utils/normalizeTimeData.js +1 -1
  68. package/libx/_runtime/fiori/generic/activate.js +14 -19
  69. package/libx/_runtime/fiori/generic/edit.js +2 -5
  70. package/libx/_runtime/hana/streaming.js +3 -4
  71. package/libx/_runtime/remote/utils/client.js +9 -5
  72. package/libx/odata/afterburner.js +5 -2
  73. package/libx/rest/RestAdapter.js +2 -2
  74. package/libx/rest/middleware/error.js +4 -1
  75. package/libx/rest/middleware/operation.js +1 -1
  76. package/package.json +3 -3
  77. package/lib/srv/protocols/graphql.js +0 -30
package/CHANGELOG.md CHANGED
@@ -4,6 +4,64 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## Version 7.1.0 - 2023-07-28
8
+
9
+ ### Added
10
+
11
+ - Support for resolving of `STREAM` CQN queries that point to views
12
+ - Enable PDF export via GET to collection with accept header `appplication/pdf`.
13
+ Custom handler must return the following:
14
+ ```
15
+ {
16
+ value: <instance of Readable>,
17
+ $mediaContentType: <String>, // > optional, defaults to: application/pdf
18
+ $mediaContentDispositionFilename: <String>, // > optional
19
+ $mediaContentDispositionType: <String> // > optional, defaults to 'attachment' if $mediaContentDispositionFilename is set
20
+ }
21
+ ```
22
+ - Schema for `cds` entry in `package.json` now has a tooltip and default value
23
+ - `srv.endpoints`: Array containing the information for all endpoints at which the service is served.
24
+ Example:
25
+ ```
26
+ [
27
+ { kind: 'odata-v4', path: '/odata/v4/browse' },
28
+ { kind: 'rest', path: '/rest/browse' }
29
+ ]
30
+ ```
31
+
32
+ ### Fixed
33
+
34
+ - Multiple TypeScript improvements
35
+ - Proper handling for `expand=*` for OData URL to CQN parser (`cds.env.features.odata_new_parser`)
36
+ - Fully qualified operation names are correctly resolved in rest adapter
37
+ - Log level for odata metadata cache was not handled correctly
38
+ - Protocol paths are normalized to always have a leading slash
39
+ - `@odata` shortcut for `odata-v4` protocol with custom configuration
40
+ - Default protocol is `odata-v4`, independent of the order in `cds.env.protocols`
41
+ - Data is not logged for GET and DELETE remote requests
42
+ - draft: deep update without change should not update the `modifiedAt` field
43
+ - Lean draft: do not propagate `@Capabilities.NavigationRestrictions.RestrictedProperties`
44
+ - Commit db transaction only once outbound streaming has ended
45
+ - Lean draft: deactivate legacy `drafts` getter
46
+ - Updated typings for srv.send
47
+ - `$search`: exclude calculated fields/expressions from default search in projection of projections
48
+ - Immutable properties are always removed from payload during UPDATE
49
+ - `serviceinfo.urlPath` contains the first endpoint of the service (cf. `srv.endpoints`), which is the legacy path if `cds.env.features.serve_on_root === true`
50
+
51
+ ## Version 7.0.3 - 2023-07-19
52
+
53
+ ### Fixed
54
+
55
+ - Compile for lean draft: do not add draft entity for external entities
56
+ - Rollback awaited in REST adapter
57
+ - `service.on('error')` handler invoked only once
58
+ - `SELECT.one.localized`
59
+ - `COPYFILE_DISABLE=1` is now set for building `tar` archives by default
60
+ - Actions of projection target are no longer accessible in linked models
61
+ - Batch execute model-less mass inputs when on `@sap/hana-client`
62
+ - Requests to `/<path>/webapp` return 404 for absolute `@path` specifications
63
+ - `cds compile --to serviceinfo` no longer returns paths w/ Windows `\` path characters
64
+
7
65
  ## Version 7.0.2 - 2023-07-06
8
66
 
9
67
  ### Fixed
@@ -60,19 +118,18 @@
60
118
  - Support for multiline texts in `properties` files
61
119
  - Error when reading auth protected entities with infix filter in expand
62
120
  - Glitch in transaction handling in case of concurrent async before handlers
63
- - Detection of feature toggles in single-tenant mode
64
121
 
65
122
  ### Removed
66
123
 
67
124
  - Deprecated `req.run()` function, use `cds.run()` instead.
68
- - Deprecated compat mode `cds.env.features.cds_tx_protection = false`
69
- - Deprecated referential integrity checks at runtime
70
125
  - Support for inofficial feature flag `cds.env.features.bigjs`
71
126
  - Support for inofficial feature flag `cds.features.parameterized_numbers`
127
+ - Deprecated referential integrity checks at runtime
72
128
  - Support for `cds-mtx`
73
129
  - Support for Node 14
74
130
  - Internal `req.getUriInfo()` and `req.getUrlObject()`
75
131
  - `cds deploy --to hana` is now part of `@sap/cds-dk`.
132
+ - Deprecated compat mode `cds.env.features.cds_tx_protection = false`
76
133
  - Beta `AuditLogService` and out-of-the-box audit logging. Use plugin `@cap-js/audit-logging` instead.
77
134
 
78
135
  ## Version 6.8.3 - 2023-06-13
@@ -49,6 +49,9 @@ CurrencyCode.Description=\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u0643\u0633\u0648\u0631 \u0648\u062D\u062F\u0627\u062A \u062B\u0627\u0646\u0648\u064A\u0629 \u0644\u0644\u0639\u0645\u0644\u0629
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u0627\u0644\u062F\u0648\u0644\u0629/\u0627\u0644\u0645\u0646\u0637\u0642\u0629
54
57
 
@@ -26,7 +26,7 @@
26
26
  #----------------------------------------------------------------------------------------------------------------------
27
27
 
28
28
  #XTIT: Created By (Answer to: "Which user has created a certain entity?")
29
- CreatedBy=Vytvo\u0159il
29
+ CreatedBy=Vytvo\u0159il(a)
30
30
 
31
31
  #XTIT: Created On (Answer to: "When has a certain entity been created?")
32
32
  CreatedAt=Vytvo\u0159eno dne
@@ -49,6 +49,9 @@ CurrencyCode.Description=K\u00F3d m\u011Bny zadan\u00FD dle ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Symbol m\u011Bny
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Zlomky pomocn\u00E9 jednotky m\u011Bny
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=St\u00E1t/region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Valutakode som angivet af ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Valutasymbol
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Valutahj\u00E6lpeenhedsandele
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Land/region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=W\u00E4hrungscode gem\u00E4\u00DF ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=W\u00E4hrungssymbol
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Bruchteile W\u00E4hrungsuntereinheit
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Land/Region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Currency code as specified by ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Currency Symbol
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Currency Minor Unit Fractions
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Country/Region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=C\u00F3digo de moneda seg\u00FAn especificado por ISO 4
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=S\u00EDmbolo de moneda
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Fracciones unidad secundaria de moneda
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Pa\u00EDs/Regi\u00F3n
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=ISO 4217:n mukainen valuuttakoodi
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Valuuttatunnus
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Valuutan pienen yksik\u00F6n murto-osat
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Maa/alue
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Code de devise tel qu'indiqu\u00E9 par ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Symbole de devise
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Fractions de l'unit\u00E9 secondaire de la devise
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Pays/R\u00E9gion
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Codice divisa come indicato da ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Simbolo divisa
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Frazioni suddivisione unit\u00E0 monetaria
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Paese/regione
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=ISO 4217 \u3067\u6307\u5B9A\u3055\u308C\u3066\u3044\u30
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u901A\u8CA8\u30B7\u30F3\u30DC\u30EB
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u901A\u8CA8\u88DC\u52A9\u5358\u4F4D\u306E\u5206\u6570
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u56FD/\u5730\u57DF
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=ISO 4217\uC5D0\uC11C \uC9C0\uC815\uD55C \uD1B5\uD654 \u
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\uD1B5\uD654 \uAE30\uD638
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\uD1B5\uD654 \uBCF4\uC870 \uB2E8\uC704 \uC18C\uC218 \uC790\uB9AC
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\uAD6D\uAC00/\uC9C0\uC5ED
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Kod mata wang seperti yang dinyatakan dalam ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Simbol Mata Wang
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Pecahan Unit Kecil Mata Wang
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Negara/Wilayah
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Valutacode zoals gespecificeerd door ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Valutasymbool
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Breuken kleinste eenheid valuta
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Land/regio
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Valutakode som definert i ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Valutasymbol
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Deler for valutaunderenhet
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Land/region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Kod waluty okre\u015Blony zgodnie z norm\u0105 ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Symbol waluty
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Warto\u015Bci u\u0142amkowe jednostki pomocniczej waluty
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Kraj/region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=C\u00F3digo de moeda como especificado pelo ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=S\u00EDmbolo da moeda
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Fra\u00E7\u00F5es de unidade auxiliar de moeda
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Pa\u00EDs/regi\u00E3o
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Cod moned\u0103 a\u0219a cum este specificat de ISO 421
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Simbol moned\u0103
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Frac\u021Bii subunitate de moned\u0103
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u021Aar\u0103/regiune
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=\u041A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u0421\u0438\u043C\u0432\u043E\u043B \u0432\u0430\u043B\u044E\u0442\u044B
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u0414\u043E\u043B\u0438 \u0432\u0441\u043F\u043E\u043C\u043E\u0433\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0439 \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u0439 \u0435\u0434\u0438\u043D\u0438\u0446\u044B
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u0421\u0442\u0440\u0430\u043D\u0430/\u0440\u0435\u0433\u0438\u043E\u043D
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=Valutakod enligt ISO 4217
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=Valutasymbol
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=Antal mindre enheter f\u00F6r valuta
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=Land/region
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u0E2A\u0E31\u0E0D\u0E25\u0E31\u0E01\u0E29\u0E13\u0E4C\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u0E40\u0E28\u0E29\u0E2A\u0E48\u0E27\u0E19\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E23\u0E2D\u0E07\u0E02\u0E2D\u0E07\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28/\u0E20\u0E39\u0E21\u0E34\u0E20\u0E32\u0E04
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=ISO 4217 \u6307\u5B9A\u7684\u8D27\u5E01\u4EE3\u7801
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u8D27\u5E01\u7B26\u53F7
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u8D27\u5E01\u6B21\u8981\u5355\u4F4D\u90E8\u5206
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u56FD\u5BB6/\u5730\u533A
54
57
 
@@ -49,6 +49,9 @@ CurrencyCode.Description=\u5DF2\u6309 ISO 4217 \u6307\u5B9A\u516C\u53F8\u4EE3\u7
49
49
  #XTIT: Currency Symbol
50
50
  CurrencySymbol=\u5E63\u5225\u7B26\u865F
51
51
 
52
+ #XTIT: Currency Minor Unit Fractions (Answer to: "How many fractions has a currency's minor unit?", e.g. "0" or "2")
53
+ CurrencyMinorUnit=\u5E63\u5225\u6B21\u8981\u55AE\u4F4D\u5206\u6578
54
+
52
55
  #XTIT: Country/Region
53
56
  Country=\u570B\u5BB6/\u5730\u5340
54
57
 
package/apis/core.d.ts CHANGED
@@ -2,8 +2,31 @@
2
2
  import { ReflectedModel, LinkedModel, LinkedDefinition } from './reflect'
3
3
  import { CSN as csn, Definition } from './csn'
4
4
 
5
+ type UserInput = string | { id: string; attr: Record<string, string>; roles: Record<string, string> } | User
5
6
 
6
- export = cds
7
+ export class User {
8
+ constructor(obj?: UserInput)
9
+ id: string
10
+ /**
11
+ * @deprecated Use https://cap.cloud.sap/docs/node.js/events#locale instead
12
+ */
13
+ locale: string
14
+ /**
15
+ * @deprecated Use https://cap.cloud.sap/docs/node.js/events#tenant instead
16
+ */
17
+ tenant: string | undefined
18
+ attr: Record<string, string>
19
+ roles: Record<string, string>
20
+ static Privileged: typeof Privileged
21
+ is(role: string): boolean
22
+ }
23
+ /**
24
+ * Subclass for executing code with superuser privileges.
25
+ */
26
+ declare class Privileged extends User {
27
+ constructor()
28
+ is(): boolean
29
+ }
7
30
 
8
31
  declare class cds {
9
32
  /**
@@ -22,7 +45,7 @@ declare class cds {
22
45
  * Represents the user in a given context.
23
46
  * @see [capire docs](https://cap.cloud.sap/docs/node.js/authentication#cds-user)
24
47
  */
25
- User: typeof cds.User
48
+ User: typeof User
26
49
 
27
50
  // infer (query : cqn, model : csn) : LinkedDefinition
28
51
 
@@ -105,31 +128,4 @@ declare class cds {
105
128
  lazified: <T>(target: T) => T
106
129
  }
107
130
  // & typeof import ('../lib/index')
108
-
109
- declare namespace cds {
110
- type UserInput = string | { id: string; attr: Record<string, string>; roles: Record<string, string> } | User
111
-
112
- export class User {
113
- constructor(obj?: UserInput)
114
- id: string
115
- /**
116
- * @deprecated Use https://cap.cloud.sap/docs/node.js/events#locale instead
117
- */
118
- locale: string
119
- /**
120
- * @deprecated Use https://cap.cloud.sap/docs/node.js/events#tenant instead
121
- */
122
- tenant: string | undefined
123
- attr: Record<string, string>
124
- roles: Record<string, string>
125
- static Privileged: typeof Privileged
126
- is(role: string): boolean
127
- }
128
- /**
129
- * Subclass for executing code with superuser privileges.
130
- */
131
- class Privileged extends User {
132
- constructor()
133
- is(): boolean
134
- }
135
- }
131
+ export = cds
package/apis/cqn.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { entity } from "./csn"
2
2
 
3
+ export type CQNQuery = SELECT & INSERT & UPDATE & DELETE & CREATE & DROP & UPSERT
3
4
  export type Query = SELECT | INSERT | UPDATE | DELETE | CREATE | DROP | UPSERT
4
5
  export type ParsedExpr = expr & { _:string }
5
6
 
package/apis/ql.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Definition } from "./csn"
2
2
  import * as CQN from "./cqn"
3
3
  import { Constructable, ArrayConstructable, SingularType } from "./internal/inference"
4
4
 
5
+ export type CQNQuery = CQN.CQNQuery
5
6
  export type Query = CQN.Query
6
7
 
7
8
  export class ConstructedQuery {
@@ -239,6 +240,7 @@ export class INSERT<T> extends ConstructedQuery {
239
240
  columns (...col: string[]) : this
240
241
  values (... val: any[]) : this
241
242
  rows (... row: any[]) : this
243
+ as (select: SELECT<T>): this
242
244
  INSERT : CQN.INSERT["INSERT"]
243
245
  }
244
246
 
package/apis/serve.d.ts CHANGED
@@ -36,6 +36,8 @@ declare class cds_serve {
36
36
  */
37
37
  server: cds_server
38
38
 
39
+
40
+
39
41
  /**
40
42
  * Emitted at the very beginning of the bootsrapping process, when the
41
43
  * express application has been constructed but no middlewares or routes
@@ -63,6 +65,13 @@ declare class cds_serve {
63
65
  on (event : 'listening', listener : (args : { server: http.Server, url:string }) => void) : this
64
66
  once (event : 'listening', listener : (args : { server: http.Server, url:string }) => void) : this
65
67
 
68
+ /**
69
+ * Emitted by the default, built-in `server.js` when the http server
70
+ * is shutdown.
71
+ */
72
+ on (event : 'shutdown', listener : () => void) : this
73
+ once (event : 'shutdown', listener : () => void) : this
74
+
66
75
  /**
67
76
  * Dictionary of all services constructed and/or connected.
68
77
  */
@@ -1,4 +1,4 @@
1
- import { SELECT, INSERT, UPDATE, DELETE, Query, ConstructedQuery, UPSERT } from './ql'
1
+ import { SELECT, INSERT, UPDATE, DELETE, CQNQuery, Query, ConstructedQuery, UPSERT } from './ql'
2
2
  import { Awaitable } from './ql'
3
3
  import { ArrayConstructable, Constructable } from './internal/inference'
4
4
  import { LinkedModel, Definition, Definitions } from './reflect'
@@ -180,6 +180,7 @@ export class Service extends QueryAPI {
180
180
  <T = any>(details: { event: Events; data?: object; headers?: object }): Promise<T>
181
181
  <T = any>(details: { query: ConstructedQuery; data?: object; headers?: object }): Promise<T>
182
182
  <T = any>(details: { method: Event; path: string; data?: object; headers?: object }): Promise<T>
183
+ <T = any>(details: { event: Event; entity: Definition | string; data?: object; params?: object }): Promise<T>
183
184
  }
184
185
 
185
186
  /**
@@ -389,7 +390,7 @@ interface Request extends EventMessage {
389
390
  * @see https://cap.cloud.sap/docs/node.js/events#req-entity
390
391
  */
391
392
  entity: string
392
- query: Query
393
+ query: CQNQuery
393
394
  subject: ref
394
395
 
395
396
  reply(results: any): void
@@ -33,24 +33,25 @@ module.exports = function cds_compile_for_lean_drafts(csn) {
33
33
  }
34
34
 
35
35
  const { Draft } = cds.linked(`
36
- entity ActiveEntity { key ID: UUID; }
37
- entity Draft {
38
- virtual IsActiveEntity : Boolean; // REVISIT: these are calculated fields, aren't they?
39
- virtual HasDraftEntity : Boolean; // REVISIT: these are calculated fields, aren't they?
40
- HasActiveEntity : Boolean; // This should be written !!!
41
- DraftAdministrativeData : Association to DRAFT.DraftAdministrativeData;
42
- DraftAdministrativeData_DraftUUID : UUID;
43
- // SiblingEntity : Association to ActiveEntity; // REVISIT: Why didn't we use a managed assoc here?
44
- }
45
- entity DRAFT.DraftAdministrativeData {
46
- key DraftUUID : UUID;
47
- LastChangedByUser : String(256); LastChangeDateTime : Timestamp;
48
- CreatedByUser : String(256); CreationDateTime : Timestamp;
49
- InProcessByUser : String(256);
50
- DraftIsCreatedByMe : Boolean; // REVISIT: these are calculated fields, aren't they?
51
- DraftIsProcessedByMe : Boolean; // REVISIT: these are calculated fields, aren't they?
52
- }
53
- `).definitions
36
+ entity ActiveEntity { key ID: UUID; }
37
+ entity Draft {
38
+ virtual IsActiveEntity : Boolean; // REVISIT: these are calculated fields, aren't they?
39
+ virtual HasDraftEntity : Boolean; // REVISIT: these are calculated fields, aren't they?
40
+ HasActiveEntity : Boolean; // This should be written !!!
41
+ DraftAdministrativeData : Association to DRAFT.DraftAdministrativeData;
42
+ DraftAdministrativeData_DraftUUID : UUID;
43
+ // SiblingEntity : Association to ActiveEntity; // REVISIT: Why didn't we use a managed assoc here?
44
+ }
45
+ entity DRAFT.DraftAdministrativeData {
46
+ key DraftUUID : UUID;
47
+ LastChangedByUser : String(256); LastChangeDateTime : Timestamp;
48
+ CreatedByUser : String(256); CreationDateTime : Timestamp;
49
+ InProcessByUser : String(256);
50
+ DraftIsCreatedByMe : Boolean; // REVISIT: these are calculated fields, aren't they?
51
+ DraftIsProcessedByMe : Boolean; // REVISIT: these are calculated fields, aren't they?
52
+ }
53
+ `).definitions
54
+
54
55
  function addDraftEntity(active, model) {
55
56
  const _draftEntity = active.name + '.drafts'
56
57
  const d = model.definitions[_draftEntity]
@@ -75,6 +76,7 @@ module.exports = function cds_compile_for_lean_drafts(csn) {
75
76
  if ('@Capabilities.DeleteRestrictions.Deletable' in draft) draft['@Capabilities.DeleteRestrictions.Deletable'] = undefined
76
77
  if ('@Capabilities.InsertRestrictions.Insertable' in draft) draft['@Capabilities.InsertRestrictions.Insertable'] = undefined
77
78
  if ('@Capabilities.UpdateRestrictions.Updatable' in draft) draft['@Capabilities.UpdateRestrictions.Updatable'] = undefined
79
+ if ('@Capabilities.NavigationRestrictions.RestrictedProperties' in draft) draft['@Capabilities.NavigationRestrictions.RestrictedProperties'] = undefined
78
80
 
79
81
  // Recursively add drafts for compositions
80
82
  for (const each in draft.elements) {
@@ -104,9 +106,10 @@ module.exports = function cds_compile_for_lean_drafts(csn) {
104
106
  }
105
107
  return draft
106
108
  }
109
+
107
110
  for (const name in csn.definitions) {
108
111
  const def = csn.definitions[name]
109
- if (!_isDraft(def)) continue
112
+ if (!_isDraft(def) || def['@cds.external']) continue
110
113
  def.elements.IsActiveEntity.virtual = true
111
114
  def.elements.HasDraftEntity.virtual = true
112
115
  def.elements.HasActiveEntity.virtual = true
@@ -35,40 +35,28 @@ module.exports = (model, options={}) => {
35
35
  }
36
36
  }
37
37
  function _makeNode(service) {
38
- const path = _effectiveNodePath(service)
39
38
  return {
40
39
  name: service.name,
41
- urlPath: _url4 (path),
40
+ urlPath: _url4 (cds.service.path4(service)),
42
41
  destination: 'srv-api', // the name to register in xs-app.json
43
42
  runtime: 'Node.js',
44
43
  location: service.$location
45
44
  }
46
45
  }
47
46
 
48
- // TODO use a function from cds.service... instead
49
- function _effectiveNodePath(service) {
50
- if (service['@path']?.[0] === '/') { // absolute path given
51
- return service['@path']
52
- }
53
- const { ProtocolAdapter } = cds.service.protocols
54
- const prots = ProtocolAdapter.protocols4(service)
55
- const prot = prots.find(p => p.kind.startsWith('odata')) || prots[0] // prefer odata for compat. reasons
56
- if (prot.path && prot.path.startsWith('/')) {
57
- return prot.path
58
- }
59
- const rootPath = cds.env.requires.middlewares ? ProtocolAdapter.protocols[prot.kind]?.path || '' : ''
60
- return join(rootPath, prot.path || cds.service.path4(service))
61
- }
62
-
63
47
  // the URL path that is *likely* effective at runtime
64
48
  function _url4 (p) {
65
- return normalize (p.replace(/^\/+/, '') + '/') //> /foo/bar -> foo/bar/
49
+ p = p.replace(/\\/g, '/') // handle Windows
50
+ .replace(/^\/+/, '') // strip leading
51
+ .replace(/\/+$/, '') // strip trailing
52
+ p += '/' // end with /
53
+ return p
66
54
  }
67
55
 
68
56
  function _javaPath (service) {
69
57
  const d = model.definitions[service.name]
70
58
  const path = d && d['@path'] ? d['@path'].replace(/^[^/]/, c => '/'+c) : service.name
71
- return join(javaPrefix, path).replace(/\\/g, '/')
59
+ return join(javaPrefix, path)
72
60
  }
73
61
 
74
62
  function _isNodeProject(root) {
@@ -102,13 +102,18 @@ exports.create = async function cds_deploy_create (db, csn=db.model, o) {
102
102
  creas = cds.compile.to.sql(csn, o)
103
103
  }
104
104
 
105
- if (!drops)
106
- drops = creas
107
- .map(each => {
105
+ if (!drops) {
106
+ drops = [];
107
+ creas.forEach(each => {
108
+ // For postgres, we add constraints via "ALTER TABLE" - so our regex might not match.
108
109
  let [, kind, entity] = each.match(/^CREATE (TABLE|VIEW) ("[^"]+"|[^\s(]+)/im) || []
109
- return `DROP ${kind} IF EXISTS ${entity};`
110
- })
111
- .reverse()
110
+ if(kind && entity)
111
+ drops.push(`DROP ${kind} IF EXISTS ${entity};`);
112
+ });
113
+
114
+ drops.reverse()
115
+ }
116
+
112
117
 
113
118
  if (!drops.length && !creas.length) return !o.dry
114
119
 
@@ -73,10 +73,7 @@ class Config {
73
73
  // 5. link dependent services
74
74
  this._link_required_services()
75
75
 
76
- // 6. complete service configurations from cloud service bindings
77
- this._add_cloud_service_bindings(process.env)
78
-
79
- // 7. Add compatibility and correlations for mtx
76
+ // 6. Add compatibility and correlations for mtx
80
77
  const db = this.requires?.db
81
78
  if (this.requires?.db) {
82
79
  if (this.requires.multitenancy !== undefined)
@@ -86,6 +83,8 @@ class Config {
86
83
  }
87
84
  if (this.requires?.multitenancy && this.requires.db?.kind === 'hana' && !this.requires.db.vcap) Object.assign(this.requires.db, { vcap: { label: 'service-manager' } })
88
85
 
86
+ // 7. complete service configurations from cloud service bindings
87
+ this._add_cloud_service_bindings(process.env)
89
88
 
90
89
  // 8. apply presets
91
90
  presets (this)