@purpleschool/gptbot-tools 0.1.11 → 0.1.13

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.
Files changed (45) hide show
  1. package/build/common/enums/file-type.enum.js +8 -0
  2. package/build/common/enums/index.js +1 -0
  3. package/build/presentation/commands/create-presentation.command.js +0 -1
  4. package/build/presentation/commands/generate-slides.command.js +1 -0
  5. package/build/writer/commands/collect-sources.command.js +15 -0
  6. package/build/writer/commands/confirm-source-citation-metadata.command.js +18 -0
  7. package/build/writer/commands/generate-document-outline.command.js +17 -0
  8. package/build/writer/commands/index.js +4 -0
  9. package/build/writer/commands/upload-writer-source.command.js +18 -0
  10. package/build/writer/enums/index.js +3 -0
  11. package/build/writer/enums/writer-document-stage.enum.js +6 -0
  12. package/build/writer/enums/writer-source-origin.enum.js +8 -0
  13. package/build/writer/enums/writer-source-status.enum.js +9 -0
  14. package/build/writer/enums/writer-source-type.enum.js +8 -0
  15. package/build/writer/models/index.js +2 -0
  16. package/build/writer/models/writer-document-type.schema.js +1 -1
  17. package/build/writer/models/writer-document.schema.js +3 -0
  18. package/build/writer/models/writer-source-bibliographic-metadata.schema.js +27 -0
  19. package/build/writer/models/writer-source.schema.js +22 -0
  20. package/build/writer/queries/get-writer-document-sources.query.js +15 -0
  21. package/build/writer/queries/index.js +1 -0
  22. package/build/writer/routes/writer.routes.js +5 -0
  23. package/common/enums/file-type.enum.ts +4 -0
  24. package/common/enums/index.ts +1 -0
  25. package/package.json +1 -1
  26. package/presentation/commands/create-presentation.command.ts +1 -2
  27. package/presentation/commands/generate-slides.command.ts +2 -1
  28. package/writer/commands/collect-sources.command.ts +15 -0
  29. package/writer/commands/confirm-source-citation-metadata.command.ts +18 -0
  30. package/writer/commands/generate-document-outline.command.ts +17 -0
  31. package/writer/commands/index.ts +4 -0
  32. package/writer/commands/upload-writer-source.command.ts +18 -0
  33. package/writer/enums/index.ts +3 -0
  34. package/writer/enums/writer-document-stage.enum.ts +8 -0
  35. package/writer/enums/writer-source-origin.enum.ts +4 -0
  36. package/writer/enums/writer-source-status.enum.ts +5 -0
  37. package/writer/enums/writer-source-type.enum.ts +4 -0
  38. package/writer/models/index.ts +2 -0
  39. package/writer/models/writer-document-type.schema.ts +1 -1
  40. package/writer/models/writer-document.schema.ts +3 -0
  41. package/writer/models/writer-source-bibliographic-metadata.schema.ts +31 -0
  42. package/writer/models/writer-source.schema.ts +22 -0
  43. package/writer/queries/get-writer-document-sources.query.ts +15 -0
  44. package/writer/queries/index.ts +1 -0
  45. package/writer/routes/writer.routes.ts +5 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILE_TYPE = void 0;
4
+ var FILE_TYPE;
5
+ (function (FILE_TYPE) {
6
+ FILE_TYPE["PDF"] = "PDF";
7
+ FILE_TYPE["DOCX"] = "DOCX";
8
+ })(FILE_TYPE || (exports.FILE_TYPE = FILE_TYPE = {}));
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./reasoning-effort.enum"), exports);
18
18
  __exportStar(require("./user-reaction.enum"), exports);
19
19
  __exportStar(require("./tool-model-status.enum"), exports);
20
+ __exportStar(require("./file-type.enum"), exports);
@@ -14,7 +14,6 @@ var CreatePresentationCommand;
14
14
  languageId: zod_1.z.string(),
15
15
  prompt: zod_1.z.string(),
16
16
  slideCount: zod_1.z.number(),
17
- titlePage: models_1.PresentationTitlePageSchema.optional().nullable(),
18
17
  targetAudience: zod_1.z.nativeEnum(enums_1.PRESENTATION_TARGET_AUDIENCE).optional(),
19
18
  });
20
19
  CreatePresentationCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.PresentationSchema);
@@ -12,6 +12,7 @@ var GenerateSlidesCommand;
12
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
13
  tokenReservationId: zod_1.z.string().uuid(),
14
14
  precalculatedPrice: zod_1.z.number(),
15
+ titlePage: models_1.PresentationTitlePageSchema.optional().nullable(),
15
16
  });
16
17
  GenerateSlidesCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.PresentationSchema);
17
18
  })(GenerateSlidesCommand || (exports.GenerateSlidesCommand = GenerateSlidesCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectWriterDocumentSourcesCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var CollectWriterDocumentSourcesCommand;
8
+ (function (CollectWriterDocumentSourcesCommand) {
9
+ CollectWriterDocumentSourcesCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ });
14
+ CollectWriterDocumentSourcesCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.WriterDocumentSchema);
15
+ })(CollectWriterDocumentSourcesCommand || (exports.CollectWriterDocumentSourcesCommand = CollectWriterDocumentSourcesCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfirmSourceCitationMetadataCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const writer_source_schema_1 = require("../models/writer-source.schema");
7
+ const writer_source_bibliographic_metadata_schema_1 = require("../models/writer-source-bibliographic-metadata.schema");
8
+ var ConfirmSourceCitationMetadataCommand;
9
+ (function (ConfirmSourceCitationMetadataCommand) {
10
+ ConfirmSourceCitationMetadataCommand.RequestSchema = zod_1.z.object({
11
+ documentId: zod_1.z.string().uuid(),
12
+ sourceId: zod_1.z.string().uuid(),
13
+ bibliographicMetadata: writer_source_bibliographic_metadata_schema_1.WriterSourceBibliographicMetadataSchema,
14
+ userId: zod_1.z.string().uuid().nullable().optional(),
15
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
16
+ });
17
+ ConfirmSourceCitationMetadataCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(writer_source_schema_1.WriterSourceSchema);
18
+ })(ConfirmSourceCitationMetadataCommand || (exports.ConfirmSourceCitationMetadataCommand = ConfirmSourceCitationMetadataCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerateWriterDocumentOutlineCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var GenerateWriterDocumentOutlineCommand;
8
+ (function (GenerateWriterDocumentOutlineCommand) {
9
+ GenerateWriterDocumentOutlineCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ numPages: zod_1.z.number(),
12
+ description: zod_1.z.string().nullable().optional(),
13
+ userId: zod_1.z.string().uuid().nullable().optional(),
14
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
15
+ });
16
+ GenerateWriterDocumentOutlineCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.WriterDocumentSchema);
17
+ })(GenerateWriterDocumentOutlineCommand || (exports.GenerateWriterDocumentOutlineCommand = GenerateWriterDocumentOutlineCommand = {}));
@@ -22,6 +22,7 @@ __exportStar(require("./update-writer-document-title-page.command"), exports);
22
22
  __exportStar(require("./toggle-writer-document-title-page.command"), exports);
23
23
  __exportStar(require("./export-writer-document-as-docx.command"), exports);
24
24
  __exportStar(require("./generate-document-contents.command"), exports);
25
+ __exportStar(require("./generate-document-outline.command"), exports);
25
26
  __exportStar(require("./get-writer-content-generation-price.command"), exports);
26
27
  __exportStar(require("./writer-paraphrase.command"), exports);
27
28
  __exportStar(require("./writer-extend-text.command"), exports);
@@ -30,3 +31,6 @@ __exportStar(require("./writer-fix-errors.command"), exports);
30
31
  __exportStar(require("./writer-generate-text.command"), exports);
31
32
  __exportStar(require("./update-writer-document-contents.command"), exports);
32
33
  __exportStar(require("./set-reaction-writer-document.command"), exports);
34
+ __exportStar(require("./collect-sources.command"), exports);
35
+ __exportStar(require("./upload-writer-source.command"), exports);
36
+ __exportStar(require("./confirm-source-citation-metadata.command"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadWriterSourceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var UploadWriterSourceCommand;
8
+ (function (UploadWriterSourceCommand) {
9
+ UploadWriterSourceCommand.RequestSchema = zod_1.z.object({
10
+ documentId: zod_1.z.string().uuid(),
11
+ fileId: zod_1.z.string().uuid(),
12
+ fileUrl: zod_1.z.string().url(),
13
+ fileType: zod_1.z.enum(['PDF', 'DOCX']),
14
+ userId: zod_1.z.string().uuid().nullable().optional(),
15
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
16
+ });
17
+ UploadWriterSourceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.WriterSourceSchema);
18
+ })(UploadWriterSourceCommand || (exports.UploadWriterSourceCommand = UploadWriterSourceCommand = {}));
@@ -20,3 +20,6 @@ __exportStar(require("./writer-ai-action-type.enum"), exports);
20
20
  __exportStar(require("./writer-document-section-type.enum"), exports);
21
21
  __exportStar(require("./writer-document-stage.enum"), exports);
22
22
  __exportStar(require("./writer-content-generation-strategy.enum"), exports);
23
+ __exportStar(require("./writer-source-type.enum"), exports);
24
+ __exportStar(require("./writer-source-origin.enum"), exports);
25
+ __exportStar(require("./writer-source-status.enum"), exports);
@@ -4,9 +4,15 @@ exports.WRITER_DOCUMENT_STAGE = void 0;
4
4
  var WRITER_DOCUMENT_STAGE;
5
5
  (function (WRITER_DOCUMENT_STAGE) {
6
6
  WRITER_DOCUMENT_STAGE["CREATED"] = "CREATED";
7
+ WRITER_DOCUMENT_STAGE["ANALYZING_TOPIC"] = "ANALYZING_TOPIC";
8
+ WRITER_DOCUMENT_STAGE["TOPIC_ANALYZED"] = "TOPIC_ANALYZED";
9
+ WRITER_DOCUMENT_STAGE["TOPIC_ANALYSIS_FAILED"] = "TOPIC_ANALYSIS_FAILED";
7
10
  WRITER_DOCUMENT_STAGE["GENERATING_OUTLINE"] = "GENERATING_OUTLINE";
8
11
  WRITER_DOCUMENT_STAGE["OUTLINE_GENERATED"] = "OUTLINE_GENERATED";
9
12
  WRITER_DOCUMENT_STAGE["OUTLINE_GENERATION_FAILED"] = "OUTLINE_GENERATION_FAILED";
13
+ WRITER_DOCUMENT_STAGE["COLLECTING_SOURCES"] = "COLLECTING_SOURCES";
14
+ WRITER_DOCUMENT_STAGE["SOURCES_COLLECTED"] = "SOURCES_COLLECTED";
15
+ WRITER_DOCUMENT_STAGE["SOURCES_COLLECTION_FAILED"] = "SOURCES_COLLECTION_FAILED";
10
16
  WRITER_DOCUMENT_STAGE["GENERATING_CONTENT"] = "GENERATING_CONTENT";
11
17
  WRITER_DOCUMENT_STAGE["CONTENT_GENERATED"] = "CONTENT_GENERATED";
12
18
  WRITER_DOCUMENT_STAGE["CONTENT_GENERATION_FAILED"] = "CONTENT_GENERATION_FAILED";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_SOURCE_ORIGIN = void 0;
4
+ var WRITER_SOURCE_ORIGIN;
5
+ (function (WRITER_SOURCE_ORIGIN) {
6
+ WRITER_SOURCE_ORIGIN["WEB_SEARCH"] = "WEB_SEARCH";
7
+ WRITER_SOURCE_ORIGIN["USER_UPLOAD"] = "USER_UPLOAD";
8
+ })(WRITER_SOURCE_ORIGIN || (exports.WRITER_SOURCE_ORIGIN = WRITER_SOURCE_ORIGIN = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_SOURCE_STATUS = void 0;
4
+ var WRITER_SOURCE_STATUS;
5
+ (function (WRITER_SOURCE_STATUS) {
6
+ WRITER_SOURCE_STATUS["READY"] = "READY";
7
+ WRITER_SOURCE_STATUS["REQUIRES_CITATION_METADATA_CONFIRMATION"] = "REQUIRES_CITATION_METADATA_CONFIRMATION";
8
+ WRITER_SOURCE_STATUS["DISCARDED"] = "DISCARDED";
9
+ })(WRITER_SOURCE_STATUS || (exports.WRITER_SOURCE_STATUS = WRITER_SOURCE_STATUS = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_SOURCE_TYPE = void 0;
4
+ var WRITER_SOURCE_TYPE;
5
+ (function (WRITER_SOURCE_TYPE) {
6
+ WRITER_SOURCE_TYPE["JOURNAL_ARTICLE"] = "JOURNAL_ARTICLE";
7
+ WRITER_SOURCE_TYPE["BOOK"] = "BOOK";
8
+ })(WRITER_SOURCE_TYPE || (exports.WRITER_SOURCE_TYPE = WRITER_SOURCE_TYPE = {}));
@@ -21,3 +21,5 @@ __exportStar(require("./writer-document-outline.schema"), exports);
21
21
  __exportStar(require("./writer-document-title-page.schema"), exports);
22
22
  __exportStar(require("./writer-document.schema"), exports);
23
23
  __exportStar(require("./writer-document-type.schema"), exports);
24
+ __exportStar(require("./writer-source.schema"), exports);
25
+ __exportStar(require("./writer-source-bibliographic-metadata.schema"), exports);
@@ -10,9 +10,9 @@ exports.WriterDocumentTypeSchema = zod_1.z.object({
10
10
  order: zod_1.z.number(),
11
11
  minPages: zod_1.z.number(),
12
12
  maxPages: zod_1.z.number(),
13
+ skipSources: zod_1.z.boolean(),
13
14
  pageRange: zod_1.z.array(zod_1.z.number()),
14
15
  needsTableOfContents: zod_1.z.boolean(),
15
- needsCitations: zod_1.z.boolean(),
16
16
  createdAt: zod_1.z.date(),
17
17
  updatedAt: zod_1.z.date(),
18
18
  });
@@ -22,6 +22,9 @@ exports.WriterDocumentSchema = zod_1.z.object({
22
22
  modelId: zod_1.z.string().nullable(),
23
23
  reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
24
24
  dislikeReason: zod_1.z.string().nullable(),
25
+ description: zod_1.z.string().nullable(),
26
+ internalError: zod_1.z.string().nullable(),
27
+ skipSources: zod_1.z.boolean(),
25
28
  pages: zod_1.z.number(),
26
29
  isDeleted: zod_1.z.boolean(),
27
30
  tokenReservationId: zod_1.z.string().nullable().optional(),
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterSourceBibliographicMetadataSchema = exports.JournalArticleBibliographicMetadataSchema = exports.BookBibliographicMetadataSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enums_1 = require("../enums");
6
+ exports.BookBibliographicMetadataSchema = zod_1.z.object({
7
+ type: zod_1.z.literal(enums_1.WRITER_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(enums_1.WRITER_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.WriterSourceBibliographicMetadataSchema = zod_1.z.discriminatedUnion('type', [
25
+ exports.BookBibliographicMetadataSchema,
26
+ exports.JournalArticleBibliographicMetadataSchema,
27
+ ]);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterSourceSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enums_1 = require("../enums");
6
+ const writer_source_bibliographic_metadata_schema_1 = require("./writer-source-bibliographic-metadata.schema");
7
+ exports.WriterSourceSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ query: zod_1.z.string().nullable(),
10
+ url: zod_1.z.string(),
11
+ snippet: zod_1.z.string().nullable(),
12
+ inclusionReason: zod_1.z.string().nullable(),
13
+ sourceOrigin: zod_1.z.nativeEnum(enums_1.WRITER_SOURCE_ORIGIN),
14
+ content: zod_1.z.string().nullable(),
15
+ documentId: zod_1.z.string().uuid(),
16
+ fileId: zod_1.z.string().nullable(),
17
+ citation: zod_1.z.string().nullable(),
18
+ status: zod_1.z.nativeEnum(enums_1.WRITER_SOURCE_STATUS),
19
+ bibliographicMetadata: writer_source_bibliographic_metadata_schema_1.WriterSourceBibliographicMetadataSchema.nullable(),
20
+ createdAt: zod_1.z.date(),
21
+ updatedAt: zod_1.z.date(),
22
+ });
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetWriterDocumentSourcesQueryContract = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var GetWriterDocumentSourcesQueryContract;
8
+ (function (GetWriterDocumentSourcesQueryContract) {
9
+ GetWriterDocumentSourcesQueryContract.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ });
14
+ GetWriterDocumentSourcesQueryContract.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.array(models_1.WriterSourceSchema));
15
+ })(GetWriterDocumentSourcesQueryContract || (exports.GetWriterDocumentSourcesQueryContract = GetWriterDocumentSourcesQueryContract = {}));
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./find-writer-documents.query"), exports);
18
18
  __exportStar(require("./get-writer-config.query"), exports);
19
19
  __exportStar(require("./find-writer-document-by-uuid.query"), exports);
20
+ __exportStar(require("./get-writer-document-sources.query"), exports);
@@ -13,6 +13,11 @@ exports.WRITER_AMQP_ROUTES = {
13
13
  TOGGLE_DOCUMENT_TITLE_PAGE: 'tools.writer.toggle-document-title-page.rpc',
14
14
  UPDATE_DOCUMENT_CONTENTS: 'tools.writer.update-document-contents.rpc',
15
15
  GENERATE_DOCUMENT_CONTENTS: 'tools.writer.generate-document-contents.rpc',
16
+ GENERATE_DOCUMENT_OUTLINE: 'tools.writer.generate-document-outline.rpc',
17
+ COLLECT_SOURCES: 'tools.writer.collect-sources.rpc',
18
+ GET_DOCUMENT_SOURCES: 'tools.writer.get-document-sources.rpc',
19
+ UPLOAD_SOURCE: 'tools.writer.upload-source.rpc',
20
+ CONFIRM_SOURCE_CITATION_METADATA: 'tools.writer.confirm-source-citation-metadata.rpc',
16
21
  GET_CONTENT_GENERATION_PRICE: 'tools.writer.content-generation.get-price.rpc',
17
22
  PARAPHRASE: 'tools.writer.actions.paraphrase.rpc',
18
23
  EXTEND_TEXT: 'tools.writer.actions.extend-text.rpc',
@@ -0,0 +1,4 @@
1
+ export enum FILE_TYPE {
2
+ PDF = 'PDF',
3
+ DOCX = 'DOCX',
4
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './reasoning-effort.enum';
2
2
  export * from './user-reaction.enum';
3
3
  export * from './tool-model-status.enum';
4
+ export * from './file-type.enum';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ICommandResponseSchema } from '../../common';
3
- import { PresentationSchema, PresentationTitlePageSchema } from '../models';
3
+ import { PresentationSchema } from '../models';
4
4
  import { PRESENTATION_TARGET_AUDIENCE } from '../enums';
5
5
 
6
6
  export namespace CreatePresentationCommand {
@@ -11,7 +11,6 @@ export namespace CreatePresentationCommand {
11
11
  languageId: z.string(),
12
12
  prompt: z.string(),
13
13
  slideCount: z.number(),
14
- titlePage: PresentationTitlePageSchema.optional().nullable(),
15
14
  targetAudience: z.nativeEnum(PRESENTATION_TARGET_AUDIENCE).optional(),
16
15
  });
17
16
  export type Request = z.infer<typeof RequestSchema>;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ICommandResponseSchema } from '../../common';
3
- import { PresentationSchema } from '../models';
3
+ import { PresentationSchema, PresentationTitlePageSchema } from '../models';
4
4
 
5
5
  export namespace GenerateSlidesCommand {
6
6
  export const RequestSchema = z.object({
@@ -9,6 +9,7 @@ export namespace GenerateSlidesCommand {
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  tokenReservationId: z.string().uuid(),
11
11
  precalculatedPrice: z.number(),
12
+ titlePage: PresentationTitlePageSchema.optional().nullable(),
12
13
  });
13
14
  export type Request = z.infer<typeof RequestSchema>;
14
15
 
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { WriterDocumentSchema } from '../models';
4
+
5
+ export namespace CollectWriterDocumentSourcesCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ });
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = ICommandResponseSchema(WriterDocumentSchema);
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { WriterSourceSchema } from '../models/writer-source.schema';
4
+ import { WriterSourceBibliographicMetadataSchema } from '../models/writer-source-bibliographic-metadata.schema';
5
+
6
+ export namespace ConfirmSourceCitationMetadataCommand {
7
+ export const RequestSchema = z.object({
8
+ documentId: z.string().uuid(),
9
+ sourceId: z.string().uuid(),
10
+ bibliographicMetadata: WriterSourceBibliographicMetadataSchema,
11
+ userId: z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: z.string().uuid().nullable().optional(),
13
+ });
14
+ export type Request = z.infer<typeof RequestSchema>;
15
+
16
+ export const ResponseSchema = ICommandResponseSchema(WriterSourceSchema);
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { WriterDocumentSchema } from '../models';
4
+
5
+ export namespace GenerateWriterDocumentOutlineCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ numPages: z.number(),
9
+ description: z.string().nullable().optional(),
10
+ userId: z.string().uuid().nullable().optional(),
11
+ unregisteredUserId: z.string().uuid().nullable().optional(),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = ICommandResponseSchema(WriterDocumentSchema);
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -6,6 +6,7 @@ export * from './update-writer-document-title-page.command';
6
6
  export * from './toggle-writer-document-title-page.command';
7
7
  export * from './export-writer-document-as-docx.command';
8
8
  export * from './generate-document-contents.command';
9
+ export * from './generate-document-outline.command';
9
10
  export * from './get-writer-content-generation-price.command';
10
11
  export * from './writer-paraphrase.command';
11
12
  export * from './writer-extend-text.command';
@@ -14,3 +15,6 @@ export * from './writer-fix-errors.command';
14
15
  export * from './writer-generate-text.command';
15
16
  export * from './update-writer-document-contents.command';
16
17
  export * from './set-reaction-writer-document.command';
18
+ export * from './collect-sources.command';
19
+ export * from './upload-writer-source.command';
20
+ export * from './confirm-source-citation-metadata.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { WriterSourceSchema } from '../models';
4
+
5
+ export namespace UploadWriterSourceCommand {
6
+ export const RequestSchema = z.object({
7
+ documentId: z.string().uuid(),
8
+ fileId: z.string().uuid(),
9
+ fileUrl: z.string().url(),
10
+ fileType: z.enum(['PDF', 'DOCX']),
11
+ userId: z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: z.string().uuid().nullable().optional(),
13
+ });
14
+ export type Request = z.infer<typeof RequestSchema>;
15
+
16
+ export const ResponseSchema = ICommandResponseSchema(WriterSourceSchema);
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -4,3 +4,6 @@ export * from './writer-ai-action-type.enum';
4
4
  export * from './writer-document-section-type.enum';
5
5
  export * from './writer-document-stage.enum';
6
6
  export * from './writer-content-generation-strategy.enum';
7
+ export * from './writer-source-type.enum';
8
+ export * from './writer-source-origin.enum';
9
+ export * from './writer-source-status.enum';
@@ -1,10 +1,18 @@
1
1
  export enum WRITER_DOCUMENT_STAGE {
2
2
  CREATED = 'CREATED',
3
3
 
4
+ ANALYZING_TOPIC = 'ANALYZING_TOPIC',
5
+ TOPIC_ANALYZED = 'TOPIC_ANALYZED',
6
+ TOPIC_ANALYSIS_FAILED = 'TOPIC_ANALYSIS_FAILED',
7
+
4
8
  GENERATING_OUTLINE = 'GENERATING_OUTLINE',
5
9
  OUTLINE_GENERATED = 'OUTLINE_GENERATED',
6
10
  OUTLINE_GENERATION_FAILED = 'OUTLINE_GENERATION_FAILED',
7
11
 
12
+ COLLECTING_SOURCES = 'COLLECTING_SOURCES',
13
+ SOURCES_COLLECTED = 'SOURCES_COLLECTED',
14
+ SOURCES_COLLECTION_FAILED = 'SOURCES_COLLECTION_FAILED',
15
+
8
16
  GENERATING_CONTENT = 'GENERATING_CONTENT',
9
17
  CONTENT_GENERATED = 'CONTENT_GENERATED',
10
18
  CONTENT_GENERATION_FAILED = 'CONTENT_GENERATION_FAILED',
@@ -0,0 +1,4 @@
1
+ export enum WRITER_SOURCE_ORIGIN {
2
+ WEB_SEARCH = 'WEB_SEARCH',
3
+ USER_UPLOAD = 'USER_UPLOAD',
4
+ }
@@ -0,0 +1,5 @@
1
+ export enum WRITER_SOURCE_STATUS {
2
+ READY = 'READY',
3
+ REQUIRES_CITATION_METADATA_CONFIRMATION = 'REQUIRES_CITATION_METADATA_CONFIRMATION',
4
+ DISCARDED = 'DISCARDED',
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum WRITER_SOURCE_TYPE {
2
+ JOURNAL_ARTICLE = 'JOURNAL_ARTICLE',
3
+ BOOK = 'BOOK',
4
+ }
@@ -5,3 +5,5 @@ export * from './writer-document-outline.schema';
5
5
  export * from './writer-document-title-page.schema';
6
6
  export * from './writer-document.schema';
7
7
  export * from './writer-document-type.schema';
8
+ export * from './writer-source.schema';
9
+ export * from './writer-source-bibliographic-metadata.schema';
@@ -8,9 +8,9 @@ export const WriterDocumentTypeSchema = z.object({
8
8
  order: z.number(),
9
9
  minPages: z.number(),
10
10
  maxPages: z.number(),
11
+ skipSources: z.boolean(),
11
12
  pageRange: z.array(z.number()),
12
13
  needsTableOfContents: z.boolean(),
13
- needsCitations: z.boolean(),
14
14
  createdAt: z.date(),
15
15
  updatedAt: z.date(),
16
16
  });
@@ -20,6 +20,9 @@ export const WriterDocumentSchema = z.object({
20
20
  modelId: z.string().nullable(),
21
21
  reaction: z.nativeEnum(USER_REACTION).nullable(),
22
22
  dislikeReason: z.string().nullable(),
23
+ description: z.string().nullable(),
24
+ internalError: z.string().nullable(),
25
+ skipSources: z.boolean(),
23
26
  pages: z.number(),
24
27
  isDeleted: z.boolean(),
25
28
  tokenReservationId: z.string().nullable().optional(),
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { WRITER_SOURCE_TYPE } from '../enums';
3
+
4
+ export const BookBibliographicMetadataSchema = z.object({
5
+ type: z.literal(WRITER_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
+
14
+ export const JournalArticleBibliographicMetadataSchema = z.object({
15
+ type: z.literal(WRITER_SOURCE_TYPE.JOURNAL_ARTICLE),
16
+ title: z.string(),
17
+ authors: z.string(),
18
+ year: z.number(),
19
+ journalName: z.string(),
20
+ issueNumber: z.string(),
21
+ pageRange: z.string(),
22
+ });
23
+
24
+ export const WriterSourceBibliographicMetadataSchema = z.discriminatedUnion('type', [
25
+ BookBibliographicMetadataSchema,
26
+ JournalArticleBibliographicMetadataSchema,
27
+ ]);
28
+
29
+ export type WriterSourceBibliographicMetadata = z.infer<
30
+ typeof WriterSourceBibliographicMetadataSchema
31
+ >;
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { WRITER_SOURCE_ORIGIN, WRITER_SOURCE_STATUS } from '../enums';
3
+ import { WriterSourceBibliographicMetadataSchema } from './writer-source-bibliographic-metadata.schema';
4
+
5
+ export const WriterSourceSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ query: z.string().nullable(),
8
+ url: z.string(),
9
+ snippet: z.string().nullable(),
10
+ inclusionReason: z.string().nullable(),
11
+ sourceOrigin: z.nativeEnum(WRITER_SOURCE_ORIGIN),
12
+ content: z.string().nullable(),
13
+ documentId: z.string().uuid(),
14
+ fileId: z.string().nullable(),
15
+ citation: z.string().nullable(),
16
+ status: z.nativeEnum(WRITER_SOURCE_STATUS),
17
+ bibliographicMetadata: WriterSourceBibliographicMetadataSchema.nullable(),
18
+ createdAt: z.date(),
19
+ updatedAt: z.date(),
20
+ });
21
+
22
+ export type WriterSource = z.infer<typeof WriterSourceSchema>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { WriterSourceSchema } from '../models';
4
+
5
+ export namespace GetWriterDocumentSourcesQueryContract {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ });
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = ICommandResponseSchema(z.array(WriterSourceSchema));
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './find-writer-documents.query';
2
2
  export * from './get-writer-config.query';
3
3
  export * from './find-writer-document-by-uuid.query';
4
+ export * from './get-writer-document-sources.query';
@@ -10,6 +10,11 @@ export const WRITER_AMQP_ROUTES = {
10
10
  TOGGLE_DOCUMENT_TITLE_PAGE: 'tools.writer.toggle-document-title-page.rpc',
11
11
  UPDATE_DOCUMENT_CONTENTS: 'tools.writer.update-document-contents.rpc',
12
12
  GENERATE_DOCUMENT_CONTENTS: 'tools.writer.generate-document-contents.rpc',
13
+ GENERATE_DOCUMENT_OUTLINE: 'tools.writer.generate-document-outline.rpc',
14
+ COLLECT_SOURCES: 'tools.writer.collect-sources.rpc',
15
+ GET_DOCUMENT_SOURCES: 'tools.writer.get-document-sources.rpc',
16
+ UPLOAD_SOURCE: 'tools.writer.upload-source.rpc',
17
+ CONFIRM_SOURCE_CITATION_METADATA: 'tools.writer.confirm-source-citation-metadata.rpc',
13
18
  GET_CONTENT_GENERATION_PRICE: 'tools.writer.content-generation.get-price.rpc',
14
19
  PARAPHRASE: 'tools.writer.actions.paraphrase.rpc',
15
20
  EXTEND_TEXT: 'tools.writer.actions.extend-text.rpc',