@media-quest/builder 0.0.24 → 0.0.25

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.
@@ -1,101 +1,102 @@
1
- import type { BuilderOptionDto } from "./Builder-option";
2
- import { BuilderOption } from "./Builder-option";
3
- import { BuilderObject, BuilderObjectId } from "./BuilderObject";
4
-
5
- export type BuilderQuestionType =
6
- | "select-one"
7
- | "select-many"
8
- | "text"
9
- | "color"
10
- | "radio"
11
- | "email"
12
- | "time"
13
- | "checkbox"
14
- | "textarea"
15
- | "date"
16
- | "numeric-range"
17
- | "duration";
18
-
19
- export interface BuilderQuestionDto {
20
- readonly id: BuilderObjectId.QuestionID;
21
- _type: BuilderQuestionType;
22
- text: string;
23
- options: ReadonlyArray<BuilderOptionDto>;
24
- prefix: string;
25
- }
26
-
27
- export class BuilderQuestion extends BuilderObject<"builder-question", BuilderQuestionDto> {
28
- readonly objectType = "builder-question";
29
- id: BuilderObjectId.QuestionID;
30
- type: BuilderQuestionType;
31
- questionText = "";
32
- options: BuilderOption[] = [];
33
- prefix = "";
34
-
35
- static create = (type: BuilderQuestionType) => {
36
- const id = BuilderObjectId.questionId();
37
-
38
- return new BuilderQuestion({
39
- id,
40
- _type: type,
41
- text: "",
42
- options: [],
43
- prefix: "",
44
- });
45
- };
46
-
47
- public static fromJson(dto: BuilderQuestionDto): BuilderQuestion {
48
- const question = new BuilderQuestion(dto);
49
- return question;
50
- }
51
-
52
- private constructor(dto: BuilderQuestionDto) {
53
- super(dto);
54
- this.id = dto.id as BuilderObjectId.QuestionID;
55
- this.type = dto._type;
56
- this.questionText = dto.text;
57
- this.prefix = dto.prefix;
58
- this.options = dto.options.map((o) => BuilderOption.fromJson(o));
59
- }
60
-
61
- addOption(label: string, value: number, atIndex = -1) {
62
- const option = BuilderOption.create(value, label);
63
- if (atIndex >= 0 && atIndex < this.options.length) {
64
- this.options.splice(atIndex, 0, option);
65
- } else {
66
- this.options.push(option);
67
- }
68
- return option;
69
- }
70
-
71
- deleteOption(option: BuilderOption): boolean {
72
- const filtered = this.options.filter((o) => o.id !== option.id);
73
- const didDelete = filtered.length === this.options.length - 1;
74
- this.options = filtered;
75
- return didDelete;
76
- }
77
-
78
- toJson() {
79
- const optionsJson = this.options.map((o) => o.toJson());
80
- const dto: BuilderQuestionDto = {
81
- id: this.id,
82
- prefix: this.prefix,
83
- _type: this.type,
84
- text: this.questionText,
85
- options: optionsJson,
86
- };
87
- return dto;
88
- }
89
-
90
- clone(): BuilderQuestionDto {
91
- const cloneId = BuilderObjectId.questionId();
92
- const dto = this.toJson();
93
- const optionsClone = this.options.map((o) => o.clone());
94
- const clonedDto: BuilderQuestionDto = {
95
- ...dto,
96
- id: cloneId,
97
- options: optionsClone,
98
- };
99
- return clonedDto;
100
- }
101
- }
1
+ import type { BuilderOptionDto } from "./Builder-option";
2
+ import { BuilderOption } from "./Builder-option";
3
+ import { BuilderObject } from "./BuilderObject";
4
+ import { QuestionID } from "./primitives/ID";
5
+
6
+ export type BuilderQuestionType =
7
+ | "select-one"
8
+ | "select-many"
9
+ | "text"
10
+ | "color"
11
+ | "radio"
12
+ | "email"
13
+ | "time"
14
+ | "checkbox"
15
+ | "textarea"
16
+ | "date"
17
+ | "numeric-range"
18
+ | "duration";
19
+
20
+ export interface BuilderQuestionDto {
21
+ readonly id: QuestionID;
22
+ _type: BuilderQuestionType;
23
+ text: string;
24
+ options: ReadonlyArray<BuilderOptionDto>;
25
+ prefix: string;
26
+ }
27
+
28
+ export class BuilderQuestion extends BuilderObject<"builder-question", BuilderQuestionDto> {
29
+ readonly objectType = "builder-question";
30
+ id: QuestionID;
31
+ type: BuilderQuestionType;
32
+ questionText = "";
33
+ options: BuilderOption[] = [];
34
+ prefix = "";
35
+
36
+ static create = (type: BuilderQuestionType) => {
37
+ const id = QuestionID.create();
38
+
39
+ return new BuilderQuestion({
40
+ id,
41
+ _type: type,
42
+ text: "",
43
+ options: [],
44
+ prefix: "",
45
+ });
46
+ };
47
+
48
+ public static fromJson(dto: BuilderQuestionDto): BuilderQuestion {
49
+ const question = new BuilderQuestion(dto);
50
+ return question;
51
+ }
52
+
53
+ private constructor(dto: BuilderQuestionDto) {
54
+ super(dto);
55
+ this.id = QuestionID.validateOrCreate(dto.id);
56
+ this.type = dto._type;
57
+ this.questionText = dto.text;
58
+ this.prefix = dto.prefix;
59
+ this.options = dto.options.map((o) => BuilderOption.fromJson(o));
60
+ }
61
+
62
+ addOption(label: string, value: number, atIndex = -1) {
63
+ const option = BuilderOption.create(value, label);
64
+ if (atIndex >= 0 && atIndex < this.options.length) {
65
+ this.options.splice(atIndex, 0, option);
66
+ } else {
67
+ this.options.push(option);
68
+ }
69
+ return option;
70
+ }
71
+
72
+ deleteOption(option: BuilderOption): boolean {
73
+ const filtered = this.options.filter((o) => o.id !== option.id);
74
+ const didDelete = filtered.length === this.options.length - 1;
75
+ this.options = filtered;
76
+ return didDelete;
77
+ }
78
+
79
+ toJson() {
80
+ const optionsJson = this.options.map((o) => o.toJson());
81
+ const dto: BuilderQuestionDto = {
82
+ id: this.id,
83
+ prefix: this.prefix,
84
+ _type: this.type,
85
+ text: this.questionText,
86
+ options: optionsJson,
87
+ };
88
+ return dto;
89
+ }
90
+
91
+ clone(): BuilderQuestionDto {
92
+ const cloneId = QuestionID.create();
93
+ const dto = this.toJson();
94
+ const optionsClone = this.options.map((o) => o.clone());
95
+ const clonedDto: BuilderQuestionDto = {
96
+ ...dto,
97
+ id: cloneId,
98
+ options: optionsClone,
99
+ };
100
+ return clonedDto;
101
+ }
102
+ }
@@ -3,11 +3,11 @@ import { BuilderSchema } from "./Builder-schema";
3
3
  import { BuilderPage } from "./Builder-page";
4
4
  import type { BuilderTagDto } from "./BuilderTag";
5
5
  import { BuilderTag } from "./BuilderTag";
6
- import type { BuilderObjectId } from "./BuilderObject";
7
- import { PageID, SchemaID } from "@media-quest/engine";
8
6
  import { PagePrefix } from "./primitives/page-prefix";
9
7
  import { SchemaPrefix } from "./primitives/schema-prefix";
10
- import { SumScoreVariable } from "./variable/sum-score";
8
+
9
+ import { SumScoreVariableDto } from "./variable/sum-score-variable";
10
+ import { OptionID, PageID, QuestionID, SchemaID } from "./primitives/ID";
11
11
 
12
12
  const tag1: BuilderTagDto = BuilderTag.create("tag1", "This tag is defined in schemaDto1").toJson();
13
13
 
@@ -34,7 +34,7 @@ const schemaDto1: BuilderSchemaDto = {
34
34
  ],
35
35
  pages: [
36
36
  {
37
- id: PageID.ensure("a".repeat(24)),
37
+ id: PageID.validateOrCreate("a".repeat(24)),
38
38
  _type: "info-page",
39
39
  prefix: PagePrefix.fromStringOrThrow("p1"),
40
40
  mainText: {
@@ -45,28 +45,28 @@ const schemaDto1: BuilderSchemaDto = {
45
45
  },
46
46
 
47
47
  nextButton: {
48
- id: "next-button-text-id" as BuilderObjectId.QuestionOptionID,
48
+ id: "next-button-text-id" as OptionID,
49
49
  label: "Neste",
50
50
  value: -1,
51
51
  },
52
52
  defaultQuestion: {
53
- id: "q1" as BuilderObjectId.QuestionID,
53
+ id: QuestionID.create(),
54
54
  prefix: "one-prefix",
55
55
  _type: "select-one",
56
56
  text: "q1-text",
57
57
  options: [
58
58
  {
59
- id: "opt-nei" as BuilderObjectId.QuestionOptionID,
59
+ id: "opt-nei" as OptionID,
60
60
  value: 0,
61
61
  label: "Nei",
62
62
  },
63
63
  {
64
- id: "opt-ja" as BuilderObjectId.QuestionOptionID,
64
+ id: "opt-ja" as OptionID,
65
65
  value: 1,
66
66
  label: "Ja",
67
67
  },
68
68
  {
69
- id: "opt-vet-ikke" as BuilderObjectId.QuestionOptionID,
69
+ id: "opt-vet-ikke" as OptionID,
70
70
  value: 9,
71
71
  label: "Vet ikke",
72
72
  },
@@ -82,7 +82,7 @@ const schemaDto1: BuilderSchemaDto = {
82
82
  autoplaySequence: [],
83
83
  },
84
84
  {
85
- id: PageID.ensure("b".repeat(24)),
85
+ id: PageID.validateOrCreate("b".repeat(24)),
86
86
  _type: "multi-select",
87
87
  prefix: PagePrefix.fromStringOrThrow("page2-prefix"),
88
88
  tags: [tag3.tag],
@@ -93,12 +93,12 @@ const schemaDto1: BuilderSchemaDto = {
93
93
  audioFile: false,
94
94
  },
95
95
  nextButton: {
96
- id: "next-button-id-page2" as BuilderObjectId.QuestionOptionID,
96
+ id: "next-button-id-page2" as OptionID,
97
97
  label: "Neste",
98
98
  value: -1,
99
99
  },
100
100
  defaultQuestion: {
101
- id: "default-q" as BuilderObjectId.QuestionID,
101
+ id: QuestionID.validateOrCreate("default-question-id"),
102
102
  prefix: "one-prefix",
103
103
  _type: "select-one",
104
104
  text: "q1",
@@ -106,23 +106,23 @@ const schemaDto1: BuilderSchemaDto = {
106
106
  },
107
107
  questions: [
108
108
  {
109
- id: "q1" as BuilderObjectId.QuestionID,
109
+ id: QuestionID.create(),
110
110
  prefix: "one-prefix",
111
111
  _type: "select-one",
112
112
  text: "q1-text",
113
113
  options: [
114
114
  {
115
- id: "opt-nei" as BuilderObjectId.QuestionOptionID,
115
+ id: "opt-nei" as OptionID,
116
116
  value: 0,
117
117
  label: "Nei",
118
118
  },
119
119
  {
120
- id: "opt-ja" as BuilderObjectId.QuestionOptionID,
120
+ id: "opt-ja" as OptionID,
121
121
  value: 1,
122
122
  label: "Ja",
123
123
  },
124
124
  {
125
- id: "opt-vet-ikke" as BuilderObjectId.QuestionOptionID,
125
+ id: "opt-vet-ikke" as OptionID,
126
126
  value: 9,
127
127
  label: "Vet ikke",
128
128
  },
@@ -326,7 +326,7 @@ describe("Builder schema", () => {
326
326
  p2.defaultQuestion.addOption("Nei", 0);
327
327
 
328
328
  const ruleInput = builderSchema.getRuleInput();
329
- const ss1: SumScoreVariable = {
329
+ const ss1: SumScoreVariableDto = {
330
330
  label: "ss1",
331
331
  varId: "ss1_var_id",
332
332
  initialValue: 0,
@@ -13,14 +13,16 @@ import type { BuilderTagDto } from "./BuilderTag";
13
13
  import { BuilderTag, TagCollection } from "./BuilderTag";
14
14
  import { DefaultThemeCompiler } from "./theme/default-theme-compiler";
15
15
  import { ImageFile } from "./media-files";
16
- import { DUtil, SchemaID } from "@media-quest/engine";
16
+ import { DUtil } from "@media-quest/engine";
17
17
  import { PagePrefix } from "./primitives/page-prefix";
18
18
  import { SchemaPrefix, SchemaPrefixValue } from "./primitives/schema-prefix";
19
19
  import { CodeBook } from "./codebook";
20
- import { PredefinedVariable } from "./variable/mq-variable";
20
+ import { PredefinedVariable } from "./variable/b-variable";
21
21
  import { SchemaConfig } from "./schema-config";
22
22
  import { CompilerOption, CompilerOutput } from "./builder-compiler";
23
- import { SumScoreVariable } from "./variable/sum-score";
23
+
24
+ import { SumScoreVariableDto } from "./variable/sum-score-variable";
25
+ import { SchemaID } from "./primitives/ID";
24
26
 
25
27
  const U = DUtil;
26
28
 
@@ -34,13 +36,13 @@ export interface BuilderSchemaDto {
34
36
  readonly baseHeight: number;
35
37
  readonly baseWidth: number;
36
38
  readonly predefinedVariables?: Array<PredefinedVariable>;
37
- readonly sumScoreVariables?: Array<SumScoreVariable>;
39
+ readonly sumScoreVariables?: ReadonlyArray<SumScoreVariableDto>;
38
40
  readonly rules: ReadonlyArray<BuilderRuleDto>;
39
41
  readonly tags: ReadonlyArray<BuilderTagDto>;
40
42
  }
41
43
 
42
44
  class SumScoreVariableCollection {
43
- private _all: Array<SumScoreVariable> = [];
45
+ private _all: Array<SumScoreVariableDto> = [];
44
46
  }
45
47
 
46
48
  export class BuilderSchema {
@@ -52,11 +54,11 @@ export class BuilderSchema {
52
54
  mainImage: ImageFile | false = false;
53
55
  predefinedVariables: PredefinedVariable[] = [];
54
56
  private _rules: BuilderRule[] = [];
55
- private _sumVariables: SumScoreVariable[] = [];
57
+ private _sumVariables: SumScoreVariableDto[] = [];
56
58
  get rules(): ReadonlyArray<BuilderRule> {
57
59
  return [...this._rules];
58
60
  }
59
- get sumScoreVariables(): ReadonlyArray<SumScoreVariable> {
61
+ get sumScoreVariables(): ReadonlyArray<SumScoreVariableDto> {
60
62
  return [...this._sumVariables];
61
63
  }
62
64
 
@@ -77,6 +79,7 @@ export class BuilderSchema {
77
79
  const schemaPrefix = SchemaPrefix.castOrCreateRandom(dto.prefix);
78
80
  const schema = new BuilderSchema(dto.id, dto.name, schemaPrefix);
79
81
  const pages = dto.pages.map(BuilderPage.fromJson);
82
+
80
83
  schema._tagCollection.init(dto.tags);
81
84
  schema.backgroundColor = dto.backgroundColor;
82
85
  schema.baseHeight = dto.baseHeight;
@@ -87,6 +90,8 @@ export class BuilderSchema {
87
90
  schema.mainImage = dto.mainImage ?? false;
88
91
  const rulesDto = dto.rules ?? [];
89
92
  const ruleInput = schema.getRuleInput();
93
+
94
+ schema._sumVariables = Array.isArray(dto.sumScoreVariables) ? [...dto.sumScoreVariables] : [];
90
95
  schema._rules = rulesDto.map((r) => BuilderRule.fromDto(r, ruleInput));
91
96
  return schema;
92
97
  }
@@ -106,6 +111,7 @@ export class BuilderSchema {
106
111
  rules,
107
112
  tags,
108
113
  predefinedVariables: this.predefinedVariables,
114
+ sumScoreVariables: [...this.sumScoreVariables],
109
115
  mainImage: this.mainImage,
110
116
  prefix: this.prefix.value,
111
117
  };
@@ -130,7 +136,7 @@ export class BuilderSchema {
130
136
  return newPage;
131
137
  }
132
138
 
133
- addSumScoreVariable(variable: SumScoreVariable) {
139
+ addSumScoreVariable(variable: SumScoreVariableDto) {
134
140
  // TODO VALIDATE.
135
141
  this._sumVariables.push({ ...variable });
136
142
  }
@@ -1,24 +1,24 @@
1
- import type { BuilderTextDto } from "./Builder-text";
2
- import { BuilderText } from "./Builder-text";
3
- import type { BuilderObjectId } from "./BuilderObject";
4
-
5
- const textDto: BuilderTextDto = {
6
- id: "dto1" as BuilderObjectId.TextID,
7
- name: "dto1-name",
8
- text: "text one",
9
- translationRequired: true,
10
- };
11
-
12
- let text1 = BuilderText.create("text one created");
13
-
14
- beforeEach(() => {
15
- text1 = BuilderText.create("text one created");
16
- });
17
-
18
- describe("Builder Text", () => {
19
- test("Can serialize", () => {
20
- const instance1 = BuilderText.fromJson(textDto);
21
- const json = instance1.toJson();
22
- expect(textDto).toStrictEqual(json);
23
- });
24
- });
1
+ import type { BuilderTextDto } from "./Builder-text";
2
+ import { BuilderText } from "./Builder-text";
3
+ import { TextID } from "./primitives/ID";
4
+
5
+ const textDto: BuilderTextDto = {
6
+ id: "dto1" as TextID,
7
+ name: "dto1-name",
8
+ text: "text one",
9
+ translationRequired: true,
10
+ };
11
+
12
+ let text1 = BuilderText.create("text one created");
13
+
14
+ beforeEach(() => {
15
+ text1 = BuilderText.create("text one created");
16
+ });
17
+
18
+ describe("Builder Text", () => {
19
+ test("Can serialize", () => {
20
+ const instance1 = BuilderText.fromJson(textDto);
21
+ const json = instance1.toJson();
22
+ expect(textDto).toStrictEqual(json);
23
+ });
24
+ });
@@ -1,57 +1,57 @@
1
- import { BuilderObjectId, BuilderObject } from './BuilderObject';
2
-
3
- export interface BuilderTextDto {
4
- readonly id: BuilderObjectId.TextID;
5
- text: string;
6
- name: string;
7
- translationRequired: boolean;
8
- }
9
-
10
- export class BuilderText extends BuilderObject<'builder-text', BuilderTextDto> {
11
- readonly objectType = 'builder-text';
12
- id: BuilderObjectId.TextID;
13
- text = '';
14
- name = '';
15
- translateRequired = false;
16
- // audio: {id: B}
17
- private constructor(dto: BuilderTextDto) {
18
- super(dto);
19
- this.id = dto.id;
20
- this.translateRequired = dto.translationRequired;
21
- this.name = dto.name;
22
- this.text = dto.text;
23
- }
24
-
25
- public static create(name: string) {
26
- const id = BuilderObjectId.textId();
27
- const dto: BuilderTextDto = {
28
- id,
29
- name,
30
- text: '',
31
- translationRequired: false
32
- };
33
- const instance = new BuilderText(dto);
34
- return instance;
35
- }
36
- public static fromJson(dto: BuilderTextDto) {
37
- const instance = new BuilderText(dto);
38
- return instance;
39
- }
40
-
41
- clone(): BuilderTextDto {
42
- const newId = BuilderObjectId.textId();
43
- const dto = this.toJson();
44
- const withNewId: BuilderTextDto = { ...dto, id: newId };
45
- return withNewId;
46
- }
47
-
48
- toJson(): BuilderTextDto {
49
- const dto: BuilderTextDto = {
50
- id: this.id,
51
- name: this.name,
52
- text: this.text,
53
- translationRequired: this.translateRequired
54
- };
55
- return dto;
56
- }
57
- }
1
+ import { BuilderObject } from "./BuilderObject";
2
+ import { TextID } from "./primitives/ID";
3
+
4
+ export interface BuilderTextDto {
5
+ readonly id: TextID;
6
+ text: string;
7
+ name: string;
8
+ translationRequired: boolean;
9
+ }
10
+
11
+ export class BuilderText extends BuilderObject<"builder-text", BuilderTextDto> {
12
+ readonly objectType = "builder-text";
13
+ id: TextID;
14
+ text = "";
15
+ name = "";
16
+ translateRequired = false;
17
+ // audio: {id: B}
18
+ private constructor(dto: BuilderTextDto) {
19
+ super(dto);
20
+ this.id = dto.id;
21
+ this.translateRequired = dto.translationRequired;
22
+ this.name = dto.name;
23
+ this.text = dto.text;
24
+ }
25
+
26
+ public static create(name: string) {
27
+ const id = TextID.create();
28
+ const dto: BuilderTextDto = {
29
+ id,
30
+ name,
31
+ text: "",
32
+ translationRequired: false,
33
+ };
34
+ const instance = new BuilderText(dto);
35
+ return instance;
36
+ }
37
+ public static fromJson(dto: BuilderTextDto) {
38
+ const instance = new BuilderText(dto);
39
+ return instance;
40
+ }
41
+
42
+ clone(): BuilderTextDto {
43
+ const dto = this.toJson();
44
+ const withNewId: BuilderTextDto = { ...dto, id: TextID.create() };
45
+ return withNewId;
46
+ }
47
+
48
+ toJson(): BuilderTextDto {
49
+ const dto: BuilderTextDto = {
50
+ id: this.id,
51
+ name: this.name,
52
+ text: this.text,
53
+ translationRequired: this.translateRequired,
54
+ };
55
+ return dto;
56
+ }
57
+ }
@@ -1,61 +1,29 @@
1
- import { DUtil } from "@media-quest/engine";
2
-
3
- const U = DUtil;
4
- /**
5
- * Builder objects are complex objects that are embedded inside
6
- * a Builder-schema, and needs to be serialized to json. Often these objects
7
- * are used in collections, and that is why most of them need an id.
8
- */
9
- type BuilderObjectType =
10
- | "builder-page"
11
- | "builder-question-option"
12
- | "builder-question"
13
- | "builder-main-text"
14
- | "builder-text"
15
- | "builder-rule"
16
- | "builder-tag"
17
- | "builder-condition"
18
- | "builder-variable"
19
- | "builder-condition-group";
20
-
21
- export namespace BuilderObjectId {
22
- export type QuestionOptionID = string & { __OPTION__ID__: true };
23
- export type QuestionID = string & { __QUESTION__ID__: true };
24
- export type TextID = string & { __TEXT__ID__: true };
25
- export type MainTextID = string & { __MAIN__TEXT__ID__: true };
26
- export type TagId = string & { __TAG__ID__: true };
27
- export const createTagId = (): TagId => {
28
- return createId("builder-tag") as TagId;
29
- };
30
-
31
- export const mainTextId = (): MainTextID => {
32
- return createId("builder-main-text") as MainTextID;
33
- };
34
- export const textId = (): TextID => {
35
- return createId("builder-text") as TextID;
36
- };
37
-
38
- export const questionOptionId = (): QuestionOptionID => {
39
- return createId("builder-question-option") as QuestionOptionID;
40
- };
41
- export const questionId = (): QuestionID => {
42
- return createId("builder-question") as QuestionID;
43
- };
44
-
45
- const createId = (type: BuilderObjectType): string => {
46
- const id = U.randomString(24);
47
- return type + "-" + id;
48
- };
49
- }
50
-
51
- export abstract class BuilderObject<T extends BuilderObjectType, Dto extends {}> {
52
- // abstract readonly id: string;
53
- abstract readonly objectType: T;
54
- abstract toJson(): Dto;
55
- abstract clone(): Dto;
56
- protected readonly originalDto: Dto;
57
- protected constructor(dto: Dto) {
58
- this.originalDto = dto;
59
- // this.objectId = dto.objectId;
60
- }
61
- }
1
+ /**
2
+ * Builder objects are complex objects that are embedded inside
3
+ * a Builder-schema, and needs to be serialized to json. Often these objects
4
+ * are used in collections, and that is why most of them need an id.
5
+ */
6
+ type BuilderObjectType =
7
+ | "builder-page"
8
+ | "builder-question-option"
9
+ | "builder-question"
10
+ | "builder-main-text"
11
+ | "builder-text"
12
+ | "builder-rule"
13
+ | "builder-tag"
14
+ | "builder-sum-score-variable"
15
+ | "builder-condition"
16
+ | "builder-variable"
17
+ | "builder-condition-group";
18
+
19
+ export abstract class BuilderObject<T extends BuilderObjectType, Dto extends {}> {
20
+ // abstract readonly id: string;
21
+ abstract readonly objectType: T;
22
+ abstract toJson(): Dto;
23
+ abstract clone(): Dto;
24
+ protected readonly originalDto: Dto;
25
+ protected constructor(dto: Dto) {
26
+ this.originalDto = dto;
27
+ // this.objectId = dto.objectId;
28
+ }
29
+ }