chelys 2.3.1 → 2.4.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.
@@ -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
+ }
@@ -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 === 0; // TODO : Magic Number
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 < 1; // TODO : Magic Number
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;
@@ -1,4 +1,4 @@
1
- export declare const FAVORITES_MAX_LENGTH = 5;
1
+ export declare const FAVORITES_MAX_LENGTH = 8;
2
2
  export interface UserFavorites {
3
3
  uid: string;
4
4
  favs: number[];
package/dist/favorite.js CHANGED
@@ -2,4 +2,4 @@
2
2
  // TYPE / CONST
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FAVORITES_MAX_LENGTH = void 0;
5
- exports.FAVORITES_MAX_LENGTH = 5;
5
+ exports.FAVORITES_MAX_LENGTH = 8;
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 = {}));
@@ -0,0 +1,17 @@
1
+ export interface Invite {
2
+ id: string;
3
+ createdBy: string;
4
+ date: string;
5
+ }
6
+ export interface InvReqNew {
7
+ }
8
+ export interface InvReqGet {
9
+ }
10
+ export interface InvReqDelete {
11
+ id: string;
12
+ }
13
+ export interface InvResUnsubscribe {
14
+ }
15
+ export interface InvResUpdate {
16
+ invite: Invite;
17
+ }
package/dist/invite.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TYPE / CONST
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/message.d.ts CHANGED
@@ -24,6 +24,10 @@ export declare enum EventType {
24
24
  CST_SONG_GRADE_get_user = "CST-SONG-GRADE-get-user",
25
25
  CST_SONG_GRADE_get_summary = "CST-SONG-GRADE-get-summary",
26
26
  CST_SONG_GRADE_unsubscribe = "CST-SONG-GRADE-unsubscribe",
27
+ INVITE_delete = "INVITE-delete",
28
+ INVITE_get = "INVITE-get",
29
+ INVITE_new = "INVITE-new",
30
+ INVITE_unsubscribe = "INVITE-unsubscribe",
27
31
  USER_create = "USER-create",
28
32
  USER_edit = "USER-edit",
29
33
  USER_get = "USER-get",
@@ -34,6 +38,7 @@ export declare enum EventType {
34
38
  CST_SONG_update = "CST-SONG-update",
35
39
  CST_SONG_GRADE_summary_update = "CST-SONG-GRADE-summary-update",
36
40
  CST_SONG_GRADE_userdata_update = "CST-SONG-GRADE-userdata-update",
41
+ INVITE_update = "INVITE-update",
37
42
  USER_update = "USER-update"
38
43
  }
39
44
  export declare function createMessage<T>(event: string, data: T): string;
package/dist/message.js CHANGED
@@ -26,6 +26,10 @@ var EventType;
26
26
  EventType["CST_SONG_GRADE_get_user"] = "CST-SONG-GRADE-get-user";
27
27
  EventType["CST_SONG_GRADE_get_summary"] = "CST-SONG-GRADE-get-summary";
28
28
  EventType["CST_SONG_GRADE_unsubscribe"] = "CST-SONG-GRADE-unsubscribe";
29
+ EventType["INVITE_delete"] = "INVITE-delete";
30
+ EventType["INVITE_get"] = "INVITE-get";
31
+ EventType["INVITE_new"] = "INVITE-new";
32
+ EventType["INVITE_unsubscribe"] = "INVITE-unsubscribe";
29
33
  EventType["USER_create"] = "USER-create";
30
34
  EventType["USER_edit"] = "USER-edit";
31
35
  EventType["USER_get"] = "USER-get";
@@ -37,6 +41,7 @@ var EventType;
37
41
  EventType["CST_SONG_update"] = "CST-SONG-update";
38
42
  EventType["CST_SONG_GRADE_summary_update"] = "CST-SONG-GRADE-summary-update";
39
43
  EventType["CST_SONG_GRADE_userdata_update"] = "CST-SONG-GRADE-userdata-update";
44
+ EventType["INVITE_update"] = "INVITE-update";
40
45
  EventType["USER_update"] = "USER-update";
41
46
  })(EventType = exports.EventType || (exports.EventType = {}));
42
47
  // FUNCTION
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "chelys",
3
- "version": "2.3.1",
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
- }
2
+ "name": "chelys",
3
+ "version": "2.4.0",
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
  }