@contember/binding 1.2.0-alpha.8 → 1.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/development/accessors/EntityAccessor.js +66 -22
  2. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  3. package/dist/development/core/operations/EntityOperations.js +13 -8
  4. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  5. package/dist/development/dao/TreeNodeEnvironmentFactory.js +6 -76
  6. package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -1
  7. package/dist/development/markers/PlaceholderGenerator.js +5 -4
  8. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  9. package/dist/development/markers/PlaceholderParametersGenerator.js +62 -0
  10. package/dist/development/markers/PlaceholderParametersGenerator.js.map +1 -0
  11. package/dist/development/utils/Hashing.js +2 -56
  12. package/dist/development/utils/Hashing.js.map +1 -1
  13. package/dist/development/utils/TreeNodeUtils.js +77 -0
  14. package/dist/development/utils/TreeNodeUtils.js.map +1 -0
  15. package/dist/production/accessors/EntityAccessor.js +66 -22
  16. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  17. package/dist/production/core/operations/EntityOperations.js +13 -8
  18. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  19. package/dist/production/dao/TreeNodeEnvironmentFactory.js +6 -76
  20. package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -1
  21. package/dist/production/markers/PlaceholderGenerator.js +5 -4
  22. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  23. package/dist/production/markers/PlaceholderParametersGenerator.js +62 -0
  24. package/dist/production/markers/PlaceholderParametersGenerator.js.map +1 -0
  25. package/dist/production/utils/Hashing.js +2 -56
  26. package/dist/production/utils/Hashing.js.map +1 -1
  27. package/dist/production/utils/TreeNodeUtils.js +77 -0
  28. package/dist/production/utils/TreeNodeUtils.js.map +1 -0
  29. package/dist/types/accessors/EntityAccessor.d.ts +9 -4
  30. package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
  31. package/dist/types/core/operations/EntityOperations.d.ts.map +1 -1
  32. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts +0 -8
  33. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -1
  34. package/dist/types/markers/PlaceholderGenerator.d.ts.map +1 -1
  35. package/dist/types/markers/PlaceholderParametersGenerator.d.ts +9 -0
  36. package/dist/types/markers/PlaceholderParametersGenerator.d.ts.map +1 -0
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/dist/types/utils/Hashing.d.ts +1 -7
  39. package/dist/types/utils/Hashing.d.ts.map +1 -1
  40. package/dist/types/utils/TreeNodeUtils.d.ts +13 -0
  41. package/dist/types/utils/TreeNodeUtils.d.ts.map +1 -0
  42. package/package.json +5 -5
  43. package/src/accessors/EntityAccessor.ts +96 -28
  44. package/src/core/operations/EntityOperations.ts +16 -11
  45. package/src/dao/TreeNodeEnvironmentFactory.ts +6 -92
  46. package/src/markers/PlaceholderGenerator.ts +6 -5
  47. package/src/markers/PlaceholderParametersGenerator.ts +79 -0
  48. package/src/utils/Hashing.ts +2 -68
  49. package/src/utils/TreeNodeUtils.ts +92 -0
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeEnvironmentFactory.js","sources":["../../../src/dao/TreeNodeEnvironmentFactory.ts"],"sourcesContent":["import { Environment } from './Environment'\nimport {\n\tHasOneRelation,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { QueryLanguage } from '../queryLanguage'\nimport { BindingError } from '../BindingError'\nimport { whereToFilter } from '@contember/client'\nimport { BaseRelation, Schema, SchemaColumn, SchemaEntity, SchemaField, SchemaRelation } from '../core/schema'\nimport levenshtein from 'js-levenshtein'\n\nexport class TreeNodeEnvironmentFactory {\n\n\tpublic static createEnvironmentForEntityListSubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t): Environment {\n\t\tlet entityList\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\tentityList = QueryLanguage.desugarUnconstrainedQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = {} as const\n\t\t\texpectedCardinality = 'zero'\n\n\t\t} else {\n\t\t\tentityList = QueryLanguage.desugarQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = entityList.filter ?? {}\n\t\t\texpectedCardinality = 'zero-to-many'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entityList.entityName, 'entity list')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity-list',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntitySubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t): Environment {\n\t\tlet entity\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\trootWhere = { } as const\n\t\t\texpectedCardinality = 'zero'\n\t\t\tentity = QueryLanguage.desugarUnconstrainedQualifiedSingleEntity(sugaredEntityList, environment)\n\n\t\t} else {\n\t\t\tentity = QueryLanguage.desugarQualifiedSingleEntity(sugaredEntityList, environment, { missingSetOnCreate: 'fill' })\n\t\t\trootWhere = whereToFilter(entity.where)\n\t\t\texpectedCardinality = entity.setOnCreate ? 'zero-or-one' : 'one'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entity.entityName, 'entity')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality: expectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntityList(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeEntityList: SugaredRelativeEntityList,\n\t): Environment {\n\t\tconst relativeEntityList = QueryLanguage.desugarRelativeEntityList(sugaredRelativeEntityList, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeEntityList.hasOneRelationPath)\n\t\tconst hasManyField = relativeEntityList.hasManyRelation.field\n\n\t\tconst field = this.assertHasManyRelation(hasOneEnvironment, hasManyField)\n\n\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'entity-list',\n\t\t\tfield,\n\t\t\tentity: targetEntity,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntity(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleEntity: SugaredRelativeSingleEntity,\n\t) {\n\t\tconst relativeSingleEntity = QueryLanguage.desugarRelativeSingleEntity(sugaredRelativeSingleEntity, environment)\n\n\t\treturn this.traverseHasOnePath(environment, relativeSingleEntity.hasOneRelationPath)\n\t}\n\n\tpublic static createEnvironmentForField(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleField: SugaredRelativeSingleField,\n\t) {\n\t\tconst relativeSingleField = QueryLanguage.desugarRelativeSingleField(sugaredRelativeSingleField, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeSingleField.hasOneRelationPath)\n\n\t\tconst field = this.resolveColumn(hasOneEnvironment, relativeSingleField.field)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'column',\n\t\t\tentity: environment.getSubTreeNode().entity,\n\t\t\tfield,\n\t\t})\n\t}\n\n\tprivate static traverseHasOnePath(\n\t\tenvironment: Environment,\n\t\thasOneRelationPath: HasOneRelation[],\n\t): Environment {\n\t\tfor (const pathItem of hasOneRelationPath) {\n\t\t\tconst field = this.resolveHasOneRelation(environment, pathItem.field, !!pathItem.reducedBy)\n\t\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\t\tenvironment = environment.withSubTreeChild({\n\t\t\t\ttype: 'entity',\n\t\t\t\tfield,\n\t\t\t\tentity: targetEntity,\n\t\t\t})\n\t\t}\n\t\treturn environment\n\t}\n\n\tprivate static resolveHasOneRelation(environment: Environment, field: string, isReduced: boolean): SchemaRelation {\n\t\tif (isReduced) {\n\t\t\treturn this.resolveRelation(environment, field, 'reduced has-one relation', ['ManyHasMany', 'OneHasMany'])\n\t\t}\n\t\treturn this.resolveRelation(environment, field, 'a has-one relation', ['ManyHasOne', 'OneHasOne'])\n\t}\n\n\tprivate static assertHasManyRelation(environment: Environment, field: string): SchemaRelation {\n\t\treturn this.resolveRelation(environment, field, 'a has-many relation', ['ManyHasMany', 'OneHasMany'])\n\t}\n\n\n\tprivate static resolveRelation(environment: Environment, field: string, relationDescription: string, expectedRelationType: BaseRelation['type'][]): SchemaRelation {\n\t\treturn this.resolveField(environment, field, (field): field is SchemaRelation => {\n\t\t\treturn field.__typename === '_Relation' && expectedRelationType.includes(field.type)\n\t\t}, relationDescription)\n\t}\n\n\tprivate static resolveEntity(schema: Schema, entityName: string, type: 'entity' | 'entity list'): SchemaEntity {\n\t\tconst entity = schema.getEntityOrUndefined(entityName)\n\t\tif (!entity) {\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.getEntityNames())\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`)\n\t\t}\n\t\treturn entity\n\t}\n\n\tprivate static resolveColumn(environment: Environment, fieldName: string): SchemaColumn {\n\t\treturn this.resolveField(environment, fieldName, (field): field is SchemaColumn => field.__typename === '_Column', 'an ordinary field')\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static resolveField<T extends SchemaField>(environment: Environment, fieldName: string, matcher: (field: SchemaField) => field is T, expectedDescription: string): T {\n\t\tconst treeLocation = environment.getSubTreeNode()\n\t\tconst entity = treeLocation.entity\n\t\tconst field = entity.fields.get(fieldName)\n\t\tif (!field) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(entity.fields)\n\t\t\t\t\t.filter(([, field]) => matcher(field))\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`)\n\t\t}\n\t\tif (!matcher(field)) {\n\t\t\tconst actual = field.__typename === '_Column' ? 'an ordinary field' : `a ${field.type} relation`\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} ` +\n\t\t\t\t`refers to ${actual} but is being used as a ${expectedDescription}.`,\n\t\t\t)\n\t\t}\n\t\treturn field\n\t}\n\n\tprivate static describeLocation(environment: Environment): string {\n\t\tconst path = []\n\t\tconst loc = environment.getSubTreeNode()\n\t\tfor (let env = environment;; env = env.getParent()) {\n\t\t\tconst node = env.getSubTreeNode()\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn `entity '${loc.entity.name}' in path '${[node.entity.name, ...path.reverse()].join('.')}'`\n\t\t\t}\n\t\t\tpath.push(node.field.name)\n\t\t}\n\t}\n\n\tpublic static recommendAlternative(original: string, possibleAlternatives: Iterable<string>): string | undefined {\n\t\tlet bestAlternative: string | undefined = undefined\n\t\tlet bestAlternativeDistance = Number.MAX_SAFE_INTEGER\n\n\t\tfor (const alternative of possibleAlternatives) {\n\t\t\tconst distance = levenshtein(original, alternative)\n\n\t\t\tif (distance < bestAlternativeDistance) {\n\t\t\t\tbestAlternative = alternative\n\t\t\t\tbestAlternativeDistance = distance\n\t\t\t}\n\t\t}\n\t\treturn bestAlternative\n\t}\n}\n"],"names":["field","fieldName"],"mappings":";;;;AAiBO,MAAM,2BAA2B;AAAA,EAEvC,OAAc,sCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACpB,mBAAA,cAAc,wCAAwC,mBAAmB,WAAW;AACjG,kBAAY,CAAA;AACU,4BAAA;AAAA,IAAA,OAEhB;AACO,mBAAA,cAAc,2BAA2B,mBAAmB,WAAW;AACxE,kBAAA,WAAW,UAAU;AACX,4BAAA;AAAA,IACvB;AAEM,UAAA,eAAe,KAAK,cAAc,YAAY,aAAa,WAAW,YAAY,aAAa;AAErG,WAAO,YAAY,YAAY;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AAAA,EAEA,OAAc,kCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACjC,kBAAY,CAAA;AACU,4BAAA;AACb,eAAA,cAAc,0CAA0C,mBAAmB,WAAW;AAAA,IAAA,OAEzF;AACN,eAAS,cAAc,6BAA6B,mBAAmB,aAAa,EAAE,oBAAoB,QAAQ;AACtG,kBAAA,cAAc,OAAO,KAAK;AAChB,4BAAA,OAAO,cAAc,gBAAgB;AAAA,IAC5D;AAEM,UAAA,eAAe,KAAK,cAAc,YAAY,aAAa,OAAO,YAAY,QAAQ;AAE5F,WAAO,YAAY,YAAY;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AAAA,EAEA,OAAc,+BACb,aACA,2BACc;AACd,UAAM,qBAAqB,cAAc,0BAA0B,2BA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9D,YAAA,IAAI,aAAa,UAAU,+BAA+B,KAAK,iBAAiB,WAAW,MAAM,YAAY;AAAA,IACpH;AACI,QAAA,CAAC,QAAQ,KAAK,GAAG;AACpB,YAAM,SAAS,MAAM,eAAe,YAAY,sBAAsB,KAAK,MAAM;AACjF,YAAM,IAAI;AAAA,QACT,4BAA4B,MAAM,YAAY,KAAK,iBAAiB,WAAW,eAClE,iCAAiC;AAAA,MAAA;AAAA,IAEhD;AACO,WAAA;AAAA,EACR;AAAA,EAEA,OAAe,iBAAiB,aAAkC;AACjE,UAAM,OAAO,CAAA;AACP,UAAA,MAAM,YAAY;AACxB,aAAS,MAAM,eAAc,MAAM,IAAI,aAAa;AAC7C,YAAA,OAAO,IAAI;AACjB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AAC1E,eAAO,WAAW,IAAI,OAAO,kBAAkB,CAAC,KAAK,OAAO,MAAM,GAAG,KAAK,QAAS,CAAA,EAAE,KAAK,GAAG;AAAA,MAC9F;AACK,WAAA,KAAK,KAAK,MAAM,IAAI;AAAA,IAC1B;AAAA,EACD;AAAA,EAEA,OAAc,qBAAqB,UAAkB,sBAA4D;AAChH,QAAI,kBAAsC;AAC1C,QAAI,0BAA0B,OAAO;AAErC,eAAW,eAAe,sBAAsB;AACzC,YAAA,WAAW,YAAY,UAAU,WAAW;AAElD,UAAI,WAAW,yBAAyB;AACrB,0BAAA;AACQ,kCAAA;AAAA,MAC3B;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"TreeNodeEnvironmentFactory.js","sources":["../../../src/dao/TreeNodeEnvironmentFactory.ts"],"sourcesContent":["import { Environment } from './Environment'\nimport {\n\tHasOneRelation,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { QueryLanguage } from '../queryLanguage'\nimport { whereToFilter } from '@contember/client'\nimport { TreeNodeUtils } from '../utils/TreeNodeUtils'\n\nexport class TreeNodeEnvironmentFactory {\n\n\tpublic static createEnvironmentForEntityListSubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t): Environment {\n\t\tlet entityList\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\tentityList = QueryLanguage.desugarUnconstrainedQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = {} as const\n\t\t\texpectedCardinality = 'zero'\n\n\t\t} else {\n\t\t\tentityList = QueryLanguage.desugarQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = entityList.filter ?? {}\n\t\t\texpectedCardinality = 'zero-to-many'\n\t\t}\n\n\t\tconst entitySchema = TreeNodeUtils.resolveEntity(environment.getSchema(), entityList.entityName, 'entity list')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity-list',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntitySubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t): Environment {\n\t\tlet entity\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\trootWhere = { } as const\n\t\t\texpectedCardinality = 'zero'\n\t\t\tentity = QueryLanguage.desugarUnconstrainedQualifiedSingleEntity(sugaredEntityList, environment)\n\n\t\t} else {\n\t\t\tentity = QueryLanguage.desugarQualifiedSingleEntity(sugaredEntityList, environment, { missingSetOnCreate: 'fill' })\n\t\t\trootWhere = whereToFilter(entity.where)\n\t\t\texpectedCardinality = entity.setOnCreate ? 'zero-or-one' : 'one'\n\t\t}\n\n\t\tconst entitySchema = TreeNodeUtils.resolveEntity(environment.getSchema(), entity.entityName, 'entity')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality: expectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntityList(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeEntityList: SugaredRelativeEntityList,\n\t): Environment {\n\t\tconst relativeEntityList = QueryLanguage.desugarRelativeEntityList(sugaredRelativeEntityList, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeEntityList.hasOneRelationPath)\n\t\tconst hasManyField = relativeEntityList.hasManyRelation.field\n\n\t\tconst field = TreeNodeUtils.resolveHasManyRelation(hasOneEnvironment, hasManyField)\n\n\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'entity-list',\n\t\t\tfield,\n\t\t\tentity: targetEntity,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntity(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleEntity: SugaredRelativeSingleEntity,\n\t) {\n\t\tconst relativeSingleEntity = QueryLanguage.desugarRelativeSingleEntity(sugaredRelativeSingleEntity, environment)\n\n\t\treturn this.traverseHasOnePath(environment, relativeSingleEntity.hasOneRelationPath)\n\t}\n\n\tpublic static createEnvironmentForField(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleField: SugaredRelativeSingleField,\n\t) {\n\t\tconst relativeSingleField = QueryLanguage.desugarRelativeSingleField(sugaredRelativeSingleField, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeSingleField.hasOneRelationPath)\n\n\t\tconst field = TreeNodeUtils.resolveColumn(hasOneEnvironment, relativeSingleField.field)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'column',\n\t\t\tentity: environment.getSubTreeNode().entity,\n\t\t\tfield,\n\t\t})\n\t}\n\n\tprivate static traverseHasOnePath(\n\t\tenvironment: Environment,\n\t\thasOneRelationPath: HasOneRelation[],\n\t): Environment {\n\t\tfor (const pathItem of hasOneRelationPath) {\n\t\t\tconst field = TreeNodeUtils.resolveHasOneRelation(environment, pathItem.field, !!pathItem.reducedBy)\n\t\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\t\tenvironment = environment.withSubTreeChild({\n\t\t\t\ttype: 'entity',\n\t\t\t\tfield,\n\t\t\t\tentity: targetEntity,\n\t\t\t})\n\t\t}\n\t\treturn environment\n\t}\n\n}\n"],"names":[],"mappings":";;;AAeO,MAAM,2BAA2B;AAAA,EAEvC,OAAc,sCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACpB,mBAAA,cAAc,wCAAwC,mBAAmB,WAAW;AACjG,kBAAY,CAAA;AACU,4BAAA;AAAA,IAAA,OAEhB;AACO,mBAAA,cAAc,2BAA2B,mBAAmB,WAAW;AACxE,kBAAA,WAAW,UAAU;AACX,4BAAA;AAAA,IACvB;AAEM,UAAA,eAAe,cAAc,cAAc,YAAY,aAAa,WAAW,YAAY,aAAa;AAE9G,WAAO,YAAY,YAAY;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AAAA,EAEA,OAAc,kCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACjC,kBAAY,CAAA;AACU,4BAAA;AACb,eAAA,cAAc,0CAA0C,mBAAmB,WAAW;AAAA,IAAA,OAEzF;AACN,eAAS,cAAc,6BAA6B,mBAAmB,aAAa,EAAE,oBAAoB,QAAQ;AACtG,kBAA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;AACnG,YAAM,eAAe,YAAY,UAAA,EAAY,UAAU,MAAM,YAAY;AAEzE,oBAAc,YAAY,iBAAiB;AAAA,QAC1C,MAAM;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,MAAA,CACR;AAAA,IACF;AACO,WAAA;AAAA,EACR;AAED;"}
@@ -1,19 +1,20 @@
1
+ import { PlaceholderParametersGenerator } from "./PlaceholderParametersGenerator.js";
1
2
  import { Hashing } from "../utils/Hashing.js";
2
3
  class PlaceholderGenerator {
3
4
  static getFieldPlaceholder(fieldName) {
4
5
  return fieldName;
5
6
  }
6
7
  static getHasOneRelationPlaceholder(relation) {
7
- return `${relation.field}_${Hashing.hashHasOneRelation(relation)}`;
8
+ return `${relation.field}_${Hashing.hashAny(PlaceholderParametersGenerator.createHasOneRelationParameters(relation))}`;
8
9
  }
9
10
  static getHasManyRelationPlaceholder(relation) {
10
- return `${relation.field}_${Hashing.hashHasManyRelation(relation)}`;
11
+ return `${relation.field}_${Hashing.hashAny(PlaceholderParametersGenerator.createHasManyRelationParameters(relation))}`;
11
12
  }
12
13
  static getEntitySubTreePlaceholder(subTreeParameters, environment) {
13
- return `est_${Hashing.hashEntitySubTreeParameters(subTreeParameters, environment)}`;
14
+ return `est_${Hashing.hashAny(PlaceholderParametersGenerator.createEntitySubTreeParameters(subTreeParameters, environment))}`;
14
15
  }
15
16
  static getEntityListSubTreePlaceholder(subTreeParameters, environment) {
16
- return `lst_${Hashing.hashEntityListSubTreeParameters(subTreeParameters, environment)}`;
17
+ return `lst_${Hashing.hashAny(PlaceholderParametersGenerator.createEntityListSubTreeParameters(subTreeParameters, environment))}`;
17
18
  }
18
19
  }
19
20
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderGenerator.js","sources":["../../../src/markers/PlaceholderGenerator.ts"],"sourcesContent":["import type {\n\tFieldName,\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Hashing } from '../utils'\nimport { Environment } from '../dao'\n\nexport class PlaceholderGenerator {\n\tpublic static getFieldPlaceholder(fieldName: FieldName): string {\n\t\treturn fieldName\n\t}\n\n\tpublic static getHasOneRelationPlaceholder(relation: HasOneRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashHasOneRelation(relation)}`\n\t}\n\n\tpublic static getHasManyRelationPlaceholder(relation: HasManyRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashHasManyRelation(relation)}`\n\t}\n\n\tpublic static getEntitySubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): string {\n\t\treturn `est_${Hashing.hashEntitySubTreeParameters(subTreeParameters, environment)}`\n\t}\n\n\tpublic static getEntityListSubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): string {\n\t\treturn `lst_${Hashing.hashEntityListSubTreeParameters(subTreeParameters, environment)}`\n\t}\n}\n"],"names":[],"mappings":";AAYO,MAAM,qBAAqB;AAAA,EACjC,OAAc,oBAAoB,WAA8B;AACxD,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,6BAA6B,UAAkC;AAC5E,WAAO,GAAG,SAAS,SAAS,QAAQ,mBAAmB,QAAQ;AAAA,EAChE;AAAA,EAEA,OAAc,8BAA8B,UAAmC;AAC9E,WAAO,GAAG,SAAS,SAAS,QAAQ,oBAAoB,QAAQ;AAAA,EACjE;AAAA,EAEA,OAAc,4BACb,mBACA,aACS;AACT,WAAO,OAAO,QAAQ,4BAA4B,mBAAmB,WAAW;AAAA,EACjF;AAAA,EAEA,OAAc,gCACb,mBACA,aACS;AACT,WAAO,OAAO,QAAQ,gCAAgC,mBAAmB,WAAW;AAAA,EACrF;AACD;"}
1
+ {"version":3,"file":"PlaceholderGenerator.js","sources":["../../../src/markers/PlaceholderGenerator.ts"],"sourcesContent":["import type {\n\tFieldName,\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Hashing } from '../utils'\nimport { Environment } from '../dao'\nimport { PlaceholderParametersGenerator } from './PlaceholderParametersGenerator'\n\nexport class PlaceholderGenerator {\n\tpublic static getFieldPlaceholder(fieldName: FieldName): string {\n\t\treturn fieldName // hashing intentionally ignored\n\t}\n\n\tpublic static getHasOneRelationPlaceholder(relation: HasOneRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashAny(PlaceholderParametersGenerator.createHasOneRelationParameters(relation))}`\n\t}\n\n\tpublic static getHasManyRelationPlaceholder(relation: HasManyRelation): string {\n\t\treturn `${relation.field}_${Hashing.hashAny(PlaceholderParametersGenerator.createHasManyRelationParameters(relation))}`\n\t}\n\n\tpublic static getEntitySubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): string {\n\t\treturn `est_${Hashing.hashAny(PlaceholderParametersGenerator.createEntitySubTreeParameters(subTreeParameters, environment))}`\n\t}\n\n\tpublic static getEntityListSubTreePlaceholder(\n\t\tsubTreeParameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): string {\n\t\treturn `lst_${Hashing.hashAny(PlaceholderParametersGenerator.createEntityListSubTreeParameters(subTreeParameters, environment))}`\n\t}\n}\n"],"names":[],"mappings":";;AAaO,MAAM,qBAAqB;AAAA,EACjC,OAAc,oBAAoB,WAA8B;AACxD,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,6BAA6B,UAAkC;AACrE,WAAA,GAAG,SAAS,SAAS,QAAQ,QAAQ,+BAA+B,+BAA+B,QAAQ,CAAC;AAAA,EACpH;AAAA,EAEA,OAAc,8BAA8B,UAAmC;AACvE,WAAA,GAAG,SAAS,SAAS,QAAQ,QAAQ,+BAA+B,gCAAgC,QAAQ,CAAC;AAAA,EACrH;AAAA,EAEA,OAAc,4BACb,mBACA,aACS;AACT,WAAO,OAAO,QAAQ,QAAQ,+BAA+B,8BAA8B,mBAAmB,WAAW,CAAC;AAAA,EAC3H;AAAA,EAEA,OAAc,gCACb,mBACA,aACS;AACT,WAAO,OAAO,QAAQ,QAAQ,+BAA+B,kCAAkC,mBAAmB,WAAW,CAAC;AAAA,EAC/H;AACD;"}
@@ -0,0 +1,62 @@
1
+ class PlaceholderParametersGenerator {
2
+ static createHasOneRelationParameters(relation) {
3
+ return {
4
+ type: "hasOne",
5
+ field: relation.field,
6
+ filter: relation.filter,
7
+ reducedBy: relation.reducedBy
8
+ };
9
+ }
10
+ static createHasManyRelationParameters(relation) {
11
+ return {
12
+ type: "hasMany",
13
+ field: relation.field,
14
+ filter: relation.filter,
15
+ offset: relation.offset,
16
+ limit: relation.limit,
17
+ orderBy: relation.orderBy
18
+ };
19
+ }
20
+ static createEntityListSubTreeParameters(parameters, environment) {
21
+ if (parameters.isCreating) {
22
+ return {
23
+ type: "entityListSubtree",
24
+ isCreating: true,
25
+ entityName: parameters.entityName,
26
+ variables: environment.getAllVariables()
27
+ };
28
+ }
29
+ return {
30
+ type: "entityListSubtree",
31
+ isCreating: false,
32
+ entityName: parameters.entityName,
33
+ filter: parameters.filter,
34
+ offset: parameters.offset,
35
+ limit: parameters.limit,
36
+ orderBy: parameters.orderBy,
37
+ variables: environment.getAllVariables()
38
+ };
39
+ }
40
+ static createEntitySubTreeParameters(parameters, environment) {
41
+ if (parameters.isCreating) {
42
+ return {
43
+ type: "entitySubTree",
44
+ isCreating: true,
45
+ entityName: parameters.entityName,
46
+ variables: environment.getAllVariables()
47
+ };
48
+ }
49
+ return {
50
+ type: "entitySubTree",
51
+ isCreating: false,
52
+ where: parameters.where,
53
+ entityName: parameters.entityName,
54
+ filter: parameters.filter,
55
+ variables: environment.getAllVariables()
56
+ };
57
+ }
58
+ }
59
+ export {
60
+ PlaceholderParametersGenerator
61
+ };
62
+ //# sourceMappingURL=PlaceholderParametersGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaceholderParametersGenerator.js","sources":["../../../src/markers/PlaceholderParametersGenerator.ts"],"sourcesContent":["import {\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Environment } from '../dao'\n\nexport class PlaceholderParametersGenerator {\n\n\tpublic static createHasOneRelationParameters(relation: HasOneRelation): any {\n\t\treturn {\n\t\t\ttype: 'hasOne',\n\t\t\tfield: relation.field,\n\t\t\tfilter: relation.filter,\n\t\t\treducedBy: relation.reducedBy,\n\t\t}\n\t}\n\n\tpublic static createHasManyRelationParameters(relation: HasManyRelation): any {\n\t\treturn {\n\t\t\ttype: 'hasMany',\n\t\t\tfield: relation.field,\n\t\t\tfilter: relation.filter,\n\t\t\toffset: relation.offset,\n\t\t\tlimit: relation.limit,\n\t\t\torderBy: relation.orderBy,\n\t\t}\n\t}\n\n\tpublic static createEntityListSubTreeParameters(\n\t\tparameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): any {\n\t\tif (parameters.isCreating) {\n\t\t\treturn {\n\t\t\t\ttype: 'entityListSubtree',\n\t\t\t\tisCreating: true,\n\t\t\t\tentityName: parameters.entityName,\n\t\t\t\tvariables: environment.getAllVariables(),\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\ttype: 'entityListSubtree',\n\t\t\tisCreating: false,\n\t\t\tentityName: parameters.entityName,\n\t\t\tfilter: parameters.filter,\n\t\t\toffset: parameters.offset,\n\t\t\tlimit: parameters.limit,\n\t\t\torderBy: parameters.orderBy,\n\t\t\tvariables: environment.getAllVariables(),\n\t\t}\n\t}\n\n\tpublic static createEntitySubTreeParameters(\n\t\tparameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): any {\n\t\tif (parameters.isCreating) {\n\t\t\treturn {\n\t\t\t\ttype: 'entitySubTree',\n\t\t\t\tisCreating: true,\n\t\t\t\tentityName: parameters.entityName,\n\t\t\t\tvariables: environment.getAllVariables(),\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\ttype: 'entitySubTree',\n\t\t\tisCreating: false,\n\t\t\twhere: parameters.where,\n\t\t\tentityName: parameters.entityName,\n\t\t\tfilter: parameters.filter,\n\t\t\tvariables: environment.getAllVariables(),\n\t\t}\n\t}\n\n}\n"],"names":[],"mappings":"AAUO,MAAM,+BAA+B;AAAA,EAE3C,OAAc,+BAA+B,UAA+B;AACpE,WAAA;AAAA,MACN,MAAM;AAAA,MACN,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS;AAAA,MACjB,WAAW,SAAS;AAAA,IAAA;AAAA,EAEtB;AAAA,EAEA,OAAc,gCAAgC,UAAgC;AACtE,WAAA;AAAA,MACN,MAAM;AAAA,MACN,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS;AAAA,MACjB,QAAQ,SAAS;AAAA,MACjB,OAAO,SAAS;AAAA,MAChB,SAAS,SAAS;AAAA,IAAA;AAAA,EAEpB;AAAA,EAEA,OAAc,kCACb,YACA,aACM;AACN,QAAI,WAAW,YAAY;AACnB,aAAA;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,YAAY,WAAW;AAAA,QACvB,WAAW,YAAY,gBAAgB;AAAA,MAAA;AAAA,IAEzC;AACO,WAAA;AAAA,MACN,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,YAAY,WAAW;AAAA,MACvB,QAAQ,WAAW;AAAA,MACnB,QAAQ,WAAW;AAAA,MACnB,OAAO,WAAW;AAAA,MAClB,SAAS,WAAW;AAAA,MACpB,WAAW,YAAY,gBAAgB;AAAA,IAAA;AAAA,EAEzC;AAAA,EAEA,OAAc,8BACb,YACA,aACM;AACN,QAAI,WAAW,YAAY;AACnB,aAAA;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,YAAY,WAAW;AAAA,QACvB,WAAW,YAAY,gBAAgB;AAAA,MAAA;AAAA,IAEzC;AACO,WAAA;AAAA,MACN,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,OAAO,WAAW;AAAA,MAClB,YAAY,WAAW;AAAA,MACvB,QAAQ,WAAW;AAAA,MACnB,WAAW,YAAY,gBAAgB;AAAA,IAAA;AAAA,EAEzC;AAED;"}
@@ -1,60 +1,6 @@
1
1
  class Hashing {
2
- static hashHasOneRelation(relation) {
3
- const where = [
4
- "upToOne",
5
- relation.field,
6
- relation.filter,
7
- relation.reducedBy
8
- ];
9
- return Hashing.hashArray(where);
10
- }
11
- static hashHasManyRelation(relation) {
12
- const where = [
13
- "possiblyMany",
14
- relation.field,
15
- relation.filter,
16
- "offset" in relation ? relation.offset : void 0,
17
- "limit" in relation ? relation.limit : void 0,
18
- "orderBy" in relation ? relation.orderBy : void 0
19
- ];
20
- return Hashing.hashArray(where);
21
- }
22
- static hashEntityListSubTreeParameters(parameters, environment) {
23
- if (parameters.isCreating) {
24
- return Hashing.hashArray([
25
- parameters.isCreating,
26
- parameters.entityName,
27
- environment.getAllVariables()
28
- ]);
29
- }
30
- return Hashing.hashArray([
31
- parameters.isCreating,
32
- parameters.entityName,
33
- parameters.filter,
34
- parameters.orderBy,
35
- parameters.offset,
36
- parameters.limit,
37
- environment.getAllVariables()
38
- ]);
39
- }
40
- static hashEntitySubTreeParameters(parameters, environment) {
41
- if (parameters.isCreating) {
42
- return Hashing.hashArray([
43
- parameters.isCreating,
44
- parameters.entityName,
45
- environment.getAllVariables()
46
- ]);
47
- }
48
- return Hashing.hashArray([
49
- parameters.isCreating,
50
- parameters.where,
51
- parameters.entityName,
52
- parameters.filter,
53
- environment.getAllVariables()
54
- ]);
55
- }
56
- static hashArray(array) {
57
- const json = array.map((item) => JSON.stringify(item)).join("_");
2
+ static hashAny(array) {
3
+ const json = JSON.stringify(array);
58
4
  return Hashing.hash(json);
59
5
  }
60
6
  // Taken from Java
@@ -1 +1 @@
1
- {"version":3,"file":"Hashing.js","sources":["../../../src/utils/Hashing.ts"],"sourcesContent":["import type {\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Environment } from '../dao'\n\n// TODO update hashing so that for offset, 0 == undefined\nexport class Hashing {\n\tpublic static hashHasOneRelation(relation: HasOneRelation): number {\n\t\tconst where = [\n\t\t\t'upToOne',\n\t\t\trelation.field,\n\t\t\trelation.filter,\n\t\t\trelation.reducedBy,\n\t\t]\n\n\t\treturn Hashing.hashArray(where)\n\t}\n\n\tpublic static hashHasManyRelation(relation: HasManyRelation): number {\n\t\tconst where = [\n\t\t\t'possiblyMany',\n\t\t\trelation.field,\n\t\t\trelation.filter,\n\t\t\t'offset' in relation ? relation.offset : undefined,\n\t\t\t'limit' in relation ? relation.limit : undefined,\n\t\t\t'orderBy' in relation ? relation.orderBy : undefined,\n\t\t]\n\n\t\treturn Hashing.hashArray(where)\n\t}\n\n\tpublic static hashEntityListSubTreeParameters(\n\t\tparameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,\n\t\tenvironment: Environment,\n\t): number {\n\t\tif (parameters.isCreating) {\n\t\t\treturn Hashing.hashArray([\n\t\t\t\tparameters.isCreating,\n\t\t\t\tparameters.entityName,\n\t\t\t\tenvironment.getAllVariables(),\n\t\t\t])\n\t\t}\n\t\treturn Hashing.hashArray([\n\t\t\tparameters.isCreating,\n\t\t\tparameters.entityName,\n\t\t\tparameters.filter,\n\t\t\tparameters.orderBy,\n\t\t\tparameters.offset,\n\t\t\tparameters.limit,\n\t\t\tenvironment.getAllVariables(),\n\t\t])\n\t}\n\n\tpublic static hashEntitySubTreeParameters(\n\t\tparameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,\n\t\tenvironment: Environment,\n\t): number {\n\t\tif (parameters.isCreating) {\n\t\t\treturn Hashing.hashArray([\n\t\t\t\tparameters.isCreating,\n\t\t\t\tparameters.entityName,\n\t\t\t\tenvironment.getAllVariables(),\n\t\t\t])\n\t\t}\n\t\treturn Hashing.hashArray([\n\t\t\tparameters.isCreating,\n\t\t\tparameters.where,\n\t\t\tparameters.entityName,\n\t\t\tparameters.filter,\n\t\t\tenvironment.getAllVariables(),\n\t\t])\n\t}\n\n\tprivate static hashArray(array: any[]): number {\n\t\tconst json = array.map(item => JSON.stringify(item)).join('_')\n\t\treturn Hashing.hash(json)\n\t}\n\n\t// Taken from Java\n\tpublic static hash(str: string): number {\n\t\tlet hash = 0\n\t\tif (str.length === 0) {\n\t\t\treturn hash\n\t\t}\n\t\tfor (let i = 0; i < str.length; i++) {\n\t\t\thash = (hash << 5) - hash + str.charCodeAt(i)\n\t\t\thash = hash & hash // Convert to 32bit integer\n\t\t}\n\t\treturn Math.abs(hash)\n\t}\n}\n"],"names":[],"mappings":"AAWO,MAAM,QAAQ;AAAA,EACpB,OAAc,mBAAmB,UAAkC;AAClE,UAAM,QAAQ;AAAA,MACb;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IAAA;AAGH,WAAA,QAAQ,UAAU,KAAK;AAAA,EAC/B;AAAA,EAEA,OAAc,oBAAoB,UAAmC;AACpE,UAAM,QAAQ;AAAA,MACb;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT,YAAY,WAAW,SAAS,SAAS;AAAA,MACzC,WAAW,WAAW,SAAS,QAAQ;AAAA,MACvC,aAAa,WAAW,SAAS,UAAU;AAAA,IAAA;AAGrC,WAAA,QAAQ,UAAU,KAAK;AAAA,EAC/B;AAAA,EAEA,OAAc,gCACb,YACA,aACS;AACT,QAAI,WAAW,YAAY;AAC1B,aAAO,QAAQ,UAAU;AAAA,QACxB,WAAW;AAAA,QACX,WAAW;AAAA,QACX,YAAY,gBAAgB;AAAA,MAAA,CAC5B;AAAA,IACF;AACA,WAAO,QAAQ,UAAU;AAAA,MACxB,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,YAAY,gBAAgB;AAAA,IAAA,CAC5B;AAAA,EACF;AAAA,EAEA,OAAc,4BACb,YACA,aACS;AACT,QAAI,WAAW,YAAY;AAC1B,aAAO,QAAQ,UAAU;AAAA,QACxB,WAAW;AAAA,QACX,WAAW;AAAA,QACX,YAAY,gBAAgB;AAAA,MAAA,CAC5B;AAAA,IACF;AACA,WAAO,QAAQ,UAAU;AAAA,MACxB,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,YAAY,gBAAgB;AAAA,IAAA,CAC5B;AAAA,EACF;AAAA,EAEA,OAAe,UAAU,OAAsB;AACxC,UAAA,OAAO,MAAM,IAAI,CAAQ,SAAA,KAAK,UAAU,IAAI,CAAC,EAAE,KAAK,GAAG;AACtD,WAAA,QAAQ,KAAK,IAAI;AAAA,EACzB;AAAA;AAAA,EAGA,OAAc,KAAK,KAAqB;AACvC,QAAI,OAAO;AACP,QAAA,IAAI,WAAW,GAAG;AACd,aAAA;AAAA,IACR;AACA,aAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACpC,cAAQ,QAAQ,KAAK,OAAO,IAAI,WAAW,CAAC;AAC5C,aAAO,OAAO;AAAA,IACf;AACO,WAAA,KAAK,IAAI,IAAI;AAAA,EACrB;AACD;"}
1
+ {"version":3,"file":"Hashing.js","sources":["../../../src/utils/Hashing.ts"],"sourcesContent":["import type {\n\tHasManyRelation,\n\tHasOneRelation,\n\tQualifiedEntityList,\n\tQualifiedSingleEntity,\n\tUnconstrainedQualifiedEntityList,\n\tUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { Environment } from '../dao'\n\n// TODO update hashing so that for offset, 0 == undefined\nexport class Hashing {\n\tpublic static hashAny(array: any[]): number {\n\t\tconst json = JSON.stringify(array)\n\t\treturn Hashing.hash(json)\n\t}\n\n\t// Taken from Java\n\tpublic static hash(str: string): number {\n\t\tlet hash = 0\n\t\tif (str.length === 0) {\n\t\t\treturn hash\n\t\t}\n\t\tfor (let i = 0; i < str.length; i++) {\n\t\t\thash = (hash << 5) - hash + str.charCodeAt(i)\n\t\t\thash = hash & hash // Convert to 32bit integer\n\t\t}\n\t\treturn Math.abs(hash)\n\t}\n}\n"],"names":[],"mappings":"AAWO,MAAM,QAAQ;AAAA,EACpB,OAAc,QAAQ,OAAsB;AACrC,UAAA,OAAO,KAAK,UAAU,KAAK;AAC1B,WAAA,QAAQ,KAAK,IAAI;AAAA,EACzB;AAAA;AAAA,EAGA,OAAc,KAAK,KAAqB;AACvC,QAAI,OAAO;AACP,QAAA,IAAI,WAAW,GAAG;AACd,aAAA;AAAA,IACR;AACA,aAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACpC,cAAQ,QAAQ,KAAK,OAAO,IAAI,WAAW,CAAC;AAC5C,aAAO,OAAO;AAAA,IACf;AACO,WAAA,KAAK,IAAI,IAAI;AAAA,EACrB;AACD;"}
@@ -0,0 +1,77 @@
1
+ import { BindingError } from "../BindingError.js";
2
+ import levenshtein from "js-levenshtein";
3
+ class TreeNodeUtils {
4
+ static resolveEntity(schema, entityName, type) {
5
+ const entity = schema.getEntityOrUndefined(entityName);
6
+ if (!entity) {
7
+ const alternative = this.recommendAlternative(entityName, schema.getEntityNames());
8
+ const didYouMean = alternative ? `Did you mean '${alternative}'?` : "";
9
+ throw new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`);
10
+ }
11
+ return entity;
12
+ }
13
+ static resolveHasOneRelation(environment, field, isReduced) {
14
+ if (isReduced) {
15
+ return this.resolveRelation(environment, field, "reduced has-one relation", ["ManyHasMany", "OneHasMany"]);
16
+ }
17
+ return this.resolveRelation(environment, field, "a has-one relation", ["ManyHasOne", "OneHasOne"]);
18
+ }
19
+ static resolveHasManyRelation(environment, field) {
20
+ return this.resolveRelation(environment, field, "a has-many relation", ["ManyHasMany", "OneHasMany"]);
21
+ }
22
+ static resolveRelation(environment, field, relationDescription, expectedRelationType) {
23
+ return this.resolveField(environment, field, (field2) => {
24
+ return field2.__typename === "_Relation" && expectedRelationType.includes(field2.type);
25
+ }, relationDescription);
26
+ }
27
+ static resolveColumn(environment, fieldName) {
28
+ return this.resolveField(environment, fieldName, (field) => field.__typename === "_Column", "an ordinary field");
29
+ }
30
+ static resolveField(environment, fieldName, matcher, expectedDescription) {
31
+ const treeLocation = environment.getSubTreeNode();
32
+ const entity = treeLocation.entity;
33
+ const field = entity.fields.get(fieldName);
34
+ if (!field) {
35
+ const alternative = this.recommendAlternative(
36
+ fieldName,
37
+ Array.from(entity.fields).filter(([, field2]) => matcher(field2)).map(([fieldName2]) => fieldName2)
38
+ );
39
+ const didYouMean = alternative ? `Did you mean '${alternative}'?` : "";
40
+ throw new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`);
41
+ }
42
+ if (!matcher(field)) {
43
+ const actual = field.__typename === "_Column" ? "an ordinary field" : `a ${field.type} relation`;
44
+ throw new BindingError(
45
+ `Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} refers to ${actual} but is being used as a ${expectedDescription}.`
46
+ );
47
+ }
48
+ return field;
49
+ }
50
+ static describeLocation(environment) {
51
+ const path = [];
52
+ const loc = environment.getSubTreeNode();
53
+ for (let env = environment; ; env = env.getParent()) {
54
+ const node = env.getSubTreeNode();
55
+ if (node.type === "subtree-entity" || node.type === "subtree-entity-list") {
56
+ return `entity '${loc.entity.name}' in path '${[node.entity.name, ...path.reverse()].join(".")}'`;
57
+ }
58
+ path.push(node.field.name);
59
+ }
60
+ }
61
+ static recommendAlternative(original, possibleAlternatives) {
62
+ let bestAlternative = void 0;
63
+ let bestAlternativeDistance = Number.MAX_SAFE_INTEGER;
64
+ for (const alternative of possibleAlternatives) {
65
+ const distance = levenshtein(original, alternative);
66
+ if (distance < bestAlternativeDistance) {
67
+ bestAlternative = alternative;
68
+ bestAlternativeDistance = distance;
69
+ }
70
+ }
71
+ return bestAlternative;
72
+ }
73
+ }
74
+ export {
75
+ TreeNodeUtils
76
+ };
77
+ //# sourceMappingURL=TreeNodeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeUtils.js","sources":["../../../src/utils/TreeNodeUtils.ts"],"sourcesContent":["import { Environment } from '../dao'\nimport { BaseRelation, Schema, SchemaColumn, SchemaEntity, SchemaField, SchemaRelation } from '../core'\nimport { BindingError } from '../BindingError'\nimport levenshtein from 'js-levenshtein'\n\nexport class TreeNodeUtils {\n\n\tpublic static resolveEntity(schema: Schema, entityName: string, type: 'entity' | 'entity list'): SchemaEntity {\n\t\tconst entity = schema.getEntityOrUndefined(entityName)\n\t\tif (!entity) {\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.getEntityNames())\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`)\n\t\t}\n\t\treturn entity\n\t}\n\n\tpublic static resolveHasOneRelation(environment: Environment, field: string, isReduced: boolean): SchemaRelation {\n\t\tif (isReduced) {\n\t\t\treturn this.resolveRelation(environment, field, 'reduced has-one relation', ['ManyHasMany', 'OneHasMany'])\n\t\t}\n\t\treturn this.resolveRelation(environment, field, 'a has-one relation', ['ManyHasOne', 'OneHasOne'])\n\t}\n\n\n\tpublic static resolveHasManyRelation(environment: Environment, field: string): SchemaRelation {\n\t\treturn this.resolveRelation(environment, field, 'a has-many relation', ['ManyHasMany', 'OneHasMany'])\n\t}\n\n\tprivate static resolveRelation(environment: Environment, field: string, relationDescription: string, expectedRelationType: BaseRelation['type'][]): SchemaRelation {\n\t\treturn this.resolveField(environment, field, (field): field is SchemaRelation => {\n\t\t\treturn field.__typename === '_Relation' && expectedRelationType.includes(field.type)\n\t\t}, relationDescription)\n\t}\n\n\tpublic static resolveColumn(environment: Environment, fieldName: string): SchemaColumn {\n\t\treturn this.resolveField(environment, fieldName, (field): field is SchemaColumn => field.__typename === '_Column', 'an ordinary field')\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static resolveField<T extends SchemaField>(environment: Environment, fieldName: string, matcher: (field: SchemaField) => field is T, expectedDescription: string): T {\n\t\tconst treeLocation = environment.getSubTreeNode()\n\t\tconst entity = treeLocation.entity\n\t\tconst field = entity.fields.get(fieldName)\n\t\tif (!field) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(entity.fields)\n\t\t\t\t\t.filter(([, field]) => matcher(field))\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`)\n\t\t}\n\t\tif (!matcher(field)) {\n\t\t\tconst actual = field.__typename === '_Column' ? 'an ordinary field' : `a ${field.type} relation`\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} ` +\n\t\t\t\t`refers to ${actual} but is being used as a ${expectedDescription}.`,\n\t\t\t)\n\t\t}\n\t\treturn field\n\t}\n\n\tpublic static describeLocation(environment: Environment): string {\n\t\tconst path = []\n\t\tconst loc = environment.getSubTreeNode()\n\t\tfor (let env = environment; ; env = env.getParent()) {\n\t\t\tconst node = env.getSubTreeNode()\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn `entity '${loc.entity.name}' in path '${[node.entity.name, ...path.reverse()].join('.')}'`\n\t\t\t}\n\t\t\tpath.push(node.field.name)\n\t\t}\n\t}\n\n\tpublic static recommendAlternative(original: string, possibleAlternatives: Iterable<string>): string | undefined {\n\t\tlet bestAlternative: string | undefined = undefined\n\t\tlet bestAlternativeDistance = Number.MAX_SAFE_INTEGER\n\n\t\tfor (const alternative of possibleAlternatives) {\n\t\t\tconst distance = levenshtein(original, alternative)\n\n\t\t\tif (distance < bestAlternativeDistance) {\n\t\t\t\tbestAlternative = alternative\n\t\t\t\tbestAlternativeDistance = distance\n\t\t\t}\n\t\t}\n\t\treturn bestAlternative\n\t}\n}\n"],"names":["field","fieldName"],"mappings":";;AAKO,MAAM,cAAc;AAAA,EAE1B,OAAc,cAAc,QAAgB,YAAoB,MAA8C;AACvG,UAAA,SAAS,OAAO,qBAAqB,UAAU;AACrD,QAAI,CAAC,QAAQ;AACZ,YAAM,cAAc,KAAK,qBAAqB,YAAY,OAAO,gBAAgB;AAC3E,YAAA,aAAa,cAAc,iBAAiB,kBAAkB;AACpE,YAAM,IAAI,aAAa,WAAW,0BAA0B,8BAA8B,YAAY;AAAA,IACvG;AACO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,sBAAsB,aAA0B,OAAe,WAAoC;AAChH,QAAI,WAAW;AACP,aAAA,KAAK,gBAAgB,aAAa,OAAO,4BAA4B,CAAC,eAAe,YAAY,CAAC;AAAA,IAC1G;AACO,WAAA,KAAK,gBAAgB,aAAa,OAAO,sBAAsB,CAAC,cAAc,WAAW,CAAC;AAAA,EAClG;AAAA,EAGA,OAAc,uBAAuB,aAA0B,OAA+B;AACtF,WAAA,KAAK,gBAAgB,aAAa,OAAO,uBAAuB,CAAC,eAAe,YAAY,CAAC;AAAA,EACrG;AAAA,EAEA,OAAe,gBAAgB,aAA0B,OAAe,qBAA6B,sBAA8D;AAClK,WAAO,KAAK,aAAa,aAAa,OAAO,CAACA,WAAmC;AAChF,aAAOA,OAAM,eAAe,eAAe,qBAAqB,SAASA,OAAM,IAAI;AAAA,OACjF,mBAAmB;AAAA,EACvB;AAAA,EAEA,OAAc,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4D;AAChH,QAAI,kBAAsC;AAC1C,QAAI,0BAA0B,OAAO;AAErC,eAAW,eAAe,sBAAsB;AACzC,YAAA,WAAW,YAAY,UAAU,WAAW;AAElD,UAAI,WAAW,yBAAyB;AACrB,0BAAA;AACQ,kCAAA;AAAA,MAC3B;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;"}
@@ -1,10 +1,11 @@
1
1
  import { RuntimeId, SingleEntityPersistedData } from '../accessorTree';
2
2
  import type { EntityOperations } from '../core/operations';
3
3
  import type { Environment } from '../dao';
4
+ import { HasManyRelationMarker, HasOneRelationMarker } from '../markers';
4
5
  import type { EntityId, EntityName, EntityRealmKey, FieldName, FieldValue, RelativeEntityList, RelativeSingleEntity, RelativeSingleField, SugaredRelativeEntityList, SugaredRelativeSingleEntity, SugaredRelativeSingleField } from '../treeParameters';
5
6
  import type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions';
6
7
  import type { BatchUpdatesOptions } from './BatchUpdatesOptions';
7
- import type { EntityListAccessor } from './EntityListAccessor';
8
+ import { EntityListAccessor } from './EntityListAccessor';
8
9
  import type { Errorable } from './Errorable';
9
10
  import { ErrorAccessor } from './ErrorAccessor';
10
11
  import type { FieldAccessor } from './FieldAccessor';
@@ -54,15 +55,19 @@ declare class EntityAccessor implements Errorable {
54
55
  getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value>;
55
56
  getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor;
56
57
  getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor;
58
+ private raiseInvalidHasOneRelationError;
59
+ private raiseInvalidHasManyRelationError;
60
+ private raiseUndefinedRelationError;
61
+ private createHintMessage;
62
+ private getMarkersOfType;
57
63
  getParent(): EntityAccessor | EntityListAccessor | undefined;
58
- getMarker(): import("../markers").HasOneRelationMarker | import("../markers").HasManyRelationMarker | import("../markers").EntityListSubTreeMarker | import("../markers").EntitySubTreeMarker;
59
- private getAccessorByPlaceholder;
64
+ getMarker(): HasOneRelationMarker | HasManyRelationMarker | import("../markers").EntityListSubTreeMarker | import("../markers").EntitySubTreeMarker;
60
65
  }
61
66
  declare namespace EntityAccessor {
62
67
  interface FieldDatum {
63
68
  getAccessor(): NestedAccessor;
64
69
  }
65
- type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor;
70
+ type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor<any>;
66
71
  type FieldValuePairs = {
67
72
  [field: string]: FieldValue;
68
73
  } | Iterable<[SugaredRelativeSingleField | string, FieldValue]>;
@@ -1 +1 @@
1
- {"version":3,"file":"EntityAccessor.d.ts","sourceRoot":"","sources":["../../../src/accessors/EntityAccessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAGzC,OAAO,KAAK,EACX,QAAQ,EACR,UAAU,EACV,cAAc,EACd,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB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,CAAC,mBAAmB;IAMxF,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc;IAoHxG,uBAAuB,CAC7B,UAAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,SAAS,EACpB,qBAAqB,EAAE,cAAc,CAAC,mBAAmB,GAAG,SAAS;IA6D/D,YAAY,CAAC,KAAK,EAAE,gBAAgB;IAkE3C,OAAO,CAAE,4BAA4B;CAqBrC"}
@@ -7,13 +7,5 @@ export declare class TreeNodeEnvironmentFactory {
7
7
  static createEnvironmentForEntity(environment: Environment, sugaredRelativeSingleEntity: SugaredRelativeSingleEntity): Environment;
8
8
  static createEnvironmentForField(environment: Environment, sugaredRelativeSingleField: SugaredRelativeSingleField): Environment;
9
9
  private static traverseHasOnePath;
10
- private static resolveHasOneRelation;
11
- private static assertHasManyRelation;
12
- private static resolveRelation;
13
- private static resolveEntity;
14
- private static resolveColumn;
15
- private static resolveField;
16
- private static describeLocation;
17
- static recommendAlternative(original: string, possibleAlternatives: Iterable<string>): string | undefined;
18
10
  }
19
11
  //# sourceMappingURL=TreeNodeEnvironmentFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeEnvironmentFactory.d.ts","sourceRoot":"","sources":["../../../src/dao/TreeNodeEnvironmentFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAEN,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,uCAAuC,EACvC,yCAAyC,EACzC,MAAM,mBAAmB,CAAA;AAO1B,qBAAa,0BAA0B;WAExB,qCAAqC,CAClD,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,0BAA0B,GAAG,uCAAuC,GACrF,WAAW;WA0BA,iCAAiC,CAC9C,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,4BAA4B,GAA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AAyB,EAAE,yBAAyB,GAClD,WAAW;WAgBA,0BAA0B,CACvC,WAAW,EAAE,WAAW,EACxB,2BAA2B,EAAE,2BAA2B;WAO3C,yBAAyB,CACtC,WAAW,EAAE,WAAW,EACxB,0BAA0B,EAAE,0BAA0B;IAcvD,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAiBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderGenerator.d.ts","sourceRoot":"","sources":["../../../src/markers/PlaceholderGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,gCAAgC,EAChC,kCAAkC,EAClC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,qBAAa,oBAAoB;WAClB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;WAIjD,4BAA4B,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM;WAI9D,6BAA6B,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;WAIhE,2BAA2B,CACxC,iBAAiB,EAAE,qBAAqB,GAAG,kCAAkC,EAC7E,WAAW,EAAE,WAAW,GACtB,MAAM;WAIK,+BAA+B,CAC5C,iBAAiB,EAAE,mBAAmB,GAAG,gCAAgC,EACzE,WAAW,EAAE,WAAW,GACtB,MAAM;CAGT"}
1
+ {"version":3,"file":"PlaceholderGenerator.d.ts","sourceRoot":"","sources":["../../../src/markers/PlaceholderGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,gCAAgC,EAChC,kCAAkC,EAClC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAGpC,qBAAa,oBAAoB;WAClB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;WAIjD,4BAA4B,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM;WAI9D,6BAA6B,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;WAIhE,2BAA2B,CACxC,iBAAiB,EAAE,qBAAqB,GAAG,kCAAkC,EAC7E,WAAW,EAAE,WAAW,GACtB,MAAM;WAIK,+BAA+B,CAC5C,iBAAiB,EAAE,mBAAmB,GAAG,gCAAgC,EACzE,WAAW,EAAE,WAAW,GACtB,MAAM;CAGT"}
@@ -0,0 +1,9 @@
1
+ import { HasManyRelation, HasOneRelation, QualifiedEntityList, QualifiedSingleEntity, UnconstrainedQualifiedEntityList, UnconstrainedQualifiedSingleEntity } from '../treeParameters';
2
+ import { Environment } from '../dao';
3
+ export declare class PlaceholderParametersGenerator {
4
+ static createHasOneRelationParameters(relation: HasOneRelation): any;
5
+ static createHasManyRelationParameters(relation: HasManyRelation): any;
6
+ static createEntityListSubTreeParameters(parameters: QualifiedEntityList | UnconstrainedQualifiedEntityList, environment: Environment): any;
7
+ static createEntitySubTreeParameters(parameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity, environment: Environment): any;
8
+ }
9
+ //# sourceMappingURL=PlaceholderParametersGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaceholderParametersGenerator.d.ts","sourceRoot":"","sources":["../../../src/markers/PlaceholderParametersGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,gCAAgC,EAChC,kCAAkC,EAClC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,qBAAa,8BAA8B;WAE5B,8BAA8B,CAAC,QAAQ,EAAE,cAAc,GAAG,GAAG;WAS7D,+BAA+B,CAAC,QAAQ,EAAE,eAAe,GAAG,GAAG;WAW/D,iCAAiC,CAC9C,UAAU,EAAE,mBAAmB,GAAG,gCAAgC,EAClE,WAAW,EAAE,WAAW,GACtB,GAAG;WAqBQ,6BAA6B,CAC1C,UAAU,EAAE,qBAAqB,GAAG,kCAAkC,EACtE,WAAW,EAAE,WAAW,GACtB,GAAG;CAmBN"}