@routevn/creator-model 1.13.1 → 1.13.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/model.js +73 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/model.js CHANGED
@@ -2493,6 +2493,31 @@ const validateAudioEffectAbsoluteValue = ({
2493
2493
  }
2494
2494
  };
2495
2495
 
2496
+ const validateAudioEffectInitialValue = ({
2497
+ value,
2498
+ property,
2499
+ path,
2500
+ errorFactory,
2501
+ }) => {
2502
+ if (value === undefined) {
2503
+ return;
2504
+ }
2505
+
2506
+ if (!isFiniteNumber(value)) {
2507
+ return invalidFromErrorFactory(
2508
+ errorFactory,
2509
+ `${path} must be a finite number when provided`,
2510
+ );
2511
+ }
2512
+
2513
+ return validateAudioEffectAbsoluteValue({
2514
+ value,
2515
+ property,
2516
+ path,
2517
+ errorFactory,
2518
+ });
2519
+ };
2520
+
2496
2521
  const validateAudioEffectKeyframes = ({
2497
2522
  keyframes,
2498
2523
  property,
@@ -2652,9 +2677,9 @@ const validateAudioEffectTween = ({ tween, path, errorFactory }) => {
2652
2677
  }
2653
2678
 
2654
2679
  {
2655
- const result = validateExactKeys({
2680
+ const result = validateAllowedKeys({
2656
2681
  value: config,
2657
- expectedKeys: ["keyframes"],
2682
+ allowedKeys: ["initialValue", "keyframes"],
2658
2683
  path: `${path}.${property}`,
2659
2684
  errorFactory,
2660
2685
  });
@@ -2663,6 +2688,25 @@ const validateAudioEffectTween = ({ tween, path, errorFactory }) => {
2663
2688
  }
2664
2689
  }
2665
2690
 
2691
+ if (!Object.hasOwn(config, "keyframes")) {
2692
+ return invalidFromErrorFactory(
2693
+ errorFactory,
2694
+ `${path}.${property}.keyframes is required`,
2695
+ );
2696
+ }
2697
+
2698
+ {
2699
+ const result = validateAudioEffectInitialValue({
2700
+ value: config.initialValue,
2701
+ property,
2702
+ path: `${path}.${property}.initialValue`,
2703
+ errorFactory,
2704
+ });
2705
+ if (result?.valid === false) {
2706
+ return result;
2707
+ }
2708
+ }
2709
+
2666
2710
  {
2667
2711
  const result = validateAudioEffectKeyframes({
2668
2712
  keyframes: config.keyframes,
@@ -2684,9 +2728,9 @@ const validateAudioEffectFade = ({ fade, path, side, errorFactory }) => {
2684
2728
 
2685
2729
  if (Object.hasOwn(fade, "keyframes")) {
2686
2730
  {
2687
- const result = validateExactKeys({
2731
+ const result = validateAllowedKeys({
2688
2732
  value: fade,
2689
- expectedKeys: ["keyframes"],
2733
+ allowedKeys: ["initialValue", "keyframes"],
2690
2734
  path,
2691
2735
  errorFactory,
2692
2736
  });
@@ -2695,6 +2739,18 @@ const validateAudioEffectFade = ({ fade, path, side, errorFactory }) => {
2695
2739
  }
2696
2740
  }
2697
2741
 
2742
+ {
2743
+ const result = validateAudioEffectInitialValue({
2744
+ value: fade.initialValue,
2745
+ property: "volume",
2746
+ path: `${path}.initialValue`,
2747
+ errorFactory,
2748
+ });
2749
+ if (result?.valid === false) {
2750
+ return result;
2751
+ }
2752
+ }
2753
+
2698
2754
  {
2699
2755
  const result = validateAudioEffectKeyframes({
2700
2756
  keyframes: fade.keyframes,
@@ -2722,7 +2778,7 @@ const validateAudioEffectFade = ({ fade, path, side, errorFactory }) => {
2722
2778
  {
2723
2779
  const result = validateAllowedKeys({
2724
2780
  value: fade,
2725
- allowedKeys: ["delay", "duration", "easing"],
2781
+ allowedKeys: ["initialValue", "delay", "duration", "easing"],
2726
2782
  path,
2727
2783
  errorFactory,
2728
2784
  });
@@ -2731,6 +2787,18 @@ const validateAudioEffectFade = ({ fade, path, side, errorFactory }) => {
2731
2787
  }
2732
2788
  }
2733
2789
 
2790
+ {
2791
+ const result = validateAudioEffectInitialValue({
2792
+ value: fade.initialValue,
2793
+ property: "volume",
2794
+ path: `${path}.initialValue`,
2795
+ errorFactory,
2796
+ });
2797
+ if (result?.valid === false) {
2798
+ return result;
2799
+ }
2800
+ }
2801
+
2734
2802
  if (!Object.hasOwn(fade, "duration")) {
2735
2803
  return invalidFromErrorFactory(
2736
2804
  errorFactory,