agrs-sequelize-sdk 1.4.57 → 1.4.59

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 (120) 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 +151 -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 -168
  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 -46
  54. package/models/CampaignTagAssignment.js +48 -48
  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 +56 -56
  68. package/models/MineBrandConfig.js +26 -26
  69. package/models/MineChannel.js +47 -47
  70. package/models/MineRedirectDomain.js +42 -42
  71. package/models/MineWebhookEvent.js +53 -53
  72. package/models/Pages.js +117 -117
  73. package/models/PipelineExecution.js +59 -59
  74. package/models/PolicyDogsCreativeCache.js +50 -50
  75. package/models/PolicyDogsImageCache.js +30 -30
  76. package/models/Presets.js +40 -40
  77. package/models/PublicApiBatch.js +155 -155
  78. package/models/PublicApiBatchItem.js +166 -166
  79. package/models/PublicApiIdempotencyCache.js +135 -135
  80. package/models/RSOCFeedCampaign.js +387 -387
  81. package/models/RSOCFeedConfig.js +46 -46
  82. package/models/RSOCRedirectWsCode.js +22 -22
  83. package/models/RsocKeywordPerformance.js +110 -110
  84. package/models/RuleAction.js +90 -90
  85. package/models/RuleCondition.js +137 -137
  86. package/models/RuleExecution.js +107 -107
  87. package/models/RulesValues.js +56 -56
  88. package/models/SingularChannel.js +31 -31
  89. package/models/SnapchatAd.js +69 -69
  90. package/models/SnapchatAdSquad.js +92 -92
  91. package/models/SnapchatCampaign.js +69 -69
  92. package/models/SnapchatChannel.js +31 -31
  93. package/models/SnapchatPublicProfiles.js +67 -67
  94. package/models/SupportedLocale.js +23 -23
  95. package/models/SyncHistory.js +249 -249
  96. package/models/TTQChannel.js +42 -42
  97. package/models/Team.js +43 -43
  98. package/models/TemplateMetadata.js +260 -260
  99. package/models/Tier2_AdAccounts.js +110 -110
  100. package/models/Tier2_Assets.js +70 -70
  101. package/models/Tier2_BusinessManagers.js +105 -105
  102. package/models/Tier2_CreditLines.js +99 -99
  103. package/models/Tier2_Pages.js +91 -91
  104. package/models/Tier2_Pixels.js +82 -82
  105. package/models/Tier2_Tokens.js +64 -64
  106. package/models/Tier2_UserAdAccounts.js +83 -83
  107. package/models/TikTokAd.js +71 -71
  108. package/models/TikTokAdGroup.js +82 -82
  109. package/models/TikTokCampaign.js +71 -71
  110. package/models/TiktokChannel.js +31 -31
  111. package/models/TiktokIdentities.js +65 -65
  112. package/models/TokenRotationState.js +121 -121
  113. package/models/TonicRSOCKeywordPerformance.js +122 -122
  114. package/models/Users.js +204 -204
  115. package/models/Vertical.js +25 -25
  116. package/models/newFiles.js +137 -137
  117. package/package.json +19 -21
  118. package/run.sh +214 -214
  119. package/services/sequelizeService.js +110 -110
  120. package/tarzo-skalio-integration-docs.md +691 -691
@@ -1,153 +1,152 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const AICampaignQueue = sequelize.define(
3
- "AICampaignQueue",
4
- {
5
- id: {
6
- type: DataTypes.INTEGER,
7
- primaryKey: true,
8
- autoIncrement: true,
9
- },
10
- article_id: {
11
- type: DataTypes.STRING(255),
12
- allowNull: false,
13
- field: "article_id",
14
- },
15
- feed_provider: {
16
- type: DataTypes.STRING(100),
17
- allowNull: false,
18
- field: "feed_provider",
19
- },
20
- payload: {
21
- type: DataTypes.JSONB,
22
- allowNull: false,
23
- },
24
- status: {
25
- type: DataTypes.STRING(50),
26
- allowNull: false,
27
- defaultValue: "pending",
28
- validate: {
29
- isIn: [["pending", "queued", "processing", "completed", "failed"]],
30
- },
31
- },
32
- created_at: {
33
- type: DataTypes.DATE,
34
- allowNull: false,
35
- defaultValue: DataTypes.NOW,
36
- field: "created_at",
37
- },
38
- processed_at: {
39
- type: DataTypes.DATE,
40
- allowNull: true,
41
- field: "processed_at",
42
- },
43
- retry_count: {
44
- type: DataTypes.INTEGER,
45
- allowNull: false,
46
- defaultValue: 0,
47
- field: "retry_count",
48
- },
49
- error_message: {
50
- type: DataTypes.TEXT,
51
- allowNull: true,
52
- field: "error_message",
53
- },
54
- facebook_campaign_id: {
55
- type: DataTypes.STRING(255),
56
- allowNull: true,
57
- field: "facebook_campaign_id",
58
- },
59
- process_id: {
60
- type: DataTypes.STRING(255),
61
- allowNull: true,
62
- field: "process_id",
63
- },
64
- creation_logs_process_id: {
65
- type: DataTypes.UUID,
66
- allowNull: true,
67
- field: "creation_logs_process_id",
68
- comment: "Process ID from CampaignCreationLogV2 (UUID)",
69
- },
70
- agrs_cid: {
71
- type: DataTypes.STRING(255),
72
- allowNull: true,
73
- field: "agrs_cid",
74
- comment: "AGRS Campaign ID",
75
- },
76
- preset_id: {
77
- type: DataTypes.STRING(255),
78
- allowNull: true,
79
- field: "preset_id",
80
- comment: "Preset ID",
81
- },
82
- article_creation_payload: {
83
- type: DataTypes.JSONB,
84
- allowNull: true,
85
- field: "article_creation_payload",
86
- comment: "Payload sent for article creation (Mine/Predicto/Mobitech specific parameters)",
87
- },
88
- original_payload: {
89
- type: DataTypes.JSONB,
90
- allowNull: true,
91
- field: "original_payload",
92
- comment: "Original createAICampaign request params for this campaign (preset, feed config, AI settings, combo values)",
93
- },
94
- platform: {
95
- type: DataTypes.ENUM("fb", "tt", "snp"),
96
- allowNull: false,
97
- defaultValue: "fb",
98
- field: "platform",
99
- comment: "Ad platform identifier: fb=Facebook, tt=TikTok, snp=Snapchat",
100
- },
101
- group_id: {
102
- type: DataTypes.UUID,
103
- allowNull: true,
104
- field: "group_id",
105
- comment: "Groups rows created by a single multi-platform fanout request",
106
- },
107
- },
108
- {
109
- tableName: "ai_campaign_queue",
110
- timestamps: false, // We manage created_at manually
111
- indexes: [
112
- {
113
- fields: ["status"],
114
- },
115
- {
116
- fields: ["article_id"],
117
- },
118
- {
119
- fields: ["created_at"],
120
- },
121
- {
122
- fields: ["feed_provider"],
123
- },
124
- {
125
- fields: ["process_id"],
126
- },
127
- {
128
- fields: ["creation_logs_process_id"],
129
- },
130
- {
131
- fields: ["agrs_cid"],
132
- },
133
- {
134
- fields: ["preset_id"],
135
- },
136
- {
137
- fields: ["group_id"],
138
- },
139
- ],
140
- }
141
- );
142
-
143
- AICampaignQueue.associate = (models) => {
144
- // Optional: Add association to Article model if needed
145
- // AICampaignQueue.belongsTo(models.Article, {
146
- // foreignKey: "article_id",
147
- // targetKey: "AGRSAID",
148
- // as: "Article",
149
- // });
150
- };
151
-
152
- return AICampaignQueue;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AICampaignQueue = sequelize.define(
3
+ "AICampaignQueue",
4
+ {
5
+ id: {
6
+ type: DataTypes.INTEGER,
7
+ primaryKey: true,
8
+ autoIncrement: true,
9
+ },
10
+ article_id: {
11
+ type: DataTypes.STRING(255),
12
+ allowNull: false,
13
+ field: "article_id",
14
+ },
15
+ feed_provider: {
16
+ type: DataTypes.STRING(100),
17
+ allowNull: false,
18
+ field: "feed_provider",
19
+ },
20
+ payload: {
21
+ type: DataTypes.JSONB,
22
+ allowNull: false,
23
+ },
24
+ status: {
25
+ type: DataTypes.STRING(50),
26
+ allowNull: false,
27
+ defaultValue: "pending",
28
+ validate: {
29
+ isIn: [["pending", "queued", "processing", "completed", "failed"]],
30
+ },
31
+ },
32
+ created_at: {
33
+ type: DataTypes.DATE,
34
+ allowNull: false,
35
+ defaultValue: DataTypes.NOW,
36
+ field: "created_at",
37
+ },
38
+ processed_at: {
39
+ type: DataTypes.DATE,
40
+ allowNull: true,
41
+ field: "processed_at",
42
+ },
43
+ retry_count: {
44
+ type: DataTypes.INTEGER,
45
+ allowNull: false,
46
+ defaultValue: 0,
47
+ field: "retry_count",
48
+ },
49
+ error_message: {
50
+ type: DataTypes.TEXT,
51
+ allowNull: true,
52
+ field: "error_message",
53
+ },
54
+ facebook_campaign_id: {
55
+ type: DataTypes.STRING(255),
56
+ allowNull: true,
57
+ field: "facebook_campaign_id",
58
+ },
59
+ process_id: {
60
+ type: DataTypes.STRING(255),
61
+ allowNull: true,
62
+ field: "process_id",
63
+ },
64
+ creation_logs_process_id: {
65
+ type: DataTypes.UUID,
66
+ allowNull: true,
67
+ field: "creation_logs_process_id",
68
+ comment: "Process ID from CampaignCreationLogV2 (UUID)",
69
+ },
70
+ agrs_cid: {
71
+ type: DataTypes.STRING(255),
72
+ allowNull: true,
73
+ field: "agrs_cid",
74
+ comment: "AGRS Campaign ID",
75
+ },
76
+ preset_id: {
77
+ type: DataTypes.STRING(255),
78
+ allowNull: true,
79
+ field: "preset_id",
80
+ comment: "Preset ID",
81
+ },
82
+ article_creation_payload: {
83
+ type: DataTypes.JSONB,
84
+ allowNull: true,
85
+ field: "article_creation_payload",
86
+ comment: "Payload sent for article creation (Mine/Predicto/Mobitech specific parameters)",
87
+ },
88
+ original_payload: {
89
+ type: DataTypes.JSONB,
90
+ allowNull: true,
91
+ field: "original_payload",
92
+ comment: "Original createAICampaign request params for this campaign (preset, feed config, AI settings, combo values)",
93
+ },
94
+ platform: {
95
+ type: DataTypes.ENUM("fb", "tt", "snp"),
96
+ allowNull: false,
97
+ defaultValue: "fb",
98
+ field: "platform",
99
+ },
100
+ group_id: {
101
+ type: DataTypes.UUID,
102
+ allowNull: true,
103
+ field: "group_id",
104
+ comment: "Groups rows created by a single multi-platform fanout request",
105
+ },
106
+ },
107
+ {
108
+ tableName: "ai_campaign_queue",
109
+ timestamps: false, // We manage created_at manually
110
+ indexes: [
111
+ {
112
+ fields: ["status"],
113
+ },
114
+ {
115
+ fields: ["article_id"],
116
+ },
117
+ {
118
+ fields: ["created_at"],
119
+ },
120
+ {
121
+ fields: ["feed_provider"],
122
+ },
123
+ {
124
+ fields: ["process_id"],
125
+ },
126
+ {
127
+ fields: ["creation_logs_process_id"],
128
+ },
129
+ {
130
+ fields: ["agrs_cid"],
131
+ },
132
+ {
133
+ fields: ["preset_id"],
134
+ },
135
+ {
136
+ fields: ["group_id"],
137
+ },
138
+ ],
139
+ }
140
+ );
141
+
142
+ AICampaignQueue.associate = (models) => {
143
+ // Optional: Add association to Article model if needed
144
+ // AICampaignQueue.belongsTo(models.Article, {
145
+ // foreignKey: "article_id",
146
+ // targetKey: "AGRSAID",
147
+ // as: "Article",
148
+ // });
149
+ };
150
+
151
+ return AICampaignQueue;
153
152
  };
@@ -1,85 +1,85 @@
1
- /**
2
- * AI Generation Log Model
3
- *
4
- * Stores detailed logs for each step of the generation process.
5
- * Useful for debugging and monitoring.
6
- */
7
-
8
- module.exports = (sequelize, DataTypes) => {
9
- const AIGenerationLog = sequelize.define(
10
- "AIGenerationLog",
11
- {
12
- id: {
13
- type: DataTypes.UUID,
14
- defaultValue: DataTypes.UUIDV4,
15
- primaryKey: true,
16
- },
17
- requestId: {
18
- type: DataTypes.STRING,
19
- allowNull: false,
20
- comment: "Reference to AIGenerationRequest.requestId",
21
- indexes: [
22
- {
23
- fields: ["requestId"],
24
- },
25
- ],
26
- },
27
- step: {
28
- type: DataTypes.STRING,
29
- allowNull: false,
30
- comment:
31
- "Step name: parsing, prompt_generation, image_generation, storage, logging",
32
- },
33
- level: {
34
- type: DataTypes.ENUM("info", "warning", "error", "success"),
35
- allowNull: false,
36
- defaultValue: "info",
37
- comment: "Log level",
38
- },
39
- message: {
40
- type: DataTypes.TEXT,
41
- allowNull: false,
42
- comment: "Log message",
43
- },
44
- data: {
45
- type: DataTypes.JSONB,
46
- allowNull: true,
47
- comment: "Additional log data (JSON)",
48
- },
49
- duration: {
50
- type: DataTypes.INTEGER,
51
- allowNull: true,
52
- comment: "Step duration in milliseconds",
53
- },
54
- },
55
- {
56
- tableName: "ai_generation_logs",
57
- timestamps: true,
58
- createdAt: "createdAt",
59
- updatedAt: false, // Logs are immutable
60
- indexes: [
61
- {
62
- fields: ["requestId", "step"],
63
- },
64
- {
65
- fields: ["level"],
66
- },
67
- {
68
- fields: ["createdAt"],
69
- },
70
- ],
71
- }
72
- );
73
-
74
- // Associations
75
- AIGenerationLog.associate = function (models) {
76
- // Each log belongs to a request
77
- AIGenerationLog.belongsTo(models.AIGenerationRequest, {
78
- foreignKey: "requestId",
79
- targetKey: "requestId",
80
- as: "request",
81
- });
82
- };
83
-
84
- return AIGenerationLog;
85
- };
1
+ /**
2
+ * AI Generation Log Model
3
+ *
4
+ * Stores detailed logs for each step of the generation process.
5
+ * Useful for debugging and monitoring.
6
+ */
7
+
8
+ module.exports = (sequelize, DataTypes) => {
9
+ const AIGenerationLog = sequelize.define(
10
+ "AIGenerationLog",
11
+ {
12
+ id: {
13
+ type: DataTypes.UUID,
14
+ defaultValue: DataTypes.UUIDV4,
15
+ primaryKey: true,
16
+ },
17
+ requestId: {
18
+ type: DataTypes.STRING,
19
+ allowNull: false,
20
+ comment: "Reference to AIGenerationRequest.requestId",
21
+ indexes: [
22
+ {
23
+ fields: ["requestId"],
24
+ },
25
+ ],
26
+ },
27
+ step: {
28
+ type: DataTypes.STRING,
29
+ allowNull: false,
30
+ comment:
31
+ "Step name: parsing, prompt_generation, image_generation, storage, logging",
32
+ },
33
+ level: {
34
+ type: DataTypes.ENUM("info", "warning", "error", "success"),
35
+ allowNull: false,
36
+ defaultValue: "info",
37
+ comment: "Log level",
38
+ },
39
+ message: {
40
+ type: DataTypes.TEXT,
41
+ allowNull: false,
42
+ comment: "Log message",
43
+ },
44
+ data: {
45
+ type: DataTypes.JSONB,
46
+ allowNull: true,
47
+ comment: "Additional log data (JSON)",
48
+ },
49
+ duration: {
50
+ type: DataTypes.INTEGER,
51
+ allowNull: true,
52
+ comment: "Step duration in milliseconds",
53
+ },
54
+ },
55
+ {
56
+ tableName: "ai_generation_logs",
57
+ timestamps: true,
58
+ createdAt: "createdAt",
59
+ updatedAt: false, // Logs are immutable
60
+ indexes: [
61
+ {
62
+ fields: ["requestId", "step"],
63
+ },
64
+ {
65
+ fields: ["level"],
66
+ },
67
+ {
68
+ fields: ["createdAt"],
69
+ },
70
+ ],
71
+ }
72
+ );
73
+
74
+ // Associations
75
+ AIGenerationLog.associate = function (models) {
76
+ // Each log belongs to a request
77
+ AIGenerationLog.belongsTo(models.AIGenerationRequest, {
78
+ foreignKey: "requestId",
79
+ targetKey: "requestId",
80
+ as: "request",
81
+ });
82
+ };
83
+
84
+ return AIGenerationLog;
85
+ };