@tstdl/base 0.70.21 → 0.70.24

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.
package/api/index.d.ts CHANGED
@@ -2,5 +2,6 @@ export * from './api-controller';
2
2
  export * from './client';
3
3
  export * from './default-error-handlers';
4
4
  export * from './gateway';
5
+ export * from './module';
5
6
  export * from './response';
6
7
  export * from './types';
package/api/index.js CHANGED
@@ -18,6 +18,7 @@ __exportStar(require("./api-controller"), exports);
18
18
  __exportStar(require("./client"), exports);
19
19
  __exportStar(require("./default-error-handlers"), exports);
20
20
  __exportStar(require("./gateway"), exports);
21
+ __exportStar(require("./module"), exports);
21
22
  __exportStar(require("./response"), exports);
22
23
  __exportStar(require("./types"), exports);
23
24
  //# sourceMappingURL=index.js.map
package/api/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,2DAAyC;AACzC,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB;AACzB,2DAAyC;AACzC,4CAA0B;AAC1B,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB"}
@@ -0,0 +1,4 @@
1
+ import type { Type } from "../types";
2
+ import type { ApiController } from './api-controller';
3
+ export declare type ApiControllers = Type<ApiController>[];
4
+ export declare const API_CONTROLLERS: import("../container").InjectionToken<ApiControllers, any>;
package/api/module.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_CONTROLLERS = void 0;
4
+ const container_1 = require("../container");
5
+ exports.API_CONTROLLERS = (0, container_1.injectionToken)('API_CONTROLLERS');
6
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../source/api/module.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAMhC,QAAA,eAAe,GAAG,IAAA,0BAAc,EAAiB,iBAAiB,CAAC,CAAC"}
package/database/id.d.ts CHANGED
@@ -1,3 +1 @@
1
1
  export declare function getNewId(): string;
2
- export declare function setIdLength(length: number): void;
3
- export declare function setIdAlphabet(alphabet: string): void;
package/database/id.js CHANGED
@@ -1,20 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setIdAlphabet = exports.setIdLength = exports.getNewId = void 0;
4
- const alphabet_1 = require("../utils/alphabet");
3
+ exports.getNewId = void 0;
5
4
  const random_1 = require("../utils/random");
6
- let idLength = 15;
7
- let idAlphabet = alphabet_1.Alphabet.LowerUpperCaseNumbers;
5
+ const module_1 = require("./module");
8
6
  function getNewId() {
9
- return (0, random_1.getRandomString)(idLength, idAlphabet);
7
+ return (0, random_1.getRandomString)(module_1.databaseModuleConfig.idLength, module_1.databaseModuleConfig.idAlphabet);
10
8
  }
11
9
  exports.getNewId = getNewId;
12
- function setIdLength(length) {
13
- idLength = length;
14
- }
15
- exports.setIdLength = setIdLength;
16
- function setIdAlphabet(alphabet) {
17
- idAlphabet = alphabet;
18
- }
19
- exports.setIdAlphabet = setIdAlphabet;
20
10
  //# sourceMappingURL=id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"id.js","sourceRoot":"","sources":["../../source/database/id.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAC5C,4CAAiD;AAEjD,IAAI,QAAQ,GAAG,EAAE,CAAC;AAClB,IAAI,UAAU,GAAW,mBAAQ,CAAC,qBAAqB,CAAC;AAExD,SAAgB,QAAQ;IACtB,OAAO,IAAA,wBAAe,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC/C,CAAC;AAFD,4BAEC;AAED,SAAgB,WAAW,CAAC,MAAc;IACxC,QAAQ,GAAG,MAAM,CAAC;AACpB,CAAC;AAFD,kCAEC;AAED,SAAgB,aAAa,CAAC,QAAgB;IAC5C,UAAU,GAAG,QAAQ,CAAC;AACxB,CAAC;AAFD,sCAEC"}
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../../source/database/id.ts"],"names":[],"mappings":";;;AAAA,4CAAiD;AACjD,qCAAgD;AAEhD,SAAgB,QAAQ;IACtB,OAAO,IAAA,wBAAe,EAAC,6BAAoB,CAAC,QAAQ,EAAE,6BAAoB,CAAC,UAAU,CAAC,CAAC;AACzF,CAAC;AAFD,4BAEC"}
@@ -1,5 +1,6 @@
1
1
  export * from './entity';
2
2
  export * from './entity-repository';
3
3
  export * from './id';
4
+ export * from './module';
4
5
  export * from './query';
5
6
  export * from './utils';
package/database/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./entity"), exports);
18
18
  __exportStar(require("./entity-repository"), exports);
19
19
  __exportStar(require("./id"), exports);
20
+ __exportStar(require("./module"), exports);
20
21
  __exportStar(require("./query"), exports);
21
22
  __exportStar(require("./utils"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sDAAoC;AACpC,uCAAqB;AACrB,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sDAAoC;AACpC,uCAAqB;AACrB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
@@ -0,0 +1,6 @@
1
+ export declare type DatabaseModuleConfig = {
2
+ idLength: number;
3
+ idAlphabet: string;
4
+ };
5
+ export declare const databaseModuleConfig: DatabaseModuleConfig;
6
+ export declare function configureDatabase(config: Partial<DatabaseModuleConfig>): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureDatabase = exports.databaseModuleConfig = void 0;
4
+ const alphabet_1 = require("../utils/alphabet");
5
+ exports.databaseModuleConfig = {
6
+ idLength: 15,
7
+ idAlphabet: alphabet_1.Alphabet.LowerUpperCaseNumbers
8
+ };
9
+ function configureDatabase(config) {
10
+ var _a, _b;
11
+ exports.databaseModuleConfig.idLength = (_a = config.idLength) !== null && _a !== void 0 ? _a : exports.databaseModuleConfig.idLength;
12
+ exports.databaseModuleConfig.idAlphabet = (_b = config.idAlphabet) !== null && _b !== void 0 ? _b : exports.databaseModuleConfig.idAlphabet;
13
+ }
14
+ exports.configureDatabase = configureDatabase;
15
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../source/database/module.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAO/B,QAAA,oBAAoB,GAAyB;IACxD,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,mBAAQ,CAAC,qBAAqB;CAC3C,CAAC;AAEF,SAAgB,iBAAiB,CAAC,MAAqC;;IACrE,4BAAoB,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,4BAAoB,CAAC,QAAQ,CAAC;IACjF,4BAAoB,CAAC,UAAU,GAAG,MAAA,MAAM,CAAC,UAAU,mCAAI,4BAAoB,CAAC,UAAU,CAAC;AACzF,CAAC;AAHD,8CAGC"}
@@ -94,6 +94,7 @@ export declare type HttpClientRequestObject<T extends HttpBodyType = HttpBodyTyp
94
94
  url: string;
95
95
  method?: HttpMethod;
96
96
  };
97
+ export declare type CredentialsOptions = 'omit' | 'same-origin' | 'include';
97
98
  export declare class HttpClientRequest<T extends HttpBodyType = HttpBodyType> implements HttpClientRequestDocs, Disposable {
98
99
  private readonly _abortToken;
99
100
  url: string;
@@ -108,6 +109,7 @@ export declare class HttpClientRequest<T extends HttpBodyType = HttpBodyType> im
108
109
  query: HttpQuery;
109
110
  body: HttpRequestBody;
110
111
  responseType: T;
112
+ credentials: CredentialsOptions;
111
113
  timeout: number;
112
114
  context: StringMap;
113
115
  get abortToken(): ReadonlyCancellationToken;
@@ -10,7 +10,7 @@ const http_query_1 = require("../http-query");
10
10
  const http_url_parameters_1 = require("../http-url-parameters");
11
11
  class HttpClientRequest {
12
12
  constructor(urlOrObject, method, options) {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
13
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
14
14
  if ((0, type_guards_1.isString)(urlOrObject)) {
15
15
  this.url = urlOrObject;
16
16
  this.method = method !== null && method !== void 0 ? method : 'GET';
@@ -30,9 +30,10 @@ class HttpClientRequest {
30
30
  this.query = new http_query_1.HttpQuery(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.query);
31
31
  this.body = normalizeBody(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.body);
32
32
  this.responseType = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.responseType) !== null && _f !== void 0 ? _f : 'auto';
33
- this.timeout = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) !== null && _g !== void 0 ? _g : 30000;
34
- this.context = (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.context) !== null && _h !== void 0 ? _h : {};
35
- this._abortToken = (_k = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortToken) === null || _j === void 0 ? void 0 : _j.createChild()) !== null && _k !== void 0 ? _k : new cancellation_token_1.CancellationToken();
33
+ this.credentials = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.credentials) !== null && _g !== void 0 ? _g : 'omit';
34
+ this.timeout = (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) !== null && _h !== void 0 ? _h : 30000;
35
+ this.context = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.context) !== null && _j !== void 0 ? _j : {};
36
+ this._abortToken = (_l = (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortToken) === null || _k === void 0 ? void 0 : _k.createChild()) !== null && _l !== void 0 ? _l : new cancellation_token_1.CancellationToken();
36
37
  }
37
38
  get abortToken() {
38
39
  return this._abortToken.asReadonly;
@@ -1 +1 @@
1
- {"version":3,"file":"http-client-request.js","sourceRoot":"","sources":["../../../source/http/client/http-client-request.ts"],"names":[],"mappings":";;;AACA,iDAAuC;AAGvC,uEAA+D;AAC/D,yDAAuE;AAEvE,4CAAwC;AAExC,kDAA8C;AAE9C,8CAA0C;AAE1C,gEAA2D;AAgG3D,MAAa,iBAAiB;IAwB5B,YAAY,WAAgD,EAAE,MAAmB,EAAE,OAAqC;;QACtH,IAAI,IAAA,sBAAQ,EAAC,WAAW,CAAC,EAAE;YACzB,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC;SAC/B;aACI;YACH,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,MAAA,WAAW,CAAC,MAAM,mCAAI,KAAK,CAAC;SAC3C;QAED,MAAM,cAAc,GAA4C,IAAA,sBAAQ,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;QAE9G,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAW,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAC;QAC7C,IAAI,CAAC,kBAAkB,GAAG,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,kBAAkB,mCAAI,IAAI,CAAC;QACrE,IAAI,CAA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C,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AA1FD,8CA0FC;AAED,SAAS,aAAa,CAAC,IAAsC;IAC3D,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,cAAc,qBAAQ,IAAI,CAAE,CAAC;IAEnC,IAAI,IAAA,uBAAS,EAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAClC,cAAc,CAAC,IAAI,GAAG,IAAI,oBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACzD;IAED,OAAO,cAA2C,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"http-client-request.js","sourceRoot":"","sources":["../../../source/http/client/http-client-request.ts"],"names":[],"mappings":";;;AACA,iDAAuC;AAGvC,uEAA+D;AAC/D,yDAAuE;AAEvE,4CAAwC;AAExC,kDAA8C;AAE9C,8CAA0C;AAE1C,gEAA2D;AAkG3D,MAAa,iBAAiB;IAyB5B,YAAY,WAAgD,EAAE,MAAmB,EAAE,OAAqC;;QACtH,IAAI,IAAA,sBAAQ,EAAC,WAAW,CAAC,EAAE;YACzB,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC;SAC/B;aACI;YACH,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,MAAA,WAAW,CAAC,MAAM,mCAAI,KAAK,CAAC;SAC3C;QAED,MAAM,cAAc,GAA4C,IAAA,sBAAQ,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;QAE9G,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAW,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,GAAG,cAAc,aAAd,cA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C,aAAa,CAAC,QAAQ,EAAE;YAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YAC5B,IAAI;YACJ,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AA5FD,8CA4FC;AAED,SAAS,aAAa,CAAC,IAAsC;IAC3D,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,EAAE;QACrB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,cAAc,qBAAQ,IAAI,CAAE,CAAC;IAEnC,IAAI,IAAA,uBAAS,EAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAClC,cAAc,CAAC,IAAI,GAAG,IAAI,oBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KACzD;IAED,OAAO,cAA2C,CAAC;AACrD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { HttpHeaders } from './http-headers';
2
+ export declare class CookieParser {
3
+ private readonly httpHeaders;
4
+ private readonly cookies;
5
+ constructor(httpHeaders: HttpHeaders);
6
+ has(name: string): boolean;
7
+ get(name: string): string | undefined;
8
+ private parseCookies;
9
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CookieParser = void 0;
4
+ const utils_1 = require("../utils");
5
+ const object_1 = require("../utils/object");
6
+ class CookieParser {
7
+ constructor(httpHeaders) {
8
+ this.httpHeaders = httpHeaders;
9
+ (0, object_1.lazyProperty)(this, 'cookies', () => this.parseCookies());
10
+ }
11
+ has(name) {
12
+ return this.cookies.has(name);
13
+ }
14
+ get(name) {
15
+ return this.cookies.get(name);
16
+ }
17
+ parseCookies() {
18
+ const cookie = this.httpHeaders.tryGetSingle('Cookie');
19
+ if ((0, utils_1.isUndefined)(cookie)) {
20
+ return new Map();
21
+ }
22
+ const entries = cookie.split(';')
23
+ .map((value) => value.trim())
24
+ .map((value) => {
25
+ const equalsIndex = value.indexOf('=');
26
+ const name = value.slice(0, equalsIndex);
27
+ const cookieValue = value.slice(equalsIndex + 1);
28
+ return [name, cookieValue];
29
+ });
30
+ return new Map(entries);
31
+ }
32
+ }
33
+ exports.CookieParser = CookieParser;
34
+ //# sourceMappingURL=cookie-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookie-parser.js","sourceRoot":"","sources":["../../source/http/cookie-parser.ts"],"names":[],"mappings":";;;AAAA,oCAAsC;AACtC,4CAA8C;AAG9C,MAAa,YAAY;IAIvB,YAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAA,qBAAY,EAAC,IAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAEO,YAAY;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAuB,CAAC;QAE7E,IAAI,IAAA,mBAAW,EAAC,MAAM,CAAC,EAAE;YACvB,OAAO,IAAI,GAAG,EAAE,CAAC;SAClB;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;aAC9B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;aAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAEvC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YACzC,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;YAEjD,OAAO,CAAC,IAAI,EAAE,WAAW,CAAU,CAAC;QACtC,CAAC,CAAC,CAAC;QAEL,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF;AAtCD,oCAsCC"}
package/http/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './client';
2
+ export * from './cookie-parser';
2
3
  export * from './http-headers';
3
4
  export * from './http-query';
4
5
  export * from './http.error';
package/http/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client"), exports);
18
+ __exportStar(require("./cookie-parser"), exports);
18
19
  __exportStar(require("./http-headers"), exports);
19
20
  __exportStar(require("./http-query"), exports);
20
21
  __exportStar(require("./http.error"), exports);
package/http/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC;AAChC,iDAA+B;AAC/B,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB"}
@@ -1,4 +1,5 @@
1
1
  import type { StringMap, UndefinableJson } from "../../types";
2
+ import { CookieParser } from '../cookie-parser';
2
3
  import type { HttpHeaders } from '../http-headers';
3
4
  import type { HttpQuery } from '../http-query';
4
5
  import type { HttpMethod } from '../types';
@@ -14,6 +15,7 @@ export declare class HttpServerRequest {
14
15
  readonly url: URL;
15
16
  readonly method: HttpMethod;
16
17
  readonly headers: HttpHeaders;
18
+ readonly cookies: CookieParser;
17
19
  readonly query: HttpQuery;
18
20
  readonly ip: string;
19
21
  context: StringMap;
@@ -5,12 +5,14 @@ const unsupported_media_type_error_1 = require("../../error/unsupported-media-ty
5
5
  const encoding_1 = require("../../utils/encoding");
6
6
  const stream_reader_1 = require("../../utils/stream/stream-reader");
7
7
  const type_guards_1 = require("../../utils/type-guards");
8
+ const cookie_parser_1 = require("../cookie-parser");
8
9
  class HttpServerRequest {
9
10
  constructor(data) {
10
11
  var _a;
11
12
  this.url = data.url;
12
13
  this.method = data.method;
13
14
  this.headers = data.headers;
15
+ this.cookies = new cookie_parser_1.CookieParser(this.headers);
14
16
  this.query = data.query;
15
17
  this.ip = data.ip;
16
18
  this.body = data.body;
@@ -1 +1 @@
1
- {"version":3,"file":"http-server-request.js","sourceRoot":"","sources":["../../../source/http/server/http-server-request.ts"],"names":[],"mappings":";;;AAAA,2FAAiF;AAEjF,mDAA8C;AAC9C,oEAAgE;AAChE,yDAA+D;AAc/D,MAAa,iBAAiB;IAe5B,YAAY,IAA6B;;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEtB,IAAI,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;IACpC,CAAC;IAbD,IAAI,OAAO;QACT,OAAO,IAAA,uBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAaD,YAAY;QACV,IAAA,2BAAa,EAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACnC,OAAO,IAAA,gCAAgB,EAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAyB;QACxC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,IAAA,qBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,UAAU,CAA8C,OAAyB;QACrF,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,kBAAkB,EAAE;YAClD,MAAM,IAAI,wDAAyB,CAAC,gCAAgC,CAAC,CAAC;SACvE;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;SAC9B;QACD,OAAO,KAAc,EAAE;YACrB,MAAM,IAAI,wDAAyB,CAAC,yCAA0C,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;SAC1G;IACH,CAAC;CACF;AAvDD,8CAuDC"}
1
+ {"version":3,"file":"http-server-request.js","sourceRoot":"","sources":["../../../source/http/server/http-server-request.ts"],"names":[],"mappings":";;;AAAA,2FAAiF;AAEjF,mDAA8C;AAC9C,oEAAgE;AAChE,yDAA+D;AAC/D,oDAAgD;AAchD,MAAa,iBAAiB;IAgB5B,YAAY,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AAO,CAAC,WAAW,IAAI,kBAAkB,EAAE;YAClD,MAAM,IAAI,wDAAyB,CAAC,gCAAgC,CAAC,CAAC;SACvE;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;SAC9B;QACD,OAAO,KAAc,EAAE;YACrB,MAAM,IAAI,wDAAyB,CAAC,yCAA0C,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;SAC1G;IACH,CAAC;CACF;AAzDD,8CAyDC"}
@@ -1,6 +1,7 @@
1
1
  import type { ApiController } from "../../api";
2
- import { ApiGateway } from "../../api";
3
- import { Injectable, resolveArgumentType } from "../../container";
2
+ import { ApiControllers, ApiGateway } from "../../api";
3
+ import type { AfterResolve, Injectable } from "../../container";
4
+ import { afterResolve, resolveArgumentType } from "../../container";
4
5
  import { HttpServer } from "../../http/server";
5
6
  import { Logger } from "../../logger";
6
7
  import type { Type } from "../../types";
@@ -13,11 +14,13 @@ export declare type WebServerModuleConfiguration = {
13
14
  prefix: 'api/';
14
15
  };
15
16
  export declare const webServerModuleConfiguration: WebServerModuleConfiguration;
16
- export declare class WebServerModule extends ModuleBase implements Module, Injectable<WebServerModuleConfiguration> {
17
+ export declare class WebServerModule extends ModuleBase implements Module, Injectable<WebServerModuleConfiguration>, AfterResolve {
17
18
  private readonly config;
18
19
  private readonly logger;
19
20
  private readonly httpServer;
20
21
  private readonly apiGateway;
22
+ private readonly apiControllers;
23
+ private initialized;
21
24
  readonly metrics: {
22
25
  connectedSockets: {
23
26
  type: ModuleMetricType;
@@ -25,7 +28,9 @@ export declare class WebServerModule extends ModuleBase implements Module, Injec
25
28
  };
26
29
  };
27
30
  [resolveArgumentType]: WebServerModuleConfiguration;
28
- constructor(config: WebServerModuleConfiguration, httpServer: HttpServer, apiGateway: ApiGateway, logger: Logger);
31
+ constructor(config: WebServerModuleConfiguration, httpServer: HttpServer, apiGateway: ApiGateway, logger: Logger, apiControllers?: ApiControllers);
32
+ initialize(): Promise<void>;
33
+ [afterResolve](): Promise<void>;
29
34
  registerApiController(controller: Type<ApiController>): Promise<void>;
30
35
  protected _run(cancellationToken: ReadonlyCancellationToken): Promise<void>;
31
36
  }
@@ -37,7 +37,7 @@ function getApiGatewayArgument(config) {
37
37
  };
38
38
  }
39
39
  let WebServerModule = class WebServerModule extends module_base_1.ModuleBase {
40
- constructor(config, httpServer, apiGateway, logger) {
40
+ constructor(config, httpServer, apiGateway, logger, apiControllers = []) {
41
41
  super('WebServer');
42
42
  this.metrics = {
43
43
  connectedSockets: {
@@ -49,12 +49,27 @@ let WebServerModule = class WebServerModule extends module_base_1.ModuleBase {
49
49
  this.apiGateway = apiGateway;
50
50
  this.config = config;
51
51
  this.logger = logger;
52
+ this.apiControllers = apiControllers;
53
+ this.initialized = false;
54
+ }
55
+ async initialize() {
56
+ if (this.initialized) {
57
+ return;
58
+ }
59
+ this.initialized = true;
60
+ for (const controller of this.apiControllers) {
61
+ await this.registerApiController(controller);
62
+ }
63
+ }
64
+ async [container_1.afterResolve]() {
65
+ await this.initialize();
52
66
  }
53
67
  async registerApiController(controller) {
54
68
  await this.apiGateway.registerApiController(controller);
55
69
  }
56
70
  async _run(cancellationToken) {
57
71
  var e_1, _a;
72
+ await this.initialize();
58
73
  await this.httpServer.listen(this.config.port);
59
74
  this.logger.info(`listening on port ${this.config.port}`);
60
75
  const closePromise = cancellationToken.$set.then(async () => {
@@ -82,9 +97,11 @@ WebServerModule = __decorate([
82
97
  __param(0, (0, container_1.injectArg)()),
83
98
  __param(2, (0, container_1.forwardArg)(getApiGatewayArgument)),
84
99
  __param(3, (0, container_1.resolveArg)('WebServer')),
100
+ __param(4, (0, container_1.inject)(api_1.API_CONTROLLERS)),
101
+ __param(4, (0, container_1.optional)()),
85
102
  __metadata("design:paramtypes", [Object, server_1.HttpServer,
86
103
  api_1.ApiGateway,
87
- logger_1.Logger])
104
+ logger_1.Logger, Array])
88
105
  ], WebServerModule);
89
106
  exports.WebServerModule = WebServerModule;
90
107
  function configureWebServerModule(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"web-server.module.js","sourceRoot":"","sources":["../../../source/module/modules/web-server.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,mCAAmC;AACnC,+CAA4G;AAC5G,4DAAuD;AACvD,8CAA2C;AAE3C,yCAAkC;AAIlC,sCAA6C;AAC7C,gDAA4C;AAO/B,QAAA,4BAA4B,GAAiC;IACxE,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,MAAM;CACf,CAAC;AAEF,SAAS,qBAAqB,CAAC,MAAoC;IACjE,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC;AAGD,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,wBAAU;IAe7C,YACe,MAAoC,EACjD,UAAsB,EAC+D,UAAsB,EAClE,MAAc;QAEvD,KAAK,CAAC,WAAW,CAAC,CAAC;QAfZ,YAAO,GAAG;YACjB,gBAAgB,EAAE;gBAChB,IAAI,EAAE,yBAAgB,CAAC,KAAK;gBAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB;aACtD;SACF,CAAC;QAYA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,UAA+B;QACzD,MAAM,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAES,KAAK,CAAC,IAAI,CAAC,iBAA4C;;QAC/D,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,I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IAAA,oBAAQ,GAAE,CAAA;6CAHxB,mBAAU;QAC2E,gBAAU;QAC1D,eAAM;GAtB9C,eAAe,CAyE3B;AAzEY,0CAAe;AA2E5B,SAAgB,wBAAwB,CAAC,MAA8C;;IACrF,oCAA4B,CAAC,IAAI,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,oCAA4B,CAAC,IAAI,CAAC;IACtF,oCAA4B,CAAC,MAAM,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,mCAAI,oCAA4B,CAAC,MAAM,CAAC;AAC9F,CAAC;AAHD,4DAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.70.21",
3
+ "version": "0.70.24",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/utils/random.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * generate cryptographically strong random bytes
2
+ * generate cryptographically secure random bytes
3
3
  *
4
4
  * if allowUnsafe is true a view on the underlying pool is returned. This can be dangerous as the underlying
5
5
  * pool can be read and modified by other callers of {@link getRandomBytes} but improves performance as
@@ -8,4 +8,9 @@
8
8
  * @param allowUnsafe whether to allow sharing the underlying pool
9
9
  */
10
10
  export declare function getRandomBytes(count: number, allowUnsafe?: boolean): Uint8Array;
11
- export declare function getRandomString(length: number, alphabet: string): string;
11
+ /**
12
+ * generate a cryptographically secure random string (in terms of source of randomness).
13
+ * @param length length of string
14
+ * @param alphabet alphabet to choose characters from. Defaults to {@link Alphabet.LowerUpperCaseNumbers}
15
+ */
16
+ export declare function getRandomString(length: number, alphabet?: string): string;
package/utils/random.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRandomString = exports.getRandomBytes = void 0;
4
+ const alphabet_1 = require("./alphabet");
4
5
  const bufferSize = 20480;
5
6
  const bufferBypassThreshold = (bufferSize / 2) + 1;
6
7
  let nodeCrypto;
@@ -26,7 +27,7 @@ const randomBytes = (nodeCrypto != undefined)
26
27
  let randomBytesBuffer = new Uint8Array();
27
28
  let randomBytesBufferIndex = 0;
28
29
  /**
29
- * generate cryptographically strong random bytes
30
+ * generate cryptographically secure random bytes
30
31
  *
31
32
  * if allowUnsafe is true a view on the underlying pool is returned. This can be dangerous as the underlying
32
33
  * pool can be read and modified by other callers of {@link getRandomBytes} but improves performance as
@@ -48,7 +49,12 @@ function getRandomBytes(count, allowUnsafe = false) {
48
49
  return bytes;
49
50
  }
50
51
  exports.getRandomBytes = getRandomBytes;
51
- function getRandomString(length, alphabet) {
52
+ /**
53
+ * generate a cryptographically secure random string (in terms of source of randomness).
54
+ * @param length length of string
55
+ * @param alphabet alphabet to choose characters from. Defaults to {@link Alphabet.LowerUpperCaseNumbers}
56
+ */
57
+ function getRandomString(length, alphabet = alphabet_1.Alphabet.LowerUpperCaseNumbers) {
52
58
  let result = '';
53
59
  if (length < 1) {
54
60
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../../source/utils/random.ts"],"names":[],"mappings":";;;AAIA,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,MAAM,qBAAqB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAEnD,IAAI,UAAsC,CAAC;AAE3C,IAAI;IACF,mCAAmC;IACnC,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAmB,CAAC;CAC5D;AACD,WAAM;IACJ,SAAS;CACV;AAED,SAAS,wBAAwB,CAAC,IAAY;IAC5C,MAAM,MAAM,GAAG,UAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAEnF,OAAO,UAAU,CAA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