@scopieflows/apps-common 0.12.3

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 (81) hide show
  1. package/package.json +19 -0
  2. package/src/index.d.ts +6 -0
  3. package/src/index.d.ts.map +1 -0
  4. package/src/index.js +9 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/authentication/index.d.ts +16 -0
  7. package/src/lib/authentication/index.d.ts.map +1 -0
  8. package/src/lib/authentication/index.js +9 -0
  9. package/src/lib/authentication/index.js.map +1 -0
  10. package/src/lib/helpers/index.d.ts +37 -0
  11. package/src/lib/helpers/index.d.ts.map +1 -0
  12. package/src/lib/helpers/index.js +268 -0
  13. package/src/lib/helpers/index.js.map +1 -0
  14. package/src/lib/http/axios/axios-http-client.d.ts +13 -0
  15. package/src/lib/http/axios/axios-http-client.d.ts.map +1 -0
  16. package/src/lib/http/axios/axios-http-client.js +96 -0
  17. package/src/lib/http/axios/axios-http-client.js.map +1 -0
  18. package/src/lib/http/core/base-http-client.d.ts +20 -0
  19. package/src/lib/http/core/base-http-client.d.ts.map +1 -0
  20. package/src/lib/http/core/base-http-client.js +52 -0
  21. package/src/lib/http/core/base-http-client.js.map +1 -0
  22. package/src/lib/http/core/delegating-authentication-converter.d.ts +18 -0
  23. package/src/lib/http/core/delegating-authentication-converter.d.ts.map +1 -0
  24. package/src/lib/http/core/delegating-authentication-converter.js +33 -0
  25. package/src/lib/http/core/delegating-authentication-converter.js.map +1 -0
  26. package/src/lib/http/core/http-client.d.ts +10 -0
  27. package/src/lib/http/core/http-client.d.ts.map +1 -0
  28. package/src/lib/http/core/http-client.js +6 -0
  29. package/src/lib/http/core/http-client.js.map +1 -0
  30. package/src/lib/http/core/http-error.d.ts +24 -0
  31. package/src/lib/http/core/http-error.d.ts.map +1 -0
  32. package/src/lib/http/core/http-error.js +46 -0
  33. package/src/lib/http/core/http-error.js.map +1 -0
  34. package/src/lib/http/core/http-header.d.ts +7 -0
  35. package/src/lib/http/core/http-header.d.ts.map +1 -0
  36. package/src/lib/http/core/http-header.js +11 -0
  37. package/src/lib/http/core/http-header.js.map +1 -0
  38. package/src/lib/http/core/http-headers.d.ts +2 -0
  39. package/src/lib/http/core/http-headers.d.ts.map +1 -0
  40. package/src/lib/http/core/http-headers.js +3 -0
  41. package/src/lib/http/core/http-headers.js.map +1 -0
  42. package/src/lib/http/core/http-message-body.d.ts +2 -0
  43. package/src/lib/http/core/http-message-body.d.ts.map +1 -0
  44. package/src/lib/http/core/http-message-body.js +3 -0
  45. package/src/lib/http/core/http-message-body.js.map +1 -0
  46. package/src/lib/http/core/http-method.d.ts +9 -0
  47. package/src/lib/http/core/http-method.d.ts.map +1 -0
  48. package/src/lib/http/core/http-method.js +13 -0
  49. package/src/lib/http/core/http-method.js.map +1 -0
  50. package/src/lib/http/core/http-request-body.d.ts +3 -0
  51. package/src/lib/http/core/http-request-body.d.ts.map +1 -0
  52. package/src/lib/http/core/http-request-body.js +3 -0
  53. package/src/lib/http/core/http-request-body.js.map +1 -0
  54. package/src/lib/http/core/http-request.d.ts +18 -0
  55. package/src/lib/http/core/http-request.d.ts.map +1 -0
  56. package/src/lib/http/core/http-request.js +3 -0
  57. package/src/lib/http/core/http-request.js.map +1 -0
  58. package/src/lib/http/core/http-response.d.ts +8 -0
  59. package/src/lib/http/core/http-response.d.ts.map +1 -0
  60. package/src/lib/http/core/http-response.js +3 -0
  61. package/src/lib/http/core/http-response.js.map +1 -0
  62. package/src/lib/http/core/media-type.d.ts +5 -0
  63. package/src/lib/http/core/media-type.d.ts.map +1 -0
  64. package/src/lib/http/core/media-type.js +9 -0
  65. package/src/lib/http/core/media-type.js.map +1 -0
  66. package/src/lib/http/core/query-params.d.ts +2 -0
  67. package/src/lib/http/core/query-params.d.ts.map +1 -0
  68. package/src/lib/http/core/query-params.js +3 -0
  69. package/src/lib/http/core/query-params.js.map +1 -0
  70. package/src/lib/http/index.d.ts +14 -0
  71. package/src/lib/http/index.d.ts.map +1 -0
  72. package/src/lib/http/index.js +17 -0
  73. package/src/lib/http/index.js.map +1 -0
  74. package/src/lib/polling/index.d.ts +58 -0
  75. package/src/lib/polling/index.d.ts.map +1 -0
  76. package/src/lib/polling/index.js +136 -0
  77. package/src/lib/polling/index.js.map +1 -0
  78. package/src/lib/validation/index.d.ts +5 -0
  79. package/src/lib/validation/index.d.ts.map +1 -0
  80. package/src/lib/validation/index.js +26 -0
  81. package/src/lib/validation/index.js.map +1 -0
@@ -0,0 +1,18 @@
1
+ import type { HttpHeaders } from './http-headers';
2
+ import { Authentication, BasicAuthentication, BearerTokenAuthentication } from '../../authentication';
3
+ export declare class DelegatingAuthenticationConverter implements AuthenticationConverter<Authentication> {
4
+ private readonly converters;
5
+ constructor(bearerTokenConverter?: BearerTokenAuthenticationConverter, basicTokenConverter?: BasicTokenAuthenticationConverter);
6
+ convert(authentication: Authentication, headers: HttpHeaders): HttpHeaders;
7
+ }
8
+ declare class BearerTokenAuthenticationConverter implements AuthenticationConverter<BearerTokenAuthentication> {
9
+ convert(authentication: BearerTokenAuthentication, headers: HttpHeaders): HttpHeaders;
10
+ }
11
+ declare class BasicTokenAuthenticationConverter implements AuthenticationConverter<BasicAuthentication> {
12
+ convert(authentication: BasicAuthentication, headers: HttpHeaders): HttpHeaders;
13
+ }
14
+ type AuthenticationConverter<T extends Authentication> = {
15
+ convert: (authentication: T, headers: HttpHeaders) => HttpHeaders;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=delegating-authentication-converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegating-authentication-converter.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/delegating-authentication-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,cAAc,EAEd,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,iCACX,YAAW,uBAAuB,CAAC,cAAc,CAAC;IAElD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGzB;gBAGA,oBAAoB,qCAA2C,EAC/D,mBAAmB,oCAA0C;IAQ/D,OAAO,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW;CAI3E;AAED,cAAM,kCACJ,YAAW,uBAAuB,CAAC,yBAAyB,CAAC;IAE7D,OAAO,CACL,cAAc,EAAE,yBAAyB,EACzC,OAAO,EAAE,WAAW,GACnB,WAAW;CAIf;AAED,cAAM,iCACJ,YAAW,uBAAuB,CAAC,mBAAmB,CAAC;IAEvD,OAAO,CACL,cAAc,EAAE,mBAAmB,EACnC,OAAO,EAAE,WAAW,GACnB,WAAW;CAMf;AAED,KAAK,uBAAuB,CAAC,CAAC,SAAS,cAAc,IAAI;IACvD,OAAO,EAAE,CAAC,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,KAAK,WAAW,CAAC;CACnE,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DelegatingAuthenticationConverter = void 0;
4
+ const http_header_1 = require("./http-header");
5
+ const authentication_1 = require("../../authentication");
6
+ class DelegatingAuthenticationConverter {
7
+ constructor(bearerTokenConverter = new BearerTokenAuthenticationConverter(), basicTokenConverter = new BasicTokenAuthenticationConverter()) {
8
+ this.converters = {
9
+ [authentication_1.AuthenticationType.BEARER_TOKEN]: bearerTokenConverter,
10
+ [authentication_1.AuthenticationType.BASIC]: basicTokenConverter,
11
+ };
12
+ }
13
+ convert(authentication, headers) {
14
+ const converter = this.converters[authentication.type];
15
+ return converter.convert(authentication, headers);
16
+ }
17
+ }
18
+ exports.DelegatingAuthenticationConverter = DelegatingAuthenticationConverter;
19
+ class BearerTokenAuthenticationConverter {
20
+ convert(authentication, headers) {
21
+ headers[http_header_1.HttpHeader.AUTHORIZATION] = `Bearer ${authentication.token}`;
22
+ return headers;
23
+ }
24
+ }
25
+ class BasicTokenAuthenticationConverter {
26
+ convert(authentication, headers) {
27
+ const credentials = `${authentication.username}:${authentication.password}`;
28
+ const encoded = Buffer.from(credentials).toString('base64');
29
+ headers[http_header_1.HttpHeader.AUTHORIZATION] = `Basic ${encoded}`;
30
+ return headers;
31
+ }
32
+ }
33
+ //# sourceMappingURL=delegating-authentication-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegating-authentication-converter.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/delegating-authentication-converter.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,yDAK8B;AAE9B,MAAa,iCAAiC;IAQ5C,YACE,oBAAoB,GAAG,IAAI,kCAAkC,EAAE,EAC/D,mBAAmB,GAAG,IAAI,iCAAiC,EAAE;QAE7D,IAAI,CAAC,UAAU,GAAG;YAChB,CAAC,mCAAkB,CAAC,YAAY,CAAC,EAAE,oBAAoB;YACvD,CAAC,mCAAkB,CAAC,KAAK,CAAC,EAAE,mBAAmB;SAChD,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,cAA8B,EAAE,OAAoB;QAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAtBD,8EAsBC;AAED,MAAM,kCAAkC;IAGtC,OAAO,CACL,cAAyC,EACzC,OAAoB;QAEpB,OAAO,CAAC,wBAAU,CAAC,aAAa,CAAC,GAAG,UAAU,cAAc,CAAC,KAAK,EAAE,CAAC;QACrE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,MAAM,iCAAiC;IAGrC,OAAO,CACL,cAAmC,EACnC,OAAoB;QAEpB,MAAM,WAAW,GAAG,GAAG,cAAc,CAAC,QAAQ,IAAI,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO,CAAC,wBAAU,CAAC,aAAa,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC;QACvD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { AxiosHttpClient } from '../axios/axios-http-client';
2
+ import type { HttpMessageBody } from './http-message-body';
3
+ import type { HttpRequest } from './http-request';
4
+ import { HttpRequestBody } from './http-request-body';
5
+ import { HttpResponse } from './http-response';
6
+ export type HttpClient = {
7
+ sendRequest<RequestBody extends HttpRequestBody, ResponseBody extends HttpMessageBody>(request: HttpRequest<RequestBody>): Promise<HttpResponse<ResponseBody>>;
8
+ };
9
+ export declare const httpClient: AxiosHttpClient;
10
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,CACT,WAAW,SAAS,eAAe,EACnC,YAAY,SAAS,eAAe,EAEpC,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,GAChC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,UAAU,iBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.httpClient = void 0;
4
+ const axios_http_client_1 = require("../axios/axios-http-client");
5
+ exports.httpClient = new axios_http_client_1.AxiosHttpClient();
6
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-client.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAehD,QAAA,UAAU,GAAG,IAAI,mCAAe,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { AxiosError } from 'axios';
2
+ export declare class HttpError extends Error {
3
+ private readonly requestBody;
4
+ private readonly status;
5
+ private readonly responseBody;
6
+ constructor(requestBody: unknown, err: AxiosError);
7
+ errorMessage(): {
8
+ response: {
9
+ status: number;
10
+ body: unknown;
11
+ };
12
+ request: {
13
+ body: unknown;
14
+ };
15
+ };
16
+ get response(): {
17
+ status: number;
18
+ body: unknown;
19
+ };
20
+ get request(): {
21
+ body: unknown;
22
+ };
23
+ }
24
+ //# sourceMappingURL=http-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,qBAAa,SAAU,SAAQ,KAAK;IAItB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAHxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;gBAEV,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU;IAoB3D,YAAY;;;;;;;;;IAYnB,IAAI,QAAQ;;;MAKX;IAED,IAAI,OAAO;;MAIV;CACF"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpError = void 0;
4
+ class HttpError extends Error {
5
+ constructor(requestBody, err) {
6
+ var _a, _b, _c, _d;
7
+ const status = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status) || 500;
8
+ const responseBody = Buffer.isBuffer((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data) ? (_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.data.toString() : (_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.data;
9
+ super(JSON.stringify({
10
+ response: {
11
+ status: status,
12
+ body: responseBody,
13
+ },
14
+ request: {
15
+ body: requestBody,
16
+ },
17
+ }));
18
+ this.requestBody = requestBody;
19
+ this.status = status;
20
+ this.responseBody = responseBody;
21
+ }
22
+ errorMessage() {
23
+ return {
24
+ response: {
25
+ status: this.status,
26
+ body: this.responseBody,
27
+ },
28
+ request: {
29
+ body: this.requestBody,
30
+ },
31
+ };
32
+ }
33
+ get response() {
34
+ return {
35
+ status: this.status,
36
+ body: this.responseBody,
37
+ };
38
+ }
39
+ get request() {
40
+ return {
41
+ body: this.requestBody,
42
+ };
43
+ }
44
+ }
45
+ exports.HttpError = HttpError;
46
+ //# sourceMappingURL=http-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-error.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAU,SAAQ,KAAK;IAIlC,YAA6B,WAAoB,EAAE,GAAe;;QAChE,MAAM,MAAM,GAAG,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,KAAI,GAAG,CAAC;QAC5C,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,IAAI,CAAC;QAEjH,KAAK,CACH,IAAI,CAAC,SAAS,CAAC;YACb,QAAQ,EAAE;gBACR,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,YAAY;aACnB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;aAClB;SACF,CAAC,CACH,CAAC;QAdyB,gBAAW,GAAX,WAAW,CAAS;QAgB/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,YAAY;QACjB,OAAO;YACL,QAAQ,EAAE;gBACR,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,YAAY;aACxB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,IAAI,CAAC,WAAW;aACvB;SACF,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ;QACV,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,YAAY;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,OAAO;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,WAAW;SACvB,CAAC;IACJ,CAAC;CACF;AAhDD,8BAgDC"}
@@ -0,0 +1,7 @@
1
+ export declare enum HttpHeader {
2
+ AUTHORIZATION = "Authorization",
3
+ ACCEPT = "Accept",
4
+ API_KEY = "x-api-key",
5
+ CONTENT_TYPE = "Content-Type"
6
+ }
7
+ //# sourceMappingURL=http-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-header.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-header.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,OAAO,cAAc;IACrB,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpHeader = void 0;
4
+ var HttpHeader;
5
+ (function (HttpHeader) {
6
+ HttpHeader["AUTHORIZATION"] = "Authorization";
7
+ HttpHeader["ACCEPT"] = "Accept";
8
+ HttpHeader["API_KEY"] = "x-api-key";
9
+ HttpHeader["CONTENT_TYPE"] = "Content-Type";
10
+ })(HttpHeader || (exports.HttpHeader = HttpHeader = {}));
11
+ //# sourceMappingURL=http-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-header.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-header.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,6CAA+B,CAAA;IAC/B,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;IACrB,2CAA6B,CAAA;AAC/B,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB"}
@@ -0,0 +1,2 @@
1
+ export type HttpHeaders = Record<string, string | string[] | undefined>;
2
+ //# sourceMappingURL=http-headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-headers.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-headers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-headers.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-headers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type HttpMessageBody = any;
2
+ //# sourceMappingURL=http-message-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-message-body.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-message-body.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAI,GAAG,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-message-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-message-body.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-message-body.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare enum HttpMethod {
2
+ GET = "GET",
3
+ POST = "POST",
4
+ PATCH = "PATCH",
5
+ PUT = "PUT",
6
+ DELETE = "DELETE",
7
+ HEAD = "HEAD"
8
+ }
9
+ //# sourceMappingURL=http-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-method.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-method.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpMethod = void 0;
4
+ var HttpMethod;
5
+ (function (HttpMethod) {
6
+ HttpMethod["GET"] = "GET";
7
+ HttpMethod["POST"] = "POST";
8
+ HttpMethod["PATCH"] = "PATCH";
9
+ HttpMethod["PUT"] = "PUT";
10
+ HttpMethod["DELETE"] = "DELETE";
11
+ HttpMethod["HEAD"] = "HEAD";
12
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
13
+ //# sourceMappingURL=http-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-method.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-method.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACf,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB"}
@@ -0,0 +1,3 @@
1
+ import { HttpMessageBody } from "./http-message-body";
2
+ export type HttpRequestBody = HttpMessageBody | string;
3
+ //# sourceMappingURL=http-request-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request-body.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-request-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request-body.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-request-body.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { HttpMethod } from './http-method';
2
+ import type { QueryParams } from './query-params';
3
+ import { HttpHeaders } from './http-headers';
4
+ import { Authentication } from '../../authentication';
5
+ import { HttpRequestBody } from './http-request-body';
6
+ export type HttpRequest<RequestBody extends HttpRequestBody = any> = {
7
+ method: HttpMethod;
8
+ url: string;
9
+ body?: RequestBody | undefined;
10
+ headers?: HttpHeaders;
11
+ authentication?: Authentication | undefined;
12
+ queryParams?: QueryParams | undefined;
13
+ timeout?: number;
14
+ retries?: number;
15
+ responseType?: 'arraybuffer' | 'json' | 'blob' | 'text';
16
+ followRedirects?: boolean;
17
+ };
18
+ //# sourceMappingURL=http-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,WAAW,CAAC,WAAW,SAAS,eAAe,GAAG,GAAG,IAAI;IACnE,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { HttpMessageBody } from './http-message-body';
2
+ import { HttpHeaders } from './http-headers';
3
+ export type HttpResponse<RequestBody extends HttpMessageBody = any> = {
4
+ status: number;
5
+ headers?: HttpHeaders | undefined;
6
+ body: RequestBody;
7
+ };
8
+ //# sourceMappingURL=http-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,YAAY,CAAC,WAAW,SAAS,eAAe,GAAG,GAAG,IAAI;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-response.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/http-response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare enum MediaType {
2
+ APPLICATION_JSON = "application/json",
3
+ TEXT_CSV = "text/csv"
4
+ }
5
+ //# sourceMappingURL=media-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-type.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/media-type.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediaType = void 0;
4
+ var MediaType;
5
+ (function (MediaType) {
6
+ MediaType["APPLICATION_JSON"] = "application/json";
7
+ MediaType["TEXT_CSV"] = "text/csv";
8
+ })(MediaType || (exports.MediaType = MediaType = {}));
9
+ //# sourceMappingURL=media-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-type.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/media-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,kDAAqC,CAAA;IACrC,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
@@ -0,0 +1,2 @@
1
+ export type QueryParams = Record<string, string>;
2
+ //# sourceMappingURL=query-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-params.d.ts","sourceRoot":"","sources":["../../../../../src/lib/http/core/query-params.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=query-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-params.js","sourceRoot":"","sources":["../../../../../src/lib/http/core/query-params.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export * from './axios/axios-http-client';
2
+ export * from './core/base-http-client';
3
+ export * from './core/delegating-authentication-converter';
4
+ export * from './core/http-client';
5
+ export * from './core/http-error';
6
+ export * from './core/http-header';
7
+ export * from './core/http-headers';
8
+ export * from './core/http-message-body';
9
+ export * from './core/http-method';
10
+ export * from './core/http-request';
11
+ export * from './core/http-response';
12
+ export * from './core/media-type';
13
+ export * from './core/query-params';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./axios/axios-http-client"), exports);
5
+ tslib_1.__exportStar(require("./core/base-http-client"), exports);
6
+ tslib_1.__exportStar(require("./core/delegating-authentication-converter"), exports);
7
+ tslib_1.__exportStar(require("./core/http-client"), exports);
8
+ tslib_1.__exportStar(require("./core/http-error"), exports);
9
+ tslib_1.__exportStar(require("./core/http-header"), exports);
10
+ tslib_1.__exportStar(require("./core/http-headers"), exports);
11
+ tslib_1.__exportStar(require("./core/http-message-body"), exports);
12
+ tslib_1.__exportStar(require("./core/http-method"), exports);
13
+ tslib_1.__exportStar(require("./core/http-request"), exports);
14
+ tslib_1.__exportStar(require("./core/http-response"), exports);
15
+ tslib_1.__exportStar(require("./core/media-type"), exports);
16
+ tslib_1.__exportStar(require("./core/query-params"), exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/http/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,kEAAwC;AACxC,qFAA2D;AAC3D,6DAAmC;AACnC,4DAAkC;AAClC,6DAAmC;AACnC,8DAAoC;AACpC,mEAAyC;AACzC,6DAAmC;AACnC,8DAAoC;AACpC,+DAAqC;AACrC,4DAAkC;AAClC,8DAAoC"}
@@ -0,0 +1,58 @@
1
+ import { AppConnectionValueForAuthProperty, FilesService, Store } from '@scopieflows/apps-framework';
2
+ interface TimebasedPolling<AuthValue, PropsValue> {
3
+ strategy: DedupeStrategy.TIMEBASED;
4
+ items: (params: {
5
+ auth: AuthValue;
6
+ store: Store;
7
+ propsValue: PropsValue;
8
+ lastFetchEpochMS: number;
9
+ }) => Promise<{
10
+ epochMilliSeconds: number;
11
+ data: unknown;
12
+ }[]>;
13
+ }
14
+ interface LastItemPolling<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue> {
15
+ strategy: DedupeStrategy.LAST_ITEM;
16
+ items: (params: {
17
+ auth: AuthValue;
18
+ store: Store;
19
+ files?: FilesService;
20
+ propsValue: PropsValue;
21
+ lastItemId: unknown;
22
+ }) => Promise<{
23
+ id: unknown;
24
+ data: unknown;
25
+ }[]>;
26
+ }
27
+ export declare enum DedupeStrategy {
28
+ TIMEBASED = 0,
29
+ LAST_ITEM = 1
30
+ }
31
+ export type Polling<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue> = TimebasedPolling<AuthValue, PropsValue> | LastItemPolling<AuthValue, PropsValue>;
32
+ export declare const pollingHelper: {
33
+ poll<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue>(polling: Polling<AuthValue, PropsValue>, { store, auth, propsValue, maxItemsToPoll, files, }: {
34
+ store: Store;
35
+ auth: AuthValue;
36
+ propsValue: PropsValue;
37
+ files: FilesService;
38
+ maxItemsToPoll?: number;
39
+ }): Promise<unknown[]>;
40
+ onEnable<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue>(polling: Polling<AuthValue, PropsValue>, { store, auth, propsValue, }: {
41
+ store: Store;
42
+ auth: AuthValue;
43
+ propsValue: PropsValue;
44
+ }): Promise<void>;
45
+ onDisable<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue>(polling: Polling<AuthValue, PropsValue>, params: {
46
+ store: Store;
47
+ auth: AuthValue;
48
+ propsValue: PropsValue;
49
+ }): Promise<void>;
50
+ test<AuthValue extends AppConnectionValueForAuthProperty<any>, PropsValue>(polling: Polling<AuthValue, PropsValue>, { auth, propsValue, store, files, }: {
51
+ store: Store;
52
+ auth: AuthValue;
53
+ propsValue: PropsValue;
54
+ files: FilesService;
55
+ }): Promise<unknown[]>;
56
+ };
57
+ export {};
58
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/polling/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAIvG,UAAU,gBAAgB,CAAC,SAAS,EAAE,UAAU;IAC9C,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;IACnC,KAAK,EAAE,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,SAAS,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC;QACb,UAAU,EAAE,UAAU,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,KAAK,OAAO,CACX;QACE,iBAAiB,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,OAAO,CAAC;KACf,EAAE,CACJ,CAAC;CACH;AAED,UAAU,eAAe,CAAC,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU;IAC5F,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;IACnC,KAAK,EAAE,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,SAAS,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC;QACb,KAAK,CAAC,EAAE,YAAY,CAAC;QACrB,UAAU,EAAE,UAAU,CAAC;QACvB,UAAU,EAAE,OAAO,CAAC;KACrB,KAAK,OAAO,CACX;QACE,EAAE,EAAE,OAAO,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC;KACf,EAAE,CACJ,CAAC;CACH;AAED,oBAAY,cAAc;IACxB,SAAS,IAAA;IACT,SAAS,IAAA;CACV;AAED,MAAM,MAAM,OAAO,CAAC,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU,IACpF,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,GACvC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAE3C,eAAO,MAAM,aAAa;SACb,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU,WACpE,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,uDAOpC;QACD,KAAK,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,SAAS,CAAC;QAChB,UAAU,EAAE,UAAU,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,OAAO,EAAE,CAAC;aAoDN,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU,WACxE,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,gCAKpC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,GAC3D,OAAO,CAAC,IAAI,CAAC;cAuBA,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU,WACzE,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,UAC/B;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,GAChE,OAAO,CAAC,IAAI,CAAC;SAOL,SAAS,SAAS,iCAAiC,CAAC,GAAG,CAAC,EAAE,UAAU,WACpE,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,uCAMpC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,SAAS,CAAC;QAAC,UAAU,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,GAChF,OAAO,CAAC,OAAO,EAAE,CAAC;CAyBtB,CAAC"}