bookish-press 0.4.28 → 0.4.31
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/components/page/Publish.svelte +21 -7
- package/index.d.ts +0 -1
- package/models/CRUD.d.ts +3 -1
- package/models/book/Edition.js +1 -1
- package/models/book/Schema.d.ts +17 -15
- package/models/book/Schema.js +14 -16
- package/package.json +1 -1
|
@@ -15,16 +15,27 @@ let edition = getEdition();
|
|
|
15
15
|
let editable = isEditionEditable();
|
|
16
16
|
let publishing = false;
|
|
17
17
|
let feedback = undefined;
|
|
18
|
+
let error = undefined;
|
|
19
|
+
let url = undefined;
|
|
18
20
|
async function requestPublish() {
|
|
19
21
|
if ($edition) {
|
|
20
22
|
publishing = true;
|
|
21
|
-
|
|
23
|
+
error = undefined;
|
|
24
|
+
feedback = 'Binding the book, this could take a minute...';
|
|
22
25
|
try {
|
|
23
|
-
|
|
26
|
+
const result = await publish($edition);
|
|
27
|
+
if (typeof result === 'string') {
|
|
28
|
+
error = result;
|
|
29
|
+
feedback = undefined;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
url = result.url;
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
35
|
catch (err) {
|
|
26
36
|
console.log(err);
|
|
27
|
-
feedback =
|
|
37
|
+
feedback = undefined;
|
|
38
|
+
error = 'Unable to bundle the book for download :(';
|
|
28
39
|
}
|
|
29
40
|
finally {
|
|
30
41
|
publishing = false;
|
|
@@ -83,12 +94,15 @@ async function updateUserClaims() {
|
|
|
83
94
|
<Button
|
|
84
95
|
tooltip="Publish the book online"
|
|
85
96
|
disabled={publishing}
|
|
86
|
-
command={() => requestPublish()}
|
|
87
|
-
>{publishing ? 'publishing...' : 'publish'}</Button
|
|
97
|
+
command={() => requestPublish()}>↓ download</Button
|
|
88
98
|
>
|
|
89
99
|
</div>
|
|
90
|
-
{#if
|
|
91
|
-
<Feedback error>{
|
|
100
|
+
{#if error}
|
|
101
|
+
<Feedback error>{error}</Feedback>
|
|
102
|
+
{:else if url}
|
|
103
|
+
<p>Your book is <Link to={url}>ready for download</Link>.</p>
|
|
104
|
+
{:else if feedback}
|
|
105
|
+
<Feedback>{feedback}</Feedback>
|
|
92
106
|
{/if}
|
|
93
107
|
<div>
|
|
94
108
|
<Note
|
package/index.d.ts
CHANGED
|
@@ -11,4 +11,3 @@ export { default as Feedback } from "./components/app/Feedback.svelte";
|
|
|
11
11
|
export { default as Loading } from "./components/page/Loading.svelte";
|
|
12
12
|
export { default as EditionModel } from "./models/book/Edition";
|
|
13
13
|
export { EDITION } from "./components/page/Contexts";
|
|
14
|
-
export { Schema } from "./models/book/Schema";
|
package/models/CRUD.d.ts
CHANGED
|
@@ -22,4 +22,6 @@ export declare function updateLock(edition: Edition, uid: string, content: strin
|
|
|
22
22
|
export declare function updateEdition(previousEdition: Edition | undefined, newEdition: Edition): Promise<Map<string, DocumentReference>>;
|
|
23
23
|
export declare function updateBook(book: Book): Promise<void>;
|
|
24
24
|
export declare function isSubdomainAvailable(subdomain: string, book: Book): Promise<boolean>;
|
|
25
|
-
export declare function publish(edition: Edition): Promise<string |
|
|
25
|
+
export declare function publish(edition: Edition): Promise<string | {
|
|
26
|
+
url: string;
|
|
27
|
+
}>;
|
package/models/book/Edition.js
CHANGED
|
@@ -57,7 +57,7 @@ export default class Edition {
|
|
|
57
57
|
static fromJSON(editionRef, spec) {
|
|
58
58
|
// Copy all of the specification metadata to fields.
|
|
59
59
|
// Choose suitable defaults if the spec is lacking a field.
|
|
60
|
-
return new Edition(spec.bookRef, editionRef, spec.uids, spec.title, spec.authors, spec.number, spec.summary, spec.published, spec.images, spec.description, spec.chapters.map((chap) => Chapter.fromJSON(chap, '')), spec.license, spec.acknowledgements, spec.tags, spec.sources, spec.references, spec.symbols, spec.glossary, spec.theme, spec.active);
|
|
60
|
+
return new Edition(spec.bookRef, editionRef, spec.uids, spec.title, spec.authors, spec.number, spec.summary, spec.published, spec.images, spec.description, spec.chapters.map((chap) => Chapter.fromJSON(chap, '')), spec.license, spec.acknowledgements, spec.tags ?? [], spec.sources ?? {}, spec.references ?? {}, spec.symbols ?? {}, spec.glossary ?? {}, spec.theme, spec.active);
|
|
61
61
|
}
|
|
62
62
|
static parseReference(citationID, ref, edition, short = false) {
|
|
63
63
|
if (typeof ref === 'string')
|
package/models/book/Schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const Schema: {
|
|
2
2
|
$schema: string;
|
|
3
3
|
title: string;
|
|
4
4
|
type: string;
|
|
@@ -14,6 +14,15 @@ export declare const Schema: {
|
|
|
14
14
|
title: {
|
|
15
15
|
type: string;
|
|
16
16
|
};
|
|
17
|
+
number: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
summary: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
published: {
|
|
24
|
+
type: string[];
|
|
25
|
+
};
|
|
17
26
|
authors: {
|
|
18
27
|
type: string;
|
|
19
28
|
items: {
|
|
@@ -84,17 +93,6 @@ export declare const Schema: {
|
|
|
84
93
|
};
|
|
85
94
|
};
|
|
86
95
|
};
|
|
87
|
-
revisions: {
|
|
88
|
-
type: string;
|
|
89
|
-
items: {
|
|
90
|
-
type: string;
|
|
91
|
-
minItems: number;
|
|
92
|
-
maxItems: number;
|
|
93
|
-
items: {
|
|
94
|
-
type: string;
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
96
|
tags: {
|
|
99
97
|
type: string;
|
|
100
98
|
items: {
|
|
@@ -115,15 +113,18 @@ export declare const Schema: {
|
|
|
115
113
|
additionalProperties: {
|
|
116
114
|
oneOf: ({
|
|
117
115
|
type: string;
|
|
118
|
-
|
|
116
|
+
minItems?: undefined;
|
|
119
117
|
items?: undefined;
|
|
120
118
|
additionalItems?: undefined;
|
|
121
119
|
} | {
|
|
122
120
|
type: string;
|
|
123
|
-
|
|
121
|
+
minItems: number;
|
|
124
122
|
items: ({
|
|
125
123
|
type: string;
|
|
126
124
|
format?: undefined;
|
|
125
|
+
} | {
|
|
126
|
+
type: string[];
|
|
127
|
+
format?: undefined;
|
|
127
128
|
} | {
|
|
128
129
|
type: string[];
|
|
129
130
|
format: string;
|
|
@@ -163,7 +164,8 @@ export declare const Schema: {
|
|
|
163
164
|
};
|
|
164
165
|
};
|
|
165
166
|
theme: {
|
|
166
|
-
type: string;
|
|
167
|
+
type: string[];
|
|
167
168
|
};
|
|
168
169
|
};
|
|
169
170
|
};
|
|
171
|
+
export default Schema;
|
package/models/book/Schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const Schema = {
|
|
2
2
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
3
3
|
title: 'Bookish book schema',
|
|
4
4
|
type: 'object',
|
|
@@ -10,18 +10,24 @@ export const Schema = {
|
|
|
10
10
|
},
|
|
11
11
|
required: [
|
|
12
12
|
'title',
|
|
13
|
+
'number',
|
|
14
|
+
'summary',
|
|
15
|
+
'published',
|
|
13
16
|
'authors',
|
|
17
|
+
'images',
|
|
14
18
|
'description',
|
|
15
|
-
'chapters',
|
|
16
|
-
'revisions',
|
|
17
19
|
'license',
|
|
20
|
+
'acknowledgements',
|
|
18
21
|
'sources',
|
|
19
22
|
'references',
|
|
20
|
-
'
|
|
23
|
+
'chapters',
|
|
21
24
|
],
|
|
22
25
|
additionalProperties: false,
|
|
23
26
|
properties: {
|
|
24
27
|
title: { type: 'string' },
|
|
28
|
+
number: { type: 'number' },
|
|
29
|
+
summary: { type: 'string' },
|
|
30
|
+
published: { type: ['number', 'null'] },
|
|
25
31
|
authors: {
|
|
26
32
|
type: 'array',
|
|
27
33
|
items: { type: 'string' },
|
|
@@ -55,15 +61,6 @@ export const Schema = {
|
|
|
55
61
|
},
|
|
56
62
|
},
|
|
57
63
|
},
|
|
58
|
-
revisions: {
|
|
59
|
-
type: 'array',
|
|
60
|
-
items: {
|
|
61
|
-
type: 'array',
|
|
62
|
-
minItems: 2,
|
|
63
|
-
maxItems: 2,
|
|
64
|
-
items: { type: 'string' },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
64
|
tags: {
|
|
68
65
|
type: 'array',
|
|
69
66
|
items: { type: 'string' },
|
|
@@ -77,10 +74,10 @@ export const Schema = {
|
|
|
77
74
|
{ type: 'string' },
|
|
78
75
|
{
|
|
79
76
|
type: 'array',
|
|
80
|
-
|
|
77
|
+
minItems: 5,
|
|
81
78
|
items: [
|
|
82
79
|
{ type: 'string' },
|
|
83
|
-
{ type: 'integer' },
|
|
80
|
+
{ type: ['integer', 'string'] },
|
|
84
81
|
{ type: 'string' },
|
|
85
82
|
{ type: 'string' },
|
|
86
83
|
{ type: ['string', 'null'], format: 'uri' },
|
|
@@ -108,7 +105,8 @@ export const Schema = {
|
|
|
108
105
|
},
|
|
109
106
|
},
|
|
110
107
|
theme: {
|
|
111
|
-
type: 'object',
|
|
108
|
+
type: ['object', 'null'],
|
|
112
109
|
},
|
|
113
110
|
},
|
|
114
111
|
};
|
|
112
|
+
export default Schema;
|