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
58 changes: 58 additions & 0 deletions .changeset/evidence-to-attachment-rename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
"@hypercerts-org/sdk-core": minor
---

Rename evidence records to attachments and update schema to match lexicon changes

**Breaking Changes:**

**API Symbol Renames:**

- `addEvidence()` → `addAttachment()`
- `CreateHypercertEvidenceParams` → `CreateAttachmentParams`
- `evidenceUris` → `attachmentUris` in create results
- `evidenceAdded` → `attachmentAdded` event
- Evidence type exports replaced with Attachment equivalents
Comment thread
coderabbitai[bot] marked this conversation as resolved.

**Schema Field Changes:**

**Subject Fields:**

- `subjectUri` (string) → `subjects` (array of StrongRefs or a single uri or StrongRef)
- `subject` (StrongRef) → `subjects` (array of StrongRefs or a single uri or StrongRef)

**Content Fields:**

- `content` (string | Blob) | Array<(string | Blob)> → `content` (required array of URI/Blob refs)
- Content is now required and can be an array with multiple items or a single item. SDK will convert to an array

**Removed Fields:**

- `relationType` - removed from attachment schema
- `contributors` - removed from attachment schema
- `locations` - removed from attachment schema

**Payload Mapping Examples:**

```typescript
// Old evidence payload
{
subjectUri: "at://did:plc:abc/org.hypercerts.claim.activity/xyz",
content: "https://example.com/report.pdf",
title: "Report",
relationType: "supports"
}

// New attachment payload
{
subjects: "at://did:plc:abc/org.hypercerts.claim.activity/xyz",
content: "https://example.com/report.pdf",
title: "Report"
// relationType removed
}
Comment thread
Kzoeps marked this conversation as resolved.
// or arrays:
{
subjects: ["at://did:plc:abc/org.hypercerts.claim.activity/xyz", "at://did:plc:abc/org.hypercerts.claim.activity/zyx"]
content: ["https://reportfile.com/pdf", File]
}
```
6 changes: 4 additions & 2 deletions packages/sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export type {
OrganizationOperations,
CreateHypercertParams,
CreateHypercertResult,
CreateHypercertEvidenceParams,
CreateOrganizationParams,
LocationParams,
ContributionDetailsParams,
Expand Down Expand Up @@ -162,7 +161,7 @@ export type {
BadgeResponse,
FundingReceipt,
// SDK-specific types
HypercertEvidence,
HypercertAttachment,
HypercertImage,
HypercertImageRecord,
BlobRef,
Expand All @@ -171,6 +170,9 @@ export type {
HypercertProjectWithMetadata,
CreateProjectParams,
UpdateProjectParams,
CreateAttachmentParams,
UpdateAttachmentParams,
AttachmentParams,
} from "./services/hypercerts/types.js";

// Re-export ATProto lexicon types
Expand Down
8 changes: 1 addition & 7 deletions packages/sdk-core/src/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,10 @@ export const HYPERCERT_COLLECTIONS = {
EVALUATION: EVALUATION_NSID,

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

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

/**
* Collection record collection (groups of hypercerts).
* Projects are now collections with type='project'.
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/src/lexicons/sidecar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export async function attachSidecar(repo: Repository, params: AttachSidecarParam
* This orchestrates the creation of a main record followed by one or more
* sidecar records that reference it. This is useful for workflows like:
* - Creating a project with multiple hypercert claims
* - Creating a hypercert with evidence and evaluation records
* - Creating a hypercert with attachments and evaluation records
*
* @param repo - The repository instance
* @param params - Parameters including the main record and sidecar definitions
Expand Down
Loading