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 COPY . /app
RUN cd /app && bun install
RUN cd /app && bun docs:build
RUN cd ./app && bun install FROM base AS final
RUN cd ./app && bun docs:build
FROM oven/bun:alpine
COPY --from=builder /app/.vitepress/dist/ /app COPY --from=builder /app/.vitepress/dist/ /app
@ -15,3 +28,6 @@ LABEL org.opencontainers.image.vendor "Lysand.org"
LABEL org.opencontainers.image.licenses "MIT" LABEL org.opencontainers.image.licenses "MIT"
LABEL org.opencontainers.image.title "Lysand Docs" 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

@ -55,7 +55,13 @@ interface Entity {
created_at: string; created_at: string;
uri: string; uri: string;
type: 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. 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

@ -41,3 +41,12 @@ This approach helps prevent potential misuse of the protocol to determine if a u
| author | String | Yes | | 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 ## Types
```typescript ```typescript
interface Announce extends Entity { interface Announce extends Action {
type: "Announce"; type: "Announce";
author: string;
object: string; object: string;
} }
``` ```

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -212,7 +212,7 @@ Servers **MUST** respect the visibility of the publication and **MUST NOT** show
## Types ## Types
```typescript ```typescript
interface Publication { interface Publication extends Entity {
type: "Note" | "Patch"; type: "Note" | "Patch";
author: string; author: string;
content?: ContentFormat; content?: ContentFormat;
@ -223,6 +223,19 @@ interface Publication {
subject?: string; subject?: string;
is_sensitive?: boolean; is_sensitive?: boolean;
visibility: Visibility; 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

@ -152,3 +152,23 @@ Clients should display the most modern format that they support, such as WebP, A
| supported_extensions | Array of String | Yes, can be empty array (`[]`) | | 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

@ -41,3 +41,13 @@ URI of the [Actor](./actors) who initiated the action.
| object | String | Yes | | 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; dislikes: string;
inbox: string; inbox: string;
outbox: string; outbox: string;
extensions?: Entity["extensions"] & {
"org.lysand:vanity"?: VanityExtension;
};
} }
``` ```