@trayio/commons 2.3.0 → 2.5.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.
|
@@ -7,6 +7,7 @@ export declare class TypeCodec<T> implements Codec<T> {
|
|
|
7
7
|
static unknown: Codec<unknown>;
|
|
8
8
|
static emptyRecord: Codec<{}>;
|
|
9
9
|
static stringRecord: Codec<Record<string, string>>;
|
|
10
|
+
static partialRecord: <K extends Record<string, unknown>, G extends t.Any>(k: t.KeyofType<K>, type: G) => t.PartialC<Record<string, G>>;
|
|
10
11
|
private descriptor;
|
|
11
12
|
private constructor();
|
|
12
13
|
encode(value: T): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeCodec.d.ts","sourceRoot":"","sources":["../../src/codec/TypeCodec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TypeCodec.d.ts","sourceRoot":"","sources":["../../src/codec/TypeCodec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,SAAS,CAAC,CAAC,CAAE,YAAW,KAAK,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAIlE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAEhC;IAEF,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAgD;IAC9E,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAA4C;IACzE,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAElB;IAIhC,MAAM,CAAC,aAAa,oHAGoB;IAExC,OAAO,CAAC,UAAU,CAAqB;IAEvC,OAAO;IAIP,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAIzB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;CAQ1C"}
|
package/dist/codec/TypeCodec.js
CHANGED
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.TypeCodec = void 0;
|
|
27
27
|
const E = __importStar(require("fp-ts/lib/Either"));
|
|
28
28
|
const t = __importStar(require("io-ts"));
|
|
29
|
+
const Record_1 = require("fp-ts/Record");
|
|
29
30
|
const PathReporter_1 = require("io-ts/PathReporter");
|
|
30
31
|
const function_1 = require("fp-ts/function");
|
|
31
32
|
class TypeCodec {
|
|
@@ -49,3 +50,6 @@ TypeCodec.undefined = TypeCodec.fromDescriptor(t.undefined);
|
|
|
49
50
|
TypeCodec.unknown = TypeCodec.fromDescriptor(t.unknown);
|
|
50
51
|
TypeCodec.emptyRecord = TypeCodec.fromDescriptor(t.type({}));
|
|
51
52
|
TypeCodec.stringRecord = TypeCodec.fromDescriptor(t.record(t.string, t.string));
|
|
53
|
+
// Added support for partial records as IO-TS does not support them
|
|
54
|
+
// https://github.com/gcanti/io-ts/issues/429#issuecomment-862472408
|
|
55
|
+
TypeCodec.partialRecord = (k, type) => t.partial((0, Record_1.map)(() => type)(k.keys));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/commons",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Extensions to the standard/core libraries and basic features",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@types/formidable": "3.4.
|
|
17
|
+
"@types/formidable": "3.4.5",
|
|
18
18
|
"@types/node": "18.11.9",
|
|
19
19
|
"@types/uuid": "9.0.2",
|
|
20
20
|
"formidable": "^3.5.1",
|