@ask-ell/back-end 0.2.5 → 0.2.6

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 (155) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/package.json +2 -2
  3. package/src/http/index.d.ts +2 -0
  4. package/src/http/index.d.ts.map +1 -0
  5. package/src/http/index.js +4 -0
  6. package/src/http/types.d.ts +5 -0
  7. package/src/http/types.d.ts.map +1 -0
  8. package/src/http/types.js +2 -0
  9. package/src/{index.ts → index.d.ts} +1 -0
  10. package/src/index.d.ts.map +1 -0
  11. package/src/index.js +10 -0
  12. package/src/keyv.store.adapter.factory.d.ts +11 -0
  13. package/src/keyv.store.adapter.factory.d.ts.map +1 -0
  14. package/src/keyv.store.adapter.factory.js +44 -0
  15. package/src/nest/add-ons/add-on.interface.d.ts +5 -0
  16. package/src/nest/add-ons/add-on.interface.d.ts.map +1 -0
  17. package/src/nest/add-ons/add-on.interface.js +2 -0
  18. package/src/nest/add-ons/add-on.wrapper.d.ts +11 -0
  19. package/src/nest/add-ons/add-on.wrapper.d.ts.map +1 -0
  20. package/src/nest/add-ons/add-on.wrapper.js +29 -0
  21. package/src/nest/add-ons/implementations/security/security.add-on.d.ts +6 -0
  22. package/src/nest/add-ons/implementations/security/security.add-on.d.ts.map +1 -0
  23. package/src/nest/add-ons/implementations/security/security.add-on.js +16 -0
  24. package/src/nest/add-ons/implementations/sentry/sentry.add-on.d.ts +8 -0
  25. package/src/nest/add-ons/implementations/sentry/sentry.add-on.d.ts.map +1 -0
  26. package/src/nest/add-ons/implementations/sentry/{sentry.add-on.interface.ts → sentry.add-on.interface.d.ts} +3 -5
  27. package/src/nest/add-ons/implementations/sentry/sentry.add-on.interface.d.ts.map +1 -0
  28. package/src/nest/add-ons/implementations/sentry/sentry.add-on.interface.js +2 -0
  29. package/src/nest/add-ons/implementations/sentry/sentry.add-on.js +19 -0
  30. package/src/nest/add-ons/implementations/sentry/sentry.add-on.state.interface.d.ts +6 -0
  31. package/src/nest/add-ons/implementations/sentry/sentry.add-on.state.interface.d.ts.map +1 -0
  32. package/src/nest/add-ons/implementations/sentry/sentry.add-on.state.interface.js +2 -0
  33. package/src/nest/add-ons/implementations/swagger/swagger.add-on.d.ts +10 -0
  34. package/src/nest/add-ons/implementations/swagger/swagger.add-on.d.ts.map +1 -0
  35. package/src/nest/add-ons/implementations/swagger/{swagger.add-on.interface.ts → swagger.add-on.interface.d.ts} +3 -5
  36. package/src/nest/add-ons/implementations/swagger/swagger.add-on.interface.d.ts.map +1 -0
  37. package/src/nest/add-ons/implementations/swagger/swagger.add-on.interface.js +2 -0
  38. package/src/nest/add-ons/implementations/swagger/swagger.add-on.js +32 -0
  39. package/src/nest/add-ons/implementations/swagger/swagger.add-on.state.interface.d.ts +7 -0
  40. package/src/nest/add-ons/implementations/swagger/swagger.add-on.state.interface.d.ts.map +1 -0
  41. package/src/nest/add-ons/implementations/swagger/swagger.add-on.state.interface.js +2 -0
  42. package/src/nest/add-ons/implementations/swagger/{types.ts → types.d.ts} +1 -0
  43. package/src/nest/add-ons/implementations/swagger/types.d.ts.map +1 -0
  44. package/src/nest/add-ons/implementations/swagger/types.js +2 -0
  45. package/src/nest/add-ons/{index.ts → index.d.ts} +1 -0
  46. package/src/nest/add-ons/index.d.ts.map +1 -0
  47. package/src/nest/add-ons/index.js +9 -0
  48. package/src/nest/add-ons/{types.ts → types.d.ts} +3 -3
  49. package/src/nest/add-ons/types.d.ts.map +1 -0
  50. package/src/nest/add-ons/types.js +2 -0
  51. package/src/nest/application.base.d.ts +5 -0
  52. package/src/nest/application.base.d.ts.map +1 -0
  53. package/src/nest/application.base.js +34 -0
  54. package/src/nest/application.factory.d.ts +9 -0
  55. package/src/nest/application.factory.d.ts.map +1 -0
  56. package/src/nest/application.factory.js +15 -0
  57. package/src/nest/filters/http.exception.filter.d.ts +5 -0
  58. package/src/nest/filters/http.exception.filter.d.ts.map +1 -0
  59. package/src/nest/filters/http.exception.filter.js +32 -0
  60. package/src/nest/filters/{index.ts → index.d.ts} +1 -0
  61. package/src/nest/filters/index.d.ts.map +1 -0
  62. package/src/nest/filters/index.js +4 -0
  63. package/src/nest/{index.ts → index.d.ts} +1 -0
  64. package/src/nest/index.d.ts.map +1 -0
  65. package/src/nest/index.js +9 -0
  66. package/src/nest/interceptors/error.interceptor.d.ts +11 -0
  67. package/src/nest/interceptors/error.interceptor.d.ts.map +1 -0
  68. package/src/nest/interceptors/error.interceptor.js +17 -0
  69. package/src/nest/interceptors/{index.ts → index.d.ts} +1 -0
  70. package/src/nest/interceptors/index.d.ts.map +1 -0
  71. package/src/nest/interceptors/index.js +5 -0
  72. package/src/nest/interceptors/response.format.interceptor.d.ts +7 -0
  73. package/src/nest/interceptors/response.format.interceptor.d.ts.map +1 -0
  74. package/src/nest/interceptors/response.format.interceptor.js +30 -0
  75. package/src/nest/modules/health/health.module.d.ts +5 -0
  76. package/src/nest/modules/health/health.module.d.ts.map +1 -0
  77. package/src/nest/modules/health/health.module.js +32 -0
  78. package/src/nest/modules/health/index.d.ts +2 -0
  79. package/src/nest/modules/health/index.d.ts.map +1 -0
  80. package/src/nest/modules/health/index.js +4 -0
  81. package/src/nest/modules/health/middlewares/{index.ts → index.d.ts} +1 -0
  82. package/src/nest/modules/health/middlewares/index.d.ts.map +1 -0
  83. package/src/nest/modules/health/middlewares/index.js +4 -0
  84. package/src/nest/modules/health/middlewares/ping.middleware.d.ts +6 -0
  85. package/src/nest/modules/health/middlewares/ping.middleware.d.ts.map +1 -0
  86. package/src/nest/modules/health/middlewares/ping.middleware.js +26 -0
  87. package/src/nest/modules/{index.ts → index.d.ts} +1 -0
  88. package/src/nest/modules/index.d.ts.map +1 -0
  89. package/src/nest/modules/index.js +5 -0
  90. package/src/nest/modules/requirement/{index.ts → index.d.ts} +1 -0
  91. package/src/nest/modules/requirement/index.d.ts.map +1 -0
  92. package/src/nest/modules/requirement/index.js +4 -0
  93. package/src/nest/modules/requirement/requirement.module.d.ts +3 -0
  94. package/src/nest/modules/requirement/requirement.module.d.ts.map +1 -0
  95. package/src/nest/modules/requirement/requirement.module.js +72 -0
  96. package/src/scripts/{index.ts → index.d.ts} +1 -0
  97. package/src/scripts/index.d.ts.map +1 -0
  98. package/src/scripts/index.js +5 -0
  99. package/src/scripts/move-keyv-data.program.d.ts +6 -0
  100. package/src/scripts/move-keyv-data.program.d.ts.map +1 -0
  101. package/src/scripts/move-keyv-data.program.js +65 -0
  102. package/src/scripts/update-dependencies-versions.program.d.ts +32 -0
  103. package/src/scripts/update-dependencies-versions.program.d.ts.map +1 -0
  104. package/src/scripts/update-dependencies-versions.program.js +112 -0
  105. package/src/secrets/docker.secret.getter.d.ts +3 -0
  106. package/src/secrets/docker.secret.getter.d.ts.map +1 -0
  107. package/src/secrets/docker.secret.getter.js +6 -0
  108. package/src/secrets/file.secret.getter.d.ts +5 -0
  109. package/src/secrets/file.secret.getter.d.ts.map +1 -0
  110. package/src/secrets/file.secret.getter.js +20 -0
  111. package/src/secrets/{index.ts → index.d.ts} +1 -0
  112. package/src/secrets/index.d.ts.map +1 -0
  113. package/src/secrets/index.js +5 -0
  114. package/src/secrets/local.secret.getter.d.ts +3 -0
  115. package/src/secrets/local.secret.getter.d.ts.map +1 -0
  116. package/src/secrets/local.secret.getter.js +6 -0
  117. package/src/secrets/{types.ts → types.d.ts} +1 -0
  118. package/src/secrets/types.d.ts.map +1 -0
  119. package/src/secrets/types.js +2 -0
  120. package/src/tmp.d.ts +4 -0
  121. package/src/tmp.d.ts.map +1 -0
  122. package/src/tmp.js +16 -0
  123. package/.spec.swcrc +0 -22
  124. package/dist/tsconfig.lib.tsbuildinfo +0 -1
  125. package/eslint.config.mjs +0 -22
  126. package/jest.config.ts +0 -20
  127. package/project.json +0 -26
  128. package/src/http/index.ts +0 -1
  129. package/src/http/types.ts +0 -4
  130. package/src/keyv.store.adapter.factory.ts +0 -43
  131. package/src/nest/add-ons/add-on.interface.ts +0 -5
  132. package/src/nest/add-ons/add-on.wrapper.ts +0 -31
  133. package/src/nest/add-ons/implementations/security/security.add-on.ts +0 -17
  134. package/src/nest/add-ons/implementations/sentry/sentry.add-on.state.interface.ts +0 -5
  135. package/src/nest/add-ons/implementations/sentry/sentry.add-on.ts +0 -24
  136. package/src/nest/add-ons/implementations/swagger/swagger.add-on.state.interface.ts +0 -7
  137. package/src/nest/add-ons/implementations/swagger/swagger.add-on.ts +0 -59
  138. package/src/nest/application.base.ts +0 -18
  139. package/src/nest/application.factory.ts +0 -23
  140. package/src/nest/filters/http.exception.filter.ts +0 -23
  141. package/src/nest/interceptors/error.interceptor.ts +0 -25
  142. package/src/nest/interceptors/response.format.interceptor.ts +0 -29
  143. package/src/nest/modules/health/health.module.ts +0 -20
  144. package/src/nest/modules/health/index.ts +0 -1
  145. package/src/nest/modules/health/middlewares/ping.middleware.ts +0 -9
  146. package/src/nest/modules/requirement/requirement.module.ts +0 -56
  147. package/src/scripts/move-keyv-data.program.ts +0 -88
  148. package/src/scripts/update-dependencies-versions.program.ts +0 -201
  149. package/src/secrets/docker.secret.getter.ts +0 -9
  150. package/src/secrets/file.secret.getter.ts +0 -27
  151. package/src/secrets/local.secret.getter.ts +0 -9
  152. package/src/tmp.ts +0 -15
  153. package/tsconfig.json +0 -16
  154. package/tsconfig.lib.json +0 -18
  155. package/tsconfig.spec.json +0 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @ask-ell/back-end
2
2
 
3
+ ## 0.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a15edf6`](https://github.com/ask-ell/stacks/commit/a15edf6a2deb914cadfbbaa3f95b45f7986dcec0) Thanks [@timbitwin](https://github.com/timbitwin)! - Forced publish
8
+ - Updated dependencies [[`a15edf6`](https://github.com/ask-ell/stacks/commit/a15edf6a2deb914cadfbbaa3f95b45f7986dcec0)]:
9
+ - @ask-ell/core@1.3.10
10
+ - @ask-ell/nest@0.0.17
11
+ - @ask-ell/node@0.1.3
12
+
3
13
  ## 0.2.5
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ask-ell/back-end",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -24,4 +24,4 @@
24
24
  "tslib": "*",
25
25
  "rxjs": "*"
26
26
  }
27
- }
27
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/back-end/src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./types"), exports);
@@ -0,0 +1,5 @@
1
+ export type HttpResponseBody<Data = unknown> = {
2
+ message: string;
3
+ data?: Data;
4
+ };
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/back-end/src/http/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,IAAI,GAAG,OAAO,IAAI;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,3 +5,4 @@ export * from './scripts';
5
5
  export * from './http';
6
6
  export * from './nest';
7
7
  export * from './keyv.store.adapter.factory';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/back-end/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,8BAA8B,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /**
5
+ * @module @ask-ell/back-end
6
+ */
7
+ tslib_1.__exportStar(require("./scripts"), exports);
8
+ tslib_1.__exportStar(require("./http"), exports);
9
+ tslib_1.__exportStar(require("./nest"), exports);
10
+ tslib_1.__exportStar(require("./keyv.store.adapter.factory"), exports);
@@ -0,0 +1,11 @@
1
+ import { KeyvStoreAdapter } from 'keyv';
2
+ import { MaybeUndefined } from '@ask-ell/core';
3
+ export type CreateKeyvStoreAdapterOptions = {
4
+ postgresUri: MaybeUndefined<string>;
5
+ };
6
+ export declare class KeyvStoreAdapterFactory {
7
+ private logger;
8
+ create(options: CreateKeyvStoreAdapterOptions): KeyvStoreAdapter;
9
+ private getKeyvStoreAdapter;
10
+ }
11
+ //# sourceMappingURL=keyv.store.adapter.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyv.store.adapter.factory.d.ts","sourceRoot":"","sources":["../../../../packages/back-end/src/keyv.store.adapter.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAGxC,OAAO,EAAW,cAAc,EAAE,MAAM,eAAe,CAAC;AAMxD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,qBACa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAA0D;IAExE,MAAM,CAAC,OAAO,EAAE,6BAA6B,GAAG,gBAAgB;IAQhE,OAAO,CAAC,mBAAmB;CAgB5B"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyvStoreAdapterFactory = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const sqlite_1 = require("@keyv/sqlite");
7
+ const postgres_1 = require("@keyv/postgres");
8
+ const nest_1 = require("@ask-ell/nest");
9
+ const node_path_1 = require("node:path");
10
+ const tmp_1 = require("./tmp");
11
+ let KeyvStoreAdapterFactory = (() => {
12
+ let _classDecorators = [(0, common_1.Injectable)()];
13
+ let _classDescriptor;
14
+ let _classExtraInitializers = [];
15
+ let _classThis;
16
+ var KeyvStoreAdapterFactory = class {
17
+ static { _classThis = this; }
18
+ static {
19
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
20
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
21
+ KeyvStoreAdapterFactory = _classThis = _classDescriptor.value;
22
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
23
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
24
+ }
25
+ logger = nest_1.NestLogger.fromClass(KeyvStoreAdapterFactory);
26
+ create(options) {
27
+ const adapter = this.getKeyvStoreAdapter(options);
28
+ this.logger.log(`Connected to database with adapter "${adapter.constructor.name}"`);
29
+ return adapter;
30
+ }
31
+ getKeyvStoreAdapter({ postgresUri, }) {
32
+ if (!postgresUri) {
33
+ (0, tmp_1.createTmpFolder)(this.logger);
34
+ const localDatabaseFilePath = (0, node_path_1.join)(tmp_1.TMP_FOLDER_PATH, 'database.sqlite');
35
+ return new sqlite_1.default(localDatabaseFilePath);
36
+ }
37
+ return new postgres_1.default({
38
+ uri: postgresUri,
39
+ });
40
+ }
41
+ };
42
+ return KeyvStoreAdapterFactory = _classThis;
43
+ })();
44
+ exports.KeyvStoreAdapterFactory = KeyvStoreAdapterFactory;
@@ -0,0 +1,5 @@
1
+ import { INestApplication } from '@nestjs/common';
2
+ export interface IAddOn<T> {
3
+ apply(application: INestApplication<T>): void;
4
+ }
5
+ //# sourceMappingURL=add-on.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-on.interface.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/add-ons/add-on.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,KAAK,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/C"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { INestApplication } from '@nestjs/common';
2
+ import { IAddOn } from './add-on.interface';
3
+ import { AddOnWrapperParams } from './types';
4
+ export declare class AddOnWrapper<T> implements IAddOn<T> {
5
+ private params;
6
+ private implementations;
7
+ constructor(params: AddOnWrapperParams);
8
+ apply(application: INestApplication<T>): void;
9
+ private appendImplementations;
10
+ }
11
+ //# sourceMappingURL=add-on.wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-on.wrapper.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/add-ons/add-on.wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7C,qBAAa,YAAY,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IAGnC,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,eAAe,CAAsC;gBAEzC,MAAM,EAAE,kBAAkB;IAI9C,KAAK,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI;IAM7C,OAAO,CAAC,qBAAqB;CAS9B"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddOnWrapper = void 0;
4
+ const security_add_on_1 = require("./implementations/security/security.add-on");
5
+ const swagger_add_on_1 = require("./implementations/swagger/swagger.add-on");
6
+ const sentry_add_on_1 = require("./implementations/sentry/sentry.add-on");
7
+ class AddOnWrapper {
8
+ params;
9
+ implementations = [new security_add_on_1.SecurityAddOn()];
10
+ constructor(params) {
11
+ this.params = params;
12
+ this.appendImplementations();
13
+ }
14
+ apply(application) {
15
+ this.implementations.forEach((addOn) => {
16
+ addOn.apply(application);
17
+ });
18
+ }
19
+ appendImplementations() {
20
+ const { sentry, swagger } = this.params;
21
+ if (swagger) {
22
+ this.implementations.push(new swagger_add_on_1.SwaggerAddon(swagger));
23
+ }
24
+ if (sentry) {
25
+ this.implementations.push(new sentry_add_on_1.SentryAddon(sentry));
26
+ }
27
+ }
28
+ }
29
+ exports.AddOnWrapper = AddOnWrapper;
@@ -0,0 +1,6 @@
1
+ import { INestApplication } from '@nestjs/common';
2
+ import { IAddOn } from '../../add-on.interface';
3
+ export declare class SecurityAddOn<T> implements IAddOn<T> {
4
+ apply(application: INestApplication<T>): void;
5
+ }
6
+ //# sourceMappingURL=security.add-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.add-on.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/security/security.add-on.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;IAChD,KAAK,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI;CAU9C"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecurityAddOn = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const helmet_1 = require("helmet");
6
+ class SecurityAddOn {
7
+ apply(application) {
8
+ application.enableCors();
9
+ application.use((0, helmet_1.default)());
10
+ application.useGlobalPipes(new common_1.ValidationPipe({
11
+ transform: true,
12
+ whitelist: false,
13
+ }));
14
+ }
15
+ }
16
+ exports.SecurityAddOn = SecurityAddOn;
@@ -0,0 +1,8 @@
1
+ import { Entity, type IResult } from '@ask-ell/core';
2
+ import { ISentryAddOnState } from './sentry.add-on.state.interface';
3
+ import { ISentryAddOn } from './sentry.add-on.interface';
4
+ export declare class SentryAddon<T> extends Entity<ISentryAddOnState> implements ISentryAddOn<T> {
5
+ checkStateValidity(): IResult<void>;
6
+ apply(): void;
7
+ }
8
+ //# sourceMappingURL=sentry.add-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry.add-on.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/sentry/sentry.add-on.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAM,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,qBAAa,WAAW,CAAC,CAAC,CACxB,SAAQ,MAAM,CAAC,iBAAiB,CAChC,YAAW,YAAY,CAAC,CAAC,CAAC;IAE1B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC,KAAK,IAAI,IAAI;CASd"}
@@ -1,8 +1,6 @@
1
1
  import { IEntity } from '@ask-ell/core';
2
-
3
2
  import { ISentryAddOnState } from './sentry.add-on.state.interface';
4
3
  import { IAddOn } from '../../add-on.interface';
5
-
6
- export interface ISentryAddOn<T>
7
- extends IEntity<ISentryAddOnState>,
8
- IAddOn<T> {}
4
+ export interface ISentryAddOn<T> extends IEntity<ISentryAddOnState>, IAddOn<T> {
5
+ }
6
+ //# sourceMappingURL=sentry.add-on.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry.add-on.interface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/sentry/sentry.add-on.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,YAAY,CAAC,CAAC,CAC7B,SAAQ,OAAO,CAAC,iBAAiB,CAAC,EAChC,MAAM,CAAC,CAAC,CAAC;CAAG"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SentryAddon = void 0;
4
+ const core_1 = require("@ask-ell/core");
5
+ const nest_1 = require("@ask-ell/nest");
6
+ class SentryAddon extends core_1.Entity {
7
+ checkStateValidity() {
8
+ return (0, core_1.ok)();
9
+ }
10
+ apply() {
11
+ const { host, projectId, publicKey } = this.getSnapshot();
12
+ new nest_1.NestSentryConfiguration({
13
+ publicKey,
14
+ host,
15
+ projectId,
16
+ }).init();
17
+ }
18
+ }
19
+ exports.SentryAddon = SentryAddon;
@@ -0,0 +1,6 @@
1
+ export interface ISentryAddOnState {
2
+ publicKey: string;
3
+ host: string;
4
+ projectId: string;
5
+ }
6
+ //# sourceMappingURL=sentry.add-on.state.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry.add-on.state.interface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/sentry/sentry.add-on.state.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Entity, type IResult } from '@ask-ell/core';
2
+ import { type INestApplication } from '@nestjs/common';
3
+ import { ISwaggerAddOnState } from './swagger.add-on.state.interface';
4
+ import { ISwaggerAddOn } from './swagger.add-on.interface';
5
+ export declare class SwaggerAddon<T> extends Entity<ISwaggerAddOnState> implements ISwaggerAddOn<T> {
6
+ private logger;
7
+ checkStateValidity(): IResult<void>;
8
+ apply(application: INestApplication<T>): void;
9
+ }
10
+ //# sourceMappingURL=swagger.add-on.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.add-on.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/swagger/swagger.add-on.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAEN,KAAK,OAAO,EAGb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,qBAAa,YAAY,CAAC,CAAC,CACzB,SAAQ,MAAM,CAAC,kBAAkB,CACjC,YAAW,aAAa,CAAC,CAAC,CAAC;IAE3B,OAAO,CAAC,MAAM,CAA+C;IAE7D,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC,KAAK,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI;CA6B9C"}
@@ -1,8 +1,6 @@
1
1
  import { IEntity } from '@ask-ell/core';
2
-
3
2
  import { ISwaggerAddOnState } from './swagger.add-on.state.interface';
4
3
  import { IAddOn } from '../../add-on.interface';
5
-
6
- export interface ISwaggerAddOn<T>
7
- extends IEntity<ISwaggerAddOnState>,
8
- IAddOn<T> {}
4
+ export interface ISwaggerAddOn<T> extends IEntity<ISwaggerAddOnState>, IAddOn<T> {
5
+ }
6
+ //# sourceMappingURL=swagger.add-on.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.add-on.interface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/swagger/swagger.add-on.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,aAAa,CAAC,CAAC,CAC9B,SAAQ,OAAO,CAAC,kBAAkB,CAAC,EACjC,MAAM,CAAC,CAAC,CAAC;CAAG"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwaggerAddon = void 0;
4
+ const core_1 = require("@ask-ell/core");
5
+ const nest_1 = require("@ask-ell/nest");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ class SwaggerAddon extends core_1.Entity {
8
+ logger = nest_1.NestLogger.fromClass(SwaggerAddon);
9
+ checkStateValidity() {
10
+ return (0, core_1.ok)();
11
+ }
12
+ apply(application) {
13
+ const { title, auths, enabledInProduction } = this.getSnapshot();
14
+ if (!enabledInProduction && !(0, core_1.isOnDevelopmentMode)()) {
15
+ return;
16
+ }
17
+ const documentBuilder = new swagger_1.DocumentBuilder().setTitle(title);
18
+ auths?.forEach((auth) => {
19
+ if (auth === 'bearer') {
20
+ documentBuilder.addBearerAuth();
21
+ }
22
+ });
23
+ const documentBuild = documentBuilder.build();
24
+ const documentFactory = () => swagger_1.SwaggerModule.createDocument(application, documentBuild);
25
+ swagger_1.SwaggerModule.setup('/swagger', application, documentFactory, {
26
+ customSiteTitle: title,
27
+ jsonDocumentUrl: '/swagger/json',
28
+ });
29
+ this.logger.log('Swagger initialized');
30
+ }
31
+ }
32
+ exports.SwaggerAddon = SwaggerAddon;
@@ -0,0 +1,7 @@
1
+ import { AuthMethod } from './types';
2
+ export interface ISwaggerAddOnState {
3
+ title: string;
4
+ auths?: AuthMethod[];
5
+ enabledInProduction?: boolean;
6
+ }
7
+ //# sourceMappingURL=swagger.add-on.state.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.add-on.state.interface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/swagger/swagger.add-on.state.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
1
  export type AuthMethod = 'bearer' | 'cookie';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/back-end/src/nest/add-ons/implementations/swagger/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,3 +4,4 @@ export * from './types';
4
4
  export * from './implementations/sentry/sentry.add-on.state.interface';
5
5
  export * from './implementations/swagger/swagger.add-on.state.interface';
6
6
  export * from './implementations/swagger/types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/add-ons/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,wDAAwD,CAAC;AACvE,cAAc,0DAA0D,CAAC;AACzE,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./add-on.interface"), exports);
5
+ tslib_1.__exportStar(require("./add-on.wrapper"), exports);
6
+ tslib_1.__exportStar(require("./types"), exports);
7
+ tslib_1.__exportStar(require("./implementations/sentry/sentry.add-on.state.interface"), exports);
8
+ tslib_1.__exportStar(require("./implementations/swagger/swagger.add-on.state.interface"), exports);
9
+ tslib_1.__exportStar(require("./implementations/swagger/types"), exports);
@@ -1,7 +1,7 @@
1
1
  import { ISentryAddOnState } from './implementations/sentry/sentry.add-on.state.interface';
2
2
  import { ISwaggerAddOnState } from './implementations/swagger/swagger.add-on.state.interface';
3
-
4
3
  export type AddOnWrapperParams = Partial<{
5
- swagger: ISwaggerAddOnState;
6
- sentry: ISentryAddOnState;
4
+ swagger: ISwaggerAddOnState;
5
+ sentry: ISentryAddOnState;
7
6
  }>;
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/add-ons/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAE9F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { DynamicModule, Provider } from '@nestjs/common';
2
+ export declare class ApplicationBase {
3
+ static withProviders(providers: Provider[]): DynamicModule;
4
+ }
5
+ //# sourceMappingURL=application.base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.base.d.ts","sourceRoot":"","sources":["../../../../../packages/back-end/src/nest/application.base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAIzE,qBAIa,eAAe;IAC1B,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,aAAa;CAQ3D"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationBase = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const modules_1 = require("./modules");
7
+ let ApplicationBase = (() => {
8
+ let _classDecorators = [(0, common_1.Global)(), (0, common_1.Module)({
9
+ imports: [modules_1.RequirementModule],
10
+ })];
11
+ let _classDescriptor;
12
+ let _classExtraInitializers = [];
13
+ let _classThis;
14
+ var ApplicationBase = class {
15
+ static { _classThis = this; }
16
+ static {
17
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
18
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
19
+ ApplicationBase = _classThis = _classDescriptor.value;
20
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
21
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
22
+ }
23
+ static withProviders(providers) {
24
+ const providersAndExports = [...providers];
25
+ return {
26
+ module: this,
27
+ providers: providersAndExports,
28
+ exports: [...providersAndExports],
29
+ };
30
+ }
31
+ };
32
+ return ApplicationBase = _classThis;
33
+ })();
34
+ exports.ApplicationBase = ApplicationBase;
@@ -0,0 +1,9 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { IServerProvider } from '@ask-ell/node';
3
+ import { AddOnWrapperParams } from './add-ons';
4
+ export type NestApplicationFactoryParams = {
5
+ addons: AddOnWrapperParams;
6
+ module: DynamicModule;
7
+ };
8
+ export declare function createNestApplication({ module, addons: addonsParams, }: NestApplicationFactoryParams): Promise<IServerProvider>;
9
+ //# sourceMappingURL=application.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.factory.d.ts","sourceRoot":"","sources":["../../../../../packages/back-end/src/nest/application.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAgB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,EACN,MAAM,EAAE,YAAY,GACrB,EAAE,4BAA4B,GAAG,OAAO,CAAC,eAAe,CAAC,CAQzD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNestApplication = createNestApplication;
4
+ const common_1 = require("@nestjs/common");
5
+ const core_1 = require("@nestjs/core");
6
+ const add_ons_1 = require("./add-ons");
7
+ async function createNestApplication({ module, addons: addonsParams, }) {
8
+ const application = await core_1.NestFactory.create(module, {
9
+ logger: new common_1.ConsoleLogger({
10
+ json: true,
11
+ }),
12
+ });
13
+ new add_ons_1.AddOnWrapper(addonsParams).apply(application);
14
+ return application;
15
+ }
@@ -0,0 +1,5 @@
1
+ import { type ExceptionFilter, type ArgumentsHost, HttpException } from '@nestjs/common';
2
+ export declare class HttpExceptionFilter implements ExceptionFilter {
3
+ catch(exception: HttpException, host: ArgumentsHost): void;
4
+ }
5
+ //# sourceMappingURL=http.exception.filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.exception.filter.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/filters/http.exception.filter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,aAAa,EACd,MAAM,gBAAgB,CAAC;AAMxB,qBACa,mBAAoB,YAAW,eAAe;IACzD,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;CAS3D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpExceptionFilter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ let HttpExceptionFilter = (() => {
7
+ let _classDecorators = [(0, common_1.Catch)(common_1.HttpException)];
8
+ let _classDescriptor;
9
+ let _classExtraInitializers = [];
10
+ let _classThis;
11
+ var HttpExceptionFilter = class {
12
+ static { _classThis = this; }
13
+ static {
14
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
15
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
16
+ HttpExceptionFilter = _classThis = _classDescriptor.value;
17
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
19
+ }
20
+ catch(exception, host) {
21
+ const context = host.switchToHttp();
22
+ const response = context.getResponse();
23
+ const status = exception.getStatus();
24
+ const responseData = {
25
+ message: exception.message,
26
+ };
27
+ response.status(status).json(responseData);
28
+ }
29
+ };
30
+ return HttpExceptionFilter = _classThis;
31
+ })();
32
+ exports.HttpExceptionFilter = HttpExceptionFilter;
@@ -1 +1,2 @@
1
1
  export * from './http.exception.filter';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/back-end/src/nest/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./http.exception.filter"), exports);
@@ -4,3 +4,4 @@ export * from './application.factory';
4
4
  export * from './filters';
5
5
  export * from './interceptors';
6
6
  export * from './modules';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/back-end/src/nest/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./add-ons"), exports);
5
+ tslib_1.__exportStar(require("./application.base"), exports);
6
+ tslib_1.__exportStar(require("./application.factory"), exports);
7
+ tslib_1.__exportStar(require("./filters"), exports);
8
+ tslib_1.__exportStar(require("./interceptors"), exports);
9
+ tslib_1.__exportStar(require("./modules"), exports);