Skip to content

Commit 7e930a3

Browse files
committed
refactor(sdk-core): use @hypercerts-org/lexicon package for lexicon definitions
- Add index.ts to lexicon package exporting HYPERCERT_LEXICONS and HYPERCERT_COLLECTIONS - Move hypercertCollection.json to lexicons/org/hypercerts/collection.json - Add @hypercerts-org/lexicon as workspace dependency to sdk-core - Update sdk-core to import lexicons from @hypercerts-org/lexicon - Remove duplicate lexicon JSON files from sdk-core - Update HYPERCERT_COLLECTIONS.RECORD to CLAIM to match new lexicon naming
1 parent 6accf8b commit 7e930a3

File tree

15 files changed

+180
-586
lines changed

15 files changed

+180
-586
lines changed

packages/lexicon/index.ts

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/**
2+
* Hypercert lexicon definitions for AT Protocol.
3+
*
4+
* This module exports the lexicon documents and collection names
5+
* for all hypercert-related record types. Lexicons define the
6+
* schema for records stored in AT Protocol repositories.
7+
*
8+
* @packageDocumentation
9+
*/
10+
11+
import defsLexicon from "./lexicons/app/certified/defs.json";
12+
import locationLexicon from "./lexicons/app/certified/location.json";
13+
import claimLexicon from "./lexicons/org/hypercerts/claim.json";
14+
import contributionLexicon from "./lexicons/org/hypercerts/claim/contribution.json";
15+
import evaluationLexicon from "./lexicons/org/hypercerts/claim/evaluation.json";
16+
import evidenceLexicon from "./lexicons/org/hypercerts/claim/evidence.json";
17+
import measurementLexicon from "./lexicons/org/hypercerts/claim/measurement.json";
18+
import rightsLexicon from "./lexicons/org/hypercerts/claim/rights.json";
19+
import strongRefLexicon from "./lexicons/com/atproto/repo/strongRef.json";
20+
import collectionLexicon from "./lexicons/org/hypercerts/collection.json";
21+
import type { LexiconDoc } from "@atproto/lexicon";
22+
23+
/**
24+
* All hypercert-related lexicons for registration with AT Protocol Agent.
25+
*
26+
* This array contains all lexicon documents needed to work with
27+
* hypercert records.
28+
*/
29+
export const HYPERCERT_LEXICONS: LexiconDoc[] = [
30+
defsLexicon as LexiconDoc,
31+
locationLexicon as LexiconDoc,
32+
claimLexicon as LexiconDoc,
33+
rightsLexicon as LexiconDoc,
34+
contributionLexicon as LexiconDoc,
35+
measurementLexicon as LexiconDoc,
36+
evaluationLexicon as LexiconDoc,
37+
evidenceLexicon as LexiconDoc,
38+
collectionLexicon as LexiconDoc,
39+
];
40+
41+
/**
42+
* Collection NSIDs (Namespaced Identifiers) for hypercert records.
43+
*
44+
* Use these constants when performing record operations to ensure
45+
* correct collection names.
46+
*/
47+
export const HYPERCERT_COLLECTIONS = {
48+
/**
49+
* Main hypercert claim record collection.
50+
*/
51+
CLAIM: "org.hypercerts.claim",
52+
53+
/**
54+
* Rights record collection.
55+
*/
56+
RIGHTS: "org.hypercerts.claim.rights",
57+
58+
/**
59+
* Location record collection (shared certified lexicon).
60+
*/
61+
LOCATION: "app.certified.location",
62+
63+
/**
64+
* Contribution record collection.
65+
*/
66+
CONTRIBUTION: "org.hypercerts.claim.contribution",
67+
68+
/**
69+
* Measurement record collection.
70+
*/
71+
MEASUREMENT: "org.hypercerts.claim.measurement",
72+
73+
/**
74+
* Evaluation record collection.
75+
*/
76+
EVALUATION: "org.hypercerts.claim.evaluation",
77+
78+
/**
79+
* Evidence record collection.
80+
*/
81+
EVIDENCE: "org.hypercerts.claim.evidence",
82+
83+
/**
84+
* Collection record collection (groups of hypercerts).
85+
*/
86+
COLLECTION: "org.hypercerts.collection",
87+
} as const;
88+
89+
// Re-export individual lexicons for direct access
90+
export {
91+
defsLexicon,
92+
locationLexicon,
93+
strongRefLexicon,
94+
claimLexicon,
95+
contributionLexicon,
96+
evaluationLexicon,
97+
evidenceLexicon,
98+
measurementLexicon,
99+
rightsLexicon,
100+
collectionLexicon,
101+
};
File renamed without changes.

packages/sdk-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@atproto/lexicon": "^0.5.1",
7777
"@atproto/oauth-client": "^0.5.9",
7878
"@atproto/oauth-client-node": "^0.3.10",
79+
"@hypercerts-org/lexicon": "workspace:*",
7980
"eventemitter3": "^5.0.1",
8081
"zod": "^3.24.4"
8182
}

packages/sdk-core/src/lexicons/hypercerts/defs.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/sdk-core/src/lexicons/hypercerts/hypercert.json

Lines changed: 0 additions & 103 deletions
This file was deleted.

packages/sdk-core/src/lexicons/hypercerts/hypercertCollection.json

Lines changed: 0 additions & 62 deletions
This file was deleted.

packages/sdk-core/src/lexicons/hypercerts/hypercertContribution.json

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)