@contember/binding 0.8.0-alpha.7 → 0.8.0-alpha.8

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 CHANGED
@@ -1338,6 +1338,26 @@ declare interface ParsedRelativeSingleField {
1338
1338
  field: FieldName;
1339
1339
  }
1340
1340
 
1341
+ declare interface ParsedTaggedMap {
1342
+ name: string;
1343
+ entries: ParsedTaggedMapEntry[];
1344
+ }
1345
+
1346
+ declare interface ParsedTaggedMapEntry {
1347
+ key: string;
1348
+ value: ParsedTaggedMapLiteralValue | ParsedTaggedMapVariableValue;
1349
+ }
1350
+
1351
+ declare interface ParsedTaggedMapLiteralValue {
1352
+ type: 'literal';
1353
+ value: string | number;
1354
+ }
1355
+
1356
+ declare interface ParsedTaggedMapVariableValue {
1357
+ type: 'variable';
1358
+ value: string;
1359
+ }
1360
+
1341
1361
  declare interface ParsedUnconstrainedQualifiedEntityList {
1342
1362
  entityName: EntityName;
1343
1363
  hasOneRelationPath: ParsedHasOneRelation[];
@@ -1382,6 +1402,11 @@ export declare class Parser extends EmbeddedActionsParser {
1382
1402
  private columnValue;
1383
1403
  private uniqueWhere;
1384
1404
  private orderBy;
1405
+ private taggedMap;
1406
+ private taggedMapEntries;
1407
+ private taggedMapEntry;
1408
+ private taggedMapLiteralValue;
1409
+ private taggedMapVariableValue;
1385
1410
  private fieldName;
1386
1411
  private primaryValue;
1387
1412
  private fieldIdentifier;
@@ -1414,6 +1439,7 @@ export declare namespace Parser {
1414
1439
  uniqueWhere: UniqueWhere;
1415
1440
  filter: Filter;
1416
1441
  orderBy: OrderBy;
1442
+ taggedMap: ParsedTaggedMap;
1417
1443
  }
1418
1444
  export type EntryPoint = keyof ParserResult;
1419
1445
  }
@@ -1491,6 +1517,7 @@ export declare class QueryLanguage {
1491
1517
  static desugarUniqueWhere: (input: string | UniqueWhere<GraphQlLiteral<string>>, environment: Environment) => UniqueWhere<GraphQlLiteral<string>>;
1492
1518
  static desugarFilter: (input: string | Filter<GraphQlLiteral<string>>, environment: Environment) => Filter<GraphQlLiteral<string>>;
1493
1519
  static desugarOrderBy: (input: string | OrderBy, environment: Environment) => OrderBy;
1520
+ static desugarTaggedMap: (input: string | ParsedTaggedMap, environment: Environment) => ParsedTaggedMap;
1494
1521
  private static desugarEntityListParameters;
1495
1522
  static desugarSetOnCreate(setOnCreate: SugaredSetOnCreate, environment: Environment): UniqueWhere;
1496
1523
  static desugarEventListener<F extends Function>(listener: F | Set<F>): Set<F>;
@@ -1873,6 +1900,7 @@ export declare const tokens: {
1873
1900
  DollarSign: TokenType;
1874
1901
  Dot: TokenType;
1875
1902
  Comma: TokenType;
1903
+ Colon: TokenType;
1876
1904
  NumberLiteral: TokenType;
1877
1905
  StringLiteral: TokenType;
1878
1906
  LeftParenthesis: TokenType;
@@ -2202,6 +2230,8 @@ export declare const useGetEntitySubTree: () => (parametersOrAlias: Alias | Suga
2202
2230
 
2203
2231
  export declare const useGetTreeFilters: () => (() => TreeFilter[]);
2204
2232
 
2233
+ export declare const useHasEntity: () => boolean;
2234
+
2205
2235
  export declare const useMutationState: () => boolean;
2206
2236
 
2207
2237
  export declare const useOnConnectionUpdate: (fieldName: FieldName, listener: EntityAccessor.EntityEventListenerMap['connectionUpdate']) => void;
@@ -0,0 +1,9 @@
1
+ import { useContext } from 'react';
2
+ import { EntityKeyContext } from './EntityKeyContext.js';
3
+
4
+ const useHasEntity = () => {
5
+ return useContext(EntityKeyContext) !== void 0;
6
+ };
7
+
8
+ export { useHasEntity };
9
+ //# sourceMappingURL=useHasEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHasEntity.js","sources":["../../../src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":[],"mappings":";;;MAGa,eAAe,MAAe;AAC1C,SAAO,WAAW,sBAAsB;AAAA;;;;"}
@@ -13,6 +13,7 @@ export { useDesugaredRelativeSingleEntity } from './accessorPropagation/useDesug
13
13
  export { useDesugaredRelativeSingleField } from './accessorPropagation/useDesugaredRelativeSingleField.js';
14
14
  export { useEntity } from './accessorPropagation/useEntity.js';
15
15
  export { useEntityKey } from './accessorPropagation/useEntityKey.js';
16
+ export { useHasEntity } from './accessorPropagation/useHasEntity.js';
16
17
  export { useEntityList } from './accessorPropagation/useEntityList.js';
17
18
  export { useEntityListSubTree } from './accessorPropagation/useEntityListSubTree.js';
18
19
  export { useEntityListSubTreeParameters } from './accessorPropagation/useEntityListSubTreeParameters.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -28,7 +28,8 @@ class CacheStore {
28
28
  relativeEntityList: new LRUCache(500),
29
29
  uniqueWhere: new LRUCache(100),
30
30
  filter: new LRUCache(100),
31
- orderBy: new LRUCache(50)
31
+ orderBy: new LRUCache(50),
32
+ taggedMap: new LRUCache(50)
32
33
  };
33
34
  }
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CacheStore.js","sources":["../../../src/queryLanguage/CacheStore.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport { LRUCache } from '../structures'\nimport type { Parser } from './Parser'\n\ntype CacheByEntryPoint = {\n\t[Entry in Parser.EntryPoint]: LRUCache<string, Parser.ParserResult[Entry]>\n}\n\nexport class CacheStore {\n\tprivate cacheStore: WeakMap<Environment, CacheByEntryPoint> = new WeakMap()\n\n\tpublic get<Entry extends Parser.EntryPoint>(\n\t\tenvironment: Environment,\n\t\tentry: Entry,\n\t\texpression: string,\n\t): Parser.ParserResult[Entry] | undefined {\n\t\tlet caches = this.cacheStore.get(environment)\n\n\t\tif (caches === undefined) {\n\t\t\tthis.cacheStore.set(environment, (caches = this.createEntryPointCache()))\n\t\t}\n\t\treturn caches[entry].get(expression) as Parser.ParserResult[Entry] | undefined\n\t}\n\n\tpublic set<Entry extends Parser.EntryPoint>(\n\t\tenvironment: Environment,\n\t\tentry: Entry,\n\t\texpression: string,\n\t\tvalue: Parser.ParserResult[Entry],\n\t) {\n\t\tlet caches = this.cacheStore.get(environment)\n\n\t\tif (caches === undefined) {\n\t\t\tthis.cacheStore.set(environment, (caches = this.createEntryPointCache()))\n\t\t}\n\t\t(caches[entry] as LRUCache<string, Parser.ParserResult[Entry]>).set(expression, value)\n\t}\n\n\tprivate createEntryPointCache(): CacheByEntryPoint {\n\t\t// TODO configurable limits\n\t\treturn {\n\t\t\tqualifiedEntityList: new LRUCache(50),\n\t\t\tqualifiedFieldList: new LRUCache(50),\n\t\t\tqualifiedSingleEntity: new LRUCache(50),\n\t\t\tunconstrainedQualifiedEntityList: new LRUCache(10),\n\t\t\tunconstrainedQualifiedSingleEntity: new LRUCache(10),\n\t\t\trelativeSingleField: new LRUCache(1000),\n\t\t\trelativeSingleEntity: new LRUCache(500),\n\t\t\trelativeEntityList: new LRUCache(500),\n\t\t\tuniqueWhere: new LRUCache(100),\n\t\t\tfilter: new LRUCache(100),\n\t\t\torderBy: new LRUCache(50),\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;iBAQwB;AAAA,EACf,aAAsD,IAAI;AAAA,EAE3D,IACN,aACA,OACA,YACyC;AACzC,QAAI,SAAS,KAAK,WAAW,IAAI;AAEjC,QAAI,WAAW,QAAW;AACzB,WAAK,WAAW,IAAI,aAAc,SAAS,KAAK;AAAA;AAEjD,WAAO,OAAO,OAAO,IAAI;AAAA;AAAA,EAGnB,IACN,aACA,OACA,YACA,OACC;AACD,QAAI,SAAS,KAAK,WAAW,IAAI;AAEjC,QAAI,WAAW,QAAW;AACzB,WAAK,WAAW,IAAI,aAAc,SAAS,KAAK;AAAA;AAEjD,IAAC,OAAO,OAAwD,IAAI,YAAY;AAAA;AAAA,EAGzE,wBAA2C;AAElD,WAAO;AAAA,MACN,qBAAqB,IAAI,SAAS;AAAA,MAClC,oBAAoB,IAAI,SAAS;AAAA,MACjC,uBAAuB,IAAI,SAAS;AAAA,MACpC,kCAAkC,IAAI,SAAS;AAAA,MAC/C,oCAAoC,IAAI,SAAS;AAAA,MACjD,qBAAqB,IAAI,SAAS;AAAA,MAClC,sBAAsB,IAAI,SAAS;AAAA,MACnC,oBAAoB,IAAI,SAAS;AAAA,MACjC,aAAa,IAAI,SAAS;AAAA,MAC1B,QAAQ,IAAI,SAAS;AAAA,MACrB,SAAS,IAAI,SAAS;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"CacheStore.js","sources":["../../../src/queryLanguage/CacheStore.ts"],"sourcesContent":["import type { Environment } from '../dao'\nimport { LRUCache } from '../structures'\nimport type { Parser } from './Parser'\n\ntype CacheByEntryPoint = {\n\t[Entry in Parser.EntryPoint]: LRUCache<string, Parser.ParserResult[Entry]>\n}\n\nexport class CacheStore {\n\tprivate cacheStore: WeakMap<Environment, CacheByEntryPoint> = new WeakMap()\n\n\tpublic get<Entry extends Parser.EntryPoint>(\n\t\tenvironment: Environment,\n\t\tentry: Entry,\n\t\texpression: string,\n\t): Parser.ParserResult[Entry] | undefined {\n\t\tlet caches = this.cacheStore.get(environment)\n\n\t\tif (caches === undefined) {\n\t\t\tthis.cacheStore.set(environment, (caches = this.createEntryPointCache()))\n\t\t}\n\t\treturn caches[entry].get(expression) as Parser.ParserResult[Entry] | undefined\n\t}\n\n\tpublic set<Entry extends Parser.EntryPoint>(\n\t\tenvironment: Environment,\n\t\tentry: Entry,\n\t\texpression: string,\n\t\tvalue: Parser.ParserResult[Entry],\n\t) {\n\t\tlet caches = this.cacheStore.get(environment)\n\n\t\tif (caches === undefined) {\n\t\t\tthis.cacheStore.set(environment, (caches = this.createEntryPointCache()))\n\t\t}\n\t\t(caches[entry] as LRUCache<string, Parser.ParserResult[Entry]>).set(expression, value)\n\t}\n\n\tprivate createEntryPointCache(): CacheByEntryPoint {\n\t\t// TODO configurable limits\n\t\treturn {\n\t\t\tqualifiedEntityList: new LRUCache(50),\n\t\t\tqualifiedFieldList: new LRUCache(50),\n\t\t\tqualifiedSingleEntity: new LRUCache(50),\n\t\t\tunconstrainedQualifiedEntityList: new LRUCache(10),\n\t\t\tunconstrainedQualifiedSingleEntity: new LRUCache(10),\n\t\t\trelativeSingleField: new LRUCache(1000),\n\t\t\trelativeSingleEntity: new LRUCache(500),\n\t\t\trelativeEntityList: new LRUCache(500),\n\t\t\tuniqueWhere: new LRUCache(100),\n\t\t\tfilter: new LRUCache(100),\n\t\t\torderBy: new LRUCache(50),\n\t\t\ttaggedMap: new LRUCache(50),\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;iBAQwB;AAAA,EACf,aAAsD,IAAI;AAAA,EAE3D,IACN,aACA,OACA,YACyC;AACzC,QAAI,SAAS,KAAK,WAAW,IAAI;AAEjC,QAAI,WAAW,QAAW;AACzB,WAAK,WAAW,IAAI,aAAc,SAAS,KAAK;AAAA;AAEjD,WAAO,OAAO,OAAO,IAAI;AAAA;AAAA,EAGnB,IACN,aACA,OACA,YACA,OACC;AACD,QAAI,SAAS,KAAK,WAAW,IAAI;AAEjC,QAAI,WAAW,QAAW;AACzB,WAAK,WAAW,IAAI,aAAc,SAAS,KAAK;AAAA;AAEjD,IAAC,OAAO,OAAwD,IAAI,YAAY;AAAA;AAAA,EAGzE,wBAA2C;AAElD,WAAO;AAAA,MACN,qBAAqB,IAAI,SAAS;AAAA,MAClC,oBAAoB,IAAI,SAAS;AAAA,MACjC,uBAAuB,IAAI,SAAS;AAAA,MACpC,kCAAkC,IAAI,SAAS;AAAA,MAC/C,oCAAoC,IAAI,SAAS;AAAA,MACjD,qBAAqB,IAAI,SAAS;AAAA,MAClC,sBAAsB,IAAI,SAAS;AAAA,MACnC,oBAAoB,IAAI,SAAS;AAAA,MACjC,aAAa,IAAI,SAAS;AAAA,MAC1B,QAAQ,IAAI,SAAS;AAAA,MACrB,SAAS,IAAI,SAAS;AAAA,MACtB,WAAW,IAAI,SAAS;AAAA;AAAA;AAAA;;;;"}
@@ -406,6 +406,63 @@ class Parser extends EmbeddedActionsParser {
406
406
  });
407
407
  return order;
408
408
  });
409
+ taggedMap = this.RULE("taggedMap", () => {
410
+ const name = this.SUBRULE(this.identifier);
411
+ return {
412
+ name,
413
+ entries: this.OPTION(() => this.SUBRULE(this.taggedMapEntries)) ?? []
414
+ };
415
+ });
416
+ taggedMapEntries = this.RULE("taggedMapEntries", () => {
417
+ this.CONSUME(tokens.LeftParenthesis);
418
+ const entries = [];
419
+ this.AT_LEAST_ONE_SEP({
420
+ SEP: tokens.Comma,
421
+ DEF: () => entries.push(this.SUBRULE(this.taggedMapEntry))
422
+ });
423
+ this.CONSUME(tokens.RightParenthesis);
424
+ return entries;
425
+ });
426
+ taggedMapEntry = this.RULE("taggedMapEntry", () => {
427
+ const variableName = this.CONSUME(tokens.Identifier).image;
428
+ this.CONSUME1(tokens.Colon);
429
+ const value = this.OR([
430
+ {
431
+ ALT: () => this.SUBRULE(this.taggedMapLiteralValue)
432
+ },
433
+ {
434
+ ALT: () => this.SUBRULE(this.taggedMapVariableValue)
435
+ }
436
+ ]);
437
+ return {
438
+ key: variableName,
439
+ value
440
+ };
441
+ });
442
+ taggedMapLiteralValue = this.RULE("taggedMapLiteralValue", () => {
443
+ const value = this.OR([
444
+ {
445
+ ALT: () => this.SUBRULE(this.string)
446
+ },
447
+ {
448
+ ALT: () => this.SUBRULE(this.number)
449
+ }
450
+ ]);
451
+ return {
452
+ type: "literal",
453
+ value
454
+ };
455
+ });
456
+ taggedMapVariableValue = this.RULE("taggedMapVariableValue", () => {
457
+ const start = this.CONSUME(tokens.DollarSign);
458
+ this.SUBRULE(this.relativeSingleField);
459
+ const end = this.LA(0);
460
+ const field = this.input.slice(this.input.indexOf(start) + 1, this.input.indexOf(end) + 1).map((it) => it.image).join("");
461
+ return {
462
+ type: "variable",
463
+ value: field
464
+ };
465
+ });
409
466
  fieldName = this.RULE("fieldName", () => {
410
467
  return this.OR([
411
468
  {
@@ -548,6 +605,9 @@ ${lexingResult.errors.map((i) => i.message).join("\n")}`);
548
605
  case "orderBy":
549
606
  expression = Parser.parser.orderBy();
550
607
  break;
608
+ case "taggedMap":
609
+ expression = Parser.parser.taggedMap();
610
+ break;
551
611
  default:
552
612
  throw new QueryLanguageError(`Not implemented entry point '${entry}'`);
553
613
  }
@@ -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\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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AAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,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 { EntityName, FieldName, Filter, OrderBy, UniqueWhere } from '../treeParameters'\nimport type {\n\tParsedTaggedMap,\n\tParsedTaggedMapVariableValue,\n\tParsedTaggedMapLiteralValue,\n\tParsedTaggedMapEntry,\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 taggedMap: () => ParsedTaggedMap = this.RULE<ParsedTaggedMap>('taggedMap', () => {\n\t\tconst name = this.SUBRULE(this.identifier)\n\t\treturn {\n\t\t\tname,\n\t\t\tentries: this.OPTION(() => this.SUBRULE(this.taggedMapEntries)) ?? [],\n\t\t}\n\t})\n\n\tprivate taggedMapEntries: () => ParsedTaggedMapEntry[] = this.RULE<ParsedTaggedMapEntry[]>('taggedMapEntries', () => {\n\t\tthis.CONSUME(tokens.LeftParenthesis)\n\t\tconst entries: ParsedTaggedMapEntry[] = []\n\t\tthis.AT_LEAST_ONE_SEP({\n\t\t\tSEP: tokens.Comma,\n\t\t\tDEF: () => entries.push(this.SUBRULE(this.taggedMapEntry)),\n\t\t})\n\t\tthis.CONSUME(tokens.RightParenthesis)\n\n\t\treturn entries\n\t})\n\n\tprivate taggedMapEntry: () => ParsedTaggedMapEntry = this.RULE<ParsedTaggedMapEntry>('taggedMapEntry', () => {\n\t\tconst variableName = this.CONSUME(tokens.Identifier).image\n\t\tthis.CONSUME1(tokens.Colon)\n\t\tconst value = this.OR([\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.taggedMapLiteralValue),\n\t\t\t},\n\t\t\t{\n\t\t\t\tALT: () => this.SUBRULE(this.taggedMapVariableValue),\n\t\t\t},\n\t\t])\n\n\t\treturn {\n\t\t\tkey: variableName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\tprivate taggedMapLiteralValue: () => ParsedTaggedMapLiteralValue = this.RULE<ParsedTaggedMapLiteralValue>('taggedMapLiteralValue', () => {\n\t\tconst value = 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])\n\n\t\treturn {\n\t\t\ttype: 'literal',\n\t\t\tvalue,\n\t\t}\n\t})\n\n\tprivate taggedMapVariableValue: () => ParsedTaggedMapVariableValue = this.RULE<ParsedTaggedMapVariableValue>('taggedMapVariableValue', () => {\n\t\tconst start = this.CONSUME(tokens.DollarSign)\n\t\tthis.SUBRULE(this.relativeSingleField)\n\t\tconst end = this.LA(0)\n\t\tconst field = this.input.slice(this.input.indexOf(start) + 1, this.input.indexOf(end) + 1).map(it => it.image).join('')\n\n\t\treturn {\n\t\t\ttype: 'variable',\n\t\t\tvalue: field,\n\t\t}\n\t})\n\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\tcase 'taggedMap':\n\t\t\t\texpression = Parser.parser.taggedMap()\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\ttaggedMap: ParsedTaggedMap // E.g editUser(id: $entity.id, foo: 'bar')\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,I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AS,KAAK;AAAA;AAIpF,WAAO,cAAc;AACrB,WAAO,OAAO,QAAQ,aAAa;AAEnC,QAAI;AAEJ,YAAQ;AAAA,WACF;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,OAAO;AAC3B;AAAA,WACI;AACJ,qBAAa,OAAO,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;;;;"}
@@ -33,6 +33,7 @@ class QueryLanguage {
33
33
  static desugarUniqueWhere = QueryLanguage.preparePrimitiveEntryPointWithFallback("uniqueWhere");
34
34
  static desugarFilter = QueryLanguage.preparePrimitiveEntryPointWithFallback("filter");
35
35
  static desugarOrderBy = QueryLanguage.preparePrimitiveEntryPointWithFallback("orderBy");
36
+ static desugarTaggedMap = QueryLanguage.preparePrimitiveEntryPointWithFallback("taggedMap");
36
37
  static desugarEntityListParameters(sugarablePart, unsugarablePart, environment) {
37
38
  return {
38
39
  filter: sugarablePart.filter ? this.desugarFilter(sugarablePart.filter, environment) : void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"QueryLanguage.js","sources":["../../../src/queryLanguage/QueryLanguage.ts"],"sourcesContent":["import { emptyObject } from '@contember/react-utils'\nimport { TreeParameterMerger, VariableInputTransformer } from '../core'\nimport type { Environment } from '../dao'\nimport {\n\tAlias,\n\tEntityCreationParametersDefaults,\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityListParameters,\n\tEntityListPreferencesDefaults,\n\tEntityName,\n\tEventListenersStore,\n\tFieldEventListenerStore,\n\tFieldName,\n\tFilter,\n\tHasManyRelation,\n\tHasOneRelation,\n\tLeafFieldDefaults,\n\tParentEntityParameters,\n\tQualifiedEntityList,\n\tQualifiedEntityParametersDefaults,\n\tQualifiedFieldList,\n\tQualifiedSingleEntity,\n\tRelationDefaults,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugarableEntityListParameters,\n\tSugarableHasManyRelation,\n\tSugarableHasOneRelation,\n\tSugaredFilter,\n\tSugaredParentEntityParameters,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedFieldList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredSetOnCreate,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n\tUniqueWhere,\n\tUnsugarableEntityListEventListeners,\n\tUnsugarableEntityListParameters,\n\tUnsugarableFieldEventListeners,\n\tUnsugarableHasManyRelation,\n\tUnsugarableHasOneRelation,\n\tUnsugarableSingleEntityEventListeners,\n} from '../treeParameters'\nimport { Parser } from './Parser'\nimport { GraphQlLiteral } from '@contember/client'\nimport { ParsedHasManyRelation, ParsedHasOneRelation } from './ParserResults'\n\nexport class QueryLanguage {\n\n\tprivate static preparePrimitiveEntryPoint<Entry extends Parser.EntryPoint>(entryPoint: Entry) {\n\t\treturn (input: string, environment: Environment): Parser.ParserResult[Entry] =>\n\t\t\tParser.parseQueryLanguageExpression(input, entryPoint, environment)\n\t}\n\n\tprivate static preparePrimitiveEntryPointWithFallback<Entry extends Parser.EntryPoint>(entryPoint: Entry) {\n\t\treturn (input: string | Parser.ParserResult[Entry], environment: Environment): Parser.ParserResult[Entry] => {\n\t\t\tif (typeof input === 'string') {\n\t\t\t\treturn Parser.parseQueryLanguageExpression(input, entryPoint, environment)\n\t\t\t}\n\t\t\treturn input\n\t\t}\n\t}\n\n\tprivate static parseUnconstrainedQualifiedEntityList = QueryLanguage.preparePrimitiveEntryPoint('unconstrainedQualifiedEntityList')\n\tprivate static parseUnconstrainedQualifiedSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('unconstrainedQualifiedEntityList')\n\tprivate static parseQualifiedEntityList = QueryLanguage.preparePrimitiveEntryPoint('qualifiedEntityList')\n\tprivate static parseQualifiedFieldList = QueryLanguage.preparePrimitiveEntryPoint('qualifiedFieldList')\n\tprivate static parseQualifiedSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('qualifiedSingleEntity')\n\tprivate static parseRelativeEntityList = QueryLanguage.preparePrimitiveEntryPoint('relativeEntityList')\n\tprivate static parseRelativeSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('relativeSingleEntity')\n\tprivate static parseRelativeSingleField = QueryLanguage.preparePrimitiveEntryPoint('relativeSingleField')\n\n\tpublic static desugarUniqueWhere = QueryLanguage.preparePrimitiveEntryPointWithFallback('uniqueWhere')\n\tpublic static desugarFilter = QueryLanguage.preparePrimitiveEntryPointWithFallback('filter')\n\tpublic static desugarOrderBy = QueryLanguage.preparePrimitiveEntryPointWithFallback('orderBy')\n\n\n\tprivate static desugarEntityListParameters(\n\t\tsugarablePart: SugarableEntityListParameters,\n\t\tunsugarablePart: UnsugarableEntityListParameters,\n\t\tenvironment: Environment,\n\t): EntityListParameters {\n\t\treturn {\n\t\t\tfilter: sugarablePart.filter ? this.desugarFilter(sugarablePart.filter, environment) : undefined,\n\t\t\tlimit: unsugarablePart.limit,\n\t\t\toffset: unsugarablePart.offset,\n\t\t\torderBy: unsugarablePart.orderBy ? this.desugarOrderBy(unsugarablePart.orderBy, environment) : undefined,\n\t\t\tinitialEntityCount: unsugarablePart.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t}\n\t}\n\n\tpublic static desugarSetOnCreate(setOnCreate: SugaredSetOnCreate, environment: Environment): UniqueWhere {\n\t\tif (Array.isArray(setOnCreate)) {\n\t\t\tconst whereList = setOnCreate.map(connection => this.desugarUniqueWhere(connection, environment))\n\t\t\treturn whereList.reduce(\n\t\t\t\t(accumulator, uniqueWhere) => TreeParameterMerger.mergeSetOnCreate(accumulator, uniqueWhere)!,\n\t\t\t)\n\t\t}\n\t\tif (typeof setOnCreate === 'string') {\n\t\t\treturn this.desugarUniqueWhere(setOnCreate, environment)\n\t\t}\n\t\treturn setOnCreate\n\t}\n\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F>): Set<F>\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F> | undefined): Set<F> | undefined\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F> | undefined): Set<F> | undefined {\n\t\tif (typeof listener === 'function') {\n\t\t\treturn new Set([listener])\n\t\t}\n\t\treturn listener\n\t}\n\n\tprivate static desugarSingleEntityEventListeners(\n\t\tunsugarable: UnsugarableSingleEntityEventListeners,\n\t): EntityEventListenerStore | undefined {\n\t\tif (\n\t\t\tunsugarable.onBeforePersist === undefined &&\n\t\t\tunsugarable.onBeforeUpdate === undefined &&\n\t\t\tunsugarable.onInitialize === undefined &&\n\t\t\tunsugarable.onPersistError === undefined &&\n\t\t\tunsugarable.onPersistSuccess === undefined &&\n\t\t\tunsugarable.onUpdate === undefined\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst store: EntityEventListenerStore = new EventListenersStore()\n\n\t\tif (unsugarable.onConnectionUpdate) {\n\t\t\tfor (const fieldName in unsugarable.onConnectionUpdate) {\n\t\t\t\tconst listener = this.desugarEventListener(unsugarable.onConnectionUpdate[fieldName])\n\t\t\t\tstore.set({ type: 'connectionUpdate', key: fieldName }, listener)\n\t\t\t}\n\t\t}\n\n\t\tconst beforePersist = this.desugarEventListener(unsugarable.onBeforePersist)\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst initialize = this.desugarEventListener(unsugarable.onInitialize)\n\t\tconst persistError = this.desugarEventListener(unsugarable.onPersistError)\n\t\tconst persistSuccess = this.desugarEventListener(unsugarable.onPersistSuccess)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforePersist) {\n\t\t\tstore.set({ type: 'beforePersist' }, beforePersist)\n\t\t}\n\t\tif (beforeUpdate) {\n\t\t\tstore.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (initialize) {\n\t\t\tstore.set({ type: 'initialize' }, initialize)\n\t\t}\n\t\tif (persistError) {\n\t\t\tstore.set({ type: 'persistError' }, persistError)\n\t\t}\n\t\tif (persistSuccess) {\n\t\t\tstore.set({ type: 'persistSuccess' }, persistSuccess)\n\t\t}\n\t\tif (update) {\n\t\t\tstore.set({ type: 'update' }, update)\n\t\t}\n\n\t\treturn store\n\t}\n\n\tprivate static desugarEntityListEventListeners(unsugarable: UnsugarableEntityListEventListeners):\n\t\t| {\n\t\t\t\teventListeners: EntityListEventListenerStore | undefined\n\t\t\t\tchildEventListeners: EntityEventListenerStore | undefined\n\t\t }\n\t\t| undefined {\n\t\tif (\n\t\t\tunsugarable.onBeforePersist === undefined &&\n\t\t\tunsugarable.onBeforeUpdate === undefined &&\n\t\t\tunsugarable.onChildBeforeUpdate === undefined &&\n\t\t\tunsugarable.onChildInitialize === undefined &&\n\t\t\tunsugarable.onChildUpdate === undefined &&\n\t\t\tunsugarable.onInitialize === undefined &&\n\t\t\tunsugarable.onPersistError === undefined &&\n\t\t\tunsugarable.onPersistSuccess === undefined &&\n\t\t\tunsugarable.onUpdate === undefined\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst eventListeners: EntityListEventListenerStore = new EventListenersStore()\n\n\t\tconst beforePersist = this.desugarEventListener(unsugarable.onBeforePersist)\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst initialize = this.desugarEventListener(unsugarable.onInitialize)\n\t\tconst persistError = this.desugarEventListener(unsugarable.onPersistError)\n\t\tconst persistSuccess = this.desugarEventListener(unsugarable.onPersistSuccess)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforePersist) {\n\t\t\teventListeners.set({ type: 'beforePersist' }, beforePersist)\n\t\t}\n\t\tif (beforeUpdate) {\n\t\t\teventListeners.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (initialize) {\n\t\t\teventListeners.set({ type: 'initialize' }, initialize)\n\t\t}\n\t\tif (persistError) {\n\t\t\teventListeners.set({ type: 'persistError' }, persistError)\n\t\t}\n\t\tif (persistSuccess) {\n\t\t\teventListeners.set({ type: 'persistSuccess' }, persistSuccess)\n\t\t}\n\t\tif (update) {\n\t\t\teventListeners.set({ type: 'update' }, update)\n\t\t}\n\n\t\tconst childEventListeners: EntityEventListenerStore = new EventListenersStore()\n\n\t\tconst childBeforeUpdate = this.desugarEventListener(unsugarable.onChildBeforeUpdate)\n\t\tconst childInitialize = this.desugarEventListener(unsugarable.onChildInitialize)\n\t\tconst childUpdate = this.desugarEventListener(unsugarable.onChildUpdate)\n\n\t\tif (childBeforeUpdate) {\n\t\t\tchildEventListeners.set({ type: 'beforeUpdate' }, childBeforeUpdate)\n\t\t}\n\t\tif (childInitialize) {\n\t\t\tchildEventListeners.set({ type: 'initialize' }, childInitialize)\n\t\t}\n\t\tif (childUpdate) {\n\t\t\tchildEventListeners.set({ type: 'update' }, childUpdate)\n\t\t}\n\n\t\treturn {\n\t\t\teventListeners,\n\t\t\tchildEventListeners,\n\t\t}\n\t}\n\n\tprivate static desugarFieldEventListeners(\n\t\tunsugarable: UnsugarableFieldEventListeners,\n\t): FieldEventListenerStore | undefined {\n\t\tif (unsugarable.onBeforeUpdate === undefined && unsugarable.onUpdate === undefined) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst store: FieldEventListenerStore = new EventListenersStore()\n\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforeUpdate) {\n\t\t\tstore.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (update) {\n\t\t\tstore.set({ type: 'update' }, update)\n\t\t}\n\n\t\treturn store\n\t}\n\n\tprivate static desugarSubTreeAlias(alias: Alias | Set<Alias> | undefined): Set<Alias> | undefined {\n\t\tif (alias === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (alias instanceof Set) {\n\t\t\treturn alias\n\t\t}\n\t\treturn new Set<Alias>().add(alias)\n\t}\n\n\tprivate static desugarHasOneRelation(\n\t\tsugarable: SugarableHasOneRelation,\n\t\tunsugarable: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation {\n\t\treturn {\n\t\t\tfield: sugarable.field,\n\t\t\tfilter: sugarable.filter ? this.desugarFilter(sugarable.filter, environment) : undefined,\n\t\t\texpectedMutation: unsugarable.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\treducedBy: sugarable.reducedBy ? this.desugarUniqueWhere(sugarable.reducedBy, environment) : undefined,\n\t\t\tsetOnCreate: unsugarable.setOnCreate ? this.desugarSetOnCreate(unsugarable.setOnCreate, environment) : undefined,\n\t\t\tisNonbearing: unsugarable.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarable.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(unsugarable),\n\t\t}\n\t}\n\n\tprivate static augmentDesugaredHasOneRelationPath(\n\t\tpath: ParsedHasOneRelation[],\n\t\tunsugarable: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation[] {\n\t\treturn path.map((desugaredHasOneRelation, i) =>\n\t\t\t// Unsugarable applies to the last\n\t\t\tthis.desugarHasOneRelation(desugaredHasOneRelation, i === path.length - 1 ? unsugarable : {}, environment),\n\t\t)\n\t}\n\n\tprivate static augmentDesugaredHasManyRelation(\n\t\trelation: ParsedHasManyRelation,\n\t\tunsugarable: UnsugarableHasManyRelation,\n\t\tenvironment: Environment,\n\t): HasManyRelation {\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarable)\n\t\treturn {\n\t\t\tfield: relation.field,\n\t\t\tfilter: relation.filter,\n\t\t\texpectedMutation: unsugarable.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\tisNonbearing: unsugarable.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarable.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tinitialEntityCount: unsugarable.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t\tsetOnCreate: unsugarable.setOnCreate ? this.desugarSetOnCreate(unsugarable.setOnCreate, environment) : undefined,\n\t\t\torderBy: unsugarable.orderBy ? this.desugarOrderBy(unsugarable.orderBy, environment) : undefined,\n\t\t\toffset: unsugarable.offset,\n\t\t\tlimit: unsugarable.limit,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tprivate static desugarHasOneRelationPath(\n\t\tinput: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined,\n\t\tlastRelation: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation[] {\n\t\tif (input === undefined) {\n\t\t\tinput = []\n\t\t} else if (!Array.isArray(input)) {\n\t\t\tinput = [input]\n\t\t}\n\n\t\tconst relationPath: HasOneRelation[] = []\n\n\t\tconst cappedLength = input.length - 1\n\t\tlet i = 0\n\t\tfor (; i < cappedLength; i++) {\n\t\t\t// Deliberately leaving out the last element\n\t\t\tconst pathNode = input[i]\n\n\t\t\trelationPath.push(this.desugarHasOneRelation(pathNode, {}, environment))\n\t\t}\n\t\tif (i in input) {\n\t\t\trelationPath.push(this.desugarHasOneRelation(input[i], lastRelation, environment))\n\t\t}\n\n\t\treturn relationPath\n\t}\n\n\tprivate static desugarHasManyRelation(\n\t\tsugarablePart: SugarableHasManyRelation,\n\t\tunsugarablePart: UnsugarableHasManyRelation,\n\t\tenvironment: Environment,\n\t): HasManyRelation {\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarablePart)\n\t\treturn {\n\t\t\t...this.desugarEntityListParameters(sugarablePart, unsugarablePart, environment),\n\t\t\texpectedMutation: unsugarablePart.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\tsetOnCreate: unsugarablePart.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarablePart.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\tfield: sugarablePart.field,\n\t\t\tisNonbearing: unsugarablePart.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarablePart.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tpublic static desugarUnconstrainedQualifiedEntityList(\n\t\t{ entities, ...unsugarableEntityList }: SugaredUnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): UnconstrainedQualifiedEntityList {\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet entityName: EntityName\n\n\t\tif (typeof entities === 'string') {\n\t\t\tconst parsed = this.parseUnconstrainedQualifiedEntityList(entities, environment)\n\t\t\tentityName = parsed.entityName\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entities.entityName\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(entities.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarableEntityList)\n\n\t\treturn {\n\t\t\tisCreating: true,\n\t\t\tisNonbearing: unsugarableEntityList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableEntityList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableEntityList.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableEntityList.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableEntityList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t\tinitialEntityCount: unsugarableEntityList.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t\talias: this.desugarSubTreeAlias(unsugarableEntityList.alias),\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarUnconstrainedQualifiedSingleEntity(\n\t\t{ entity, ...unsugarableSingleEntity }: SugaredUnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): UnconstrainedQualifiedSingleEntity {\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet entityName: EntityName\n\n\t\tif (typeof entity === 'string') {\n\t\t\tconst parsed = this.parseUnconstrainedQualifiedSingleEntity(entity, environment)\n\t\t\tentityName = parsed.entityName\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entity.entityName\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(\n\t\t\t\tentity.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\treturn {\n\t\t\tisCreating: true,\n\t\t\tisNonbearing: unsugarableSingleEntity.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableSingleEntity.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableSingleEntity.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableSingleEntity.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableSingleEntity.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(unsugarableSingleEntity),\n\t\t\talias: this.desugarSubTreeAlias(unsugarableSingleEntity.alias),\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedEntityList(\n\t\t{ entities, ...unsugarableEntityList }: SugaredQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): QualifiedEntityList {\n\t\tlet entityName: EntityName\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tlet filter: SugaredFilter | undefined\n\n\t\tif (typeof entities === 'string') {\n\t\t\tconst parsed = this.parseQualifiedEntityList(entities, environment)\n\n\t\t\tentityName = parsed.entityName\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entities.entityName\n\t\t\tfilter = entities.filter\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(entities.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarableEntityList)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t\t...this.desugarEntityListParameters(\n\t\t\t\t{\n\t\t\t\t\tfilter,\n\t\t\t\t},\n\t\t\t\tunsugarableEntityList,\n\t\t\t\tenvironment,\n\t\t\t),\n\t\t\talias: this.desugarSubTreeAlias(unsugarableEntityList.alias),\n\t\t\tisCreating: false,\n\t\t\tisNonbearing: unsugarableEntityList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableEntityList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableEntityList.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableEntityList.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableEntityList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedFieldList(\n\t\t{ fields, ...unsugarableFieldList }: SugaredQualifiedFieldList,\n\t\tenvironment: Environment,\n\t): QualifiedFieldList {\n\t\tlet field: FieldName\n\t\tlet entityName: EntityName\n\t\tlet filter: SugaredFilter | undefined\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tif (typeof fields === 'string') {\n\t\t\tconst parsed = this.parseQualifiedFieldList(fields, environment)\n\n\t\t\tfield = parsed.field\n\t\t\tentityName = parsed.entityName\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tfield = fields.field\n\t\t\tentityName = fields.entityName\n\t\t\tfilter = fields.filter\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(fields.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\treturn {\n\t\t\tfield,\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t\talias: this.desugarSubTreeAlias(unsugarableFieldList.alias),\n\t\t\tisNonbearing: unsugarableFieldList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableFieldList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tdefaultValue:\n\t\t\t\tunsugarableFieldList.defaultValue !== undefined\n\t\t\t\t\t? VariableInputTransformer.transformValue(unsugarableFieldList.defaultValue, environment)\n\t\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableFieldList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\teventListeners: this.desugarFieldEventListeners(unsugarableFieldList),\n\t\t\t...this.desugarEntityListParameters({ filter }, unsugarableFieldList, environment),\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedSingleEntity(\n\t\t{ entity, ...unsugarableSingleEntity }: SugaredQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t\toptions: { missingSetOnCreate?: 'fill' | 'fillAndWarn' } = {},\n\t): QualifiedSingleEntity {\n\t\tlet entityName: EntityName\n\t\tlet where: UniqueWhere\n\t\tlet filter: Filter | undefined\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tif (typeof entity === 'string') {\n\t\t\tconst parsed = this.parseQualifiedSingleEntity(entity, environment)\n\n\t\t\tentityName = parsed.entityName\n\t\t\twhere = parsed.where\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entity.entityName\n\t\t\twhere = this.desugarUniqueWhere(entity.where, environment)\n\t\t\tfilter = entity.filter ? this.desugarFilter(entity.filter, environment) : undefined\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(\n\t\t\t\tentity.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\t// const forceCreation: boolean =\n\t\t// \tunsugarableSingleEntity.forceCreation !== undefined\n\t\t// \t\t? unsugarableSingleEntity.forceCreation !== undefined\n\t\t// \t\t: EntityCreationParametersDefaults.forceCreation\n\t\tlet setOnCreate: UniqueWhere | undefined =\n\t\t\tunsugarableSingleEntity.setOnCreate !== undefined\n\t\t\t\t? this.desugarSetOnCreate(unsugarableSingleEntity.setOnCreate, environment)\n\t\t\t\t: undefined\n\n\t\t// todo: remove deprecated code\n\t\tif (!setOnCreate && options.missingSetOnCreate) {\n\t\t\tconst whereValues = Object.values(where)\n\t\t\tif (whereValues.length === 1 && whereValues[0] instanceof GraphQlLiteral) {\n\t\t\t\tsetOnCreate = where\n\t\t\t\tif (import.meta.env.DEV && options.missingSetOnCreate === 'fillAndWarn') {\n\t\t\t\t\tconsole.warn('Automatic creation of singleton entities in EditPage is deprecated. Please use setOnCreate prop.')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst isNonbearing: boolean =\n\t\t\tunsugarableSingleEntity.isNonbearing !== undefined\n\t\t\t\t? unsugarableSingleEntity.isNonbearing\n\t\t\t\t: EntityCreationParametersDefaults.isNonbearing\n\t\tconst eventListeners = this.desugarSingleEntityEventListeners(unsugarableSingleEntity)\n\t\tconst expectedMutation =\n\t\t\tunsugarableSingleEntity.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation\n\t\tconst alias = this.desugarSubTreeAlias(unsugarableSingleEntity.alias)\n\n\t\treturn {\n\t\t\talias,\n\t\t\tentityName,\n\t\t\tisCreating: false,\n\t\t\twhere,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t\t// forceCreation,\n\t\t\tsetOnCreate,\n\t\t\tisNonbearing,\n\t\t\teventListeners,\n\t\t\texpectedMutation,\n\t\t}\n\t}\n\n\tpublic static desugarParentEntityParameters(\n\t\tparentEntity: SugaredParentEntityParameters,\n\t\tenvironment: Environment,\n\t): ParentEntityParameters {\n\t\treturn {\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(parentEntity),\n\t\t}\n\t}\n\n\tpublic static desugarRelativeSingleEntity(\n\t\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity,\n\t\tenvironment: Environment,\n\t): RelativeSingleEntity {\n\t\tif (typeof sugaredRelativeSingleEntity === 'string') {\n\t\t\treturn this.desugarRelativeSingleEntity({ field: sugaredRelativeSingleEntity }, environment)\n\t\t}\n\n\t\tconst { field, ...unsugarableEntity } = sugaredRelativeSingleEntity\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeSingleEntity(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field, unsugarableEntity, environment)\n\t\t}\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarRelativeSingleField(\n\t\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n\t\tenvironment: Environment,\n\t): RelativeSingleField {\n\t\tif (typeof sugaredRelativeSingleField === 'string') {\n\t\t\treturn this.desugarRelativeSingleField({ field: sugaredRelativeSingleField }, environment)\n\t\t}\n\n\t\tconst { field, ...unsugarableField } = sugaredRelativeSingleField\n\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet fieldName: FieldName\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeSingleField(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(parsed.hasOneRelationPath, {}, environment)\n\t\t\tfieldName = parsed.field\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field.hasOneRelationPath, {}, environment)\n\t\t\tfieldName = field.field\n\t\t}\n\n\t\treturn {\n\t\t\teventListeners: this.desugarFieldEventListeners(unsugarableField),\n\t\t\thasOneRelationPath,\n\t\t\tfield: fieldName,\n\t\t\tisNonbearing: unsugarableField.isNonbearing ?? LeafFieldDefaults.isNonbearing,\n\t\t\tdefaultValue:\n\t\t\t\tunsugarableField.defaultValue !== undefined\n\t\t\t\t\t? VariableInputTransformer.transformValue(unsugarableField.defaultValue, environment)\n\t\t\t\t\t: undefined,\n\t\t}\n\t}\n\n\tpublic static desugarRelativeEntityList(\n\t\tsugaredRelativeEntityList: string | SugaredRelativeEntityList,\n\t\tenvironment: Environment,\n\t): RelativeEntityList {\n\t\tif (typeof sugaredRelativeEntityList === 'string') {\n\t\t\treturn this.desugarRelativeEntityList(\n\t\t\t\t{\n\t\t\t\t\tfield: sugaredRelativeEntityList,\n\t\t\t\t},\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\tconst { field, ...unsugarableEntityList } = sugaredRelativeEntityList\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet hasManyRelation: HasManyRelation\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeEntityList(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t\thasManyRelation = this.augmentDesugaredHasManyRelation(\n\t\t\t\tparsed.hasManyRelation,\n\t\t\t\tunsugarableEntityList,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field.hasOneRelationPath || [], emptyObject, environment)\n\t\t\thasManyRelation = this.desugarHasManyRelation(field.hasManyRelation, unsugarableEntityList, environment)\n\t\t}\n\n\t\treturn {\n\t\t\thas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I;AACJ,QAAI;AACJ,QAAI,OAAO,UAAU,UAAU;AAC9B,YAAM,SAAS,KAAK,wBAAwB,OAAO;AACnD,2BAAqB,KAAK,mCACzB,OAAO,oBACP,aACA;AAED,wBAAkB,KAAK,gCACtB,OAAO,iBACP,uBACA;AAAA,WAEK;AACN,2BAAqB,KAAK,0BAA0B,MAAM,sBAAsB,IAAI,aAAa;AACjG,wBAAkB,KAAK,uBAAuB,MAAM,iBAAiB,uBAAuB;AAAA;AAG7F,WAAO;AAAA,MACN;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"QueryLanguage.js","sources":["../../../src/queryLanguage/QueryLanguage.ts"],"sourcesContent":["import { emptyObject } from '@contember/react-utils'\nimport { TreeParameterMerger, VariableInputTransformer } from '../core'\nimport type { Environment } from '../dao'\nimport {\n\tAlias,\n\tEntityCreationParametersDefaults,\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityListParameters,\n\tEntityListPreferencesDefaults,\n\tEntityName,\n\tEventListenersStore,\n\tFieldEventListenerStore,\n\tFieldName,\n\tFilter,\n\tHasManyRelation,\n\tHasOneRelation,\n\tLeafFieldDefaults,\n\tParentEntityParameters,\n\tQualifiedEntityList,\n\tQualifiedEntityParametersDefaults,\n\tQualifiedFieldList,\n\tQualifiedSingleEntity,\n\tRelationDefaults,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugarableEntityListParameters,\n\tSugarableHasManyRelation,\n\tSugarableHasOneRelation,\n\tSugaredFilter,\n\tSugaredParentEntityParameters,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedFieldList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredSetOnCreate,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n\tUniqueWhere,\n\tUnsugarableEntityListEventListeners,\n\tUnsugarableEntityListParameters,\n\tUnsugarableFieldEventListeners,\n\tUnsugarableHasManyRelation,\n\tUnsugarableHasOneRelation,\n\tUnsugarableSingleEntityEventListeners,\n} from '../treeParameters'\nimport { Parser } from './Parser'\nimport { GraphQlLiteral } from '@contember/client'\nimport { ParsedHasManyRelation, ParsedHasOneRelation } from './ParserResults'\n\nexport class QueryLanguage {\n\n\tprivate static preparePrimitiveEntryPoint<Entry extends Parser.EntryPoint>(entryPoint: Entry) {\n\t\treturn (input: string, environment: Environment): Parser.ParserResult[Entry] =>\n\t\t\tParser.parseQueryLanguageExpression(input, entryPoint, environment)\n\t}\n\n\tprivate static preparePrimitiveEntryPointWithFallback<Entry extends Parser.EntryPoint>(entryPoint: Entry) {\n\t\treturn (input: string | Parser.ParserResult[Entry], environment: Environment): Parser.ParserResult[Entry] => {\n\t\t\tif (typeof input === 'string') {\n\t\t\t\treturn Parser.parseQueryLanguageExpression(input, entryPoint, environment)\n\t\t\t}\n\t\t\treturn input\n\t\t}\n\t}\n\n\tprivate static parseUnconstrainedQualifiedEntityList = QueryLanguage.preparePrimitiveEntryPoint('unconstrainedQualifiedEntityList')\n\tprivate static parseUnconstrainedQualifiedSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('unconstrainedQualifiedEntityList')\n\tprivate static parseQualifiedEntityList = QueryLanguage.preparePrimitiveEntryPoint('qualifiedEntityList')\n\tprivate static parseQualifiedFieldList = QueryLanguage.preparePrimitiveEntryPoint('qualifiedFieldList')\n\tprivate static parseQualifiedSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('qualifiedSingleEntity')\n\tprivate static parseRelativeEntityList = QueryLanguage.preparePrimitiveEntryPoint('relativeEntityList')\n\tprivate static parseRelativeSingleEntity = QueryLanguage.preparePrimitiveEntryPoint('relativeSingleEntity')\n\tprivate static parseRelativeSingleField = QueryLanguage.preparePrimitiveEntryPoint('relativeSingleField')\n\n\tpublic static desugarUniqueWhere = QueryLanguage.preparePrimitiveEntryPointWithFallback('uniqueWhere')\n\tpublic static desugarFilter = QueryLanguage.preparePrimitiveEntryPointWithFallback('filter')\n\tpublic static desugarOrderBy = QueryLanguage.preparePrimitiveEntryPointWithFallback('orderBy')\n\tpublic static desugarTaggedMap = QueryLanguage.preparePrimitiveEntryPointWithFallback('taggedMap')\n\n\n\tprivate static desugarEntityListParameters(\n\t\tsugarablePart: SugarableEntityListParameters,\n\t\tunsugarablePart: UnsugarableEntityListParameters,\n\t\tenvironment: Environment,\n\t): EntityListParameters {\n\t\treturn {\n\t\t\tfilter: sugarablePart.filter ? this.desugarFilter(sugarablePart.filter, environment) : undefined,\n\t\t\tlimit: unsugarablePart.limit,\n\t\t\toffset: unsugarablePart.offset,\n\t\t\torderBy: unsugarablePart.orderBy ? this.desugarOrderBy(unsugarablePart.orderBy, environment) : undefined,\n\t\t\tinitialEntityCount: unsugarablePart.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t}\n\t}\n\n\tpublic static desugarSetOnCreate(setOnCreate: SugaredSetOnCreate, environment: Environment): UniqueWhere {\n\t\tif (Array.isArray(setOnCreate)) {\n\t\t\tconst whereList = setOnCreate.map(connection => this.desugarUniqueWhere(connection, environment))\n\t\t\treturn whereList.reduce(\n\t\t\t\t(accumulator, uniqueWhere) => TreeParameterMerger.mergeSetOnCreate(accumulator, uniqueWhere)!,\n\t\t\t)\n\t\t}\n\t\tif (typeof setOnCreate === 'string') {\n\t\t\treturn this.desugarUniqueWhere(setOnCreate, environment)\n\t\t}\n\t\treturn setOnCreate\n\t}\n\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F>): Set<F>\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F> | undefined): Set<F> | undefined\n\tpublic static desugarEventListener<F extends Function>(listener: F | Set<F> | undefined): Set<F> | undefined {\n\t\tif (typeof listener === 'function') {\n\t\t\treturn new Set([listener])\n\t\t}\n\t\treturn listener\n\t}\n\n\tprivate static desugarSingleEntityEventListeners(\n\t\tunsugarable: UnsugarableSingleEntityEventListeners,\n\t): EntityEventListenerStore | undefined {\n\t\tif (\n\t\t\tunsugarable.onBeforePersist === undefined &&\n\t\t\tunsugarable.onBeforeUpdate === undefined &&\n\t\t\tunsugarable.onInitialize === undefined &&\n\t\t\tunsugarable.onPersistError === undefined &&\n\t\t\tunsugarable.onPersistSuccess === undefined &&\n\t\t\tunsugarable.onUpdate === undefined\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst store: EntityEventListenerStore = new EventListenersStore()\n\n\t\tif (unsugarable.onConnectionUpdate) {\n\t\t\tfor (const fieldName in unsugarable.onConnectionUpdate) {\n\t\t\t\tconst listener = this.desugarEventListener(unsugarable.onConnectionUpdate[fieldName])\n\t\t\t\tstore.set({ type: 'connectionUpdate', key: fieldName }, listener)\n\t\t\t}\n\t\t}\n\n\t\tconst beforePersist = this.desugarEventListener(unsugarable.onBeforePersist)\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst initialize = this.desugarEventListener(unsugarable.onInitialize)\n\t\tconst persistError = this.desugarEventListener(unsugarable.onPersistError)\n\t\tconst persistSuccess = this.desugarEventListener(unsugarable.onPersistSuccess)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforePersist) {\n\t\t\tstore.set({ type: 'beforePersist' }, beforePersist)\n\t\t}\n\t\tif (beforeUpdate) {\n\t\t\tstore.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (initialize) {\n\t\t\tstore.set({ type: 'initialize' }, initialize)\n\t\t}\n\t\tif (persistError) {\n\t\t\tstore.set({ type: 'persistError' }, persistError)\n\t\t}\n\t\tif (persistSuccess) {\n\t\t\tstore.set({ type: 'persistSuccess' }, persistSuccess)\n\t\t}\n\t\tif (update) {\n\t\t\tstore.set({ type: 'update' }, update)\n\t\t}\n\n\t\treturn store\n\t}\n\n\tprivate static desugarEntityListEventListeners(unsugarable: UnsugarableEntityListEventListeners):\n\t\t| {\n\t\t\t\teventListeners: EntityListEventListenerStore | undefined\n\t\t\t\tchildEventListeners: EntityEventListenerStore | undefined\n\t\t }\n\t\t| undefined {\n\t\tif (\n\t\t\tunsugarable.onBeforePersist === undefined &&\n\t\t\tunsugarable.onBeforeUpdate === undefined &&\n\t\t\tunsugarable.onChildBeforeUpdate === undefined &&\n\t\t\tunsugarable.onChildInitialize === undefined &&\n\t\t\tunsugarable.onChildUpdate === undefined &&\n\t\t\tunsugarable.onInitialize === undefined &&\n\t\t\tunsugarable.onPersistError === undefined &&\n\t\t\tunsugarable.onPersistSuccess === undefined &&\n\t\t\tunsugarable.onUpdate === undefined\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst eventListeners: EntityListEventListenerStore = new EventListenersStore()\n\n\t\tconst beforePersist = this.desugarEventListener(unsugarable.onBeforePersist)\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst initialize = this.desugarEventListener(unsugarable.onInitialize)\n\t\tconst persistError = this.desugarEventListener(unsugarable.onPersistError)\n\t\tconst persistSuccess = this.desugarEventListener(unsugarable.onPersistSuccess)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforePersist) {\n\t\t\teventListeners.set({ type: 'beforePersist' }, beforePersist)\n\t\t}\n\t\tif (beforeUpdate) {\n\t\t\teventListeners.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (initialize) {\n\t\t\teventListeners.set({ type: 'initialize' }, initialize)\n\t\t}\n\t\tif (persistError) {\n\t\t\teventListeners.set({ type: 'persistError' }, persistError)\n\t\t}\n\t\tif (persistSuccess) {\n\t\t\teventListeners.set({ type: 'persistSuccess' }, persistSuccess)\n\t\t}\n\t\tif (update) {\n\t\t\teventListeners.set({ type: 'update' }, update)\n\t\t}\n\n\t\tconst childEventListeners: EntityEventListenerStore = new EventListenersStore()\n\n\t\tconst childBeforeUpdate = this.desugarEventListener(unsugarable.onChildBeforeUpdate)\n\t\tconst childInitialize = this.desugarEventListener(unsugarable.onChildInitialize)\n\t\tconst childUpdate = this.desugarEventListener(unsugarable.onChildUpdate)\n\n\t\tif (childBeforeUpdate) {\n\t\t\tchildEventListeners.set({ type: 'beforeUpdate' }, childBeforeUpdate)\n\t\t}\n\t\tif (childInitialize) {\n\t\t\tchildEventListeners.set({ type: 'initialize' }, childInitialize)\n\t\t}\n\t\tif (childUpdate) {\n\t\t\tchildEventListeners.set({ type: 'update' }, childUpdate)\n\t\t}\n\n\t\treturn {\n\t\t\teventListeners,\n\t\t\tchildEventListeners,\n\t\t}\n\t}\n\n\tprivate static desugarFieldEventListeners(\n\t\tunsugarable: UnsugarableFieldEventListeners,\n\t): FieldEventListenerStore | undefined {\n\t\tif (unsugarable.onBeforeUpdate === undefined && unsugarable.onUpdate === undefined) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst store: FieldEventListenerStore = new EventListenersStore()\n\n\t\tconst beforeUpdate = this.desugarEventListener(unsugarable.onBeforeUpdate)\n\t\tconst update = this.desugarEventListener(unsugarable.onUpdate)\n\n\t\tif (beforeUpdate) {\n\t\t\tstore.set({ type: 'beforeUpdate' }, beforeUpdate)\n\t\t}\n\t\tif (update) {\n\t\t\tstore.set({ type: 'update' }, update)\n\t\t}\n\n\t\treturn store\n\t}\n\n\tprivate static desugarSubTreeAlias(alias: Alias | Set<Alias> | undefined): Set<Alias> | undefined {\n\t\tif (alias === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (alias instanceof Set) {\n\t\t\treturn alias\n\t\t}\n\t\treturn new Set<Alias>().add(alias)\n\t}\n\n\tprivate static desugarHasOneRelation(\n\t\tsugarable: SugarableHasOneRelation,\n\t\tunsugarable: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation {\n\t\treturn {\n\t\t\tfield: sugarable.field,\n\t\t\tfilter: sugarable.filter ? this.desugarFilter(sugarable.filter, environment) : undefined,\n\t\t\texpectedMutation: unsugarable.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\treducedBy: sugarable.reducedBy ? this.desugarUniqueWhere(sugarable.reducedBy, environment) : undefined,\n\t\t\tsetOnCreate: unsugarable.setOnCreate ? this.desugarSetOnCreate(unsugarable.setOnCreate, environment) : undefined,\n\t\t\tisNonbearing: unsugarable.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarable.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(unsugarable),\n\t\t}\n\t}\n\n\tprivate static augmentDesugaredHasOneRelationPath(\n\t\tpath: ParsedHasOneRelation[],\n\t\tunsugarable: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation[] {\n\t\treturn path.map((desugaredHasOneRelation, i) =>\n\t\t\t// Unsugarable applies to the last\n\t\t\tthis.desugarHasOneRelation(desugaredHasOneRelation, i === path.length - 1 ? unsugarable : {}, environment),\n\t\t)\n\t}\n\n\tprivate static augmentDesugaredHasManyRelation(\n\t\trelation: ParsedHasManyRelation,\n\t\tunsugarable: UnsugarableHasManyRelation,\n\t\tenvironment: Environment,\n\t): HasManyRelation {\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarable)\n\t\treturn {\n\t\t\tfield: relation.field,\n\t\t\tfilter: relation.filter,\n\t\t\texpectedMutation: unsugarable.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\tisNonbearing: unsugarable.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarable.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tinitialEntityCount: unsugarable.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t\tsetOnCreate: unsugarable.setOnCreate ? this.desugarSetOnCreate(unsugarable.setOnCreate, environment) : undefined,\n\t\t\torderBy: unsugarable.orderBy ? this.desugarOrderBy(unsugarable.orderBy, environment) : undefined,\n\t\t\toffset: unsugarable.offset,\n\t\t\tlimit: unsugarable.limit,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tprivate static desugarHasOneRelationPath(\n\t\tinput: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined,\n\t\tlastRelation: UnsugarableHasOneRelation,\n\t\tenvironment: Environment,\n\t): HasOneRelation[] {\n\t\tif (input === undefined) {\n\t\t\tinput = []\n\t\t} else if (!Array.isArray(input)) {\n\t\t\tinput = [input]\n\t\t}\n\n\t\tconst relationPath: HasOneRelation[] = []\n\n\t\tconst cappedLength = input.length - 1\n\t\tlet i = 0\n\t\tfor (; i < cappedLength; i++) {\n\t\t\t// Deliberately leaving out the last element\n\t\t\tconst pathNode = input[i]\n\n\t\t\trelationPath.push(this.desugarHasOneRelation(pathNode, {}, environment))\n\t\t}\n\t\tif (i in input) {\n\t\t\trelationPath.push(this.desugarHasOneRelation(input[i], lastRelation, environment))\n\t\t}\n\n\t\treturn relationPath\n\t}\n\n\tprivate static desugarHasManyRelation(\n\t\tsugarablePart: SugarableHasManyRelation,\n\t\tunsugarablePart: UnsugarableHasManyRelation,\n\t\tenvironment: Environment,\n\t): HasManyRelation {\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarablePart)\n\t\treturn {\n\t\t\t...this.desugarEntityListParameters(sugarablePart, unsugarablePart, environment),\n\t\t\texpectedMutation: unsugarablePart.expectedMutation ?? RelationDefaults.expectedMutation,\n\t\t\tsetOnCreate: unsugarablePart.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarablePart.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\tfield: sugarablePart.field,\n\t\t\tisNonbearing: unsugarablePart.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarablePart.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tpublic static desugarUnconstrainedQualifiedEntityList(\n\t\t{ entities, ...unsugarableEntityList }: SugaredUnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): UnconstrainedQualifiedEntityList {\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet entityName: EntityName\n\n\t\tif (typeof entities === 'string') {\n\t\t\tconst parsed = this.parseUnconstrainedQualifiedEntityList(entities, environment)\n\t\t\tentityName = parsed.entityName\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entities.entityName\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(entities.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarableEntityList)\n\n\t\treturn {\n\t\t\tisCreating: true,\n\t\t\tisNonbearing: unsugarableEntityList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableEntityList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableEntityList.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableEntityList.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableEntityList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t\tinitialEntityCount: unsugarableEntityList.initialEntityCount ?? EntityListPreferencesDefaults.initialEntityCount,\n\t\t\talias: this.desugarSubTreeAlias(unsugarableEntityList.alias),\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarUnconstrainedQualifiedSingleEntity(\n\t\t{ entity, ...unsugarableSingleEntity }: SugaredUnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): UnconstrainedQualifiedSingleEntity {\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet entityName: EntityName\n\n\t\tif (typeof entity === 'string') {\n\t\t\tconst parsed = this.parseUnconstrainedQualifiedSingleEntity(entity, environment)\n\t\t\tentityName = parsed.entityName\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entity.entityName\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(\n\t\t\t\tentity.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\treturn {\n\t\t\tisCreating: true,\n\t\t\tisNonbearing: unsugarableSingleEntity.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableSingleEntity.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableSingleEntity.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableSingleEntity.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableSingleEntity.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(unsugarableSingleEntity),\n\t\t\talias: this.desugarSubTreeAlias(unsugarableSingleEntity.alias),\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedEntityList(\n\t\t{ entities, ...unsugarableEntityList }: SugaredQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): QualifiedEntityList {\n\t\tlet entityName: EntityName\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tlet filter: SugaredFilter | undefined\n\n\t\tif (typeof entities === 'string') {\n\t\t\tconst parsed = this.parseQualifiedEntityList(entities, environment)\n\n\t\t\tentityName = parsed.entityName\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entities.entityName\n\t\t\tfilter = entities.filter\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(entities.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\tconst eventListeners = this.desugarEntityListEventListeners(unsugarableEntityList)\n\n\t\treturn {\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t\t...this.desugarEntityListParameters(\n\t\t\t\t{\n\t\t\t\t\tfilter,\n\t\t\t\t},\n\t\t\t\tunsugarableEntityList,\n\t\t\t\tenvironment,\n\t\t\t),\n\t\t\talias: this.desugarSubTreeAlias(unsugarableEntityList.alias),\n\t\t\tisCreating: false,\n\t\t\tisNonbearing: unsugarableEntityList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableEntityList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tsetOnCreate: unsugarableEntityList.setOnCreate\n\t\t\t\t? this.desugarSetOnCreate(unsugarableEntityList.setOnCreate, environment)\n\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableEntityList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\tchildEventListeners: eventListeners?.childEventListeners,\n\t\t\teventListeners: eventListeners?.eventListeners,\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedFieldList(\n\t\t{ fields, ...unsugarableFieldList }: SugaredQualifiedFieldList,\n\t\tenvironment: Environment,\n\t): QualifiedFieldList {\n\t\tlet field: FieldName\n\t\tlet entityName: EntityName\n\t\tlet filter: SugaredFilter | undefined\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tif (typeof fields === 'string') {\n\t\t\tconst parsed = this.parseQualifiedFieldList(fields, environment)\n\n\t\t\tfield = parsed.field\n\t\t\tentityName = parsed.entityName\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tfield = fields.field\n\t\t\tentityName = fields.entityName\n\t\t\tfilter = fields.filter\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(fields.hasOneRelationPath, emptyObject, environment)\n\t\t}\n\n\t\treturn {\n\t\t\tfield,\n\t\t\tentityName,\n\t\t\thasOneRelationPath,\n\t\t\talias: this.desugarSubTreeAlias(unsugarableFieldList.alias),\n\t\t\tisNonbearing: unsugarableFieldList.isNonbearing ?? EntityCreationParametersDefaults.isNonbearing,\n\t\t\t// forceCreation: unsugarableFieldList.forceCreation ?? EntityCreationParametersDefaults.forceCreation,\n\t\t\tdefaultValue:\n\t\t\t\tunsugarableFieldList.defaultValue !== undefined\n\t\t\t\t\t? VariableInputTransformer.transformValue(unsugarableFieldList.defaultValue, environment)\n\t\t\t\t\t: undefined,\n\t\t\texpectedMutation: unsugarableFieldList.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation,\n\t\t\teventListeners: this.desugarFieldEventListeners(unsugarableFieldList),\n\t\t\t...this.desugarEntityListParameters({ filter }, unsugarableFieldList, environment),\n\t\t}\n\t}\n\n\tpublic static desugarQualifiedSingleEntity(\n\t\t{ entity, ...unsugarableSingleEntity }: SugaredQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t\toptions: { missingSetOnCreate?: 'fill' | 'fillAndWarn' } = {},\n\t): QualifiedSingleEntity {\n\t\tlet entityName: EntityName\n\t\tlet where: UniqueWhere\n\t\tlet filter: Filter | undefined\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\n\t\tif (typeof entity === 'string') {\n\t\t\tconst parsed = this.parseQualifiedSingleEntity(entity, environment)\n\n\t\t\tentityName = parsed.entityName\n\t\t\twhere = parsed.where\n\t\t\tfilter = parsed.filter\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\tentityName = entity.entityName\n\t\t\twhere = this.desugarUniqueWhere(entity.where, environment)\n\t\t\tfilter = entity.filter ? this.desugarFilter(entity.filter, environment) : undefined\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(\n\t\t\t\tentity.hasOneRelationPath,\n\t\t\t\tunsugarableSingleEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\t// const forceCreation: boolean =\n\t\t// \tunsugarableSingleEntity.forceCreation !== undefined\n\t\t// \t\t? unsugarableSingleEntity.forceCreation !== undefined\n\t\t// \t\t: EntityCreationParametersDefaults.forceCreation\n\t\tlet setOnCreate: UniqueWhere | undefined =\n\t\t\tunsugarableSingleEntity.setOnCreate !== undefined\n\t\t\t\t? this.desugarSetOnCreate(unsugarableSingleEntity.setOnCreate, environment)\n\t\t\t\t: undefined\n\n\t\t// todo: remove deprecated code\n\t\tif (!setOnCreate && options.missingSetOnCreate) {\n\t\t\tconst whereValues = Object.values(where)\n\t\t\tif (whereValues.length === 1 && whereValues[0] instanceof GraphQlLiteral) {\n\t\t\t\tsetOnCreate = where\n\t\t\t\tif (import.meta.env.DEV && options.missingSetOnCreate === 'fillAndWarn') {\n\t\t\t\t\tconsole.warn('Automatic creation of singleton entities in EditPage is deprecated. Please use setOnCreate prop.')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst isNonbearing: boolean =\n\t\t\tunsugarableSingleEntity.isNonbearing !== undefined\n\t\t\t\t? unsugarableSingleEntity.isNonbearing\n\t\t\t\t: EntityCreationParametersDefaults.isNonbearing\n\t\tconst eventListeners = this.desugarSingleEntityEventListeners(unsugarableSingleEntity)\n\t\tconst expectedMutation =\n\t\t\tunsugarableSingleEntity.expectedMutation ?? QualifiedEntityParametersDefaults.expectedMutation\n\t\tconst alias = this.desugarSubTreeAlias(unsugarableSingleEntity.alias)\n\n\t\treturn {\n\t\t\talias,\n\t\t\tentityName,\n\t\t\tisCreating: false,\n\t\t\twhere,\n\t\t\tfilter,\n\t\t\thasOneRelationPath,\n\t\t\t// forceCreation,\n\t\t\tsetOnCreate,\n\t\t\tisNonbearing,\n\t\t\teventListeners,\n\t\t\texpectedMutation,\n\t\t}\n\t}\n\n\tpublic static desugarParentEntityParameters(\n\t\tparentEntity: SugaredParentEntityParameters,\n\t\tenvironment: Environment,\n\t): ParentEntityParameters {\n\t\treturn {\n\t\t\teventListeners: this.desugarSingleEntityEventListeners(parentEntity),\n\t\t}\n\t}\n\n\tpublic static desugarRelativeSingleEntity(\n\t\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity,\n\t\tenvironment: Environment,\n\t): RelativeSingleEntity {\n\t\tif (typeof sugaredRelativeSingleEntity === 'string') {\n\t\t\treturn this.desugarRelativeSingleEntity({ field: sugaredRelativeSingleEntity }, environment)\n\t\t}\n\n\t\tconst { field, ...unsugarableEntity } = sugaredRelativeSingleEntity\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeSingleEntity(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\tunsugarableEntity,\n\t\t\t\tenvironment,\n\t\t\t)\n\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field, unsugarableEntity, environment)\n\t\t}\n\n\t\treturn {\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n\n\tpublic static desugarRelativeSingleField(\n\t\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n\t\tenvironment: Environment,\n\t): RelativeSingleField {\n\t\tif (typeof sugaredRelativeSingleField === 'string') {\n\t\t\treturn this.desugarRelativeSingleField({ field: sugaredRelativeSingleField }, environment)\n\t\t}\n\n\t\tconst { field, ...unsugarableField } = sugaredRelativeSingleField\n\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet fieldName: FieldName\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeSingleField(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(parsed.hasOneRelationPath, {}, environment)\n\t\t\tfieldName = parsed.field\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field.hasOneRelationPath, {}, environment)\n\t\t\tfieldName = field.field\n\t\t}\n\n\t\treturn {\n\t\t\teventListeners: this.desugarFieldEventListeners(unsugarableField),\n\t\t\thasOneRelationPath,\n\t\t\tfield: fieldName,\n\t\t\tisNonbearing: unsugarableField.isNonbearing ?? LeafFieldDefaults.isNonbearing,\n\t\t\tdefaultValue:\n\t\t\t\tunsugarableField.defaultValue !== undefined\n\t\t\t\t\t? VariableInputTransformer.transformValue(unsugarableField.defaultValue, environment)\n\t\t\t\t\t: undefined,\n\t\t}\n\t}\n\n\tpublic static desugarRelativeEntityList(\n\t\tsugaredRelativeEntityList: string | SugaredRelativeEntityList,\n\t\tenvironment: Environment,\n\t): RelativeEntityList {\n\t\tif (typeof sugaredRelativeEntityList === 'string') {\n\t\t\treturn this.desugarRelativeEntityList(\n\t\t\t\t{\n\t\t\t\t\tfield: sugaredRelativeEntityList,\n\t\t\t\t},\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t}\n\n\t\tconst { field, ...unsugarableEntityList } = sugaredRelativeEntityList\n\t\tlet hasOneRelationPath: HasOneRelation[]\n\t\tlet hasManyRelation: HasManyRelation\n\t\tif (typeof field === 'string') {\n\t\t\tconst parsed = this.parseRelativeEntityList(field, environment)\n\t\t\thasOneRelationPath = this.augmentDesugaredHasOneRelationPath(\n\t\t\t\tparsed.hasOneRelationPath,\n\t\t\t\temptyObject,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t\thasManyRelation = this.augmentDesugaredHasManyRelation(\n\t\t\t\tparsed.hasManyRelation,\n\t\t\t\tunsugarableEntityList,\n\t\t\t\tenvironment,\n\t\t\t)\n\t\t} else {\n\t\t\thasOneRelationPath = this.desugarHasOneRelationPath(field.hasOneRelationPath || [], emptyObject, environment)\n\t\t\thasManyRelation = this.desugarHasManyRelation(field.hasManyRelation, unsugarableEntityList, environment)\n\t\t}\n\n\t\treturn {\n\t\t\thasManyRelation,\n\t\t\thasOneRelationPath,\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;oBAuD2B;AAAA,SAEX,2BAA4D,YAAmB;AAC7F,WAAO,CAAC,OAAe,gBACtB,OAAO,6BAA6B,OAAO,YAAY;AAAA;AAAA,SAG1C,uCAAwE,YAAmB;AACzG,WAAO,CAAC,OAA4C,gBAAyD;AAC5G,UAAI,OAAO,UAAU,UAAU;AAC9B,eAAO,OAAO,6BAA6B,OAAO,YAAY;AAAA;AAE/D,aAAO;AAAA;AAAA;AAAA,SAIM,wCAAwC,cAAc,2BAA2B;AAAA,SACjF,0CAA0C,cAAc,2BAA2B;AAAA,SACnF,2BAA2B,cAAc,2BAA2B;AAAA,SACpE,0BAA0B,cAAc,2BAA2B;AAAA,SACnE,6BAA6B,cAAc,2BAA2B;AAAA,SACtE,0BAA0B,cAAc,2BAA2B;AAAA,SACnE,4BAA4B,cAAc,2BAA2B;AAAA,SACrE,2BAA2B,cAAc,2BAA2B;AAAA,SAErE,qBAAqB,cAAc,uCAAuC;AAAA,SAC1E,gBAAgB,cAAc,uCAAuC;AAAA,SACrE,iBAAiB,cAAc,uCAAuC;AAAA,SACtE,mBAAmB,cAAc,uCAAuC;AAAA,SAGvE,4BACd,eACA,iBACA,aACuB;AACvB,WAAO;AAAA,MACN,QAAQ,cAAc,SAAS,KAAK,cAAc,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M,oBAAoB,IAAI;AAClF,kBAAY,MAAM;AAAA;AAGnB,WAAO;AAAA,MACN,gBAAgB,KAAK,2BAA2B;AAAA,MAChD;AAAA,MACA,OAAO;AAAA,MACP,cAAc,iBAAiB,gBAAgB,kBAAkB;AAAA,MACjE,cACC,iBAAiB,iBAAiB,SAC/B,yBAAyB,eAAe,iBAAiB,cAAc,eACvE;AAAA;AAAA;AAAA,SAIQ,0BACb,2BACA,aACqB;AACrB,QAAI,OAAO,8BAA8B,UAAU;AAClD,aAAO,KAAK,0BACX;AAAA,QACC,OAAO;AAAA,SAER;AAAA;AAIF,UAAM,EAAE,UAAU,0BAA0B;AAC5C,QAAI;AACJ,QAAI;AACJ,QAAI,OAAO,UAAU,UAAU;AAC9B,YAAM,SAAS,KAAK,wBAAwB,OAAO;AACnD,2BAAqB,KAAK,mCACzB,OAAO,oBACP,aACA;AAED,wBAAkB,KAAK,gCACtB,OAAO,iBACP,uBACA;AAAA,WAEK;AACN,2BAAqB,KAAK,0BAA0B,MAAM,sBAAsB,IAAI,aAAa;AACjG,wBAAkB,KAAK,uBAAuB,MAAM,iBAAiB,uBAAuB;AAAA;AAG7F,WAAO;AAAA,MACN;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
@@ -32,6 +32,10 @@ const tokens = {
32
32
  name: "Comma",
33
33
  pattern: /,/
34
34
  }),
35
+ Colon: createToken({
36
+ name: "Colon",
37
+ pattern: /:/
38
+ }),
35
39
  NumberLiteral: createToken({
36
40
  name: "NumberLiteral",
37
41
  pattern: /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/
@@ -118,6 +122,7 @@ const tokenList = [
118
122
  tokens.DollarSign,
119
123
  tokens.Dot,
120
124
  tokens.Comma,
125
+ tokens.Colon,
121
126
  tokens.StringLiteral,
122
127
  tokens.NumberLiteral,
123
128
  tokens.LeftParenthesis,