refactor: 🔥 Remove id property from transient entities

This commit is contained in:
Jesse Wierzbinski 2025-05-13 15:04:30 +02:00
parent e56b1c407d
commit e138e9e7c3
No known key found for this signature in database
10 changed files with 8 additions and 20 deletions

View file

@ -41,7 +41,6 @@ Having the authorization is defined as:
```jsonc {{ title: 'Example Delete' }}
{
"type": "Delete",
"id": "9b3212b8-529c-435a-8798-09ebbc17ca74",
"created_at": "2021-01-01T00:00:00.000Z",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"deleted_type": "Note",

View file

@ -32,7 +32,6 @@ export const metadata = {
```jsonc {{ title: 'Example FollowAccept' }}
{
"type": "FollowAccept",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"created_at": "2021-01-01T00:00:00.000Z",
"follower": "example.com:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"

View file

@ -42,7 +42,6 @@ But it can also be used when Bob is already following Alice, in the case that:
```jsonc {{ title: 'Example FollowReject' }}
{
"type": "FollowReject",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"created_at": "2021-01-01T00:00:00.000Z",
"follower": "example.com:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"

View file

@ -74,7 +74,6 @@ Once a follow relationship is established, the **followee**'s instance should se
```jsonc {{ title: 'Example Follow' }}
{
"type": "Follow",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"created_at": "2021-01-01T00:00:00.000Z",
"followee": "example.com:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"

View file

@ -25,6 +25,8 @@ Any field in an entity not marked as `required` may be omitted or set to `null`.
- `A-Z`
- `0-9`
- `-`, `_`
Not present on [Transient Entities](#transient-entities).
</Property>
<Property name="type" type="string" required={true}>
Type of the entity. Custom types must follow [Extension Naming](/extensions#naming).
@ -54,11 +56,11 @@ Any field in an entity not marked as `required` may be omitted or set to `null`.
```jsonc {{ 'title': 'Example Entity' }}
{
"id": "9a8928b6-2526-4979-aab1-ef2f88cd5700",
"type": "Delete",
"created_at": "2022-01-01T12:00:00Z",
"author": "63a00ab3-39b1-49eb-b88e-ed65d2361f3e",
"deleted": "54059ce2-9332-46fa-bf6a-598b5493b81b",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"type": "pub.versia:likes/Like",
"created_at": "2021-01-01T00:00:00.000Z",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"liked": "otherexample.org:fmKZ763jzIU8"
}
```
@ -84,7 +86,7 @@ Any field in an entity not marked as `required` may be omitted or set to `null`.
## Transient Entities
Some entities are transient, meaning they cannot be refetched using the [Federation API](/api/endpoints). These entities are used for actions that do not require a permanent record, such as deletions or migrations.
Some entities are transient, meaning they cannot be refetched using the [Federation API](/api/endpoints). These entities are used for actions that do not require a permanent record, such as deletions or migrations. Transient Entities do not have an `id` field.
Implementations **must not** rely on other implementations to store transient entities in their database.

View file

@ -47,7 +47,6 @@ Sometimes, [Users](/entities/user) want to unsubscribe from each other to stop s
```jsonc {{ title: 'Example Unfollow' }}
{
"type": "Unfollow",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe",
"created_at": "2021-01-01T00:00:00.000Z",
"followee": "example.com:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"

View file

@ -107,7 +107,6 @@ Indicates that a [User](/entities/user) wishes to subscribe to a group.
```jsonc {{ title: "Example GroupSubscribe" }}
{
"type": "pub.versia:groups/Subscribe",
"id": "9a7e9345-4e4a-4d5a-8301-4dbbfe777ca0",
"subscriber": "e9277471-8aa1-4d40-a3d0-0878e818ccdc",
"group": "example.com:ed480922-b095-4f09-9da5-c995be8f5960",
"created_at": "2021-01-01T00:00:00Z"
@ -145,7 +144,6 @@ Indicates that a [User](/entities/user) wishes to unsubscribe from a group.
```jsonc {{ title: "Example GroupUnsubscribe" }}
{
"type": "pub.versia:groups/Unsubscribe",
"id": "9a7e9345-4e4a-4d5a-8301-4dbbfe777ca0",
"subscriber": "e9277471-8aa1-4d40-a3d0-0878e818ccdc",
"group": "example.com:ed480922-b095-4f09-9da5-c995be8f5960",
"created_at": "2021-01-01T00:00:00Z"
@ -183,7 +181,6 @@ Indicates that a [Group](#entity-definition) has accepted a [User](/entities/use
```jsonc {{ title: "Example GroupSubscribeAccept" }}
{
"type": "pub.versia:groups/SubscribeAccept",
"id": "9a7e9345-4e4a-4d5a-8301-4dbbfe777ca0",
"subscriber": "e9277471-8aa1-4d40-a3d0-0878e818ccdc",
"group": "example.com:ed480922-b095-4f09-9da5-c995be8f5960",
"created_at": "2021-01-01T00:00:00Z"
@ -221,7 +218,6 @@ Indicates that a [Group](#entity-definition) has rejected a [User](/entities/use
```jsonc {{ title: "Example GroupSubscribeReject" }}
{
"type": "pub.versia:groups/SubscribeReject",
"id": "9a7e9345-4e4a-4d5a-8301-4dbbfe777ca0",
"subscriber": "e9277471-8aa1-4d40-a3d0-0878e818ccdc",
"group": "example.com:ed480922-b095-4f09-9da5-c995be8f5960",
"created_at": "2021-01-01T00:00:00Z"
@ -267,7 +263,6 @@ The `GroupFederate` entity allows a group to federate a note to all of its membe
```jsonc {{ title: "Example GroupFederate" }}
{
"type": "pub.versia:groups/Federate",
"id": "9a7e9345-4e4a-4d5a-8301-4dbbfe777ca0",
"note": "c5aa65fa-0356-4029-b61c-6b237e5d1393",
"group": "example.com:ed480922-b095-4f09-9da5-c995be8f5960",
"created_at": "2021-01-01T00:00:00Z"

View file

@ -53,7 +53,6 @@ Migration happens in three steps:
```json {{ title: "Example Entity" }}
{
"id": "016f3de2-ad63-4e06-999e-1e6b41c981c5",
"type": "pub.versia:migration/Migration",
"author": "44df6e02-ef43-47e0-aff2-47041f3d09ed",
"created_at": "2021-01-01T00:00:00.000Z",

View file

@ -40,7 +40,6 @@ When an instance receives a report, it *should* be reviewed by a moderator or ad
```jsonc {{ title: "Example Report" }}
{
"id": "6f3001a1-641b-4763-a9c4-a089852eec84",
"type": "pub.versia:reports/Report",
"author": "6f3001a1-641b-4763-a9c4-a089852eec84",
"reported": [

View file

@ -29,7 +29,6 @@ These two examples are equivalent if the instance is `example.com`:
```jsonc
{
"type": "Follow",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "6e0204a2-746c-4972-8602-c4f37fc63bbe", // [!code focus]
"created_at": "2021-01-01T00:00:00.000Z",
"followee": "test.org:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"
@ -39,7 +38,6 @@ These two examples are equivalent if the instance is `example.com`:
```jsonc
{
"type": "Follow",
"id": "3e7e4750-afd4-4d99-a256-02f0710a0520",
"author": "example.com:6e0204a2-746c-4972-8602-c4f37fc63bbe", // [!code focus]
"created_at": "2021-01-01T00:00:00.000Z",
"followee": "test.org:02e1e3b2-cb1f-4e4a-b82e-98866bee5de7"