@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.
Files changed (57) hide show
  1. package/README.md +129 -0
  2. package/dist/case-envelope.d.ts +1130 -0
  3. package/dist/case-envelope.d.ts.map +1 -0
  4. package/dist/case-envelope.js +383 -0
  5. package/dist/case-envelope.js.map +1 -0
  6. package/dist/decisions.d.ts +353 -0
  7. package/dist/decisions.d.ts.map +1 -0
  8. package/dist/decisions.js +198 -0
  9. package/dist/decisions.js.map +1 -0
  10. package/dist/index.d.ts +45 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +61 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/json-schema.d.ts +43 -0
  15. package/dist/json-schema.d.ts.map +1 -0
  16. package/dist/json-schema.js +83 -0
  17. package/dist/json-schema.js.map +1 -0
  18. package/dist/policies.d.ts +286 -0
  19. package/dist/policies.d.ts.map +1 -0
  20. package/dist/policies.js +178 -0
  21. package/dist/policies.js.map +1 -0
  22. package/dist/primitives.d.ts +185 -0
  23. package/dist/primitives.d.ts.map +1 -0
  24. package/dist/primitives.js +231 -0
  25. package/dist/primitives.js.map +1 -0
  26. package/dist/reputation-events.d.ts +349 -0
  27. package/dist/reputation-events.d.ts.map +1 -0
  28. package/dist/reputation-events.js +128 -0
  29. package/dist/reputation-events.js.map +1 -0
  30. package/dist/resources.d.ts +484 -0
  31. package/dist/resources.d.ts.map +1 -0
  32. package/dist/resources.js +436 -0
  33. package/dist/resources.js.map +1 -0
  34. package/dist/reviews.d.ts +276 -0
  35. package/dist/reviews.d.ts.map +1 -0
  36. package/dist/reviews.js +144 -0
  37. package/dist/reviews.js.map +1 -0
  38. package/dist/taxonomy.d.ts +266 -0
  39. package/dist/taxonomy.d.ts.map +1 -0
  40. package/dist/taxonomy.js +282 -0
  41. package/dist/taxonomy.js.map +1 -0
  42. package/dist/webhooks.d.ts +604 -0
  43. package/dist/webhooks.d.ts.map +1 -0
  44. package/dist/webhooks.js +192 -0
  45. package/dist/webhooks.js.map +1 -0
  46. package/package.json +56 -0
  47. package/src/case-envelope.ts +433 -0
  48. package/src/decisions.ts +216 -0
  49. package/src/index.ts +45 -0
  50. package/src/json-schema.ts +89 -0
  51. package/src/policies.ts +203 -0
  52. package/src/primitives.ts +283 -0
  53. package/src/reputation-events.ts +144 -0
  54. package/src/resources.ts +489 -0
  55. package/src/reviews.ts +159 -0
  56. package/src/taxonomy.ts +313 -0
  57. package/src/webhooks.ts +215 -0
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Public entry point for `@oxyhq/crowdsource-contracts`.
4
+ *
5
+ * The contracts every CrowdSource surface agrees on: the backend, the reviewer
6
+ * and console clients, the published SDKs, and third-party integrators. One
7
+ * entry point because the package publishes one `exports` path — this is the
8
+ * package boundary, not a convenience barrel over an internal tree.
9
+ *
10
+ * Two version numbers live here and mean different things. `/v1` is the route
11
+ * prefix and is not this package's business. `CASE_ENVELOPE_SCHEMA_VERSION`
12
+ * travels inside the payload and is validated separately (§10.11). Additive
13
+ * changes bump neither.
14
+ *
15
+ * Where strictness lands, and why, since it is the one thing a reader will want
16
+ * to look up:
17
+ *
18
+ * * **Inbound from a tenant or a reviewer — strict.** The Case Envelope tree,
19
+ * the review submission, the recusal, the policy set, the resource schema
20
+ * registration. A dropped field here is context a jury never sees or an
21
+ * input nobody reviewed, and §10.11 makes the exception explicitly for
22
+ * fields "the schema forbids for safety".
23
+ * * **Outbound to a tenant — loose.** Decisions, webhook envelopes and event
24
+ * payloads pass unknown fields through, so a newer CrowdSource never breaks
25
+ * an older client and a receiver that persists `event.data` keeps all of it.
26
+ * * **Internal, to Oxy Trust — strict.** The reputation event carries no
27
+ * resource ids and no free text on purpose; an unrecognised field is how
28
+ * content reaches a reputation ledger. The `.v1` in the event type is what
29
+ * handles evolution there.
30
+ *
31
+ * Open bags (`metadata`, custom payloads, registered JSON Schemas) are the
32
+ * deliberate exception in both directions: open by definition, but flat or
33
+ * depth-bounded, scalar-typed, key-restricted and free of prototype-bearing
34
+ * names.
35
+ */
36
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
37
+ if (k2 === undefined) k2 = k;
38
+ var desc = Object.getOwnPropertyDescriptor(m, k);
39
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
40
+ desc = { enumerable: true, get: function() { return m[k]; } };
41
+ }
42
+ Object.defineProperty(o, k2, desc);
43
+ }) : (function(o, m, k, k2) {
44
+ if (k2 === undefined) k2 = k;
45
+ o[k2] = m[k];
46
+ }));
47
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
48
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ __exportStar(require("./primitives"), exports);
52
+ __exportStar(require("./taxonomy"), exports);
53
+ __exportStar(require("./policies"), exports);
54
+ __exportStar(require("./resources"), exports);
55
+ __exportStar(require("./case-envelope"), exports);
56
+ __exportStar(require("./reviews"), exports);
57
+ __exportStar(require("./decisions"), exports);
58
+ __exportStar(require("./webhooks"), exports);
59
+ __exportStar(require("./reputation-events"), exports);
60
+ __exportStar(require("./json-schema"), exports);
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;;;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,6CAA2B;AAC3B,6CAA2B;AAC3B,8CAA4B;AAC5B,kDAAgC;AAChC,4CAA0B;AAC1B,8CAA4B;AAC5B,6CAA2B;AAC3B,sDAAoC;AACpC,gDAA8B"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The same contracts as JSON Schema, for integrators who are not on TypeScript.
3
+ *
4
+ * §15.2 asks for "Zod and exportable JSON Schema". Conversion is deliberately
5
+ * lazy — a function, not a frozen constant — so importing the package to
6
+ * validate one report does not pay for thirteen schema conversions.
7
+ *
8
+ * **What JSON Schema does NOT carry.** Zod refinements have no JSON Schema
9
+ * equivalent and are dropped silently by the conversion. Everything structural
10
+ * survives — types, enums, patterns, bounds, required keys, `additionalProperties`
11
+ * — and every cross-field and cross-reference rule does not:
12
+ *
13
+ * * §5.5 reference resolution (relations, `primaryResourceId`, allegation
14
+ * resource ids, author and seller refs, conversation members, avatars)
15
+ * * the `oxy_user` binding-proof requirement
16
+ * * exactly-one-of `uploadId`/`url`, media type agreement, coarse coordinates,
17
+ * price-with-currency
18
+ * * `agreement = winningVotes / decisiveVotes` and the vote count nesting
19
+ * * revision 1 supersedes nothing / later revisions must
20
+ * * `externalReportId` matching between request and envelope
21
+ *
22
+ * So a payload that passes the JSON Schema is well-FORMED, not accepted. The
23
+ * server validates with Zod, and that is the authority. This is stated here
24
+ * because an integrator who assumes otherwise will build against a contract
25
+ * that is looser than the one they will meet in production, and will discover
26
+ * the difference as a 422.
27
+ */
28
+ import { z } from 'zod';
29
+ /** A JSON Schema document, as produced by the conversion. */
30
+ export type JsonSchemaDocument = z.core.JSONSchema.BaseSchema;
31
+ export declare const CONTRACT_JSON_SCHEMA_NAMES: readonly ["case-envelope", "create-report-request", "create-report-response", "resource", "relation", "resource-schema-registration", "policy-set-version", "review-submission", "recusal-submission", "decision", "webhook-event-envelope", "known-webhook-event", "reputation-event"];
32
+ export type ContractJsonSchemaName = (typeof CONTRACT_JSON_SCHEMA_NAMES)[number];
33
+ /**
34
+ * The Zod schema behind each published name.
35
+ *
36
+ * Typed as an exhaustive `Record` so adding a name without a schema — or a
37
+ * schema without a name — is a compile error rather than a runtime hole in the
38
+ * exported contract set.
39
+ */
40
+ export declare const CONTRACT_SCHEMAS: Record<ContractJsonSchemaName, z.ZodType>;
41
+ /** The JSON Schema for one published contract. */
42
+ export declare function crowdSourceJsonSchema(name: ContractJsonSchemaName): JsonSchemaDocument;
43
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;AAE9D,eAAO,MAAM,0BAA0B,yRAc7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,OAAO,CActE,CAAC;AAKF,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,CAEtF"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * The same contracts as JSON Schema, for integrators who are not on TypeScript.
4
+ *
5
+ * §15.2 asks for "Zod and exportable JSON Schema". Conversion is deliberately
6
+ * lazy — a function, not a frozen constant — so importing the package to
7
+ * validate one report does not pay for thirteen schema conversions.
8
+ *
9
+ * **What JSON Schema does NOT carry.** Zod refinements have no JSON Schema
10
+ * equivalent and are dropped silently by the conversion. Everything structural
11
+ * survives — types, enums, patterns, bounds, required keys, `additionalProperties`
12
+ * — and every cross-field and cross-reference rule does not:
13
+ *
14
+ * * §5.5 reference resolution (relations, `primaryResourceId`, allegation
15
+ * resource ids, author and seller refs, conversation members, avatars)
16
+ * * the `oxy_user` binding-proof requirement
17
+ * * exactly-one-of `uploadId`/`url`, media type agreement, coarse coordinates,
18
+ * price-with-currency
19
+ * * `agreement = winningVotes / decisiveVotes` and the vote count nesting
20
+ * * revision 1 supersedes nothing / later revisions must
21
+ * * `externalReportId` matching between request and envelope
22
+ *
23
+ * So a payload that passes the JSON Schema is well-FORMED, not accepted. The
24
+ * server validates with Zod, and that is the authority. This is stated here
25
+ * because an integrator who assumes otherwise will build against a contract
26
+ * that is looser than the one they will meet in production, and will discover
27
+ * the difference as a 422.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.CONTRACT_SCHEMAS = exports.CONTRACT_JSON_SCHEMA_NAMES = void 0;
31
+ exports.crowdSourceJsonSchema = crowdSourceJsonSchema;
32
+ const zod_1 = require("zod");
33
+ const case_envelope_1 = require("./case-envelope");
34
+ const decisions_1 = require("./decisions");
35
+ const policies_1 = require("./policies");
36
+ const reputation_events_1 = require("./reputation-events");
37
+ const resources_1 = require("./resources");
38
+ const reviews_1 = require("./reviews");
39
+ const webhooks_1 = require("./webhooks");
40
+ exports.CONTRACT_JSON_SCHEMA_NAMES = [
41
+ 'case-envelope',
42
+ 'create-report-request',
43
+ 'create-report-response',
44
+ 'resource',
45
+ 'relation',
46
+ 'resource-schema-registration',
47
+ 'policy-set-version',
48
+ 'review-submission',
49
+ 'recusal-submission',
50
+ 'decision',
51
+ 'webhook-event-envelope',
52
+ 'known-webhook-event',
53
+ 'reputation-event',
54
+ ];
55
+ /**
56
+ * The Zod schema behind each published name.
57
+ *
58
+ * Typed as an exhaustive `Record` so adding a name without a schema — or a
59
+ * schema without a name — is a compile error rather than a runtime hole in the
60
+ * exported contract set.
61
+ */
62
+ exports.CONTRACT_SCHEMAS = {
63
+ 'case-envelope': case_envelope_1.CaseEnvelopeSchema,
64
+ 'create-report-request': case_envelope_1.CreateReportRequestSchema,
65
+ 'create-report-response': case_envelope_1.CreateReportResponseSchema,
66
+ resource: resources_1.ResourceSchema,
67
+ relation: resources_1.RelationSchema,
68
+ 'resource-schema-registration': resources_1.ResourceSchemaRegistrationSchema,
69
+ 'policy-set-version': policies_1.PolicySetVersionSchema,
70
+ 'review-submission': reviews_1.ReviewSubmissionSchema,
71
+ 'recusal-submission': reviews_1.RecusalSubmissionSchema,
72
+ decision: decisions_1.DecisionSchema,
73
+ 'webhook-event-envelope': webhooks_1.WebhookEventEnvelopeSchema,
74
+ 'known-webhook-event': webhooks_1.KnownWebhookEventSchema,
75
+ 'reputation-event': reputation_events_1.ReputationEventSchema,
76
+ };
77
+ /** JSON Schema draft 2020-12, so `$defs` and `unevaluatedProperties` mean what integrators expect. */
78
+ const JSON_SCHEMA_TARGET = 'draft-2020-12';
79
+ /** The JSON Schema for one published contract. */
80
+ function crowdSourceJsonSchema(name) {
81
+ return zod_1.z.toJSONSchema(exports.CONTRACT_SCHEMAS[name], { target: JSON_SCHEMA_TARGET });
82
+ }
83
+ //# sourceMappingURL=json-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AA4DH,sDAEC;AA5DD,6BAAwB;AAExB,mDAA4G;AAC5G,2CAA6C;AAC7C,yCAAoD;AACpD,2DAA4D;AAC5D,2CAA+F;AAC/F,uCAA4E;AAC5E,yCAAiF;AAKpE,QAAA,0BAA0B,GAAG;IACxC,eAAe;IACf,uBAAuB;IACvB,wBAAwB;IACxB,UAAU;IACV,UAAU;IACV,8BAA8B;IAC9B,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,UAAU;IACV,wBAAwB;IACxB,qBAAqB;IACrB,kBAAkB;CACV,CAAC;AAIX;;;;;;GAMG;AACU,QAAA,gBAAgB,GAA8C;IACzE,eAAe,EAAE,kCAAkB;IACnC,uBAAuB,EAAE,yCAAyB;IAClD,wBAAwB,EAAE,0CAA0B;IACpD,QAAQ,EAAE,0BAAc;IACxB,QAAQ,EAAE,0BAAc;IACxB,8BAA8B,EAAE,4CAAgC;IAChE,oBAAoB,EAAE,iCAAsB;IAC5C,mBAAmB,EAAE,gCAAsB;IAC3C,oBAAoB,EAAE,iCAAuB;IAC7C,QAAQ,EAAE,0BAAc;IACxB,wBAAwB,EAAE,qCAA0B;IACpD,qBAAqB,EAAE,kCAAuB;IAC9C,kBAAkB,EAAE,yCAAqB;CAC1C,CAAC;AAEF,sGAAsG;AACtG,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAE3C,kDAAkD;AAClD,SAAgB,qBAAqB,CAAC,IAA4B;IAChE,OAAO,OAAC,CAAC,YAAY,CAAC,wBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,286 @@
1
+ /**
2
+ * The application-policy layer (§6.1 layer 2) and policy versioning (§6.4).
3
+ *
4
+ * The taxonomy says what the material contains; a policy set says whether that
5
+ * violates THIS application's rules. The two are versioned independently and
6
+ * every decision records both (plus the Oxy conduct policy version), because
7
+ * §6.4 forbids a policy update from silently changing what a past decision
8
+ * meant.
9
+ *
10
+ * The security boundary of this module is §6.4's last line: "rules must be
11
+ * expressed as data, not as arbitrary code supplied by the tenant". A rule here
12
+ * therefore has an id, a title, the taxonomy codes it responds to, a default
13
+ * severity and recommended actions — and no expression, predicate, script,
14
+ * template or callback field of any kind. That absence is the control. It is
15
+ * enforced by `.strict()`: a policy set carrying an unrecognised key is
16
+ * rejected outright rather than accepted with the key quietly dropped, because
17
+ * "dropped" and "never evaluated" look identical right up until something
18
+ * decides to evaluate it.
19
+ */
20
+ import { z } from 'zod';
21
+ /** A namespaced policy set id, e.g. `mention.community`. */
22
+ export declare const PolicySetIdSchema: z.ZodString;
23
+ /** A rule id within a policy set, e.g. `mention.harassment.2`. */
24
+ export declare const PolicyRuleIdSchema: z.ZodString;
25
+ /**
26
+ * An immutable policy version token, e.g. `2026.07`, `mention.2026.07`,
27
+ * `oxy.2026.1`.
28
+ *
29
+ * Deliberately not semver: the plan's own tokens are calendar-shaped and
30
+ * tenant-prefixed, and a policy version is an opaque label pointing at a frozen
31
+ * document — nothing compares two of them for ordering.
32
+ */
33
+ export declare const PolicyVersionSchema: z.ZodString;
34
+ /**
35
+ * The version of the Oxy Conduct Policy every decision is stamped with (§6.4).
36
+ *
37
+ * §6.1 assigns the third layer — "should this conduct affect global Oxy trust?"
38
+ * — to the Oxy Conduct Policy, evaluated by the Reputation Bridge. That bridge
39
+ * does not exist yet, and this constant is deliberately NOT a promise that it
40
+ * does. What it is: the label a decision published today records, so that when
41
+ * the bridge arrives it can tell which conduct policy a historical decision was
42
+ * decided under and refuse to re-interpret it under a newer one. §6.4's "a
43
+ * policy update never silently rewrites historical decisions" is unenforceable
44
+ * without a version on every decision from the first one.
45
+ *
46
+ * The value is Appendix B's. It is pinned here, in the package both the
47
+ * decision DTO and the reputation event import, so the two cannot drift into
48
+ * describing the same decision under two different conduct policies.
49
+ */
50
+ export declare const OXY_CONDUCT_POLICY_VERSION = "oxy.2026.1";
51
+ /**
52
+ * The policy an envelope asks to be evaluated under (§5.1 `policy`).
53
+ *
54
+ * `locale` selects the language the policy text is shown to the reviewer in
55
+ * (Appendix A), and is not the language of the reported material — that is
56
+ * `resource.language`.
57
+ */
58
+ export declare const CasePolicyRefSchema: z.ZodObject<{
59
+ policySetId: z.ZodString;
60
+ version: z.ZodString;
61
+ locale: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>;
63
+ export type CasePolicyRef = z.infer<typeof CasePolicyRefSchema>;
64
+ /**
65
+ * The three policy versions a decision is decided under (§6.4).
66
+ *
67
+ * Field names follow Appendix B (`taxonomy`), which is the reference Decision.
68
+ * §6.4's prose calls the same field `universalTaxonomyVersion` and §11.6's
69
+ * internal event calls it `universal`; see `ReputationPolicyVersionsSchema` for
70
+ * why both spellings survive.
71
+ */
72
+ export declare const DecisionPolicyVersionsSchema: z.ZodObject<{
73
+ taxonomy: z.ZodString;
74
+ application: z.ZodString;
75
+ oxyConduct: z.ZodString;
76
+ }, z.core.$loose>;
77
+ export type DecisionPolicyVersions = z.infer<typeof DecisionPolicyVersionsSchema>;
78
+ /**
79
+ * The same three versions as carried by the internal reputation event (§11.6).
80
+ *
81
+ * §11.6 spells the first key `universal` where Appendix B spells it `taxonomy`.
82
+ * Both are reference payloads in the approved plan and both are load-bearing
83
+ * for a different consumer, so each surface keeps the spelling its own
84
+ * reference document uses rather than one of the two documents being quietly
85
+ * rewritten here. Unifying them is a one-line change and worth doing when the
86
+ * event contract is agreed with OxyHQServices — it is called out in the package
87
+ * README as the single naming inconsistency the contract preserves on purpose.
88
+ */
89
+ export declare const ReputationPolicyVersionsSchema: z.ZodObject<{
90
+ universal: z.ZodString;
91
+ application: z.ZodString;
92
+ oxyConduct: z.ZodString;
93
+ }, z.core.$strict>;
94
+ export type ReputationPolicyVersions = z.infer<typeof ReputationPolicyVersionsSchema>;
95
+ /** §6.4: a draft may be edited, a published version may not. */
96
+ export declare const POLICY_SET_STATUSES: readonly ["draft", "published"];
97
+ export declare const PolicySetStatusSchema: z.ZodEnum<{
98
+ draft: "draft";
99
+ published: "published";
100
+ }>;
101
+ export type PolicySetStatus = z.infer<typeof PolicySetStatusSchema>;
102
+ /**
103
+ * One rule inside a policy version — data, never code.
104
+ *
105
+ * `taxonomyCodes` is what binds layer 2 back to layer 1: the rule declares
106
+ * which universal findings it responds to, so a jury classifies once (§9.2 step
107
+ * one) and any number of applications evaluate that same classification against
108
+ * their own rules (§6.2).
109
+ */
110
+ export declare const PolicyRuleSchema: z.ZodObject<{
111
+ id: z.ZodString;
112
+ title: z.ZodString;
113
+ description: z.ZodOptional<z.ZodString>;
114
+ taxonomyCodes: z.ZodArray<z.ZodEnum<{
115
+ "integrity.spam": "integrity.spam";
116
+ "integrity.scam": "integrity.scam";
117
+ "integrity.fraud": "integrity.fraud";
118
+ "integrity.impersonation": "integrity.impersonation";
119
+ "integrity.coordinated_manipulation": "integrity.coordinated_manipulation";
120
+ "harassment.insult": "harassment.insult";
121
+ "harassment.targeted_abuse": "harassment.targeted_abuse";
122
+ "harassment.sexual_harassment": "harassment.sexual_harassment";
123
+ "harassment.doxxing": "harassment.doxxing";
124
+ "harassment.credible_threat": "harassment.credible_threat";
125
+ "hate.dehumanization": "hate.dehumanization";
126
+ "hate.slur": "hate.slur";
127
+ "hate.incitement": "hate.incitement";
128
+ "hate.protected_targeting": "hate.protected_targeting";
129
+ "violence.graphic": "violence.graphic";
130
+ "violence.threat": "violence.threat";
131
+ "violence.instruction": "violence.instruction";
132
+ "violence.celebration": "violence.celebration";
133
+ "sexual_content.nudity": "sexual_content.nudity";
134
+ "sexual_content.explicit_activity": "sexual_content.explicit_activity";
135
+ "sexual_content.non_consensual": "sexual_content.non_consensual";
136
+ "sexual_content.exploitation": "sexual_content.exploitation";
137
+ "child_safety.sexualization": "child_safety.sexualization";
138
+ "child_safety.grooming": "child_safety.grooming";
139
+ "child_safety.exploitation": "child_safety.exploitation";
140
+ "self_harm.promotion": "self_harm.promotion";
141
+ "self_harm.instruction": "self_harm.instruction";
142
+ "self_harm.imminent_risk": "self_harm.imminent_risk";
143
+ "privacy.personal_information": "privacy.personal_information";
144
+ "privacy.intimate_media": "privacy.intimate_media";
145
+ "privacy.location_exposure": "privacy.location_exposure";
146
+ "commerce.prohibited_item": "commerce.prohibited_item";
147
+ "commerce.counterfeit": "commerce.counterfeit";
148
+ "commerce.misleading_listing": "commerce.misleading_listing";
149
+ "commerce.unsafe_product": "commerce.unsafe_product";
150
+ "platform_abuse.ban_evasion": "platform_abuse.ban_evasion";
151
+ "platform_abuse.report_abuse": "platform_abuse.report_abuse";
152
+ "platform_abuse.automation_abuse": "platform_abuse.automation_abuse";
153
+ "other.policy_specific": "other.policy_specific";
154
+ "other.unclassifiable": "other.unclassifiable";
155
+ }>>;
156
+ defaultSeverity: z.ZodOptional<z.ZodEnum<{
157
+ low: "low";
158
+ medium: "medium";
159
+ high: "high";
160
+ critical: "critical";
161
+ }>>;
162
+ recommendedActions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
163
+ remove_or_restrict: "remove_or_restrict";
164
+ allow_with_label: "allow_with_label";
165
+ remove: "remove";
166
+ hide: "hide";
167
+ label: "label";
168
+ age_gate: "age_gate";
169
+ reduce_distribution: "reduce_distribution";
170
+ freeze_transaction: "freeze_transaction";
171
+ suspend_user: "suspend_user";
172
+ request_changes: "request_changes";
173
+ allow: "allow";
174
+ restore: "restore";
175
+ no_action: "no_action";
176
+ request_more_context: "request_more_context";
177
+ hold: "hold";
178
+ local_manual_review: "local_manual_review";
179
+ keep_restricted_temporarily: "keep_restricted_temporarily";
180
+ escalate: "escalate";
181
+ no_global_effect: "no_global_effect";
182
+ specialist_queue: "specialist_queue";
183
+ legal_queue: "legal_queue";
184
+ safety_queue: "safety_queue";
185
+ }>>>;
186
+ }, z.core.$strict>;
187
+ export type PolicyRule = z.infer<typeof PolicyRuleSchema>;
188
+ /**
189
+ * A policy set at one version (§6.4).
190
+ *
191
+ * The `status`/`publishedAt` pairing is the immutability rule expressed where a
192
+ * schema can express it: a published version must record when it was published,
193
+ * and a draft must not claim to have been. Actual immutability — never
194
+ * rewriting a published version's rules — is a storage rule the registry
195
+ * enforces; no parse can see a second write.
196
+ */
197
+ export declare const PolicySetVersionSchema: z.ZodObject<{
198
+ policySetId: z.ZodString;
199
+ version: z.ZodString;
200
+ status: z.ZodEnum<{
201
+ draft: "draft";
202
+ published: "published";
203
+ }>;
204
+ title: z.ZodString;
205
+ locale: z.ZodOptional<z.ZodString>;
206
+ publishedAt: z.ZodOptional<z.ZodISODateTime>;
207
+ rules: z.ZodArray<z.ZodObject<{
208
+ id: z.ZodString;
209
+ title: z.ZodString;
210
+ description: z.ZodOptional<z.ZodString>;
211
+ taxonomyCodes: z.ZodArray<z.ZodEnum<{
212
+ "integrity.spam": "integrity.spam";
213
+ "integrity.scam": "integrity.scam";
214
+ "integrity.fraud": "integrity.fraud";
215
+ "integrity.impersonation": "integrity.impersonation";
216
+ "integrity.coordinated_manipulation": "integrity.coordinated_manipulation";
217
+ "harassment.insult": "harassment.insult";
218
+ "harassment.targeted_abuse": "harassment.targeted_abuse";
219
+ "harassment.sexual_harassment": "harassment.sexual_harassment";
220
+ "harassment.doxxing": "harassment.doxxing";
221
+ "harassment.credible_threat": "harassment.credible_threat";
222
+ "hate.dehumanization": "hate.dehumanization";
223
+ "hate.slur": "hate.slur";
224
+ "hate.incitement": "hate.incitement";
225
+ "hate.protected_targeting": "hate.protected_targeting";
226
+ "violence.graphic": "violence.graphic";
227
+ "violence.threat": "violence.threat";
228
+ "violence.instruction": "violence.instruction";
229
+ "violence.celebration": "violence.celebration";
230
+ "sexual_content.nudity": "sexual_content.nudity";
231
+ "sexual_content.explicit_activity": "sexual_content.explicit_activity";
232
+ "sexual_content.non_consensual": "sexual_content.non_consensual";
233
+ "sexual_content.exploitation": "sexual_content.exploitation";
234
+ "child_safety.sexualization": "child_safety.sexualization";
235
+ "child_safety.grooming": "child_safety.grooming";
236
+ "child_safety.exploitation": "child_safety.exploitation";
237
+ "self_harm.promotion": "self_harm.promotion";
238
+ "self_harm.instruction": "self_harm.instruction";
239
+ "self_harm.imminent_risk": "self_harm.imminent_risk";
240
+ "privacy.personal_information": "privacy.personal_information";
241
+ "privacy.intimate_media": "privacy.intimate_media";
242
+ "privacy.location_exposure": "privacy.location_exposure";
243
+ "commerce.prohibited_item": "commerce.prohibited_item";
244
+ "commerce.counterfeit": "commerce.counterfeit";
245
+ "commerce.misleading_listing": "commerce.misleading_listing";
246
+ "commerce.unsafe_product": "commerce.unsafe_product";
247
+ "platform_abuse.ban_evasion": "platform_abuse.ban_evasion";
248
+ "platform_abuse.report_abuse": "platform_abuse.report_abuse";
249
+ "platform_abuse.automation_abuse": "platform_abuse.automation_abuse";
250
+ "other.policy_specific": "other.policy_specific";
251
+ "other.unclassifiable": "other.unclassifiable";
252
+ }>>;
253
+ defaultSeverity: z.ZodOptional<z.ZodEnum<{
254
+ low: "low";
255
+ medium: "medium";
256
+ high: "high";
257
+ critical: "critical";
258
+ }>>;
259
+ recommendedActions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
260
+ remove_or_restrict: "remove_or_restrict";
261
+ allow_with_label: "allow_with_label";
262
+ remove: "remove";
263
+ hide: "hide";
264
+ label: "label";
265
+ age_gate: "age_gate";
266
+ reduce_distribution: "reduce_distribution";
267
+ freeze_transaction: "freeze_transaction";
268
+ suspend_user: "suspend_user";
269
+ request_changes: "request_changes";
270
+ allow: "allow";
271
+ restore: "restore";
272
+ no_action: "no_action";
273
+ request_more_context: "request_more_context";
274
+ hold: "hold";
275
+ local_manual_review: "local_manual_review";
276
+ keep_restricted_temporarily: "keep_restricted_temporarily";
277
+ escalate: "escalate";
278
+ no_global_effect: "no_global_effect";
279
+ specialist_queue: "specialist_queue";
280
+ legal_queue: "legal_queue";
281
+ safety_queue: "safety_queue";
282
+ }>>>;
283
+ }, z.core.$strict>>;
284
+ }, z.core.$strict>;
285
+ export type PolicySetVersion = z.infer<typeof PolicySetVersionSchema>;
286
+ //# sourceMappingURL=policies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,aAO3B,CAAC;AAEJ,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,aAO5B,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,aAO7B,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;kBAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B;;;;kBAIzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,iCAAkC,CAAC;AACnE,eAAO,MAAM,qBAAqB;;;EAA8B,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAU3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqC/B,CAAC;AACL,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}