@productminds/article-events 4.1.1 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +11 -11
- package/lib/events/ExternalArticleEvent.d.ts +180 -156
- package/lib/events/ExternalArticleEvent.js +15 -2
- 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
@@ -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;
|
package/lib/shared/schema.d.ts
DELETED
package/lib/shared/schema.js
DELETED