@universal-packages/core-express-controllers-authentication 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { Authentication } from '@universal-packages/authentication';
2
+ import { CoreModule } from '@universal-packages/core';
3
+ import { ExpressControllerAuthenticationOptions } from '@universal-packages/express-controllers-authentication';
4
+ export default class AuthenticationModule extends CoreModule<ExpressControllerAuthenticationOptions> {
5
+ static readonly moduleName = "jobs-module";
6
+ static readonly description = "Background jobs core module wrapper";
7
+ static readonly defaultConfig: ExpressControllerAuthenticationOptions;
8
+ subject: Authentication;
9
+ prepare(): Promise<void>;
10
+ release(): Promise<void>;
11
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@universal-packages/core");
4
+ const express_controllers_authentication_1 = require("@universal-packages/express-controllers-authentication");
5
+ class AuthenticationModule extends core_1.CoreModule {
6
+ async prepare() {
7
+ const terminalTransport = this.logger.getTransport('terminal');
8
+ terminalTransport.options.categoryColors['AUTH'] = 'YELLOW';
9
+ this.subject = (await (0, express_controllers_authentication_1.initialize)(this.config)).instance;
10
+ this.subject.on('warning', (data) => {
11
+ this.logger.publish('WARNING', 'Authentication Dynamic waring', data.message, 'AUTH', { metadata: data });
12
+ });
13
+ await this.subject.loadDynamics();
14
+ }
15
+ async release() { }
16
+ }
17
+ exports.default = AuthenticationModule;
18
+ AuthenticationModule.moduleName = 'jobs-module';
19
+ AuthenticationModule.description = 'Background jobs core module wrapper';
20
+ AuthenticationModule.defaultConfig = { dynamicsLocation: './src', secret: 'default' };
21
+ //# sourceMappingURL=Authentication.universal-core-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Authentication.universal-core-module.js","sourceRoot":"","sources":["../src/Authentication.universal-core-module.ts"],"names":[],"mappings":";;AACA,mDAAqD;AACrD,+GAA2H;AAG3H,MAAqB,oBAAqB,SAAQ,iBAAkD;IAO3F,KAAK,CAAC,OAAO;QAClB,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAsB,CAAA;QACnF,iBAAiB,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAA;QAE3D,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,IAAA,+CAAU,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;QAEvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAS,EAAQ,EAAE;YAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,+BAA+B,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QAC3G,CAAC,CAAC,CAAA;QAEF,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAA;IACnC,CAAC;IAEM,KAAK,CAAC,OAAO,KAAmB,CAAC;;AApB1C,uCAqBC;AApBwB,+BAAU,GAAG,aAAa,CAAA;AAC1B,gCAAW,GAAG,qCAAqC,CAAA;AACnD,kCAAa,GAA2C,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { CoreTask } from '@universal-packages/core';
2
+ export default class AuthenticationTask extends CoreTask {
3
+ static readonly taskName = "authentication-task";
4
+ static readonly description = "Authentication related tasks";
5
+ exec(): Promise<void>;
6
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const core_1 = require("@universal-packages/core");
7
+ const template_populator_1 = require("@universal-packages/template-populator");
8
+ const path_1 = __importDefault(require("path"));
9
+ class AuthenticationTask extends core_1.CoreTask {
10
+ async exec() {
11
+ switch (this.directive) {
12
+ case 'init':
13
+ if (this.args.ts) {
14
+ await (0, template_populator_1.populateTemplates)(path_1.default.resolve(__dirname, 'template-ts'), './src', { override: this.args.f });
15
+ }
16
+ else {
17
+ await (0, template_populator_1.populateTemplates)(path_1.default.resolve(__dirname, 'template'), './src', { override: this.args.f });
18
+ }
19
+ this.logger.publish('INFO', 'Authentication template initialized');
20
+ break;
21
+ default:
22
+ throw new Error(`Unrecognized directive ${this.directive}`);
23
+ }
24
+ }
25
+ }
26
+ exports.default = AuthenticationTask;
27
+ AuthenticationTask.taskName = 'authentication-task';
28
+ AuthenticationTask.description = 'Authentication related tasks';
29
+ //# sourceMappingURL=Authentication.universal-core-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Authentication.universal-core-task.js","sourceRoot":"","sources":["../src/Authentication.universal-core-task.ts"],"names":[],"mappings":";;;;;AAAA,mDAAmD;AACnD,+EAA0E;AAC1E,gDAAuB;AAEvB,MAAqB,kBAAmB,SAAQ,eAAQ;IAI/C,KAAK,CAAC,IAAI;QACf,QAAQ,IAAI,CAAC,SAAS,EAAE;YACtB,KAAK,MAAM;gBACT,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;oBAChB,MAAM,IAAA,sCAAiB,EAAC,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;iBACpG;qBAAM;oBACL,MAAM,IAAA,sCAAiB,EAAC,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;iBACjG;gBAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,qCAAqC,CAAC,CAAA;gBAClE,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;SAC9D;IACH,CAAC;;AAlBH,qCAmBC;AAlBwB,2BAAQ,GAAG,qBAAqB,CAAA;AAChC,8BAAW,GAAG,8BAA8B,CAAA"}
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022-present David De Anda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Core Express Controllers Authentication
2
+
3
+ [![npm version](https://badge.fury.io/js/@universal-packages%2Fcore-express-controllers-authentication.svg)](https://www.npmjs.com/package/@universal-packages/core-express-controllers-authentication)
4
+ [![Testing](https://github.com/universal-packages/universal-core-express-controllers-authentication/actions/workflows/testing.yml/badge.svg)](https://github.com/universal-packages/universal-core-express-controllers-authentication/actions/workflows/testing.yml)
5
+ [![codecov](https://codecov.io/gh/universal-packages/universal-core-express-controllers-authentication/branch/main/graph/badge.svg?token=CXPJSN8IGL)](https://codecov.io/gh/universal-packages/universal-core-express-controllers-authentication)
6
+
7
+ [Express Controllers Authentication](https://github.com/universal-packages/universal-express-controllers-authentication) universal-core module abstraction.
8
+
9
+ ## Install
10
+
11
+ ```shell
12
+ npm install @universal-packages/core-express-controllers-authentication
13
+
14
+ npm install @universal-packages/core-express-controllers
15
+ ```
16
+
17
+ ## Initialization
18
+
19
+ ```shell
20
+ ucore exec authentication-task init
21
+ ucore exec authentication-task init -ts
22
+ ```
23
+
24
+ ## Running App
25
+
26
+ This a complement module that works along side the express app available in universal-express-controllers core app.
27
+
28
+ ```
29
+ ucore run express-app
30
+ ```
31
+
32
+ ## Typescript
33
+
34
+ This library is developed in TypeScript and shipped fully typed.
35
+
36
+ ## Contributing
37
+
38
+ The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.
39
+
40
+ - [Code of Conduct](./CODE_OF_CONDUCT.md)
41
+ - [Contributing Guide](./CONTRIBUTING.md)
42
+
43
+ ### License
44
+
45
+ [MIT licensed](./LICENSE).
package/globals.d.ts ADDED
@@ -0,0 +1 @@
1
+ declare var authenticationSubject: import('@universal-packages/authentication').Authentication;
package/globals.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=globals.js.map
package/globals.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":""}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as AuthenticationModule } from './Authentication.universal-core-module';
2
+ import './globals';
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuthenticationModule = void 0;
7
+ var Authentication_universal_core_module_1 = require("./Authentication.universal-core-module");
8
+ Object.defineProperty(exports, "AuthenticationModule", { enumerable: true, get: function () { return __importDefault(Authentication_universal_core_module_1).default; } });
9
+ require("./globals");
10
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+FAAwF;AAA/E,6JAAA,OAAO,OAAwB;AAExC,qBAAkB"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@universal-packages/core-express-controllers-authentication",
3
+ "version": "1.0.0",
4
+ "description": "Express Controllers Authentication universal-core module abstraction.",
5
+ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",
6
+ "license": "MIT",
7
+ "main": "index.js",
8
+ "types": "index.d.ts",
9
+ "repository": "git://git@github.com/universal-packages/universal-core-express-controllers-authentication.git",
10
+ "scripts": {
11
+ "build": "tsc --p tsconfig.dis.json",
12
+ "test": "jest --watch",
13
+ "test:full": "jest --coverage --verbose",
14
+ "test:clear": "jest --clearCache"
15
+ },
16
+ "dependencies": {
17
+ "@universal-packages/authentication": "^1.3.2",
18
+ "@universal-packages/express-controllers-authentication": "^1.0.1"
19
+ },
20
+ "peerDependencies": {
21
+ "@universal-packages/core": "^1.10.4",
22
+ "@universal-packages/core-express-controllers": "^1.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/express": "^4.17.14",
26
+ "@types/jest": "^28.1.0",
27
+ "@types/node": "^17.0.39",
28
+ "@types/uuid": "^8.3.4",
29
+ "jest": "^28.1.0",
30
+ "jest-circus": "^28.1.0",
31
+ "ts-jest": "^28.0.4",
32
+ "typescript": "^4.7.3"
33
+ },
34
+ "jest": {
35
+ "testRunner": "jest-circus/runner",
36
+ "transform": {
37
+ "^.+\\.(ts|tsx)$": "ts-jest"
38
+ },
39
+ "testRegex": "(/tests/.*\\.test\\.ts?)$",
40
+ "collectCoverageFrom": [
41
+ "src/**/*.ts"
42
+ ],
43
+ "setupFilesAfterEnv": [
44
+ "<rootDir>/tests/setupTests.ts"
45
+ ],
46
+ "watchPathIgnorePatterns": [
47
+ "<rootDir>/tmp"
48
+ ]
49
+ },
50
+ "prettier": {
51
+ "semi": false,
52
+ "singleQuote": true,
53
+ "printWidth": 180,
54
+ "trailingComma": "none"
55
+ }
56
+ }