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
package/models/Users.js CHANGED
@@ -1,204 +1,204 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Users = sequelize.define(
3
- "Users",
4
- {
5
- id: {
6
- type: DataTypes.UUID, // Use UUID for the primary key
7
- defaultValue: DataTypes.UUIDV4, // Automatically generate a UUID
8
- primaryKey: true, // Set as primary key
9
- },
10
- Username: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- unique: true,
14
- },
15
- Image: {
16
- type: DataTypes.STRING,
17
- allowNull: true,
18
- },
19
- Email: {
20
- type: DataTypes.STRING,
21
- allowNull: true,
22
- unique: true,
23
- },
24
- // add name field
25
- Name: {
26
- type: DataTypes.STRING,
27
- allowNull: false,
28
- },
29
- Password: {
30
- type: DataTypes.STRING(1024), // Store hash with max length 256
31
- allowNull: false,
32
- },
33
- Roles: {
34
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of roles
35
- allowNull: true,
36
- defaultValue: [],
37
- },
38
- Features: {
39
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of features
40
- allowNull: true,
41
- defaultValue: [],
42
- },
43
- // Public API token scope preference. Admin sets it on the User
44
- // Management screen (Features → API & Docs → Read / Read & Write).
45
- // The token-issue route reads this when a user mints/regenerates so
46
- // the new token gets the admin-granted scope, without polluting the
47
- // Features array.
48
- api_scope: {
49
- type: DataTypes.STRING,
50
- allowNull: false,
51
- defaultValue: "read",
52
- },
53
- Accounts: {
54
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
55
- allowNull: true,
56
- defaultValue: [],
57
- },
58
- MediaBuyers: {
59
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
60
- allowNull: true,
61
- defaultValue: [],
62
- },
63
- Pages: {
64
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
65
- allowNull: true,
66
- defaultValue: [],
67
- },
68
- FeedProvider: {
69
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of static feed names (predicto, mine, etc.)
70
- allowNull: true,
71
- defaultValue: [],
72
- },
73
- DynamicFeedIds: {
74
- type: DataTypes.ARRAY(DataTypes.UUID), // Array of UUIDs referencing dynamic_feeds.id
75
- allowNull: true,
76
- defaultValue: [],
77
- },
78
- Organization: {
79
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
80
- allowNull: true,
81
- defaultValue: [],
82
- },
83
- Tier2Accounts: {
84
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of Tier2 Ad Account Facebook IDs
85
- allowNull: true,
86
- defaultValue: [],
87
- },
88
- AccountsView: {
89
- type: DataTypes.ARRAY(DataTypes.STRING),
90
- allowNull: true,
91
- defaultValue: [],
92
- },
93
- AccountsEdit: {
94
- type: DataTypes.ARRAY(DataTypes.STRING),
95
- allowNull: true,
96
- defaultValue: [],
97
- },
98
- AccountsAI: {
99
- type: DataTypes.ARRAY(DataTypes.STRING),
100
- allowNull: true,
101
- defaultValue: [],
102
- },
103
- Pixels: {
104
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of pixel ids
105
- allowNull: true,
106
- defaultValue: [],
107
- },
108
- // Per-platform access gate. Default ['fb'] mirrors the pre-multi-platform
109
- // org policy: every user can use Facebook unless explicitly revoked, and
110
- // TikTok / Snapchat require an explicit grant. Allowed entries:
111
- // 'fb' | 'tt' | 'snp'. Drives:
112
- // - which platforms appear in the Create-New Platform dropdown for
113
- // this user;
114
- // - which platform-tagged AdAccount rows the platform-aware selects
115
- // return for this user;
116
- // - whether this user can submit a TT/SNP campaign at all.
117
- // Managed via the per-user "Platforms" accordion at /dashboard/users/[id].
118
- // Existing user rows are backfilled to ['fb'] in the same migration that
119
- // adds the column so nobody loses Facebook access on rollout.
120
- Platforms: {
121
- type: DataTypes.ARRAY(DataTypes.STRING),
122
- allowNull: true,
123
- defaultValue: ['fb'],
124
- },
125
- LastEntrance: {
126
- type: DataTypes.DATE, // Array of organization IDs
127
- allowNull: true,
128
- defaultValue: [],
129
- },
130
- Status: {
131
- type: DataTypes.STRING, // Array of organization IDs
132
- allowNull: true,
133
- },
134
- access_all_files: {
135
- type: DataTypes.BOOLEAN,
136
- allowNull: true,
137
- },
138
- Domains: {
139
- type: DataTypes.JSONB,
140
- allowNull: true
141
- },
142
- ApiRateLimits: {
143
- type: DataTypes.JSONB,
144
- allowNull: true,
145
- defaultValue: null,
146
- // Per-user public API rate-limit override. Null = use system defaults
147
- // (read 120, write 20, ai 3, dryRun 600 — all per minute), defined in
148
- // server/middleware/publicApiRateLimit.js BUCKETS.
149
- // Shape when set: { read: 200, write: 50, ai: 5, dryRun: 1000 } — any
150
- // missing key falls back to the system default for that bucket.
151
- },
152
- managed_by: {
153
- type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
154
- allowNull: true,
155
- references: {
156
- model: "Users",
157
- key: "id",
158
- },
159
- },
160
- team_id: {
161
- type: DataTypes.UUID,
162
- allowNull: true,
163
- references: {
164
- model: "teams",
165
- key: "id",
166
- },
167
- comment: "Optional single team this user belongs to",
168
- },
169
- },
170
- {
171
- tableName: "Users",
172
- }
173
- );
174
-
175
- // Define associations for managed_by relationship
176
- Users.associate = (models) => {
177
- // A user can manage many users
178
- Users.hasMany(models.Users, {
179
- foreignKey: "managed_by",
180
- as: "managedUsers",
181
- });
182
-
183
- // A user can only be managed by one user
184
- Users.belongsTo(models.Users, {
185
- foreignKey: "managed_by",
186
- as: "manager",
187
- });
188
-
189
- // A user can have many presets
190
- Users.hasMany(models.Presets, { foreignKey: "userId", as: "presets" });
191
-
192
- Users.hasMany(models.CampaignTag, {
193
- foreignKey: "created_by",
194
- as: "createdCampaignTags",
195
- });
196
-
197
- Users.belongsTo(models.Team, {
198
- foreignKey: "team_id",
199
- as: "team",
200
- });
201
- };
202
-
203
- return Users;
204
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Users = sequelize.define(
3
+ "Users",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID, // Use UUID for the primary key
7
+ defaultValue: DataTypes.UUIDV4, // Automatically generate a UUID
8
+ primaryKey: true, // Set as primary key
9
+ },
10
+ Username: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ unique: true,
14
+ },
15
+ Image: {
16
+ type: DataTypes.STRING,
17
+ allowNull: true,
18
+ },
19
+ Email: {
20
+ type: DataTypes.STRING,
21
+ allowNull: true,
22
+ unique: true,
23
+ },
24
+ // add name field
25
+ Name: {
26
+ type: DataTypes.STRING,
27
+ allowNull: false,
28
+ },
29
+ Password: {
30
+ type: DataTypes.STRING(1024), // Store hash with max length 256
31
+ allowNull: false,
32
+ },
33
+ Roles: {
34
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of roles
35
+ allowNull: true,
36
+ defaultValue: [],
37
+ },
38
+ Features: {
39
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of features
40
+ allowNull: true,
41
+ defaultValue: [],
42
+ },
43
+ // Public API token scope preference. Admin sets it on the User
44
+ // Management screen (Features → API & Docs → Read / Read & Write).
45
+ // The token-issue route reads this when a user mints/regenerates so
46
+ // the new token gets the admin-granted scope, without polluting the
47
+ // Features array.
48
+ api_scope: {
49
+ type: DataTypes.STRING,
50
+ allowNull: false,
51
+ defaultValue: "read",
52
+ },
53
+ Accounts: {
54
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
55
+ allowNull: true,
56
+ defaultValue: [],
57
+ },
58
+ MediaBuyers: {
59
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
60
+ allowNull: true,
61
+ defaultValue: [],
62
+ },
63
+ Pages: {
64
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
65
+ allowNull: true,
66
+ defaultValue: [],
67
+ },
68
+ FeedProvider: {
69
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of static feed names (predicto, mine, etc.)
70
+ allowNull: true,
71
+ defaultValue: [],
72
+ },
73
+ DynamicFeedIds: {
74
+ type: DataTypes.ARRAY(DataTypes.UUID), // Array of UUIDs referencing dynamic_feeds.id
75
+ allowNull: true,
76
+ defaultValue: [],
77
+ },
78
+ Organization: {
79
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
80
+ allowNull: true,
81
+ defaultValue: [],
82
+ },
83
+ Tier2Accounts: {
84
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of Tier2 Ad Account Facebook IDs
85
+ allowNull: true,
86
+ defaultValue: [],
87
+ },
88
+ AccountsView: {
89
+ type: DataTypes.ARRAY(DataTypes.STRING),
90
+ allowNull: true,
91
+ defaultValue: [],
92
+ },
93
+ AccountsEdit: {
94
+ type: DataTypes.ARRAY(DataTypes.STRING),
95
+ allowNull: true,
96
+ defaultValue: [],
97
+ },
98
+ AccountsAI: {
99
+ type: DataTypes.ARRAY(DataTypes.STRING),
100
+ allowNull: true,
101
+ defaultValue: [],
102
+ },
103
+ Pixels: {
104
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of pixel ids
105
+ allowNull: true,
106
+ defaultValue: [],
107
+ },
108
+ // Per-platform access gate. Default ['fb'] mirrors the pre-multi-platform
109
+ // org policy: every user can use Facebook unless explicitly revoked, and
110
+ // TikTok / Snapchat require an explicit grant. Allowed entries:
111
+ // 'fb' | 'tt' | 'snp'. Drives:
112
+ // - which platforms appear in the Create-New Platform dropdown for
113
+ // this user;
114
+ // - which platform-tagged AdAccount rows the platform-aware selects
115
+ // return for this user;
116
+ // - whether this user can submit a TT/SNP campaign at all.
117
+ // Managed via the per-user "Platforms" accordion at /dashboard/users/[id].
118
+ // Existing user rows are backfilled to ['fb'] in the same migration that
119
+ // adds the column so nobody loses Facebook access on rollout.
120
+ Platforms: {
121
+ type: DataTypes.ARRAY(DataTypes.STRING),
122
+ allowNull: true,
123
+ defaultValue: ['fb'],
124
+ },
125
+ LastEntrance: {
126
+ type: DataTypes.DATE, // Array of organization IDs
127
+ allowNull: true,
128
+ defaultValue: [],
129
+ },
130
+ Status: {
131
+ type: DataTypes.STRING, // Array of organization IDs
132
+ allowNull: true,
133
+ },
134
+ access_all_files: {
135
+ type: DataTypes.BOOLEAN,
136
+ allowNull: true,
137
+ },
138
+ Domains: {
139
+ type: DataTypes.JSONB,
140
+ allowNull: true
141
+ },
142
+ ApiRateLimits: {
143
+ type: DataTypes.JSONB,
144
+ allowNull: true,
145
+ defaultValue: null,
146
+ // Per-user public API rate-limit override. Null = use system defaults
147
+ // (read 120, write 20, ai 3, dryRun 600 — all per minute), defined in
148
+ // server/middleware/publicApiRateLimit.js BUCKETS.
149
+ // Shape when set: { read: 200, write: 50, ai: 5, dryRun: 1000 } — any
150
+ // missing key falls back to the system default for that bucket.
151
+ },
152
+ managed_by: {
153
+ type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
154
+ allowNull: true,
155
+ references: {
156
+ model: "Users",
157
+ key: "id",
158
+ },
159
+ },
160
+ team_id: {
161
+ type: DataTypes.UUID,
162
+ allowNull: true,
163
+ references: {
164
+ model: "teams",
165
+ key: "id",
166
+ },
167
+ comment: "Optional single team this user belongs to",
168
+ },
169
+ },
170
+ {
171
+ tableName: "Users",
172
+ }
173
+ );
174
+
175
+ // Define associations for managed_by relationship
176
+ Users.associate = (models) => {
177
+ // A user can manage many users
178
+ Users.hasMany(models.Users, {
179
+ foreignKey: "managed_by",
180
+ as: "managedUsers",
181
+ });
182
+
183
+ // A user can only be managed by one user
184
+ Users.belongsTo(models.Users, {
185
+ foreignKey: "managed_by",
186
+ as: "manager",
187
+ });
188
+
189
+ // A user can have many presets
190
+ Users.hasMany(models.Presets, { foreignKey: "userId", as: "presets" });
191
+
192
+ Users.hasMany(models.CampaignTag, {
193
+ foreignKey: "created_by",
194
+ as: "createdCampaignTags",
195
+ });
196
+
197
+ Users.belongsTo(models.Team, {
198
+ foreignKey: "team_id",
199
+ as: "team",
200
+ });
201
+ };
202
+
203
+ return Users;
204
+ };
@@ -1,26 +1,26 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Vertical = sequelize.define(
3
- "Vertical",
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
- },
20
- {
21
- tableName: "Vertical",
22
- }
23
- );
24
-
25
- return Vertical;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Vertical = sequelize.define(
3
+ "Vertical",
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
+ },
20
+ {
21
+ tableName: "Vertical",
22
+ }
23
+ );
24
+
25
+ return Vertical;
26
26
  };