@clioplaylists/clio 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/com/clioplaylists/alpha/feed/getRecommendedPlaylistsByUser.d.ts +3 -0
- package/dist/api/com/clioplaylists/alpha/feed/getRecommendedPlaylistsByUser.js +70 -0
- package/dist/api/health.js +10 -3
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +40 -2
- package/dist/api/oauth.d.ts +3 -0
- package/dist/api/oauth.js +63 -0
- package/dist/api/util.d.ts +1 -0
- package/dist/api/util.js +11 -6
- package/dist/api/well-known.d.ts +3 -0
- package/dist/api/well-known.js +35 -0
- package/dist/auth-verifier.d.ts +17 -4
- package/dist/auth-verifier.js +171 -165
- package/dist/client.js +15 -8
- package/dist/config.d.ts +23 -0
- package/dist/config.js +87 -7
- package/dist/context.d.ts +14 -0
- package/dist/context.js +17 -1
- package/dist/dataplane/client/hosts.d.ts +21 -0
- package/dist/dataplane/client/hosts.js +29 -0
- package/dist/dataplane/client/index.d.ts +13 -0
- package/dist/dataplane/client/index.js +120 -0
- package/dist/dataplane/client/util.d.ts +20 -0
- package/dist/dataplane/client/util.js +92 -0
- package/dist/dataplane/index.js +18 -2
- package/dist/dataplane/server/background.d.ts +1 -1
- package/dist/dataplane/server/background.js +12 -5
- package/dist/dataplane/server/db/database-schema.d.ts +5 -1
- package/dist/dataplane/server/db/database-schema.js +2 -1
- package/dist/dataplane/server/db/db.js +60 -20
- package/dist/dataplane/server/db/index.js +17 -1
- package/dist/dataplane/server/db/migrations/20250515T045948368Z-init.d.ts +3 -0
- package/dist/dataplane/server/db/migrations/20250515T045948368Z-init.js +170 -0
- package/dist/dataplane/server/db/migrations/20260119T210000000Z-song-recommendation.d.ts +3 -0
- package/dist/dataplane/server/db/migrations/20260119T210000000Z-song-recommendation.js +36 -0
- package/dist/dataplane/server/db/migrations/20260119T220000000Z-oauth.d.ts +3 -0
- package/dist/dataplane/server/db/migrations/20260119T220000000Z-oauth.js +25 -0
- package/dist/dataplane/server/db/migrations/index.d.ts +3 -2
- package/dist/dataplane/server/db/migrations/index.js +39 -2
- package/dist/dataplane/server/db/migrations/provider.js +5 -1
- package/dist/dataplane/server/db/pagination.d.ts +1 -1
- package/dist/dataplane/server/db/pagination.js +38 -25
- package/dist/dataplane/server/db/tables/actor-sync.d.ts +2 -2
- package/dist/dataplane/server/db/tables/actor-sync.js +4 -1
- package/dist/dataplane/server/db/tables/actor.d.ts +3 -3
- package/dist/dataplane/server/db/tables/actor.js +4 -1
- package/dist/dataplane/server/db/tables/artist-list-item.d.ts +2 -2
- package/dist/dataplane/server/db/tables/artist-list-item.js +4 -1
- package/dist/dataplane/server/db/tables/artist.js +4 -1
- package/dist/dataplane/server/db/tables/oauth-session.d.ts +9 -0
- package/dist/dataplane/server/db/tables/oauth-session.js +4 -0
- package/dist/dataplane/server/db/tables/oauth-state.d.ts +10 -0
- package/dist/dataplane/server/db/tables/oauth-state.js +4 -0
- package/dist/dataplane/server/db/tables/playlist-idea.d.ts +3 -3
- package/dist/dataplane/server/db/tables/playlist-idea.js +4 -1
- package/dist/dataplane/server/db/tables/playlist-item.js +4 -1
- package/dist/dataplane/server/db/tables/playlist.d.ts +1 -0
- package/dist/dataplane/server/db/tables/playlist.js +4 -1
- package/dist/dataplane/server/db/tables/profile.d.ts +5 -5
- package/dist/dataplane/server/db/tables/profile.js +4 -1
- package/dist/dataplane/server/db/tables/record.d.ts +1 -1
- package/dist/dataplane/server/db/tables/record.js +4 -1
- package/dist/dataplane/server/db/tables/song-recommendation.d.ts +17 -0
- package/dist/dataplane/server/db/tables/song-recommendation.js +4 -0
- package/dist/dataplane/server/db/tables/song.d.ts +2 -2
- package/dist/dataplane/server/db/tables/song.js +4 -1
- package/dist/dataplane/server/db/tables/subscription-cursor.d.ts +9 -0
- package/dist/dataplane/server/db/tables/subscription-cursor.js +4 -0
- package/dist/dataplane/server/db/types.js +2 -1
- package/dist/dataplane/server/db/util.d.ts +7 -3
- package/dist/dataplane/server/db/util.js +26 -18
- package/dist/dataplane/server/index.js +21 -13
- package/dist/dataplane/server/indexing/index.d.ts +2 -0
- package/dist/dataplane/server/indexing/index.js +82 -66
- package/dist/dataplane/server/indexing/plugins/playlist-idea.d.ts +1 -2
- package/dist/dataplane/server/indexing/plugins/playlist-idea.js +50 -41
- package/dist/dataplane/server/indexing/plugins/profile.js +45 -12
- package/dist/dataplane/server/indexing/plugins/song-recommendation.d.ts +9 -0
- package/dist/dataplane/server/indexing/plugins/song-recommendation.js +101 -0
- package/dist/dataplane/server/indexing/processor.js +12 -11
- package/dist/dataplane/server/routes/identity.d.ts +19 -0
- package/dist/dataplane/server/routes/identity.js +32 -25
- package/dist/dataplane/server/routes/index.js +15 -10
- package/dist/dataplane/server/routes/profile.js +17 -25
- package/dist/dataplane/server/routes/records.d.ts +18 -0
- package/dist/dataplane/server/routes/records.js +48 -22
- package/dist/dataplane/server/routes/sync.js +5 -3
- package/dist/dataplane/server/storage/subscription-cursor.d.ts +3 -0
- package/dist/dataplane/server/storage/subscription-cursor.js +25 -0
- package/dist/dataplane/server/subscription.d.ts +6 -3
- package/dist/dataplane/server/subscription.js +73 -63
- package/dist/error.js +9 -5
- package/dist/index.d.ts +8 -3
- package/dist/index.js +96 -27
- package/dist/lexicons/index.d.ts +3 -210
- package/dist/lexicons/index.js +26 -403
- package/dist/lexicons/lexicons.d.ts +409 -8107
- package/dist/lexicons/lexicons.js +134 -4276
- package/dist/lexicons/types/com/atproto/repo/strongRef.d.ts +4 -4
- package/dist/lexicons/types/com/atproto/repo/strongRef.js +13 -9
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.d.ts +10 -8
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.js +13 -9
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.d.ts +20 -11
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.js +29 -14
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getRecommendedPlaylistsByUser.d.ts +36 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getRecommendedPlaylistsByUser.js +6 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.d.ts +11 -14
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.js +20 -23
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/recommendedPlaylist.d.ts +18 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/recommendedPlaylist.js +15 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/songRecommendation.d.ts +18 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/songRecommendation.js +15 -0
- package/dist/lexicons/util.d.ts +33 -2
- package/dist/lexicons/util.js +32 -4
- package/dist/logger.js +16 -10
- package/dist/oauth/client.d.ts +14 -0
- package/dist/oauth/client.js +126 -0
- package/dist/oauth/pds-agent.d.ts +3 -0
- package/dist/oauth/pds-agent.js +15 -0
- package/dist/rpc/clio_connect.d.ts +101 -11
- package/dist/rpc/clio_connect.js +138 -45
- package/dist/rpc/clio_pb.d.ts +448 -30
- package/dist/rpc/clio_pb.js +967 -272
- package/dist/start.js +9 -1
- package/dist/util/retry.js +10 -9
- package/dist/util/uris.js +6 -3
- package/dist/util.d.ts +0 -1
- package/dist/util.js +61 -20
- package/package.json +26 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
|
-
import { ValidationResult } from '@atproto/lexicon';
|
|
4
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
|
5
5
|
export interface Main {
|
|
6
|
+
$type?: 'com.atproto.repo.strongRef';
|
|
6
7
|
uri: string;
|
|
7
8
|
cid: string;
|
|
8
|
-
[k: string]: unknown;
|
|
9
9
|
}
|
|
10
|
-
export declare function isMain(v:
|
|
11
|
-
export declare function validateMain(v:
|
|
10
|
+
export declare function isMain<V>(v: V): v is import("../../../../util").$TypedObject<V, "com.atproto.repo.strongRef", "main">;
|
|
11
|
+
export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMain = isMain;
|
|
4
|
+
exports.validateMain = validateMain;
|
|
5
|
+
const lexicons_1 = require("../../../../lexicons");
|
|
6
|
+
const util_1 = require("../../../../util");
|
|
7
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
8
|
+
const id = 'com.atproto.repo.strongRef';
|
|
9
|
+
const hashMain = 'main';
|
|
10
|
+
function isMain(v) {
|
|
11
|
+
return is$typed(v, id, hashMain);
|
|
8
12
|
}
|
|
9
|
-
|
|
10
|
-
return
|
|
13
|
+
function validateMain(v) {
|
|
14
|
+
return validate(v, id, hashMain);
|
|
11
15
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import * as ComAtprotoRepoStrongRef from '../../../atproto/repo/strongRef';
|
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon';
|
|
5
|
+
import type * as ComAtprotoRepoStrongRef from '../../../atproto/repo/strongRef.js';
|
|
6
6
|
export interface Record {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
$type: 'com.clioplaylists.alpha.actor.profile';
|
|
8
|
+
displayName: string;
|
|
9
|
+
/** Free-form profile bio text. */
|
|
10
|
+
bio?: string;
|
|
10
11
|
/** Small image to be displayed next to posts from account. AKA, 'profile picture' */
|
|
11
12
|
avatar?: BlobRef;
|
|
12
13
|
/** Larger horizontal image to display behind profile view. */
|
|
13
14
|
banner?: BlobRef;
|
|
14
15
|
pinnedPlaylistIdea?: ComAtprotoRepoStrongRef.Main;
|
|
15
|
-
|
|
16
|
+
/** Client-declared timestamp when this record was originally created. */
|
|
17
|
+
createdAt: string;
|
|
16
18
|
[k: string]: unknown;
|
|
17
19
|
}
|
|
18
|
-
export declare function isRecord(v:
|
|
19
|
-
export declare function validateRecord(v:
|
|
20
|
+
export declare function isRecord<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.actor.profile", "main">;
|
|
21
|
+
export declare function validateRecord<V>(v: V): ValidationResult<Record & V>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRecord = isRecord;
|
|
4
|
+
exports.validateRecord = validateRecord;
|
|
5
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
6
|
+
const util_1 = require("../../../../../util");
|
|
7
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
8
|
+
const id = 'com.clioplaylists.alpha.actor.profile';
|
|
9
|
+
const hashRecord = 'main';
|
|
10
|
+
function isRecord(v) {
|
|
11
|
+
return is$typed(v, id, hashRecord);
|
|
8
12
|
}
|
|
9
|
-
|
|
10
|
-
return
|
|
13
|
+
function validateRecord(v) {
|
|
14
|
+
return validate(v, id, hashRecord, true);
|
|
11
15
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon';
|
|
5
5
|
export interface Song {
|
|
6
|
+
$type?: 'com.clioplaylists.alpha.feed.defs#song';
|
|
6
7
|
/** The title of the track. */
|
|
7
8
|
trackName: string;
|
|
8
9
|
/** Array of artist names in order of original appearance. */
|
|
@@ -12,21 +13,29 @@ export interface Song {
|
|
|
12
13
|
/** Array of Musicbrainz artist IDs. */
|
|
13
14
|
artistMbIds: string[];
|
|
14
15
|
/** Image associated with the song's album. */
|
|
15
|
-
|
|
16
|
-
/** Client-declared timestamp when this record was originally created. */
|
|
17
|
-
createdAt?: string;
|
|
18
|
-
[k: string]: unknown;
|
|
16
|
+
albumArtworkRef?: BlobRef;
|
|
19
17
|
}
|
|
20
|
-
export declare function isSong(v:
|
|
21
|
-
export declare function validateSong(v:
|
|
18
|
+
export declare function isSong<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.defs", "song">;
|
|
19
|
+
export declare function validateSong<V>(v: V): ValidationResult<Song & V>;
|
|
22
20
|
export interface SongView {
|
|
21
|
+
$type?: 'com.clioplaylists.alpha.feed.defs#songView';
|
|
23
22
|
trackName: string;
|
|
24
23
|
artistNames: string[];
|
|
25
24
|
trackMbId: string;
|
|
26
25
|
artistMbIds: string[];
|
|
27
26
|
albumArtwork?: BlobRef;
|
|
28
|
-
indexedAt?: string;
|
|
29
|
-
[k: string]: unknown;
|
|
30
27
|
}
|
|
31
|
-
export declare function isSongView(v:
|
|
32
|
-
export declare function validateSongView(v:
|
|
28
|
+
export declare function isSongView<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.defs", "songView">;
|
|
29
|
+
export declare function validateSongView<V>(v: V): ValidationResult<SongView & V>;
|
|
30
|
+
export interface RecommendedPlaylistView {
|
|
31
|
+
$type?: 'com.clioplaylists.alpha.feed.defs#recommendedPlaylistView';
|
|
32
|
+
uri: string;
|
|
33
|
+
cid: string;
|
|
34
|
+
songs: SongView[];
|
|
35
|
+
playlistIdeaUri: string;
|
|
36
|
+
/** Handle of the recommender and owner of this playlist. */
|
|
37
|
+
ownerHandle: string;
|
|
38
|
+
playlistArtwork?: BlobRef;
|
|
39
|
+
}
|
|
40
|
+
export declare function isRecommendedPlaylistView<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.defs", "recommendedPlaylistView">;
|
|
41
|
+
export declare function validateRecommendedPlaylistView<V>(v: V): ValidationResult<RecommendedPlaylistView & V>;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSong = isSong;
|
|
4
|
+
exports.validateSong = validateSong;
|
|
5
|
+
exports.isSongView = isSongView;
|
|
6
|
+
exports.validateSongView = validateSongView;
|
|
7
|
+
exports.isRecommendedPlaylistView = isRecommendedPlaylistView;
|
|
8
|
+
exports.validateRecommendedPlaylistView = validateRecommendedPlaylistView;
|
|
9
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
10
|
+
const util_1 = require("../../../../../util");
|
|
11
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
12
|
+
const id = 'com.clioplaylists.alpha.feed.defs';
|
|
13
|
+
const hashSong = 'song';
|
|
14
|
+
function isSong(v) {
|
|
15
|
+
return is$typed(v, id, hashSong);
|
|
7
16
|
}
|
|
8
|
-
|
|
9
|
-
return
|
|
17
|
+
function validateSong(v) {
|
|
18
|
+
return validate(v, id, hashSong);
|
|
10
19
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
v.$type === 'com.clioplaylists.alpha.feed.defs#songView');
|
|
20
|
+
const hashSongView = 'songView';
|
|
21
|
+
function isSongView(v) {
|
|
22
|
+
return is$typed(v, id, hashSongView);
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
return
|
|
24
|
+
function validateSongView(v) {
|
|
25
|
+
return validate(v, id, hashSongView);
|
|
26
|
+
}
|
|
27
|
+
const hashRecommendedPlaylistView = 'recommendedPlaylistView';
|
|
28
|
+
function isRecommendedPlaylistView(v) {
|
|
29
|
+
return is$typed(v, id, hashRecommendedPlaylistView);
|
|
30
|
+
}
|
|
31
|
+
function validateRecommendedPlaylistView(v) {
|
|
32
|
+
return validate(v, id, hashRecommendedPlaylistView);
|
|
18
33
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
|
|
6
|
+
import type * as ComClioplaylistsAlphaFeedDefs from './defs.js';
|
|
7
|
+
export interface QueryParams {
|
|
8
|
+
/** The handle or did of the user to return recommended playlists for. */
|
|
9
|
+
userAtIdentifier: string;
|
|
10
|
+
}
|
|
11
|
+
export type InputSchema = undefined;
|
|
12
|
+
export interface OutputSchema {
|
|
13
|
+
recommendedPlaylists: ComClioplaylistsAlphaFeedDefs.RecommendedPlaylistView[];
|
|
14
|
+
}
|
|
15
|
+
export type HandlerInput = undefined;
|
|
16
|
+
export interface HandlerSuccess {
|
|
17
|
+
encoding: 'application/json';
|
|
18
|
+
body: OutputSchema;
|
|
19
|
+
headers?: {
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface HandlerError {
|
|
24
|
+
status: number;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough;
|
|
28
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
29
|
+
auth: HA;
|
|
30
|
+
params: QueryParams;
|
|
31
|
+
input: HandlerInput;
|
|
32
|
+
req: express.Request;
|
|
33
|
+
res: express.Response;
|
|
34
|
+
resetRouteRateLimits: () => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
4
|
+
const util_1 = require("../../../../../util");
|
|
5
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
6
|
+
const id = 'com.clioplaylists.alpha.feed.getRecommendedPlaylistsByUser';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
|
-
import { ValidationResult } from '@atproto/lexicon';
|
|
5
|
-
import * as ComClioplaylistsAlphaFeedDefs from './defs';
|
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon';
|
|
5
|
+
import type * as ComClioplaylistsAlphaFeedDefs from './defs.js';
|
|
6
6
|
export interface Record {
|
|
7
|
+
$type: 'com.clioplaylists.alpha.feed.playlistIdea';
|
|
7
8
|
/** A concise title that gives other users an idea of the vibe of the playlist. */
|
|
8
9
|
title: string;
|
|
9
10
|
/** A description of the playlist that explains more about what the user is looking for from the playlist. */
|
|
@@ -11,22 +12,18 @@ export interface Record {
|
|
|
11
12
|
creatorDid: string;
|
|
12
13
|
ownerDid: string;
|
|
13
14
|
masterPlaylist?: MasterPlaylist;
|
|
14
|
-
recommendedPlaylist?: RecommendedPlaylist;
|
|
15
15
|
/** Client-declared timestamp when this record was originally created. */
|
|
16
16
|
createdAt: string;
|
|
17
17
|
[k: string]: unknown;
|
|
18
18
|
}
|
|
19
|
-
export declare function isRecord(v:
|
|
20
|
-
export declare function validateRecord(v:
|
|
19
|
+
export declare function isRecord<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.playlistIdea", "main">;
|
|
20
|
+
export declare function validateRecord<V>(v: V): ValidationResult<Record & V>;
|
|
21
|
+
/** The playlist of songs that the creator officially says are representative of the idea. */
|
|
21
22
|
export interface MasterPlaylist {
|
|
23
|
+
$type?: 'com.clioplaylists.alpha.feed.playlistIdea#masterPlaylist';
|
|
22
24
|
songs: ComClioplaylistsAlphaFeedDefs.Song[];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export declare function isMasterPlaylist(v: unknown): v is MasterPlaylist;
|
|
26
|
-
export declare function validateMasterPlaylist(v: unknown): ValidationResult;
|
|
27
|
-
export interface RecommendedPlaylist {
|
|
28
|
-
songs: ComClioplaylistsAlphaFeedDefs.Song[];
|
|
29
|
-
[k: string]: unknown;
|
|
25
|
+
/** Image associated with the playlist. */
|
|
26
|
+
playlistArtwork?: BlobRef;
|
|
30
27
|
}
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function
|
|
28
|
+
export declare function isMasterPlaylist<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.playlistIdea", "masterPlaylist">;
|
|
29
|
+
export declare function validateMasterPlaylist<V>(v: V): ValidationResult<MasterPlaylist & V>;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRecord = isRecord;
|
|
4
|
+
exports.validateRecord = validateRecord;
|
|
5
|
+
exports.isMasterPlaylist = isMasterPlaylist;
|
|
6
|
+
exports.validateMasterPlaylist = validateMasterPlaylist;
|
|
7
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
8
|
+
const util_1 = require("../../../../../util");
|
|
9
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
10
|
+
const id = 'com.clioplaylists.alpha.feed.playlistIdea';
|
|
11
|
+
const hashRecord = 'main';
|
|
12
|
+
function isRecord(v) {
|
|
13
|
+
return is$typed(v, id, hashRecord);
|
|
8
14
|
}
|
|
9
|
-
|
|
10
|
-
return
|
|
15
|
+
function validateRecord(v) {
|
|
16
|
+
return validate(v, id, hashRecord, true);
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
v.$type === 'com.clioplaylists.alpha.feed.playlistIdea#masterPlaylist');
|
|
18
|
+
const hashMasterPlaylist = 'masterPlaylist';
|
|
19
|
+
function isMasterPlaylist(v) {
|
|
20
|
+
return is$typed(v, id, hashMasterPlaylist);
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
export function isRecommendedPlaylist(v) {
|
|
21
|
-
return (isObj(v) &&
|
|
22
|
-
hasProp(v, '$type') &&
|
|
23
|
-
v.$type === 'com.clioplaylists.alpha.feed.playlistIdea#recommendedPlaylist');
|
|
24
|
-
}
|
|
25
|
-
export function validateRecommendedPlaylist(v) {
|
|
26
|
-
return lexicons.validate('com.clioplaylists.alpha.feed.playlistIdea#recommendedPlaylist', v);
|
|
22
|
+
function validateMasterPlaylist(v) {
|
|
23
|
+
return validate(v, id, hashMasterPlaylist);
|
|
27
24
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon';
|
|
5
|
+
import type * as ComClioplaylistsAlphaFeedDefs from './defs.js';
|
|
6
|
+
export interface Main {
|
|
7
|
+
$type?: 'com.clioplaylists.alpha.feed.recommendedPlaylist';
|
|
8
|
+
/** Songs that the user recommends for the playlist idea. */
|
|
9
|
+
songs: ComClioplaylistsAlphaFeedDefs.Song[];
|
|
10
|
+
/** The at-uri of the playlist idea that these recommendations are for. */
|
|
11
|
+
playlistIdeaAtUri: string;
|
|
12
|
+
/** DID of the recommender and owner of this playlist. */
|
|
13
|
+
ownerDid: string;
|
|
14
|
+
/** Image associated with the playlist. */
|
|
15
|
+
playlistArtwork?: BlobRef;
|
|
16
|
+
}
|
|
17
|
+
export declare function isMain<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.recommendedPlaylist", "main">;
|
|
18
|
+
export declare function validateMain<V>(v: V): ValidationResult<Main & V>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMain = isMain;
|
|
4
|
+
exports.validateMain = validateMain;
|
|
5
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
6
|
+
const util_1 = require("../../../../../util");
|
|
7
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
8
|
+
const id = 'com.clioplaylists.alpha.feed.recommendedPlaylist';
|
|
9
|
+
const hashMain = 'main';
|
|
10
|
+
function isMain(v) {
|
|
11
|
+
return is$typed(v, id, hashMain);
|
|
12
|
+
}
|
|
13
|
+
function validateMain(v) {
|
|
14
|
+
return validate(v, id, hashMain);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
|
5
|
+
import type * as ComAtprotoRepoStrongRef from '../../../atproto/repo/strongRef.js';
|
|
6
|
+
import type * as ComClioplaylistsAlphaFeedDefs from './defs.js';
|
|
7
|
+
export interface Record {
|
|
8
|
+
$type: 'com.clioplaylists.alpha.feed.songRecommendation';
|
|
9
|
+
playlistIdea: ComAtprotoRepoStrongRef.Main;
|
|
10
|
+
song: ComClioplaylistsAlphaFeedDefs.Song;
|
|
11
|
+
/** Optional note from the recommender explaining why this song fits. */
|
|
12
|
+
note?: string;
|
|
13
|
+
/** Client-declared timestamp when this record was originally created. */
|
|
14
|
+
createdAt: string;
|
|
15
|
+
[k: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export declare function isRecord<V>(v: V): v is import("../../../../../util").$TypedObject<V, "com.clioplaylists.alpha.feed.songRecommendation", "main">;
|
|
18
|
+
export declare function validateRecord<V>(v: V): ValidationResult<Record & V>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRecord = isRecord;
|
|
4
|
+
exports.validateRecord = validateRecord;
|
|
5
|
+
const lexicons_1 = require("../../../../../lexicons");
|
|
6
|
+
const util_1 = require("../../../../../util");
|
|
7
|
+
const is$typed = util_1.is$typed, validate = lexicons_1.validate;
|
|
8
|
+
const id = 'com.clioplaylists.alpha.feed.songRecommendation';
|
|
9
|
+
const hashRecord = 'main';
|
|
10
|
+
function isRecord(v) {
|
|
11
|
+
return is$typed(v, id, hashRecord);
|
|
12
|
+
}
|
|
13
|
+
function validateRecord(v) {
|
|
14
|
+
return validate(v, id, hashRecord, true);
|
|
15
|
+
}
|
package/dist/lexicons/util.d.ts
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
import { type ValidationResult } from '@atproto/lexicon';
|
|
5
|
+
export type OmitKey<T, K extends keyof T> = {
|
|
6
|
+
[K2 in keyof T as K2 extends K ? never : K2]: T[K2];
|
|
7
|
+
};
|
|
8
|
+
export type $Typed<V, T extends string = string> = V & {
|
|
9
|
+
$type: T;
|
|
10
|
+
};
|
|
11
|
+
export type Un$Typed<V extends {
|
|
12
|
+
$type?: string;
|
|
13
|
+
}> = OmitKey<V, '$type'>;
|
|
14
|
+
export type $Type<Id extends string, Hash extends string> = Hash extends 'main' ? Id : `${Id}#${Hash}`;
|
|
15
|
+
export type $TypedObject<V, Id extends string, Hash extends string> = V extends {
|
|
16
|
+
$type: $Type<Id, Hash>;
|
|
17
|
+
} ? V : V extends {
|
|
18
|
+
$type?: string;
|
|
19
|
+
} ? V extends {
|
|
20
|
+
$type?: infer T extends $Type<Id, Hash>;
|
|
21
|
+
} ? V & {
|
|
22
|
+
$type: T;
|
|
23
|
+
} : never : V & {
|
|
24
|
+
$type: $Type<Id, Hash>;
|
|
25
|
+
};
|
|
26
|
+
export declare function is$typed<V, Id extends string, Hash extends string>(v: V, id: Id, hash: Hash): v is $TypedObject<V, Id, Hash>;
|
|
27
|
+
export declare function maybe$typed<V, Id extends string, Hash extends string>(v: V, id: Id, hash: Hash): v is V & object & {
|
|
28
|
+
$type?: $Type<Id, Hash>;
|
|
29
|
+
};
|
|
30
|
+
export type Validator<R = unknown> = (v: unknown) => ValidationResult<R>;
|
|
31
|
+
export type ValidatorParam<V extends Validator> = V extends Validator<infer R> ? R : never;
|
|
32
|
+
/**
|
|
33
|
+
* Utility function that allows to convert a "validate*" utility function into a
|
|
34
|
+
* type predicate.
|
|
35
|
+
*/
|
|
36
|
+
export declare function asPredicate<V extends Validator>(validate: V): <T>(v: T) => v is T & ValidatorParam<V>;
|
package/dist/lexicons/util.js
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* GENERATED CODE - DO NOT MODIFY
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.is$typed = is$typed;
|
|
7
|
+
exports.maybe$typed = maybe$typed;
|
|
8
|
+
exports.asPredicate = asPredicate;
|
|
9
|
+
function isObject(v) {
|
|
10
|
+
return v != null && typeof v === 'object';
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
return
|
|
12
|
+
function is$type($type, id, hash) {
|
|
13
|
+
return hash === 'main'
|
|
14
|
+
? $type === id
|
|
15
|
+
: // $type === `${id}#${hash}`
|
|
16
|
+
typeof $type === 'string' &&
|
|
17
|
+
$type.length === id.length + 1 + hash.length &&
|
|
18
|
+
$type.charCodeAt(id.length) === 35 /* '#' */ &&
|
|
19
|
+
$type.startsWith(id) &&
|
|
20
|
+
$type.endsWith(hash);
|
|
21
|
+
}
|
|
22
|
+
function is$typed(v, id, hash) {
|
|
23
|
+
return isObject(v) && '$type' in v && is$type(v.$type, id, hash);
|
|
24
|
+
}
|
|
25
|
+
function maybe$typed(v, id, hash) {
|
|
26
|
+
return (isObject(v) &&
|
|
27
|
+
('$type' in v ? v.$type === undefined || is$type(v.$type, id, hash) : true));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Utility function that allows to convert a "validate*" utility function into a
|
|
31
|
+
* type predicate.
|
|
32
|
+
*/
|
|
33
|
+
function asPredicate(validate) {
|
|
34
|
+
return function (v) {
|
|
35
|
+
return validate(v).success;
|
|
36
|
+
};
|
|
9
37
|
}
|
package/dist/logger.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loggerMiddleware = exports.httpLogger = exports.subLogger = exports.dbLogger = void 0;
|
|
7
|
+
const common_1 = require("@atproto/common");
|
|
8
|
+
const pino_1 = require("pino");
|
|
9
|
+
const pino_http_1 = __importDefault(require("pino-http"));
|
|
10
|
+
exports.dbLogger = (0, common_1.subsystemLogger)('clio:db');
|
|
11
|
+
exports.subLogger = (0, common_1.subsystemLogger)('clio:sub');
|
|
12
|
+
exports.httpLogger = (0, common_1.subsystemLogger)('clio');
|
|
13
|
+
exports.loggerMiddleware = (0, pino_http_1.default)({
|
|
14
|
+
logger: exports.httpLogger,
|
|
9
15
|
serializers: {
|
|
10
16
|
err: (err) => ({
|
|
11
17
|
code: err?.['code'],
|
|
12
18
|
message: err?.['message'],
|
|
13
19
|
}),
|
|
14
20
|
req: (req) => {
|
|
15
|
-
const serialized = stdSerializers.req(req);
|
|
16
|
-
const headers = obfuscateHeaders(serialized.headers);
|
|
21
|
+
const serialized = pino_1.stdSerializers.req(req);
|
|
22
|
+
const headers = (0, common_1.obfuscateHeaders)(serialized.headers);
|
|
17
23
|
return { ...serialized, headers };
|
|
18
24
|
},
|
|
19
25
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OAuthClient } from '@atproto/oauth-client';
|
|
2
|
+
import { NodeOAuthClient } from '@atproto/oauth-client-node';
|
|
3
|
+
import type AppContext from '../context';
|
|
4
|
+
import { Database } from '../dataplane/server/db';
|
|
5
|
+
type RedirectUri = NonNullable<Parameters<OAuthClient['authorize']>[1] extends {
|
|
6
|
+
redirect_uri?: infer R;
|
|
7
|
+
} ? R : never>;
|
|
8
|
+
export declare const getOauthRedirectUri: (ctx: AppContext) => RedirectUri;
|
|
9
|
+
export declare const getOauthDb: (ctx: AppContext) => Database;
|
|
10
|
+
type NodeOauthOptions = ConstructorParameters<typeof NodeOAuthClient>[0];
|
|
11
|
+
type ClientMetadata = NodeOauthOptions['clientMetadata'];
|
|
12
|
+
export declare const getOauthClientMetadata: (ctx: AppContext) => ClientMetadata;
|
|
13
|
+
export declare const getOauthClient: (ctx: AppContext) => OAuthClient;
|
|
14
|
+
export {};
|