@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 @@
|
|
|
1
|
+
{"version":3,"file":"case-envelope.d.ts","sourceRoot":"","sources":["../src/case-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE,eAAO,MAAM,+BAA+B,qCAA0C,CAAC;AAEvF,qCAAqC;AACrC,eAAO,MAAM,sBAAsB,sNAYzB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAS5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,mCAAmC;AACnC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;kBAM5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,+EAMlB,CAAC;AACX,eAAO,MAAM,mBAAmB;;;;;;EAA0B,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;kBAiB/B,CAAC;AACL,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,g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+
* §5 opens by naming the mistake this contract exists to avoid: designing
|
|
6
|
+
* moderation around `post`, `comment`, `room` or `product`. Nothing below knows
|
|
7
|
+
* what a post is. An envelope is resources, relations, pseudonymous principals,
|
|
8
|
+
* allegations, a policy reference and privacy terms; what the material happens
|
|
9
|
+
* to be called in the application that sent it lives in `subject.type`, which
|
|
10
|
+
* is a namespaced label, not a branch in this file.
|
|
11
|
+
*
|
|
12
|
+
* Two rules govern the whole module.
|
|
13
|
+
*
|
|
14
|
+
* **Everything inbound is strict.** An unknown key on an envelope is either a
|
|
15
|
+
* typo — in which case the application believes it sent context that the jury
|
|
16
|
+
* will never see — or a field somebody hopes will reach the reviewer's screen.
|
|
17
|
+
* Both are rejected loudly. §10.11's "unknown fields must not break clients"
|
|
18
|
+
* governs what CrowdSource SENDS; see `decisions.ts` and `webhooks.ts` for the
|
|
19
|
+
* other half of that rule.
|
|
20
|
+
*
|
|
21
|
+
* **References resolve inside the envelope.** §5.5 requires the backend to
|
|
22
|
+
* check that every referenced id exists. That check lives here, in the schema,
|
|
23
|
+
* because it is a property of the document and nothing downstream can restate
|
|
24
|
+
* it as reliably. It is extended past `relations` to every in-envelope
|
|
25
|
+
* reference — `subject.primaryResourceId`, `allegation.resourceIds`,
|
|
26
|
+
* `authorPrincipalRef`, conversation members, listing media and seller, profile
|
|
27
|
+
* avatar — since a dangling id is the same defect wherever it appears.
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.CreateReportResponseSchema = exports.CreateReportRequestSchema = exports.ReportStatusSchema = exports.REPORT_STATUSES = exports.CaseEnvelopeSchema = exports.CaseUrgencySchema = exports.CasePrivacySchema = exports.CaseSourceSchema = exports.SourceEnvironmentSchema = exports.SOURCE_ENVIRONMENTS = exports.AllegationSchema = exports.PrincipalBindingSchema = exports.PrincipalTypeSchema = exports.PRINCIPAL_TYPES = exports.CaseSubjectSchema = exports.SubjectTypeSchema = exports.STANDARD_SUBJECT_TYPES = exports.CaseEnvelopeSchemaVersionSchema = exports.CASE_ENVELOPE_SCHEMA_VERSION = void 0;
|
|
31
|
+
const zod_1 = require("zod");
|
|
32
|
+
const primitives_1 = require("./primitives");
|
|
33
|
+
const policies_1 = require("./policies");
|
|
34
|
+
const resources_1 = require("./resources");
|
|
35
|
+
const taxonomy_1 = require("./taxonomy");
|
|
36
|
+
/**
|
|
37
|
+
* The contract version carried inside the payload.
|
|
38
|
+
*
|
|
39
|
+
* §10.11 keeps this separate from the `/v1` route version on purpose: the HTTP
|
|
40
|
+
* surface and the document shape evolve at different speeds, and an additive
|
|
41
|
+
* change to either bumps neither.
|
|
42
|
+
*/
|
|
43
|
+
exports.CASE_ENVELOPE_SCHEMA_VERSION = 'crowdsource.case.v1';
|
|
44
|
+
exports.CaseEnvelopeSchemaVersionSchema = zod_1.z.literal(exports.CASE_ENVELOPE_SCHEMA_VERSION);
|
|
45
|
+
/** §5.4 namespaced subject types. */
|
|
46
|
+
exports.STANDARD_SUBJECT_TYPES = [
|
|
47
|
+
'social.post',
|
|
48
|
+
'social.comment',
|
|
49
|
+
'chat.message',
|
|
50
|
+
'chat.conversation',
|
|
51
|
+
'identity.profile',
|
|
52
|
+
'commerce.listing',
|
|
53
|
+
'commerce.review',
|
|
54
|
+
'forum.thread',
|
|
55
|
+
'video.live_segment',
|
|
56
|
+
'document.file',
|
|
57
|
+
'gaming.username',
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* A subject type: one of §5.4's standard types, or an application's own
|
|
61
|
+
* `custom.<organization>.<object_type>`.
|
|
62
|
+
*
|
|
63
|
+
* The custom branch is a pattern rather than an open string so a tenant's
|
|
64
|
+
* private vocabulary is always visibly namespaced and can never collide with a
|
|
65
|
+
* standard type or be mistaken for one.
|
|
66
|
+
*/
|
|
67
|
+
exports.SubjectTypeSchema = zod_1.z.union([
|
|
68
|
+
zod_1.z.enum(exports.STANDARD_SUBJECT_TYPES),
|
|
69
|
+
zod_1.z
|
|
70
|
+
.string()
|
|
71
|
+
.max(primitives_1.CONTRACT_LIMITS.IDENTIFIER_MAX_LENGTH)
|
|
72
|
+
.regex(/^custom\.[a-z0-9][a-z0-9_-]*\.[a-z0-9][a-z0-9_-]*$/, 'a custom subject type must be "custom.<organization>.<object_type>"'),
|
|
73
|
+
]);
|
|
74
|
+
/** §5.1 / Appendix A `subject`. */
|
|
75
|
+
exports.CaseSubjectSchema = zod_1.z.strictObject({
|
|
76
|
+
externalId: primitives_1.ExternalIdSchema,
|
|
77
|
+
type: exports.SubjectTypeSchema,
|
|
78
|
+
primaryResourceId: resources_1.ResourceIdSchema,
|
|
79
|
+
/** Where the application's own users see the object. Never fetched by a jury. */
|
|
80
|
+
permalink: primitives_1.HttpUrlSchema.optional(),
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* §3 principal kinds.
|
|
84
|
+
*
|
|
85
|
+
* The plan defines a principal in prose — "an Oxy user, a local user, an
|
|
86
|
+
* organization, a bot or a federated actor" — and only ever writes `oxy_user`
|
|
87
|
+
* in an example. These are those five in the plan's own order; the tokens are
|
|
88
|
+
* this contract's, the concepts are the plan's.
|
|
89
|
+
*/
|
|
90
|
+
exports.PRINCIPAL_TYPES = [
|
|
91
|
+
'oxy_user',
|
|
92
|
+
'local_user',
|
|
93
|
+
'organization',
|
|
94
|
+
'bot',
|
|
95
|
+
'federated_actor',
|
|
96
|
+
];
|
|
97
|
+
exports.PrincipalTypeSchema = zod_1.z.enum(exports.PRINCIPAL_TYPES);
|
|
98
|
+
/**
|
|
99
|
+
* §5.1 `principalBindings` — proof that a pseudonymous ref corresponds to a
|
|
100
|
+
* verifiable identity.
|
|
101
|
+
*
|
|
102
|
+
* `bindingProofId` is REQUIRED for `oxy_user` and optional for every other
|
|
103
|
+
* principal type. That is the "no binding proof, no Oxy Trust effect" invariant
|
|
104
|
+
* made structural at the earliest possible point: an Oxy identity asserted
|
|
105
|
+
* without a proof cannot be expressed. The other four types can never move Oxy
|
|
106
|
+
* reputation anyway — they have no Oxy identity to move — and requiring a proof
|
|
107
|
+
* from them would lock out every tenant whose users are not Oxy users, which is
|
|
108
|
+
* the multi-tenant case this whole product exists for.
|
|
109
|
+
*/
|
|
110
|
+
exports.PrincipalBindingSchema = zod_1.z
|
|
111
|
+
.strictObject({
|
|
112
|
+
principalRef: resources_1.PrincipalRefSchema,
|
|
113
|
+
type: exports.PrincipalTypeSchema,
|
|
114
|
+
/** The application's own id for the actor. Pseudonymous to the jury. */
|
|
115
|
+
externalPrincipalId: primitives_1.ExternalIdSchema.optional(),
|
|
116
|
+
bindingProofId: primitives_1.IdentifierSchema.optional(),
|
|
117
|
+
boundAt: primitives_1.TimestampSchema.optional(),
|
|
118
|
+
})
|
|
119
|
+
.superRefine((binding, ctx) => {
|
|
120
|
+
if (binding.type === 'oxy_user' && binding.bindingProofId === undefined) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
code: 'custom',
|
|
123
|
+
path: ['bindingProofId'],
|
|
124
|
+
message: 'an oxy_user binding must carry a bindingProofId',
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* §5.1 `allegations` — what the reporter claims, not what is true.
|
|
130
|
+
*
|
|
131
|
+
* §9.1 requires the jury to see this as an unverified allegation, and §6.2
|
|
132
|
+
* shows the allegation and the finding diverging as the normal case. Only
|
|
133
|
+
* `code` is required: §5.8's example carries nothing else.
|
|
134
|
+
*/
|
|
135
|
+
exports.AllegationSchema = zod_1.z.strictObject({
|
|
136
|
+
code: taxonomy_1.TaxonomyCodeSchema,
|
|
137
|
+
resourceIds: zod_1.z
|
|
138
|
+
.array(resources_1.ResourceIdSchema)
|
|
139
|
+
.max(primitives_1.CONTRACT_LIMITS.RESOURCE_REFS_PER_FINDING_MAX)
|
|
140
|
+
.optional(),
|
|
141
|
+
reporterPrincipalRef: resources_1.PrincipalRefSchema.optional(),
|
|
142
|
+
details: zod_1.z.string().max(primitives_1.CONTRACT_LIMITS.LONG_TEXT_MAX_LENGTH).optional(),
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* The environment the report came from, as the APPLICATION sees it.
|
|
146
|
+
*
|
|
147
|
+
* `staging` is deliberately absent. The plan's §12.4 three-environment model is
|
|
148
|
+
* not what this ecosystem runs — CrowdSource has one deployment, and
|
|
149
|
+
* tenant-facing sandboxing is an application-trust state inside it. A report
|
|
150
|
+
* from a tenant's own pre-production is a sandbox report or it is a real one.
|
|
151
|
+
*/
|
|
152
|
+
exports.SOURCE_ENVIRONMENTS = ['production', 'sandbox'];
|
|
153
|
+
exports.SourceEnvironmentSchema = zod_1.z.enum(exports.SOURCE_ENVIRONMENTS);
|
|
154
|
+
/** Appendix A `source`. */
|
|
155
|
+
exports.CaseSourceSchema = zod_1.z.strictObject({
|
|
156
|
+
environment: exports.SourceEnvironmentSchema,
|
|
157
|
+
submittedAt: primitives_1.TimestampSchema,
|
|
158
|
+
});
|
|
159
|
+
/** §5.1 / Appendix A `privacy`. */
|
|
160
|
+
exports.CasePrivacySchema = zod_1.z.strictObject({
|
|
161
|
+
/** §13.6 defaults to 30 days after a final decision, configurable by policy. */
|
|
162
|
+
retentionDays: zod_1.z.number().int().positive().max(primitives_1.CONTRACT_LIMITS.RETENTION_DAYS_MAX),
|
|
163
|
+
/**
|
|
164
|
+
* Whether a community jury may see this at all. `false` routes the case to a
|
|
165
|
+
* specialist pool (§7.5); it is not a preference the triage may override
|
|
166
|
+
* upwards.
|
|
167
|
+
*/
|
|
168
|
+
allowCommunityReview: zod_1.z.boolean(),
|
|
169
|
+
containsPersonalData: zod_1.z.boolean().optional(),
|
|
170
|
+
sensitivityHint: taxonomy_1.SensitivityHintSchema.optional(),
|
|
171
|
+
});
|
|
172
|
+
/**
|
|
173
|
+
* §5.1 / Appendix A `urgency` — an input to triage, never to a verdict.
|
|
174
|
+
*
|
|
175
|
+
* `hint` stays an open lowercase token for the same reason as
|
|
176
|
+
* `sensitivityHint`: the plan names exactly one value (`normal`) and §7.4 makes
|
|
177
|
+
* clear the authoritative priority is computed server-side from several
|
|
178
|
+
* signals, of which this is one. Closing the list is a product decision that
|
|
179
|
+
* has not been made.
|
|
180
|
+
*/
|
|
181
|
+
exports.CaseUrgencySchema = zod_1.z.strictObject({
|
|
182
|
+
hint: zod_1.z
|
|
183
|
+
.string()
|
|
184
|
+
.min(1)
|
|
185
|
+
.max(40)
|
|
186
|
+
.regex(/^[a-z][a-z0-9_]*$/, 'must be a lowercase token'),
|
|
187
|
+
/** How many people the material reached, as the application counts it. */
|
|
188
|
+
reach: zod_1.z.number().int().nonnegative().optional(),
|
|
189
|
+
activeDistribution: zod_1.z.boolean().optional(),
|
|
190
|
+
});
|
|
191
|
+
const caseEnvelopeShape = {
|
|
192
|
+
schemaVersion: exports.CaseEnvelopeSchemaVersionSchema,
|
|
193
|
+
/**
|
|
194
|
+
* An assertion by the caller, never the source of tenancy.
|
|
195
|
+
*
|
|
196
|
+
* `applicationId` comes from the credential (Appendix F). This field exists
|
|
197
|
+
* so a mismatch can be DETECTED — the ingress route compares it to the
|
|
198
|
+
* credential-derived id and rejects a disagreement rather than trusting
|
|
199
|
+
* either side silently. No schema can enforce that; it is stated here so the
|
|
200
|
+
* rule travels with the field it constrains.
|
|
201
|
+
*/
|
|
202
|
+
applicationId: primitives_1.IdentifierSchema,
|
|
203
|
+
externalReportId: primitives_1.ExternalIdSchema,
|
|
204
|
+
source: exports.CaseSourceSchema.optional(),
|
|
205
|
+
subject: exports.CaseSubjectSchema,
|
|
206
|
+
principalBindings: zod_1.z
|
|
207
|
+
.array(exports.PrincipalBindingSchema)
|
|
208
|
+
.max(primitives_1.CONTRACT_LIMITS.PRINCIPAL_BINDINGS_PER_ENVELOPE_MAX),
|
|
209
|
+
resources: zod_1.z.array(resources_1.ResourceSchema).min(1).max(primitives_1.CONTRACT_LIMITS.RESOURCES_PER_ENVELOPE_MAX),
|
|
210
|
+
relations: zod_1.z.array(resources_1.RelationSchema).max(primitives_1.CONTRACT_LIMITS.RELATIONS_PER_ENVELOPE_MAX),
|
|
211
|
+
allegations: zod_1.z.array(exports.AllegationSchema).min(1).max(primitives_1.CONTRACT_LIMITS.ALLEGATIONS_PER_ENVELOPE_MAX),
|
|
212
|
+
policy: policies_1.CasePolicyRefSchema,
|
|
213
|
+
privacy: exports.CasePrivacySchema,
|
|
214
|
+
urgency: exports.CaseUrgencySchema.optional(),
|
|
215
|
+
metadata: primitives_1.MetadataBagSchema.optional(),
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* The Case Envelope.
|
|
219
|
+
*
|
|
220
|
+
* `principalBindings`, `resources`, `relations` and `allegations` are all
|
|
221
|
+
* required keys, matching §5.1's declared root structure and both worked
|
|
222
|
+
* examples; `resources` and `allegations` additionally require at least one
|
|
223
|
+
* entry, because an envelope with nothing to look at or no claim to evaluate is
|
|
224
|
+
* not a case. `source`, `urgency` and `metadata` are optional — §5.8 omits all
|
|
225
|
+
* three, Appendix A carries all three.
|
|
226
|
+
*/
|
|
227
|
+
exports.CaseEnvelopeSchema = zod_1.z
|
|
228
|
+
.strictObject(caseEnvelopeShape)
|
|
229
|
+
.superRefine((envelope, ctx) => {
|
|
230
|
+
const resourceIds = new Set();
|
|
231
|
+
envelope.resources.forEach((resource, index) => {
|
|
232
|
+
if (resourceIds.has(resource.id)) {
|
|
233
|
+
ctx.addIssue({
|
|
234
|
+
code: 'custom',
|
|
235
|
+
path: ['resources', index, 'id'],
|
|
236
|
+
message: `duplicate resource id "${resource.id}"`,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
resourceIds.add(resource.id);
|
|
240
|
+
});
|
|
241
|
+
const principalRefs = new Set();
|
|
242
|
+
envelope.principalBindings.forEach((binding, index) => {
|
|
243
|
+
if (principalRefs.has(binding.principalRef)) {
|
|
244
|
+
ctx.addIssue({
|
|
245
|
+
code: 'custom',
|
|
246
|
+
path: ['principalBindings', index, 'principalRef'],
|
|
247
|
+
message: `duplicate principalRef "${binding.principalRef}"`,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
principalRefs.add(binding.principalRef);
|
|
251
|
+
});
|
|
252
|
+
const requireResource = (id, path) => {
|
|
253
|
+
if (!resourceIds.has(id)) {
|
|
254
|
+
ctx.addIssue({
|
|
255
|
+
code: 'custom',
|
|
256
|
+
path,
|
|
257
|
+
message: `no resource in this envelope has id "${id}"`,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const requirePrincipal = (ref, path) => {
|
|
262
|
+
if (!principalRefs.has(ref)) {
|
|
263
|
+
ctx.addIssue({
|
|
264
|
+
code: 'custom',
|
|
265
|
+
path,
|
|
266
|
+
message: `no principal binding in this envelope has principalRef "${ref}"`,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
requireResource(envelope.subject.primaryResourceId, ['subject', 'primaryResourceId']);
|
|
271
|
+
const primary = envelope.resources.find((resource) => resource.id === envelope.subject.primaryResourceId);
|
|
272
|
+
if (primary !== undefined && primary.role !== 'subject') {
|
|
273
|
+
ctx.addIssue({
|
|
274
|
+
code: 'custom',
|
|
275
|
+
path: ['subject', 'primaryResourceId'],
|
|
276
|
+
message: `the primary resource must have role "subject", not "${primary.role}"`,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
envelope.resources.forEach((resource, index) => {
|
|
280
|
+
if (resource.authorPrincipalRef !== undefined) {
|
|
281
|
+
requirePrincipal(resource.authorPrincipalRef, ['resources', index, 'authorPrincipalRef']);
|
|
282
|
+
}
|
|
283
|
+
switch (resource.type) {
|
|
284
|
+
case 'profile':
|
|
285
|
+
if (resource.data.avatarRef !== undefined) {
|
|
286
|
+
requireResource(resource.data.avatarRef, ['resources', index, 'data', 'avatarRef']);
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
case 'conversation':
|
|
290
|
+
resource.data.messageResourceIds.forEach((messageId, messageIndex) => {
|
|
291
|
+
requireResource(messageId, [
|
|
292
|
+
'resources',
|
|
293
|
+
index,
|
|
294
|
+
'data',
|
|
295
|
+
'messageResourceIds',
|
|
296
|
+
messageIndex,
|
|
297
|
+
]);
|
|
298
|
+
});
|
|
299
|
+
break;
|
|
300
|
+
case 'listing':
|
|
301
|
+
if (resource.data.sellerRef !== undefined) {
|
|
302
|
+
requirePrincipal(resource.data.sellerRef, ['resources', index, 'data', 'sellerRef']);
|
|
303
|
+
}
|
|
304
|
+
resource.data.mediaRefs?.forEach((mediaId, mediaIndex) => {
|
|
305
|
+
requireResource(mediaId, ['resources', index, 'data', 'mediaRefs', mediaIndex]);
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
default:
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
const seenRelations = new Set();
|
|
313
|
+
envelope.relations.forEach((relation, index) => {
|
|
314
|
+
requireResource(relation.from, ['relations', index, 'from']);
|
|
315
|
+
if (resources_1.PRINCIPAL_TARGETED_RELATION_TYPES.some((type) => type === relation.type)) {
|
|
316
|
+
requirePrincipal(relation.to, ['relations', index, 'to']);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
requireResource(relation.to, ['relations', index, 'to']);
|
|
320
|
+
if (relation.from === relation.to) {
|
|
321
|
+
ctx.addIssue({
|
|
322
|
+
code: 'custom',
|
|
323
|
+
path: ['relations', index, 'to'],
|
|
324
|
+
message: 'a resource cannot relate to itself',
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const key = `${relation.from}${relation.type}${relation.to}`;
|
|
329
|
+
if (seenRelations.has(key)) {
|
|
330
|
+
ctx.addIssue({
|
|
331
|
+
code: 'custom',
|
|
332
|
+
path: ['relations', index],
|
|
333
|
+
message: 'duplicate relation',
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
seenRelations.add(key);
|
|
337
|
+
});
|
|
338
|
+
envelope.allegations.forEach((allegation, index) => {
|
|
339
|
+
allegation.resourceIds?.forEach((resourceId, resourceIndex) => {
|
|
340
|
+
requireResource(resourceId, ['allegations', index, 'resourceIds', resourceIndex]);
|
|
341
|
+
});
|
|
342
|
+
if (allegation.reporterPrincipalRef !== undefined) {
|
|
343
|
+
requirePrincipal(allegation.reporterPrincipalRef, [
|
|
344
|
+
'allegations',
|
|
345
|
+
index,
|
|
346
|
+
'reporterPrincipalRef',
|
|
347
|
+
]);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
/** §3.2 report states. */
|
|
352
|
+
exports.REPORT_STATUSES = ['received', 'merged', 'invalid', 'withdrawn', 'closed'];
|
|
353
|
+
exports.ReportStatusSchema = zod_1.z.enum(exports.REPORT_STATUSES);
|
|
354
|
+
/**
|
|
355
|
+
* `POST /v1/reports` (§10.4).
|
|
356
|
+
*
|
|
357
|
+
* The request repeats `externalReportId` outside the envelope, so the two must
|
|
358
|
+
* agree — a mismatch means the idempotency key and the document disagree about
|
|
359
|
+
* which report this is, and §12.7's `application_id + external_report_id`
|
|
360
|
+
* uniqueness would then be enforced against the wrong value.
|
|
361
|
+
*/
|
|
362
|
+
exports.CreateReportRequestSchema = zod_1.z
|
|
363
|
+
.strictObject({
|
|
364
|
+
externalReportId: primitives_1.ExternalIdSchema,
|
|
365
|
+
envelope: exports.CaseEnvelopeSchema,
|
|
366
|
+
})
|
|
367
|
+
.superRefine((request, ctx) => {
|
|
368
|
+
if (request.externalReportId !== request.envelope.externalReportId) {
|
|
369
|
+
ctx.addIssue({
|
|
370
|
+
code: 'custom',
|
|
371
|
+
path: ['envelope', 'externalReportId'],
|
|
372
|
+
message: 'externalReportId must match the envelope',
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
/** The `202 Accepted` body of §10.4. Loose: it travels outbound (§10.11). */
|
|
377
|
+
exports.CreateReportResponseSchema = zod_1.z.looseObject({
|
|
378
|
+
reportId: primitives_1.IdentifierSchema,
|
|
379
|
+
caseId: primitives_1.IdentifierSchema,
|
|
380
|
+
status: exports.ReportStatusSchema,
|
|
381
|
+
merged: zod_1.z.boolean(),
|
|
382
|
+
});
|
|
383
|
+
//# sourceMappingURL=case-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case-envelope.js","sourceRoot":"","sources":["../src/case-envelope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAEH,6BAAwB;AAExB,6CAOsB;AACtB,yCAAiD;AACjD,2CAMqB;AACrB,yCAAuE;AAEvE;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG,qBAAqB,CAAC;AAErD,QAAA,+BAA+B,GAAG,OAAC,CAAC,OAAO,CAAC,oCAA4B,CAAC,CAAC;AAEvF,qCAAqC;AACxB,QAAA,sBAAsB,GAAG;IACpC,aAAa;IACb,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,eAAe;IACf,iBAAiB;CACT,CAAC;AAEX;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC;IACvC,OAAC,CAAC,IAAI,CAAC,8BAAsB,CAAC;IAC9B,OAAC;SACE,MAAM,EAAE;SACR,GAAG,CAAC,4BAAe,CAAC,qBAAqB,CAAC;SAC1C,KAAK,CACJ,oDAAoD,EACpD,qEAAqE,CACtE;CACJ,CAAC,CAAC;AAGH,mCAAmC;AACtB,QAAA,iBAAiB,GAAG,OAAC,CAAC,YAAY,CAAC;IAC9C,UAAU,EAAE,6BAAgB;IAC5B,IAAI,EAAE,yBAAiB;IACvB,iBAAiB,EAAE,4BAAgB;IACnC,iFAAiF;IACjF,SAAS,EAAE,0BAAa,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAGH;;;;;;;GAOG;AACU,QAAA,eAAe,GAAG;IAC7B,UAAU;IACV,YAAY;IACZ,cAAc;IACd,KAAK;IACL,iBAAiB;CACT,CAAC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