@productminds/article-events 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +11 -0
- package/lib/article-events.d.ts +4 -0
- package/lib/article-events.js +12 -0
- package/lib/cmd/write-json-schema.d.ts +1 -0
- package/lib/cmd/write-json-schema.js +14 -0
- package/{dist/src → lib}/events/ArticleEvent.d.ts +14 -29
- package/{dist/src → lib}/events/ArticleEvent.js +3 -3
- package/{dist/src → lib}/events/ExternalArticleEvent.d.ts +50 -178
- package/{dist/src → lib}/events/ExternalArticleEvent.js +6 -4
- package/{dist/src → lib}/events/InternalArticleEvent.d.ts +30 -110
- package/lib/events/InternalArticleEvent.js +18 -0
- package/{dist/src → lib}/types/Article.d.ts +5 -1
- package/{dist/src → lib}/types/Article.js +12 -7
- package/package.json +13 -16
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -29
- package/dist/src/events/InternalArticleEvent.js +0 -16
- package/index.ts +0 -5
- package/src/events/ArticleEvent.ts +0 -19
- package/src/events/ExternalArticleEvent.ts +0 -19
- package/src/events/InternalArticleEvent.ts +0 -19
- package/src/types/Article.ts +0 -46
- package/src/utils/makeHelpers.ts +0 -55
- package/tsconfig.json +0 -100
- /package/{dist/src → lib}/utils/makeHelpers.d.ts +0 -0
- /package/{dist/src → lib}/utils/makeHelpers.js +0 -0
@@ -1,8 +1,15 @@
|
|
1
|
-
import { Schema } from
|
2
|
-
export declare const
|
1
|
+
import { Schema } from "@effect/schema";
|
2
|
+
export declare const InternalArticleEventSchema: Schema.Struct<{
|
3
3
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
4
4
|
payload: Schema.Struct<{
|
5
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
|
+
}>]>>;
|
6
13
|
id: typeof Schema.UUID;
|
7
14
|
title: typeof Schema.NonEmpty;
|
8
15
|
teaser: typeof Schema.NonEmpty;
|
@@ -12,21 +19,9 @@ export declare const InternalArticleEvent: Schema.Struct<{
|
|
12
19
|
retrievedAt: typeof Schema.Date;
|
13
20
|
url: typeof Schema.NonEmpty;
|
14
21
|
site: typeof Schema.NonEmpty;
|
15
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
16
|
-
type: Schema.Literal<["CATEGORY"]>;
|
17
|
-
value: typeof Schema.NonEmpty;
|
18
|
-
}>, Schema.Struct<{
|
19
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
20
|
-
id: typeof Schema.UUID;
|
21
|
-
}>, Schema.Struct<{
|
22
|
-
type: Schema.Literal<["ENTITY"]>;
|
23
|
-
entityType: Schema.Literal<["PERSON"]>;
|
24
|
-
value: typeof Schema.NonEmpty;
|
25
|
-
}>]>>;
|
26
22
|
authors: Schema.Array$<Schema.Struct<{
|
27
23
|
name: typeof Schema.NonEmpty;
|
28
24
|
}>>;
|
29
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
30
25
|
}>;
|
31
26
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
32
27
|
source: Schema.Literal<["INTERNAL"]>;
|
@@ -38,6 +33,7 @@ declare const _default: {
|
|
38
33
|
readonly payload: {
|
39
34
|
readonly article: {
|
40
35
|
readonly id: string;
|
36
|
+
readonly site: string;
|
41
37
|
readonly title: string;
|
42
38
|
readonly teaser: string;
|
43
39
|
readonly content: string;
|
@@ -45,22 +41,16 @@ declare const _default: {
|
|
45
41
|
readonly updatedAt: Date;
|
46
42
|
readonly retrievedAt: Date;
|
47
43
|
readonly url: string;
|
48
|
-
readonly site: string;
|
49
44
|
readonly tags: readonly ({
|
50
45
|
readonly type: "CATEGORY";
|
51
46
|
readonly value: string;
|
52
47
|
} | {
|
53
48
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
54
49
|
readonly id: string;
|
55
|
-
} | {
|
56
|
-
readonly type: "ENTITY";
|
57
|
-
readonly value: string;
|
58
|
-
readonly entityType: "PERSON";
|
59
50
|
})[];
|
60
51
|
readonly authors: readonly {
|
61
52
|
readonly name: string;
|
62
53
|
}[];
|
63
|
-
readonly meta?: unknown;
|
64
54
|
};
|
65
55
|
readonly status: "NEW" | "UPDATED";
|
66
56
|
readonly source: "INTERNAL";
|
@@ -71,6 +61,7 @@ declare const _default: {
|
|
71
61
|
readonly payload: {
|
72
62
|
readonly article: {
|
73
63
|
readonly id: string;
|
64
|
+
readonly site: string;
|
74
65
|
readonly title: string;
|
75
66
|
readonly teaser: string;
|
76
67
|
readonly content: string;
|
@@ -78,22 +69,16 @@ declare const _default: {
|
|
78
69
|
readonly updatedAt: Date;
|
79
70
|
readonly retrievedAt: Date;
|
80
71
|
readonly url: string;
|
81
|
-
readonly site: string;
|
82
72
|
readonly tags: readonly ({
|
83
73
|
readonly type: "CATEGORY";
|
84
74
|
readonly value: string;
|
85
75
|
} | {
|
86
76
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
87
77
|
readonly id: string;
|
88
|
-
} | {
|
89
|
-
readonly type: "ENTITY";
|
90
|
-
readonly value: string;
|
91
|
-
readonly entityType: "PERSON";
|
92
78
|
})[];
|
93
79
|
readonly authors: readonly {
|
94
80
|
readonly name: string;
|
95
81
|
}[];
|
96
|
-
readonly meta?: unknown;
|
97
82
|
};
|
98
83
|
readonly status: "NEW" | "UPDATED";
|
99
84
|
readonly source: "INTERNAL";
|
@@ -104,6 +89,7 @@ declare const _default: {
|
|
104
89
|
readonly payload: {
|
105
90
|
readonly article: {
|
106
91
|
readonly id: string;
|
92
|
+
readonly site: string;
|
107
93
|
readonly title: string;
|
108
94
|
readonly teaser: string;
|
109
95
|
readonly content: string;
|
@@ -111,22 +97,16 @@ declare const _default: {
|
|
111
97
|
readonly updatedAt: Date;
|
112
98
|
readonly retrievedAt: Date;
|
113
99
|
readonly url: string;
|
114
|
-
readonly site: string;
|
115
100
|
readonly tags: readonly ({
|
116
101
|
readonly type: "CATEGORY";
|
117
102
|
readonly value: string;
|
118
103
|
} | {
|
119
104
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
120
105
|
readonly id: string;
|
121
|
-
} | {
|
122
|
-
readonly type: "ENTITY";
|
123
|
-
readonly value: string;
|
124
|
-
readonly entityType: "PERSON";
|
125
106
|
})[];
|
126
107
|
readonly authors: readonly {
|
127
108
|
readonly name: string;
|
128
109
|
}[];
|
129
|
-
readonly meta?: unknown;
|
130
110
|
};
|
131
111
|
readonly status: "NEW" | "UPDATED";
|
132
112
|
readonly source: "INTERNAL";
|
@@ -136,6 +116,7 @@ declare const _default: {
|
|
136
116
|
readonly payload: {
|
137
117
|
readonly article: {
|
138
118
|
readonly id: string;
|
119
|
+
readonly site: string;
|
139
120
|
readonly title: string;
|
140
121
|
readonly teaser: string;
|
141
122
|
readonly content: string;
|
@@ -143,22 +124,16 @@ declare const _default: {
|
|
143
124
|
readonly updatedAt: string;
|
144
125
|
readonly retrievedAt: string;
|
145
126
|
readonly url: string;
|
146
|
-
readonly site: string;
|
147
127
|
readonly tags: readonly ({
|
148
128
|
readonly type: "CATEGORY";
|
149
129
|
readonly value: string;
|
150
130
|
} | {
|
151
131
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
152
132
|
readonly id: string;
|
153
|
-
} | {
|
154
|
-
readonly type: "ENTITY";
|
155
|
-
readonly value: string;
|
156
|
-
readonly entityType: "PERSON";
|
157
133
|
})[];
|
158
134
|
readonly authors: readonly {
|
159
135
|
readonly name: string;
|
160
136
|
}[];
|
161
|
-
readonly meta?: unknown;
|
162
137
|
};
|
163
138
|
readonly status: "NEW" | "UPDATED";
|
164
139
|
readonly source: "INTERNAL";
|
@@ -169,6 +144,7 @@ declare const _default: {
|
|
169
144
|
readonly payload: {
|
170
145
|
readonly article: {
|
171
146
|
readonly id: string;
|
147
|
+
readonly site: string;
|
172
148
|
readonly title: string;
|
173
149
|
readonly teaser: string;
|
174
150
|
readonly content: string;
|
@@ -176,22 +152,16 @@ declare const _default: {
|
|
176
152
|
readonly updatedAt: Date;
|
177
153
|
readonly retrievedAt: Date;
|
178
154
|
readonly url: string;
|
179
|
-
readonly site: string;
|
180
155
|
readonly tags: readonly ({
|
181
156
|
readonly type: "CATEGORY";
|
182
157
|
readonly value: string;
|
183
158
|
} | {
|
184
159
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
185
160
|
readonly id: string;
|
186
|
-
} | {
|
187
|
-
readonly type: "ENTITY";
|
188
|
-
readonly value: string;
|
189
|
-
readonly entityType: "PERSON";
|
190
161
|
})[];
|
191
162
|
readonly authors: readonly {
|
192
163
|
readonly name: string;
|
193
164
|
}[];
|
194
|
-
readonly meta?: unknown;
|
195
165
|
};
|
196
166
|
readonly status: "NEW" | "UPDATED";
|
197
167
|
readonly source: "INTERNAL";
|
@@ -201,6 +171,7 @@ declare const _default: {
|
|
201
171
|
readonly payload: {
|
202
172
|
readonly article: {
|
203
173
|
readonly id: string;
|
174
|
+
readonly site: string;
|
204
175
|
readonly title: string;
|
205
176
|
readonly teaser: string;
|
206
177
|
readonly content: string;
|
@@ -208,22 +179,16 @@ declare const _default: {
|
|
208
179
|
readonly updatedAt: string;
|
209
180
|
readonly retrievedAt: string;
|
210
181
|
readonly url: string;
|
211
|
-
readonly site: string;
|
212
182
|
readonly tags: readonly ({
|
213
183
|
readonly type: "CATEGORY";
|
214
184
|
readonly value: string;
|
215
185
|
} | {
|
216
186
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
217
187
|
readonly id: string;
|
218
|
-
} | {
|
219
|
-
readonly type: "ENTITY";
|
220
|
-
readonly value: string;
|
221
|
-
readonly entityType: "PERSON";
|
222
188
|
})[];
|
223
189
|
readonly authors: readonly {
|
224
190
|
readonly name: string;
|
225
191
|
}[];
|
226
|
-
readonly meta?: unknown;
|
227
192
|
};
|
228
193
|
readonly status: "NEW" | "UPDATED";
|
229
194
|
readonly source: "INTERNAL";
|
@@ -234,6 +199,7 @@ declare const _default: {
|
|
234
199
|
readonly payload: {
|
235
200
|
readonly article: {
|
236
201
|
readonly id: string;
|
202
|
+
readonly site: string;
|
237
203
|
readonly title: string;
|
238
204
|
readonly teaser: string;
|
239
205
|
readonly content: string;
|
@@ -241,22 +207,16 @@ declare const _default: {
|
|
241
207
|
readonly updatedAt: Date;
|
242
208
|
readonly retrievedAt: Date;
|
243
209
|
readonly url: string;
|
244
|
-
readonly site: string;
|
245
210
|
readonly tags: readonly ({
|
246
211
|
readonly type: "CATEGORY";
|
247
212
|
readonly value: string;
|
248
213
|
} | {
|
249
214
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
250
215
|
readonly id: string;
|
251
|
-
} | {
|
252
|
-
readonly type: "ENTITY";
|
253
|
-
readonly value: string;
|
254
|
-
readonly entityType: "PERSON";
|
255
216
|
})[];
|
256
217
|
readonly authors: readonly {
|
257
218
|
readonly name: string;
|
258
219
|
}[];
|
259
|
-
readonly meta?: unknown;
|
260
220
|
};
|
261
221
|
readonly status: "NEW" | "UPDATED";
|
262
222
|
readonly source: "INTERNAL";
|
@@ -267,6 +227,7 @@ declare const _default: {
|
|
267
227
|
readonly payload: {
|
268
228
|
readonly article: {
|
269
229
|
readonly id: string;
|
230
|
+
readonly site: string;
|
270
231
|
readonly title: string;
|
271
232
|
readonly teaser: string;
|
272
233
|
readonly content: string;
|
@@ -274,22 +235,16 @@ declare const _default: {
|
|
274
235
|
readonly updatedAt: Date;
|
275
236
|
readonly retrievedAt: Date;
|
276
237
|
readonly url: string;
|
277
|
-
readonly site: string;
|
278
238
|
readonly tags: readonly ({
|
279
239
|
readonly type: "CATEGORY";
|
280
240
|
readonly value: string;
|
281
241
|
} | {
|
282
242
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
283
243
|
readonly id: string;
|
284
|
-
} | {
|
285
|
-
readonly type: "ENTITY";
|
286
|
-
readonly value: string;
|
287
|
-
readonly entityType: "PERSON";
|
288
244
|
})[];
|
289
245
|
readonly authors: readonly {
|
290
246
|
readonly name: string;
|
291
247
|
}[];
|
292
|
-
readonly meta?: unknown;
|
293
248
|
};
|
294
249
|
readonly status: "NEW" | "UPDATED";
|
295
250
|
readonly source: "INTERNAL";
|
@@ -300,6 +255,7 @@ declare const _default: {
|
|
300
255
|
readonly payload: {
|
301
256
|
readonly article: {
|
302
257
|
readonly id: string;
|
258
|
+
readonly site: string;
|
303
259
|
readonly title: string;
|
304
260
|
readonly teaser: string;
|
305
261
|
readonly content: string;
|
@@ -307,22 +263,16 @@ declare const _default: {
|
|
307
263
|
readonly updatedAt: Date;
|
308
264
|
readonly retrievedAt: Date;
|
309
265
|
readonly url: string;
|
310
|
-
readonly site: string;
|
311
266
|
readonly tags: readonly ({
|
312
267
|
readonly type: "CATEGORY";
|
313
268
|
readonly value: string;
|
314
269
|
} | {
|
315
270
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
316
271
|
readonly id: string;
|
317
|
-
} | {
|
318
|
-
readonly type: "ENTITY";
|
319
|
-
readonly value: string;
|
320
|
-
readonly entityType: "PERSON";
|
321
272
|
})[];
|
322
273
|
readonly authors: readonly {
|
323
274
|
readonly name: string;
|
324
275
|
}[];
|
325
|
-
readonly meta?: unknown;
|
326
276
|
};
|
327
277
|
readonly status: "NEW" | "UPDATED";
|
328
278
|
readonly source: "INTERNAL";
|
@@ -333,6 +283,7 @@ declare const _default: {
|
|
333
283
|
readonly payload: {
|
334
284
|
readonly article: {
|
335
285
|
readonly id: string;
|
286
|
+
readonly site: string;
|
336
287
|
readonly title: string;
|
337
288
|
readonly teaser: string;
|
338
289
|
readonly content: string;
|
@@ -340,22 +291,16 @@ declare const _default: {
|
|
340
291
|
readonly updatedAt: Date;
|
341
292
|
readonly retrievedAt: Date;
|
342
293
|
readonly url: string;
|
343
|
-
readonly site: string;
|
344
294
|
readonly tags: readonly ({
|
345
295
|
readonly type: "CATEGORY";
|
346
296
|
readonly value: string;
|
347
297
|
} | {
|
348
298
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
349
299
|
readonly id: string;
|
350
|
-
} | {
|
351
|
-
readonly type: "ENTITY";
|
352
|
-
readonly value: string;
|
353
|
-
readonly entityType: "PERSON";
|
354
300
|
})[];
|
355
301
|
readonly authors: readonly {
|
356
302
|
readonly name: string;
|
357
303
|
}[];
|
358
|
-
readonly meta?: unknown;
|
359
304
|
};
|
360
305
|
readonly status: "NEW" | "UPDATED";
|
361
306
|
readonly source: "INTERNAL";
|
@@ -366,6 +311,7 @@ declare const _default: {
|
|
366
311
|
readonly payload: {
|
367
312
|
readonly article: {
|
368
313
|
readonly id: string;
|
314
|
+
readonly site: string;
|
369
315
|
readonly title: string;
|
370
316
|
readonly teaser: string;
|
371
317
|
readonly content: string;
|
@@ -373,22 +319,16 @@ declare const _default: {
|
|
373
319
|
readonly updatedAt: Date;
|
374
320
|
readonly retrievedAt: Date;
|
375
321
|
readonly url: string;
|
376
|
-
readonly site: string;
|
377
322
|
readonly tags: readonly ({
|
378
323
|
readonly type: "CATEGORY";
|
379
324
|
readonly value: string;
|
380
325
|
} | {
|
381
326
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
382
327
|
readonly id: string;
|
383
|
-
} | {
|
384
|
-
readonly type: "ENTITY";
|
385
|
-
readonly value: string;
|
386
|
-
readonly entityType: "PERSON";
|
387
328
|
})[];
|
388
329
|
readonly authors: readonly {
|
389
330
|
readonly name: string;
|
390
331
|
}[];
|
391
|
-
readonly meta?: unknown;
|
392
332
|
};
|
393
333
|
readonly status: "NEW" | "UPDATED";
|
394
334
|
readonly source: "INTERNAL";
|
@@ -399,6 +339,7 @@ declare const _default: {
|
|
399
339
|
readonly payload: {
|
400
340
|
readonly article: {
|
401
341
|
readonly id: string;
|
342
|
+
readonly site: string;
|
402
343
|
readonly title: string;
|
403
344
|
readonly teaser: string;
|
404
345
|
readonly content: string;
|
@@ -406,22 +347,16 @@ declare const _default: {
|
|
406
347
|
readonly updatedAt: Date;
|
407
348
|
readonly retrievedAt: Date;
|
408
349
|
readonly url: string;
|
409
|
-
readonly site: string;
|
410
350
|
readonly tags: readonly ({
|
411
351
|
readonly type: "CATEGORY";
|
412
352
|
readonly value: string;
|
413
353
|
} | {
|
414
354
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
415
355
|
readonly id: string;
|
416
|
-
} | {
|
417
|
-
readonly type: "ENTITY";
|
418
|
-
readonly value: string;
|
419
|
-
readonly entityType: "PERSON";
|
420
356
|
})[];
|
421
357
|
readonly authors: readonly {
|
422
358
|
readonly name: string;
|
423
359
|
}[];
|
424
|
-
readonly meta?: unknown;
|
425
360
|
};
|
426
361
|
readonly status: "NEW" | "UPDATED";
|
427
362
|
readonly source: "INTERNAL";
|
@@ -432,6 +367,7 @@ declare const _default: {
|
|
432
367
|
readonly payload: {
|
433
368
|
readonly article: {
|
434
369
|
readonly id: string;
|
370
|
+
readonly site: string;
|
435
371
|
readonly title: string;
|
436
372
|
readonly teaser: string;
|
437
373
|
readonly content: string;
|
@@ -439,22 +375,16 @@ declare const _default: {
|
|
439
375
|
readonly updatedAt: Date;
|
440
376
|
readonly retrievedAt: Date;
|
441
377
|
readonly url: string;
|
442
|
-
readonly site: string;
|
443
378
|
readonly tags: readonly ({
|
444
379
|
readonly type: "CATEGORY";
|
445
380
|
readonly value: string;
|
446
381
|
} | {
|
447
382
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
448
383
|
readonly id: string;
|
449
|
-
} | {
|
450
|
-
readonly type: "ENTITY";
|
451
|
-
readonly value: string;
|
452
|
-
readonly entityType: "PERSON";
|
453
384
|
})[];
|
454
385
|
readonly authors: readonly {
|
455
386
|
readonly name: string;
|
456
387
|
}[];
|
457
|
-
readonly meta?: unknown;
|
458
388
|
};
|
459
389
|
readonly status: "NEW" | "UPDATED";
|
460
390
|
readonly source: "INTERNAL";
|
@@ -465,6 +395,7 @@ declare const _default: {
|
|
465
395
|
readonly payload: {
|
466
396
|
readonly article: {
|
467
397
|
readonly id: string;
|
398
|
+
readonly site: string;
|
468
399
|
readonly title: string;
|
469
400
|
readonly teaser: string;
|
470
401
|
readonly content: string;
|
@@ -472,22 +403,16 @@ declare const _default: {
|
|
472
403
|
readonly updatedAt: Date;
|
473
404
|
readonly retrievedAt: Date;
|
474
405
|
readonly url: string;
|
475
|
-
readonly site: string;
|
476
406
|
readonly tags: readonly ({
|
477
407
|
readonly type: "CATEGORY";
|
478
408
|
readonly value: string;
|
479
409
|
} | {
|
480
410
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
481
411
|
readonly id: string;
|
482
|
-
} | {
|
483
|
-
readonly type: "ENTITY";
|
484
|
-
readonly value: string;
|
485
|
-
readonly entityType: "PERSON";
|
486
412
|
})[];
|
487
413
|
readonly authors: readonly {
|
488
414
|
readonly name: string;
|
489
415
|
}[];
|
490
|
-
readonly meta?: unknown;
|
491
416
|
};
|
492
417
|
readonly status: "NEW" | "UPDATED";
|
493
418
|
readonly source: "INTERNAL";
|
@@ -497,6 +422,13 @@ declare const _default: {
|
|
497
422
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
498
423
|
payload: Schema.Struct<{
|
499
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
|
+
}>]>>;
|
500
432
|
id: typeof Schema.UUID;
|
501
433
|
title: typeof Schema.NonEmpty;
|
502
434
|
teaser: typeof Schema.NonEmpty;
|
@@ -506,21 +438,9 @@ declare const _default: {
|
|
506
438
|
retrievedAt: typeof Schema.Date;
|
507
439
|
url: typeof Schema.NonEmpty;
|
508
440
|
site: typeof Schema.NonEmpty;
|
509
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
510
|
-
type: Schema.Literal<["CATEGORY"]>;
|
511
|
-
value: typeof Schema.NonEmpty;
|
512
|
-
}>, Schema.Struct<{
|
513
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
514
|
-
id: typeof Schema.UUID;
|
515
|
-
}>, Schema.Struct<{
|
516
|
-
type: Schema.Literal<["ENTITY"]>;
|
517
|
-
entityType: Schema.Literal<["PERSON"]>;
|
518
|
-
value: typeof Schema.NonEmpty;
|
519
|
-
}>]>>;
|
520
441
|
authors: Schema.Array$<Schema.Struct<{
|
521
442
|
name: typeof Schema.NonEmpty;
|
522
443
|
}>>;
|
523
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
524
444
|
}>;
|
525
445
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
526
446
|
source: Schema.Literal<["INTERNAL"]>;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InternalArticleEventSchema = void 0;
|
4
|
+
const schema_1 = require("@effect/schema");
|
5
|
+
const Article_1 = require("../types/Article");
|
6
|
+
const makeHelpers_1 = require("../utils/makeHelpers");
|
7
|
+
const TagSchema = schema_1.Schema.Union(Article_1.CategoryTagSchema, Article_1.ArticleReferenceSchema);
|
8
|
+
const ArticleSchema = schema_1.Schema.Struct(Object.assign(Object.assign({}, Article_1.ArticleSchema.fields), { tags: schema_1.Schema.Array(TagSchema) }));
|
9
|
+
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
10
|
+
kind: schema_1.Schema.Literal("INTERNAL_ARTICLE_EVENT"),
|
11
|
+
payload: schema_1.Schema.Struct({
|
12
|
+
article: ArticleSchema,
|
13
|
+
status: schema_1.Schema.Literal("NEW", "UPDATED"),
|
14
|
+
source: schema_1.Schema.Literal("INTERNAL"),
|
15
|
+
}),
|
16
|
+
});
|
17
|
+
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
18
|
+
exports.default = Object.assign({ Schema: exports.InternalArticleEventSchema }, helpers);
|
@@ -27,6 +27,11 @@ export declare const TagSchema: Schema.Union<[Schema.Struct<{
|
|
27
27
|
export declare const AuthorSchema: Schema.Struct<{
|
28
28
|
name: typeof Schema.NonEmpty;
|
29
29
|
}>;
|
30
|
+
export declare const ScoreItemsSchema: Schema.Array$<Schema.Struct<{
|
31
|
+
site: typeof Schema.String;
|
32
|
+
relevance: typeof Schema.Number;
|
33
|
+
potential: typeof Schema.Number;
|
34
|
+
}>>;
|
30
35
|
export declare const ArticleSchema: Schema.Struct<{
|
31
36
|
id: typeof Schema.UUID;
|
32
37
|
title: typeof Schema.NonEmpty;
|
@@ -51,5 +56,4 @@ export declare const ArticleSchema: Schema.Struct<{
|
|
51
56
|
authors: Schema.Array$<Schema.Struct<{
|
52
57
|
name: typeof Schema.NonEmpty;
|
53
58
|
}>>;
|
54
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
55
59
|
}>;
|
@@ -1,27 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ArticleSchema = exports.AuthorSchema = exports.TagSchema = exports.EntityTag = exports.ArticleReferenceSchema = exports.CategoryTagSchema = exports.DateTimeSchema = void 0;
|
3
|
+
exports.ArticleSchema = exports.ScoreItemsSchema = exports.AuthorSchema = exports.TagSchema = exports.EntityTag = exports.ArticleReferenceSchema = exports.CategoryTagSchema = exports.DateTimeSchema = void 0;
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
5
|
exports.DateTimeSchema = schema_1.Schema.Date.annotations({
|
6
|
-
jsonSchema: { format: 'date-time' }
|
6
|
+
jsonSchema: { format: 'date-time' },
|
7
7
|
});
|
8
8
|
exports.CategoryTagSchema = schema_1.Schema.Struct({
|
9
9
|
type: schema_1.Schema.Literal('CATEGORY'),
|
10
|
-
value: schema_1.Schema.NonEmpty
|
10
|
+
value: schema_1.Schema.NonEmpty,
|
11
11
|
});
|
12
12
|
exports.ArticleReferenceSchema = schema_1.Schema.Struct({
|
13
13
|
type: schema_1.Schema.Literal('EXTERNAL_ARTICLE_REFERENCE'),
|
14
|
-
id: schema_1.Schema.UUID
|
14
|
+
id: schema_1.Schema.UUID,
|
15
15
|
});
|
16
16
|
exports.EntityTag = schema_1.Schema.Struct({
|
17
17
|
type: schema_1.Schema.Literal('ENTITY'),
|
18
18
|
entityType: schema_1.Schema.Literal('PERSON'),
|
19
|
-
value: schema_1.Schema.NonEmpty
|
19
|
+
value: schema_1.Schema.NonEmpty,
|
20
20
|
});
|
21
21
|
exports.TagSchema = schema_1.Schema.Union(exports.CategoryTagSchema, exports.ArticleReferenceSchema, exports.EntityTag);
|
22
22
|
exports.AuthorSchema = schema_1.Schema.Struct({
|
23
|
-
name: schema_1.Schema.NonEmpty
|
23
|
+
name: schema_1.Schema.NonEmpty,
|
24
|
+
});
|
25
|
+
const ScoreSchema = schema_1.Schema.Struct({
|
26
|
+
site: schema_1.Schema.String,
|
27
|
+
relevance: schema_1.Schema.Number,
|
28
|
+
potential: schema_1.Schema.Number,
|
24
29
|
});
|
30
|
+
exports.ScoreItemsSchema = schema_1.Schema.Array(ScoreSchema);
|
25
31
|
exports.ArticleSchema = schema_1.Schema.Struct({
|
26
32
|
id: schema_1.Schema.UUID,
|
27
33
|
title: schema_1.Schema.NonEmpty,
|
@@ -34,5 +40,4 @@ exports.ArticleSchema = schema_1.Schema.Struct({
|
|
34
40
|
site: schema_1.Schema.NonEmpty,
|
35
41
|
tags: schema_1.Schema.Array(exports.TagSchema),
|
36
42
|
authors: schema_1.Schema.Array(exports.AuthorSchema),
|
37
|
-
meta: schema_1.Schema.optional(schema_1.Schema.Unknown)
|
38
43
|
});
|
package/package.json
CHANGED
@@ -1,23 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "@productminds/article-events",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "",
|
5
|
-
"
|
6
|
-
"
|
3
|
+
"version": "0.0.11",
|
4
|
+
"description": "Article events",
|
5
|
+
"license": "ISC",
|
6
|
+
"main": "lib/article-events.js",
|
7
|
+
"typings": "lib/article-events.d.ts",
|
8
|
+
"directories": {
|
9
|
+
"lib": "lib"
|
10
|
+
},
|
11
|
+
"files": [
|
12
|
+
"lib"
|
13
|
+
],
|
7
14
|
"scripts": {
|
15
|
+
"cmd:generate_json_schema": "tsc && node ./lib/cmd/write-json-schema.js",
|
8
16
|
"build": "tsc",
|
9
17
|
"build:watch": "tsc --watch",
|
10
|
-
"build_and_publish": "npm run build &&
|
11
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
12
|
-
},
|
13
|
-
"keywords": [],
|
14
|
-
"author": "mbirkegaard",
|
15
|
-
"license": "ISC",
|
16
|
-
"devDependencies": {
|
17
|
-
"@types/node": "^20.14.11",
|
18
|
-
"typescript": "^5.5.3"
|
19
|
-
},
|
20
|
-
"dependencies": {
|
21
|
-
"@effect/schema": "^0.68.26"
|
18
|
+
"build_and_publish": "npm run build && lerna publish from-package"
|
22
19
|
}
|
23
20
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.InternalArticleEvent = exports.ExternalArticleEvent = exports.ArticleEvent = void 0;
|
27
|
-
exports.ArticleEvent = __importStar(require("./src/events/ArticleEvent"));
|
28
|
-
exports.ExternalArticleEvent = __importStar(require("./src/events/ExternalArticleEvent"));
|
29
|
-
exports.InternalArticleEvent = __importStar(require("./src/events/InternalArticleEvent"));
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InternalArticleEvent = void 0;
|
4
|
-
const schema_1 = require("@effect/schema");
|
5
|
-
const Article_1 = require("../types/Article");
|
6
|
-
exports.InternalArticleEvent = schema_1.Schema.Struct({
|
7
|
-
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
8
|
-
payload: schema_1.Schema.Struct({
|
9
|
-
article: Article_1.ArticleSchema,
|
10
|
-
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
11
|
-
source: schema_1.Schema.Literal('INTERNAL')
|
12
|
-
})
|
13
|
-
});
|
14
|
-
const makeHelpers_1 = require("../utils/makeHelpers");
|
15
|
-
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEvent);
|
16
|
-
exports.default = Object.assign({ Schema: exports.InternalArticleEvent }, helpers);
|
package/index.ts
DELETED