@trayio/commons 5.35.0-unstable.fd7158a → 6.0.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.
Files changed (146) hide show
  1. package/dist/base64/Base64.d.ts +10 -5
  2. package/dist/base64/Base64.d.ts.map +1 -1
  3. package/dist/base64/Base64.js +40 -8
  4. package/dist/base64/Base64.unit.test.js +27 -4
  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 +38 -25
  8. package/dist/buffer/BufferExtensions.unit.test.js +45 -22
  9. package/dist/callsite/CallSite.js +7 -17
  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 +25 -2
  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 +31 -5
  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 +26 -2
  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 +25 -2
  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 +25 -2
  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 +25 -2
  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 +25 -2
  33. package/dist/codec/SensitiveRemoveTagAndRedactCodec.unit.test.js +38 -15
  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 +25 -2
  37. package/dist/codec/TypeCodec.d.ts +8 -24
  38. package/dist/codec/TypeCodec.d.ts.map +1 -1
  39. package/dist/codec/TypeCodec.js +48 -40
  40. package/dist/codec/TypeCodec.unit.test.js +38 -12
  41. package/dist/dynamicschema/DynamicSchema.d.ts +12 -6
  42. package/dist/dynamicschema/DynamicSchema.d.ts.map +1 -1
  43. package/dist/dynamicschema/DynamicSchema.js +41 -18
  44. package/dist/dynamicschema/DynamicSchema.unit.test.js +75 -51
  45. package/dist/dynamictype/DynamicType.d.ts +20 -17
  46. package/dist/dynamictype/DynamicType.d.ts.map +1 -1
  47. package/dist/dynamictype/DynamicType.js +35 -48
  48. package/dist/file/FakeFileStorage.d.ts +8 -8
  49. package/dist/file/FakeFileStorage.d.ts.map +1 -1
  50. package/dist/file/FakeFileStorage.js +40 -16
  51. package/dist/file/File.d.ts +14 -10
  52. package/dist/file/File.d.ts.map +1 -1
  53. package/dist/file/File.js +24 -31
  54. package/dist/file/FileStorage.abstract.test.d.ts.map +1 -1
  55. package/dist/file/FileStorage.abstract.test.js +41 -18
  56. package/dist/file/NodeFsFileStorage.d.ts +11 -9
  57. package/dist/file/NodeFsFileStorage.d.ts.map +1 -1
  58. package/dist/file/NodeFsFileStorage.integration.test.js +45 -21
  59. package/dist/file/NodeFsFileStorage.js +29 -37
  60. package/dist/http/Http.d.ts +13 -11
  61. package/dist/http/Http.d.ts.map +1 -1
  62. package/dist/http/Http.js +22 -30
  63. package/dist/http/Http.unit.test.js +26 -3
  64. package/dist/http/HttpClient.abstract.test.d.ts.map +1 -1
  65. package/dist/http/HttpClient.abstract.test.js +108 -104
  66. package/dist/http/HttpClient.d.ts +2 -2
  67. package/dist/http/HttpClient.d.ts.map +1 -1
  68. package/dist/http/HttpController.d.ts +3 -2
  69. package/dist/http/HttpController.d.ts.map +1 -1
  70. package/dist/http/HttpTypeDescriptors.d.ts +11 -0
  71. package/dist/http/HttpTypeDescriptors.d.ts.map +1 -0
  72. package/dist/http/HttpTypeDescriptors.js +59 -0
  73. package/dist/http/MultipartHttpRequestBody.integration.test.js +20 -31
  74. package/dist/http/MultipartHttpRequestBody.unit.test.js +53 -70
  75. package/dist/record/Record.d.ts +3 -3
  76. package/dist/record/Record.d.ts.map +1 -1
  77. package/dist/record/Record.js +30 -9
  78. package/dist/result/Result.d.ts +3 -3
  79. package/dist/result/Result.d.ts.map +1 -1
  80. package/dist/result/Result.js +26 -9
  81. package/dist/schema/JsonSchemaIntrospector.js +7 -17
  82. package/dist/sensitive/Sensitive.d.ts +3 -7
  83. package/dist/sensitive/Sensitive.d.ts.map +1 -1
  84. package/dist/sensitive/Sensitive.js +39 -23
  85. package/dist/sensitive/Sensitive.unit.test.d.ts +4 -4
  86. package/dist/sensitive/Sensitive.unit.test.d.ts.map +1 -1
  87. package/dist/sensitive/Sensitive.unit.test.js +46 -20
  88. package/dist/serialization/FormUrlEncodedSerialization.d.ts +2 -2
  89. package/dist/serialization/FormUrlEncodedSerialization.d.ts.map +1 -1
  90. package/dist/serialization/FormUrlEncodedSerialization.js +28 -5
  91. package/dist/serialization/JsonSerialization.d.ts +2 -2
  92. package/dist/serialization/JsonSerialization.d.ts.map +1 -1
  93. package/dist/serialization/JsonSerialization.js +28 -5
  94. package/dist/serialization/Serialization.abstract.test.d.ts.map +1 -1
  95. package/dist/serialization/Serialization.abstract.test.js +32 -6
  96. package/dist/serialization/Serialization.d.ts +2 -2
  97. package/dist/serialization/Serialization.d.ts.map +1 -1
  98. package/dist/task/Task.d.ts +19 -0
  99. package/dist/task/Task.d.ts.map +1 -0
  100. package/dist/task/Task.js +74 -0
  101. package/dist/task/Task.unit.test.d.ts +2 -0
  102. package/dist/task/Task.unit.test.d.ts.map +1 -0
  103. package/dist/task/Task.unit.test.js +46 -0
  104. package/dist/try/Try.d.ts +2 -2
  105. package/dist/try/Try.d.ts.map +1 -1
  106. package/dist/try/Try.js +32 -2
  107. package/dist/uuid/Uuid.d.ts +10 -11
  108. package/dist/uuid/Uuid.d.ts.map +1 -1
  109. package/dist/uuid/Uuid.js +39 -13
  110. package/dist/uuid/Uuid.unit.test.js +27 -4
  111. package/dist/zod/SchemaParser.abstract.test.d.ts.map +1 -1
  112. package/dist/zod/SchemaParser.abstract.test.js +31 -6
  113. package/dist/zod/SchemaParser.d.ts +2 -2
  114. package/dist/zod/SchemaParser.d.ts.map +1 -1
  115. package/dist/zod/ZodSchemaParser.d.ts +4 -3
  116. package/dist/zod/ZodSchemaParser.d.ts.map +1 -1
  117. package/dist/zod/ZodSchemaParser.js +28 -4
  118. package/dist/zod/ZodSchemaParser.unit.test.js +25 -2
  119. package/package.json +9 -4
  120. package/dist/effect/EffectExtensions.d.ts +0 -29
  121. package/dist/effect/EffectExtensions.d.ts.map +0 -1
  122. package/dist/effect/EffectExtensions.js +0 -30
  123. package/dist/effect/EffectExtensions.unit.test.d.ts +0 -2
  124. package/dist/effect/EffectExtensions.unit.test.d.ts.map +0 -1
  125. package/dist/effect/EffectExtensions.unit.test.js +0 -59
  126. package/dist/effect/Interop.d.ts +0 -53
  127. package/dist/effect/Interop.d.ts.map +0 -1
  128. package/dist/effect/Interop.js +0 -56
  129. package/dist/effect/Interop.unit.test.d.ts +0 -2
  130. package/dist/effect/Interop.unit.test.d.ts.map +0 -1
  131. package/dist/effect/Interop.unit.test.js +0 -134
  132. package/dist/effect/SchemaExtensions.d.ts +0 -11
  133. package/dist/effect/SchemaExtensions.d.ts.map +0 -1
  134. package/dist/effect/SchemaExtensions.js +0 -7
  135. package/dist/effect/SchemaExtensions.unit.test.d.ts +0 -2
  136. package/dist/effect/SchemaExtensions.unit.test.d.ts.map +0 -1
  137. package/dist/effect/SchemaExtensions.unit.test.js +0 -29
  138. package/dist/http/HttpSchemas.d.ts +0 -13
  139. package/dist/http/HttpSchemas.d.ts.map +0 -1
  140. package/dist/http/HttpSchemas.js +0 -23
  141. package/dist/schema/DateFromUnixTime.d.ts +0 -4
  142. package/dist/schema/DateFromUnixTime.d.ts.map +0 -1
  143. package/dist/schema/DateFromUnixTime.js +0 -10
  144. package/dist/schema/DateFromUnixTime.unit.test.d.ts +0 -2
  145. package/dist/schema/DateFromUnixTime.unit.test.d.ts.map +0 -1
  146. package/dist/schema/DateFromUnixTime.unit.test.js +0 -11
@@ -1,4 +1,6 @@
1
- import { Effect, Option } from 'effect';
1
+ /// <reference types="node" />
2
+ import * as O from 'fp-ts/lib/Option';
3
+ import * as TE from 'fp-ts/lib/TaskEither';
2
4
  import { Readable } from 'stream';
3
5
  import { File, FileStorage } from '../file/File';
4
6
  import { SerializationFormat } from '../serialization/Serialization';
@@ -15,10 +17,10 @@ export type MultipartHttpRequestBody = {
15
17
  };
16
18
  export type StreamHttpRequestBody = Readable;
17
19
  export interface MultipartHttpRequestBodyInterface {
18
- create: (value: unknown, fileStorage: FileStorage) => Effect.Effect<MultipartHttpRequestBody, Error>;
20
+ create: (value: unknown, fileStorage: FileStorage) => TE.TaskEither<Error, MultipartHttpRequestBody>;
19
21
  }
20
22
  export declare const MultipartHttpRequestBody: {
21
- create: (value: unknown, fileStorage: FileStorage) => Effect.Effect<MultipartHttpRequestBody, Error>;
23
+ create: (value: unknown, fileStorage: FileStorage) => TE.TaskEither<Error, MultipartHttpRequestBody>;
22
24
  };
23
25
  export type HttpRequestBody = RegularHttpRequestBody | MultipartHttpRequestBody | StreamHttpRequestBody;
24
26
  export type HttpCertificate = {
@@ -26,20 +28,20 @@ export type HttpCertificate = {
26
28
  key: string;
27
29
  };
28
30
  export type HttpAgent = {
29
- certificate: Option.Option<HttpCertificate>;
31
+ certificate: O.Option<HttpCertificate>;
30
32
  };
31
33
  export type HeaderOptions = {
32
- preserveHeaderCasing: Option.Option<boolean>;
34
+ preserveHeaderCasing: O.Option<boolean>;
33
35
  };
34
36
  export type HttpRequest = {
35
37
  headers: HttpHeaders;
36
- headerOptions: Option.Option<HeaderOptions>;
38
+ headerOptions: O.Option<HeaderOptions>;
37
39
  pathParams: Record<string, string>;
38
40
  queryString: HttpQueryString;
39
41
  body: HttpRequestBody;
40
- agent: Option.Option<HttpAgent>;
41
- clientIp: Option.Option<string>;
42
- timeout?: Option.Option<number>;
42
+ agent: O.Option<HttpAgent>;
43
+ clientIp: O.Option<string>;
44
+ timeout?: O.Option<number>;
43
45
  };
44
46
  export type HttpResponse = {
45
47
  statusCode: number;
@@ -77,8 +79,8 @@ export interface HttpRequestInterface {
77
79
  }
78
80
  export declare const HttpRequest: HttpRequestInterface;
79
81
  export interface HttpHeadersInterface {
80
- get: (headers: HttpHeaders, name: string) => Option.Option<HttpHeaderValue>;
81
- extractBearerToken: (headers: HttpHeaders) => Option.Option<string>;
82
+ get: (headers: HttpHeaders, name: string) => O.Option<HttpHeaderValue>;
83
+ extractBearerToken: (headers: HttpHeaders) => O.Option<string>;
82
84
  fromDynamicObject: (headers: DynamicObject) => HttpHeaders;
83
85
  toDynamicObject: (headers: HttpHeaders) => DynamicObject;
84
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Http.d.ts","sourceRoot":"","sources":["../../src/http/Http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,IAAI,EAAkB,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAgB3D,MAAM,MAAM,eAA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E,aAAa,KAAK,WAAW,CAAC;IAC3D,eAAe,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,aAAa,CAAC;CACzD;AAED,eAAO,MAAM,WAAW,EAAE,oBAyIzB,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACxD,mBAAmB,EACnB,eAAe,CAIf,CAAC;AAEF,eAAO,MAAM,eAAe,SACrB,eAAe,qCAEkC,CAAC"}
package/dist/http/Http.js CHANGED
@@ -15,26 +15,18 @@ 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
- 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
- })();
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
+ };
35
25
  Object.defineProperty(exports, "__esModule", { value: true });
36
26
  exports.isMultiPartBody = exports.serializationFormatToHttpContentType = exports.HttpHeaders = exports.HttpRequest = exports.HttpHeader = exports.HttpContentType = exports.HttpMethod = exports.MultipartHttpRequestBody = void 0;
37
- const effect_1 = require("effect");
27
+ const O = __importStar(require("fp-ts/lib/Option"));
28
+ const TE = __importStar(require("fp-ts/lib/TaskEither"));
29
+ const function_1 = require("fp-ts/lib/function");
38
30
  const stream_1 = require("stream");
39
31
  const _ = __importStar(require("lodash"));
40
32
  const File_1 = require("../file/File");
@@ -44,12 +36,12 @@ const getHeader = (headers, name) => {
44
36
  ...acc,
45
37
  [key.toLowerCase()]: headers[key],
46
38
  }), {});
47
- return effect_1.Option.fromNullable(lowerCasedHeaders[name.toLowerCase()]);
39
+ return O.fromNullable(lowerCasedHeaders[name.toLowerCase()]);
48
40
  };
49
41
  exports.MultipartHttpRequestBody = {
50
42
  create: (value, fileStorage) => {
51
43
  if (value === null || typeof value !== 'object') {
52
- return effect_1.Effect.fail(Error('Multipart body must be an object'));
44
+ return TE.left(Error('Multipart body must be an object'));
53
45
  }
54
46
  /**
55
47
  * Recursively traverses an object to find FileDescriptors at any nesting level.
@@ -100,7 +92,7 @@ exports.MultipartHttpRequestBody = {
100
92
  const fileDescriptorPaths = findFileDescriptors(value);
101
93
  // Extract fields, using dot notation for nested structures
102
94
  const fields = extractFields(value);
103
- return effect_1.Effect.map(effect_1.Effect.all(fileDescriptorPaths.map(({ path, descriptor }) => effect_1.Effect.map(fileStorage.read(descriptor.key), (file) => ({
95
+ return (0, function_1.pipe)(TE.sequenceArray(fileDescriptorPaths.map(({ path, descriptor }) => (0, function_1.pipe)(fileStorage.read(descriptor.key), TE.map((file) => ({
104
96
  // Use the object path (not the file key) as the form field name
105
97
  // This tells the server where to place the FileDescriptor in the reconstructed object
106
98
  key: path.join('.'),
@@ -115,13 +107,13 @@ exports.MultipartHttpRequestBody = {
115
107
  },
116
108
  },
117
109
  },
118
- })))), (files) => {
110
+ }))))), TE.map((files) => {
119
111
  const filesRecord = {};
120
112
  files.forEach(({ key, file }) => {
121
113
  filesRecord[key] = file;
122
114
  });
123
115
  return { fields, files: filesRecord };
124
- });
116
+ }));
125
117
  },
126
118
  };
127
119
  var HttpMethod;
@@ -159,18 +151,18 @@ exports.HttpRequest = {
159
151
  pathParams: {},
160
152
  queryString: {},
161
153
  body: stream_1.Readable.from(''),
162
- headerOptions: effect_1.Option.none(),
163
- agent: effect_1.Option.none(),
164
- clientIp: effect_1.Option.none(),
165
- timeout: effect_1.Option.none(),
154
+ headerOptions: O.none,
155
+ agent: O.none,
156
+ clientIp: O.none,
157
+ timeout: O.none,
166
158
  ...httpRequest,
167
159
  }),
168
160
  };
169
161
  exports.HttpHeaders = {
170
162
  get: (headers, name) => getHeader(headers, name),
171
- extractBearerToken: (headers) => effect_1.Option.flatMap(getHeader(headers, HttpHeader.Authorization), (header) => header.toLowerCase().startsWith('bearer ')
172
- ? effect_1.Option.some(header.substring(7))
173
- : effect_1.Option.none()),
163
+ extractBearerToken: (headers) => (0, function_1.pipe)(getHeader(headers, HttpHeader.Authorization), O.chain((header) => header.toLowerCase().startsWith('bearer ')
164
+ ? O.fromNullable(header.substring(7))
165
+ : O.fromNullable(null))),
174
166
  fromDynamicObject(headers) {
175
167
  const flattenObject = (obj, prefix = '') => Object.entries(obj).reduce((acc, [key, value]) => {
176
168
  const newKey = prefix ? `${prefix}.${key}` : key;
@@ -1,6 +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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const effect_1 = require("effect");
26
+ const O = __importStar(require("fp-ts/Option"));
4
27
  const Http_1 = require("./Http");
5
28
  describe('HttpHeaders', () => {
6
29
  it('should convert headers to DynamicObject', () => {
@@ -139,7 +162,7 @@ describe('HttpHeaders', () => {
139
162
  authorization: 'bearer 1234',
140
163
  };
141
164
  const result = Http_1.HttpHeaders.extractBearerToken(headers);
142
- expect(result).toEqual(effect_1.Option.some('1234'));
165
+ expect(result).toEqual(O.some('1234'));
143
166
  });
144
167
  it('should extract bearer token from headers when headers are capitalized', () => {
145
168
  const headers = {
@@ -148,6 +171,6 @@ describe('HttpHeaders', () => {
148
171
  Authorization: 'Bearer 1234',
149
172
  };
150
173
  const result = Http_1.HttpHeaders.extractBearerToken(headers);
151
- expect(result).toEqual(effect_1.Option.some('1234'));
174
+ expect(result).toEqual(O.some('1234'));
152
175
  });
153
176
  });
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.abstract.test.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.abstract.test.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,QAm0BpD"}
1
+ {"version":3,"file":"HttpClient.abstract.test.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.abstract.test.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,QAwwBpD"}