@purpleschool/student-works 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/controller/http/index.ts +1 -0
- package/api/controller/http/tools.ts +7 -0
- package/api/routes.ts +8 -0
- package/build/api/controller/http/index.js +1 -0
- package/build/api/controller/http/tools.js +9 -0
- package/build/api/routes.js +8 -0
- package/build/common/enums/tool-type.enum.js +2 -1
- package/build/constants/email/subjects.js +9 -9
- package/build/constants/errors/errors.js +5 -0
- package/build/helpers/writer/calculate-writer-ai-action-price.util.js +1 -0
- package/build/helpers/writer/calculate-writer-content-generation-price.util.js +1 -0
- package/build/models/index.js +1 -0
- package/build/models/tools/index.js +17 -0
- package/build/models/tools/unified-tool-job.schema.js +17 -0
- package/build/queries/index.js +1 -1
- package/build/queries/tools/find-unified-tool-job-history-full.query.js +19 -0
- package/build/queries/tools/find-unified-tool-job-history.query.js +18 -0
- package/build/queries/tools/index.js +18 -0
- package/common/enums/tool-type.enum.ts +2 -1
- package/constants/email/subjects.ts +9 -9
- package/constants/errors/errors.ts +5 -0
- package/helpers/writer/calculate-writer-ai-action-price.util.ts +1 -0
- package/helpers/writer/calculate-writer-content-generation-price.util.ts +1 -0
- package/models/index.ts +1 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/unified-tool-job.schema.ts +17 -0
- package/package.json +1 -1
- package/queries/index.ts +1 -1
- package/queries/tools/find-unified-tool-job-history-full.query.ts +21 -0
- package/queries/tools/find-unified-tool-job-history.query.ts +20 -0
- package/queries/tools/index.ts +2 -0
package/api/routes.ts
CHANGED
|
@@ -239,4 +239,12 @@ export const REST_API = {
|
|
|
239
239
|
RETRY: (uuid: string) =>
|
|
240
240
|
`${ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.RETRY(uuid)}`,
|
|
241
241
|
},
|
|
242
|
+
TOOLS_PRIVATE: {
|
|
243
|
+
HISTORY: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
244
|
+
HISTORY_FULL: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
245
|
+
},
|
|
246
|
+
TOOLS_PUBLIC: {
|
|
247
|
+
HISTORY: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
248
|
+
HISTORY_FULL: `${ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
249
|
+
},
|
|
242
250
|
} as const;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOLS_ROUTES = exports.TOOLS_CONTROLLER_PUBLIC = exports.TOOLS_CONTROLLER_PRIVATE = void 0;
|
|
4
|
+
exports.TOOLS_CONTROLLER_PRIVATE = 'private/tools';
|
|
5
|
+
exports.TOOLS_CONTROLLER_PUBLIC = 'public/tools';
|
|
6
|
+
exports.TOOLS_ROUTES = {
|
|
7
|
+
HISTORY: 'history',
|
|
8
|
+
HISTORY_FULL: 'history/full',
|
|
9
|
+
};
|
package/build/api/routes.js
CHANGED
|
@@ -201,4 +201,12 @@ exports.REST_API = {
|
|
|
201
201
|
DELETE_ALL: `${exports.ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.DELETE_ALL}`,
|
|
202
202
|
RETRY: (uuid) => `${exports.ROOT}/${CONTROLLERS.SOLVING_EDU_TASK_CONTROLLER_PUBLIC}/${CONTROLLERS.SOLVING_EDU_TASK_ROUTES.RETRY(uuid)}`,
|
|
203
203
|
},
|
|
204
|
+
TOOLS_PRIVATE: {
|
|
205
|
+
HISTORY: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
206
|
+
HISTORY_FULL: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PRIVATE}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
207
|
+
},
|
|
208
|
+
TOOLS_PUBLIC: {
|
|
209
|
+
HISTORY: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY}`,
|
|
210
|
+
HISTORY_FULL: `${exports.ROOT}/${CONTROLLERS.TOOLS_CONTROLLER_PUBLIC}/${CONTROLLERS.TOOLS_ROUTES.HISTORY_FULL}`,
|
|
211
|
+
},
|
|
204
212
|
};
|
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TOOL_TYPE = void 0;
|
|
4
4
|
var TOOL_TYPE;
|
|
5
5
|
(function (TOOL_TYPE) {
|
|
6
|
-
TOOL_TYPE["WRITER"] = "
|
|
6
|
+
TOOL_TYPE["WRITER"] = "writer";
|
|
7
|
+
TOOL_TYPE["SOLVING_EDU_TASK"] = "solving-edu-task";
|
|
7
8
|
})(TOOL_TYPE || (exports.TOOL_TYPE = TOOL_TYPE = {}));
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EMAIL_SUBJECTS = void 0;
|
|
4
4
|
exports.EMAIL_SUBJECTS = {
|
|
5
|
-
EMAIL_VERIFICATION: '
|
|
6
|
-
WELCOME: '
|
|
5
|
+
EMAIL_VERIFICATION: 'Подтверждение email',
|
|
6
|
+
WELCOME: 'Добро пожаловать в Studdy.io',
|
|
7
7
|
RESTORE_PASSWORD: 'Восстановление пароля в Studdy.io',
|
|
8
|
-
FAST_REGISTRATION: '
|
|
9
|
-
PRODUCT_PURCHASE: '
|
|
10
|
-
RECURRENT_PAYMENT_FAILED: '
|
|
11
|
-
SUBSCRIPTION_PURCHASE: '
|
|
12
|
-
SUBSCRIPTION_BEFORE_CANCEL: '
|
|
13
|
-
SUBSCRIPTION_RENEWAL_REMINDER: '
|
|
14
|
-
SUBSCRIPTION_CANCEL: '
|
|
8
|
+
FAST_REGISTRATION: 'Быстрая регистрация',
|
|
9
|
+
PRODUCT_PURCHASE: 'Покупка продукта',
|
|
10
|
+
RECURRENT_PAYMENT_FAILED: 'Ошибка повторного платежа',
|
|
11
|
+
SUBSCRIPTION_PURCHASE: 'Оформление подписки',
|
|
12
|
+
SUBSCRIPTION_BEFORE_CANCEL: 'Подписка будет отменена',
|
|
13
|
+
SUBSCRIPTION_RENEWAL_REMINDER: 'Напоминание о продлении подписки',
|
|
14
|
+
SUBSCRIPTION_CANCEL: 'Подписка отменена',
|
|
15
15
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateWriterAiActionPrice = calculateWriterAiActionPrice;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
|
+
// Note: If you change this logic, also update the internal helper in
|
|
5
6
|
function calculateWriterAiActionPrice(pricingRules, selectionText) {
|
|
6
7
|
switch (pricingRules.type) {
|
|
7
8
|
case constants_1.WRITER_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateWriterContentGenerationPrice = calculateWriterContentGenerationPrice;
|
|
4
|
+
// Note: If you change this logic, also update the internal helper
|
|
4
5
|
function calculateWriterContentGenerationPrice(pages, pricePerPage) {
|
|
5
6
|
return Math.max(1, pages * pricePerPage);
|
|
6
7
|
}
|
package/build/models/index.js
CHANGED
|
@@ -38,3 +38,4 @@ __exportStar(require("./referral-bonus.schema"), exports);
|
|
|
38
38
|
__exportStar(require("./user-referrals.schema"), exports);
|
|
39
39
|
__exportStar(require("./file.schema"), exports);
|
|
40
40
|
__exportStar(require("./solving-edu-task"), exports);
|
|
41
|
+
__exportStar(require("./tools"), exports);
|
|
@@ -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("./unified-tool-job.schema"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnifiedToolJobSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const constants_2 = require("../../constants");
|
|
8
|
+
exports.UnifiedToolJobSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
title: zod_1.z.string(),
|
|
11
|
+
type: zod_1.z.nativeEnum(common_1.TOOL_TYPE),
|
|
12
|
+
status: zod_1.z.nativeEnum(constants_1.JOB_STATUS).optional().nullable(),
|
|
13
|
+
stage: zod_1.z.nativeEnum(constants_2.WRITER_DOCUMENT_STAGE).optional().nullable(),
|
|
14
|
+
documentTypeId: zod_1.z.string().uuid().optional().nullable(),
|
|
15
|
+
createdAt: zod_1.z.date().or(zod_1.z.string()),
|
|
16
|
+
updatedAt: zod_1.z.date().or(zod_1.z.string()),
|
|
17
|
+
});
|
package/build/queries/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./tools"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUnifiedToolJobHistoryFullQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const writer_1 = require("../../models/writer");
|
|
6
|
+
const solving_edu_task_1 = require("../../models/solving-edu-task");
|
|
7
|
+
var FindUnifiedToolJobHistoryFullQuery;
|
|
8
|
+
(function (FindUnifiedToolJobHistoryFullQuery) {
|
|
9
|
+
FindUnifiedToolJobHistoryFullQuery.RequestSchema = zod_1.z.object({
|
|
10
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
11
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
12
|
+
title: zod_1.z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
FindUnifiedToolJobHistoryFullQuery.ResponseSchema = zod_1.z.object({
|
|
15
|
+
data: zod_1.z.array(zod_1.z.union([writer_1.WriterDocumentSchema, solving_edu_task_1.SolvingEduTaskJobSchema])),
|
|
16
|
+
page: zod_1.z.number().int(),
|
|
17
|
+
totalPages: zod_1.z.number().int(),
|
|
18
|
+
});
|
|
19
|
+
})(FindUnifiedToolJobHistoryFullQuery || (exports.FindUnifiedToolJobHistoryFullQuery = FindUnifiedToolJobHistoryFullQuery = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindUnifiedToolJobHistoryQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tools_1 = require("../../models/tools");
|
|
6
|
+
var FindUnifiedToolJobHistoryQuery;
|
|
7
|
+
(function (FindUnifiedToolJobHistoryQuery) {
|
|
8
|
+
FindUnifiedToolJobHistoryQuery.RequestSchema = zod_1.z.object({
|
|
9
|
+
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
10
|
+
offset: zod_1.z.coerce.number().min(0).default(0).optional(),
|
|
11
|
+
title: zod_1.z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
FindUnifiedToolJobHistoryQuery.ResponseSchema = zod_1.z.object({
|
|
14
|
+
data: zod_1.z.array(tools_1.UnifiedToolJobSchema),
|
|
15
|
+
page: zod_1.z.number().int(),
|
|
16
|
+
totalPages: zod_1.z.number().int(),
|
|
17
|
+
});
|
|
18
|
+
})(FindUnifiedToolJobHistoryQuery || (exports.FindUnifiedToolJobHistoryQuery = FindUnifiedToolJobHistoryQuery = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./find-unified-tool-job-history.query"), exports);
|
|
18
|
+
__exportStar(require("./find-unified-tool-job-history-full.query"), exports);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const EMAIL_SUBJECTS = {
|
|
2
|
-
EMAIL_VERIFICATION: '
|
|
3
|
-
WELCOME: '
|
|
2
|
+
EMAIL_VERIFICATION: 'Подтверждение email',
|
|
3
|
+
WELCOME: 'Добро пожаловать в Studdy.io',
|
|
4
4
|
RESTORE_PASSWORD: 'Восстановление пароля в Studdy.io',
|
|
5
|
-
FAST_REGISTRATION: '
|
|
6
|
-
PRODUCT_PURCHASE: '
|
|
7
|
-
RECURRENT_PAYMENT_FAILED: '
|
|
8
|
-
SUBSCRIPTION_PURCHASE: '
|
|
9
|
-
SUBSCRIPTION_BEFORE_CANCEL: '
|
|
10
|
-
SUBSCRIPTION_RENEWAL_REMINDER: '
|
|
11
|
-
SUBSCRIPTION_CANCEL: '
|
|
5
|
+
FAST_REGISTRATION: 'Быстрая регистрация',
|
|
6
|
+
PRODUCT_PURCHASE: 'Покупка продукта',
|
|
7
|
+
RECURRENT_PAYMENT_FAILED: 'Ошибка повторного платежа',
|
|
8
|
+
SUBSCRIPTION_PURCHASE: 'Оформление подписки',
|
|
9
|
+
SUBSCRIPTION_BEFORE_CANCEL: 'Подписка будет отменена',
|
|
10
|
+
SUBSCRIPTION_RENEWAL_REMINDER: 'Напоминание о продлении подписки',
|
|
11
|
+
SUBSCRIPTION_CANCEL: 'Подписка отменена',
|
|
12
12
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WRITER_AI_ACTION_PRICING_TYPE } from '../../constants';
|
|
2
2
|
import { WriterAiActionPricingRules } from '../../models';
|
|
3
3
|
|
|
4
|
+
// Note: If you change this logic, also update the internal helper in
|
|
4
5
|
export function calculateWriterAiActionPrice(
|
|
5
6
|
pricingRules: WriterAiActionPricingRules,
|
|
6
7
|
selectionText: string,
|
package/models/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unified-tool-job.schema';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TOOL_TYPE } from '../../common';
|
|
3
|
+
import { JOB_STATUS } from '../../constants';
|
|
4
|
+
import { WRITER_DOCUMENT_STAGE } from '../../constants';
|
|
5
|
+
|
|
6
|
+
export const UnifiedToolJobSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
type: z.nativeEnum(TOOL_TYPE),
|
|
10
|
+
status: z.nativeEnum(JOB_STATUS).optional().nullable(),
|
|
11
|
+
stage: z.nativeEnum(WRITER_DOCUMENT_STAGE).optional().nullable(),
|
|
12
|
+
documentTypeId: z.string().uuid().optional().nullable(),
|
|
13
|
+
createdAt: z.date().or(z.string()),
|
|
14
|
+
updatedAt: z.date().or(z.string()),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type UnifiedToolJob = z.infer<typeof UnifiedToolJobSchema>;
|
package/package.json
CHANGED
package/queries/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './tools';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WriterDocumentSchema } from '../../models/writer';
|
|
3
|
+
import { SolvingEduTaskJobSchema } from '../../models/solving-edu-task';
|
|
4
|
+
|
|
5
|
+
export namespace FindUnifiedToolJobHistoryFullQuery {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
limit: z.coerce.number().min(1).optional(),
|
|
8
|
+
offset: z.coerce.number().min(0).default(0).optional(),
|
|
9
|
+
title: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = z.object({
|
|
15
|
+
data: z.array(z.union([WriterDocumentSchema, SolvingEduTaskJobSchema])),
|
|
16
|
+
page: z.number().int(),
|
|
17
|
+
totalPages: z.number().int(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnifiedToolJobSchema } from '../../models/tools';
|
|
3
|
+
|
|
4
|
+
export namespace FindUnifiedToolJobHistoryQuery {
|
|
5
|
+
export const RequestSchema = 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
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.array(UnifiedToolJobSchema),
|
|
15
|
+
page: z.number().int(),
|
|
16
|
+
totalPages: z.number().int(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|