Skip to content

Commit 7578756

Browse files
authored
Merge pull request #120 from hypercerts-org/measurements-migration
2 parents af0dfc0 + 61fe2cf commit 7578756

17 files changed

Lines changed: 882 additions & 269 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
"@hypercerts-org/sdk-core": minor
3+
"@hypercerts-org/sdk-react": minor
4+
---
5+
6+
Update measurement API to align with lexicon beta.12+ schema
7+
8+
**Breaking Changes (sdk-core):**
9+
10+
- `addMeasurement()` now accepts `CreateMeasurementParams` instead of individual parameters
11+
- `subject` field replaces `hypercertUri` and accepts both string AT-URIs and StrongRefs
12+
- `unit` is now a required field (e.g., "tons CO2e", "hectares", "%")
13+
- `measurers` is now optional instead of required
14+
- Field name changes: `methodUri``methodURI`, `evidenceUris``evidenceURI`
15+
16+
**Breaking Changes (sdk-react):**
17+
18+
- Removed `OrgHypercertsDefs` export (WorkScope types removed from lexicon)
19+
- `UpdateHypercertParams.workScope` now accepts `string | StrongRef` (i.e., `string | { uri: string; cid: string }`)
20+
21+
**New Features:**
22+
23+
- Added `updateMeasurement()` method with `UpdateMeasurementParams` type (subject is immutable)
24+
- Support for `locations` array to specify where measurements were taken
25+
- Added `startDate` and `endDate` for measurement timeframes
26+
- Added `methodType` for short methodology identifiers
27+
- Rich text support via `comment` and `commentFacets` fields
28+
29+
**Internal Improvements:**
30+
31+
- Added `resolveToStrongRef` utility for handling string/StrongRef conversions
32+
- Updated evidence handling to use `HypercertAttachment` schema (beta.13 compatibility)
33+
- Improved error messages in URI resolution functions

packages/sdk-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"@atproto/lexicon": "^0.5.1",
8989
"@atproto/oauth-client": "^0.5.10",
9090
"@atproto/oauth-client-node": "^0.3.12",
91-
"@hypercerts-org/lexicon": "0.10.0-beta.11",
91+
"@hypercerts-org/lexicon": "0.10.0-beta.13",
9292
"eventemitter3": "^5.0.1",
9393
"type-fest": "^5.4.1",
9494
"zod": "^3.24.4"

packages/sdk-core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export {
114114
OrgHypercertsClaimContributorInformation,
115115
OrgHypercertsClaimMeasurement,
116116
OrgHypercertsClaimEvaluation,
117-
OrgHypercertsClaimEvidence,
117+
OrgHypercertsClaimAttachment,
118118
OrgHypercertsClaimCollection,
119119
OrgHypercertsHelperWorkScopeTag,
120120
AppCertifiedLocation,

packages/sdk-core/src/lexicons.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import {
7070
CONTRIBUTION_DETAILS_LEXICON_JSON,
7171
CONTRIBUTOR_INFORMATION_LEXICON_JSON,
7272
EVALUATION_LEXICON_JSON,
73-
EVIDENCE_LEXICON_JSON,
73+
ATTACHMENT_LEXICON_JSON,
7474
MEASUREMENT_LEXICON_JSON,
7575
RIGHTS_LEXICON_JSON,
7676
BADGE_AWARD_LEXICON_JSON,
@@ -86,7 +86,7 @@ import {
8686
CONTRIBUTOR_INFORMATION_NSID,
8787
MEASUREMENT_NSID,
8888
EVALUATION_NSID,
89-
EVIDENCE_NSID,
89+
ATTACHMENT_NSID,
9090
COLLECTION_NSID,
9191
BADGE_AWARD_NSID,
9292
BADGE_DEFINITION_NSID,
@@ -113,7 +113,7 @@ export const HYPERCERT_LEXICONS: LexiconDoc[] = [
113113
CONTRIBUTION_DETAILS_LEXICON_JSON as LexiconDoc,
114114
CONTRIBUTOR_INFORMATION_LEXICON_JSON as LexiconDoc,
115115
EVALUATION_LEXICON_JSON as LexiconDoc,
116-
EVIDENCE_LEXICON_JSON as LexiconDoc,
116+
ATTACHMENT_LEXICON_JSON as LexiconDoc,
117117
MEASUREMENT_LEXICON_JSON as LexiconDoc,
118118
RIGHTS_LEXICON_JSON as LexiconDoc,
119119
BADGE_AWARD_LEXICON_JSON as LexiconDoc,
@@ -168,9 +168,15 @@ export const HYPERCERT_COLLECTIONS = {
168168
EVALUATION: EVALUATION_NSID,
169169

170170
/**
171-
* Evidence record collection.
171+
* Attachment record collection (formerly evidence).
172+
* @remarks Renamed from EVIDENCE in beta.13
172173
*/
173-
EVIDENCE: EVIDENCE_NSID,
174+
ATTACHMENT: ATTACHMENT_NSID,
175+
176+
/**
177+
* @deprecated Use ATTACHMENT instead. Renamed in beta.13.
178+
*/
179+
EVIDENCE: ATTACHMENT_NSID,
174180

175181
/**
176182
* Collection record collection (groups of hypercerts).

0 commit comments

Comments
 (0)