social bookmarking for atproto

[lexicons] make createdAt required in social.clippr.actor.profile

hexmani.ac 89702178 7b56723f

verified
+129 -62
+2
.idea/dictionaries/project.xml
··· 7 7 <w>atproto</w> 8 8 <w>bsky</w> 9 9 <w>clippr</w> 10 + <w>clipprjs</w> 10 11 <w>dids</w> 11 12 <w>hono</w> 12 13 <w>jetstream</w> 13 14 <w>multiformats</w> 14 15 <w>rkey</w> 15 16 <w>tseslint</w> 17 + <w>xrpc</w> 16 18 </words> 17 19 </dictionary> 18 20 </component>
+1
backend/.gitignore
··· 3 3 config.toml 4 4 *.db 5 5 dist/ 6 + logs/ 6 7 clippr-*.log
+1 -1
backend/src/main.ts
··· 42 42 process.once("SIGTERM", () => gracefulShutdown("SIGTERM")); 43 43 44 44 function gracefulShutdown(signal: string) { 45 - logger.info(`\nreceived ${signal}, shutting down...`); 45 + logger.info(`received ${signal}, shutting down...`); 46 46 stopFirehose(); 47 47 server.close(); 48 48 logger.info("server shut down, bye!");
+28 -27
backend/tsconfig.json
··· 1 1 { 2 - "compilerOptions": { 3 - "allowImportingTsExtensions": true, 4 - "esModuleInterop": true, 5 - "skipLibCheck": true, 6 - "target": "ESNext", 7 - "module": "NodeNext", 8 - "moduleResolution": "NodeNext", 9 - "allowJs": true, 10 - "resolveJsonModule": true, 11 - "moduleDetection": "force", 12 - "isolatedModules": true, 13 - "verbatimModuleSyntax": true, 14 - "types": [ 15 - "node", 16 - "@atcute/atproto" 17 - ], 18 - "strict": true, 19 - "noUncheckedIndexedAccess": true, 20 - "noImplicitOverride": true, 21 - "noEmit": true, 22 - "jsx": "react-jsx", 23 - "jsxImportSource": "hono/jsx", 24 - "outDir": "dist/", 25 - "lib": [ 26 - "ESNext" 27 - ] 28 - }, 2 + "compilerOptions": { 3 + "allowImportingTsExtensions": true, 4 + "esModuleInterop": true, 5 + "skipLibCheck": true, 6 + "target": "ESNext", 7 + "module": "NodeNext", 8 + "moduleResolution": "NodeNext", 9 + "allowJs": true, 10 + "resolveJsonModule": true, 11 + "moduleDetection": "force", 12 + "isolatedModules": true, 13 + "verbatimModuleSyntax": true, 14 + "types": [ 15 + "node", 16 + "@atcute/atproto", 17 + "@clipprjs/lexicons" 18 + ], 19 + "strict": true, 20 + "noUncheckedIndexedAccess": true, 21 + "noImplicitOverride": true, 22 + "noEmit": true, 23 + "jsx": "react-jsx", 24 + "jsxImportSource": "hono/jsx", 25 + "outDir": "dist/", 26 + "lib": [ 27 + "ESNext" 28 + ] 29 + }, 29 30 "exclude": [ 30 31 "node_modules" 31 32 ]
+3
lexdocs/clippr/social/clippr/actor/profile.json
··· 8 8 "key": "literal:self", 9 9 "record": { 10 10 "type": "object", 11 + "required": [ 12 + "createdAt" 13 + ], 11 14 "properties": { 12 15 "displayName": { 13 16 "type": "string",
+61 -1
lexicons/README.md
··· 1 1 # @clipprjs/lexicons 2 2 3 - lexicon package auto-generated with `@atcute/lex-cli` 3 + Lexicon package auto-generated with `@atcute/lex-cli` 4 + 5 + > [!WARNING] 6 + > This package is *very* unstable. Lexicon attributes can be modified at any moment. 7 + > Please do not use this package for anything until the [Clippr server](https://tangled.sh/@hexmani.ac/clippr) has been 8 + > deployed. 9 + 10 + ## Usage 11 + 12 + > [!NOTE] 13 + > This section has been shamelessly lifted from 14 + > the [atcute definitions](https://github.com/mary-ext/atcute/tree/trunk/packages/definitions/bluesky) packages. We 15 + > recommend using this package with other atcute libraries for maximum compatibility. 16 + 17 + ```ts 18 + import {SocialClipprFeedClip} from '@clipprjs/lexicons'; 19 + import {is} from '@atcute/lexicons'; 20 + 21 + const record: SocialClipprFeedClip.Main = { 22 + $type: 'social.clippr.feed.clip', 23 + createdAt: "2025-07-08T12:34:56.123Z", 24 + url: "https://example.com", 25 + title: "Example page", 26 + description: "Example description", 27 + unlisted: false, 28 + notes: "This is an example note for a clip", 29 + tags: undefined, 30 + unread: true, 31 + languages: [ 32 + "en" 33 + ] 34 + }; 35 + 36 + is(SocialClipprFeedClip.mainSchema, record); 37 + // -> true 38 + ``` 39 + 40 + ### Using with `@atcute/client` 41 + 42 + Pick either one of these three options to register the ambient declarations: 43 + 44 + ```jsonc 45 + // tsconfig.json 46 + { 47 + "compilerOptions": { 48 + "types": ["@clipprjs/lexicons"], 49 + }, 50 + } 51 + ``` 52 + 53 + ```ts 54 + // env.d.ts 55 + /// <reference types="@clipprjs/lexicons" /> 56 + ``` 57 + 58 + ```ts 59 + // index.ts 60 + import type {} from '@clipprjs/lexicons'; 61 + ``` 62 + 63 + All the XRPC operations should be visible in the client afterward.
+1 -1
lexicons/lib/lexicons/types/social/clippr/actor/profile.ts
··· 11 11 /*#__PURE__*/ v.object({ 12 12 $type: /*#__PURE__*/ v.literal("social.clippr.actor.profile"), 13 13 avatar: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.blob()), 14 - createdAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), 14 + createdAt: /*#__PURE__*/ v.datetimeString(), 15 15 description: /*#__PURE__*/ v.optional( 16 16 /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 17 17 /*#__PURE__*/ v.stringLength(0, 5000),
+32 -32
lexicons/package.json
··· 1 1 { 2 - "type": "module", 3 - "name": "@clipprjs/lexicons", 2 + "type": "module", 3 + "name": "@clipprjs/lexicons", 4 4 "version": "0.1.2", 5 - "description": "Clippr schema definitions", 6 - "license": "AGPL-3.0-only", 7 - "private": false, 8 - "repository": { 9 - "url": "https://tangled.sh/@hexmani.ac/clippr", 10 - "directory": "lexicons" 11 - }, 5 + "description": "Clippr schema definitions", 6 + "license": "AGPL-3.0-only", 7 + "private": false, 8 + "repository": { 9 + "url": "https://tangled.sh/@hexmani.ac/clippr", 10 + "directory": "lexicons" 11 + }, 12 12 "keywords": [ 13 13 "atproto", 14 14 "clippr" 15 15 ], 16 - "files": [ 17 - "dist/", 18 - "lib/", 19 - "!lib/**/*.bench.ts", 20 - "!lib/**/*.test.ts" 21 - ], 22 - "exports": { 23 - ".": "./dist/index.js", 24 - "./types/social/*": "./dist/lexicons/types/social/clippr/*.js" 25 - }, 26 - "scripts": { 27 - "build": "tsc --project tsconfig.json", 28 - "generate": "rm -r lib/lexicons; lex-cli generate -c ./lex.config.ts", 29 - "prepublish": "rm -rf dist; pnpm run build" 30 - }, 31 - "dependencies": { 32 - "@atcute/atproto": "^3.1.0", 33 - "@atcute/lexicons": "^1.1.0" 34 - }, 35 - "devDependencies": { 36 - "@atcute/lex-cli": "^2.1.1", 37 - "typescript": "^5.8.3" 38 - } 16 + "files": [ 17 + "dist/", 18 + "lib/", 19 + "!lib/**/*.bench.ts", 20 + "!lib/**/*.test.ts" 21 + ], 22 + "exports": { 23 + ".": "./dist/index.js", 24 + "./types/social/*": "./dist/lexicons/types/social/clippr/*.js" 25 + }, 26 + "scripts": { 27 + "build": "tsc --project tsconfig.json", 28 + "generate": "rm -r lib/lexicons; lex-cli generate -c ./lex.config.ts", 29 + "prepublish": "rm -rf dist; pnpm run build" 30 + }, 31 + "dependencies": { 32 + "@atcute/atproto": "^3.1.0", 33 + "@atcute/lexicons": "^1.1.0" 34 + }, 35 + "devDependencies": { 36 + "@atcute/lex-cli": "^2.1.1", 37 + "typescript": "^5.8.3" 38 + } 39 39 }