agrs-sequelize-sdk 1.4.16 → 1.4.18

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.
Files changed (84) hide show
  1. package/migrations/2026-05-17-PIXELS-FOLLOWUP.md +85 -0
  2. package/migrations/2026-05-17-add-platform-to-ad.js +19 -0
  3. package/migrations/2026-05-17-add-platform-to-adaccount.js +19 -0
  4. package/migrations/2026-05-17-add-platform-to-adperformance.js +19 -0
  5. package/migrations/2026-05-17-add-platform-to-adset.js +19 -0
  6. package/migrations/2026-05-17-add-platform-to-adsetperformance.js +19 -0
  7. package/migrations/2026-05-17-add-platform-to-aiarticleretryqueue.js +19 -0
  8. package/migrations/2026-05-17-add-platform-to-aicampaignqueue.js +19 -0
  9. package/migrations/2026-05-17-add-platform-to-article.js +19 -0
  10. package/migrations/2026-05-17-add-platform-to-campaign.js +19 -0
  11. package/migrations/2026-05-17-add-platform-to-codefuelcampaign.js +19 -0
  12. package/migrations/2026-05-17-add-platform-to-dynamicfeed.js +19 -0
  13. package/migrations/2026-05-17-add-platform-to-facebookretryqueue.js +19 -0
  14. package/migrations/2026-05-17-add-platform-to-pages.js +19 -0
  15. package/migrations/2026-05-17-add-platform-to-presets.js +19 -0
  16. package/migrations/RUN_ME_MANUALLY_2026-05-17.sql +99 -0
  17. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  18. package/migrations/change-adset-name-to-text.js +79 -79
  19. package/models/AICampaignQueue.js +143 -136
  20. package/models/AIGenerationLog.js +85 -85
  21. package/models/AIGenerationRequest.js +212 -212
  22. package/models/Ad.js +6 -0
  23. package/models/AdAccount.js +6 -0
  24. package/models/AdAccountValues.js +25 -25
  25. package/models/AdHistory.js +30 -30
  26. package/models/AdPerformance.js +100 -94
  27. package/models/AdSet.js +295 -289
  28. package/models/AdSetHistory.js +30 -30
  29. package/models/AdsetPerformance.js +132 -126
  30. package/models/AiArticleRetryQueue.js +157 -150
  31. package/models/AiCreationRetryQueue.js +127 -127
  32. package/models/Article.js +212 -206
  33. package/models/AutomationRule.js +173 -173
  34. package/models/BannerTemplate.js +129 -129
  35. package/models/Buyers.js +25 -25
  36. package/models/Campaign.js +163 -157
  37. package/models/CampaignActionHistory.js +86 -86
  38. package/models/CampaignCreationLog.js +309 -309
  39. package/models/CampaignCreationLogV2.js +314 -314
  40. package/models/CampaignHistory.js +33 -33
  41. package/models/Channel.js +55 -55
  42. package/models/CodefuelCampaign.js +6 -0
  43. package/models/Domain.js +39 -47
  44. package/models/DynamicFeed.js +218 -212
  45. package/models/ExplorAdsChannel.js +61 -61
  46. package/models/FacebookRetryQueue.js +163 -156
  47. package/models/Feed.js +33 -33
  48. package/models/FeedArticleConfiguration.js +80 -80
  49. package/models/FrontStoryChannel.js +59 -59
  50. package/models/FrontStoryChannelV2.js +60 -60
  51. package/models/GenericFlowRequest.js +114 -114
  52. package/models/MidoWebChannel.js +47 -47
  53. package/models/MineChannel.js +42 -42
  54. package/models/Pages.js +105 -99
  55. package/models/PipelineExecution.js +59 -59
  56. package/models/PolicyDogsCreativeCache.js +50 -50
  57. package/models/PolicyDogsImageCache.js +30 -30
  58. package/models/Presets.js +40 -34
  59. package/models/RSOCFeedCampaign.js +375 -375
  60. package/models/RsocKeywordPerformance.js +110 -110
  61. package/models/RuleAction.js +90 -90
  62. package/models/RuleCondition.js +137 -137
  63. package/models/RuleExecution.js +107 -107
  64. package/models/RulesValues.js +56 -56
  65. package/models/SupportedLocale.js +23 -23
  66. package/models/SyncHistory.js +249 -249
  67. package/models/TTQChannel.js +42 -42
  68. package/models/TemplateMetadata.js +260 -260
  69. package/models/Tier2_AdAccounts.js +110 -110
  70. package/models/Tier2_Assets.js +70 -70
  71. package/models/Tier2_BusinessManagers.js +105 -105
  72. package/models/Tier2_CreditLines.js +99 -99
  73. package/models/Tier2_Pages.js +91 -91
  74. package/models/Tier2_Pixels.js +82 -82
  75. package/models/Tier2_Tokens.js +64 -64
  76. package/models/Tier2_UserAdAccounts.js +83 -83
  77. package/models/TokenRotationState.js +121 -121
  78. package/models/TonicRSOCKeywordPerformance.js +122 -122
  79. package/models/Users.js +148 -148
  80. package/models/Vertical.js +25 -25
  81. package/models/newFiles.js +137 -137
  82. package/package.json +19 -21
  83. package/run.sh +214 -214
  84. package/services/sequelizeService.js +110 -110
@@ -1,213 +1,219 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const DynamicFeed = sequelize.define(
3
- "DynamicFeed",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- primaryKey: true,
8
- defaultValue: DataTypes.UUIDV4,
9
- },
10
- // Feed Details
11
- feed_type: {
12
- type: DataTypes.ENUM('N2S', 'Type-In', 'AFD', 'RSOC'),
13
- allowNull: true,
14
- },
15
- feed: {
16
- type: DataTypes.ENUM('Direct', 'Partner', '3rd Party'),
17
- allowNull: true,
18
- },
19
- feed_name: {
20
- type: DataTypes.STRING,
21
- allowNull: false,
22
- },
23
- feed_short_name: {
24
- type: DataTypes.STRING,
25
- allowNull: true,
26
- },
27
- feed_logo: {
28
- type: DataTypes.TEXT,
29
- allowNull: true,
30
- },
31
- organization: {
32
- type: DataTypes.STRING,
33
- allowNull: true,
34
- },
35
- traffic_source: {
36
- type: DataTypes.STRING,
37
- allowNull: true,
38
- },
39
-
40
- // Targeting Rules
41
- accepted_devices: {
42
- type: DataTypes.JSONB,
43
- allowNull: true,
44
- },
45
- search_engine: {
46
- type: DataTypes.JSONB,
47
- allowNull: true,
48
- },
49
- country: {
50
- type: DataTypes.STRING,
51
- allowNull: true,
52
- },
53
- country_groups: {
54
- type: DataTypes.JSONB,
55
- allowNull: true,
56
- },
57
-
58
- // Tracking & URL Parameters
59
- default_pixel: {
60
- type: DataTypes.ARRAY(DataTypes.STRING),
61
- allowNull: true,
62
- defaultValue: [],
63
- },
64
- default_pixel_event: {
65
- type: DataTypes.ARRAY(DataTypes.STRING),
66
- allowNull: true,
67
- defaultValue: [],
68
- },
69
- base_url: {
70
- type: DataTypes.STRING(500),
71
- allowNull: true,
72
- },
73
- display_url: {
74
- type: DataTypes.STRING(500),
75
- allowNull: true,
76
- },
77
- path_url_structure: {
78
- type: DataTypes.STRING(500),
79
- allowNull: true,
80
- },
81
- reporting_parameter: {
82
- type: DataTypes.STRING(100),
83
- allowNull: true,
84
- },
85
- keyword_parameter: {
86
- type: DataTypes.STRING(100),
87
- allowNull: true,
88
- },
89
- special_static_params: {
90
- type: DataTypes.TEXT,
91
- allowNull: true,
92
- },
93
-
94
- // Facebook Settings
95
- optimization_goal: {
96
- type: DataTypes.STRING,
97
- allowNull: true,
98
- },
99
- bid_strategy: {
100
- type: DataTypes.STRING,
101
- allowNull: true,
102
- },
103
-
104
- // Feed Provider Settings
105
- feed_provider: {
106
- type: DataTypes.STRING,
107
- allowNull: true,
108
- },
109
- reporting_frequency: {
110
- type: DataTypes.STRING,
111
- allowNull: true,
112
- },
113
- feed_username: {
114
- type: DataTypes.STRING,
115
- allowNull: true,
116
- },
117
- feed_password: {
118
- type: DataTypes.STRING,
119
- allowNull: true,
120
- },
121
- access_token: {
122
- type: DataTypes.TEXT,
123
- allowNull: true,
124
- },
125
- api_base_url: {
126
- type: DataTypes.STRING,
127
- allowNull: true,
128
- },
129
- token_expires_at: {
130
- type: DataTypes.DATE,
131
- allowNull: true,
132
- },
133
-
134
- // Reporting Configuration
135
- revenue_source: {
136
- type: DataTypes.STRING,
137
- allowNull: true,
138
- },
139
- reporting_granularity: {
140
- type: DataTypes.STRING,
141
- allowNull: true,
142
- },
143
- reporting_group_by: {
144
- type: DataTypes.STRING,
145
- allowNull: true,
146
- },
147
- reporting_metrics_map: {
148
- type: DataTypes.JSONB,
149
- allowNull: true,
150
- },
151
- reporting_channel_field: {
152
- type: DataTypes.STRING,
153
- allowNull: true,
154
- },
155
-
156
- // Generated URLs
157
- generated_url: {
158
- type: DataTypes.STRING,
159
- allowNull: true,
160
- },
161
- token: {
162
- type: DataTypes.STRING,
163
- allowNull: true,
164
- unique: true,
165
- },
166
-
167
- // Status
168
- is_active: {
169
- type: DataTypes.BOOLEAN,
170
- defaultValue: true,
171
- allowNull: true,
172
- },
173
- is_dynamic_feed: {
174
- type: DataTypes.BOOLEAN,
175
- defaultValue: true,
176
- allowNull: true,
177
- },
178
- },
179
- {
180
- tableName: "dynamic_feeds",
181
- timestamps: true,
182
- indexes: [
183
- {
184
- fields: ["token"],
185
- },
186
- {
187
- fields: ["generated_url"],
188
- },
189
- {
190
- fields: ["is_active"],
191
- },
192
- {
193
- fields: ["feed_type"],
194
- },
195
- {
196
- fields: ["country"],
197
- },
198
- {
199
- fields: ["feed_provider"],
200
- },
201
- {
202
- fields: ["is_dynamic_feed"],
203
- },
204
- ],
205
- }
206
- );
207
-
208
- DynamicFeed.associate = (models) => {
209
- // Add associations here when needed
210
- };
211
-
212
- return DynamicFeed;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const DynamicFeed = sequelize.define(
3
+ "DynamicFeed",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ primaryKey: true,
8
+ defaultValue: DataTypes.UUIDV4,
9
+ },
10
+ // Feed Details
11
+ feed_type: {
12
+ type: DataTypes.ENUM('N2S', 'Type-In', 'AFD', 'RSOC'),
13
+ allowNull: true,
14
+ },
15
+ feed: {
16
+ type: DataTypes.ENUM('Direct', 'Partner', '3rd Party'),
17
+ allowNull: true,
18
+ },
19
+ feed_name: {
20
+ type: DataTypes.STRING,
21
+ allowNull: false,
22
+ },
23
+ feed_short_name: {
24
+ type: DataTypes.STRING,
25
+ allowNull: true,
26
+ },
27
+ feed_logo: {
28
+ type: DataTypes.TEXT,
29
+ allowNull: true,
30
+ },
31
+ organization: {
32
+ type: DataTypes.STRING,
33
+ allowNull: true,
34
+ },
35
+ traffic_source: {
36
+ type: DataTypes.STRING,
37
+ allowNull: true,
38
+ },
39
+
40
+ // Targeting Rules
41
+ accepted_devices: {
42
+ type: DataTypes.JSONB,
43
+ allowNull: true,
44
+ },
45
+ search_engine: {
46
+ type: DataTypes.JSONB,
47
+ allowNull: true,
48
+ },
49
+ country: {
50
+ type: DataTypes.STRING,
51
+ allowNull: true,
52
+ },
53
+ country_groups: {
54
+ type: DataTypes.JSONB,
55
+ allowNull: true,
56
+ },
57
+
58
+ // Tracking & URL Parameters
59
+ default_pixel: {
60
+ type: DataTypes.ARRAY(DataTypes.STRING),
61
+ allowNull: true,
62
+ defaultValue: [],
63
+ },
64
+ default_pixel_event: {
65
+ type: DataTypes.ARRAY(DataTypes.STRING),
66
+ allowNull: true,
67
+ defaultValue: [],
68
+ },
69
+ base_url: {
70
+ type: DataTypes.STRING(500),
71
+ allowNull: true,
72
+ },
73
+ display_url: {
74
+ type: DataTypes.STRING(500),
75
+ allowNull: true,
76
+ },
77
+ path_url_structure: {
78
+ type: DataTypes.STRING(500),
79
+ allowNull: true,
80
+ },
81
+ reporting_parameter: {
82
+ type: DataTypes.STRING(100),
83
+ allowNull: true,
84
+ },
85
+ keyword_parameter: {
86
+ type: DataTypes.STRING(100),
87
+ allowNull: true,
88
+ },
89
+ special_static_params: {
90
+ type: DataTypes.TEXT,
91
+ allowNull: true,
92
+ },
93
+
94
+ // Facebook Settings
95
+ optimization_goal: {
96
+ type: DataTypes.STRING,
97
+ allowNull: true,
98
+ },
99
+ bid_strategy: {
100
+ type: DataTypes.STRING,
101
+ allowNull: true,
102
+ },
103
+
104
+ // Feed Provider Settings
105
+ feed_provider: {
106
+ type: DataTypes.STRING,
107
+ allowNull: true,
108
+ },
109
+ reporting_frequency: {
110
+ type: DataTypes.STRING,
111
+ allowNull: true,
112
+ },
113
+ feed_username: {
114
+ type: DataTypes.STRING,
115
+ allowNull: true,
116
+ },
117
+ feed_password: {
118
+ type: DataTypes.STRING,
119
+ allowNull: true,
120
+ },
121
+ access_token: {
122
+ type: DataTypes.TEXT,
123
+ allowNull: true,
124
+ },
125
+ api_base_url: {
126
+ type: DataTypes.STRING,
127
+ allowNull: true,
128
+ },
129
+ token_expires_at: {
130
+ type: DataTypes.DATE,
131
+ allowNull: true,
132
+ },
133
+
134
+ // Reporting Configuration
135
+ revenue_source: {
136
+ type: DataTypes.STRING,
137
+ allowNull: true,
138
+ },
139
+ reporting_granularity: {
140
+ type: DataTypes.STRING,
141
+ allowNull: true,
142
+ },
143
+ reporting_group_by: {
144
+ type: DataTypes.STRING,
145
+ allowNull: true,
146
+ },
147
+ reporting_metrics_map: {
148
+ type: DataTypes.JSONB,
149
+ allowNull: true,
150
+ },
151
+ reporting_channel_field: {
152
+ type: DataTypes.STRING,
153
+ allowNull: true,
154
+ },
155
+
156
+ // Generated URLs
157
+ generated_url: {
158
+ type: DataTypes.STRING,
159
+ allowNull: true,
160
+ },
161
+ token: {
162
+ type: DataTypes.STRING,
163
+ allowNull: true,
164
+ unique: true,
165
+ },
166
+
167
+ // Status
168
+ is_active: {
169
+ type: DataTypes.BOOLEAN,
170
+ defaultValue: true,
171
+ allowNull: true,
172
+ },
173
+ is_dynamic_feed: {
174
+ type: DataTypes.BOOLEAN,
175
+ defaultValue: true,
176
+ allowNull: true,
177
+ },
178
+ platform: {
179
+ type: DataTypes.ENUM("fb", "tt", "snp"),
180
+ allowNull: false,
181
+ defaultValue: "fb",
182
+ comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
183
+ },
184
+ },
185
+ {
186
+ tableName: "dynamic_feeds",
187
+ timestamps: true,
188
+ indexes: [
189
+ {
190
+ fields: ["token"],
191
+ },
192
+ {
193
+ fields: ["generated_url"],
194
+ },
195
+ {
196
+ fields: ["is_active"],
197
+ },
198
+ {
199
+ fields: ["feed_type"],
200
+ },
201
+ {
202
+ fields: ["country"],
203
+ },
204
+ {
205
+ fields: ["feed_provider"],
206
+ },
207
+ {
208
+ fields: ["is_dynamic_feed"],
209
+ },
210
+ ],
211
+ }
212
+ );
213
+
214
+ DynamicFeed.associate = (models) => {
215
+ // Add associations here when needed
216
+ };
217
+
218
+ return DynamicFeed;
213
219
  };
@@ -1,62 +1,62 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const ExplorAdsChannel = sequelize.define(
3
- "ExplorAdsChannel",
4
- {
5
- channelId: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- validate: {
9
- // Validate channel format (br_vt_ch1401 to br_vt_ch1500)
10
- is: /^br_vt_ch(14[0-9][0-9]|1500)$/
11
- }
12
- },
13
- status: {
14
- type: DataTypes.STRING,
15
- allowNull: false,
16
- defaultValue: "free",
17
- validate: {
18
- isIn: [["free", "used", "archived"]],
19
- },
20
- },
21
- domain: {
22
- type: DataTypes.STRING,
23
- allowNull: false,
24
- defaultValue: "nexoreach.com"
25
- },
26
- connectedCampaigns: {
27
- type: DataTypes.JSONB,
28
- allowNull: false,
29
- defaultValue: [],
30
- },
31
- lastUsed: {
32
- type: DataTypes.DATE,
33
- allowNull: true
34
- }
35
- },
36
- {
37
- tableName: "explorads_channels",
38
- timestamps: true,
39
- indexes: [
40
- {
41
- unique: true,
42
- fields: ["channelId"],
43
- name: "unique_explorads_channel"
44
- },
45
- ],
46
- }
47
- );
48
-
49
- // Define associations
50
- ExplorAdsChannel.associate = (models) => {
51
- if (models.RSOCFeedCampaign) {
52
- ExplorAdsChannel.hasMany(models.RSOCFeedCampaign, {
53
- foreignKey: "channelId",
54
- sourceKey: "channelId",
55
- as: "RSOCFeedCampaigns",
56
- constraints: false, // Disable FK constraint
57
- });
58
- }
59
- };
60
-
61
- return ExplorAdsChannel;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const ExplorAdsChannel = sequelize.define(
3
+ "ExplorAdsChannel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ validate: {
9
+ // Validate channel format (br_vt_ch1401 to br_vt_ch1500)
10
+ is: /^br_vt_ch(14[0-9][0-9]|1500)$/
11
+ }
12
+ },
13
+ status: {
14
+ type: DataTypes.STRING,
15
+ allowNull: false,
16
+ defaultValue: "free",
17
+ validate: {
18
+ isIn: [["free", "used", "archived"]],
19
+ },
20
+ },
21
+ domain: {
22
+ type: DataTypes.STRING,
23
+ allowNull: false,
24
+ defaultValue: "nexoreach.com"
25
+ },
26
+ connectedCampaigns: {
27
+ type: DataTypes.JSONB,
28
+ allowNull: false,
29
+ defaultValue: [],
30
+ },
31
+ lastUsed: {
32
+ type: DataTypes.DATE,
33
+ allowNull: true
34
+ }
35
+ },
36
+ {
37
+ tableName: "explorads_channels",
38
+ timestamps: true,
39
+ indexes: [
40
+ {
41
+ unique: true,
42
+ fields: ["channelId"],
43
+ name: "unique_explorads_channel"
44
+ },
45
+ ],
46
+ }
47
+ );
48
+
49
+ // Define associations
50
+ ExplorAdsChannel.associate = (models) => {
51
+ if (models.RSOCFeedCampaign) {
52
+ ExplorAdsChannel.hasMany(models.RSOCFeedCampaign, {
53
+ foreignKey: "channelId",
54
+ sourceKey: "channelId",
55
+ as: "RSOCFeedCampaigns",
56
+ constraints: false, // Disable FK constraint
57
+ });
58
+ }
59
+ };
60
+
61
+ return ExplorAdsChannel;
62
62
  };