@media-quest/engine 0.0.7 → 0.0.9

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.
@@ -251,6 +251,37 @@ declare namespace DState {
251
251
  export {};
252
252
  }
253
253
 
254
+ type ID<B extends string> = string & {
255
+ __ID__: B;
256
+ };
257
+ /**
258
+ * Creates a object with helper functions for a specific ID type
259
+ * @param idName
260
+ */
261
+ declare const createTypedIdSingleton: <const B extends string>(idName: B) => Readonly<{
262
+ create: () => ID<B>;
263
+ is: (id: string) => id is ID<B>;
264
+ ensure: (id: string) => ID<B>;
265
+ validateOrThrow: (id: string) => ID<B>;
266
+ name: B;
267
+ }>;
268
+ type SchemaID = ID<"SCHEMA">;
269
+ declare const SchemaID: Readonly<{
270
+ create: () => ID<"SCHEMA">;
271
+ is: (id: string) => id is ID<"SCHEMA">;
272
+ ensure: (id: string) => ID<"SCHEMA">;
273
+ validateOrThrow: (id: string) => ID<"SCHEMA">;
274
+ name: "SCHEMA";
275
+ }>;
276
+ type PageID = ID<"PAGE">;
277
+ declare const PageID: Readonly<{
278
+ create: () => ID<"PAGE">;
279
+ is: (id: string) => id is ID<"PAGE">;
280
+ ensure: (id: string) => ID<"PAGE">;
281
+ validateOrThrow: (id: string) => ID<"PAGE">;
282
+ name: "PAGE";
283
+ }>;
284
+
254
285
  type CommandTarget = "VIDEO" | "AUDIO" | "ELEMENT" | "PAGE_QUE" | "ENGINE" | "STATE";
255
286
  type CommandKind = `${Uppercase<CommandTarget>}_${Uppercase<string>}_COMMAND`;
256
287
  type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", {
@@ -292,7 +323,7 @@ type ElementCommand = CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", Animation
292
323
  type PageQueCommand = CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", {
293
324
  tagIds: string[];
294
325
  }> | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", {
295
- pageIds: Array<string>;
326
+ pageIds: Array<PageID>;
296
327
  }> | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", {
297
328
  readonly pageId: string;
298
329
  }>;
@@ -398,7 +429,7 @@ declare namespace Rule {
398
429
 
399
430
  type PageQueRules = Rule<PageQueCommand, never>;
400
431
  interface PageDto {
401
- readonly id: string;
432
+ readonly id: PageID;
402
433
  readonly elements: Array<DElementDto>;
403
434
  readonly tags?: string[];
404
435
  readonly mainVideoId?: string;
@@ -413,8 +444,7 @@ interface PageSequenceDto {
413
444
  readonly pages: Array<PageDto>;
414
445
  }
415
446
  interface SchemaDto {
416
- readonly id: string;
417
- readonly prefix: string;
447
+ readonly id: SchemaID;
418
448
  readonly baseHeight: number;
419
449
  readonly baseWidth: number;
420
450
  readonly backgroundColor: string;
@@ -540,4 +570,4 @@ declare namespace DUtil {
540
570
  const minFn: (lowerLimit: number) => (value: number) => number;
541
571
  }
542
572
 
543
- export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, Match, NavigationCommand, PageDto, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SolveResult, StateCommand, VideoCommand };
573
+ export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, ID, Match, NavigationCommand, PageDto, PageID, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SchemaID, SolveResult, StateCommand, VideoCommand, createTypedIdSingleton };
@@ -251,6 +251,37 @@ declare namespace DState {
251
251
  export {};
252
252
  }
253
253
 
254
+ type ID<B extends string> = string & {
255
+ __ID__: B;
256
+ };
257
+ /**
258
+ * Creates a object with helper functions for a specific ID type
259
+ * @param idName
260
+ */
261
+ declare const createTypedIdSingleton: <const B extends string>(idName: B) => Readonly<{
262
+ create: () => ID<B>;
263
+ is: (id: string) => id is ID<B>;
264
+ ensure: (id: string) => ID<B>;
265
+ validateOrThrow: (id: string) => ID<B>;
266
+ name: B;
267
+ }>;
268
+ type SchemaID = ID<"SCHEMA">;
269
+ declare const SchemaID: Readonly<{
270
+ create: () => ID<"SCHEMA">;
271
+ is: (id: string) => id is ID<"SCHEMA">;
272
+ ensure: (id: string) => ID<"SCHEMA">;
273
+ validateOrThrow: (id: string) => ID<"SCHEMA">;
274
+ name: "SCHEMA";
275
+ }>;
276
+ type PageID = ID<"PAGE">;
277
+ declare const PageID: Readonly<{
278
+ create: () => ID<"PAGE">;
279
+ is: (id: string) => id is ID<"PAGE">;
280
+ ensure: (id: string) => ID<"PAGE">;
281
+ validateOrThrow: (id: string) => ID<"PAGE">;
282
+ name: "PAGE";
283
+ }>;
284
+
254
285
  type CommandTarget = "VIDEO" | "AUDIO" | "ELEMENT" | "PAGE_QUE" | "ENGINE" | "STATE";
255
286
  type CommandKind = `${Uppercase<CommandTarget>}_${Uppercase<string>}_COMMAND`;
256
287
  type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", {
@@ -292,7 +323,7 @@ type ElementCommand = CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", Animation
292
323
  type PageQueCommand = CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", {
293
324
  tagIds: string[];
294
325
  }> | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", {
295
- pageIds: Array<string>;
326
+ pageIds: Array<PageID>;
296
327
  }> | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", {
297
328
  readonly pageId: string;
298
329
  }>;
@@ -398,7 +429,7 @@ declare namespace Rule {
398
429
 
399
430
  type PageQueRules = Rule<PageQueCommand, never>;
400
431
  interface PageDto {
401
- readonly id: string;
432
+ readonly id: PageID;
402
433
  readonly elements: Array<DElementDto>;
403
434
  readonly tags?: string[];
404
435
  readonly mainVideoId?: string;
@@ -413,8 +444,7 @@ interface PageSequenceDto {
413
444
  readonly pages: Array<PageDto>;
414
445
  }
415
446
  interface SchemaDto {
416
- readonly id: string;
417
- readonly prefix: string;
447
+ readonly id: SchemaID;
418
448
  readonly baseHeight: number;
419
449
  readonly baseWidth: number;
420
450
  readonly backgroundColor: string;
@@ -540,4 +570,4 @@ declare namespace DUtil {
540
570
  const minFn: (lowerLimit: number) => (value: number) => number;
541
571
  }
542
572
 
543
- export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, Match, NavigationCommand, PageDto, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SolveResult, StateCommand, VideoCommand };
573
+ export { AnimationDto, AudioCommand, AudioPlayEvent, AutoPlayAudio, AutoPlayElement, AutoPlayPause, AutoPlayVideo, BooleanStateProperty, Condition, DAudioDto, DAudioEvent, DAutoPlaySequence, DCommand, DCss, DDivDto, DElementBaseDto, DElementDto, DEvent, DEventHandler, DImageEvent, DImgDto, DPageEvents, DState, DStyle, DTextDto, DUtil, DVideoDto, DVideoEvent, DWindowEvents, ElementCommand, EngineCommand, Fact, ID, Match, NavigationCommand, PageDto, PageID, PageQueCommand, PageQueRules, PageSequenceDto, QueryChangedEvent, QueryChangedHandler, RandomObjectId, Rule, RuleEngine, RuleEngineError, SchemaDto, SchemaEngine, SchemaID, SolveResult, StateCommand, VideoCommand, createTypedIdSingleton };