@contember/binding 1.3.0-alpha.6 → 1.3.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/development/accessorTree/RuntimeId.cjs +5 -5
- package/dist/development/accessorTree/RuntimeId.cjs.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +5 -5
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessors/EntityAccessor.cjs.map +1 -1
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.cjs +1 -1
- package/dist/development/core/AccessorErrorManager.cjs.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +1 -1
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/Config.cjs +3 -3
- package/dist/development/core/Config.cjs.map +1 -1
- package/dist/development/core/Config.js +3 -3
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.cjs +3 -3
- package/dist/development/core/DataBinding.cjs.map +1 -1
- package/dist/development/core/DataBinding.js +3 -3
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.cjs.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/development/core/EventManager.cjs.map +1 -1
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/MarkerComparator.cjs.map +1 -1
- package/dist/development/core/MarkerComparator.js.map +1 -1
- package/dist/development/core/MarkerMerger.cjs.map +1 -1
- package/dist/development/core/MarkerMerger.js.map +1 -1
- package/dist/development/core/MutationGenerator.cjs.map +1 -1
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/QueryGenerator.cjs.map +1 -1
- package/dist/development/core/QueryGenerator.js.map +1 -1
- package/dist/development/core/RealmKeyGenerator.cjs.map +1 -1
- package/dist/development/core/RealmKeyGenerator.js.map +1 -1
- package/dist/development/core/StateInitializer.cjs.map +1 -1
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeParameterMerger.cjs.map +1 -1
- package/dist/development/core/TreeParameterMerger.js.map +1 -1
- package/dist/development/core/TreeStore.cjs.map +1 -1
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/VariableInputTransformer.cjs.map +1 -1
- package/dist/development/core/VariableInputTransformer.js.map +1 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.cjs.map +1 -1
- package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.cjs.map +1 -1
- package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.cjs.map +1 -1
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/FieldOperations.cjs.map +1 -1
- package/dist/development/core/operations/FieldOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.cjs.map +1 -1
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.cjs.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.cjs.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/core/schema/Schema.cjs.map +1 -1
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/dao/Environment.cjs.map +1 -1
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.cjs.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/queryLanguage/Parser.cjs +6 -6
- package/dist/development/queryLanguage/Parser.cjs.map +1 -1
- package/dist/development/queryLanguage/Parser.js +6 -6
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.cjs +13 -13
- package/dist/development/queryLanguage/QueryLanguage.cjs.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +13 -13
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/treeParameters/EventListenersStore.cjs.map +1 -1
- package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/development/utils/TreeNodeUtils.cjs.map +1 -1
- package/dist/development/utils/TreeNodeUtils.js.map +1 -1
- package/dist/development/utils/assert.cjs.map +1 -1
- package/dist/development/utils/assert.js.map +1 -1
- package/dist/development/utils/ucfirst.cjs.map +1 -1
- package/dist/development/utils/ucfirst.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.cjs +5 -5
- package/dist/production/accessorTree/RuntimeId.cjs.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +5 -5
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessors/EntityAccessor.cjs.map +1 -1
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.cjs +1 -1
- package/dist/production/core/AccessorErrorManager.cjs.map +1 -1
- package/dist/production/core/AccessorErrorManager.js +1 -1
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/Config.cjs +3 -3
- package/dist/production/core/Config.cjs.map +1 -1
- package/dist/production/core/Config.js +3 -3
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.cjs +3 -3
- package/dist/production/core/DataBinding.cjs.map +1 -1
- package/dist/production/core/DataBinding.js +3 -3
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.cjs.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/production/core/EventManager.cjs.map +1 -1
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/MarkerComparator.cjs.map +1 -1
- package/dist/production/core/MarkerComparator.js.map +1 -1
- package/dist/production/core/MarkerMerger.cjs.map +1 -1
- package/dist/production/core/MarkerMerger.js.map +1 -1
- package/dist/production/core/MutationGenerator.cjs.map +1 -1
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/QueryGenerator.cjs.map +1 -1
- package/dist/production/core/QueryGenerator.js.map +1 -1
- package/dist/production/core/RealmKeyGenerator.cjs.map +1 -1
- package/dist/production/core/RealmKeyGenerator.js.map +1 -1
- package/dist/production/core/StateInitializer.cjs.map +1 -1
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeParameterMerger.cjs.map +1 -1
- package/dist/production/core/TreeParameterMerger.js.map +1 -1
- package/dist/production/core/TreeStore.cjs.map +1 -1
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/VariableInputTransformer.cjs.map +1 -1
- package/dist/production/core/VariableInputTransformer.js.map +1 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.cjs.map +1 -1
- package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.cjs.map +1 -1
- package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.cjs.map +1 -1
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.cjs.map +1 -1
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.cjs.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.cjs.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/core/schema/Schema.cjs.map +1 -1
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/dao/Environment.cjs.map +1 -1
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.cjs.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/queryLanguage/Parser.cjs +6 -6
- package/dist/production/queryLanguage/Parser.cjs.map +1 -1
- package/dist/production/queryLanguage/Parser.js +6 -6
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.cjs +13 -13
- package/dist/production/queryLanguage/QueryLanguage.cjs.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js +13 -13
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/treeParameters/EventListenersStore.cjs.map +1 -1
- package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
- package/dist/production/utils/TreeNodeUtils.cjs.map +1 -1
- package/dist/production/utils/TreeNodeUtils.js.map +1 -1
- package/dist/production/utils/assert.cjs.map +1 -1
- package/dist/production/utils/assert.js.map +1 -1
- package/dist/production/utils/ucfirst.cjs.map +1 -1
- package/dist/production/utils/ucfirst.js.map +1 -1
- package/dist/types/accessors/EntityAccessor.d.ts +2 -2
- package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
- package/dist/types/treeParameters/EventListenersStore.d.ts +2 -1
- package/dist/types/treeParameters/EventListenersStore.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/accessors/EntityAccessor.ts +2 -2
- package/src/treeParameters/EventListenersStore.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryLanguage.js","sources":["../../../src/queryLanguage/QueryLanguage.ts"],"sourcesContent":["import { 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\nconst emptyObject = Object.freeze({})\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\tisUnpersisted: unsugarableEntityList.isUnpersisted ?? 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\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\tisUnpersisted: unsugarableSingleEntity.isUnpersisted ?? false,\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":";;;;;;;;;;;;;;;;AAsDA,MAAM,cAAc,OAAO,OAAO,CAAA,CAAE;AAE7B,MAAM,iBAAN,MAAoB;AAAA,EAE1B,OAAe,2BAA4D,YAAmB;AAC7F,WAAO,CAAC,OAAe,gBACtB,OAAO,6BAA6B,OAAO,YAAY,WAAW;AAAA,EACpE;AAAA,EAEA,OAAe,uCAAwE,YAAmB;AAClG,WAAA,CAAC,OAA4C,gBAAyD;AACxG,UAAA,OAAO,UAAU,UAAU;AAC9B,eAAO,OAAO,6BAA6B,OAAO,YAAY,WAAW;AAAA,MAC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AAqB,KAAK;AAAA,QACzB,OAAO;AAAA,QACP;AAAA,QACA;AAAA,MAAA;AAED,wBAAkB,KAAK;AAAA,QACtB,OAAO;AAAA,QACP;AAAA,QACA;AAAA,MAAA;AAAA,IACD,OACM;AACN,2BAAqB,KAAK,0BAA0B,MAAM,sBAAsB,IAAI,aAAa,WAAW;AAC5G,wBAAkB,KAAK,uBAAuB,MAAM,iBAAiB,uBAAuB,WAAW;AAAA,IACxG;AAEO,WAAA;AAAA,MACN;AAAA,MACA;AAAA,IAAA;AAAA,EAEF;AACD;AApqBO,IAAM,gBAAN;AAgBN,cAhBY,eAgBG,yCAAwC,eAAc,2BAA2B,kCAAkC;AAClI,cAjBY,eAiBG,2CAA0C,eAAc,2BAA2B,kCAAkC;AACpI,cAlBY,eAkBG,4BAA2B,eAAc,2BAA2B,qBAAqB;AACxG,cAnBY,eAmBG,2BAA0B,eAAc,2BAA2B,oBAAoB;AACtG,cApBY,eAoBG,8BAA6B,eAAc,2BAA2B,uBAAuB;AAC5G,cArBY,eAqBG,2BAA0B,eAAc,2BAA2B,oBAAoB;AACtG,cAtBY,eAsBG,6BAA4B,eAAc,2BAA2B,sBAAsB;AAC1G,cAvBY,eAuBG,4BAA2B,eAAc,2BAA2B,qBAAqB;AAExG,cAzBY,eAyBE,sBAAqB,eAAc,uCAAuC,aAAa;AACrG,cA1BY,eA0BE,iBAAgB,eAAc,uCAAuC,QAAQ;AAC3F,cA3BY,eA2BE,kBAAiB,eAAc,uCAAuC,SAAS;AAC7F,cA5BY,eA4BE,oBAAmB,eAAc,uCAAuC,WAAW;"}
|
|
1
|
+
{"version":3,"file":"QueryLanguage.js","sources":["../../../src/queryLanguage/QueryLanguage.ts"],"sourcesContent":["import { 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\nconst emptyObject = Object.freeze({})\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\tisUnpersisted: unsugarableEntityList.isUnpersisted ?? 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\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\tisUnpersisted: unsugarableSingleEntity.isUnpersisted ?? false,\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":";;;;;;;;;;;;;;;;AAsDA,MAAM,cAAc,OAAO,OAAO,CAAA,CAAE;AAE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A4BE,oBAAmB,eAAc,uCAAuC,WAAW;AA5B3F,IAAM,gBAAN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventListenersStore.cjs","sources":["../../../src/treeParameters/EventListenersStore.ts"],"sourcesContent":["type GenericEventsMap<EventTypes extends string> = {\n\t[K in EventTypes]?: (...args: any[]) => void | Promise<void |
|
|
1
|
+
{"version":3,"file":"EventListenersStore.cjs","sources":["../../../src/treeParameters/EventListenersStore.ts"],"sourcesContent":["type AnyFunction = (...args: any[]) => any\ntype GenericEventsMap<EventTypes extends string> = {\n\t[K in EventTypes]?: (...args: any[]) => void | AnyFunction | Promise<void | AnyFunction>\n}\n\nexport class EventListenersStore<EventTypes extends string, Events extends GenericEventsMap<EventTypes>> {\n\n\tconstructor(\n\t\tprivate readonly parentStoreGetter?: () => EventListenersStore<EventTypes, Events> | undefined,\n\t\tprivate listeners: Map<string, Set<Events[any]>> = new Map(),\n\t) {}\n\n\tset<Type extends EventTypes>(event: { type: Type; key?: string }, listeners: Set<Events[Type]>): void {\n\t\tthis.listeners.set(this.formatMapEntryKey(event), listeners)\n\t}\n\n\tdelete<Type extends EventTypes>(event: { type: Type; key?: string }) {\n\t\tthis.listeners.delete(this.formatMapEntryKey(event))\n\t}\n\n\tdeleteByType<Type extends EventTypes>(type: Type) {\n\t\tconst prefix = this.formatMapEntryKey({ type, key: '' })\n\t\tfor (const eventType of this.listeners.keys()) {\n\t\t\tif (eventType.startsWith(prefix)) {\n\t\t\t\tthis.listeners.delete(eventType)\n\t\t\t}\n\t\t}\n\t}\n\n\tget<Type extends EventTypes>(event: { type: Type; key?: string }): Set<Events[Type]> | undefined {\n\t\tconst ownListeners = this.listeners.get(this.formatMapEntryKey(event))\n\t\tconst parentListeners = this.parentStoreGetter?.()?.get(event)\n\t\tif (!parentListeners) {\n\t\t\treturn ownListeners\n\t\t} else if (!ownListeners) {\n\t\t\treturn parentListeners\n\t\t}\n\t\treturn new Set([...ownListeners, ...parentListeners])\n\t}\n\n\tadd<Type extends EventTypes>(event: { type: Type; key?: string }, handler: Events[Type]): () => void {\n\t\tconst key = this.formatMapEntryKey(event)\n\t\tlet eventListeners = this.addInternal(key, handler)\n\t\treturn () => eventListeners?.delete(handler)\n\t}\n\n\tcloneDeep(): EventListenersStore<EventTypes, Events> {\n\t\tconst store: EventListenersStore<EventTypes, Events> = new EventListenersStore()\n\t\tfor (const [key, value] of this.listeners.entries()) {\n\t\t\tstore.listeners.set(key, new Set(value))\n\t\t}\n\t\treturn store\n\t}\n\n\tclone(): EventListenersStore<EventTypes, Events> {\n\t\tconst store: EventListenersStore<EventTypes, Events> = new EventListenersStore()\n\t\tstore.listeners = new Map(this.listeners)\n\t\treturn store\n\t}\n\n\tappend(other: EventListenersStore<EventTypes, Events>) {\n\t\tfor (const [eventKey, otherListeners] of other.listeners) {\n\t\t\tfor (const listener of otherListeners) {\n\t\t\t\tthis.addInternal(eventKey, listener)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate formatMapEntryKey(event: { type: string; key?: string }): string {\n\t\treturn event.key ? `${event.type}_${event.key ?? ''}` : event.type\n\t}\n\n\tprivate addInternal<Type extends keyof Events>(key: string, handler: Events[Type]) {\n\t\tlet eventListeners = this.listeners.get(key)\n\t\tif (!eventListeners) {\n\t\t\teventListeners = new Set()\n\t\t\tthis.listeners.set(key, eventListeners)\n\t\t}\n\t\teventListeners.add(handler)\n\t\treturn eventListeners\n\t}\n}\n"],"names":[],"mappings":";;AAKO,MAAM,oBAA4F;AAAA,EAExG,YACkB,mBACT,YAA2C,oBAAI,OACtD;AAFgB,SAAA,oBAAA;AACT,SAAA,YAAA;AAAA,EACN;AAAA,EAEH,IAA6B,OAAqC,WAAoC;AACrG,SAAK,UAAU,IAAI,KAAK,kBAAkB,KAAK,GAAG,SAAS;AAAA,EAC5D;AAAA,EAEA,OAAgC,OAAqC;AACpE,SAAK,UAAU,OAAO,KAAK,kBAAkB,KAAK,CAAC;AAAA,EACpD;AAAA,EAEA,a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,OAAO,EAAE,KAAK,MAAM;AAAA,EAC/D;AAAA,EAEQ,YAAuC,KAAa,SAAuB;AAClF,QAAI,iBAAiB,KAAK,UAAU,IAAI,GAAG;AAC3C,QAAI,CAAC,gBAAgB;AACpB,2CAAqB;AAChB,WAAA,UAAU,IAAI,KAAK,cAAc;AAAA,IACvC;AACA,mBAAe,IAAI,OAAO;AACnB,WAAA;AAAA,EACR;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventListenersStore.js","sources":["../../../src/treeParameters/EventListenersStore.ts"],"sourcesContent":["type GenericEventsMap<EventTypes extends string> = {\n\t[K in EventTypes]?: (...args: any[]) => void | Promise<void |
|
|
1
|
+
{"version":3,"file":"EventListenersStore.js","sources":["../../../src/treeParameters/EventListenersStore.ts"],"sourcesContent":["type AnyFunction = (...args: any[]) => any\ntype GenericEventsMap<EventTypes extends string> = {\n\t[K in EventTypes]?: (...args: any[]) => void | AnyFunction | Promise<void | AnyFunction>\n}\n\nexport class EventListenersStore<EventTypes extends string, Events extends GenericEventsMap<EventTypes>> {\n\n\tconstructor(\n\t\tprivate readonly parentStoreGetter?: () => EventListenersStore<EventTypes, Events> | undefined,\n\t\tprivate listeners: Map<string, Set<Events[any]>> = new Map(),\n\t) {}\n\n\tset<Type extends EventTypes>(event: { type: Type; key?: string }, listeners: Set<Events[Type]>): void {\n\t\tthis.listeners.set(this.formatMapEntryKey(event), listeners)\n\t}\n\n\tdelete<Type extends EventTypes>(event: { type: Type; key?: string }) {\n\t\tthis.listeners.delete(this.formatMapEntryKey(event))\n\t}\n\n\tdeleteByType<Type extends EventTypes>(type: Type) {\n\t\tconst prefix = this.formatMapEntryKey({ type, key: '' })\n\t\tfor (const eventType of this.listeners.keys()) {\n\t\t\tif (eventType.startsWith(prefix)) {\n\t\t\t\tthis.listeners.delete(eventType)\n\t\t\t}\n\t\t}\n\t}\n\n\tget<Type extends EventTypes>(event: { type: Type; key?: string }): Set<Events[Type]> | undefined {\n\t\tconst ownListeners = this.listeners.get(this.formatMapEntryKey(event))\n\t\tconst parentListeners = this.parentStoreGetter?.()?.get(event)\n\t\tif (!parentListeners) {\n\t\t\treturn ownListeners\n\t\t} else if (!ownListeners) {\n\t\t\treturn parentListeners\n\t\t}\n\t\treturn new Set([...ownListeners, ...parentListeners])\n\t}\n\n\tadd<Type extends EventTypes>(event: { type: Type; key?: string }, handler: Events[Type]): () => void {\n\t\tconst key = this.formatMapEntryKey(event)\n\t\tlet eventListeners = this.addInternal(key, handler)\n\t\treturn () => eventListeners?.delete(handler)\n\t}\n\n\tcloneDeep(): EventListenersStore<EventTypes, Events> {\n\t\tconst store: EventListenersStore<EventTypes, Events> = new EventListenersStore()\n\t\tfor (const [key, value] of this.listeners.entries()) {\n\t\t\tstore.listeners.set(key, new Set(value))\n\t\t}\n\t\treturn store\n\t}\n\n\tclone(): EventListenersStore<EventTypes, Events> {\n\t\tconst store: EventListenersStore<EventTypes, Events> = new EventListenersStore()\n\t\tstore.listeners = new Map(this.listeners)\n\t\treturn store\n\t}\n\n\tappend(other: EventListenersStore<EventTypes, Events>) {\n\t\tfor (const [eventKey, otherListeners] of other.listeners) {\n\t\t\tfor (const listener of otherListeners) {\n\t\t\t\tthis.addInternal(eventKey, listener)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate formatMapEntryKey(event: { type: string; key?: string }): string {\n\t\treturn event.key ? `${event.type}_${event.key ?? ''}` : event.type\n\t}\n\n\tprivate addInternal<Type extends keyof Events>(key: string, handler: Events[Type]) {\n\t\tlet eventListeners = this.listeners.get(key)\n\t\tif (!eventListeners) {\n\t\t\teventListeners = new Set()\n\t\t\tthis.listeners.set(key, eventListeners)\n\t\t}\n\t\teventListeners.add(handler)\n\t\treturn eventListeners\n\t}\n}\n"],"names":[],"mappings":"AAKO,MAAM,oBAA4F;AAAA,EAExG,YACkB,mBACT,YAA2C,oBAAI,OACtD;AAFgB,SAAA,oBAAA;AACT,SAAA,YAAA;AAAA,EACN;AAAA,EA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AAc,KAAK,MAAM,WAAW;AACzD,iBAAW,YAAY,gBAAgB;AACjC,aAAA,YAAY,UAAU,QAAQ;AAAA,MACpC;AAAA,IACD;AAAA,EACD;AAAA,EAEQ,kBAAkB,OAA+C;AACjE,WAAA,MAAM,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,OAAO,EAAE,KAAK,MAAM;AAAA,EAC/D;AAAA,EAEQ,YAAuC,KAAa,SAAuB;AAClF,QAAI,iBAAiB,KAAK,UAAU,IAAI,GAAG;AAC3C,QAAI,CAAC,gBAAgB;AACpB,2CAAqB;AAChB,WAAA,UAAU,IAAI,KAAK,cAAc;AAAA,IACvC;AACA,mBAAe,IAAI,OAAO;AACnB,WAAA;AAAA,EACR;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeUtils.cjs","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":["BindingError","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;
|
|
1
|
+
{"version":3,"file":"TreeNodeUtils.cjs","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":["BindingError","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;AACjF,YAAM,aAAa,cAAc,iBAAiB,WAAW,OAAO;AAC9D,YAAA,IAAIA,aAAAA,aAAa,WAAW,IAAI,sBAAsB,UAAU,oBAAoB,UAAU,EAAE;AAAA,IACvG;AACO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,sBAAsB,aAA0B,OAAe,WAAoC;AAChH,QAAI,WA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YAAM,IAAIA,aAAA;AAAA,QACT,4BAA4B,MAAM,IAAI,QAAQ,KAAK,iBAAiB,WAAW,CAAC,cACnE,MAAM,2BAA2B,mBAAmB;AAAA,MAAA;AAAA,IAEnE;AACO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,iBAAiB,aAAkC;AAChE,UAAM,OAAO,CAAA;AACP,UAAA,MAAM,YAAY;AACxB,aAAS,MAAM,eAAe,MAAM,IAAI,aAAa;AAC9C,YAAA,OAAO,IAAI;AACjB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AAC1E,eAAO,WAAW,IAAI,OAAO,IAAI,cAAc,CAAC,KAAK,OAAO,MAAM,GAAG,KAAK,QAAS,CAAA,EAAE,KAAK,GAAG,CAAC;AAAA,MAC/F;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 +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;
|
|
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,UA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AC,EACpC,IAAI,CAAC,CAACC,UAAS,MAAMA,UAAS;AAAA,MAAA;AAEjC,YAAM,aAAa,cAAc,iBAAiB,WAAW,OAAO;AAC9D,YAAA,IAAI,aAAa,UAAU,SAAS,sBAAsB,KAAK,iBAAiB,WAAW,CAAC,KAAK,UAAU,EAAE;AAAA,IACpH;AACI,QAAA,CAAC,QAAQ,KAAK,GAAG;AACpB,YAAM,SAAS,MAAM,eAAe,YAAY,sBAAsB,KAAK,MAAM,IAAI;AACrF,YAAM,IAAI;AAAA,QACT,4BAA4B,MAAM,IAAI,QAAQ,KAAK,iBAAiB,WAAW,CAAC,cACnE,MAAM,2BAA2B,mBAAmB;AAAA,MAAA;AAAA,IAEnE;AACO,WAAA;AAAA,EACR;AAAA,EAEA,OAAc,iBAAiB,aAAkC;AAChE,UAAM,OAAO,CAAA;AACP,UAAA,MAAM,YAAY;AACxB,aAAS,MAAM,eAAe,MAAM,IAAI,aAAa;AAC9C,YAAA,OAAO,IAAI;AACjB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AAC1E,eAAO,WAAW,IAAI,OAAO,IAAI,cAAc,CAAC,KAAK,OAAO,MAAM,GAAG,KAAK,QAAS,CAAA,EAAE,KAAK,GAAG,CAAC;AAAA,MAC/F;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.cjs","sources":["../../../src/utils/assert.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\n\nexport function assert(arg: boolean, message?: string): asserts arg {\n\tif (!arg) {\n\t\tthrow new BindingError(`Assertion fail!${message ? `\\n${message}` : ''}`)\n\t}\n}\n"],"names":["BindingError"],"mappings":";;;AAEgB,SAAA,OAAO,KAAc,SAA+B;AACnE,MAAI,CAAC,KAAK;AACH,UAAA,IAAIA,aAAa,aAAA,kBAAkB,UAAU;AAAA,EAAK,
|
|
1
|
+
{"version":3,"file":"assert.cjs","sources":["../../../src/utils/assert.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\n\nexport function assert(arg: boolean, message?: string): asserts arg {\n\tif (!arg) {\n\t\tthrow new BindingError(`Assertion fail!${message ? `\\n${message}` : ''}`)\n\t}\n}\n"],"names":["BindingError"],"mappings":";;;AAEgB,SAAA,OAAO,KAAc,SAA+B;AACnE,MAAI,CAAC,KAAK;AACH,UAAA,IAAIA,aAAa,aAAA,kBAAkB,UAAU;AAAA,EAAK,OAAO,KAAK,EAAE,EAAE;AAAA,EACzE;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sources":["../../../src/utils/assert.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\n\nexport function assert(arg: boolean, message?: string): asserts arg {\n\tif (!arg) {\n\t\tthrow new BindingError(`Assertion fail!${message ? `\\n${message}` : ''}`)\n\t}\n}\n"],"names":[],"mappings":";AAEgB,SAAA,OAAO,KAAc,SAA+B;AACnE,MAAI,CAAC,KAAK;AACH,UAAA,IAAI,aAAa,kBAAkB,UAAU;AAAA,EAAK,
|
|
1
|
+
{"version":3,"file":"assert.js","sources":["../../../src/utils/assert.ts"],"sourcesContent":["import { BindingError } from '../BindingError'\n\nexport function assert(arg: boolean, message?: string): asserts arg {\n\tif (!arg) {\n\t\tthrow new BindingError(`Assertion fail!${message ? `\\n${message}` : ''}`)\n\t}\n}\n"],"names":[],"mappings":";AAEgB,SAAA,OAAO,KAAc,SAA+B;AACnE,MAAI,CAAC,KAAK;AACH,UAAA,IAAI,aAAa,kBAAkB,UAAU;AAAA,EAAK,OAAO,KAAK,EAAE,EAAE;AAAA,EACzE;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ucfirst.cjs","sources":["../../../src/utils/ucfirst.ts"],"sourcesContent":["export const ucfirst = (string: string) => `${string.charAt(0).toUpperCase()}${string.substring(1)}`\n"],"names":[],"mappings":";;AAAO,MAAM,UAAU,CAAC,WAAmB,GAAG,OAAO,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ucfirst.cjs","sources":["../../../src/utils/ucfirst.ts"],"sourcesContent":["export const ucfirst = (string: string) => `${string.charAt(0).toUpperCase()}${string.substring(1)}`\n"],"names":[],"mappings":";;AAAO,MAAM,UAAU,CAAC,WAAmB,GAAG,OAAO,OAAO,CAAC,EAAE,YAAa,CAAA,GAAG,OAAO,UAAU,CAAC,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ucfirst.js","sources":["../../../src/utils/ucfirst.ts"],"sourcesContent":["export const ucfirst = (string: string) => `${string.charAt(0).toUpperCase()}${string.substring(1)}`\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,CAAC,WAAmB,GAAG,OAAO,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ucfirst.js","sources":["../../../src/utils/ucfirst.ts"],"sourcesContent":["export const ucfirst = (string: string) => `${string.charAt(0).toUpperCase()}${string.substring(1)}`\n"],"names":[],"mappings":"AAAO,MAAM,UAAU,CAAC,WAAmB,GAAG,OAAO,OAAO,CAAC,EAAE,YAAa,CAAA,GAAG,OAAO,UAAU,CAAC,CAAC;"}
|
|
@@ -33,7 +33,7 @@ class ClientGeneratedUuid {
|
|
|
33
33
|
return this.value;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const _UnpersistedEntityDummyId = class {
|
|
36
|
+
const _UnpersistedEntityDummyId = class _UnpersistedEntityDummyId {
|
|
37
37
|
constructor() {
|
|
38
38
|
__publicField(this, "value");
|
|
39
39
|
const enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy.generateEnumerabilityPreventingEntropy(
|
|
@@ -51,13 +51,13 @@ const _UnpersistedEntityDummyId = class {
|
|
|
51
51
|
return this.value;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
__publicField(UnpersistedEntityDummyId, "getNextSeed", (() => {
|
|
54
|
+
__publicField(_UnpersistedEntityDummyId, "getNextSeed", /* @__PURE__ */ (() => {
|
|
56
55
|
let seed = 0;
|
|
57
56
|
return () => seed++;
|
|
58
57
|
})());
|
|
59
|
-
__publicField(
|
|
60
|
-
__publicField(
|
|
58
|
+
__publicField(_UnpersistedEntityDummyId, "entropyLength", 5);
|
|
59
|
+
__publicField(_UnpersistedEntityDummyId, "dummyIdRegex", new RegExp(`^adminOnlyDummyId-\\d{${_UnpersistedEntityDummyId.entropyLength}}-\\d+$`));
|
|
60
|
+
let UnpersistedEntityDummyId = _UnpersistedEntityDummyId;
|
|
61
61
|
exports.ClientGeneratedUuid = ClientGeneratedUuid;
|
|
62
62
|
exports.ServerId = ServerId;
|
|
63
63
|
exports.UnpersistedEntityDummyId = UnpersistedEntityDummyId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeId.cjs","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\nimport { EntityId } from '../treeParameters'\n\nexport type UniqueEntityId = string & { __type: 'UniqueEntityId' }\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: EntityId\n\tuniqueValue: UniqueEntityId\n}\n\nexport class ServerId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: EntityId, public readonly entityName: string) {\n\t}\n\n\tget uniqueValue() {\n\t\treturn ServerId.formatUniqueValue(this.value, this.entityName)\n\t}\n\n\tstatic formatUniqueValue(id: EntityId, entityName: string): UniqueEntityId {\n\t\treturn `${entityName}_${id}` as UniqueEntityId\n\t}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: EntityId): boolean {\n\t\treturn typeof candidate === 'string' && UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport type RuntimeId = ServerId | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":["generateEnumerabilityPreventingEntropy"],"mappings":";;;;;;;;;AAWO,MAAM,SAAkC;AAAA,EAIvC,YAA4B,OAAiC,YAAoB;AAArD,SAAA,QAAA;AAAiC,SAAA,aAAA;AAAA,EACpE;AAAA,EAJA,IAAW,iBAAuB;AAC1B,WAAA;AAAA,EACR;AAAA,EAIA,IAAI,cAAc;AACjB,WAAO,SAAS,kBAAkB,KAAK,OAAO,KAAK,UAAU;AAAA,EAC9D;AAAA,EAEA,OAAO,kBAAkB,IAAc,YAAoC;
|
|
1
|
+
{"version":3,"file":"RuntimeId.cjs","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\nimport { EntityId } from '../treeParameters'\n\nexport type UniqueEntityId = string & { __type: 'UniqueEntityId' }\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: EntityId\n\tuniqueValue: UniqueEntityId\n}\n\nexport class ServerId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: EntityId, public readonly entityName: string) {\n\t}\n\n\tget uniqueValue() {\n\t\treturn ServerId.formatUniqueValue(this.value, this.entityName)\n\t}\n\n\tstatic formatUniqueValue(id: EntityId, entityName: string): UniqueEntityId {\n\t\treturn `${entityName}_${id}` as UniqueEntityId\n\t}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: EntityId): boolean {\n\t\treturn typeof candidate === 'string' && UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport type RuntimeId = ServerId | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":["generateEnumerabilityPreventingEntropy"],"mappings":";;;;;;;;;AAWO,MAAM,SAAkC;AAAA,EAIvC,YAA4B,OAAiC,YAAoB;AAArD,SAAA,QAAA;AAAiC,SAAA,aAAA;AAAA,EACpE;AAAA,EAJA,IAAW,iBAAuB;AAC1B,WAAA;AAAA,EACR;AAAA,EAIA,IAAI,cAAc;AACjB,WAAO,SAAS,kBAAkB,KAAK,OAAO,KAAK,UAAU;AAAA,EAC9D;AAAA,EAEA,OAAO,kBAAkB,IAAc,YAAoC;AACnE,WAAA,GAAG,UAAU,IAAI,EAAE;AAAA,EAC3B;AACD;AAEO,MAAM,oBAA6C;AAAA,EAIlD,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAAA,EAHnD,IAAW,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAAA,EAGA,IAAI,cAAc;AACjB,WAAO,KAAK;AAAA,EACb;AACD;AAEO,MAAM,4BAAN,MAAM,0BAAkD;AAAA,EAWvD,cAAc;AAPL;AAQf,UAAM,iCAAiCA,uCAAA;AAAA,MACtC,0BAAyB;AAAA,IAAA;AAI1B,SAAK,QAAQ,oBAAoB,8BAA8B,IAAI,0BAAyB,YAAa,CAAA;AAAA,EAC1G;AAAA,EAjBA,IAAW,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAAA,EAmBA,OAAc,eAAe,WAA8B;AAC1D,WAAO,OAAO,cAAc,YAAY,0BAAyB,aAAa,KAAK,SAAS;AAAA,EAC7F;AAAA,EAEA,IAAI,cAAc;AACjB,WAAO,KAAK;AAAA,EACb;AACD;AAvBC,cANY,2BAMG,eAAqB,uBAAA;AACnC,MAAI,OAAO;AACX,SAAO,MAAM;AAAA;AAYd,cApBY,2BAoBG,iBAAgB;AAC/B,cArBY,2BAqBG,gBAAe,IAAI,OAAO,yBAAyB,0BAAyB,aAAa,SAAS;AArB3G,IAAM,2BAAN;;;;"}
|
|
@@ -31,7 +31,7 @@ class ClientGeneratedUuid {
|
|
|
31
31
|
return this.value;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const _UnpersistedEntityDummyId = class {
|
|
34
|
+
const _UnpersistedEntityDummyId = class _UnpersistedEntityDummyId {
|
|
35
35
|
constructor() {
|
|
36
36
|
__publicField(this, "value");
|
|
37
37
|
const enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(
|
|
@@ -49,13 +49,13 @@ const _UnpersistedEntityDummyId = class {
|
|
|
49
49
|
return this.value;
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
__publicField(UnpersistedEntityDummyId, "getNextSeed", (() => {
|
|
52
|
+
__publicField(_UnpersistedEntityDummyId, "getNextSeed", /* @__PURE__ */ (() => {
|
|
54
53
|
let seed = 0;
|
|
55
54
|
return () => seed++;
|
|
56
55
|
})());
|
|
57
|
-
__publicField(
|
|
58
|
-
__publicField(
|
|
56
|
+
__publicField(_UnpersistedEntityDummyId, "entropyLength", 5);
|
|
57
|
+
__publicField(_UnpersistedEntityDummyId, "dummyIdRegex", new RegExp(`^adminOnlyDummyId-\\d{${_UnpersistedEntityDummyId.entropyLength}}-\\d+$`));
|
|
58
|
+
let UnpersistedEntityDummyId = _UnpersistedEntityDummyId;
|
|
59
59
|
export {
|
|
60
60
|
ClientGeneratedUuid,
|
|
61
61
|
ServerId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeId.js","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\nimport { EntityId } from '../treeParameters'\n\nexport type UniqueEntityId = string & { __type: 'UniqueEntityId' }\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: EntityId\n\tuniqueValue: UniqueEntityId\n}\n\nexport class ServerId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: EntityId, public readonly entityName: string) {\n\t}\n\n\tget uniqueValue() {\n\t\treturn ServerId.formatUniqueValue(this.value, this.entityName)\n\t}\n\n\tstatic formatUniqueValue(id: EntityId, entityName: string): UniqueEntityId {\n\t\treturn `${entityName}_${id}` as UniqueEntityId\n\t}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: EntityId): boolean {\n\t\treturn typeof candidate === 'string' && UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport type RuntimeId = ServerId | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,SAAkC;AAAA,EAIvC,YAA4B,OAAiC,YAAoB;AAArD,SAAA,QAAA;AAAiC,SAAA,aAAA;AAAA,EACpE;AAAA,EAJA,IAAW,iBAAuB;AAC1B,WAAA;AAAA,EACR;AAAA,EAIA,IAAI,cAAc;AACjB,WAAO,SAAS,kBAAkB,KAAK,OAAO,KAAK,UAAU;AAAA,EAC9D;AAAA,EAEA,OAAO,kBAAkB,IAAc,YAAoC;
|
|
1
|
+
{"version":3,"file":"RuntimeId.js","sources":["../../../src/accessorTree/RuntimeId.ts"],"sourcesContent":["import { generateEnumerabilityPreventingEntropy } from '../utils'\nimport { EntityId } from '../treeParameters'\n\nexport type UniqueEntityId = string & { __type: 'UniqueEntityId' }\n\nexport interface RuntimeIdSpec {\n\texistsOnServer: boolean\n\tvalue: EntityId\n\tuniqueValue: UniqueEntityId\n}\n\nexport class ServerId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): true {\n\t\treturn true\n\t}\n\tpublic constructor(public readonly value: EntityId, public readonly entityName: string) {\n\t}\n\n\tget uniqueValue() {\n\t\treturn ServerId.formatUniqueValue(this.value, this.entityName)\n\t}\n\n\tstatic formatUniqueValue(id: EntityId, entityName: string): UniqueEntityId {\n\t\treturn `${entityName}_${id}` as UniqueEntityId\n\t}\n}\n\nexport class ClientGeneratedUuid implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic constructor(public readonly value: string) {}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport class UnpersistedEntityDummyId implements RuntimeIdSpec {\n\tpublic get existsOnServer(): false {\n\t\treturn false\n\t}\n\tpublic readonly value: string\n\n\tprivate static getNextSeed = (() => {\n\t\tlet seed = 0\n\t\treturn () => seed++\n\t})()\n\n\tpublic constructor() {\n\t\tconst enumerabilityPreventingEntropy = generateEnumerabilityPreventingEntropy(\n\t\t\tUnpersistedEntityDummyId.entropyLength,\n\t\t)\n\n\t\t// KEEP THIS IN SYNC WITH THE REGEX BELOW!!!\n\t\tthis.value = `adminOnlyDummyId-${enumerabilityPreventingEntropy}-${UnpersistedEntityDummyId.getNextSeed()}`\n\t}\n\n\tprivate static entropyLength = 5\n\tprivate static dummyIdRegex = new RegExp(`^adminOnlyDummyId-\\\\d{${UnpersistedEntityDummyId.entropyLength}}-\\\\d+$`)\n\tpublic static matchesDummyId(candidate: EntityId): boolean {\n\t\treturn typeof candidate === 'string' && UnpersistedEntityDummyId.dummyIdRegex.test(candidate)\n\t}\n\n\tget uniqueValue() {\n\t\treturn this.value as UniqueEntityId\n\t}\n}\n\nexport type RuntimeId = ServerId | ClientGeneratedUuid | UnpersistedEntityDummyId\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,SAAkC;AAAA,EAIvC,YAA4B,OAAiC,YAAoB;AAArD,SAAA,QAAA;AAAiC,SAAA,aAAA;AAAA,EACpE;AAAA,EAJA,IAAW,iBAAuB;AAC1B,WAAA;AAAA,EACR;AAAA,EAIA,IAAI,cAAc;AACjB,WAAO,SAAS,kBAAkB,KAAK,OAAO,KAAK,UAAU;AAAA,EAC9D;AAAA,EAEA,OAAO,kBAAkB,IAAc,YAAoC;AACnE,WAAA,GAAG,UAAU,IAAI,EAAE;AAAA,EAC3B;AACD;AAEO,MAAM,oBAA6C;AAAA,EAIlD,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAAA,EAHnD,IAAW,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAAA,EAGA,IAAI,cAAc;AACjB,WAAO,KAAK;AAAA,EACb;AACD;AAEO,MAAM,4BAAN,MAAM,0BAAkD;AAAA,EAWvD,cAAc;AAPL;AAQf,UAAM,iCAAiC;AAAA,MACtC,0BAAyB;AAAA,IAAA;AAI1B,SAAK,QAAQ,oBAAoB,8BAA8B,IAAI,0BAAyB,YAAa,CAAA;AAAA,EAC1G;AAAA,EAjBA,IAAW,iBAAwB;AAC3B,WAAA;AAAA,EACR;AAAA,EAmBA,OAAc,eAAe,WAA8B;AAC1D,WAAO,OAAO,cAAc,YAAY,0BAAyB,aAAa,KAAK,SAAS;AAAA,EAC7F;AAAA,EAEA,IAAI,cAAc;AACjB,WAAO,KAAK;AAAA,EACb;AACD;AAvBC,cANY,2BAMG,eAAqB,uBAAA;AACnC,MAAI,OAAO;AACX,SAAO,MAAM;AAAA;AAYd,cApBY,2BAoBG,iBAAgB;AAC/B,cArBY,2BAqBG,gBAAe,IAAI,OAAO,yBAAyB,0BAAyB,aAAa,SAAS;AArB3G,IAAM,2BAAN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityAccessor.cjs","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { EntityFieldMarkers, HasManyRelationMarker, HasOneRelationMarker, PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tHasManyRelation,\n\tHasOneRelation,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\nimport { getEntityMarker } from '../core/state'\nimport { TreeNodeUtils } from '../utils/TreeNodeUtils'\nimport { PlaceholderParametersGenerator } from '../markers/PlaceholderParametersGenerator'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly state: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {\n\t}\n\n\tpublic get idOnServer(): EntityId | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.state, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.state, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.state, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.state, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.state, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.state)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value> {\n\t\tconst entity = this.getRelativeSingleEntity(field)\n\t\tconst fieldPlaceholder = PlaceholderGenerator.getFieldPlaceholder(field.field)\n\t\tconst accessor = entity.fieldData.get(fieldPlaceholder)\n\t\tif (accessor) {\n\t\t\treturn accessor.getAccessor() as FieldAccessor<Value>\n\t\t}\n\n\t\tTreeNodeUtils.resolveColumn(entity.environment, field.field)\n\n\t\tthrow new BindingError(''\n\t\t\t+ 'EntityAccessor: cannot access field '\n\t\t\t+ `'${field.field}' on ${TreeNodeUtils.describeLocation(entity.environment)}.\\n`\n\t\t\t+ 'The cause of the error is that this relation has not been registered during the static rendering process. As a result, it lacks a required marker and accessor.',\n\t\t)\n\t}\n\n\tpublic getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\tconst fieldPlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation)\n\t\t\tconst accessor = relativeTo.fieldData.get(fieldPlaceholder)\n\t\t\tif (!accessor) {\n\t\t\t\treturn this.raiseInvalidHasOneRelationError(relativeTo, hasOneRelation)\n\t\t\t}\n\n\t\t\trelativeTo = accessor.getAccessor() as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor {\n\t\tconst entity = this.getRelativeSingleEntity(entityList)\n\t\tconst fieldPlaceholder = PlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation)\n\t\tconst accessor = entity.fieldData.get(fieldPlaceholder)\n\t\tif (!accessor) {\n\t\t\treturn this.raiseInvalidHasManyRelationError(entity, entityList.hasManyRelation)\n\t\t}\n\n\t\treturn accessor.getAccessor() as EntityListAccessor\n\t}\n\n\tprivate raiseInvalidHasOneRelationError(relativeTo: EntityAccessor, hasOneRelation: HasOneRelation): never {\n\t\tTreeNodeUtils.resolveHasOneRelation(relativeTo.environment, hasOneRelation.field, !!hasOneRelation.reducedBy)\n\n\t\tconst entityMarker = relativeTo.getMarker()\n\t\tconst possibleMarkers = this.getMarkersOfType(entityMarker.fields.markers, HasOneRelationMarker, hasOneRelation.field)\n\t\tconst markerParams = possibleMarkers.map(it => PlaceholderParametersGenerator.createHasOneRelationParameters(it.parameters))\n\n\t\tconst relationParams = PlaceholderParametersGenerator.createHasOneRelationParameters(hasOneRelation)\n\n\t\tthis.raiseUndefinedRelationError(hasOneRelation.field, relativeTo.environment, relationParams, markerParams)\n\t}\n\n\tprivate raiseInvalidHasManyRelationError(entity: EntityAccessor, hasManyRelation: HasManyRelation): never {\n\t\tTreeNodeUtils.resolveHasManyRelation(entity.environment, hasManyRelation.field)\n\n\t\tconst entityMarker = entity.getMarker()\n\t\tconst possibleMarkers = this.getMarkersOfType(entityMarker.fields.markers, HasManyRelationMarker, hasManyRelation.field)\n\t\tconst markerParams = possibleMarkers.map(it => PlaceholderParametersGenerator.createHasManyRelationParameters(it.parameters))\n\n\t\tconst relationParams = PlaceholderParametersGenerator.createHasManyRelationParameters(hasManyRelation)\n\n\t\tthis.raiseUndefinedRelationError(hasManyRelation.field, entity.environment, relationParams, markerParams)\n\t}\n\n\tprivate raiseUndefinedRelationError(field: string, environment: Environment, relationParams: any, otherMarkersParams: any[]): never {\n\t\tconst hint = this.createHintMessage(otherMarkersParams)\n\t\tthrow new BindingError(''\n\t\t\t+ `EntityAccessor: cannot access relation `\n\t\t\t+ `'${field}' on ${TreeNodeUtils.describeLocation(environment)}.\\n`\n\t\t\t+ 'The cause of the error is that this relation has not been registered during the static rendering process. As a result, it lacks a required marker and accessor.\\n\\n'\n\t\t\t+ 'Provided parameters:\\n'\n\t\t\t+ JSON.stringify(relationParams)\n\t\t\t+ hint,\n\t\t)\n\t}\n\n\tprivate createHintMessage(params: any[]): string {\n\t\tif (params.length === 0) {\n\t\t\treturn ''\n\t\t}\n\n\t\tconst serializedParams = params.map(it => JSON.stringify(it)).join('\\n')\n\t\tconst message = params.length === 1\n\t\t\t? 'However, there is existing marker for the same field, but it have different parameters:'\n\t\t\t: 'However, there are existing markers for the same field, but they have different parameters:'\n\n\t\treturn `\\n\\n${message}\\n${serializedParams}`\n\t}\n\n\tprivate getMarkersOfType<T extends { new(...args: any[]): HasManyRelationMarker | HasOneRelationMarker }>(\n\t\tmarkers: EntityFieldMarkers,\n\t\tmarkerConstructor: T,\n\t\tfieldName: string,\n\t): InstanceType<T>[] {\n\t\treturn Array.from(markers.values())\n\t\t\t.filter((it): it is InstanceType<T> => (it instanceof markerConstructor) && it.parameters.field === fieldName)\n\t}\n\n\tpublic getParent(): EntityAccessor | EntityListAccessor | undefined {\n\t\tconst blueprint = this.state.blueprint\n\t\tif (blueprint.type === 'subTree') {\n\t\t\treturn undefined\n\t\t}\n\t\treturn blueprint.parent.getAccessor()\n\t}\n\n\tpublic getMarker() {\n\t\treturn getEntityMarker(this.state)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor<any>\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListenerMap\n}\n\nexport { EntityAccessor }\n"],"names":["ErrorAccessor","QueryLanguage","PlaceholderGenerator","TreeNodeUtils","BindingError","HasOneRelationMarker","PlaceholderParametersGenerator","HasManyRelationMarker","getEntityMarker"],"mappings":";;;;;;;;;;;AAkCA,MAAM,eAAoC;AAAA,EAClC,YACW,OACA,YACA,WACD,KACA,MACC,WACA,gBACD,uBACA,QACA,aACA,aACf;AAXgB,SAAA,QAAA;AACA,SAAA,aAAA;AACA,SAAA,YAAA;AACD,SAAA,MAAA;AACA,SAAA,OAAA;AACC,SAAA,YAAA;AACA,SAAA,iBAAA;AACD,SAAA,wBAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AACA,SAAA,cAAA;AAAA,EAEjB;AAAA,EAEA,IAAW,aAAmC;AAC7C,WAAO,KAAK,UAAU,iBAAiB,KAAK,UAAU,QAAQ;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA,EAKA,IAAW,KAAe;AACzB,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,EAEA,IAAW,iBAA0B;AACpC,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA;AAAA,EAIO,SAAS,OAAiD;AACzD,WAAA,KAAK,WAAW,SAAS,KAAK,OAAOA,4BAAc,eAAe,KAAK,CAAC;AAAA,EAChF;AAAA,EAEO,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,OAAO,OAAO,QAAQ;AAAA,EACpE;AAAA,EAEO,aAAa,gBAA0D;AAC7E,SAAK,WAAW,aAAa,KAAK,OAAO,cAAc;AAAA,EACxD;AAAA,EAEO,qBAAqB,OAAkB,iBAAuC;AACpF,SAAK,WAAW,qBAAqB,KAAK,OAAO,OAAO,eAAe;AAAA,EACxE;AAAA,EAEO,wBAAwB,OAAkB,uBAAkE;AAClH,SAAK,WAAW,wBAAwB,KAAK,OAAO,OAAO,qBAAqB;AAAA,EACjF;AAAA,EAEO,eAAqB;AACtB,SAAA,WAAW,aAAa,KAAK,KAAK;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A4B,OAAe,aAA0B,gBAAqB,oBAAkC;AAC7H,UAAA,OAAO,KAAK,kBAAkB,kBAAkB;AACtD,UAAM,IAAIF,aAAA;AAAA,MAAa,2CAEhB,aAAaD,cAAAA,cAAc,iBAAiB,WAAW;AAAA;AAAA;AAAA;AAAA,IAG3D,KAAK,UAAU,cAAc,IAC7B;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEQ,kBAAkB,QAAuB;AAC5C,QAAA,OAAO,WAAW,GAAG;AACjB,aAAA;AAAA,IACR;AAEM,UAAA,mBAAmB,OAAO,IAAI,CAAM,OAAA,KAAK,UAAU,EAAE,CAAC,EAAE,KAAK,IAAI;AACvE,UAAM,UAAU,OAAO,WAAW,IAC/B,4FACA;AAEI,WAAA;AAAA;AAAA,EAAO;AAAA,EAAY;AAAA,EAC3B;AAAA,EAEQ,iBACP,SACA,mBACA,WACoB;AACpB,WAAO,MAAM,KAAK,QAAQ,OAAQ,CAAA,EAChC,OAAO,CAAC,OAA+B,cAAc,qBAAsB,GAAG,WAAW,UAAU,SAAS;AAAA,EAC/G;AAAA,EAEO,YAA6D;AAC7D,UAAA,YAAY,KAAK,MAAM;AACzB,QAAA,UAAU,SAAS,WAAW;AAC1B,aAAA;AAAA,IACR;AACO,WAAA,UAAU,OAAO;EACzB;AAAA,EAEO,YAAY;AACX,WAAAK,gBAAA,gBAAgB,KAAK,KAAK;AAAA,EAClC;AACD;;"}
|
|
1
|
+
{"version":3,"file":"EntityAccessor.cjs","sources":["../../../src/accessors/EntityAccessor.ts"],"sourcesContent":["import { RuntimeId, SingleEntityPersistedData } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport type { EntityOperations } from '../core/operations'\nimport type { Environment } from '../dao'\nimport { EntityFieldMarkers, HasManyRelationMarker, HasOneRelationMarker, PlaceholderGenerator } from '../markers'\nimport { QueryLanguage } from '../queryLanguage'\nimport type {\n\tEntityId,\n\tEntityName,\n\tEntityRealmKey,\n\tFieldName,\n\tFieldValue,\n\tHasManyRelation,\n\tHasOneRelation,\n\tRelativeEntityList,\n\tRelativeSingleEntity,\n\tRelativeSingleField,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n} from '../treeParameters'\nimport type { AsyncBatchUpdatesOptions } from './AsyncBatchUpdatesOptions'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport { EntityListAccessor } from './EntityListAccessor'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldAccessor } from './FieldAccessor'\nimport type { PersistErrorOptions } from './PersistErrorOptions'\nimport type { PersistSuccessOptions } from './PersistSuccessOptions'\nimport type { EntityRealmState } from '../core/state'\nimport { getEntityMarker } from '../core/state'\nimport { TreeNodeUtils } from '../utils/TreeNodeUtils'\nimport { PlaceholderParametersGenerator } from '../markers/PlaceholderParametersGenerator'\n\nclass EntityAccessor implements Errorable {\n\tpublic constructor(\n\t\tprivate readonly state: EntityRealmState,\n\t\tprivate readonly operations: EntityOperations,\n\t\tprivate readonly runtimeId: RuntimeId,\n\t\tpublic readonly key: EntityRealmKey, // ⚠️ This is *NOT* the id! ⚠️\n\t\tpublic readonly name: EntityName,\n\t\tprivate readonly fieldData: EntityAccessor.FieldData,\n\t\tprivate readonly dataFromServer: SingleEntityPersistedData | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly environment: Environment,\n\t\tpublic readonly getAccessor: EntityAccessor.GetEntityAccessor,\n\t) {\n\t}\n\n\tpublic get idOnServer(): EntityId | undefined {\n\t\treturn this.runtimeId.existsOnServer ? this.runtimeId.value : undefined\n\t}\n\n\t/**\n\t * Note that for entities that don't yet exist on server this will return a dummy id.\n\t */\n\tpublic get id(): EntityId {\n\t\treturn this.runtimeId.value\n\t}\n\n\tpublic get existsOnServer(): boolean {\n\t\treturn this.runtimeId.existsOnServer\n\t}\n\n\t//\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.state, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityAccessor.RuntimeEntityEventListenerMap>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.state, event, listener)\n\t}\n\n\tpublic batchUpdates(performUpdates: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.batchUpdates(this.state, performUpdates)\n\t}\n\n\tpublic connectEntityAtField(field: FieldName, entityToConnect: EntityAccessor): void {\n\t\tthis.operations.connectEntityAtField(this.state, field, entityToConnect)\n\t}\n\n\tpublic disconnectEntityAtField(field: FieldName, initializeReplacement?: EntityAccessor.BatchUpdatesHandler): void {\n\t\tthis.operations.disconnectEntityAtField(this.state, field, initializeReplacement)\n\t}\n\n\tpublic deleteEntity(): void {\n\t\tthis.operations.deleteEntity(this.state)\n\t}\n\n\t//\n\n\tpublic updateValues(fieldValuePairs: EntityAccessor.FieldValuePairs): void {\n\t\tthis.batchUpdates(getAccessor => {\n\t\t\tconst entries = Array.isArray(fieldValuePairs) ? fieldValuePairs : Object.entries(fieldValuePairs)\n\n\t\t\tfor (const [field, value] of entries) {\n\t\t\t\tgetAccessor().getField(field).updateValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Please keep in mind that this method signature is literally impossible to implement safely. The generic parameter\n\t * is really just a way to succinctly write a type cast. Nothing more, really.\n\t */\n\tpublic getField<Value extends FieldValue = FieldValue>(\n\t\tfield: SugaredRelativeSingleField | string,\n\t): FieldAccessor<Value> {\n\t\treturn this.getRelativeSingleField<Value>(QueryLanguage.desugarRelativeSingleField(field, this.environment))\n\t}\n\n\tpublic getEntity(entity: SugaredRelativeSingleEntity | string): EntityAccessor {\n\t\treturn this.getRelativeSingleEntity(QueryLanguage.desugarRelativeSingleEntity(entity, this.environment))\n\t}\n\n\tpublic getEntityList(entityList: SugaredRelativeEntityList | string): EntityListAccessor {\n\t\treturn this.getRelativeEntityList(QueryLanguage.desugarRelativeEntityList(entityList, this.environment))\n\t}\n\n\t//\n\n\t/**\n\t * @see EntityAccessor.getField\n\t */\n\tpublic getRelativeSingleField<Value extends FieldValue = FieldValue>(field: RelativeSingleField): FieldAccessor<Value> {\n\t\tconst entity = this.getRelativeSingleEntity(field)\n\t\tconst fieldPlaceholder = PlaceholderGenerator.getFieldPlaceholder(field.field)\n\t\tconst accessor = entity.fieldData.get(fieldPlaceholder)\n\t\tif (accessor) {\n\t\t\treturn accessor.getAccessor() as FieldAccessor<Value>\n\t\t}\n\n\t\tTreeNodeUtils.resolveColumn(entity.environment, field.field)\n\n\t\tthrow new BindingError(''\n\t\t\t+ 'EntityAccessor: cannot access field '\n\t\t\t+ `'${field.field}' on ${TreeNodeUtils.describeLocation(entity.environment)}.\\n`\n\t\t\t+ 'The cause of the error is that this relation has not been registered during the static rendering process. As a result, it lacks a required marker and accessor.',\n\t\t)\n\t}\n\n\tpublic getRelativeSingleEntity(relativeSingleEntity: RelativeSingleEntity): EntityAccessor {\n\t\tlet relativeTo: EntityAccessor = this\n\n\t\tfor (const hasOneRelation of relativeSingleEntity.hasOneRelationPath) {\n\t\t\tconst fieldPlaceholder = PlaceholderGenerator.getHasOneRelationPlaceholder(hasOneRelation)\n\t\t\tconst accessor = relativeTo.fieldData.get(fieldPlaceholder)\n\t\t\tif (!accessor) {\n\t\t\t\treturn this.raiseInvalidHasOneRelationError(relativeTo, hasOneRelation)\n\t\t\t}\n\n\t\t\trelativeTo = accessor.getAccessor() as EntityAccessor\n\t\t}\n\t\treturn relativeTo\n\t}\n\n\tpublic getRelativeEntityList(entityList: RelativeEntityList): EntityListAccessor {\n\t\tconst entity = this.getRelativeSingleEntity(entityList)\n\t\tconst fieldPlaceholder = PlaceholderGenerator.getHasManyRelationPlaceholder(entityList.hasManyRelation)\n\t\tconst accessor = entity.fieldData.get(fieldPlaceholder)\n\t\tif (!accessor) {\n\t\t\treturn this.raiseInvalidHasManyRelationError(entity, entityList.hasManyRelation)\n\t\t}\n\n\t\treturn accessor.getAccessor() as EntityListAccessor\n\t}\n\n\tprivate raiseInvalidHasOneRelationError(relativeTo: EntityAccessor, hasOneRelation: HasOneRelation): never {\n\t\tTreeNodeUtils.resolveHasOneRelation(relativeTo.environment, hasOneRelation.field, !!hasOneRelation.reducedBy)\n\n\t\tconst entityMarker = relativeTo.getMarker()\n\t\tconst possibleMarkers = this.getMarkersOfType(entityMarker.fields.markers, HasOneRelationMarker, hasOneRelation.field)\n\t\tconst markerParams = possibleMarkers.map(it => PlaceholderParametersGenerator.createHasOneRelationParameters(it.parameters))\n\n\t\tconst relationParams = PlaceholderParametersGenerator.createHasOneRelationParameters(hasOneRelation)\n\n\t\tthis.raiseUndefinedRelationError(hasOneRelation.field, relativeTo.environment, relationParams, markerParams)\n\t}\n\n\tprivate raiseInvalidHasManyRelationError(entity: EntityAccessor, hasManyRelation: HasManyRelation): never {\n\t\tTreeNodeUtils.resolveHasManyRelation(entity.environment, hasManyRelation.field)\n\n\t\tconst entityMarker = entity.getMarker()\n\t\tconst possibleMarkers = this.getMarkersOfType(entityMarker.fields.markers, HasManyRelationMarker, hasManyRelation.field)\n\t\tconst markerParams = possibleMarkers.map(it => PlaceholderParametersGenerator.createHasManyRelationParameters(it.parameters))\n\n\t\tconst relationParams = PlaceholderParametersGenerator.createHasManyRelationParameters(hasManyRelation)\n\n\t\tthis.raiseUndefinedRelationError(hasManyRelation.field, entity.environment, relationParams, markerParams)\n\t}\n\n\tprivate raiseUndefinedRelationError(field: string, environment: Environment, relationParams: any, otherMarkersParams: any[]): never {\n\t\tconst hint = this.createHintMessage(otherMarkersParams)\n\t\tthrow new BindingError(''\n\t\t\t+ `EntityAccessor: cannot access relation `\n\t\t\t+ `'${field}' on ${TreeNodeUtils.describeLocation(environment)}.\\n`\n\t\t\t+ 'The cause of the error is that this relation has not been registered during the static rendering process. As a result, it lacks a required marker and accessor.\\n\\n'\n\t\t\t+ 'Provided parameters:\\n'\n\t\t\t+ JSON.stringify(relationParams)\n\t\t\t+ hint,\n\t\t)\n\t}\n\n\tprivate createHintMessage(params: any[]): string {\n\t\tif (params.length === 0) {\n\t\t\treturn ''\n\t\t}\n\n\t\tconst serializedParams = params.map(it => JSON.stringify(it)).join('\\n')\n\t\tconst message = params.length === 1\n\t\t\t? 'However, there is existing marker for the same field, but it have different parameters:'\n\t\t\t: 'However, there are existing markers for the same field, but they have different parameters:'\n\n\t\treturn `\\n\\n${message}\\n${serializedParams}`\n\t}\n\n\tprivate getMarkersOfType<T extends { new(...args: any[]): HasManyRelationMarker | HasOneRelationMarker }>(\n\t\tmarkers: EntityFieldMarkers,\n\t\tmarkerConstructor: T,\n\t\tfieldName: string,\n\t): InstanceType<T>[] {\n\t\treturn Array.from(markers.values())\n\t\t\t.filter((it): it is InstanceType<T> => (it instanceof markerConstructor) && it.parameters.field === fieldName)\n\t}\n\n\tpublic getParent(): EntityAccessor | EntityListAccessor | undefined {\n\t\tconst blueprint = this.state.blueprint\n\t\tif (blueprint.type === 'subTree') {\n\t\t\treturn undefined\n\t\t}\n\t\treturn blueprint.parent.getAccessor()\n\t}\n\n\tpublic getMarker() {\n\t\treturn getEntityMarker(this.state)\n\t}\n}\n\nnamespace EntityAccessor {\n\texport interface FieldDatum {\n\t\tgetAccessor(): NestedAccessor\n\t}\n\texport type NestedAccessor = EntityAccessor | EntityListAccessor | FieldAccessor<any>\n\n\texport type FieldValuePairs =\n\t\t| {\n\t\t\t\t[field: string]: FieldValue\n\t\t }\n\t\t| Iterable<[SugaredRelativeSingleField | string, FieldValue]>\n\n\texport type FieldData = Map<FieldName, FieldDatum>\n\n\texport type GetEntityAccessor = () => EntityAccessor\n\texport type BatchUpdatesHandler = (getAccessor: GetEntityAccessor, options: BatchUpdatesOptions) => void\n\texport type UpdateListener = (accessor: EntityAccessor) => void\n\n\texport type BeforePersistHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: AsyncBatchUpdatesOptions,\n\t) => void | BeforePersistHandler | Promise<void | BeforePersistHandler>\n\n\texport type PersistErrorHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistErrorOptions,\n\t) => void | Promise<void>\n\n\texport type PersistSuccessHandler = (\n\t\tgetAccessor: GetEntityAccessor,\n\t\toptions: PersistSuccessOptions,\n\t) => void | PersistSuccessHandler | Promise<void | PersistSuccessHandler>\n\n\texport interface RuntimeEntityEventListenerMap {\n\t\tbeforePersist: BeforePersistHandler\n\t\tbeforeUpdate: BatchUpdatesHandler\n\t\tconnectionUpdate: UpdateListener\n\t\tpersistError: PersistErrorHandler\n\t\tpersistSuccess: PersistSuccessHandler\n\t\tupdate: UpdateListener\n\t}\n\texport interface EntityEventListenerMap extends RuntimeEntityEventListenerMap {\n\t\tinitialize: BatchUpdatesHandler\n\t}\n\texport type EntityEventType = keyof EntityEventListenerMap\n}\n\nexport { EntityAccessor }\n"],"names":["ErrorAccessor","QueryLanguage","PlaceholderGenerator","TreeNodeUtils","BindingError","HasOneRelationMarker","PlaceholderParametersGenerator","HasManyRelationMarker","getEntityMarker"],"mappings":";;;;;;;;;;;AAkCA,MAAM,eAAoC;AAAA,EAClC,YACW,OACA,YACA,WACD,KACA,MACC,WACA,gBACD,uBACA,QACA,aACA,aACf;AAXgB,SAAA,QAAA;AACA,SAAA,aAAA;AACA,SAAA,YAAA;AACD,SAAA,MAAA;AACA,SAAA,OAAA;AACC,SAAA,YAAA;AACA,SAAA,iBAAA;AACD,SAAA,wBAAA;AACA,SAAA,SAAA;AACA,SAAA,cAAA;AACA,SAAA,cAAA;AAAA,EAEjB;AAAA,EAEA,IAAW,aAAmC;AAC7C,WAAO,KAAK,UAAU,iBAAiB,KAAK,UAAU,QAAQ;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA,EAKA,IAAW,KAAe;AACzB,WAAO,KAAK,UAAU;AAAA,EACvB;AAAA,EAEA,IAAW,iBAA0B;AACpC,WAAO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