@bprotsyk/aso-core 2.1.131 → 2.1.133

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/lib/app/app.d.ts CHANGED
@@ -33,6 +33,7 @@ export interface IApp extends Document {
33
33
  proxied: boolean;
34
34
  ech?: boolean;
35
35
  imageFormat: EImageFormat;
36
+ policyPath: string;
36
37
  }
37
38
  export declare enum EImageFormat {
38
39
  PNG = "png",
@@ -209,6 +210,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
209
210
  trackingUrl: string;
210
211
  integrationVersion: string;
211
212
  removeInfo: any;
213
+ policyPath: string;
212
214
  name?: string | null | undefined;
213
215
  pushesEnabled?: boolean | null | undefined;
214
216
  publicationHistory?: any;
@@ -252,6 +254,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
252
254
  trackingUrl: string;
253
255
  integrationVersion: string;
254
256
  removeInfo: any;
257
+ policyPath: string;
255
258
  name?: string | null | undefined;
256
259
  pushesEnabled?: boolean | null | undefined;
257
260
  publicationHistory?: any;
@@ -295,6 +298,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
295
298
  trackingUrl: string;
296
299
  integrationVersion: string;
297
300
  removeInfo: any;
301
+ policyPath: string;
298
302
  name?: string | null | undefined;
299
303
  pushesEnabled?: boolean | null | undefined;
300
304
  publicationHistory?: any;
package/lib/app/app.js CHANGED
@@ -211,5 +211,9 @@ exports.AppSchema = new mongoose_1.Schema({
211
211
  type: String,
212
212
  },
213
213
  },
214
- platforms: Object
214
+ platforms: Object,
215
+ policyPath: {
216
+ type: String,
217
+ default: "none"
218
+ }
215
219
  });
@@ -5,6 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.KeitaroCLOGeosService = exports.getAppsNeedingGeoUpdate = exports.getAppGeoSyncDetails = exports.syncKeitaroCLOGeosWithApps = void 0;
7
7
  const http_1 = __importDefault(require("../network/keitaro/traffle/http"));
8
+ // Хелпер для нормалізації списку гео
9
+ function normalizeGeos(geos) {
10
+ if (!Array.isArray(geos))
11
+ return [];
12
+ const unique = new Set();
13
+ for (const raw of geos) {
14
+ if (typeof raw !== 'string')
15
+ continue;
16
+ const val = raw.trim().toUpperCase();
17
+ if (!val)
18
+ continue;
19
+ unique.add(val);
20
+ }
21
+ return Array.from(unique).sort();
22
+ }
8
23
  /**
9
24
  * Отримує всі кампанії з Keitaro
10
25
  */
@@ -191,16 +206,17 @@ async function syncKeitaroCLOGeosWithApps(apps) {
191
206
  console.log(` Визначена платформа: ${platform}`);
192
207
  // Отримуємо гео з CLO потоку кампанії
193
208
  console.log(` Отримуємо гео з CLO потоку...`);
194
- const keitaroGeos = await getCLOGeosFromCampaign(campaign.id);
209
+ const keitaroGeosRaw = await getCLOGeosFromCampaign(campaign.id);
210
+ const keitaroGeos = normalizeGeos(keitaroGeosRaw);
195
211
  console.log(` Keitaro CLO гео: ${keitaroGeos.join(', ')}`);
196
212
  // Отримуємо гео з додатку для конкретної платформи
197
213
  const platformData = app.platforms[platform];
198
- const appGeos = platformData?.geo || [];
214
+ const appGeos = normalizeGeos(platformData?.geo);
199
215
  console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
200
216
  // Порівнюємо гео
201
217
  const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
202
- const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
203
- !appGeos.every(geo => keitaroGeos.includes(geo));
218
+ const extraGeos = appGeos.filter(geo => !keitaroGeos.includes(geo));
219
+ const needsUpdate = missingGeos.length > 0 || extraGeos.length > 0;
204
220
  console.log(` Відсутні гео в app: ${missingGeos.join(', ')}`);
205
221
  console.log(` Потребує оновлення: ${needsUpdate}`);
206
222
  if (needsUpdate) {
@@ -217,6 +233,7 @@ async function syncKeitaroCLOGeosWithApps(apps) {
217
233
  console.log(` Keitaro гео: ${keitaroGeos.join(', ')}`);
218
234
  console.log(` App гео: ${appGeos.join(', ')}`);
219
235
  console.log(` Відсутні гео в app: ${missingGeos.join(', ')}`);
236
+ console.log(` Зайві гео в app: ${extraGeos.join(', ')}`);
220
237
  console.log(` Нові гео (з Keitaro): ${updateData.newGeos.join(', ')}`);
221
238
  }
222
239
  else {
@@ -24,6 +24,7 @@ export interface IUpsertAppRequest {
24
24
  imageFormat?: EImageFormat;
25
25
  file?: any;
26
26
  status?: AppStatus;
27
+ policyPath?: string;
27
28
  }
28
29
  export interface IUpsertAppResponse {
29
30
  data: IUpsertAppRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.1.131",
3
+ "version": "2.1.133",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
package/src/app/app.ts CHANGED
@@ -41,6 +41,7 @@ export interface IApp extends Document {
41
41
  proxied: boolean,
42
42
  ech?: boolean,
43
43
  imageFormat: EImageFormat
44
+ policyPath: string
44
45
  }
45
46
 
46
47
  export enum EImageFormat {
@@ -386,7 +387,11 @@ export const AppSchema = new Schema({
386
387
  type: String,
387
388
  },
388
389
  },
389
- platforms: Object
390
+ platforms: Object,
391
+ policyPath: {
392
+ type: String,
393
+ default: "none"
394
+ }
390
395
  })
391
396
 
392
397
 
@@ -3,6 +3,19 @@ import { IKeitaroCampaign } from "./keitaro-campaign";
3
3
  import { IKeitaroStream } from "./keitaro-stream";
4
4
  import { IApp, IPlatformParams, EPlatform } from "../app/app";
5
5
 
6
+ // Хелпер для нормалізації списку гео
7
+ function normalizeGeos(geos: string[] | undefined | null): string[] {
8
+ if (!Array.isArray(geos)) return [];
9
+ const unique = new Set<string>();
10
+ for (const raw of geos) {
11
+ if (typeof raw !== 'string') continue;
12
+ const val = raw.trim().toUpperCase();
13
+ if (!val) continue;
14
+ unique.add(val);
15
+ }
16
+ return Array.from(unique).sort();
17
+ }
18
+
6
19
  // Інтерфейс для результату синхронізації гео
7
20
  export interface IGeoSyncResult {
8
21
  appId: number;
@@ -242,18 +255,19 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
242
255
 
243
256
  // Отримуємо гео з CLO потоку кампанії
244
257
  console.log(` Отримуємо гео з CLO потоку...`);
245
- const keitaroGeos = await getCLOGeosFromCampaign(campaign.id);
258
+ const keitaroGeosRaw = await getCLOGeosFromCampaign(campaign.id);
259
+ const keitaroGeos = normalizeGeos(keitaroGeosRaw);
246
260
  console.log(` Keitaro CLO гео: ${keitaroGeos.join(', ')}`);
247
261
 
248
262
  // Отримуємо гео з додатку для конкретної платформи
249
263
  const platformData = app.platforms[platform as EPlatform];
250
- const appGeos = platformData?.geo || [];
264
+ const appGeos = normalizeGeos(platformData?.geo);
251
265
  console.log(` App гео для платформи ${platform}: ${appGeos.join(', ')}`);
252
266
 
253
267
  // Порівнюємо гео
254
268
  const missingGeos = keitaroGeos.filter(geo => !appGeos.includes(geo));
255
- const needsUpdate = missingGeos.length > 0 || appGeos.length !== keitaroGeos.length ||
256
- !appGeos.every(geo => keitaroGeos.includes(geo));
269
+ const extraGeos = appGeos.filter(geo => !keitaroGeos.includes(geo));
270
+ const needsUpdate = missingGeos.length > 0 || extraGeos.length > 0;
257
271
 
258
272
  console.log(` Відсутні гео в app: ${missingGeos.join(', ')}`);
259
273
  console.log(` Потребує оновлення: ${needsUpdate}`);
@@ -275,6 +289,7 @@ export async function syncKeitaroCLOGeosWithApps(apps: IApp[]): Promise<IGeoSync
275
289
  console.log(` Keitaro гео: ${keitaroGeos.join(', ')}`);
276
290
  console.log(` App гео: ${appGeos.join(', ')}`);
277
291
  console.log(` Відсутні гео в app: ${missingGeos.join(', ')}`);
292
+ console.log(` Зайві гео в app: ${extraGeos.join(', ')}`);
278
293
  console.log(` Нові гео (з Keitaro): ${updateData.newGeos.join(', ')}`);
279
294
  } else {
280
295
  console.log(`✅ Додаток ${group} (${platform}) не потребує оновлення гео - гео ідентичні`);
@@ -30,6 +30,7 @@ export interface IUpsertAppRequest {
30
30
  imageFormat?: EImageFormat,
31
31
  file?: any
32
32
  status?: AppStatus
33
+ policyPath?: string
33
34
  }
34
35
 
35
36
  export interface IUpsertAppResponse {