@productminds/article-events 0.0.10 → 1.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/README.md +11 -0
- package/lib/article-events.d.ts +3 -0
- package/lib/article-events.js +10 -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 +70 -0
- package/{dist/src → lib}/events/ArticleEvent.js +3 -3
- package/{dist/src → lib}/events/ExternalArticleEvent.d.ts +84 -196
- package/{dist/src → lib}/events/ExternalArticleEvent.js +7 -4
- package/{dist/src → lib}/events/InternalArticleEvent.d.ts +69 -133
- package/{dist/src → lib}/events/InternalArticleEvent.js +11 -8
- package/lib/types/Article.d.ts +27 -0
- package/lib/types/Article.js +30 -0
- package/{dist/src → lib}/utils/makeHelpers.js +1 -1
- package/package.json +13 -16
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -29
- package/dist/src/events/ArticleEvent.d.ts +0 -497
- package/dist/src/types/Article.d.ts +0 -55
- package/dist/src/types/Article.js +0 -38
- package/index.ts +0 -5
- 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
- /package/{dist/src → lib}/utils/makeHelpers.d.ts +0 -0
package/README.md
ADDED
@@ -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,70 @@
|
|
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;
|
@@ -2,14 +2,14 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schema_1 = require("@effect/schema");
|
4
4
|
const Article_1 = require("../types/Article");
|
5
|
+
const makeHelpers_1 = require("../utils/makeHelpers");
|
5
6
|
const ArticleEventSchema = schema_1.Schema.Struct({
|
6
7
|
kind: schema_1.Schema.Literal('ARTICLE_EVENT'),
|
7
8
|
payload: schema_1.Schema.Struct({
|
8
9
|
article: Article_1.ArticleSchema,
|
9
10
|
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
10
|
-
source: schema_1.Schema.Literal('INTERNAL', 'EXTERNAL')
|
11
|
-
})
|
11
|
+
source: schema_1.Schema.Literal('INTERNAL', 'EXTERNAL'),
|
12
|
+
}),
|
12
13
|
});
|
13
|
-
const makeHelpers_1 = require("../utils/makeHelpers");
|
14
14
|
const helpers = (0, makeHelpers_1.makeHelpers)(ArticleEventSchema);
|
15
15
|
exports.default = Object.assign({ Schema: ArticleEventSchema }, helpers);
|
@@ -2,7 +2,7 @@ import { Schema } from '@effect/schema';
|
|
2
2
|
export declare const ExternalArticleEventSchema: Schema.Struct<{
|
3
3
|
kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
|
4
4
|
payload: Schema.Struct<{
|
5
|
-
article: Schema.Struct<{
|
5
|
+
article: Schema.extend<Schema.Struct<{
|
6
6
|
id: typeof Schema.UUID;
|
7
7
|
title: typeof Schema.NonEmpty;
|
8
8
|
teaser: typeof Schema.NonEmpty;
|
@@ -12,22 +12,15 @@ export declare const ExternalArticleEventSchema: Schema.Struct<{
|
|
12
12
|
retrievedAt: typeof Schema.Date;
|
13
13
|
url: typeof Schema.NonEmpty;
|
14
14
|
site: typeof Schema.NonEmpty;
|
15
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
16
|
-
type: Schema.Literal<["CATEGORY"]>;
|
17
|
-
value: typeof Schema.NonEmpty;
|
18
|
-
}>, Schema.Struct<{
|
19
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
20
|
-
id: typeof Schema.UUID;
|
21
|
-
}>, Schema.Struct<{
|
22
|
-
type: Schema.Literal<["ENTITY"]>;
|
23
|
-
entityType: Schema.Literal<["PERSON"]>;
|
24
|
-
value: typeof Schema.NonEmpty;
|
25
|
-
}>]>>;
|
26
15
|
authors: Schema.Array$<Schema.Struct<{
|
27
16
|
name: typeof Schema.NonEmpty;
|
28
17
|
}>>;
|
29
|
-
|
30
|
-
|
18
|
+
}>, Schema.Struct<{
|
19
|
+
tags: Schema.Array$<Schema.Struct<{
|
20
|
+
type: Schema.Literal<["CATEGORY"]>;
|
21
|
+
value: typeof Schema.NonEmpty;
|
22
|
+
}>>;
|
23
|
+
}>>;
|
31
24
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
32
25
|
source: Schema.Literal<["EXTERNAL"]>;
|
33
26
|
}>;
|
@@ -46,21 +39,14 @@ declare const _default: {
|
|
46
39
|
readonly retrievedAt: Date;
|
47
40
|
readonly url: string;
|
48
41
|
readonly site: string;
|
49
|
-
readonly tags: readonly ({
|
50
|
-
readonly type: "CATEGORY";
|
51
|
-
readonly value: string;
|
52
|
-
} | {
|
53
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
54
|
-
readonly id: string;
|
55
|
-
} | {
|
56
|
-
readonly type: "ENTITY";
|
57
|
-
readonly value: string;
|
58
|
-
readonly entityType: "PERSON";
|
59
|
-
})[];
|
60
42
|
readonly authors: readonly {
|
61
43
|
readonly name: string;
|
62
44
|
}[];
|
63
|
-
|
45
|
+
} & {
|
46
|
+
readonly tags: readonly {
|
47
|
+
readonly type: "CATEGORY";
|
48
|
+
readonly value: string;
|
49
|
+
}[];
|
64
50
|
};
|
65
51
|
readonly status: "NEW" | "UPDATED";
|
66
52
|
readonly source: "EXTERNAL";
|
@@ -79,21 +65,14 @@ declare const _default: {
|
|
79
65
|
readonly retrievedAt: Date;
|
80
66
|
readonly url: string;
|
81
67
|
readonly site: string;
|
82
|
-
readonly tags: readonly ({
|
83
|
-
readonly type: "CATEGORY";
|
84
|
-
readonly value: string;
|
85
|
-
} | {
|
86
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
87
|
-
readonly id: string;
|
88
|
-
} | {
|
89
|
-
readonly type: "ENTITY";
|
90
|
-
readonly value: string;
|
91
|
-
readonly entityType: "PERSON";
|
92
|
-
})[];
|
93
68
|
readonly authors: readonly {
|
94
69
|
readonly name: string;
|
95
70
|
}[];
|
96
|
-
|
71
|
+
} & {
|
72
|
+
readonly tags: readonly {
|
73
|
+
readonly type: "CATEGORY";
|
74
|
+
readonly value: string;
|
75
|
+
}[];
|
97
76
|
};
|
98
77
|
readonly status: "NEW" | "UPDATED";
|
99
78
|
readonly source: "EXTERNAL";
|
@@ -112,21 +91,14 @@ declare const _default: {
|
|
112
91
|
readonly retrievedAt: Date;
|
113
92
|
readonly url: string;
|
114
93
|
readonly site: string;
|
115
|
-
readonly tags: readonly ({
|
116
|
-
readonly type: "CATEGORY";
|
117
|
-
readonly value: string;
|
118
|
-
} | {
|
119
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
120
|
-
readonly id: string;
|
121
|
-
} | {
|
122
|
-
readonly type: "ENTITY";
|
123
|
-
readonly value: string;
|
124
|
-
readonly entityType: "PERSON";
|
125
|
-
})[];
|
126
94
|
readonly authors: readonly {
|
127
95
|
readonly name: string;
|
128
96
|
}[];
|
129
|
-
|
97
|
+
} & {
|
98
|
+
readonly tags: readonly {
|
99
|
+
readonly type: "CATEGORY";
|
100
|
+
readonly value: string;
|
101
|
+
}[];
|
130
102
|
};
|
131
103
|
readonly status: "NEW" | "UPDATED";
|
132
104
|
readonly source: "EXTERNAL";
|
@@ -144,21 +116,14 @@ declare const _default: {
|
|
144
116
|
readonly retrievedAt: string;
|
145
117
|
readonly url: string;
|
146
118
|
readonly site: string;
|
147
|
-
readonly tags: readonly ({
|
148
|
-
readonly type: "CATEGORY";
|
149
|
-
readonly value: string;
|
150
|
-
} | {
|
151
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
152
|
-
readonly id: string;
|
153
|
-
} | {
|
154
|
-
readonly type: "ENTITY";
|
155
|
-
readonly value: string;
|
156
|
-
readonly entityType: "PERSON";
|
157
|
-
})[];
|
158
119
|
readonly authors: readonly {
|
159
120
|
readonly name: string;
|
160
121
|
}[];
|
161
|
-
|
122
|
+
} & {
|
123
|
+
readonly tags: readonly {
|
124
|
+
readonly type: "CATEGORY";
|
125
|
+
readonly value: string;
|
126
|
+
}[];
|
162
127
|
};
|
163
128
|
readonly status: "NEW" | "UPDATED";
|
164
129
|
readonly source: "EXTERNAL";
|
@@ -177,21 +142,14 @@ declare const _default: {
|
|
177
142
|
readonly retrievedAt: Date;
|
178
143
|
readonly url: string;
|
179
144
|
readonly site: string;
|
180
|
-
readonly tags: readonly ({
|
181
|
-
readonly type: "CATEGORY";
|
182
|
-
readonly value: string;
|
183
|
-
} | {
|
184
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
185
|
-
readonly id: string;
|
186
|
-
} | {
|
187
|
-
readonly type: "ENTITY";
|
188
|
-
readonly value: string;
|
189
|
-
readonly entityType: "PERSON";
|
190
|
-
})[];
|
191
145
|
readonly authors: readonly {
|
192
146
|
readonly name: string;
|
193
147
|
}[];
|
194
|
-
|
148
|
+
} & {
|
149
|
+
readonly tags: readonly {
|
150
|
+
readonly type: "CATEGORY";
|
151
|
+
readonly value: string;
|
152
|
+
}[];
|
195
153
|
};
|
196
154
|
readonly status: "NEW" | "UPDATED";
|
197
155
|
readonly source: "EXTERNAL";
|
@@ -209,21 +167,14 @@ declare const _default: {
|
|
209
167
|
readonly retrievedAt: string;
|
210
168
|
readonly url: string;
|
211
169
|
readonly site: string;
|
212
|
-
readonly tags: readonly ({
|
213
|
-
readonly type: "CATEGORY";
|
214
|
-
readonly value: string;
|
215
|
-
} | {
|
216
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
217
|
-
readonly id: string;
|
218
|
-
} | {
|
219
|
-
readonly type: "ENTITY";
|
220
|
-
readonly value: string;
|
221
|
-
readonly entityType: "PERSON";
|
222
|
-
})[];
|
223
170
|
readonly authors: readonly {
|
224
171
|
readonly name: string;
|
225
172
|
}[];
|
226
|
-
|
173
|
+
} & {
|
174
|
+
readonly tags: readonly {
|
175
|
+
readonly type: "CATEGORY";
|
176
|
+
readonly value: string;
|
177
|
+
}[];
|
227
178
|
};
|
228
179
|
readonly status: "NEW" | "UPDATED";
|
229
180
|
readonly source: "EXTERNAL";
|
@@ -242,21 +193,14 @@ declare const _default: {
|
|
242
193
|
readonly retrievedAt: Date;
|
243
194
|
readonly url: string;
|
244
195
|
readonly site: string;
|
245
|
-
readonly tags: readonly ({
|
246
|
-
readonly type: "CATEGORY";
|
247
|
-
readonly value: string;
|
248
|
-
} | {
|
249
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
250
|
-
readonly id: string;
|
251
|
-
} | {
|
252
|
-
readonly type: "ENTITY";
|
253
|
-
readonly value: string;
|
254
|
-
readonly entityType: "PERSON";
|
255
|
-
})[];
|
256
196
|
readonly authors: readonly {
|
257
197
|
readonly name: string;
|
258
198
|
}[];
|
259
|
-
|
199
|
+
} & {
|
200
|
+
readonly tags: readonly {
|
201
|
+
readonly type: "CATEGORY";
|
202
|
+
readonly value: string;
|
203
|
+
}[];
|
260
204
|
};
|
261
205
|
readonly status: "NEW" | "UPDATED";
|
262
206
|
readonly source: "EXTERNAL";
|
@@ -275,21 +219,14 @@ declare const _default: {
|
|
275
219
|
readonly retrievedAt: Date;
|
276
220
|
readonly url: string;
|
277
221
|
readonly site: string;
|
278
|
-
readonly tags: readonly ({
|
279
|
-
readonly type: "CATEGORY";
|
280
|
-
readonly value: string;
|
281
|
-
} | {
|
282
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
283
|
-
readonly id: string;
|
284
|
-
} | {
|
285
|
-
readonly type: "ENTITY";
|
286
|
-
readonly value: string;
|
287
|
-
readonly entityType: "PERSON";
|
288
|
-
})[];
|
289
222
|
readonly authors: readonly {
|
290
223
|
readonly name: string;
|
291
224
|
}[];
|
292
|
-
|
225
|
+
} & {
|
226
|
+
readonly tags: readonly {
|
227
|
+
readonly type: "CATEGORY";
|
228
|
+
readonly value: string;
|
229
|
+
}[];
|
293
230
|
};
|
294
231
|
readonly status: "NEW" | "UPDATED";
|
295
232
|
readonly source: "EXTERNAL";
|
@@ -308,21 +245,14 @@ declare const _default: {
|
|
308
245
|
readonly retrievedAt: Date;
|
309
246
|
readonly url: string;
|
310
247
|
readonly site: string;
|
311
|
-
readonly tags: readonly ({
|
312
|
-
readonly type: "CATEGORY";
|
313
|
-
readonly value: string;
|
314
|
-
} | {
|
315
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
316
|
-
readonly id: string;
|
317
|
-
} | {
|
318
|
-
readonly type: "ENTITY";
|
319
|
-
readonly value: string;
|
320
|
-
readonly entityType: "PERSON";
|
321
|
-
})[];
|
322
248
|
readonly authors: readonly {
|
323
249
|
readonly name: string;
|
324
250
|
}[];
|
325
|
-
|
251
|
+
} & {
|
252
|
+
readonly tags: readonly {
|
253
|
+
readonly type: "CATEGORY";
|
254
|
+
readonly value: string;
|
255
|
+
}[];
|
326
256
|
};
|
327
257
|
readonly status: "NEW" | "UPDATED";
|
328
258
|
readonly source: "EXTERNAL";
|
@@ -341,21 +271,14 @@ declare const _default: {
|
|
341
271
|
readonly retrievedAt: Date;
|
342
272
|
readonly url: string;
|
343
273
|
readonly site: string;
|
344
|
-
readonly tags: readonly ({
|
345
|
-
readonly type: "CATEGORY";
|
346
|
-
readonly value: string;
|
347
|
-
} | {
|
348
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
349
|
-
readonly id: string;
|
350
|
-
} | {
|
351
|
-
readonly type: "ENTITY";
|
352
|
-
readonly value: string;
|
353
|
-
readonly entityType: "PERSON";
|
354
|
-
})[];
|
355
274
|
readonly authors: readonly {
|
356
275
|
readonly name: string;
|
357
276
|
}[];
|
358
|
-
|
277
|
+
} & {
|
278
|
+
readonly tags: readonly {
|
279
|
+
readonly type: "CATEGORY";
|
280
|
+
readonly value: string;
|
281
|
+
}[];
|
359
282
|
};
|
360
283
|
readonly status: "NEW" | "UPDATED";
|
361
284
|
readonly source: "EXTERNAL";
|
@@ -374,21 +297,14 @@ declare const _default: {
|
|
374
297
|
readonly retrievedAt: Date;
|
375
298
|
readonly url: string;
|
376
299
|
readonly site: string;
|
377
|
-
readonly tags: readonly ({
|
378
|
-
readonly type: "CATEGORY";
|
379
|
-
readonly value: string;
|
380
|
-
} | {
|
381
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
382
|
-
readonly id: string;
|
383
|
-
} | {
|
384
|
-
readonly type: "ENTITY";
|
385
|
-
readonly value: string;
|
386
|
-
readonly entityType: "PERSON";
|
387
|
-
})[];
|
388
300
|
readonly authors: readonly {
|
389
301
|
readonly name: string;
|
390
302
|
}[];
|
391
|
-
|
303
|
+
} & {
|
304
|
+
readonly tags: readonly {
|
305
|
+
readonly type: "CATEGORY";
|
306
|
+
readonly value: string;
|
307
|
+
}[];
|
392
308
|
};
|
393
309
|
readonly status: "NEW" | "UPDATED";
|
394
310
|
readonly source: "EXTERNAL";
|
@@ -407,21 +323,14 @@ declare const _default: {
|
|
407
323
|
readonly retrievedAt: Date;
|
408
324
|
readonly url: string;
|
409
325
|
readonly site: string;
|
410
|
-
readonly tags: readonly ({
|
411
|
-
readonly type: "CATEGORY";
|
412
|
-
readonly value: string;
|
413
|
-
} | {
|
414
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
415
|
-
readonly id: string;
|
416
|
-
} | {
|
417
|
-
readonly type: "ENTITY";
|
418
|
-
readonly value: string;
|
419
|
-
readonly entityType: "PERSON";
|
420
|
-
})[];
|
421
326
|
readonly authors: readonly {
|
422
327
|
readonly name: string;
|
423
328
|
}[];
|
424
|
-
|
329
|
+
} & {
|
330
|
+
readonly tags: readonly {
|
331
|
+
readonly type: "CATEGORY";
|
332
|
+
readonly value: string;
|
333
|
+
}[];
|
425
334
|
};
|
426
335
|
readonly status: "NEW" | "UPDATED";
|
427
336
|
readonly source: "EXTERNAL";
|
@@ -440,21 +349,14 @@ declare const _default: {
|
|
440
349
|
readonly retrievedAt: Date;
|
441
350
|
readonly url: string;
|
442
351
|
readonly site: string;
|
443
|
-
readonly tags: readonly ({
|
444
|
-
readonly type: "CATEGORY";
|
445
|
-
readonly value: string;
|
446
|
-
} | {
|
447
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
448
|
-
readonly id: string;
|
449
|
-
} | {
|
450
|
-
readonly type: "ENTITY";
|
451
|
-
readonly value: string;
|
452
|
-
readonly entityType: "PERSON";
|
453
|
-
})[];
|
454
352
|
readonly authors: readonly {
|
455
353
|
readonly name: string;
|
456
354
|
}[];
|
457
|
-
|
355
|
+
} & {
|
356
|
+
readonly tags: readonly {
|
357
|
+
readonly type: "CATEGORY";
|
358
|
+
readonly value: string;
|
359
|
+
}[];
|
458
360
|
};
|
459
361
|
readonly status: "NEW" | "UPDATED";
|
460
362
|
readonly source: "EXTERNAL";
|
@@ -473,21 +375,14 @@ declare const _default: {
|
|
473
375
|
readonly retrievedAt: Date;
|
474
376
|
readonly url: string;
|
475
377
|
readonly site: string;
|
476
|
-
readonly tags: readonly ({
|
477
|
-
readonly type: "CATEGORY";
|
478
|
-
readonly value: string;
|
479
|
-
} | {
|
480
|
-
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
481
|
-
readonly id: string;
|
482
|
-
} | {
|
483
|
-
readonly type: "ENTITY";
|
484
|
-
readonly value: string;
|
485
|
-
readonly entityType: "PERSON";
|
486
|
-
})[];
|
487
378
|
readonly authors: readonly {
|
488
379
|
readonly name: string;
|
489
380
|
}[];
|
490
|
-
|
381
|
+
} & {
|
382
|
+
readonly tags: readonly {
|
383
|
+
readonly type: "CATEGORY";
|
384
|
+
readonly value: string;
|
385
|
+
}[];
|
491
386
|
};
|
492
387
|
readonly status: "NEW" | "UPDATED";
|
493
388
|
readonly source: "EXTERNAL";
|
@@ -496,7 +391,7 @@ declare const _default: {
|
|
496
391
|
Schema: Schema.Struct<{
|
497
392
|
kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
|
498
393
|
payload: Schema.Struct<{
|
499
|
-
article: Schema.Struct<{
|
394
|
+
article: Schema.extend<Schema.Struct<{
|
500
395
|
id: typeof Schema.UUID;
|
501
396
|
title: typeof Schema.NonEmpty;
|
502
397
|
teaser: typeof Schema.NonEmpty;
|
@@ -506,22 +401,15 @@ declare const _default: {
|
|
506
401
|
retrievedAt: typeof Schema.Date;
|
507
402
|
url: typeof Schema.NonEmpty;
|
508
403
|
site: typeof Schema.NonEmpty;
|
509
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
510
|
-
type: Schema.Literal<["CATEGORY"]>;
|
511
|
-
value: typeof Schema.NonEmpty;
|
512
|
-
}>, Schema.Struct<{
|
513
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
514
|
-
id: typeof Schema.UUID;
|
515
|
-
}>, Schema.Struct<{
|
516
|
-
type: Schema.Literal<["ENTITY"]>;
|
517
|
-
entityType: Schema.Literal<["PERSON"]>;
|
518
|
-
value: typeof Schema.NonEmpty;
|
519
|
-
}>]>>;
|
520
404
|
authors: Schema.Array$<Schema.Struct<{
|
521
405
|
name: typeof Schema.NonEmpty;
|
522
406
|
}>>;
|
523
|
-
|
524
|
-
|
407
|
+
}>, Schema.Struct<{
|
408
|
+
tags: Schema.Array$<Schema.Struct<{
|
409
|
+
type: Schema.Literal<["CATEGORY"]>;
|
410
|
+
value: typeof Schema.NonEmpty;
|
411
|
+
}>>;
|
412
|
+
}>>;
|
525
413
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
526
414
|
source: Schema.Literal<["EXTERNAL"]>;
|
527
415
|
}>;
|
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExternalArticleEventSchema = void 0;
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
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
|
+
}));
|
6
10
|
exports.ExternalArticleEventSchema = schema_1.Schema.Struct({
|
7
11
|
kind: schema_1.Schema.Literal('EXTERNAL_ARTICLE_EVENT'),
|
8
12
|
payload: schema_1.Schema.Struct({
|
9
|
-
article:
|
13
|
+
article: ExternalArticleSchema,
|
10
14
|
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
11
|
-
source: schema_1.Schema.Literal('EXTERNAL')
|
12
|
-
})
|
15
|
+
source: schema_1.Schema.Literal('EXTERNAL'),
|
16
|
+
}),
|
13
17
|
});
|
14
|
-
const makeHelpers_1 = require("../utils/makeHelpers");
|
15
18
|
const helpers = (0, makeHelpers_1.makeHelpers)(exports.ExternalArticleEventSchema);
|
16
19
|
exports.default = Object.assign({ Schema: exports.ExternalArticleEventSchema }, helpers);
|