@hypercerts-org/lexicon 0.9.0-beta.0 → 0.10.0-beta.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 (109) hide show
  1. package/README.md +346 -164
  2. package/dist/exports.d.ts +1018 -0
  3. package/dist/exports.d.ts.map +1 -0
  4. package/dist/generated/exports.d.ts +1018 -0
  5. package/dist/generated/exports.d.ts.map +1 -0
  6. package/dist/generated/lexicons.d.ts +1805 -0
  7. package/dist/generated/lexicons.d.ts.map +1 -0
  8. package/dist/generated/types/app/certified/badge/award.d.ts +24 -0
  9. package/dist/generated/types/app/certified/badge/award.d.ts.map +1 -0
  10. package/dist/generated/types/app/certified/badge/definition.d.ts +25 -0
  11. package/dist/generated/types/app/certified/badge/definition.d.ts.map +1 -0
  12. package/dist/generated/types/app/certified/badge/response.d.ts +20 -0
  13. package/dist/generated/types/app/certified/badge/response.d.ts.map +1 -0
  14. package/dist/generated/types/app/certified/defs.d.ts +3 -0
  15. package/dist/generated/types/app/certified/defs.d.ts.map +1 -0
  16. package/dist/generated/types/app/certified/location.d.ts +29 -0
  17. package/dist/generated/types/app/certified/location.d.ts.map +1 -0
  18. package/dist/generated/types/com/atproto/repo/strongRef.d.ts +12 -0
  19. package/dist/generated/types/com/atproto/repo/strongRef.d.ts.map +1 -0
  20. package/dist/generated/types/org/hypercerts/claim/activity.d.ts +57 -0
  21. package/dist/generated/types/org/hypercerts/claim/activity.d.ts.map +1 -0
  22. package/dist/generated/types/org/hypercerts/claim/collection.d.ts +25 -0
  23. package/dist/generated/types/org/hypercerts/claim/collection.d.ts.map +1 -0
  24. package/dist/generated/types/org/hypercerts/claim/contribution.d.ts +24 -0
  25. package/dist/generated/types/org/hypercerts/claim/contribution.d.ts.map +1 -0
  26. package/dist/generated/types/org/hypercerts/claim/evaluation.d.ts +43 -0
  27. package/dist/generated/types/org/hypercerts/claim/evaluation.d.ts.map +1 -0
  28. package/dist/generated/types/org/hypercerts/claim/evidence.d.ts +29 -0
  29. package/dist/generated/types/org/hypercerts/claim/evidence.d.ts.map +1 -0
  30. package/dist/generated/types/org/hypercerts/claim/measurement.d.ts +30 -0
  31. package/dist/generated/types/org/hypercerts/claim/measurement.d.ts.map +1 -0
  32. package/dist/generated/types/org/hypercerts/claim/project.d.ts +29 -0
  33. package/dist/generated/types/org/hypercerts/claim/project.d.ts.map +1 -0
  34. package/dist/generated/types/org/hypercerts/claim/rights.d.ts +25 -0
  35. package/dist/generated/types/org/hypercerts/claim/rights.d.ts.map +1 -0
  36. package/dist/generated/types/org/hypercerts/defs.d.ts +45 -0
  37. package/dist/generated/types/org/hypercerts/defs.d.ts.map +1 -0
  38. package/dist/generated/types/org/hypercerts/funding/receipt.d.ts +34 -0
  39. package/dist/generated/types/org/hypercerts/funding/receipt.d.ts.map +1 -0
  40. package/dist/generated/types/pub/leaflet/pages/linearDocument.d.ts +2 -0
  41. package/dist/generated/types/pub/leaflet/pages/linearDocument.d.ts.map +1 -0
  42. package/dist/generated/util.d.ts +37 -0
  43. package/dist/generated/util.d.ts.map +1 -0
  44. package/dist/index.cjs +2119 -955
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.mjs +2054 -935
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/lexicons.cjs +1002 -0
  49. package/dist/lexicons.cjs.map +1 -0
  50. package/dist/lexicons.d.ts +1805 -0
  51. package/dist/lexicons.d.ts.map +1 -0
  52. package/dist/lexicons.mjs +996 -0
  53. package/dist/lexicons.mjs.map +1 -0
  54. package/dist/types/app/certified/badge/award.d.ts +24 -0
  55. package/dist/types/app/certified/badge/award.d.ts.map +1 -0
  56. package/dist/types/app/certified/badge/definition.d.ts +25 -0
  57. package/dist/types/app/certified/badge/definition.d.ts.map +1 -0
  58. package/dist/types/app/certified/badge/response.d.ts +20 -0
  59. package/dist/types/app/certified/badge/response.d.ts.map +1 -0
  60. package/dist/types/app/certified/defs.d.ts +3 -0
  61. package/dist/types/app/certified/defs.d.ts.map +1 -0
  62. package/dist/types/app/certified/location.d.ts +29 -0
  63. package/dist/types/app/certified/location.d.ts.map +1 -0
  64. package/dist/types/com/atproto/repo/strongRef.d.ts +12 -0
  65. package/dist/types/com/atproto/repo/strongRef.d.ts.map +1 -0
  66. package/dist/types/org/hypercerts/claim/activity.d.ts +57 -0
  67. package/dist/types/org/hypercerts/claim/activity.d.ts.map +1 -0
  68. package/dist/types/org/hypercerts/claim/collection.d.ts +25 -0
  69. package/dist/types/org/hypercerts/claim/collection.d.ts.map +1 -0
  70. package/dist/types/org/hypercerts/claim/contribution.d.ts +24 -0
  71. package/dist/types/org/hypercerts/claim/contribution.d.ts.map +1 -0
  72. package/dist/types/org/hypercerts/claim/evaluation.d.ts +43 -0
  73. package/dist/types/org/hypercerts/claim/evaluation.d.ts.map +1 -0
  74. package/dist/types/org/hypercerts/claim/evidence.d.ts +29 -0
  75. package/dist/types/org/hypercerts/claim/evidence.d.ts.map +1 -0
  76. package/dist/types/org/hypercerts/claim/measurement.d.ts +30 -0
  77. package/dist/types/org/hypercerts/claim/measurement.d.ts.map +1 -0
  78. package/dist/types/org/hypercerts/claim/project.d.ts +29 -0
  79. package/dist/types/org/hypercerts/claim/project.d.ts.map +1 -0
  80. package/dist/types/org/hypercerts/claim/rights.d.ts +25 -0
  81. package/dist/types/org/hypercerts/claim/rights.d.ts.map +1 -0
  82. package/dist/types/org/hypercerts/defs.d.ts +45 -0
  83. package/dist/types/org/hypercerts/defs.d.ts.map +1 -0
  84. package/dist/types/org/hypercerts/funding/receipt.d.ts +34 -0
  85. package/dist/types/org/hypercerts/funding/receipt.d.ts.map +1 -0
  86. package/dist/types/pub/leaflet/pages/linearDocument.d.ts +2 -0
  87. package/dist/types/pub/leaflet/pages/linearDocument.d.ts.map +1 -0
  88. package/dist/util.d.ts +37 -0
  89. package/dist/util.d.ts.map +1 -0
  90. package/lexicons/app/certified/badge/award.json +36 -0
  91. package/lexicons/app/certified/badge/definition.json +53 -0
  92. package/lexicons/app/certified/badge/response.json +36 -0
  93. package/lexicons/app/certified/defs.json +4 -16
  94. package/lexicons/app/certified/location.json +5 -8
  95. package/lexicons/com/atproto/repo/strongRef.json +1 -1
  96. package/lexicons/org/hypercerts/claim/activity.json +135 -0
  97. package/lexicons/org/hypercerts/claim/collection.json +54 -0
  98. package/lexicons/org/hypercerts/claim/contribution.json +4 -11
  99. package/lexicons/org/hypercerts/claim/evaluation.json +50 -9
  100. package/lexicons/org/hypercerts/claim/evidence.json +29 -16
  101. package/lexicons/org/hypercerts/claim/measurement.json +18 -8
  102. package/lexicons/org/hypercerts/claim/project.json +64 -0
  103. package/lexicons/org/hypercerts/claim/rights.json +16 -3
  104. package/lexicons/org/hypercerts/defs.json +71 -0
  105. package/lexicons/org/hypercerts/funding/receipt.json +66 -0
  106. package/package.json +46 -26
  107. package/dist/index.d.ts +0 -2094
  108. package/lexicons/org/hypercerts/claim.json +0 -95
  109. package/lexicons/org/hypercerts/collection.json +0 -62
package/README.md CHANGED
@@ -1,109 +1,185 @@
1
- # @hypercerts-org/lexicon
1
+ # Hypercerts Lexicon Documentation
2
2
 
3
- ATProto lexicon definitions and generated TypeScript types for the Hypercerts protocol.
3
+ This repository contains ATProto lexicon definitions for the
4
+ Hypercerts protocol. Each lexicon defines a record type that can be
5
+ stored on the ATProto network.
6
+
7
+ ## Entity Relationship Diagram
8
+
9
+ The following diagrams show the relationship between:
10
+
11
+ - data classes represented by ATProto lexicons, which model the data
12
+ sets relating to hypercerts
13
+
14
+ - contributors to activity records (modelled/identified by ATProto
15
+ DIDs rather than lexicons)
16
+
17
+ - hypercerts protocol tokens which are onchain representations of
18
+ activity records in ATProto
19
+
20
+ Note that contributors and tokens do not require lexicons.
21
+
22
+ To distinguish these in the diagrams, each class has one of the
23
+ following icons:
24
+
25
+ - "D" means "data class"
26
+ - "E" means "entity"
27
+ - "P" means "protocol"
28
+
29
+ ![Hypercert ERD](ERD.svg)
30
+
31
+ <details>
32
+ <summary>View ERD with field details</summary>
33
+
34
+ ![Hypercert ERD with fields](ERD-with-fields.svg)
35
+
36
+ </details>
4
37
 
5
38
  ## Installation
6
39
 
7
40
  ```bash
8
- pnpm add @hypercerts-org/lexicon
41
+ npm install @hypercerts-org/lexicon
9
42
  ```
10
43
 
11
- ## Features
12
-
13
- - **Lexicon JSON Definitions**: ATProto-compliant lexicon schemas for all Hypercerts record types
14
- - **Generated TypeScript Types**: Strongly-typed interfaces generated via `@atproto/lex-cli`
15
- - **Runtime Validation**: `isRecord` and `validateRecord` functions for each type
16
- - **Lexicon Registry**: Pre-configured registry for schema validation
17
-
18
44
  ## Usage
19
45
 
20
- ### Using Types
46
+ ### Basic Import
21
47
 
22
48
  ```typescript
23
- import type {
24
- OrgHypercertsClaim,
25
- OrgHypercertsCollection,
26
- OrgHypercertsClaimRights
27
- } from '@hypercerts-org/lexicon';
28
-
29
- // Use the Main type for full records (includes $type)
30
- const claim: OrgHypercertsClaim.Main = {
31
- $type: 'org.hypercerts.claim',
32
- title: 'My Impact Work',
33
- shortDescription: 'Description here',
34
- workScope: 'Scope of work',
35
- workTimeFrameFrom: '2023-01-01T00:00:00Z',
36
- workTimeFrameTo: '2023-12-31T23:59:59Z',
37
- createdAt: new Date().toISOString()
49
+ import {
50
+ HYPERCERTS_SCHEMAS,
51
+ ACTIVITY_NSID,
52
+ validate,
53
+ } from "@hypercerts-org/lexicon";
54
+
55
+ // Use with AT Protocol Agent
56
+ import { Agent } from "@atproto/api";
57
+
58
+ const agent = new Agent({ service: "https://bsky.social" });
59
+
60
+ // Register lexicons with the agent
61
+ agent.api.lex.add(...HYPERCERTS_SCHEMAS);
62
+
63
+ // Create a record
64
+ const activityRecord = {
65
+ $type: ACTIVITY_NSID,
66
+ title: "My Impact Work",
67
+ shortDescription: "Description here",
68
+ workScope: "Scope of work",
69
+ startDate: "2023-01-01T00:00:00Z",
70
+ endDate: "2023-12-31T23:59:59Z",
71
+ createdAt: new Date().toISOString(),
38
72
  };
73
+
74
+ // Validate before creating
75
+ const validation = validate(ACTIVITY_NSID, activityRecord);
76
+ if (!validation.valid) {
77
+ console.error("Validation failed:", validation.errors);
78
+ }
79
+
80
+ await agent.api.com.atproto.repo.createRecord({
81
+ repo: agent.session?.did,
82
+ collection: ACTIVITY_NSID,
83
+ record: activityRecord,
84
+ });
39
85
  ```
40
86
 
41
- ### Runtime Validation
87
+ ### Accessing NSIDs (Lexicon IDs)
42
88
 
43
- ```typescript
44
- import { OrgHypercertsClaim } from '@hypercerts-org/lexicon';
89
+ **Recommended**: Use individual NSID constants for cleaner, more readable code:
45
90
 
46
- // Check if a value matches the type
47
- if (OrgHypercertsClaim.isRecord(unknownValue)) {
48
- // unknownValue is now typed as OrgHypercertsClaim.Main
49
- console.log(unknownValue.title);
50
- }
91
+ ```typescript
92
+ import { ACTIVITY_NSID, COLLECTION_NSID } from "@hypercerts-org/lexicon";
51
93
 
52
- // Validate with detailed error information
53
- const result = OrgHypercertsClaim.validateRecord(data);
54
- if (result.success) {
55
- // data is valid
56
- } else {
57
- console.error(result.error);
58
- }
94
+ // Clean and explicit
95
+ const record = {
96
+ $type: ACTIVITY_NSID,
97
+ // ...
98
+ };
59
99
  ```
60
100
 
61
- ### Using Lexicon Constants
101
+ **Alternative**: Use the semantic NSID object when you need multiple NSIDs:
62
102
 
63
103
  ```typescript
64
- import { HYPERCERT_LEXICONS, HYPERCERT_COLLECTIONS } from '@hypercerts-org/lexicon';
104
+ import { HYPERCERTS_NSIDS } from "@hypercerts-org/lexicon";
65
105
 
66
- // Collection names for ATProto operations
67
- console.log(HYPERCERT_COLLECTIONS.CLAIM); // 'org.hypercerts.claim'
68
- console.log(HYPERCERT_COLLECTIONS.COLLECTION); // 'org.hypercerts.collection'
69
- console.log(HYPERCERT_COLLECTIONS.RIGHTS); // 'org.hypercerts.claim.rights'
70
-
71
- // Full lexicon documents for registry
72
- import { Lexicons } from '@atproto/lexicon';
73
- const registry = new Lexicons(HYPERCERT_LEXICONS);
106
+ // Access via semantic keys
107
+ const activityId = HYPERCERTS_NSIDS.ACTIVITY;
108
+ const collectionId = HYPERCERTS_NSIDS.COLLECTION;
109
+ const rightsId = HYPERCERTS_NSIDS.RIGHTS;
74
110
  ```
75
111
 
76
- ## Type Inheritance
112
+ **Type-based mapping**: If you need to map TypeScript type namespaces to NSIDs:
77
113
 
78
- This package is the source of truth for Hypercerts types. The SDK packages re-export these types with friendly aliases:
114
+ ```typescript
115
+ import { HYPERCERTS_NSIDS_BY_TYPE } from "@hypercerts-org/lexicon";
79
116
 
117
+ // Access via type namespace names
118
+ const activityId = HYPERCERTS_NSIDS_BY_TYPE.OrgHypercertsClaimActivity;
119
+ const collectionId = HYPERCERTS_NSIDS_BY_TYPE.OrgHypercertsClaimCollection;
80
120
  ```
81
- @hypercerts-org/lexicon
82
- ├── OrgHypercertsClaim.Main → sdk-core: HypercertClaim
83
- ├── OrgHypercertsClaimRights.Main → sdk-core: HypercertRights
84
- ├── OrgHypercertsCollection.Main → sdk-core: HypercertCollection
85
- └── ...etc
121
+
122
+ **Lightweight Bundle**: Import from `/lexicons` for runtime validation without TypeScript types (smaller bundle size):
123
+
124
+ ```typescript
125
+ import { schemas, validate, ids } from "@hypercerts-org/lexicon/lexicons";
126
+
127
+ // Lighter bundle, type-based namespace access
128
+ const result = validate(ids.OrgHypercertsClaimActivity, record);
86
129
  ```
87
130
 
88
- **Recommendation**: Import types from `@hypercerts-org/sdk-core` for cleaner imports, unless you need direct access to validation functions.
131
+ **Note**: Individual constants (e.g., `ACTIVITY_NSID`) are the recommended approach for most use cases as they provide the best developer experience with clear, concise naming.
89
132
 
90
- ## Development
133
+ ### TypeScript Types
91
134
 
92
- ### Regenerating Types
135
+ All lexicon types are exported as namespaces:
93
136
 
94
- Types are generated from the lexicon JSON files using `@atproto/lex-cli`:
137
+ ```typescript
138
+ import { OrgHypercertsClaimActivity } from "@hypercerts-org/lexicon";
95
139
 
96
- ```bash
97
- pnpm generate # Regenerates src/types/ from lexicons/
98
- pnpm build # Build the package
140
+ // Use the Main type
141
+ const activity: OrgHypercertsClaimActivity.Main = {
142
+ $type: "org.hypercerts.claim.activity",
143
+ title: "My Impact Work",
144
+ // ... other fields
145
+ };
146
+ ```
147
+
148
+ ### Individual Lexicon Imports
149
+
150
+ Each lexicon is available in two forms as individual constants:
151
+
152
+ ```typescript
153
+ import {
154
+ // Raw JSON (untyped) - direct import from JSON files
155
+ ACTIVITY_LEXICON_JSON,
156
+ RIGHTS_LEXICON_JSON,
157
+
158
+ // Typed LexiconDoc - from lexicons.get() at module initialization
159
+ ACTIVITY_LEXICON_DOC,
160
+ RIGHTS_LEXICON_DOC,
161
+ } from "@hypercerts-org/lexicon";
99
162
  ```
100
163
 
101
- ### Adding New Lexicons
164
+ | Suffix | Type | Source | Use Case |
165
+ | ------- | -------------------- | ------------------------- | ------------------------------ |
166
+ | `_JSON` | Untyped JSON | Direct JSON import | Raw schema data |
167
+ | `_DOC` | `LexiconDoc` (typed) | `lexicons.get()` instance | Type-safe lexicon manipulation |
102
168
 
103
- 1. Add lexicon JSON file to `lexicons/` directory
104
- 2. Run `pnpm generate` to regenerate types
105
- 3. Export new types from `src/index.ts`
106
- 4. Update `HYPERCERT_COLLECTIONS` if adding a new collection
169
+ Or access all lexicons via semantic mapping objects:
170
+
171
+ ```typescript
172
+ import {
173
+ HYPERCERTS_LEXICON_JSON,
174
+ HYPERCERTS_LEXICON_DOC,
175
+ } from "@hypercerts-org/lexicon";
176
+
177
+ // Access via semantic keys (same keys as HYPERCERTS_NSIDS)
178
+ const activityJSON = HYPERCERTS_LEXICON_JSON.ACTIVITY;
179
+ const activityDoc = HYPERCERTS_LEXICON_DOC.ACTIVITY;
180
+ const rightsJSON = HYPERCERTS_LEXICON_JSON.RIGHTS;
181
+ const rightsDoc = HYPERCERTS_LEXICON_DOC.RIGHTS;
182
+ ```
107
183
 
108
184
  ## Certified Lexicons
109
185
 
@@ -111,17 +187,19 @@ Certified lexicons are common/shared lexicons that can be used across multiple p
111
187
 
112
188
  ### Common Definitions
113
189
 
114
- **Lexicon ID:** `app.certified.defs`
190
+ **Lexicon ID:** `org.hypercerts.defs`
115
191
 
116
192
  **Description:** Common type definitions used across all certified protocols.
117
193
 
118
194
  #### Defs
119
195
 
120
- | Def | Type | Description | Comments |
121
- |-----|------|-------------|----------|
122
- | `uri` | `string` | URI to external data | |
123
- | `smallBlob` | `blob` | Data stored in a PDS (up to 10MB) | |
124
- | `largeBlob` | `blob` | Data stored in a PDS (up to 100MB) | |
196
+ | Def | Type | Description | Comments |
197
+ | ------------ | -------- | ----------------------------------------- | --------------------------------------- |
198
+ | `uri` | `object` | Object containing a URI to external data | Has `uri` property (string, format uri) |
199
+ | `smallBlob` | `object` | Object containing a blob to external data | Has `blob` property (blob, up to 10MB) |
200
+ | `largeBlob` | `object` | Object containing a blob to external data | Has `blob` property (blob, up to 100MB) |
201
+ | `smallImage` | `object` | Object containing a small image | Has `image` property (blob, up to 5MB) |
202
+ | `largeImage` | `object` | Object containing a large image | Has `image` property (blob, up to 10MB) |
125
203
 
126
204
  ---
127
205
 
@@ -129,21 +207,68 @@ Certified lexicons are common/shared lexicons that can be used across multiple p
129
207
 
130
208
  **Lexicon ID:** `app.certified.location`
131
209
 
132
- **Description:** A location reference for use across certified protocols. For more information about
210
+ **Description:** A location reference for use across certified protocols. For more information about
133
211
 
134
- **Key:** `any`
212
+ **Key:** `tid`
135
213
 
136
214
  #### Properties
137
215
 
138
- | Property | Type | Required | Description | Comments |
139
- |----------|------|----------|-------------|----------|
140
- | `lpVersion` | `string` | ✅ | The version of the Location Protocol | |
141
- | `srs` | `string` | ✅ | The Spatial Reference System URI (e.g., http://www.opengis.net/def/crs/OGC/1.3/CRS84) that defines the coordinate system. | |
142
- | `locationType` | `string` | ✅ | An identifier for the format of the location data (e.g., coordinate-decimal, geojson-point) | |
143
- | `location` | `union` | ✅ | The location of where the work was performed as a URI or blob. | |
144
- | `name` | `string` | ❌ | Optional name for this location | |
145
- | `description` | `string` | ❌ | Optional description for this location | |
146
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
216
+ | Property | Type | Required | Description |
217
+ | -------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
218
+ | `lpVersion` | `string` | ✅ | The version of the Location Protocol |
219
+ | `srs` | `string` | ✅ | The Spatial Reference System URI (e.g., http://www.opengis.net/def/crs/OGC/1.3/CRS84) that defines the coordinate system. |
220
+ | `locationType` | `string` | ✅ | An identifier for the format of the location data (e.g., coordinate-decimal, geojson-point) |
221
+ | `location` | `union` | ✅ | The location of where the work was performed as a URI or blob. |
222
+ | `name` | `string` | ❌ | Optional name for this location |
223
+ | `description` | `string` | ❌ | Optional description for this location |
224
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created |
225
+
226
+ ### Badges Lexicon
227
+
228
+ **Lexicon IDs:** `app.certified.badge.definition`, `app.certified.badge.award`, `app.certified.badge.response`
229
+
230
+ **Description:** Defines badge metadata, award records, and recipient responses for certified badges that can be used across protocols.
231
+
232
+ #### Badge Definition
233
+
234
+ **Lexicon ID:** `app.certified.badge.definition`
235
+
236
+ **Key:** `tid`
237
+
238
+ | Property | Type | Required | Description |
239
+ | ---------------- | -------- | -------- | ---------------------------------------------------------------------- |
240
+ | `badgeType` | `string` | ✅ | Category of the badge (e.g., endorsement, participation, affiliation). |
241
+ | `title` | `string` | ✅ | Human-readable title of the badge. |
242
+ | `icon` | `blob` | ✅ | Icon representing the badge (accepted `image/*` types, maxSize 1MB). |
243
+ | `description` | `string` | ❌ | Optional short statement describing the badge. |
244
+ | `allowedIssuers` | `array` | ❌ | Optional allowlist of DIDs allowed to issue this badge. |
245
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created. |
246
+
247
+ #### Badge Award
248
+
249
+ **Lexicon ID:** `app.certified.badge.award`
250
+
251
+ **Key:** `tid`
252
+
253
+ | Property | Type | Required | Description |
254
+ | ----------- | -------- | -------- | ------------------------------------------------------------------------------------ |
255
+ | `badge` | `ref` | ✅ | Reference to the badge definition for this award (`app.certified.badge.definition`). |
256
+ | `subject` | `union` | ✅ | Entity the badge award is for (either a DID or a specific AT Protocol record). |
257
+ | `note` | `string` | ❌ | Optional explanation for the award. |
258
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created. |
259
+
260
+ #### Badge Response
261
+
262
+ **Lexicon ID:** `app.certified.badge.response`
263
+
264
+ **Key:** `tid`
265
+
266
+ | Property | Type | Required | Description |
267
+ | ------------ | -------- | -------- | ---------------------------------------------------------------------- |
268
+ | `badgeAward` | `ref` | ✅ | Reference to the badge award (`app.certified.badge.award`). |
269
+ | `response` | `string` | ✅ | Enum: `accepted` or `rejected`. |
270
+ | `weight` | `string` | ❌ | Optional relative weight assigned by the recipient (stored as string). |
271
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created. |
147
272
 
148
273
  ---
149
274
 
@@ -151,9 +276,9 @@ Certified lexicons are common/shared lexicons that can be used across multiple p
151
276
 
152
277
  Hypercerts-specific lexicons for tracking impact work and claims.
153
278
 
154
- ### Hypercerts Record
279
+ ### Hypercerts Activity Claim
155
280
 
156
- **Lexicon ID:** `org.hypercerts.claim.record`
281
+ **Lexicon ID:** `org.hypercerts.claim.activity`
157
282
 
158
283
  **Description:** The main lexicon where everything is connected to. This is the hypercert record that tracks impact work.
159
284
 
@@ -161,42 +286,50 @@ Hypercerts-specific lexicons for tracking impact work and claims.
161
286
 
162
287
  #### Properties
163
288
 
164
- | Property | Type | Required | Description | Comments |
165
- |----------|------|----------|-------------|----------|
166
- | `title` | `string` | ✅ | Title of the hypercert | |
167
- | `shortDescription` | `string` | ✅ | Short blurb of the impact work done. | |
168
- | `description` | `string` | ❌ | Optional longer description of the impact work done. | |
169
- | `image` | `union` | ❌ | The hypercert visual representation as a URI or blob | |
170
- | `workScope` | `string` | | Scope of the work performed | |
171
- | `workTimeframeFrom` | `string` | ✅ | When the work began | |
172
- | `workTimeFrameTo` | `string` | ✅ | When the work ended | |
173
- | `evidence` | `array` | ❌ | Supporting evidence, documentation, or external data URIs | References must conform to `org.hypercerts.claim.evidence` |
174
- | `contributions` | `array` | ❌ | A strong reference to the contributions done to create the impact in the hypercerts | References must conform to `org.hypercerts.claim.contributions` |
175
- | `rights` | `ref` | ❌ | A strong reference to the rights that this hypercert has | References must conform to `org.hypercerts.claim.rights` |
176
- | `location` | `ref` | ❌ | A strong reference to the location where the work for done hypercert was located | References must conform to `org.hypercerts.claim.location` |
177
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
289
+ | Property | Type | Required | Description | Comments |
290
+ | ------------------ | -------- | -------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
291
+ | `title` | `string` | ✅ | Title of the hypercert | |
292
+ | `shortDescription` | `string` | ✅ | Short blurb of the impact work done. | |
293
+ | `description` | `string` | ❌ | Optional longer description of the impact work done. | |
294
+ | `image` | `union` | ❌ | The hypercert visual representation as a URI or image blob | |
295
+ | `workScope` | `object` | | Logical scope of the work using label-based conditions | Object with `withinAllOf`, `withinAnyOf`, `withinNoneOf` arrays of labels |
296
+ | `startDate` | `string` | ✅ | When the work began | |
297
+ | `endDate` | `string` | ✅ | When the work ended | |
298
+ | `contributions` | `array` | ❌ | A strong reference to the contributions done to create the impact in the hypercerts | References must conform to `org.hypercerts.claim.contribution` |
299
+ | `rights` | `ref` | ❌ | A strong reference to the rights that this hypercert has | References must conform to `org.hypercerts.claim.rights` |
300
+ | `location` | `ref` | ❌ | A strong reference to the location where the work for done hypercert was located | References must conform to `app.certified.location` |
301
+ | `project` | `string` | ❌ | A reference (AT-URI) to the project record that this activity is part of | References must conform to `org.hypercerts.claim.project` |
302
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
303
+
304
+ #### Defs
305
+
306
+ ##### activityWeight
307
+
308
+ | Property | Type | Required | Description |
309
+ | ---------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
310
+ | `activity` | `ref` | ✅ | A strong reference to a hypercert activity record. This activity must conform to the lexicon org.hypercerts.claim.activity |
311
+ | `weight` | `string` | ✅ | The relative weight/importance of this hypercert activity (stored as a string to avoid float precision issues). Weights can be any positive numeric values and do not need to sum to a specific total; normalization can be performed by the consuming application as needed. |
178
312
 
179
313
  ---
180
314
 
181
- ### Hypercerts Contributor
315
+ ### Hypercerts Contribution
182
316
 
183
317
  **Lexicon ID:** `org.hypercerts.claim.contribution`
184
318
 
185
319
  **Description:** A contribution made toward a hypercert's impact.
186
320
 
187
- **Key:** `any`
321
+ **Key:** `tid`
188
322
 
189
323
  #### Properties
190
324
 
191
- | Property | Type | Required | Description | Comments |
192
- |----------|------|----------|-------------|----------|
193
- | `hypercert` | `ref` | | A strong reference to the hypercert this contribution is for | The record referenced must conform with the lexicon `org.hypercerts.claim.record` |
194
- | `role` | `string` | | Role or title of the contributor(s). | |
195
- | `contributors` | `array` | | List of the contributors (names, pseudonyms, or DIDs). If multiple contributors are stored in the same hypercertContribution, then they would have the exact same role. | |
196
- | `description` | `string` | ❌ | What the contribution concretely achieved | |
197
- | `workTimeframeFrom` | `string` | ❌ | When this contribution started. This should be a subset of the hypercert timeframe. | |
198
- | `workTimeframeTo` | `string` | | When this contribution finished. This should be a subset of the hypercert timeframe. | |
199
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
325
+ | Property | Type | Required | Description |
326
+ | -------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
327
+ | `role` | `string` | | Role or title of the contributor(s). |
328
+ | `contributors` | `array` | | List of the contributors (names, pseudonyms, or DIDs). If multiple contributors are stored in the same hypercertContribution, then they would have the exact same role. |
329
+ | `description` | `string` | | What the contribution concretely achieved |
330
+ | `startDate` | `string` | ❌ | When this contribution started. This should be a subset of the hypercert timeframe. |
331
+ | `endDate` | `string` | ❌ | When this contribution finished. This should be a subset of the hypercert timeframe. |
332
+ | `createdAt` | `string` | | Client-declared timestamp when this record was originally created |
200
333
 
201
334
  ---
202
335
 
@@ -204,19 +337,22 @@ Hypercerts-specific lexicons for tracking impact work and claims.
204
337
 
205
338
  **Lexicon ID:** `org.hypercerts.claim.evaluation`
206
339
 
207
- **Description:** An evaluation of a hypercert or other claim
340
+ **Description:** An evaluation of a hypercert record (e.g. an activity and its impact).
208
341
 
209
342
  **Key:** `tid`
210
343
 
211
344
  #### Properties
212
345
 
213
- | Property | Type | Required | Description | Comments |
214
- |----------|------|----------|-------------|----------|
215
- | `subject` | `ref` | | A strong reference to the evaluated claim | (e.g measurement, hypercert, contribution, etc) |
216
- | `evaluators` | `array` | ✅ | DIDs of the evaluators | |
217
- | `evaluations` | `array` | ❌ | Evaluation data (URIs or blobs) containing detailed reports or methodology | |
218
- | `summary` | `string` | | Brief evaluation summary | |
219
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
346
+ | Property | Type | Required | Description | Comments |
347
+ | -------------- | -------- | -------- | --------------------------------------------------------------------------- | ------------------------------------------------------------- |
348
+ | `subject` | `ref` | | A strong reference to what is being evaluated | (e.g activity, measurement, contribution, etc.) |
349
+ | `evaluators` | `array` | ✅ | DIDs of the evaluators | |
350
+ | `content` | `array` | ❌ | Evaluation data (URIs or blobs) containing detailed reports or methodology | |
351
+ | `measurements` | `array` | | Optional references to the measurements that contributed to this evaluation | References must conform to `org.hypercerts.claim.measurement` |
352
+ | `summary` | `string` | ✅ | Brief evaluation summary | |
353
+ | `score` | `object` | ❌ | Optional overall score for this evaluation on a numeric scale | Object with `min`, `max`, and `value` (integers) |
354
+ | `location` | `ref` | ❌ | An optional reference for georeferenced evaluations | References must conform to `app.certified.location` |
355
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
220
356
 
221
357
  ---
222
358
 
@@ -224,19 +360,21 @@ Hypercerts-specific lexicons for tracking impact work and claims.
224
360
 
225
361
  **Lexicon ID:** `org.hypercerts.claim.evidence`
226
362
 
227
- **Description:** A piece of evidence supporting a hypercert claim
363
+ **Description:** A piece of evidence related to a hypercert record (e.g. an activity, project, claim, or evaluation). Evidence may support, clarify, or challenge the referenced subject.
228
364
 
229
- **Key:** `any`
365
+ **Key:** `tid`
230
366
 
231
367
  #### Properties
232
368
 
233
- | Property | Type | Required | Description | Comments |
234
- |----------|------|----------|-------------|----------|
235
- | `content` | `union` | | A piece of evidence (URI or blobs) supporting a hypercert claim | |
236
- | `title` | `string` | | Optional title to describe the nature of the evidence | |
237
- | `shortDescription` | `string` | ✅ | Short description explaining what this evidence demonstrates or proves | |
238
- | `description` | `string` | ❌ | Optional longer description describing the impact claim evidence. | |
239
- | `createdAt` | `string` | | Client-declared timestamp when this hypercert claim was originally created | |
369
+ | Property | Type | Required | Description | Comments |
370
+ | ------------------ | -------- | -------- | ----------------------------------------------------------------- | ---------------------------------------------------- |
371
+ | `subject` | `ref` | | A strong reference to the record this evidence relates to | (e.g. an activity, project, claim, or evaluation) |
372
+ | `content` | `union` | | A piece of evidence (URI or blob) related to the subject record | May support, clarify, or challenge a hypercert claim |
373
+ | `title` | `string` | ✅ | Title to describe the nature of the evidence | |
374
+ | `shortDescription` | `string` | ❌ | Short description explaining what this evidence shows | |
375
+ | `description` | `string` | | Longer description describing the evidence in more detail | |
376
+ | `relationType` | `string` | ❌ | How this evidence relates to the subject | Known values: `supports`, `challenges`, `clarifies` |
377
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
240
378
 
241
379
  ---
242
380
 
@@ -244,27 +382,29 @@ Hypercerts-specific lexicons for tracking impact work and claims.
244
382
 
245
383
  **Lexicon ID:** `org.hypercerts.claim.measurement`
246
384
 
247
- **Description:** External measurement data supporting a hypercert claim
385
+ **Description:** Measurement data related to a hypercert record (e.g. an activity and its impact).
248
386
 
249
387
  **Key:** `tid`
250
388
 
251
389
  #### Properties
252
390
 
253
- | Property | Type | Required | Description | Comments |
254
- |----------|------|----------|-------------|----------|
255
- | `hypercert` | `ref` | | A strong reference to the hypercert that this measurement is for | The record referenced must conform with the lexicon `org.hypercerts.claim.record` |
256
- | `measurers` | `array` | ✅ | DIDs of the entity (or entities) that measured this data. | |
257
- | `metric` | `string` | ✅ | The metric being measured | |
258
- | `value` | `string` | ✅ | The measured value | |
259
- | `measurementMethodURI` | `string` | ❌ | URI to methodology documentation, standard protocol, or measurement procedure | |
260
- | `evidenceURI` | `array` | ❌ | URIs to supporting evidence or data | |
261
- | `createdAt` | `string` | | Client-declared timestamp when this record was originally created | |
391
+ | Property | Type | Required | Description | Comments |
392
+ | ------------- | -------- | -------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------ |
393
+ | `subject` | `ref` | | A strong reference to the record this measurement refers to | (e.g. an activity, project, or claim) |
394
+ | `measurers` | `array` | ✅ | DIDs of the entity (or entities) that measured this data | |
395
+ | `metric` | `string` | ✅ | The metric being measured | |
396
+ | `value` | `string` | ✅ | The measured value | |
397
+ | `methodType` | `string` | ❌ | Short identifier for the measurement methodology | |
398
+ | `methodURI` | `string` | ❌ | URI to methodology documentation, standard protocol, or measurement procedure | |
399
+ | `evidenceURI` | `array` | | URIs to related evidence or underlying data | (e.g. org.hypercerts.claim.evidence records or raw datasets) |
400
+ | `location` | `ref` | ❌ | A strong reference to the location where the measurement was taken | References must conform to `app.certified.location` |
401
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
262
402
 
263
403
  ---
264
404
 
265
- ### org.hypercerts.collection
405
+ ### org.hypercerts.claim.collection
266
406
 
267
- **Lexicon ID:** `org.hypercerts.collection`
407
+ **Lexicon ID:** `org.hypercerts.claim.collection`
268
408
 
269
409
  **Description:** A collection/group of hypercerts that have a specific property.
270
410
 
@@ -272,22 +412,37 @@ Hypercerts-specific lexicons for tracking impact work and claims.
272
412
 
273
413
  #### Properties
274
414
 
275
- | Property | Type | Required | Description | Comments |
276
- |----------|------|----------|-------------|----------|
277
- | `title` | `string` | ✅ | The title of this collection | |
278
- | `shortDescription` | `string` | ❌ | A short description of this collection | |
279
- | `coverPhoto` | `union` | ❌ | The cover photo of this collection (either in URI format or in a blob). | |
280
- | `claims` | `array` | | Array of claims with their associated weights in this collection | Each item references `#claimItem` |
281
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
415
+ | Property | Type | Required | Description | Comments |
416
+ | ------------------ | -------- | -------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
417
+ | `title` | `string` | ✅ | The title of this collection | |
418
+ | `shortDescription` | `string` | ❌ | A short description of this collection | |
419
+ | `avatar` | `blob` | ❌ | Primary avatar image representing this collection across apps and views | Typically a square image |
420
+ | `coverPhoto` | `blob` | | The cover photo of this collection | |
421
+ | `activities` | `array` | ✅ | Array of activities with their associated weights in this collection | Each item references `org.hypercerts.claim.activity#activityWeight` |
422
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
282
423
 
283
- #### Defs
424
+ ---
284
425
 
285
- ##### claimItem
426
+ ### org.hypercerts.claim.project
286
427
 
287
- | Property | Type | Required | Description | Comments |
288
- |----------|------|----------|-------------|----------|
289
- | `claim` | `ref` | | A strong reference to a hypercert claim record. This claim must conform to the lexicon org.hypercerts.claim.record | |
290
- | `weight` | `string` | ✅ | 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. | |
428
+ **Lexicon ID:** `org.hypercerts.claim.project`
429
+
430
+ **Description:** A project that can include multiple activities, each of which may be linked to at most one project.
431
+
432
+ **Key:** `tid`
433
+
434
+ #### Properties
435
+
436
+ | Property | Type | Required | Description | Comments |
437
+ | ------------------ | -------- | -------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
438
+ | `title` | `string` | ✅ | Title of this project | |
439
+ | `shortDescription` | `string` | ✅ | Short summary of this project, suitable for previews and list views | |
440
+ | `description` | `ref` | ❌ | Rich-text description of this project, represented as a Leaflet linear document | References must conform to `pub.leaflet.pages.linearDocument#main` |
441
+ | `avatar` | `blob` | ❌ | Primary avatar image representing this project across apps and views | Typically a square logo or project identity image |
442
+ | `coverPhoto` | `blob` | ❌ | The cover photo of this project | |
443
+ | `activities` | `array` | ❌ | Array of activities with their associated weights in this project | Each item references `org.hypercerts.claim.activity#activityWeight` |
444
+ | `location` | `ref` | ❌ | A strong reference to a location record describing where the work took place | References must conform to `app.certified.location` |
445
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
291
446
 
292
447
  ---
293
448
 
@@ -295,18 +450,45 @@ Hypercerts-specific lexicons for tracking impact work and claims.
295
450
 
296
451
  **Lexicon ID:** `org.hypercerts.claim.rights`
297
452
 
298
- **Description:** Describes the rights that a user has with a hypercert, such as whether it can be sold, transferred, and under what conditions.
453
+ **Description:** Describes the rights that a contributor and/or an owner has, such as whether the hypercert can be sold, transferred, and under what conditions.
299
454
 
300
- **Key:** `any`
455
+ **Key:** `tid`
456
+
457
+ #### Properties
458
+
459
+ | Property | Type | Required | Description | Comments |
460
+ | ------------------- | -------- | -------- | ----------------------------------------------------------------- | ----------- |
461
+ | `rightsName` | `string` | ✅ | Full name of the rights | |
462
+ | `rightsType` | `string` | ✅ | Short rights identifier for easier search | |
463
+ | `rightsDescription` | `string` | ✅ | Description of the rights of this hypercert | |
464
+ | `attachment` | `union` | ❌ | An attachment to define the rights further, e.g. a legal document | URI or blob |
465
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
466
+
467
+ ---
468
+
469
+ ### org.hypercerts.funding.receipt
470
+
471
+ **Lexicon ID:** `org.hypercerts.funding.receipt`
472
+
473
+ **Description:** Records a funding receipt for a payment from one user to another user. It may be recorded by the recipient, by the sender, or by a third party. The sender may remain anonymous.
474
+
475
+ **Key:** `tid`
301
476
 
302
477
  #### Properties
303
478
 
304
- | Property | Type | Required | Description | Comments |
305
- |----------|------|----------|-------------|----------|
306
- | `rightsName` | `string` | ✅ | Full name of the rights | |
307
- | `rightsType` | `string` | ✅ | Short rights identifier for easier search | |
308
- | `rightsDescription` | `string` | ✅ | Description of the rights of this hypercert | |
309
- | `createdAt` | `string` | ✅ | Client-declared timestamp when this record was originally created | |
479
+ | Property | Type | Required | Description | Comments |
480
+ | ---------------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
481
+ | `from` | `string` | ✅ | DID of the sender who transferred the funds. If sender wants to stay anonymous, mark this explicitly. | Format: did |
482
+ | `to` | `string` | ✅ | The recipient of the funds, who can be identified by DID or a clear-text name. | |
483
+ | `amount` | `string` | ✅ | Amount of funding received. | |
484
+ | `currency` | `string` | ✅ | Currency of the payment (e.g. EUR, USD, ETH). | |
485
+ | `paymentRail` | `string` | ❌ | How the funds were transferred (e.g. bank_transfer, credit_card, onchain, cash, check, payment_processor). | |
486
+ | `paymentNetwork` | `string` | ❌ | Optional network within the payment rail (e.g. arbitrum, ethereum, sepa, visa, paypal). | |
487
+ | `transactionId` | `string` | ❌ | Identifier of the underlying payment transaction (e.g. bank reference, onchain transaction hash, or processor-specific ID). | Use paymentNetwork to specify the network where applicable. |
488
+ | `for` | `string` | ❌ | Optional reference to the activity, project, or organization this funding relates to. | Format: at-uri |
489
+ | `notes` | `string` | ❌ | Optional notes or additional context for this funding receipt. | maxLength: 500 |
490
+ | `occurredAt` | `string` | ❌ | Timestamp when the payment occurred. | Format: datetime |
491
+ | `createdAt` | `string` | ✅ | Client-declared timestamp when this receipt record was created. | Format: datetime |
310
492
 
311
493
  ---
312
494