@@ -641,6 +641,17 @@ function sandBox(script, name, verbose, debug, context) {
641
641
}
642
642
}
643
643
644
+ if ( name === 'schedule' ) {
645
+ if ( ! context . schedules ) {
646
+ context . schedules = [ ] ;
647
+ for ( const _id in objects ) {
648
+ if ( objects . hasOwnProperty ( _id ) && objects [ _id ] . type === 'schedule' ) {
649
+ context . schedules . push ( _id ) ;
650
+ }
651
+ }
652
+ }
653
+ }
654
+
644
655
/**
645
656
* applies all selectors targeting an object or state ID
646
657
* @param {string } objId
@@ -700,7 +711,25 @@ function sandBox(script, name, verbose, debug, context) {
700
711
let res = [ ] ;
701
712
702
713
if ( name === 'schedule' ) {
703
- adapter . getObjectsView
714
+ res = context . schedules ;
715
+ if ( objectIdSelectors . length ) {
716
+ res = res . filter ( channelId => applyIDSelectors ( channelId , objectIdSelectors ) ) ;
717
+ }
718
+
719
+ // filter out those that don't match every common selector
720
+ if ( commonSelectors . length ) {
721
+ res = res . filter ( id => applyCommonSelectors ( id ) ) ;
722
+ }
723
+
724
+ // filter out those that don't match every native selector
725
+ if ( nativeSelectors . length ) {
726
+ res = res . filter ( id => applyNativeSelectors ( id ) ) ;
727
+ }
728
+
729
+ // filter out those that don't match every enum selector
730
+ if ( enumSelectors . length ) {
731
+ res = res . filter ( channelId => applyEnumSelectors ( channelId ) ) ;
732
+ }
704
733
} else
705
734
if ( name === 'channel' ) {
706
735
if ( ! context . channels ) {
@@ -774,7 +803,7 @@ function sandBox(script, name, verbose, debug, context) {
774
803
} else {
775
804
// go through all states
776
805
res = context . stateIds ;
777
- // if the "name" is not state then we filter for the ID aswell
806
+ // if the "name" is not state then we filter for the ID as well
778
807
if ( name && name !== 'state' ) {
779
808
const r = new RegExp ( '^' + name . replace ( / \. / g, '\\.' ) . replace ( / \* / g, '.*' ) + '$' ) ;
780
809
res = res . filter ( id => r . test ( id ) ) ;
0 commit comments