@atproto/lexicon-resolver 0.4.1 → 0.4.2
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 +14 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lexicon.js.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.d.ts +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts +11 -11
- package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.defs.js +3 -2
- package/dist/lexicons/com/atproto/lexicon/schema.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.js +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.js.map +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.d.ts +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts +4 -4
- package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.defs.js +7 -7
- package/dist/lexicons/com/atproto/sync/getRecord.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.js +1 -1
- package/dist/lexicons/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/record.d.ts +1 -1
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js.map +1 -1
- package/package.json +9 -10
- package/tests/record.test.ts +1 -2
- package/tsconfig.build.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +2 -2
- package/tsconfig.tests.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atproto/lexicon-resolver
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4967](https://github.com/bluesky-social/atproto/pull/4967) [`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use TypeScript 7 to build package
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
|
|
10
|
+
- @atproto-labs/fetch-node@0.3.1
|
|
11
|
+
- @atproto/lex-document@0.1.1
|
|
12
|
+
- @atproto/identity@0.5.1
|
|
13
|
+
- @atproto/lex@0.1.4
|
|
14
|
+
- @atproto/syntax@0.6.2
|
|
15
|
+
- @atproto/repo@0.10.1
|
|
16
|
+
|
|
3
17
|
## 0.4.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/lexicon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon.d.ts","sourceRoot":"","sources":["../src/lexicon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,eAAe,EAAyB,MAAM,uBAAuB,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,KAAK,cAAc,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EAErB,MAAM,aAAa,CAAA;AAKpB,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,IAAI,GAAG,eAAe,CAAA;AACzE,eAAO,MAAM,mBAAmB,+BAAuB,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,IAAI,GAAG,UAAU,KACpB,OAAO,CAAC,iBAAiB,C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AAC,CAKhC;AAED,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,IAAI;aACV,WAAW;IAF7B,YACkB,IAAI,EAAE,IAAI,EACV,WAAW,SAAuC,EAClE,OAAO,CAAC,EAAE,YAAY,EAIvB;IAED,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,YAAY,GACrB,sBAAsB,CAGxB;CACF"}
|
package/dist/lexicon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon.js","sourceRoot":"","sources":["../src/lexicon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAO,CAAC,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE9E,OAAO,EAAE,KAAK,EAAa,IAAI,EAAc,MAAM,iBAAiB,CAAA;AACpE,OAAO,KAAK,cAAc,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAGL,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAEpB,MAAM,aAAa,GAAG,UAAU,CAAA;AAChC,MAAM,UAAU,GAAG,MAAM,CAAA;AAGzB,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAA;AA+BvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AAGtB;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,
|
|
1
|
+
{"version":3,"file":"lexicon.js","sourceRoot":"","sources":["../src/lexicon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAO,CAAC,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAmB,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE9E,OAAO,EAAE,KAAK,EAAa,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OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import * as dns from 'node:dns/promises'\nimport { Cid, l } from '@atproto/lex'\nimport { LexiconDocument, lexiconDocumentSchema } from '@atproto/lex-document'\nimport { Commit } from '@atproto/repo'\nimport { AtUri, DidString, NSID, NsidString } from '@atproto/syntax'\nimport * as lexiconsSchema from './lexicons/com/atproto/lexicon/schema.js'\nimport {\n BuildRecordResolverOptions,\n ResolveRecordOptions,\n buildRecordResolver,\n} from './record.js'\n\nconst DNS_SUBDOMAIN = '_lexicon'\nconst DNS_PREFIX = 'did='\n\nexport type LexiconDocumentRecord = lexiconsSchema.Main & LexiconDocument\nexport const LEXICON_SCHEMA_NSID = lexiconsSchema.$nsid\n\n/**\n * Resolve Lexicon from an NSID\n */\nexport type LexiconResolver = (\n nsid: NSID | NsidString,\n) => Promise<LexiconResolution>\n\n/**\n * Resolve Lexicon from an NSID using Lexicon DID authority and record resolution\n */\nexport type AtprotoLexiconResolver = (\n nsid: NSID | NsidString,\n options?: ResolveLexiconOptions,\n) => Promise<LexiconResolution>\n\nexport type BuildLexiconResolverOptions = BuildRecordResolverOptions\n\nexport type ResolveLexiconOptions = ResolveRecordOptions & {\n didAuthority?: DidString\n}\n\nexport type LexiconResolution = {\n commit: Commit\n uri: AtUri\n cid: Cid\n nsid: NSID\n lexicon: LexiconDocumentRecord\n}\n\nexport { AtUri, NSID }\nexport type { Cid, Commit, DidString, LexiconDocument, NsidString }\n\n/**\n * Build a Lexicon resolver function.\n */\nexport function buildLexiconResolver(\n options: BuildLexiconResolverOptions = {},\n): AtprotoLexiconResolver {\n const resolveRecord = buildRecordResolver(options)\n return async function (\n input: NSID | NsidString,\n opts: ResolveLexiconOptions = {},\n ): Promise<LexiconResolution> {\n const nsid = NSID.from(input)\n const didAuthority = await getDidAuthority(nsid, opts)\n const verified = await resolveRecord(\n AtUri.make(didAuthority, lexiconsSchema.$nsid, nsid.toString()),\n { forceRefresh: opts.forceRefresh },\n ).catch((err) => {\n throw new LexiconResolutionError(\n nsid,\n 'Could not resolve Lexicon schema record',\n { cause: err },\n )\n })\n\n if (!lexiconsSchema.$matches(verified.record)) {\n throw new LexiconResolutionError(nsid, 'Invalid Lexicon schema record')\n }\n\n const validationResult = lexiconDocumentSchema.safeValidate(verified.record)\n if (!validationResult.success) {\n throw new LexiconResolutionError(nsid, 'Invalid Lexicon document', {\n cause: validationResult.reason,\n })\n }\n\n const lexicon = validationResult.value\n if (lexicon.id !== nsid.toString()) {\n throw new LexiconResolutionError(\n nsid,\n `Lexicon schema record id (${lexicon.id}) does not match NSID`,\n )\n }\n const { uri, cid, commit } = verified\n return { commit, uri, cid, nsid, lexicon }\n } satisfies LexiconResolver\n}\n\nexport const resolveLexicon = buildLexiconResolver()\n\n/**\n * Resolve the DID authority for a Lexicon from the network using DNS, based on its NSID.\n * @param input NSID or string representing one for which to lookup its Lexicon DID authority.\n */\nexport async function resolveLexiconDidAuthority(\n input: NSID | NsidString,\n): Promise<DidString | undefined> {\n const nsid = NSID.from(input)\n const did = await resolveDns(nsid.authority)\n if (did == null || !l.isDidString(did)) return\n return did\n}\n\nexport class LexiconResolutionError extends Error {\n constructor(\n public readonly nsid: NSID,\n public readonly description = `Could not resolve Lexicon for NSID`,\n options?: ErrorOptions,\n ) {\n super(`${description} (${nsid})`, options)\n this.name = 'LexiconResolutionError'\n }\n\n static from(\n input: NSID | string,\n description?: string,\n options?: ErrorOptions,\n ): LexiconResolutionError {\n const nsid = NSID.from(input)\n return new LexiconResolutionError(nsid, description, options)\n }\n}\n\nasync function getDidAuthority(nsid: NSID, options: ResolveLexiconOptions) {\n if (options.didAuthority) {\n return options.didAuthority\n }\n const did = await resolveLexiconDidAuthority(nsid)\n if (!did) {\n throw new LexiconResolutionError(\n nsid,\n `Could not resolve a DID authority for NSID`,\n )\n }\n return did\n}\n\nasync function resolveDns(authority: string): Promise<string | undefined> {\n let chunkedResults: string[][]\n try {\n chunkedResults = await dns.resolveTxt(`${DNS_SUBDOMAIN}.${authority}`)\n } catch (err) {\n return undefined\n }\n return parseDnsResult(chunkedResults)\n}\n\nfunction parseDnsResult(chunkedResults: string[][]): string | undefined {\n const results = chunkedResults.map((chunks) => chunks.join(''))\n const found = results.filter((i) => i.startsWith(DNS_PREFIX))\n if (found.length !== 1) {\n return undefined\n }\n return found[0].slice(DNS_PREFIX.length)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAA;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -13,51 +13,51 @@ export type { Main };
|
|
|
13
13
|
/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */
|
|
14
14
|
declare const main: l.RecordSchema<"nsid", "com.atproto.lexicon.schema", l.Validator<Omit<Main, "$type">, Omit<Main, "$type">>>;
|
|
15
15
|
export { main };
|
|
16
|
+
export declare const $type = "com.atproto.lexicon.schema";
|
|
16
17
|
export declare const $isTypeOf: <TValue extends {
|
|
17
18
|
$type?: unknown;
|
|
18
19
|
}>(value: TValue) => value is l.TypedRecord<"com.atproto.lexicon.schema", TValue>;
|
|
19
20
|
export declare const $build: {
|
|
20
21
|
(input: Omit<Omit<Main, "$type">, "$type">): {
|
|
21
|
-
lexicon: number;
|
|
22
22
|
$type: "com.atproto.lexicon.schema";
|
|
23
|
+
lexicon: number;
|
|
23
24
|
};
|
|
24
25
|
(input: Omit<Omit<Main, "$type">, "$type">): {
|
|
25
|
-
lexicon: number;
|
|
26
26
|
$type: "com.atproto.lexicon.schema";
|
|
27
|
+
lexicon: number;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
|
-
export declare const $type: "com.atproto.lexicon.schema";
|
|
30
30
|
export declare const $assert: (input: unknown, options?: l.ValidateOptions) => asserts input is {
|
|
31
|
-
lexicon: number;
|
|
32
31
|
$type: "com.atproto.lexicon.schema";
|
|
32
|
+
lexicon: number;
|
|
33
33
|
};
|
|
34
34
|
export declare const $check: (input: unknown, options?: l.ValidateOptions) => void;
|
|
35
35
|
export declare const $cast: <I>(input: I, options?: l.ValidateOptions) => I & {
|
|
36
|
-
lexicon: number;
|
|
37
36
|
$type: "com.atproto.lexicon.schema";
|
|
37
|
+
lexicon: number;
|
|
38
38
|
};
|
|
39
39
|
export declare const $ifMatches: <I>(input: I, options?: l.ValidateOptions) => (I & {
|
|
40
|
-
lexicon: number;
|
|
41
40
|
$type: "com.atproto.lexicon.schema";
|
|
41
|
+
lexicon: number;
|
|
42
42
|
}) | undefined;
|
|
43
43
|
export declare const $matches: <I>(input: I, options?: l.ValidateOptions) => input is I & {
|
|
44
|
-
lexicon: number;
|
|
45
44
|
$type: "com.atproto.lexicon.schema";
|
|
45
|
+
lexicon: number;
|
|
46
46
|
};
|
|
47
47
|
export declare const $parse: (input: unknown, options?: l.ParseOptions) => {
|
|
48
|
-
lexicon: number;
|
|
49
48
|
$type: "com.atproto.lexicon.schema";
|
|
49
|
+
lexicon: number;
|
|
50
50
|
};
|
|
51
51
|
export declare const $safeParse: (input: unknown, options?: l.ParseOptions) => l.ValidationResult<{
|
|
52
|
-
lexicon: number;
|
|
53
52
|
$type: "com.atproto.lexicon.schema";
|
|
53
|
+
lexicon: number;
|
|
54
54
|
}>;
|
|
55
55
|
export declare const $validate: <I>(input: I, options?: l.ValidateOptions) => I & {
|
|
56
|
-
lexicon: number;
|
|
57
56
|
$type: "com.atproto.lexicon.schema";
|
|
57
|
+
lexicon: number;
|
|
58
58
|
};
|
|
59
59
|
export declare const $safeValidate: <I>(input: I, options?: l.ValidateOptions) => l.ValidationResult<I & {
|
|
60
|
-
lexicon: number;
|
|
61
60
|
$type: "com.atproto.lexicon.schema";
|
|
61
|
+
lexicon: number;
|
|
62
62
|
}>;
|
|
63
63
|
//# sourceMappingURL=schema.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wUAAwU;AACxU,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,4BAA4B,CAAA;IAEnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,YAAY,EAAE,IAAI,EAAE,CAAA;AAEpB,wUAAwU;AACxU,QAAA,MAAM,IAAI,6GAIT,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wUAAwU;AACxU,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,4BAA4B,CAAA;IAEnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,YAAY,EAAE,IAAI,EAAE,CAAA;AAEpB,wUAAwU;AACxU,QAAA,MAAM,IAAI,6GAIT,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,eAAO,MAAM,KAAK,+BAAQ,CAAA;AAC1B,eAAO,MAAM,SAAS;;iFAAyC,CAAA;AAC/D,eAAO,MAAM,MAAM;;;iBAhBR,MAAM;;;;iBAAN,MAAM;;CAgBwC,CAAA;AACzD,eAAO,MAAM,OAAO;;aAjBT,MAAM;CAiB0C,CAAA;AAC3D,eAAO,MAAM,MAAM,uDAAsC,CAAA;AACzD,eAAO,MAAM,KAAK;;aAnBP,MAAM;CAmBsC,CAAA;AACvD,eAAO,MAAM,UAAU;;aApBZ,MAAM;cAoBgD,CAAA;AACjE,eAAO,MAAM,QAAQ;;aArBV,MAAM;CAqB4C,CAAA;AAC7D,eAAO,MAAM,MAAM;;aAtBR,MAAM;CAsBwC,CAAA;AACzD,eAAO,MAAM,UAAU;;aAvBZ,MAAM;EAuBgD,CAAA;AACjE,eAAO,MAAM,SAAS;;aAxBX,MAAM;CAwB8C,CAAA;AAC/D,eAAO,MAAM,aAAa;;aAzBf,MAAM;EAyBsD,CAAA"}
|
|
@@ -5,11 +5,12 @@ import { l } from '@atproto/lex';
|
|
|
5
5
|
const $nsid = 'com.atproto.lexicon.schema';
|
|
6
6
|
export { $nsid };
|
|
7
7
|
/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */
|
|
8
|
-
const main = l.record('nsid', $nsid,
|
|
8
|
+
const main = /*#__PURE__*/ l.record('nsid', $nsid,
|
|
9
|
+
/*#__PURE__*/ l.object({ lexicon: /*#__PURE__*/ l.integer() }));
|
|
9
10
|
export { main };
|
|
11
|
+
export const $type = $nsid;
|
|
10
12
|
export const $isTypeOf = /*#__PURE__*/ main.isTypeOf.bind(main);
|
|
11
13
|
export const $build = /*#__PURE__*/ main.build.bind(main);
|
|
12
|
-
export const $type = main.$type;
|
|
13
14
|
export const $assert = /*#__PURE__*/ main.assert.bind(main);
|
|
14
15
|
export const $check = /*#__PURE__*/ main.check.bind(main);
|
|
15
16
|
export const $cast = /*#__PURE__*/ main.cast.bind(main);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAchB,wUAAwU;AACxU,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAchB,wUAAwU;AACxU,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CACjC,MAAM,EACN,KAAK;AACL,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC/D,CAAA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAA;AAC1B,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC/D,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzD,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzD,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC7D,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex'\n\nconst $nsid = 'com.atproto.lexicon.schema'\n\nexport { $nsid }\n\n/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */\ntype Main = {\n $type: 'com.atproto.lexicon.schema'\n\n /**\n * Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system.\n */\n lexicon: number\n}\n\nexport type { Main }\n\n/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */\nconst main = /*#__PURE__*/ l.record<'nsid', Main>(\n 'nsid',\n $nsid,\n /*#__PURE__*/ l.object({ lexicon: /*#__PURE__*/ l.integer() }),\n)\n\nexport { main }\n\nexport const $type = $nsid\nexport const $isTypeOf = /*#__PURE__*/ main.isTypeOf.bind(main)\nexport const $build = /*#__PURE__*/ main.build.bind(main)\nexport const $assert = /*#__PURE__*/ main.assert.bind(main)\nexport const $check = /*#__PURE__*/ main.check.bind(main)\nexport const $cast = /*#__PURE__*/ main.cast.bind(main)\nexport const $ifMatches = /*#__PURE__*/ main.ifMatches.bind(main)\nexport const $matches = /*#__PURE__*/ main.matches.bind(main)\nexport const $parse = /*#__PURE__*/ main.parse.bind(main)\nexport const $safeParse = /*#__PURE__*/ main.safeParse.bind(main)\nexport const $validate = /*#__PURE__*/ main.validate.bind(main)\nexport const $safeValidate = /*#__PURE__*/ main.safeValidate.bind(main)\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAA;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './schema.defs.js'\nexport { main as default } from './schema.defs.js'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAA;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"getRecord.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { l } from '@atproto/lex';
|
|
2
2
|
declare const $nsid = "com.atproto.sync.getRecord";
|
|
3
3
|
export { $nsid };
|
|
4
|
-
export declare const $lxm = "com.atproto.sync.getRecord";
|
|
5
4
|
export declare const $params: l.ParamsSchema<{
|
|
6
5
|
readonly did: l.StringSchema<{
|
|
7
6
|
readonly format: "did";
|
|
@@ -13,7 +12,10 @@ export declare const $params: l.ParamsSchema<{
|
|
|
13
12
|
readonly format: "record-key";
|
|
14
13
|
}>;
|
|
15
14
|
}>;
|
|
15
|
+
export type $Params = l.InferOutput<typeof $params>;
|
|
16
16
|
export declare const $output: l.Payload<"application/vnd.ipld.car", undefined>;
|
|
17
|
+
export type $Output<B = l.BinaryData> = l.InferPayload<typeof $output, B>;
|
|
18
|
+
export type $OutputBody<B = l.BinaryData> = l.InferPayloadBody<typeof $output, B>;
|
|
17
19
|
/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */
|
|
18
20
|
declare const main: l.Query<"com.atproto.sync.getRecord", l.ParamsSchema<{
|
|
19
21
|
readonly did: l.StringSchema<{
|
|
@@ -27,7 +29,5 @@ declare const main: l.Query<"com.atproto.sync.getRecord", l.ParamsSchema<{
|
|
|
27
29
|
}>;
|
|
28
30
|
}>, l.Payload<"application/vnd.ipld.car", undefined>, readonly ["RecordNotFound", "RepoNotFound", "RepoTakendown", "RepoSuspended", "RepoDeactivated"]>;
|
|
29
31
|
export { main };
|
|
30
|
-
export
|
|
31
|
-
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
32
|
-
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
32
|
+
export declare const $lxm = "com.atproto.sync.getRecord";
|
|
33
33
|
//# sourceMappingURL=getRecord.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"getRecord.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,QAAA,MAAM,KAAK,+BAA+B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,eAAO,MAAM,OAAO;;;;;;;;;;EAIlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,OAAO,CAAC,CAAA;AAEnD,eAAO,MAAM,OAAO,kDAAsD,CAAA;AAE1E,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,CAAA;AACzE,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,gBAAgB,CAC5D,OAAO,OAAO,EACd,CAAC,CACF,CAAA;AAED,sIAAsI;AACtI,QAAA,MAAM,IAAI;;;;;;;;;;uJAMR,CAAA;AAEF,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,eAAO,MAAM,IAAI,+BAAQ,CAAA"}
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
import { l } from '@atproto/lex';
|
|
5
5
|
const $nsid = 'com.atproto.sync.getRecord';
|
|
6
6
|
export { $nsid };
|
|
7
|
-
export const $
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rkey: l.string({ format: 'record-key' }),
|
|
7
|
+
export const $params = /*#__PURE__*/ l.params({
|
|
8
|
+
did: /*#__PURE__*/ l.string({ format: 'did' }),
|
|
9
|
+
collection: /*#__PURE__*/ l.string({ format: 'nsid' }),
|
|
10
|
+
rkey: /*#__PURE__*/ l.string({ format: 'record-key' }),
|
|
12
11
|
});
|
|
13
|
-
export const $output = l.payload('application/vnd.ipld.car');
|
|
12
|
+
export const $output = /*#__PURE__*/ l.payload('application/vnd.ipld.car');
|
|
14
13
|
/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */
|
|
15
|
-
const main = l.query($nsid, $params, $output, [
|
|
14
|
+
const main = /*#__PURE__*/ l.query($nsid, $params, $output, [
|
|
16
15
|
'RecordNotFound',
|
|
17
16
|
'RepoNotFound',
|
|
18
17
|
'RepoTakendown',
|
|
@@ -20,4 +19,5 @@ const main = l.query($nsid, $params, $output, [
|
|
|
20
19
|
'RepoDeactivated',
|
|
21
20
|
]);
|
|
22
21
|
export { main };
|
|
22
|
+
export const $lxm = $nsid;
|
|
23
23
|
//# sourceMappingURL=getRecord.defs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"getRecord.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.defs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACtD,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;CACvD,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAA;AAQ1E,sIAAsI;AACtI,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;IAC1D,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,eAAe;IACf,iBAAiB;CAClB,CAAC,CAAA;AAEF,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex'\n\nconst $nsid = 'com.atproto.sync.getRecord'\n\nexport { $nsid }\n\nexport const $params = /*#__PURE__*/ l.params({\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n collection: /*#__PURE__*/ l.string({ format: 'nsid' }),\n rkey: /*#__PURE__*/ l.string({ format: 'record-key' }),\n})\n\nexport type $Params = l.InferOutput<typeof $params>\n\nexport const $output = /*#__PURE__*/ l.payload('application/vnd.ipld.car')\n\nexport type $Output<B = l.BinaryData> = l.InferPayload<typeof $output, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferPayloadBody<\n typeof $output,\n B\n>\n\n/** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */\nconst main = /*#__PURE__*/ l.query($nsid, $params, $output, [\n 'RecordNotFound',\n 'RepoNotFound',\n 'RepoTakendown',\n 'RepoSuspended',\n 'RepoDeactivated',\n])\n\nexport { main }\n\nexport const $lxm = $nsid\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecord.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAA;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"getRecord.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './getRecord.defs.js'\nexport { main as default } from './getRecord.defs.js'\n"]}
|
package/dist/record.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type RecordResolution = {
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function buildRecordResolver(options?: BuildRecordResolverOptions): AtprotoRecordResolver;
|
|
32
32
|
export declare const resolveRecord: AtprotoRecordResolver;
|
|
33
|
-
export declare const safeFetch: (input: string |
|
|
33
|
+
export declare const safeFetch: (input: string | Request | URL, init?: RequestInit | undefined) => Promise<Response>;
|
|
34
34
|
export declare class RecordResolutionError extends Error {
|
|
35
35
|
constructor(message?: string, options?: ErrorOptions);
|
|
36
36
|
}
|
package/dist/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,mBAAmB,CAAA;AACtE,OAAO,EACL,WAAW,EACX,GAAG,EAEH,SAAS,EACT,YAAY,EACZ,MAAM,EAEP,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,MAAM,EAMP,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAIpD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;AAC5B,YAAY,EACV,WAAW,EACX,WAAW,EACX,GAAG,EACH,MAAM,EACN,SAAS,EACT,YAAY,EACZ,MAAM,GACP,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,KAAK,GAAG,WAAW,KACrB,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE9B;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,GAAG,EAAE,KAAK,GAAG,WAAW,EACxB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE9B,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,YAAY,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,KAAK,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;G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AAG,EAAE,KAAK,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,qBAAqB,CAoDvB;AAED,eAAO,MAAM,aAAa,uBAAwB,CAAA;AAElD,eAAO,MAAM,SAAS,sFAIpB,CAAA;AAEF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGnD;CACF"}
|
package/dist/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAGL,MAAM,EAIN,CAAC,GACF,MAAM,cAAc,CAAA;AACrB,OAAO,EAEL,GAAG,EACH,gBAAgB,EAChB,GAAG,IAAI,OAAO,EACd,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;AA0C5B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AACtE,OAAO,EAGL,MAAM,EAIN,CAAC,GACF,MAAM,cAAc,CAAA;AACrB,OAAO,EAEL,GAAG,EACH,gBAAgB,EAChB,GAAG,IAAI,OAAO,EACd,eAAe,EACf,eAAe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M,CAAC,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,qBAAqB,CAC7B,gCAAgC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAClD,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,qBAAqB,CAAC,2BAA2B,CAAC,CAAA;IAC9D,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,MAAM,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAW,CAAA;IAC3D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACrC,CAAC","sourcesContent":["import { IdResolver, parseToAtprotoDocument } from '@atproto/identity'\nimport {\n AgentConfig,\n Cid,\n Client,\n DidString,\n FetchHandler,\n LexMap,\n l,\n} from '@atproto/lex'\nimport {\n Commit,\n MST,\n MemoryBlockstore,\n def as repoDef,\n readCarWithRoot,\n verifyCommitSig,\n} from '@atproto/repo'\nimport { AtUri, AtUriString } from '@atproto/syntax'\nimport { safeFetchWrap } from '@atproto-labs/fetch-node'\nimport { com } from './lexicons/index.js'\n\nexport { AtUri, IdResolver }\nexport type {\n AgentConfig,\n AtUriString,\n Cid,\n Commit,\n DidString,\n FetchHandler,\n LexMap,\n}\n\n/**\n * Resolve a record from the network.\n */\nexport type RecordResolver = (\n uri: AtUri | AtUriString,\n) => Promise<RecordResolution>\n\n/**\n * Resolve a record from the network, verifying its authenticity.\n */\nexport type AtprotoRecordResolver = (\n uri: AtUri | AtUriString,\n options?: ResolveRecordOptions,\n) => Promise<RecordResolution>\n\nexport type BuildRecordResolverOptions = {\n idResolver?: IdResolver\n rpc?: Partial<AgentConfig> | FetchHandler\n}\n\nexport type ResolveRecordOptions = {\n forceRefresh?: boolean\n}\n\nexport type RecordResolution = {\n commit: Commit\n uri: AtUri\n cid: Cid\n record: LexMap\n}\n\n/**\n * Build a record resolver function.\n */\nexport function buildRecordResolver(\n options: BuildRecordResolverOptions = {},\n): AtprotoRecordResolver {\n const { idResolver = new IdResolver(), rpc } = options\n return async function resolveRecord(\n uriStr: AtUri | AtUriString,\n opts: ResolveRecordOptions = {},\n ): Promise<RecordResolution> {\n const uri = typeof uriStr === 'string' ? new AtUri(uriStr) : uriStr\n const did = await getDidFromUri(uri, { idResolver })\n const identityDoc = await idResolver.did\n .ensureResolve(did, opts.forceRefresh)\n .catch((err) => {\n throw new RecordResolutionError('Could not resolve DID identity data', {\n cause: err,\n })\n })\n const { pds, signingKey } = parseToAtprotoDocument(identityDoc)\n if (!pds) {\n throw new RecordResolutionError(\n 'Incomplete DID identity data: missing pds',\n )\n }\n if (!signingKey) {\n throw new RecordResolutionError(\n 'Incomplete DID identity data: missing signing key',\n )\n }\n const client = new Client(\n typeof rpc === 'function'\n ? { fetchHandler: rpc }\n : {\n ...rpc,\n service: rpc?.service ?? pds,\n fetch: rpc?.fetch ?? safeFetch,\n },\n )\n const proofBytes = await client\n .call(com.atproto.sync.getRecord, {\n did,\n collection: uri.collection as l.NsidString,\n rkey: uri.rkey as l.RecordKeyString,\n })\n .catch((err) => {\n throw new RecordResolutionError('Could not fetch record proof', {\n cause: err,\n })\n })\n const verified = await verifyRecordProof(proofBytes, {\n uri: AtUri.make(did, uri.collection, uri.rkey),\n signingKey,\n })\n return verified\n }\n}\n\nexport const resolveRecord = buildRecordResolver()\n\nexport const safeFetch = safeFetchWrap({\n allowIpHost: false,\n allowImplicitRedirect: true,\n responseMaxSize: (1024 + 10) * 1024, // 1MB + 10kB, just a bit larger than max record size\n})\n\nexport class RecordResolutionError extends Error {\n constructor(message?: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'RecordResolutionError'\n }\n}\n\nasync function getDidFromUri(\n uri: AtUri,\n { idResolver }: { idResolver: IdResolver },\n): Promise<DidString> {\n if (l.isDidString(uri.host)) {\n return uri.host\n }\n\n const resolved = await idResolver.handle.resolve(uri.host)\n if (!resolved || !l.isDidString(resolved)) {\n throw new RecordResolutionError('Could not resolve handle found in AT-URI')\n }\n\n return resolved\n}\n\nasync function verifyRecordProof(\n proofBytes: Uint8Array,\n { uri, signingKey }: { uri: AtUri; signingKey: string },\n): Promise<RecordResolution> {\n const { root, blocks } = await readCarWithRoot(proofBytes).catch((err) => {\n throw new RecordResolutionError('Malformed record proof', { cause: err })\n })\n const blockstore = new MemoryBlockstore(blocks)\n const commit = await blockstore.readObj(root, repoDef.commit).catch((err) => {\n throw new RecordResolutionError('Invalid commit in record proof', {\n cause: err,\n })\n })\n if (commit.did !== uri.host) {\n throw new RecordResolutionError(`Invalid repo did: ${commit.did}`)\n }\n const validSig = await verifyCommitSig(commit, signingKey)\n if (!validSig) {\n throw new RecordResolutionError(\n `Invalid signature on commit: ${root.toString()}`,\n )\n }\n const mst = MST.load(blockstore, commit.data)\n const cid = await mst.get(`${uri.collection}/${uri.rkey}`)\n if (!cid) {\n throw new RecordResolutionError('Record not found in proof')\n }\n const record = (await blockstore.readRecord(cid)) as LexMap\n return { commit, uri, cid, record }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/lexicon-resolver",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22"
|
|
6
6
|
},
|
|
@@ -24,21 +24,20 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atproto
|
|
28
|
-
"@atproto/
|
|
29
|
-
"@atproto/
|
|
30
|
-
"@atproto/lex-document": "^0.1.
|
|
31
|
-
"@atproto/
|
|
32
|
-
"@atproto/syntax": "^0.6.
|
|
27
|
+
"@atproto/identity": "^0.5.1",
|
|
28
|
+
"@atproto/lex": "^0.1.4",
|
|
29
|
+
"@atproto/repo": "^0.10.1",
|
|
30
|
+
"@atproto/lex-document": "^0.1.1",
|
|
31
|
+
"@atproto-labs/fetch-node": "^0.3.1",
|
|
32
|
+
"@atproto/syntax": "^0.6.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"typescript": "^6.0.3",
|
|
36
35
|
"vitest": "^4.0.16",
|
|
37
|
-
"@atproto/lex-cbor": "^0.1.
|
|
36
|
+
"@atproto/lex-cbor": "^0.1.1"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
40
39
|
"test": "vitest run",
|
|
41
|
-
"build": "
|
|
40
|
+
"build": "tsgo --build tsconfig.build.json",
|
|
42
41
|
"prebuild": "pnpm run codegen",
|
|
43
42
|
"codegen": "lex build --clear --indexFile --lexicons ../../lexicons --include com.atproto.sync.getRecord --include com.atproto.lexicon.schema"
|
|
44
43
|
}
|
package/tests/record.test.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import assert from '
|
|
2
|
-
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
1
|
+
import { afterAll, assert, beforeAll, describe, expect, it } from 'vitest'
|
|
3
2
|
import { SeedClient, TestNetworkNoAppView, usersSeed } from '@atproto/dev-env'
|
|
4
3
|
import { AtUriString, l } from '@atproto/lex'
|
|
5
4
|
import { encode } from '@atproto/lex-cbor'
|
package/tsconfig.build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/lexicon.ts","./src/record.ts","./src/util.ts","./src/lexicons/com.ts","./src/lexicons/index.ts","./src/lexicons/com/atproto.ts","./src/lexicons/com/atproto/lexicon.ts","./src/lexicons/com/atproto/sync.ts","./src/lexicons/com/atproto/lexicon/schema.defs.ts","./src/lexicons/com/atproto/lexicon/schema.ts","./src/lexicons/com/atproto/sync/getRecord.defs.ts","./src/lexicons/com/atproto/sync/getRecord.ts"]
|
|
1
|
+
{"version":"7.0.0-dev.20260614.1","root":["./src/index.ts","./src/lexicon.ts","./src/record.ts","./src/util.ts","./src/lexicons/com.ts","./src/lexicons/index.ts","./src/lexicons/com/atproto.ts","./src/lexicons/com/atproto/lexicon.ts","./src/lexicons/com/atproto/sync.ts","./src/lexicons/com/atproto/lexicon/schema.defs.ts","./src/lexicons/com/atproto/lexicon/schema.ts","./src/lexicons/com/atproto/sync/getRecord.defs.ts","./src/lexicons/com/atproto/sync/getRecord.ts"]}
|
package/tsconfig.json
CHANGED
package/tsconfig.tests.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig/
|
|
2
|
+
"extends": "../../tsconfig/vitest.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": ".",
|
|
5
|
-
"noUnusedLocals": false
|
|
5
|
+
"noUnusedLocals": false,
|
|
6
6
|
},
|
|
7
|
-
"include": ["./tests"]
|
|
7
|
+
"include": ["./tests", "./src/**/*.test.ts"],
|
|
8
8
|
}
|