pl-api hotfix

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-09 13:18:38 +02:00
parent 5297e100ce
commit 8f17bb8783
4 changed files with 20 additions and 12 deletions

View file

@ -132,13 +132,17 @@ const accountWithMovedAccountSchema = baseAccountSchema.extend({
});
/** @see {@link https://docs.joinmastodon.org/entities/Account/} */
const accountSchema: z.ZodType<Account> = z.preprocess(preprocessAccount, accountWithMovedAccountSchema) as any;
const untypedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema);
type Account = z.infer<typeof baseAccountSchema> & {
type WithMoved = {
moved: Account | null;
};
const credentialAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({
type Account = z.infer<typeof baseAccountSchema> & WithMoved;
const accountSchema: z.ZodType<Account> = untypedAccountSchema as any;
const untypedCredentialAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({
source: z.object({
note: z.string().catch(''),
fields: filteredArray(fieldSchema),
@ -166,13 +170,17 @@ const credentialAccountSchema = z.preprocess(preprocessAccount, accountWithMoved
}).optional().catch(undefined),
}));
type CredentialAccount = z.infer<typeof credentialAccountSchema>;
type CredentialAccount = z.infer<typeof untypedCredentialAccountSchema> & WithMoved;
const mutedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({
const credentialAccountSchema: z.ZodType<CredentialAccount> = untypedCredentialAccountSchema as any;
const untypedMutedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({
mute_expires_at: dateSchema.nullable().catch(null),
}));
type MutedAccount = z.infer<typeof mutedAccountSchema>;
type MutedAccount = z.infer<typeof untypedMutedAccountSchema> & WithMoved;
const mutedAccountSchema: z.ZodType<MutedAccount> = untypedMutedAccountSchema as any;
export {
accountSchema,

View file

@ -1,6 +1,6 @@
{
"name": "pl-api",
"version": "0.0.39",
"version": "0.0.40",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-api",
"repository": {

View file

@ -103,7 +103,7 @@
"mini-css-extract-plugin": "^2.9.1",
"multiselect-react-dropdown": "^2.0.25",
"path-browserify": "^1.0.1",
"pl-api": "^0.0.39",
"pl-api": "^0.0.40",
"postcss": "^8.4.47",
"process": "^0.11.10",
"punycode": "^2.1.1",

View file

@ -8128,10 +8128,10 @@ pirates@^4.0.1:
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9"
integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==
pl-api@^0.0.39:
version "0.0.39"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.39.tgz#7db536d1566b4f8c741b8d01dbdd7faa3ecb66cc"
integrity sha512-kkg1e8V21Xfa9ajOXo+3aa7o7rwPy9aTfBM21APvzt1vdQqINhbPspw1IZEXkQQCR/9kittaTnc/XFQKLuTfhA==
pl-api@^0.0.40:
version "0.0.40"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.40.tgz#d2c63a8673e8899e5ea1b550544b2658310bfa03"
integrity sha512-HgpfBm+JJ68ack5Crw7f+2fKUCueJTy//xwgUjvOw4ZCBUsMlckse+VjZNoUsgg3jPxY1Yb8e2nJkJCdiYnTkA==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"