@hypercerts-org/lexicon 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,62 @@
1
+ {
2
+ "lexicon": 1,
3
+ "id": "org.hypercerts.collection",
4
+ "defs": {
5
+ "main": {
6
+ "type": "record",
7
+ "description": "A collection/group of hypercerts that have a specific property.",
8
+ "key": "tid",
9
+ "record": {
10
+ "type": "object",
11
+ "required": ["title", "claims", "createdAt"],
12
+ "properties": {
13
+ "title": {
14
+ "type": "string",
15
+ "description": "The title of this collection",
16
+ "maxLength": 800,
17
+ "maxGraphemes": 80
18
+ },
19
+ "shortDescription": {
20
+ "type": "string",
21
+ "maxLength": 3000,
22
+ "maxGraphemes": 300,
23
+ "description": "A short description of this collection"
24
+ },
25
+ "coverPhoto": {
26
+ "type": "union",
27
+ "refs": ["app.certified.defs#uri", "app.certified.defs#smallBlob"],
28
+ "description": "The cover photo of this collection (either in URI format or in a blob)."
29
+ },
30
+ "claims": {
31
+ "type": "array",
32
+ "description": "Array of claims with their associated weights in this collection",
33
+ "items": {
34
+ "type": "ref",
35
+ "ref": "#claimItem"
36
+ }
37
+ },
38
+ "createdAt": {
39
+ "type": "string",
40
+ "format": "datetime",
41
+ "description": "Client-declared timestamp when this record was originally created"
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "claimItem": {
47
+ "type": "object",
48
+ "required": ["claim", "weight"],
49
+ "properties": {
50
+ "claim": {
51
+ "type": "ref",
52
+ "ref": "com.atproto.repo.strongRef",
53
+ "description": "A strong reference to a hypercert claim record. This claim must conform to the lexicon org.hypercerts.claim.record"
54
+ },
55
+ "weight": {
56
+ "type": "string",
57
+ "description": "The weight/importance of this hypercert claim in the collection (a percentage from 0-100, stored as a string to avoid float precision issues). The total claim weights should add up to 100."
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@hypercerts-org/lexicon",
3
+ "version": "0.2.0-beta.0",
4
+ "description": "ATProto lexicon definitions and TypeScript types for the Hypercerts protocol",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "publishConfig": {
10
+ "access": "public",
11
+ "registry": "https://registry.npmjs.org/"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "lexicons",
23
+ "src"
24
+ ],
25
+ "keywords": [
26
+ "hypercerts",
27
+ "atproto",
28
+ "lexicon",
29
+ "typescript"
30
+ ],
31
+ "author": "Hypercerts Foundation",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "url": "https://github.com/hypercerts-org/hypercerts-sdk.git"
35
+ },
36
+ "scripts": {
37
+ "build": "rollup -c",
38
+ "typecheck": "tsc --noEmit",
39
+ "clean": "rm -rf dist",
40
+ "lint": "eslint .",
41
+ "format": "prettier --write .",
42
+ "gen-api": "find ./lexicons -name '*.json' | xargs lex gen-api --yes ./src",
43
+ "gen-md": "find ./lexicons -name '*.json' | xargs lex gen-md --yes ./lexicons.md",
44
+ "gen-ts": "find ./lexicons -name '*.json' | xargs lex gen-ts-obj > src/lexicons.ts",
45
+ "lex": "lex",
46
+ "prepublishOnly": "pnpm run build"
47
+ },
48
+ "dependencies": {
49
+ "@atproto/lexicon": "^0.5.1",
50
+ "multiformats": "^13.3.6"
51
+ },
52
+ "devDependencies": {
53
+ "@atproto/lex-cli": "^0.9.5",
54
+ "@atproto/xrpc": "^0.7.5",
55
+ "@rollup/plugin-commonjs": "^29.0.0",
56
+ "@rollup/plugin-json": "^6.1.0",
57
+ "@rollup/plugin-node-resolve": "^16.0.3",
58
+ "@rollup/plugin-typescript": "^12.3.0",
59
+ "rollup": "^4.53.3",
60
+ "rollup-plugin-dts": "^6.2.3"
61
+ },
62
+ "peerDependencies": {
63
+ "@atproto/xrpc": "*"
64
+ },
65
+ "sideEffects": false
66
+ }
package/src/index.ts ADDED
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Hypercert lexicon definitions for AT Protocol.
3
+ *
4
+ * This module exports the lexicon documents, collection names,
5
+ * and generated TypeScript types for all hypercert-related record types.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+
10
+ import defsLexicon from "../lexicons/app/certified/defs.json";
11
+ import locationLexicon from "../lexicons/app/certified/location.json";
12
+ import claimLexicon from "../lexicons/org/hypercerts/claim.json";
13
+ import contributionLexicon from "../lexicons/org/hypercerts/claim/contribution.json";
14
+ import evaluationLexicon from "../lexicons/org/hypercerts/claim/evaluation.json";
15
+ import evidenceLexicon from "../lexicons/org/hypercerts/claim/evidence.json";
16
+ import measurementLexicon from "../lexicons/org/hypercerts/claim/measurement.json";
17
+ import rightsLexicon from "../lexicons/org/hypercerts/claim/rights.json";
18
+ import strongRefLexicon from "../lexicons/com/atproto/repo/strongRef.json";
19
+ import collectionLexicon from "../lexicons/org/hypercerts/collection.json";
20
+ import type { LexiconDoc } from "@atproto/lexicon";
21
+
22
+ /**
23
+ * All hypercert-related lexicons for registration with AT Protocol Agent.
24
+ *
25
+ * This array contains all lexicon documents needed to work with
26
+ * hypercert records.
27
+ */
28
+ export const HYPERCERT_LEXICONS: LexiconDoc[] = [
29
+ defsLexicon as LexiconDoc,
30
+ locationLexicon as LexiconDoc,
31
+ claimLexicon as LexiconDoc,
32
+ rightsLexicon as LexiconDoc,
33
+ contributionLexicon as LexiconDoc,
34
+ measurementLexicon as LexiconDoc,
35
+ evaluationLexicon as LexiconDoc,
36
+ evidenceLexicon as LexiconDoc,
37
+ collectionLexicon as LexiconDoc,
38
+ ];
39
+
40
+ /**
41
+ * Collection NSIDs (Namespaced Identifiers) for hypercert records.
42
+ *
43
+ * Use these constants when performing record operations to ensure
44
+ * correct collection names.
45
+ */
46
+ export const HYPERCERT_COLLECTIONS = {
47
+ /**
48
+ * Main hypercert claim record collection.
49
+ */
50
+ CLAIM: "org.hypercerts.claim",
51
+
52
+ /**
53
+ * Rights record collection.
54
+ */
55
+ RIGHTS: "org.hypercerts.claim.rights",
56
+
57
+ /**
58
+ * Location record collection (shared certified lexicon).
59
+ */
60
+ LOCATION: "app.certified.location",
61
+
62
+ /**
63
+ * Contribution record collection.
64
+ */
65
+ CONTRIBUTION: "org.hypercerts.claim.contribution",
66
+
67
+ /**
68
+ * Measurement record collection.
69
+ */
70
+ MEASUREMENT: "org.hypercerts.claim.measurement",
71
+
72
+ /**
73
+ * Evaluation record collection.
74
+ */
75
+ EVALUATION: "org.hypercerts.claim.evaluation",
76
+
77
+ /**
78
+ * Evidence record collection.
79
+ */
80
+ EVIDENCE: "org.hypercerts.claim.evidence",
81
+
82
+ /**
83
+ * Collection record collection (groups of hypercerts).
84
+ */
85
+ COLLECTION: "org.hypercerts.collection",
86
+ } as const;
87
+
88
+ // Re-export individual lexicons for direct access
89
+ export {
90
+ defsLexicon,
91
+ locationLexicon,
92
+ strongRefLexicon,
93
+ claimLexicon,
94
+ contributionLexicon,
95
+ evaluationLexicon,
96
+ evidenceLexicon,
97
+ measurementLexicon,
98
+ rightsLexicon,
99
+ collectionLexicon,
100
+ };
101
+
102
+ // Re-export generated types as namespaces (avoiding conflicts)
103
+ export * as AppCertifiedDefs from "./types/app/certified/defs.js";
104
+ export * as AppCertifiedLocation from "./types/app/certified/location.js";
105
+ export * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js";
106
+ export * as OrgHypercertsClaim from "./types/org/hypercerts/claim.js";
107
+ export * as OrgHypercertsClaimContribution from "./types/org/hypercerts/claim/contribution.js";
108
+ export * as OrgHypercertsClaimEvaluation from "./types/org/hypercerts/claim/evaluation.js";
109
+ export * as OrgHypercertsClaimEvidence from "./types/org/hypercerts/claim/evidence.js";
110
+ export * as OrgHypercertsClaimMeasurement from "./types/org/hypercerts/claim/measurement.js";
111
+ export * as OrgHypercertsClaimRights from "./types/org/hypercerts/claim/rights.js";
112
+ export * as OrgHypercertsCollection from "./types/org/hypercerts/collection.js";
113
+
114
+ // Re-export lexicon schemas, validation, and IDs
115
+ export { schemas, schemaDict, lexicons, validate, ids } from "./lexicons.js";
116
+
117
+ // Re-export utilities
118
+ export * from "./util.js";