@bprotsyk/aso-core 2.1.126 → 2.1.128
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.
|
@@ -16,6 +16,14 @@ export interface IGeoSyncSummary {
|
|
|
16
16
|
totalApps: number;
|
|
17
17
|
appsNeedingUpdate: number;
|
|
18
18
|
updates: IGeoUpdateData[];
|
|
19
|
+
appsNeedingEnable: number;
|
|
20
|
+
appsNeedingDisable: number;
|
|
21
|
+
enablementChecks: {
|
|
22
|
+
appId: number;
|
|
23
|
+
platform: string;
|
|
24
|
+
mustBeEnabled: boolean;
|
|
25
|
+
mustBeDisabled: boolean;
|
|
26
|
+
}[];
|
|
19
27
|
errors: string[];
|
|
20
28
|
}
|
|
21
29
|
/**
|
|
@@ -119,6 +119,9 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
119
119
|
totalApps: apps.length,
|
|
120
120
|
appsNeedingUpdate: 0,
|
|
121
121
|
updates: [],
|
|
122
|
+
appsNeedingEnable: 0,
|
|
123
|
+
appsNeedingDisable: 0,
|
|
124
|
+
enablementChecks: [],
|
|
122
125
|
errors: []
|
|
123
126
|
};
|
|
124
127
|
try {
|
|
@@ -197,6 +200,32 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
197
200
|
const platformData = app.platforms[platform];
|
|
198
201
|
const appGeos = platformData?.geo || [];
|
|
199
202
|
console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
|
|
203
|
+
// Перевіряємо статус CLO потоку в Keitaro
|
|
204
|
+
const streams = await getStreamsByCampaignId(campaign.id);
|
|
205
|
+
const cloStream = streams.find(stream => stream.name === "CLO");
|
|
206
|
+
const keitaroCLOEnabled = cloStream?.state === 'active' || false;
|
|
207
|
+
console.log(` CLO потік в Keitaro: ${keitaroCLOEnabled ? 'включений' : 'вимкнений'}`);
|
|
208
|
+
// Перевіряємо чи включена платформа в додатку
|
|
209
|
+
const appPlatformEnabled = platformData?.enabled || false;
|
|
210
|
+
console.log(` Платформа ${platform} в додатку: ${appPlatformEnabled ? 'включена' : 'вимкнена'}`);
|
|
211
|
+
// Визначаємо чи потрібно включити/вимкнути додаток
|
|
212
|
+
const mustBeEnabled = keitaroCLOEnabled && !appPlatformEnabled;
|
|
213
|
+
const mustBeDisabled = !keitaroCLOEnabled && appPlatformEnabled;
|
|
214
|
+
if (mustBeEnabled) {
|
|
215
|
+
summary.appsNeedingEnable++;
|
|
216
|
+
console.log(` ✅ Потребує включення`);
|
|
217
|
+
}
|
|
218
|
+
else if (mustBeDisabled) {
|
|
219
|
+
summary.appsNeedingDisable++;
|
|
220
|
+
console.log(` ❌ Потребує вимкнення`);
|
|
221
|
+
}
|
|
222
|
+
// Додаємо до перевірок включення
|
|
223
|
+
summary.enablementChecks.push({
|
|
224
|
+
appId: parseInt(group),
|
|
225
|
+
platform: platform,
|
|
226
|
+
mustBeEnabled: mustBeEnabled,
|
|
227
|
+
mustBeDisabled: mustBeDisabled
|
|
228
|
+
});
|
|
200
229
|
// Порівнюємо гео
|
|
201
230
|
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
202
231
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
@@ -229,7 +258,7 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
229
258
|
summary.errors.push(errorMsg);
|
|
230
259
|
}
|
|
231
260
|
}
|
|
232
|
-
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення
|
|
261
|
+
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення гео, ${summary.appsNeedingEnable} потребують включення, ${summary.appsNeedingDisable} потребують вимкнення.`);
|
|
233
262
|
}
|
|
234
263
|
catch (error) {
|
|
235
264
|
const errorMsg = `Критична помилка синхронізації: ${error}`;
|
package/package.json
CHANGED
|
@@ -25,9 +25,18 @@ export interface IGeoSyncSummary {
|
|
|
25
25
|
totalApps: number;
|
|
26
26
|
appsNeedingUpdate: number;
|
|
27
27
|
updates: IGeoUpdateData[];
|
|
28
|
+
appsNeedingEnable: number;
|
|
29
|
+
appsNeedingDisable: number;
|
|
30
|
+
enablementChecks: {
|
|
31
|
+
appId: number;
|
|
32
|
+
platform: string;
|
|
33
|
+
mustBeEnabled: boolean;
|
|
34
|
+
mustBeDisabled: boolean;
|
|
35
|
+
}[];
|
|
28
36
|
errors: string[];
|
|
29
37
|
}
|
|
30
38
|
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Отримує всі кампанії з Keitaro
|
|
33
42
|
*/
|
|
@@ -146,6 +155,9 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
146
155
|
totalApps: apps.length,
|
|
147
156
|
appsNeedingUpdate: 0,
|
|
148
157
|
updates: [],
|
|
158
|
+
appsNeedingEnable: 0,
|
|
159
|
+
appsNeedingDisable: 0,
|
|
160
|
+
enablementChecks: [],
|
|
149
161
|
errors: []
|
|
150
162
|
};
|
|
151
163
|
|
|
@@ -250,6 +262,36 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
250
262
|
const appGeos = platformData?.geo || [];
|
|
251
263
|
console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
|
|
252
264
|
|
|
265
|
+
// Перевіряємо статус CLO потоку в Keitaro
|
|
266
|
+
const streams = await getStreamsByCampaignId(campaign.id);
|
|
267
|
+
const cloStream = streams.find(stream => stream.name === "CLO");
|
|
268
|
+
const keitaroCLOEnabled = cloStream?.state === 'active' || false;
|
|
269
|
+
console.log(` CLO потік в Keitaro: ${keitaroCLOEnabled ? 'включений' : 'вимкнений'}`);
|
|
270
|
+
|
|
271
|
+
// Перевіряємо чи включена платформа в додатку
|
|
272
|
+
const appPlatformEnabled = platformData?.enabled || false;
|
|
273
|
+
console.log(` Платформа ${platform} в додатку: ${appPlatformEnabled ? 'включена' : 'вимкнена'}`);
|
|
274
|
+
|
|
275
|
+
// Визначаємо чи потрібно включити/вимкнути додаток
|
|
276
|
+
const mustBeEnabled = keitaroCLOEnabled && !appPlatformEnabled;
|
|
277
|
+
const mustBeDisabled = !keitaroCLOEnabled && appPlatformEnabled;
|
|
278
|
+
|
|
279
|
+
if (mustBeEnabled) {
|
|
280
|
+
summary.appsNeedingEnable++;
|
|
281
|
+
console.log(` ✅ Потребує включення`);
|
|
282
|
+
} else if (mustBeDisabled) {
|
|
283
|
+
summary.appsNeedingDisable++;
|
|
284
|
+
console.log(` ❌ Потребує вимкнення`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Додаємо до перевірок включення
|
|
288
|
+
summary.enablementChecks.push({
|
|
289
|
+
appId: parseInt(group),
|
|
290
|
+
platform: platform,
|
|
291
|
+
mustBeEnabled: mustBeEnabled,
|
|
292
|
+
mustBeDisabled: mustBeDisabled
|
|
293
|
+
});
|
|
294
|
+
|
|
253
295
|
// Порівнюємо гео
|
|
254
296
|
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
255
297
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
@@ -287,7 +329,7 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
287
329
|
}
|
|
288
330
|
}
|
|
289
331
|
|
|
290
|
-
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення
|
|
332
|
+
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення гео, ${summary.appsNeedingEnable} потребують включення, ${summary.appsNeedingDisable} потребують вимкнення.`);
|
|
291
333
|
|
|
292
334
|
} catch (error) {
|
|
293
335
|
const errorMsg = `Критична помилка синхронізації: ${error}`;
|
|
@@ -364,6 +406,7 @@ export async function getAppsNeedingGeoUpdate(apps: IApp[]): Promise<IGeoUpdateD
|
|
|
364
406
|
return summary.updates;
|
|
365
407
|
}
|
|
366
408
|
|
|
409
|
+
|
|
367
410
|
/**
|
|
368
411
|
* Експортуємо основні функції
|
|
369
412
|
*/
|