agrs-sequelize-sdk 1.2.99 → 1.3.1

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 (47) hide show
  1. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  2. package/models/AdAccountValues.js +25 -25
  3. package/models/AdHistory.js +30 -30
  4. package/models/AdPerformance.js +94 -94
  5. package/models/AdSet.js +289 -289
  6. package/models/AdSetHistory.js +30 -30
  7. package/models/AdsetPerformance.js +126 -126
  8. package/models/Article.js +190 -190
  9. package/models/AutomationRule.js +161 -127
  10. package/models/Buyers.js +25 -25
  11. package/models/Campaign.js +157 -157
  12. package/models/CampaignActionHistory.js +86 -86
  13. package/models/CampaignCreationLog.js +309 -309
  14. package/models/CampaignHistory.js +33 -33
  15. package/models/Channel.js +55 -55
  16. package/models/Domain.js +25 -25
  17. package/models/DynamicFeed.js +212 -212
  18. package/models/ExplorAdsChannel.js +61 -61
  19. package/models/Feed.js +33 -33
  20. package/models/FrontStoryChannel.js +59 -59
  21. package/models/MineChannel.js +42 -42
  22. package/models/Pages.js +81 -81
  23. package/models/PipelineExecution.js +59 -59
  24. package/models/Presets.js +34 -34
  25. package/models/RSOCFeedCampaign.js +357 -357
  26. package/models/RsocKeywordPerformance.js +110 -110
  27. package/models/RuleAction.js +90 -90
  28. package/models/RuleCondition.js +98 -98
  29. package/models/RuleExecution.js +107 -107
  30. package/models/RulesValues.js +56 -56
  31. package/models/SupportedLocale.js +23 -23
  32. package/models/SyncHistory.js +249 -249
  33. package/models/Tier2_AdAccounts.js +110 -110
  34. package/models/Tier2_Assets.js +70 -70
  35. package/models/Tier2_BusinessManagers.js +105 -105
  36. package/models/Tier2_CreditLines.js +99 -99
  37. package/models/Tier2_Pages.js +91 -91
  38. package/models/Tier2_Pixels.js +82 -82
  39. package/models/Tier2_Tokens.js +64 -64
  40. package/models/Tier2_UserAdAccounts.js +83 -83
  41. package/models/TokenRotationState.js +121 -121
  42. package/models/TonicRSOCKeywordPerformance.js +122 -122
  43. package/models/Vertical.js +25 -25
  44. package/models/newFiles.js +110 -110
  45. package/package.json +19 -21
  46. package/run.sh +214 -214
  47. package/services/sequelizeService.js +63 -63
@@ -1,111 +1,111 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const RsocKeywordPerformance = sequelize.define('RsocKeywordPerformance', {
3
- id: {
4
- type: DataTypes.INTEGER,
5
- primaryKey: true,
6
- autoIncrement: true,
7
- allowNull: false
8
- },
9
- ts: {
10
- type: DataTypes.DATE,
11
- allowNull: false,
12
- comment: 'Timestamp of the record'
13
- },
14
- channel_id: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- comment: 'Channel identifier'
18
- },
19
- style_id: {
20
- type: DataTypes.STRING,
21
- allowNull: true,
22
- comment: 'Style identifier'
23
- },
24
- country_code: {
25
- type: DataTypes.STRING(2),
26
- allowNull: true,
27
- comment: 'Country code (ISO 2-letter)'
28
- },
29
- custom_query: {
30
- type: DataTypes.TEXT,
31
- allowNull: true,
32
- comment: 'Custom search query'
33
- },
34
- query: {
35
- type: DataTypes.TEXT,
36
- allowNull: true,
37
- comment: 'Standard search query'
38
- },
39
- funnel_page_views: {
40
- type: DataTypes.INTEGER,
41
- allowNull: true,
42
- defaultValue: 0,
43
- comment: 'Number of funnel page views'
44
- },
45
- funnel_impressions: {
46
- type: DataTypes.INTEGER,
47
- allowNull: true,
48
- defaultValue: 0,
49
- comment: 'Number of funnel impressions'
50
- },
51
- funnel_clicks: {
52
- type: DataTypes.INTEGER,
53
- allowNull: true,
54
- defaultValue: 0,
55
- comment: 'Number of funnel clicks'
56
- },
57
- page_views: {
58
- type: DataTypes.INTEGER,
59
- allowNull: true,
60
- defaultValue: 0,
61
- comment: 'Number of page views'
62
- },
63
- impressions: {
64
- type: DataTypes.INTEGER,
65
- allowNull: true,
66
- defaultValue: 0,
67
- comment: 'Number of impressions'
68
- },
69
- clicks: {
70
- type: DataTypes.INTEGER,
71
- allowNull: true,
72
- defaultValue: 0,
73
- comment: 'Number of clicks'
74
- },
75
- agrs_cid: {
76
- type: DataTypes.STRING,
77
- allowNull: true,
78
- comment: 'AGRS campaign identifier linking to campaign data'
79
- }
80
- }, {
81
- tableName: 'rsoc_keyword_performance',
82
- timestamps: true, // Adds createdAt and updatedAt columns
83
- indexes: [
84
- {
85
- fields: ['channel_id', 'ts'],
86
- name: 'idx_rsoc_keyword_channel_time'
87
- },
88
- {
89
- fields: ['style_id'],
90
- name: 'idx_rsoc_keyword_style'
91
- },
92
- {
93
- fields: ['country_code'],
94
- name: 'idx_rsoc_keyword_country'
95
- },
96
- {
97
- fields: ['agrs_cid'],
98
- name: 'idx_rsoc_keyword_agrs_cid'
99
- }
100
- ]
101
- });
102
-
103
- // Define associations if needed
104
- RsocKeywordPerformance.associate = (models) => {
105
- // Add associations here if your table needs to reference other tables
106
- // For example:
107
- // RsocKeywordPerformance.belongsTo(models.Channel, { foreignKey: 'channel_id' });
108
- };
109
-
110
- return RsocKeywordPerformance;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const RsocKeywordPerformance = sequelize.define('RsocKeywordPerformance', {
3
+ id: {
4
+ type: DataTypes.INTEGER,
5
+ primaryKey: true,
6
+ autoIncrement: true,
7
+ allowNull: false
8
+ },
9
+ ts: {
10
+ type: DataTypes.DATE,
11
+ allowNull: false,
12
+ comment: 'Timestamp of the record'
13
+ },
14
+ channel_id: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ comment: 'Channel identifier'
18
+ },
19
+ style_id: {
20
+ type: DataTypes.STRING,
21
+ allowNull: true,
22
+ comment: 'Style identifier'
23
+ },
24
+ country_code: {
25
+ type: DataTypes.STRING(2),
26
+ allowNull: true,
27
+ comment: 'Country code (ISO 2-letter)'
28
+ },
29
+ custom_query: {
30
+ type: DataTypes.TEXT,
31
+ allowNull: true,
32
+ comment: 'Custom search query'
33
+ },
34
+ query: {
35
+ type: DataTypes.TEXT,
36
+ allowNull: true,
37
+ comment: 'Standard search query'
38
+ },
39
+ funnel_page_views: {
40
+ type: DataTypes.INTEGER,
41
+ allowNull: true,
42
+ defaultValue: 0,
43
+ comment: 'Number of funnel page views'
44
+ },
45
+ funnel_impressions: {
46
+ type: DataTypes.INTEGER,
47
+ allowNull: true,
48
+ defaultValue: 0,
49
+ comment: 'Number of funnel impressions'
50
+ },
51
+ funnel_clicks: {
52
+ type: DataTypes.INTEGER,
53
+ allowNull: true,
54
+ defaultValue: 0,
55
+ comment: 'Number of funnel clicks'
56
+ },
57
+ page_views: {
58
+ type: DataTypes.INTEGER,
59
+ allowNull: true,
60
+ defaultValue: 0,
61
+ comment: 'Number of page views'
62
+ },
63
+ impressions: {
64
+ type: DataTypes.INTEGER,
65
+ allowNull: true,
66
+ defaultValue: 0,
67
+ comment: 'Number of impressions'
68
+ },
69
+ clicks: {
70
+ type: DataTypes.INTEGER,
71
+ allowNull: true,
72
+ defaultValue: 0,
73
+ comment: 'Number of clicks'
74
+ },
75
+ agrs_cid: {
76
+ type: DataTypes.STRING,
77
+ allowNull: true,
78
+ comment: 'AGRS campaign identifier linking to campaign data'
79
+ }
80
+ }, {
81
+ tableName: 'rsoc_keyword_performance',
82
+ timestamps: true, // Adds createdAt and updatedAt columns
83
+ indexes: [
84
+ {
85
+ fields: ['channel_id', 'ts'],
86
+ name: 'idx_rsoc_keyword_channel_time'
87
+ },
88
+ {
89
+ fields: ['style_id'],
90
+ name: 'idx_rsoc_keyword_style'
91
+ },
92
+ {
93
+ fields: ['country_code'],
94
+ name: 'idx_rsoc_keyword_country'
95
+ },
96
+ {
97
+ fields: ['agrs_cid'],
98
+ name: 'idx_rsoc_keyword_agrs_cid'
99
+ }
100
+ ]
101
+ });
102
+
103
+ // Define associations if needed
104
+ RsocKeywordPerformance.associate = (models) => {
105
+ // Add associations here if your table needs to reference other tables
106
+ // For example:
107
+ // RsocKeywordPerformance.belongsTo(models.Channel, { foreignKey: 'channel_id' });
108
+ };
109
+
110
+ return RsocKeywordPerformance;
111
111
  };
@@ -1,90 +1,90 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const RuleAction = sequelize.define(
5
- "RuleAction",
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 parent rule",
20
- },
21
- actionType: {
22
- type: DataTypes.ENUM(
23
- "PAUSE",
24
- "ACTIVATE",
25
- "CHANGE_BUDGET",
26
- "CHANGE_BID",
27
- "CHANGE_BID_STRATEGY",
28
- "CUSTOM_ACTION"
29
- ),
30
- allowNull: false,
31
- comment: "Type of action to perform",
32
- },
33
- targetLevel: {
34
- type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
35
- allowNull: false,
36
- comment: "Level at which the action operates",
37
- },
38
- value: {
39
- type: DataTypes.STRING(255),
40
- allowNull: true,
41
- comment: "Value for the action (budget amount, bid amount, etc.)",
42
- },
43
- valueType: {
44
- type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
45
- allowNull: true,
46
- defaultValue: "STRING",
47
- comment: "Type of the value field",
48
- },
49
- actionConfig: {
50
- type: DataTypes.JSONB,
51
- allowNull: true,
52
- comment:
53
- "Configuration for the action (budget amount, bid strategy, etc.)",
54
- },
55
- order: {
56
- type: DataTypes.INTEGER,
57
- allowNull: false,
58
- defaultValue: 0,
59
- comment: "Order of this action within the rule",
60
- },
61
- isActive: {
62
- type: DataTypes.BOOLEAN,
63
- defaultValue: true,
64
- allowNull: false,
65
- comment: "Whether this action is active",
66
- },
67
- delayMinutes: {
68
- type: DataTypes.INTEGER,
69
- allowNull: true,
70
- defaultValue: 0,
71
- comment: "Delay in minutes before executing this action",
72
- },
73
- },
74
- {
75
- tableName: "RuleActions",
76
- timestamps: true,
77
- // Remove indexes from model definition - they will be created by migration
78
- }
79
- );
80
-
81
- RuleAction.associate = (models) => {
82
- // An action belongs to a rule
83
- RuleAction.belongsTo(models.AutomationRule, {
84
- foreignKey: "ruleId",
85
- as: "rule",
86
- });
87
- };
88
-
89
- return RuleAction;
90
- };
1
+ const { DataTypes } = require("sequelize");
2
+
3
+ module.exports = (sequelize) => {
4
+ const RuleAction = sequelize.define(
5
+ "RuleAction",
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 parent rule",
20
+ },
21
+ actionType: {
22
+ type: DataTypes.ENUM(
23
+ "PAUSE",
24
+ "ACTIVATE",
25
+ "CHANGE_BUDGET",
26
+ "CHANGE_BID",
27
+ "CHANGE_BID_STRATEGY",
28
+ "CUSTOM_ACTION"
29
+ ),
30
+ allowNull: false,
31
+ comment: "Type of action to perform",
32
+ },
33
+ targetLevel: {
34
+ type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
35
+ allowNull: false,
36
+ comment: "Level at which the action operates",
37
+ },
38
+ value: {
39
+ type: DataTypes.STRING(255),
40
+ allowNull: true,
41
+ comment: "Value for the action (budget amount, bid amount, etc.)",
42
+ },
43
+ valueType: {
44
+ type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
45
+ allowNull: true,
46
+ defaultValue: "STRING",
47
+ comment: "Type of the value field",
48
+ },
49
+ actionConfig: {
50
+ type: DataTypes.JSONB,
51
+ allowNull: true,
52
+ comment:
53
+ "Configuration for the action (budget amount, bid strategy, etc.)",
54
+ },
55
+ order: {
56
+ type: DataTypes.INTEGER,
57
+ allowNull: false,
58
+ defaultValue: 0,
59
+ comment: "Order of this action within the rule",
60
+ },
61
+ isActive: {
62
+ type: DataTypes.BOOLEAN,
63
+ defaultValue: true,
64
+ allowNull: false,
65
+ comment: "Whether this action is active",
66
+ },
67
+ delayMinutes: {
68
+ type: DataTypes.INTEGER,
69
+ allowNull: true,
70
+ defaultValue: 0,
71
+ comment: "Delay in minutes before executing this action",
72
+ },
73
+ },
74
+ {
75
+ tableName: "RuleActions",
76
+ timestamps: true,
77
+ // Remove indexes from model definition - they will be created by migration
78
+ }
79
+ );
80
+
81
+ RuleAction.associate = (models) => {
82
+ // An action belongs to a rule
83
+ RuleAction.belongsTo(models.AutomationRule, {
84
+ foreignKey: "ruleId",
85
+ as: "rule",
86
+ });
87
+ };
88
+
89
+ return RuleAction;
90
+ };
@@ -1,98 +1,98 @@
1
- const { DataTypes } = require("sequelize");
2
-
3
- module.exports = (sequelize) => {
4
- const RuleCondition = sequelize.define(
5
- "RuleCondition",
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 parent rule",
20
- },
21
- field: {
22
- type: DataTypes.STRING(100),
23
- allowNull: false,
24
- comment: "Field to evaluate (e.g., roi, ctr, campaign_name)",
25
- },
26
- type: {
27
- type: DataTypes.ENUM("DIMENSION", "METRIC"),
28
- allowNull: false,
29
- defaultValue: "DIMENSION",
30
- comment: "Type of field - DIMENSION for filtering, METRIC for calculations",
31
- },
32
- operator: {
33
- type: DataTypes.ENUM(
34
- "EQUALS",
35
- "NOT_EQUALS",
36
- "GREATER_THAN",
37
- "LESS_THAN",
38
- "GREATER_THAN_OR_EQUAL",
39
- "LESS_THAN_OR_EQUAL",
40
- "BETWEEN",
41
- "IN",
42
- "NOT_IN",
43
- "CONTAINS",
44
- "NOT_CONTAINS",
45
- "IS_NULL",
46
- "IS_NOT_NULL"
47
- ),
48
- allowNull: false,
49
- comment: "Comparison operator",
50
- },
51
- value: {
52
- type: DataTypes.JSONB,
53
- allowNull: true,
54
- comment:
55
- "Value(s) to compare against (can be array for BETWEEN, IN, etc.)",
56
- },
57
- valueType: {
58
- type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
59
- allowNull: true,
60
- defaultValue: "STRING",
61
- comment: "Type of the value field",
62
- },
63
- logicalOperator: {
64
- type: DataTypes.ENUM("AND", "OR"),
65
- allowNull: false,
66
- defaultValue: "AND",
67
- comment: "How this condition connects to the next one",
68
- },
69
- order: {
70
- type: DataTypes.INTEGER,
71
- allowNull: false,
72
- defaultValue: 0,
73
- comment: "Order of this condition within the rule",
74
- },
75
- isActive: {
76
- type: DataTypes.BOOLEAN,
77
- defaultValue: true,
78
- allowNull: false,
79
- comment: "Whether this condition is active",
80
- },
81
- },
82
- {
83
- tableName: "RuleConditions",
84
- timestamps: true,
85
- // Remove indexes from model definition - they will be created by migration
86
- }
87
- );
88
-
89
- RuleCondition.associate = (models) => {
90
- // A condition belongs to a rule
91
- RuleCondition.belongsTo(models.AutomationRule, {
92
- foreignKey: "ruleId",
93
- as: "rule",
94
- });
95
- };
96
-
97
- return RuleCondition;
98
- };
1
+ const { DataTypes } = require("sequelize");
2
+
3
+ module.exports = (sequelize) => {
4
+ const RuleCondition = sequelize.define(
5
+ "RuleCondition",
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 parent rule",
20
+ },
21
+ field: {
22
+ type: DataTypes.STRING(100),
23
+ allowNull: false,
24
+ comment: "Field to evaluate (e.g., roi, ctr, campaign_name)",
25
+ },
26
+ type: {
27
+ type: DataTypes.ENUM("DIMENSION", "METRIC"),
28
+ allowNull: false,
29
+ defaultValue: "DIMENSION",
30
+ comment: "Type of field - DIMENSION for filtering, METRIC for calculations",
31
+ },
32
+ operator: {
33
+ type: DataTypes.ENUM(
34
+ "EQUALS",
35
+ "NOT_EQUALS",
36
+ "GREATER_THAN",
37
+ "LESS_THAN",
38
+ "GREATER_THAN_OR_EQUAL",
39
+ "LESS_THAN_OR_EQUAL",
40
+ "BETWEEN",
41
+ "IN",
42
+ "NOT_IN",
43
+ "CONTAINS",
44
+ "NOT_CONTAINS",
45
+ "IS_NULL",
46
+ "IS_NOT_NULL"
47
+ ),
48
+ allowNull: false,
49
+ comment: "Comparison operator",
50
+ },
51
+ value: {
52
+ type: DataTypes.JSONB,
53
+ allowNull: true,
54
+ comment:
55
+ "Value(s) to compare against (can be array for BETWEEN, IN, etc.)",
56
+ },
57
+ valueType: {
58
+ type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
59
+ allowNull: true,
60
+ defaultValue: "STRING",
61
+ comment: "Type of the value field",
62
+ },
63
+ logicalOperator: {
64
+ type: DataTypes.ENUM("AND", "OR"),
65
+ allowNull: false,
66
+ defaultValue: "AND",
67
+ comment: "How this condition connects to the next one",
68
+ },
69
+ order: {
70
+ type: DataTypes.INTEGER,
71
+ allowNull: false,
72
+ defaultValue: 0,
73
+ comment: "Order of this condition within the rule",
74
+ },
75
+ isActive: {
76
+ type: DataTypes.BOOLEAN,
77
+ defaultValue: true,
78
+ allowNull: false,
79
+ comment: "Whether this condition is active",
80
+ },
81
+ },
82
+ {
83
+ tableName: "RuleConditions",
84
+ timestamps: true,
85
+ // Remove indexes from model definition - they will be created by migration
86
+ }
87
+ );
88
+
89
+ RuleCondition.associate = (models) => {
90
+ // A condition belongs to a rule
91
+ RuleCondition.belongsTo(models.AutomationRule, {
92
+ foreignKey: "ruleId",
93
+ as: "rule",
94
+ });
95
+ };
96
+
97
+ return RuleCondition;
98
+ };