Music streaming on ATProto!

feat: add package for messing around with inserting records manually

ovyerus.com 68ac199c feca8ceb

verified
+26 -1
bun.lock
···
"packages/lexicons": {
"name": "@comet/lexicons",
"dependencies": {
+
"@atcute/lexicons": "^1.0.3",
+
},
+
"devDependencies": {
"@atcute/lex-cli": "^2.0.2",
-
"@atcute/lexicons": "^1.0.3",
+
"@types/bun": "latest",
+
},
+
"peerDependencies": {
+
"typescript": "^5",
+
},
+
},
+
"packages/test": {
+
"name": "test",
+
"dependencies": {
+
"@atcute/atproto": "^3.0.2",
+
"@atcute/bluesky": "^3.0.2",
+
"@atcute/client": "^4.0.2",
+
"@comet/lexicons": "workspace:",
},
"devDependencies": {
"@types/bun": "latest",
···
},
"packages": {
"@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
+
+
"@atcute/atproto": ["@atcute/atproto@3.0.2", "", { "dependencies": { "@atcute/lexicons": "^1.0.2" } }, "sha512-p37GqTmrxc1XaxtX8JsePEuomL+PtDeGdy0lcBm+HisD03ZZTia7MouxUpnYezX0l926fFaDc9tllIBtX9iSsQ=="],
+
+
"@atcute/bluesky": ["@atcute/bluesky@3.0.2", "", { "dependencies": { "@atcute/atproto": "^3.0.2", "@atcute/lexicons": "^1.0.2" } }, "sha512-xDRu/8Rlu3uTG/Mf625vUvKiFvy3hdCE371pXSJpHofivNZxi+MburdmYgOsBWZstNMo4vTBUviWaLJpL23rFg=="],
+
+
"@atcute/client": ["@atcute/client@4.0.2", "", { "dependencies": { "@atcute/identity": "^1.0.2", "@atcute/lexicons": "^1.0.2" } }, "sha512-AOs6DEm59I0+wt8JOEOjKQLtBYZMML9p40pxaEWqP/ukAlhYUfLc9Geby5CMBmh7TchQCMCSHQzrY/lDs026Bw=="],
+
+
"@atcute/identity": ["@atcute/identity@1.0.2", "", { "dependencies": { "@atcute/lexicons": "^1.0.2", "@badrap/valita": "^0.4.4" } }, "sha512-SrDPHuEarEHj9bx7NfYn7DYG6kIgJIMRU581iOCIaVaiZ1WhE9D8QxTxeYG/rbGNSa85E891ECp1sQcKiBN0kg=="],
"@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=="],
···
"tapable": ["tapable@2.2.1", "", {}, "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="],
"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=="],
+
+
"test": ["test@workspace:packages/test"],
"tinyglobby": ["tinyglobby@0.2.13", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw=="],
+36
packages/test/.gitignore
···
+
# dependencies (bun install)
+
node_modules
+
+
# output
+
out
+
dist
+
*.tgz
+
+
# code coverage
+
coverage
+
*.lcov
+
+
# logs
+
logs
+
_.log
+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
+
+
# dotenv environment variable files
+
.env
+
.env.development.local
+
.env.test.local
+
.env.production.local
+
.env.local
+
+
# caches
+
.eslintcache
+
.cache
+
*.tsbuildinfo
+
+
# IntelliJ based IDEs
+
.idea
+
+
# Finder (MacOS) folder config
+
.DS_Store
+
+
*.opus
+15
packages/test/README.md
···
+
# test
+
+
To install dependencies:
+
+
```bash
+
bun install
+
```
+
+
To run:
+
+
```bash
+
bun run index.ts
+
```
+
+
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
···
+
import { Client, CredentialManager, ok } from "@atcute/client";
+
+
import type {} from "@atcute/bluesky";
+
import type {} from "@atcute/atproto";
+
import { ShCometV0FeedPlaylist, ShCometV0FeedTrack } from "@comet/lexicons";
+
+
// const manager = new CredentialManager({ service: "https://pds.ovy.sh" });
+
const manager = new CredentialManager({ service: "https://bsky.social" });
+
const rpc = new Client({ handler: manager });
+
+
await manager.login({
+
identifier: Bun.env.COMET_TEST_IDENT!,
+
password: Bun.env.COMET_TEST_PASSWORD!,
+
});
+
+
// const inputAudio = Bun.file("./test-track.opus");
+
// const { blob: audio } = await ok(
+
// rpc.post("com.atproto.repo.uploadBlob", { input: inputAudio }),
+
// );
+
+
// const audio = {
+
// $type: "blob",
+
// ref: {
+
// $link: "bafkreifiu63dr52dxzrurnspha5xvzlzqkho3hdzdhu6zvthrrvdpd6yve",
+
// },
+
// mimeType: "audio/opus",
+
// size: 3349806,
+
// } as const;
+
+
// const track: ShCometV0FeedTrack.Main = {
+
// $type: "sh.comet.v0.feed.track",
+
// audio,
+
// title: "Testing Track 5",
+
// createdAt: new Date().toJSON(),
+
// };
+
+
// const response = await ok(
+
// rpc.post("com.atproto.repo.createRecord", {
+
// input: {
+
// collection: track.$type,
+
// repo: manager.session!.did,
+
// record: track,
+
// },
+
// }),
+
// );
+
+
const playlist: ShCometV0FeedPlaylist.Main = {
+
$type: "sh.comet.v0.feed.playlist",
+
tracks: [
+
"at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2gsib2s2e",
+
"at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2muqtnu2w",
+
"at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2njjm6p2y",
+
"at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2nrehj52o",
+
"at://did:plc:jrrhosrfzgjf6v4oydav6ftb/sh.comet.v0.feed.track/3lpq2nnacyg23",
+
],
+
title: "Testing Playlist",
+
type: "sh.comet.v0.feed.playlist#playlist",
+
createdAt: new Date().toJSON(),
+
};
+
+
const response = await ok(
+
rpc.post("com.atproto.repo.createRecord", {
+
input: {
+
collection: playlist.$type,
+
repo: manager.session!.did,
+
record: playlist,
+
},
+
}),
+
);
+
+
console.log(response);
+18
packages/test/package.json
···
+
{
+
"name": "test",
+
"module": "index.ts",
+
"type": "module",
+
"private": true,
+
"devDependencies": {
+
"@types/bun": "latest"
+
},
+
"peerDependencies": {
+
"typescript": "^5"
+
},
+
"dependencies": {
+
"@atcute/atproto": "^3.0.2",
+
"@atcute/bluesky": "^3.0.2",
+
"@atcute/client": "^4.0.2",
+
"@comet/lexicons": "workspace:*"
+
}
+
}
+28
packages/test/tsconfig.json
···
+
{
+
"compilerOptions": {
+
// Environment setup & latest features
+
"lib": ["ESNext"],
+
"target": "ESNext",
+
"module": "ESNext",
+
"moduleDetection": "force",
+
"jsx": "react-jsx",
+
"allowJs": true,
+
+
// Bundler mode
+
"moduleResolution": "bundler",
+
"allowImportingTsExtensions": true,
+
"verbatimModuleSyntax": true,
+
"noEmit": true,
+
+
// Best practices
+
"strict": true,
+
"skipLibCheck": true,
+
"noFallthroughCasesInSwitch": true,
+
"noUncheckedIndexedAccess": true,
+
+
// Some stricter flags (disabled by default)
+
"noUnusedLocals": false,
+
"noUnusedParameters": false,
+
"noPropertyAccessFromIndexSignature": false
+
}
+
}