@crowdin/app-project-module 1.2.1 → 1.3.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.
Files changed (214) hide show
  1. package/out/app-test/integration/get-integration-files.js +1 -1
  2. package/out/app-test/integration/index.js +6 -6
  3. package/out/app-test/integration/mocks/crowdin-storage.d.ts +16 -16
  4. package/out/app-test/integration/mocks/mock-crowdin-api-client.js +17 -7
  5. package/out/app-test/integration/update-crowdin.js +1 -1
  6. package/out/app-test/integration/update-integration.js +1 -1
  7. package/out/app-test/util/index.js +1 -2
  8. package/out/index.js +23 -13
  9. package/out/middlewares/api-call.js +1 -1
  10. package/out/middlewares/auto-credentials-masker.js +2 -3
  11. package/out/middlewares/crowdin-client.d.ts +1 -2
  12. package/out/middlewares/crowdin-client.js +5 -6
  13. package/out/middlewares/integration-credentials.d.ts +1 -2
  14. package/out/middlewares/integration-credentials.js +18 -8
  15. package/out/middlewares/json-response.js +1 -1
  16. package/out/middlewares/render-ui-module.d.ts +1 -2
  17. package/out/middlewares/render-ui-module.js +1 -1
  18. package/out/middlewares/ui-module.d.ts +1 -2
  19. package/out/middlewares/ui-module.js +1 -1
  20. package/out/modules/about.js +2 -3
  21. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -2
  22. package/out/modules/ai-prompt-provider/handlers/compile.js +1 -1
  23. package/out/modules/ai-prompt-provider/index.js +1 -2
  24. package/out/modules/ai-prompt-provider/types.js +1 -1
  25. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -2
  26. package/out/modules/ai-provider/handlers/chat-completions.js +2 -2
  27. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -2
  28. package/out/modules/ai-provider/handlers/get-model-list.js +1 -1
  29. package/out/modules/ai-provider/index.js +1 -2
  30. package/out/modules/ai-provider/util/index.js +6 -6
  31. package/out/modules/ai-request-processors/handler.d.ts +1 -2
  32. package/out/modules/ai-request-processors/handler.js +1 -1
  33. package/out/modules/ai-request-processors/index.js +5 -5
  34. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -2
  35. package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
  36. package/out/modules/ai-tools/index.js +2 -3
  37. package/out/modules/ai-tools/util/index.js +4 -5
  38. package/out/modules/api/api.js +4 -5
  39. package/out/modules/api/index.js +1 -2
  40. package/out/modules/api/types.js +1 -1
  41. package/out/modules/auth-guard/handlers/verify.d.ts +1 -2
  42. package/out/modules/auth-guard/handlers/verify.js +1 -1
  43. package/out/modules/auth-guard/index.js +1 -2
  44. package/out/modules/automation-action/handlers/execute.d.ts +1 -2
  45. package/out/modules/automation-action/handlers/execute.js +1 -1
  46. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -2
  47. package/out/modules/automation-action/handlers/input-schema.js +1 -1
  48. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -2
  49. package/out/modules/automation-action/handlers/output-schema.js +1 -1
  50. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -2
  51. package/out/modules/automation-action/handlers/validate-settings.js +1 -1
  52. package/out/modules/automation-action/index.js +1 -2
  53. package/out/modules/automation-action/util/index.js +2 -3
  54. package/out/modules/automation-action/util/validate-input.js +1 -2
  55. package/out/modules/context-menu/index.js +1 -2
  56. package/out/modules/context-menu/types.js +2 -2
  57. package/out/modules/custom-mt/handlers/translate.d.ts +1 -2
  58. package/out/modules/custom-mt/handlers/translate.js +1 -1
  59. package/out/modules/custom-mt/index.js +1 -2
  60. package/out/modules/custom-mt/types.d.ts +0 -2
  61. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -2
  62. package/out/modules/custom-spell-check/handlers/get-languages-list.js +1 -1
  63. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -2
  64. package/out/modules/custom-spell-check/handlers/spell-check.js +1 -1
  65. package/out/modules/custom-spell-check/index.js +1 -2
  66. package/out/modules/editor-right-panel/index.js +1 -2
  67. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -2
  68. package/out/modules/external-qa-check/handlers/validate.js +1 -1
  69. package/out/modules/external-qa-check/index.js +1 -2
  70. package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -2
  71. package/out/modules/file-processing/handlers/custom-file-format.js +9 -9
  72. package/out/modules/file-processing/handlers/file-download.d.ts +1 -2
  73. package/out/modules/file-processing/handlers/file-download.js +1 -1
  74. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -2
  75. package/out/modules/file-processing/handlers/pre-post-process.js +1 -1
  76. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -2
  77. package/out/modules/file-processing/handlers/translations-alignment.js +1 -1
  78. package/out/modules/file-processing/index.js +6 -7
  79. package/out/modules/file-processing/types.d.ts +0 -2
  80. package/out/modules/file-processing/types.js +1 -1
  81. package/out/modules/file-processing/util/defaults.js +18 -9
  82. package/out/modules/file-processing/util/files.d.ts +0 -2
  83. package/out/modules/file-processing/util/files.js +4 -4
  84. package/out/modules/form-data-display.d.ts +1 -2
  85. package/out/modules/form-data-display.js +18 -8
  86. package/out/modules/form-data-save.d.ts +1 -2
  87. package/out/modules/form-data-save.js +18 -8
  88. package/out/modules/install.d.ts +1 -2
  89. package/out/modules/install.js +2 -2
  90. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -2
  91. package/out/modules/integration/handlers/crowdin-file-progress.js +1 -1
  92. package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +1 -2
  93. package/out/modules/integration/handlers/crowdin-files-target-languages.js +1 -1
  94. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -2
  95. package/out/modules/integration/handlers/crowdin-files.js +1 -1
  96. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -2
  97. package/out/modules/integration/handlers/crowdin-project.js +1 -1
  98. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -2
  99. package/out/modules/integration/handlers/crowdin-update.js +1 -1
  100. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -2
  101. package/out/modules/integration/handlers/crowdin-webhook.js +2 -2
  102. package/out/modules/integration/handlers/integration-data.d.ts +1 -2
  103. package/out/modules/integration/handlers/integration-data.js +1 -1
  104. package/out/modules/integration/handlers/integration-login.d.ts +1 -2
  105. package/out/modules/integration/handlers/integration-login.js +1 -1
  106. package/out/modules/integration/handlers/integration-logout.d.ts +1 -2
  107. package/out/modules/integration/handlers/integration-logout.js +18 -8
  108. package/out/modules/integration/handlers/integration-update.d.ts +1 -2
  109. package/out/modules/integration/handlers/integration-update.js +1 -1
  110. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -2
  111. package/out/modules/integration/handlers/integration-webhook.js +1 -1
  112. package/out/modules/integration/handlers/invite-users.d.ts +1 -2
  113. package/out/modules/integration/handlers/invite-users.js +1 -1
  114. package/out/modules/integration/handlers/job-cancel.d.ts +1 -2
  115. package/out/modules/integration/handlers/job-cancel.js +1 -1
  116. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -2
  117. package/out/modules/integration/handlers/job-info-deprecated.js +1 -1
  118. package/out/modules/integration/handlers/job-info.d.ts +1 -2
  119. package/out/modules/integration/handlers/job-info.js +1 -1
  120. package/out/modules/integration/handlers/job-list.d.ts +1 -2
  121. package/out/modules/integration/handlers/job-list.js +1 -1
  122. package/out/modules/integration/handlers/main.d.ts +1 -2
  123. package/out/modules/integration/handlers/main.js +1 -1
  124. package/out/modules/integration/handlers/oauth-login.d.ts +1 -2
  125. package/out/modules/integration/handlers/oauth-login.js +1 -1
  126. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -2
  127. package/out/modules/integration/handlers/oauth-polling.js +1 -1
  128. package/out/modules/integration/handlers/oauth-url.d.ts +1 -2
  129. package/out/modules/integration/handlers/oauth-url.js +1 -1
  130. package/out/modules/integration/handlers/settings-save.d.ts +1 -2
  131. package/out/modules/integration/handlers/settings-save.js +1 -1
  132. package/out/modules/integration/handlers/settings.d.ts +1 -2
  133. package/out/modules/integration/handlers/settings.js +1 -1
  134. package/out/modules/integration/handlers/subscription-info.js +1 -1
  135. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -2
  136. package/out/modules/integration/handlers/sync-settings-save.js +1 -1
  137. package/out/modules/integration/handlers/sync-settings.d.ts +1 -2
  138. package/out/modules/integration/handlers/sync-settings.js +1 -1
  139. package/out/modules/integration/handlers/user-errors.d.ts +1 -2
  140. package/out/modules/integration/handlers/user-errors.js +1 -1
  141. package/out/modules/integration/handlers/users.d.ts +1 -2
  142. package/out/modules/integration/handlers/users.js +4 -5
  143. package/out/modules/integration/index.js +1 -2
  144. package/out/modules/integration/types.js +4 -4
  145. package/out/modules/integration/util/cron.js +46 -37
  146. package/out/modules/integration/util/defaults.js +33 -24
  147. package/out/modules/integration/util/files.js +29 -30
  148. package/out/modules/integration/util/job.js +29 -20
  149. package/out/modules/integration/util/snapshot.js +7 -8
  150. package/out/modules/integration/util/types.js +3 -3
  151. package/out/modules/integration/util/webhooks.js +54 -44
  152. package/out/modules/manifest.js +1 -1
  153. package/out/modules/modal/index.js +1 -2
  154. package/out/modules/organization-menu/index.js +1 -2
  155. package/out/modules/organization-settings-menu/index.js +1 -2
  156. package/out/modules/profile-resources-menu/index.js +1 -2
  157. package/out/modules/profile-settings-menu/index.js +1 -2
  158. package/out/modules/project-menu/index.js +1 -2
  159. package/out/modules/project-menu-crowdsource/index.js +1 -2
  160. package/out/modules/project-reports/index.js +1 -2
  161. package/out/modules/project-tools/index.js +1 -2
  162. package/out/modules/status.d.ts +1 -2
  163. package/out/modules/status.js +1 -1
  164. package/out/modules/subscription-paid.d.ts +1 -2
  165. package/out/modules/subscription-paid.js +1 -1
  166. package/out/modules/uninstall.d.ts +1 -2
  167. package/out/modules/uninstall.js +1 -1
  168. package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -2
  169. package/out/modules/webhooks/handlers/webhook-handler.js +18 -9
  170. package/out/modules/webhooks/index.js +1 -2
  171. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -2
  172. package/out/modules/workflow-step-type/handlers/delete-step.js +18 -8
  173. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -2
  174. package/out/modules/workflow-step-type/handlers/step-settings-save.js +18 -8
  175. package/out/modules/workflow-step-type/index.js +1 -2
  176. package/out/modules/workflow-step-type/types.js +1 -1
  177. package/out/modules/workflow-step-type/util/index.js +2 -3
  178. package/out/static/ui/error.bundle.js +446 -379
  179. package/out/static/ui/error.bundle.js.map +1 -1
  180. package/out/static/ui/form.bundle.js +29793 -29989
  181. package/out/static/ui/form.bundle.js.map +1 -1
  182. package/out/static/ui/install.bundle.js +446 -379
  183. package/out/static/ui/install.bundle.js.map +1 -1
  184. package/out/static/ui/login.bundle.js +448 -379
  185. package/out/static/ui/login.bundle.js.map +1 -1
  186. package/out/static/ui/main.bundle.js +448 -379
  187. package/out/static/ui/main.bundle.js.map +1 -1
  188. package/out/static/ui/oauth.bundle.js +448 -379
  189. package/out/static/ui/oauth.bundle.js.map +1 -1
  190. package/out/storage/d1.d.ts +1 -1
  191. package/out/storage/d1.js +29 -27
  192. package/out/storage/index.d.ts +1 -1
  193. package/out/storage/index.js +25 -11
  194. package/out/storage/mysql.d.ts +1 -1
  195. package/out/storage/mysql.js +35 -33
  196. package/out/storage/postgre.d.ts +1 -1
  197. package/out/storage/postgre.js +46 -44
  198. package/out/storage/sqlite.d.ts +1 -1
  199. package/out/storage/sqlite.js +18 -16
  200. package/out/types.d.ts +0 -2
  201. package/out/types.js +8 -8
  202. package/out/util/connection.js +34 -25
  203. package/out/util/credentials-masker.d.ts +1 -2
  204. package/out/util/credentials-masker.js +3 -4
  205. package/out/util/cron.js +20 -10
  206. package/out/util/form-schema.js +2 -3
  207. package/out/util/index.js +38 -28
  208. package/out/util/jsx-renderer.js +2 -3
  209. package/out/util/logger.js +41 -31
  210. package/out/util/static-files.d.ts +0 -1
  211. package/out/util/static-files.js +2 -3
  212. package/out/util/subscription.js +11 -12
  213. package/out/views/FormPage.js +3 -3
  214. package/package.json +28 -33
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,7 +42,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
42
  });
33
43
  };
34
44
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.temporaryErrorDebug = exports.handleUserError = exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = exports.getErrorMessage = exports.isInternalErrorMessage = exports.isAxiosError = exports.logError = exports.log = exports.withContextError = exports.withContext = exports.prepareContext = exports.initialize = void 0;
45
+ exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = void 0;
46
+ exports.initialize = initialize;
47
+ exports.prepareContext = prepareContext;
48
+ exports.withContext = withContext;
49
+ exports.withContextError = withContextError;
50
+ exports.log = log;
51
+ exports.logError = logError;
52
+ exports.isAxiosError = isAxiosError;
53
+ exports.isInternalErrorMessage = isInternalErrorMessage;
54
+ exports.getErrorMessage = getErrorMessage;
55
+ exports.handleUserError = handleUserError;
56
+ exports.temporaryErrorDebug = temporaryErrorDebug;
36
57
  const logsFormatter = __importStar(require("@crowdin/logs-formatter"));
37
58
  const storage_1 = require("../storage");
38
59
  let logConfig;
@@ -41,7 +62,6 @@ function initialize(config) {
41
62
  logConfig = config.logger;
42
63
  onError = config.onError;
43
64
  }
44
- exports.initialize = initialize;
45
65
  function prepareContext(context) {
46
66
  return {
47
67
  orgId: context.crowdinId,
@@ -49,15 +69,12 @@ function prepareContext(context) {
49
69
  projectId: context.jwtPayload.context.project_id,
50
70
  };
51
71
  }
52
- exports.prepareContext = prepareContext;
53
72
  function withContext(context) {
54
73
  return (message) => log(message, context);
55
74
  }
56
- exports.withContext = withContext;
57
75
  function withContextError(context) {
58
76
  return (e) => logError(e, context);
59
77
  }
60
- exports.withContextError = withContextError;
61
78
  function log(message, context) {
62
79
  var _a, _b, _c;
63
80
  if (logConfig === null || logConfig === void 0 ? void 0 : logConfig.enabled) {
@@ -92,7 +109,6 @@ function log(message, context) {
92
109
  }
93
110
  }
94
111
  }
95
- exports.log = log;
96
112
  function logError(e, context) {
97
113
  var _a, _b, _c;
98
114
  if (onError) {
@@ -131,7 +147,6 @@ function logError(e, context) {
131
147
  }
132
148
  }
133
149
  }
134
- exports.logError = logError;
135
150
  function errorOutputByType(error) {
136
151
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
137
152
  if (error instanceof AppUserModuleError) {
@@ -161,7 +176,6 @@ function errorOutputByType(error) {
161
176
  function isAxiosError(e) {
162
177
  return !!e.isAxiosError;
163
178
  }
164
- exports.isAxiosError = isAxiosError;
165
179
  function isInternalErrorMessage(message) {
166
180
  const internalErrorMessagePrefixes = ['SQL'];
167
181
  for (const prefix of internalErrorMessagePrefixes) {
@@ -171,7 +185,6 @@ function isInternalErrorMessage(message) {
171
185
  }
172
186
  return false;
173
187
  }
174
- exports.isInternalErrorMessage = isInternalErrorMessage;
175
188
  function getErrorMessage(err) {
176
189
  let message = 'Internal Server Error';
177
190
  if (typeof err === 'string') {
@@ -182,7 +195,6 @@ function getErrorMessage(err) {
182
195
  }
183
196
  return isInternalErrorMessage(message) ? 'Internal Server Error' : message;
184
197
  }
185
- exports.getErrorMessage = getErrorMessage;
186
198
  class AppModuleError extends Error {
187
199
  constructor(error, data) {
188
200
  super(typeof error === 'string' ? error : error.message);
@@ -216,21 +228,21 @@ class AppModuleAggregateError extends Error {
216
228
  }
217
229
  }
218
230
  exports.AppModuleAggregateError = AppModuleAggregateError;
219
- function storeUserError({ action, error, crowdinId, clientId, }) {
220
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
221
- return __awaiter(this, void 0, void 0, function* () {
231
+ function storeUserError(_a) {
232
+ return __awaiter(this, arguments, void 0, function* ({ action, error, crowdinId, clientId, }) {
233
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
222
234
  const data = {};
223
235
  if (isAxiosError(error)) {
224
236
  data.requestParams = {
225
- method: ((_a = error === null || error === void 0 ? void 0 : error.request) === null || _a === void 0 ? void 0 : _a.method) || ((_c = (_b = error === null || error === void 0 ? void 0 : error.data) === null || _b === void 0 ? void 0 : _b.request) === null || _c === void 0 ? void 0 : _c.method),
226
- protocol: ((_d = error === null || error === void 0 ? void 0 : error.request) === null || _d === void 0 ? void 0 : _d.protocol) || ((_f = (_e = error === null || error === void 0 ? void 0 : error.data) === null || _e === void 0 ? void 0 : _e.request) === null || _f === void 0 ? void 0 : _f.protocol),
227
- host: ((_g = error === null || error === void 0 ? void 0 : error.request) === null || _g === void 0 ? void 0 : _g.host) || ((_j = (_h = error === null || error === void 0 ? void 0 : error.data) === null || _h === void 0 ? void 0 : _h.request) === null || _j === void 0 ? void 0 : _j.host),
228
- path: ((_k = error === null || error === void 0 ? void 0 : error.request) === null || _k === void 0 ? void 0 : _k.path) || ((_m = (_l = error === null || error === void 0 ? void 0 : error.data) === null || _l === void 0 ? void 0 : _l.request) === null || _m === void 0 ? void 0 : _m.path),
237
+ method: ((_b = error === null || error === void 0 ? void 0 : error.request) === null || _b === void 0 ? void 0 : _b.method) || ((_d = (_c = error === null || error === void 0 ? void 0 : error.data) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.method),
238
+ protocol: ((_e = error === null || error === void 0 ? void 0 : error.request) === null || _e === void 0 ? void 0 : _e.protocol) || ((_g = (_f = error === null || error === void 0 ? void 0 : error.data) === null || _f === void 0 ? void 0 : _f.request) === null || _g === void 0 ? void 0 : _g.protocol),
239
+ host: ((_h = error === null || error === void 0 ? void 0 : error.request) === null || _h === void 0 ? void 0 : _h.host) || ((_k = (_j = error === null || error === void 0 ? void 0 : error.data) === null || _j === void 0 ? void 0 : _j.request) === null || _k === void 0 ? void 0 : _k.host),
240
+ path: ((_l = error === null || error === void 0 ? void 0 : error.request) === null || _l === void 0 ? void 0 : _l.path) || ((_o = (_m = error === null || error === void 0 ? void 0 : error.data) === null || _m === void 0 ? void 0 : _m.request) === null || _o === void 0 ? void 0 : _o.path),
229
241
  };
230
242
  data.responseData = {
231
- data: ((_o = error === null || error === void 0 ? void 0 : error.response) === null || _o === void 0 ? void 0 : _o.data) || ((_q = (_p = error === null || error === void 0 ? void 0 : error.data) === null || _p === void 0 ? void 0 : _p.response) === null || _q === void 0 ? void 0 : _q.data),
232
- status: ((_r = error === null || error === void 0 ? void 0 : error.response) === null || _r === void 0 ? void 0 : _r.status) || ((_t = (_s = error === null || error === void 0 ? void 0 : error.data) === null || _s === void 0 ? void 0 : _s.response) === null || _t === void 0 ? void 0 : _t.status),
233
- statusText: ((_u = error === null || error === void 0 ? void 0 : error.response) === null || _u === void 0 ? void 0 : _u.statusText) || ((_w = (_v = error === null || error === void 0 ? void 0 : error.data) === null || _v === void 0 ? void 0 : _v.response) === null || _w === void 0 ? void 0 : _w.statusText),
243
+ data: ((_p = error === null || error === void 0 ? void 0 : error.response) === null || _p === void 0 ? void 0 : _p.data) || ((_r = (_q = error === null || error === void 0 ? void 0 : error.data) === null || _q === void 0 ? void 0 : _q.response) === null || _r === void 0 ? void 0 : _r.data),
244
+ status: ((_s = error === null || error === void 0 ? void 0 : error.response) === null || _s === void 0 ? void 0 : _s.status) || ((_u = (_t = error === null || error === void 0 ? void 0 : error.data) === null || _t === void 0 ? void 0 : _t.response) === null || _u === void 0 ? void 0 : _u.status),
245
+ statusText: ((_v = error === null || error === void 0 ? void 0 : error.response) === null || _v === void 0 ? void 0 : _v.statusText) || ((_x = (_w = error === null || error === void 0 ? void 0 : error.data) === null || _w === void 0 ? void 0 : _w.response) === null || _x === void 0 ? void 0 : _x.statusText),
234
246
  };
235
247
  }
236
248
  if ((error instanceof AppModuleError || error instanceof AppUserModuleError) && error.appData) {
@@ -272,8 +284,8 @@ function mergeAppModuleAggregateErrors(errors) {
272
284
  }
273
285
  return result;
274
286
  }
275
- function handleUserError({ action, error, crowdinId, clientId, }) {
276
- return __awaiter(this, void 0, void 0, function* () {
287
+ function handleUserError(_a) {
288
+ return __awaiter(this, arguments, void 0, function* ({ action, error, crowdinId, clientId, }) {
277
289
  if (typeof error === 'string') {
278
290
  return;
279
291
  }
@@ -288,9 +300,7 @@ function handleUserError({ action, error, crowdinId, clientId, }) {
288
300
  }
289
301
  });
290
302
  }
291
- exports.handleUserError = handleUserError;
292
303
  function temporaryErrorDebug(msg, req) {
293
304
  // eslint-disable-next-line no-console
294
305
  console.log(msg, req.headers, Object.assign({ originalUrl: req.originalUrl }, req.query));
295
306
  }
296
- exports.temporaryErrorDebug = temporaryErrorDebug;
@@ -2,7 +2,6 @@
2
2
  * Static Files Abstraction Layer
3
3
  * Dual compatibility: Node.js (Express) + Cloudflare Workers (Assets Fetcher)
4
4
  */
5
- /// <reference types="serve-static" />
6
5
  import express, { Request, Response } from 'express';
7
6
  import { Config, UnauthorizedConfig } from '../types';
8
7
  /**
@@ -16,7 +16,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.serveFile = exports.serveStatic = void 0;
19
+ exports.serveStatic = serveStatic;
20
+ exports.serveFile = serveFile;
20
21
  const express_1 = __importDefault(require("express"));
21
22
  const path_1 = __importDefault(require("path"));
22
23
  /**
@@ -63,7 +64,6 @@ function serveStatic(config, staticPath) {
63
64
  const absolutePath = path_1.default.isAbsolute(staticPath) ? staticPath : path_1.default.join(rootDir, staticPath);
64
65
  return express_1.default.static(absolutePath);
65
66
  }
66
- exports.serveStatic = serveStatic;
67
67
  /**
68
68
  * Serve single file (e.g., logo.png, icons/star.svg) with dual compatibility
69
69
  * @param config - App configuration
@@ -84,4 +84,3 @@ function serveFile(config, filePath) {
84
84
  }
85
85
  });
86
86
  }
87
- exports.serveFile = serveFile;
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.clearCache = exports.checkSubscription = exports.isAppFree = void 0;
12
+ exports.isAppFree = isAppFree;
13
+ exports.checkSubscription = checkSubscription;
14
+ exports.clearCache = clearCache;
13
15
  const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
14
16
  const types_1 = require("../types");
15
17
  const logger_1 = require("./logger");
@@ -17,10 +19,9 @@ const subscriptionCache = {};
17
19
  function isAppFree(config) {
18
20
  return !config.pricing || config.pricing.planType === 'free';
19
21
  }
20
- exports.isAppFree = isAppFree;
21
- function checkSubscription({ config, token, organization, accountType, }) {
22
- var _a, _b, _c, _d, _e, _f, _g;
23
- return __awaiter(this, void 0, void 0, function* () {
22
+ function checkSubscription(_a) {
23
+ return __awaiter(this, arguments, void 0, function* ({ config, token, organization, accountType, }) {
24
+ var _b, _c, _d, _e, _f, _g, _h;
24
25
  if (isAppFree(config)) {
25
26
  return { expired: false };
26
27
  }
@@ -41,12 +42,12 @@ function checkSubscription({ config, token, organization, accountType, }) {
41
42
  appIdentifier,
42
43
  organization: accountType === types_1.AccountType.ENTERPRISE ? organization : undefined,
43
44
  token,
44
- baseUrl: (_a = config.crowdinUrls) === null || _a === void 0 ? void 0 : _a.subscriptionUrl,
45
+ baseUrl: (_b = config.crowdinUrls) === null || _b === void 0 ? void 0 : _b.subscriptionUrl,
45
46
  });
46
47
  (0, logger_1.log)(`Recieved subscription info. ${JSON.stringify(subscription)}`);
47
48
  const { expired, daysLeft } = validateSubscription(new Date(subscription.expires));
48
49
  (0, logger_1.log)(`expired ${expired}`);
49
- addToCache(organization, appIdentifier, new Date(subscription.expires), types_1.SubscriptionInfoType.SUBSCRIPTION, (_b = config.pricing) === null || _b === void 0 ? void 0 : _b.cachingSeconds);
50
+ addToCache(organization, appIdentifier, new Date(subscription.expires), types_1.SubscriptionInfoType.SUBSCRIPTION, (_c = config.pricing) === null || _c === void 0 ? void 0 : _c.cachingSeconds);
50
51
  return { expired, daysLeft, type: types_1.SubscriptionInfoType.SUBSCRIPTION };
51
52
  }
52
53
  catch (e) {
@@ -57,17 +58,17 @@ function checkSubscription({ config, token, organization, accountType, }) {
57
58
  const defaultSubscriptionPlan = 14;
58
59
  let days;
59
60
  if (accountType === types_1.AccountType.ENTERPRISE) {
60
- days = ((_c = config.pricing) === null || _c === void 0 ? void 0 : _c.trialEnterprise) || ((_d = config.pricing) === null || _d === void 0 ? void 0 : _d.trial) || defaultSubscriptionPlan;
61
+ days = ((_d = config.pricing) === null || _d === void 0 ? void 0 : _d.trialEnterprise) || ((_e = config.pricing) === null || _e === void 0 ? void 0 : _e.trial) || defaultSubscriptionPlan;
61
62
  }
62
63
  else {
63
- days = ((_e = config.pricing) === null || _e === void 0 ? void 0 : _e.trialCrowdin) || ((_f = config.pricing) === null || _f === void 0 ? void 0 : _f.trial) || defaultSubscriptionPlan;
64
+ days = ((_f = config.pricing) === null || _f === void 0 ? void 0 : _f.trialCrowdin) || ((_g = config.pricing) === null || _g === void 0 ? void 0 : _g.trial) || defaultSubscriptionPlan;
64
65
  }
65
66
  (0, logger_1.log)(`Subscriptino trial plan ${days} days`);
66
67
  const date = new Date(initializedAt);
67
68
  date.setDate(date.getDate() + days);
68
69
  const { expired, daysLeft } = validateSubscription(date);
69
70
  (0, logger_1.log)(`expired ${expired}`);
70
- addToCache(organization, appIdentifier, new Date(date), types_1.SubscriptionInfoType.TRIAL, (_g = config.pricing) === null || _g === void 0 ? void 0 : _g.cachingSeconds, subscribeLink);
71
+ addToCache(organization, appIdentifier, new Date(date), types_1.SubscriptionInfoType.TRIAL, (_h = config.pricing) === null || _h === void 0 ? void 0 : _h.cachingSeconds, subscribeLink);
71
72
  return { expired, subscribeLink, daysLeft, type: types_1.SubscriptionInfoType.TRIAL };
72
73
  }
73
74
  if (config.onError) {
@@ -81,11 +82,9 @@ function checkSubscription({ config, token, organization, accountType, }) {
81
82
  }
82
83
  });
83
84
  }
84
- exports.checkSubscription = checkSubscription;
85
85
  function clearCache(organization) {
86
86
  delete subscriptionCache[organization];
87
87
  }
88
- exports.clearCache = clearCache;
89
88
  function addToCache(organization, appIdentifier, validUntil, type, cachingSeconds, subscribeLink) {
90
89
  if (!cachingSeconds) {
91
90
  return;
@@ -17,9 +17,9 @@ const FormPage = ({ formGetDataUrl, formPostDataUrl, formPatchDataUrl, formSchem
17
17
  react_1.default.createElement("crowdin-toasts", null),
18
18
  react_1.default.createElement("script", { dangerouslySetInnerHTML: {
19
19
  __html: `
20
- var formGetDataUrl = '${formGetDataUrl}';
21
- var formPostDataUrl = '${formPostDataUrl}';
22
- var formPatchDataUrl = '${formPatchDataUrl}';
20
+ var formGetDataUrl = ${formGetDataUrl ? `'${formGetDataUrl}'` : 'undefined'};
21
+ var formPostDataUrl = ${formPostDataUrl ? `'${formPostDataUrl}'` : 'undefined'};
22
+ var formPatchDataUrl = ${formPatchDataUrl ? `'${formPatchDataUrl}'` : 'undefined'};
23
23
  var formSchema = ${formSchema};
24
24
  var formUiSchema = ${formUiSchema};
25
25
  `,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
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",
@@ -37,8 +37,8 @@
37
37
  "swagger-jsdoc": "^6.2.8"
38
38
  },
39
39
  "peerDependencies": {
40
- "@aws-sdk/client-s3": "^3.980.0",
41
- "@aws-sdk/s3-request-presigner": "^3.980.0"
40
+ "@aws-sdk/client-s3": "^3.995.0",
41
+ "@aws-sdk/s3-request-presigner": "^3.995.0"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@aws-sdk/client-s3": {
@@ -49,26 +49,33 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
- "@aws-sdk/client-s3": "^3.980.0",
53
- "@aws-sdk/s3-request-presigner": "^3.980.0",
54
- "@babel/preset-react": "^7.26.3",
55
- "@cloudflare/workers-types": "^4.20251117.0",
56
- "@emotion/react": "^11.14.0",
57
- "@emotion/styled": "^11.14.0",
58
- "@eslint/eslintrc": "^3.3.3",
59
- "@eslint/js": "^9.39.2",
52
+ "typescript": "^5.9.3",
53
+ "auto-changelog": "^2.5.0",
54
+ "@aws-sdk/client-s3": "^3.995.0",
55
+ "@aws-sdk/s3-request-presigner": "^3.995.0",
56
+ "@mui/material": "^7.3.8",
57
+ "@rjsf/core": "^6.3.1",
58
+ "@rjsf/mui": "^6.3.1",
59
+ "@rjsf/validator-ajv8": "^6.3.1",
60
60
  "@monaco-editor/react": "^4.7.0",
61
- "@mui/icons-material": "^5.16.14",
62
- "@mui/material": "^5.16.14",
63
- "@rjsf/core": "^5.24.3",
64
- "@rjsf/mui": "^5.24.3",
65
- "@rjsf/utils": "^5.24.3",
66
- "@rjsf/validator-ajv8": "^5.24.3",
67
- "@rollup/plugin-commonjs": "^24.1.0",
61
+ "rollup": "^4.59.0",
62
+ "@rollup/plugin-commonjs": "^29.0.0",
68
63
  "@rollup/plugin-json": "^6.1.0",
69
- "@rollup/plugin-node-resolve": "^15.3.1",
70
- "@rollup/plugin-replace": "^5.0.7",
64
+ "@rollup/plugin-node-resolve": "^16.0.3",
65
+ "@rollup/plugin-replace": "^6.0.3",
71
66
  "@rollup/plugin-typescript": "12.3.0",
67
+ "eslint": "^10.0.1",
68
+ "prettier": "^3.8.1",
69
+ "eslint-config-prettier": "^10.1.8",
70
+ "eslint-plugin-prettier": "^5.5.5",
71
+ "@eslint/eslintrc": "^3.3.3",
72
+ "@eslint/js": "^10.0.1",
73
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
74
+ "@typescript-eslint/parser": "^8.56.0",
75
+ "jest": "^30.2.0",
76
+ "jest-junit": "^16.0.0",
77
+ "ts-jest": "^29.4.6",
78
+ "@cloudflare/workers-types": "^4.20260228.0",
72
79
  "@types/amqplib": "^0.10.7",
73
80
  "@types/better-sqlite3": "^7.6.13",
74
81
  "@types/cors": "^2.8.19",
@@ -79,19 +86,7 @@
79
86
  "@types/pg": "^8.16.0",
80
87
  "@types/react": "^18.3.18",
81
88
  "@types/react-dom": "^18.3.5",
82
- "@types/swagger-jsdoc": "^6.0.4",
83
- "@typescript-eslint/eslint-plugin": "^8.49.0",
84
- "@typescript-eslint/parser": "^8.49.0",
85
- "auto-changelog": "^2.5.0",
86
- "eslint": "^9.39.2",
87
- "eslint-config-prettier": "^10.1.8",
88
- "eslint-plugin-prettier": "^5.5.4",
89
- "jest": "^29.7.0",
90
- "jest-junit": "^15.0.0",
91
- "prettier": "^3.7.4",
92
- "rollup": "^3.29.4",
93
- "ts-jest": "^29.2.5",
94
- "typescript": "^4.9.5"
89
+ "@types/swagger-jsdoc": "^6.0.4"
95
90
  },
96
91
  "repository": {
97
92
  "type": "git",