agrs-sequelize-sdk 1.4.13 → 1.4.15

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 (65) hide show
  1. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  2. package/migrations/change-adset-name-to-text.js +79 -79
  3. package/models/AICampaignQueue.js +136 -136
  4. package/models/AIGenerationLog.js +85 -85
  5. package/models/AIGenerationRequest.js +212 -212
  6. package/models/AdAccountValues.js +25 -25
  7. package/models/AdHistory.js +30 -30
  8. package/models/AdPerformance.js +94 -94
  9. package/models/AdSet.js +289 -289
  10. package/models/AdSetHistory.js +30 -30
  11. package/models/AdsetPerformance.js +126 -126
  12. package/models/AiArticleRetryQueue.js +150 -150
  13. package/models/AiCreationRetryQueue.js +127 -127
  14. package/models/Article.js +206 -206
  15. package/models/AutomationRule.js +173 -173
  16. package/models/BannerTemplate.js +129 -129
  17. package/models/Buyers.js +25 -25
  18. package/models/Campaign.js +157 -157
  19. package/models/CampaignActionHistory.js +86 -86
  20. package/models/CampaignCreationLog.js +309 -309
  21. package/models/CampaignCreationLogV2.js +314 -314
  22. package/models/CampaignHistory.js +33 -33
  23. package/models/Channel.js +55 -55
  24. package/models/Domain.js +39 -43
  25. package/models/DynamicFeed.js +212 -212
  26. package/models/ExplorAdsChannel.js +61 -61
  27. package/models/FacebookRetryQueue.js +156 -156
  28. package/models/Feed.js +33 -33
  29. package/models/FeedArticleConfiguration.js +80 -80
  30. package/models/FrontStoryChannel.js +59 -59
  31. package/models/FrontStoryChannelV2.js +60 -60
  32. package/models/GenericFlowRequest.js +114 -114
  33. package/models/MidoWebChannel.js +47 -47
  34. package/models/MineChannel.js +42 -42
  35. package/models/Pages.js +99 -99
  36. package/models/PipelineExecution.js +59 -59
  37. package/models/PolicyDogsCreativeCache.js +50 -50
  38. package/models/PolicyDogsImageCache.js +30 -30
  39. package/models/Presets.js +34 -34
  40. package/models/RSOCFeedCampaign.js +375 -375
  41. package/models/RsocKeywordPerformance.js +110 -110
  42. package/models/RuleAction.js +90 -90
  43. package/models/RuleCondition.js +137 -137
  44. package/models/RuleExecution.js +107 -107
  45. package/models/RulesValues.js +56 -56
  46. package/models/SupportedLocale.js +23 -23
  47. package/models/SyncHistory.js +249 -249
  48. package/models/TTQChannel.js +42 -42
  49. package/models/TemplateMetadata.js +260 -260
  50. package/models/Tier2_AdAccounts.js +110 -110
  51. package/models/Tier2_Assets.js +70 -70
  52. package/models/Tier2_BusinessManagers.js +105 -105
  53. package/models/Tier2_CreditLines.js +99 -99
  54. package/models/Tier2_Pages.js +91 -91
  55. package/models/Tier2_Pixels.js +82 -82
  56. package/models/Tier2_Tokens.js +64 -64
  57. package/models/Tier2_UserAdAccounts.js +83 -83
  58. package/models/TokenRotationState.js +121 -121
  59. package/models/TonicRSOCKeywordPerformance.js +122 -122
  60. package/models/Users.js +148 -148
  61. package/models/Vertical.js +25 -25
  62. package/models/newFiles.js +137 -137
  63. package/package.json +21 -19
  64. package/run.sh +214 -214
  65. package/services/sequelizeService.js +110 -110
package/models/Users.js CHANGED
@@ -1,148 +1,148 @@
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
- Accounts: {
44
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
45
- allowNull: true,
46
- defaultValue: [],
47
- },
48
- MediaBuyers: {
49
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
50
- allowNull: true,
51
- defaultValue: [],
52
- },
53
- Pages: {
54
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
55
- allowNull: true,
56
- defaultValue: [],
57
- },
58
- FeedProvider: {
59
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of static feed names (predicto, mine, etc.)
60
- allowNull: true,
61
- defaultValue: [],
62
- },
63
- DynamicFeedIds: {
64
- type: DataTypes.ARRAY(DataTypes.UUID), // Array of UUIDs referencing dynamic_feeds.id
65
- allowNull: true,
66
- defaultValue: [],
67
- },
68
- Organization: {
69
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
70
- allowNull: true,
71
- defaultValue: [],
72
- },
73
- Tier2Accounts: {
74
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of Tier2 Ad Account Facebook IDs
75
- allowNull: true,
76
- defaultValue: [],
77
- },
78
- AccountsView: {
79
- type: DataTypes.ARRAY(DataTypes.STRING),
80
- allowNull: true,
81
- defaultValue: [],
82
- },
83
- AccountsEdit: {
84
- type: DataTypes.ARRAY(DataTypes.STRING),
85
- allowNull: true,
86
- defaultValue: [],
87
- },
88
- AccountsAI: {
89
- type: DataTypes.ARRAY(DataTypes.STRING),
90
- allowNull: true,
91
- defaultValue: [],
92
- },
93
- Pixels: {
94
- type: DataTypes.ARRAY(DataTypes.STRING), // Array of pixel ids
95
- allowNull: true,
96
- defaultValue: [],
97
- },
98
- LastEntrance: {
99
- type: DataTypes.DATE, // Array of organization IDs
100
- allowNull: true,
101
- defaultValue: [],
102
- },
103
- Status: {
104
- type: DataTypes.STRING, // Array of organization IDs
105
- allowNull: true,
106
- },
107
- access_all_files: {
108
- type: DataTypes.BOOLEAN,
109
- allowNull: true,
110
- },
111
- Domains: {
112
- type: DataTypes.JSONB,
113
- allowNull: true
114
- },
115
- managed_by: {
116
- type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
117
- allowNull: true,
118
- references: {
119
- model: "Users",
120
- key: "id",
121
- },
122
- },
123
- },
124
- {
125
- tableName: "Users",
126
- }
127
- );
128
-
129
- // Define associations for managed_by relationship
130
- Users.associate = (models) => {
131
- // A user can manage many users
132
- Users.hasMany(models.Users, {
133
- foreignKey: "managed_by",
134
- as: "managedUsers",
135
- });
136
-
137
- // A user can only be managed by one user
138
- Users.belongsTo(models.Users, {
139
- foreignKey: "managed_by",
140
- as: "manager",
141
- });
142
-
143
- // A user can have many presets
144
- Users.hasMany(models.Presets, { foreignKey: "userId", as: "presets" });
145
- };
146
-
147
- return Users;
148
- };
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
+ Accounts: {
44
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
45
+ allowNull: true,
46
+ defaultValue: [],
47
+ },
48
+ MediaBuyers: {
49
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
50
+ allowNull: true,
51
+ defaultValue: [],
52
+ },
53
+ Pages: {
54
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of account IDs
55
+ allowNull: true,
56
+ defaultValue: [],
57
+ },
58
+ FeedProvider: {
59
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of static feed names (predicto, mine, etc.)
60
+ allowNull: true,
61
+ defaultValue: [],
62
+ },
63
+ DynamicFeedIds: {
64
+ type: DataTypes.ARRAY(DataTypes.UUID), // Array of UUIDs referencing dynamic_feeds.id
65
+ allowNull: true,
66
+ defaultValue: [],
67
+ },
68
+ Organization: {
69
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of organization IDs
70
+ allowNull: true,
71
+ defaultValue: [],
72
+ },
73
+ Tier2Accounts: {
74
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of Tier2 Ad Account Facebook IDs
75
+ allowNull: true,
76
+ defaultValue: [],
77
+ },
78
+ AccountsView: {
79
+ type: DataTypes.ARRAY(DataTypes.STRING),
80
+ allowNull: true,
81
+ defaultValue: [],
82
+ },
83
+ AccountsEdit: {
84
+ type: DataTypes.ARRAY(DataTypes.STRING),
85
+ allowNull: true,
86
+ defaultValue: [],
87
+ },
88
+ AccountsAI: {
89
+ type: DataTypes.ARRAY(DataTypes.STRING),
90
+ allowNull: true,
91
+ defaultValue: [],
92
+ },
93
+ Pixels: {
94
+ type: DataTypes.ARRAY(DataTypes.STRING), // Array of pixel ids
95
+ allowNull: true,
96
+ defaultValue: [],
97
+ },
98
+ LastEntrance: {
99
+ type: DataTypes.DATE, // Array of organization IDs
100
+ allowNull: true,
101
+ defaultValue: [],
102
+ },
103
+ Status: {
104
+ type: DataTypes.STRING, // Array of organization IDs
105
+ allowNull: true,
106
+ },
107
+ access_all_files: {
108
+ type: DataTypes.BOOLEAN,
109
+ allowNull: true,
110
+ },
111
+ Domains: {
112
+ type: DataTypes.JSONB,
113
+ allowNull: true
114
+ },
115
+ managed_by: {
116
+ type: DataTypes.UUID, // A UUID to store the ID of the user who manages this user
117
+ allowNull: true,
118
+ references: {
119
+ model: "Users",
120
+ key: "id",
121
+ },
122
+ },
123
+ },
124
+ {
125
+ tableName: "Users",
126
+ }
127
+ );
128
+
129
+ // Define associations for managed_by relationship
130
+ Users.associate = (models) => {
131
+ // A user can manage many users
132
+ Users.hasMany(models.Users, {
133
+ foreignKey: "managed_by",
134
+ as: "managedUsers",
135
+ });
136
+
137
+ // A user can only be managed by one user
138
+ Users.belongsTo(models.Users, {
139
+ foreignKey: "managed_by",
140
+ as: "manager",
141
+ });
142
+
143
+ // A user can have many presets
144
+ Users.hasMany(models.Presets, { foreignKey: "userId", as: "presets" });
145
+ };
146
+
147
+ return Users;
148
+ };
@@ -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
  };
@@ -1,137 +1,137 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const NewFiles = sequelize.define("NewFiles", {
3
- id: {
4
- type: DataTypes.STRING,
5
- primaryKey: true,
6
- },
7
- accounts: {
8
- type: DataTypes.JSONB(),
9
- allowNull: true,
10
- },
11
- name: {
12
- type: DataTypes.STRING,
13
- allowNull: false,
14
- },
15
- // need to add a field of the name in the gcp bucket
16
- gcpFileName: {
17
- type: DataTypes.STRING,
18
- allowNull: true,
19
- },
20
- type: {
21
- type: DataTypes.STRING, // Can be "image" or "video"
22
- allowNull: false,
23
- },
24
- URL: {
25
- type: DataTypes.STRING, // URL for the file
26
- allowNull: false,
27
- },
28
- FileType: {
29
- type: DataTypes.STRING,
30
- allowNull: true,
31
- defaultValue: "image",
32
- },
33
- Size: {
34
- type: DataTypes.STRING,
35
- allowNull: true,
36
- },
37
- Language: {
38
- type: DataTypes.STRING,
39
- allowNull: true,
40
- },
41
- Vertical: {
42
- type: DataTypes.STRING,
43
- allowNull: true,
44
- },
45
- // want to add length ( duration of the video) if the file is a video.
46
- // maybe call it duration
47
- Duration: {
48
- type: DataTypes.STRING,
49
- allowNull: true,
50
- },
51
- // Thumbnail URL
52
- Thumbnail: {
53
- type: DataTypes.TEXT,
54
- allowNull: true,
55
- },
56
- Thumbnai2: {
57
- type: DataTypes.TEXT,
58
- allowNull: true,
59
- },
60
- // ImageHash
61
- ImageHash: {
62
- type: DataTypes.STRING,
63
- allowNull: true,
64
- },
65
- isGenerated: {
66
- type: DataTypes.BOOLEAN,
67
- allowNull: true,
68
- defaultValue: false,
69
- },
70
- isUploading: {
71
- type: DataTypes.BOOLEAN,
72
- allowNull: true,
73
- defaultValue: false,
74
- },
75
- freeText: {
76
- type: DataTypes.STRING,
77
- allowNull: true,
78
- },
79
- style: {
80
- type: DataTypes.STRING,
81
- allowNull: true,
82
- },
83
- ratio: {
84
- type: DataTypes.STRING,
85
- allowNull: true,
86
- },
87
- notes: {
88
- type: DataTypes.STRING(1000),
89
- allowNull: true,
90
- },
91
- headline: {
92
- type: DataTypes.STRING(1000),
93
- allowNull: true,
94
- },
95
- subtext: {
96
- type: DataTypes.STRING(1000),
97
- allowNull: true,
98
- },
99
- cta: {
100
- type: DataTypes.STRING(1000),
101
- allowNull: true,
102
- },
103
- script: {
104
- type: DataTypes.STRING(1000),
105
- allowNull: true,
106
- },
107
- extractedText: {
108
- type: DataTypes.TEXT,
109
- allowNull: true,
110
- comment: 'Text extracted from image/video using Gemini Vision API',
111
- },
112
- // AI Generation Settings - stores all generation parameters for AI-generated files
113
- generationSettings: {
114
- type: DataTypes.JSONB,
115
- allowNull: true,
116
- comment: 'Generation settings from AdvancedCreativeGenerator (style, colors, layout, etc.)',
117
- },
118
- // AI Generation Request ID - link to AIGenerationRequest table
119
- generationRequestId: {
120
- type: DataTypes.STRING,
121
- allowNull: true,
122
- comment: 'Request ID from AIGenerationRequest table if this file was AI-generated',
123
- },
124
- });
125
-
126
- // ✅ Associations
127
- NewFiles.associate = function (models) {
128
- // File belongs to a generation request
129
- NewFiles.belongsTo(models.AIGenerationRequest, {
130
- foreignKey: "generationRequestId",
131
- targetKey: "requestId",
132
- as: "generationRequest",
133
- });
134
- };
135
-
136
- return NewFiles;
137
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const NewFiles = sequelize.define("NewFiles", {
3
+ id: {
4
+ type: DataTypes.STRING,
5
+ primaryKey: true,
6
+ },
7
+ accounts: {
8
+ type: DataTypes.JSONB(),
9
+ allowNull: true,
10
+ },
11
+ name: {
12
+ type: DataTypes.STRING,
13
+ allowNull: false,
14
+ },
15
+ // need to add a field of the name in the gcp bucket
16
+ gcpFileName: {
17
+ type: DataTypes.STRING,
18
+ allowNull: true,
19
+ },
20
+ type: {
21
+ type: DataTypes.STRING, // Can be "image" or "video"
22
+ allowNull: false,
23
+ },
24
+ URL: {
25
+ type: DataTypes.STRING, // URL for the file
26
+ allowNull: false,
27
+ },
28
+ FileType: {
29
+ type: DataTypes.STRING,
30
+ allowNull: true,
31
+ defaultValue: "image",
32
+ },
33
+ Size: {
34
+ type: DataTypes.STRING,
35
+ allowNull: true,
36
+ },
37
+ Language: {
38
+ type: DataTypes.STRING,
39
+ allowNull: true,
40
+ },
41
+ Vertical: {
42
+ type: DataTypes.STRING,
43
+ allowNull: true,
44
+ },
45
+ // want to add length ( duration of the video) if the file is a video.
46
+ // maybe call it duration
47
+ Duration: {
48
+ type: DataTypes.STRING,
49
+ allowNull: true,
50
+ },
51
+ // Thumbnail URL
52
+ Thumbnail: {
53
+ type: DataTypes.TEXT,
54
+ allowNull: true,
55
+ },
56
+ Thumbnai2: {
57
+ type: DataTypes.TEXT,
58
+ allowNull: true,
59
+ },
60
+ // ImageHash
61
+ ImageHash: {
62
+ type: DataTypes.STRING,
63
+ allowNull: true,
64
+ },
65
+ isGenerated: {
66
+ type: DataTypes.BOOLEAN,
67
+ allowNull: true,
68
+ defaultValue: false,
69
+ },
70
+ isUploading: {
71
+ type: DataTypes.BOOLEAN,
72
+ allowNull: true,
73
+ defaultValue: false,
74
+ },
75
+ freeText: {
76
+ type: DataTypes.STRING,
77
+ allowNull: true,
78
+ },
79
+ style: {
80
+ type: DataTypes.STRING,
81
+ allowNull: true,
82
+ },
83
+ ratio: {
84
+ type: DataTypes.STRING,
85
+ allowNull: true,
86
+ },
87
+ notes: {
88
+ type: DataTypes.STRING(1000),
89
+ allowNull: true,
90
+ },
91
+ headline: {
92
+ type: DataTypes.STRING(1000),
93
+ allowNull: true,
94
+ },
95
+ subtext: {
96
+ type: DataTypes.STRING(1000),
97
+ allowNull: true,
98
+ },
99
+ cta: {
100
+ type: DataTypes.STRING(1000),
101
+ allowNull: true,
102
+ },
103
+ script: {
104
+ type: DataTypes.STRING(1000),
105
+ allowNull: true,
106
+ },
107
+ extractedText: {
108
+ type: DataTypes.TEXT,
109
+ allowNull: true,
110
+ comment: 'Text extracted from image/video using Gemini Vision API',
111
+ },
112
+ // AI Generation Settings - stores all generation parameters for AI-generated files
113
+ generationSettings: {
114
+ type: DataTypes.JSONB,
115
+ allowNull: true,
116
+ comment: 'Generation settings from AdvancedCreativeGenerator (style, colors, layout, etc.)',
117
+ },
118
+ // AI Generation Request ID - link to AIGenerationRequest table
119
+ generationRequestId: {
120
+ type: DataTypes.STRING,
121
+ allowNull: true,
122
+ comment: 'Request ID from AIGenerationRequest table if this file was AI-generated',
123
+ },
124
+ });
125
+
126
+ // ✅ Associations
127
+ NewFiles.associate = function (models) {
128
+ // File belongs to a generation request
129
+ NewFiles.belongsTo(models.AIGenerationRequest, {
130
+ foreignKey: "generationRequestId",
131
+ targetKey: "requestId",
132
+ as: "generationRequest",
133
+ });
134
+ };
135
+
136
+ return NewFiles;
137
+ };
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
- {
2
- "name": "agrs-sequelize-sdk",
3
- "version": "1.4.13",
4
- "main": "index.js",
5
- "scripts": {
6
- "start": "node index.js",
7
- "sync": "node services/sequelizeService.js",
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
- "keywords": [],
11
- "author": "",
12
- "license": "ISC",
13
- "description": "",
14
- "dependencies": {
15
- "pg": "^8.13.0",
16
- "pg-hstore": "^2.3.4",
17
- "sequelize": "^6.37.4"
18
- }
19
- }
1
+ {
2
+ "name": "agrs-sequelize-sdk",
3
+ "version": "1.4.15",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "start": "node index.js",
7
+ "sync": "node services/sequelizeService.js",
8
+ "test": "echo \"Error: no test specified\" \u0026\u0026 exit 1"
9
+ },
10
+ "keywords": [
11
+
12
+ ],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "description": "",
16
+ "dependencies": {
17
+ "pg": "^8.13.0",
18
+ "pg-hstore": "^2.3.4",
19
+ "sequelize": "^6.37.4"
20
+ }
21
+ }