From 8f17bb878345ceb76b231f142dc3a9293ce6e92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 9 Oct 2024 13:18:38 +0200 Subject: [PATCH] pl-api hotfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-api/lib/entities/account.ts | 20 ++++++++++++++------ packages/pl-api/package.json | 2 +- packages/pl-fe/package.json | 2 +- packages/pl-fe/yarn.lock | 8 ++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/pl-api/lib/entities/account.ts b/packages/pl-api/lib/entities/account.ts index 7df9fee07..2c195dda7 100644 --- a/packages/pl-api/lib/entities/account.ts +++ b/packages/pl-api/lib/entities/account.ts @@ -132,13 +132,17 @@ const accountWithMovedAccountSchema = baseAccountSchema.extend({ }); /** @see {@link https://docs.joinmastodon.org/entities/Account/} */ -const accountSchema: z.ZodType = z.preprocess(preprocessAccount, accountWithMovedAccountSchema) as any; +const untypedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema); -type Account = z.infer & { +type WithMoved = { moved: Account | null; }; -const credentialAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({ +type Account = z.infer & WithMoved; + +const accountSchema: z.ZodType = 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; +type CredentialAccount = z.infer & WithMoved; -const mutedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({ +const credentialAccountSchema: z.ZodType = untypedCredentialAccountSchema as any; + +const untypedMutedAccountSchema = z.preprocess(preprocessAccount, accountWithMovedAccountSchema.extend({ mute_expires_at: dateSchema.nullable().catch(null), })); -type MutedAccount = z.infer; +type MutedAccount = z.infer & WithMoved; + +const mutedAccountSchema: z.ZodType = untypedMutedAccountSchema as any; export { accountSchema, diff --git a/packages/pl-api/package.json b/packages/pl-api/package.json index 2f00597ad..a899bf6a2 100644 --- a/packages/pl-api/package.json +++ b/packages/pl-api/package.json @@ -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": { diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index 876bc19da..57790d81b 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -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", diff --git a/packages/pl-fe/yarn.lock b/packages/pl-fe/yarn.lock index 1d1895834..3251171a0 100644 --- a/packages/pl-fe/yarn.lock +++ b/packages/pl-fe/yarn.lock @@ -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"