@percayso-community/cayso-contracts 0.23.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.
package/dist/routes.js CHANGED
@@ -109,6 +109,20 @@
109
109
  * `requestBuyBack` asks the Treasury to buy back (CAY-0080 §2.2). It is a fourth path
110
110
  * for the same reason: selling to the Treasury is not a quote (Open decision G), and a
111
111
  * credential scoped to place one must not thereby cash out. It names no wallet either.
112
+ *
113
+ * ## Why `standingAuthorisation` is here, and the Cloud's settlement is not
114
+ *
115
+ * `standingAuthorisation` is an Instance presenting its owner's standing
116
+ * authorisation under the owner's assertion (`present-standing-authorisation`,
117
+ * CMTY-0018 §1). A person is behind it, so it is classified by a person's
118
+ * assurance like every other entry. It names no wallet: the wallet is the verified
119
+ * holder's own. It is published before it is served.
120
+ *
121
+ * The Contribution Store's settlement assertion is presented by no person. Its path
122
+ * is {@link CLOUD_SETTLEMENT_ROUTE}, outside this table, because every entry here is
123
+ * mapped in `OPERATION_FOR_ROUTE` to the assurance a person needs, and `null` there
124
+ * means "carries no identity", which is false of an assertion a registered issuer
125
+ * signed.
112
126
  */
113
127
  export const ROUTES = {
114
128
  wallet: { method: 'GET', path: '/api/wallet' },
@@ -124,5 +138,25 @@ export const ROUTES = {
124
138
  placeQuote: { method: 'POST', path: '/api/quotes' },
125
139
  withdrawQuote: { method: 'POST', path: '/api/quote-withdrawals' },
126
140
  requestBuyBack: { method: 'POST', path: '/api/buy-backs' },
141
+ marketplaceOrder: { method: 'POST', path: '/api/marketplace/orders' },
142
+ standingAuthorisation: { method: 'POST', path: '/api/cloud/standing-authorisations' },
127
143
  version: { method: 'GET', path: '/api/version' },
128
144
  };
145
+ /**
146
+ * Where the Percayso Cloud's Contribution Store presents one period's settlement
147
+ * assertion (CMTY-0018 §2, `cloud-settlement`).
148
+ *
149
+ * **Authenticated by a registered Store issuer (CAY-0030), not by a person.** The
150
+ * assertion is its own credential: signed by a key whose public half is a
151
+ * registered Cayso issuer under its own `kid`, in CAY-0072's format, and verified
152
+ * against a registry that is empty by default, so a Cayso never told about a Store
153
+ * settles nothing (CAY-0021). No person's assertion travels with it, and it is not
154
+ * in {@link ROUTES}, whose every entry is classified by a person's assurance. The
155
+ * client has no method for it, because no person's software calls it.
156
+ *
157
+ * Published before it is served.
158
+ */
159
+ export const CLOUD_SETTLEMENT_ROUTE = {
160
+ method: 'POST',
161
+ path: '/api/cloud/settlement-assertions',
162
+ };
@@ -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.23.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": [