@productminds/article-events 2.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/article-events/src/article-events.d.ts +3 -0
- package/lib/article-events/src/article-events.js +10 -0
- package/lib/article-events/src/cmd/write-json-schema.d.ts +1 -0
- package/lib/article-events/src/cmd/write-json-schema.js +14 -0
- package/lib/article-events/src/events/ExternalArticleEvent.d.ts +418 -0
- package/lib/article-events/src/events/ExternalArticleEvent.js +19 -0
- package/lib/article-events/src/events/InternalArticleEvent.d.ts +546 -0
- package/lib/article-events/src/events/InternalArticleEvent.js +19 -0
- package/lib/article-events/src/types/Article.d.ts +47 -0
- package/lib/article-events/src/types/Article.js +41 -0
- package/lib/article-events/src/utils/makeHelpers.d.ts +15 -0
- package/lib/article-events/src/utils/makeHelpers.js +45 -0
- package/lib/events/InternalArticleEvent.d.ts +34 -18
- package/lib/events/InternalArticleEvent.js +1 -1
- package/lib/shared/schema.d.ts +2 -0
- package/lib/shared/schema.js +5 -0
- package/lib/types/Article.d.ts +15 -0
- package/lib/types/Article.js +5 -1
- package/package.json +1 -1
@@ -0,0 +1,546 @@
|
|
1
|
+
import { Schema } from '@effect/schema';
|
2
|
+
export declare const InternalArticleEventSchema: Schema.Struct<{
|
3
|
+
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
4
|
+
payload: Schema.Struct<{
|
5
|
+
article: Schema.extend<Schema.extend<Schema.Struct<{
|
6
|
+
title: typeof Schema.NonEmptyString;
|
7
|
+
teaser: typeof Schema.NonEmptyString;
|
8
|
+
content: typeof Schema.NonEmptyString;
|
9
|
+
publishedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
10
|
+
updatedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
11
|
+
retrievedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
12
|
+
url: typeof Schema.NonEmptyString;
|
13
|
+
site: typeof Schema.NonEmptyString;
|
14
|
+
authors: Schema.Array$<Schema.Struct<{
|
15
|
+
name: typeof Schema.NonEmptyString;
|
16
|
+
}>>;
|
17
|
+
}>, Schema.Struct<{
|
18
|
+
id: typeof Schema.NonEmptyString;
|
19
|
+
}>>, Schema.Struct<{
|
20
|
+
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
21
|
+
type: Schema.Literal<["CATEGORY"]>;
|
22
|
+
value: typeof Schema.NonEmptyString;
|
23
|
+
}>, Schema.Struct<{
|
24
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
25
|
+
id: typeof Schema.UUID;
|
26
|
+
}>, Schema.Struct<{
|
27
|
+
type: Schema.Literal<["DRUPAL_EXTERNAL_ID"]>;
|
28
|
+
extID: typeof Schema.UUID;
|
29
|
+
extSource: typeof Schema.String;
|
30
|
+
}>]>>;
|
31
|
+
}>>;
|
32
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
33
|
+
source: Schema.Literal<["INTERNAL"]>;
|
34
|
+
}>;
|
35
|
+
}>;
|
36
|
+
declare const _default: {
|
37
|
+
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
|
+
};
|
70
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
71
|
+
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
|
+
};
|
104
|
+
};
|
105
|
+
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
|
+
};
|
138
|
+
}, 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
|
+
};
|
171
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
172
|
+
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
|
+
};
|
205
|
+
}) => {
|
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
|
+
};
|
238
|
+
};
|
239
|
+
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
|
+
};
|
272
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
273
|
+
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
|
+
};
|
306
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
307
|
+
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
|
+
};
|
340
|
+
};
|
341
|
+
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
|
+
};
|
374
|
+
};
|
375
|
+
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
|
+
};
|
408
|
+
}) => string;
|
409
|
+
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
|
+
};
|
442
|
+
}) => Buffer;
|
443
|
+
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
|
+
};
|
476
|
+
}) => string;
|
477
|
+
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
|
+
};
|
510
|
+
}) => Buffer;
|
511
|
+
Schema: Schema.Struct<{
|
512
|
+
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
513
|
+
payload: Schema.Struct<{
|
514
|
+
article: Schema.extend<Schema.extend<Schema.Struct<{
|
515
|
+
title: typeof Schema.NonEmptyString;
|
516
|
+
teaser: typeof Schema.NonEmptyString;
|
517
|
+
content: typeof Schema.NonEmptyString;
|
518
|
+
publishedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
519
|
+
updatedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
520
|
+
retrievedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
521
|
+
url: typeof Schema.NonEmptyString;
|
522
|
+
site: typeof Schema.NonEmptyString;
|
523
|
+
authors: Schema.Array$<Schema.Struct<{
|
524
|
+
name: typeof Schema.NonEmptyString;
|
525
|
+
}>>;
|
526
|
+
}>, Schema.Struct<{
|
527
|
+
id: typeof Schema.NonEmptyString;
|
528
|
+
}>>, Schema.Struct<{
|
529
|
+
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
530
|
+
type: Schema.Literal<["CATEGORY"]>;
|
531
|
+
value: typeof Schema.NonEmptyString;
|
532
|
+
}>, Schema.Struct<{
|
533
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
534
|
+
id: typeof Schema.UUID;
|
535
|
+
}>, Schema.Struct<{
|
536
|
+
type: Schema.Literal<["DRUPAL_EXTERNAL_ID"]>;
|
537
|
+
extID: typeof Schema.UUID;
|
538
|
+
extSource: typeof Schema.String;
|
539
|
+
}>]>>;
|
540
|
+
}>>;
|
541
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
542
|
+
source: Schema.Literal<["INTERNAL"]>;
|
543
|
+
}>;
|
544
|
+
}>;
|
545
|
+
};
|
546
|
+
export default _default;
|
@@ -0,0 +1,19 @@
|
|
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 InternalArticleSchema = schema_1.Schema.extend(Article_1.BaseInternalArticleSchema, schema_1.Schema.Struct({
|
8
|
+
tags: schema_1.Schema.Array(schema_1.Schema.Union(Article_1.CategoryTagSchema, Article_1.ExternalArticleReferenceTagSchema, Article_1.DrupalExternalIDTag)),
|
9
|
+
}));
|
10
|
+
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
11
|
+
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
12
|
+
payload: schema_1.Schema.Struct({
|
13
|
+
article: InternalArticleSchema,
|
14
|
+
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
15
|
+
source: schema_1.Schema.Literal('INTERNAL'),
|
16
|
+
}),
|
17
|
+
});
|
18
|
+
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
19
|
+
exports.default = Object.assign({ Schema: exports.InternalArticleEventSchema }, helpers);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { Schema } from '@effect/schema';
|
2
|
+
export declare const DateTimeSchema: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
3
|
+
export declare const CategoryTagSchema: Schema.Struct<{
|
4
|
+
type: Schema.Literal<["CATEGORY"]>;
|
5
|
+
value: typeof Schema.NonEmptyString;
|
6
|
+
}>;
|
7
|
+
export declare const ExternalArticleReferenceTagSchema: Schema.Struct<{
|
8
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
9
|
+
id: typeof Schema.UUID;
|
10
|
+
}>;
|
11
|
+
export declare const DrupalExternalIDTag: Schema.Struct<{
|
12
|
+
type: Schema.Literal<["DRUPAL_EXTERNAL_ID"]>;
|
13
|
+
extID: typeof Schema.UUID;
|
14
|
+
extSource: typeof Schema.String;
|
15
|
+
}>;
|
16
|
+
export declare const AuthorSchema: Schema.Struct<{
|
17
|
+
name: typeof Schema.NonEmptyString;
|
18
|
+
}>;
|
19
|
+
export declare const BaseArticleSchema: Schema.Struct<{
|
20
|
+
id: typeof Schema.UUID;
|
21
|
+
title: typeof Schema.NonEmptyString;
|
22
|
+
teaser: typeof Schema.NonEmptyString;
|
23
|
+
content: typeof Schema.NonEmptyString;
|
24
|
+
publishedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
25
|
+
updatedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
26
|
+
retrievedAt: Schema.transformOrFail<typeof Schema.String, typeof Schema.DateTimeUtcFromSelf, never>;
|
27
|
+
url: typeof Schema.NonEmptyString;
|
28
|
+
site: typeof Schema.NonEmptyString;
|
29
|
+
authors: Schema.Array$<Schema.Struct<{
|
30
|
+
name: typeof Schema.NonEmptyString;
|
31
|
+
}>>;
|
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
|
+
}>>;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BaseInternalArticleSchema = exports.BaseArticleSchema = exports.AuthorSchema = exports.DrupalExternalIDTag = exports.ExternalArticleReferenceTagSchema = exports.CategoryTagSchema = exports.DateTimeSchema = void 0;
|
4
|
+
const schema_1 = require("@effect/schema");
|
5
|
+
const schema_2 = require("../../../shared/schema");
|
6
|
+
exports.DateTimeSchema = schema_1.Schema.DateTimeUtc.annotations({
|
7
|
+
jsonSchema: { type: 'string', format: 'date-time' },
|
8
|
+
});
|
9
|
+
exports.CategoryTagSchema = schema_1.Schema.Struct({
|
10
|
+
type: schema_1.Schema.Literal('CATEGORY'),
|
11
|
+
value: schema_1.Schema.NonEmptyString,
|
12
|
+
});
|
13
|
+
exports.ExternalArticleReferenceTagSchema = schema_1.Schema.Struct({
|
14
|
+
type: schema_1.Schema.Literal('EXTERNAL_ARTICLE_REFERENCE'),
|
15
|
+
id: schema_1.Schema.UUID,
|
16
|
+
});
|
17
|
+
exports.DrupalExternalIDTag = schema_1.Schema.Struct({
|
18
|
+
type: schema_1.Schema.Literal('DRUPAL_EXTERNAL_ID'),
|
19
|
+
extID: schema_1.Schema.UUID,
|
20
|
+
extSource: schema_1.Schema.String,
|
21
|
+
}).annotations({
|
22
|
+
description: 'A special case tag for tracking where a Drupal article was created from',
|
23
|
+
});
|
24
|
+
exports.AuthorSchema = schema_1.Schema.Struct({
|
25
|
+
name: schema_1.Schema.NonEmptyString,
|
26
|
+
});
|
27
|
+
exports.BaseArticleSchema = schema_1.Schema.Struct({
|
28
|
+
id: schema_1.Schema.UUID,
|
29
|
+
title: schema_1.Schema.NonEmptyString,
|
30
|
+
teaser: schema_1.Schema.NonEmptyString,
|
31
|
+
content: schema_1.Schema.NonEmptyString,
|
32
|
+
publishedAt: exports.DateTimeSchema,
|
33
|
+
updatedAt: exports.DateTimeSchema,
|
34
|
+
retrievedAt: exports.DateTimeSchema,
|
35
|
+
url: schema_1.Schema.NonEmptyString,
|
36
|
+
site: schema_1.Schema.NonEmptyString,
|
37
|
+
authors: schema_1.Schema.Array(exports.AuthorSchema),
|
38
|
+
});
|
39
|
+
exports.BaseInternalArticleSchema = schema_1.Schema.extend(exports.BaseArticleSchema.omit('id'), schema_1.Schema.Struct({
|
40
|
+
id: schema_2.InternalArticleIDSchema,
|
41
|
+
}));
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Schema } from '@effect/schema';
|
2
|
+
export declare const makeHelpers: <A, I>(schema: Schema.Schema<A, I, never>) => {
|
3
|
+
decode: (u: unknown, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<A, import("@effect/schema/ParseResult").ParseError>;
|
4
|
+
decodeExn: (u: unknown) => A;
|
5
|
+
encode: (a: A, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<I, import("@effect/schema/ParseResult").ParseError>;
|
6
|
+
encodeExn: (event: typeof schema.Type) => I;
|
7
|
+
fromString: (msg: string) => import("effect/Either").Either<A, import("@effect/schema/ParseResult").ParseError>;
|
8
|
+
fromBuffer: (msg: Buffer) => import("effect/Either").Either<A, import("@effect/schema/ParseResult").ParseError>;
|
9
|
+
fromStringExn: (msg: string) => A;
|
10
|
+
fromBufferExn: (msg: Buffer) => A;
|
11
|
+
toString: (event: typeof schema.Type) => string;
|
12
|
+
toBuffer: (event: typeof schema.Type) => Buffer;
|
13
|
+
toStringExn: (event: typeof schema.Type) => string;
|
14
|
+
toBufferExn: (event: typeof schema.Type) => Buffer;
|
15
|
+
};
|