@bprotsyk/aso-core 2.1.130 → 2.1.131
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,14 +16,6 @@ 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
|
-
}[];
|
|
27
19
|
errors: string[];
|
|
28
20
|
}
|
|
29
21
|
/**
|
|
@@ -119,9 +119,6 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
119
119
|
totalApps: apps.length,
|
|
120
120
|
appsNeedingUpdate: 0,
|
|
121
121
|
updates: [],
|
|
122
|
-
appsNeedingEnable: 0,
|
|
123
|
-
appsNeedingDisable: 0,
|
|
124
|
-
enablementChecks: [],
|
|
125
122
|
errors: []
|
|
126
123
|
};
|
|
127
124
|
try {
|
|
@@ -200,32 +197,6 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
200
197
|
const platformData = app.platforms[platform];
|
|
201
198
|
const appGeos = platformData?.geo || [];
|
|
202
199
|
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
|
-
});
|
|
229
200
|
// Порівнюємо гео
|
|
230
201
|
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
231
202
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
@@ -258,7 +229,7 @@ async function syncKeitaroCLOGeosWithApps(apps) {
|
|
|
258
229
|
summary.errors.push(errorMsg);
|
|
259
230
|
}
|
|
260
231
|
}
|
|
261
|
-
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення
|
|
232
|
+
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення гео.`);
|
|
262
233
|
}
|
|
263
234
|
catch (error) {
|
|
264
235
|
const errorMsg = `Критична помилка синхронізації: ${error}`;
|
package/package.json
CHANGED
|
@@ -25,18 +25,9 @@ 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
|
-
}[];
|
|
36
28
|
errors: string[];
|
|
37
29
|
}
|
|
38
30
|
|
|
39
|
-
|
|
40
31
|
/**
|
|
41
32
|
* Отримує всі кампанії з Keitaro
|
|
42
33
|
*/
|
|
@@ -155,9 +146,6 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
155
146
|
totalApps: apps.length,
|
|
156
147
|
appsNeedingUpdate: 0,
|
|
157
148
|
updates: [],
|
|
158
|
-
appsNeedingEnable: 0,
|
|
159
|
-
appsNeedingDisable: 0,
|
|
160
|
-
enablementChecks: [],
|
|
161
149
|
errors: []
|
|
162
150
|
};
|
|
163
151
|
|
|
@@ -262,36 +250,6 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
262
250
|
const appGeos = platformData?.geo || [];
|
|
263
251
|
console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
|
|
264
252
|
|
|
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
|
-
|
|
295
253
|
// Порівнюємо гео
|
|
296
254
|
const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
|
|
297
255
|
const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
|
|
@@ -329,7 +287,7 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
|
|
|
329
287
|
}
|
|
330
288
|
}
|
|
331
289
|
|
|
332
|
-
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення
|
|
290
|
+
console.log(`\nСинхронізація завершена. ${summary.appsNeedingUpdate} додатків потребують оновлення гео.`);
|
|
333
291
|
|
|
334
292
|
} catch (error) {
|
|
335
293
|
const errorMsg = `Критична помилка синхронізації: ${error}`;
|
|
@@ -406,7 +364,6 @@ export async function getAppsNeedingGeoUpdate(apps: IApp[]): Promise<IGeoUpdateD
|
|
|
406
364
|
return summary.updates;
|
|
407
365
|
}
|
|
408
366
|
|
|
409
|
-
|
|
410
367
|
/**
|
|
411
368
|
* Експортуємо основні функції
|
|
412
369
|
*/
|