@clioplaylists/clio 0.1.6 → 0.1.7
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/.env +7 -0
- package/dist/api/health.js +3 -10
- package/dist/api/index.js +2 -39
- package/dist/api/util.js +6 -10
- package/dist/auth-verifier.js +165 -273
- package/dist/client.js +8 -15
- package/dist/config.js +7 -23
- package/dist/context.js +3 -10
- package/dist/dataplane/client.js +25 -70
- package/dist/dataplane/index.js +2 -18
- package/dist/dataplane/server/background.js +8 -29
- package/dist/dataplane/server/db/database-schema.js +1 -2
- package/dist/dataplane/server/db/db.js +27 -103
- package/dist/dataplane/server/db/index.js +1 -17
- package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.js +7 -11
- package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.js +2 -6
- package/dist/dataplane/server/db/migrations/index.js +2 -38
- package/dist/dataplane/server/db/migrations/provider.js +5 -17
- package/dist/dataplane/server/db/pagination.js +21 -37
- package/dist/dataplane/server/db/tables/actor-sync.js +1 -4
- package/dist/dataplane/server/db/tables/actor.js +1 -4
- package/dist/dataplane/server/db/tables/artist-list-item.js +1 -4
- package/dist/dataplane/server/db/tables/artist.js +1 -4
- package/dist/dataplane/server/db/tables/playlist-idea.js +1 -4
- package/dist/dataplane/server/db/tables/playlist-item.js +1 -4
- package/dist/dataplane/server/db/tables/playlist.js +1 -4
- package/dist/dataplane/server/db/tables/profile.js +1 -4
- package/dist/dataplane/server/db/tables/record.js +1 -4
- package/dist/dataplane/server/db/tables/song.js +1 -4
- package/dist/dataplane/server/db/types.js +1 -2
- package/dist/dataplane/server/db/util.js +18 -26
- package/dist/dataplane/server/index.js +17 -33
- package/dist/dataplane/server/indexing/index.js +39 -89
- package/dist/dataplane/server/indexing/plugins/playlist-idea.js +7 -44
- package/dist/dataplane/server/indexing/plugins/profile.js +5 -42
- package/dist/dataplane/server/indexing/processor.js +11 -29
- package/dist/dataplane/server/routes/identity.js +11 -13
- package/dist/dataplane/server/routes/index.js +10 -15
- package/dist/dataplane/server/routes/profile.js +9 -11
- package/dist/dataplane/server/routes/records.js +14 -51
- package/dist/dataplane/server/routes/sync.js +1 -3
- package/dist/dataplane/server/subscription.js +19 -47
- package/dist/error.js +5 -9
- package/dist/index.js +29 -89
- package/dist/lexicons/index.js +52 -227
- package/dist/lexicons/lexicons.js +5 -8
- package/dist/lexicons/types/com/atproto/admin/defs.js +27 -39
- package/dist/lexicons/types/com/atproto/admin/deleteAccount.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/getAccountInfo.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/getAccountInfos.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/getInviteCodes.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/searchAccounts.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/sendEmail.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.js +1 -2
- package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/defs.js +7 -11
- package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/refreshIdentity.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/resolveDid.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/resolveHandle.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/resolveIdentity.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/signPlcOperation.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.js +1 -2
- package/dist/lexicons/types/com/atproto/identity/updateHandle.js +1 -2
- package/dist/lexicons/types/com/atproto/label/defs.js +27 -39
- package/dist/lexicons/types/com/atproto/label/queryLabels.js +1 -2
- package/dist/lexicons/types/com/atproto/label/subscribeLabels.js +12 -18
- package/dist/lexicons/types/com/atproto/lexicon/schema.js +7 -11
- package/dist/lexicons/types/com/atproto/moderation/createReport.js +1 -2
- package/dist/lexicons/types/com/atproto/moderation/defs.js +7 -10
- package/dist/lexicons/types/com/atproto/repo/applyWrites.js +32 -46
- package/dist/lexicons/types/com/atproto/repo/createRecord.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/defs.js +7 -11
- package/dist/lexicons/types/com/atproto/repo/deleteRecord.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/describeRepo.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/getRecord.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/importRepo.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.js +7 -11
- package/dist/lexicons/types/com/atproto/repo/listRecords.js +7 -11
- package/dist/lexicons/types/com/atproto/repo/putRecord.js +1 -2
- package/dist/lexicons/types/com/atproto/repo/strongRef.js +7 -11
- package/dist/lexicons/types/com/atproto/repo/uploadBlob.js +1 -2
- package/dist/lexicons/types/com/atproto/server/activateAccount.js +1 -2
- package/dist/lexicons/types/com/atproto/server/checkAccountStatus.js +1 -2
- package/dist/lexicons/types/com/atproto/server/confirmEmail.js +1 -2
- package/dist/lexicons/types/com/atproto/server/createAccount.js +1 -2
- package/dist/lexicons/types/com/atproto/server/createAppPassword.js +7 -11
- package/dist/lexicons/types/com/atproto/server/createInviteCode.js +1 -2
- package/dist/lexicons/types/com/atproto/server/createInviteCodes.js +7 -11
- package/dist/lexicons/types/com/atproto/server/createSession.js +1 -2
- package/dist/lexicons/types/com/atproto/server/deactivateAccount.js +1 -2
- package/dist/lexicons/types/com/atproto/server/defs.js +12 -18
- package/dist/lexicons/types/com/atproto/server/deleteAccount.js +1 -2
- package/dist/lexicons/types/com/atproto/server/deleteSession.js +1 -2
- package/dist/lexicons/types/com/atproto/server/describeServer.js +12 -18
- package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.js +1 -2
- package/dist/lexicons/types/com/atproto/server/getServiceAuth.js +1 -2
- package/dist/lexicons/types/com/atproto/server/getSession.js +1 -2
- package/dist/lexicons/types/com/atproto/server/listAppPasswords.js +7 -11
- package/dist/lexicons/types/com/atproto/server/refreshSession.js +1 -2
- package/dist/lexicons/types/com/atproto/server/requestAccountDelete.js +1 -2
- package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.js +1 -2
- package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.js +1 -2
- package/dist/lexicons/types/com/atproto/server/requestPasswordReset.js +1 -2
- package/dist/lexicons/types/com/atproto/server/reserveSigningKey.js +1 -2
- package/dist/lexicons/types/com/atproto/server/resetPassword.js +1 -2
- package/dist/lexicons/types/com/atproto/server/revokeAppPassword.js +1 -2
- package/dist/lexicons/types/com/atproto/server/updateEmail.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getBlob.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getBlocks.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getCheckout.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getHead.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getLatestCommit.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getRecord.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getRepo.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/getRepoStatus.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/listBlobs.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/listRepos.js +7 -11
- package/dist/lexicons/types/com/atproto/sync/listReposByCollection.js +7 -11
- package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/requestCrawl.js +1 -2
- package/dist/lexicons/types/com/atproto/sync/subscribeRepos.js +32 -46
- package/dist/lexicons/types/com/atproto/temp/addReservedHandle.js +1 -2
- package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.js +1 -2
- package/dist/lexicons/types/com/atproto/temp/fetchLabels.js +1 -2
- package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.js +1 -2
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.js +7 -11
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.js +12 -18
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.js +1 -2
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.js +17 -25
- package/dist/lexicons/util.js +2 -6
- package/dist/logger.js +10 -16
- package/dist/rpc/clio_connect.js +30 -33
- package/dist/rpc/clio_pb.js +402 -956
- package/dist/util/retry.js +7 -10
- package/dist/util/uris.js +3 -6
- package/dist/util.js +17 -60
- package/package.json +4 -4
package/dist/util/retry.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const common_1 = require("@atproto/common");
|
|
5
|
-
const xrpc_1 = require("@atproto/xrpc");
|
|
6
|
-
exports.RETRYABLE_HTTP_STATUS_CODES = new Set([
|
|
1
|
+
import { createRetryable } from '@atproto/common';
|
|
2
|
+
import { ResponseType, XRPCError } from '@atproto/xrpc';
|
|
3
|
+
export const RETRYABLE_HTTP_STATUS_CODES = new Set([
|
|
7
4
|
408, 425, 429, 500, 502, 503, 504, 522, 524,
|
|
8
5
|
]);
|
|
9
|
-
|
|
10
|
-
if (err instanceof
|
|
11
|
-
if (err.status ===
|
|
6
|
+
export const retryXrpc = createRetryable((err) => {
|
|
7
|
+
if (err instanceof XRPCError) {
|
|
8
|
+
if (err.status === ResponseType.Unknown)
|
|
12
9
|
return true;
|
|
13
|
-
return
|
|
10
|
+
return RETRYABLE_HTTP_STATUS_CODES.has(err.status);
|
|
14
11
|
}
|
|
15
12
|
return false;
|
|
16
13
|
});
|
package/dist/util/uris.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const syntax_1 = require("@atproto/syntax");
|
|
5
|
-
function uriToDid(uri) {
|
|
6
|
-
return new syntax_1.AtUri(uri).hostname;
|
|
1
|
+
import { AtUri } from '@atproto/syntax';
|
|
2
|
+
export function uriToDid(uri) {
|
|
3
|
+
return new AtUri(uri).hostname;
|
|
7
4
|
}
|
package/dist/util.js
CHANGED
|
@@ -1,60 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.safeTakedownRef = exports.parseCid = exports.parseJsonBytes = exports.parseRecordBytes = exports.parseRecord = exports.formatLabelerHeader = exports.defaultLabelerHeader = void 0;
|
|
37
|
-
const lexicon_1 = require("@atproto/lexicon");
|
|
38
|
-
const cid_1 = require("multiformats/cid");
|
|
39
|
-
const ui8 = __importStar(require("uint8arrays"));
|
|
40
|
-
const lexicons_1 = require("./lexicons/lexicons");
|
|
41
|
-
const defaultLabelerHeader = (dids) => {
|
|
1
|
+
import { jsonToLex } from '@atproto/lexicon';
|
|
2
|
+
import { CID } from 'multiformats/cid';
|
|
3
|
+
import * as ui8 from 'uint8arrays';
|
|
4
|
+
import { lexicons } from './lexicons/lexicons';
|
|
5
|
+
export const defaultLabelerHeader = (dids) => {
|
|
42
6
|
return {
|
|
43
7
|
dids,
|
|
44
8
|
redact: new Set(dids),
|
|
45
9
|
};
|
|
46
10
|
};
|
|
47
|
-
|
|
48
|
-
const formatLabelerHeader = (parsed) => {
|
|
11
|
+
export const formatLabelerHeader = (parsed) => {
|
|
49
12
|
const parts = parsed.dids.map((did) => parsed.redact.has(did) ? `${did};redact` : did);
|
|
50
13
|
return parts.join(',');
|
|
51
14
|
};
|
|
52
|
-
|
|
53
|
-
const parseRecord = (entry, includeTakedowns) => {
|
|
15
|
+
export const parseRecord = (entry, includeTakedowns) => {
|
|
54
16
|
if (!includeTakedowns && entry.takenDown) {
|
|
55
17
|
return undefined;
|
|
56
18
|
}
|
|
57
|
-
const record =
|
|
19
|
+
const record = parseRecordBytes(entry.record);
|
|
58
20
|
const cid = entry.cid;
|
|
59
21
|
const sortedAt = entry.sortedAt?.toDate() ?? new Date(0);
|
|
60
22
|
const indexedAt = entry.indexedAt?.toDate() ?? new Date(0);
|
|
@@ -68,17 +30,16 @@ const parseRecord = (entry, includeTakedowns) => {
|
|
|
68
30
|
cid,
|
|
69
31
|
sortedAt,
|
|
70
32
|
indexedAt,
|
|
71
|
-
takedownRef:
|
|
33
|
+
takedownRef: safeTakedownRef(entry),
|
|
72
34
|
};
|
|
73
35
|
};
|
|
74
|
-
exports.parseRecord = parseRecord;
|
|
75
36
|
const isValidRecord = (json) => {
|
|
76
|
-
const lexRecord =
|
|
37
|
+
const lexRecord = jsonToLex(json);
|
|
77
38
|
if (typeof lexRecord?.['$type'] !== 'string') {
|
|
78
39
|
return false;
|
|
79
40
|
}
|
|
80
41
|
try {
|
|
81
|
-
|
|
42
|
+
lexicons.assertValidRecord(lexRecord['$type'], lexRecord);
|
|
82
43
|
return true;
|
|
83
44
|
}
|
|
84
45
|
catch {
|
|
@@ -86,29 +47,26 @@ const isValidRecord = (json) => {
|
|
|
86
47
|
}
|
|
87
48
|
};
|
|
88
49
|
// @NOTE not parsed into lex format, so will not match lexicon record types on CID and blob values.
|
|
89
|
-
const parseRecordBytes = (bytes) => {
|
|
90
|
-
return
|
|
50
|
+
export const parseRecordBytes = (bytes) => {
|
|
51
|
+
return parseJsonBytes(bytes);
|
|
91
52
|
};
|
|
92
|
-
|
|
93
|
-
const parseJsonBytes = (bytes) => {
|
|
53
|
+
export const parseJsonBytes = (bytes) => {
|
|
94
54
|
if (!bytes || bytes.byteLength === 0)
|
|
95
55
|
return;
|
|
96
56
|
const parsed = JSON.parse(ui8.toString(bytes, 'utf8'));
|
|
97
57
|
return parsed ?? undefined;
|
|
98
58
|
};
|
|
99
|
-
|
|
100
|
-
const parseCid = (cidStr) => {
|
|
59
|
+
export const parseCid = (cidStr) => {
|
|
101
60
|
if (!cidStr || cidStr.length === 0)
|
|
102
61
|
return;
|
|
103
62
|
try {
|
|
104
|
-
return
|
|
63
|
+
return CID.parse(cidStr);
|
|
105
64
|
}
|
|
106
65
|
catch {
|
|
107
66
|
return;
|
|
108
67
|
}
|
|
109
68
|
};
|
|
110
|
-
|
|
111
|
-
const safeTakedownRef = (obj) => {
|
|
69
|
+
export const safeTakedownRef = (obj) => {
|
|
112
70
|
if (!obj)
|
|
113
71
|
return;
|
|
114
72
|
if (obj.takedownRef)
|
|
@@ -116,4 +74,3 @@ const safeTakedownRef = (obj) => {
|
|
|
116
74
|
if (obj.takenDown)
|
|
117
75
|
return 'BSKY-TAKEDOWN-UNKNOWN';
|
|
118
76
|
};
|
|
119
|
-
exports.safeTakedownRef = safeTakedownRef;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clioplaylists/clio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Appview server for the Clio application",
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/start.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [ "dist" ],
|
|
7
8
|
"scripts": {
|
|
8
|
-
"build": "tsc --project ./tsconfig.json && cp
|
|
9
|
+
"build": "tsc --project ./tsconfig.json && cp .env ./dist",
|
|
9
10
|
"start": "node dist/start.js",
|
|
10
11
|
"dev": "nodemon -r tsconfig-paths/register src/index.ts",
|
|
11
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -27,7 +28,6 @@
|
|
|
27
28
|
"url": "https://github.com/Hoid/clio/issues"
|
|
28
29
|
},
|
|
29
30
|
"homepage": "https://github.com/Hoid/clio#readme",
|
|
30
|
-
"files": [ "dist" ],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atproto/api": "^0.13.35",
|
|
33
33
|
"@atproto/common": "^0.4.4",
|