@media-quest/builder 0.0.2 → 0.0.3
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 +24 -6
- package/dist/public-api.d.ts +24 -6
- package/dist/public-api.js +58 -32
- package/dist/public-api.mjs +39 -32
- package/package.json +3 -4
- package/src/public-api.ts +3 -0
- package/src/rulebuilder/Builder-rule.spec.ts +182 -182
- package/src/rulebuilder/Builder-rule.ts +34 -65
- package/src/rulebuilder/RuleBuilder-test-utils.ts +228 -228
- package/src/rulebuilder/SingleSelectItem.ts +118 -118
- package/src/rulebuilder/{Builder-condition-group.ts → condition/Builder-condition-group.ts} +15 -33
- package/src/rulebuilder/condition/Builder-condition.spec.ts +169 -0
- package/src/rulebuilder/condition/Builder-condition.ts +186 -0
- package/src/rulebuilder/index.ts +11 -11
- 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
|
@@ -464,14 +464,14 @@ declare const ConditionGroupType: {
|
|
|
464
464
|
};
|
|
465
465
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
466
|
interface BuilderConditionGroupDto {
|
|
467
|
-
readonly kind:
|
|
467
|
+
readonly kind: "condition-group";
|
|
468
468
|
readonly name: string;
|
|
469
469
|
readonly type: ConditionGroupType;
|
|
470
470
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
471
|
}
|
|
472
|
-
declare class BuilderConditionGroup extends BuilderObject<
|
|
472
|
+
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
473
|
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count" | "range";
|
|
474
|
-
readonly objectType:
|
|
474
|
+
readonly objectType: "builder-condition-group";
|
|
475
475
|
private _type;
|
|
476
476
|
name: string;
|
|
477
477
|
private readonly _conditions;
|
|
@@ -538,10 +538,10 @@ interface BuilderRuleDto {
|
|
|
538
538
|
readonly excludePages: ReadonlyArray<string>;
|
|
539
539
|
readonly jumpToPage: string | false;
|
|
540
540
|
}
|
|
541
|
-
declare class BuilderRule extends BuilderObject<
|
|
541
|
+
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
542
542
|
private readonly dto;
|
|
543
543
|
private readonly _ruleInput;
|
|
544
|
-
readonly objectType:
|
|
544
|
+
readonly objectType: "builder-rule";
|
|
545
545
|
private _type;
|
|
546
546
|
name: string;
|
|
547
547
|
private readonly _conditions;
|
|
@@ -563,6 +563,24 @@ declare class BuilderRule extends BuilderObject<'builder-rule', BuilderRuleDto>
|
|
|
563
563
|
toJson(): BuilderRuleDto;
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
+
declare class PageActionManager {
|
|
567
|
+
readonly validOptions: RuleInput["_pageIdActions"];
|
|
568
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
569
|
+
private readonly _initialSelection;
|
|
570
|
+
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
571
|
+
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
572
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare class TagActionManager {
|
|
576
|
+
readonly validOptions: RuleInput["_tagActions"];
|
|
577
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
578
|
+
private readonly _initialSelection;
|
|
579
|
+
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
580
|
+
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
581
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
582
|
+
}
|
|
583
|
+
|
|
566
584
|
interface BuilderSchemaDto {
|
|
567
585
|
readonly id: string;
|
|
568
586
|
readonly prefix: string;
|
|
@@ -631,4 +649,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
631
649
|
toJson(): BuilderTextDto;
|
|
632
650
|
}
|
|
633
651
|
|
|
634
|
-
export { AudioFile, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, ImageFile, TagCollection, VideoFile };
|
|
652
|
+
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
|
@@ -464,14 +464,14 @@ declare const ConditionGroupType: {
|
|
|
464
464
|
};
|
|
465
465
|
type ConditionGroupType = keyof typeof ConditionGroupType;
|
|
466
466
|
interface BuilderConditionGroupDto {
|
|
467
|
-
readonly kind:
|
|
467
|
+
readonly kind: "condition-group";
|
|
468
468
|
readonly name: string;
|
|
469
469
|
readonly type: ConditionGroupType;
|
|
470
470
|
readonly conditions: ReadonlyArray<BuilderConditionDto>;
|
|
471
471
|
}
|
|
472
|
-
declare class BuilderConditionGroup extends BuilderObject<
|
|
472
|
+
declare class BuilderConditionGroup extends BuilderObject<"builder-condition-group", BuilderConditionGroupDto> {
|
|
473
473
|
static readonly isConditionGroupType: (value: string | symbol) => value is "all" | "any" | "count" | "range";
|
|
474
|
-
readonly objectType:
|
|
474
|
+
readonly objectType: "builder-condition-group";
|
|
475
475
|
private _type;
|
|
476
476
|
name: string;
|
|
477
477
|
private readonly _conditions;
|
|
@@ -538,10 +538,10 @@ interface BuilderRuleDto {
|
|
|
538
538
|
readonly excludePages: ReadonlyArray<string>;
|
|
539
539
|
readonly jumpToPage: string | false;
|
|
540
540
|
}
|
|
541
|
-
declare class BuilderRule extends BuilderObject<
|
|
541
|
+
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
542
542
|
private readonly dto;
|
|
543
543
|
private readonly _ruleInput;
|
|
544
|
-
readonly objectType:
|
|
544
|
+
readonly objectType: "builder-rule";
|
|
545
545
|
private _type;
|
|
546
546
|
name: string;
|
|
547
547
|
private readonly _conditions;
|
|
@@ -563,6 +563,24 @@ declare class BuilderRule extends BuilderObject<'builder-rule', BuilderRuleDto>
|
|
|
563
563
|
toJson(): BuilderRuleDto;
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
+
declare class PageActionManager {
|
|
567
|
+
readonly validOptions: RuleInput["_pageIdActions"];
|
|
568
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
569
|
+
private readonly _initialSelection;
|
|
570
|
+
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
571
|
+
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
572
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare class TagActionManager {
|
|
576
|
+
readonly validOptions: RuleInput["_tagActions"];
|
|
577
|
+
readonly initialSelection: ReadonlyArray<string>;
|
|
578
|
+
private readonly _initialSelection;
|
|
579
|
+
readonly selectItems: ReadonlyArray<ExcludeByTagSelectItem>;
|
|
580
|
+
constructor(validOptions: RuleInput["_tagActions"], initialSelection: ReadonlyArray<string>);
|
|
581
|
+
getCurrentSelection(): ReadonlyArray<string>;
|
|
582
|
+
}
|
|
583
|
+
|
|
566
584
|
interface BuilderSchemaDto {
|
|
567
585
|
readonly id: string;
|
|
568
586
|
readonly prefix: string;
|
|
@@ -631,4 +649,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
631
649
|
toJson(): BuilderTextDto;
|
|
632
650
|
}
|
|
633
651
|
|
|
634
|
-
export { AudioFile, BuilderMainImageDto, BuilderMainText, BuilderMainTextDto, BuilderMainVideoDto, BuilderOption, BuilderOptionDto, BuilderPage, BuilderPageDto, BuilderPageType, BuilderQuestion, BuilderQuestionDto, BuilderQuestionType, BuilderSchema, BuilderSchemaDto, BuilderTag, BuilderTagDto, BuilderText, BuilderTextDto, ImageFile, TagCollection, VideoFile };
|
|
652
|
+
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.js
CHANGED
|
@@ -20,13 +20,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/public-api.ts
|
|
21
21
|
var public_api_exports = {};
|
|
22
22
|
__export(public_api_exports, {
|
|
23
|
+
BuilderCondition: () => BuilderCondition,
|
|
24
|
+
BuilderConditionGroup: () => BuilderConditionGroup,
|
|
23
25
|
BuilderMainText: () => BuilderMainText,
|
|
26
|
+
BuilderOperator: () => BuilderOperator,
|
|
24
27
|
BuilderOption: () => BuilderOption,
|
|
25
28
|
BuilderPage: () => BuilderPage,
|
|
26
29
|
BuilderQuestion: () => BuilderQuestion,
|
|
30
|
+
BuilderRule: () => BuilderRule,
|
|
27
31
|
BuilderSchema: () => BuilderSchema,
|
|
28
32
|
BuilderTag: () => BuilderTag,
|
|
29
33
|
BuilderText: () => BuilderText,
|
|
34
|
+
BuilderVariableOption: () => BuilderVariableOption,
|
|
35
|
+
CustomVariable: () => CustomVariable,
|
|
36
|
+
ExcludeByPageIdSelectItem: () => ExcludeByPageIdSelectItem,
|
|
37
|
+
ExcludeByTagSelectItem: () => ExcludeByTagSelectItem,
|
|
38
|
+
JumpToActionManager: () => JumpToActionManager,
|
|
39
|
+
JumpToPageSelectItem: () => JumpToPageSelectItem,
|
|
40
|
+
MultiSelectItem: () => MultiSelectItem,
|
|
41
|
+
OperatorSelectItem: () => OperatorSelectItem,
|
|
42
|
+
PageActionManager: () => PageActionManager,
|
|
43
|
+
QuestionVariable: () => QuestionVariable,
|
|
44
|
+
RuleInput: () => RuleInput,
|
|
45
|
+
RuleOptionSelectItem: () => RuleOptionSelectItem,
|
|
46
|
+
RuleVariableSelectItem: () => RuleVariableSelectItem,
|
|
47
|
+
SingleSelectItem: () => SingleSelectItem,
|
|
48
|
+
TagActionManager: () => TagActionManager,
|
|
30
49
|
TagCollection: () => TagCollection
|
|
31
50
|
});
|
|
32
51
|
module.exports = __toCommonJS(public_api_exports);
|
|
@@ -412,6 +431,15 @@ var QuestionVariable = class {
|
|
|
412
431
|
kind = "question-variable";
|
|
413
432
|
dataType = "numericWithOptions";
|
|
414
433
|
};
|
|
434
|
+
var CustomVariable = class {
|
|
435
|
+
constructor(varId, label, options) {
|
|
436
|
+
this.varId = varId;
|
|
437
|
+
this.label = label;
|
|
438
|
+
this.options = options;
|
|
439
|
+
}
|
|
440
|
+
kind = "configuration-variable";
|
|
441
|
+
dataType = "numericWithOptions";
|
|
442
|
+
};
|
|
415
443
|
|
|
416
444
|
// src/Builder-page.ts
|
|
417
445
|
var import_engine2 = require("@media-quest/engine");
|
|
@@ -840,7 +868,7 @@ var TagCollection = class _TagCollection {
|
|
|
840
868
|
}
|
|
841
869
|
};
|
|
842
870
|
|
|
843
|
-
// src/rulebuilder/Builder-operator.ts
|
|
871
|
+
// src/rulebuilder/condition/Builder-operator.ts
|
|
844
872
|
var BuilderOperatorSymbols = {
|
|
845
873
|
equal: true,
|
|
846
874
|
notEqual: true,
|
|
@@ -871,7 +899,7 @@ var BuilderOperator;
|
|
|
871
899
|
};
|
|
872
900
|
})(BuilderOperator || (BuilderOperator = {}));
|
|
873
901
|
|
|
874
|
-
// src/rulebuilder/Builder-condition.ts
|
|
902
|
+
// src/rulebuilder/condition/Builder-condition.ts
|
|
875
903
|
var BuilderCondition = class _BuilderCondition extends BuilderObject {
|
|
876
904
|
objectType = "builder-condition";
|
|
877
905
|
static NUMBER_OPERATORS = [
|
|
@@ -1026,7 +1054,7 @@ var BuilderCondition = class _BuilderCondition extends BuilderObject {
|
|
|
1026
1054
|
}
|
|
1027
1055
|
};
|
|
1028
1056
|
|
|
1029
|
-
// src/rulebuilder/Builder-condition-group.ts
|
|
1057
|
+
// src/rulebuilder/condition/Builder-condition-group.ts
|
|
1030
1058
|
var ConditionGroupType = {
|
|
1031
1059
|
all: true,
|
|
1032
1060
|
any: true,
|
|
@@ -1054,9 +1082,7 @@ var BuilderConditionGroup = class _BuilderConditionGroup extends BuilderObject {
|
|
|
1054
1082
|
this.name = dto.name;
|
|
1055
1083
|
this._type = dto.type;
|
|
1056
1084
|
const conditionList = Array.isArray(dto.conditions) ? dto.conditions : [];
|
|
1057
|
-
this._conditions = conditionList.map(
|
|
1058
|
-
(dto2) => BuilderCondition.fromDto(dto2, variableList)
|
|
1059
|
-
);
|
|
1085
|
+
this._conditions = conditionList.map((dto2) => BuilderCondition.fromDto(dto2, variableList));
|
|
1060
1086
|
this._variableList = variableList;
|
|
1061
1087
|
}
|
|
1062
1088
|
get conditions() {
|
|
@@ -1082,9 +1108,7 @@ var BuilderConditionGroup = class _BuilderConditionGroup extends BuilderObject {
|
|
|
1082
1108
|
return this.toJson();
|
|
1083
1109
|
}
|
|
1084
1110
|
toJson() {
|
|
1085
|
-
const conditions = [
|
|
1086
|
-
...this._conditions.map((c) => c.toJson())
|
|
1087
|
-
];
|
|
1111
|
+
const conditions = [...this._conditions.map((c) => c.toJson())];
|
|
1088
1112
|
return {
|
|
1089
1113
|
name: this.name,
|
|
1090
1114
|
conditions,
|
|
@@ -1247,26 +1271,14 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1247
1271
|
acc.push(condition);
|
|
1248
1272
|
}
|
|
1249
1273
|
if (curr.kind === "condition-group") {
|
|
1250
|
-
const conditionGroup = BuilderConditionGroup.fromDto(
|
|
1251
|
-
curr,
|
|
1252
|
-
conditionInput
|
|
1253
|
-
);
|
|
1274
|
+
const conditionGroup = BuilderConditionGroup.fromDto(curr, conditionInput);
|
|
1254
1275
|
acc.push(conditionGroup);
|
|
1255
1276
|
}
|
|
1256
1277
|
return acc;
|
|
1257
1278
|
}, []);
|
|
1258
|
-
this._pageActionManager = new PageActionManager(
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
);
|
|
1262
|
-
this._tagActionManager = new TagActionManager(
|
|
1263
|
-
_ruleInput.excludeByTagActions,
|
|
1264
|
-
dto.excludeTags
|
|
1265
|
-
);
|
|
1266
|
-
this.jumpToActionManager = new JumpToActionManager(
|
|
1267
|
-
_ruleInput.jumpToPageActions,
|
|
1268
|
-
dto.jumpToPage
|
|
1269
|
-
);
|
|
1279
|
+
this._pageActionManager = new PageActionManager(_ruleInput.excludeByPageIdActions, dto.excludePages);
|
|
1280
|
+
this._tagActionManager = new TagActionManager(_ruleInput.excludeByTagActions, dto.excludeTags);
|
|
1281
|
+
this.jumpToActionManager = new JumpToActionManager(_ruleInput.jumpToPageActions, dto.jumpToPage);
|
|
1270
1282
|
}
|
|
1271
1283
|
objectType = "builder-rule";
|
|
1272
1284
|
_type = "all";
|
|
@@ -1308,9 +1320,7 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1308
1320
|
return true;
|
|
1309
1321
|
}
|
|
1310
1322
|
addCondition() {
|
|
1311
|
-
const condition = BuilderCondition.create(
|
|
1312
|
-
this._ruleInput.getConditionInput()
|
|
1313
|
-
);
|
|
1323
|
+
const condition = BuilderCondition.create(this._ruleInput.getConditionInput());
|
|
1314
1324
|
this._conditions.push(condition);
|
|
1315
1325
|
return condition;
|
|
1316
1326
|
}
|
|
@@ -1321,10 +1331,7 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1321
1331
|
type: "all",
|
|
1322
1332
|
conditions: []
|
|
1323
1333
|
};
|
|
1324
|
-
const newGroup = BuilderConditionGroup.fromDto(
|
|
1325
|
-
dto,
|
|
1326
|
-
this._ruleInput.questionVars
|
|
1327
|
-
);
|
|
1334
|
+
const newGroup = BuilderConditionGroup.fromDto(dto, this._ruleInput.questionVars);
|
|
1328
1335
|
this._conditions.push(newGroup);
|
|
1329
1336
|
return newGroup;
|
|
1330
1337
|
}
|
|
@@ -2150,12 +2157,31 @@ var BuilderText = class _BuilderText extends BuilderObject {
|
|
|
2150
2157
|
};
|
|
2151
2158
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2152
2159
|
0 && (module.exports = {
|
|
2160
|
+
BuilderCondition,
|
|
2161
|
+
BuilderConditionGroup,
|
|
2153
2162
|
BuilderMainText,
|
|
2163
|
+
BuilderOperator,
|
|
2154
2164
|
BuilderOption,
|
|
2155
2165
|
BuilderPage,
|
|
2156
2166
|
BuilderQuestion,
|
|
2167
|
+
BuilderRule,
|
|
2157
2168
|
BuilderSchema,
|
|
2158
2169
|
BuilderTag,
|
|
2159
2170
|
BuilderText,
|
|
2171
|
+
BuilderVariableOption,
|
|
2172
|
+
CustomVariable,
|
|
2173
|
+
ExcludeByPageIdSelectItem,
|
|
2174
|
+
ExcludeByTagSelectItem,
|
|
2175
|
+
JumpToActionManager,
|
|
2176
|
+
JumpToPageSelectItem,
|
|
2177
|
+
MultiSelectItem,
|
|
2178
|
+
OperatorSelectItem,
|
|
2179
|
+
PageActionManager,
|
|
2180
|
+
QuestionVariable,
|
|
2181
|
+
RuleInput,
|
|
2182
|
+
RuleOptionSelectItem,
|
|
2183
|
+
RuleVariableSelectItem,
|
|
2184
|
+
SingleSelectItem,
|
|
2185
|
+
TagActionManager,
|
|
2160
2186
|
TagCollection
|
|
2161
2187
|
});
|
package/dist/public-api.mjs
CHANGED
|
@@ -379,6 +379,15 @@ var QuestionVariable = class {
|
|
|
379
379
|
kind = "question-variable";
|
|
380
380
|
dataType = "numericWithOptions";
|
|
381
381
|
};
|
|
382
|
+
var CustomVariable = class {
|
|
383
|
+
constructor(varId, label, options) {
|
|
384
|
+
this.varId = varId;
|
|
385
|
+
this.label = label;
|
|
386
|
+
this.options = options;
|
|
387
|
+
}
|
|
388
|
+
kind = "configuration-variable";
|
|
389
|
+
dataType = "numericWithOptions";
|
|
390
|
+
};
|
|
382
391
|
|
|
383
392
|
// src/Builder-page.ts
|
|
384
393
|
import { DUtil as DUtil2 } from "@media-quest/engine";
|
|
@@ -807,7 +816,7 @@ var TagCollection = class _TagCollection {
|
|
|
807
816
|
}
|
|
808
817
|
};
|
|
809
818
|
|
|
810
|
-
// src/rulebuilder/Builder-operator.ts
|
|
819
|
+
// src/rulebuilder/condition/Builder-operator.ts
|
|
811
820
|
var BuilderOperatorSymbols = {
|
|
812
821
|
equal: true,
|
|
813
822
|
notEqual: true,
|
|
@@ -838,7 +847,7 @@ var BuilderOperator;
|
|
|
838
847
|
};
|
|
839
848
|
})(BuilderOperator || (BuilderOperator = {}));
|
|
840
849
|
|
|
841
|
-
// src/rulebuilder/Builder-condition.ts
|
|
850
|
+
// src/rulebuilder/condition/Builder-condition.ts
|
|
842
851
|
var BuilderCondition = class _BuilderCondition extends BuilderObject {
|
|
843
852
|
objectType = "builder-condition";
|
|
844
853
|
static NUMBER_OPERATORS = [
|
|
@@ -993,7 +1002,7 @@ var BuilderCondition = class _BuilderCondition extends BuilderObject {
|
|
|
993
1002
|
}
|
|
994
1003
|
};
|
|
995
1004
|
|
|
996
|
-
// src/rulebuilder/Builder-condition-group.ts
|
|
1005
|
+
// src/rulebuilder/condition/Builder-condition-group.ts
|
|
997
1006
|
var ConditionGroupType = {
|
|
998
1007
|
all: true,
|
|
999
1008
|
any: true,
|
|
@@ -1021,9 +1030,7 @@ var BuilderConditionGroup = class _BuilderConditionGroup extends BuilderObject {
|
|
|
1021
1030
|
this.name = dto.name;
|
|
1022
1031
|
this._type = dto.type;
|
|
1023
1032
|
const conditionList = Array.isArray(dto.conditions) ? dto.conditions : [];
|
|
1024
|
-
this._conditions = conditionList.map(
|
|
1025
|
-
(dto2) => BuilderCondition.fromDto(dto2, variableList)
|
|
1026
|
-
);
|
|
1033
|
+
this._conditions = conditionList.map((dto2) => BuilderCondition.fromDto(dto2, variableList));
|
|
1027
1034
|
this._variableList = variableList;
|
|
1028
1035
|
}
|
|
1029
1036
|
get conditions() {
|
|
@@ -1049,9 +1056,7 @@ var BuilderConditionGroup = class _BuilderConditionGroup extends BuilderObject {
|
|
|
1049
1056
|
return this.toJson();
|
|
1050
1057
|
}
|
|
1051
1058
|
toJson() {
|
|
1052
|
-
const conditions = [
|
|
1053
|
-
...this._conditions.map((c) => c.toJson())
|
|
1054
|
-
];
|
|
1059
|
+
const conditions = [...this._conditions.map((c) => c.toJson())];
|
|
1055
1060
|
return {
|
|
1056
1061
|
name: this.name,
|
|
1057
1062
|
conditions,
|
|
@@ -1214,26 +1219,14 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1214
1219
|
acc.push(condition);
|
|
1215
1220
|
}
|
|
1216
1221
|
if (curr.kind === "condition-group") {
|
|
1217
|
-
const conditionGroup = BuilderConditionGroup.fromDto(
|
|
1218
|
-
curr,
|
|
1219
|
-
conditionInput
|
|
1220
|
-
);
|
|
1222
|
+
const conditionGroup = BuilderConditionGroup.fromDto(curr, conditionInput);
|
|
1221
1223
|
acc.push(conditionGroup);
|
|
1222
1224
|
}
|
|
1223
1225
|
return acc;
|
|
1224
1226
|
}, []);
|
|
1225
|
-
this._pageActionManager = new PageActionManager(
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
);
|
|
1229
|
-
this._tagActionManager = new TagActionManager(
|
|
1230
|
-
_ruleInput.excludeByTagActions,
|
|
1231
|
-
dto.excludeTags
|
|
1232
|
-
);
|
|
1233
|
-
this.jumpToActionManager = new JumpToActionManager(
|
|
1234
|
-
_ruleInput.jumpToPageActions,
|
|
1235
|
-
dto.jumpToPage
|
|
1236
|
-
);
|
|
1227
|
+
this._pageActionManager = new PageActionManager(_ruleInput.excludeByPageIdActions, dto.excludePages);
|
|
1228
|
+
this._tagActionManager = new TagActionManager(_ruleInput.excludeByTagActions, dto.excludeTags);
|
|
1229
|
+
this.jumpToActionManager = new JumpToActionManager(_ruleInput.jumpToPageActions, dto.jumpToPage);
|
|
1237
1230
|
}
|
|
1238
1231
|
objectType = "builder-rule";
|
|
1239
1232
|
_type = "all";
|
|
@@ -1275,9 +1268,7 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1275
1268
|
return true;
|
|
1276
1269
|
}
|
|
1277
1270
|
addCondition() {
|
|
1278
|
-
const condition = BuilderCondition.create(
|
|
1279
|
-
this._ruleInput.getConditionInput()
|
|
1280
|
-
);
|
|
1271
|
+
const condition = BuilderCondition.create(this._ruleInput.getConditionInput());
|
|
1281
1272
|
this._conditions.push(condition);
|
|
1282
1273
|
return condition;
|
|
1283
1274
|
}
|
|
@@ -1288,10 +1279,7 @@ var BuilderRule = class _BuilderRule extends BuilderObject {
|
|
|
1288
1279
|
type: "all",
|
|
1289
1280
|
conditions: []
|
|
1290
1281
|
};
|
|
1291
|
-
const newGroup = BuilderConditionGroup.fromDto(
|
|
1292
|
-
dto,
|
|
1293
|
-
this._ruleInput.questionVars
|
|
1294
|
-
);
|
|
1282
|
+
const newGroup = BuilderConditionGroup.fromDto(dto, this._ruleInput.questionVars);
|
|
1295
1283
|
this._conditions.push(newGroup);
|
|
1296
1284
|
return newGroup;
|
|
1297
1285
|
}
|
|
@@ -2118,12 +2106,31 @@ var BuilderText = class _BuilderText extends BuilderObject {
|
|
|
2118
2106
|
}
|
|
2119
2107
|
};
|
|
2120
2108
|
export {
|
|
2109
|
+
BuilderCondition,
|
|
2110
|
+
BuilderConditionGroup,
|
|
2121
2111
|
BuilderMainText,
|
|
2112
|
+
BuilderOperator,
|
|
2122
2113
|
BuilderOption,
|
|
2123
2114
|
BuilderPage,
|
|
2124
2115
|
BuilderQuestion,
|
|
2116
|
+
BuilderRule,
|
|
2125
2117
|
BuilderSchema,
|
|
2126
2118
|
BuilderTag,
|
|
2127
2119
|
BuilderText,
|
|
2120
|
+
BuilderVariableOption,
|
|
2121
|
+
CustomVariable,
|
|
2122
|
+
ExcludeByPageIdSelectItem,
|
|
2123
|
+
ExcludeByTagSelectItem,
|
|
2124
|
+
JumpToActionManager,
|
|
2125
|
+
JumpToPageSelectItem,
|
|
2126
|
+
MultiSelectItem,
|
|
2127
|
+
OperatorSelectItem,
|
|
2128
|
+
PageActionManager,
|
|
2129
|
+
QuestionVariable,
|
|
2130
|
+
RuleInput,
|
|
2131
|
+
RuleOptionSelectItem,
|
|
2132
|
+
RuleVariableSelectItem,
|
|
2133
|
+
SingleSelectItem,
|
|
2134
|
+
TagActionManager,
|
|
2128
2135
|
TagCollection
|
|
2129
2136
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@media-quest/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Builder library for Media-quest schemas",
|
|
5
5
|
"main": "dist/public-api.js",
|
|
6
6
|
"module": "dist/public-api.mjs",
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"check": "tsc --watch --noEmit",
|
|
11
11
|
"clean": "rimraf dist",
|
|
12
12
|
"build": "npm run clean && tsup src/public-api.ts --format cjs,esm --dts",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
14
|
-
"postpublish": "npm run clean"
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
15
14
|
},
|
|
16
15
|
"dependencies": {
|
|
17
|
-
"@media-quest/engine": "0.0.
|
|
16
|
+
"@media-quest/engine": "0.0.3"
|
|
18
17
|
}
|
|
19
18
|
}
|
package/src/public-api.ts
CHANGED
|
@@ -8,3 +8,6 @@ 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
|
+
|
|
12
|
+
// Public Api of rule-builder
|
|
13
|
+
export * from "./rulebuilder";
|