@productminds/article-events 0.0.9 → 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/lib/events/ArticleEvent.d.ts +482 -0
- package/lib/events/ArticleEvent.js +15 -0
- package/lib/events/ExternalArticleEvent.d.ts +402 -0
- package/lib/events/ExternalArticleEvent.js +18 -0
- package/lib/events/InternalArticleEvent.d.ts +450 -0
- package/lib/events/InternalArticleEvent.js +18 -0
- package/lib/types/Article.d.ts +59 -0
- package/lib/types/Article.js +43 -0
- package/lib/utils/makeHelpers.d.ts +15 -0
- package/lib/utils/makeHelpers.js +45 -0
- package/package.json +12 -31
- package/index.ts +0 -3
- 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
@@ -0,0 +1,402 @@
|
|
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
|
+
tags: Schema.Array$<Schema.Struct<{
|
7
|
+
type: Schema.Literal<["CATEGORY"]>;
|
8
|
+
value: typeof Schema.NonEmpty;
|
9
|
+
}>>;
|
10
|
+
id: typeof Schema.UUID;
|
11
|
+
title: typeof Schema.NonEmpty;
|
12
|
+
teaser: typeof Schema.NonEmpty;
|
13
|
+
content: typeof Schema.NonEmpty;
|
14
|
+
publishedAt: typeof Schema.Date;
|
15
|
+
updatedAt: typeof Schema.Date;
|
16
|
+
retrievedAt: typeof Schema.Date;
|
17
|
+
url: typeof Schema.NonEmpty;
|
18
|
+
site: typeof Schema.NonEmpty;
|
19
|
+
authors: Schema.Array$<Schema.Struct<{
|
20
|
+
name: typeof Schema.NonEmpty;
|
21
|
+
}>>;
|
22
|
+
}>;
|
23
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
24
|
+
source: Schema.Literal<["EXTERNAL"]>;
|
25
|
+
}>;
|
26
|
+
}>;
|
27
|
+
declare const _default: {
|
28
|
+
decode: (u: unknown, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
29
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
30
|
+
readonly payload: {
|
31
|
+
readonly article: {
|
32
|
+
readonly id: string;
|
33
|
+
readonly site: string;
|
34
|
+
readonly title: string;
|
35
|
+
readonly teaser: string;
|
36
|
+
readonly content: string;
|
37
|
+
readonly publishedAt: Date;
|
38
|
+
readonly updatedAt: Date;
|
39
|
+
readonly retrievedAt: Date;
|
40
|
+
readonly url: string;
|
41
|
+
readonly tags: readonly {
|
42
|
+
readonly type: "CATEGORY";
|
43
|
+
readonly value: string;
|
44
|
+
}[];
|
45
|
+
readonly authors: readonly {
|
46
|
+
readonly name: string;
|
47
|
+
}[];
|
48
|
+
};
|
49
|
+
readonly status: "NEW" | "UPDATED";
|
50
|
+
readonly source: "EXTERNAL";
|
51
|
+
};
|
52
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
53
|
+
decodeExn: (u: unknown) => {
|
54
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
55
|
+
readonly payload: {
|
56
|
+
readonly article: {
|
57
|
+
readonly id: string;
|
58
|
+
readonly site: string;
|
59
|
+
readonly title: string;
|
60
|
+
readonly teaser: string;
|
61
|
+
readonly content: string;
|
62
|
+
readonly publishedAt: Date;
|
63
|
+
readonly updatedAt: Date;
|
64
|
+
readonly retrievedAt: Date;
|
65
|
+
readonly url: string;
|
66
|
+
readonly tags: readonly {
|
67
|
+
readonly type: "CATEGORY";
|
68
|
+
readonly value: string;
|
69
|
+
}[];
|
70
|
+
readonly authors: readonly {
|
71
|
+
readonly name: string;
|
72
|
+
}[];
|
73
|
+
};
|
74
|
+
readonly status: "NEW" | "UPDATED";
|
75
|
+
readonly source: "EXTERNAL";
|
76
|
+
};
|
77
|
+
};
|
78
|
+
encode: (a: {
|
79
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
80
|
+
readonly payload: {
|
81
|
+
readonly article: {
|
82
|
+
readonly id: string;
|
83
|
+
readonly site: string;
|
84
|
+
readonly title: string;
|
85
|
+
readonly teaser: string;
|
86
|
+
readonly content: string;
|
87
|
+
readonly publishedAt: Date;
|
88
|
+
readonly updatedAt: Date;
|
89
|
+
readonly retrievedAt: Date;
|
90
|
+
readonly url: string;
|
91
|
+
readonly tags: readonly {
|
92
|
+
readonly type: "CATEGORY";
|
93
|
+
readonly value: string;
|
94
|
+
}[];
|
95
|
+
readonly authors: readonly {
|
96
|
+
readonly name: string;
|
97
|
+
}[];
|
98
|
+
};
|
99
|
+
readonly status: "NEW" | "UPDATED";
|
100
|
+
readonly source: "EXTERNAL";
|
101
|
+
};
|
102
|
+
}, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
103
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
104
|
+
readonly payload: {
|
105
|
+
readonly article: {
|
106
|
+
readonly id: string;
|
107
|
+
readonly site: string;
|
108
|
+
readonly title: string;
|
109
|
+
readonly teaser: string;
|
110
|
+
readonly content: string;
|
111
|
+
readonly publishedAt: string;
|
112
|
+
readonly updatedAt: string;
|
113
|
+
readonly retrievedAt: string;
|
114
|
+
readonly url: string;
|
115
|
+
readonly tags: readonly {
|
116
|
+
readonly type: "CATEGORY";
|
117
|
+
readonly value: string;
|
118
|
+
}[];
|
119
|
+
readonly authors: readonly {
|
120
|
+
readonly name: string;
|
121
|
+
}[];
|
122
|
+
};
|
123
|
+
readonly status: "NEW" | "UPDATED";
|
124
|
+
readonly source: "EXTERNAL";
|
125
|
+
};
|
126
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
127
|
+
encodeExn: (event: {
|
128
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
129
|
+
readonly payload: {
|
130
|
+
readonly article: {
|
131
|
+
readonly id: string;
|
132
|
+
readonly site: string;
|
133
|
+
readonly title: string;
|
134
|
+
readonly teaser: string;
|
135
|
+
readonly content: string;
|
136
|
+
readonly publishedAt: Date;
|
137
|
+
readonly updatedAt: Date;
|
138
|
+
readonly retrievedAt: Date;
|
139
|
+
readonly url: string;
|
140
|
+
readonly tags: readonly {
|
141
|
+
readonly type: "CATEGORY";
|
142
|
+
readonly value: string;
|
143
|
+
}[];
|
144
|
+
readonly authors: readonly {
|
145
|
+
readonly name: string;
|
146
|
+
}[];
|
147
|
+
};
|
148
|
+
readonly status: "NEW" | "UPDATED";
|
149
|
+
readonly source: "EXTERNAL";
|
150
|
+
};
|
151
|
+
}) => {
|
152
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
153
|
+
readonly payload: {
|
154
|
+
readonly article: {
|
155
|
+
readonly id: string;
|
156
|
+
readonly site: string;
|
157
|
+
readonly title: string;
|
158
|
+
readonly teaser: string;
|
159
|
+
readonly content: string;
|
160
|
+
readonly publishedAt: string;
|
161
|
+
readonly updatedAt: string;
|
162
|
+
readonly retrievedAt: string;
|
163
|
+
readonly url: string;
|
164
|
+
readonly tags: readonly {
|
165
|
+
readonly type: "CATEGORY";
|
166
|
+
readonly value: string;
|
167
|
+
}[];
|
168
|
+
readonly authors: readonly {
|
169
|
+
readonly name: string;
|
170
|
+
}[];
|
171
|
+
};
|
172
|
+
readonly status: "NEW" | "UPDATED";
|
173
|
+
readonly source: "EXTERNAL";
|
174
|
+
};
|
175
|
+
};
|
176
|
+
fromString: (msg: string) => import("effect/Either").Either<{
|
177
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
178
|
+
readonly payload: {
|
179
|
+
readonly article: {
|
180
|
+
readonly id: string;
|
181
|
+
readonly site: string;
|
182
|
+
readonly title: string;
|
183
|
+
readonly teaser: string;
|
184
|
+
readonly content: string;
|
185
|
+
readonly publishedAt: Date;
|
186
|
+
readonly updatedAt: Date;
|
187
|
+
readonly retrievedAt: Date;
|
188
|
+
readonly url: string;
|
189
|
+
readonly tags: readonly {
|
190
|
+
readonly type: "CATEGORY";
|
191
|
+
readonly value: string;
|
192
|
+
}[];
|
193
|
+
readonly authors: readonly {
|
194
|
+
readonly name: string;
|
195
|
+
}[];
|
196
|
+
};
|
197
|
+
readonly status: "NEW" | "UPDATED";
|
198
|
+
readonly source: "EXTERNAL";
|
199
|
+
};
|
200
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
201
|
+
fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
|
202
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
203
|
+
readonly payload: {
|
204
|
+
readonly article: {
|
205
|
+
readonly id: string;
|
206
|
+
readonly site: string;
|
207
|
+
readonly title: string;
|
208
|
+
readonly teaser: string;
|
209
|
+
readonly content: string;
|
210
|
+
readonly publishedAt: Date;
|
211
|
+
readonly updatedAt: Date;
|
212
|
+
readonly retrievedAt: Date;
|
213
|
+
readonly url: string;
|
214
|
+
readonly tags: readonly {
|
215
|
+
readonly type: "CATEGORY";
|
216
|
+
readonly value: string;
|
217
|
+
}[];
|
218
|
+
readonly authors: readonly {
|
219
|
+
readonly name: string;
|
220
|
+
}[];
|
221
|
+
};
|
222
|
+
readonly status: "NEW" | "UPDATED";
|
223
|
+
readonly source: "EXTERNAL";
|
224
|
+
};
|
225
|
+
}, import("@effect/schema/ParseResult").ParseError>;
|
226
|
+
fromStringExn: (msg: string) => {
|
227
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
228
|
+
readonly payload: {
|
229
|
+
readonly article: {
|
230
|
+
readonly id: string;
|
231
|
+
readonly site: string;
|
232
|
+
readonly title: string;
|
233
|
+
readonly teaser: string;
|
234
|
+
readonly content: string;
|
235
|
+
readonly publishedAt: Date;
|
236
|
+
readonly updatedAt: Date;
|
237
|
+
readonly retrievedAt: Date;
|
238
|
+
readonly url: string;
|
239
|
+
readonly tags: readonly {
|
240
|
+
readonly type: "CATEGORY";
|
241
|
+
readonly value: string;
|
242
|
+
}[];
|
243
|
+
readonly authors: readonly {
|
244
|
+
readonly name: string;
|
245
|
+
}[];
|
246
|
+
};
|
247
|
+
readonly status: "NEW" | "UPDATED";
|
248
|
+
readonly source: "EXTERNAL";
|
249
|
+
};
|
250
|
+
};
|
251
|
+
fromBufferExn: (msg: Buffer) => {
|
252
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
253
|
+
readonly payload: {
|
254
|
+
readonly article: {
|
255
|
+
readonly id: string;
|
256
|
+
readonly site: string;
|
257
|
+
readonly title: string;
|
258
|
+
readonly teaser: string;
|
259
|
+
readonly content: string;
|
260
|
+
readonly publishedAt: Date;
|
261
|
+
readonly updatedAt: Date;
|
262
|
+
readonly retrievedAt: Date;
|
263
|
+
readonly url: string;
|
264
|
+
readonly tags: readonly {
|
265
|
+
readonly type: "CATEGORY";
|
266
|
+
readonly value: string;
|
267
|
+
}[];
|
268
|
+
readonly authors: readonly {
|
269
|
+
readonly name: string;
|
270
|
+
}[];
|
271
|
+
};
|
272
|
+
readonly status: "NEW" | "UPDATED";
|
273
|
+
readonly source: "EXTERNAL";
|
274
|
+
};
|
275
|
+
};
|
276
|
+
toString: (event: {
|
277
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
278
|
+
readonly payload: {
|
279
|
+
readonly article: {
|
280
|
+
readonly id: string;
|
281
|
+
readonly site: string;
|
282
|
+
readonly title: string;
|
283
|
+
readonly teaser: string;
|
284
|
+
readonly content: string;
|
285
|
+
readonly publishedAt: Date;
|
286
|
+
readonly updatedAt: Date;
|
287
|
+
readonly retrievedAt: Date;
|
288
|
+
readonly url: string;
|
289
|
+
readonly tags: readonly {
|
290
|
+
readonly type: "CATEGORY";
|
291
|
+
readonly value: string;
|
292
|
+
}[];
|
293
|
+
readonly authors: readonly {
|
294
|
+
readonly name: string;
|
295
|
+
}[];
|
296
|
+
};
|
297
|
+
readonly status: "NEW" | "UPDATED";
|
298
|
+
readonly source: "EXTERNAL";
|
299
|
+
};
|
300
|
+
}) => string;
|
301
|
+
toBuffer: (event: {
|
302
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
303
|
+
readonly payload: {
|
304
|
+
readonly article: {
|
305
|
+
readonly id: string;
|
306
|
+
readonly site: string;
|
307
|
+
readonly title: string;
|
308
|
+
readonly teaser: string;
|
309
|
+
readonly content: string;
|
310
|
+
readonly publishedAt: Date;
|
311
|
+
readonly updatedAt: Date;
|
312
|
+
readonly retrievedAt: Date;
|
313
|
+
readonly url: string;
|
314
|
+
readonly tags: readonly {
|
315
|
+
readonly type: "CATEGORY";
|
316
|
+
readonly value: string;
|
317
|
+
}[];
|
318
|
+
readonly authors: readonly {
|
319
|
+
readonly name: string;
|
320
|
+
}[];
|
321
|
+
};
|
322
|
+
readonly status: "NEW" | "UPDATED";
|
323
|
+
readonly source: "EXTERNAL";
|
324
|
+
};
|
325
|
+
}) => Buffer;
|
326
|
+
toStringExn: (event: {
|
327
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
328
|
+
readonly payload: {
|
329
|
+
readonly article: {
|
330
|
+
readonly id: string;
|
331
|
+
readonly site: string;
|
332
|
+
readonly title: string;
|
333
|
+
readonly teaser: string;
|
334
|
+
readonly content: string;
|
335
|
+
readonly publishedAt: Date;
|
336
|
+
readonly updatedAt: Date;
|
337
|
+
readonly retrievedAt: Date;
|
338
|
+
readonly url: string;
|
339
|
+
readonly tags: readonly {
|
340
|
+
readonly type: "CATEGORY";
|
341
|
+
readonly value: string;
|
342
|
+
}[];
|
343
|
+
readonly authors: readonly {
|
344
|
+
readonly name: string;
|
345
|
+
}[];
|
346
|
+
};
|
347
|
+
readonly status: "NEW" | "UPDATED";
|
348
|
+
readonly source: "EXTERNAL";
|
349
|
+
};
|
350
|
+
}) => string;
|
351
|
+
toBufferExn: (event: {
|
352
|
+
readonly kind: "EXTERNAL_ARTICLE_EVENT";
|
353
|
+
readonly payload: {
|
354
|
+
readonly article: {
|
355
|
+
readonly id: string;
|
356
|
+
readonly site: string;
|
357
|
+
readonly title: string;
|
358
|
+
readonly teaser: string;
|
359
|
+
readonly content: string;
|
360
|
+
readonly publishedAt: Date;
|
361
|
+
readonly updatedAt: Date;
|
362
|
+
readonly retrievedAt: Date;
|
363
|
+
readonly url: string;
|
364
|
+
readonly tags: readonly {
|
365
|
+
readonly type: "CATEGORY";
|
366
|
+
readonly value: string;
|
367
|
+
}[];
|
368
|
+
readonly authors: readonly {
|
369
|
+
readonly name: string;
|
370
|
+
}[];
|
371
|
+
};
|
372
|
+
readonly status: "NEW" | "UPDATED";
|
373
|
+
readonly source: "EXTERNAL";
|
374
|
+
};
|
375
|
+
}) => Buffer;
|
376
|
+
Schema: Schema.Struct<{
|
377
|
+
kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
|
378
|
+
payload: Schema.Struct<{
|
379
|
+
article: Schema.Struct<{
|
380
|
+
tags: Schema.Array$<Schema.Struct<{
|
381
|
+
type: Schema.Literal<["CATEGORY"]>;
|
382
|
+
value: typeof Schema.NonEmpty;
|
383
|
+
}>>;
|
384
|
+
id: typeof Schema.UUID;
|
385
|
+
title: typeof Schema.NonEmpty;
|
386
|
+
teaser: typeof Schema.NonEmpty;
|
387
|
+
content: typeof Schema.NonEmpty;
|
388
|
+
publishedAt: typeof Schema.Date;
|
389
|
+
updatedAt: typeof Schema.Date;
|
390
|
+
retrievedAt: typeof Schema.Date;
|
391
|
+
url: typeof Schema.NonEmpty;
|
392
|
+
site: typeof Schema.NonEmpty;
|
393
|
+
authors: Schema.Array$<Schema.Struct<{
|
394
|
+
name: typeof Schema.NonEmpty;
|
395
|
+
}>>;
|
396
|
+
}>;
|
397
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
398
|
+
source: Schema.Literal<["EXTERNAL"]>;
|
399
|
+
}>;
|
400
|
+
}>;
|
401
|
+
};
|
402
|
+
export default _default;
|
@@ -0,0 +1,18 @@
|
|
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
|
+
const makeHelpers_1 = require("../utils/makeHelpers");
|
7
|
+
const TagSchema = schema_1.Schema.Union(Article_1.CategoryTagSchema);
|
8
|
+
const ArticleSchema = schema_1.Schema.Struct(Object.assign(Object.assign({}, Article_1.ArticleSchema.fields), { tags: schema_1.Schema.Array(TagSchema) }));
|
9
|
+
exports.ExternalArticleEventSchema = schema_1.Schema.Struct({
|
10
|
+
kind: schema_1.Schema.Literal('EXTERNAL_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('EXTERNAL'),
|
15
|
+
}),
|
16
|
+
});
|
17
|
+
const helpers = (0, makeHelpers_1.makeHelpers)(exports.ExternalArticleEventSchema);
|
18
|
+
exports.default = Object.assign({ Schema: exports.ExternalArticleEventSchema }, helpers);
|