@percayso-community/cayso-contracts 0.30.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/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 three operator reads an
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, Amendment 4), and nothing
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,48 @@
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
+ * `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
88
+ * `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
89
+ * `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
90
+ * entries below are the `0.x` history; "breaking" in them is the package's sense,
91
+ * under which a minor below `1.0.0` was a breaking line.
92
+ *
93
+ * `0.31.0` → `0.32.0` publishes and serves a fourth operator read on the `./operator`
94
+ * entry point, the economy summary, under
95
+ * `read-economy-summary-as-operator` (CAY-0026 Amendment 5): whole-number counts of
96
+ * wallets, movements and purchases, and cent totals of what is minted, cancelled and
97
+ * held, with its closed not-configured body. Nothing in this barrel changed, so no
98
+ * closed table grew: `ROUTES`, `ContractOperation` and `CaysoApiErrorCode` are as
99
+ * `0.31.0` published them. It is additive in the package's sense and on the wire
100
+ * (CAY-0086).
101
+ *
102
+ * `0.30.0` → `0.31.0` publishes BizID's authority assertion (CAY-0100), and serves
103
+ * nothing new: {@link AuthorityClaims}, its {@link AuthorityEnvelope} under the identity
104
+ * assertion's own `AssertionHeader`, and the binding's closed
105
+ * {@link AuthorityBindingRefusal}, which `CaysoApiErrorCode` gains by reference;
106
+ * {@link AUTHORITY_ASSERTION_HEADER}, the header it travels in; {@link isMandateVersion},
107
+ * the one check that `mandateVersion` is a JSON integer of at least 1; the seam code
108
+ * `authority_issuer_not_configured`, which `CaysoApiErrorCode` gains as the authority
109
+ * issuer's closed door and no route emits yet (#417); an optional
110
+ * `auth_time` on {@link AssertionClaims}, which the verifier now admits as a
111
+ * non-negative integer and nothing reads; and an optional per-request authority
112
+ * assertion provider on the thin client's three Organisation operations,
113
+ * `provisionOrganisation`, `makeCommercialPayment` and `authorisePurchase`, sent only
114
+ * when the caller passes one. `organisationAuthority` and `mandateFor` stay, retired
115
+ * and removed by a later breaking step (#419). BREAKING in the package's sense
116
+ * because a closed union grew. Additive on the wire (CAY-0086): no route a `0.30.0`
117
+ * consumer calls changed or answers anything new, because no route reads the header
118
+ * or produces the new codes yet, and a credential a `0.30.0` issuer mints, which
119
+ * carries no `auth_time`, verifies exactly as before.
120
+ *
79
121
  * `0.29.0` → `0.30.0` publishes and SERVES Cayso's authorisation acknowledgement keys
80
122
  * (CAY-0093): {@link ACKNOWLEDGEMENT_KEYS_ROUTE}, `GET /api/acknowledgement-keys`, an
81
123
  * unauthenticated read outside `ROUTES`, described in the schema under `keyRoutes`;
@@ -610,7 +652,7 @@
610
652
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
611
653
  * is where a breaking change goes, so the minor moves and the patch does not.
612
654
  */
613
- export declare const CONTRACT_VERSION: "0.30.0";
655
+ export declare const CONTRACT_VERSION: "1.0.0";
614
656
  /** The package's own name, so a consumer can name what it depends on. */
615
657
  export declare const packageName = "@percayso-community/cayso-contracts";
616
658
  /**
@@ -687,6 +729,17 @@ export { NOT_PROVISIONED } from './citizenship.js';
687
729
  * exception to keeping numbers in the canon PRD; no economic figure is here.
688
730
  */
689
731
  export { MAX_ASSERTION_LIFETIME_SECONDS, CLOCK_SKEW_TOLERANCE_SECONDS, MINIMUM_ASSERTION_USE_RETENTION_SECONDS, } from './assertion.js';
732
+ /**
733
+ * The request header BizID's authority assertion travels in, beside the identity
734
+ * assertion's `Authorization` (CAY-0100 §4). A value so a consumer and the service
735
+ * spell it from one place; the reasoning behind the name is on the constant.
736
+ */
737
+ export { AUTHORITY_ASSERTION_HEADER } from './authority.js';
738
+ /**
739
+ * Whether a value is a well-formed `AuthorityClaims.mandateVersion`: a JSON integer of at
740
+ * least 1, BizID's mandate version counter (CAY-0100 §5). The one check of the shape.
741
+ */
742
+ export { isMandateVersion } from './authority.js';
690
743
  /**
691
744
  * The assurance profile (CAY-0029): what each `VerificationMethod` asserts, which
692
745
  * methods each operation accepts, and the version a claim is minted under.
@@ -775,5 +828,6 @@ export type { StoreSignedStatement, MarketplaceOrderRequest, MarketplaceRefundRe
775
828
  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
829
  export type { PurchaseRequest, PurchaseAuthorised, PurchaseTerminal, PurchaseUnresolved, PurchaseRefused, PurchaseAuthorisationResponse, PurchaseFailureReason, PurchaseStatus, LivePurchaseStatus, TerminalPurchaseStatus, PurchaseCancelRefusalReason, PurchaseCancelled, PurchaseCancelRefused, PurchaseCancelResponse, PurchaseResult, } from './purchase.js';
777
830
  export type { VerificationMethod, VerificationStatus, SubjectPersonhood, AssertionClaims, AssertionHeader, AssertionEnvelope, ContractOperation, InternalOperation, ScopeKey, } from './assertion.js';
831
+ export type { AuthorityClaims, AuthorityEnvelope, AuthorityBindingRefusal } from './authority.js';
778
832
  export type { VerificationEvidence, EvidenceStatement, MethodDecision, MethodDecisions, AssuranceRequired, AssuranceNotRequired, OperationAssurance, AssuranceRefusalReason, AssuranceAssessment, } from './assurance.js';
779
833
  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 three operator reads an
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, Amendment 4), and nothing
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,48 @@
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
+ * `0.32.0` → `1.0.0` changes nothing but the version. Its content is exactly
104
+ * `0.32.0`'s, and a deployment of it keeps serving `0.32.0`, `0.31.0`, `0.30.0` and
105
+ * `0.29.0` as a declared transition from the `0.x` line, which the next major ends. The
106
+ * entries below are the `0.x` history; "breaking" in them is the package's sense,
107
+ * under which a minor below `1.0.0` was a breaking line.
108
+ *
109
+ * `0.31.0` → `0.32.0` publishes and serves a fourth operator read on the `./operator`
110
+ * entry point, the economy summary, under
111
+ * `read-economy-summary-as-operator` (CAY-0026 Amendment 5): whole-number counts of
112
+ * wallets, movements and purchases, and cent totals of what is minted, cancelled and
113
+ * held, with its closed not-configured body. Nothing in this barrel changed, so no
114
+ * closed table grew: `ROUTES`, `ContractOperation` and `CaysoApiErrorCode` are as
115
+ * `0.31.0` published them. It is additive in the package's sense and on the wire
116
+ * (CAY-0086).
117
+ *
118
+ * `0.30.0` → `0.31.0` publishes BizID's authority assertion (CAY-0100), and serves
119
+ * nothing new: {@link AuthorityClaims}, its {@link AuthorityEnvelope} under the identity
120
+ * assertion's own `AssertionHeader`, and the binding's closed
121
+ * {@link AuthorityBindingRefusal}, which `CaysoApiErrorCode` gains by reference;
122
+ * {@link AUTHORITY_ASSERTION_HEADER}, the header it travels in; {@link isMandateVersion},
123
+ * the one check that `mandateVersion` is a JSON integer of at least 1; the seam code
124
+ * `authority_issuer_not_configured`, which `CaysoApiErrorCode` gains as the authority
125
+ * issuer's closed door and no route emits yet (#417); an optional
126
+ * `auth_time` on {@link AssertionClaims}, which the verifier now admits as a
127
+ * non-negative integer and nothing reads; and an optional per-request authority
128
+ * assertion provider on the thin client's three Organisation operations,
129
+ * `provisionOrganisation`, `makeCommercialPayment` and `authorisePurchase`, sent only
130
+ * when the caller passes one. `organisationAuthority` and `mandateFor` stay, retired
131
+ * and removed by a later breaking step (#419). BREAKING in the package's sense
132
+ * because a closed union grew. Additive on the wire (CAY-0086): no route a `0.30.0`
133
+ * consumer calls changed or answers anything new, because no route reads the header
134
+ * or produces the new codes yet, and a credential a `0.30.0` issuer mints, which
135
+ * carries no `auth_time`, verifies exactly as before.
136
+ *
95
137
  * `0.29.0` → `0.30.0` publishes and SERVES Cayso's authorisation acknowledgement keys
96
138
  * (CAY-0093): {@link ACKNOWLEDGEMENT_KEYS_ROUTE}, `GET /api/acknowledgement-keys`, an
97
139
  * unauthenticated read outside `ROUTES`, described in the schema under `keyRoutes`;
@@ -626,7 +668,7 @@
626
668
  * have needed a breaking bump on their own. Under semver below `1.0.0` the minor
627
669
  * is where a breaking change goes, so the minor moves and the patch does not.
628
670
  */
629
- export const CONTRACT_VERSION = '0.30.0';
671
+ export const CONTRACT_VERSION = '1.0.0';
630
672
  /** The package's own name, so a consumer can name what it depends on. */
631
673
  export const packageName = '@percayso-community/cayso-contracts';
632
674
  /**
@@ -703,6 +745,17 @@ export { NOT_PROVISIONED } from './citizenship.js';
703
745
  * exception to keeping numbers in the canon PRD; no economic figure is here.
704
746
  */
705
747
  export { MAX_ASSERTION_LIFETIME_SECONDS, CLOCK_SKEW_TOLERANCE_SECONDS, MINIMUM_ASSERTION_USE_RETENTION_SECONDS, } from './assertion.js';
748
+ /**
749
+ * The request header BizID's authority assertion travels in, beside the identity
750
+ * assertion's `Authorization` (CAY-0100 §4). A value so a consumer and the service
751
+ * spell it from one place; the reasoning behind the name is on the constant.
752
+ */
753
+ export { AUTHORITY_ASSERTION_HEADER } from './authority.js';
754
+ /**
755
+ * Whether a value is a well-formed `AuthorityClaims.mandateVersion`: a JSON integer of at
756
+ * least 1, BizID's mandate version counter (CAY-0100 §5). The one check of the shape.
757
+ */
758
+ export { isMandateVersion } from './authority.js';
706
759
  /**
707
760
  * The assurance profile (CAY-0029): what each `VerificationMethod` asserts, which
708
761
  * methods each operation accepts, and the version a claim is minted under.
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * `@percayso-community/cayso-contracts/operator` — the operator READ surface, on its
3
- * own entry point: three reads and nothing else (CAY-0026, Amendment 4).
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 three reads only.** The operator surface is larger than this — the wallet
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
- * three routes and fails on any field the service sends that this file does not
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 three reads, by name. The paths and scopes are the service's own. */
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 three reads, by name. The paths and scopes are the service's own. */
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 = [
@@ -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 three reads on the
31
- * `./operator` entry point (CAY-0026, Amendment 4) — is described under its own
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, Amendment 4): the three reads on
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.30.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": {