@smartsoft001/auth-domain 2.127.0 → 2.128.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.
Files changed (2) hide show
  1. package/index.js +13 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
@@ -60,10 +59,6 @@ import { Injectable } from "@nestjs/common";
60
59
  import { InjectRepository } from "@nestjs/typeorm";
61
60
  import { Guid as Guid2 } from "guid-typescript";
62
61
 
63
- // packages/shared/models/src/lib/symbols.ts
64
- var SYMBOL_MODEL = Symbol.for("smartsoft:model");
65
- var SYMBOL_FIELD = Symbol.for("smartsoft:field");
66
-
67
62
  // packages/shared/models/src/lib/decorators/model/model.decorator.ts
68
63
  import "reflect-metadata";
69
64
 
@@ -118,6 +113,11 @@ var TokenFactory = class {
118
113
  this.fbService = fbService;
119
114
  this.googleService = googleService;
120
115
  }
116
+ config;
117
+ repository;
118
+ jwtService;
119
+ fbService;
120
+ googleService;
121
121
  _invalidUsernameOrPasswordMessage = "Invalid username or password";
122
122
  static getQuery(config, customProvider = false) {
123
123
  switch (config.grant_type) {
@@ -137,8 +137,7 @@ var TokenFactory = class {
137
137
  }
138
138
  }
139
139
  static checkDisabled(user) {
140
- if (user.disabled)
141
- throw new DomainValidationError("user disabled");
140
+ if (user.disabled) throw new DomainValidationError("user disabled");
142
141
  }
143
142
  async create(options) {
144
143
  if (options.request.grant_type === "fb") {
@@ -212,25 +211,19 @@ var TokenFactory = class {
212
211
  throw new DomainValidationError(this._invalidUsernameOrPasswordMessage);
213
212
  }
214
213
  valid(req) {
215
- if (!req)
216
- throw new DomainValidationError("config is empty");
217
- if (!req.grant_type)
218
- throw new DomainValidationError("grant_type is empty");
214
+ if (!req) throw new DomainValidationError("config is empty");
215
+ if (!req.grant_type) throw new DomainValidationError("grant_type is empty");
219
216
  if (req.grant_type === "password") {
220
- if (!req.username)
221
- throw new DomainValidationError("username is empty");
222
- if (!req.password)
223
- throw new DomainValidationError("password is empty");
224
- if (!req.client_id)
225
- throw new DomainValidationError("client_id is empty");
217
+ if (!req.username) throw new DomainValidationError("username is empty");
218
+ if (!req.password) throw new DomainValidationError("password is empty");
219
+ if (!req.client_id) throw new DomainValidationError("client_id is empty");
226
220
  if (!this.config.clients.some((c) => c === req.client_id))
227
221
  throw new DomainValidationError("client_id is incorrect");
228
222
  } else if (req.grant_type === "refresh_token") {
229
223
  if (!req.refresh_token)
230
224
  throw new DomainValidationError("refresh_token is empty");
231
225
  } else if (req.grant_type === "fb") {
232
- if (!req.fb_token)
233
- throw new DomainValidationError("fb_token is empty");
226
+ if (!req.fb_token) throw new DomainValidationError("fb_token is empty");
234
227
  if (!req.fb_user_id)
235
228
  throw new DomainValidationError("fb_user_id is empty");
236
229
  } else if (req.grant_type === "google") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/auth-domain",
3
- "version": "2.127.0",
3
+ "version": "2.128.0",
4
4
  "description": "Utils for authorization",
5
5
  "repository": {
6
6
  "type": "git",