mirror of
https://github.com/versia-pub/api.git
synced 2026-03-12 20:09:14 +01:00
refactor: 🚚 Rename Lysand to Versia
This commit is contained in:
parent
5b119949dc
commit
c9f4885c72
27 changed files with 112 additions and 112 deletions
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Lysand
|
||||
Copyright (c) 2024 Versia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<a href="https://lysand.org"><img src="https://cdn.lysand.org/logo-long-dark.webp" alt="Lysand Logo" height="110"></a>
|
||||
</p>
|
||||
|
||||
<center><h1><code>@lysand-org/federation</code></h1></center>
|
||||
<center><h1><code>@versia/federation</code></h1></center>
|
||||
|
||||
Federation types, validators and cryptography for Lysand server implementations.
|
||||
Federation types, validators and cryptography for Versia server implementations.
|
||||
|
||||
## Efficiency
|
||||
|
||||
The built output of the package is not even `200 KB` in size, making it a lightweight and efficient solution for your Lysand needs. Installing the package adds around `5 MB` to your `node_modules` folder, but this does not affect the final bundle size.
|
||||
The built output of the package is not even `200 KB` in size, making it a lightweight and efficient solution for your Versia needs. Installing the package adds around `5 MB` to your `node_modules` folder, but this does not affect the final bundle size.
|
||||
|
||||
Compilation (bundling/minifying) time is a few seconds, almost all of which is spent on type-checking. The actual compilation time is less than a tenth of a second.
|
||||
|
||||
|
|
@ -18,10 +18,10 @@ Compilation (bundling/minifying) time is a few seconds, almost all of which is s
|
|||
|
||||
#### Validation
|
||||
|
||||
[**Zod**](https://zod.dev) is used to validate and parse the objects. All Lysand objects are already written for you.
|
||||
[**Zod**](https://zod.dev) is used to validate and parse the objects. All Versia entities are already written for you.
|
||||
|
||||
```typescript
|
||||
import { EntityValidator, type ValidationError } from "@lysand-org/federation";
|
||||
import { EntityValidator, type ValidationError } from "@versia/federation";
|
||||
|
||||
const validator = new EntityValidator();
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ try {
|
|||
}
|
||||
|
||||
// Types are also included for TypeScript users that don't use the extracted ones
|
||||
import type { Note } from "@lysand-org/federation/types";
|
||||
import type { Note } from "@versia/federation/types";
|
||||
|
||||
const validNoteObject: Note = {
|
||||
type: "Note",
|
||||
|
|
@ -50,14 +50,14 @@ const validNote = await validator.Note(validNoteObject);
|
|||
// validNote is still the same as noteObject
|
||||
```
|
||||
|
||||
Your editor's IntelliSense should provide you with every method and property available, which all match the [**Lysand**](https://lysand.org) specification names.
|
||||
Your editor's IntelliSense should provide you with every method and property available, which all match the [**Versia**](https://versia.pub) specification names.
|
||||
|
||||
#### Requester
|
||||
|
||||
A `FederationRequester` class is provided to make requests to a remote server. It sets the correct headers and has multiple methods to make requesters easier.
|
||||
|
||||
```typescript
|
||||
import { FederationRequester, SignatureConstructor } from "@lysand-org/federation";
|
||||
import { FederationRequester, SignatureConstructor } from "@versia/federation";
|
||||
|
||||
const requester = new FederationRequester(
|
||||
new URL("https://example.com"),
|
||||
|
|
@ -217,18 +217,18 @@ We strongly recommend using JSR over NPM for all your packages that are availabl
|
|||
|
||||
```bash
|
||||
# NPM version
|
||||
deno add npm:@lysand-org/federation # For Deno
|
||||
npm install @lysand-org/federation # For NPM
|
||||
yarn add @lysand-org/federation # For Yarn
|
||||
pnpm add @lysand-org/federation # For PNPM
|
||||
bun add @lysand-org/federation # For Bun
|
||||
deno add npm:@versia/federation # For Deno
|
||||
npm install @versia/federation # For NPM
|
||||
yarn add @versia/federation # For Yarn
|
||||
pnpm add @versia/federation # For PNPM
|
||||
bun add @versia/federation # For Bun
|
||||
|
||||
# JSR version
|
||||
deno add @lysand-org/federation # For Deno
|
||||
npx jsr add @lysand-org/federation # For JSR
|
||||
yarn dlx jsr add @lysand-org/federation # For Yarn
|
||||
pnpm dlx jsr add @lysand-org/federation # For PNPM
|
||||
bunx jsr add @lysand-org/federation # For Bun
|
||||
deno add @versia/federation # For Deno
|
||||
npx jsr add @versia/federation # For JSR
|
||||
yarn dlx jsr add @versia/federation # For Yarn
|
||||
pnpm dlx jsr add @versia/federation # For PNPM
|
||||
bunx jsr add @versia/federation # For Bun
|
||||
```
|
||||
|
||||
#### From Source
|
||||
|
|
@ -257,4 +257,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|||
|
||||
### People
|
||||
|
||||
- [**April John**](https://github.com/cutestnekoaqua): Creator and maintainer of the Lysand Server ActivityPub bridge.
|
||||
- [**April John**](https://github.com/cutestnekoaqua): Creator and maintainer of the Versia Server ActivityPub bridge.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const checkEvironmentSupport = () => {
|
|||
|
||||
/**
|
||||
* Validates the signature of a request.
|
||||
* @see https://lysand.org/security/signing
|
||||
* @see https://versia.pub/signatures
|
||||
*/
|
||||
export class SignatureValidator {
|
||||
/**
|
||||
|
|
@ -67,7 +67,7 @@ export class SignatureValidator {
|
|||
* @returns A Promise that resolves to a boolean indicating whether the signature is valid.
|
||||
* @throws TypeError if any required headers are missing in the request.
|
||||
* @example
|
||||
* const request = new Request(); // Should be a Request from a Lysand federation request
|
||||
* const request = new Request(); // Should be a Request from a Versia federation request
|
||||
* const isValid = await validator.validate(request);
|
||||
*/
|
||||
async validate(request: Request): Promise<boolean>;
|
||||
|
|
@ -187,7 +187,7 @@ export class SignatureValidator {
|
|||
|
||||
/**
|
||||
* Constructs a signature for a request.
|
||||
* @see https://lysand.org/security/signing
|
||||
* @see https://versia.pub/signatures
|
||||
*/
|
||||
export class SignatureConstructor {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const validUser = {
|
|||
extensions: { "org.lysand:custom_emojis": { emojis: [] } },
|
||||
};
|
||||
|
||||
describe("LysandRequestHandler", () => {
|
||||
describe("RequestParserHandler", () => {
|
||||
let validator: EntityValidator;
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://jsr.io/schema/config-file.v1.json",
|
||||
"name": "@lysand-org/federation",
|
||||
"name": "@versia/federation",
|
||||
"version": "0.0.0",
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lysand-org/federation",
|
||||
"displayName": "Lysand Federation",
|
||||
"name": "@versia/federation",
|
||||
"displayName": "Versia Federation",
|
||||
"version": "0.0.0",
|
||||
"author": {
|
||||
"email": "jesse.wierzbinski@lysand.org",
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
"url": "https://cpluspatch.com"
|
||||
}
|
||||
],
|
||||
"description": "Type definitions for Lysand Federation, with validators.",
|
||||
"description": "SDK for Versia implementations.",
|
||||
"categories": ["Other"],
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
|
@ -53,9 +53,9 @@
|
|||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/lysand"
|
||||
},
|
||||
"homepage": "https://lysand.org",
|
||||
"homepage": "https://versia.pub",
|
||||
"keywords": [
|
||||
"lysand",
|
||||
"versia",
|
||||
"federation",
|
||||
"api",
|
||||
"typescript",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import pkg from "../package.json" with { type: "json" };
|
||||
|
||||
export const DEFAULT_UA = `LysandFederation/${pkg.version} (+${pkg.homepage})`;
|
||||
export const DEFAULT_UA = `VersiaFederation/${pkg.version} (+${pkg.homepage})`;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Custom emojis extension.
|
||||
* @module federation/schemas/extensions/custom_emojis
|
||||
* @see module:federation/schemas/base
|
||||
* @see https://lysand.org/extensions/custom-emojis
|
||||
* @see https://versia.pub/extensions/custom-emojis
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { ContentFormatSchema } from "../content_format";
|
||||
|
|
@ -10,7 +10,7 @@ import { emojiRegex } from "../regex";
|
|||
|
||||
/**
|
||||
* @description Used to validate the properties the extension's custom field
|
||||
* @see https://lysand.org/extensions/custom-emojis
|
||||
* @see https://versia.pub/extensions/custom-emojis
|
||||
* @example
|
||||
* {
|
||||
* // ...
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Polls extension
|
||||
* @module federation/schemas/extensions/polls
|
||||
* @see module:federation/schemas/base
|
||||
* @see https://lysand.org/extensions/polls
|
||||
* @see https://versia.pub/extensions/polls
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { ExtensionSchema } from "../base";
|
||||
|
|
@ -10,7 +10,7 @@ import { ContentFormatSchema } from "../content_format";
|
|||
|
||||
/**
|
||||
* @description Poll extension entity
|
||||
* @see https://lysand.org/extensions/polls
|
||||
* @see https://versia.pub/extensions/polls
|
||||
* @example
|
||||
* {
|
||||
* "type": "Extension",
|
||||
|
|
@ -53,7 +53,7 @@ export const PollSchema = ExtensionSchema.extend({
|
|||
|
||||
/**
|
||||
* @description Vote extension entity
|
||||
* @see https://lysand.org/extensions/polls
|
||||
* @see https://versia.pub/extensions/polls
|
||||
* @example
|
||||
* {
|
||||
* "type": "Extension",
|
||||
|
|
@ -73,7 +73,7 @@ export const VoteSchema = ExtensionSchema.extend({
|
|||
|
||||
/**
|
||||
* @description Vote result extension entity
|
||||
* @see https://lysand.org/extensions/polls
|
||||
* @see https://versia.pub/extensions/polls
|
||||
* @example
|
||||
* {
|
||||
* "type": "Extension",
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
* Reactions extension
|
||||
* @module federation/schemas/extensions/reactions
|
||||
* @see module:federation/schemas/base
|
||||
* @see https://lysand.org/extensions/reactions
|
||||
* @see https://versia.pub/extensions/reactions
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { ExtensionSchema } from "../base";
|
||||
|
||||
/**
|
||||
* @description Reaction extension entity
|
||||
* @see https://lysand.org/extensions/reactions
|
||||
* @see https://versia.pub/extensions/reactions
|
||||
* @example
|
||||
* {
|
||||
* "type": "Extension",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Vanity extension schema.
|
||||
* @module federation/schemas/extensions/vanity
|
||||
* @see module:federation/schemas/base
|
||||
* @see https://lysand.org/extensions/vanity
|
||||
* @see https://versia.pub/extensions/vanity
|
||||
*/
|
||||
|
||||
import { z } from "zod";
|
||||
|
|
@ -10,7 +10,7 @@ import { ContentFormatSchema } from "../content_format";
|
|||
|
||||
/**
|
||||
* @description Vanity extension entity
|
||||
* @see https://lysand.org/extensions/vanity
|
||||
* @see https://versia.pub/extensions/vanity
|
||||
* @example
|
||||
* {
|
||||
* // ...
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ type InferType<T extends AnyZod> = z.infer<T>;
|
|||
* @module federation/validator
|
||||
* @see module:federation/schemas/base
|
||||
* @example
|
||||
* import { EntityValidator, type ValidationError } from "@lysand-org/federation";
|
||||
* import { EntityValidator, type ValidationError } from "@versia/federation";
|
||||
* const validator = new EntityValidator();
|
||||
*
|
||||
* // Will throw a special ValidationError with a human-friendly error message
|
||||
|
|
@ -54,7 +54,7 @@ type InferType<T extends AnyZod> = z.infer<T>;
|
|||
* }
|
||||
*
|
||||
* // Types are also included for TypeScript users that don't use the extracted ones
|
||||
* import type { Note } from "@lysand-org/federation/types";
|
||||
* import type { Note } from "@versia/federation/types";
|
||||
*
|
||||
* const note: Note = {
|
||||
* ...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue