@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.
Files changed (146) hide show
  1. package/dist/base64/Base64.d.ts +5 -10
  2. package/dist/base64/Base64.d.ts.map +1 -1
  3. package/dist/base64/Base64.js +8 -40
  4. package/dist/base64/Base64.unit.test.js +4 -27
  5. package/dist/buffer/BufferExtensions.d.ts +4 -4
  6. package/dist/buffer/BufferExtensions.d.ts.map +1 -1
  7. package/dist/buffer/BufferExtensions.js +25 -38
  8. package/dist/buffer/BufferExtensions.unit.test.js +22 -45
  9. package/dist/callsite/CallSite.js +17 -7
  10. package/dist/codec/CamelCasePropertyNameCodec.d.ts +2 -2
  11. package/dist/codec/CamelCasePropertyNameCodec.d.ts.map +1 -1
  12. package/dist/codec/CamelCasePropertyNameCodec.js +2 -25
  13. package/dist/codec/Codec.abstract.test.d.ts +2 -2
  14. package/dist/codec/Codec.abstract.test.d.ts.map +1 -1
  15. package/dist/codec/Codec.abstract.test.js +5 -31
  16. package/dist/codec/Codec.d.ts +2 -2
  17. package/dist/codec/Codec.d.ts.map +1 -1
  18. package/dist/codec/CompositeCodec.d.ts +2 -2
  19. package/dist/codec/CompositeCodec.d.ts.map +1 -1
  20. package/dist/codec/CompositeCodec.js +2 -26
  21. package/dist/codec/PartialRedactionCodec.d.ts +2 -2
  22. package/dist/codec/PartialRedactionCodec.d.ts.map +1 -1
  23. package/dist/codec/PartialRedactionCodec.js +2 -25
  24. package/dist/codec/RemoveNullValuesCodec.d.ts +2 -2
  25. package/dist/codec/RemoveNullValuesCodec.d.ts.map +1 -1
  26. package/dist/codec/RemoveNullValuesCodec.js +2 -25
  27. package/dist/codec/RemoveTopLevelTagCodec.d.ts +2 -2
  28. package/dist/codec/RemoveTopLevelTagCodec.d.ts.map +1 -1
  29. package/dist/codec/RemoveTopLevelTagCodec.js +2 -25
  30. package/dist/codec/SensitiveRemoveTagAndRedactCodec.d.ts +2 -2
  31. package/dist/codec/SensitiveRemoveTagAndRedactCodec.d.ts.map +1 -1
  32. package/dist/codec/SensitiveRemoveTagAndRedactCodec.js +2 -25
  33. package/dist/codec/SensitiveRemoveTagAndRedactCodec.unit.test.js +15 -38
  34. package/dist/codec/SnakeCasePropertyNameCodec.d.ts +2 -2
  35. package/dist/codec/SnakeCasePropertyNameCodec.d.ts.map +1 -1
  36. package/dist/codec/SnakeCasePropertyNameCodec.js +2 -25
  37. package/dist/codec/TypeCodec.d.ts +24 -8
  38. package/dist/codec/TypeCodec.d.ts.map +1 -1
  39. package/dist/codec/TypeCodec.js +40 -48
  40. package/dist/codec/TypeCodec.unit.test.js +12 -38
  41. package/dist/dynamicschema/DynamicSchema.d.ts +6 -12
  42. package/dist/dynamicschema/DynamicSchema.d.ts.map +1 -1
  43. package/dist/dynamicschema/DynamicSchema.js +18 -41
  44. package/dist/dynamicschema/DynamicSchema.unit.test.js +51 -75
  45. package/dist/dynamictype/DynamicType.d.ts +17 -20
  46. package/dist/dynamictype/DynamicType.d.ts.map +1 -1
  47. package/dist/dynamictype/DynamicType.js +48 -35
  48. package/dist/effect/EffectExtensions.d.ts +29 -0
  49. package/dist/effect/EffectExtensions.d.ts.map +1 -0
  50. package/dist/effect/EffectExtensions.js +30 -0
  51. package/dist/effect/EffectExtensions.unit.test.d.ts +2 -0
  52. package/dist/effect/EffectExtensions.unit.test.d.ts.map +1 -0
  53. package/dist/effect/EffectExtensions.unit.test.js +59 -0
  54. package/dist/effect/Interop.d.ts +53 -0
  55. package/dist/effect/Interop.d.ts.map +1 -0
  56. package/dist/effect/Interop.js +56 -0
  57. package/dist/effect/Interop.unit.test.d.ts +2 -0
  58. package/dist/effect/Interop.unit.test.d.ts.map +1 -0
  59. package/dist/effect/Interop.unit.test.js +134 -0
  60. package/dist/effect/SchemaExtensions.d.ts +11 -0
  61. package/dist/effect/SchemaExtensions.d.ts.map +1 -0
  62. package/dist/effect/SchemaExtensions.js +7 -0
  63. package/dist/effect/SchemaExtensions.unit.test.d.ts +2 -0
  64. package/dist/effect/SchemaExtensions.unit.test.d.ts.map +1 -0
  65. package/dist/effect/SchemaExtensions.unit.test.js +29 -0
  66. package/dist/file/FakeFileStorage.d.ts +8 -8
  67. package/dist/file/FakeFileStorage.d.ts.map +1 -1
  68. package/dist/file/FakeFileStorage.js +16 -40
  69. package/dist/file/File.d.ts +10 -14
  70. package/dist/file/File.d.ts.map +1 -1
  71. package/dist/file/File.js +31 -24
  72. package/dist/file/FileStorage.abstract.test.d.ts.map +1 -1
  73. package/dist/file/FileStorage.abstract.test.js +18 -41
  74. package/dist/file/NodeFsFileStorage.d.ts +9 -11
  75. package/dist/file/NodeFsFileStorage.d.ts.map +1 -1
  76. package/dist/file/NodeFsFileStorage.integration.test.js +21 -45
  77. package/dist/file/NodeFsFileStorage.js +37 -29
  78. package/dist/http/Http.d.ts +11 -13
  79. package/dist/http/Http.d.ts.map +1 -1
  80. package/dist/http/Http.js +30 -22
  81. package/dist/http/Http.unit.test.js +3 -26
  82. package/dist/http/HttpClient.abstract.test.d.ts.map +1 -1
  83. package/dist/http/HttpClient.abstract.test.js +104 -108
  84. package/dist/http/HttpClient.d.ts +2 -2
  85. package/dist/http/HttpClient.d.ts.map +1 -1
  86. package/dist/http/HttpController.d.ts +2 -3
  87. package/dist/http/HttpController.d.ts.map +1 -1
  88. package/dist/http/HttpSchemas.d.ts +13 -0
  89. package/dist/http/HttpSchemas.d.ts.map +1 -0
  90. package/dist/http/HttpSchemas.js +23 -0
  91. package/dist/http/MultipartHttpRequestBody.integration.test.js +31 -20
  92. package/dist/http/MultipartHttpRequestBody.unit.test.js +70 -53
  93. package/dist/record/Record.d.ts +3 -3
  94. package/dist/record/Record.d.ts.map +1 -1
  95. package/dist/record/Record.js +9 -30
  96. package/dist/result/Result.d.ts +3 -3
  97. package/dist/result/Result.d.ts.map +1 -1
  98. package/dist/result/Result.js +9 -26
  99. package/dist/schema/DateFromUnixTime.d.ts +4 -0
  100. package/dist/schema/DateFromUnixTime.d.ts.map +1 -0
  101. package/dist/schema/DateFromUnixTime.js +10 -0
  102. package/dist/schema/DateFromUnixTime.unit.test.d.ts +2 -0
  103. package/dist/schema/DateFromUnixTime.unit.test.d.ts.map +1 -0
  104. package/dist/schema/DateFromUnixTime.unit.test.js +11 -0
  105. package/dist/schema/JsonSchemaIntrospector.js +17 -7
  106. package/dist/sensitive/Sensitive.d.ts +7 -3
  107. package/dist/sensitive/Sensitive.d.ts.map +1 -1
  108. package/dist/sensitive/Sensitive.js +23 -39
  109. package/dist/sensitive/Sensitive.unit.test.d.ts +4 -4
  110. package/dist/sensitive/Sensitive.unit.test.d.ts.map +1 -1
  111. package/dist/sensitive/Sensitive.unit.test.js +20 -46
  112. package/dist/serialization/FormUrlEncodedSerialization.d.ts +2 -2
  113. package/dist/serialization/FormUrlEncodedSerialization.d.ts.map +1 -1
  114. package/dist/serialization/FormUrlEncodedSerialization.js +5 -28
  115. package/dist/serialization/JsonSerialization.d.ts +2 -2
  116. package/dist/serialization/JsonSerialization.d.ts.map +1 -1
  117. package/dist/serialization/JsonSerialization.js +5 -28
  118. package/dist/serialization/Serialization.abstract.test.d.ts.map +1 -1
  119. package/dist/serialization/Serialization.abstract.test.js +6 -32
  120. package/dist/serialization/Serialization.d.ts +2 -2
  121. package/dist/serialization/Serialization.d.ts.map +1 -1
  122. package/dist/try/Try.d.ts +2 -2
  123. package/dist/try/Try.d.ts.map +1 -1
  124. package/dist/try/Try.js +2 -32
  125. package/dist/uuid/Uuid.d.ts +11 -10
  126. package/dist/uuid/Uuid.d.ts.map +1 -1
  127. package/dist/uuid/Uuid.js +13 -39
  128. package/dist/uuid/Uuid.unit.test.js +4 -27
  129. package/dist/zod/SchemaParser.abstract.test.d.ts.map +1 -1
  130. package/dist/zod/SchemaParser.abstract.test.js +6 -31
  131. package/dist/zod/SchemaParser.d.ts +2 -2
  132. package/dist/zod/SchemaParser.d.ts.map +1 -1
  133. package/dist/zod/ZodSchemaParser.d.ts +3 -4
  134. package/dist/zod/ZodSchemaParser.d.ts.map +1 -1
  135. package/dist/zod/ZodSchemaParser.js +4 -28
  136. package/dist/zod/ZodSchemaParser.unit.test.js +2 -25
  137. package/package.json +3 -8
  138. package/dist/http/HttpTypeDescriptors.d.ts +0 -11
  139. package/dist/http/HttpTypeDescriptors.d.ts.map +0 -1
  140. package/dist/http/HttpTypeDescriptors.js +0 -59
  141. package/dist/task/Task.d.ts +0 -19
  142. package/dist/task/Task.d.ts.map +0 -1
  143. package/dist/task/Task.js +0 -74
  144. package/dist/task/Task.unit.test.d.ts +0 -2
  145. package/dist/task/Task.unit.test.d.ts.map +0 -1
  146. 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 (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
- };
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 * as t from 'io-ts';
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
- typeDescriptor: <T>(descriptor: t.Type<T, unknown>) => t.Type<Sensitive<T>, Sensitive<unknown>>;
10
- typeCodec: <T>(descriptor: t.Type<T, unknown>) => Codec<Sensitive<T>>;
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,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B,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,cAAc,EAAE,CAAC,CAAC,EACjB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,KAC1B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACtE;AAyBD,eAAO,MAAM,SAAS,EAAE,kBAQvB,CAAC"}
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 t = __importStar(require("io-ts"));
28
- const E = __importStar(require("fp-ts/Either"));
4
+ const effect_1 = require("effect");
29
5
  const TypeCodec_1 = require("../codec/TypeCodec");
30
- const sensitiveTypeDescriptor = (descriptor) => new t.Type('Sensitive', (u) => u instanceof Object && '_tag' in u && u._tag === 'Sensitive', (u, c) => {
31
- const validation = descriptor.validate(u, c);
32
- if (E.isLeft(validation)) {
33
- return t.failure(u, c, validation.left.map((e) => e.message).join('\n'));
34
- }
35
- return t.success(exports.Sensitive.fromValue(validation.right));
36
- }, (a) => exports.Sensitive.fromValue(descriptor.encode(a.value)));
37
- const sensitiveTypeCodec = (descriptor) => TypeCodec_1.TypeCodec.fromDescriptor(sensitiveTypeDescriptor(descriptor));
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: (value) => ({
40
- value,
41
- _tag: 'Sensitive',
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 * as O from 'fp-ts/Option';
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<O.Option<number>>;
6
+ intField: Sensitive<Option.Option<number>>;
7
7
  objectField: Sensitive<{
8
8
  int: number;
9
9
  str: string;
10
- optionalObj: Sensitive<O.Option<{
10
+ optionalObj: Sensitive<Option.Option<{
11
11
  test: string;
12
12
  test1: string;
13
- testArray: Sensitive<O.Option<string>[]>;
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":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,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,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACtC,WAAW,EAAE,SAAS,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,SAAS,CACrB,CAAC,CAAC,MAAM,CAAC;YACR,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SACzC,CAAC,CACF,CAAC;KACF,CAAC,CAAC;CACH,CAAC;AAwBF,eAAO,MAAM,+BAA+B,EAAE,KAAK,CAAC,iBAAiB,CAInE,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,iBAAiB,CACiB,CAAC"}
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 E = __importStar(require("fp-ts/Either"));
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 testTypeSensitiveTypeDescriptor = t.type({
34
- strField: t.string,
35
- intField: Sensitive_1.Sensitive.typeDescriptor(td.optionFromNullable(t.number)),
36
- objectField: Sensitive_1.Sensitive.typeDescriptor(t.type({
37
- int: t.number,
38
- str: t.string,
39
- optionalObj: Sensitive_1.Sensitive.typeDescriptor(td.optionFromNullable(t.type({
40
- test: t.string,
41
- test1: t.string,
42
- testArray: Sensitive_1.Sensitive.typeDescriptor(t.array(td.optionFromNullable(t.string))),
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.fromDescriptor(testTypeSensitiveTypeDescriptor, true);
47
- exports.testTypeSensitiveCodec = TypeCodec_1.TypeCodec.fromDescriptor(testTypeSensitiveTypeDescriptor);
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(O.some(123)),
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(O.some({
31
+ optionalObj: Sensitive_1.Sensitive.fromValue(effect_1.Option.some({
58
32
  test: 'test',
59
33
  test1: 'test1',
60
- testArray: Sensitive_1.Sensitive.fromValue([O.some('test')]),
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 = E.right({
69
+ const expected = effect_1.Either.right({
96
70
  strField: 'str',
97
- intField: Sensitive_1.Sensitive.fromValue(O.none),
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(O.some({
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 * as E from 'fp-ts/Either';
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): E.Either<Error, unknown>;
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,KAAK,CAAC,MAAM,cAAc,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGrE,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,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;CASzD"}
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 E = __importStar(require("fp-ts/Either"));
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).buffer;
19
+ return BufferExtensions_1.BufferExtensions.toArrayBuffer(this.textEncoder.encode(formEncoded));
43
20
  }
44
21
  deserialize(value) {
45
22
  if (value.byteLength === 0) {
46
- return E.right(undefined);
23
+ return effect_1.Either.right(undefined);
47
24
  }
48
- return (0, function_1.pipe)((0, Try_1.tryToEither)(() => this.textDecoder.decode(value)), E.chain((str) => (0, Try_1.tryToEither)(() => qs_1.default.parse(str))));
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 * as E from 'fp-ts/Either';
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): E.Either<Error, unknown>;
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,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGrE,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,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;CASzD"}
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 E = __importStar(require("fp-ts/Either"));
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).buffer;
15
+ return BufferExtensions_1.BufferExtensions.toArrayBuffer(this.textEncoder.encode(json));
39
16
  }
40
17
  deserialize(value) {
41
18
  if (value.byteLength === 0) {
42
- return E.right(undefined);
19
+ return effect_1.Either.right(undefined);
43
20
  }
44
- return (0, function_1.pipe)((0, Try_1.tryToEither)(() => this.textDecoder.decode(value)), E.chain((str) => (0, Try_1.tryToEither)(() => JSON.parse(str))));
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":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa,QAyC7D"}
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 = void 0;
27
- const E = __importStar(require("fp-ts/Either"));
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: O.some('123'),
10
+ intStrField: '123',
36
11
  };
37
- const result = (0, function_1.pipe)(E.right(serialization.serialize(testValue)), E.chain((serialized) => serialization.deserialize(serialized)));
38
- expect(result).toStrictEqual(E.right(testValue));
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 = E.right(undefined);
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 * as E from 'fp-ts/Either';
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): E.Either<Error, unknown>;
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,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,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,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAC1D"}
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 * as E from 'fp-ts/Either';
2
- export declare const tryToEither: <T>(block: () => T) => E.Either<Error, 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
@@ -1 +1 @@
1
- {"version":3,"file":"Try.d.ts","sourceRoot":"","sources":["../../src/try/Try.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAQjE,CAAC"}
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 E = __importStar(require("fp-ts/Either"));
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;
@@ -1,19 +1,20 @@
1
- import * as t from 'io-ts';
2
- import * as E from 'fp-ts/Either';
1
+ import { Either, Schema } from 'effect';
3
2
  import { Codec } from '../codec/Codec';
4
- declare const uuidTypeDescriptor: t.BrandC<t.StringC, UuidBrand>;
5
- export type Uuid = t.TypeOf<typeof uuidTypeDescriptor>;
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
- typeDescriptor: t.BrandC<t.StringC, UuidBrand>;
6
+ schema: typeof uuidSchema;
11
7
  typeCodec: Codec<Uuid>;
12
- fromString: (value: string) => E.Either<Error, Uuid>;
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
- export {};
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
@@ -1 +1 @@
1
- {"version":3,"file":"Uuid.d.ts","sourceRoot":"","sources":["../../src/uuid/Uuid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAQvC,QAAA,MAAM,kBAAkB,gCAIvB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIvD,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC7B,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrD,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,aAoBlB,CAAC"}
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"}