@crowdin/app-project-module 0.28.10 → 0.28.11

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
@@ -254,6 +254,16 @@ function addCrowdinEndpoints(app, clientConfig) {
254
254
  }
255
255
  }),
256
256
  establishCrowdinConnection: (jwtToken) => (0, crowdin_client_1.prepareCrowdinRequest)(jwtToken, config),
257
+ encryptCrowdinConnection: (data) => (0, util_1.encryptData)(config, JSON.stringify(data)),
258
+ dencryptCrowdinConnection: (hash) => __awaiter(this, void 0, void 0, function* () {
259
+ const { crowdinId, extra } = JSON.parse((0, util_1.decryptData)(config, hash));
260
+ const creds = yield storage.getStorage().getCrowdinCredentials(crowdinId);
261
+ if (!creds) {
262
+ throw new Error('Failed to find Crowdin credentials');
263
+ }
264
+ const { client } = yield (0, connection_1.prepareCrowdinClient)(config, creds);
265
+ return { client, extra };
266
+ }),
257
267
  };
258
268
  }
259
269
  exports.addCrowdinEndpoints = addCrowdinEndpoints;
@@ -745,6 +745,14 @@ export interface CrowdinAppUtilities {
745
745
  context: CrowdinContextInfo;
746
746
  client?: Crowdin;
747
747
  }>;
748
+ encryptCrowdinConnection: (data: {
749
+ crowdinId: string;
750
+ extra: Record<string, any>;
751
+ }) => string;
752
+ dencryptCrowdinConnection: (hash: string) => Promise<{
753
+ client: Crowdin;
754
+ extra: Record<string, any>;
755
+ }>;
748
756
  }
749
757
  export interface IntegrationSyncSettings {
750
758
  id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.28.10",
3
+ "version": "0.28.11",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",