@media-quest/engine 0.0.21 → 0.0.23

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/Delement/DElement.dto.ts +5 -5
  3. package/src/Delement/DElement.ts +88 -88
  4. package/src/Delement/DImg.ts +39 -39
  5. package/src/Delement/DStyle-utils.ts +616 -616
  6. package/src/Delement/DStyle.ts +165 -165
  7. package/src/Delement/DText.ts +13 -13
  8. package/src/Delement/Ddiv.ts +25 -25
  9. package/src/Delement/button-click-action.ts +35 -35
  10. package/src/Delement/css.spec.ts +36 -36
  11. package/src/Delement/css.ts +46 -46
  12. package/src/Delement/element-factory.ts +40 -40
  13. package/src/common/DMaybe.ts +46 -46
  14. package/src/common/DTimestamp.ts +20 -20
  15. package/src/common/DTmestamp.spec.ts +11 -11
  16. package/src/common/result.ts +41 -41
  17. package/src/engine/SchemaDto.ts +24 -24
  18. package/src/engine/SchemaEngine.ts +150 -150
  19. package/src/engine/SchemaResult.ts +10 -10
  20. package/src/engine/dplayer.spec.ts +91 -91
  21. package/src/engine/dplayer.ts +104 -104
  22. package/src/engine/history-que.spec.ts +67 -67
  23. package/src/engine/history-que.ts +17 -17
  24. package/src/engine/next-que.spec.ts +121 -121
  25. package/src/engine/next-que.ts +101 -101
  26. package/src/engine/page-que-ruleengine-action.ts +6 -6
  27. package/src/engine/scale.spec.ts +38 -38
  28. package/src/engine/scale.ts +70 -70
  29. package/src/events/mq-events.ts +63 -63
  30. package/src/page/Page.ts +182 -182
  31. package/src/page/media-player.ts +117 -117
  32. package/src/page/page-component.ts +113 -113
  33. package/src/page/page-result.ts +11 -11
  34. package/src/page/task-manager.ts +240 -240
  35. package/src/page/task-state.ts +55 -55
  36. package/src/page/task.ts +90 -90
  37. package/src/public-api.ts +26 -26
  38. package/src/rules/__test__/complex-condition.spec.ts +15 -15
  39. package/src/rules/__test__/conditon.spec.ts +124 -124
  40. package/src/rules/__test__/numeric-condition.spec.ts +84 -84
  41. package/src/rules/__test__/rule-engine.spec.ts +348 -348
  42. package/src/rules/__test__/rule-evaluation.spec.ts +140 -140
  43. package/src/rules/__test__/string-condition.spec.ts +41 -41
  44. package/src/rules/condition.ts +191 -191
  45. package/src/rules/fact.ts +18 -18
  46. package/src/rules/rule-engine.ts +45 -45
  47. package/src/rules/rule.ts +40 -40
  48. package/src/utils/DUtil.ts +116 -116
  49. package/src/utils/ID.spec.ts +39 -39
  50. package/src/utils/ID.ts +73 -73
  51. package/tsconfig.json +19 -19
@@ -1,84 +1,84 @@
1
- import { Condition } from "../condition";
2
- import { Fact } from "../fact";
3
- const numFact = (n: number): [Fact.Numeric] => [
4
- {
5
- kind: "numeric-fact",
6
- value: n,
7
- label: "Label-for " + n,
8
- referenceId: "test-fact",
9
- referenceLabel: "test-fact-label",
10
- },
11
- ];
12
- const eq0: Condition.Numeric = {
13
- kind: "numeric-condition",
14
- referenceId: "test-fact",
15
- operator: "eq",
16
- value: 0,
17
- referenceLabel: "fact-label",
18
- valueLabel: "value-label",
19
- };
20
-
21
- const notEq0: Condition.Numeric = {
22
- ...eq0,
23
- operator: "not-eq",
24
- };
25
-
26
- const lessThen0: Condition.Numeric = {
27
- ...eq0,
28
- operator: "less-then",
29
- };
30
-
31
- const greaterThen0: Condition.Numeric = {
32
- ...eq0,
33
- operator: "greater-then",
34
- };
35
- const greaterThen0Inclusive: Condition.Numeric = {
36
- ...eq0,
37
- operator: "greater-then-inclusive",
38
- };
39
-
40
- const lessThen0Inclusive: Condition.Numeric = {
41
- ...eq0,
42
- operator: "less-then-inclusive",
43
- };
44
-
45
- describe("Numeric conditions", () => {
46
- // beforeEach(() => {});
47
-
48
- it("eq works", () => {
49
- const equals = Condition.evaluate(eq0, numFact(0));
50
- const notEquals = Condition.evaluate(eq0, numFact(1));
51
- expect(equals).toBe(true);
52
- expect(notEquals).toBe(false);
53
- });
54
-
55
- it("not-eq works", () => {
56
- expect(Condition.evaluate(notEq0, numFact(1))).toBe(true);
57
- expect(Condition.evaluate(notEq0, numFact(-1))).toBe(true);
58
- expect(Condition.evaluate(notEq0, numFact(0))).toBe(false);
59
- });
60
-
61
- it("less than works", () => {
62
- expect(Condition.evaluate(lessThen0, numFact(-1))).toBe(true);
63
- expect(Condition.evaluate(lessThen0, numFact(0))).toBe(false);
64
- expect(Condition.evaluate(lessThen0, numFact(1))).toBe(false);
65
- });
66
-
67
- it("less than inclusive works", () => {
68
- expect(Condition.evaluate(lessThen0Inclusive, numFact(-1))).toBe(true);
69
- expect(Condition.evaluate(lessThen0Inclusive, numFact(0))).toBe(true);
70
- expect(Condition.evaluate(lessThen0Inclusive, numFact(1))).toBe(false);
71
- });
72
-
73
- it("greater than works", () => {
74
- expect(Condition.evaluate(greaterThen0, numFact(-1))).toBe(false);
75
- expect(Condition.evaluate(greaterThen0, numFact(0))).toBe(false);
76
- expect(Condition.evaluate(greaterThen0, numFact(1))).toBe(true);
77
- });
78
-
79
- it("greater than inclusive works", () => {
80
- expect(Condition.evaluate(greaterThen0Inclusive, numFact(-1))).toBe(false);
81
- expect(Condition.evaluate(greaterThen0Inclusive, numFact(0))).toBe(true);
82
- expect(Condition.evaluate(greaterThen0Inclusive, numFact(1))).toBe(true);
83
- });
84
- });
1
+ import { Condition } from "../condition";
2
+ import { Fact } from "../fact";
3
+ const numFact = (n: number): [Fact.Numeric] => [
4
+ {
5
+ kind: "numeric-fact",
6
+ value: n,
7
+ label: "Label-for " + n,
8
+ referenceId: "test-fact",
9
+ referenceLabel: "test-fact-label",
10
+ },
11
+ ];
12
+ const eq0: Condition.Numeric = {
13
+ kind: "numeric-condition",
14
+ referenceId: "test-fact",
15
+ operator: "eq",
16
+ value: 0,
17
+ referenceLabel: "fact-label",
18
+ valueLabel: "value-label",
19
+ };
20
+
21
+ const notEq0: Condition.Numeric = {
22
+ ...eq0,
23
+ operator: "not-eq",
24
+ };
25
+
26
+ const lessThen0: Condition.Numeric = {
27
+ ...eq0,
28
+ operator: "less-then",
29
+ };
30
+
31
+ const greaterThen0: Condition.Numeric = {
32
+ ...eq0,
33
+ operator: "greater-then",
34
+ };
35
+ const greaterThen0Inclusive: Condition.Numeric = {
36
+ ...eq0,
37
+ operator: "greater-then-inclusive",
38
+ };
39
+
40
+ const lessThen0Inclusive: Condition.Numeric = {
41
+ ...eq0,
42
+ operator: "less-then-inclusive",
43
+ };
44
+
45
+ describe("Numeric conditions", () => {
46
+ // beforeEach(() => {});
47
+
48
+ it("eq works", () => {
49
+ const equals = Condition.evaluate(eq0, numFact(0));
50
+ const notEquals = Condition.evaluate(eq0, numFact(1));
51
+ expect(equals).toBe(true);
52
+ expect(notEquals).toBe(false);
53
+ });
54
+
55
+ it("not-eq works", () => {
56
+ expect(Condition.evaluate(notEq0, numFact(1))).toBe(true);
57
+ expect(Condition.evaluate(notEq0, numFact(-1))).toBe(true);
58
+ expect(Condition.evaluate(notEq0, numFact(0))).toBe(false);
59
+ });
60
+
61
+ it("less than works", () => {
62
+ expect(Condition.evaluate(lessThen0, numFact(-1))).toBe(true);
63
+ expect(Condition.evaluate(lessThen0, numFact(0))).toBe(false);
64
+ expect(Condition.evaluate(lessThen0, numFact(1))).toBe(false);
65
+ });
66
+
67
+ it("less than inclusive works", () => {
68
+ expect(Condition.evaluate(lessThen0Inclusive, numFact(-1))).toBe(true);
69
+ expect(Condition.evaluate(lessThen0Inclusive, numFact(0))).toBe(true);
70
+ expect(Condition.evaluate(lessThen0Inclusive, numFact(1))).toBe(false);
71
+ });
72
+
73
+ it("greater than works", () => {
74
+ expect(Condition.evaluate(greaterThen0, numFact(-1))).toBe(false);
75
+ expect(Condition.evaluate(greaterThen0, numFact(0))).toBe(false);
76
+ expect(Condition.evaluate(greaterThen0, numFact(1))).toBe(true);
77
+ });
78
+
79
+ it("greater than inclusive works", () => {
80
+ expect(Condition.evaluate(greaterThen0Inclusive, numFact(-1))).toBe(false);
81
+ expect(Condition.evaluate(greaterThen0Inclusive, numFact(0))).toBe(true);
82
+ expect(Condition.evaluate(greaterThen0Inclusive, numFact(1))).toBe(true);
83
+ });
84
+ });