@purpleschool/student-works 0.0.2 → 0.0.3
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/api/controller/http/writer.ts +2 -0
- package/api/routes.ts +2 -0
- package/build/api/controller/http/writer.js +1 -0
- package/build/api/routes.js +1 -0
- package/build/commands/writer/confirm-source-citation-metadata.command.js +15 -0
- package/build/commands/writer/generate-writer-document-contents.command.js +1 -3
- package/build/commands/writer/generate-writer-document-outline.command.js +1 -0
- package/build/commands/writer/index.js +1 -0
- package/build/commands/writer/upload-writer-source.command.js +0 -1
- package/build/constants/writer/enums/index.js +2 -0
- package/build/constants/writer/enums/source-status.enum.js +9 -0
- package/build/constants/writer/enums/source-type.enum.js +8 -0
- package/build/models/writer/writer-document-type.schema.js +1 -0
- package/build/models/writer-source.schema.js +28 -2
- package/commands/writer/confirm-source-citation-metadata.command.ts +15 -0
- package/commands/writer/generate-writer-document-contents.command.ts +1 -3
- package/commands/writer/generate-writer-document-outline.command.ts +1 -0
- package/commands/writer/index.ts +1 -0
- package/commands/writer/upload-writer-source.command.ts +0 -1
- package/constants/writer/enums/index.ts +2 -0
- package/constants/writer/enums/source-status.enum.ts +5 -0
- package/constants/writer/enums/source-type.enum.ts +4 -0
- package/models/writer/writer-document-type.schema.ts +1 -0
- package/models/writer-source.schema.ts +36 -3
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ export const WRITER_ROUTES = {
|
|
|
10
10
|
GENERATE_OUTLINE: (uuid: string) => `documents/${uuid}/outline/generate`,
|
|
11
11
|
COLLECT_SOURCES: (uuid: string) => `documents/${uuid}/sources/collect`,
|
|
12
12
|
UPLOAD_SOURCE: (uuid: string) => `documents/${uuid}/sources/upload`,
|
|
13
|
+
CONFIRM_SOURCE_CITATION_METADATA: (docId: string, sourceId: string) =>
|
|
14
|
+
`documents/${docId}/sources/${sourceId}/confirm`,
|
|
13
15
|
GENERATE_CONTENTS: (uuid: string) => `documents/${uuid}/generate`,
|
|
14
16
|
UPDATE_OUTLINE: (uuid: string) => `documents/${uuid}/outline`,
|
|
15
17
|
DELETE_DOCUMENT: (uuid: string) => `documents/${uuid}`,
|
package/api/routes.ts
CHANGED
|
@@ -101,6 +101,8 @@ export const REST_API = {
|
|
|
101
101
|
`${ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.COLLECT_SOURCES(uuid)}`,
|
|
102
102
|
UPLOAD_SOURCE: (uuid: string) =>
|
|
103
103
|
`${ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.UPLOAD_SOURCE(uuid)}`,
|
|
104
|
+
CONFIRM_SOURCE_CITATION_METADATA: (docId: string, sourceId: string) =>
|
|
105
|
+
`${ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.CONFIRM_SOURCE_CITATION_METADATA(docId, sourceId)}`,
|
|
104
106
|
GENERATE_CONTENTS: (uuid: string) =>
|
|
105
107
|
`${ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.GENERATE_CONTENTS(uuid)}`,
|
|
106
108
|
UPDATE_OUTLINE: (uuid: string) =>
|
|
@@ -12,6 +12,7 @@ exports.WRITER_ROUTES = {
|
|
|
12
12
|
GENERATE_OUTLINE: (uuid) => `documents/${uuid}/outline/generate`,
|
|
13
13
|
COLLECT_SOURCES: (uuid) => `documents/${uuid}/sources/collect`,
|
|
14
14
|
UPLOAD_SOURCE: (uuid) => `documents/${uuid}/sources/upload`,
|
|
15
|
+
CONFIRM_SOURCE_CITATION_METADATA: (docId, sourceId) => `documents/${docId}/sources/${sourceId}/confirm`,
|
|
15
16
|
GENERATE_CONTENTS: (uuid) => `documents/${uuid}/generate`,
|
|
16
17
|
UPDATE_OUTLINE: (uuid) => `documents/${uuid}/outline`,
|
|
17
18
|
DELETE_DOCUMENT: (uuid) => `documents/${uuid}`,
|
package/build/api/routes.js
CHANGED
|
@@ -116,6 +116,7 @@ exports.REST_API = {
|
|
|
116
116
|
GENERATE_OUTLINE: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.GENERATE_OUTLINE(uuid)}`,
|
|
117
117
|
COLLECT_SOURCES: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.COLLECT_SOURCES(uuid)}`,
|
|
118
118
|
UPLOAD_SOURCE: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.UPLOAD_SOURCE(uuid)}`,
|
|
119
|
+
CONFIRM_SOURCE_CITATION_METADATA: (docId, sourceId) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.CONFIRM_SOURCE_CITATION_METADATA(docId, sourceId)}`,
|
|
119
120
|
GENERATE_CONTENTS: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.GENERATE_CONTENTS(uuid)}`,
|
|
120
121
|
UPDATE_OUTLINE: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.UPDATE_OUTLINE(uuid)}`,
|
|
121
122
|
DELETE_DOCUMENT: (uuid) => `${exports.ROOT}/${CONTROLLERS.WRITER_CONTROLLER_PRIVATE}/${CONTROLLERS.WRITER_ROUTES.DELETE_DOCUMENT(uuid)}`,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfirmSourceCitationMetadataCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var ConfirmSourceCitationMetadataCommand;
|
|
7
|
+
(function (ConfirmSourceCitationMetadataCommand) {
|
|
8
|
+
ConfirmSourceCitationMetadataCommand.RequestParamsSchema = zod_1.z.object({
|
|
9
|
+
documentId: zod_1.z.string().uuid(),
|
|
10
|
+
sourceId: zod_1.z.string().uuid(),
|
|
11
|
+
});
|
|
12
|
+
ConfirmSourceCitationMetadataCommand.RequestBodySchema = zod_1.z.object({
|
|
13
|
+
bibliographicMetadata: models_1.SourceBibliographicMetadataSchema,
|
|
14
|
+
});
|
|
15
|
+
})(ConfirmSourceCitationMetadataCommand || (exports.ConfirmSourceCitationMetadataCommand = ConfirmSourceCitationMetadataCommand = {}));
|
|
@@ -8,9 +8,7 @@ var GenerateWriterDocumentContentsCommand;
|
|
|
8
8
|
GenerateWriterDocumentContentsCommand.RequestParamsSchema = zod_1.z.object({
|
|
9
9
|
uuid: zod_1.z.string().uuid(),
|
|
10
10
|
});
|
|
11
|
-
GenerateWriterDocumentContentsCommand.RequestBodySchema = zod_1.z.object({
|
|
12
|
-
modelId: zod_1.z.string().uuid(),
|
|
13
|
-
});
|
|
11
|
+
GenerateWriterDocumentContentsCommand.RequestBodySchema = zod_1.z.object({});
|
|
14
12
|
GenerateWriterDocumentContentsCommand.ResponseSchema = zod_1.z.object({
|
|
15
13
|
data: models_1.WriterDocumentSchema,
|
|
16
14
|
});
|
|
@@ -13,6 +13,7 @@ var GenerateWriterDocumentOutlineCommand;
|
|
|
13
13
|
description: zod_1.z
|
|
14
14
|
.string()
|
|
15
15
|
.nullable()
|
|
16
|
+
.optional()
|
|
16
17
|
.describe("If set to null existing description will be used. Otherwise replaces document's description"),
|
|
17
18
|
});
|
|
18
19
|
GenerateWriterDocumentOutlineCommand.ResponseSchema = zod_1.z.object({
|
|
@@ -35,3 +35,4 @@ __exportStar(require("./export-writer-document-as-docx.command"), exports);
|
|
|
35
35
|
__exportStar(require("./set-reaction.writer-document.command"), exports);
|
|
36
36
|
__exportStar(require("./discard-writer-source.command"), exports);
|
|
37
37
|
__exportStar(require("./upload-writer-source.command"), exports);
|
|
38
|
+
__exportStar(require("./confirm-source-citation-metadata.command"), exports);
|
|
@@ -10,7 +10,6 @@ var UploadWriterSourceCommand;
|
|
|
10
10
|
});
|
|
11
11
|
UploadWriterSourceCommand.RequestBodySchema = zod_1.z.object({
|
|
12
12
|
fileId: zod_1.z.string().uuid(),
|
|
13
|
-
title: zod_1.z.string().min(1).max(500),
|
|
14
13
|
});
|
|
15
14
|
UploadWriterSourceCommand.ResponseSchema = zod_1.z.object({
|
|
16
15
|
data: models_1.WriterSourceSchema,
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./source-type.enum"), exports);
|
|
18
|
+
__exportStar(require("./source-status.enum"), exports);
|
|
17
19
|
__exportStar(require("./source-origin.enum"), exports);
|
|
18
20
|
__exportStar(require("./writer-document-section-type.enum"), exports);
|
|
19
21
|
__exportStar(require("./writer-document-stage.enum"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SOURCE_STATUS = void 0;
|
|
4
|
+
var SOURCE_STATUS;
|
|
5
|
+
(function (SOURCE_STATUS) {
|
|
6
|
+
SOURCE_STATUS["READY"] = "READY";
|
|
7
|
+
SOURCE_STATUS["REQUIRES_CITATION_METADATA_CONFIRMATION"] = "REQUIRES_CITATION_METADATA_CONFIRMATION";
|
|
8
|
+
SOURCE_STATUS["DISCARDED"] = "DISCARDED";
|
|
9
|
+
})(SOURCE_STATUS || (exports.SOURCE_STATUS = SOURCE_STATUS = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SOURCE_TYPE = void 0;
|
|
4
|
+
var SOURCE_TYPE;
|
|
5
|
+
(function (SOURCE_TYPE) {
|
|
6
|
+
SOURCE_TYPE["JOURNAL_ARTICLE"] = "JOURNAL_ARTICLE";
|
|
7
|
+
SOURCE_TYPE["BOOK"] = "BOOK";
|
|
8
|
+
})(SOURCE_TYPE || (exports.SOURCE_TYPE = SOURCE_TYPE = {}));
|
|
@@ -7,6 +7,7 @@ exports.WriterDocumentTypeSchema = zod_1.z.object({
|
|
|
7
7
|
uuid: zod_1.z.string().uuid(),
|
|
8
8
|
title: zod_1.z.string(),
|
|
9
9
|
icons: icon_variants_schema_1.IconVariantsSchema,
|
|
10
|
+
needsCitations: zod_1.z.boolean(),
|
|
10
11
|
order: zod_1.z.number(),
|
|
11
12
|
minPages: zod_1.z.number(),
|
|
12
13
|
maxPages: zod_1.z.number(),
|
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WriterSourceSchema = void 0;
|
|
3
|
+
exports.WriterSourceSchema = exports.SourceBibliographicMetadataSchema = exports.JournalArticleBibliographicMetadataSchema = exports.BookBibliographicMetadataSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
+
exports.BookBibliographicMetadataSchema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal(constants_1.SOURCE_TYPE.BOOK),
|
|
8
|
+
title: zod_1.z.string(),
|
|
9
|
+
authors: zod_1.z.string(),
|
|
10
|
+
year: zod_1.z.number(),
|
|
11
|
+
publicationCity: zod_1.z.string(),
|
|
12
|
+
publisher: zod_1.z.string(),
|
|
13
|
+
pageCount: zod_1.z.number().nullable(),
|
|
14
|
+
});
|
|
15
|
+
exports.JournalArticleBibliographicMetadataSchema = zod_1.z.object({
|
|
16
|
+
type: zod_1.z.literal(constants_1.SOURCE_TYPE.JOURNAL_ARTICLE),
|
|
17
|
+
title: zod_1.z.string(),
|
|
18
|
+
authors: zod_1.z.string(),
|
|
19
|
+
year: zod_1.z.number(),
|
|
20
|
+
journalName: zod_1.z.string(),
|
|
21
|
+
issueNumber: zod_1.z.string(),
|
|
22
|
+
pageRange: zod_1.z.string(),
|
|
23
|
+
});
|
|
24
|
+
exports.SourceBibliographicMetadataSchema = zod_1.z.discriminatedUnion('type', [
|
|
25
|
+
exports.BookBibliographicMetadataSchema,
|
|
26
|
+
exports.JournalArticleBibliographicMetadataSchema,
|
|
27
|
+
]);
|
|
6
28
|
exports.WriterSourceSchema = zod_1.z.object({
|
|
7
29
|
uuid: zod_1.z.string().uuid(),
|
|
8
|
-
title: zod_1.z.string(),
|
|
9
30
|
url: zod_1.z.string().url(),
|
|
31
|
+
title: zod_1.z.string().nullable(),
|
|
32
|
+
type: zod_1.z.nativeEnum(constants_1.SOURCE_TYPE).nullable(),
|
|
10
33
|
sourceOrigin: zod_1.z.nativeEnum(constants_1.SOURCE_ORIGIN),
|
|
34
|
+
citation: zod_1.z.string().nullable(),
|
|
35
|
+
status: zod_1.z.nativeEnum(constants_1.SOURCE_STATUS),
|
|
36
|
+
bibliographicMetadata: exports.SourceBibliographicMetadataSchema,
|
|
11
37
|
createdAt: zod_1.z.date(),
|
|
12
38
|
updatedAt: zod_1.z.date(),
|
|
13
39
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SourceBibliographicMetadataSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace ConfirmSourceCitationMetadataCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
documentId: z.string().uuid(),
|
|
7
|
+
sourceId: z.string().uuid(),
|
|
8
|
+
});
|
|
9
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestBodySchema = z.object({
|
|
12
|
+
bibliographicMetadata: SourceBibliographicMetadataSchema,
|
|
13
|
+
});
|
|
14
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
15
|
+
}
|
|
@@ -7,9 +7,7 @@ export namespace GenerateWriterDocumentContentsCommand {
|
|
|
7
7
|
});
|
|
8
8
|
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
9
9
|
|
|
10
|
-
export const RequestBodySchema = z.object({
|
|
11
|
-
modelId: z.string().uuid(),
|
|
12
|
-
});
|
|
10
|
+
export const RequestBodySchema = z.object({});
|
|
13
11
|
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
14
12
|
|
|
15
13
|
export const ResponseSchema = z.object({
|
package/commands/writer/index.ts
CHANGED
|
@@ -19,3 +19,4 @@ export * from './export-writer-document-as-docx.command';
|
|
|
19
19
|
export * from './set-reaction.writer-document.command';
|
|
20
20
|
export * from './discard-writer-source.command';
|
|
21
21
|
export * from './upload-writer-source.command';
|
|
22
|
+
export * from './confirm-source-citation-metadata.command';
|
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SOURCE_ORIGIN } from '../constants';
|
|
2
|
+
import { SOURCE_ORIGIN, SOURCE_STATUS, SOURCE_TYPE } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const BookBibliographicMetadataSchema = z.object({
|
|
5
|
+
type: z.literal(SOURCE_TYPE.BOOK),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
authors: z.string(),
|
|
8
|
+
year: z.number(),
|
|
9
|
+
publicationCity: z.string(),
|
|
10
|
+
publisher: z.string(),
|
|
11
|
+
pageCount: z.number().nullable(),
|
|
12
|
+
});
|
|
13
|
+
export type BookBibliographicMetadata = z.infer<typeof BookBibliographicMetadataSchema>;
|
|
14
|
+
|
|
15
|
+
export const JournalArticleBibliographicMetadataSchema = z.object({
|
|
16
|
+
type: z.literal(SOURCE_TYPE.JOURNAL_ARTICLE),
|
|
17
|
+
title: z.string(),
|
|
18
|
+
authors: z.string(),
|
|
19
|
+
year: z.number(),
|
|
20
|
+
journalName: z.string(),
|
|
21
|
+
issueNumber: z.string(),
|
|
22
|
+
pageRange: z.string(),
|
|
23
|
+
});
|
|
24
|
+
export type JournalArticleBibliographicMetadata = z.infer<
|
|
25
|
+
typeof JournalArticleBibliographicMetadataSchema
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export const SourceBibliographicMetadataSchema = z.discriminatedUnion('type', [
|
|
29
|
+
BookBibliographicMetadataSchema,
|
|
30
|
+
JournalArticleBibliographicMetadataSchema,
|
|
31
|
+
]);
|
|
32
|
+
export type SourceBibliographicMetadata = z.infer<typeof SourceBibliographicMetadataSchema>;
|
|
3
33
|
|
|
4
34
|
export const WriterSourceSchema = z.object({
|
|
5
35
|
uuid: z.string().uuid(),
|
|
6
|
-
title: z.string(),
|
|
7
36
|
url: z.string().url(),
|
|
37
|
+
title: z.string().nullable(),
|
|
38
|
+
type: z.nativeEnum(SOURCE_TYPE).nullable(),
|
|
8
39
|
sourceOrigin: z.nativeEnum(SOURCE_ORIGIN),
|
|
40
|
+
citation: z.string().nullable(),
|
|
41
|
+
status: z.nativeEnum(SOURCE_STATUS),
|
|
42
|
+
bibliographicMetadata: SourceBibliographicMetadataSchema,
|
|
9
43
|
createdAt: z.date(),
|
|
10
44
|
updatedAt: z.date(),
|
|
11
45
|
});
|
|
12
|
-
|
|
13
46
|
export type WriterSource = z.infer<typeof WriterSourceSchema>;
|