@purpleschool/gptbot-tools 0.1.12 → 0.1.14

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 (49) 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 +1 -0
  4. package/build/presentation/models/presentation-template.schema.js +1 -0
  5. package/build/presentation/models/slide-content-edit.schema.js +12 -6
  6. package/build/presentation/models/slide-content.schema.js +18 -12
  7. package/build/writer/commands/collect-sources.command.js +15 -0
  8. package/build/writer/commands/confirm-source-citation-metadata.command.js +18 -0
  9. package/build/writer/commands/generate-document-outline.command.js +17 -0
  10. package/build/writer/commands/index.js +4 -0
  11. package/build/writer/commands/upload-writer-source.command.js +18 -0
  12. package/build/writer/enums/index.js +3 -0
  13. package/build/writer/enums/writer-document-stage.enum.js +6 -0
  14. package/build/writer/enums/writer-source-origin.enum.js +8 -0
  15. package/build/writer/enums/writer-source-status.enum.js +9 -0
  16. package/build/writer/enums/writer-source-type.enum.js +8 -0
  17. package/build/writer/models/index.js +2 -0
  18. package/build/writer/models/writer-document-type.schema.js +1 -1
  19. package/build/writer/models/writer-document.schema.js +3 -0
  20. package/build/writer/models/writer-source-bibliographic-metadata.schema.js +27 -0
  21. package/build/writer/models/writer-source.schema.js +22 -0
  22. package/build/writer/queries/get-writer-document-sources.query.js +15 -0
  23. package/build/writer/queries/index.js +1 -0
  24. package/build/writer/routes/writer.routes.js +5 -0
  25. package/common/enums/file-type.enum.ts +4 -0
  26. package/common/enums/index.ts +1 -0
  27. package/package.json +1 -1
  28. package/presentation/commands/create-presentation.command.ts +1 -0
  29. package/presentation/models/presentation-template.schema.ts +1 -0
  30. package/presentation/models/slide-content-edit.schema.ts +18 -12
  31. package/presentation/models/slide-content.schema.ts +25 -19
  32. package/writer/commands/collect-sources.command.ts +15 -0
  33. package/writer/commands/confirm-source-citation-metadata.command.ts +18 -0
  34. package/writer/commands/generate-document-outline.command.ts +17 -0
  35. package/writer/commands/index.ts +4 -0
  36. package/writer/commands/upload-writer-source.command.ts +18 -0
  37. package/writer/enums/index.ts +3 -0
  38. package/writer/enums/writer-document-stage.enum.ts +8 -0
  39. package/writer/enums/writer-source-origin.enum.ts +4 -0
  40. package/writer/enums/writer-source-status.enum.ts +5 -0
  41. package/writer/enums/writer-source-type.enum.ts +4 -0
  42. package/writer/models/index.ts +2 -0
  43. package/writer/models/writer-document-type.schema.ts +1 -1
  44. package/writer/models/writer-document.schema.ts +3 -0
  45. package/writer/models/writer-source-bibliographic-metadata.schema.ts +31 -0
  46. package/writer/models/writer-source.schema.ts +22 -0
  47. package/writer/queries/get-writer-document-sources.query.ts +15 -0
  48. package/writer/queries/index.ts +1 -0
  49. 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);
@@ -15,6 +15,7 @@ var CreatePresentationCommand;
15
15
  prompt: zod_1.z.string(),
16
16
  slideCount: zod_1.z.number(),
17
17
  targetAudience: zod_1.z.nativeEnum(enums_1.PRESENTATION_TARGET_AUDIENCE).optional(),
18
+ userHasActiveSubscriptionOrProduct: zod_1.z.boolean(),
18
19
  });
19
20
  CreatePresentationCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.PresentationSchema);
20
21
  })(CreatePresentationCommand || (exports.CreatePresentationCommand = CreatePresentationCommand = {}));
@@ -9,6 +9,7 @@ exports.PresentationTemplateSchema = zod_1.z.object({
9
9
  order: zod_1.z.number(),
10
10
  price: zod_1.z.number(),
11
11
  imagePlaceholder: zod_1.z.string(),
12
+ isPremium: zod_1.z.boolean(),
12
13
  createdAt: zod_1.z.date(),
13
14
  updatedAt: zod_1.z.date(),
14
15
  });
@@ -33,18 +33,24 @@ exports.CoverSlideDataUserEditSchema = zod_1.default.object({
33
33
  exports.ThankYouSlideDataUserEditSchema = zod_1.default.object({
34
34
  contentType: zod_1.default.literal(enums_1.SLIDE_CONTENT_TYPE.THANK_YOU),
35
35
  title: zod_1.default.string().min(1).max(500),
36
- author: zod_1.default.object({
36
+ author: zod_1.default
37
+ .object({
37
38
  label: zod_1.default.string().min(1).max(100),
38
39
  value: zod_1.default.string().min(1).max(200),
39
- }),
40
- date: zod_1.default.object({
40
+ })
41
+ .optional(),
42
+ date: zod_1.default
43
+ .object({
41
44
  label: zod_1.default.string().min(1).max(100),
42
45
  value: zod_1.default.string().min(1).max(200),
43
- }),
44
- email: zod_1.default.object({
46
+ })
47
+ .optional(),
48
+ email: zod_1.default
49
+ .object({
45
50
  label: zod_1.default.string().min(1).max(100),
46
51
  value: zod_1.default.string().min(1).max(200),
47
- }),
52
+ })
53
+ .optional(),
48
54
  version: zod_1.default.literal(1),
49
55
  });
50
56
  exports.TextSlideDataUserEditSchema = zod_1.default.object({
@@ -63,20 +63,26 @@ exports.ThankYouSlideDataSchema = zod_1.z.object({
63
63
  .describe('"Thank you for your attention" in presentation\'s language')
64
64
  .min(10)
65
65
  .max(150),
66
- author: zod_1.z.object({
67
- label: zod_1.z.string().describe('"Author" in presentation\'s language'),
68
- value: zod_1.z.string().describe('"Author of the presentation" in presentation\'s language'),
69
- }),
70
- date: zod_1.z.object({
71
- label: zod_1.z.string().describe('"Date" in presentation\'s language'),
66
+ author: zod_1.z
67
+ .object({
68
+ label: zod_1.z.string().describe('Literal "Author" in presentation\'s language'),
69
+ value: zod_1.z.string().describe('Author value from titlePage if provided'),
70
+ })
71
+ .optional(),
72
+ date: zod_1.z
73
+ .object({
74
+ label: zod_1.z.string().describe('Literal "Date" in presentation\'s language'),
72
75
  value: zod_1.z
73
76
  .string()
74
- .describe('Date of the presentation in the "dd month yyyy" format in presentation\'s locale'),
75
- }),
76
- email: zod_1.z.object({
77
- label: zod_1.z.string().describe('Just default word "Email"'),
78
- value: zod_1.z.string().describe('Just default "email@example.com"'),
79
- }),
77
+ .describe('Date from titlePage in the "dd month yyyy" format in presentation\'s locale'),
78
+ })
79
+ .optional(),
80
+ email: zod_1.z
81
+ .object({
82
+ label: zod_1.z.string().describe('Localized contact/email label'),
83
+ value: zod_1.z.string().describe('Email value from titlePage if provided'),
84
+ })
85
+ .optional(),
80
86
  version: zod_1.z.literal(1),
81
87
  });
82
88
  exports.StructuredListSlideDataSchema = zod_1.z.object({
@@ -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.12",
3
+ "version": "0.1.14",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -12,6 +12,7 @@ export namespace CreatePresentationCommand {
12
12
  prompt: z.string(),
13
13
  slideCount: z.number(),
14
14
  targetAudience: z.nativeEnum(PRESENTATION_TARGET_AUDIENCE).optional(),
15
+ userHasActiveSubscriptionOrProduct: z.boolean(),
15
16
  });
16
17
  export type Request = z.infer<typeof RequestSchema>;
17
18
 
@@ -7,6 +7,7 @@ export const PresentationTemplateSchema = z.object({
7
7
  order: z.number(),
8
8
  price: z.number(),
9
9
  imagePlaceholder: z.string(),
10
+ isPremium: z.boolean(),
10
11
  createdAt: z.date(),
11
12
  updatedAt: z.date(),
12
13
  });
@@ -43,18 +43,24 @@ export const CoverSlideDataUserEditSchema = z.object({
43
43
  export const ThankYouSlideDataUserEditSchema = z.object({
44
44
  contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
45
45
  title: z.string().min(1).max(500),
46
- author: z.object({
47
- label: z.string().min(1).max(100),
48
- value: z.string().min(1).max(200),
49
- }),
50
- date: z.object({
51
- label: z.string().min(1).max(100),
52
- value: z.string().min(1).max(200),
53
- }),
54
- email: z.object({
55
- label: z.string().min(1).max(100),
56
- value: z.string().min(1).max(200),
57
- }),
46
+ author: z
47
+ .object({
48
+ label: z.string().min(1).max(100),
49
+ value: z.string().min(1).max(200),
50
+ })
51
+ .optional(),
52
+ date: z
53
+ .object({
54
+ label: z.string().min(1).max(100),
55
+ value: z.string().min(1).max(200),
56
+ })
57
+ .optional(),
58
+ email: z
59
+ .object({
60
+ label: z.string().min(1).max(100),
61
+ value: z.string().min(1).max(200),
62
+ })
63
+ .optional(),
58
64
  version: z.literal(1),
59
65
  }) satisfies z.ZodType<IThankYouSlideDataStructure>;
60
66
 
@@ -47,9 +47,9 @@ export interface ICoverSlideDataStructure {
47
47
  export interface IThankYouSlideDataStructure {
48
48
  contentType: SLIDE_CONTENT_TYPE.THANK_YOU;
49
49
  title: string;
50
- author: { label: string; value: string };
51
- date: { label: string; value: string };
52
- email: { label: string; value: string };
50
+ author?: { label: string; value: string };
51
+ date?: { label: string; value: string };
52
+ email?: { label: string; value: string };
53
53
  version: 1;
54
54
  }
55
55
 
@@ -170,22 +170,28 @@ export const ThankYouSlideDataSchema = z.object({
170
170
  .describe('"Thank you for your attention" in presentation\'s language')
171
171
  .min(10)
172
172
  .max(150),
173
- author: z.object({
174
- label: z.string().describe('"Author" in presentation\'s language'),
175
- value: z.string().describe('"Author of the presentation" in presentation\'s language'),
176
- }),
177
- date: z.object({
178
- label: z.string().describe('"Date" in presentation\'s language'),
179
- value: z
180
- .string()
181
- .describe(
182
- 'Date of the presentation in the "dd month yyyy" format in presentation\'s locale',
183
- ),
184
- }),
185
- email: z.object({
186
- label: z.string().describe('Just default word "Email"'),
187
- value: z.string().describe('Just default "email@example.com"'),
188
- }),
173
+ author: z
174
+ .object({
175
+ label: z.string().describe('Literal "Author" in presentation\'s language'),
176
+ value: z.string().describe('Author value from titlePage if provided'),
177
+ })
178
+ .optional(),
179
+ date: z
180
+ .object({
181
+ label: z.string().describe('Literal "Date" in presentation\'s language'),
182
+ value: z
183
+ .string()
184
+ .describe(
185
+ 'Date from titlePage in the "dd month yyyy" format in presentation\'s locale',
186
+ ),
187
+ })
188
+ .optional(),
189
+ email: z
190
+ .object({
191
+ label: z.string().describe('Localized contact/email label'),
192
+ value: z.string().describe('Email value from titlePage if provided'),
193
+ })
194
+ .optional(),
189
195
  version: z.literal(1),
190
196
  }) satisfies z.ZodType<IThankYouSlideDataStructure>;
191
197
  export type ThankYouSlideData = z.infer<typeof ThankYouSlideDataSchema>;
@@ -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',