@educabot/educablocks-boards 0.1.0
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.
- package/.github/workflows/main.yaml +24 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/src/boards/boards.js +66 -0
- package/dist/src/boards/boards.js.map +1 -0
- package/dist/src/boards/data.js +1378 -0
- package/dist/src/boards/data.js.map +1 -0
- package/dist/src/boards/types.js +18 -0
- package/dist/src/boards/types.js.map +1 -0
- package/dist/src/boards.js +1448 -0
- package/dist/src/boards.js.map +1 -0
- package/dist/src/pins.js +58 -0
- package/dist/src/pins.js.map +1 -0
- package/index.ts +4 -0
- package/package.json +18 -0
- package/readme.md +1 -0
- package/src/boards/boards.ts +101 -0
- package/src/boards/data.ts +1388 -0
- package/src/boards/types.ts +52 -0
- package/src/pins.ts +74 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: "*"
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [16.x, 18.x]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: ${{ matrix.node-version }}
|
|
21
|
+
- run: npm ci
|
|
22
|
+
- run: npm run build --if-present
|
|
23
|
+
- run: npm test
|
|
24
|
+
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBoardById = exports.getBoards = exports.getAllBoards = exports.boards = void 0;
|
|
4
|
+
var data_1 = require("./src/boards/data");
|
|
5
|
+
Object.defineProperty(exports, "boards", { enumerable: true, get: function () { return data_1.boards; } });
|
|
6
|
+
var boards_1 = require("./src/boards/boards");
|
|
7
|
+
Object.defineProperty(exports, "getAllBoards", { enumerable: true, get: function () { return boards_1.getAllBoards; } });
|
|
8
|
+
Object.defineProperty(exports, "getBoards", { enumerable: true, get: function () { return boards_1.getBoards; } });
|
|
9
|
+
Object.defineProperty(exports, "getBoardById", { enumerable: true, get: function () { return boards_1.getBoardById; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAAjC,8FAAA,MAAM,OAAA;AACf,8CAA2E;AAAlE,sGAAA,YAAY,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,sGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBoards = exports.getBoardById = exports.getAllBoards = void 0;
|
|
4
|
+
const getAllBoards = ({ boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
|
|
5
|
+
prop: '',
|
|
6
|
+
value: ''
|
|
7
|
+
} }) => {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case 'senior':
|
|
10
|
+
return boards.filter(b => b.type === 'senior' &&
|
|
11
|
+
(hidden || b.show === 1) &&
|
|
12
|
+
(premium || !b.premium) &&
|
|
13
|
+
(disabled || b.enabled) &&
|
|
14
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value));
|
|
15
|
+
case 'junior':
|
|
16
|
+
return boards.filter(b => b.type === 'junior' &&
|
|
17
|
+
(hidden || b.show === 1) &&
|
|
18
|
+
(premium || !b.premium) &&
|
|
19
|
+
(disabled || b.enabled) &&
|
|
20
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value));
|
|
21
|
+
case 'code':
|
|
22
|
+
return boards.filter(b => b.type === 'senior' &&
|
|
23
|
+
b.enabledForCode > 0 &&
|
|
24
|
+
(hidden || b.show === 1) &&
|
|
25
|
+
(premium || !b.premium) &&
|
|
26
|
+
(disabled || b.enabled) &&
|
|
27
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value));
|
|
28
|
+
case 'aula':
|
|
29
|
+
return boards.filter(b => (hidden || b.showOnAula === 1) &&
|
|
30
|
+
(disabled || b.enabled) &&
|
|
31
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value));
|
|
32
|
+
case 'all':
|
|
33
|
+
default:
|
|
34
|
+
return boards.filter(b => (hidden || b.show === 1) &&
|
|
35
|
+
(premium || !b.premium) &&
|
|
36
|
+
(disabled || b.enabled) &&
|
|
37
|
+
(!b[exclude.prop] || b[exclude.prop] !== exclude.value));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.getAllBoards = getAllBoards;
|
|
41
|
+
const getBoardById = (boards, id) => boards
|
|
42
|
+
.find((board) => {
|
|
43
|
+
const boardId = typeof id === 'string' ? parseInt(id, 10) : id;
|
|
44
|
+
return board.id === boardId;
|
|
45
|
+
});
|
|
46
|
+
exports.getBoardById = getBoardById;
|
|
47
|
+
/**
|
|
48
|
+
* Get all filtered boards
|
|
49
|
+
* legacy support
|
|
50
|
+
*
|
|
51
|
+
* @param boards all boards
|
|
52
|
+
* @param [type='all'] type of board
|
|
53
|
+
* @param [premium=true] include premium boards
|
|
54
|
+
* @param [disabled=true] include disabled boards
|
|
55
|
+
* @param [hidden=false] include hidden boards
|
|
56
|
+
* @param [exclude={
|
|
57
|
+
* prop: '',
|
|
58
|
+
* value: ''
|
|
59
|
+
* }] exclude boards by property name and value
|
|
60
|
+
*/
|
|
61
|
+
const getBoards = (boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
|
|
62
|
+
prop: '',
|
|
63
|
+
value: ''
|
|
64
|
+
}) => (0, exports.getAllBoards)({ boards, type, premium, disabled, hidden, exclude });
|
|
65
|
+
exports.getBoards = getBoards;
|
|
66
|
+
//# sourceMappingURL=boards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boards.js","sourceRoot":"","sources":["../../../src/boards/boards.ts"],"names":[],"mappings":";;;AAgBO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,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,EACU,EAAW,EAAE;IACxB,QAAQ,IAAI,EAAE;QACV,KAAK,QAAQ;YACT,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC,CAAC,IAAI,KAAK,QAAQ;gBACnB,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;gBACxB,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;gBACvB,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC;gBACvB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAC1D,CAAA;QACL,KAAK,QAAQ;YACT,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC,CAAC,IAAI,KAAK,QAAQ;gBACnB,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;gBACxB,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;gBACvB,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC;gBACvB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IA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