agrs-sequelize-sdk 1.3.86 → 1.3.88

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.
@@ -0,0 +1,127 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AiCreationRetryQueue = sequelize.define(
3
+ "AiCreationRetryQueue",
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-combination 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
+ failed_step: {
35
+ type: DataTypes.STRING(50),
36
+ allowNull: false,
37
+ field: "failed_step",
38
+ comment:
39
+ "Step that failed: keywords, texts, banners, fb_creation, rabbitmq_publish",
40
+ },
41
+ original_payload: {
42
+ type: DataTypes.JSONB,
43
+ allowNull: false,
44
+ field: "original_payload",
45
+ comment: "Full combination payload for retry",
46
+ },
47
+ generated_assets: {
48
+ type: DataTypes.JSONB,
49
+ allowNull: true,
50
+ defaultValue: {},
51
+ field: "generated_assets",
52
+ comment:
53
+ "Assets generated before failure: { keywords, headlines, primaryTexts, bannerFiles }",
54
+ },
55
+ campaign_context: {
56
+ type: DataTypes.JSONB,
57
+ allowNull: true,
58
+ defaultValue: {},
59
+ field: "campaign_context",
60
+ comment:
61
+ "Additional context needed to resume campaign flow after retry",
62
+ },
63
+ status: {
64
+ type: DataTypes.STRING(50),
65
+ allowNull: false,
66
+ defaultValue: "pending",
67
+ validate: {
68
+ isIn: [["pending", "processing", "completed", "failed", "abandoned"]],
69
+ },
70
+ },
71
+ retry_count: {
72
+ type: DataTypes.INTEGER,
73
+ allowNull: false,
74
+ defaultValue: 0,
75
+ field: "retry_count",
76
+ },
77
+ max_retries: {
78
+ type: DataTypes.INTEGER,
79
+ allowNull: false,
80
+ defaultValue: 5,
81
+ field: "max_retries",
82
+ },
83
+ next_retry_at: {
84
+ type: DataTypes.DATE,
85
+ allowNull: false,
86
+ field: "next_retry_at",
87
+ comment: "When the next retry should be attempted",
88
+ },
89
+ last_error: {
90
+ type: DataTypes.TEXT,
91
+ allowNull: true,
92
+ field: "last_error",
93
+ },
94
+ last_attempt_at: {
95
+ type: DataTypes.DATE,
96
+ allowNull: true,
97
+ field: "last_attempt_at",
98
+ },
99
+ completed_at: {
100
+ type: DataTypes.DATE,
101
+ allowNull: true,
102
+ field: "completed_at",
103
+ },
104
+ },
105
+ {
106
+ tableName: "ai_creation_retry_queue",
107
+ timestamps: true,
108
+ underscored: true,
109
+ indexes: [
110
+ {
111
+ fields: ["status", "next_retry_at"],
112
+ name: "idx_creation_retry_status_next",
113
+ },
114
+ {
115
+ fields: ["agrs_cid"],
116
+ name: "idx_creation_retry_agrs_cid",
117
+ },
118
+ ],
119
+ }
120
+ );
121
+
122
+ AiCreationRetryQueue.associate = (models) => {
123
+ // No associations needed for now
124
+ };
125
+
126
+ return AiCreationRetryQueue;
127
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.3.86",
3
+ "version": "1.3.88",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",