@productminds/article-events 5.2.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/article-events/src/article-events.d.ts +3 -0
- package/lib/article-events/src/article-events.js +10 -0
- package/lib/article-events/src/cmd/write-json-schema.d.ts +1 -0
- package/lib/article-events/src/cmd/write-json-schema.js +14 -0
- package/lib/article-events/src/events/ExternalArticleEvent.d.ts +418 -0
- package/lib/article-events/src/events/ExternalArticleEvent.js +19 -0
- package/lib/article-events/src/events/InternalArticleEvent.d.ts +546 -0
- package/lib/article-events/src/events/InternalArticleEvent.js +19 -0
- package/lib/article-events/src/types/Article.d.ts +47 -0
- package/lib/article-events/src/types/Article.js +41 -0
- package/lib/article-events/src/utils/makeHelpers.d.ts +15 -0
- package/lib/article-events/src/utils/makeHelpers.js +45 -0
- package/lib/events/ArticleEvent.d.ts +70 -0
- package/lib/events/ArticleEvent.js +15 -0
- package/lib/events/ExternalArticleEvent.d.ts +2 -2
- package/lib/events/InternalArticleEvent.d.ts +113 -14
- package/lib/events/InternalArticleEvent.js +12 -6
- package/lib/shared/schema.d.ts +2 -0
- package/lib/shared/schema.js +5 -0
- package/lib/types/Article.d.ts +4 -4
- package/package.json +1 -1
@@ -0,0 +1,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;
|
@@ -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;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const schema_1 = require("@effect/schema");
|
4
|
+
const Article_1 = require("../types/Article");
|
5
|
+
const makeHelpers_1 = require("../utils/makeHelpers");
|
6
|
+
const ArticleEventSchema = schema_1.Schema.Struct({
|
7
|
+
kind: schema_1.Schema.Literal('ARTICLE_EVENT'),
|
8
|
+
payload: schema_1.Schema.Struct({
|
9
|
+
article: Article_1.ArticleSchema,
|
10
|
+
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
11
|
+
source: schema_1.Schema.Literal('INTERNAL', 'EXTERNAL'),
|
12
|
+
}),
|
13
|
+
});
|
14
|
+
const helpers = (0, makeHelpers_1.makeHelpers)(ArticleEventSchema);
|
15
|
+
exports.default = Object.assign({ Schema: ArticleEventSchema }, helpers);
|
@@ -7,7 +7,7 @@ export declare const ExternalArticleEventSchema: Schema.Struct<{
|
|
7
7
|
url: typeof Schema.NonEmptyString;
|
8
8
|
site: typeof Schema.NonEmptyString;
|
9
9
|
content: typeof Schema.NonEmptyString;
|
10
|
-
retrievedAt: Schema.transformOrFail<
|
10
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
11
11
|
}>, Schema.SchemaClass<{
|
12
12
|
readonly title?: string | undefined;
|
13
13
|
readonly teaser?: string | undefined;
|
@@ -424,7 +424,7 @@ declare const _default: {
|
|
424
424
|
url: typeof Schema.NonEmptyString;
|
425
425
|
site: typeof Schema.NonEmptyString;
|
426
426
|
content: typeof Schema.NonEmptyString;
|
427
|
-
retrievedAt: Schema.transformOrFail<
|
427
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
428
428
|
}>, Schema.SchemaClass<{
|
429
429
|
readonly title?: string | undefined;
|
430
430
|
readonly teaser?: string | undefined;
|
@@ -1,15 +1,52 @@
|
|
1
1
|
import { Schema } from '@effect/schema';
|
2
|
+
export declare const ArticleUnpublishedSchema: Schema.Struct<{
|
3
|
+
status: Schema.Literal<["UNPUBLISHED"]>;
|
4
|
+
id: typeof Schema.NonEmptyString;
|
5
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
6
|
+
}>;
|
7
|
+
export declare const ArticleIngressSchema: Schema.Struct<{
|
8
|
+
source: Schema.Literal<["INTERNAL"]>;
|
9
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
10
|
+
article: Schema.extend<Schema.Struct<{
|
11
|
+
id: typeof Schema.NonEmptyString;
|
12
|
+
title: typeof Schema.NonEmptyString;
|
13
|
+
teaser: typeof Schema.NonEmptyString;
|
14
|
+
content: typeof Schema.NonEmptyString;
|
15
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
16
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
17
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
18
|
+
url: typeof Schema.NonEmptyString;
|
19
|
+
site: typeof Schema.NonEmptyString;
|
20
|
+
authors: Schema.Array$<Schema.Struct<{
|
21
|
+
name: typeof Schema.NonEmptyString;
|
22
|
+
}>>;
|
23
|
+
}>, Schema.Struct<{
|
24
|
+
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
25
|
+
type: Schema.Literal<["CATEGORY"]>;
|
26
|
+
value: typeof Schema.NonEmptyString;
|
27
|
+
}>, Schema.Struct<{
|
28
|
+
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
29
|
+
id: typeof Schema.NonEmptyString;
|
30
|
+
}>, Schema.Struct<{
|
31
|
+
type: Schema.Literal<["DRUPAL_EXTERNAL_ID"]>;
|
32
|
+
extID: typeof Schema.UUID;
|
33
|
+
extSource: typeof Schema.String;
|
34
|
+
}>]>>;
|
35
|
+
}>>;
|
36
|
+
}>;
|
2
37
|
export declare const InternalArticleEventSchema: Schema.Struct<{
|
3
38
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
4
|
-
payload: Schema.Struct<{
|
39
|
+
payload: Schema.Union<[Schema.Struct<{
|
40
|
+
source: Schema.Literal<["INTERNAL"]>;
|
41
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
5
42
|
article: Schema.extend<Schema.Struct<{
|
6
43
|
id: typeof Schema.NonEmptyString;
|
7
44
|
title: typeof Schema.NonEmptyString;
|
8
45
|
teaser: typeof Schema.NonEmptyString;
|
9
46
|
content: typeof Schema.NonEmptyString;
|
10
|
-
publishedAt: Schema.transformOrFail<
|
11
|
-
updatedAt: Schema.transformOrFail<
|
12
|
-
retrievedAt: Schema.transformOrFail<
|
47
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
48
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
49
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
13
50
|
url: typeof Schema.NonEmptyString;
|
14
51
|
site: typeof Schema.NonEmptyString;
|
15
52
|
authors: Schema.Array$<Schema.Struct<{
|
@@ -28,9 +65,11 @@ export declare const InternalArticleEventSchema: Schema.Struct<{
|
|
28
65
|
extSource: typeof Schema.String;
|
29
66
|
}>]>>;
|
30
67
|
}>>;
|
31
|
-
|
32
|
-
|
33
|
-
|
68
|
+
}>, Schema.Struct<{
|
69
|
+
status: Schema.Literal<["UNPUBLISHED"]>;
|
70
|
+
id: typeof Schema.NonEmptyString;
|
71
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
72
|
+
}>]>;
|
34
73
|
}>;
|
35
74
|
declare const _default: {
|
36
75
|
decode: (u: unknown, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
@@ -64,6 +103,10 @@ declare const _default: {
|
|
64
103
|
};
|
65
104
|
readonly status: "NEW" | "UPDATED";
|
66
105
|
readonly source: "INTERNAL";
|
106
|
+
} | {
|
107
|
+
readonly id: string;
|
108
|
+
readonly status: "UNPUBLISHED";
|
109
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
67
110
|
};
|
68
111
|
}, import("@effect/schema/ParseResult").ParseError>;
|
69
112
|
decodeExn: (u: unknown) => {
|
@@ -97,6 +140,10 @@ declare const _default: {
|
|
97
140
|
};
|
98
141
|
readonly status: "NEW" | "UPDATED";
|
99
142
|
readonly source: "INTERNAL";
|
143
|
+
} | {
|
144
|
+
readonly id: string;
|
145
|
+
readonly status: "UNPUBLISHED";
|
146
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
100
147
|
};
|
101
148
|
};
|
102
149
|
encode: (a: {
|
@@ -130,6 +177,10 @@ declare const _default: {
|
|
130
177
|
};
|
131
178
|
readonly status: "NEW" | "UPDATED";
|
132
179
|
readonly source: "INTERNAL";
|
180
|
+
} | {
|
181
|
+
readonly id: string;
|
182
|
+
readonly status: "UNPUBLISHED";
|
183
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
133
184
|
};
|
134
185
|
}, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
135
186
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -162,6 +213,10 @@ declare const _default: {
|
|
162
213
|
};
|
163
214
|
readonly status: "NEW" | "UPDATED";
|
164
215
|
readonly source: "INTERNAL";
|
216
|
+
} | {
|
217
|
+
readonly id: string;
|
218
|
+
readonly status: "UNPUBLISHED";
|
219
|
+
readonly unpublishedAt: string;
|
165
220
|
};
|
166
221
|
}, import("@effect/schema/ParseResult").ParseError>;
|
167
222
|
encodeExn: (event: {
|
@@ -195,6 +250,10 @@ declare const _default: {
|
|
195
250
|
};
|
196
251
|
readonly status: "NEW" | "UPDATED";
|
197
252
|
readonly source: "INTERNAL";
|
253
|
+
} | {
|
254
|
+
readonly id: string;
|
255
|
+
readonly status: "UNPUBLISHED";
|
256
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
198
257
|
};
|
199
258
|
}) => {
|
200
259
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -227,6 +286,10 @@ declare const _default: {
|
|
227
286
|
};
|
228
287
|
readonly status: "NEW" | "UPDATED";
|
229
288
|
readonly source: "INTERNAL";
|
289
|
+
} | {
|
290
|
+
readonly id: string;
|
291
|
+
readonly status: "UNPUBLISHED";
|
292
|
+
readonly unpublishedAt: string;
|
230
293
|
};
|
231
294
|
};
|
232
295
|
fromString: (msg: string) => import("effect/Either").Either<{
|
@@ -260,6 +323,10 @@ declare const _default: {
|
|
260
323
|
};
|
261
324
|
readonly status: "NEW" | "UPDATED";
|
262
325
|
readonly source: "INTERNAL";
|
326
|
+
} | {
|
327
|
+
readonly id: string;
|
328
|
+
readonly status: "UNPUBLISHED";
|
329
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
263
330
|
};
|
264
331
|
}, import("@effect/schema/ParseResult").ParseError>;
|
265
332
|
fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
|
@@ -293,6 +360,10 @@ declare const _default: {
|
|
293
360
|
};
|
294
361
|
readonly status: "NEW" | "UPDATED";
|
295
362
|
readonly source: "INTERNAL";
|
363
|
+
} | {
|
364
|
+
readonly id: string;
|
365
|
+
readonly status: "UNPUBLISHED";
|
366
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
296
367
|
};
|
297
368
|
}, import("@effect/schema/ParseResult").ParseError>;
|
298
369
|
fromStringExn: (msg: string) => {
|
@@ -326,6 +397,10 @@ declare const _default: {
|
|
326
397
|
};
|
327
398
|
readonly status: "NEW" | "UPDATED";
|
328
399
|
readonly source: "INTERNAL";
|
400
|
+
} | {
|
401
|
+
readonly id: string;
|
402
|
+
readonly status: "UNPUBLISHED";
|
403
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
329
404
|
};
|
330
405
|
};
|
331
406
|
fromBufferExn: (msg: Buffer) => {
|
@@ -359,6 +434,10 @@ declare const _default: {
|
|
359
434
|
};
|
360
435
|
readonly status: "NEW" | "UPDATED";
|
361
436
|
readonly source: "INTERNAL";
|
437
|
+
} | {
|
438
|
+
readonly id: string;
|
439
|
+
readonly status: "UNPUBLISHED";
|
440
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
362
441
|
};
|
363
442
|
};
|
364
443
|
toString: (event: {
|
@@ -392,6 +471,10 @@ declare const _default: {
|
|
392
471
|
};
|
393
472
|
readonly status: "NEW" | "UPDATED";
|
394
473
|
readonly source: "INTERNAL";
|
474
|
+
} | {
|
475
|
+
readonly id: string;
|
476
|
+
readonly status: "UNPUBLISHED";
|
477
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
395
478
|
};
|
396
479
|
}) => string;
|
397
480
|
toBuffer: (event: {
|
@@ -425,6 +508,10 @@ declare const _default: {
|
|
425
508
|
};
|
426
509
|
readonly status: "NEW" | "UPDATED";
|
427
510
|
readonly source: "INTERNAL";
|
511
|
+
} | {
|
512
|
+
readonly id: string;
|
513
|
+
readonly status: "UNPUBLISHED";
|
514
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
428
515
|
};
|
429
516
|
}) => Buffer;
|
430
517
|
toStringExn: (event: {
|
@@ -458,6 +545,10 @@ declare const _default: {
|
|
458
545
|
};
|
459
546
|
readonly status: "NEW" | "UPDATED";
|
460
547
|
readonly source: "INTERNAL";
|
548
|
+
} | {
|
549
|
+
readonly id: string;
|
550
|
+
readonly status: "UNPUBLISHED";
|
551
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
461
552
|
};
|
462
553
|
}) => string;
|
463
554
|
toBufferExn: (event: {
|
@@ -491,19 +582,25 @@ declare const _default: {
|
|
491
582
|
};
|
492
583
|
readonly status: "NEW" | "UPDATED";
|
493
584
|
readonly source: "INTERNAL";
|
585
|
+
} | {
|
586
|
+
readonly id: string;
|
587
|
+
readonly status: "UNPUBLISHED";
|
588
|
+
readonly unpublishedAt: import("effect/DateTime").Utc;
|
494
589
|
};
|
495
590
|
}) => Buffer;
|
496
591
|
Schema: Schema.Struct<{
|
497
592
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
498
|
-
payload: Schema.Struct<{
|
593
|
+
payload: Schema.Union<[Schema.Struct<{
|
594
|
+
source: Schema.Literal<["INTERNAL"]>;
|
595
|
+
status: Schema.Literal<["NEW", "UPDATED"]>;
|
499
596
|
article: Schema.extend<Schema.Struct<{
|
500
597
|
id: typeof Schema.NonEmptyString;
|
501
598
|
title: typeof Schema.NonEmptyString;
|
502
599
|
teaser: typeof Schema.NonEmptyString;
|
503
600
|
content: typeof Schema.NonEmptyString;
|
504
|
-
publishedAt: Schema.transformOrFail<
|
505
|
-
updatedAt: Schema.transformOrFail<
|
506
|
-
retrievedAt: Schema.transformOrFail<
|
601
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
602
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
603
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
507
604
|
url: typeof Schema.NonEmptyString;
|
508
605
|
site: typeof Schema.NonEmptyString;
|
509
606
|
authors: Schema.Array$<Schema.Struct<{
|
@@ -522,9 +619,11 @@ declare const _default: {
|
|
522
619
|
extSource: typeof Schema.String;
|
523
620
|
}>]>>;
|
524
621
|
}>>;
|
525
|
-
|
526
|
-
|
527
|
-
|
622
|
+
}>, Schema.Struct<{
|
623
|
+
status: Schema.Literal<["UNPUBLISHED"]>;
|
624
|
+
id: typeof Schema.NonEmptyString;
|
625
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
626
|
+
}>]>;
|
528
627
|
}>;
|
529
628
|
};
|
530
629
|
export default _default;
|
@@ -1,19 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InternalArticleEventSchema = void 0;
|
3
|
+
exports.InternalArticleEventSchema = exports.ArticleIngressSchema = exports.ArticleUnpublishedSchema = void 0;
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
5
|
const Article_1 = require("../types/Article");
|
6
6
|
const makeHelpers_1 = require("../utils/makeHelpers");
|
7
7
|
const InternalArticleSchema = schema_1.Schema.extend(Article_1.BaseArticleSchema, schema_1.Schema.Struct({
|
8
8
|
tags: schema_1.Schema.Array(schema_1.Schema.Union(Article_1.CategoryTagSchema, Article_1.ExternalArticleReferenceTagSchema, Article_1.DrupalExternalIDTag)),
|
9
9
|
}));
|
10
|
+
exports.ArticleUnpublishedSchema = schema_1.Schema.Struct({
|
11
|
+
status: schema_1.Schema.Literal('UNPUBLISHED'),
|
12
|
+
id: schema_1.Schema.NonEmptyString,
|
13
|
+
unpublishedAt: Article_1.DateTimeSchema,
|
14
|
+
});
|
15
|
+
exports.ArticleIngressSchema = schema_1.Schema.Struct({
|
16
|
+
source: schema_1.Schema.Literal('INTERNAL'),
|
17
|
+
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
18
|
+
article: InternalArticleSchema,
|
19
|
+
});
|
10
20
|
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
11
21
|
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
12
|
-
payload: schema_1.Schema.
|
13
|
-
article: InternalArticleSchema,
|
14
|
-
status: schema_1.Schema.Literal('NEW', 'UPDATED'),
|
15
|
-
source: schema_1.Schema.Literal('INTERNAL'),
|
16
|
-
}),
|
22
|
+
payload: schema_1.Schema.Union(exports.ArticleIngressSchema, exports.ArticleUnpublishedSchema),
|
17
23
|
});
|
18
24
|
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
19
25
|
exports.default = Object.assign({ Schema: exports.InternalArticleEventSchema }, helpers);
|
package/lib/types/Article.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Schema } from '@effect/schema';
|
2
|
-
export declare const DateTimeSchema: Schema.transformOrFail<
|
2
|
+
export declare const DateTimeSchema: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
3
3
|
export declare const CategoryTagSchema: Schema.Struct<{
|
4
4
|
type: Schema.Literal<["CATEGORY"]>;
|
5
5
|
value: typeof Schema.NonEmptyString;
|
@@ -21,9 +21,9 @@ export declare const BaseArticleSchema: Schema.Struct<{
|
|
21
21
|
title: typeof Schema.NonEmptyString;
|
22
22
|
teaser: typeof Schema.NonEmptyString;
|
23
23
|
content: typeof Schema.NonEmptyString;
|
24
|
-
publishedAt: Schema.transformOrFail<
|
25
|
-
updatedAt: Schema.transformOrFail<
|
26
|
-
retrievedAt: Schema.transformOrFail<
|
24
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
25
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
26
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
27
27
|
url: typeof Schema.NonEmptyString;
|
28
28
|
site: typeof Schema.NonEmptyString;
|
29
29
|
authors: Schema.Array$<Schema.Struct<{
|