@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/dist/public-api.d.mts +31 -26
- package/dist/public-api.d.ts +31 -26
- package/dist/public-api.js +49 -42
- package/dist/public-api.mjs +47 -40
- package/package.json +2 -2
- package/src/Builder-page.spec.ts +2 -1
- package/src/Builder-page.ts +3 -1
- package/src/Builder-schema.spec.ts +3 -2
- package/src/Builder-schema.ts +13 -19
- package/src/primitives/page-prefix.ts +58 -0
- package/src/primitives/prefix.ts +0 -0
- package/src/primitives/schema-prefix.ts +52 -0
- package/src/primitives/varID.ts +11 -0
- package/src/public-api.ts +4 -1
- package/src/rulebuilder/Builder-rule.spec.ts +3 -1
- package/src/rulebuilder/Builder-rule.ts +2 -2
- package/src/rulebuilder/RuleAction.ts +84 -0
- package/src/rulebuilder/RuleBuilder-test-utils.ts +32 -12
- package/src/rulebuilder/RuleVariable.ts +3 -1
- package/src/rulebuilder/SingleSelectItem.ts +2 -2
- package/src/rulebuilder/condition/Builder-condition.spec.ts +2 -1
- package/src/rulebuilder/multi-select-item.ts +57 -54
- package/src/rulebuilder/page-action-manager.ts +2 -1
- package/src/prefix.ts +0 -107
- /package/src/{prefix.spec.ts → primitives/prefix.spec.ts} +0 -0
package/dist/public-api.d.mts
CHANGED
|
@@ -167,15 +167,27 @@ declare class BuilderMainText extends BuilderObject<"builder-main-text", Builder
|
|
|
167
167
|
set audioFile(audioFile: AudioFile | false);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
type SchemaPrefixValue = string & {
|
|
171
|
-
__SCHEMA_PREFIX__: true;
|
|
172
|
-
};
|
|
173
170
|
type PagePrefixValue = string & {
|
|
174
171
|
__PAGE_PREFIX__: true;
|
|
175
172
|
};
|
|
176
|
-
|
|
177
|
-
declare
|
|
178
|
-
|
|
173
|
+
declare const createRandomPrefix: <const P extends string>(length: number) => P;
|
|
174
|
+
declare class PagePrefix {
|
|
175
|
+
private _value;
|
|
176
|
+
static readonly MIN_LENGTH = 1;
|
|
177
|
+
private static randomLen;
|
|
178
|
+
static readonly MAX_LENGTH = 16;
|
|
179
|
+
static create: () => PagePrefix;
|
|
180
|
+
static fromString: (value: string) => PagePrefix | false;
|
|
181
|
+
static fromStringOrThrow: (value: string) => PagePrefixValue;
|
|
182
|
+
static castOrCreateRandom: (value: string) => PagePrefix;
|
|
183
|
+
static isValid: (prefix: string | 999) => prefix is PagePrefixValue;
|
|
184
|
+
get value(): PagePrefixValue;
|
|
185
|
+
set value(value: string);
|
|
186
|
+
private constructor();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type SchemaPrefixValue = string & {
|
|
190
|
+
__SCHEMA_PREFIX__: true;
|
|
179
191
|
};
|
|
180
192
|
declare class SchemaPrefix {
|
|
181
193
|
private _value;
|
|
@@ -187,25 +199,17 @@ declare class SchemaPrefix {
|
|
|
187
199
|
static fromString: (value: string) => SchemaPrefix | false;
|
|
188
200
|
static castOrCreateRandom: (value: string) => SchemaPrefix;
|
|
189
201
|
static isValid: (prefix: string | 999) => prefix is SchemaPrefixValue;
|
|
202
|
+
toJSON(): void;
|
|
190
203
|
get value(): SchemaPrefixValue;
|
|
204
|
+
get isValid(): boolean;
|
|
191
205
|
set value(value: string);
|
|
192
206
|
private constructor();
|
|
193
207
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
static fromValue: (value: PagePrefixValue) => PagePrefix;
|
|
200
|
-
static create: () => PagePrefix;
|
|
201
|
-
static fromString: (value: string) => PagePrefix | false;
|
|
202
|
-
static fromStringOrThrow: (value: string) => PagePrefixValue;
|
|
203
|
-
static castOrCreateRandom: (value: string) => PagePrefix;
|
|
204
|
-
static isValid: (prefix: string | 999) => prefix is PagePrefixValue;
|
|
205
|
-
get value(): PagePrefixValue;
|
|
206
|
-
set value(value: string);
|
|
207
|
-
private constructor();
|
|
208
|
-
}
|
|
208
|
+
|
|
209
|
+
type VarID = `${SchemaPrefixValue}_${PagePrefixValue}`;
|
|
210
|
+
declare const VarID: {
|
|
211
|
+
create: (schemaPrefix: SchemaPrefixValue, pagePrefix: PagePrefixValue) => VarID;
|
|
212
|
+
};
|
|
209
213
|
|
|
210
214
|
declare const BuilderVariableType: {
|
|
211
215
|
readonly numericWithOptions: true;
|
|
@@ -299,12 +303,14 @@ declare class BuilderPage extends BuilderObject<"builder-page", BuilderPageDto>
|
|
|
299
303
|
interface ExcludeByPageAction {
|
|
300
304
|
readonly kind: "exclude-by-pageId";
|
|
301
305
|
readonly pageId: PageID;
|
|
306
|
+
readonly pagePrefix: PagePrefixValue;
|
|
302
307
|
readonly mainText: string;
|
|
303
308
|
readonly pageNumber: number;
|
|
304
309
|
}
|
|
305
310
|
interface JumpToPageAction {
|
|
306
311
|
readonly kind: "jump-to-page";
|
|
307
312
|
readonly pageId: PageID;
|
|
313
|
+
readonly pagePrefix: PagePrefixValue;
|
|
308
314
|
readonly mainText: string;
|
|
309
315
|
readonly pageNumber: number;
|
|
310
316
|
}
|
|
@@ -565,7 +571,7 @@ interface BuilderRuleDto {
|
|
|
565
571
|
readonly name: string;
|
|
566
572
|
readonly conditions: ReadonlyArray<BuilderConditionDto | BuilderConditionGroupDto>;
|
|
567
573
|
readonly excludeTags: ReadonlyArray<string>;
|
|
568
|
-
readonly excludePages: ReadonlyArray<
|
|
574
|
+
readonly excludePages: ReadonlyArray<PageID>;
|
|
569
575
|
readonly jumpToPage: string | false;
|
|
570
576
|
}
|
|
571
577
|
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
@@ -600,7 +606,7 @@ declare class PageActionManager {
|
|
|
600
606
|
private readonly _initialSelection;
|
|
601
607
|
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
602
608
|
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
603
|
-
getCurrentSelection(): ReadonlyArray<
|
|
609
|
+
getCurrentSelection(): ReadonlyArray<PageID>;
|
|
604
610
|
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
605
611
|
}
|
|
606
612
|
|
|
@@ -634,7 +640,7 @@ interface SchemaBuildOutput {
|
|
|
634
640
|
declare class BuilderSchema {
|
|
635
641
|
readonly id: SchemaID;
|
|
636
642
|
name: string;
|
|
637
|
-
|
|
643
|
+
readonly prefix: SchemaPrefix;
|
|
638
644
|
baseHeight: number;
|
|
639
645
|
baseWidth: number;
|
|
640
646
|
backgroundColor: string;
|
|
@@ -642,7 +648,6 @@ declare class BuilderSchema {
|
|
|
642
648
|
mainImage: ImageFile | false;
|
|
643
649
|
private _rules;
|
|
644
650
|
get rules(): ReadonlyArray<BuilderRule>;
|
|
645
|
-
get prefix(): SchemaPrefixValue;
|
|
646
651
|
private readonly _tagCollection;
|
|
647
652
|
get tags(): ReadonlyArray<BuilderTag>;
|
|
648
653
|
static create(id: SchemaID, name: string, prefix: SchemaPrefixValue): BuilderSchema;
|
|
@@ -682,4 +687,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
682
687
|
toJson(): BuilderTextDto;
|
|
683
688
|
}
|
|
684
689
|
|
|
685
|
-
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, PagePrefix, PagePrefixValue, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem,
|
|
690
|
+
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, PagePrefix, PagePrefixValue, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem, SingleSelectItem, TagActionManager, TagCollection, VarID, VideoFile, createRandomPrefix };
|
package/dist/public-api.d.ts
CHANGED
|
@@ -167,15 +167,27 @@ declare class BuilderMainText extends BuilderObject<"builder-main-text", Builder
|
|
|
167
167
|
set audioFile(audioFile: AudioFile | false);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
type SchemaPrefixValue = string & {
|
|
171
|
-
__SCHEMA_PREFIX__: true;
|
|
172
|
-
};
|
|
173
170
|
type PagePrefixValue = string & {
|
|
174
171
|
__PAGE_PREFIX__: true;
|
|
175
172
|
};
|
|
176
|
-
|
|
177
|
-
declare
|
|
178
|
-
|
|
173
|
+
declare const createRandomPrefix: <const P extends string>(length: number) => P;
|
|
174
|
+
declare class PagePrefix {
|
|
175
|
+
private _value;
|
|
176
|
+
static readonly MIN_LENGTH = 1;
|
|
177
|
+
private static randomLen;
|
|
178
|
+
static readonly MAX_LENGTH = 16;
|
|
179
|
+
static create: () => PagePrefix;
|
|
180
|
+
static fromString: (value: string) => PagePrefix | false;
|
|
181
|
+
static fromStringOrThrow: (value: string) => PagePrefixValue;
|
|
182
|
+
static castOrCreateRandom: (value: string) => PagePrefix;
|
|
183
|
+
static isValid: (prefix: string | 999) => prefix is PagePrefixValue;
|
|
184
|
+
get value(): PagePrefixValue;
|
|
185
|
+
set value(value: string);
|
|
186
|
+
private constructor();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type SchemaPrefixValue = string & {
|
|
190
|
+
__SCHEMA_PREFIX__: true;
|
|
179
191
|
};
|
|
180
192
|
declare class SchemaPrefix {
|
|
181
193
|
private _value;
|
|
@@ -187,25 +199,17 @@ declare class SchemaPrefix {
|
|
|
187
199
|
static fromString: (value: string) => SchemaPrefix | false;
|
|
188
200
|
static castOrCreateRandom: (value: string) => SchemaPrefix;
|
|
189
201
|
static isValid: (prefix: string | 999) => prefix is SchemaPrefixValue;
|
|
202
|
+
toJSON(): void;
|
|
190
203
|
get value(): SchemaPrefixValue;
|
|
204
|
+
get isValid(): boolean;
|
|
191
205
|
set value(value: string);
|
|
192
206
|
private constructor();
|
|
193
207
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
static fromValue: (value: PagePrefixValue) => PagePrefix;
|
|
200
|
-
static create: () => PagePrefix;
|
|
201
|
-
static fromString: (value: string) => PagePrefix | false;
|
|
202
|
-
static fromStringOrThrow: (value: string) => PagePrefixValue;
|
|
203
|
-
static castOrCreateRandom: (value: string) => PagePrefix;
|
|
204
|
-
static isValid: (prefix: string | 999) => prefix is PagePrefixValue;
|
|
205
|
-
get value(): PagePrefixValue;
|
|
206
|
-
set value(value: string);
|
|
207
|
-
private constructor();
|
|
208
|
-
}
|
|
208
|
+
|
|
209
|
+
type VarID = `${SchemaPrefixValue}_${PagePrefixValue}`;
|
|
210
|
+
declare const VarID: {
|
|
211
|
+
create: (schemaPrefix: SchemaPrefixValue, pagePrefix: PagePrefixValue) => VarID;
|
|
212
|
+
};
|
|
209
213
|
|
|
210
214
|
declare const BuilderVariableType: {
|
|
211
215
|
readonly numericWithOptions: true;
|
|
@@ -299,12 +303,14 @@ declare class BuilderPage extends BuilderObject<"builder-page", BuilderPageDto>
|
|
|
299
303
|
interface ExcludeByPageAction {
|
|
300
304
|
readonly kind: "exclude-by-pageId";
|
|
301
305
|
readonly pageId: PageID;
|
|
306
|
+
readonly pagePrefix: PagePrefixValue;
|
|
302
307
|
readonly mainText: string;
|
|
303
308
|
readonly pageNumber: number;
|
|
304
309
|
}
|
|
305
310
|
interface JumpToPageAction {
|
|
306
311
|
readonly kind: "jump-to-page";
|
|
307
312
|
readonly pageId: PageID;
|
|
313
|
+
readonly pagePrefix: PagePrefixValue;
|
|
308
314
|
readonly mainText: string;
|
|
309
315
|
readonly pageNumber: number;
|
|
310
316
|
}
|
|
@@ -565,7 +571,7 @@ interface BuilderRuleDto {
|
|
|
565
571
|
readonly name: string;
|
|
566
572
|
readonly conditions: ReadonlyArray<BuilderConditionDto | BuilderConditionGroupDto>;
|
|
567
573
|
readonly excludeTags: ReadonlyArray<string>;
|
|
568
|
-
readonly excludePages: ReadonlyArray<
|
|
574
|
+
readonly excludePages: ReadonlyArray<PageID>;
|
|
569
575
|
readonly jumpToPage: string | false;
|
|
570
576
|
}
|
|
571
577
|
declare class BuilderRule extends BuilderObject<"builder-rule", BuilderRuleDto> {
|
|
@@ -600,7 +606,7 @@ declare class PageActionManager {
|
|
|
600
606
|
private readonly _initialSelection;
|
|
601
607
|
readonly selectItems: ReadonlyArray<ExcludeByPageIdSelectItem>;
|
|
602
608
|
constructor(validOptions: RuleInput["_pageIdActions"], initialSelection: ReadonlyArray<string>);
|
|
603
|
-
getCurrentSelection(): ReadonlyArray<
|
|
609
|
+
getCurrentSelection(): ReadonlyArray<PageID>;
|
|
604
610
|
getEngineAction(): ReadonlyArray<ExcludeByPageAction>;
|
|
605
611
|
}
|
|
606
612
|
|
|
@@ -634,7 +640,7 @@ interface SchemaBuildOutput {
|
|
|
634
640
|
declare class BuilderSchema {
|
|
635
641
|
readonly id: SchemaID;
|
|
636
642
|
name: string;
|
|
637
|
-
|
|
643
|
+
readonly prefix: SchemaPrefix;
|
|
638
644
|
baseHeight: number;
|
|
639
645
|
baseWidth: number;
|
|
640
646
|
backgroundColor: string;
|
|
@@ -642,7 +648,6 @@ declare class BuilderSchema {
|
|
|
642
648
|
mainImage: ImageFile | false;
|
|
643
649
|
private _rules;
|
|
644
650
|
get rules(): ReadonlyArray<BuilderRule>;
|
|
645
|
-
get prefix(): SchemaPrefixValue;
|
|
646
651
|
private readonly _tagCollection;
|
|
647
652
|
get tags(): ReadonlyArray<BuilderTag>;
|
|
648
653
|
static create(id: SchemaID, name: string, prefix: SchemaPrefixValue): BuilderSchema;
|
|
@@ -682,4 +687,4 @@ declare class BuilderText extends BuilderObject<'builder-text', BuilderTextDto>
|
|
|
682
687
|
toJson(): BuilderTextDto;
|
|
683
688
|
}
|
|
684
689
|
|
|
685
|
-
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, PagePrefix, PagePrefixValue, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem,
|
|
690
|
+
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, PagePrefix, PagePrefixValue, QuestionVariable, RuleInput, RuleOptionSelectItem, RuleVariableSelectItem, SingleSelectItem, TagActionManager, TagCollection, VarID, VideoFile, createRandomPrefix };
|