forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Initial implementation of sets api on ozone * ✨ Introduce sortDirection to querySets * 🧹 Cleanup and refactor * ✨ Align setView for response * ♻️ Rename and add specific error * 🐛 Cleanup unnecessary check that is covered by lexicon * ✨ Rename remove to delete and add set suffix * ✨ Use id and createdAt for values pagination * ✨ Add index on createdAt for query perf and other cleanups * 🐛 Set createdAt when inserting values * 📝 Add changeset * ✨ Add index on setId and createdAt
- Loading branch information
Showing
51 changed files
with
3,212 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@atproto/ozone": patch | ||
"@atproto/api": patch | ||
--- | ||
|
||
Sets api to manage lists of strings on ozone, mostly aimed for automod configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.addValues", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Add values to a specific set. Attempting to add values to a set that does not exist will result in an error.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["name", "values"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Name of the set to add values to" | ||
}, | ||
"values": { | ||
"type": "array", | ||
"minLength": 1, | ||
"maxLength": 1000, | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "Array of string values to add to the set" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.defs", | ||
"defs": { | ||
"set": { | ||
"type": "object", | ||
"required": ["name"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"minLength": 3, | ||
"maxLength": 128 | ||
}, | ||
"description": { | ||
"type": "string", | ||
"maxGraphemes": 1024, | ||
"maxLength": 10240 | ||
} | ||
} | ||
}, | ||
"setView": { | ||
"type": "object", | ||
"required": ["name", "setSize", "createdAt", "updatedAt"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"minLength": 3, | ||
"maxLength": 128 | ||
}, | ||
"description": { | ||
"type": "string", | ||
"maxGraphemes": 1024, | ||
"maxLength": 10240 | ||
}, | ||
"setSize": { | ||
"type": "integer" | ||
}, | ||
"createdAt": { | ||
"type": "string", | ||
"format": "datetime" | ||
}, | ||
"updatedAt": { | ||
"type": "string", | ||
"format": "datetime" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.deleteSet", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Delete an entire set. Attempting to delete a set that does not exist will result in an error.", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["name"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Name of the set to delete" | ||
} | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"properties": {} | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "SetNotFound", | ||
"description": "set with the given name does not exist" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.deleteValues", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["name", "values"], | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Name of the set to delete values from" | ||
}, | ||
"values": { | ||
"type": "array", | ||
"minLength": 1, | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "Array of string values to delete from the set" | ||
} | ||
} | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "SetNotFound", | ||
"description": "set with the given name does not exist" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.getValues", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Get a specific set and its values", | ||
"parameters": { | ||
"type": "params", | ||
"required": ["name"], | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 1000, | ||
"default": 100 | ||
}, | ||
"cursor": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["set", "values"], | ||
"properties": { | ||
"set": { | ||
"type": "ref", | ||
"ref": "tools.ozone.set.defs#setView" | ||
}, | ||
"values": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"cursor": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"errors": [ | ||
{ | ||
"name": "SetNotFound", | ||
"description": "set with the given name does not exist" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.querySets", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Query available sets", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 100, | ||
"default": 50 | ||
}, | ||
"cursor": { | ||
"type": "string" | ||
}, | ||
"namePrefix": { | ||
"type": "string" | ||
}, | ||
"sortBy": { | ||
"type": "string", | ||
"enum": ["name", "createdAt", "updatedAt"], | ||
"default": "name" | ||
}, | ||
"sortDirection": { | ||
"type": "string", | ||
"default": "asc", | ||
"enum": ["asc", "desc"], | ||
"description": "Defaults to ascending order of name field." | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["sets"], | ||
"properties": { | ||
"sets": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "tools.ozone.set.defs#setView" | ||
} | ||
}, | ||
"cursor": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "tools.ozone.set.upsertSet", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Create or update set metadata", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "tools.ozone.set.defs#set" | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "ref", | ||
"ref": "tools.ozone.set.defs#setView" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.