@appxdigital/appx-core 0.1.74 → 0.1.76

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.
@@ -6,7 +6,7 @@ export declare class AuthController {
6
6
  constructor(authService: AuthService);
7
7
  register(registerDto: RegisterDto): Promise<{
8
8
  message: string;
9
- user: any;
9
+ user: Omit<User, "password">;
10
10
  }>;
11
11
  login(req: Request, res: Response): Promise<void>;
12
12
  logout(req: Request, res: Response): Promise<void>;
@@ -4,6 +4,7 @@ import { PrismaService } from '../../prisma/prisma.service';
4
4
  import { ConfigService } from '@nestjs/config';
5
5
  import { Request, Response } from 'express';
6
6
  import { JwtService } from "@nestjs/jwt";
7
+ import { User } from "@prisma/client";
7
8
  export declare class AuthService {
8
9
  private readonly userService;
9
10
  private prisma;
@@ -13,7 +14,7 @@ export declare class AuthService {
13
14
  constructor(userService: UserService, prisma: PrismaService, jwtService: JwtService, configService: ConfigService);
14
15
  register(registerDto: RegisterDto): Promise<{
15
16
  message: string;
16
- user: any;
17
+ user: Omit<User, "password">;
17
18
  }>;
18
19
  login(req: Request): Promise<{
19
20
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/modules/auth/auth.service.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAIvC,qBACa,WAAW;IAIhB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ,C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O;IAW3B,iBAAiB,CAAC,GAAG,EAAE,OAAO;IAW9B,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IA0BhD,mBAAmB,CAAC,MAAM,EAAE,MAAM;IAMlC,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAOtC,kBAAkB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAQtC,cAAc;IA8BtB,aAAa,CAAC,yBAAyB,EAAE,GAAG,GAAG,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAC,CAAC;IAmB3G,OAAO,CAAC,WAAW;IAUb,QAAQ,CAAC,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAC,CAAC;IAUnG,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlE"}
@@ -1,8 +1,12 @@
1
1
  import { Store } from 'express-session';
2
2
  import { PrismaService } from '../../../prisma/prisma.service';
3
+ export type Options = {
4
+ ttl: number;
5
+ };
3
6
  export declare class CorePrismaSessionStore extends Store {
4
7
  private prisma;
5
- constructor(prismaService: PrismaService);
8
+ private options;
9
+ constructor(prismaService: PrismaService, options?: Options);
6
10
  get: (sid: string, callback: (err: any, session?: any | null) => void) => Promise<void>;
7
11
  set: (sid: string, session: any, callback?: (err?: any) => void) => Promise<void>;
8
12
  destroy: (sid: string, callback?: (err?: any) => void) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/session/session-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAGtC,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAI7D,q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AC,EAAE,GAAG,KAAK,IAAI,mBAcjE;IAEK,KAAK,GACR,KAAK,MAAM,EACX,SAAS,GAAG,EACZ,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,mBAiBhC;CACL"}
@@ -5,7 +5,7 @@ const express_session_1 = require("express-session");
5
5
  const library_1 = require("@prisma/client/runtime/library");
6
6
  const cuid2_1 = require("@paralleldrive/cuid2");
7
7
  class CorePrismaSessionStore extends express_session_1.Store {
8
- constructor(prismaService) {
8
+ constructor(prismaService, options) {
9
9
  super();
10
10
  this.get = async (sid, callback) => {
11
11
  try {
@@ -33,7 +33,7 @@ class CorePrismaSessionStore extends express_session_1.Store {
33
33
  const data = JSON.stringify(session);
34
34
  const expiresAt = session.cookie && session.cookie.expires
35
35
  ? new Date(session.cookie.expires)
36
- : null;
36
+ : new Date(Date.now() + this.options.ttl * 1000);
37
37
  await this.prisma.session.upsert({
38
38
  where: { sid },
39
39
  create: {
@@ -79,6 +79,9 @@ class CorePrismaSessionStore extends express_session_1.Store {
79
79
  if (session.cookie && session.cookie.maxAge) {
80
80
  expiresAt = new Date(Date.now() + session.cookie.maxAge);
81
81
  }
82
+ else {
83
+ expiresAt = new Date(Date.now() + this.options.ttl * 1000);
84
+ }
82
85
  await this.prisma.session.update({
83
86
  where: { sid },
84
87
  data: { expiresAt },
@@ -91,6 +94,11 @@ class CorePrismaSessionStore extends express_session_1.Store {
91
94
  callback(err);
92
95
  }
93
96
  };
97
+ // Merge default options with provided options
98
+ const defaultOptions = {
99
+ ttl: 3600 * 24, // Default to 1 day
100
+ };
101
+ this.options = { ...defaultOptions, ...(options || {}) };
94
102
  this.prisma = prismaService.prismaClient;
95
103
  }
96
104
  }
@@ -1,9 +1,10 @@
1
1
  import { PrismaService } from '../../prisma/prisma.service';
2
2
  import { UserCreateInput } from '../../common/interfaces/user.interface';
3
+ import { User } from '@prisma/client';
3
4
  export declare class UserService {
4
5
  private prisma;
5
6
  constructor(prisma: PrismaService);
6
- createUser(createUserInput: UserCreateInput): Promise<any>;
7
+ createUser(createUserInput: UserCreateInput): Promise<User>;
7
8
  findByField(field: string, value: any): Promise<any>;
8
9
  findByEmail(email: string): Promise<any>;
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../../src/modules/user/user.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,wCAAwC,CAAC;AAEvE,qBACa,WAAW;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEnC,UAAU,CAAC,eAAe,EAAE,eAAe;IAM3C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUpD,WAAW,CAAC,KAAK,EAAE,MAAM;CAYlC"}
1
+ {"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../../src/modules/user/user.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAEpC,qBACa,WAAW;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEnC,UAAU,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUpD,WAAW,CAAC,KAAK,EAAE,MAAM;CAYlC"}
@@ -17,8 +17,8 @@ export declare class PrismaService {
17
17
  */
18
18
  getModelDelegate<M extends ModelKey>(model: M): RuntimeClient[M];
19
19
  get model(): RuntimeClient;
20
- get user(): any;
21
- get session(): any;
20
+ get user(): RuntimeClient['user'];
21
+ get session(): RuntimeClient['session'];
22
22
  get userRefreshToken(): any;
23
23
  /**
24
24
  * Parses the Prisma schema to extract model information and field configurations
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../../src/prisma/prisma.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAI9E,OAAO,KAAK,EAAC,YAAY,IAAI,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAElE,KAAK,QAAQ,GAAG,MAAM,aAAa,CAAC;AAEpC,qBACa,aAAa;IAOY,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IANpE,OAAO,CAAC,YAAY,CAA2B;IAC/C,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,UAAU,CAAc;gBAG5B,YAAY,EAAE,YAAY,EACqB,iBAAiB,EAAE,qBAAqB;IAO3F,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC;IAIpE,WAAW;IA4CX;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAYhE,IAAI,KAAK,IAAI,aAAa,CAUzB;IAED,IAAI,IAAI,QAEP;IAED,IAAI,OAAO,QAEV;IAED,IAAI,gBAAgB,QAEnB;IAED;;;OAGG;IACH,WAAW;IASX;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IA4B/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,YAAY;IAMpB;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAiC1B,IAAI,2BAA2B,QAM9B;IAED;;;;;;;;;;;OAWG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tC;IAED,IAAI,gBAAgB,QAEnB;IAED;;;OAGG;IACH,WAAW;IASX;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IA4B/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,YAAY;IAMpB;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAiC1B,IAAI,2BAA2B,QAM9B;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,oBAAoB;IAqG5B,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;;;;;;;IAoCzD;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAgBvB;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAQvB;;;;;;;;;OASG;IACH,OAAO,CAAC,iBAAiB;IAkDzB;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;CAgB9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appxdigital/appx-core",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "description": "Appx Core is a library that provides a set of tools to help you build your application faster.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",