agrs-sequelize-sdk 1.2.78 → 1.2.80

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.
@@ -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,92 +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
- operator: {
27
- type: DataTypes.ENUM(
28
- "eq",
29
- "ne",
30
- "gt",
31
- "lt",
32
- "gte",
33
- "lte",
34
- "between",
35
- "in",
36
- "not_in",
37
- "contains",
38
- "not_contains",
39
- "is_null",
40
- "is_not_null"
41
- ),
42
- allowNull: false,
43
- comment: "Comparison operator",
44
- },
45
- value: {
46
- type: DataTypes.JSONB,
47
- allowNull: true,
48
- comment:
49
- "Value(s) to compare against (can be array for BETWEEN, IN, etc.)",
50
- },
51
- valueType: {
52
- type: DataTypes.ENUM("STRING", "NUMBER", "ARRAY"),
53
- allowNull: true,
54
- defaultValue: "STRING",
55
- comment: "Type of the value field",
56
- },
57
- logicalOperator: {
58
- type: DataTypes.ENUM("AND", "OR"),
59
- allowNull: false,
60
- defaultValue: "AND",
61
- comment: "How this condition connects to the next one",
62
- },
63
- order: {
64
- type: DataTypes.INTEGER,
65
- allowNull: false,
66
- defaultValue: 0,
67
- comment: "Order of this condition within the rule",
68
- },
69
- isActive: {
70
- type: DataTypes.BOOLEAN,
71
- defaultValue: true,
72
- allowNull: false,
73
- comment: "Whether this condition is active",
74
- },
75
- },
76
- {
77
- tableName: "RuleConditions",
78
- timestamps: true,
79
- // Remove indexes from model definition - they will be created by migration
80
- }
81
- );
82
-
83
- RuleCondition.associate = (models) => {
84
- // A condition belongs to a rule
85
- RuleCondition.belongsTo(models.AutomationRule, {
86
- foreignKey: "ruleId",
87
- as: "rule",
88
- });
89
- };
90
-
91
- return RuleCondition;
92
- };
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
+ };