@metacensus/api 0.2.0 → 0.3.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 +102 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/public.d.ts.map +1 -1
- package/dist/public.js +2 -2
- package/dist/public.js.map +1 -1
- package/dist/src/client.d.ts +49 -37
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +138 -79
- package/dist/src/client.js.map +1 -1
- package/dist/src/metacensus/v1/auth.d.ts +2 -2
- package/dist/src/metacensus/v1/auth.d.ts.map +1 -1
- package/dist/src/metacensus/v1/common.d.ts +34 -3
- package/dist/src/metacensus/v1/common.d.ts.map +1 -1
- package/dist/src/metacensus/v1/prop.d.ts +26 -16
- package/dist/src/metacensus/v1/prop.d.ts.map +1 -1
- package/dist/src/metacensus/v1/prop.js +18 -18
- package/dist/src/metacensus/v1/prop.js.map +1 -1
- package/dist/src/metacensus/v1/topic.d.ts +11 -6
- package/dist/src/metacensus/v1/topic.d.ts.map +1 -1
- package/dist/src/metacensus/v1/user.d.ts +9 -4
- package/dist/src/metacensus/v1/user.d.ts.map +1 -1
- package/dist/src/route-manifest.js +7 -7
- package/dist/src/route-manifest.js.map +1 -1
- package/dist/src/signing.d.ts.map +1 -1
- package/dist/src/signing.js +7 -12
- package/dist/src/signing.js.map +1 -1
- package/package.json +4 -4
package/dist/src/client.js
CHANGED
|
@@ -1,146 +1,205 @@
|
|
|
1
1
|
// Code generated by routegen. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// The same literal as route-manifest.ts's publicPrefix, re-emitted rather than
|
|
6
|
-
// imported, since a value import under src/ is forbidden (check-no-runtime.mjs).
|
|
7
|
-
const publicPrefixDefault = "/metacensus/public";
|
|
8
|
-
function param(v) {
|
|
9
|
-
return encodeURIComponent(String(v));
|
|
10
|
-
}
|
|
11
|
-
// ApiError is any non-2xx the transport did not act on itself. body is the
|
|
12
|
-
// response text, unparsed: a 404 or 405 comes from the router, not a handler, so
|
|
13
|
-
// parse it defensively rather than assuming JSON.
|
|
2
|
+
import { apiPrefix, publicPrefix } from "./route-manifest.js";
|
|
3
|
+
// ApiError is any non-2xx response. body is the response text, unparsed: a 404
|
|
4
|
+
// or 405 comes from the router, not a handler, so parse it defensively.
|
|
14
5
|
export class ApiError extends Error {
|
|
15
6
|
method;
|
|
16
|
-
|
|
7
|
+
url;
|
|
17
8
|
status;
|
|
18
9
|
body;
|
|
19
|
-
constructor(method,
|
|
20
|
-
super(`${method} ${
|
|
10
|
+
constructor(method, url, status, body) {
|
|
11
|
+
super(`${method} ${url}: HTTP ${status}`);
|
|
21
12
|
this.method = method;
|
|
22
|
-
this.
|
|
13
|
+
this.url = url;
|
|
23
14
|
this.status = status;
|
|
24
15
|
this.body = body;
|
|
25
16
|
this.name = "ApiError";
|
|
26
17
|
}
|
|
27
18
|
}
|
|
28
|
-
|
|
19
|
+
function param(v) {
|
|
20
|
+
return encodeURIComponent(String(v));
|
|
21
|
+
}
|
|
22
|
+
async function request(f, url, method, body, token) {
|
|
23
|
+
const headers = {};
|
|
24
|
+
if (body !== undefined)
|
|
25
|
+
headers["Content-Type"] = "application/json";
|
|
26
|
+
if (token !== undefined)
|
|
27
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
28
|
+
const res = await f(url, { method, headers, body });
|
|
29
|
+
if (res.status < 200 || res.status >= 300) {
|
|
30
|
+
throw new ApiError(method, url, res.status, await res.text());
|
|
31
|
+
}
|
|
32
|
+
const text = await res.text();
|
|
33
|
+
return (text === "" ? {} : JSON.parse(text));
|
|
34
|
+
}
|
|
35
|
+
function flattenProp(r) {
|
|
36
|
+
return { id: r.id, recorded: r.recorded, ...r.content };
|
|
37
|
+
}
|
|
38
|
+
function flattenTopic(r) {
|
|
39
|
+
return { id: r.id, recorded: r.recorded, ...r.content };
|
|
40
|
+
}
|
|
41
|
+
function flattenUser(r) {
|
|
42
|
+
return { id: r.id, recorded: r.recorded, ...r.content };
|
|
43
|
+
}
|
|
44
|
+
function flattenVote(r) {
|
|
45
|
+
return { recorded: r.recorded, ...r.content };
|
|
46
|
+
}
|
|
47
|
+
// Client calls the authenticated API.
|
|
29
48
|
export class Client {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
#baseUrl;
|
|
50
|
+
#fetch;
|
|
51
|
+
#prefix;
|
|
52
|
+
#signer;
|
|
53
|
+
#token;
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.#baseUrl = options.baseUrl;
|
|
56
|
+
this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
57
|
+
this.#prefix = options.prefix ?? apiPrefix;
|
|
58
|
+
this.#signer = options.signer;
|
|
59
|
+
this.#token = options.token;
|
|
60
|
+
}
|
|
61
|
+
// The session token from the last login/signUp, for persisting a session.
|
|
62
|
+
get token() {
|
|
63
|
+
return this.#token;
|
|
64
|
+
}
|
|
65
|
+
#request(method, path, body) {
|
|
66
|
+
return request(this.#fetch, this.#baseUrl + this.#prefix + path, method, body, this.#token);
|
|
67
|
+
}
|
|
68
|
+
#sign(content, contentType) {
|
|
69
|
+
if (this.#signer === undefined) {
|
|
70
|
+
throw new Error("Client: a write needs a signer; construct new Client({ ..., signer })");
|
|
43
71
|
}
|
|
44
|
-
|
|
45
|
-
return (res.body === "" ? {} : JSON.parse(res.body));
|
|
72
|
+
return this.#signer(content, contentType);
|
|
46
73
|
}
|
|
47
74
|
// AuthRoutes.Login: POST /login
|
|
48
|
-
login(req) {
|
|
49
|
-
const
|
|
50
|
-
|
|
75
|
+
async login(req) {
|
|
76
|
+
const session = await this.#request("POST", "/login", JSON.stringify(req));
|
|
77
|
+
this.#token = session.token;
|
|
78
|
+
return session;
|
|
51
79
|
}
|
|
52
80
|
// AuthRoutes.SignUp: POST /signup
|
|
53
|
-
signUp(req) {
|
|
54
|
-
const
|
|
55
|
-
|
|
81
|
+
async signUp(req) {
|
|
82
|
+
const userSignature = await this.#sign(req.content, "metacensus.v1.User");
|
|
83
|
+
const session = await this.#request("POST", "/signup", JSON.stringify({ ...req, userSignature }));
|
|
84
|
+
this.#token = session.token;
|
|
85
|
+
return session;
|
|
56
86
|
}
|
|
57
87
|
// AuthRoutes.Logout: POST /logout
|
|
58
|
-
logout(req) {
|
|
59
|
-
|
|
88
|
+
async logout(req) {
|
|
89
|
+
const res = await this.#request("POST", "/logout", undefined);
|
|
90
|
+
this.#token = undefined;
|
|
91
|
+
return res;
|
|
60
92
|
}
|
|
61
93
|
// HealthRoutes.Healthcheck: GET /healthcheck
|
|
62
94
|
healthcheck(req) {
|
|
63
|
-
return this
|
|
95
|
+
return this.#request("GET", "/healthcheck", undefined);
|
|
64
96
|
}
|
|
65
97
|
// PropRoutes.ListProps: GET /topic/{topicId}/prop
|
|
66
98
|
listProps(req) {
|
|
67
|
-
return this
|
|
99
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop`, undefined).then((r) => r.items.map(flattenProp));
|
|
100
|
+
}
|
|
101
|
+
// PropRoutes.ListProps: GET /topic/{topicId}/prop
|
|
102
|
+
listPropsSigned(req) {
|
|
103
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop`, undefined).then((r) => r.items);
|
|
68
104
|
}
|
|
69
105
|
// PropRoutes.GetProp: GET /topic/{topicId}/prop/{propId}
|
|
70
106
|
getProp(req) {
|
|
71
|
-
return this
|
|
107
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}`, undefined).then(flattenProp);
|
|
108
|
+
}
|
|
109
|
+
// PropRoutes.GetProp: GET /topic/{topicId}/prop/{propId}
|
|
110
|
+
getPropSigned(req) {
|
|
111
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}`, undefined);
|
|
72
112
|
}
|
|
73
113
|
// PropRoutes.CreateProp: POST /topic/{topicId}/prop
|
|
74
|
-
createProp(req) {
|
|
75
|
-
const { topicId, ...
|
|
76
|
-
|
|
114
|
+
async createProp(req) {
|
|
115
|
+
const { topicId, ...rest } = req;
|
|
116
|
+
const userSignature = await this.#sign(rest.content, "metacensus.v1.Prop");
|
|
117
|
+
return flattenProp(await this.#request("POST", `/topic/${param(topicId)}/prop`, JSON.stringify({ ...rest, userSignature })));
|
|
77
118
|
}
|
|
78
119
|
// PropRoutes.ListVotes: GET /topic/{topicId}/prop/{propId}/vote
|
|
79
120
|
listVotes(req) {
|
|
80
|
-
return this
|
|
121
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}/vote`, undefined).then((r) => r.items.map(flattenVote));
|
|
122
|
+
}
|
|
123
|
+
// PropRoutes.ListVotes: GET /topic/{topicId}/prop/{propId}/vote
|
|
124
|
+
listVotesSigned(req) {
|
|
125
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}/vote`, undefined).then((r) => r.items);
|
|
81
126
|
}
|
|
82
127
|
// PropRoutes.SetVote: POST /topic/{topicId}/prop/{propId}/vote
|
|
83
|
-
setVote(req) {
|
|
84
|
-
const { topicId, propId, ...
|
|
85
|
-
|
|
128
|
+
async setVote(req) {
|
|
129
|
+
const { topicId, propId, ...rest } = req;
|
|
130
|
+
const userSignature = await this.#sign(rest.content, "metacensus.v1.Vote");
|
|
131
|
+
return flattenVote(await this.#request("POST", `/topic/${param(topicId)}/prop/${param(propId)}/vote`, JSON.stringify({ ...rest, userSignature })));
|
|
86
132
|
}
|
|
87
133
|
// TopicRoutes.ListTopics: GET /topic
|
|
88
134
|
listTopics(req) {
|
|
89
|
-
return this
|
|
135
|
+
return this.#request("GET", "/topic", undefined).then((r) => r.items.map(flattenTopic));
|
|
136
|
+
}
|
|
137
|
+
// TopicRoutes.ListTopics: GET /topic
|
|
138
|
+
listTopicsSigned(req) {
|
|
139
|
+
return this.#request("GET", "/topic", undefined).then((r) => r.items);
|
|
90
140
|
}
|
|
91
141
|
// TopicRoutes.GetTopic: GET /topic/{topicId}
|
|
92
142
|
getTopic(req) {
|
|
93
|
-
return this
|
|
143
|
+
return this.#request("GET", `/topic/${param(req.topicId)}`, undefined).then(flattenTopic);
|
|
144
|
+
}
|
|
145
|
+
// TopicRoutes.GetTopic: GET /topic/{topicId}
|
|
146
|
+
getTopicSigned(req) {
|
|
147
|
+
return this.#request("GET", `/topic/${param(req.topicId)}`, undefined);
|
|
94
148
|
}
|
|
95
149
|
// TopicRoutes.CreateTopic: POST /topic
|
|
96
|
-
createTopic(req) {
|
|
97
|
-
const
|
|
98
|
-
return this
|
|
150
|
+
async createTopic(req) {
|
|
151
|
+
const userSignature = await this.#sign(req.content, "metacensus.v1.Topic");
|
|
152
|
+
return flattenTopic(await this.#request("POST", "/topic", JSON.stringify({ ...req, userSignature })));
|
|
99
153
|
}
|
|
100
154
|
// TopicRoutes.ListMembers: GET /topic/{topicId}/member
|
|
101
155
|
listMembers(req) {
|
|
102
|
-
return this
|
|
156
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/member`, undefined).then((r) => r.items);
|
|
103
157
|
}
|
|
104
158
|
// TopicRoutes.GetMember: GET /topic/{topicId}/member/{userId}
|
|
105
159
|
getMember(req) {
|
|
106
|
-
return this
|
|
160
|
+
return this.#request("GET", `/topic/${param(req.topicId)}/member/${param(req.userId)}`, undefined);
|
|
107
161
|
}
|
|
108
162
|
// UserRoutes.ListUsers: GET /user
|
|
109
163
|
listUsers(req) {
|
|
110
|
-
return this
|
|
164
|
+
return this.#request("GET", "/user", undefined).then((r) => r.items.map(flattenUser));
|
|
165
|
+
}
|
|
166
|
+
// UserRoutes.ListUsers: GET /user
|
|
167
|
+
listUsersSigned(req) {
|
|
168
|
+
return this.#request("GET", "/user", undefined).then((r) => r.items);
|
|
111
169
|
}
|
|
112
170
|
// UserRoutes.GetUser: GET /user/{userId}
|
|
113
171
|
getUser(req) {
|
|
114
|
-
return this
|
|
172
|
+
return this.#request("GET", `/user/${param(req.userId)}`, undefined).then(flattenUser);
|
|
173
|
+
}
|
|
174
|
+
// UserRoutes.GetUser: GET /user/{userId}
|
|
175
|
+
getUserSigned(req) {
|
|
176
|
+
return this.#request("GET", `/user/${param(req.userId)}`, undefined);
|
|
115
177
|
}
|
|
116
178
|
// UserRoutes.GetSelf: GET /self
|
|
117
179
|
getSelf(req) {
|
|
118
|
-
return this
|
|
180
|
+
return this.#request("GET", "/self", undefined).then(flattenUser);
|
|
181
|
+
}
|
|
182
|
+
// UserRoutes.GetSelf: GET /self
|
|
183
|
+
getSelfSigned(req) {
|
|
184
|
+
return this.#request("GET", "/self", undefined);
|
|
119
185
|
}
|
|
120
186
|
}
|
|
121
|
-
// PublicClient calls the public, unauthenticated surface
|
|
187
|
+
// PublicClient calls the public, unauthenticated surface.
|
|
122
188
|
export class PublicClient {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this
|
|
129
|
-
this
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const res = await this.transport({ method, path: full, body });
|
|
134
|
-
if (res.status < 200 || res.status >= 300) {
|
|
135
|
-
throw new ApiError(method, full, res.status, res.body);
|
|
136
|
-
}
|
|
137
|
-
// A cast: no runtime schema to validate against.
|
|
138
|
-
return (res.body === "" ? {} : JSON.parse(res.body));
|
|
189
|
+
#baseUrl;
|
|
190
|
+
#fetch;
|
|
191
|
+
#prefix;
|
|
192
|
+
constructor(options) {
|
|
193
|
+
this.#baseUrl = options.baseUrl;
|
|
194
|
+
this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
195
|
+
this.#prefix = options.prefix ?? publicPrefix;
|
|
196
|
+
}
|
|
197
|
+
#request(method, path, body) {
|
|
198
|
+
return request(this.#fetch, this.#baseUrl + this.#prefix + path, method, body, undefined);
|
|
139
199
|
}
|
|
140
200
|
// PartnerRoutes.SubmitPartnerInterest: POST /partner
|
|
141
201
|
submitPartnerInterest(req) {
|
|
142
|
-
|
|
143
|
-
return this.call("POST", "/partner", JSON.stringify(body));
|
|
202
|
+
return this.#request("POST", "/partner", JSON.stringify(req));
|
|
144
203
|
}
|
|
145
204
|
}
|
|
146
205
|
//# sourceMappingURL=client.js.map
|
package/dist/src/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,2CAA2C;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAW3C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE9D,+EAA+E;AAC/E,wEAAwE;AACxE,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEtB,MAAM;IACN,GAAG;IACH,MAAM;IACN,IAAI;IAJf,YACW,MAAc,EACd,GAAW,EACX,MAAc,EACd,IAAY;QAErB,KAAK,CAAC,GAAG,MAAM,IAAI,GAAG,UAAU,MAAM,EAAE,CAAC,CAAC;sBALjC,MAAM;mBACN,GAAG;sBACH,MAAM;oBACN,IAAI;QAGb,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAMD,SAAS,KAAK,CAAC,CAA4B;IACzC,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,CAA0B,EAC1B,GAAW,EACX,MAAc,EACd,IAAwB,EACxB,KAAyB;IAEzB,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;IACrE,IA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O,CAAS;IAEzB,YAAY,OAA4B;QACtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC;IAChD,CAAC;IAED,QAAQ,CAAI,MAAc,EAAE,IAAY,EAAE,IAAa;QACrD,OAAO,OAAO,CAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/F,CAAC;IAED,qDAAqD;IACrD,qBAAqB,CAAC,GAAsB;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAiB,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { User, UserSignature } from "./common.js";
|
|
2
2
|
export declare const protobufPackage = "metacensus.v1";
|
|
3
3
|
/** Sign-up, login and logout. */
|
|
4
4
|
export interface LoginRequest {
|
|
@@ -12,7 +12,7 @@ export interface LoginRequest {
|
|
|
12
12
|
* matching private key at enrollment.
|
|
13
13
|
*/
|
|
14
14
|
export interface SignUpRequest {
|
|
15
|
-
content?:
|
|
15
|
+
content?: User | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Deliberately outside `content`: a password must never be inside a
|
|
18
18
|
* signed, stored document.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,iCAAiC;AAEjC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EACJ,IAAI,GACJ,SAAS,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,OAAO;IACtB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;CAC7B;AAED,MAAM,WAAW,cAAc;CAC9B"}
|
|
@@ -40,7 +40,7 @@ export interface UserSignature {
|
|
|
40
40
|
spec: string;
|
|
41
41
|
/**
|
|
42
42
|
* Full proto name of the message `content` holds, e.g.
|
|
43
|
-
* "metacensus.v1.
|
|
43
|
+
* "metacensus.v1.Prop". Stops a signature over one type being
|
|
44
44
|
* replayed as another.
|
|
45
45
|
*/
|
|
46
46
|
contentType: string;
|
|
@@ -56,11 +56,42 @@ export declare enum UserSignature_Alg {
|
|
|
56
56
|
/** Es384 - JOSE fixed-width r||s, never DER. */
|
|
57
57
|
Es384 = "Es384"
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* An institution's countersignature over a UserSignature.value — it endorses
|
|
61
|
+
* the author (enrolled and in good standing when the record was written), not
|
|
62
|
+
* the content. Server-minted and outside the user's signature, so it rides on
|
|
63
|
+
* the stored envelope and never inside signed content. Computing and checking
|
|
64
|
+
* it is the store's, below the persistence seam; this contract only carries
|
|
65
|
+
* the shape so a later runtime needs no wire break. See README.md.
|
|
66
|
+
*/
|
|
67
|
+
export interface InstitutionalSignature {
|
|
68
|
+
/** The institution that countersigned. */
|
|
69
|
+
signerId: string;
|
|
70
|
+
/**
|
|
71
|
+
* base64url SHA-256 of the institution key's SPKI DER, resolved against the
|
|
72
|
+
* institution's key history the way a user's key_id is.
|
|
73
|
+
*/
|
|
74
|
+
keyId: string;
|
|
75
|
+
/** Reuses UserSignature's closed algorithm vocabulary. */
|
|
76
|
+
alg: UserSignature_Alg;
|
|
77
|
+
/**
|
|
78
|
+
* The server's observation of when it countersigned; the institution makes
|
|
79
|
+
* no separately-claimed time.
|
|
80
|
+
*/
|
|
81
|
+
recorded?: string | undefined;
|
|
82
|
+
/** Versions the countersignature scheme, independently of UserSignature.spec. */
|
|
83
|
+
spec: string;
|
|
84
|
+
/**
|
|
85
|
+
* base64url r||s over the countersigned UserSignature.value. Emptied from
|
|
86
|
+
* its own digest by the same rule as UserSignature.value.
|
|
87
|
+
*/
|
|
88
|
+
value: string;
|
|
89
|
+
}
|
|
59
90
|
/**
|
|
60
91
|
* The part of a user record its owner signs. Lives here, not user.proto,
|
|
61
|
-
* because auth.proto's SignUpRequest and user.proto's
|
|
92
|
+
* because auth.proto's SignUpRequest and user.proto's UserSigned both need it.
|
|
62
93
|
*/
|
|
63
|
-
export interface
|
|
94
|
+
export interface User {
|
|
64
95
|
name: string;
|
|
65
96
|
email: string;
|
|
66
97
|
country: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,oBAAoB;AAEpB,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,iBAAiB,CAAC;IACvB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EACR,MAAM,GACN,SAAS,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,WAAW,gBAAgB;IAC3B,gDAAgD;IAChD,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,oBAAoB;AAEpB,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,iBAAiB,CAAC;IACvB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EACR,MAAM,GACN,SAAS,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,WAAW,gBAAgB;IAC3B,gDAAgD;IAChD,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,GAAG,EAAE,iBAAiB,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EACL,MAAM,GACN,SAAS,CAAC;IACd,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserSignature } from "./common.js";
|
|
1
|
+
import type { InstitutionalSignature, UserSignature } from "./common.js";
|
|
2
2
|
export declare const protobufPackage = "metacensus.v1";
|
|
3
3
|
/** Propositions and votes: the consensus mechanism. */
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ export declare const protobufPackage = "metacensus.v1";
|
|
|
6
6
|
* `created` were removed: they're `user_signature.signer_id` and
|
|
7
7
|
* `.signing_time` now.
|
|
8
8
|
*/
|
|
9
|
-
export interface
|
|
9
|
+
export interface PropSigned {
|
|
10
10
|
/** Minted by the server, outside the signature. */
|
|
11
11
|
id: string;
|
|
12
12
|
/**
|
|
@@ -14,21 +14,26 @@ export interface Prop {
|
|
|
14
14
|
* claim.
|
|
15
15
|
*/
|
|
16
16
|
recorded?: string | undefined;
|
|
17
|
-
content?:
|
|
17
|
+
content?: Prop | undefined;
|
|
18
18
|
userSignature?: UserSignature | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The institution's countersignature over user_signature.value; see
|
|
21
|
+
* UserSigned.
|
|
22
|
+
*/
|
|
23
|
+
institutionalSignature?: InstitutionalSignature | undefined;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* What a prop's author signs; carries `topic_id` but not the prop's own
|
|
22
27
|
* server-minted id.
|
|
23
28
|
*/
|
|
24
|
-
export interface
|
|
29
|
+
export interface Prop {
|
|
25
30
|
topicId: string;
|
|
26
|
-
type:
|
|
27
|
-
/** The text `
|
|
31
|
+
type: Prop_Type;
|
|
32
|
+
/** The text `Vote.citations` indexes into. */
|
|
28
33
|
description: string;
|
|
29
34
|
}
|
|
30
35
|
/** What the proposition would do if it passed. */
|
|
31
|
-
export declare enum
|
|
36
|
+
export declare enum Prop_Type {
|
|
32
37
|
Unspecified = "Unspecified",
|
|
33
38
|
Statement = "Statement",
|
|
34
39
|
TopicQuestion = "TopicQuestion",
|
|
@@ -42,25 +47,30 @@ export declare enum PropContent_Type {
|
|
|
42
47
|
* One member's position on one prop, keyed by `(propId, userId)`; a second
|
|
43
48
|
* vote from the same user replaces the first rather than adding to it.
|
|
44
49
|
*/
|
|
45
|
-
export interface
|
|
50
|
+
export interface VoteSigned {
|
|
46
51
|
/**
|
|
47
52
|
* Server's observation, and the only ordering a reader may use —
|
|
48
53
|
* `user_signature.signing_time` is the voter's own claim.
|
|
49
54
|
*/
|
|
50
55
|
recorded?: string | undefined;
|
|
51
|
-
content?:
|
|
56
|
+
content?: Vote | undefined;
|
|
52
57
|
userSignature?: UserSignature | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The institution's countersignature over user_signature.value; see
|
|
60
|
+
* UserSigned. VoteSigned mints no id, so this is 4, not 5.
|
|
61
|
+
*/
|
|
62
|
+
institutionalSignature?: InstitutionalSignature | undefined;
|
|
53
63
|
}
|
|
54
64
|
/**
|
|
55
65
|
* What a voter signs. `user_id` duplicates `user_signature.signer_id` by
|
|
56
66
|
* design; persistence owes refusing the two when they disagree (see
|
|
57
67
|
* README.md, "Open questions").
|
|
58
68
|
*/
|
|
59
|
-
export interface
|
|
69
|
+
export interface Vote {
|
|
60
70
|
topicId: string;
|
|
61
71
|
propId: string;
|
|
62
72
|
userId: string;
|
|
63
|
-
position:
|
|
73
|
+
position: Vote_Position;
|
|
64
74
|
explanation: string;
|
|
65
75
|
/**
|
|
66
76
|
* Highlighted spans of the prop's `description`; meaningful only for
|
|
@@ -68,7 +78,7 @@ export interface VoteContent {
|
|
|
68
78
|
*/
|
|
69
79
|
citations: PropCitation[];
|
|
70
80
|
}
|
|
71
|
-
export declare enum
|
|
81
|
+
export declare enum Vote_Position {
|
|
72
82
|
Unspecified = "Unspecified",
|
|
73
83
|
For = "For",
|
|
74
84
|
Against = "Against",
|
|
@@ -83,7 +93,7 @@ export interface PropListRequest {
|
|
|
83
93
|
topicId: string;
|
|
84
94
|
}
|
|
85
95
|
export interface PropList {
|
|
86
|
-
items:
|
|
96
|
+
items: PropSigned[];
|
|
87
97
|
}
|
|
88
98
|
export interface PropGetRequest {
|
|
89
99
|
topicId: string;
|
|
@@ -95,7 +105,7 @@ export interface PropGetRequest {
|
|
|
95
105
|
*/
|
|
96
106
|
export interface PropCreateRequest {
|
|
97
107
|
topicId: string;
|
|
98
|
-
content?:
|
|
108
|
+
content?: Prop | undefined;
|
|
99
109
|
userSignature?: UserSignature | undefined;
|
|
100
110
|
}
|
|
101
111
|
export interface VoteListRequest {
|
|
@@ -104,7 +114,7 @@ export interface VoteListRequest {
|
|
|
104
114
|
}
|
|
105
115
|
/** The only way to read a prop's votes. */
|
|
106
116
|
export interface VoteList {
|
|
107
|
-
items:
|
|
117
|
+
items: VoteSigned[];
|
|
108
118
|
}
|
|
109
119
|
/**
|
|
110
120
|
* Replaces the caller's previous vote rather than creating a new one; both
|
|
@@ -113,7 +123,7 @@ export interface VoteList {
|
|
|
113
123
|
export interface VoteSetRequest {
|
|
114
124
|
topicId: string;
|
|
115
125
|
propId: string;
|
|
116
|
-
content?:
|
|
126
|
+
content?: Vote | undefined;
|
|
117
127
|
userSignature?: UserSignature | undefined;
|
|
118
128
|
}
|
|
119
129
|
//# sourceMappingURL=prop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/prop.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prop.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/prop.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,uDAAuD;AAEvD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,aAAa,CAAC,EACV,aAAa,GACb,SAAS,CAAC;IACd;;;OAGG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,kDAAkD;AAClD,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,uBAAuB,4BAA4B;IACnD,wBAAwB,6BAA6B;CACtD;AAED;;;GAGG;AACH,MA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AAU,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C"}
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
// source: metacensus/v1/prop.proto
|
|
6
6
|
export const protobufPackage = "metacensus.v1";
|
|
7
7
|
/** What the proposition would do if it passed. */
|
|
8
|
-
export var
|
|
9
|
-
(function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})(
|
|
19
|
-
export var
|
|
20
|
-
(function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})(
|
|
8
|
+
export var Prop_Type;
|
|
9
|
+
(function (Prop_Type) {
|
|
10
|
+
Prop_Type["Unspecified"] = "Unspecified";
|
|
11
|
+
Prop_Type["Statement"] = "Statement";
|
|
12
|
+
Prop_Type["TopicQuestion"] = "TopicQuestion";
|
|
13
|
+
Prop_Type["TopicChange"] = "TopicChange";
|
|
14
|
+
Prop_Type["UserAdmit"] = "UserAdmit";
|
|
15
|
+
Prop_Type["UserExpulse"] = "UserExpulse";
|
|
16
|
+
Prop_Type["PaperExtractionComplete"] = "PaperExtractionComplete";
|
|
17
|
+
Prop_Type["PaperIncludeMetaAnalysis"] = "PaperIncludeMetaAnalysis";
|
|
18
|
+
})(Prop_Type || (Prop_Type = {}));
|
|
19
|
+
export var Vote_Position;
|
|
20
|
+
(function (Vote_Position) {
|
|
21
|
+
Vote_Position["Unspecified"] = "Unspecified";
|
|
22
|
+
Vote_Position["For"] = "For";
|
|
23
|
+
Vote_Position["Against"] = "Against";
|
|
24
|
+
Vote_Position["Abstain"] = "Abstain";
|
|
25
|
+
})(Vote_Position || (Vote_Position = {}));
|
|
26
26
|
//# sourceMappingURL=prop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/prop.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,mCAAmC;AAKnC,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"prop.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/prop.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,mCAAmC;AAKnC,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAuC/C,kDAAkD;AAClD,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,wCAA2B,CAAA;IAC3B,oCAAuB,CAAA;IACvB,wCAA2B,CAAA;IAC3B,gEAAmD,CAAA;IACnD,kEAAqD,CAAA;AACvD,CAAC,EATW,SAAS,KAAT,SAAS,QASpB;AAyCD,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,4CAA2B,CAAA;IAC3B,4BAAW,CAAA;IACX,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACrB,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB"}
|