@productminds/article-events 0.0.11 → 1.0.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.
- package/lib/article-events.d.ts +1 -2
- package/lib/article-events.js +1 -3
- package/lib/cmd/write-json-schema.js +1 -1
- package/lib/events/ArticleEvent.d.ts +15 -427
- package/lib/events/ExternalArticleEvent.d.ts +84 -68
- package/lib/events/ExternalArticleEvent.js +4 -3
- package/lib/events/InternalArticleEvent.d.ts +91 -75
- package/lib/events/InternalArticleEvent.js +7 -6
- package/lib/types/Article.d.ts +2 -34
- package/lib/types/Article.js +3 -16
- package/lib/utils/makeHelpers.js +1 -1
- package/package.json +2 -2
@@ -1,15 +1,8 @@
|
|
1
|
-
import { Schema } from
|
1
|
+
import { Schema } from '@effect/schema';
|
2
2
|
export declare const InternalArticleEventSchema: Schema.Struct<{
|
3
3
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
4
4
|
payload: Schema.Struct<{
|
5
|
-
article: Schema.Struct<{
|
6
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
7
|
-
type: Schema.Literal<["CATEGORY"]>;
|
8
|
-
value: typeof Schema.NonEmpty;
|
9
|
-
}>, Schema.Struct<{
|
10
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
11
|
-
id: typeof Schema.UUID;
|
12
|
-
}>]>>;
|
5
|
+
article: Schema.extend<Schema.Struct<{
|
13
6
|
id: typeof Schema.UUID;
|
14
7
|
title: typeof Schema.NonEmpty;
|
15
8
|
teaser: typeof Schema.NonEmpty;
|
@@ -22,7 +15,15 @@ export declare const InternalArticleEventSchema: Schema.Struct<{
|
|
22
15
|
authors: Schema.Array$<Schema.Struct<{
|
23
16
|
name: typeof Schema.NonEmpty;
|
24
17
|
}>>;
|
25
|
-
}
|
18
|
+
}>, Schema.Struct<{
|
19
|
+
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
20
|
+
type: Schema.Literal<["CATEGORY"]>;
|
21
|
+
value: typeof Schema.NonEmpty;
|
22
|
+
}>, Schema.Struct<{
|
23
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
24
|
+
id: typeof Schema.UUID;
|
25
|
+
}>]>>;
|
26
|
+
}>>;
|
26
27
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
27
28
|
source: Schema.Literal<["INTERNAL"]>;
|
28
29
|
}>;
|
@@ -33,7 +34,6 @@ declare const _default: {
|
|
33
34
|
readonly payload: {
|
34
35
|
readonly article: {
|
35
36
|
readonly id: string;
|
36
|
-
readonly site: string;
|
37
37
|
readonly title: string;
|
38
38
|
readonly teaser: string;
|
39
39
|
readonly content: string;
|
@@ -41,6 +41,11 @@ declare const _default: {
|
|
41
41
|
readonly updatedAt: Date;
|
42
42
|
readonly retrievedAt: Date;
|
43
43
|
readonly url: string;
|
44
|
+
readonly site: string;
|
45
|
+
readonly authors: readonly {
|
46
|
+
readonly name: string;
|
47
|
+
}[];
|
48
|
+
} & {
|
44
49
|
readonly tags: readonly ({
|
45
50
|
readonly type: "CATEGORY";
|
46
51
|
readonly value: string;
|
@@ -48,9 +53,6 @@ declare const _default: {
|
|
48
53
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
49
54
|
readonly id: string;
|
50
55
|
})[];
|
51
|
-
readonly authors: readonly {
|
52
|
-
readonly name: string;
|
53
|
-
}[];
|
54
56
|
};
|
55
57
|
readonly status: "NEW" | "UPDATED";
|
56
58
|
readonly source: "INTERNAL";
|
@@ -61,7 +63,6 @@ declare const _default: {
|
|
61
63
|
readonly payload: {
|
62
64
|
readonly article: {
|
63
65
|
readonly id: string;
|
64
|
-
readonly site: string;
|
65
66
|
readonly title: string;
|
66
67
|
readonly teaser: string;
|
67
68
|
readonly content: string;
|
@@ -69,6 +70,11 @@ declare const _default: {
|
|
69
70
|
readonly updatedAt: Date;
|
70
71
|
readonly retrievedAt: Date;
|
71
72
|
readonly url: string;
|
73
|
+
readonly site: string;
|
74
|
+
readonly authors: readonly {
|
75
|
+
readonly name: string;
|
76
|
+
}[];
|
77
|
+
} & {
|
72
78
|
readonly tags: readonly ({
|
73
79
|
readonly type: "CATEGORY";
|
74
80
|
readonly value: string;
|
@@ -76,9 +82,6 @@ declare const _default: {
|
|
76
82
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
77
83
|
readonly id: string;
|
78
84
|
})[];
|
79
|
-
readonly authors: readonly {
|
80
|
-
readonly name: string;
|
81
|
-
}[];
|
82
85
|
};
|
83
86
|
readonly status: "NEW" | "UPDATED";
|
84
87
|
readonly source: "INTERNAL";
|
@@ -89,7 +92,6 @@ declare const _default: {
|
|
89
92
|
readonly payload: {
|
90
93
|
readonly article: {
|
91
94
|
readonly id: string;
|
92
|
-
readonly site: string;
|
93
95
|
readonly title: string;
|
94
96
|
readonly teaser: string;
|
95
97
|
readonly content: string;
|
@@ -97,6 +99,11 @@ declare const _default: {
|
|
97
99
|
readonly updatedAt: Date;
|
98
100
|
readonly retrievedAt: Date;
|
99
101
|
readonly url: string;
|
102
|
+
readonly site: string;
|
103
|
+
readonly authors: readonly {
|
104
|
+
readonly name: string;
|
105
|
+
}[];
|
106
|
+
} & {
|
100
107
|
readonly tags: readonly ({
|
101
108
|
readonly type: "CATEGORY";
|
102
109
|
readonly value: string;
|
@@ -104,9 +111,6 @@ declare const _default: {
|
|
104
111
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
105
112
|
readonly id: string;
|
106
113
|
})[];
|
107
|
-
readonly authors: readonly {
|
108
|
-
readonly name: string;
|
109
|
-
}[];
|
110
114
|
};
|
111
115
|
readonly status: "NEW" | "UPDATED";
|
112
116
|
readonly source: "INTERNAL";
|
@@ -116,7 +120,6 @@ declare const _default: {
|
|
116
120
|
readonly payload: {
|
117
121
|
readonly article: {
|
118
122
|
readonly id: string;
|
119
|
-
readonly site: string;
|
120
123
|
readonly title: string;
|
121
124
|
readonly teaser: string;
|
122
125
|
readonly content: string;
|
@@ -124,6 +127,11 @@ declare const _default: {
|
|
124
127
|
readonly updatedAt: string;
|
125
128
|
readonly retrievedAt: string;
|
126
129
|
readonly url: string;
|
130
|
+
readonly site: string;
|
131
|
+
readonly authors: readonly {
|
132
|
+
readonly name: string;
|
133
|
+
}[];
|
134
|
+
} & {
|
127
135
|
readonly tags: readonly ({
|
128
136
|
readonly type: "CATEGORY";
|
129
137
|
readonly value: string;
|
@@ -131,9 +139,6 @@ declare const _default: {
|
|
131
139
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
132
140
|
readonly id: string;
|
133
141
|
})[];
|
134
|
-
readonly authors: readonly {
|
135
|
-
readonly name: string;
|
136
|
-
}[];
|
137
142
|
};
|
138
143
|
readonly status: "NEW" | "UPDATED";
|
139
144
|
readonly source: "INTERNAL";
|
@@ -144,7 +149,6 @@ declare const _default: {
|
|
144
149
|
readonly payload: {
|
145
150
|
readonly article: {
|
146
151
|
readonly id: string;
|
147
|
-
readonly site: string;
|
148
152
|
readonly title: string;
|
149
153
|
readonly teaser: string;
|
150
154
|
readonly content: string;
|
@@ -152,6 +156,11 @@ declare const _default: {
|
|
152
156
|
readonly updatedAt: Date;
|
153
157
|
readonly retrievedAt: Date;
|
154
158
|
readonly url: string;
|
159
|
+
readonly site: string;
|
160
|
+
readonly authors: readonly {
|
161
|
+
readonly name: string;
|
162
|
+
}[];
|
163
|
+
} & {
|
155
164
|
readonly tags: readonly ({
|
156
165
|
readonly type: "CATEGORY";
|
157
166
|
readonly value: string;
|
@@ -159,9 +168,6 @@ declare const _default: {
|
|
159
168
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
160
169
|
readonly id: string;
|
161
170
|
})[];
|
162
|
-
readonly authors: readonly {
|
163
|
-
readonly name: string;
|
164
|
-
}[];
|
165
171
|
};
|
166
172
|
readonly status: "NEW" | "UPDATED";
|
167
173
|
readonly source: "INTERNAL";
|
@@ -171,7 +177,6 @@ declare const _default: {
|
|
171
177
|
readonly payload: {
|
172
178
|
readonly article: {
|
173
179
|
readonly id: string;
|
174
|
-
readonly site: string;
|
175
180
|
readonly title: string;
|
176
181
|
readonly teaser: string;
|
177
182
|
readonly content: string;
|
@@ -179,6 +184,11 @@ declare const _default: {
|
|
179
184
|
readonly updatedAt: string;
|
180
185
|
readonly retrievedAt: string;
|
181
186
|
readonly url: string;
|
187
|
+
readonly site: string;
|
188
|
+
readonly authors: readonly {
|
189
|
+
readonly name: string;
|
190
|
+
}[];
|
191
|
+
} & {
|
182
192
|
readonly tags: readonly ({
|
183
193
|
readonly type: "CATEGORY";
|
184
194
|
readonly value: string;
|
@@ -186,9 +196,6 @@ declare const _default: {
|
|
186
196
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
187
197
|
readonly id: string;
|
188
198
|
})[];
|
189
|
-
readonly authors: readonly {
|
190
|
-
readonly name: string;
|
191
|
-
}[];
|
192
199
|
};
|
193
200
|
readonly status: "NEW" | "UPDATED";
|
194
201
|
readonly source: "INTERNAL";
|
@@ -199,7 +206,6 @@ declare const _default: {
|
|
199
206
|
readonly payload: {
|
200
207
|
readonly article: {
|
201
208
|
readonly id: string;
|
202
|
-
readonly site: string;
|
203
209
|
readonly title: string;
|
204
210
|
readonly teaser: string;
|
205
211
|
readonly content: string;
|
@@ -207,6 +213,11 @@ declare const _default: {
|
|
207
213
|
readonly updatedAt: Date;
|
208
214
|
readonly retrievedAt: Date;
|
209
215
|
readonly url: string;
|
216
|
+
readonly site: string;
|
217
|
+
readonly authors: readonly {
|
218
|
+
readonly name: string;
|
219
|
+
}[];
|
220
|
+
} & {
|
210
221
|
readonly tags: readonly ({
|
211
222
|
readonly type: "CATEGORY";
|
212
223
|
readonly value: string;
|
@@ -214,9 +225,6 @@ declare const _default: {
|
|
214
225
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
215
226
|
readonly id: string;
|
216
227
|
})[];
|
217
|
-
readonly authors: readonly {
|
218
|
-
readonly name: string;
|
219
|
-
}[];
|
220
228
|
};
|
221
229
|
readonly status: "NEW" | "UPDATED";
|
222
230
|
readonly source: "INTERNAL";
|
@@ -227,7 +235,6 @@ declare const _default: {
|
|
227
235
|
readonly payload: {
|
228
236
|
readonly article: {
|
229
237
|
readonly id: string;
|
230
|
-
readonly site: string;
|
231
238
|
readonly title: string;
|
232
239
|
readonly teaser: string;
|
233
240
|
readonly content: string;
|
@@ -235,6 +242,11 @@ declare const _default: {
|
|
235
242
|
readonly updatedAt: Date;
|
236
243
|
readonly retrievedAt: Date;
|
237
244
|
readonly url: string;
|
245
|
+
readonly site: string;
|
246
|
+
readonly authors: readonly {
|
247
|
+
readonly name: string;
|
248
|
+
}[];
|
249
|
+
} & {
|
238
250
|
readonly tags: readonly ({
|
239
251
|
readonly type: "CATEGORY";
|
240
252
|
readonly value: string;
|
@@ -242,9 +254,6 @@ declare const _default: {
|
|
242
254
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
243
255
|
readonly id: string;
|
244
256
|
})[];
|
245
|
-
readonly authors: readonly {
|
246
|
-
readonly name: string;
|
247
|
-
}[];
|
248
257
|
};
|
249
258
|
readonly status: "NEW" | "UPDATED";
|
250
259
|
readonly source: "INTERNAL";
|
@@ -255,7 +264,6 @@ declare const _default: {
|
|
255
264
|
readonly payload: {
|
256
265
|
readonly article: {
|
257
266
|
readonly id: string;
|
258
|
-
readonly site: string;
|
259
267
|
readonly title: string;
|
260
268
|
readonly teaser: string;
|
261
269
|
readonly content: string;
|
@@ -263,6 +271,11 @@ declare const _default: {
|
|
263
271
|
readonly updatedAt: Date;
|
264
272
|
readonly retrievedAt: Date;
|
265
273
|
readonly url: string;
|
274
|
+
readonly site: string;
|
275
|
+
readonly authors: readonly {
|
276
|
+
readonly name: string;
|
277
|
+
}[];
|
278
|
+
} & {
|
266
279
|
readonly tags: readonly ({
|
267
280
|
readonly type: "CATEGORY";
|
268
281
|
readonly value: string;
|
@@ -270,9 +283,6 @@ declare const _default: {
|
|
270
283
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
271
284
|
readonly id: string;
|
272
285
|
})[];
|
273
|
-
readonly authors: readonly {
|
274
|
-
readonly name: string;
|
275
|
-
}[];
|
276
286
|
};
|
277
287
|
readonly status: "NEW" | "UPDATED";
|
278
288
|
readonly source: "INTERNAL";
|
@@ -283,7 +293,6 @@ declare const _default: {
|
|
283
293
|
readonly payload: {
|
284
294
|
readonly article: {
|
285
295
|
readonly id: string;
|
286
|
-
readonly site: string;
|
287
296
|
readonly title: string;
|
288
297
|
readonly teaser: string;
|
289
298
|
readonly content: string;
|
@@ -291,6 +300,11 @@ declare const _default: {
|
|
291
300
|
readonly updatedAt: Date;
|
292
301
|
readonly retrievedAt: Date;
|
293
302
|
readonly url: string;
|
303
|
+
readonly site: string;
|
304
|
+
readonly authors: readonly {
|
305
|
+
readonly name: string;
|
306
|
+
}[];
|
307
|
+
} & {
|
294
308
|
readonly tags: readonly ({
|
295
309
|
readonly type: "CATEGORY";
|
296
310
|
readonly value: string;
|
@@ -298,9 +312,6 @@ declare const _default: {
|
|
298
312
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
299
313
|
readonly id: string;
|
300
314
|
})[];
|
301
|
-
readonly authors: readonly {
|
302
|
-
readonly name: string;
|
303
|
-
}[];
|
304
315
|
};
|
305
316
|
readonly status: "NEW" | "UPDATED";
|
306
317
|
readonly source: "INTERNAL";
|
@@ -311,7 +322,6 @@ declare const _default: {
|
|
311
322
|
readonly payload: {
|
312
323
|
readonly article: {
|
313
324
|
readonly id: string;
|
314
|
-
readonly site: string;
|
315
325
|
readonly title: string;
|
316
326
|
readonly teaser: string;
|
317
327
|
readonly content: string;
|
@@ -319,6 +329,11 @@ declare const _default: {
|
|
319
329
|
readonly updatedAt: Date;
|
320
330
|
readonly retrievedAt: Date;
|
321
331
|
readonly url: string;
|
332
|
+
readonly site: string;
|
333
|
+
readonly authors: readonly {
|
334
|
+
readonly name: string;
|
335
|
+
}[];
|
336
|
+
} & {
|
322
337
|
readonly tags: readonly ({
|
323
338
|
readonly type: "CATEGORY";
|
324
339
|
readonly value: string;
|
@@ -326,9 +341,6 @@ declare const _default: {
|
|
326
341
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
327
342
|
readonly id: string;
|
328
343
|
})[];
|
329
|
-
readonly authors: readonly {
|
330
|
-
readonly name: string;
|
331
|
-
}[];
|
332
344
|
};
|
333
345
|
readonly status: "NEW" | "UPDATED";
|
334
346
|
readonly source: "INTERNAL";
|
@@ -339,7 +351,6 @@ declare const _default: {
|
|
339
351
|
readonly payload: {
|
340
352
|
readonly article: {
|
341
353
|
readonly id: string;
|
342
|
-
readonly site: string;
|
343
354
|
readonly title: string;
|
344
355
|
readonly teaser: string;
|
345
356
|
readonly content: string;
|
@@ -347,6 +358,11 @@ declare const _default: {
|
|
347
358
|
readonly updatedAt: Date;
|
348
359
|
readonly retrievedAt: Date;
|
349
360
|
readonly url: string;
|
361
|
+
readonly site: string;
|
362
|
+
readonly authors: readonly {
|
363
|
+
readonly name: string;
|
364
|
+
}[];
|
365
|
+
} & {
|
350
366
|
readonly tags: readonly ({
|
351
367
|
readonly type: "CATEGORY";
|
352
368
|
readonly value: string;
|
@@ -354,9 +370,6 @@ declare const _default: {
|
|
354
370
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
355
371
|
readonly id: string;
|
356
372
|
})[];
|
357
|
-
readonly authors: readonly {
|
358
|
-
readonly name: string;
|
359
|
-
}[];
|
360
373
|
};
|
361
374
|
readonly status: "NEW" | "UPDATED";
|
362
375
|
readonly source: "INTERNAL";
|
@@ -367,7 +380,6 @@ declare const _default: {
|
|
367
380
|
readonly payload: {
|
368
381
|
readonly article: {
|
369
382
|
readonly id: string;
|
370
|
-
readonly site: string;
|
371
383
|
readonly title: string;
|
372
384
|
readonly teaser: string;
|
373
385
|
readonly content: string;
|
@@ -375,6 +387,11 @@ declare const _default: {
|
|
375
387
|
readonly updatedAt: Date;
|
376
388
|
readonly retrievedAt: Date;
|
377
389
|
readonly url: string;
|
390
|
+
readonly site: string;
|
391
|
+
readonly authors: readonly {
|
392
|
+
readonly name: string;
|
393
|
+
}[];
|
394
|
+
} & {
|
378
395
|
readonly tags: readonly ({
|
379
396
|
readonly type: "CATEGORY";
|
380
397
|
readonly value: string;
|
@@ -382,9 +399,6 @@ declare const _default: {
|
|
382
399
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
383
400
|
readonly id: string;
|
384
401
|
})[];
|
385
|
-
readonly authors: readonly {
|
386
|
-
readonly name: string;
|
387
|
-
}[];
|
388
402
|
};
|
389
403
|
readonly status: "NEW" | "UPDATED";
|
390
404
|
readonly source: "INTERNAL";
|
@@ -395,7 +409,6 @@ declare const _default: {
|
|
395
409
|
readonly payload: {
|
396
410
|
readonly article: {
|
397
411
|
readonly id: string;
|
398
|
-
readonly site: string;
|
399
412
|
readonly title: string;
|
400
413
|
readonly teaser: string;
|
401
414
|
readonly content: string;
|
@@ -403,6 +416,11 @@ declare const _default: {
|
|
403
416
|
readonly updatedAt: Date;
|
404
417
|
readonly retrievedAt: Date;
|
405
418
|
readonly url: string;
|
419
|
+
readonly site: string;
|
420
|
+
readonly authors: readonly {
|
421
|
+
readonly name: string;
|
422
|
+
}[];
|
423
|
+
} & {
|
406
424
|
readonly tags: readonly ({
|
407
425
|
readonly type: "CATEGORY";
|
408
426
|
readonly value: string;
|
@@ -410,9 +428,6 @@ declare const _default: {
|
|
410
428
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
411
429
|
readonly id: string;
|
412
430
|
})[];
|
413
|
-
readonly authors: readonly {
|
414
|
-
readonly name: string;
|
415
|
-
}[];
|
416
431
|
};
|
417
432
|
readonly status: "NEW" | "UPDATED";
|
418
433
|
readonly source: "INTERNAL";
|
@@ -421,14 +436,7 @@ declare const _default: {
|
|
421
436
|
Schema: Schema.Struct<{
|
422
437
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
423
438
|
payload: Schema.Struct<{
|
424
|
-
article: Schema.Struct<{
|
425
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
426
|
-
type: Schema.Literal<["CATEGORY"]>;
|
427
|
-
value: typeof Schema.NonEmpty;
|
428
|
-
}>, Schema.Struct<{
|
429
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
430
|
-
id: typeof Schema.UUID;
|
431
|
-
}>]>>;
|
439
|
+
article: Schema.extend<Schema.Struct<{
|
432
440
|
id: typeof Schema.UUID;
|
433
441
|
title: typeof Schema.NonEmpty;
|
434
442
|
teaser: typeof Schema.NonEmpty;
|
@@ -441,7 +449,15 @@ declare const _default: {
|
|
441
449
|
authors: Schema.Array$<Schema.Struct<{
|
442
450
|
name: typeof Schema.NonEmpty;
|
443
451
|
}>>;
|
444
|
-
}
|
452
|
+
}>, Schema.Struct<{
|
453
|
+
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
454
|
+
type: Schema.Literal<["CATEGORY"]>;
|
455
|
+
value: typeof Schema.NonEmpty;
|
456
|
+
}>, Schema.Struct<{
|
457
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
458
|
+
id: typeof Schema.UUID;
|
459
|
+
}>]>>;
|
460
|
+
}>>;
|
445
461
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
446
462
|
source: Schema.Literal<["INTERNAL"]>;
|
447
463
|
}>;
|
@@ -4,14 +4,15 @@ exports.InternalArticleEventSchema = void 0;
|
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
5
|
const Article_1 = require("../types/Article");
|
6
6
|
const makeHelpers_1 = require("../utils/makeHelpers");
|
7
|
-
const
|
8
|
-
|
7
|
+
const InternalArticleSchema = schema_1.Schema.extend(Article_1.BaseArticleSchema, schema_1.Schema.Struct({
|
8
|
+
tags: schema_1.Schema.Array(schema_1.Schema.Union(Article_1.CategoryTagSchema, Article_1.ExternalArticleReferenceTagSchema)),
|
9
|
+
}));
|
9
10
|
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
10
|
-
kind: schema_1.Schema.Literal(
|
11
|
+
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
11
12
|
payload: schema_1.Schema.Struct({
|
12
|
-
article:
|
13
|
-
status: schema_1.Schema.Literal(
|
14
|
-
source: schema_1.Schema.Literal(
|
13
|
+
article: InternalArticleSchema,
|
14
|
+
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
15
|
+
source: schema_1.Schema.Literal('INTERNAL'),
|
15
16
|
}),
|
16
17
|
});
|
17
18
|
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
package/lib/types/Article.d.ts
CHANGED
@@ -4,35 +4,14 @@ export declare const CategoryTagSchema: Schema.Struct<{
|
|
4
4
|
type: Schema.Literal<["CATEGORY"]>;
|
5
5
|
value: typeof Schema.NonEmpty;
|
6
6
|
}>;
|
7
|
-
export declare const
|
7
|
+
export declare const ExternalArticleReferenceTagSchema: Schema.Struct<{
|
8
8
|
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
9
9
|
id: typeof Schema.UUID;
|
10
10
|
}>;
|
11
|
-
export declare const EntityTag: Schema.Struct<{
|
12
|
-
type: Schema.Literal<["ENTITY"]>;
|
13
|
-
entityType: Schema.Literal<["PERSON"]>;
|
14
|
-
value: typeof Schema.NonEmpty;
|
15
|
-
}>;
|
16
|
-
export declare const TagSchema: Schema.Union<[Schema.Struct<{
|
17
|
-
type: Schema.Literal<["CATEGORY"]>;
|
18
|
-
value: typeof Schema.NonEmpty;
|
19
|
-
}>, Schema.Struct<{
|
20
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
21
|
-
id: typeof Schema.UUID;
|
22
|
-
}>, Schema.Struct<{
|
23
|
-
type: Schema.Literal<["ENTITY"]>;
|
24
|
-
entityType: Schema.Literal<["PERSON"]>;
|
25
|
-
value: typeof Schema.NonEmpty;
|
26
|
-
}>]>;
|
27
11
|
export declare const AuthorSchema: Schema.Struct<{
|
28
12
|
name: typeof Schema.NonEmpty;
|
29
13
|
}>;
|
30
|
-
export declare const
|
31
|
-
site: typeof Schema.String;
|
32
|
-
relevance: typeof Schema.Number;
|
33
|
-
potential: typeof Schema.Number;
|
34
|
-
}>>;
|
35
|
-
export declare const ArticleSchema: Schema.Struct<{
|
14
|
+
export declare const BaseArticleSchema: Schema.Struct<{
|
36
15
|
id: typeof Schema.UUID;
|
37
16
|
title: typeof Schema.NonEmpty;
|
38
17
|
teaser: typeof Schema.NonEmpty;
|
@@ -42,17 +21,6 @@ export declare const ArticleSchema: Schema.Struct<{
|
|
42
21
|
retrievedAt: typeof Schema.Date;
|
43
22
|
url: typeof Schema.NonEmpty;
|
44
23
|
site: typeof Schema.NonEmpty;
|
45
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
46
|
-
type: Schema.Literal<["CATEGORY"]>;
|
47
|
-
value: typeof Schema.NonEmpty;
|
48
|
-
}>, Schema.Struct<{
|
49
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
50
|
-
id: typeof Schema.UUID;
|
51
|
-
}>, Schema.Struct<{
|
52
|
-
type: Schema.Literal<["ENTITY"]>;
|
53
|
-
entityType: Schema.Literal<["PERSON"]>;
|
54
|
-
value: typeof Schema.NonEmpty;
|
55
|
-
}>]>>;
|
56
24
|
authors: Schema.Array$<Schema.Struct<{
|
57
25
|
name: typeof Schema.NonEmpty;
|
58
26
|
}>>;
|
package/lib/types/Article.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.BaseArticleSchema = exports.AuthorSchema = exports.ExternalArticleReferenceTagSchema = exports.CategoryTagSchema = exports.DateTimeSchema = void 0;
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
5
|
exports.DateTimeSchema = schema_1.Schema.Date.annotations({
|
6
6
|
jsonSchema: { format: 'date-time' },
|
@@ -9,26 +9,14 @@ exports.CategoryTagSchema = schema_1.Schema.Struct({
|
|
9
9
|
type: schema_1.Schema.Literal('CATEGORY'),
|
10
10
|
value: schema_1.Schema.NonEmpty,
|
11
11
|
});
|
12
|
-
exports.
|
12
|
+
exports.ExternalArticleReferenceTagSchema = schema_1.Schema.Struct({
|
13
13
|
type: schema_1.Schema.Literal('EXTERNAL_ARTICLE_REFERENCE'),
|
14
14
|
id: schema_1.Schema.UUID,
|
15
15
|
});
|
16
|
-
exports.EntityTag = schema_1.Schema.Struct({
|
17
|
-
type: schema_1.Schema.Literal('ENTITY'),
|
18
|
-
entityType: schema_1.Schema.Literal('PERSON'),
|
19
|
-
value: schema_1.Schema.NonEmpty,
|
20
|
-
});
|
21
|
-
exports.TagSchema = schema_1.Schema.Union(exports.CategoryTagSchema, exports.ArticleReferenceSchema, exports.EntityTag);
|
22
16
|
exports.AuthorSchema = schema_1.Schema.Struct({
|
23
17
|
name: schema_1.Schema.NonEmpty,
|
24
18
|
});
|
25
|
-
|
26
|
-
site: schema_1.Schema.String,
|
27
|
-
relevance: schema_1.Schema.Number,
|
28
|
-
potential: schema_1.Schema.Number,
|
29
|
-
});
|
30
|
-
exports.ScoreItemsSchema = schema_1.Schema.Array(ScoreSchema);
|
31
|
-
exports.ArticleSchema = schema_1.Schema.Struct({
|
19
|
+
exports.BaseArticleSchema = schema_1.Schema.Struct({
|
32
20
|
id: schema_1.Schema.UUID,
|
33
21
|
title: schema_1.Schema.NonEmpty,
|
34
22
|
teaser: schema_1.Schema.NonEmpty,
|
@@ -38,6 +26,5 @@ exports.ArticleSchema = schema_1.Schema.Struct({
|
|
38
26
|
retrievedAt: exports.DateTimeSchema,
|
39
27
|
url: schema_1.Schema.NonEmpty,
|
40
28
|
site: schema_1.Schema.NonEmpty,
|
41
|
-
tags: schema_1.Schema.Array(exports.TagSchema),
|
42
29
|
authors: schema_1.Schema.Array(exports.AuthorSchema),
|
43
30
|
});
|
package/lib/utils/makeHelpers.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@productminds/article-events",
|
3
|
-
"version": "0.0
|
3
|
+
"version": "1.0.0",
|
4
4
|
"description": "Article events",
|
5
5
|
"license": "ISC",
|
6
6
|
"main": "lib/article-events.js",
|
@@ -15,6 +15,6 @@
|
|
15
15
|
"cmd:generate_json_schema": "tsc && node ./lib/cmd/write-json-schema.js",
|
16
16
|
"build": "tsc",
|
17
17
|
"build:watch": "tsc --watch",
|
18
|
-
"build_and_publish": "npm run build &&
|
18
|
+
"build_and_publish": "npm run build && npm publish"
|
19
19
|
}
|
20
20
|
}
|