From de05d827a2ff5425999f3c193a0ad08006afa74b Mon Sep 17 00:00:00 2001 From: Miroir Framework Date: Mon, 12 Aug 2024 23:00:33 +0200 Subject: [PATCH] create basic elements for Miroir Action Script (MAS), migrate Tools.submit to MAS #28. Allow the "runQuery" queryAction to use "domainModelSingleExtractor" queries, and allow such actions in handleQuery (DomainController, QuerySelectors, IndexedDbExtractorRunner). --- .../getMiroirFundamentalJzodSchema.ts | 51 ++- .../miroirFundamentalJzodSchema.ts | 349 ++++++++++++++++-- .../miroirFundamentalType.ts | 68 ++-- .../src/2_domain/DomainStateQuerySelectors.ts | 5 +- .../src/2_domain/QuerySelectors.ts | 3 +- .../src/3_controllers/DomainController.ts | 8 + .../miroir-core/src/4_services/RestServer.ts | 30 +- .../0faae143-0d7b-4a8a-a950-4fc3df943bde.json | 25 +- .../359f1f9b-7260-4d76-a864-72c839b9711b.json | 12 +- packages/miroir-core/src/index.ts | 2 + .../DomainStateMemoizedSelectors.ts | 1 + .../PersistenceStoreExtractorRunner.test.tsx | 124 +++---- .../4_services/IndexedDbExtractorRunner.ts | 59 +-- 13 files changed, 557 insertions(+), 180 deletions(-) diff --git a/packages/miroir-core/src/0_interfaces/1_core/bootstrapJzodSchemas/getMiroirFundamentalJzodSchema.ts b/packages/miroir-core/src/0_interfaces/1_core/bootstrapJzodSchemas/getMiroirFundamentalJzodSchema.ts index 955421a9..7f444efc 100644 --- a/packages/miroir-core/src/0_interfaces/1_core/bootstrapJzodSchemas/getMiroirFundamentalJzodSchema.ts +++ b/packages/miroir-core/src/0_interfaces/1_core/bootstrapJzodSchemas/getMiroirFundamentalJzodSchema.ts @@ -1486,6 +1486,26 @@ export function getMiroirFundamentalJzodSchema( }, }, }, + domainModelSingleExtractor: { + type: "union", + discriminator: "queryType", + definition: [ + { + type: "schemaReference", + definition: { + absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + relativePath: "extractorForSingleObject", + }, + }, + { + type: "schemaReference", + definition: { + absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + relativePath: "extractorForSingleObjectList", + }, + }, + ] + }, extractorForRecordOfExtractors: { type: "object", extend: { @@ -1642,16 +1662,23 @@ export function getMiroirFundamentalJzodSchema( type: "schemaReference", definition: { absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - relativePath: "extractorForSingleObject", - }, - }, - { - type: "schemaReference", - definition: { - absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - relativePath: "extractorForSingleObjectList", + relativePath: "domainModelSingleExtractor", }, }, + // { + // type: "schemaReference", + // definition: { + // absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + // relativePath: "extractorForSingleObject", + // }, + // }, + // { + // type: "schemaReference", + // definition: { + // absolutePath: "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + // relativePath: "extractorForSingleObjectList", + // }, + // }, { type: "schemaReference", definition: { @@ -2259,13 +2286,17 @@ export function getMiroirFundamentalJzodSchema( .querySelectObjectByRelation, extractObjectByDirectReference: (miroirFundamentalJzodSchema as any).definition.context .extractObjectByDirectReference, - querySelectExtractorObject: (miroirFundamentalJzodSchema as any).definition.context.querySelectExtractorObject, - querySelectExtractorList: (miroirFundamentalJzodSchema as any).definition.context.querySelectExtractorList, + querySelectExtractorWrapperReturningObject: (miroirFundamentalJzodSchema as any).definition.context.querySelectExtractorWrapperReturningObject, + querySelectExtractorWrapperReturningList: (miroirFundamentalJzodSchema as any).definition.context.querySelectExtractorWrapperReturningList, querySelectExtractor: (miroirFundamentalJzodSchema as any).definition.context.querySelectExtractor, querySelectObject: (miroirFundamentalJzodSchema as any).definition.context.querySelectObject, + querySelectObjectList: (miroirFundamentalJzodSchema as any).definition.context.querySelectObjectList, querySelectByQueryCombiner: (miroirFundamentalJzodSchema as any).definition.context.querySelectByQueryCombiner, querySelect: (miroirFundamentalJzodSchema as any).definition.context.querySelect, miroirSelectQueriesRecord: (miroirFundamentalJzodSchema as any).definition.context.miroirSelectQueriesRecord, + extractorForSingleObject: (miroirFundamentalJzodSchema as any).definition.context.extractorForSingleObject, + extractorForSingleObjectList: (miroirFundamentalJzodSchema as any).definition.context.extractorForSingleObjectList, + domainModelSingleExtractor: (miroirFundamentalJzodSchema as any).definition.context.domainModelSingleExtractor, extractorForRecordOfExtractors: (miroirFundamentalJzodSchema as any).definition.context.extractorForRecordOfExtractors, queryAction: queryEndpointVersionV1.definition.actions[0].actionParameters, }, diff --git a/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalJzodSchema.ts b/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalJzodSchema.ts index 1d5758c6..1d1c93e6 100644 --- a/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalJzodSchema.ts +++ b/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalJzodSchema.ts @@ -4444,7 +4444,7 @@ export const miroirFundamentalJzodSchema = { } } }, - "querySelectExtractorObject": { + "querySelectExtractorWrapperReturningObject": { "type": "union", "discriminator": "queryType", "definition": [ @@ -4468,7 +4468,7 @@ export const miroirFundamentalJzodSchema = { "definition": { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorObject", + "relativePath": "querySelectExtractorWrapperReturningObject", "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739" }, "context": {} @@ -4478,7 +4478,7 @@ export const miroirFundamentalJzodSchema = { } ] }, - "querySelectExtractorList": { + "querySelectExtractorWrapperReturningList": { "type": "union", "discriminator": "queryType", "definition": [ @@ -4502,7 +4502,7 @@ export const miroirFundamentalJzodSchema = { "definition": { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorList", + "relativePath": "querySelectExtractorWrapperReturningList", "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739" }, "context": {} @@ -4519,7 +4519,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorObject", + "relativePath": "querySelectExtractorWrapperReturningObject", "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739" }, "context": {} @@ -4527,7 +4527,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorList", + "relativePath": "querySelectExtractorWrapperReturningList", "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739" }, "context": {} @@ -5214,6 +5214,26 @@ export const miroirFundamentalJzodSchema = { } } }, + "domainModelSingleExtractor": { + "type": "union", + "discriminator": "queryType", + "definition": [ + { + "type": "schemaReference", + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "extractorForSingleObject" + } + }, + { + "type": "schemaReference", + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "extractorForSingleObjectList" + } + } + ] + }, "extractorForRecordOfExtractors": { "type": "object", "extend": { @@ -5370,14 +5390,7 @@ export const miroirFundamentalJzodSchema = { "type": "schemaReference", "definition": { "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - "relativePath": "extractorForSingleObject" - } - }, - { - "type": "schemaReference", - "definition": { - "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - "relativePath": "extractorForSingleObjectList" + "relativePath": "domainModelSingleExtractor" } }, { @@ -7643,12 +7656,25 @@ export const miroirFundamentalJzodSchema = { } }, "query": { - "type": "schemaReference", - "optional": false, - "definition": { - "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - "relativePath": "extractorForRecordOfExtractors" - } + "type": "union", + "definition": [ + { + "type": "schemaReference", + "optional": false, + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "domainModelSingleExtractor" + } + }, + { + "type": "schemaReference", + "optional": false, + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "extractorForRecordOfExtractors" + } + } + ] } } }, @@ -24381,7 +24407,7 @@ export const miroirFundamentalJzodSchema = { } ] }, - "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject": { + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject": { "type": "union", "discriminator": "queryType", "definition": [ @@ -24432,7 +24458,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject" + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject" }, "context": {} }, @@ -24463,7 +24489,7 @@ export const miroirFundamentalJzodSchema = { } ] }, - "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList": { + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList": { "type": "union", "discriminator": "queryType", "definition": [ @@ -24514,7 +24540,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList" + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList" }, "context": {} }, @@ -24555,7 +24581,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject" + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject" }, "context": {} }, @@ -24573,7 +24599,7 @@ export const miroirFundamentalJzodSchema = { { "type": "schemaReference", "definition": { - "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList" + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList" }, "context": {} }, @@ -24641,6 +24667,72 @@ export const miroirFundamentalJzodSchema = { } ] }, + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList": { + "type": "union", + "discriminator": "queryType", + "definition": [ + { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByRelation" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByManyToManyRelation" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectByQueryCombiner": { "type": "union", "definition": [ @@ -25103,6 +25195,168 @@ export const miroirFundamentalJzodSchema = { } ] }, + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject": { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + }, + { + "type": "object", + "extend": { + "type": "schemaReference", + "definition": { + "eager": true, + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelRootExtractor_extend" + }, + "context": {} + }, + "definition": { + "queryType": { + "type": "union", + "definition": [ + { + "type": "literal", + "definition": "domainModelSingleExtractor" + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + "select": { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObject" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + } + } + } + ] + }, + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList": { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + }, + { + "type": "object", + "extend": { + "type": "schemaReference", + "definition": { + "eager": true, + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelRootExtractor_extend" + }, + "context": {} + }, + "definition": { + "queryType": { + "type": "union", + "definition": [ + { + "type": "literal", + "definition": "domainModelSingleExtractor" + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + "select": { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + } + } + } + ] + }, + "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor": { + "type": "union", + "discriminator": "queryType", + "definition": [ + { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "type": "union", + "definition": [ + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors": { "type": "union", "definition": [ @@ -25282,16 +25536,47 @@ export const miroirFundamentalJzodSchema = { ] }, "query": { - "optional": false, "type": "union", "definition": [ { - "type": "schemaReference", "optional": false, - "definition": { - "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors" - }, - "context": {} + "type": "union", + "definition": [ + { + "type": "schemaReference", + "optional": false, + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] + }, + { + "optional": false, + "type": "union", + "definition": [ + { + "type": "schemaReference", + "optional": false, + "definition": { + "relativePath": "carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors" + }, + "context": {} + }, + { + "type": "schemaReference", + "definition": { + "relativePath": "carryOnObject" + } + } + ] }, { "type": "schemaReference", diff --git a/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.ts b/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.ts index f70d6bf7..269b0e5c 100644 --- a/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.ts +++ b/packages/miroir-core/src/0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.ts @@ -906,17 +906,17 @@ export type QuerySelectByQueryCombiner = { rootQueryObjectTransformer: RecordOfTransformers; }; }; -export type QuerySelectExtractorObject = ExtractObjectByDirectReference | { +export type QuerySelectExtractorWrapperReturningObject = ExtractObjectByDirectReference | { queryType: "extractorWrapperReturningObject"; definition: { - [x: string]: QuerySelectExtractorObject; + [x: string]: QuerySelectExtractorWrapperReturningObject; }; }; -export type QuerySelectExtractorList = ExtractObjectListByEntity | { +export type QuerySelectExtractorWrapperReturningList = ExtractObjectListByEntity | { queryType: "extractorWrapperReturningList"; - definition: QuerySelectExtractorList[]; + definition: QuerySelectExtractorWrapperReturningList[]; }; -export type QuerySelectExtractor = QuerySelectExtractorObject | QuerySelectExtractorList; +export type QuerySelectExtractor = QuerySelectExtractorWrapperReturningObject | QuerySelectExtractorWrapperReturningList; export type QuerySelect = QuerySelectExtractor | { queryType: "extractorTransformer"; referencedQuery: QueryTemplateContextReference; @@ -1033,6 +1033,7 @@ export type ExtractorForSingleObjectList = { queryType: "domainModelSingleExtractor"; select: QuerySelectObjectList; }; +export type DomainModelSingleExtractor = ExtractorForSingleObject | ExtractorForSingleObjectList; export type ExtractorForRecordOfExtractors = { deploymentUuid: string; pageParams: DomainElementObject; @@ -1069,7 +1070,7 @@ export type DomainModelGetSingleSelectQueryJzodSchemaExtractor = { select: QuerySelect; }; export type DomainModelQueryJzodSchemaParams = DomainModelGetEntityDefinitionExtractor | DomainModelGetFetchParamJzodSchemaExtractor | DomainModelGetSingleSelectQueryJzodSchemaExtractor; -export type DomainModelExtractor = ExtractorForSingleObject | ExtractorForSingleObjectList | ExtractorForRecordOfExtractors | LocalCacheExtractor | DomainModelGetEntityDefinitionExtractor | DomainModelGetFetchParamJzodSchemaExtractor | DomainModelGetSingleSelectQueryJzodSchemaExtractor; +export type DomainModelExtractor = DomainModelSingleExtractor | ExtractorForRecordOfExtractors | LocalCacheExtractor | DomainModelGetEntityDefinitionExtractor | DomainModelGetFetchParamJzodSchemaExtractor | DomainModelGetSingleSelectQueryJzodSchemaExtractor; export type ______________________________________________actions_____________________________________________ = never; export type ActionError = { status: "error"; @@ -1433,7 +1434,7 @@ export type QueryAction = { actionName: "runQuery"; endpoint: "9e404b3c-368c-40cb-be8b-e3c28550c25e"; deploymentUuid: string; - query: ExtractorForRecordOfExtractors; + query: DomainModelSingleExtractor | ExtractorForRecordOfExtractors; }; export type CompositeAction = { actionType: "compositeAction"; @@ -2649,18 +2650,19 @@ export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectRe queryType: "selectObjectByDirectReference" | CarryOnObject; instanceUuid: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference | CarryOnObject; }; -export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference | CarryOnObject) | { +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference | CarryOnObject) | { queryType: "extractorWrapperReturningObject" | CarryOnObject; definition: { - [x: string]: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject | CarryOnObject; + [x: string]: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject | CarryOnObject; } | CarryOnObject; } | CarryOnObject; -export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity | CarryOnObject) | { +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity | CarryOnObject) | { queryType: "extractorWrapperReturningList" | CarryOnObject; - definition: (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList | CarryOnObject)[] | CarryOnObject; + definition: (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList | CarryOnObject)[] | CarryOnObject; } | CarryOnObject; -export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList | CarryOnObject) | CarryOnObject; +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList | CarryOnObject) | CarryOnObject; export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObject = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectByRelation | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference | CarryOnObject) | CarryOnObject; +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByRelation | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByManyToManyRelation | CarryOnObject) | CarryOnObject; export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectByQueryCombiner = CarryOnObject | { queryType: "queryCombiner" | CarryOnObject; rootQuery: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect | CarryOnObject; @@ -2691,6 +2693,23 @@ export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect = (CarryOn_ export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_miroirSelectQueriesRecord = { [x: string]: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect | CarryOnObject; } | CarryOnObject; +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject = CarryOnObject | { + deploymentUuid: string | CarryOnObject; + pageParams: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject | CarryOnObject; + queryParams: DomainElementObject | CarryOnObject; + contextResults: DomainElementObject | CarryOnObject; + queryType: "domainModelSingleExtractor" | CarryOnObject; + select: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObject | CarryOnObject; +}; +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList = CarryOnObject | { + deploymentUuid: string | CarryOnObject; + pageParams: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject | CarryOnObject; + queryParams: DomainElementObject | CarryOnObject; + contextResults: DomainElementObject | CarryOnObject; + queryType: "domainModelSingleExtractor" | CarryOnObject; + select: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList | CarryOnObject; +}; +export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor = (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList | CarryOnObject) | CarryOnObject; export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors = CarryOnObject | { deploymentUuid: string | CarryOnObject; pageParams: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject | CarryOnObject; @@ -2707,7 +2726,7 @@ export type CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryAction = CarryOnOb actionName: "runQuery" | CarryOnObject; endpoint: "9e404b3c-368c-40cb-be8b-e3c28550c25e" | CarryOnObject; deploymentUuid: string | CarryOnObject; - query: CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors | CarryOnObject; + query: (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor | CarryOnObject) | (CarryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors | CarryOnObject) | CarryOnObject; }; export type CompositeInstanceActionTemplate = { actionType: "compositeInstanceAction"; @@ -2833,9 +2852,9 @@ export const querySelectObjectListByRelation: z.ZodType = z.object({label:z.string().optional(), applicationSection:z.lazy(() =>applicationSection).optional(), parentName:z.string().optional(), parentUuid:z.lazy(() =>queryTemplateConstantOrAnyReference)}).strict().extend({queryType:z.literal("selectObjectListByManyToManyRelation"), objectListReference:z.lazy(() =>queryTemplateConstantOrAnyReference), objectListReferenceAttribute:z.string().optional(), AttributeOfRootListObjectToCompareToListReferenceUuid:z.string().optional()}).strict(); export const querySelectObjectList: z.ZodType = z.union([z.lazy(() =>extractObjectListByEntity), z.lazy(() =>querySelectObjectListByRelation), z.lazy(() =>querySelectObjectListByManyToManyRelation)]); export const querySelectByQueryCombiner: z.ZodType = z.object({queryType:z.literal("queryCombiner"), rootQuery:z.lazy(() =>querySelect), subQuery:z.object({query:z.lazy(() =>querySelect), rootQueryObjectTransformer:z.lazy(() =>recordOfTransformers)}).strict()}).strict(); -export const querySelectExtractorObject: z.ZodType = z.union([z.lazy(() =>extractObjectByDirectReference), z.object({queryType:z.literal("extractorWrapperReturningObject"), definition:z.record(z.string(),z.lazy(() =>querySelectExtractorObject))}).strict()]); -export const querySelectExtractorList: z.ZodType = z.union([z.lazy(() =>extractObjectListByEntity), z.object({queryType:z.literal("extractorWrapperReturningList"), definition:z.array(z.lazy(() =>querySelectExtractorList))}).strict()]); -export const querySelectExtractor: z.ZodType = z.union([z.lazy(() =>querySelectExtractorObject), z.lazy(() =>querySelectExtractorList)]); +export const querySelectExtractorWrapperReturningObject: z.ZodType = z.union([z.lazy(() =>extractObjectByDirectReference), z.object({queryType:z.literal("extractorWrapperReturningObject"), definition:z.record(z.string(),z.lazy(() =>querySelectExtractorWrapperReturningObject))}).strict()]); +export const querySelectExtractorWrapperReturningList: z.ZodType = z.union([z.lazy(() =>extractObjectListByEntity), z.object({queryType:z.literal("extractorWrapperReturningList"), definition:z.array(z.lazy(() =>querySelectExtractorWrapperReturningList))}).strict()]); +export const querySelectExtractor: z.ZodType = z.union([z.lazy(() =>querySelectExtractorWrapperReturningObject), z.lazy(() =>querySelectExtractorWrapperReturningList)]); export const querySelect: z.ZodType = z.union([z.lazy(() =>querySelectExtractor), z.object({queryType:z.literal("extractorTransformer"), referencedQuery:z.lazy(() =>queryTemplateContextReference), attribute:z.string()}).strict(), z.object({queryType:z.literal("wrapperReturningObject"), definition:z.record(z.string(),z.lazy(() =>querySelect))}).strict(), z.object({queryType:z.literal("wrapperReturningList"), definition:z.array(z.lazy(() =>querySelect))}).strict(), z.lazy(() =>querySelectObjectByRelation), z.lazy(() =>querySelectObjectListByRelation), z.lazy(() =>querySelectObjectListByManyToManyRelation), z.lazy(() =>querySelectByQueryCombiner), z.object({queryType:z.literal("literal"), definition:z.string()}).strict(), z.object({queryType:z.literal("queryContextReference"), queryReference:z.string()}).strict()]); export const miroirSelectQueriesRecord: z.ZodType = z.record(z.string(),z.lazy(() =>querySelect)); export const domainElementVoid: z.ZodType = z.object({elementType:z.literal("void"), elementValue:z.void()}).strict(); @@ -2859,12 +2878,13 @@ export const localCacheExtractor: z.ZodType = z.object({que export const domainModelRootExtractor: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict(); export const extractorForSingleObject: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("domainModelSingleExtractor"), select:z.lazy(() =>querySelectObject)}).strict(); export const extractorForSingleObjectList: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("domainModelSingleExtractor"), select:z.lazy(() =>querySelectObjectList)}).strict(); +export const domainModelSingleExtractor: z.ZodType = z.union([z.lazy(() =>extractorForSingleObject), z.lazy(() =>extractorForSingleObjectList)]); export const extractorForRecordOfExtractors: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("extractorForRecordOfExtractors"), extractors:z.record(z.string(),z.lazy(() =>querySelectExtractor)).optional(), fetchQuery:z.lazy(() =>miroirSelectQueriesRecord).optional()}).strict(); export const domainModelGetEntityDefinitionExtractor: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("getEntityDefinition"), deploymentUuid:z.string().uuid(), entityUuid:z.string().uuid()}).strict(); export const domainModelGetFetchParamJzodSchemaExtractor: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("getFetchParamsJzodSchema"), fetchParams:z.lazy(() =>extractorForRecordOfExtractors)}).strict(); export const domainModelGetSingleSelectQueryJzodSchemaExtractor: z.ZodType = z.object({deploymentUuid:z.string().uuid(), pageParams:z.lazy(() =>domainElementObject), queryParams:z.lazy(() =>domainElementObject), contextResults:z.lazy(() =>domainElementObject)}).strict().extend({queryType:z.literal("getSingleSelectQueryJzodSchema"), select:z.lazy(() =>querySelect)}).strict(); export const domainModelQueryJzodSchemaParams: z.ZodType = z.union([z.lazy(() =>domainModelGetEntityDefinitionExtractor), z.lazy(() =>domainModelGetFetchParamJzodSchemaExtractor), z.lazy(() =>domainModelGetSingleSelectQueryJzodSchemaExtractor)]); -export const domainModelExtractor: z.ZodType = z.union([z.lazy(() =>extractorForSingleObject), z.lazy(() =>extractorForSingleObjectList), z.lazy(() =>extractorForRecordOfExtractors), z.lazy(() =>localCacheExtractor), z.lazy(() =>domainModelGetEntityDefinitionExtractor), z.lazy(() =>domainModelGetFetchParamJzodSchemaExtractor), z.lazy(() =>domainModelGetSingleSelectQueryJzodSchemaExtractor)]); +export const domainModelExtractor: z.ZodType = z.union([z.lazy(() =>domainModelSingleExtractor), z.lazy(() =>extractorForRecordOfExtractors), z.lazy(() =>localCacheExtractor), z.lazy(() =>domainModelGetEntityDefinitionExtractor), z.lazy(() =>domainModelGetFetchParamJzodSchemaExtractor), z.lazy(() =>domainModelGetSingleSelectQueryJzodSchemaExtractor)]); export const ______________________________________________actions_____________________________________________: z.ZodType<______________________________________________actions_____________________________________________> = z.never(); export const actionError: z.ZodType = z.object({status:z.literal("error"), error:z.object({errorType:z.union([z.enum(["FailedToCreateStore","FailedToDeployModule"]), z.literal("FailedToDeleteStore"), z.literal("FailedToResetAndInitMiroirAndApplicationDatabase"), z.literal("FailedToOpenStore"), z.literal("FailedToCloseStore"), z.literal("FailedToCreateInstance"), z.literal("FailedToGetInstance"), z.literal("FailedToGetInstances")]), errorMessage:z.string().optional(), error:z.object({errorMessage:z.string().optional(), stack:z.array(z.string().optional())}).strict().optional()}).strict()}).strict(); export const actionVoidSuccess: z.ZodType = z.object({status:z.literal("ok"), returnedDomainElement:z.lazy(() =>domainElementVoid)}).strict(); @@ -2894,7 +2914,7 @@ export const localCacheAction: z.ZodType = z.union([z.lazy(() export const storeManagementAction: z.ZodType = z.union([z.object({actionType:z.literal("storeManagementAction"), actionName:z.literal("createStore"), endpoint:z.literal("bbd08cbb-79ff-4539-b91f-7a14f15ac55f"), configuration:z.lazy(() =>storeUnitConfiguration), deploymentUuid:z.string().uuid()}).strict(), z.object({actionType:z.literal("storeManagementAction"), actionName:z.literal("deleteStore"), endpoint:z.literal("bbd08cbb-79ff-4539-b91f-7a14f15ac55f"), deploymentUuid:z.string().uuid(), configuration:z.lazy(() =>storeUnitConfiguration)}).strict(), z.object({actionType:z.literal("storeManagementAction"), actionName:z.literal("resetAndInitMiroirAndApplicationDatabase"), endpoint:z.literal("bbd08cbb-79ff-4539-b91f-7a14f15ac55f"), deployments:z.array(z.lazy(() =>deployment)), deploymentUuid:z.string().uuid()}).strict(), z.object({actionType:z.literal("storeManagementAction"), actionName:z.literal("openStore"), endpoint:z.literal("bbd08cbb-79ff-4539-b91f-7a14f15ac55f"), configuration:z.record(z.string(),z.lazy(() =>storeUnitConfiguration)), deploymentUuid:z.string().uuid()}).strict(), z.object({actionType:z.literal("storeManagementAction"), actionName:z.literal("closeStore"), endpoint:z.literal("bbd08cbb-79ff-4539-b91f-7a14f15ac55f"), deploymentUuid:z.string().uuid()}).strict()]); export const persistenceAction: z.ZodType = z.union([z.object({actionType:z.literal("RestPersistenceAction"), actionName:z.enum(["create","read","update","delete"]), endpoint:z.literal("a93598b3-19b6-42e8-828c-f02042d212d4"), section:z.lazy(() =>applicationSection), deploymentUuid:z.string().uuid(), parentName:z.string().optional(), parentUuid:z.string().optional(), uuid:z.string().optional(), objects:z.array(z.lazy(() =>entityInstance).optional()).optional()}).strict(), z.lazy(() =>queryAction), z.lazy(() =>bundleAction), z.lazy(() =>instanceAction), z.lazy(() =>modelAction), z.lazy(() =>storeManagementAction)]); export const restPersistenceAction: z.ZodType = z.object({actionType:z.literal("RestPersistenceAction"), actionName:z.enum(["create","read","update","delete"]), endpoint:z.literal("a93598b3-19b6-42e8-828c-f02042d212d4"), section:z.lazy(() =>applicationSection), deploymentUuid:z.string().uuid(), parentName:z.string().optional(), parentUuid:z.string().optional(), uuid:z.string().optional(), objects:z.array(z.lazy(() =>entityInstance).optional()).optional()}).strict(); -export const queryAction: z.ZodType = z.object({actionType:z.literal("queryAction"), actionName:z.literal("runQuery"), endpoint:z.literal("9e404b3c-368c-40cb-be8b-e3c28550c25e"), deploymentUuid:z.string().uuid(), query:z.lazy(() =>extractorForRecordOfExtractors)}).strict(); +export const queryAction: z.ZodType = z.object({actionType:z.literal("queryAction"), actionName:z.literal("runQuery"), endpoint:z.literal("9e404b3c-368c-40cb-be8b-e3c28550c25e"), deploymentUuid:z.string().uuid(), query:z.union([z.lazy(() =>domainModelSingleExtractor), z.lazy(() =>extractorForRecordOfExtractors)])}).strict(); export const compositeAction: z.ZodType = z.object({actionType:z.literal("compositeAction"), actionName:z.literal("sequence"), deploymentUuid:z.string().uuid().optional(), definition:z.array(z.union([z.object({compositeActionType:z.literal("action"), action:z.lazy(() =>domainAction)}).strict(), z.object({compositeActionType:z.literal("query"), query:z.lazy(() =>queryAction)}).strict()]))}).strict(); export const domainAction: z.ZodType = z.union([z.lazy(() =>undoRedoAction), z.lazy(() =>storeOrBundleAction), z.lazy(() =>modelAction), z.lazy(() =>instanceAction), z.object({actionType:z.literal("transactionalInstanceAction"), deploymentUuid:z.string().uuid().optional(), instanceAction:z.lazy(() =>instanceCUDAction)}).strict(), z.object({actionType:z.literal("compositeAction"), actionName:z.literal("sequence"), deploymentUuid:z.string().uuid().optional(), definition:z.array(z.union([z.object({compositeActionType:z.literal("action"), action:z.lazy(() =>domainAction)}).strict(), z.object({compositeActionType:z.literal("query"), query:z.lazy(() =>queryAction)}).strict()]))}).strict()]); export const objectTemplateInnerReference: z.ZodType = z.union([z.object({templateType:z.literal("constantUuid"), constantUuidValue:z.string()}).strict(), z.object({templateType:z.literal("contextReference"), referenceName:z.string()}).strict(), z.object({templateType:z.literal("parameterReference"), referenceName:z.string()}).strict()]); @@ -3008,15 +3028,19 @@ export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEnt export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByRelation: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({label:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), applicationSection:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_applicationSection).optional(), z.lazy(() =>carryOnObject)]).optional(), parentName:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), parentUuid:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("selectObjectListByRelation"), z.lazy(() =>carryOnObject)]), objectReference:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)]), objectReferenceAttribute:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), AttributeOfListObjectToCompareToReferenceUuid:z.union([z.string(), z.lazy(() =>carryOnObject)])}).strict()]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectByRelation: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({label:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), applicationSection:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_applicationSection).optional(), z.lazy(() =>carryOnObject)]).optional(), parentName:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), parentUuid:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("selectObjectByRelation"), z.lazy(() =>carryOnObject)]), objectReference:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)]), AttributeOfObjectToCompareToReferenceUuid:z.union([z.string(), z.lazy(() =>carryOnObject)])}).strict()]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({label:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), applicationSection:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_applicationSection).optional(), z.lazy(() =>carryOnObject)]).optional(), parentName:z.union([z.string().optional(), z.lazy(() =>carryOnObject)]).optional(), parentUuid:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("selectObjectByDirectReference"), z.lazy(() =>carryOnObject)]), instanceUuid:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateConstantOrAnyReference), z.lazy(() =>carryOnObject)])}).strict()]); -export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("extractorWrapperReturningObject"), z.lazy(() =>carryOnObject)]), definition:z.union([z.record(z.string(),z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.lazy(() =>carryOnObject)]); -export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("extractorWrapperReturningList"), z.lazy(() =>carryOnObject)]), definition:z.union([z.array(z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.lazy(() =>carryOnObject)]); -export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorObject), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorList), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("extractorWrapperReturningObject"), z.lazy(() =>carryOnObject)]), definition:z.union([z.record(z.string(),z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.lazy(() =>carryOnObject)]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("extractorWrapperReturningList"), z.lazy(() =>carryOnObject)]), definition:z.union([z.array(z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.lazy(() =>carryOnObject)]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningObject), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractorWrapperReturningList), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObject: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectByRelation), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectByDirectReference), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractObjectListByEntity), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByRelation), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByManyToManyRelation), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectByQueryCombiner: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({queryType:z.union([z.literal("queryCombiner"), z.lazy(() =>carryOnObject)]), rootQuery:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect), z.lazy(() =>carryOnObject)]), subQuery:z.union([z.lazy(() =>carryOnObject), z.object({query:z.union([z.lazy(() =>querySelect), z.lazy(() =>carryOnObject)]), rootQueryObjectTransformer:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_recordOfTransformers), z.lazy(() =>carryOnObject)])}).strict()])}).strict()]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("extractorTransformer"), z.lazy(() =>carryOnObject)]), referencedQuery:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryTemplateContextReference), z.lazy(() =>carryOnObject)]), attribute:z.union([z.string(), z.lazy(() =>carryOnObject)])}).strict(), z.object({queryType:z.union([z.literal("wrapperReturningObject"), z.lazy(() =>carryOnObject)]), definition:z.union([z.record(z.string(),z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.object({queryType:z.union([z.literal("wrapperReturningList"), z.lazy(() =>carryOnObject)]), definition:z.union([z.array(z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)])}).strict(), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectByRelation), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByRelation), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectListByManyToManyRelation), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectByQueryCombiner), z.lazy(() =>carryOnObject)]), z.object({queryType:z.union([z.literal("literal"), z.lazy(() =>carryOnObject)]), definition:z.union([z.string(), z.lazy(() =>carryOnObject)])}).strict(), z.object({queryType:z.union([z.literal("queryContextReference"), z.lazy(() =>carryOnObject)]), queryReference:z.union([z.string(), z.lazy(() =>carryOnObject)])}).strict(), z.lazy(() =>carryOnObject)]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_miroirSelectQueriesRecord: z.ZodType = z.union([z.record(z.string(),z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelect), z.lazy(() =>carryOnObject)])), z.lazy(() =>carryOnObject)]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({deploymentUuid:z.union([z.string().uuid(), z.lazy(() =>carryOnObject)]), pageParams:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject), z.lazy(() =>carryOnObject)]), queryParams:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)]), contextResults:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("domainModelSingleExtractor"), z.lazy(() =>carryOnObject)]), select:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObject), z.lazy(() =>carryOnObject)])}).strict()]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({deploymentUuid:z.union([z.string().uuid(), z.lazy(() =>carryOnObject)]), pageParams:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject), z.lazy(() =>carryOnObject)]), queryParams:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)]), contextResults:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("domainModelSingleExtractor"), z.lazy(() =>carryOnObject)]), select:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectObjectList), z.lazy(() =>carryOnObject)])}).strict()]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor: z.ZodType = z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObject), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForSingleObjectList), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)]); export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({deploymentUuid:z.union([z.string().uuid(), z.lazy(() =>carryOnObject)]), pageParams:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainElementObject), z.lazy(() =>carryOnObject)]), queryParams:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)]), contextResults:z.union([z.lazy(() =>domainElementObject), z.lazy(() =>carryOnObject)])}).strict().extend({queryType:z.union([z.literal("extractorForRecordOfExtractors"), z.lazy(() =>carryOnObject)]), extractors:z.union([z.record(z.string(),z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_querySelectExtractor), z.lazy(() =>carryOnObject)])).optional(), z.lazy(() =>carryOnObject)]).optional(), fetchQuery:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_miroirSelectQueriesRecord).optional(), z.lazy(() =>carryOnObject)]).optional()}).strict()]); -export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryAction: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({actionType:z.union([z.literal("queryAction"), z.lazy(() =>carryOnObject)]), actionName:z.union([z.literal("runQuery"), z.lazy(() =>carryOnObject)]), endpoint:z.union([z.literal("9e404b3c-368c-40cb-be8b-e3c28550c25e"), z.lazy(() =>carryOnObject)]), deploymentUuid:z.union([z.string().uuid(), z.lazy(() =>carryOnObject)]), query:z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors), z.lazy(() =>carryOnObject)])}).strict()]); +export const carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryAction: z.ZodType = z.union([z.lazy(() =>carryOnObject), z.object({actionType:z.union([z.literal("queryAction"), z.lazy(() =>carryOnObject)]), actionName:z.union([z.literal("runQuery"), z.lazy(() =>carryOnObject)]), endpoint:z.union([z.literal("9e404b3c-368c-40cb-be8b-e3c28550c25e"), z.lazy(() =>carryOnObject)]), deploymentUuid:z.union([z.string().uuid(), z.lazy(() =>carryOnObject)]), query:z.union([z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_domainModelSingleExtractor), z.lazy(() =>carryOnObject)]), z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_extractorForRecordOfExtractors), z.lazy(() =>carryOnObject)]), z.lazy(() =>carryOnObject)])}).strict()]); export const compositeInstanceActionTemplate: z.ZodType = z.object({actionType:z.literal("compositeInstanceAction"), actionName:z.literal("instanceActionSequence"), definition:z.array(z.union([z.object({compositeActionType:z.literal("action"), action:z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_instanceAction)}).strict(), z.object({compositeActionType:z.literal("query"), nameGivenToResult:z.string(), query:z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_queryAction)}).strict()]))}).strict(); export const carryOnObject: z.ZodType = z.union([z.lazy(() =>objectTemplateInnerReference), z.object({templateType:z.literal("mustacheStringTemplate"), definition:z.string()}).strict(), z.object({templateType:z.literal("fullObjectTemplate"), definition:z.array(z.tuple([z.lazy(() =>objectTemplateInnerReference), z.lazy(() =>objectTemplate)]))}).strict()]); export const compositeActionTemplate: z.ZodType = z.union([z.lazy(() =>carryOn_fe9b7d99$f216$44de$bb6e$60e1a1ebb739_compositeAction), z.lazy(() =>carryOnObject)]); diff --git a/packages/miroir-core/src/2_domain/DomainStateQuerySelectors.ts b/packages/miroir-core/src/2_domain/DomainStateQuerySelectors.ts index c5687ed9..22335904 100644 --- a/packages/miroir-core/src/2_domain/DomainStateQuerySelectors.ts +++ b/packages/miroir-core/src/2_domain/DomainStateQuerySelectors.ts @@ -14,7 +14,8 @@ import { EntityDefinition, JzodObject, DomainModelExtractor, - QuerySelectObject + QuerySelectObject, + DomainModelSingleExtractor } from "../0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.js"; import { ExtractorRunnerMapForJzodSchema, @@ -386,7 +387,7 @@ ExtractorForRecordOfExtractors, DomainState, DomainElementObject // ################################################################################################ export const extractWithExtractorFromDomainState:SyncExtractorRunner< - ExtractorForSingleObject | ExtractorForRecordOfExtractors | ExtractorForRecordOfExtractors, DomainState, DomainElement + DomainModelSingleExtractor | ExtractorForRecordOfExtractors, DomainState, DomainElement > = extractWithExtractor // ################################################################################################ diff --git a/packages/miroir-core/src/2_domain/QuerySelectors.ts b/packages/miroir-core/src/2_domain/QuerySelectors.ts index c035fb5a..aa5b5951 100644 --- a/packages/miroir-core/src/2_domain/QuerySelectors.ts +++ b/packages/miroir-core/src/2_domain/QuerySelectors.ts @@ -26,6 +26,7 @@ import { ExtractorForSingleObject, QuerySelectObjectList, ExtractObjectListByEntity, + DomainModelSingleExtractor, } from "../0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.js"; import { SyncExtractorRunnerParams, @@ -809,7 +810,7 @@ export const extractWithExtractor /**: SyncExtractorRunner */= ( state: StateType, // selectorParams: SyncExtractorRunnerParams, selectorParams: SyncExtractorRunnerParams< - ExtractorForSingleObject | ExtractorForSingleObjectList | ExtractorForRecordOfExtractors, + DomainModelSingleExtractor | ExtractorForRecordOfExtractors, StateType > ): DomainElement => { diff --git a/packages/miroir-core/src/3_controllers/DomainController.ts b/packages/miroir-core/src/3_controllers/DomainController.ts index e82bd556..20966c6d 100644 --- a/packages/miroir-core/src/3_controllers/DomainController.ts +++ b/packages/miroir-core/src/3_controllers/DomainController.ts @@ -650,6 +650,14 @@ export class DomainController implements DomainControllerInterface { "objects", JSON.stringify((queryAction as any)["objects"], null, 2) ); + + // TODO: handleQuery for queryAction.query.queryType == "domainModelSingleExtractor" + if (queryAction.query.queryType == "domainModelSingleExtractor" ) { + // if (["domainModelSingleExtractor","extractorForRecordOfExtractors"].includes(queryAction.query.queryType) ) { + log.info("handleQuery queryAction", queryAction); + throw new Error("DomainController handleQuery queryAction not implemented for queryType " + queryAction.query.queryType); + } + if (this.hasDirectAccessToPersistenceStore) { /** * we're on the server side. Shall we execute the query on the localCache or on the persistentStore? diff --git a/packages/miroir-core/src/4_services/RestServer.ts b/packages/miroir-core/src/4_services/RestServer.ts index 8e343e94..a4a6d4f9 100644 --- a/packages/miroir-core/src/4_services/RestServer.ts +++ b/packages/miroir-core/src/4_services/RestServer.ts @@ -27,7 +27,7 @@ import { generateRestServiceResponse } from "./RestTools.js"; import { cleanLevel } from "./constants.js"; import { LocalCacheInterface } from "../0_interfaces/4-services/LocalCacheInterface.js"; -import { getSelectorParams, extractWithManyExtractorsFromDomainState } from "../2_domain/DomainStateQuerySelectors.js"; +import { getSelectorParams, extractWithManyExtractorsFromDomainState, extractWithExtractorFromDomainState } from "../2_domain/DomainStateQuerySelectors.js"; const loggerName: string = getLoggerName(packageName, cleanLevel,"RestServer"); let log:LoggerInterface = console as any as LoggerInterface; @@ -298,10 +298,30 @@ export async function queryHandler( log.info("RestServer queryHandler query=", JSON.stringify(queryAction, undefined, 2)) log.info("RestServer queryHandler domainState=", JSON.stringify(domainState, undefined, 2)) // const queryResult: DomainElement = extractWithManyExtractorsFromDomainState(domainState, getSelectorParams(query)); - const queryResult: DomainElement = extractWithManyExtractorsFromDomainState( - domainState, - getSelectorParams(queryAction.query) - ); + let queryResult: DomainElement + switch (queryAction.query.queryType) { + case "domainModelSingleExtractor": { + queryResult = extractWithExtractorFromDomainState( + domainState, + getSelectorParams(queryAction.query) + ); + break; + } + case "extractorForRecordOfExtractors": { + queryResult = extractWithManyExtractorsFromDomainState( + domainState, + getSelectorParams(queryAction.query) + ); + break; + } + default: { + return continuationFunction(response)({ + status: "error", + error: "RestServer queryHandler could not handle queryAction.query: " + queryAction.query, + }) + break; + } + } const result:ActionReturnType = { status: "ok", returnedDomainElement: queryResult diff --git a/packages/miroir-core/src/assets/miroir_data/3d8da4d4-8f76-4bb4-9212-14869d81c00c/0faae143-0d7b-4a8a-a950-4fc3df943bde.json b/packages/miroir-core/src/assets/miroir_data/3d8da4d4-8f76-4bb4-9212-14869d81c00c/0faae143-0d7b-4a8a-a950-4fc3df943bde.json index d18fa5aa..da4fbbc9 100644 --- a/packages/miroir-core/src/assets/miroir_data/3d8da4d4-8f76-4bb4-9212-14869d81c00c/0faae143-0d7b-4a8a-a950-4fc3df943bde.json +++ b/packages/miroir-core/src/assets/miroir_data/3d8da4d4-8f76-4bb4-9212-14869d81c00c/0faae143-0d7b-4a8a-a950-4fc3df943bde.json @@ -20,12 +20,25 @@ "tag": { "value": { "id": 1, "defaultLabel": "Uuid", "editable": false } } }, "query": { - "type": "schemaReference", - "optional": false, - "definition": { - "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", - "relativePath": "extractorForRecordOfExtractors" - } + "type": "union", + "definition": [ + { + "type": "schemaReference", + "optional": false, + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "domainModelSingleExtractor" + } + }, + { + "type": "schemaReference", + "optional": false, + "definition": { + "absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739", + "relativePath": "extractorForRecordOfExtractors" + } + } + ] } } }, diff --git a/packages/miroir-core/src/assets/miroir_model/54b9c72f-d4f3-4db9-9e0e-0dc840b530bd/359f1f9b-7260-4d76-a864-72c839b9711b.json b/packages/miroir-core/src/assets/miroir_model/54b9c72f-d4f3-4db9-9e0e-0dc840b530bd/359f1f9b-7260-4d76-a864-72c839b9711b.json index 9c56d4cd..8b9ad107 100644 --- a/packages/miroir-core/src/assets/miroir_model/54b9c72f-d4f3-4db9-9e0e-0dc840b530bd/359f1f9b-7260-4d76-a864-72c839b9711b.json +++ b/packages/miroir-core/src/assets/miroir_model/54b9c72f-d4f3-4db9-9e0e-0dc840b530bd/359f1f9b-7260-4d76-a864-72c839b9711b.json @@ -464,7 +464,7 @@ } } }, - "querySelectExtractorObject": { + "querySelectExtractorWrapperReturningObject": { "type": "union", "discriminator": "queryType", "definition": [ @@ -486,7 +486,7 @@ "definition": { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorObject" + "relativePath": "querySelectExtractorWrapperReturningObject" } } } @@ -494,7 +494,7 @@ } ] }, - "querySelectExtractorList": { + "querySelectExtractorWrapperReturningList": { "type": "union", "discriminator": "queryType", "definition": [ @@ -516,7 +516,7 @@ "definition": { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorList" + "relativePath": "querySelectExtractorWrapperReturningList" } } } @@ -531,13 +531,13 @@ { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorObject" + "relativePath": "querySelectExtractorWrapperReturningObject" } }, { "type": "schemaReference", "definition": { - "relativePath": "querySelectExtractorList" + "relativePath": "querySelectExtractorWrapperReturningList" } } ] diff --git a/packages/miroir-core/src/index.ts b/packages/miroir-core/src/index.ts index e230cae6..04572a36 100644 --- a/packages/miroir-core/src/index.ts +++ b/packages/miroir-core/src/index.ts @@ -253,6 +253,8 @@ export { extractorForSingleObject, ExtractorForSingleObjectList, extractorForSingleObjectList, + DomainModelSingleExtractor, + domainModelSingleExtractor, } from "./0_interfaces/1_core/preprocessor-generated/miroirFundamentalType.js" diff --git a/packages/miroir-localcache-redux/src/4_services/localCache/DomainStateMemoizedSelectors.ts b/packages/miroir-localcache-redux/src/4_services/localCache/DomainStateMemoizedSelectors.ts index 8581cd1e..81d2beeb 100644 --- a/packages/miroir-localcache-redux/src/4_services/localCache/DomainStateMemoizedSelectors.ts +++ b/packages/miroir-localcache-redux/src/4_services/localCache/DomainStateMemoizedSelectors.ts @@ -19,6 +19,7 @@ const deploymentEntityStateSelectorParams = (domainState: DeploymentEntityState, export function getMemoizedDeploymentEntityStateSelectorMap(): SyncExtractorRunnerMap { return { + extractorType: "sync", extractEntityInstance: createSelector( [deploymentEntityStateSelector, deploymentEntityStateSelectorParams], selectEntityInstanceFromDeploymentEntityState diff --git a/packages/miroir-standalone-app/tests/4_storage/PersistenceStoreExtractorRunner.test.tsx b/packages/miroir-standalone-app/tests/4_storage/PersistenceStoreExtractorRunner.test.tsx index 6f680a09..624bc8cc 100644 --- a/packages/miroir-standalone-app/tests/4_storage/PersistenceStoreExtractorRunner.test.tsx +++ b/packages/miroir-standalone-app/tests/4_storage/PersistenceStoreExtractorRunner.test.tsx @@ -336,74 +336,62 @@ describe.sequential("PersistenceStoreExtractorRunner.test", () => { ) }); - // // ################################################################################################ - // it("get Entity Entity from Library", async () => { - // await chainVitestSteps( - // "PersistenceStoreExtractorRunner_selectEntityInstance_selectObjectByDirectReference", - // {}, - // async () => { - // const extractorRunner = new IndexedDbExtractorRunner(localMiroirPersistenceStoreController); - // const queryResult = await extractorRunner.extractEntityInstance(undefined, { - // extractorRunnerMap: { - // extractEntityInstance: undefined as any, - // extractEntityInstanceUuidIndex: undefined as any, - // extractEntityInstanceUuidIndexWithObjectListExtractor: undefined as any, - // extractWithManyExtractors: undefined as any, - // extractWithExtractor: undefined as any, - // }, - // extractor: { - // queryType: "domainModelSingleExtractor", - // pageParams: { elementType: "object", elementValue: {} }, - // queryParams: { elementType: "object", elementValue: {} }, - // contextResults: { elementType: "object", elementValue: {} }, - // deploymentUuid: adminConfigurationDeploymentLibrary.uuid, - // select: { - // queryType: "selectObjectByDirectReference", - // applicationSection: "model", - // parentName: "Entity", - // parentUuid: { - // queryTemplateType: "constantUuid", - // constantUuidValue: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", - // }, - // instanceUuid: { - // queryTemplateType: "constantUuid", - // constantUuidValue: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", - // }, - // }, - // }, - // }); - // console.log("queryResult", JSON.stringify(queryResult, null, 2)); - // const result: ActionReturnType = - // queryResult.elementType == "instance" - // ? { - // status: "ok", - // returnedDomainElement: queryResult, - // } - // : { - // status: "error", - // error: { - // errorType: "FailedToGetInstances", - // errorMessage: JSON.stringify(queryResult, undefined, 2), - // }, - // }; - // return result; - // }, - // // (a) => ignorePostgresExtraAttributes((a as any).returnedDomainElement.elementValue.instances), - // undefined, // expected result transformation - // undefined, // name to give to result - // "instance", - // { - // uuid: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", - // parentName: "Entity", - // parentUuid: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", - // parentDefinitionVersionUuid: "381ab1be-337f-4198-b1d3-f686867fc1dd", - // name: "Entity", - // application: "360fcf1f-f0d4-4f8a-9262-07886e70fa15", - // conceptLevel: "MetaModel", - // description: "The Metaclass for entities.", - // } - // ); - // }); + // ################################################################################################ + it("get Entity Entity from Library", async () => { + await chainVitestSteps( + "PersistenceStoreExtractorRunner_selectEntityInstance_selectObjectByDirectReference", + {}, + async () => { + const extractorRunner = new IndexedDbExtractorRunner(localMiroirPersistenceStoreController); + const applicationSection:ApplicationSection = "model"; + const queryResult:ActionReturnType = await extractorRunner.handleQuery( + applicationSection, + { + actionType: "queryAction", + actionName: "runQuery", + deploymentUuid: adminConfigurationDeploymentLibrary.uuid, + endpoint: "9e404b3c-368c-40cb-be8b-e3c28550c25e", + query: { + queryType: "domainModelSingleExtractor", + pageParams: { elementType: "object", elementValue: {} }, + queryParams: { elementType: "object", elementValue: {} }, + contextResults: { elementType: "object", elementValue: {} }, + deploymentUuid: adminConfigurationDeploymentLibrary.uuid, + select: { + queryType: "selectObjectByDirectReference", + applicationSection: "model", + parentName: "Entity", + parentUuid: { + queryTemplateType: "constantUuid", + constantUuidValue: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", + }, + instanceUuid: { + queryTemplateType: "constantUuid", + constantUuidValue: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", + }, + }, + }, + } + ); + console.log("queryResult", JSON.stringify(queryResult, null, 2)); + return queryResult; + }, + // (a) => ignorePostgresExtraAttributes((a as any).returnedDomainElement.elementValue.instances), + undefined, // expected result transformation + undefined, // name to give to result + "instance", + { + uuid: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", + parentName: "Entity", + parentUuid: "16dbfe28-e1d7-4f20-9ba4-c1a9873202ad", + parentDefinitionVersionUuid: "381ab1be-337f-4198-b1d3-f686867fc1dd", + name: "Entity", + application: "360fcf1f-f0d4-4f8a-9262-07886e70fa15", + conceptLevel: "MetaModel", + description: "The Metaclass for entities.", + } + ); + }); // // ################################################################################################ // it("get Filtered Entity Entity from Library", async () => { diff --git a/packages/miroir-store-indexedDb/src/4_services/IndexedDbExtractorRunner.ts b/packages/miroir-store-indexedDb/src/4_services/IndexedDbExtractorRunner.ts index 0a9f8948..ad36aa21 100644 --- a/packages/miroir-store-indexedDb/src/4_services/IndexedDbExtractorRunner.ts +++ b/packages/miroir-store-indexedDb/src/4_services/IndexedDbExtractorRunner.ts @@ -63,29 +63,8 @@ export class IndexedDbExtractorRunner implements PersistenceStoreExtractorRunner extractEntityInstanceUuidIndex: this.extractEntityInstanceUuidIndex, extractEntityInstance: this.extractEntityInstance, extractEntityInstanceUuidIndexWithObjectListExtractor: asyncExtractEntityInstanceUuidIndexWithObjectListExtractor, - // extractEntityInstanceUuidIndexWithObjectListExtractor: async ( - // domainState: any, - // extractorAndParams: AsyncExtractorRunnerParams - // ) => - // exractEntityInstanceListFromListQueryAndDomainState( - // domainState, - // getSelectorParams(extractorAndParams.extractor) - // ), extractWithManyExtractors: asyncExtractWithManyExtractors, - // extractWithManyExtractors: async ( - // domainState: any, - // extractorAndParams: AsyncExtractorRunnerParams - // ) => extractWithManyExtractorsFromDomainState( - // domainState, - // getSelectorParams(extractorAndParams.extractor) - // ), extractWithExtractor: asyncExtractWithExtractor, - // extractWithExtractor: async ( - // domainState: any, - // extractorAndParams: AsyncExtractorRunnerParams - // ) => extractWithExtractor(domainState, - // getSelectorParams(extractorAndParams.extractor) - // ), }; } @@ -99,14 +78,38 @@ export class IndexedDbExtractorRunner implements PersistenceStoreExtractorRunner // const currentStore: StoreDataSectionInterface | StoreModelSectionInterface = // section == "data" ? this.dataStoreSection : this.modelStoreSection; // const result: ActionReturnType = await currentStore.handleQuery(query); - const queryResult: DomainElement = await this.selectorMap.extractWithManyExtractors( - undefined /* domainState*/, - // getSelectorParams(queryAction.query) - { - extractor: queryAction.query, - extractorRunnerMap: this.selectorMap, + let queryResult: DomainElement; + switch (queryAction.query.queryType) { + case "domainModelSingleExtractor": { + queryResult = await this.selectorMap.extractWithExtractor( + undefined /* domainState*/, + // getSelectorParams(queryAction.query) + { + extractor: queryAction.query, + extractorRunnerMap: this.selectorMap, + } + ); + break; } - ); + case "extractorForRecordOfExtractors": { + queryResult = await this.selectorMap.extractWithManyExtractors( + undefined /* domainState*/, + // getSelectorParams(queryAction.query) + { + extractor: queryAction.query, + extractorRunnerMap: this.selectorMap, + } + ); + break; + } + default: { + return { + status: "error", + error: { errorType: "FailedToGetInstances", errorMessage: JSON.stringify(queryAction) }, + } as ActionReturnType; + break; + } + } if (queryResult.elementType == "failure") { return { status: "error",