@sap/cds-compiler 6.3.6 → 6.4.6
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 +101 -3
- package/LICENSE +32 -0
- package/README.md +14 -2
- package/bin/cdsse.js +0 -3
- package/doc/CHANGELOG_BETA.md +1 -1
- package/doc/CHANGELOG_DEPRECATED.md +1 -1
- package/lib/base/message-registry.js +9 -2
- package/lib/base/messages.js +1 -1
- package/lib/base/model.js +2 -0
- package/lib/checks/existsExpressionsOnlyForeignKeys.js +16 -10
- package/lib/checks/existsMustEndInAssoc.js +1 -1
- package/lib/checks/existsMustNotStartWithDollarSelf.js +31 -0
- package/lib/checks/validator.js +4 -2
- package/lib/compiler/assert-consistency.js +3 -2
- package/lib/compiler/builtins.js +5 -6
- package/lib/compiler/checks.js +37 -26
- package/lib/compiler/define.js +1 -1
- package/lib/compiler/extend.js +39 -50
- package/lib/compiler/finalize-parse-cdl.js +1 -1
- package/lib/compiler/lsp-api.js +1 -1
- package/lib/compiler/populate.js +2 -2
- package/lib/compiler/propagator.js +29 -6
- package/lib/compiler/resolve.js +13 -3
- package/lib/compiler/shared.js +157 -133
- package/lib/compiler/tweak-assocs.js +87 -29
- package/lib/compiler/xpr-rewrite.js +164 -160
- package/lib/edm/annotations/edmJson.js +206 -37
- package/lib/edm/csn2edm.js +13 -0
- package/lib/edm/edmUtils.js +2 -2
- package/lib/gen/BaseParser.js +106 -72
- package/lib/gen/CdlGrammar.checksum +1 -1
- package/lib/gen/CdlParser.js +1501 -1509
- package/lib/json/to-csn.js +8 -5
- package/lib/language/genericAntlrParser.js +0 -0
- package/lib/main.js +19 -16
- package/lib/model/csnRefs.js +589 -521
- package/lib/model/csnUtils.js +8 -5
- package/lib/model/enrichCsn.js +1 -0
- package/lib/parsers/AstBuildingParser.js +73 -28
- package/lib/render/toCdl.js +2 -1
- package/lib/render/toHdbcds.js +6 -3
- package/lib/render/toSql.js +5 -0
- package/lib/transform/db/applyTransformations.js +1 -1
- package/lib/transform/db/assertUnique.js +4 -1
- package/lib/transform/db/assocsToQueries/transformExists.js +3 -10
- package/lib/transform/db/assocsToQueries/utils.js +0 -5
- package/lib/transform/db/cdsPersistence.js +17 -18
- package/lib/transform/db/expansion.js +179 -3
- package/lib/transform/db/flattening.js +16 -5
- package/lib/transform/db/rewriteCalculatedElements.js +79 -283
- package/lib/transform/effective/main.js +8 -1
- package/lib/transform/forOdata.js +1 -1
- package/lib/transform/forRelationalDB.js +21 -80
- package/lib/transform/localized.js +75 -127
- package/lib/transform/odata/foreignKeyRefsInXprAnnos.js +89 -63
- package/lib/transform/transformUtils.js +23 -21
- package/lib/transform/translateAssocsToJoins.js +7 -5
- package/lib/transform/tupleExpansion.js +16 -3
- package/package.json +3 -3
- package/doc/DeprecatedOptions_v2.md +0 -150
- package/doc/NameResolution.md +0 -837
- package/lib/transform/parseExpr.js +0 -415
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,69 @@
|
|
|
4
4
|
<!-- markdownlint-disable MD004 -->
|
|
5
5
|
<!-- (no-duplicate-heading)-->
|
|
6
6
|
|
|
7
|
-
Note: `beta`
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Note: while we list new `beta` flags and their removal in this ChangeLog,
|
|
8
|
+
we might not list every change in its behavior here.
|
|
9
|
+
Productive code should never require a `beta` flag to be set, and
|
|
10
|
+
might use a deprecated flag only for a limited period of time.
|
|
11
|
+
|
|
12
|
+
## Version 6.4.6 - 2025-10-23
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- compiler: a references to an element of the target in a filter for associations
|
|
17
|
+
inside an annotation expression does not lead to a compiler message requesting
|
|
18
|
+
users to provide the annotation themselves (regression with v6.4.4)
|
|
19
|
+
|
|
20
|
+
## Version 6.4.4 - 2025-10-15
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- compiler:
|
|
25
|
+
+ properly rewrite references in arguments of associations in annotation expressions
|
|
26
|
+
+ a references to a variable (`$user.id`, …) in a filter of an annotation expression
|
|
27
|
+
does not lead to a compiler message requesting users to provide the annotation themselves
|
|
28
|
+
+ improve code completion in annotation expressions: the editor can display valid names
|
|
29
|
+
for references even if the expression does not properly end by `)`
|
|
30
|
+
- to.sql:
|
|
31
|
+
+ reject `$self` in infix filter following exists predicate instead of just ignoring the filter expression
|
|
32
|
+
+ properly add comparison for the `tenant` discriminator to the `join` condition of `localized` views
|
|
33
|
+
if the non-published option for tenant support is set (regression with v6.4.0)
|
|
34
|
+
|
|
35
|
+
### Removed
|
|
36
|
+
|
|
37
|
+
## Version 6.4.2 - 2025-10-07
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- parser:
|
|
42
|
+
+ improve error recovery with empty expression as annotation value
|
|
43
|
+
+ avoid clutter in message text for syntax errors: use `‹Value›` instead of listing value tokens
|
|
44
|
+
- compiler: fix suppression of warnings when annotating backend-generated things
|
|
45
|
+
like draft entities or localized convenience views
|
|
46
|
+
- to.sql|hdi|hdbcds: don’t report unjustified errors when projecting structured elements and
|
|
47
|
+
calculated elements had been used (regression with v6.4.0)
|
|
48
|
+
|
|
49
|
+
## Version 6.4.0 - 2025-09-26
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- compiler: `annotate … with @extension.code: [..., 'additional code']` even works
|
|
54
|
+
if no value for that annotation has been provided with the base definition.
|
|
55
|
+
- to.sql: Calculated elements can now be used next to (but not in) nested projections.
|
|
56
|
+
- to.edm(x): The `@cds.api.ignore` annotation can now be applied to actions, functions, and their parameters.
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- to.sql:
|
|
61
|
+
+ generation of localized convenience views now use the ON-condition of the `localized` element
|
|
62
|
+
to create the FROM clause.
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- parser: minor improvements in error reporting and error recovery
|
|
67
|
+
- to.sql:
|
|
68
|
+
+ columns selecting variables did not always get a column alias.
|
|
69
|
+
+ when excluding a structure, the SQL backend incorrectly emits `wildcard-excluding-one`.
|
|
10
70
|
|
|
11
71
|
## Version 6.3.6 - 2025-09-19
|
|
12
72
|
|
|
@@ -205,6 +265,19 @@ The compiler behavior concerning `beta` features can change at any time without
|
|
|
205
265
|
|
|
206
266
|
- for.odata/to.edm(x):
|
|
207
267
|
+ Annotating the generated `DraftAdministrativeData` artifacts and their elements is now supported.
|
|
268
|
+
- beta flag `v7preview`: if set, the compiler reports those issues as errors
|
|
269
|
+
which we consider severe enough to report as error with the v7 release.
|
|
270
|
+
- new deprecated flags:
|
|
271
|
+
+ If the deprecated flag `noQuasiVirtualAssocs` is set, managed to-many associations
|
|
272
|
+
will get foreign keys as they got in compiler v5. If not set, managed to-many associations
|
|
273
|
+
without explicit foreign keys don't get `keys` anymore in cds-compiler v6.
|
|
274
|
+
+ If the deprecated flag `noCompositionIncludes` is set, generated entities for compositions
|
|
275
|
+
of named aspect will not get an `includes` property.
|
|
276
|
+
+ If the deprecated flag `noPersistenceJournalForGeneratedEntities` is set,
|
|
277
|
+
`@cds.persistence.journal` will _not_ be propagated to generated entities,
|
|
278
|
+
including generated `.texts` entities for localized entities, nor generated entities
|
|
279
|
+
for managed compositions of aspects. If not set, this annotation is copied to those entities
|
|
280
|
+
in compiler v6.
|
|
208
281
|
|
|
209
282
|
### Removed
|
|
210
283
|
|
|
@@ -213,11 +286,28 @@ The compiler behavior concerning `beta` features can change at any time without
|
|
|
213
286
|
+ v5 deprecated flags are removed, see [CHANGELOG_DEPRECATED.md](doc/CHANGELOG_DEPRECATED.md).
|
|
214
287
|
+ Option `compositionIncludes` is removed, as its default is `true`; instead, a deprecated flag was added.
|
|
215
288
|
- to.hdbcds: The HDBCDS backend is deprecated and can no longer be invoked.
|
|
289
|
+
- beta feature `v6preview`
|
|
290
|
+
- deprecated flags `includesNonShadowedFirst`, `eagerPersistenceForGeneratedEntities` and
|
|
291
|
+
noKeyPropagationWithExpansions`
|
|
216
292
|
|
|
217
293
|
### Fixed
|
|
218
294
|
|
|
219
295
|
- to.edm(x): Fixed crash for rare case if annotation expressions were used.
|
|
220
296
|
|
|
297
|
+
## Version 5.9.12 - 2025-09-19
|
|
298
|
+
|
|
299
|
+
### Fixed
|
|
300
|
+
|
|
301
|
+
- to.sql: Topological ordering of views did not always account for subqueries (fixes regression from v5.9.0)
|
|
302
|
+
|
|
303
|
+
## Version 5.9.10 - 2025-09-11
|
|
304
|
+
|
|
305
|
+
### Fixed
|
|
306
|
+
|
|
307
|
+
- parser: Keep parentheses around lists on the right side of an `in` operator.
|
|
308
|
+
- compiler: For calculated elements using associations with filters and cardinality, CSN recompilation could
|
|
309
|
+
fail for `gensrc` CSN, as happens for MTX.
|
|
310
|
+
|
|
221
311
|
## Version 5.9.8 - 2025-07-14
|
|
222
312
|
|
|
223
313
|
### Fixed
|
|
@@ -310,6 +400,8 @@ The compiler behavior concerning `beta` features can change at any time without
|
|
|
310
400
|
in parentheses such as `[ (1), (2) ]`, as well as "infinite" by using `[ _, _ ]`.
|
|
311
401
|
- for.odata/to.edm(x)/for.seal: Propagate annotation expressions from managed associations
|
|
312
402
|
to the foreign keys
|
|
403
|
+
- beta feature `v6preview`: if set, the compiler reports those issues as errors
|
|
404
|
+
which we consider severe enough to report as error with the v6 release.
|
|
313
405
|
|
|
314
406
|
### Changed
|
|
315
407
|
|
|
@@ -482,6 +574,11 @@ The compiler behavior concerning `beta` features can change at any time without
|
|
|
482
574
|
- CDL parser: Issue warning for arrayed parameter with default value.
|
|
483
575
|
- to.cdl: Arrayed parameters with default values were not rendered correctly.
|
|
484
576
|
|
|
577
|
+
### Removed
|
|
578
|
+
|
|
579
|
+
- beta flag `optionalActionFunctionParameters`: in v5, action and function parameters
|
|
580
|
+
can be specified as optional without setting this beta flag.
|
|
581
|
+
|
|
485
582
|
## Version 5.2.0 - 2024-08-27
|
|
486
583
|
|
|
487
584
|
### Added
|
|
@@ -597,6 +694,7 @@ This is a preview version for the major release and contains breaking changes. I
|
|
|
597
694
|
|
|
598
695
|
- API: Deprecated functions `preparedCsnToEdmx` and `preparedCsnToEdm` were removed.
|
|
599
696
|
Use `to.edm(x)` instead.
|
|
697
|
+
- beta feature `v5preview`
|
|
600
698
|
|
|
601
699
|
## Version 4.9.10 - 2025-04-29
|
|
602
700
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
SAP DEVELOPER LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
Version 3.2 CAP
|
|
4
|
+
|
|
5
|
+
Please scroll down and read the following Developer License Agreement carefully ("Developer Agreement"). By clicking "I Accept" or by attempting to download, or install, or use the SAP software and other materials that accompany this Developer Agreement ("SAP Materials"), You agree that this Developer Agreement forms a legally binding agreement between You ("You" or "Your") and SAP SE, for and on behalf of itself and its subsidiaries and affiliates (as defined in Section 15 of the German Stock Corporation Act) and You agree to be bound by all of the terms and conditions stated in this Developer Agreement. If You are trying to access or download the SAP Materials on behalf of Your employer or as a consultant or agent of a third party (either "Your Company"), You represent and warrant that You have the authority to act on behalf of and bind Your Company to the terms of this Developer Agreement and everywhere in this Developer Agreement that refers to 'You' or 'Your' shall also include Your Company. If You do not agree to these terms, do not click "I Accept", and do not attempt to access or use the SAP Materials.
|
|
6
|
+
|
|
7
|
+
1. LICENSE: SAP grants You a non-exclusive, non-transferable, non-sublicensable, revocable, limited use license to copy and reproduce the application programming interfaces ("API"), documentation, plug-ins, templates, scripts and sample code, libraries, software development kits ("Tools") to create new applications ("Customer Applications") being developed either for (a) testing and only non-productive use (“Customer Test Applications”) or (b) for productive use deployed and operated exclusively on “SAP Business Technology Platform (BTP)” or any other platform licensed from SAP (“Customer Productive Applications”). Only under this prerequisite SAP will grant You a non-exclusive, non-transferable, revocable, limited use license to copy, reproduce and distribute SAP’s underlying rights in the Customer Productive Application. You agree that any Customer Applications will not: (a) unreasonably impair, degrade or reduce the performance or security of any SAP software applications, services or related technology ("Software"); (b) enable the bypassing or circumventing of SAP's license restrictions and/or provide users with access to the Software to which such users are not licensed; (c) render or provide, without prior written consent from SAP, any information concerning SAP software license terms, Software, or any other information related to SAP products; or (d) permit mass data extraction from an SAP product to a non-SAP product, including use, modification, saving or other processing of such data in the non-SAP product, except and only to the extent that the extraction is solely used for and required for interoperability with an SAP product. In exchange for the right to develop any Customer Applications under this Agreement, You covenant not to assert any Intellectual Property Rights in Customer Applications created by You against any SAP product, service, or future SAP development.
|
|
8
|
+
|
|
9
|
+
2. INTELLECTUAL PROPERTY: (a) SAP or its licensors retain all ownership and intellectual property rights in the APIs, Tools and Software. You may not: a) remove or modify any marks or proprietary notices of SAP, b) provide or make the APIs, Tools or Software available to any third party, except in cases APIs and Tools have been made part of the overall Customer Productive Application to function, c) assign this Developer Agreement or give or transfer the APIs, Tools or Software or an interest in them to another individual or entity, d) decompile, disassemble or reverse engineer (except to the extent permitted by applicable law) the APIs Tools or Software, e) create derivative works of or based on the APIs, Tools or Software, subject to Customer Productive Applications, being exclusively deployed and operated on “SAP Business Technology Platform (BTP)” or on any other platform licensed from SAP, f) use any SAP name, trademark or logo, or g) use the APIs or Tools to modify existing Software or other SAP product functionality or to access the Software or other SAP products' source code or metadata. (b) Subject to SAP's underlying rights in any part of the APIs, Tools or Software, You retain all ownership and intellectual property rights in Your Customer Applications.
|
|
10
|
+
|
|
11
|
+
3. ARTIFICIAL INTELLIGENCE TRAINING: You are expressly prohibited from using the Software, Tools or APIs as well as any Customer Applications or any part thereof for the purpose of training (developing) artificial intelligence models or systems (“AI Training”). Prohibition of AI Training includes, but is not limited to, using the Software, Tools, APIs and/or Customer Applications or part thereof in any training data set, algorithm development, model development or refinement (including language learning models) related to artificial intelligence, as well as text and data mining in accordance with §44b UrhG and Art. 4 of EU Directive 2019/790. For the avoidance of doubt, by accepting this Developer Agreement You agree that Your ownership of Customer Applications shall not create nor encompass any right to use Customer Applications for AI Training and, hence, You will not use Customer Applications or any part of it for AI Training.
|
|
12
|
+
|
|
13
|
+
4. FREE AND OPEN SOURCE COMPONENTS: The SAP Materials may include certain third party free or open source components ("FOSS Components"). You may have additional rights in such FOSS Components that are provided by the third party licensors of those components.
|
|
14
|
+
|
|
15
|
+
5. THIRD PARTY DEPENDENCIES: The SAP Materials may require certain third party software dependencies ("Dependencies") for the use or operation of such SAP Materials. These dependencies may be identified by SAP in Maven POM files, product documentation or by other means. SAP does not grant You any rights in or to such Dependencies under this Developer Agreement. You are solely responsible for the acquisition, installation and use of Dependencies. SAP DOES NOT MAKE ANY REPRESENTATIONS OR WARRANTIES IN RESPECT OF DEPENDENCIES, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR A PARTICULAR PURPOSE. IN PARTICULAR, SAP DOES NOT WARRANT THAT DEPENDENCIES WILL BE AVAILABLE, ERROR FREE, INTEROPERABLE WITH THE SAP MATERIALS, SUITABLE FOR ANY PARTICULAR PURPOSE OR NON-INFRINGING. YOU ASSUME ALL RISKS ASSOCIATED WITH THE USE OF DEPENDENCIES, INCLUDING WITHOUT LIMITATION RISKS RELATING TO QUALITY, AVAILABILITY, PERFORMANCE, DATA LOSS, UTILITY IN A PRODUCTION ENVIRONMENT, AND NON-INFRINGEMENT. IN NO EVENT WILL SAP BE LIABLE DIRECTLY OR INDIRECTLY IN RESPECT OF ANY USE OF DEPENDENCIES BY YOU.
|
|
16
|
+
|
|
17
|
+
6. WARRANTY: a) If You are located outside the US or Canada: AS THE API AND TOOLS ARE PROVIDED TO YOU FREE OF CHARGE, SAP DOES NOT GUARANTEE OR WARRANT ANY FEATURES OR QUALITIES OF THE TOOLS OR API OR GIVE ANY UNDERTAKING WITH REGARD TO ANY OTHER QUALITY OR TO YOUR CUSTOMERS. NO SUCH WARRANTY OR UNDERTAKING SHALL BE IMPLIED BY YOU FROM ANY DESCRIPTION IN THE API OR TOOLS OR ANY AVAILABLE DOCUMENTATION OR ANY OTHER COMMUNICATION OR ADVERTISEMENT. IN PARTICULAR, SAP DOES NOT WARRANT THAT THE SOFTWARE WILL BE AVAILABLE UNINTERRUPTED, ERROR FREE, OR PERMANENTLY AVAILABLE. FOR THE TOOLS AND API ALL WARRANTY CLAIMS ARE SUBJECT TO THE LIMITATION OF LIABILITY STIPULATED IN SECTION 4 BELOW. b) If You are located in the US or Canada: THE API AND TOOLS ARE LICENSED TO YOU "AS IS", WITHOUT ANY WARRANTY, ESCROW, TRAINING, MAINTENANCE, OR SERVICE OBLIGATIONS WHATSOEVER ON THE PART OF SAP. SAP MAKES NO EXPRESS OR IMPLIED WARRANTIES OR CONDITIONS OF SALE OF ANY TYPE WHATSOEVER, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR A PARTICULAR PURPOSE. IN PARTICULAR, SAP DOES NOT WARRANT THAT THE SOFTWARE WILL BE AVAILABLE UNINTERRUPTED, ERROR FREE, OR PERMANENTLY AVAILABLE. YOU ASSUME ALL RISKS ASSOCIATED WITH THE USE AND DISTRIBUTION (IF ANY) OF THE API AND TOOLS, INCLUDING WITHOUT LIMITATION RISKS RELATING TO QUALITY, AVAILABILITY, PERFORMANCE, DATA LOSS, AND UTILITY IN A PRODUCTION ENVIRONMENT.
|
|
18
|
+
|
|
19
|
+
7. LIMITATION OF LIABILITY: a) If You are located outside the US or Canada: IRRESPECTIVE OF THE LEGAL REASONS, SAP SHALL ONLY BE LIABLE FOR DAMAGES UNDER THIS AGREEMENT IF SUCH DAMAGE (I) CAN BE CLAIMED UNDER THE GERMAN PRODUCT LIABILITY ACT OR (II) IS CAUSED BY INTENTIONAL MISCONDUCT OF SAP OR (III) CONSISTS OF PERSONAL INJURY. IN ALL OTHER CASES, NEITHER SAP NOR ITS EMPLOYEES, AGENTS AND SUBCONTRACTORS SHALL BE LIABLE FOR ANY KIND OF DAMAGE OR CLAIMS HEREUNDER.
|
|
20
|
+
b) If You are located in the US or Canada: IN NO EVENT SHALL SAP BE LIABLE TO YOU, YOUR COMPANY, YOUR CUSTOMERS OR TO ANY THIRD PARTY FOR ANY DAMAGES IN AN AMOUNT IN EXCESS OF $100 ARISING IN CONNECTION WITH YOUR USE OF OR INABILITY TO USE THE TOOLS OR API OR IN CONNECTION WITH SAP'S PROVISION OF OR FAILURE TO PROVIDE SERVICES PERTAINING TO THE TOOLS OR API, OR AS A RESULT OF ANY DEFECT IN THE API OR TOOLS OR ANY THIRD PARTY RIGHTS INFRINGEMENT BY THE APIs, TOOLS OR SOFTWARE. THIS DISCLAIMER OF LIABILITY SHALL APPLY REGARDLESS OF THE FORM OF ACTION THAT MAY BE BROUGHT AGAINST SAP, WHETHER IN CONTRACT OR TORT, INCLUDING WITHOUT LIMITATION ANY ACTION FOR NEGLIGENCE. YOUR SOLE REMEDY IN THE EVENT OF BREACH OF THIS DEVELOPER AGREEMENT BY SAP OR FOR ANY OTHER CLAIM RELATED TO THE API OR TOOLS SHALL BE TERMINATION OF THIS AGREEMENT. NOTWITHSTANDING ANYTHING TO THE CONTRARY HEREIN, UNDER NO CIRCUMSTANCES SHALL SAP AND ITS LICENSORS BE LIABLE TO YOU OR ANY OTHER PERSON IN PARTICULAR COMPANY AND YOUR CUSTOMERS OR ENTITY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR INDIRECT DAMAGES, LOSS OF GOOD WILL OR BUSINESS PROFITS, WORK STOPPAGE, DATA LOSS, COMPUTER FAILURE OR MALFUNCTION, ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSS, OR EXEMPLARY OR PUNITIVE DAMAGES.
|
|
21
|
+
|
|
22
|
+
8. INDEMNITY: You will fully indemnify, hold harmless and defend SAP against law suits based on any claim: (a) that any Customer Application created by You infringes or misappropriates any patent, copyright, trademark, trade secrets, or other proprietary rights of a third party, or (b) related to Your alleged violation of the terms of this Developer Agreement
|
|
23
|
+
|
|
24
|
+
9. EXPORT: The Tools and API are subject to German, EU and US export control regulations. You confirm that: a) You will not use the Tools or API for, and will not allow the Tools or API to be used for, any purposes prohibited by German, EU and US law, including, without limitation, for the development, design, manufacture or production of nuclear, chemical or biological weapons of mass destruction; b) You are not located in and/or will not download or otherwise export or re-export the API or Tools, directly or indirectly, to Cuba, Iran, North Korea, Syria, Crimea/Sevastopol or the so-called Donetsk People’s Republic (DNR) / Luhansk People’s Republic (LNR)nor any other country to which Germany, the European Union and/or the United States has prohibited export; c) You are not listed on any applicable sanctioned party lists (e.g., European Union Sanctions List, U.S. Specially Designated National (SDN) lists, U.S. Denied Persons List, BIS Entity List, United Nations Security Council Sanctions); d) You will not download or otherwise export or re-export the API or Tools , directly or indirectly, to persons on the above-mentioned lists.
|
|
25
|
+
|
|
26
|
+
10. SUPPORT: Other than what is made available on the SAP Community Website (SCN) by SAP at its sole discretion and by SCN members, SAP does not offer support for the API or Tools which are the subject of this Developer Agreement. In case of Customer Productive Applications developed and made available by You in accordance with this Developer Agreement, You and third parties may request support in line with Your licensing agreement for SAP.
|
|
27
|
+
|
|
28
|
+
11. TERM AND TERMINATION: You may terminate this Developer Agreement by destroying all copies of the API and Tools on Your Computer(s). SAP may terminate Your license to use the API and Tools immediately if You fail to comply with any of the terms of this Developer Agreement, or, for SAP's convenience by providing you with ten (10) day's written notice of termination (including email). In case of termination or expiration of this Developer Agreement, You must destroy all copies of the API and Tools immediately. In the event Your Company or any of the intellectual property you create using the API, Tools or Software are acquired (by merger, purchase of stock, assets or intellectual property or exclusive license), or You become employed, by a direct competitor of SAP, then this Development Agreement and all licenses granted in this Developer Agreement shall immediately terminate upon the date of such acquisition.
|
|
29
|
+
|
|
30
|
+
12. LAW/VENUE: a) If You are located outside the US or Canada: This Developer Agreement is governed by and construed in accordance with the laws of the Germany. You and SAP agree to submit to the exclusive jurisdiction of, and venue in, the courts of Karlsruhe in Germany in any dispute arising out of or relating to this Developer Agreement. b) If You are located in the US or Canada: This Developer Agreement shall be governed by and construed under the Commonwealth of Pennsylvania law without reference to its conflicts of law principles. In the event of any conflicts between foreign law, rules, and regulations, and United States of America law, rules, and regulations, United States of America law, rules, and regulations shall prevail and govern. The United Nations Convention on Contracts for the International Sale of Goods shall not apply to this Developer Agreement. The Uniform Computer Information Transactions Act as enacted shall not apply.
|
|
31
|
+
|
|
32
|
+
13. MISCELLANEOUS: This Developer Agreement is the complete agreement for the API and Tools licensed (including reference to information/documentation contained in a URL). This Developer Agreement supersedes all prior or contemporaneous agreements or representations with regards to the subject matter of this Developer Agreement. If any term of this Developer Agreement is found to be invalid or unenforceable, the surviving provisions shall remain effective. SAP's failure to enforce any right or provisions stipulated in this Developer Agreement will not constitute a waiver of such provision, or any other provision of this Developer Agreement.
|
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
[Installation and Usage](#installation-and-usage)
|
|
8
8
|
[Documentation](#documentation)
|
|
9
|
+
[How to Obtain Support](#how-to-obtain-support)
|
|
10
|
+
[History and License](#history-and-license)
|
|
9
11
|
|
|
10
12
|
## Installation and Usage
|
|
11
13
|
|
|
@@ -23,15 +25,25 @@ Or maintain your package.json dependencies as follows:
|
|
|
23
25
|
}
|
|
24
26
|
```
|
|
25
27
|
|
|
28
|
+
If your project already has a dependency to `@sap/cds`, nothing has to be done.
|
|
29
|
+
|
|
26
30
|
|
|
27
31
|
## Documentation
|
|
28
32
|
|
|
29
33
|
Please refer to the [official CDS documentation](https://cap.cloud.sap/docs/cds/).
|
|
30
34
|
|
|
35
|
+
|
|
31
36
|
## How to Obtain Support
|
|
32
37
|
|
|
33
38
|
In case you find a bug, please report an [incident](https://cap.cloud.sap/docs/resources/#reporting-incidents) on SAP Support Portal.
|
|
34
39
|
|
|
35
|
-
## License
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
## History and License
|
|
42
|
+
|
|
43
|
+
The cds-compiler uses [Semantic Versioning](./doc/Versioning.md) for its version numbers.
|
|
44
|
+
|
|
45
|
+
Our [changelog](./CHANGELOG.md) lists recent changes.
|
|
46
|
+
<!-- If you upgrade from a previous version, TODO: incompatible changes -->
|
|
47
|
+
|
|
48
|
+
This package is provided under the terms of the [SAP Developer License Agreement, Version 3.2 CAP](LICENSE).
|
|
49
|
+
<!-- https://cap.cloud.sap/resources/license/developer-license-3_2_CAP.txt -->
|
package/bin/cdsse.js
CHANGED
|
@@ -174,9 +174,6 @@ function tokensAt( buf, _offset, col, symbol ) {
|
|
|
174
174
|
else if (/^[A-Z_]+$/.test( n )) {
|
|
175
175
|
console.log( n.toLowerCase(), 'keyword' );
|
|
176
176
|
}
|
|
177
|
-
else if (n === 'Boolean') {
|
|
178
|
-
console.log( 'true keyword\nfalse keyword' );
|
|
179
|
-
}
|
|
180
177
|
else if (n !== 'Identifier') {
|
|
181
178
|
console.log( n, 'unknown' );
|
|
182
179
|
}
|
package/doc/CHANGELOG_BETA.md
CHANGED
|
@@ -669,6 +669,7 @@ const centralMessageTexts = {
|
|
|
669
669
|
tableAlias: 'A filter can only be provided when navigating along associations, but found table alias',
|
|
670
670
|
from: 'A filter can only be provided for the source entity or associations',
|
|
671
671
|
'model-only': 'A filter can\'t be provided for a to-many association without ON-condition',
|
|
672
|
+
'last-empty-filter': 'Unexpected empty filter in last path step',
|
|
672
673
|
},
|
|
673
674
|
|
|
674
675
|
// multi-line strings: --------------------------------------------------------
|
|
@@ -706,8 +707,8 @@ const centralMessageTexts = {
|
|
|
706
707
|
on: 'Unexpected $(ID) reference; is valid only if compared to be equal to an association of the target side',
|
|
707
708
|
subQuery: 'Unexpected $(ID) reference in a sub query',
|
|
708
709
|
setQuery: 'Unexpected $(ID) reference in a query on the right side of $(OP)',
|
|
709
|
-
exists: '
|
|
710
|
-
'exists-filter': 'Unexpected $(ID) reference in filter of
|
|
710
|
+
exists: 'Paths following $(NAME) must not start with $(ID)',
|
|
711
|
+
'exists-filter': 'Unexpected $(ID) reference in filter of assoc $(ELEMREF) following “EXISTS” predicate',
|
|
711
712
|
},
|
|
712
713
|
'ref-unexpected-map': {
|
|
713
714
|
std: 'Unexpected reference to an element of type $(TYPE)', // unused
|
|
@@ -1011,6 +1012,11 @@ const centralMessageTexts = {
|
|
|
1011
1012
|
// TODO: Better message?
|
|
1012
1013
|
include: '$(ART) can\'t have localized elements (through include)',
|
|
1013
1014
|
},
|
|
1015
|
+
'def-expected-localized': {
|
|
1016
|
+
std: 'Skipped creation of convenience view for $(NAME)', // unused
|
|
1017
|
+
'non-assoc': 'Skipped creation of convenience view for $(NAME) because element $(ALIAS) is not an association',
|
|
1018
|
+
missing: 'Skipped creation of convenience view for $(NAME) because element $(ALIAS) is missing',
|
|
1019
|
+
},
|
|
1014
1020
|
'def-unexpected-localized-struct': '$(KEYWORD) is not fully supported for structures',
|
|
1015
1021
|
'def-unexpected-localized-anno': 'Annotations can\'t have localized elements',
|
|
1016
1022
|
'def-unexpected-virtual': 'Unexpected $(KEYWORD): an element can\'t be virtual and an association/composition',
|
|
@@ -1428,6 +1434,7 @@ const centralMessageTexts = {
|
|
|
1428
1434
|
},
|
|
1429
1435
|
'odata-anno-xpr': {
|
|
1430
1436
|
std: 'unused',
|
|
1437
|
+
invalid: 'Invalid expression around $(OP) in $(ANNO); can\'t be rendered as a dynamic expression',
|
|
1431
1438
|
notadynexpr: '$(OP) is not a renderable dynamic expression in $(ANNO)',
|
|
1432
1439
|
use: 'Function $(OP) is not a renderable dynamic expression in $(ANNO), use $(CODE) instead',
|
|
1433
1440
|
canonfuncalias: 'Expected function name $(CODE) to be of the form $(META).$(OTHERMETA) for $(OP) in $(ANNO)',
|
package/lib/base/messages.js
CHANGED
|
@@ -1724,7 +1724,7 @@ function constructSemanticLocationFromCsnPath( model, options, csnPath ) {
|
|
|
1724
1724
|
else if (step === 'targetAspect') {
|
|
1725
1725
|
// skip
|
|
1726
1726
|
}
|
|
1727
|
-
else if (step === 'xpr' || step === 'default' || step === 'ref' || step === 'as' || step === 'value') {
|
|
1727
|
+
else if (step === 'xpr' || step === 'list' || step === 'default' || step === 'ref' || step === 'as' || step === 'value') {
|
|
1728
1728
|
break; // don't go into xprs, refs, aliases, values, etc.
|
|
1729
1729
|
}
|
|
1730
1730
|
else if (step === 'returns') {
|
package/lib/base/model.js
CHANGED
|
@@ -3,39 +3,45 @@
|
|
|
3
3
|
const { requireForeignKeyAccess } = require('../checks/onConditions');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Filter expressions in an exists path must:
|
|
7
|
+
* - only contain fk-accesses for assocs. Unmanaged traversal / non-fk access is forbidden.
|
|
8
|
+
* - not contain a ref starting with $self
|
|
7
9
|
*
|
|
8
10
|
* @param {CSN.Artifact} parent
|
|
9
11
|
* @param {string} name
|
|
10
12
|
* @param {Array} expr
|
|
11
13
|
*/
|
|
12
|
-
function
|
|
14
|
+
function assertFilterOfExists( parent, name, expr ) {
|
|
13
15
|
for (let i = 0; i < expr.length - 1; i++) {
|
|
14
16
|
if (expr[i] === 'exists' && expr[i + 1].ref) {
|
|
15
17
|
i++;
|
|
16
18
|
const current = expr[i];
|
|
17
19
|
|
|
18
|
-
const { _links } =
|
|
20
|
+
const { _links } = current;
|
|
19
21
|
|
|
20
22
|
const assocs = _links.filter(link => link.art?.target).map(link => current.ref[link.idx]);
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
ensureValidFilters.call(this, assocs);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Reject:
|
|
31
|
+
* - Unmanaged traversal / non-fk access.
|
|
32
|
+
* - ref's starting with $self
|
|
29
33
|
*
|
|
30
34
|
* @param {object[]} assocs Array of refs of assocs - possibly with a .where to check
|
|
31
35
|
*/
|
|
32
|
-
function
|
|
36
|
+
function ensureValidFilters( assocs ) {
|
|
33
37
|
for (const assoc of assocs) {
|
|
34
38
|
if (assoc.where) {
|
|
35
39
|
for (let i = 0; i < assoc.where.length; i++) {
|
|
36
40
|
const part = assoc.where[i];
|
|
37
41
|
|
|
38
42
|
if (part._links && !(assoc.where[i - 1] && assoc.where[i - 1] === 'exists')) {
|
|
43
|
+
if (part.$scope === '$self')
|
|
44
|
+
this.error('ref-unexpected-self', part.$path, { '#': 'exists-filter', elemref: assoc.id, id: part.ref[0] });
|
|
39
45
|
for (const link of part._links) {
|
|
40
46
|
if (link.art && link.art.target) {
|
|
41
47
|
if (link.art.keys) { // managed - allow FK access
|
|
@@ -55,7 +61,7 @@ function checkForInvalidAssoc( assocs ) {
|
|
|
55
61
|
}
|
|
56
62
|
// Recursively drill down if the assoc-step has a filter
|
|
57
63
|
if (part.ref[link.idx].where)
|
|
58
|
-
|
|
64
|
+
ensureValidFilters.call(this, [ part.ref[link.idx] ]);
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
}
|
|
@@ -65,7 +71,7 @@ function checkForInvalidAssoc( assocs ) {
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
module.exports = {
|
|
68
|
-
having:
|
|
69
|
-
where:
|
|
70
|
-
xpr:
|
|
74
|
+
having: assertFilterOfExists,
|
|
75
|
+
where: assertFilterOfExists,
|
|
76
|
+
xpr: assertFilterOfExists,
|
|
71
77
|
};
|
|
@@ -13,8 +13,8 @@ function existsMustEndInAssoc( parent, prop, expression, path ) {
|
|
|
13
13
|
if (expression[i] === 'exists') {
|
|
14
14
|
const next = expression[i + 1];
|
|
15
15
|
const { _art } = next;
|
|
16
|
-
const errorPath = path.concat([ prop, i ]);
|
|
17
16
|
if (!next.SELECT && !_art?.target) {
|
|
17
|
+
const errorPath = path.concat([ prop, i ]);
|
|
18
18
|
this.error('ref-expecting-assoc', errorPath, {
|
|
19
19
|
'#': _art.type ? 'with-type' : 'std',
|
|
20
20
|
elemref: next,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A path following an “exists” predicate must always end in an association.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} parent
|
|
7
|
+
* @param {string} prop
|
|
8
|
+
* @param {Array} expression
|
|
9
|
+
* @param {CSN.Path} path
|
|
10
|
+
*/
|
|
11
|
+
function existsMustNotStartWithDollarSelf( parent, prop, expression, path ) {
|
|
12
|
+
for (let i = 0; i < expression?.length - 1; i++) {
|
|
13
|
+
if (expression[i] === 'exists') {
|
|
14
|
+
const next = expression[i + 1];
|
|
15
|
+
if (next.$scope === '$self') {
|
|
16
|
+
const errorPath = path.concat([ prop, i ]);
|
|
17
|
+
this.error('ref-unexpected-self', errorPath, {
|
|
18
|
+
'#': 'exists',
|
|
19
|
+
id: next.ref[0],
|
|
20
|
+
name: 'exists',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
having: existsMustNotStartWithDollarSelf,
|
|
29
|
+
where: existsMustNotStartWithDollarSelf,
|
|
30
|
+
xpr: existsMustNotStartWithDollarSelf,
|
|
31
|
+
};
|
package/lib/checks/validator.js
CHANGED
|
@@ -43,7 +43,8 @@ const { validateAssociationsInItems } = require('./arrayOfs');
|
|
|
43
43
|
const checkQueryForNoDBArtifacts = require('./queryNoDbArtifacts');
|
|
44
44
|
const checkExplicitlyNullableKeys = require('./nullableKeys');
|
|
45
45
|
const existsMustEndInAssoc = require('./existsMustEndInAssoc');
|
|
46
|
-
const
|
|
46
|
+
const existsMustNotStartWithDollarSelf = require('./existsMustNotStartWithDollarSelf');
|
|
47
|
+
const assertFilterOfExists = require('./existsExpressionsOnlyForeignKeys');
|
|
47
48
|
const checkPathsInStoredCalcElement = require('./checkPathsInStoredCalcElement');
|
|
48
49
|
const managedWithoutKeys = require('./managedWithoutKeys');
|
|
49
50
|
const {
|
|
@@ -85,7 +86,8 @@ const forRelationalDBArtifactValidators = [
|
|
|
85
86
|
const forRelationalDBCsnValidators = [
|
|
86
87
|
checkCdsMap,
|
|
87
88
|
existsMustEndInAssoc,
|
|
88
|
-
|
|
89
|
+
existsMustNotStartWithDollarSelf,
|
|
90
|
+
assertFilterOfExists,
|
|
89
91
|
navigationIntoMany,
|
|
90
92
|
checkPathsInStoredCalcElement,
|
|
91
93
|
featureFlags,
|
|
@@ -207,7 +207,7 @@ function assertConsistency( model, stage ) {
|
|
|
207
207
|
'elements', '$autoElement', '$uncheckedElements', '_origin', '_extensions',
|
|
208
208
|
'$requireElementAccess', '_effectiveType', '$effectiveSeqNo', '_deps',
|
|
209
209
|
'$calcDepElement', '$filtered', '$enclosed', '_parent',
|
|
210
|
-
'deprecated', '$
|
|
210
|
+
'deprecated', '$restricted',
|
|
211
211
|
],
|
|
212
212
|
schema: {
|
|
213
213
|
kind: { test: isString, enum: [ 'builtin' ] },
|
|
@@ -216,7 +216,7 @@ function assertConsistency( model, stage ) {
|
|
|
216
216
|
$uncheckedElements: { test: isBoolean },
|
|
217
217
|
$requireElementAccess: { test: isBoolean },
|
|
218
218
|
deprecated: { test: isBoolean },
|
|
219
|
-
$
|
|
219
|
+
$restricted: { test: TODO },
|
|
220
220
|
// missing location for normal "elements"
|
|
221
221
|
elements: { test: TODO },
|
|
222
222
|
},
|
|
@@ -480,6 +480,7 @@ function assertConsistency( model, stage ) {
|
|
|
480
480
|
},
|
|
481
481
|
query: { requires: [ 'query', 'location' ], optional: [ 'stored', '$parens' ] },
|
|
482
482
|
},
|
|
483
|
+
$calc: { kind: true, test: TODO }, // TODO: rename to `value`?
|
|
483
484
|
literal: { // TODO: check value against literal
|
|
484
485
|
test: isString,
|
|
485
486
|
enum: [
|
package/lib/compiler/builtins.js
CHANGED
|
@@ -211,8 +211,7 @@ const magicVariables = {
|
|
|
211
211
|
},
|
|
212
212
|
// Require that elements are accessed, i.e. no $draft, only $draft.<element>.
|
|
213
213
|
$requireElementAccess: true,
|
|
214
|
-
//
|
|
215
|
-
$onlyInExprCtx: [ 'annotation', 'annoRewrite' ],
|
|
214
|
+
$restricted: true, // only in annotation expression, see shared.js
|
|
216
215
|
},
|
|
217
216
|
};
|
|
218
217
|
|
|
@@ -454,8 +453,8 @@ function initBuiltins( model ) {
|
|
|
454
453
|
art.$requireElementAccess = magic.$requireElementAccess;
|
|
455
454
|
if (magic.deprecated)
|
|
456
455
|
art.deprecated = magic.deprecated;
|
|
457
|
-
if (magic.$
|
|
458
|
-
art.$
|
|
456
|
+
if (magic.$restricted)
|
|
457
|
+
art.$restricted = magic.$restricted;
|
|
459
458
|
|
|
460
459
|
createMagicElements( art, magic.elements );
|
|
461
460
|
if (options.variableReplacements?.[id])
|
|
@@ -480,8 +479,8 @@ function initBuiltins( model ) {
|
|
|
480
479
|
// Propagate this property so that it is available for sub-elements.
|
|
481
480
|
if (art.$uncheckedElements)
|
|
482
481
|
magic.$uncheckedElements = art.$uncheckedElements;
|
|
483
|
-
if (art.$
|
|
484
|
-
magic.$
|
|
482
|
+
if (art.$restricted)
|
|
483
|
+
magic.$restricted = art.$restricted;
|
|
485
484
|
setProp( magic, '_parent', art );
|
|
486
485
|
// setProp( magic, '_effectiveType', magic );
|
|
487
486
|
if (elements[id] && typeof elements[id] === 'object')
|
package/lib/compiler/checks.js
CHANGED
|
@@ -258,37 +258,46 @@ function check( model ) {
|
|
|
258
258
|
: xpr._artifact;
|
|
259
259
|
|
|
260
260
|
const typeArt = isSqlCast ? xpr : user;
|
|
261
|
-
if (!elem || !isSqlCast && typeArt.type?.$inferred)
|
|
262
|
-
return; // e.g. $inferred:'generated'
|
|
261
|
+
if (!elem || typeArt.$inferred || !isSqlCast && typeArt.type?.$inferred)
|
|
262
|
+
return; // e.g. $inferred: 'generated'
|
|
263
263
|
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
264
|
+
const typeItems = typeArt.items ?? typeArt;
|
|
265
|
+
|
|
266
|
+
// explicit type, elements, or items -> has type cast
|
|
267
|
+
const hasCast = typeItems.type ||
|
|
268
|
+
(typeItems.elements && !typeArt.expand && !typeArt.$expand && !elem.$expand);
|
|
269
|
+
|
|
270
|
+
if (!hasCast)
|
|
271
|
+
return;
|
|
272
|
+
|
|
273
|
+
const { type } = typeItems;
|
|
274
|
+
const loc = [ (type || typeItems).location, user ];
|
|
275
|
+
|
|
276
|
+
if (type?._artifact?._effectiveType?.name.id === 'cds.Map') {
|
|
277
|
+
error( 'type-invalid-cast', loc, { '#': 'std', type: 'cds.Map' } );
|
|
278
|
+
}
|
|
279
|
+
else if (elem.elements && !typeArt.$expand) { // TODO: calc elements
|
|
280
|
+
error( 'type-invalid-cast', loc, { '#': 'from-structure' } );
|
|
281
|
+
}
|
|
282
|
+
else if (elem.target && (typeArt.items || !type?._artifact?.target)) {
|
|
283
|
+
error( 'type-invalid-cast', loc, { '#': 'from-assoc' } );
|
|
284
|
+
}
|
|
285
|
+
else if ((typeArt.elements && !typeArt.$expand) || type?._artifact?.elements) {
|
|
286
|
+
error( 'type-invalid-cast', loc, { '#': 'to-structure' } );
|
|
287
|
+
}
|
|
288
|
+
else if (!elem.target && // referenced element is not association
|
|
279
289
|
!user.type?.$inferred && // $inferred types already reported in resolve.js.
|
|
280
290
|
(
|
|
281
291
|
// assoc used in SQL cast
|
|
282
|
-
type
|
|
292
|
+
type?._artifact?.target && isSqlCast ||
|
|
283
293
|
// there is a target and the type is a direct `cds.Association`;
|
|
284
294
|
// other types handled by resolver already.
|
|
285
|
-
|
|
295
|
+
typeItems.target && type?._artifact?.category === 'relation'
|
|
286
296
|
)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
297
|
+
) {
|
|
298
|
+
// - redirection-check in resolve.js already checks this for CDL-casts
|
|
299
|
+
// - `"cast": { "target": "…", "type": "cds.Association", … }` via CSN input.
|
|
300
|
+
error('type-invalid-cast', loc, { '#': 'assoc' });
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
|
|
@@ -827,8 +836,10 @@ function check( model ) {
|
|
|
827
836
|
error( 'ref-unexpected-structured', [ sourceLoc, elem ],
|
|
828
837
|
{ '#': 'struct-expr', elemref: xpr } );
|
|
829
838
|
}
|
|
830
|
-
else if (xpr._artifact.target !== undefined &&
|
|
831
|
-
|
|
839
|
+
else if (xpr._artifact.target !== undefined &&
|
|
840
|
+
(!lastStep.where || lastStep.where.args?.length === 0 || isStored)) {
|
|
841
|
+
// Allow using an association _with non-empty filter_, but only for on-read
|
|
842
|
+
// calculated elements.
|
|
832
843
|
// TODO: Also allow bare unmanaged association references and remove beta.
|
|
833
844
|
const variant = (isStored && lastStep.where && 'assoc-stored') ||
|
|
834
845
|
(isComposition( model, xpr._artifact ) && 'expr-comp') ||
|
package/lib/compiler/define.js
CHANGED
|
@@ -395,7 +395,7 @@ function define( model ) {
|
|
|
395
395
|
function addExtension( ext, block ) {
|
|
396
396
|
setLink( ext, '_block', block );
|
|
397
397
|
initExprAnnoBlock( ext, block );
|
|
398
|
-
const absolute = ext.name && resolveUncheckedPath( ext.name, '
|
|
398
|
+
const absolute = ext.name && resolveUncheckedPath( ext.name, '_uncheckedExtension', ext );
|
|
399
399
|
if (!absolute) // broken path
|
|
400
400
|
return;
|
|
401
401
|
delete ext.name.path[0]._artifact; // might point to wrong JS object in phase 1
|