@heavybit/shared-lib 1.3.2 → 2.1.0

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.
Files changed (128) hide show
  1. package/README.md +100 -0
  2. package/dist/cjs/common/errors.js +44 -5
  3. package/dist/cjs/common/errors.js.map +1 -1
  4. package/dist/cjs/common/phone.js +43 -10
  5. package/dist/cjs/common/phone.js.map +1 -1
  6. package/dist/cjs/common/response.js +78 -5
  7. package/dist/cjs/common/response.js.map +1 -1
  8. package/dist/cjs/config/index.js +1 -1
  9. package/dist/cjs/config/index.js.map +1 -1
  10. package/dist/cjs/context/index.js +49 -0
  11. package/dist/cjs/context/index.js.map +1 -0
  12. package/dist/cjs/contracts/index.js +0 -2
  13. package/dist/cjs/contracts/index.js.map +1 -1
  14. package/dist/cjs/contracts/notification-dispatch.js +87 -63
  15. package/dist/cjs/contracts/notification-dispatch.js.map +1 -1
  16. package/dist/cjs/express/auth.js +44 -11
  17. package/dist/cjs/express/auth.js.map +1 -1
  18. package/dist/cjs/express/index.js +1 -0
  19. package/dist/cjs/express/index.js.map +1 -1
  20. package/dist/cjs/express/middleware.js +154 -34
  21. package/dist/cjs/express/middleware.js.map +1 -1
  22. package/dist/cjs/express/respond.js +47 -0
  23. package/dist/cjs/express/respond.js.map +1 -0
  24. package/dist/cjs/index.js +1 -0
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/logging/index.js +76 -40
  27. package/dist/cjs/logging/index.js.map +1 -1
  28. package/dist/cjs/logging/redact.js +117 -0
  29. package/dist/cjs/logging/redact.js.map +1 -0
  30. package/dist/cjs/messaging/index.js +1 -0
  31. package/dist/cjs/messaging/index.js.map +1 -1
  32. package/dist/cjs/messaging/staff-notifier.js +36 -44
  33. package/dist/cjs/messaging/staff-notifier.js.map +1 -1
  34. package/dist/cjs/messaging/staff-recipients.js +57 -0
  35. package/dist/cjs/messaging/staff-recipients.js.map +1 -0
  36. package/dist/cjs/validation/index.js +27 -3
  37. package/dist/cjs/validation/index.js.map +1 -1
  38. package/dist/esm/common/errors.js +42 -4
  39. package/dist/esm/common/errors.js.map +1 -1
  40. package/dist/esm/common/phone.js +43 -10
  41. package/dist/esm/common/phone.js.map +1 -1
  42. package/dist/esm/common/response.js +75 -5
  43. package/dist/esm/common/response.js.map +1 -1
  44. package/dist/esm/config/index.js +1 -1
  45. package/dist/esm/config/index.js.map +1 -1
  46. package/dist/esm/context/index.js +44 -0
  47. package/dist/esm/context/index.js.map +1 -0
  48. package/dist/esm/contracts/index.js +0 -2
  49. package/dist/esm/contracts/index.js.map +1 -1
  50. package/dist/esm/contracts/notification-dispatch.js +85 -62
  51. package/dist/esm/contracts/notification-dispatch.js.map +1 -1
  52. package/dist/esm/express/auth.js +45 -12
  53. package/dist/esm/express/auth.js.map +1 -1
  54. package/dist/esm/express/index.js +1 -0
  55. package/dist/esm/express/index.js.map +1 -1
  56. package/dist/esm/express/middleware.js +146 -27
  57. package/dist/esm/express/middleware.js.map +1 -1
  58. package/dist/esm/express/respond.js +42 -0
  59. package/dist/esm/express/respond.js.map +1 -0
  60. package/dist/esm/index.js +1 -0
  61. package/dist/esm/index.js.map +1 -1
  62. package/dist/esm/logging/index.js +68 -39
  63. package/dist/esm/logging/index.js.map +1 -1
  64. package/dist/esm/logging/redact.js +110 -0
  65. package/dist/esm/logging/redact.js.map +1 -0
  66. package/dist/esm/messaging/index.js +1 -0
  67. package/dist/esm/messaging/index.js.map +1 -1
  68. package/dist/esm/messaging/staff-notifier.js +36 -43
  69. package/dist/esm/messaging/staff-notifier.js.map +1 -1
  70. package/dist/esm/messaging/staff-recipients.js +53 -0
  71. package/dist/esm/messaging/staff-recipients.js.map +1 -0
  72. package/dist/esm/validation/index.js +27 -2
  73. package/dist/esm/validation/index.js.map +1 -1
  74. package/dist/types/alerting/index.d.ts +1 -1
  75. package/dist/types/alerting/index.d.ts.map +1 -1
  76. package/dist/types/cache/index.d.ts +1 -1
  77. package/dist/types/cache/index.d.ts.map +1 -1
  78. package/dist/types/common/errors.d.ts +48 -7
  79. package/dist/types/common/errors.d.ts.map +1 -1
  80. package/dist/types/common/phone.d.ts +35 -6
  81. package/dist/types/common/phone.d.ts.map +1 -1
  82. package/dist/types/common/response.d.ts +66 -5
  83. package/dist/types/common/response.d.ts.map +1 -1
  84. package/dist/types/config/index.d.ts +1 -1
  85. package/dist/types/config/index.d.ts.map +1 -1
  86. package/dist/types/context/index.d.ts +39 -0
  87. package/dist/types/context/index.d.ts.map +1 -0
  88. package/dist/types/contracts/index.d.ts +0 -2
  89. package/dist/types/contracts/index.d.ts.map +1 -1
  90. package/dist/types/contracts/notification-dispatch.d.ts +208 -90
  91. package/dist/types/contracts/notification-dispatch.d.ts.map +1 -1
  92. package/dist/types/express/auth.d.ts +42 -6
  93. package/dist/types/express/auth.d.ts.map +1 -1
  94. package/dist/types/express/index.d.ts +1 -0
  95. package/dist/types/express/index.d.ts.map +1 -1
  96. package/dist/types/express/middleware.d.ts +86 -7
  97. package/dist/types/express/middleware.d.ts.map +1 -1
  98. package/dist/types/express/respond.d.ts +41 -0
  99. package/dist/types/express/respond.d.ts.map +1 -0
  100. package/dist/types/index.d.ts +1 -0
  101. package/dist/types/index.d.ts.map +1 -1
  102. package/dist/types/logging/index.d.ts +30 -4
  103. package/dist/types/logging/index.d.ts.map +1 -1
  104. package/dist/types/logging/redact.d.ts +54 -0
  105. package/dist/types/logging/redact.d.ts.map +1 -0
  106. package/dist/types/messaging/index.d.ts +1 -0
  107. package/dist/types/messaging/index.d.ts.map +1 -1
  108. package/dist/types/messaging/staff-notifier.d.ts +67 -36
  109. package/dist/types/messaging/staff-notifier.d.ts.map +1 -1
  110. package/dist/types/messaging/staff-recipients.d.ts +50 -0
  111. package/dist/types/messaging/staff-recipients.d.ts.map +1 -0
  112. package/dist/types/types/index.d.ts +36 -1
  113. package/dist/types/types/index.d.ts.map +1 -1
  114. package/dist/types/validation/index.d.ts +33 -2
  115. package/dist/types/validation/index.d.ts.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/cjs/contracts/editorial-draft.js +0 -120
  118. package/dist/cjs/contracts/editorial-draft.js.map +0 -1
  119. package/dist/cjs/contracts/upload-import.js +0 -54
  120. package/dist/cjs/contracts/upload-import.js.map +0 -1
  121. package/dist/esm/contracts/editorial-draft.js +0 -117
  122. package/dist/esm/contracts/editorial-draft.js.map +0 -1
  123. package/dist/esm/contracts/upload-import.js +0 -51
  124. package/dist/esm/contracts/upload-import.js.map +0 -1
  125. package/dist/types/contracts/editorial-draft.d.ts +0 -610
  126. package/dist/types/contracts/editorial-draft.d.ts.map +0 -1
  127. package/dist/types/contracts/upload-import.d.ts +0 -96
  128. package/dist/types/contracts/upload-import.d.ts.map +0 -1
@@ -1,610 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * The newswire → editorial draft hand-off (design Appendix A.4 plus `paragraphFactIds` and
4
- * `image.uploadId`, decision R14). newswire-service stages it through its outbox; editorial-service
5
- * validates it with the same schema before creating the story. One contract for both sides.
6
- */
7
- export declare const EDITORIAL_DRAFT_SUBMIT = "editorial:draft.submit";
8
- /** Field limits of the contract (editorial's story columns). */
9
- export declare const EDITORIAL_DRAFT_LIMITS: {
10
- readonly headline: 200;
11
- readonly excerpt: 400;
12
- readonly tags: 6;
13
- readonly seoTitle: 70;
14
- readonly seoDescription: 170;
15
- /** Reader-facing update note ("Updated with …"), shown under the article byline. */
16
- readonly updateNote: 300;
17
- };
18
- export declare const DRAFT_SOURCE_ROLES: readonly ["primary", "corroborating"];
19
- export declare const DRAFT_RISKS: readonly ["low", "medium", "high"];
20
- export declare const GATE_VERDICTS: readonly ["pass", "review", "block"];
21
- /**
22
- * Every quality gate newswire runs on a draft, in design order. A submitted draft carries one result per
23
- * gate; editorial treats a missing one as not passed (auto-publish never runs on an unchecked draft).
24
- */
25
- export declare const QUALITY_GATE_NAMES: readonly ["originality", "grounding", "quote_limits", "corroboration", "conflicts", "sensitivity", "category", "freshness", "duplicate_of_published", "length_format"];
26
- export type QualityGateName = (typeof QUALITY_GATE_NAMES)[number];
27
- export declare const FACT_KINDS: readonly ["event", "person", "date", "place", "number", "quote", "context"];
28
- export declare const editorialDraftSubmitSchema: z.ZodEffects<z.ZodObject<{
29
- draftId: z.ZodString;
30
- clusterId: z.ZodString;
31
- headline: z.ZodString;
32
- excerpt: z.ZodString;
33
- paragraphs: z.ZodArray<z.ZodString, "many">;
34
- /** The fact-sheet fact ids each paragraph asserts (same length as `paragraphs`). */
35
- paragraphFactIds: z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">;
36
- category: z.ZodString;
37
- tags: z.ZodArray<z.ZodString, "many">;
38
- seo: z.ZodObject<{
39
- title: z.ZodString;
40
- description: z.ZodString;
41
- }, "strip", z.ZodTypeAny, {
42
- description: string;
43
- title: string;
44
- }, {
45
- description: string;
46
- title: string;
47
- }>;
48
- social: z.ZodObject<{
49
- facebook: z.ZodString;
50
- x: z.ZodString;
51
- whatsapp: z.ZodString;
52
- instagram: z.ZodString;
53
- }, "strip", z.ZodTypeAny, {
54
- facebook: string;
55
- x: string;
56
- whatsapp: string;
57
- instagram: string;
58
- }, {
59
- facebook: string;
60
- x: string;
61
- whatsapp: string;
62
- instagram: string;
63
- }>;
64
- sources: z.ZodArray<z.ZodObject<{
65
- name: z.ZodString;
66
- url: z.ZodEffects<z.ZodString, string, string>;
67
- publishedAt: z.ZodOptional<z.ZodString>;
68
- role: z.ZodEnum<["primary", "corroborating"]>;
69
- }, "strip", z.ZodTypeAny, {
70
- name: string;
71
- url: string;
72
- role: "primary" | "corroborating";
73
- publishedAt?: string | undefined;
74
- }, {
75
- name: string;
76
- url: string;
77
- role: "primary" | "corroborating";
78
- publishedAt?: string | undefined;
79
- }>, "many">;
80
- /** An imported or profile cover (upload-service id), or null when the draft has none. */
81
- image: z.ZodNullable<z.ZodObject<{
82
- uploadId: z.ZodString;
83
- credit: z.ZodString;
84
- alt: z.ZodString;
85
- }, "strip", z.ZodTypeAny, {
86
- uploadId: string;
87
- credit: string;
88
- alt: string;
89
- }, {
90
- uploadId: string;
91
- credit: string;
92
- alt: string;
93
- }>>;
94
- relatedProfileIds: z.ZodArray<z.ZodString, "many">;
95
- suggestedProfileIds: z.ZodArray<z.ZodString, "many">;
96
- review: z.ZodObject<{
97
- confidence: z.ZodNumber;
98
- risk: z.ZodEnum<["low", "medium", "high"]>;
99
- riskReasons: z.ZodArray<z.ZodString, "many">;
100
- gates: z.ZodArray<z.ZodObject<{
101
- gate: z.ZodString;
102
- verdict: z.ZodEnum<["pass", "review", "block"]>;
103
- reasons: z.ZodArray<z.ZodString, "many">;
104
- metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
105
- }, "strip", z.ZodTypeAny, {
106
- gate: string;
107
- verdict: "pass" | "review" | "block";
108
- reasons: string[];
109
- metrics?: Record<string, number> | undefined;
110
- }, {
111
- gate: string;
112
- verdict: "pass" | "review" | "block";
113
- reasons: string[];
114
- metrics?: Record<string, number> | undefined;
115
- }>, "many">;
116
- factSheet: z.ZodObject<{
117
- facts: z.ZodArray<z.ZodObject<{
118
- id: z.ZodString;
119
- statement: z.ZodString;
120
- kind: z.ZodEnum<["event", "person", "date", "place", "number", "quote", "context"]>;
121
- entities: z.ZodArray<z.ZodString, "many">;
122
- supportedBy: z.ZodArray<z.ZodObject<{
123
- itemId: z.ZodString;
124
- paragraph: z.ZodNumber;
125
- }, "strip", z.ZodTypeAny, {
126
- itemId: string;
127
- paragraph: number;
128
- }, {
129
- itemId: string;
130
- paragraph: number;
131
- }>, "many">;
132
- conflictsWith: z.ZodArray<z.ZodString, "many">;
133
- independentSources: z.ZodNumber;
134
- }, "strip", z.ZodTypeAny, {
135
- id: string;
136
- statement: string;
137
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
138
- entities: string[];
139
- supportedBy: {
140
- itemId: string;
141
- paragraph: number;
142
- }[];
143
- conflictsWith: string[];
144
- independentSources: number;
145
- }, {
146
- id: string;
147
- statement: string;
148
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
149
- entities: string[];
150
- supportedBy: {
151
- itemId: string;
152
- paragraph: number;
153
- }[];
154
- conflictsWith: string[];
155
- independentSources: number;
156
- }>, "many">;
157
- quotes: z.ZodArray<z.ZodObject<{
158
- itemId: z.ZodString;
159
- paragraph: z.ZodNumber;
160
- } & {
161
- text: z.ZodString;
162
- speaker: z.ZodString;
163
- }, "strip", z.ZodTypeAny, {
164
- itemId: string;
165
- paragraph: number;
166
- text: string;
167
- speaker: string;
168
- }, {
169
- itemId: string;
170
- paragraph: number;
171
- text: string;
172
- speaker: string;
173
- }>, "many">;
174
- conflicts: z.ZodArray<z.ZodObject<{
175
- description: z.ZodString;
176
- factIds: z.ZodArray<z.ZodString, "many">;
177
- }, "strip", z.ZodTypeAny, {
178
- description: string;
179
- factIds: string[];
180
- }, {
181
- description: string;
182
- factIds: string[];
183
- }>, "many">;
184
- }, "strip", z.ZodTypeAny, {
185
- conflicts: {
186
- description: string;
187
- factIds: string[];
188
- }[];
189
- facts: {
190
- id: string;
191
- statement: string;
192
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
193
- entities: string[];
194
- supportedBy: {
195
- itemId: string;
196
- paragraph: number;
197
- }[];
198
- conflictsWith: string[];
199
- independentSources: number;
200
- }[];
201
- quotes: {
202
- itemId: string;
203
- paragraph: number;
204
- text: string;
205
- speaker: string;
206
- }[];
207
- }, {
208
- conflicts: {
209
- description: string;
210
- factIds: string[];
211
- }[];
212
- facts: {
213
- id: string;
214
- statement: string;
215
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
216
- entities: string[];
217
- supportedBy: {
218
- itemId: string;
219
- paragraph: number;
220
- }[];
221
- conflictsWith: string[];
222
- independentSources: number;
223
- }[];
224
- quotes: {
225
- itemId: string;
226
- paragraph: number;
227
- text: string;
228
- speaker: string;
229
- }[];
230
- }>;
231
- /** Prompt slug → version used to produce the draft. */
232
- promptVersions: z.ZodRecord<z.ZodString, z.ZodNumber>;
233
- }, "strip", z.ZodTypeAny, {
234
- confidence: number;
235
- risk: "low" | "medium" | "high";
236
- riskReasons: string[];
237
- gates: {
238
- gate: string;
239
- verdict: "pass" | "review" | "block";
240
- reasons: string[];
241
- metrics?: Record<string, number> | undefined;
242
- }[];
243
- factSheet: {
244
- conflicts: {
245
- description: string;
246
- factIds: string[];
247
- }[];
248
- facts: {
249
- id: string;
250
- statement: string;
251
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
252
- entities: string[];
253
- supportedBy: {
254
- itemId: string;
255
- paragraph: number;
256
- }[];
257
- conflictsWith: string[];
258
- independentSources: number;
259
- }[];
260
- quotes: {
261
- itemId: string;
262
- paragraph: number;
263
- text: string;
264
- speaker: string;
265
- }[];
266
- };
267
- promptVersions: Record<string, number>;
268
- }, {
269
- confidence: number;
270
- risk: "low" | "medium" | "high";
271
- riskReasons: string[];
272
- gates: {
273
- gate: string;
274
- verdict: "pass" | "review" | "block";
275
- reasons: string[];
276
- metrics?: Record<string, number> | undefined;
277
- }[];
278
- factSheet: {
279
- conflicts: {
280
- description: string;
281
- factIds: string[];
282
- }[];
283
- facts: {
284
- id: string;
285
- statement: string;
286
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
287
- entities: string[];
288
- supportedBy: {
289
- itemId: string;
290
- paragraph: number;
291
- }[];
292
- conflictsWith: string[];
293
- independentSources: number;
294
- }[];
295
- quotes: {
296
- itemId: string;
297
- paragraph: number;
298
- text: string;
299
- speaker: string;
300
- }[];
301
- };
302
- promptVersions: Record<string, number>;
303
- }>;
304
- /**
305
- * Present when the draft updates a story editorial has already published (Phase 21.2): editorial
306
- * stores it as a pending update on that story instead of creating a new one. Additive and optional.
307
- */
308
- updateOf: z.ZodOptional<z.ZodObject<{
309
- storyId: z.ZodString;
310
- note: z.ZodString;
311
- }, "strip", z.ZodTypeAny, {
312
- storyId: string;
313
- note: string;
314
- }, {
315
- storyId: string;
316
- note: string;
317
- }>>;
318
- }, "strip", z.ZodTypeAny, {
319
- review: {
320
- confidence: number;
321
- risk: "low" | "medium" | "high";
322
- riskReasons: string[];
323
- gates: {
324
- gate: string;
325
- verdict: "pass" | "review" | "block";
326
- reasons: string[];
327
- metrics?: Record<string, number> | undefined;
328
- }[];
329
- factSheet: {
330
- conflicts: {
331
- description: string;
332
- factIds: string[];
333
- }[];
334
- facts: {
335
- id: string;
336
- statement: string;
337
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
338
- entities: string[];
339
- supportedBy: {
340
- itemId: string;
341
- paragraph: number;
342
- }[];
343
- conflictsWith: string[];
344
- independentSources: number;
345
- }[];
346
- quotes: {
347
- itemId: string;
348
- paragraph: number;
349
- text: string;
350
- speaker: string;
351
- }[];
352
- };
353
- promptVersions: Record<string, number>;
354
- };
355
- category: string;
356
- draftId: string;
357
- clusterId: string;
358
- headline: string;
359
- excerpt: string;
360
- paragraphs: string[];
361
- paragraphFactIds: string[][];
362
- tags: string[];
363
- seo: {
364
- description: string;
365
- title: string;
366
- };
367
- social: {
368
- facebook: string;
369
- x: string;
370
- whatsapp: string;
371
- instagram: string;
372
- };
373
- sources: {
374
- name: string;
375
- url: string;
376
- role: "primary" | "corroborating";
377
- publishedAt?: string | undefined;
378
- }[];
379
- image: {
380
- uploadId: string;
381
- credit: string;
382
- alt: string;
383
- } | null;
384
- relatedProfileIds: string[];
385
- suggestedProfileIds: string[];
386
- updateOf?: {
387
- storyId: string;
388
- note: string;
389
- } | undefined;
390
- }, {
391
- review: {
392
- confidence: number;
393
- risk: "low" | "medium" | "high";
394
- riskReasons: string[];
395
- gates: {
396
- gate: string;
397
- verdict: "pass" | "review" | "block";
398
- reasons: string[];
399
- metrics?: Record<string, number> | undefined;
400
- }[];
401
- factSheet: {
402
- conflicts: {
403
- description: string;
404
- factIds: string[];
405
- }[];
406
- facts: {
407
- id: string;
408
- statement: string;
409
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
410
- entities: string[];
411
- supportedBy: {
412
- itemId: string;
413
- paragraph: number;
414
- }[];
415
- conflictsWith: string[];
416
- independentSources: number;
417
- }[];
418
- quotes: {
419
- itemId: string;
420
- paragraph: number;
421
- text: string;
422
- speaker: string;
423
- }[];
424
- };
425
- promptVersions: Record<string, number>;
426
- };
427
- category: string;
428
- draftId: string;
429
- clusterId: string;
430
- headline: string;
431
- excerpt: string;
432
- paragraphs: string[];
433
- paragraphFactIds: string[][];
434
- tags: string[];
435
- seo: {
436
- description: string;
437
- title: string;
438
- };
439
- social: {
440
- facebook: string;
441
- x: string;
442
- whatsapp: string;
443
- instagram: string;
444
- };
445
- sources: {
446
- name: string;
447
- url: string;
448
- role: "primary" | "corroborating";
449
- publishedAt?: string | undefined;
450
- }[];
451
- image: {
452
- uploadId: string;
453
- credit: string;
454
- alt: string;
455
- } | null;
456
- relatedProfileIds: string[];
457
- suggestedProfileIds: string[];
458
- updateOf?: {
459
- storyId: string;
460
- note: string;
461
- } | undefined;
462
- }>, {
463
- review: {
464
- confidence: number;
465
- risk: "low" | "medium" | "high";
466
- riskReasons: string[];
467
- gates: {
468
- gate: string;
469
- verdict: "pass" | "review" | "block";
470
- reasons: string[];
471
- metrics?: Record<string, number> | undefined;
472
- }[];
473
- factSheet: {
474
- conflicts: {
475
- description: string;
476
- factIds: string[];
477
- }[];
478
- facts: {
479
- id: string;
480
- statement: string;
481
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
482
- entities: string[];
483
- supportedBy: {
484
- itemId: string;
485
- paragraph: number;
486
- }[];
487
- conflictsWith: string[];
488
- independentSources: number;
489
- }[];
490
- quotes: {
491
- itemId: string;
492
- paragraph: number;
493
- text: string;
494
- speaker: string;
495
- }[];
496
- };
497
- promptVersions: Record<string, number>;
498
- };
499
- category: string;
500
- draftId: string;
501
- clusterId: string;
502
- headline: string;
503
- excerpt: string;
504
- paragraphs: string[];
505
- paragraphFactIds: string[][];
506
- tags: string[];
507
- seo: {
508
- description: string;
509
- title: string;
510
- };
511
- social: {
512
- facebook: string;
513
- x: string;
514
- whatsapp: string;
515
- instagram: string;
516
- };
517
- sources: {
518
- name: string;
519
- url: string;
520
- role: "primary" | "corroborating";
521
- publishedAt?: string | undefined;
522
- }[];
523
- image: {
524
- uploadId: string;
525
- credit: string;
526
- alt: string;
527
- } | null;
528
- relatedProfileIds: string[];
529
- suggestedProfileIds: string[];
530
- updateOf?: {
531
- storyId: string;
532
- note: string;
533
- } | undefined;
534
- }, {
535
- review: {
536
- confidence: number;
537
- risk: "low" | "medium" | "high";
538
- riskReasons: string[];
539
- gates: {
540
- gate: string;
541
- verdict: "pass" | "review" | "block";
542
- reasons: string[];
543
- metrics?: Record<string, number> | undefined;
544
- }[];
545
- factSheet: {
546
- conflicts: {
547
- description: string;
548
- factIds: string[];
549
- }[];
550
- facts: {
551
- id: string;
552
- statement: string;
553
- kind: "number" | "date" | "event" | "person" | "place" | "quote" | "context";
554
- entities: string[];
555
- supportedBy: {
556
- itemId: string;
557
- paragraph: number;
558
- }[];
559
- conflictsWith: string[];
560
- independentSources: number;
561
- }[];
562
- quotes: {
563
- itemId: string;
564
- paragraph: number;
565
- text: string;
566
- speaker: string;
567
- }[];
568
- };
569
- promptVersions: Record<string, number>;
570
- };
571
- category: string;
572
- draftId: string;
573
- clusterId: string;
574
- headline: string;
575
- excerpt: string;
576
- paragraphs: string[];
577
- paragraphFactIds: string[][];
578
- tags: string[];
579
- seo: {
580
- description: string;
581
- title: string;
582
- };
583
- social: {
584
- facebook: string;
585
- x: string;
586
- whatsapp: string;
587
- instagram: string;
588
- };
589
- sources: {
590
- name: string;
591
- url: string;
592
- role: "primary" | "corroborating";
593
- publishedAt?: string | undefined;
594
- }[];
595
- image: {
596
- uploadId: string;
597
- credit: string;
598
- alt: string;
599
- } | null;
600
- relatedProfileIds: string[];
601
- suggestedProfileIds: string[];
602
- updateOf?: {
603
- storyId: string;
604
- note: string;
605
- } | undefined;
606
- }>;
607
- export type EditorialDraftSubmit = z.infer<typeof editorialDraftSubmitSchema>;
608
- export type EditorialDraftSource = EditorialDraftSubmit['sources'][number];
609
- export type EditorialDraftUpdateOf = NonNullable<EditorialDraftSubmit['updateOf']>;
610
- //# sourceMappingURL=editorial-draft.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editorial-draft.d.ts","sourceRoot":"","sources":["../../../src/contracts/editorial-draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,gEAAgE;AAChE,eAAO,MAAM,sBAAsB;;;;;;IAMjC,oFAAoF;;CAE5E,CAAC;AAEX,eAAO,MAAM,kBAAkB,uCAAwC,CAAC;AACxE,eAAO,MAAM,WAAW,oCAAqC,CAAC;AAC9D,eAAO,MAAM,aAAa,sCAAuC,CAAC;AAClE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,wKAGrB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,eAAO,MAAM,UAAU,6EAA8E,CAAC;AAuCtG,eAAO,MAAM,0BAA0B;;;;;;IAOnC,oFAAoF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUpF,yFAAyF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAcvF,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGzD;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBH,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3E,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC"}
@@ -1,96 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Licensed image import by URL (Newswire R5, decision R39). newswire-service (and later
4
- * editorial-service) sends `upload:import`; upload-service fetches the file and answers with an
5
- * `upload.import.completed` or `upload.import.failed` event. One contract for both sides.
6
- */
7
- export declare const UPLOAD_IMPORT = "upload:import";
8
- export declare const UPLOAD_IMPORT_EVENTS: {
9
- readonly COMPLETED: "upload.import.completed";
10
- readonly FAILED: "upload.import.failed";
11
- };
12
- /** Upload policies an import may use. */
13
- export declare const UPLOAD_IMPORT_POLICIES: readonly ["news_image"];
14
- export type UploadImportPolicy = (typeof UPLOAD_IMPORT_POLICIES)[number];
15
- /** Field limits of the contract (upload-service's `uploads` columns). */
16
- export declare const UPLOAD_IMPORT_LIMITS: {
17
- readonly url: 2048;
18
- readonly ownerType: 50;
19
- readonly licenceHolder: 160;
20
- readonly licenceBasis: 255;
21
- readonly reason: 255;
22
- };
23
- /**
24
- * `upload:import` data. The URL is only length-checked here: upload-service rejects a non-https or
25
- * unsafe URL itself, so the sender hears about it through a `failed` event instead of a dead letter.
26
- */
27
- export declare const uploadImportCommandSchema: z.ZodObject<{
28
- /** ULID the outcome event echoes back; upload-service is idempotent on it. */
29
- importId: z.ZodString;
30
- url: z.ZodString;
31
- policy: z.ZodEnum<["news_image"]>;
32
- /** Echoed in the outcome only; the imported upload is a system row with no owner. */
33
- ownerType: z.ZodString;
34
- ownerId: z.ZodString;
35
- licence: z.ZodObject<{
36
- holder: z.ZodString;
37
- basis: z.ZodString;
38
- }, "strip", z.ZodTypeAny, {
39
- holder: string;
40
- basis: string;
41
- }, {
42
- holder: string;
43
- basis: string;
44
- }>;
45
- }, "strip", z.ZodTypeAny, {
46
- url: string;
47
- importId: string;
48
- policy: "news_image";
49
- ownerType: string;
50
- ownerId: string;
51
- licence: {
52
- holder: string;
53
- basis: string;
54
- };
55
- }, {
56
- url: string;
57
- importId: string;
58
- policy: "news_image";
59
- ownerType: string;
60
- ownerId: string;
61
- licence: {
62
- holder: string;
63
- basis: string;
64
- };
65
- }>;
66
- export declare const uploadImportCompletedSchema: z.ZodObject<{
67
- importId: z.ZodString;
68
- uploadId: z.ZodString;
69
- ownerType: z.ZodString;
70
- ownerId: z.ZodString;
71
- }, "strip", z.ZodTypeAny, {
72
- uploadId: string;
73
- importId: string;
74
- ownerType: string;
75
- ownerId: string;
76
- }, {
77
- uploadId: string;
78
- importId: string;
79
- ownerType: string;
80
- ownerId: string;
81
- }>;
82
- /** `reason` is a machine code (`too_large`, `http_404`, …; see upload-service `ImportFailureReason`). */
83
- export declare const uploadImportFailedSchema: z.ZodObject<{
84
- importId: z.ZodString;
85
- reason: z.ZodString;
86
- }, "strip", z.ZodTypeAny, {
87
- reason: string;
88
- importId: string;
89
- }, {
90
- reason: string;
91
- importId: string;
92
- }>;
93
- export type UploadImportCommand = z.infer<typeof uploadImportCommandSchema>;
94
- export type UploadImportCompleted = z.infer<typeof uploadImportCompletedSchema>;
95
- export type UploadImportFailed = z.infer<typeof uploadImportFailedSchema>;
96
- //# sourceMappingURL=upload-import.d.ts.map