@kekkle/shared 0.0.1
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/README.md +30 -0
- package/dist/constants/collections.d.ts +6 -0
- package/dist/constants/collections.js +6 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/enums/index.d.ts +2 -0
- package/dist/enums/index.js +2 -0
- package/dist/enums/permissions.d.ts +5 -0
- package/dist/enums/permissions.js +6 -0
- package/dist/enums/push-settings-options.d.ts +9 -0
- package/dist/enums/push-settings-options.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/types/comment.d.ts +9 -0
- package/dist/types/comment.js +1 -0
- package/dist/types/fcm-token.d.ts +1 -0
- package/dist/types/fcm-token.js +1 -0
- package/dist/types/group-general-data.d.ts +6 -0
- package/dist/types/group-general-data.js +1 -0
- package/dist/types/group-member.d.ts +8 -0
- package/dist/types/group-member.js +1 -0
- package/dist/types/group.d.ts +20 -0
- package/dist/types/group.js +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.js +16 -0
- package/dist/types/match-tries.d.ts +9 -0
- package/dist/types/match-tries.js +1 -0
- package/dist/types/push-document.d.ts +20 -0
- package/dist/types/push-document.js +1 -0
- package/dist/types/quote.d.ts +12 -0
- package/dist/types/quote.js +1 -0
- package/dist/types/uid.d.ts +1 -0
- package/dist/types/uid.js +1 -0
- package/dist/types/user.d.ts +13 -0
- package/dist/types/user.js +1 -0
- package/dist/types/wordle-game-state.d.ts +8 -0
- package/dist/types/wordle-game-state.js +1 -0
- package/dist/types/wordle-game.d.ts +18 -0
- package/dist/types/wordle-game.js +1 -0
- package/dist/types/wordle-leaderboard.d.ts +28 -0
- package/dist/types/wordle-leaderboard.js +1 -0
- package/dist/types/wordle-monthly-score.d.ts +32 -0
- package/dist/types/wordle-monthly-score.js +1 -0
- package/dist/types/worlde-game-state-document.d.ts +12 -0
- package/dist/types/worlde-game-state-document.js +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## About this package
|
|
2
|
+
|
|
3
|
+
This package contains shared logic, types, enums and constants for Kekkle frontend and functions.
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kekkle-verse/shared
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { types, constants, enums } from "@kekkle-verse/shared";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import * as shared from "@kekkle-verse/shared";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { user } from "@kekkle-verse/shared/types";
|
|
27
|
+
import { permissions } from "@kekkle-verse/shared/enums";
|
|
28
|
+
import { collections } from "@kekkle-verse/shared/constants";
|
|
29
|
+
```
|
|
30
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
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";
|
|
@@ -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
|
+
export * from "./collections";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./collections";
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -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 = {}));
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FcmToken = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { GroupGeneralData } from "./group-general-data";
|
|
3
|
+
import type { GroupMember } from "./group-member";
|
|
4
|
+
import type { Uid } from "./uid";
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./comment";
|
|
2
|
+
export * from "./fcm-token";
|
|
3
|
+
export * from "./group-general-data";
|
|
4
|
+
export * from "./group-member";
|
|
5
|
+
export * from "./group";
|
|
6
|
+
export * from "./match-tries";
|
|
7
|
+
export * from "./push-document";
|
|
8
|
+
export * from "./quote";
|
|
9
|
+
export * from "./uid";
|
|
10
|
+
export * from "./user";
|
|
11
|
+
export * from "./wordle-game-state";
|
|
12
|
+
export * from "./wordle-game";
|
|
13
|
+
export * from "./wordle-leaderboard";
|
|
14
|
+
export * from "./wordle-monthly-score";
|
|
15
|
+
export * from "./wordle-monthly-score";
|
|
16
|
+
export * from "./worlde-game-state-document";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./comment";
|
|
2
|
+
export * from "./fcm-token";
|
|
3
|
+
export * from "./group-general-data";
|
|
4
|
+
export * from "./group-member";
|
|
5
|
+
export * from "./group";
|
|
6
|
+
export * from "./match-tries";
|
|
7
|
+
export * from "./push-document";
|
|
8
|
+
export * from "./quote";
|
|
9
|
+
export * from "./uid";
|
|
10
|
+
export * from "./user";
|
|
11
|
+
export * from "./wordle-game-state";
|
|
12
|
+
export * from "./wordle-game";
|
|
13
|
+
export * from "./wordle-leaderboard";
|
|
14
|
+
export * from "./wordle-monthly-score";
|
|
15
|
+
export * from "./wordle-monthly-score";
|
|
16
|
+
export * from "./worlde-game-state-document";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { PushSettingsOptions } from "../enums/push-settings-options";
|
|
3
|
+
import type { Uid } from "./uid";
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Uid = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { PushTokenObject, AllPushSettings } from "./push-document";
|
|
3
|
+
export type User = {
|
|
4
|
+
active_group: "";
|
|
5
|
+
birthdate: Timestamp;
|
|
6
|
+
groups: string[];
|
|
7
|
+
message_tokens?: Array<PushTokenObject>;
|
|
8
|
+
push_settings?: AllPushSettings;
|
|
9
|
+
language?: string;
|
|
10
|
+
name: string;
|
|
11
|
+
new_auth_claim: boolean;
|
|
12
|
+
profile_picture: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
export type WordleGame = {
|
|
3
|
+
language: string;
|
|
4
|
+
word: string;
|
|
5
|
+
locked: boolean;
|
|
6
|
+
date: Timestamp;
|
|
7
|
+
created_at: Timestamp;
|
|
8
|
+
updated_at: Timestamp;
|
|
9
|
+
game_number: number;
|
|
10
|
+
year?: number;
|
|
11
|
+
month?: number;
|
|
12
|
+
date_number?: number;
|
|
13
|
+
day?: number;
|
|
14
|
+
year_utc?: number;
|
|
15
|
+
month_utc?: number;
|
|
16
|
+
date_number_utc?: number;
|
|
17
|
+
day_utc?: number;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { MatchTries } from "./match-tries";
|
|
3
|
+
export type WordleLeaderboard = {
|
|
4
|
+
created_at: Timestamp;
|
|
5
|
+
has_lost: number;
|
|
6
|
+
has_won: number;
|
|
7
|
+
language: string;
|
|
8
|
+
match_tries: MatchTries;
|
|
9
|
+
matches_played: string[];
|
|
10
|
+
new_score: number | null;
|
|
11
|
+
score: number;
|
|
12
|
+
updated_at: Timestamp;
|
|
13
|
+
username: string;
|
|
14
|
+
user_id: string;
|
|
15
|
+
};
|
|
16
|
+
export type PartialWordleLeaderboard = Partial<{
|
|
17
|
+
created_at: Timestamp;
|
|
18
|
+
has_lost: number;
|
|
19
|
+
has_won: number;
|
|
20
|
+
language: string;
|
|
21
|
+
match_tries: MatchTries;
|
|
22
|
+
matches_played: string[];
|
|
23
|
+
new_score: number | null;
|
|
24
|
+
score: number;
|
|
25
|
+
updated_at: Timestamp;
|
|
26
|
+
username: string;
|
|
27
|
+
user_id: string;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { MatchTries } from "./match-tries";
|
|
3
|
+
export type WordleMonthlyScore = {
|
|
4
|
+
created_at: Timestamp;
|
|
5
|
+
has_lost: number;
|
|
6
|
+
has_won: number;
|
|
7
|
+
language: string;
|
|
8
|
+
match_tries: MatchTries;
|
|
9
|
+
matches_played: string[];
|
|
10
|
+
month: number;
|
|
11
|
+
new_score: number;
|
|
12
|
+
score: number;
|
|
13
|
+
updated_at: Timestamp;
|
|
14
|
+
user_id: string;
|
|
15
|
+
username: string;
|
|
16
|
+
year: number;
|
|
17
|
+
};
|
|
18
|
+
export type PartialWordleMonthlyScore = Partial<{
|
|
19
|
+
created_at: Timestamp;
|
|
20
|
+
has_lost: number;
|
|
21
|
+
has_won: number;
|
|
22
|
+
language: string;
|
|
23
|
+
match_tries: MatchTries;
|
|
24
|
+
matches_played: string[];
|
|
25
|
+
month: number;
|
|
26
|
+
new_score: number;
|
|
27
|
+
score: number;
|
|
28
|
+
updated_at: Timestamp;
|
|
29
|
+
user_id: string;
|
|
30
|
+
username: string;
|
|
31
|
+
year: number;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StringifiedWordleGameState } from "./wordle-game-state";
|
|
2
|
+
import type { Timestamp } from "firebase-admin/firestore";
|
|
3
|
+
export type WorldeGameStateDocument = {
|
|
4
|
+
calculated_score: number;
|
|
5
|
+
game_state: StringifiedWordleGameState;
|
|
6
|
+
has_finished: boolean;
|
|
7
|
+
has_lost: boolean;
|
|
8
|
+
has_won: boolean;
|
|
9
|
+
number_of_tries_needed: number;
|
|
10
|
+
updated_at: Timestamp;
|
|
11
|
+
user_id: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kekkle/shared",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Shared logic and types for Kekkle frontend and functions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./types": {
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"import": "./dist/types/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./enums": {
|
|
16
|
+
"types": "./dist/enums/index.d.ts",
|
|
17
|
+
"import": "./dist/enums/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./constants": {
|
|
20
|
+
"types": "./dist/constants/index.d.ts",
|
|
21
|
+
"import": "./dist/constants/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/**/*"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"prepublishOnly": "npm run build",
|
|
31
|
+
"lint": "eslint .",
|
|
32
|
+
"lint:fix": "eslint . --fix"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/kekkle-verse/shared.git"
|
|
40
|
+
},
|
|
41
|
+
"author": "Sam Freriks",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/kekkle-verse/shared/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/kekkle-verse/shared#readme",
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@eslint/js": "^9.12.0",
|
|
48
|
+
"@types/eslint__js": "^8.42.3",
|
|
49
|
+
"eslint": "^9.12.0",
|
|
50
|
+
"typescript": "^5.6.3",
|
|
51
|
+
"typescript-eslint": "^8.8.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"firebase-admin": "11.11.1"
|
|
55
|
+
}
|
|
56
|
+
}
|