Compare commits

...

6 commits

Author SHA1 Message Date
Jesse Wierzbinski 8c0a20a743
chore(packages/client): 🔖 Release 0.2.0-alpha.2
Some checks failed
Build Docker Images / lint (push) Failing after 7s
Build Docker Images / check (push) Failing after 7s
Build Docker Images / tests (push) Failing after 7s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
2025-05-26 11:05:02 +02:00
Jesse Wierzbinski 6d85dbdfcb
fix(packages/client): 🐛 Fix client types, and add missing banner schema for Instance 2025-05-26 11:04:09 +02:00
Jesse Wierzbinski 77cd27a458
ci: 👷 Add CI workflow to publish packages 2025-05-26 09:08:14 +02:00
Jesse Wierzbinski e5e688a154
fix: 🐛 Add type: json specifier to all JSON imports 2025-05-26 08:55:06 +02:00
Jesse Wierzbinski fa5be6bd6a
chore: 🐛 Add jsr registry file to SDK package 2025-05-26 08:52:30 +02:00
Jesse Wierzbinski bf9840bd14
ci: 💚 Fix test publish CI 2025-05-26 08:47:27 +02:00
17 changed files with 97 additions and 21 deletions

48
.github/workflows/publish.yml vendored Normal file
View file

@ -0,0 +1,48 @@
name: Build & Publish Packages
on:
workflow_dispatch:
inputs:
package:
description: "Package to publish"
required: true
type: choice
options:
- client
- sdk
tag:
description: "NPM tag to use"
required: true
type: choice
default: nightly
options:
- latest
- nightly
permissions:
contents: read
# For provenance generation
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment: NPM Deploy
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install
run: bun install --frozen-lockfile
- name: Publish to NPM
working-directory: packages/${{ inputs.package }}
run: bun publish --provenance --tag ${{ inputs.tag }} --access public
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to JSR
working-directory: packages/${{ inputs.package }}
run: bunx jsr publish --allow-slow-types --allow-dirty

View file

@ -23,16 +23,13 @@ jobs:
- uses: oven-sh/setup-bun@v2 - uses: oven-sh/setup-bun@v2
- name: Install - name: Install
run: bun install run: bun install --frozen-lockfile
- name: Configure .npmrc
working-directory: packages/${{ matrix.package }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Publish to NPM - name: Publish to NPM
working-directory: packages/${{ matrix.package }} working-directory: packages/${{ matrix.package }}
run: bun publish --dry-run env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
run: bun publish --dry-run --access public
- name: Publish to JSR - name: Publish to JSR
working-directory: packages/${{ matrix.package }} working-directory: packages/${{ matrix.package }}

View file

@ -8,7 +8,9 @@
"config", "config",
"plugin", "plugin",
"worker", "worker",
"media" "media",
"packages/client",
"packages/sdk"
], ],
"languageToolLinter.languageTool.ignoredWordsInWorkspace": ["versia"] "languageToolLinter.languageTool.ignoredWordsInWorkspace": ["versia"]
} }

View file

@ -8,7 +8,7 @@ import type { z } from "zod";
import { apiRoute } from "@/api"; import { apiRoute } from "@/api";
import { markdownParse } from "~/classes/functions/status"; import { markdownParse } from "~/classes/functions/status";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import manifest from "~/package.json"; import manifest from "~/package.json" with { type: "json" };
export default apiRoute((app) => export default apiRoute((app) =>
app.get( app.get(

View file

@ -6,7 +6,7 @@ import { describeRoute } from "hono-openapi";
import { resolver } from "hono-openapi/zod"; import { resolver } from "hono-openapi/zod";
import { apiRoute } from "@/api"; import { apiRoute } from "@/api";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import pkg from "~/package.json"; import pkg from "~/package.json" with { type: "json" };
export default apiRoute((app) => export default apiRoute((app) =>
app.get( app.get(

View file

@ -4,7 +4,7 @@ import { resolver } from "hono-openapi/zod";
import { z } from "zod"; import { z } from "zod";
import { apiRoute } from "@/api"; import { apiRoute } from "@/api";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import manifest from "~/package.json"; import manifest from "~/package.json" with { type: "json" };
export default apiRoute((app) => export default apiRoute((app) =>
app.get( app.get(

View file

@ -6,7 +6,7 @@ import { resolver } from "hono-openapi/zod";
import { apiRoute } from "@/api"; import { apiRoute } from "@/api";
import { urlToContentFormat } from "@/content_types"; import { urlToContentFormat } from "@/content_types";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import pkg from "~/package.json"; import pkg from "~/package.json" with { type: "json" };
import { InstanceMetadataSchema } from "~/packages/sdk/schemas"; import { InstanceMetadataSchema } from "~/packages/sdk/schemas";
export default apiRoute((app) => export default apiRoute((app) =>

View file

@ -6,7 +6,7 @@ import { versionPlugin } from "@clerc/plugin-version";
import { Clerc } from "clerc"; import { Clerc } from "clerc";
import { searchManager } from "~/classes/search/search-manager.ts"; import { searchManager } from "~/classes/search/search-manager.ts";
import { setupDatabase } from "~/drizzle/db.ts"; import { setupDatabase } from "~/drizzle/db.ts";
import pkg from "~/package.json"; import pkg from "~/package.json" with { type: "json" };
import { rebuildIndexCommand } from "./index/rebuild.ts"; import { rebuildIndexCommand } from "./index/rebuild.ts";
import { refetchInstanceCommand } from "./instance/refetch.ts"; import { refetchInstanceCommand } from "./instance/refetch.ts";
import { createUserCommand } from "./user/create.ts"; import { createUserCommand } from "./user/create.ts";

View file

@ -1,7 +1,7 @@
{ {
"$schema": "https://jsr.io/schema/config-file.v1.json", "$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@versia/client", "name": "@versia/client",
"version": "0.2.0-alpha.1", "version": "0.2.0-alpha.2",
"exports": { "exports": {
".": "./index.ts", ".": "./index.ts",
"./schemas": "./schemas.ts" "./schemas": "./schemas.ts"

View file

@ -1,7 +1,7 @@
{ {
"name": "@versia/client", "name": "@versia/client",
"displayName": "Versia Client", "displayName": "Versia Client",
"version": "0.2.0-alpha.1", "version": "0.2.0-alpha.2",
"author": { "author": {
"email": "jesse.wierzbinski@lysand.org", "email": "jesse.wierzbinski@lysand.org",
"name": "Jesse Wierzbinski (CPlusPatch)", "name": "Jesse Wierzbinski (CPlusPatch)",

View file

@ -102,6 +102,25 @@ export const Instance = z
.openapi({ .openapi({
description: "An image used to represent this instance.", description: "An image used to represent this instance.",
}), }),
/* Versia Server API extension */
banner: z
.object({
url: z.string().url().openapi({
description: "The URL for the banner image.",
example:
"https://files.mastodon.social/site_uploads/files/000/000/001/@1x/57c12f441d083cde.png",
}),
blurhash: z.string().optional().openapi({
description:
"A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.",
example: "UUKJMXv|x]t7^*t7Rjaz^jazRjaz",
}),
})
.optional()
.openapi({
description:
"A wide banner image used to represent this instance.",
}),
icon: z.array(InstanceIcon).openapi({ icon: z.array(InstanceIcon).openapi({
description: description:
"The list of available size variants for this instance configured icon.", "The list of available size variants for this instance configured icon.",

View file

@ -103,7 +103,7 @@ export class BaseClient {
} }
/** Overridable by testing */ /** Overridable by testing */
private fetch = fetch; private fetch = (...args: Parameters<typeof fetch>) => fetch(...args);
private async request<ReturnType>( private async request<ReturnType>(
request: Request, request: Request,

View file

@ -1,7 +1,7 @@
import { sign } from "./crypto.ts"; import { sign } from "./crypto.ts";
import { Collection, URICollection } from "./entities/collection.ts"; import { Collection, URICollection } from "./entities/collection.ts";
import type { Entity } from "./entities/entity.ts"; import type { Entity } from "./entities/entity.ts";
import { homepage, version } from "./package.json"; import { homepage, version } from "./package.json" with { type: "json" };
import { WebFingerSchema } from "./schemas/webfinger.ts"; import { WebFingerSchema } from "./schemas/webfinger.ts";
const DEFAULT_UA = `VersiaFederationClient/${version} (+${homepage})`; const DEFAULT_UA = `VersiaFederationClient/${version} (+${homepage})`;

12
packages/sdk/jsr.jsonc Normal file
View file

@ -0,0 +1,12 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@versia/sdk",
"version": "0.0.1",
"exports": {
".": "./inbox-processor.ts",
"./http": "./http.ts",
"./crypto": "./crypto.ts",
"./entities": "./entities.ts",
"./schemas": "./schemas.ts"
}
}

View file

@ -61,8 +61,6 @@ export const generateClient = async (
token?.data.accessToken, token?.data.accessToken,
); );
// @ts-expect-error This doesn't include fetch.preconnect, which is a custom property
// added by Bun
// biome-ignore lint/complexity/useLiteralKeys: Overriding private properties // biome-ignore lint/complexity/useLiteralKeys: Overriding private properties
client["fetch"] = ( client["fetch"] = (
input: RequestInfo | string | URL | Request, input: RequestInfo | string | URL | Request,

View file

@ -10,7 +10,7 @@ import { mediaQueue } from "~/classes/queues/media";
import { pushQueue } from "~/classes/queues/push"; import { pushQueue } from "~/classes/queues/push";
import { relationshipQueue } from "~/classes/queues/relationships"; import { relationshipQueue } from "~/classes/queues/relationships";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import pkg from "~/package.json"; import pkg from "~/package.json" with { type: "json" };
import type { HonoEnv } from "~/types/api"; import type { HonoEnv } from "~/types/api";
export const applyToHono = (app: Hono<HonoEnv>): void => { export const applyToHono = (app: Hono<HonoEnv>): void => {

View file

@ -1,7 +1,7 @@
import * as Sentry from "@sentry/bun"; import * as Sentry from "@sentry/bun";
import { env } from "bun"; import { env } from "bun";
import { config } from "~/config.ts"; import { config } from "~/config.ts";
import pkg from "~/package.json"; import pkg from "~/package.json" with { type: "json" };
const sentryInstance = const sentryInstance =
config.logging.sentry && config.logging.sentry &&