|
| 1 | +--- |
| 2 | +"@hypercerts-org/sdk-core": minor |
| 3 | +"@hypercerts-org/sdk-react": minor |
| 4 | +--- |
| 5 | + |
| 6 | +Add dual profile system with separate Bluesky and Certified profile operations, plus upsert methods |
| 7 | + |
| 8 | +**Core SDK (`@hypercerts-org/sdk-core`):** |
| 9 | + |
| 10 | +**Breaking Changes:** |
| 11 | + |
| 12 | +The profile API has been completely redesigned to support two profile types: |
| 13 | + |
| 14 | +- **Removed generic profile methods:** |
| 15 | + - ❌ `profile.get()` |
| 16 | + - ❌ `profile.create(params)` |
| 17 | + - ❌ `profile.update(params)` |
| 18 | + |
| 19 | +- **Removed deprecated profile types:** |
| 20 | + - ❌ `HypercertProfile` - Use `CertifiedProfileRecord` instead |
| 21 | + - ❌ `CreateHypercertProfileParams` - Use `CreateCertifiedProfileParams` instead |
| 22 | + - ❌ `UpdateHypercertProfileParams` - Use `UpdateCertifiedProfileParams` instead |
| 23 | + - ❌ `HypercertProfileParams` - Use specific create/update types instead |
| 24 | + - ❌ `CreateProfileParams` - Use `CreateCertifiedProfileParams` instead |
| 25 | + |
| 26 | +- **Removed unused type export:** |
| 27 | + - ❌ `JsonBlobRef` - No longer used in SDK. This type was removed because: |
| 28 | + - It was too "snowflaky" - required converting `BlobRef` instances to JSON format unnecessarily |
| 29 | + - The actual `BlobRef` object works perfectly fine for all use cases |
| 30 | + - It created flaky tests where we manually created mock JSON objects that weren't representative of actual |
| 31 | + `JsonBlobRef` values |
| 32 | + - Internal implementation now uses `BlobRef` instances directly throughout |
| 33 | + - Users who need this type for advanced use cases can import it directly from `@atproto/lexicon` |
| 34 | + |
| 35 | +- **Added profile-specific methods:** |
| 36 | + - ✅ `profile.getBskyProfile()` - Get Bluesky profile (app.bsky.actor.profile) |
| 37 | + - ✅ `profile.createBskyProfile(params)` - Create Bluesky profile |
| 38 | + - ✅ `profile.updateBskyProfile(params)` - Update Bluesky profile |
| 39 | + - ✅ `profile.getCertifiedProfile()` - Get Certified profile (app.certified.actor.profile) **[Returns `null` if |
| 40 | + profile doesn't exist]** |
| 41 | + - ✅ `profile.createCertifiedProfile(params)` - Create Certified profile |
| 42 | + - ✅ `profile.updateCertifiedProfile(params)` - Update Certified profile |
| 43 | + - ✅ `profile.upsertBskyProfile(params)` - Create or update Bluesky profile **[New]** |
| 44 | + - ✅ `profile.upsertCertifiedProfile(params)` - Create or update Certified profile **[New]** |
| 45 | + |
| 46 | +**Features:** |
| 47 | + |
| 48 | +- **Bluesky profiles** (`app.bsky.actor.profile`): |
| 49 | + - Standard AT Protocol profiles |
| 50 | + - Avatar/banner returned as CDN URLs (`https://cdn.bsky.app/...`) |
| 51 | + - Includes Bluesky-specific fields (labels, pinnedPost, etc.) |
| 52 | + |
| 53 | +- **Certified profiles** (`app.certified.actor.profile`): |
| 54 | + - Hypercerts-specific profiles with additional fields |
| 55 | + - Avatar/banner returned as PDS blob URLs (`https://pds.../xrpc/...`) |
| 56 | + - **`getCertifiedProfile()` returns `null` if profile doesn't exist** (not an error - common for new users) |
| 57 | + - Supports `pronouns` field (max 20 graphemes) |
| 58 | + - Supports `website` field |
| 59 | + - Images stored using `HypercertImageRecord` format internally (smallImage/largeImage wrappers) |
| 60 | + |
| 61 | +- **Upsert methods** (Recommended for most use cases): |
| 62 | + - `upsertBskyProfile(params)` - Automatically creates or updates Bluesky profile |
| 63 | + - `upsertCertifiedProfile(params)` - Automatically creates or updates Certified profile |
| 64 | + - Simpler DX - no need to check if profile exists first |
| 65 | + - Perfect for "save profile" operations |
| 66 | + |
| 67 | +- **New types:** |
| 68 | + - `BskyProfile` - Type for Bluesky profiles (alias for `AppBskyActorDefs.ProfileViewDetailed`) |
| 69 | + - `CertifiedProfile` - Type for Certified profiles |
| 70 | + - `CertifiedProfileRecord` - Record type for Certified profiles (replaces `HypercertProfile`) |
| 71 | + - `CreateBskyProfileParams`, `UpdateBskyProfileParams` |
| 72 | + - `CreateCertifiedProfileParams`, `UpdateCertifiedProfileParams` (replace `CreateHypercertProfileParams`, |
| 73 | + `UpdateHypercertProfileParams`) |
| 74 | + |
| 75 | +**Migration Guide:** |
| 76 | + |
| 77 | +```typescript |
| 78 | +// BEFORE (old API - removed) |
| 79 | +const profile = await repo.profile.get(); |
| 80 | +await repo.profile.create({ displayName: "Alice" }); |
| 81 | +await repo.profile.update({ displayName: "New Name" }); |
| 82 | + |
| 83 | +// AFTER - Recommended: Use upsert (works for both create and update) |
| 84 | +await repo.profile.upsertCertifiedProfile({ |
| 85 | + displayName: "Alice", |
| 86 | + pronouns: "she/her", |
| 87 | + website: "https://alice.com", |
| 88 | +}); |
| 89 | + |
| 90 | +// AFTER - Advanced: Explicit create/update for fine control |
| 91 | +const certProfile = await repo.profile.getCertifiedProfile(); |
| 92 | +if (!certProfile) { |
| 93 | + await repo.profile.createCertifiedProfile({ |
| 94 | + displayName: "Alice", |
| 95 | + pronouns: "she/her", |
| 96 | + }); |
| 97 | +} else { |
| 98 | + await repo.profile.updateCertifiedProfile({ |
| 99 | + displayName: "New Name", |
| 100 | + }); |
| 101 | +} |
| 102 | + |
| 103 | +// Getting profiles - handle null case |
| 104 | +const profile = await repo.profile.getCertifiedProfile(); |
| 105 | +if (profile) { |
| 106 | + console.log(profile.displayName); |
| 107 | +} else { |
| 108 | + console.log("User hasn't created a profile yet"); |
| 109 | +} |
| 110 | + |
| 111 | +// Type migrations |
| 112 | +import type { |
| 113 | + CertifiedProfileRecord, // was: HypercertProfile |
| 114 | + CreateCertifiedProfileParams, // was: CreateHypercertProfileParams |
| 115 | + UpdateCertifiedProfileParams, // was: UpdateHypercertProfileParams |
| 116 | +} from "@hypercerts-org/sdk-core/types"; |
| 117 | +``` |
| 118 | + |
| 119 | +**React SDK (`@hypercerts-org/sdk-react`):** |
| 120 | + |
| 121 | +**Breaking Changes:** |
| 122 | + |
| 123 | +- `useProfile` hook renamed `update` to `save` and `isUpdating` to `isSaving` |
| 124 | +- `save()` now uses upsert internally - works for first-time profile creation too |
| 125 | + |
| 126 | +```typescript |
| 127 | +// BEFORE |
| 128 | +const { update, isUpdating } = useProfile(); |
| 129 | +await update({ displayName: "Alice" }); |
| 130 | + |
| 131 | +// AFTER |
| 132 | +const { save, isSaving } = useProfile(); |
| 133 | +await save({ displayName: "Alice" }); // Works even if profile doesn't exist! |
| 134 | +``` |
0 commit comments