@media-quest/builder 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@media-quest/builder",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Builder library for Media-quest schemas",
5
5
  "main": "dist/public-api.js",
6
6
  "module": "dist/public-api.mjs",
@@ -13,6 +13,6 @@
13
13
  "prepublishOnly": "npm run build"
14
14
  },
15
15
  "dependencies": {
16
- "@media-quest/engine": "0.0.9"
16
+ "@media-quest/engine": "0.0.11"
17
17
  }
18
18
  }
@@ -4,7 +4,8 @@ import type { BuilderQuestionDto } from "./Builder-question";
4
4
  import { BuilderQuestion } from "./Builder-question";
5
5
  import type { BuilderObjectId } from "./BuilderObject";
6
6
  import { DUtil, PageID } from "@media-quest/engine";
7
- import { PagePrefix, SchemaPrefix } from "./prefix";
7
+ import { PagePrefix } from "./primitives/page-prefix";
8
+ import { SchemaPrefix } from "./primitives/schema-prefix";
8
9
 
9
10
  const U = DUtil;
10
11
  const deleteIdsFromPage = (page: BuilderPageDto) => {
@@ -9,7 +9,9 @@ import type { BuilderMainTextDto } from "./BuilderMainText";
9
9
  import { BuilderMainText } from "./BuilderMainText";
10
10
  import { BuilderVariableOption, QuestionVariable } from "./rulebuilder/RuleVariable";
11
11
  import { DUtil, PageID } from "@media-quest/engine";
12
- import { PagePrefix, PagePrefixValue, VarID, SchemaPrefix, SchemaPrefixValue } from "./prefix";
12
+ import { PagePrefix, PagePrefixValue } from "./primitives/page-prefix";
13
+ import { VarID } from "./primitives/varID";
14
+ import { SchemaPrefix, SchemaPrefixValue } from "./primitives/schema-prefix";
13
15
 
14
16
  const U = DUtil;
15
17
  export type BuilderPageType = "info-page" | "question" | "multi-select" | "form";
@@ -5,7 +5,8 @@ import type { BuilderTagDto } from "./BuilderTag";
5
5
  import { BuilderTag } from "./BuilderTag";
6
6
  import type { BuilderObjectId } from "./BuilderObject";
7
7
  import { PageID, SchemaID } from "@media-quest/engine";
8
- import { PagePrefix, SchemaPrefix } from "./prefix";
8
+ import { PagePrefix } from "./primitives/page-prefix";
9
+ import { SchemaPrefix } from "./primitives/schema-prefix";
9
10
 
10
11
  const tag1: BuilderTagDto = BuilderTag.create("tag1", "This tag is defined in schemaDto1").toJson();
11
12
 
@@ -166,7 +167,7 @@ describe("Builder schema", () => {
166
167
  test("Can create Schema from dto", () => {
167
168
  const s = BuilderSchema.fromJson(schemaDto1);
168
169
  expect(s.id).toBe(schemaDto1.id);
169
- expect(s.prefix).toBe(schemaDto1.prefix);
170
+ expect(s.prefix.value).toBe(schemaDto1.prefix);
170
171
  expect(s.baseHeight).toBe(schemaDto1.baseHeight);
171
172
  expect(s.baseWidth).toBe(schemaDto1.baseWidth);
172
173
  expect(s.backgroundColor).toBe(schemaDto1.backgroundColor);
@@ -11,18 +11,10 @@ import { BuilderRule } from "./rulebuilder";
11
11
  import { DefaultThemeCompiler } from "./theme/default-theme-compiler";
12
12
  import { ImageFile } from "./media-files";
13
13
  import { SchemaDto, DUtil, PageID, SchemaID } from "@media-quest/engine";
14
- import { PagePrefix, SchemaPrefix, SchemaPrefixValue } from "./prefix";
14
+ import { PagePrefix } from "./primitives/page-prefix";
15
+ import { SchemaPrefix, SchemaPrefixValue } from "./primitives/schema-prefix";
15
16
  const U = DUtil;
16
17
 
17
- class PrimitiveWrapper<T> {
18
- constructor(private readonly _value: T) {}
19
-
20
- get value(): T {
21
- return this._value;
22
- }
23
- }
24
-
25
- // type SchemaHash = string & { __MD5__HASH: true };
26
18
  export interface BuilderSchemaDto {
27
19
  readonly id: SchemaID;
28
20
  readonly prefix: SchemaPrefixValue;
@@ -43,7 +35,7 @@ export interface SchemaBuildOutput {
43
35
  }
44
36
 
45
37
  export class BuilderSchema {
46
- private readonly _prefix: SchemaPrefix;
38
+ readonly prefix: SchemaPrefix;
47
39
  baseHeight = 1300;
48
40
  baseWidth = 1024;
49
41
  backgroundColor = "#000000";
@@ -54,9 +46,9 @@ export class BuilderSchema {
54
46
  return [...this._rules];
55
47
  }
56
48
 
57
- get prefix(): SchemaPrefixValue {
58
- return this._prefix.value;
59
- }
49
+ // get prefix(): SchemaPrefixValue {
50
+ // return this._prefix.value;
51
+ // }
60
52
 
61
53
  private readonly _tagCollection: TagCollection = TagCollection.create();
62
54
  get tags(): ReadonlyArray<BuilderTag> {
@@ -99,16 +91,16 @@ export class BuilderSchema {
99
91
  rules,
100
92
  tags,
101
93
  mainImage: this.mainImage,
102
- prefix: this.prefix,
94
+ prefix: this.prefix.value,
103
95
  };
104
96
  return dto;
105
97
  }
106
98
  private constructor(
107
99
  public readonly id: SchemaID,
108
100
  public name: string,
109
- _prefix: SchemaPrefix,
101
+ prefix: SchemaPrefix,
110
102
  ) {
111
- this._prefix = _prefix;
103
+ this.prefix = prefix;
112
104
  }
113
105
 
114
106
  addPage(type: BuilderPageType, atIndex = -1): BuilderPage {
@@ -208,20 +200,22 @@ export class BuilderSchema {
208
200
  return excludeByTagDto;
209
201
  });
210
202
  const jumpActions: JumpToPageAction[] = [];
211
- const prefix = this.prefix;
212
203
  this.pages.forEach((page, index) => {
213
- const pageVariables = page.getQuestionVariables(this._prefix, index);
204
+ const pageVariables = page.getQuestionVariables(this.prefix, index);
214
205
  qVars.push(...pageVariables);
215
206
  const mainText = page.mainText.text;
207
+ const pagePrefix = page.prefix;
216
208
  const jumpAction: JumpToPageAction = {
217
209
  kind: "jump-to-page",
218
210
  pageId: page.id,
211
+ pagePrefix,
219
212
  pageNumber: index,
220
213
  mainText: page.mainText.text,
221
214
  };
222
215
  const excludePageAction: ExcludeByPageAction = {
223
216
  kind: "exclude-by-pageId",
224
217
  pageId: page.id,
218
+ pagePrefix,
225
219
  pageNumber: index,
226
220
  mainText,
227
221
  };
@@ -0,0 +1,58 @@
1
+ import { SchemaPrefix } from "./schema-prefix";
2
+
3
+ export type PagePrefixValue = string & { __PAGE_PREFIX__: true };
4
+ export const createRandomPrefix = <const P extends string>(length: number): P => {
5
+ const letters = "abcdefghijklmnopqrstuvyz";
6
+ const all = letters + letters.toUpperCase();
7
+ let result = "";
8
+ for (let i = 0; i < length; i++) {
9
+ const char = all.charAt(Math.floor(Math.random() * all.length));
10
+ result += char;
11
+ }
12
+ return result as P;
13
+ };
14
+
15
+ export class PagePrefix {
16
+ public static readonly MIN_LENGTH = 1;
17
+ private static randomLen = 5;
18
+ public static readonly MAX_LENGTH = 16;
19
+
20
+ public static create = (): PagePrefix => {
21
+ const v = createRandomPrefix<PagePrefixValue>(PagePrefix.randomLen);
22
+ return new PagePrefix(v);
23
+ };
24
+ public static fromString = (value: string): PagePrefix | false => {
25
+ if (!PagePrefix.isValid(value)) return false;
26
+ return new PagePrefix(value);
27
+ };
28
+
29
+ public static fromStringOrThrow = (value: string): PagePrefixValue => {
30
+ if (!PagePrefix.isValid(value)) throw new Error("Invalid prefix");
31
+ return value;
32
+ };
33
+ public static castOrCreateRandom = (value: string): PagePrefix => {
34
+ const v = PagePrefix.isValid(value) ? value : createRandomPrefix<PagePrefixValue>(PagePrefix.randomLen);
35
+ return new PagePrefix(v);
36
+ };
37
+
38
+ public static isValid = (prefix: string | 999): prefix is PagePrefixValue => {
39
+ if (typeof prefix !== "string") return false;
40
+ if (prefix.length < SchemaPrefix.MIN_LENGTH) return false;
41
+ if (prefix.length > SchemaPrefix.MAX_LENGTH) return false;
42
+ return true;
43
+ };
44
+
45
+ get value(): PagePrefixValue {
46
+ return this._value;
47
+ }
48
+
49
+ set value(value: string) {
50
+ if (!PagePrefix.isValid(value)) {
51
+ console.log("INVALID PREFIX", value);
52
+ } else {
53
+ this._value = value;
54
+ }
55
+ }
56
+
57
+ private constructor(private _value: PagePrefixValue) {}
58
+ }
File without changes
@@ -0,0 +1,52 @@
1
+ import { createRandomPrefix } from "./page-prefix";
2
+
3
+ export type SchemaPrefixValue = string & { __SCHEMA_PREFIX__: true };
4
+
5
+ export class SchemaPrefix {
6
+ public static readonly MIN_LENGTH = 1;
7
+ private static randomLen = 5;
8
+ public static readonly MAX_LENGTH = 16;
9
+
10
+ public static fromValue = (value: SchemaPrefixValue): SchemaPrefix => {
11
+ return new SchemaPrefix(value);
12
+ };
13
+
14
+ public static fromValueOrThrow = (value: string): SchemaPrefix => {
15
+ if (!SchemaPrefix.isValid(value)) throw new Error("Invalid prefix");
16
+ return new SchemaPrefix(value);
17
+ };
18
+ public static fromString = (value: string): SchemaPrefix | false => {
19
+ if (!SchemaPrefix.isValid(value)) return false;
20
+ return new SchemaPrefix(value);
21
+ };
22
+ public static castOrCreateRandom = (value: string): SchemaPrefix => {
23
+ const v = SchemaPrefix.isValid(value) ? value : createRandomPrefix<SchemaPrefixValue>(SchemaPrefix.randomLen);
24
+ return new SchemaPrefix(v);
25
+ };
26
+
27
+ public static isValid = (prefix: string | 999): prefix is SchemaPrefixValue => {
28
+ if (typeof prefix !== "string") return false;
29
+ if (prefix.length < SchemaPrefix.MIN_LENGTH) return false;
30
+ if (prefix.length > SchemaPrefix.MAX_LENGTH) return false;
31
+ return true;
32
+ };
33
+
34
+ toJSON() {}
35
+
36
+ get value(): SchemaPrefixValue {
37
+ return this._value;
38
+ }
39
+
40
+ get isValid() {
41
+ return SchemaPrefix.isValid(this._value);
42
+ }
43
+
44
+ set value(value: string) {
45
+ const casted = value as unknown;
46
+ if (typeof casted === "string") {
47
+ this._value = casted as SchemaPrefixValue;
48
+ }
49
+ }
50
+
51
+ private constructor(private _value: SchemaPrefixValue) {}
52
+ }
@@ -0,0 +1,11 @@
1
+ import { PagePrefixValue } from "./page-prefix";
2
+
3
+ import { SchemaPrefixValue } from "./schema-prefix";
4
+
5
+ export type VarID = `${SchemaPrefixValue}_${PagePrefixValue}`;
6
+ export const VarID = {
7
+ create: (schemaPrefix: SchemaPrefixValue, pagePrefix: PagePrefixValue): VarID => {
8
+ const varId = schemaPrefix + "_" + pagePrefix;
9
+ return varId as VarID;
10
+ },
11
+ };
package/src/public-api.ts CHANGED
@@ -8,6 +8,9 @@ export { BuilderMainText, type BuilderMainTextDto } from "./BuilderMainText";
8
8
  export { type BuilderMainVideoDto } from "./BuilderMainVideoDto";
9
9
  export { type BuilderTagDto, BuilderTag, TagCollection } from "./BuilderTag";
10
10
  export { type AudioFile, type ImageFile, type VideoFile } from "./media-files";
11
- export * from "./prefix";
12
11
  // Public Api of rule-builder
13
12
  export * from "./rulebuilder";
13
+ export { PagePrefix } from "./primitives/page-prefix";
14
+ export { createRandomPrefix } from "./primitives/page-prefix";
15
+ export { PagePrefixValue } from "./primitives/page-prefix";
16
+ export { VarID } from "./primitives/varID";
@@ -4,7 +4,9 @@ import { RuleInput } from "./RuleInput";
4
4
  import type { BuilderConditionGroupDto } from "./condition/Builder-condition-group";
5
5
  import { BuilderConditionDto } from "./condition/Builder-condition";
6
6
  import { Condition, PageID } from "@media-quest/engine";
7
- import { PagePrefix, VarID, SchemaPrefix } from "../prefix";
7
+ import { PagePrefix } from "../primitives/page-prefix";
8
+ import { VarID } from "../primitives/varID";
9
+ import { SchemaPrefix } from "../primitives/schema-prefix";
8
10
 
9
11
  const { createPagesAndVars_A_H } = U;
10
12
 
@@ -9,14 +9,14 @@ import { BuilderObject } from "../BuilderObject";
9
9
  import { TagActionManager } from "./tag-action-manager";
10
10
  import { PageActionManager } from "./page-action-manager";
11
11
  import { JumpToActionManager } from "./jump-to-action-manager";
12
- import { Condition, PageQueCommand, PageQueRules } from "@media-quest/engine";
12
+ import { Condition, PageID, PageQueCommand, PageQueRules } from "@media-quest/engine";
13
13
 
14
14
  export interface BuilderRuleDto {
15
15
  readonly type: ConditionGroupType;
16
16
  readonly name: string;
17
17
  readonly conditions: ReadonlyArray<BuilderConditionDto | BuilderConditionGroupDto>;
18
18
  readonly excludeTags: ReadonlyArray<string>;
19
- readonly excludePages: ReadonlyArray<string>;
19
+ readonly excludePages: ReadonlyArray<PageID>;
20
20
  readonly jumpToPage: string | false;
21
21
  }
22
22
  export class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
@@ -1,8 +1,11 @@
1
1
  import { PageID } from "@media-quest/engine";
2
2
 
3
+ import { PagePrefixValue } from "../primitives/page-prefix";
4
+
3
5
  export interface ExcludeByPageAction {
4
6
  readonly kind: "exclude-by-pageId";
5
7
  readonly pageId: PageID;
8
+ readonly pagePrefix: PagePrefixValue;
6
9
  readonly mainText: string;
7
10
  readonly pageNumber: number;
8
11
  }
@@ -10,6 +13,7 @@ export interface ExcludeByPageAction {
10
13
  export interface JumpToPageAction {
11
14
  readonly kind: "jump-to-page";
12
15
  readonly pageId: PageID;
16
+ readonly pagePrefix: PagePrefixValue;
13
17
  readonly mainText: string;
14
18
  readonly pageNumber: number;
15
19
  }
@@ -20,3 +24,83 @@ export interface ExcludeByTagAction {
20
24
  readonly description: string;
21
25
  readonly pageCount: number;
22
26
  }
27
+
28
+ // interface ISearchable {
29
+ // getLabel(): string;
30
+ // getTooltip(): string;
31
+ // getSearchString(): string;
32
+ // }
33
+ // interface ISelectable {
34
+ // isSelected: boolean;
35
+ // }
36
+ //
37
+ // export class PageAction implements ISearchable, ISelectable {
38
+ // public readonly description = "Will exclude this page from the survey.";
39
+ // private _isSelected: boolean = false;
40
+ // get isSelected(): boolean {
41
+ // return this._isSelected;
42
+ // }
43
+ // set isSelected(value: boolean) {
44
+ // const casted = value as unknown;
45
+ // if (typeof casted === "boolean") {
46
+ // this._isSelected = casted;
47
+ // }
48
+ // }
49
+ // get pageId(): PageID {
50
+ // return this.data.pageId;
51
+ // }
52
+ // get pagePrefix(): PagePrefixValue {
53
+ // return this.data.pagePrefix;
54
+ // }
55
+ // get mainText(): string {
56
+ // return this.data.mainText;
57
+ // }
58
+ // get pageNumber(): number {
59
+ // return this.data.pageNumber;
60
+ // }
61
+ // constructor(
62
+ // private readonly data: {
63
+ // pageId: PageID;
64
+ // pagePrefix: PagePrefixValue;
65
+ // mainText: string;
66
+ // pageNumber: number;
67
+ // isSelected: boolean;
68
+ // },
69
+ // ) {
70
+ // this.isSelected = this.data.isSelected;
71
+ // }
72
+ //
73
+ // getLabel(): string {
74
+ // return this.data.pagePrefix + " (" + this.data.pageNumber + ")";
75
+ // }
76
+ // getTooltip(): string {
77
+ // return this.data.mainText;
78
+ // }
79
+ // getSearchString(): string {
80
+ // return this.data.pagePrefix + this.data.mainText;
81
+ // }
82
+ // }
83
+ // export class TagAction implements ISearchable {
84
+ // constructor(
85
+ // readonly tag: string,
86
+ // readonly description: string,
87
+ // readonly usedInPages: { pageNumber: number; pagePrefix: PagePrefixValue }[],
88
+ // ) {}
89
+ // getLabel(): string {
90
+ // return this.tag + " (" + this.usedInPages.length + ")";
91
+ // }
92
+ // getTooltip(): string {
93
+ // return this.description;
94
+ // }
95
+ // getSearchString(): string {
96
+ // return this.tag;
97
+ // }
98
+ // }
99
+
100
+ // class SelectableCollection<T> {
101
+ // private readonly _items: Array<T>;
102
+ // private selected: T | false = false;
103
+ // constructor(items: ReadonlyArray<T>) {
104
+ // this._items = [...items];
105
+ // }
106
+ // }
@@ -7,9 +7,15 @@ import type { BuilderOperator } from "./condition/Builder-operator";
7
7
  import type { ExcludeByPageAction, ExcludeByTagAction, JumpToPageAction } from "./RuleAction";
8
8
  import { ExcludeByPageIdSelectItem, ExcludeByTagSelectItem } from "./multi-select-item";
9
9
  import { PageID } from "@media-quest/engine";
10
- import { PagePrefix, VarID, SchemaPrefix } from "../prefix";
10
+ import { PagePrefix, PagePrefixValue } from "../primitives/page-prefix";
11
+ import { VarID } from "../primitives/varID";
12
+ import { SchemaPrefix } from "../primitives/schema-prefix";
11
13
 
12
- const id = () => PageID.create();
14
+ const idPxx = () => {
15
+ const id = PageID.create();
16
+ const prefix = PagePrefix.fromStringOrThrow("pxx");
17
+ return { id, prefix: prefix };
18
+ };
13
19
  export namespace RuleBuilderTestUtils {
14
20
  export const createOptions = () => [
15
21
  BuilderOption.create(0, "Nei"),
@@ -29,18 +35,22 @@ export namespace RuleBuilderTestUtils {
29
35
  };
30
36
 
31
37
  export const excludeByPageIdAction = (pageId: PageID, pageNumber: number) => {
38
+ const pagePrefix = PagePrefix.castOrCreateRandom("").value;
32
39
  const action: ExcludeByPageAction = {
33
40
  kind: "exclude-by-pageId",
34
41
  mainText: "",
35
42
  pageId,
43
+ pagePrefix,
36
44
  pageNumber,
37
45
  };
38
46
  return action;
39
47
  };
40
48
  export const jumpToPageAction = (pageId: PageID, pageNumber: number) => {
49
+ const pagePrefix = PagePrefix.castOrCreateRandom("").value;
41
50
  const action: JumpToPageAction = {
42
51
  kind: "jump-to-page",
43
52
  mainText: "TEXT: " + pageId,
53
+ pagePrefix,
44
54
  pageId,
45
55
  pageNumber,
46
56
  };
@@ -150,7 +160,8 @@ export namespace RuleBuilderTestUtils {
150
160
  ExcludeByPageIdSelectItem.create(
151
161
  {
152
162
  kind: "exclude-by-pageId",
153
- pageId: id(),
163
+ pageId: idPxx().id,
164
+ pagePrefix: idPxx().prefix,
154
165
  pageNumber: 5,
155
166
  mainText: "Har du noen gang vært deprimeri?? ",
156
167
  },
@@ -160,7 +171,8 @@ export namespace RuleBuilderTestUtils {
160
171
  ExcludeByPageIdSelectItem.create(
161
172
  {
162
173
  kind: "exclude-by-pageId",
163
- pageId: id(),
174
+ pageId: idPxx().id,
175
+ pagePrefix: idPxx().prefix,
164
176
  pageNumber: 5,
165
177
  mainText: "Har du noen gang vært deprimeri?? ",
166
178
  },
@@ -170,7 +182,8 @@ export namespace RuleBuilderTestUtils {
170
182
  ExcludeByPageIdSelectItem.create(
171
183
  {
172
184
  kind: "exclude-by-pageId",
173
- pageId: id(),
185
+ pageId: idPxx().id,
186
+ pagePrefix: idPxx().prefix,
174
187
  pageNumber: 5,
175
188
  mainText: "Har du noen gang vært deprimeri?? ",
176
189
  },
@@ -180,7 +193,8 @@ export namespace RuleBuilderTestUtils {
180
193
  ExcludeByPageIdSelectItem.create(
181
194
  {
182
195
  kind: "exclude-by-pageId",
183
- pageId: id(),
196
+ pageId: idPxx().id,
197
+ pagePrefix: idPxx().prefix,
184
198
  pageNumber: 5,
185
199
  mainText: "Har du noen gang vært deprimeri?? ",
186
200
  },
@@ -190,7 +204,8 @@ export namespace RuleBuilderTestUtils {
190
204
  ExcludeByPageIdSelectItem.create(
191
205
  {
192
206
  kind: "exclude-by-pageId",
193
- pageId: id(),
207
+ pageId: idPxx().id,
208
+ pagePrefix: idPxx().prefix,
194
209
  pageNumber: 5,
195
210
  mainText: "Har du noen gang vært deprimeri?? ",
196
211
  },
@@ -199,7 +214,8 @@ export namespace RuleBuilderTestUtils {
199
214
  ExcludeByPageIdSelectItem.create(
200
215
  {
201
216
  kind: "exclude-by-pageId",
202
- pageId: id(),
217
+ pageId: idPxx().id,
218
+ pagePrefix: idPxx().prefix,
203
219
  pageNumber: 5,
204
220
  mainText: "Har du noen gang vært deprimeri?? ",
205
221
  },
@@ -209,7 +225,8 @@ export namespace RuleBuilderTestUtils {
209
225
  ExcludeByPageIdSelectItem.create(
210
226
  {
211
227
  kind: "exclude-by-pageId",
212
- pageId: id(),
228
+ pageId: idPxx().id,
229
+ pagePrefix: idPxx().prefix,
213
230
  pageNumber: 5,
214
231
  mainText: "Har du noen gang vært deprimeri?? ",
215
232
  },
@@ -219,7 +236,8 @@ export namespace RuleBuilderTestUtils {
219
236
  ExcludeByPageIdSelectItem.create(
220
237
  {
221
238
  kind: "exclude-by-pageId",
222
- pageId: id(),
239
+ pageId: idPxx().id,
240
+ pagePrefix: idPxx().prefix,
223
241
  pageNumber: 5,
224
242
  mainText: "Har du noen gang vært deprimeri?? ",
225
243
  },
@@ -229,7 +247,8 @@ export namespace RuleBuilderTestUtils {
229
247
  ExcludeByPageIdSelectItem.create(
230
248
  {
231
249
  kind: "exclude-by-pageId",
232
- pageId: id(),
250
+ pageId: idPxx().id,
251
+ pagePrefix: idPxx().prefix,
233
252
  pageNumber: 5,
234
253
  mainText: "Har du noen gang vært deprimeri?? ",
235
254
  },
@@ -239,7 +258,8 @@ export namespace RuleBuilderTestUtils {
239
258
  ExcludeByPageIdSelectItem.create(
240
259
  {
241
260
  kind: "exclude-by-pageId",
242
- pageId: id(),
261
+ pageId: idPxx().id,
262
+ pagePrefix: idPxx().prefix,
243
263
  pageNumber: 5,
244
264
  mainText: "Har du noen gang vært deprimeri?? ",
245
265
  },
@@ -1,4 +1,6 @@
1
- import { PagePrefix, VarID, SchemaPrefix } from "../prefix";
1
+ import { PagePrefix } from "../primitives/page-prefix";
2
+ import { VarID } from "../primitives/varID";
3
+ import { SchemaPrefix } from "../primitives/schema-prefix";
2
4
 
3
5
  const BuilderVariableType = {
4
6
  numericWithOptions: true,
@@ -122,11 +122,11 @@ export class JumpToPageSelectItem extends SingleSelectItem<JumpToPageAction> {
122
122
  }
123
123
 
124
124
  protected getSearchString(): string {
125
- return this.data.pageId + this.data.mainText;
125
+ return this.data.pagePrefix + this.data.mainText;
126
126
  }
127
127
 
128
128
  protected getSelectLabel(): string {
129
- return this.data.pageId + " (" + this.data.pageNumber + ")";
129
+ return this.data.pagePrefix + " (" + this.data.pageNumber + ")";
130
130
  }
131
131
 
132
132
  protected getTooltip(): string {
@@ -2,7 +2,8 @@ import { BuilderCondition, type BuilderConditionDto } from "./Builder-condition"
2
2
  import { RuleBuilderTestUtils } from "../RuleBuilder-test-utils";
3
3
  import type { BuilderVariable, BuilderVariableOption } from "../RuleVariable";
4
4
  import { QuestionVariable } from "../RuleVariable";
5
- import { SchemaPrefix } from "../../prefix";
5
+
6
+ import { SchemaPrefix } from "../../primitives/schema-prefix";
6
7
 
7
8
  let condition = BuilderCondition.create([]);
8
9