@oxyhq/contracts 0.24.0 → 0.25.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.
@@ -82,6 +82,12 @@ export interface FollowRecord {
82
82
  target: FollowTarget;
83
83
  globalState: FollowState;
84
84
  applicationMode: FollowApplicationMode;
85
+ /**
86
+ * Whether this follow acts in the requesting application right now — the
87
+ * same field a button renders. List rows carry it so a follow list can seed
88
+ * `FollowTargetButton` without recomputing the server's derivation.
89
+ */
90
+ effectiveState: FollowEffectiveState;
85
91
  /**
86
92
  * Where the user was when they followed. Provenance for the audit trail and
87
93
  * for notification routing — never authority: this application cannot undo
@@ -1,31 +1,59 @@
1
1
  /**
2
2
  * Oxy-scoped signed-record types.
3
3
  *
4
- * The base `signedRecordEnvelopeSchema` (`./identity`) now treats `type` as an
5
- * OPEN, non-empty string so ANY Oxy app may define its own record categories
6
- * (e.g. `app.mention.*`'s `app_record`) on the shared envelope grammar. The Oxy
7
- * identity/civic/node STORE, however, accepts ONLY the closed set of categories
8
- * it knows how to verify and materialize — this module is that closed set.
4
+ * The base `signedRecordEnvelopeSchema` (`./identity`) treats `type` as an OPEN,
5
+ * non-empty string so ANY Oxy app may sign on the shared envelope grammar. The
6
+ * Oxy STORE re-narrows it to the closed set in this module — a `type` outside it
7
+ * is rejected as `invalid_envelope`.
9
8
  *
10
- * `oxySignedRecordTypeSchema` is the runtime gate the Oxy store re-narrows with
11
- * (the API's `verifyEnvelope` rejects any `type` outside it; the Mongoose
12
- * `SignedRecord.type` enum is derived from `.options`); `OxySignedRecordType` is
13
- * the matching compile-time union the SDK identity/civic mixins type against.
9
+ * `oxySignedRecordTypeSchema` is that runtime gate (the API's `verifyEnvelope`
10
+ * re-narrows with it; the Mongoose `SignedRecord.type` enum and the Postgres
11
+ * CHECK on `signed_records.type` are both derived from `.options`);
12
+ * `OxySignedRecordType` is the matching compile-time union the SDK
13
+ * identity/civic mixins type against.
14
14
  *
15
15
  * The signing input INCLUDES `type`, so this set is part of the signed bytes —
16
- * a record cannot have its category swapped after signing.
16
+ * a record cannot have its category swapped after signing, and a value once
17
+ * signed can never be renamed.
17
18
  *
18
19
  * v1 only ever carried `identity` / `profile` (already in production); v2 added
19
20
  * the civic record types (reputation attestations, real-life / peer validations,
20
21
  * personhood vouches, verifiable credentials) and the user-node registration
21
- * record. Every value here is an Oxy `app.oxy.*` (or legacy v1) category — an
22
- * app's own `type` (e.g. `app_record`) is intentionally NOT in this set and is
23
- * rejected by the Oxy store.
22
+ * record.
23
+ *
24
+ * ## Why `app_record` is here, when it deliberately was not
25
+ *
26
+ * This set used to hold Oxy's own categories only, and said so: an app's `type`
27
+ * was "intentionally NOT in this set". The reason given was that the store
28
+ * accepts only what it knows how to **verify and materialize**. Verification
29
+ * turned out not to argue for the exclusion — the engine verifies a signature
30
+ * against the subject's keys whatever the category says — and materialization
31
+ * is the app's job, not the store's: an app projects its own feed tables from
32
+ * records it reads back.
33
+ *
34
+ * What changed is the decision the exclusion blocked. One chain per PERSON, held
35
+ * by Oxy, is the ecosystem substrate: apps append their records to the subject's
36
+ * one chain instead of each keeping a private chain for the same person. A
37
+ * closed set that admits no app category makes that unrepresentable.
38
+ *
39
+ * `app_record` is ONE value rather than an open lane, and the lexicon lives in
40
+ * the envelope's `collection` (`app.mention.feed.post`, `app.syra.*`), which the
41
+ * store denormalizes to `signed_records.nsid` and indexes. So a new app needs no
42
+ * change here — it picks its own collection namespace and signs `app_record`,
43
+ * exactly as Mention already does in production. Keeping the set closed is what
44
+ * keeps the CHECK a real constraint.
45
+ *
46
+ * **Admitting the category is not the whole of that decision.** Two gates sit
47
+ * beside it and are unchanged: an app record must arrive as a v2 (chained)
48
+ * envelope, and `oxyVerificationResolver` accepts exactly one custodial issuer
49
+ * (`OXY_DID`). So a record a user signs themselves verifies here today, while
50
+ * one an app signs custodially under its OWN issuer DID does not — that needs a
51
+ * separate, deliberate answer about which issuers may write to a person's chain.
24
52
  *
25
53
  * Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
26
54
  */
27
55
  import { z } from 'zod';
28
- export declare const oxySignedRecordTypeSchema: z.ZodEnum<["identity", "profile", "reputation_attestation", "real_life_attestation", "validation_verdict", "personhood_vouch", "credential", "node"]>;
56
+ export declare const oxySignedRecordTypeSchema: z.ZodEnum<["identity", "profile", "reputation_attestation", "real_life_attestation", "validation_verdict", "personhood_vouch", "credential", "node", "app_record"]>;
29
57
  /**
30
58
  * The closed set of record categories the Oxy identity/civic/node store accepts.
31
59
  * The base envelope `type` is an open string; this is what the Oxy store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -26,6 +26,7 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "files": [
29
+ "NOTICE",
29
30
  "dist"
30
31
  ],
31
32
  "keywords": [
@@ -42,7 +43,7 @@
42
43
  "directory": "packages/contracts"
43
44
  },
44
45
  "author": "OxyHQ",
45
- "license": "AGPL-3.0-only",
46
+ "license": "Apache-2.0",
46
47
  "homepage": "https://oxy.so",
47
48
  "engines": {
48
49
  "node": ">=18.0.0"