Skip to content

Commit 9456cdf

Browse files
committed
feat(lexicon): update core sdk package to use lexicon package instead of files
1 parent 2ca1cd0 commit 9456cdf

File tree

9 files changed

+168
-1267
lines changed

9 files changed

+168
-1267
lines changed

packages/sdk-core/src/index.ts

Lines changed: 40 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,6 @@
11
/**
22
* Hypercerts SDK - Main entrypoint.
33
*
4-
* This is the primary entry point for the `@hypercerts-org/sdk` package.
5-
* It exports all public APIs needed to work with hypercerts on the
6-
* AT Protocol.
7-
*
8-
* @remarks
9-
* **Quick Start**:
10-
* ```typescript
11-
* import { ATProtoSDK } from "@hypercerts-org/sdk";
12-
*
13-
* const sdk = new ATProtoSDK({
14-
* oauth: {
15-
* clientId: "https://my-app.com/client-metadata.json",
16-
* redirectUri: "https://my-app.com/callback",
17-
* scope: "atproto transition:generic",
18-
* jwksUri: "https://my-app.com/.well-known/jwks.json",
19-
* jwkPrivate: process.env.JWK_PRIVATE_KEY!,
20-
* },
21-
* servers: {
22-
* pds: "https://bsky.social",
23-
* sds: "https://sds.hypercerts.org",
24-
* },
25-
* });
26-
*
27-
* // Start OAuth flow
28-
* const authUrl = await sdk.authorize("user.bsky.social");
29-
*
30-
* // After callback
31-
* const session = await sdk.callback(params);
32-
* const repo = sdk.repository(session);
33-
*
34-
* // Create a hypercert
35-
* const result = await repo.hypercerts.create({
36-
* title: "My Impact",
37-
* description: "...",
38-
* workScope: "Climate",
39-
* workTimeframeFrom: "2024-01-01",
40-
* workTimeframeTo: "2024-12-31",
41-
* rights: { name: "CC-BY", type: "license", description: "..." },
42-
* });
43-
* ```
44-
*
45-
* **Sub-entrypoints**:
46-
* - `@hypercerts-org/sdk/types` - TypeScript types only
47-
* - `@hypercerts-org/sdk/errors` - Error classes
48-
* - `@hypercerts-org/sdk/lexicons` - Lexicon registry and constants
49-
* - `@hypercerts-org/sdk/storage` - Storage implementations
50-
* - `@hypercerts-org/sdk/testing` - Test utilities
51-
*
524
* @packageDocumentation
535
*/
546

@@ -87,43 +39,53 @@ export type {
8739
export { LexiconRegistry } from "./repository/LexiconRegistry.js";
8840
export type { ValidationResult } from "./repository/LexiconRegistry.js";
8941

90-
// Hypercert types
42+
// ============================================================================
43+
// Lexicon Types and Validation (from @hypercerts-org/lexicon)
44+
// ============================================================================
45+
46+
// Namespaced types with validation functions (isRecord, validateRecord)
47+
export {
48+
OrgHypercertsClaim,
49+
OrgHypercertsClaimRights,
50+
OrgHypercertsClaimContribution,
51+
OrgHypercertsClaimMeasurement,
52+
OrgHypercertsClaimEvaluation,
53+
OrgHypercertsClaimEvidence,
54+
OrgHypercertsCollection,
55+
AppCertifiedLocation,
56+
ComAtprotoRepoStrongRef,
57+
// Validation utilities
58+
validate,
59+
schemas,
60+
schemaDict,
61+
lexicons,
62+
ids,
63+
// Lexicon constants
64+
HYPERCERT_LEXICONS,
65+
HYPERCERT_COLLECTIONS,
66+
} from "./services/hypercerts/types.js";
67+
68+
// Type-only exports
69+
export type { AppCertifiedDefs } from "./services/hypercerts/types.js";
70+
71+
// Type aliases for generated lexicon types
9172
export type {
92-
HypercertRecord,
93-
RightsRecord,
94-
LocationRecord,
95-
ContributionRecord,
96-
MeasurementRecord,
97-
EvaluationRecord,
98-
CollectionRecord,
99-
CollectionClaimItem,
73+
StrongRef,
74+
HypercertClaim,
75+
HypercertRights,
76+
HypercertContribution,
77+
HypercertMeasurement,
78+
HypercertEvaluation,
79+
HypercertCollection,
80+
HypercertCollectionClaimItem,
81+
HypercertLocation,
82+
// SDK-specific types
10083
HypercertEvidence,
10184
HypercertImage,
10285
BlobRef,
10386
HypercertWithMetadata,
10487
} from "./services/hypercerts/types.js";
10588

106-
// Hypercert Zod schemas (for runtime validation)
107-
export {
108-
HypercertRecordSchema,
109-
RightsRecordSchema,
110-
LocationRecordSchema,
111-
ContributionRecordSchema,
112-
MeasurementRecordSchema,
113-
EvaluationRecordSchema,
114-
CollectionRecordSchema,
115-
StrongRefSchema,
116-
BlobRefSchema,
117-
HypercertEvidenceSchema,
118-
parseHypercertRecord,
119-
parseCollectionRecord,
120-
safeParseHypercertRecord,
121-
safeParseCollectionRecord,
122-
} from "./services/hypercerts/schemas.js";
123-
124-
// Lexicon constants
125-
export { HYPERCERT_LEXICONS, HYPERCERT_COLLECTIONS } from "./lexicons/hypercerts/index.js";
126-
12789
// Errors
12890
export {
12991
ATProtoSDKError,

packages/sdk-core/src/lexicons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@
6161
export { LexiconRegistry } from "./repository/LexiconRegistry.js";
6262
export type { ValidationResult } from "./repository/LexiconRegistry.js";
6363

64-
export { HYPERCERT_LEXICONS, HYPERCERT_COLLECTIONS } from "./lexicons/hypercerts/index.js";
64+
export { HYPERCERT_LEXICONS, HYPERCERT_COLLECTIONS } from "@hypercerts-org/lexicon";

packages/sdk-core/src/lexicons/hypercerts/index.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)