@percayso-community/cayso-contracts 0.24.0 → 0.27.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 +35 -11
- package/dist/assertion.d.ts +21 -2
- package/dist/assurance.js +41 -0
- package/dist/citizen-transfer.d.ts +110 -0
- package/dist/citizen-transfer.js +16 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.js +20 -0
- package/dist/cloud-settlement.d.ts +460 -0
- package/dist/cloud-settlement.js +16 -0
- package/dist/contract-schema.generated.d.ts +2 -1
- package/dist/contract-schema.generated.js +1995 -32
- package/dist/errors.d.ts +10 -2
- package/dist/index.d.ts +48 -3
- package/dist/index.js +46 -3
- package/dist/operator.d.ts +298 -0
- package/dist/operator.js +48 -0
- package/dist/routes.d.ts +48 -0
- package/dist/routes.js +42 -0
- package/dist/schema-types.d.ts +48 -6
- package/dist/schema.d.ts +1 -1
- package/package.json +6 -2
package/dist/routes.js
CHANGED
|
@@ -91,6 +91,14 @@
|
|
|
91
91
|
* (CAY-0079 §2). A path that took a payee's identity would make this route a
|
|
92
92
|
* directory of identities for anyone holding a mandate.
|
|
93
93
|
*
|
|
94
|
+
* ## Why `citizenTransfer` names only the payee, and never the sender
|
|
95
|
+
*
|
|
96
|
+
* `POST /api/citizen-transfers` is a Citizen transferring Cayso to another Citizen
|
|
97
|
+
* (CAY-0088). The body carries the payee's wallet id, the cents and the key. The
|
|
98
|
+
* sending wallet is NOT in the request: it is the verified subject's own Citizen
|
|
99
|
+
* Wallet, resolved inside `apps/api`, because a sending wallet the caller named would
|
|
100
|
+
* be the caller's claim about whose cents these are (CAY-0021).
|
|
101
|
+
*
|
|
94
102
|
* ## Why the citizen market is FOUR PATHS, and none of them names a wallet
|
|
95
103
|
*
|
|
96
104
|
* `citizenMarket` reads the book, `placeQuote` places a quote, and `withdrawQuote`
|
|
@@ -109,6 +117,20 @@
|
|
|
109
117
|
* `requestBuyBack` asks the Treasury to buy back (CAY-0080 §2.2). It is a fourth path
|
|
110
118
|
* for the same reason: selling to the Treasury is not a quote (Open decision G), and a
|
|
111
119
|
* credential scoped to place one must not thereby cash out. It names no wallet either.
|
|
120
|
+
*
|
|
121
|
+
* ## Why `standingAuthorisation` is here, and the Cloud's settlement is not
|
|
122
|
+
*
|
|
123
|
+
* `standingAuthorisation` is an Instance presenting its owner's standing
|
|
124
|
+
* authorisation under the owner's assertion (`present-standing-authorisation`,
|
|
125
|
+
* CMTY-0018 §1). A person is behind it, so it is classified by a person's
|
|
126
|
+
* assurance like every other entry. It names no wallet: the wallet is the verified
|
|
127
|
+
* holder's own. It is published before it is served.
|
|
128
|
+
*
|
|
129
|
+
* The Contribution Store's settlement assertion is presented by no person. Its path
|
|
130
|
+
* is {@link CLOUD_SETTLEMENT_ROUTE}, outside this table, because every entry here is
|
|
131
|
+
* mapped in `OPERATION_FOR_ROUTE` to the assurance a person needs, and `null` there
|
|
132
|
+
* means "carries no identity", which is false of an assertion a registered issuer
|
|
133
|
+
* signed.
|
|
112
134
|
*/
|
|
113
135
|
export const ROUTES = {
|
|
114
136
|
wallet: { method: 'GET', path: '/api/wallet' },
|
|
@@ -120,10 +142,30 @@ export const ROUTES = {
|
|
|
120
142
|
purchaseResult: { method: 'GET', path: '/api/purchases/:purchaseId' },
|
|
121
143
|
purchaseCancel: { method: 'POST', path: '/api/purchases/:purchaseId/cancel' },
|
|
122
144
|
commercialPayment: { method: 'POST', path: '/api/commercial-payments' },
|
|
145
|
+
citizenTransfer: { method: 'POST', path: '/api/citizen-transfers' },
|
|
123
146
|
citizenMarket: { method: 'GET', path: '/api/citizen-market' },
|
|
124
147
|
placeQuote: { method: 'POST', path: '/api/quotes' },
|
|
125
148
|
withdrawQuote: { method: 'POST', path: '/api/quote-withdrawals' },
|
|
126
149
|
requestBuyBack: { method: 'POST', path: '/api/buy-backs' },
|
|
127
150
|
marketplaceOrder: { method: 'POST', path: '/api/marketplace/orders' },
|
|
151
|
+
standingAuthorisation: { method: 'POST', path: '/api/cloud/standing-authorisations' },
|
|
128
152
|
version: { method: 'GET', path: '/api/version' },
|
|
129
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Where the Percayso Cloud's Contribution Store presents one period's settlement
|
|
156
|
+
* assertion (CMTY-0018 §2, `cloud-settlement`).
|
|
157
|
+
*
|
|
158
|
+
* **Authenticated by a registered Store issuer (CAY-0030), not by a person.** The
|
|
159
|
+
* assertion is its own credential: signed by a key whose public half is a
|
|
160
|
+
* registered Cayso issuer under its own `kid`, in CAY-0072's format, and verified
|
|
161
|
+
* against a registry that is empty by default, so a Cayso never told about a Store
|
|
162
|
+
* settles nothing (CAY-0021). No person's assertion travels with it, and it is not
|
|
163
|
+
* in {@link ROUTES}, whose every entry is classified by a person's assurance. The
|
|
164
|
+
* client has no method for it, because no person's software calls it.
|
|
165
|
+
*
|
|
166
|
+
* Published before it is served.
|
|
167
|
+
*/
|
|
168
|
+
export const CLOUD_SETTLEMENT_ROUTE = {
|
|
169
|
+
method: 'POST',
|
|
170
|
+
path: '/api/cloud/settlement-assertions',
|
|
171
|
+
};
|
package/dist/schema-types.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
23
|
-
* business,
|
|
24
|
-
*
|
|
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.
|
|
4
|
-
"description": "The versioned capability contract surface through which anything outside this repository reads a wallet. Published; keep it the Piper
|
|
3
|
+
"version": "0.27.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": [
|