@crowdin/app-project-module 1.16.0 → 2.1.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.
Files changed (112) hide show
  1. package/out/index.js +8 -15
  2. package/out/middlewares/auto-credentials-masker.js +5 -2
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/crowdin-client.js +1 -1
  5. package/out/middlewares/export.d.ts +2 -2
  6. package/out/middlewares/export.js +4 -35
  7. package/out/middlewares/json-response.d.ts +1 -1
  8. package/out/middlewares/json-response.js +1 -1
  9. package/out/modules/ai-prompt-provider/index.js +6 -6
  10. package/out/modules/ai-provider/index.js +7 -7
  11. package/out/modules/ai-provider/types.d.ts +10 -0
  12. package/out/modules/ai-provider/types.js +12 -0
  13. package/out/modules/ai-provider/util/index.d.ts +0 -10
  14. package/out/modules/ai-provider/util/index.js +2 -13
  15. package/out/modules/ai-request-processors/index.js +4 -4
  16. package/out/modules/api/api.js +18 -18
  17. package/out/modules/auth-guard/index.js +4 -5
  18. package/out/modules/automation-action/index.js +4 -6
  19. package/out/modules/context-menu/index.js +4 -13
  20. package/out/modules/custom-mt/index.js +4 -4
  21. package/out/modules/custom-spell-check/index.js +11 -11
  22. package/out/modules/editor-right-panel/index.js +1 -1
  23. package/out/modules/external-qa-check/index.js +7 -7
  24. package/out/modules/file-processing/index.js +14 -14
  25. package/out/modules/integration/index.js +26 -26
  26. package/out/modules/integration/types.d.ts +4 -4
  27. package/out/modules/integration/util/files.js +1 -1
  28. package/out/modules/integration/util/types.d.ts +1 -1
  29. package/out/modules/integration/util/webhooks.js +69 -54
  30. package/out/modules/manifest.js +70 -281
  31. package/out/modules/modal/index.js +4 -13
  32. package/out/modules/organization-menu/index.js +1 -1
  33. package/out/modules/organization-settings-menu/index.js +1 -1
  34. package/out/modules/profile-resources-menu/index.js +1 -1
  35. package/out/modules/profile-settings-menu/index.js +1 -1
  36. package/out/modules/project-menu/index.js +1 -1
  37. package/out/modules/project-menu-crowdsource/index.js +1 -1
  38. package/out/modules/project-reports/index.js +1 -1
  39. package/out/modules/project-tools/index.js +1 -1
  40. package/out/modules/webhooks/index.js +3 -6
  41. package/out/modules/workflow-step-type/index.js +6 -6
  42. package/out/static/ui/error.bundle.js +9 -9
  43. package/out/static/ui/error.bundle.js.map +1 -1
  44. package/out/static/ui/form.bundle.js +125 -125
  45. package/out/static/ui/form.bundle.js.map +1 -1
  46. package/out/static/ui/install.bundle.js +9 -9
  47. package/out/static/ui/install.bundle.js.map +1 -1
  48. package/out/static/ui/login.bundle.js +9 -9
  49. package/out/static/ui/login.bundle.js.map +1 -1
  50. package/out/static/ui/main.bundle.js +9 -9
  51. package/out/static/ui/main.bundle.js.map +1 -1
  52. package/out/static/ui/oauth.bundle.js +9 -9
  53. package/out/static/ui/oauth.bundle.js.map +1 -1
  54. package/out/storage/drizzle/d1/index.d.ts +7 -0
  55. package/out/storage/drizzle/d1/index.js +48 -0
  56. package/out/storage/drizzle/d1/migrations/init.d.ts +2 -0
  57. package/out/storage/drizzle/d1/migrations/init.js +122 -0
  58. package/out/storage/drizzle/d1/types.d.ts +13 -0
  59. package/out/storage/drizzle/d1/types.js +38 -0
  60. package/out/storage/{sqlite.d.ts → drizzle/index.d.ts} +37 -58
  61. package/out/storage/drizzle/index.js +939 -0
  62. package/out/storage/drizzle/postgresql/config.d.ts +5 -0
  63. package/out/storage/drizzle/postgresql/config.js +11 -0
  64. package/out/storage/drizzle/postgresql/index.d.ts +14 -0
  65. package/out/storage/drizzle/postgresql/index.js +144 -0
  66. package/out/storage/drizzle/postgresql/migrations/0000_init.sql +113 -0
  67. package/out/storage/drizzle/postgresql/migrations/0001_init_indexes.sql +28 -0
  68. package/out/storage/drizzle/postgresql/migrations/meta/0000_snapshot.json +646 -0
  69. package/out/storage/drizzle/postgresql/migrations/meta/0001_snapshot.json +646 -0
  70. package/out/storage/drizzle/postgresql/migrations/meta/_journal.json +20 -0
  71. package/out/storage/drizzle/postgresql/schema.d.ts +1410 -0
  72. package/out/storage/drizzle/postgresql/schema.js +106 -0
  73. package/out/storage/drizzle/sqlite/config.d.ts +5 -0
  74. package/out/storage/drizzle/sqlite/config.js +11 -0
  75. package/out/storage/drizzle/sqlite/index.d.ts +8 -0
  76. package/out/storage/drizzle/sqlite/index.js +63 -0
  77. package/out/storage/drizzle/sqlite/migrations/0000_init.sql +113 -0
  78. package/out/storage/drizzle/sqlite/migrations/meta/0000_snapshot.json +687 -0
  79. package/out/storage/drizzle/sqlite/migrations/meta/_journal.json +13 -0
  80. package/out/storage/drizzle/sqlite/schema.d.ts +1544 -0
  81. package/out/storage/drizzle/sqlite/schema.js +106 -0
  82. package/out/storage/index.d.ts +2 -88
  83. package/out/storage/index.js +12 -128
  84. package/out/storage/internal/backup.d.ts +3 -0
  85. package/out/storage/internal/backup.js +94 -0
  86. package/out/storage/types.d.ts +66 -0
  87. package/out/types.d.ts +43 -47
  88. package/out/util/credentials-masker.js +2 -2
  89. package/out/util/export.d.ts +1 -0
  90. package/out/util/export.js +2 -1
  91. package/out/util/index.d.ts +2 -1
  92. package/out/util/index.js +12 -9
  93. package/out/util/normalize-module.d.ts +0 -1
  94. package/out/util/normalize-module.js +0 -4
  95. package/package.json +19 -24
  96. package/out/modules/ai-tools/handlers/tool-calls.d.ts +0 -4
  97. package/out/modules/ai-tools/handlers/tool-calls.js +0 -52
  98. package/out/modules/ai-tools/index.d.ts +0 -10
  99. package/out/modules/ai-tools/index.js +0 -46
  100. package/out/modules/ai-tools/types.d.ts +0 -63
  101. package/out/modules/ai-tools/types.js +0 -2
  102. package/out/modules/ai-tools/util/index.d.ts +0 -5
  103. package/out/modules/ai-tools/util/index.js +0 -24
  104. package/out/storage/d1.d.ts +0 -107
  105. package/out/storage/d1.js +0 -837
  106. package/out/storage/export.d.ts +0 -1
  107. package/out/storage/export.js +0 -2
  108. package/out/storage/mysql.d.ts +0 -109
  109. package/out/storage/mysql.js +0 -984
  110. package/out/storage/postgre.d.ts +0 -124
  111. package/out/storage/postgre.js +0 -1027
  112. package/out/storage/sqlite.js +0 -786
@@ -369,52 +369,71 @@ function updateCrowdinFromWebhookRequest(args) {
369
369
  }
370
370
  function listenQueueMessage(_a) {
371
371
  return __awaiter(this, arguments, void 0, function* ({ config, integration, queueName, queueUrl, }) {
372
- let reconnectAttempts = 0;
373
- const connect = () => __awaiter(this, void 0, void 0, function* () {
374
- try {
375
- const connection = yield amqplib_1.default.connect(queueUrl, {
376
- heartbeat: connectionHeartbeat, // 60 seconds heartbeat
377
- });
378
- // Reset reconnect attempts on successful connection
379
- reconnectAttempts = 0;
380
- connection.on('error', (err) => {
381
- (0, logger_1.logError)(`AMQP connection error: ${err.message}`);
382
- });
383
- connection.on('close', () => __awaiter(this, void 0, void 0, function* () {
384
- (0, logger_1.logError)('AMQP connection closed, attempting to reconnect...');
385
- yield scheduleReconnect();
386
- }));
387
- const channel = yield connection.createChannel();
388
- if (channel) {
389
- yield channel.assertQueue(queueName, { durable: true });
390
- yield channel.prefetch(prefetchCount);
391
- channel.on('error', (err) => {
392
- (0, logger_1.logError)(`AMQP channel error: ${err.message}`);
393
- });
394
- channel.on('close', () => {
395
- (0, logger_1.logError)('AMQP channel closed');
396
- });
397
- const onMessage = consumer({ channel, config, integration });
398
- yield channel.consume(queueName, onMessage, { noAck: false });
399
- }
400
- }
401
- catch (e) {
402
- (0, logger_1.logError)(`Failed to connect to AMQP: ${e}`);
403
- yield scheduleReconnect();
404
- }
372
+ let parsedUrl;
373
+ try {
374
+ parsedUrl = new URL(queueUrl);
375
+ }
376
+ catch (err) {
377
+ (0, logger_1.logError)(`Invalid AMQP queueUrl: ${err}`);
378
+ return;
379
+ }
380
+ const setup = (model) => __awaiter(this, void 0, void 0, function* () {
381
+ const channel = yield model.createChannel();
382
+ yield channel.assertQueue(queueName, { durable: true });
383
+ yield channel.prefetch(prefetchCount);
384
+ channel.on('error', (err) => {
385
+ (0, logger_1.logError)(`AMQP channel error: ${err.message}`);
386
+ });
387
+ channel.on('close', () => {
388
+ (0, logger_1.logError)('AMQP channel closed');
389
+ });
390
+ channel.on('handler-error', (err, eventName) => {
391
+ (0, logger_1.logError)(`AMQP channel handler error on event '${eventName}': ${err}`);
392
+ });
393
+ const onMessage = consumer({ channel, config, integration });
394
+ yield channel.consume(queueName, onMessage, { noAck: false });
405
395
  });
406
- const scheduleReconnect = () => __awaiter(this, void 0, void 0, function* () {
407
- if (reconnectAttempts >= maxReconnectAttempts) {
408
- (0, logger_1.logError)(`Max reconnection attempts (${maxReconnectAttempts}) reached. Stopping reconnection.`);
409
- return;
410
- }
411
- reconnectAttempts++;
412
- const delay = Math.min(baseReconnectDelay * Math.pow(2, reconnectAttempts - 1), 30000); // Exponential backoff up to 30s
413
- setTimeout(() => __awaiter(this, void 0, void 0, function* () {
414
- yield connect();
415
- }), delay);
396
+ let connection;
397
+ try {
398
+ connection = yield amqplib_1.default.connect({
399
+ protocol: parsedUrl.protocol.replace(/:$/, ''),
400
+ hostname: parsedUrl.hostname,
401
+ port: parsedUrl.port ? Number(parsedUrl.port) : undefined,
402
+ username: parsedUrl.username || undefined,
403
+ password: parsedUrl.password || undefined,
404
+ vhost: parsedUrl.pathname && parsedUrl.pathname !== '/'
405
+ ? decodeURIComponent(parsedUrl.pathname.slice(1))
406
+ : undefined,
407
+ heartbeat: connectionHeartbeat,
408
+ }, {
409
+ recovery: {
410
+ initialDelay: baseReconnectDelay,
411
+ maxDelay: 30000,
412
+ factor: 2,
413
+ maxRetries: maxReconnectAttempts,
414
+ setup,
415
+ },
416
+ });
417
+ }
418
+ catch (err) {
419
+ (0, logger_1.logError)(`Failed to connect to AMQP: ${err}`);
420
+ return;
421
+ }
422
+ connection.on('connect', () => {
423
+ (0, logger_1.log)('AMQP connection established');
424
+ });
425
+ connection.on('disconnect', (err) => {
426
+ (0, logger_1.logError)(`AMQP connection closed, attempting to reconnect: ${err === null || err === void 0 ? void 0 : err.message}`);
427
+ });
428
+ connection.on('reconnect-scheduled', ({ attempt, delay }) => {
429
+ (0, logger_1.logError)(`AMQP reconnecting (attempt ${attempt}, delay ${delay}ms)`);
430
+ });
431
+ connection.on('reconnect-failed', (err) => {
432
+ (0, logger_1.logError)(`AMQP max reconnection attempts (${maxReconnectAttempts}) reached: ${err}`);
433
+ });
434
+ connection.on('error', (err) => {
435
+ (0, logger_1.logError)(`AMQP connection error: ${err.message}`);
416
436
  });
417
- yield connect();
418
437
  });
419
438
  }
420
439
  function consumer({ channel, config, integration, }) {
@@ -463,15 +482,11 @@ function consumer({ channel, config, integration, }) {
463
482
  }
464
483
  if (messagesCounter < prefetchCount) {
465
484
  // if all messages are not received, wait 10 seconds to force process messages
466
- timeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
467
- yield processMessages({
468
- webhooksData,
469
- webhooksInfo,
470
- channel,
471
- messagesToAck,
472
- });
473
- resetStateVariables();
474
- }), forceProcessDelay);
485
+ timeoutId = setTimeout(() => {
486
+ processMessages({ webhooksData, webhooksInfo, channel, messagesToAck })
487
+ .then(() => resetStateVariables())
488
+ .catch((err) => (0, logger_1.logError)(`Error in deferred message processing: ${err}`));
489
+ }, forceProcessDelay);
475
490
  return;
476
491
  }
477
492
  clearTimeout(timeoutId);
@@ -542,7 +557,7 @@ function processMessages(_a) {
542
557
  }
543
558
  }
544
559
  catch (e) {
545
- (0, logger_1.log)(`Error in processMessages: ${e}`);
560
+ (0, logger_1.logError)(`Error in processMessages: ${e}`);
546
561
  for (const msg of messagesToAck) {
547
562
  try {
548
563
  if (isRetryableError(e)) {