@metacensus/library-research 0.14.0 → 0.16.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 +65 -20
- package/dist/collection-store.d.ts +31 -0
- package/dist/collection-store.js +174 -0
- package/dist/collections.gen.d.ts +309 -0
- package/dist/collections.gen.js +190 -0
- package/dist/commands/add.js +29 -12
- package/dist/commands/dev.js +48 -44
- package/dist/commands/reshape.d.ts +2 -0
- package/dist/commands/reshape.js +21 -0
- package/dist/context.d.ts +5 -3
- package/dist/context.js +4 -2
- package/dist/corpus.d.ts +432 -0
- package/dist/corpus.js +348 -0
- package/dist/data.d.ts +13 -6
- package/dist/data.js +27 -15
- package/dist/datasets.d.ts +4 -1
- package/dist/datasets.js +48 -8
- package/dist/dev/host.js +6 -9
- package/dist/host.d.ts +17 -2
- package/dist/host.js +26 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/mount.d.ts +11 -4
- package/dist/mount.js +15 -9
- package/dist/papers.js +3 -2
- package/dist/parity.d.ts +25 -0
- package/dist/parity.js +70 -0
- package/dist/playwright.d.ts +2 -2
- package/dist/playwright.js +30 -8
- package/dist/project-id.d.ts +4 -0
- package/dist/project-id.js +7 -0
- package/dist/react.d.ts +32 -42
- package/dist/react.js +121 -118
- package/dist/schema.d.ts +19 -34
- package/dist/schema.js +47 -31
- package/dist/testing.d.ts +26 -11
- package/dist/testing.js +64 -26
- package/dist/types.d.ts +85 -26
- package/dist/urls.d.ts +35 -0
- package/dist/urls.js +58 -0
- package/dist/vite-config.js +2 -12
- package/dist/vite.d.ts +11 -2
- package/dist/vite.js +79 -25
- package/dist/zod.d.ts +2 -0
- package/dist/zod.js +4 -0
- package/package.json +19 -12
- package/schema/corpus.schema.json +3949 -29
- package/schema/project-id.schema.json +6 -0
- package/schema/research.schema.json +130 -2
- package/dist/document-store.d.ts +0 -14
- package/dist/document-store.js +0 -78
- package/dist/documents.d.ts +0 -10
- package/dist/documents.js +0 -22
package/dist/commands/dev.js
CHANGED
|
@@ -5,21 +5,19 @@ import { extname, join } from 'node:path';
|
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
7
|
import { createServer, mergeConfig } from 'vite';
|
|
8
|
-
import {
|
|
8
|
+
import { papers as held } from '../corpus.js';
|
|
9
|
+
import { collectionStore } from '../collection-store.js';
|
|
9
10
|
import { paperPath } from '../papers.js';
|
|
10
11
|
import { project, read, readCorpus } from '../data.js';
|
|
11
12
|
import { pdfAssets } from '../pdf.js';
|
|
12
13
|
import { pagesOf, readerCookie, readerOf } from '../reader.js';
|
|
13
14
|
import { findRoot } from '../root.js';
|
|
14
15
|
import { kinds } from '../schema.js';
|
|
16
|
+
import { match, routed } from '../urls.js';
|
|
15
17
|
import { hostConfig } from '../vite-config.js';
|
|
16
18
|
const entry = 'virtual:research-host';
|
|
17
19
|
const css = `${entry}.css`;
|
|
18
20
|
const host = fileURLToPath(new URL('../dev/host.js', import.meta.url));
|
|
19
|
-
const data = /^\/projects\/project\/data\//;
|
|
20
|
-
const privates = /^\/projects\/project\/private\/([^/]+)\/([^/]+)\.json$/;
|
|
21
|
-
const documents = /^\/projects\/project\/documents(\/[^/]*)?$/;
|
|
22
|
-
const papers = /^\/projects\/project\/papers\/([^/]+)$/;
|
|
23
21
|
const assetTypes = {
|
|
24
22
|
'.js': 'text/javascript',
|
|
25
23
|
'.mjs': 'text/javascript',
|
|
@@ -72,13 +70,17 @@ export default async function dev(args) {
|
|
|
72
70
|
function devHost(root, named) {
|
|
73
71
|
const reader = named ?? 'local';
|
|
74
72
|
const real = realpathSync(root);
|
|
75
|
-
const { people, roles } = project(root);
|
|
73
|
+
const { people, roles, collections } = project(root);
|
|
76
74
|
// Refuses, before serving, a --reader the project's people cannot serve; the
|
|
77
75
|
// default is refused where a page reads as it, so contexts that each name a
|
|
78
76
|
// reader still start.
|
|
79
77
|
if (named !== undefined)
|
|
80
78
|
readerOf({ people, roles }, named, true);
|
|
81
|
-
|
|
79
|
+
// Without people, the reader is the one member, as in testHost.
|
|
80
|
+
const store = collectionStore({
|
|
81
|
+
collections,
|
|
82
|
+
people: people ?? { [reader]: {} },
|
|
83
|
+
});
|
|
82
84
|
return {
|
|
83
85
|
name: 'research:dev',
|
|
84
86
|
// Before research:serve, so a signed-out reader's data requests are refused first.
|
|
@@ -87,10 +89,14 @@ function devHost(root, named) {
|
|
|
87
89
|
resolveId: (id) => ([entry, css].includes(id) ? '\0' + id : undefined),
|
|
88
90
|
load(id) {
|
|
89
91
|
if (id === '\0' + css)
|
|
90
|
-
return
|
|
92
|
+
return [
|
|
93
|
+
'@layer theme, base, mc, components, utilities;',
|
|
94
|
+
`@import 'tailwindcss';`,
|
|
95
|
+
`@import '@metacensus/library-ui/theme.css';`,
|
|
96
|
+
].join('\n');
|
|
91
97
|
if (id === '\0' + entry)
|
|
92
98
|
return [
|
|
93
|
-
// First, so
|
|
99
|
+
// First, so its layer line sets the order before library-ui's CSS declares `mc`.
|
|
94
100
|
`import '${css}'`,
|
|
95
101
|
`import '@metacensus/library-ui/fonts.css'`,
|
|
96
102
|
`import '@metacensus/library-ui/tokens.css'`,
|
|
@@ -102,8 +108,8 @@ function devHost(root, named) {
|
|
|
102
108
|
].join('\n');
|
|
103
109
|
},
|
|
104
110
|
configureServer(server) {
|
|
105
|
-
// The project's
|
|
106
|
-
const
|
|
111
|
+
// The project's collections, shared by every reader, as the cookie names them.
|
|
112
|
+
const collection = async (req, res, route, person) => {
|
|
107
113
|
const chunks = [];
|
|
108
114
|
for await (const chunk of req)
|
|
109
115
|
chunks.push(chunk);
|
|
@@ -113,47 +119,44 @@ function devHost(root, named) {
|
|
|
113
119
|
body: ['GET', 'HEAD'].includes(req.method)
|
|
114
120
|
? undefined
|
|
115
121
|
: Buffer.concat(chunks),
|
|
116
|
-
}),
|
|
122
|
+
}), route, person);
|
|
117
123
|
reply(res, answer.status, Object.fromEntries(answer.headers), Buffer.from(await answer.arrayBuffer()));
|
|
118
124
|
};
|
|
119
125
|
server.middlewares.use((req, res, next) => {
|
|
120
126
|
res.setHeader('Content-Security-Policy', policy);
|
|
121
|
-
const path = req.url?.split('?')[0];
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
const path = req.url?.split('?')[0] ?? '';
|
|
128
|
+
const route = match(req.url ?? '');
|
|
129
|
+
if (route?.project !== 'project' && routed(path))
|
|
130
|
+
return notFound(res, `${path}: not a route of this project`);
|
|
131
|
+
// A cookie with an empty value is a signed-out reader, as an encoded
|
|
132
|
+
// name is never empty; one that does not decode names no reader.
|
|
124
133
|
const named = cookie(req, readerCookie);
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
let who = reader;
|
|
135
|
+
try {
|
|
136
|
+
if (named !== undefined)
|
|
137
|
+
who = decodeURIComponent(named) || undefined;
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
who = undefined;
|
|
141
|
+
}
|
|
142
|
+
// The store answers a signed-out reader as the API does.
|
|
143
|
+
if (route?.route === 'collections' || route?.route === 'collection')
|
|
144
|
+
return void collection(req, res, route, who).catch(next);
|
|
145
|
+
if (route && route.route !== 'paper' && named === '')
|
|
127
146
|
return reply(res, 401, { 'Content-Type': 'text/plain' }, 'signed out');
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
// A cookie that does not decode names no reader.
|
|
131
|
-
let who = reader;
|
|
132
|
-
try {
|
|
133
|
-
if (named !== undefined)
|
|
134
|
-
who = decodeURIComponent(named);
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
147
|
+
if (route?.route === 'private') {
|
|
148
|
+
if (who === undefined)
|
|
137
149
|
return reply(res, 401, { 'Content-Type': 'text/plain' }, 'signed out');
|
|
138
|
-
}
|
|
139
|
-
if (!page)
|
|
140
|
-
return void document(req, res, who).catch(next);
|
|
141
150
|
// A page is its reader's alone, as the server gates it; view-as is no gate.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
wanted = decodeURIComponent(page);
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
return notFound(res, `${page}: not a page`);
|
|
148
|
-
}
|
|
149
|
-
if (!pagesOf(people, who).includes(wanted))
|
|
151
|
+
const { page, dataset } = route;
|
|
152
|
+
if (!pagesOf(people, who).includes(page))
|
|
150
153
|
return reply(res, 403, { 'Content-Type': 'text/plain' }, 'not yours');
|
|
151
|
-
const file = privateFile(root,
|
|
154
|
+
const file = privateFile(root, page, dataset);
|
|
152
155
|
if (!file)
|
|
153
156
|
return notFound(res, `project has no private dataset "${dataset}" page "${page}"`);
|
|
154
157
|
return send(req, res, Buffer.from(JSON.stringify(read(root, file))), 'application/json');
|
|
155
158
|
}
|
|
156
|
-
const asset = path
|
|
159
|
+
const asset = path.startsWith(pdfAssets) && path.slice(pdfAssets.length);
|
|
157
160
|
if (asset) {
|
|
158
161
|
const file = pdfAsset(asset);
|
|
159
162
|
if (!file)
|
|
@@ -161,10 +164,10 @@ function devHost(root, named) {
|
|
|
161
164
|
const type = assetTypes[extname(file)] ?? 'application/octet-stream';
|
|
162
165
|
return send(req, res, readFileSync(file), type);
|
|
163
166
|
}
|
|
164
|
-
|
|
165
|
-
if (!sha)
|
|
167
|
+
if (route?.route !== 'paper')
|
|
166
168
|
return next();
|
|
167
|
-
const
|
|
169
|
+
const { sha } = route;
|
|
170
|
+
const kind = held(readCorpus(root)).get(sha)?.paper.kind;
|
|
168
171
|
if (!kind)
|
|
169
172
|
return notFound(res, `${sha}: not in corpus.json`);
|
|
170
173
|
const file = paperPath(sha, kind);
|
|
@@ -179,7 +182,7 @@ function devHost(root, named) {
|
|
|
179
182
|
});
|
|
180
183
|
return () => server.middlewares.use((req, res, next) => {
|
|
181
184
|
const url = req.originalUrl ?? '';
|
|
182
|
-
if (req.url !== '/index.html' || url
|
|
185
|
+
if (req.url !== '/index.html' || routed(url))
|
|
183
186
|
return next();
|
|
184
187
|
server
|
|
185
188
|
.transformIndexHtml(url, page)
|
|
@@ -191,7 +194,8 @@ function devHost(root, named) {
|
|
|
191
194
|
}
|
|
192
195
|
function privateFile(root, page, dataset) {
|
|
193
196
|
try {
|
|
194
|
-
|
|
197
|
+
const { pages } = project(root);
|
|
198
|
+
return Object.hasOwn(pages, dataset) ? pages[dataset]()[page] : undefined;
|
|
195
199
|
}
|
|
196
200
|
catch (error) {
|
|
197
201
|
if (error.message.endsWith(': matches no file'))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import * as loader from '../corpus.js';
|
|
3
|
+
import { read, readCorpus, writeCorpus } from '../data.js';
|
|
4
|
+
import { findRoot } from '../root.js';
|
|
5
|
+
/** Rewrites a legacy corpus.json in the new shape, leaving one already in it, and prints what waits on a person. */
|
|
6
|
+
export default function reshape(args) {
|
|
7
|
+
parseArgs({ args });
|
|
8
|
+
const root = findRoot(process.cwd());
|
|
9
|
+
let corpus;
|
|
10
|
+
try {
|
|
11
|
+
corpus = readCorpus(root);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const legacy = loader.LegacyCorpus.safeParse(read(root, 'corpus.json'));
|
|
15
|
+
if (!legacy.success)
|
|
16
|
+
throw error;
|
|
17
|
+
corpus = loader.reshape(legacy.data).corpus;
|
|
18
|
+
writeCorpus(root, corpus);
|
|
19
|
+
}
|
|
20
|
+
console.log(JSON.stringify(loader.pending(corpus), null, 2));
|
|
21
|
+
}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Host } from './types.js';
|
|
1
|
+
import type { Host, Schema } from './types.js';
|
|
2
2
|
export declare const HostContext: import("react").Context<Host | null>;
|
|
3
|
-
/**
|
|
4
|
-
export declare const
|
|
3
|
+
/** The schemas `defineProject` was given, which `useData` and `usePrivate` look a dataset up in. */
|
|
4
|
+
export declare const DatasetsContext: import("react").Context<Record<string, Schema>>;
|
|
5
|
+
/** The schemas `defineProject` was given, which `useCollection` parses a collection's bodies by. */
|
|
6
|
+
export declare const CollectionsContext: import("react").Context<Record<string, Schema>>;
|
package/dist/context.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
export const HostContext = createContext(null);
|
|
3
|
-
/**
|
|
4
|
-
export const
|
|
3
|
+
/** The schemas `defineProject` was given, which `useData` and `usePrivate` look a dataset up in. */
|
|
4
|
+
export const DatasetsContext = createContext({});
|
|
5
|
+
/** The schemas `defineProject` was given, which `useCollection` parses a collection's bodies by. */
|
|
6
|
+
export const CollectionsContext = createContext({});
|
package/dist/corpus.d.ts
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { z } from './zod.js';
|
|
2
|
+
export declare const kinds: {
|
|
3
|
+
readonly pdf: "application/pdf";
|
|
4
|
+
readonly doc: "application/msword";
|
|
5
|
+
readonly docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
6
|
+
readonly xls: "application/vnd.ms-excel";
|
|
7
|
+
readonly xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
8
|
+
readonly zip: "application/zip";
|
|
9
|
+
readonly gif: "image/gif";
|
|
10
|
+
readonly jpg: "image/jpeg";
|
|
11
|
+
readonly tif: "image/tiff";
|
|
12
|
+
readonly txt: "text/plain";
|
|
13
|
+
readonly html: "text/plain";
|
|
14
|
+
readonly xml: "text/plain";
|
|
15
|
+
};
|
|
16
|
+
declare const names: readonly ["author", "chair", "collection-editor", "compiler", "composer", "container-author", "contributor", "curator", "director", "editor", "editorial-director", "executive-producer", "guest", "host", "illustrator", "interviewer", "narrator", "organizer", "original-author", "performer", "producer", "recipient", "reviewed-author", "script-writer", "series-creator", "translator"];
|
|
17
|
+
declare const dates: readonly ["accessed", "available-date", "event-date", "issued", "original-date", "submitted"];
|
|
18
|
+
declare const numbers: readonly ["chapter-number", "citation-number", "collection-number", "edition", "first-reference-note-number", "issue", "number", "number-of-pages", "number-of-volumes", "page", "page-first", "part", "printing", "supplement", "version", "volume"];
|
|
19
|
+
declare const strings: readonly ["abstract", "annote", "archive", "archive_collection", "archive_location", "archive-place", "authority", "call-number", "citation-label", "collection-title", "container-title", "container-title-short", "dimensions", "division", "event", "event-place", "event-title", "genre", "ISBN", "ISSN", "journalAbbreviation", "jurisdiction", "keyword", "language", "locator", "medium", "note", "original-publisher", "original-publisher-place", "original-title", "part-title", "PMCID", "PMID", "publisher", "publisher-place", "references", "reviewed-genre", "reviewed-title", "scale", "section", "shortTitle", "source", "status", "title", "title-short", "URL", "volume-title", "volume-title-short", "year-suffix"];
|
|
20
|
+
declare const name: z.ZodArray<z.ZodObject<{
|
|
21
|
+
family: z.ZodOptional<z.ZodString>;
|
|
22
|
+
given: z.ZodOptional<z.ZodString>;
|
|
23
|
+
'dropping-particle': z.ZodOptional<z.ZodString>;
|
|
24
|
+
'non-dropping-particle': z.ZodOptional<z.ZodString>;
|
|
25
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
26
|
+
'comma-suffix': z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
27
|
+
'static-ordering': z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
28
|
+
literal: z.ZodOptional<z.ZodString>;
|
|
29
|
+
'parse-names': z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
declare const date: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
32
|
+
'date-parts': z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>;
|
|
33
|
+
season: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
34
|
+
circa: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
35
|
+
literal: z.ZodOptional<z.ZodString>;
|
|
36
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>]>;
|
|
38
|
+
declare const number: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
39
|
+
declare const string: z.ZodString;
|
|
40
|
+
type Variables<K extends string, T extends z.ZodType> = {
|
|
41
|
+
[P in K]: z.ZodOptional<T>;
|
|
42
|
+
};
|
|
43
|
+
declare const base: {
|
|
44
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
document: "document";
|
|
46
|
+
collection: "collection";
|
|
47
|
+
dataset: "dataset";
|
|
48
|
+
map: "map";
|
|
49
|
+
article: "article";
|
|
50
|
+
"article-journal": "article-journal";
|
|
51
|
+
"article-magazine": "article-magazine";
|
|
52
|
+
"article-newspaper": "article-newspaper";
|
|
53
|
+
bill: "bill";
|
|
54
|
+
book: "book";
|
|
55
|
+
broadcast: "broadcast";
|
|
56
|
+
chapter: "chapter";
|
|
57
|
+
classic: "classic";
|
|
58
|
+
entry: "entry";
|
|
59
|
+
"entry-dictionary": "entry-dictionary";
|
|
60
|
+
"entry-encyclopedia": "entry-encyclopedia";
|
|
61
|
+
event: "event";
|
|
62
|
+
figure: "figure";
|
|
63
|
+
graphic: "graphic";
|
|
64
|
+
hearing: "hearing";
|
|
65
|
+
interview: "interview";
|
|
66
|
+
legal_case: "legal_case";
|
|
67
|
+
legislation: "legislation";
|
|
68
|
+
manuscript: "manuscript";
|
|
69
|
+
motion_picture: "motion_picture";
|
|
70
|
+
musical_score: "musical_score";
|
|
71
|
+
pamphlet: "pamphlet";
|
|
72
|
+
"paper-conference": "paper-conference";
|
|
73
|
+
patent: "patent";
|
|
74
|
+
performance: "performance";
|
|
75
|
+
periodical: "periodical";
|
|
76
|
+
personal_communication: "personal_communication";
|
|
77
|
+
post: "post";
|
|
78
|
+
"post-weblog": "post-weblog";
|
|
79
|
+
regulation: "regulation";
|
|
80
|
+
report: "report";
|
|
81
|
+
review: "review";
|
|
82
|
+
"review-book": "review-book";
|
|
83
|
+
software: "software";
|
|
84
|
+
song: "song";
|
|
85
|
+
speech: "speech";
|
|
86
|
+
standard: "standard";
|
|
87
|
+
thesis: "thesis";
|
|
88
|
+
treaty: "treaty";
|
|
89
|
+
webpage: "webpage";
|
|
90
|
+
}>>;
|
|
91
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
93
|
+
};
|
|
94
|
+
type CslShape = typeof base & Variables<(typeof names)[number], typeof name> & Variables<(typeof dates)[number], typeof date> & Variables<(typeof numbers)[number], typeof number> & Variables<(typeof strings)[number], typeof string>;
|
|
95
|
+
export declare const Csl: z.ZodObject<CslShape, z.core.$strict>;
|
|
96
|
+
type Field = keyof CslShape;
|
|
97
|
+
export declare const Paper: z.ZodObject<{
|
|
98
|
+
kind: z.ZodEnum<{
|
|
99
|
+
pdf: "pdf";
|
|
100
|
+
doc: "doc";
|
|
101
|
+
docx: "docx";
|
|
102
|
+
xls: "xls";
|
|
103
|
+
xlsx: "xlsx";
|
|
104
|
+
zip: "zip";
|
|
105
|
+
gif: "gif";
|
|
106
|
+
jpg: "jpg";
|
|
107
|
+
tif: "tif";
|
|
108
|
+
txt: "txt";
|
|
109
|
+
html: "html";
|
|
110
|
+
xml: "xml";
|
|
111
|
+
}>;
|
|
112
|
+
open: z.ZodOptional<z.ZodLiteral<true>>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export declare const Edition: z.ZodObject<{
|
|
115
|
+
csl: z.ZodOptional<z.ZodObject<CslShape, z.core.$strict>>;
|
|
116
|
+
papers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
117
|
+
kind: z.ZodEnum<{
|
|
118
|
+
pdf: "pdf";
|
|
119
|
+
doc: "doc";
|
|
120
|
+
docx: "docx";
|
|
121
|
+
xls: "xls";
|
|
122
|
+
xlsx: "xlsx";
|
|
123
|
+
zip: "zip";
|
|
124
|
+
gif: "gif";
|
|
125
|
+
jpg: "jpg";
|
|
126
|
+
tif: "tif";
|
|
127
|
+
txt: "txt";
|
|
128
|
+
html: "html";
|
|
129
|
+
xml: "xml";
|
|
130
|
+
}>;
|
|
131
|
+
open: z.ZodOptional<z.ZodLiteral<true>>;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export declare const Work: z.ZodObject<{
|
|
135
|
+
csl: z.ZodObject<CslShape, z.core.$strict>;
|
|
136
|
+
editions: z.ZodArray<z.ZodObject<{
|
|
137
|
+
csl: z.ZodOptional<z.ZodObject<CslShape, z.core.$strict>>;
|
|
138
|
+
papers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
139
|
+
kind: z.ZodEnum<{
|
|
140
|
+
pdf: "pdf";
|
|
141
|
+
doc: "doc";
|
|
142
|
+
docx: "docx";
|
|
143
|
+
xls: "xls";
|
|
144
|
+
xlsx: "xlsx";
|
|
145
|
+
zip: "zip";
|
|
146
|
+
gif: "gif";
|
|
147
|
+
jpg: "jpg";
|
|
148
|
+
tif: "tif";
|
|
149
|
+
txt: "txt";
|
|
150
|
+
html: "html";
|
|
151
|
+
xml: "xml";
|
|
152
|
+
}>;
|
|
153
|
+
open: z.ZodOptional<z.ZodLiteral<true>>;
|
|
154
|
+
}, z.core.$strict>>;
|
|
155
|
+
}, z.core.$strict>>;
|
|
156
|
+
pending: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
157
|
+
number: "number";
|
|
158
|
+
type: "type";
|
|
159
|
+
page: "page";
|
|
160
|
+
status: "status";
|
|
161
|
+
event: "event";
|
|
162
|
+
author: "author";
|
|
163
|
+
chair: "chair";
|
|
164
|
+
"collection-editor": "collection-editor";
|
|
165
|
+
compiler: "compiler";
|
|
166
|
+
composer: "composer";
|
|
167
|
+
"container-author": "container-author";
|
|
168
|
+
contributor: "contributor";
|
|
169
|
+
curator: "curator";
|
|
170
|
+
director: "director";
|
|
171
|
+
editor: "editor";
|
|
172
|
+
"editorial-director": "editorial-director";
|
|
173
|
+
"executive-producer": "executive-producer";
|
|
174
|
+
guest: "guest";
|
|
175
|
+
host: "host";
|
|
176
|
+
illustrator: "illustrator";
|
|
177
|
+
interviewer: "interviewer";
|
|
178
|
+
narrator: "narrator";
|
|
179
|
+
organizer: "organizer";
|
|
180
|
+
"original-author": "original-author";
|
|
181
|
+
performer: "performer";
|
|
182
|
+
producer: "producer";
|
|
183
|
+
recipient: "recipient";
|
|
184
|
+
"reviewed-author": "reviewed-author";
|
|
185
|
+
"script-writer": "script-writer";
|
|
186
|
+
"series-creator": "series-creator";
|
|
187
|
+
translator: "translator";
|
|
188
|
+
accessed: "accessed";
|
|
189
|
+
"available-date": "available-date";
|
|
190
|
+
"event-date": "event-date";
|
|
191
|
+
issued: "issued";
|
|
192
|
+
"original-date": "original-date";
|
|
193
|
+
submitted: "submitted";
|
|
194
|
+
"chapter-number": "chapter-number";
|
|
195
|
+
"citation-number": "citation-number";
|
|
196
|
+
"collection-number": "collection-number";
|
|
197
|
+
edition: "edition";
|
|
198
|
+
"first-reference-note-number": "first-reference-note-number";
|
|
199
|
+
issue: "issue";
|
|
200
|
+
"number-of-pages": "number-of-pages";
|
|
201
|
+
"number-of-volumes": "number-of-volumes";
|
|
202
|
+
"page-first": "page-first";
|
|
203
|
+
part: "part";
|
|
204
|
+
printing: "printing";
|
|
205
|
+
supplement: "supplement";
|
|
206
|
+
version: "version";
|
|
207
|
+
volume: "volume";
|
|
208
|
+
abstract: "abstract";
|
|
209
|
+
annote: "annote";
|
|
210
|
+
archive: "archive";
|
|
211
|
+
archive_collection: "archive_collection";
|
|
212
|
+
archive_location: "archive_location";
|
|
213
|
+
"archive-place": "archive-place";
|
|
214
|
+
authority: "authority";
|
|
215
|
+
"call-number": "call-number";
|
|
216
|
+
"citation-label": "citation-label";
|
|
217
|
+
"collection-title": "collection-title";
|
|
218
|
+
"container-title": "container-title";
|
|
219
|
+
"container-title-short": "container-title-short";
|
|
220
|
+
dimensions: "dimensions";
|
|
221
|
+
division: "division";
|
|
222
|
+
"event-place": "event-place";
|
|
223
|
+
"event-title": "event-title";
|
|
224
|
+
genre: "genre";
|
|
225
|
+
ISBN: "ISBN";
|
|
226
|
+
ISSN: "ISSN";
|
|
227
|
+
journalAbbreviation: "journalAbbreviation";
|
|
228
|
+
jurisdiction: "jurisdiction";
|
|
229
|
+
keyword: "keyword";
|
|
230
|
+
language: "language";
|
|
231
|
+
locator: "locator";
|
|
232
|
+
medium: "medium";
|
|
233
|
+
note: "note";
|
|
234
|
+
"original-publisher": "original-publisher";
|
|
235
|
+
"original-publisher-place": "original-publisher-place";
|
|
236
|
+
"original-title": "original-title";
|
|
237
|
+
"part-title": "part-title";
|
|
238
|
+
PMCID: "PMCID";
|
|
239
|
+
PMID: "PMID";
|
|
240
|
+
publisher: "publisher";
|
|
241
|
+
"publisher-place": "publisher-place";
|
|
242
|
+
references: "references";
|
|
243
|
+
"reviewed-genre": "reviewed-genre";
|
|
244
|
+
"reviewed-title": "reviewed-title";
|
|
245
|
+
scale: "scale";
|
|
246
|
+
section: "section";
|
|
247
|
+
shortTitle: "shortTitle";
|
|
248
|
+
source: "source";
|
|
249
|
+
title: "title";
|
|
250
|
+
"title-short": "title-short";
|
|
251
|
+
URL: "URL";
|
|
252
|
+
"volume-title": "volume-title";
|
|
253
|
+
"volume-title-short": "volume-title-short";
|
|
254
|
+
"year-suffix": "year-suffix";
|
|
255
|
+
custom: "custom";
|
|
256
|
+
categories: "categories";
|
|
257
|
+
}>>>;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
export declare const Corpus: z.ZodRecord<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodString]>, z.ZodObject<{
|
|
260
|
+
csl: z.ZodObject<CslShape, z.core.$strict>;
|
|
261
|
+
editions: z.ZodArray<z.ZodObject<{
|
|
262
|
+
csl: z.ZodOptional<z.ZodObject<CslShape, z.core.$strict>>;
|
|
263
|
+
papers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
264
|
+
kind: z.ZodEnum<{
|
|
265
|
+
pdf: "pdf";
|
|
266
|
+
doc: "doc";
|
|
267
|
+
docx: "docx";
|
|
268
|
+
xls: "xls";
|
|
269
|
+
xlsx: "xlsx";
|
|
270
|
+
zip: "zip";
|
|
271
|
+
gif: "gif";
|
|
272
|
+
jpg: "jpg";
|
|
273
|
+
tif: "tif";
|
|
274
|
+
txt: "txt";
|
|
275
|
+
html: "html";
|
|
276
|
+
xml: "xml";
|
|
277
|
+
}>;
|
|
278
|
+
open: z.ZodOptional<z.ZodLiteral<true>>;
|
|
279
|
+
}, z.core.$strict>>;
|
|
280
|
+
}, z.core.$strict>>;
|
|
281
|
+
pending: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
282
|
+
number: "number";
|
|
283
|
+
type: "type";
|
|
284
|
+
page: "page";
|
|
285
|
+
status: "status";
|
|
286
|
+
event: "event";
|
|
287
|
+
author: "author";
|
|
288
|
+
chair: "chair";
|
|
289
|
+
"collection-editor": "collection-editor";
|
|
290
|
+
compiler: "compiler";
|
|
291
|
+
composer: "composer";
|
|
292
|
+
"container-author": "container-author";
|
|
293
|
+
contributor: "contributor";
|
|
294
|
+
curator: "curator";
|
|
295
|
+
director: "director";
|
|
296
|
+
editor: "editor";
|
|
297
|
+
"editorial-director": "editorial-director";
|
|
298
|
+
"executive-producer": "executive-producer";
|
|
299
|
+
guest: "guest";
|
|
300
|
+
host: "host";
|
|
301
|
+
illustrator: "illustrator";
|
|
302
|
+
interviewer: "interviewer";
|
|
303
|
+
narrator: "narrator";
|
|
304
|
+
organizer: "organizer";
|
|
305
|
+
"original-author": "original-author";
|
|
306
|
+
performer: "performer";
|
|
307
|
+
producer: "producer";
|
|
308
|
+
recipient: "recipient";
|
|
309
|
+
"reviewed-author": "reviewed-author";
|
|
310
|
+
"script-writer": "script-writer";
|
|
311
|
+
"series-creator": "series-creator";
|
|
312
|
+
translator: "translator";
|
|
313
|
+
accessed: "accessed";
|
|
314
|
+
"available-date": "available-date";
|
|
315
|
+
"event-date": "event-date";
|
|
316
|
+
issued: "issued";
|
|
317
|
+
"original-date": "original-date";
|
|
318
|
+
submitted: "submitted";
|
|
319
|
+
"chapter-number": "chapter-number";
|
|
320
|
+
"citation-number": "citation-number";
|
|
321
|
+
"collection-number": "collection-number";
|
|
322
|
+
edition: "edition";
|
|
323
|
+
"first-reference-note-number": "first-reference-note-number";
|
|
324
|
+
issue: "issue";
|
|
325
|
+
"number-of-pages": "number-of-pages";
|
|
326
|
+
"number-of-volumes": "number-of-volumes";
|
|
327
|
+
"page-first": "page-first";
|
|
328
|
+
part: "part";
|
|
329
|
+
printing: "printing";
|
|
330
|
+
supplement: "supplement";
|
|
331
|
+
version: "version";
|
|
332
|
+
volume: "volume";
|
|
333
|
+
abstract: "abstract";
|
|
334
|
+
annote: "annote";
|
|
335
|
+
archive: "archive";
|
|
336
|
+
archive_collection: "archive_collection";
|
|
337
|
+
archive_location: "archive_location";
|
|
338
|
+
"archive-place": "archive-place";
|
|
339
|
+
authority: "authority";
|
|
340
|
+
"call-number": "call-number";
|
|
341
|
+
"citation-label": "citation-label";
|
|
342
|
+
"collection-title": "collection-title";
|
|
343
|
+
"container-title": "container-title";
|
|
344
|
+
"container-title-short": "container-title-short";
|
|
345
|
+
dimensions: "dimensions";
|
|
346
|
+
division: "division";
|
|
347
|
+
"event-place": "event-place";
|
|
348
|
+
"event-title": "event-title";
|
|
349
|
+
genre: "genre";
|
|
350
|
+
ISBN: "ISBN";
|
|
351
|
+
ISSN: "ISSN";
|
|
352
|
+
journalAbbreviation: "journalAbbreviation";
|
|
353
|
+
jurisdiction: "jurisdiction";
|
|
354
|
+
keyword: "keyword";
|
|
355
|
+
language: "language";
|
|
356
|
+
locator: "locator";
|
|
357
|
+
medium: "medium";
|
|
358
|
+
note: "note";
|
|
359
|
+
"original-publisher": "original-publisher";
|
|
360
|
+
"original-publisher-place": "original-publisher-place";
|
|
361
|
+
"original-title": "original-title";
|
|
362
|
+
"part-title": "part-title";
|
|
363
|
+
PMCID: "PMCID";
|
|
364
|
+
PMID: "PMID";
|
|
365
|
+
publisher: "publisher";
|
|
366
|
+
"publisher-place": "publisher-place";
|
|
367
|
+
references: "references";
|
|
368
|
+
"reviewed-genre": "reviewed-genre";
|
|
369
|
+
"reviewed-title": "reviewed-title";
|
|
370
|
+
scale: "scale";
|
|
371
|
+
section: "section";
|
|
372
|
+
shortTitle: "shortTitle";
|
|
373
|
+
source: "source";
|
|
374
|
+
title: "title";
|
|
375
|
+
"title-short": "title-short";
|
|
376
|
+
URL: "URL";
|
|
377
|
+
"volume-title": "volume-title";
|
|
378
|
+
"volume-title-short": "volume-title-short";
|
|
379
|
+
"year-suffix": "year-suffix";
|
|
380
|
+
custom: "custom";
|
|
381
|
+
categories: "categories";
|
|
382
|
+
}>>>;
|
|
383
|
+
}, z.core.$strict>>;
|
|
384
|
+
/** The corpus before works: one entry per file, by sha. */
|
|
385
|
+
export declare const LegacyCorpus: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
386
|
+
kind: z.ZodEnum<{
|
|
387
|
+
pdf: "pdf";
|
|
388
|
+
doc: "doc";
|
|
389
|
+
docx: "docx";
|
|
390
|
+
xls: "xls";
|
|
391
|
+
xlsx: "xlsx";
|
|
392
|
+
zip: "zip";
|
|
393
|
+
gif: "gif";
|
|
394
|
+
jpg: "jpg";
|
|
395
|
+
tif: "tif";
|
|
396
|
+
txt: "txt";
|
|
397
|
+
html: "html";
|
|
398
|
+
xml: "xml";
|
|
399
|
+
}>;
|
|
400
|
+
title: z.ZodOptional<z.ZodString>;
|
|
401
|
+
citation: z.ZodOptional<z.ZodString>;
|
|
402
|
+
open: z.ZodOptional<z.ZodLiteral<true>>;
|
|
403
|
+
}, z.core.$strict>>;
|
|
404
|
+
type Corpus = z.infer<typeof Corpus>;
|
|
405
|
+
type Work = z.infer<typeof Work>;
|
|
406
|
+
type Legacy = Omit<z.infer<typeof LegacyCorpus>[string], 'open'> & {
|
|
407
|
+
open?: boolean;
|
|
408
|
+
};
|
|
409
|
+
type Judgment = {
|
|
410
|
+
work: string;
|
|
411
|
+
shas: string[];
|
|
412
|
+
judgment: Field | 'key';
|
|
413
|
+
};
|
|
414
|
+
/** Every held file by sha, with the work and edition holding it. */
|
|
415
|
+
export declare function papers(corpus: Corpus): Map<string, {
|
|
416
|
+
key: string;
|
|
417
|
+
work: Work;
|
|
418
|
+
edition: Work["editions"][number];
|
|
419
|
+
paper: z.infer<typeof Paper>;
|
|
420
|
+
}>;
|
|
421
|
+
/** What waits on a person: each placeholder's key, and each pending field. */
|
|
422
|
+
export declare function pending(corpus: Corpus): Judgment[];
|
|
423
|
+
/** The placeholder key of the file `sha`. */
|
|
424
|
+
export declare const placeholderOf: (sha: string) => string;
|
|
425
|
+
/** One legacy entry as a work of one edition, judging nothing. */
|
|
426
|
+
export declare function workOf(sha: string, { kind, title, citation, open }: Legacy): Work;
|
|
427
|
+
/** Today's corpus in the new shape, one work per sha, and the judgments it leaves. */
|
|
428
|
+
export declare function reshape(legacy: z.infer<typeof LegacyCorpus>): {
|
|
429
|
+
corpus: Corpus;
|
|
430
|
+
judgments: Judgment[];
|
|
431
|
+
};
|
|
432
|
+
export {};
|