@productminds/article-events 4.0.0 → 4.1.0

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