ngrx-entity-crud 12.0.6-beta.2
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/README.md +259 -0
- package/bundles/ngrx-entity-crud.umd.js +1829 -0
- package/bundles/ngrx-entity-crud.umd.js.map +1 -0
- package/esm2015/lib/actions.js +88 -0
- package/esm2015/lib/base-crud-gql.service.js +71 -0
- package/esm2015/lib/base-crud.service.js +136 -0
- package/esm2015/lib/create_adapter.js +14 -0
- package/esm2015/lib/effect.js +467 -0
- package/esm2015/lib/entity_state.js +23 -0
- package/esm2015/lib/ibase-crud-service.js +2 -0
- package/esm2015/lib/j-ngrx-filter.js +133 -0
- package/esm2015/lib/models.js +17 -0
- package/esm2015/lib/reducer.js +353 -0
- package/esm2015/lib/state_selectors.js +56 -0
- package/esm2015/lib/utils.js +19 -0
- package/esm2015/ngrx-entity-crud.js +5 -0
- package/esm2015/public-api.js +7 -0
- package/fesm2015/ngrx-entity-crud.js +1367 -0
- package/fesm2015/ngrx-entity-crud.js.map +1 -0
- package/lib/actions.d.ts +5 -0
- package/lib/actions.d.ts.map +1 -0
- package/lib/base-crud-gql.service.d.ts +19 -0
- package/lib/base-crud-gql.service.d.ts.map +1 -0
- package/lib/base-crud.service.d.ts +34 -0
- package/lib/base-crud.service.d.ts.map +1 -0
- package/lib/create_adapter.d.ts +6 -0
- package/lib/create_adapter.d.ts.map +1 -0
- package/lib/effect.d.ts +132 -0
- package/lib/effect.d.ts.map +1 -0
- package/lib/entity_state.d.ts +9 -0
- package/lib/entity_state.d.ts.map +1 -0
- package/lib/ibase-crud-service.d.ts +13 -0
- package/lib/ibase-crud-service.d.ts.map +1 -0
- package/lib/j-ngrx-filter.d.ts +14 -0
- package/lib/j-ngrx-filter.d.ts.map +1 -0
- package/lib/models.d.ts +494 -0
- package/lib/models.d.ts.map +1 -0
- package/lib/reducer.d.ts +11 -0
- package/lib/reducer.d.ts.map +1 -0
- package/lib/state_selectors.d.ts +5 -0
- package/lib/state_selectors.d.ts.map +1 -0
- package/lib/utils.d.ts +8 -0
- package/lib/utils.d.ts.map +1 -0
- package/ngrx-entity-crud.d.ts +5 -0
- package/ngrx-entity-crud.d.ts.map +1 -0
- package/ngrx-entity-crud.metadata.json +1 -0
- package/package.json +41 -0
- package/public-api.d.ts +7 -0
- package/public-api.d.ts.map +1 -0
- package/schematics/auth/files/model/auth.ts +17 -0
- package/schematics/auth/files/store/auth-store/actions.ts +30 -0
- package/schematics/auth/files/store/auth-store/auth-mock.service.ts +95 -0
- package/schematics/auth/files/store/auth-store/auth-store.module.ts +34 -0
- package/schematics/auth/files/store/auth-store/auth.guard.ts +44 -0
- package/schematics/auth/files/store/auth-store/auth.service.ts +28 -0
- package/schematics/auth/files/store/auth-store/conf.ts +2 -0
- package/schematics/auth/files/store/auth-store/effects.ts +53 -0
- package/schematics/auth/files/store/auth-store/index.d.ts +13 -0
- package/schematics/auth/files/store/auth-store/index.ts +13 -0
- package/schematics/auth/files/store/auth-store/names.ts +3 -0
- package/schematics/auth/files/store/auth-store/reducer.ts +16 -0
- package/schematics/auth/files/store/auth-store/selectors.ts +51 -0
- package/schematics/auth/files/store/auth-store/state.ts +16 -0
- package/schematics/auth/files/views/login/components/logout-button/logout-button.component.ts +49 -0
- package/schematics/auth/files/views/login/login-main/login-main.component.html +25 -0
- package/schematics/auth/files/views/login/login-main/login-main.component.ts +57 -0
- package/schematics/auth/files/views/login/login-routing.module.ts +30 -0
- package/schematics/auth/files/views/login/login.module.ts +30 -0
- package/schematics/auth/index.d.ts +2 -0
- package/schematics/auth/index.js +77 -0
- package/schematics/auth/index.js.map +1 -0
- package/schematics/auth/schema.json +21 -0
- package/schematics/auth0/files/store/auth-store/actions.ts +21 -0
- package/schematics/auth0/files/store/auth-store/auth-store.module.ts +32 -0
- package/schematics/auth0/files/store/auth-store/auth.guard.ts +44 -0
- package/schematics/auth0/files/store/auth-store/authentication.service.ts +32 -0
- package/schematics/auth0/files/store/auth-store/conf.ts +2 -0
- package/schematics/auth0/files/store/auth-store/effects.ts +59 -0
- package/schematics/auth0/files/store/auth-store/index.d.ts +13 -0
- package/schematics/auth0/files/store/auth-store/index.ts +13 -0
- package/schematics/auth0/files/store/auth-store/login.component.ts +75 -0
- package/schematics/auth0/files/store/auth-store/names.ts +3 -0
- package/schematics/auth0/files/store/auth-store/profile.ts +12 -0
- package/schematics/auth0/files/store/auth-store/reducer.ts +23 -0
- package/schematics/auth0/files/store/auth-store/selectors.ts +24 -0
- package/schematics/auth0/files/store/auth-store/state.ts +11 -0
- package/schematics/auth0/index.d.ts +2 -0
- package/schematics/auth0/index.js +67 -0
- package/schematics/auth0/index.js.map +1 -0
- package/schematics/auth0/schema.json +21 -0
- package/schematics/collection.json +30 -0
- package/schematics/my-utility.d.ts +58 -0
- package/schematics/my-utility.js +257 -0
- package/schematics/my-utility.js.map +1 -0
- package/schematics/ng-add/files/root-store/index.d.ts +8 -0
- package/schematics/ng-add/files/root-store/index.ts +8 -0
- package/schematics/ng-add/files/root-store/root-reducer.ts +11 -0
- package/schematics/ng-add/files/root-store/root-store.module.ts +29 -0
- package/schematics/ng-add/files/root-store/router-store/actions.ts +27 -0
- package/schematics/ng-add/files/root-store/router-store/effects.ts +65 -0
- package/schematics/ng-add/files/root-store/router-store/index.d.ts +11 -0
- package/schematics/ng-add/files/root-store/router-store/index.ts +11 -0
- package/schematics/ng-add/files/root-store/router-store/pop-up-base.component.ts +83 -0
- package/schematics/ng-add/files/root-store/router-store/pop-up-base.module.ts +24 -0
- package/schematics/ng-add/files/root-store/router-store/reducer.ts +31 -0
- package/schematics/ng-add/files/root-store/router-store/router-store.module.ts +30 -0
- package/schematics/ng-add/files/root-store/router-store/selectors.ts +63 -0
- package/schematics/ng-add/files/root-store/router-store/state.ts +18 -0
- package/schematics/ng-add/files/root-store/selectors.ts +20 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/actions.ts +11 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/effects.ts +10 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/index.d.ts +13 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/index.ts +13 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/names.ts +3 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/operators.ts +24 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/reducer.ts +8 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/selectors.ts +41 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/slide-menu-store.module.ts +27 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/state.ts +14 -0
- package/schematics/ng-add/files/root-store/state.ts +5 -0
- package/schematics/ng-add/index.d.ts +2 -0
- package/schematics/ng-add/index.js +78 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.json +22 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +52 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +57 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +7 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +50 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +15 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +23 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +36 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__.module.ts +33 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +16 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +27 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +18 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +36 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__.module.ts +26 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +38 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +50 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +30 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +101 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +12 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +21 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +37 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__.module.ts +49 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-create-many-test-__clazz@dasherize__.component.ts +46 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-delete-__clazz@dasherize__.component.ts +35 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-edit-many-test-__clazz@dasherize__.component.ts +45 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-new-__clazz@dasherize__.component.ts +45 -0
- package/schematics/section/index.d.ts +2 -0
- package/schematics/section/index.js +56 -0
- package/schematics/section/index.js.map +1 -0
- package/schematics/section/schema.json +39 -0
- package/schematics/store/files/base-model/__clazz@dasherize__.ts +8 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__-store.module.ts +26 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.actions.ts +9 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.effects.ts +11 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.names.ts +3 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.reducer.ts +8 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.selectors.ts +18 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.state.ts +6 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/index.d.ts +13 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/index.ts +13 -0
- package/schematics/store/files/crud-graphql/__clazz@dasherize__-store/__clazz@dasherize__.criteria.ts +39 -0
- package/schematics/store/files/crud-graphql/__clazz@dasherize__-store/__clazz@dasherize__.graphql +34 -0
- package/schematics/store/files/crud-model/__clazz@dasherize__.ts +8 -0
- package/schematics/store/files/crud-service/__clazz@dasherize__.service.ts +11 -0
- package/schematics/store/files/crud-service-graphql/__clazz@dasherize__.service.ts +16 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__-store.module.ts +26 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.actions.ts +55 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.effects.ts +90 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.names.ts +3 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.reducer.ts +103 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.selectors.ts +26 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.state.ts +11 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/index.d.ts +15 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/index.ts +15 -0
- package/schematics/store/index.d.ts +2 -0
- package/schematics/store/index.js +100 -0
- package/schematics/store/index.js.map +1 -0
- package/schematics/store/schema.json +45 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeAuth = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const my_utility_1 = require("../my-utility");
|
|
6
|
+
const core_1 = require("@angular-devkit/core");
|
|
7
|
+
function makeAuth(options) {
|
|
8
|
+
return (tree, _context) => {
|
|
9
|
+
const workspaceConfig = tree.read('/angular.json');
|
|
10
|
+
if (!workspaceConfig) {
|
|
11
|
+
throw new schematics_1.SchematicsException('Could not find Angular workspace configuration');
|
|
12
|
+
}
|
|
13
|
+
// convert workspace to string
|
|
14
|
+
const workspaceContent = workspaceConfig.toString();
|
|
15
|
+
// parse workspace string into JSON object
|
|
16
|
+
const workspace = JSON.parse(workspaceContent);
|
|
17
|
+
if (!options.project) {
|
|
18
|
+
options.project = workspace.defaultProject;
|
|
19
|
+
}
|
|
20
|
+
const projectName = options.project;
|
|
21
|
+
const project = workspace.projects[projectName];
|
|
22
|
+
const projectType = project.projectType === 'application' ? 'app' : 'lib';
|
|
23
|
+
options.path = `${project.sourceRoot}/${projectType}`;
|
|
24
|
+
options.clazz = 'Auth';
|
|
25
|
+
options.name = 'auth';
|
|
26
|
+
let pathApp = 'src/app';
|
|
27
|
+
let pathStore = 'src/app/root-store';
|
|
28
|
+
let pathView = 'src/app/main/views';
|
|
29
|
+
let pathService = 'src/app/main/services';
|
|
30
|
+
let pathVo = 'src/app/main/models/vo/';
|
|
31
|
+
const conf = tree.read('/ngrx-entity-crud.conf.json');
|
|
32
|
+
if (conf) {
|
|
33
|
+
const confData = JSON.parse(conf.toString());
|
|
34
|
+
pathView = confData.pathView;
|
|
35
|
+
pathStore = confData.pathStore;
|
|
36
|
+
pathApp = confData.pathApp;
|
|
37
|
+
pathService = confData.pathService;
|
|
38
|
+
pathVo = confData.pathVo;
|
|
39
|
+
}
|
|
40
|
+
console.log('pathView', pathView);
|
|
41
|
+
console.log('pathStore', pathStore);
|
|
42
|
+
console.log('pathApp', pathApp);
|
|
43
|
+
console.log('pathService', pathService);
|
|
44
|
+
console.log('pathVo', pathVo);
|
|
45
|
+
const view = getView(options, pathView, pathApp);
|
|
46
|
+
const store = getStore(options, pathStore, pathVo);
|
|
47
|
+
return schematics_1.chain([...view, ...store]);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.makeAuth = makeAuth;
|
|
51
|
+
function getView(options, pathView, pathApp) {
|
|
52
|
+
const result = [
|
|
53
|
+
my_utility_1.render(options, `./files/views`, pathView),
|
|
54
|
+
my_utility_1.addRouteDeclarationToNgModule({
|
|
55
|
+
module: `${pathApp}/app-routing.module.ts`,
|
|
56
|
+
routeLiteral: `{path: 'login', loadChildren: () => import('./main/views/login/login.module').then(m => m.LoginModule)}`
|
|
57
|
+
})
|
|
58
|
+
];
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function getStore(options, pathStore, pathVo) {
|
|
62
|
+
const result = [
|
|
63
|
+
my_utility_1.addExport(options, core_1.normalize(`${pathStore}/index.ts`)),
|
|
64
|
+
my_utility_1.addExport(options, core_1.normalize(`${pathStore}/index.d.ts`)),
|
|
65
|
+
my_utility_1.addImport(core_1.normalize(`${pathStore}/state.ts`), `import {${options.clazz}} from '@models/vo/${core_1.strings.dasherize(options.clazz)}';`),
|
|
66
|
+
my_utility_1.updateState(`${core_1.strings.underscore(options.name)}:${options.clazz};`, core_1.normalize(`${pathStore}/state.ts`)),
|
|
67
|
+
my_utility_1.render(options, './files/store', pathStore),
|
|
68
|
+
my_utility_1.render(options, './files/model', pathVo),
|
|
69
|
+
my_utility_1.addDeclarationToNgModule({
|
|
70
|
+
module: `${pathStore}/root-store.module.ts`,
|
|
71
|
+
name: `${options.clazz}Store`,
|
|
72
|
+
path: `@root-store/${core_1.strings.dasherize(options.clazz)}-store`
|
|
73
|
+
})
|
|
74
|
+
];
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngrx-entity-crud/schematics/auth/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,8CAAiI;AACjI,+CAAwD;AAExD,SAAgB,QAAQ,CAAC,OAAa;IACpC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,CAAC,CAAC;SACjF;QAED,8BAA8B;QAC9B,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;QAEpD,0CAA0C;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC;SAC5C;QAED,MAAM,WAAW,GAAG,OAAO,CAAC,OAAiB,CAAC;QAE9C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEhD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CA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AK,CAAC,QAAQ;SAC9D,CAAC;KACH,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"id": "NgrxAuth",
|
|
4
|
+
"title": "NGRX auth",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"format": "path",
|
|
10
|
+
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
11
|
+
"visible": false
|
|
12
|
+
},
|
|
13
|
+
"project": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The name of the project.",
|
|
16
|
+
"$default": {
|
|
17
|
+
"$source": "projectName"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {createAction, props} from '@ngrx/store';
|
|
2
|
+
|
|
3
|
+
export enum ActionTypes {
|
|
4
|
+
LOGIN_REQUEST = '[Auth] Login Request',
|
|
5
|
+
LOGIN_RESULT = '[Auth] Login Result',
|
|
6
|
+
|
|
7
|
+
LOGOUT_REQUEST = '[Auth] Logout Request',
|
|
8
|
+
LOGOUT_RESULT = '[Auth] Logout Result',
|
|
9
|
+
|
|
10
|
+
GO_TO_LOGIN = '[Auth] Go to login',
|
|
11
|
+
CHECK_AUTH = '[Auth] Check auth',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CheckAuth = createAction(ActionTypes.CHECK_AUTH);
|
|
15
|
+
export const LoginRequest = createAction(ActionTypes.LOGIN_REQUEST);
|
|
16
|
+
export const LoginResult = createAction(ActionTypes.LOGIN_RESULT, props<{ profile: any; isLoggedIn: boolean }>());
|
|
17
|
+
|
|
18
|
+
export const LogoutRequest = createAction(ActionTypes.LOGOUT_REQUEST);
|
|
19
|
+
export const LogoutResult = createAction(ActionTypes.LOGOUT_RESULT);
|
|
20
|
+
|
|
21
|
+
export const GoToLogin = createAction(ActionTypes.GO_TO_LOGIN);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {InjectionToken, NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {ActionReducer, StoreModule} from '@ngrx/store';
|
|
4
|
+
import {EffectsModule} from '@ngrx/effects';
|
|
5
|
+
import {AuthStoreEffects} from './effects';
|
|
6
|
+
import {featureReducer} from './reducer';
|
|
7
|
+
import {Names} from './names';
|
|
8
|
+
import {State} from './state';
|
|
9
|
+
import {AuthenticationService} from '@root-store/auth-store/authentication.service';
|
|
10
|
+
import {LoginModule} from './login.component';
|
|
11
|
+
import {Profile} from '@root-store/auth-store/profile';
|
|
12
|
+
|
|
13
|
+
export const INJECTION_TOKEN = new InjectionToken<ActionReducer<Profile>>(`${Names.NAME}-store Reducers`);
|
|
14
|
+
|
|
15
|
+
@NgModule({
|
|
16
|
+
imports: [
|
|
17
|
+
CommonModule,
|
|
18
|
+
StoreModule.forFeature(Names.NAME, INJECTION_TOKEN),
|
|
19
|
+
EffectsModule.forFeature([AuthStoreEffects]),
|
|
20
|
+
LoginModule,
|
|
21
|
+
],
|
|
22
|
+
declarations: [],
|
|
23
|
+
providers: [AuthStoreEffects,
|
|
24
|
+
AuthenticationService,
|
|
25
|
+
{
|
|
26
|
+
provide: INJECTION_TOKEN,
|
|
27
|
+
useFactory: (): ActionReducer<State> => featureReducer
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
export class AuthStoreModule {
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Injectable} from '@angular/core';
|
|
2
|
+
import {ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot} from '@angular/router';
|
|
3
|
+
import {select, Store} from '@ngrx/store';
|
|
4
|
+
import * as AuthStoreSelectors from './selectors';
|
|
5
|
+
import {map} from 'rxjs/operators';
|
|
6
|
+
import {Observable} from 'rxjs';
|
|
7
|
+
import * as AuthStoreActions from './actions';
|
|
8
|
+
|
|
9
|
+
@Injectable({
|
|
10
|
+
providedIn: 'root'
|
|
11
|
+
})
|
|
12
|
+
export class AuthGuard implements CanActivate, CanActivateChild {
|
|
13
|
+
|
|
14
|
+
constructor(private readonly store$: Store) {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
|
19
|
+
console.log('AuthGuard.canActivate()');
|
|
20
|
+
return this.store$.pipe(
|
|
21
|
+
select(AuthStoreSelectors.selectIsLoggedIn),
|
|
22
|
+
map(selectIsLoggedIn => {
|
|
23
|
+
if (!selectIsLoggedIn) {
|
|
24
|
+
this.store$.dispatch(AuthStoreActions.GoToLogin());
|
|
25
|
+
}
|
|
26
|
+
return selectIsLoggedIn;
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
|
32
|
+
console.log('AuthGuard.canActivateChild()');
|
|
33
|
+
return this.store$.pipe(
|
|
34
|
+
select(AuthStoreSelectors.selectIsLoggedIn),
|
|
35
|
+
map(selectIsLoggedIn => {
|
|
36
|
+
if (!selectIsLoggedIn) {
|
|
37
|
+
this.store$.dispatch(AuthStoreActions.GoToLogin());
|
|
38
|
+
}
|
|
39
|
+
return selectIsLoggedIn;
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {Injectable} from '@angular/core';
|
|
2
|
+
import {AuthService} from '@auth0/auth0-angular';
|
|
3
|
+
import {Observable} from 'rxjs';
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class AuthenticationService {
|
|
9
|
+
|
|
10
|
+
constructor(public authService: AuthService) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get isLoggedIn$(): Observable<boolean> {
|
|
14
|
+
return this.authService.isAuthenticated$;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getToken$(): Observable<string> {
|
|
18
|
+
return this.authService.getAccessTokenSilently();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get user$(): Observable<any> {
|
|
22
|
+
return this.authService.user$;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
login(): void {
|
|
26
|
+
this.authService.loginWithRedirect();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
logout(): void {
|
|
30
|
+
this.authService.logout({returnTo: document.location.origin});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {Injectable} from '@angular/core';
|
|
2
|
+
import {Actions, createEffect, ofType} from '@ngrx/effects';
|
|
3
|
+
import * as actions from './actions';
|
|
4
|
+
import {switchMap, tap} from 'rxjs/operators';
|
|
5
|
+
import {AuthenticationService} from './authentication.service';
|
|
6
|
+
import {combineLatest, of} from 'rxjs';
|
|
7
|
+
import {RouterGo} from '@root-store/router-store/actions';
|
|
8
|
+
import {afterLogoutUri} from './conf';
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
export class AuthStoreEffects {
|
|
12
|
+
constructor(private actions$: Actions,
|
|
13
|
+
private authService: AuthenticationService) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
login$ = createEffect(
|
|
17
|
+
() =>
|
|
18
|
+
this.actions$.pipe(
|
|
19
|
+
ofType(actions.LoginRequest),
|
|
20
|
+
tap(() => this.authService.login())
|
|
21
|
+
),
|
|
22
|
+
{dispatch: false}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
checkAuth$ = createEffect(() =>
|
|
26
|
+
this.actions$.pipe(
|
|
27
|
+
// If an action with the type 'checkAuth' occurs in the actions$ stream...
|
|
28
|
+
ofType(actions.CheckAuth),
|
|
29
|
+
// return an observable including the latest info from 'isLoggedIn' and 'userProfile'
|
|
30
|
+
switchMap(() =>
|
|
31
|
+
combineLatest([this.authService.isLoggedIn$, this.authService.user$])
|
|
32
|
+
),
|
|
33
|
+
// Take it out and return the appropriate action based on if logged in or not
|
|
34
|
+
switchMap(([isLoggedIn, profile]) => {
|
|
35
|
+
if (isLoggedIn) {
|
|
36
|
+
return of(actions.LoginResult({profile, isLoggedIn}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return of(actions.LogoutResult());
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
logout$ = createEffect(() =>
|
|
45
|
+
this.actions$.pipe(
|
|
46
|
+
ofType(actions.LogoutRequest),
|
|
47
|
+
tap(() => this.authService.logout()),
|
|
48
|
+
switchMap(() => of(actions.LogoutResult()))
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
goToLogin$ = createEffect(() =>
|
|
53
|
+
this.actions$.pipe(
|
|
54
|
+
ofType(actions.GoToLogin),
|
|
55
|
+
switchMap(() => [RouterGo({path: [afterLogoutUri]})])
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as AuthStoreActions from './actions';
|
|
2
|
+
import * as AuthStoreSelectors from './selectors';
|
|
3
|
+
import * as AuthStoreState from './state';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
AuthStoreModule
|
|
7
|
+
} from './auth-store.module';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
AuthStoreActions,
|
|
11
|
+
AuthStoreSelectors,
|
|
12
|
+
AuthStoreState
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as AuthStoreActions from './actions';
|
|
2
|
+
import * as AuthStoreSelectors from './selectors';
|
|
3
|
+
import * as AuthStoreState from './state';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
AuthStoreModule
|
|
7
|
+
} from './auth-store.module';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
AuthStoreActions,
|
|
11
|
+
AuthStoreSelectors,
|
|
12
|
+
AuthStoreState
|
|
13
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {Component, NgModule, OnInit} from '@angular/core';
|
|
2
|
+
import {Observable} from 'rxjs';
|
|
3
|
+
import {select, Store} from '@ngrx/store';
|
|
4
|
+
import {AuthStoreActions, AuthStoreSelectors} from './index';
|
|
5
|
+
import {CommonModule} from '@angular/common';
|
|
6
|
+
import {OverlayPanelModule} from 'primeng/overlaypanel';
|
|
7
|
+
import {SharedModule} from 'primeng/api';
|
|
8
|
+
import {CardModule} from 'primeng/card';
|
|
9
|
+
import {AvatarModule} from 'primeng/avatar';
|
|
10
|
+
import {ButtonModule} from 'primeng/button';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-login',
|
|
14
|
+
template: `
|
|
15
|
+
<p-overlayPanel #op>
|
|
16
|
+
<ng-template pTemplate>
|
|
17
|
+
<!-- <p-card>
|
|
18
|
+
<pre>{{ profile$ | async | json }}</pre>
|
|
19
|
+
<button (click)="logout(); op.hide();">Logout</button>
|
|
20
|
+
</p-card>-->
|
|
21
|
+
<button pButton class="p-button-danger" (click)="logout(); op.hide();">Logout</button>
|
|
22
|
+
</ng-template>
|
|
23
|
+
</p-overlayPanel>
|
|
24
|
+
<div>
|
|
25
|
+
<div *ngIf="loggedIn$ | async as loggedIn; else loginContent">
|
|
26
|
+
<p-avatar image="{{(profile$ | async).picture}}" shape="circle" (click)="op.toggle($event)"></p-avatar>
|
|
27
|
+
</div>
|
|
28
|
+
<ng-template #loginContent>
|
|
29
|
+
<button pButton class="p-button-Primary" (click)="login()">Login</button>
|
|
30
|
+
</ng-template>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
styles: []
|
|
34
|
+
})
|
|
35
|
+
export class LoginComponent implements OnInit {
|
|
36
|
+
|
|
37
|
+
title = 'auth0-angular-ngrx';
|
|
38
|
+
|
|
39
|
+
loggedIn$: Observable<boolean>;
|
|
40
|
+
profile$: Observable<any>;
|
|
41
|
+
|
|
42
|
+
constructor(private store: Store<any>) {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ngOnInit(): void {
|
|
46
|
+
this.loggedIn$ = this.store.pipe(select(AuthStoreSelectors.selectIsLoggedIn));
|
|
47
|
+
this.profile$ = this.store.pipe(select(AuthStoreSelectors.selectCurrentUserProfile));
|
|
48
|
+
this.store.dispatch(AuthStoreActions.CheckAuth());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
logout(): void {
|
|
52
|
+
this.store.dispatch(AuthStoreActions.LogoutResult());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
login(): void {
|
|
56
|
+
this.store.dispatch(AuthStoreActions.LoginRequest());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@NgModule({
|
|
61
|
+
imports: [
|
|
62
|
+
CommonModule,
|
|
63
|
+
OverlayPanelModule,
|
|
64
|
+
SharedModule,
|
|
65
|
+
CardModule,
|
|
66
|
+
AvatarModule,
|
|
67
|
+
ButtonModule,
|
|
68
|
+
],
|
|
69
|
+
declarations: [LoginComponent],
|
|
70
|
+
exports: [LoginComponent],
|
|
71
|
+
providers: []
|
|
72
|
+
})
|
|
73
|
+
export class LoginModule {
|
|
74
|
+
}
|
|
75
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {initialState} from './state';
|
|
2
|
+
import {createReducer, on} from '@ngrx/store';
|
|
3
|
+
import * as actions from './actions';
|
|
4
|
+
|
|
5
|
+
export const featureReducer = createReducer(
|
|
6
|
+
initialState,
|
|
7
|
+
|
|
8
|
+
on(actions.LoginResult, (state, {profile, isLoggedIn}) => {
|
|
9
|
+
return {
|
|
10
|
+
...state,
|
|
11
|
+
userProfile: profile,
|
|
12
|
+
isLoggedIn,
|
|
13
|
+
};
|
|
14
|
+
}),
|
|
15
|
+
|
|
16
|
+
on(actions.LogoutResult, (state, {}) => {
|
|
17
|
+
return {
|
|
18
|
+
...state,
|
|
19
|
+
userProfile: null,
|
|
20
|
+
isLoggedIn: false,
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {createFeatureSelector, createSelector} from '@ngrx/store';
|
|
2
|
+
import {Names} from './names';
|
|
3
|
+
import {State} from './state';
|
|
4
|
+
|
|
5
|
+
// get the `auth` property from the state object
|
|
6
|
+
export const getAuthFeatureState = createFeatureSelector<State>(Names.NAME);
|
|
7
|
+
|
|
8
|
+
// get the userProfile from the auth state
|
|
9
|
+
export const selectCurrentUserProfile = createSelector(
|
|
10
|
+
getAuthFeatureState,
|
|
11
|
+
(state: State) => state.userProfile
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
// get the isLoggedIn from the auth state
|
|
15
|
+
export const selectIsLoggedIn = createSelector(
|
|
16
|
+
getAuthFeatureState,
|
|
17
|
+
(state: State) => state.isLoggedIn
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const selectRoles = createSelector(
|
|
21
|
+
selectIsLoggedIn,
|
|
22
|
+
(isLoggedIn: boolean) => isLoggedIn ? ['roleA'] : []
|
|
23
|
+
)
|
|
24
|
+
;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeAuth0 = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const my_utility_1 = require("../my-utility");
|
|
6
|
+
const core_1 = require("@angular-devkit/core");
|
|
7
|
+
function makeAuth0(options) {
|
|
8
|
+
return (tree, _context) => {
|
|
9
|
+
const workspaceConfig = tree.read('/angular.json');
|
|
10
|
+
if (!workspaceConfig) {
|
|
11
|
+
throw new schematics_1.SchematicsException('Could not find Angular workspace configuration');
|
|
12
|
+
}
|
|
13
|
+
// convert workspace to string
|
|
14
|
+
const workspaceContent = workspaceConfig.toString();
|
|
15
|
+
// parse workspace string into JSON object
|
|
16
|
+
const workspace = JSON.parse(workspaceContent);
|
|
17
|
+
if (!options.project) {
|
|
18
|
+
options.project = workspace.defaultProject;
|
|
19
|
+
}
|
|
20
|
+
const projectName = options.project;
|
|
21
|
+
const project = workspace.projects[projectName];
|
|
22
|
+
const projectType = project.projectType === 'application' ? 'app' : 'lib';
|
|
23
|
+
options.path = `${project.sourceRoot}/${projectType}`;
|
|
24
|
+
options.clazz = 'Auth';
|
|
25
|
+
options.name = 'auth';
|
|
26
|
+
let pathApp = 'src/app';
|
|
27
|
+
let pathStore = 'src/app/root-store';
|
|
28
|
+
let pathView = 'src/app/main/views';
|
|
29
|
+
let pathService = 'src/app/main/services';
|
|
30
|
+
let pathVo = 'src/app/main/models/vo/';
|
|
31
|
+
const conf = tree.read('/ngrx-entity-crud.conf.json');
|
|
32
|
+
if (conf) {
|
|
33
|
+
const confData = JSON.parse(conf.toString());
|
|
34
|
+
pathView = confData.pathView;
|
|
35
|
+
pathStore = confData.pathStore;
|
|
36
|
+
pathApp = confData.pathApp;
|
|
37
|
+
pathService = confData.pathService;
|
|
38
|
+
pathVo = confData.pathVo;
|
|
39
|
+
}
|
|
40
|
+
console.log('pathView', pathView);
|
|
41
|
+
console.log('pathStore', pathStore);
|
|
42
|
+
console.log('pathApp', pathApp);
|
|
43
|
+
console.log('pathService', pathService);
|
|
44
|
+
console.log('pathVo', pathVo);
|
|
45
|
+
// const view = getView(options, pathView);
|
|
46
|
+
const store = getStore(options, pathStore, pathVo);
|
|
47
|
+
return schematics_1.chain([...store]);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.makeAuth0 = makeAuth0;
|
|
51
|
+
function getStore(options, path, pathVo) {
|
|
52
|
+
const result = [
|
|
53
|
+
my_utility_1.addExport(options, core_1.normalize(`${path}/index.ts`)),
|
|
54
|
+
my_utility_1.addExport(options, core_1.normalize(`${path}/index.d.ts`)),
|
|
55
|
+
my_utility_1.addImport(core_1.normalize(`${path}/state.ts`), `import {${options.clazz}} from '@models/vo/${core_1.strings.dasherize(options.clazz)}';`),
|
|
56
|
+
my_utility_1.updateState(`${core_1.strings.underscore(options.name)}:${options.clazz};`, core_1.normalize(`${path}/state.ts`)),
|
|
57
|
+
my_utility_1.render(options, './files/store', path),
|
|
58
|
+
my_utility_1.render(options, './files/model', pathVo),
|
|
59
|
+
my_utility_1.addDeclarationToNgModule({
|
|
60
|
+
module: `${path}/root-store.module.ts`,
|
|
61
|
+
name: `${options.clazz}Store`,
|
|
62
|
+
path: `@root-store/${core_1.strings.dasherize(options.clazz)}-store`
|
|
63
|
+
})
|
|
64
|
+
];
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngrx-entity-crud/schematics/auth0/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,8CAAkG;AAClG,+CAAwD;AAExD,SAAgB,SAAS,CAAC,OAAa;IACrC,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAChD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,CAAC,CAAC;SACjF;QAED,8BAA8B;QAC9B,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;QAEpD,0CAA0C;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"id": "NgrxAuth",
|
|
4
|
+
"title": "NGRX auth",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"format": "path",
|
|
10
|
+
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
11
|
+
"visible": false
|
|
12
|
+
},
|
|
13
|
+
"project": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The name of the project.",
|
|
16
|
+
"$default": {
|
|
17
|
+
"$source": "projectName"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"store": {
|
|
5
|
+
"description": "add store",
|
|
6
|
+
"factory": "./store/index#makeStore",
|
|
7
|
+
"schema": "./store/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"section": {
|
|
10
|
+
"description": "add section",
|
|
11
|
+
"factory": "./section/index#crudSection",
|
|
12
|
+
"schema": "./section/schema.json"
|
|
13
|
+
},
|
|
14
|
+
"auth": {
|
|
15
|
+
"description": "add login integration",
|
|
16
|
+
"factory": "./auth/index#makeAuth",
|
|
17
|
+
"schema": "./auth/schema.json"
|
|
18
|
+
},
|
|
19
|
+
"ng-add": {
|
|
20
|
+
"description": "Add my library to the project.",
|
|
21
|
+
"factory": "./ng-add/index#ngAdd",
|
|
22
|
+
"schema": "./ng-add/schema.json"
|
|
23
|
+
},
|
|
24
|
+
"auth0": {
|
|
25
|
+
"description": "add Auth0 login integration",
|
|
26
|
+
"factory": "./auth0/index#makeAuth0",
|
|
27
|
+
"schema": "./auth0/schema.json"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|