@bprotsyk/aso-core 1.2.81 → 1.2.85

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.
@@ -50,7 +50,7 @@ exports.FlashAppSchema = new mongoose_1.Schema({
50
50
  },
51
51
  plugStatus: {
52
52
  type: String,
53
- enum: PlugType,
53
+ enum: FlashAppPlugStatus,
54
54
  default: FlashAppPlugStatus.DISABLED,
55
55
  required: false
56
56
  },
@@ -62,8 +62,8 @@ exports.FlashAppSchema = new mongoose_1.Schema({
62
62
  },
63
63
  reservePlugType: {
64
64
  type: String,
65
- enum: PlugType,
66
- default: PlugType.GIST,
65
+ enum: FlashAppPlugStatus,
66
+ default: FlashAppPlugStatus.DISABLED,
67
67
  required: false
68
68
  },
69
69
  reservePlugContent: {
@@ -72,7 +72,7 @@ exports.FlashAppSchema = new mongoose_1.Schema({
72
72
  },
73
73
  reservePlugStatus: {
74
74
  type: String,
75
- enum: PlugType,
75
+ enum: FlashAppPlugStatus,
76
76
  default: FlashAppPlugStatus.DISABLED,
77
77
  required: false
78
78
  },
@@ -210,32 +210,18 @@ async function updateSchemaAndMoveValue(model) {
210
210
  // employee_addr: "$$REMOVE"
211
211
  // },
212
212
  $set: {
213
- "plugAccountId": 1,
214
- "reservePlugAccountId": 1,
215
- "plugId": "none",
216
- "plugContent": "none",
217
- "keitaroData.domainId": "$$REMOVE",
218
- "keitaroData.domainName": "$$REMOVE",
219
- "plugUrl": "$$REMOVE",
220
- "reservePlugUrl": "$$REMOVE",
213
+ "plugStatus": "$$REMOVE",
214
+ "reservePlugStatus": "$$REMOVE",
221
215
  }
222
216
  }
223
217
  ];
224
218
  let aggregation = model.aggregate(pipelineStage);
225
219
  try {
226
- await model.collection.dropIndex("keitaroData.domainId");
227
- }
228
- catch (e) { }
229
- try {
230
- await model.collection.dropIndex("keitaroData.domainName");
231
- }
232
- catch (e) { }
233
- try {
234
- await model.collection.dropIndex("plugUrl");
220
+ await model.collection.dropIndex("plugStatus");
235
221
  }
236
222
  catch (e) { }
237
223
  try {
238
- await model.collection.dropIndex("reservePlugUrl");
224
+ await model.collection.dropIndex("reservePlugStatus");
239
225
  }
240
226
  catch (e) { }
241
227
  // await model.schema.dropIndex("generationOptions.keyPassword_1")
@@ -391,78 +391,68 @@ let gatherInfoForFlashApps = async () => {
391
391
  let result = [];
392
392
  for (let [id, paste] of Object.entries(pasteMap)) {
393
393
  console.log(`- #${id}`);
394
- let ow = owCampaigns[id];
395
- let redirect = redirectCampaigns[id];
396
- let tracking = trackingMap[id];
394
+ // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
395
+ // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
396
+ // let tracking = trackingMap[id as keyof object]
397
397
  let app = flashApps[id];
398
398
  if (!app) {
399
399
  console.log(`! No app for ${id}`);
400
400
  continue;
401
401
  }
402
- if (paste.status == flash_app_1.FlashAppPlugStatus.ENABLED) {
403
- if (!ow)
404
- console.log(`#${id}: no OW`);
405
- if (!redirect)
406
- console.log(`No redirect for #${id}`);
407
- else if (!paste.content.includes(redirect.domain))
408
- console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`);
409
- else if (!paste.content.includes(redirect.alias))
410
- console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`);
411
- }
412
- let appId;
413
- for (let parameter of Object.values(redirect?.parameters || {})) {
414
- if (parameter.name == "appId") {
415
- appId = parameter.placeholder;
416
- }
417
- }
418
- if (!appId && ow)
419
- console.log(`No app id for #${id}`);
420
- else if (appId != id && ow)
421
- console.log(`Wrong app id (${appId}) for #${id}`);
422
- let owDomain = ow?.domain?.split("/")[2];
423
- let owDomainId = ow?.domain_id;
424
- let owCampaignId = ow?.id;
425
- let owCampaignName = ow?.name;
426
- let owCampaignAlias = ow?.alias;
427
- let redirectDomain = redirect?.domain?.split("/")[2];
428
- let redirectDomainId = redirect?.domain_id;
429
- let redirectCampaignId = redirect?.id;
430
- let redirectCampaignName = redirect?.name;
431
- let redirectCampaignAlias = redirect?.alias;
432
- let clickIdParameterName = ow?.parameters?.sub_id_8?.name;
433
- let offerIdParameterName = ow?.parameters?.sub_id_15?.name;
434
- if (!clickIdParameterName && app && ow)
435
- console.log(`No click id parameter for #${id}`);
436
- if (!offerIdParameterName && app && ow)
437
- console.log(`No offer id parameter for #${id}`);
438
- let trackingLink = tracking?.trackingUrl;
402
+ // if (paste.status == FlashAppPlugStatus.ENABLED) {
403
+ // if (!ow) console.log(`#${id}: no OW`)
404
+ // if (!redirect) console.log(`No redirect for #${id}`)
405
+ // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
406
+ // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
407
+ // }
408
+ // let appId
409
+ // for (let parameter of Object.values(redirect?.parameters || {})) {
410
+ // if (parameter.name == "appId") {
411
+ // appId = parameter.placeholder
412
+ // }
413
+ // }
414
+ // if (!appId && ow) console.log(`No app id for #${id}`)
415
+ // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
416
+ // let owDomain = ow?.domain?.split("/")[2]
417
+ // let owDomainId = ow?.domain_id
418
+ // let owCampaignId = ow?.id
419
+ // let owCampaignName = ow?.name
420
+ // let owCampaignAlias = ow?.alias
421
+ // let redirectDomain = redirect?.domain?.split("/")[2]
422
+ // let redirectDomainId = redirect?.domain_id
423
+ // let redirectCampaignId = redirect?.id
424
+ // let redirectCampaignName = redirect?.name
425
+ // let redirectCampaignAlias = redirect?.alias
426
+ // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
427
+ // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
428
+ // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
429
+ // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
430
+ // let trackingLink = tracking?.trackingUrl
439
431
  app.plugStatus = paste.status;
440
432
  app.plugContent = paste.content;
441
433
  app.plugType = flash_app_1.PlugType.PASTEBIN;
442
434
  app.plugId = paste.paste_id;
443
- app.plugAccountId = parseInt(paste.accountId);
444
- app.keitaroData.redirectDomainName = redirectDomain || "none";
445
- app.keitaroData.redirectDomainId = redirectDomainId || 0;
446
- app.keitaroData.redirectCampaignId = redirectCampaignId || 0;
447
- app.keitaroData.redirectCampaignName = redirectCampaignName || "none";
448
- app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none";
449
- app.keitaroData.trackingDomainId = owDomainId || 0;
450
- app.keitaroData.trackingDomainName = owDomain || "none";
451
- app.keitaroData.trackingCampaignId = owCampaignId || 0;
452
- app.keitaroData.trackingCampaignName = owCampaignName || "none";
453
- app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none";
454
- if (clickIdParameterName)
455
- app.keitaroData.clickIdParameterName = clickIdParameterName;
456
- if (offerIdParameterName)
457
- app.keitaroData.offerIdParameterName = offerIdParameterName;
458
- if (trackingLink)
459
- app.trackingUrl = trackingLink;
460
- if (!owCampaignName?.includes(app.bundle) && ow) {
461
- console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`);
462
- }
463
- if (!redirectCampaignName?.includes(app.bundle) && redirect) {
464
- console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`);
465
- }
435
+ app.reservePlugType =
436
+ app.plugAccountId = parseInt(paste.accountId);
437
+ // app.keitaroData.redirectDomainName = redirectDomain || "none"
438
+ // app.keitaroData.redirectDomainId = redirectDomainId || 0
439
+ // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
440
+ // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
441
+ // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
442
+ // app.keitaroData.trackingDomainId = owDomainId || 0
443
+ // app.keitaroData.trackingDomainName = owDomain || "none"
444
+ // app.keitaroData.trackingCampaignId = owCampaignId || 0
445
+ // app.keitaroData.trackingCampaignName = owCampaignName || "none"
446
+ // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
447
+ // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
448
+ // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
449
+ // if (trackingLink) app.trackingUrl = trackingLink
450
+ // if (!owCampaignName?.includes(app.bundle) && ow) {
451
+ // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
452
+ // }
453
+ // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
454
+ // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
455
+ // }
466
456
  result.push(app);
467
457
  console.log("--------------------");
468
458
  }
@@ -478,4 +468,4 @@ let gatherInfoForFlashApps = async () => {
478
468
  // changeSourceForFA()
479
469
  // addGeosToAllRedirectCampaigns("BE")
480
470
  // removeGeosFromAllRedirectCampaigns("BE`")
481
- // gatherInfoForFlashApps()
471
+ gatherInfoForFlashApps();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.81",
3
+ "version": "1.2.85",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -104,7 +104,7 @@ export const FlashAppSchema = new Schema({
104
104
  },
105
105
  plugStatus: {
106
106
  type: String,
107
- enum: PlugType,
107
+ enum: FlashAppPlugStatus,
108
108
  default: FlashAppPlugStatus.DISABLED,
109
109
  required: false
110
110
  },
@@ -116,8 +116,8 @@ export const FlashAppSchema = new Schema({
116
116
  },
117
117
  reservePlugType: {
118
118
  type: String,
119
- enum: PlugType,
120
- default: PlugType.GIST,
119
+ enum: FlashAppPlugStatus,
120
+ default: FlashAppPlugStatus.DISABLED,
121
121
  required: false
122
122
  },
123
123
  reservePlugContent: {
@@ -126,7 +126,7 @@ export const FlashAppSchema = new Schema({
126
126
  },
127
127
  reservePlugStatus: {
128
128
  type: String,
129
- enum: PlugType,
129
+ enum: FlashAppPlugStatus,
130
130
  default: FlashAppPlugStatus.DISABLED,
131
131
  required: false
132
132
  },
@@ -269,24 +269,15 @@ export async function updateSchemaAndMoveValue(model: Model<IFlashApp>): Promise
269
269
  // employee_addr: "$$REMOVE"
270
270
  // },
271
271
  $set: {
272
- "plugAccountId": 1,
273
- "reservePlugAccountId": 1,
274
- "plugId": "none",
275
- "plugContent": "none",
276
- "keitaroData.domainId": "$$REMOVE",
277
- "keitaroData.domainName": "$$REMOVE",
278
- "plugUrl": "$$REMOVE",
279
- "reservePlugUrl": "$$REMOVE",
272
+ "plugStatus": "$$REMOVE",
273
+ "reservePlugStatus": "$$REMOVE",
280
274
  }
281
275
  }
282
276
  ]
283
277
 
284
278
  let aggregation = model.aggregate(pipelineStage)
285
- try { await model.collection.dropIndex("keitaroData.domainId") } catch(e) {}
286
- try { await model.collection.dropIndex("keitaroData.domainName") } catch(e) {}
287
-
288
- try { await model.collection.dropIndex("plugUrl") } catch(e) {}
289
- try { await model.collection.dropIndex("reservePlugUrl") } catch(e) {}
279
+ try { await model.collection.dropIndex("plugStatus") } catch(e) {}
280
+ try { await model.collection.dropIndex("reservePlugStatus") } catch(e) {}
290
281
 
291
282
  // await model.schema.dropIndex("generationOptions.keyPassword_1")
292
283
  await aggregation.exec()
@@ -401,9 +401,9 @@ let gatherInfoForFlashApps = async () => {
401
401
  let result = []
402
402
  for (let [id, paste] of Object.entries(pasteMap)) {
403
403
  console.log(`- #${id}`)
404
- let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
405
- let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
406
- let tracking = trackingMap[id as keyof object]
404
+ // let ow = owCampaigns[id as keyof object] as IKeitaroCampaign | undefined
405
+ // let redirect = redirectCampaigns[id as keyof object] as IKeitaroCampaign | undefined
406
+ // let tracking = trackingMap[id as keyof object]
407
407
  let app = flashApps[id as keyof object]
408
408
 
409
409
  if (!app) {
@@ -411,70 +411,71 @@ let gatherInfoForFlashApps = async () => {
411
411
  continue
412
412
  }
413
413
 
414
- if (paste.status == FlashAppPlugStatus.ENABLED) {
415
- if (!ow) console.log(`#${id}: no OW`)
416
-
417
- if (!redirect) console.log(`No redirect for #${id}`)
418
- else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
419
- else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
420
- }
421
-
422
- let appId
423
- for (let parameter of Object.values(redirect?.parameters || {})) {
424
- if (parameter.name == "appId") {
425
- appId = parameter.placeholder
426
- }
427
- }
428
- if (!appId && ow) console.log(`No app id for #${id}`)
429
- else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
430
-
431
- let owDomain = ow?.domain?.split("/")[2]
432
- let owDomainId = ow?.domain_id
433
- let owCampaignId = ow?.id
434
- let owCampaignName = ow?.name
435
- let owCampaignAlias = ow?.alias
436
- let redirectDomain = redirect?.domain?.split("/")[2]
437
- let redirectDomainId = redirect?.domain_id
438
- let redirectCampaignId = redirect?.id
439
- let redirectCampaignName = redirect?.name
440
- let redirectCampaignAlias = redirect?.alias
441
-
442
- let clickIdParameterName = ow?.parameters?.sub_id_8?.name
443
- let offerIdParameterName = ow?.parameters?.sub_id_15?.name
444
- if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
445
- if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
446
-
447
- let trackingLink = tracking?.trackingUrl
414
+ // if (paste.status == FlashAppPlugStatus.ENABLED) {
415
+ // if (!ow) console.log(`#${id}: no OW`)
416
+
417
+ // if (!redirect) console.log(`No redirect for #${id}`)
418
+ // else if (!paste.content.includes(redirect.domain)) console.log(`#${id}: Redirect domain (${redirect.domain}) differs from paste domain (${paste.content})`)
419
+ // else if (!paste.content.includes(redirect.alias)) console.log(`#${id}: Redirect campaign alias (${redirect.alias}) differs from paste id (${paste.content})`)
420
+ // }
421
+
422
+ // let appId
423
+ // for (let parameter of Object.values(redirect?.parameters || {})) {
424
+ // if (parameter.name == "appId") {
425
+ // appId = parameter.placeholder
426
+ // }
427
+ // }
428
+ // if (!appId && ow) console.log(`No app id for #${id}`)
429
+ // else if (appId != id && ow) console.log(`Wrong app id (${appId}) for #${id}`)
430
+
431
+ // let owDomain = ow?.domain?.split("/")[2]
432
+ // let owDomainId = ow?.domain_id
433
+ // let owCampaignId = ow?.id
434
+ // let owCampaignName = ow?.name
435
+ // let owCampaignAlias = ow?.alias
436
+ // let redirectDomain = redirect?.domain?.split("/")[2]
437
+ // let redirectDomainId = redirect?.domain_id
438
+ // let redirectCampaignId = redirect?.id
439
+ // let redirectCampaignName = redirect?.name
440
+ // let redirectCampaignAlias = redirect?.alias
441
+
442
+ // let clickIdParameterName = ow?.parameters?.sub_id_8?.name
443
+ // let offerIdParameterName = ow?.parameters?.sub_id_15?.name
444
+ // if (!clickIdParameterName && app && ow) console.log(`No click id parameter for #${id}`)
445
+ // if (!offerIdParameterName && app && ow) console.log(`No offer id parameter for #${id}`)
446
+
447
+ // let trackingLink = tracking?.trackingUrl
448
448
 
449
449
  app.plugStatus = paste.status
450
450
  app.plugContent = paste.content
451
451
  app.plugType = PlugType.PASTEBIN
452
452
  app.plugId = paste.paste_id
453
+ app.reservePlugType =
453
454
  app.plugAccountId = parseInt(paste.accountId)
454
455
 
455
- app.keitaroData.redirectDomainName = redirectDomain || "none"
456
- app.keitaroData.redirectDomainId = redirectDomainId || 0
457
- app.keitaroData.redirectCampaignId = redirectCampaignId || 0
458
- app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
459
- app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
460
- app.keitaroData.trackingDomainId = owDomainId || 0
461
- app.keitaroData.trackingDomainName = owDomain || "none"
462
- app.keitaroData.trackingCampaignId = owCampaignId || 0
463
- app.keitaroData.trackingCampaignName = owCampaignName || "none"
464
- app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
456
+ // app.keitaroData.redirectDomainName = redirectDomain || "none"
457
+ // app.keitaroData.redirectDomainId = redirectDomainId || 0
458
+ // app.keitaroData.redirectCampaignId = redirectCampaignId || 0
459
+ // app.keitaroData.redirectCampaignName = redirectCampaignName || "none"
460
+ // app.keitaroData.redirectCampaignAlias = redirectCampaignAlias || "none"
461
+ // app.keitaroData.trackingDomainId = owDomainId || 0
462
+ // app.keitaroData.trackingDomainName = owDomain || "none"
463
+ // app.keitaroData.trackingCampaignId = owCampaignId || 0
464
+ // app.keitaroData.trackingCampaignName = owCampaignName || "none"
465
+ // app.keitaroData.trackingCampaignAlias = owCampaignAlias || "none"
465
466
 
466
- if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
467
- if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
467
+ // if (clickIdParameterName) app.keitaroData.clickIdParameterName = clickIdParameterName
468
+ // if (offerIdParameterName) app.keitaroData.offerIdParameterName = offerIdParameterName
468
469
 
469
- if (trackingLink) app.trackingUrl = trackingLink
470
+ // if (trackingLink) app.trackingUrl = trackingLink
470
471
 
471
- if (!owCampaignName?.includes(app.bundle) && ow) {
472
- console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
473
- }
472
+ // if (!owCampaignName?.includes(app.bundle) && ow) {
473
+ // console.log(`OW: bundle differs (${app.bundle} in DB and ${owCampaignName})`)
474
+ // }
474
475
 
475
- if (!redirectCampaignName?.includes(app.bundle) && redirect) {
476
- console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
477
- }
476
+ // if (!redirectCampaignName?.includes(app.bundle) && redirect) {
477
+ // console.log(`Redirect: bundle differs (${app.bundle} in DB and ${redirectCampaignName})`)
478
+ // }
478
479
 
479
480
  result.push(app)
480
481
 
@@ -497,4 +498,4 @@ let gatherInfoForFlashApps = async () => {
497
498
  // addGeosToAllRedirectCampaigns("BE")
498
499
  // removeGeosFromAllRedirectCampaigns("BE`")
499
500
 
500
- // gatherInfoForFlashApps()
501
+ gatherInfoForFlashApps()