@sap/cds 6.0.3 → 6.1.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.
- package/CHANGELOG.md +165 -18
- package/apis/cds.d.ts +11 -7
- package/apis/log.d.ts +46 -0
- package/apis/ql.d.ts +72 -15
- package/bin/build/buildTaskHandler.js +5 -2
- package/bin/build/constants.js +4 -1
- package/bin/build/provider/buildTaskHandlerEdmx.js +11 -39
- package/bin/build/provider/buildTaskHandlerFeatureToggles.js +14 -34
- package/bin/build/provider/buildTaskHandlerInternal.js +56 -4
- package/bin/build/provider/buildTaskProviderInternal.js +22 -14
- package/bin/build/provider/hana/index.js +12 -9
- package/bin/build/provider/java/index.js +18 -8
- package/bin/build/provider/mtx/index.js +7 -4
- package/bin/build/provider/mtx/resourcesTarBuilder.js +60 -35
- package/bin/build/provider/mtx-extension/index.js +57 -0
- package/bin/build/provider/mtx-sidecar/index.js +46 -18
- package/bin/build/provider/nodejs/index.js +34 -13
- package/bin/deploy/to-hana/cfUtil.js +7 -2
- package/bin/deploy/to-hana/hana.js +20 -25
- package/bin/deploy/to-hana/hdiDeployUtil.js +13 -2
- package/bin/serve.js +7 -4
- package/lib/compile/{index.js → cds-compile.js} +0 -0
- package/lib/compile/extend.js +15 -5
- package/lib/compile/minify.js +1 -15
- package/lib/compile/parse.js +1 -1
- package/lib/compile/resolve.js +2 -2
- package/lib/compile/to/srvinfo.js +6 -4
- package/lib/{deploy.js → dbs/cds-deploy.js} +9 -8
- package/lib/env/{index.js → cds-env.js} +1 -17
- package/lib/env/{requires.js → cds-requires.js} +24 -3
- package/lib/env/defaults.js +7 -1
- package/lib/env/schemas/cds-package.json +11 -0
- package/lib/env/schemas/cds-rc.json +614 -0
- package/lib/index.js +19 -16
- package/lib/log/{errors.js → cds-error.js} +1 -1
- package/lib/log/{index.js → cds-log.js} +0 -0
- package/lib/ql/Query.js +9 -3
- package/lib/ql/SELECT.js +2 -2
- package/lib/ql/{index.js → cds-ql.js} +0 -9
- package/lib/req/context.js +49 -17
- package/lib/req/locale.js +5 -1
- package/lib/{serve → srv}/adapters.js +23 -19
- package/lib/{connect → srv}/bindings.js +0 -0
- package/lib/{connect/index.js → srv/cds-connect.js} +1 -1
- package/lib/{serve/index.js → srv/cds-serve.js} +1 -1
- package/lib/{serve → srv}/factory.js +1 -1
- package/lib/{serve/Service-api.js → srv/srv-api.js} +22 -6
- package/lib/{serve/Service-dispatch.js → srv/srv-dispatch.js} +13 -8
- package/lib/{serve/Service-handlers.js → srv/srv-handlers.js} +10 -0
- package/lib/{serve/Service-methods.js → srv/srv-methods.js} +10 -8
- package/lib/srv/srv-models.js +207 -0
- package/lib/{serve/Transaction.js → srv/srv-tx.js} +57 -40
- package/lib/utils/{tests.js → cds-test.js} +2 -2
- package/lib/utils/cds-utils.js +146 -0
- package/lib/utils/index.js +2 -145
- package/lib/utils/jest.js +43 -0
- package/lib/utils/resources/index.js +15 -25
- package/lib/utils/resources/tar.js +18 -41
- package/libx/_runtime/auth/index.js +14 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +7 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/delete.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +6 -19
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +1 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +0 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DeserializerFactory.js +3 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +38 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +1 -3
- package/libx/_runtime/cds-services/services/utils/differ.js +4 -0
- package/libx/_runtime/cds-services/util/errors.js +1 -29
- package/libx/_runtime/common/i18n/messages.properties +2 -1
- package/libx/_runtime/common/perf/index.js +10 -15
- package/libx/_runtime/common/utils/binary.js +3 -4
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +0 -1
- package/libx/_runtime/common/utils/entityFromCqn.js +8 -5
- package/libx/_runtime/common/utils/resolveView.js +1 -1
- package/libx/_runtime/common/utils/template.js +1 -1
- package/libx/_runtime/db/Service.js +2 -14
- package/libx/_runtime/db/expand/expandCQNToJoin.js +28 -25
- package/libx/_runtime/db/expand/rawToExpanded.js +7 -6
- package/libx/_runtime/db/generic/input.js +8 -1
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +37 -18
- package/libx/_runtime/extensibility/activate.js +47 -47
- package/libx/_runtime/extensibility/add.js +22 -13
- package/libx/_runtime/extensibility/addExtension.js +17 -13
- package/libx/_runtime/extensibility/defaults.js +25 -30
- package/libx/_runtime/extensibility/handler/transformREAD.js +20 -18
- package/libx/_runtime/extensibility/linter/allowlist_checker.js +373 -0
- package/libx/_runtime/extensibility/linter/annotations_checker.js +113 -0
- package/libx/_runtime/extensibility/linter/checker_base.js +20 -0
- package/libx/_runtime/extensibility/linter/namespace_checker.js +180 -0
- package/libx/_runtime/extensibility/linter.js +32 -0
- package/libx/_runtime/extensibility/push.js +77 -20
- package/libx/_runtime/extensibility/service.js +29 -12
- package/libx/_runtime/extensibility/token.js +56 -0
- package/libx/_runtime/extensibility/utils.js +8 -6
- package/libx/_runtime/extensibility/validation.js +6 -9
- package/libx/_runtime/fiori/generic/new.js +0 -11
- package/libx/_runtime/hana/Service.js +0 -1
- package/libx/_runtime/hana/conversion.js +12 -1
- package/libx/_runtime/hana/customBuilder/CustomFunctionBuilder.js +4 -3
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +5 -0
- package/libx/_runtime/hana/pool.js +6 -10
- package/libx/_runtime/hana/search2Contains.js +0 -5
- package/libx/_runtime/hana/search2cqn4sql.js +1 -0
- package/libx/_runtime/messaging/outbox/utils.js +1 -1
- package/libx/_runtime/messaging/service.js +11 -6
- package/libx/_runtime/remote/utils/data.js +5 -0
- package/libx/_runtime/sqlite/Service.js +7 -6
- package/libx/_runtime/sqlite/execute.js +41 -28
- package/libx/odata/afterburner.js +79 -2
- package/libx/odata/cqn2odata.js +9 -7
- package/libx/odata/grammar.pegjs +157 -76
- package/libx/odata/index.js +9 -3
- package/libx/odata/parser.js +1 -1
- package/libx/odata/utils.js +39 -5
- package/libx/rest/RestAdapter.js +3 -7
- package/libx/rest/middleware/delete.js +4 -5
- package/libx/rest/middleware/parse.js +3 -2
- package/package.json +3 -3
- package/server.js +1 -1
- package/srv/extensibility-service.cds +6 -3
- package/srv/model-provider.cds +3 -1
- package/srv/model-provider.js +84 -104
- package/srv/mtx.js +7 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/Dispatcher.js +0 -240
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "JSON schema for CDS configuration",
|
|
3
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"description": "This is a JSON schema representation for CDS project configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"properties": {
|
|
8
|
+
"folders": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"description": "Set folders if you don't want to use the defaults 'app', 'db', 'srv'.",
|
|
11
|
+
"additionalProperties": true,
|
|
12
|
+
"properties": {
|
|
13
|
+
"app": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"format": "uri-reference",
|
|
16
|
+
"default": "app",
|
|
17
|
+
"description": "Path for app folder."
|
|
18
|
+
},
|
|
19
|
+
"db": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "uri-reference",
|
|
22
|
+
"default": "db",
|
|
23
|
+
"description": "Path for db folder."
|
|
24
|
+
},
|
|
25
|
+
"srv": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"format": "uri-reference",
|
|
28
|
+
"default": "srv",
|
|
29
|
+
"description": "Path for srv folder."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"patternProperties": {
|
|
33
|
+
".+": {
|
|
34
|
+
"description": "A static name identifying this folder."
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"build": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"description": "CDS build settings.",
|
|
41
|
+
"additionalProperties": true,
|
|
42
|
+
"properties": {
|
|
43
|
+
"target": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The folder which contains generated build results. Defaults to 'gen'.",
|
|
46
|
+
"format": "uri-reference",
|
|
47
|
+
"default": "gen"
|
|
48
|
+
},
|
|
49
|
+
"tasks": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"description": "Controls which tasks cds build will execute on your project modules.",
|
|
52
|
+
"uniqueItems": true,
|
|
53
|
+
"items": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": true,
|
|
56
|
+
"properties": {
|
|
57
|
+
"dest": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Destination folder for this build task relative to build target folder.",
|
|
60
|
+
"format": "uri-reference"
|
|
61
|
+
},
|
|
62
|
+
"src": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Source folder for this build task.",
|
|
65
|
+
"format": "uri-reference"
|
|
66
|
+
},
|
|
67
|
+
"for": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Target technology for this build task.",
|
|
70
|
+
"minLength": 1,
|
|
71
|
+
"enum": [
|
|
72
|
+
"nodejs",
|
|
73
|
+
"java",
|
|
74
|
+
"hana",
|
|
75
|
+
"mtx-sidecar",
|
|
76
|
+
"mtx",
|
|
77
|
+
"fiori",
|
|
78
|
+
"node-cf",
|
|
79
|
+
"java-cf"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"options": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"description": "Set target technology specific options for this build task.",
|
|
85
|
+
"additionalProperties": true,
|
|
86
|
+
"properties": {
|
|
87
|
+
"model": {
|
|
88
|
+
"$ref": "#/$defs/foldersStringArray"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"i18n": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"description": "CDS translation settings.",
|
|
100
|
+
"additionalProperties": true,
|
|
101
|
+
"properties": {
|
|
102
|
+
"default_language": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"default": "en"
|
|
105
|
+
},
|
|
106
|
+
"folders": {
|
|
107
|
+
"description": "List of language file folders. First valid entry wins.",
|
|
108
|
+
"default": [
|
|
109
|
+
"_i18n",
|
|
110
|
+
"i18n",
|
|
111
|
+
"assets/i18n"
|
|
112
|
+
],
|
|
113
|
+
"$ref": "#/$defs/foldersStringArray"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"deploy": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"description": "CDS deploy settings.",
|
|
120
|
+
"additionalProperties": true,
|
|
121
|
+
"properties": {
|
|
122
|
+
"no_save": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"description": "Do / don't update config in package.json.",
|
|
125
|
+
"default": true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"extends": {
|
|
130
|
+
"description": "Name of the application that shall be extended",
|
|
131
|
+
"type": "string"
|
|
132
|
+
},
|
|
133
|
+
"requires": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"description": "CDS Dependencies to databases and services can be configured by listing them within a requires section.",
|
|
136
|
+
"additionalProperties": true,
|
|
137
|
+
"properties": {
|
|
138
|
+
"auth": {
|
|
139
|
+
"oneOf": [
|
|
140
|
+
{
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "Auth-specific settings via shortcut.",
|
|
143
|
+
"anyOf": [
|
|
144
|
+
{
|
|
145
|
+
"$ref": "#/$defs/authType"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"minLength": 1
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"type": "object",
|
|
154
|
+
"description": "Authentication settings.",
|
|
155
|
+
"default": {
|
|
156
|
+
"kind": "mocked"
|
|
157
|
+
},
|
|
158
|
+
"additionalProperties": true,
|
|
159
|
+
"properties": {
|
|
160
|
+
"kind": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"description": "Kind of dependency.",
|
|
163
|
+
"anyOf": [
|
|
164
|
+
{
|
|
165
|
+
"$ref": "#/$defs/authType"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"minLength": 1
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"users": {
|
|
173
|
+
"$ref": "#/$defs/mockUsers"
|
|
174
|
+
},
|
|
175
|
+
"credentials": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"description": "Can be explicitly configured here, but will be overruled by VCAP_SERVICES if a matching entry is found therein.",
|
|
178
|
+
"additionalProperties": true,
|
|
179
|
+
"properties": {
|
|
180
|
+
"database": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"format": "uri-reference"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"db": {
|
|
191
|
+
"oneOf": [
|
|
192
|
+
{
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "Database specific settings via shortcut.",
|
|
195
|
+
"anyOf": [
|
|
196
|
+
{
|
|
197
|
+
"$ref": "#/$defs/databaseType"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"minLength": 1
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"type": "object",
|
|
206
|
+
"description": "Database specific settings.",
|
|
207
|
+
"default": {
|
|
208
|
+
"kind": "sqlite"
|
|
209
|
+
},
|
|
210
|
+
"additionalProperties": true,
|
|
211
|
+
"properties": {
|
|
212
|
+
"kind": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "Kind of dependency.",
|
|
215
|
+
"anyOf": [
|
|
216
|
+
{
|
|
217
|
+
"$ref": "#/$defs/databaseType"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"minLength": 1
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"model": {
|
|
225
|
+
"description": "Assigned model. Interpreted like Node.js 'requires' logic.",
|
|
226
|
+
"$ref": "#/$defs/foldersStringArray"
|
|
227
|
+
},
|
|
228
|
+
"credentials": {
|
|
229
|
+
"type": "object",
|
|
230
|
+
"description": "Can be explicitly configured here, but will be overruled by VCAP_SERVICES if a matching entry is found therein.",
|
|
231
|
+
"additionalProperties": true,
|
|
232
|
+
"properties": {
|
|
233
|
+
"database": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"format": "uri-reference"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"vcap": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"description": "Can optionally be used to select entry in VCAP_SERVICES.",
|
|
242
|
+
"additionalProperties": true,
|
|
243
|
+
"properties": {
|
|
244
|
+
"name": {
|
|
245
|
+
"type": "string",
|
|
246
|
+
"minLength": 1
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"multitenancy": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"description": "Shortcut to enable multitenancy"
|
|
257
|
+
},
|
|
258
|
+
"extensibility": {
|
|
259
|
+
"type": "boolean",
|
|
260
|
+
"description": "Shortcut to enable extensibility"
|
|
261
|
+
},
|
|
262
|
+
"toggles": {
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"description": "Shortcut to enable feature toggles"
|
|
265
|
+
},
|
|
266
|
+
"cds.xt.ModelProviderService": {
|
|
267
|
+
"description": "Serves model variants, which may include tenant-specific extensions and/or feature-toggled aspects",
|
|
268
|
+
"oneOf": [
|
|
269
|
+
{
|
|
270
|
+
"$ref": "#/$defs/serviceActivation"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"$ref": "#/$defs/servicePresetSidecar"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"type": "object",
|
|
277
|
+
"description": "Configuration options",
|
|
278
|
+
"additionalProperties": true,
|
|
279
|
+
"properties": {
|
|
280
|
+
"root": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"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
|
+
"format": "uri-reference"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
"cds.xt.ExtensibilityService": {
|
|
290
|
+
"description": "Allows to add and activate tenant-specific extensions at runtime",
|
|
291
|
+
"oneOf": [
|
|
292
|
+
{
|
|
293
|
+
"$ref": "#/$defs/serviceActivation"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"$ref": "#/$defs/extensionRestrictions"
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"cds.xt.DeploymentService": {
|
|
301
|
+
"description": "Handles subscribe, unsubscribe, and upgrade events for single tenants and single apps / micro-services",
|
|
302
|
+
"oneOf": [
|
|
303
|
+
{
|
|
304
|
+
"$ref": "#/$defs/serviceActivation"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"$ref": "#/$defs/servicePresetSidecar"
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
"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",
|
|
313
|
+
"oneOf": [
|
|
314
|
+
{
|
|
315
|
+
"$ref": "#/$defs/serviceActivation"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"patternProperties": {
|
|
321
|
+
".+": {
|
|
322
|
+
"oneOf": [
|
|
323
|
+
{
|
|
324
|
+
"type": "boolean",
|
|
325
|
+
"description": "Add this type with default settings during runtime."
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"type": "string",
|
|
329
|
+
"description": "A shortcut referencing a predefined configuration.",
|
|
330
|
+
"anyOf": [
|
|
331
|
+
{
|
|
332
|
+
"$ref": "#/$defs/authType"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"$ref": "#/$defs/databaseType"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"$ref": "#/$defs/serviceType"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"minLength": 1
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"type": "object",
|
|
347
|
+
"default": {},
|
|
348
|
+
"additionalProperties": true,
|
|
349
|
+
"properties": {
|
|
350
|
+
"kind": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"description": "Kind of dependency.",
|
|
353
|
+
"anyOf": [
|
|
354
|
+
{
|
|
355
|
+
"$ref": "#/$defs/authType"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"$ref": "#/$defs/databaseType"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"$ref": "#/$defs/serviceType"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"minLength": 1
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
},
|
|
368
|
+
"model": {
|
|
369
|
+
"description": "Assigned model. Interpreted like Node.js 'requires' logic.",
|
|
370
|
+
"$ref": "#/$defs/foldersStringArray"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"$defs": {
|
|
380
|
+
"serviceType": {
|
|
381
|
+
"oneOf": [
|
|
382
|
+
{
|
|
383
|
+
"const": "app-service",
|
|
384
|
+
"description": "Standard app service"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"const": "odata",
|
|
388
|
+
"description": "Odata service"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"const": "odata-v2",
|
|
392
|
+
"description": "Odata service version 2"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"const": "odata-v4",
|
|
396
|
+
"description": "Odata service version 4"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"const": "rest",
|
|
400
|
+
"description": "REST service"
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
},
|
|
404
|
+
"authType": {
|
|
405
|
+
"default": "mocked",
|
|
406
|
+
"oneOf": [
|
|
407
|
+
{
|
|
408
|
+
"const": "mocked",
|
|
409
|
+
"description": "Mocked authentication"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"const": "basic",
|
|
413
|
+
"description": "Basic authentication"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"const": "jwt",
|
|
417
|
+
"description": "JWT authentication"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"const": "xsuaa",
|
|
421
|
+
"description": "Authentication using XSUAA"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"const": "dummy",
|
|
425
|
+
"description": "Dummy authentication"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
"mockUsers": {
|
|
430
|
+
"type": "object",
|
|
431
|
+
"description": "List of users for local usage",
|
|
432
|
+
"properties": {
|
|
433
|
+
"*": {
|
|
434
|
+
"default": true,
|
|
435
|
+
"oneOf": [
|
|
436
|
+
{
|
|
437
|
+
"const": true,
|
|
438
|
+
"description": "Allow other users than the ones specified"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"const": false,
|
|
442
|
+
"description": "Block other users than the ones specified"
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"patternProperties": {
|
|
448
|
+
".+": {
|
|
449
|
+
"type": "object",
|
|
450
|
+
"additionalProperties": false,
|
|
451
|
+
"properties": {
|
|
452
|
+
"roles": {
|
|
453
|
+
"type": "array",
|
|
454
|
+
"description": "Roles of the user",
|
|
455
|
+
"uniqueItems": true,
|
|
456
|
+
"items": {
|
|
457
|
+
"type": "string"
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
"features": {
|
|
461
|
+
"type": "array",
|
|
462
|
+
"description": "Feature toggle values of the user",
|
|
463
|
+
"uniqueItems": true,
|
|
464
|
+
"items": {
|
|
465
|
+
"type": "string"
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"tenant": {
|
|
469
|
+
"type": "string",
|
|
470
|
+
"description": "SaaS tenant of the user"
|
|
471
|
+
},
|
|
472
|
+
"userAttributes": {
|
|
473
|
+
"type": "object",
|
|
474
|
+
"description": "Additional user attributes",
|
|
475
|
+
"patternProperties": {
|
|
476
|
+
".+": {
|
|
477
|
+
"type": "string",
|
|
478
|
+
"description": "Attribute value"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
"password": {
|
|
483
|
+
"type": "string",
|
|
484
|
+
"description": "User password"
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
"databaseType": {
|
|
491
|
+
"default": "sqlite",
|
|
492
|
+
"oneOf": [
|
|
493
|
+
{
|
|
494
|
+
"const": "hana",
|
|
495
|
+
"description": "SAP HANA"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"const": "hana-cloud",
|
|
499
|
+
"description": "SAP HANA Cloud"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"const": "hana-mt",
|
|
503
|
+
"description": "Multi-tenant SAP HANA Cloud"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"const": "sql",
|
|
507
|
+
"description": "In-memory SQLite (development), SAP HANA (production)"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"const": "sql-mt",
|
|
511
|
+
"description": "File-based SQLite (development), Multi-tenant SAP HANA Cloud (production)"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"const": "sqlite",
|
|
515
|
+
"description": "File-based SQLite"
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
"foldersStringArray": {
|
|
520
|
+
"oneOf": [
|
|
521
|
+
{
|
|
522
|
+
"type": "string",
|
|
523
|
+
"format": "uri-reference"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"type": "array",
|
|
527
|
+
"uniqueItems": true,
|
|
528
|
+
"items": {
|
|
529
|
+
"type": "string",
|
|
530
|
+
"format": "uri-reference"
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
"serviceActivation": {
|
|
536
|
+
"type": "boolean",
|
|
537
|
+
"description": "Activate or deactivate this service"
|
|
538
|
+
},
|
|
539
|
+
"servicePresetSidecar": {
|
|
540
|
+
"type": "string",
|
|
541
|
+
"description": "'in-sidecar' preset provides defaults for usage in sidecars.\n'from-sidecar' preset is a shortcut for '{ kind: rest }'",
|
|
542
|
+
"enum": [
|
|
543
|
+
"in-sidecar",
|
|
544
|
+
"from-sidecar"
|
|
545
|
+
]
|
|
546
|
+
},
|
|
547
|
+
"extensionRestrictions": {
|
|
548
|
+
"type": "object",
|
|
549
|
+
"description": "Extension restrictions",
|
|
550
|
+
"additionalProperties": false,
|
|
551
|
+
"properties": {
|
|
552
|
+
"element-prefix": {
|
|
553
|
+
"type": "array",
|
|
554
|
+
"description": "Field names must start with one of these strings",
|
|
555
|
+
"uniqueItems": true,
|
|
556
|
+
"items": {
|
|
557
|
+
"type": "string"
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
"namespace-blocklist": {
|
|
561
|
+
"type": "array",
|
|
562
|
+
"description": "Namespaces must not start with these strings",
|
|
563
|
+
"uniqueItems": true,
|
|
564
|
+
"items": {
|
|
565
|
+
"type": "string"
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
"extension-allowlist": {
|
|
569
|
+
"type": "array",
|
|
570
|
+
"description": "Restrictions for model entities, types, etc.",
|
|
571
|
+
"uniqueItems": true,
|
|
572
|
+
"items": {
|
|
573
|
+
"type": "object",
|
|
574
|
+
"additionalProperties": false,
|
|
575
|
+
"properties": {
|
|
576
|
+
"for": {
|
|
577
|
+
"type": "array",
|
|
578
|
+
"description": "Restriction applies to these namespaces",
|
|
579
|
+
"uniqueItems": true,
|
|
580
|
+
"items": {
|
|
581
|
+
"type": "string"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
"kind": {
|
|
585
|
+
"type": "string",
|
|
586
|
+
"description": "Type of definition",
|
|
587
|
+
"default": "entity",
|
|
588
|
+
"enum": [
|
|
589
|
+
"action",
|
|
590
|
+
"annotation",
|
|
591
|
+
"context",
|
|
592
|
+
"entity",
|
|
593
|
+
"function",
|
|
594
|
+
"service",
|
|
595
|
+
"type"
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
"new-fields": {
|
|
599
|
+
"type": "integer",
|
|
600
|
+
"description": "Number of fields to be added at most",
|
|
601
|
+
"minimum": 1
|
|
602
|
+
},
|
|
603
|
+
"new-entities": {
|
|
604
|
+
"type": "integer",
|
|
605
|
+
"description": "Number of entities to be added at most",
|
|
606
|
+
"minimum": 1
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const facade = class cds extends require('events') {
|
|
4
4
|
|
|
5
|
-
get env() { return super.env = require('./env').for('cds',cds.root) }
|
|
6
|
-
get requires() { return super.requires = this.env.
|
|
5
|
+
get env() { return super.env = require('./env/cds-env').for('cds',cds.root) }
|
|
6
|
+
get requires() { return super.requires = this.env.requires._resolved() }
|
|
7
7
|
get version() { return super.version = require('../package.json').version }
|
|
8
8
|
get builtin() { return super.builtin = require('./core') }
|
|
9
9
|
get service() { return super.service = extend(this.builtin.classes.service) .with (_service) }
|
|
@@ -25,9 +25,9 @@ const _service = lazified ({ // nested facade for service-related modules
|
|
|
25
25
|
/** @param x {(this:Service, srv:Service, ...etc) => any} */ impl: x=>x,
|
|
26
26
|
/** @type {{ [path:string] : Service }} */ paths: {},
|
|
27
27
|
/** @type Service[] */ providers: [],
|
|
28
|
-
factory: require ('./
|
|
29
|
-
adapters: require ('./
|
|
30
|
-
bindings: require ('./
|
|
28
|
+
factory: require ('./srv/factory'),
|
|
29
|
+
adapters: require ('./srv/adapters'),
|
|
30
|
+
bindings: require ('./srv/bindings'),
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
/** cds is the central facade to all cds functions */
|
|
@@ -50,30 +50,30 @@ const cds = module.exports = extend (new facade) .with ({
|
|
|
50
50
|
// Loading and Compiling Models
|
|
51
51
|
model: undefined,
|
|
52
52
|
compiler: require ('./compile/cdsc'),
|
|
53
|
-
compile: require ('./compile'),
|
|
53
|
+
compile: require ('./compile/cds-compile'),
|
|
54
54
|
resolve: require ('./compile/resolve'),
|
|
55
55
|
load: require ('./compile/load'), get: lazy => cds.load.parsed,
|
|
56
56
|
parse: require ('./compile/parse'),
|
|
57
57
|
minify: require ('./compile/minify'),
|
|
58
58
|
extend: require ('./compile/extend'),
|
|
59
|
-
deploy: require ('./deploy'),
|
|
59
|
+
deploy: require ('./dbs/cds-deploy'),
|
|
60
60
|
|
|
61
61
|
// Providing and Consuming Services
|
|
62
|
+
connect: require ('./srv/cds-connect'),
|
|
63
|
+
serve: require ('./srv/cds-serve'),
|
|
64
|
+
server: require ('../server'),
|
|
62
65
|
services: new class IterableServices {
|
|
63
66
|
*[Symbol.iterator]() {for (let e in this) yield this[e]}
|
|
64
67
|
get _pending(){ let p={}; Object.defineProperty(this,'_pending',{value:p}); return p }
|
|
65
68
|
},
|
|
66
|
-
serve: require ('./serve'),
|
|
67
|
-
server: require ('../server'),
|
|
68
|
-
connect: require ('./connect'),
|
|
69
69
|
|
|
70
70
|
// Core Services API
|
|
71
|
-
Service: require ('./
|
|
71
|
+
Service: require ('./srv/srv-api'),
|
|
72
72
|
EventContext: require ('./req/context'),
|
|
73
73
|
Request: require ('./req/request'),
|
|
74
74
|
Event: require ('./req/event'),
|
|
75
75
|
User: require ('./req/user'),
|
|
76
|
-
ql: require ('./ql'),
|
|
76
|
+
ql: lazy => require ('./ql/cds-ql'),
|
|
77
77
|
tx: (..._) => (cds.db || cds.Service.prototype) .tx (..._),
|
|
78
78
|
/** @type Service */ db: undefined,
|
|
79
79
|
|
|
@@ -87,10 +87,10 @@ const cds = module.exports = extend (new facade) .with ({
|
|
|
87
87
|
|
|
88
88
|
// Helpers
|
|
89
89
|
localize: require ('./i18n/localize'),
|
|
90
|
-
error: require ('./log/
|
|
91
|
-
utils: require ('./utils'),
|
|
92
|
-
test: require ('./utils/
|
|
93
|
-
log: require ('./log'), debug: lazy => cds.log.debug,
|
|
90
|
+
error: require ('./log/cds-error'),
|
|
91
|
+
utils: require ('./utils/cds-utils'),
|
|
92
|
+
test: require ('./utils/cds-test'),
|
|
93
|
+
log: require ('./log/cds-log'), debug: lazy => cds.log.debug,
|
|
94
94
|
exec: require ('../bin/cds'),
|
|
95
95
|
clone: m => JSON.parse (JSON.stringify(m)),
|
|
96
96
|
lazified, lazify,
|
|
@@ -151,3 +151,6 @@ if (process.env.CDS_GLOBAL) // TODO for stakeholder-tests only. Remove after cds
|
|
|
151
151
|
Object.assign(module,{ exports: global.cds || (global.cds = cds)})
|
|
152
152
|
else
|
|
153
153
|
global.cds = cds
|
|
154
|
+
|
|
155
|
+
// install jest util if jest is defined
|
|
156
|
+
if (process.env.CDS_JEST_MEM_FIX && typeof jest !== 'undefined') require('./utils/jest.js')
|