@atproto/lexicon-resolver 0.2.6 → 0.3.1

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/lexicon.d.ts +13 -13
  3. package/dist/lexicon.d.ts.map +1 -1
  4. package/dist/lexicon.js +46 -20
  5. package/dist/lexicon.js.map +1 -1
  6. package/dist/lexicons/com/atproto/lexicon/schema.d.ts +3 -0
  7. package/dist/lexicons/com/atproto/lexicon/schema.d.ts.map +1 -0
  8. package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts +50 -0
  9. package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -0
  10. package/dist/lexicons/com/atproto/lexicon/schema.defs.js +15 -0
  11. package/dist/lexicons/com/atproto/lexicon/schema.defs.js.map +1 -0
  12. package/dist/lexicons/com/atproto/lexicon/schema.js +45 -0
  13. package/dist/lexicons/com/atproto/lexicon/schema.js.map +1 -0
  14. package/dist/lexicons/com/atproto/lexicon.d.ts +2 -0
  15. package/dist/lexicons/com/atproto/lexicon.d.ts.map +1 -0
  16. package/dist/lexicons/com/atproto/lexicon.js +41 -0
  17. package/dist/lexicons/com/atproto/lexicon.js.map +1 -0
  18. package/dist/lexicons/com/atproto/sync/getRecord.d.ts +3 -0
  19. package/dist/lexicons/com/atproto/sync/getRecord.d.ts.map +1 -0
  20. package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts +31 -0
  21. package/dist/lexicons/com/atproto/sync/getRecord.defs.d.ts.map +1 -0
  22. package/dist/lexicons/com/atproto/sync/getRecord.defs.js +24 -0
  23. package/dist/lexicons/com/atproto/sync/getRecord.defs.js.map +1 -0
  24. package/dist/lexicons/com/atproto/sync/getRecord.js +45 -0
  25. package/dist/lexicons/com/atproto/sync/getRecord.js.map +1 -0
  26. package/dist/lexicons/com/atproto/sync.d.ts +2 -0
  27. package/dist/lexicons/com/atproto/sync.d.ts.map +1 -0
  28. package/dist/lexicons/com/atproto/sync.js +41 -0
  29. package/dist/lexicons/com/atproto/sync.js.map +1 -0
  30. package/dist/lexicons/com/atproto.d.ts +3 -0
  31. package/dist/lexicons/com/atproto.d.ts.map +1 -0
  32. package/dist/lexicons/com/atproto.js +42 -0
  33. package/dist/lexicons/com/atproto.js.map +1 -0
  34. package/dist/lexicons/com.d.ts +2 -0
  35. package/dist/lexicons/com.d.ts.map +1 -0
  36. package/dist/lexicons/com.js +41 -0
  37. package/dist/lexicons/com.js.map +1 -0
  38. package/dist/lexicons/index.d.ts +2 -0
  39. package/dist/lexicons/index.d.ts.map +1 -0
  40. package/dist/lexicons/index.js +41 -0
  41. package/dist/lexicons/index.js.map +1 -0
  42. package/dist/record.d.ts +9 -10
  43. package/dist/record.d.ts.map +1 -1
  44. package/dist/record.js +10 -13
  45. package/dist/record.js.map +1 -1
  46. package/package.json +8 -10
  47. package/src/lexicon.ts +29 -37
  48. package/src/lexicons/com/atproto/lexicon/schema.defs.ts +43 -0
  49. package/src/lexicons/com/atproto/lexicon/schema.ts +6 -0
  50. package/src/lexicons/com/atproto/lexicon.ts +5 -0
  51. package/src/lexicons/com/atproto/sync/getRecord.defs.ts +39 -0
  52. package/src/lexicons/com/atproto/sync/getRecord.ts +6 -0
  53. package/src/lexicons/com/atproto/sync.ts +5 -0
  54. package/src/lexicons/com/atproto.ts +6 -0
  55. package/src/lexicons/com.ts +5 -0
  56. package/src/lexicons/index.ts +5 -0
  57. package/src/record.ts +42 -25
  58. package/tests/lexicon.test.ts +4 -3
  59. package/tests/record.test.ts +8 -5
  60. package/tsconfig.build.tsbuildinfo +1 -1
  61. package/dist/client/index.d.ts +0 -28
  62. package/dist/client/index.d.ts.map +0 -1
  63. package/dist/client/index.js +0 -118
  64. package/dist/client/index.js.map +0 -1
  65. package/dist/client/lexicons.d.ts +0 -105
  66. package/dist/client/lexicons.d.ts.map +0 -1
  67. package/dist/client/lexicons.js +0 -75
  68. package/dist/client/lexicons.js.map +0 -1
  69. package/dist/client/types/com/atproto/sync/getRecord.d.ts +0 -38
  70. package/dist/client/types/com/atproto/sync/getRecord.d.ts.map +0 -1
  71. package/dist/client/types/com/atproto/sync/getRecord.js +0 -58
  72. package/dist/client/types/com/atproto/sync/getRecord.js.map +0 -1
  73. package/dist/client/util.d.ts +0 -37
  74. package/dist/client/util.d.ts.map +0 -1
  75. package/dist/client/util.js +0 -38
  76. package/dist/client/util.js.map +0 -1
  77. package/src/client/index.ts +0 -67
  78. package/src/client/lexicons.ts +0 -98
  79. package/src/client/types/com/atproto/sync/getRecord.ts +0 -78
  80. package/src/client/util.ts +0 -82
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atproto/lexicon-resolver
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`67eb0c1`](https://github.com/bluesky-social/atproto/commit/67eb0c19ac415e762e221b2ccda9f0bcf7b3dd6f), [`192685f`](https://github.com/bluesky-social/atproto/commit/192685fca75a68c9c50a94817d3f27da7fc02f56)]:
8
+ - @atproto/syntax@0.5.1
9
+ - @atproto/repo@0.8.13
10
+ - @atproto/lex@0.0.21
11
+ - @atproto/lex-document@0.0.16
12
+
13
+ ## 0.3.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#4697](https://github.com/bluesky-social/atproto/pull/4697) [`1c473ab`](https://github.com/bluesky-social/atproto/commit/1c473ab555d734fa1bb68d3cdb2e17a94929afd3) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace `@atproto/lex-cli` based codegen with `@atproto/lex`
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [[`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`52834ab`](https://github.com/bluesky-social/atproto/commit/52834aba182da8df3611fd9dff924e6c6a3973a7), [`e8969b6`](https://github.com/bluesky-social/atproto/commit/e8969b6b3d3fed8912be53fd72b4d5288ca34766), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd)]:
22
+ - @atproto/syntax@0.5.0
23
+ - @atproto/lex@0.0.20
24
+ - @atproto/lex-document@0.0.15
25
+
3
26
  ## 0.2.6
4
27
 
5
28
  ### Patch Changes
package/dist/lexicon.d.ts CHANGED
@@ -1,29 +1,32 @@
1
- import { CID } from 'multiformats/cid';
2
- import { LexiconDoc } from '@atproto/lexicon';
1
+ import { Cid } from '@atproto/lex';
2
+ import { LexiconDocument } from '@atproto/lex-document';
3
3
  import { Commit } from '@atproto/repo';
4
- import { AtUri, NSID } from '@atproto/syntax';
4
+ import { AtUri, DidString, NSID, NsidString } from '@atproto/syntax';
5
+ import * as lexiconsSchema from './lexicons/com/atproto/lexicon/schema.js';
5
6
  import { BuildRecordResolverOptions, ResolveRecordOptions } from './record.js';
7
+ export type LexiconDocumentRecord = lexiconsSchema.Main & LexiconDocument;
6
8
  export declare const LEXICON_SCHEMA_NSID = "com.atproto.lexicon.schema";
7
9
  /**
8
10
  * Resolve Lexicon from an NSID
9
11
  */
10
- export type LexiconResolver = (nsid: NSID | string) => Promise<LexiconResolution>;
12
+ export type LexiconResolver = (nsid: NSID | NsidString) => Promise<LexiconResolution>;
11
13
  /**
12
14
  * Resolve Lexicon from an NSID using Lexicon DID authority and record resolution
13
15
  */
14
- export type AtprotoLexiconResolver = (nsid: NSID | string, options?: ResolveLexiconOptions) => Promise<LexiconResolution>;
16
+ export type AtprotoLexiconResolver = (nsid: NSID | NsidString, options?: ResolveLexiconOptions) => Promise<LexiconResolution>;
15
17
  export type BuildLexiconResolverOptions = BuildRecordResolverOptions;
16
18
  export type ResolveLexiconOptions = ResolveRecordOptions & {
17
- didAuthority?: string;
19
+ didAuthority?: DidString;
18
20
  };
19
21
  export type LexiconResolution = {
20
22
  commit: Commit;
21
23
  uri: AtUri;
22
- cid: CID;
24
+ cid: Cid;
23
25
  nsid: NSID;
24
- lexicon: LexiconDoc & LexiconSchemaRecord;
26
+ lexicon: LexiconDocumentRecord;
25
27
  };
26
- export { AtUri, CID, type Commit, type LexiconDoc, type LexiconSchemaRecord, NSID, };
28
+ export { AtUri, NSID };
29
+ export type { Cid, Commit, DidString, LexiconDocument, NsidString };
27
30
  /**
28
31
  * Build a Lexicon resolver function.
29
32
  */
@@ -33,14 +36,11 @@ export declare const resolveLexicon: AtprotoLexiconResolver;
33
36
  * Resolve the DID authority for a Lexicon from the network using DNS, based on its NSID.
34
37
  * @param input NSID or string representing one for which to lookup its Lexicon DID authority.
35
38
  */
36
- export declare function resolveLexiconDidAuthority(input: NSID | string): Promise<string | undefined>;
39
+ export declare function resolveLexiconDidAuthority(input: NSID | NsidString): Promise<DidString | undefined>;
37
40
  export declare class LexiconResolutionError extends Error {
38
41
  readonly nsid: NSID;
39
42
  readonly description: string;
40
43
  constructor(nsid: NSID, description?: string, options?: ErrorOptions);
41
44
  static from(input: NSID | string, description?: string, options?: ErrorOptions): LexiconResolutionError;
42
45
  }
43
- type LexiconSchemaRecord = {
44
- $type: typeof LEXICON_SCHEMA_NSID;
45
- };
46
46
  //# sourceMappingURL=lexicon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lexicon.d.ts","sourceRoot":"","sources":["../src/lexicon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAmB,MAAM,kBA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GAAG;IACzD,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,KAAK,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,qBAAqB,CAAA;CAC/B,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACtB,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,CAAA;AAEnE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,sBAAsB,CAwCxB;AAED,eAAO,MAAM,cAAc,wBAAyB,CAAA;AAEpD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,IAAI,GAAG,UAAU,GACvB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAKhC;AAED,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,IAAI;aACV,WAAW;gBADX,IAAI,EAAE,IAAI,EACV,WAAW,SAAuC,EAClE,OAAO,CAAC,EAAE,YAAY;IAMxB,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,YAAY,GACrB,sBAAsB;CAI1B"}
package/dist/lexicon.js CHANGED
@@ -1,23 +1,55 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
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
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LexiconResolutionError = exports.resolveLexicon = exports.NSID = exports.CID = exports.AtUri = exports.LEXICON_SCHEMA_NSID = void 0;
39
+ exports.LexiconResolutionError = exports.resolveLexicon = exports.NSID = exports.AtUri = exports.LEXICON_SCHEMA_NSID = void 0;
7
40
  exports.buildLexiconResolver = buildLexiconResolver;
8
41
  exports.resolveLexiconDidAuthority = resolveLexiconDidAuthority;
9
42
  const promises_1 = __importDefault(require("node:dns/promises"));
10
- const cid_1 = require("multiformats/cid");
11
- Object.defineProperty(exports, "CID", { enumerable: true, get: function () { return cid_1.CID; } });
12
- const lexicon_1 = require("@atproto/lexicon");
43
+ const lex_1 = require("@atproto/lex");
44
+ const lex_document_1 = require("@atproto/lex-document");
13
45
  const syntax_1 = require("@atproto/syntax");
14
46
  Object.defineProperty(exports, "AtUri", { enumerable: true, get: function () { return syntax_1.AtUri; } });
15
47
  Object.defineProperty(exports, "NSID", { enumerable: true, get: function () { return syntax_1.NSID; } });
48
+ const lexiconsSchema = __importStar(require("./lexicons/com/atproto/lexicon/schema.js"));
16
49
  const record_js_1 = require("./record.js");
17
- const util_js_1 = require("./util.js");
18
50
  const DNS_SUBDOMAIN = '_lexicon';
19
51
  const DNS_PREFIX = 'did=';
20
- exports.LEXICON_SCHEMA_NSID = 'com.atproto.lexicon.schema';
52
+ exports.LEXICON_SCHEMA_NSID = lexiconsSchema.$nsid;
21
53
  /**
22
54
  * Build a Lexicon resolver function.
23
55
  */
@@ -26,21 +58,19 @@ function buildLexiconResolver(options = {}) {
26
58
  return async function (input, opts = {}) {
27
59
  const nsid = syntax_1.NSID.from(input);
28
60
  const didAuthority = await getDidAuthority(nsid, opts);
29
- const verified = await resolveRecord(syntax_1.AtUri.make(didAuthority, exports.LEXICON_SCHEMA_NSID, nsid.toString()), { forceRefresh: opts.forceRefresh }).catch((err) => {
61
+ const verified = await resolveRecord(syntax_1.AtUri.make(didAuthority, lexiconsSchema.$nsid, nsid.toString()), { forceRefresh: opts.forceRefresh }).catch((err) => {
30
62
  throw new LexiconResolutionError(nsid, 'Could not resolve Lexicon schema record', { cause: err });
31
63
  });
32
- let lexicon;
33
- try {
34
- lexicon = (0, lexicon_1.parseLexiconDoc)(verified.record);
64
+ if (!lexiconsSchema.$matches(verified.record)) {
65
+ throw new LexiconResolutionError(nsid, 'Invalid Lexicon schema record');
35
66
  }
36
- catch (err) {
67
+ const validationResult = lex_document_1.lexiconDocumentSchema.safeValidate(verified.record);
68
+ if (!validationResult.success) {
37
69
  throw new LexiconResolutionError(nsid, 'Invalid Lexicon document', {
38
- cause: err,
70
+ cause: validationResult.reason,
39
71
  });
40
72
  }
41
- if (!isLexiconSchemaRecord(lexicon)) {
42
- throw new LexiconResolutionError(nsid, 'Invalid Lexicon schema record');
43
- }
73
+ const lexicon = validationResult.value;
44
74
  if (lexicon.id !== nsid.toString()) {
45
75
  throw new LexiconResolutionError(nsid, `Lexicon schema record id (${lexicon.id}) does not match NSID`);
46
76
  }
@@ -56,7 +86,7 @@ exports.resolveLexicon = buildLexiconResolver();
56
86
  async function resolveLexiconDidAuthority(input) {
57
87
  const nsid = syntax_1.NSID.from(input);
58
88
  const did = await resolveDns(nsid.authority);
59
- if (did == null || !(0, util_js_1.isValidDid)(did))
89
+ if (did == null || !lex_1.l.isDidString(did))
60
90
  return;
61
91
  return did;
62
92
  }
@@ -85,7 +115,6 @@ class LexiconResolutionError extends Error {
85
115
  exports.LexiconResolutionError = LexiconResolutionError;
86
116
  async function getDidAuthority(nsid, options) {
87
117
  if (options.didAuthority) {
88
- (0, syntax_1.ensureValidDid)(options.didAuthority);
89
118
  return options.didAuthority;
90
119
  }
91
120
  const did = await resolveLexiconDidAuthority(nsid);
@@ -112,7 +141,4 @@ function parseDnsResult(chunkedResults) {
112
141
  }
113
142
  return found[0].slice(DNS_PREFIX.length);
114
143
  }
115
- function isLexiconSchemaRecord(v) {
116
- return v?.['$type'] === exports.LEXICON_SCHEMA_NSID;
117
- }
118
144
  //# sourceMappingURL=lexicon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lexicon.js","sourceRoot":"","sources":["../src/lexicon.ts"],"names":[],"mappings":";;;;;;AAyDA,oDAwCC;AAQD,gEAOC;AAhHD,iEAAmC;AACnC,0CAAsC;AA8CpC,oFA9CO,SAAG,OA8CP;AA7CL,8CAA8D;AAE9D,4CAA6D;AA0C3D,sFA1CO,cAAK,OA0CP;AAKL,qFA/Cc,aAAI,OA+Cd;AA9CN,2CAIoB;AACpB,uCAAsC;AAEtC,MAAM,aAAa,GAAG,UAAU,CAAA;AAChC,MAAM,UAAU,GAAG,MAAM,CAAA;AACZ,QAAA,mBAAmB,GAAG,4BAA4B,CAAA;AAwC/D;;GAEG;AACH,SAAgB,oBAAoB,CAClC,UAAuC,EAAE;IAEzC,MAAM,aAAa,GAAG,IAAA,+BAAmB,EAAC,OAAO,CAAC,CAAA;IAClD,OAAO,KAAK,WACV,K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AI,sBAAsB,CAC9B,IAAI,EACJ,4CAA4C,CAC7C,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,SAAiB;IACzC,IAAI,cAA0B,CAAA;IAC9B,IAAI,CAAC;QACH,cAAc,GAAG,MAAM,kBAAG,CAAC,UAAU,CAAC,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC,CAAA;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,cAAc,CAAC,cAAc,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,cAAc,CAAC,cAA0B;IAChD,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAC/D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IAC7D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;AAC1C,CAAC;AAGD,SAAS,qBAAqB,CAAC,CAAU;IACvC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,2BAAmB,CAAA;AAC7C,CAAC","sourcesContent":["import dns from 'node:dns/promises'\nimport { CID } from 'multiformats/cid'\nimport { LexiconDoc, parseLexiconDoc } from '@atproto/lexicon'\nimport { Commit } from '@atproto/repo'\nimport { AtUri, NSID, ensureValidDid } from '@atproto/syntax'\nimport {\n BuildRecordResolverOptions,\n ResolveRecordOptions,\n buildRecordResolver,\n} from './record.js'\nimport { isValidDid } from './util.js'\n\nconst DNS_SUBDOMAIN = '_lexicon'\nconst DNS_PREFIX = 'did='\nexport const LEXICON_SCHEMA_NSID = 'com.atproto.lexicon.schema'\n\n/**\n * Resolve Lexicon from an NSID\n */\nexport type LexiconResolver = (\n nsid: NSID | string,\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 | string,\n options?: ResolveLexiconOptions,\n) => Promise<LexiconResolution>\n\nexport type BuildLexiconResolverOptions = BuildRecordResolverOptions\n\nexport type ResolveLexiconOptions = ResolveRecordOptions & {\n didAuthority?: string\n}\n\nexport type LexiconResolution = {\n commit: Commit\n uri: AtUri\n cid: CID\n nsid: NSID\n lexicon: LexiconDoc & LexiconSchemaRecord\n}\n\nexport {\n AtUri,\n CID,\n type Commit,\n type LexiconDoc,\n type LexiconSchemaRecord,\n NSID,\n}\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 | string,\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, LEXICON_SCHEMA_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 let lexicon: LexiconDoc\n try {\n lexicon = parseLexiconDoc(verified.record)\n } catch (err) {\n throw new LexiconResolutionError(nsid, 'Invalid Lexicon document', {\n cause: err,\n })\n }\n if (!isLexiconSchemaRecord(lexicon)) {\n throw new LexiconResolutionError(nsid, 'Invalid Lexicon schema record')\n }\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 | string,\n): Promise<string | undefined> {\n const nsid = NSID.from(input)\n const did = await resolveDns(nsid.authority)\n if (did == null || !isValidDid(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 ensureValidDid(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\ntype LexiconSchemaRecord = { $type: typeof LEXICON_SCHEMA_NSID }\nfunction isLexiconSchemaRecord(v: unknown): v is LexiconSchemaRecord {\n return v?.['$type'] === LEXICON_SCHEMA_NSID\n}\n"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AAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IAC7D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;AAC1C,CAAC","sourcesContent":["import 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"]}
@@ -0,0 +1,3 @@
1
+ export * from './schema.defs.js';
2
+ export * as $defs from './schema.defs.js';
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +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,KAAK,KAAK,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { l } from '@atproto/lex';
2
+ declare const $nsid = "com.atproto.lexicon.schema";
3
+ export { $nsid };
4
+ /** 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). */
5
+ type Main = {
6
+ $type: 'com.atproto.lexicon.schema';
7
+ /**
8
+ * Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system.
9
+ */
10
+ lexicon: number;
11
+ };
12
+ export type { Main };
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
+ declare const main: l.RecordSchema<"nsid", "com.atproto.lexicon.schema", l.Validator<Omit<Main, "$type">, Omit<Main, "$type">>>;
15
+ export { main };
16
+ export declare const $isTypeOf: <TValue extends {
17
+ $type?: unknown;
18
+ }>(value: TValue) => value is l.TypedRecord<"com.atproto.lexicon.schema", TValue>, $build: (input: Omit<{
19
+ lexicon: number;
20
+ $type: "com.atproto.lexicon.schema";
21
+ }, "$type">) => {
22
+ lexicon: number;
23
+ $type: "com.atproto.lexicon.schema";
24
+ }, $type: "com.atproto.lexicon.schema";
25
+ export declare const $assert: (input: unknown) => asserts input is {
26
+ lexicon: number;
27
+ $type: "com.atproto.lexicon.schema";
28
+ }, $check: (input: unknown) => void, $cast: <I>(input: I) => I & {
29
+ lexicon: number;
30
+ $type: "com.atproto.lexicon.schema";
31
+ }, $ifMatches: <I>(input: I) => (I & {
32
+ lexicon: number;
33
+ $type: "com.atproto.lexicon.schema";
34
+ }) | undefined, $matches: <I>(input: I) => input is I & {
35
+ lexicon: number;
36
+ $type: "com.atproto.lexicon.schema";
37
+ }, $parse: (input: unknown, options?: l.ParseOptions) => {
38
+ lexicon: number;
39
+ $type: "com.atproto.lexicon.schema";
40
+ }, $safeParse: (input: unknown, options?: l.ParseOptions) => l.ValidationResult<{
41
+ lexicon: number;
42
+ $type: "com.atproto.lexicon.schema";
43
+ }>, $validate: <I>(input: I, options?: l.ValidateOptions) => I & {
44
+ lexicon: number;
45
+ $type: "com.atproto.lexicon.schema";
46
+ }, $safeValidate: <I>(input: I, options?: l.ValidateOptions) => l.ValidationResult<I & {
47
+ lexicon: number;
48
+ $type: "com.atproto.lexicon.schema";
49
+ }>;
50
+ //# sourceMappingURL=schema.defs.d.ts.map
@@ -0,0 +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,SAAS;SAYgQ,CAAC;iFAZxN,EAC7D,MAAM;aAfG,MAAM;;;aAAN,MAAM;;CAe6B,EAC5C,KAAK,8BAA2B,CAAA;AAClC,eAAO,MAAM,OAAO;aAjBT,MAAM;;CAiB0C,EACzD,MAAM,0BAAsC,EAC5C,KAAK;aAnBI,MAAM;;CAmB2B,EAC1C,UAAU;aApBD,MAAM;;cAoBqC,EACpD,QAAQ;aArBC,MAAM;;CAqBiC,EAChD,MAAM;aAtBG,MAAM;;CAsB6B,EAC5C,UAAU;aAvBD,MAAM;;EAuBqC,EACpD,SAAS;aAxBA,MAAM;;CAwBmC,EAClD,aAAa;aAzBJ,MAAM;;EAyB2C,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.$safeValidate = exports.$validate = exports.$safeParse = exports.$parse = exports.$matches = exports.$ifMatches = exports.$cast = exports.$check = exports.$assert = exports.$type = exports.$build = exports.$isTypeOf = exports.main = exports.$nsid = void 0;
7
+ const lex_1 = require("@atproto/lex");
8
+ const $nsid = 'com.atproto.lexicon.schema';
9
+ exports.$nsid = $nsid;
10
+ /** 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). */
11
+ const main = lex_1.l.record('nsid', $nsid, lex_1.l.object({ lexicon: lex_1.l.integer() }));
12
+ exports.main = main;
13
+ exports.$isTypeOf = main.isTypeOf.bind(main), exports.$build = main.build.bind(main), exports.$type = main.$type;
14
+ exports.$assert = main.assert.bind(main), exports.$check = main.check.bind(main), exports.$cast = main.cast.bind(main), exports.$ifMatches = main.ifMatches.bind(main), exports.$matches = main.matches.bind(main), exports.$parse = main.parse.bind(main), exports.$safeParse = main.safeParse.bind(main), exports.$validate = main.validate.bind(main), exports.$safeValidate = main.safeValidate.bind(main);
15
+ //# sourceMappingURL=schema.defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAgC;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAEjC,sBAAK;AAcd,wUAAwU;AACxU,MAAM,IAAI,GAAG,OAAC,CAAC,MAAM,CACnB,MAAM,EACN,KAAK,EACL,OAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACnC,CAAA;AAEQ,oBAAI;AAEA,QAAA,SAAS,GAAiB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAC7D,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5C,QAAA,KAAK,GAAiB,IAAI,CAAC,KAAK,CAAA;AACrB,QAAA,OAAO,GAAiB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EACzD,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5C,QAAA,KAAK,GAAiB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAC1C,QAAA,UAAU,GAAiB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EACpD,QAAA,QAAQ,GAAiB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAChD,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5C,QAAA,UAAU,GAAiB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EACpD,QAAA,SAAS,GAAiB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAClD,QAAA,aAAa,GAAiB,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 = l.record<'nsid', Main>(\n 'nsid',\n $nsid,\n l.object({ lexicon: l.integer() }),\n)\n\nexport { main }\n\nexport const $isTypeOf = /*#__PURE__*/ main.isTypeOf.bind(main),\n $build = /*#__PURE__*/ main.build.bind(main),\n $type = /*#__PURE__*/ main.$type\nexport const $assert = /*#__PURE__*/ main.assert.bind(main),\n $check = /*#__PURE__*/ main.check.bind(main),\n $cast = /*#__PURE__*/ main.cast.bind(main),\n $ifMatches = /*#__PURE__*/ main.ifMatches.bind(main),\n $matches = /*#__PURE__*/ main.matches.bind(main),\n $parse = /*#__PURE__*/ main.parse.bind(main),\n $safeParse = /*#__PURE__*/ main.safeParse.bind(main),\n $validate = /*#__PURE__*/ main.validate.bind(main),\n $safeValidate = /*#__PURE__*/ main.safeValidate.bind(main)\n"]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.$defs = void 0;
43
+ __exportStar(require("./schema.defs.js"), exports);
44
+ exports.$defs = __importStar(require("./schema.defs.js"));
45
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/lexicon/schema.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAgC;AAChC,0DAAyC","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './schema.defs.js'\nexport * as $defs from './schema.defs.js'\n"]}
@@ -0,0 +1,2 @@
1
+ export * as schema from './lexicon/schema.js';
2
+ //# sourceMappingURL=lexicon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexicon.d.ts","sourceRoot":"","sources":["../../../../src/lexicons/com/atproto/lexicon.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.schema = void 0;
40
+ exports.schema = __importStar(require("./lexicon/schema.js"));
41
+ //# sourceMappingURL=lexicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexicon.js","sourceRoot":"","sources":["../../../../src/lexicons/com/atproto/lexicon.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8DAA6C","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * as schema from './lexicon/schema.js'\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './getRecord.defs.js';
2
+ export * as $defs from './getRecord.defs.js';
3
+ //# sourceMappingURL=getRecord.d.ts.map
@@ -0,0 +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,KAAK,KAAK,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { l } from '@atproto/lex';
2
+ declare const $nsid = "com.atproto.sync.getRecord";
3
+ export { $nsid };
4
+ /** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */
5
+ declare const main: l.Query<"com.atproto.sync.getRecord", l.ParamsSchema<{
6
+ readonly did: l.StringSchema<{
7
+ readonly format: "did";
8
+ }>;
9
+ readonly collection: l.StringSchema<{
10
+ readonly format: "nsid";
11
+ }>;
12
+ readonly rkey: l.StringSchema<{
13
+ readonly format: "record-key";
14
+ }>;
15
+ }>, l.Payload<"application/vnd.ipld.car", undefined>, readonly ["RecordNotFound", "RepoNotFound", "RepoTakendown", "RepoSuspended", "RepoDeactivated"]>;
16
+ export { main };
17
+ export type $Params = l.InferMethodParams<typeof main>;
18
+ export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
19
+ export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
20
+ export declare const $lxm: "com.atproto.sync.getRecord", $params: l.ParamsSchema<{
21
+ readonly did: l.StringSchema<{
22
+ readonly format: "did";
23
+ }>;
24
+ readonly collection: l.StringSchema<{
25
+ readonly format: "nsid";
26
+ }>;
27
+ readonly rkey: l.StringSchema<{
28
+ readonly format: "record-key";
29
+ }>;
30
+ }>, $output: l.Payload<"application/vnd.ipld.car", undefined>;
31
+ //# sourceMappingURL=getRecord.defs.d.ts.map
@@ -0,0 +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,sIAAsI;AACtI,QAAA,MAAM,IAAI;;;;;;;;;;uJAeT,CAAA;AACD,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,8BAAY,EAC3B,OAAO;;;;;;;;;;EAAkB,EACzB,OAAO,kDAAc,CAAA"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.$output = exports.$params = exports.$lxm = exports.main = exports.$nsid = void 0;
7
+ const lex_1 = require("@atproto/lex");
8
+ const $nsid = 'com.atproto.sync.getRecord';
9
+ exports.$nsid = $nsid;
10
+ /** Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. */
11
+ const main = lex_1.l.query($nsid, lex_1.l.params({
12
+ did: lex_1.l.string({ format: 'did' }),
13
+ collection: lex_1.l.string({ format: 'nsid' }),
14
+ rkey: lex_1.l.string({ format: 'record-key' }),
15
+ }), lex_1.l.payload('application/vnd.ipld.car'), [
16
+ 'RecordNotFound',
17
+ 'RepoNotFound',
18
+ 'RepoTakendown',
19
+ 'RepoSuspended',
20
+ 'RepoDeactivated',
21
+ ]);
22
+ exports.main = main;
23
+ exports.$lxm = main.nsid, exports.$params = main.parameters, exports.$output = main.output;
24
+ //# sourceMappingURL=getRecord.defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRecord.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAgC;AAEhC,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAEjC,sBAAK;AAEd,sIAAsI;AACtI,MAAM,IAAI,GAAG,OAAC,CAAC,KAAK,CAClB,KAAK,EACL,OAAC,CAAC,MAAM,CAAC;IACP,GAAG,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAChC,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;CACzC,CAAC,EACF,OAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,EACrC;IACE,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,eAAe;IACf,iBAAiB;CAClB,CACF,CAAA;AACQ,oBAAI;AASA,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,EAC3B,QAAA,OAAO,GAAG,IAAI,CAAC,UAAU,EACzB,QAAA,OAAO,GAAG,IAAI,CAAC,MAAM,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\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 = l.query(\n $nsid,\n l.params({\n did: l.string({ format: 'did' }),\n collection: l.string({ format: 'nsid' }),\n rkey: l.string({ format: 'record-key' }),\n }),\n l.payload('application/vnd.ipld.car'),\n [\n 'RecordNotFound',\n 'RepoNotFound',\n 'RepoTakendown',\n 'RepoSuspended',\n 'RepoDeactivated',\n ],\n)\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = main.nsid,\n $params = main.parameters,\n $output = main.output\n"]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /*
3
+ * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.$defs = void 0;
43
+ __exportStar(require("./getRecord.defs.js"), exports);
44
+ exports.$defs = __importStar(require("./getRecord.defs.js"));
45
+ //# sourceMappingURL=getRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRecord.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/sync/getRecord.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAmC;AACnC,6DAA4C","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nexport * from './getRecord.defs.js'\nexport * as $defs from './getRecord.defs.js'\n"]}
@@ -0,0 +1,2 @@
1
+ export * as getRecord from './sync/getRecord.js';
2
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/lexicons/com/atproto/sync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAA"}