@hypercerts-org/sdk-core 0.10.0-beta.0 → 0.10.0-beta.1
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 +273 -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/dist/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var oauthClientNode = require('@atproto/oauth-client-node');
|
|
4
4
|
var zod = require('zod');
|
|
5
|
-
var lexicon$1 = require('@atproto/lexicon');
|
|
6
|
-
var lexicon = require('@hypercerts-org/lexicon');
|
|
7
5
|
var api = require('@atproto/api');
|
|
8
6
|
var eventemitter3 = require('eventemitter3');
|
|
7
|
+
var lexicon = require('@hypercerts-org/lexicon');
|
|
8
|
+
require('@atproto/lexicon');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Base error class for all SDK errors.
|
|
@@ -2004,303 +2004,6 @@ class OAuthClient {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
|
-
/**
|
|
2008
|
-
* Registry for managing and validating AT Protocol lexicon schemas.
|
|
2009
|
-
*
|
|
2010
|
-
* Lexicons are schema definitions that describe the structure of records
|
|
2011
|
-
* in the AT Protocol. This registry allows you to:
|
|
2012
|
-
*
|
|
2013
|
-
* - Register custom lexicons for your application's record types
|
|
2014
|
-
* - Validate records against their lexicon schemas
|
|
2015
|
-
* - Extend the AT Protocol Agent with custom lexicon support
|
|
2016
|
-
*
|
|
2017
|
-
* @remarks
|
|
2018
|
-
* The SDK automatically registers hypercert lexicons when creating a Repository.
|
|
2019
|
-
* You only need to use this class directly if you're working with custom
|
|
2020
|
-
* record types.
|
|
2021
|
-
*
|
|
2022
|
-
* **Lexicon IDs** follow the NSID (Namespaced Identifier) format:
|
|
2023
|
-
* `{authority}.{name}` (e.g., `org.hypercerts.hypercert`)
|
|
2024
|
-
*
|
|
2025
|
-
* @example Registering custom lexicons
|
|
2026
|
-
* ```typescript
|
|
2027
|
-
* const registry = sdk.getLexiconRegistry();
|
|
2028
|
-
*
|
|
2029
|
-
* // Register a single lexicon
|
|
2030
|
-
* registry.register({
|
|
2031
|
-
* lexicon: 1,
|
|
2032
|
-
* id: "org.example.myRecord",
|
|
2033
|
-
* defs: {
|
|
2034
|
-
* main: {
|
|
2035
|
-
* type: "record",
|
|
2036
|
-
* key: "tid",
|
|
2037
|
-
* record: {
|
|
2038
|
-
* type: "object",
|
|
2039
|
-
* required: ["title", "createdAt"],
|
|
2040
|
-
* properties: {
|
|
2041
|
-
* title: { type: "string" },
|
|
2042
|
-
* description: { type: "string" },
|
|
2043
|
-
* createdAt: { type: "string", format: "datetime" },
|
|
2044
|
-
* },
|
|
2045
|
-
* },
|
|
2046
|
-
* },
|
|
2047
|
-
* },
|
|
2048
|
-
* });
|
|
2049
|
-
*
|
|
2050
|
-
* // Register multiple lexicons at once
|
|
2051
|
-
* registry.registerMany([lexicon1, lexicon2, lexicon3]);
|
|
2052
|
-
* ```
|
|
2053
|
-
*
|
|
2054
|
-
* @example Validating records
|
|
2055
|
-
* ```typescript
|
|
2056
|
-
* const result = registry.validate("org.example.myRecord", {
|
|
2057
|
-
* title: "Test",
|
|
2058
|
-
* createdAt: new Date().toISOString(),
|
|
2059
|
-
* });
|
|
2060
|
-
*
|
|
2061
|
-
* if (!result.valid) {
|
|
2062
|
-
* console.error(`Validation failed: ${result.error}`);
|
|
2063
|
-
* }
|
|
2064
|
-
* ```
|
|
2065
|
-
*
|
|
2066
|
-
* @see https://atproto.com/specs/lexicon for the Lexicon specification
|
|
2067
|
-
*/
|
|
2068
|
-
class LexiconRegistry {
|
|
2069
|
-
/**
|
|
2070
|
-
* Creates a new LexiconRegistry.
|
|
2071
|
-
*
|
|
2072
|
-
* The registry starts empty. Use {@link register} or {@link registerMany}
|
|
2073
|
-
* to add lexicons.
|
|
2074
|
-
*/
|
|
2075
|
-
constructor() {
|
|
2076
|
-
/** Map of lexicon ID to lexicon document */
|
|
2077
|
-
this.lexicons = new Map();
|
|
2078
|
-
this.lexiconsCollection = new lexicon$1.Lexicons();
|
|
2079
|
-
}
|
|
2080
|
-
/**
|
|
2081
|
-
* Registers a single lexicon schema.
|
|
2082
|
-
*
|
|
2083
|
-
* @param lexicon - The lexicon document to register
|
|
2084
|
-
* @throws {@link ValidationError} if the lexicon doesn't have an `id` field
|
|
2085
|
-
*
|
|
2086
|
-
* @remarks
|
|
2087
|
-
* If a lexicon with the same ID is already registered, it will be
|
|
2088
|
-
* replaced with the new definition. This is useful for testing but
|
|
2089
|
-
* should generally be avoided in production.
|
|
2090
|
-
*
|
|
2091
|
-
* @example
|
|
2092
|
-
* ```typescript
|
|
2093
|
-
* registry.register({
|
|
2094
|
-
* lexicon: 1,
|
|
2095
|
-
* id: "org.example.post",
|
|
2096
|
-
* defs: {
|
|
2097
|
-
* main: {
|
|
2098
|
-
* type: "record",
|
|
2099
|
-
* key: "tid",
|
|
2100
|
-
* record: {
|
|
2101
|
-
* type: "object",
|
|
2102
|
-
* required: ["text", "createdAt"],
|
|
2103
|
-
* properties: {
|
|
2104
|
-
* text: { type: "string", maxLength: 300 },
|
|
2105
|
-
* createdAt: { type: "string", format: "datetime" },
|
|
2106
|
-
* },
|
|
2107
|
-
* },
|
|
2108
|
-
* },
|
|
2109
|
-
* },
|
|
2110
|
-
* });
|
|
2111
|
-
* ```
|
|
2112
|
-
*/
|
|
2113
|
-
register(lexicon) {
|
|
2114
|
-
if (!lexicon.id) {
|
|
2115
|
-
throw new ValidationError("Lexicon must have an 'id' field");
|
|
2116
|
-
}
|
|
2117
|
-
// Remove existing lexicon if present (to allow overwriting)
|
|
2118
|
-
if (this.lexicons.has(lexicon.id)) {
|
|
2119
|
-
// Lexicons collection doesn't support removal, so we create a new one
|
|
2120
|
-
// This is a limitation - in practice, lexicons shouldn't be overwritten
|
|
2121
|
-
// But we allow it for testing and flexibility
|
|
2122
|
-
const existingLexicon = this.lexicons.get(lexicon.id);
|
|
2123
|
-
if (existingLexicon) {
|
|
2124
|
-
// Try to remove from collection (may fail if not supported)
|
|
2125
|
-
try {
|
|
2126
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2127
|
-
this.lexiconsCollection.remove?.(lexicon.id);
|
|
2128
|
-
}
|
|
2129
|
-
catch {
|
|
2130
|
-
// If removal fails, create a new collection
|
|
2131
|
-
this.lexiconsCollection = new lexicon$1.Lexicons();
|
|
2132
|
-
// Re-register all other lexicons
|
|
2133
|
-
for (const [id, lex] of this.lexicons.entries()) {
|
|
2134
|
-
if (id !== lexicon.id) {
|
|
2135
|
-
this.lexiconsCollection.add(lex);
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
this.lexicons.set(lexicon.id, lexicon);
|
|
2142
|
-
this.lexiconsCollection.add(lexicon);
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* Registers multiple lexicons at once.
|
|
2146
|
-
*
|
|
2147
|
-
* @param lexicons - Array of lexicon documents to register
|
|
2148
|
-
*
|
|
2149
|
-
* @example
|
|
2150
|
-
* ```typescript
|
|
2151
|
-
* import { HYPERCERT_LEXICONS } from "@hypercerts-org/sdk/lexicons";
|
|
2152
|
-
*
|
|
2153
|
-
* registry.registerMany(HYPERCERT_LEXICONS);
|
|
2154
|
-
* ```
|
|
2155
|
-
*/
|
|
2156
|
-
registerMany(lexicons) {
|
|
2157
|
-
for (const lexicon of lexicons) {
|
|
2158
|
-
this.register(lexicon);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
/**
|
|
2162
|
-
* Gets a lexicon document by ID.
|
|
2163
|
-
*
|
|
2164
|
-
* @param id - The lexicon NSID (e.g., "org.hypercerts.hypercert")
|
|
2165
|
-
* @returns The lexicon document, or `undefined` if not registered
|
|
2166
|
-
*
|
|
2167
|
-
* @example
|
|
2168
|
-
* ```typescript
|
|
2169
|
-
* const lexicon = registry.get("org.hypercerts.hypercert");
|
|
2170
|
-
* if (lexicon) {
|
|
2171
|
-
* console.log(`Found lexicon: ${lexicon.id}`);
|
|
2172
|
-
* }
|
|
2173
|
-
* ```
|
|
2174
|
-
*/
|
|
2175
|
-
get(id) {
|
|
2176
|
-
return this.lexicons.get(id);
|
|
2177
|
-
}
|
|
2178
|
-
/**
|
|
2179
|
-
* Validates a record against a collection's lexicon schema.
|
|
2180
|
-
*
|
|
2181
|
-
* @param collection - The collection NSID (same as lexicon ID)
|
|
2182
|
-
* @param record - The record data to validate
|
|
2183
|
-
* @returns Validation result with `valid` boolean and optional `error` message
|
|
2184
|
-
*
|
|
2185
|
-
* @remarks
|
|
2186
|
-
* - If no lexicon is registered for the collection, validation passes
|
|
2187
|
-
* (we can't validate against unknown schemas)
|
|
2188
|
-
* - Validation checks required fields and type constraints defined
|
|
2189
|
-
* in the lexicon schema
|
|
2190
|
-
*
|
|
2191
|
-
* @example
|
|
2192
|
-
* ```typescript
|
|
2193
|
-
* const result = registry.validate("org.hypercerts.hypercert", {
|
|
2194
|
-
* title: "My Hypercert",
|
|
2195
|
-
* description: "Description...",
|
|
2196
|
-
* // ... other fields
|
|
2197
|
-
* });
|
|
2198
|
-
*
|
|
2199
|
-
* if (!result.valid) {
|
|
2200
|
-
* throw new Error(`Invalid record: ${result.error}`);
|
|
2201
|
-
* }
|
|
2202
|
-
* ```
|
|
2203
|
-
*/
|
|
2204
|
-
validate(collection, record) {
|
|
2205
|
-
// Check if we have a lexicon registered for this collection
|
|
2206
|
-
// Collection format is typically "namespace.collection" (e.g., "app.bsky.feed.post")
|
|
2207
|
-
// Lexicon ID format is the same
|
|
2208
|
-
const lexiconId = collection;
|
|
2209
|
-
const lexicon = this.lexicons.get(lexiconId);
|
|
2210
|
-
if (!lexicon) {
|
|
2211
|
-
// No lexicon registered - validation passes (can't validate unknown schemas)
|
|
2212
|
-
return { valid: true };
|
|
2213
|
-
}
|
|
2214
|
-
// Check required fields if the lexicon defines them
|
|
2215
|
-
const recordDef = lexicon.defs?.record;
|
|
2216
|
-
if (recordDef && typeof recordDef === "object" && "record" in recordDef) {
|
|
2217
|
-
const recordSchema = recordDef.record;
|
|
2218
|
-
if (typeof recordSchema === "object" && "required" in recordSchema && Array.isArray(recordSchema.required)) {
|
|
2219
|
-
const recordObj = record;
|
|
2220
|
-
for (const requiredField of recordSchema.required) {
|
|
2221
|
-
if (typeof requiredField === "string" && !(requiredField in recordObj)) {
|
|
2222
|
-
return {
|
|
2223
|
-
valid: false,
|
|
2224
|
-
error: `Missing required field: ${requiredField}`,
|
|
2225
|
-
};
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
try {
|
|
2231
|
-
this.lexiconsCollection.assertValidRecord(collection, record);
|
|
2232
|
-
return { valid: true };
|
|
2233
|
-
}
|
|
2234
|
-
catch (error) {
|
|
2235
|
-
// If error indicates lexicon not found, treat as validation pass
|
|
2236
|
-
// (the lexicon might exist in Agent's collection but not ours)
|
|
2237
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2238
|
-
if (errorMessage.includes("not found") || errorMessage.includes("Lexicon not found")) {
|
|
2239
|
-
return { valid: true };
|
|
2240
|
-
}
|
|
2241
|
-
return {
|
|
2242
|
-
valid: false,
|
|
2243
|
-
error: errorMessage,
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Adds all registered lexicons to an AT Protocol Agent instance.
|
|
2249
|
-
*
|
|
2250
|
-
* This allows the Agent to understand custom lexicon types when making
|
|
2251
|
-
* API requests.
|
|
2252
|
-
*
|
|
2253
|
-
* @param agent - The Agent instance to extend
|
|
2254
|
-
*
|
|
2255
|
-
* @remarks
|
|
2256
|
-
* This is called automatically when creating a Repository. You typically
|
|
2257
|
-
* don't need to call this directly unless you're using the Agent
|
|
2258
|
-
* independently.
|
|
2259
|
-
*
|
|
2260
|
-
* @internal
|
|
2261
|
-
*/
|
|
2262
|
-
addToAgent(agent) {
|
|
2263
|
-
// Access the internal lexicons collection and merge our lexicons
|
|
2264
|
-
// The Agent's lex property is a Lexicons instance
|
|
2265
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2266
|
-
const agentLex = agent.lex;
|
|
2267
|
-
// Add each registered lexicon to the agent
|
|
2268
|
-
for (const lexicon of this.lexicons.values()) {
|
|
2269
|
-
agentLex.add(lexicon);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
/**
|
|
2273
|
-
* Gets all registered lexicon IDs.
|
|
2274
|
-
*
|
|
2275
|
-
* @returns Array of lexicon NSIDs
|
|
2276
|
-
*
|
|
2277
|
-
* @example
|
|
2278
|
-
* ```typescript
|
|
2279
|
-
* const ids = registry.getRegisteredIds();
|
|
2280
|
-
* console.log(`Registered lexicons: ${ids.join(", ")}`);
|
|
2281
|
-
* ```
|
|
2282
|
-
*/
|
|
2283
|
-
getRegisteredIds() {
|
|
2284
|
-
return Array.from(this.lexicons.keys());
|
|
2285
|
-
}
|
|
2286
|
-
/**
|
|
2287
|
-
* Checks if a lexicon is registered.
|
|
2288
|
-
*
|
|
2289
|
-
* @param id - The lexicon NSID to check
|
|
2290
|
-
* @returns `true` if the lexicon is registered
|
|
2291
|
-
*
|
|
2292
|
-
* @example
|
|
2293
|
-
* ```typescript
|
|
2294
|
-
* if (registry.has("org.hypercerts.hypercert")) {
|
|
2295
|
-
* // Hypercert lexicon is available
|
|
2296
|
-
* }
|
|
2297
|
-
* ```
|
|
2298
|
-
*/
|
|
2299
|
-
has(id) {
|
|
2300
|
-
return this.lexicons.has(id);
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
2007
|
/**
|
|
2305
2008
|
* ConfigurableAgent - Agent with configurable service URL routing.
|
|
2306
2009
|
*
|
|
@@ -2429,14 +2132,12 @@ class RecordOperationsImpl {
|
|
|
2429
2132
|
*
|
|
2430
2133
|
* @param agent - AT Protocol Agent for making API calls
|
|
2431
2134
|
* @param repoDid - DID of the repository to operate on
|
|
2432
|
-
* @param lexiconRegistry - Registry for record validation
|
|
2433
2135
|
*
|
|
2434
2136
|
* @internal
|
|
2435
2137
|
*/
|
|
2436
|
-
constructor(agent, repoDid
|
|
2138
|
+
constructor(agent, repoDid) {
|
|
2437
2139
|
this.agent = agent;
|
|
2438
2140
|
this.repoDid = repoDid;
|
|
2439
|
-
this.lexiconRegistry = lexiconRegistry;
|
|
2440
2141
|
}
|
|
2441
2142
|
/**
|
|
2442
2143
|
* Creates a new record in the specified collection.
|
|
@@ -2472,10 +2173,6 @@ class RecordOperationsImpl {
|
|
|
2472
2173
|
* ```
|
|
2473
2174
|
*/
|
|
2474
2175
|
async create(params) {
|
|
2475
|
-
const validation = this.lexiconRegistry.validate(params.collection, params.record);
|
|
2476
|
-
if (!validation.valid) {
|
|
2477
|
-
throw new ValidationError(`Invalid record for collection ${params.collection}: ${validation.error}`);
|
|
2478
|
-
}
|
|
2479
2176
|
try {
|
|
2480
2177
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
2481
2178
|
repo: this.repoDid,
|
|
@@ -2530,10 +2227,6 @@ class RecordOperationsImpl {
|
|
|
2530
2227
|
* ```
|
|
2531
2228
|
*/
|
|
2532
2229
|
async update(params) {
|
|
2533
|
-
const validation = this.lexiconRegistry.validate(params.collection, params.record);
|
|
2534
|
-
if (!validation.valid) {
|
|
2535
|
-
throw new ValidationError(`Invalid record for collection ${params.collection}: ${validation.error}`);
|
|
2536
|
-
}
|
|
2537
2230
|
try {
|
|
2538
2231
|
const result = await this.agent.com.atproto.repo.putRecord({
|
|
2539
2232
|
repo: this.repoDid,
|
|
@@ -3125,6 +2818,148 @@ class ProfileOperationsImpl {
|
|
|
3125
2818
|
}
|
|
3126
2819
|
}
|
|
3127
2820
|
|
|
2821
|
+
/**
|
|
2822
|
+
* Lexicons entrypoint - Lexicon definitions and registry.
|
|
2823
|
+
*
|
|
2824
|
+
* This sub-entrypoint exports the lexicon registry and hypercert
|
|
2825
|
+
* lexicon constants for working with AT Protocol record schemas.
|
|
2826
|
+
*
|
|
2827
|
+
* @remarks
|
|
2828
|
+
* Import from `@hypercerts-org/sdk/lexicons`:
|
|
2829
|
+
*
|
|
2830
|
+
* ```typescript
|
|
2831
|
+
* import {
|
|
2832
|
+
* LexiconRegistry,
|
|
2833
|
+
* HYPERCERT_LEXICONS,
|
|
2834
|
+
* HYPERCERT_COLLECTIONS,
|
|
2835
|
+
* } from "@hypercerts-org/sdk/lexicons";
|
|
2836
|
+
* ```
|
|
2837
|
+
*
|
|
2838
|
+
* **Exports**:
|
|
2839
|
+
* - {@link LexiconRegistry} - Registry for managing and validating lexicons
|
|
2840
|
+
* - {@link HYPERCERT_LEXICONS} - Array of all hypercert lexicon documents
|
|
2841
|
+
* - {@link HYPERCERT_COLLECTIONS} - Constants for collection NSIDs
|
|
2842
|
+
*
|
|
2843
|
+
* @example Using collection constants
|
|
2844
|
+
* ```typescript
|
|
2845
|
+
* import { HYPERCERT_COLLECTIONS } from "@hypercerts-org/sdk/lexicons";
|
|
2846
|
+
*
|
|
2847
|
+
* // List hypercerts using the correct collection name
|
|
2848
|
+
* const records = await repo.records.list({
|
|
2849
|
+
* collection: HYPERCERT_COLLECTIONS.RECORD,
|
|
2850
|
+
* });
|
|
2851
|
+
*
|
|
2852
|
+
* // List contributions
|
|
2853
|
+
* const contributions = await repo.records.list({
|
|
2854
|
+
* collection: HYPERCERT_COLLECTIONS.CONTRIBUTION,
|
|
2855
|
+
* });
|
|
2856
|
+
* ```
|
|
2857
|
+
*
|
|
2858
|
+
* @example Custom lexicon registration
|
|
2859
|
+
* ```typescript
|
|
2860
|
+
* import { LexiconRegistry } from "@hypercerts-org/sdk/lexicons";
|
|
2861
|
+
*
|
|
2862
|
+
* const registry = sdk.getLexiconRegistry();
|
|
2863
|
+
*
|
|
2864
|
+
* // Register custom lexicon
|
|
2865
|
+
* registry.register({
|
|
2866
|
+
* lexicon: 1,
|
|
2867
|
+
* id: "org.myapp.customRecord",
|
|
2868
|
+
* defs: { ... },
|
|
2869
|
+
* });
|
|
2870
|
+
*
|
|
2871
|
+
* // Validate a record
|
|
2872
|
+
* const result = registry.validate("org.myapp.customRecord", record);
|
|
2873
|
+
* if (!result.valid) {
|
|
2874
|
+
* console.error(result.error);
|
|
2875
|
+
* }
|
|
2876
|
+
* ```
|
|
2877
|
+
*
|
|
2878
|
+
* @packageDocumentation
|
|
2879
|
+
*/
|
|
2880
|
+
/**
|
|
2881
|
+
* All hypercert-related lexicons for registration with AT Protocol Agent.
|
|
2882
|
+
* This array contains all lexicon documents from the published package.
|
|
2883
|
+
*/
|
|
2884
|
+
const HYPERCERT_LEXICONS = [
|
|
2885
|
+
lexicon.CERTIFIED_DEFS_LEXICON_JSON,
|
|
2886
|
+
lexicon.LOCATION_LEXICON_JSON,
|
|
2887
|
+
lexicon.STRONGREF_LEXICON_JSON,
|
|
2888
|
+
lexicon.HYPERCERTS_DEFS_LEXICON_JSON,
|
|
2889
|
+
lexicon.ACTIVITY_LEXICON_JSON,
|
|
2890
|
+
lexicon.COLLECTION_LEXICON_JSON,
|
|
2891
|
+
lexicon.CONTRIBUTION_LEXICON_JSON,
|
|
2892
|
+
lexicon.EVALUATION_LEXICON_JSON,
|
|
2893
|
+
lexicon.EVIDENCE_LEXICON_JSON,
|
|
2894
|
+
lexicon.MEASUREMENT_LEXICON_JSON,
|
|
2895
|
+
lexicon.RIGHTS_LEXICON_JSON,
|
|
2896
|
+
lexicon.PROJECT_LEXICON_JSON,
|
|
2897
|
+
lexicon.BADGE_AWARD_LEXICON_JSON,
|
|
2898
|
+
lexicon.BADGE_DEFINITION_LEXICON_JSON,
|
|
2899
|
+
lexicon.BADGE_RESPONSE_LEXICON_JSON,
|
|
2900
|
+
lexicon.FUNDING_RECEIPT_LEXICON_JSON,
|
|
2901
|
+
];
|
|
2902
|
+
/**
|
|
2903
|
+
* Collection NSIDs (Namespaced Identifiers) for hypercert records.
|
|
2904
|
+
*
|
|
2905
|
+
* Use these constants when performing record operations to ensure
|
|
2906
|
+
* correct collection names.
|
|
2907
|
+
*/
|
|
2908
|
+
const HYPERCERT_COLLECTIONS = {
|
|
2909
|
+
/**
|
|
2910
|
+
* Main hypercert claim record collection.
|
|
2911
|
+
*/
|
|
2912
|
+
CLAIM: lexicon.ACTIVITY_NSID,
|
|
2913
|
+
/**
|
|
2914
|
+
* Rights record collection.
|
|
2915
|
+
*/
|
|
2916
|
+
RIGHTS: lexicon.RIGHTS_NSID,
|
|
2917
|
+
/**
|
|
2918
|
+
* Location record collection (shared certified lexicon).
|
|
2919
|
+
*/
|
|
2920
|
+
LOCATION: lexicon.LOCATION_NSID,
|
|
2921
|
+
/**
|
|
2922
|
+
* Contribution record collection.
|
|
2923
|
+
*/
|
|
2924
|
+
CONTRIBUTION: lexicon.CONTRIBUTION_NSID,
|
|
2925
|
+
/**
|
|
2926
|
+
* Measurement record collection.
|
|
2927
|
+
*/
|
|
2928
|
+
MEASUREMENT: lexicon.MEASUREMENT_NSID,
|
|
2929
|
+
/**
|
|
2930
|
+
* Evaluation record collection.
|
|
2931
|
+
*/
|
|
2932
|
+
EVALUATION: lexicon.EVALUATION_NSID,
|
|
2933
|
+
/**
|
|
2934
|
+
* Evidence record collection.
|
|
2935
|
+
*/
|
|
2936
|
+
EVIDENCE: lexicon.EVIDENCE_NSID,
|
|
2937
|
+
/**
|
|
2938
|
+
* Collection record collection (groups of hypercerts).
|
|
2939
|
+
*/
|
|
2940
|
+
COLLECTION: lexicon.COLLECTION_NSID,
|
|
2941
|
+
/**
|
|
2942
|
+
* Project record collection.
|
|
2943
|
+
*/
|
|
2944
|
+
PROJECT: lexicon.PROJECT_NSID,
|
|
2945
|
+
/**
|
|
2946
|
+
* Badge award record collection.
|
|
2947
|
+
*/
|
|
2948
|
+
BADGE_AWARD: lexicon.BADGE_AWARD_NSID,
|
|
2949
|
+
/**
|
|
2950
|
+
* Badge definition record collection.
|
|
2951
|
+
*/
|
|
2952
|
+
BADGE_DEFINITION: lexicon.BADGE_DEFINITION_NSID,
|
|
2953
|
+
/**
|
|
2954
|
+
* Badge response record collection.
|
|
2955
|
+
*/
|
|
2956
|
+
BADGE_RESPONSE: lexicon.BADGE_RESPONSE_NSID,
|
|
2957
|
+
/**
|
|
2958
|
+
* Funding receipt record collection.
|
|
2959
|
+
*/
|
|
2960
|
+
FUNDING_RECEIPT: lexicon.FUNDING_RECEIPT_NSID,
|
|
2961
|
+
};
|
|
2962
|
+
|
|
3128
2963
|
/**
|
|
3129
2964
|
* HypercertOperationsImpl - High-level hypercert operations.
|
|
3130
2965
|
*
|
|
@@ -3188,17 +3023,15 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3188
3023
|
* @param agent - AT Protocol Agent for making API calls
|
|
3189
3024
|
* @param repoDid - DID of the repository to operate on
|
|
3190
3025
|
* @param _serverUrl - Server URL (reserved for future use)
|
|
3191
|
-
* @param lexiconRegistry - Registry for record validation
|
|
3192
3026
|
* @param logger - Optional logger for debugging
|
|
3193
3027
|
*
|
|
3194
3028
|
* @internal
|
|
3195
3029
|
*/
|
|
3196
|
-
constructor(agent, repoDid, _serverUrl,
|
|
3030
|
+
constructor(agent, repoDid, _serverUrl, logger) {
|
|
3197
3031
|
super();
|
|
3198
3032
|
this.agent = agent;
|
|
3199
3033
|
this.repoDid = repoDid;
|
|
3200
3034
|
this._serverUrl = _serverUrl;
|
|
3201
|
-
this.lexiconRegistry = lexiconRegistry;
|
|
3202
3035
|
this.logger = logger;
|
|
3203
3036
|
}
|
|
3204
3037
|
/**
|
|
@@ -3218,6 +3051,202 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3218
3051
|
}
|
|
3219
3052
|
}
|
|
3220
3053
|
}
|
|
3054
|
+
/**
|
|
3055
|
+
* Uploads an image blob and returns a blob reference.
|
|
3056
|
+
*
|
|
3057
|
+
* @param image - Image blob to upload
|
|
3058
|
+
* @param onProgress - Optional progress callback
|
|
3059
|
+
* @returns Promise resolving to blob reference or undefined
|
|
3060
|
+
* @throws {@link NetworkError} if upload fails
|
|
3061
|
+
* @internal
|
|
3062
|
+
*/
|
|
3063
|
+
async uploadImageBlob(image, onProgress) {
|
|
3064
|
+
this.emitProgress(onProgress, { name: "uploadImage", status: "start" });
|
|
3065
|
+
try {
|
|
3066
|
+
const arrayBuffer = await image.arrayBuffer();
|
|
3067
|
+
const uint8Array = new Uint8Array(arrayBuffer);
|
|
3068
|
+
const uploadResult = await this.agent.com.atproto.repo.uploadBlob(uint8Array, {
|
|
3069
|
+
encoding: image.type || "image/jpeg",
|
|
3070
|
+
});
|
|
3071
|
+
if (uploadResult.success) {
|
|
3072
|
+
const blobRef = {
|
|
3073
|
+
$type: "blob",
|
|
3074
|
+
ref: { $link: uploadResult.data.blob.ref.toString() },
|
|
3075
|
+
mimeType: uploadResult.data.blob.mimeType,
|
|
3076
|
+
size: uploadResult.data.blob.size,
|
|
3077
|
+
};
|
|
3078
|
+
this.emitProgress(onProgress, {
|
|
3079
|
+
name: "uploadImage",
|
|
3080
|
+
status: "success",
|
|
3081
|
+
data: { size: image.size },
|
|
3082
|
+
});
|
|
3083
|
+
return blobRef;
|
|
3084
|
+
}
|
|
3085
|
+
throw new NetworkError("Image upload succeeded but returned no blob reference");
|
|
3086
|
+
}
|
|
3087
|
+
catch (error) {
|
|
3088
|
+
this.emitProgress(onProgress, { name: "uploadImage", status: "error", error: error });
|
|
3089
|
+
throw new NetworkError(`Failed to upload image: ${error instanceof Error ? error.message : "Unknown"}`, error);
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
/**
|
|
3093
|
+
* Creates a rights record for a hypercert.
|
|
3094
|
+
*
|
|
3095
|
+
* @param rights - Rights data
|
|
3096
|
+
* @param createdAt - ISO timestamp for creation
|
|
3097
|
+
* @param onProgress - Optional progress callback
|
|
3098
|
+
* @returns Promise resolving to rights URI and CID
|
|
3099
|
+
* @throws {@link ValidationError} if validation fails
|
|
3100
|
+
* @throws {@link NetworkError} if creation fails
|
|
3101
|
+
* @internal
|
|
3102
|
+
*/
|
|
3103
|
+
async createRightsRecord(rights, createdAt, onProgress) {
|
|
3104
|
+
this.emitProgress(onProgress, { name: "createRights", status: "start" });
|
|
3105
|
+
const rightsRecord = {
|
|
3106
|
+
$type: HYPERCERT_COLLECTIONS.RIGHTS,
|
|
3107
|
+
rightsName: rights.name,
|
|
3108
|
+
rightsType: rights.type,
|
|
3109
|
+
rightsDescription: rights.description,
|
|
3110
|
+
createdAt,
|
|
3111
|
+
};
|
|
3112
|
+
const rightsValidation = lexicon.validate(rightsRecord, HYPERCERT_COLLECTIONS.RIGHTS, "main", false);
|
|
3113
|
+
if (!rightsValidation.success) {
|
|
3114
|
+
throw new ValidationError(`Invalid rights record: ${rightsValidation.error?.message}`);
|
|
3115
|
+
}
|
|
3116
|
+
const rightsResult = await this.agent.com.atproto.repo.createRecord({
|
|
3117
|
+
repo: this.repoDid,
|
|
3118
|
+
collection: HYPERCERT_COLLECTIONS.RIGHTS,
|
|
3119
|
+
record: rightsRecord,
|
|
3120
|
+
});
|
|
3121
|
+
if (!rightsResult.success) {
|
|
3122
|
+
throw new NetworkError("Failed to create rights record");
|
|
3123
|
+
}
|
|
3124
|
+
const uri = rightsResult.data.uri;
|
|
3125
|
+
const cid = rightsResult.data.cid;
|
|
3126
|
+
this.emit("rightsCreated", { uri, cid });
|
|
3127
|
+
this.emitProgress(onProgress, {
|
|
3128
|
+
name: "createRights",
|
|
3129
|
+
status: "success",
|
|
3130
|
+
data: { uri },
|
|
3131
|
+
});
|
|
3132
|
+
return { uri, cid };
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* Creates the main hypercert record.
|
|
3136
|
+
*
|
|
3137
|
+
* @param params - Hypercert creation parameters
|
|
3138
|
+
* @param rightsUri - URI of the associated rights record
|
|
3139
|
+
* @param rightsCid - CID of the associated rights record
|
|
3140
|
+
* @param imageBlobRef - Optional image blob reference
|
|
3141
|
+
* @param createdAt - ISO timestamp for creation
|
|
3142
|
+
* @param onProgress - Optional progress callback
|
|
3143
|
+
* @returns Promise resolving to hypercert URI and CID
|
|
3144
|
+
* @throws {@link ValidationError} if validation fails
|
|
3145
|
+
* @throws {@link NetworkError} if creation fails
|
|
3146
|
+
* @internal
|
|
3147
|
+
*/
|
|
3148
|
+
async createHypercertRecord(params, rightsUri, rightsCid, imageBlobRef, createdAt, onProgress) {
|
|
3149
|
+
this.emitProgress(onProgress, { name: "createHypercert", status: "start" });
|
|
3150
|
+
const hypercertRecord = {
|
|
3151
|
+
$type: HYPERCERT_COLLECTIONS.CLAIM,
|
|
3152
|
+
title: params.title,
|
|
3153
|
+
shortDescription: params.shortDescription,
|
|
3154
|
+
description: params.description,
|
|
3155
|
+
workScope: params.workScope,
|
|
3156
|
+
workTimeFrameFrom: params.workTimeFrameFrom,
|
|
3157
|
+
workTimeFrameTo: params.workTimeFrameTo,
|
|
3158
|
+
rights: { uri: rightsUri, cid: rightsCid },
|
|
3159
|
+
createdAt,
|
|
3160
|
+
};
|
|
3161
|
+
if (imageBlobRef) {
|
|
3162
|
+
hypercertRecord.image = imageBlobRef;
|
|
3163
|
+
}
|
|
3164
|
+
if (params.evidence && params.evidence.length > 0) {
|
|
3165
|
+
hypercertRecord.evidence = params.evidence;
|
|
3166
|
+
}
|
|
3167
|
+
const hypercertValidation = lexicon.validate(hypercertRecord, HYPERCERT_COLLECTIONS.CLAIM, "#main", false);
|
|
3168
|
+
if (!hypercertValidation.success) {
|
|
3169
|
+
throw new ValidationError(`Invalid hypercert record: ${hypercertValidation.error?.message}`);
|
|
3170
|
+
}
|
|
3171
|
+
const hypercertResult = await this.agent.com.atproto.repo.createRecord({
|
|
3172
|
+
repo: this.repoDid,
|
|
3173
|
+
collection: HYPERCERT_COLLECTIONS.CLAIM,
|
|
3174
|
+
record: hypercertRecord,
|
|
3175
|
+
});
|
|
3176
|
+
if (!hypercertResult.success) {
|
|
3177
|
+
throw new NetworkError("Failed to create hypercert record");
|
|
3178
|
+
}
|
|
3179
|
+
const uri = hypercertResult.data.uri;
|
|
3180
|
+
const cid = hypercertResult.data.cid;
|
|
3181
|
+
this.emit("recordCreated", { uri, cid });
|
|
3182
|
+
this.emitProgress(onProgress, {
|
|
3183
|
+
name: "createHypercert",
|
|
3184
|
+
status: "success",
|
|
3185
|
+
data: { uri },
|
|
3186
|
+
});
|
|
3187
|
+
return { uri, cid };
|
|
3188
|
+
}
|
|
3189
|
+
/**
|
|
3190
|
+
* Attaches a location to a hypercert with progress tracking.
|
|
3191
|
+
*
|
|
3192
|
+
* @param hypercertUri - URI of the hypercert
|
|
3193
|
+
* @param location - Location data
|
|
3194
|
+
* @param onProgress - Optional progress callback
|
|
3195
|
+
* @returns Promise resolving to location URI
|
|
3196
|
+
* @internal
|
|
3197
|
+
*/
|
|
3198
|
+
async attachLocationWithProgress(hypercertUri, location, onProgress) {
|
|
3199
|
+
this.emitProgress(onProgress, { name: "attachLocation", status: "start" });
|
|
3200
|
+
try {
|
|
3201
|
+
const locationResult = await this.attachLocation(hypercertUri, location);
|
|
3202
|
+
this.emitProgress(onProgress, {
|
|
3203
|
+
name: "attachLocation",
|
|
3204
|
+
status: "success",
|
|
3205
|
+
data: { uri: locationResult.uri },
|
|
3206
|
+
});
|
|
3207
|
+
return locationResult.uri;
|
|
3208
|
+
}
|
|
3209
|
+
catch (error) {
|
|
3210
|
+
this.emitProgress(onProgress, { name: "attachLocation", status: "error", error: error });
|
|
3211
|
+
this.logger?.warn(`Failed to attach location: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
3212
|
+
throw error;
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
/**
|
|
3216
|
+
* Creates contribution records with progress tracking.
|
|
3217
|
+
*
|
|
3218
|
+
* @param hypercertUri - URI of the hypercert
|
|
3219
|
+
* @param contributions - Array of contribution data
|
|
3220
|
+
* @param onProgress - Optional progress callback
|
|
3221
|
+
* @returns Promise resolving to array of contribution URIs
|
|
3222
|
+
* @internal
|
|
3223
|
+
*/
|
|
3224
|
+
async createContributionsWithProgress(hypercertUri, contributions, onProgress) {
|
|
3225
|
+
this.emitProgress(onProgress, { name: "createContributions", status: "start" });
|
|
3226
|
+
try {
|
|
3227
|
+
const contributionUris = [];
|
|
3228
|
+
for (const contrib of contributions) {
|
|
3229
|
+
const contribResult = await this.addContribution({
|
|
3230
|
+
hypercertUri,
|
|
3231
|
+
contributors: contrib.contributors,
|
|
3232
|
+
role: contrib.role,
|
|
3233
|
+
description: contrib.description,
|
|
3234
|
+
});
|
|
3235
|
+
contributionUris.push(contribResult.uri);
|
|
3236
|
+
}
|
|
3237
|
+
this.emitProgress(onProgress, {
|
|
3238
|
+
name: "createContributions",
|
|
3239
|
+
status: "success",
|
|
3240
|
+
data: { count: contributionUris.length },
|
|
3241
|
+
});
|
|
3242
|
+
return contributionUris;
|
|
3243
|
+
}
|
|
3244
|
+
catch (error) {
|
|
3245
|
+
this.emitProgress(onProgress, { name: "createContributions", status: "error", error: error });
|
|
3246
|
+
this.logger?.warn(`Failed to create contributions: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
3247
|
+
throw error;
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3221
3250
|
/**
|
|
3222
3251
|
* Creates a new hypercert with all related records.
|
|
3223
3252
|
*
|
|
@@ -3294,142 +3323,31 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3294
3323
|
};
|
|
3295
3324
|
try {
|
|
3296
3325
|
// Step 1: Upload image if provided
|
|
3297
|
-
|
|
3298
|
-
if (params.image) {
|
|
3299
|
-
this.emitProgress(params.onProgress, { name: "uploadImage", status: "start" });
|
|
3300
|
-
try {
|
|
3301
|
-
const arrayBuffer = await params.image.arrayBuffer();
|
|
3302
|
-
const uint8Array = new Uint8Array(arrayBuffer);
|
|
3303
|
-
const uploadResult = await this.agent.com.atproto.repo.uploadBlob(uint8Array, {
|
|
3304
|
-
encoding: params.image.type || "image/jpeg",
|
|
3305
|
-
});
|
|
3306
|
-
if (uploadResult.success) {
|
|
3307
|
-
imageBlobRef = {
|
|
3308
|
-
$type: "blob",
|
|
3309
|
-
ref: { $link: uploadResult.data.blob.ref.toString() },
|
|
3310
|
-
mimeType: uploadResult.data.blob.mimeType,
|
|
3311
|
-
size: uploadResult.data.blob.size,
|
|
3312
|
-
};
|
|
3313
|
-
}
|
|
3314
|
-
this.emitProgress(params.onProgress, {
|
|
3315
|
-
name: "uploadImage",
|
|
3316
|
-
status: "success",
|
|
3317
|
-
data: { size: params.image.size },
|
|
3318
|
-
});
|
|
3319
|
-
}
|
|
3320
|
-
catch (error) {
|
|
3321
|
-
this.emitProgress(params.onProgress, { name: "uploadImage", status: "error", error: error });
|
|
3322
|
-
throw new NetworkError(`Failed to upload image: ${error instanceof Error ? error.message : "Unknown"}`, error);
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3326
|
+
const imageBlobRef = params.image ? await this.uploadImageBlob(params.image, params.onProgress) : undefined;
|
|
3325
3327
|
// Step 2: Create rights record
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
rightsName: params.rights.name,
|
|
3330
|
-
rightsType: params.rights.type,
|
|
3331
|
-
rightsDescription: params.rights.description,
|
|
3332
|
-
createdAt,
|
|
3333
|
-
};
|
|
3334
|
-
const rightsValidation = this.lexiconRegistry.validate(lexicon.HYPERCERT_COLLECTIONS.RIGHTS, rightsRecord);
|
|
3335
|
-
if (!rightsValidation.valid) {
|
|
3336
|
-
throw new ValidationError(`Invalid rights record: ${rightsValidation.error}`);
|
|
3337
|
-
}
|
|
3338
|
-
const rightsResult = await this.agent.com.atproto.repo.createRecord({
|
|
3339
|
-
repo: this.repoDid,
|
|
3340
|
-
collection: lexicon.HYPERCERT_COLLECTIONS.RIGHTS,
|
|
3341
|
-
record: rightsRecord,
|
|
3342
|
-
});
|
|
3343
|
-
if (!rightsResult.success) {
|
|
3344
|
-
throw new NetworkError("Failed to create rights record");
|
|
3345
|
-
}
|
|
3346
|
-
result.rightsUri = rightsResult.data.uri;
|
|
3347
|
-
result.rightsCid = rightsResult.data.cid;
|
|
3348
|
-
this.emit("rightsCreated", { uri: result.rightsUri, cid: result.rightsCid });
|
|
3349
|
-
this.emitProgress(params.onProgress, {
|
|
3350
|
-
name: "createRights",
|
|
3351
|
-
status: "success",
|
|
3352
|
-
data: { uri: result.rightsUri },
|
|
3353
|
-
});
|
|
3328
|
+
const { uri: rightsUri, cid: rightsCid } = await this.createRightsRecord(params.rights, createdAt, params.onProgress);
|
|
3329
|
+
result.rightsUri = rightsUri;
|
|
3330
|
+
result.rightsCid = rightsCid;
|
|
3354
3331
|
// Step 3: Create hypercert record
|
|
3355
|
-
this.
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
title: params.title,
|
|
3359
|
-
shortDescription: params.shortDescription,
|
|
3360
|
-
description: params.description,
|
|
3361
|
-
workScope: params.workScope,
|
|
3362
|
-
workTimeFrameFrom: params.workTimeFrameFrom,
|
|
3363
|
-
workTimeFrameTo: params.workTimeFrameTo,
|
|
3364
|
-
rights: { uri: result.rightsUri, cid: result.rightsCid },
|
|
3365
|
-
createdAt,
|
|
3366
|
-
};
|
|
3367
|
-
if (imageBlobRef) {
|
|
3368
|
-
hypercertRecord.image = imageBlobRef;
|
|
3369
|
-
}
|
|
3370
|
-
if (params.evidence && params.evidence.length > 0) {
|
|
3371
|
-
hypercertRecord.evidence = params.evidence;
|
|
3372
|
-
}
|
|
3373
|
-
const hypercertValidation = this.lexiconRegistry.validate(lexicon.HYPERCERT_COLLECTIONS.CLAIM, hypercertRecord);
|
|
3374
|
-
if (!hypercertValidation.valid) {
|
|
3375
|
-
throw new ValidationError(`Invalid hypercert record: ${hypercertValidation.error}`);
|
|
3376
|
-
}
|
|
3377
|
-
const hypercertResult = await this.agent.com.atproto.repo.createRecord({
|
|
3378
|
-
repo: this.repoDid,
|
|
3379
|
-
collection: lexicon.HYPERCERT_COLLECTIONS.CLAIM,
|
|
3380
|
-
record: hypercertRecord,
|
|
3381
|
-
});
|
|
3382
|
-
if (!hypercertResult.success) {
|
|
3383
|
-
throw new NetworkError("Failed to create hypercert record");
|
|
3384
|
-
}
|
|
3385
|
-
result.hypercertUri = hypercertResult.data.uri;
|
|
3386
|
-
result.hypercertCid = hypercertResult.data.cid;
|
|
3387
|
-
this.emit("recordCreated", { uri: result.hypercertUri, cid: result.hypercertCid });
|
|
3388
|
-
this.emitProgress(params.onProgress, {
|
|
3389
|
-
name: "createHypercert",
|
|
3390
|
-
status: "success",
|
|
3391
|
-
data: { uri: result.hypercertUri },
|
|
3392
|
-
});
|
|
3332
|
+
const { uri: hypercertUri, cid: hypercertCid } = await this.createHypercertRecord(params, rightsUri, rightsCid, imageBlobRef, createdAt, params.onProgress);
|
|
3333
|
+
result.hypercertUri = hypercertUri;
|
|
3334
|
+
result.hypercertCid = hypercertCid;
|
|
3393
3335
|
// Step 4: Attach location if provided
|
|
3394
3336
|
if (params.location) {
|
|
3395
|
-
this.emitProgress(params.onProgress, { name: "attachLocation", status: "start" });
|
|
3396
3337
|
try {
|
|
3397
|
-
|
|
3398
|
-
result.locationUri = locationResult.uri;
|
|
3399
|
-
this.emitProgress(params.onProgress, {
|
|
3400
|
-
name: "attachLocation",
|
|
3401
|
-
status: "success",
|
|
3402
|
-
data: { uri: result.locationUri },
|
|
3403
|
-
});
|
|
3338
|
+
result.locationUri = await this.attachLocationWithProgress(hypercertUri, params.location, params.onProgress);
|
|
3404
3339
|
}
|
|
3405
|
-
catch
|
|
3406
|
-
|
|
3407
|
-
this.logger?.warn(`Failed to attach location: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
3340
|
+
catch {
|
|
3341
|
+
// Error already logged and progress emitted
|
|
3408
3342
|
}
|
|
3409
3343
|
}
|
|
3410
3344
|
// Step 5: Create contributions if provided
|
|
3411
3345
|
if (params.contributions && params.contributions.length > 0) {
|
|
3412
|
-
this.emitProgress(params.onProgress, { name: "createContributions", status: "start" });
|
|
3413
|
-
result.contributionUris = [];
|
|
3414
3346
|
try {
|
|
3415
|
-
|
|
3416
|
-
const contribResult = await this.addContribution({
|
|
3417
|
-
hypercertUri: result.hypercertUri,
|
|
3418
|
-
contributors: contrib.contributors,
|
|
3419
|
-
role: contrib.role,
|
|
3420
|
-
description: contrib.description,
|
|
3421
|
-
});
|
|
3422
|
-
result.contributionUris.push(contribResult.uri);
|
|
3423
|
-
}
|
|
3424
|
-
this.emitProgress(params.onProgress, {
|
|
3425
|
-
name: "createContributions",
|
|
3426
|
-
status: "success",
|
|
3427
|
-
data: { count: result.contributionUris.length },
|
|
3428
|
-
});
|
|
3347
|
+
result.contributionUris = await this.createContributionsWithProgress(hypercertUri, params.contributions, params.onProgress);
|
|
3429
3348
|
}
|
|
3430
|
-
catch
|
|
3431
|
-
|
|
3432
|
-
this.logger?.warn(`Failed to create contributions: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
3349
|
+
catch {
|
|
3350
|
+
// Error already logged and progress emitted
|
|
3433
3351
|
}
|
|
3434
3352
|
}
|
|
3435
3353
|
return result;
|
|
@@ -3531,9 +3449,9 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3531
3449
|
// Preserve existing image
|
|
3532
3450
|
recordForUpdate.image = existingRecord.image;
|
|
3533
3451
|
}
|
|
3534
|
-
const validation =
|
|
3535
|
-
if (!validation.
|
|
3536
|
-
throw new ValidationError(`Invalid hypercert record: ${validation.error}`);
|
|
3452
|
+
const validation = lexicon.validate(recordForUpdate, collection, "main", false);
|
|
3453
|
+
if (!validation.success) {
|
|
3454
|
+
throw new ValidationError(`Invalid hypercert record: ${validation.error?.message}`);
|
|
3537
3455
|
}
|
|
3538
3456
|
const result = await this.agent.com.atproto.repo.putRecord({
|
|
3539
3457
|
repo: this.repoDid,
|
|
@@ -3582,10 +3500,10 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3582
3500
|
if (!result.success) {
|
|
3583
3501
|
throw new NetworkError("Failed to get hypercert");
|
|
3584
3502
|
}
|
|
3585
|
-
// Validate with lexicon
|
|
3586
|
-
const validation =
|
|
3587
|
-
if (!validation.
|
|
3588
|
-
throw new ValidationError(`Invalid hypercert record format: ${validation.error}`);
|
|
3503
|
+
// Validate with lexicon (more lenient - doesn't require $type)
|
|
3504
|
+
const validation = lexicon.validate(result.data.value, HYPERCERT_COLLECTIONS.CLAIM, "main", false);
|
|
3505
|
+
if (!validation.success) {
|
|
3506
|
+
throw new ValidationError(`Invalid hypercert record format: ${validation.error?.message}`);
|
|
3589
3507
|
}
|
|
3590
3508
|
return {
|
|
3591
3509
|
uri: result.data.uri,
|
|
@@ -3621,7 +3539,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3621
3539
|
try {
|
|
3622
3540
|
const result = await this.agent.com.atproto.repo.listRecords({
|
|
3623
3541
|
repo: this.repoDid,
|
|
3624
|
-
collection:
|
|
3542
|
+
collection: HYPERCERT_COLLECTIONS.CLAIM,
|
|
3625
3543
|
limit: params?.limit,
|
|
3626
3544
|
cursor: params?.cursor,
|
|
3627
3545
|
});
|
|
@@ -3759,7 +3677,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3759
3677
|
}
|
|
3760
3678
|
// Build location record according to app.certified.location lexicon
|
|
3761
3679
|
const locationRecord = {
|
|
3762
|
-
$type:
|
|
3680
|
+
$type: HYPERCERT_COLLECTIONS.LOCATION,
|
|
3763
3681
|
lpVersion: "1.0",
|
|
3764
3682
|
srs: location.srs,
|
|
3765
3683
|
locationType,
|
|
@@ -3768,13 +3686,13 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3768
3686
|
name: location.name,
|
|
3769
3687
|
description: location.description,
|
|
3770
3688
|
};
|
|
3771
|
-
const validation =
|
|
3772
|
-
if (!validation.
|
|
3773
|
-
throw new ValidationError(`Invalid location record: ${validation.error}`);
|
|
3689
|
+
const validation = lexicon.validate(locationRecord, HYPERCERT_COLLECTIONS.LOCATION, "main", false);
|
|
3690
|
+
if (!validation.success) {
|
|
3691
|
+
throw new ValidationError(`Invalid location record: ${validation.error?.message}`);
|
|
3774
3692
|
}
|
|
3775
3693
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
3776
3694
|
repo: this.repoDid,
|
|
3777
|
-
collection:
|
|
3695
|
+
collection: HYPERCERT_COLLECTIONS.LOCATION,
|
|
3778
3696
|
record: locationRecord,
|
|
3779
3697
|
});
|
|
3780
3698
|
if (!result.success) {
|
|
@@ -3853,7 +3771,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3853
3771
|
try {
|
|
3854
3772
|
const createdAt = new Date().toISOString();
|
|
3855
3773
|
const contributionRecord = {
|
|
3856
|
-
$type:
|
|
3774
|
+
$type: HYPERCERT_COLLECTIONS.CONTRIBUTION,
|
|
3857
3775
|
contributors: params.contributors,
|
|
3858
3776
|
role: params.role,
|
|
3859
3777
|
createdAt,
|
|
@@ -3864,13 +3782,13 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3864
3782
|
const hypercert = await this.get(params.hypercertUri);
|
|
3865
3783
|
contributionRecord.hypercert = { uri: hypercert.uri, cid: hypercert.cid };
|
|
3866
3784
|
}
|
|
3867
|
-
const validation =
|
|
3868
|
-
if (!validation.
|
|
3869
|
-
throw new ValidationError(`Invalid contribution record: ${validation.error}`);
|
|
3785
|
+
const validation = lexicon.validate(contributionRecord, HYPERCERT_COLLECTIONS.CONTRIBUTION, "main", false);
|
|
3786
|
+
if (!validation.success) {
|
|
3787
|
+
throw new ValidationError(`Invalid contribution record: ${validation.error?.message}`);
|
|
3870
3788
|
}
|
|
3871
3789
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
3872
3790
|
repo: this.repoDid,
|
|
3873
|
-
collection:
|
|
3791
|
+
collection: HYPERCERT_COLLECTIONS.CONTRIBUTION,
|
|
3874
3792
|
record: contributionRecord,
|
|
3875
3793
|
});
|
|
3876
3794
|
if (!result.success) {
|
|
@@ -3919,7 +3837,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3919
3837
|
const hypercert = await this.get(params.hypercertUri);
|
|
3920
3838
|
const createdAt = new Date().toISOString();
|
|
3921
3839
|
const measurementRecord = {
|
|
3922
|
-
$type:
|
|
3840
|
+
$type: HYPERCERT_COLLECTIONS.MEASUREMENT,
|
|
3923
3841
|
hypercert: { uri: hypercert.uri, cid: hypercert.cid },
|
|
3924
3842
|
measurers: params.measurers,
|
|
3925
3843
|
metric: params.metric,
|
|
@@ -3928,13 +3846,13 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3928
3846
|
measurementMethodURI: params.methodUri,
|
|
3929
3847
|
evidenceURI: params.evidenceUris,
|
|
3930
3848
|
};
|
|
3931
|
-
const validation =
|
|
3932
|
-
if (!validation.
|
|
3933
|
-
throw new ValidationError(`Invalid measurement record: ${validation.error}`);
|
|
3849
|
+
const validation = lexicon.validate(measurementRecord, HYPERCERT_COLLECTIONS.MEASUREMENT, "main", false);
|
|
3850
|
+
if (!validation.success) {
|
|
3851
|
+
throw new ValidationError(`Invalid measurement record: ${validation.error?.message}`);
|
|
3934
3852
|
}
|
|
3935
3853
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
3936
3854
|
repo: this.repoDid,
|
|
3937
|
-
collection:
|
|
3855
|
+
collection: HYPERCERT_COLLECTIONS.MEASUREMENT,
|
|
3938
3856
|
record: measurementRecord,
|
|
3939
3857
|
});
|
|
3940
3858
|
if (!result.success) {
|
|
@@ -3975,19 +3893,19 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
3975
3893
|
const subject = await this.get(params.subjectUri);
|
|
3976
3894
|
const createdAt = new Date().toISOString();
|
|
3977
3895
|
const evaluationRecord = {
|
|
3978
|
-
$type:
|
|
3896
|
+
$type: HYPERCERT_COLLECTIONS.EVALUATION,
|
|
3979
3897
|
subject: { uri: subject.uri, cid: subject.cid },
|
|
3980
3898
|
evaluators: params.evaluators,
|
|
3981
3899
|
summary: params.summary,
|
|
3982
3900
|
createdAt,
|
|
3983
3901
|
};
|
|
3984
|
-
const validation =
|
|
3985
|
-
if (!validation.
|
|
3986
|
-
throw new ValidationError(`Invalid evaluation record: ${validation.error}`);
|
|
3902
|
+
const validation = lexicon.validate(evaluationRecord, HYPERCERT_COLLECTIONS.EVALUATION, "main", false);
|
|
3903
|
+
if (!validation.success) {
|
|
3904
|
+
throw new ValidationError(`Invalid evaluation record: ${validation.error?.message}`);
|
|
3987
3905
|
}
|
|
3988
3906
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
3989
3907
|
repo: this.repoDid,
|
|
3990
|
-
collection:
|
|
3908
|
+
collection: HYPERCERT_COLLECTIONS.EVALUATION,
|
|
3991
3909
|
record: evaluationRecord,
|
|
3992
3910
|
});
|
|
3993
3911
|
if (!result.success) {
|
|
@@ -4050,7 +3968,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
4050
3968
|
}
|
|
4051
3969
|
}
|
|
4052
3970
|
const collectionRecord = {
|
|
4053
|
-
$type:
|
|
3971
|
+
$type: HYPERCERT_COLLECTIONS.COLLECTION,
|
|
4054
3972
|
title: params.title,
|
|
4055
3973
|
claims: params.claims.map((c) => ({ claim: { uri: c.uri, cid: c.cid }, weight: c.weight })),
|
|
4056
3974
|
createdAt,
|
|
@@ -4061,13 +3979,13 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
4061
3979
|
if (coverPhotoRef) {
|
|
4062
3980
|
collectionRecord.coverPhoto = coverPhotoRef;
|
|
4063
3981
|
}
|
|
4064
|
-
const validation =
|
|
4065
|
-
if (!validation.
|
|
4066
|
-
throw new ValidationError(`Invalid collection record: ${validation.error}`);
|
|
3982
|
+
const validation = lexicon.validate(collectionRecord, HYPERCERT_COLLECTIONS.COLLECTION, "main", false);
|
|
3983
|
+
if (!validation.success) {
|
|
3984
|
+
throw new ValidationError(`Invalid collection record: ${validation.error?.message}`);
|
|
4067
3985
|
}
|
|
4068
3986
|
const result = await this.agent.com.atproto.repo.createRecord({
|
|
4069
3987
|
repo: this.repoDid,
|
|
4070
|
-
collection:
|
|
3988
|
+
collection: HYPERCERT_COLLECTIONS.COLLECTION,
|
|
4071
3989
|
record: collectionRecord,
|
|
4072
3990
|
});
|
|
4073
3991
|
if (!result.success) {
|
|
@@ -4113,9 +4031,9 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
4113
4031
|
throw new NetworkError("Failed to get collection");
|
|
4114
4032
|
}
|
|
4115
4033
|
// Validate with lexicon registry (more lenient - doesn't require $type)
|
|
4116
|
-
const validation =
|
|
4117
|
-
if (!validation.
|
|
4118
|
-
throw new ValidationError(`Invalid collection record format: ${validation.error}`);
|
|
4034
|
+
const validation = lexicon.validate(result.data.value, HYPERCERT_COLLECTIONS.COLLECTION, "#main", false);
|
|
4035
|
+
if (!validation.success) {
|
|
4036
|
+
throw new ValidationError(`Invalid collection record format: ${validation.error?.message}`);
|
|
4119
4037
|
}
|
|
4120
4038
|
return {
|
|
4121
4039
|
uri: result.data.uri,
|
|
@@ -4148,7 +4066,7 @@ class HypercertOperationsImpl extends eventemitter3.EventEmitter {
|
|
|
4148
4066
|
try {
|
|
4149
4067
|
const result = await this.agent.com.atproto.repo.listRecords({
|
|
4150
4068
|
repo: this.repoDid,
|
|
4151
|
-
collection:
|
|
4069
|
+
collection: HYPERCERT_COLLECTIONS.COLLECTION,
|
|
4152
4070
|
limit: params?.limit,
|
|
4153
4071
|
cursor: params?.cursor,
|
|
4154
4072
|
});
|
|
@@ -4912,7 +4830,6 @@ class Repository {
|
|
|
4912
4830
|
* @param session - Authenticated OAuth session
|
|
4913
4831
|
* @param serverUrl - Base URL of the AT Protocol server
|
|
4914
4832
|
* @param repoDid - DID of the repository to operate on
|
|
4915
|
-
* @param lexiconRegistry - Registry for lexicon validation
|
|
4916
4833
|
* @param isSDS - Whether this is a Shared Data Server
|
|
4917
4834
|
* @param logger - Optional logger for debugging
|
|
4918
4835
|
*
|
|
@@ -4922,20 +4839,16 @@ class Repository {
|
|
|
4922
4839
|
*
|
|
4923
4840
|
* @internal
|
|
4924
4841
|
*/
|
|
4925
|
-
constructor(session, serverUrl, repoDid,
|
|
4842
|
+
constructor(session, serverUrl, repoDid, isSDS, logger) {
|
|
4926
4843
|
this.session = session;
|
|
4927
4844
|
this.serverUrl = serverUrl;
|
|
4928
4845
|
this.repoDid = repoDid;
|
|
4929
|
-
this.lexiconRegistry = lexiconRegistry;
|
|
4930
4846
|
this._isSDS = isSDS;
|
|
4931
4847
|
this.logger = logger;
|
|
4932
4848
|
// Create a ConfigurableAgent that routes requests to the specified server URL
|
|
4933
4849
|
// This allows routing to PDS, SDS, or any custom server while maintaining
|
|
4934
4850
|
// the OAuth session's authentication
|
|
4935
4851
|
this.agent = new ConfigurableAgent(session, serverUrl);
|
|
4936
|
-
this.lexiconRegistry.addToAgent(this.agent);
|
|
4937
|
-
// Register hypercert lexicons
|
|
4938
|
-
this.lexiconRegistry.registerMany(lexicon.HYPERCERT_LEXICONS);
|
|
4939
4852
|
}
|
|
4940
4853
|
/**
|
|
4941
4854
|
* The DID (Decentralized Identifier) of this repository.
|
|
@@ -5006,7 +4919,7 @@ class Repository {
|
|
|
5006
4919
|
* ```
|
|
5007
4920
|
*/
|
|
5008
4921
|
repo(did) {
|
|
5009
|
-
return new Repository(this.session, this.serverUrl, did, this.
|
|
4922
|
+
return new Repository(this.session, this.serverUrl, did, this._isSDS, this.logger);
|
|
5010
4923
|
}
|
|
5011
4924
|
/**
|
|
5012
4925
|
* Low-level record operations for CRUD on any AT Protocol record type.
|
|
@@ -5039,7 +4952,7 @@ class Repository {
|
|
|
5039
4952
|
*/
|
|
5040
4953
|
get records() {
|
|
5041
4954
|
if (!this._records) {
|
|
5042
|
-
this._records = new RecordOperationsImpl(this.agent, this.repoDid
|
|
4955
|
+
this._records = new RecordOperationsImpl(this.agent, this.repoDid);
|
|
5043
4956
|
}
|
|
5044
4957
|
return this._records;
|
|
5045
4958
|
}
|
|
@@ -5134,7 +5047,7 @@ class Repository {
|
|
|
5134
5047
|
*/
|
|
5135
5048
|
get hypercerts() {
|
|
5136
5049
|
if (!this._hypercerts) {
|
|
5137
|
-
this._hypercerts = new HypercertOperationsImpl(this.agent, this.repoDid, this.serverUrl, this.
|
|
5050
|
+
this._hypercerts = new HypercertOperationsImpl(this.agent, this.repoDid, this.serverUrl, this.logger);
|
|
5138
5051
|
}
|
|
5139
5052
|
return this._hypercerts;
|
|
5140
5053
|
}
|
|
@@ -5430,8 +5343,6 @@ class ATProtoSDK {
|
|
|
5430
5343
|
this.logger = config.logger;
|
|
5431
5344
|
// Initialize OAuth client
|
|
5432
5345
|
this.oauthClient = new OAuthClient(configWithDefaults);
|
|
5433
|
-
// Initialize lexicon registry
|
|
5434
|
-
this.lexiconRegistry = new LexiconRegistry();
|
|
5435
5346
|
this.logger?.info("ATProto SDK initialized");
|
|
5436
5347
|
}
|
|
5437
5348
|
/**
|
|
@@ -5713,30 +5624,7 @@ class ATProtoSDK {
|
|
|
5713
5624
|
}
|
|
5714
5625
|
// Get repository DID (default to session DID)
|
|
5715
5626
|
const repoDid = session.did || session.sub;
|
|
5716
|
-
return new Repository(session, serverUrl, repoDid,
|
|
5717
|
-
}
|
|
5718
|
-
/**
|
|
5719
|
-
* Gets the lexicon registry for schema validation.
|
|
5720
|
-
*
|
|
5721
|
-
* The lexicon registry manages AT Protocol lexicon schemas used for
|
|
5722
|
-
* validating record data. You can register custom lexicons to extend
|
|
5723
|
-
* the SDK's capabilities.
|
|
5724
|
-
*
|
|
5725
|
-
* @returns The {@link LexiconRegistry} instance
|
|
5726
|
-
*
|
|
5727
|
-
* @example
|
|
5728
|
-
* ```typescript
|
|
5729
|
-
* const registry = sdk.getLexiconRegistry();
|
|
5730
|
-
*
|
|
5731
|
-
* // Register custom lexicons
|
|
5732
|
-
* registry.register(myCustomLexicons);
|
|
5733
|
-
*
|
|
5734
|
-
* // Check if a lexicon is registered
|
|
5735
|
-
* const hasLexicon = registry.has("org.example.myRecord");
|
|
5736
|
-
* ```
|
|
5737
|
-
*/
|
|
5738
|
-
getLexiconRegistry() {
|
|
5739
|
-
return this.lexiconRegistry;
|
|
5627
|
+
return new Repository(session, serverUrl, repoDid, isSDS, this.logger);
|
|
5740
5628
|
}
|
|
5741
5629
|
/**
|
|
5742
5630
|
* The configured PDS (Personal Data Server) URL.
|
|
@@ -5892,6 +5780,18 @@ const CollaboratorSchema = zod.z.object({
|
|
|
5892
5780
|
revokedAt: zod.z.string().optional(),
|
|
5893
5781
|
});
|
|
5894
5782
|
|
|
5783
|
+
Object.defineProperty(exports, "AppCertifiedBadgeAward", {
|
|
5784
|
+
enumerable: true,
|
|
5785
|
+
get: function () { return lexicon.AppCertifiedBadgeAward; }
|
|
5786
|
+
});
|
|
5787
|
+
Object.defineProperty(exports, "AppCertifiedBadgeDefinition", {
|
|
5788
|
+
enumerable: true,
|
|
5789
|
+
get: function () { return lexicon.AppCertifiedBadgeDefinition; }
|
|
5790
|
+
});
|
|
5791
|
+
Object.defineProperty(exports, "AppCertifiedBadgeResponse", {
|
|
5792
|
+
enumerable: true,
|
|
5793
|
+
get: function () { return lexicon.AppCertifiedBadgeResponse; }
|
|
5794
|
+
});
|
|
5895
5795
|
Object.defineProperty(exports, "AppCertifiedLocation", {
|
|
5896
5796
|
enumerable: true,
|
|
5897
5797
|
get: function () { return lexicon.AppCertifiedLocation; }
|
|
@@ -5900,17 +5800,29 @@ Object.defineProperty(exports, "ComAtprotoRepoStrongRef", {
|
|
|
5900
5800
|
enumerable: true,
|
|
5901
5801
|
get: function () { return lexicon.ComAtprotoRepoStrongRef; }
|
|
5902
5802
|
});
|
|
5903
|
-
Object.defineProperty(exports, "
|
|
5803
|
+
Object.defineProperty(exports, "HYPERCERTS_NSIDS", {
|
|
5804
|
+
enumerable: true,
|
|
5805
|
+
get: function () { return lexicon.HYPERCERTS_NSIDS; }
|
|
5806
|
+
});
|
|
5807
|
+
Object.defineProperty(exports, "HYPERCERTS_NSIDS_BY_TYPE", {
|
|
5808
|
+
enumerable: true,
|
|
5809
|
+
get: function () { return lexicon.HYPERCERTS_NSIDS_BY_TYPE; }
|
|
5810
|
+
});
|
|
5811
|
+
Object.defineProperty(exports, "HYPERCERTS_SCHEMAS", {
|
|
5812
|
+
enumerable: true,
|
|
5813
|
+
get: function () { return lexicon.HYPERCERTS_SCHEMAS; }
|
|
5814
|
+
});
|
|
5815
|
+
Object.defineProperty(exports, "HYPERCERTS_SCHEMA_DICT", {
|
|
5904
5816
|
enumerable: true,
|
|
5905
|
-
get: function () { return lexicon.
|
|
5817
|
+
get: function () { return lexicon.HYPERCERTS_SCHEMA_DICT; }
|
|
5906
5818
|
});
|
|
5907
|
-
Object.defineProperty(exports, "
|
|
5819
|
+
Object.defineProperty(exports, "OrgHypercertsClaimActivity", {
|
|
5908
5820
|
enumerable: true,
|
|
5909
|
-
get: function () { return lexicon.
|
|
5821
|
+
get: function () { return lexicon.OrgHypercertsClaimActivity; }
|
|
5910
5822
|
});
|
|
5911
|
-
Object.defineProperty(exports, "
|
|
5823
|
+
Object.defineProperty(exports, "OrgHypercertsClaimCollection", {
|
|
5912
5824
|
enumerable: true,
|
|
5913
|
-
get: function () { return lexicon.
|
|
5825
|
+
get: function () { return lexicon.OrgHypercertsClaimCollection; }
|
|
5914
5826
|
});
|
|
5915
5827
|
Object.defineProperty(exports, "OrgHypercertsClaimContribution", {
|
|
5916
5828
|
enumerable: true,
|
|
@@ -5928,29 +5840,17 @@ Object.defineProperty(exports, "OrgHypercertsClaimMeasurement", {
|
|
|
5928
5840
|
enumerable: true,
|
|
5929
5841
|
get: function () { return lexicon.OrgHypercertsClaimMeasurement; }
|
|
5930
5842
|
});
|
|
5931
|
-
Object.defineProperty(exports, "
|
|
5932
|
-
enumerable: true,
|
|
5933
|
-
get: function () { return lexicon.OrgHypercertsClaimRights; }
|
|
5934
|
-
});
|
|
5935
|
-
Object.defineProperty(exports, "OrgHypercertsCollection", {
|
|
5936
|
-
enumerable: true,
|
|
5937
|
-
get: function () { return lexicon.OrgHypercertsCollection; }
|
|
5938
|
-
});
|
|
5939
|
-
Object.defineProperty(exports, "ids", {
|
|
5940
|
-
enumerable: true,
|
|
5941
|
-
get: function () { return lexicon.ids; }
|
|
5942
|
-
});
|
|
5943
|
-
Object.defineProperty(exports, "lexicons", {
|
|
5843
|
+
Object.defineProperty(exports, "OrgHypercertsClaimProject", {
|
|
5944
5844
|
enumerable: true,
|
|
5945
|
-
get: function () { return lexicon.
|
|
5845
|
+
get: function () { return lexicon.OrgHypercertsClaimProject; }
|
|
5946
5846
|
});
|
|
5947
|
-
Object.defineProperty(exports, "
|
|
5847
|
+
Object.defineProperty(exports, "OrgHypercertsClaimRights", {
|
|
5948
5848
|
enumerable: true,
|
|
5949
|
-
get: function () { return lexicon.
|
|
5849
|
+
get: function () { return lexicon.OrgHypercertsClaimRights; }
|
|
5950
5850
|
});
|
|
5951
|
-
Object.defineProperty(exports, "
|
|
5851
|
+
Object.defineProperty(exports, "OrgHypercertsFundingReceipt", {
|
|
5952
5852
|
enumerable: true,
|
|
5953
|
-
get: function () { return lexicon.
|
|
5853
|
+
get: function () { return lexicon.OrgHypercertsFundingReceipt; }
|
|
5954
5854
|
});
|
|
5955
5855
|
Object.defineProperty(exports, "validate", {
|
|
5956
5856
|
enumerable: true,
|
|
@@ -5968,12 +5868,13 @@ exports.BlobPermissionSchema = BlobPermissionSchema;
|
|
|
5968
5868
|
exports.CollaboratorPermissionsSchema = CollaboratorPermissionsSchema;
|
|
5969
5869
|
exports.CollaboratorSchema = CollaboratorSchema;
|
|
5970
5870
|
exports.ConfigurableAgent = ConfigurableAgent;
|
|
5871
|
+
exports.HYPERCERT_COLLECTIONS = HYPERCERT_COLLECTIONS;
|
|
5872
|
+
exports.HYPERCERT_LEXICONS = HYPERCERT_LEXICONS;
|
|
5971
5873
|
exports.IdentityAttrSchema = IdentityAttrSchema;
|
|
5972
5874
|
exports.IdentityPermissionSchema = IdentityPermissionSchema;
|
|
5973
5875
|
exports.InMemorySessionStore = InMemorySessionStore;
|
|
5974
5876
|
exports.InMemoryStateStore = InMemoryStateStore;
|
|
5975
5877
|
exports.IncludePermissionSchema = IncludePermissionSchema;
|
|
5976
|
-
exports.LexiconRegistry = LexiconRegistry;
|
|
5977
5878
|
exports.MimeTypeSchema = MimeTypeSchema;
|
|
5978
5879
|
exports.NetworkError = NetworkError;
|
|
5979
5880
|
exports.NsidSchema = NsidSchema;
|