Draft: Add tsp definitions for lexicons from lexicon.community #4

Adds tsp definitions for the lexicons from lexicon.community. Two are missing (calendar.event and calendar.rsvp) because they contain unions of tokens (strings) with default values and I don't know how to do those.

Changed files
+501
packages
emitter
test
integration
lexicon-examples
input
community
output
+14
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/bookmarks/bookmark.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.bookmarks.bookmark {
+
/** Record bookmarking a link to come back to later. */
+
@rec("tid")
+
model Main {
+
@required subject: uri;
+
+
@required createdAt: datetime;
+
+
/** Tags for content the bookmark may be related to, for example 'news' or 'funny videos' */
+
tags?: string[];
+
}
+
}
+27
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/bookmarks/getActorBookmarks.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.bookmarks.getActorBookmarks {
+
/** 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. */
+
@query
+
op main(
+
tags?: string[],
+
+
@minValue(1)
+
@maxValue(100)
+
limit?: int32 = 50,
+
+
cursor?: string
+
): {
+
@required
+
bookmarks: community.lexicon.bookmarks.bookmark.Main[];
+
+
cursor?: string;
+
};
+
}
+
+
// --- Externals ---
+
+
@external
+
namespace community.lexicon.bookmarks.bookmark {
+
model Main { }
+
}
+20
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/interaction/like.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.interaction.like {
+
/** A 'like' interaction with another AT Protocol record. */
+
@rec("tid")
+
model Main {
+
@required
+
subject: `com`.atproto.repo.strongRef.Main;
+
+
@required
+
createdAt: datetime;
+
}
+
}
+
+
// --- Externals ---
+
+
@external
+
namespace `com`.atproto.repo.strongRef {
+
model Main { }
+
}
+27
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/address.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.location.address {
+
/** A physical location in the form of a street address. */
+
model Main {
+
/** The ISO 3166 country code. Preferably the 2-letter code. */
+
@required
+
@minLength(2)
+
@maxLength(10)
+
country: string;
+
+
/** The postal code of the location. */
+
postalCode?: string;
+
+
/** The administrative region of the country. For example, a state in the USA. */
+
region?: string;
+
+
/** The locality of the region. For example, a city in the USA. */
+
locality?: string;
+
+
/** The street address. */
+
street?: string;
+
+
/** The name of the location. */
+
name?: string;
+
}
+
}
+15
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/fsq.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.location.fsq {
+
/** A physical location contained in the Foursquare Open Source Places dataset. */
+
model Main {
+
/** The unique identifier of a Foursquare POI. */
+
@required fsq_place_id: string;
+
+
latitude?: string;
+
longitude?: string;
+
+
/** The name of the location. */
+
name?: string;
+
}
+
}
+12
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/geo.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.location.geo {
+
/** A physical location in the form of a WGS84 coordinate. */
+
model Main {
+
@required latitude: string;
+
@required longitude: string;
+
altitude?: string;
+
/** The name of the location. */
+
name?: string;
+
}
+
}
+12
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/location/hthree.tsp
···
+
import "@typelex/emitter";
+
+
namespace community.lexicon.location.hthree {
+
/** A physical location in the form of a H3 encoded location. */
+
model Main {
+
/** The h3 encoded location. */
+
@required value: string;
+
+
/** The name of the location. */
+
name?: string;
+
}
+
}
+14
packages/emitter/test/integration/lexicon-examples/input/community/lexicon/payments/webMonetization.tsp
···
+
import "@typelex/emitter";
+
+
/** Web Monetization integration: https://webmonetization.org/ */
+
namespace community.lexicon.payments.webMonetization {
+
@rec("any")
+
/** Web Monetization wallet. */
+
model Main {
+
/** Wallet address. */
+
@required address: uri;
+
+
/** Short, human-readable description of how this wallet is related to this account. */
+
note?: string;
+
}
+
}
+35
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/bookmarks/bookmark.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.bookmarks.bookmark",
+
"defs": {
+
"main": {
+
"type": "record",
+
"description": "Record bookmarking a link to come back to later.",
+
"key": "tid",
+
"record": {
+
"type": "object",
+
"required": [
+
"subject",
+
"createdAt"
+
],
+
"properties": {
+
"subject": {
+
"type": "string",
+
"format": "uri"
+
},
+
"createdAt": {
+
"type": "string",
+
"format": "datetime"
+
},
+
"tags": {
+
"type": "array",
+
"description": "Tags for content the bookmark may be related to, for example 'news' or 'funny videos'",
+
"items": {
+
"type": "string"
+
}
+
}
+
}
+
}
+
}
+
}
+
}
+51
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/bookmarks/getActorBookmarks.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.bookmarks.getActorBookmarks",
+
"defs": {
+
"main": {
+
"type": "query",
+
"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.",
+
"parameters": {
+
"type": "params",
+
"properties": {
+
"tags": {
+
"type": "array",
+
"items": {
+
"type": "string"
+
}
+
},
+
"limit": {
+
"type": "integer",
+
"minimum": 1,
+
"maximum": 100,
+
"default": 50
+
},
+
"cursor": {
+
"type": "string"
+
}
+
}
+
},
+
"output": {
+
"encoding": "application/json",
+
"schema": {
+
"type": "object",
+
"required": [
+
"bookmarks"
+
],
+
"properties": {
+
"cursor": {
+
"type": "string"
+
},
+
"bookmarks": {
+
"type": "array",
+
"items": {
+
"type": "ref",
+
"ref": "community.lexicon.bookmarks.bookmark"
+
}
+
}
+
}
+
}
+
}
+
}
+
}
+
}
+28
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/calendar/event.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.calendar.event",
+
"defs": {
+
"mode": {
+
"type": "string",
+
"description": "The mode of the event.",
+
"default": "community.lexicon.calendar.event#inperson",
+
"knownValues": [
+
"community.lexicon.calendar.event#hybrid",
+
"community.lexicon.calendar.event#inperson",
+
"community.lexicon.calendar.event#virtual"
+
]
+
},
+
"virtual": {
+
"type": "token",
+
"description": "A virtual event that takes place online."
+
},
+
"inperson": {
+
"type": "token",
+
"description": "An in-person event that takes place offline."
+
},
+
"hybrid": {
+
"type": "token",
+
"description": "A hybrid event that takes place both online and offline."
+
}
+
}
+
}
+45
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/calendar/rsvp.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.calendar.rsvp",
+
"defs": {
+
"main": {
+
"type": "record",
+
"description": "An RSVP for an event.",
+
"key": "tid",
+
"record": {
+
"type": "object",
+
"required": [
+
"subject",
+
"status"
+
],
+
"properties": {
+
"subject": {
+
"type": "ref",
+
"ref": "com.atproto.repo.strongRef"
+
},
+
"status": {
+
"type": "string",
+
"default": "community.lexicon.calendar.rsvp#going",
+
"knownValues": [
+
"community.lexicon.calendar.rsvp#interested",
+
"community.lexicon.calendar.rsvp#going",
+
"community.lexicon.calendar.rsvp#notgoing"
+
]
+
}
+
}
+
}
+
},
+
"interested": {
+
"type": "token",
+
"description": "Interested in the event"
+
},
+
"going": {
+
"type": "token",
+
"description": "Going to the event"
+
},
+
"notgoing": {
+
"type": "token",
+
"description": "Not going to the event"
+
}
+
}
+
}
+28
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/interaction/like.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.interaction.like",
+
"defs": {
+
"main": {
+
"type": "record",
+
"description": "A 'like' interaction with another AT Protocol record.",
+
"key": "tid",
+
"record": {
+
"type": "object",
+
"required": [
+
"subject",
+
"createdAt"
+
],
+
"properties": {
+
"subject": {
+
"type": "ref",
+
"ref": "com.atproto.repo.strongRef"
+
},
+
"createdAt": {
+
"type": "string",
+
"format": "datetime"
+
}
+
}
+
}
+
}
+
}
+
}
+41
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/address.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.location.address",
+
"defs": {
+
"main": {
+
"type": "object",
+
"description": "A physical location in the form of a street address.",
+
"required": [
+
"country"
+
],
+
"properties": {
+
"country": {
+
"type": "string",
+
"description": "The ISO 3166 country code. Preferably the 2-letter code.",
+
"minLength": 2,
+
"maxLength": 10
+
},
+
"postalCode": {
+
"type": "string",
+
"description": "The postal code of the location."
+
},
+
"region": {
+
"type": "string",
+
"description": "The administrative region of the country. For example, a state in the USA."
+
},
+
"locality": {
+
"type": "string",
+
"description": "The locality of the region. For example, a city in the USA."
+
},
+
"street": {
+
"type": "string",
+
"description": "The street address."
+
},
+
"name": {
+
"type": "string",
+
"description": "The name of the location."
+
}
+
}
+
}
+
}
+
}
+29
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/fsq.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.location.fsq",
+
"defs": {
+
"main": {
+
"type": "object",
+
"description": "A physical location contained in the Foursquare Open Source Places dataset.",
+
"required": [
+
"fsq_place_id"
+
],
+
"properties": {
+
"fsq_place_id": {
+
"type": "string",
+
"description": "The unique identifier of a Foursquare POI."
+
},
+
"latitude": {
+
"type": "string"
+
},
+
"longitude": {
+
"type": "string"
+
},
+
"name": {
+
"type": "string",
+
"description": "The name of the location."
+
}
+
}
+
}
+
}
+
}
+29
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/geo.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.location.geo",
+
"defs": {
+
"main": {
+
"type": "object",
+
"description": "A physical location in the form of a WGS84 coordinate.",
+
"required": [
+
"latitude",
+
"longitude"
+
],
+
"properties": {
+
"latitude": {
+
"type": "string"
+
},
+
"longitude": {
+
"type": "string"
+
},
+
"altitude": {
+
"type": "string"
+
},
+
"name": {
+
"type": "string",
+
"description": "The name of the location."
+
}
+
}
+
}
+
}
+
}
+23
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/location/hthree.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.location.hthree",
+
"defs": {
+
"main": {
+
"type": "object",
+
"description": "A physical location in the form of a H3 encoded location.",
+
"required": [
+
"value"
+
],
+
"properties": {
+
"value": {
+
"type": "string",
+
"description": "The h3 encoded location."
+
},
+
"name": {
+
"type": "string",
+
"description": "The name of the location."
+
}
+
}
+
}
+
}
+
}
+27
packages/emitter/test/integration/lexicon-examples/output/community/lexicon/payments/webMonetization.json
···
+
{
+
"lexicon": 1,
+
"id": "community.lexicon.payments.webMonetization",
+
"description": "Web Monetization integration: https://webmonetization.org/",
+
"defs": {
+
"main": {
+
"type": "record",
+
"description": "Web Monetization wallet.",
+
"key": "any",
+
"record": {
+
"type": "object",
+
"required": ["address"],
+
"properties": {
+
"address": {
+
"type": "string",
+
"format": "uri",
+
"description": "Wallet address."
+
},
+
"note": {
+
"type": "string",
+
"description": "Short, human-readable description of how this wallet is related to this account."
+
}
+
}
+
}
+
}
+
}
+
}
+24
LICENSE.md
···
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
SOFTWARE.
+
+
Contains lexicons from https://github.com/lexicon-community/lexicon under the following license:
+
+
MIT License
+
+
Copyright (c) 2024 Lexicon Community
+
+
Permission is hereby granted, free of charge, to any person obtaining a copy
+
of this software and associated documentation files (the "Software"), to deal
+
in the Software without restriction, including without limitation the rights
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
copies of the Software, and to permit persons to whom the Software is
+
furnished to do so, subject to the following conditions:
+
+
The above copyright notice and this permission notice shall be included in all
+
copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE