@crowdin/app-project-module 2.0.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.
- package/out/modules/integration/util/webhooks.js +69 -54
- package/out/static/ui/error.bundle.js +9 -9
- package/out/static/ui/error.bundle.js.map +1 -1
- package/out/static/ui/form.bundle.js +125 -125
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/static/ui/install.bundle.js +9 -9
- package/out/static/ui/install.bundle.js.map +1 -1
- package/out/static/ui/login.bundle.js +9 -9
- package/out/static/ui/login.bundle.js.map +1 -1
- package/out/static/ui/main.bundle.js +9 -9
- package/out/static/ui/main.bundle.js.map +1 -1
- package/out/static/ui/oauth.bundle.js +9 -9
- package/out/static/ui/oauth.bundle.js.map +1 -1
- package/package.json +2 -3
|
@@ -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
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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(() =>
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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.
|
|
560
|
+
(0, logger_1.logError)(`Error in processMessages: ${e}`);
|
|
546
561
|
for (const msg of messagesToAck) {
|
|
547
562
|
try {
|
|
548
563
|
if (isRetryableError(e)) {
|
|
@@ -115,17 +115,17 @@
|
|
|
115
115
|
function requireScheduler_production_min () {
|
|
116
116
|
if (hasRequiredScheduler_production_min) return scheduler_production_min;
|
|
117
117
|
hasRequiredScheduler_production_min = 1;
|
|
118
|
-
(function (exports
|
|
118
|
+
(function (exports) {
|
|
119
119
|
function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length,w=e>>>1;d<w;){var m=2*(d+1)-1,C=a[m],n=m+1,x=a[n];if(0>g(C,c))n<e&&0>g(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(n<e&&0>g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}
|
|
120
|
-
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports
|
|
120
|
+
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};}var r=[],t=[],u=1,v=null,y=3,z=false,A=false,B=false,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null;
|
|
121
121
|
"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t);}}function H(a){B=false;G(a);if(!A)if(null!==h(r))A=true,I(J);else {var b=h(t);null!==b&&K(H,b.startTime-a);}}
|
|
122
|
-
function J(a,b){A=false;B&&(B=false,E(L),L=-1);z=true;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if("function"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports
|
|
123
|
-
function M(){return exports
|
|
124
|
-
exports
|
|
125
|
-
exports
|
|
126
|
-
exports
|
|
127
|
-
exports
|
|
128
|
-
exports
|
|
122
|
+
function J(a,b){A=false;B&&(B=false,E(L),L=-1);z=true;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if("function"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?v.callback=e:v===h(r)&&k(r);G(b);}else k(r);v=h(r);}if(null!==v)var w=!0;else {var m=h(t);null!==m&&K(H,m.startTime-b);w=!1;}return w}finally{v=null,y=c,z=false;}}var N=false,O=null,L=-1,P=5,Q=-1;
|
|
123
|
+
function M(){return exports.unstable_now()-Q<P?false:true}function R(){if(null!==O){var a=exports.unstable_now();Q=a;var b=true;try{b=O(!0,a);}finally{b?S():(N=false,O=null);}}else N=false;}var S;if("function"===typeof F)S=function(){F(R);};else if("undefined"!==typeof MessageChannel){var T=new MessageChannel,U=T.port2;T.port1.onmessage=R;S=function(){U.postMessage(null);};}else S=function(){D(R,0);};function I(a){O=a;N||(N=true,S());}function K(a,b){L=D(function(){a(exports.unstable_now());},b);}
|
|
124
|
+
exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null;};exports.unstable_continueExecution=function(){A||z||(A=true,I(J));};
|
|
125
|
+
exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<a?Math.floor(1E3/a):5;};exports.unstable_getCurrentPriorityLevel=function(){return y};exports.unstable_getFirstCallbackNode=function(){return h(r)};exports.unstable_next=function(a){switch(y){case 1:case 2:case 3:var b=3;break;default:b=y;}var c=y;y=b;try{return a()}finally{y=c;}};exports.unstable_pauseExecution=function(){};
|
|
126
|
+
exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3;}var c=y;y=a;try{return b()}finally{y=c;}};
|
|
127
|
+
exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3;}e=c+e;a={id:u++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=true,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=true,I(J)));return a};
|
|
128
|
+
exports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c;}}};
|
|
129
129
|
} (scheduler_production_min));
|
|
130
130
|
return scheduler_production_min;
|
|
131
131
|
}
|