@smartsoft001/auth-shell-nestjs 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 +18 -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);
@@ -17,6 +16,7 @@ var TokenController = class {
17
16
  constructor(service) {
18
17
  this.service = service;
19
18
  }
19
+ service;
20
20
  create(req, httpReq) {
21
21
  return this.service.create(req, httpReq);
22
22
  }
@@ -86,10 +86,6 @@ import { Injectable } from "@nestjs/common";
86
86
  import { InjectRepository } from "@nestjs/typeorm";
87
87
  import { Guid as Guid2 } from "guid-typescript";
88
88
 
89
- // packages/shared/models/src/lib/symbols.ts
90
- var SYMBOL_MODEL = Symbol.for("smartsoft:model");
91
- var SYMBOL_FIELD = Symbol.for("smartsoft:field");
92
-
93
89
  // packages/shared/models/src/lib/decorators/model/model.decorator.ts
94
90
  import "reflect-metadata";
95
91
 
@@ -144,6 +140,11 @@ var TokenFactory = class {
144
140
  this.fbService = fbService;
145
141
  this.googleService = googleService;
146
142
  }
143
+ config;
144
+ repository;
145
+ jwtService;
146
+ fbService;
147
+ googleService;
147
148
  _invalidUsernameOrPasswordMessage = "Invalid username or password";
148
149
  static getQuery(config, customProvider = false) {
149
150
  switch (config.grant_type) {
@@ -163,8 +164,7 @@ var TokenFactory = class {
163
164
  }
164
165
  }
165
166
  static checkDisabled(user) {
166
- if (user.disabled)
167
- throw new DomainValidationError("user disabled");
167
+ if (user.disabled) throw new DomainValidationError("user disabled");
168
168
  }
169
169
  async create(options) {
170
170
  if (options.request.grant_type === "fb") {
@@ -238,25 +238,19 @@ var TokenFactory = class {
238
238
  throw new DomainValidationError(this._invalidUsernameOrPasswordMessage);
239
239
  }
240
240
  valid(req) {
241
- if (!req)
242
- throw new DomainValidationError("config is empty");
243
- if (!req.grant_type)
244
- throw new DomainValidationError("grant_type is empty");
241
+ if (!req) throw new DomainValidationError("config is empty");
242
+ if (!req.grant_type) throw new DomainValidationError("grant_type is empty");
245
243
  if (req.grant_type === "password") {
246
- if (!req.username)
247
- throw new DomainValidationError("username is empty");
248
- if (!req.password)
249
- throw new DomainValidationError("password is empty");
250
- if (!req.client_id)
251
- throw new DomainValidationError("client_id is empty");
244
+ if (!req.username) throw new DomainValidationError("username is empty");
245
+ if (!req.password) throw new DomainValidationError("password is empty");
246
+ if (!req.client_id) throw new DomainValidationError("client_id is empty");
252
247
  if (!this.config.clients.some((c) => c === req.client_id))
253
248
  throw new DomainValidationError("client_id is incorrect");
254
249
  } else if (req.grant_type === "refresh_token") {
255
250
  if (!req.refresh_token)
256
251
  throw new DomainValidationError("refresh_token is empty");
257
252
  } else if (req.grant_type === "fb") {
258
- if (!req.fb_token)
259
- throw new DomainValidationError("fb_token is empty");
253
+ if (!req.fb_token) throw new DomainValidationError("fb_token is empty");
260
254
  if (!req.fb_user_id)
261
255
  throw new DomainValidationError("fb_user_id is empty");
262
256
  } else if (req.grant_type === "google") {
@@ -303,6 +297,8 @@ var AuthService = class {
303
297
  this.factory = factory;
304
298
  this.moduleRef = moduleRef;
305
299
  }
300
+ factory;
301
+ moduleRef;
306
302
  create(req, httpReq) {
307
303
  return this.factory.create({
308
304
  httpReq,
@@ -353,6 +349,7 @@ var FbService = class {
353
349
  constructor(http) {
354
350
  this.http = http;
355
351
  }
352
+ http;
356
353
  async getUserId(token) {
357
354
  const { data } = await this.http.get("https://graph.facebook.com/me?access_token=" + token).toPromise();
358
355
  return data.id;
@@ -374,6 +371,7 @@ var GoogleService = class {
374
371
  constructor(http) {
375
372
  this.http = http;
376
373
  }
374
+ http;
377
375
  async getUserId(token) {
378
376
  const { data } = await this.http.get(
379
377
  "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=" + token
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/auth-shell-nestjs",
3
- "version": "2.127.0",
3
+ "version": "2.128.0",
4
4
  "description": "Utils for authorization",
5
5
  "repository": {
6
6
  "type": "git",