@productminds/article-events 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,530 @@
1
+ import { Schema } from '@effect/schema';
2
+ export declare const ExternalArticleEventSchema: Schema.Struct<{
3
+ kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
4
+ payload: Schema.Struct<{
5
+ article: Schema.Struct<{
6
+ id: typeof Schema.UUID;
7
+ title: typeof Schema.NonEmpty;
8
+ teaser: typeof Schema.NonEmpty;
9
+ content: typeof Schema.NonEmpty;
10
+ publishedAt: typeof Schema.Date;
11
+ updatedAt: typeof Schema.Date;
12
+ retrievedAt: typeof Schema.Date;
13
+ url: typeof Schema.NonEmpty;
14
+ 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
+ authors: Schema.Array$<Schema.Struct<{
27
+ name: typeof Schema.NonEmpty;
28
+ }>>;
29
+ meta: Schema.optional<typeof Schema.Unknown>;
30
+ }>;
31
+ status: Schema.Literal<["NEW", "UPDATED"]>;
32
+ source: Schema.Literal<["EXTERNAL"]>;
33
+ }>;
34
+ }>;
35
+ declare const _default: {
36
+ decode: (u: unknown, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
37
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
38
+ readonly payload: {
39
+ readonly article: {
40
+ readonly id: string;
41
+ readonly title: string;
42
+ readonly teaser: string;
43
+ readonly content: string;
44
+ readonly publishedAt: Date;
45
+ readonly updatedAt: Date;
46
+ readonly retrievedAt: Date;
47
+ readonly url: string;
48
+ readonly site: string;
49
+ readonly tags: readonly ({
50
+ readonly type: "CATEGORY";
51
+ readonly value: string;
52
+ } | {
53
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
54
+ readonly id: string;
55
+ } | {
56
+ readonly type: "ENTITY";
57
+ readonly value: string;
58
+ readonly entityType: "PERSON";
59
+ })[];
60
+ readonly authors: readonly {
61
+ readonly name: string;
62
+ }[];
63
+ readonly meta?: unknown;
64
+ };
65
+ readonly status: "NEW" | "UPDATED";
66
+ readonly source: "EXTERNAL";
67
+ };
68
+ }, import("@effect/schema/ParseResult").ParseError>;
69
+ decodeExn: (u: unknown) => {
70
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
71
+ readonly payload: {
72
+ readonly article: {
73
+ readonly id: string;
74
+ readonly title: string;
75
+ readonly teaser: string;
76
+ readonly content: string;
77
+ readonly publishedAt: Date;
78
+ readonly updatedAt: Date;
79
+ readonly retrievedAt: Date;
80
+ readonly url: string;
81
+ readonly site: string;
82
+ readonly tags: readonly ({
83
+ readonly type: "CATEGORY";
84
+ readonly value: string;
85
+ } | {
86
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
87
+ readonly id: string;
88
+ } | {
89
+ readonly type: "ENTITY";
90
+ readonly value: string;
91
+ readonly entityType: "PERSON";
92
+ })[];
93
+ readonly authors: readonly {
94
+ readonly name: string;
95
+ }[];
96
+ readonly meta?: unknown;
97
+ };
98
+ readonly status: "NEW" | "UPDATED";
99
+ readonly source: "EXTERNAL";
100
+ };
101
+ };
102
+ encode: (a: {
103
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
104
+ readonly payload: {
105
+ readonly article: {
106
+ readonly id: string;
107
+ readonly title: string;
108
+ readonly teaser: string;
109
+ readonly content: string;
110
+ readonly publishedAt: Date;
111
+ readonly updatedAt: Date;
112
+ readonly retrievedAt: Date;
113
+ readonly url: string;
114
+ readonly site: string;
115
+ readonly tags: readonly ({
116
+ readonly type: "CATEGORY";
117
+ readonly value: string;
118
+ } | {
119
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
120
+ readonly id: string;
121
+ } | {
122
+ readonly type: "ENTITY";
123
+ readonly value: string;
124
+ readonly entityType: "PERSON";
125
+ })[];
126
+ readonly authors: readonly {
127
+ readonly name: string;
128
+ }[];
129
+ readonly meta?: unknown;
130
+ };
131
+ readonly status: "NEW" | "UPDATED";
132
+ readonly source: "EXTERNAL";
133
+ };
134
+ }, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
135
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
136
+ readonly payload: {
137
+ readonly article: {
138
+ readonly id: string;
139
+ readonly title: string;
140
+ readonly teaser: string;
141
+ readonly content: string;
142
+ readonly publishedAt: string;
143
+ readonly updatedAt: string;
144
+ readonly retrievedAt: string;
145
+ readonly url: string;
146
+ readonly site: string;
147
+ readonly tags: readonly ({
148
+ readonly type: "CATEGORY";
149
+ readonly value: string;
150
+ } | {
151
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
152
+ readonly id: string;
153
+ } | {
154
+ readonly type: "ENTITY";
155
+ readonly value: string;
156
+ readonly entityType: "PERSON";
157
+ })[];
158
+ readonly authors: readonly {
159
+ readonly name: string;
160
+ }[];
161
+ readonly meta?: unknown;
162
+ };
163
+ readonly status: "NEW" | "UPDATED";
164
+ readonly source: "EXTERNAL";
165
+ };
166
+ }, import("@effect/schema/ParseResult").ParseError>;
167
+ encodeExn: (event: {
168
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
169
+ readonly payload: {
170
+ readonly article: {
171
+ readonly id: string;
172
+ readonly title: string;
173
+ readonly teaser: string;
174
+ readonly content: string;
175
+ readonly publishedAt: Date;
176
+ readonly updatedAt: Date;
177
+ readonly retrievedAt: Date;
178
+ readonly url: string;
179
+ readonly site: string;
180
+ readonly tags: readonly ({
181
+ readonly type: "CATEGORY";
182
+ readonly value: string;
183
+ } | {
184
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
185
+ readonly id: string;
186
+ } | {
187
+ readonly type: "ENTITY";
188
+ readonly value: string;
189
+ readonly entityType: "PERSON";
190
+ })[];
191
+ readonly authors: readonly {
192
+ readonly name: string;
193
+ }[];
194
+ readonly meta?: unknown;
195
+ };
196
+ readonly status: "NEW" | "UPDATED";
197
+ readonly source: "EXTERNAL";
198
+ };
199
+ }) => {
200
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
201
+ readonly payload: {
202
+ readonly article: {
203
+ readonly id: string;
204
+ readonly title: string;
205
+ readonly teaser: string;
206
+ readonly content: string;
207
+ readonly publishedAt: string;
208
+ readonly updatedAt: string;
209
+ readonly retrievedAt: string;
210
+ readonly url: string;
211
+ readonly site: string;
212
+ readonly tags: readonly ({
213
+ readonly type: "CATEGORY";
214
+ readonly value: string;
215
+ } | {
216
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
217
+ readonly id: string;
218
+ } | {
219
+ readonly type: "ENTITY";
220
+ readonly value: string;
221
+ readonly entityType: "PERSON";
222
+ })[];
223
+ readonly authors: readonly {
224
+ readonly name: string;
225
+ }[];
226
+ readonly meta?: unknown;
227
+ };
228
+ readonly status: "NEW" | "UPDATED";
229
+ readonly source: "EXTERNAL";
230
+ };
231
+ };
232
+ fromString: (msg: string) => import("effect/Either").Either<{
233
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
234
+ readonly payload: {
235
+ readonly article: {
236
+ readonly id: string;
237
+ readonly title: string;
238
+ readonly teaser: string;
239
+ readonly content: string;
240
+ readonly publishedAt: Date;
241
+ readonly updatedAt: Date;
242
+ readonly retrievedAt: Date;
243
+ readonly url: string;
244
+ readonly site: string;
245
+ readonly tags: readonly ({
246
+ readonly type: "CATEGORY";
247
+ readonly value: string;
248
+ } | {
249
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
250
+ readonly id: string;
251
+ } | {
252
+ readonly type: "ENTITY";
253
+ readonly value: string;
254
+ readonly entityType: "PERSON";
255
+ })[];
256
+ readonly authors: readonly {
257
+ readonly name: string;
258
+ }[];
259
+ readonly meta?: unknown;
260
+ };
261
+ readonly status: "NEW" | "UPDATED";
262
+ readonly source: "EXTERNAL";
263
+ };
264
+ }, import("@effect/schema/ParseResult").ParseError>;
265
+ fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
266
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
267
+ readonly payload: {
268
+ readonly article: {
269
+ readonly id: string;
270
+ readonly title: string;
271
+ readonly teaser: string;
272
+ readonly content: string;
273
+ readonly publishedAt: Date;
274
+ readonly updatedAt: Date;
275
+ readonly retrievedAt: Date;
276
+ readonly url: string;
277
+ readonly site: string;
278
+ readonly tags: readonly ({
279
+ readonly type: "CATEGORY";
280
+ readonly value: string;
281
+ } | {
282
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
283
+ readonly id: string;
284
+ } | {
285
+ readonly type: "ENTITY";
286
+ readonly value: string;
287
+ readonly entityType: "PERSON";
288
+ })[];
289
+ readonly authors: readonly {
290
+ readonly name: string;
291
+ }[];
292
+ readonly meta?: unknown;
293
+ };
294
+ readonly status: "NEW" | "UPDATED";
295
+ readonly source: "EXTERNAL";
296
+ };
297
+ }, import("@effect/schema/ParseResult").ParseError>;
298
+ fromStringExn: (msg: string) => {
299
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
300
+ readonly payload: {
301
+ readonly article: {
302
+ readonly id: string;
303
+ readonly title: string;
304
+ readonly teaser: string;
305
+ readonly content: string;
306
+ readonly publishedAt: Date;
307
+ readonly updatedAt: Date;
308
+ readonly retrievedAt: Date;
309
+ readonly url: string;
310
+ readonly site: string;
311
+ readonly tags: readonly ({
312
+ readonly type: "CATEGORY";
313
+ readonly value: string;
314
+ } | {
315
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
316
+ readonly id: string;
317
+ } | {
318
+ readonly type: "ENTITY";
319
+ readonly value: string;
320
+ readonly entityType: "PERSON";
321
+ })[];
322
+ readonly authors: readonly {
323
+ readonly name: string;
324
+ }[];
325
+ readonly meta?: unknown;
326
+ };
327
+ readonly status: "NEW" | "UPDATED";
328
+ readonly source: "EXTERNAL";
329
+ };
330
+ };
331
+ fromBufferExn: (msg: Buffer) => {
332
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
333
+ readonly payload: {
334
+ readonly article: {
335
+ readonly id: string;
336
+ readonly title: string;
337
+ readonly teaser: string;
338
+ readonly content: string;
339
+ readonly publishedAt: Date;
340
+ readonly updatedAt: Date;
341
+ readonly retrievedAt: Date;
342
+ readonly url: string;
343
+ readonly site: string;
344
+ readonly tags: readonly ({
345
+ readonly type: "CATEGORY";
346
+ readonly value: string;
347
+ } | {
348
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
349
+ readonly id: string;
350
+ } | {
351
+ readonly type: "ENTITY";
352
+ readonly value: string;
353
+ readonly entityType: "PERSON";
354
+ })[];
355
+ readonly authors: readonly {
356
+ readonly name: string;
357
+ }[];
358
+ readonly meta?: unknown;
359
+ };
360
+ readonly status: "NEW" | "UPDATED";
361
+ readonly source: "EXTERNAL";
362
+ };
363
+ };
364
+ toString: (event: {
365
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
366
+ readonly payload: {
367
+ readonly article: {
368
+ readonly id: string;
369
+ readonly title: string;
370
+ readonly teaser: string;
371
+ readonly content: string;
372
+ readonly publishedAt: Date;
373
+ readonly updatedAt: Date;
374
+ readonly retrievedAt: Date;
375
+ readonly url: string;
376
+ readonly site: string;
377
+ readonly tags: readonly ({
378
+ readonly type: "CATEGORY";
379
+ readonly value: string;
380
+ } | {
381
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
382
+ readonly id: string;
383
+ } | {
384
+ readonly type: "ENTITY";
385
+ readonly value: string;
386
+ readonly entityType: "PERSON";
387
+ })[];
388
+ readonly authors: readonly {
389
+ readonly name: string;
390
+ }[];
391
+ readonly meta?: unknown;
392
+ };
393
+ readonly status: "NEW" | "UPDATED";
394
+ readonly source: "EXTERNAL";
395
+ };
396
+ }) => string;
397
+ toBuffer: (event: {
398
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
399
+ readonly payload: {
400
+ readonly article: {
401
+ readonly id: string;
402
+ readonly title: string;
403
+ readonly teaser: string;
404
+ readonly content: string;
405
+ readonly publishedAt: Date;
406
+ readonly updatedAt: Date;
407
+ readonly retrievedAt: Date;
408
+ readonly url: string;
409
+ readonly site: string;
410
+ readonly tags: readonly ({
411
+ readonly type: "CATEGORY";
412
+ readonly value: string;
413
+ } | {
414
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
415
+ readonly id: string;
416
+ } | {
417
+ readonly type: "ENTITY";
418
+ readonly value: string;
419
+ readonly entityType: "PERSON";
420
+ })[];
421
+ readonly authors: readonly {
422
+ readonly name: string;
423
+ }[];
424
+ readonly meta?: unknown;
425
+ };
426
+ readonly status: "NEW" | "UPDATED";
427
+ readonly source: "EXTERNAL";
428
+ };
429
+ }) => Buffer;
430
+ toStringExn: (event: {
431
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
432
+ readonly payload: {
433
+ readonly article: {
434
+ readonly id: string;
435
+ readonly title: string;
436
+ readonly teaser: string;
437
+ readonly content: string;
438
+ readonly publishedAt: Date;
439
+ readonly updatedAt: Date;
440
+ readonly retrievedAt: Date;
441
+ readonly url: string;
442
+ readonly site: string;
443
+ readonly tags: readonly ({
444
+ readonly type: "CATEGORY";
445
+ readonly value: string;
446
+ } | {
447
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
448
+ readonly id: string;
449
+ } | {
450
+ readonly type: "ENTITY";
451
+ readonly value: string;
452
+ readonly entityType: "PERSON";
453
+ })[];
454
+ readonly authors: readonly {
455
+ readonly name: string;
456
+ }[];
457
+ readonly meta?: unknown;
458
+ };
459
+ readonly status: "NEW" | "UPDATED";
460
+ readonly source: "EXTERNAL";
461
+ };
462
+ }) => string;
463
+ toBufferExn: (event: {
464
+ readonly kind: "EXTERNAL_ARTICLE_EVENT";
465
+ readonly payload: {
466
+ readonly article: {
467
+ readonly id: string;
468
+ readonly title: string;
469
+ readonly teaser: string;
470
+ readonly content: string;
471
+ readonly publishedAt: Date;
472
+ readonly updatedAt: Date;
473
+ readonly retrievedAt: Date;
474
+ readonly url: string;
475
+ readonly site: string;
476
+ readonly tags: readonly ({
477
+ readonly type: "CATEGORY";
478
+ readonly value: string;
479
+ } | {
480
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
481
+ readonly id: string;
482
+ } | {
483
+ readonly type: "ENTITY";
484
+ readonly value: string;
485
+ readonly entityType: "PERSON";
486
+ })[];
487
+ readonly authors: readonly {
488
+ readonly name: string;
489
+ }[];
490
+ readonly meta?: unknown;
491
+ };
492
+ readonly status: "NEW" | "UPDATED";
493
+ readonly source: "EXTERNAL";
494
+ };
495
+ }) => Buffer;
496
+ Schema: Schema.Struct<{
497
+ kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
498
+ payload: Schema.Struct<{
499
+ article: Schema.Struct<{
500
+ id: typeof Schema.UUID;
501
+ title: typeof Schema.NonEmpty;
502
+ teaser: typeof Schema.NonEmpty;
503
+ content: typeof Schema.NonEmpty;
504
+ publishedAt: typeof Schema.Date;
505
+ updatedAt: typeof Schema.Date;
506
+ retrievedAt: typeof Schema.Date;
507
+ url: typeof Schema.NonEmpty;
508
+ 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
+ authors: Schema.Array$<Schema.Struct<{
521
+ name: typeof Schema.NonEmpty;
522
+ }>>;
523
+ meta: Schema.optional<typeof Schema.Unknown>;
524
+ }>;
525
+ status: Schema.Literal<["NEW", "UPDATED"]>;
526
+ source: Schema.Literal<["EXTERNAL"]>;
527
+ }>;
528
+ }>;
529
+ };
530
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExternalArticleEventSchema = void 0;
4
+ const schema_1 = require("@effect/schema");
5
+ const Article_1 = require("../types/Article");
6
+ exports.ExternalArticleEventSchema = schema_1.Schema.Struct({
7
+ kind: schema_1.Schema.Literal('EXTERNAL_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('EXTERNAL')
12
+ })
13
+ });
14
+ const makeHelpers_1 = require("../utils/makeHelpers");
15
+ const helpers = (0, makeHelpers_1.makeHelpers)(exports.ExternalArticleEventSchema);
16
+ exports.default = Object.assign({ Schema: exports.ExternalArticleEventSchema }, helpers);