@atproto/lexicon-resolver 0.2.5 → 0.3.0
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/CHANGELOG.md +19 -0
- package/LICENSE.txt +1 -1
- package/dist/lexicon.d.ts +13 -13
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lexicon.js +46 -20
- package/dist/lexicon.js.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.d.ts +3 -0
- package/dist/lexicons/com/atproto/lexicon/schema.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts +50 -0
- package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/lexicon/schema.defs.js +15 -0
- package/dist/lexicons/com/atproto/lexicon/schema.defs.js.map +1 -0
- package/dist/lexicons/com/atproto/lexicon/schema.js +45 -0
- package/dist/lexicons/com/atproto/lexicon/schema.js.map +1 -0
- package/dist/lexicons/com/atproto/lexicon.d.ts +2 -0
- package/dist/lexicons/com/atproto/lexicon.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/lexicon.js +41 -0
- package/dist/lexicons/com/atproto/lexicon.js.map +1 -0
- package/dist/lexicons/com/atproto/sync/getRecord.d.ts +3 -0
- package/dist/lexicons/com/atproto/sync/getRecord.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts +31 -0
- package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync/getRecord.defs.js +24 -0
- package/dist/lexicons/com/atproto/sync/getRecord.defs.js.map +1 -0
- package/dist/lexicons/com/atproto/sync/getRecord.js +45 -0
- package/dist/lexicons/com/atproto/sync/getRecord.js.map +1 -0
- package/dist/lexicons/com/atproto/sync.d.ts +2 -0
- package/dist/lexicons/com/atproto/sync.d.ts.map +1 -0
- package/dist/lexicons/com/atproto/sync.js +41 -0
- package/dist/lexicons/com/atproto/sync.js.map +1 -0
- package/dist/lexicons/com/atproto.d.ts +3 -0
- package/dist/lexicons/com/atproto.d.ts.map +1 -0
- package/dist/lexicons/com/atproto.js +42 -0
- package/dist/lexicons/com/atproto.js.map +1 -0
- package/dist/lexicons/com.d.ts +2 -0
- package/dist/lexicons/com.d.ts.map +1 -0
- package/dist/lexicons/com.js +41 -0
- package/dist/lexicons/com.js.map +1 -0
- package/dist/lexicons/index.d.ts +2 -0
- package/dist/lexicons/index.d.ts.map +1 -0
- package/dist/lexicons/index.js +41 -0
- package/dist/lexicons/index.js.map +1 -0
- package/dist/record.d.ts +9 -10
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +21 -18
- package/dist/record.js.map +1 -1
- package/package.json +7 -9
- package/src/lexicon.ts +29 -37
- package/src/lexicons/com/atproto/lexicon/schema.defs.ts +43 -0
- package/src/lexicons/com/atproto/lexicon/schema.ts +6 -0
- package/src/lexicons/com/atproto/lexicon.ts +5 -0
- package/src/lexicons/com/atproto/sync/getRecord.defs.ts +39 -0
- package/src/lexicons/com/atproto/sync/getRecord.ts +6 -0
- package/src/lexicons/com/atproto/sync.ts +5 -0
- package/src/lexicons/com/atproto.ts +6 -0
- package/src/lexicons/com.ts +5 -0
- package/src/lexicons/index.ts +5 -0
- package/src/record.ts +58 -32
- package/tests/lexicon.test.ts +4 -3
- package/tests/record.test.ts +99 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/client/index.d.ts +0 -28
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -118
- package/dist/client/index.js.map +0 -1
- package/dist/client/lexicons.d.ts +0 -105
- package/dist/client/lexicons.d.ts.map +0 -1
- package/dist/client/lexicons.js +0 -75
- package/dist/client/lexicons.js.map +0 -1
- package/dist/client/types/com/atproto/sync/getRecord.d.ts +0 -38
- package/dist/client/types/com/atproto/sync/getRecord.d.ts.map +0 -1
- package/dist/client/types/com/atproto/sync/getRecord.js +0 -58
- package/dist/client/types/com/atproto/sync/getRecord.js.map +0 -1
- package/dist/client/util.d.ts +0 -37
- package/dist/client/util.d.ts.map +0 -1
- package/dist/client/util.js +0 -38
- package/dist/client/util.js.map +0 -1
- package/src/client/index.ts +0 -67
- package/src/client/lexicons.ts +0 -98
- package/src/client/types/com/atproto/sync/getRecord.ts +0 -78
- package/src/client/util.ts +0 -82
- package/tsconfig.tests.tsbuildinfo +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { Lexicons, type ValidationResult } from '@atproto/lexicon';
|
|
5
|
-
export declare const schemaDict: {
|
|
6
|
-
readonly ComAtprotoSyncGetRecord: {
|
|
7
|
-
readonly lexicon: 1;
|
|
8
|
-
readonly id: "com.atproto.sync.getRecord";
|
|
9
|
-
readonly defs: {
|
|
10
|
-
readonly main: {
|
|
11
|
-
readonly type: "query";
|
|
12
|
-
readonly description: "Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.";
|
|
13
|
-
readonly parameters: {
|
|
14
|
-
readonly type: "params";
|
|
15
|
-
readonly required: ["did", "collection", "rkey"];
|
|
16
|
-
readonly properties: {
|
|
17
|
-
readonly did: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly format: "did";
|
|
20
|
-
readonly description: "The DID of the repo.";
|
|
21
|
-
};
|
|
22
|
-
readonly collection: {
|
|
23
|
-
readonly type: "string";
|
|
24
|
-
readonly format: "nsid";
|
|
25
|
-
};
|
|
26
|
-
readonly rkey: {
|
|
27
|
-
readonly type: "string";
|
|
28
|
-
readonly description: "Record Key";
|
|
29
|
-
readonly format: "record-key";
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
readonly output: {
|
|
34
|
-
readonly encoding: "application/vnd.ipld.car";
|
|
35
|
-
};
|
|
36
|
-
readonly errors: [{
|
|
37
|
-
readonly name: "RecordNotFound";
|
|
38
|
-
}, {
|
|
39
|
-
readonly name: "RepoNotFound";
|
|
40
|
-
}, {
|
|
41
|
-
readonly name: "RepoTakendown";
|
|
42
|
-
}, {
|
|
43
|
-
readonly name: "RepoSuspended";
|
|
44
|
-
}, {
|
|
45
|
-
readonly name: "RepoDeactivated";
|
|
46
|
-
}];
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
export declare const schemas: {
|
|
52
|
-
readonly lexicon: 1;
|
|
53
|
-
readonly id: "com.atproto.sync.getRecord";
|
|
54
|
-
readonly defs: {
|
|
55
|
-
readonly main: {
|
|
56
|
-
readonly type: "query";
|
|
57
|
-
readonly description: "Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.";
|
|
58
|
-
readonly parameters: {
|
|
59
|
-
readonly type: "params";
|
|
60
|
-
readonly required: ["did", "collection", "rkey"];
|
|
61
|
-
readonly properties: {
|
|
62
|
-
readonly did: {
|
|
63
|
-
readonly type: "string";
|
|
64
|
-
readonly format: "did";
|
|
65
|
-
readonly description: "The DID of the repo.";
|
|
66
|
-
};
|
|
67
|
-
readonly collection: {
|
|
68
|
-
readonly type: "string";
|
|
69
|
-
readonly format: "nsid";
|
|
70
|
-
};
|
|
71
|
-
readonly rkey: {
|
|
72
|
-
readonly type: "string";
|
|
73
|
-
readonly description: "Record Key";
|
|
74
|
-
readonly format: "record-key";
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
readonly output: {
|
|
79
|
-
readonly encoding: "application/vnd.ipld.car";
|
|
80
|
-
};
|
|
81
|
-
readonly errors: [{
|
|
82
|
-
readonly name: "RecordNotFound";
|
|
83
|
-
}, {
|
|
84
|
-
readonly name: "RepoNotFound";
|
|
85
|
-
}, {
|
|
86
|
-
readonly name: "RepoTakendown";
|
|
87
|
-
}, {
|
|
88
|
-
readonly name: "RepoSuspended";
|
|
89
|
-
}, {
|
|
90
|
-
readonly name: "RepoDeactivated";
|
|
91
|
-
}];
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
}[];
|
|
95
|
-
export declare const lexicons: Lexicons;
|
|
96
|
-
export declare function validate<T extends {
|
|
97
|
-
$type: string;
|
|
98
|
-
}>(v: unknown, id: string, hash: string, requiredType: true): ValidationResult<T>;
|
|
99
|
-
export declare function validate<T extends {
|
|
100
|
-
$type?: string;
|
|
101
|
-
}>(v: unknown, id: string, hash: string, requiredType?: false): ValidationResult<T>;
|
|
102
|
-
export declare const ids: {
|
|
103
|
-
readonly ComAtprotoSyncGetRecord: "com.atproto.sync.getRecord";
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=lexicons.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.d.ts","sourceRoot":"","sources":["../../src/client/lexicons.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,QAAQ,EAER,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDwB,CAAA;AAC/C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAA;AACvE,eAAO,MAAM,QAAQ,EAAE,QAAgC,CAAA;AAEvD,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAClD,CAAC,EAAE,OAAO,EACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,IAAI,GACjB,gBAAgB,CAAC,CAAC,CAAC,CAAA;AACtB,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACnD,CAAC,EAAE,OAAO,EACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,KAAK,GACnB,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAiBtB,eAAO,MAAM,GAAG;;CAEN,CAAA"}
|
package/dist/client/lexicons.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ids = exports.lexicons = exports.schemas = exports.schemaDict = void 0;
|
|
4
|
-
exports.validate = validate;
|
|
5
|
-
/**
|
|
6
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
7
|
-
*/
|
|
8
|
-
const lexicon_1 = require("@atproto/lexicon");
|
|
9
|
-
const util_js_1 = require("./util.js");
|
|
10
|
-
exports.schemaDict = {
|
|
11
|
-
ComAtprotoSyncGetRecord: {
|
|
12
|
-
lexicon: 1,
|
|
13
|
-
id: 'com.atproto.sync.getRecord',
|
|
14
|
-
defs: {
|
|
15
|
-
main: {
|
|
16
|
-
type: 'query',
|
|
17
|
-
description: 'Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.',
|
|
18
|
-
parameters: {
|
|
19
|
-
type: 'params',
|
|
20
|
-
required: ['did', 'collection', 'rkey'],
|
|
21
|
-
properties: {
|
|
22
|
-
did: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
format: 'did',
|
|
25
|
-
description: 'The DID of the repo.',
|
|
26
|
-
},
|
|
27
|
-
collection: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
format: 'nsid',
|
|
30
|
-
},
|
|
31
|
-
rkey: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'Record Key',
|
|
34
|
-
format: 'record-key',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
output: {
|
|
39
|
-
encoding: 'application/vnd.ipld.car',
|
|
40
|
-
},
|
|
41
|
-
errors: [
|
|
42
|
-
{
|
|
43
|
-
name: 'RecordNotFound',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'RepoNotFound',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'RepoTakendown',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'RepoSuspended',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'RepoDeactivated',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
exports.schemas = Object.values(exports.schemaDict);
|
|
63
|
-
exports.lexicons = new lexicon_1.Lexicons(exports.schemas);
|
|
64
|
-
function validate(v, id, hash, requiredType) {
|
|
65
|
-
return (requiredType ? util_js_1.is$typed : util_js_1.maybe$typed)(v, id, hash)
|
|
66
|
-
? exports.lexicons.validate(`${id}#${hash}`, v)
|
|
67
|
-
: {
|
|
68
|
-
success: false,
|
|
69
|
-
error: new lexicon_1.ValidationError(`Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
exports.ids = {
|
|
73
|
-
ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord',
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=lexicons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lexicons.js","sourceRoot":"","sources":["../../src/client/lexicons.ts"],"names":[],"mappings":";;;AA+EA,4BAcC;AA7FD;;GAEG;AACH,8CAKyB;AACzB,uCAA8D;AAEjD,QAAA,UAAU,GAAG;IACxB,uBAAuB,EAAE;QACvB,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,4BAA4B;QAChC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,iIAAiI;gBACnI,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC;oBACvC,UAAU,EAAE;wBACV,GAAG,EAAE;4BACH,IAAI,EAAE,QAAQ;4BACd,MAAM,EAAE,KAAK;4BACb,WAAW,EAAE,sBAAsB;yBACpC;wBACD,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,MAAM,EAAE,MAAM;yBACf;wBACD,IAAI,EAAE;4BACJ,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,YAAY;4BACzB,MAAM,EAAE,YAAY;yBACrB;qBACF;iBACF;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,0BAA0B;iBACrC;gBACD,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,gBAAgB;qBACvB;oBACD;wBACE,IAAI,EAAE,cAAc;qBACrB;oBACD;wBACE,IAAI,EAAE,eAAe;qBACtB;oBACD;wBACE,IAAI,EAAE,eAAe;qBACtB;oBACD;wBACE,IAAI,EAAE,iBAAiB;qBACxB;iBACF;aACF;SACF;KACF;CAC4C,CAAA;AAClC,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAU,CAAwB,CAAA;AAC1D,QAAA,QAAQ,GAAa,IAAI,kBAAQ,CAAC,eAAO,CAAC,CAAA;AAcvD,SAAgB,QAAQ,CACtB,CAAU,EACV,EAAU,EACV,IAAY,EACZ,YAAsB;IAEtB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAQ,CAAC,CAAC,CAAC,qBAAW,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC;QACzD,CAAC,CAAC,gBAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;YACE,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,yBAAe,CACxB,2BAA2B,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,kBAAkB,CACpF;SACF,CAAA;AACP,CAAC;AAEY,QAAA,GAAG,GAAG;IACjB,uBAAuB,EAAE,4BAA4B;CAC7C,CAAA","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport {\n type LexiconDoc,\n Lexicons,\n ValidationError,\n type ValidationResult,\n} from '@atproto/lexicon'\nimport { type $Typed, is$typed, maybe$typed } from './util.js'\n\nexport const schemaDict = {\n ComAtprotoSyncGetRecord: {\n lexicon: 1,\n id: 'com.atproto.sync.getRecord',\n defs: {\n main: {\n type: 'query',\n description:\n 'Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.',\n parameters: {\n type: 'params',\n required: ['did', 'collection', 'rkey'],\n properties: {\n did: {\n type: 'string',\n format: 'did',\n description: 'The DID of the repo.',\n },\n collection: {\n type: 'string',\n format: 'nsid',\n },\n rkey: {\n type: 'string',\n description: 'Record Key',\n format: 'record-key',\n },\n },\n },\n output: {\n encoding: 'application/vnd.ipld.car',\n },\n errors: [\n {\n name: 'RecordNotFound',\n },\n {\n name: 'RepoNotFound',\n },\n {\n name: 'RepoTakendown',\n },\n {\n name: 'RepoSuspended',\n },\n {\n name: 'RepoDeactivated',\n },\n ],\n },\n },\n },\n} as const satisfies Record<string, LexiconDoc>\nexport const schemas = Object.values(schemaDict) satisfies LexiconDoc[]\nexport const lexicons: Lexicons = new Lexicons(schemas)\n\nexport function validate<T extends { $type: string }>(\n v: unknown,\n id: string,\n hash: string,\n requiredType: true,\n): ValidationResult<T>\nexport function validate<T extends { $type?: string }>(\n v: unknown,\n id: string,\n hash: string,\n requiredType?: false,\n): ValidationResult<T>\nexport function validate(\n v: unknown,\n id: string,\n hash: string,\n requiredType?: boolean,\n): ValidationResult {\n return (requiredType ? is$typed : maybe$typed)(v, id, hash)\n ? lexicons.validate(`${id}#${hash}`, v)\n : {\n success: false,\n error: new ValidationError(\n `Must be an object with \"${hash === 'main' ? id : `${id}#${hash}`}\" $type property`,\n ),\n }\n}\n\nexport const ids = {\n ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord',\n} as const\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { HeadersMap, XRPCError } from '@atproto/xrpc';
|
|
5
|
-
export type QueryParams = {
|
|
6
|
-
/** The DID of the repo. */
|
|
7
|
-
did: string;
|
|
8
|
-
collection: string;
|
|
9
|
-
/** Record Key */
|
|
10
|
-
rkey: string;
|
|
11
|
-
};
|
|
12
|
-
export type InputSchema = undefined;
|
|
13
|
-
export interface CallOptions {
|
|
14
|
-
signal?: AbortSignal;
|
|
15
|
-
headers?: HeadersMap;
|
|
16
|
-
}
|
|
17
|
-
export interface Response {
|
|
18
|
-
success: boolean;
|
|
19
|
-
headers: HeadersMap;
|
|
20
|
-
data: Uint8Array;
|
|
21
|
-
}
|
|
22
|
-
export declare class RecordNotFoundError extends XRPCError {
|
|
23
|
-
constructor(src: XRPCError);
|
|
24
|
-
}
|
|
25
|
-
export declare class RepoNotFoundError extends XRPCError {
|
|
26
|
-
constructor(src: XRPCError);
|
|
27
|
-
}
|
|
28
|
-
export declare class RepoTakendownError extends XRPCError {
|
|
29
|
-
constructor(src: XRPCError);
|
|
30
|
-
}
|
|
31
|
-
export declare class RepoSuspendedError extends XRPCError {
|
|
32
|
-
constructor(src: XRPCError);
|
|
33
|
-
}
|
|
34
|
-
export declare class RepoDeactivatedError extends XRPCError {
|
|
35
|
-
constructor(src: XRPCError);
|
|
36
|
-
}
|
|
37
|
-
export declare function toKnownErr(e: any): any;
|
|
38
|
-
//# sourceMappingURL=getRecord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.d.ts","sourceRoot":"","sources":["../../../../../../src/client/types/com/atproto/sync/getRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAcrD,MAAM,MAAM,WAAW,GAAG;IACxB,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,UAAU,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,GAAG,EAAE,SAAS;CAG3B;AAED,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,GAAG,EAAE,SAAS;CAG3B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,GAAG,EAAE,SAAS;CAG3B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,GAAG,EAAE,SAAS;CAG3B;AAED,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,GAAG,EAAE,SAAS;CAG3B;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,OAUhC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = exports.RecordNotFoundError = void 0;
|
|
4
|
-
exports.toKnownErr = toKnownErr;
|
|
5
|
-
/**
|
|
6
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
7
|
-
*/
|
|
8
|
-
const xrpc_1 = require("@atproto/xrpc");
|
|
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.atproto.sync.getRecord';
|
|
13
|
-
class RecordNotFoundError extends xrpc_1.XRPCError {
|
|
14
|
-
constructor(src) {
|
|
15
|
-
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.RecordNotFoundError = RecordNotFoundError;
|
|
19
|
-
class RepoNotFoundError extends xrpc_1.XRPCError {
|
|
20
|
-
constructor(src) {
|
|
21
|
-
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.RepoNotFoundError = RepoNotFoundError;
|
|
25
|
-
class RepoTakendownError extends xrpc_1.XRPCError {
|
|
26
|
-
constructor(src) {
|
|
27
|
-
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.RepoTakendownError = RepoTakendownError;
|
|
31
|
-
class RepoSuspendedError extends xrpc_1.XRPCError {
|
|
32
|
-
constructor(src) {
|
|
33
|
-
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.RepoSuspendedError = RepoSuspendedError;
|
|
37
|
-
class RepoDeactivatedError extends xrpc_1.XRPCError {
|
|
38
|
-
constructor(src) {
|
|
39
|
-
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.RepoDeactivatedError = RepoDeactivatedError;
|
|
43
|
-
function toKnownErr(e) {
|
|
44
|
-
if (e instanceof xrpc_1.XRPCError) {
|
|
45
|
-
if (e.error === 'RecordNotFound')
|
|
46
|
-
return new RecordNotFoundError(e);
|
|
47
|
-
if (e.error === 'RepoNotFound')
|
|
48
|
-
return new RepoNotFoundError(e);
|
|
49
|
-
if (e.error === 'RepoTakendown')
|
|
50
|
-
return new RepoTakendownError(e);
|
|
51
|
-
if (e.error === 'RepoSuspended')
|
|
52
|
-
return new RepoSuspendedError(e);
|
|
53
|
-
if (e.error === 'RepoDeactivated')
|
|
54
|
-
return new RepoDeactivatedError(e);
|
|
55
|
-
}
|
|
56
|
-
return e;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=getRecord.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.js","sourceRoot":"","sources":["../../../../../../src/client/types/com/atproto/sync/getRecord.ts"],"names":[],"mappings":";;;AAmEA,gCAUC;AA7ED;;GAEG;AACH,wCAAqD;AAGrD,mDAA4D;AAC5D,2CAIyB;AAEzB,MAAM,QAAQ,GAAG,eAAS,EACxB,QAAQ,GAAG,mBAAS,CAAA;AACtB,MAAM,EAAE,GAAG,4BAA4B,CAAA;AAsBvC,MAAa,mBAAoB,SAAQ,gBAAS;IAChD,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAJD,kDAIC;AAED,MAAa,iBAAkB,SAAQ,gBAAS;IAC9C,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAJD,8CAIC;AAED,MAAa,kBAAmB,SAAQ,gBAAS;IAC/C,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAJD,gDAIC;AAED,MAAa,kBAAmB,SAAQ,gBAAS;IAC/C,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAJD,gDAIC;AAED,MAAa,oBAAqB,SAAQ,gBAAS;IACjD,YAAY,GAAc;QACxB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAJD,oDAIC;AAED,SAAgB,UAAU,CAAC,CAAM;IAC/B,IAAI,CAAC,YAAY,gBAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,KAAK,KAAK,gBAAgB;YAAE,OAAO,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAA;QACnE,IAAI,CAAC,CAAC,KAAK,KAAK,cAAc;YAAE,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAA;QAC/D,IAAI,CAAC,CAAC,KAAK,KAAK,eAAe;YAAE,OAAO,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAA;QACjE,IAAI,CAAC,CAAC,KAAK,KAAK,eAAe;YAAE,OAAO,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAA;QACjE,IAAI,CAAC,CAAC,KAAK,KAAK,iBAAiB;YAAE,OAAO,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\nimport { HeadersMap, XRPCError } from '@atproto/xrpc'\nimport { type ValidationResult, BlobRef } from '@atproto/lexicon'\nimport { CID } from 'multiformats/cid'\nimport { validate as _validate } from '../../../../lexicons'\nimport {\n type $Typed,\n is$typed as _is$typed,\n type OmitKey,\n} from '../../../../util'\n\nconst is$typed = _is$typed,\n validate = _validate\nconst id = 'com.atproto.sync.getRecord'\n\nexport type QueryParams = {\n /** The DID of the repo. */\n did: string\n collection: string\n /** Record Key */\n rkey: string\n}\nexport type InputSchema = undefined\n\nexport interface CallOptions {\n signal?: AbortSignal\n headers?: HeadersMap\n}\n\nexport interface Response {\n success: boolean\n headers: HeadersMap\n data: Uint8Array\n}\n\nexport class RecordNotFoundError extends XRPCError {\n constructor(src: XRPCError) {\n super(src.status, src.error, src.message, src.headers, { cause: src })\n }\n}\n\nexport class RepoNotFoundError extends XRPCError {\n constructor(src: XRPCError) {\n super(src.status, src.error, src.message, src.headers, { cause: src })\n }\n}\n\nexport class RepoTakendownError extends XRPCError {\n constructor(src: XRPCError) {\n super(src.status, src.error, src.message, src.headers, { cause: src })\n }\n}\n\nexport class RepoSuspendedError extends XRPCError {\n constructor(src: XRPCError) {\n super(src.status, src.error, src.message, src.headers, { cause: src })\n }\n}\n\nexport class RepoDeactivatedError extends XRPCError {\n constructor(src: XRPCError) {\n super(src.status, src.error, src.message, src.headers, { cause: src })\n }\n}\n\nexport function toKnownErr(e: any) {\n if (e instanceof XRPCError) {\n if (e.error === 'RecordNotFound') return new RecordNotFoundError(e)\n if (e.error === 'RepoNotFound') return new RepoNotFoundError(e)\n if (e.error === 'RepoTakendown') return new RepoTakendownError(e)\n if (e.error === 'RepoSuspended') return new RepoSuspendedError(e)\n if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e)\n }\n\n return e\n}\n"]}
|
package/dist/client/util.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
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>;
|
|
37
|
-
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/client/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI;KACzC,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;CACpD,CAAA;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AACnE,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AAExE,MAAM,MAAM,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,SAAS,MAAM,GAC3E,EAAE,GACF,GAAG,EAAE,IAAI,IAAI,EAAE,CAAA;AAqBnB,MAAM,MAAM,YAAY,CACtB,CAAC,EACD,EAAE,SAAS,MAAM,EACjB,IAAI,SAAS,MAAM,IACjB,CAAC,SAAS;IACZ,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;CACvB,GACG,CAAC,GACD,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,SAAS,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;CAAE,GACnD,CAAC,GAAG;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,GAChB,KAAK,GACP,CAAC,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;CAAE,CAAA;AAEpC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,EAChE,CAAC,EAAE,CAAC,EACJ,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,GACT,CAAC,IAAI,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAEhC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,EACnE,CAAC,EAAE,CAAC,EACJ,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,GACT,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;CAAE,CAK/C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,EAAE,OAAO,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAA;AACxE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,IAC5C,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,QAAQ,EAAE,CAAC,IACzC,CAAC,EAAE,GAAG,CAAC,KAAG,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAGtD"}
|
package/dist/client/util.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
4
|
-
*/
|
|
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';
|
|
11
|
-
}
|
|
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
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=util.js.map
|
package/dist/client/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/client/util.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAgDH,4BAMC;AAED,kCASC;AAUD,kCAIC;AAhED,SAAS,QAAQ,CAAI,CAAI;IACvB,OAAO,CAAC,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAA;AAC3C,CAAC;AAED,SAAS,OAAO,CACd,KAAc,EACd,EAAM,EACN,IAAU;IAEV,OAAO,IAAI,KAAK,MAAM;QACpB,CAAC,CAAC,KAAK,KAAK,EAAE;QACd,CAAC,CAAC,4BAA4B;YAC5B,OAAO,KAAK,KAAK,QAAQ;gBACvB,KAAK,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM;gBAC5C,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,SAAS;gBAC5C,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC;AAgBD,SAAgB,QAAQ,CACtB,CAAI,EACJ,EAAM,EACN,IAAU;IAEV,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;AAClE,CAAC;AAED,SAAgB,WAAW,CACzB,CAAI,EACJ,EAAM,EACN,IAAU;IAEV,OAAO,CACL,QAAQ,CAAC,CAAC,CAAC;QACX,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAC5E,CAAA;AACH,CAAC;AAMD;;;GAGG;AACH,SAAgB,WAAW,CAAsB,QAAW;IAC1D,OAAO,UAAa,CAAI;QACtB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC5B,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * GENERATED CODE - DO NOT MODIFY\n */\n\nimport { type ValidationResult } from '@atproto/lexicon'\n\nexport type OmitKey<T, K extends keyof T> = {\n [K2 in keyof T as K2 extends K ? never : K2]: T[K2]\n}\n\nexport type $Typed<V, T extends string = string> = V & { $type: T }\nexport type Un$Typed<V extends { $type?: string }> = OmitKey<V, '$type'>\n\nexport type $Type<Id extends string, Hash extends string> = Hash extends 'main'\n ? Id\n : `${Id}#${Hash}`\n\nfunction isObject<V>(v: V): v is V & object {\n return v != null && typeof v === 'object'\n}\n\nfunction is$type<Id extends string, Hash extends string>(\n $type: unknown,\n id: Id,\n hash: Hash,\n): $type is $Type<Id, Hash> {\n return hash === 'main'\n ? $type === id\n : // $type === `${id}#${hash}`\n typeof $type === 'string' &&\n $type.length === id.length + 1 + hash.length &&\n $type.charCodeAt(id.length) === 35 /* '#' */ &&\n $type.startsWith(id) &&\n $type.endsWith(hash)\n}\n\nexport type $TypedObject<\n V,\n Id extends string,\n Hash extends string,\n> = V extends {\n $type: $Type<Id, Hash>\n}\n ? V\n : V extends { $type?: string }\n ? V extends { $type?: infer T extends $Type<Id, Hash> }\n ? V & { $type: T }\n : never\n : V & { $type: $Type<Id, Hash> }\n\nexport function is$typed<V, Id extends string, Hash extends string>(\n v: V,\n id: Id,\n hash: Hash,\n): v is $TypedObject<V, Id, Hash> {\n return isObject(v) && '$type' in v && is$type(v.$type, id, hash)\n}\n\nexport function maybe$typed<V, Id extends string, Hash extends string>(\n v: V,\n id: Id,\n hash: Hash,\n): v is V & object & { $type?: $Type<Id, Hash> } {\n return (\n isObject(v) &&\n ('$type' in v ? v.$type === undefined || is$type(v.$type, id, hash) : true)\n )\n}\n\nexport type Validator<R = unknown> = (v: unknown) => ValidationResult<R>\nexport type ValidatorParam<V extends Validator> =\n V extends Validator<infer R> ? R : never\n\n/**\n * Utility function that allows to convert a \"validate*\" utility function into a\n * type predicate.\n */\nexport function asPredicate<V extends Validator>(validate: V) {\n return function <T>(v: T): v is T & ValidatorParam<V> {\n return validate(v).success\n }\n}\n"]}
|
package/src/client/index.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
XrpcClient,
|
|
6
|
-
type FetchHandler,
|
|
7
|
-
type FetchHandlerOptions,
|
|
8
|
-
} from '@atproto/xrpc'
|
|
9
|
-
import { schemas } from './lexicons.js'
|
|
10
|
-
import { CID } from 'multiformats/cid'
|
|
11
|
-
import { type OmitKey, type Un$Typed } from './util.js'
|
|
12
|
-
import * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js'
|
|
13
|
-
|
|
14
|
-
export * as ComAtprotoSyncGetRecord from './types/com/atproto/sync/getRecord.js'
|
|
15
|
-
|
|
16
|
-
export class AtpBaseClient extends XrpcClient {
|
|
17
|
-
com: ComNS
|
|
18
|
-
|
|
19
|
-
constructor(options: FetchHandler | FetchHandlerOptions) {
|
|
20
|
-
super(options, schemas)
|
|
21
|
-
this.com = new ComNS(this)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** @deprecated use `this` instead */
|
|
25
|
-
get xrpc(): XrpcClient {
|
|
26
|
-
return this
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class ComNS {
|
|
31
|
-
_client: XrpcClient
|
|
32
|
-
atproto: ComAtprotoNS
|
|
33
|
-
|
|
34
|
-
constructor(client: XrpcClient) {
|
|
35
|
-
this._client = client
|
|
36
|
-
this.atproto = new ComAtprotoNS(client)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class ComAtprotoNS {
|
|
41
|
-
_client: XrpcClient
|
|
42
|
-
sync: ComAtprotoSyncNS
|
|
43
|
-
|
|
44
|
-
constructor(client: XrpcClient) {
|
|
45
|
-
this._client = client
|
|
46
|
-
this.sync = new ComAtprotoSyncNS(client)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class ComAtprotoSyncNS {
|
|
51
|
-
_client: XrpcClient
|
|
52
|
-
|
|
53
|
-
constructor(client: XrpcClient) {
|
|
54
|
-
this._client = client
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getRecord(
|
|
58
|
-
params?: ComAtprotoSyncGetRecord.QueryParams,
|
|
59
|
-
opts?: ComAtprotoSyncGetRecord.CallOptions,
|
|
60
|
-
): Promise<ComAtprotoSyncGetRecord.Response> {
|
|
61
|
-
return this._client
|
|
62
|
-
.call('com.atproto.sync.getRecord', params, undefined, opts)
|
|
63
|
-
.catch((e) => {
|
|
64
|
-
throw ComAtprotoSyncGetRecord.toKnownErr(e)
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
}
|
package/src/client/lexicons.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
type LexiconDoc,
|
|
6
|
-
Lexicons,
|
|
7
|
-
ValidationError,
|
|
8
|
-
type ValidationResult,
|
|
9
|
-
} from '@atproto/lexicon'
|
|
10
|
-
import { type $Typed, is$typed, maybe$typed } from './util.js'
|
|
11
|
-
|
|
12
|
-
export const schemaDict = {
|
|
13
|
-
ComAtprotoSyncGetRecord: {
|
|
14
|
-
lexicon: 1,
|
|
15
|
-
id: 'com.atproto.sync.getRecord',
|
|
16
|
-
defs: {
|
|
17
|
-
main: {
|
|
18
|
-
type: 'query',
|
|
19
|
-
description:
|
|
20
|
-
'Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.',
|
|
21
|
-
parameters: {
|
|
22
|
-
type: 'params',
|
|
23
|
-
required: ['did', 'collection', 'rkey'],
|
|
24
|
-
properties: {
|
|
25
|
-
did: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
format: 'did',
|
|
28
|
-
description: 'The DID of the repo.',
|
|
29
|
-
},
|
|
30
|
-
collection: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
format: 'nsid',
|
|
33
|
-
},
|
|
34
|
-
rkey: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Record Key',
|
|
37
|
-
format: 'record-key',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
output: {
|
|
42
|
-
encoding: 'application/vnd.ipld.car',
|
|
43
|
-
},
|
|
44
|
-
errors: [
|
|
45
|
-
{
|
|
46
|
-
name: 'RecordNotFound',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'RepoNotFound',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'RepoTakendown',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'RepoSuspended',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'RepoDeactivated',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
} as const satisfies Record<string, LexiconDoc>
|
|
65
|
-
export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
|
|
66
|
-
export const lexicons: Lexicons = new Lexicons(schemas)
|
|
67
|
-
|
|
68
|
-
export function validate<T extends { $type: string }>(
|
|
69
|
-
v: unknown,
|
|
70
|
-
id: string,
|
|
71
|
-
hash: string,
|
|
72
|
-
requiredType: true,
|
|
73
|
-
): ValidationResult<T>
|
|
74
|
-
export function validate<T extends { $type?: string }>(
|
|
75
|
-
v: unknown,
|
|
76
|
-
id: string,
|
|
77
|
-
hash: string,
|
|
78
|
-
requiredType?: false,
|
|
79
|
-
): ValidationResult<T>
|
|
80
|
-
export function validate(
|
|
81
|
-
v: unknown,
|
|
82
|
-
id: string,
|
|
83
|
-
hash: string,
|
|
84
|
-
requiredType?: boolean,
|
|
85
|
-
): ValidationResult {
|
|
86
|
-
return (requiredType ? is$typed : maybe$typed)(v, id, hash)
|
|
87
|
-
? lexicons.validate(`${id}#${hash}`, v)
|
|
88
|
-
: {
|
|
89
|
-
success: false,
|
|
90
|
-
error: new ValidationError(
|
|
91
|
-
`Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
|
|
92
|
-
),
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export const ids = {
|
|
97
|
-
ComAtprotoSyncGetRecord: 'com.atproto.sync.getRecord',
|
|
98
|
-
} as const
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { HeadersMap, XRPCError } from '@atproto/xrpc'
|
|
5
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
-
import { CID } from 'multiformats/cid'
|
|
7
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
8
|
-
import {
|
|
9
|
-
type $Typed,
|
|
10
|
-
is$typed as _is$typed,
|
|
11
|
-
type OmitKey,
|
|
12
|
-
} from '../../../../util'
|
|
13
|
-
|
|
14
|
-
const is$typed = _is$typed,
|
|
15
|
-
validate = _validate
|
|
16
|
-
const id = 'com.atproto.sync.getRecord'
|
|
17
|
-
|
|
18
|
-
export type QueryParams = {
|
|
19
|
-
/** The DID of the repo. */
|
|
20
|
-
did: string
|
|
21
|
-
collection: string
|
|
22
|
-
/** Record Key */
|
|
23
|
-
rkey: string
|
|
24
|
-
}
|
|
25
|
-
export type InputSchema = undefined
|
|
26
|
-
|
|
27
|
-
export interface CallOptions {
|
|
28
|
-
signal?: AbortSignal
|
|
29
|
-
headers?: HeadersMap
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface Response {
|
|
33
|
-
success: boolean
|
|
34
|
-
headers: HeadersMap
|
|
35
|
-
data: Uint8Array
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class RecordNotFoundError extends XRPCError {
|
|
39
|
-
constructor(src: XRPCError) {
|
|
40
|
-
super(src.status, src.error, src.message, src.headers, { cause: src })
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export class RepoNotFoundError extends XRPCError {
|
|
45
|
-
constructor(src: XRPCError) {
|
|
46
|
-
super(src.status, src.error, src.message, src.headers, { cause: src })
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class RepoTakendownError extends XRPCError {
|
|
51
|
-
constructor(src: XRPCError) {
|
|
52
|
-
super(src.status, src.error, src.message, src.headers, { cause: src })
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export class RepoSuspendedError extends XRPCError {
|
|
57
|
-
constructor(src: XRPCError) {
|
|
58
|
-
super(src.status, src.error, src.message, src.headers, { cause: src })
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export class RepoDeactivatedError extends XRPCError {
|
|
63
|
-
constructor(src: XRPCError) {
|
|
64
|
-
super(src.status, src.error, src.message, src.headers, { cause: src })
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function toKnownErr(e: any) {
|
|
69
|
-
if (e instanceof XRPCError) {
|
|
70
|
-
if (e.error === 'RecordNotFound') return new RecordNotFoundError(e)
|
|
71
|
-
if (e.error === 'RepoNotFound') return new RepoNotFoundError(e)
|
|
72
|
-
if (e.error === 'RepoTakendown') return new RepoTakendownError(e)
|
|
73
|
-
if (e.error === 'RepoSuspended') return new RepoSuspendedError(e)
|
|
74
|
-
if (e.error === 'RepoDeactivated') return new RepoDeactivatedError(e)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return e
|
|
78
|
-
}
|