@nextage/nx-frame-be 1.0.5 → 1.0.6

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.
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { AppData } from './types';
3
4
  import { CryptoUtils } from './crypto';
4
5
  export declare const APP: AppData;
@@ -50,7 +50,7 @@ beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
50
50
  // generateSchema<CodedEntity>(ceModel, params);
51
51
  (0, generator_1.generateSchema)(coded_entity_controller_1.ceCtrl, params);
52
52
  const constraintDir = { name: 'constraint', typeDefs: graphql_constraint_directive_1.constraintDirectiveTypeDefs, transformer: (0, graphql_constraint_directive_1.constraintDirective)() };
53
- const config = (0, loader_1.makeApolloConfig)([directives_1.authDirective, constraintDir]);
53
+ const config = (0, loader_1.makeApolloConfig)([directives_1.authDirective, constraintDir], true);
54
54
  server = new server_1.ApolloServer(config);
55
55
  }));
56
56
  afterAll(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -9,6 +9,11 @@ export interface NxContext {
9
9
  userAgent?: string;
10
10
  remoteAddress?: string;
11
11
  res?: Response;
12
+ i18n?: string;
13
+ }
14
+ export interface NxJwtData extends NxObject {
15
+ rls?: string[];
16
+ i18n?: string;
12
17
  }
13
18
  export declare abstract class BaseUser {
14
19
  id?: string;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
+ /// <reference types="node" />
3
4
  import { ClassElement } from 'typescript';
4
5
  import moment, { Moment } from 'moment';
5
6
  import JSZip from 'jszip';
@@ -7,14 +8,14 @@ import schedule from 'node-schedule';
7
8
  import jwt from 'jsonwebtoken';
8
9
  import UAParser from 'ua-parser-js';
9
10
  import { DatePeriod } from './enums';
10
- import { NxObject, BaseUser, NxContext } from './interfaces';
11
+ import { NxObject, BaseUser, NxContext, NxJwtData } from './interfaces';
11
12
  export declare function devMode(): boolean;
12
13
  export declare function prodMode(): boolean;
13
14
  /**
14
15
  *
15
16
  * @param {*} jti
16
17
  */
17
- export declare function generateJwt(sub: string, jti: string, iss: string, signOpts?: jwt.SignOptions, secret?: jwt.Secret): string;
18
+ export declare function generateJwt(sub: string, jti: string, iss: string, data?: NxJwtData, signOpts?: jwt.SignOptions, secret?: jwt.Secret): string;
18
19
  /**
19
20
  *
20
21
  * @param {*} token
@@ -471,7 +472,7 @@ export declare function checkCommonPassword(commonPwds: string[], pwd: string):
471
472
  * @param {*} name
472
473
  * @param {*} callback
473
474
  */
474
- export declare function zipFolder(path: string, name: string): Promise<unknown>;
475
+ export declare function zipFolder(path: string, name: string): Promise<void>;
475
476
  /**
476
477
  *
477
478
  * @param {*} path
@@ -40,7 +40,7 @@ exports.prodMode = prodMode;
40
40
  *
41
41
  * @param {*} jti
42
42
  */
43
- function generateJwt(sub, jti, iss, signOpts = {}, secret) {
43
+ function generateJwt(sub, jti, iss, data, signOpts = {}, secret) {
44
44
  if (!secret)
45
45
  secret = process.env.JWT_SECRET;
46
46
  if (!signOpts)
@@ -54,7 +54,7 @@ function generateJwt(sub, jti, iss, signOpts = {}, secret) {
54
54
  if (!secret)
55
55
  throw new Error('Missing JWT secret');
56
56
  return jsonwebtoken_1.default.sign({
57
- sub, jti, iss
57
+ sub, jti, iss, data
58
58
  }, secret, signOpts);
59
59
  }
60
60
  exports.generateJwt = generateJwt;
@@ -817,7 +817,7 @@ exports.initObjectWithProperty = initObjectWithProperty;
817
817
  */
818
818
  function resizeBuffer(buffer, size) {
819
819
  const resizedBuffer = Buffer.allocUnsafe(size);
820
- buffer.copy(resizedBuffer);
820
+ buffer.copy(new Uint8Array(resizedBuffer));
821
821
  return resizedBuffer;
822
822
  }
823
823
  exports.resizeBuffer = resizeBuffer;
@@ -45,7 +45,7 @@ global.signin = () => {
45
45
  const userId = new mongoose_1.default.Types.ObjectId().toHexString();
46
46
  const accessId = new mongoose_1.default.Types.ObjectId().toHexString();
47
47
  // Create the JWT!
48
- const token = (0, common_1.generateJwt)(userId, accessId, 'user', {}, process.env.JWT_KEY);
48
+ const token = (0, common_1.generateJwt)(userId, accessId, 'user', {}, {}, process.env.JWT_KEY);
49
49
  // return a string thats the cookie with the encoded data
50
50
  return `Bearer ${token}`;
51
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextage/nx-frame-be",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "clean": "del ./build/*",
12
12
  "build": "npm run clean && tsc",
13
- "test": "jest --watchAll --no-cache",
13
+ "test": "jest --no-cache",
14
14
  "pub": "git add . && git commit -m \"Library updates\" && npm version patch && npm run build && npm publish"
15
15
  },
16
16
  "jest": {