@kekkle/shared 1.5.0-next.1 → 1.5.0-next.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/esm/constants/collections.js +6 -9
- package/dist/esm/enums/group-permission.js +2 -5
- package/dist/esm/enums/push-settings-options.js +2 -5
- package/dist/esm/fixtures/character-state.fixtures.js +1 -4
- package/dist/esm/fixtures/wordle-row.fixtures.js +9 -15
- package/dist/esm/helpers/permissions/is-valid-permission.js +3 -6
- package/dist/esm/helpers/worlde/all-correct-in-row.js +1 -4
- package/dist/esm/helpers/worlde/calculate-wordle-score.js +4 -7
- package/dist/esm/types/comment.js +1 -2
- package/dist/esm/types/fcm-token.js +1 -2
- package/dist/esm/types/group-general-data.js +1 -2
- package/dist/esm/types/group-member.js +1 -2
- package/dist/esm/types/group.js +1 -2
- package/dist/esm/types/match-tries.js +1 -2
- package/dist/esm/types/push-document.js +1 -2
- package/dist/esm/types/quote.js +1 -2
- package/dist/esm/types/uid.js +1 -2
- package/dist/esm/types/user.js +1 -2
- package/dist/esm/types/wordle-game-state-document.js +1 -2
- package/dist/esm/types/wordle-game-state.js +1 -2
- package/dist/esm/types/wordle-game.js +1 -2
- package/dist/esm/types/wordle-leaderboard.js +1 -2
- package/dist/esm/types/wordle-monthly-score.js +1 -2
- package/dist/esm/types/wordle-score.js +1 -2
- package/dist/node/constants/collections.d.ts +7 -0
- package/dist/node/constants/collections.d.ts.map +1 -0
- package/dist/node/constants/collections.js +6 -0
- package/dist/node/enums/group-permission.d.ts +6 -0
- package/dist/node/enums/group-permission.d.ts.map +1 -0
- package/dist/node/enums/group-permission.js +6 -0
- package/dist/node/enums/push-settings-options.d.ts +10 -0
- package/dist/node/enums/push-settings-options.d.ts.map +1 -0
- package/dist/node/enums/push-settings-options.js +10 -0
- package/dist/node/fixtures/character-state.fixtures.d.ts +3 -0
- package/dist/node/fixtures/character-state.fixtures.d.ts.map +1 -0
- package/dist/node/fixtures/character-state.fixtures.js +3 -0
- package/dist/node/fixtures/wordle-row.fixtures.d.ts +6 -0
- package/dist/node/fixtures/wordle-row.fixtures.d.ts.map +1 -0
- package/dist/node/fixtures/wordle-row.fixtures.js +20 -0
- package/dist/node/helpers/permissions/is-valid-permission.d.ts +2 -0
- package/dist/node/helpers/permissions/is-valid-permission.d.ts.map +1 -0
- package/dist/node/helpers/permissions/is-valid-permission.js +4 -0
- package/dist/node/helpers/worlde/all-correct-in-row.d.ts +6 -0
- package/dist/node/helpers/worlde/all-correct-in-row.d.ts.map +1 -0
- package/dist/node/helpers/worlde/all-correct-in-row.js +6 -0
- package/dist/node/helpers/worlde/calculate-wordle-score.d.ts +13 -0
- package/dist/node/helpers/worlde/calculate-wordle-score.d.ts.map +1 -0
- package/dist/node/helpers/worlde/calculate-wordle-score.js +42 -0
- package/dist/node/types/comment.d.ts +10 -0
- package/dist/node/types/comment.d.ts.map +1 -0
- package/dist/node/types/comment.js +1 -0
- package/dist/node/types/fcm-token.d.ts +2 -0
- package/dist/node/types/fcm-token.d.ts.map +1 -0
- package/dist/node/types/fcm-token.js +1 -0
- package/dist/node/types/group-general-data.d.ts +7 -0
- package/dist/node/types/group-general-data.d.ts.map +1 -0
- package/dist/node/types/group-general-data.js +1 -0
- package/dist/node/types/group-member.d.ts +9 -0
- package/dist/node/types/group-member.d.ts.map +1 -0
- package/dist/node/types/group-member.js +1 -0
- package/dist/node/types/group.d.ts +23 -0
- package/dist/node/types/group.d.ts.map +1 -0
- package/dist/node/types/group.js +1 -0
- package/dist/node/types/match-tries.d.ts +10 -0
- package/dist/node/types/match-tries.d.ts.map +1 -0
- package/dist/node/types/match-tries.js +1 -0
- package/dist/node/types/push-document.d.ts +21 -0
- package/dist/node/types/push-document.d.ts.map +1 -0
- package/dist/node/types/push-document.js +1 -0
- package/dist/node/types/quote.d.ts +13 -0
- package/dist/node/types/quote.d.ts.map +1 -0
- package/dist/node/types/quote.js +1 -0
- package/dist/node/types/uid.d.ts +2 -0
- package/dist/node/types/uid.d.ts.map +1 -0
- package/dist/node/types/uid.js +1 -0
- package/dist/node/types/user.d.ts +14 -0
- package/dist/node/types/user.d.ts.map +1 -0
- package/dist/node/types/user.js +1 -0
- package/dist/node/types/wordle-game-state-document.d.ts +13 -0
- package/dist/node/types/wordle-game-state-document.d.ts.map +1 -0
- package/dist/node/types/wordle-game-state-document.js +1 -0
- package/dist/node/types/wordle-game-state.d.ts +9 -0
- package/dist/node/types/wordle-game-state.d.ts.map +1 -0
- package/dist/node/types/wordle-game-state.js +1 -0
- package/dist/node/types/wordle-game.d.ts +19 -0
- package/dist/node/types/wordle-game.d.ts.map +1 -0
- package/dist/node/types/wordle-game.js +1 -0
- package/dist/node/types/wordle-leaderboard.d.ts +29 -0
- package/dist/node/types/wordle-leaderboard.d.ts.map +1 -0
- package/dist/node/types/wordle-leaderboard.js +1 -0
- package/dist/node/types/wordle-monthly-score.d.ts +33 -0
- package/dist/node/types/wordle-monthly-score.d.ts.map +1 -0
- package/dist/node/types/wordle-monthly-score.js +1 -0
- package/dist/node/types/wordle-score.d.ts +17 -0
- package/dist/node/types/wordle-score.d.ts.map +1 -0
- package/dist/node/types/wordle-score.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -0
- package/package.json +7 -3
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.WORDLE_LEADERBOARD_COLLECTION_PATH = "wordle_leaderboard";
|
|
8
|
-
exports.WORDLE_MONTHLY_SCORES_COLLECTION_PATH = "wordle_monthly_scores";
|
|
9
|
-
exports.WORDLE_SCORES_COLLECTION_PATH = "wordle_scores";
|
|
1
|
+
export const USER_COLLECTION_PATH = "users";
|
|
2
|
+
export const GROUP_COLLECTION_PATH = "groups";
|
|
3
|
+
export const WORDLE_GAMES_COLLECTION_PATH = "wordle_games";
|
|
4
|
+
export const WORDLE_LEADERBOARD_COLLECTION_PATH = "wordle_leaderboard";
|
|
5
|
+
export const WORDLE_MONTHLY_SCORES_COLLECTION_PATH = "wordle_monthly_scores";
|
|
6
|
+
export const WORDLE_SCORES_COLLECTION_PATH = "wordle_scores";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupPermission = void 0;
|
|
4
|
-
var GroupPermission;
|
|
1
|
+
export var GroupPermission;
|
|
5
2
|
(function (GroupPermission) {
|
|
6
3
|
GroupPermission["ADMIN"] = "admin";
|
|
7
4
|
GroupPermission["ORGANISER"] = "organiser";
|
|
8
5
|
GroupPermission["MEMBER"] = "member";
|
|
9
|
-
})(GroupPermission || (
|
|
6
|
+
})(GroupPermission || (GroupPermission = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PushSettingsOptions = void 0;
|
|
4
|
-
var PushSettingsOptions;
|
|
1
|
+
export var PushSettingsOptions;
|
|
5
2
|
(function (PushSettingsOptions) {
|
|
6
3
|
PushSettingsOptions["EVENT_CREATE"] = "event_create";
|
|
7
4
|
PushSettingsOptions["GROUP_MEMBER_JOINED"] = "group_member_joined";
|
|
@@ -10,4 +7,4 @@ var PushSettingsOptions;
|
|
|
10
7
|
PushSettingsOptions["EVENT_COMMENT"] = "event_comment";
|
|
11
8
|
PushSettingsOptions["PHOTO_CREATE"] = "photo_create";
|
|
12
9
|
PushSettingsOptions["PHOTO_COMMENT"] = "photo_comment";
|
|
13
|
-
})(PushSettingsOptions || (
|
|
10
|
+
})(PushSettingsOptions || (PushSettingsOptions = {}));
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCharacterState = createCharacterState;
|
|
4
|
-
function createCharacterState(character, isCorrect, isLocked = false) {
|
|
1
|
+
export function createCharacterState(character, isCorrect, isLocked = false) {
|
|
5
2
|
return { character, isCorrect, isLocked };
|
|
6
3
|
}
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.createWordleRow = createWordleRow;
|
|
4
|
-
exports.createAllCorrectWordleRow = createAllCorrectWordleRow;
|
|
5
|
-
exports.createAllIncorrectWordleRow = createAllIncorrectWordleRow;
|
|
6
|
-
exports.createPartialWordleRow = createPartialWordleRow;
|
|
7
|
-
const character_state_fixtures_js_1 = require("../fixtures/character-state.fixtures.js");
|
|
8
|
-
function createWordleRow(inputWord, correctWord) {
|
|
1
|
+
import { createCharacterState } from "../fixtures/character-state.fixtures.js";
|
|
2
|
+
export function createWordleRow(inputWord, correctWord) {
|
|
9
3
|
if (inputWord.length !== correctWord.length) {
|
|
10
4
|
throw new Error("Input word and correct word must be the same length");
|
|
11
5
|
}
|
|
12
6
|
return inputWord
|
|
13
7
|
.split("")
|
|
14
|
-
.map((char, index) =>
|
|
8
|
+
.map((char, index) => createCharacterState(char, char === correctWord[index]));
|
|
15
9
|
}
|
|
16
|
-
function createAllCorrectWordleRow(word) {
|
|
17
|
-
return word.split("").map((char) =>
|
|
10
|
+
export function createAllCorrectWordleRow(word) {
|
|
11
|
+
return word.split("").map((char) => createCharacterState(char, true, false));
|
|
18
12
|
}
|
|
19
|
-
function createAllIncorrectWordleRow(word) {
|
|
20
|
-
return word.split("").map((char) =>
|
|
13
|
+
export function createAllIncorrectWordleRow(word) {
|
|
14
|
+
return word.split("").map((char) => createCharacterState(char, false, false));
|
|
21
15
|
}
|
|
22
|
-
function createPartialWordleRow(word, correctIndices) {
|
|
16
|
+
export function createPartialWordleRow(word, correctIndices) {
|
|
23
17
|
return word
|
|
24
18
|
.split("")
|
|
25
|
-
.map((char, index) =>
|
|
19
|
+
.map((char, index) => createCharacterState(char, correctIndices.includes(index), false));
|
|
26
20
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const group_permission_js_1 = require("../../enums/group-permission.js");
|
|
5
|
-
function isValidPermission(permission) {
|
|
6
|
-
return Object.values(group_permission_js_1.GroupPermission).includes(permission);
|
|
1
|
+
import { GroupPermission } from "../../enums/group-permission.js";
|
|
2
|
+
export function isValidPermission(permission) {
|
|
3
|
+
return Object.values(GroupPermission).includes(permission);
|
|
7
4
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allCorrectInRow = allCorrectInRow;
|
|
4
1
|
/**
|
|
5
2
|
* Method to determine if all characters are correct for a given WordleRow
|
|
6
3
|
*/
|
|
7
|
-
function allCorrectInRow(row) {
|
|
4
|
+
export function allCorrectInRow(row) {
|
|
8
5
|
return row.every((cell) => cell.isCorrect);
|
|
9
6
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateWordleScore = calculateWordleScore;
|
|
4
|
-
const all_correct_in_row_js_1 = require("./all-correct-in-row.js");
|
|
1
|
+
import { allCorrectInRow } from "./all-correct-in-row.js";
|
|
5
2
|
/**
|
|
6
3
|
* Calculates the score for a Wordle game based on the current game state.
|
|
7
4
|
*
|
|
@@ -12,7 +9,7 @@ const all_correct_in_row_js_1 = require("./all-correct-in-row.js");
|
|
|
12
9
|
* - If the game is not won yet:
|
|
13
10
|
* - Score equals the number of correct cells in the latest row
|
|
14
11
|
*/
|
|
15
|
-
function calculateWordleScore(gameState) {
|
|
12
|
+
export function calculateWordleScore(gameState) {
|
|
16
13
|
// Handle empty game state
|
|
17
14
|
if (gameState.length === 0) {
|
|
18
15
|
return 0;
|
|
@@ -22,7 +19,7 @@ function calculateWordleScore(gameState) {
|
|
|
22
19
|
// Iterate over each row in the game state to check for a win condition
|
|
23
20
|
for (const row of gameState) {
|
|
24
21
|
// If all cells in a row are correct, the game is won
|
|
25
|
-
if (
|
|
22
|
+
if (allCorrectInRow(row)) {
|
|
26
23
|
hasWon = true;
|
|
27
24
|
break;
|
|
28
25
|
}
|
|
@@ -37,7 +34,7 @@ function calculateWordleScore(gameState) {
|
|
|
37
34
|
// Base score is the row length (number of letters in the word)
|
|
38
35
|
score = gameState[0].length;
|
|
39
36
|
// Calculate which attempt was successful (1-based index)
|
|
40
|
-
const numberOfTriesNeeded = gameState.findIndex(
|
|
37
|
+
const numberOfTriesNeeded = gameState.findIndex(allCorrectInRow) + 1;
|
|
41
38
|
// Award bonus points based on how quickly the word was guessed
|
|
42
39
|
// Maximum bonus (5) for first try, decreasing by 1 for each additional attempt
|
|
43
40
|
const bonusPoints = 6 - numberOfTriesNeeded;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/esm/types/group.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/esm/types/quote.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/esm/types/uid.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/esm/types/user.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const USER_COLLECTION_PATH = "users";
|
|
2
|
+
export declare const GROUP_COLLECTION_PATH = "groups";
|
|
3
|
+
export declare const WORDLE_GAMES_COLLECTION_PATH = "wordle_games";
|
|
4
|
+
export declare const WORDLE_LEADERBOARD_COLLECTION_PATH = "wordle_leaderboard";
|
|
5
|
+
export declare const WORDLE_MONTHLY_SCORES_COLLECTION_PATH = "wordle_monthly_scores";
|
|
6
|
+
export declare const WORDLE_SCORES_COLLECTION_PATH = "wordle_scores";
|
|
7
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/constants/collections.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,qCAAqC,0BAA0B,CAAC;AAC7E,eAAO,MAAM,6BAA6B,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const USER_COLLECTION_PATH = "users";
|
|
2
|
+
export const GROUP_COLLECTION_PATH = "groups";
|
|
3
|
+
export const WORDLE_GAMES_COLLECTION_PATH = "wordle_games";
|
|
4
|
+
export const WORDLE_LEADERBOARD_COLLECTION_PATH = "wordle_leaderboard";
|
|
5
|
+
export const WORDLE_MONTHLY_SCORES_COLLECTION_PATH = "wordle_monthly_scores";
|
|
6
|
+
export const WORDLE_SCORES_COLLECTION_PATH = "wordle_scores";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-permission.d.ts","sourceRoot":"","sources":["../../../src/enums/group-permission.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum PushSettingsOptions {
|
|
2
|
+
EVENT_CREATE = "event_create",
|
|
3
|
+
GROUP_MEMBER_JOINED = "group_member_joined",
|
|
4
|
+
QUOTE_CREATE = "quote_create",
|
|
5
|
+
QUOTE_COMMENT = "quote_comment",
|
|
6
|
+
EVENT_COMMENT = "event_comment",
|
|
7
|
+
PHOTO_CREATE = "photo_create",
|
|
8
|
+
PHOTO_COMMENT = "photo_comment"
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=push-settings-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-settings-options.d.ts","sourceRoot":"","sources":["../../../src/enums/push-settings-options.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,YAAY,iBAAiB;IAC7B,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var PushSettingsOptions;
|
|
2
|
+
(function (PushSettingsOptions) {
|
|
3
|
+
PushSettingsOptions["EVENT_CREATE"] = "event_create";
|
|
4
|
+
PushSettingsOptions["GROUP_MEMBER_JOINED"] = "group_member_joined";
|
|
5
|
+
PushSettingsOptions["QUOTE_CREATE"] = "quote_create";
|
|
6
|
+
PushSettingsOptions["QUOTE_COMMENT"] = "quote_comment";
|
|
7
|
+
PushSettingsOptions["EVENT_COMMENT"] = "event_comment";
|
|
8
|
+
PushSettingsOptions["PHOTO_CREATE"] = "photo_create";
|
|
9
|
+
PushSettingsOptions["PHOTO_COMMENT"] = "photo_comment";
|
|
10
|
+
})(PushSettingsOptions || (PushSettingsOptions = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-state.fixtures.d.ts","sourceRoot":"","sources":["../../../src/fixtures/character-state.fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,GACxB,cAAc,CAEhB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WordleRow } from "../types/wordle-game-state.js";
|
|
2
|
+
export declare function createWordleRow(inputWord: string, correctWord: string): WordleRow;
|
|
3
|
+
export declare function createAllCorrectWordleRow(word: string): WordleRow;
|
|
4
|
+
export declare function createAllIncorrectWordleRow(word: string): WordleRow;
|
|
5
|
+
export declare function createPartialWordleRow(word: string, correctIndices: number[]): WordleRow;
|
|
6
|
+
//# sourceMappingURL=wordle-row.fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordle-row.fixtures.d.ts","sourceRoot":"","sources":["../../../src/fixtures/wordle-row.fixtures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,SAAS,CAUX;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAEjE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAEnE;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EAAE,GACvB,SAAS,CAMX"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createCharacterState } from "../fixtures/character-state.fixtures.js";
|
|
2
|
+
export function createWordleRow(inputWord, correctWord) {
|
|
3
|
+
if (inputWord.length !== correctWord.length) {
|
|
4
|
+
throw new Error("Input word and correct word must be the same length");
|
|
5
|
+
}
|
|
6
|
+
return inputWord
|
|
7
|
+
.split("")
|
|
8
|
+
.map((char, index) => createCharacterState(char, char === correctWord[index]));
|
|
9
|
+
}
|
|
10
|
+
export function createAllCorrectWordleRow(word) {
|
|
11
|
+
return word.split("").map((char) => createCharacterState(char, true, false));
|
|
12
|
+
}
|
|
13
|
+
export function createAllIncorrectWordleRow(word) {
|
|
14
|
+
return word.split("").map((char) => createCharacterState(char, false, false));
|
|
15
|
+
}
|
|
16
|
+
export function createPartialWordleRow(word, correctIndices) {
|
|
17
|
+
return word
|
|
18
|
+
.split("")
|
|
19
|
+
.map((char, index) => createCharacterState(char, correctIndices.includes(index), false));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-valid-permission.d.ts","sourceRoot":"","sources":["../../../../src/helpers/permissions/is-valid-permission.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-correct-in-row.d.ts","sourceRoot":"","sources":["../../../../src/helpers/worlde/all-correct-in-row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WordleGameState } from "../../types/wordle-game-state.js";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the score for a Wordle game based on the current game state.
|
|
4
|
+
*
|
|
5
|
+
* Scoring rules:
|
|
6
|
+
* - If the game is won (any row has all correct letters):
|
|
7
|
+
* - Base score equals the length of a row (typically 5)
|
|
8
|
+
* - Bonus points are added based on how quickly the word was guessed (6 minus attempts used)
|
|
9
|
+
* - If the game is not won yet:
|
|
10
|
+
* - Score equals the number of correct cells in the latest row
|
|
11
|
+
*/
|
|
12
|
+
export declare function calculateWordleScore(gameState: WordleGameState): number;
|
|
13
|
+
//# sourceMappingURL=calculate-wordle-score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-wordle-score.d.ts","sourceRoot":"","sources":["../../../../src/helpers/worlde/calculate-wordle-score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAuCvE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { allCorrectInRow } from "./all-correct-in-row.js";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates the score for a Wordle game based on the current game state.
|
|
4
|
+
*
|
|
5
|
+
* Scoring rules:
|
|
6
|
+
* - If the game is won (any row has all correct letters):
|
|
7
|
+
* - Base score equals the length of a row (typically 5)
|
|
8
|
+
* - Bonus points are added based on how quickly the word was guessed (6 minus attempts used)
|
|
9
|
+
* - If the game is not won yet:
|
|
10
|
+
* - Score equals the number of correct cells in the latest row
|
|
11
|
+
*/
|
|
12
|
+
export function calculateWordleScore(gameState) {
|
|
13
|
+
// Handle empty game state
|
|
14
|
+
if (gameState.length === 0) {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
let score = 0;
|
|
18
|
+
let hasWon = false;
|
|
19
|
+
// Iterate over each row in the game state to check for a win condition
|
|
20
|
+
for (const row of gameState) {
|
|
21
|
+
// If all cells in a row are correct, the game is won
|
|
22
|
+
if (allCorrectInRow(row)) {
|
|
23
|
+
hasWon = true;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Case 1: Game in progress (not yet won)
|
|
28
|
+
if (!hasWon) {
|
|
29
|
+
// Score is based on correct cells in the latest attempt
|
|
30
|
+
score = gameState[gameState.length - 1].filter((cell) => cell.isCorrect).length;
|
|
31
|
+
return score;
|
|
32
|
+
}
|
|
33
|
+
// Case 2: Game is won
|
|
34
|
+
// Base score is the row length (number of letters in the word)
|
|
35
|
+
score = gameState[0].length;
|
|
36
|
+
// Calculate which attempt was successful (1-based index)
|
|
37
|
+
const numberOfTriesNeeded = gameState.findIndex(allCorrectInRow) + 1;
|
|
38
|
+
// Award bonus points based on how quickly the word was guessed
|
|
39
|
+
// Maximum bonus (5) for first try, decreasing by 1 for each additional attempt
|
|
40
|
+
const bonusPoints = 6 - numberOfTriesNeeded;
|
|
41
|
+
return score + bonusPoints;
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
type Comment = {
|
|
3
|
+
author: string;
|
|
4
|
+
comment: string;
|
|
5
|
+
date: Date | Timestamp;
|
|
6
|
+
};
|
|
7
|
+
export type PhotoComment = Comment;
|
|
8
|
+
export type QuoteComment = Comment;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/types/comment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;AAEnC,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fcm-token.d.ts","sourceRoot":"","sources":["../../../src/types/fcm-token.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-general-data.d.ts","sourceRoot":"","sources":["../../../src/types/group-general-data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GroupPermission } from "../enums/group-permission.js";
|
|
2
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
3
|
+
export type GroupMember = {
|
|
4
|
+
birthday: Timestamp | null;
|
|
5
|
+
name: string;
|
|
6
|
+
permission: GroupPermission;
|
|
7
|
+
profile_picture: string;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=group-member.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-member.d.ts","sourceRoot":"","sources":["../../../src/types/group-member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { GroupGeneralData } from "../types/group-general-data.js";
|
|
3
|
+
import type { GroupMember } from "../types/group-member.js";
|
|
4
|
+
import type { Uid } from "../types/uid.js";
|
|
5
|
+
export type Group = {
|
|
6
|
+
created_at: Timestamp;
|
|
7
|
+
updated_at: Timestamp;
|
|
8
|
+
description: string | undefined;
|
|
9
|
+
general_data: GroupGeneralData;
|
|
10
|
+
ical_token: string;
|
|
11
|
+
join_token: string | null | undefined;
|
|
12
|
+
join_token_timestamp: Timestamp | null | undefined;
|
|
13
|
+
members: {
|
|
14
|
+
[key: Uid]: GroupMember;
|
|
15
|
+
};
|
|
16
|
+
members_uuids: string[];
|
|
17
|
+
name: string;
|
|
18
|
+
premium: boolean | null | undefined;
|
|
19
|
+
premium_till: Timestamp | null | undefined;
|
|
20
|
+
group_picture?: string;
|
|
21
|
+
group_picture_blurhash?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/types/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,gBAAgB,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,oBAAoB,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAAC;KACzB,CAAC;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,YAAY,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-tries.d.ts","sourceRoot":"","sources":["../../../src/types/match-tries.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { PushSettingsOptions } from "../enums/push-settings-options.js";
|
|
3
|
+
import type { Uid } from "../types/uid.js";
|
|
4
|
+
export type AllPushSettings = {
|
|
5
|
+
[key in PushSettingsOptions]: boolean | null;
|
|
6
|
+
};
|
|
7
|
+
export type GroupPushDocumentSettings = {
|
|
8
|
+
[key: Uid]: AllPushSettings;
|
|
9
|
+
};
|
|
10
|
+
export type GroupPushDocumentTokens = {
|
|
11
|
+
[key: Uid]: Array<PushTokenObject>;
|
|
12
|
+
};
|
|
13
|
+
export type PushTokenObject = {
|
|
14
|
+
token: string | null;
|
|
15
|
+
updated_at: Timestamp | string;
|
|
16
|
+
};
|
|
17
|
+
export type GroupPushDocument = {
|
|
18
|
+
settings: GroupPushDocumentSettings;
|
|
19
|
+
tokens: GroupPushDocumentTokens;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=push-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-document.d.ts","sourceRoot":"","sources":["../../../src/types/push-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG;KAC3B,GAAG,IAAI,mBAAmB,GAAG,OAAO,GAAG,IAAI;CAC7C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,MAAM,EAAE,uBAAuB,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
export type Quote = {
|
|
3
|
+
authors: Array<string> | null;
|
|
4
|
+
quote: string;
|
|
5
|
+
context: string | null;
|
|
6
|
+
created_by: string;
|
|
7
|
+
custom_author: string | null;
|
|
8
|
+
timestamp: Date | Timestamp;
|
|
9
|
+
trigrams: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
} | null;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../../src/types/quote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV,CAAC"}
|