@percayso-community/cayso-contracts 0.29.0 → 1.0.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 +72 -28
- package/dist/assertion.d.ts +55 -2
- package/dist/assurance.js +37 -0
- package/dist/authority.d.ts +221 -0
- package/dist/authority.js +49 -0
- package/dist/client.d.ts +68 -6
- package/dist/client.js +35 -4
- package/dist/cloud-settlement.d.ts +339 -20
- package/dist/contract-schema.generated.js +1092 -38
- package/dist/errors.d.ts +67 -3
- package/dist/index.d.ts +129 -5
- package/dist/index.js +127 -4
- package/dist/operator.d.ts +142 -6
- package/dist/operator.js +8 -1
- package/dist/routes.d.ts +68 -3
- package/dist/routes.js +65 -3
- package/dist/schema-types.d.ts +15 -5
- package/dist/schema.d.ts +20 -8
- package/package.json +1 -1
package/dist/operator.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@percayso-community/cayso-contracts/operator` — the operator READ surface, on its
|
|
3
|
-
* own entry point:
|
|
3
|
+
* own entry point: four reads and nothing else (CAY-0026, Amendments 4 and 5).
|
|
4
4
|
*
|
|
5
5
|
* - `GET /api/operator/movements` — the movement list, under `list-movements-as-operator`.
|
|
6
6
|
* - `GET /api/operator/purchases` — the purchase list, under `list-purchases-as-operator`.
|
|
7
7
|
* - `GET /api/operator/quickenings` — the quickening ladder, under
|
|
8
8
|
* `read-quickening-ladder-as-operator`.
|
|
9
|
+
* - `GET /api/operator/summary` — the economy summary, under
|
|
10
|
+
* `read-economy-summary-as-operator` (Amendment 5): whole-number counts and cent
|
|
11
|
+
* totals, and never a row.
|
|
9
12
|
*
|
|
10
13
|
* ## Who calls this, and from where
|
|
11
14
|
*
|
|
@@ -25,7 +28,7 @@
|
|
|
25
28
|
*
|
|
26
29
|
* ## What it carries, and what it deliberately does not
|
|
27
30
|
*
|
|
28
|
-
* - **The
|
|
31
|
+
* - **The four reads only.** The operator surface is larger than this — the wallet
|
|
29
32
|
* lookup, the resolver, the market alarms, the founder lapse — and all of it stays
|
|
30
33
|
* unpublished. Widening this entry point is a further amendment to CAY-0026, not
|
|
31
34
|
* an edit to this file.
|
|
@@ -44,7 +47,7 @@
|
|
|
44
47
|
* ## The API is the source of truth
|
|
45
48
|
*
|
|
46
49
|
* Every shape here is the one `apps/api` serves, and a test in `apps/api` drives the
|
|
47
|
-
*
|
|
50
|
+
* four routes and fails on any field the service sends that this file does not
|
|
48
51
|
* describe. Where an earlier hand-written client disagreed with the service, the
|
|
49
52
|
* service won.
|
|
50
53
|
*/
|
|
@@ -55,14 +58,14 @@ import type { Cents } from './wallet.js';
|
|
|
55
58
|
* here refuses a credential that does not name what it is about to do, exactly as a
|
|
56
59
|
* contract-surface route does (`403 assertion_scope_refused`).
|
|
57
60
|
*/
|
|
58
|
-
export type OperatorReadScope = 'list-movements-as-operator' | 'list-purchases-as-operator' | 'read-quickening-ladder-as-operator';
|
|
61
|
+
export type OperatorReadScope = 'list-movements-as-operator' | 'list-purchases-as-operator' | 'read-quickening-ladder-as-operator' | 'read-economy-summary-as-operator';
|
|
59
62
|
/** One published operator read: its method, its path and the scope it requires. */
|
|
60
63
|
export interface OperatorReadRoute {
|
|
61
64
|
readonly method: 'GET';
|
|
62
65
|
readonly path: string;
|
|
63
66
|
readonly scope: OperatorReadScope;
|
|
64
67
|
}
|
|
65
|
-
/** The
|
|
68
|
+
/** The four reads, by name. The paths and scopes are the service's own. */
|
|
66
69
|
export declare const OPERATOR_READ_ROUTES: {
|
|
67
70
|
readonly movements: {
|
|
68
71
|
readonly method: "GET";
|
|
@@ -79,13 +82,18 @@ export declare const OPERATOR_READ_ROUTES: {
|
|
|
79
82
|
readonly path: "/api/operator/quickenings";
|
|
80
83
|
readonly scope: "read-quickening-ladder-as-operator";
|
|
81
84
|
};
|
|
85
|
+
readonly summary: {
|
|
86
|
+
readonly method: "GET";
|
|
87
|
+
readonly path: "/api/operator/summary";
|
|
88
|
+
readonly scope: "read-economy-summary-as-operator";
|
|
89
|
+
};
|
|
82
90
|
};
|
|
83
91
|
/**
|
|
84
92
|
* What a movement is, declared by the act before the draw (CAY-0075). Closed: the
|
|
85
93
|
* movement list's `kind` filter refuses anything outside it (`400 invalid_kind`), and
|
|
86
94
|
* every row's `kind` is one of these.
|
|
87
95
|
*/
|
|
88
|
-
export type MovementKind = 'issuance' | 'purchase' | 'grant' | 'charge' | 'payout' | 'transfer' | 'burn' | 'forfeit' | 'commercial_payment' | 'quoted_sale' | 'buy_back' | 'quoted_sale_compensation' | 'marketplace_settlement';
|
|
96
|
+
export type MovementKind = 'issuance' | 'purchase' | 'grant' | 'charge' | 'payout' | 'transfer' | 'burn' | 'forfeit' | 'commercial_payment' | 'quoted_sale' | 'buy_back' | 'quoted_sale_compensation' | 'marketplace_settlement' | 'contribution_settlement' | 'consumption_settlement';
|
|
89
97
|
/** Every {@link MovementKind}, in the service's order — for a filter a person picks from. */
|
|
90
98
|
export declare const MOVEMENT_KINDS: readonly MovementKind[];
|
|
91
99
|
/**
|
|
@@ -101,6 +109,11 @@ export declare const MOVEMENT_KINDS: readonly MovementKind[];
|
|
|
101
109
|
* publisher's Citizen Wallet and `cents` the whole price the buyer paid. The Community
|
|
102
110
|
* leg's share of it went to the Treasury inside the same movement, and the row does not
|
|
103
111
|
* itemise it; the signed receipt names both legs (CAY-0090).
|
|
112
|
+
*
|
|
113
|
+
* A `contribution_settlement` runs from the Treasury to a Node's wallet, and a
|
|
114
|
+
* `consumption_settlement` from an Instance's wallet to the Treasury: one per row of a
|
|
115
|
+
* settled Cloud period (CAY-0096). Neither row names the Node, the authorisation or
|
|
116
|
+
* the period; the wallet ids are the handle here as everywhere.
|
|
104
117
|
*/
|
|
105
118
|
export interface OperatorMovementRow {
|
|
106
119
|
/** The row's own opaque handle: a stable list key, not an identity. */
|
|
@@ -231,6 +244,120 @@ export interface QuickeningLadder {
|
|
|
231
244
|
readonly live: LiveQuickeningBand | null;
|
|
232
245
|
readonly activeCitizens: number;
|
|
233
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* How many wallets exist, by holder kind, and how many were created recently.
|
|
249
|
+
*
|
|
250
|
+
* `citizenWallets + organisationWallets` is `total`: the two holder kinds are the only
|
|
251
|
+
* two (CONTEXT.md, *Wallet*). `founderWallets` counts the Founder wallets among the
|
|
252
|
+
* Citizen Wallets, claimed or not, so it is a part of `citizenWallets` and not a third
|
|
253
|
+
* kind. The two windows end at `asOf` and include it: `createdInLast7Days` counts
|
|
254
|
+
* wallets created in `(asOf − 7 days, asOf]`.
|
|
255
|
+
*/
|
|
256
|
+
export interface OperatorWalletCounts {
|
|
257
|
+
readonly total: number;
|
|
258
|
+
readonly citizenWallets: number;
|
|
259
|
+
readonly organisationWallets: number;
|
|
260
|
+
readonly founderWallets: number;
|
|
261
|
+
readonly createdInLast7Days: number;
|
|
262
|
+
readonly createdInLast30Days: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The cents this economy has minted, cancelled and holds, and where the held cents sit.
|
|
266
|
+
*
|
|
267
|
+
* Conservation is the identity `heldCents = totalMintedCents − cancelledCents`
|
|
268
|
+
* (migration `0005`); both sides are reported as read, and a disagreement is reported,
|
|
269
|
+
* never repaired (CAY-0028). `heldCents` is the system-wide sum of holdings — the cents
|
|
270
|
+
* in circulation — and is never a stored total: a balance is derived (CAY-0019).
|
|
271
|
+
*
|
|
272
|
+
* - `restrictedCents + unrestrictedCents` is `heldCents`.
|
|
273
|
+
* - `inCitizenWalletsCents + inOrganisationWalletsCents` is `heldCents`.
|
|
274
|
+
* - `inFounderWalletsCents` is a part of `inCitizenWalletsCents`, and
|
|
275
|
+
* `inTreasuryCents` a part of `inOrganisationWalletsCents`: the Treasury is an
|
|
276
|
+
* Organisation Wallet. `inTreasuryCents` is null when this deployment has no
|
|
277
|
+
* Treasury configured, which is not the same as a Treasury holding nothing.
|
|
278
|
+
*
|
|
279
|
+
* Every figure is an integer number of cents (₡1 = 100 cents) and never sterling: the
|
|
280
|
+
* sterling value of a cent is the published value's, and it is not carried here.
|
|
281
|
+
*/
|
|
282
|
+
export interface OperatorSupplySummary {
|
|
283
|
+
readonly totalMintedCents: Cents;
|
|
284
|
+
readonly cancelledCents: Cents;
|
|
285
|
+
readonly heldCents: Cents;
|
|
286
|
+
readonly restrictedCents: Cents;
|
|
287
|
+
readonly unrestrictedCents: Cents;
|
|
288
|
+
readonly inCitizenWalletsCents: Cents;
|
|
289
|
+
readonly inOrganisationWalletsCents: Cents;
|
|
290
|
+
readonly inFounderWalletsCents: Cents;
|
|
291
|
+
readonly inTreasuryCents: Cents | null;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* How many movements there are of each {@link MovementKind}. Every kind is present, at
|
|
295
|
+
* zero when none has happened: a missing key would read as "not counted", which is a
|
|
296
|
+
* different statement from "none". `operator.test.ts` pins the keys to the union.
|
|
297
|
+
*/
|
|
298
|
+
export interface OperatorMovementCountsByKind {
|
|
299
|
+
readonly issuance: number;
|
|
300
|
+
readonly purchase: number;
|
|
301
|
+
readonly grant: number;
|
|
302
|
+
readonly charge: number;
|
|
303
|
+
readonly payout: number;
|
|
304
|
+
readonly transfer: number;
|
|
305
|
+
readonly burn: number;
|
|
306
|
+
readonly forfeit: number;
|
|
307
|
+
readonly commercial_payment: number;
|
|
308
|
+
readonly quoted_sale: number;
|
|
309
|
+
readonly buy_back: number;
|
|
310
|
+
readonly quoted_sale_compensation: number;
|
|
311
|
+
readonly marketplace_settlement: number;
|
|
312
|
+
readonly contribution_settlement: number;
|
|
313
|
+
readonly consumption_settlement: number;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* How many movements there are, how many happened recently, and of which kind. A
|
|
317
|
+
* movement is final and append-only (CAY-0023), so there is no status to count by.
|
|
318
|
+
* The windows are the wallet counts' windows, on `occurredAt`.
|
|
319
|
+
*/
|
|
320
|
+
export interface OperatorMovementCounts {
|
|
321
|
+
readonly total: number;
|
|
322
|
+
readonly inLast7Days: number;
|
|
323
|
+
readonly inLast30Days: number;
|
|
324
|
+
readonly byKind: OperatorMovementCountsByKind;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* How many purchases are in each {@link PurchaseStatus}, every status present, at zero
|
|
328
|
+
* when none is in it. `operator.test.ts` pins the keys to the union.
|
|
329
|
+
*/
|
|
330
|
+
export interface OperatorPurchaseCountsByStatus {
|
|
331
|
+
readonly pending: number;
|
|
332
|
+
readonly issued_uncaptured: number;
|
|
333
|
+
readonly succeeded: number;
|
|
334
|
+
readonly failed: number;
|
|
335
|
+
readonly cancelled: number;
|
|
336
|
+
}
|
|
337
|
+
/** How many purchases there are, and in which status. */
|
|
338
|
+
export interface OperatorPurchaseCounts {
|
|
339
|
+
readonly total: number;
|
|
340
|
+
readonly byStatus: OperatorPurchaseCountsByStatus;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The economy summary: aggregate counts and cent totals over the whole deployment,
|
|
344
|
+
* read in one snapshot at `asOf` (CAY-0026, Amendment 5).
|
|
345
|
+
*
|
|
346
|
+
* **Aggregates only.** No wallet id, no Percayso identity, no Handle, no name and no
|
|
347
|
+
* row of any kind appears here, and nothing in it can be narrowed to one wallet: the
|
|
348
|
+
* read takes no query. A per-wallet question is the wallet detail's, audited against
|
|
349
|
+
* that wallet (CAY-0027).
|
|
350
|
+
*
|
|
351
|
+
* `asOf` is the instant the read was made, as an ISO-8601 UTC instant, and the instant
|
|
352
|
+
* every "last N days" window ends at.
|
|
353
|
+
*/
|
|
354
|
+
export interface OperatorEconomySummary {
|
|
355
|
+
readonly asOf: string;
|
|
356
|
+
readonly wallets: OperatorWalletCounts;
|
|
357
|
+
readonly supply: OperatorSupplySummary;
|
|
358
|
+
readonly movements: OperatorMovementCounts;
|
|
359
|
+
readonly purchases: OperatorPurchaseCounts;
|
|
360
|
+
}
|
|
234
361
|
/**
|
|
235
362
|
* `401` — no credential, or one the verifier refused. Every member is also a
|
|
236
363
|
* {@link import('./errors.js').CaysoApiErrorCode}: the gate is the one every route
|
|
@@ -280,12 +407,16 @@ export type OperatorPurchasesUnavailable = 'operator_purchases_reader_not_config
|
|
|
280
407
|
* seeded. Kept apart so an operator can tell a wiring fault from an empty table.
|
|
281
408
|
*/
|
|
282
409
|
export type QuickeningLadderUnavailable = 'quickening_ladder_reader_not_configured' | 'quickening_ladder_not_configured';
|
|
410
|
+
/** `503` — this deployment has no economy summary reader wired. */
|
|
411
|
+
export type OperatorEconomySummaryUnavailable = 'operator_summary_reader_not_configured';
|
|
283
412
|
/** Every `{ error }` code the movement list answers. */
|
|
284
413
|
export type OperatorMovementsErrorCode = OperatorMovementsQueryRefusal | OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | OperatorMovementsUnavailable | OperatorReadFailed;
|
|
285
414
|
/** Every `{ error }` code the purchase list answers. */
|
|
286
415
|
export type OperatorPurchasesErrorCode = OperatorPurchasesQueryRefusal | OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | OperatorPurchasesUnavailable | OperatorReadFailed;
|
|
287
416
|
/** Every `{ error }` code the ladder answers. It takes no query, so nothing is a `400`. */
|
|
288
417
|
export type QuickeningLadderErrorCode = OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | QuickeningLadderUnavailable | OperatorReadFailed;
|
|
418
|
+
/** Every `{ error }` code the economy summary answers. It takes no query, so nothing is a `400`. */
|
|
419
|
+
export type OperatorEconomySummaryErrorCode = OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | OperatorEconomySummaryUnavailable | OperatorReadFailed;
|
|
289
420
|
export interface OperatorMovementsError {
|
|
290
421
|
readonly error: OperatorMovementsErrorCode;
|
|
291
422
|
}
|
|
@@ -295,9 +426,14 @@ export interface OperatorPurchasesError {
|
|
|
295
426
|
export interface QuickeningLadderError {
|
|
296
427
|
readonly error: QuickeningLadderErrorCode;
|
|
297
428
|
}
|
|
429
|
+
export interface OperatorEconomySummaryError {
|
|
430
|
+
readonly error: OperatorEconomySummaryErrorCode;
|
|
431
|
+
}
|
|
298
432
|
/** Everything `GET /api/operator/movements` answers: `200`, or one refusal body. */
|
|
299
433
|
export type OperatorMovementsResponse = OperatorMovementsPage | OperatorVerificationRefused | OperatorMovementsError;
|
|
300
434
|
/** Everything `GET /api/operator/purchases` answers: `200`, or one refusal body. */
|
|
301
435
|
export type OperatorPurchasesResponse = OperatorPurchasesPage | OperatorVerificationRefused | OperatorPurchasesError;
|
|
302
436
|
/** Everything `GET /api/operator/quickenings` answers: `200`, or one refusal body. */
|
|
303
437
|
export type QuickeningLadderResponse = QuickeningLadder | OperatorVerificationRefused | QuickeningLadderError;
|
|
438
|
+
/** Everything `GET /api/operator/summary` answers: `200`, or one refusal body. */
|
|
439
|
+
export type OperatorEconomySummaryResponse = OperatorEconomySummary | OperatorVerificationRefused | OperatorEconomySummaryError;
|
package/dist/operator.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
/** The
|
|
16
|
+
/** The four reads, by name. The paths and scopes are the service's own. */
|
|
17
17
|
export const OPERATOR_READ_ROUTES = {
|
|
18
18
|
movements: {
|
|
19
19
|
method: 'GET',
|
|
@@ -30,6 +30,11 @@ export const OPERATOR_READ_ROUTES = {
|
|
|
30
30
|
path: '/api/operator/quickenings',
|
|
31
31
|
scope: 'read-quickening-ladder-as-operator',
|
|
32
32
|
},
|
|
33
|
+
summary: {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
path: '/api/operator/summary',
|
|
36
|
+
scope: 'read-economy-summary-as-operator',
|
|
37
|
+
},
|
|
33
38
|
};
|
|
34
39
|
/** Every {@link MovementKind}, in the service's order — for a filter a person picks from. */
|
|
35
40
|
export const MOVEMENT_KINDS = [
|
|
@@ -46,4 +51,6 @@ export const MOVEMENT_KINDS = [
|
|
|
46
51
|
'buy_back',
|
|
47
52
|
'quoted_sale_compensation',
|
|
48
53
|
'marketplace_settlement',
|
|
54
|
+
'contribution_settlement',
|
|
55
|
+
'consumption_settlement',
|
|
49
56
|
];
|
package/dist/routes.d.ts
CHANGED
|
@@ -119,13 +119,34 @@
|
|
|
119
119
|
* authorisation under the owner's assertion (`present-standing-authorisation`,
|
|
120
120
|
* CMTY-0018 §1). A person is behind it, so it is classified by a person's
|
|
121
121
|
* assurance like every other entry. It names no wallet: the wallet is the verified
|
|
122
|
-
* holder's own.
|
|
122
|
+
* holder's own. Published at `0.25.0` and served from `0.30.0` (CAY-0094).
|
|
123
|
+
*
|
|
124
|
+
* `revokeStandingAuthorisation` withdraws one (`revoke-standing-authorisation`). It
|
|
125
|
+
* is its own path for citizenship's reason, and a `POST` for cancelling's: nothing is
|
|
126
|
+
* deleted. The authorisation's row stays, and so does its Instance key's binding to
|
|
127
|
+
* the wallet; the revocation is a row of its own beside them. The body names the
|
|
128
|
+
* authorisation's `jti` and no wallet.
|
|
129
|
+
*
|
|
130
|
+
* `bindNode` binds a Node to the wallet its presenting Instance key is already bound
|
|
131
|
+
* to (`bind-node`, CAY-0095), under the owner's assertion. A person is behind it, so
|
|
132
|
+
* it is classified by a person's assurance. The body carries the Node ID signed by the
|
|
133
|
+
* Instance key and that key's public half, and no wallet: the wallet is the one the
|
|
134
|
+
* key is bound to, which must be the verified holder's own. A `POST` to a collection
|
|
135
|
+
* of bindings, because a Node is bound once and a repeat answers the same.
|
|
123
136
|
*
|
|
124
137
|
* The Contribution Store's settlement assertion is presented by no person. Its path
|
|
125
138
|
* is {@link CLOUD_SETTLEMENT_ROUTE}, outside this table, because every entry here is
|
|
126
139
|
* mapped in `OPERATION_FOR_ROUTE` to the assurance a person needs, and `null` there
|
|
127
140
|
* means "carries no identity", which is false of an assertion a registered issuer
|
|
128
|
-
* signed.
|
|
141
|
+
* signed. The Store's read of whether a Node is bound,
|
|
142
|
+
* {@link NODE_BINDING_QUERY_ROUTE}, is outside it for the same reason.
|
|
143
|
+
*
|
|
144
|
+
* ## Why Cayso's acknowledgement keys are outside this table too
|
|
145
|
+
*
|
|
146
|
+
* {@link ACKNOWLEDGEMENT_KEYS_ROUTE} publishes the public half of the key Cayso signs
|
|
147
|
+
* an authorisation acknowledgement with. It carries no identity at all, so it is not
|
|
148
|
+
* a person's operation either, and it is read by the Percayso Cloud's software rather
|
|
149
|
+
* than by a person's, so the client has no method for it.
|
|
129
150
|
*/
|
|
130
151
|
export declare const ROUTES: {
|
|
131
152
|
readonly wallet: {
|
|
@@ -200,6 +221,14 @@ export declare const ROUTES: {
|
|
|
200
221
|
readonly method: "POST";
|
|
201
222
|
readonly path: "/api/cloud/standing-authorisations";
|
|
202
223
|
};
|
|
224
|
+
readonly revokeStandingAuthorisation: {
|
|
225
|
+
readonly method: "POST";
|
|
226
|
+
readonly path: "/api/cloud/standing-authorisation-revocations";
|
|
227
|
+
};
|
|
228
|
+
readonly bindNode: {
|
|
229
|
+
readonly method: "POST";
|
|
230
|
+
readonly path: "/api/cloud/node-bindings";
|
|
231
|
+
};
|
|
203
232
|
readonly version: {
|
|
204
233
|
readonly method: "GET";
|
|
205
234
|
readonly path: "/api/version";
|
|
@@ -217,9 +246,45 @@ export declare const ROUTES: {
|
|
|
217
246
|
* in {@link ROUTES}, whose every entry is classified by a person's assurance. The
|
|
218
247
|
* client has no method for it, because no person's software calls it.
|
|
219
248
|
*
|
|
220
|
-
* Published
|
|
249
|
+
* Published at `0.25.0` and served from `0.30.0` (CAY-0096): a settled period is one
|
|
250
|
+
* `contribution_settlement` movement per paid contribution row and one
|
|
251
|
+
* `consumption_settlement` movement per consumption row, written whole or not at all.
|
|
221
252
|
*/
|
|
222
253
|
export declare const CLOUD_SETTLEMENT_ROUTE: {
|
|
223
254
|
readonly method: "POST";
|
|
224
255
|
readonly path: "/api/cloud/settlement-assertions";
|
|
225
256
|
};
|
|
257
|
+
/**
|
|
258
|
+
* Where the Percayso Cloud's Contribution Store asks whether one Node is bound to a
|
|
259
|
+
* wallet (CMTY-0018 §4, CAY-0095), so it can carry an unbound Node's rows withheld
|
|
260
|
+
* (`node_not_bound`) rather than pay them to nobody.
|
|
261
|
+
*
|
|
262
|
+
* **Authenticated by the registered Store issuer, exactly as
|
|
263
|
+
* {@link CLOUD_SETTLEMENT_ROUTE} is, and never by a person.** The body is the Store's
|
|
264
|
+
* own signed query, naming the one Node it asks about, so a captured query answers
|
|
265
|
+
* for that Node and no other. A person issuer's key is never the Store's, so a query
|
|
266
|
+
* a person signed is refused. It answers `{ nodeId, bound }` and nothing else: no
|
|
267
|
+
* wallet, holder, Citizen or date crosses to the Cloud. A `POST` because the question
|
|
268
|
+
* travels signed in the body; nothing is written. Not in {@link ROUTES}, and no
|
|
269
|
+
* client method, because no person's software calls it.
|
|
270
|
+
*/
|
|
271
|
+
export declare const NODE_BINDING_QUERY_ROUTE: {
|
|
272
|
+
readonly method: "POST";
|
|
273
|
+
readonly path: "/api/cloud/node-binding-queries";
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Where Cayso publishes the public half of every key it signs an authorisation
|
|
277
|
+
* acknowledgement with (CMTY-0018 §1, CMTY-0022 row 9): a JSON Web Key Set the
|
|
278
|
+
* Percayso Cloud reads to verify an acknowledgement an Instance hands it.
|
|
279
|
+
*
|
|
280
|
+
* **An unauthenticated read**, because a public key is public: it carries no
|
|
281
|
+
* identity, names no wallet and moves nothing. Not in {@link ROUTES}, whose every
|
|
282
|
+
* entry is classified by a person's assurance, and no client method, because no
|
|
283
|
+
* person's software calls it. A deployment holding no acknowledgement key answers
|
|
284
|
+
* `503 acknowledgement_signing_not_configured`, never an empty set a verifier would
|
|
285
|
+
* read as "Cayso signs nothing".
|
|
286
|
+
*/
|
|
287
|
+
export declare const ACKNOWLEDGEMENT_KEYS_ROUTE: {
|
|
288
|
+
readonly method: "GET";
|
|
289
|
+
readonly path: "/api/acknowledgement-keys";
|
|
290
|
+
};
|
package/dist/routes.js
CHANGED
|
@@ -134,13 +134,34 @@
|
|
|
134
134
|
* authorisation under the owner's assertion (`present-standing-authorisation`,
|
|
135
135
|
* CMTY-0018 §1). A person is behind it, so it is classified by a person's
|
|
136
136
|
* assurance like every other entry. It names no wallet: the wallet is the verified
|
|
137
|
-
* holder's own.
|
|
137
|
+
* holder's own. Published at `0.25.0` and served from `0.30.0` (CAY-0094).
|
|
138
|
+
*
|
|
139
|
+
* `revokeStandingAuthorisation` withdraws one (`revoke-standing-authorisation`). It
|
|
140
|
+
* is its own path for citizenship's reason, and a `POST` for cancelling's: nothing is
|
|
141
|
+
* deleted. The authorisation's row stays, and so does its Instance key's binding to
|
|
142
|
+
* the wallet; the revocation is a row of its own beside them. The body names the
|
|
143
|
+
* authorisation's `jti` and no wallet.
|
|
144
|
+
*
|
|
145
|
+
* `bindNode` binds a Node to the wallet its presenting Instance key is already bound
|
|
146
|
+
* to (`bind-node`, CAY-0095), under the owner's assertion. A person is behind it, so
|
|
147
|
+
* it is classified by a person's assurance. The body carries the Node ID signed by the
|
|
148
|
+
* Instance key and that key's public half, and no wallet: the wallet is the one the
|
|
149
|
+
* key is bound to, which must be the verified holder's own. A `POST` to a collection
|
|
150
|
+
* of bindings, because a Node is bound once and a repeat answers the same.
|
|
138
151
|
*
|
|
139
152
|
* The Contribution Store's settlement assertion is presented by no person. Its path
|
|
140
153
|
* is {@link CLOUD_SETTLEMENT_ROUTE}, outside this table, because every entry here is
|
|
141
154
|
* mapped in `OPERATION_FOR_ROUTE` to the assurance a person needs, and `null` there
|
|
142
155
|
* means "carries no identity", which is false of an assertion a registered issuer
|
|
143
|
-
* signed.
|
|
156
|
+
* signed. The Store's read of whether a Node is bound,
|
|
157
|
+
* {@link NODE_BINDING_QUERY_ROUTE}, is outside it for the same reason.
|
|
158
|
+
*
|
|
159
|
+
* ## Why Cayso's acknowledgement keys are outside this table too
|
|
160
|
+
*
|
|
161
|
+
* {@link ACKNOWLEDGEMENT_KEYS_ROUTE} publishes the public half of the key Cayso signs
|
|
162
|
+
* an authorisation acknowledgement with. It carries no identity at all, so it is not
|
|
163
|
+
* a person's operation either, and it is read by the Percayso Cloud's software rather
|
|
164
|
+
* than by a person's, so the client has no method for it.
|
|
144
165
|
*/
|
|
145
166
|
export const ROUTES = {
|
|
146
167
|
wallet: { method: 'GET', path: '/api/wallet' },
|
|
@@ -161,6 +182,11 @@ export const ROUTES = {
|
|
|
161
182
|
requestBuyBack: { method: 'POST', path: '/api/buy-backs' },
|
|
162
183
|
marketplaceOrder: { method: 'POST', path: '/api/marketplace/orders' },
|
|
163
184
|
standingAuthorisation: { method: 'POST', path: '/api/cloud/standing-authorisations' },
|
|
185
|
+
revokeStandingAuthorisation: {
|
|
186
|
+
method: 'POST',
|
|
187
|
+
path: '/api/cloud/standing-authorisation-revocations',
|
|
188
|
+
},
|
|
189
|
+
bindNode: { method: 'POST', path: '/api/cloud/node-bindings' },
|
|
164
190
|
version: { method: 'GET', path: '/api/version' },
|
|
165
191
|
};
|
|
166
192
|
/**
|
|
@@ -175,9 +201,45 @@ export const ROUTES = {
|
|
|
175
201
|
* in {@link ROUTES}, whose every entry is classified by a person's assurance. The
|
|
176
202
|
* client has no method for it, because no person's software calls it.
|
|
177
203
|
*
|
|
178
|
-
* Published
|
|
204
|
+
* Published at `0.25.0` and served from `0.30.0` (CAY-0096): a settled period is one
|
|
205
|
+
* `contribution_settlement` movement per paid contribution row and one
|
|
206
|
+
* `consumption_settlement` movement per consumption row, written whole or not at all.
|
|
179
207
|
*/
|
|
180
208
|
export const CLOUD_SETTLEMENT_ROUTE = {
|
|
181
209
|
method: 'POST',
|
|
182
210
|
path: '/api/cloud/settlement-assertions',
|
|
183
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Where the Percayso Cloud's Contribution Store asks whether one Node is bound to a
|
|
214
|
+
* wallet (CMTY-0018 §4, CAY-0095), so it can carry an unbound Node's rows withheld
|
|
215
|
+
* (`node_not_bound`) rather than pay them to nobody.
|
|
216
|
+
*
|
|
217
|
+
* **Authenticated by the registered Store issuer, exactly as
|
|
218
|
+
* {@link CLOUD_SETTLEMENT_ROUTE} is, and never by a person.** The body is the Store's
|
|
219
|
+
* own signed query, naming the one Node it asks about, so a captured query answers
|
|
220
|
+
* for that Node and no other. A person issuer's key is never the Store's, so a query
|
|
221
|
+
* a person signed is refused. It answers `{ nodeId, bound }` and nothing else: no
|
|
222
|
+
* wallet, holder, Citizen or date crosses to the Cloud. A `POST` because the question
|
|
223
|
+
* travels signed in the body; nothing is written. Not in {@link ROUTES}, and no
|
|
224
|
+
* client method, because no person's software calls it.
|
|
225
|
+
*/
|
|
226
|
+
export const NODE_BINDING_QUERY_ROUTE = {
|
|
227
|
+
method: 'POST',
|
|
228
|
+
path: '/api/cloud/node-binding-queries',
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Where Cayso publishes the public half of every key it signs an authorisation
|
|
232
|
+
* acknowledgement with (CMTY-0018 §1, CMTY-0022 row 9): a JSON Web Key Set the
|
|
233
|
+
* Percayso Cloud reads to verify an acknowledgement an Instance hands it.
|
|
234
|
+
*
|
|
235
|
+
* **An unauthenticated read**, because a public key is public: it carries no
|
|
236
|
+
* identity, names no wallet and moves nothing. Not in {@link ROUTES}, whose every
|
|
237
|
+
* entry is classified by a person's assurance, and no client method, because no
|
|
238
|
+
* person's software calls it. A deployment holding no acknowledgement key answers
|
|
239
|
+
* `503 acknowledgement_signing_not_configured`, never an empty set a verifier would
|
|
240
|
+
* read as "Cayso signs nothing".
|
|
241
|
+
*/
|
|
242
|
+
export const ACKNOWLEDGEMENT_KEYS_ROUTE = {
|
|
243
|
+
method: 'GET',
|
|
244
|
+
path: '/api/acknowledgement-keys',
|
|
245
|
+
};
|
package/dist/schema-types.d.ts
CHANGED
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
* consumer's business, Piper's or the Percayso Cloud's, and a schema that
|
|
24
24
|
* enumerated the operator surface would have published it (CAY-0026, Amendment 3;
|
|
25
25
|
* CLAUDE.md). The Contribution Store's settlement path is published, but under
|
|
26
|
-
* `issuerRoutes`, apart from the routes a person calls
|
|
26
|
+
* `issuerRoutes`, apart from the routes a person calls, and Cayso's acknowledgement keys
|
|
27
|
+
* under `keyRoutes`. The generator only ever sees this package, so the
|
|
27
28
|
* internal surface is absent by construction.
|
|
28
29
|
*
|
|
29
|
-
* The one part of the operator surface that IS published — the
|
|
30
|
-
* `./operator` entry point (CAY-0026,
|
|
30
|
+
* The one part of the operator surface that IS published — the four reads on the
|
|
31
|
+
* `./operator` entry point (CAY-0026, Amendments 4 and 5) — is described under its own
|
|
31
32
|
* key, {@link ContractSchema.operator}, with its routes and its types apart from
|
|
32
33
|
* `routes` and `types`. A consumer reading the person-facing surface therefore
|
|
33
34
|
* never meets an operator route or an operator type by accident, and the rest of
|
|
@@ -105,7 +106,7 @@ export interface SchemaOperatorRoute {
|
|
|
105
106
|
readonly scope: string;
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
108
|
-
* The published operator read surface (CAY-0026,
|
|
109
|
+
* The published operator read surface (CAY-0026, Amendments 4 and 5): the four reads on
|
|
109
110
|
* `@percayso-community/cayso-contracts/operator` and the types declared there. A type
|
|
110
111
|
* here may refer to one in {@link ContractSchema.types} — a row's `cents` is `Cents`
|
|
111
112
|
* — but never the other way round: nothing on the person-facing surface depends on
|
|
@@ -129,10 +130,19 @@ export interface ContractSchema {
|
|
|
129
130
|
/**
|
|
130
131
|
* The routes authenticated by a registered issuer (CAY-0030) rather than by a
|
|
131
132
|
* person, and therefore not in `ROUTES`: today the Contribution Store's
|
|
132
|
-
* settlement path (`CLOUD_SETTLEMENT_ROUTE`, CMTY-0018 §2)
|
|
133
|
+
* settlement path (`CLOUD_SETTLEMENT_ROUTE`, CMTY-0018 §2) and its read of whether a
|
|
134
|
+
* Node is bound (`NODE_BINDING_QUERY_ROUTE`, CAY-0095). Kept apart from
|
|
133
135
|
* {@link routes} so that no consumer reads one as the other.
|
|
134
136
|
*/
|
|
135
137
|
readonly issuerRoutes: Readonly<Record<string, SchemaRoute>>;
|
|
138
|
+
/**
|
|
139
|
+
* The unauthenticated reads that publish the public half of a key Cayso signs
|
|
140
|
+
* with, and therefore not in `ROUTES` either: today the authorisation
|
|
141
|
+
* acknowledgement keys (`ACKNOWLEDGEMENT_KEYS_ROUTE`, CAY-0093). No credential
|
|
142
|
+
* travels with them, so they are apart from both {@link routes} and
|
|
143
|
+
* {@link issuerRoutes}.
|
|
144
|
+
*/
|
|
145
|
+
readonly keyRoutes: Readonly<Record<string, SchemaRoute>>;
|
|
136
146
|
readonly types: Readonly<Record<string, SchemaType>>;
|
|
137
147
|
/**
|
|
138
148
|
* The operator reads an operator app's server calls, and their types — under
|
package/dist/schema.d.ts
CHANGED
|
@@ -10,15 +10,27 @@
|
|
|
10
10
|
* none of this, and importing it does nothing but hand back a frozen data value
|
|
11
11
|
* and its types (CLAUDE.md: packages have no side effects on import).
|
|
12
12
|
*
|
|
13
|
-
* ##
|
|
13
|
+
* ## A published, versioned surface — and the one a Go consumer depends on
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* Two consumers read this descriptor, in two ways, and both are depending on the
|
|
16
|
+
* package (CAY-0026 Amendment 3; CMTY-0018 §3 as amended):
|
|
17
|
+
*
|
|
18
|
+
* - **A TypeScript consumer imports the types** and the compiler holds the
|
|
19
|
+
* surface; for it this descriptor is a tool *about* the contract — the version
|
|
20
|
+
* endpoint, the CI contract test, an operator eyeballing a mismatch — and never
|
|
21
|
+
* a runtime type system standing in for the import.
|
|
22
|
+
* - **A consumer in another language generates from this entry point of the
|
|
23
|
+
* published tarball at a pinned version**, and fails its own build when its
|
|
24
|
+
* generated types drift from the schema. The Percayso Cloud is that consumer: it
|
|
25
|
+
* is written in Go, cannot import a TypeScript type, and generates its types for
|
|
26
|
+
* the two seams in `cloud-settlement` from the tarball it pins. The pin is its
|
|
27
|
+
* lockfile entry and the regeneration is its compile. The schema ships as a JS
|
|
28
|
+
* module only, which is why the generator reads the tarball.
|
|
29
|
+
*
|
|
30
|
+
* What is refused is reading the schema OFF THE WIRE (`GET /api/version/schema`)
|
|
31
|
+
* as a substitute for pinning the package: that couples a consumer's build to a
|
|
32
|
+
* deployment's uptime and replaces a pinned version with whatever is deployed. The
|
|
33
|
+
* endpoint reports a running deployment; the package is the contract (the README).
|
|
22
34
|
*/
|
|
23
35
|
export type { ContractSchema, ScalarKind, SchemaProperty, SchemaOperatorRoute, SchemaOperatorSurface, SchemaRoute, SchemaType, SchemaTypeNode, } from './schema-types.js';
|
|
24
36
|
export { CONTRACT_SCHEMA } from './contract-schema.generated.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percayso-community/cayso-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
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": {
|