agrs-sequelize-sdk 1.4.34 → 1.4.36

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 @@
1
+ {"version":1,"sessions":{}}
@@ -0,0 +1,53 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ /**
3
+ * Durable audit log of every inbound Mine webhook call (article-ready / policy-decision).
4
+ * Purpose: observability, security audit (signature failures), idempotency, replay/reconcile.
5
+ * Correlation is by string ids (provider_id / adset_id / ad_id) — no FK, to stay decoupled
6
+ * from the article/ad lifecycle and tolerate webhooks that arrive before the local row exists.
7
+ */
8
+ const MineWebhookEvent = sequelize.define(
9
+ "MineWebhookEvent",
10
+ {
11
+ id: {
12
+ type: DataTypes.INTEGER,
13
+ primaryKey: true,
14
+ autoIncrement: true,
15
+ },
16
+ event_id: { type: DataTypes.STRING, allowNull: true }, // Mine's unique id (idempotency)
17
+ event_type: { type: DataTypes.STRING, allowNull: false }, // 'article-ready' | 'policy-decision'
18
+ endpoint: { type: DataTypes.STRING, allowNull: true },
19
+ source_ip: { type: DataTypes.STRING, allowNull: true },
20
+
21
+ signature_valid: { type: DataTypes.BOOLEAN, allowNull: true },
22
+ http_status: { type: DataTypes.INTEGER, allowNull: true },
23
+
24
+ payload: { type: DataTypes.JSONB, allowNull: true },
25
+
26
+ provider_id: { type: DataTypes.STRING, allowNull: true },
27
+ adset_id: { type: DataTypes.STRING, allowNull: true },
28
+ ad_id: { type: DataTypes.STRING, allowNull: true },
29
+ matched_agrsaid: { type: DataTypes.STRING, allowNull: true },
30
+
31
+ // received | processed | skipped | duplicate | rejected_signature | rejected_validation | failed
32
+ outcome: { type: DataTypes.STRING, allowNull: false, defaultValue: "received" },
33
+ outcome_reason: { type: DataTypes.TEXT, allowNull: true },
34
+
35
+ received_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
36
+ processed_at: { type: DataTypes.DATE, allowNull: true },
37
+ duration_ms: { type: DataTypes.INTEGER, allowNull: true },
38
+ },
39
+ {
40
+ tableName: "mine_webhook_events",
41
+ indexes: [
42
+ { fields: ["event_id"] },
43
+ { fields: ["event_type"] },
44
+ { fields: ["outcome"] },
45
+ { fields: ["provider_id"] },
46
+ { fields: ["adset_id"] },
47
+ { fields: [{ name: "received_at", order: "DESC" }] },
48
+ ],
49
+ }
50
+ );
51
+
52
+ return MineWebhookEvent;
53
+ };
@@ -36,6 +36,13 @@ module.exports = (sequelize, DataTypes) => {
36
36
  comment:
37
37
  "Rotation weight. Higher tier => higher probability of being picked.",
38
38
  },
39
+ feed_provider: {
40
+ type: DataTypes.ARRAY(DataTypes.STRING),
41
+ allowNull: false,
42
+ defaultValue: [],
43
+ comment:
44
+ "Feeds this profile can serve (e.g. ['Mine - RSOC'], ['Predicto - RSOC']). Empty = unrestricted.",
45
+ },
39
46
  },
40
47
  {
41
48
  tableName: "snapchat_public_profiles",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.4.34",
3
+ "version": "1.4.36",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",