@productminds/article-events 2.0.1 → 3.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/shared/schema.d.ts +2 -0
- package/lib/shared/schema.js +5 -0
- 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);
|
@@ -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
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.makeHelpers = void 0;
|
4
|
+
const schema_1 = require("@effect/schema");
|
5
|
+
const makeHelpers = (schema) => {
|
6
|
+
const decode = schema_1.Schema.decodeUnknownEither(schema);
|
7
|
+
const decodeExn = (u) => {
|
8
|
+
const decoded = decode(u);
|
9
|
+
if (decoded._tag === 'Left') {
|
10
|
+
throw new Error('Failed to decode ArticleEvent');
|
11
|
+
}
|
12
|
+
return decoded.right;
|
13
|
+
};
|
14
|
+
const encode = schema_1.Schema.encodeEither(schema);
|
15
|
+
const encodeExn = (event) => {
|
16
|
+
const encoded = encode(event);
|
17
|
+
if (encoded._tag === 'Left') {
|
18
|
+
throw new Error('Failed to encode ArticleEvent');
|
19
|
+
}
|
20
|
+
return encoded.right;
|
21
|
+
};
|
22
|
+
const fromString = (msg) => decode(JSON.parse(msg));
|
23
|
+
const fromBuffer = (msg) => decode(JSON.parse(msg.toString()));
|
24
|
+
const fromStringExn = (msg) => decodeExn(JSON.parse(msg));
|
25
|
+
const fromBufferExn = (msg) => fromStringExn(msg.toString());
|
26
|
+
const toString = (event) => JSON.stringify(encode(event));
|
27
|
+
const toBuffer = (event) => Buffer.from(toString(event));
|
28
|
+
const toStringExn = (event) => JSON.stringify(encodeExn(event));
|
29
|
+
const toBufferExn = (event) => Buffer.from(toStringExn(event));
|
30
|
+
return {
|
31
|
+
decode,
|
32
|
+
decodeExn,
|
33
|
+
encode,
|
34
|
+
encodeExn,
|
35
|
+
fromString,
|
36
|
+
fromBuffer,
|
37
|
+
fromStringExn,
|
38
|
+
fromBufferExn,
|
39
|
+
toString,
|
40
|
+
toBuffer,
|
41
|
+
toStringExn,
|
42
|
+
toBufferExn,
|
43
|
+
};
|
44
|
+
};
|
45
|
+
exports.makeHelpers = makeHelpers;
|