@trayio/commons 4.50.0 → 4.51.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.
@@ -22,11 +22,19 @@ export declare const MultipartHttpRequestBody: {
22
22
  create: (value: unknown, fileStorage: FileStorage) => TE.TaskEither<Error, MultipartHttpRequestBody>;
23
23
  };
24
24
  export type HttpRequestBody = RegularHttpRequestBody | MultipartHttpRequestBody;
25
+ export type HttpCertificate = {
26
+ cert: string;
27
+ key: string;
28
+ };
29
+ export type HttpAgent = {
30
+ certificate: O.Option<HttpCertificate>;
31
+ };
25
32
  export type HttpRequest = {
26
33
  headers: HttpHeaders;
27
34
  pathParams: Record<string, string>;
28
35
  queryString: HttpQueryString;
29
36
  body: HttpRequestBody;
37
+ agent: O.Option<HttpAgent>;
30
38
  };
31
39
  export type HttpResponse = {
32
40
  statusCode: number;
@@ -57,6 +65,10 @@ export declare enum HttpHeader {
57
65
  ContentLength = "Content-Length",
58
66
  ContentDisposition = "Content-Disposition"
59
67
  }
68
+ export interface HttpRequestInterface {
69
+ create: (httpRequest: Partial<HttpRequest>) => HttpRequest;
70
+ }
71
+ export declare const HttpRequest: HttpRequestInterface;
60
72
  export interface HttpHeadersInterface {
61
73
  get: (headers: HttpHeaders, name: string) => O.Option<HttpHeaderValue>;
62
74
  extractBearerToken: (headers: HttpHeaders) => O.Option<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"Http.d.ts","sourceRoot":"","sources":["../../src/http/Http.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG3C,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,M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C/D,iBAAiB,EAAE,CAAC,OAAO,EAAE,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
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isMultiPartBody = exports.serializationFormatToHttpContentType = exports.HttpHeaders = exports.HttpHeader = exports.HttpContentType = exports.HttpMethod = exports.MultipartHttpRequestBody = void 0;
26
+ exports.isMultiPartBody = exports.serializationFormatToHttpContentType = exports.HttpHeaders = exports.HttpRequest = exports.HttpHeader = exports.HttpContentType = exports.HttpMethod = exports.MultipartHttpRequestBody = void 0;
27
27
  const O = __importStar(require("fp-ts/lib/Option"));
28
28
  const TE = __importStar(require("fp-ts/lib/TaskEither"));
29
29
  const function_1 = require("fp-ts/lib/function");
30
+ const stream_1 = require("stream");
30
31
  const _ = __importStar(require("lodash"));
31
32
  const File_1 = require("../file/File");
32
33
  const Serialization_1 = require("../serialization/Serialization");
@@ -91,6 +92,16 @@ var HttpHeader;
91
92
  HttpHeader["ContentLength"] = "Content-Length";
92
93
  HttpHeader["ContentDisposition"] = "Content-Disposition";
93
94
  })(HttpHeader || (exports.HttpHeader = HttpHeader = {}));
95
+ exports.HttpRequest = {
96
+ create: (httpRequest) => ({
97
+ headers: {},
98
+ pathParams: {},
99
+ queryString: {},
100
+ body: stream_1.Readable.from(''),
101
+ agent: O.none,
102
+ ...httpRequest,
103
+ }),
104
+ };
94
105
  exports.HttpHeaders = {
95
106
  get: (headers, name) => getHeader(headers, name),
96
107
  extractBearerToken: (headers) => (0, function_1.pipe)(getHeader(headers, HttpHeader.Authorization), O.chain((header) => header.toLowerCase().startsWith('bearer ')
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.abstract.test.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.abstract.test.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,QAkmBpD"}
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,QA2sBpD"}
@@ -28,11 +28,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.httpClientTest = void 0;
30
30
  const E = __importStar(require("fp-ts/Either"));
31
+ const O = __importStar(require("fp-ts/Option"));
31
32
  const stream_1 = require("stream");
33
+ const selfsigned_1 = __importDefault(require("selfsigned"));
32
34
  const function_1 = require("fp-ts/function");
33
35
  const t = __importStar(require("io-ts"));
34
36
  const td = __importStar(require("io-ts-types"));
35
37
  const http_1 = require("http");
38
+ const https_1 = require("https");
36
39
  const util_1 = require("util");
37
40
  const TE = __importStar(require("fp-ts/TaskEither"));
38
41
  const formidable_1 = __importDefault(require("formidable"));
@@ -201,12 +204,28 @@ function httpClientTest(httpClient) {
201
204
  };
202
205
  const host = 'localhost';
203
206
  const port = 8000; // TODO: Get random port
207
+ const httpsPort = 9001;
204
208
  const baseUrl = `http://${host}:${port}`;
209
+ const httpsServerUrl = `https://${host}:${httpsPort}`;
210
+ // Generate self-signed certificates for Https server, override type as it didn't include client certs
211
+ const certs = selfsigned_1.default.generate([], {
212
+ clientCertificate: true,
213
+ clientCertificateCN: 'client',
214
+ extensions: [{ name: 'basicConstraints', cA: true }],
215
+ });
205
216
  const server = (0, http_1.createServer)(requestListener);
217
+ const httpsServer = (0, https_1.createServer)({
218
+ key: certs.private,
219
+ cert: certs.cert,
220
+ requestCert: true,
221
+ rejectUnauthorized: true,
222
+ ca: [certs.clientcert],
223
+ }, requestListener);
206
224
  describe('HttpClient Test', () => {
207
225
  beforeAll(async () => {
208
226
  await new Promise((resolve) => {
209
227
  server.listen(port, host, resolve);
228
+ httpsServer.listen(httpsPort, host);
210
229
  });
211
230
  });
212
231
  afterAll(async () => {
@@ -220,14 +239,45 @@ function httpClientTest(httpClient) {
220
239
  }
221
240
  });
222
241
  });
242
+ await new Promise((resolve, reject) => {
243
+ httpsServer.close((error) => {
244
+ if (error) {
245
+ reject(error);
246
+ }
247
+ else {
248
+ resolve();
249
+ }
250
+ });
251
+ });
223
252
  });
224
253
  test('should send a GET request', async () => {
225
- const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, {
254
+ const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, Http_1.HttpRequest.create({
226
255
  headers: { 'x-custom-header': 'customVal' },
227
256
  pathParams: {},
228
257
  queryString: {},
229
258
  body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(new ArrayBuffer(0)),
230
- })();
259
+ }))();
260
+ const testValue = {
261
+ strField: 'customVal',
262
+ intField: 123,
263
+ };
264
+ const result = (0, function_1.pipe)(response, TE.fromEither, TE.chain((httpResponse) => BufferExtensions_1.BufferExtensions.readableToArrayBuffer(httpResponse.body)), TE.match((error) => E.left(error), (buffer) => (0, function_1.pipe)(serialization.deserialize(buffer), E.chain((encoded) => testResponseCodec.decode(encoded)))));
265
+ const resultE = await result();
266
+ expect(resultE).toStrictEqual(E.right(testValue));
267
+ });
268
+ test('should send a GET request with a certificate', async () => {
269
+ const response = await httpClient.execute(Http_1.HttpMethod.Get, httpsServerUrl, Http_1.HttpRequest.create({
270
+ headers: { 'x-custom-header': 'customVal' },
271
+ pathParams: {},
272
+ queryString: {},
273
+ body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(new ArrayBuffer(0)),
274
+ agent: O.some({
275
+ certificate: O.some({
276
+ key: certs.clientprivate,
277
+ cert: certs.clientcert,
278
+ }),
279
+ }),
280
+ }))();
231
281
  const testValue = {
232
282
  strField: 'customVal',
233
283
  intField: 123,
@@ -240,7 +290,7 @@ function httpClientTest(httpClient) {
240
290
  const testInput = {
241
291
  inputField: 321,
242
292
  };
243
- const response = await (0, function_1.pipe)((0, Task_1.createTaskEitherFromEither)(E.right(testInputCodec.encode(testInput))), TE.map((encoded) => serialization.serialize(encoded)), TE.chain((serializedInput) => httpClient.execute(Http_1.HttpMethod.Post, baseUrl, {
293
+ const response = await (0, function_1.pipe)((0, Task_1.createTaskEitherFromEither)(E.right(testInputCodec.encode(testInput))), TE.map((encoded) => serialization.serialize(encoded)), TE.chain((serializedInput) => httpClient.execute(Http_1.HttpMethod.Post, baseUrl, Http_1.HttpRequest.create({
244
294
  headers: {
245
295
  'x-custom-header': 'customVal',
246
296
  [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.Json,
@@ -248,7 +298,7 @@ function httpClientTest(httpClient) {
248
298
  pathParams: {},
249
299
  queryString: {},
250
300
  body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(serializedInput),
251
- })))();
301
+ }))))();
252
302
  const testValue = {
253
303
  strField: 'customVal',
254
304
  intField: 321,
@@ -298,7 +348,7 @@ function httpClientTest(httpClient) {
298
348
  },
299
349
  },
300
350
  };
301
- const response = await httpClient.execute(Http_1.HttpMethod.Post, baseUrl, {
351
+ const response = await httpClient.execute(Http_1.HttpMethod.Post, baseUrl, Http_1.HttpRequest.create({
302
352
  headers: {
303
353
  'x-custom-header': 'customVal',
304
354
  'content-type': Http_1.HttpContentType.MultipartRequestBody,
@@ -306,7 +356,7 @@ function httpClientTest(httpClient) {
306
356
  pathParams: {},
307
357
  queryString: {},
308
358
  body: testInput,
309
- })();
359
+ }))();
310
360
  const result = (0, function_1.pipe)(response, TE.fromEither, TE.chain((httpResponse) => BufferExtensions_1.BufferExtensions.readableToArrayBuffer(httpResponse.body)), TE.match((error) => E.left(error), (buffer) => (0, function_1.pipe)(serialization.deserialize(buffer), E.chain((encoded) => testMultiPartBodyTypeCodec.decode(encoded)))));
311
361
  const resultE = await result();
312
362
  expect(resultE).toEqual(E.right(expect.objectContaining({
@@ -330,14 +380,14 @@ function httpClientTest(httpClient) {
330
380
  })));
331
381
  });
332
382
  test('should send a POST request with a formUrlEncoded body', async () => {
333
- const response = await (0, function_1.pipe)((0, Task_1.createTaskEitherFromEither)(E.right(testInputFormUrlEncodedCodec.encode(testInputFormUrlEncoded))), TE.map((encoded) => formUrlEncodedSerialization.serialize(encoded)), TE.chain((serializedInput) => httpClient.execute(Http_1.HttpMethod.Post, baseUrl, {
383
+ const response = await (0, function_1.pipe)((0, Task_1.createTaskEitherFromEither)(E.right(testInputFormUrlEncodedCodec.encode(testInputFormUrlEncoded))), TE.map((encoded) => formUrlEncodedSerialization.serialize(encoded)), TE.chain((serializedInput) => httpClient.execute(Http_1.HttpMethod.Post, baseUrl, Http_1.HttpRequest.create({
334
384
  headers: {
335
385
  [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.FormUrlEncoded,
336
386
  },
337
387
  pathParams: {},
338
388
  queryString: {},
339
389
  body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(serializedInput),
340
- })))();
390
+ }))))();
341
391
  const testValue = {
342
392
  strField: 'customVal',
343
393
  intField: 1,
@@ -347,12 +397,12 @@ function httpClientTest(httpClient) {
347
397
  expect(resultE).toStrictEqual(E.right(testValue));
348
398
  });
349
399
  test('should parse an internal error response', async () => {
350
- const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, {
400
+ const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, Http_1.HttpRequest.create({
351
401
  headers: { error: '500' },
352
402
  pathParams: {},
353
403
  queryString: {},
354
404
  body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(new ArrayBuffer(0)),
355
- })();
405
+ }))();
356
406
  const testErrorResponse = {
357
407
  message: 'some error message 500',
358
408
  };
@@ -364,12 +414,12 @@ function httpClientTest(httpClient) {
364
414
  expect(responseBodyE).toStrictEqual(E.right(serialization.serialize(testErrorResponseCodec.encode(testErrorResponse))));
365
415
  });
366
416
  test('should parse a not found error response', async () => {
367
- const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, {
417
+ const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, Http_1.HttpRequest.create({
368
418
  headers: { error: '404' },
369
419
  pathParams: {},
370
420
  queryString: {},
371
421
  body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(new ArrayBuffer(0)),
372
- })();
422
+ }))();
373
423
  const testErrorResponse = {
374
424
  message: 'some error message 404',
375
425
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/commons",
3
- "version": "4.50.0",
3
+ "version": "4.51.0",
4
4
  "description": "Extensions to the standard/core libraries and basic features",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"