@crowdin/app-project-module 0.43.1 → 0.45.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/index.d.ts +3 -3
- package/out/index.js +103 -219
- package/out/middlewares/crowdin-client.d.ts +1 -1
- package/out/middlewares/crowdin-client.js +3 -2
- package/out/middlewares/integration-credentials.d.ts +3 -2
- package/out/middlewares/render-ui-module.d.ts +2 -2
- package/out/middlewares/ui-module.d.ts +2 -2
- package/out/middlewares/ui-module.js +5 -1
- package/out/{util → modules}/api/api.d.ts +3 -2
- package/out/{util → modules}/api/api.js +22 -22
- package/out/modules/api/index.d.ts +6 -0
- package/out/modules/api/index.js +14 -0
- package/out/modules/api/types.d.ts +20 -0
- package/out/modules/api/types.js +11 -0
- package/out/modules/context-menu/index.d.ts +6 -0
- package/out/modules/context-menu/index.js +17 -0
- package/out/modules/context-menu/types.d.ts +27 -0
- package/out/modules/context-menu/types.js +18 -0
- package/out/{handlers/custom-mt → modules/custom-mt/handlers}/translate.d.ts +2 -1
- package/out/{handlers/custom-mt → modules/custom-mt/handlers}/translate.js +2 -2
- package/out/modules/custom-mt/index.d.ts +6 -0
- package/out/modules/custom-mt/index.js +17 -0
- package/out/modules/custom-mt/types.d.ts +22 -0
- package/out/modules/custom-mt/types.js +2 -0
- package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/get-languages-list.d.ts +2 -1
- package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/get-languages-list.js +2 -2
- package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/spell-check.d.ts +2 -1
- package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/spell-check.js +5 -3
- package/out/modules/custom-spell-check/index.d.ts +6 -0
- package/out/modules/custom-spell-check/index.js +32 -0
- package/out/modules/custom-spell-check/types.d.ts +56 -0
- package/out/modules/custom-spell-check/types.js +2 -0
- package/out/modules/editor-right-panel/index.d.ts +6 -0
- package/out/modules/editor-right-panel/index.js +17 -0
- package/out/modules/editor-right-panel/types.d.ts +7 -0
- package/out/modules/editor-right-panel/types.js +2 -0
- package/out/modules/editor-themes/index.d.ts +6 -0
- package/out/modules/editor-themes/index.js +11 -0
- package/out/modules/editor-themes/types.d.ts +17 -0
- package/out/modules/editor-themes/types.js +2 -0
- package/out/{handlers/file-processing → modules/file-processing/handlers}/custom-file-format.d.ts +2 -1
- package/out/{handlers/file-processing → modules/file-processing/handlers}/custom-file-format.js +5 -5
- package/out/modules/file-processing/handlers/file-download.d.ts +5 -0
- package/out/{handlers/file-processing → modules/file-processing/handlers}/file-download.js +2 -2
- package/out/{handlers/file-processing → modules/file-processing/handlers}/pre-post-process.d.ts +2 -1
- package/out/{handlers/file-processing → modules/file-processing/handlers}/pre-post-process.js +8 -8
- package/out/modules/file-processing/index.d.ts +22 -0
- package/out/modules/file-processing/index.js +57 -0
- package/out/modules/file-processing/types.d.ts +133 -0
- package/out/modules/file-processing/types.js +12 -0
- package/out/modules/file-processing/util/defaults.d.ts +3 -0
- package/out/modules/file-processing/util/defaults.js +30 -0
- package/out/modules/file-processing/util/files.d.ts +6 -0
- package/out/modules/file-processing/util/files.js +47 -0
- package/out/{handlers/integration/crowdin-project.d.ts → modules/form-data-display.d.ts} +1 -1
- package/out/modules/form-data-save.d.ts +4 -0
- package/out/modules/install.d.ts +4 -0
- package/out/{handlers → modules}/install.js +3 -3
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-file-progress.d.ts +2 -1
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-file-progress.js +2 -2
- package/out/modules/integration/handlers/crowdin-files.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-files.js +3 -3
- package/out/modules/integration/handlers/crowdin-project.d.ts +4 -0
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-project.js +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-update.js +9 -9
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/crowdin-webhook.js +19 -8
- package/out/modules/integration/handlers/integration-data.d.ts +4 -0
- package/out/{handlers/integration → modules/integration/handlers}/integration-data.js +5 -5
- package/out/{handlers/integration → modules/integration/handlers}/integration-login.d.ts +2 -1
- package/out/{handlers/integration → modules/integration/handlers}/integration-login.js +3 -3
- package/out/modules/integration/handlers/integration-logout.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/integration-logout.js +14 -7
- package/out/modules/integration/handlers/integration-update.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/integration-update.js +9 -8
- package/out/modules/integration/handlers/integration-webhook.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/integration-webhook.js +9 -4
- package/out/modules/integration/handlers/job-cancel.d.ts +3 -0
- package/out/{handlers/integration → modules/integration/handlers}/job-cancel.js +4 -4
- package/out/modules/integration/handlers/job-info.d.ts +3 -0
- package/out/{handlers/integration → modules/integration/handlers}/job-info.js +4 -4
- package/out/modules/integration/handlers/main.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/main.js +5 -5
- package/out/modules/integration/handlers/oauth-login.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/oauth-login.js +3 -3
- package/out/{handlers/integration → modules/integration/handlers}/oauth-url.d.ts +2 -1
- package/out/{handlers/integration → modules/integration/handlers}/oauth-url.js +2 -2
- package/out/modules/integration/handlers/settings-save.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/settings-save.js +28 -11
- package/out/modules/integration/handlers/settings.d.ts +3 -0
- package/out/{handlers/integration → modules/integration/handlers}/settings.js +1 -1
- package/out/{handlers/integration → modules/integration/handlers}/subscription-info.d.ts +1 -1
- package/out/{handlers/integration → modules/integration/handlers}/subscription-info.js +2 -2
- package/out/modules/integration/handlers/sync-settings-save.d.ts +5 -0
- package/out/{handlers/integration → modules/integration/handlers}/sync-settings-save.js +16 -8
- package/out/modules/integration/handlers/sync-settings.d.ts +3 -0
- package/out/{handlers/integration → modules/integration/handlers}/sync-settings.js +2 -2
- package/out/modules/integration/handlers/user-errors.d.ts +3 -0
- package/out/{handlers/integration → modules/integration/handlers}/user-errors.js +2 -2
- package/out/modules/integration/index.d.ts +6 -0
- package/out/modules/integration/index.js +118 -0
- package/out/modules/integration/types.d.ts +435 -0
- package/out/modules/integration/types.js +19 -0
- package/out/modules/integration/util/cron.d.ts +27 -0
- package/out/{util → modules/integration/util}/cron.js +97 -28
- package/out/{util → modules/integration/util}/defaults.d.ts +2 -3
- package/out/{util → modules/integration/util}/defaults.js +1 -36
- package/out/modules/integration/util/files.d.ts +5 -0
- package/out/{util → modules/integration/util}/files.js +9 -40
- package/out/{util → modules/integration/util}/job.d.ts +1 -1
- package/out/{util → modules/integration/util}/job.js +11 -11
- package/out/{util/file-snapshot.d.ts → modules/integration/util/snapshot.d.ts} +2 -3
- package/out/{util/file-snapshot.js → modules/integration/util/snapshot.js} +6 -65
- package/out/{models/job.d.ts → modules/integration/util/types.d.ts} +14 -0
- package/out/modules/integration/util/webhooks.d.ts +48 -0
- package/out/{util → modules/integration/util}/webhooks.js +95 -49
- package/out/modules/manifest.d.ts +3 -0
- package/out/{handlers → modules}/manifest.js +22 -16
- package/out/modules/modal/index.d.ts +6 -0
- package/out/modules/modal/index.js +17 -0
- package/out/modules/organization-menu/index.d.ts +6 -0
- package/out/modules/organization-menu/index.js +18 -0
- package/out/modules/profile-resources-menu/index.d.ts +6 -0
- package/out/modules/profile-resources-menu/index.js +18 -0
- package/out/modules/project-menu/index.d.ts +6 -0
- package/out/modules/project-menu/index.js +17 -0
- package/out/modules/project-menu-crowdsource/index.d.ts +6 -0
- package/out/modules/project-menu-crowdsource/index.js +17 -0
- package/out/modules/project-reports/index.d.ts +6 -0
- package/out/modules/project-reports/index.js +18 -0
- package/out/modules/project-tools/index.d.ts +6 -0
- package/out/modules/project-tools/index.js +18 -0
- package/out/modules/subscription-paid.d.ts +3 -0
- package/out/{handlers → modules}/subscription-paid.js +2 -2
- package/out/modules/uninstall.d.ts +4 -0
- package/out/{handlers → modules}/uninstall.js +6 -2
- package/out/storage/index.d.ts +5 -3
- package/out/storage/mysql.d.ts +4 -2
- package/out/storage/mysql.js +3 -3
- package/out/storage/postgre.d.ts +4 -2
- package/out/storage/postgre.js +3 -3
- package/out/storage/sqlite.d.ts +4 -2
- package/out/storage/sqlite.js +3 -3
- package/out/storage/types.d.ts +9 -0
- package/out/storage/types.js +2 -0
- package/out/types.d.ts +374 -0
- package/out/types.js +59 -0
- package/out/util/connection.d.ts +2 -9
- package/out/util/connection.js +54 -150
- package/out/util/handlebars.d.ts +1 -0
- package/out/util/handlebars.js +34 -0
- package/out/util/index.d.ts +2 -2
- package/out/util/index.js +6 -6
- package/out/util/logger.d.ts +2 -2
- package/out/util/subscription.d.ts +9 -0
- package/out/util/subscription.js +111 -0
- package/package.json +1 -1
- package/out/handlers/file-processing/file-download.d.ts +0 -4
- package/out/handlers/form-data-display.d.ts +0 -3
- package/out/handlers/form-data-save.d.ts +0 -3
- package/out/handlers/install.d.ts +0 -4
- package/out/handlers/integration/crowdin-files.d.ts +0 -4
- package/out/handlers/integration/crowdin-update.d.ts +0 -4
- package/out/handlers/integration/crowdin-webhook.d.ts +0 -4
- package/out/handlers/integration/integration-data.d.ts +0 -4
- package/out/handlers/integration/integration-logout.d.ts +0 -4
- package/out/handlers/integration/integration-update.d.ts +0 -4
- package/out/handlers/integration/integration-webhook.d.ts +0 -4
- package/out/handlers/integration/job-cancel.d.ts +0 -3
- package/out/handlers/integration/job-info.d.ts +0 -3
- package/out/handlers/integration/main.d.ts +0 -4
- package/out/handlers/integration/oauth-login.d.ts +0 -4
- package/out/handlers/integration/settings-save.d.ts +0 -4
- package/out/handlers/integration/settings.d.ts +0 -3
- package/out/handlers/integration/sync-settings-save.d.ts +0 -4
- package/out/handlers/integration/sync-settings.d.ts +0 -3
- package/out/handlers/integration/user-errors.d.ts +0 -3
- package/out/handlers/manifest.d.ts +0 -3
- package/out/handlers/subscription-paid.d.ts +0 -3
- package/out/handlers/uninstall.d.ts +0 -4
- package/out/models/index.d.ts +0 -1088
- package/out/models/index.js +0 -106
- package/out/util/cron.d.ts +0 -7
- package/out/util/files.d.ts +0 -9
- package/out/util/webhooks.d.ts +0 -28
- /package/out/{util → modules}/api/base.d.ts +0 -0
- /package/out/{util → modules}/api/base.js +0 -0
- /package/out/{util → modules}/api/components.d.ts +0 -0
- /package/out/{util → modules}/api/components.js +0 -0
- /package/out/{handlers → modules}/form-data-display.js +0 -0
- /package/out/{handlers → modules}/form-data-save.js +0 -0
- /package/out/{models/job.js → modules/integration/util/types.js} +0 -0
package/out/models/index.d.ts
DELETED
|
@@ -1,1088 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Crowdin, { LanguagesModel, SourceFilesModel, SourceStringsModel, TranslationStatusModel } from '@crowdin/crowdin-api-client';
|
|
3
|
-
import { JwtPayload, VerifyOptions } from '@crowdin/crowdin-apps-functions';
|
|
4
|
-
import { Request } from 'express';
|
|
5
|
-
import { MySQLStorageConfig } from '../storage/mysql';
|
|
6
|
-
import { PostgreStorageConfig } from '../storage/postgre';
|
|
7
|
-
import { LogErrorFunction, LogFunction } from '../util/logger';
|
|
8
|
-
import { JobClient } from './job';
|
|
9
|
-
export interface ClientConfig extends ImagePath {
|
|
10
|
-
/**
|
|
11
|
-
* Authentication Crowdin App type: "authorization_code", "crowdin_app". Default: "crowdin_app"
|
|
12
|
-
*/
|
|
13
|
-
authenticationType?: AuthenticationType;
|
|
14
|
-
/**
|
|
15
|
-
* client id that we received when registering the app
|
|
16
|
-
*/
|
|
17
|
-
clientId?: string;
|
|
18
|
-
/**
|
|
19
|
-
* client secret that we received when registering the app
|
|
20
|
-
*/
|
|
21
|
-
clientSecret?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Secret to encrypt/decrypt credentials (by default @clientSecret will be used)
|
|
24
|
-
*/
|
|
25
|
-
cryptoSecret?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Options to validate Crowdin JWT token
|
|
28
|
-
*/
|
|
29
|
-
jwtValidationOptions?: VerifyOptions;
|
|
30
|
-
/**
|
|
31
|
-
* https url where an app is reachable from the internet (e.g. the one that ngrok generates for us)
|
|
32
|
-
*/
|
|
33
|
-
baseUrl?: string;
|
|
34
|
-
/**
|
|
35
|
-
* define custom Crowdin urls (e.g. to work against local Crowdin server)
|
|
36
|
-
*/
|
|
37
|
-
crowdinUrls?: CrowdinUrls;
|
|
38
|
-
/**
|
|
39
|
-
* Set of scopes requested by this app (default 'project')
|
|
40
|
-
*/
|
|
41
|
-
scopes?: Scope[];
|
|
42
|
-
/**
|
|
43
|
-
* app name
|
|
44
|
-
*/
|
|
45
|
-
name: string;
|
|
46
|
-
/**
|
|
47
|
-
* app identifier
|
|
48
|
-
*/
|
|
49
|
-
identifier: string;
|
|
50
|
-
/**
|
|
51
|
-
* app description
|
|
52
|
-
*/
|
|
53
|
-
description: string;
|
|
54
|
-
/**
|
|
55
|
-
* Set default app permissions
|
|
56
|
-
*/
|
|
57
|
-
defaultPermissions?: DefaultPermissions;
|
|
58
|
-
/**
|
|
59
|
-
* port where to start express application
|
|
60
|
-
*/
|
|
61
|
-
port?: number;
|
|
62
|
-
/**
|
|
63
|
-
* folder where module will create sqlite db file to persist credentials (e.g. {@example __dirname})
|
|
64
|
-
*/
|
|
65
|
-
dbFolder?: string;
|
|
66
|
-
/**
|
|
67
|
-
* config to configure PostgreSQL as a storage
|
|
68
|
-
*/
|
|
69
|
-
postgreConfig?: PostgreStorageConfig;
|
|
70
|
-
/**
|
|
71
|
-
* config to configure MySQL as a storage
|
|
72
|
-
*/
|
|
73
|
-
mysqlConfig?: MySQLStorageConfig;
|
|
74
|
-
/**
|
|
75
|
-
* integration module logic
|
|
76
|
-
*/
|
|
77
|
-
projectIntegration?: IntegrationLogic & ImagePath & Environments;
|
|
78
|
-
/**
|
|
79
|
-
* custom file format module logic
|
|
80
|
-
*/
|
|
81
|
-
customFileFormat?: CustomFileFormatLogic;
|
|
82
|
-
/**
|
|
83
|
-
* custom MT module logic
|
|
84
|
-
*/
|
|
85
|
-
customMT?: CustomMTLogic & ImagePath & Environments;
|
|
86
|
-
/**
|
|
87
|
-
* resources module
|
|
88
|
-
*/
|
|
89
|
-
profileResourcesMenu?: UiModule & ImagePath & Environments;
|
|
90
|
-
/**
|
|
91
|
-
* organization-menu module
|
|
92
|
-
*/
|
|
93
|
-
organizationMenu?: UiModule & ImagePath;
|
|
94
|
-
/**
|
|
95
|
-
* editor-right-panel module
|
|
96
|
-
*/
|
|
97
|
-
editorRightPanel?: EditorPanels & Environments;
|
|
98
|
-
/**
|
|
99
|
-
* editor-themes module
|
|
100
|
-
*/
|
|
101
|
-
editorThemes?: EditorThemes & ImagePath & Environments;
|
|
102
|
-
/**
|
|
103
|
-
* project menu module
|
|
104
|
-
*/
|
|
105
|
-
projectMenu?: UiModule & Environments;
|
|
106
|
-
/**
|
|
107
|
-
* project menu crowdsource module
|
|
108
|
-
*/
|
|
109
|
-
projectMenuCrowdsource?: UiModule;
|
|
110
|
-
/**
|
|
111
|
-
* tools module
|
|
112
|
-
*/
|
|
113
|
-
projectTools?: UiModule & ImagePath & Environments;
|
|
114
|
-
/**
|
|
115
|
-
* reports module
|
|
116
|
-
*/
|
|
117
|
-
projectReports?: UiModule & ImagePath;
|
|
118
|
-
/**
|
|
119
|
-
* API module
|
|
120
|
-
*/
|
|
121
|
-
api?: ApiModule;
|
|
122
|
-
/**
|
|
123
|
-
* context menu module
|
|
124
|
-
*/
|
|
125
|
-
contextMenu?: ContextModule & UiModule & Environments;
|
|
126
|
-
/**
|
|
127
|
-
* modal module
|
|
128
|
-
*/
|
|
129
|
-
modal?: ModuleContent & UiModule & Environments;
|
|
130
|
-
/**
|
|
131
|
-
* Uninstall hook for cleanup logic
|
|
132
|
-
*/
|
|
133
|
-
onUninstall?: (organization: string, allCredentials: {
|
|
134
|
-
settings?: any;
|
|
135
|
-
credentials: any;
|
|
136
|
-
}[]) => Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Error interceptor (can be used to log error in centralized place)
|
|
139
|
-
*/
|
|
140
|
-
onError?: (error: any, context?: CrowdinContextInfo) => void;
|
|
141
|
-
/**
|
|
142
|
-
* Disable global error handling of unhandledRejection and uncaughtException events
|
|
143
|
-
*/
|
|
144
|
-
disableGlobalErrorHandling?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Configuration to log everything that are happening in the app
|
|
147
|
-
*/
|
|
148
|
-
logger?: Logger;
|
|
149
|
-
/**
|
|
150
|
-
* Configuration of app pricing
|
|
151
|
-
*/
|
|
152
|
-
pricing?: Pricing;
|
|
153
|
-
filePreImport?: FilePreImportLogic;
|
|
154
|
-
filePostImport?: FilePostImportLogic;
|
|
155
|
-
filePreExport?: FilePreExportLogic;
|
|
156
|
-
filePostExport?: FilePostExportLogic;
|
|
157
|
-
/**
|
|
158
|
-
* Disable formatting logs
|
|
159
|
-
*/
|
|
160
|
-
disableLogsFormatter?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* AWS configuration for uploading big files to temporary bucket. Used with customFileFormat and file processors modules.
|
|
163
|
-
*
|
|
164
|
-
* Not necessary to configure if environment variables AWS_REGION and AWS_TMP_BUCKET_NAME are properly set.
|
|
165
|
-
*/
|
|
166
|
-
awsConfig?: AWSConfig;
|
|
167
|
-
customSpellchecker?: CustomSpellcheckerModule;
|
|
168
|
-
}
|
|
169
|
-
export type Config = ClientConfig & {
|
|
170
|
-
baseUrl: string;
|
|
171
|
-
clientId: string;
|
|
172
|
-
clientSecret: string;
|
|
173
|
-
port: number;
|
|
174
|
-
dbFolder: string;
|
|
175
|
-
imagePath: string;
|
|
176
|
-
};
|
|
177
|
-
export declare enum AuthenticationType {
|
|
178
|
-
CODE = "authorization_code",
|
|
179
|
-
APP = "crowdin_app"
|
|
180
|
-
}
|
|
181
|
-
export interface CrowdinUrls {
|
|
182
|
-
apiUrl?: string;
|
|
183
|
-
accountUrl?: string;
|
|
184
|
-
subscriptionUrl?: string;
|
|
185
|
-
}
|
|
186
|
-
export declare enum Scope {
|
|
187
|
-
ALL_SCOPES = "all",
|
|
188
|
-
NOTIFICATIONS = "notification",
|
|
189
|
-
TRANSLATION_MEMORIES = "tm",
|
|
190
|
-
MACHINE_TRANSLATION_ENGINES = "mt",
|
|
191
|
-
GLOSSARIES = "glossary",
|
|
192
|
-
USERS = "user",
|
|
193
|
-
TEAMS = "team",
|
|
194
|
-
GROUPS = "group",
|
|
195
|
-
PROJECTS = "project",
|
|
196
|
-
TASKS = "project.task",
|
|
197
|
-
REPORTS = "project.report",
|
|
198
|
-
TRANSLATION_STATUS = "project.status",
|
|
199
|
-
SOURCE_FILES_AND_STRINGS = "project.source",
|
|
200
|
-
WEBHOOKS = "project.webhook",
|
|
201
|
-
TRANSLATIONS = "project.translation",
|
|
202
|
-
SCREENSHOTS = "project.screenshot",
|
|
203
|
-
SECURITY_LOGS = "security-log",
|
|
204
|
-
VENDORS = "vendor"
|
|
205
|
-
}
|
|
206
|
-
export interface IntegrationLogic {
|
|
207
|
-
/**
|
|
208
|
-
* Customize your app login form
|
|
209
|
-
*/
|
|
210
|
-
loginForm: LoginForm;
|
|
211
|
-
/**
|
|
212
|
-
* Define login process via OAuth2 protocol
|
|
213
|
-
*/
|
|
214
|
-
oauthLogin?: OAuthLogin;
|
|
215
|
-
/**
|
|
216
|
-
* name of the root folder in Crowdin where files from integration will be stored, default your app name, will be ignored in case if {@link withRootFolder} is false
|
|
217
|
-
*/
|
|
218
|
-
appFolderName?: string;
|
|
219
|
-
/**
|
|
220
|
-
* flag that defines if the app should have a dedicated root folder in Crowdin files, default 'false'
|
|
221
|
-
*/
|
|
222
|
-
withRootFolder?: boolean;
|
|
223
|
-
/**
|
|
224
|
-
* function which will be used to check connection with integration service
|
|
225
|
-
*/
|
|
226
|
-
checkConnection?: (apiCredentials: any) => Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* function to get crowdin files that are related with this integration
|
|
229
|
-
*/
|
|
230
|
-
getCrowdinFiles?: (projectId: number, client: Crowdin, appRootFolder?: SourceFilesModel.Directory, config?: any) => Promise<TreeItem[]>;
|
|
231
|
-
/**
|
|
232
|
-
* function to get data from integration
|
|
233
|
-
*/
|
|
234
|
-
getIntegrationFiles: (apiCredentials: any, config?: any, parentId?: any, search?: any, page?: any) => Promise<TreeItem[] | ExtendedResult<TreeItem[]>>;
|
|
235
|
-
/**
|
|
236
|
-
* function to update crowdin files (e.g. pull integration data to crowdin source files)
|
|
237
|
-
*/
|
|
238
|
-
updateCrowdin: ({ projectId, client, credentials, request, rootFolder, appSettings, uploadTranslations, job, }: {
|
|
239
|
-
projectId: number;
|
|
240
|
-
client: Crowdin;
|
|
241
|
-
credentials: any;
|
|
242
|
-
request: IntegrationFile[];
|
|
243
|
-
rootFolder?: SourceFilesModel.Directory;
|
|
244
|
-
appSettings?: any;
|
|
245
|
-
uploadTranslations?: boolean;
|
|
246
|
-
job: JobClient;
|
|
247
|
-
}) => Promise<void | ExtendedResult<void>>;
|
|
248
|
-
/**
|
|
249
|
-
* function to update integration content (e.g. load crowdin translations and push them to integration service)
|
|
250
|
-
*/
|
|
251
|
-
updateIntegration: ({ projectId, client, credentials, request, rootFolder, appSettings, job, }: {
|
|
252
|
-
projectId: number;
|
|
253
|
-
client: Crowdin;
|
|
254
|
-
credentials: any;
|
|
255
|
-
request: UpdateIntegrationRequest;
|
|
256
|
-
rootFolder?: SourceFilesModel.Directory;
|
|
257
|
-
appSettings?: any;
|
|
258
|
-
job: JobClient;
|
|
259
|
-
}) => Promise<void | ExtendedResult<void>>;
|
|
260
|
-
/**
|
|
261
|
-
* function to define configuration(settings) modal for you app (by default app will not have any custom settings)
|
|
262
|
-
*/
|
|
263
|
-
getConfiguration?: (projectId: number, client: Crowdin, apiCredentials: any) => Promise<FormEntity[]>;
|
|
264
|
-
/**
|
|
265
|
-
* Logout hook for cleanup logic
|
|
266
|
-
*/
|
|
267
|
-
onLogout?: (projectId: number, client: Crowdin, apiCredentials: any, config?: any) => Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* flag to turn on auto reload of the tree whenever user updates the configuration
|
|
270
|
-
*/
|
|
271
|
-
reloadOnConfigSave?: boolean;
|
|
272
|
-
/**
|
|
273
|
-
* define info modal (help section) for you app (by default app will not have own info section)
|
|
274
|
-
*/
|
|
275
|
-
infoModal?: {
|
|
276
|
-
title: string;
|
|
277
|
-
content: string;
|
|
278
|
-
};
|
|
279
|
-
/**
|
|
280
|
-
* background jobs that will be executed for each crowdin project and user
|
|
281
|
-
*/
|
|
282
|
-
cronJobs?: CronJob[];
|
|
283
|
-
/**
|
|
284
|
-
* Enable new file sync when syncing via cron or webhook
|
|
285
|
-
*/
|
|
286
|
-
syncNewElements?: {
|
|
287
|
-
crowdin: boolean;
|
|
288
|
-
integration: boolean;
|
|
289
|
-
};
|
|
290
|
-
withCronSync?: {
|
|
291
|
-
crowdin: boolean;
|
|
292
|
-
integration: boolean;
|
|
293
|
-
};
|
|
294
|
-
withWebhookSync?: {
|
|
295
|
-
crowdin: boolean;
|
|
296
|
-
integration: boolean;
|
|
297
|
-
};
|
|
298
|
-
filtering?: {
|
|
299
|
-
crowdinLanguages: boolean;
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Enable integration folder open event
|
|
303
|
-
*/
|
|
304
|
-
integrationOneLevelFetching?: boolean;
|
|
305
|
-
/**
|
|
306
|
-
* Enable integration search event
|
|
307
|
-
*/
|
|
308
|
-
integrationSearchListener?: boolean;
|
|
309
|
-
/**
|
|
310
|
-
* Enable integration next page event
|
|
311
|
-
*/
|
|
312
|
-
integrationPagination?: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* Enable the option to upload translations to crowdin that are already present in the integration.
|
|
315
|
-
*/
|
|
316
|
-
uploadTranslations?: boolean;
|
|
317
|
-
/**
|
|
318
|
-
* function to get crowdin file translation progress
|
|
319
|
-
*/
|
|
320
|
-
getFileProgress?: (projectId: number, client: Crowdin, fileId: number) => Promise<{
|
|
321
|
-
[key: number]: TranslationStatusModel.LanguageProgress[];
|
|
322
|
-
}>;
|
|
323
|
-
/**
|
|
324
|
-
* Register Crowdin webhook to get notified when translations are ready
|
|
325
|
-
*/
|
|
326
|
-
webhooks?: Webhooks;
|
|
327
|
-
/**
|
|
328
|
-
* define a notification for your application at the top of the screen
|
|
329
|
-
*/
|
|
330
|
-
notice?: {
|
|
331
|
-
title: string;
|
|
332
|
-
content: string;
|
|
333
|
-
type: NoticeType;
|
|
334
|
-
icon: boolean;
|
|
335
|
-
close: boolean;
|
|
336
|
-
};
|
|
337
|
-
skipIntegrationNodes?: SkipIntegrationNodes;
|
|
338
|
-
/**
|
|
339
|
-
* Async progress checking time interval to update job progress, im ms.
|
|
340
|
-
*
|
|
341
|
-
* Default 1000
|
|
342
|
-
*/
|
|
343
|
-
asyncProgress?: {
|
|
344
|
-
checkInterval?: number;
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
export interface SkipIntegrationNodes {
|
|
348
|
-
fileNamePattern?: string;
|
|
349
|
-
folderNamePattern?: string;
|
|
350
|
-
}
|
|
351
|
-
export type FormEntity = FormField | FormDelimiter;
|
|
352
|
-
export interface FormDelimiter {
|
|
353
|
-
label?: string;
|
|
354
|
-
labelHtml?: string;
|
|
355
|
-
}
|
|
356
|
-
export interface LoginForm {
|
|
357
|
-
fields: FormEntity[];
|
|
358
|
-
}
|
|
359
|
-
export interface OAuthLogin {
|
|
360
|
-
/**
|
|
361
|
-
* Extra field for login form
|
|
362
|
-
*/
|
|
363
|
-
loginFields?: FormField[];
|
|
364
|
-
/**
|
|
365
|
-
* Authorization url (e.g. https://github.com/login/oauth/authorize or https://accounts.google.com/o/oauth2/v2/auth)
|
|
366
|
-
*/
|
|
367
|
-
authorizationUrl?: string;
|
|
368
|
-
/**
|
|
369
|
-
* Authorization url getter
|
|
370
|
-
*/
|
|
371
|
-
getAuthorizationUrl?: (redirectUrl: string, loginForm?: any) => string;
|
|
372
|
-
/**
|
|
373
|
-
* Access token url (e.g. https://github.com/login/oauth/access_token)
|
|
374
|
-
*/
|
|
375
|
-
accessTokenUrl: string;
|
|
376
|
-
/**
|
|
377
|
-
* Url to refresh token, default will use {@link accessTokenUrl}. Needed when {@link refresh} is enabled
|
|
378
|
-
*/
|
|
379
|
-
refreshTokenUrl?: string;
|
|
380
|
-
/**
|
|
381
|
-
* The scopes of access, usually expressed as a list of space-delimited, case-sensitive strings
|
|
382
|
-
*/
|
|
383
|
-
scope?: string;
|
|
384
|
-
/**
|
|
385
|
-
* Client id
|
|
386
|
-
*/
|
|
387
|
-
clientId: string;
|
|
388
|
-
/**
|
|
389
|
-
* Client secret
|
|
390
|
-
*/
|
|
391
|
-
clientSecret: string;
|
|
392
|
-
/**
|
|
393
|
-
* default '/oauth/code'
|
|
394
|
-
*/
|
|
395
|
-
redirectUriRoute?: string;
|
|
396
|
-
/**
|
|
397
|
-
* request/response fields mapping
|
|
398
|
-
*/
|
|
399
|
-
fieldsMapping?: {
|
|
400
|
-
/**
|
|
401
|
-
* default 'client_id'
|
|
402
|
-
*/
|
|
403
|
-
clientId?: string;
|
|
404
|
-
/**
|
|
405
|
-
* default 'client_secret'
|
|
406
|
-
*/
|
|
407
|
-
clientSecret?: string;
|
|
408
|
-
/**
|
|
409
|
-
* default 'scope'
|
|
410
|
-
*/
|
|
411
|
-
scope?: string;
|
|
412
|
-
/**
|
|
413
|
-
* default 'redirect_uri'
|
|
414
|
-
*/
|
|
415
|
-
redirectUri?: string;
|
|
416
|
-
/**
|
|
417
|
-
* default 'code'
|
|
418
|
-
*/
|
|
419
|
-
code: string;
|
|
420
|
-
/**
|
|
421
|
-
* default 'access_token'
|
|
422
|
-
*/
|
|
423
|
-
accessToken?: string;
|
|
424
|
-
/**
|
|
425
|
-
* default 'refresh_token'
|
|
426
|
-
*/
|
|
427
|
-
refreshToken?: string;
|
|
428
|
-
/**
|
|
429
|
-
* default 'expires_in'
|
|
430
|
-
*/
|
|
431
|
-
expiresIn?: string;
|
|
432
|
-
};
|
|
433
|
-
/**
|
|
434
|
-
* default 'false' which means that the access token has no expiration date
|
|
435
|
-
*/
|
|
436
|
-
refresh?: boolean;
|
|
437
|
-
/**
|
|
438
|
-
* Additional URL parameters for authorizarion url
|
|
439
|
-
*/
|
|
440
|
-
extraAutorizationUrlParameters?: {
|
|
441
|
-
[key: string]: string;
|
|
442
|
-
};
|
|
443
|
-
/**
|
|
444
|
-
* Additional parameters for access token request
|
|
445
|
-
*/
|
|
446
|
-
extraAccessTokenParameters?: {
|
|
447
|
-
[key: string]: any;
|
|
448
|
-
};
|
|
449
|
-
/**
|
|
450
|
-
* Additional parameters for refresh token request
|
|
451
|
-
*/
|
|
452
|
-
extraRefreshTokenParameters?: {
|
|
453
|
-
[key: string]: any;
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* Override to implement request for retrieving access token (and refresh token if 'refresh' is enabled)
|
|
457
|
-
*/
|
|
458
|
-
performGetTokenRequest?: (code: string, query: {
|
|
459
|
-
[key: string]: any;
|
|
460
|
-
}, url: string) => Promise<any>;
|
|
461
|
-
/**
|
|
462
|
-
* Override to implement request for refreshing token (only if 'refresh' is enabled)
|
|
463
|
-
*/
|
|
464
|
-
performRefreshTokenRequest?: (currentCredentials: any) => Promise<any>;
|
|
465
|
-
}
|
|
466
|
-
export interface Environments {
|
|
467
|
-
environments: 'crowdin' | 'crowdin-enterprise';
|
|
468
|
-
}
|
|
469
|
-
export interface FormField {
|
|
470
|
-
key: string;
|
|
471
|
-
helpText?: string;
|
|
472
|
-
helpTextHtml?: string;
|
|
473
|
-
label: string;
|
|
474
|
-
type?: 'text' | 'password' | 'checkbox' | 'select' | 'textarea' | 'file';
|
|
475
|
-
defaultValue?: any;
|
|
476
|
-
/**
|
|
477
|
-
* only for select
|
|
478
|
-
*/
|
|
479
|
-
isMulti?: boolean;
|
|
480
|
-
/**
|
|
481
|
-
* only for select
|
|
482
|
-
*/
|
|
483
|
-
isSearchable?: boolean;
|
|
484
|
-
/**
|
|
485
|
-
* only for select
|
|
486
|
-
*/
|
|
487
|
-
options?: {
|
|
488
|
-
label: string;
|
|
489
|
-
value: string;
|
|
490
|
-
}[];
|
|
491
|
-
/**
|
|
492
|
-
* only for type file
|
|
493
|
-
*/
|
|
494
|
-
accept?: string;
|
|
495
|
-
/**
|
|
496
|
-
* field dependency settings
|
|
497
|
-
*/
|
|
498
|
-
dependencySettings?: string;
|
|
499
|
-
}
|
|
500
|
-
export interface ExtendedResult<T> {
|
|
501
|
-
data?: T;
|
|
502
|
-
message?: string;
|
|
503
|
-
stopPagination?: boolean;
|
|
504
|
-
}
|
|
505
|
-
export type TreeItem = File | Folder;
|
|
506
|
-
/**
|
|
507
|
-
* 0 - folder
|
|
508
|
-
* 1 - file
|
|
509
|
-
* 2 - branch
|
|
510
|
-
*/
|
|
511
|
-
type IntegrationTreeElementType = '0' | '1' | '2';
|
|
512
|
-
type LabelTreeElementType = 'primary' | 'secondary' | 'success' | 'warning' | 'info' | 'danger' | 'dark' | 'light';
|
|
513
|
-
export interface LabelTreeElement {
|
|
514
|
-
text: string;
|
|
515
|
-
type?: LabelTreeElementType;
|
|
516
|
-
color?: string;
|
|
517
|
-
}
|
|
518
|
-
export interface File {
|
|
519
|
-
id: string;
|
|
520
|
-
name: string;
|
|
521
|
-
type: SourceFilesModel.FileType;
|
|
522
|
-
parentId?: string;
|
|
523
|
-
nodeType?: IntegrationTreeElementType;
|
|
524
|
-
customContent?: string;
|
|
525
|
-
labels?: LabelTreeElement;
|
|
526
|
-
}
|
|
527
|
-
export interface Folder {
|
|
528
|
-
id: string;
|
|
529
|
-
name: string;
|
|
530
|
-
parentId?: string;
|
|
531
|
-
nodeType?: IntegrationTreeElementType;
|
|
532
|
-
customContent?: string;
|
|
533
|
-
labels?: LabelTreeElement;
|
|
534
|
-
}
|
|
535
|
-
export interface IntegrationRequest extends CrowdinClientRequest {
|
|
536
|
-
integrationCredentials: any;
|
|
537
|
-
integrationSettings?: any;
|
|
538
|
-
}
|
|
539
|
-
export interface CrowdinClientRequest extends Request {
|
|
540
|
-
crowdinApiClient: Crowdin;
|
|
541
|
-
crowdinContext: CrowdinContextInfo;
|
|
542
|
-
subscriptionInfo?: SubscriptionInfo;
|
|
543
|
-
logInfo: LogFunction;
|
|
544
|
-
logError: LogErrorFunction;
|
|
545
|
-
}
|
|
546
|
-
export interface CrowdinCredentials {
|
|
547
|
-
id: string;
|
|
548
|
-
appSecret: string;
|
|
549
|
-
domain?: string;
|
|
550
|
-
userId: number;
|
|
551
|
-
organizationId: number;
|
|
552
|
-
baseUrl: string;
|
|
553
|
-
accessToken: string;
|
|
554
|
-
refreshToken: string;
|
|
555
|
-
expire: string;
|
|
556
|
-
type: AccountType;
|
|
557
|
-
}
|
|
558
|
-
export declare enum AccountType {
|
|
559
|
-
NORMAL = "normal",
|
|
560
|
-
ENTERPRISE = "enterprise"
|
|
561
|
-
}
|
|
562
|
-
export interface CrowdinContextInfo {
|
|
563
|
-
jwtPayload: JwtPayload;
|
|
564
|
-
crowdinId: string;
|
|
565
|
-
clientId: string;
|
|
566
|
-
appIdentifier: string;
|
|
567
|
-
}
|
|
568
|
-
export declare enum SubscriptionInfoType {
|
|
569
|
-
TRIAL = "trial",
|
|
570
|
-
SUBSCRIPTION = "subscription"
|
|
571
|
-
}
|
|
572
|
-
export interface SubscriptionInfo {
|
|
573
|
-
expired: boolean;
|
|
574
|
-
subscribeLink?: string;
|
|
575
|
-
daysLeft?: number;
|
|
576
|
-
type?: SubscriptionInfoType;
|
|
577
|
-
}
|
|
578
|
-
export interface IntegrationCredentials {
|
|
579
|
-
id: string;
|
|
580
|
-
credentials: any;
|
|
581
|
-
crowdinId: string;
|
|
582
|
-
}
|
|
583
|
-
export interface IntegrationConfig {
|
|
584
|
-
id: number;
|
|
585
|
-
integrationId: string;
|
|
586
|
-
crowdinId: string;
|
|
587
|
-
config: any;
|
|
588
|
-
}
|
|
589
|
-
export interface IntegrationFile {
|
|
590
|
-
id: string;
|
|
591
|
-
name: string;
|
|
592
|
-
type: SourceFilesModel.FileType;
|
|
593
|
-
parentId: string;
|
|
594
|
-
nodeType?: IntegrationTreeElementType;
|
|
595
|
-
}
|
|
596
|
-
export interface UpdateIntegrationRequest {
|
|
597
|
-
[fileId: string]: string[];
|
|
598
|
-
}
|
|
599
|
-
export interface CronJob {
|
|
600
|
-
task: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: any) => Promise<void>;
|
|
601
|
-
expression: string;
|
|
602
|
-
}
|
|
603
|
-
export interface FileProcessLogic {
|
|
604
|
-
/**
|
|
605
|
-
* Folder where larger file will be temporary stored (default "{@link dbFolder}/custom-file-format")
|
|
606
|
-
*/
|
|
607
|
-
filesFolder?: string;
|
|
608
|
-
/**
|
|
609
|
-
* Contains fileName and/or fileContent regular expressions used to detect file type when uploading a new source file via UI (or via API without specified type parameter). If the file matches regular expressions, it's labeled as a custom format file.
|
|
610
|
-
*/
|
|
611
|
-
signaturePatterns?: SignaturePatterns;
|
|
612
|
-
/**
|
|
613
|
-
* Override to store huge responses (by default they will be stored in fs)
|
|
614
|
-
*/
|
|
615
|
-
storeFile?: (content: Buffer) => Promise<string>;
|
|
616
|
-
}
|
|
617
|
-
export interface CustomFileFormatLogic extends FileProcessLogic {
|
|
618
|
-
/**
|
|
619
|
-
* The type parameter value for a custom file format. Used for a custom format file upload via API.
|
|
620
|
-
*/
|
|
621
|
-
type: string;
|
|
622
|
-
/**
|
|
623
|
-
* This parameter is used to combine the content of multiple languages into one request when uploading and downloading translations in your Crowdin project.
|
|
624
|
-
*/
|
|
625
|
-
multilingual?: boolean;
|
|
626
|
-
/**
|
|
627
|
-
* Flag to automatically upload translations
|
|
628
|
-
*/
|
|
629
|
-
autoUploadTranslations?: boolean;
|
|
630
|
-
/**
|
|
631
|
-
* Enable strings export
|
|
632
|
-
*/
|
|
633
|
-
stringsExport?: boolean;
|
|
634
|
-
/**
|
|
635
|
-
* File extensions (used for strings export)
|
|
636
|
-
*/
|
|
637
|
-
extensions?: string[];
|
|
638
|
-
/**
|
|
639
|
-
* Enable custom srx
|
|
640
|
-
*/
|
|
641
|
-
customSrxSupported?: boolean;
|
|
642
|
-
/**
|
|
643
|
-
* Enable multi language strings export
|
|
644
|
-
*/
|
|
645
|
-
multilingualExport?: boolean;
|
|
646
|
-
/**
|
|
647
|
-
* Used for initial source file upload, source file update, and translation upload
|
|
648
|
-
*/
|
|
649
|
-
parseFile?: (fileContent: Buffer, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ParseFileResponse>;
|
|
650
|
-
/**
|
|
651
|
-
* Used for translation download
|
|
652
|
-
*/
|
|
653
|
-
buildFile?: (fileContent: Buffer, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, strings: ProcessFileString[], client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
|
|
654
|
-
/**
|
|
655
|
-
* Used for strings export
|
|
656
|
-
*/
|
|
657
|
-
exportStrings?: (req: Omit<ProcessFileRequest, 'jobType'>, strings: ProcessFileString[], client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
|
|
658
|
-
}
|
|
659
|
-
export type FileImportExportLogic = FilePreImportLogic | FilePostImportLogic | FilePreExportLogic | FilePostExportLogic;
|
|
660
|
-
export type FileImportExportContent = ProcessFileString[] | Buffer | undefined;
|
|
661
|
-
export interface FilePreImportLogic extends FileProcessLogic {
|
|
662
|
-
fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ContentFileResponse>;
|
|
663
|
-
}
|
|
664
|
-
export interface FilePostImportLogic extends FileProcessLogic {
|
|
665
|
-
fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<StringsFileResponse>;
|
|
666
|
-
}
|
|
667
|
-
export interface FilePreExportLogic extends FileProcessLogic {
|
|
668
|
-
fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<StringsFileResponse>;
|
|
669
|
-
}
|
|
670
|
-
export interface FilePostExportLogic extends FileProcessLogic {
|
|
671
|
-
fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ContentFileResponse>;
|
|
672
|
-
}
|
|
673
|
-
export interface SignaturePatterns {
|
|
674
|
-
fileName?: string;
|
|
675
|
-
fileContent?: string;
|
|
676
|
-
}
|
|
677
|
-
export interface ProcessFileRequest {
|
|
678
|
-
jobType: ProcessFileJobType;
|
|
679
|
-
file: ProcessFileRecord;
|
|
680
|
-
sourceLanguage: LanguagesModel.Language;
|
|
681
|
-
targetLanguages: LanguagesModel.Language[];
|
|
682
|
-
strings: ProcessFileString[];
|
|
683
|
-
stringsUrl: string;
|
|
684
|
-
getRawContent?: (encoding: BufferEncoding) => Promise<string | Buffer>;
|
|
685
|
-
}
|
|
686
|
-
export interface ProcessFileRecord {
|
|
687
|
-
content?: string;
|
|
688
|
-
contentUrl?: string;
|
|
689
|
-
path?: string;
|
|
690
|
-
id?: number;
|
|
691
|
-
name?: string;
|
|
692
|
-
}
|
|
693
|
-
export declare enum ProcessFileJobType {
|
|
694
|
-
PARSE_FILE = "parse-file",
|
|
695
|
-
BUILD_FILE = "build-file",
|
|
696
|
-
PRE_IMPORT = "pre-import-file",
|
|
697
|
-
POST_IMPORT = "post-import-file",
|
|
698
|
-
PRE_EXPORT = "pre-export-file",
|
|
699
|
-
POST_EXPORT = "post-export-file"
|
|
700
|
-
}
|
|
701
|
-
export interface ParseFileResponse {
|
|
702
|
-
previewFile?: Buffer;
|
|
703
|
-
strings?: ProcessFileString[];
|
|
704
|
-
error?: string;
|
|
705
|
-
}
|
|
706
|
-
export interface BuildFileResponse {
|
|
707
|
-
contentFile: Buffer;
|
|
708
|
-
error?: string;
|
|
709
|
-
fileName?: string;
|
|
710
|
-
fileType?: string;
|
|
711
|
-
}
|
|
712
|
-
export interface StringsFileResponse extends Omit<ParseFileResponse, 'previewFile'> {
|
|
713
|
-
notModified?: boolean;
|
|
714
|
-
}
|
|
715
|
-
export interface ContentFileResponse extends BuildFileResponse {
|
|
716
|
-
notModified?: boolean;
|
|
717
|
-
}
|
|
718
|
-
export interface ProcessFileString {
|
|
719
|
-
previewId?: number;
|
|
720
|
-
id: number;
|
|
721
|
-
identifier: string;
|
|
722
|
-
context?: string;
|
|
723
|
-
customData?: string;
|
|
724
|
-
maxLength?: number;
|
|
725
|
-
isHidden?: boolean;
|
|
726
|
-
hasPlurals?: boolean;
|
|
727
|
-
labels?: string[];
|
|
728
|
-
text: string | SourceStringsModel.PluralText;
|
|
729
|
-
translations?: StringTranslations;
|
|
730
|
-
uniqId?: string;
|
|
731
|
-
}
|
|
732
|
-
export interface StringTranslations {
|
|
733
|
-
[language: string]: {
|
|
734
|
-
text: string | SourceStringsModel.PluralText;
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
export interface CustomMTLogic {
|
|
738
|
-
withContext?: boolean;
|
|
739
|
-
translate: (client: Crowdin, context: CrowdinContextInfo, projectId: number, source: string, target: string, strings: CustomMtString[]) => Promise<string[]>;
|
|
740
|
-
validate?: (client: Crowdin) => Promise<void>;
|
|
741
|
-
}
|
|
742
|
-
export interface CustomMTRequest {
|
|
743
|
-
strings: CustomMtString[];
|
|
744
|
-
}
|
|
745
|
-
export type CustomMtString = string | {
|
|
746
|
-
id: number;
|
|
747
|
-
projectId: number;
|
|
748
|
-
fileId: number;
|
|
749
|
-
identifier: string;
|
|
750
|
-
context: string;
|
|
751
|
-
maxLength: number;
|
|
752
|
-
isHidden: boolean;
|
|
753
|
-
text: string | SourceStringsModel.PluralText;
|
|
754
|
-
isPlural: boolean;
|
|
755
|
-
pluralForm: any;
|
|
756
|
-
};
|
|
757
|
-
export interface UiModule {
|
|
758
|
-
/**
|
|
759
|
-
* Form schema for react-jsonschema-doc to be used as front-end
|
|
760
|
-
* https://rjsf-team.github.io/react-jsonschema-form/docs
|
|
761
|
-
*/
|
|
762
|
-
formSchema?: object;
|
|
763
|
-
/**
|
|
764
|
-
* URL to custom endpoint that can be used instead of default one to save form data.
|
|
765
|
-
* Endpoint should accept POST requests.
|
|
766
|
-
*/
|
|
767
|
-
formPostDataUrl?: string;
|
|
768
|
-
/**
|
|
769
|
-
* URL to custom endpoint that can be used instead of default one to retrieve form data.
|
|
770
|
-
* Endpoint should accept GET requests.
|
|
771
|
-
*/
|
|
772
|
-
formGetDataUrl?: string;
|
|
773
|
-
/**
|
|
774
|
-
* Additional attributes for react-jsonschema-doc
|
|
775
|
-
*/
|
|
776
|
-
formUiSchema?: object;
|
|
777
|
-
/**
|
|
778
|
-
* path to ui folder (e.g. {@example join(__dirname, 'public')})
|
|
779
|
-
*/
|
|
780
|
-
uiPath?: string;
|
|
781
|
-
/**
|
|
782
|
-
* page name (default index.html)
|
|
783
|
-
*/
|
|
784
|
-
fileName?: string;
|
|
785
|
-
/**
|
|
786
|
-
* make module publicly available without crowdin context
|
|
787
|
-
*/
|
|
788
|
-
allowUnauthorized?: boolean;
|
|
789
|
-
/**
|
|
790
|
-
* Module name
|
|
791
|
-
*/
|
|
792
|
-
name?: string;
|
|
793
|
-
}
|
|
794
|
-
export interface EditorPanels extends UiModule {
|
|
795
|
-
/**
|
|
796
|
-
* The Editor's mode list where the module will be available.
|
|
797
|
-
*/
|
|
798
|
-
modes: EditorMode[];
|
|
799
|
-
}
|
|
800
|
-
export interface EditorThemes {
|
|
801
|
-
/**
|
|
802
|
-
* Module name
|
|
803
|
-
*/
|
|
804
|
-
name?: string;
|
|
805
|
-
/**
|
|
806
|
-
* Defines a set of CSS custom variables for theming purposes
|
|
807
|
-
*/
|
|
808
|
-
styles: {
|
|
809
|
-
[key: string]: string;
|
|
810
|
-
};
|
|
811
|
-
/**
|
|
812
|
-
* The Editor's mode list where the module will be available.
|
|
813
|
-
*/
|
|
814
|
-
modes: EditorMode[];
|
|
815
|
-
}
|
|
816
|
-
export declare enum EditorMode {
|
|
817
|
-
ASSETS = "assets",
|
|
818
|
-
REVIEW = "review",
|
|
819
|
-
TRANSLATE = "TRANSLATE",
|
|
820
|
-
PROOFREAD = "proofread"
|
|
821
|
-
}
|
|
822
|
-
interface ModuleContent {
|
|
823
|
-
/**
|
|
824
|
-
* relative URL to the content page of the module
|
|
825
|
-
*/
|
|
826
|
-
url?: string;
|
|
827
|
-
}
|
|
828
|
-
export interface ContextModule {
|
|
829
|
-
location: ContextOptionsLocations;
|
|
830
|
-
type: ContextOptionsTypes;
|
|
831
|
-
module: string;
|
|
832
|
-
/**
|
|
833
|
-
* Context menu name
|
|
834
|
-
*/
|
|
835
|
-
name?: string;
|
|
836
|
-
/**
|
|
837
|
-
* Support fileName pattern only. Contains fileName field regular expressions used to detect the file type. If the file name matches any of the regular expressions, the context menu will be displayed.
|
|
838
|
-
*/
|
|
839
|
-
signaturePatterns?: SignaturePatterns;
|
|
840
|
-
}
|
|
841
|
-
export declare enum ContextOptionsLocations {
|
|
842
|
-
TM = "tm",
|
|
843
|
-
GLOSSARY = "glossary",
|
|
844
|
-
LANGUAGE = "language",
|
|
845
|
-
SCREENSHOT = "screenshot",
|
|
846
|
-
SOURCE_FILE = "source_file",
|
|
847
|
-
TRANSLATED_FILE = "translated_file"
|
|
848
|
-
}
|
|
849
|
-
export declare enum ContextOptionsTypes {
|
|
850
|
-
MODAL = "modal",
|
|
851
|
-
NEW_TAB = "new_tab",
|
|
852
|
-
REDIRECT = "redirect"
|
|
853
|
-
}
|
|
854
|
-
export interface CrowdinAppUtilities extends CrowdinMetadataStore {
|
|
855
|
-
establishCrowdinConnection: (authRequest: string | CrowdinClientRequest) => Promise<{
|
|
856
|
-
context: CrowdinContextInfo;
|
|
857
|
-
client?: Crowdin;
|
|
858
|
-
}>;
|
|
859
|
-
encryptCrowdinConnection: (data: {
|
|
860
|
-
crowdinId: string;
|
|
861
|
-
extra: Record<string, any>;
|
|
862
|
-
}) => string;
|
|
863
|
-
dencryptCrowdinConnection: (hash: string) => Promise<{
|
|
864
|
-
client: Crowdin;
|
|
865
|
-
extra: Record<string, any>;
|
|
866
|
-
}>;
|
|
867
|
-
}
|
|
868
|
-
export interface CrowdinMetadataStore {
|
|
869
|
-
saveMetadata: (id: string, metadata: any, crowdinId?: string) => Promise<void>;
|
|
870
|
-
getMetadata: (id: string) => Promise<any | undefined>;
|
|
871
|
-
deleteMetadata: (id: string) => Promise<void>;
|
|
872
|
-
/**
|
|
873
|
-
* Settings that users manage in the integration module
|
|
874
|
-
*/
|
|
875
|
-
getUserSettings: (clientId: string) => Promise<any | undefined>;
|
|
876
|
-
}
|
|
877
|
-
export declare enum Provider {
|
|
878
|
-
CROWDIN = "crowdin",
|
|
879
|
-
INTEGRATION = "integration"
|
|
880
|
-
}
|
|
881
|
-
export interface IntegrationSyncSettings {
|
|
882
|
-
id: number;
|
|
883
|
-
files?: any;
|
|
884
|
-
integrationId: string;
|
|
885
|
-
crowdinId: string;
|
|
886
|
-
provider: Provider;
|
|
887
|
-
}
|
|
888
|
-
export interface IntegrationFilesSnapshot {
|
|
889
|
-
id: number;
|
|
890
|
-
files?: any;
|
|
891
|
-
integrationId: string;
|
|
892
|
-
crowdinId: string;
|
|
893
|
-
provider: Provider;
|
|
894
|
-
}
|
|
895
|
-
export interface IntegrationWebhooks {
|
|
896
|
-
id: number;
|
|
897
|
-
fileId: number;
|
|
898
|
-
integrationId: string;
|
|
899
|
-
crowdinId: string;
|
|
900
|
-
provider: Provider;
|
|
901
|
-
}
|
|
902
|
-
export interface UserErrors {
|
|
903
|
-
id: number;
|
|
904
|
-
action: string;
|
|
905
|
-
message: string;
|
|
906
|
-
data: any;
|
|
907
|
-
createdAt: string;
|
|
908
|
-
crowdinId: string;
|
|
909
|
-
integrationId?: string;
|
|
910
|
-
}
|
|
911
|
-
export interface ImagePath {
|
|
912
|
-
/**
|
|
913
|
-
* path to app logo (e.g. {@example join(__dirname, 'logo.png')})
|
|
914
|
-
*/
|
|
915
|
-
imagePath?: string;
|
|
916
|
-
}
|
|
917
|
-
export declare enum RequestMethods {
|
|
918
|
-
GET = "GET",
|
|
919
|
-
POST = "POST",
|
|
920
|
-
PUT = "PUT",
|
|
921
|
-
PATCH = "PATCH",
|
|
922
|
-
DELETE = "DELETE"
|
|
923
|
-
}
|
|
924
|
-
export interface ApiEndpoints {
|
|
925
|
-
key: string;
|
|
926
|
-
name: string;
|
|
927
|
-
url: string;
|
|
928
|
-
method: RequestMethods;
|
|
929
|
-
description?: string;
|
|
930
|
-
documentationUrl?: string;
|
|
931
|
-
}
|
|
932
|
-
export interface ApiModule {
|
|
933
|
-
default?: boolean;
|
|
934
|
-
endpoints?: ApiEndpoints[];
|
|
935
|
-
docFile?: string;
|
|
936
|
-
}
|
|
937
|
-
export interface CustomSpellCheckRequest {
|
|
938
|
-
language: string;
|
|
939
|
-
texts: string[];
|
|
940
|
-
}
|
|
941
|
-
export type SpellCheckCategory = 'typography' | 'casing' | 'grammar' | 'typos' | 'punctuation' | 'confused_words' | 'redundancy' | 'style' | 'gender_neutrality' | 'semantics' | 'colloquialisms' | 'wikipedia' | 'barbarism' | 'misc';
|
|
942
|
-
export interface SupportedLanguage {
|
|
943
|
-
code: string;
|
|
944
|
-
name: string;
|
|
945
|
-
}
|
|
946
|
-
export interface SpellCheckMatch {
|
|
947
|
-
category: SpellCheckCategory;
|
|
948
|
-
message: string;
|
|
949
|
-
shortMessage: string;
|
|
950
|
-
offset: number;
|
|
951
|
-
length: number;
|
|
952
|
-
replacements: string[];
|
|
953
|
-
}
|
|
954
|
-
export interface CustomSpellCheckResponse {
|
|
955
|
-
texts: {
|
|
956
|
-
text: string;
|
|
957
|
-
matches: SpellCheckMatch[];
|
|
958
|
-
}[];
|
|
959
|
-
error?: string;
|
|
960
|
-
}
|
|
961
|
-
export interface CustomSpellcheckerModule extends Environments {
|
|
962
|
-
/**
|
|
963
|
-
* module description
|
|
964
|
-
*/
|
|
965
|
-
description?: string;
|
|
966
|
-
/**
|
|
967
|
-
* module name
|
|
968
|
-
*/
|
|
969
|
-
name?: string;
|
|
970
|
-
/**
|
|
971
|
-
* Settings UI module
|
|
972
|
-
*/
|
|
973
|
-
settingsUiModule?: UiModule;
|
|
974
|
-
/**
|
|
975
|
-
* function to get list of supported languages that are supports by current spellchecker
|
|
976
|
-
*/
|
|
977
|
-
getSupportedLanguage: ({ client, context, }: {
|
|
978
|
-
client: Crowdin;
|
|
979
|
-
context: CrowdinContextInfo;
|
|
980
|
-
}) => Promise<SupportedLanguage[]>;
|
|
981
|
-
/**
|
|
982
|
-
* function to check spelling
|
|
983
|
-
*/
|
|
984
|
-
runSpellCheck: ({ client, context, language, texts, }: {
|
|
985
|
-
client: Crowdin;
|
|
986
|
-
context: CrowdinContextInfo;
|
|
987
|
-
language: string;
|
|
988
|
-
texts: string[];
|
|
989
|
-
}) => Promise<CustomSpellCheckResponse>;
|
|
990
|
-
}
|
|
991
|
-
export interface Logger {
|
|
992
|
-
enabled: boolean;
|
|
993
|
-
log?: (message: string, context?: CrowdinContextInfo) => void;
|
|
994
|
-
}
|
|
995
|
-
export interface Pricing {
|
|
996
|
-
planType: 'free' | 'recurring';
|
|
997
|
-
trial?: number;
|
|
998
|
-
trialCrowdin?: number;
|
|
999
|
-
trialEnterprise?: number;
|
|
1000
|
-
cachingSeconds?: number;
|
|
1001
|
-
infoDisplayDaysThreshold?: number;
|
|
1002
|
-
}
|
|
1003
|
-
export interface Webhooks {
|
|
1004
|
-
crowdinWebhookUrl?: string;
|
|
1005
|
-
integrationWebhookUrl?: string;
|
|
1006
|
-
urlParam?: string;
|
|
1007
|
-
crowdinWebhooks?: (client: Crowdin, projectId: number, available: boolean, config?: AppSettings) => Promise<void>;
|
|
1008
|
-
integrationWebhooks?: (apiCredentials: any, urlParam: string, available: boolean, config?: AppSettings, syncSettings?: any) => Promise<void>;
|
|
1009
|
-
crowdinWebhookInterceptor?: (projectId: number, client: Crowdin, appRootFolder?: SourceFilesModel.Directory, config?: any, syncSettings?: any, webhookRequest?: any) => Promise<UpdateIntegrationRequest>;
|
|
1010
|
-
integrationWebhookInterceptor?: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: AppSettings, syncSettings?: any, webhookRequests?: any) => Promise<IntegrationFile[]>;
|
|
1011
|
-
queueUrl: string;
|
|
1012
|
-
}
|
|
1013
|
-
export declare enum SyncCondition {
|
|
1014
|
-
ALL = 0,
|
|
1015
|
-
TRANSLATED = 1,
|
|
1016
|
-
APPROVED = 2
|
|
1017
|
-
}
|
|
1018
|
-
export declare enum SyncSchedule {
|
|
1019
|
-
DISABLED = 0,
|
|
1020
|
-
ACTIVE
|
|
1021
|
-
}
|
|
1022
|
-
export type Payload = {
|
|
1023
|
-
event: string;
|
|
1024
|
-
projectId: string;
|
|
1025
|
-
language: string;
|
|
1026
|
-
fileId: string;
|
|
1027
|
-
};
|
|
1028
|
-
export type WebhookUrlParams = {
|
|
1029
|
-
projectId: number;
|
|
1030
|
-
crowdinId: string;
|
|
1031
|
-
clientId: string;
|
|
1032
|
-
};
|
|
1033
|
-
export interface GetAllNewFilesArgs {
|
|
1034
|
-
config: Config;
|
|
1035
|
-
integration: IntegrationLogic;
|
|
1036
|
-
crowdinApiClient: Crowdin;
|
|
1037
|
-
crowdinId: string;
|
|
1038
|
-
integrationCredentials: any;
|
|
1039
|
-
integrationId: string;
|
|
1040
|
-
projectId: number;
|
|
1041
|
-
integrationSettings: any;
|
|
1042
|
-
syncSettings: IntegrationSyncSettings;
|
|
1043
|
-
}
|
|
1044
|
-
export interface UpdateCrowdinWebhookPayloadsArgs {
|
|
1045
|
-
integration: IntegrationLogic;
|
|
1046
|
-
webhookData: any;
|
|
1047
|
-
req: Request[];
|
|
1048
|
-
}
|
|
1049
|
-
export interface FilterSyncFilesArgs {
|
|
1050
|
-
projectId: number;
|
|
1051
|
-
crowdinClient: Crowdin;
|
|
1052
|
-
events: Payload[];
|
|
1053
|
-
syncFileSettings: UpdateIntegrationRequest;
|
|
1054
|
-
appSettings: AppSettings;
|
|
1055
|
-
}
|
|
1056
|
-
export interface AppSettings {
|
|
1057
|
-
schedule?: number;
|
|
1058
|
-
condition?: number;
|
|
1059
|
-
'new-crowdin-files'?: boolean;
|
|
1060
|
-
'new-integration-files'?: boolean;
|
|
1061
|
-
[key: string]: any;
|
|
1062
|
-
}
|
|
1063
|
-
export declare enum UserPermissions {
|
|
1064
|
-
OWNER = "owner",
|
|
1065
|
-
MANAGERS = "managers",
|
|
1066
|
-
ALL_MEMBERS = "all",
|
|
1067
|
-
GUESTS = "guests"
|
|
1068
|
-
}
|
|
1069
|
-
export declare enum ProjectPermissions {
|
|
1070
|
-
OWN = "own",
|
|
1071
|
-
RESTRICTED = "restricted"
|
|
1072
|
-
}
|
|
1073
|
-
export interface DefaultPermissions {
|
|
1074
|
-
user?: UserPermissions;
|
|
1075
|
-
project?: ProjectPermissions;
|
|
1076
|
-
}
|
|
1077
|
-
type NoticeType = 'info' | 'warning' | 'danger' | 'success' | 'error' | 'dataLostWarning';
|
|
1078
|
-
export interface AWSConfig {
|
|
1079
|
-
/**
|
|
1080
|
-
* AWS bucket name for temporary files
|
|
1081
|
-
*/
|
|
1082
|
-
tmpBucketName?: string;
|
|
1083
|
-
/**
|
|
1084
|
-
* AWS region
|
|
1085
|
-
*/
|
|
1086
|
-
region?: string;
|
|
1087
|
-
}
|
|
1088
|
-
export {};
|