rategame-shared 1.1.531 → 1.1.533
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.
|
@@ -466,12 +466,12 @@ const getPlayerGameStats = (stats, league, position) => {
|
|
|
466
466
|
}
|
|
467
467
|
else if (positionCode.includes('RB') || positionCode.includes('RUNNING')) {
|
|
468
468
|
addFrom([
|
|
469
|
+
'rushing_attempts',
|
|
469
470
|
'rushing_yards',
|
|
470
471
|
'rushing_touchdowns',
|
|
471
472
|
'receptions',
|
|
472
|
-
'receiving_touchdowns',
|
|
473
|
-
'rushing_attempts',
|
|
474
473
|
'receiving_yards',
|
|
474
|
+
'receiving_touchdowns',
|
|
475
475
|
]);
|
|
476
476
|
}
|
|
477
477
|
else if (positionCode.includes('WR') ||
|
|
@@ -68,6 +68,22 @@ export declare const articleEntitySchema: z.ZodObject<{
|
|
|
68
68
|
*/
|
|
69
69
|
export declare const ARTICLE_PROSE_MAX_LENGTH = 50000;
|
|
70
70
|
export declare const ARTICLE_BODY_MAX_LENGTH = 150000;
|
|
71
|
+
export declare const ARTICLE_RELATED_MAX = 20;
|
|
72
|
+
/**
|
|
73
|
+
* Block embed stored in article markdown. Hydrated on the client the same way
|
|
74
|
+
* chat embeds are: type + id only, no pre-fetched document.
|
|
75
|
+
*/
|
|
76
|
+
export declare const ARTICLE_EMBED_TOKEN_RE: RegExp;
|
|
77
|
+
export declare const serializeArticleEmbed: (type: string, id: string) => string;
|
|
78
|
+
export type ArticleBodyPart = {
|
|
79
|
+
kind: "markdown";
|
|
80
|
+
value: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: "embed";
|
|
83
|
+
embedType: string;
|
|
84
|
+
itemId: string;
|
|
85
|
+
};
|
|
86
|
+
export declare const splitArticleBodyByEmbeds: (body: string) => ArticleBodyPart[];
|
|
71
87
|
export declare const stripMarkdownImages: (markdown: string) => string;
|
|
72
88
|
export declare const articleBodySchema: z.ZodEffects<z.ZodString, string, string>;
|
|
73
89
|
/**
|
|
@@ -134,6 +150,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
134
150
|
} | null | undefined;
|
|
135
151
|
gameEntity?: any;
|
|
136
152
|
}>, "many">>;
|
|
153
|
+
relatedArticles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
154
|
+
relatedArticleItems: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
137
155
|
entityLeagues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
138
156
|
entityTeamIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
139
157
|
entityStadiumIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1828,6 +1846,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
1828
1846
|
} | null | undefined;
|
|
1829
1847
|
gameEntity?: any;
|
|
1830
1848
|
}[] | undefined;
|
|
1849
|
+
relatedArticles?: string[] | undefined;
|
|
1850
|
+
relatedArticleItems?: any[] | undefined;
|
|
1831
1851
|
entityLeagues?: string[] | undefined;
|
|
1832
1852
|
entityTeamIds?: string[] | undefined;
|
|
1833
1853
|
entityStadiumIds?: string[] | undefined;
|
|
@@ -1865,6 +1885,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
1865
1885
|
} | null | undefined;
|
|
1866
1886
|
gameEntity?: any;
|
|
1867
1887
|
}[] | undefined;
|
|
1888
|
+
relatedArticles?: string[] | undefined;
|
|
1889
|
+
relatedArticleItems?: any[] | undefined;
|
|
1868
1890
|
entityLeagues?: string[] | undefined;
|
|
1869
1891
|
entityTeamIds?: string[] | undefined;
|
|
1870
1892
|
entityStadiumIds?: string[] | undefined;
|
|
@@ -1936,6 +1958,7 @@ export declare const createArticleSchema: z.ZodObject<{
|
|
|
1936
1958
|
} | null | undefined;
|
|
1937
1959
|
gameEntity?: any;
|
|
1938
1960
|
}>, "many">>;
|
|
1961
|
+
relatedArticles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1939
1962
|
user: z.ZodObject<Pick<{
|
|
1940
1963
|
id: z.ZodString;
|
|
1941
1964
|
email: z.ZodString;
|
|
@@ -3618,6 +3641,7 @@ export declare const createArticleSchema: z.ZodObject<{
|
|
|
3618
3641
|
} | null | undefined;
|
|
3619
3642
|
gameEntity?: any;
|
|
3620
3643
|
}[] | undefined;
|
|
3644
|
+
relatedArticles?: string[] | undefined;
|
|
3621
3645
|
}, {
|
|
3622
3646
|
body: string;
|
|
3623
3647
|
title: string;
|
|
@@ -3645,6 +3669,7 @@ export declare const createArticleSchema: z.ZodObject<{
|
|
|
3645
3669
|
} | null | undefined;
|
|
3646
3670
|
gameEntity?: any;
|
|
3647
3671
|
}[] | undefined;
|
|
3672
|
+
relatedArticles?: string[] | undefined;
|
|
3648
3673
|
}>;
|
|
3649
3674
|
/**
|
|
3650
3675
|
* Schema for updating an existing article.
|
|
@@ -3704,6 +3729,7 @@ export declare const updateArticleSchema: z.ZodObject<{
|
|
|
3704
3729
|
} | null | undefined;
|
|
3705
3730
|
gameEntity?: any;
|
|
3706
3731
|
}>, "many">>;
|
|
3732
|
+
relatedArticles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3707
3733
|
}, "strip", z.ZodTypeAny, {
|
|
3708
3734
|
body?: string | undefined;
|
|
3709
3735
|
title?: string | undefined;
|
|
@@ -3723,6 +3749,7 @@ export declare const updateArticleSchema: z.ZodObject<{
|
|
|
3723
3749
|
} | null | undefined;
|
|
3724
3750
|
gameEntity?: any;
|
|
3725
3751
|
}[] | undefined;
|
|
3752
|
+
relatedArticles?: string[] | undefined;
|
|
3726
3753
|
}, {
|
|
3727
3754
|
body?: string | undefined;
|
|
3728
3755
|
title?: string | undefined;
|
|
@@ -3742,6 +3769,7 @@ export declare const updateArticleSchema: z.ZodObject<{
|
|
|
3742
3769
|
} | null | undefined;
|
|
3743
3770
|
gameEntity?: any;
|
|
3744
3771
|
}[] | undefined;
|
|
3772
|
+
relatedArticles?: string[] | undefined;
|
|
3745
3773
|
}>;
|
|
3746
3774
|
/**
|
|
3747
3775
|
* Search/filter parameters for articles.
|
package/dist/schemas/article.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.articleThreadCommentLikeSchema = exports.articleThreadCommentSchema = exports.searchArticleSchema = exports.updateArticleSchema = exports.createArticleSchema = exports.articleSchema = exports.articleBodySchema = exports.stripMarkdownImages = exports.ARTICLE_BODY_MAX_LENGTH = exports.ARTICLE_PROSE_MAX_LENGTH = exports.articleEntitySchema = exports.articleEntityTypeSchema = void 0;
|
|
3
|
+
exports.articleThreadCommentLikeSchema = exports.articleThreadCommentSchema = exports.searchArticleSchema = exports.updateArticleSchema = exports.createArticleSchema = exports.articleSchema = exports.articleBodySchema = exports.stripMarkdownImages = exports.splitArticleBodyByEmbeds = exports.serializeArticleEmbed = exports.ARTICLE_EMBED_TOKEN_RE = exports.ARTICLE_RELATED_MAX = exports.ARTICLE_BODY_MAX_LENGTH = exports.ARTICLE_PROSE_MAX_LENGTH = exports.articleEntitySchema = exports.articleEntityTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const user_1 = require("./user");
|
|
6
6
|
const trivia_1 = require("./trivia");
|
|
@@ -43,12 +43,49 @@ exports.articleEntitySchema = zod_1.z.object({
|
|
|
43
43
|
*/
|
|
44
44
|
exports.ARTICLE_PROSE_MAX_LENGTH = 50000;
|
|
45
45
|
exports.ARTICLE_BODY_MAX_LENGTH = 150000;
|
|
46
|
+
exports.ARTICLE_RELATED_MAX = 20;
|
|
47
|
+
/**
|
|
48
|
+
* Block embed stored in article markdown. Hydrated on the client the same way
|
|
49
|
+
* chat embeds are: type + id only, no pre-fetched document.
|
|
50
|
+
*/
|
|
51
|
+
exports.ARTICLE_EMBED_TOKEN_RE = /\{\{rg-embed:([a-zA-Z]+):([^}\s]+)\}\}/g;
|
|
52
|
+
const serializeArticleEmbed = (type, id) => `{{rg-embed:${type}:${id}}}`;
|
|
53
|
+
exports.serializeArticleEmbed = serializeArticleEmbed;
|
|
54
|
+
const splitArticleBodyByEmbeds = (body) => {
|
|
55
|
+
if (!body) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
const parts = [];
|
|
59
|
+
const tokenRe = new RegExp(exports.ARTICLE_EMBED_TOKEN_RE.source, "g");
|
|
60
|
+
let lastIndex = 0;
|
|
61
|
+
let match;
|
|
62
|
+
while ((match = tokenRe.exec(body)) !== null) {
|
|
63
|
+
if (match.index > lastIndex) {
|
|
64
|
+
parts.push({
|
|
65
|
+
kind: "markdown",
|
|
66
|
+
value: body.slice(lastIndex, match.index),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
parts.push({
|
|
70
|
+
kind: "embed",
|
|
71
|
+
embedType: match[1],
|
|
72
|
+
itemId: match[2],
|
|
73
|
+
});
|
|
74
|
+
lastIndex = match.index + match[0].length;
|
|
75
|
+
}
|
|
76
|
+
if (lastIndex < body.length) {
|
|
77
|
+
parts.push({ kind: "markdown", value: body.slice(lastIndex) });
|
|
78
|
+
}
|
|
79
|
+
return parts;
|
|
80
|
+
};
|
|
81
|
+
exports.splitArticleBodyByEmbeds = splitArticleBodyByEmbeds;
|
|
46
82
|
const stripMarkdownImages = (markdown) => {
|
|
47
83
|
if (!markdown) {
|
|
48
84
|
return "";
|
|
49
85
|
}
|
|
50
86
|
return markdown
|
|
51
87
|
.replace(/!\[[^\]]*\]\([^)]*\)/g, "")
|
|
88
|
+
.replace(exports.ARTICLE_EMBED_TOKEN_RE, "")
|
|
52
89
|
.replace(/\n{3,}/g, "\n\n")
|
|
53
90
|
.trim();
|
|
54
91
|
};
|
|
@@ -78,6 +115,10 @@ exports.articleSchema = zod_1.z.object({
|
|
|
78
115
|
imageUrlSmall: zod_1.z.string().optional().nullable(),
|
|
79
116
|
// Up to 10 optional entity tags.
|
|
80
117
|
entities: zod_1.z.array(exports.articleEntitySchema).max(10).optional(),
|
|
118
|
+
// IDs of other articles by the same author (series / related). Hydrated on
|
|
119
|
+
// findOne into `relatedArticleItems`; never stored as full documents.
|
|
120
|
+
relatedArticles: zod_1.z.array(zod_1.z.string()).max(exports.ARTICLE_RELATED_MAX).optional(),
|
|
121
|
+
relatedArticleItems: zod_1.z.array(zod_1.z.any()).optional(),
|
|
81
122
|
// Denormalized tag references for `array-contains` filtering (derived from
|
|
82
123
|
// `entities` server-side on create/update).
|
|
83
124
|
entityLeagues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
@@ -106,6 +147,7 @@ exports.createArticleSchema = zod_1.z.object({
|
|
|
106
147
|
body: exports.articleBodySchema,
|
|
107
148
|
imageUrl: zod_1.z.string().optional().nullable(),
|
|
108
149
|
entities: zod_1.z.array(exports.articleEntitySchema).max(10).optional(),
|
|
150
|
+
relatedArticles: zod_1.z.array(zod_1.z.string()).max(exports.ARTICLE_RELATED_MAX).optional(),
|
|
109
151
|
user: user_1.reducedUserSchema,
|
|
110
152
|
});
|
|
111
153
|
/**
|
|
@@ -116,6 +158,7 @@ exports.updateArticleSchema = zod_1.z.object({
|
|
|
116
158
|
body: exports.articleBodySchema.optional(),
|
|
117
159
|
imageUrl: zod_1.z.string().optional().nullable(),
|
|
118
160
|
entities: zod_1.z.array(exports.articleEntitySchema).max(10).optional(),
|
|
161
|
+
relatedArticles: zod_1.z.array(zod_1.z.string()).max(exports.ARTICLE_RELATED_MAX).optional(),
|
|
119
162
|
});
|
|
120
163
|
/**
|
|
121
164
|
* Search/filter parameters for articles.
|