@productminds/article-events 0.0.10 → 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/{dist/src → lib}/events/ArticleEvent.d.ts +14 -29
- package/{dist/src → lib}/events/ArticleEvent.js +3 -3
- package/{dist/src → lib}/events/ExternalArticleEvent.d.ts +50 -178
- package/{dist/src → lib}/events/ExternalArticleEvent.js +6 -4
- package/{dist/src → lib}/events/InternalArticleEvent.d.ts +30 -110
- package/lib/events/InternalArticleEvent.js +18 -0
- package/{dist/src → lib}/types/Article.d.ts +5 -1
- package/{dist/src → lib}/types/Article.js +12 -7
- package/package.json +13 -16
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -29
- package/dist/src/events/InternalArticleEvent.js +0 -16
- 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/{dist/src → lib}/utils/makeHelpers.js +0 -0
package/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
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 = exports.ArticleEvent = void 0;
|
7
|
+
const ArticleEvent_1 = __importDefault(require("./events/ArticleEvent"));
|
8
|
+
exports.ArticleEvent = ArticleEvent_1.default;
|
9
|
+
const ExternalArticleEvent_1 = __importDefault(require("./events/ExternalArticleEvent"));
|
10
|
+
exports.ExternalArticleEvent = ExternalArticleEvent_1.default;
|
11
|
+
const InternalArticleEvent_1 = __importDefault(require("./events/InternalArticleEvent"));
|
12
|
+
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));
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
5
5
|
readonly payload: {
|
6
6
|
readonly article: {
|
7
7
|
readonly id: string;
|
8
|
+
readonly site: string;
|
8
9
|
readonly title: string;
|
9
10
|
readonly teaser: string;
|
10
11
|
readonly content: string;
|
@@ -12,7 +13,6 @@ declare const _default: {
|
|
12
13
|
readonly updatedAt: Date;
|
13
14
|
readonly retrievedAt: Date;
|
14
15
|
readonly url: string;
|
15
|
-
readonly site: string;
|
16
16
|
readonly tags: readonly ({
|
17
17
|
readonly type: "CATEGORY";
|
18
18
|
readonly value: string;
|
@@ -27,7 +27,6 @@ declare const _default: {
|
|
27
27
|
readonly authors: readonly {
|
28
28
|
readonly name: string;
|
29
29
|
}[];
|
30
|
-
readonly meta?: unknown;
|
31
30
|
};
|
32
31
|
readonly status: "NEW" | "UPDATED";
|
33
32
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -38,6 +37,7 @@ declare const _default: {
|
|
38
37
|
readonly payload: {
|
39
38
|
readonly article: {
|
40
39
|
readonly id: string;
|
40
|
+
readonly site: string;
|
41
41
|
readonly title: string;
|
42
42
|
readonly teaser: string;
|
43
43
|
readonly content: string;
|
@@ -45,7 +45,6 @@ declare const _default: {
|
|
45
45
|
readonly updatedAt: Date;
|
46
46
|
readonly retrievedAt: Date;
|
47
47
|
readonly url: string;
|
48
|
-
readonly site: string;
|
49
48
|
readonly tags: readonly ({
|
50
49
|
readonly type: "CATEGORY";
|
51
50
|
readonly value: string;
|
@@ -60,7 +59,6 @@ declare const _default: {
|
|
60
59
|
readonly authors: readonly {
|
61
60
|
readonly name: string;
|
62
61
|
}[];
|
63
|
-
readonly meta?: unknown;
|
64
62
|
};
|
65
63
|
readonly status: "NEW" | "UPDATED";
|
66
64
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -71,6 +69,7 @@ declare const _default: {
|
|
71
69
|
readonly payload: {
|
72
70
|
readonly article: {
|
73
71
|
readonly id: string;
|
72
|
+
readonly site: string;
|
74
73
|
readonly title: string;
|
75
74
|
readonly teaser: string;
|
76
75
|
readonly content: string;
|
@@ -78,7 +77,6 @@ declare const _default: {
|
|
78
77
|
readonly updatedAt: Date;
|
79
78
|
readonly retrievedAt: Date;
|
80
79
|
readonly url: string;
|
81
|
-
readonly site: string;
|
82
80
|
readonly tags: readonly ({
|
83
81
|
readonly type: "CATEGORY";
|
84
82
|
readonly value: string;
|
@@ -93,7 +91,6 @@ declare const _default: {
|
|
93
91
|
readonly authors: readonly {
|
94
92
|
readonly name: string;
|
95
93
|
}[];
|
96
|
-
readonly meta?: unknown;
|
97
94
|
};
|
98
95
|
readonly status: "NEW" | "UPDATED";
|
99
96
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -103,6 +100,7 @@ declare const _default: {
|
|
103
100
|
readonly payload: {
|
104
101
|
readonly article: {
|
105
102
|
readonly id: string;
|
103
|
+
readonly site: string;
|
106
104
|
readonly title: string;
|
107
105
|
readonly teaser: string;
|
108
106
|
readonly content: string;
|
@@ -110,7 +108,6 @@ declare const _default: {
|
|
110
108
|
readonly updatedAt: string;
|
111
109
|
readonly retrievedAt: string;
|
112
110
|
readonly url: string;
|
113
|
-
readonly site: string;
|
114
111
|
readonly tags: readonly ({
|
115
112
|
readonly type: "CATEGORY";
|
116
113
|
readonly value: string;
|
@@ -125,7 +122,6 @@ declare const _default: {
|
|
125
122
|
readonly authors: readonly {
|
126
123
|
readonly name: string;
|
127
124
|
}[];
|
128
|
-
readonly meta?: unknown;
|
129
125
|
};
|
130
126
|
readonly status: "NEW" | "UPDATED";
|
131
127
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -136,6 +132,7 @@ declare const _default: {
|
|
136
132
|
readonly payload: {
|
137
133
|
readonly article: {
|
138
134
|
readonly id: string;
|
135
|
+
readonly site: string;
|
139
136
|
readonly title: string;
|
140
137
|
readonly teaser: string;
|
141
138
|
readonly content: string;
|
@@ -143,7 +140,6 @@ declare const _default: {
|
|
143
140
|
readonly updatedAt: Date;
|
144
141
|
readonly retrievedAt: Date;
|
145
142
|
readonly url: string;
|
146
|
-
readonly site: string;
|
147
143
|
readonly tags: readonly ({
|
148
144
|
readonly type: "CATEGORY";
|
149
145
|
readonly value: string;
|
@@ -158,7 +154,6 @@ declare const _default: {
|
|
158
154
|
readonly authors: readonly {
|
159
155
|
readonly name: string;
|
160
156
|
}[];
|
161
|
-
readonly meta?: unknown;
|
162
157
|
};
|
163
158
|
readonly status: "NEW" | "UPDATED";
|
164
159
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -168,6 +163,7 @@ declare const _default: {
|
|
168
163
|
readonly payload: {
|
169
164
|
readonly article: {
|
170
165
|
readonly id: string;
|
166
|
+
readonly site: string;
|
171
167
|
readonly title: string;
|
172
168
|
readonly teaser: string;
|
173
169
|
readonly content: string;
|
@@ -175,7 +171,6 @@ declare const _default: {
|
|
175
171
|
readonly updatedAt: string;
|
176
172
|
readonly retrievedAt: string;
|
177
173
|
readonly url: string;
|
178
|
-
readonly site: string;
|
179
174
|
readonly tags: readonly ({
|
180
175
|
readonly type: "CATEGORY";
|
181
176
|
readonly value: string;
|
@@ -190,7 +185,6 @@ declare const _default: {
|
|
190
185
|
readonly authors: readonly {
|
191
186
|
readonly name: string;
|
192
187
|
}[];
|
193
|
-
readonly meta?: unknown;
|
194
188
|
};
|
195
189
|
readonly status: "NEW" | "UPDATED";
|
196
190
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -201,6 +195,7 @@ declare const _default: {
|
|
201
195
|
readonly payload: {
|
202
196
|
readonly article: {
|
203
197
|
readonly id: string;
|
198
|
+
readonly site: string;
|
204
199
|
readonly title: string;
|
205
200
|
readonly teaser: string;
|
206
201
|
readonly content: string;
|
@@ -208,7 +203,6 @@ declare const _default: {
|
|
208
203
|
readonly updatedAt: Date;
|
209
204
|
readonly retrievedAt: Date;
|
210
205
|
readonly url: string;
|
211
|
-
readonly site: string;
|
212
206
|
readonly tags: readonly ({
|
213
207
|
readonly type: "CATEGORY";
|
214
208
|
readonly value: string;
|
@@ -223,7 +217,6 @@ declare const _default: {
|
|
223
217
|
readonly authors: readonly {
|
224
218
|
readonly name: string;
|
225
219
|
}[];
|
226
|
-
readonly meta?: unknown;
|
227
220
|
};
|
228
221
|
readonly status: "NEW" | "UPDATED";
|
229
222
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -234,6 +227,7 @@ declare const _default: {
|
|
234
227
|
readonly payload: {
|
235
228
|
readonly article: {
|
236
229
|
readonly id: string;
|
230
|
+
readonly site: string;
|
237
231
|
readonly title: string;
|
238
232
|
readonly teaser: string;
|
239
233
|
readonly content: string;
|
@@ -241,7 +235,6 @@ declare const _default: {
|
|
241
235
|
readonly updatedAt: Date;
|
242
236
|
readonly retrievedAt: Date;
|
243
237
|
readonly url: string;
|
244
|
-
readonly site: string;
|
245
238
|
readonly tags: readonly ({
|
246
239
|
readonly type: "CATEGORY";
|
247
240
|
readonly value: string;
|
@@ -256,7 +249,6 @@ declare const _default: {
|
|
256
249
|
readonly authors: readonly {
|
257
250
|
readonly name: string;
|
258
251
|
}[];
|
259
|
-
readonly meta?: unknown;
|
260
252
|
};
|
261
253
|
readonly status: "NEW" | "UPDATED";
|
262
254
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -267,6 +259,7 @@ declare const _default: {
|
|
267
259
|
readonly payload: {
|
268
260
|
readonly article: {
|
269
261
|
readonly id: string;
|
262
|
+
readonly site: string;
|
270
263
|
readonly title: string;
|
271
264
|
readonly teaser: string;
|
272
265
|
readonly content: string;
|
@@ -274,7 +267,6 @@ declare const _default: {
|
|
274
267
|
readonly updatedAt: Date;
|
275
268
|
readonly retrievedAt: Date;
|
276
269
|
readonly url: string;
|
277
|
-
readonly site: string;
|
278
270
|
readonly tags: readonly ({
|
279
271
|
readonly type: "CATEGORY";
|
280
272
|
readonly value: string;
|
@@ -289,7 +281,6 @@ declare const _default: {
|
|
289
281
|
readonly authors: readonly {
|
290
282
|
readonly name: string;
|
291
283
|
}[];
|
292
|
-
readonly meta?: unknown;
|
293
284
|
};
|
294
285
|
readonly status: "NEW" | "UPDATED";
|
295
286
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -300,6 +291,7 @@ declare const _default: {
|
|
300
291
|
readonly payload: {
|
301
292
|
readonly article: {
|
302
293
|
readonly id: string;
|
294
|
+
readonly site: string;
|
303
295
|
readonly title: string;
|
304
296
|
readonly teaser: string;
|
305
297
|
readonly content: string;
|
@@ -307,7 +299,6 @@ declare const _default: {
|
|
307
299
|
readonly updatedAt: Date;
|
308
300
|
readonly retrievedAt: Date;
|
309
301
|
readonly url: string;
|
310
|
-
readonly site: string;
|
311
302
|
readonly tags: readonly ({
|
312
303
|
readonly type: "CATEGORY";
|
313
304
|
readonly value: string;
|
@@ -322,7 +313,6 @@ declare const _default: {
|
|
322
313
|
readonly authors: readonly {
|
323
314
|
readonly name: string;
|
324
315
|
}[];
|
325
|
-
readonly meta?: unknown;
|
326
316
|
};
|
327
317
|
readonly status: "NEW" | "UPDATED";
|
328
318
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -333,6 +323,7 @@ declare const _default: {
|
|
333
323
|
readonly payload: {
|
334
324
|
readonly article: {
|
335
325
|
readonly id: string;
|
326
|
+
readonly site: string;
|
336
327
|
readonly title: string;
|
337
328
|
readonly teaser: string;
|
338
329
|
readonly content: string;
|
@@ -340,7 +331,6 @@ declare const _default: {
|
|
340
331
|
readonly updatedAt: Date;
|
341
332
|
readonly retrievedAt: Date;
|
342
333
|
readonly url: string;
|
343
|
-
readonly site: string;
|
344
334
|
readonly tags: readonly ({
|
345
335
|
readonly type: "CATEGORY";
|
346
336
|
readonly value: string;
|
@@ -355,7 +345,6 @@ declare const _default: {
|
|
355
345
|
readonly authors: readonly {
|
356
346
|
readonly name: string;
|
357
347
|
}[];
|
358
|
-
readonly meta?: unknown;
|
359
348
|
};
|
360
349
|
readonly status: "NEW" | "UPDATED";
|
361
350
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -366,6 +355,7 @@ declare const _default: {
|
|
366
355
|
readonly payload: {
|
367
356
|
readonly article: {
|
368
357
|
readonly id: string;
|
358
|
+
readonly site: string;
|
369
359
|
readonly title: string;
|
370
360
|
readonly teaser: string;
|
371
361
|
readonly content: string;
|
@@ -373,7 +363,6 @@ declare const _default: {
|
|
373
363
|
readonly updatedAt: Date;
|
374
364
|
readonly retrievedAt: Date;
|
375
365
|
readonly url: string;
|
376
|
-
readonly site: string;
|
377
366
|
readonly tags: readonly ({
|
378
367
|
readonly type: "CATEGORY";
|
379
368
|
readonly value: string;
|
@@ -388,7 +377,6 @@ declare const _default: {
|
|
388
377
|
readonly authors: readonly {
|
389
378
|
readonly name: string;
|
390
379
|
}[];
|
391
|
-
readonly meta?: unknown;
|
392
380
|
};
|
393
381
|
readonly status: "NEW" | "UPDATED";
|
394
382
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -399,6 +387,7 @@ declare const _default: {
|
|
399
387
|
readonly payload: {
|
400
388
|
readonly article: {
|
401
389
|
readonly id: string;
|
390
|
+
readonly site: string;
|
402
391
|
readonly title: string;
|
403
392
|
readonly teaser: string;
|
404
393
|
readonly content: string;
|
@@ -406,7 +395,6 @@ declare const _default: {
|
|
406
395
|
readonly updatedAt: Date;
|
407
396
|
readonly retrievedAt: Date;
|
408
397
|
readonly url: string;
|
409
|
-
readonly site: string;
|
410
398
|
readonly tags: readonly ({
|
411
399
|
readonly type: "CATEGORY";
|
412
400
|
readonly value: string;
|
@@ -421,7 +409,6 @@ declare const _default: {
|
|
421
409
|
readonly authors: readonly {
|
422
410
|
readonly name: string;
|
423
411
|
}[];
|
424
|
-
readonly meta?: unknown;
|
425
412
|
};
|
426
413
|
readonly status: "NEW" | "UPDATED";
|
427
414
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -432,6 +419,7 @@ declare const _default: {
|
|
432
419
|
readonly payload: {
|
433
420
|
readonly article: {
|
434
421
|
readonly id: string;
|
422
|
+
readonly site: string;
|
435
423
|
readonly title: string;
|
436
424
|
readonly teaser: string;
|
437
425
|
readonly content: string;
|
@@ -439,7 +427,6 @@ declare const _default: {
|
|
439
427
|
readonly updatedAt: Date;
|
440
428
|
readonly retrievedAt: Date;
|
441
429
|
readonly url: string;
|
442
|
-
readonly site: string;
|
443
430
|
readonly tags: readonly ({
|
444
431
|
readonly type: "CATEGORY";
|
445
432
|
readonly value: string;
|
@@ -454,7 +441,6 @@ declare const _default: {
|
|
454
441
|
readonly authors: readonly {
|
455
442
|
readonly name: string;
|
456
443
|
}[];
|
457
|
-
readonly meta?: unknown;
|
458
444
|
};
|
459
445
|
readonly status: "NEW" | "UPDATED";
|
460
446
|
readonly source: "INTERNAL" | "EXTERNAL";
|
@@ -487,7 +473,6 @@ declare const _default: {
|
|
487
473
|
authors: Schema.Array$<Schema.Struct<{
|
488
474
|
name: typeof Schema.NonEmpty;
|
489
475
|
}>>;
|
490
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
491
476
|
}>;
|
492
477
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
493
478
|
source: Schema.Literal<["INTERNAL", "EXTERNAL"]>;
|
@@ -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);
|