agrs-sequelize-sdk 1.3.65 → 1.3.68

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.
@@ -85,6 +85,12 @@ module.exports = (sequelize, DataTypes) => {
85
85
  field: "article_creation_payload",
86
86
  comment: "Payload sent for article creation (Mine/Predicto/Mobitech specific parameters)",
87
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
+ },
88
94
  },
89
95
  {
90
96
  tableName: "ai_campaign_queue",
@@ -0,0 +1,150 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AiArticleRetryQueue = sequelize.define(
3
+ "AiArticleRetryQueue",
4
+ {
5
+ id: {
6
+ type: DataTypes.INTEGER,
7
+ primaryKey: true,
8
+ autoIncrement: true,
9
+ },
10
+ agrs_cid: {
11
+ type: DataTypes.STRING(255),
12
+ allowNull: false,
13
+ field: "agrs_cid",
14
+ comment: "AGRS Campaign ID (links to the campaign combo)",
15
+ },
16
+ process_id: {
17
+ type: DataTypes.STRING(255),
18
+ allowNull: true,
19
+ field: "process_id",
20
+ comment: "Root process_id from createAICampaign",
21
+ },
22
+ controller_process_id: {
23
+ type: DataTypes.UUID,
24
+ allowNull: true,
25
+ field: "controller_process_id",
26
+ comment: "Per-campaign process_id (for CampaignCreationLog)",
27
+ },
28
+ feed_provider: {
29
+ type: DataTypes.STRING(100),
30
+ allowNull: false,
31
+ field: "feed_provider",
32
+ comment: "Normalized feed name: Mine - RSOC, Predicto - RSOC, etc.",
33
+ },
34
+ article_creation_payload: {
35
+ type: DataTypes.JSONB,
36
+ allowNull: false,
37
+ field: "article_creation_payload",
38
+ comment: "Exact params to pass to createMineArticle/createPredictoArticle/etc.",
39
+ },
40
+ original_payload: {
41
+ type: DataTypes.JSONB,
42
+ allowNull: true,
43
+ field: "original_payload",
44
+ comment: "Full original_payload from createAICampaign (preset, feed config, AI settings, combo values)",
45
+ },
46
+ generated_assets: {
47
+ type: DataTypes.JSONB,
48
+ allowNull: true,
49
+ field: "generated_assets",
50
+ comment: "Already-generated assets: { headlines, primaryTexts, bannerFiles, keywords }",
51
+ },
52
+ campaign_context: {
53
+ type: DataTypes.JSONB,
54
+ allowNull: true,
55
+ field: "campaign_context",
56
+ comment: "Additional context needed to resume campaign flow after article succeeds",
57
+ },
58
+ status: {
59
+ type: DataTypes.STRING(50),
60
+ allowNull: false,
61
+ defaultValue: "pending",
62
+ validate: {
63
+ isIn: [["pending", "processing", "completed", "failed", "abandoned"]],
64
+ },
65
+ },
66
+ retry_count: {
67
+ type: DataTypes.INTEGER,
68
+ allowNull: false,
69
+ defaultValue: 0,
70
+ field: "retry_count",
71
+ },
72
+ max_retries: {
73
+ type: DataTypes.INTEGER,
74
+ allowNull: false,
75
+ defaultValue: 10,
76
+ field: "max_retries",
77
+ },
78
+ next_retry_at: {
79
+ type: DataTypes.DATE,
80
+ allowNull: false,
81
+ field: "next_retry_at",
82
+ comment: "When the next retry should be attempted",
83
+ },
84
+ last_error: {
85
+ type: DataTypes.TEXT,
86
+ allowNull: true,
87
+ field: "last_error",
88
+ },
89
+ last_attempt_at: {
90
+ type: DataTypes.DATE,
91
+ allowNull: true,
92
+ field: "last_attempt_at",
93
+ },
94
+ created_at: {
95
+ type: DataTypes.DATE,
96
+ allowNull: false,
97
+ defaultValue: DataTypes.NOW,
98
+ field: "created_at",
99
+ },
100
+ completed_at: {
101
+ type: DataTypes.DATE,
102
+ allowNull: true,
103
+ field: "completed_at",
104
+ },
105
+ article_id: {
106
+ type: DataTypes.STRING(255),
107
+ allowNull: true,
108
+ field: "article_id",
109
+ comment: "AGRSAID of created article (populated on success)",
110
+ },
111
+ article_url: {
112
+ type: DataTypes.TEXT,
113
+ allowNull: true,
114
+ field: "article_url",
115
+ comment: "URL of created article (populated on success)",
116
+ },
117
+ },
118
+ {
119
+ tableName: "ai_article_retry_queue",
120
+ timestamps: false,
121
+ indexes: [
122
+ {
123
+ fields: ["status", "next_retry_at"],
124
+ name: "idx_article_retry_status_next",
125
+ },
126
+ {
127
+ fields: ["agrs_cid"],
128
+ },
129
+ {
130
+ fields: ["feed_provider"],
131
+ },
132
+ {
133
+ fields: ["process_id"],
134
+ },
135
+ {
136
+ fields: ["controller_process_id"],
137
+ },
138
+ {
139
+ fields: ["created_at"],
140
+ },
141
+ ],
142
+ }
143
+ );
144
+
145
+ AiArticleRetryQueue.associate = (models) => {
146
+ // No associations needed for now
147
+ };
148
+
149
+ return AiArticleRetryQueue;
150
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.3.65",
3
+ "version": "1.3.68",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",