Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .changeset/update-measurement-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
"@hypercerts-org/sdk-core": minor
"@hypercerts-org/sdk-react": minor
---

Update measurement API to align with lexicon beta.12+ schema

**Breaking Changes (sdk-core):**

- `addMeasurement()` now accepts `CreateMeasurementParams` instead of individual parameters
- `subject` field replaces `hypercertUri` and accepts both string AT-URIs and StrongRefs
- `unit` is now a required field (e.g., "tons CO2e", "hectares", "%")
- `measurers` is now optional instead of required
- Field name changes: `methodUri` → `methodURI`, `evidenceUris` → `evidenceURI`

**Breaking Changes (sdk-react):**

- Removed `OrgHypercertsDefs` export (WorkScope types removed from lexicon)
- `UpdateHypercertParams.workScope` now accepts `string | StrongRef` (i.e., `string | { uri: string; cid: string }`)

Comment thread
Kzoeps marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
**New Features:**

- Added `updateMeasurement()` method with `UpdateMeasurementParams` type (subject is immutable)
- Support for `locations` array to specify where measurements were taken
- Added `startDate` and `endDate` for measurement timeframes
- Added `methodType` for short methodology identifiers
- Rich text support via `comment` and `commentFacets` fields

**Internal Improvements:**

- Added `resolveToStrongRef` utility for handling string/StrongRef conversions
- Updated evidence handling to use `HypercertAttachment` schema (beta.13 compatibility)
- Improved error messages in URI resolution functions
2 changes: 1 addition & 1 deletion packages/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@atproto/lexicon": "^0.5.1",
"@atproto/oauth-client": "^0.5.10",
"@atproto/oauth-client-node": "^0.3.12",
"@hypercerts-org/lexicon": "0.10.0-beta.11",
"@hypercerts-org/lexicon": "0.10.0-beta.13",
Comment thread
aspiers marked this conversation as resolved.
"eventemitter3": "^5.0.1",
"type-fest": "^5.4.1",
"zod": "^3.24.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export {
OrgHypercertsClaimContributorInformation,
OrgHypercertsClaimMeasurement,
OrgHypercertsClaimEvaluation,
OrgHypercertsClaimEvidence,
OrgHypercertsClaimAttachment,
OrgHypercertsClaimCollection,
OrgHypercertsHelperWorkScopeTag,
AppCertifiedLocation,
Expand Down
16 changes: 11 additions & 5 deletions packages/sdk-core/src/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {
CONTRIBUTION_DETAILS_LEXICON_JSON,
CONTRIBUTOR_INFORMATION_LEXICON_JSON,
EVALUATION_LEXICON_JSON,
EVIDENCE_LEXICON_JSON,
ATTACHMENT_LEXICON_JSON,
MEASUREMENT_LEXICON_JSON,
RIGHTS_LEXICON_JSON,
BADGE_AWARD_LEXICON_JSON,
Expand All @@ -86,7 +86,7 @@ import {
CONTRIBUTOR_INFORMATION_NSID,
MEASUREMENT_NSID,
EVALUATION_NSID,
EVIDENCE_NSID,
ATTACHMENT_NSID,
COLLECTION_NSID,
BADGE_AWARD_NSID,
BADGE_DEFINITION_NSID,
Expand All @@ -113,7 +113,7 @@ export const HYPERCERT_LEXICONS: LexiconDoc[] = [
CONTRIBUTION_DETAILS_LEXICON_JSON as LexiconDoc,
CONTRIBUTOR_INFORMATION_LEXICON_JSON as LexiconDoc,
EVALUATION_LEXICON_JSON as LexiconDoc,
EVIDENCE_LEXICON_JSON as LexiconDoc,
ATTACHMENT_LEXICON_JSON as LexiconDoc,
MEASUREMENT_LEXICON_JSON as LexiconDoc,
RIGHTS_LEXICON_JSON as LexiconDoc,
BADGE_AWARD_LEXICON_JSON as LexiconDoc,
Expand Down Expand Up @@ -168,9 +168,15 @@ export const HYPERCERT_COLLECTIONS = {
EVALUATION: EVALUATION_NSID,

/**
* Evidence record collection.
* Attachment record collection (formerly evidence).
* @remarks Renamed from EVIDENCE in beta.13
*/
EVIDENCE: EVIDENCE_NSID,
ATTACHMENT: ATTACHMENT_NSID,

/**
* @deprecated Use ATTACHMENT instead. Renamed in beta.13.
*/
EVIDENCE: ATTACHMENT_NSID,

/**
* Collection record collection (groups of hypercerts).
Expand Down
Loading