@percayso-community/cayso-contracts 0.30.0 → 2.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 +45 -13
- package/dist/assertion.d.ts +43 -0
- package/dist/authority.d.ts +221 -0
- package/dist/authority.js +49 -0
- package/dist/client.d.ts +54 -15
- package/dist/client.js +17 -4
- package/dist/cloud-settlement.d.ts +8 -5
- package/dist/contract-schema.generated.js +567 -1
- package/dist/errors.d.ts +13 -2
- package/dist/index.d.ts +81 -4
- package/dist/index.js +80 -4
- package/dist/operator.d.ts +136 -5
- package/dist/operator.js +6 -1
- package/dist/schema-types.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
* This is the surface of every consumer outside this tree (CAY-0026, Amendment 3):
|
|
61
61
|
* Piper first, and the Percayso Cloud second, whose two seams with Cayso arrive from
|
|
62
62
|
* `cloud-settlement`. Peer types, admin types, holdings and carves are deliberately
|
|
63
|
-
* not exported here; they are not a consumer's business. The
|
|
63
|
+
* not exported here; they are not a consumer's business. The four operator reads an
|
|
64
64
|
* operator app's server calls are published, but on their own entry point,
|
|
65
|
-
* `@percayso-community/cayso-contracts/operator` (CAY-0026,
|
|
66
|
-
* here re-exports them: none of this barrel's consumers is an operator.
|
|
65
|
+
* `@percayso-community/cayso-contracts/operator` (CAY-0026, Amendments 4 and 5), and
|
|
66
|
+
* nothing here re-exports them: none of this barrel's consumers is an operator.
|
|
67
67
|
* And it carries **no numbers** — amounts, rates, tiers, schedules and thresholds
|
|
68
68
|
* live in the canon PRD and are read from one place, never restated here.
|
|
69
69
|
*/
|
|
@@ -76,6 +76,71 @@
|
|
|
76
76
|
* this money surface gains that Piper's own contracts lack, since theirs share
|
|
77
77
|
* one global version bumped across all twenty-two together (CAY-0026).
|
|
78
78
|
*
|
|
79
|
+
* From `1.0.0` the version follows ordinary semantic versioning (CAY-0101, amending
|
|
80
|
+
* CAY-0086). A minor is additive on the wire and drops nothing: Cayso keeps serving
|
|
81
|
+
* every earlier minor of the same major, so a removal waits for a major. A major is
|
|
82
|
+
* the only breaking kind, and the only time a consumer has to move. A consumer's
|
|
83
|
+
* handshake accepts a Cayso if `contractVersion` or any entry of
|
|
84
|
+
* `supportedContractVersions` is on its own line: from `1.0.0` the same major, below
|
|
85
|
+
* it the same minor.
|
|
86
|
+
*
|
|
87
|
+
* `1.0.0` → `2.0.0` SERVES the two-signer binding (CAY-0100 §4, §4a, #417), and it is
|
|
88
|
+
* a MAJOR, BREAKING ON THE WIRE, declared so under CAY-0101. It lists nothing older: a
|
|
89
|
+
* deployment of it serves `2.0.0` alone, so `1.0.0` and the `0.x` transition major 1
|
|
90
|
+
* carried are no longer served. No type in this package changed shape; the behaviour
|
|
91
|
+
* behind three routes a `1.0.0` consumer already calls did:
|
|
92
|
+
*
|
|
93
|
+
* - **`ROUTES.organisationProvision`** reads the Organisation ID from BizID's
|
|
94
|
+
* {@link AuthorityClaims}, sent in {@link AUTHORITY_ASSERTION_HEADER} and bound to
|
|
95
|
+
* the identity assertion, and no longer from `organisationAuthority`. Without the
|
|
96
|
+
* header it answers `401 authority_assertion_missing`, where it used to provision
|
|
97
|
+
* or answer `403 no_organisation_authority`.
|
|
98
|
+
* - **`ROUTES.commercialPayment` on the `'mandate'` route** is authorised by the bound
|
|
99
|
+
* `AuthorityClaims`, not by `mandateFor`. The payment-allowance route is unchanged.
|
|
100
|
+
* - **`ROUTES.purchaseAuthorise` with any `onBehalfOfWalletId`** is authorised the
|
|
101
|
+
* same way, and the wallet named must be the one the bound Organisation is bound to;
|
|
102
|
+
* `mandateFor` authorises no delegated purchase, into any wallet. A Citizen's own
|
|
103
|
+
* purchase is unchanged.
|
|
104
|
+
*
|
|
105
|
+
* On those three acts the members of {@link AuthorityBindingRefusal} and
|
|
106
|
+
* `authority_issuer_not_configured` now reach the wire, which `0.31.0` declared and no
|
|
107
|
+
* route produced up to `1.0.0`. `organisationAuthority` and `mandateFor` stay declared,
|
|
108
|
+
* and are removed by a later major (#419).
|
|
109
|
+
*
|
|
110
|
+
* `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
|
|
111
|
+
* `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
|
|
112
|
+
* `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
|
|
113
|
+
* entries below are the `0.x` history; "breaking" in them is the package's sense,
|
|
114
|
+
* under which a minor below `1.0.0` was a breaking line.
|
|
115
|
+
*
|
|
116
|
+
* `0.31.0` → `0.32.0` publishes and serves a fourth operator read on the `./operator`
|
|
117
|
+
* entry point, the economy summary, under
|
|
118
|
+
* `read-economy-summary-as-operator` (CAY-0026 Amendment 5): whole-number counts of
|
|
119
|
+
* wallets, movements and purchases, and cent totals of what is minted, cancelled and
|
|
120
|
+
* held, with its closed not-configured body. Nothing in this barrel changed, so no
|
|
121
|
+
* closed table grew: `ROUTES`, `ContractOperation` and `CaysoApiErrorCode` are as
|
|
122
|
+
* `0.31.0` published them. It is additive in the package's sense and on the wire
|
|
123
|
+
* (CAY-0086).
|
|
124
|
+
*
|
|
125
|
+
* `0.30.0` → `0.31.0` publishes BizID's authority assertion (CAY-0100), and serves
|
|
126
|
+
* nothing new: {@link AuthorityClaims}, its {@link AuthorityEnvelope} under the identity
|
|
127
|
+
* assertion's own `AssertionHeader`, and the binding's closed
|
|
128
|
+
* {@link AuthorityBindingRefusal}, which `CaysoApiErrorCode` gains by reference;
|
|
129
|
+
* {@link AUTHORITY_ASSERTION_HEADER}, the header it travels in; {@link isMandateVersion},
|
|
130
|
+
* the one check that `mandateVersion` is a JSON integer of at least 1; the seam code
|
|
131
|
+
* `authority_issuer_not_configured`, which `CaysoApiErrorCode` gains as the authority
|
|
132
|
+
* issuer's closed door and no route emits yet (#417); an optional
|
|
133
|
+
* `auth_time` on {@link AssertionClaims}, which the verifier now admits as a
|
|
134
|
+
* non-negative integer and nothing reads; and an optional per-request authority
|
|
135
|
+
* assertion provider on the thin client's three Organisation operations,
|
|
136
|
+
* `provisionOrganisation`, `makeCommercialPayment` and `authorisePurchase`, sent only
|
|
137
|
+
* when the caller passes one. `organisationAuthority` and `mandateFor` stay, retired
|
|
138
|
+
* and removed by a later breaking step (#419). BREAKING in the package's sense
|
|
139
|
+
* because a closed union grew. Additive on the wire (CAY-0086): no route a `0.30.0`
|
|
140
|
+
* consumer calls changed or answers anything new, because no route reads the header
|
|
141
|
+
* or produces the new codes yet, and a credential a `0.30.0` issuer mints, which
|
|
142
|
+
* carries no `auth_time`, verifies exactly as before.
|
|
143
|
+
*
|
|
79
144
|
* `0.29.0` → `0.30.0` publishes and SERVES Cayso's authorisation acknowledgement keys
|
|
80
145
|
* (CAY-0093): {@link ACKNOWLEDGEMENT_KEYS_ROUTE}, `GET /api/acknowledgement-keys`, an
|
|
81
146
|
* unauthenticated read outside `ROUTES`, described in the schema under `keyRoutes`;
|
|
@@ -610,7 +675,7 @@
|
|
|
610
675
|
* have needed a breaking bump on their own. Under semver below `1.0.0` the minor
|
|
611
676
|
* is where a breaking change goes, so the minor moves and the patch does not.
|
|
612
677
|
*/
|
|
613
|
-
export declare const CONTRACT_VERSION: "0.
|
|
678
|
+
export declare const CONTRACT_VERSION: "2.0.0";
|
|
614
679
|
/** The package's own name, so a consumer can name what it depends on. */
|
|
615
680
|
export declare const packageName = "@percayso-community/cayso-contracts";
|
|
616
681
|
/**
|
|
@@ -687,6 +752,17 @@ export { NOT_PROVISIONED } from './citizenship.js';
|
|
|
687
752
|
* exception to keeping numbers in the canon PRD; no economic figure is here.
|
|
688
753
|
*/
|
|
689
754
|
export { MAX_ASSERTION_LIFETIME_SECONDS, CLOCK_SKEW_TOLERANCE_SECONDS, MINIMUM_ASSERTION_USE_RETENTION_SECONDS, } from './assertion.js';
|
|
755
|
+
/**
|
|
756
|
+
* The request header BizID's authority assertion travels in, beside the identity
|
|
757
|
+
* assertion's `Authorization` (CAY-0100 §4). A value so a consumer and the service
|
|
758
|
+
* spell it from one place; the reasoning behind the name is on the constant.
|
|
759
|
+
*/
|
|
760
|
+
export { AUTHORITY_ASSERTION_HEADER } from './authority.js';
|
|
761
|
+
/**
|
|
762
|
+
* Whether a value is a well-formed `AuthorityClaims.mandateVersion`: a JSON integer of at
|
|
763
|
+
* least 1, BizID's mandate version counter (CAY-0100 §5). The one check of the shape.
|
|
764
|
+
*/
|
|
765
|
+
export { isMandateVersion } from './authority.js';
|
|
690
766
|
/**
|
|
691
767
|
* The assurance profile (CAY-0029): what each `VerificationMethod` asserts, which
|
|
692
768
|
* methods each operation accepts, and the version a claim is minted under.
|
|
@@ -775,5 +851,6 @@ export type { StoreSignedStatement, MarketplaceOrderRequest, MarketplaceRefundRe
|
|
|
775
851
|
export type { InstanceKeyId, SettlementPeriodRule, SettlementPeriodId, NodeId, ContributionStoreIssuer, PercaysoCloudAudience, StandingAuthorisationClaims, StandingAuthorisationRequest, AuthorisationAcknowledgementClaims, AcknowledgementKeyId, AcknowledgementPublicKey, AcknowledgementKeySet, StandingAuthorisationAcknowledged, StandingAuthorisationRefused, StandingAuthorisationResponse, StandingAuthorisationRefusal, StandingAuthorisationRevocationRequest, StandingAuthorisationRevoked, StandingAuthorisationRevocationRefused, StandingAuthorisationRevocationResponse, StandingAuthorisationRevocationRefusal, NodePresentationClaims, NodeBindingRequest, NodeBound, NodeBindingRefused, NodeBindingResponse, NodeBindingRefusal, NodeBindingQueryClaims, NodeBindingQueryRequest, NodeBindingStatus, NodeBindingQueryRefused, NodeBindingQueryRefusal, ContributionType, SettlementPeriod, ContributionWithheldReason, ContributionQualified, ContributionWithheld, ContributionQualification, ContributionRow, ConsumptionRow, SettlementTotals, SettlementAssertionClaims, SettlementAssertionRequest, SettlementAssertionSettled, SettlementAssertionRefused, ContributionRowRefused, ConsumptionRowRefused, SettlementAssertionResponse, SettlementAssertionLevelRefusal, ContributionRowRefusal, ConsumptionRowRefusal, SettlementAssertionRefusal, } from './cloud-settlement.js';
|
|
776
852
|
export type { PurchaseRequest, PurchaseAuthorised, PurchaseTerminal, PurchaseUnresolved, PurchaseRefused, PurchaseAuthorisationResponse, PurchaseFailureReason, PurchaseStatus, LivePurchaseStatus, TerminalPurchaseStatus, PurchaseCancelRefusalReason, PurchaseCancelled, PurchaseCancelRefused, PurchaseCancelResponse, PurchaseResult, } from './purchase.js';
|
|
777
853
|
export type { VerificationMethod, VerificationStatus, SubjectPersonhood, AssertionClaims, AssertionHeader, AssertionEnvelope, ContractOperation, InternalOperation, ScopeKey, } from './assertion.js';
|
|
854
|
+
export type { AuthorityClaims, AuthorityEnvelope, AuthorityBindingRefusal } from './authority.js';
|
|
778
855
|
export type { VerificationEvidence, EvidenceStatement, MethodDecision, MethodDecisions, AssuranceRequired, AssuranceNotRequired, OperationAssurance, AssuranceRefusalReason, AssuranceAssessment, } from './assurance.js';
|
|
779
856
|
export type { Restriction, HoldingKind, HoldingCapability, PermittedStanding, RefusedStanding, OpenStanding, CapabilityStanding, CapabilityCell, CapabilityCoordinate, CapabilityPolicy, ArrivalAndExpiry, } from './restriction.js';
|
package/dist/index.js
CHANGED
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
* This is the surface of every consumer outside this tree (CAY-0026, Amendment 3):
|
|
76
76
|
* Piper first, and the Percayso Cloud second, whose two seams with Cayso arrive from
|
|
77
77
|
* `cloud-settlement`. Peer types, admin types, holdings and carves are deliberately
|
|
78
|
-
* not exported here; they are not a consumer's business. The
|
|
78
|
+
* not exported here; they are not a consumer's business. The four operator reads an
|
|
79
79
|
* operator app's server calls are published, but on their own entry point,
|
|
80
|
-
* `@percayso-community/cayso-contracts/operator` (CAY-0026,
|
|
81
|
-
* here re-exports them: none of this barrel's consumers is an operator.
|
|
80
|
+
* `@percayso-community/cayso-contracts/operator` (CAY-0026, Amendments 4 and 5), and
|
|
81
|
+
* nothing here re-exports them: none of this barrel's consumers is an operator.
|
|
82
82
|
* And it carries **no numbers** — amounts, rates, tiers, schedules and thresholds
|
|
83
83
|
* live in the canon PRD and are read from one place, never restated here.
|
|
84
84
|
*/
|
|
@@ -92,6 +92,71 @@
|
|
|
92
92
|
* this money surface gains that Piper's own contracts lack, since theirs share
|
|
93
93
|
* one global version bumped across all twenty-two together (CAY-0026).
|
|
94
94
|
*
|
|
95
|
+
* From `1.0.0` the version follows ordinary semantic versioning (CAY-0101, amending
|
|
96
|
+
* CAY-0086). A minor is additive on the wire and drops nothing: Cayso keeps serving
|
|
97
|
+
* every earlier minor of the same major, so a removal waits for a major. A major is
|
|
98
|
+
* the only breaking kind, and the only time a consumer has to move. A consumer's
|
|
99
|
+
* handshake accepts a Cayso if `contractVersion` or any entry of
|
|
100
|
+
* `supportedContractVersions` is on its own line: from `1.0.0` the same major, below
|
|
101
|
+
* it the same minor.
|
|
102
|
+
*
|
|
103
|
+
* `1.0.0` → `2.0.0` SERVES the two-signer binding (CAY-0100 §4, §4a, #417), and it is
|
|
104
|
+
* a MAJOR, BREAKING ON THE WIRE, declared so under CAY-0101. It lists nothing older: a
|
|
105
|
+
* deployment of it serves `2.0.0` alone, so `1.0.0` and the `0.x` transition major 1
|
|
106
|
+
* carried are no longer served. No type in this package changed shape; the behaviour
|
|
107
|
+
* behind three routes a `1.0.0` consumer already calls did:
|
|
108
|
+
*
|
|
109
|
+
* - **`ROUTES.organisationProvision`** reads the Organisation ID from BizID's
|
|
110
|
+
* {@link AuthorityClaims}, sent in {@link AUTHORITY_ASSERTION_HEADER} and bound to
|
|
111
|
+
* the identity assertion, and no longer from `organisationAuthority`. Without the
|
|
112
|
+
* header it answers `401 authority_assertion_missing`, where it used to provision
|
|
113
|
+
* or answer `403 no_organisation_authority`.
|
|
114
|
+
* - **`ROUTES.commercialPayment` on the `'mandate'` route** is authorised by the bound
|
|
115
|
+
* `AuthorityClaims`, not by `mandateFor`. The payment-allowance route is unchanged.
|
|
116
|
+
* - **`ROUTES.purchaseAuthorise` with any `onBehalfOfWalletId`** is authorised the
|
|
117
|
+
* same way, and the wallet named must be the one the bound Organisation is bound to;
|
|
118
|
+
* `mandateFor` authorises no delegated purchase, into any wallet. A Citizen's own
|
|
119
|
+
* purchase is unchanged.
|
|
120
|
+
*
|
|
121
|
+
* On those three acts the members of {@link AuthorityBindingRefusal} and
|
|
122
|
+
* `authority_issuer_not_configured` now reach the wire, which `0.31.0` declared and no
|
|
123
|
+
* route produced up to `1.0.0`. `organisationAuthority` and `mandateFor` stay declared,
|
|
124
|
+
* and are removed by a later major (#419).
|
|
125
|
+
*
|
|
126
|
+
* `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
|
|
127
|
+
* `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
|
|
128
|
+
* `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
|
|
129
|
+
* entries below are the `0.x` history; "breaking" in them is the package's sense,
|
|
130
|
+
* under which a minor below `1.0.0` was a breaking line.
|
|
131
|
+
*
|
|
132
|
+
* `0.31.0` → `0.32.0` publishes and serves a fourth operator read on the `./operator`
|
|
133
|
+
* entry point, the economy summary, under
|
|
134
|
+
* `read-economy-summary-as-operator` (CAY-0026 Amendment 5): whole-number counts of
|
|
135
|
+
* wallets, movements and purchases, and cent totals of what is minted, cancelled and
|
|
136
|
+
* held, with its closed not-configured body. Nothing in this barrel changed, so no
|
|
137
|
+
* closed table grew: `ROUTES`, `ContractOperation` and `CaysoApiErrorCode` are as
|
|
138
|
+
* `0.31.0` published them. It is additive in the package's sense and on the wire
|
|
139
|
+
* (CAY-0086).
|
|
140
|
+
*
|
|
141
|
+
* `0.30.0` → `0.31.0` publishes BizID's authority assertion (CAY-0100), and serves
|
|
142
|
+
* nothing new: {@link AuthorityClaims}, its {@link AuthorityEnvelope} under the identity
|
|
143
|
+
* assertion's own `AssertionHeader`, and the binding's closed
|
|
144
|
+
* {@link AuthorityBindingRefusal}, which `CaysoApiErrorCode` gains by reference;
|
|
145
|
+
* {@link AUTHORITY_ASSERTION_HEADER}, the header it travels in; {@link isMandateVersion},
|
|
146
|
+
* the one check that `mandateVersion` is a JSON integer of at least 1; the seam code
|
|
147
|
+
* `authority_issuer_not_configured`, which `CaysoApiErrorCode` gains as the authority
|
|
148
|
+
* issuer's closed door and no route emits yet (#417); an optional
|
|
149
|
+
* `auth_time` on {@link AssertionClaims}, which the verifier now admits as a
|
|
150
|
+
* non-negative integer and nothing reads; and an optional per-request authority
|
|
151
|
+
* assertion provider on the thin client's three Organisation operations,
|
|
152
|
+
* `provisionOrganisation`, `makeCommercialPayment` and `authorisePurchase`, sent only
|
|
153
|
+
* when the caller passes one. `organisationAuthority` and `mandateFor` stay, retired
|
|
154
|
+
* and removed by a later breaking step (#419). BREAKING in the package's sense
|
|
155
|
+
* because a closed union grew. Additive on the wire (CAY-0086): no route a `0.30.0`
|
|
156
|
+
* consumer calls changed or answers anything new, because no route reads the header
|
|
157
|
+
* or produces the new codes yet, and a credential a `0.30.0` issuer mints, which
|
|
158
|
+
* carries no `auth_time`, verifies exactly as before.
|
|
159
|
+
*
|
|
95
160
|
* `0.29.0` → `0.30.0` publishes and SERVES Cayso's authorisation acknowledgement keys
|
|
96
161
|
* (CAY-0093): {@link ACKNOWLEDGEMENT_KEYS_ROUTE}, `GET /api/acknowledgement-keys`, an
|
|
97
162
|
* unauthenticated read outside `ROUTES`, described in the schema under `keyRoutes`;
|
|
@@ -626,7 +691,7 @@
|
|
|
626
691
|
* have needed a breaking bump on their own. Under semver below `1.0.0` the minor
|
|
627
692
|
* is where a breaking change goes, so the minor moves and the patch does not.
|
|
628
693
|
*/
|
|
629
|
-
export const CONTRACT_VERSION = '0.
|
|
694
|
+
export const CONTRACT_VERSION = '2.0.0';
|
|
630
695
|
/** The package's own name, so a consumer can name what it depends on. */
|
|
631
696
|
export const packageName = '@percayso-community/cayso-contracts';
|
|
632
697
|
/**
|
|
@@ -703,6 +768,17 @@ export { NOT_PROVISIONED } from './citizenship.js';
|
|
|
703
768
|
* exception to keeping numbers in the canon PRD; no economic figure is here.
|
|
704
769
|
*/
|
|
705
770
|
export { MAX_ASSERTION_LIFETIME_SECONDS, CLOCK_SKEW_TOLERANCE_SECONDS, MINIMUM_ASSERTION_USE_RETENTION_SECONDS, } from './assertion.js';
|
|
771
|
+
/**
|
|
772
|
+
* The request header BizID's authority assertion travels in, beside the identity
|
|
773
|
+
* assertion's `Authorization` (CAY-0100 §4). A value so a consumer and the service
|
|
774
|
+
* spell it from one place; the reasoning behind the name is on the constant.
|
|
775
|
+
*/
|
|
776
|
+
export { AUTHORITY_ASSERTION_HEADER } from './authority.js';
|
|
777
|
+
/**
|
|
778
|
+
* Whether a value is a well-formed `AuthorityClaims.mandateVersion`: a JSON integer of at
|
|
779
|
+
* least 1, BizID's mandate version counter (CAY-0100 §5). The one check of the shape.
|
|
780
|
+
*/
|
|
781
|
+
export { isMandateVersion } from './authority.js';
|
|
706
782
|
/**
|
|
707
783
|
* The assurance profile (CAY-0029): what each `VerificationMethod` asserts, which
|
|
708
784
|
* methods each operation accepts, and the version a claim is minted under.
|
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,6 +82,11 @@ 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
|
|
@@ -236,6 +244,120 @@ export interface QuickeningLadder {
|
|
|
236
244
|
readonly live: LiveQuickeningBand | null;
|
|
237
245
|
readonly activeCitizens: number;
|
|
238
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
|
+
}
|
|
239
361
|
/**
|
|
240
362
|
* `401` — no credential, or one the verifier refused. Every member is also a
|
|
241
363
|
* {@link import('./errors.js').CaysoApiErrorCode}: the gate is the one every route
|
|
@@ -285,12 +407,16 @@ export type OperatorPurchasesUnavailable = 'operator_purchases_reader_not_config
|
|
|
285
407
|
* seeded. Kept apart so an operator can tell a wiring fault from an empty table.
|
|
286
408
|
*/
|
|
287
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';
|
|
288
412
|
/** Every `{ error }` code the movement list answers. */
|
|
289
413
|
export type OperatorMovementsErrorCode = OperatorMovementsQueryRefusal | OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | OperatorMovementsUnavailable | OperatorReadFailed;
|
|
290
414
|
/** Every `{ error }` code the purchase list answers. */
|
|
291
415
|
export type OperatorPurchasesErrorCode = OperatorPurchasesQueryRefusal | OperatorAuthenticationRefusal | OperatorAccessRefusal | OperatorRateLimited | OperatorReadUnavailable | OperatorPurchasesUnavailable | OperatorReadFailed;
|
|
292
416
|
/** Every `{ error }` code the ladder answers. It takes no query, so nothing is a `400`. */
|
|
293
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;
|
|
294
420
|
export interface OperatorMovementsError {
|
|
295
421
|
readonly error: OperatorMovementsErrorCode;
|
|
296
422
|
}
|
|
@@ -300,9 +426,14 @@ export interface OperatorPurchasesError {
|
|
|
300
426
|
export interface QuickeningLadderError {
|
|
301
427
|
readonly error: QuickeningLadderErrorCode;
|
|
302
428
|
}
|
|
429
|
+
export interface OperatorEconomySummaryError {
|
|
430
|
+
readonly error: OperatorEconomySummaryErrorCode;
|
|
431
|
+
}
|
|
303
432
|
/** Everything `GET /api/operator/movements` answers: `200`, or one refusal body. */
|
|
304
433
|
export type OperatorMovementsResponse = OperatorMovementsPage | OperatorVerificationRefused | OperatorMovementsError;
|
|
305
434
|
/** Everything `GET /api/operator/purchases` answers: `200`, or one refusal body. */
|
|
306
435
|
export type OperatorPurchasesResponse = OperatorPurchasesPage | OperatorVerificationRefused | OperatorPurchasesError;
|
|
307
436
|
/** Everything `GET /api/operator/quickenings` answers: `200`, or one refusal body. */
|
|
308
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 = [
|
package/dist/schema-types.d.ts
CHANGED
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* under `keyRoutes`. The generator only ever sees this package, so the
|
|
28
28
|
* internal surface is absent by construction.
|
|
29
29
|
*
|
|
30
|
-
* The one part of the operator surface that IS published — the
|
|
31
|
-
* `./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
|
|
32
32
|
* key, {@link ContractSchema.operator}, with its routes and its types apart from
|
|
33
33
|
* `routes` and `types`. A consumer reading the person-facing surface therefore
|
|
34
34
|
* never meets an operator route or an operator type by accident, and the rest of
|
|
@@ -106,7 +106,7 @@ export interface SchemaOperatorRoute {
|
|
|
106
106
|
readonly scope: string;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* The published operator read surface (CAY-0026,
|
|
109
|
+
* The published operator read surface (CAY-0026, Amendments 4 and 5): the four reads on
|
|
110
110
|
* `@percayso-community/cayso-contracts/operator` and the types declared there. A type
|
|
111
111
|
* here may refer to one in {@link ContractSchema.types} — a row's `cents` is `Cents`
|
|
112
112
|
* — but never the other way round: nothing on the person-facing surface depends on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percayso-community/cayso-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.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": {
|