|
1 | 1 | /** |
2 | 2 | * Hypercerts SDK - Main entrypoint. |
3 | 3 | * |
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 | | - * |
52 | 4 | * @packageDocumentation |
53 | 5 | */ |
54 | 6 |
|
@@ -87,43 +39,53 @@ export type { |
87 | 39 | export { LexiconRegistry } from "./repository/LexiconRegistry.js"; |
88 | 40 | export type { ValidationResult } from "./repository/LexiconRegistry.js"; |
89 | 41 |
|
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 |
91 | 72 | 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 |
100 | 83 | HypercertEvidence, |
101 | 84 | HypercertImage, |
102 | 85 | BlobRef, |
103 | 86 | HypercertWithMetadata, |
104 | 87 | } from "./services/hypercerts/types.js"; |
105 | 88 |
|
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 | | - |
127 | 89 | // Errors |
128 | 90 | export { |
129 | 91 | ATProtoSDKError, |
|
0 commit comments