@productminds/article-events 0.0.7 → 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 +19 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -29
- package/dist/src/events/ArticleEvent.d.ts +0 -497
- package/dist/src/events/ArticleEvent.js +0 -15
- package/dist/src/events/ExternalArticleEvent.d.ts +0 -530
- package/dist/src/events/ExternalArticleEvent.js +0 -16
- package/dist/src/events/InternalArticleEvent.d.ts +0 -530
- 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
@@ -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;
|