@sap/cds 6.1.3 → 6.2.1

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 (206) hide show
  1. package/CHANGELOG.md +77 -8
  2. package/apis/cds.d.ts +18 -6
  3. package/apis/connect.d.ts +1 -1
  4. package/apis/cqn.d.ts +1 -1
  5. package/apis/log.d.ts +23 -5
  6. package/apis/ql.d.ts +128 -61
  7. package/apis/services.d.ts +11 -0
  8. package/apis/test.d.ts +61 -0
  9. package/apis/utils.d.ts +15 -0
  10. package/app/fiori/preview.js +1 -0
  11. package/bin/build/buildTaskEngine.js +70 -22
  12. package/bin/build/buildTaskFactory.js +18 -11
  13. package/bin/build/buildTaskHandler.js +1 -1
  14. package/bin/build/buildTaskProviderFactory.js +3 -13
  15. package/bin/build/constants.js +0 -1
  16. package/bin/build/index.js +14 -6
  17. package/bin/build/provider/buildTaskHandlerEdmx.js +2 -3
  18. package/bin/build/provider/buildTaskHandlerFeatureToggles.js +2 -2
  19. package/bin/build/provider/buildTaskHandlerInternal.js +3 -6
  20. package/bin/build/provider/buildTaskProviderInternal.js +51 -39
  21. package/bin/build/provider/fiori/index.js +3 -3
  22. package/bin/build/provider/hana/2migration.js +1 -1
  23. package/bin/build/provider/hana/index.js +34 -27
  24. package/bin/build/provider/java/index.js +6 -7
  25. package/bin/build/provider/mtx/index.js +20 -18
  26. package/bin/build/provider/mtx/resourcesTarBuilder.js +8 -11
  27. package/bin/build/provider/mtx-sidecar/index.js +13 -17
  28. package/bin/build/provider/nodejs/index.js +8 -7
  29. package/bin/build/util.js +22 -4
  30. package/bin/cds.js +8 -4
  31. package/bin/deploy/to-hana/cfUtil.js +53 -18
  32. package/bin/mtx/in-cds.js +1 -0
  33. package/bin/serve.js +37 -30
  34. package/lib/auth/basic-auth.js +33 -0
  35. package/lib/auth/dummy-auth.js +7 -0
  36. package/lib/auth/ias-auth.js +2 -0
  37. package/lib/auth/index.js +31 -0
  38. package/lib/auth/jwt-auth.js +3 -0
  39. package/lib/auth/mocked-users.js +72 -0
  40. package/lib/auth/passport-basic.js +12 -0
  41. package/lib/auth/passport-digest.js +14 -0
  42. package/lib/auth/xsuaa-auth.js +3 -0
  43. package/lib/compile/cds-compile.js +3 -3
  44. package/lib/compile/to/cdl.js +5 -1
  45. package/lib/compile/to/edm.js +8 -0
  46. package/lib/compile/to/gql.js +1 -0
  47. package/lib/compile/to/json.js +30 -5
  48. package/lib/compile/to/sql.js +3 -1
  49. package/lib/core/index.js +5 -1
  50. package/lib/dbs/cds-deploy.js +36 -6
  51. package/lib/env/cds-env.js +15 -5
  52. package/lib/env/cds-requires.js +51 -58
  53. package/lib/env/defaults.js +1 -0
  54. package/lib/env/schemas/cds-package.json +4 -0
  55. package/lib/env/schemas/cds-rc.json +63 -77
  56. package/lib/i18n/localize.js +16 -5
  57. package/lib/index.js +9 -4
  58. package/lib/log/cds-error.js +4 -6
  59. package/lib/log/cds-log.js +89 -53
  60. package/lib/log/service/index.js +1 -0
  61. package/lib/ql/CREATE.js +2 -5
  62. package/lib/ql/DELETE.js +1 -1
  63. package/lib/ql/DROP.js +1 -3
  64. package/lib/ql/INSERT.js +3 -3
  65. package/lib/ql/Query.js +10 -23
  66. package/lib/ql/SELECT.js +1 -2
  67. package/lib/ql/UPDATE.js +2 -2
  68. package/lib/ql/Whereable.js +7 -15
  69. package/lib/ql/cds-ql.js +9 -3
  70. package/lib/req/cds-context.js +11 -3
  71. package/lib/req/context.js +29 -23
  72. package/lib/req/locale.js +9 -5
  73. package/lib/req/request.js +1 -0
  74. package/lib/req/user.js +2 -1
  75. package/lib/srv/cds-connect.js +1 -1
  76. package/lib/srv/cds-serve.js +21 -14
  77. package/lib/srv/middlewares/cds-context.js +29 -0
  78. package/lib/srv/middlewares/ctx-model.js +24 -0
  79. package/lib/srv/middlewares/errors.js +9 -0
  80. package/lib/srv/middlewares/index.js +22 -0
  81. package/lib/srv/middlewares/sap-statistics.js +13 -0
  82. package/lib/srv/middlewares/trace.js +102 -0
  83. package/lib/srv/protocols/_legacy.js +42 -0
  84. package/lib/srv/protocols/graphql.js +39 -0
  85. package/lib/srv/protocols/hcql.js +37 -0
  86. package/lib/srv/protocols/index.js +86 -0
  87. package/lib/srv/protocols/odata-v2-proxy.js +3767 -0
  88. package/lib/srv/protocols/odata-v2.js +26 -0
  89. package/lib/srv/protocols/odata-v4.js +16 -0
  90. package/lib/srv/protocols/rest.js +13 -0
  91. package/lib/srv/srv-api.js +5 -0
  92. package/lib/srv/srv-models.js +4 -6
  93. package/lib/utils/axios.js +3 -2
  94. package/lib/utils/cds-test.js +27 -21
  95. package/lib/utils/cds-utils.js +19 -20
  96. package/lib/utils/tar.js +175 -0
  97. package/libx/_runtime/audit/generic/personal/utils.js +18 -7
  98. package/libx/_runtime/audit/utils/v2.js +1 -0
  99. package/libx/_runtime/auth/index.js +4 -0
  100. package/libx/_runtime/auth/strategies/ias-auth.js +76 -0
  101. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +8 -3
  102. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +15 -4
  103. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +1 -1
  104. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/orderByToCQN.js +1 -1
  105. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +1 -1
  106. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/ResourcePathParser.js +9 -0
  107. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriInfo.js +5 -1
  108. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParser.js +12 -0
  109. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/utils/BufferedWriter.js +6 -2
  110. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/RequestValidator.js +47 -7
  111. package/libx/_runtime/cds-services/adapter/odata-v4/to.js +1 -1
  112. package/libx/_runtime/cds-services/util/assert.js +4 -0
  113. package/libx/_runtime/common/aspects/relation.js +1 -1
  114. package/libx/_runtime/common/composition/data.js +61 -15
  115. package/libx/_runtime/common/composition/delete.js +0 -1
  116. package/libx/_runtime/common/composition/insert.js +0 -1
  117. package/libx/_runtime/common/composition/tree.js +4 -10
  118. package/libx/_runtime/common/composition/update.js +44 -21
  119. package/libx/_runtime/common/generic/auth/capabilities.js +8 -10
  120. package/libx/_runtime/common/generic/crud.js +1 -2
  121. package/libx/_runtime/common/generic/etag.js +4 -4
  122. package/libx/_runtime/common/generic/input.js +4 -4
  123. package/libx/_runtime/common/generic/paging.js +3 -3
  124. package/libx/_runtime/common/generic/put.js +3 -3
  125. package/libx/_runtime/common/generic/sorting.js +4 -4
  126. package/libx/_runtime/common/generic/temporal.js +3 -3
  127. package/libx/_runtime/common/i18n/messages.properties +0 -7
  128. package/libx/_runtime/common/utils/cqn2cqn4sql.js +11 -6
  129. package/libx/_runtime/common/utils/csn.js +0 -28
  130. package/libx/_runtime/common/utils/draft.js +8 -1
  131. package/libx/_runtime/common/utils/path.js +7 -1
  132. package/libx/_runtime/common/utils/resolveView.js +2 -3
  133. package/libx/_runtime/db/data-conversion/post-processing.js +3 -44
  134. package/libx/_runtime/db/generic/input.js +3 -3
  135. package/libx/_runtime/db/sql-builder/dataTypes.js +4 -0
  136. package/libx/_runtime/fiori/generic/activate.js +2 -2
  137. package/libx/_runtime/fiori/generic/before.js +40 -72
  138. package/libx/_runtime/fiori/generic/cancel.js +2 -2
  139. package/libx/_runtime/fiori/generic/delete.js +2 -2
  140. package/libx/_runtime/fiori/generic/edit.js +2 -2
  141. package/libx/_runtime/fiori/generic/new.js +2 -2
  142. package/libx/_runtime/fiori/generic/patch.js +49 -37
  143. package/libx/_runtime/fiori/generic/prepare.js +2 -2
  144. package/libx/_runtime/fiori/generic/read.js +27 -37
  145. package/libx/_runtime/fiori/utils/where.js +4 -2
  146. package/libx/_runtime/hana/Service.js +1 -3
  147. package/libx/_runtime/hana/conversion.js +3 -0
  148. package/libx/_runtime/hana/driver.js +33 -3
  149. package/libx/_runtime/hana/dynatrace.js +1 -0
  150. package/libx/_runtime/hana/search2Contains.js +12 -1
  151. package/libx/_runtime/hana/search2cqn4sql.js +10 -27
  152. package/libx/_runtime/hana/streaming.js +1 -0
  153. package/libx/_runtime/messaging/AMQPWebhookMessaging.js +4 -2
  154. package/libx/_runtime/messaging/common-utils/AMQPClient.js +1 -0
  155. package/libx/_runtime/messaging/enterprise-messaging-utils/getTenantInfo.js +5 -2
  156. package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +2 -0
  157. package/libx/_runtime/messaging/enterprise-messaging.js +62 -3
  158. package/libx/_runtime/messaging/outbox/utils.js +1 -1
  159. package/libx/_runtime/messaging/redis-messaging.js +1 -0
  160. package/libx/_runtime/remote/Service.js +2 -2
  161. package/libx/_runtime/remote/utils/client.js +8 -3
  162. package/libx/_runtime/remote/utils/data.js +7 -2
  163. package/libx/_runtime/sqlite/Service.js +18 -7
  164. package/libx/_runtime/sqlite/conversion.js +3 -0
  165. package/libx/_runtime/sqlite/convertAssocToOneManaged.js +3 -3
  166. package/libx/_runtime/sqlite/localized.js +8 -8
  167. package/libx/odata/afterburner.js +39 -7
  168. package/libx/odata/cqn2odata.js +6 -3
  169. package/libx/odata/grammar.pegjs +66 -18
  170. package/libx/odata/index.js +3 -2
  171. package/libx/odata/parser.js +1 -1
  172. package/libx/odata/utils.js +2 -0
  173. package/libx/rest/RestAdapter.js +62 -43
  174. package/libx/rest/middleware/parse.js +2 -1
  175. package/libx/rest/middleware/update.js +1 -1
  176. package/package.json +2 -2
  177. package/server.js +5 -4
  178. package/srv/mtx.cds +1 -1
  179. package/srv/mtx.js +4 -33
  180. package/lib/srv/adapters.js +0 -85
  181. package/lib/utils/resources/index.js +0 -48
  182. package/lib/utils/resources/tar.js +0 -49
  183. package/lib/utils/resources/utils.js +0 -11
  184. package/libx/_runtime/extensibility/activate.js +0 -69
  185. package/libx/_runtime/extensibility/add.js +0 -50
  186. package/libx/_runtime/extensibility/addExtension.js +0 -72
  187. package/libx/_runtime/extensibility/defaults.js +0 -34
  188. package/libx/_runtime/extensibility/handler/transformREAD.js +0 -121
  189. package/libx/_runtime/extensibility/handler/transformRESULT.js +0 -51
  190. package/libx/_runtime/extensibility/handler/transformWRITE.js +0 -64
  191. package/libx/_runtime/extensibility/linter/allowlist_checker.js +0 -373
  192. package/libx/_runtime/extensibility/linter/annotations_checker.js +0 -113
  193. package/libx/_runtime/extensibility/linter/checker_base.js +0 -20
  194. package/libx/_runtime/extensibility/linter/namespace_checker.js +0 -180
  195. package/libx/_runtime/extensibility/linter.js +0 -32
  196. package/libx/_runtime/extensibility/push.js +0 -118
  197. package/libx/_runtime/extensibility/service.js +0 -38
  198. package/libx/_runtime/extensibility/token.js +0 -57
  199. package/libx/_runtime/extensibility/utils.js +0 -131
  200. package/libx/_runtime/extensibility/validation.js +0 -50
  201. package/libx/_runtime/extensibility/views.js +0 -12
  202. package/srv/extensibility-service.cds +0 -60
  203. package/srv/extensibility-service.js +0 -1
  204. package/srv/extensions.cds +0 -8
  205. package/srv/model-provider.cds +0 -61
  206. package/srv/model-provider.js +0 -143
@@ -2,9 +2,16 @@ const _runtime = '@sap/cds/libx/_runtime'
2
2
 
3
3
  exports = module.exports = {
4
4
 
5
+ middlewares: false,
6
+ "[middlewares]": {
7
+ middlewares: true
8
+ },
9
+
5
10
  db: undefined,
6
11
  messaging: undefined,
7
12
  multitenancy: undefined,
13
+ extensibility: undefined,
14
+ toggles: undefined,
8
15
 
9
16
  auth: {
10
17
  '[development]': { kind: 'mocked-auth' },
@@ -33,11 +40,16 @@ exports = module.exports = {
33
40
 
34
41
  const _authentication_strategies = {
35
42
 
36
- "basic-auth": "mocked-auth",
43
+ "basic-auth": {
44
+ kind: 'basic-auth', // this is to override kind from cds.requires.auth
45
+ strategy: 'mock', // REVISIT: Can be removed when we switch to new auth middlewars
46
+ users: {},
47
+ tenants: {}
48
+ },
37
49
  "mocked-auth": {
38
- strategy: 'mock',
50
+ kind: 'basic-auth',
39
51
  users: {
40
- alice: { roles: ['admin'] },
52
+ alice: { roles: ['admin', 'cds.Subscriber'] },
41
53
  bob: { roles: ['builder'] },
42
54
  carol: { tenant: 't1', roles: ['admin', 'cds.Subscriber', 'cds.ExtensionDeveloper', 'cds.UIFlexDeveloper'] },
43
55
  dave: { tenant: 't1', roles: ['cds.Subscriber'], features: [] }, // user-specific features
@@ -52,15 +64,19 @@ const _authentication_strategies = {
52
64
  }
53
65
  },
54
66
  "jwt-auth": {
55
- strategy: 'JWT',
67
+ strategy: 'JWT', // REVISIT: Can be removed when we switch to new auth middlewars
56
68
  vcap: { label: 'xsuaa' }
57
69
  },
70
+ "ias-auth": {
71
+ kind: 'ias-auth',
72
+ vcap: { label: 'identity' }
73
+ },
58
74
  "xsuaa": {
59
- strategy: 'xsuaa',
75
+ strategy: 'xsuaa', // REVISIT: Can be removed when we switch to new auth middlewars
60
76
  vcap: { label: 'xsuaa' }
61
77
  },
62
78
  "dummy-auth": {
63
- strategy: 'dummy',
79
+ strategy: 'dummy', // REVISIT: Can be removed when we switch to new auth middlewars
64
80
  },
65
81
 
66
82
  }
@@ -101,13 +117,18 @@ const _databases = {
101
117
  "sql": {
102
118
  '[development]': { kind: 'sqlite', credentials: { url: ':memory:' } },
103
119
  '[production]': { kind: 'hana' },
120
+ '[better-sqlite]': { kind: 'better-sqlite' },
104
121
  },
122
+ "better-sqlite": _compat_to_use({
123
+ credentials: { url: ":memory:" },
124
+ impl: "@sap/cds-sqlite",
125
+ }),
105
126
  "sql-mt": {
106
127
  '[development]': { kind: 'sqlite' },
107
128
  '[production]': { kind: 'hana-mt' },
108
129
  },
109
130
  "sqlite": _compat_to_use({
110
- credentials: { url: 'sqlite.db' },
131
+ credentials: { url: 'db.sqlite' },
111
132
  impl: `${_runtime}/sqlite/Service.js`,
112
133
  }),
113
134
  "hana": _compat_to_use ({
@@ -191,56 +212,6 @@ const _messaging = {
191
212
  }
192
213
 
193
214
 
194
- const _mtx_services = {
195
-
196
- "toggles": {
197
- model: "@sap/cds/srv/mtx"
198
- },
199
- "cds.xt.ModelProviderService": {
200
- model: "@sap/cds/srv/model-provider"
201
- },
202
- "cds.xt.ModelProviderService-in-sidecar": {
203
- "[development]": { root: "../.." }, // sidecar is expected to reside in ./mtx/sidecar
204
- "[production]": { root: "_main" },
205
- "[prod]": { root: "_main" }, // for simulating production in local tests
206
- },
207
- "cds.xt.ModelProviderService-from-sidecar": {
208
- kind: 'rest'
209
- },
210
-
211
- "multitenancy": {
212
- model: "@sap/cds/srv/mtx",
213
- kind: "saas-registry",
214
- },
215
- "cds.xt.SaasProvisioningService": {
216
- model: "@sap/cds-mtxs/srv/cf/saas-provisioning-service",
217
- kind: "saas-registry",
218
- },
219
- "cds.xt.DeploymentService": {
220
- model: "@sap/cds-mtxs/srv/deployment-service",
221
- },
222
- "cds.xt.DeploymentService-in-sidecar": {
223
- },
224
- "cds.xt.DeploymentService-from-sidecar": {
225
- kind: 'rest'
226
- },
227
-
228
- "extensions": {
229
- model: "@sap/cds/srv/extensions",
230
- },
231
- "extensibility": {
232
- model: [ "@sap/cds/srv/mtx", "@sap/cds/srv/extensions" ],
233
- tenantCheckInterval: 10000
234
- },
235
- "cds.xt.ExtensibilityService": {
236
- model: "@sap/cds/srv/extensibility-service"
237
- },
238
- "uiflex": "extensibility", // REVISIT: temporary for compatibility with cds-mtxs tests -> eliminate "uiflex" later
239
-
240
- }
241
-
242
-
243
-
244
215
  const _platform_services = {
245
216
 
246
217
  "audit-log-service": {
@@ -265,13 +236,35 @@ const _platform_services = {
265
236
 
266
237
  }
267
238
 
239
+ require = (id) => { // eslint-disable-line no-global-assign
240
+ try {
241
+ return module.require(id)
242
+ } catch(e) {
243
+ if (e.code !== 'MODULE_NOT_FOUND') throw e
244
+ }
245
+ }
246
+
247
+ // REVISIT: we should have a real modular plugin technique for cds.env
248
+ // eslint-disable-next-line cds/no-missing-dependencies
249
+ const _mtxs = require('@sap/cds-mtxs/lib/env-requires') || {
250
+ "toggles": {
251
+ model: "@sap/cds/srv/mtx"
252
+ },
253
+ "multitenancy": {
254
+ model: "@sap/cds/srv/mtx",
255
+ kind: "saas-registry",
256
+ },
257
+ "extensibility": {
258
+ model: "@sap/cds/srv/mtx",
259
+ },
260
+ }
268
261
 
269
262
  exports.kinds = {
270
263
  ..._authentication_strategies,
271
264
  ..._databases,
272
265
  ..._services,
273
266
  ..._messaging,
274
- ..._mtx_services,
267
+ ..._mtxs,
275
268
  ..._platform_services,
276
269
  }
277
270
 
@@ -24,6 +24,7 @@ module.exports = {
24
24
  mocked_bindings: !production,
25
25
  // skip_unused: 'all',
26
26
  skip_unused: true,
27
+ deploy_data_onconflict: 'insert',
27
28
  one_model: true,
28
29
  localized: true,
29
30
  assert_integrity: false,
@@ -4,6 +4,10 @@
4
4
  "description": "This is a JSON schema representation of the CDS project configuration inside a project root level package.json",
5
5
  "type": "object",
6
6
  "properties": {
7
+ "extends": {
8
+ "description": "Name of the application that shall be extended",
9
+ "type": "string"
10
+ },
7
11
  "cds": {
8
12
  "$ref": "cdsJsonSchema://schemas/cds-rc.json"
9
13
  }
@@ -7,26 +7,23 @@
7
7
  "properties": {
8
8
  "folders": {
9
9
  "type": "object",
10
- "description": "Set folders if you don't want to use the defaults 'app', 'db', 'srv'.",
10
+ "description": "Only set folders if you don't want to use the defaults 'app/', 'db/', 'srv/'.",
11
11
  "additionalProperties": true,
12
12
  "properties": {
13
13
  "app": {
14
14
  "type": "string",
15
15
  "format": "uri-reference",
16
- "default": "app",
17
- "description": "Path for app folder."
16
+ "description": "Add a custom path for the app property, which becomes 'cds.roots'."
18
17
  },
19
18
  "db": {
20
19
  "type": "string",
21
20
  "format": "uri-reference",
22
- "default": "db",
23
- "description": "Path for db folder."
21
+ "description": "Add a custom path for the db property, which becomes 'cds.roots'."
24
22
  },
25
23
  "srv": {
26
24
  "type": "string",
27
25
  "format": "uri-reference",
28
- "default": "srv",
29
- "description": "Path for srv folder."
26
+ "description": "Add a custom path for the srv property, which becomes 'cds.roots'."
30
27
  }
31
28
  },
32
29
  "patternProperties": {
@@ -37,36 +34,38 @@
37
34
  },
38
35
  "build": {
39
36
  "type": "object",
40
- "description": "CDS build settings.",
37
+ "description": "Customize CDS build settings.",
41
38
  "additionalProperties": true,
42
39
  "properties": {
43
40
  "target": {
44
41
  "type": "string",
45
- "description": "The folder which contains generated build results. Defaults to 'gen'.",
46
- "format": "uri-reference",
47
- "default": "gen"
42
+ "description": "Specify the folder which contains generated build results. Defaults to './gen'.",
43
+ "format": "uri-reference"
48
44
  },
49
45
  "tasks": {
50
46
  "type": "array",
51
- "description": "Controls which tasks cds build will execute on your project modules.",
47
+ "description": "Control which tasks 'cds build' will execute on your project modules. This is a typical task configuration: '\"tasks\": [{ \"for\": \"hana\"}];",
52
48
  "uniqueItems": true,
49
+ "default": [
50
+ {}
51
+ ],
53
52
  "items": {
54
53
  "type": "object",
55
54
  "additionalProperties": true,
56
55
  "properties": {
57
56
  "dest": {
58
57
  "type": "string",
59
- "description": "Destination folder for this build task relative to build target folder.",
58
+ "description": "Optional: Define the destination folder for this build task, relative to build target folder. \nFor example: Destination defined as 'custom' results in an output written to 'gen/custom'.",
60
59
  "format": "uri-reference"
61
60
  },
62
61
  "src": {
63
62
  "type": "string",
64
- "description": "Source folder for this build task.",
63
+ "description": "Optional: Prefer defining 'cds.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
65
64
  "format": "uri-reference"
66
65
  },
67
66
  "for": {
68
67
  "type": "string",
69
- "description": "Target technology for this build task.",
68
+ "description": "Define the target technology for this build task.",
70
69
  "minLength": 1,
71
70
  "enum": [
72
71
  "nodejs",
@@ -81,7 +80,7 @@
81
80
  },
82
81
  "options": {
83
82
  "type": "object",
84
- "description": "Set target technology specific options for this build task.",
83
+ "description": "Optional: Set target technology specific options for this build task.",
85
84
  "additionalProperties": true,
86
85
  "properties": {
87
86
  "model": {
@@ -96,50 +95,41 @@
96
95
  },
97
96
  "i18n": {
98
97
  "type": "object",
99
- "description": "CDS translation settings.",
98
+ "description": "Customize CDS translation settings.",
100
99
  "additionalProperties": true,
101
100
  "properties": {
102
101
  "default_language": {
103
- "type": "string",
104
- "default": "en"
102
+ "type": "string"
105
103
  },
106
104
  "folders": {
107
- "description": "List of language file folders. First valid entry wins.",
108
- "default": [
109
- "_i18n",
110
- "i18n",
111
- "assets/i18n"
112
- ],
105
+ "description": "Define the list of folders containing language files. Defaults are '_i18n/', 'i18n/', and 'assets/i18n/'. First valid entry wins.",
106
+ "default": [],
113
107
  "$ref": "#/$defs/foldersStringArray"
114
108
  }
115
109
  }
116
110
  },
117
111
  "deploy": {
118
112
  "type": "object",
119
- "description": "CDS deploy settings.",
113
+ "description": "Customize 'cds deploy' settings.",
120
114
  "additionalProperties": true,
121
115
  "properties": {
122
116
  "no_save": {
123
117
  "type": "boolean",
124
- "description": "Do / don't update config in package.json.",
118
+ "description": "Do / don't update configuration in package.json.",
125
119
  "default": true
126
120
  }
127
121
  }
128
122
  },
129
- "extends": {
130
- "description": "Name of the application that shall be extended",
131
- "type": "string"
132
- },
133
123
  "requires": {
134
124
  "type": "object",
135
- "description": "CDS Dependencies to databases and services can be configured by listing them within a requires section.",
125
+ "description": "List CDS dependencies to databases and services within the requires section.",
136
126
  "additionalProperties": true,
137
127
  "properties": {
138
128
  "auth": {
139
129
  "oneOf": [
140
130
  {
141
131
  "type": "string",
142
- "description": "Auth-specific settings via shortcut.",
132
+ "description": "Use standard auth-specific settings via shortcut.",
143
133
  "anyOf": [
144
134
  {
145
135
  "$ref": "#/$defs/authType"
@@ -151,15 +141,13 @@
151
141
  },
152
142
  {
153
143
  "type": "object",
154
- "description": "Authentication settings.",
155
- "default": {
156
- "kind": "mocked"
157
- },
144
+ "description": "Use custom authentication settings.",
145
+ "default": {},
158
146
  "additionalProperties": true,
159
147
  "properties": {
160
148
  "kind": {
161
149
  "type": "string",
162
- "description": "Kind of dependency.",
150
+ "description": "Define the kind of strategy.",
163
151
  "anyOf": [
164
152
  {
165
153
  "$ref": "#/$defs/authType"
@@ -174,7 +162,7 @@
174
162
  },
175
163
  "credentials": {
176
164
  "type": "object",
177
- "description": "Can be explicitly configured here, but will be overruled by VCAP_SERVICES if a matching entry is found therein.",
165
+ "description": "You can explicitly configure credentials, but this is overruled by VCAP_SERVICES if a matching entry is found therein.",
178
166
  "additionalProperties": true,
179
167
  "properties": {
180
168
  "database": {
@@ -191,7 +179,7 @@
191
179
  "oneOf": [
192
180
  {
193
181
  "type": "string",
194
- "description": "Database specific settings via shortcut.",
182
+ "description": "Use standard database-specific settings via shortcut.",
195
183
  "anyOf": [
196
184
  {
197
185
  "$ref": "#/$defs/databaseType"
@@ -203,15 +191,13 @@
203
191
  },
204
192
  {
205
193
  "type": "object",
206
- "description": "Database specific settings.",
207
- "default": {
208
- "kind": "sqlite"
209
- },
194
+ "description": "Use custom database-specific settings.",
195
+ "default": {},
210
196
  "additionalProperties": true,
211
197
  "properties": {
212
198
  "kind": {
213
199
  "type": "string",
214
- "description": "Kind of dependency.",
200
+ "description": "Define the kind of dependency.",
215
201
  "anyOf": [
216
202
  {
217
203
  "$ref": "#/$defs/databaseType"
@@ -222,12 +208,12 @@
222
208
  ]
223
209
  },
224
210
  "model": {
225
- "description": "Assigned model. Interpreted like Node.js 'requires' logic.",
211
+ "description": "Define the assigned model. Interpreted like Node.js 'requires' logic.",
226
212
  "$ref": "#/$defs/foldersStringArray"
227
213
  },
228
214
  "credentials": {
229
215
  "type": "object",
230
- "description": "Can be explicitly configured here, but will be overruled by VCAP_SERVICES if a matching entry is found therein.",
216
+ "description": "You can explicitly configure credentials, but this is overruled by VCAP_SERVICES if a matching entry is found therein.",
231
217
  "additionalProperties": true,
232
218
  "properties": {
233
219
  "database": {
@@ -238,7 +224,7 @@
238
224
  },
239
225
  "vcap": {
240
226
  "type": "object",
241
- "description": "Can optionally be used to select entry in VCAP_SERVICES.",
227
+ "description": "Optional: Used to select an entry in VCAP_SERVICES.",
242
228
  "additionalProperties": true,
243
229
  "properties": {
244
230
  "name": {
@@ -253,18 +239,18 @@
253
239
  },
254
240
  "multitenancy": {
255
241
  "type": "boolean",
256
- "description": "Shortcut to enable multitenancy"
242
+ "description": "Shortcut to enable multitenancy."
257
243
  },
258
244
  "extensibility": {
259
245
  "type": "boolean",
260
- "description": "Shortcut to enable extensibility"
246
+ "description": "Shortcut to enable extensibility."
261
247
  },
262
248
  "toggles": {
263
249
  "type": "boolean",
264
- "description": "Shortcut to enable feature toggles"
250
+ "description": "Shortcut to enable feature toggles."
265
251
  },
266
252
  "cds.xt.ModelProviderService": {
267
- "description": "Serves model variants, which may include tenant-specific extensions and/or feature-toggled aspects",
253
+ "description": "Configure if/how the ModelProviderService serves model variants that may include tenant-specific extensions and/or feature-toggled aspects.",
268
254
  "oneOf": [
269
255
  {
270
256
  "$ref": "#/$defs/serviceActivation"
@@ -279,7 +265,7 @@
279
265
  "properties": {
280
266
  "root": {
281
267
  "type": "string",
282
- "description": "A directory name, absolute or relative to the package.jsons location, specifying the location to search for models and resources to be served by the model provider services. Default is undefined, for embedded usage of model provider. In case of a sidecar, it refers to the main apps model; usually '../..' during development, and '_main' in production",
268
+ "description": "A directory name, absolute or relative to the package.json's location, specifying the location to search for models and resources to be served by the model provider services. Default is undefined, for embedded usage of model provider. In case of a sidecar, it refers to the main app's model; usually '../..' during development, and '_main' in production.",
283
269
  "format": "uri-reference"
284
270
  }
285
271
  }
@@ -287,7 +273,7 @@
287
273
  ]
288
274
  },
289
275
  "cds.xt.ExtensibilityService": {
290
- "description": "Allows to add and activate tenant-specific extensions at runtime",
276
+ "description": "Configure if/how the ExtensibilityService allows to add and activate tenant-specific extensions at runtime.",
291
277
  "oneOf": [
292
278
  {
293
279
  "$ref": "#/$defs/serviceActivation"
@@ -298,7 +284,7 @@
298
284
  ]
299
285
  },
300
286
  "cds.xt.DeploymentService": {
301
- "description": "Handles subscribe, unsubscribe, and upgrade events for single tenants and single apps / micro-services",
287
+ "description": "Configure if/how the DeploymentService handles subscribe, unsubscribe, and upgrade events for single tenants and single apps/micro-services.",
302
288
  "oneOf": [
303
289
  {
304
290
  "$ref": "#/$defs/serviceActivation"
@@ -309,7 +295,7 @@
309
295
  ]
310
296
  },
311
297
  "cds.xt.SaasProvisioningService": {
312
- "description": "Facade for the DeploymentService to adapt to the API expected by SAP BTP’s SaaS Provisioning Service, hence providing out-of-the-box integration",
298
+ "description": "De-/Activate the facade for the DeploymentService to adapt to the API expected by SAP BTP’s SaaS Provisioning Service, hence providing out-of-the-box integration.",
313
299
  "oneOf": [
314
300
  {
315
301
  "$ref": "#/$defs/serviceActivation"
@@ -385,15 +371,15 @@
385
371
  },
386
372
  {
387
373
  "const": "odata",
388
- "description": "Odata service"
374
+ "description": "OData service"
389
375
  },
390
376
  {
391
377
  "const": "odata-v2",
392
- "description": "Odata service version 2"
378
+ "description": "OData service version 2"
393
379
  },
394
380
  {
395
381
  "const": "odata-v4",
396
- "description": "Odata service version 4"
382
+ "description": "OData service version 4"
397
383
  },
398
384
  {
399
385
  "const": "rest",
@@ -428,18 +414,18 @@
428
414
  },
429
415
  "mockUsers": {
430
416
  "type": "object",
431
- "description": "List of users for local usage",
417
+ "description": "List of users for local usage.",
432
418
  "properties": {
433
419
  "*": {
434
420
  "default": true,
435
421
  "oneOf": [
436
422
  {
437
423
  "const": true,
438
- "description": "Allow other users than the ones specified"
424
+ "description": "Allow other users than the ones specified."
439
425
  },
440
426
  {
441
427
  "const": false,
442
- "description": "Block other users than the ones specified"
428
+ "description": "Block other users than the ones specified."
443
429
  }
444
430
  ]
445
431
  }
@@ -447,11 +433,11 @@
447
433
  "patternProperties": {
448
434
  ".+": {
449
435
  "type": "object",
450
- "additionalProperties": false,
436
+ "additionalProperties": true,
451
437
  "properties": {
452
438
  "roles": {
453
439
  "type": "array",
454
- "description": "Roles of the user",
440
+ "description": "Roles of the user.",
455
441
  "uniqueItems": true,
456
442
  "items": {
457
443
  "type": "string"
@@ -459,7 +445,7 @@
459
445
  },
460
446
  "features": {
461
447
  "type": "array",
462
- "description": "Feature toggle values of the user",
448
+ "description": "Feature toggle values of the user.",
463
449
  "uniqueItems": true,
464
450
  "items": {
465
451
  "type": "string"
@@ -467,11 +453,11 @@
467
453
  },
468
454
  "tenant": {
469
455
  "type": "string",
470
- "description": "SaaS tenant of the user"
456
+ "description": "SaaS tenant of the user."
471
457
  },
472
- "userAttributes": {
458
+ "attr": {
473
459
  "type": "object",
474
- "description": "Additional user attributes",
460
+ "description": "Additional user attributes.",
475
461
  "patternProperties": {
476
462
  ".+": {
477
463
  "type": "string",
@@ -500,7 +486,7 @@
500
486
  },
501
487
  {
502
488
  "const": "hana-mt",
503
- "description": "Multi-tenant SAP HANA Cloud"
489
+ "description": "Multitenant SAP HANA Cloud"
504
490
  },
505
491
  {
506
492
  "const": "sql",
@@ -508,7 +494,7 @@
508
494
  },
509
495
  {
510
496
  "const": "sql-mt",
511
- "description": "File-based SQLite (development), Multi-tenant SAP HANA Cloud (production)"
497
+ "description": "File-based SQLite (development), Multitenant SAP HANA Cloud (production)"
512
498
  },
513
499
  {
514
500
  "const": "sqlite",
@@ -534,11 +520,11 @@
534
520
  },
535
521
  "serviceActivation": {
536
522
  "type": "boolean",
537
- "description": "Activate or deactivate this service"
523
+ "description": "De-/Activate this service."
538
524
  },
539
525
  "servicePresetSidecar": {
540
526
  "type": "string",
541
- "description": "'in-sidecar' preset provides defaults for usage in sidecars.\n'from-sidecar' preset is a shortcut for '{ kind: rest }'",
527
+ "description": "'in-sidecar' preset provides defaults for usage in sidecars.\n'from-sidecar' preset is a shortcut for '{ kind: rest }'.",
542
528
  "enum": [
543
529
  "in-sidecar",
544
530
  "from-sidecar"
@@ -551,7 +537,7 @@
551
537
  "properties": {
552
538
  "element-prefix": {
553
539
  "type": "array",
554
- "description": "Field names must start with one of these strings",
540
+ "description": "Field names must start with one of these strings.",
555
541
  "uniqueItems": true,
556
542
  "items": {
557
543
  "type": "string"
@@ -559,7 +545,7 @@
559
545
  },
560
546
  "namespace-blocklist": {
561
547
  "type": "array",
562
- "description": "Namespaces must not start with these strings",
548
+ "description": "Namespaces must not start with these strings.",
563
549
  "uniqueItems": true,
564
550
  "items": {
565
551
  "type": "string"
@@ -575,7 +561,7 @@
575
561
  "properties": {
576
562
  "for": {
577
563
  "type": "array",
578
- "description": "Restriction applies to these namespaces",
564
+ "description": "Restriction applies to these namespaces.",
579
565
  "uniqueItems": true,
580
566
  "items": {
581
567
  "type": "string"
@@ -597,7 +583,7 @@
597
583
  },
598
584
  "new-fields": {
599
585
  "type": "integer",
600
- "description": "Number of fields to be added at most",
586
+ "description": "Number of fields to be added at most.",
601
587
  "minimum": 1
602
588
  },
603
589
  "new-entities": {
@@ -611,4 +597,4 @@
611
597
  }
612
598
  }
613
599
  }
614
- }
600
+ }
@@ -1,9 +1,9 @@
1
1
  const cds = require ('..')
2
2
  const {existsSync, readdirSync} = require ('fs')
3
- const {join,dirname,resolve,parse} = require ('path')
3
+ const {join,dirname,resolve,parse,sep} = require ('path')
4
4
 
5
5
  const DEBUG = cds.debug('i18n')
6
-
6
+ const _node_modules = sep + 'node_modules'
7
7
 
8
8
  module.exports = Object.assign (localize, {
9
9
  bundles4, folders4, folder4, bundle4
@@ -172,14 +172,25 @@ function folders4 (model) {
172
172
  function folder4 (loc) {
173
173
  // already cached from a former lookup?
174
174
  if (loc in folder4) return folder4[loc]
175
- // check whether a <loc>/_i18n extists
175
+ // check whether a <loc>/_i18n exists
176
176
  for (let i18n of cds.env.i18n.folders) {
177
177
  const f = join (loc, i18n)
178
178
  if (existsSync(f)) return folder4[loc] = f
179
179
  }
180
- //> no --> search up the folder hierarchy
180
+ //> no --> search up the folder hierarchy up to cds.root, cds.home, or some .../node_modules/<package>
181
181
  let next = dirname(loc)
182
- return folder4[loc] = !next || next === loc ? null : folder4(next)
182
+ if (next.includes(_node_modules)) {
183
+ if (next.endsWith(_node_modules)) return folder4[loc] = null
184
+ } else {
185
+ if (!(
186
+ next.startsWith(cds.root) ||
187
+ next.startsWith(cds.home) ||
188
+ cds.env.i18n.root && next.startsWith(cds.env.i18n.root)
189
+ )) return folder4[loc] = null
190
+ }
191
+ if (!next || next === loc) return folder4[loc] = null
192
+ // console.debug(next)
193
+ return folder4[loc] = folder4(next)
183
194
  }
184
195
 
185
196