@grapadigital/shared-schemas 1.0.206 → 1.0.208

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.
@@ -199,6 +199,7 @@ export declare class Content {
199
199
  createdAt?: Date;
200
200
  updatedAt?: Date;
201
201
  primetagId?: string;
202
+ captureRunId?: string;
202
203
  sentimentAnalysis?: SentimentAnalysis | null;
203
204
  thumbnailUrl?: string;
204
205
  mediaUrl?: string;
@@ -417,6 +417,10 @@ __decorate([
417
417
  (0, mongoose_1.Prop)({ type: String, required: false }),
418
418
  __metadata("design:type", String)
419
419
  ], Content.prototype, "primetagId", void 0);
420
+ __decorate([
421
+ (0, mongoose_1.Prop)({ type: String, required: false }),
422
+ __metadata("design:type", String)
423
+ ], Content.prototype, "captureRunId", void 0);
420
424
  __decorate([
421
425
  (0, mongoose_1.Prop)({ type: exports.SentimentAnalysisSchema, required: false, default: null }),
422
426
  __metadata("design:type", Object)
@@ -30,7 +30,7 @@ export declare const JOB_ORIGINS: readonly ["trigger", "approval", "reclassify"]
30
30
  export type JobOrigin = (typeof JOB_ORIGINS)[number];
31
31
  export declare const JOB_WORKERS: readonly ["content-capture-trigger", "content-capture", "comment-capture", "content-classification", "metrics-generator", "profile-sync"];
32
32
  export type JobWorker = (typeof JOB_WORKERS)[number];
33
- export declare const JOB_STATUSES: readonly ["done", "skipped", "error"];
33
+ export declare const JOB_STATUSES: readonly ["running", "done", "skipped", "error"];
34
34
  export type JobStatus = (typeof JOB_STATUSES)[number];
35
35
  /**
36
36
  * Trilha única do pipeline de captura: cada worker grava uma linha por
@@ -21,7 +21,9 @@ exports.JOB_WORKERS = [
21
21
  'metrics-generator',
22
22
  'profile-sync',
23
23
  ];
24
- exports.JOB_STATUSES = ['done', 'skipped', 'error'];
24
+ // running: trabalho em andamento com checkpoint (ex.: job assíncrono da
25
+ // exportcomments em criação/polling).
26
+ exports.JOB_STATUSES = ['running', 'done', 'skipped', 'error'];
25
27
  /**
26
28
  * Trilha única do pipeline de captura: cada worker grava uma linha por
27
29
  * unidade de trabalho (action ou content), e todas as linhas da mesma rodada
@@ -110,4 +112,9 @@ exports.JobSchema = mongoose_1.SchemaFactory.createForClass(Job);
110
112
  exports.JobSchema.index({ runId: 1, requestId: 1, worker: 1, contentId: 1, primetagId: 1 }, { unique: true });
111
113
  // Trava do trigger: última rodada de uma action.
112
114
  exports.JobSchema.index({ actionId: 1, worker: 1, origin: 1, startedAt: -1 });
115
+ // A trilha guarda o payload bruto de cada rodada e cresce rápido: o Mongo
116
+ // apaga sozinho as linhas com mais de 180 dias.
117
+ exports.JobSchema.index({ createdAt: 1 }, { expireAfterSeconds: 180 * 24 * 60 * 60 });
118
+ // Raw mais recente de uma publication (linhas do content-capture).
119
+ exports.JobSchema.index({ actionId: 1, worker: 1, primetagId: 1, startedAt: -1 });
113
120
  exports.JobModel = (0, mongoose_2.model)('Job', exports.JobSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.206",
3
+ "version": "1.0.208",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -348,6 +348,12 @@ export class Content {
348
348
  @Prop({ type: String, required: false })
349
349
  primetagId?: string;
350
350
 
351
+ // runId da última captura que tocou o conteúdo (não o da rodada que o
352
+ // criou) — a aprovação e a reclassificação reaproveitam esse runId pra
353
+ // continuar na mesma trilha da coleção `jobs`.
354
+ @Prop({ type: String, required: false })
355
+ captureRunId?: string;
356
+
351
357
  @Prop({ type: SentimentAnalysisSchema, required: false, default: null })
352
358
  sentimentAnalysis?: SentimentAnalysis | null;
353
359
 
@@ -22,7 +22,9 @@ export const JOB_WORKERS = [
22
22
  ] as const;
23
23
  export type JobWorker = (typeof JOB_WORKERS)[number];
24
24
 
25
- export const JOB_STATUSES = ['done', 'skipped', 'error'] as const;
25
+ // running: trabalho em andamento com checkpoint (ex.: job assíncrono da
26
+ // exportcomments em criação/polling).
27
+ export const JOB_STATUSES = ['running', 'done', 'skipped', 'error'] as const;
26
28
  export type JobStatus = (typeof JOB_STATUSES)[number];
27
29
 
28
30
  /**
@@ -97,5 +99,10 @@ JobSchema.index(
97
99
  );
98
100
  // Trava do trigger: última rodada de uma action.
99
101
  JobSchema.index({ actionId: 1, worker: 1, origin: 1, startedAt: -1 });
102
+ // A trilha guarda o payload bruto de cada rodada e cresce rápido: o Mongo
103
+ // apaga sozinho as linhas com mais de 180 dias.
104
+ JobSchema.index({ createdAt: 1 }, { expireAfterSeconds: 180 * 24 * 60 * 60 });
105
+ // Raw mais recente de uma publication (linhas do content-capture).
106
+ JobSchema.index({ actionId: 1, worker: 1, primetagId: 1, startedAt: -1 });
100
107
 
101
108
  export const JobModel = MongooseModel('Job', JobSchema);