@productminds/article-events 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/lib/events/ExternalArticleEvent.d.ts +2 -2
- package/lib/events/InternalArticleEvent.d.ts +28 -12
- package/lib/events/InternalArticleEvent.js +1 -0
- package/lib/types/Article.d.ts +4 -4
- package/package.json +20 -20
- package/lib/article-events/src/article-events.d.ts +0 -3
- package/lib/article-events/src/article-events.js +0 -10
- package/lib/article-events/src/cmd/write-json-schema.d.ts +0 -1
- package/lib/article-events/src/cmd/write-json-schema.js +0 -14
- package/lib/article-events/src/events/ExternalArticleEvent.d.ts +0 -418
- package/lib/article-events/src/events/ExternalArticleEvent.js +0 -19
- package/lib/article-events/src/events/InternalArticleEvent.d.ts +0 -546
- package/lib/article-events/src/events/InternalArticleEvent.js +0 -19
- package/lib/article-events/src/types/Article.d.ts +0 -47
- package/lib/article-events/src/types/Article.js +0 -41
- package/lib/article-events/src/utils/makeHelpers.d.ts +0 -15
- package/lib/article-events/src/utils/makeHelpers.js +0 -45
- package/lib/shared/schema.d.ts +0 -2
- package/lib/shared/schema.js +0 -5
package/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# `article-events`
|
2
|
-
|
3
|
-
> TODO: description
|
4
|
-
|
5
|
-
## Usage
|
6
|
-
|
7
|
-
```
|
8
|
-
const articleEvents = require('article-events');
|
9
|
-
|
10
|
-
// TODO: DEMONSTRATE API
|
11
|
-
```
|
1
|
+
# `article-events`
|
2
|
+
|
3
|
+
> TODO: description
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```
|
8
|
+
const articleEvents = require('article-events');
|
9
|
+
|
10
|
+
// TODO: DEMONSTRATE API
|
11
|
+
```
|
@@ -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;
|
@@ -2,7 +2,7 @@ import { Schema } from '@effect/schema';
|
|
2
2
|
export declare const ArticleUnpublishedSchema: Schema.Struct<{
|
3
3
|
status: Schema.Literal<["UNPUBLISHED"]>;
|
4
4
|
id: typeof Schema.NonEmptyString;
|
5
|
-
unpublishedAt: Schema.transformOrFail<
|
5
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
6
6
|
}>;
|
7
7
|
export declare const ArticleIngressSchema: Schema.Struct<{
|
8
8
|
source: Schema.Literal<["INTERNAL"]>;
|
@@ -12,9 +12,9 @@ export declare const ArticleIngressSchema: Schema.Struct<{
|
|
12
12
|
title: typeof Schema.NonEmptyString;
|
13
13
|
teaser: typeof Schema.NonEmptyString;
|
14
14
|
content: typeof Schema.NonEmptyString;
|
15
|
-
publishedAt: Schema.transformOrFail<
|
16
|
-
updatedAt: Schema.transformOrFail<
|
17
|
-
retrievedAt: Schema.transformOrFail<
|
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
18
|
url: typeof Schema.NonEmptyString;
|
19
19
|
site: typeof Schema.NonEmptyString;
|
20
20
|
authors: Schema.Array$<Schema.Struct<{
|
@@ -37,6 +37,7 @@ export declare const ArticleIngressSchema: Schema.Struct<{
|
|
37
37
|
}>;
|
38
38
|
export declare const InternalArticleEventSchema: Schema.Struct<{
|
39
39
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
40
|
+
extId: Schema.optional<typeof Schema.NonEmptyString>;
|
40
41
|
payload: Schema.Union<[Schema.Struct<{
|
41
42
|
source: Schema.Literal<["INTERNAL"]>;
|
42
43
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
@@ -45,9 +46,9 @@ export declare const InternalArticleEventSchema: Schema.Struct<{
|
|
45
46
|
title: typeof Schema.NonEmptyString;
|
46
47
|
teaser: typeof Schema.NonEmptyString;
|
47
48
|
content: typeof Schema.NonEmptyString;
|
48
|
-
publishedAt: Schema.transformOrFail<
|
49
|
-
updatedAt: Schema.transformOrFail<
|
50
|
-
retrievedAt: Schema.transformOrFail<
|
49
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
50
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
51
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
51
52
|
url: typeof Schema.NonEmptyString;
|
52
53
|
site: typeof Schema.NonEmptyString;
|
53
54
|
authors: Schema.Array$<Schema.Struct<{
|
@@ -70,7 +71,7 @@ export declare const InternalArticleEventSchema: Schema.Struct<{
|
|
70
71
|
}>, Schema.Struct<{
|
71
72
|
status: Schema.Literal<["UNPUBLISHED"]>;
|
72
73
|
id: typeof Schema.NonEmptyString;
|
73
|
-
unpublishedAt: Schema.transformOrFail<
|
74
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
74
75
|
}>]>;
|
75
76
|
}>;
|
76
77
|
declare const _default: {
|
@@ -111,6 +112,7 @@ declare const _default: {
|
|
111
112
|
readonly status: "UNPUBLISHED";
|
112
113
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
113
114
|
};
|
115
|
+
readonly extId?: string | undefined;
|
114
116
|
}, import("@effect/schema/ParseResult").ParseError>;
|
115
117
|
decodeExn: (u: unknown) => {
|
116
118
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -149,6 +151,7 @@ declare const _default: {
|
|
149
151
|
readonly status: "UNPUBLISHED";
|
150
152
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
151
153
|
};
|
154
|
+
readonly extId?: string | undefined;
|
152
155
|
};
|
153
156
|
encode: (a: {
|
154
157
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -187,6 +190,7 @@ declare const _default: {
|
|
187
190
|
readonly status: "UNPUBLISHED";
|
188
191
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
189
192
|
};
|
193
|
+
readonly extId?: string | undefined;
|
190
194
|
}, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
191
195
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
192
196
|
readonly payload: {
|
@@ -224,6 +228,7 @@ declare const _default: {
|
|
224
228
|
readonly status: "UNPUBLISHED";
|
225
229
|
readonly unpublishedAt: string;
|
226
230
|
};
|
231
|
+
readonly extId?: string | undefined;
|
227
232
|
}, import("@effect/schema/ParseResult").ParseError>;
|
228
233
|
encodeExn: (event: {
|
229
234
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -262,6 +267,7 @@ declare const _default: {
|
|
262
267
|
readonly status: "UNPUBLISHED";
|
263
268
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
264
269
|
};
|
270
|
+
readonly extId?: string | undefined;
|
265
271
|
}) => {
|
266
272
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
267
273
|
readonly payload: {
|
@@ -299,6 +305,7 @@ declare const _default: {
|
|
299
305
|
readonly status: "UNPUBLISHED";
|
300
306
|
readonly unpublishedAt: string;
|
301
307
|
};
|
308
|
+
readonly extId?: string | undefined;
|
302
309
|
};
|
303
310
|
fromString: (msg: string) => import("effect/Either").Either<{
|
304
311
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -337,6 +344,7 @@ declare const _default: {
|
|
337
344
|
readonly status: "UNPUBLISHED";
|
338
345
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
339
346
|
};
|
347
|
+
readonly extId?: string | undefined;
|
340
348
|
}, import("@effect/schema/ParseResult").ParseError>;
|
341
349
|
fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
|
342
350
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -375,6 +383,7 @@ declare const _default: {
|
|
375
383
|
readonly status: "UNPUBLISHED";
|
376
384
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
377
385
|
};
|
386
|
+
readonly extId?: string | undefined;
|
378
387
|
}, import("@effect/schema/ParseResult").ParseError>;
|
379
388
|
fromStringExn: (msg: string) => {
|
380
389
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -413,6 +422,7 @@ declare const _default: {
|
|
413
422
|
readonly status: "UNPUBLISHED";
|
414
423
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
415
424
|
};
|
425
|
+
readonly extId?: string | undefined;
|
416
426
|
};
|
417
427
|
fromBufferExn: (msg: Buffer) => {
|
418
428
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -451,6 +461,7 @@ declare const _default: {
|
|
451
461
|
readonly status: "UNPUBLISHED";
|
452
462
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
453
463
|
};
|
464
|
+
readonly extId?: string | undefined;
|
454
465
|
};
|
455
466
|
toString: (event: {
|
456
467
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -489,6 +500,7 @@ declare const _default: {
|
|
489
500
|
readonly status: "UNPUBLISHED";
|
490
501
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
491
502
|
};
|
503
|
+
readonly extId?: string | undefined;
|
492
504
|
}) => string;
|
493
505
|
toBuffer: (event: {
|
494
506
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -527,6 +539,7 @@ declare const _default: {
|
|
527
539
|
readonly status: "UNPUBLISHED";
|
528
540
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
529
541
|
};
|
542
|
+
readonly extId?: string | undefined;
|
530
543
|
}) => Buffer;
|
531
544
|
toStringExn: (event: {
|
532
545
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -565,6 +578,7 @@ declare const _default: {
|
|
565
578
|
readonly status: "UNPUBLISHED";
|
566
579
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
567
580
|
};
|
581
|
+
readonly extId?: string | undefined;
|
568
582
|
}) => string;
|
569
583
|
toBufferExn: (event: {
|
570
584
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -603,9 +617,11 @@ declare const _default: {
|
|
603
617
|
readonly status: "UNPUBLISHED";
|
604
618
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
605
619
|
};
|
620
|
+
readonly extId?: string | undefined;
|
606
621
|
}) => Buffer;
|
607
622
|
Schema: Schema.Struct<{
|
608
623
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
624
|
+
extId: Schema.optional<typeof Schema.NonEmptyString>;
|
609
625
|
payload: Schema.Union<[Schema.Struct<{
|
610
626
|
source: Schema.Literal<["INTERNAL"]>;
|
611
627
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
@@ -614,9 +630,9 @@ declare const _default: {
|
|
614
630
|
title: typeof Schema.NonEmptyString;
|
615
631
|
teaser: typeof Schema.NonEmptyString;
|
616
632
|
content: typeof Schema.NonEmptyString;
|
617
|
-
publishedAt: Schema.transformOrFail<
|
618
|
-
updatedAt: Schema.transformOrFail<
|
619
|
-
retrievedAt: Schema.transformOrFail<
|
633
|
+
publishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
634
|
+
updatedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
635
|
+
retrievedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
620
636
|
url: typeof Schema.NonEmptyString;
|
621
637
|
site: typeof Schema.NonEmptyString;
|
622
638
|
authors: Schema.Array$<Schema.Struct<{
|
@@ -639,7 +655,7 @@ declare const _default: {
|
|
639
655
|
}>, Schema.Struct<{
|
640
656
|
status: Schema.Literal<["UNPUBLISHED"]>;
|
641
657
|
id: typeof Schema.NonEmptyString;
|
642
|
-
unpublishedAt: Schema.transformOrFail<
|
658
|
+
unpublishedAt: Schema.transformOrFail<Schema.SchemaClass<string, string, never>, typeof Schema.DateTimeUtcFromSelf, never>;
|
643
659
|
}>]>;
|
644
660
|
}>;
|
645
661
|
};
|
@@ -20,6 +20,7 @@ exports.ArticleIngressSchema = schema_1.Schema.Struct({
|
|
20
20
|
});
|
21
21
|
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
22
22
|
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
23
|
+
extId: schema_1.Schema.optional(schema_1.Schema.NonEmptyString),
|
23
24
|
payload: schema_1.Schema.Union(exports.ArticleIngressSchema, exports.ArticleUnpublishedSchema),
|
24
25
|
});
|
25
26
|
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
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<{
|
package/package.json
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
{
|
2
|
-
"name": "@productminds/article-events",
|
3
|
-
"version": "6.2.
|
4
|
-
"description": "Article events",
|
5
|
-
"license": "ISC",
|
6
|
-
"main": "lib/article-events.js",
|
7
|
-
"typings": "lib/article-events.d.ts",
|
8
|
-
"directories": {
|
9
|
-
"lib": "lib"
|
10
|
-
},
|
11
|
-
"files": [
|
12
|
-
"lib"
|
13
|
-
],
|
14
|
-
"scripts": {
|
15
|
-
"cmd:generate_json_schema": "tsc && node ./lib/cmd/write-json-schema.js",
|
16
|
-
"build": "tsc",
|
17
|
-
"build:watch": "tsc --watch",
|
18
|
-
"build_and_publish": "npm run build && npm publish"
|
19
|
-
}
|
20
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@productminds/article-events",
|
3
|
+
"version": "6.2.2",
|
4
|
+
"description": "Article events",
|
5
|
+
"license": "ISC",
|
6
|
+
"main": "lib/article-events.js",
|
7
|
+
"typings": "lib/article-events.d.ts",
|
8
|
+
"directories": {
|
9
|
+
"lib": "lib"
|
10
|
+
},
|
11
|
+
"files": [
|
12
|
+
"lib"
|
13
|
+
],
|
14
|
+
"scripts": {
|
15
|
+
"cmd:generate_json_schema": "tsc && node ./lib/cmd/write-json-schema.js",
|
16
|
+
"build": "tsc",
|
17
|
+
"build:watch": "tsc --watch",
|
18
|
+
"build_and_publish": "npm run build && npm publish"
|
19
|
+
}
|
20
|
+
}
|
@@ -1,10 +0,0 @@
|
|
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;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,14 +0,0 @@
|
|
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));
|