Resubmit of #3 (Add schema for Lexicon-defined API) #4

closed
opened by hexmani.ac targeting main from lexicons-extension

This is a resubmission of the pull request, as there seems to be an error when resubmitting.

Original message: This will build the foundations for a basic Lexicon-defined API to be used by the backend. Right now I'm focusing solely on implementing ways to get indexed content from the database as well as a basic "preferences" system similar to was Bluesky has, mainly for expanding private preferences in the future once we move to the frontend. There are also some search query lexicons in there, just for good measure.

+27
.idea/jsonSchemas.xml
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <project version="4"> 3 + <component name="JsonSchemaMappingsProjectConfiguration"> 4 + <state> 5 + <map> 6 + <entry key="Lexicon Schema"> 7 + <value> 8 + <SchemaInfo> 9 + <option name="generatedName" value="New Schema" /> 10 + <option name="name" value="Lexicon Schema" /> 11 + <option name="relativePathToSchema" value="https://cdn.justdavi.dev/lexiconschema.json" /> 12 + <option name="patterns"> 13 + <list> 14 + <Item> 15 + <option name="directory" value="true" /> 16 + <option name="path" value="lexdocs" /> 17 + <option name="mappingKind" value="Directory" /> 18 + </Item> 19 + </list> 20 + </option> 21 + </SchemaInfo> 22 + </value> 23 + </entry> 24 + </map> 25 + </state> 26 + </component> 27 + </project>
+3 -3
backend/README.md
··· 24 24 ## current status 25 25 26 26 right now we're not running on bun because there are 27 - [some issues with partysocket](https://github.com/oven-sh/bun/issues/18807), which haven't 28 - been fixed yet and which the jetstream library we use depends on for the moment. once it has been fixed, we do plan 29 - to use bun over node in the future. 27 + [some issues with partysocket](https://github.com/oven-sh/bun/issues/18807), which haven't been 28 + fixed yet and which the jetstream library we use depends on for the moment. once it has been fixed, 29 + we do plan to use bun over node in the future. 30 30 31 31 ### checklist before it's usable 32 32
+4 -3
lexdocs/social/clippr/actor/getPreferences.json
··· 4 4 "defs": { 5 5 "main": { 6 6 "type": "query", 7 - "description": "Get the private user preferences associated to the account.", 7 + "description": "Get the private user preferences associated to the account.", 8 8 "parameters": { 9 9 "type": "params", 10 10 "properties": {} ··· 19 19 "properties": { 20 20 "preferences": { 21 21 "type": "ref", 22 - "ref": "social.clippr.actor.defs#preferences" 22 + "ref": "social.clippr.actor.defs#preferences", 23 + "description": "A ref to the user's preferences" 23 24 } 24 25 } 25 26 } 26 27 } 27 28 } 28 29 } 29 - } 30 + }
+29 -28
lexdocs/social/clippr/actor/getProfile.json
··· 1 1 { 2 - "lexicon": 1, 3 - "id": "social.clippr.actor.getProfile", 4 - "defs": { 5 - "main": { 6 - "type": "query", 7 - "description": "Get profile view of an actor. Does not require auth.", 8 - "parameters": { 9 - "type": "params", 10 - "required": [ 11 - "actor" 12 - ], 13 - "properties": { 14 - "actor": { 15 - "type": "string", 16 - "format": "at-identifier", 17 - "description": "Handle or DID of account to fetch profile of." 18 - } 19 - } 20 - }, 21 - "output": { 22 - "encoding": "application/json", 23 - "schema": { 24 - "type": "ref", 25 - "ref": "social.clippr.actor.defs#profileView" 26 - } 27 - } 28 - } 29 - } 2 + "lexicon": 1, 3 + "id": "social.clippr.actor.getProfile", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Get profile view of an actor. Does not require auth.", 8 + "parameters": { 9 + "type": "params", 10 + "required": [ 11 + "actor" 12 + ], 13 + "properties": { 14 + "actor": { 15 + "type": "string", 16 + "format": "at-identifier", 17 + "description": "Handle or DID of account to fetch profile of" 18 + } 19 + } 20 + }, 21 + "output": { 22 + "encoding": "application/json", 23 + "schema": { 24 + "type": "ref", 25 + "ref": "social.clippr.actor.defs#profileView", 26 + "description": "A reference to the profile view of the actor" 27 + } 28 + } 29 + } 30 + } 30 31 }
+46 -45
lexdocs/social/clippr/actor/profile.json
··· 1 1 { 2 - "lexicon": 1, 3 - "id": "social.clippr.actor.profile", 4 - "defs": { 5 - "main": { 6 - "type": "record", 7 - "description": "A declaration of a Clippr account's profile.", 8 - "key": "literal:self", 9 - "record": { 10 - "type": "object", 11 - "required": [ 12 - "createdAt", 13 - "displayName" 14 - ], 15 - "properties": { 16 - "displayName": { 17 - "type": "string", 18 - "description": "A display name to be shown on a profile.", 19 - "minGraphemes": 1, 20 - "minLength": 10, 21 - "maxGraphemes": 64, 22 - "maxLength": 640 23 - }, 24 - "description": { 25 - "type": "string", 26 - "description": "Text for user to describe themselves", 27 - "maxGraphemes": 500, 28 - "maxLength": 5000 29 - }, 30 - "avatar": { 31 - "type": "blob", 32 - "description": "Image to show on user's profiles.", 33 - "accept": [ 34 - "image/png", 35 - "image/jpeg" 36 - ], 37 - "maxSize": 1000000 38 - }, 39 - "createdAt": { 40 - "type": "string", 41 - "format": "datetime" 42 - } 43 - } 44 - } 45 - } 46 - } 2 + "lexicon": 1, 3 + "id": "social.clippr.actor.profile", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A declaration of a Clippr account's profile.", 8 + "key": "literal:self", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "createdAt", 13 + "displayName" 14 + ], 15 + "properties": { 16 + "displayName": { 17 + "type": "string", 18 + "description": "A display name to be shown on a profile", 19 + "minGraphemes": 1, 20 + "minLength": 10, 21 + "maxGraphemes": 64, 22 + "maxLength": 640 23 + }, 24 + "description": { 25 + "type": "string", 26 + "description": "Text for user to describe themselves", 27 + "maxGraphemes": 500, 28 + "maxLength": 5000 29 + }, 30 + "avatar": { 31 + "type": "blob", 32 + "description": "Image to show on user's profiles", 33 + "accept": [ 34 + "image/png", 35 + "image/jpeg" 36 + ], 37 + "maxSize": 1000000 38 + }, 39 + "createdAt": { 40 + "type": "string", 41 + "format": "datetime", 42 + "description": "The creation date of the profile" 43 + } 44 + } 45 + } 46 + } 47 + } 47 48 }
+6 -3
lexdocs/social/clippr/actor/putPreferences.json
··· 9 9 "encoding": "application/json", 10 10 "schema": { 11 11 "type": "object", 12 - "required": ["preferences"], 12 + "required": [ 13 + "preferences" 14 + ], 13 15 "properties": { 14 16 "preferences": { 15 17 "type": "ref", 16 - "ref": "social.clippr.actor.defs#preferences" 18 + "ref": "social.clippr.actor.defs#preferences", 19 + "description": "A ref to the user's preferences" 17 20 } 18 21 } 19 22 } 20 23 } 21 24 } 22 25 } 23 - } 26 + }
+51 -42
lexdocs/social/clippr/actor/searchProfiles.json
··· 1 1 { 2 - "lexicon": 1, 3 - "id": "social.clippr.actor.searchProfiles", 4 - "defs": { 5 - "main": { 6 - "type": "query", 7 - "description": "Find profiles matching search criteria. Does not require auth.", 8 - "parameters": { 9 - "type": "params", 10 - "properties": { 11 - "q": { 12 - "type": "string", 13 - "description": "Search query string." 14 - }, 15 - "limit": { 16 - "type": "integer", 17 - "minimum": 1, 18 - "maximum": 100, 19 - "default": 25 20 - }, 21 - "cursor": { "type": "string" } 22 - } 23 - }, 24 - "output": { 25 - "encoding": "application/json", 26 - "schema": { 27 - "type": "object", 28 - "required": ["actors"], 29 - "properties": { 30 - "cursor": { "type": "string" }, 31 - "actors": { 32 - "type": "array", 33 - "items": { 34 - "type": "ref", 35 - "ref": "social.clippr.actor.defs#profileView" 36 - } 37 - } 38 - } 39 - } 40 - } 41 - } 42 - } 43 - } 2 + "lexicon": 1, 3 + "id": "social.clippr.actor.searchProfiles", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Find profiles matching search criteria. Does not require auth.", 8 + "parameters": { 9 + "type": "params", 10 + "properties": { 11 + "q": { 12 + "type": "string", 13 + "description": "Search query string" 14 + }, 15 + "limit": { 16 + "type": "integer", 17 + "minimum": 1, 18 + "maximum": 100, 19 + "default": 25, 20 + "description": "The number of profiles to be returned in the query" 21 + }, 22 + "cursor": { 23 + "type": "string", 24 + "description": "A parameter used for pagination" 25 + } 26 + } 27 + }, 28 + "output": { 29 + "encoding": "application/json", 30 + "schema": { 31 + "type": "object", 32 + "required": [ 33 + "actors" 34 + ], 35 + "properties": { 36 + "cursor": { 37 + "type": "string", 38 + "description": "A parameter used for pagination" 39 + }, 40 + "actors": { 41 + "type": "array", 42 + "items": { 43 + "type": "ref", 44 + "ref": "social.clippr.actor.defs#profileView" 45 + } 46 + } 47 + } 48 + } 49 + } 50 + } 51 + } 52 + }
+86 -86
lexdocs/social/clippr/feed/clip.json
··· 1 1 { 2 - "lexicon": 1, 3 - "id": "social.clippr.feed.clip", 4 - "defs": { 5 - "main": { 6 - "type": "record", 7 - "description": "Record containing a bookmark item, or 'clip'.", 8 - "key": "any", 9 - "record": { 10 - "type": "object", 11 - "required": [ 12 - "url", 13 - "title", 14 - "description", 15 - "unlisted", 16 - "createdAt" 17 - ], 18 - "properties": { 19 - "url": { 20 - "type": "string", 21 - "format": "uri", 22 - "description": "The URL of the bookmark. Cannot be left empty or be modified after creation.", 23 - "minGraphemes": 3, 24 - "minLength": 30, 25 - "maxGraphemes": 2000, 26 - "maxLength": 20000 27 - }, 28 - "title": { 29 - "type": "string", 30 - "description": "The title of the bookmark. If left empty, reuse the URL.", 31 - "minGraphemes": 1, 32 - "minLength": 10, 33 - "maxGraphemes": 2048, 34 - "maxLength": 20480 35 - }, 36 - "description": { 37 - "type": "string", 38 - "description": "A description of the bookmark's content. This should be ripped from the URL metadata and be static for all records using the URL.", 39 - "minGraphemes": 1, 40 - "minLength": 10, 41 - "maxGraphemes": 4096, 42 - "maxLength": 40960 43 - }, 44 - "notes": { 45 - "type": "string", 46 - "description": "User-written notes for the bookmark. Public and personal.", 47 - "minGraphemes": 1, 48 - "minLength": 10, 49 - "maxGraphemes": 10000, 50 - "maxLength": 100000 51 - }, 52 - "tags": { 53 - "type": "array", 54 - "description": "An array of tags. A format of solely alphanumeric characters and dashes should be used.", 55 - "items": { 56 - "type": "ref", 57 - "ref": "com.atproto.repo.strongRef" 58 - } 59 - }, 60 - "unlisted": { 61 - "type": "boolean", 62 - "description": "Whether the bookmark can be used for feed indexing and aggregation.", 63 - "default": false 64 - }, 65 - "unread": { 66 - "type": "boolean", 67 - "description": "Whether the bookmark has been read by the user.", 68 - "default": true 69 - }, 70 - "languages": { 71 - "type": "array", 72 - "description": "Indicates human language of the given URL.", 73 - "maxLength": 5, 74 - "items": { 75 - "type": "string", 76 - "format": "language" 77 - } 78 - }, 79 - "createdAt": { 80 - "type": "string", 81 - "description": "Client-declared timestamp when the bookmark is created.", 82 - "format": "datetime" 83 - } 84 - } 85 - } 86 - } 87 - } 2 + "lexicon": 1, 3 + "id": "social.clippr.feed.clip", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "Record containing a bookmarked item, or 'clip'.", 8 + "key": "any", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "url", 13 + "title", 14 + "description", 15 + "unlisted", 16 + "createdAt" 17 + ], 18 + "properties": { 19 + "url": { 20 + "type": "string", 21 + "format": "uri", 22 + "description": "The URL of the bookmark. Cannot be left empty or be modified after creation.", 23 + "minGraphemes": 3, 24 + "minLength": 30, 25 + "maxGraphemes": 2000, 26 + "maxLength": 20000 27 + }, 28 + "title": { 29 + "type": "string", 30 + "description": "The title of the bookmark. If left empty, reuse the URL.", 31 + "minGraphemes": 1, 32 + "minLength": 10, 33 + "maxGraphemes": 2048, 34 + "maxLength": 20480 35 + }, 36 + "description": { 37 + "type": "string", 38 + "description": "A description of the bookmark's content. This should be ripped from the URL metadata and be static for all records using the URL.", 39 + "minGraphemes": 1, 40 + "minLength": 10, 41 + "maxGraphemes": 4096, 42 + "maxLength": 40960 43 + }, 44 + "notes": { 45 + "type": "string", 46 + "description": "User-written notes for the bookmark. Public and personal.", 47 + "minGraphemes": 1, 48 + "minLength": 10, 49 + "maxGraphemes": 10000, 50 + "maxLength": 100000 51 + }, 52 + "tags": { 53 + "type": "array", 54 + "description": "An array of tags. A format of solely alphanumeric characters and dashes should be used.", 55 + "items": { 56 + "type": "ref", 57 + "ref": "com.atproto.repo.strongRef" 58 + } 59 + }, 60 + "unlisted": { 61 + "type": "boolean", 62 + "description": "Whether the bookmark can be used for feed indexing and aggregation", 63 + "default": false 64 + }, 65 + "unread": { 66 + "type": "boolean", 67 + "description": "Whether the bookmark has been read by the user", 68 + "default": true 69 + }, 70 + "languages": { 71 + "type": "array", 72 + "description": "Indicates human language of the given URL", 73 + "maxLength": 5, 74 + "items": { 75 + "type": "string", 76 + "format": "language" 77 + } 78 + }, 79 + "createdAt": { 80 + "type": "string", 81 + "description": "Client-declared timestamp when the bookmark is created", 82 + "format": "datetime" 83 + } 84 + } 85 + } 86 + } 87 + } 88 88 }
+65
lexdocs/social/clippr/feed/getProfileClips.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "social.clippr.feed.getProfileClips", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Get a view of a profile's reverse-chronological clips feed. Does not require auth.", 8 + "parameters": { 9 + "type": "params", 10 + "required": [ 11 + "actor" 12 + ], 13 + "properties": { 14 + "actor": { 15 + "type": "string", 16 + "format": "at-identifier", 17 + "description": "An actor to get feed data from" 18 + }, 19 + "limit": { 20 + "type": "integer", 21 + "minimum": 1, 22 + "maximum": 100, 23 + "default": 50, 24 + "description": "How many results to return with the query" 25 + }, 26 + "cursor": { 27 + "type": "string", 28 + "description": "A parameter to paginate results" 29 + }, 30 + "filter": { 31 + "type": "string", 32 + "knownValues": [ 33 + "all_clips", 34 + "tagged_clips", 35 + "untagged_clips" 36 + ], 37 + "default": "all_clips", 38 + "description": "What types to include in response" 39 + } 40 + } 41 + }, 42 + "output": { 43 + "encoding": "application/json", 44 + "schema": { 45 + "type": "object", 46 + "required": [ 47 + "feed" 48 + ], 49 + "properties": { 50 + "cursor": { 51 + "type": "string" 52 + }, 53 + "feed": { 54 + "type": "array", 55 + "items": { 56 + "type": "ref", 57 + "ref": "social.clippr.feed.defs#clipView" 58 + } 59 + } 60 + } 61 + } 62 + } 63 + } 64 + } 65 + }
+55
lexdocs/social/clippr/feed/getProfileTags.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "social.clippr.feed.getProfileTags", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Get a view of a profile's reverse-chronological clips feed. Does not require auth.", 8 + "parameters": { 9 + "type": "params", 10 + "required": [ 11 + "actor" 12 + ], 13 + "properties": { 14 + "actor": { 15 + "type": "string", 16 + "format": "at-identifier", 17 + "description": "An actor to get feed data from" 18 + }, 19 + "limit": { 20 + "type": "integer", 21 + "minimum": 1, 22 + "maximum": 100, 23 + "default": 50, 24 + "description": "How many results to return with the query" 25 + }, 26 + "cursor": { 27 + "type": "string", 28 + "description": "A parameter to paginate results" 29 + } 30 + } 31 + }, 32 + "output": { 33 + "encoding": "application/json", 34 + "schema": { 35 + "type": "object", 36 + "required": [ 37 + "feed" 38 + ], 39 + "properties": { 40 + "cursor": { 41 + "type": "string" 42 + }, 43 + "feed": { 44 + "type": "array", 45 + "items": { 46 + "type": "ref", 47 + "ref": "social.clippr.feed.defs#tagView" 48 + } 49 + } 50 + } 51 + } 52 + } 53 + } 54 + } 55 + }
+47 -39
lexdocs/social/clippr/feed/tag.json
··· 1 1 { 2 - "lexicon": 1, 3 - "id": "social.clippr.feed.tag", 4 - "defs": { 5 - "main": { 6 - "type": "record", 7 - "description": "A record containing a bookmark tag for organization.", 8 - "key": "any", 9 - "record": { 10 - "type": "object", 11 - "required": [ 12 - "name", 13 - "createdAt" 14 - ], 15 - "properties": { 16 - "name": { 17 - "type": "string", 18 - "description": "A de-duplicated string containing the name of the tag.", 19 - "minGraphemes": 1, 20 - "minLength": 10, 21 - "maxGraphemes": 64, 22 - "maxLength": 640 23 - }, 24 - "color": { 25 - "type": "string", 26 - "description": "A hexadecimal color code.", 27 - "minGraphemes": 4, 28 - "minLength": 40, 29 - "maxGraphemes": 7, 30 - "maxLength": 70 31 - }, 32 - "createdAt": { 33 - "type": "string", 34 - "description": "A client-defined timestamp for the creation of the tag.", 35 - "format": "datetime" 36 - } 37 - } 38 - } 39 - } 40 - } 2 + "lexicon": 1, 3 + "id": "social.clippr.feed.tag", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A record containing a bookmark tag for organization.", 8 + "key": "any", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "name", 13 + "createdAt" 14 + ], 15 + "properties": { 16 + "name": { 17 + "type": "string", 18 + "minGraphemes": 1, 19 + "minLength": 10, 20 + "maxGraphemes": 64, 21 + "maxLength": 640, 22 + "description": "A de-duplicated string containing the name of the tag" 23 + }, 24 + "color": { 25 + "type": "string", 26 + "minGraphemes": 4, 27 + "minLength": 40, 28 + "maxGraphemes": 7, 29 + "maxLength": 70, 30 + "description": "A hexadecimal color code" 31 + }, 32 + "description": { 33 + "type": "string", 34 + "minGraphemes": 1, 35 + "minLength": 10, 36 + "maxGraphemes": 5000, 37 + "maxLength": 50000, 38 + "description": "A description of the tag for additional context" 39 + }, 40 + "createdAt": { 41 + "type": "string", 42 + "format": "datetime", 43 + "description": "A client-defined timestamp for the creation of the tag" 44 + } 45 + } 46 + } 47 + } 48 + } 41 49 }
+16 -16
lexicons/lex.config.js
··· 8 8 import {defineLexiconConfig} from "@atcute/lex-cli"; 9 9 10 10 export default defineLexiconConfig({ 11 - files: ["../lexdocs/**/*.json"], 12 - outdir: "lib/lexicons", 13 - mappings: [ 14 - { 15 - nsid: ["com.atproto.*"], 16 - imports: (nsid) => { 17 - const specifier = nsid 18 - .slice("com.atproto.".length) 19 - .replaceAll(".", "/"); 20 - return { 21 - type: "namespace", 22 - from: `@atcute/atproto/types/${specifier}`, 23 - }; 24 - }, 25 - }, 26 - ], 11 + files: ["../lexdocs/**/*.json"], 12 + outdir: "lib/lexicons", 13 + mappings: [ 14 + { 15 + nsid: ["com.atproto.*"], 16 + imports: (nsid) => { 17 + const specifier = nsid 18 + .slice("com.atproto.".length) 19 + .replaceAll(".", "/"); 20 + return { 21 + type: "namespace", 22 + from: `@atcute/atproto/types/${specifier}`, 23 + }; 24 + }, 25 + }, 26 + ], 27 27 });
+10
lexicons/lib/lexicons/index.ts
··· 5 5 */ 6 6 7 7 export * as SocialClipprActorDefs from "./types/social/clippr/actor/defs.js"; 8 + export * as SocialClipprActorGetPreferences from "./types/social/clippr/actor/getPreferences.js"; 8 9 export * as SocialClipprActorGetProfile from "./types/social/clippr/actor/getProfile.js"; 9 10 export * as SocialClipprActorProfile from "./types/social/clippr/actor/profile.js"; 11 + export * as SocialClipprActorPutPreferences from "./types/social/clippr/actor/putPreferences.js"; 12 + export * as SocialClipprActorSearchClips from "./types/social/clippr/actor/searchClips.js"; 13 + export * as SocialClipprActorSearchProfiles from "./types/social/clippr/actor/searchProfiles.js"; 14 + export * as SocialClipprActorSearchTags from "./types/social/clippr/actor/searchTags.js"; 10 15 export * as SocialClipprFeedClip from "./types/social/clippr/feed/clip.js"; 16 + export * as SocialClipprFeedDefs from "./types/social/clippr/feed/defs.js"; 17 + export * as SocialClipprFeedGetClips from "./types/social/clippr/feed/getClips.js"; 18 + export * as SocialClipprFeedGetProfileClips from "./types/social/clippr/feed/getProfileClips.js"; 19 + export * as SocialClipprFeedGetProfileTags from "./types/social/clippr/feed/getProfileTags.js"; 20 + export * as SocialClipprFeedGetTagList from "./types/social/clippr/feed/getTagList.js"; 11 21 export * as SocialClipprFeedTag from "./types/social/clippr/feed/tag.js";
+20
lexicons/lib/lexicons/types/social/clippr/actor/defs.ts
··· 7 7 import type {} from "@atcute/lexicons"; 8 8 import * as v from "@atcute/lexicons/validations"; 9 9 10 + const _preferencesSchema = /*#__PURE__*/ v.array(() => { 11 + return /*#__PURE__*/ v.variant([publishingScopesPrefSchema]); 12 + }); 10 13 const _profileViewSchema = /*#__PURE__*/ v.object({ 11 14 $type: /*#__PURE__*/ v.optional( 12 15 /*#__PURE__*/ v.literal("social.clippr.actor.defs#profileView"), ··· 28 31 ), 29 32 handle: /*#__PURE__*/ v.handleString(), 30 33 }); 34 + const _publishingScopesPrefSchema = /*#__PURE__*/ v.object({ 35 + $type: /*#__PURE__*/ v.optional( 36 + /*#__PURE__*/ v.literal("social.clippr.actor.defs#publishingScopesPref"), 37 + ), 38 + defaultScope: /*#__PURE__*/ v.string<"public" | "unlisted" | (string & {})>(), 39 + }); 31 40 41 + type preferences$schematype = typeof _preferencesSchema; 32 42 type profileView$schematype = typeof _profileViewSchema; 43 + type publishingScopesPref$schematype = typeof _publishingScopesPrefSchema; 33 44 45 + export interface preferencesSchema extends preferences$schematype {} 34 46 export interface profileViewSchema extends profileView$schematype {} 47 + export interface publishingScopesPrefSchema 48 + extends publishingScopesPref$schematype {} 35 49 50 + export const preferencesSchema = _preferencesSchema as preferencesSchema; 36 51 export const profileViewSchema = _profileViewSchema as profileViewSchema; 52 + export const publishingScopesPrefSchema = 53 + _publishingScopesPrefSchema as publishingScopesPrefSchema; 37 54 55 + export interface Preferences extends v.InferInput<typeof preferencesSchema> {} 38 56 export interface ProfileView extends v.InferInput<typeof profileViewSchema> {} 57 + export interface PublishingScopesPref 58 + extends v.InferInput<typeof publishingScopesPrefSchema> {}
+40
lexicons/lib/lexicons/types/social/clippr/actor/getPreferences.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprActorDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query( 13 + "social.clippr.actor.getPreferences", 14 + { 15 + params: /*#__PURE__*/ v.object({}), 16 + output: { 17 + type: "lex", 18 + schema: /*#__PURE__*/ v.object({ 19 + get preferences() { 20 + return SocialClipprActorDefs.preferencesSchema; 21 + }, 22 + }), 23 + }, 24 + }, 25 + ); 26 + 27 + type main$schematype = typeof _mainSchema; 28 + 29 + export interface mainSchema extends main$schematype {} 30 + 31 + export const mainSchema = _mainSchema as mainSchema; 32 + 33 + export interface $params extends v.InferInput<mainSchema["params"]> {} 34 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 35 + 36 + declare module "@atcute/lexicons/ambient" { 37 + interface XRPCQueries { 38 + "social.clippr.actor.getPreferences": mainSchema; 39 + } 40 + }
+41
lexicons/lib/lexicons/types/social/clippr/actor/putPreferences.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprActorDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.procedure( 13 + "social.clippr.actor.putPreferences", 14 + { 15 + params: null, 16 + input: { 17 + type: "lex", 18 + schema: /*#__PURE__*/ v.object({ 19 + get preferences() { 20 + return SocialClipprActorDefs.preferencesSchema; 21 + }, 22 + }), 23 + }, 24 + output: null, 25 + }, 26 + ); 27 + 28 + type main$schematype = typeof _mainSchema; 29 + 30 + export interface mainSchema extends main$schematype {} 31 + 32 + export const mainSchema = _mainSchema as mainSchema; 33 + 34 + export interface $params {} 35 + export interface $input extends v.InferXRPCBodyInput<mainSchema["input"]> {} 36 + 37 + declare module "@atcute/lexicons/ambient" { 38 + interface XRPCProcedures { 39 + "social.clippr.actor.putPreferences": mainSchema; 40 + } 41 + }
+48
lexicons/lib/lexicons/types/social/clippr/actor/searchClips.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "../feed/defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query("social.clippr.actor.searchClips", { 13 + params: /*#__PURE__*/ v.object({ 14 + actor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.actorIdentifierString()), 15 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 16 + limit: /*#__PURE__*/ v.optional( 17 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 18 + /*#__PURE__*/ v.integerRange(1, 100), 19 + ]), 20 + 25, 21 + ), 22 + q: /*#__PURE__*/ v.string(), 23 + }), 24 + output: { 25 + type: "lex", 26 + schema: /*#__PURE__*/ v.object({ 27 + get clips() { 28 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.clipViewSchema); 29 + }, 30 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 31 + }), 32 + }, 33 + }); 34 + 35 + type main$schematype = typeof _mainSchema; 36 + 37 + export interface mainSchema extends main$schematype {} 38 + 39 + export const mainSchema = _mainSchema as mainSchema; 40 + 41 + export interface $params extends v.InferInput<mainSchema["params"]> {} 42 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 43 + 44 + declare module "@atcute/lexicons/ambient" { 45 + interface XRPCQueries { 46 + "social.clippr.actor.searchClips": mainSchema; 47 + } 48 + }
+50
lexicons/lib/lexicons/types/social/clippr/actor/searchProfiles.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprActorDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query( 13 + "social.clippr.actor.searchProfiles", 14 + { 15 + params: /*#__PURE__*/ v.object({ 16 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 17 + limit: /*#__PURE__*/ v.optional( 18 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 19 + /*#__PURE__*/ v.integerRange(1, 100), 20 + ]), 21 + 25, 22 + ), 23 + q: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 24 + }), 25 + output: { 26 + type: "lex", 27 + schema: /*#__PURE__*/ v.object({ 28 + get actors() { 29 + return /*#__PURE__*/ v.array(SocialClipprActorDefs.profileViewSchema); 30 + }, 31 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 32 + }), 33 + }, 34 + }, 35 + ); 36 + 37 + type main$schematype = typeof _mainSchema; 38 + 39 + export interface mainSchema extends main$schematype {} 40 + 41 + export const mainSchema = _mainSchema as mainSchema; 42 + 43 + export interface $params extends v.InferInput<mainSchema["params"]> {} 44 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 45 + 46 + declare module "@atcute/lexicons/ambient" { 47 + interface XRPCQueries { 48 + "social.clippr.actor.searchProfiles": mainSchema; 49 + } 50 + }
+48
lexicons/lib/lexicons/types/social/clippr/actor/searchTags.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "../feed/defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query("social.clippr.actor.searchTags", { 13 + params: /*#__PURE__*/ v.object({ 14 + actor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.actorIdentifierString()), 15 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 16 + limit: /*#__PURE__*/ v.optional( 17 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 18 + /*#__PURE__*/ v.integerRange(1, 100), 19 + ]), 20 + 25, 21 + ), 22 + q: /*#__PURE__*/ v.string(), 23 + }), 24 + output: { 25 + type: "lex", 26 + schema: /*#__PURE__*/ v.object({ 27 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 28 + get tags() { 29 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.tagViewSchema); 30 + }, 31 + }), 32 + }, 33 + }); 34 + 35 + type main$schematype = typeof _mainSchema; 36 + 37 + export interface mainSchema extends main$schematype {} 38 + 39 + export const mainSchema = _mainSchema as mainSchema; 40 + 41 + export interface $params extends v.InferInput<mainSchema["params"]> {} 42 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 43 + 44 + declare module "@atcute/lexicons/ambient" { 45 + interface XRPCQueries { 46 + "social.clippr.actor.searchTags": mainSchema; 47 + } 48 + }
+46
lexicons/lib/lexicons/types/social/clippr/feed/defs.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import * as SocialClipprActorDefs from "../actor/defs.js"; 10 + 11 + const _clipViewSchema = /*#__PURE__*/ v.object({ 12 + $type: /*#__PURE__*/ v.optional( 13 + /*#__PURE__*/ v.literal("social.clippr.feed.defs#clipView"), 14 + ), 15 + get author() { 16 + return SocialClipprActorDefs.profileViewSchema; 17 + }, 18 + cid: /*#__PURE__*/ v.cidString(), 19 + indexedAt: /*#__PURE__*/ v.datetimeString(), 20 + record: /*#__PURE__*/ v.unknown(), 21 + uri: /*#__PURE__*/ v.resourceUriString(), 22 + }); 23 + const _tagViewSchema = /*#__PURE__*/ v.object({ 24 + $type: /*#__PURE__*/ v.optional( 25 + /*#__PURE__*/ v.literal("social.clippr.feed.defs#tagView"), 26 + ), 27 + get author() { 28 + return SocialClipprActorDefs.profileViewSchema; 29 + }, 30 + cid: /*#__PURE__*/ v.cidString(), 31 + indexedAt: /*#__PURE__*/ v.datetimeString(), 32 + record: /*#__PURE__*/ v.unknown(), 33 + uri: /*#__PURE__*/ v.resourceUriString(), 34 + }); 35 + 36 + type clipView$schematype = typeof _clipViewSchema; 37 + type tagView$schematype = typeof _tagViewSchema; 38 + 39 + export interface clipViewSchema extends clipView$schematype {} 40 + export interface tagViewSchema extends tagView$schematype {} 41 + 42 + export const clipViewSchema = _clipViewSchema as clipViewSchema; 43 + export const tagViewSchema = _tagViewSchema as tagViewSchema; 44 + 45 + export interface ClipView extends v.InferInput<typeof clipViewSchema> {} 46 + export interface TagView extends v.InferInput<typeof tagViewSchema> {}
+42
lexicons/lib/lexicons/types/social/clippr/feed/getClips.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query("social.clippr.feed.getClips", { 13 + params: /*#__PURE__*/ v.object({ 14 + uris: /*#__PURE__*/ v.constrain( 15 + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), 16 + [/*#__PURE__*/ v.arrayLength(1, 25)], 17 + ), 18 + }), 19 + output: { 20 + type: "lex", 21 + schema: /*#__PURE__*/ v.object({ 22 + get tags() { 23 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.tagViewSchema); 24 + }, 25 + }), 26 + }, 27 + }); 28 + 29 + type main$schematype = typeof _mainSchema; 30 + 31 + export interface mainSchema extends main$schematype {} 32 + 33 + export const mainSchema = _mainSchema as mainSchema; 34 + 35 + export interface $params extends v.InferInput<mainSchema["params"]> {} 36 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 37 + 38 + declare module "@atcute/lexicons/ambient" { 39 + interface XRPCQueries { 40 + "social.clippr.feed.getClips": mainSchema; 41 + } 42 + }
+56
lexicons/lib/lexicons/types/social/clippr/feed/getProfileClips.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query( 13 + "social.clippr.feed.getProfileClips", 14 + { 15 + params: /*#__PURE__*/ v.object({ 16 + actor: /*#__PURE__*/ v.actorIdentifierString(), 17 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 18 + filter: /*#__PURE__*/ v.optional( 19 + /*#__PURE__*/ v.string< 20 + "all_clips" | "tagged_clips" | "untagged_clips" | (string & {}) 21 + >(), 22 + "all_clips", 23 + ), 24 + limit: /*#__PURE__*/ v.optional( 25 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 26 + /*#__PURE__*/ v.integerRange(1, 100), 27 + ]), 28 + 50, 29 + ), 30 + }), 31 + output: { 32 + type: "lex", 33 + schema: /*#__PURE__*/ v.object({ 34 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 35 + get feed() { 36 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.clipViewSchema); 37 + }, 38 + }), 39 + }, 40 + }, 41 + ); 42 + 43 + type main$schematype = typeof _mainSchema; 44 + 45 + export interface mainSchema extends main$schematype {} 46 + 47 + export const mainSchema = _mainSchema as mainSchema; 48 + 49 + export interface $params extends v.InferInput<mainSchema["params"]> {} 50 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 51 + 52 + declare module "@atcute/lexicons/ambient" { 53 + interface XRPCQueries { 54 + "social.clippr.feed.getProfileClips": mainSchema; 55 + } 56 + }
+47
lexicons/lib/lexicons/types/social/clippr/feed/getProfileTags.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query("social.clippr.feed.getProfileTags", { 13 + params: /*#__PURE__*/ v.object({ 14 + actor: /*#__PURE__*/ v.actorIdentifierString(), 15 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 16 + limit: /*#__PURE__*/ v.optional( 17 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 18 + /*#__PURE__*/ v.integerRange(1, 100), 19 + ]), 20 + 50, 21 + ), 22 + }), 23 + output: { 24 + type: "lex", 25 + schema: /*#__PURE__*/ v.object({ 26 + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 27 + get feed() { 28 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.tagViewSchema); 29 + }, 30 + }), 31 + }, 32 + }); 33 + 34 + type main$schematype = typeof _mainSchema; 35 + 36 + export interface mainSchema extends main$schematype {} 37 + 38 + export const mainSchema = _mainSchema as mainSchema; 39 + 40 + export interface $params extends v.InferInput<mainSchema["params"]> {} 41 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 42 + 43 + declare module "@atcute/lexicons/ambient" { 44 + interface XRPCQueries { 45 + "social.clippr.feed.getProfileTags": mainSchema; 46 + } 47 + }
+39
lexicons/lib/lexicons/types/social/clippr/feed/getTagList.ts
··· 1 + /* 2 + * clippr: a social bookmarking service for the AT Protocol 3 + * Copyright (c) 2025 clippr contributors. 4 + * SPDX-License-Identifier: AGPL-3.0-only 5 + */ 6 + 7 + import type {} from "@atcute/lexicons"; 8 + import * as v from "@atcute/lexicons/validations"; 9 + import type {} from "@atcute/lexicons/ambient"; 10 + import * as SocialClipprFeedDefs from "./defs.js"; 11 + 12 + const _mainSchema = /*#__PURE__*/ v.query("social.clippr.feed.getTagList", { 13 + params: /*#__PURE__*/ v.object({ 14 + actor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.actorIdentifierString()), 15 + }), 16 + output: { 17 + type: "lex", 18 + schema: /*#__PURE__*/ v.object({ 19 + get tags() { 20 + return /*#__PURE__*/ v.array(SocialClipprFeedDefs.tagViewSchema); 21 + }, 22 + }), 23 + }, 24 + }); 25 + 26 + type main$schematype = typeof _mainSchema; 27 + 28 + export interface mainSchema extends main$schematype {} 29 + 30 + export const mainSchema = _mainSchema as mainSchema; 31 + 32 + export interface $params extends v.InferInput<mainSchema["params"]> {} 33 + export interface $output extends v.InferXRPCBodyInput<mainSchema["output"]> {} 34 + 35 + declare module "@atcute/lexicons/ambient" { 36 + interface XRPCQueries { 37 + "social.clippr.feed.getTagList": mainSchema; 38 + } 39 + }
+6
lexicons/lib/lexicons/types/social/clippr/feed/tag.ts
··· 19 19 ]), 20 20 ), 21 21 createdAt: /*#__PURE__*/ v.datetimeString(), 22 + description: /*#__PURE__*/ v.optional( 23 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 24 + /*#__PURE__*/ v.stringLength(10, 50000), 25 + /*#__PURE__*/ v.stringGraphemes(1, 5000), 26 + ]), 27 + ), 22 28 name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 23 29 /*#__PURE__*/ v.stringLength(10, 640), 24 30 /*#__PURE__*/ v.stringGraphemes(1, 64),
+1 -1
lexicons/package.json
··· 1 1 { 2 2 "type": "module", 3 3 "name": "@clipprjs/lexicons", 4 - "version": "0.1.4", 4 + "version": "1.0.0", 5 5 "description": "Clippr schema definitions", 6 6 "license": "AGPL-3.0-only", 7 7 "private": false,
+31
lexicons/CHANGELOG.md
··· 1 + # changelog for @clipprjs/lexicons 2 + 3 + ## v1.0.0 4 + 5 + > this version should be considered as the starting point for a usable Lexicon API. previous versions should be ignored. 6 + 7 + * added search queries for clips, tags and profiles 8 + * added `social.clippr.actor.defs#preferences` with an accompanying query and procedure lexicon 9 + * added more inline documentation to previously existing lexicons 10 + * added query lexicons for having a clip and tag feed on a profile 11 + * added general query lexicons for at:// URIs linking to clips and tags 12 + 13 + ## v0.1.4 14 + 15 + * added length constraints to more strings in record lexicons 16 + 17 + ## v0.1.3 18 + 19 + * made `displayName` required for profile records 20 + 21 + ## v0.1.2 22 + 23 + * added npm tags.. i guess 24 + 25 + ## v0.1.1 26 + 27 + * something(?) 28 + 29 + ## v0.1.0 30 + 31 + * initial record and `social.clippr.actor.getProfile` query lexicons
+2 -2
lexicons/README.md
··· 2 2 3 3 Lexicon package auto-generated with `@atcute/lex-cli` 4 4 5 - > This package is *very* unstable. Lexicon attributes can be modified at any moment. 5 + > This package is *somewhat* unstable. Lexicon attributes can be modified at any moment. 6 6 > Please do not use this package for anything until the [Clippr server](https://tangled.sh/@hexmani.ac/clippr) has been 7 - > deployed for either public or developer consumption. 7 + > deployed for either public or developer usage. 8 8 9 9 ## Usage 10 10