@hypercerts-org/sdk-core 0.10.0-beta.0 → 0.10.0-beta.2
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.
- package/CHANGELOG.md +281 -0
- package/README.md +97 -114
- package/dist/index.cjs +435 -534
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +160 -271
- package/dist/index.mjs +387 -499
- package/dist/index.mjs.map +1 -1
- package/dist/lexicons.cjs +103 -374
- package/dist/lexicons.cjs.map +1 -1
- package/dist/lexicons.d.ts +90 -188
- package/dist/lexicons.mjs +103 -367
- package/dist/lexicons.mjs.map +1 -1
- package/dist/types.cjs +6 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +24 -37
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -1
- package/package.json +10 -9
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# @hypercerts-org/sdk-core
|
|
2
|
+
|
|
3
|
+
## 0.10.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#71](https://github.com/hypercerts-org/hypercerts-sdk/pull/71)
|
|
8
|
+
[`10bc42d`](https://github.com/hypercerts-org/hypercerts-sdk/commit/10bc42de46f1a391f47de9d0af486f00b6edde08) Thanks
|
|
9
|
+
[@aspiers](https://github.com/aspiers)! - Fix errant versions in CHANGELOG.md files
|
|
10
|
+
|
|
11
|
+
## 0.10.0-beta.1
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#66](https://github.com/hypercerts-org/hypercerts-sdk/pull/66)
|
|
16
|
+
[`7c33673`](https://github.com/hypercerts-org/hypercerts-sdk/commit/7c33673fd5f53d92ba160ced1d1582178fa7c455) Thanks
|
|
17
|
+
[@aspiers](https://github.com/aspiers)! - feat: migrate to published @hypercerts-org/lexicon package
|
|
18
|
+
|
|
19
|
+
This release migrates the SDK from using a local `packages/lexicon` workspace to consuming the published
|
|
20
|
+
`@hypercerts-org/lexicon` package from npm.
|
|
21
|
+
|
|
22
|
+
**Benefits:**
|
|
23
|
+
- **Single source of truth**: Lexicon definitions now come from a dedicated, independently versioned package
|
|
24
|
+
- **Reduced codebase**: Removes ~3,000 lines of duplicated lexicon code from this repository
|
|
25
|
+
- **Better versioning**: Lexicon can be updated independently via semver dependency updates
|
|
26
|
+
- **Simplified architecture**: No longer maintaining duplicate lexicon tooling in monorepo
|
|
27
|
+
- **Improved maintainability**: Clearer separation of concerns between SDK and lexicon definitions
|
|
28
|
+
|
|
29
|
+
**Breaking Changes:**
|
|
30
|
+
1. **Removed `LexiconRegistry` class**: Use the `validate()` function instead
|
|
31
|
+
2. **Removed `ValidationResult` type**: Validation functions now throw errors on validation failure
|
|
32
|
+
3. **Renamed type exports** to match lexicon package conventions:
|
|
33
|
+
- `OrgHypercertsClaim` → `OrgHypercertsClaimActivity`
|
|
34
|
+
- `OrgHypercertsCollection` → `OrgHypercertsClaimCollection`
|
|
35
|
+
4. **Renamed constant exports** to use consistent naming:
|
|
36
|
+
- `schemas` → `HYPERCERTS_SCHEMAS`
|
|
37
|
+
- `schemaDict` → `HYPERCERTS_SCHEMA_DICT`
|
|
38
|
+
- `ids` → `HYPERCERTS_NSIDS`
|
|
39
|
+
- `lexicons` now exported as type-only (use `HYPERCERTS_LEXICON_JSON` or `HYPERCERTS_LEXICON_DOC` for runtime
|
|
40
|
+
values)
|
|
41
|
+
|
|
42
|
+
**Migration Guide:**
|
|
43
|
+
|
|
44
|
+
**Validation:**
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// Before
|
|
48
|
+
import { LexiconRegistry, HYPERCERT_LEXICONS, HYPERCERT_COLLECTIONS } from "@hypercerts-org/sdk-core";
|
|
49
|
+
const registry = new LexiconRegistry();
|
|
50
|
+
registry.registerLexicons(HYPERCERT_LEXICONS);
|
|
51
|
+
const result = registry.validate(HYPERCERT_COLLECTIONS.CLAIM, claimData);
|
|
52
|
+
if (!result.valid) {
|
|
53
|
+
console.error("Invalid record:", result.error);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// After
|
|
57
|
+
import { validate, HYPERCERT_COLLECTIONS } from "@hypercerts-org/sdk-core";
|
|
58
|
+
try {
|
|
59
|
+
validate(HYPERCERT_COLLECTIONS.CLAIM, claimData);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error("Invalid record:", error);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Type imports:**
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// Before
|
|
69
|
+
import { OrgHypercertsClaim, OrgHypercertsCollection } from "@hypercerts-org/sdk-core";
|
|
70
|
+
|
|
71
|
+
// After
|
|
72
|
+
import { OrgHypercertsClaimActivity, OrgHypercertsClaimCollection } from "@hypercerts-org/sdk-core";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Constant imports:**
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Before
|
|
79
|
+
import { schemas, schemaDict, ids } from "@hypercerts-org/sdk-core";
|
|
80
|
+
|
|
81
|
+
// After
|
|
82
|
+
import { HYPERCERTS_SCHEMAS, HYPERCERTS_SCHEMA_DICT, HYPERCERTS_NSIDS } from "@hypercerts-org/sdk-core";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Other Changes:**
|
|
86
|
+
- Added dependency on `@hypercerts-org/lexicon@0.10.0-beta.3`
|
|
87
|
+
- Updated all lexicon type exports to use namespaced imports from lexicon package
|
|
88
|
+
- Improved hypercert validation with new test coverage
|
|
89
|
+
- Enhanced test mocks and fixtures for better testability
|
|
90
|
+
|
|
91
|
+
**For SDK users**: If you're using `LexiconRegistry`, follow the migration guide above. If you're only using the
|
|
92
|
+
high-level Repository API, no changes are required.
|
|
93
|
+
|
|
94
|
+
### Minor Changes
|
|
95
|
+
|
|
96
|
+
- [#60](https://github.com/hypercerts-org/hypercerts-sdk/pull/60)
|
|
97
|
+
[`f7594f8`](https://github.com/hypercerts-org/hypercerts-sdk/commit/f7594f838fd7e64837da702f7498e84a49b28bf5) Thanks
|
|
98
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Implement ConfigurableAgent for proper multi-server routing
|
|
99
|
+
|
|
100
|
+
This release introduces the `ConfigurableAgent` class that enables proper routing of AT Protocol requests to different
|
|
101
|
+
servers (PDS, SDS, or custom instances) while maintaining OAuth authentication from a single session.
|
|
102
|
+
|
|
103
|
+
**Breaking Changes:**
|
|
104
|
+
- Repository now uses `ConfigurableAgent` internally instead of standard `Agent`
|
|
105
|
+
- This fixes the issue where invalid `agent.service` and `agent.api.xrpc.uri` property assignments were causing
|
|
106
|
+
TypeScript errors
|
|
107
|
+
|
|
108
|
+
**New Features:**
|
|
109
|
+
- `ConfigurableAgent` class exported from `@hypercerts-org/sdk-core`
|
|
110
|
+
- Support for simultaneous connections to multiple SDS instances with one OAuth session
|
|
111
|
+
- Proper request routing based on configured service URL rather than session defaults
|
|
112
|
+
|
|
113
|
+
**Bug Fixes:**
|
|
114
|
+
- Remove invalid Agent property assignments that caused TypeScript compilation errors (TS2339)
|
|
115
|
+
- Replace all `any` types in test files with proper type annotations
|
|
116
|
+
- Eliminate build warnings from missing type declarations
|
|
117
|
+
|
|
118
|
+
**Architecture:** The new routing system wraps the OAuth session's fetch handler to prepend the target server URL,
|
|
119
|
+
ensuring requests go to the intended destination while maintaining full authentication (DPoP, access tokens, etc.).
|
|
120
|
+
This enables use cases like:
|
|
121
|
+
- Routing to SDS while authenticated via PDS
|
|
122
|
+
- Accessing multiple organization SDS instances simultaneously
|
|
123
|
+
- Testing against different server environments
|
|
124
|
+
- Dynamic switching between PDS and SDS operations
|
|
125
|
+
|
|
126
|
+
**Migration:** No action required - the change is transparent to existing code. The Repository API remains unchanged.
|
|
127
|
+
|
|
128
|
+
- [#46](https://github.com/hypercerts-org/hypercerts-sdk/pull/46)
|
|
129
|
+
[`eda4ac2`](https://github.com/hypercerts-org/hypercerts-sdk/commit/eda4ac233e09764d83f042ba7df94d4c9884cc01) Thanks
|
|
130
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Initial release of sdk-core package with ATProto SDK for
|
|
131
|
+
authentication, repository operations, and lexicon management
|
|
132
|
+
|
|
133
|
+
- [#65](https://github.com/hypercerts-org/hypercerts-sdk/pull/65)
|
|
134
|
+
[`826b50c`](https://github.com/hypercerts-org/hypercerts-sdk/commit/826b50c140a56fee4feeb6b6c83d1123e44c5118) Thanks
|
|
135
|
+
[@bitbeckers](https://github.com/bitbeckers)! - feat(auth): add OAuth scopes and granular permissions system
|
|
136
|
+
|
|
137
|
+
Add comprehensive OAuth permissions system with support for granular permissions and easy email access:
|
|
138
|
+
|
|
139
|
+
**Permission System**
|
|
140
|
+
- Zod schemas for all ATProto permission types (account, repo, blob, rpc, identity, include)
|
|
141
|
+
- Support for both transitional (legacy) and granular permission models
|
|
142
|
+
- Type-safe permission builder with fluent API
|
|
143
|
+
- 14 pre-built scope presets (EMAIL_READ, POSTING_APP, FULL_ACCESS, etc.)
|
|
144
|
+
- 8 utility functions for working with scopes
|
|
145
|
+
|
|
146
|
+
**Email Access**
|
|
147
|
+
- New `getAccountEmail()` method to retrieve user email from authenticated session
|
|
148
|
+
- Returns null when permission not granted
|
|
149
|
+
- Comprehensive error handling
|
|
150
|
+
|
|
151
|
+
**Enhanced OAuth Integration**
|
|
152
|
+
- Automatic scope validation with helpful warnings
|
|
153
|
+
- Migration suggestions from transitional to granular permissions
|
|
154
|
+
- Improved documentation with comprehensive examples
|
|
155
|
+
|
|
156
|
+
**Breaking Changes**: None - fully backward compatible
|
|
157
|
+
|
|
158
|
+
**New Exports**:
|
|
159
|
+
- `PermissionBuilder` - Fluent API for building type-safe scopes
|
|
160
|
+
- `ScopePresets` - 14 ready-to-use permission presets
|
|
161
|
+
- Utility functions: `buildScope()`, `parseScope()`, `hasPermission()`, `validateScope()`, etc.
|
|
162
|
+
- Permission schemas and types for TypeScript consumers
|
|
163
|
+
|
|
164
|
+
See README for usage examples and migration guide.
|
|
165
|
+
|
|
166
|
+
- [#56](https://github.com/hypercerts-org/hypercerts-sdk/pull/56)
|
|
167
|
+
[`caceacb`](https://github.com/hypercerts-org/hypercerts-sdk/commit/caceacbc5572a590c750a95ccfda23fff2dd0c61) Thanks
|
|
168
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Add pagination support and fix React hooks for SDS operations
|
|
169
|
+
|
|
170
|
+
**Breaking Changes (sdk-core):**
|
|
171
|
+
- `CollaboratorOperations.list()` now returns `{ collaborators: RepositoryAccessGrant[], cursor?: string }` instead of
|
|
172
|
+
`RepositoryAccessGrant[]`
|
|
173
|
+
- `OrganizationOperations.list()` now returns `{ organizations: OrganizationInfo[], cursor?: string }` instead of
|
|
174
|
+
`OrganizationInfo[]`
|
|
175
|
+
|
|
176
|
+
**Features:**
|
|
177
|
+
- Add cursor-based pagination support to collaborator and organization list operations
|
|
178
|
+
- Support optional `limit` and `cursor` parameters for paginated queries
|
|
179
|
+
- Update internal methods (`hasAccess`, `getRole`, `get`) to handle new pagination structure
|
|
180
|
+
|
|
181
|
+
**Bug Fixes (sdk-core):**
|
|
182
|
+
- Fix permissions parsing in `CollaboratorOperationsImpl.list()` to match actual SDS API format (object with boolean
|
|
183
|
+
flags)
|
|
184
|
+
- Prevent `TypeError: permissionArray.includes is not a function` by correctly handling permissions as objects
|
|
185
|
+
- Fix Agent service URL configuration to route queries to the correct server (PDS or SDS)
|
|
186
|
+
- Resolve "Could not find repo" errors when querying SDS repositories by ensuring Agent uses SDS service endpoint
|
|
187
|
+
- Update test mocks to use the actual SDS API response format
|
|
188
|
+
|
|
189
|
+
**Bug Fixes (sdk-react):**
|
|
190
|
+
- Fix `useCollaborators` hook to correctly destructure paginated response
|
|
191
|
+
- Fix `useOrganizations` hook to correctly destructure paginated response
|
|
192
|
+
- All React hooks now properly handle the new pagination structure
|
|
193
|
+
|
|
194
|
+
**Documentation:**
|
|
195
|
+
- Comprehensive README updates with clear examples for all SDK operations
|
|
196
|
+
- Added pagination examples throughout documentation
|
|
197
|
+
- Improved code samples with realistic use cases
|
|
198
|
+
|
|
199
|
+
**Tests:**
|
|
200
|
+
- All 317 tests passing (181 sdk-core + 136 sdk-react)
|
|
201
|
+
- Updated test mocks to match new pagination response structure
|
|
202
|
+
- Build completes with zero warnings
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- [#58](https://github.com/hypercerts-org/hypercerts-sdk/pull/58)
|
|
207
|
+
[`bcde5fa`](https://github.com/hypercerts-org/hypercerts-sdk/commit/bcde5faeb11dba6d99967a434e8ec32d67b3aca5) Thanks
|
|
208
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Fix collaborator permissions parsing to align with SDS API response
|
|
209
|
+
format. The SDS API returns permissions as objects with boolean flags (`{ read: true, create: true, ... }`) rather
|
|
210
|
+
than string arrays. This fix simplifies the permissions parser to handle only the actual format returned by the API.
|
|
211
|
+
|
|
212
|
+
- [#64](https://github.com/hypercerts-org/hypercerts-sdk/pull/64)
|
|
213
|
+
[`f83f03a`](https://github.com/hypercerts-org/hypercerts-sdk/commit/f83f03a8e505d57d38b45f3a50213ca1035c1229) Thanks
|
|
214
|
+
[@bitbeckers](https://github.com/bitbeckers)! - fix(lexicon): correct field names and types to match lexicon schema
|
|
215
|
+
- Fix `workTimeframeFrom/To` -> `workTimeFrameFrom/To` (capital 'F' in Frame)
|
|
216
|
+
- Make `shortDescription` required for hypercert claims per lexicon schema
|
|
217
|
+
- Update all interfaces, implementations, and tests to use correct field names
|
|
218
|
+
- Add comprehensive lexicon documentation to README
|
|
219
|
+
|
|
220
|
+
- [#62](https://github.com/hypercerts-org/hypercerts-sdk/pull/62)
|
|
221
|
+
[`4b80edc`](https://github.com/hypercerts-org/hypercerts-sdk/commit/4b80edca4162c4ce929edb28ffffa3f99f21cb74) Thanks
|
|
222
|
+
[@bitbeckers](https://github.com/bitbeckers)! - fix(sdk-core): add required $type field to all record creation
|
|
223
|
+
operations
|
|
224
|
+
|
|
225
|
+
The AT Protocol requires all records to include a `$type` field, but the SDK was omitting it during record creation,
|
|
226
|
+
causing validation errors like "Record/$type must be a string". This fix:
|
|
227
|
+
- Adds `$type` field to all record types (rights, claims, locations, contributions, measurements, evaluations,
|
|
228
|
+
collections)
|
|
229
|
+
- Fixes location record implementation to match `app.certified.location` lexicon schema
|
|
230
|
+
- Makes `srs` (Spatial Reference System) field required for location records with proper validation
|
|
231
|
+
- Updates interfaces and documentation to reflect required fields
|
|
232
|
+
|
|
233
|
+
Breaking change: `location.srs` is now required when creating locations (use "EPSG:4326" for standard WGS84
|
|
234
|
+
coordinates).
|
|
235
|
+
|
|
236
|
+
- [#59](https://github.com/hypercerts-org/hypercerts-sdk/pull/59)
|
|
237
|
+
[`7020fcc`](https://github.com/hypercerts-org/hypercerts-sdk/commit/7020fcc9845a4d4c2f792536611fc3bb5e3c4fe3) Thanks
|
|
238
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Configure npm publishing to exclude source code and development files.
|
|
239
|
+
Packages now only include the compiled `dist/` folder, README, and necessary runtime files (lexicon schemas). This
|
|
240
|
+
reduces package sizes and prevents unnecessary files from being published to npm.
|
|
241
|
+
|
|
242
|
+
- [#60](https://github.com/hypercerts-org/hypercerts-sdk/pull/60)
|
|
243
|
+
[`39accd9`](https://github.com/hypercerts-org/hypercerts-sdk/commit/39accd954422c901b7faf93e08be88e68a4f849a) Thanks
|
|
244
|
+
[@bitbeckers](https://github.com/bitbeckers)! - fix(sdk-core): ensure repository operations route to correct server
|
|
245
|
+
(PDS/SDS)
|
|
246
|
+
|
|
247
|
+
**Problem:** When using OAuth authentication to access organization repositories on SDS via
|
|
248
|
+
`repo.repo(organizationDid)`, all operations like `hypercerts.list()` and `hypercerts.listCollections()` were
|
|
249
|
+
incorrectly routing to the user's PDS instead of the SDS server, causing "Could not find repo" errors.
|
|
250
|
+
|
|
251
|
+
**Root Cause:** The AT Protocol Agent was created from the OAuth session but only had its `api.xrpc.uri` property
|
|
252
|
+
configured. Without setting the Agent's `service` property, it continued using the session's default PDS URL for all
|
|
253
|
+
requests, even when switched to organization repositories.
|
|
254
|
+
|
|
255
|
+
**Solution:** Set both `agent.service` and `agent.api.xrpc.uri` to the specified server URL in the Repository
|
|
256
|
+
constructor. This ensures that:
|
|
257
|
+
- Initial repository creation routes to the correct server (PDS or SDS)
|
|
258
|
+
- Repository switching via `.repo(did)` maintains the same server routing
|
|
259
|
+
- All operation implementations (HypercertOperationsImpl, RecordOperationsImpl, ProfileOperationsImpl,
|
|
260
|
+
BlobOperationsImpl) now route correctly
|
|
261
|
+
|
|
262
|
+
**Documentation:** Added comprehensive PDS/SDS orchestration explanation to README covering:
|
|
263
|
+
- Server type comparison and use cases
|
|
264
|
+
- How repository routing works internally
|
|
265
|
+
- Common patterns for personal vs organization hypercerts
|
|
266
|
+
- Key implementation details about Agent configuration
|
|
267
|
+
|
|
268
|
+
- [#56](https://github.com/hypercerts-org/hypercerts-sdk/pull/56)
|
|
269
|
+
[`cb3268d`](https://github.com/hypercerts-org/hypercerts-sdk/commit/cb3268d78614efaf15aecc57a5dc3bce8313f3ca) Thanks
|
|
270
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Fix SDS organization and collaborator operations to match API
|
|
271
|
+
contracts
|
|
272
|
+
- Add required creatorDid parameter to organization.create endpoint
|
|
273
|
+
- Fix organization.list to parse organizations field instead of repositories
|
|
274
|
+
- Update accessType values to match SDS API: owner|shared|none (was owner|collaborator)
|
|
275
|
+
- Add permission string array parser for collaborator.list endpoint
|
|
276
|
+
- Update type definitions to match actual SDS API response formats
|
|
277
|
+
|
|
278
|
+
- [#55](https://github.com/hypercerts-org/hypercerts-sdk/pull/55)
|
|
279
|
+
[`23c3d9a`](https://github.com/hypercerts-org/hypercerts-sdk/commit/23c3d9a3b71f326df68b65420c83f7ae42c2432d) Thanks
|
|
280
|
+
[@bitbeckers](https://github.com/bitbeckers)! - Fix endpoints and NSIDs for SDS operations in CollaboratorOperations
|
|
281
|
+
and OrganizationOperations
|