Music streaming on ATProto!

feat: add package for messing around with inserting records manually

ovyerus.com 68ac199c feca8ceb

verified
+26 -1
bun.lock
··· 42 42 "packages/lexicons": { 43 43 "name": "@comet/lexicons", 44 44 "dependencies": { 45 + "@atcute/lexicons": "^1.0.3", 46 + }, 47 + "devDependencies": { 45 48 "@atcute/lex-cli": "^2.0.2", 46 - "@atcute/lexicons": "^1.0.3", 49 + "@types/bun": "latest", 50 + }, 51 + "peerDependencies": { 52 + "typescript": "^5", 53 + }, 54 + }, 55 + "packages/test": { 56 + "name": "test", 57 + "dependencies": { 58 + "@atcute/atproto": "^3.0.2", 59 + "@atcute/bluesky": "^3.0.2", 60 + "@atcute/client": "^4.0.2", 61 + "@comet/lexicons": "workspace:", 47 62 }, 48 63 "devDependencies": { 49 64 "@types/bun": "latest", ··· 55 70 }, 56 71 "packages": { 57 72 "@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="], 73 + 74 + "@atcute/atproto": ["@atcute/atproto@3.0.2", "", { "dependencies": { "@atcute/lexicons": "^1.0.2" } }, "sha512-p37GqTmrxc1XaxtX8JsePEuomL+PtDeGdy0lcBm+HisD03ZZTia7MouxUpnYezX0l926fFaDc9tllIBtX9iSsQ=="], 75 + 76 + "@atcute/bluesky": ["@atcute/bluesky@3.0.2", "", { "dependencies": { "@atcute/atproto": "^3.0.2", "@atcute/lexicons": "^1.0.2" } }, "sha512-xDRu/8Rlu3uTG/Mf625vUvKiFvy3hdCE371pXSJpHofivNZxi+MburdmYgOsBWZstNMo4vTBUviWaLJpL23rFg=="], 77 + 78 + "@atcute/client": ["@atcute/client@4.0.2", "", { "dependencies": { "@atcute/identity": "^1.0.2", "@atcute/lexicons": "^1.0.2" } }, "sha512-AOs6DEm59I0+wt8JOEOjKQLtBYZMML9p40pxaEWqP/ukAlhYUfLc9Geby5CMBmh7TchQCMCSHQzrY/lDs026Bw=="], 79 + 80 + "@atcute/identity": ["@atcute/identity@1.0.2", "", { "dependencies": { "@atcute/lexicons": "^1.0.2", "@badrap/valita": "^0.4.4" } }, "sha512-SrDPHuEarEHj9bx7NfYn7DYG6kIgJIMRU581iOCIaVaiZ1WhE9D8QxTxeYG/rbGNSa85E891ECp1sQcKiBN0kg=="], 58 81 59 82 "@atcute/lex-cli": ["@atcute/lex-cli@2.0.2", "", { "dependencies": { "@atcute/lexicon-doc": "^1.0.1", "@badrap/valita": "^0.4.4", "@externdefs/collider": "^0.3.0", "picocolors": "^1.1.1", "prettier": "^3.5.3" }, "bin": { "lex-cli": "cli.mjs" } }, "sha512-GdudG2F4FKgFLdE7pB+aj2JOprCHkjlYtG1/rJriHKUZ5CPPfhd8A/+xMXaf9qoNqtyK4L7G3GYpd2PnS9bF8Q=="], 60 83 ··· 585 608 "tapable": ["tapable@2.2.1", "", {}, "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="], 586 609 587 610 "tar": ["tar@7.4.3", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.0.1", "mkdirp": "^3.0.1", "yallist": "^5.0.0" } }, "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw=="], 611 + 612 + "test": ["test@workspace:packages/test"], 588 613 589 614 "tinyglobby": ["tinyglobby@0.2.13", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw=="], 590 615
+36
packages/test/.gitignore
··· 1 + # dependencies (bun install) 2 + node_modules 3 + 4 + # output 5 + out 6 + dist 7 + *.tgz 8 + 9 + # code coverage 10 + coverage 11 + *.lcov 12 + 13 + # logs 14 + logs 15 + _.log 16 + report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 17 + 18 + # dotenv environment variable files 19 + .env 20 + .env.development.local 21 + .env.test.local 22 + .env.production.local 23 + .env.local 24 + 25 + # caches 26 + .eslintcache 27 + .cache 28 + *.tsbuildinfo 29 + 30 + # IntelliJ based IDEs 31 + .idea 32 + 33 + # Finder (MacOS) folder config 34 + .DS_Store 35 + 36 + *.opus
+15
packages/test/README.md
··· 1 + # test 2 + 3 + To install dependencies: 4 + 5 + ```bash 6 + bun install 7 + ``` 8 + 9 + To run: 10 + 11 + ```bash 12 + bun run index.ts 13 + ``` 14 + 15 + This project was created using `bun init` in bun v1.2.8. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
+71
packages/test/index.ts
··· 1 + import { Client, CredentialManager, ok } from "@atcute/client"; 2 + 3 + import type {} from "@atcute/bluesky"; 4 + import type {} from "@atcute/atproto"; 5 + import { ShCometV0FeedPlaylist, ShCometV0FeedTrack } from "@comet/lexicons"; 6 + 7 + // const manager = new CredentialManager({ service: "https://pds.ovy.sh" }); 8 + const manager = new CredentialManager({ service: "https://bsky.social" }); 9 + const rpc = new Client({ handler: manager }); 10 + 11 + await manager.login({ 12 + identifier: Bun.env.COMET_TEST_IDENT!, 13 + password: Bun.env.COMET_TEST_PASSWORD!, 14 + }); 15 + 16 + // const inputAudio = Bun.file("./test-track.opus"); 17 + // const { blob: audio } = await ok( 18 + // rpc.post("com.atproto.repo.uploadBlob", { input: inputAudio }), 19 + // ); 20 + 21 + // const audio = { 22 + // $type: "blob", 23 + // ref: { 24 + // $link: "bafkreifiu63dr52dxzrurnspha5xvzlzqkho3hdzdhu6zvthrrvdpd6yve", 25 + // }, 26 + // mimeType: "audio/opus", 27 + // size: 3349806, 28 + // } as const; 29 + 30 + // const track: ShCometV0FeedTrack.Main = { 31 + // $type: "sh.comet.v0.feed.track", 32 + // audio, 33 + // title: "Testing Track 5", 34 + // createdAt: new Date().toJSON(), 35 + // }; 36 + 37 + // const response = await ok( 38 + // rpc.post("com.atproto.repo.createRecord", { 39 + // input: { 40 + // collection: track.$type, 41 + // repo: manager.session!.did, 42 + // record: track, 43 + // }, 44 + // }), 45 + // ); 46 + 47 + const playlist: ShCometV0FeedPlaylist.Main = { 48 + $type: "sh.comet.v0.feed.playlist", 49 + tracks: [ 50 + "at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2gsib2s2e", 51 + "at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2muqtnu2w", 52 + "at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2njjm6p2y", 53 + "at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2nrehj52o", 54 + "at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2nnacyg23", 55 + ], 56 + title: "Testing Playlist", 57 + type: "sh.comet.v0.feed.playlist#playlist", 58 + createdAt: new Date().toJSON(), 59 + }; 60 + 61 + const response = await ok( 62 + rpc.post("com.atproto.repo.createRecord", { 63 + input: { 64 + collection: playlist.$type, 65 + repo: manager.session!.did, 66 + record: playlist, 67 + }, 68 + }), 69 + ); 70 + 71 + console.log(response);
+18
packages/test/package.json
··· 1 + { 2 + "name": "test", 3 + "module": "index.ts", 4 + "type": "module", 5 + "private": true, 6 + "devDependencies": { 7 + "@types/bun": "latest" 8 + }, 9 + "peerDependencies": { 10 + "typescript": "^5" 11 + }, 12 + "dependencies": { 13 + "@atcute/atproto": "^3.0.2", 14 + "@atcute/bluesky": "^3.0.2", 15 + "@atcute/client": "^4.0.2", 16 + "@comet/lexicons": "workspace:*" 17 + } 18 + }
+28
packages/test/tsconfig.json
··· 1 + { 2 + "compilerOptions": { 3 + // Environment setup & latest features 4 + "lib": ["ESNext"], 5 + "target": "ESNext", 6 + "module": "ESNext", 7 + "moduleDetection": "force", 8 + "jsx": "react-jsx", 9 + "allowJs": true, 10 + 11 + // Bundler mode 12 + "moduleResolution": "bundler", 13 + "allowImportingTsExtensions": true, 14 + "verbatimModuleSyntax": true, 15 + "noEmit": true, 16 + 17 + // Best practices 18 + "strict": true, 19 + "skipLibCheck": true, 20 + "noFallthroughCasesInSwitch": true, 21 + "noUncheckedIndexedAccess": true, 22 + 23 + // Some stricter flags (disabled by default) 24 + "noUnusedLocals": false, 25 + "noUnusedParameters": false, 26 + "noPropertyAccessFromIndexSignature": false 27 + } 28 + }