Skip to content

Commit

Permalink
Children => Containment
Browse files Browse the repository at this point in the history
  • Loading branch information
joswarmer committed Nov 9, 2023
1 parent 25b6570 commit 47b33c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/storage/FreLionwebSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FreLanguage, FreLanguageProperty } from "../language";
import { FreLogger } from "../logging/index";
import { FreUtils, isNullOrUndefined, jsonAsString } from "../util";
import { FreSerializer } from "./FreSerializer";
import { createLwNode, isLwChunk, LwChild, LwChunk, LwMetaPointer, LwNode, LwReference } from "./LionwebM3";
import { createLwNode, isLwChunk, LwContainment, LwChunk, LwMetaPointer, LwNode, LwReference } from "./LionwebM3";

const LOGGER = new FreLogger("FreLionwebSerializer");
/**
Expand Down Expand Up @@ -209,7 +209,7 @@ export class FreLionwebSerializer implements FreSerializer {
}

private convertChildProperties(freNode: FreNode, concept: string, jsonObject: LwNode): ParsedChild[] {
const jsonChildren = jsonObject.children;
const jsonChildren = jsonObject.containments;
FreUtils.CHECK(Array.isArray(jsonChildren), "Found children value which is not a Array for node: " + jsonObject.id);
const parsedChildren: ParsedChild[] = [];
for (const jsonChild of Object.values(jsonChildren)) {
Expand Down Expand Up @@ -372,7 +372,7 @@ export class FreLionwebSerializer implements FreSerializer {
LOGGER.log("PART is null: " + + parentNode["name"] + "." + p.name);
break;
}
const child: LwChild = {
const child: LwContainment = {
containment: this.createMetaPointer(p.key, p.language),
children: []
};
Expand All @@ -385,7 +385,7 @@ export class FreLionwebSerializer implements FreSerializer {
// single value
child.children.push((!!value ? this.convertToJSONinternal(value as FreNode, publicOnly, idMap) : null).id);
}
result.children.push(child);
result.containments.push(child);
break;
case "reference":
const lwReference: LwReference = {
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/storage/LionwebM3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type LwNode = {
id: Id;
classifier: LwMetaPointer;
properties: LwProperty[];
children: LwChild[];
containments: LwContainment[];
references: LwReference[];
parent: string;
}
Expand All @@ -56,7 +56,7 @@ export function isLwNode(box: any): box is LwNode {
return lwNode.id !== undefined &&
lwNode.classifier !== undefined &&
lwNode.properties !== undefined &&
lwNode.children !== undefined &&
lwNode.containments !== undefined &&
lwNode.references !== undefined &&
lwNode.parent !== undefined;
}
Expand All @@ -66,7 +66,7 @@ export function createLwNode(): LwNode {
id: null,
classifier: null,
properties: [],
children: [],
containments: [],
references: [],
parent: null
}
Expand All @@ -83,13 +83,13 @@ export function isLwProperty(obj: any): obj is LwProperty {
lwProperty.value !== undefined;
}

export type LwChild = {
export type LwContainment = {
containment: LwMetaPointer;
children: string[];
}

export function isLwChild(obj: any): obj is LwChild {
const lwChild = obj as LwChild;
export function isLwChild(obj: any): obj is LwContainment {
const lwChild = obj as LwContainment;
return lwChild.containment !== undefined &&
lwChild.children !== undefined;
}
Expand Down

0 comments on commit 47b33c6

Please sign in to comment.