@kekkle/shared 2.0.0-next.1 → 2.0.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.
Files changed (73) hide show
  1. package/dist/cjs/convertors/node/event-document.converter.d.ts +9 -0
  2. package/dist/cjs/convertors/node/event-document.converter.d.ts.map +1 -0
  3. package/dist/cjs/convertors/node/event-document.converter.js +48 -0
  4. package/dist/cjs/convertors/web/event-document.converter.d.ts +9 -0
  5. package/dist/cjs/convertors/web/event-document.converter.d.ts.map +1 -0
  6. package/dist/cjs/convertors/web/event-document.converter.js +48 -0
  7. package/dist/cjs/fixtures/character-state.fixtures.d.ts +1 -1
  8. package/dist/cjs/fixtures/character-state.fixtures.d.ts.map +1 -1
  9. package/dist/cjs/fixtures/character-state.fixtures.js +2 -2
  10. package/dist/cjs/types/documents/event-document/event-document-firestore-base.d.ts +15 -0
  11. package/dist/cjs/types/documents/event-document/event-document-firestore-base.d.ts.map +1 -0
  12. package/dist/cjs/types/documents/event-document/event-document-firestore-base.js +2 -0
  13. package/dist/cjs/types/documents/event-document/event-document.d.ts +17 -0
  14. package/dist/cjs/types/documents/event-document/event-document.d.ts.map +1 -0
  15. package/dist/cjs/types/documents/event-document/event-document.js +2 -0
  16. package/dist/cjs/types/documents/event-document/node/event-document-firestore.d.ts +11 -0
  17. package/dist/cjs/types/documents/event-document/node/event-document-firestore.d.ts.map +1 -0
  18. package/dist/cjs/types/documents/event-document/node/event-document-firestore.js +2 -0
  19. package/dist/cjs/types/documents/event-document/web/event-document-firestore.d.ts +11 -0
  20. package/dist/cjs/types/documents/event-document/web/event-document-firestore.d.ts.map +1 -0
  21. package/dist/cjs/types/documents/event-document/web/event-document-firestore.js +2 -0
  22. package/dist/cjs/types/fields/wordle-game-state/wordle-game-state.d.ts +1 -0
  23. package/dist/cjs/types/fields/wordle-game-state/wordle-game-state.d.ts.map +1 -1
  24. package/dist/esm/convertors/node/event-document.converter.d.ts +9 -0
  25. package/dist/esm/convertors/node/event-document.converter.d.ts.map +1 -0
  26. package/dist/esm/convertors/node/event-document.converter.js +45 -0
  27. package/dist/esm/convertors/web/event-document.converter.d.ts +9 -0
  28. package/dist/esm/convertors/web/event-document.converter.d.ts.map +1 -0
  29. package/dist/esm/convertors/web/event-document.converter.js +45 -0
  30. package/dist/esm/fixtures/character-state.fixtures.d.ts +1 -1
  31. package/dist/esm/fixtures/character-state.fixtures.d.ts.map +1 -1
  32. package/dist/esm/fixtures/character-state.fixtures.js +2 -2
  33. package/dist/esm/types/documents/event-document/event-document-firestore-base.d.ts +15 -0
  34. package/dist/esm/types/documents/event-document/event-document-firestore-base.d.ts.map +1 -0
  35. package/dist/esm/types/documents/event-document/event-document-firestore-base.js +1 -0
  36. package/dist/esm/types/documents/event-document/event-document.d.ts +17 -0
  37. package/dist/esm/types/documents/event-document/event-document.d.ts.map +1 -0
  38. package/dist/esm/types/documents/event-document/event-document.js +1 -0
  39. package/dist/esm/types/documents/event-document/node/event-document-firestore.d.ts +11 -0
  40. package/dist/esm/types/documents/event-document/node/event-document-firestore.d.ts.map +1 -0
  41. package/dist/esm/types/documents/event-document/node/event-document-firestore.js +1 -0
  42. package/dist/esm/types/documents/event-document/web/event-document-firestore.d.ts +11 -0
  43. package/dist/esm/types/documents/event-document/web/event-document-firestore.d.ts.map +1 -0
  44. package/dist/esm/types/documents/event-document/web/event-document-firestore.js +1 -0
  45. package/dist/esm/types/fields/wordle-game-state/wordle-game-state.d.ts +1 -0
  46. package/dist/esm/types/fields/wordle-game-state/wordle-game-state.d.ts.map +1 -1
  47. package/dist/node/convertors/node/event-document.converter.d.ts +9 -0
  48. package/dist/node/convertors/node/event-document.converter.d.ts.map +1 -0
  49. package/dist/node/convertors/node/event-document.converter.js +45 -0
  50. package/dist/node/convertors/web/event-document.converter.d.ts +9 -0
  51. package/dist/node/convertors/web/event-document.converter.d.ts.map +1 -0
  52. package/dist/node/convertors/web/event-document.converter.js +45 -0
  53. package/dist/node/fixtures/character-state.fixtures.d.ts +1 -1
  54. package/dist/node/fixtures/character-state.fixtures.d.ts.map +1 -1
  55. package/dist/node/fixtures/character-state.fixtures.js +2 -2
  56. package/dist/node/types/documents/event-document/event-document-firestore-base.d.ts +15 -0
  57. package/dist/node/types/documents/event-document/event-document-firestore-base.d.ts.map +1 -0
  58. package/dist/node/types/documents/event-document/event-document-firestore-base.js +1 -0
  59. package/dist/node/types/documents/event-document/event-document.d.ts +17 -0
  60. package/dist/node/types/documents/event-document/event-document.d.ts.map +1 -0
  61. package/dist/node/types/documents/event-document/event-document.js +1 -0
  62. package/dist/node/types/documents/event-document/node/event-document-firestore.d.ts +11 -0
  63. package/dist/node/types/documents/event-document/node/event-document-firestore.d.ts.map +1 -0
  64. package/dist/node/types/documents/event-document/node/event-document-firestore.js +1 -0
  65. package/dist/node/types/documents/event-document/web/event-document-firestore.d.ts +11 -0
  66. package/dist/node/types/documents/event-document/web/event-document-firestore.d.ts.map +1 -0
  67. package/dist/node/types/documents/event-document/web/event-document-firestore.js +1 -0
  68. package/dist/node/types/fields/wordle-game-state/wordle-game-state.d.ts +1 -0
  69. package/dist/node/types/fields/wordle-game-state/wordle-game-state.d.ts.map +1 -1
  70. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  71. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  72. package/dist/tsconfig.node.tsbuildinfo +1 -1
  73. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase-admin/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Admin SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/node/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA4CxE,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventDocumentConverter = void 0;
4
+ const firestore_1 = require("firebase-admin/firestore");
5
+ /**
6
+ * Firestore converter for Event documents (Admin SDK)
7
+ * Handles conversion between client-side Event type (with Date objects)
8
+ * and Firestore EventDocumentFirestore type (with Timestamps)
9
+ */
10
+ exports.eventDocumentConverter = {
11
+ /**
12
+ * Convert EventDocument to Firestore document
13
+ * Date objects are converted to Firestore Timestamps
14
+ * FieldValue (like serverTimestamp()) is passed through as-is
15
+ * _id is stripped as it's not stored in Firestore
16
+ */
17
+ toFirestore: (event) => {
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ const { _id, ...eventWithoutId } = event;
20
+ return {
21
+ ...eventWithoutId,
22
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
23
+ ? firestore_1.Timestamp.fromDate(eventWithoutId.begin_timestamp)
24
+ : eventWithoutId.begin_timestamp,
25
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
26
+ ? firestore_1.Timestamp.fromDate(eventWithoutId.end_timestamp)
27
+ : eventWithoutId.end_timestamp,
28
+ };
29
+ },
30
+ /**
31
+ * Convert Firestore document to EventDocument
32
+ * Timestamps are converted to Date objects
33
+ * _id is populated from document ID
34
+ */
35
+ fromFirestore: (snapshot) => {
36
+ const data = snapshot.data();
37
+ return {
38
+ ...data,
39
+ _id: snapshot.id,
40
+ begin_timestamp: data.begin_timestamp.toDate(),
41
+ end_timestamp: data.end_timestamp.toDate(),
42
+ available: data.available ?? [],
43
+ maybe_available: data.maybe_available ?? [],
44
+ non_available: data.non_available ?? [],
45
+ description: data.description ?? "",
46
+ };
47
+ },
48
+ };
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Web SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/web/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA8CxE,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventDocumentConverter = void 0;
4
+ const firestore_1 = require("firebase/firestore");
5
+ /**
6
+ * Firestore converter for Event documents (Web SDK)
7
+ * Handles conversion between client-side Event type (with Date objects)
8
+ * and Firestore EventDocumentFirestore type (with Timestamps)
9
+ */
10
+ exports.eventDocumentConverter = {
11
+ /**
12
+ * Convert EventDocument to Firestore document
13
+ * Date objects are converted to Firestore Timestamps
14
+ * FieldValue (like serverTimestamp()) is passed through as-is
15
+ * _id is stripped as it's not stored in Firestore
16
+ */
17
+ toFirestore: (event) => {
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ const { _id, ...eventWithoutId } = event;
20
+ return {
21
+ ...eventWithoutId,
22
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
23
+ ? firestore_1.Timestamp.fromDate(eventWithoutId.begin_timestamp)
24
+ : eventWithoutId.begin_timestamp,
25
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
26
+ ? firestore_1.Timestamp.fromDate(eventWithoutId.end_timestamp)
27
+ : eventWithoutId.end_timestamp,
28
+ };
29
+ },
30
+ /**
31
+ * Convert Firestore document to EventDocument
32
+ * Timestamps are converted to Date objects
33
+ * _id is populated from document ID
34
+ */
35
+ fromFirestore: (snapshot) => {
36
+ const data = snapshot.data();
37
+ return {
38
+ ...data,
39
+ _id: snapshot.id,
40
+ begin_timestamp: data.begin_timestamp.toDate(),
41
+ end_timestamp: data.end_timestamp.toDate(),
42
+ available: data.available ?? [],
43
+ maybe_available: data.maybe_available ?? [],
44
+ non_available: data.non_available ?? [],
45
+ description: data.description ?? "",
46
+ };
47
+ },
48
+ };
@@ -1,3 +1,3 @@
1
1
  import { CharacterState } from "../types/fields/wordle-game-state/wordle-game-state.js";
2
- export declare function createCharacterState(character: string, isCorrect: boolean, isLocked?: boolean): CharacterState;
2
+ export declare function createCharacterState(character: string, isCorrect: boolean, isLocked?: boolean, isPresent?: boolean): CharacterState;
3
3
  //# sourceMappingURL=character-state.fixtures.d.ts.map
@@ -1 +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,uDAAuD,CAAC;AAEvF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,GACxB,cAAc,CAEhB"}
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,uDAAuD,CAAC;AAEvF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,EACzB,SAAS,GAAE,OAAe,GACzB,cAAc,CAEhB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCharacterState = createCharacterState;
4
- function createCharacterState(character, isCorrect, isLocked = false) {
5
- return { character, isCorrect, isLocked };
4
+ function createCharacterState(character, isCorrect, isLocked = false, isPresent = false) {
5
+ return { character, isCorrect, isLocked, isPresent };
6
6
  }
@@ -0,0 +1,15 @@
1
+ import { Uid } from "../../../types/fields/uid/uid.js";
2
+ /**
3
+ * Base Firestore document type with shared fields
4
+ * Timestamp-dependent fields are added in web/node specific document types
5
+ */
6
+ export type EventDocumentFirestoreBase = {
7
+ _id: string;
8
+ description?: string;
9
+ created_by: Uid;
10
+ name: string;
11
+ available?: Uid[];
12
+ non_available?: Uid[];
13
+ maybe_available?: Uid[];
14
+ };
15
+ //# sourceMappingURL=event-document-firestore-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore-base.d.ts","sourceRoot":"","sources":["../../../../../src/types/documents/event-document/event-document-firestore-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;CACzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Uid } from "../../../types/fields/uid/uid.js";
2
+ /**
3
+ * Group type for client-side usage
4
+ * All date fields are represented as Date objects
5
+ */
6
+ export type EventDocument = {
7
+ _id: string;
8
+ begin_timestamp: Date;
9
+ end_timestamp: Date;
10
+ description: string;
11
+ created_by: Uid;
12
+ name: string;
13
+ available: Uid[];
14
+ non_available: Uid[];
15
+ maybe_available: Uid[];
16
+ };
17
+ //# sourceMappingURL=event-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.d.ts","sourceRoot":"","sources":["../../../../../src/types/documents/event-document/event-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,IAAI,CAAC;IACtB,aAAa,EAAE,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,aAAa,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,EAAE,GAAG,EAAE,CAAC;CACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import type { Timestamp } from "firebase-admin/firestore";
2
+ import { EventDocumentFirestoreBase } from "../../../../types/documents/event-document/event-document-firestore-base.js";
3
+ /**
4
+ * Firestore document type for web client
5
+ * Uses Timestamp from firebase/firestore
6
+ */
7
+ export type EventDocumentFirestore = EventDocumentFirestoreBase & {
8
+ begin_timestamp: Timestamp;
9
+ end_timestamp: Timestamp;
10
+ };
11
+ //# sourceMappingURL=event-document-firestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore.d.ts","sourceRoot":"","sources":["../../../../../../src/types/documents/event-document/node/event-document-firestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mEAAmE,CAAC;AAE/G;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,eAAe,EAAE,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import type { Timestamp } from "firebase/firestore";
2
+ import { EventDocumentFirestoreBase } from "../../../../types/documents/event-document/event-document-firestore-base.js";
3
+ /**
4
+ * Firestore document type for web client
5
+ * Uses Timestamp from firebase/firestore
6
+ */
7
+ export type EventDocumentFirestore = EventDocumentFirestoreBase & {
8
+ begin_timestamp: Timestamp;
9
+ end_timestamp: Timestamp;
10
+ };
11
+ //# sourceMappingURL=event-document-firestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore.d.ts","sourceRoot":"","sources":["../../../../../../src/types/documents/event-document/web/event-document-firestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mEAAmE,CAAC;AAE/G;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,eAAe,EAAE,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,7 @@ export type CharacterState = {
2
2
  character: string;
3
3
  isCorrect: boolean;
4
4
  isLocked: boolean;
5
+ isPresent?: boolean;
5
6
  };
6
7
  export type WordleRow = CharacterState[];
7
8
  export type WordleGameState = WordleRow[];
@@ -1 +1 @@
1
- {"version":3,"file":"wordle-game-state.d.ts","sourceRoot":"","sources":["../../../../../src/types/fields/wordle-game-state/wordle-game-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC;AAE1C,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"wordle-game-state.d.ts","sourceRoot":"","sources":["../../../../../src/types/fields/wordle-game-state/wordle-game-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC;AAE1C,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase-admin/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Admin SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/node/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA4CxE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Timestamp, } from "firebase-admin/firestore";
2
+ /**
3
+ * Firestore converter for Event documents (Admin SDK)
4
+ * Handles conversion between client-side Event type (with Date objects)
5
+ * and Firestore EventDocumentFirestore type (with Timestamps)
6
+ */
7
+ export const eventDocumentConverter = {
8
+ /**
9
+ * Convert EventDocument to Firestore document
10
+ * Date objects are converted to Firestore Timestamps
11
+ * FieldValue (like serverTimestamp()) is passed through as-is
12
+ * _id is stripped as it's not stored in Firestore
13
+ */
14
+ toFirestore: (event) => {
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const { _id, ...eventWithoutId } = event;
17
+ return {
18
+ ...eventWithoutId,
19
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
20
+ ? Timestamp.fromDate(eventWithoutId.begin_timestamp)
21
+ : eventWithoutId.begin_timestamp,
22
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
23
+ ? Timestamp.fromDate(eventWithoutId.end_timestamp)
24
+ : eventWithoutId.end_timestamp,
25
+ };
26
+ },
27
+ /**
28
+ * Convert Firestore document to EventDocument
29
+ * Timestamps are converted to Date objects
30
+ * _id is populated from document ID
31
+ */
32
+ fromFirestore: (snapshot) => {
33
+ const data = snapshot.data();
34
+ return {
35
+ ...data,
36
+ _id: snapshot.id,
37
+ begin_timestamp: data.begin_timestamp.toDate(),
38
+ end_timestamp: data.end_timestamp.toDate(),
39
+ available: data.available ?? [],
40
+ maybe_available: data.maybe_available ?? [],
41
+ non_available: data.non_available ?? [],
42
+ description: data.description ?? "",
43
+ };
44
+ },
45
+ };
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Web SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/web/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA8CxE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Timestamp, } from "firebase/firestore";
2
+ /**
3
+ * Firestore converter for Event documents (Web SDK)
4
+ * Handles conversion between client-side Event type (with Date objects)
5
+ * and Firestore EventDocumentFirestore type (with Timestamps)
6
+ */
7
+ export const eventDocumentConverter = {
8
+ /**
9
+ * Convert EventDocument to Firestore document
10
+ * Date objects are converted to Firestore Timestamps
11
+ * FieldValue (like serverTimestamp()) is passed through as-is
12
+ * _id is stripped as it's not stored in Firestore
13
+ */
14
+ toFirestore: (event) => {
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const { _id, ...eventWithoutId } = event;
17
+ return {
18
+ ...eventWithoutId,
19
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
20
+ ? Timestamp.fromDate(eventWithoutId.begin_timestamp)
21
+ : eventWithoutId.begin_timestamp,
22
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
23
+ ? Timestamp.fromDate(eventWithoutId.end_timestamp)
24
+ : eventWithoutId.end_timestamp,
25
+ };
26
+ },
27
+ /**
28
+ * Convert Firestore document to EventDocument
29
+ * Timestamps are converted to Date objects
30
+ * _id is populated from document ID
31
+ */
32
+ fromFirestore: (snapshot) => {
33
+ const data = snapshot.data();
34
+ return {
35
+ ...data,
36
+ _id: snapshot.id,
37
+ begin_timestamp: data.begin_timestamp.toDate(),
38
+ end_timestamp: data.end_timestamp.toDate(),
39
+ available: data.available ?? [],
40
+ maybe_available: data.maybe_available ?? [],
41
+ non_available: data.non_available ?? [],
42
+ description: data.description ?? "",
43
+ };
44
+ },
45
+ };
@@ -1,3 +1,3 @@
1
1
  import { CharacterState } from "../types/fields/wordle-game-state/wordle-game-state.js";
2
- export declare function createCharacterState(character: string, isCorrect: boolean, isLocked?: boolean): CharacterState;
2
+ export declare function createCharacterState(character: string, isCorrect: boolean, isLocked?: boolean, isPresent?: boolean): CharacterState;
3
3
  //# sourceMappingURL=character-state.fixtures.d.ts.map
@@ -1 +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,uDAAuD,CAAC;AAEvF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,GACxB,cAAc,CAEhB"}
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,uDAAuD,CAAC;AAEvF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,EACzB,SAAS,GAAE,OAAe,GACzB,cAAc,CAEhB"}
@@ -1,3 +1,3 @@
1
- export function createCharacterState(character, isCorrect, isLocked = false) {
2
- return { character, isCorrect, isLocked };
1
+ export function createCharacterState(character, isCorrect, isLocked = false, isPresent = false) {
2
+ return { character, isCorrect, isLocked, isPresent };
3
3
  }
@@ -0,0 +1,15 @@
1
+ import { Uid } from "../../../types/fields/uid/uid.js";
2
+ /**
3
+ * Base Firestore document type with shared fields
4
+ * Timestamp-dependent fields are added in web/node specific document types
5
+ */
6
+ export type EventDocumentFirestoreBase = {
7
+ _id: string;
8
+ description?: string;
9
+ created_by: Uid;
10
+ name: string;
11
+ available?: Uid[];
12
+ non_available?: Uid[];
13
+ maybe_available?: Uid[];
14
+ };
15
+ //# sourceMappingURL=event-document-firestore-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore-base.d.ts","sourceRoot":"","sources":["../../../../../src/types/documents/event-document/event-document-firestore-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;CACzB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Uid } from "../../../types/fields/uid/uid.js";
2
+ /**
3
+ * Group type for client-side usage
4
+ * All date fields are represented as Date objects
5
+ */
6
+ export type EventDocument = {
7
+ _id: string;
8
+ begin_timestamp: Date;
9
+ end_timestamp: Date;
10
+ description: string;
11
+ created_by: Uid;
12
+ name: string;
13
+ available: Uid[];
14
+ non_available: Uid[];
15
+ maybe_available: Uid[];
16
+ };
17
+ //# sourceMappingURL=event-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.d.ts","sourceRoot":"","sources":["../../../../../src/types/documents/event-document/event-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,IAAI,CAAC;IACtB,aAAa,EAAE,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,aAAa,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,EAAE,GAAG,EAAE,CAAC;CACxB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Timestamp } from "firebase-admin/firestore";
2
+ import { EventDocumentFirestoreBase } from "../../../../types/documents/event-document/event-document-firestore-base.js";
3
+ /**
4
+ * Firestore document type for web client
5
+ * Uses Timestamp from firebase/firestore
6
+ */
7
+ export type EventDocumentFirestore = EventDocumentFirestoreBase & {
8
+ begin_timestamp: Timestamp;
9
+ end_timestamp: Timestamp;
10
+ };
11
+ //# sourceMappingURL=event-document-firestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore.d.ts","sourceRoot":"","sources":["../../../../../../src/types/documents/event-document/node/event-document-firestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mEAAmE,CAAC;AAE/G;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,eAAe,EAAE,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Timestamp } from "firebase/firestore";
2
+ import { EventDocumentFirestoreBase } from "../../../../types/documents/event-document/event-document-firestore-base.js";
3
+ /**
4
+ * Firestore document type for web client
5
+ * Uses Timestamp from firebase/firestore
6
+ */
7
+ export type EventDocumentFirestore = EventDocumentFirestoreBase & {
8
+ begin_timestamp: Timestamp;
9
+ end_timestamp: Timestamp;
10
+ };
11
+ //# sourceMappingURL=event-document-firestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document-firestore.d.ts","sourceRoot":"","sources":["../../../../../../src/types/documents/event-document/web/event-document-firestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mEAAmE,CAAC;AAE/G;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE,eAAe,EAAE,SAAS,CAAC;IAC3B,aAAa,EAAE,SAAS,CAAC;CAC1B,CAAC"}
@@ -2,6 +2,7 @@ export type CharacterState = {
2
2
  character: string;
3
3
  isCorrect: boolean;
4
4
  isLocked: boolean;
5
+ isPresent?: boolean;
5
6
  };
6
7
  export type WordleRow = CharacterState[];
7
8
  export type WordleGameState = WordleRow[];
@@ -1 +1 @@
1
- {"version":3,"file":"wordle-game-state.d.ts","sourceRoot":"","sources":["../../../../../src/types/fields/wordle-game-state/wordle-game-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC;AAE1C,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"wordle-game-state.d.ts","sourceRoot":"","sources":["../../../../../src/types/fields/wordle-game-state/wordle-game-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC;AAE1C,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase-admin/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Admin SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/node/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA4CxE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Timestamp, } from "firebase-admin/firestore";
2
+ /**
3
+ * Firestore converter for Event documents (Admin SDK)
4
+ * Handles conversion between client-side Event type (with Date objects)
5
+ * and Firestore EventDocumentFirestore type (with Timestamps)
6
+ */
7
+ export const eventDocumentConverter = {
8
+ /**
9
+ * Convert EventDocument to Firestore document
10
+ * Date objects are converted to Firestore Timestamps
11
+ * FieldValue (like serverTimestamp()) is passed through as-is
12
+ * _id is stripped as it's not stored in Firestore
13
+ */
14
+ toFirestore: (event) => {
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const { _id, ...eventWithoutId } = event;
17
+ return {
18
+ ...eventWithoutId,
19
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
20
+ ? Timestamp.fromDate(eventWithoutId.begin_timestamp)
21
+ : eventWithoutId.begin_timestamp,
22
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
23
+ ? Timestamp.fromDate(eventWithoutId.end_timestamp)
24
+ : eventWithoutId.end_timestamp,
25
+ };
26
+ },
27
+ /**
28
+ * Convert Firestore document to EventDocument
29
+ * Timestamps are converted to Date objects
30
+ * _id is populated from document ID
31
+ */
32
+ fromFirestore: (snapshot) => {
33
+ const data = snapshot.data();
34
+ return {
35
+ ...data,
36
+ _id: snapshot.id,
37
+ begin_timestamp: data.begin_timestamp.toDate(),
38
+ end_timestamp: data.end_timestamp.toDate(),
39
+ available: data.available ?? [],
40
+ maybe_available: data.maybe_available ?? [],
41
+ non_available: data.non_available ?? [],
42
+ description: data.description ?? "",
43
+ };
44
+ },
45
+ };
@@ -0,0 +1,9 @@
1
+ import { EventDocument } from "../../types/documents/event-document/event-document.js";
2
+ import { type FirestoreDataConverter } from "firebase/firestore";
3
+ /**
4
+ * Firestore converter for Event documents (Web SDK)
5
+ * Handles conversion between client-side Event type (with Date objects)
6
+ * and Firestore EventDocumentFirestore type (with Timestamps)
7
+ */
8
+ export declare const eventDocumentConverter: FirestoreDataConverter<EventDocument>;
9
+ //# sourceMappingURL=event-document.converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-document.converter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/web/event-document.converter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AAEnF,OAAO,EAEL,KAAK,sBAAsB,EAI5B,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAAsB,CAAC,aAAa,CA8CxE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Timestamp, } from "firebase/firestore";
2
+ /**
3
+ * Firestore converter for Event documents (Web SDK)
4
+ * Handles conversion between client-side Event type (with Date objects)
5
+ * and Firestore EventDocumentFirestore type (with Timestamps)
6
+ */
7
+ export const eventDocumentConverter = {
8
+ /**
9
+ * Convert EventDocument to Firestore document
10
+ * Date objects are converted to Firestore Timestamps
11
+ * FieldValue (like serverTimestamp()) is passed through as-is
12
+ * _id is stripped as it's not stored in Firestore
13
+ */
14
+ toFirestore: (event) => {
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const { _id, ...eventWithoutId } = event;
17
+ return {
18
+ ...eventWithoutId,
19
+ begin_timestamp: eventWithoutId.begin_timestamp instanceof Date
20
+ ? Timestamp.fromDate(eventWithoutId.begin_timestamp)
21
+ : eventWithoutId.begin_timestamp,
22
+ end_timestamp: eventWithoutId.end_timestamp instanceof Date
23
+ ? Timestamp.fromDate(eventWithoutId.end_timestamp)
24
+ : eventWithoutId.end_timestamp,
25
+ };
26
+ },
27
+ /**
28
+ * Convert Firestore document to EventDocument
29
+ * Timestamps are converted to Date objects
30
+ * _id is populated from document ID
31
+ */
32
+ fromFirestore: (snapshot) => {
33
+ const data = snapshot.data();
34
+ return {
35
+ ...data,
36
+ _id: snapshot.id,
37
+ begin_timestamp: data.begin_timestamp.toDate(),
38
+ end_timestamp: data.end_timestamp.toDate(),
39
+ available: data.available ?? [],
40
+ maybe_available: data.maybe_available ?? [],
41
+ non_available: data.non_available ?? [],
42
+ description: data.description ?? "",
43
+ };
44
+ },
45
+ };