An experimental TypeSpec syntax for Lexicon

draft: add community lexicon tsp definitions

authored by uwx and committed by Tangled e5c0c6a3 66f26174

Changed files
+477
packages
emitter
test
integration
lexicon-examples
input
community
output
+14
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/bookmarks/bookmark.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.bookmarks.bookmark { 4 + /** Record bookmarking a link to come back to later. */ 5 + @rec("tid") 6 + model Main { 7 + @required subject: uri; 8 + 9 + @required createdAt: datetime; 10 + 11 + /** Tags for content the bookmark may be related to, for example 'news' or 'funny videos' */ 12 + tags?: string[]; 13 + } 14 + }
+27
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/bookmarks/getActorBookmarks.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.bookmarks.getActorBookmarks { 4 + /** Get a list of bookmarks by actor. Optionally add a list of tags to include, default will be all bookmarks. Requires auth, actor must be the requesting account. */ 5 + @query 6 + op main( 7 + tags?: string[], 8 + 9 + @minValue(1) 10 + @maxValue(100) 11 + limit?: int32 = 50, 12 + 13 + cursor?: string 14 + ): { 15 + @required 16 + bookmarks: community.lexicon.bookmarks.bookmark.Main[]; 17 + 18 + cursor?: string; 19 + }; 20 + } 21 + 22 + // --- Externals --- 23 + 24 + @external 25 + namespace community.lexicon.bookmarks.bookmark { 26 + model Main { } 27 + }
+20
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/interaction/like.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.interaction.like { 4 + /** A 'like' interaction with another AT Protocol record. */ 5 + @rec("tid") 6 + model Main { 7 + @required 8 + subject: `com`.atproto.repo.strongRef.Main; 9 + 10 + @required 11 + createdAt: datetime; 12 + } 13 + } 14 + 15 + // --- Externals --- 16 + 17 + @external 18 + namespace `com`.atproto.repo.strongRef { 19 + model Main { } 20 + }
+27
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/address.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.location.address { 4 + /** A physical location in the form of a street address. */ 5 + model Main { 6 + /** The ISO 3166 country code. Preferably the 2-letter code. */ 7 + @required 8 + @minLength(2) 9 + @maxLength(10) 10 + country: string; 11 + 12 + /** The postal code of the location. */ 13 + postalCode?: string; 14 + 15 + /** The administrative region of the country. For example, a state in the USA. */ 16 + region?: string; 17 + 18 + /** The locality of the region. For example, a city in the USA. */ 19 + locality?: string; 20 + 21 + /** The street address. */ 22 + street?: string; 23 + 24 + /** The name of the location. */ 25 + name?: string; 26 + } 27 + }
+15
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/fsq.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.location.fsq { 4 + /** A physical location contained in the Foursquare Open Source Places dataset. */ 5 + model Main { 6 + /** The unique identifier of a Foursquare POI. */ 7 + @required fsq_place_id: string; 8 + 9 + latitude?: string; 10 + longitude?: string; 11 + 12 + /** The name of the location. */ 13 + name?: string; 14 + } 15 + }
+12
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/geo.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.location.geo { 4 + /** A physical location in the form of a WGS84 coordinate. */ 5 + model Main { 6 + @required latitude: string; 7 + @required longitude: string; 8 + altitude?: string; 9 + /** The name of the location. */ 10 + name?: string; 11 + } 12 + }
+12
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/hthree.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace community.lexicon.location.hthree { 4 + /** A physical location in the form of a H3 encoded location. */ 5 + model Main { 6 + /** The h3 encoded location. */ 7 + @required value: string; 8 + 9 + /** The name of the location. */ 10 + name?: string; 11 + } 12 + }
+14
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/payments/webMonetization.tsp
··· 1 + import "@typelex/emitter"; 2 + 3 + /** Web Monetization integration: https://webmonetization.org/ */ 4 + namespace community.lexicon.payments.webMonetization { 5 + @rec("any") 6 + /** Web Monetization wallet. */ 7 + model Main { 8 + /** Wallet address. */ 9 + @required address: uri; 10 + 11 + /** Short, human-readable description of how this wallet is related to this account. */ 12 + note?: string; 13 + } 14 + }
+35
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/bookmarks/bookmark.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.bookmarks.bookmark", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "Record bookmarking a link to come back to later.", 8 + "key": "tid", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "subject", 13 + "createdAt" 14 + ], 15 + "properties": { 16 + "subject": { 17 + "type": "string", 18 + "format": "uri" 19 + }, 20 + "createdAt": { 21 + "type": "string", 22 + "format": "datetime" 23 + }, 24 + "tags": { 25 + "type": "array", 26 + "description": "Tags for content the bookmark may be related to, for example 'news' or 'funny videos'", 27 + "items": { 28 + "type": "string" 29 + } 30 + } 31 + } 32 + } 33 + } 34 + } 35 + }
+51
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/bookmarks/getActorBookmarks.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.bookmarks.getActorBookmarks", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Get a list of bookmarks by actor. Optionally add a list of tags to include, default will be all bookmarks. Requires auth, actor must be the requesting account.", 8 + "parameters": { 9 + "type": "params", 10 + "properties": { 11 + "tags": { 12 + "type": "array", 13 + "items": { 14 + "type": "string" 15 + } 16 + }, 17 + "limit": { 18 + "type": "integer", 19 + "minimum": 1, 20 + "maximum": 100, 21 + "default": 50 22 + }, 23 + "cursor": { 24 + "type": "string" 25 + } 26 + } 27 + }, 28 + "output": { 29 + "encoding": "application/json", 30 + "schema": { 31 + "type": "object", 32 + "required": [ 33 + "bookmarks" 34 + ], 35 + "properties": { 36 + "cursor": { 37 + "type": "string" 38 + }, 39 + "bookmarks": { 40 + "type": "array", 41 + "items": { 42 + "type": "ref", 43 + "ref": "community.lexicon.bookmarks.bookmark" 44 + } 45 + } 46 + } 47 + } 48 + } 49 + } 50 + } 51 + }
+28
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/calendar/event.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.calendar.event", 4 + "defs": { 5 + "mode": { 6 + "type": "string", 7 + "description": "The mode of the event.", 8 + "default": "community.lexicon.calendar.event#inperson", 9 + "knownValues": [ 10 + "community.lexicon.calendar.event#hybrid", 11 + "community.lexicon.calendar.event#inperson", 12 + "community.lexicon.calendar.event#virtual" 13 + ] 14 + }, 15 + "virtual": { 16 + "type": "token", 17 + "description": "A virtual event that takes place online." 18 + }, 19 + "inperson": { 20 + "type": "token", 21 + "description": "An in-person event that takes place offline." 22 + }, 23 + "hybrid": { 24 + "type": "token", 25 + "description": "A hybrid event that takes place both online and offline." 26 + } 27 + } 28 + }
+45
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/calendar/rsvp.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.calendar.rsvp", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "An RSVP for an event.", 8 + "key": "tid", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "subject", 13 + "status" 14 + ], 15 + "properties": { 16 + "subject": { 17 + "type": "ref", 18 + "ref": "com.atproto.repo.strongRef" 19 + }, 20 + "status": { 21 + "type": "string", 22 + "default": "community.lexicon.calendar.rsvp#going", 23 + "knownValues": [ 24 + "community.lexicon.calendar.rsvp#interested", 25 + "community.lexicon.calendar.rsvp#going", 26 + "community.lexicon.calendar.rsvp#notgoing" 27 + ] 28 + } 29 + } 30 + } 31 + }, 32 + "interested": { 33 + "type": "token", 34 + "description": "Interested in the event" 35 + }, 36 + "going": { 37 + "type": "token", 38 + "description": "Going to the event" 39 + }, 40 + "notgoing": { 41 + "type": "token", 42 + "description": "Not going to the event" 43 + } 44 + } 45 + }
+28
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/interaction/like.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.interaction.like", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A 'like' interaction with another AT Protocol record.", 8 + "key": "tid", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "subject", 13 + "createdAt" 14 + ], 15 + "properties": { 16 + "subject": { 17 + "type": "ref", 18 + "ref": "com.atproto.repo.strongRef" 19 + }, 20 + "createdAt": { 21 + "type": "string", 22 + "format": "datetime" 23 + } 24 + } 25 + } 26 + } 27 + } 28 + }
+41
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/address.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.location.address", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "A physical location in the form of a street address.", 8 + "required": [ 9 + "country" 10 + ], 11 + "properties": { 12 + "country": { 13 + "type": "string", 14 + "description": "The ISO 3166 country code. Preferably the 2-letter code.", 15 + "minLength": 2, 16 + "maxLength": 10 17 + }, 18 + "postalCode": { 19 + "type": "string", 20 + "description": "The postal code of the location." 21 + }, 22 + "region": { 23 + "type": "string", 24 + "description": "The administrative region of the country. For example, a state in the USA." 25 + }, 26 + "locality": { 27 + "type": "string", 28 + "description": "The locality of the region. For example, a city in the USA." 29 + }, 30 + "street": { 31 + "type": "string", 32 + "description": "The street address." 33 + }, 34 + "name": { 35 + "type": "string", 36 + "description": "The name of the location." 37 + } 38 + } 39 + } 40 + } 41 + }
+29
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/fsq.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.location.fsq", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "A physical location contained in the Foursquare Open Source Places dataset.", 8 + "required": [ 9 + "fsq_place_id" 10 + ], 11 + "properties": { 12 + "fsq_place_id": { 13 + "type": "string", 14 + "description": "The unique identifier of a Foursquare POI." 15 + }, 16 + "latitude": { 17 + "type": "string" 18 + }, 19 + "longitude": { 20 + "type": "string" 21 + }, 22 + "name": { 23 + "type": "string", 24 + "description": "The name of the location." 25 + } 26 + } 27 + } 28 + } 29 + }
+29
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/geo.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.location.geo", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "A physical location in the form of a WGS84 coordinate.", 8 + "required": [ 9 + "latitude", 10 + "longitude" 11 + ], 12 + "properties": { 13 + "latitude": { 14 + "type": "string" 15 + }, 16 + "longitude": { 17 + "type": "string" 18 + }, 19 + "altitude": { 20 + "type": "string" 21 + }, 22 + "name": { 23 + "type": "string", 24 + "description": "The name of the location." 25 + } 26 + } 27 + } 28 + } 29 + }
+23
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/hthree.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.location.hthree", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "A physical location in the form of a H3 encoded location.", 8 + "required": [ 9 + "value" 10 + ], 11 + "properties": { 12 + "value": { 13 + "type": "string", 14 + "description": "The h3 encoded location." 15 + }, 16 + "name": { 17 + "type": "string", 18 + "description": "The name of the location." 19 + } 20 + } 21 + } 22 + } 23 + }
+27
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/payments/webMonetization.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "community.lexicon.payments.webMonetization", 4 + "description": "Web Monetization integration: https://webmonetization.org/", 5 + "defs": { 6 + "main": { 7 + "type": "record", 8 + "description": "Web Monetization wallet.", 9 + "key": "any", 10 + "record": { 11 + "type": "object", 12 + "required": ["address"], 13 + "properties": { 14 + "address": { 15 + "type": "string", 16 + "format": "uri", 17 + "description": "Wallet address." 18 + }, 19 + "note": { 20 + "type": "string", 21 + "description": "Short, human-readable description of how this wallet is related to this account." 22 + } 23 + } 24 + } 25 + } 26 + } 27 + }