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