@oxyhq/crowdsource-contracts 0.1.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/README.md +129 -0
- package/dist/case-envelope.d.ts +1130 -0
- package/dist/case-envelope.d.ts.map +1 -0
- package/dist/case-envelope.js +383 -0
- package/dist/case-envelope.js.map +1 -0
- package/dist/decisions.d.ts +353 -0
- package/dist/decisions.d.ts.map +1 -0
- package/dist/decisions.js +198 -0
- package/dist/decisions.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +43 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +83 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/policies.d.ts +286 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +178 -0
- package/dist/policies.js.map +1 -0
- package/dist/primitives.d.ts +185 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +231 -0
- package/dist/primitives.js.map +1 -0
- package/dist/reputation-events.d.ts +349 -0
- package/dist/reputation-events.d.ts.map +1 -0
- package/dist/reputation-events.js +128 -0
- package/dist/reputation-events.js.map +1 -0
- package/dist/resources.d.ts +484 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +436 -0
- package/dist/resources.js.map +1 -0
- package/dist/reviews.d.ts +276 -0
- package/dist/reviews.d.ts.map +1 -0
- package/dist/reviews.js +144 -0
- package/dist/reviews.js.map +1 -0
- package/dist/taxonomy.d.ts +266 -0
- package/dist/taxonomy.d.ts.map +1 -0
- package/dist/taxonomy.js +282 -0
- package/dist/taxonomy.js.map +1 -0
- package/dist/webhooks.d.ts +604 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +192 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +56 -0
- package/src/case-envelope.ts +433 -0
- package/src/decisions.ts +216 -0
- package/src/index.ts +45 -0
- package/src/json-schema.ts +89 -0
- package/src/policies.ts +203 -0
- package/src/primitives.ts +283 -0
- package/src/reputation-events.ts +144 -0
- package/src/resources.ts +489 -0
- package/src/reviews.ts +159 -0
- package/src/taxonomy.ts +313 -0
- package/src/webhooks.ts +215 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Resources and relations — the universal content unit (§5.2–§5.7).
|
|
4
|
+
*
|
|
5
|
+
* "Applications send data, never executable code" (§5.2). Everything in this
|
|
6
|
+
* module follows from that one sentence:
|
|
7
|
+
*
|
|
8
|
+
* * The resource union is CLOSED and discriminated on `type`, and each
|
|
9
|
+
* variant declares exactly which fields it may carry. There is no free-form
|
|
10
|
+
* branch, so there is no place to put a rendering instruction.
|
|
11
|
+
* * Every object is `.strict()`. In the outbound direction an unknown field
|
|
12
|
+
* is harmless forward compatibility (§10.11); inbound it is not. A field
|
|
13
|
+
* that is silently dropped is context an application believes it sent and a
|
|
14
|
+
* jury never sees — which is how a case gets decided on incomplete material
|
|
15
|
+
* — and a field that is silently kept is a rendering input nobody reviewed.
|
|
16
|
+
* §10.11 makes exactly this exception: unknown fields must not break
|
|
17
|
+
* clients "except where the schema forbids them for safety".
|
|
18
|
+
* * A media type must agree with its resource type, so an `image` cannot
|
|
19
|
+
* declare `text/html` and be handed to something that trusts the label.
|
|
20
|
+
* * §5.7 custom payloads are bounded JSON with no `$`-prefixed keys, which
|
|
21
|
+
* removes every JSON Schema reference mechanism at once — `$ref` to a
|
|
22
|
+
* remote document IS the "remote component" §5.7 forbids, and resolving one
|
|
23
|
+
* is an SSRF against CrowdSource itself.
|
|
24
|
+
*
|
|
25
|
+
* What is deliberately NOT here: any filter on the CONTENT of text fields. The
|
|
26
|
+
* material under review is hostile by definition — a harassment report quotes
|
|
27
|
+
* the harassment, a phishing report quotes the phishing link. A lexical
|
|
28
|
+
* blocklist would reject the evidence and protect nothing, because the contract
|
|
29
|
+
* has no field whose value is ever interpreted as markup or code.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.ResourceSchemaRegistrationSchema = exports.RelationSchema = exports.PRINCIPAL_TARGETED_RELATION_TYPES = exports.RelationTypeSchema = exports.RELATION_TYPES = exports.ResourceSchema = exports.AssetRefSchema = exports.TextFormattingSchema = exports.TEXT_FORMATTINGS = exports.ResourceTypeSchema = exports.RESOURCE_TYPES = exports.ResourceRoleSchema = exports.RESOURCE_ROLES = exports.PrincipalRefSchema = exports.ResourceIdSchema = void 0;
|
|
33
|
+
const zod_1 = require("zod");
|
|
34
|
+
const primitives_1 = require("./primitives");
|
|
35
|
+
const policies_1 = require("./policies");
|
|
36
|
+
const taxonomy_1 = require("./taxonomy");
|
|
37
|
+
/** A resource id, unique within one envelope (§5.2 `id`). */
|
|
38
|
+
exports.ResourceIdSchema = primitives_1.IdentifierSchema;
|
|
39
|
+
/**
|
|
40
|
+
* A pseudonymous reference to an actor, resolved within one envelope.
|
|
41
|
+
*
|
|
42
|
+
* Never a real identity: §13.5 requires a pseudonymous principal wherever one
|
|
43
|
+
* suffices. `principalBindings` is the only place a ref is tied to anything,
|
|
44
|
+
* and even there it is tied to a binding proof id, not to a name.
|
|
45
|
+
*/
|
|
46
|
+
exports.PrincipalRefSchema = primitives_1.IdentifierSchema;
|
|
47
|
+
/** §5.2 `role`: why this resource is in the case. */
|
|
48
|
+
exports.RESOURCE_ROLES = [
|
|
49
|
+
'subject',
|
|
50
|
+
'attachment',
|
|
51
|
+
'context',
|
|
52
|
+
'parent',
|
|
53
|
+
'quoted',
|
|
54
|
+
'evidence',
|
|
55
|
+
'metadata',
|
|
56
|
+
'policy_context',
|
|
57
|
+
];
|
|
58
|
+
exports.ResourceRoleSchema = zod_1.z.enum(exports.RESOURCE_ROLES);
|
|
59
|
+
/** §5.3 standard resource types. */
|
|
60
|
+
exports.RESOURCE_TYPES = [
|
|
61
|
+
'text',
|
|
62
|
+
'image',
|
|
63
|
+
'video',
|
|
64
|
+
'audio',
|
|
65
|
+
'document',
|
|
66
|
+
'link',
|
|
67
|
+
'profile',
|
|
68
|
+
'conversation',
|
|
69
|
+
'listing',
|
|
70
|
+
'location',
|
|
71
|
+
'metadata',
|
|
72
|
+
'custom',
|
|
73
|
+
];
|
|
74
|
+
exports.ResourceTypeSchema = zod_1.z.enum(exports.RESOURCE_TYPES);
|
|
75
|
+
/** §5.3 text formatting. Never HTML: `markdown_subset` is a subset for a reason. */
|
|
76
|
+
exports.TEXT_FORMATTINGS = ['plain', 'markdown_subset'];
|
|
77
|
+
exports.TextFormattingSchema = zod_1.z.enum(exports.TEXT_FORMATTINGS);
|
|
78
|
+
/**
|
|
79
|
+
* A reference to bytes held outside the envelope (§5.2 `asset`).
|
|
80
|
+
*
|
|
81
|
+
* Exactly one of `uploadId` and `url` — never both, never neither. Two
|
|
82
|
+
* locations for one piece of evidence means two answers to "what exactly did
|
|
83
|
+
* the jury look at", and §5.6 requires the case to pin the exact version that
|
|
84
|
+
* was reported. `sha256` is required for the same reason: it is what makes the
|
|
85
|
+
* answer verifiable after the application has deleted the original.
|
|
86
|
+
*/
|
|
87
|
+
exports.AssetRefSchema = zod_1.z
|
|
88
|
+
.strictObject({
|
|
89
|
+
uploadId: primitives_1.IdentifierSchema.optional(),
|
|
90
|
+
url: primitives_1.HttpUrlSchema.optional(),
|
|
91
|
+
mimeType: primitives_1.MimeTypeSchema,
|
|
92
|
+
sha256: primitives_1.Sha256DigestSchema,
|
|
93
|
+
sizeBytes: zod_1.z.number().int().positive().optional(),
|
|
94
|
+
width: zod_1.z.number().int().positive().optional(),
|
|
95
|
+
height: zod_1.z.number().int().positive().optional(),
|
|
96
|
+
durationSeconds: zod_1.z.number().positive().optional(),
|
|
97
|
+
})
|
|
98
|
+
.superRefine((asset, ctx) => {
|
|
99
|
+
const hasUpload = asset.uploadId !== undefined;
|
|
100
|
+
const hasUrl = asset.url !== undefined;
|
|
101
|
+
if (hasUpload === hasUrl) {
|
|
102
|
+
ctx.addIssue({
|
|
103
|
+
code: 'custom',
|
|
104
|
+
path: ['uploadId'],
|
|
105
|
+
message: 'an asset must reference exactly one of uploadId or url',
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const mediaTypeMismatch = (ctx, mimeType, allowedPrefixes) => {
|
|
110
|
+
if (!allowedPrefixes.some((prefix) => mimeType.startsWith(prefix))) {
|
|
111
|
+
ctx.addIssue({
|
|
112
|
+
code: 'custom',
|
|
113
|
+
path: ['asset', 'mimeType'],
|
|
114
|
+
message: `must be one of ${allowedPrefixes.join(', ')}* for this resource type`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const resourceBaseShape = {
|
|
119
|
+
id: exports.ResourceIdSchema,
|
|
120
|
+
role: exports.ResourceRoleSchema,
|
|
121
|
+
/** §5.2: BCP 47 "where applicable" — a text of unknown language is real. */
|
|
122
|
+
language: primitives_1.LanguageTagSchema.optional(),
|
|
123
|
+
/** §5.2: the moment of the ORIGINAL object, not of the report. */
|
|
124
|
+
createdAt: primitives_1.TimestampSchema.optional(),
|
|
125
|
+
authorPrincipalRef: exports.PrincipalRefSchema.optional(),
|
|
126
|
+
/** §5.2: a prior classification of exposure, never shown as a verdict. */
|
|
127
|
+
sensitivity: taxonomy_1.SensitivityHintSchema.optional(),
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* `sha256` is required on every resource whose content travels inline, and
|
|
131
|
+
* optional on asset-backed ones where `asset.sha256` carries it instead.
|
|
132
|
+
*
|
|
133
|
+
* That split is not a preference; it is what both reference envelopes do.
|
|
134
|
+
* Appendix A's `res_post` and `res_parent` carry a top-level digest and its
|
|
135
|
+
* `res_image` carries the digest on the asset only. §5.6 asks for "SHA 256 of
|
|
136
|
+
* each resource", so one of the two is always present.
|
|
137
|
+
*/
|
|
138
|
+
const inlineResourceShape = { ...resourceBaseShape, sha256: primitives_1.Sha256DigestSchema };
|
|
139
|
+
const assetResourceShape = { ...resourceBaseShape, sha256: primitives_1.Sha256DigestSchema.optional() };
|
|
140
|
+
const TextResourceSchema = zod_1.z.strictObject({
|
|
141
|
+
...inlineResourceShape,
|
|
142
|
+
type: zod_1.z.literal('text'),
|
|
143
|
+
data: zod_1.z.strictObject({
|
|
144
|
+
text: zod_1.z.string().min(1).max(primitives_1.CONTRACT_LIMITS.TEXT_RESOURCE_MAX_LENGTH),
|
|
145
|
+
formatting: exports.TextFormattingSchema.optional(),
|
|
146
|
+
}),
|
|
147
|
+
});
|
|
148
|
+
const ImageResourceSchema = zod_1.z
|
|
149
|
+
.strictObject({
|
|
150
|
+
...assetResourceShape,
|
|
151
|
+
type: zod_1.z.literal('image'),
|
|
152
|
+
asset: exports.AssetRefSchema,
|
|
153
|
+
})
|
|
154
|
+
.superRefine((resource, ctx) => mediaTypeMismatch(ctx, resource.asset.mimeType, ['image/']));
|
|
155
|
+
const VideoResourceSchema = zod_1.z
|
|
156
|
+
.strictObject({
|
|
157
|
+
...assetResourceShape,
|
|
158
|
+
type: zod_1.z.literal('video'),
|
|
159
|
+
asset: exports.AssetRefSchema,
|
|
160
|
+
data: zod_1.z
|
|
161
|
+
.strictObject({
|
|
162
|
+
timeRange: zod_1.z
|
|
163
|
+
.strictObject({
|
|
164
|
+
startSeconds: zod_1.z.number().nonnegative(),
|
|
165
|
+
endSeconds: zod_1.z.number().positive(),
|
|
166
|
+
})
|
|
167
|
+
.refine((range) => range.endSeconds > range.startSeconds, {
|
|
168
|
+
message: 'endSeconds must be greater than startSeconds',
|
|
169
|
+
path: ['endSeconds'],
|
|
170
|
+
})
|
|
171
|
+
.optional(),
|
|
172
|
+
})
|
|
173
|
+
.optional(),
|
|
174
|
+
})
|
|
175
|
+
.superRefine((resource, ctx) => {
|
|
176
|
+
mediaTypeMismatch(ctx, resource.asset.mimeType, ['video/']);
|
|
177
|
+
if (resource.asset.durationSeconds === undefined) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: 'custom',
|
|
180
|
+
path: ['asset', 'durationSeconds'],
|
|
181
|
+
message: 'a video asset must declare durationSeconds',
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
const AudioResourceSchema = zod_1.z
|
|
186
|
+
.strictObject({
|
|
187
|
+
...assetResourceShape,
|
|
188
|
+
type: zod_1.z.literal('audio'),
|
|
189
|
+
asset: exports.AssetRefSchema,
|
|
190
|
+
data: zod_1.z
|
|
191
|
+
.strictObject({
|
|
192
|
+
transcript: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.EXTRACTED_TEXT_MAX_LENGTH).optional(),
|
|
193
|
+
})
|
|
194
|
+
.optional(),
|
|
195
|
+
})
|
|
196
|
+
.superRefine((resource, ctx) => {
|
|
197
|
+
mediaTypeMismatch(ctx, resource.asset.mimeType, ['audio/']);
|
|
198
|
+
if (resource.asset.durationSeconds === undefined) {
|
|
199
|
+
ctx.addIssue({
|
|
200
|
+
code: 'custom',
|
|
201
|
+
path: ['asset', 'durationSeconds'],
|
|
202
|
+
message: 'an audio asset must declare durationSeconds',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
const DocumentResourceSchema = zod_1.z
|
|
207
|
+
.strictObject({
|
|
208
|
+
...assetResourceShape,
|
|
209
|
+
type: zod_1.z.literal('document'),
|
|
210
|
+
asset: exports.AssetRefSchema,
|
|
211
|
+
data: zod_1.z.strictObject({
|
|
212
|
+
title: zod_1.z.string().min(1).max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH),
|
|
213
|
+
extractedText: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.EXTRACTED_TEXT_MAX_LENGTH).optional(),
|
|
214
|
+
}),
|
|
215
|
+
})
|
|
216
|
+
.superRefine((resource, ctx) => mediaTypeMismatch(ctx, resource.asset.mimeType, ['application/', 'text/']));
|
|
217
|
+
const LinkResourceSchema = zod_1.z.strictObject({
|
|
218
|
+
...inlineResourceShape,
|
|
219
|
+
type: zod_1.z.literal('link'),
|
|
220
|
+
data: zod_1.z.strictObject({
|
|
221
|
+
url: primitives_1.HttpUrlSchema,
|
|
222
|
+
title: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH).optional(),
|
|
223
|
+
resolvedHost: zod_1.z
|
|
224
|
+
.string()
|
|
225
|
+
.max(253)
|
|
226
|
+
.regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/, 'must be a hostname')
|
|
227
|
+
.optional(),
|
|
228
|
+
snapshot: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.EXTRACTED_TEXT_MAX_LENGTH).optional(),
|
|
229
|
+
}),
|
|
230
|
+
});
|
|
231
|
+
const ProfileResourceSchema = zod_1.z.strictObject({
|
|
232
|
+
...inlineResourceShape,
|
|
233
|
+
type: zod_1.z.literal('profile'),
|
|
234
|
+
data: zod_1.z.strictObject({
|
|
235
|
+
/**
|
|
236
|
+
* Every field is optional on purpose. A federated or unresolved actor
|
|
237
|
+
* routinely has no display name, and requiring one would push applications
|
|
238
|
+
* into synthesising a name — the opposite of what the profile-identity rule
|
|
239
|
+
* in the ecosystem instructions asks for.
|
|
240
|
+
*/
|
|
241
|
+
displayName: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH).optional(),
|
|
242
|
+
bio: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.LONG_TEXT_MAX_LENGTH).optional(),
|
|
243
|
+
/** An `image` resource in the same envelope. */
|
|
244
|
+
avatarRef: exports.ResourceIdSchema.optional(),
|
|
245
|
+
claims: primitives_1.MetadataBagSchema.optional(),
|
|
246
|
+
}),
|
|
247
|
+
});
|
|
248
|
+
const ConversationResourceSchema = zod_1.z.strictObject({
|
|
249
|
+
...inlineResourceShape,
|
|
250
|
+
type: zod_1.z.literal('conversation'),
|
|
251
|
+
data: zod_1.z.strictObject({
|
|
252
|
+
/**
|
|
253
|
+
* Ordered (§5.3). §13.5 asks for five messages around the incident rather
|
|
254
|
+
* than the whole thread, which is why this is a bounded list of ids the
|
|
255
|
+
* application chose, not a pointer to a conversation.
|
|
256
|
+
*/
|
|
257
|
+
messageResourceIds: zod_1.z
|
|
258
|
+
.array(exports.ResourceIdSchema)
|
|
259
|
+
.min(1)
|
|
260
|
+
.max(primitives_1.CONTRACT_LIMITS.CONVERSATION_MESSAGES_MAX),
|
|
261
|
+
}),
|
|
262
|
+
});
|
|
263
|
+
const ListingResourceSchema = zod_1.z
|
|
264
|
+
.strictObject({
|
|
265
|
+
...inlineResourceShape,
|
|
266
|
+
type: zod_1.z.literal('listing'),
|
|
267
|
+
data: zod_1.z.strictObject({
|
|
268
|
+
title: zod_1.z.string().min(1).max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH),
|
|
269
|
+
description: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.LONG_TEXT_MAX_LENGTH).optional(),
|
|
270
|
+
price: zod_1.z.number().finite().nonnegative().optional(),
|
|
271
|
+
currency: zod_1.z
|
|
272
|
+
.string()
|
|
273
|
+
.regex(/^[A-Z]{3}$/, 'must be an ISO 4217 alphabetic code')
|
|
274
|
+
.optional(),
|
|
275
|
+
sellerRef: exports.PrincipalRefSchema.optional(),
|
|
276
|
+
mediaRefs: zod_1.z.array(exports.ResourceIdSchema).max(primitives_1.CONTRACT_LIMITS.LISTING_MEDIA_REFS_MAX).optional(),
|
|
277
|
+
}),
|
|
278
|
+
})
|
|
279
|
+
.superRefine((resource, ctx) => {
|
|
280
|
+
const hasPrice = resource.data.price !== undefined;
|
|
281
|
+
const hasCurrency = resource.data.currency !== undefined;
|
|
282
|
+
if (hasPrice !== hasCurrency) {
|
|
283
|
+
ctx.addIssue({
|
|
284
|
+
code: 'custom',
|
|
285
|
+
path: ['data', hasPrice ? 'currency' : 'price'],
|
|
286
|
+
message: 'price and currency must travel together',
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
/** Two decimal places ≈ 1.1 km — coarse enough not to locate a person. */
|
|
291
|
+
const COARSE_COORDINATE_DECIMALS = 2;
|
|
292
|
+
const isCoarse = (value) => Number.isInteger(value * 10 ** COARSE_COORDINATE_DECIMALS);
|
|
293
|
+
const LocationResourceSchema = zod_1.z
|
|
294
|
+
.strictObject({
|
|
295
|
+
...inlineResourceShape,
|
|
296
|
+
type: zod_1.z.literal('location'),
|
|
297
|
+
data: zod_1.z.strictObject({
|
|
298
|
+
label: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH).optional(),
|
|
299
|
+
latitude: zod_1.z.number().min(-90).max(90).optional(),
|
|
300
|
+
longitude: zod_1.z.number().min(-180).max(180).optional(),
|
|
301
|
+
}),
|
|
302
|
+
})
|
|
303
|
+
.superRefine((resource, ctx) => {
|
|
304
|
+
const { label, latitude, longitude } = resource.data;
|
|
305
|
+
if (label === undefined && latitude === undefined && longitude === undefined) {
|
|
306
|
+
ctx.addIssue({
|
|
307
|
+
code: 'custom',
|
|
308
|
+
path: ['data'],
|
|
309
|
+
message: 'a location must carry a label, coordinates, or both',
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
if ((latitude === undefined) !== (longitude === undefined)) {
|
|
313
|
+
ctx.addIssue({
|
|
314
|
+
code: 'custom',
|
|
315
|
+
path: ['data', latitude === undefined ? 'latitude' : 'longitude'],
|
|
316
|
+
message: 'latitude and longitude must travel together',
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* §5.3 says "coarse location or place label" and §13.5 requires precise
|
|
321
|
+
* location to be redacted before community review. Precision is a property
|
|
322
|
+
* of the number itself, so the contract can refuse the precise value rather
|
|
323
|
+
* than trusting every downstream renderer to round it.
|
|
324
|
+
*/
|
|
325
|
+
if (latitude !== undefined && !isCoarse(latitude)) {
|
|
326
|
+
ctx.addIssue({
|
|
327
|
+
code: 'custom',
|
|
328
|
+
path: ['data', 'latitude'],
|
|
329
|
+
message: `must be coarse: at most ${COARSE_COORDINATE_DECIMALS} decimal places`,
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
if (longitude !== undefined && !isCoarse(longitude)) {
|
|
333
|
+
ctx.addIssue({
|
|
334
|
+
code: 'custom',
|
|
335
|
+
path: ['data', 'longitude'],
|
|
336
|
+
message: `must be coarse: at most ${COARSE_COORDINATE_DECIMALS} decimal places`,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
const MetadataResourceSchema = zod_1.z.strictObject({
|
|
341
|
+
...inlineResourceShape,
|
|
342
|
+
type: zod_1.z.literal('metadata'),
|
|
343
|
+
data: primitives_1.MetadataBagSchema.refine((bag) => Object.keys(bag).length >= 1, {
|
|
344
|
+
message: 'a metadata resource must carry at least one field',
|
|
345
|
+
}),
|
|
346
|
+
});
|
|
347
|
+
const CustomResourceSchema = zod_1.z.strictObject({
|
|
348
|
+
...inlineResourceShape,
|
|
349
|
+
type: zod_1.z.literal('custom'),
|
|
350
|
+
/** The schema the application registered for this shape (§5.7). */
|
|
351
|
+
schemaId: primitives_1.IdentifierSchema,
|
|
352
|
+
/**
|
|
353
|
+
* Validated twice: structurally here, then against the registered JSON Schema
|
|
354
|
+
* at ingress. The registered schema decides what the fields MEAN; this decides
|
|
355
|
+
* that they are fields at all.
|
|
356
|
+
*/
|
|
357
|
+
payload: primitives_1.CustomPayloadSchema,
|
|
358
|
+
});
|
|
359
|
+
/**
|
|
360
|
+
* One resource (§5.2).
|
|
361
|
+
*
|
|
362
|
+
* A discriminated union rather than one object with everything optional: the
|
|
363
|
+
* latter would accept an `image` with inline text and no asset, which is not a
|
|
364
|
+
* resource anybody can review.
|
|
365
|
+
*/
|
|
366
|
+
exports.ResourceSchema = zod_1.z.discriminatedUnion('type', [
|
|
367
|
+
TextResourceSchema,
|
|
368
|
+
ImageResourceSchema,
|
|
369
|
+
VideoResourceSchema,
|
|
370
|
+
AudioResourceSchema,
|
|
371
|
+
DocumentResourceSchema,
|
|
372
|
+
LinkResourceSchema,
|
|
373
|
+
ProfileResourceSchema,
|
|
374
|
+
ConversationResourceSchema,
|
|
375
|
+
ListingResourceSchema,
|
|
376
|
+
LocationResourceSchema,
|
|
377
|
+
MetadataResourceSchema,
|
|
378
|
+
CustomResourceSchema,
|
|
379
|
+
]);
|
|
380
|
+
/** §5.5 relation types. */
|
|
381
|
+
exports.RELATION_TYPES = [
|
|
382
|
+
'has_attachment',
|
|
383
|
+
'replies_to',
|
|
384
|
+
'quotes',
|
|
385
|
+
'authored_by',
|
|
386
|
+
'contextualizes',
|
|
387
|
+
'previous_version',
|
|
388
|
+
'contains',
|
|
389
|
+
'refers_to',
|
|
390
|
+
];
|
|
391
|
+
exports.RelationTypeSchema = zod_1.z.enum(exports.RELATION_TYPES);
|
|
392
|
+
/**
|
|
393
|
+
* Relation types whose `to` names a principal rather than a resource.
|
|
394
|
+
*
|
|
395
|
+
* §5.5 defines `authored_by` as "a resource was created by a principal", so its
|
|
396
|
+
* target is a `principalRef`. Every other relation in the table joins two
|
|
397
|
+
* resources. No example in the plan exercises `authored_by`, so this reading is
|
|
398
|
+
* recorded here rather than assumed: it is what makes §5.5's "the backend must
|
|
399
|
+
* validate that every referenced id exists in the envelope" checkable at all,
|
|
400
|
+
* since the two id spaces are separate.
|
|
401
|
+
*/
|
|
402
|
+
exports.PRINCIPAL_TARGETED_RELATION_TYPES = ['authored_by'];
|
|
403
|
+
/**
|
|
404
|
+
* A relation (§5.5).
|
|
405
|
+
*
|
|
406
|
+
* `from` and `to` are only shape-checked here. Whether they RESOLVE is decided
|
|
407
|
+
* by `CaseEnvelopeSchema`, which is the smallest scope that can see both the
|
|
408
|
+
* resource list and the principal list.
|
|
409
|
+
*/
|
|
410
|
+
exports.RelationSchema = zod_1.z.strictObject({
|
|
411
|
+
from: exports.ResourceIdSchema,
|
|
412
|
+
type: exports.RelationTypeSchema,
|
|
413
|
+
to: primitives_1.IdentifierSchema,
|
|
414
|
+
});
|
|
415
|
+
/**
|
|
416
|
+
* A custom resource schema an application registers (§5.7).
|
|
417
|
+
*
|
|
418
|
+
* `jsonSchema` reuses the custom-payload grammar, which forbids `$`-prefixed
|
|
419
|
+
* keys. That single restriction removes `$ref`, `$dynamicRef`, `$recursiveRef`
|
|
420
|
+
* and `$id` in one move — every mechanism by which a registered schema could
|
|
421
|
+
* point at a document CrowdSource would then have to fetch. §5.7's "no remote
|
|
422
|
+
* components" is not a rendering rule alone; a remote `$ref` is also an SSRF
|
|
423
|
+
* with a tenant holding the pen.
|
|
424
|
+
*
|
|
425
|
+
* The cost is `$defs`, `$schema` and `$comment`, which flat custom-field
|
|
426
|
+
* schemas do not need. Recursive tenant schemas are not supported and are not
|
|
427
|
+
* meant to be.
|
|
428
|
+
*/
|
|
429
|
+
exports.ResourceSchemaRegistrationSchema = zod_1.z.strictObject({
|
|
430
|
+
schemaId: primitives_1.IdentifierSchema,
|
|
431
|
+
version: policies_1.PolicyVersionSchema,
|
|
432
|
+
title: zod_1.z.string().min(1).max(primitives_1.CONTRACT_LIMITS.SHORT_TEXT_MAX_LENGTH),
|
|
433
|
+
description: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.LONG_TEXT_MAX_LENGTH).optional(),
|
|
434
|
+
jsonSchema: primitives_1.CustomPayloadSchema,
|
|
435
|
+
});
|
|
436
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,6BAAwB;AAExB,6CAUsB;AACtB,yCAAiD;AACjD,yCAAmD;AAEnD,6DAA6D;AAChD,QAAA,gBAAgB,GAAG,6BAAgB,CAAC;AAGjD;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,6BAAgB,CAAC;AAGnD,qDAAq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