nicot-simple-user 1.0.7 → 1.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.
@@ -4,6 +4,7 @@ import { SimpleUser } from './simple-user.entity';
4
4
  import { CrudOptions } from 'nicot';
5
5
  import { SendCodeDto } from './send-code/send-code.dto';
6
6
  import { EntityManager } from 'typeorm';
7
+ import { MayBeArray } from 'aragami/dist/src/utility/utility';
7
8
  export interface SimpleUserExtraOptions {
8
9
  userClass?: ClassType<SimpleUser>;
9
10
  userServiceCrudExtras?: CrudOptions<SimpleUser>;
@@ -28,4 +29,5 @@ export interface SimpleUserOptions {
28
29
  onMigrateUser?: (oldUser: SimpleUser, newUser: SimpleUser) => Awaitable<void>;
29
30
  unregisterWaitTimeMs?: number;
30
31
  onUnregisterUser?: (user: SimpleUser, tdb: EntityManager) => Awaitable<void>;
32
+ initialUser?: MayBeArray<Partial<SimpleUser>>;
31
33
  }
@@ -0,0 +1,13 @@
1
+ import { CrudBase } from 'nicot';
2
+ import { Repository } from 'typeorm';
3
+ import { SimpleUserExtraOptions, SimpleUserOptions } from '../options';
4
+ import { SimpleUser } from '../simple-user.entity';
5
+ export declare class SimpleUserInitialCreationService extends CrudBase<SimpleUser> {
6
+ private options;
7
+ private optionsEx;
8
+ constructor(repo: Repository<SimpleUser>, options: SimpleUserOptions, optionsEx: SimpleUserExtraOptions);
9
+ private logger;
10
+ createInitialUser(initialUser?: Partial<SimpleUser>, repo?: Repository<SimpleUser>): Promise<void>;
11
+ createAllInitialUsers(): Promise<void>;
12
+ onApplicationBootstrap(): Promise<void>;
13
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SimpleUserInitialCreationService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const nicot_1 = require("nicot");
18
+ const tokens_1 = require("../tokens");
19
+ const typeorm_1 = require("typeorm");
20
+ const module_builder_1 = require("../module-builder");
21
+ const utility_1 = require("aragami/dist/src/utility/utility");
22
+ let SimpleUserInitialCreationService = class SimpleUserInitialCreationService extends nicot_1.CrudBase {
23
+ constructor(repo, options, optionsEx) {
24
+ super(optionsEx.userClass, repo, optionsEx.userServiceCrudExtras || {});
25
+ this.options = options;
26
+ this.optionsEx = optionsEx;
27
+ this.logger = new common_1.ConsoleLogger('SimpleUserInitialCreationService');
28
+ }
29
+ async createInitialUser(initialUser, repo = this.repo) {
30
+ const existing = await repo.findOne({
31
+ where: { email: initialUser.email },
32
+ select: ['id'],
33
+ lock: {
34
+ mode: 'pessimistic_write',
35
+ tables: [repo.metadata.tableName],
36
+ },
37
+ });
38
+ const serviceInstance = new nicot_1.CrudBase(this.entityClass, repo, this.optionsEx.userServiceCrudExtras || {});
39
+ if (existing) {
40
+ await serviceInstance.update(existing.id, initialUser);
41
+ this.logger.log(`Initial user with email ${initialUser.email} already exists. Updated existing user.`);
42
+ }
43
+ else {
44
+ await serviceInstance.create(initialUser);
45
+ this.logger.log(`Created initial user with email ${initialUser.email}.`);
46
+ }
47
+ }
48
+ async createAllInitialUsers() {
49
+ const initialUsers = (0, utility_1.makeArray)(this.options.initialUser).filter((u) => u?.email);
50
+ if (!initialUsers?.length) {
51
+ return;
52
+ }
53
+ await this._mayBeTransaction(async (_, repo) => {
54
+ for (const user of initialUsers) {
55
+ await this.createInitialUser(user, repo);
56
+ }
57
+ });
58
+ }
59
+ async onApplicationBootstrap() {
60
+ await this.createAllInitialUsers();
61
+ }
62
+ };
63
+ exports.SimpleUserInitialCreationService = SimpleUserInitialCreationService;
64
+ exports.SimpleUserInitialCreationService = SimpleUserInitialCreationService = __decorate([
65
+ (0, common_1.Injectable)(),
66
+ __param(0, (0, common_1.Inject)(tokens_1.UserRepoToken)),
67
+ __param(1, (0, common_1.Inject)(module_builder_1.MODULE_OPTIONS_TOKEN)),
68
+ __param(2, (0, common_1.Inject)(tokens_1.OptionsExToken)),
69
+ __metadata("design:paramtypes", [typeorm_1.Repository, Object, Object])
70
+ ], SimpleUserInitialCreationService);
71
+ //# sourceMappingURL=simple-user-initial-creation.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-user-initial-creation.service.js","sourceRoot":"","sources":["../../../src/simple-user/simple-user-initial-creation/simple-user-initial-creation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,iCAAiC;AACjC,sCAA0D;AAC1D,qCAAqC;AACrC,sDAAyD;AAGzD,8DAA6D;AAGtD,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,gBAAoB;IACxE,YAEE,IAA4B,EAE5B,OAAkC,EAElC,SAAyC;QAEzC,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;QAJhE,YAAO,GAAP,OAAO,CAAmB;QAE1B,cAAS,GAAT,SAAS,CAAwB;QAKnC,WAAM,GAAG,IAAI,sBAAa,CAAC,kCAAkC,CAAC,CAAC;IAFvE,CAAC;IAID,KAAK,CAAC,iBAAiB,CAAC,WAAiC,EAAE,IAAI,GAAG,IAAI,CAAC,IAAI;QACzE,M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AE,IAAI,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACrC,CAAC;CACF,CAAA;AA5DY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,sBAAa,CAAC,CAAA;IAErB,WAAA,IAAA,eAAM,EAAC,qCAAoB,CAAC,CAAA;IAE5B,WAAA,IAAA,eAAM,EAAC,uBAAc,CAAC,CAAA;qCAHjB,oBAAU;GAHP,gCAAgC,CA4D5C"}
@@ -1,3 +1,4 @@
1
+ export declare const SimpleUserSensitiveFields: readonly ["email", "password"];
1
2
  declare const SimpleUser_base: new () => {
2
3
  id: number;
3
4
  applyQuery(qb: import("typeorm").SelectQueryBuilder<any>, entityName: string): void;
@@ -27,6 +28,11 @@ export declare class SimpleUser extends SimpleUser_base {
27
28
  ssaid: string;
28
29
  passwordHash: string;
29
30
  passwordSet: boolean;
31
+ registered: boolean;
32
+ password: string;
33
+ private setPasswordWhenAvailable;
34
+ beforeCreate(): Promise<void>;
35
+ beforeUpdate(): Promise<void>;
30
36
  afterGet(): Promise<void>;
31
37
  setPassword(password: string): Promise<void>;
32
38
  checkPassword(password: string): Promise<boolean>;
@@ -12,13 +12,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SimpleUser = void 0;
15
+ exports.SimpleUser = exports.SimpleUserSensitiveFields = void 0;
16
16
  const openapi = require("@nestjs/swagger");
17
17
  const nicot_1 = require("nicot");
18
18
  const typeorm_1 = require("typeorm");
19
19
  const argon2_1 = __importDefault(require("argon2"));
20
+ const swagger_1 = require("@nestjs/swagger");
21
+ exports.SimpleUserSensitiveFields = ['email', 'password'];
20
22
  let SimpleUser = class SimpleUser extends (0, nicot_1.IdBase)() {
23
+ async setPasswordWhenAvailable() {
24
+ if (this.password) {
25
+ await this.setPassword(this.password);
26
+ delete this.password;
27
+ }
28
+ }
29
+ async beforeCreate() {
30
+ await this.setPasswordWhenAvailable();
31
+ }
32
+ async beforeUpdate() {
33
+ await this.setPasswordWhenAvailable();
34
+ }
21
35
  async afterGet() {
36
+ this.registered = !!this.email;
22
37
  this.passwordSet = !!this.passwordHash;
23
38
  }
24
39
  async setPassword(password) {
@@ -37,13 +52,13 @@ let SimpleUser = class SimpleUser extends (0, nicot_1.IdBase)() {
37
52
  }
38
53
  }
39
54
  static _OPENAPI_METADATA_FACTORY() {
40
- return { email: { required: true, type: () => String }, ssaid: { required: true, type: () => String }, passwordHash: { required: true, type: () => String }, passwordSet: { required: true, type: () => Boolean }, loginIpAddress: { required: true, type: () => String }, loginTime: { required: true, type: () => Date }, registerIpAddress: { required: true, type: () => String }, registerTime: { required: true, type: () => Date }, lastActiveIpAddress: { required: true, type: () => String }, lastActiveTime: { required: true, type: () => Date }, unregisterTime: { required: true, type: () => Date } };
55
+ return { email: { required: true, type: () => String }, ssaid: { required: true, type: () => String }, passwordHash: { required: true, type: () => String }, passwordSet: { required: true, type: () => Boolean }, registered: { required: true, type: () => Boolean }, password: { required: true, type: () => String }, loginIpAddress: { required: true, type: () => String }, loginTime: { required: true, type: () => Date }, registerIpAddress: { required: true, type: () => String }, registerTime: { required: true, type: () => Date }, lastActiveIpAddress: { required: true, type: () => String }, lastActiveTime: { required: true, type: () => Date }, unregisterTime: { required: true, type: () => Date } };
41
56
  }
42
57
  };
43
58
  exports.SimpleUser = SimpleUser;
44
59
  __decorate([
60
+ (0, nicot_1.QueryEqual)(),
45
61
  (0, typeorm_1.Index)(),
46
- (0, nicot_1.NotWritable)(),
47
62
  (0, nicot_1.StringColumn)(255, {
48
63
  description: 'Email address of the user. Only available for registered users',
49
64
  }),
@@ -71,6 +86,21 @@ __decorate([
71
86
  }),
72
87
  __metadata("design:type", Boolean)
73
88
  ], SimpleUser.prototype, "passwordSet", void 0);
89
+ __decorate([
90
+ (0, nicot_1.NotColumn)({
91
+ description: 'Indicates whether the user is registered (has email)',
92
+ required: true,
93
+ }),
94
+ __metadata("design:type", Boolean)
95
+ ], SimpleUser.prototype, "registered", void 0);
96
+ __decorate([
97
+ (0, nicot_1.NotQueryable)(),
98
+ (0, nicot_1.NotInResult)(),
99
+ (0, swagger_1.ApiProperty)({
100
+ description: 'Set password for the user. Write-only field.',
101
+ }),
102
+ __metadata("design:type", String)
103
+ ], SimpleUser.prototype, "password", void 0);
74
104
  __decorate([
75
105
  (0, nicot_1.InternalColumn)(),
76
106
  (0, nicot_1.StringColumn)(39, {
@@ -1 +1 @@
1
- {"version":3,"file":"simple-user.entity.js","sourceRoot":"","sources":["../../src/simple-user/simple-user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iCAOe;AACf,qCAAwC;AACxC,oDAA4B;AAGrB,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,IAAA,cAAM,GAAE;IA6BtC,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IACzC,CAAC;IAMD,KAAK,CAAC,WAAW,CAAC,QAAgB;QAChC,IAAI,CAAC,YAAY,GAAG,MAAM,gBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC9C,IAAI,EAAE,gBAAM,CAAC,QAAQ;SACtB,CAAC,CAAC;IACL,CAAC;IAKD,KAAK,CAAC,aAAa,CAAC,QAAgB;QAClC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAElD,IAAI,CAAC;YACH,OAAO,MAAM,gBAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YAEP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,C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B;IAJC,IAAA,sBAAc,GAAE;IAChB,IAAA,oBAAY,EAAC,EAAE,EAAE;QAChB,WAAW,EAAE,qCAAqC;KACnD,CAAC;;qDACwB;AAM1B;IAJC,IAAA,sBAAc,GAAE;IAChB,IAAA,kBAAU,EAAC;QACV,WAAW,EAAE,+BAA+B;KAC7C,CAAC;8BACY,IAAI;gDAAC;AAMnB;IAJC,IAAA,sBAAc,GAAE;IAChB,IAAA,oBAAY,EAAC,EAAE,EAAE;QAChB,WAAW,EAAE,oCAAoC;KAClD,CAAC;;uDAC0B;AAM5B;IAJC,IAAA,sBAAc,GAAE;IAChB,IAAA,kBAAU,EAAC;QACV,WAAW,EAAE,8BAA8B;KAC5C,CAAC;8BACc,IAAI;kDAAC;AAOrB;IALC,IAAA,sBAAc,GAAE;IAChB,IAAA,eAAK,GAAE;IACP,IAAA,kBAAU,EAAC;QACV,WAAW,EAAE,qCAAqC;KACnD,CAAC;8BACc,IAAI;kDAAC;qBA/HV,UAAU;IADtB,IAAA,gBAAM,GAAE;GACI,UAAU,CAgItB"}
@@ -19,6 +19,7 @@ const resolver_1 = require("./resolver");
19
19
  const tokens_1 = require("./tokens");
20
20
  const patch_me_1 = require("./user-center/patch-me");
21
21
  const nicot_1 = require("nicot");
22
+ const simple_user_initial_creation_service_1 = require("./simple-user-initial-creation/simple-user-initial-creation.service");
22
23
  const patchUserCenterControllerMeWithDynamicModule = (module) => {
23
24
  const userExProvider = module.providers?.find((p) => p.provide === tokens_1.OptionsExToken);
24
25
  if (userExProvider?.useValue) {
@@ -55,6 +56,7 @@ exports.SimpleUserModule = SimpleUserModule = __decorate([
55
56
  send_code_service_1.SendCodeService,
56
57
  resolver_1.userResolverProvider.provider,
57
58
  resolver_1.userRiskControlResolverProvider.provider,
59
+ simple_user_initial_creation_service_1.SimpleUserInitialCreationService,
58
60
  ],
59
61
  exports: [
60
62
  simple_user_service_1.SimpleUserService,
@@ -1 +1 @@
1
- {"version":3,"file":"simple-user.module.js","sourceRoot":"","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xE,CAAC;YACF,IAAA,gCAAwB,EAAC,qCAAoB,EAAE,gBAAgB,CAAC,CAAC;YACjE,KAAK,MAAM,KAAK,IAAI,gBAAgB,EAAE,CAAC;gBACrC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;oBACrC,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAA,sCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AAvBY,4CAAgB;2BAAhB,gBAAgB;IAd5B,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,uCAAiB;YACjB,mCAAe;YACf,+BAAoB,CAAC,QAAQ;YAC7B,0CAA+B,CAAC,QAAQ;SACzC;QACD,OAAO,EAAE;YACP,uCAAiB;YACjB,+BAAoB,CAAC,QAAQ;YAC7B,0CAA+B,CAAC,QAAQ;SACzC;QACD,WAAW;KACZ,CAAC;GACW,gBAAgB,CAuB5B"}
1
+ {"version":3,"file":"simple-user.module.js","sourceRoot":"","sources":["../../src/simple-user/simple-user.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AACxB,qDAG0B;AAC1B,iDAAyD;AACzD,2EAAsE;AACtE,qEAAgE;AAChE,2EAAsE;AACtE,+DAA2D;AAC3D,iFAA4E;AAC5E,yCAGoB;AACpB,qCAA0C;AAE1C,qDAAqE;AACrE,iCAAkE;AAClE,8HAAuH;AAUvH,MAAM,4CAA4C,GAAG,CACnD,MAAqB,EACrB,EAAE;IACF,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,EAAE,IAAI,CAC3C,CAAC,CAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,uBAAc,CAClC,CAAC;IACnB,IAAI,cAAc,EAAE,QAAQ,EAAE,CAAC;QAC7B,IAAA,sCAA2B,EAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvD,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C;QACD,OAAO,EAAE;YACP,uCAAiB;YACjB,+BAAoB,CAAC,QAAQ;YAC7B,0CAA+B,CAAC,QAAQ;SACzC;QACD,WAAW;KACZ,CAAC;GACW,gBAAgB,CAuB5B"}
@@ -5,11 +5,12 @@ const nicot_1 = require("nicot");
5
5
  const user_center_controller_1 = require("./user-center.controller");
6
6
  const swagger_1 = require("@nestjs/swagger");
7
7
  const patchUserCenterControllerMe = (extras) => {
8
+ const factory = new nicot_1.RestfulFactory(extras.userClass, {
9
+ relations: extras.userServiceCrudExtras?.relations || [],
10
+ });
8
11
  const userCenterControllerMeDescriptor = Object.getOwnPropertyDescriptor(user_center_controller_1.UserCenterController.prototype, 'getCurrentUser');
9
12
  (0, swagger_1.ApiOkResponse)({
10
- type: new nicot_1.RestfulFactory(extras.userClass, {
11
- relations: extras.userServiceCrudExtras?.relations || [],
12
- }).entityReturnMessageDto,
13
+ type: factory.entityReturnMessageDto,
13
14
  })(user_center_controller_1.UserCenterController.prototype, 'getCurrentUser', userCenterControllerMeDescriptor);
14
15
  };
15
16
  exports.patchUserCenterControllerMe = patchUserCenterControllerMe;
@@ -1 +1 @@
1
- {"version":3,"file":"patch-me.js","sourceRoot":"","sources":["../../../src/simple-user/user-center/patch-me.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AACvC,qEAAgE;AAChE,6CAAgD;AAGzC,MAAM,2BAA2B,GAAG,CAAC,MAA8B,EAAE,EAAE;IAC5E,MAAM,gCAAgC,GAAG,MAAM,CAAC,wBAAwB,CACtE,6CAAoB,CAAC,SAAS,EAC9B,gBAAgB,CACjB,CAAC;IACF,IAAA,uBAAa,EAAC;QACZ,IAAI,EAAE,IAAI,sBAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YACzC,SAAS,EAAE,MAAM,CAAC,qBAAqB,EAAE,SAAS,IAAI,EAAE;SACzD,CAAC,CAAC,sBAAsB;KAC1B,CAAC,CACA,6CAAoB,CAAC,SAAS,EAC9B,gBAAgB,EAChB,gCAAgC,CACjC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,2BAA2B,+BActC"}
1
+ {"version":3,"file":"patch-me.js","sourceRoot":"","sources":["../../../src/simple-user/user-center/patch-me.ts"],"names":[],"mappings":";;;AAAA,iCAAuC;AACvC,qEAAgE;AAChE,6CAAgD;AAGzC,MAAM,2BAA2B,GAAG,CAAC,MAA8B,EAAE,EAAE;IAC5E,MAAM,OAAO,GAAG,IAAI,sBAAc,CAAC,MAAM,CAAC,SAAS,EAAE;QACnD,SAAS,EAAE,MAAM,CAAC,qBAAqB,EAAE,SAAS,IAAI,EAAE;KACzD,CAAC,CAAC;IAEH,MAAM,gCAAgC,GAAG,MAAM,CAAC,wBAAwB,CACtE,6CAAoB,CAAC,SAAS,EAC9B,gBAAgB,CACjB,CAAC;IAEF,IAAA,uBAAa,EAAC;QACZ,IAAI,EAAE,OAAO,CAAC,sBAAsB;KACrC,CAAC,CACA,6CAAoB,CAAC,SAAS,EAC9B,gBAAgB,EAChB,gCAAgC,CACjC,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,2BAA2B,+BAiBtC"}