@trayio/commons 4.48.0 → 4.49.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.
@@ -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,MAAM,4BAA4B,CAAC;AAgB3D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAEhD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAAC,CAAC;AAE5E,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAC7B,0BAA0B,GAC1B,0BAA0B,EAAE,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEnE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE9C,MAAM,MAAM,wBAAwB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,iCAAiC;IACjD,MAAM,EAAE,CACP,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,WAAW,KACpB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;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AE,WAAW,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/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
@@ -208,6 +208,7 @@ exports.HttpHeaders = {
208
208
  };
209
209
  exports.serializationFormatToHttpContentType = {
210
210
  [Serialization_1.SerializationFormat.Json]: HttpContentType.Json,
211
+ [Serialization_1.SerializationFormat.FormUrlEncoded]: HttpContentType.FormUrlEncoded,
211
212
  };
212
213
  const isMultiPartBody = (body) => body?.files !== undefined;
213
214
  exports.isMultiPartBody = isMultiPartBody;
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.abstract.test.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.abstract.test.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,QAogBpD"}
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"}
@@ -31,6 +31,7 @@ const E = __importStar(require("fp-ts/Either"));
31
31
  const stream_1 = require("stream");
32
32
  const function_1 = require("fp-ts/function");
33
33
  const t = __importStar(require("io-ts"));
34
+ const td = __importStar(require("io-ts-types"));
34
35
  const http_1 = require("http");
35
36
  const util_1 = require("util");
36
37
  const TE = __importStar(require("fp-ts/TaskEither"));
@@ -42,8 +43,10 @@ const Http_1 = require("./Http");
42
43
  const File_1 = require("../file/File");
43
44
  const NodeFsFileStorage_1 = require("../file/NodeFsFileStorage");
44
45
  const BufferExtensions_1 = require("../buffer/BufferExtensions");
46
+ const FormUrlEncodedSerialization_1 = require("../serialization/FormUrlEncodedSerialization");
45
47
  function httpClientTest(httpClient) {
46
48
  const serialization = new JsonSerialization_1.JsonSerialization();
49
+ const formUrlEncodedSerialization = new FormUrlEncodedSerialization_1.FormUrlEncodedSerialization();
47
50
  const fileStorage = new NodeFsFileStorage_1.NodeFsFileStorage();
48
51
  const testErrorResponseCodec = TypeCodec_1.TypeCodec.fromDescriptor(t.type({
49
52
  message: t.string,
@@ -52,6 +55,20 @@ function httpClientTest(httpClient) {
52
55
  strField: t.string,
53
56
  intField: t.number,
54
57
  }));
58
+ const testInputFormUrlEncoded = {
59
+ x: 1,
60
+ arr: [1, 2, 3],
61
+ arr2: [1, [2], 3],
62
+ users: [{ username: 'tray' }],
63
+ };
64
+ const testInputFormUrlEncodedCodec = TypeCodec_1.TypeCodec.fromDescriptor(t.type({
65
+ x: td.NumberFromString,
66
+ arr: t.array(td.NumberFromString),
67
+ arr2: t.array(t.union([td.NumberFromString, t.array(td.NumberFromString)])),
68
+ users: t.array(t.type({
69
+ username: t.string,
70
+ })),
71
+ }));
55
72
  const ReadableCodec = new t.Type('Readable', (input) => input instanceof stream_1.Readable, (input, ctx) => input instanceof stream_1.Readable ? t.success(input) : t.failure(input, ctx), (input) => input);
56
73
  const testMultiPartBodyTypeCodec = TypeCodec_1.TypeCodec.fromDescriptor(t.type({
57
74
  fields: t.record(t.string, t.string),
@@ -92,7 +109,10 @@ function httpClientTest(httpClient) {
92
109
  });
93
110
  httpRequest.on('end', () => {
94
111
  const buffer = Buffer.concat(body);
95
- const response = (0, function_1.pipe)(serialization.deserialize(buffer), E.chain((encodedRequest) => requestCodec.decode(encodedRequest)), E.map(process), E.map((result) => responseCodec.encode(result)), E.map((encodedResult) => serialization.serialize(encodedResult)), E.getOrElse(() => (new util_1.TextEncoder().encode('Error serializing value').buffer)));
112
+ const requestSerializer = httpRequest.headers['content-type'] === Http_1.HttpContentType.FormUrlEncoded
113
+ ? formUrlEncodedSerialization
114
+ : serialization;
115
+ const response = (0, function_1.pipe)(requestSerializer.deserialize(buffer), E.chain((encodedRequest) => requestCodec.decode(encodedRequest)), E.map(process), E.map((result) => responseCodec.encode(result)), E.map((encodedResult) => serialization.serialize(encodedResult)), E.getOrElse((error) => new util_1.TextEncoder().encode(error.message).buffer));
96
116
  httpResponse.end(Buffer.from(response));
97
117
  });
98
118
  }
@@ -162,6 +182,14 @@ function httpClientTest(httpClient) {
162
182
  res.writeHead(200, { [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.Json });
163
183
  await processHttpRequest(testMultiPartBodyTypeCodec, testMultiPartBodyTypeCodec, req, res, (input) => input, true);
164
184
  }
185
+ else if (req.method === 'POST' &&
186
+ req.headers['content-type'] === Http_1.HttpContentType.FormUrlEncoded) {
187
+ res.writeHead(200, { [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.Json });
188
+ await processHttpRequest(testInputFormUrlEncodedCodec, testResponseCodec, req, res, (input) => ({
189
+ strField: 'customVal',
190
+ intField: input.arr2[0],
191
+ }));
192
+ }
165
193
  else {
166
194
  const customHeader = req.headers['x-custom-header'];
167
195
  res.writeHead(200, { [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.Json });
@@ -215,6 +243,7 @@ function httpClientTest(httpClient) {
215
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, {
216
244
  headers: {
217
245
  'x-custom-header': 'customVal',
246
+ [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.Json,
218
247
  },
219
248
  pathParams: {},
220
249
  queryString: {},
@@ -300,6 +329,23 @@ function httpClientTest(httpClient) {
300
329
  }),
301
330
  })));
302
331
  });
332
+ 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, {
334
+ headers: {
335
+ [Http_1.HttpHeader.ContentType]: Http_1.HttpContentType.FormUrlEncoded,
336
+ },
337
+ pathParams: {},
338
+ queryString: {},
339
+ body: BufferExtensions_1.BufferExtensions.arrayBufferToReadable(serializedInput),
340
+ })))();
341
+ const testValue = {
342
+ strField: 'customVal',
343
+ intField: 1,
344
+ };
345
+ 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)))));
346
+ const resultE = await result();
347
+ expect(resultE).toStrictEqual(E.right(testValue));
348
+ });
303
349
  test('should parse an internal error response', async () => {
304
350
  const response = await httpClient.execute(Http_1.HttpMethod.Get, baseUrl, {
305
351
  headers: { error: '500' },
@@ -0,0 +1,10 @@
1
+ import * as E from 'fp-ts/Either';
2
+ import { Serialization, SerializationFormat } from './Serialization';
3
+ export declare class FormUrlEncodedSerialization implements Serialization {
4
+ private textEncoder;
5
+ private textDecoder;
6
+ format: SerializationFormat;
7
+ serialize(value: unknown): ArrayBuffer;
8
+ deserialize(value: ArrayBuffer): E.Either<Error, unknown>;
9
+ }
10
+ //# sourceMappingURL=FormUrlEncodedSerialization.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,51 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.FormUrlEncodedSerialization = void 0;
30
+ const E = __importStar(require("fp-ts/Either"));
31
+ const util_1 = require("util");
32
+ const function_1 = require("fp-ts/function");
33
+ const qs_1 = __importDefault(require("qs"));
34
+ const Serialization_1 = require("./Serialization");
35
+ const Try_1 = require("../try/Try");
36
+ class FormUrlEncodedSerialization {
37
+ textEncoder = new util_1.TextEncoder();
38
+ textDecoder = new util_1.TextDecoder();
39
+ format = Serialization_1.SerializationFormat.FormUrlEncoded;
40
+ serialize(value) {
41
+ const formEncoded = qs_1.default.stringify(value);
42
+ return this.textEncoder.encode(formEncoded).buffer;
43
+ }
44
+ deserialize(value) {
45
+ if (value.byteLength === 0) {
46
+ return E.right(undefined);
47
+ }
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))));
49
+ }
50
+ }
51
+ exports.FormUrlEncodedSerialization = FormUrlEncodedSerialization;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FormUrlEncodedSerialization.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormUrlEncodedSerialization.unit.test.d.ts","sourceRoot":"","sources":["../../src/serialization/FormUrlEncodedSerialization.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Serialization_abstract_test_1 = require("./Serialization.abstract.test");
4
+ const FormUrlEncodedSerialization_1 = require("./FormUrlEncodedSerialization");
5
+ describe('FormUrlEncoded', () => {
6
+ (0, Serialization_abstract_test_1.testSerialization)(new FormUrlEncodedSerialization_1.FormUrlEncodedSerialization());
7
+ });
@@ -32,7 +32,7 @@ function testSerialization(serialization) {
32
32
  test('should serialize and deserialize a value', () => {
33
33
  const testValue = {
34
34
  strField: 'str',
35
- intField: O.some(123),
35
+ intStrField: O.some('123'),
36
36
  };
37
37
  const result = (0, function_1.pipe)(E.right(serialization.serialize(testValue)), E.chain((serialized) => serialization.deserialize(serialized)));
38
38
  expect(result).toStrictEqual(E.right(testValue));
@@ -44,8 +44,8 @@ function testSerialization(serialization) {
44
44
  expect(result).toStrictEqual(expected);
45
45
  });
46
46
  test('should deserialize undefined', () => {
47
- const undefinedSerialised = new ArrayBuffer(0);
48
- const result = serialization.deserialize(undefinedSerialised);
47
+ const undefinedSerialized = new ArrayBuffer(0);
48
+ const result = serialization.deserialize(undefinedSerialized);
49
49
  const expected = E.right(undefined);
50
50
  expect(result).toStrictEqual(expected);
51
51
  });
@@ -1,6 +1,7 @@
1
1
  import * as E from 'fp-ts/Either';
2
2
  export declare enum SerializationFormat {
3
- Json = "Json"
3
+ Json = "Json",
4
+ FormUrlEncoded = "FormUrlEncoded"
4
5
  }
5
6
  export interface Serialization {
6
7
  format: SerializationFormat;
@@ -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;CACb;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,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"}
@@ -4,4 +4,5 @@ exports.SerializationFormat = void 0;
4
4
  var SerializationFormat;
5
5
  (function (SerializationFormat) {
6
6
  SerializationFormat["Json"] = "Json";
7
+ SerializationFormat["FormUrlEncoded"] = "FormUrlEncoded";
7
8
  })(SerializationFormat || (exports.SerializationFormat = SerializationFormat = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/commons",
3
- "version": "4.48.0",
3
+ "version": "4.49.0",
4
4
  "description": "Extensions to the standard/core libraries and basic features",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"