Skip to content

Commit

Permalink
create basic elements for Miroir Action Script (MAS), migrate Tools.s…
Browse files Browse the repository at this point in the history
…ubmit to MAS #28. Replace ActionTemplateSchema by ActionHandler, which has separate "interface" and "implementation" sections. Implementation is given as CompositeAction Template, interpreted in Tools.tsx to produce a CompositeAction, which is run by DomainController.
  • Loading branch information
miroir-framework committed Jul 2, 2024
1 parent 003dfdb commit c4f78b5
Show file tree
Hide file tree
Showing 10 changed files with 1,154 additions and 1,225 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 1 addition & 23 deletions packages/miroir-core/src/3_controllers/DomainController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,29 +756,7 @@ export class DomainController implements DomainControllerInterface {

switch (domainAction.actionType) {
case 'compositeAction':{
// resolve templatesDEFUNCT
const resolvedTemplates: any = {}
// going imperatively to handle inner references
if (domainAction.templatesDEFUNCT) {
for (const t of Object.entries(domainAction.templatesDEFUNCT)) {
const resolvedTemplate = renderObjectTemplate(
t[0],
t[1],
{...domainAction.params,...resolvedTemplates},
undefined
);
log.info("handleAction compositeAction resolved template", t[0], resolvedTemplate)
resolvedTemplates[t[0]] = resolvedTemplate
}
}
// resolve domainAction array templatesDEFUNCT
for (const a of domainAction.definition) {
const currentAction = renderObjectTemplate(
"ROOT",
a,
{...domainAction.params, ...resolvedTemplates},
undefined
)
for (const currentAction of domainAction.definition) {
log.info("handleAction compositeAction resolved action", currentAction)
const actionResult = await this.handleAction(currentAction, currentModel)
if (actionResult?.status != "ok") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,15 @@
"optional": true,
"extra": { "defaultLabel": "Module Deployment Uuid", "editable": false }
},
"params": {
"type": "record",
"optional": true,
"definition": {
"type": "any"
}
},
"definition": {
"type": "array",
"definition": {
"type": "schemaReference",
"definition": {
"absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739",
"relativePath": "objectTemplate"
"relativePath": "domainAction"
}
}
},
"templatesDEFUNCT": {
"type": "record",
"optional": true,
"definition": {
"type": "any"
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,74 +102,45 @@
}
]
},
"actionTemplateSchema": {
"actionHandler": {
"type": "object",
"definition": {
"actionTemplateParameters": {
"type": "schemaReference",
"interface": {
"type": "object",
"definition": {
"absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739",
"relativePath": "jzodObject"
"actionJzodObjectSchema": {
"type": "schemaReference",
"definition": {
"absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739",
"relativePath": "jzodObject"
}
}
}
},
"actionTemplate": {
"type": "schemaReference",
"carryOn": {
"type": "union",
"discriminator": "templateType",
"definition": [
{
"type": "schemaReference",
"definition": {
"relativePath": "objectTemplateInnerReference"
}
},
{
"type": "object",
"definition": {
"templateType": {
"type": "literal",
"definition": "mustacheStringTemplate"
},
"definition": {
"type": "string"
}
}
},
{
"type": "object",
"definition": {
"templateType": {
"type": "literal",
"definition": "fullObjectTemplate"
},
"definition": {
"type": "array",
"definition": {
"type": "tuple",
"definition": [
{
"type": "schemaReference",
"definition": {
"relativePath": "objectTemplateInnerReference"
}
},
{
"type": "schemaReference",
"definition": {
"relativePath": "objectTemplate"
}
}
]
}
}
}
"implementation": {
"type": "object",
"definition": {
"templates": {
"type": "record",
"optional": true,
"definition": {
"type": "any"
}
},
"compositeActionTemplate": {
"type": "schemaReference",
"definition": {
"absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739",
"relativePath": "compositeActionTemplate"
}
]
},
}
}
},
"params": {
"type": "record",
"optional": true,
"definition": {
"absolutePath": "fe9b7d99-f216-44de-bb6e-60e1a1ebb739",
"relativePath": "compositeAction"
"type": "any"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/miroir-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export {
objectTemplateInnerReference,
objectTemplate,
ObjectTemplate,
actionTemplateSchema,
ActionTemplateSchema,
actionHandler,
ActionHandler,
PersistenceAction,
RestPersistenceAction,
SelectObjectQuery,
Expand Down
22 changes: 11 additions & 11 deletions packages/miroir-standalone-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ import {
} from "miroir-core";
import { createMswRestServer } from "miroir-server-msw-stub";
import { miroirIndexedDbStoreSectionStartup } from "miroir-store-indexedDb";
import { PersistenceReduxSaga, LocalCache, RestPersistenceClientAndRestClient } from "miroir-localcache-redux";

import { loglevelnext } from './loglevelnextImporter';
import { ErrorPage } from "./miroir-fwk/4_view/ErrorPage";
import { HomePage } from "./miroir-fwk/4_view/routes/HomePage";
import { MiroirContextReactProvider } from "./miroir-fwk/4_view/MiroirContextReactProvider";
import { RootComponent } from "./miroir-fwk/4_view/components/RootComponent";
import { ReportPage } from "./miroir-fwk/4_view/routes/ReportPage";
import { miroirAppStartup } from "./startup";
import { loglevelnext } from './loglevelnextImporter.js';
import { ErrorPage } from "./miroir-fwk/4_view/ErrorPage.js";
import { HomePage } from "./miroir-fwk/4_view/routes/HomePage.js";
import { MiroirContextReactProvider } from "./miroir-fwk/4_view/MiroirContextReactProvider.js";
import { RootComponent } from "./miroir-fwk/4_view/components/RootComponent.js";
import { ReportPage } from "./miroir-fwk/4_view/routes/ReportPage.js";
import { miroirAppStartup } from "./startup.js";

import { PersistenceReduxSaga, LocalCache, RestPersistenceClientAndRestClient } from "miroir-localcache-redux";
import { packageName } from "./constants";
import { cleanLevel } from "./miroir-fwk/4_view/constants";
import { packageName } from "./constants.js";
import { cleanLevel } from "./miroir-fwk/4_view/constants.js";

import miroirConfigEmulatedServerIndexedDb from "./assets/miroirConfig-emulatedServer-IndexedDb.json";
import miroirConfigRealServerFilesystemGit from "./assets/miroirConfig-realServer-filesystem-git.json";
import miroirConfigRealServerFilesystemTmp from "./assets/miroirConfig-realServer-filesystem-tmp.json";
import miroirConfigRealServerIndexedDb from "./assets/miroirConfig-realServer-indexedDb.json";
import miroirConfigRealServerSql from "./assets/miroirConfig-realServer-sql.json";
import miroirConfig from "./assets/miroirConfig.json";
import { ToolsPage } from "./miroir-fwk/4_view/routes/Tools";
import { ToolsPage } from "./miroir-fwk/4_view/routes/Tools.js";

const specificLoggerOptions: SpecificLoggerOptionsMap = {
// "5_miroir-core_DomainController": {level:defaultLevels.INFO, template:"[{{time}}] {{level}} ({{name}}) BBBBB-"},
Expand Down
Loading

0 comments on commit c4f78b5

Please sign in to comment.