mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Compare commits
6 commits
0551b8e12d
...
8c0a20a743
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c0a20a743 | ||
|
|
6d85dbdfcb | ||
|
|
77cd27a458 | ||
|
|
e5e688a154 | ||
|
|
fa5be6bd6a | ||
|
|
bf9840bd14 |
48
.github/workflows/publish.yml
vendored
Normal file
48
.github/workflows/publish.yml
vendored
Normal 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
|
||||||
11
.github/workflows/test-publish.yml
vendored
11
.github/workflows/test-publish.yml
vendored
|
|
@ -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 }}
|
||||||
|
|
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -8,7 +8,9 @@
|
||||||
"config",
|
"config",
|
||||||
"plugin",
|
"plugin",
|
||||||
"worker",
|
"worker",
|
||||||
"media"
|
"media",
|
||||||
|
"packages/client",
|
||||||
|
"packages/sdk"
|
||||||
],
|
],
|
||||||
"languageToolLinter.languageTool.ignoredWordsInWorkspace": ["versia"]
|
"languageToolLinter.languageTool.ignoredWordsInWorkspace": ["versia"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
|
|
@ -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) =>
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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)",
|
||||||
|
|
|
||||||
|
|
@ -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.",
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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
12
packages/sdk/jsr.jsonc
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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 => {
|
||||||
|
|
|
||||||
|
|
@ -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 &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue