@contember/binding 0.7.0-beta.1 → 0.7.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binding.d.ts +96 -154
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +47 -38
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/development/treeParameters/LeafField.js.map +1 -1
- package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/development/treeParameters/Relation.js.map +1 -1
- package/dist/development/utils/Hashing.js.map +1 -1
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js +47 -38
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
- package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
- package/dist/production/treeParameters/LeafField.js.map +1 -1
- package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
- package/dist/production/treeParameters/Relation.js.map +1 -1
- package/dist/production/utils/Hashing.js.map +1 -1
- package/package.json +5 -5
package/dist/binding.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { FunctionComponent } from 'react';
|
|
|
8
8
|
import { GraphQlBuilder } from '@contember/client';
|
|
9
9
|
import type { GraphQlClient } from '@contember/client';
|
|
10
10
|
import type { GraphQlClientFailedRequestMetadata } from '@contember/client';
|
|
11
|
-
import
|
|
11
|
+
import { GraphQlLiteral } from '@contember/client';
|
|
12
12
|
import { Input } from '@contember/client';
|
|
13
13
|
import { NamedExoticComponent } from 'react';
|
|
14
14
|
import { ReactElement } from 'react';
|
|
@@ -231,90 +231,6 @@ export declare interface DeferredSubTreesProps {
|
|
|
231
231
|
children: ReactNode;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
export declare interface DesugaredAnyField {
|
|
235
|
-
field: FieldName;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export declare interface DesugaredEntityCreationParameters {
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export declare interface DesugaredEntityListEventListeners {
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export declare interface DesugaredEntityListParameters extends DesugaredEntityListPreferences {
|
|
245
|
-
filter: Filter | undefined;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export declare interface DesugaredEntityListPreferences {
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export declare interface DesugaredFieldEventListeners {
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export declare interface DesugaredHasManyRelation extends DesugaredRelation, DesugaredEntityListParameters, DesugaredEntityListEventListeners {
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export declare interface DesugaredHasOneRelation extends DesugaredRelation, DesugaredSingleEntityParameters, DesugaredSingleEntityEventListeners {
|
|
258
|
-
reducedBy: UniqueWhere | undefined;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export declare interface DesugaredLeafField extends DesugaredFieldEventListeners {
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export declare interface DesugaredParentEntityParameters extends DesugaredSingleEntityEventListeners {
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export declare interface DesugaredQualifiedEntityList extends DesugaredEntityListParameters, DesugaredQualifiedEntityParameters, DesugaredEntityCreationParameters, DesugaredEntityListEventListeners {
|
|
268
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export declare interface DesugaredQualifiedEntityParameters {
|
|
272
|
-
entityName: EntityName;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export declare interface DesugaredQualifiedFieldList extends DesugaredQualifiedEntityList, DesugaredAnyField, DesugaredLeafField {
|
|
276
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export declare interface DesugaredQualifiedSingleEntity extends DesugaredQualifiedSingleEntityParameters, DesugaredSingleEntityParameters, DesugaredQualifiedEntityParameters, DesugaredEntityCreationParameters, DesugaredSingleEntityEventListeners {
|
|
280
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export declare interface DesugaredQualifiedSingleEntityParameters {
|
|
284
|
-
where: UniqueWhere;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export declare interface DesugaredRelation extends DesugaredAnyField, DesugaredEntityCreationParameters {
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
export declare interface DesugaredRelativeEntityList {
|
|
291
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
292
|
-
hasManyRelation: DesugaredHasManyRelation;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export declare interface DesugaredRelativeSingleEntity {
|
|
296
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export declare interface DesugaredRelativeSingleField extends DesugaredAnyField, DesugaredLeafField {
|
|
300
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export declare interface DesugaredSingleEntityEventListeners {
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export declare interface DesugaredSingleEntityParameters {
|
|
307
|
-
filter: Filter | undefined;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export declare interface DesugaredUnconstrainedQualifiedEntityList extends DesugaredQualifiedEntityParameters, DesugaredEntityCreationParameters, DesugaredEntityListEventListeners, DesugaredEntityListPreferences {
|
|
311
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export declare interface DesugaredUnconstrainedQualifiedSingleEntity extends DesugaredQualifiedEntityParameters, DesugaredEntityCreationParameters, DesugaredSingleEntityEventListeners {
|
|
315
|
-
hasOneRelationPath: DesugaredHasOneRelation[];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
234
|
export declare const DirtinessContext: Context<boolean>;
|
|
319
235
|
|
|
320
236
|
declare class DirtinessTracker {
|
|
@@ -372,9 +288,9 @@ export declare class EntityAccessor implements Errorable {
|
|
|
372
288
|
/**
|
|
373
289
|
* @see EntityAccessor.getField
|
|
374
290
|
*/
|
|
375
|
-
getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField
|
|
376
|
-
getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity
|
|
377
|
-
getRelativeEntityList(entityList: RelativeEntityList
|
|
291
|
+
getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value>;
|
|
292
|
+
getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor;
|
|
293
|
+
getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor;
|
|
378
294
|
private getAccessorByPlaceholder;
|
|
379
295
|
private getPersistedKeyByPlaceholder;
|
|
380
296
|
}
|
|
@@ -1367,6 +1283,61 @@ export declare interface ParentEntityProps extends SugaredParentEntityParameters
|
|
|
1367
1283
|
children?: ReactNode;
|
|
1368
1284
|
}
|
|
1369
1285
|
|
|
1286
|
+
declare interface ParsedHasManyRelation {
|
|
1287
|
+
field: FieldName;
|
|
1288
|
+
filter: Filter | undefined;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
declare interface ParsedHasOneRelation {
|
|
1292
|
+
filter: Filter | undefined;
|
|
1293
|
+
field: FieldName;
|
|
1294
|
+
reducedBy: UniqueWhere | undefined;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
declare interface ParsedQualifiedEntityList {
|
|
1298
|
+
entityName: EntityName;
|
|
1299
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1300
|
+
filter: Filter | undefined;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
declare interface ParsedQualifiedFieldList {
|
|
1304
|
+
field: FieldName;
|
|
1305
|
+
entityName: EntityName;
|
|
1306
|
+
filter: Filter | undefined;
|
|
1307
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
declare interface ParsedQualifiedSingleEntity {
|
|
1311
|
+
where: UniqueWhere;
|
|
1312
|
+
filter: Filter | undefined;
|
|
1313
|
+
entityName: EntityName;
|
|
1314
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
declare interface ParsedRelativeEntityList {
|
|
1318
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1319
|
+
hasManyRelation: ParsedHasManyRelation;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
declare interface ParsedRelativeSingleEntity {
|
|
1323
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
declare interface ParsedRelativeSingleField {
|
|
1327
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1328
|
+
field: FieldName;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
declare interface ParsedUnconstrainedQualifiedEntityList {
|
|
1332
|
+
entityName: EntityName;
|
|
1333
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
declare interface ParsedUnconstrainedQualifiedSingleEntity {
|
|
1337
|
+
entityName: EntityName;
|
|
1338
|
+
hasOneRelationPath: ParsedHasOneRelation[];
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1370
1341
|
/**
|
|
1371
1342
|
* TODO:
|
|
1372
1343
|
* - double quoted strings
|
|
@@ -1422,14 +1393,14 @@ export declare namespace Parser {
|
|
|
1422
1393
|
export type ConditionOperator = keyof Pick<Condition, 'eq' | 'notEq' | 'lt' | 'lte' | 'gt' | 'gte'>;
|
|
1423
1394
|
}
|
|
1424
1395
|
export interface ParserResult {
|
|
1425
|
-
qualifiedEntityList:
|
|
1426
|
-
qualifiedFieldList:
|
|
1427
|
-
qualifiedSingleEntity:
|
|
1428
|
-
unconstrainedQualifiedEntityList:
|
|
1429
|
-
unconstrainedQualifiedSingleEntity:
|
|
1430
|
-
relativeSingleField:
|
|
1431
|
-
relativeSingleEntity:
|
|
1432
|
-
relativeEntityList:
|
|
1396
|
+
qualifiedEntityList: ParsedQualifiedEntityList;
|
|
1397
|
+
qualifiedFieldList: ParsedQualifiedFieldList;
|
|
1398
|
+
qualifiedSingleEntity: ParsedQualifiedSingleEntity;
|
|
1399
|
+
unconstrainedQualifiedEntityList: ParsedUnconstrainedQualifiedEntityList;
|
|
1400
|
+
unconstrainedQualifiedSingleEntity: ParsedUnconstrainedQualifiedSingleEntity;
|
|
1401
|
+
relativeSingleField: ParsedRelativeSingleField;
|
|
1402
|
+
relativeSingleEntity: ParsedRelativeSingleEntity;
|
|
1403
|
+
relativeEntityList: ParsedRelativeEntityList;
|
|
1433
1404
|
uniqueWhere: UniqueWhere;
|
|
1434
1405
|
filter: Filter;
|
|
1435
1406
|
orderBy: OrderBy;
|
|
@@ -1458,8 +1429,8 @@ export declare interface PersistSuccessOptions extends AsyncBatchUpdatesOptions
|
|
|
1458
1429
|
|
|
1459
1430
|
export declare class PlaceholderGenerator {
|
|
1460
1431
|
static getFieldPlaceholder(fieldName: FieldName): string;
|
|
1461
|
-
static getHasOneRelationPlaceholder(relation: HasOneRelation
|
|
1462
|
-
static getHasManyRelationPlaceholder(relation: HasManyRelation
|
|
1432
|
+
static getHasOneRelationPlaceholder(relation: HasOneRelation): string;
|
|
1433
|
+
static getHasManyRelationPlaceholder(relation: HasManyRelation): string;
|
|
1463
1434
|
static getEntitySubTreePlaceholder(subTreeParameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity): string;
|
|
1464
1435
|
static getEntityListSubTreePlaceholder(subTreeParameters: QualifiedEntityList | UnconstrainedQualifiedEntityList): string;
|
|
1465
1436
|
}
|
|
@@ -1498,14 +1469,18 @@ export declare interface QualifiedSingleEntityParameters {
|
|
|
1498
1469
|
|
|
1499
1470
|
export declare class QueryLanguage {
|
|
1500
1471
|
private static preparePrimitiveEntryPoint;
|
|
1501
|
-
private static
|
|
1502
|
-
private static
|
|
1503
|
-
private static
|
|
1504
|
-
private static
|
|
1505
|
-
private static
|
|
1506
|
-
private static
|
|
1507
|
-
private static
|
|
1508
|
-
private static
|
|
1472
|
+
private static preparePrimitiveEntryPointWithFallback;
|
|
1473
|
+
private static parseUnconstrainedQualifiedEntityList;
|
|
1474
|
+
private static parseUnconstrainedQualifiedSingleEntity;
|
|
1475
|
+
private static parseQualifiedEntityList;
|
|
1476
|
+
private static parseQualifiedFieldList;
|
|
1477
|
+
private static parseQualifiedSingleEntity;
|
|
1478
|
+
private static parseRelativeEntityList;
|
|
1479
|
+
private static parseRelativeSingleEntity;
|
|
1480
|
+
private static parseRelativeSingleField;
|
|
1481
|
+
static desugarUniqueWhere: (input: string | UniqueWhere<GraphQlLiteral<string>>, environment: Environment) => UniqueWhere<GraphQlLiteral<string>>;
|
|
1482
|
+
static desugarFilter: (input: string | Filter<GraphQlLiteral<string>>, environment: Environment) => Filter<GraphQlLiteral<string>>;
|
|
1483
|
+
static desugarOrderBy: (input: string | OrderBy, environment: Environment) => OrderBy;
|
|
1509
1484
|
private static desugarEntityListParameters;
|
|
1510
1485
|
static desugarSetOnCreate(setOnCreate: SugaredSetOnCreate, environment: Environment): UniqueWhere;
|
|
1511
1486
|
static desugarEventListener<F extends Function>(listener: F | Set<F>): Set<F>;
|
|
@@ -1519,9 +1494,6 @@ export declare class QueryLanguage {
|
|
|
1519
1494
|
private static augmentDesugaredHasManyRelation;
|
|
1520
1495
|
private static desugarHasOneRelationPath;
|
|
1521
1496
|
private static desugarHasManyRelation;
|
|
1522
|
-
static desugarUniqueWhere: (input: string | Parser.ParserResult['uniqueWhere'], environment: Environment) => Parser.ParserResult['uniqueWhere'];
|
|
1523
|
-
static desugarFilter: (input: string | Parser.ParserResult['filter'], environment: Environment) => Parser.ParserResult['filter'];
|
|
1524
|
-
static desugarOrderBy: (input: string | Parser.ParserResult['orderBy'], environment: Environment) => Parser.ParserResult['orderBy'];
|
|
1525
1497
|
static desugarUnconstrainedQualifiedEntityList({ entities, ...unsugarableEntityList }: SugaredUnconstrainedQualifiedEntityList, environment: Environment): UnconstrainedQualifiedEntityList;
|
|
1526
1498
|
static desugarUnconstrainedQualifiedSingleEntity({ entity, ...unsugarableSingleEntity }: SugaredUnconstrainedQualifiedSingleEntity, environment: Environment): UnconstrainedQualifiedSingleEntity;
|
|
1527
1499
|
static desugarQualifiedEntityList({ entities, ...unsugarableEntityList }: SugaredQualifiedEntityList, environment: Environment): QualifiedEntityList;
|
|
@@ -1758,36 +1730,18 @@ export declare interface SugarableAnyField {
|
|
|
1758
1730
|
field: FieldName;
|
|
1759
1731
|
}
|
|
1760
1732
|
|
|
1761
|
-
export declare interface
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
export declare interface SugarableEntityListEventListeners {
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1767
|
-
export declare interface SugarableEntityListParameters extends SugarableEntityListPreferences {
|
|
1733
|
+
export declare interface SugarableEntityListParameters {
|
|
1768
1734
|
filter?: SugaredFilter;
|
|
1769
1735
|
}
|
|
1770
1736
|
|
|
1771
|
-
export declare interface
|
|
1737
|
+
export declare interface SugarableHasManyRelation extends SugarableRelation, SugarableEntityListParameters {
|
|
1772
1738
|
}
|
|
1773
1739
|
|
|
1774
|
-
export declare interface
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
export declare interface SugarableHasManyRelation extends SugarableRelation, SugarableEntityListParameters, SugarableEntityListEventListeners {
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
export declare interface SugarableHasOneRelation extends SugarableRelation, SugarableSingleEntityParameters, SugarableSingleEntityEventListeners {
|
|
1740
|
+
export declare interface SugarableHasOneRelation extends SugarableRelation, SugarableSingleEntityParameters {
|
|
1781
1741
|
reducedBy?: SugaredUniqueWhere;
|
|
1782
1742
|
}
|
|
1783
1743
|
|
|
1784
|
-
export declare interface
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
export declare interface SugarableParentEntityParameters extends SugarableSingleEntityEventListeners {
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
export declare interface SugarableQualifiedEntityList extends SugarableEntityListParameters, SugarableQualifiedEntityParameters, SugarableEntityCreationParameters, SugarableEntityListEventListeners {
|
|
1744
|
+
export declare interface SugarableQualifiedEntityList extends SugarableEntityListParameters, SugarableQualifiedEntityParameters {
|
|
1791
1745
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1792
1746
|
}
|
|
1793
1747
|
|
|
@@ -1795,11 +1749,11 @@ export declare interface SugarableQualifiedEntityParameters {
|
|
|
1795
1749
|
entityName: EntityName;
|
|
1796
1750
|
}
|
|
1797
1751
|
|
|
1798
|
-
export declare interface SugarableQualifiedFieldList extends SugarableEntityListParameters, SugarableQualifiedEntityParameters, SugarableAnyField
|
|
1752
|
+
export declare interface SugarableQualifiedFieldList extends SugarableEntityListParameters, SugarableQualifiedEntityParameters, SugarableAnyField {
|
|
1799
1753
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1800
1754
|
}
|
|
1801
1755
|
|
|
1802
|
-
export declare interface SugarableQualifiedSingleEntity extends SugarableQualifiedSingleEntityParameters, SugarableSingleEntityParameters, SugarableQualifiedEntityParameters
|
|
1756
|
+
export declare interface SugarableQualifiedSingleEntity extends SugarableQualifiedSingleEntityParameters, SugarableSingleEntityParameters, SugarableQualifiedEntityParameters {
|
|
1803
1757
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1804
1758
|
}
|
|
1805
1759
|
|
|
@@ -1807,7 +1761,7 @@ export declare interface SugarableQualifiedSingleEntityParameters {
|
|
|
1807
1761
|
where: SugaredUniqueWhere;
|
|
1808
1762
|
}
|
|
1809
1763
|
|
|
1810
|
-
export declare interface SugarableRelation extends SugarableAnyField
|
|
1764
|
+
export declare interface SugarableRelation extends SugarableAnyField {
|
|
1811
1765
|
}
|
|
1812
1766
|
|
|
1813
1767
|
export declare interface SugarableRelativeEntityList {
|
|
@@ -1819,22 +1773,19 @@ export declare interface SugarableRelativeSingleEntity {
|
|
|
1819
1773
|
hasOneRelationPath: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1820
1774
|
}
|
|
1821
1775
|
|
|
1822
|
-
export declare interface SugarableRelativeSingleField extends SugarableAnyField
|
|
1776
|
+
export declare interface SugarableRelativeSingleField extends SugarableAnyField {
|
|
1823
1777
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1824
1778
|
}
|
|
1825
1779
|
|
|
1826
|
-
export declare interface SugarableSingleEntityEventListeners {
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
1780
|
export declare interface SugarableSingleEntityParameters {
|
|
1830
1781
|
filter?: SugaredFilter;
|
|
1831
1782
|
}
|
|
1832
1783
|
|
|
1833
|
-
export declare interface SugarableUnconstrainedQualifiedEntityList extends SugarableQualifiedEntityParameters
|
|
1784
|
+
export declare interface SugarableUnconstrainedQualifiedEntityList extends SugarableQualifiedEntityParameters {
|
|
1834
1785
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1835
1786
|
}
|
|
1836
1787
|
|
|
1837
|
-
export declare interface SugarableUnconstrainedQualifiedSingleEntity extends SugarableQualifiedEntityParameters
|
|
1788
|
+
export declare interface SugarableUnconstrainedQualifiedSingleEntity extends SugarableQualifiedEntityParameters {
|
|
1838
1789
|
hasOneRelationPath?: SugarableHasOneRelation[] | SugarableHasOneRelation;
|
|
1839
1790
|
}
|
|
1840
1791
|
|
|
@@ -2027,9 +1978,6 @@ export declare class UnpersistedEntityDummyId implements RuntimeIdSpec {
|
|
|
2027
1978
|
static matchesDummyId(candidate: string): boolean;
|
|
2028
1979
|
}
|
|
2029
1980
|
|
|
2030
|
-
export declare interface UnsugarableAnyField {
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
1981
|
export declare interface UnsugarableEntityCreationParameters {
|
|
2034
1982
|
isNonbearing?: boolean;
|
|
2035
1983
|
setOnCreate?: SugaredSetOnCreate;
|
|
@@ -2058,7 +2006,7 @@ export declare type UnsugarableFieldEventListeners<Persisted extends FieldValue
|
|
|
2058
2006
|
export declare interface UnsugarableHasManyRelation extends UnsugarableRelation, UnsugarableEntityListParameters, UnsugarableEntityListEventListeners {
|
|
2059
2007
|
}
|
|
2060
2008
|
|
|
2061
|
-
export declare interface UnsugarableHasOneRelation extends UnsugarableRelation,
|
|
2009
|
+
export declare interface UnsugarableHasOneRelation extends UnsugarableRelation, UnsugarableSingleEntityEventListeners {
|
|
2062
2010
|
}
|
|
2063
2011
|
|
|
2064
2012
|
export declare interface UnsugarableLeafField extends UnsugarableFieldEventListeners {
|
|
@@ -2078,17 +2026,14 @@ export declare interface UnsugarableQualifiedEntityParameters {
|
|
|
2078
2026
|
expectedMutation?: ExpectedQualifiedEntityMutation;
|
|
2079
2027
|
}
|
|
2080
2028
|
|
|
2081
|
-
export declare interface UnsugarableQualifiedFieldList extends UnsugarableEntityListParameters, UnsugarableQualifiedEntityParameters,
|
|
2029
|
+
export declare interface UnsugarableQualifiedFieldList extends UnsugarableEntityListParameters, UnsugarableQualifiedEntityParameters, UnsugarableLeafField {
|
|
2082
2030
|
}
|
|
2083
2031
|
|
|
2084
|
-
export declare interface UnsugarableQualifiedSingleEntity extends
|
|
2032
|
+
export declare interface UnsugarableQualifiedSingleEntity extends UnsugarableQualifiedEntityParameters, UnsugarableEntityCreationParameters, UnsugarableSingleEntityEventListeners {
|
|
2085
2033
|
isCreating?: false;
|
|
2086
2034
|
}
|
|
2087
2035
|
|
|
2088
|
-
export declare interface
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
export declare interface UnsugarableRelation extends UnsugarableAnyField, UnsugarableEntityCreationParameters {
|
|
2036
|
+
export declare interface UnsugarableRelation extends UnsugarableEntityCreationParameters {
|
|
2092
2037
|
expectedMutation?: ExpectedRelationMutation;
|
|
2093
2038
|
}
|
|
2094
2039
|
|
|
@@ -2098,7 +2043,7 @@ export declare interface UnsugarableRelativeEntityList extends UnsugarableRelati
|
|
|
2098
2043
|
export declare interface UnsugarableRelativeSingleEntity extends UnsugarableHasOneRelation {
|
|
2099
2044
|
}
|
|
2100
2045
|
|
|
2101
|
-
export declare interface UnsugarableRelativeSingleField extends
|
|
2046
|
+
export declare interface UnsugarableRelativeSingleField extends UnsugarableLeafField {
|
|
2102
2047
|
}
|
|
2103
2048
|
|
|
2104
2049
|
export declare type UnsugarableSingleEntityEventListeners = {
|
|
@@ -2109,9 +2054,6 @@ export declare type UnsugarableSingleEntityEventListeners = {
|
|
|
2109
2054
|
};
|
|
2110
2055
|
};
|
|
2111
2056
|
|
|
2112
|
-
export declare interface UnsugarableSingleEntityParameters {
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
2057
|
export declare interface UnsugarableUnconstrainedQualifiedEntityList extends UnsugarableQualifiedEntityParameters, UnsugarableEntityCreationParameters, UnsugarableEntityListEventListeners, UnsugarableEntityListPreferences {
|
|
2116
2058
|
isCreating: true;
|
|
2117
2059
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityAccessor.js","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, ServerGeneratedUuid, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tDesugaredRelativeEntityList,\n\tDesugaredRelativeSingleEntity,\n\tDesugaredRelativeSingleField,\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport type { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {}\n\n\tpublic get idOnServer(): string | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.SugaredValidationError): () => void {\n\t\treturn this.operations.addError(this.stateKey, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.stateKey, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.stateKey, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.stateKey)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\tpublic getKeyConnectedOnServer(entity: SugaredRelativeSingleEntity | string): string | null {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity(entity, this.environment)\n\t\tconst lastHasOne = desugared.hasOneRelationPath[desugared.hasOneRelationPath.length - 1]\n\t\tconst lastHasOnePlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(lastHasOne)\n\n\t\tlet containingAccessor: EntityAccessor = this\n\n\t\tif (desugared.hasOneRelationPath.length > 1) {\n\t\t\tcontainingAccessor = this.getRelativeSingleEntity({\n\t\t\t\thasOneRelationPath: desugared.hasOneRelationPath.slice(0, -1),\n\t\t\t})\n\t\t}\n\t\treturn containingAccessor.getPersistedKeyByPlaceholder(lastHasOnePlaceholder)\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(\n\t\tfield: RelativeSingleField | DesugaredRelativeSingleField,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleEntity(field).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getFieldPlaceholder(field.field),\n\t\t) as unknown as FieldAccessor<Value>\n\t}\n\n\tpublic getRelativeSingleEntity(\n\t\trelativeSingleEntity: RelativeSingleEntity | DesugaredRelativeSingleEntity,\n\t): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\trelativeTo = relativeTo.getAccessorByPlaceholder(\n\t\t\t\tPlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation),\n\t\t\t) as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList | DesugaredRelativeEntityList): EntityListAccessor {\n\t\treturn this.getRelativeSingleEntity(entityList).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation),\n\t\t) as EntityListAccessor\n\t}\n\n\tprivate getAccessorByPlaceholder(placeholderName: FieldName): EntityAccessor.NestedAccessor {\n\t\tconst record = this.fieldData.get(placeholderName)\n\t\tif (record === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor: unknown field placeholder '${placeholderName} on ${this.name}'. Unless this is just a typo, this is ` +\n\t\t\t\t\t`typically caused by one of the following:\\n` +\n\t\t\t\t\t`\\t• Trying to access a field that has not been registered during static render, and thus lacks a marker and an accessor.\\n` +\n\t\t\t\t\t`\\t• Misusing an EntityAccessor getter. If you used one of the getRelative[…] family, please make sure all ` +\n\t\t\t\t\t`parameters match the marker tree exactly.` +\n\t\t\t\t\t`\\n\\nFor more information, please consult the documentation.\\n\\n`,\n\t\t\t)\n\t\t}\n\t\treturn record.getAccessor()\n\t}\n\n\tprivate getPersistedKeyByPlaceholder(placeholderName: string): string | null {\n\t\tif (this.dataFromServer === undefined) {\n\t\t\treturn null\n\t\t}\n\t\tconst key = this.dataFromServer.get(placeholderName)\n\n\t\tif (key instanceof ServerGeneratedUuid) {\n\t\t\treturn key.value\n\t\t}\n\t\tif (key === null) {\n\t\t\t// TODO this also returns null and fails to throw when placeholderName points to a regular scalar field that\n\t\t\t// \thappens to be also null.\n\t\t\treturn null\n\t\t}\n\n\t\t// From now on, we're past the happy path, way into error land.\n\t\tif (key === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: unknown placeholder '${placeholderName}'. Unless this is just ` +\n\t\t\t\t\t`a typo, this typically happens when a has-one relation hasn't been registered during static render.`,\n\t\t\t)\n\t\t}\n\t\tif (key instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a has-many relation, ` +\n\t\t\t\t\t`not a has-one. This method is meant exclusively for has-one relations.`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(\n\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a scalar field, not a` +\n\t\t\t\t`has-one relation. This method is meant exclusively for has-one relations.`,\n\t\t)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListener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AAgE;AAAA;AAIlE,QAAI,eAAe,KAAK;AACvB,YAAM,IAAI,aACT,4DAA4D;AAAA;AAI9D,UAAM,IAAI,aACT,4DAA4D;AAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityAccessor.js","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, ServerGeneratedUuid, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport type { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly stateKey: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {}\n\n\tpublic get idOnServer(): string | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.SugaredValidationError): () => void {\n\t\treturn this.operations.addError(this.stateKey, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.stateKey, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.stateKey, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.stateKey, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.stateKey)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\tpublic getKeyConnectedOnServer(entity: SugaredRelativeSingleEntity | string): string | null {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity(entity, this.environment)\n\t\tconst lastHasOne = desugared.hasOneRelationPath[desugared.hasOneRelationPath.length - 1]\n\t\tconst lastHasOnePlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(lastHasOne)\n\n\t\tlet containingAccessor: EntityAccessor = this\n\n\t\tif (desugared.hasOneRelationPath.length > 1) {\n\t\t\tcontainingAccessor = this.getRelativeSingleEntity({\n\t\t\t\thasOneRelationPath: desugared.hasOneRelationPath.slice(0, -1),\n\t\t\t})\n\t\t}\n\t\treturn containingAccessor.getPersistedKeyByPlaceholder(lastHasOnePlaceholder)\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleEntity(field).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getFieldPlaceholder(field.field),\n\t\t) as unknown as FieldAccessor<Value>\n\t}\n\n\tpublic getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\trelativeTo = relativeTo.getAccessorByPlaceholder(\n\t\t\t\tPlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation),\n\t\t\t) as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor {\n\t\treturn this.getRelativeSingleEntity(entityList).getAccessorByPlaceholder(\n\t\t\tPlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation),\n\t\t) as EntityListAccessor\n\t}\n\n\tprivate getAccessorByPlaceholder(placeholderName: FieldName): EntityAccessor.NestedAccessor {\n\t\tconst record = this.fieldData.get(placeholderName)\n\t\tif (record === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor: unknown field placeholder '${placeholderName} on ${this.name}'. Unless this is just a typo, this is ` +\n\t\t\t\t\t`typically caused by one of the following:\\n` +\n\t\t\t\t\t`\\t• Trying to access a field that has not been registered during static render, and thus lacks a marker and an accessor.\\n` +\n\t\t\t\t\t`\\t• Misusing an EntityAccessor getter. If you used one of the getRelative[…] family, please make sure all ` +\n\t\t\t\t\t`parameters match the marker tree exactly.` +\n\t\t\t\t\t`\\n\\nFor more information, please consult the documentation.\\n\\n`,\n\t\t\t)\n\t\t}\n\t\treturn record.getAccessor()\n\t}\n\n\tprivate getPersistedKeyByPlaceholder(placeholderName: string): string | null {\n\t\tif (this.dataFromServer === undefined) {\n\t\t\treturn null\n\t\t}\n\t\tconst key = this.dataFromServer.get(placeholderName)\n\n\t\tif (key instanceof ServerGeneratedUuid) {\n\t\t\treturn key.value\n\t\t}\n\t\tif (key === null) {\n\t\t\t// TODO this also returns null and fails to throw when placeholderName points to a regular scalar field that\n\t\t\t// \thappens to be also null.\n\t\t\treturn null\n\t\t}\n\n\t\t// From now on, we're past the happy path, way into error land.\n\t\tif (key === undefined) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: unknown placeholder '${placeholderName}'. Unless this is just ` +\n\t\t\t\t\t`a typo, this typically happens when a has-one relation hasn't been registered during static render.`,\n\t\t\t)\n\t\t}\n\t\tif (key instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a has-many relation, ` +\n\t\t\t\t\t`not a has-one. This method is meant exclusively for has-one relations.`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(\n\t\t\t`EntityAccessor.getKeyConnectedOnServer: the placeholder '${placeholderName}' refers to a scalar field, not a` +\n\t\t\t\t`has-one relation. This method is meant exclusively for has-one relations.`,\n\t\t)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListenerMap\n}\n\nexport { EntityAccessor }\n"],"names":[],"mappings":";;;;;AA6BA,qBAA0C;AAAA,EAClC,YACW,UACA,YACA,WACD,KACA,MACC,WACA,gBACD,uBACA,QACA,aACA,aACf;AAXgB;AACA;AACA;AACD;AACA;AACC;AACA;AACD;AACA;AACA;AACA;AAAA;AAAA,MAGN,aAAiC;AAC3C,WAAO,KAAK,UAAU,iBAAiB,KAAK,UAAU,QAAQ;AAAA;AAAA,MAMpD,KAAe;AACzB,WAAO,KAAK,UAAU;AAAA;AAAA,MAGZ,iBAA0B;AACpC,WAAO,KAAK,UAAU;AAAA;AAAA,EAKhB,SAAS,OAAyD;AACxE,WAAO,KAAK,WAAW,SAAS,KAAK,UAAU;AAAA;AAAA,EAGzC,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,aAAa,gBAA0D;AAC7E,SAAK,WAAW,aAAa,KAAK,UAAU;AAAA;AAAA,EAGtC,qBAAqB,OAAkB,iBAAuC;AACpF,SAAK,WAAW,qBAAqB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGrD,wBAAwB,OAAkB,uBAAkE;AAClH,SAAK,WAAW,wBAAwB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,eAAqB;AAC3B,SAAK,WAAW,aAAa,KAAK;AAAA;AAAA,EAK5B,aAAa,iBAAuD;AAC1E,SAAK,aAAa,iBAAe;AAChC,YAAM,UAAU,MAAM,QAAQ,mBAAmB,kBAAkB,OAAO,QAAQ;AAElF,iBAAW,CAAC,OAAO,UAAU,SAAS;AACrC,sBAAc,SAAS,OAAO,YAAY;AAAA;AAAA;AAAA;AAAA,EAStC,SACN,OACuB;AACvB,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AM,KAAK,eAAe,IAAI;AAEpC,QAAI,eAAe,qBAAqB;AACvC,aAAO,IAAI;AAAA;AAEZ,QAAI,QAAQ,MAAM;AAGjB,aAAO;AAAA;AAIR,QAAI,QAAQ,QAAW;AACtB,YAAM,IAAI,aACT,gEAAgE;AAAA;AAIlE,QAAI,eAAe,KAAK;AACvB,YAAM,IAAI,aACT,4DAA4D;AAAA;AAI9D,UAAM,IAAI,aACT,4DAA4D;AAAA;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderGenerator.js","sources":["../../../src/markers/PlaceholderGenerator.ts"],"sourcesContent":["import type {\n\
|
|
1
|
+
{"version":3,"file":"PlaceholderGenerator.js","sources":["../../../src/markers/PlaceholderGenerator.ts"],"sourcesContent":["import type {\n\tFieldName,\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Hashing } from '../utils'\n\nexport class PlaceholderGenerator {\n\tpublic static getFieldPlaceholder(fieldName: FieldName): string {\n\t\treturn fieldName\n\t}\n\n\tpublic static getHasOneRelationPlaceholder(relation: HasOneRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashHasOneRelation(relation)}`\n\t}\n\n\tpublic static getHasManyRelationPlaceholder(relation: HasManyRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashHasManyRelation(relation)}`\n\t}\n\n\tpublic static getEntitySubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t): string {\n\t\treturn `est_${Hashing.hashEntitySubTreeParameters(subTreeParameters)}`\n\t}\n\n\tpublic static getEntityListSubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t): string {\n\t\treturn `lst_${Hashing.hashEntityListSubTreeParameters(subTreeParameters)}`\n\t}\n}\n"],"names":[],"mappings":";;2BAWkC;AAAA,SACnB,oBAAoB,WAA8B;AAC/D,WAAO;AAAA;AAAA,SAGM,6BAA6B,UAAkC;AAC5E,WAAO,GAAG,SAAS,SAAS,QAAQ,mBAAmB;AAAA;AAAA,SAG1C,8BAA8B,UAAmC;AAC9E,WAAO,GAAG,SAAS,SAAS,QAAQ,oBAAoB;AAAA;AAAA,SAG3C,4BACb,mBACS;AACT,WAAO,OAAO,QAAQ,4BAA4B;AAAA;AAAA,SAGrC,gCACb,mBACS;AACT,WAAO,OAAO,QAAQ,gCAAgC;AAAA;AAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Parser.js","sources":["../../../src/queryLanguage/Parser.ts"],"sourcesContent":["import { CrudQueryBuilder, GraphQlBuilder, GraphQlLiteral, Input } from '@contember/client'\nimport { EmbeddedActionsParser, Lexer } from 'chevrotain'\nimport { Environment } from '../dao'\nimport type {\n\tDesugaredHasManyRelation,\n\tDesugaredHasOneRelation,\n\tDesugaredQualifiedEntityList,\n\tDesugaredQualifiedFieldList,\n\tDesugaredQualifiedSingleEntity,\n\tDesugaredRelativeEntityList,\n\tDesugaredRelativeSingleEntity,\n\tDesugaredRelativeSingleField,\n\tDesugaredUnconstrainedQualifiedEntityList,\n\tDesugaredUnconstrainedQualifiedSingleEntity,\n\tEntityName,\n\tFieldName,\n\tFilter,\n\tOrderBy,\n\tUniqueWhere,\n} from '../treeParameters'\nimport { CacheStore } from './CacheStore'\nimport { QueryLanguageError } from './QueryLanguageError'\nimport { tokenList, TokenRegExps, tokens } from './tokenList'\n\n/**\n * TODO:\n * \t- double quoted strings\n * \t- collections (objects & lists)\n * \t- collection operators (e.g. 'in', 'notIn', etc.)\n * \t- filtering toOne\n */\nclass Parser extends EmbeddedActionsParser {\n\tprivate static rawInput: string = ''\n\tprivate static lexer = new Lexer(tokenList)\n\tprivate static parser = new Parser()\n\tprivate static environment: Environment = new Environment()\n\tprivate static cacheStore: CacheStore = new CacheStore()\n\n\tprivate qualifiedEntityList = this.RULE<DesugaredQualifiedEntityList>('qualifiedEntityList', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\n\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t})\n\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate qualifiedFieldList = this.RULE<DesugaredQualifiedFieldList>('qualifiedFieldList', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\n\t\tthis.CONSUME(tokens.Dot)\n\n\t\tconst { hasOneRelationPath, field } = this.SUBRULE(this.relativeSingleField)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\tfield,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate qualifiedSingleEntity = this.RULE<DesugaredQualifiedSingleEntity>('qualifiedSingleEntity', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\n\t\t// TODO this will probably go away once we support singleton entities\n\t\tconst where = this.SUBRULE(this.uniqueWhere)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t})\n\n\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\twhere,\n\t\t\thasOneRelationPath,\n\t\t\tfilter,\n\t\t}\n\t})\n\n\tprivate unconstrainedQualifiedEntityList = this.RULE<DesugaredUnconstrainedQualifiedEntityList>(\n\t\t'unconstrainedQualifiedEntityList',\n\t\t() => {\n\t\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\t\tconst relativeSingleEntity = this.OPTION(() => {\n\t\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t\t})\n\n\t\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tentityName,\n\t\t\t\thasOneRelationPath,\n\t\t\t}\n\t\t},\n\t)\n\n\tprivate unconstrainedQualifiedSingleEntity = this.RULE<DesugaredUnconstrainedQualifiedSingleEntity>(\n\t\t'unconstrainedQualifiedSingleEntity',\n\t\t() => {\n\t\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t\t})\n\n\t\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tentityName,\n\t\t\t\thasOneRelationPath,\n\t\t\t}\n\t\t},\n\t)\n\n\tprivate relativeSingleField = this.RULE<DesugaredRelativeSingleField>('relativeSingleField', () => {\n\t\tlet { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity)\n\n\t\tconst last = this.ACTION(() => hasOneRelationPath.pop()!)\n\n\t\tthis.ACTION(() => {\n\t\t\tif (last.reducedBy !== undefined || last.filter !== undefined) {\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced or filtered, which, grammatically, makes it a relation but a single field is expected.`,\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\tconst field = this.ACTION(() => last.field)\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t\tfield,\n\t\t}\n\t})\n\n\tprivate relativeSingleEntity = this.RULE<DesugaredRelativeSingleEntity>('relativeSingleEntity', () => {\n\t\tconst hasOneRelationPath: DesugaredHasOneRelation[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Dot,\n\t\t\tDEF: () => {\n\t\t\t\thasOneRelationPath.push(this.SUBRULE(this.hasOneRelation))\n\t\t\t},\n\t\t})\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate relativeEntityList = this.RULE<DesugaredRelativeEntityList>('relativeEntityList', () => {\n\t\tlet { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity)\n\n\t\tconst last = this.ACTION(() => hasOneRelationPath.pop()!)\n\n\t\tthis.ACTION(() => {\n\t\t\tif (last.reducedBy !== undefined) {\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced, which, grammatically, makes it a has-one relation but a has-many relation is expected.`,\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\tconst hasManyRelation = this.ACTION(\n\t\t\t(): DesugaredHasManyRelation => ({\n\t\t\t\tfield: last.field,\n\t\t\t\tfilter: last.filter,\n\t\t\t}),\n\t\t)\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t\thasManyRelation,\n\t\t}\n\t})\n\n\tprivate hasOneRelation = this.RULE<DesugaredHasOneRelation>('hasOneRelation', () => {\n\t\tconst fieldName = this.SUBRULE(this.fieldName)\n\t\tconst reducedBy = this.OPTION(() => this.SUBRULE(this.uniqueWhere))\n\t\tconst filter = this.OPTION1(() => this.SUBRULE(this.nonUniqueWhere))\n\t\tconst hasOneRelation: DesugaredHasOneRelation = {\n\t\t\tfield: fieldName,\n\t\t\tfilter,\n\t\t\treducedBy,\n\t\t}\n\n\t\treturn hasOneRelation\n\t})\n\n\tprivate nonUniqueWhere: () => Filter = this.RULE('nonUniqueWhere', () => {\n\t\tconst cnfWhere: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE(() => {\n\t\t\tthis.CONSUME(tokens.LeftBracket)\n\n\t\t\tcnfWhere.push(this.SUBRULE(this.disjunction))\n\n\t\t\tthis.CONSUME(tokens.RightBracket)\n\t\t})\n\t\tif (cnfWhere.length === 1) {\n\t\t\treturn cnfWhere[0]\n\t\t}\n\t\treturn {\n\t\t\tand: cnfWhere,\n\t\t}\n\t})\n\n\tprivate disjunction: () => Filter = this.RULE('disjunction', () => {\n\t\tconst conjunctions: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Or,\n\t\t\tDEF: () => {\n\t\t\t\tconjunctions.push(this.SUBRULE(this.conjunction))\n\t\t\t},\n\t\t})\n\t\tif (conjunctions.length === 1) {\n\t\t\treturn conjunctions[0]\n\t\t}\n\t\treturn {\n\t\t\tor: conjunctions,\n\t\t}\n\t})\n\n\tprivate conjunction: () => Filter = this.RULE('conjunction', () => {\n\t\tconst negations: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.And,\n\t\t\tDEF: () => {\n\t\t\t\tnegations.push(this.SUBRULE(this.negation))\n\t\t\t},\n\t\t})\n\t\tif (negations.length === 1) {\n\t\t\treturn negations[0]\n\t\t}\n\t\treturn {\n\t\t\tand: negations,\n\t\t}\n\t})\n\n\t// TODO this is to naïve and needs rewriting\n\tprivate negation: () => Filter = this.RULE('negation', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.Not)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tnot: this.SUBRULE(this.filterGroup),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\treturn this.SUBRULE1(this.filterGroup)\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate filterGroup: () => Filter = this.RULE('filterGroup', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.LeftParenthesis)\n\t\t\t\t\tconst subFilter = this.SUBRULE(this.disjunction)\n\t\t\t\t\tthis.CONSUME1(tokens.RightParenthesis)\n\t\t\t\t\treturn subFilter\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE1(this.filterAtom),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate filterAtom: () => Filter = this.RULE('filterAtom', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (typeof variable !== 'object' || variable instanceof GraphQlBuilder.GraphQlLiteral) {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`Invalid filter value '${JSON.stringify(variable)}'`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn variable\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE1(this.fieldWhere),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate fieldWhere: () => Parser.AST.FieldWhere = this.RULE('fieldWhere', () => {\n\t\tconst fields: FieldName[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Dot,\n\t\t\tDEF: () => {\n\t\t\t\tfields.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t},\n\t\t})\n\n\t\tconst condition = this.SUBRULE(this.condition)\n\n\t\tlet i = fields.length - 1\n\t\tlet where: Parser.AST.FieldWhere = {\n\t\t\t[fields[i--]]: condition,\n\t\t}\n\n\t\twhile (i >= 0) {\n\t\t\twhere = {\n\t\t\t\t[fields[i--]]: where,\n\t\t\t}\n\t\t}\n\n\t\treturn where\n\t})\n\n\tprivate condition: () => Parser.AST.Condition = this.RULE('condition', () => {\n\t\tconst operator = this.SUBRULE(this.conditionOperator)\n\t\tconst columnValue = this.SUBRULE(this.columnValue)\n\t\tconst condition: Parser.AST.Condition = {}\n\n\t\treturn this.ACTION(() => {\n\t\t\tif (columnValue === null) {\n\t\t\t\tif (operator === 'eq') {\n\t\t\t\t\tcondition.null = true\n\t\t\t\t} else if (operator === 'notEq') {\n\t\t\t\t\tcondition.null = false\n\t\t\t\t} else {\n\t\t\t\t\tthrow new QueryLanguageError(`The null keyword as a right hand operand can only be tested for (in)equality.`)\n\t\t\t\t}\n\t\t\t\treturn condition\n\t\t\t}\n\t\t\tcondition[operator] = columnValue\n\n\t\t\treturn condition\n\t\t})\n\t})\n\n\tprivate conditionOperator: () => Parser.AST.ConditionOperator = this.RULE<Parser.AST.ConditionOperator>(\n\t\t'conditionOperator',\n\t\t() => {\n\t\t\treturn this.OR([\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.Equals)\n\t\t\t\t\t\treturn 'eq'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.NotEquals)\n\t\t\t\t\t\treturn 'notEq'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.LowerThan)\n\t\t\t\t\t\treturn 'lt'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.LowerEqual)\n\t\t\t\t\t\treturn 'lte'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.GreaterThan)\n\t\t\t\t\t\treturn 'gt'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.GreaterEqual)\n\t\t\t\t\t\treturn 'gte'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t])\n\t\t},\n\t)\n\n\tprivate columnValue: () => Parser.AST.ColumnValue = this.RULE<Parser.AST.ColumnValue>('columnValue', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.Null)\n\t\t\t\t\treturn null\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.True)\n\t\t\t\t\treturn true\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.False)\n\t\t\t\t\treturn false\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.primaryValue),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate uniqueWhere = this.RULE('uniqueWhere', () => {\n\t\tconst where: UniqueWhere = {}\n\n\t\tthis.CONSUME(tokens.LeftParenthesis)\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Comma,\n\t\t\tDEF: () => {\n\t\t\t\tconst nestedFields: string[] = []\n\t\t\t\tthis.AT_LEAST_ONE_SEP1({\n\t\t\t\t\tSEP: tokens.Dot,\n\t\t\t\t\tDEF: () => {\n\t\t\t\t\t\tnestedFields.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tthis.CONSUME(tokens.Equals)\n\t\t\t\tconst primaryValue = this.SUBRULE<Input.PrimaryValue<GraphQlBuilder.GraphQlLiteral>>(this.primaryValue)\n\n\t\t\t\tthis.ACTION(() => {\n\t\t\t\t\tlet nestedWhere = where\n\t\t\t\t\tfor (let i = 0, len = nestedFields.length; i < len; i++) {\n\t\t\t\t\t\tconst nestedField = nestedFields[i]\n\n\t\t\t\t\t\tconst isLast = len - 1 === i\n\n\t\t\t\t\t\tif (isLast) {\n\t\t\t\t\t\t\tif (nestedField in nestedWhere) {\n\t\t\t\t\t\t\t\tthrow new QueryLanguageError(`Duplicate '${nestedFields.slice(0, i + 1).join('.')}' field`)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tnestedWhere[nestedField] = primaryValue\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (nestedField in nestedWhere) {\n\t\t\t\t\t\t\t\tconst existingWhere = nestedWhere[nestedField]\n\n\t\t\t\t\t\t\t\tif (typeof existingWhere === 'object' && !(existingWhere instanceof GraphQlBuilder.GraphQlLiteral)) {\n\t\t\t\t\t\t\t\t\tnestedWhere = existingWhere\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t\t\t\t\t\t`Malformed expression: cannot simultaneously treat the '${nestedFields\n\t\t\t\t\t\t\t\t\t\t\t.slice(0, i + 1)\n\t\t\t\t\t\t\t\t\t\t\t.join('.')}' ` + `field as a scalar as well as a relation.`,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst newWhere = {}\n\t\t\t\t\t\t\t\tnestedWhere[nestedField] = newWhere\n\t\t\t\t\t\t\t\tnestedWhere = newWhere\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\t\tthis.CONSUME(tokens.RightParenthesis)\n\n\t\treturn where\n\t})\n\n\tprivate orderBy: () => Input.OrderBy<CrudQueryBuilder.OrderDirection>[] = this.RULE<\n\t\tInput.OrderBy<CrudQueryBuilder.OrderDirection>[]\n\t>('orderBy', () => {\n\t\tconst order: Input.OrderBy<CrudQueryBuilder.OrderDirection>[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Comma,\n\t\t\tDEF: () => {\n\t\t\t\tconst fieldNames: FieldName[] = []\n\t\t\t\tthis.AT_LEAST_ONE_SEP1({\n\t\t\t\t\tSEP: tokens.Dot,\n\t\t\t\t\tDEF: () => {\n\t\t\t\t\t\tfieldNames.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tlet literal = this.OPTION(() => this.SUBRULE1(this.graphQlLiteral)) as\n\t\t\t\t\t| CrudQueryBuilder.OrderDirection\n\t\t\t\t\t| undefined\n\n\t\t\t\tthis.ACTION(() => {\n\t\t\t\t\tif (literal) {\n\t\t\t\t\t\tif (literal.value !== 'asc' && literal.value !== 'desc') {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`The only valid order directions are \\`asc\\` and \\`desc\\`.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tliteral = new GraphQlBuilder.GraphQlLiteral('asc')\n\t\t\t\t\t}\n\t\t\t\t\tlet orderBy: Input.FieldOrderBy<CrudQueryBuilder.OrderDirection> = literal\n\n\t\t\t\t\tfor (let i = fieldNames.length - 1; i >= 0; i--) {\n\t\t\t\t\t\torderBy = { [fieldNames[i]]: orderBy }\n\t\t\t\t\t}\n\t\t\t\t\torder.push(orderBy as Input.OrderBy<CrudQueryBuilder.OrderDirection>)\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\n\t\treturn order\n\t})\n\n\tprivate fieldName: () => FieldName = this.RULE<FieldName>('fieldName', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.fieldIdentifier),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate primaryValue = this.RULE<Input.PrimaryValue<GraphQlBuilder.GraphQlLiteral>>('primaryValue', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.string),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.number),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.graphQlLiteral),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variableValue = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof variableValue === 'string' ||\n\t\t\t\t\t\t\ttypeof variableValue === 'number' ||\n\t\t\t\t\t\t\tvariableValue instanceof GraphQlBuilder.GraphQlLiteral\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn variableValue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t\t\t`A variable can resolve to a literal, string or a number, not ${typeof variableValue}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate fieldIdentifier: () => FieldName = this.RULE('fieldIdentifier', () => {\n\t\treturn this.SUBRULE(this.identifier)\n\t\t// return this.OR([\n\t\t// \t{\n\t\t// \t\tALT: () => this.SUBRULE(this.identifier),\n\t\t// \t},\n\t\t// \t{\n\t\t// \t\tALT: () => {\n\t\t// \t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t// \t\t\treturn this.ACTION(() => {\n\t\t// \t\t\t\tif (!(typeof variable === 'string') || !TokenRegExps.identifier.test(variable)) {\n\t\t// \t\t\t\t\tthrow new QueryLanguageError(`The value \\$${variable} is not a valid field identifier.`)\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\treturn variable\n\t\t// \t\t\t})\n\t\t// \t\t},\n\t\t// \t},\n\t\t// ])\n\t})\n\n\tprivate identifier: () => string = this.RULE('identifier', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.CONSUME(tokens.Identifier).image,\n\t\t\t},\n\t\t\t{\n\t\t\t\t// TODO this is a temporary hack to allow for literals that start with an uppercase letter… 🙈\n\t\t\t\tALT: () => this.CONSUME(tokens.EntityIdentifier).image,\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate entityIdentifier: () => EntityName = this.RULE('entityIdentifier', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.CONSUME(tokens.EntityIdentifier).image,\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (!(typeof variable === 'string') || !TokenRegExps.entityIdentifier.test(variable)) {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`The value of the variable \\$${variable} is not a valid entity identifier.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn variable\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate string = this.RULE('string', () => {\n\t\tconst image = this.CONSUME(tokens.StringLiteral).image\n\t\treturn image\n\t\t\t.substring(1, image.length - 1)\n\t\t\t.replace(\"\\\\'\", \"'\")\n\t\t\t.replace('\\\\b', '\\b')\n\t\t\t.replace('\\\\f', '\\f')\n\t\t\t.replace('\\\\n', '\\n')\n\t\t\t.replace('\\\\r', '\\r')\n\t\t\t.replace('\\\\t', '\\t')\n\t\t\t.replace('\\\\v', '\\v')\n\t})\n\n\tprivate number = this.RULE('number', () => {\n\t\treturn parseFloat(this.CONSUME(tokens.NumberLiteral).image)\n\t})\n\n\tprivate graphQlLiteral: () => GraphQlBuilder.GraphQlLiteral = this.RULE('graphQlLiteral', () => {\n\t\tconst image = this.SUBRULE(this.identifier)\n\n\t\treturn new GraphQlBuilder.GraphQlLiteral(image)\n\t})\n\n\tprivate variable = this.RULE<string | number | GraphQlLiteral | Filter | UniqueWhere>('variable', () => {\n\t\tthis.CONSUME(tokens.DollarSign)\n\t\tconst variableName = this.CONSUME(tokens.Identifier).image\n\n\t\treturn this.ACTION(() => {\n\t\t\tif (Parser.environment.hasName(variableName)) {\n\t\t\t\treturn Parser.environment.getValue(variableName)\n\t\t\t}\n\t\t\tif (Parser.environment.hasDimension(variableName)) {\n\t\t\t\tconst dimensionValue = Parser.environment.getDimension(variableName)\n\n\t\t\t\tif (dimensionValue.length === 1) {\n\t\t\t\t\treturn dimensionValue[0]\n\t\t\t\t}\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`The variable \\$${variableName} resolved to a dimension which exists but contains ${dimensionValue.length} values. It has to contain exactly one. ` +\n\t\t\t\t\t\t`Perhaps you forgot to set the 'maxItems' prop of your DimensionsSwitcher?`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow new QueryLanguageError(`Undefined variable \\$${variableName}.`)\n\t\t})\n\t})\n\n\tprivate constructor() {\n\t\tsuper(tokenList, { outputCst: false, maxLookahead: 1 })\n\t\tthis.performSelfAnalysis()\n\t}\n\n\tpublic static parseQueryLanguageExpression<E extends Parser.EntryPoint>(\n\t\tinput: string,\n\t\tentry: E,\n\t\tenvironment: Environment,\n\t): Parser.ParserResult[E] {\n\t\tconst cached = this.cacheStore.get(environment, entry, input)\n\n\t\tif (cached !== undefined) {\n\t\t\treturn cached\n\t\t}\n\n\t\tconst lexingResult = Parser.lexer.tokenize((Parser.rawInput = input))\n\n\t\tif (lexingResult.errors.length !== 0) {\n\t\t\tthrow new QueryLanguageError(\n\t\t\t\t`Failed to tokenize '${input}'.\\n\\n${lexingResult.errors.map(i => i.message).join('\\n')}`,\n\t\t\t)\n\t\t}\n\n\t\tParser.environment = environment\n\t\tParser.parser.input = lexingResult.tokens\n\n\t\tlet expression: Parser.ParserResult[keyof Parser.ParserResult]\n\n\t\tswitch (entry) {\n\t\t\tcase 'relativeSingleField':\n\t\t\t\texpression = Parser.parser.relativeSingleField()\n\t\t\t\tbreak\n\t\t\tcase 'relativeSingleEntity':\n\t\t\t\texpression = Parser.parser.relativeSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'relativeEntityList':\n\t\t\t\texpression = Parser.parser.relativeEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedEntityList':\n\t\t\t\texpression = Parser.parser.qualifiedEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedFieldList':\n\t\t\t\texpression = Parser.parser.qualifiedFieldList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedSingleEntity':\n\t\t\t\texpression = Parser.parser.qualifiedSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'unconstrainedQualifiedEntityList':\n\t\t\t\texpression = Parser.parser.unconstrainedQualifiedEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'unconstrainedQualifiedSingleEntity':\n\t\t\t\texpression = Parser.parser.unconstrainedQualifiedSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'uniqueWhere':\n\t\t\t\texpression = Parser.parser.uniqueWhere()\n\t\t\t\tbreak\n\t\t\tcase 'filter':\n\t\t\t\texpression = Parser.parser.nonUniqueWhere()\n\t\t\t\tbreak\n\t\t\tcase 'orderBy':\n\t\t\t\texpression = Parser.parser.orderBy()\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tthrow new QueryLanguageError(`Not implemented entry point '${entry}'`)\n\t\t}\n\n\t\tif (Parser.parser.errors.length !== 0) {\n\t\t\tthrow new QueryLanguageError(\n\t\t\t\t`Failed to parse '${input}'.\\n\\n${Parser.parser.errors.map(i => i.message).join('\\n')}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.cacheStore.set(environment, entry, input, expression as Parser.ParserResult[E])\n\n\t\treturn expression as Parser.ParserResult[E]\n\t}\n}\n\nnamespace Parser {\n\texport namespace AST {\n\t\texport type FieldWhere = Input.FieldWhere<Condition>\n\n\t\texport type ColumnValue = Input.ColumnValue<GraphQlBuilder.GraphQlLiteral>\n\n\t\texport type Condition = Input.Condition<ColumnValue>\n\n\t\texport type ConditionOperator = keyof Pick<Condition, 'eq' | 'notEq' | 'lt' | 'lte' | 'gt' | 'gte'>\n\t}\n\n\texport interface ParserResult {\n\t\tqualifiedEntityList: DesugaredQualifiedEntityList // E.g. Author[age < 123].son.sisters(name = 'Jane')\n\t\tqualifiedFieldList: DesugaredQualifiedFieldList // E.g. Author[age < 123].son.sister.name\n\t\tqualifiedSingleEntity: DesugaredQualifiedSingleEntity // E.g. Author(id = 123).son.sister\n\t\tunconstrainedQualifiedEntityList: DesugaredUnconstrainedQualifiedEntityList // E.g. Author.son.sister\n\t\tunconstrainedQualifiedSingleEntity: DesugaredUnconstrainedQualifiedSingleEntity // E.g. Author.son.sister\n\t\trelativeSingleField: DesugaredRelativeSingleField // E.g. authors(id = 123).person.name\n\t\trelativeSingleEntity: DesugaredRelativeSingleEntity // E.g. localesByLocale(locale.slug = en)\n\t\trelativeEntityList: DesugaredRelativeEntityList // E.g. genres(slug = 'sciFi').authors[age < 123]\n\t\tuniqueWhere: UniqueWhere // E.g. (author.mother.id = 123)\n\t\tfilter: Filter // E.g. [author.son.age < 123]\n\t\torderBy: OrderBy // E.g. items.order asc, items.content.name asc\n\t}\n\n\texport type EntryPoint = keyof ParserResult\n}\n\nexport { Parser }\n"],"names":[],"mappings":";;;;;;;AA+BA,qBAAqB,sBAAsB;AAAA,SAC3B,WAAmB;AAAA,SACnB,QAAQ,IAAI,MAAM;AAAA,SAClB,SAAS,IAAI;AAAA,SACb,cAA2B,IAAI;AAAA,SAC/B,aAAyB,IAAI;AAAA,EAEpC,sBAAsB,KAAK,KAAmC,uBAAuB,MAAM;AAClG,UAAM,aAAa,KAAK,QAAQ,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,MAAM,KAAK,QAAQ,KAAK;AAEnD,UAAM,uBAAuB,KAAK,QAAQ,MAAM;AAC/C,WAAK,QAAQ,OAAO;AACpB,aAAO,KAAK,QAAQ,KAAK;AAAA;AAE1B,UAAM,qBAAqB,KAAK,OAAO,MACtC,yBAAyB,SAAY,KAAK,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O,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA;AAEA,cAAM,IAAI,mBAAmB,gCAAgC;AAAA;AAG/D,QAAI,OAAO,OAAO,OAAO,WAAW,GAAG;AACtC,YAAM,IAAI,mBACT,oBAAoB;AAAA;AAAA,EAAc,OAAO,OAAO,OAAO,IAAI,OAAK,EAAE,SAAS,KAAK;AAAA;AAIlF,SAAK,WAAW,IAAI,aAAa,OAAO,OAAO;AAE/C,WAAO;AAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Parser.js","sources":["../../../src/queryLanguage/Parser.ts"],"sourcesContent":["import { CrudQueryBuilder, GraphQlBuilder, GraphQlLiteral, Input } from '@contember/client'\nimport { EmbeddedActionsParser, Lexer } from 'chevrotain'\nimport { Environment } from '../dao'\nimport type {\n\tEntityName,\n\tFieldName,\n\tFilter,\n\tOrderBy,\n\tUniqueWhere,\n} from '../treeParameters'\nimport type {\n\tParsedHasManyRelation,\n\tParsedHasOneRelation,\n\tParsedQualifiedEntityList,\n\tParsedQualifiedFieldList,\n\tParsedQualifiedSingleEntity,\n\tParsedRelativeEntityList,\n\tParsedRelativeSingleEntity,\n\tParsedRelativeSingleField,\n\tParsedUnconstrainedQualifiedEntityList,\n\tParsedUnconstrainedQualifiedSingleEntity,\n} from './ParserResults'\nimport { CacheStore } from './CacheStore'\nimport { QueryLanguageError } from './QueryLanguageError'\nimport { tokenList, TokenRegExps, tokens } from './tokenList'\n\n/**\n * TODO:\n * \t- double quoted strings\n * \t- collections (objects & lists)\n * \t- collection operators (e.g. 'in', 'notIn', etc.)\n * \t- filtering toOne\n */\nclass Parser extends EmbeddedActionsParser {\n\tprivate static rawInput: string = ''\n\tprivate static lexer = new Lexer(tokenList)\n\tprivate static parser = new Parser()\n\tprivate static environment: Environment = new Environment()\n\tprivate static cacheStore: CacheStore = new CacheStore()\n\n\tprivate qualifiedEntityList = this.RULE<ParsedQualifiedEntityList>('qualifiedEntityList', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\n\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t})\n\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate qualifiedFieldList = this.RULE<ParsedQualifiedFieldList>('qualifiedFieldList', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\n\t\tthis.CONSUME(tokens.Dot)\n\n\t\tconst { hasOneRelationPath, field } = this.SUBRULE(this.relativeSingleField)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\tfield,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate qualifiedSingleEntity = this.RULE<ParsedQualifiedSingleEntity>('qualifiedSingleEntity', () => {\n\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\n\t\t// TODO this will probably go away once we support singleton entities\n\t\tconst where = this.SUBRULE(this.uniqueWhere)\n\t\tconst filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere))\n\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t})\n\n\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\twhere,\n\t\t\thasOneRelationPath,\n\t\t\tfilter,\n\t\t}\n\t})\n\n\tprivate unconstrainedQualifiedEntityList = this.RULE<ParsedUnconstrainedQualifiedEntityList>(\n\t\t'unconstrainedQualifiedEntityList',\n\t\t() => {\n\t\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\t\tconst relativeSingleEntity = this.OPTION(() => {\n\t\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t\t})\n\n\t\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tentityName,\n\t\t\t\thasOneRelationPath,\n\t\t\t}\n\t\t},\n\t)\n\n\tprivate unconstrainedQualifiedSingleEntity = this.RULE<ParsedUnconstrainedQualifiedSingleEntity>(\n\t\t'unconstrainedQualifiedSingleEntity',\n\t\t() => {\n\t\t\tconst entityName = this.SUBRULE(this.entityIdentifier)\n\t\t\tconst relativeSingleEntity = this.OPTION1(() => {\n\t\t\t\tthis.CONSUME(tokens.Dot)\n\t\t\t\treturn this.SUBRULE(this.relativeSingleEntity)\n\t\t\t})\n\n\t\t\tconst hasOneRelationPath = this.ACTION(() =>\n\t\t\t\trelativeSingleEntity === undefined ? [] : relativeSingleEntity.hasOneRelationPath,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tentityName,\n\t\t\t\thasOneRelationPath,\n\t\t\t}\n\t\t},\n\t)\n\n\tprivate relativeSingleField = this.RULE<ParsedRelativeSingleField>('relativeSingleField', () => {\n\t\tlet { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity)\n\n\t\tconst last = this.ACTION(() => hasOneRelationPath.pop()!)\n\n\t\tthis.ACTION(() => {\n\t\t\tif (last.reducedBy !== undefined || last.filter !== undefined) {\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced or filtered, which, grammatically, makes it a relation but a single field is expected.`,\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\tconst field = this.ACTION(() => last.field)\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t\tfield,\n\t\t}\n\t})\n\n\tprivate relativeSingleEntity = this.RULE<ParsedRelativeSingleEntity>('relativeSingleEntity', () => {\n\t\tconst hasOneRelationPath: ParsedHasOneRelation[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Dot,\n\t\t\tDEF: () => {\n\t\t\t\thasOneRelationPath.push(this.SUBRULE(this.hasOneRelation))\n\t\t\t},\n\t\t})\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t}\n\t})\n\n\tprivate relativeEntityList = this.RULE<ParsedRelativeEntityList>('relativeEntityList', () => {\n\t\tlet { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity)\n\n\t\tconst last = this.ACTION(() => hasOneRelationPath.pop()!)\n\n\t\tthis.ACTION(() => {\n\t\t\tif (last.reducedBy !== undefined) {\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced, which, grammatically, makes it a has-one relation but a has-many relation is expected.`,\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\tconst hasManyRelation = this.ACTION(\n\t\t\t(): ParsedHasManyRelation => ({\n\t\t\t\tfield: last.field,\n\t\t\t\tfilter: last.filter,\n\t\t\t}),\n\t\t)\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t\thasManyRelation,\n\t\t}\n\t})\n\n\tprivate hasOneRelation = this.RULE<ParsedHasOneRelation>('hasOneRelation', () => {\n\t\tconst fieldName = this.SUBRULE(this.fieldName)\n\t\tconst reducedBy = this.OPTION(() => this.SUBRULE(this.uniqueWhere))\n\t\tconst filter = this.OPTION1(() => this.SUBRULE(this.nonUniqueWhere))\n\t\tconst hasOneRelation: ParsedHasOneRelation = {\n\t\t\tfield: fieldName,\n\t\t\tfilter,\n\t\t\treducedBy,\n\t\t}\n\n\t\treturn hasOneRelation\n\t})\n\n\tprivate nonUniqueWhere: () => Filter = this.RULE('nonUniqueWhere', () => {\n\t\tconst cnfWhere: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE(() => {\n\t\t\tthis.CONSUME(tokens.LeftBracket)\n\n\t\t\tcnfWhere.push(this.SUBRULE(this.disjunction))\n\n\t\t\tthis.CONSUME(tokens.RightBracket)\n\t\t})\n\t\tif (cnfWhere.length === 1) {\n\t\t\treturn cnfWhere[0]\n\t\t}\n\t\treturn {\n\t\t\tand: cnfWhere,\n\t\t}\n\t})\n\n\tprivate disjunction: () => Filter = this.RULE('disjunction', () => {\n\t\tconst conjunctions: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Or,\n\t\t\tDEF: () => {\n\t\t\t\tconjunctions.push(this.SUBRULE(this.conjunction))\n\t\t\t},\n\t\t})\n\t\tif (conjunctions.length === 1) {\n\t\t\treturn conjunctions[0]\n\t\t}\n\t\treturn {\n\t\t\tor: conjunctions,\n\t\t}\n\t})\n\n\tprivate conjunction: () => Filter = this.RULE('conjunction', () => {\n\t\tconst negations: Filter[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.And,\n\t\t\tDEF: () => {\n\t\t\t\tnegations.push(this.SUBRULE(this.negation))\n\t\t\t},\n\t\t})\n\t\tif (negations.length === 1) {\n\t\t\treturn negations[0]\n\t\t}\n\t\treturn {\n\t\t\tand: negations,\n\t\t}\n\t})\n\n\t// TODO this is to naïve and needs rewriting\n\tprivate negation: () => Filter = this.RULE('negation', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.Not)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tnot: this.SUBRULE(this.filterGroup),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\treturn this.SUBRULE1(this.filterGroup)\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate filterGroup: () => Filter = this.RULE('filterGroup', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.LeftParenthesis)\n\t\t\t\t\tconst subFilter = this.SUBRULE(this.disjunction)\n\t\t\t\t\tthis.CONSUME1(tokens.RightParenthesis)\n\t\t\t\t\treturn subFilter\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE1(this.filterAtom),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate filterAtom: () => Filter = this.RULE('filterAtom', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (typeof variable !== 'object' || variable instanceof GraphQlBuilder.GraphQlLiteral) {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`Invalid filter value '${JSON.stringify(variable)}'`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn variable\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE1(this.fieldWhere),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate fieldWhere: () => Parser.AST.FieldWhere = this.RULE('fieldWhere', () => {\n\t\tconst fields: FieldName[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Dot,\n\t\t\tDEF: () => {\n\t\t\t\tfields.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t},\n\t\t})\n\n\t\tconst condition = this.SUBRULE(this.condition)\n\n\t\tlet i = fields.length - 1\n\t\tlet where: Parser.AST.FieldWhere = {\n\t\t\t[fields[i--]]: condition,\n\t\t}\n\n\t\twhile (i >= 0) {\n\t\t\twhere = {\n\t\t\t\t[fields[i--]]: where,\n\t\t\t}\n\t\t}\n\n\t\treturn where\n\t})\n\n\tprivate condition: () => Parser.AST.Condition = this.RULE('condition', () => {\n\t\tconst operator = this.SUBRULE(this.conditionOperator)\n\t\tconst columnValue = this.SUBRULE(this.columnValue)\n\t\tconst condition: Parser.AST.Condition = {}\n\n\t\treturn this.ACTION(() => {\n\t\t\tif (columnValue === null) {\n\t\t\t\tif (operator === 'eq') {\n\t\t\t\t\tcondition.null = true\n\t\t\t\t} else if (operator === 'notEq') {\n\t\t\t\t\tcondition.null = false\n\t\t\t\t} else {\n\t\t\t\t\tthrow new QueryLanguageError(`The null keyword as a right hand operand can only be tested for (in)equality.`)\n\t\t\t\t}\n\t\t\t\treturn condition\n\t\t\t}\n\t\t\tcondition[operator] = columnValue\n\n\t\t\treturn condition\n\t\t})\n\t})\n\n\tprivate conditionOperator: () => Parser.AST.ConditionOperator = this.RULE<Parser.AST.ConditionOperator>(\n\t\t'conditionOperator',\n\t\t() => {\n\t\t\treturn this.OR([\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.Equals)\n\t\t\t\t\t\treturn 'eq'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.NotEquals)\n\t\t\t\t\t\treturn 'notEq'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.LowerThan)\n\t\t\t\t\t\treturn 'lt'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.LowerEqual)\n\t\t\t\t\t\treturn 'lte'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.GreaterThan)\n\t\t\t\t\t\treturn 'gt'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tALT: () => {\n\t\t\t\t\t\tthis.CONSUME(tokens.GreaterEqual)\n\t\t\t\t\t\treturn 'gte'\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t])\n\t\t},\n\t)\n\n\tprivate columnValue: () => Parser.AST.ColumnValue = this.RULE<Parser.AST.ColumnValue>('columnValue', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.Null)\n\t\t\t\t\treturn null\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.True)\n\t\t\t\t\treturn true\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tthis.CONSUME(tokens.False)\n\t\t\t\t\treturn false\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.primaryValue),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate uniqueWhere = this.RULE('uniqueWhere', () => {\n\t\tconst where: UniqueWhere = {}\n\n\t\tthis.CONSUME(tokens.LeftParenthesis)\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Comma,\n\t\t\tDEF: () => {\n\t\t\t\tconst nestedFields: string[] = []\n\t\t\t\tthis.AT_LEAST_ONE_SEP1({\n\t\t\t\t\tSEP: tokens.Dot,\n\t\t\t\t\tDEF: () => {\n\t\t\t\t\t\tnestedFields.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tthis.CONSUME(tokens.Equals)\n\t\t\t\tconst primaryValue = this.SUBRULE<Input.PrimaryValue<GraphQlBuilder.GraphQlLiteral>>(this.primaryValue)\n\n\t\t\t\tthis.ACTION(() => {\n\t\t\t\t\tlet nestedWhere = where\n\t\t\t\t\tfor (let i = 0, len = nestedFields.length; i < len; i++) {\n\t\t\t\t\t\tconst nestedField = nestedFields[i]\n\n\t\t\t\t\t\tconst isLast = len - 1 === i\n\n\t\t\t\t\t\tif (isLast) {\n\t\t\t\t\t\t\tif (nestedField in nestedWhere) {\n\t\t\t\t\t\t\t\tthrow new QueryLanguageError(`Duplicate '${nestedFields.slice(0, i + 1).join('.')}' field`)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tnestedWhere[nestedField] = primaryValue\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (nestedField in nestedWhere) {\n\t\t\t\t\t\t\t\tconst existingWhere = nestedWhere[nestedField]\n\n\t\t\t\t\t\t\t\tif (typeof existingWhere === 'object' && !(existingWhere instanceof GraphQlBuilder.GraphQlLiteral)) {\n\t\t\t\t\t\t\t\t\tnestedWhere = existingWhere\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t\t\t\t\t\t`Malformed expression: cannot simultaneously treat the '${nestedFields\n\t\t\t\t\t\t\t\t\t\t\t.slice(0, i + 1)\n\t\t\t\t\t\t\t\t\t\t\t.join('.')}' ` + `field as a scalar as well as a relation.`,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst newWhere = {}\n\t\t\t\t\t\t\t\tnestedWhere[nestedField] = newWhere\n\t\t\t\t\t\t\t\tnestedWhere = newWhere\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\t\tthis.CONSUME(tokens.RightParenthesis)\n\n\t\treturn where\n\t})\n\n\tprivate orderBy: () => Input.OrderBy<CrudQueryBuilder.OrderDirection>[] = this.RULE<\n\t\tInput.OrderBy<CrudQueryBuilder.OrderDirection>[]\n\t>('orderBy', () => {\n\t\tconst order: Input.OrderBy<CrudQueryBuilder.OrderDirection>[] = []\n\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Comma,\n\t\t\tDEF: () => {\n\t\t\t\tconst fieldNames: FieldName[] = []\n\t\t\t\tthis.AT_LEAST_ONE_SEP1({\n\t\t\t\t\tSEP: tokens.Dot,\n\t\t\t\t\tDEF: () => {\n\t\t\t\t\t\tfieldNames.push(this.SUBRULE(this.fieldIdentifier))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tlet literal = this.OPTION(() => this.SUBRULE1(this.graphQlLiteral)) as\n\t\t\t\t\t| CrudQueryBuilder.OrderDirection\n\t\t\t\t\t| undefined\n\n\t\t\t\tthis.ACTION(() => {\n\t\t\t\t\tif (literal) {\n\t\t\t\t\t\tif (literal.value !== 'asc' && literal.value !== 'desc') {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`The only valid order directions are \\`asc\\` and \\`desc\\`.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tliteral = new GraphQlBuilder.GraphQlLiteral('asc')\n\t\t\t\t\t}\n\t\t\t\t\tlet orderBy: Input.FieldOrderBy<CrudQueryBuilder.OrderDirection> = literal\n\n\t\t\t\t\tfor (let i = fieldNames.length - 1; i >= 0; i--) {\n\t\t\t\t\t\torderBy = { [fieldNames[i]]: orderBy }\n\t\t\t\t\t}\n\t\t\t\t\torder.push(orderBy as Input.OrderBy<CrudQueryBuilder.OrderDirection>)\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\n\t\treturn order\n\t})\n\n\tprivate fieldName: () => FieldName = this.RULE<FieldName>('fieldName', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.fieldIdentifier),\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate primaryValue = this.RULE<Input.PrimaryValue<GraphQlBuilder.GraphQlLiteral>>('primaryValue', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.string),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.number),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.graphQlLiteral),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variableValue = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof variableValue === 'string' ||\n\t\t\t\t\t\t\ttypeof variableValue === 'number' ||\n\t\t\t\t\t\t\tvariableValue instanceof GraphQlBuilder.GraphQlLiteral\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn variableValue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t\t\t`A variable can resolve to a literal, string or a number, not ${typeof variableValue}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate fieldIdentifier: () => FieldName = this.RULE('fieldIdentifier', () => {\n\t\treturn this.SUBRULE(this.identifier)\n\t\t// return this.OR([\n\t\t// \t{\n\t\t// \t\tALT: () => this.SUBRULE(this.identifier),\n\t\t// \t},\n\t\t// \t{\n\t\t// \t\tALT: () => {\n\t\t// \t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t// \t\t\treturn this.ACTION(() => {\n\t\t// \t\t\t\tif (!(typeof variable === 'string') || !TokenRegExps.identifier.test(variable)) {\n\t\t// \t\t\t\t\tthrow new QueryLanguageError(`The value \\$${variable} is not a valid field identifier.`)\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\treturn variable\n\t\t// \t\t\t})\n\t\t// \t\t},\n\t\t// \t},\n\t\t// ])\n\t})\n\n\tprivate identifier: () => string = this.RULE('identifier', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.CONSUME(tokens.Identifier).image,\n\t\t\t},\n\t\t\t{\n\t\t\t\t// TODO this is a temporary hack to allow for literals that start with an uppercase letter… 🙈\n\t\t\t\tALT: () => this.CONSUME(tokens.EntityIdentifier).image,\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate entityIdentifier: () => EntityName = this.RULE('entityIdentifier', () => {\n\t\treturn this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.CONSUME(tokens.EntityIdentifier).image,\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => {\n\t\t\t\t\tconst variable = this.SUBRULE(this.variable)\n\t\t\t\t\treturn this.ACTION(() => {\n\t\t\t\t\t\tif (!(typeof variable === 'string') || !TokenRegExps.entityIdentifier.test(variable)) {\n\t\t\t\t\t\t\tthrow new QueryLanguageError(`The value of the variable \\$${variable} is not a valid entity identifier.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn variable\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t})\n\n\tprivate string = this.RULE('string', () => {\n\t\tconst image = this.CONSUME(tokens.StringLiteral).image\n\t\treturn image\n\t\t\t.substring(1, image.length - 1)\n\t\t\t.replace(\"\\\\'\", \"'\")\n\t\t\t.replace('\\\\b', '\\b')\n\t\t\t.replace('\\\\f', '\\f')\n\t\t\t.replace('\\\\n', '\\n')\n\t\t\t.replace('\\\\r', '\\r')\n\t\t\t.replace('\\\\t', '\\t')\n\t\t\t.replace('\\\\v', '\\v')\n\t})\n\n\tprivate number = this.RULE('number', () => {\n\t\treturn parseFloat(this.CONSUME(tokens.NumberLiteral).image)\n\t})\n\n\tprivate graphQlLiteral: () => GraphQlBuilder.GraphQlLiteral = this.RULE('graphQlLiteral', () => {\n\t\tconst image = this.SUBRULE(this.identifier)\n\n\t\treturn new GraphQlBuilder.GraphQlLiteral(image)\n\t})\n\n\tprivate variable = this.RULE<string | number | GraphQlLiteral | Filter | UniqueWhere>('variable', () => {\n\t\tthis.CONSUME(tokens.DollarSign)\n\t\tconst variableName = this.CONSUME(tokens.Identifier).image\n\n\t\treturn this.ACTION(() => {\n\t\t\tif (Parser.environment.hasName(variableName)) {\n\t\t\t\treturn Parser.environment.getValue(variableName)\n\t\t\t}\n\t\t\tif (Parser.environment.hasDimension(variableName)) {\n\t\t\t\tconst dimensionValue = Parser.environment.getDimension(variableName)\n\n\t\t\t\tif (dimensionValue.length === 1) {\n\t\t\t\t\treturn dimensionValue[0]\n\t\t\t\t}\n\t\t\t\tthrow new QueryLanguageError(\n\t\t\t\t\t`The variable \\$${variableName} resolved to a dimension which exists but contains ${dimensionValue.length} values. It has to contain exactly one. ` +\n\t\t\t\t\t\t`Perhaps you forgot to set the 'maxItems' prop of your DimensionsSwitcher?`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow new QueryLanguageError(`Undefined variable \\$${variableName}.`)\n\t\t})\n\t})\n\n\tprivate constructor() {\n\t\tsuper(tokenList, { outputCst: false, maxLookahead: 1 })\n\t\tthis.performSelfAnalysis()\n\t}\n\n\tpublic static parseQueryLanguageExpression<E extends Parser.EntryPoint>(\n\t\tinput: string,\n\t\tentry: E,\n\t\tenvironment: Environment,\n\t): Parser.ParserResult[E] {\n\t\tconst cached = this.cacheStore.get(environment, entry, input)\n\n\t\tif (cached !== undefined) {\n\t\t\treturn cached\n\t\t}\n\n\t\tconst lexingResult = Parser.lexer.tokenize((Parser.rawInput = input))\n\n\t\tif (lexingResult.errors.length !== 0) {\n\t\t\tthrow new QueryLanguageError(\n\t\t\t\t`Failed to tokenize '${input}'.\\n\\n${lexingResult.errors.map(i => i.message).join('\\n')}`,\n\t\t\t)\n\t\t}\n\n\t\tParser.environment = environment\n\t\tParser.parser.input = lexingResult.tokens\n\n\t\tlet expression: Parser.ParserResult[keyof Parser.ParserResult]\n\n\t\tswitch (entry) {\n\t\t\tcase 'relativeSingleField':\n\t\t\t\texpression = Parser.parser.relativeSingleField()\n\t\t\t\tbreak\n\t\t\tcase 'relativeSingleEntity':\n\t\t\t\texpression = Parser.parser.relativeSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'relativeEntityList':\n\t\t\t\texpression = Parser.parser.relativeEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedEntityList':\n\t\t\t\texpression = Parser.parser.qualifiedEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedFieldList':\n\t\t\t\texpression = Parser.parser.qualifiedFieldList()\n\t\t\t\tbreak\n\t\t\tcase 'qualifiedSingleEntity':\n\t\t\t\texpression = Parser.parser.qualifiedSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'unconstrainedQualifiedEntityList':\n\t\t\t\texpression = Parser.parser.unconstrainedQualifiedEntityList()\n\t\t\t\tbreak\n\t\t\tcase 'unconstrainedQualifiedSingleEntity':\n\t\t\t\texpression = Parser.parser.unconstrainedQualifiedSingleEntity()\n\t\t\t\tbreak\n\t\t\tcase 'uniqueWhere':\n\t\t\t\texpression = Parser.parser.uniqueWhere()\n\t\t\t\tbreak\n\t\t\tcase 'filter':\n\t\t\t\texpression = Parser.parser.nonUniqueWhere()\n\t\t\t\tbreak\n\t\t\tcase 'orderBy':\n\t\t\t\texpression = Parser.parser.orderBy()\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tthrow new QueryLanguageError(`Not implemented entry point '${entry}'`)\n\t\t}\n\n\t\tif (Parser.parser.errors.length !== 0) {\n\t\t\tthrow new QueryLanguageError(\n\t\t\t\t`Failed to parse '${input}'.\\n\\n${Parser.parser.errors.map(i => i.message).join('\\n')}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.cacheStore.set(environment, entry, input, expression as Parser.ParserResult[E])\n\n\t\treturn expression as Parser.ParserResult[E]\n\t}\n}\n\nnamespace Parser {\n\texport namespace AST {\n\t\texport type FieldWhere = Input.FieldWhere<Condition>\n\n\t\texport type ColumnValue = Input.ColumnValue<GraphQlBuilder.GraphQlLiteral>\n\n\t\texport type Condition = Input.Condition<ColumnValue>\n\n\t\texport type ConditionOperator = keyof Pick<Condition, 'eq' | 'notEq' | 'lt' | 'lte' | 'gt' | 'gte'>\n\t}\n\n\texport interface ParserResult {\n\t\tqualifiedEntityList: ParsedQualifiedEntityList // E.g. Author[age < 123].son.sisters(name = 'Jane')\n\t\tqualifiedFieldList: ParsedQualifiedFieldList // E.g. Author[age < 123].son.sister.name\n\t\tqualifiedSingleEntity: ParsedQualifiedSingleEntity // E.g. Author(id = 123).son.sister\n\t\tunconstrainedQualifiedEntityList: ParsedUnconstrainedQualifiedEntityList // E.g. Author.son.sister\n\t\tunconstrainedQualifiedSingleEntity: ParsedUnconstrainedQualifiedSingleEntity // E.g. Author.son.sister\n\t\trelativeSingleField: ParsedRelativeSingleField // E.g. authors(id = 123).person.name\n\t\trelativeSingleEntity: ParsedRelativeSingleEntity // E.g. localesByLocale(locale.slug = en)\n\t\trelativeEntityList: ParsedRelativeEntityList // E.g. genres(slug = 'sciFi').authors[age < 123]\n\t\tuniqueWhere: UniqueWhere // E.g. (author.mother.id = 123)\n\t\tfilter: Filter // E.g. [author.son.age < 123]\n\t\torderBy: OrderBy // E.g. items.order asc, items.content.name asc\n\t}\n\n\texport type EntryPoint = keyof ParserResult\n}\n\nexport { Parser }\n"],"names":[],"mappings":";;;;;;;AAiCA,qBAAqB,sBAAsB;AAAA,SAC3B,WAAmB;AAAA,SACnB,QAAQ,IAAI,MAAM;AAAA,SAClB,SAAS,IAAI;AAAA,SACb,cAA2B,IAAI;AAAA,SAC/B,aAAyB,IAAI;AAAA,EAEpC,sBAAsB,KAAK,KAAgC,uBAAuB,MAAM;AAC/F,UAAM,aAAa,KAAK,QAAQ,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,MAAM,KAAK,QAAQ,KAAK;AAEnD,UAAM,uBAAuB,KAAK,QAAQ,MAAM;AAC/C,WAAK,QAAQ,OAAO;AACpB,aAAO,KAAK,QAAQ,KAAK;AAAA;AAE1B,UAAM,qBAAqB,KAAK,OAAO,MACtC,yBAAyB,SAAY,KAAK,qBAAqB;AAGhE,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,EAIM,qBAAqB,KAAK,KA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