@sap/cds-compiler 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +29 -9
  2. package/bin/cdsc.js +9 -16
  3. package/lib/api/main.js +92 -40
  4. package/lib/base/keywords.js +64 -1
  5. package/lib/base/message-registry.js +17 -1
  6. package/lib/base/messages.js +38 -28
  7. package/lib/base/optionProcessorHelper.js +53 -21
  8. package/lib/compiler/assert-consistency.js +1 -1
  9. package/lib/compiler/builtins.js +40 -1
  10. package/lib/compiler/define.js +4 -2
  11. package/lib/compiler/extend.js +4 -1
  12. package/lib/compiler/populate.js +3 -1
  13. package/lib/compiler/resolve.js +1 -4
  14. package/lib/compiler/shared.js +9 -0
  15. package/lib/compiler/utils.js +2 -2
  16. package/lib/edm/annotations/preprocessAnnotations.js +10 -11
  17. package/lib/edm/csn2edm.js +15 -14
  18. package/lib/edm/edm.js +13 -12
  19. package/lib/edm/edmPreprocessor.js +30 -33
  20. package/lib/edm/edmUtils.js +3 -39
  21. package/lib/gen/language.checksum +1 -1
  22. package/lib/gen/language.interp +1 -1
  23. package/lib/gen/languageParser.js +3311 -3289
  24. package/lib/json/from-csn.js +17 -19
  25. package/lib/json/to-csn.js +3 -2
  26. package/lib/language/genericAntlrParser.js +42 -42
  27. package/lib/language/language.g4 +28 -17
  28. package/lib/model/csnRefs.js +1 -0
  29. package/lib/model/csnUtils.js +19 -8
  30. package/lib/model/revealInternalProperties.js +4 -1
  31. package/lib/optionProcessor.js +54 -38
  32. package/lib/render/toHdbcds.js +1 -1
  33. package/lib/render/toSql.js +7 -3
  34. package/lib/transform/forOdataNew.js +3 -3
  35. package/lib/transform/localized.js +15 -11
  36. package/lib/utils/file.js +28 -18
  37. package/package.json +2 -3
  38. package/share/messages/syntax-expected-integer.md +9 -8
package/CHANGELOG.md CHANGED
@@ -7,27 +7,46 @@
7
7
  Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
 
10
+ ## Version 3.0.2 - 2022-07-05
11
+
12
+ ### Fixed
13
+
14
+ - to.sql: For `sqlDialect` `plain`, `$now` is replaced by `CURRENT_TIMESTAMP` again.
15
+ - compiler:
16
+ + Don't crash if a USING filename is invalid on the operating system, e.g. if `\0` is used.
17
+ + Info messages for annotations on localized convenience views are only emitted for unknown ones.
18
+ + Improve error message for an `extend` statement which had added a new element
19
+ and tried to extend that element further. Similarly for a new action.
20
+ (If you consider this really of any use, use two `extend` statements.)
21
+ - for.odata: expand `@readonly`/`@insertonly` on aspects as for entities into `@Capabilities`.
22
+ - to.edm(x):
23
+ + Exclude managed association as primary key on value list annotation preprocessing.
24
+ + Don't render annotations for aspects defined in a service.
25
+
10
26
  ## Version 3.0.0 - 2022-06-23
11
27
 
12
28
  ### Added
13
29
 
14
30
  - Instead of requiring all files on startup, they are required on an as-needed basis to reduce startup times.
15
- - Allow `*` as argument in SQL functions `count`, `min`, `max`, `sum`, `avg`, `stddev`, `var`.
31
+ - CDL parser: support SQL functions `locate_regexpr`, `occurrences_regexpr`,
32
+ `replace_regexpr` and `substring_regexpr` with their special argument syntax.
33
+ - CDL parser: the names `trim` and `extract` are not reserved anymore.
16
34
 
17
35
  ### Changed
18
36
 
19
37
  - cds-compiler now requires Node 14.
20
38
  - `compile()` and its derivates now use `fs.realpath.native()` instead of `fs.realpath()`.
21
- - Multi-line doc comments without leading `*` were inconsistently trimmed.
39
+ - CDL parser:
40
+ + Multi-line doc comments without leading `*` were inconsistently trimmed.
41
+ + As before, a structure value for an annotation assignment in a CDL source is flattened,
42
+ i.e. `@Anno: { foo: 1, @bar: 2 }` becomes `@Anno.foo: 1 @Anno.@bar: 2`.
43
+ Now, the structure property name `$value` is basically ignored:
44
+ `@Anno: { $value: 1, @bar: 2 }` becomes `@Anno: 1 @Anno.@bar: 2`.
45
+ The advantage is that overwriting or appending the annotation value works as expected.
46
+ + Keywords `not null` is only valid after `many String enum {...}` and no longer after `String`.
22
47
  - `@cds.persistence.skip` and `@cds.persistence.exists` are both copied to generated child artifacts
23
48
  such as localized convenience views, texts entities and managed compositions.
24
- - As before, a structure value for an annotation assignment in a CDL source is flattened,
25
- i.e. `@Anno: { foo: 1, @bar: 2 }` becomes `@Anno.foo: 1 @Anno.@bar: 2`.
26
- Now, the structure property name `$value` is basically ignored:
27
- `@Anno: { $value: 1, @bar: 2 }` becomes `@Anno: 1 @Anno.@bar: 2`.
28
- The advantage is that overwriting or appending the annotation value works as expected.
29
49
  - Update OData vocabularies 'Common', 'UI'.
30
- - Keywords `not null` is only valid after `many String enum {...}` and no longer after `String`.
31
50
  - (Sub-)Elements of localized convenience views can now be annotated, e.g. `annotate localized.E:elem`.
32
51
  - `getArtifactCdsPersistenceName` now enforces the `csn` argument and can optionally have the `sqlDialect` passed in.
33
52
  - `getElementCdsPersistenceName` can optionally have the `sqlDialect` passed in.
@@ -36,7 +55,8 @@ The compiler behavior concerning `beta` features can change at any time without
36
55
 
37
56
  - All v2 deprecated flags.
38
57
  - Keyword `masked`.
39
- - `*` as generic argument to SQL functions/expressions.
58
+ - CDL parser: `*` is not parsed anymore as argument to all SQL functions;
59
+ it is now only allowed for `count`, `min`, `max`, `sum`, `avg`, `stddev`, `var`.
40
60
  - All non-SNAPI options.
41
61
 
42
62
  ## Version 2.15.4 - 2022-06-09
package/bin/cdsc.js CHANGED
@@ -63,9 +63,6 @@ function remapCmdOptions(options, command) {
63
63
 
64
64
  for (const [ key, value ] of Object.entries(options[command])) {
65
65
  switch (key) {
66
- case 'names':
67
- options.sqlMapping = value;
68
- break;
69
66
  case 'user':
70
67
  if (!options.variableReplacements)
71
68
  options.variableReplacements = {};
@@ -73,12 +70,6 @@ function remapCmdOptions(options, command) {
73
70
  options.variableReplacements.$user = {};
74
71
  options.variableReplacements.$user.id = value;
75
72
  break;
76
- case 'dialect':
77
- options.sqlDialect = value;
78
- break;
79
- case 'version':
80
- options.odataVersion = value;
81
- break;
82
73
  case 'locale':
83
74
  if (!options.variableReplacements)
84
75
  options.variableReplacements = {};
@@ -89,9 +80,6 @@ function remapCmdOptions(options, command) {
89
80
  case 'serviceNames':
90
81
  options.serviceNames = value.split(',');
91
82
  break;
92
- case 'flavor':
93
- options.csnFlavor = value;
94
- break;
95
83
  default:
96
84
  options[key] = value;
97
85
  }
@@ -158,12 +146,17 @@ function cdsc_main() {
158
146
  if (cmdLine.options.rawOutput)
159
147
  cmdLine.options.attachValidNames = true;
160
148
 
161
- // Internally, parseCdl is an option so we map the command to it.
149
+ // Internally, parseCdl/parseOnly are options, so we map the command to it.
162
150
  if (cmdLine.command === 'parseCdl') {
163
151
  cmdLine.command = 'toCsn';
164
152
  cmdLine.options.parseCdl = true;
165
153
  cmdLine.args.files = [ cmdLine.args.file ];
166
154
  }
155
+ else if (cmdLine.command === 'parseOnly') {
156
+ cmdLine.command = 'toCsn';
157
+ cmdLine.options.parseOnly = true;
158
+ cmdLine.args.files = [ cmdLine.args.file ];
159
+ }
167
160
 
168
161
  if (cmdLine.options.directBackend)
169
162
  validateDirectBackendOption(cmdLine.command, cmdLine.options, cmdLine.args);
@@ -525,7 +518,7 @@ function executeCommandLine(command, options, args) {
525
518
  else if (options.internalMsg) {
526
519
  writeToFileOrDisplay(options.out, `${name}_raw.txt`, util.inspect(reveal(xsn).messages, { depth: null, maxArrayLength: null }), true);
527
520
  }
528
- else if (!options.lintMode) {
521
+ else if (!options.parseOnly) { // no output if parseOnly but not rawOutput
529
522
  const csn = compactModel(xsn, options);
530
523
  if (command === 'toCsn' && options.withLocalized)
531
524
  addLocalizationViews(csn, options);
@@ -545,7 +538,7 @@ function executeCommandLine(command, options, args) {
545
538
  if (options.internalMsg) {
546
539
  writeToFileOrDisplay(options.out, `${name}_raw.txt`, options.messages, true);
547
540
  }
548
- else if (!options.lintMode && !options.internalMsg) {
541
+ else if (!options.internalMsg) {
549
542
  if (command === 'toCsn' && options.withLocalized)
550
543
  addLocalizationViews(csn, options);
551
544
  writeToFileOrDisplay(options.out, `${name}.json`, csn, true);
@@ -558,7 +551,7 @@ function executeCommandLine(command, options, args) {
558
551
  // If displaying to stdout, prepend a headline containing 'filename', unless 'omitHeadline' is set.
559
552
  // For filenames, illegal characters (slash, backslash, colon) are replaced by '_'.
560
553
  function writeToFileOrDisplay(dir, fileName, content, omitHeadline = false) {
561
- if (options.lintMode && !options.rawOutput || options.internalMsg)
554
+ if (options.internalMsg)
562
555
  return;
563
556
  fileName = fileName.replace(/[:/\\]/g, '_');
564
557
 
package/lib/api/main.js CHANGED
@@ -226,6 +226,50 @@ function sql(csn, options = {}) {
226
226
  return result.map(obj => obj.sql).filter(create => create);
227
227
  }
228
228
 
229
+ /**
230
+ * Render the given deltaCSN as SQL.
231
+ *
232
+ * @param {CSN.Model} csn A clean input CSN
233
+ * @param {CSN.Model} deltaCsn A CSN representing new entities and extensions
234
+ * @param {SqlOptions} [options={}] Options
235
+ * @returns {object} - definitions: An array of objects with all artifacts in the after-image. Each object specifies
236
+ * the artifact filename, the suffix, and the corresponding SQL statement to create
237
+ * the artifact.
238
+ * - deletions: An array of objects with the deleted artifacts. Each object specifies the artifact
239
+ * filename and the suffix.
240
+ * - migrations: An array of objects with the changed (migrated) artifacts. Each object specifies the
241
+ * artifact filename, the suffix, and the changeset (an array of changes, each specifying
242
+ * whether it incurs potential data loss, and its respective SQL statement(s), with
243
+ * multiple statements concatenated as a multi-line string in case the change e.g.
244
+ * consists of a column drop and add).
245
+ */
246
+ function mtx(csn, deltaCsn, options = {}) {
247
+ if (!baseModel.isBetaEnabled(options, 'to.mtx'))
248
+ throw new Error('to.mtx is only available with beta flag `to.mtx`');
249
+
250
+ const internalOptions = prepareOptions.to.sql(options);
251
+ // TODO: Use compiler.compileSources() when this function is moved to lib/main.js
252
+ const merged = toCsn.compactModel(compiler.compileSourcesX({ 'base.csn': csn, 'delta.csn': deltaCsn }), options);
253
+ const baseSql = forSql(csn, options);
254
+ const mergedSql = forSql(merged, options);
255
+ const diff = modelCompare.compareModels(baseSql, mergedSql, options);
256
+ // Delete artifacts that are already present in csn
257
+ Object.keys(baseSql.definitions).forEach((artifactName) => {
258
+ if (diff.definitions[artifactName]) // don't render again, but need info for primary key extension
259
+ diff.definitions[artifactName]['@cds.persistence.skip'] = true;
260
+ });
261
+
262
+ internalOptions.forHana = true;
263
+ internalOptions.beta.sqlExtensions = true;
264
+ const { deletions, migrations, ...additions } = toSql.toSqlDdl(diff, internalOptions);
265
+
266
+ return {
267
+ additions: createSqlDefinitions(additions, mergedSql),
268
+ deletions: createSqlDeletions(deletions, baseSql),
269
+ migrations: createSqlMigrations(migrations, mergedSql),
270
+ };
271
+ }
272
+
229
273
  /**
230
274
  * Process the given CSN into HDI artifacts.
231
275
  *
@@ -357,49 +401,55 @@ function hdiMigration(csn, options, beforeImage) {
357
401
 
358
402
  return {
359
403
  afterImage,
360
- definitions: createDefinitions(),
361
- deletions: createDeletions(),
362
- migrations: createMigrations(),
404
+ definitions: createSqlDefinitions(hdbkinds, afterImage),
405
+ deletions: createSqlDeletions(deletions, beforeImage),
406
+ migrations: createSqlMigrations(migrations, afterImage),
363
407
  };
408
+ }
364
409
 
365
- /**
366
- * From the given HDI artifacts, create the the correct result structure.
367
- *
368
- * @returns {object[]} Array of objects, each having: name, suffix and sql
369
- */
370
- function createDefinitions() {
371
- const result = [];
372
- forEach(hdbkinds, (kind, artifacts) => {
373
- const suffix = `.${ kind }`;
374
- forEach(artifacts, (name, sqlStatement) => {
375
- if ( kind !== 'hdbindex' )
376
- result.push({ name: getFileName(name, afterImage), suffix, sql: sqlStatement });
377
- else
378
- result.push({ name, suffix, sql: sqlStatement });
379
- });
410
+ /**
411
+ * From the given SQLs, create the the correct result structure.
412
+ *
413
+ * @param {object} hdbkinds
414
+ * @param {CSN.Model} afterImage
415
+ * @returns {object[]} Array of objects, each having: name, suffix and sql
416
+ */
417
+ function createSqlDefinitions(hdbkinds, afterImage) {
418
+ const result = [];
419
+ forEach(hdbkinds, (kind, artifacts) => {
420
+ const suffix = `.${ kind }`;
421
+ forEach(artifacts, (name, sqlStatement) => {
422
+ if ( kind !== 'hdbindex' )
423
+ result.push({ name: getFileName(name, afterImage), suffix, sql: sqlStatement });
424
+ else
425
+ result.push({ name, suffix, sql: sqlStatement });
380
426
  });
381
- return result;
382
- }
383
- /**
384
- * From the given deletions, create the correct result structure.
385
- *
386
- * @returns {object[]} Array of objects, each having: name and suffix - only .hdbtable as suffix for now
387
- */
388
- function createDeletions() {
389
- const result = [];
390
- forEach(deletions, name => result.push({ name: getFileName(name, beforeImage), suffix: '.hdbtable' }));
391
- return result;
392
- }
393
- /**
394
- * From the given migrations, create the correct result structure.
395
- *
396
- * @returns {object[]} Array of objects, each having: name, suffix and changeset.
397
- */
398
- function createMigrations() {
399
- const result = [];
400
- forEach(migrations, (name, changeset) => result.push({ name: getFileName(name, afterImage), suffix: '.hdbmigrationtable', changeset }));
401
- return result;
402
- }
427
+ });
428
+ return result;
429
+ }
430
+ /**
431
+ * From the given deletions, create the correct result structure.
432
+ *
433
+ * @param {object} deletions
434
+ * @param {CSN.Model} beforeImage
435
+ * @returns {object[]} Array of objects, each having: name and suffix - only .hdbtable as suffix for now
436
+ */
437
+ function createSqlDeletions(deletions, beforeImage) {
438
+ const result = [];
439
+ forEach(deletions, name => result.push({ name: getFileName(name, beforeImage), suffix: '.hdbtable' }));
440
+ return result;
441
+ }
442
+ /**
443
+ * From the given migrations, create the correct result structure.
444
+ *
445
+ * @param {object} migrations
446
+ * @param {CSN.Model} afterImage
447
+ * @returns {object[]} Array of objects, each having: name, suffix and changeset.
448
+ */
449
+ function createSqlMigrations(migrations, afterImage) {
450
+ const result = [];
451
+ forEach(migrations, (name, changeset) => result.push({ name: getFileName(name, afterImage), suffix: '.hdbmigrationtable', changeset }));
452
+ return result;
403
453
  }
404
454
 
405
455
  hdi.migration = hdiMigration;
@@ -649,6 +699,8 @@ module.exports = {
649
699
  for_sql: publishCsnProcessor(forSql, 'for.sql'),
650
700
  for_hdi: publishCsnProcessor(forHdi, 'for.hdi'),
651
701
  for_hdbcds: publishCsnProcessor(forHdbcds, 'for.hdbcds'),
702
+ /** beta - WIP */
703
+ mtx: publishCsnProcessor(mtx, 'to.mtx'),
652
704
  /** Deprecated, will be removed in cds-compiler@v4 */
653
705
  preparedCsnToEdmx,
654
706
  preparedCsnToEdm,
@@ -190,7 +190,7 @@ module.exports = {
190
190
  // SAP HANA keywords, used for smart quoting in to-hdi.plain
191
191
  // Taken from https://help.sap.com/viewer/7c78579ce9b14a669c1f3295b0d8ca16/Cloud/en-US/28bcd6af3eb6437892719f7c27a8a285.html
192
192
  // Better use keywords in ptime/query/parser/syntax/qp_keyword.cc minus those
193
- // in rule unreserved_keyword_column (=…_common - "CONSTRAINT") in
193
+ // in rule unreserved_keyword_column (=…_common - 'CONSTRAINT') in
194
194
  // ptime/query/parser/syntax/qp_gram.y of the HANA sources.
195
195
  hana: [
196
196
  'ABAPITAB',
@@ -209,12 +209,16 @@ module.exports = {
209
209
  'ABAP_STRING',
210
210
  'ABAP_TIME',
211
211
  'ABAP_XSTRING',
212
+ 'ABS',
213
+ 'ACOS',
212
214
  'ADD_DAYS',
213
215
  'ADD_MONTHS',
214
216
  'ADD_SECONDS',
215
217
  'ADD_YEARS',
218
+ 'ADJACENCY',
216
219
  'ADOPT',
217
220
  'ALL',
221
+ 'ALPHANUM',
218
222
  'ALTER',
219
223
  'ANALYTIC',
220
224
  'ANY',
@@ -222,7 +226,11 @@ module.exports = {
222
226
  'ARRAY',
223
227
  'ARRAY_AGG',
224
228
  'AS',
229
+ 'ASCII',
230
+ 'ASIN',
225
231
  'AT',
232
+ 'ATAN',
233
+ 'ATAN2',
226
234
  'AUTHORIZATION',
227
235
  'AUTO',
228
236
  'AVG',
@@ -240,6 +248,9 @@ module.exports = {
240
248
  'BIND_DOUBLE',
241
249
  'BIND_NCHAR',
242
250
  'BIND_REAL',
251
+ 'BINTEXT',
252
+ 'BINTOHEX',
253
+ 'BITAND',
243
254
  'BLOB',
244
255
  'BOOLEAN',
245
256
  'BOTH',
@@ -249,9 +260,25 @@ module.exports = {
249
260
  'BY',
250
261
  'CASE',
251
262
  'CAST',
263
+ 'CEIL',
264
+ 'CEILING',
265
+ 'CE_AGGREGATION',
252
266
  'CE_CALC',
267
+ 'CE_CALC_VIEW',
268
+ 'CE_COLUMN_TABLE',
269
+ 'CE_COMM2R',
270
+ 'CE_CONVERSION',
271
+ 'CE_FULL_OUTER_JOIN',
253
272
  'CE_JOIN',
273
+ 'CE_JOIN_VIEW',
274
+ 'CE_LEFT_OUTER_JOIN',
275
+ 'CE_MERGE',
276
+ 'CE_OLAP_VIEW',
277
+ 'CE_PARTITION',
254
278
  'CE_PROJECTION',
279
+ 'CE_RIGHT_OUTER_JOIN',
280
+ 'CE_UNION_ALL',
281
+ 'CE_VERTICAL_UNION',
255
282
  'CHAR',
256
283
  'CHARACTER',
257
284
  'CLOB',
@@ -262,8 +289,12 @@ module.exports = {
262
289
  'CONNECT',
263
290
  'CONSTANT',
264
291
  'CONSTRAINT',
292
+ 'COS',
293
+ 'COSH',
294
+ 'COT',
265
295
  'COUNT',
266
296
  'CROSS',
297
+ 'CS_ALPHANUM',
267
298
  'CS_DATE',
268
299
  'CS_DAYDATE',
269
300
  'CS_DECIMAL_FLOAT',
@@ -285,6 +316,7 @@ module.exports = {
285
316
  'CS_TEXT',
286
317
  'CS_TEXT_AE',
287
318
  'CS_TIME',
319
+ 'CS_ZONE',
288
320
  'CUBE',
289
321
  'CUME_DIST',
290
322
  'CURDATE',
@@ -313,6 +345,7 @@ module.exports = {
313
345
  'DAYOFWEEK',
314
346
  'DAYS_BETWEEN',
315
347
  'DDIC_ACCP',
348
+ 'DDIC_ALNM',
316
349
  'DDIC_CDAY',
317
350
  'DDIC_CHAR',
318
351
  'DDIC_CLNT',
@@ -373,12 +406,14 @@ module.exports = {
373
406
  'EXCEPTION',
374
407
  'EXEC',
375
408
  'EXISTS',
409
+ 'EXP',
376
410
  'EXTRACT',
377
411
  'FALSE',
378
412
  'FILTER',
379
413
  'FIRST_VALUE',
380
414
  'FLATTEN',
381
415
  'FLOAT',
416
+ 'FLOOR',
382
417
  'FOR',
383
418
  'FORCE_FIRST_PASSWORD_CHANGE',
384
419
  'FREESTYLESEARCHATTRIBUTE',
@@ -390,6 +425,7 @@ module.exports = {
390
425
  'GROUPING',
391
426
  'GROUPING_FILTER',
392
427
  'GROUPING_ID',
428
+ 'GROUP_SCORE',
393
429
  'HASANYPRIVILEGES',
394
430
  'HASSYSTEMPRIVILEGE',
395
431
  'HAVING',
@@ -403,6 +439,7 @@ module.exports = {
403
439
  'HIERARCHY_SIBLINGS',
404
440
  'HIERARCHY_SPANTREE',
405
441
  'HIERARCHY_TEMPORAL',
442
+ 'HIGHLIGHTED',
406
443
  'HILBERT',
407
444
  'HOST',
408
445
  'HOUR',
@@ -426,10 +463,12 @@ module.exports = {
426
463
  'JSON_TABLE',
427
464
  'JSON_VALUE',
428
465
  'LAG',
466
+ 'LANGUAGE',
429
467
  'LAST_DAY',
430
468
  'LAST_VALUE',
431
469
  'LATERAL',
432
470
  'LAYOUT',
471
+ 'LCASE',
433
472
  'LEAD',
434
473
  'LEADING',
435
474
  'LEAST',
@@ -439,10 +478,13 @@ module.exports = {
439
478
  'LENGTHB',
440
479
  'LEVELS',
441
480
  'LIMIT',
481
+ 'LN',
442
482
  'LOCATE',
443
483
  'LOCATE_REGEXPR',
484
+ 'LOG',
444
485
  'LONGDATE',
445
486
  'LOOP',
487
+ 'LOWER',
446
488
  'LPAD',
447
489
  'LTRIM',
448
490
  'MAP',
@@ -450,9 +492,11 @@ module.exports = {
450
492
  'MAP_REDUCE',
451
493
  'MAX',
452
494
  'MEASURES',
495
+ 'MIMETYPE',
453
496
  'MIN',
454
497
  'MINUS',
455
498
  'MINUTE',
499
+ 'MOD',
456
500
  'MONTH',
457
501
  'MULTIPARENT',
458
502
  'NATURAL',
@@ -486,9 +530,11 @@ module.exports = {
486
530
  'PERCENTILE_DISC',
487
531
  'PERCENT_RANK',
488
532
  'PLAIN',
533
+ 'POWER',
489
534
  'PRIOR',
490
535
  'PRODUCT',
491
536
  'RANGE',
537
+ 'RANGE_RESTRICTION',
492
538
  'RANK',
493
539
  'RAW',
494
540
  'RDICT',
@@ -525,11 +571,17 @@ module.exports = {
525
571
  'SESSION_CONTEXT',
526
572
  'SESSION_USER',
527
573
  'SET',
574
+ 'SHORTTEXT',
528
575
  'SIBLING',
576
+ 'SIGN',
577
+ 'SIN',
578
+ 'SINH',
529
579
  'SMALLDECIMAL',
530
580
  'SMALLINT',
581
+ 'SNIPPETS',
531
582
  'SOME',
532
583
  'SQL',
584
+ 'SQRT',
533
585
  'START',
534
586
  'STDDEV',
535
587
  'STRING',
@@ -537,6 +589,7 @@ module.exports = {
537
589
  'ST_ALPHASHAPEAGGR',
538
590
  'ST_ALPHASHAPEAREAAGGR',
539
591
  'ST_ALPHASHAPEEDGEAGGR',
592
+ 'ST_ASMVT',
540
593
  'ST_ASSVGAGGR',
541
594
  'ST_CIRCULARSTRING',
542
595
  'ST_CLUSTERCELL',
@@ -552,6 +605,7 @@ module.exports = {
552
605
  'ST_FROMTEXT',
553
606
  'ST_GEOMETRY',
554
607
  'ST_GEOMETRYCOLLECTION',
608
+ 'ST_GEOMFROMESRIJSON',
555
609
  'ST_GEOMFROMEWKB',
556
610
  'ST_GEOMFROMEWKT',
557
611
  'ST_GEOMFROMGEOHASH',
@@ -562,6 +616,8 @@ module.exports = {
562
616
  'ST_INTERSECTIONAGGR',
563
617
  'ST_LINESTRING',
564
618
  'ST_MAKELINE',
619
+ 'ST_MAKEPOLYGON',
620
+ 'ST_MEMORY_LOB',
565
621
  'ST_MULTILINESTRING',
566
622
  'ST_MULTIPOINT',
567
623
  'ST_MULTIPOLYGON',
@@ -586,9 +642,12 @@ module.exports = {
586
642
  'TABLE',
587
643
  'TABLES',
588
644
  'TABLESAMPLE',
645
+ 'TAN',
646
+ 'TANH',
589
647
  'TARGET',
590
648
  'TEMPORARY',
591
649
  'TEXT',
650
+ 'TEXT_FILTER',
592
651
  'THEN',
593
652
  'THREAD',
594
653
  'TIME',
@@ -614,6 +673,7 @@ module.exports = {
614
673
  'TO_CHAR',
615
674
  'TO_CLOB',
616
675
  'TO_DATE',
676
+ 'TO_DATS',
617
677
  'TO_DECIMAL',
618
678
  'TO_DOUBLE',
619
679
  'TO_INT',
@@ -642,9 +702,12 @@ module.exports = {
642
702
  'TRIGGER_UPDATE_COLUMN',
643
703
  'TRIM',
644
704
  'TRUE',
705
+ 'UCASE',
706
+ 'UNICODE',
645
707
  'UNION',
646
708
  'UNKNOWN',
647
709
  'UNNEST',
710
+ 'UPPER',
648
711
  'USER',
649
712
  'USING',
650
713
  'UTCTIMESTAMP',
@@ -176,6 +176,15 @@ const centralMessages = {
176
176
  // The keys will be added to `oldNames` of the new message, which is used for reclassification.
177
177
  const oldMessageIds = createDict({
178
178
  'old-anno-duplicate': 'anno-duplicate', // Example
179
+
180
+ // These IDs are used by large stakeholders. If we change them, we should
181
+ // be backward-compatible.
182
+ // 'redirected-to-complex': 'TODO',
183
+ // 'wildcard-excluding-one': 'TODO',
184
+ // 'wildcard-excluding-many': 'TODO',
185
+ // 'assoc-outside-service': 'TODO',
186
+ // 'redirected-to-same': 'TODO',
187
+ // 'query-navigate-many': 'TODO',
179
188
  });
180
189
 
181
190
  // Set up the old-to-new message ID mapping in the message registry.
@@ -197,7 +206,7 @@ for (const oldName in oldMessageIds) {
197
206
  const centralMessageTexts = {
198
207
  'api-invalid-option': {
199
208
  std: 'Option $(NAME) is deprecated! Use SNAPI options instead',
200
- magicVars: 'Option “magicVars” is deprecated! Use “variableReplacements” instead. See <https://cap.cloud.sap/docs/guides/databases#configuring-variables> for details',
209
+ magicVars: 'Option “magicVars” is no longer supported! Use “variableReplacements” instead. See <https://cap.cloud.sap/docs/guides/databases#configuring-variables> for details',
201
210
  user: 'Option “variableReplacements” expects “$user” instead of “user”. See <https://cap.cloud.sap/docs/guides/databases#configuring-variables> for details',
202
211
  locale: 'Option “variableReplacements” expects “$user.locale” instead of “locale”. See <https://cap.cloud.sap/docs/guides/databases#configuring-variables> for details',
203
212
  'noDollar': 'Option “variableReplacements” does not know $(NAME). Did you forget a leading “$”?'
@@ -267,6 +276,12 @@ const centralMessageTexts = {
267
276
  unknown: 'Unknown argument $(CODE)',
268
277
  duplicate: 'Duplicate argument $(CODE)',
269
278
  },
279
+ 'syntax-duplicate-annotate': 'You shouldn\'t refer to $(NAME) repeatedly in the same annotate statement',
280
+ 'syntax-duplicate-extend': {
281
+ std: 'You can\'t define and refer to $(NAME) repeatedly in the same extend statement',
282
+ define: 'You can\'t refer to $(NAME) in the same extend statement where it was defined',
283
+ extend: 'You can\'t refer to $(NAME) repeatedly in the same extend statement',
284
+ },
270
285
  'syntax-invalid-literal': {
271
286
  'std': 'Invalid literal',
272
287
  'uneven-hex': 'A binary literal must have an even number of characters',
@@ -312,6 +327,7 @@ const centralMessageTexts = {
312
327
  event: 'Unexpected $(KEYWORD) for the type of an event',
313
328
  param: 'Unexpected $(KEYWORD) for the type of a parameter definition',
314
329
  select: 'Unexpected $(KEYWORD) for type references in queries',
330
+ annotation: '$(KEYWORD) can\'t be used in annotation definitions',
315
331
  },
316
332
 
317
333
  'type-missing-argument': 'Missing value for argument $(NAME) in reference to type $(ID)',