@bprotsyk/aso-core 2.1.43 → 2.1.45

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.
@@ -71,17 +71,22 @@ async function createStreamForMatchingCampaigns(streamPayloads, campaignRegExp,
71
71
  // Process each stream payload
72
72
  for (const { payload, offerId } of streamPayloads) {
73
73
  const identicalStream = streams.find(stream => stream.name.includes(offerId));
74
- if (identicalStream) {
75
- await http_1.default.put(`streams/${identicalStream.id}`, {
76
- campaign_id: matchingCampaign.id,
77
- ...payload
78
- });
74
+ try {
75
+ if (identicalStream) {
76
+ await http_1.default.put(`streams/${identicalStream.id}`, {
77
+ campaign_id: matchingCampaign.id,
78
+ ...payload
79
+ });
80
+ }
81
+ else {
82
+ await http_1.default.post('streams', {
83
+ campaign_id: matchingCampaign.id,
84
+ ...payload
85
+ });
86
+ }
79
87
  }
80
- else {
81
- await http_1.default.post('streams', {
82
- campaign_id: matchingCampaign.id,
83
- ...payload
84
- });
88
+ catch (error) {
89
+ console.error(`Error updating stream ${offerId} (${payload.name}) in campaign ${matchingCampaign.id} (${matchingCampaign.name}):`, error);
85
90
  }
86
91
  }
87
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.1.43",
3
+ "version": "2.1.45",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -94,16 +94,20 @@ async function createStreamForMatchingCampaigns(streamPayloads: { payload: any,
94
94
  for (const { payload, offerId } of streamPayloads) {
95
95
  const identicalStream = streams.find(stream => stream.name.includes(offerId));
96
96
 
97
- if (identicalStream) {
98
- await keitaroApi.put(`streams/${identicalStream.id}`, {
99
- campaign_id: matchingCampaign.id,
100
- ...payload
101
- });
102
- } else {
103
- await keitaroApi.post('streams', {
104
- campaign_id: matchingCampaign.id,
105
- ...payload
106
- });
97
+ try {
98
+ if (identicalStream) {
99
+ await keitaroApi.put(`streams/${identicalStream.id}`, {
100
+ campaign_id: matchingCampaign.id,
101
+ ...payload
102
+ });
103
+ } else {
104
+ await keitaroApi.post('streams', {
105
+ campaign_id: matchingCampaign.id,
106
+ ...payload
107
+ });
108
+ }
109
+ } catch (error) {
110
+ console.error(`Error updating stream ${offerId} (${payload.name}) in campaign ${matchingCampaign.id} (${matchingCampaign.name}):`, error);
107
111
  }
108
112
  }
109
113
  }