chelys 2.2.2 → 2.3.3
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/dist/constitution.d.ts +5 -0
- package/dist/constitution.js +12 -3
- package/dist/favorite.d.ts +22 -0
- package/dist/favorite.js +5 -0
- package/dist/grade.d.ts +5 -0
- package/dist/grade.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/message.d.ts +5 -0
- package/dist/message.js +5 -0
- package/package.json +31 -31
package/dist/constitution.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResponseStatus } from ".";
|
|
1
2
|
export declare const OWNER_INDEX = 0;
|
|
2
3
|
export declare enum ConstitutionType {
|
|
3
4
|
GRADE = 0,
|
|
@@ -25,6 +26,7 @@ export interface Constitution {
|
|
|
25
26
|
export declare const EMPTY_CONSTITUTION: Constitution;
|
|
26
27
|
export declare function canModifySongs(constitution: Constitution): boolean;
|
|
27
28
|
export declare function canModifyVotes(constitution: Constitution): boolean;
|
|
29
|
+
export declare function areResultsPublic(constitution: Constitution): boolean;
|
|
28
30
|
export interface CstReqGet {
|
|
29
31
|
ids: string[];
|
|
30
32
|
}
|
|
@@ -49,3 +51,6 @@ export interface CstReqUpdateState {
|
|
|
49
51
|
id: string;
|
|
50
52
|
newState: number;
|
|
51
53
|
}
|
|
54
|
+
export interface CstResJoin {
|
|
55
|
+
status: ResponseStatus;
|
|
56
|
+
}
|
package/dist/constitution.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// TYPE / CONST
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.canModifyVotes = exports.canModifySongs = exports.EMPTY_CONSTITUTION = exports.AnonymousLevel = exports.ConstitutionType = exports.OWNER_INDEX = void 0;
|
|
4
|
+
exports.areResultsPublic = exports.canModifyVotes = exports.canModifySongs = exports.EMPTY_CONSTITUTION = exports.AnonymousLevel = exports.ConstitutionType = exports.OWNER_INDEX = void 0;
|
|
5
|
+
var _1 = require(".");
|
|
5
6
|
exports.OWNER_INDEX = 0;
|
|
6
7
|
var ConstitutionType;
|
|
7
8
|
(function (ConstitutionType) {
|
|
@@ -31,7 +32,7 @@ exports.EMPTY_CONSTITUTION = {
|
|
|
31
32
|
// FUNCTION
|
|
32
33
|
function canModifySongs(constitution) {
|
|
33
34
|
switch (constitution.type) {
|
|
34
|
-
case ConstitutionType.GRADE: return constitution.state ===
|
|
35
|
+
case ConstitutionType.GRADE: return constitution.state === _1.GradeState.SONG_ADD;
|
|
35
36
|
default:
|
|
36
37
|
return false;
|
|
37
38
|
}
|
|
@@ -39,9 +40,17 @@ function canModifySongs(constitution) {
|
|
|
39
40
|
exports.canModifySongs = canModifySongs;
|
|
40
41
|
function canModifyVotes(constitution) {
|
|
41
42
|
switch (constitution.type) {
|
|
42
|
-
case ConstitutionType.GRADE: return constitution.state
|
|
43
|
+
case ConstitutionType.GRADE: return constitution.state <= _1.GradeState.VOTING;
|
|
43
44
|
default:
|
|
44
45
|
return false;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
exports.canModifyVotes = canModifyVotes;
|
|
49
|
+
function areResultsPublic(constitution) {
|
|
50
|
+
switch (constitution.type) {
|
|
51
|
+
case ConstitutionType.GRADE: return constitution.state === _1.GradeState.RESULTS;
|
|
52
|
+
default:
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.areResultsPublic = areResultsPublic;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const FAVORITES_MAX_LENGTH = 5;
|
|
2
|
+
export interface UserFavorites {
|
|
3
|
+
uid: string;
|
|
4
|
+
favs: number[];
|
|
5
|
+
}
|
|
6
|
+
export interface CstFavReqAdd {
|
|
7
|
+
cstId: string;
|
|
8
|
+
songId: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CstFavReqRemove {
|
|
11
|
+
cstId: string;
|
|
12
|
+
songId: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CstFavReqGet {
|
|
15
|
+
cstId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CstFavReqUnsubscribe {
|
|
18
|
+
cstId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CstFavResUpdate {
|
|
21
|
+
userFavorites: UserFavorites;
|
|
22
|
+
}
|
package/dist/favorite.js
ADDED
package/dist/grade.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export interface GradeSummary {
|
|
|
10
10
|
voteCount: number;
|
|
11
11
|
userCount: Map<string, number>;
|
|
12
12
|
}
|
|
13
|
+
export declare enum GradeState {
|
|
14
|
+
SONG_ADD = 0,
|
|
15
|
+
VOTING = 1,
|
|
16
|
+
RESULTS = 2
|
|
17
|
+
}
|
|
13
18
|
export interface KGradeUserData {
|
|
14
19
|
uid: string;
|
|
15
20
|
values: Record<string, unknown>;
|
package/dist/grade.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// TYPE / CONST
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GradeState = void 0;
|
|
5
|
+
var GradeState;
|
|
6
|
+
(function (GradeState) {
|
|
7
|
+
GradeState[GradeState["SONG_ADD"] = 0] = "SONG_ADD";
|
|
8
|
+
GradeState[GradeState["VOTING"] = 1] = "VOTING";
|
|
9
|
+
GradeState[GradeState["RESULTS"] = 2] = "RESULTS";
|
|
10
|
+
})(GradeState = exports.GradeState || (exports.GradeState = {}));
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./client"), exports);
|
|
14
14
|
__exportStar(require("./constitution"), exports);
|
|
15
|
+
__exportStar(require("./favorite"), exports);
|
|
15
16
|
__exportStar(require("./grade"), exports);
|
|
16
17
|
__exportStar(require("./message"), exports);
|
|
17
18
|
__exportStar(require("./song"), exports);
|
package/dist/message.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare enum EventType {
|
|
|
11
11
|
CST_join = "CST-join",
|
|
12
12
|
CST_state = "CST-state",
|
|
13
13
|
CST_unsubscribe = "CST-unsubscribe",
|
|
14
|
+
CST_FAV_add = "CST-FAV-add",
|
|
15
|
+
CST_FAV_remove = "CST-FAV-remove",
|
|
16
|
+
CST_FAV_get = "CST-FAV-get",
|
|
17
|
+
CST_FAV_unsubscribe = "CST-FAV-unsubscribe",
|
|
14
18
|
CST_SONG_add = "CST-SONG-add",
|
|
15
19
|
CST_SONG_get_all = "CST-SONG-get-all",
|
|
16
20
|
CST_SONG_remove = "CST-SONG-remove",
|
|
@@ -26,6 +30,7 @@ export declare enum EventType {
|
|
|
26
30
|
USER_get_all = "USER-get-all",
|
|
27
31
|
USER_unsubscribe = "USER-unsubscribe",
|
|
28
32
|
CST_update = "CST-update",
|
|
33
|
+
CST_FAV_update = "CST-FAV-update",
|
|
29
34
|
CST_SONG_update = "CST-SONG-update",
|
|
30
35
|
CST_SONG_GRADE_summary_update = "CST-SONG-GRADE-summary-update",
|
|
31
36
|
CST_SONG_GRADE_userdata_update = "CST-SONG-GRADE-userdata-update",
|
package/dist/message.js
CHANGED
|
@@ -13,6 +13,10 @@ var EventType;
|
|
|
13
13
|
EventType["CST_join"] = "CST-join";
|
|
14
14
|
EventType["CST_state"] = "CST-state";
|
|
15
15
|
EventType["CST_unsubscribe"] = "CST-unsubscribe";
|
|
16
|
+
EventType["CST_FAV_add"] = "CST-FAV-add";
|
|
17
|
+
EventType["CST_FAV_remove"] = "CST-FAV-remove";
|
|
18
|
+
EventType["CST_FAV_get"] = "CST-FAV-get";
|
|
19
|
+
EventType["CST_FAV_unsubscribe"] = "CST-FAV-unsubscribe";
|
|
16
20
|
EventType["CST_SONG_add"] = "CST-SONG-add";
|
|
17
21
|
EventType["CST_SONG_get_all"] = "CST-SONG-get-all";
|
|
18
22
|
EventType["CST_SONG_remove"] = "CST-SONG-remove";
|
|
@@ -29,6 +33,7 @@ var EventType;
|
|
|
29
33
|
EventType["USER_unsubscribe"] = "USER-unsubscribe";
|
|
30
34
|
// From server
|
|
31
35
|
EventType["CST_update"] = "CST-update";
|
|
36
|
+
EventType["CST_FAV_update"] = "CST-FAV-update";
|
|
32
37
|
EventType["CST_SONG_update"] = "CST-SONG-update";
|
|
33
38
|
EventType["CST_SONG_GRADE_summary_update"] = "CST-SONG-GRADE-summary-update";
|
|
34
39
|
EventType["CST_SONG_GRADE_userdata_update"] = "CST-SONG-GRADE-userdata-update";
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"name": "chelys",
|
|
3
|
+
"version": "2.3.3",
|
|
4
|
+
"description": "Common code between Yatga and Kalimba",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/TableauBits/Chelys.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"matbay"
|
|
16
|
+
],
|
|
17
|
+
"author": "tableaubits",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/TableauBits/Chelys/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/TableauBits/Chelys#readme",
|
|
23
|
+
"dependencies": {},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/"
|
|
26
|
+
],
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^16.10.1",
|
|
30
|
+
"eslint": "^7.32.0",
|
|
31
|
+
"typescript": "^4.4.3"
|
|
32
|
+
}
|
|
33
33
|
}
|