agrs-sequelize-sdk 1.4.52 → 1.4.53

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 (116) hide show
  1. package/migrations/2026-05-17-PIXELS-FOLLOWUP.md +85 -85
  2. package/migrations/2026-05-17-add-platform-to-ad.js +19 -19
  3. package/migrations/2026-05-17-add-platform-to-adaccount.js +19 -19
  4. package/migrations/2026-05-17-add-platform-to-adperformance.js +19 -19
  5. package/migrations/2026-05-17-add-platform-to-adset.js +19 -19
  6. package/migrations/2026-05-17-add-platform-to-adsetperformance.js +19 -19
  7. package/migrations/2026-05-17-add-platform-to-aiarticleretryqueue.js +19 -19
  8. package/migrations/2026-05-17-add-platform-to-aicampaignqueue.js +19 -19
  9. package/migrations/2026-05-17-add-platform-to-article.js +19 -19
  10. package/migrations/2026-05-17-add-platform-to-campaign.js +19 -19
  11. package/migrations/2026-05-17-add-platform-to-codefuelcampaign.js +19 -19
  12. package/migrations/2026-05-17-add-platform-to-dynamicfeed.js +19 -19
  13. package/migrations/2026-05-17-add-platform-to-facebookretryqueue.js +19 -19
  14. package/migrations/2026-05-17-add-platform-to-pages.js +19 -19
  15. package/migrations/2026-05-17-add-platform-to-presets.js +19 -19
  16. package/migrations/2026-05-18-add-group-id-to-ai-campaign-queue.js +18 -18
  17. package/migrations/2026-05-18-add-platform-code-to-creation-logs.js +65 -65
  18. package/migrations/2026-05-18-add-platform-code-to-pixels.js +55 -55
  19. package/migrations/2026-05-18-add-platform-code-to-rsoc-feed-campaigns.js +55 -55
  20. package/migrations/2026-05-18-add-platform-date-index-to-adperformance.js +16 -16
  21. package/migrations/2026-05-18-add-platform-date-index-to-adsetperformance.js +16 -16
  22. package/migrations/2026-05-18-add-review-status-to-ad.js +36 -36
  23. package/migrations/2026-05-18-create-canonical-insights.js +84 -84
  24. package/migrations/2026-05-18-create-snapchat-public-profiles.js +68 -68
  25. package/migrations/2026-05-18-create-tiktok-identities.js +71 -71
  26. package/migrations/2026-05-18-create-tiktok-snapchat-campaigns.js +143 -143
  27. package/migrations/2026-05-18-create-tt-snp-adset-ad-tables.js +309 -309
  28. package/migrations/RUN_ME_MANUALLY_2026-05-17.sql +99 -99
  29. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  30. package/migrations/change-adset-name-to-text.js +79 -79
  31. package/models/AICampaignQueue.js +152 -152
  32. package/models/AIGenerationLog.js +85 -85
  33. package/models/AIGenerationRequest.js +212 -212
  34. package/models/AdAccountValues.js +25 -25
  35. package/models/AdHistory.js +30 -30
  36. package/models/AdPerformance.js +104 -104
  37. package/models/AdSet.js +295 -295
  38. package/models/AdSetHistory.js +30 -30
  39. package/models/AdsetPerformance.js +137 -137
  40. package/models/AiArticleRetryQueue.js +157 -157
  41. package/models/AiCreationRetryQueue.js +134 -134
  42. package/models/ApiAuditLog.js +127 -127
  43. package/models/ApiToken.js +67 -67
  44. package/models/Article.js +222 -222
  45. package/models/AutomationRule.js +179 -179
  46. package/models/BannerTemplate.js +129 -129
  47. package/models/Buyers.js +25 -25
  48. package/models/Campaign.js +168 -163
  49. package/models/CampaignActionHistory.js +101 -101
  50. package/models/CampaignCreationLog.js +340 -340
  51. package/models/CampaignCreationLogV2.js +392 -392
  52. package/models/CampaignHistory.js +33 -33
  53. package/models/CampaignTag.js +46 -0
  54. package/models/CampaignTagAssignment.js +48 -0
  55. package/models/CanonicalInsights.js +68 -68
  56. package/models/Channel.js +55 -55
  57. package/models/Domain.js +44 -44
  58. package/models/DynamicFeed.js +218 -218
  59. package/models/ExplorAdsChannel.js +61 -61
  60. package/models/FacebookRetryQueue.js +163 -163
  61. package/models/Feed.js +33 -33
  62. package/models/FeedArticleConfiguration.js +80 -80
  63. package/models/FrontStoryChannel.js +59 -59
  64. package/models/FrontStoryChannelV2.js +60 -60
  65. package/models/GenericFlowRequest.js +114 -114
  66. package/models/MidoWebChannel.js +47 -47
  67. package/models/MineBrandBlocklist.js +40 -40
  68. package/models/MineChannel.js +42 -42
  69. package/models/MineRedirectDomain.js +36 -36
  70. package/models/MineWebhookEvent.js +53 -53
  71. package/models/Pages.js +117 -117
  72. package/models/PipelineExecution.js +59 -59
  73. package/models/PolicyDogsCreativeCache.js +50 -50
  74. package/models/PolicyDogsImageCache.js +30 -30
  75. package/models/Presets.js +40 -40
  76. package/models/PublicApiBatch.js +155 -155
  77. package/models/PublicApiBatchItem.js +166 -166
  78. package/models/PublicApiIdempotencyCache.js +135 -135
  79. package/models/RSOCFeedCampaign.js +387 -387
  80. package/models/RsocKeywordPerformance.js +110 -110
  81. package/models/RuleAction.js +90 -90
  82. package/models/RuleCondition.js +137 -137
  83. package/models/RuleExecution.js +107 -107
  84. package/models/RulesValues.js +56 -56
  85. package/models/SingularChannel.js +31 -31
  86. package/models/SnapchatAd.js +69 -69
  87. package/models/SnapchatAdSquad.js +92 -92
  88. package/models/SnapchatCampaign.js +69 -69
  89. package/models/SnapchatChannel.js +31 -31
  90. package/models/SnapchatPublicProfiles.js +67 -67
  91. package/models/SupportedLocale.js +23 -23
  92. package/models/SyncHistory.js +249 -249
  93. package/models/TTQChannel.js +42 -42
  94. package/models/TemplateMetadata.js +260 -260
  95. package/models/Tier2_AdAccounts.js +110 -110
  96. package/models/Tier2_Assets.js +70 -70
  97. package/models/Tier2_BusinessManagers.js +105 -105
  98. package/models/Tier2_CreditLines.js +99 -99
  99. package/models/Tier2_Pages.js +91 -91
  100. package/models/Tier2_Pixels.js +82 -82
  101. package/models/Tier2_Tokens.js +64 -64
  102. package/models/Tier2_UserAdAccounts.js +83 -83
  103. package/models/TikTokAd.js +71 -71
  104. package/models/TikTokAdGroup.js +82 -82
  105. package/models/TikTokCampaign.js +71 -71
  106. package/models/TiktokChannel.js +31 -31
  107. package/models/TiktokIdentities.js +65 -65
  108. package/models/TokenRotationState.js +121 -121
  109. package/models/TonicRSOCKeywordPerformance.js +122 -122
  110. package/models/Users.js +190 -185
  111. package/models/Vertical.js +25 -25
  112. package/models/newFiles.js +137 -137
  113. package/package.json +21 -19
  114. package/run.sh +214 -214
  115. package/services/sequelizeService.js +110 -110
  116. package/tarzo-skalio-integration-docs.md +691 -691
@@ -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,31 +1,31 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const SingularChannel = sequelize.define(
3
- "SingularChannel",
4
- {
5
- channelId: {
6
- type: DataTypes.STRING,
7
- allowNull: false,
8
- unique: true,
9
- },
10
- status: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- defaultValue: "free",
14
- validate: {
15
- isIn: [["free", "used", "archived"]],
16
- },
17
- },
18
- connectedCampaigns: {
19
- type: DataTypes.JSONB,
20
- allowNull: false,
21
- defaultValue: [],
22
- },
23
- },
24
- {
25
- tableName: "singular_rsoc_channels",
26
- timestamps: true,
27
- }
28
- );
29
-
30
- return SingularChannel;
31
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const SingularChannel = sequelize.define(
3
+ "SingularChannel",
4
+ {
5
+ channelId: {
6
+ type: DataTypes.STRING,
7
+ allowNull: false,
8
+ unique: true,
9
+ },
10
+ status: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ defaultValue: "free",
14
+ validate: {
15
+ isIn: [["free", "used", "archived"]],
16
+ },
17
+ },
18
+ connectedCampaigns: {
19
+ type: DataTypes.JSONB,
20
+ allowNull: false,
21
+ defaultValue: [],
22
+ },
23
+ },
24
+ {
25
+ tableName: "singular_rsoc_channels",
26
+ timestamps: true,
27
+ }
28
+ );
29
+
30
+ return SingularChannel;
31
+ };
@@ -1,69 +1,69 @@
1
- module.exports = (sequelize, DataTypes) =>
2
- sequelize.define(
3
- "SnapchatAd",
4
- {
5
- id: {
6
- type: DataTypes.STRING(36),
7
- primaryKey: true,
8
- comment: "Snapchat ad UUID",
9
- },
10
- name: {
11
- type: DataTypes.STRING(255),
12
- allowNull: false,
13
- },
14
- ad_squad_id: {
15
- type: DataTypes.STRING(36),
16
- allowNull: false,
17
- comment: "Snapchat ad squad UUID; loose FK to snapchat_ad_squads",
18
- },
19
- ad_account_id: {
20
- type: DataTypes.STRING(36),
21
- allowNull: false,
22
- },
23
- creative_id: {
24
- type: DataTypes.STRING(36),
25
- allowNull: false,
26
- },
27
- status: {
28
- type: DataTypes.STRING(50),
29
- allowNull: true,
30
- comment: "ACTIVE or PAUSED (Snap native)",
31
- },
32
- type: {
33
- type: DataTypes.STRING(50),
34
- allowNull: true,
35
- comment: "SNAP_AD",
36
- },
37
- review_status: {
38
- type: DataTypes.STRING(50),
39
- allowNull: true,
40
- comment: "Mirrors Plan Q Ad.review_status (e.g. PENDING_REVIEW, APPROVED)",
41
- },
42
- pending_review_since: {
43
- type: DataTypes.DATE,
44
- allowNull: true,
45
- comment: "Timestamp when ad first entered pending review (Plan Q)",
46
- },
47
- created_at: {
48
- type: DataTypes.DATE,
49
- allowNull: false,
50
- },
51
- updated_at: {
52
- type: DataTypes.DATE,
53
- allowNull: true,
54
- },
55
- synced_at: {
56
- type: DataTypes.DATE,
57
- allowNull: false,
58
- },
59
- },
60
- {
61
- tableName: "snapchat_ads",
62
- timestamps: false,
63
- indexes: [
64
- { fields: ["ad_squad_id"] },
65
- { fields: ["ad_account_id"] },
66
- { fields: ["status"] },
67
- ],
68
- },
69
- );
1
+ module.exports = (sequelize, DataTypes) =>
2
+ sequelize.define(
3
+ "SnapchatAd",
4
+ {
5
+ id: {
6
+ type: DataTypes.STRING(36),
7
+ primaryKey: true,
8
+ comment: "Snapchat ad UUID",
9
+ },
10
+ name: {
11
+ type: DataTypes.STRING(255),
12
+ allowNull: false,
13
+ },
14
+ ad_squad_id: {
15
+ type: DataTypes.STRING(36),
16
+ allowNull: false,
17
+ comment: "Snapchat ad squad UUID; loose FK to snapchat_ad_squads",
18
+ },
19
+ ad_account_id: {
20
+ type: DataTypes.STRING(36),
21
+ allowNull: false,
22
+ },
23
+ creative_id: {
24
+ type: DataTypes.STRING(36),
25
+ allowNull: false,
26
+ },
27
+ status: {
28
+ type: DataTypes.STRING(50),
29
+ allowNull: true,
30
+ comment: "ACTIVE or PAUSED (Snap native)",
31
+ },
32
+ type: {
33
+ type: DataTypes.STRING(50),
34
+ allowNull: true,
35
+ comment: "SNAP_AD",
36
+ },
37
+ review_status: {
38
+ type: DataTypes.STRING(50),
39
+ allowNull: true,
40
+ comment: "Mirrors Plan Q Ad.review_status (e.g. PENDING_REVIEW, APPROVED)",
41
+ },
42
+ pending_review_since: {
43
+ type: DataTypes.DATE,
44
+ allowNull: true,
45
+ comment: "Timestamp when ad first entered pending review (Plan Q)",
46
+ },
47
+ created_at: {
48
+ type: DataTypes.DATE,
49
+ allowNull: false,
50
+ },
51
+ updated_at: {
52
+ type: DataTypes.DATE,
53
+ allowNull: true,
54
+ },
55
+ synced_at: {
56
+ type: DataTypes.DATE,
57
+ allowNull: false,
58
+ },
59
+ },
60
+ {
61
+ tableName: "snapchat_ads",
62
+ timestamps: false,
63
+ indexes: [
64
+ { fields: ["ad_squad_id"] },
65
+ { fields: ["ad_account_id"] },
66
+ { fields: ["status"] },
67
+ ],
68
+ },
69
+ );