@serve.zone/interfaces 32.80.0 → 32.82.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.
@@ -9,6 +9,7 @@ import * as certificateRequests from './certificate.js';
9
9
  import * as clusterRequests from './cluster.js';
10
10
  import * as clusterIngressRequests from './clusteringress.js';
11
11
  import * as configRequests from './config.js';
12
+ import * as controllerRequests from './controller.js';
12
13
  import * as coreMailRequests from './coremail.js';
13
14
  import * as coreMailAdminRequests from './coremail.admin.js';
14
15
  import * as corestoreRequests from './corestore.js';
@@ -41,6 +42,7 @@ import * as statusRequests from './status.js';
41
42
  import * as taskRequests from './task.js';
42
43
  import * as versionRequests from './version.js';
43
44
  import * as webPushRequests from './webpush.js';
45
+ import * as witnessRequests from './witness.js';
44
46
 
45
47
  export {
46
48
  adminRequests as admin,
@@ -52,6 +54,7 @@ export {
52
54
  clusterRequests as cluster,
53
55
  clusterIngressRequests as clusteringress,
54
56
  configRequests as config,
57
+ controllerRequests as controller,
55
58
  coreMailRequests as coremail,
56
59
  coreMailAdminRequests as coremailAdmin,
57
60
  corestoreRequests as corestore,
@@ -84,6 +87,7 @@ export {
84
87
  taskRequests as task,
85
88
  versionRequests as version,
86
89
  webPushRequests as webpush,
90
+ witnessRequests as witness,
87
91
  };
88
92
 
89
93
  export * from './inform.js';
@@ -0,0 +1,121 @@
1
+ import * as plugins from '../plugins.js';
2
+ import type {
3
+ ICompareAndSetWitnessRecordRequest,
4
+ IEnrollWitnessMemberRequest,
5
+ IGetWitnessRecordRequest,
6
+ IPairWitnessControllerRequest,
7
+ IWitnessHealth,
8
+ IWitnessRecord,
9
+ } from '../data/witness.js';
10
+
11
+ /*
12
+ * The witness (AGL-1195, Linus ruling 69 Q5, Q6). A controller site (Cloudly), the witness's only
13
+ * caller, sends `Cloudly_Witness` requests with TypedRequest over HTTPS to
14
+ * `data.witnessContract.typedRequestPath` below the witness's `https` origin. The witness refuses a
15
+ * request by one of `data.witnessRefusals`, in the gate order the `data` witness module states, as a
16
+ * `TypedResponseError` whose `errorData` is `data.IWitnessRefusalErrorData`
17
+ * (`data.readWitnessRefusalErrorData`). Every request but `getWitnessHealth` carries a bearer or a
18
+ * pairing code: exclude them from logs. No answer carries a bearer: each site creates its own and
19
+ * the witness learns only its SHA-256.
20
+ */
21
+
22
+ /**
23
+ * A controller pairs with the witness: it redeems the one-time code the witness's operator made on
24
+ * the witness host for this controller id, with the SHA-256 of the bearer it created for itself.
25
+ * In one atomic write the witness consumes the code and creates the record (`revision` 1, the
26
+ * caller's origin as the active site and only member, no in-sync standby, `bearerSha256` as that
27
+ * member's hash); it answers the record.
28
+ *
29
+ * A caller whose answer was lost reads the record with its own bearer (`getWitnessRecord`): the
30
+ * record answers when the pairing was stored, and `credential-invalid` when it was not, so the code
31
+ * was not consumed and the caller pairs again with it.
32
+ *
33
+ * Refused `pairing-code-unknown`, `pairing-code-expired` or `pairing-code-used` for the code, then,
34
+ * with the code left unconsumed, `controller-mismatch` for a code made for another controller id
35
+ * and `controller-paired` when the witness holds a record for the controller already.
36
+ */
37
+ export interface IReq_Cloudly_Witness_PairWitnessController extends plugins.typedrequestInterfaces.implementsTR<
38
+ plugins.typedrequestInterfaces.ITypedRequest,
39
+ IReq_Cloudly_Witness_PairWitnessController
40
+ > {
41
+ method: 'pairWitnessController';
42
+ /** `data.validatePairWitnessControllerRequest`. */
43
+ request: IPairWitnessControllerRequest;
44
+ response: {
45
+ /** `data.validateWitnessRecord`. */
46
+ record: IWitnessRecord;
47
+ };
48
+ }
49
+
50
+ /**
51
+ * The active site enrolls another site with the SHA-256 of the bearer that site created for itself
52
+ * and handed it, never the bearer: a new member (`member-limit` once the record holds
53
+ * `data.witnessContract.maximumMemberOrigins`), or an existing one whose bearer hash is replaced,
54
+ * never the recorded in-sync standby (`transition-invalid`; the active drops it by compare-and-set
55
+ * first). A compare-and-set on `expectedRevision` that raises the revision by one and leaves the
56
+ * state as it is (`data.judgeWitnessMemberEnrollment`). The answer is the record as stored.
57
+ */
58
+ export interface IReq_Cloudly_Witness_EnrollWitnessMember extends plugins.typedrequestInterfaces.implementsTR<
59
+ plugins.typedrequestInterfaces.ITypedRequest,
60
+ IReq_Cloudly_Witness_EnrollWitnessMember
61
+ > {
62
+ method: 'enrollWitnessMember';
63
+ /** `data.validateEnrollWitnessMemberRequest`. */
64
+ request: IEnrollWitnessMemberRequest;
65
+ response: {
66
+ /** `data.validateWitnessRecord`. */
67
+ record: IWitnessRecord;
68
+ };
69
+ }
70
+
71
+ /** A member site reads the controller's witness record. */
72
+ export interface IReq_Cloudly_Witness_GetWitnessRecord extends plugins.typedrequestInterfaces.implementsTR<
73
+ plugins.typedrequestInterfaces.ITypedRequest,
74
+ IReq_Cloudly_Witness_GetWitnessRecord
75
+ > {
76
+ method: 'getWitnessRecord';
77
+ /** `data.validateGetWitnessRecordRequest`. */
78
+ request: IGetWitnessRecordRequest;
79
+ response: {
80
+ /** `data.validateWitnessRecord`. */
81
+ record: IWitnessRecord;
82
+ };
83
+ }
84
+
85
+ /**
86
+ * A member site changes the record's state: the active drops its standby or records it in sync
87
+ * again, the in-sync standby promotes itself, or the active raises the epoch after a restore
88
+ * (`data.judgeWitnessChange`). The change is stored only while the stored revision is
89
+ * `expectedRevision`, and raises it by one; of two changes naming one revision at most one is
90
+ * stored and the other is refused `revision-stale`. The answer is the record as stored.
91
+ *
92
+ * A controller acts on a change only once this answer arrived. A change refused `outcome-unknown`,
93
+ * or whose answer never arrived, may have been stored: the caller reads the record first.
94
+ */
95
+ export interface IReq_Cloudly_Witness_CompareAndSetWitnessRecord extends plugins.typedrequestInterfaces.implementsTR<
96
+ plugins.typedrequestInterfaces.ITypedRequest,
97
+ IReq_Cloudly_Witness_CompareAndSetWitnessRecord
98
+ > {
99
+ method: 'compareAndSetWitnessRecord';
100
+ /** `data.validateCompareAndSetWitnessRecordRequest`. */
101
+ request: ICompareAndSetWitnessRecordRequest;
102
+ response: {
103
+ /** `data.validateWitnessRecord`. */
104
+ record: IWitnessRecord;
105
+ };
106
+ }
107
+
108
+ /**
109
+ * Whether the witness can serve, and which releases it runs. Unauthenticated, and it names no
110
+ * controller. A controller records `witnessVersion` with the takeover-path components and gates a
111
+ * later witness contract member on `interfacesVersion`.
112
+ */
113
+ export interface IReq_Cloudly_Witness_GetWitnessHealth extends plugins.typedrequestInterfaces.implementsTR<
114
+ plugins.typedrequestInterfaces.ITypedRequest,
115
+ IReq_Cloudly_Witness_GetWitnessHealth
116
+ > {
117
+ method: 'getWitnessHealth';
118
+ request: {};
119
+ /** `data.validateWitnessHealth`. */
120
+ response: IWitnessHealth;
121
+ }