@sap/cds 5.8.4 → 5.9.2
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 +198 -77
- package/app/fiori/preview.js +16 -11
- package/app/fiori/routes.js +15 -8
- package/app/index.js +1 -1
- package/bin/build/buildTaskFactory.js +3 -3
- package/bin/build/buildTaskProviderFactory.js +1 -1
- package/bin/build/constants.js +1 -1
- package/bin/build/provider/buildTaskHandlerEdmx.js +12 -7
- package/bin/build/provider/buildTaskHandlerInternal.js +1 -1
- package/bin/build/provider/buildTaskProviderInternal.js +8 -2
- package/bin/build/provider/hana/2migration.js +27 -24
- package/bin/build/provider/hana/index.js +17 -18
- package/bin/build/provider/hana/migrationtable.js +9 -10
- package/bin/build/provider/java-cf/index.js +4 -5
- package/bin/build/provider/node-cf/index.js +99 -6
- package/bin/cds.js +17 -18
- package/bin/deploy/to-hana/cfUtil.js +16 -19
- package/bin/deploy/to-hana/hana.js +7 -24
- package/bin/deploy/to-hana/hdiDeployUtil.js +8 -4
- package/bin/mtx/in-cds.js +2 -2
- package/bin/serve.js +10 -3
- package/bin/utils/modules.js +7 -0
- package/bin/version.js +56 -3
- package/lib/compile/cdsc.js +7 -2
- package/lib/compile/etc/_localized.js +37 -25
- package/lib/compile/etc/csv.js +8 -8
- package/lib/compile/for/drafts.js +9 -0
- package/lib/compile/for/java.js +16 -0
- package/lib/compile/for/nodejs.js +12 -0
- package/lib/compile/index.js +3 -0
- package/lib/compile/minify.js +16 -2
- package/lib/compile/parse.js +2 -2
- package/lib/compile/resolve.js +35 -18
- package/lib/compile/to/json.js +3 -1
- package/lib/compile/to/sql.js +2 -2
- package/lib/compile/to/srvinfo.js +4 -2
- package/lib/connect/bindings.js +1 -1
- package/lib/connect/index.js +3 -4
- package/lib/core/entities.js +15 -14
- package/lib/core/index.js +39 -36
- package/lib/core/reflect.js +4 -2
- package/lib/deploy.js +114 -127
- package/lib/env/defaults.js +1 -0
- package/lib/env/index.js +165 -165
- package/lib/env/presets.js +1 -0
- package/lib/env/requires.js +121 -50
- package/lib/index.js +2 -0
- package/lib/log/format/kibana.js +2 -2
- package/lib/ql/SELECT.js +10 -0
- package/lib/ql/parse.js +1 -0
- package/lib/req/cds-context.js +4 -1
- package/lib/req/context.js +50 -56
- package/lib/req/event.js +1 -6
- package/lib/req/locale.js +6 -5
- package/lib/req/request.js +2 -0
- package/lib/req/user.js +7 -5
- package/lib/serve/Service-api.js +10 -7
- package/lib/serve/Service-dispatch.js +9 -11
- package/lib/serve/Service-methods.js +30 -41
- package/lib/serve/Transaction.js +10 -7
- package/lib/serve/adapters.js +11 -9
- package/lib/serve/factory.js +14 -9
- package/lib/serve/index.js +28 -15
- package/lib/utils/data.js +1 -1
- package/lib/utils/index.js +27 -30
- package/lib/utils/resources/index.js +101 -0
- package/lib/utils/resources/tar.js +71 -0
- package/lib/utils/resources/utils.js +11 -0
- package/libx/_runtime/audit/Service.js +36 -39
- package/libx/_runtime/audit/generic/personal/access.js +3 -4
- package/libx/_runtime/audit/generic/personal/modification.js +3 -4
- package/libx/_runtime/audit/utils/v2.js +1 -2
- package/libx/_runtime/auth/index.js +126 -84
- package/libx/_runtime/auth/strategies/JWT.js +12 -19
- package/libx/_runtime/auth/strategies/dummy.js +1 -5
- package/libx/_runtime/auth/strategies/dwc.js +11 -9
- package/libx/_runtime/auth/strategies/mock.js +0 -4
- package/libx/_runtime/auth/strategies/{utils/xssec.js → xssecUtils.js} +7 -4
- package/libx/_runtime/auth/strategies/xsuaa.js +12 -19
- package/libx/_runtime/auth/utils.js +22 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/Dispatcher.js +104 -98
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +8 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +1 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/language.js +2 -8
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +4 -29
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +2 -1
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +3 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +4 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +24 -21
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/index.js +8 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/deserializer/DeserializerFactory.js +2 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DispatcherCommand.js +2 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/to.js +1 -12
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +33 -9
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/dispatcherUtils.js +56 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +10 -3
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +9 -11
- package/libx/_runtime/cds-services/adapter/rest/RestRequest.js +6 -3
- package/libx/_runtime/cds-services/adapter/rest/handlers/operation.js +4 -2
- package/libx/_runtime/cds-services/adapter/rest/rest-to-cqn/utils.js +1 -1
- package/libx/_runtime/cds-services/adapter/rest/utils/binary.js +1 -1
- package/libx/_runtime/cds-services/adapter/rest/utils/key-value-utils.js +2 -3
- package/libx/_runtime/cds-services/adapter/rest/utils/parse-url.js +6 -4
- package/libx/_runtime/cds-services/adapter/rest/utils/result.js +1 -0
- package/libx/_runtime/cds-services/adapter/rest/utils/validation-checks.js +8 -5
- package/libx/_runtime/cds-services/services/Service.js +40 -0
- package/libx/_runtime/cds-services/services/utils/columns.js +4 -3
- package/libx/_runtime/cds-services/services/utils/compareJson.js +4 -4
- package/libx/_runtime/cds-services/services/utils/differ.js +3 -3
- package/libx/_runtime/cds-services/services/utils/handlerUtils.js +4 -4
- package/libx/_runtime/cds-services/util/assert.js +20 -14
- package/libx/_runtime/cds.js +9 -1
- package/libx/_runtime/common/aspects/any.js +5 -0
- package/libx/_runtime/common/aspects/entity.js +25 -7
- package/libx/_runtime/common/aspects/utils.js +2 -2
- package/libx/_runtime/common/composition/data.js +6 -0
- package/libx/_runtime/common/composition/insert.js +3 -2
- package/libx/_runtime/common/composition/tree.js +4 -10
- package/libx/_runtime/common/composition/update.js +4 -4
- package/libx/_runtime/common/constants/draft.js +29 -26
- package/libx/_runtime/common/error/constants.js +2 -2
- package/libx/_runtime/common/error/frontend.js +7 -15
- package/libx/_runtime/common/generic/auth/capabilities.js +59 -0
- package/libx/_runtime/common/generic/auth/constants.js +20 -0
- package/libx/_runtime/common/generic/auth/expand.js +54 -0
- package/libx/_runtime/common/generic/auth/index.js +32 -0
- package/libx/_runtime/common/generic/auth/insertOnly.js +15 -0
- package/libx/_runtime/common/generic/auth/readOnly.js +26 -0
- package/libx/_runtime/common/generic/auth/requires.js +34 -0
- package/libx/_runtime/common/generic/auth/restrict.js +298 -0
- package/libx/_runtime/common/generic/auth/restrictions.js +85 -0
- package/libx/_runtime/common/generic/auth/utils.js +213 -0
- package/libx/_runtime/common/generic/crud.js +8 -6
- package/libx/_runtime/common/generic/etag.js +1 -1
- package/libx/_runtime/common/generic/input.js +35 -35
- package/libx/_runtime/common/generic/sorting.js +2 -3
- package/libx/_runtime/common/generic/temporal.js +2 -2
- package/libx/_runtime/common/i18n/messages.properties +1 -1
- package/libx/_runtime/common/toggles/handler.js +21 -0
- package/libx/_runtime/common/utils/copy.js +10 -1
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +111 -35
- package/libx/_runtime/common/utils/csn.js +63 -1
- package/libx/_runtime/common/utils/dollar.js +10 -1
- package/libx/_runtime/common/utils/draft.js +46 -7
- package/libx/_runtime/common/utils/entityFromCqn.js +13 -9
- package/libx/_runtime/common/utils/extensibilityUtils.js +18 -0
- package/libx/_runtime/common/utils/foreignKeyPropagations.js +88 -104
- package/libx/_runtime/common/utils/generateOnCond.js +4 -1
- package/libx/_runtime/common/utils/quotingStyles.js +2 -0
- package/libx/_runtime/common/utils/resolveStructured.js +25 -9
- package/libx/_runtime/common/utils/resolveView.js +4 -1
- package/libx/_runtime/common/utils/rewriteAsterisks.js +3 -16
- package/libx/_runtime/common/utils/structured.js +33 -37
- package/libx/_runtime/common/utils/template.js +17 -8
- package/libx/_runtime/common/utils/templateProcessor.js +28 -28
- package/libx/_runtime/db/data-conversion/post-processing.js +118 -412
- package/libx/_runtime/db/expand/expandCQNToJoin.js +45 -41
- package/libx/_runtime/db/expand/rawToExpanded.js +29 -8
- package/libx/_runtime/db/generic/index.js +1 -3
- package/libx/_runtime/db/generic/input.js +5 -10
- package/libx/_runtime/db/generic/rewrite.js +5 -2
- package/libx/_runtime/db/generic/structured.js +2 -2
- package/libx/_runtime/db/query/delete.js +2 -2
- package/libx/_runtime/db/query/insert.js +1 -1
- package/libx/_runtime/db/query/update.js +9 -14
- package/libx/_runtime/db/sql-builder/CreateBuilder.js +4 -3
- package/libx/_runtime/db/sql-builder/FunctionBuilder.js +8 -8
- package/libx/_runtime/db/sql-builder/InsertBuilder.js +14 -1
- package/libx/_runtime/db/sql-builder/SelectBuilder.js +3 -2
- package/libx/_runtime/db/sql-builder/dataTypes.js +3 -3
- package/libx/_runtime/db/utils/columns.js +3 -3
- package/libx/_runtime/db/utils/normalizeTimeData.js +2 -2
- package/libx/_runtime/db/utils/propagateForeignKeys.js +6 -2
- package/libx/_runtime/extensibility/mps/index.js +5 -0
- package/libx/_runtime/extensibility/mps/service.js +111 -0
- package/libx/_runtime/extensibility/mps/tar.js +42 -0
- package/libx/_runtime/extensibility/mps/utils.js +11 -0
- package/libx/_runtime/{fiori → extensibility}/uiflex/handler/transformREAD.js +0 -0
- package/libx/_runtime/{fiori → extensibility}/uiflex/handler/transformRESULT.js +17 -5
- package/libx/_runtime/{fiori → extensibility}/uiflex/handler/transformWRITE.js +1 -0
- package/libx/_runtime/extensibility/uiflex/index.js +54 -0
- package/libx/_runtime/extensibility/uiflex/service.js +276 -0
- package/libx/_runtime/{fiori → extensibility}/uiflex/utils.js +22 -7
- package/libx/_runtime/fiori/generic/activate.js +2 -2
- package/libx/_runtime/fiori/generic/before.js +4 -4
- package/libx/_runtime/fiori/generic/new.js +3 -3
- package/libx/_runtime/fiori/generic/patch.js +1 -1
- package/libx/_runtime/fiori/generic/read.js +58 -66
- package/libx/_runtime/fiori/generic/readOverDraft.js +74 -16
- package/libx/_runtime/fiori/utils/handler.js +6 -13
- package/libx/_runtime/fiori/utils/where.js +6 -5
- package/libx/_runtime/hana/Service.js +4 -10
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +1 -1
- package/libx/_runtime/hana/driver.js +2 -2
- package/libx/_runtime/hana/execute.js +45 -75
- package/libx/_runtime/hana/pool.js +1 -1
- package/libx/_runtime/hana/streaming.js +2 -1
- package/libx/_runtime/index.js +6 -6
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +5 -21
- package/libx/_runtime/messaging/Outbox.js +2 -2
- package/libx/_runtime/messaging/common-utils/AMQPClient.js +4 -14
- package/libx/_runtime/messaging/common-utils/connections.js +5 -7
- package/libx/_runtime/messaging/common-utils/normalizeIncomingMessage.js +30 -0
- package/libx/_runtime/messaging/enterprise-messaging-shared.js +2 -1
- package/libx/_runtime/messaging/enterprise-messaging-utils/EMManagement.js +36 -30
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +19 -12
- package/libx/_runtime/messaging/enterprise-messaging.js +8 -8
- package/libx/_runtime/messaging/file-based.js +5 -5
- package/libx/_runtime/messaging/message-queuing.js +14 -12
- package/libx/_runtime/messaging/outbox/utils.js +18 -19
- package/libx/_runtime/messaging/redis-messaging.js +91 -0
- package/libx/_runtime/messaging/service.js +8 -6
- package/libx/_runtime/remote/Service.js +44 -8
- package/libx/_runtime/remote/utils/client.js +24 -19
- package/libx/_runtime/remote/utils/data.js +11 -11
- package/libx/_runtime/sqlite/Service.js +6 -9
- package/libx/_runtime/sqlite/customBuilder/CustomFunctionBuilder.js +5 -2
- package/libx/_runtime/types/api.js +10 -2
- package/libx/common/utils/ucsn.js +109 -0
- package/libx/gql/resolvers/crud/update.js +5 -0
- package/libx/gql/resolvers/parse/ast2cqn/columns.js +3 -1
- package/libx/gql/schema/typeDefMap.js +2 -2
- package/libx/odata/afterburner.js +110 -16
- package/libx/odata/cqn2odata.js +24 -27
- package/libx/odata/grammar.pegjs +9 -1
- package/libx/odata/parseToCqn.js +39 -0
- package/libx/odata/parser.js +1 -1
- package/libx/rest/RestAdapter.js +9 -1
- package/libx/rest/middleware/input.js +54 -0
- package/libx/rest/middleware/operation.js +14 -1
- package/libx/rest/middleware/parse.js +11 -7
- package/package.json +2 -2
- package/server.js +34 -19
- package/srv/audit-log.cds +2 -2
- package/srv/flex.cds +8 -2
- package/srv/flex.js +1 -1
- package/srv/mps.cds +23 -0
- package/srv/mps.js +1 -0
- package/libx/_runtime/auth/strategies/utils/uaa.js +0 -21
- package/libx/_runtime/common/generic/auth.js +0 -874
- package/libx/_runtime/common/toggles/alpha.js +0 -43
- package/libx/_runtime/db/generic/arrayed.js +0 -33
- package/libx/_runtime/fiori/uiflex/index.js +0 -35
- package/libx/_runtime/fiori/uiflex/service.js +0 -150
- package/libx/rest/utils/data.js +0 -60
package/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const cds = require('./lib'), { features } = cds.env
|
|
1
2
|
const express = require('express')
|
|
2
|
-
const cds = require('./lib'), { unfold_csn: cds_localized } = cds.compile._localized
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Standard express.js bootstrapping, constructing an express `application`
|
|
@@ -23,9 +23,10 @@ const cds = require('./lib'), { unfold_csn: cds_localized } = cds.compile._local
|
|
|
23
23
|
* @param {express.Handler} options.logger - custom request logger middleware
|
|
24
24
|
* @returns Promise resolving to a Node.js http server as returned by express' `app.listen()`.
|
|
25
25
|
*/
|
|
26
|
-
module.exports = async function cds_server (options
|
|
26
|
+
module.exports = async function cds_server (options) {
|
|
27
27
|
|
|
28
28
|
const _in_prod = process.env.NODE_ENV === 'production'
|
|
29
|
+
const o = cds.options = { ...options, __proto__:defaults }
|
|
29
30
|
|
|
30
31
|
const app = cds.app = o.app || express()
|
|
31
32
|
app.serve = _app_serve //> app.serve allows delegating to sub modules
|
|
@@ -33,39 +34,49 @@ module.exports = async function cds_server (options, o = { ...options, __proto__
|
|
|
33
34
|
|
|
34
35
|
// mount static resources and logger middleware
|
|
35
36
|
if (o.cors) !_in_prod && app.use (o.cors) //> CORS
|
|
36
|
-
if (o.static) app.use (
|
|
37
|
+
if (o.static) app.use (express_static (o.static)) //> defaults to ./app
|
|
37
38
|
if (o.favicon) app.use ('/favicon.ico', o.favicon) //> if none in ./app
|
|
38
39
|
if (o.index) app.get ('/',o.index) //> if none in ./app
|
|
39
40
|
if (o.correlate) app.use (o.correlate) //> request correlation
|
|
40
41
|
if (o.logger) app.use (o.logger) //> basic request logging
|
|
41
42
|
if (o.toggler) app.use (o.toggler) //> feature toggler
|
|
42
43
|
|
|
43
|
-
// give uiflex a chance to plug into everything
|
|
44
|
-
if (cds.requires.extensibility) await require('./libx/_runtime/fiori/uiflex')() // REVISIT: later this should be a ext umbrella service
|
|
45
|
-
|
|
46
44
|
// load specified models or all in project
|
|
47
|
-
const csn = await cds.load(o.from||'*',o) .then (cds.minify)
|
|
48
|
-
cds.model =
|
|
45
|
+
const csn = await cds.load(o.from||'*',o) .then (cds.minify) //> separate csn for _init_db
|
|
46
|
+
cds.model = cds.compile.for.nodejs(csn)
|
|
49
47
|
|
|
50
48
|
// connect to essential framework services if required
|
|
51
|
-
|
|
52
|
-
if (cds.requires.db)
|
|
53
|
-
if (cds.requires.messaging)
|
|
54
|
-
if (cds.requires.multitenancy)
|
|
55
|
-
|
|
56
|
-
// serve graphql
|
|
57
|
-
if (cds.env.features.graphql) serve_graphql(app)
|
|
49
|
+
if (cds.requires.extensibility) await _extensibility() //> has to go first
|
|
50
|
+
if (cds.requires.db) cds.db = await cds.connect.to ('db') .then (_init)
|
|
51
|
+
if (cds.requires.messaging) await cds.connect.to ('messaging')
|
|
52
|
+
if (cds.requires.multitenancy) await _multitenancy()
|
|
53
|
+
if (cds.requires.toggles) await _model_provider()
|
|
58
54
|
|
|
59
55
|
// serve all services declared in models
|
|
60
|
-
|
|
61
|
-
await cds.
|
|
56
|
+
if (features.graphql) serve_graphql(app)
|
|
57
|
+
await cds.serve (o.service,o) .in (app)
|
|
58
|
+
await cds.emit ('served', cds.services) //> hook for listeners
|
|
62
59
|
|
|
63
60
|
// start http server
|
|
64
61
|
const port = (o.port !== undefined) ? o.port : (process.env.PORT || 4004)
|
|
65
62
|
return app.listen (port)
|
|
66
63
|
|
|
64
|
+
// bootstrap in-memory db
|
|
65
|
+
async function _init (db) {
|
|
66
|
+
if (!o.in_memory || cds.requires.multitenancy) return db
|
|
67
|
+
const fts = cds.requires.toggles && cds.resolve (features.folders)
|
|
68
|
+
const m = !fts ? csn : await cds.load([o.from||'*',...fts],o) .then (cds.minify)
|
|
69
|
+
return cds.deploy(m).to(db,o)
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
}
|
|
68
73
|
|
|
74
|
+
// REVISIT: Move these out of here...
|
|
75
|
+
const _model_provider = () => require('./libx/_runtime/extensibility/mps')
|
|
76
|
+
const _extensibility = () => require('./libx/_runtime/extensibility/uiflex')
|
|
77
|
+
const _multitenancy = () => features.streamlined_mtx ? _model_provider() : cds.mtx.in (cds.app)
|
|
78
|
+
|
|
79
|
+
|
|
69
80
|
|
|
70
81
|
// -------------------------------------------------------------------------
|
|
71
82
|
// Default handlers, which can be overidden by options passed to the server
|
|
@@ -103,8 +114,8 @@ const defaults = {
|
|
|
103
114
|
|
|
104
115
|
// feature toggler
|
|
105
116
|
get toggler() {
|
|
106
|
-
return require('./libx/_runtime/common/toggles/
|
|
107
|
-
}
|
|
117
|
+
return require('./libx/_runtime/common/toggles/handler')(cds)
|
|
118
|
+
}
|
|
108
119
|
}
|
|
109
120
|
|
|
110
121
|
|
|
@@ -153,6 +164,10 @@ function correlate (req, res, next) {
|
|
|
153
164
|
next()
|
|
154
165
|
}
|
|
155
166
|
|
|
167
|
+
function express_static (dir) {
|
|
168
|
+
return express.static (path.resolve (cds.root,dir))
|
|
169
|
+
}
|
|
170
|
+
|
|
156
171
|
|
|
157
172
|
// -------------------------------------------------------------------------
|
|
158
173
|
if (!module.parent) module.exports ({from:process.argv[2]})
|
package/srv/audit-log.cds
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
service AuditLogService {
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// Log read access to sensitive personal data
|
|
4
4
|
event dataAccessLog {
|
|
5
5
|
accesses : array of Access;
|
|
6
6
|
// accessFilters : array of KeyValuePair;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// Log changes to personal data
|
|
10
10
|
event dataModificationLog : {
|
|
11
11
|
modifications : array of DataModification;
|
|
12
12
|
};
|
package/srv/flex.cds
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
namespace cds_r; //> cds system tables
|
|
2
2
|
|
|
3
|
+
type JSON: String;
|
|
4
|
+
|
|
5
|
+
@protocol: 'rest'
|
|
3
6
|
service ExtensibilityService @(path:'/-/cds/extensibility') {
|
|
4
7
|
action addExtension(extensions : array of String); // TODO: change to array of CSN extensions
|
|
8
|
+
action activate(tenant: String);
|
|
9
|
+
action activateProject(tenant: String, extension: array of { filename: String; model: JSON }, undeployExtension: Boolean);
|
|
5
10
|
}
|
|
6
11
|
|
|
7
12
|
entity Extensions {
|
|
8
|
-
key ID
|
|
9
|
-
csn
|
|
13
|
+
key ID : UUID;
|
|
14
|
+
csn : String;
|
|
15
|
+
activated : Boolean; // <-- status / enum ?
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
// @open type Extension {
|
package/srv/flex.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('../libx/_runtime/
|
|
1
|
+
module.exports = require('../libx/_runtime/extensibility/uiflex/service')
|
package/srv/mps.cds
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
namespace cds_r; //> cds system tables
|
|
2
|
+
|
|
3
|
+
type TenantID : String;
|
|
4
|
+
@open type CSN {};
|
|
5
|
+
type XML : String;
|
|
6
|
+
type Locale : String;
|
|
7
|
+
type TAR : LargeBinary;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Used by CAP runtimes to retrieve tenant-specific variants of
|
|
11
|
+
* deployed models used to serve requests.
|
|
12
|
+
*/
|
|
13
|
+
@(requires : [
|
|
14
|
+
'mtcallback'
|
|
15
|
+
])
|
|
16
|
+
@protocol: 'rest'
|
|
17
|
+
service ModelProviderService @(path:'/-/cds/model-provider') {
|
|
18
|
+
action isExtended(tenant : TenantID) returns Boolean;
|
|
19
|
+
action getCsn(tenant : TenantID, toggles : array of String, flavor: String enum { nodejs; java; }) returns CSN;
|
|
20
|
+
action getOdataCsn(tenant : TenantID, toggles : array of String) returns CSN; // REVISIT: Replace by getCsn(..., flavor=node/java)
|
|
21
|
+
action getEdmx(tenant : TenantID, toggles : array of String, serviceName : String, locale : Locale, odataFlavor : String) returns XML;
|
|
22
|
+
action getResources(flat : Boolean) returns TAR;
|
|
23
|
+
}
|
package/srv/mps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../libx/_runtime/extensibility/mps/service')
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const cds = require('../../../cds')
|
|
2
|
-
|
|
3
|
-
const getCredentials = uaa => {
|
|
4
|
-
uaa =
|
|
5
|
-
uaa && uaa.credentials
|
|
6
|
-
? uaa
|
|
7
|
-
: cds.env.requires.uaa && cds.env.requires.uaa.credentials
|
|
8
|
-
? cds.env.requires.uaa
|
|
9
|
-
: cds.env.requires.xsuaa && cds.env.requires.xsuaa.credentials
|
|
10
|
-
? cds.env.requires.xsuaa
|
|
11
|
-
: {}
|
|
12
|
-
|
|
13
|
-
if (!uaa.credentials)
|
|
14
|
-
throw Object.assign(new Error('No or malformed uaa credentials'), { credentials: uaa.credentials })
|
|
15
|
-
|
|
16
|
-
return uaa.credentials
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
getCredentials
|
|
21
|
-
}
|