7vsdk-pessoas 1.1.13 → 1.1.16

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 (68) hide show
  1. package/hyprjson.json +11 -0
  2. package/package.json +1 -1
  3. package/src/clients/base/CrudClientBase.ts +0 -1
  4. package/src/clients/enderecos/EnderecoCidadeClient.ts +0 -3
  5. package/src/clients/portalContador/EmpresaSdk.ts +3 -3
  6. package/src/clients/portalContador/ImpostoEstadualProdutoSdk.ts +39 -0
  7. package/src/clients/portalContador/ImpostoFederalProdutoSdk.ts +39 -0
  8. package/src/clients/portalContador/index.ts +2 -0
  9. package/src/tests/main.ts +9 -23
  10. package/dist/clients/AuthClient.d.ts +0 -7
  11. package/dist/clients/AuthClient.js +0 -29
  12. package/dist/clients/Debug.d.ts +0 -4
  13. package/dist/clients/Debug.js +0 -11
  14. package/dist/clients/base/CrudClientBase.d.ts +0 -22
  15. package/dist/clients/base/CrudClientBase.js +0 -81
  16. package/dist/clients/base/index.d.ts +0 -1
  17. package/dist/clients/base/index.js +0 -17
  18. package/dist/clients/enderecos/EnderecoBairroClient.d.ts +0 -10
  19. package/dist/clients/enderecos/EnderecoBairroClient.js +0 -17
  20. package/dist/clients/enderecos/EnderecoCidadeClient.d.ts +0 -10
  21. package/dist/clients/enderecos/EnderecoCidadeClient.js +0 -25
  22. package/dist/clients/enderecos/EnderecoSdk.d.ts +0 -12
  23. package/dist/clients/enderecos/EnderecoSdk.js +0 -14
  24. package/dist/clients/enderecos/UfClient.d.ts +0 -5
  25. package/dist/clients/enderecos/UfClient.js +0 -10
  26. package/dist/clients/enderecos/index.d.ts +0 -1
  27. package/dist/clients/enderecos/index.js +0 -17
  28. package/dist/clients/index.d.ts +0 -5
  29. package/dist/clients/index.js +0 -21
  30. package/dist/clients/pessoas/PessoaClient.d.ts +0 -20
  31. package/dist/clients/pessoas/PessoaClient.js +0 -33
  32. package/dist/clients/pessoas/PessoaCnpjClient.d.ts +0 -9
  33. package/dist/clients/pessoas/PessoaCnpjClient.js +0 -47
  34. package/dist/clients/pessoas/PessoaCpfClient.d.ts +0 -7
  35. package/dist/clients/pessoas/PessoaCpfClient.js +0 -10
  36. package/dist/clients/pessoas/PessoaEmailClient.d.ts +0 -7
  37. package/dist/clients/pessoas/PessoaEmailClient.js +0 -10
  38. package/dist/clients/pessoas/PessoaEnderecoClient.d.ts +0 -11
  39. package/dist/clients/pessoas/PessoaEnderecoClient.js +0 -18
  40. package/dist/clients/pessoas/PessoaNascimentoClient.d.ts +0 -7
  41. package/dist/clients/pessoas/PessoaNascimentoClient.js +0 -10
  42. package/dist/clients/pessoas/PessoaNecessidadeEspecial.d.ts +0 -7
  43. package/dist/clients/pessoas/PessoaNecessidadeEspecial.js +0 -10
  44. package/dist/clients/pessoas/PessoaProcedimentoClient.d.ts +0 -7
  45. package/dist/clients/pessoas/PessoaProcedimentoClient.js +0 -10
  46. package/dist/clients/pessoas/PessoaRelacaoClient.d.ts +0 -14
  47. package/dist/clients/pessoas/PessoaRelacaoClient.js +0 -54
  48. package/dist/clients/pessoas/PessoaRelacaoGrupoClient.d.ts +0 -10
  49. package/dist/clients/pessoas/PessoaRelacaoGrupoClient.js +0 -16
  50. package/dist/clients/pessoas/PessoaRelacaoTipoClient.d.ts +0 -12
  51. package/dist/clients/pessoas/PessoaRelacaoTipoClient.js +0 -29
  52. package/dist/clients/pessoas/PessoaTelefoneClient.d.ts +0 -11
  53. package/dist/clients/pessoas/PessoaTelefoneClient.js +0 -17
  54. package/dist/clients/pessoas/PessoaTipoClient.d.ts +0 -7
  55. package/dist/clients/pessoas/PessoaTipoClient.js +0 -10
  56. package/dist/clients/pessoas/index.d.ts +0 -13
  57. package/dist/clients/pessoas/index.js +0 -30
  58. package/dist/clients/portalContador/EmpresaSdk.d.ts +0 -12
  59. package/dist/clients/portalContador/EmpresaSdk.js +0 -28
  60. package/dist/clients/portalContador/index.d.ts +0 -1
  61. package/dist/clients/portalContador/index.js +0 -17
  62. package/dist/index.d.ts +0 -1
  63. package/dist/tests/index.d.ts +0 -1
  64. package/dist/tests/index.js +0 -2
  65. package/dist/tests/main.d.ts +0 -1
  66. package/dist/tests/main.js +0 -29
  67. package/src/clients/Debug.ts +0 -11
  68. package/src/tests/index.ts +0 -0
package/hyprjson.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "hyprland":
3
+ {
4
+ "browser": "firefox",
5
+ "terminal": "kitty",
6
+ "fileManager": "nnn"
7
+ },
8
+ "waybar": {
9
+
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "7vsdk-pessoas",
3
- "version": "1.1.13",
3
+ "version": "1.1.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,5 +1,4 @@
1
1
  import type { PessoaCnpjResponse, ResultDto } from "7vdomain";
2
- import { Debug } from "../Debug";
3
2
 
4
3
  export interface ICrudClientBase<TRequest, TResponse> {
5
4
  postAsync(data: TRequest): Promise<ResultDto<TResponse>>;
@@ -1,6 +1,5 @@
1
1
  import type { EnderecoCidadeRequest, EnderecoCidadeResponse, UfEnum } from "7vdomain";
2
2
  import { CrudClientBase } from "../base/CrudClientBase";
3
- import { Debug } from "../Debug";
4
3
 
5
4
  interface IEnderecoCidadeClient {
6
5
  pegarCidadePorNomeUf(nome: string, uf: UfEnum): Promise<EnderecoCidadeResponse | null>;
@@ -17,8 +16,6 @@ export class EnderecoCidadeClient extends CrudClientBase<EnderecoCidadeRequest,
17
16
  const safe = encodeURIComponent(nome);
18
17
  const url = `${this.baseUrl}${this.endpointBase}/nome/${safe}/${uf}`;
19
18
 
20
- Debug.debugMessage(`url feita ${url}`);
21
-
22
19
  const request = await fetch(url, {
23
20
  headers: this.headers
24
21
  });
@@ -3,7 +3,7 @@ import { EmpresaRootResponse, IncluirEmpresaRootRequest, ResultDto } from "7vdom
3
3
 
4
4
  interface IEmpresaSdk {
5
5
  incluirEmpresaRoot(request: IncluirEmpresaRootRequest): Promise<EmpresaRootResponse>
6
- listarEmpresasPeloRegistrador(registradorId: string): Promise<IncluirEmpresaRootRequest[]>
6
+ listarEmpresasPeloRegistradorId(registradorId: string): Promise<IncluirEmpresaRootRequest[]>
7
7
  }
8
8
 
9
9
  export class EmpresaSdk extends CrudClientBase<IncluirEmpresaRootRequest, EmpresaRootResponse>
@@ -13,7 +13,7 @@ export class EmpresaSdk extends CrudClientBase<IncluirEmpresaRootRequest, Empres
13
13
  super(baseUrl, "api/pdc/empresa", tokenJwt);
14
14
  }
15
15
 
16
- public async listarEmpresasPeloRegistrador(registradorId: string): Promise<IncluirEmpresaRootRequest[]> {
16
+ public async listarEmpresasPeloRegistradorId(registradorId: string): Promise<IncluirEmpresaRootRequest[]> {
17
17
  const right_guid = encodeURIComponent(registradorId);
18
18
  const res = await fetch(`${this.baseUrl}${this.endpointBase}/registradorid/${right_guid}`, { headers: this.headers });
19
19
 
@@ -25,7 +25,7 @@ export class EmpresaSdk extends CrudClientBase<IncluirEmpresaRootRequest, Empres
25
25
  const resultDto: ResultDto<IncluirEmpresaRootRequest[]> = await res.json();
26
26
 
27
27
  if (!resultDto.success || !resultDto.data) {
28
- throw new Error(resultDto.message || "Erro ao listar empresas");
28
+ throw new Error(resultDto.message);
29
29
  }
30
30
 
31
31
  return resultDto.data;
@@ -0,0 +1,39 @@
1
+ import { ImpostoEstadualProdutoResponse, ResultDto } from "7vdomain";
2
+
3
+ interface IImpostoEstadualProdutoSdk
4
+ {
5
+ ListarImpostosEstaduaisPorPessoaId(pessoaId: string): Promise<ResultDto<ImpostoEstadualProdutoResponse[]>>
6
+ }
7
+
8
+ export class ImpostoEstadualProdutoSdk implements IImpostoEstadualProdutoSdk
9
+ {
10
+
11
+ private readonly baseUrl: string;
12
+ private readonly token?: string;
13
+
14
+ constructor(baseUrl: string, token?: string) {
15
+ this.baseUrl = baseUrl;
16
+ this.token = token;
17
+ }
18
+
19
+ async ListarImpostosEstaduaisPorPessoaId(pessoaId: string): Promise<ResultDto<ImpostoEstadualProdutoResponse[]>> {
20
+ const response = await fetch(
21
+ `${this.baseUrl}/api/produto/imposto/estadual/${encodeURIComponent(pessoaId)}`,
22
+ {
23
+ method: "GET",
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ ...(this.token && {
27
+ Authorization: `Bearer ${this.token}`
28
+ })
29
+ }
30
+ }
31
+ );
32
+
33
+ if (!response.ok) {
34
+ throw new Error(`Erro ${response.status}: ${await response.text()}`);
35
+ }
36
+
37
+ return response.json();
38
+ }
39
+ }
@@ -0,0 +1,39 @@
1
+ import { ImpostoFederalProdutoResponse, ResultDto } from "7vdomain";
2
+
3
+ interface IImpostoFederalProdutoSdk
4
+ {
5
+ ListarImpostosFederaisPorPessoaId(pessoaId: string): Promise<ResultDto<ImpostoFederalProdutoResponse[]>>
6
+ }
7
+
8
+ export class ImpostoFederalProdutoSdk implements IImpostoFederalProdutoSdk
9
+ {
10
+
11
+ private readonly baseUrl: string;
12
+ private readonly token?: string;
13
+
14
+ constructor(baseUrl: string, token?: string) {
15
+ this.baseUrl = baseUrl;
16
+ this.token = token;
17
+ }
18
+
19
+ async ListarImpostosFederaisPorPessoaId(pessoaId: string): Promise<ResultDto<ImpostoFederalProdutoResponse[]>> {
20
+ const response = await fetch(
21
+ `${this.baseUrl}/api/produto/imposto/federal/${encodeURIComponent(pessoaId)}`,
22
+ {
23
+ method: "GET",
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ ...(this.token && {
27
+ Authorization: `Bearer ${this.token}`
28
+ })
29
+ }
30
+ }
31
+ );
32
+
33
+ if (!response.ok) {
34
+ throw new Error(`Erro ${response.status}: ${await response.text()}`);
35
+ }
36
+
37
+ return response.json();
38
+ }
39
+ }
@@ -1 +1,3 @@
1
1
  export * from "./EmpresaSdk";
2
+ export * from "./ImpostoEstadualProdutoSdk";
3
+ export * from "./ImpostoFederalProdutoSdk";
package/src/tests/main.ts CHANGED
@@ -1,31 +1,17 @@
1
- import { IncluirEmpresaRootRequest, RegimeEnum, SistemasEnum, UfEnum } from "7vdomain";
2
- import { AuthClient, EmpresaSdk } from "../clients";
1
+ import { EmpresaSdk, ImpostoEstadualProdutoSdk, ImpostoFederalProdutoSdk } from "../clients";
3
2
 
4
3
  async function main() {
5
- try {
6
- // instanciar SDK
7
- const empresaSdk = new EmpresaSdk("http://localhost:4220", "");
8
4
 
9
- // montar request
10
- const incluirRequest: IncluirEmpresaRootRequest = {
11
- pessoaRegistradoraId: "00000000-0000-0000-0000-000000001234",
12
- sistema: SistemasEnum.PlataformaContador,
13
- numeroCnpj: "12345678000195", // string
14
- ie: "123456789",
15
- razaoSocial: "Empresa Teste LTDA",
16
- nomeFantasia: "Empresa Teste",
17
- lucroReal: true,
18
- industria: false,
19
- grupo: "Grupo Teste",
20
- regimeTributario: RegimeEnum.Normal
21
- };
5
+ const getFederal: ImpostoFederalProdutoSdk = new ImpostoFederalProdutoSdk("http://localhost:7429", "no token");
6
+
7
+ const getEstadual: ImpostoEstadualProdutoSdk = new ImpostoEstadualProdutoSdk("http://localhost:7429", "no token");
8
+
9
+ const resEstadual = await getEstadual.ListarImpostosEstaduaisPorPessoaId("dcd5fcbb-7870-4b11-8a49-52cd229dc6c0");
10
+ const resFederal = await getFederal.ListarImpostosFederaisPorPessoaId("dcd5fcbb-7870-4b11-8a49-52cd229dc6c0");
22
11
 
23
- const response = await empresaSdk.incluirEmpresaRoot(incluirRequest);
24
- console.log("Empresa incluída:", response);
12
+ console.log(resEstadual.message);
13
+ console.log(resFederal.message);
25
14
 
26
- } catch (err: any) {
27
- console.error("Erro na operação:", err.message || err);
28
- }
29
15
  }
30
16
 
31
17
  main();
@@ -1,7 +0,0 @@
1
- import { UsuarioRequest, UsuarioResponse } from "7vdomain";
2
- export declare class AuthClient extends EventTarget {
3
- private readonly baseUrl;
4
- private readonly route;
5
- constructor(url: string);
6
- gerarToken(data: UsuarioRequest): Promise<UsuarioResponse>;
7
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthClient = void 0;
4
- class AuthClient extends EventTarget {
5
- constructor(url) {
6
- super();
7
- this.route = "/api/auth";
8
- this.baseUrl = url;
9
- }
10
- async gerarToken(data) {
11
- const response = await fetch(`${this.baseUrl}${this.route}`, {
12
- method: "POST",
13
- headers: { "Content-Type": "application/json" },
14
- body: JSON.stringify(data),
15
- });
16
- if (response.status === 404) {
17
- throw new Error(`Rota ${this.route} não encontrada. O servidor pode ter mudado o endpoint ou a URL base está incorreta.`);
18
- }
19
- if (!response.ok) {
20
- throw new Error(`Falha na requisição: ${response.status} ${response.statusText}`);
21
- }
22
- // desserializa como ResultDTO<UsuarioResponse>
23
- const result = await response.json();
24
- if (!result.data)
25
- throw new Error(result.message);
26
- return result.data;
27
- }
28
- }
29
- exports.AuthClient = AuthClient;
@@ -1,4 +0,0 @@
1
- export declare class Debug {
2
- private static debug;
3
- static debugMessage(msg: string): void;
4
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Debug = void 0;
4
- class Debug {
5
- static debugMessage(msg) {
6
- if (this.debug)
7
- console.log("-- DEBUG: ", msg);
8
- }
9
- }
10
- exports.Debug = Debug;
11
- Debug.debug = true;
@@ -1,22 +0,0 @@
1
- import type { PessoaCnpjResponse, ResultDto } from "7vdomain";
2
- export interface ICrudClientBase<TRequest, TResponse> {
3
- postAsync(data: TRequest): Promise<ResultDto<TResponse>>;
4
- getAsync?(id: number): Promise<ResultDto<TResponse | null>>;
5
- getPagedAsync?(pageNumber?: number, pageSize?: number): Promise<ResultDto<TResponse[]>>;
6
- updateAsync?(id: number, data: TRequest): Promise<ResultDto<TResponse>>;
7
- deleteAsync?(id: number): Promise<void>;
8
- }
9
- export declare abstract class CrudClientBase<TRequest, TResponse> implements ICrudClientBase<TRequest, TResponse> {
10
- protected baseUrl: string;
11
- protected endpointBase: string;
12
- protected tokenJwt: string;
13
- constructor(baseUrl: string, endpoint: string, tokenJwt: string);
14
- protected get headers(): HeadersInit;
15
- protected handleResponse<T>(res: Response): Promise<ResultDto<T>>;
16
- postAsync(data: TRequest): Promise<ResultDto<TResponse>>;
17
- getAsync(id: number): Promise<ResultDto<TResponse>>;
18
- pegarCnpj(cnpj: string): Promise<PessoaCnpjResponse>;
19
- getPagedAsync(pageNumber?: number, pageSize?: number): Promise<ResultDto<TResponse[]>>;
20
- updateAsync(id: number, data: TRequest): Promise<ResultDto<TResponse>>;
21
- deleteAsync(id: number): Promise<void>;
22
- }
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudClientBase = void 0;
4
- class CrudClientBase {
5
- constructor(baseUrl, endpoint, tokenJwt) {
6
- baseUrl = baseUrl.replace(/\/+$/, "");
7
- endpoint = "/" + endpoint.replace(/^\/+/, "");
8
- this.baseUrl = baseUrl;
9
- this.endpointBase = endpoint;
10
- this.tokenJwt = tokenJwt;
11
- }
12
- get headers() {
13
- const h = { "Content-Type": "application/json" };
14
- if (this.tokenJwt)
15
- h["Authorization"] = `Bearer ${this.tokenJwt}`;
16
- return h;
17
- }
18
- async handleResponse(res) {
19
- if (!res.ok) {
20
- const raw = await res.text();
21
- throw new Error(`HTTP ${res.status}: ${raw}`);
22
- }
23
- return await res.json();
24
- }
25
- async postAsync(data) {
26
- const res = await fetch(`${this.baseUrl}${this.endpointBase}`, {
27
- method: "POST",
28
- headers: this.headers,
29
- body: JSON.stringify(data),
30
- });
31
- return this.handleResponse(res);
32
- }
33
- async getAsync(id) {
34
- const res = await fetch(`${this.baseUrl}${this.endpointBase}/${id}`, { headers: this.headers });
35
- if (!res.ok) {
36
- return {
37
- data: null,
38
- success: false,
39
- message: `Request failed with status ${res.status}`,
40
- };
41
- }
42
- // mesmo que o body venha vazio, devolve um ResultDto
43
- const body = await res.json().catch(() => null);
44
- return {
45
- data: body,
46
- success: true,
47
- message: 'Request successful',
48
- };
49
- }
50
- async pegarCnpj(cnpj) {
51
- var _a;
52
- const url = `${this.baseUrl.replace(/\/$/, '')}/pessoa/cnpj/${cnpj}`;
53
- const res = await fetch(url, { headers: this.headers });
54
- const resultDto = await res.json();
55
- if (!res.ok || !resultDto.data) {
56
- throw new Error((_a = resultDto === null || resultDto === void 0 ? void 0 : resultDto.message) !== null && _a !== void 0 ? _a : `CNPJ ${cnpj} não encontrado`);
57
- }
58
- return resultDto.data;
59
- }
60
- async getPagedAsync(pageNumber = 1, pageSize = 25) {
61
- const res = await fetch(`${this.baseUrl}${this.endpointBase}?pageNumber=${pageNumber}&pageSize=${pageSize}`, { headers: this.headers });
62
- return this.handleResponse(res);
63
- }
64
- async updateAsync(id, data) {
65
- const res = await fetch(`${this.baseUrl}${this.endpointBase}/${id}`, {
66
- method: "PUT",
67
- headers: this.headers,
68
- body: JSON.stringify(data),
69
- });
70
- return this.handleResponse(res);
71
- }
72
- async deleteAsync(id) {
73
- const res = await fetch(`${this.baseUrl}${this.endpointBase}/${id}`, {
74
- method: "DELETE",
75
- headers: this.headers,
76
- });
77
- if (!res.ok)
78
- throw new Error(`HTTP ${res.status}: ${res.statusText}`);
79
- }
80
- }
81
- exports.CrudClientBase = CrudClientBase;
@@ -1 +0,0 @@
1
- export * from "./CrudClientBase";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./CrudClientBase"), exports);
@@ -1,10 +0,0 @@
1
- import { EnderecoBairroRequest, EnderecoBairroResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase";
3
- interface IEnderecoBairroClient {
4
- postarBairro(nome: string, cidadeId: number): Promise<EnderecoBairroResponse>;
5
- }
6
- export declare class EnderecoBairroClient extends CrudClientBase<EnderecoBairroRequest, EnderecoBairroResponse> implements IEnderecoBairroClient {
7
- constructor(Url: string, tokenJwt: string);
8
- postarBairro(nomeRua: string, cidadeIdd: number): Promise<EnderecoBairroResponse>;
9
- }
10
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnderecoBairroClient = void 0;
4
- const CrudClientBase_1 = require("../base/CrudClientBase");
5
- class EnderecoBairroClient extends CrudClientBase_1.CrudClientBase {
6
- constructor(Url, tokenJwt) {
7
- super(Url, "api/endereco/bairro", tokenJwt);
8
- }
9
- async postarBairro(nomeRua, cidadeIdd) {
10
- var _a;
11
- const responseEnvelope = await this.postAsync({ nome: nomeRua, enderecoCidadeId: cidadeIdd });
12
- if (!responseEnvelope.data)
13
- throw new Error((_a = responseEnvelope.message) !== null && _a !== void 0 ? _a : "Resposta do servidor sem dados");
14
- return responseEnvelope.data;
15
- }
16
- }
17
- exports.EnderecoBairroClient = EnderecoBairroClient;
@@ -1,10 +0,0 @@
1
- import type { EnderecoCidadeRequest, EnderecoCidadeResponse, UfEnum } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase";
3
- interface IEnderecoCidadeClient {
4
- pegarCidadePorNomeUf(nome: string, uf: UfEnum): Promise<EnderecoCidadeResponse | null>;
5
- }
6
- export declare class EnderecoCidadeClient extends CrudClientBase<EnderecoCidadeRequest, EnderecoCidadeResponse> implements IEnderecoCidadeClient {
7
- constructor(Url: string, tokenJwt: string);
8
- pegarCidadePorNomeUf(nome: string, uf: UfEnum): Promise<EnderecoCidadeResponse | null>;
9
- }
10
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnderecoCidadeClient = void 0;
4
- const CrudClientBase_1 = require("../base/CrudClientBase");
5
- const Debug_1 = require("../Debug");
6
- class EnderecoCidadeClient extends CrudClientBase_1.CrudClientBase {
7
- constructor(Url, tokenJwt) {
8
- super(Url, "api/endereco/cidade", tokenJwt);
9
- }
10
- async pegarCidadePorNomeUf(nome, uf) {
11
- if (!(nome === null || nome === void 0 ? void 0 : nome.trim()))
12
- throw new Error("nome inválido!");
13
- const safe = encodeURIComponent(nome);
14
- const url = `${this.baseUrl}${this.endpointBase}/nome/${safe}/${uf}`;
15
- Debug_1.Debug.debugMessage(`url feita ${url}`);
16
- const request = await fetch(url, {
17
- headers: this.headers
18
- });
19
- const response = await this.handleResponse(request);
20
- if (!response.data)
21
- throw new Error(response.message);
22
- return response.data;
23
- }
24
- }
25
- exports.EnderecoCidadeClient = EnderecoCidadeClient;
@@ -1,12 +0,0 @@
1
- import type { EnderecoBairroResponse, EnderecoCidadeResponse, EnderecoRequest, EnderecoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase";
3
- export interface EnderecoCompletoResponse {
4
- cidadeResponse: EnderecoCidadeResponse;
5
- bairroResponse: EnderecoBairroResponse;
6
- ruaResponse: EnderecoResponse;
7
- }
8
- export declare class EnderecoSdk extends CrudClientBase<EnderecoRequest, EnderecoResponse> {
9
- private readonly cidadeSdk;
10
- private readonly bairroSdk;
11
- constructor(Url: string, tokenJwt: string);
12
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnderecoSdk = void 0;
4
- const CrudClientBase_1 = require("../base/CrudClientBase");
5
- const EnderecoBairroClient_1 = require("./EnderecoBairroClient");
6
- const EnderecoCidadeClient_1 = require("./EnderecoCidadeClient");
7
- class EnderecoSdk extends CrudClientBase_1.CrudClientBase {
8
- constructor(Url, tokenJwt) {
9
- super(Url, "api/endereco/bairro", tokenJwt);
10
- this.cidadeSdk = new EnderecoCidadeClient_1.EnderecoCidadeClient(Url, tokenJwt);
11
- this.bairroSdk = new EnderecoBairroClient_1.EnderecoBairroClient(Url, tokenJwt);
12
- }
13
- }
14
- exports.EnderecoSdk = EnderecoSdk;
@@ -1,5 +0,0 @@
1
- import { UfRequest, UfResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base";
3
- export declare class UfClient extends CrudClientBase<UfRequest, UfResponse> {
4
- constructor(Url: string, tokenJwt: string);
5
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UfClient = void 0;
4
- const base_1 = require("../base");
5
- class UfClient extends base_1.CrudClientBase {
6
- constructor(Url, tokenJwt) {
7
- super(Url, "api/endereco/uf", tokenJwt);
8
- }
9
- }
10
- exports.UfClient = UfClient;
@@ -1 +0,0 @@
1
- export * from "./EnderecoSdk";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./EnderecoSdk"), exports);
@@ -1,5 +0,0 @@
1
- export * from "./base";
2
- export * from "./enderecos";
3
- export * from "./pessoas";
4
- export * from "./portalContador";
5
- export * from "./AuthClient";
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./base"), exports);
18
- __exportStar(require("./enderecos"), exports);
19
- __exportStar(require("./pessoas"), exports);
20
- __exportStar(require("./portalContador"), exports);
21
- __exportStar(require("./AuthClient"), exports);
@@ -1,20 +0,0 @@
1
- import { PessoaResponse } from "7vdomain";
2
- import { PessoaRequest } from "7vdomain";
3
- import { CrudClientBase } from "../base/CrudClientBase.js";
4
- interface IPessoaClient {
5
- postarPessoa(nome: string, sexo: string): Promise<PessoaResponse>;
6
- pegarPessoa(id: number): Promise<PessoaResponse>;
7
- deletarPessoa(id: number): Promise<void>;
8
- pegarPessoaPaginada(pagina: number, tamanho: number): Promise<PessoaResponse[]>;
9
- }
10
- export declare class PessoaClient extends CrudClientBase<PessoaRequest, PessoaResponse> implements IPessoaClient {
11
- constructor(urlServer: string, tokenJwt: string);
12
- constructor(server: {
13
- Url: string;
14
- }, tokenJwt: string);
15
- postarPessoa(nome: string, sexo: string): Promise<PessoaResponse>;
16
- pegarPessoa(id: number): Promise<PessoaResponse>;
17
- deletarPessoa(id: number): Promise<void>;
18
- pegarPessoaPaginada(pagina: number, tamanho: number): Promise<PessoaResponse[]>;
19
- }
20
- export {};
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(urlOrServer, tokenJwt) {
7
- if (typeof urlOrServer === 'string') {
8
- super(urlOrServer, '/api/pessoa', tokenJwt);
9
- }
10
- }
11
- async postarPessoa(nome, sexo) {
12
- const res = await this.postAsync({ nome, sexo });
13
- if (!res.data)
14
- throw new Error("Falha ao criar a pessoa");
15
- return res.data;
16
- }
17
- async pegarPessoa(id) {
18
- const res = await this.getAsync(id);
19
- if (!res.data)
20
- throw new Error("Pessoa não encontrada");
21
- return res.data;
22
- }
23
- async deletarPessoa(id) {
24
- return await this.deleteAsync(id);
25
- }
26
- async pegarPessoaPaginada(pagina, tamanho) {
27
- const res = await this.getPagedAsync(pagina, tamanho);
28
- if (!res.data)
29
- throw new Error("Nenhuma pessoa encontrada");
30
- return res.data;
31
- }
32
- }
33
- exports.PessoaClient = PessoaClient;
@@ -1,9 +0,0 @@
1
- import type { PessoaCnpjRequest, PessoaCnpjResponse, RegimeEnum } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaCnpjClient extends CrudClientBase<PessoaCnpjRequest, PessoaCnpjResponse> {
4
- constructor(Url: string, tokenJwt: string);
5
- criarPessoaCnpj(pessoaId: number, numero: string, ie: string, regimeTributario: RegimeEnum, lucroReal: boolean, industria: boolean): Promise<PessoaCnpjResponse>;
6
- pegarPessoaCnpj(pessoaId: number): Promise<PessoaCnpjResponse>;
7
- pegarCnpj(numero: string): Promise<PessoaCnpjResponse>;
8
- pegarPessoaCnpjPaginado(tamanhoPag: number, numeroPag: number): Promise<import("7vdomain").ResultDto<PessoaCnpjResponse[]>>;
9
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaCnpjClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaCnpjClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(Url, tokenJwt) {
7
- super(Url, "api/pessoa/cnpj", tokenJwt);
8
- this.baseUrl = Url;
9
- }
10
- async criarPessoaCnpj(pessoaId, numero, ie, regimeTributario, lucroReal, industria) {
11
- const request = {
12
- ie: ie,
13
- numero: numero,
14
- pessoaId: pessoaId,
15
- regimeTributario: regimeTributario,
16
- lucroReal: lucroReal,
17
- industria: industria
18
- };
19
- const response = await this.postAsync(request);
20
- if (!response.data) {
21
- throw new Error(response.message);
22
- }
23
- return response.data;
24
- }
25
- async pegarPessoaCnpj(pessoaId) {
26
- var _a;
27
- if (pessoaId === 0)
28
- throw new Error("o id fornecido para a busca está vindo como 0.");
29
- const response = await this.getAsync(pessoaId);
30
- if (!response.data) {
31
- throw new Error((_a = response.message) !== null && _a !== void 0 ? _a : "Não foi possível encontrar a pessoa CNPJ");
32
- }
33
- return response.data; // agora é do tipo PessoaCnpjResponse
34
- }
35
- async pegarCnpj(numero) {
36
- const url = `${this.baseUrl.replace(/\/$/, '')}${this.endpointBase}/numero/${numero}`;
37
- const response = await fetch(url);
38
- const resultDto = await response.json().catch();
39
- if (!resultDto.data)
40
- throw new Error(resultDto.message);
41
- return resultDto.data;
42
- }
43
- async pegarPessoaCnpjPaginado(tamanhoPag, numeroPag) {
44
- return await this.getPagedAsync(numeroPag, tamanhoPag);
45
- }
46
- }
47
- exports.PessoaCnpjClient = PessoaCnpjClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaCpfRequest, PessoaCpfResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaCpfClient extends CrudClientBase<PessoaCpfResponse, PessoaCpfRequest> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaCpfClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaCpfClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/cpf", tokenJwt);
8
- }
9
- }
10
- exports.PessoaCpfClient = PessoaCpfClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaEmailRequest, PessoaEmailResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaEmailClient extends CrudClientBase<PessoaEmailResponse, PessoaEmailRequest> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaEmailClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaEmailClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/email", tokenJwt);
8
- }
9
- }
10
- exports.PessoaEmailClient = PessoaEmailClient;
@@ -1,11 +0,0 @@
1
- import type { EnderecoTipoEnum, PessoaEnderecoRequest, PessoaEnderecoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- interface IPessoaEndereco {
4
- atribuirEndereco(idPessoa: number, idEndereco: number, pontoReferencia: string, numeroRua: string, tipoEndereco: EnderecoTipoEnum): Promise<PessoaEnderecoResponse>;
5
- }
6
- export declare class PessoaEnderecoClient extends CrudClientBase<PessoaEnderecoRequest, PessoaEnderecoResponse> implements IPessoaEndereco {
7
- private readonly enderecoSdk;
8
- constructor(url: string, tokenJwt: string);
9
- atribuirEndereco(idPessoa: number, idEndereco: number, pontoReferencia: string, numeroRua: string, tipoEndereco: EnderecoTipoEnum): Promise<PessoaEnderecoResponse>;
10
- }
11
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaEnderecoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- const EnderecoSdk_js_1 = require("../enderecos/EnderecoSdk.js");
6
- class PessoaEnderecoClient extends CrudClientBase_js_1.CrudClientBase {
7
- constructor(url, tokenJwt) {
8
- super(url, "api/pessoa/endereco", tokenJwt);
9
- this.enderecoSdk = new EnderecoSdk_js_1.EnderecoSdk(url, tokenJwt);
10
- }
11
- async atribuirEndereco(idPessoa, idEndereco, pontoReferencia, numeroRua, tipoEndereco) {
12
- const request = await this.postAsync({ enderecoId: idEndereco, enderecoTipoId: tipoEndereco, numero: numeroRua, pessoaId: idPessoa, pontoReferencia: pontoReferencia });
13
- if (!request || request.data == null)
14
- throw new Error(request.message);
15
- return request.data;
16
- }
17
- }
18
- exports.PessoaEnderecoClient = PessoaEnderecoClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaNascimentoRequest, PessoaNascimentoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaNascimentoClient extends CrudClientBase<PessoaNascimentoResponse, PessoaNascimentoRequest> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaNascimentoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaNascimentoClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/nascimento", tokenJwt);
8
- }
9
- }
10
- exports.PessoaNascimentoClient = PessoaNascimentoClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaNecessidadeEspecialRequest, PessoaNecessidadeEspecialResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaNecessidadeEspecialClient extends CrudClientBase<PessoaNecessidadeEspecialResponse, PessoaNecessidadeEspecialRequest> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaNecessidadeEspecialClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaNecessidadeEspecialClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/necessidade-especial", tokenJwt);
8
- }
9
- }
10
- exports.PessoaNecessidadeEspecialClient = PessoaNecessidadeEspecialClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaProcedimentoRequest, PessoaProcedimentoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaProcedimentoClient extends CrudClientBase<PessoaProcedimentoResponse, PessoaProcedimentoRequest> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaProcedimentoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaProcedimentoClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/procedimento", tokenJwt);
8
- }
9
- }
10
- exports.PessoaProcedimentoClient = PessoaProcedimentoClient;
@@ -1,14 +0,0 @@
1
- import type { PessoaRelacaoRequest, PessoaRelacaoResponse, SistemasEnum } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- interface IPessoaRelacaoClient {
4
- criarRelacao(pessoaIdRelacaoPai: number, PessoaIdRelacaoFilho: number, PessoaRelacaoTipoId: number, Sistema: SistemasEnum, PessoaTipoIdPai: number, PessoaTipoIdFilho: number): Promise<PessoaRelacaoResponse>;
5
- atribuirRelacaoIndefinida(pessoaIdPai: number, pessoaIdFilho: number, sistema: SistemasEnum): Promise<PessoaRelacaoResponse>;
6
- }
7
- export declare class PessoaRelacaoClient extends CrudClientBase<PessoaRelacaoRequest, PessoaRelacaoResponse> implements IPessoaRelacaoClient {
8
- constructor(Url: string, tokenJwt: string);
9
- atribuirRelacaoCliente(pessoaIdPai: number, pessoaIdFilho: number, sistema: SistemasEnum): Promise<PessoaRelacaoResponse>;
10
- excluirRelacaoIndefinida(pessoaIdPai: number, pessoaIdFilho: number, sistema: SistemasEnum, PessoaTipoIdFilho: number, pessoaTipoIdPai: number): Promise<boolean>;
11
- atribuirRelacaoIndefinida(pessoaIdPai: number, pessoaIdFilho: number, sistema: SistemasEnum): Promise<PessoaRelacaoResponse>;
12
- criarRelacao(PessoaIdRelacaoPai: number, PessoaIdRelacaoFilho: number, PessoaRelacaoTipoId: number, SistemaId: SistemasEnum, PessoaTipoIdPai: number, PessoaTipoIdFilho: number): Promise<PessoaRelacaoResponse>;
13
- }
14
- export {};
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaRelacaoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- const PessoaRelacaoTipoClient_js_1 = require("./PessoaRelacaoTipoClient.js");
6
- class PessoaRelacaoClient extends CrudClientBase_js_1.CrudClientBase {
7
- constructor(Url, tokenJwt) {
8
- super(Url, "api/pessoa/relacao", tokenJwt);
9
- }
10
- async atribuirRelacaoCliente(pessoaIdPai, pessoaIdFilho, sistema) {
11
- const request = await this.postAsync({
12
- sistemaId: sistema,
13
- pessoaRelacaoTipoId: 2, // o id do cliente no banco em 15/12/2025 para cliente, talvez tenha mudado, olhe no banco.
14
- pessoaIdRelacaoFilho: pessoaIdFilho,
15
- pessoaIdRelacaoPai: pessoaIdPai,
16
- pessoaTipoIdFilho: 2,
17
- pessoaTipoIdPai: 2,
18
- });
19
- if (!request.data)
20
- throw new Error(request.message);
21
- return request.data;
22
- }
23
- excluirRelacaoIndefinida(pessoaIdPai, pessoaIdFilho, sistema, PessoaTipoIdFilho, pessoaTipoIdPai) {
24
- throw new Error("Method not implemented.");
25
- }
26
- async atribuirRelacaoIndefinida(pessoaIdPai, pessoaIdFilho, sistema) {
27
- const request = await this.postAsync({
28
- sistemaId: sistema,
29
- pessoaRelacaoTipoId: 1,
30
- pessoaIdRelacaoFilho: pessoaIdFilho,
31
- pessoaIdRelacaoPai: pessoaIdPai,
32
- pessoaTipoIdFilho: 1,
33
- pessoaTipoIdPai: 1
34
- });
35
- if (!request.data)
36
- throw new Error(request.message);
37
- return request.data;
38
- }
39
- async criarRelacao(PessoaIdRelacaoPai, PessoaIdRelacaoFilho, PessoaRelacaoTipoId, SistemaId, PessoaTipoIdPai, PessoaTipoIdFilho) {
40
- const pessoaRelacaoTipoSdk = new PessoaRelacaoTipoClient_js_1.PessoaRelacaoTipoClient(this.baseUrl, this.tokenJwt);
41
- const response = await this.postAsync({
42
- pessoaIdRelacaoFilho: PessoaIdRelacaoFilho,
43
- pessoaIdRelacaoPai: PessoaIdRelacaoPai,
44
- pessoaRelacaoTipoId: PessoaRelacaoTipoId,
45
- pessoaTipoIdFilho: 1,
46
- pessoaTipoIdPai: 1,
47
- sistemaId: SistemaId
48
- });
49
- if (!response.data)
50
- throw new Error(response.message);
51
- return response.data;
52
- }
53
- }
54
- exports.PessoaRelacaoClient = PessoaRelacaoClient;
@@ -1,10 +0,0 @@
1
- import type { PessoaRelacaoGrupoRequest, PessoaRelacaoGrupoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- interface IPessoaRelacaoGrupoClient {
4
- criarGrupo(nomeGrupo: string): Promise<PessoaRelacaoGrupoResponse>;
5
- }
6
- export declare class PessoaRelacaoGrupoClient extends CrudClientBase<PessoaRelacaoGrupoRequest, PessoaRelacaoGrupoResponse> implements IPessoaRelacaoGrupoClient {
7
- constructor(Url: string, tokenJwt: string);
8
- criarGrupo(nomeGrupo: string): Promise<PessoaRelacaoGrupoResponse>;
9
- }
10
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaRelacaoGrupoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaRelacaoGrupoClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(Url, tokenJwt) {
7
- super(Url, "api/pessoa/relacao/grupo", tokenJwt);
8
- }
9
- async criarGrupo(nomeGrupo) {
10
- const req = await this.postAsync({ nome: nomeGrupo });
11
- if (!req.data)
12
- throw new Error(req.message);
13
- return req.data;
14
- }
15
- }
16
- exports.PessoaRelacaoGrupoClient = PessoaRelacaoGrupoClient;
@@ -1,12 +0,0 @@
1
- import { PessoaRelacaoGrupoEnum, PessoaRelacaoTipoRequest, PessoaRelacaoTipoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- interface IPessoaRelacaoTipoClient {
4
- criarRelacaoTipo(relacaoNome: string, urlPagin: string, relacaoGrupo: PessoaRelacaoGrupoEnum): Promise<PessoaRelacaoTipoResponse>;
5
- relacaoTipoExiste(relacaoId: number): Promise<PessoaRelacaoTipoResponse | null>;
6
- }
7
- export declare class PessoaRelacaoTipoClient extends CrudClientBase<PessoaRelacaoTipoRequest, PessoaRelacaoTipoResponse> implements IPessoaRelacaoTipoClient {
8
- constructor(Url: string, tokenJwt: string);
9
- relacaoTipoExiste(relacaoId: number): Promise<PessoaRelacaoTipoResponse | null>;
10
- criarRelacaoTipo(relacaoNome: string, urlPagin: string, relacaoGrupo: PessoaRelacaoGrupoEnum): Promise<PessoaRelacaoTipoResponse>;
11
- }
12
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaRelacaoTipoClient = void 0;
4
- const _7vdomain_1 = require("7vdomain");
5
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
6
- class PessoaRelacaoTipoClient extends CrudClientBase_js_1.CrudClientBase {
7
- constructor(Url, tokenJwt) {
8
- super(Url, "pessoa/relacao/tipo", tokenJwt);
9
- }
10
- async relacaoTipoExiste(relacaoId) {
11
- if (relacaoId == 0)
12
- throw new Error("o id passado em relacaoId está vindo zero.");
13
- const request = await this.getAsync(relacaoId);
14
- if (!request.data)
15
- throw new Error(request.message);
16
- return request.data;
17
- }
18
- async criarRelacaoTipo(relacaoNome, urlPagin, relacaoGrupo) {
19
- if (relacaoNome == "")
20
- throw new Error("uma relação não pode ter o nome vazio.");
21
- if (relacaoGrupo == _7vdomain_1.PessoaRelacaoGrupoEnum.Indefinido)
22
- console.warn("a relação está indefinida.");
23
- const response = await this.postAsync({ nome: relacaoNome, urlPagina: urlPagin, pessoaRelacaoGrupoId: relacaoGrupo });
24
- if (!response.data || response.data == null)
25
- throw new Error(response.message);
26
- return response.data;
27
- }
28
- }
29
- exports.PessoaRelacaoTipoClient = PessoaRelacaoTipoClient;
@@ -1,11 +0,0 @@
1
- import { PessoaTelefoneRequest, PessoaTelefoneResponse } from "7vdomain";
2
- import { TelefoneTipoEnum } from "7vdomain";
3
- import { CrudClientBase } from "../base";
4
- interface IPessoaTelefoneClient {
5
- criarTelefone(numero: string, pessoaId: number, telefoneTipo: TelefoneTipoEnum): Promise<PessoaTelefoneResponse>;
6
- }
7
- export declare class PesosaTelefoneClient extends CrudClientBase<PessoaTelefoneRequest, PessoaTelefoneResponse> implements IPessoaTelefoneClient {
8
- constructor(url: string, tok: string);
9
- criarTelefone(numero: string, pessoaId: number, telefoneTipo: TelefoneTipoEnum): Promise<PessoaTelefoneResponse>;
10
- }
11
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PesosaTelefoneClient = void 0;
4
- const base_1 = require("../base");
5
- class PesosaTelefoneClient extends base_1.CrudClientBase {
6
- constructor(url, tok) {
7
- super(url, "api/pessoa/telefone", tok);
8
- }
9
- async criarTelefone(numero, pessoaId, telefoneTipo) {
10
- const _req = { numero: numero, pessoaId: pessoaId, telefoneTipoId: telefoneTipo };
11
- const _res = await this.postAsync(_req);
12
- if (!_res.data)
13
- throw new Error(_res.message);
14
- return _res.data;
15
- }
16
- }
17
- exports.PesosaTelefoneClient = PesosaTelefoneClient;
@@ -1,7 +0,0 @@
1
- import type { PessoaTipoRequest, PessoaTipoResponse } from "7vdomain";
2
- import { CrudClientBase } from "../base/CrudClientBase.js";
3
- export declare class PessoaTipoClient extends CrudClientBase<PessoaTipoRequest, PessoaTipoResponse> {
4
- constructor(server: {
5
- Url: string;
6
- }, tokenJwt: string);
7
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PessoaTipoClient = void 0;
4
- const CrudClientBase_js_1 = require("../base/CrudClientBase.js");
5
- class PessoaTipoClient extends CrudClientBase_js_1.CrudClientBase {
6
- constructor(server, tokenJwt) {
7
- super(server.Url, "api/pessoa/tipo", tokenJwt);
8
- }
9
- }
10
- exports.PessoaTipoClient = PessoaTipoClient;
@@ -1,13 +0,0 @@
1
- export * from "./PessoaClient";
2
- export * from "./PessoaCpfClient";
3
- export * from "./PessoaCnpjClient";
4
- export * from "./PessoaEmailClient";
5
- export * from "./PessoaEnderecoClient";
6
- export * from "./PessoaNascimentoClient";
7
- export * from "./PessoaNecessidadeEspecial";
8
- export * from "./PessoaProcedimentoClient";
9
- export * from "./PessoaRelacaoClient";
10
- export * from "./PessoaRelacaoGrupoClient";
11
- export * from "./PessoaRelacaoTipoClient";
12
- export * from "./PessoaTelefoneClient";
13
- export * from "./PessoaTipoClient";
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- // src/clients/pessoas/index.ts
18
- __exportStar(require("./PessoaClient"), exports);
19
- __exportStar(require("./PessoaCpfClient"), exports);
20
- __exportStar(require("./PessoaCnpjClient"), exports);
21
- __exportStar(require("./PessoaEmailClient"), exports);
22
- __exportStar(require("./PessoaEnderecoClient"), exports);
23
- __exportStar(require("./PessoaNascimentoClient"), exports);
24
- __exportStar(require("./PessoaNecessidadeEspecial"), exports);
25
- __exportStar(require("./PessoaProcedimentoClient"), exports);
26
- __exportStar(require("./PessoaRelacaoClient"), exports);
27
- __exportStar(require("./PessoaRelacaoGrupoClient"), exports);
28
- __exportStar(require("./PessoaRelacaoTipoClient"), exports);
29
- __exportStar(require("./PessoaTelefoneClient"), exports);
30
- __exportStar(require("./PessoaTipoClient"), exports);
@@ -1,12 +0,0 @@
1
- import { CrudClientBase } from "../base";
2
- import { EmpresaRootResponse, IncluirEmpresaRootRequest } from "7vdomain";
3
- interface IEmpresaSdk {
4
- incluirEmpresaRoot(request: IncluirEmpresaRootRequest): Promise<EmpresaRootResponse>;
5
- listarEmpresasPeloRegistrador(registradorId: string): Promise<IncluirEmpresaRootRequest[]>;
6
- }
7
- export declare class EmpresaSdk extends CrudClientBase<IncluirEmpresaRootRequest, EmpresaRootResponse> implements IEmpresaSdk {
8
- constructor(baseUrl: string, tokenJwt: string);
9
- listarEmpresasPeloRegistrador(registradorId: string): Promise<IncluirEmpresaRootRequest[]>;
10
- incluirEmpresaRoot(request: IncluirEmpresaRootRequest): Promise<EmpresaRootResponse>;
11
- }
12
- export {};
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmpresaSdk = void 0;
4
- const base_1 = require("../base");
5
- class EmpresaSdk extends base_1.CrudClientBase {
6
- constructor(baseUrl, tokenJwt) {
7
- super(baseUrl, "api/pdc/empresa", tokenJwt);
8
- }
9
- async listarEmpresasPeloRegistrador(registradorId) {
10
- const right_guid = encodeURIComponent(registradorId);
11
- const res = await fetch(`${this.baseUrl}${this.endpointBase}/registradorid/${right_guid}`, { headers: this.headers });
12
- if (!res.ok) {
13
- throw new Error(`Request failed with status ${res.status}`);
14
- }
15
- const resultDto = await res.json();
16
- if (!resultDto.success || !resultDto.data) {
17
- throw new Error(resultDto.message || "Erro ao listar empresas");
18
- }
19
- return resultDto.data;
20
- }
21
- async incluirEmpresaRoot(request) {
22
- const response = await this.postAsync(request);
23
- if (response.data == null)
24
- throw new Error(response.message);
25
- return response.data;
26
- }
27
- }
28
- exports.EmpresaSdk = EmpresaSdk;
@@ -1 +0,0 @@
1
- export * from "./EmpresaSdk";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./EmpresaSdk"), exports);
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./clients";
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _7vdomain_1 = require("7vdomain");
4
- const clients_1 = require("../clients");
5
- async function main() {
6
- try {
7
- // instanciar SDK
8
- const empresaSdk = new clients_1.EmpresaSdk("http://localhost:4220", "");
9
- // montar request
10
- const incluirRequest = {
11
- pessoaRegistradoraId: "00000000-0000-0000-0000-000000001234",
12
- sistema: _7vdomain_1.SistemasEnum.PlataformaContador,
13
- numeroCnpj: "12345678000195", // string
14
- ie: "123456789",
15
- razaoSocial: "Empresa Teste LTDA",
16
- nomeFantasia: "Empresa Teste",
17
- lucroReal: true,
18
- industria: false,
19
- grupo: "Grupo Teste",
20
- regimeTributario: _7vdomain_1.RegimeEnum.Normal
21
- };
22
- const response = await empresaSdk.incluirEmpresaRoot(incluirRequest);
23
- console.log("Empresa incluída:", response);
24
- }
25
- catch (err) {
26
- console.error("Erro na operação:", err.message || err);
27
- }
28
- }
29
- main();
@@ -1,11 +0,0 @@
1
-
2
- export class Debug
3
- {
4
- private static debug: boolean = true;
5
-
6
- static debugMessage(msg: string): void
7
- {
8
- if(this.debug)
9
- console.log("-- DEBUG: ", msg);
10
- }
11
- }
File without changes