A Prediction Market on the AT Protocol

refactor(src/lexicon): clean up defs based on added lex:lint command

Ciaran 13da87d9 8a65025e

+46 -25
+5 -3
generated/json/za/co/ciaran/cumulus/bet.json
··· 1 1 { 2 2 "defs": { 3 3 "main": { 4 + "description": "The record containing a Bet placed on a Cumulus Market", 4 5 "key": "tid", 5 6 "record": { 6 7 "properties": { ··· 11 12 }, 12 13 "position": { 13 14 "type": "string", 14 - "enum": ["yes", "no"] 15 + "enum": ["yes", "no"], 16 + "maxLength": 3, 17 + "minLength": 2 15 18 }, 16 19 "createdAt": { 17 20 "type": "string", ··· 26 29 }, 27 30 "description": "The record containing a Bet placed on a Cumulus Market", 28 31 "id": "za.co.ciaran.cumulus.bet", 29 - "lexicon": 1, 30 - "revision": 1 32 + "lexicon": 1 31 33 }
+2 -2
generated/json/za/co/ciaran/cumulus/market.json
··· 1 1 { 2 2 "defs": { 3 3 "main": { 4 + "description": "The record containing a Cumulus Market", 4 5 "key": "tid", 5 6 "record": { 6 7 "properties": { ··· 29 30 }, 30 31 "description": "The record containing a Cumulus Market", 31 32 "id": "za.co.ciaran.cumulus.market", 32 - "lexicon": 1, 33 - "revision": 1 33 + "lexicon": 1 34 34 }
+5 -3
generated/json/za/co/ciaran/cumulus/resolution.json
··· 1 1 { 2 2 "defs": { 3 3 "main": { 4 + "description": "The record containing the Resolution for a Cumulus Market", 4 5 "key": "tid", 5 6 "record": { 6 7 "properties": { ··· 11 12 }, 12 13 "answer": { 13 14 "type": "string", 14 - "enum": ["yes", "no"] 15 + "enum": ["yes", "no"], 16 + "maxLength": 3, 17 + "minLength": 2 15 18 }, 16 19 "createdAt": { 17 20 "type": "string", ··· 26 29 }, 27 30 "description": "The record containing the Resolution for a Cumulus Market", 28 31 "id": "za.co.ciaran.cumulus.resolution", 29 - "lexicon": 1, 30 - "revision": 1 32 + "lexicon": 1 31 33 }
+4
generated/typescript/types/za/co/ciaran/cumulus/bet.ts
··· 14 14 get market() { 15 15 return ComAtprotoRepoStrongRef.mainSchema; 16 16 }, 17 + /** 18 + * @minLength 2 19 + * @maxLength 3 20 + */ 17 21 position: /*#__PURE__*/ v.literalEnum(["no", "yes"]), 18 22 }), 19 23 );
+4
generated/typescript/types/za/co/ciaran/cumulus/resolution.ts
··· 7 7 /*#__PURE__*/ v.tidString(), 8 8 /*#__PURE__*/ v.object({ 9 9 $type: /*#__PURE__*/ v.literal("za.co.ciaran.cumulus.resolution"), 10 + /** 11 + * @minLength 2 12 + * @maxLength 3 13 + */ 10 14 answer: /*#__PURE__*/ v.literalEnum(["no", "yes"]), 11 15 createdAt: /*#__PURE__*/ v.datetimeString(), 12 16 /**
+2 -1
package.json
··· 2 2 "name": "cumulus-prediction-market", 3 3 "scripts": { 4 4 "jetstream:dev": "bun --watch src/jetstream/index.ts", 5 - "generate:lex": "bun lex-cli export && bun lex-cli generate", 5 + "lex:lint": "goat lex lint generated/", 6 + "lex:generate": "bun lex-cli export && bun lex-cli generate", 6 7 "test": "bun run vitest" 7 8 }, 8 9 "devDependencies": {
+9 -7
src/lexicon/bet.ts
··· 1 1 import { document, object, record, ref, required, string } from "@atcute/lexicon-doc/builder"; 2 2 3 + const data = { 4 + description: 'The record containing a Bet placed on a Cumulus Market', 5 + marketRefDescription: 'The record containing the Cumulus Market for this Bet' 6 + } 7 + 3 8 export default document({ 4 9 id: 'za.co.ciaran.cumulus.bet', 5 - description: 'The record containing a Bet placed on a Cumulus Market', 6 - revision: 1, 10 + description: data.description, 7 11 defs: { 8 12 main: record({ 9 13 key: 'tid', 14 + description: data.description, 10 15 record: object({ 11 16 properties: { 12 - market: required(ref({ 13 - ref: 'com.atproto.repo.strongRef', 14 - description: 'The record containing the Cumulus Market for this Bet', 15 - })), 16 - position: required(string({ enum: ["yes", "no"] })), 17 + market: required(ref({ ref: 'com.atproto.repo.strongRef', description: data.marketRefDescription })), 18 + position: required(string({ enum: ["yes", "no"], minLength: 2, maxLength: 3 })), 17 19 createdAt: required(string({ format: "datetime" })), 18 20 } 19 21 })
+6 -2
src/lexicon/market.ts
··· 1 1 import { document, integer, object, record, required, string } from "@atcute/lexicon-doc/builder"; 2 2 3 + const data = { 4 + description: 'The record containing a Cumulus Market', 5 + } 6 + 3 7 export default document({ 4 8 id: 'za.co.ciaran.cumulus.market', 5 - description: 'The record containing a Cumulus Market', 6 - revision: 1, 9 + description: data.description, 7 10 defs: { 8 11 main: record({ 9 12 key: 'tid', 13 + description: 'The record containing a Cumulus Market', 10 14 record: object({ 11 15 properties: { 12 16 question: required(string({ maxLength: 140 })),
+9 -7
src/lexicon/resolution.ts
··· 1 1 import { document, object, record, required, string, ref } from "@atcute/lexicon-doc/builder"; 2 2 3 + const data = { 4 + description: 'The record containing the Resolution for a Cumulus Market', 5 + marketRefDescription: 'The record containing the Cumulus Market for this Resolution' 6 + } 7 + 3 8 export default document({ 4 9 id: 'za.co.ciaran.cumulus.resolution', 5 - description: 'The record containing the Resolution for a Cumulus Market', 6 - revision: 1, 10 + description: data.description, 7 11 defs: { 8 12 main: record({ 9 13 key: 'tid', 14 + description: data.description, 10 15 record: object({ 11 16 properties: { 12 - market: required(ref({ 13 - ref: 'com.atproto.repo.strongRef', 14 - description: 'The record containing the Cumulus Market for this Resolution', 15 - })), 16 - answer: required(string({ enum: ["yes", "no"] })), 17 + market: required(ref({ ref: 'com.atproto.repo.strongRef', description: data.marketRefDescription })), 18 + answer: required(string({ enum: ["yes", "no"], minLength: 2, maxLength: 3 })), 17 19 createdAt: required(string({ format: "datetime" })), 18 20 } 19 21 })