@crowdin/app-project-module 0.29.0 → 0.29.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/out/index.js
CHANGED
|
@@ -260,7 +260,16 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
260
260
|
return JSON.parse(integrationCredentials.config);
|
|
261
261
|
}
|
|
262
262
|
}),
|
|
263
|
-
establishCrowdinConnection: (
|
|
263
|
+
establishCrowdinConnection: (authRequest) => {
|
|
264
|
+
let jwtToken = '';
|
|
265
|
+
if (typeof authRequest === 'string') {
|
|
266
|
+
jwtToken = authRequest;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
jwtToken = (0, crowdin_client_1.getToken)(authRequest);
|
|
270
|
+
}
|
|
271
|
+
return (0, crowdin_client_1.prepareCrowdinRequest)(jwtToken, config);
|
|
272
|
+
},
|
|
264
273
|
encryptCrowdinConnection: (data) => (0, util_1.encryptData)(config, JSON.stringify(data)),
|
|
265
274
|
dencryptCrowdinConnection: (hash) => __awaiter(this, void 0, void 0, function* () {
|
|
266
275
|
const { crowdinId, extra } = JSON.parse((0, util_1.decryptData)(config, hash));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import Crowdin from '@crowdin/crowdin-api-client';
|
|
3
3
|
import { Response } from 'express';
|
|
4
|
-
import { Config, CrowdinContextInfo, SubscriptionInfo } from '../models';
|
|
4
|
+
import { Config, CrowdinClientRequest, CrowdinContextInfo, SubscriptionInfo } from '../models';
|
|
5
5
|
export declare function prepareCrowdinRequest(jwtToken: string, config: Config, optional?: boolean, checkSubscriptionExpiration?: boolean): Promise<{
|
|
6
6
|
context: CrowdinContextInfo;
|
|
7
7
|
client?: Crowdin;
|
|
8
8
|
subscriptionInfo?: SubscriptionInfo;
|
|
9
9
|
}>;
|
|
10
10
|
export default function handle(config: Config, optional?: boolean, checkSubscriptionExpiration?: boolean): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
11
|
+
export declare function getToken(req: CrowdinClientRequest): string | undefined;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.prepareCrowdinRequest = void 0;
|
|
12
|
+
exports.getToken = exports.prepareCrowdinRequest = void 0;
|
|
13
13
|
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
14
14
|
const storage_1 = require("../storage");
|
|
15
15
|
const util_1 = require("../util");
|
|
@@ -91,3 +91,4 @@ function getToken(req) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
exports.getToken = getToken;
|
package/out/models/index.d.ts
CHANGED
|
@@ -752,7 +752,7 @@ export interface CrowdinAppUtilities {
|
|
|
752
752
|
* Settings that users manage in the integration module
|
|
753
753
|
*/
|
|
754
754
|
getUserSettings: (clientId: string) => Promise<any | undefined>;
|
|
755
|
-
establishCrowdinConnection: (
|
|
755
|
+
establishCrowdinConnection: (authRequest: string | CrowdinClientRequest) => Promise<{
|
|
756
756
|
context: CrowdinContextInfo;
|
|
757
757
|
client?: Crowdin;
|
|
758
758
|
}>;
|
package/out/util/api/api.js
CHANGED
|
@@ -45,91 +45,83 @@ function getUsersApiManifest(endpoints) {
|
|
|
45
45
|
return apiModuleManifest;
|
|
46
46
|
}
|
|
47
47
|
function getDefaultApiEndpointsManifest(config) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
48
|
+
const apiModuleManifest = [];
|
|
49
|
+
if (config.projectIntegration) {
|
|
50
|
+
apiModuleManifest.push({
|
|
51
51
|
key: 'crowdin-files-api',
|
|
52
52
|
name: 'Get Crowdin Files',
|
|
53
53
|
url: '/crowdin-files',
|
|
54
54
|
method: models_1.RequestMethods.GET,
|
|
55
55
|
description: 'Get a list of synced files',
|
|
56
56
|
documentationUrl: '/api-docs#tag/Files/operation/crowdin.files',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
57
|
+
}, {
|
|
59
58
|
key: 'crowdin-files-api',
|
|
60
59
|
name: 'File Translation Progress',
|
|
61
60
|
url: '/file-progress',
|
|
62
61
|
method: models_1.RequestMethods.GET,
|
|
63
62
|
description: 'Get file translation progress',
|
|
64
63
|
documentationUrl: '/api-docs#tag/Files/operation/file.progress',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
64
|
+
}, {
|
|
67
65
|
key: 'integration-files-api',
|
|
68
66
|
name: 'Get Integration Files',
|
|
69
67
|
url: '/integration-files',
|
|
70
68
|
method: models_1.RequestMethods.GET,
|
|
71
69
|
description: 'Get integration data',
|
|
72
70
|
documentationUrl: '/api-docs#tag/Files/operation/integration.files',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
71
|
+
}, {
|
|
75
72
|
key: 'crowdin-update-api',
|
|
76
73
|
name: 'Update Crowdin',
|
|
77
74
|
url: '/crowdin-update',
|
|
78
75
|
method: models_1.RequestMethods.POST,
|
|
79
76
|
description: 'Update crowdin data',
|
|
80
77
|
documentationUrl: '/api-docs#tag/Files/operation/crowdin.update',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
78
|
+
}, {
|
|
83
79
|
key: 'integration-update-api',
|
|
84
80
|
name: 'Update Integration',
|
|
85
81
|
url: '/integration-update',
|
|
86
82
|
method: models_1.RequestMethods.POST,
|
|
87
83
|
description: 'Update integration data',
|
|
88
84
|
documentationUrl: '/api-docs#tag/Files/operation/integration.update',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
85
|
+
}, {
|
|
91
86
|
key: 'settings-api',
|
|
92
87
|
name: 'Get App Settings',
|
|
93
88
|
url: '/settings',
|
|
94
89
|
method: models_1.RequestMethods.GET,
|
|
95
90
|
documentationUrl: '/api-docs#tag/Settings/operation/settings.get',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
91
|
+
}, {
|
|
98
92
|
key: 'settings-update-api',
|
|
99
93
|
name: 'Update App Settings',
|
|
100
94
|
url: '/settings',
|
|
101
95
|
method: models_1.RequestMethods.POST,
|
|
102
96
|
documentationUrl: '/api-docs#tag/Settings/operation/settings.update',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
97
|
+
}, {
|
|
105
98
|
key: 'sync-settings-api',
|
|
106
99
|
name: 'Get Sync Settings',
|
|
107
100
|
url: '/sync-settings',
|
|
108
101
|
method: models_1.RequestMethods.GET,
|
|
109
102
|
documentationUrl: '/api-docs#tag/Settings/operation/sync.settings.get',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
103
|
+
}, {
|
|
112
104
|
key: 'sync-settings-update-api',
|
|
113
105
|
name: 'Update Sync Settings',
|
|
114
106
|
url: '/sync-settings',
|
|
115
107
|
method: models_1.RequestMethods.POST,
|
|
116
108
|
documentationUrl: '/api-docs#tag/Settings/operation/sync.settings.update',
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
if ((_a = config.projectIntegration) === null || _a === void 0 ? void 0 : _a.loginForm) {
|
|
120
|
-
apiModuleManifest.push({
|
|
121
|
-
key: 'login-data',
|
|
122
|
-
name: 'Get Login Fields',
|
|
123
|
-
url: '/login-fields',
|
|
124
|
-
method: models_1.RequestMethods.GET,
|
|
125
|
-
documentationUrl: '/api-docs#tag/Login/operation/integration.fields',
|
|
126
|
-
}, {
|
|
127
|
-
key: 'login',
|
|
128
|
-
name: 'Login',
|
|
129
|
-
url: '/login',
|
|
130
|
-
method: models_1.RequestMethods.POST,
|
|
131
|
-
documentationUrl: '/api-docs#tag/Login/operation/integration.login',
|
|
132
109
|
});
|
|
110
|
+
if (config.projectIntegration.loginForm) {
|
|
111
|
+
apiModuleManifest.push({
|
|
112
|
+
key: 'login-data',
|
|
113
|
+
name: 'Get Login Fields',
|
|
114
|
+
url: '/login-fields',
|
|
115
|
+
method: models_1.RequestMethods.GET,
|
|
116
|
+
documentationUrl: '/api-docs#tag/Login/operation/integration.fields',
|
|
117
|
+
}, {
|
|
118
|
+
key: 'login',
|
|
119
|
+
name: 'Login',
|
|
120
|
+
url: '/login',
|
|
121
|
+
method: models_1.RequestMethods.POST,
|
|
122
|
+
documentationUrl: '/api-docs#tag/Login/operation/integration.login',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
133
125
|
}
|
|
134
126
|
return apiModuleManifest;
|
|
135
127
|
}
|
package/package.json
CHANGED