@educabot/educablocks-boards 0.2.34 → 0.2.35
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.
|
@@ -4,43 +4,49 @@ exports.getBoards = exports.getBoardById = exports.getAllBoards = void 0;
|
|
|
4
4
|
const getAllBoards = ({ boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
|
|
5
5
|
prop: '',
|
|
6
6
|
value: ''
|
|
7
|
-
} }) => {
|
|
7
|
+
}, include = [], }) => {
|
|
8
8
|
switch (type) {
|
|
9
9
|
case 'machineLearning':
|
|
10
10
|
return boards.filter(b => b.type === 'machineLearning' &&
|
|
11
11
|
(hidden || b.show === 1) &&
|
|
12
12
|
(premium || !b.premium) &&
|
|
13
13
|
(disabled || b.enabled) &&
|
|
14
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
14
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
15
|
+
(include.length === 0 || include.includes(b.id)));
|
|
15
16
|
case 'senior':
|
|
16
17
|
return boards.filter(b => b.type === 'senior' &&
|
|
17
18
|
(hidden || b.show === 1) &&
|
|
18
19
|
(premium || !b.premium) &&
|
|
19
20
|
(disabled || b.enabled) &&
|
|
20
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
21
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
22
|
+
(include.length === 0 || include.includes(b.id)));
|
|
21
23
|
case 'junior':
|
|
22
24
|
return boards.filter(b => b.type === 'junior' &&
|
|
23
25
|
(hidden || b.show === 1) &&
|
|
24
26
|
(premium || !b.premium) &&
|
|
25
27
|
(disabled || b.enabled) &&
|
|
26
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
28
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
29
|
+
(include.length === 0 || include.includes(b.id)));
|
|
27
30
|
case 'code':
|
|
28
31
|
return boards.filter(b => b.type === 'senior' &&
|
|
29
32
|
b.enabledForCode > 0 &&
|
|
30
33
|
(hidden || b.show === 1) &&
|
|
31
34
|
(premium || !b.premium) &&
|
|
32
35
|
(disabled || b.enabled) &&
|
|
33
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
36
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
37
|
+
(include.length === 0 || include.includes(b.id)));
|
|
34
38
|
case 'aula':
|
|
35
39
|
return boards.filter(b => (hidden || b.showOnAula === 1) &&
|
|
36
40
|
(disabled || b.enabled) &&
|
|
37
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
41
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
42
|
+
(include.length === 0 || include.includes(b.id)));
|
|
38
43
|
case 'all':
|
|
39
44
|
default:
|
|
40
45
|
return boards.filter(b => (hidden || b.show === 1) &&
|
|
41
46
|
(premium || !b.premium) &&
|
|
42
47
|
(disabled || b.enabled) &&
|
|
43
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
48
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
49
|
+
(include.length === 0 || include.includes(b.id)));
|
|
44
50
|
}
|
|
45
51
|
};
|
|
46
52
|
exports.getAllBoards = getAllBoards;
|
|
@@ -67,6 +73,6 @@ exports.getBoardById = getBoardById;
|
|
|
67
73
|
const getBoards = (boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
|
|
68
74
|
prop: '',
|
|
69
75
|
value: ''
|
|
70
|
-
}) => (0, exports.getAllBoards)({ boards, type, premium, disabled, hidden, exclude });
|
|
76
|
+
}, include = []) => (0, exports.getAllBoards)({ boards, type, premium, disabled, hidden, exclude, include });
|
|
71
77
|
exports.getBoards = getBoards;
|
|
72
78
|
//# sourceMappingURL=boards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boards.js","sourceRoot":"","sources":["../../../src/boards/bo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C,EAAE,CAAA;IAC9D,OAAO,KAAK,CAAC,EAAE,KAAK,OAAO,CAAA;AAC/B,CAAC,CAAC,CAAA;AAJO,QAAA,YAAY,gBAInB;AAEN;;;;;;;;;;;;;EAaE;AACK,MAAM,SAAS,GAAG,CACrB,MAAe,EACf,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,IAAI,EACf,MAAM,GAAG,KAAK,EACd,OAAO,GAAG;IACN,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;CACZ,EACD,OAAO,GAAG,EAAE,EACL,EAAE,CAAC,IAAA,oBAAY,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;AAX5E,QAAA,SAAS,aAWmE"}
|
package/package.json
CHANGED
package/src/boards/boards.ts
CHANGED
|
@@ -12,6 +12,7 @@ type GetAllBoards = {
|
|
|
12
12
|
disabled?: boolean
|
|
13
13
|
hidden?: boolean
|
|
14
14
|
exclude?: ExcludeProp
|
|
15
|
+
include?: number[]
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const getAllBoards = ({
|
|
@@ -23,7 +24,8 @@ export const getAllBoards = ({
|
|
|
23
24
|
exclude = {
|
|
24
25
|
prop: '',
|
|
25
26
|
value: ''
|
|
26
|
-
}
|
|
27
|
+
},
|
|
28
|
+
include = [],
|
|
27
29
|
}: GetAllBoards): Board[] => {
|
|
28
30
|
switch (type) {
|
|
29
31
|
case 'machineLearning':
|
|
@@ -32,7 +34,8 @@ export const getAllBoards = ({
|
|
|
32
34
|
(hidden || b.show === 1) &&
|
|
33
35
|
(premium || !b.premium) &&
|
|
34
36
|
(disabled || b.enabled) &&
|
|
35
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
37
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
38
|
+
(include.length === 0 || include.includes(b.id))
|
|
36
39
|
)
|
|
37
40
|
case 'senior':
|
|
38
41
|
return boards.filter(b =>
|
|
@@ -40,7 +43,8 @@ export const getAllBoards = ({
|
|
|
40
43
|
(hidden || b.show === 1) &&
|
|
41
44
|
(premium || !b.premium) &&
|
|
42
45
|
(disabled || b.enabled) &&
|
|
43
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
46
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
47
|
+
(include.length === 0 || include.includes(b.id))
|
|
44
48
|
)
|
|
45
49
|
case 'junior':
|
|
46
50
|
return boards.filter(b =>
|
|
@@ -48,7 +52,8 @@ export const getAllBoards = ({
|
|
|
48
52
|
(hidden || b.show === 1) &&
|
|
49
53
|
(premium || !b.premium) &&
|
|
50
54
|
(disabled || b.enabled) &&
|
|
51
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
55
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
56
|
+
(include.length === 0 || include.includes(b.id))
|
|
52
57
|
)
|
|
53
58
|
case 'code':
|
|
54
59
|
return boards.filter(b =>
|
|
@@ -57,13 +62,15 @@ export const getAllBoards = ({
|
|
|
57
62
|
(hidden || b.show === 1) &&
|
|
58
63
|
(premium || !b.premium) &&
|
|
59
64
|
(disabled || b.enabled) &&
|
|
60
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
65
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
66
|
+
(include.length === 0 || include.includes(b.id))
|
|
61
67
|
)
|
|
62
68
|
case 'aula':
|
|
63
69
|
return boards.filter(b =>
|
|
64
70
|
(hidden || b.showOnAula === 1) &&
|
|
65
71
|
(disabled || b.enabled) &&
|
|
66
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
72
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
73
|
+
(include.length === 0 || include.includes(b.id))
|
|
67
74
|
)
|
|
68
75
|
case 'all':
|
|
69
76
|
default:
|
|
@@ -71,7 +78,8 @@ export const getAllBoards = ({
|
|
|
71
78
|
(hidden || b.show === 1) &&
|
|
72
79
|
(premium || !b.premium) &&
|
|
73
80
|
(disabled || b.enabled) &&
|
|
74
|
-
(!b[exclude.prop] || b[exclude.prop] !== exclude.value)
|
|
81
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value) &&
|
|
82
|
+
(include.length === 0 || include.includes(b.id))
|
|
75
83
|
)
|
|
76
84
|
}
|
|
77
85
|
}
|
|
@@ -106,4 +114,5 @@ export const getBoards = (
|
|
|
106
114
|
prop: '',
|
|
107
115
|
value: ''
|
|
108
116
|
},
|
|
109
|
-
|
|
117
|
+
include = [],
|
|
118
|
+
): Board[] => getAllBoards({ boards, type, premium, disabled, hidden, exclude, include })
|