@metacensus/api 0.0.0 → 0.2.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 +121 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/public.d.ts +6 -0
- package/dist/public.d.ts.map +1 -0
- package/dist/public.js +14 -0
- package/dist/public.js.map +1 -0
- package/dist/signing.d.ts +2 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +5 -0
- package/dist/signing.js.map +1 -0
- package/dist/src/client.d.ts +54 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +146 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/metacensus/public/v1/common.d.ts +20 -0
- package/dist/src/metacensus/public/v1/common.d.ts.map +1 -0
- package/dist/src/metacensus/public/v1/common.js +26 -0
- package/dist/src/metacensus/public/v1/common.js.map +1 -0
- package/dist/src/metacensus/public/v1/partner.d.ts +55 -0
- package/dist/src/metacensus/public/v1/partner.d.ts.map +1 -0
- package/dist/src/metacensus/public/v1/partner.js +22 -0
- package/dist/src/metacensus/public/v1/partner.js.map +1 -0
- package/dist/src/metacensus/v1/auth.d.ts +17 -3
- package/dist/src/metacensus/v1/auth.d.ts.map +1 -1
- package/dist/src/metacensus/v1/auth.js +0 -1
- package/dist/src/metacensus/v1/auth.js.map +1 -1
- package/dist/src/metacensus/v1/common.d.ts +54 -6
- package/dist/src/metacensus/v1/common.d.ts.map +1 -1
- package/dist/src/metacensus/v1/common.js +10 -0
- package/dist/src/metacensus/v1/common.js.map +1 -1
- package/dist/src/metacensus/v1/prop.d.ts +56 -27
- package/dist/src/metacensus/v1/prop.d.ts.map +1 -1
- package/dist/src/metacensus/v1/prop.js +19 -20
- package/dist/src/metacensus/v1/prop.js.map +1 -1
- package/dist/src/metacensus/v1/topic.d.ts +20 -10
- package/dist/src/metacensus/v1/topic.d.ts.map +1 -1
- package/dist/src/metacensus/v1/topic.js +0 -1
- package/dist/src/metacensus/v1/topic.js.map +1 -1
- package/dist/src/metacensus/v1/user.d.ts +14 -5
- package/dist/src/metacensus/v1/user.d.ts.map +1 -1
- package/dist/src/metacensus/v1/user.js +0 -1
- package/dist/src/metacensus/v1/user.js.map +1 -1
- package/dist/src/route-manifest.d.ts +3 -0
- package/dist/src/route-manifest.d.ts.map +1 -1
- package/dist/src/route-manifest.js +32 -30
- package/dist/src/route-manifest.js.map +1 -1
- package/dist/src/signing.d.ts +37 -0
- package/dist/src/signing.d.ts.map +1 -0
- package/dist/src/signing.js +193 -0
- package/dist/src/signing.js.map +1 -0
- package/package.json +16 -4
- package/dist/src/metacensus/v1/extraction.d.ts +0 -48
- package/dist/src/metacensus/v1/extraction.d.ts.map +0 -1
- package/dist/src/metacensus/v1/extraction.js +0 -8
- package/dist/src/metacensus/v1/extraction.js.map +0 -1
- package/dist/src/metacensus/v1/paper.d.ts +0 -57
- package/dist/src/metacensus/v1/paper.d.ts.map +0 -1
- package/dist/src/metacensus/v1/paper.js +0 -8
- package/dist/src/metacensus/v1/paper.js.map +0 -1
- package/dist/src/metacensus/v1/protocol.d.ts +0 -42
- package/dist/src/metacensus/v1/protocol.d.ts.map +0 -1
- package/dist/src/metacensus/v1/protocol.js +0 -8
- package/dist/src/metacensus/v1/protocol.js.map +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { UserSignature } from "./metacensus/v1/common.js";
|
|
2
|
+
export declare const SPEC = "metacensus.sig/1";
|
|
3
|
+
/**
|
|
4
|
+
* `value` as RFC 8785 canonical JSON of a ts-proto message — shaped to
|
|
5
|
+
* match what protojson emits on the Go side (see buf.gen.yaml, wire.test.mjs).
|
|
6
|
+
*/
|
|
7
|
+
export declare function canonicalize(value: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* The exact string the digest is taken over — exported so a mismatch between
|
|
10
|
+
* implementations shows up as two strings, not two hashes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function signingInput(content: unknown, signature: UserSignature): string;
|
|
13
|
+
/** SHA-384 over `signingInput`. */
|
|
14
|
+
export declare function digest(content: unknown, signature: UserSignature): Promise<ArrayBuffer>;
|
|
15
|
+
/**
|
|
16
|
+
* Signs `content`, returning the `value` for the signature. Fills in
|
|
17
|
+
* nothing else — the other fields are the signer's own claims and are
|
|
18
|
+
* already inside the digest.
|
|
19
|
+
*/
|
|
20
|
+
export declare function sign(privateKey: CryptoKey, content: unknown, signature: UserSignature): Promise<string>;
|
|
21
|
+
/** Checks `signature` against `content` under `publicKey`. */
|
|
22
|
+
export declare function verify(publicKey: CryptoKey, content: unknown, signature: UserSignature): Promise<boolean>;
|
|
23
|
+
/** Generates a signing keypair. The private key is non-extractable. */
|
|
24
|
+
export declare function generateKeyPair(): Promise<CryptoKeyPair>;
|
|
25
|
+
/**
|
|
26
|
+
* `publicKey` as the contract carries it: base64url of SPKI DER, not PEM —
|
|
27
|
+
* a PEM body's line breaks would make `keyId`'s hash ambiguous.
|
|
28
|
+
*/
|
|
29
|
+
export declare function encodePublicKey(publicKey: CryptoKey): Promise<string>;
|
|
30
|
+
/** Reads what `encodePublicKey` wrote. */
|
|
31
|
+
export declare function decodePublicKey(encoded: string): Promise<CryptoKey>;
|
|
32
|
+
/**
|
|
33
|
+
* base64url of SHA-256 over the SPKI DER — `UserSignature.keyId`. Derived
|
|
34
|
+
* rather than minted, so a client can compute it before it has an account.
|
|
35
|
+
*/
|
|
36
|
+
export declare function keyId(publicKey: CryptoKey): Promise<string>;
|
|
37
|
+
//# sourceMappingURL=signing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/signing.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI/D,eAAO,MAAM,IAAI,qBAAqB,CAAC;AAcvC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAyBnD;AAoDD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAO/E;AAED,mCAAmC;AACnC,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAG7F;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,UAAU,EAAE,SAAS,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,8DAA8D;AAC9D,wBAAsB,MAAM,CAC1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,OAAO,CAAC,CAIlB;AAqBD,uEAAuE;AACvE,wBAAsB,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC,CAE9D;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3E;AAED,0CAA0C;AAC1C,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEzE;AAED;;;GAGG;AACH,wBAAsB,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAGjE"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// The TypeScript half of the MetaCensus signing chain; go/signing is the
|
|
2
|
+
// other half, and ts/test/wire.test.mjs checks the two agree — neither may
|
|
3
|
+
// be edited alone.
|
|
4
|
+
//
|
|
5
|
+
// digest = SHA-384( JCS( {"content": C, "signature": S} ) )
|
|
6
|
+
//
|
|
7
|
+
// C is the content message, S is the UserSignature with `value` cleared.
|
|
8
|
+
// Canonical JSON (RFC 8785) rather than the wire bytes: protojson isn't
|
|
9
|
+
// byte-stable, so only canonicalizing keeps a record verifiable after it's
|
|
10
|
+
// relayed, re-encoded and stored.
|
|
11
|
+
//
|
|
12
|
+
// No runtime dependency: the canonicalizer below is hand-written, and
|
|
13
|
+
// signing uses the WebCrypto `crypto` global rather than an import.
|
|
14
|
+
// Identifies this scheme (JCS + SHA-384 + base64url r||s); a verifier that
|
|
15
|
+
// doesn't recognize it should refuse rather than guess.
|
|
16
|
+
export const SPEC = "metacensus.sig/1";
|
|
17
|
+
// P-384/SHA-384 — `UserSignature.Alg`'s `Es384`. The enum is closed; adding
|
|
18
|
+
// another algorithm is a contract release.
|
|
19
|
+
const ALG = {
|
|
20
|
+
name: "ECDSA",
|
|
21
|
+
namedCurve: "P-384",
|
|
22
|
+
hash: "SHA-384",
|
|
23
|
+
};
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// JCS (RFC 8785)
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* `value` as RFC 8785 canonical JSON of a ts-proto message — shaped to
|
|
29
|
+
* match what protojson emits on the Go side (see buf.gen.yaml, wire.test.mjs).
|
|
30
|
+
*/
|
|
31
|
+
export function canonicalize(value) {
|
|
32
|
+
if (value === null)
|
|
33
|
+
return "null";
|
|
34
|
+
switch (typeof value) {
|
|
35
|
+
case "boolean":
|
|
36
|
+
return value ? "true" : "false";
|
|
37
|
+
case "number":
|
|
38
|
+
return numberToJCS(value);
|
|
39
|
+
case "string":
|
|
40
|
+
return stringToJCS(value);
|
|
41
|
+
case "object":
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
throw new TypeError(`signing: ${typeof value} cannot appear in a canonical document`);
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
return "[" + value.map(canonicalize).join(",") + "]";
|
|
48
|
+
}
|
|
49
|
+
const entries = Object.entries(value).filter(
|
|
50
|
+
// Absent message fields are `undefined` in ts-proto; protojson omits them too.
|
|
51
|
+
([, v]) => v !== undefined);
|
|
52
|
+
// RFC 8785 sorts by UTF-16 code unit — exactly what `<` does on JS strings
|
|
53
|
+
// (Go's sortUTF16 matches this).
|
|
54
|
+
entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
55
|
+
return "{" + entries.map(([k, v]) => stringToJCS(k) + ":" + canonicalize(v)).join(",") + "}";
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Only int32/uint32 survive JCS identically in both languages (RFC 8785's
|
|
59
|
+
* ECMAScript number formatting doesn't reproduce cleanly in Go); the schema
|
|
60
|
+
* enforces this via `TestNoWideNumbersCrossJCS` — this is its runtime half.
|
|
61
|
+
*/
|
|
62
|
+
function numberToJCS(n) {
|
|
63
|
+
if (!Number.isInteger(n) || !Number.isSafeInteger(n)) {
|
|
64
|
+
throw new RangeError(`signing: ${n} is not a safe integer; the contract carries no float, double ` +
|
|
65
|
+
`or 64-bit integer field (TestNoWideNumbersCrossJCS), because ECMAScript ` +
|
|
66
|
+
`number formatting is the one part of RFC 8785 that does not reimplement cleanly`);
|
|
67
|
+
}
|
|
68
|
+
return String(n);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* RFC 8785 §3.2.2.2 escaping, spelled out rather than delegated to
|
|
72
|
+
* `JSON.stringify` — which would match, but Go's `encoding/json` also
|
|
73
|
+
* escapes `<`, `>` and `&`, and two implementations read alike this way.
|
|
74
|
+
*/
|
|
75
|
+
const SHORT = {
|
|
76
|
+
"\b": "\\b",
|
|
77
|
+
"\t": "\\t",
|
|
78
|
+
"\n": "\\n",
|
|
79
|
+
"\f": "\\f",
|
|
80
|
+
"\r": "\\r",
|
|
81
|
+
'"': '\\"',
|
|
82
|
+
"\\": "\\\\",
|
|
83
|
+
};
|
|
84
|
+
function stringToJCS(s) {
|
|
85
|
+
let out = '"';
|
|
86
|
+
for (const ch of s) {
|
|
87
|
+
const short = SHORT[ch];
|
|
88
|
+
if (short !== undefined) {
|
|
89
|
+
out += short;
|
|
90
|
+
}
|
|
91
|
+
else if (ch < " ") {
|
|
92
|
+
out += "\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
out += ch;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return out + '"';
|
|
99
|
+
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// The chain
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
/**
|
|
104
|
+
* The exact string the digest is taken over — exported so a mismatch between
|
|
105
|
+
* implementations shows up as two strings, not two hashes.
|
|
106
|
+
*/
|
|
107
|
+
export function signingInput(content, signature) {
|
|
108
|
+
if (!signature.signingTime) {
|
|
109
|
+
// Message-typed, so canonicalization can't tell "absent" from a default;
|
|
110
|
+
// it must be set explicitly.
|
|
111
|
+
throw new Error("signing: signingTime is unset; every signature carries the time its signer claims");
|
|
112
|
+
}
|
|
113
|
+
return canonicalize({ content, signature: { ...signature, value: "" } });
|
|
114
|
+
}
|
|
115
|
+
/** SHA-384 over `signingInput`. */
|
|
116
|
+
export async function digest(content, signature) {
|
|
117
|
+
const bytes = new TextEncoder().encode(signingInput(content, signature));
|
|
118
|
+
return crypto.subtle.digest("SHA-384", bytes);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Signs `content`, returning the `value` for the signature. Fills in
|
|
122
|
+
* nothing else — the other fields are the signer's own claims and are
|
|
123
|
+
* already inside the digest.
|
|
124
|
+
*/
|
|
125
|
+
export async function sign(privateKey, content, signature) {
|
|
126
|
+
checkAttributes(signature);
|
|
127
|
+
const raw = await crypto.subtle.sign(ALG, privateKey, new TextEncoder().encode(signingInput(content, signature)));
|
|
128
|
+
// WebCrypto returns fixed-width r||s directly, not a DER SEQUENCE — no
|
|
129
|
+
// re-encoding needed.
|
|
130
|
+
return toBase64Url(new Uint8Array(raw));
|
|
131
|
+
}
|
|
132
|
+
/** Checks `signature` against `content` under `publicKey`. */
|
|
133
|
+
export async function verify(publicKey, content, signature) {
|
|
134
|
+
checkAttributes(signature);
|
|
135
|
+
const value = fromBase64Url(signature.value);
|
|
136
|
+
return crypto.subtle.verify(ALG, publicKey, value, new TextEncoder().encode(signingInput(content, signature)));
|
|
137
|
+
}
|
|
138
|
+
// Checked by both sign and verify, so a signature this module would refuse
|
|
139
|
+
// is one it will never produce. `contentType` is the caller's responsibility
|
|
140
|
+
// to set correctly — nothing here knows a plain object's proto name.
|
|
141
|
+
function checkAttributes(signature) {
|
|
142
|
+
if (signature.spec !== SPEC) {
|
|
143
|
+
throw new Error(`signing: spec is ${JSON.stringify(signature.spec)}, and this module implements ${JSON.stringify(SPEC)}`);
|
|
144
|
+
}
|
|
145
|
+
if (signature.alg !== "Es384") {
|
|
146
|
+
throw new Error(`signing: alg is ${JSON.stringify(signature.alg)}, and this module implements "Es384"`);
|
|
147
|
+
}
|
|
148
|
+
if (!signature.contentType) {
|
|
149
|
+
throw new Error("signing: contentType is empty; it names the message the signature covers");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// Keys
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
/** Generates a signing keypair. The private key is non-extractable. */
|
|
156
|
+
export async function generateKeyPair() {
|
|
157
|
+
return crypto.subtle.generateKey(ALG, false, ["sign", "verify"]);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* `publicKey` as the contract carries it: base64url of SPKI DER, not PEM —
|
|
161
|
+
* a PEM body's line breaks would make `keyId`'s hash ambiguous.
|
|
162
|
+
*/
|
|
163
|
+
export async function encodePublicKey(publicKey) {
|
|
164
|
+
return toBase64Url(new Uint8Array(await crypto.subtle.exportKey("spki", publicKey)));
|
|
165
|
+
}
|
|
166
|
+
/** Reads what `encodePublicKey` wrote. */
|
|
167
|
+
export async function decodePublicKey(encoded) {
|
|
168
|
+
return crypto.subtle.importKey("spki", fromBase64Url(encoded), ALG, true, ["verify"]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* base64url of SHA-256 over the SPKI DER — `UserSignature.keyId`. Derived
|
|
172
|
+
* rather than minted, so a client can compute it before it has an account.
|
|
173
|
+
*/
|
|
174
|
+
export async function keyId(publicKey) {
|
|
175
|
+
const spki = await crypto.subtle.exportKey("spki", publicKey);
|
|
176
|
+
return toBase64Url(new Uint8Array(await crypto.subtle.digest("SHA-256", spki)));
|
|
177
|
+
}
|
|
178
|
+
function toBase64Url(bytes) {
|
|
179
|
+
let binary = "";
|
|
180
|
+
for (const b of bytes)
|
|
181
|
+
binary += String.fromCharCode(b);
|
|
182
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
183
|
+
}
|
|
184
|
+
// Uint8Array<ArrayBuffer>, not the default <ArrayBufferLike>: WebCrypto's
|
|
185
|
+
// BufferSource excludes SharedArrayBuffer.
|
|
186
|
+
function fromBase64Url(s) {
|
|
187
|
+
const binary = atob(s.replace(/-/g, "+").replace(/_/g, "/"));
|
|
188
|
+
const out = new Uint8Array(new ArrayBuffer(binary.length));
|
|
189
|
+
for (let i = 0; i < binary.length; i++)
|
|
190
|
+
out[i] = binary.charCodeAt(i);
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../src/signing.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,mBAAmB;AACnB,EAAE;AACF,gEAAgE;AAChE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,2EAA2E;AAC3E,kCAAkC;AAClC,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AAIpE,2EAA2E;AAC3E,wDAAwD;AACxD,MAAM,CAAC,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEvC,4EAA4E;AAC5E,2CAA2C;AAC3C,MAAM,GAA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AM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metacensus/api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript for the MetaCensus API contract (/metacensus/api/v1 and /metacensus/public): generated types, a route manifest, a typed transport-agnostic client per surface, and the signing chain. No runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
6
9
|
"sideEffects": false,
|
|
7
10
|
"main": "./dist/index.js",
|
|
8
11
|
"types": "./dist/index.d.ts",
|
|
@@ -11,6 +14,14 @@
|
|
|
11
14
|
"types": "./dist/index.d.ts",
|
|
12
15
|
"default": "./dist/index.js"
|
|
13
16
|
},
|
|
17
|
+
"./public": {
|
|
18
|
+
"types": "./dist/public.d.ts",
|
|
19
|
+
"default": "./dist/public.js"
|
|
20
|
+
},
|
|
21
|
+
"./signing": {
|
|
22
|
+
"types": "./dist/signing.d.ts",
|
|
23
|
+
"default": "./dist/signing.js"
|
|
24
|
+
},
|
|
14
25
|
"./package.json": "./package.json"
|
|
15
26
|
},
|
|
16
27
|
"files": [
|
|
@@ -31,12 +42,13 @@
|
|
|
31
42
|
},
|
|
32
43
|
"scripts": {
|
|
33
44
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
34
|
-
"check": "tsc --noEmit && node scripts/check-no-runtime.mjs",
|
|
45
|
+
"check": "tsc --noEmit && node scripts/check-no-runtime.mjs && node scripts/check-entry-points.mjs",
|
|
46
|
+
"test": "npm run build && node --test \"test/**/*.test.mjs\"",
|
|
35
47
|
"prepack": "npm run build"
|
|
36
48
|
},
|
|
37
49
|
"dependencies": {},
|
|
38
50
|
"devDependencies": {
|
|
39
51
|
"ts-proto": "2.7.7",
|
|
40
|
-
"typescript": "
|
|
52
|
+
"typescript": "7.0.2"
|
|
41
53
|
}
|
|
42
54
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export declare const protobufPackage = "metacensus.v1";
|
|
2
|
-
/** Data extraction: the values pulled from one paper against one protocol. */
|
|
3
|
-
/**
|
|
4
|
-
* DataExtraction is the values extracted from one paper against one protocol,
|
|
5
|
-
* identified by the three ids together. Upserted and read back as-is.
|
|
6
|
-
*/
|
|
7
|
-
export interface DataExtraction {
|
|
8
|
-
topicId: string;
|
|
9
|
-
paperId: string;
|
|
10
|
-
protocolId: string;
|
|
11
|
-
data: DatumExtraction[];
|
|
12
|
-
}
|
|
13
|
-
/** DatumExtraction is one answered protocol element. */
|
|
14
|
-
export interface DatumExtraction {
|
|
15
|
-
protocolElementId: string;
|
|
16
|
-
/**
|
|
17
|
-
* The extracted value. A string for every element type the contract
|
|
18
|
-
* describes; multi-select elements have no representation yet.
|
|
19
|
-
*/
|
|
20
|
-
datum: string;
|
|
21
|
-
/**
|
|
22
|
-
* Where in the PDF the value was read from. Empty when the value was typed
|
|
23
|
-
* rather than selected.
|
|
24
|
-
*/
|
|
25
|
-
sourceLocation: SourceLocationPage[];
|
|
26
|
-
}
|
|
27
|
-
/** SourceLocationPage is the highlighted rectangles on one page of a PDF. */
|
|
28
|
-
export interface SourceLocationPage {
|
|
29
|
-
page: number;
|
|
30
|
-
rects: SourceRect[];
|
|
31
|
-
}
|
|
32
|
-
/** SourceRect is one highlight rectangle, in the PDF viewer's coordinate space. */
|
|
33
|
-
export interface SourceRect {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
w: number;
|
|
37
|
-
h: number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* DataExtractionGetRequest requires all three fields; together they identify
|
|
41
|
-
* one DataExtraction.
|
|
42
|
-
*/
|
|
43
|
-
export interface DataExtractionGetRequest {
|
|
44
|
-
topicId: string;
|
|
45
|
-
paperId: string;
|
|
46
|
-
protocolId: string;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=extraction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/extraction.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,EAAE,kBAAkB,EAAE,CAAC;CACtC;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.7.7
|
|
4
|
-
// protoc unknown
|
|
5
|
-
// source: metacensus/v1/extraction.proto
|
|
6
|
-
/* eslint-disable */
|
|
7
|
-
export const protobufPackage = "metacensus.v1";
|
|
8
|
-
//# sourceMappingURL=extraction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extraction.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/extraction.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,yCAAyC;AAEzC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export declare const protobufPackage = "metacensus.v1";
|
|
2
|
-
/** Papers: the literature under review in a topic. */
|
|
3
|
-
export interface Paper {
|
|
4
|
-
id: string;
|
|
5
|
-
topicId: string;
|
|
6
|
-
title: string;
|
|
7
|
-
/** Author names, in reading order. */
|
|
8
|
-
authors: string[];
|
|
9
|
-
abstract: string;
|
|
10
|
-
/**
|
|
11
|
-
* Bibliographic identifiers. Either may be empty: not every paper has both,
|
|
12
|
-
* and one uploaded as a PDF may have neither.
|
|
13
|
-
*/
|
|
14
|
-
doi: string;
|
|
15
|
-
pmid: string;
|
|
16
|
-
created?: string | undefined;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* PaperListRequest requires at least one field; setting `paper_id` narrows the
|
|
20
|
-
* result to a single paper.
|
|
21
|
-
*/
|
|
22
|
-
export interface PaperListRequest {
|
|
23
|
-
topicId: string;
|
|
24
|
-
paperId: string;
|
|
25
|
-
}
|
|
26
|
-
export interface PaperList {
|
|
27
|
-
items: Paper[];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* PaperCreateRequest carries no PDF; uploading one is not part of this
|
|
31
|
-
* contract.
|
|
32
|
-
*/
|
|
33
|
-
export interface PaperCreateRequest {
|
|
34
|
-
topicId: string;
|
|
35
|
-
title: string;
|
|
36
|
-
authors: string[];
|
|
37
|
-
abstract: string;
|
|
38
|
-
doi: string;
|
|
39
|
-
pmid: string;
|
|
40
|
-
}
|
|
41
|
-
/** PaperLookupRequest names the PubMed record the create form is prefilled from. */
|
|
42
|
-
export interface PaperLookupRequest {
|
|
43
|
-
pmid: string;
|
|
44
|
-
}
|
|
45
|
-
/** PaperLookupResponse is whatever PubMed supplied, so any field may be empty. */
|
|
46
|
-
export interface PaperLookupResponse {
|
|
47
|
-
pmid: string;
|
|
48
|
-
title: string;
|
|
49
|
-
authors: string[];
|
|
50
|
-
/**
|
|
51
|
-
* Labelled sections arrive joined by blank lines and prefixed with their
|
|
52
|
-
* label — `"METHODS: …"` — rather than structured.
|
|
53
|
-
*/
|
|
54
|
-
abstract: string;
|
|
55
|
-
doi: string;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=paper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paper.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/paper.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,sDAAsD;AAEtD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,KAAK,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oFAAoF;AACpF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.7.7
|
|
4
|
-
// protoc unknown
|
|
5
|
-
// source: metacensus/v1/paper.proto
|
|
6
|
-
/* eslint-disable */
|
|
7
|
-
export const protobufPackage = "metacensus.v1";
|
|
8
|
-
//# sourceMappingURL=paper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paper.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/paper.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,oCAAoC;AAEpC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export declare const protobufPackage = "metacensus.v1";
|
|
2
|
-
/** Protocols: the extraction form a topic's reviewers fill in per paper. */
|
|
3
|
-
/** Protocol is an ordered set of sections, each an ordered set of elements. */
|
|
4
|
-
export interface Protocol {
|
|
5
|
-
id: string;
|
|
6
|
-
title: string;
|
|
7
|
-
protocolSections: ProtocolSection[];
|
|
8
|
-
}
|
|
9
|
-
/** ProtocolSection is a titled group of elements, ordered by `sort_order`. */
|
|
10
|
-
export interface ProtocolSection {
|
|
11
|
-
id: string;
|
|
12
|
-
title: string;
|
|
13
|
-
sortOrder: number;
|
|
14
|
-
protocolElements: ProtocolElement[];
|
|
15
|
-
}
|
|
16
|
-
export interface ProtocolElement {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
/**
|
|
20
|
-
* An HTML input type, used verbatim as `<input type=…>`: `text`, `number`,
|
|
21
|
-
* `date`, `textarea`, `radio` or `checkbox`.
|
|
22
|
-
*/
|
|
23
|
-
type: string;
|
|
24
|
-
label: string;
|
|
25
|
-
placeholder: string;
|
|
26
|
-
required: boolean;
|
|
27
|
-
/** Only meaningful for `radio` and `checkbox`. */
|
|
28
|
-
options: ProtocolElementOption[];
|
|
29
|
-
sortOrder: number;
|
|
30
|
-
}
|
|
31
|
-
/** ProtocolElementOption is one choice of a radio or checkbox element. */
|
|
32
|
-
export interface ProtocolElementOption {
|
|
33
|
-
name: string;
|
|
34
|
-
value: string;
|
|
35
|
-
}
|
|
36
|
-
/** ProtocolCreateRequest ignores the ids on its sections and elements. */
|
|
37
|
-
export interface ProtocolCreateRequest {
|
|
38
|
-
topicId: string;
|
|
39
|
-
title: string;
|
|
40
|
-
sections: ProtocolSection[];
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/protocol.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,4EAA4E;AAE5E,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.7.7
|
|
4
|
-
// protoc unknown
|
|
5
|
-
// source: metacensus/v1/protocol.proto
|
|
6
|
-
/* eslint-disable */
|
|
7
|
-
export const protobufPackage = "metacensus.v1";
|
|
8
|
-
//# sourceMappingURL=protocol.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/protocol.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,uCAAuC;AAEvC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC"}
|