@sap/cds 5.6.4 → 5.7.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 +102 -0
- package/_i18n/i18n_fr.properties +4 -4
- package/apis/cds.d.ts +7 -10
- package/apis/connect.d.ts +3 -3
- package/apis/core.d.ts +2 -4
- package/apis/models.d.ts +2 -3
- package/apis/ql.d.ts +0 -1
- package/apis/services.d.ts +3 -3
- package/bin/build/buildTaskFactory.js +16 -10
- package/bin/build/buildTaskProviderFactory.js +3 -3
- package/bin/build/constants.js +2 -1
- package/bin/build/provider/buildTaskProviderInternal.js +14 -14
- package/bin/build/provider/hana/2migration.js +2 -3
- package/bin/build/provider/hana/index.js +34 -0
- package/bin/build/provider/hana/migrationtable.js +90 -22
- package/bin/build/provider/hana/template/undeploy.json +5 -0
- package/bin/build/provider/node-cf/index.js +9 -2
- package/bin/serve.js +16 -18
- package/lib/compile/cdsc.js +15 -5
- package/lib/compile/etc/_localized.js +4 -4
- package/lib/compile/extend.js +8 -0
- package/lib/compile/index.js +3 -1
- package/lib/compile/minify.js +61 -0
- package/lib/compile/resolve.js +4 -1
- package/lib/compile/to/gql.js +9 -0
- package/lib/compile/to/sql.js +26 -30
- package/lib/connect/index.js +1 -1
- package/lib/core/entities.js +0 -3
- package/lib/core/infer.js +1 -0
- package/lib/core/reflect.js +0 -34
- package/lib/deploy.js +25 -17
- package/lib/env/defaults.js +3 -1
- package/lib/env/index.js +8 -3
- package/lib/env/presets.js +38 -0
- package/lib/env/requires.js +16 -11
- package/lib/index.js +13 -11
- package/lib/log/format/kibana.js +3 -1
- package/lib/log/index.js +2 -2
- package/lib/req/cds-context.js +79 -0
- package/lib/req/context.js +5 -77
- package/lib/req/request.js +1 -1
- package/lib/serve/Service-api.js +8 -4
- package/lib/serve/Service-dispatch.js +0 -7
- package/lib/serve/Service-methods.js +6 -8
- package/lib/serve/Transaction.js +35 -30
- package/lib/serve/adapters.js +1 -4
- package/lib/utils/axios.js +1 -1
- package/libx/_runtime/audit/Service.js +44 -20
- package/libx/_runtime/audit/generic/personal/access.js +16 -11
- package/libx/_runtime/audit/generic/personal/modification.js +5 -5
- package/libx/_runtime/audit/generic/personal/utils.js +46 -37
- package/libx/_runtime/{common/auth → auth}/index.js +21 -7
- package/libx/_runtime/{common/auth → auth}/strategies/JWT.js +2 -2
- package/libx/_runtime/{common/auth → auth}/strategies/basic.js +2 -2
- package/libx/_runtime/{common/auth → auth}/strategies/dummy.js +1 -1
- package/libx/_runtime/{common/auth → auth}/strategies/mock.js +2 -2
- package/libx/_runtime/{common/auth → auth}/strategies/utils/uaa.js +1 -1
- package/libx/_runtime/{common/auth → auth}/strategies/utils/xssec.js +0 -0
- package/libx/_runtime/{common/auth → auth}/strategies/xsuaa.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/Dispatcher.js +7 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +0 -8
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +3 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +6 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/delete.js +3 -4
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +2 -11
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +16 -6
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +26 -65
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +3 -66
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +24 -0
- package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +2 -2
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriParser.js +13 -10
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/ConditionalRequestControlCommand.js +0 -7
- package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/validator/ConditionalRequestValidator.js +0 -8
- package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +54 -76
- package/libx/_runtime/cds-services/adapter/rest/RestRequest.js +0 -7
- package/libx/_runtime/cds-services/adapter/rest/handlers/create.js +3 -6
- package/libx/_runtime/cds-services/adapter/rest/handlers/delete.js +3 -6
- package/libx/_runtime/cds-services/adapter/rest/handlers/operation.js +3 -6
- package/libx/_runtime/cds-services/adapter/rest/handlers/read.js +3 -6
- package/libx/_runtime/cds-services/adapter/rest/handlers/update.js +3 -6
- package/libx/_runtime/cds-services/adapter/rest/utils/parse-url.js +8 -4
- package/libx/_runtime/cds-services/services/Service.js +0 -6
- package/libx/_runtime/cds-services/services/utils/columns.js +10 -3
- package/libx/_runtime/cds-services/services/utils/compareJson.js +3 -6
- package/libx/_runtime/cds-services/services/utils/differ.js +4 -1
- package/libx/_runtime/cds-services/services/utils/handlerUtils.js +1 -41
- package/libx/_runtime/cds-services/util/assert.js +1 -262
- package/libx/_runtime/cds.js +6 -9
- package/libx/_runtime/common/aspects/entity.js +1 -1
- package/libx/_runtime/common/composition/delete.js +4 -2
- package/libx/_runtime/common/composition/update.js +22 -38
- package/libx/_runtime/common/composition/utils.js +3 -7
- package/libx/_runtime/common/error/standardError.js +11 -0
- package/libx/_runtime/common/generic/auth.js +61 -30
- package/libx/_runtime/common/generic/crud.js +11 -23
- package/libx/_runtime/common/generic/input.js +20 -0
- package/libx/_runtime/common/generic/put.js +4 -10
- package/libx/_runtime/common/generic/sorting.js +12 -30
- package/libx/_runtime/common/perf/index.js +24 -0
- package/libx/_runtime/common/utils/cqn.js +58 -1
- package/libx/_runtime/common/utils/cqn2cqn4sql.js +289 -114
- package/libx/_runtime/common/utils/csn.js +38 -56
- package/libx/_runtime/common/utils/entityFromCqn.js +6 -6
- package/libx/_runtime/common/utils/resolveView.js +4 -5
- package/libx/_runtime/common/utils/rewriteAsterisks.js +46 -5
- package/libx/_runtime/common/utils/search2cqn4sql.js +21 -9
- package/libx/_runtime/common/utils/structured.js +35 -25
- package/libx/_runtime/db/Service.js +0 -6
- package/libx/_runtime/db/expand/expand-v2.js +130 -0
- package/libx/_runtime/db/expand/expandCQNToJoin.js +38 -52
- package/libx/_runtime/db/expand/index.js +3 -1
- package/libx/_runtime/db/generic/input.js +52 -10
- package/libx/_runtime/db/generic/integrity.js +367 -26
- package/libx/_runtime/db/generic/virtual.js +51 -13
- package/libx/_runtime/db/query/update.js +9 -3
- package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +8 -9
- package/libx/_runtime/{common → db}/utils/propagateForeignKeys.js +11 -14
- package/libx/_runtime/fiori/generic/activate.js +1 -0
- package/libx/_runtime/fiori/generic/before.js +2 -1
- package/libx/_runtime/fiori/generic/edit.js +1 -0
- package/libx/_runtime/fiori/generic/patch.js +1 -1
- package/libx/_runtime/fiori/generic/read.js +123 -57
- package/libx/_runtime/fiori/uiflex/index.js +1 -1
- package/libx/_runtime/fiori/uiflex/{extensibility/index.js → service.js} +3 -3
- package/libx/_runtime/fiori/utils/delete.js +7 -1
- package/libx/_runtime/hana/Service.js +1 -8
- package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +5 -14
- package/libx/_runtime/hana/execute.js +10 -4
- package/libx/_runtime/hana/pool.js +55 -45
- package/libx/_runtime/hana/search.js +7 -6
- package/libx/_runtime/hana/search2cqn4sql.js +8 -5
- package/libx/_runtime/hana/searchToContains.js +3 -1
- package/libx/_runtime/index.js +5 -5
- package/libx/_runtime/messaging/AMQPWebhookMessaging.js +3 -3
- package/libx/_runtime/messaging/Outbox.js +53 -0
- package/libx/_runtime/messaging/common-utils/AMQPClient.js +17 -10
- package/libx/_runtime/messaging/common-utils/connections.js +14 -9
- package/libx/_runtime/messaging/common-utils/waitingTime.js +2 -0
- package/libx/_runtime/messaging/enterprise-messaging-shared.js +2 -3
- package/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +2 -2
- package/libx/_runtime/messaging/enterprise-messaging.js +21 -15
- package/libx/_runtime/messaging/file-based.js +5 -5
- package/libx/_runtime/messaging/message-queuing.js +2 -3
- package/libx/_runtime/messaging/outbox/OutboxRunner.js +75 -0
- package/libx/_runtime/messaging/outbox/utils.js +192 -0
- package/libx/_runtime/messaging/service.js +16 -30
- package/libx/_runtime/remote/Service.js +15 -0
- package/libx/_runtime/remote/utils/client.js +15 -3
- package/libx/_runtime/remote/utils/{dataConversion.js → data.js} +12 -2
- package/libx/_runtime/sqlite/Service.js +7 -10
- package/libx/_runtime/sqlite/customBuilder/CustomExpressionBuilder.js +19 -0
- package/libx/_runtime/sqlite/execute.js +18 -12
- package/libx/_runtime/types/api.js +2 -1
- package/libx/odata/{odata2cqn/afterburner.js → afterburner.js} +19 -15
- package/libx/odata/{cqn2odata/index.js → cqn2odata.js} +1 -1
- package/libx/odata/{odata2cqn/grammar.pegjs → grammar.pegjs} +171 -130
- package/libx/odata/index.js +16 -14
- package/libx/odata/parser.js +1 -0
- package/libx/odata/utils.js +57 -0
- package/libx/rest/RestAdapter.js +2 -6
- package/libx/rest/utils/data.js +1 -6
- package/package.json +4 -3
- package/server.js +4 -5
- package/srv/audit-log.cds +87 -0
- package/{libx/_runtime/fiori/uiflex/extensibility/index.cds → srv/flex.cds} +0 -0
- package/srv/flex.js +1 -0
- package/srv/outbox.cds +11 -0
- package/srv/outbox.js +0 -0
- package/libx/_runtime/cds-services/adapter/perf/performance.js +0 -104
- package/libx/_runtime/cds-services/adapter/perf/performanceMeasurement.js +0 -33
- package/libx/odata/odata2cqn/index.js +0 -3
- package/libx/odata/odata2cqn/parser.js +0 -1
- package/libx/odata/readme.md +0 -1
- package/libx/odata/utils/index.js +0 -64
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const getSafeNumber = str => {
|
|
2
|
+
const n = Number(str)
|
|
3
|
+
return Number.isSafeInteger(n) || String(n) === str ? n : str
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
7
|
+
const _PT = ([hh, mm, ss]) => `PT${hh}H${mm}M${ss}S`
|
|
8
|
+
const _isTimestamp = val =>
|
|
9
|
+
/^\d+-\d\d-\d\d(T\d\d:\d\d(:\d\d(\.\d+)?)?(Z|([+-]{1}\d\d:\d\d))?)?$/.test(val) && !isNaN(Date.parse(val))
|
|
10
|
+
|
|
11
|
+
const formatVal = (val, element, csnTarget, kind) => {
|
|
12
|
+
if (val === null || val === 'null') return 'null'
|
|
13
|
+
if (typeof val === 'boolean') return val
|
|
14
|
+
if (typeof val === 'number') return getSafeNumber(val)
|
|
15
|
+
if (!csnTarget && typeof val === 'string' && UUID.test(val)) return kind === 'odata-v2' ? `guid'${val}'` : val
|
|
16
|
+
const { type } = (csnTarget && csnTarget.elements && csnTarget.elements[element]) || { type: undefined }
|
|
17
|
+
|
|
18
|
+
if (kind === 'odata-v2') {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case 'cds.Binary':
|
|
21
|
+
case 'cds.LargeBinary':
|
|
22
|
+
return `binary'${val}'`
|
|
23
|
+
case 'cds.Date':
|
|
24
|
+
return `datetime'${val}T00:00:00'`
|
|
25
|
+
case 'cds.DateTime':
|
|
26
|
+
return `datetime'${val}'`
|
|
27
|
+
case 'cds.Time':
|
|
28
|
+
return `time'${_PT(val.split(':'))}'`
|
|
29
|
+
case 'cds.Timestamp':
|
|
30
|
+
return `datetimeoffset'${val}'`
|
|
31
|
+
case 'cds.UUID':
|
|
32
|
+
return `guid'${val}'`
|
|
33
|
+
default:
|
|
34
|
+
return `'${val}'`
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
switch (type) {
|
|
38
|
+
case 'cds.Decimal':
|
|
39
|
+
case 'cds.Integer64':
|
|
40
|
+
return getSafeNumber(val)
|
|
41
|
+
case 'cds.Boolean':
|
|
42
|
+
case 'cds.DateTime':
|
|
43
|
+
case 'cds.Date':
|
|
44
|
+
case 'cds.Timestamp':
|
|
45
|
+
case 'cds.Time':
|
|
46
|
+
case 'cds.UUID':
|
|
47
|
+
return val
|
|
48
|
+
default:
|
|
49
|
+
return _isTimestamp(val) ? val : `'${val}'` // Why are we checking strings for timestamps? --> expensive
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
getSafeNumber,
|
|
56
|
+
formatVal
|
|
57
|
+
}
|
package/libx/rest/RestAdapter.js
CHANGED
|
@@ -14,9 +14,6 @@ const operation = require('./middleware/operation')
|
|
|
14
14
|
|
|
15
15
|
const error = require('./middleware/error')
|
|
16
16
|
|
|
17
|
-
// REVISIT: _commit_attempted workaround to avoid double rollback leading to release error
|
|
18
|
-
const _commit_attempted = Symbol()
|
|
19
|
-
|
|
20
17
|
class RestAdapter extends express.Router {
|
|
21
18
|
constructor(srv) {
|
|
22
19
|
super()
|
|
@@ -69,7 +66,6 @@ class RestAdapter extends express.Router {
|
|
|
69
66
|
|
|
70
67
|
// unfortunately, express doesn't catch async errors -> try catch needed
|
|
71
68
|
try {
|
|
72
|
-
req._tx[_commit_attempted] = true
|
|
73
69
|
await req._tx.commit(result)
|
|
74
70
|
} catch (e) {
|
|
75
71
|
return next(e)
|
|
@@ -85,8 +81,8 @@ class RestAdapter extends express.Router {
|
|
|
85
81
|
this.use('/', (err, req, res, next) => {
|
|
86
82
|
// request may fail during processing or during commit -> both caught here
|
|
87
83
|
|
|
88
|
-
//
|
|
89
|
-
if (req._tx
|
|
84
|
+
// REVISIT: rollback needed if error occured before commit attempted -> how to distinguish?
|
|
85
|
+
if (req._tx) req._tx.rollback(err).catch(() => {})
|
|
90
86
|
|
|
91
87
|
next(err)
|
|
92
88
|
})
|
package/libx/rest/utils/data.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const cds = require('../../_runtime/cds')
|
|
2
|
-
|
|
3
1
|
const { deepCopyObject } = require('../../_runtime/common/utils/copy')
|
|
4
2
|
const { checkKeys, checkStatic } = require('../../_runtime/cds-services/util/assert')
|
|
5
3
|
const { MULTIPLE_ERRORS } = require('../../_runtime/common/error/constants')
|
|
@@ -29,11 +27,8 @@ const _getDeepCopy = (data, definition, model, validations, skipKeys) => {
|
|
|
29
27
|
for (const k in data) {
|
|
30
28
|
const element = (definition.elements && definition.elements[k]) || (definition.params && definition.params[k])
|
|
31
29
|
if (!element) {
|
|
32
|
-
|
|
33
|
-
if (additional_properties === 'ignore' || !additional_properties) {
|
|
30
|
+
if (!definition['@open']) {
|
|
34
31
|
// ignore input (the default)
|
|
35
|
-
} else if (additional_properties === 'error') {
|
|
36
|
-
validations.push({ message: `Unknown property "${k}"`, code: 400 })
|
|
37
32
|
} else {
|
|
38
33
|
d[k] = data[k] && typeof data[k] === 'object' ? deepCopyObject(data[k]) : data[k]
|
|
39
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.1",
|
|
4
4
|
"description": "SAP Cloud Application Programming Model - CDS for Node.js",
|
|
5
5
|
"homepage": "https://cap.cloud.sap/",
|
|
6
6
|
"keywords": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"lib/",
|
|
20
20
|
"libx/",
|
|
21
21
|
"tasks/",
|
|
22
|
+
"srv/",
|
|
22
23
|
"_i18n/",
|
|
23
24
|
"server.js",
|
|
24
25
|
"common.cds",
|
|
@@ -40,8 +41,8 @@
|
|
|
40
41
|
}
|
|
41
42
|
},
|
|
42
43
|
"lint-staged": {
|
|
43
|
-
"libx/odata/
|
|
44
|
-
"npm run pegjs:odata2cqn && git add libx/odata/
|
|
44
|
+
"libx/odata/grammar.pegjs": [
|
|
45
|
+
"npm run pegjs:odata2cqn && git add libx/odata/parser.js"
|
|
45
46
|
],
|
|
46
47
|
"{libx,tests/_runtime}/**/*.js": [
|
|
47
48
|
"npx prettier --write"
|
package/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const express = require('express')
|
|
2
|
-
const cds = require('./lib')
|
|
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`
|
|
@@ -44,12 +44,11 @@ module.exports = async function cds_server (options, o = { ...options, __proto__
|
|
|
44
44
|
if (cds.requires.extensibility) await require('./libx/_runtime/fiori/uiflex')() // REVISIT: later this should be a ext umbrella service
|
|
45
45
|
|
|
46
46
|
// load specified models or all in project
|
|
47
|
-
const csn = await cds.load
|
|
48
|
-
|
|
49
|
-
cds.model = o.from = cds.linked (cds.compile.for.odata(m))
|
|
47
|
+
const csn = await cds.load(o.from||'*',o) .then (cds.minify)
|
|
48
|
+
cds.model = o.from = cds_localized(cds.linked(cds.compile.for.odata(csn)))
|
|
50
49
|
|
|
51
50
|
// connect to essential framework services if required
|
|
52
|
-
const _init = o.in_memory && (db => cds.deploy(
|
|
51
|
+
const _init = o.in_memory && (db => cds.deploy(csn).to(db,o))
|
|
53
52
|
if (cds.requires.db) cds.db = await cds.connect.to ('db') .then (_init)
|
|
54
53
|
if (cds.requires.messaging) await cds.connect.to ('messaging')
|
|
55
54
|
if (cds.requires.multitenancy) await cds.mtx.in (app)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
service AuditLogService {
|
|
2
|
+
|
|
3
|
+
// SEC-254: Log read access to sensitive personal data
|
|
4
|
+
event dataAccessLog {
|
|
5
|
+
accesses : array of Access;
|
|
6
|
+
// accessFilters : array of KeyValuePair;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// SEC-265: Log changes to personal data
|
|
10
|
+
event dataModificationLog : {
|
|
11
|
+
modifications : array of DataModification;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// config change
|
|
15
|
+
event configChangeLog : {
|
|
16
|
+
action : String @assert.range enum {
|
|
17
|
+
Create;
|
|
18
|
+
Update;
|
|
19
|
+
Delete
|
|
20
|
+
};
|
|
21
|
+
// success : Boolean;
|
|
22
|
+
configurations : array of ConfigChange;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// security message
|
|
26
|
+
event securityLog : {
|
|
27
|
+
action : String;
|
|
28
|
+
data : String;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// types
|
|
34
|
+
|
|
35
|
+
define type KeyValuePair {
|
|
36
|
+
keyName : String;
|
|
37
|
+
value : String;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
define type DataObject {
|
|
41
|
+
type : String;
|
|
42
|
+
id : array of KeyValuePair;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
define type DataSubject {
|
|
46
|
+
type : String;
|
|
47
|
+
id : array of KeyValuePair;
|
|
48
|
+
role : String;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
define type Attribute {
|
|
52
|
+
name : String;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
define type Attachment {
|
|
56
|
+
id : String;
|
|
57
|
+
name : String;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
define type Access {
|
|
61
|
+
dataObject : DataObject;
|
|
62
|
+
dataSubject : DataSubject;
|
|
63
|
+
attributes : array of Attribute;
|
|
64
|
+
attachments : array of Attachment;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
define type ChangedAttribute {
|
|
68
|
+
name : String;
|
|
69
|
+
oldValue : String;
|
|
70
|
+
newValue : String;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
define type DataModification {
|
|
74
|
+
dataObject : DataObject;
|
|
75
|
+
dataSubject : DataSubject;
|
|
76
|
+
action : String @assert.range enum {
|
|
77
|
+
Create;
|
|
78
|
+
Update;
|
|
79
|
+
Delete;
|
|
80
|
+
};
|
|
81
|
+
attributes : array of ChangedAttribute;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
define type ConfigChange {
|
|
85
|
+
dataObject : DataObject;
|
|
86
|
+
attributes : array of ChangedAttribute;
|
|
87
|
+
};
|
|
File without changes
|
package/srv/flex.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../libx/_runtime/fiori/uiflex/service')
|
package/srv/outbox.cds
ADDED
package/srv/outbox.js
ADDED
|
File without changes
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/* istanbul ignore file */
|
|
2
|
-
// REVISIT: remove istanbul ignore once re-enabled
|
|
3
|
-
|
|
4
|
-
const cds = require('../../../cds')
|
|
5
|
-
|
|
6
|
-
const { performance, PerformanceObserver } = require('perf_hooks')
|
|
7
|
-
|
|
8
|
-
const _addDurationToRequest = (req, splitName, duration) => {
|
|
9
|
-
if (splitName[2] === 'Total') {
|
|
10
|
-
req.performanceMeasurement.results.total = duration
|
|
11
|
-
} else if (splitName[splitName.length - 2] === 'SQL') {
|
|
12
|
-
req.performanceMeasurement.results.db += duration
|
|
13
|
-
} else if (splitName[splitName.length - 1] === 'ODataIn') {
|
|
14
|
-
req.performanceMeasurement.results.ODataIn = duration
|
|
15
|
-
} else if (splitName[splitName.length - 1] === 'default') {
|
|
16
|
-
req.performanceMeasurement.results.defaulthandler += duration
|
|
17
|
-
} else if (splitName[splitName.length - 1] === 'custom') {
|
|
18
|
-
req.performanceMeasurement.results.customhandler += duration
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const _clearMeasuresAndMarksOfRequest = req => {
|
|
23
|
-
for (const mark of req.performanceMeasurement.marks) {
|
|
24
|
-
performance.clearMarks(mark)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (performance.clearMeasures) {
|
|
28
|
-
for (const measure of req.performanceMeasurement.measures) {
|
|
29
|
-
performance.clearMeasures(measure)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const _observerCallback = req => items => {
|
|
35
|
-
const entry = items.getEntries()[0]
|
|
36
|
-
const splitName = entry.name.split(' ')
|
|
37
|
-
|
|
38
|
-
if (splitName[0] === req.performanceMeasurement.uuid) {
|
|
39
|
-
if (entry.entryType === 'mark') {
|
|
40
|
-
req.performanceMeasurement.marks.push(entry.name)
|
|
41
|
-
} else if (entry.entryType === 'measure') {
|
|
42
|
-
req.performanceMeasurement.measures.push(entry.name)
|
|
43
|
-
_addDurationToRequest(req, splitName, entry.duration)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const _statisticsRequested = req =>
|
|
49
|
-
(req.query && req.query['sap-statistics'] === 'true') ||
|
|
50
|
-
(req.headers && req.headers['sap-statistics'] === 'true' && (!req.query || !req.query['sap-statistics']))
|
|
51
|
-
|
|
52
|
-
const measurePerformance = (req, res) => {
|
|
53
|
-
if (_statisticsRequested(req)) {
|
|
54
|
-
const uuid = cds.utils.uuid()
|
|
55
|
-
const startMark = `${uuid} Start`
|
|
56
|
-
const endMark = `${uuid} End`
|
|
57
|
-
|
|
58
|
-
req.performanceMeasurement = {
|
|
59
|
-
uuid,
|
|
60
|
-
performance,
|
|
61
|
-
sqlId: 0,
|
|
62
|
-
results: { total: 0.0, db: 0.0, ODataIn: 0.0, defaulthandler: 0.0, customhandler: 0.0 },
|
|
63
|
-
marks: [],
|
|
64
|
-
measures: []
|
|
65
|
-
}
|
|
66
|
-
req.performanceMeasurement.observer = new PerformanceObserver(_observerCallback(req))
|
|
67
|
-
req.performanceMeasurement.observer.observe({ entryTypes: ['measure', 'mark'] })
|
|
68
|
-
|
|
69
|
-
const includeStatusHeader = originalFn =>
|
|
70
|
-
function (...args) {
|
|
71
|
-
if (!res.headersSent) {
|
|
72
|
-
// avoid ERR_HTTP_HEADERS_SENT in case res.write was used before res.end
|
|
73
|
-
performance.mark(endMark)
|
|
74
|
-
performance.measure(`${uuid} 0 Total`, startMark, endMark)
|
|
75
|
-
|
|
76
|
-
_clearMeasuresAndMarksOfRequest(req)
|
|
77
|
-
|
|
78
|
-
req.performanceMeasurement.observer.disconnect()
|
|
79
|
-
|
|
80
|
-
const statusCode = res.statusCode && res.statusCode.toString()
|
|
81
|
-
|
|
82
|
-
if (!statusCode.startsWith('4') && !statusCode.startsWith('5')) {
|
|
83
|
-
const stats = `total=${req.performanceMeasurement.results.total.toFixed(2)}`
|
|
84
|
-
// ,defaulthandler=${req.performanceMeasurement.results.defaulthandler.toFixed(2)}
|
|
85
|
-
// ,customhandler=${req.performanceMeasurement.results.customhandler.toFixed(2)}
|
|
86
|
-
// ,db=${req.performanceMeasurement.results.db.toFixed(2)}`
|
|
87
|
-
res.setHeader('sap-statistics', stats)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
originalFn.call(this, ...args)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// if res.write is used e.g. by odata-server, no headers can be set afterwards
|
|
95
|
-
const originalWrite = res.write
|
|
96
|
-
res.write = includeStatusHeader(originalWrite)
|
|
97
|
-
const originalEnd = res.end
|
|
98
|
-
res.end = includeStatusHeader(originalEnd)
|
|
99
|
-
|
|
100
|
-
performance.mark(startMark)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
module.exports = measurePerformance
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const measurePerformance = require('./performance')
|
|
2
|
-
|
|
3
|
-
let dynatrace
|
|
4
|
-
try {
|
|
5
|
-
const sdk = require('@dynatrace/oneagent-sdk')
|
|
6
|
-
const api = sdk.createInstance()
|
|
7
|
-
dynatrace = {
|
|
8
|
-
sdk,
|
|
9
|
-
api
|
|
10
|
-
}
|
|
11
|
-
} catch (_) {
|
|
12
|
-
// ignore
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const sapStatistics = (req, res, next) => {
|
|
16
|
-
measurePerformance(req, res)
|
|
17
|
-
next()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const useDynatrace = (req, res, next) => {
|
|
21
|
-
req.dynatrace = dynatrace
|
|
22
|
-
next()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const performanceMeasurement = app => {
|
|
26
|
-
app.use(sapStatistics)
|
|
27
|
-
|
|
28
|
-
if (dynatrace) {
|
|
29
|
-
app.use(useDynatrace)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = performanceMeasurement
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function peg$subclass(t,r){function e(){this.constructor=t}e.prototype=r.prototype,t.prototype=new e}function peg$SyntaxError(t,r,e,n){this.message=t,this.expected=r,this.found=e,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,peg$SyntaxError)}function peg$parse(t,r){r=void 0!==r?r:{};var e,n={},s={ODataRelativeURI:Ze},u=Ze,a="/",o=ye("/",!1),c=ye("?",!1),i=ye("&",!1),f="$count",l=ye("$count",!1),h="$ref",p=ye("$ref",!1),A="$value",d=ye("$value",!1),v=ye("=",!1),g="$select=",b=ye("$select=",!1),m="$expand=",x=ye("$expand=",!1),y="$filter=",C=ye("$filter=",!1),$="$orderby=",w=ye("$orderby=",!1),E="$top=",S=ye("$top=",!1),z="$skip=",Z=ye("$skip=",!1),j="$skiptoken=",O=ye("$skiptoken=",!1),B="$search=",k=ye("$search=",!1),R="$count=",F=ye("$count=",!1),T="$apply=",L=ye("$apply=",!1),N=ye("*",!1),_=ye(";",!1),q=function(t){return t?[t]:[]},I=function(t,r){t.push({xpr:r})},D=function(t,r){t.push({val:r})},U=function(t,r,e){t.push(r,...e)},M=function(t,r){t.push(r)},P=function(t,r,e){t.push(r,...e)},J=":",G=ye(":",!1),H="any",K=ye("any",!1),Q="all",V=ye("all",!1),W=ye("asc",!1),X="desc",Y=ye("desc",!1),tt=/^[a-zA-Z]/,rt=Ce([["a","z"],["A","Z"]],!1,!1),et=/^[a-zA-Z0-9\-]/,nt=Ce([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),st=/^[^&]/,ut=Ce(["&"],!0,!1),at=$e("a comparison"),ot=ye("eq",!1),ct=ye("ne",!1),it=ye("lt",!1),ft=ye("gt",!1),lt=ye("le",!1),ht=ye("ge",!1),pt=(ye("add",!1),ye("sub",!1),ye("mul",!1),ye("div",!1),ye("mod",!1),$e("an operand")),At=$e("a reference"),dt=function(t,r){return r},vt=function(t){return{val:t}},gt=ye("{",!1),bt=/^[^}]/,mt=Ce(["}"],!0,!1),xt=ye("}",!1),yt="[",Ct=ye("[",!1),$t="]",wt=ye("]",!1),Et=/^[^\]]/,St=Ce(["]"],!0,!1),zt=$e("a function call"),Zt=/^[a-z]/,jt=Ce([["a","z"]],!1,!1),Ot=function(t,r,e){return e},Bt=$e("a boolean function"),kt="contains",Rt=ye("contains",!1),Ft="endswith",Tt=ye("endswith",!1),Lt="startswith",Nt=ye("startswith",!1),_t=ye("NOT",!0),qt=ye("AND",!0),It=ye("OR",!0),Dt="aggregate",Ut=ye("aggregate",!1),Mt="groupby",Pt=ye("groupby",!1),Jt="filter",Gt=ye("filter",!1),Ht="expand",Kt=ye("expand",!1),Qt="search",Vt=ye("search",!1),Wt="concat",Xt=ye("concat",!1),Yt="compute",tr=ye("compute",!1),rr="bottompercent",er=ye("bottompercent",!1),nr="bottomsum",sr=ye("bottomsum",!1),ur="toppercent",ar=ye("toppercent",!1),or="topsum",cr=ye("topsum",!1),ir="with",fr=ye("with",!1),lr="from",hr=ye("from",!1),pr=ye("as",!1),Ar="rollup",dr=ye("rollup",!1),vr="$all",gr=ye("$all",!1),br="topcount",mr=ye("topcount",!1),xr="bottomcount",yr=ye("bottomcount",!1),Cr="identity",$r=ye("identity",!1),wr="true",Er=ye("true",!1),Sr="false",zr=ye("false",!1),Zr=$e("Edm.String"),jr=ye("'",!1),Or="''",Br=ye("''",!1),kr=/^[^']/,Rr=Ce(["'"],!0,!1),Fr='"',Tr=ye('"',!1),Lr='\\"',Nr=ye('\\"',!1),_r=/^[^"]/,qr=Ce(['"'],!0,!1),Ir=/^[a-zA-Z0-9.+\-]/,Dr=Ce([["a","z"],["A","Z"],["0","9"],".","+","-"],!1,!1),Ur=/^[0-9]/,Mr=Ce([["0","9"]],!1,!1),Pr="-",Jr=ye("-",!1),Gr=ye("T",!1),Hr=ye(".",!1),Kr=ye("Z",!1),Qr=ye("+",!1),Vr=/^[+\-]/,Wr=Ce(["+","-"],!1,!1),Xr=ye("e",!1),Yr=/^[_a-zA-Z]/,te=Ce(["_",["a","z"],["A","Z"]],!1,!1),re=/^[_a-zA-Z0-9"."]/,ee=Ce(["_",["a","z"],["A","Z"],["0","9"],'"',".",'"'],!1,!1),ne=/^[0-9a-zA-Z]/,se=Ce([["0","9"],["a","z"],["A","Z"]],!1,!1),ue=/^[a-zA-Z0-9\-"."_~!$&'()*+,;=:@]/,ae=Ce([["a","z"],["A","Z"],["0","9"],"-",'"',".",'"',"_","~","!","$","&","'","(",")","*","+",",",";","=",":","@"],!1,!1),oe=ye(",",!1),ce=ye("(",!1),ie=ye(")",!1),fe=$e("optional whitespaces"),le=/^[ \t\n]/,he=Ce([" ","\t","\n"],!1,!1),pe=$e("mandatory whitespaces"),Ae=0,de=0,ve=[{line:1,column:1}],ge=0,be=[],me=0;if("startRule"in r){if(!(r.startRule in s))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=s[r.startRule]}function xe(t,r){throw function(t,r){return new peg$SyntaxError(t,null,null,r)}(t,r=void 0!==r?r:Ee(de,Ae))}function ye(t,r){return{type:"literal",text:t,ignoreCase:r}}function Ce(t,r,e){return{type:"class",parts:t,inverted:r,ignoreCase:e}}function $e(t){return{type:"other",description:t}}function we(r){var e,n=ve[r];if(n)return n;for(e=r-1;!ve[e];)e--;for(n={line:(n=ve[e]).line,column:n.column};e<r;)10===t.charCodeAt(e)?(n.line++,n.column=1):n.column++,e++;return ve[r]=n,n}function Ee(t,r){var e=we(t),n=we(r);return{start:{offset:t,line:e.line,column:e.column},end:{offset:r,line:n.line,column:n.column}}}function Se(t){Ae<ge||(Ae>ge&&(ge=Ae,be=[]),be.push(t))}function ze(t,r,e){return new peg$SyntaxError(peg$SyntaxError.buildMessage(t,r),t,r,e)}function Ze(){var r,e,s,u,f,l,h,p,A,d,v,g,b,m;if(r=Ae,47===t.charCodeAt(Ae)?(e=a,Ae++):(e=n,0===me&&Se(o)),e===n&&(e=null),e!==n)if(s=Ae,(u=je())!==n&&(de=s,u=void(On=u)),(s=u)!==n){if(u=Ae,(f=$n())!==n)if(63===t.charCodeAt(Ae)?(l="?",Ae++):(l=n,0===me&&Se(c)),l!==n)if((h=$n())!==n)if((p=Be())!==n){for(A=[],d=Ae,(v=$n())!==n?(38===t.charCodeAt(Ae)?(g="&",Ae++):(g=n,0===me&&Se(i)),g!==n&&(b=$n())!==n&&(m=Be())!==n?d=v=[v,g,b,m]:(Ae=d,d=n)):(Ae=d,d=n);d!==n;)A.push(d),d=Ae,(v=$n())!==n?(38===t.charCodeAt(Ae)?(g="&",Ae++):(g=n,0===me&&Se(i)),g!==n&&(b=$n())!==n&&(m=Be())!==n?d=v=[v,g,b,m]:(Ae=d,d=n)):(Ae=d,d=n);A!==n?u=f=[f,l,h,p,A]:(Ae=u,u=n)}else Ae=u,u=n;else Ae=u,u=n;else Ae=u,u=n;else Ae=u,u=n;u===n&&(u=null),u!==n&&(f=$n())!==n?(de=r,r=e=function(){if(Bn)return On.columns=[{args:[{val:1}],as:"$count",func:"count"}],delete On.expand,delete On.limit,delete On.orderBy,{SELECT:On};if(On.expand){On.columns||(On.columns=["*"]);for(const t of On.expand){const r=On.columns.findIndex(Ln(t));r>-1&&On.columns.splice(r,1),On.columns.push(t)}delete On.expand}return On=Tn(On),{SELECT:On}}()):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;return r}function je(){var r,e,s,u,c,i,v,g;return r=Ae,t.substr(Ae,6)===f?(e=f,Ae+=6):(e=n,0===me&&Se(l)),e!==n&&(de=r,e=void(Bn=!0)),(r=e)===n&&(r=Ae,e=Ae,t.substr(Ae,4)===h?(s=h,Ae+=4):(s=n,0===me&&Se(p)),s===n&&(t.substr(Ae,6)===A?(s=A,Ae+=6):(s=n,0===me&&Se(d))),(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,g=e,e=!kn.includes(g)&&{from:{ref:[g]}}),(r=e)===n&&(r=Ae,(e=bn())===n&&(e=He()),e===n&&(e=null),e!==n?(s=Ae,(u=yn())!==n&&(c=Cn())!==n?s=u=[u,c]:(Ae=s,s=n),s===n&&(s=Ae,(u=yn())!==n&&(c=Oe())!==n&&(i=Cn())!==n?s=u=[u,c,i]:(Ae=s,s=n)),s===n&&(s=null),s!==n?(u=function(){var r,e,s;r=Ae,e=[],ue.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(ae));if(s!==n)for(;s!==n;)e.push(s),ue.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(ae));else e=n;r=e!==n?t.substring(r,Ae):e;return r}(),u===n&&(u=null),u!==n?(c=Ae,47===t.charCodeAt(Ae)?(i=a,Ae++):(i=n,0===me&&Se(o)),i!==n&&(v=je())!==n?(de=c,c=i=v):(Ae=c,c=n),c===n&&(c=null),c!==n?(de=r,r=e=function(t,r,e,n){e&&([t,r,e]=Nn(t,r,e));const s=[r?r.length>2?{id:t,where:r[1].map((t=>t.val&&t.val.match&&t.val.match(/^"(.*)"$/)?{val:t.val.match(/^"(.*)"$/)[1]}:t))}:{id:t,where:[]}:Zn?`${Object.prototype.hasOwnProperty.call(t,"val")?t.val:t}`:t];if(n&&n.from){const t=n.from.ref;Object.prototype.hasOwnProperty.call(t[0],"val")&&(s[s.length-1]={id:s[s.length-1],where:[t.shift()]}),s.push(...t)}const u={from:{ref:s}};return n&&n.columns&&(u.columns=n.columns),u}(e,s,u,c)):(Ae=r,r=n)):(Ae=r,r=n)):(Ae=r,r=n)):(Ae=r,r=n))),r}function Oe(){var r,e,s,u,a,o,c;return r=Ae,(e=He())!==n&&(de=r,e=[e]),(r=e)===n&&(r=Ae,(e=Ge())!==n&&$n()!==n?(61===t.charCodeAt(Ae)?(s="=",Ae++):(s=n,0===me&&Se(v)),s!==n&&$n()!==n?((u=He())===n&&(u=Ae,(a=dn())!==n&&(de=u,a={val:a}),u=a),u!==n?(a=Ae,(o=xn())!==n&&(c=Oe())!==n?a=o=[o,c]:(Ae=a,a=n),a===n&&(a=null),a!==n?(de=r,e=function(t,r,e){const n=[t,"=",r];return e&&n.push("and",...e[1]),n}(e,u,a),r=e):(Ae=r,r=n)):(Ae=r,r=n)):(Ae=r,r=n)):(Ae=r,r=n)),r}function Be(){var r,e,s,u,a,o,c,i;if(r=Ae,t.substr(Ae,8)===g?(e=g,Ae+=8):(e=n,0===me&&Se(b)),e!==n)if((s=$n())!==n)if((u=ke())!==n){for(a=[],o=Ae,(c=xn())!==n&&(i=ke())!==n?o=c=[c,i]:(Ae=o,o=n);o!==n;)a.push(o),o=Ae,(c=xn())!==n&&(i=ke())!==n?o=c=[c,i]:(Ae=o,o=n);a!==n?r=e=[e,s,u,a]:(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;else Ae=r,r=n;if(r===n){if(r=Ae,t.substr(Ae,8)===m?(e=m,Ae+=8):(e=n,0===me&&Se(x)),e!==n)if((s=$n())!==n)if((u=Re())!==n){for(a=[],o=Ae,(c=xn())!==n&&(i=Re())!==n?o=c=[c,i]:(Ae=o,o=n);o!==n;)a.push(o),o=Ae,(c=xn())!==n&&(i=Re())!==n?o=c=[c,i]:(Ae=o,o=n);a!==n?r=e=[e,s,u,a]:(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;else Ae=r,r=n;if(r===n&&(r=Ae,t.substr(Ae,8)===y?(e=y,Ae+=8):(e=n,0===me&&Se(C)),e!==n&&(s=$n())!==n&&(u=Ne())!==n?r=e=[e,s,u]:(Ae=r,r=n),r===n)){if(r=Ae,t.substr(Ae,9)===$?(e=$,Ae+=9):(e=n,0===me&&Se(w)),e!==n)if((s=$n())!==n)if((u=Ue())!==n){for(a=[],o=Ae,(c=xn())!==n&&(i=Ue())!==n?o=c=[c,i]:(Ae=o,o=n);o!==n;)a.push(o),o=Ae,(c=xn())!==n&&(i=Ue())!==n?o=c=[c,i]:(Ae=o,o=n);a!==n?r=e=[e,s,u,a]:(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;else Ae=r,r=n;r===n&&(r=Ae,t.substr(Ae,5)===E?(e=E,Ae+=5):(e=n,0===me&&Se(S)),e!==n&&(s=$n())!==n?(u=function(){var t,r;t=Ae,(r=gn())!==n&&(de=t,e=r,r=void((On.limit||(On.limit={})).rows={val:e}));var e;return t=r}(),u!==n?r=e=[e,s,u]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,6)===z?(e=z,Ae+=6):(e=n,0===me&&Se(Z)),e!==n&&(s=$n())!==n&&(u=Fe())!==n?r=e=[e,s,u]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,11)===j?(e=j,Ae+=11):(e=n,0===me&&Se(O)),e!==n&&(s=$n())!==n&&(u=Fe())!==n?r=e=[e,s,u]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,8)===B?(e=B,Ae+=8):(e=n,0===me&&Se(k)),e!==n&&(s=$n())!==n&&(u=Te())!==n?r=e=[e,s,u]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,7)===R?(e=R,Ae+=7):(e=n,0===me&&Se(F)),e!==n&&(s=$n())!==n?(u=function(){var t,r;t=Ae,(r=pn())!==n&&(de=t,r=void(r&&(On.count=!0)));return t=r}(),u!==n?r=e=[e,s,u]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,7)===T?(e=T,Ae+=7):(e=n,0===me&&Se(L)),e!==n&&(s=$n())!==n&&(u=Me())!==n?r=e=[e,s,u]:(Ae=r,r=n),r===n&&(r=function(){var r,e,s,u,a,o;r=Ae,tt.test(t.charAt(Ae))?(e=t.charAt(Ae),Ae++):(e=n,0===me&&Se(rt));if(e!==n){for(s=[],et.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(nt));u!==n;)s.push(u),et.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(nt));if(s!==n)if(61===t.charCodeAt(Ae)?(u="=",Ae++):(u=n,0===me&&Se(v)),u!==n){for(a=[],st.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(ut));o!==n;)a.push(o),st.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(ut));a!==n?r=e=[e,s,u,a]:(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n}else Ae=r,r=n;return r}())))))))}}return r}function ke(){var r,e,s;return r=Ae,42===t.charCodeAt(Ae)?(e="*",Ae++):(e=n,0===me&&Se(N)),e===n&&(e=Ge()),e!==n&&(de=r,s=e,On.columns=Array.isArray(On.columns)?On.columns:[],On.columns.find(Ln(s))||On.columns.push(s),e=s),r=e}function Re(){var r,e,s,u,a,o,c,i,f,l,h;if(r=Ae,e=Ae,42===t.charCodeAt(Ae)?(s="*",Ae++):(s=n,0===me&&Se(N)),s===n&&(s=Ge()),s!==n&&(de=e,s=function(t){const r="*"===t?{}:t;return r.expand="*",Array.isArray(On.expand)||(On.expand=[]),On.expand.find(Ln(r))||On.expand.push(r),r}(s)),(e=s)!==n){if(s=Ae,u=Ae,(a=yn())!==n&&(de=u,jn.push(On),On=On.expand[On.expand.length-1],a=void(On.expand="*")),(u=a)!==n){for(a=Ae,o=[],c=Ae,(i=$n())!==n?(59===t.charCodeAt(Ae)?(f=";",Ae++):(f=n,0===me&&Se(_)),f===n&&(f=null),f!==n&&(l=$n())!==n&&(h=Be())!==n?c=i=[i,f,l,h]:(Ae=c,c=n)):(Ae=c,c=n);c!==n;)o.push(c),c=Ae,(i=$n())!==n?(59===t.charCodeAt(Ae)?(f=";",Ae++):(f=n,0===me&&Se(_)),f===n&&(f=null),f!==n&&(l=$n())!==n&&(h=Be())!==n?c=i=[i,f,l,h]:(Ae=c,c=n)):(Ae=c,c=n);o!==n&&(de=a,o=function(t){if(On.columns){"*"===On.expand&&(On.expand=[]);for(const t of On.columns)On.expand.find(Ln(t))||On.expand.push(t);delete On.columns}else Array.isArray(On.expand)&&-1===On.expand.indexOf("*")&&On.expand.unshift("*")}()),(a=o)!==n?(o=Ae,(c=Cn())!==n&&(de=o,c=void(On=jn.pop())),(o=c)!==n?s=u=[u,a,o]:(Ae=s,s=n)):(Ae=s,s=n)}else Ae=s,s=n;s===n&&(s=null),s!==n?(u=Ae,(a=xn())!==n&&(o=Re())!==n?u=a=[a,o]:(Ae=u,u=n),u===n&&(u=null),u!==n?r=e=[e,s,u]:(Ae=r,r=n)):(Ae=r,r=n)}else Ae=r,r=n;return r}function Fe(){var t,r,e;return t=Ae,(r=gn())!==n&&(de=t,e=r,On.limit&&On.limit.offset&&On.limit.offset.val&&(e+=On.limit.offset.val),r=void((On.limit||(On.limit={})).offset={val:e})),t=r}function Te(){var t,r,e;return t=Ae,(r=Le())!==n&&(de=t,e=r,r=void(On.search=e)),t=r}function Le(){var r,e,s,u,a,o,c;if(r=Ae,e=Ae,(s=We())===n&&(s=null),s!==n&&(de=e,s=q(s)),(e=s)!==n)if(s=Ae,(u=yn())!==n&&(a=Le())!==n&&(o=Cn())!==n?(de=s,s=u=I(e,a)):(Ae=s,s=n),s===n&&(s=Ae,u=function(){var r,e,s,u,a;r=Ae,34===t.charCodeAt(Ae)?(e=Fr,Ae++):(e=n,0===me&&Se(Tr));if(e!==n){for(s=Ae,u=[],t.substr(Ae,2)===Lr?(a=Lr,Ae+=2):(a=n,0===me&&Se(Nr)),a===n&&(_r.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(qr)));a!==n;)u.push(a),t.substr(Ae,2)===Lr?(a=Lr,Ae+=2):(a=n,0===me&&Se(Nr)),a===n&&(_r.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(qr)));(s=u!==n?t.substring(s,Ae):u)!==n?(34===t.charCodeAt(Ae)?(u=Fr,Ae++):(u=n,0===me&&Se(Tr)),u!==n?(de=r,r=e=s.replace(/\\\\/g,"\\").replace(/\\"/g,'"')):(Ae=r,r=n)):(Ae=r,r=n)}else Ae=r,r=n;return r}(),u!==n&&(de=s,u=D(e,u)),(s=u)===n&&(s=Ae,(u=An())!==n&&(de=s,u=D(e,u)),(s=u)===n&&(s=Ae,(u=dn())!==n&&(de=s,u=D(e,u)),s=u))),s!==n){for(u=[],a=Ae,(o=Xe())===n&&(o=tn())===n&&(o=Ye()),o!==n&&(c=Le())!==n?(de=a,a=o=U(e,o,c)):(Ae=a,a=n);a!==n;)u.push(a),a=Ae,(o=Xe())===n&&(o=tn())===n&&(o=Ye()),o!==n&&(c=Le())!==n?(de=a,a=o=U(e,o,c)):(Ae=a,a=n);u!==n?(de=r,r=e=e):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;return r}function Ne(){var t,r,e;return t=Ae,(r=_e())!==n&&(de=t,e=r,r=void(On.where=e)),t=r}function _e(){var r,e,s,u,a,o,c,i;if(r=Ae,e=Ae,(s=We())===n&&(s=null),s!==n&&(de=e,s=q(s)),(e=s)!==n)if(s=Ae,(u=yn())!==n&&(a=_e())!==n&&(o=Cn())!==n?(de=s,s=u=I(e,a)):(Ae=s,s=n),s===n&&(s=Ae,(u=Pe())!==n&&(de=s,i=u,u=void e.push(...i)),(s=u)===n&&(s=Ae,(u=qe())!==n&&(de=s,u=function(t,r){t.push(...r)}(e,u)),(s=u)===n&&(s=Ae,u=function(){var r,e,s,u;me++,r=Ae,t.substr(Ae,8)===kt?(e=kt,Ae+=8):(e=n,0===me&&Se(Rt));e===n&&(t.substr(Ae,8)===Ft?(e=Ft,Ae+=8):(e=n,0===me&&Se(Tt)),e===n&&(t.substr(Ae,10)===Lt?(e=Lt,Ae+=10):(e=n,0===me&&Se(Nt))));e!==n&&yn()!==n&&(s=Je())!==n&&xn()!==n&&(u=Je())!==n&&Cn()!==n?(de=r,r=e={func:e,args:[s,u]}):(Ae=r,r=n);me--,r===n&&(e=n,0===me&&Se(Bt));return r}(),u!==n&&(de=s,u=function(t,r){t.push(r)}(e,u)),(s=u)===n&&(s=Ae,(u=pn())!==n&&(de=s,u=D(e,u)),s=u)))),s!==n){for(u=[],a=Ae,(o=Xe())===n&&(o=tn()),o!==n&&(c=_e())!==n?(de=a,a=o=U(e,o,c)):(Ae=a,a=n);a!==n;)u.push(a),a=Ae,(o=Xe())===n&&(o=tn()),o!==n&&(c=_e())!==n?(de=a,a=o=U(e,o,c)):(Ae=a,a=n);u!==n?(de=r,r=e=e):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;return r}function qe(){var r,e,s,u,c,i,f;if(r=Ae,e=Ae,(s=bn())!==n&&(de=e,s=[s]),(e=s)!==n)if(47===t.charCodeAt(Ae)?(s=a,Ae++):(s=n,0===me&&Se(o)),s!==n){for(u=[],c=Ae,(i=bn())!==n?(47===t.charCodeAt(Ae)?(f=a,Ae++):(f=n,0===me&&Se(o)),f!==n?(de=c,c=i=M(e,i)):(Ae=c,c=n)):(Ae=c,c=n);c!==n;)u.push(c),c=Ae,(i=bn())!==n?(47===t.charCodeAt(Ae)?(f=a,Ae++):(f=n,0===me&&Se(o)),f!==n?(de=c,c=i=M(e,i)):(Ae=c,c=n)):(Ae=c,c=n);u!==n?(c=Ae,i=function(){var r,e,s;r=Ae,t.substr(Ae,3)===H?(e=H,Ae+=3):(e=n,0===me&&Se(K));e!==n&&yn()!==n?((s=De())===n&&(s=null),s!==n&&Cn()!==n?(de=r,r=e=s):(Ae=r,r=n)):(Ae=r,r=n);return r}(),i!==n&&(de=c,i=function(t,r){let e=t.pop();if(!r)return["exists",{ref:[...t,{id:e}]}];let n=[];for(let t=0,s=0;t<r.length;++t){let u=r[t];u.ref&&0===u.ref.length&&"="===r[t+1]?n[s++]={func:"contains",args:[{ref:e},r[t+=2]]}:n[s++]=u}return n.length<r.length?(e=t.pop(),["exists",{ref:[...t,{id:e,where:n}]}]):["exists",{ref:[...t,{id:e,where:r}]}]}(e,i)),(c=i)===n&&(c=Ae,i=function(){var r,e,s;r=Ae,t.substr(Ae,3)===Q?(e=Q,Ae+=3):(e=n,0===me&&Se(V));e!==n&&yn()!==n&&(s=De())!==n&&Cn()!==n?(de=r,r=e=s):(Ae=r,r=n);return r}(),i!==n&&(de=c,i=function(t,r){let e=t.pop();return["not","exists",{ref:[...t,{id:e,where:["not",{xpr:[...r]}]}]}]}(e,i)),c=i),c!==n?(de=r,r=e=c):(Ae=r,r=n)):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;return r}function Ie(){var t,r,e,s,u,a,o,c,i;if(t=Ae,r=Ae,(e=We())===n&&(e=null),e!==n&&(de=r,e=(c=e)?[c]:[]),(r=e)!==n)if(e=Ae,(s=yn())!==n&&(u=Ie())!==n&&(a=Cn())!==n?(de=e,i=u,e=s=void r.push("(",...i,")")):(Ae=e,e=n),e===n&&(e=Ae,(s=Pe())!==n&&(de=e,s=function(t,r){t.push(...r)}(r,s)),(e=s)===n&&(e=Ae,(s=qe())!==n&&(de=e,s=function(t,r){t.push(...r)}(r,s)),e=s)),e!==n){for(s=[],u=Ae,(a=Xe())===n&&(a=tn()),a!==n&&(o=Ie())!==n?(de=u,u=a=P(r,a,o)):(Ae=u,u=n);u!==n;)s.push(u),u=Ae,(a=Xe())===n&&(a=tn()),a!==n&&(o=Ie())!==n?(de=u,u=a=P(r,a,o)):(Ae=u,u=n);s!==n?(de=t,t=r=r):(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;return t}function De(){var r,e,s,u;return r=Ae,(e=bn())!==n?(58===t.charCodeAt(Ae)?(s=J,Ae++):(s=n,0===me&&Se(G)),s!==n&&(u=Ie())!==n?(de=r,r=e=function(t,r){for(const e of r)e.ref&&e.ref[0]===t&&e.ref.shift();return r}(e,u)):(Ae=r,r=n)):(Ae=r,r=n),r}function Ue(){var r,e,s,u,a;return r=Ae,(e=Ve())===n&&(e=Ge()),e!==n?(s=Ae,wn()!==n?(u=Ae,"asc"===t.substr(Ae,3)?(a="asc",Ae+=3):(a=n,0===me&&Se(W)),a===n&&(t.substr(Ae,4)===X?(a=X,Ae+=4):(a=n,0===me&&Se(Y))),(u=a!==n?t.substring(u,Ae):a)!==n?(de=s,s=u):(Ae=s,s=n)):(Ae=s,s=n),s===n&&(s=null),s!==n?(de=r,r=e=function(t,r){const e=Sn(t,r&&{sort:r});On.orderBy=On.orderBy?[...On.orderBy,e]:[e]}(e,s)):(Ae=r,r=n)):(Ae=r,r=n),r}function Me(){var r,e,s,u,c,i;if(r=Ae,(e=rn())!==n){for(s=[],u=Ae,47===t.charCodeAt(Ae)?(c=a,Ae++):(c=n,0===me&&Se(o)),c!==n&&(i=rn())!==n?u=c=[c,i]:(Ae=u,u=n);u!==n;)s.push(u),u=Ae,47===t.charCodeAt(Ae)?(c=a,Ae++):(c=n,0===me&&Se(o)),c!==n&&(i=rn())!==n?u=c=[c,i]:(Ae=u,u=n);s!==n?r=e=[e,s]:(Ae=r,r=n)}else Ae=r,r=n;return r}function Pe(){var r,e,s,u,a,o;return me++,r=Ae,(e=Je())!==n&&wn()!==n?(s=Ae,"eq"===t.substr(Ae,2)?(u="eq",Ae+=2):(u=n,0===me&&Se(ot)),u===n&&("ne"===t.substr(Ae,2)?(u="ne",Ae+=2):(u=n,0===me&&Se(ct)),u===n&&("lt"===t.substr(Ae,2)?(u="lt",Ae+=2):(u=n,0===me&&Se(it)),u===n&&("gt"===t.substr(Ae,2)?(u="gt",Ae+=2):(u=n,0===me&&Se(ft)),u===n&&("le"===t.substr(Ae,2)?(u="le",Ae+=2):(u=n,0===me&&Se(lt)),u===n&&("ge"===t.substr(Ae,2)?(u="ge",Ae+=2):(u=n,0===me&&Se(ht))))))),(s=u!==n?t.substring(s,Ae):u)!==n&&(u=wn())!==n&&(a=Je())!==n?(de=r,r=e=[e,{eq:"=",ne:"!=",lt:"<",gt:">",le:"<=",ge:">="}[o=s]||o,a]):(Ae=r,r=n)):(Ae=r,r=n),me--,r===n&&(e=n,0===me&&Se(at)),r}function Je(){var r;return me++,(r=Ve())===n&&(r=Ge())===n&&(r=He())===n&&(r=Ke())===n&&(r=Qe())===n&&(r=function(){var r,e,s,u,a;r=Ae,91===t.charCodeAt(Ae)?(e=yt,Ae++):(e=n,0===me&&Se(Ct));if(e!==n){for(s=Ae,u=[],Et.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(St));a!==n;)u.push(a),Et.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(St));(s=u!==n?t.substring(s,Ae):u)!==n?(93===t.charCodeAt(Ae)?(u=$t,Ae++):(u=n,0===me&&Se(wt)),u!==n?(de=r,r=e={list:s.replace(/"/g,"").split(",").map((t=>({val:t})))}):(Ae=r,r=n)):(Ae=r,r=n)}else Ae=r,r=n;return r}()),me--,r===n&&(n,0===me&&Se(pt)),r}function Ge(){var r,e,s,u,c,i,f,l;if(me++,r=Ae,(e=bn())!==n){for(s=[],u=Ae,47===t.charCodeAt(Ae)?(c=a,Ae++):(c=n,0===me&&Se(o)),c!==n&&(i=bn())!==n?(de=u,u=c=dt(0,i)):(Ae=u,u=n);u!==n;)s.push(u),u=Ae,47===t.charCodeAt(Ae)?(c=a,Ae++):(c=n,0===me&&Se(o)),c!==n&&(i=bn())!==n?(de=u,u=c=dt(0,i)):(Ae=u,u=n);s!==n?(de=r,l=s,r=e="null"===(f=e)?{val:null}:{ref:[f,...l]}):(Ae=r,r=n)}else Ae=r,r=n;return me--,r===n&&(e=n,0===me&&Se(At)),r}function He(){var r,e,s;return r=Ae,(e=pn())===n&&(e=function(){var r,e,s,u,a,o,c,i,f,l,h,p,A,d,v,g,b,m,x,y,C,$,w,E;r=Ae,e=Ae,s=[],Ur.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(Mr));if(u!==n)for(;u!==n;)s.push(u),Ur.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(Mr));else s=n;if(s!==n)if(45===t.charCodeAt(Ae)?(u=Pr,Ae++):(u=n,0===me&&Se(Jr)),u!==n)if(Ur.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(Mr)),a!==n)if(Ur.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(Mr)),o!==n)if(45===t.charCodeAt(Ae)?(c=Pr,Ae++):(c=n,0===me&&Se(Jr)),c!==n)if(Ur.test(t.charAt(Ae))?(i=t.charAt(Ae),Ae++):(i=n,0===me&&Se(Mr)),i!==n)if(Ur.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(Mr)),f!==n){if(l=Ae,84===t.charCodeAt(Ae)?(h="T",Ae++):(h=n,0===me&&Se(Gr)),h!==n)if(Ur.test(t.charAt(Ae))?(p=t.charAt(Ae),Ae++):(p=n,0===me&&Se(Mr)),p!==n)if(Ur.test(t.charAt(Ae))?(A=t.charAt(Ae),Ae++):(A=n,0===me&&Se(Mr)),A!==n)if(58===t.charCodeAt(Ae)?(d=J,Ae++):(d=n,0===me&&Se(G)),d!==n)if(Ur.test(t.charAt(Ae))?(v=t.charAt(Ae),Ae++):(v=n,0===me&&Se(Mr)),v!==n)if(Ur.test(t.charAt(Ae))?(g=t.charAt(Ae),Ae++):(g=n,0===me&&Se(Mr)),g!==n){if(b=Ae,58===t.charCodeAt(Ae)?(m=J,Ae++):(m=n,0===me&&Se(G)),m!==n)if(Ur.test(t.charAt(Ae))?(x=t.charAt(Ae),Ae++):(x=n,0===me&&Se(Mr)),x!==n)if(Ur.test(t.charAt(Ae))?(y=t.charAt(Ae),Ae++):(y=n,0===me&&Se(Mr)),y!==n){if(C=Ae,46===t.charCodeAt(Ae)?($=".",Ae++):($=n,0===me&&Se(Hr)),$!==n){if(w=[],Ur.test(t.charAt(Ae))?(E=t.charAt(Ae),Ae++):(E=n,0===me&&Se(Mr)),E!==n)for(;E!==n;)w.push(E),Ur.test(t.charAt(Ae))?(E=t.charAt(Ae),Ae++):(E=n,0===me&&Se(Mr));else w=n;w!==n?C=$=[$,w]:(Ae=C,C=n)}else Ae=C,C=n;C===n&&(C=null),C!==n?b=m=[m,x,y,C]:(Ae=b,b=n)}else Ae=b,b=n;else Ae=b,b=n;else Ae=b,b=n;b===n&&(b=null),b!==n?(90===t.charCodeAt(Ae)?(m="Z",Ae++):(m=n,0===me&&Se(Kr)),m===n&&(m=Ae,43===t.charCodeAt(Ae)?(x="+",Ae++):(x=n,0===me&&Se(Qr)),x===n&&(45===t.charCodeAt(Ae)?(x=Pr,Ae++):(x=n,0===me&&Se(Jr))),x!==n?(Ur.test(t.charAt(Ae))?(y=t.charAt(Ae),Ae++):(y=n,0===me&&Se(Mr)),y!==n?(Ur.test(t.charAt(Ae))?(C=t.charAt(Ae),Ae++):(C=n,0===me&&Se(Mr)),C!==n?(58===t.charCodeAt(Ae)?($=J,Ae++):($=n,0===me&&Se(G)),$!==n?(Ur.test(t.charAt(Ae))?(w=t.charAt(Ae),Ae++):(w=n,0===me&&Se(Mr)),w!==n?(Ur.test(t.charAt(Ae))?(E=t.charAt(Ae),Ae++):(E=n,0===me&&Se(Mr)),E!==n?m=x=[x,y,C,$,w,E]:(Ae=m,m=n)):(Ae=m,m=n)):(Ae=m,m=n)):(Ae=m,m=n)):(Ae=m,m=n)):(Ae=m,m=n)),m===n&&(m=null),m!==n?l=h=[h,p,A,d,v,g,b,m]:(Ae=l,l=n)):(Ae=l,l=n)}else Ae=l,l=n;else Ae=l,l=n;else Ae=l,l=n;else Ae=l,l=n;else Ae=l,l=n;else Ae=l,l=n;l===n&&(l=null),l!==n?e=s=[s,u,a,o,c,i,f,l]:(Ae=e,e=n)}else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;r=e!==n?t.substring(r,Ae):e;return r}()),e!==n&&(de=r,e=vt(e)),(r=e)===n&&(r=mn())===n&&(r=Ae,(e=vn())!==n&&(de=r,e="number"==typeof(s=e)?{val:s}:{val:s,literal:"number"}),(r=e)===n&&(r=Ae,(e=An())!==n&&(de=r,e=vt(e)),r=e)),r}function Ke(){var r,e,s,u,a,o;if(r=Ae,e=Ae,s=Ae,123===t.charCodeAt(Ae)?(u="{",Ae++):(u=n,0===me&&Se(gt)),u!==n){for(a=[],(o=Ke())===n&&(bt.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(mt)));o!==n;)a.push(o),(o=Ke())===n&&(bt.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(mt)));a!==n?(125===t.charCodeAt(Ae)?(o="}",Ae++):(o=n,0===me&&Se(xt)),o!==n?s=u=[u,a,o]:(Ae=s,s=n)):(Ae=s,s=n)}else Ae=s,s=n;return(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,e=vt(e)),r=e}function Qe(){var r,e,s,u,a,o,c,i;if(r=Ae,e=Ae,s=Ae,91===t.charCodeAt(Ae)?(u=yt,Ae++):(u=n,0===me&&Se(Ct)),u!==n&&(a=$n())!==n?(93===t.charCodeAt(Ae)?(o=$t,Ae++):(o=n,0===me&&Se(wt)),o!==n?s=u=[u,a,o]:(Ae=s,s=n)):(Ae=s,s=n),s===n)if(s=Ae,91===t.charCodeAt(Ae)?(u=yt,Ae++):(u=n,0===me&&Se(Ct)),u!==n)if((a=$n())!==n)if(123===t.charCodeAt(Ae)?(o="{",Ae++):(o=n,0===me&&Se(gt)),o!==n){for(c=[],(i=Qe())===n&&(Et.test(t.charAt(Ae))?(i=t.charAt(Ae),Ae++):(i=n,0===me&&Se(St)));i!==n;)c.push(i),(i=Qe())===n&&(Et.test(t.charAt(Ae))?(i=t.charAt(Ae),Ae++):(i=n,0===me&&Se(St)));c!==n?(93===t.charCodeAt(Ae)?(i=$t,Ae++):(i=n,0===me&&Se(wt)),i!==n?s=u=[u,a,o,c,i]:(Ae=s,s=n)):(Ae=s,s=n)}else Ae=s,s=n;else Ae=s,s=n;else Ae=s,s=n;return(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,e=vt(e)),r=e}function Ve(){var r,e,s,u,a,o,c,i,f,l;if(me++,r=Ae,e=Ae,s=[],Zt.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(jt)),u!==n)for(;u!==n;)s.push(u),Zt.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(jt));else s=n;if((e=s!==n?t.substring(e,Ae):s)!==n)if((s=yn())!==n)if((u=Je())!==n){for(a=[],o=Ae,xn()!==n&&(c=Je())!==n?(de=o,o=Ot(0,0,c)):(Ae=o,o=n);o!==n;)a.push(o),o=Ae,xn()!==n&&(c=Je())!==n?(de=o,o=Ot(0,0,c)):(Ae=o,o=n);a!==n&&(o=Cn())!==n?(de=r,i=e,f=u,l=a,zn&&!(i in zn.functions)&&En("'"+i+"' is an unknown function in OData URL spec (strict mode)"),r=e={func:i,args:[f,...l]}):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;else Ae=r,r=n;return me--,r===n&&(e=n,0===me&&Se(zt)),r}function We(){var r,e;return r=Ae,$n()!==n?("not"===t.substr(Ae,3).toLowerCase()?(e=t.substr(Ae,3),Ae+=3):(e=n,0===me&&Se(_t)),e!==n&&wn()!==n?(de=r,r="not"):(Ae=r,r=n)):(Ae=r,r=n),r}function Xe(){var r,e;return r=Ae,wn()!==n?("and"===t.substr(Ae,3).toLowerCase()?(e=t.substr(Ae,3),Ae+=3):(e=n,0===me&&Se(qt)),e!==n&&wn()!==n?(de=r,r="and"):(Ae=r,r=n)):(Ae=r,r=n),r}function Ye(){var t,r;return t=Ae,(r=wn())!==n&&(de=t,r="and"),t=r}function tn(){var r,e;return r=Ae,wn()!==n?("or"===t.substr(Ae,2).toLowerCase()?(e=t.substr(Ae,2),Ae+=2):(e=n,0===me&&Se(It)),e!==n&&wn()!==n?(de=r,r="or"):(Ae=r,r=n)):(Ae=r,r=n),r}function rn(){var r,e,s;return r=Ae,t.substr(Ae,9)===Dt?(e=Dt,Ae+=9):(e=n,0===me&&Se(Ut)),e!==n?(s=function(){var t,r,e,s,u,a,o,c,i,f;if(t=Ae,(r=yn())!==n)if((e=$n())!==n)if((s=en())!==n){for(u=[],a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=en())!==n?a=o=[o,c,i,f]:(Ae=a,a=n);a!==n;)u.push(a),a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=en())!==n?a=o=[o,c,i,f]:(Ae=a,a=n);u!==n&&(a=$n())!==n&&(o=Cn())!==n?t=r=[r,e,s,u,a,o]:(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;return t}(),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,7)===Mt?(e=Mt,Ae+=7):(e=n,0===me&&Se(Pt)),e!==n?(s=function(){var t,r,e,s,u,a,o,c,i,f,l;if(t=Ae,(r=yn())!==n)if((e=$n())!==n){if(s=Ae,(u=yn())!==n)if((a=on())!==n){for(o=[],c=Ae,(i=xn())!==n&&(f=$n())!==n&&(l=on())!==n?c=i=[i,f,l]:(Ae=c,c=n);c!==n;)o.push(c),c=Ae,(i=xn())!==n&&(f=$n())!==n&&(l=on())!==n?c=i=[i,f,l]:(Ae=c,c=n);o!==n&&(c=Cn())!==n?s=u=[u,a,o,c]:(Ae=s,s=n)}else Ae=s,s=n;else Ae=s,s=n;s!==n?(u=Ae,(a=xn())!==n&&(o=$n())!==n&&(c=Me())!==n?u=a=[a,o,c]:(Ae=u,u=n),u===n&&(u=null),u!==n&&(a=$n())!==n&&(o=Cn())!==n?t=r=[r,e,s,u,a,o]:(Ae=t,t=n)):(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;return t}(),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,6)===Jt?(e=Jt,Ae+=6):(e=n,0===me&&Se(Gt)),e!==n&&(s=cn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=function(){var r,e,s,u;r=Ae,t.substr(Ae,8)===br?(e=br,Ae+=8):(e=n,0===me&&Se(mr));e===n&&(t.substr(Ae,11)===xr?(e=xr,Ae+=11):(e=n,0===me&&Se(yr)));e!==n&&yn()!==n&&$n()!==n&&(s=vn())!==n&&$n()!==n&&xn()!==n&&$n()!==n&&(u=Ge())!==n&&$n()!==n&&Cn()!==n?(de=r,r=e=function(t,r,e){const n={...e,sort:"topcount"===t?"desc":"asc"};On.orderBy=On.orderBy?[...On.orderBy,n]:[n],(On.limit||(On.limit={})).rows={val:r}}(e,s,u)):(Ae=r,r=n);return r}(),r===n&&(r=Ae,t.substr(Ae,6)===Ht?(e=Ht,Ae+=6):(e=n,0===me&&Se(Kt)),e!==n&&(s=fn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,6)===Qt?(e=Qt,Ae+=6):(e=n,0===me&&Se(Vt)),e!==n?(s=function(){var t,r,e,s,u,a;t=Ae,(r=yn())!==n&&(e=$n())!==n&&(s=Te())!==n&&(u=$n())!==n&&(a=Cn())!==n?t=r=[r,e,s,u,a]:(Ae=t,t=n);return t}(),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,6)===Wt?(e=Wt,Ae+=6):(e=n,0===me&&Se(Xt)),e!==n?(s=function(){var t,r,e,s,u,a,o,c,i,f;if(t=Ae,(r=yn())!==n)if((e=$n())!==n)if((s=Me())!==n){if(u=[],a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=Me())!==n?a=o=[o,c,i,f]:(Ae=a,a=n),a!==n)for(;a!==n;)u.push(a),a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=Me())!==n?a=o=[o,c,i,f]:(Ae=a,a=n);else u=n;u!==n&&(a=$n())!==n&&(o=Cn())!==n?t=r=[r,e,s,u,a,o]:(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;return t}(),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,7)===Yt?(e=Yt,Ae+=7):(e=n,0===me&&Se(tr)),e!==n?(s=function(){var t,r,e,s,u,a,o,c,i,f;if(t=Ae,(r=yn())!==n)if((e=$n())!==n)if((s=ln())!==n){for(u=[],a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=ln())!==n?a=o=[o,c,i,f]:(Ae=a,a=n);a!==n;)u.push(a),a=Ae,(o=$n())!==n&&(c=xn())!==n&&(i=$n())!==n&&(f=ln())!==n?a=o=[o,c,i,f]:(Ae=a,a=n);u!==n&&(a=$n())!==n&&(o=Cn())!==n?t=r=[r,e,s,u,a,o]:(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;return t}(),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,13)===rr?(e=rr,Ae+=13):(e=n,0===me&&Se(er)),e!==n&&(s=hn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,9)===nr?(e=nr,Ae+=9):(e=n,0===me&&Se(sr)),e!==n&&(s=hn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,10)===ur?(e=ur,Ae+=10):(e=n,0===me&&Se(ar)),e!==n&&(s=hn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=Ae,t.substr(Ae,6)===or?(e=or,Ae+=6):(e=n,0===me&&Se(cr)),e!==n&&(s=hn())!==n?r=e=[e,s]:(Ae=r,r=n),r===n&&(r=function(){var r;t.substr(Ae,8)===Cr?(r=Cr,Ae+=8):(r=n,0===me&&Se($r));return r}())))))))))))),r}function en(){var r,e,s,u,a;return r=Ae,e=Ae,t.substr(Ae,6)===f?(s=f,Ae+=6):(s=n,0===me&&Se(l)),s!==n&&(u=an())!==n?(de=e,e=s={func:"count",args:["*"],as:u}):(Ae=e,e=n),e===n&&(e=nn()),e!==n&&(de=r,a=e,On.columns=Array.isArray(On.columns)?On.columns:[],On.columns.find(Ln(a))||On.columns.push(a),e=a),r=e}function nn(){var t,r,e,s,u;return t=Ae,(r=Ge())!==n&&(e=sn())!==n?((s=un())===n&&(s=null),s!==n&&(u=an())!==n?(de=t,t=r={func:e,args:[r],as:u}):(Ae=t,t=n)):(Ae=t,t=n),t===n&&(t=Ae,(r=bn())!==n&&(e=yn())!==n&&(s=nn())!==n&&(u=Cn())!==n?t=r=[r,e,s,u]:(Ae=t,t=n)),t}function sn(){var r,e,s,u,a;if(r=Ae,wn()!==n)if(t.substr(Ae,4)===ir?(e=ir,Ae+=4):(e=n,0===me&&Se(fr)),e!==n)if(wn()!==n){if(s=Ae,u=[],Zt.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(jt)),a!==n)for(;a!==n;)u.push(a),Zt.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(jt));else u=n;(s=u!==n?t.substring(s,Ae):u)!==n?(de=r,r=s):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;else Ae=r,r=n;return r}function un(){var r,e,s,u,a,o,c;return r=Ae,(e=wn())!==n?(t.substr(Ae,4)===lr?(s=lr,Ae+=4):(s=n,0===me&&Se(hr)),s!==n&&(u=wn())!==n&&(a=Ge())!==n&&(o=sn())!==n?((c=un())===n&&(c=null),c!==n?r=e=[e,s,u,a,o,c]:(Ae=r,r=n)):(Ae=r,r=n)):(Ae=r,r=n),r}function an(){var r,e,s;return r=Ae,wn()!==n?("as"===t.substr(Ae,2)?(e="as",Ae+=2):(e=n,0===me&&Se(pr)),e!==n&&wn()!==n&&(s=bn())!==n?(de=r,r=s):(Ae=r,r=n)):(Ae=r,r=n),r}function on(){var r,e,s;return r=Ae,e=function(){var r,e,s,u,a,o,c,i,f,l,h;r=Ae,e=Ae,t.substr(Ae,6)===Ar?(s=Ar,Ae+=6):(s=n,0===me&&Se(dr));if(s!==n)if((u=yn())!==n)if((a=$n())!==n)if(t.substr(Ae,4)===vr?(o=vr,Ae+=4):(o=n,0===me&&Se(gr)),o===n&&(o=Ge()),o!==n){if(c=[],i=Ae,(f=$n())!==n&&(l=xn())!==n&&(h=Ge())!==n?i=f=[f,l,h]:(Ae=i,i=n),i!==n)for(;i!==n;)c.push(i),i=Ae,(f=$n())!==n&&(l=xn())!==n&&(h=Ge())!==n?i=f=[f,l,h]:(Ae=i,i=n);else c=n;c!==n&&(i=$n())!==n&&(f=Cn())!==n?e=s=[s,u,a,o,c,i,f]:(Ae=e,e=n)}else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;else Ae=e,e=n;e!==n&&(de=r,e=function(t){const r=new Error("Rollup in groupby is not supported yet.");throw r.statusCode=501,r}());return r=e}(),e===n&&(e=Ge()),e!==n&&(de=r,s=e,e=void(On.groupBy||(On.groupBy=[])).push(s)),r=e}function cn(){var t,r,e,s,u,a;return t=Ae,(r=yn())!==n&&(e=$n())!==n&&(s=Ne())!==n&&(u=$n())!==n&&(a=Cn())!==n?t=r=[r,e,s,u,a]:(Ae=t,t=n),t}function fn(){var t,r,e,s,u,a,o,c,i,f,l,h,p,A;if(t=Ae,(r=yn())!==n)if((e=$n())!==n)if((s=Ge())!==n)if((u=$n())!==n)if((a=xn())!==n)if((o=$n())!==n){if(c=Ae,(i=fn())!==n){for(f=[],l=Ae,(h=$n())!==n&&(p=xn())!==n&&(A=fn())!==n?l=h=[h,p,A]:(Ae=l,l=n);l!==n;)f.push(l),l=Ae,(h=$n())!==n&&(p=xn())!==n&&(A=fn())!==n?l=h=[h,p,A]:(Ae=l,l=n);f!==n?c=i=[i,f]:(Ae=c,c=n)}else Ae=c,c=n;if(c===n)if(c=Ae,(i=cn())!==n){for(f=[],l=Ae,(h=$n())!==n&&(p=xn())!==n&&(A=fn())!==n?l=h=[h,p,A]:(Ae=l,l=n);l!==n;)f.push(l),l=Ae,(h=$n())!==n&&(p=xn())!==n&&(A=fn())!==n?l=h=[h,p,A]:(Ae=l,l=n);f!==n?c=i=[i,f]:(Ae=c,c=n)}else Ae=c,c=n;c!==n&&(i=$n())!==n&&(f=Cn())!==n?t=r=[r,e,s,u,a,o,c,i,f]:(Ae=t,t=n)}else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;else Ae=t,t=n;return t}function ln(){var t,r,e;return t=Ae,(r=_e())!==n&&(e=an())!==n?t=r=[r,e]:(Ae=t,t=n),t}function hn(){var t,r,e,s,u,a,o,c,i,f;return t=Ae,(r=yn())!==n&&(e=$n())!==n&&(s=Je())!==n&&(u=$n())!==n&&(a=xn())!==n&&(o=$n())!==n&&(c=Je())!==n&&(i=$n())!==n&&(f=Cn())!==n?t=r=[r,e,s,u,a,o,c,i,f]:(Ae=t,t=n),t}function pn(){var r,e;return r=Ae,t.substr(Ae,4)===wr?(e=wr,Ae+=4):(e=n,0===me&&Se(Er)),e===n&&(t.substr(Ae,5)===Sr?(e=Sr,Ae+=5):(e=n,0===me&&Se(zr))),e!==n&&(de=r,e="true"===e),r=e}function An(){var r,e,s,u,a;if(me++,r=Ae,39===t.charCodeAt(Ae)?(e="'",Ae++):(e=n,0===me&&Se(jr)),e!==n){for(s=Ae,u=[],t.substr(Ae,2)===Or?(a=Or,Ae+=2):(a=n,0===me&&Se(Br)),a===n&&(kr.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(Rr)));a!==n;)u.push(a),t.substr(Ae,2)===Or?(a=Or,Ae+=2):(a=n,0===me&&Se(Br)),a===n&&(kr.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(Rr)));(s=u!==n?t.substring(s,Ae):u)!==n?(39===t.charCodeAt(Ae)?(u="'",Ae++):(u=n,0===me&&Se(jr)),u!==n?(de=r,r=e=s.replace(/''/g,"'")):(Ae=r,r=n)):(Ae=r,r=n)}else Ae=r,r=n;return me--,r===n&&(e=n,0===me&&Se(Zr)),r}function dn(){var r,e,s;if(r=Ae,e=[],Ir.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(Dr)),s!==n)for(;s!==n;)e.push(s),Ir.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(Dr));else e=n;return r=e!==n?t.substring(r,Ae):e}function vn(){var r,e,s,u,a,o,c,i,f,l;if(r=Ae,e=Ae,s=Ae,Vr.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(Wr)),u===n&&(u=null),u!==n){if(a=[],Ur.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(Mr)),o!==n)for(;o!==n;)a.push(o),Ur.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(Mr));else a=n;if(a!==n){if(o=Ae,46===t.charCodeAt(Ae)?(c=".",Ae++):(c=n,0===me&&Se(Hr)),c!==n){if(i=[],Ur.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(Mr)),f!==n)for(;f!==n;)i.push(f),Ur.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(Mr));else i=n;i!==n?o=c=[c,i]:(Ae=o,o=n)}else Ae=o,o=n;if(o===n&&(o=null),o!==n){if(c=Ae,101===t.charCodeAt(Ae)?(i="e",Ae++):(i=n,0===me&&Se(Xr)),i!==n){if(f=[],Ur.test(t.charAt(Ae))?(l=t.charAt(Ae),Ae++):(l=n,0===me&&Se(Mr)),l!==n)for(;l!==n;)f.push(l),Ur.test(t.charAt(Ae))?(l=t.charAt(Ae),Ae++):(l=n,0===me&&Se(Mr));else f=n;f!==n?c=i=[i,f]:(Ae=c,c=n)}else Ae=c,c=n;c===n&&(c=null),c!==n?s=u=[u,a,o,c]:(Ae=s,s=n)}else Ae=s,s=n}else Ae=s,s=n}else Ae=s,s=n;return(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,e=Rn(e)),r=e}function gn(){var r,e,s,u,a,o;if(r=Ae,e=Ae,s=Ae,Vr.test(t.charAt(Ae))?(u=t.charAt(Ae),Ae++):(u=n,0===me&&Se(Wr)),u===n&&(u=null),u!==n){if(a=[],Ur.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(Mr)),o!==n)for(;o!==n;)a.push(o),Ur.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(Mr));else a=n;a!==n?s=u=[u,a]:(Ae=s,s=n)}else Ae=s,s=n;return(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,e=parseInt(e)),r=e}function bn(){var r,e,s,u,a,o,c,i;if(r=Ae,e=Ae,me++,s=pn(),me--,s===n?e=void 0:(Ae=e,e=n),e!==n)if(s=Ae,me++,u=mn(),me--,u===n?s=void 0:(Ae=s,s=n),s!==n){if(u=Ae,a=Ae,Yr.test(t.charAt(Ae))?(o=t.charAt(Ae),Ae++):(o=n,0===me&&Se(te)),o!==n){for(c=[],re.test(t.charAt(Ae))?(i=t.charAt(Ae),Ae++):(i=n,0===me&&Se(ee));i!==n;)c.push(i),re.test(t.charAt(Ae))?(i=t.charAt(Ae),Ae++):(i=n,0===me&&Se(ee));c!==n?a=o=[o,c]:(Ae=a,a=n)}else Ae=a,a=n;(u=a!==n?t.substring(u,Ae):a)!==n?(de=r,r=e=u):(Ae=r,r=n)}else Ae=r,r=n;else Ae=r,r=n;return r}function mn(){var r,e,s,u,a,o,c,i,f;if(r=Ae,e=Ae,s=Ae,u=[],ne.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(se)),a!==n)for(;a!==n;)u.push(a),ne.test(t.charAt(Ae))?(a=t.charAt(Ae),Ae++):(a=n,0===me&&Se(se));else u=n;if(u!==n)if(45===t.charCodeAt(Ae)?(a=Pr,Ae++):(a=n,0===me&&Se(Jr)),a!==n){if(o=[],c=Ae,i=[],ne.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(se)),f!==n)for(;f!==n;)i.push(f),ne.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(se));else i=n;if(i!==n?(45===t.charCodeAt(Ae)?(f=Pr,Ae++):(f=n,0===me&&Se(Jr)),f===n&&(f=null),f!==n?c=i=[i,f]:(Ae=c,c=n)):(Ae=c,c=n),c!==n)for(;c!==n;){if(o.push(c),c=Ae,i=[],ne.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(se)),f!==n)for(;f!==n;)i.push(f),ne.test(t.charAt(Ae))?(f=t.charAt(Ae),Ae++):(f=n,0===me&&Se(se));else i=n;i!==n?(45===t.charCodeAt(Ae)?(f=Pr,Ae++):(f=n,0===me&&Se(Jr)),f===n&&(f=null),f!==n?c=i=[i,f]:(Ae=c,c=n)):(Ae=c,c=n)}else o=n;o!==n?s=u=[u,a,o]:(Ae=s,s=n)}else Ae=s,s=n;else Ae=s,s=n;return(e=s!==n?t.substring(e,Ae):s)!==n&&(de=r,e=vt(e)),r=e}function xn(){var r,e,s,u;return r=Ae,(e=$n())!==n?(44===t.charCodeAt(Ae)?(s=",",Ae++):(s=n,0===me&&Se(oe)),s!==n&&(u=$n())!==n?r=e=[e,s,u]:(Ae=r,r=n)):(Ae=r,r=n),r}function yn(){var r,e,s,u;return r=Ae,(e=$n())!==n?(40===t.charCodeAt(Ae)?(s="(",Ae++):(s=n,0===me&&Se(ce)),s!==n&&(u=$n())!==n?r=e=[e,s,u]:(Ae=r,r=n)):(Ae=r,r=n),r}function Cn(){var r,e,s;return r=Ae,(e=$n())!==n?(41===t.charCodeAt(Ae)?(s=")",Ae++):(s=n,0===me&&Se(ie)),s!==n?r=e=[e,s]:(Ae=r,r=n)):(Ae=r,r=n),r}function $n(){var r,e,s;for(me++,r=Ae,e=[],le.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(he));s!==n;)e.push(s),le.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(he));return r=e!==n?t.substring(r,Ae):e,me--,r===n&&(e=n,0===me&&Se(fe)),r}function wn(){var r,e,s;if(me++,r=Ae,e=[],le.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(he)),s!==n)for(;s!==n;)e.push(s),le.test(t.charAt(Ae))?(s=t.charAt(Ae),Ae++):(s=n,0===me&&Se(he));else e=n;return r=e!==n?t.substring(r,Ae):e,me--,r===n&&(e=n,0===me&&Se(pe)),r}const En=(t,r=400)=>{xe(JSON.stringify({code:r,message:t}))},Sn=Object.assign,{strict:zn,minimal:Zn}=r,jn=[];let On,Bn;const kn=["$value"],Rn=r.safeNumber||function(t){const r=Number(t);return Number.isSafeInteger(r)?r:t},Fn=(t,r)=>{const e=[...t];for(const t of e)t.xpr&&(t.xpr=Fn(t.xpr,r)),t.args&&(t.args=Fn(t.args,r)),t.ref&&r.includes(t.ref.join(""));return e},Tn=t=>{const r=t.groupBy,e=t.where,n=t.columns||[],s=n.filter((t=>t.as));let u=[],a=[];if(0!==s.length&&(u=n.filter((t=>!t.ref||s.includes(t.ref.join(""))))),r){const t=r.map((({ref:t})=>t&&t.join(""))),e=n.filter((r=>r.ref&&t.includes(r.ref.join(""))));a=0===e.length?[...r]:e}const o=0!==u.length||0!==a.length?[...a,...u]:t.columns;let c={...t};o&&(c.columns=o);if(e&&(r||0!==s.length)){const t=n.map((t=>t.ref&&t.ref.join("")||t.as));c={...c,where:Fn(e,t)}}return c},Ln=t=>r=>t===r||t.as&&r.as&&t.as===r.as||t.ref&&r.ref&&t.ref.join("")===r.ref.join(""),Nn=(t,r,e)=>(t||(t=""),r&&(t+=r.reduce(((t,r)=>{for(const e of r)t+="string"==typeof e?e:e.val?"string"==typeof e.val?`'${e.val}'`:e.val:e.ref[0];return t}),""),r=void 0),[t+=e,r,e]);if((e=u())!==n&&Ae===t.length)return e;throw e!==n&&Ae<t.length&&Se({type:"end"}),ze(be,ge<t.length?t.charAt(ge):null,ge<t.length?Ee(ge,ge+1):Ee(ge,ge))}peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.buildMessage=function(t,r){var e={literal:function(t){return'"'+s(t.text)+'"'},class:function(t){var r,e="";for(r=0;r<t.parts.length;r++)e+=t.parts[r]instanceof Array?u(t.parts[r][0])+"-"+u(t.parts[r][1]):u(t.parts[r]);return"["+(t.inverted?"^":"")+e+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function s(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}function u(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+n(t)}))}return"Expected "+function(t){var r,n,s,u=new Array(t.length);for(r=0;r<t.length;r++)u[r]=(s=t[r],e[s.type](s));if(u.sort(),u.length>0){for(r=1,n=1;r<u.length;r++)u[r-1]!==u[r]&&(u[n]=u[r],n++);u.length=n}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}(t)+" but "+function(t){return t?'"'+s(t)+'"':"end of input"}(r)+" found."},module.exports={SyntaxError:peg$SyntaxError,parse:peg$parse};
|
package/libx/odata/readme.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# OData Protocol Adapter
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const getSafeNumber = str => {
|
|
2
|
-
const n = Number(str)
|
|
3
|
-
return Number.isSafeInteger(n) || String(n) === str ? n : str
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const V4UUIDREGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
7
|
-
const isV4UUID = val => V4UUIDREGEXP.test(val)
|
|
8
|
-
|
|
9
|
-
const _odataV2Val = (val, type) => {
|
|
10
|
-
switch (type) {
|
|
11
|
-
case 'cds.Binary':
|
|
12
|
-
case 'cds.LargeBinary':
|
|
13
|
-
return `binary'${val}'`
|
|
14
|
-
case 'cds.Date':
|
|
15
|
-
return `datetime'${val}T00:00:00'`
|
|
16
|
-
case 'cds.DateTime':
|
|
17
|
-
return `datetime'${val}'`
|
|
18
|
-
case 'cds.Time':
|
|
19
|
-
// eslint-disable-next-line no-case-declarations
|
|
20
|
-
const [hh, mm, ss] = val.split(':')
|
|
21
|
-
return `time'PT${hh}H${mm}M${ss}S'`
|
|
22
|
-
case 'cds.Timestamp':
|
|
23
|
-
return `datetimeoffset'${val}'`
|
|
24
|
-
case 'cds.UUID':
|
|
25
|
-
return `guid'${val}'`
|
|
26
|
-
default:
|
|
27
|
-
return `'${val}'`
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const _isTimestamp = val =>
|
|
32
|
-
/^\d+-\d\d-\d\d(T\d\d:\d\d(:\d\d(\.\d+)?)?(Z|([+-]{1}\d\d:\d\d))?)?$/.test(val) && !isNaN(Date.parse(val))
|
|
33
|
-
|
|
34
|
-
const _val = (val, type) => {
|
|
35
|
-
switch (type) {
|
|
36
|
-
case 'cds.Decimal':
|
|
37
|
-
case 'cds.Integer64':
|
|
38
|
-
return getSafeNumber(val)
|
|
39
|
-
case 'cds.Boolean':
|
|
40
|
-
case 'cds.DateTime':
|
|
41
|
-
case 'cds.Date':
|
|
42
|
-
case 'cds.Timestamp':
|
|
43
|
-
case 'cds.Time':
|
|
44
|
-
case 'cds.UUID':
|
|
45
|
-
return val
|
|
46
|
-
default:
|
|
47
|
-
return _isTimestamp(val) ? val : `'${val}'`
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const formatVal = (val, element, csnTarget, kind) => {
|
|
52
|
-
if (val === null || val === 'null') return 'null'
|
|
53
|
-
if (typeof val === 'boolean') return val
|
|
54
|
-
if (typeof val === 'number') return getSafeNumber(val)
|
|
55
|
-
if (!csnTarget && typeof val === 'string' && isV4UUID(val)) return kind === 'odata-v2' ? `guid'${val}'` : val
|
|
56
|
-
|
|
57
|
-
const csnElement = (csnTarget && csnTarget.elements && csnTarget.elements[element]) || { type: undefined }
|
|
58
|
-
return kind === 'odata-v2' ? _odataV2Val(val, csnElement.type) : _val(val, csnElement.type)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = {
|
|
62
|
-
getSafeNumber,
|
|
63
|
-
formatVal
|
|
64
|
-
}
|