Fix types

This commit is contained in:
Jesse Wierzbinski 2024-04-09 16:41:55 -10:00
parent dc1b8c7447
commit 437f01f055
No known key found for this signature in database
13 changed files with 98 additions and 27 deletions

View file

@ -1,11 +1,24 @@
FROM oven/bun:alpine
FROM oven/bun:alpine as base
# Install dependencies into temp directory
# This will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# Install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
FROM base AS builder
COPY . /app
RUN cd /app && bun install
RUN cd /app && bun docs:build
RUN cd ./app && bun install
RUN cd ./app && bun docs:build
FROM oven/bun:alpine
FROM base AS final
COPY --from=builder /app/.vitepress/dist/ /app
@ -14,4 +27,7 @@ LABEL org.opencontainers.image.source "https://github.com/lysand-org/docs"
LABEL org.opencontainers.image.vendor "Lysand.org"
LABEL org.opencontainers.image.licenses "MIT"
LABEL org.opencontainers.image.title "Lysand Docs"
LABEL org.opencontainers.image.description "Documentation for Lysand"
LABEL org.opencontainers.image.description "Documentation for Lysand"
WORKDIR /app
CMD ["bun", "docs:serve"]

View file

@ -51,11 +51,17 @@ This document uses TypeScript to define the types of the entities in a clear and
```typescript
interface Entity {
id: string;
created_at: string;
uri: string;
type: string;
};
id: string;
created_at: string;
uri: string;
type: string;
extensions?: {
"org.lysand:custom_emojis"?: {
emojis: Emoji[];
};
[key: string]: object | undefined;
};
}
```
The `Entity` type is the base type for all entities in the Lysand protocol. It includes the `id`, `created_at`, `uri`, and `type` attributes.

View file

@ -40,4 +40,13 @@ This approach helps prevent potential misuse of the protocol to determine if a u
| :----- | :----- | :------- |
| author | String | Yes |
URI of the [Actor](./actors) who initiated the action.
URI of the [Actor](./actors) who initiated the action.
## Types
```typescript
interface Action extends Entity {
type: "Like" | "Dislike" | "Follow" | "FollowAccept" | "FollowReject" | "Announce" | "Undo";
author: string
}
```

View file

@ -36,9 +36,8 @@ URI of the object being announced. Must be of type [Note](./note)
## Types
```typescript
interface Announce extends Entity {
interface Announce extends Action {
type: "Announce";
author: string;
object: string;
}
```

View file

@ -35,9 +35,8 @@ URI of the object being disliked. Must be of type [Note](./note)
## Types
```typescript
interface Dislike extends Entity {
interface Dislike extends Action {
type: "Dislike";
author: string;
object: string;
}
```

View file

@ -35,9 +35,8 @@ URI of the [User](./user) who tried to follow the author
## Types
```typescript
interface FollowAccept extends Entity {
interface FollowAccept extends Action {
type: "FollowAccept";
author: string;
follower: string;
}
```

View file

@ -35,9 +35,8 @@ URI of the [User](./user) who tried to follow the author.
## Types
```typescript
interface FollowReject extends Entity {
interface FollowReject extends Action {
type: "FollowReject";
author: string;
follower: string;
}
```

View file

@ -35,9 +35,8 @@ URI of the [User](./user) who is being follow requested.
## Types
```typescript
interface Follow extends Entity {
interface Follow extends Action {
type: "Follow";
author: string;
followee: string;
}
```

View file

@ -35,9 +35,8 @@ URI of the object being liked. Must be of type [Note](./note)
## Types
```typescript
interface Like extends Entity {
interface Like extends Action {
type: "Like";
author: string;
object: string;
}
```

View file

@ -212,7 +212,7 @@ Servers **MUST** respect the visibility of the publication and **MUST NOT** show
## Types
```typescript
interface Publication {
interface Publication extends Entity {
type: "Note" | "Patch";
author: string;
content?: ContentFormat;
@ -223,6 +223,19 @@ interface Publication {
subject?: string;
is_sensitive?: boolean;
visibility: Visibility;
extensions?: Entity["extensions"] & {
"org.lysand:reactions"?: {
reactions: string;
};
"org.lysand:polls"?: {
poll: {
options: ContentFormat[];
votes: number[];
multiple_choice?: boolean;
expires_at: string;
};
};
};
}
```

View file

@ -151,4 +151,24 @@ Clients should display the most modern format that they support, such as WebP, A
| :------------------- | :-------------- | :----------------------------- |
| supported_extensions | Array of String | Yes, can be empty array (`[]`) |
List of extension names that the server supports, in namespaced format (`"org.lysand:reactions"`).
List of extension names that the server supports, in namespaced format (`"org.lysand:reactions"`).
## Types
```typescript
interface ServerMetadata {
type: "ServerMetadata";
name: string;
version: string;
description?: string;
website?: string;
moderators?: string[];
admins?: string[];
logo?: ContentFormat;
banner?: ContentFormat;
supported_extensions: string[];
extensions?: {
[key: string]: object | undefined;
};
}
```

View file

@ -40,4 +40,14 @@ URI of the [Actor](./actors) who initiated the action.
| :----- | :----- | :------- |
| object | String | Yes |
URI of the object being undone. The object **MUST** be an [Action](./actions) or a [Note](./note). To undo [Patch](./patch) objects, use a subsequent [Patch](./patch) or delete the original [Note](./note).
URI of the object being undone. The object **MUST** be an [Action](./actions) or a [Note](./note). To undo [Patch](./patch) objects, use a subsequent [Patch](./patch) or delete the original [Note](./note).
## Types
```typescript
interface Undo extends Entity {
type: "Undo";
author: string;
object: string;
}
```

View file

@ -332,6 +332,9 @@ interface User extends Entity {
dislikes: string;
inbox: string;
outbox: string;
extensions?: Entity["extensions"] & {
"org.lysand:vanity"?: VanityExtension;
};
}
```