@serve.zone/interfaces 32.79.0 → 32.81.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/changelog.md +16 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/data/deploymentoperation.d.ts +17 -0
- package/dist_ts/data/deploymentoperation.js +12 -1
- package/dist_ts/data/index.d.ts +1 -0
- package/dist_ts/data/index.js +2 -1
- package/dist_ts/data/witness.d.ts +217 -0
- package/dist_ts/data/witness.js +407 -0
- package/dist_ts/requests/index.d.ts +2 -1
- package/dist_ts/requests/index.js +3 -2
- package/dist_ts/requests/witness.d.ts +83 -0
- package/dist_ts/requests/witness.js +2 -0
- package/package.json +1 -1
- package/readme.md +82 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/data/deploymentoperation.ts +28 -0
- package/ts/data/index.ts +1 -0
- package/ts/data/witness.ts +606 -0
- package/ts/requests/index.ts +2 -0
- package/ts/requests/witness.ts +121 -0
|
@@ -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
|
+
}
|