@percayso-community/cayso-contracts 0.24.0 → 0.26.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The shape of the machine-readable contract schema `GET /api/version/schema`
3
- * serves — a structural description of the Piper-facing surface, one that a
3
+ * serves — a structural description of the published surface, one that a
4
4
  * consumer (or the CI contract test) can read at runtime.
5
5
  *
6
6
  * ## Why this file is types-only and hand-written, while the schema VALUE is not
@@ -14,16 +14,25 @@
14
14
  * as `@percayso-community/cayso-contracts`, so the two cannot disagree, and a CI test regenerates and
15
15
  * compares — a type changed without regeneration turns that test red.
16
16
  *
17
- * ## Why it describes the Piper-facing surface ONLY
17
+ * ## Why it describes the published surface ONLY
18
18
  *
19
19
  * The descriptor covers the exported wire types, the route table, the capability
20
20
  * names and the contract version — the surface a consumer of `@percayso-community/cayso-contracts`
21
21
  * reads. It does NOT describe the internal routes (`INTERNAL_ROUTES` in
22
- * `apps/api`: the operator, webhook and peer endpoints): those are not Piper's
23
- * business, and a schema that enumerated the operator surface would have published
24
- * it (CAY-0026, CLAUDE.md). The generator only ever sees this package, so the
22
+ * `apps/api`: the operator, webhook and peer endpoints): those are no outside
23
+ * consumer's business, Piper's or the Percayso Cloud's, and a schema that
24
+ * enumerated the operator surface would have published it (CAY-0026, Amendment 3;
25
+ * CLAUDE.md). The Contribution Store's settlement path is published, but under
26
+ * `issuerRoutes`, apart from the routes a person calls. The generator only ever sees this package, so the
25
27
  * internal surface is absent by construction.
26
28
  *
29
+ * The one part of the operator surface that IS published — the three reads on the
30
+ * `./operator` entry point (CAY-0026, Amendment 4) — is described under its own
31
+ * key, {@link ContractSchema.operator}, with its routes and its types apart from
32
+ * `routes` and `types`. A consumer reading the person-facing surface therefore
33
+ * never meets an operator route or an operator type by accident, and the rest of
34
+ * the operator surface is still absent by construction.
35
+ *
27
36
  * ## What it deliberately omits
28
37
  *
29
38
  * `CaysoWallet` — the client capability interface carrying a `getMyWallet()`
@@ -46,7 +55,9 @@ export type ScalarKind = 'string' | 'number' | 'boolean';
46
55
  * - `{ literal }` — a string-literal type, e.g. the `'cayso'` audience or a
47
56
  * failure-reason member.
48
57
  * - `{ null: true }` — the `null` type, as it appears in `T | null`.
49
- * - `{ ref }` — a reference to another named type in {@link ContractSchema.types}.
58
+ * - `{ ref }` — a reference to another named type in {@link ContractSchema.types}
59
+ * or, from an operator type, in {@link SchemaOperatorSurface.types}.
60
+ * The two maps share one namespace, so a name means one type.
50
61
  * - `{ array, readonly }` — an array whose element is `array`; `readonly`
51
62
  * records whether the source wrote `readonly T[]`.
52
63
  * - `{ union }` — a union of the member nodes, in source order.
@@ -87,6 +98,23 @@ export interface SchemaRoute {
87
98
  readonly method: string;
88
99
  readonly path: string;
89
100
  }
101
+ /** An operator read, as the descriptor reports it: a route plus the scope it requires. */
102
+ export interface SchemaOperatorRoute {
103
+ readonly method: string;
104
+ readonly path: string;
105
+ readonly scope: string;
106
+ }
107
+ /**
108
+ * The published operator read surface (CAY-0026, Amendment 4): the three reads on
109
+ * `@percayso-community/cayso-contracts/operator` and the types declared there. A type
110
+ * here may refer to one in {@link ContractSchema.types} — a row's `cents` is `Cents`
111
+ * — but never the other way round: nothing on the person-facing surface depends on
112
+ * the operator one.
113
+ */
114
+ export interface SchemaOperatorSurface {
115
+ readonly routes: Readonly<Record<string, SchemaOperatorRoute>>;
116
+ readonly types: Readonly<Record<string, SchemaType>>;
117
+ }
90
118
  /**
91
119
  * The whole served schema: the contract version it describes, the package name,
92
120
  * the capability names, the route table and every named wire type. Generated from
@@ -96,6 +124,20 @@ export interface ContractSchema {
96
124
  readonly contractVersion: string;
97
125
  readonly packageName: string;
98
126
  readonly capabilities: Readonly<Record<string, string>>;
127
+ /** Every `ROUTES` entry: the routes a person calls, under a person's assertion. */
99
128
  readonly routes: Readonly<Record<string, SchemaRoute>>;
129
+ /**
130
+ * The routes authenticated by a registered issuer (CAY-0030) rather than by a
131
+ * person, and therefore not in `ROUTES`: today the Contribution Store's
132
+ * settlement path (`CLOUD_SETTLEMENT_ROUTE`, CMTY-0018 §2). Kept apart from
133
+ * {@link routes} so that no consumer reads one as the other.
134
+ */
135
+ readonly issuerRoutes: Readonly<Record<string, SchemaRoute>>;
100
136
  readonly types: Readonly<Record<string, SchemaType>>;
137
+ /**
138
+ * The operator reads an operator app's server calls, and their types — under
139
+ * their own key, so that neither {@link routes} nor {@link types} grows an
140
+ * operator entry.
141
+ */
142
+ readonly operator: SchemaOperatorSurface;
101
143
  }
package/dist/schema.d.ts CHANGED
@@ -20,5 +20,5 @@
20
20
  * drive validation instead of depending on the package would re-implement, badly,
21
21
  * the guarantee the package already gives for free (CAY-0026, and the README).
22
22
  */
23
- export type { ContractSchema, ScalarKind, SchemaProperty, SchemaRoute, SchemaType, SchemaTypeNode, } from './schema-types.js';
23
+ export type { ContractSchema, ScalarKind, SchemaProperty, SchemaOperatorRoute, SchemaOperatorSurface, SchemaRoute, SchemaType, SchemaTypeNode, } from './schema-types.js';
24
24
  export { CONTRACT_SCHEMA } from './contract-schema.generated.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@percayso-community/cayso-contracts",
3
- "version": "0.24.0",
4
- "description": "The versioned capability contract surface through which anything outside this repository reads a wallet. Published; keep it the Piper-facing surface only.",
3
+ "version": "0.26.0",
4
+ "description": "The versioned capability contract surface through which anything outside this repository reads a wallet. Published; keep it the surface of every consumer outside this tree, Piper and the Percayso Cloud, and nothing internal.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,6 +24,10 @@
24
24
  "./schema": {
25
25
  "types": "./dist/schema.d.ts",
26
26
  "default": "./dist/schema.js"
27
+ },
28
+ "./operator": {
29
+ "types": "./dist/operator.d.ts",
30
+ "default": "./dist/operator.js"
27
31
  }
28
32
  },
29
33
  "files": [