rategame-shared 1.1.397 → 1.1.398

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.
@@ -6,6 +6,17 @@ import { achievementId } from "../schemas/user";
6
6
  import { UnionGame } from "../models/game";
7
7
  export declare const firestoreTimestampSchema: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
8
8
  export declare const urlPrefixMap: Record<string, string>;
9
+ /**
10
+ * Resolve the Firestore collection prefix from a league slug string.
11
+ *
12
+ * Use this when you only have the league string (e.g. when reconstructing a
13
+ * game document path from a saved-item reference). Known slugs are looked up
14
+ * in urlPrefixMap; unknown/community slugs fall back to `leagues/{league}/`.
15
+ *
16
+ * @param league - The league slug (e.g. "nfl", "my_community_league")
17
+ * @returns The collection prefix (e.g. "leagues/nfl/" or "")
18
+ */
19
+ export declare function getGameCollectionPrefix(league: string): string;
9
20
  /**
10
21
  * Get the Firestore URL prefix for a game's collection path.
11
22
  * Handles both regular league games and community games.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.achievementsMap = exports.milestonesMap = exports.getGameUrlPrefix = exports.urlPrefixMap = exports.firestoreTimestampSchema = void 0;
3
+ exports.achievementsMap = exports.milestonesMap = exports.getGameUrlPrefix = exports.getGameCollectionPrefix = exports.urlPrefixMap = exports.firestoreTimestampSchema = void 0;
4
4
  const firestore_1 = require("@firebase/firestore");
5
5
  const zod_1 = require("zod");
6
6
  exports.firestoreTimestampSchema = zod_1.z.instanceof(firestore_1.Timestamp);
@@ -17,6 +17,21 @@ exports.urlPrefixMap = {
17
17
  wnba: "leagues/wnba/",
18
18
  cwc: "leagues/cwc/",
19
19
  };
20
+ /**
21
+ * Resolve the Firestore collection prefix from a league slug string.
22
+ *
23
+ * Use this when you only have the league string (e.g. when reconstructing a
24
+ * game document path from a saved-item reference). Known slugs are looked up
25
+ * in urlPrefixMap; unknown/community slugs fall back to `leagues/{league}/`.
26
+ *
27
+ * @param league - The league slug (e.g. "nfl", "my_community_league")
28
+ * @returns The collection prefix (e.g. "leagues/nfl/" or "")
29
+ */
30
+ function getGameCollectionPrefix(league) {
31
+ var _a;
32
+ return (_a = exports.urlPrefixMap[league]) !== null && _a !== void 0 ? _a : `leagues/${league}/`;
33
+ }
34
+ exports.getGameCollectionPrefix = getGameCollectionPrefix;
20
35
  /**
21
36
  * Get the Firestore URL prefix for a game's collection path.
22
37
  * Handles both regular league games and community games.
@@ -25,7 +40,6 @@ exports.urlPrefixMap = {
25
40
  * @returns The URL prefix for the game's collection (e.g., "leagues/nfl/" or "leagues/my_custom_league/")
26
41
  */
27
42
  function getGameUrlPrefix(game) {
28
- var _a;
29
43
  // Community games always use leagues/{league}/ format
30
44
  if (game.communityGame &&
31
45
  game.league &&
@@ -33,7 +47,7 @@ function getGameUrlPrefix(game) {
33
47
  return `leagues/${game.league}/`;
34
48
  }
35
49
  // Regular games use the urlPrefixMap
36
- return (_a = exports.urlPrefixMap[game.league]) !== null && _a !== void 0 ? _a : `leagues/${game.league}/`;
50
+ return getGameCollectionPrefix(game.league);
37
51
  }
38
52
  exports.getGameUrlPrefix = getGameUrlPrefix;
39
53
  exports.milestonesMap = {
@@ -2,3 +2,17 @@ import { z } from "zod";
2
2
  import { savedItemSchema, savedItemTypeSchema } from "../schemas/saved";
3
3
  export type SavedItem = z.infer<typeof savedItemSchema>;
4
4
  export type SavedItemType = z.infer<typeof savedItemTypeSchema>;
5
+ export interface EnrichedSavedItem {
6
+ id: string;
7
+ type: SavedItemType;
8
+ data: Record<string, any>;
9
+ savedAt: number;
10
+ }
11
+ export interface SavedFeedResponse {
12
+ items: EnrichedSavedItem[];
13
+ total: number;
14
+ /** True when more saved rows exist beyond the current page. */
15
+ hasMore: boolean;
16
+ limit?: string;
17
+ offset?: string;
18
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const chatMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
2
+ export declare const chatMessageSchema: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  content: z.ZodString;
5
5
  createdAt: z.ZodAny;
@@ -2303,9 +2303,9 @@ export declare const chatMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
2303
2303
  avatarUrl?: string | null | undefined;
2304
2304
  badge?: string | undefined;
2305
2305
  }>>>;
2306
- }, {
2306
+ } & {
2307
2307
  replyToMessage: z.ZodOptional<z.ZodNullable<z.ZodType<any, z.ZodTypeDef, any>>>;
2308
- }>, "strip", z.ZodTypeAny, {
2308
+ }, "strip", z.ZodTypeAny, {
2309
2309
  type: "text" | "rating" | "game" | "profile" | "list" | "gif" | "trivia";
2310
2310
  id: string;
2311
2311
  content: string;
@@ -2360,7 +2360,7 @@ export declare const chatMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
2360
2360
  itemId?: string | undefined;
2361
2361
  replyToMessage?: any;
2362
2362
  }>;
2363
- export declare const communityChatMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
2363
+ export declare const communityChatMessageSchema: z.ZodObject<{
2364
2364
  id: z.ZodString;
2365
2365
  content: z.ZodOptional<z.ZodString>;
2366
2366
  createdAt: z.ZodAny;
@@ -4662,9 +4662,9 @@ export declare const communityChatMessageSchema: z.ZodObject<z.objectUtil.extend
4662
4662
  avatarUrl?: string | null | undefined;
4663
4663
  badge?: string | undefined;
4664
4664
  }>>>;
4665
- }, {
4665
+ } & {
4666
4666
  replyToMessage: z.ZodOptional<z.ZodNullable<z.ZodType<any, z.ZodTypeDef, any>>>;
4667
- }>, "strip", z.ZodTypeAny, {
4667
+ }, "strip", z.ZodTypeAny, {
4668
4668
  type: "text" | "rating" | "game" | "profile" | "list" | "gif" | "trivia";
4669
4669
  id: string;
4670
4670
  user: {
@@ -1549,11 +1549,8 @@ export declare const searchExperienceRatingSchema: z.ZodObject<{
1549
1549
  /**
1550
1550
  * Schema for creating a new experience rating
1551
1551
  */
1552
- export declare const createExperienceRatingSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
1552
+ export declare const createExperienceRatingSchema: z.ZodObject<{
1553
1553
  id: z.ZodString;
1554
- createdAt: z.ZodNumber;
1555
- rating: z.ZodNumber;
1556
- comment: z.ZodOptional<z.ZodString>;
1557
1554
  user: z.ZodObject<Pick<{
1558
1555
  id: z.ZodString;
1559
1556
  email: z.ZodString;
@@ -2700,81 +2697,10 @@ export declare const createExperienceRatingSchema: z.ZodObject<z.objectUtil.exte
2700
2697
  avatarUrl?: string | null | undefined;
2701
2698
  badge?: string | undefined;
2702
2699
  }>;
2703
- experience: z.ZodObject<{
2704
- id: z.ZodString;
2705
- name: z.ZodString;
2706
- description: z.ZodString;
2707
- thumbnailUrl: z.ZodString;
2708
- gameId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2709
- stadiumId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2710
- stadiumVenueName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2711
- stadiumUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2712
- rating: z.ZodOptional<z.ZodObject<{
2713
- avg: z.ZodNumber;
2714
- votes: z.ZodObject<{
2715
- options: z.ZodRecord<z.ZodNumber, z.ZodNumber>;
2716
- total: z.ZodNumber;
2717
- }, "strip", z.ZodTypeAny, {
2718
- total: number;
2719
- options: Record<number, number>;
2720
- }, {
2721
- total: number;
2722
- options: Record<number, number>;
2723
- }>;
2724
- }, "strip", z.ZodTypeAny, {
2725
- avg: number;
2726
- votes: {
2727
- total: number;
2728
- options: Record<number, number>;
2729
- };
2730
- }, {
2731
- avg: number;
2732
- votes: {
2733
- total: number;
2734
- options: Record<number, number>;
2735
- };
2736
- }>>;
2737
- createdAt: z.ZodNumber;
2738
- happenedAt: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
2739
- }, "strip", z.ZodTypeAny, {
2740
- id: string;
2741
- name: string;
2742
- description: string;
2743
- createdAt: number;
2744
- thumbnailUrl: string;
2745
- stadiumUrl?: string | null | undefined;
2746
- rating?: {
2747
- avg: number;
2748
- votes: {
2749
- total: number;
2750
- options: Record<number, number>;
2751
- };
2752
- } | undefined;
2753
- stadiumId?: string | null | undefined;
2754
- gameId?: string | null | undefined;
2755
- stadiumVenueName?: string | null | undefined;
2756
- happenedAt?: number | null | undefined;
2757
- }, {
2758
- id: string;
2759
- name: string;
2760
- description: string;
2761
- createdAt: number;
2762
- thumbnailUrl: string;
2763
- stadiumUrl?: string | null | undefined;
2764
- rating?: {
2765
- avg: number;
2766
- votes: {
2767
- total: number;
2768
- options: Record<number, number>;
2769
- };
2770
- } | undefined;
2771
- stadiumId?: string | null | undefined;
2772
- gameId?: string | null | undefined;
2773
- stadiumVenueName?: string | null | undefined;
2774
- happenedAt?: number | null | undefined;
2775
- }>;
2776
- userLikes: z.ZodOptional<z.ZodNumber>;
2777
2700
  updatedAt: z.ZodOptional<z.ZodNumber>;
2701
+ rating: z.ZodNumber;
2702
+ comment: z.ZodOptional<z.ZodString>;
2703
+ userLikes: z.ZodOptional<z.ZodNumber>;
2778
2704
  edited: z.ZodOptional<z.ZodBoolean>;
2779
2705
  userLocation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
2780
2706
  events: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -2820,7 +2746,7 @@ export declare const createExperienceRatingSchema: z.ZodObject<z.objectUtil.exte
2820
2746
  ratingCount?: number | undefined;
2821
2747
  };
2822
2748
  }>, "many">>;
2823
- }, "createdAt">, {
2749
+ } & {
2824
2750
  experience: z.ZodObject<Omit<{
2825
2751
  id: z.ZodString;
2826
2752
  name: z.ZodString;
@@ -2880,7 +2806,7 @@ export declare const createExperienceRatingSchema: z.ZodObject<z.objectUtil.exte
2880
2806
  stadiumVenueName?: string | null | undefined;
2881
2807
  happenedAt?: number | null | undefined;
2882
2808
  }>;
2883
- }>, "strip", z.ZodTypeAny, {
2809
+ }, "strip", z.ZodTypeAny, {
2884
2810
  id: string;
2885
2811
  user: {
2886
2812
  id: string;