@productminds/article-events 0.0.6 → 0.0.8
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/package.json +20 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -19
- package/dist/src/events/ArticleEvent.d.ts +0 -70
- package/dist/src/events/ArticleEvent.js +0 -16
- package/dist/src/events/ExternalArticleEvent.d.ts +0 -70
- package/dist/src/events/ExternalArticleEvent.js +0 -16
- package/dist/src/events/InternalArticleEvent.d.ts +0 -70
- package/dist/src/events/InternalArticleEvent.js +0 -16
- package/dist/src/types/Article.d.ts +0 -55
- package/dist/src/types/Article.js +0 -38
- package/dist/src/utils/makeHelpers.d.ts +0 -15
- package/dist/src/utils/makeHelpers.js +0 -45
package/package.json
CHANGED
@@ -1,12 +1,29 @@
|
|
1
1
|
{
|
2
2
|
"name": "@productminds/article-events",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.8",
|
4
4
|
"description": "",
|
5
|
-
"
|
6
|
-
|
5
|
+
"exports": {
|
6
|
+
".": {
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"default": "./dist/index.js"
|
9
|
+
},
|
10
|
+
"./ArticleEvent": {
|
11
|
+
"types": "./dist/ArticleEvent.d.ts",
|
12
|
+
"default": "./dist/ArticleEvent.js"
|
13
|
+
},
|
14
|
+
"./InternalArticleEvent": {
|
15
|
+
"types": "./dist/InternalArticleEvent.d.ts",
|
16
|
+
"default": "./dist/InternalArticleEvent.js"
|
17
|
+
},
|
18
|
+
"./ExternalArticleEvent": {
|
19
|
+
"types": "./dist/ExternalArticleEvent.d.ts",
|
20
|
+
"default": "./dist/ExternalArticleEvent.js"
|
21
|
+
}
|
22
|
+
},
|
7
23
|
"scripts": {
|
8
24
|
"build": "tsc",
|
9
25
|
"build:watch": "tsc --watch",
|
26
|
+
"build_and_publish": "npm run build && npm publish",
|
10
27
|
"test": "echo \"Error: no test specified\" && exit 1"
|
11
28
|
},
|
12
29
|
"keywords": [],
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
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);
|
15
|
-
};
|
16
|
-
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);
|
@@ -1,70 +0,0 @@
|
|
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
|
-
declare const _default: {
|
36
|
-
Schema: Schema.Struct<{
|
37
|
-
kind: Schema.Literal<["ARTICLE_EVENT"]>;
|
38
|
-
payload: Schema.Struct<{
|
39
|
-
article: Schema.Struct<{
|
40
|
-
id: typeof Schema.UUID;
|
41
|
-
title: typeof Schema.NonEmpty;
|
42
|
-
teaser: typeof Schema.NonEmpty;
|
43
|
-
content: typeof Schema.NonEmpty;
|
44
|
-
publishedAt: typeof Schema.Date;
|
45
|
-
updatedAt: typeof Schema.Date;
|
46
|
-
retrievedAt: typeof Schema.Date;
|
47
|
-
url: typeof Schema.NonEmpty;
|
48
|
-
site: typeof Schema.NonEmpty;
|
49
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
50
|
-
type: Schema.Literal<["CATEGORY"]>;
|
51
|
-
value: typeof Schema.NonEmpty;
|
52
|
-
}>, Schema.Struct<{
|
53
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
54
|
-
id: typeof Schema.UUID;
|
55
|
-
}>, Schema.Struct<{
|
56
|
-
type: Schema.Literal<["ENTITY"]>;
|
57
|
-
entityType: Schema.Literal<["PERSON"]>;
|
58
|
-
value: typeof Schema.NonEmpty;
|
59
|
-
}>]>>;
|
60
|
-
authors: Schema.Array$<Schema.Struct<{
|
61
|
-
name: typeof Schema.NonEmpty;
|
62
|
-
}>>;
|
63
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
64
|
-
}>;
|
65
|
-
status: Schema.Literal<["NEW", "UPDATED"]>;
|
66
|
-
source: Schema.Literal<["INTERNAL", "EXTERNAL"]>;
|
67
|
-
}>;
|
68
|
-
}>;
|
69
|
-
};
|
70
|
-
export default _default;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ArticleEventSchema = void 0;
|
4
|
-
const schema_1 = require("@effect/schema");
|
5
|
-
const Article_1 = require("../types/Article");
|
6
|
-
exports.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 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);
|
@@ -1,70 +0,0 @@
|
|
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.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<["EXTERNAL"]>;
|
33
|
-
}>;
|
34
|
-
}>;
|
35
|
-
declare const _default: {
|
36
|
-
Schema: Schema.Struct<{
|
37
|
-
kind: Schema.Literal<["EXTERNAL_ARTICLE_EVENT"]>;
|
38
|
-
payload: Schema.Struct<{
|
39
|
-
article: Schema.Struct<{
|
40
|
-
id: typeof Schema.UUID;
|
41
|
-
title: typeof Schema.NonEmpty;
|
42
|
-
teaser: typeof Schema.NonEmpty;
|
43
|
-
content: typeof Schema.NonEmpty;
|
44
|
-
publishedAt: typeof Schema.Date;
|
45
|
-
updatedAt: typeof Schema.Date;
|
46
|
-
retrievedAt: typeof Schema.Date;
|
47
|
-
url: typeof Schema.NonEmpty;
|
48
|
-
site: typeof Schema.NonEmpty;
|
49
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
50
|
-
type: Schema.Literal<["CATEGORY"]>;
|
51
|
-
value: typeof Schema.NonEmpty;
|
52
|
-
}>, Schema.Struct<{
|
53
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
54
|
-
id: typeof Schema.UUID;
|
55
|
-
}>, Schema.Struct<{
|
56
|
-
type: Schema.Literal<["ENTITY"]>;
|
57
|
-
entityType: Schema.Literal<["PERSON"]>;
|
58
|
-
value: typeof Schema.NonEmpty;
|
59
|
-
}>]>>;
|
60
|
-
authors: Schema.Array$<Schema.Struct<{
|
61
|
-
name: typeof Schema.NonEmpty;
|
62
|
-
}>>;
|
63
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
64
|
-
}>;
|
65
|
-
status: Schema.Literal<["NEW", "UPDATED"]>;
|
66
|
-
source: Schema.Literal<["EXTERNAL"]>;
|
67
|
-
}>;
|
68
|
-
}>;
|
69
|
-
};
|
70
|
-
export default _default;
|
@@ -1,16 +0,0 @@
|
|
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
|
-
exports.ExternalArticleEventSchema = schema_1.Schema.Struct({
|
7
|
-
kind: schema_1.Schema.Literal('EXTERNAL_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('EXTERNAL')
|
12
|
-
})
|
13
|
-
});
|
14
|
-
const makeHelpers_1 = require("../utils/makeHelpers");
|
15
|
-
const helpers = (0, makeHelpers_1.makeHelpers)(exports.ExternalArticleEventSchema);
|
16
|
-
exports.default = Object.assign({ Schema: exports.ExternalArticleEventSchema }, makeHelpers_1.makeHelpers);
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import { Schema } from '@effect/schema';
|
2
|
-
export declare const InternalArticleEvent: Schema.Struct<{
|
3
|
-
kind: Schema.Literal<["INTERNAL_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"]>;
|
33
|
-
}>;
|
34
|
-
}>;
|
35
|
-
declare const _default: {
|
36
|
-
Schema: Schema.Struct<{
|
37
|
-
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
38
|
-
payload: Schema.Struct<{
|
39
|
-
article: Schema.Struct<{
|
40
|
-
id: typeof Schema.UUID;
|
41
|
-
title: typeof Schema.NonEmpty;
|
42
|
-
teaser: typeof Schema.NonEmpty;
|
43
|
-
content: typeof Schema.NonEmpty;
|
44
|
-
publishedAt: typeof Schema.Date;
|
45
|
-
updatedAt: typeof Schema.Date;
|
46
|
-
retrievedAt: typeof Schema.Date;
|
47
|
-
url: typeof Schema.NonEmpty;
|
48
|
-
site: typeof Schema.NonEmpty;
|
49
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
50
|
-
type: Schema.Literal<["CATEGORY"]>;
|
51
|
-
value: typeof Schema.NonEmpty;
|
52
|
-
}>, Schema.Struct<{
|
53
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
54
|
-
id: typeof Schema.UUID;
|
55
|
-
}>, Schema.Struct<{
|
56
|
-
type: Schema.Literal<["ENTITY"]>;
|
57
|
-
entityType: Schema.Literal<["PERSON"]>;
|
58
|
-
value: typeof Schema.NonEmpty;
|
59
|
-
}>]>>;
|
60
|
-
authors: Schema.Array$<Schema.Struct<{
|
61
|
-
name: typeof Schema.NonEmpty;
|
62
|
-
}>>;
|
63
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
64
|
-
}>;
|
65
|
-
status: Schema.Literal<["NEW", "UPDATED"]>;
|
66
|
-
source: Schema.Literal<["INTERNAL"]>;
|
67
|
-
}>;
|
68
|
-
}>;
|
69
|
-
};
|
70
|
-
export default _default;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InternalArticleEvent = void 0;
|
4
|
-
const schema_1 = require("@effect/schema");
|
5
|
-
const Article_1 = require("../types/Article");
|
6
|
-
exports.InternalArticleEvent = schema_1.Schema.Struct({
|
7
|
-
kind: schema_1.Schema.Literal('INTERNAL_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')
|
12
|
-
})
|
13
|
-
});
|
14
|
-
const makeHelpers_1 = require("../utils/makeHelpers");
|
15
|
-
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEvent);
|
16
|
-
exports.default = Object.assign({ Schema: exports.InternalArticleEvent }, makeHelpers_1.makeHelpers);
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import { Schema } from '@effect/schema';
|
2
|
-
export declare const DateTimeSchema: typeof Schema.Date;
|
3
|
-
export declare const CategoryTagSchema: Schema.Struct<{
|
4
|
-
type: Schema.Literal<["CATEGORY"]>;
|
5
|
-
value: typeof Schema.NonEmpty;
|
6
|
-
}>;
|
7
|
-
export declare const ArticleReferenceSchema: Schema.Struct<{
|
8
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
9
|
-
id: typeof Schema.UUID;
|
10
|
-
}>;
|
11
|
-
export declare const EntityTag: Schema.Struct<{
|
12
|
-
type: Schema.Literal<["ENTITY"]>;
|
13
|
-
entityType: Schema.Literal<["PERSON"]>;
|
14
|
-
value: typeof Schema.NonEmpty;
|
15
|
-
}>;
|
16
|
-
export declare const TagSchema: Schema.Union<[Schema.Struct<{
|
17
|
-
type: Schema.Literal<["CATEGORY"]>;
|
18
|
-
value: typeof Schema.NonEmpty;
|
19
|
-
}>, Schema.Struct<{
|
20
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
21
|
-
id: typeof Schema.UUID;
|
22
|
-
}>, Schema.Struct<{
|
23
|
-
type: Schema.Literal<["ENTITY"]>;
|
24
|
-
entityType: Schema.Literal<["PERSON"]>;
|
25
|
-
value: typeof Schema.NonEmpty;
|
26
|
-
}>]>;
|
27
|
-
export declare const AuthorSchema: Schema.Struct<{
|
28
|
-
name: typeof Schema.NonEmpty;
|
29
|
-
}>;
|
30
|
-
export declare const ArticleSchema: Schema.Struct<{
|
31
|
-
id: typeof Schema.UUID;
|
32
|
-
title: typeof Schema.NonEmpty;
|
33
|
-
teaser: typeof Schema.NonEmpty;
|
34
|
-
content: typeof Schema.NonEmpty;
|
35
|
-
publishedAt: typeof Schema.Date;
|
36
|
-
updatedAt: typeof Schema.Date;
|
37
|
-
retrievedAt: typeof Schema.Date;
|
38
|
-
url: typeof Schema.NonEmpty;
|
39
|
-
site: typeof Schema.NonEmpty;
|
40
|
-
tags: Schema.Array$<Schema.Union<[Schema.Struct<{
|
41
|
-
type: Schema.Literal<["CATEGORY"]>;
|
42
|
-
value: typeof Schema.NonEmpty;
|
43
|
-
}>, Schema.Struct<{
|
44
|
-
type: Schema.Literal<["EXTERNAL_ARTICLE_REFERENCE"]>;
|
45
|
-
id: typeof Schema.UUID;
|
46
|
-
}>, Schema.Struct<{
|
47
|
-
type: Schema.Literal<["ENTITY"]>;
|
48
|
-
entityType: Schema.Literal<["PERSON"]>;
|
49
|
-
value: typeof Schema.NonEmpty;
|
50
|
-
}>]>>;
|
51
|
-
authors: Schema.Array$<Schema.Struct<{
|
52
|
-
name: typeof Schema.NonEmpty;
|
53
|
-
}>>;
|
54
|
-
meta: Schema.optional<typeof Schema.Unknown>;
|
55
|
-
}>;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ArticleSchema = exports.AuthorSchema = exports.TagSchema = exports.EntityTag = exports.ArticleReferenceSchema = exports.CategoryTagSchema = exports.DateTimeSchema = void 0;
|
4
|
-
const schema_1 = require("@effect/schema");
|
5
|
-
exports.DateTimeSchema = schema_1.Schema.Date.annotations({
|
6
|
-
jsonSchema: { format: 'date-time' }
|
7
|
-
});
|
8
|
-
exports.CategoryTagSchema = schema_1.Schema.Struct({
|
9
|
-
type: schema_1.Schema.Literal('CATEGORY'),
|
10
|
-
value: schema_1.Schema.NonEmpty
|
11
|
-
});
|
12
|
-
exports.ArticleReferenceSchema = schema_1.Schema.Struct({
|
13
|
-
type: schema_1.Schema.Literal('EXTERNAL_ARTICLE_REFERENCE'),
|
14
|
-
id: schema_1.Schema.UUID
|
15
|
-
});
|
16
|
-
exports.EntityTag = schema_1.Schema.Struct({
|
17
|
-
type: schema_1.Schema.Literal('ENTITY'),
|
18
|
-
entityType: schema_1.Schema.Literal('PERSON'),
|
19
|
-
value: schema_1.Schema.NonEmpty
|
20
|
-
});
|
21
|
-
exports.TagSchema = schema_1.Schema.Union(exports.CategoryTagSchema, exports.ArticleReferenceSchema, exports.EntityTag);
|
22
|
-
exports.AuthorSchema = schema_1.Schema.Struct({
|
23
|
-
name: schema_1.Schema.NonEmpty
|
24
|
-
});
|
25
|
-
exports.ArticleSchema = schema_1.Schema.Struct({
|
26
|
-
id: schema_1.Schema.UUID,
|
27
|
-
title: schema_1.Schema.NonEmpty,
|
28
|
-
teaser: schema_1.Schema.NonEmpty,
|
29
|
-
content: schema_1.Schema.NonEmpty,
|
30
|
-
publishedAt: exports.DateTimeSchema,
|
31
|
-
updatedAt: exports.DateTimeSchema,
|
32
|
-
retrievedAt: exports.DateTimeSchema,
|
33
|
-
url: schema_1.Schema.NonEmpty,
|
34
|
-
site: schema_1.Schema.NonEmpty,
|
35
|
-
tags: schema_1.Schema.Array(exports.TagSchema),
|
36
|
-
authors: schema_1.Schema.Array(exports.AuthorSchema),
|
37
|
-
meta: schema_1.Schema.optional(schema_1.Schema.Unknown)
|
38
|
-
});
|
@@ -1,15 +0,0 @@
|
|
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
|
-
};
|
@@ -1,45 +0,0 @@
|
|
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;
|