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,33 +1,33 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const CampaignHistory = sequelize.define(
3
- "CampaignHistory",
4
- {
5
- HistoryID: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- CampaignID: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- TableName: {
15
- type: DataTypes.STRING, // Useful for multi-table history tracking
16
- defaultValue: "Campaign",
17
- },
18
- DataSnapshot: {
19
- type: DataTypes.JSONB, // Store the entire row as JSON
20
- allowNull: false,
21
- },
22
- timestamp: {
23
- type: DataTypes.DATE,
24
- defaultValue: DataTypes.NOW,
25
- },
26
- },
27
- {
28
- tableName: "CampaignHistory",
29
- }
30
- );
31
-
32
- return CampaignHistory;
33
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const CampaignHistory = sequelize.define(
3
+ "CampaignHistory",
4
+ {
5
+ HistoryID: {
6
+ type: DataTypes.UUID,
7
+ defaultValue: DataTypes.UUIDV4,
8
+ primaryKey: true,
9
+ },
10
+ CampaignID: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ TableName: {
15
+ type: DataTypes.STRING, // Useful for multi-table history tracking
16
+ defaultValue: "Campaign",
17
+ },
18
+ DataSnapshot: {
19
+ type: DataTypes.JSONB, // Store the entire row as JSON
20
+ allowNull: false,
21
+ },
22
+ timestamp: {
23
+ type: DataTypes.DATE,
24
+ defaultValue: DataTypes.NOW,
25
+ },
26
+ },
27
+ {
28
+ tableName: "CampaignHistory",
29
+ }
30
+ );
31
+
32
+ return CampaignHistory;
33
+ };
package/models/Channel.js CHANGED
@@ -1,55 +1,55 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Channel = sequelize.define(
3
- "Channel",
4
- {
5
- channelId: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- // Not setting as primary key or unique since duplicates are allowed
9
- },
10
- styleId: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- status: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- defaultValue: "free",
18
- validate: {
19
- isIn: [["free", "used", "archived"]],
20
- },
21
- },
22
- connectedCampaigns: {
23
- type: DataTypes.JSONB, // Use JSONB for better querying capabilities
24
- allowNull: false,
25
- defaultValue: [],
26
- },
27
- },
28
- {
29
- tableName: "channels",
30
- timestamps: true,
31
- indexes: [
32
- // Add a composite unique index on channelId and styleId if needed
33
- {
34
- unique: true,
35
- fields: ["channelId", "styleId"],
36
- name: "unique_channel_style",
37
- },
38
- ],
39
- }
40
- );
41
-
42
- // Define associations without enforcing constraints
43
- Channel.associate = (models) => {
44
- if (models.RSOCFeedCampaign) {
45
- Channel.hasMany(models.RSOCFeedCampaign, {
46
- foreignKey: "channelId",
47
- sourceKey: "channelId",
48
- as: "RSOCFeedCampaigns",
49
- constraints: false, // Disable FK constraint
50
- });
51
- }
52
- };
53
-
54
- return Channel;
55
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Channel = sequelize.define(
3
+ "Channel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ // Not setting as primary key or unique since duplicates are allowed
9
+ },
10
+ styleId: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ status: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ defaultValue: "free",
18
+ validate: {
19
+ isIn: [["free", "used", "archived"]],
20
+ },
21
+ },
22
+ connectedCampaigns: {
23
+ type: DataTypes.JSONB, // Use JSONB for better querying capabilities
24
+ allowNull: false,
25
+ defaultValue: [],
26
+ },
27
+ },
28
+ {
29
+ tableName: "channels",
30
+ timestamps: true,
31
+ indexes: [
32
+ // Add a composite unique index on channelId and styleId if needed
33
+ {
34
+ unique: true,
35
+ fields: ["channelId", "styleId"],
36
+ name: "unique_channel_style",
37
+ },
38
+ ],
39
+ }
40
+ );
41
+
42
+ // Define associations without enforcing constraints
43
+ Channel.associate = (models) => {
44
+ if (models.RSOCFeedCampaign) {
45
+ Channel.hasMany(models.RSOCFeedCampaign, {
46
+ foreignKey: "channelId",
47
+ sourceKey: "channelId",
48
+ as: "RSOCFeedCampaigns",
49
+ constraints: false, // Disable FK constraint
50
+ });
51
+ }
52
+ };
53
+
54
+ return Channel;
55
+ };
@@ -100,6 +100,12 @@ module.exports = (sequelize, DataTypes) => {
100
100
  allowNull: true,
101
101
  defaultValue: false,
102
102
  },
103
+ platform: {
104
+ type: DataTypes.ENUM("fb", "tt", "snp"),
105
+ allowNull: false,
106
+ defaultValue: "fb",
107
+ comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
108
+ },
103
109
  });
104
110
  CodefuelCampaign.associate = (models) => {
105
111
  CodefuelCampaign.hasMany(models.Ad, {
package/models/Domain.js CHANGED
@@ -1,48 +1,40 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Domain = sequelize.define(
3
- "Domain",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- name: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- code: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- unique: true,
18
- },
19
- feedProvider: {
20
- type: DataTypes.ARRAY(DataTypes.STRING),
21
- allowNull: true,
22
- defaultValue: [],
23
- },
24
- isDefault: {
25
- type: DataTypes.BOOLEAN,
26
- allowNull: false,
27
- defaultValue: false,
28
- },
29
- weight: {
30
- type: DataTypes.STRING,
31
- allowNull: true,
32
- },
33
- weightTest: {
34
- type: DataTypes.STRING,
35
- allowNull: true,
36
- },
37
- weightTest2: {
38
- type: DataTypes.STRING,
39
- allowNull: true,
40
- },
41
- },
42
- {
43
- tableName: "Domain",
44
- }
45
- );
46
-
47
- return Domain;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Domain = sequelize.define(
3
+ "Domain",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ defaultValue: DataTypes.UUIDV4,
8
+ primaryKey: true,
9
+ },
10
+ name: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ code: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ unique: true,
18
+ },
19
+ feedProvider: {
20
+ type: DataTypes.ARRAY(DataTypes.STRING),
21
+ allowNull: true,
22
+ defaultValue: [],
23
+ },
24
+ isDefault: {
25
+ type: DataTypes.BOOLEAN,
26
+ allowNull: false,
27
+ defaultValue: false,
28
+ },
29
+ weight: {
30
+ type: DataTypes.STRING,
31
+ allowNull: true,
32
+ },
33
+ },
34
+ {
35
+ tableName: "Domain",
36
+ }
37
+ );
38
+
39
+ return Domain;
48
40
  };