@abapify/acds 0.4.15 → 0.4.16
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/README.md +153 -14
- package/dist/index.d.mts +427 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3091 -245
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -68,7 +68,7 @@ interface NamedTypeRef extends AstNode {
|
|
|
68
68
|
name: string;
|
|
69
69
|
}
|
|
70
70
|
type TypeRef = BuiltinTypeRef | NamedTypeRef;
|
|
71
|
-
/** Field in a table/structure/
|
|
71
|
+
/** Field in a table/structure/table-entity/external-entity body */
|
|
72
72
|
interface FieldDefinition extends AstNode {
|
|
73
73
|
annotations: Annotation[];
|
|
74
74
|
name: string;
|
|
@@ -83,11 +83,15 @@ interface IncludeDirective extends AstNode {
|
|
|
83
83
|
suffix?: string;
|
|
84
84
|
}
|
|
85
85
|
type TableMember = FieldDefinition | IncludeDirective;
|
|
86
|
-
/** define table <name> { ... } */
|
|
86
|
+
/** define [root] table [entity] <name> { ... } */
|
|
87
87
|
interface TableDefinition extends AstNode {
|
|
88
88
|
kind: 'table';
|
|
89
89
|
name: string;
|
|
90
90
|
annotations: Annotation[];
|
|
91
|
+
/** `true` for `define table entity` (CDS table entity, no DDIC table). */
|
|
92
|
+
entity?: boolean;
|
|
93
|
+
/** `true` for `define root table entity`. */
|
|
94
|
+
root?: boolean;
|
|
91
95
|
members: TableMember[];
|
|
92
96
|
}
|
|
93
97
|
/** define structure <name> { ... } */
|
|
@@ -116,9 +120,11 @@ interface ExposeStatement extends AstNode {
|
|
|
116
120
|
entity: string;
|
|
117
121
|
alias?: string;
|
|
118
122
|
}
|
|
119
|
-
/** annotate entity <name> with { ... } */
|
|
123
|
+
/** annotate entity|view <name> with { ... } */
|
|
120
124
|
interface MetadataExtension extends AstNode {
|
|
121
125
|
kind: 'metadataExtension';
|
|
126
|
+
/** `entity` for `annotate entity`, `view` for `annotate view`. */
|
|
127
|
+
targetKind?: 'entity' | 'view';
|
|
122
128
|
entity: string;
|
|
123
129
|
annotations: Annotation[];
|
|
124
130
|
elements: AnnotatedElement[];
|
|
@@ -152,27 +158,163 @@ interface Cardinality extends AstNode {
|
|
|
152
158
|
/** `undefined` means unbounded (`*`) when present. */
|
|
153
159
|
max?: number | '*';
|
|
154
160
|
}
|
|
161
|
+
/** A cardinality bound written in words: `one`, `exact one` or `many`. */
|
|
162
|
+
type CardinalityWord = 'one' | 'exactOne' | 'many';
|
|
163
|
+
/**
|
|
164
|
+
* Word-form cardinality: `of {many|one|exact one} [to] <target>`
|
|
165
|
+
* for associations, and `[{one|many|exact one}] to {one|exact one|many}`
|
|
166
|
+
* for joins (`many to one join`, `to one join`).
|
|
167
|
+
*/
|
|
168
|
+
interface WordCardinality extends AstNode {
|
|
169
|
+
/**
|
|
170
|
+
* Source-side bound — only populated by join cardinalities
|
|
171
|
+
* (`many to one join`); `of`-form associations keep a single `target`.
|
|
172
|
+
*/
|
|
173
|
+
source?: CardinalityWord;
|
|
174
|
+
/** Target-side bound. */
|
|
175
|
+
target: CardinalityWord;
|
|
176
|
+
}
|
|
155
177
|
type AssociationKind = 'association' | 'composition';
|
|
156
178
|
interface AssociationDeclaration extends AstNode {
|
|
157
179
|
kind: 'association';
|
|
158
180
|
/** `association` or `composition` */
|
|
159
181
|
associationKind: AssociationKind;
|
|
160
182
|
annotations: Annotation[];
|
|
183
|
+
/** Bracket-form cardinality `[min..max]` / `[*]` / `[n]`. */
|
|
161
184
|
cardinality?: Cardinality;
|
|
185
|
+
/**
|
|
186
|
+
* Word-form cardinality (`of many to one X`, `to exact one X`).
|
|
187
|
+
* Absent when the bracket form is used or no cardinality is given.
|
|
188
|
+
*/
|
|
189
|
+
wordCardinality?: WordCardinality;
|
|
162
190
|
/** `of many` / `of one` modifier (optional). */
|
|
163
191
|
targetMultiplicity?: 'many' | 'one';
|
|
192
|
+
/** `association to parent <target>` (CDS to-parent association). */
|
|
193
|
+
toParent?: boolean;
|
|
164
194
|
/** Fully qualified target entity (e.g. `I_SalesOrder`). */
|
|
165
195
|
target: string;
|
|
166
196
|
/** `to redirected to <target>` (projection association). */
|
|
167
197
|
redirected?: boolean;
|
|
168
198
|
alias?: string;
|
|
169
199
|
on?: Expression;
|
|
200
|
+
/** `with default filter <condition>` — projection associations. */
|
|
201
|
+
withDefaultFilter?: Expression;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* `redefine association|composition <name> [<filter>] [as <alias>]
|
|
205
|
+
* [redirected to …]` — a redefined association of a projection view,
|
|
206
|
+
* declared in the header before the projection list.
|
|
207
|
+
*/
|
|
208
|
+
interface RedefinedAssociation extends AstNode {
|
|
209
|
+
kind: 'redefinedAssociation';
|
|
210
|
+
associationKind: AssociationKind;
|
|
211
|
+
/** Qualified association name (optionally `source._assoc`). */
|
|
212
|
+
name: string;
|
|
213
|
+
/** Filter clause `[<card>:] <cond>` (raw, opaque). */
|
|
214
|
+
filter?: Expression;
|
|
215
|
+
alias?: string;
|
|
216
|
+
redirectedTo?: AssociationRedirection;
|
|
217
|
+
}
|
|
218
|
+
/** `redirected to [composition child|parent] <target>` */
|
|
219
|
+
interface AssociationRedirection extends AstNode {
|
|
220
|
+
/** `default` = `redirected to`, else `composition child` / `parent`. */
|
|
221
|
+
mode: 'default' | 'compositionChild' | 'parent';
|
|
222
|
+
target: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* `bind aspect <aspect> ( <element> => <target>, … ) [as <alias>]`
|
|
226
|
+
* — an aspect binding in the FROM region or projection view header.
|
|
227
|
+
*/
|
|
228
|
+
interface AspectBinding extends AstNode {
|
|
229
|
+
kind: 'aspectBinding';
|
|
230
|
+
/** Bound aspect entity name. */
|
|
231
|
+
aspect: string;
|
|
232
|
+
mappings: AspectBindingMapping[];
|
|
233
|
+
alias?: string;
|
|
234
|
+
}
|
|
235
|
+
interface AspectBindingMapping extends AstNode {
|
|
236
|
+
/** Aspect element name. */
|
|
237
|
+
element: string;
|
|
238
|
+
/** Binding target, e.g. `$projection.field` (raw operand text). */
|
|
239
|
+
target: string;
|
|
170
240
|
}
|
|
171
241
|
type DataSourceKind = 'select' | 'projection';
|
|
242
|
+
/**
|
|
243
|
+
* Normalized join type.
|
|
244
|
+
*
|
|
245
|
+
* The different surface spellings are folded into one vocabulary so that
|
|
246
|
+
* downstream consumers (dependency / lineage tooling) do not have to know
|
|
247
|
+
* about surface syntax:
|
|
248
|
+
*
|
|
249
|
+
* | spelling | normalized |
|
|
250
|
+
* |-----------------------|--------------|
|
|
251
|
+
* | `JOIN` | `inner` |
|
|
252
|
+
* | `INNER JOIN` | `inner` |
|
|
253
|
+
* | `LEFT JOIN` | `leftOuter` |
|
|
254
|
+
* | `LEFT OUTER JOIN` | `leftOuter` |
|
|
255
|
+
* | `RIGHT JOIN` | `rightOuter` |
|
|
256
|
+
* | `RIGHT OUTER JOIN` | `rightOuter` |
|
|
257
|
+
* | `FULL JOIN` | `fullOuter` |
|
|
258
|
+
* | `FULL OUTER JOIN` | `fullOuter` |
|
|
259
|
+
* | `CROSS JOIN` | `cross` |
|
|
260
|
+
*/
|
|
261
|
+
type JoinType = 'inner' | 'leftOuter' | 'rightOuter' | 'fullOuter' | 'cross';
|
|
262
|
+
/**
|
|
263
|
+
* A single parameter binding of a parameterized data source.
|
|
264
|
+
*
|
|
265
|
+
* `value` keeps the original binding text, e.g. `:P_StartDate` (reference to
|
|
266
|
+
* a parameter of the consuming view), `$session.client` / `$parameters.P_X`
|
|
267
|
+
* (system variable) or a literal such as `'X'` / `42`.
|
|
268
|
+
*/
|
|
269
|
+
interface DataSourceParameter extends AstNode {
|
|
270
|
+
/** Name of the target parameter, e.g. `P_StartDate`. */
|
|
271
|
+
name: string;
|
|
272
|
+
/** Raw binding text as written in the source. */
|
|
273
|
+
value: string;
|
|
274
|
+
}
|
|
275
|
+
/** A data source in a FROM clause: a view, table, projection or parameter. */
|
|
172
276
|
interface DataSource extends AstNode {
|
|
173
277
|
name: string;
|
|
174
278
|
alias?: string;
|
|
279
|
+
/** Parameter bindings — present for parameterized sources only. */
|
|
280
|
+
parameters?: DataSourceParameter[];
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* A parenthesized join group: `join (A join B on …) on …`.
|
|
284
|
+
* The group acts as a single join source; its `joins` chain is evaluated
|
|
285
|
+
* inside the parentheses.
|
|
286
|
+
*/
|
|
287
|
+
interface JoinGroup extends AstNode {
|
|
288
|
+
kind: 'joinGroup';
|
|
289
|
+
source: JoinSource;
|
|
290
|
+
joins: JoinClause[];
|
|
291
|
+
}
|
|
292
|
+
/** A join source is either a plain data source or a parenthesized group. */
|
|
293
|
+
type JoinSource = DataSource | JoinGroup;
|
|
294
|
+
/** A join whose `ON` condition is required (inner/left/right/full). */
|
|
295
|
+
interface ConditionedJoinClause extends AstNode {
|
|
296
|
+
kind: 'join';
|
|
297
|
+
joinType: 'inner' | 'leftOuter' | 'rightOuter' | 'fullOuter';
|
|
298
|
+
source: JoinSource;
|
|
299
|
+
/** The `ON` condition, captured opaquely — always present. */
|
|
300
|
+
on: Expression;
|
|
301
|
+
/** Optional word-form join cardinality (`many to one join`). */
|
|
302
|
+
cardinality?: WordCardinality;
|
|
303
|
+
}
|
|
304
|
+
/** A cross join — never carries an `ON` condition. */
|
|
305
|
+
interface CrossJoinClause extends AstNode {
|
|
306
|
+
kind: 'join';
|
|
307
|
+
joinType: 'cross';
|
|
308
|
+
source: JoinSource;
|
|
309
|
+
on?: never;
|
|
310
|
+
cardinality?: never;
|
|
175
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* A join in a FROM clause. The discriminated union encodes the grammar
|
|
314
|
+
* invariant: `on` is mandatory for conditioned joins and forbidden for
|
|
315
|
+
* `cross` joins.
|
|
316
|
+
*/
|
|
317
|
+
type JoinClause = ConditionedJoinClause | CrossJoinClause;
|
|
176
318
|
/** Single element in a view's projection list. */
|
|
177
319
|
interface ViewElement extends AstNode {
|
|
178
320
|
annotations: Annotation[];
|
|
@@ -182,21 +324,90 @@ interface ViewElement extends AstNode {
|
|
|
182
324
|
/** Either a typed field (abstract/custom entities) or projection expression. */
|
|
183
325
|
expression: string;
|
|
184
326
|
alias?: string;
|
|
327
|
+
/** `<element> : localized` (projection views). */
|
|
328
|
+
localized?: boolean;
|
|
329
|
+
/** `<assoc> : redirected to [composition child|parent] <target>`. */
|
|
330
|
+
redirectedTo?: AssociationRedirection;
|
|
185
331
|
/** Present only when element is a typed field (`name : type`). */
|
|
186
332
|
type?: TypeRef;
|
|
187
333
|
notNull?: boolean;
|
|
188
334
|
}
|
|
189
335
|
type ViewMember = ViewElement | AssociationDeclaration;
|
|
336
|
+
/**
|
|
337
|
+
* The `select` part of a view entity (or a set-operation operand):
|
|
338
|
+
* `select [distinct] from <source> [joins|assocs|bind aspect] { … }
|
|
339
|
+
* [where …] [group by …] [having …] [union|intersect|except …]*`.
|
|
340
|
+
*/
|
|
341
|
+
interface SelectStatement extends AstNode {
|
|
342
|
+
kind: 'selectStatement';
|
|
343
|
+
distinct?: boolean;
|
|
344
|
+
source: DataSource;
|
|
345
|
+
joins: JoinClause[];
|
|
346
|
+
fromAssociations?: AssociationDeclaration[];
|
|
347
|
+
aspectBindings?: AspectBinding[];
|
|
348
|
+
members: ViewMember[];
|
|
349
|
+
where?: Expression;
|
|
350
|
+
groupBy?: string[];
|
|
351
|
+
having?: Expression;
|
|
352
|
+
setOperations?: SetOperation[];
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* `union [all] | intersect | except select …` — a set operation whose operand
|
|
356
|
+
* is a complete nested select statement.
|
|
357
|
+
*/
|
|
358
|
+
interface SetOperation extends AstNode {
|
|
359
|
+
kind: 'setOperation';
|
|
360
|
+
operator: 'union' | 'unionAll' | 'intersect' | 'except';
|
|
361
|
+
statement: SelectStatement;
|
|
362
|
+
}
|
|
190
363
|
interface ViewEntityDefinition extends AstNode {
|
|
191
364
|
kind: 'viewEntity';
|
|
192
365
|
name: string;
|
|
193
366
|
annotations: Annotation[];
|
|
367
|
+
/**
|
|
368
|
+
* `true` for the legacy `define view <name>` syntax (classic SQL view).
|
|
369
|
+
* Absent for `define view entity <name>`.
|
|
370
|
+
*/
|
|
371
|
+
legacy?: boolean;
|
|
372
|
+
/** `define root view entity`. */
|
|
373
|
+
root?: boolean;
|
|
374
|
+
/** `define writable view entity`. */
|
|
375
|
+
writable?: boolean;
|
|
376
|
+
/** `provider contract <name>` (projection views). */
|
|
377
|
+
providerContract?: string;
|
|
194
378
|
sourceKind: DataSourceKind;
|
|
379
|
+
/** `select distinct`. */
|
|
380
|
+
distinct?: boolean;
|
|
195
381
|
source: DataSource;
|
|
382
|
+
/**
|
|
383
|
+
* Ordered join chain applied to {@link source}. Empty when the view has no
|
|
384
|
+
* joins. The first entry is joined against `source`, the second against the
|
|
385
|
+
* result of the first, and so on.
|
|
386
|
+
*/
|
|
387
|
+
joins: JoinClause[];
|
|
388
|
+
/**
|
|
389
|
+
* Associations declared in the FROM region (between the data source and
|
|
390
|
+
* the element list). Distinct from the associations declared inside the
|
|
391
|
+
* element list, which are part of {@link members}.
|
|
392
|
+
*/
|
|
393
|
+
fromAssociations?: AssociationDeclaration[];
|
|
394
|
+
/**
|
|
395
|
+
* `redefine association|composition …` declarations of a projection view,
|
|
396
|
+
* placed in the header before the projection list.
|
|
397
|
+
*/
|
|
398
|
+
redefinedAssociations?: RedefinedAssociation[];
|
|
399
|
+
/** `bind aspect …` declarations in the FROM region / projection header. */
|
|
400
|
+
aspectBindings?: AspectBinding[];
|
|
196
401
|
parameters: ParameterDefinition[];
|
|
197
402
|
members: ViewMember[];
|
|
198
403
|
/** Top-level filter clause (`where ...`). */
|
|
199
404
|
where?: Expression;
|
|
405
|
+
/** `group by field1, …`. */
|
|
406
|
+
groupBy?: string[];
|
|
407
|
+
/** `having <condition>`. */
|
|
408
|
+
having?: Expression;
|
|
409
|
+
/** `union|intersect|except` set operations applied to the select. */
|
|
410
|
+
setOperations?: SetOperation[];
|
|
200
411
|
}
|
|
201
412
|
interface AbstractEntityDefinition extends AstNode {
|
|
202
413
|
kind: 'abstractEntity';
|
|
@@ -217,15 +428,204 @@ interface GrantStatement extends AstNode {
|
|
|
217
428
|
privilege: 'select';
|
|
218
429
|
/** Target entity (qualified). */
|
|
219
430
|
entity: string;
|
|
431
|
+
/** `with optional elements ( <name> [default true|false], … )`. */
|
|
432
|
+
optionalElements?: DclOptionalElement[];
|
|
433
|
+
/** `combination mode or|and` or `redefinition` after grant. */
|
|
434
|
+
combinationMode?: 'or' | 'and' | 'redefinition';
|
|
435
|
+
/** `inherit <role> …` — the role whose conditions are inherited. */
|
|
436
|
+
inheritRole?: string;
|
|
437
|
+
/** `inherit <role> and|or <cond>` connector. */
|
|
438
|
+
inheritConditionConnector?: 'and' | 'or';
|
|
439
|
+
inheritCondition?: Expression;
|
|
440
|
+
where?: Expression;
|
|
441
|
+
}
|
|
442
|
+
/** One entry of `with optional elements ( <name> [default true|false] )`. */
|
|
443
|
+
interface DclOptionalElement extends AstNode {
|
|
444
|
+
name: string;
|
|
445
|
+
/** `default true|false`; absent when not specified. */
|
|
446
|
+
default?: boolean;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* `inherit <role> [for grant select on <entity>] [where …] ;` —
|
|
450
|
+
* a standalone inherit rule inside a role body.
|
|
451
|
+
*/
|
|
452
|
+
interface InheritStatement extends AstNode {
|
|
453
|
+
/** The inherited role (qualified). */
|
|
454
|
+
role: string;
|
|
455
|
+
/** `for grant select on <entity>` — restricted scope. */
|
|
456
|
+
entity?: string;
|
|
220
457
|
where?: Expression;
|
|
221
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* `inheriting conditions from entity <name>|super [default true|false] … ;`
|
|
461
|
+
*/
|
|
462
|
+
interface InheritingConditionsStatement extends AstNode {
|
|
463
|
+
/** `entity` or `super`. */
|
|
464
|
+
sourceKind: 'entity' | 'super';
|
|
465
|
+
/** Present for `from entity <name>`. */
|
|
466
|
+
entity?: string;
|
|
467
|
+
/** `default true|false`; absent when not specified. */
|
|
468
|
+
default?: boolean;
|
|
469
|
+
condition?: Expression;
|
|
470
|
+
}
|
|
471
|
+
/** One statement inside a role body. */
|
|
472
|
+
type RoleMember = GrantStatement | InheritStatement | InheritingConditionsStatement;
|
|
222
473
|
interface RoleDefinition extends AstNode {
|
|
223
474
|
kind: 'role';
|
|
224
475
|
name: string;
|
|
225
476
|
annotations: Annotation[];
|
|
477
|
+
/** `define role <name> switchable { … }`. */
|
|
478
|
+
switchable?: boolean;
|
|
479
|
+
/** `grant select on …` statements. */
|
|
226
480
|
grants: GrantStatement[];
|
|
481
|
+
/** All members in source order, including inherit rules. */
|
|
482
|
+
members: RoleMember[];
|
|
483
|
+
}
|
|
484
|
+
/** define [writable] external entity <name> … with federated data provided at runtime [;] */
|
|
485
|
+
interface ExternalEntityDefinition extends AstNode {
|
|
486
|
+
kind: 'externalEntity';
|
|
487
|
+
name: string;
|
|
488
|
+
annotations: Annotation[];
|
|
489
|
+
/** `writable` modifier (writable external entity). */
|
|
490
|
+
writable?: boolean;
|
|
491
|
+
/** `external name <db_object>` mapping. */
|
|
492
|
+
externalName?: string;
|
|
493
|
+
parameters: ParameterDefinition[];
|
|
494
|
+
members: TableMember[];
|
|
495
|
+
}
|
|
496
|
+
/** define table function <name> [with parameters …] returns { … } implemented by method cls=>m [;] */
|
|
497
|
+
interface TableFunctionDefinition extends AstNode {
|
|
498
|
+
kind: 'tableFunction';
|
|
499
|
+
name: string;
|
|
500
|
+
annotations: Annotation[];
|
|
501
|
+
parameters: ParameterDefinition[];
|
|
502
|
+
/** Return structure fields (`name : typing;`). */
|
|
503
|
+
members: TableMember[];
|
|
504
|
+
/** `implemented by method <class>` (part before `=>`). */
|
|
505
|
+
implementingClass?: string;
|
|
506
|
+
/** `implemented by method <class>=><method>` (part after `=>`). */
|
|
507
|
+
implementingMethod?: string;
|
|
508
|
+
}
|
|
509
|
+
/** define scalar function <name> [with parameters …] returns <type> [;] */
|
|
510
|
+
interface ScalarFunctionDefinition extends AstNode {
|
|
511
|
+
kind: 'scalarFunction';
|
|
512
|
+
name: string;
|
|
513
|
+
annotations: Annotation[];
|
|
514
|
+
parameters: ParameterDefinition[];
|
|
515
|
+
returnType: TypeRef;
|
|
516
|
+
}
|
|
517
|
+
/** `[key] <elem> : <typing|expr>;` — one element of a `define aspect` body. */
|
|
518
|
+
interface AspectElement extends AstNode {
|
|
519
|
+
annotations: Annotation[];
|
|
520
|
+
name: string;
|
|
521
|
+
isKey: boolean;
|
|
522
|
+
/** `elem : typing` — present when the element is typed. */
|
|
523
|
+
type?: TypeRef;
|
|
524
|
+
/** `elem : <expr>` — raw operand text for expressions/calls/case. */
|
|
525
|
+
expression?: string;
|
|
227
526
|
}
|
|
228
|
-
|
|
527
|
+
/** define aspect <name> [{ <elements> }] */
|
|
528
|
+
interface AspectDefinition extends AstNode {
|
|
529
|
+
kind: 'aspect';
|
|
530
|
+
name: string;
|
|
531
|
+
annotations: Annotation[];
|
|
532
|
+
members: AspectElement[];
|
|
533
|
+
}
|
|
534
|
+
/** One `ORDER BY` item: `<field> [ascending|descending]`. */
|
|
535
|
+
interface SortItem extends AstNode {
|
|
536
|
+
name: string;
|
|
537
|
+
direction?: 'ascending' | 'descending';
|
|
538
|
+
}
|
|
539
|
+
/** Period clause of a hierarchy: `period from <f> to <f> [valid from <f> to <f>]`. */
|
|
540
|
+
interface HierarchyPeriod extends AstNode {
|
|
541
|
+
from: string;
|
|
542
|
+
to: string;
|
|
543
|
+
validFrom?: string;
|
|
544
|
+
validTo?: string;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* define hierarchy <name> [with parameters …]
|
|
548
|
+
* as parent child hierarchy( <clauses> ) { <elements> }
|
|
549
|
+
*/
|
|
550
|
+
interface HierarchyDefinition extends AstNode {
|
|
551
|
+
kind: 'hierarchy';
|
|
552
|
+
name: string;
|
|
553
|
+
annotations: Annotation[];
|
|
554
|
+
parameters: ParameterDefinition[];
|
|
555
|
+
/** `source <entity>` — the hierarchy's data source. */
|
|
556
|
+
source: string;
|
|
557
|
+
/** `child to parent association <name>` — the self-association. */
|
|
558
|
+
childToParentAssociation?: string;
|
|
559
|
+
period?: HierarchyPeriod;
|
|
560
|
+
/** `directory <entity> filter by <cond>`. */
|
|
561
|
+
directory?: {
|
|
562
|
+
entity: string;
|
|
563
|
+
filter: Expression;
|
|
564
|
+
};
|
|
565
|
+
/** `start where <cond>`. */
|
|
566
|
+
startWhere?: Expression;
|
|
567
|
+
/** `siblings order by <items>` — always present. */
|
|
568
|
+
siblingsOrderBy: SortItem[];
|
|
569
|
+
/** `depth <field>|<num>`. */
|
|
570
|
+
depth?: string;
|
|
571
|
+
/** `nodetype <field>`. */
|
|
572
|
+
nodetype?: string;
|
|
573
|
+
/** `load bulk|incremental|<field>|<sysvar>`. */
|
|
574
|
+
load?: string;
|
|
575
|
+
/** `multiple parents not allowed|leaves only|allowed`. */
|
|
576
|
+
multipleParents?: 'notAllowed' | 'leavesOnly' | 'allowed';
|
|
577
|
+
/** `orphans ignore|error|root`. */
|
|
578
|
+
orphans?: 'ignore' | 'error' | 'root';
|
|
579
|
+
/** `cycles error|breakup`. */
|
|
580
|
+
cycles?: 'error' | 'breakup';
|
|
581
|
+
/** `generate spantree`. */
|
|
582
|
+
generateSpantree?: boolean;
|
|
583
|
+
/** `cache on|off|force`. */
|
|
584
|
+
cache?: 'on' | 'off' | 'force';
|
|
585
|
+
members: ViewMember[];
|
|
586
|
+
}
|
|
587
|
+
/** `union|intersect|except [all] { <elements> }` — extension-level set op. */
|
|
588
|
+
interface ExtendSetOperation extends AstNode {
|
|
589
|
+
kind: 'extendSetOperation';
|
|
590
|
+
operator: 'union' | 'unionAll' | 'intersect' | 'except';
|
|
591
|
+
members: ViewMember[];
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* `extend view [entity] <name> with [<assocs>] { <elements> }
|
|
595
|
+
* [group by …] [union|intersect|except { … }]* [;]`
|
|
596
|
+
* and `extend abstract|custom entity <name> with { … }`.
|
|
597
|
+
*/
|
|
598
|
+
interface ExtensionDefinition extends AstNode {
|
|
599
|
+
kind: 'extension';
|
|
600
|
+
name: string;
|
|
601
|
+
annotations: Annotation[];
|
|
602
|
+
/** The extended entity flavour: `view` | `abstract` | `custom`. */
|
|
603
|
+
targetKind: 'view' | 'abstract' | 'custom';
|
|
604
|
+
/** `true` when the extended target is `view entity` (not legacy `view`). */
|
|
605
|
+
isViewEntity?: boolean;
|
|
606
|
+
/** Associations appended by the extension. */
|
|
607
|
+
associations: AssociationDeclaration[];
|
|
608
|
+
members: ViewMember[];
|
|
609
|
+
groupBy?: string[];
|
|
610
|
+
setOperations?: ExtendSetOperation[];
|
|
611
|
+
}
|
|
612
|
+
/** `define annotation <name> { … }` (DDLA) — body captured as raw tokens. */
|
|
613
|
+
interface AnnotationDefinition extends AstNode {
|
|
614
|
+
kind: 'annotationDefinition';
|
|
615
|
+
name: string;
|
|
616
|
+
annotations: Annotation[];
|
|
617
|
+
/** Raw token text inside the `{ … }` body (or after `:`). */
|
|
618
|
+
body: string;
|
|
619
|
+
}
|
|
620
|
+
/** `define accesspolicy <name> { … }` — body captured as raw tokens. */
|
|
621
|
+
interface AccessPolicyDefinition extends AstNode {
|
|
622
|
+
kind: 'accessPolicy';
|
|
623
|
+
name: string;
|
|
624
|
+
annotations: Annotation[];
|
|
625
|
+
/** Raw token text inside the `{ … }` body. */
|
|
626
|
+
body: string;
|
|
627
|
+
}
|
|
628
|
+
type CdsDefinition = TableDefinition | StructureDefinition | SimpleTypeDefinition | ServiceDefinition | MetadataExtension | RoleDefinition | ViewEntityDefinition | AbstractEntityDefinition | CustomEntityDefinition | ExternalEntityDefinition | TableFunctionDefinition | ScalarFunctionDefinition | AspectDefinition | HierarchyDefinition | ExtensionDefinition | AnnotationDefinition | AccessPolicyDefinition;
|
|
229
629
|
/** Root AST node representing a parsed CDS source file */
|
|
230
630
|
interface CdsSourceFile extends AstNode {
|
|
231
631
|
definitions: CdsDefinition[];
|
|
@@ -241,9 +641,9 @@ interface CdsParseError {
|
|
|
241
641
|
}
|
|
242
642
|
//#endregion
|
|
243
643
|
//#region src/lib/ast/walker.d.ts
|
|
244
|
-
type WithMembers = ViewEntityDefinition | AbstractEntityDefinition | CustomEntityDefinition;
|
|
245
|
-
type WithFields = TableDefinition | StructureDefinition;
|
|
246
|
-
type WithParameters = ViewEntityDefinition | AbstractEntityDefinition | CustomEntityDefinition;
|
|
644
|
+
type WithMembers = ViewEntityDefinition | AbstractEntityDefinition | CustomEntityDefinition | HierarchyDefinition | ExtensionDefinition;
|
|
645
|
+
type WithFields = TableDefinition | StructureDefinition | ExternalEntityDefinition | TableFunctionDefinition;
|
|
646
|
+
type WithParameters = ViewEntityDefinition | AbstractEntityDefinition | CustomEntityDefinition | ExternalEntityDefinition | TableFunctionDefinition | ScalarFunctionDefinition | HierarchyDefinition;
|
|
247
647
|
/** True when the definition has a `members` array (view-like entities). */
|
|
248
648
|
declare function hasMembers(def: CdsDefinition): def is WithMembers;
|
|
249
649
|
/** True when the definition has a `members` array of typed fields (TABL/structure). */
|
|
@@ -266,6 +666,22 @@ declare function walkAssociations(file: CdsSourceFile): Iterable<{
|
|
|
266
666
|
owner: WithMembers;
|
|
267
667
|
association: AssociationDeclaration;
|
|
268
668
|
}>;
|
|
669
|
+
/**
|
|
670
|
+
* Yield every association declared in the FROM region of a view entity.
|
|
671
|
+
*
|
|
672
|
+
* FROM associations are declared next to the data source (before the element
|
|
673
|
+
* list) and are therefore kept apart from the associations inside
|
|
674
|
+
* `members`.
|
|
675
|
+
*/
|
|
676
|
+
declare function walkFromAssociations(file: CdsSourceFile): Iterable<{
|
|
677
|
+
owner: ViewEntityDefinition;
|
|
678
|
+
association: AssociationDeclaration;
|
|
679
|
+
}>;
|
|
680
|
+
/** Yield every join of every view entity, in source order. */
|
|
681
|
+
declare function walkJoins(file: CdsSourceFile): Iterable<{
|
|
682
|
+
owner: ViewEntityDefinition;
|
|
683
|
+
join: JoinClause;
|
|
684
|
+
}>;
|
|
269
685
|
/** Yield every field definition from tables and structures. */
|
|
270
686
|
declare function walkFields(file: CdsSourceFile): Iterable<{
|
|
271
687
|
owner: WithFields;
|
|
@@ -310,6 +726,9 @@ declare const annotationsCoverage: GrammarCoverage;
|
|
|
310
726
|
//#region src/lib/grammar/associations.d.ts
|
|
311
727
|
declare const associationsCoverage: GrammarCoverage;
|
|
312
728
|
//#endregion
|
|
729
|
+
//#region src/lib/grammar/joins.d.ts
|
|
730
|
+
declare const joinsCoverage: GrammarCoverage;
|
|
731
|
+
//#endregion
|
|
313
732
|
//#region src/lib/grammar/parameters.d.ts
|
|
314
733
|
declare const parametersCoverage: GrammarCoverage;
|
|
315
734
|
//#endregion
|
|
@@ -353,5 +772,5 @@ interface ParseResult {
|
|
|
353
772
|
*/
|
|
354
773
|
declare function parse(source: string): ParseResult;
|
|
355
774
|
//#endregion
|
|
356
|
-
export { type AbstractEntityDefinition, type AnnotatedElement, type Annotation, type AnnotationArray, type AnnotationObject, type AnnotationProperty, type AnnotationValue, type AssociationDeclaration, type AssociationKind, type AstNode, type BooleanLiteral, type BuiltinTypeRef, type Cardinality, type CdsDefinition, type CdsParseError, type CdsSourceFile, type CustomEntityDefinition, type DataSource, type DataSourceKind, type EnumValue, type ExposeStatement, type Expression, type FieldDefinition, GRAMMAR_COVERAGE, type GrammarCoverage, type GrantStatement, type IncludeDirective, type MetadataExtension, type NamedTypeRef, type NumberLiteral, type ParameterDefinition, ParseResult, type RoleDefinition, type SemanticDiagnostic, type ServiceDefinition, type SimpleTypeDefinition, type SourceLocation, type StringLiteral, type StructureDefinition, type TableDefinition, type TableMember, type TypeRef, type ViewElement, type ViewEntityDefinition, type ViewMember, actionsCoverage, annotationsCoverage, associationsCoverage, dclCoverage, ddlCoverage, findAnnotation, hasFields, hasMembers, hasParameters, isAssociation, parametersCoverage, parse, projectionsCoverage, validate, validateCardinality, validateViewElements, walkAnnotations, walkAssociations, walkDefinitions, walkFields, walkParameters, walkViewElements };
|
|
775
|
+
export { type AbstractEntityDefinition, type AccessPolicyDefinition, type AnnotatedElement, type Annotation, type AnnotationArray, type AnnotationDefinition, type AnnotationObject, type AnnotationProperty, type AnnotationValue, type AspectBinding, type AspectBindingMapping, type AspectDefinition, type AspectElement, type AssociationDeclaration, type AssociationKind, type AssociationRedirection, type AstNode, type BooleanLiteral, type BuiltinTypeRef, type Cardinality, type CardinalityWord, type CdsDefinition, type CdsParseError, type CdsSourceFile, type ConditionedJoinClause, type CrossJoinClause, type CustomEntityDefinition, type DataSource, type DataSourceKind, type DataSourceParameter, type DclOptionalElement, type EnumValue, type ExposeStatement, type Expression, type ExtendSetOperation, type ExtensionDefinition, type ExternalEntityDefinition, type FieldDefinition, GRAMMAR_COVERAGE, type GrammarCoverage, type GrantStatement, type HierarchyDefinition, type HierarchyPeriod, type IncludeDirective, type InheritStatement, type InheritingConditionsStatement, type JoinClause, type JoinGroup, type JoinSource, type JoinType, type MetadataExtension, type NamedTypeRef, type NumberLiteral, type ParameterDefinition, ParseResult, type RedefinedAssociation, type RoleDefinition, type RoleMember, type ScalarFunctionDefinition, type SelectStatement, type SemanticDiagnostic, type ServiceDefinition, type SetOperation, type SimpleTypeDefinition, type SortItem, type SourceLocation, type StringLiteral, type StructureDefinition, type TableDefinition, type TableFunctionDefinition, type TableMember, type TypeRef, type ViewElement, type ViewEntityDefinition, type ViewMember, type WordCardinality, actionsCoverage, annotationsCoverage, associationsCoverage, dclCoverage, ddlCoverage, findAnnotation, hasFields, hasMembers, hasParameters, isAssociation, joinsCoverage, parametersCoverage, parse, projectionsCoverage, validate, validateCardinality, validateViewElements, walkAnnotations, walkAssociations, walkDefinitions, walkFields, walkFromAssociations, walkJoins, walkParameters, walkViewElements };
|
|
357
776
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ast.ts","../src/errors.ts","../src/lib/ast/walker.ts","../src/lib/validate/cardinality.ts","../src/lib/validate/elements.ts","../src/lib/validate/index.ts","../src/lib/grammar/ddl.ts","../src/lib/grammar/dcl.ts","../src/lib/grammar/annotations.ts","../src/lib/grammar/associations.ts","../src/lib/grammar/parameters.ts","../src/lib/grammar/projections.ts","../src/lib/grammar/actions.ts","../src/lib/grammar/index.ts","../src/index.ts"],"mappings":";;;;;;;;;;UAaiB;EACf;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf,MAAM;;;KAQI,kBACR,gBACA,YACA,iBACA,gBACA,kBACA;UAEa,sBAAsB;EACrC;EACA;;UAGe,kBAAkB;EACjC;EACA;;UAGe,uBAAuB;EACtC;EACA;;UAGe,sBAAsB;EACrC;EACA;;UAGe,wBAAwB;EACvC;EACA,OAAO;;UAGQ,yBAAyB;EACxC;EACA,YAAY;;UAGG,2BAA2B;EAC1C;EACA,OAAO;;;UAIQ,mBAAmB;EAClC;EACA,OAAO;;;UAQQ,uBAAuB;EACtC;EACA;EACA;EACA;;;UAIe,qBAAqB;EACpC;EACA;;KAGU,UAAU,iBAAiB;;UAOtB,wBAAwB;EACvC,aAAa;EACb;EACA,MAAM;EACN;EACA;;;UAIe,yBAAyB;EACxC;EACA;EACA;;KAGU,cAAc,kBAAkB;;UAO3B,wBAAwB;EACvC;EACA;EACA,aAAa;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ast.ts","../src/errors.ts","../src/lib/ast/walker.ts","../src/lib/validate/cardinality.ts","../src/lib/validate/elements.ts","../src/lib/validate/index.ts","../src/lib/grammar/ddl.ts","../src/lib/grammar/dcl.ts","../src/lib/grammar/annotations.ts","../src/lib/grammar/associations.ts","../src/lib/grammar/joins.ts","../src/lib/grammar/parameters.ts","../src/lib/grammar/projections.ts","../src/lib/grammar/actions.ts","../src/lib/grammar/index.ts","../src/index.ts"],"mappings":";;;;;;;;;;UAaiB;EACf;EACA;EACA;EACA;EAC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