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,107 +1,107 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const RuleExecution = sequelize.define(
5
- "RuleExecution",
6
- {
7
- id: {
8
- type: DataTypes.UUID,
9
- defaultValue: DataTypes.UUIDV4,
10
- primaryKey: true,
11
- },
12
- ruleId: {
13
- type: DataTypes.UUID,
14
- allowNull: false,
15
- references: {
16
- model: "AutomationRule",
17
- key: "id",
18
- },
19
- comment: "Reference to the executed rule",
20
- },
21
- executionType: {
22
- type: DataTypes.ENUM("SCHEDULED", "MANUAL", "API_TRIGGER"),
23
- allowNull: false,
24
- comment: "How the rule was triggered",
25
- },
26
- status: {
27
- type: DataTypes.ENUM("RUNNING", "SUCCESS", "FAILED", "PARTIAL_SUCCESS"),
28
- allowNull: false,
29
- comment: "Execution status",
30
- },
31
- startTime: {
32
- type: DataTypes.DATE,
33
- allowNull: false,
34
- comment: "When execution started",
35
- },
36
- endTime: {
37
- type: DataTypes.DATE,
38
- allowNull: true,
39
- comment: "When execution completed",
40
- },
41
- duration: {
42
- type: DataTypes.INTEGER,
43
- allowNull: true,
44
- comment: "Execution duration in milliseconds",
45
- },
46
- itemsEvaluated: {
47
- type: DataTypes.INTEGER,
48
- defaultValue: 0,
49
- allowNull: false,
50
- comment: "Number of items (campaigns/adsets/ads) evaluated",
51
- },
52
- itemsMatched: {
53
- type: DataTypes.INTEGER,
54
- defaultValue: 0,
55
- allowNull: false,
56
- comment: "Number of items that matched the conditions",
57
- },
58
- actionsExecuted: {
59
- type: DataTypes.INTEGER,
60
- defaultValue: 0,
61
- allowNull: false,
62
- comment: "Number of actions successfully executed",
63
- },
64
- actionsFailed: {
65
- type: DataTypes.INTEGER,
66
- defaultValue: 0,
67
- allowNull: false,
68
- comment: "Number of actions that failed",
69
- },
70
- errorMessage: {
71
- type: DataTypes.TEXT,
72
- allowNull: true,
73
- comment: "Error message if execution failed",
74
- },
75
- executionDetails: {
76
- type: DataTypes.JSONB,
77
- allowNull: true,
78
- comment: "Detailed execution results and logs",
79
- },
80
- matchedItems: {
81
- type: DataTypes.JSONB,
82
- allowNull: true,
83
- comment: "List of items that matched the rule conditions and had actions applied",
84
- },
85
- triggeredBy: {
86
- type: DataTypes.STRING(255),
87
- allowNull: true,
88
- comment: "User or system that triggered the execution",
89
- },
90
- },
91
- {
92
- tableName: "RuleExecutions",
93
- timestamps: true,
94
- // Remove indexes from model definition - they will be created by migration
95
- }
96
- );
97
-
98
- RuleExecution.associate = (models) => {
99
- // An execution belongs to a rule
100
- RuleExecution.belongsTo(models.AutomationRule, {
101
- foreignKey: "ruleId",
102
- as: "rule",
103
- });
104
- };
105
-
106
- return RuleExecution;
107
- };
1
+ const { DataTypes } = require("sequelize");
2
+
3
+ module.exports = (sequelize) => {
4
+ const RuleExecution = sequelize.define(
5
+ "RuleExecution",
6
+ {
7
+ id: {
8
+ type: DataTypes.UUID,
9
+ defaultValue: DataTypes.UUIDV4,
10
+ primaryKey: true,
11
+ },
12
+ ruleId: {
13
+ type: DataTypes.UUID,
14
+ allowNull: false,
15
+ references: {
16
+ model: "AutomationRule",
17
+ key: "id",
18
+ },
19
+ comment: "Reference to the executed rule",
20
+ },
21
+ executionType: {
22
+ type: DataTypes.ENUM("SCHEDULED", "MANUAL", "API_TRIGGER"),
23
+ allowNull: false,
24
+ comment: "How the rule was triggered",
25
+ },
26
+ status: {
27
+ type: DataTypes.ENUM("RUNNING", "SUCCESS", "FAILED", "PARTIAL_SUCCESS"),
28
+ allowNull: false,
29
+ comment: "Execution status",
30
+ },
31
+ startTime: {
32
+ type: DataTypes.DATE,
33
+ allowNull: false,
34
+ comment: "When execution started",
35
+ },
36
+ endTime: {
37
+ type: DataTypes.DATE,
38
+ allowNull: true,
39
+ comment: "When execution completed",
40
+ },
41
+ duration: {
42
+ type: DataTypes.INTEGER,
43
+ allowNull: true,
44
+ comment: "Execution duration in milliseconds",
45
+ },
46
+ itemsEvaluated: {
47
+ type: DataTypes.INTEGER,
48
+ defaultValue: 0,
49
+ allowNull: false,
50
+ comment: "Number of items (campaigns/adsets/ads) evaluated",
51
+ },
52
+ itemsMatched: {
53
+ type: DataTypes.INTEGER,
54
+ defaultValue: 0,
55
+ allowNull: false,
56
+ comment: "Number of items that matched the conditions",
57
+ },
58
+ actionsExecuted: {
59
+ type: DataTypes.INTEGER,
60
+ defaultValue: 0,
61
+ allowNull: false,
62
+ comment: "Number of actions successfully executed",
63
+ },
64
+ actionsFailed: {
65
+ type: DataTypes.INTEGER,
66
+ defaultValue: 0,
67
+ allowNull: false,
68
+ comment: "Number of actions that failed",
69
+ },
70
+ errorMessage: {
71
+ type: DataTypes.TEXT,
72
+ allowNull: true,
73
+ comment: "Error message if execution failed",
74
+ },
75
+ executionDetails: {
76
+ type: DataTypes.JSONB,
77
+ allowNull: true,
78
+ comment: "Detailed execution results and logs",
79
+ },
80
+ matchedItems: {
81
+ type: DataTypes.JSONB,
82
+ allowNull: true,
83
+ comment: "List of items that matched the rule conditions and had actions applied",
84
+ },
85
+ triggeredBy: {
86
+ type: DataTypes.STRING(255),
87
+ allowNull: true,
88
+ comment: "User or system that triggered the execution",
89
+ },
90
+ },
91
+ {
92
+ tableName: "RuleExecutions",
93
+ timestamps: true,
94
+ // Remove indexes from model definition - they will be created by migration
95
+ }
96
+ );
97
+
98
+ RuleExecution.associate = (models) => {
99
+ // An execution belongs to a rule
100
+ RuleExecution.belongsTo(models.AutomationRule, {
101
+ foreignKey: "ruleId",
102
+ as: "rule",
103
+ });
104
+ };
105
+
106
+ return RuleExecution;
107
+ };
@@ -1,56 +1,56 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const RulesValues = sequelize.define(
3
- "RulesValues",
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
- permissions: {
20
- type: DataTypes.ARRAY(DataTypes.STRING),
21
- allowNull: false,
22
- defaultValue: [],
23
- },
24
- feature: {
25
- type: DataTypes.STRING,
26
- allowNull: true,
27
- },
28
- parentId: {
29
- type: DataTypes.UUID,
30
- allowNull: true,
31
- references: {
32
- model: "RulesValues",
33
- key: "id",
34
- },
35
- onDelete: "CASCADE",
36
- },
37
- },
38
- {
39
- tableName: "RulesValues",
40
- }
41
- );
42
-
43
- // Self-referential association to define sub-rules
44
- RulesValues.hasMany(RulesValues, {
45
- as: "subRules",
46
- foreignKey: "parentId",
47
- onDelete: "CASCADE",
48
- });
49
-
50
- RulesValues.belongsTo(RulesValues, {
51
- as: "parentRule",
52
- foreignKey: "parentId",
53
- });
54
-
55
- return RulesValues;
56
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const RulesValues = sequelize.define(
3
+ "RulesValues",
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
+ permissions: {
20
+ type: DataTypes.ARRAY(DataTypes.STRING),
21
+ allowNull: false,
22
+ defaultValue: [],
23
+ },
24
+ feature: {
25
+ type: DataTypes.STRING,
26
+ allowNull: true,
27
+ },
28
+ parentId: {
29
+ type: DataTypes.UUID,
30
+ allowNull: true,
31
+ references: {
32
+ model: "RulesValues",
33
+ key: "id",
34
+ },
35
+ onDelete: "CASCADE",
36
+ },
37
+ },
38
+ {
39
+ tableName: "RulesValues",
40
+ }
41
+ );
42
+
43
+ // Self-referential association to define sub-rules
44
+ RulesValues.hasMany(RulesValues, {
45
+ as: "subRules",
46
+ foreignKey: "parentId",
47
+ onDelete: "CASCADE",
48
+ });
49
+
50
+ RulesValues.belongsTo(RulesValues, {
51
+ as: "parentRule",
52
+ foreignKey: "parentId",
53
+ });
54
+
55
+ return RulesValues;
56
+ };
@@ -1,24 +1,24 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const SupportedLocale = sequelize.define('SupportedLocale', {
3
- country: {
4
- type: DataTypes.STRING,
5
- allowNull: false,
6
- },
7
- locale: {
8
- type: DataTypes.STRING,
9
- allowNull: false,
10
- },
11
- language: {
12
- type: DataTypes.STRING,
13
- allowNull: true,
14
- comment: 'Language code (e.g., en, es, fr)'
15
- }
16
- });
17
-
18
- // Define associations if needed in the future
19
- // SupportedLocale.associate = (models) => {
20
- // // e.g., SupportedLocale.hasMany(models.OtherModel);
21
- // };
22
-
23
- return SupportedLocale;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const SupportedLocale = sequelize.define('SupportedLocale', {
3
+ country: {
4
+ type: DataTypes.STRING,
5
+ allowNull: false,
6
+ },
7
+ locale: {
8
+ type: DataTypes.STRING,
9
+ allowNull: false,
10
+ },
11
+ language: {
12
+ type: DataTypes.STRING,
13
+ allowNull: true,
14
+ comment: 'Language code (e.g., en, es, fr)'
15
+ }
16
+ });
17
+
18
+ // Define associations if needed in the future
19
+ // SupportedLocale.associate = (models) => {
20
+ // // e.g., SupportedLocale.hasMany(models.OtherModel);
21
+ // };
22
+
23
+ return SupportedLocale;
24
24
  };