@media-quest/builder 0.0.2 → 0.0.4
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/dist/public-api.d.mts +35 -11
- package/dist/public-api.d.ts +35 -11
- package/dist/public-api.js +455 -47
- package/dist/public-api.mjs +427 -37
- package/package.json +3 -4
- package/src/Builder-option.ts +51 -52
- package/src/Builder-schema.ts +1 -0
- package/src/public-api.ts +3 -0
- package/src/rulebuilder/Builder-rule.spec.ts +266 -182
- package/src/rulebuilder/Builder-rule.ts +106 -67
- package/src/rulebuilder/Rule2.ts +87 -0
- package/src/rulebuilder/RuleBuilder-test-utils.ts +250 -239
- package/src/rulebuilder/RuleVariable.ts +13 -9
- package/src/rulebuilder/SingleSelectItem.ts +118 -118
- package/src/rulebuilder/{Builder-condition-group.ts → condition/Builder-condition-group.ts} +42 -33
- package/src/rulebuilder/condition/Builder-condition.spec.ts +185 -0
- package/src/rulebuilder/condition/Builder-condition.ts +208 -0
- package/src/rulebuilder/index.ts +11 -11
- package/src/rulebuilder/jump-to-action-manager.ts +26 -26
- package/src/rulebuilder/page-action-manager.ts +23 -13
- package/src/rulebuilder/tag-action-manager.ts +23 -13
- package/src/theme/default-theme-compiler.ts +26 -1
- package/src/rulebuilder/Builder-condition.spec.ts +0 -169
- package/src/rulebuilder/Builder-condition.ts +0 -186
- /package/src/rulebuilder/{Builder-condition-group.spec.ts → condition/Builder-condition-group.spec.ts} +0 -0
- /package/src/rulebuilder/{Builder-operator.spec.ts → condition/Builder-operator.spec.ts} +0 -0
- /package/src/rulebuilder/{Builder-operator.ts → condition/Builder-operator.ts} +0 -0
package/dist/public-api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DStyle, SchemaDto } from '@media-quest/engine';
|
|
1
|
+
import { DStyle, Condition, PageQueRules, SchemaDto } from '@media-quest/engine';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Builder objects are complex objects that are embedded inside
|
|
@@ -182,6 +182,7 @@ declare class BuilderMainText extends BuilderObject<"builder-main-text", Builder
|
|
|
182
182
|
|
|
183
183
|
declare const BuilderVariableType: {
|
|
184
184
|
readonly numericWithOptions: true;
|
|
185
|
+
readonly numeric: true;
|
|
185
186
|
readonly numericRange: true;
|
|
186
187
|
readonly text: true;
|
|
187
188
|
readonly date: true;
|
|
@@ -201,7 +202,7 @@ declare class QuestionVariable {
|
|
|
201
202
|
readonly label: string;
|
|
202
203
|
readonly options: ReadonlyArray<BuilderVariableOption>;
|
|
203
204
|
readonly pageNumber: number;
|
|
204
|
-
readonly kind:
|
|
205
|
+
readonly kind: "question-variable";
|
|
205
206
|
readonly dataType: BuilderVariableType;
|
|
206
207
|
constructor(varId: string, label: string, options: ReadonlyArray<BuilderVariableOption>, pageNumber: number);
|
|
207
208
|
}
|
|
@@ -209,7 +210,7 @@ declare class CustomVariable {
|
|
|
209
210
|
readonly varId: string;
|
|
210
211
|
readonly label: string;
|
|
211
212
|
readonly options: ReadonlyArray<BuilderVariableOption>;
|
|
212
|
-
readonly kind:
|
|
213
|
+
readonly kind: "configuration-variable";
|
|
213
214
|
readonly dataType: BuilderVariableType;
|
|
214
215
|
constructor(varId: string, label: string, options: ReadonlyArray<BuilderVariableOption>);
|
|
215
216
|
}
|
|
@@ -444,6 +445,7 @@ declare class BuilderCondition extends BuilderObject<"builder-condition", Builde
|
|
|
444
445
|
isValid: false;
|
|
445
446
|
message: string;
|
|
446
447
|
};
|
|
448
|
+
toEngineCondition(): Condition.Simple | false;
|
|
447
449
|
private findVariableInUniverse;
|
|
448
450
|
set operator(operator: BuilderOperator | "");
|
|
449
451
|
get operator(): BuilderOperator | "";
|
|
@@ -464,14 +466,14 @@ declare const ConditionGroupType: {
|
|
|
464
466
|
};
|
|
465
467
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
468
|
interface BuilderConditionGroupDto {
|
|
467
|
-
readonly kind:
|
|
469
|
+
readonly kind: "condition-group";
|
|
468
470
|
readonly name: string;
|
|
469
471
|
readonly type: ConditionGroupType;
|
|
470
472
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
473
|
}
|
|
472
|
-
declare class BuilderConditionGroup extends BuilderObject<
|
|
474
|
+
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
475
|
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count" | "range";
|
|
474
|
-
readonly objectType:
|
|
476
|
+
readonly objectType: "builder-condition-group";
|
|
475
477
|
private _type;
|
|
476
478
|
name: string;
|
|
477
479
|
private readonly _conditions;
|
|
@@ -484,6 +486,7 @@ declare class BuilderConditionGroup extends BuilderObject<'builder-condition-gro
|
|
|
484
486
|
removeCondition(condition: BuilderCondition): boolean;
|
|
485
487
|
clone(): BuilderConditionGroupDto;
|
|
486
488
|
toJson(): BuilderConditionGroupDto;
|
|
489
|
+
toEngineConditionComplex(): Condition.Complex | false;
|
|
487
490
|
get type(): ConditionGroupType;
|
|
488
491
|
set type(conditionGroupType: ConditionGroupType);
|
|
489
492
|
}
|
|
@@ -538,14 +541,14 @@ interface BuilderRuleDto {
|
|
|
538
541
|
readonly excludePages: ReadonlyArray<string>;
|
|
539
542
|
readonly jumpToPage: string | false;
|
|
540
543
|
}
|
|
541
|
-
declare class BuilderRule extends BuilderObject<
|
|
544
|
+
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
542
545
|
private readonly dto;
|
|
543
546
|
private readonly _ruleInput;
|
|
544
|
-
readonly objectType:
|
|
547
|
+
readonly objectType: "builder-rule";
|
|
545
548
|
private _type;
|
|
546
549
|
name: string;
|
|
547
550
|
private readonly _conditions;
|
|
548
|
-
private _tagActionManager;
|
|
551
|
+
private readonly _tagActionManager;
|
|
549
552
|
private _pageActionManager;
|
|
550
553
|
readonly jumpToActionManager: JumpToActionManager;
|
|
551
554
|
static readonly fromDto: (dto: BuilderRuleDto, input: RuleInput) => BuilderRule;
|
|
@@ -561,6 +564,27 @@ declare class BuilderRule extends BuilderObject<'builder-rule', BuilderRuleDto>
|
|
|
561
564
|
addConditionGroup(): BuilderConditionGroup;
|
|
562
565
|
clone(): BuilderRuleDto;
|
|
563
566
|
toJson(): BuilderRuleDto;
|
|
567
|
+
toEngineRule(): PageQueRules;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare class PageActionManager {
|
|
571
|
+
readonly validOptions: RuleInput["_pageIdActions"];
|
|
572
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
573
|
+
private readonly _initialSelection;
|
|
574
|
+
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
575
|
+
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
576
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
577
|
+
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare class TagActionManager {
|
|
581
|
+
readonly validOptions: RuleInput["_tagActions"];
|
|
582
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
583
|
+
private readonly _initialSelection;
|
|
584
|
+
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
585
|
+
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
586
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
587
|
+
getEngineActions(): ReadonlyArray<ExcludeByTagAction>;
|
|
564
588
|
}
|
|
565
589
|
|
|
566
590
|
interface BuilderSchemaDto {
|
|
@@ -600,7 +624,7 @@ declare class BuilderSchema {
|
|
|
600
624
|
addPage(type: BuilderPageType, atIndex?: number): BuilderPage;
|
|
601
625
|
insertPage(page: BuilderPage, atIndex: number): boolean;
|
|
602
626
|
private insertPageAtIndex;
|
|
603
|
-
addRule():
|
|
627
|
+
addRule(): BuilderRule;
|
|
604
628
|
deleteRule(rule: BuilderRule): void;
|
|
605
629
|
movePage(page: BuilderPage, toIndex: number): boolean;
|
|
606
630
|
deletePage(page: BuilderPage): boolean;
|
|
@@ -631,4 +655,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
631
655
|
toJson(): BuilderTextDto;
|
|
632
656
|
}
|
|
633
657
|
|
|
634
|
-
export { AudioFile, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, ImageFile, TagCollection, VideoFile };
|
|
658
|
+
export { AudioFile, BuilderCondition, BuilderConditionDto, BuilderConditionGroup, BuilderConditionGroupDto, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOperator, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderRule, BuilderRuleDto, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, BuilderVariable, BuilderVariableOption, ConditionGroupType, CustomVariable, ExcludeByPageAction, ExcludeByPageIdSelectItem, ExcludeByTagAction, ExcludeByTagSelectItem, ImageFile, JumpToActionManager, JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, PageActionManager, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem, SingleSelectItem, TagActionManager, TagCollection, VideoFile };
|
package/dist/public-api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DStyle, SchemaDto } from '@media-quest/engine';
|
|
1
|
+
import { DStyle, Condition, PageQueRules, SchemaDto } from '@media-quest/engine';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Builder objects are complex objects that are embedded inside
|
|
@@ -182,6 +182,7 @@ declare class BuilderMainText extends BuilderObject<"builder-main-text", Builder
|
|
|
182
182
|
|
|
183
183
|
declare const BuilderVariableType: {
|
|
184
184
|
readonly numericWithOptions: true;
|
|
185
|
+
readonly numeric: true;
|
|
185
186
|
readonly numericRange: true;
|
|
186
187
|
readonly text: true;
|
|
187
188
|
readonly date: true;
|
|
@@ -201,7 +202,7 @@ declare class QuestionVariable {
|
|
|
201
202
|
readonly label: string;
|
|
202
203
|
readonly options: ReadonlyArray<BuilderVariableOption>;
|
|
203
204
|
readonly pageNumber: number;
|
|
204
|
-
readonly kind:
|
|
205
|
+
readonly kind: "question-variable";
|
|
205
206
|
readonly dataType: BuilderVariableType;
|
|
206
207
|
constructor(varId: string, label: string, options: ReadonlyArray<BuilderVariableOption>, pageNumber: number);
|
|
207
208
|
}
|
|
@@ -209,7 +210,7 @@ declare class CustomVariable {
|
|
|
209
210
|
readonly varId: string;
|
|
210
211
|
readonly label: string;
|
|
211
212
|
readonly options: ReadonlyArray<BuilderVariableOption>;
|
|
212
|
-
readonly kind:
|
|
213
|
+
readonly kind: "configuration-variable";
|
|
213
214
|
readonly dataType: BuilderVariableType;
|
|
214
215
|
constructor(varId: string, label: string, options: ReadonlyArray<BuilderVariableOption>);
|
|
215
216
|
}
|
|
@@ -444,6 +445,7 @@ declare class BuilderCondition extends BuilderObject<"builder-condition", Builde
|
|
|
444
445
|
isValid: false;
|
|
445
446
|
message: string;
|
|
446
447
|
};
|
|
448
|
+
toEngineCondition(): Condition.Simple | false;
|
|
447
449
|
private findVariableInUniverse;
|
|
448
450
|
set operator(operator: BuilderOperator | "");
|
|
449
451
|
get operator(): BuilderOperator | "";
|
|
@@ -464,14 +466,14 @@ declare const ConditionGroupType: {
|
|
|
464
466
|
};
|
|
465
467
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
468
|
interface BuilderConditionGroupDto {
|
|
467
|
-
readonly kind:
|
|
469
|
+
readonly kind: "condition-group";
|
|
468
470
|
readonly name: string;
|
|
469
471
|
readonly type: ConditionGroupType;
|
|
470
472
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
473
|
}
|
|
472
|
-
declare class BuilderConditionGroup extends BuilderObject<
|
|
474
|
+
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
475
|
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count" | "range";
|
|
474
|
-
readonly objectType:
|
|
476
|
+
readonly objectType: "builder-condition-group";
|
|
475
477
|
private _type;
|
|
476
478
|
name: string;
|
|
477
479
|
private readonly _conditions;
|
|
@@ -484,6 +486,7 @@ declare class BuilderConditionGroup extends BuilderObject<'builder-condition-gro
|
|
|
484
486
|
removeCondition(condition: BuilderCondition): boolean;
|
|
485
487
|
clone(): BuilderConditionGroupDto;
|
|
486
488
|
toJson(): BuilderConditionGroupDto;
|
|
489
|
+
toEngineConditionComplex(): Condition.Complex | false;
|
|
487
490
|
get type(): ConditionGroupType;
|
|
488
491
|
set type(conditionGroupType: ConditionGroupType);
|
|
489
492
|
}
|
|
@@ -538,14 +541,14 @@ interface BuilderRuleDto {
|
|
|
538
541
|
readonly excludePages: ReadonlyArray<string>;
|
|
539
542
|
readonly jumpToPage: string | false;
|
|
540
543
|
}
|
|
541
|
-
declare class BuilderRule extends BuilderObject<
|
|
544
|
+
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
542
545
|
private readonly dto;
|
|
543
546
|
private readonly _ruleInput;
|
|
544
|
-
readonly objectType:
|
|
547
|
+
readonly objectType: "builder-rule";
|
|
545
548
|
private _type;
|
|
546
549
|
name: string;
|
|
547
550
|
private readonly _conditions;
|
|
548
|
-
private _tagActionManager;
|
|
551
|
+
private readonly _tagActionManager;
|
|
549
552
|
private _pageActionManager;
|
|
550
553
|
readonly jumpToActionManager: JumpToActionManager;
|
|
551
554
|
static readonly fromDto: (dto: BuilderRuleDto, input: RuleInput) => BuilderRule;
|
|
@@ -561,6 +564,27 @@ declare class BuilderRule extends BuilderObject<'builder-rule', BuilderRuleDto>
|
|
|
561
564
|
addConditionGroup(): BuilderConditionGroup;
|
|
562
565
|
clone(): BuilderRuleDto;
|
|
563
566
|
toJson(): BuilderRuleDto;
|
|
567
|
+
toEngineRule(): PageQueRules;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare class PageActionManager {
|
|
571
|
+
readonly validOptions: RuleInput["_pageIdActions"];
|
|
572
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
573
|
+
private readonly _initialSelection;
|
|
574
|
+
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
575
|
+
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
576
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
577
|
+
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare class TagActionManager {
|
|
581
|
+
readonly validOptions: RuleInput["_tagActions"];
|
|
582
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
583
|
+
private readonly _initialSelection;
|
|
584
|
+
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
585
|
+
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
586
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
587
|
+
getEngineActions(): ReadonlyArray<ExcludeByTagAction>;
|
|
564
588
|
}
|
|
565
589
|
|
|
566
590
|
interface BuilderSchemaDto {
|
|
@@ -600,7 +624,7 @@ declare class BuilderSchema {
|
|
|
600
624
|
addPage(type: BuilderPageType, atIndex?: number): BuilderPage;
|
|
601
625
|
insertPage(page: BuilderPage, atIndex: number): boolean;
|
|
602
626
|
private insertPageAtIndex;
|
|
603
|
-
addRule():
|
|
627
|
+
addRule(): BuilderRule;
|
|
604
628
|
deleteRule(rule: BuilderRule): void;
|
|
605
629
|
movePage(page: BuilderPage, toIndex: number): boolean;
|
|
606
630
|
deletePage(page: BuilderPage): boolean;
|
|
@@ -631,4 +655,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
631
655
|
toJson(): BuilderTextDto;
|
|
632
656
|
}
|
|
633
657
|
|
|
634
|
-
export { AudioFile, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, ImageFile, TagCollection, VideoFile };
|
|
658
|
+
export { AudioFile, BuilderCondition, BuilderConditionDto, BuilderConditionGroup, BuilderConditionGroupDto, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOperator, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderRule, BuilderRuleDto, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, BuilderVariable, BuilderVariableOption, ConditionGroupType, CustomVariable, ExcludeByPageAction, ExcludeByPageIdSelectItem, ExcludeByTagAction, ExcludeByTagSelectItem, ImageFile, JumpToActionManager, JumpToPageAction, JumpToPageSelectItem, MultiSelectItem, OperatorSelectItem, PageActionManager, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem, SingleSelectItem, TagActionManager, TagCollection, VideoFile };
|