@dvsa/appdev-api-common 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  import type { APIGatewayEvent, Context } from "aws-lambda";
2
-
3
2
  export interface APIGatewayModel {
4
- event: APIGatewayEvent;
5
- context: Context;
3
+ event: APIGatewayEvent;
4
+ context: Context;
6
5
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ export declare enum HttpStatus {
2
+ OK = 200,
3
+ CREATED = 201,
4
+ ACCEPTED = 202,
5
+ NO_CONTENT = 204,
6
+ NOT_MODIFIED = 304,
7
+ BAD_REQUEST = 400,
8
+ UNAUTHORIZED = 401,
9
+ FORBIDDEN = 403,
10
+ NOT_FOUND = 404,
11
+ INTERNAL_SERVER_ERROR = 500,
12
+ BAD_GATEWAY = 502,
13
+ GATEWAY_TIMEOUT = 504
14
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpStatus = void 0;
4
+ var HttpStatus;
5
+ (function (HttpStatus) {
6
+ HttpStatus[HttpStatus["OK"] = 200] = "OK";
7
+ HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
8
+ HttpStatus[HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
9
+ HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
10
+ HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
11
+ HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
12
+ HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
13
+ HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
14
+ HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
15
+ HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
16
+ HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
17
+ HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
18
+ })(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
@@ -0,0 +1,14 @@
1
+ import type { Request } from "express";
2
+ import type { Action } from "routing-controllers";
3
+ import type { APIGatewayModel } from "../api/api-gateway-model";
4
+ export type RoutingControllersRequest = Request & {
5
+ apiGateway: APIGatewayModel;
6
+ };
7
+ export declare class JWTAuthChecker {
8
+ /**
9
+ * Perform a JWT token verification and role check
10
+ * @param {RoutingControllersRequest} request
11
+ * @param roles
12
+ */
13
+ static execute({ request }: Action, roles?: string | string[]): Promise<boolean>;
14
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JWTAuthChecker = void 0;
4
+ const http_status_codes_1 = require("../api/http-status-codes");
5
+ const auth_errors_1 = require("./auth-errors");
6
+ const verify_jwt_1 = require("./verify-jwt");
7
+ // biome-ignore lint/complexity/noStaticOnlyClass: this class will be extended in the future
8
+ class JWTAuthChecker {
9
+ /**
10
+ * Perform a JWT token verification and role check
11
+ * @param {RoutingControllersRequest} request
12
+ * @param roles
13
+ */
14
+ static async execute({ request }, roles = []) {
15
+ // if running locally, skip the token auth and role check
16
+ if (process.env.IS_OFFLINE === "true")
17
+ return true;
18
+ // extract the token from the request headers
19
+ const token = request?.apiGateway.event
20
+ .headers?.Authorization;
21
+ // if no token is found, then deny access to resource
22
+ if (!token || token.trim()?.length === 0) {
23
+ throw new auth_errors_1.AuthError(http_status_codes_1.HttpStatus.UNAUTHORIZED, "Missing Authorization header");
24
+ }
25
+ // create an instance of the JwtAuthoriser class
26
+ const authoriser = new verify_jwt_1.JwtAuthoriser();
27
+ // Validate the token and extract the roles from it
28
+ const { roles: tokenRoles } = await authoriser.verify(token);
29
+ // check if a singular or list of roles were passed into the @Authorized decorator & remove nullish values
30
+ const requiredRoles = (Array.isArray(roles) ? roles : [roles]).filter((role) => !!role);
31
+ // if there are no requiredRoles, then any valid token can access the resource, so return true
32
+ if (requiredRoles.length === 0)
33
+ return true;
34
+ // if there are no roles in JWT token but roles are required, then deny access
35
+ if (!tokenRoles || !Array.isArray(tokenRoles) || tokenRoles.length === 0) {
36
+ throw new auth_errors_1.AuthError(http_status_codes_1.HttpStatus.UNAUTHORIZED, "No roles found in token", "MISSING_ROLES");
37
+ }
38
+ // check if one of the required roles is present in JWT token
39
+ const success = requiredRoles.some((role) => tokenRoles.includes(role));
40
+ if (!success) {
41
+ throw new auth_errors_1.AuthError(http_status_codes_1.HttpStatus.UNAUTHORIZED, "Insufficient permissions", "UNAUTHORIZED", {
42
+ required: requiredRoles,
43
+ actual: tokenRoles,
44
+ });
45
+ }
46
+ return true;
47
+ }
48
+ }
49
+ exports.JWTAuthChecker = JWTAuthChecker;
@@ -0,0 +1,21 @@
1
+ import { HttpStatus } from "../api/http-status-codes";
2
+ type RoleInfo = {
3
+ required: string[];
4
+ actual: string[];
5
+ };
6
+ export declare class AuthError extends Error {
7
+ private readonly statusCode;
8
+ private readonly code;
9
+ private readonly roleInfo?;
10
+ constructor(statusCode?: HttpStatus, message?: string, code?: string, roleInfo?: RoleInfo | undefined);
11
+ toJSON(): {
12
+ error: {
13
+ name: string;
14
+ code: string;
15
+ message: string;
16
+ statusCode: number;
17
+ roleInfo: RoleInfo | undefined;
18
+ };
19
+ };
20
+ }
21
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthError = void 0;
4
+ const http_status_codes_1 = require("../api/http-status-codes");
5
+ class AuthError extends Error {
6
+ statusCode;
7
+ code;
8
+ roleInfo;
9
+ constructor(statusCode = http_status_codes_1.HttpStatus.UNAUTHORIZED, message = "Authorization failed", code = "UNAUTHORIZED", roleInfo = undefined) {
10
+ super(message);
11
+ this.statusCode = statusCode;
12
+ this.code = code;
13
+ this.name = "AuthError";
14
+ this.roleInfo = roleInfo ?? undefined;
15
+ if (Error.captureStackTrace) {
16
+ Error.captureStackTrace(this, AuthError);
17
+ }
18
+ }
19
+ toJSON() {
20
+ return {
21
+ error: {
22
+ name: this.name,
23
+ code: this.code,
24
+ message: this.message,
25
+ statusCode: this.statusCode,
26
+ roleInfo: this.roleInfo,
27
+ },
28
+ };
29
+ }
30
+ }
31
+ exports.AuthError = AuthError;
@@ -0,0 +1,14 @@
1
+ import { type JWTPayload } from "jose";
2
+ export declare class JwtAuthoriser {
3
+ private readonly clientId;
4
+ private static readonly ENV;
5
+ private static readonly tokenExpiryEnvExclusionList;
6
+ private static readonly JWKS_URI;
7
+ private static JWKS;
8
+ constructor(clientId?: string | null);
9
+ /**
10
+ * Validate a JWT and return the decoded payload
11
+ * @returns {Promise<JWTPayload>}
12
+ */
13
+ verify(token: string): Promise<JWTPayload>;
14
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JwtAuthoriser = void 0;
4
+ const jose_1 = require("jose");
5
+ const http_status_codes_1 = require("../api/http-status-codes");
6
+ const auth_errors_1 = require("./auth-errors");
7
+ class JwtAuthoriser {
8
+ clientId;
9
+ static ENV = process.env.environment?.toUpperCase() ?? "";
10
+ static tokenExpiryEnvExclusionList = [
11
+ "DEVELOPMENT",
12
+ "NON-PROD",
13
+ ];
14
+ static JWKS_URI = new URL("https://login.microsoftonline.com/common/discovery/keys");
15
+ static JWKS = (0, jose_1.createRemoteJWKSet)(JwtAuthoriser.JWKS_URI);
16
+ constructor(clientId = null) {
17
+ this.clientId = clientId;
18
+ }
19
+ /**
20
+ * Validate a JWT and return the decoded payload
21
+ * @returns {Promise<JWTPayload>}
22
+ */
23
+ async verify(token) {
24
+ try {
25
+ const opts = {
26
+ clockTolerance: 10,
27
+ algorithms: ["RS256"],
28
+ };
29
+ // issuer validation is handled automatically if present in token
30
+ if (this.clientId) {
31
+ opts.audience = this.clientId;
32
+ }
33
+ if (JwtAuthoriser.tokenExpiryEnvExclusionList.includes(JwtAuthoriser.ENV)) {
34
+ opts.maxTokenAge = Number.POSITIVE_INFINITY;
35
+ }
36
+ const { payload } = await (0, jose_1.jwtVerify)(token, JwtAuthoriser.JWKS, opts);
37
+ return payload;
38
+ }
39
+ catch (err) {
40
+ const error = err;
41
+ const code = "code" in error ? error.code : "";
42
+ throw new auth_errors_1.AuthError(http_status_codes_1.HttpStatus.UNAUTHORIZED, err.message, code);
43
+ }
44
+ }
45
+ }
46
+ exports.JwtAuthoriser = JwtAuthoriser;
package/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api/http-status-codes"), exports);
18
+ __exportStar(require("./auth/auth-checker"), exports);
19
+ __exportStar(require("./auth/auth-errors"), exports);
20
+ __exportStar(require("./auth/verify-jwt"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvsa/appdev-api-common",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "keywords": [
5
5
  "dvsa",
6
6
  "nodejs",
@@ -8,15 +8,25 @@
8
8
  ],
9
9
  "author": "DVSA",
10
10
  "description": "Utils library for common API functionality",
11
+ "publishConfig": {
12
+ "directory": "dist",
13
+ "access": "public"
14
+ },
11
15
  "scripts": {
16
+ "clean": "rimraf coverage dist",
17
+ "clean:temp": "rimraf auth api",
12
18
  "lint": "biome check src",
13
- "lint:fix": "npm run lint -- --write"
19
+ "lint:fix": "npm run lint -- --write",
20
+ "build": "npm run clean && tsc",
21
+ "build:package": "npm run build",
22
+ "prepublishOnly": "npm run build:package && cp -r ./dist/* . && rm -rf ./dist",
23
+ "postpublish": "git clean -fd && npm run clean:temp"
14
24
  },
15
25
  "dependencies": {
16
26
  "jose": "^5.9.6"
17
27
  },
18
28
  "devDependencies": {
19
- "@biomejs/biome": "1.8.3",
29
+ "@biomejs/biome": "1.9.3",
20
30
  "@dvsa/biome-config": "0.3.0",
21
31
  "@types/aws-lambda": "^8.10.145",
22
32
  "@types/express": "^5.0.0",
@@ -1,14 +0,0 @@
1
- export enum HttpStatus {
2
- OK = 200,
3
- CREATED = 201,
4
- ACCEPTED = 202,
5
- NO_CONTENT = 204,
6
- NOT_MODIFIED = 304,
7
- BAD_REQUEST = 400,
8
- UNAUTHORIZED = 401,
9
- FORBIDDEN = 403,
10
- NOT_FOUND = 404,
11
- INTERNAL_SERVER_ERROR = 500,
12
- BAD_GATEWAY = 502,
13
- GATEWAY_TIMEOUT = 504,
14
- }
@@ -1,78 +0,0 @@
1
- import type { Request } from "express";
2
- import type { Action } from "routing-controllers";
3
- import type { APIGatewayModel } from "../api/api-gateway-model";
4
- import { HttpStatus } from "../api/http-status-codes";
5
- import { AuthError } from "./auth-errors";
6
- import { JwtAuthoriser } from "./verify-jwt";
7
-
8
- export type RoutingControllersRequest = Request & {
9
- apiGateway: APIGatewayModel;
10
- };
11
-
12
- // biome-ignore lint/complexity/noStaticOnlyClass: this class will be extended in the future
13
- export class JWTAuthChecker {
14
- /**
15
- * Perform a JWT token verification and role check
16
- * @param {RoutingControllersRequest} request
17
- * @param roles
18
- */
19
- static async execute(
20
- { request }: Action,
21
- roles: string | string[] = [],
22
- ): Promise<boolean> {
23
- // if running locally, skip the token auth and role check
24
- if (process.env.IS_OFFLINE === "true") return true;
25
-
26
- // extract the token from the request headers
27
- const token = (request as RoutingControllersRequest)?.apiGateway.event
28
- .headers?.Authorization;
29
-
30
- // if no token is found, then deny access to resource
31
- if (!token || token.trim()?.length === 0) {
32
- throw new AuthError(
33
- HttpStatus.UNAUTHORIZED,
34
- "Missing Authorization header",
35
- );
36
- }
37
-
38
- // create an instance of the JwtAuthoriser class
39
- const authoriser = new JwtAuthoriser();
40
-
41
- // Validate the token and extract the roles from it
42
- const { roles: tokenRoles } = await authoriser.verify(token);
43
-
44
- // check if a singular or list of roles were passed into the @Authorized decorator & remove nullish values
45
- const requiredRoles = (Array.isArray(roles) ? roles : [roles]).filter(
46
- (role) => !!role,
47
- );
48
-
49
- // if there are no requiredRoles, then any valid token can access the resource, so return true
50
- if (requiredRoles.length === 0) return true;
51
-
52
- // if there are no roles in JWT token but roles are required, then deny access
53
- if (!tokenRoles || !Array.isArray(tokenRoles) || tokenRoles.length === 0) {
54
- throw new AuthError(
55
- HttpStatus.UNAUTHORIZED,
56
- "No roles found in token",
57
- "MISSING_ROLES",
58
- );
59
- }
60
-
61
- // check if one of the required roles is present in JWT token
62
- const success = requiredRoles.some((role) => tokenRoles.includes(role));
63
-
64
- if (!success) {
65
- throw new AuthError(
66
- HttpStatus.UNAUTHORIZED,
67
- "Insufficient permissions",
68
- "UNAUTHORIZED",
69
- {
70
- required: requiredRoles,
71
- actual: tokenRoles,
72
- },
73
- );
74
- }
75
-
76
- return true;
77
- }
78
- }
@@ -1,38 +0,0 @@
1
- import { HttpStatus } from "../api/http-status-codes";
2
-
3
- type RoleInfo = { required: string[]; actual: string[] };
4
-
5
- export class AuthError extends Error {
6
- private readonly statusCode: number;
7
- private readonly code: string;
8
- private readonly roleInfo?: RoleInfo;
9
-
10
- constructor(
11
- statusCode = HttpStatus.UNAUTHORIZED,
12
- message = "Authorization failed",
13
- code = "UNAUTHORIZED",
14
- roleInfo: RoleInfo | undefined = undefined,
15
- ) {
16
- super(message);
17
- this.statusCode = statusCode;
18
- this.code = code;
19
- this.name = "AuthError";
20
- this.roleInfo = roleInfo ?? undefined;
21
-
22
- if (Error.captureStackTrace) {
23
- Error.captureStackTrace(this, AuthError);
24
- }
25
- }
26
-
27
- public toJSON() {
28
- return {
29
- error: {
30
- name: this.name,
31
- code: this.code,
32
- message: this.message,
33
- statusCode: this.statusCode,
34
- roleInfo: this.roleInfo,
35
- },
36
- };
37
- }
38
- }
@@ -1,63 +0,0 @@
1
- import {
2
- type JWTPayload,
3
- type JWTVerifyOptions,
4
- createRemoteJWKSet,
5
- jwtVerify,
6
- } from "jose";
7
- import { HttpStatus } from "../api/http-status-codes";
8
- import { AuthError } from "./auth-errors";
9
-
10
- export class JwtAuthoriser {
11
- private readonly clientId: string | null;
12
- private static readonly ENV = process.env.environment?.toUpperCase() ?? "";
13
- private static readonly tokenExpiryEnvExclusionList = [
14
- "DEVELOPMENT",
15
- "NON-PROD",
16
- ];
17
- private static readonly JWKS_URI = new URL(
18
- "https://login.microsoftonline.com/common/discovery/keys",
19
- );
20
- private static JWKS = createRemoteJWKSet(JwtAuthoriser.JWKS_URI);
21
-
22
- public constructor(clientId: string | null = null) {
23
- this.clientId = clientId;
24
- }
25
-
26
- /**
27
- * Validate a JWT and return the decoded payload
28
- * @returns {Promise<JWTPayload>}
29
- */
30
- public async verify(token: string): Promise<JWTPayload> {
31
- try {
32
- const opts: JWTVerifyOptions = {
33
- clockTolerance: 10,
34
- algorithms: ["RS256"],
35
- };
36
-
37
- // issuer validation is handled automatically if present in token
38
- if (this.clientId) {
39
- opts.audience = this.clientId;
40
- }
41
-
42
- if (
43
- JwtAuthoriser.tokenExpiryEnvExclusionList.includes(JwtAuthoriser.ENV)
44
- ) {
45
- opts.maxTokenAge = Number.POSITIVE_INFINITY;
46
- }
47
-
48
- const { payload } = await jwtVerify(token, JwtAuthoriser.JWKS, opts);
49
-
50
- return payload;
51
- } catch (err) {
52
- const error = err as { code?: string };
53
-
54
- const code = "code" in error ? error.code : "";
55
-
56
- throw new AuthError(
57
- HttpStatus.UNAUTHORIZED,
58
- (err as Error).message,
59
- code,
60
- );
61
- }
62
- }
63
- }
package/tsconfig.json DELETED
@@ -1,120 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "ES2022",
15
- /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
16
- "lib": ["ES2022"],
17
- /* Specify a set of bundled library declaration files that describe the target runtime environment. */
18
- // "jsx": "preserve", /* Specify what JSX code is generated. */
19
- "experimentalDecorators": true,
20
- /* Enable experimental support for legacy experimental decorators. */
21
- "emitDecoratorMetadata": true,
22
- /* Emit design-type metadata for decorated declarations in source files. */
23
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
24
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
25
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
26
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
27
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
28
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
29
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
30
-
31
- /* Modules */
32
- "module": "CommonJS",
33
- /* Specify what module code is generated. */
34
- // "rootDir": "./", /* Specify the root folder within your source files. */
35
- // "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
36
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
37
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
38
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
39
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
40
- "types": ["node", "jest"],
41
- /* Specify type package names to be included without being referenced in a source file. */
42
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
43
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
44
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
45
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
46
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
47
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
48
- // "resolveJsonModule": true, /* Enable importing .json files. */
49
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
50
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
51
-
52
- /* JavaScript Support */
53
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
54
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
55
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
56
-
57
- /* Emit */
58
- "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
59
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
60
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
61
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
62
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
63
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
64
- "outDir": "./dist" /* Specify an output folder for all emitted files. */,
65
- // "removeComments": true, /* Disable emitting comments. */
66
- // "noEmit": true, /* Disable emitting files from a compilation. */
67
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
68
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
69
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
70
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
71
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
72
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
73
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
74
- // "newLine": "crlf", /* Set the newline character for emitting files. */
75
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
76
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
77
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
78
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
79
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
80
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
81
-
82
- /* Interop Constraints */
83
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
84
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
85
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
86
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
87
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
88
- "forceConsistentCasingInFileNames": true,
89
- /* Ensure that casing is correct in imports. */
90
-
91
- /* Type Checking */
92
- "strict": true,
93
- /* Enable all strict type-checking options. */
94
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
95
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
96
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
97
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
98
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
99
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
100
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
101
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
102
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
103
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
104
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
105
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
106
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
107
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
108
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
109
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
110
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
111
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
112
-
113
- /* Completeness */
114
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
115
- "skipLibCheck": true
116
- /* Skip type checking all .d.ts files. */
117
- },
118
- "include": ["src/**/*.ts"],
119
- "exclude": ["node_modules", "src/**/*.spec.ts", "src/**/*.spec.d.ts"]
120
- }
File without changes