@media-quest/builder 0.0.3 → 0.0.5
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 +14 -8
- package/dist/public-api.d.ts +14 -8
- package/dist/public-api.js +149 -11
- package/dist/public-api.mjs +151 -12
- package/package.json +3 -3
- package/src/Builder-option.ts +51 -52
- package/src/Builder-schema.ts +3 -3
- package/src/rulebuilder/Builder-rule.spec.ts +96 -12
- package/src/rulebuilder/Builder-rule.ts +66 -1
- package/src/rulebuilder/RuleBuilder-test-utils.ts +13 -2
- package/src/rulebuilder/RuleVariable.ts +13 -9
- package/src/rulebuilder/condition/Builder-condition-group.ts +28 -1
- package/src/rulebuilder/condition/Builder-condition.spec.ts +16 -0
- package/src/rulebuilder/condition/Builder-condition.ts +22 -0
- package/src/rulebuilder/condition/Builder-operator.ts +3 -3
- package/src/rulebuilder/jump-to-action-manager.ts +26 -26
- package/src/rulebuilder/page-action-manager.ts +23 -13
- package/src/rulebuilder/rule2/Rule2.ts +211 -0
- package/src/rulebuilder/tag-action-manager.ts +23 -13
- package/src/theme/default-theme-compiler.ts +32 -6
- package/tsconfig.json +2 -2
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
|
}
|
|
@@ -309,7 +310,7 @@ declare const BuilderOperatorSymbols: {
|
|
|
309
310
|
};
|
|
310
311
|
type BuilderOperator = keyof typeof BuilderOperatorSymbols;
|
|
311
312
|
declare namespace BuilderOperator {
|
|
312
|
-
const is: (symbol
|
|
313
|
+
const is: (symbol?: string) => symbol is "equal" | "notEqual" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "between" | "notBetween" | "in" | "notIn" | "missing" | "notMissing" | "contains" | "notContains" | "empty" | "notEmpty" | "startsWith" | "endsWith";
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
declare abstract class SingleSelectItem<T> {
|
|
@@ -444,6 +445,7 @@ declare class BuilderCondition extends BuilderObject<"builder-condition", Builde
|
|
|
444
445
|
isValid: false;
|
|
445
446
|
message: string;
|
|
446
447
|
};
|
|
448
|
+
toEngineCondition(modulePrefix: string): Condition.Simple | false;
|
|
447
449
|
private findVariableInUniverse;
|
|
448
450
|
set operator(operator: BuilderOperator | "");
|
|
449
451
|
get operator(): BuilderOperator | "";
|
|
@@ -460,17 +462,17 @@ declare const ConditionGroupType: {
|
|
|
460
462
|
all: boolean;
|
|
461
463
|
any: boolean;
|
|
462
464
|
count: boolean;
|
|
463
|
-
range: boolean;
|
|
464
465
|
};
|
|
465
466
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
467
|
interface BuilderConditionGroupDto {
|
|
467
468
|
readonly kind: "condition-group";
|
|
468
469
|
readonly name: string;
|
|
470
|
+
readonly count?: number;
|
|
469
471
|
readonly type: ConditionGroupType;
|
|
470
472
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
473
|
}
|
|
472
474
|
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
|
-
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count"
|
|
475
|
+
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count";
|
|
474
476
|
readonly objectType: "builder-condition-group";
|
|
475
477
|
private _type;
|
|
476
478
|
name: string;
|
|
@@ -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(modulePrefix: string): Condition.Complex | false;
|
|
487
490
|
get type(): ConditionGroupType;
|
|
488
491
|
set type(conditionGroupType: ConditionGroupType);
|
|
489
492
|
}
|
|
@@ -545,7 +548,7 @@ declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto>
|
|
|
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,7 @@ declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto>
|
|
|
561
564
|
addConditionGroup(): BuilderConditionGroup;
|
|
562
565
|
clone(): BuilderRuleDto;
|
|
563
566
|
toJson(): BuilderRuleDto;
|
|
567
|
+
toEngineRule(modulePrefix: string): PageQueRules;
|
|
564
568
|
}
|
|
565
569
|
|
|
566
570
|
declare class PageActionManager {
|
|
@@ -570,6 +574,7 @@ declare class PageActionManager {
|
|
|
570
574
|
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
571
575
|
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
572
576
|
getCurrentSelection(): ReadonlyArray<string>;
|
|
577
|
+
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
573
578
|
}
|
|
574
579
|
|
|
575
580
|
declare class TagActionManager {
|
|
@@ -579,6 +584,7 @@ declare class TagActionManager {
|
|
|
579
584
|
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
580
585
|
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
581
586
|
getCurrentSelection(): ReadonlyArray<string>;
|
|
587
|
+
getEngineActions(): ReadonlyArray<ExcludeByTagAction>;
|
|
582
588
|
}
|
|
583
589
|
|
|
584
590
|
interface BuilderSchemaDto {
|
|
@@ -618,7 +624,7 @@ declare class BuilderSchema {
|
|
|
618
624
|
addPage(type: BuilderPageType, atIndex?: number): BuilderPage;
|
|
619
625
|
insertPage(page: BuilderPage, atIndex: number): boolean;
|
|
620
626
|
private insertPageAtIndex;
|
|
621
|
-
addRule():
|
|
627
|
+
addRule(): BuilderRule;
|
|
622
628
|
deleteRule(rule: BuilderRule): void;
|
|
623
629
|
movePage(page: BuilderPage, toIndex: number): boolean;
|
|
624
630
|
deletePage(page: BuilderPage): boolean;
|
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
|
}
|
|
@@ -309,7 +310,7 @@ declare const BuilderOperatorSymbols: {
|
|
|
309
310
|
};
|
|
310
311
|
type BuilderOperator = keyof typeof BuilderOperatorSymbols;
|
|
311
312
|
declare namespace BuilderOperator {
|
|
312
|
-
const is: (symbol
|
|
313
|
+
const is: (symbol?: string) => symbol is "equal" | "notEqual" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "between" | "notBetween" | "in" | "notIn" | "missing" | "notMissing" | "contains" | "notContains" | "empty" | "notEmpty" | "startsWith" | "endsWith";
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
declare abstract class SingleSelectItem<T> {
|
|
@@ -444,6 +445,7 @@ declare class BuilderCondition extends BuilderObject<"builder-condition", Builde
|
|
|
444
445
|
isValid: false;
|
|
445
446
|
message: string;
|
|
446
447
|
};
|
|
448
|
+
toEngineCondition(modulePrefix: string): Condition.Simple | false;
|
|
447
449
|
private findVariableInUniverse;
|
|
448
450
|
set operator(operator: BuilderOperator | "");
|
|
449
451
|
get operator(): BuilderOperator | "";
|
|
@@ -460,17 +462,17 @@ declare const ConditionGroupType: {
|
|
|
460
462
|
all: boolean;
|
|
461
463
|
any: boolean;
|
|
462
464
|
count: boolean;
|
|
463
|
-
range: boolean;
|
|
464
465
|
};
|
|
465
466
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
467
|
interface BuilderConditionGroupDto {
|
|
467
468
|
readonly kind: "condition-group";
|
|
468
469
|
readonly name: string;
|
|
470
|
+
readonly count?: number;
|
|
469
471
|
readonly type: ConditionGroupType;
|
|
470
472
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
473
|
}
|
|
472
474
|
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
|
-
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count"
|
|
475
|
+
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count";
|
|
474
476
|
readonly objectType: "builder-condition-group";
|
|
475
477
|
private _type;
|
|
476
478
|
name: string;
|
|
@@ -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(modulePrefix: string): Condition.Complex | false;
|
|
487
490
|
get type(): ConditionGroupType;
|
|
488
491
|
set type(conditionGroupType: ConditionGroupType);
|
|
489
492
|
}
|
|
@@ -545,7 +548,7 @@ declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto>
|
|
|
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,7 @@ declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto>
|
|
|
561
564
|
addConditionGroup(): BuilderConditionGroup;
|
|
562
565
|
clone(): BuilderRuleDto;
|
|
563
566
|
toJson(): BuilderRuleDto;
|
|
567
|
+
toEngineRule(modulePrefix: string): PageQueRules;
|
|
564
568
|
}
|
|
565
569
|
|
|
566
570
|
declare class PageActionManager {
|
|
@@ -570,6 +574,7 @@ declare class PageActionManager {
|
|
|
570
574
|
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
571
575
|
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
572
576
|
getCurrentSelection(): ReadonlyArray<string>;
|
|
577
|
+
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
573
578
|
}
|
|
574
579
|
|
|
575
580
|
declare class TagActionManager {
|
|
@@ -579,6 +584,7 @@ declare class TagActionManager {
|
|
|
579
584
|
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
580
585
|
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
581
586
|
getCurrentSelection(): ReadonlyArray<string>;
|
|
587
|
+
getEngineActions(): ReadonlyArray<ExcludeByTagAction>;
|
|
582
588
|
}
|
|
583
589
|
|
|
584
590
|
interface BuilderSchemaDto {
|
|
@@ -618,7 +624,7 @@ declare class BuilderSchema {
|
|
|
618
624
|
addPage(type: BuilderPageType, atIndex?: number): BuilderPage;
|
|
619
625
|
insertPage(page: BuilderPage, atIndex: number): boolean;
|
|
620
626
|
private insertPageAtIndex;
|
|
621
|
-
addRule():
|
|
627
|
+
addRule(): BuilderRule;
|
|
622
628
|
deleteRule(rule: BuilderRule): void;
|
|
623
629
|
movePage(page: BuilderPage, toIndex: number): boolean;
|
|
624
630
|
deletePage(page: BuilderPage): boolean;
|