@purpleschool/gptbot 0.7.47 → 0.7.48

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 (81) hide show
  1. package/api/controllers/http/index.ts +1 -0
  2. package/api/controllers/http/writer.ts +20 -0
  3. package/build/api/controllers/http/index.js +1 -0
  4. package/build/api/controllers/http/writer.js +22 -0
  5. package/build/commands/chat/check-limit.command.js +4 -0
  6. package/build/commands/tools/index.js +1 -0
  7. package/build/commands/tools/writer/create-writer-document.command.js +16 -0
  8. package/build/commands/tools/writer/delete-all-writer-documents.command.js +8 -0
  9. package/build/commands/tools/writer/delete-writer-document-by-uuid.command.js +11 -0
  10. package/build/commands/tools/writer/export-writer-document-as-docx.command.js +15 -0
  11. package/build/commands/tools/writer/find-writer-document-by-uuid.command.js +14 -0
  12. package/build/commands/tools/writer/find-writer-documents.command.js +18 -0
  13. package/build/commands/tools/writer/generate-writer-document-contents.command.js +14 -0
  14. package/build/commands/tools/writer/get-writer-tool-config.command.js +11 -0
  15. package/build/commands/tools/writer/index.js +31 -0
  16. package/build/commands/tools/writer/update-writer-document-contents.command.js +18 -0
  17. package/build/commands/tools/writer/update-writer-document-outline.command.js +17 -0
  18. package/build/commands/tools/writer/writer-extend-text.command.js +18 -0
  19. package/build/commands/tools/writer/writer-fix-errors.command.js +18 -0
  20. package/build/commands/tools/writer/writer-generate-text.command.js +21 -0
  21. package/build/commands/tools/writer/writer-paraphrase.command.js +18 -0
  22. package/build/commands/tools/writer/writer-shorten-text.command.js +18 -0
  23. package/build/constants/errors/errors.js +115 -30
  24. package/build/constants/index.js +1 -0
  25. package/build/constants/writer/enums/index.js +20 -0
  26. package/build/constants/writer/enums/writer-ai-action-pricing-type.enum.js +8 -0
  27. package/build/constants/writer/enums/writer-ai-action-type.enum.js +11 -0
  28. package/build/constants/writer/enums/writer-document-section-type.enum.js +9 -0
  29. package/build/constants/writer/enums/writer-document-stage.enum.js +14 -0
  30. package/build/constants/writer/index.js +17 -0
  31. package/build/helpers/index.js +1 -0
  32. package/build/helpers/writer/calculate-page-count.util.js +37 -0
  33. package/build/helpers/writer/calculate-writer-ai-action-price.util.js +16 -0
  34. package/build/helpers/writer/calculate-writer-content-generation-price.util.js +6 -0
  35. package/build/helpers/writer/index.js +19 -0
  36. package/build/models/tools/index.js +1 -0
  37. package/build/models/tools/writer/index.js +21 -0
  38. package/build/models/tools/writer/writer-ai-action.schema.js +26 -0
  39. package/build/models/tools/writer/writer-config.schema.js +11 -0
  40. package/build/models/tools/writer/writer-document-outline.schema.js +21 -0
  41. package/build/models/tools/writer/writer-document-type.schema.js +16 -0
  42. package/build/models/tools/writer/writer-document.schema.js +22 -0
  43. package/commands/chat/check-limit.command.ts +4 -0
  44. package/commands/tools/index.ts +1 -0
  45. package/commands/tools/writer/create-writer-document.command.ts +16 -0
  46. package/commands/tools/writer/delete-all-writer-documents.command.ts +6 -0
  47. package/commands/tools/writer/delete-writer-document-by-uuid.command.ts +11 -0
  48. package/commands/tools/writer/export-writer-document-as-docx.command.ts +15 -0
  49. package/commands/tools/writer/find-writer-document-by-uuid.command.ts +14 -0
  50. package/commands/tools/writer/find-writer-documents.command.ts +18 -0
  51. package/commands/tools/writer/generate-writer-document-contents.command.ts +14 -0
  52. package/commands/tools/writer/get-writer-tool-config.command.ts +10 -0
  53. package/commands/tools/writer/index.ts +15 -0
  54. package/commands/tools/writer/update-writer-document-contents.command.ts +20 -0
  55. package/commands/tools/writer/update-writer-document-outline.command.ts +19 -0
  56. package/commands/tools/writer/writer-extend-text.command.ts +20 -0
  57. package/commands/tools/writer/writer-fix-errors.command.ts +20 -0
  58. package/commands/tools/writer/writer-generate-text.command.ts +23 -0
  59. package/commands/tools/writer/writer-paraphrase.command.ts +20 -0
  60. package/commands/tools/writer/writer-shorten-text.command.ts +20 -0
  61. package/constants/errors/errors.ts +115 -30
  62. package/constants/index.ts +1 -0
  63. package/constants/writer/enums/index.ts +4 -0
  64. package/constants/writer/enums/writer-ai-action-pricing-type.enum.ts +4 -0
  65. package/constants/writer/enums/writer-ai-action-type.enum.ts +7 -0
  66. package/constants/writer/enums/writer-document-section-type.enum.ts +5 -0
  67. package/constants/writer/enums/writer-document-stage.enum.ts +13 -0
  68. package/constants/writer/index.ts +1 -0
  69. package/helpers/index.ts +1 -0
  70. package/helpers/writer/calculate-page-count.util.ts +46 -0
  71. package/helpers/writer/calculate-writer-ai-action-price.util.ts +20 -0
  72. package/helpers/writer/calculate-writer-content-generation-price.util.ts +3 -0
  73. package/helpers/writer/index.ts +3 -0
  74. package/models/tools/index.ts +1 -0
  75. package/models/tools/writer/index.ts +5 -0
  76. package/models/tools/writer/writer-ai-action.schema.ts +27 -0
  77. package/models/tools/writer/writer-config.schema.ts +10 -0
  78. package/models/tools/writer/writer-document-outline.schema.ts +28 -0
  79. package/models/tools/writer/writer-document-type.schema.ts +15 -0
  80. package/models/tools/writer/writer-document.schema.ts +21 -0
  81. package/package.json +1 -1
@@ -47,6 +47,7 @@ __exportStar(require("./promocode"), exports);
47
47
  __exportStar(require("./ui-notification"), exports);
48
48
  __exportStar(require("./review"), exports);
49
49
  __exportStar(require("./tool-video"), exports);
50
+ __exportStar(require("./writer"), exports);
50
51
  __exportStar(require("./tool-image-editor"), exports);
51
52
  __exportStar(require("./feedback"), exports);
52
53
  __exportStar(require("./daily-streak"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./writer-document-section-type.enum"), exports);
18
+ __exportStar(require("./writer-document-stage.enum"), exports);
19
+ __exportStar(require("./writer-ai-action-pricing-type.enum"), exports);
20
+ __exportStar(require("./writer-ai-action-type.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_AI_ACTION_PRICING_TYPE = void 0;
4
+ var WRITER_AI_ACTION_PRICING_TYPE;
5
+ (function (WRITER_AI_ACTION_PRICING_TYPE) {
6
+ WRITER_AI_ACTION_PRICING_TYPE["PER_CHARACTER"] = "PER_CHARACTER";
7
+ WRITER_AI_ACTION_PRICING_TYPE["FLAT"] = "FLAT";
8
+ })(WRITER_AI_ACTION_PRICING_TYPE || (exports.WRITER_AI_ACTION_PRICING_TYPE = WRITER_AI_ACTION_PRICING_TYPE = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_AI_ACTION_TYPE = void 0;
4
+ var WRITER_AI_ACTION_TYPE;
5
+ (function (WRITER_AI_ACTION_TYPE) {
6
+ WRITER_AI_ACTION_TYPE["PARAPHRASE"] = "PARAPHRASE";
7
+ WRITER_AI_ACTION_TYPE["EXTEND_TEXT"] = "EXTEND_TEXT";
8
+ WRITER_AI_ACTION_TYPE["SHORTEN_TEXT"] = "SHORTEN_TEXT";
9
+ WRITER_AI_ACTION_TYPE["GENERATE_TEXT"] = "GENERATE_TEXT";
10
+ WRITER_AI_ACTION_TYPE["FIX_ERRORS"] = "FIX_ERRORS";
11
+ })(WRITER_AI_ACTION_TYPE || (exports.WRITER_AI_ACTION_TYPE = WRITER_AI_ACTION_TYPE = {}));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_DOCUMENT_SECTION_TYPE = void 0;
4
+ var WRITER_DOCUMENT_SECTION_TYPE;
5
+ (function (WRITER_DOCUMENT_SECTION_TYPE) {
6
+ WRITER_DOCUMENT_SECTION_TYPE["INTRODUCTION"] = "introduction";
7
+ WRITER_DOCUMENT_SECTION_TYPE["CONCLUSION"] = "conclusion";
8
+ WRITER_DOCUMENT_SECTION_TYPE["SECTION"] = "section";
9
+ })(WRITER_DOCUMENT_SECTION_TYPE || (exports.WRITER_DOCUMENT_SECTION_TYPE = WRITER_DOCUMENT_SECTION_TYPE = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WRITER_DOCUMENT_STAGE = void 0;
4
+ var WRITER_DOCUMENT_STAGE;
5
+ (function (WRITER_DOCUMENT_STAGE) {
6
+ WRITER_DOCUMENT_STAGE["CREATED"] = "CREATED";
7
+ WRITER_DOCUMENT_STAGE["GENERATING_OUTLINE"] = "GENERATING_OUTLINE";
8
+ WRITER_DOCUMENT_STAGE["OUTLINE_GENERATED"] = "OUTLINE_GENERATED";
9
+ WRITER_DOCUMENT_STAGE["OUTLINE_GENERATION_FAILED"] = "OUTLINE_GENERATION_FAILED";
10
+ WRITER_DOCUMENT_STAGE["GENERATING_CONTENT"] = "GENERATING_CONTENT";
11
+ WRITER_DOCUMENT_STAGE["CONTENT_GENERATED"] = "CONTENT_GENERATED";
12
+ WRITER_DOCUMENT_STAGE["CONTENT_GENERATION_FAILED"] = "CONTENT_GENERATION_FAILED";
13
+ WRITER_DOCUMENT_STAGE["DELETED"] = "DELETED";
14
+ })(WRITER_DOCUMENT_STAGE || (exports.WRITER_DOCUMENT_STAGE = WRITER_DOCUMENT_STAGE = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums"), exports);
@@ -19,3 +19,4 @@ __exportStar(require("./stt"), exports);
19
19
  __exportStar(require("./subscription"), exports);
20
20
  __exportStar(require("./tts"), exports);
21
21
  __exportStar(require("./video"), exports);
22
+ __exportStar(require("./writer"), exports);
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHARACTERS_PER_PAGE = void 0;
4
+ exports.pagesToCharacters = pagesToCharacters;
5
+ exports.charactersToPages = charactersToPages;
6
+ const WORD_FONT_SIZE_PT = 14;
7
+ const WORD_LINE_SPACING = 1.5;
8
+ const A4_WIDTH_MM = 210;
9
+ const A4_HEIGHT_MM = 297;
10
+ const MARGIN_TOP_MM = 20;
11
+ const MARGIN_BOTTOM_MM = 20;
12
+ const MARGIN_LEFT_MM = 30;
13
+ const MARGIN_RIGHT_MM = 10;
14
+ const FIRST_LINE_INDENT_MM = 12.5;
15
+ const MM_PER_POINT = 0.3527777778;
16
+ const TEXT_WIDTH_MM = A4_WIDTH_MM - MARGIN_LEFT_MM - MARGIN_RIGHT_MM;
17
+ const TEXT_HEIGHT_MM = A4_HEIGHT_MM - MARGIN_TOP_MM - MARGIN_BOTTOM_MM;
18
+ const LINE_HEIGHT_MM = WORD_FONT_SIZE_PT * WORD_LINE_SPACING * MM_PER_POINT;
19
+ const LINES_PER_PAGE = Math.floor(TEXT_HEIGHT_MM / LINE_HEIGHT_MM);
20
+ const AVG_CHAR_WIDTH_EM = 0.58;
21
+ const AVG_CHAR_WIDTH_MM = WORD_FONT_SIZE_PT * AVG_CHAR_WIDTH_EM * MM_PER_POINT;
22
+ const CHARS_PER_LINE = Math.floor(TEXT_WIDTH_MM / AVG_CHAR_WIDTH_MM);
23
+ const AVG_PARAGRAPHS_PER_PAGE = 4; // average paragraph count across typical student papers
24
+ const INDENT_CHARS_LOSS = Math.round((FIRST_LINE_INDENT_MM / AVG_CHAR_WIDTH_MM) * AVG_PARAGRAPHS_PER_PAGE);
25
+ const LAYOUT_FUDGE_FACTOR = 0.96;
26
+ exports.CHARACTERS_PER_PAGE = Math.round((LINES_PER_PAGE * CHARS_PER_LINE - INDENT_CHARS_LOSS) * LAYOUT_FUDGE_FACTOR);
27
+ function pagesToCharacters(pages) {
28
+ if (!Number.isFinite(pages) || pages <= 0)
29
+ return 0;
30
+ return Math.max(0, Math.round(pages * exports.CHARACTERS_PER_PAGE));
31
+ }
32
+ function charactersToPages(characters) {
33
+ if (!Number.isFinite(characters) || characters <= 0)
34
+ return 0;
35
+ const raw = characters / exports.CHARACTERS_PER_PAGE;
36
+ return Math.max(0, Math.ceil(raw));
37
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateWriterAiActionPrice = calculateWriterAiActionPrice;
4
+ const constants_1 = require("../../constants");
5
+ function calculateWriterAiActionPrice(pricingRules, selectionText) {
6
+ switch (pricingRules.type) {
7
+ case constants_1.WRITER_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
8
+ const characterCount = selectionText.length;
9
+ const price = characterCount * pricingRules.price;
10
+ return Math.max(1, Math.ceil(price));
11
+ case constants_1.WRITER_AI_ACTION_PRICING_TYPE.FLAT:
12
+ return Math.max(1, Math.ceil(pricingRules.price));
13
+ default:
14
+ throw new Error(`Unknown pricing type`);
15
+ }
16
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateWriterContentGenerationPrice = calculateWriterContentGenerationPrice;
4
+ function calculateWriterContentGenerationPrice(pages) {
5
+ return Math.max(1, pages);
6
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./calculate-writer-ai-action-price.util"), exports);
18
+ __exportStar(require("./calculate-writer-content-generation-price.util"), exports);
19
+ __exportStar(require("./calculate-page-count.util"), exports);
@@ -19,4 +19,5 @@ __exportStar(require("./paraphrase"), exports);
19
19
  __exportStar(require("./stt"), exports);
20
20
  __exportStar(require("./tts"), exports);
21
21
  __exportStar(require("./video"), exports);
22
+ __exportStar(require("./writer"), exports);
22
23
  __exportStar(require("./image-editor"), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./writer-config.schema"), exports);
18
+ __exportStar(require("./writer-ai-action.schema"), exports);
19
+ __exportStar(require("./writer-document-outline.schema"), exports);
20
+ __exportStar(require("./writer-document.schema"), exports);
21
+ __exportStar(require("./writer-document-type.schema"), exports);
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterAiActionSchema = exports.WriterAiActionPricingRulesSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ exports.WriterAiActionPricingRulesSchema = zod_1.z.discriminatedUnion('type', [
7
+ zod_1.z.object({
8
+ type: zod_1.z.literal(constants_1.WRITER_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
9
+ price: zod_1.z.number(),
10
+ }),
11
+ zod_1.z.object({
12
+ type: zod_1.z.literal(constants_1.WRITER_AI_ACTION_PRICING_TYPE.FLAT),
13
+ price: zod_1.z.number(),
14
+ }),
15
+ ]);
16
+ exports.WriterAiActionSchema = zod_1.z.object({
17
+ uuid: zod_1.z.string(),
18
+ type: zod_1.z.nativeEnum(constants_1.WRITER_AI_ACTION_TYPE),
19
+ pricingRules: exports.WriterAiActionPricingRulesSchema,
20
+ maxPromptLength: zod_1.z.number(),
21
+ title: zod_1.z.string(),
22
+ icon: zod_1.z.string(),
23
+ order: zod_1.z.number(),
24
+ createdAt: zod_1.z.date(),
25
+ updatedAt: zod_1.z.date(),
26
+ });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const writer_document_type_schema_1 = require("./writer-document-type.schema");
6
+ const writer_ai_action_schema_1 = require("./writer-ai-action.schema");
7
+ exports.WriterConfigSchema = zod_1.z.object({
8
+ maxPromptLength: zod_1.z.number(),
9
+ documentTypes: zod_1.z.array(writer_document_type_schema_1.WriterDocumentTypeSchema),
10
+ aiActions: zod_1.z.array(writer_ai_action_schema_1.WriterAiActionSchema),
11
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterDocumentOutlineSchema = exports.WriterDocumentOutlineSectionSchema = exports.WriterDocumentOutlineSubsectionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ exports.WriterDocumentOutlineSubsectionSchema = zod_1.z.object({
7
+ title: zod_1.z
8
+ .string()
9
+ .min(3)
10
+ .max(120)
11
+ .describe(`Concise title of the subsection. Meant to elaborate on its parent section's title.`),
12
+ });
13
+ exports.WriterDocumentOutlineSectionSchema = zod_1.z.object({
14
+ title: zod_1.z.string().min(3).max(120).describe(`Concise title of the paper section.`),
15
+ type: zod_1.z.nativeEnum(constants_1.WRITER_DOCUMENT_SECTION_TYPE),
16
+ subsections: zod_1.z
17
+ .array(exports.WriterDocumentOutlineSubsectionSchema)
18
+ .optional()
19
+ .describe(`Subsections of the paper section. Each subsection is a single idea that is a part of the parent section.`),
20
+ });
21
+ exports.WriterDocumentOutlineSchema = zod_1.z.array(exports.WriterDocumentOutlineSectionSchema);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterDocumentTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const icon_variants_schema_1 = require("../../icon-variants.schema");
6
+ exports.WriterDocumentTypeSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ title: zod_1.z.string(),
9
+ icons: icon_variants_schema_1.IconVariantsSchema,
10
+ order: zod_1.z.number(),
11
+ minPages: zod_1.z.number(),
12
+ maxPages: zod_1.z.number(),
13
+ pageRange: zod_1.z.array(zod_1.z.number()),
14
+ createdAt: zod_1.z.date(),
15
+ updatedAt: zod_1.z.date(),
16
+ });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriterDocumentSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const writer_document_outline_schema_1 = require("./writer-document-outline.schema");
6
+ const constants_1 = require("../../../constants");
7
+ exports.WriterDocumentSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ prompt: zod_1.z.string(),
10
+ topic: zod_1.z.string(),
11
+ typeId: zod_1.z.string(),
12
+ stage: zod_1.z.nativeEnum(constants_1.WRITER_DOCUMENT_STAGE),
13
+ outline: writer_document_outline_schema_1.WriterDocumentOutlineSchema,
14
+ sourceMd: zod_1.z.string().nullable(),
15
+ finalMd: zod_1.z.string().nullable(),
16
+ userId: zod_1.z.string().nullable(),
17
+ unregisteredUserId: zod_1.z.string().nullable(),
18
+ pages: zod_1.z.number(),
19
+ createdAt: zod_1.z.date(),
20
+ updatedAt: zod_1.z.date(),
21
+ completedAt: zod_1.z.date().nullable(),
22
+ });
@@ -4,6 +4,10 @@ export namespace CheckLimitCommand {
4
4
  export const ResponseSchema = z.object({
5
5
  data: z.object({
6
6
  totalTokenBalance: z.number(),
7
+ tokenBonusBalance: z.number(),
8
+ subscriptionBalance: z.number(),
9
+ productBalance: z.number(),
10
+ referralBonusBalance: z.number(),
7
11
  }),
8
12
  });
9
13
  export type Response = z.infer<typeof ResponseSchema>;
@@ -4,4 +4,5 @@ export * from './stt';
4
4
  export * from './tool';
5
5
  export * from './tts';
6
6
  export * from './video';
7
+ export * from './writer';
7
8
  export * from './image-editor';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentSchema } from '../../../models';
3
+
4
+ export namespace CreateWriterDocumentCommand {
5
+ export const RequestSchema = z.object({
6
+ prompt: z.string(),
7
+ numPages: z.number(),
8
+ documentTypeId: z.string(),
9
+ });
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: WriterDocumentSchema,
14
+ });
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAllWriterDocumentsCommand {
4
+ export const ResponseSchema = z.void();
5
+ export type Response = z.infer<typeof ResponseSchema>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteWriterDocumentByUUIDCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const ResponseSchema = z.void();
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace ExportWriterDocumentAsDocxCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const ResponseSchema = z.object({
10
+ data: z.object({
11
+ url: z.string(),
12
+ }),
13
+ });
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentSchema } from '../../../models';
3
+
4
+ export namespace FindWriterDocumentByUUIDCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: WriterDocumentSchema,
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentSchema } from '../../../models';
3
+
4
+ export namespace FindWriterDocumentsCommand {
5
+ export const RequestQuerySchema = z.object({
6
+ limit: z.coerce.number().min(1).optional(),
7
+ offset: z.coerce.number().min(0).default(0).optional(),
8
+ title: z.string().optional(),
9
+ });
10
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(WriterDocumentSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentSchema } from '../../../models';
3
+
4
+ export namespace GenerateWriterDocumentContentsCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: WriterDocumentSchema,
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { WriterConfigSchema } from '../../../models';
3
+
4
+ export namespace GetWriterToolConfigCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: WriterConfigSchema,
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,15 @@
1
+ export * from './get-writer-tool-config.command';
2
+ export * from './create-writer-document.command';
3
+ export * from './find-writer-document-by-uuid.command';
4
+ export * from './find-writer-documents.command';
5
+ export * from './generate-writer-document-contents.command';
6
+ export * from './update-writer-document-outline.command';
7
+ export * from './update-writer-document-contents.command';
8
+ export * from './delete-writer-document-by-uuid.command';
9
+ export * from './delete-all-writer-documents.command';
10
+ export * from './writer-paraphrase.command';
11
+ export * from './writer-extend-text.command';
12
+ export * from './writer-shorten-text.command';
13
+ export * from './writer-fix-errors.command';
14
+ export * from './writer-generate-text.command';
15
+ export * from './export-writer-document-as-docx.command';
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace UpdateWriterDocumentContentsCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ contents: z.string(),
11
+ });
12
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ success: z.boolean(),
17
+ }),
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { WriterDocumentOutlineSchema, WriterDocumentOutlineSectionSchema } from '../../../models';
3
+
4
+ export namespace UpdateWriterDocumentOutlineCommand {
5
+ export const RequestBodySchema = z.object({
6
+ data: WriterDocumentOutlineSchema,
7
+ });
8
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: z.array(WriterDocumentOutlineSectionSchema),
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace WriterExtendTextCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ selectionText: z.string(),
11
+ });
12
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ output: z.string(),
17
+ }),
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace WriterFixErrorsCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ selectionText: z.string(),
11
+ });
12
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ output: z.string(),
17
+ }),
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace WriterGenerateTextCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ prompt: z.string(),
11
+ selectionText: z.string(),
12
+ contextBefore: z.string().max(2000).optional(),
13
+ contextAfter: z.string().max(2000).optional(),
14
+ });
15
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
16
+
17
+ export const ResponseSchema = z.object({
18
+ data: z.object({
19
+ output: z.string(),
20
+ }),
21
+ });
22
+ export type Response = z.infer<typeof ResponseSchema>;
23
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace WriterParaphraseCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ selectionText: z.string(),
11
+ });
12
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ output: z.string(),
17
+ }),
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace WriterShortenTextCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const RequestBodySchema = z.object({
10
+ selectionText: z.string(),
11
+ });
12
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
13
+
14
+ export const ResponseSchema = z.object({
15
+ data: z.object({
16
+ output: z.string(),
17
+ }),
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }