tychat-contracts 1.0.4 → 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.
package/README.md CHANGED
@@ -1,31 +1,30 @@
1
- # tychat-contracts-dtos
2
-
3
- DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos microserviços (ex.: **tychat-tenant-service**).
4
-
5
- ## Estrutura
6
-
7
- - **auth**: `LoginDto`
8
- - **tenants**: `CreateTenantDto`, `UpdateTenantDto`, `UpdateTenantPayloadDto`
9
-
10
- ## Uso
11
-
12
- ```bash
13
- # Build (gera dist/)
14
- npm run build
15
- ```
16
-
17
- Nos projetos que consomem (tychat-api, tychat-tenant-service):
18
-
19
- ```json
20
- "dependencies": {
21
- "tychat-contracts-dtos": "file:../tychat-contracts-dtos"
22
- }
23
- ```
24
-
25
- ```ts
26
- import { CreateTenantDto, UpdateTenantDto, LoginDto } from 'tychat-contracts-dtos';
27
- ```
28
-
29
- ## Desenvolvimento
30
-
31
- Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
1
+ # tychat-contracts-dtos
2
+
3
+ DTOs compartilhados com **class-validator** usados pela **tychat-api** e pelos microserviços (ex.: **tychat-tenant-service**).
4
+
5
+ ## Estrutura
6
+
7
+ - **auth**: `LoginDto`
8
+
9
+ ## Uso
10
+
11
+ ```bash
12
+ # Build (gera dist/)
13
+ npm run build
14
+ ```
15
+
16
+ Nos projetos que consomem (tychat-api, tychat-tenant-service):
17
+
18
+ ```json
19
+ "dependencies": {
20
+ "tychat-contracts-dtos": "file:../tychat-contracts-dtos"
21
+ }
22
+ ```
23
+
24
+ ```ts
25
+ import { LoginDto } from 'tychat-contracts-dtos';
26
+ ```
27
+
28
+ ## Desenvolvimento
29
+
30
+ Após alterar os DTOs, rode `npm run build` no pacote e reinstale (ou use `npm link`) nos projetos que o utilizam.
@@ -1,3 +1,4 @@
1
1
  export { LoginDto } from './login.dto';
2
2
  export { LoginPayload, ValidatePayload, RefreshPayload } from './auth-kafka.payloads';
3
+ export { RefreshTokenDto } from './refresh-token.dto';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoginDto = void 0;
3
+ exports.RefreshTokenDto = exports.LoginDto = void 0;
4
4
  var login_dto_1 = require("./login.dto");
5
5
  Object.defineProperty(exports, "LoginDto", { enumerable: true, get: function () { return login_dto_1.LoginDto; } });
6
+ var refresh_token_dto_1 = require("./refresh-token.dto");
7
+ Object.defineProperty(exports, "RefreshTokenDto", { enumerable: true, get: function () { return refresh_token_dto_1.RefreshTokenDto; } });
@@ -0,0 +1,4 @@
1
+ export declare class RefreshTokenDto {
2
+ refresh_token: string;
3
+ }
4
+ //# sourceMappingURL=refresh-token.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-token.dto.d.ts","sourceRoot":"","sources":["../../src/auth/refresh-token.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,eAAe;IAI1B,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,24 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RefreshTokenDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ class RefreshTokenDto {
16
+ refresh_token;
17
+ }
18
+ exports.RefreshTokenDto = RefreshTokenDto;
19
+ __decorate([
20
+ (0, swagger_1.ApiProperty)({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' }),
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.MinLength)(1, { message: 'refresh_token não pode ser vazio' }),
23
+ __metadata("design:type", String)
24
+ ], RefreshTokenDto.prototype, "refresh_token", void 0);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './auth';
2
- export * from './tenants';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
- __exportStar(require("./tenants"), exports);
@@ -1,4 +1 @@
1
- export { CreateTenantDto } from './create-tenant.dto';
2
- export { UpdateTenantDto } from './update-tenant.dto';
3
- export { UpdateTenantPayloadDto } from './update-tenant-payload.dto';
4
1
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenants/index.ts"],"names":[],"mappings":""}
@@ -1,9 +1,2 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateTenantPayloadDto = exports.UpdateTenantDto = exports.CreateTenantDto = void 0;
4
- var create_tenant_dto_1 = require("./create-tenant.dto");
5
- Object.defineProperty(exports, "CreateTenantDto", { enumerable: true, get: function () { return create_tenant_dto_1.CreateTenantDto; } });
6
- var update_tenant_dto_1 = require("./update-tenant.dto");
7
- Object.defineProperty(exports, "UpdateTenantDto", { enumerable: true, get: function () { return update_tenant_dto_1.UpdateTenantDto; } });
8
- var update_tenant_payload_dto_1 = require("./update-tenant-payload.dto");
9
- Object.defineProperty(exports, "UpdateTenantPayloadDto", { enumerable: true, get: function () { return update_tenant_payload_dto_1.UpdateTenantPayloadDto; } });
2
+ // DTOs de tenants foram movidos para o próprio microserviço tychat-tenant-service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "DTOs compartilhados com class-validator (API e microserviços)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/auth/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { LoginDto } from './login.dto';
2
2
  export { LoginPayload, ValidatePayload, RefreshPayload } from './auth-kafka.payloads';
3
+ export { RefreshTokenDto } from './refresh-token.dto';
@@ -0,0 +1,10 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { IsString, MinLength } from 'class-validator';
3
+
4
+ export class RefreshTokenDto {
5
+ @ApiProperty({ description: 'Token de refresh JWT', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
6
+ @IsString()
7
+ @MinLength(1, { message: 'refresh_token não pode ser vazio' })
8
+ refresh_token: string;
9
+ }
10
+
package/src/index.ts CHANGED
@@ -1,2 +1 @@
1
- export * from './auth';
2
- export * from './tenants';
1
+ export * from './auth';
@@ -1,3 +1 @@
1
- export { CreateTenantDto } from './create-tenant.dto';
2
- export { UpdateTenantDto } from './update-tenant.dto';
3
- export { UpdateTenantPayloadDto } from './update-tenant-payload.dto';
1
+ // DTOs de tenants foram movidos para o próprio microserviço tychat-tenant-service
@@ -1,55 +0,0 @@
1
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- IsString,
4
- IsOptional,
5
- IsInt,
6
- Min,
7
- Max,
8
- IsIn,
9
- MaxLength,
10
- MinLength,
11
- } from 'class-validator';
12
-
13
- export class CreateTenantDto {
14
- @ApiProperty({ description: 'Identificador único do tenant na URL', example: 'acme', maxLength: 255 })
15
- @IsString()
16
- @MinLength(1, { message: 'slug não pode ser vazio' })
17
- @MaxLength(255)
18
- slug: string;
19
-
20
- @ApiProperty({ description: 'Host do banco de dados do tenant', example: 'localhost', maxLength: 255 })
21
- @IsString()
22
- @MinLength(1, { message: 'dbHost não pode ser vazio' })
23
- @MaxLength(255)
24
- dbHost: string;
25
-
26
- @ApiPropertyOptional({ description: 'Porta do banco de dados', example: 5432, minimum: 1, maximum: 65535, default: 5432 })
27
- @IsOptional()
28
- @IsInt()
29
- @Min(1)
30
- @Max(65535)
31
- dbPort?: number;
32
-
33
- @ApiProperty({ description: 'Nome do banco de dados', example: 'tychat_acme', maxLength: 255 })
34
- @IsString()
35
- @MinLength(1, { message: 'dbName não pode ser vazio' })
36
- @MaxLength(255)
37
- dbName: string;
38
-
39
- @ApiProperty({ description: 'Usuário do banco de dados', example: 'tychat_user', maxLength: 255 })
40
- @IsString()
41
- @MinLength(1, { message: 'dbUser não pode ser vazio' })
42
- @MaxLength(255)
43
- dbUser: string;
44
-
45
- @ApiProperty({ description: 'Senha do banco de dados', example: 'secret', maxLength: 255 })
46
- @IsString()
47
- @MinLength(1, { message: 'dbPassword não pode ser vazio' })
48
- @MaxLength(255)
49
- dbPassword: string;
50
-
51
- @ApiPropertyOptional({ description: 'Status do tenant', enum: ['active', 'inactive'], default: 'active' })
52
- @IsOptional()
53
- @IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
54
- status?: 'active' | 'inactive';
55
- }
@@ -1,10 +0,0 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import { IsInt } from 'class-validator';
3
- import { UpdateTenantDto } from './update-tenant.dto';
4
-
5
- /** Payload do Kafka para tenant.update: id + campos opcionais. */
6
- export class UpdateTenantPayloadDto extends UpdateTenantDto {
7
- @ApiProperty({ description: 'ID do tenant a ser atualizado', example: 1 })
8
- @IsInt()
9
- id: number;
10
- }
@@ -1,60 +0,0 @@
1
- import { ApiPropertyOptional } from '@nestjs/swagger';
2
- import {
3
- IsString,
4
- IsOptional,
5
- IsInt,
6
- Min,
7
- Max,
8
- IsIn,
9
- MaxLength,
10
- MinLength,
11
- } from 'class-validator';
12
-
13
- export class UpdateTenantDto {
14
- @ApiPropertyOptional({ description: 'Identificador único do tenant na URL', example: 'acme', maxLength: 255 })
15
- @IsOptional()
16
- @IsString()
17
- @MinLength(1, { message: 'slug não pode ser vazio' })
18
- @MaxLength(255)
19
- slug?: string;
20
-
21
- @ApiPropertyOptional({ description: 'Host do banco de dados do tenant', example: 'localhost', maxLength: 255 })
22
- @IsOptional()
23
- @IsString()
24
- @MinLength(1, { message: 'dbHost não pode ser vazio' })
25
- @MaxLength(255)
26
- dbHost?: string;
27
-
28
- @ApiPropertyOptional({ description: 'Porta do banco de dados', example: 5432, minimum: 1, maximum: 65535 })
29
- @IsOptional()
30
- @IsInt()
31
- @Min(1)
32
- @Max(65535)
33
- dbPort?: number;
34
-
35
- @ApiPropertyOptional({ description: 'Nome do banco de dados', example: 'tychat_acme', maxLength: 255 })
36
- @IsOptional()
37
- @IsString()
38
- @MinLength(1, { message: 'dbName não pode ser vazio' })
39
- @MaxLength(255)
40
- dbName?: string;
41
-
42
- @ApiPropertyOptional({ description: 'Usuário do banco de dados', example: 'tychat_user', maxLength: 255 })
43
- @IsOptional()
44
- @IsString()
45
- @MinLength(1, { message: 'dbUser não pode ser vazio' })
46
- @MaxLength(255)
47
- dbUser?: string;
48
-
49
- @ApiPropertyOptional({ description: 'Senha do banco de dados', example: 'secret', maxLength: 255 })
50
- @IsOptional()
51
- @IsString()
52
- @MinLength(1, { message: 'dbPassword não pode ser vazio' })
53
- @MaxLength(255)
54
- dbPassword?: string;
55
-
56
- @ApiPropertyOptional({ description: 'Status do tenant', enum: ['active', 'inactive'] })
57
- @IsOptional()
58
- @IsIn(['active', 'inactive'], { message: 'status deve ser active ou inactive' })
59
- status?: 'active' | 'inactive';
60
- }