@productminds/article-events 0.0.5 → 0.0.7

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/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './src/events/ArticleEvent';
2
- export * from './src/events/ExternalArticleEvent';
3
- export * from './src/events/InternalArticleEvent';
1
+ export * as ArticleEvent from './src/events/ArticleEvent';
2
+ export * as ExternalArticleEvent from './src/events/ExternalArticleEvent';
3
+ export * as InternalArticleEvent from './src/events/InternalArticleEvent';
package/dist/index.js CHANGED
@@ -10,10 +10,20 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
15
24
  };
16
25
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/events/ArticleEvent"), exports);
18
- __exportStar(require("./src/events/ExternalArticleEvent"), exports);
19
- __exportStar(require("./src/events/InternalArticleEvent"), exports);
26
+ exports.InternalArticleEvent = exports.ExternalArticleEvent = exports.ArticleEvent = void 0;
27
+ exports.ArticleEvent = __importStar(require("./src/events/ArticleEvent"));
28
+ exports.ExternalArticleEvent = __importStar(require("./src/events/ExternalArticleEvent"));
29
+ exports.InternalArticleEvent = __importStar(require("./src/events/InternalArticleEvent"));
@@ -1,38 +1,465 @@
1
1
  import { Schema } from '@effect/schema';
2
- export declare const ArticleEventSchema: Schema.Struct<{
3
- kind: Schema.Literal<["ARTICLE_EVENT"]>;
4
- payload: Schema.Struct<{
5
- article: Schema.Struct<{
6
- id: typeof Schema.UUID;
7
- title: typeof Schema.NonEmpty;
8
- teaser: typeof Schema.NonEmpty;
9
- content: typeof Schema.NonEmpty;
10
- publishedAt: typeof Schema.Date;
11
- updatedAt: typeof Schema.Date;
12
- retrievedAt: typeof Schema.Date;
13
- url: typeof Schema.NonEmpty;
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
- authors: Schema.Array$<Schema.Struct<{
27
- name: typeof Schema.NonEmpty;
28
- }>>;
29
- meta: Schema.optional<typeof Schema.Unknown>;
30
- }>;
31
- status: Schema.Literal<["NEW", "UPDATED"]>;
32
- source: Schema.Literal<["INTERNAL", "EXTERNAL"]>;
33
- }>;
34
- }>;
35
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: {
6
+ readonly article: {
7
+ readonly id: string;
8
+ readonly title: string;
9
+ readonly teaser: string;
10
+ readonly content: string;
11
+ readonly publishedAt: Date;
12
+ readonly updatedAt: Date;
13
+ readonly retrievedAt: Date;
14
+ readonly url: string;
15
+ readonly site: string;
16
+ readonly tags: readonly ({
17
+ readonly type: "CATEGORY";
18
+ readonly value: string;
19
+ } | {
20
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
21
+ readonly id: string;
22
+ } | {
23
+ readonly type: "ENTITY";
24
+ readonly value: string;
25
+ readonly entityType: "PERSON";
26
+ })[];
27
+ readonly authors: readonly {
28
+ readonly name: string;
29
+ }[];
30
+ readonly meta?: unknown;
31
+ };
32
+ readonly status: "NEW" | "UPDATED";
33
+ readonly source: "INTERNAL" | "EXTERNAL";
34
+ };
35
+ }, import("@effect/schema/ParseResult").ParseError>;
36
+ decodeExn: (u: unknown) => {
37
+ readonly kind: "ARTICLE_EVENT";
38
+ readonly payload: {
39
+ readonly article: {
40
+ readonly id: string;
41
+ readonly title: string;
42
+ readonly teaser: string;
43
+ readonly content: string;
44
+ readonly publishedAt: Date;
45
+ readonly updatedAt: Date;
46
+ readonly retrievedAt: Date;
47
+ readonly url: string;
48
+ 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
+ readonly authors: readonly {
61
+ readonly name: string;
62
+ }[];
63
+ readonly meta?: unknown;
64
+ };
65
+ readonly status: "NEW" | "UPDATED";
66
+ readonly source: "INTERNAL" | "EXTERNAL";
67
+ };
68
+ };
69
+ encode: (a: {
70
+ readonly kind: "ARTICLE_EVENT";
71
+ readonly payload: {
72
+ readonly article: {
73
+ readonly id: string;
74
+ readonly title: string;
75
+ readonly teaser: string;
76
+ readonly content: string;
77
+ readonly publishedAt: Date;
78
+ readonly updatedAt: Date;
79
+ readonly retrievedAt: Date;
80
+ readonly url: string;
81
+ 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
+ readonly authors: readonly {
94
+ readonly name: string;
95
+ }[];
96
+ readonly meta?: unknown;
97
+ };
98
+ readonly status: "NEW" | "UPDATED";
99
+ readonly source: "INTERNAL" | "EXTERNAL";
100
+ };
101
+ }, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
102
+ readonly kind: "ARTICLE_EVENT";
103
+ readonly payload: {
104
+ readonly article: {
105
+ readonly id: string;
106
+ readonly title: string;
107
+ readonly teaser: string;
108
+ readonly content: string;
109
+ readonly publishedAt: string;
110
+ readonly updatedAt: string;
111
+ readonly retrievedAt: string;
112
+ readonly url: string;
113
+ readonly site: string;
114
+ readonly tags: readonly ({
115
+ readonly type: "CATEGORY";
116
+ readonly value: string;
117
+ } | {
118
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
119
+ readonly id: string;
120
+ } | {
121
+ readonly type: "ENTITY";
122
+ readonly value: string;
123
+ readonly entityType: "PERSON";
124
+ })[];
125
+ readonly authors: readonly {
126
+ readonly name: string;
127
+ }[];
128
+ readonly meta?: unknown;
129
+ };
130
+ readonly status: "NEW" | "UPDATED";
131
+ readonly source: "INTERNAL" | "EXTERNAL";
132
+ };
133
+ }, import("@effect/schema/ParseResult").ParseError>;
134
+ encodeExn: (event: {
135
+ readonly kind: "ARTICLE_EVENT";
136
+ readonly payload: {
137
+ readonly article: {
138
+ readonly id: string;
139
+ readonly title: string;
140
+ readonly teaser: string;
141
+ readonly content: string;
142
+ readonly publishedAt: Date;
143
+ readonly updatedAt: Date;
144
+ readonly retrievedAt: Date;
145
+ readonly url: string;
146
+ 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
+ readonly authors: readonly {
159
+ readonly name: string;
160
+ }[];
161
+ readonly meta?: unknown;
162
+ };
163
+ readonly status: "NEW" | "UPDATED";
164
+ readonly source: "INTERNAL" | "EXTERNAL";
165
+ };
166
+ }) => {
167
+ readonly kind: "ARTICLE_EVENT";
168
+ readonly payload: {
169
+ readonly article: {
170
+ readonly id: string;
171
+ readonly title: string;
172
+ readonly teaser: string;
173
+ readonly content: string;
174
+ readonly publishedAt: string;
175
+ readonly updatedAt: string;
176
+ readonly retrievedAt: string;
177
+ readonly url: string;
178
+ readonly site: string;
179
+ readonly tags: readonly ({
180
+ readonly type: "CATEGORY";
181
+ readonly value: string;
182
+ } | {
183
+ readonly type: "EXTERNAL_ARTICLE_REFERENCE";
184
+ readonly id: string;
185
+ } | {
186
+ readonly type: "ENTITY";
187
+ readonly value: string;
188
+ readonly entityType: "PERSON";
189
+ })[];
190
+ readonly authors: readonly {
191
+ readonly name: string;
192
+ }[];
193
+ readonly meta?: unknown;
194
+ };
195
+ readonly status: "NEW" | "UPDATED";
196
+ readonly source: "INTERNAL" | "EXTERNAL";
197
+ };
198
+ };
199
+ fromString: (msg: string) => import("effect/Either").Either<{
200
+ readonly kind: "ARTICLE_EVENT";
201
+ readonly payload: {
202
+ readonly article: {
203
+ readonly id: string;
204
+ readonly title: string;
205
+ readonly teaser: string;
206
+ readonly content: string;
207
+ readonly publishedAt: Date;
208
+ readonly updatedAt: Date;
209
+ readonly retrievedAt: Date;
210
+ readonly url: string;
211
+ 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
+ readonly authors: readonly {
224
+ readonly name: string;
225
+ }[];
226
+ readonly meta?: unknown;
227
+ };
228
+ readonly status: "NEW" | "UPDATED";
229
+ readonly source: "INTERNAL" | "EXTERNAL";
230
+ };
231
+ }, import("@effect/schema/ParseResult").ParseError>;
232
+ fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
233
+ readonly kind: "ARTICLE_EVENT";
234
+ readonly payload: {
235
+ readonly article: {
236
+ readonly id: string;
237
+ readonly title: string;
238
+ readonly teaser: string;
239
+ readonly content: string;
240
+ readonly publishedAt: Date;
241
+ readonly updatedAt: Date;
242
+ readonly retrievedAt: Date;
243
+ readonly url: string;
244
+ 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
+ readonly authors: readonly {
257
+ readonly name: string;
258
+ }[];
259
+ readonly meta?: unknown;
260
+ };
261
+ readonly status: "NEW" | "UPDATED";
262
+ readonly source: "INTERNAL" | "EXTERNAL";
263
+ };
264
+ }, import("@effect/schema/ParseResult").ParseError>;
265
+ fromStringExn: (msg: string) => {
266
+ readonly kind: "ARTICLE_EVENT";
267
+ readonly payload: {
268
+ readonly article: {
269
+ readonly id: string;
270
+ readonly title: string;
271
+ readonly teaser: string;
272
+ readonly content: string;
273
+ readonly publishedAt: Date;
274
+ readonly updatedAt: Date;
275
+ readonly retrievedAt: Date;
276
+ readonly url: string;
277
+ 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
+ readonly authors: readonly {
290
+ readonly name: string;
291
+ }[];
292
+ readonly meta?: unknown;
293
+ };
294
+ readonly status: "NEW" | "UPDATED";
295
+ readonly source: "INTERNAL" | "EXTERNAL";
296
+ };
297
+ };
298
+ fromBufferExn: (msg: Buffer) => {
299
+ readonly kind: "ARTICLE_EVENT";
300
+ readonly payload: {
301
+ readonly article: {
302
+ readonly id: string;
303
+ readonly title: string;
304
+ readonly teaser: string;
305
+ readonly content: string;
306
+ readonly publishedAt: Date;
307
+ readonly updatedAt: Date;
308
+ readonly retrievedAt: Date;
309
+ readonly url: string;
310
+ 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
+ readonly authors: readonly {
323
+ readonly name: string;
324
+ }[];
325
+ readonly meta?: unknown;
326
+ };
327
+ readonly status: "NEW" | "UPDATED";
328
+ readonly source: "INTERNAL" | "EXTERNAL";
329
+ };
330
+ };
331
+ toString: (event: {
332
+ readonly kind: "ARTICLE_EVENT";
333
+ readonly payload: {
334
+ readonly article: {
335
+ readonly id: string;
336
+ readonly title: string;
337
+ readonly teaser: string;
338
+ readonly content: string;
339
+ readonly publishedAt: Date;
340
+ readonly updatedAt: Date;
341
+ readonly retrievedAt: Date;
342
+ readonly url: string;
343
+ 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
+ readonly authors: readonly {
356
+ readonly name: string;
357
+ }[];
358
+ readonly meta?: unknown;
359
+ };
360
+ readonly status: "NEW" | "UPDATED";
361
+ readonly source: "INTERNAL" | "EXTERNAL";
362
+ };
363
+ }) => string;
364
+ toBuffer: (event: {
365
+ readonly kind: "ARTICLE_EVENT";
366
+ readonly payload: {
367
+ readonly article: {
368
+ readonly id: string;
369
+ readonly title: string;
370
+ readonly teaser: string;
371
+ readonly content: string;
372
+ readonly publishedAt: Date;
373
+ readonly updatedAt: Date;
374
+ readonly retrievedAt: Date;
375
+ readonly url: string;
376
+ 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
+ readonly authors: readonly {
389
+ readonly name: string;
390
+ }[];
391
+ readonly meta?: unknown;
392
+ };
393
+ readonly status: "NEW" | "UPDATED";
394
+ readonly source: "INTERNAL" | "EXTERNAL";
395
+ };
396
+ }) => Buffer;
397
+ toStringExn: (event: {
398
+ readonly kind: "ARTICLE_EVENT";
399
+ readonly payload: {
400
+ readonly article: {
401
+ readonly id: string;
402
+ readonly title: string;
403
+ readonly teaser: string;
404
+ readonly content: string;
405
+ readonly publishedAt: Date;
406
+ readonly updatedAt: Date;
407
+ readonly retrievedAt: Date;
408
+ readonly url: string;
409
+ 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
+ readonly authors: readonly {
422
+ readonly name: string;
423
+ }[];
424
+ readonly meta?: unknown;
425
+ };
426
+ readonly status: "NEW" | "UPDATED";
427
+ readonly source: "INTERNAL" | "EXTERNAL";
428
+ };
429
+ }) => string;
430
+ toBufferExn: (event: {
431
+ readonly kind: "ARTICLE_EVENT";
432
+ readonly payload: {
433
+ readonly article: {
434
+ readonly id: string;
435
+ readonly title: string;
436
+ readonly teaser: string;
437
+ readonly content: string;
438
+ readonly publishedAt: Date;
439
+ readonly updatedAt: Date;
440
+ readonly retrievedAt: Date;
441
+ readonly url: string;
442
+ 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
+ readonly authors: readonly {
455
+ readonly name: string;
456
+ }[];
457
+ readonly meta?: unknown;
458
+ };
459
+ readonly status: "NEW" | "UPDATED";
460
+ readonly source: "INTERNAL" | "EXTERNAL";
461
+ };
462
+ }) => Buffer;
36
463
  Schema: Schema.Struct<{
37
464
  kind: Schema.Literal<["ARTICLE_EVENT"]>;
38
465
  payload: Schema.Struct<{
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArticleEventSchema = void 0;
4
3
  const schema_1 = require("@effect/schema");
5
4
  const Article_1 = require("../types/Article");
6
- exports.ArticleEventSchema = schema_1.Schema.Struct({
5
+ const ArticleEventSchema = schema_1.Schema.Struct({
7
6
  kind: schema_1.Schema.Literal('ARTICLE_EVENT'),
8
7
  payload: schema_1.Schema.Struct({
9
8
  article: Article_1.ArticleSchema,
@@ -12,5 +11,5 @@ exports.ArticleEventSchema = schema_1.Schema.Struct({
12
11
  })
13
12
  });
14
13
  const makeHelpers_1 = require("../utils/makeHelpers");
15
- const helpers = (0, makeHelpers_1.makeHelpers)(exports.ArticleEventSchema);
16
- exports.default = Object.assign({ Schema: exports.ArticleEventSchema }, makeHelpers_1.makeHelpers);
14
+ const helpers = (0, makeHelpers_1.makeHelpers)(ArticleEventSchema);
15
+ exports.default = Object.assign({ Schema: ArticleEventSchema }, helpers);