@things-factory/auth-base 6.1.94 → 6.1.95
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/dist-server/service/index.d.ts +2 -2
- package/dist-server/service/login-history/login-history-query.d.ts +3 -1
- package/dist-server/service/login-history/login-history-query.js +19 -0
- package/dist-server/service/login-history/login-history-query.js.map +1 -1
- package/dist-server/service/login-history/login-history-type.d.ts +5 -0
- package/dist-server/service/login-history/login-history-type.js +21 -0
- package/dist-server/service/login-history/login-history-type.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/login-history/login-history-query.ts +17 -2
- package/server/service/login-history/login-history-type.ts +12 -0
|
@@ -19,12 +19,12 @@ export * from './partner/partner-types';
|
|
|
19
19
|
export * from './privilege/privilege-types';
|
|
20
20
|
export * from './role/role-types';
|
|
21
21
|
export * from './user/user-types';
|
|
22
|
-
export declare const entities: (typeof import("./
|
|
22
|
+
export declare const entities: (typeof import("./login-history/login-history").LoginHistory | typeof import("./user/user").User | typeof import("./application/application").Application | typeof import("./appliance/appliance").Appliance | typeof import("./privilege/privilege").Privilege | typeof import("./role/role").Role | typeof import("./partner/partner").Partner | typeof import("./granted-role/granted-role").GrantedRole | typeof import("./invitation/invitation").Invitation | typeof import("./password-history/password-history").PasswordHistory | typeof import("./verification-token/verification-token").VerificationToken | typeof import("./verification-token/verification-token").VerificationTokenType)[];
|
|
23
23
|
export declare const schema: {
|
|
24
24
|
typeDefs: {
|
|
25
25
|
privilegeDirectiveTypeDefs: import("graphql").DocumentNode;
|
|
26
26
|
};
|
|
27
|
-
resolverClasses: (typeof import("./
|
|
27
|
+
resolverClasses: (typeof import("./login-history/login-history-query").LoginHistoryQuery | typeof import("./user/user-query").UserQuery | typeof import("./user/user-mutation").UserMutation | typeof import("./user/domain-query").DomainQuery | typeof import("./application/application-query").ApplicationQuery | typeof import("./application/application-mutation").ApplicationMutation | typeof import("./appliance/appliance-query").ApplianceQuery | typeof import("./appliance/appliance-mutation").ApplianceMutation | typeof import("./privilege/privilege-query").PrivilegeQuery | typeof import("./privilege/privilege-mutation").PrivilegeMutation | typeof import("./role/role-query").RoleQuery | typeof import("./role/role-mutation").RoleMutation | typeof import("./partner/partner-query").PartnerQuery | typeof import("./partner/partner-mutation").PartnerMutation | typeof import("./granted-role/granted-role-query").GrantedRoleQuery | typeof import("./granted-role/granted-role-mutation").GrantedRoleMutation | typeof import("./invitation/invitation-query").InvitationQuery | typeof import("./invitation/invitation-mutation").InvitationMutation | typeof import("./app-binding/app-binding-query").AppBindingQuery | typeof import("./app-binding/app-binding-mutation").AppBindingMutation | typeof import("./domain-generator/domain-generator-mutation").DomainGeneratorMutation)[];
|
|
28
28
|
directives: {
|
|
29
29
|
privilege: (schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema;
|
|
30
30
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Domain } from '@things-factory/shell';
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
2
|
import { User } from '../user/user';
|
|
3
3
|
import { LoginHistory } from './login-history';
|
|
4
|
+
import { LoginHistoryList } from './login-history-type';
|
|
4
5
|
export declare class LoginHistoryQuery {
|
|
6
|
+
loginHistories(params: ListParam, context: ResolverContext): Promise<LoginHistoryList>;
|
|
5
7
|
myLoginHistories(limit: number, context: ResolverContext): Promise<LoginHistory[]>;
|
|
6
8
|
accessDomain(loginHistory: LoginHistory): Promise<Domain>;
|
|
7
9
|
accessUser(loginHistory: LoginHistory): Promise<User>;
|
|
@@ -6,7 +6,18 @@ const type_graphql_1 = require("type-graphql");
|
|
|
6
6
|
const shell_1 = require("@things-factory/shell");
|
|
7
7
|
const user_1 = require("../user/user");
|
|
8
8
|
const login_history_1 = require("./login-history");
|
|
9
|
+
const login_history_type_1 = require("./login-history-type");
|
|
9
10
|
let LoginHistoryQuery = class LoginHistoryQuery {
|
|
11
|
+
async loginHistories(params, context) {
|
|
12
|
+
const { domain } = context.state;
|
|
13
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
14
|
+
domain,
|
|
15
|
+
params,
|
|
16
|
+
repository: await (0, shell_1.getRepository)(login_history_1.LoginHistory)
|
|
17
|
+
});
|
|
18
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
19
|
+
return { items, total };
|
|
20
|
+
}
|
|
10
21
|
async myLoginHistories(limit, context) {
|
|
11
22
|
const user = context.state.user;
|
|
12
23
|
if (!user) {
|
|
@@ -25,6 +36,14 @@ let LoginHistoryQuery = class LoginHistoryQuery {
|
|
|
25
36
|
return await (0, shell_1.getRepository)(user_1.User).findOneBy({ id: loginHistory.accessUserId });
|
|
26
37
|
}
|
|
27
38
|
};
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Query)(returns => login_history_type_1.LoginHistoryList, { description: 'To fetch multiple LoginHistories' }),
|
|
41
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
42
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
43
|
+
tslib_1.__metadata("design:type", Function),
|
|
44
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
45
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
46
|
+
], LoginHistoryQuery.prototype, "loginHistories", null);
|
|
28
47
|
tslib_1.__decorate([
|
|
29
48
|
(0, type_graphql_1.Query)(returns => [login_history_1.LoginHistory]),
|
|
30
49
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('limit')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-history-query.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history-query.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"login-history-query.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,iDAAuG;AAEvG,uCAAmC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AS,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,YAAY,EAAE,CAAC,CAAA;IAC/E,CAAC;CACF,CAAA;AApCO;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,qCAAgB,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAClE,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;uDAW7C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;IACT,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWzD;AAGK;IADL,IAAA,4BAAa,GAAE;IACI,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;qDAEpD;AAGK;IADL,IAAA,4BAAa,GAAE;IACE,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAe,4BAAY;;mDAElD;AArCU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CAsC7B;AAtCY,8CAAiB","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { User } from '../user/user'\nimport { LoginHistory } from './login-history'\nimport { LoginHistoryList } from './login-history-type'\n\n@Resolver(LoginHistory)\nexport class LoginHistoryQuery {\n @Query(returns => LoginHistoryList, { description: 'To fetch multiple LoginHistories' })\n async loginHistories(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<LoginHistoryList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(LoginHistory)\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @Query(returns => [LoginHistory])\n async myLoginHistories(@Arg('limit') limit: number, @Ctx() context: ResolverContext): Promise<LoginHistory[]> {\n const user: User = context.state.user\n if (!user) {\n throw new Error('No user specified')\n }\n\n return await getRepository(LoginHistory).find({\n where: { accessUser: { id: user.id } },\n take: limit || 10,\n order: { accessedAt: 'DESC' }\n })\n }\n\n @FieldResolver()\n async accessDomain(@Root() loginHistory: LoginHistory) {\n return await getRepository(Domain).findOneBy({ id: loginHistory.accessDomainId })\n }\n\n @FieldResolver()\n async accessUser(@Root() loginHistory: LoginHistory) {\n return await getRepository(User).findOneBy({ id: loginHistory.accessUserId })\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginHistoryList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const login_history_1 = require("./login-history");
|
|
7
|
+
let LoginHistoryList = class LoginHistoryList {
|
|
8
|
+
};
|
|
9
|
+
tslib_1.__decorate([
|
|
10
|
+
(0, type_graphql_1.Field)(type => [login_history_1.LoginHistory]),
|
|
11
|
+
tslib_1.__metadata("design:type", Array)
|
|
12
|
+
], LoginHistoryList.prototype, "items", void 0);
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
15
|
+
tslib_1.__metadata("design:type", Number)
|
|
16
|
+
], LoginHistoryList.prototype, "total", void 0);
|
|
17
|
+
LoginHistoryList = tslib_1.__decorate([
|
|
18
|
+
(0, type_graphql_1.ObjectType)()
|
|
19
|
+
], LoginHistoryList);
|
|
20
|
+
exports.LoginHistoryList = LoginHistoryList;
|
|
21
|
+
//# sourceMappingURL=login-history-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-history-type.js","sourceRoot":"","sources":["../../../server/service/login-history/login-history-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,mDAA8C;AAGvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;AALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B;AANY,4CAAgB","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { LoginHistory } from './login-history'\n\n@ObjectType()\nexport class LoginHistoryList {\n @Field(type => [LoginHistory])\n items: LoginHistory[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|