i hate my life

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-01-02 16:37:49 +01:00
parent 4b5402aed3
commit bf4bfa0b4b
13 changed files with 369 additions and 553 deletions

View File

@ -10,14 +10,7 @@ A JavaScript library for interacting with Mastodon API-compatible servers, focus
Example:
```ts
import {
ALL_SCHEMAS,
importSchemas,
PlApiClient,
type CreateApplicationParams,
} from 'pl-api';
importSchemas(ALL_SCHEMAS);
import { PlApiClient, type CreateApplicationParams } from 'pl-api';
const { ACCESS_TOKEN } = process.env;

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,6 @@ export * from './backup';
export * from './bookmark-folder';
export * from './chat';
export * from './chat-message';
export * from './circle';
export * from './context';
export * from './conversation';
export * from './custom-emoji';
@ -58,7 +57,6 @@ export * from './notification-request';
export * from './oauth-token';
export * from './poll';
export * from './preview-card';
export * from './preview-card-author';
export * from './relationship';
export * from './relationship-severance-event';
export * from './report';

View File

@ -5,5 +5,3 @@ export * from './entities';
export * from './features';
export * from './params';
export * from './responses';
export * from './schemas';
export * from './schemas/all-schemas';

View File

@ -1,193 +0,0 @@
import {
accountSchema,
accountWarningSchema,
adminAccountSchema,
adminAnnouncementSchema,
adminCanonicalEmailBlockSchema,
adminCohortSchema,
adminDimensionSchema,
adminDomainAllowSchema,
adminDomainBlockSchema,
adminDomainSchema,
adminEmailDomainBlockSchema,
adminIpBlockSchema,
adminIpSchema,
adminMeasureSchema,
adminModerationLogEntrySchema,
adminRelaySchema,
adminReportSchema,
adminRuleSchema,
adminTagSchema,
announcementReactionSchema,
announcementSchema,
antennaSchema,
applicationSchema,
backupSchema,
blurhashSchema,
bookmarkFolderSchema,
chatMessageSchema,
chatSchema,
circleSchema,
contextSchema,
conversationSchema,
credentialAccountSchema,
credentialApplicationSchema,
customEmojiSchema,
domainBlockSchema,
emojiReactionSchema,
extendedDescriptionSchema,
familiarFollowersSchema,
featuredTagSchema,
filterKeywordSchema,
filterSchema,
filterStatusSchema,
followRelationshipUpdateSchema,
groupedNotificationsResultsSchema,
groupMemberSchema,
groupRelationshipSchema,
groupSchema,
historySchema,
instanceSchema,
interactionPoliciesSchema,
interactionPolicySchema,
interactionRequestSchema,
listSchema,
locationSchema,
markerSchema,
markersSchema,
mediaAttachmentSchema,
mentionSchema,
mutedAccountSchema,
notificationGroupSchema,
notificationPolicySchema,
notificationRequestSchema,
notificationSchema,
oauthTokenSchema,
pleromaConfigSchema,
pollSchema,
previewCardAuthorSchema,
previewCardSchema,
relationshipSchema,
relationshipSeveranceEventSchema,
reportSchema,
roleSchema,
ruleSchema,
scheduledStatusSchema,
scrobbleSchema,
searchSchema,
statusEditSchema,
statusSchema,
statusSourceSchema,
statusWithoutAccountSchema,
streamingEventSchema,
suggestionSchema,
tagSchema,
tokenSchema,
translationSchema,
trendsLinkSchema,
webPushSubscriptionSchema,
} from '../entities';
const NON_ADMIN_SCHEMAS = {
accountSchema,
accountWarningSchema,
announcementReactionSchema,
announcementSchema,
antennaSchema,
applicationSchema,
backupSchema,
blurhashSchema,
bookmarkFolderSchema,
chatMessageSchema,
chatSchema,
circleSchema,
contextSchema,
conversationSchema,
credentialAccountSchema,
credentialApplicationSchema,
customEmojiSchema,
domainBlockSchema,
emojiReactionSchema,
extendedDescriptionSchema,
familiarFollowersSchema,
featuredTagSchema,
filterKeywordSchema,
filterSchema,
filterStatusSchema,
followRelationshipUpdateSchema,
groupedNotificationsResultsSchema,
groupMemberSchema,
groupRelationshipSchema,
groupSchema,
historySchema,
instanceSchema,
interactionPoliciesSchema,
interactionPolicySchema,
interactionRequestSchema,
listSchema,
locationSchema,
markerSchema,
markersSchema,
mediaAttachmentSchema,
mentionSchema,
mutedAccountSchema,
notificationGroupSchema,
notificationPolicySchema,
notificationRequestSchema,
notificationSchema,
oauthTokenSchema,
pollSchema,
previewCardAuthorSchema,
previewCardSchema,
relationshipSchema,
relationshipSeveranceEventSchema,
reportSchema,
roleSchema,
ruleSchema,
scheduledStatusSchema,
scrobbleSchema,
searchSchema,
statusEditSchema,
statusSchema,
statusSourceSchema,
statusWithoutAccountSchema,
streamingEventSchema,
suggestionSchema,
tagSchema,
tokenSchema,
translationSchema,
trendsLinkSchema,
webPushSubscriptionSchema,
};
const ADMIN_SCHEMAS = {
adminAccountSchema,
adminAnnouncementSchema,
adminCanonicalEmailBlockSchema,
adminCohortSchema,
adminDimensionSchema,
adminDomainAllowSchema,
adminDomainBlockSchema,
adminDomainSchema,
adminEmailDomainBlockSchema,
adminIpBlockSchema,
adminIpSchema,
adminMeasureSchema,
adminModerationLogEntrySchema,
adminRelaySchema,
adminReportSchema,
adminRuleSchema,
adminTagSchema,
pleromaConfigSchema,
};
const ALL_SCHEMAS = {
...ADMIN_SCHEMAS,
...NON_ADMIN_SCHEMAS,
};
export {
ALL_SCHEMAS,
ADMIN_SCHEMAS,
NON_ADMIN_SCHEMAS,
};

View File

@ -1,21 +0,0 @@
import * as v from 'valibot';
import { instanceSchema } from '../entities';
import type { ALL_SCHEMAS } from './all-schemas';
const nullSchema = v.fallback(v.null(), null);
const IMPORTED_SCHEMAS = {
instanceSchema,
} as typeof ALL_SCHEMAS;
const SCHEMAS = new Proxy(IMPORTED_SCHEMAS, {
get: (target, p: keyof typeof ALL_SCHEMAS) => p in target ? target[p] : nullSchema,
});
const importSchemas = (schemas: Partial<typeof ALL_SCHEMAS>) =>
// @ts-ignore
Object.entries(schemas).forEach(([key, value]) => IMPORTED_SCHEMAS[key] = value);
export { SCHEMAS, importSchemas };

View File

@ -1,6 +1,6 @@
{
"name": "pl-api",
"version": "1.0.0-rc.15",
"version": "1.0.0-rc.10",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
"repository": {
@ -31,7 +31,6 @@
"eslint-plugin-compat": "6.0.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-promise": "^7.2.1",
"rollup-plugin-tree-shakeable": "^1.0.3",
"typedoc": "^0.27.6",
"typedoc-material-theme": "^1.2.0",
"typedoc-plugin-valibot": "^1.0.0",

View File

@ -1,6 +1,5 @@
import { resolve } from 'path';
import treeShakeable from 'rollup-plugin-tree-shakeable';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
@ -20,7 +19,6 @@ export default defineConfig({
sourcemap: true,
rollupOptions: {
external: Object.keys(pkg.dependencies),
plugins: [treeShakeable()],
},
},
});

View File

@ -547,13 +547,6 @@
dependencies:
undici-types "~6.20.0"
"@types/node@^22.7.7":
version "22.10.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.3.tgz#cdc2a89bf6e5d5e593fad08e83f74d7348d5dd10"
integrity sha512-DifAyw4BkrufCILvD3ucnuN8eydUfc/C1GlyrnI+LK6543w5/L3VeVgf05o3B4fqSXP1dKYLOZsKfutpxPzZrw==
dependencies:
undici-types "~6.20.0"
"@types/semver@^7.5.8":
version "7.5.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
@ -1468,13 +1461,6 @@ estree-walker@^2.0.2:
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
estree-walker@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d"
integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==
dependencies:
"@types/estree" "^1.0.0"
esutils@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@ -2064,7 +2050,7 @@ lunr@^2.3.9:
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
magic-string@^0.30.12, magic-string@^0.30.17:
magic-string@^0.30.17:
version "0.30.17"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.17.tgz#450a449673d2460e5bbcfba9a61916a1714c7453"
integrity sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==
@ -2403,15 +2389,6 @@ rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
rollup-plugin-tree-shakeable@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/rollup-plugin-tree-shakeable/-/rollup-plugin-tree-shakeable-1.0.3.tgz#8c63528ff119575968e7c9af5e938ee7c071efca"
integrity sha512-A4c06mvUYIuYMN2NJnnPNh5AZlW3KzisCXSENBABUFK4HDgLycuKRsDMRFT21P5CfijoHIo7FDdrVrOGFce4vg==
dependencies:
"@types/node" "^22.7.7"
estree-walker "^3.0.3"
magic-string "^0.30.12"
rollup@^4.23.0:
version "4.28.1"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.28.1.tgz#7718ba34d62b449dfc49adbfd2f312b4fe0df4de"

View File

@ -1,4 +1,3 @@
import './schemas';
import './polyfills';
import React from 'react';

View File

@ -1,3 +0,0 @@
import { ALL_SCHEMAS, importSchemas } from 'pl-api';
importSchemas(ALL_SCHEMAS);

View File

@ -1,6 +1,6 @@
{
"name": "pl-hooks",
"version": "0.0.12",
"version": "0.0.6",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-hooks",
"repository": {
@ -35,9 +35,9 @@
"dependencies": {
"@tanstack/react-query": "^5.59.16",
"lodash": "^4.17.21",
"pl-api": "^1.0.0-rc.15",
"pl-api": "^1.0.0-rc.1",
"react": "^18.3.1",
"valibot": "^1.0.0-beta.9"
"valibot": "^0.42.1"
},
"module": "./dist/main.es.js",
"types": "dist/main.d.ts",

View File

@ -2158,10 +2158,10 @@ pkg-types@^1.0.3, pkg-types@^1.1.1:
mlly "^1.7.1"
pathe "^1.1.2"
pl-api@^1.0.0-rc.15:
version "1.0.0-rc.15"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.15.tgz#fa9d0bbc940388f5a18914e2b7e0b04a540dcd04"
integrity sha512-TqKOJ0URSUOpUJMVyGeRGCNRMocCbSCwSHx4ZkJoC7s/pcbcFWFB0aKDER9LoEOGk3SvBBH7mBDc/4Bnviqd6g==
pl-api@^1.0.0-rc.1:
version "1.0.0-rc.1"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.1.tgz#e5b1ead42230ed86e57ebaf020f3a2114da3bce0"
integrity sha512-bwV831HoATajRlmZg4USIzQvHgZC9MBAg0/sN/T5uXrM5tcUzfM+qU5ZQIzk+r5gSQ0ZCwqkjbajvhbn9tRcBA==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"
@ -2171,7 +2171,7 @@ pl-api@^1.0.0-rc.15:
object-to-formdata "^4.5.1"
query-string "^9.1.1"
semver "^7.6.3"
valibot "^1.0.0-beta.9"
valibot "^0.42.1"
possible-typed-array-names@^1.0.0:
version "1.0.0"
@ -2613,10 +2613,10 @@ uri-js@^4.2.2, uri-js@^4.4.1:
dependencies:
punycode "^2.1.0"
valibot@^1.0.0-beta.9:
version "1.0.0-beta.9"
resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.0.0-beta.9.tgz#8ae38ca53429a5c4c4cce4378e3c87cca708a287"
integrity sha512-yEX8gMAZ2R1yI2uwOO4NCtVnJQx36zn3vD0omzzj9FhcoblvPukENIiRZXKZwCnqSeV80bMm8wNiGhQ0S8fiww==
valibot@^0.42.1:
version "0.42.1"
resolved "https://registry.yarnpkg.com/valibot/-/valibot-0.42.1.tgz#a31183d8e9d7552f98e22ca0977172cab8815188"
integrity sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==
vite-plugin-dts@^4.2.1:
version "4.2.1"