@hypercerts-org/lexicon 0.5.0-beta.0 → 0.8.0-beta.0
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/package.json +2 -2
- package/src/index.ts +0 -118
- package/src/lexicons.ts +0 -623
- package/src/types/app/certified/defs.ts +0 -18
- package/src/types/app/certified/location.ts +0 -49
- package/src/types/com/atproto/repo/strongRef.ts +0 -31
- package/src/types/org/hypercerts/claim/contribution.ts +0 -50
- package/src/types/org/hypercerts/claim/evaluation.ts +0 -51
- package/src/types/org/hypercerts/claim/evidence.ts +0 -49
- package/src/types/org/hypercerts/claim/measurement.ts +0 -50
- package/src/types/org/hypercerts/claim/rights.ts +0 -44
- package/src/types/org/hypercerts/claim.ts +0 -58
- package/src/types/org/hypercerts/collection.ts +0 -63
- package/src/util.ts +0 -82
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypercerts-org/lexicon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.0",
|
|
4
4
|
"description": "ATProto lexicon definitions and TypeScript types for the Hypercerts protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
22
22
|
"lexicons",
|
|
23
|
-
"
|
|
23
|
+
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"keywords": [
|
|
26
26
|
"hypercerts",
|
package/src/index.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hypercert lexicon definitions for AT Protocol.
|
|
3
|
-
*
|
|
4
|
-
* This module exports the lexicon documents, collection names,
|
|
5
|
-
* and generated TypeScript types for all hypercert-related record types.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import defsLexicon from "../lexicons/app/certified/defs.json";
|
|
11
|
-
import locationLexicon from "../lexicons/app/certified/location.json";
|
|
12
|
-
import claimLexicon from "../lexicons/org/hypercerts/claim.json";
|
|
13
|
-
import contributionLexicon from "../lexicons/org/hypercerts/claim/contribution.json";
|
|
14
|
-
import evaluationLexicon from "../lexicons/org/hypercerts/claim/evaluation.json";
|
|
15
|
-
import evidenceLexicon from "../lexicons/org/hypercerts/claim/evidence.json";
|
|
16
|
-
import measurementLexicon from "../lexicons/org/hypercerts/claim/measurement.json";
|
|
17
|
-
import rightsLexicon from "../lexicons/org/hypercerts/claim/rights.json";
|
|
18
|
-
import strongRefLexicon from "../lexicons/com/atproto/repo/strongRef.json";
|
|
19
|
-
import collectionLexicon from "../lexicons/org/hypercerts/collection.json";
|
|
20
|
-
import type { LexiconDoc } from "@atproto/lexicon";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* All hypercert-related lexicons for registration with AT Protocol Agent.
|
|
24
|
-
*
|
|
25
|
-
* This array contains all lexicon documents needed to work with
|
|
26
|
-
* hypercert records.
|
|
27
|
-
*/
|
|
28
|
-
export const HYPERCERT_LEXICONS: LexiconDoc[] = [
|
|
29
|
-
defsLexicon as LexiconDoc,
|
|
30
|
-
locationLexicon as LexiconDoc,
|
|
31
|
-
claimLexicon as LexiconDoc,
|
|
32
|
-
rightsLexicon as LexiconDoc,
|
|
33
|
-
contributionLexicon as LexiconDoc,
|
|
34
|
-
measurementLexicon as LexiconDoc,
|
|
35
|
-
evaluationLexicon as LexiconDoc,
|
|
36
|
-
evidenceLexicon as LexiconDoc,
|
|
37
|
-
collectionLexicon as LexiconDoc,
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Collection NSIDs (Namespaced Identifiers) for hypercert records.
|
|
42
|
-
*
|
|
43
|
-
* Use these constants when performing record operations to ensure
|
|
44
|
-
* correct collection names.
|
|
45
|
-
*/
|
|
46
|
-
export const HYPERCERT_COLLECTIONS = {
|
|
47
|
-
/**
|
|
48
|
-
* Main hypercert claim record collection.
|
|
49
|
-
*/
|
|
50
|
-
CLAIM: "org.hypercerts.claim",
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Rights record collection.
|
|
54
|
-
*/
|
|
55
|
-
RIGHTS: "org.hypercerts.claim.rights",
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Location record collection (shared certified lexicon).
|
|
59
|
-
*/
|
|
60
|
-
LOCATION: "app.certified.location",
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Contribution record collection.
|
|
64
|
-
*/
|
|
65
|
-
CONTRIBUTION: "org.hypercerts.claim.contribution",
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Measurement record collection.
|
|
69
|
-
*/
|
|
70
|
-
MEASUREMENT: "org.hypercerts.claim.measurement",
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Evaluation record collection.
|
|
74
|
-
*/
|
|
75
|
-
EVALUATION: "org.hypercerts.claim.evaluation",
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Evidence record collection.
|
|
79
|
-
*/
|
|
80
|
-
EVIDENCE: "org.hypercerts.claim.evidence",
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Collection record collection (groups of hypercerts).
|
|
84
|
-
*/
|
|
85
|
-
COLLECTION: "org.hypercerts.collection",
|
|
86
|
-
} as const;
|
|
87
|
-
|
|
88
|
-
// Re-export individual lexicons for direct access
|
|
89
|
-
export {
|
|
90
|
-
defsLexicon,
|
|
91
|
-
locationLexicon,
|
|
92
|
-
strongRefLexicon,
|
|
93
|
-
claimLexicon,
|
|
94
|
-
contributionLexicon,
|
|
95
|
-
evaluationLexicon,
|
|
96
|
-
evidenceLexicon,
|
|
97
|
-
measurementLexicon,
|
|
98
|
-
rightsLexicon,
|
|
99
|
-
collectionLexicon,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Re-export generated types as namespaces (avoiding conflicts)
|
|
103
|
-
export * as AppCertifiedDefs from "./types/app/certified/defs.js";
|
|
104
|
-
export * as AppCertifiedLocation from "./types/app/certified/location.js";
|
|
105
|
-
export * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js";
|
|
106
|
-
export * as OrgHypercertsClaim from "./types/org/hypercerts/claim.js";
|
|
107
|
-
export * as OrgHypercertsClaimContribution from "./types/org/hypercerts/claim/contribution.js";
|
|
108
|
-
export * as OrgHypercertsClaimEvaluation from "./types/org/hypercerts/claim/evaluation.js";
|
|
109
|
-
export * as OrgHypercertsClaimEvidence from "./types/org/hypercerts/claim/evidence.js";
|
|
110
|
-
export * as OrgHypercertsClaimMeasurement from "./types/org/hypercerts/claim/measurement.js";
|
|
111
|
-
export * as OrgHypercertsClaimRights from "./types/org/hypercerts/claim/rights.js";
|
|
112
|
-
export * as OrgHypercertsCollection from "./types/org/hypercerts/collection.js";
|
|
113
|
-
|
|
114
|
-
// Re-export lexicon schemas, validation, and IDs
|
|
115
|
-
export { schemas, schemaDict, lexicons, validate, ids } from "./lexicons.js";
|
|
116
|
-
|
|
117
|
-
// Re-export utilities
|
|
118
|
-
export * from "./util.js";
|
package/src/lexicons.ts
DELETED
|
@@ -1,623 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
type LexiconDoc,
|
|
6
|
-
Lexicons,
|
|
7
|
-
ValidationError,
|
|
8
|
-
type ValidationResult,
|
|
9
|
-
} from '@atproto/lexicon'
|
|
10
|
-
import { type $Typed, is$typed, maybe$typed } from './util.js'
|
|
11
|
-
|
|
12
|
-
export const schemaDict = {
|
|
13
|
-
AppCertifiedDefs: {
|
|
14
|
-
lexicon: 1,
|
|
15
|
-
id: 'app.certified.defs',
|
|
16
|
-
defs: {
|
|
17
|
-
uri: {
|
|
18
|
-
type: 'string',
|
|
19
|
-
format: 'uri',
|
|
20
|
-
maxGraphemes: 1000,
|
|
21
|
-
description: 'URI to external data',
|
|
22
|
-
},
|
|
23
|
-
smallBlob: {
|
|
24
|
-
type: 'blob',
|
|
25
|
-
accept: ['*/*'],
|
|
26
|
-
maxSize: 10485760,
|
|
27
|
-
description: 'Blob to external data (up to 10MB)',
|
|
28
|
-
},
|
|
29
|
-
largeBlob: {
|
|
30
|
-
type: 'blob',
|
|
31
|
-
accept: ['*/*'],
|
|
32
|
-
maxSize: 104857600,
|
|
33
|
-
description: 'Blob to external data (up to 100MB)',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
AppCertifiedLocation: {
|
|
38
|
-
lexicon: 1,
|
|
39
|
-
id: 'app.certified.location',
|
|
40
|
-
defs: {
|
|
41
|
-
main: {
|
|
42
|
-
type: 'record',
|
|
43
|
-
description: 'A location reference',
|
|
44
|
-
key: 'any',
|
|
45
|
-
record: {
|
|
46
|
-
type: 'object',
|
|
47
|
-
required: [
|
|
48
|
-
'lpVersion',
|
|
49
|
-
'srs',
|
|
50
|
-
'locationType',
|
|
51
|
-
'location',
|
|
52
|
-
'createdAt',
|
|
53
|
-
],
|
|
54
|
-
properties: {
|
|
55
|
-
lpVersion: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
description: 'The version of the Location Protocol',
|
|
58
|
-
maxLength: 10,
|
|
59
|
-
},
|
|
60
|
-
srs: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
format: 'uri',
|
|
63
|
-
description:
|
|
64
|
-
'The Spatial Reference System URI (e.g., http://www.opengis.net/def/crs/OGC/1.3/CRS84) that defines the coordinate system.',
|
|
65
|
-
maxLength: 100,
|
|
66
|
-
},
|
|
67
|
-
locationType: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
description:
|
|
70
|
-
'An identifier for the format of the location data (e.g., coordinate-decimal, geojson-point)',
|
|
71
|
-
knownValues: ['coordinate-decimal', 'geojson-point'],
|
|
72
|
-
maxLength: 20,
|
|
73
|
-
},
|
|
74
|
-
location: {
|
|
75
|
-
type: 'union',
|
|
76
|
-
refs: [
|
|
77
|
-
'lex:app.certified.defs#uri',
|
|
78
|
-
'lex:app.certified.defs#smallBlob',
|
|
79
|
-
],
|
|
80
|
-
description:
|
|
81
|
-
'The location of where the work was performed as a URI or blob.',
|
|
82
|
-
},
|
|
83
|
-
name: {
|
|
84
|
-
type: 'string',
|
|
85
|
-
description: 'Optional name for this location',
|
|
86
|
-
maxLength: 1000,
|
|
87
|
-
maxGraphemes: 100,
|
|
88
|
-
},
|
|
89
|
-
description: {
|
|
90
|
-
type: 'string',
|
|
91
|
-
description: 'Optional description for this location',
|
|
92
|
-
maxLength: 2000,
|
|
93
|
-
maxGraphemes: 500,
|
|
94
|
-
},
|
|
95
|
-
createdAt: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
format: 'datetime',
|
|
98
|
-
description:
|
|
99
|
-
'Client-declared timestamp when this record was originally created',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
ComAtprotoRepoStrongRef: {
|
|
107
|
-
lexicon: 1,
|
|
108
|
-
id: 'com.atproto.repo.strongRef',
|
|
109
|
-
description: 'A URI with a content-hash fingerprint.',
|
|
110
|
-
defs: {
|
|
111
|
-
main: {
|
|
112
|
-
type: 'object',
|
|
113
|
-
required: ['uri', 'cid'],
|
|
114
|
-
properties: {
|
|
115
|
-
uri: {
|
|
116
|
-
type: 'string',
|
|
117
|
-
format: 'at-uri',
|
|
118
|
-
},
|
|
119
|
-
cid: {
|
|
120
|
-
type: 'string',
|
|
121
|
-
format: 'cid',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
OrgHypercertsClaim: {
|
|
128
|
-
lexicon: 1,
|
|
129
|
-
id: 'org.hypercerts.claim',
|
|
130
|
-
defs: {
|
|
131
|
-
main: {
|
|
132
|
-
type: 'record',
|
|
133
|
-
description: 'A hypercert record tracking impact work.',
|
|
134
|
-
key: 'any',
|
|
135
|
-
record: {
|
|
136
|
-
type: 'object',
|
|
137
|
-
required: [
|
|
138
|
-
'title',
|
|
139
|
-
'shortDescription',
|
|
140
|
-
'createdAt',
|
|
141
|
-
'workScope',
|
|
142
|
-
'workTimeFrameFrom',
|
|
143
|
-
'workTimeFrameTo',
|
|
144
|
-
],
|
|
145
|
-
properties: {
|
|
146
|
-
title: {
|
|
147
|
-
type: 'string',
|
|
148
|
-
description: 'Title of the hypercert',
|
|
149
|
-
maxLength: 256,
|
|
150
|
-
},
|
|
151
|
-
shortDescription: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
description: 'Short blurb of the impact work done.',
|
|
154
|
-
maxLength: 3000,
|
|
155
|
-
maxGraphemes: 300,
|
|
156
|
-
},
|
|
157
|
-
description: {
|
|
158
|
-
type: 'string',
|
|
159
|
-
description:
|
|
160
|
-
'Optional longer description of the impact work done.',
|
|
161
|
-
maxLength: 30000,
|
|
162
|
-
maxGraphemes: 3000,
|
|
163
|
-
},
|
|
164
|
-
image: {
|
|
165
|
-
type: 'union',
|
|
166
|
-
refs: [
|
|
167
|
-
'lex:app.certified.defs#uri',
|
|
168
|
-
'lex:app.certified.defs#smallBlob',
|
|
169
|
-
],
|
|
170
|
-
description:
|
|
171
|
-
'The hypercert visual representation as a URI or blob',
|
|
172
|
-
},
|
|
173
|
-
workScope: {
|
|
174
|
-
type: 'string',
|
|
175
|
-
description: 'Scope of the work performed',
|
|
176
|
-
maxLength: 5000,
|
|
177
|
-
maxGraphemes: 1000,
|
|
178
|
-
},
|
|
179
|
-
workTimeFrameFrom: {
|
|
180
|
-
type: 'string',
|
|
181
|
-
format: 'datetime',
|
|
182
|
-
description: 'When the work began',
|
|
183
|
-
},
|
|
184
|
-
workTimeFrameTo: {
|
|
185
|
-
type: 'string',
|
|
186
|
-
format: 'datetime',
|
|
187
|
-
description: 'When the work ended',
|
|
188
|
-
},
|
|
189
|
-
evidence: {
|
|
190
|
-
type: 'array',
|
|
191
|
-
description:
|
|
192
|
-
'Supporting evidence, documentation, or external data URIs',
|
|
193
|
-
items: {
|
|
194
|
-
type: 'ref',
|
|
195
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
196
|
-
description:
|
|
197
|
-
'A strong reference to the evidence that supports this impact claim. The record referenced must conform with the org.hypercerts.claim.evidence lexicon',
|
|
198
|
-
},
|
|
199
|
-
maxLength: 100,
|
|
200
|
-
},
|
|
201
|
-
contributions: {
|
|
202
|
-
type: 'array',
|
|
203
|
-
description:
|
|
204
|
-
'A strong reference to the contributions done to create the impact in the hypercerts. The record referenced must conform with the lexicon org.hypercerts.claim.contributions',
|
|
205
|
-
items: {
|
|
206
|
-
type: 'ref',
|
|
207
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
rights: {
|
|
211
|
-
type: 'ref',
|
|
212
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
213
|
-
description:
|
|
214
|
-
'A strong reference to the rights that this hypercert has. The record referenced must conform with the lexicon org.hypercerts.claim.rights',
|
|
215
|
-
},
|
|
216
|
-
location: {
|
|
217
|
-
type: 'ref',
|
|
218
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
219
|
-
description:
|
|
220
|
-
'A strong reference to the location where the work for done hypercert was located. The record referenced must conform with the lexicon org.hypercerts.claim.location',
|
|
221
|
-
},
|
|
222
|
-
createdAt: {
|
|
223
|
-
type: 'string',
|
|
224
|
-
format: 'datetime',
|
|
225
|
-
description:
|
|
226
|
-
'Client-declared timestamp when this record was originally created',
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
OrgHypercertsClaimContribution: {
|
|
234
|
-
lexicon: 1,
|
|
235
|
-
id: 'org.hypercerts.claim.contribution',
|
|
236
|
-
defs: {
|
|
237
|
-
main: {
|
|
238
|
-
type: 'record',
|
|
239
|
-
description: "A contribution made toward a hypercert's impact.",
|
|
240
|
-
key: 'any',
|
|
241
|
-
record: {
|
|
242
|
-
type: 'object',
|
|
243
|
-
required: ['hypercert', 'contributors', 'createdAt'],
|
|
244
|
-
properties: {
|
|
245
|
-
hypercert: {
|
|
246
|
-
type: 'ref',
|
|
247
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
248
|
-
description:
|
|
249
|
-
'A strong reference to the hypercert this contribution is for. The record referenced must conform with the lexicon org.hypercerts.claim.',
|
|
250
|
-
},
|
|
251
|
-
role: {
|
|
252
|
-
type: 'string',
|
|
253
|
-
description: 'Role or title of the contributor(s).',
|
|
254
|
-
maxLength: 100,
|
|
255
|
-
},
|
|
256
|
-
contributors: {
|
|
257
|
-
type: 'array',
|
|
258
|
-
description:
|
|
259
|
-
'List of the contributors (names, pseudonyms, or DIDs). If multiple contributors are stored in the same hypercertContribution, then they would have the exact same role.',
|
|
260
|
-
items: {
|
|
261
|
-
type: 'string',
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
description: {
|
|
265
|
-
type: 'string',
|
|
266
|
-
description: 'What the contribution concretely achieved',
|
|
267
|
-
maxLength: 2000,
|
|
268
|
-
maxGraphemes: 500,
|
|
269
|
-
},
|
|
270
|
-
workTimeframeFrom: {
|
|
271
|
-
type: 'string',
|
|
272
|
-
format: 'datetime',
|
|
273
|
-
description:
|
|
274
|
-
'When this contribution started. This should be a subset of the hypercert timeframe.',
|
|
275
|
-
},
|
|
276
|
-
workTimeframeTo: {
|
|
277
|
-
type: 'string',
|
|
278
|
-
format: 'datetime',
|
|
279
|
-
description:
|
|
280
|
-
'When this contribution finished. This should be a subset of the hypercert timeframe.',
|
|
281
|
-
},
|
|
282
|
-
createdAt: {
|
|
283
|
-
type: 'string',
|
|
284
|
-
format: 'datetime',
|
|
285
|
-
description:
|
|
286
|
-
'Client-declared timestamp when this record was originally created',
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
OrgHypercertsClaimEvaluation: {
|
|
294
|
-
lexicon: 1,
|
|
295
|
-
id: 'org.hypercerts.claim.evaluation',
|
|
296
|
-
defs: {
|
|
297
|
-
main: {
|
|
298
|
-
type: 'record',
|
|
299
|
-
description: 'An evaluation of a hypercert or other claim',
|
|
300
|
-
key: 'tid',
|
|
301
|
-
record: {
|
|
302
|
-
type: 'object',
|
|
303
|
-
required: ['subject', 'evaluators', 'summary', 'createdAt'],
|
|
304
|
-
properties: {
|
|
305
|
-
subject: {
|
|
306
|
-
type: 'ref',
|
|
307
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
308
|
-
description:
|
|
309
|
-
'A strong reference to the evaluated claim. (e.g measurement, hypercert, contribution, etc)',
|
|
310
|
-
},
|
|
311
|
-
evaluators: {
|
|
312
|
-
type: 'array',
|
|
313
|
-
description: 'DIDs of the evaluators',
|
|
314
|
-
items: {
|
|
315
|
-
type: 'string',
|
|
316
|
-
format: 'did',
|
|
317
|
-
},
|
|
318
|
-
maxLength: 100,
|
|
319
|
-
},
|
|
320
|
-
evaluations: {
|
|
321
|
-
type: 'array',
|
|
322
|
-
description:
|
|
323
|
-
'Evaluation data (URIs or blobs) containing detailed reports or methodology',
|
|
324
|
-
items: {
|
|
325
|
-
type: 'union',
|
|
326
|
-
refs: [
|
|
327
|
-
'lex:app.certified.defs#uri',
|
|
328
|
-
'lex:app.certified.defs#smallBlob',
|
|
329
|
-
],
|
|
330
|
-
},
|
|
331
|
-
maxLength: 100,
|
|
332
|
-
},
|
|
333
|
-
summary: {
|
|
334
|
-
type: 'string',
|
|
335
|
-
description: 'Brief evaluation summary',
|
|
336
|
-
maxLength: 5000,
|
|
337
|
-
maxGraphemes: 1000,
|
|
338
|
-
},
|
|
339
|
-
createdAt: {
|
|
340
|
-
type: 'string',
|
|
341
|
-
format: 'datetime',
|
|
342
|
-
description:
|
|
343
|
-
'Client-declared timestamp when this record was originally created',
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
OrgHypercertsClaimEvidence: {
|
|
351
|
-
lexicon: 1,
|
|
352
|
-
id: 'org.hypercerts.claim.evidence',
|
|
353
|
-
defs: {
|
|
354
|
-
main: {
|
|
355
|
-
type: 'record',
|
|
356
|
-
description: 'A piece of evidence supporting a hypercert claim',
|
|
357
|
-
key: 'any',
|
|
358
|
-
record: {
|
|
359
|
-
type: 'object',
|
|
360
|
-
required: ['content', 'shortDescription', 'createdAt'],
|
|
361
|
-
properties: {
|
|
362
|
-
content: {
|
|
363
|
-
type: 'union',
|
|
364
|
-
refs: [
|
|
365
|
-
'lex:app.certified.defs#uri',
|
|
366
|
-
'lex:app.certified.defs#smallBlob',
|
|
367
|
-
],
|
|
368
|
-
description:
|
|
369
|
-
'A piece of evidence (URI or blobs) supporting a hypercert claim',
|
|
370
|
-
},
|
|
371
|
-
title: {
|
|
372
|
-
type: 'string',
|
|
373
|
-
maxLength: 256,
|
|
374
|
-
description:
|
|
375
|
-
'Optional title to describe the nature of the evidence',
|
|
376
|
-
},
|
|
377
|
-
shortDescription: {
|
|
378
|
-
type: 'string',
|
|
379
|
-
maxLength: 3000,
|
|
380
|
-
maxGraphemes: 300,
|
|
381
|
-
description:
|
|
382
|
-
'Short description explaining what this evidence demonstrates or proves',
|
|
383
|
-
},
|
|
384
|
-
description: {
|
|
385
|
-
type: 'string',
|
|
386
|
-
description:
|
|
387
|
-
'Optional longer description describing the impact claim evidence.',
|
|
388
|
-
maxLength: 30000,
|
|
389
|
-
maxGraphemes: 3000,
|
|
390
|
-
},
|
|
391
|
-
createdAt: {
|
|
392
|
-
type: 'string',
|
|
393
|
-
format: 'datetime',
|
|
394
|
-
description:
|
|
395
|
-
'Client-declared timestamp when this hypercert claim was originally created',
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
OrgHypercertsClaimMeasurement: {
|
|
403
|
-
lexicon: 1,
|
|
404
|
-
id: 'org.hypercerts.claim.measurement',
|
|
405
|
-
defs: {
|
|
406
|
-
main: {
|
|
407
|
-
type: 'record',
|
|
408
|
-
description: 'External measurement data supporting a hypercert claim',
|
|
409
|
-
key: 'tid',
|
|
410
|
-
record: {
|
|
411
|
-
type: 'object',
|
|
412
|
-
required: ['hypercert', 'measurers', 'metric', 'value', 'createdAt'],
|
|
413
|
-
properties: {
|
|
414
|
-
hypercert: {
|
|
415
|
-
type: 'ref',
|
|
416
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
417
|
-
description:
|
|
418
|
-
'A strong reference to the hypercert that this measurement is for. The record referenced must conform with the lexicon org.hypercerts.claim.',
|
|
419
|
-
},
|
|
420
|
-
measurers: {
|
|
421
|
-
type: 'array',
|
|
422
|
-
description:
|
|
423
|
-
'DIDs of the entity (or entities) that measured this data',
|
|
424
|
-
items: {
|
|
425
|
-
type: 'string',
|
|
426
|
-
format: 'did',
|
|
427
|
-
},
|
|
428
|
-
maxLength: 100,
|
|
429
|
-
},
|
|
430
|
-
metric: {
|
|
431
|
-
type: 'string',
|
|
432
|
-
description: 'The metric being measured',
|
|
433
|
-
maxLength: 500,
|
|
434
|
-
},
|
|
435
|
-
value: {
|
|
436
|
-
type: 'string',
|
|
437
|
-
description: 'The measured value',
|
|
438
|
-
maxLength: 500,
|
|
439
|
-
},
|
|
440
|
-
measurementMethodURI: {
|
|
441
|
-
type: 'string',
|
|
442
|
-
format: 'uri',
|
|
443
|
-
description:
|
|
444
|
-
'URI to methodology documentation, standard protocol, or measurement procedure',
|
|
445
|
-
},
|
|
446
|
-
evidenceURI: {
|
|
447
|
-
type: 'array',
|
|
448
|
-
description: 'URIs to supporting evidence or data',
|
|
449
|
-
items: {
|
|
450
|
-
type: 'string',
|
|
451
|
-
format: 'uri',
|
|
452
|
-
},
|
|
453
|
-
maxLength: 50,
|
|
454
|
-
},
|
|
455
|
-
createdAt: {
|
|
456
|
-
type: 'string',
|
|
457
|
-
format: 'datetime',
|
|
458
|
-
description:
|
|
459
|
-
'Client-declared timestamp when this record was originally created',
|
|
460
|
-
},
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
},
|
|
466
|
-
OrgHypercertsClaimRights: {
|
|
467
|
-
lexicon: 1,
|
|
468
|
-
id: 'org.hypercerts.claim.rights',
|
|
469
|
-
defs: {
|
|
470
|
-
main: {
|
|
471
|
-
type: 'record',
|
|
472
|
-
description:
|
|
473
|
-
'Describes the rights that a user has with a hypercert, such as whether it can be sold, transferred, and under what conditions.',
|
|
474
|
-
key: 'any',
|
|
475
|
-
record: {
|
|
476
|
-
type: 'object',
|
|
477
|
-
required: [
|
|
478
|
-
'rightsName',
|
|
479
|
-
'rightsType',
|
|
480
|
-
'rightsDescription',
|
|
481
|
-
'createdAt',
|
|
482
|
-
],
|
|
483
|
-
properties: {
|
|
484
|
-
rightsName: {
|
|
485
|
-
type: 'string',
|
|
486
|
-
description: 'Full name of the rights',
|
|
487
|
-
maxLength: 100,
|
|
488
|
-
},
|
|
489
|
-
rightsType: {
|
|
490
|
-
type: 'string',
|
|
491
|
-
description: 'Short rights identifier for easier search',
|
|
492
|
-
maxLength: 10,
|
|
493
|
-
},
|
|
494
|
-
rightsDescription: {
|
|
495
|
-
type: 'string',
|
|
496
|
-
description: 'Description of the rights of this hypercert',
|
|
497
|
-
},
|
|
498
|
-
createdAt: {
|
|
499
|
-
type: 'string',
|
|
500
|
-
format: 'datetime',
|
|
501
|
-
description:
|
|
502
|
-
'Client-declared timestamp when this record was originally created',
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
},
|
|
508
|
-
},
|
|
509
|
-
OrgHypercertsCollection: {
|
|
510
|
-
lexicon: 1,
|
|
511
|
-
id: 'org.hypercerts.collection',
|
|
512
|
-
defs: {
|
|
513
|
-
main: {
|
|
514
|
-
type: 'record',
|
|
515
|
-
description:
|
|
516
|
-
'A collection/group of hypercerts that have a specific property.',
|
|
517
|
-
key: 'tid',
|
|
518
|
-
record: {
|
|
519
|
-
type: 'object',
|
|
520
|
-
required: ['title', 'claims', 'createdAt'],
|
|
521
|
-
properties: {
|
|
522
|
-
title: {
|
|
523
|
-
type: 'string',
|
|
524
|
-
description: 'The title of this collection',
|
|
525
|
-
maxLength: 800,
|
|
526
|
-
maxGraphemes: 80,
|
|
527
|
-
},
|
|
528
|
-
shortDescription: {
|
|
529
|
-
type: 'string',
|
|
530
|
-
maxLength: 3000,
|
|
531
|
-
maxGraphemes: 300,
|
|
532
|
-
description: 'A short description of this collection',
|
|
533
|
-
},
|
|
534
|
-
coverPhoto: {
|
|
535
|
-
type: 'union',
|
|
536
|
-
refs: [
|
|
537
|
-
'lex:app.certified.defs#uri',
|
|
538
|
-
'lex:app.certified.defs#smallBlob',
|
|
539
|
-
],
|
|
540
|
-
description:
|
|
541
|
-
'The cover photo of this collection (either in URI format or in a blob).',
|
|
542
|
-
},
|
|
543
|
-
claims: {
|
|
544
|
-
type: 'array',
|
|
545
|
-
description:
|
|
546
|
-
'Array of claims with their associated weights in this collection',
|
|
547
|
-
items: {
|
|
548
|
-
type: 'ref',
|
|
549
|
-
ref: 'lex:org.hypercerts.collection#claimItem',
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
createdAt: {
|
|
553
|
-
type: 'string',
|
|
554
|
-
format: 'datetime',
|
|
555
|
-
description:
|
|
556
|
-
'Client-declared timestamp when this record was originally created',
|
|
557
|
-
},
|
|
558
|
-
},
|
|
559
|
-
},
|
|
560
|
-
},
|
|
561
|
-
claimItem: {
|
|
562
|
-
type: 'object',
|
|
563
|
-
required: ['claim', 'weight'],
|
|
564
|
-
properties: {
|
|
565
|
-
claim: {
|
|
566
|
-
type: 'ref',
|
|
567
|
-
ref: 'lex:com.atproto.repo.strongRef',
|
|
568
|
-
description:
|
|
569
|
-
'A strong reference to a hypercert claim record. This claim must conform to the lexicon org.hypercerts.claim.record',
|
|
570
|
-
},
|
|
571
|
-
weight: {
|
|
572
|
-
type: 'string',
|
|
573
|
-
description:
|
|
574
|
-
'The weight/importance of this hypercert claim in the collection (a percentage from 0-100, stored as a string to avoid float precision issues). The total claim weights should add up to 100.',
|
|
575
|
-
},
|
|
576
|
-
},
|
|
577
|
-
},
|
|
578
|
-
},
|
|
579
|
-
},
|
|
580
|
-
} as const satisfies Record<string, LexiconDoc>
|
|
581
|
-
export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]
|
|
582
|
-
export const lexicons: Lexicons = new Lexicons(schemas)
|
|
583
|
-
|
|
584
|
-
export function validate<T extends { $type: string }>(
|
|
585
|
-
v: unknown,
|
|
586
|
-
id: string,
|
|
587
|
-
hash: string,
|
|
588
|
-
requiredType: true,
|
|
589
|
-
): ValidationResult<T>
|
|
590
|
-
export function validate<T extends { $type?: string }>(
|
|
591
|
-
v: unknown,
|
|
592
|
-
id: string,
|
|
593
|
-
hash: string,
|
|
594
|
-
requiredType?: false,
|
|
595
|
-
): ValidationResult<T>
|
|
596
|
-
export function validate(
|
|
597
|
-
v: unknown,
|
|
598
|
-
id: string,
|
|
599
|
-
hash: string,
|
|
600
|
-
requiredType?: boolean,
|
|
601
|
-
): ValidationResult {
|
|
602
|
-
return (requiredType ? is$typed : maybe$typed)(v, id, hash)
|
|
603
|
-
? lexicons.validate(`${id}#${hash}`, v)
|
|
604
|
-
: {
|
|
605
|
-
success: false,
|
|
606
|
-
error: new ValidationError(
|
|
607
|
-
`Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`,
|
|
608
|
-
),
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
export const ids = {
|
|
613
|
-
AppCertifiedDefs: 'app.certified.defs',
|
|
614
|
-
AppCertifiedLocation: 'app.certified.location',
|
|
615
|
-
ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
|
|
616
|
-
OrgHypercertsClaim: 'org.hypercerts.claim',
|
|
617
|
-
OrgHypercertsClaimContribution: 'org.hypercerts.claim.contribution',
|
|
618
|
-
OrgHypercertsClaimEvaluation: 'org.hypercerts.claim.evaluation',
|
|
619
|
-
OrgHypercertsClaimEvidence: 'org.hypercerts.claim.evidence',
|
|
620
|
-
OrgHypercertsClaimMeasurement: 'org.hypercerts.claim.measurement',
|
|
621
|
-
OrgHypercertsClaimRights: 'org.hypercerts.claim.rights',
|
|
622
|
-
OrgHypercertsCollection: 'org.hypercerts.collection',
|
|
623
|
-
} as const
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../lexicons'
|
|
7
|
-
import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
|
|
8
|
-
|
|
9
|
-
const is$typed = _is$typed,
|
|
10
|
-
validate = _validate
|
|
11
|
-
const id = 'app.certified.defs'
|
|
12
|
-
|
|
13
|
-
/** URI to external data */
|
|
14
|
-
export type Uri = string
|
|
15
|
-
/** Blob to external data (up to 10MB) */
|
|
16
|
-
export type SmallBlob = BlobRef
|
|
17
|
-
/** Blob to external data (up to 100MB) */
|
|
18
|
-
export type LargeBlob = BlobRef
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../lexicons'
|
|
7
|
-
import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
|
|
8
|
-
import type * as AppCertifiedDefs from './defs.js'
|
|
9
|
-
|
|
10
|
-
const is$typed = _is$typed,
|
|
11
|
-
validate = _validate
|
|
12
|
-
const id = 'app.certified.location'
|
|
13
|
-
|
|
14
|
-
export interface Main {
|
|
15
|
-
$type: 'app.certified.location'
|
|
16
|
-
/** The version of the Location Protocol */
|
|
17
|
-
lpVersion: string
|
|
18
|
-
/** The Spatial Reference System URI (e.g., http://www.opengis.net/def/crs/OGC/1.3/CRS84) that defines the coordinate system. */
|
|
19
|
-
srs: string
|
|
20
|
-
/** An identifier for the format of the location data (e.g., coordinate-decimal, geojson-point) */
|
|
21
|
-
locationType: 'coordinate-decimal' | 'geojson-point' | (string & {})
|
|
22
|
-
location:
|
|
23
|
-
| $Typed<AppCertifiedDefs.Uri>
|
|
24
|
-
| $Typed<AppCertifiedDefs.SmallBlob>
|
|
25
|
-
| { $type: string }
|
|
26
|
-
/** Optional name for this location */
|
|
27
|
-
name?: string
|
|
28
|
-
/** Optional description for this location */
|
|
29
|
-
description?: string
|
|
30
|
-
/** Client-declared timestamp when this record was originally created */
|
|
31
|
-
createdAt: string
|
|
32
|
-
[k: string]: unknown
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const hashMain = 'main'
|
|
36
|
-
|
|
37
|
-
export function isMain<V>(v: V) {
|
|
38
|
-
return is$typed(v, id, hashMain)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function validateMain<V>(v: V) {
|
|
42
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
type Main as Record,
|
|
47
|
-
isMain as isRecord,
|
|
48
|
-
validateMain as validateRecord,
|
|
49
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
|
|
13
|
-
const is$typed = _is$typed,
|
|
14
|
-
validate = _validate
|
|
15
|
-
const id = 'com.atproto.repo.strongRef'
|
|
16
|
-
|
|
17
|
-
export interface Main {
|
|
18
|
-
$type?: 'com.atproto.repo.strongRef'
|
|
19
|
-
uri: string
|
|
20
|
-
cid: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const hashMain = 'main'
|
|
24
|
-
|
|
25
|
-
export function isMain<V>(v: V) {
|
|
26
|
-
return is$typed(v, id, hashMain)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function validateMain<V>(v: V) {
|
|
30
|
-
return validate<Main & V>(v, id, hashMain)
|
|
31
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js'
|
|
13
|
-
|
|
14
|
-
const is$typed = _is$typed,
|
|
15
|
-
validate = _validate
|
|
16
|
-
const id = 'org.hypercerts.claim.contribution'
|
|
17
|
-
|
|
18
|
-
export interface Main {
|
|
19
|
-
$type: 'org.hypercerts.claim.contribution'
|
|
20
|
-
hypercert: ComAtprotoRepoStrongRef.Main
|
|
21
|
-
/** Role or title of the contributor(s). */
|
|
22
|
-
role?: string
|
|
23
|
-
/** List of the contributors (names, pseudonyms, or DIDs). If multiple contributors are stored in the same hypercertContribution, then they would have the exact same role. */
|
|
24
|
-
contributors: string[]
|
|
25
|
-
/** What the contribution concretely achieved */
|
|
26
|
-
description?: string
|
|
27
|
-
/** When this contribution started. This should be a subset of the hypercert timeframe. */
|
|
28
|
-
workTimeframeFrom?: string
|
|
29
|
-
/** When this contribution finished. This should be a subset of the hypercert timeframe. */
|
|
30
|
-
workTimeframeTo?: string
|
|
31
|
-
/** Client-declared timestamp when this record was originally created */
|
|
32
|
-
createdAt: string
|
|
33
|
-
[k: string]: unknown
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const hashMain = 'main'
|
|
37
|
-
|
|
38
|
-
export function isMain<V>(v: V) {
|
|
39
|
-
return is$typed(v, id, hashMain)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function validateMain<V>(v: V) {
|
|
43
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
type Main as Record,
|
|
48
|
-
isMain as isRecord,
|
|
49
|
-
validateMain as validateRecord,
|
|
50
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js'
|
|
13
|
-
import type * as AppCertifiedDefs from '../../../app/certified/defs.js'
|
|
14
|
-
|
|
15
|
-
const is$typed = _is$typed,
|
|
16
|
-
validate = _validate
|
|
17
|
-
const id = 'org.hypercerts.claim.evaluation'
|
|
18
|
-
|
|
19
|
-
export interface Main {
|
|
20
|
-
$type: 'org.hypercerts.claim.evaluation'
|
|
21
|
-
subject: ComAtprotoRepoStrongRef.Main
|
|
22
|
-
/** DIDs of the evaluators */
|
|
23
|
-
evaluators: string[]
|
|
24
|
-
/** Evaluation data (URIs or blobs) containing detailed reports or methodology */
|
|
25
|
-
evaluations?: (
|
|
26
|
-
| $Typed<AppCertifiedDefs.Uri>
|
|
27
|
-
| $Typed<AppCertifiedDefs.SmallBlob>
|
|
28
|
-
| { $type: string }
|
|
29
|
-
)[]
|
|
30
|
-
/** Brief evaluation summary */
|
|
31
|
-
summary: string
|
|
32
|
-
/** Client-declared timestamp when this record was originally created */
|
|
33
|
-
createdAt: string
|
|
34
|
-
[k: string]: unknown
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const hashMain = 'main'
|
|
38
|
-
|
|
39
|
-
export function isMain<V>(v: V) {
|
|
40
|
-
return is$typed(v, id, hashMain)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function validateMain<V>(v: V) {
|
|
44
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export {
|
|
48
|
-
type Main as Record,
|
|
49
|
-
isMain as isRecord,
|
|
50
|
-
validateMain as validateRecord,
|
|
51
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
import type * as AppCertifiedDefs from '../../../app/certified/defs.js'
|
|
13
|
-
|
|
14
|
-
const is$typed = _is$typed,
|
|
15
|
-
validate = _validate
|
|
16
|
-
const id = 'org.hypercerts.claim.evidence'
|
|
17
|
-
|
|
18
|
-
export interface Main {
|
|
19
|
-
$type: 'org.hypercerts.claim.evidence'
|
|
20
|
-
content:
|
|
21
|
-
| $Typed<AppCertifiedDefs.Uri>
|
|
22
|
-
| $Typed<AppCertifiedDefs.SmallBlob>
|
|
23
|
-
| { $type: string }
|
|
24
|
-
/** Optional title to describe the nature of the evidence */
|
|
25
|
-
title?: string
|
|
26
|
-
/** Short description explaining what this evidence demonstrates or proves */
|
|
27
|
-
shortDescription: string
|
|
28
|
-
/** Optional longer description describing the impact claim evidence. */
|
|
29
|
-
description?: string
|
|
30
|
-
/** Client-declared timestamp when this hypercert claim was originally created */
|
|
31
|
-
createdAt: string
|
|
32
|
-
[k: string]: unknown
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const hashMain = 'main'
|
|
36
|
-
|
|
37
|
-
export function isMain<V>(v: V) {
|
|
38
|
-
return is$typed(v, id, hashMain)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function validateMain<V>(v: V) {
|
|
42
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
type Main as Record,
|
|
47
|
-
isMain as isRecord,
|
|
48
|
-
validateMain as validateRecord,
|
|
49
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
import type * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef.js'
|
|
13
|
-
|
|
14
|
-
const is$typed = _is$typed,
|
|
15
|
-
validate = _validate
|
|
16
|
-
const id = 'org.hypercerts.claim.measurement'
|
|
17
|
-
|
|
18
|
-
export interface Main {
|
|
19
|
-
$type: 'org.hypercerts.claim.measurement'
|
|
20
|
-
hypercert: ComAtprotoRepoStrongRef.Main
|
|
21
|
-
/** DIDs of the entity (or entities) that measured this data */
|
|
22
|
-
measurers: string[]
|
|
23
|
-
/** The metric being measured */
|
|
24
|
-
metric: string
|
|
25
|
-
/** The measured value */
|
|
26
|
-
value: string
|
|
27
|
-
/** URI to methodology documentation, standard protocol, or measurement procedure */
|
|
28
|
-
measurementMethodURI?: string
|
|
29
|
-
/** URIs to supporting evidence or data */
|
|
30
|
-
evidenceURI?: string[]
|
|
31
|
-
/** Client-declared timestamp when this record was originally created */
|
|
32
|
-
createdAt: string
|
|
33
|
-
[k: string]: unknown
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const hashMain = 'main'
|
|
37
|
-
|
|
38
|
-
export function isMain<V>(v: V) {
|
|
39
|
-
return is$typed(v, id, hashMain)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function validateMain<V>(v: V) {
|
|
43
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
type Main as Record,
|
|
48
|
-
isMain as isRecord,
|
|
49
|
-
validateMain as validateRecord,
|
|
50
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../../lexicons'
|
|
7
|
-
import {
|
|
8
|
-
type $Typed,
|
|
9
|
-
is$typed as _is$typed,
|
|
10
|
-
type OmitKey,
|
|
11
|
-
} from '../../../../util'
|
|
12
|
-
|
|
13
|
-
const is$typed = _is$typed,
|
|
14
|
-
validate = _validate
|
|
15
|
-
const id = 'org.hypercerts.claim.rights'
|
|
16
|
-
|
|
17
|
-
export interface Main {
|
|
18
|
-
$type: 'org.hypercerts.claim.rights'
|
|
19
|
-
/** Full name of the rights */
|
|
20
|
-
rightsName: string
|
|
21
|
-
/** Short rights identifier for easier search */
|
|
22
|
-
rightsType: string
|
|
23
|
-
/** Description of the rights of this hypercert */
|
|
24
|
-
rightsDescription: string
|
|
25
|
-
/** Client-declared timestamp when this record was originally created */
|
|
26
|
-
createdAt: string
|
|
27
|
-
[k: string]: unknown
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const hashMain = 'main'
|
|
31
|
-
|
|
32
|
-
export function isMain<V>(v: V) {
|
|
33
|
-
return is$typed(v, id, hashMain)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function validateMain<V>(v: V) {
|
|
37
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export {
|
|
41
|
-
type Main as Record,
|
|
42
|
-
isMain as isRecord,
|
|
43
|
-
validateMain as validateRecord,
|
|
44
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../lexicons'
|
|
7
|
-
import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
|
|
8
|
-
import type * as AppCertifiedDefs from '../../app/certified/defs.js'
|
|
9
|
-
import type * as ComAtprotoRepoStrongRef from '../../com/atproto/repo/strongRef.js'
|
|
10
|
-
|
|
11
|
-
const is$typed = _is$typed,
|
|
12
|
-
validate = _validate
|
|
13
|
-
const id = 'org.hypercerts.claim'
|
|
14
|
-
|
|
15
|
-
export interface Main {
|
|
16
|
-
$type: 'org.hypercerts.claim'
|
|
17
|
-
/** Title of the hypercert */
|
|
18
|
-
title: string
|
|
19
|
-
/** Short blurb of the impact work done. */
|
|
20
|
-
shortDescription: string
|
|
21
|
-
/** Optional longer description of the impact work done. */
|
|
22
|
-
description?: string
|
|
23
|
-
image?:
|
|
24
|
-
| $Typed<AppCertifiedDefs.Uri>
|
|
25
|
-
| $Typed<AppCertifiedDefs.SmallBlob>
|
|
26
|
-
| { $type: string }
|
|
27
|
-
/** Scope of the work performed */
|
|
28
|
-
workScope: string
|
|
29
|
-
/** When the work began */
|
|
30
|
-
workTimeFrameFrom: string
|
|
31
|
-
/** When the work ended */
|
|
32
|
-
workTimeFrameTo: string
|
|
33
|
-
/** Supporting evidence, documentation, or external data URIs */
|
|
34
|
-
evidence?: ComAtprotoRepoStrongRef.Main[]
|
|
35
|
-
/** A strong reference to the contributions done to create the impact in the hypercerts. The record referenced must conform with the lexicon org.hypercerts.claim.contributions */
|
|
36
|
-
contributions?: ComAtprotoRepoStrongRef.Main[]
|
|
37
|
-
rights?: ComAtprotoRepoStrongRef.Main
|
|
38
|
-
location?: ComAtprotoRepoStrongRef.Main
|
|
39
|
-
/** Client-declared timestamp when this record was originally created */
|
|
40
|
-
createdAt: string
|
|
41
|
-
[k: string]: unknown
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const hashMain = 'main'
|
|
45
|
-
|
|
46
|
-
export function isMain<V>(v: V) {
|
|
47
|
-
return is$typed(v, id, hashMain)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function validateMain<V>(v: V) {
|
|
51
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export {
|
|
55
|
-
type Main as Record,
|
|
56
|
-
isMain as isRecord,
|
|
57
|
-
validateMain as validateRecord,
|
|
58
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
5
|
-
import { CID } from 'multiformats/cid'
|
|
6
|
-
import { validate as _validate } from '../../../lexicons'
|
|
7
|
-
import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util'
|
|
8
|
-
import type * as AppCertifiedDefs from '../../app/certified/defs.js'
|
|
9
|
-
import type * as ComAtprotoRepoStrongRef from '../../com/atproto/repo/strongRef.js'
|
|
10
|
-
|
|
11
|
-
const is$typed = _is$typed,
|
|
12
|
-
validate = _validate
|
|
13
|
-
const id = 'org.hypercerts.collection'
|
|
14
|
-
|
|
15
|
-
export interface Main {
|
|
16
|
-
$type: 'org.hypercerts.collection'
|
|
17
|
-
/** The title of this collection */
|
|
18
|
-
title: string
|
|
19
|
-
/** A short description of this collection */
|
|
20
|
-
shortDescription?: string
|
|
21
|
-
coverPhoto?:
|
|
22
|
-
| $Typed<AppCertifiedDefs.Uri>
|
|
23
|
-
| $Typed<AppCertifiedDefs.SmallBlob>
|
|
24
|
-
| { $type: string }
|
|
25
|
-
/** Array of claims with their associated weights in this collection */
|
|
26
|
-
claims: ClaimItem[]
|
|
27
|
-
/** Client-declared timestamp when this record was originally created */
|
|
28
|
-
createdAt: string
|
|
29
|
-
[k: string]: unknown
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const hashMain = 'main'
|
|
33
|
-
|
|
34
|
-
export function isMain<V>(v: V) {
|
|
35
|
-
return is$typed(v, id, hashMain)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function validateMain<V>(v: V) {
|
|
39
|
-
return validate<Main & V>(v, id, hashMain, true)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
type Main as Record,
|
|
44
|
-
isMain as isRecord,
|
|
45
|
-
validateMain as validateRecord,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ClaimItem {
|
|
49
|
-
$type?: 'org.hypercerts.collection#claimItem'
|
|
50
|
-
claim: ComAtprotoRepoStrongRef.Main
|
|
51
|
-
/** The weight/importance of this hypercert claim in the collection (a percentage from 0-100, stored as a string to avoid float precision issues). The total claim weights should add up to 100. */
|
|
52
|
-
weight: string
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const hashClaimItem = 'claimItem'
|
|
56
|
-
|
|
57
|
-
export function isClaimItem<V>(v: V) {
|
|
58
|
-
return is$typed(v, id, hashClaimItem)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function validateClaimItem<V>(v: V) {
|
|
62
|
-
return validate<ClaimItem & V>(v, id, hashClaimItem)
|
|
63
|
-
}
|
package/src/util.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { type ValidationResult } from '@atproto/lexicon'
|
|
6
|
-
|
|
7
|
-
export type OmitKey<T, K extends keyof T> = {
|
|
8
|
-
[K2 in keyof T as K2 extends K ? never : K2]: T[K2]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type $Typed<V, T extends string = string> = V & { $type: T }
|
|
12
|
-
export type Un$Typed<V extends { $type?: string }> = OmitKey<V, '$type'>
|
|
13
|
-
|
|
14
|
-
export type $Type<Id extends string, Hash extends string> = Hash extends 'main'
|
|
15
|
-
? Id
|
|
16
|
-
: `${Id}#${Hash}`
|
|
17
|
-
|
|
18
|
-
function isObject<V>(v: V): v is V & object {
|
|
19
|
-
return v != null && typeof v === 'object'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function is$type<Id extends string, Hash extends string>(
|
|
23
|
-
$type: unknown,
|
|
24
|
-
id: Id,
|
|
25
|
-
hash: Hash,
|
|
26
|
-
): $type is $Type<Id, Hash> {
|
|
27
|
-
return hash === 'main'
|
|
28
|
-
? $type === id
|
|
29
|
-
: // $type === `${id}#${hash}`
|
|
30
|
-
typeof $type === 'string' &&
|
|
31
|
-
$type.length === id.length + 1 + hash.length &&
|
|
32
|
-
$type.charCodeAt(id.length) === 35 /* '#' */ &&
|
|
33
|
-
$type.startsWith(id) &&
|
|
34
|
-
$type.endsWith(hash)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type $TypedObject<
|
|
38
|
-
V,
|
|
39
|
-
Id extends string,
|
|
40
|
-
Hash extends string,
|
|
41
|
-
> = V extends {
|
|
42
|
-
$type: $Type<Id, Hash>
|
|
43
|
-
}
|
|
44
|
-
? V
|
|
45
|
-
: V extends { $type?: string }
|
|
46
|
-
? V extends { $type?: infer T extends $Type<Id, Hash> }
|
|
47
|
-
? V & { $type: T }
|
|
48
|
-
: never
|
|
49
|
-
: V & { $type: $Type<Id, Hash> }
|
|
50
|
-
|
|
51
|
-
export function is$typed<V, Id extends string, Hash extends string>(
|
|
52
|
-
v: V,
|
|
53
|
-
id: Id,
|
|
54
|
-
hash: Hash,
|
|
55
|
-
): v is $TypedObject<V, Id, Hash> {
|
|
56
|
-
return isObject(v) && '$type' in v && is$type(v.$type, id, hash)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function maybe$typed<V, Id extends string, Hash extends string>(
|
|
60
|
-
v: V,
|
|
61
|
-
id: Id,
|
|
62
|
-
hash: Hash,
|
|
63
|
-
): v is V & object & { $type?: $Type<Id, Hash> } {
|
|
64
|
-
return (
|
|
65
|
-
isObject(v) &&
|
|
66
|
-
('$type' in v ? v.$type === undefined || is$type(v.$type, id, hash) : true)
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type Validator<R = unknown> = (v: unknown) => ValidationResult<R>
|
|
71
|
-
export type ValidatorParam<V extends Validator> =
|
|
72
|
-
V extends Validator<infer R> ? R : never
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Utility function that allows to convert a "validate*" utility function into a
|
|
76
|
-
* type predicate.
|
|
77
|
-
*/
|
|
78
|
-
export function asPredicate<V extends Validator>(validate: V) {
|
|
79
|
-
return function <T>(v: T): v is T & ValidatorParam<V> {
|
|
80
|
-
return validate(v).success
|
|
81
|
-
}
|
|
82
|
-
}
|