@trayio/commons 5.34.0 → 5.35.0-unstable.fd7158a
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/dist/base64/Base64.d.ts +5 -10
- package/dist/base64/Base64.d.ts.map +1 -1
- package/dist/base64/Base64.js +8 -40
- package/dist/base64/Base64.unit.test.js +4 -27
- package/dist/buffer/BufferExtensions.d.ts +4 -4
- package/dist/buffer/BufferExtensions.d.ts.map +1 -1
- package/dist/buffer/BufferExtensions.js +25 -38
- package/dist/buffer/BufferExtensions.unit.test.js +22 -45
- package/dist/callsite/CallSite.js +17 -7
- package/dist/codec/CamelCasePropertyNameCodec.d.ts +2 -2
- package/dist/codec/CamelCasePropertyNameCodec.d.ts.map +1 -1
- package/dist/codec/CamelCasePropertyNameCodec.js +2 -25
- package/dist/codec/Codec.abstract.test.d.ts +2 -2
- package/dist/codec/Codec.abstract.test.d.ts.map +1 -1
- package/dist/codec/Codec.abstract.test.js +5 -31
- package/dist/codec/Codec.d.ts +2 -2
- package/dist/codec/Codec.d.ts.map +1 -1
- package/dist/codec/CompositeCodec.d.ts +2 -2
- package/dist/codec/CompositeCodec.d.ts.map +1 -1
- package/dist/codec/CompositeCodec.js +2 -26
- package/dist/codec/PartialRedactionCodec.d.ts +2 -2
- package/dist/codec/PartialRedactionCodec.d.ts.map +1 -1
- package/dist/codec/PartialRedactionCodec.js +2 -25
- package/dist/codec/RemoveNullValuesCodec.d.ts +2 -2
- package/dist/codec/RemoveNullValuesCodec.d.ts.map +1 -1
- package/dist/codec/RemoveNullValuesCodec.js +2 -25
- package/dist/codec/RemoveTopLevelTagCodec.d.ts +2 -2
- package/dist/codec/RemoveTopLevelTagCodec.d.ts.map +1 -1
- package/dist/codec/RemoveTopLevelTagCodec.js +2 -25
- package/dist/codec/SensitiveRemoveTagAndRedactCodec.d.ts +2 -2
- package/dist/codec/SensitiveRemoveTagAndRedactCodec.d.ts.map +1 -1
- package/dist/codec/SensitiveRemoveTagAndRedactCodec.js +2 -25
- package/dist/codec/SensitiveRemoveTagAndRedactCodec.unit.test.js +15 -38
- package/dist/codec/SnakeCasePropertyNameCodec.d.ts +2 -2
- package/dist/codec/SnakeCasePropertyNameCodec.d.ts.map +1 -1
- package/dist/codec/SnakeCasePropertyNameCodec.js +2 -25
- package/dist/codec/TypeCodec.d.ts +24 -8
- package/dist/codec/TypeCodec.d.ts.map +1 -1
- package/dist/codec/TypeCodec.js +40 -48
- package/dist/codec/TypeCodec.unit.test.js +12 -38
- package/dist/dynamicschema/DynamicSchema.d.ts +6 -12
- package/dist/dynamicschema/DynamicSchema.d.ts.map +1 -1
- package/dist/dynamicschema/DynamicSchema.js +18 -41
- package/dist/dynamicschema/DynamicSchema.unit.test.js +51 -75
- package/dist/dynamictype/DynamicType.d.ts +17 -20
- package/dist/dynamictype/DynamicType.d.ts.map +1 -1
- package/dist/dynamictype/DynamicType.js +48 -35
- package/dist/effect/EffectExtensions.d.ts +29 -0
- package/dist/effect/EffectExtensions.d.ts.map +1 -0
- package/dist/effect/EffectExtensions.js +30 -0
- package/dist/effect/EffectExtensions.unit.test.d.ts +2 -0
- package/dist/effect/EffectExtensions.unit.test.d.ts.map +1 -0
- package/dist/effect/EffectExtensions.unit.test.js +59 -0
- package/dist/effect/Interop.d.ts +53 -0
- package/dist/effect/Interop.d.ts.map +1 -0
- package/dist/effect/Interop.js +56 -0
- package/dist/effect/Interop.unit.test.d.ts +2 -0
- package/dist/effect/Interop.unit.test.d.ts.map +1 -0
- package/dist/effect/Interop.unit.test.js +134 -0
- package/dist/effect/SchemaExtensions.d.ts +11 -0
- package/dist/effect/SchemaExtensions.d.ts.map +1 -0
- package/dist/effect/SchemaExtensions.js +7 -0
- package/dist/effect/SchemaExtensions.unit.test.d.ts +2 -0
- package/dist/effect/SchemaExtensions.unit.test.d.ts.map +1 -0
- package/dist/effect/SchemaExtensions.unit.test.js +29 -0
- package/dist/file/FakeFileStorage.d.ts +8 -8
- package/dist/file/FakeFileStorage.d.ts.map +1 -1
- package/dist/file/FakeFileStorage.js +16 -40
- package/dist/file/File.d.ts +10 -14
- package/dist/file/File.d.ts.map +1 -1
- package/dist/file/File.js +31 -24
- package/dist/file/FileStorage.abstract.test.d.ts.map +1 -1
- package/dist/file/FileStorage.abstract.test.js +18 -41
- package/dist/file/NodeFsFileStorage.d.ts +9 -11
- package/dist/file/NodeFsFileStorage.d.ts.map +1 -1
- package/dist/file/NodeFsFileStorage.integration.test.js +21 -45
- package/dist/file/NodeFsFileStorage.js +37 -29
- package/dist/http/Http.d.ts +11 -13
- package/dist/http/Http.d.ts.map +1 -1
- package/dist/http/Http.js +30 -22
- package/dist/http/Http.unit.test.js +3 -26
- package/dist/http/HttpClient.abstract.test.d.ts.map +1 -1
- package/dist/http/HttpClient.abstract.test.js +104 -108
- package/dist/http/HttpClient.d.ts +2 -2
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpController.d.ts +2 -3
- package/dist/http/HttpController.d.ts.map +1 -1
- package/dist/http/HttpSchemas.d.ts +13 -0
- package/dist/http/HttpSchemas.d.ts.map +1 -0
- package/dist/http/HttpSchemas.js +23 -0
- package/dist/http/MultipartHttpRequestBody.integration.test.js +31 -20
- package/dist/http/MultipartHttpRequestBody.unit.test.js +70 -53
- package/dist/record/Record.d.ts +3 -3
- package/dist/record/Record.d.ts.map +1 -1
- package/dist/record/Record.js +9 -30
- package/dist/result/Result.d.ts +3 -3
- package/dist/result/Result.d.ts.map +1 -1
- package/dist/result/Result.js +9 -26
- package/dist/schema/DateFromUnixTime.d.ts +4 -0
- package/dist/schema/DateFromUnixTime.d.ts.map +1 -0
- package/dist/schema/DateFromUnixTime.js +10 -0
- package/dist/schema/DateFromUnixTime.unit.test.d.ts +2 -0
- package/dist/schema/DateFromUnixTime.unit.test.d.ts.map +1 -0
- package/dist/schema/DateFromUnixTime.unit.test.js +11 -0
- package/dist/schema/JsonSchemaIntrospector.js +17 -7
- package/dist/sensitive/Sensitive.d.ts +7 -3
- package/dist/sensitive/Sensitive.d.ts.map +1 -1
- package/dist/sensitive/Sensitive.js +23 -39
- package/dist/sensitive/Sensitive.unit.test.d.ts +4 -4
- package/dist/sensitive/Sensitive.unit.test.d.ts.map +1 -1
- package/dist/sensitive/Sensitive.unit.test.js +20 -46
- package/dist/serialization/FormUrlEncodedSerialization.d.ts +2 -2
- package/dist/serialization/FormUrlEncodedSerialization.d.ts.map +1 -1
- package/dist/serialization/FormUrlEncodedSerialization.js +5 -28
- package/dist/serialization/JsonSerialization.d.ts +2 -2
- package/dist/serialization/JsonSerialization.d.ts.map +1 -1
- package/dist/serialization/JsonSerialization.js +5 -28
- package/dist/serialization/Serialization.abstract.test.d.ts.map +1 -1
- package/dist/serialization/Serialization.abstract.test.js +6 -32
- package/dist/serialization/Serialization.d.ts +2 -2
- package/dist/serialization/Serialization.d.ts.map +1 -1
- package/dist/try/Try.d.ts +2 -2
- package/dist/try/Try.d.ts.map +1 -1
- package/dist/try/Try.js +2 -32
- package/dist/uuid/Uuid.d.ts +11 -10
- package/dist/uuid/Uuid.d.ts.map +1 -1
- package/dist/uuid/Uuid.js +13 -39
- package/dist/uuid/Uuid.unit.test.js +4 -27
- package/dist/zod/SchemaParser.abstract.test.d.ts.map +1 -1
- package/dist/zod/SchemaParser.abstract.test.js +6 -31
- package/dist/zod/SchemaParser.d.ts +2 -2
- package/dist/zod/SchemaParser.d.ts.map +1 -1
- package/dist/zod/ZodSchemaParser.d.ts +3 -4
- package/dist/zod/ZodSchemaParser.d.ts.map +1 -1
- package/dist/zod/ZodSchemaParser.js +4 -28
- package/dist/zod/ZodSchemaParser.unit.test.js +2 -25
- package/package.json +3 -8
- package/dist/http/HttpTypeDescriptors.d.ts +0 -11
- package/dist/http/HttpTypeDescriptors.d.ts.map +0 -1
- package/dist/http/HttpTypeDescriptors.js +0 -59
- package/dist/task/Task.d.ts +0 -19
- package/dist/task/Task.d.ts.map +0 -1
- package/dist/task/Task.js +0 -74
- package/dist/task/Task.unit.test.d.ts +0 -2
- package/dist/task/Task.unit.test.d.ts.map +0 -1
- package/dist/task/Task.unit.test.js +0 -46
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.JsonSchemaIntrospector = void 0;
|
|
27
37
|
const generateSchema = __importStar(require("generate-schema"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import { Codec } from '../codec/Codec';
|
|
3
3
|
export type Sensitive<T> = {
|
|
4
4
|
value: T;
|
|
@@ -6,8 +6,12 @@ export type Sensitive<T> = {
|
|
|
6
6
|
};
|
|
7
7
|
export interface SensitiveInterface {
|
|
8
8
|
fromValue: <T>(value: T) => Sensitive<T>;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Decodes the inner value as it appears on the wire (no wrapper) into a `Sensitive`, and encodes a `Sensitive`
|
|
11
|
+
* to `{ _tag: 'Sensitive', value }` so the outer codec can strip the tag or redact the value.
|
|
12
|
+
*/
|
|
13
|
+
schema: <A, I = unknown>(inner: Schema.Schema<A, I>) => Schema.Schema<Sensitive<A>, unknown>;
|
|
14
|
+
typeCodec: <A, I = unknown>(inner: Schema.Schema<A, I>) => Codec<Sensitive<A>>;
|
|
11
15
|
}
|
|
12
16
|
export declare const Sensitive: SensitiveInterface;
|
|
13
17
|
//# sourceMappingURL=Sensitive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sensitive.d.ts","sourceRoot":"","sources":["../../src/sensitive/Sensitive.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Sensitive.d.ts","sourceRoot":"","sources":["../../src/sensitive/Sensitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAC1B,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EACtB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KACtB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EACzB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KACtB,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACzB;AAoCD,eAAO,MAAM,SAAS,EAAE,kBAKvB,CAAC"}
|
|
@@ -1,45 +1,29 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.Sensitive = void 0;
|
|
27
|
-
const
|
|
28
|
-
const E = __importStar(require("fp-ts/Either"));
|
|
4
|
+
const effect_1 = require("effect");
|
|
29
5
|
const TypeCodec_1 = require("../codec/TypeCodec");
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
const isSensitive = (u) => typeof u === 'object' &&
|
|
7
|
+
u !== null &&
|
|
8
|
+
'_tag' in u &&
|
|
9
|
+
u._tag === 'Sensitive';
|
|
10
|
+
const fromValue = (value) => ({
|
|
11
|
+
value,
|
|
12
|
+
_tag: 'Sensitive',
|
|
13
|
+
});
|
|
14
|
+
const sensitiveSchema = (inner) => {
|
|
15
|
+
const decodeInner = effect_1.ParseResult.decodeUnknown(inner);
|
|
16
|
+
const encodeInner = effect_1.ParseResult.encode(inner);
|
|
17
|
+
return effect_1.Schema.transformOrFail(effect_1.Schema.Unknown, effect_1.Schema.declare((u) => isSensitive(u), {
|
|
18
|
+
identifier: 'Sensitive',
|
|
19
|
+
}), {
|
|
20
|
+
strict: true,
|
|
21
|
+
decode: (input, options) => effect_1.ParseResult.map(decodeInner(input, options), fromValue),
|
|
22
|
+
encode: (sensitive, options) => effect_1.ParseResult.map(encodeInner(sensitive.value, options), (encoded) => fromValue(encoded)),
|
|
23
|
+
}).annotations({ identifier: 'Sensitive' });
|
|
24
|
+
};
|
|
38
25
|
exports.Sensitive = {
|
|
39
|
-
fromValue
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
typeDescriptor: (descriptor) => sensitiveTypeDescriptor(descriptor),
|
|
44
|
-
typeCodec: sensitiveTypeCodec,
|
|
26
|
+
fromValue,
|
|
27
|
+
schema: sensitiveSchema,
|
|
28
|
+
typeCodec: (inner) => TypeCodec_1.TypeCodec.fromSchema(sensitiveSchema(inner)),
|
|
45
29
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Option } from 'effect';
|
|
2
2
|
import { Codec } from '../codec/Codec';
|
|
3
3
|
import { Sensitive } from './Sensitive';
|
|
4
4
|
export type TestTypeSensitive = {
|
|
5
5
|
strField: string;
|
|
6
|
-
intField: Sensitive<
|
|
6
|
+
intField: Sensitive<Option.Option<number>>;
|
|
7
7
|
objectField: Sensitive<{
|
|
8
8
|
int: number;
|
|
9
9
|
str: string;
|
|
10
|
-
optionalObj: Sensitive<
|
|
10
|
+
optionalObj: Sensitive<Option.Option<{
|
|
11
11
|
test: string;
|
|
12
12
|
test1: string;
|
|
13
|
-
testArray: Sensitive<
|
|
13
|
+
testArray: Sensitive<Option.Option<string>[]>;
|
|
14
14
|
}>>;
|
|
15
15
|
}>;
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sensitive.unit.test.d.ts","sourceRoot":"","sources":["../../src/sensitive/Sensitive.unit.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sensitive.unit.test.d.ts","sourceRoot":"","sources":["../../src/sensitive/Sensitive.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAU,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,WAAW,EAAE,SAAS,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,SAAS,CACrB,MAAM,CAAC,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SAC9C,CAAC,CACF,CAAC;KACF,CAAC,CAAC;CACH,CAAC;AA2BF,eAAO,MAAM,+BAA+B,EAAE,KAAK,CAAC,iBAAiB,CACjB,CAAC;AAErD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,iBAAiB,CACd,CAAC"}
|
|
@@ -1,63 +1,37 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.testTypeSensitiveCodec = exports.testTypeSensitiveRedactionCodec = void 0;
|
|
27
|
-
const
|
|
28
|
-
const t = __importStar(require("io-ts"));
|
|
29
|
-
const O = __importStar(require("fp-ts/Option"));
|
|
30
|
-
const td = __importStar(require("io-ts-types"));
|
|
4
|
+
const effect_1 = require("effect");
|
|
31
5
|
const TypeCodec_1 = require("../codec/TypeCodec");
|
|
32
6
|
const Sensitive_1 = require("./Sensitive");
|
|
33
|
-
const
|
|
34
|
-
strField:
|
|
35
|
-
intField: Sensitive_1.Sensitive.
|
|
36
|
-
objectField: Sensitive_1.Sensitive.
|
|
37
|
-
int:
|
|
38
|
-
str:
|
|
39
|
-
optionalObj: Sensitive_1.Sensitive.
|
|
40
|
-
test:
|
|
41
|
-
test1:
|
|
42
|
-
testArray: Sensitive_1.Sensitive.
|
|
43
|
-
}))),
|
|
7
|
+
const testTypeSensitiveSchema = effect_1.Schema.Struct({
|
|
8
|
+
strField: effect_1.Schema.String,
|
|
9
|
+
intField: Sensitive_1.Sensitive.schema(effect_1.Schema.OptionFromNullishOr(effect_1.Schema.Number, null)),
|
|
10
|
+
objectField: Sensitive_1.Sensitive.schema(effect_1.Schema.Struct({
|
|
11
|
+
int: effect_1.Schema.Number,
|
|
12
|
+
str: effect_1.Schema.String,
|
|
13
|
+
optionalObj: Sensitive_1.Sensitive.schema(effect_1.Schema.OptionFromNullishOr(effect_1.Schema.Struct({
|
|
14
|
+
test: effect_1.Schema.String,
|
|
15
|
+
test1: effect_1.Schema.String,
|
|
16
|
+
testArray: Sensitive_1.Sensitive.schema(effect_1.Schema.mutable(effect_1.Schema.Array(effect_1.Schema.OptionFromNullishOr(effect_1.Schema.String, null)))),
|
|
17
|
+
}), null)),
|
|
44
18
|
})),
|
|
45
19
|
});
|
|
46
|
-
exports.testTypeSensitiveRedactionCodec = TypeCodec_1.TypeCodec.
|
|
47
|
-
exports.testTypeSensitiveCodec = TypeCodec_1.TypeCodec.
|
|
20
|
+
exports.testTypeSensitiveRedactionCodec = TypeCodec_1.TypeCodec.fromSchema(testTypeSensitiveSchema, true);
|
|
21
|
+
exports.testTypeSensitiveCodec = TypeCodec_1.TypeCodec.fromSchema(testTypeSensitiveSchema);
|
|
48
22
|
describe('Sensitive', () => {
|
|
49
23
|
describe('encode/decode sensitive values', () => {
|
|
50
24
|
it('should encode sensitive typed data without the extra layer', () => {
|
|
51
25
|
const testValueEncoded = {
|
|
52
26
|
strField: 'str',
|
|
53
|
-
intField: Sensitive_1.Sensitive.fromValue(
|
|
27
|
+
intField: Sensitive_1.Sensitive.fromValue(effect_1.Option.some(123)),
|
|
54
28
|
objectField: Sensitive_1.Sensitive.fromValue({
|
|
55
29
|
str: 'test',
|
|
56
30
|
int: 123,
|
|
57
|
-
optionalObj: Sensitive_1.Sensitive.fromValue(
|
|
31
|
+
optionalObj: Sensitive_1.Sensitive.fromValue(effect_1.Option.some({
|
|
58
32
|
test: 'test',
|
|
59
33
|
test1: 'test1',
|
|
60
|
-
testArray: Sensitive_1.Sensitive.fromValue([
|
|
34
|
+
testArray: Sensitive_1.Sensitive.fromValue([effect_1.Option.some('test')]),
|
|
61
35
|
})),
|
|
62
36
|
}),
|
|
63
37
|
};
|
|
@@ -92,13 +66,13 @@ describe('Sensitive', () => {
|
|
|
92
66
|
},
|
|
93
67
|
};
|
|
94
68
|
const result = exports.testTypeSensitiveCodec.decode(testValueDecoded);
|
|
95
|
-
const expected =
|
|
69
|
+
const expected = effect_1.Either.right({
|
|
96
70
|
strField: 'str',
|
|
97
|
-
intField: Sensitive_1.Sensitive.fromValue(
|
|
71
|
+
intField: Sensitive_1.Sensitive.fromValue(effect_1.Option.none()),
|
|
98
72
|
objectField: Sensitive_1.Sensitive.fromValue({
|
|
99
73
|
str: 'test',
|
|
100
74
|
int: 123,
|
|
101
|
-
optionalObj: Sensitive_1.Sensitive.fromValue(
|
|
75
|
+
optionalObj: Sensitive_1.Sensitive.fromValue(effect_1.Option.some({
|
|
102
76
|
test: 'test',
|
|
103
77
|
test1: 'test1',
|
|
104
78
|
testArray: Sensitive_1.Sensitive.fromValue([]),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Either } from 'effect';
|
|
2
2
|
import { Serialization, SerializationFormat } from './Serialization';
|
|
3
3
|
export declare class FormUrlEncodedSerialization implements Serialization {
|
|
4
4
|
private textEncoder;
|
|
5
5
|
private textDecoder;
|
|
6
6
|
format: SerializationFormat;
|
|
7
7
|
serialize(value: unknown): ArrayBuffer;
|
|
8
|
-
deserialize(value: ArrayBuffer):
|
|
8
|
+
deserialize(value: ArrayBuffer): Either.Either<unknown, Error>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=FormUrlEncodedSerialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormUrlEncodedSerialization.d.ts","sourceRoot":"","sources":["../../src/serialization/FormUrlEncodedSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FormUrlEncodedSerialization.d.ts","sourceRoot":"","sources":["../../src/serialization/FormUrlEncodedSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAIrE,qBAAa,2BAA4B,YAAW,aAAa;IAChE,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,WAAW,CAAqB;IAExC,MAAM,EAAE,mBAAmB,CAAsC;IAEjE,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;IAKtC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;CAS9D"}
|
|
@@ -1,51 +1,28 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.FormUrlEncodedSerialization = void 0;
|
|
30
|
-
const
|
|
7
|
+
const effect_1 = require("effect");
|
|
31
8
|
const util_1 = require("util");
|
|
32
|
-
const function_1 = require("fp-ts/function");
|
|
33
9
|
const qs_1 = __importDefault(require("qs"));
|
|
34
10
|
const Serialization_1 = require("./Serialization");
|
|
35
11
|
const Try_1 = require("../try/Try");
|
|
12
|
+
const BufferExtensions_1 = require("../buffer/BufferExtensions");
|
|
36
13
|
class FormUrlEncodedSerialization {
|
|
37
14
|
textEncoder = new util_1.TextEncoder();
|
|
38
15
|
textDecoder = new util_1.TextDecoder();
|
|
39
16
|
format = Serialization_1.SerializationFormat.FormUrlEncoded;
|
|
40
17
|
serialize(value) {
|
|
41
18
|
const formEncoded = qs_1.default.stringify(value);
|
|
42
|
-
return this.textEncoder.encode(formEncoded)
|
|
19
|
+
return BufferExtensions_1.BufferExtensions.toArrayBuffer(this.textEncoder.encode(formEncoded));
|
|
43
20
|
}
|
|
44
21
|
deserialize(value) {
|
|
45
22
|
if (value.byteLength === 0) {
|
|
46
|
-
return
|
|
23
|
+
return effect_1.Either.right(undefined);
|
|
47
24
|
}
|
|
48
|
-
return
|
|
25
|
+
return effect_1.Either.flatMap((0, Try_1.tryToEither)(() => this.textDecoder.decode(value)), (str) => (0, Try_1.tryToEither)(() => qs_1.default.parse(str)));
|
|
49
26
|
}
|
|
50
27
|
}
|
|
51
28
|
exports.FormUrlEncodedSerialization = FormUrlEncodedSerialization;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Either } from 'effect';
|
|
2
2
|
import { Serialization, SerializationFormat } from './Serialization';
|
|
3
3
|
export declare class JsonSerialization implements Serialization {
|
|
4
4
|
private textEncoder;
|
|
5
5
|
private textDecoder;
|
|
6
6
|
format: SerializationFormat;
|
|
7
7
|
serialize(value: unknown): ArrayBuffer;
|
|
8
|
-
deserialize(value: ArrayBuffer):
|
|
8
|
+
deserialize(value: ArrayBuffer): Either.Either<unknown, Error>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=JsonSerialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSerialization.d.ts","sourceRoot":"","sources":["../../src/serialization/JsonSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"JsonSerialization.d.ts","sourceRoot":"","sources":["../../src/serialization/JsonSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAIrE,qBAAa,iBAAkB,YAAW,aAAa;IACtD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,WAAW,CAAqB;IAExC,MAAM,EAAE,mBAAmB,CAA4B;IAEvD,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;IAKtC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;CAS9D"}
|
|
@@ -1,47 +1,24 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.JsonSerialization = void 0;
|
|
27
|
-
const
|
|
4
|
+
const effect_1 = require("effect");
|
|
28
5
|
const util_1 = require("util");
|
|
29
|
-
const function_1 = require("fp-ts/function");
|
|
30
6
|
const Serialization_1 = require("./Serialization");
|
|
31
7
|
const Try_1 = require("../try/Try");
|
|
8
|
+
const BufferExtensions_1 = require("../buffer/BufferExtensions");
|
|
32
9
|
class JsonSerialization {
|
|
33
10
|
textEncoder = new util_1.TextEncoder();
|
|
34
11
|
textDecoder = new util_1.TextDecoder();
|
|
35
12
|
format = Serialization_1.SerializationFormat.Json;
|
|
36
13
|
serialize(value) {
|
|
37
14
|
const json = JSON.stringify(value);
|
|
38
|
-
return this.textEncoder.encode(json)
|
|
15
|
+
return BufferExtensions_1.BufferExtensions.toArrayBuffer(this.textEncoder.encode(json));
|
|
39
16
|
}
|
|
40
17
|
deserialize(value) {
|
|
41
18
|
if (value.byteLength === 0) {
|
|
42
|
-
return
|
|
19
|
+
return effect_1.Either.right(undefined);
|
|
43
20
|
}
|
|
44
|
-
return
|
|
21
|
+
return effect_1.Either.flatMap((0, Try_1.tryToEither)(() => this.textDecoder.decode(value)), (str) => (0, Try_1.tryToEither)(() => JSON.parse(str)));
|
|
45
22
|
}
|
|
46
23
|
}
|
|
47
24
|
exports.JsonSerialization = JsonSerialization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Serialization.abstract.test.d.ts","sourceRoot":"","sources":["../../src/serialization/Serialization.abstract.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Serialization.abstract.test.d.ts","sourceRoot":"","sources":["../../src/serialization/Serialization.abstract.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa,QAyC7D"}
|
|
@@ -1,41 +1,16 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.testSerialization =
|
|
27
|
-
const
|
|
28
|
-
const O = __importStar(require("fp-ts/Option"));
|
|
29
|
-
const function_1 = require("fp-ts/function");
|
|
3
|
+
exports.testSerialization = testSerialization;
|
|
4
|
+
const effect_1 = require("effect");
|
|
30
5
|
function testSerialization(serialization) {
|
|
31
6
|
describe('Serialization Test', () => {
|
|
32
7
|
test('should serialize and deserialize a value', () => {
|
|
33
8
|
const testValue = {
|
|
34
9
|
strField: 'str',
|
|
35
|
-
intStrField:
|
|
10
|
+
intStrField: '123',
|
|
36
11
|
};
|
|
37
|
-
const result = (0,
|
|
38
|
-
expect(result).toStrictEqual(
|
|
12
|
+
const result = (0, effect_1.pipe)(effect_1.Either.right(serialization.serialize(testValue)), effect_1.Either.flatMap((serialized) => serialization.deserialize(serialized)));
|
|
13
|
+
expect(result).toStrictEqual(effect_1.Either.right(testValue));
|
|
39
14
|
});
|
|
40
15
|
test('should serialize undefined', () => {
|
|
41
16
|
const undefinedType = undefined;
|
|
@@ -46,9 +21,8 @@ function testSerialization(serialization) {
|
|
|
46
21
|
test('should deserialize undefined', () => {
|
|
47
22
|
const undefinedSerialized = new ArrayBuffer(0);
|
|
48
23
|
const result = serialization.deserialize(undefinedSerialized);
|
|
49
|
-
const expected =
|
|
24
|
+
const expected = effect_1.Either.right(undefined);
|
|
50
25
|
expect(result).toStrictEqual(expected);
|
|
51
26
|
});
|
|
52
27
|
});
|
|
53
28
|
}
|
|
54
|
-
exports.testSerialization = testSerialization;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Either } from 'effect';
|
|
2
2
|
export declare enum SerializationFormat {
|
|
3
3
|
Json = "Json",
|
|
4
4
|
FormUrlEncoded = "FormUrlEncoded"
|
|
@@ -6,6 +6,6 @@ export declare enum SerializationFormat {
|
|
|
6
6
|
export interface Serialization {
|
|
7
7
|
format: SerializationFormat;
|
|
8
8
|
serialize(value: unknown): ArrayBuffer;
|
|
9
|
-
deserialize(value: ArrayBuffer):
|
|
9
|
+
deserialize(value: ArrayBuffer): Either.Either<unknown, Error>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=Serialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Serialization.d.ts","sourceRoot":"","sources":["../../src/serialization/Serialization.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Serialization.d.ts","sourceRoot":"","sources":["../../src/serialization/Serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,oBAAY,mBAAmB;IAC9B,IAAI,SAAS;IACb,cAAc,mBAAmB;CACjC;AAED,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,mBAAmB,CAAC;IAE5B,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC;IAEvC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CAC/D"}
|
package/dist/try/Try.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const tryToEither: <T>(block: () => T) =>
|
|
1
|
+
import { Either } from 'effect';
|
|
2
|
+
export declare const tryToEither: <T>(block: () => T) => Either.Either<T, Error>;
|
|
3
3
|
//# sourceMappingURL=Try.d.ts.map
|
package/dist/try/Try.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Try.d.ts","sourceRoot":"","sources":["../../src/try/Try.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Try.d.ts","sourceRoot":"","sources":["../../src/try/Try.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,OAAO,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CACzB,CAAC"}
|
package/dist/try/Try.js
CHANGED
|
@@ -1,37 +1,7 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.tryToEither = void 0;
|
|
27
|
-
const
|
|
4
|
+
const effect_1 = require("effect");
|
|
28
5
|
const Error_1 = require("../error/Error");
|
|
29
|
-
const tryToEither = (block) => {
|
|
30
|
-
try {
|
|
31
|
-
return E.right(block());
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
return E.left((0, Error_1.castError)(error));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
6
|
+
const tryToEither = (block) => effect_1.Either.try({ try: block, catch: Error_1.castError });
|
|
37
7
|
exports.tryToEither = tryToEither;
|
package/dist/uuid/Uuid.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as E from 'fp-ts/Either';
|
|
1
|
+
import { Either, Schema } from 'effect';
|
|
3
2
|
import { Codec } from '../codec/Codec';
|
|
4
|
-
declare const
|
|
5
|
-
export type Uuid =
|
|
6
|
-
export interface UuidBrand {
|
|
7
|
-
readonly Uuid: unique symbol;
|
|
8
|
-
}
|
|
3
|
+
export declare const uuidSchema: Schema.brand<Schema.filter<typeof Schema.String>, "Uuid">;
|
|
4
|
+
export type Uuid = typeof uuidSchema.Type;
|
|
9
5
|
export interface UuidInterface {
|
|
10
|
-
|
|
6
|
+
schema: typeof uuidSchema;
|
|
11
7
|
typeCodec: Codec<Uuid>;
|
|
12
|
-
fromString: (value: string) =>
|
|
8
|
+
fromString: (value: string) => Either.Either<Uuid, Error>;
|
|
13
9
|
parseUuidUnsafe: (value: string) => Uuid;
|
|
14
10
|
decodeBinary: (value: Uuid) => ArrayBuffer;
|
|
15
11
|
randomUuid: () => Uuid;
|
|
16
12
|
}
|
|
17
13
|
export declare const Uuid: UuidInterface;
|
|
18
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Drop-in for io-ts-types' `UUID`, which was both a codec and a branded string type. Same here: `UUID` is the schema
|
|
16
|
+
* as a value and the branded string as a type, so `import { UUID } from 'io-ts-types'` only needs its source changed.
|
|
17
|
+
*/
|
|
18
|
+
export declare const UUID: Schema.brand<Schema.filter<typeof Schema.String>, "Uuid">;
|
|
19
|
+
export type UUID = Uuid;
|
|
19
20
|
//# sourceMappingURL=Uuid.d.ts.map
|
package/dist/uuid/Uuid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Uuid.d.ts","sourceRoot":"","sources":["../../src/uuid/Uuid.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Uuid.d.ts","sourceRoot":"","sources":["../../src/uuid/Uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AASvC,eAAO,MAAM,UAAU,2DAGc,CAAC;AAEtC,MAAM,MAAM,IAAI,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAI1C,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,OAAO,UAAU,CAAC;IAC1B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1D,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,WAAW,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,IAAI,EAAE,aAelB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,2DAAa,CAAC;AAC/B,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC"}
|