@crowdin/app-project-module 0.39.1 → 0.40.0
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/out/handlers/integration/crowdin-update.js +36 -17
- package/out/handlers/integration/integration-data.js +2 -0
- package/out/handlers/integration/integration-update.js +35 -17
- package/out/handlers/integration/integration-webhook.js +1 -1
- package/out/handlers/integration/job-cancel.d.ts +3 -0
- package/out/handlers/integration/job-cancel.js +28 -0
- package/out/handlers/integration/job-info.d.ts +3 -0
- package/out/handlers/integration/job-info.js +54 -0
- package/out/handlers/integration/main.js +6 -3
- package/out/handlers/integration/user-errors.d.ts +3 -0
- package/out/handlers/{user-errors.js → integration/user-errors.js} +2 -2
- package/out/index.d.ts +2 -1
- package/out/index.js +35 -27
- package/out/middlewares/crowdin-client.js +1 -0
- package/out/middlewares/ui-module.js +1 -0
- package/out/models/index.d.ts +48 -17
- package/out/models/index.js +1 -0
- package/out/models/job.d.ts +44 -0
- package/out/models/job.js +16 -0
- package/out/static/js/form.js +6 -6
- package/out/static/js/main.js +1 -1
- package/out/storage/index.d.ts +6 -0
- package/out/storage/index.js +3 -0
- package/out/storage/mysql.d.ts +6 -0
- package/out/storage/mysql.js +106 -0
- package/out/storage/postgre.d.ts +6 -0
- package/out/storage/postgre.js +107 -0
- package/out/storage/sqlite.d.ts +6 -0
- package/out/storage/sqlite.js +96 -0
- package/out/util/cron.d.ts +1 -0
- package/out/util/cron.js +47 -3
- package/out/util/defaults.js +4 -11
- package/out/util/file-snapshot.js +2 -0
- package/out/util/files.d.ts +2 -1
- package/out/util/files.js +19 -1
- package/out/util/index.js +3 -1
- package/out/util/job.d.ts +12 -0
- package/out/util/job.js +88 -0
- package/out/util/logger.js +4 -0
- package/out/util/webhooks.js +50 -4
- package/out/views/main.handlebars +153 -5
- package/package.json +13 -12
- package/out/handlers/user-errors.d.ts +0 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare enum JobType {
|
|
2
|
+
UPDATE_TO_CROWDIN = "updateCrowdin",
|
|
3
|
+
UPDATE_TO_INTEGRATION = "updateIntegration"
|
|
4
|
+
}
|
|
5
|
+
export declare enum JobStatus {
|
|
6
|
+
CREATED = "created",
|
|
7
|
+
IN_PROGRESS = "inProgress",
|
|
8
|
+
FINISHED = "finished",
|
|
9
|
+
FAILED = "failed",
|
|
10
|
+
CANCELED = "canceled"
|
|
11
|
+
}
|
|
12
|
+
export interface Job {
|
|
13
|
+
id: string;
|
|
14
|
+
integrationId: string;
|
|
15
|
+
crowdinId: string;
|
|
16
|
+
type: JobType;
|
|
17
|
+
title: string;
|
|
18
|
+
progress: number;
|
|
19
|
+
status: JobStatus;
|
|
20
|
+
payload?: any;
|
|
21
|
+
data?: any;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
updatedAt?: number;
|
|
24
|
+
finishedAt?: number;
|
|
25
|
+
eta?: number;
|
|
26
|
+
info?: string;
|
|
27
|
+
}
|
|
28
|
+
export type GetJobParams = Pick<Job, 'id'>;
|
|
29
|
+
export type GetActiveJobsParams = Pick<Job, 'integrationId' | 'crowdinId'>;
|
|
30
|
+
export type CreateJobParams = Pick<Job, 'integrationId' | 'crowdinId' | 'type' | 'payload' | 'title'>;
|
|
31
|
+
export type UpdateJobParams = {
|
|
32
|
+
id: string;
|
|
33
|
+
progress?: number;
|
|
34
|
+
status?: JobStatus;
|
|
35
|
+
info?: string;
|
|
36
|
+
data?: string;
|
|
37
|
+
};
|
|
38
|
+
export type JobClient = {
|
|
39
|
+
get: () => Promise<Job | undefined>;
|
|
40
|
+
update: UpdateJobProgress;
|
|
41
|
+
};
|
|
42
|
+
export type UpdateJobProgress = ({ progress, status, info, data, }: Omit<UpdateJobParams, 'id'>) => Promise<{
|
|
43
|
+
isCanceled: boolean;
|
|
44
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobStatus = exports.JobType = void 0;
|
|
4
|
+
var JobType;
|
|
5
|
+
(function (JobType) {
|
|
6
|
+
JobType["UPDATE_TO_CROWDIN"] = "updateCrowdin";
|
|
7
|
+
JobType["UPDATE_TO_INTEGRATION"] = "updateIntegration";
|
|
8
|
+
})(JobType = exports.JobType || (exports.JobType = {}));
|
|
9
|
+
var JobStatus;
|
|
10
|
+
(function (JobStatus) {
|
|
11
|
+
JobStatus["CREATED"] = "created";
|
|
12
|
+
JobStatus["IN_PROGRESS"] = "inProgress";
|
|
13
|
+
JobStatus["FINISHED"] = "finished";
|
|
14
|
+
JobStatus["FAILED"] = "failed";
|
|
15
|
+
JobStatus["CANCELED"] = "canceled";
|
|
16
|
+
})(JobStatus = exports.JobStatus || (exports.JobStatus = {}));
|