sgp-sdk 1.2.0 → 2.0.0-beta.2

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 (100) hide show
  1. package/CHANGELOG.md +234 -0
  2. package/COMPATIBILITY.md +231 -0
  3. package/MIGRATION.md +344 -0
  4. package/README.md +464 -265
  5. package/dist/address.d.ts +46 -0
  6. package/dist/annotation-selection.d.ts +32 -0
  7. package/dist/budget.d.ts +29 -0
  8. package/dist/classify.d.ts +15 -0
  9. package/dist/client.d.ts +938 -165
  10. package/dist/config.d.ts +115 -0
  11. package/dist/constants.d.ts +85 -0
  12. package/dist/document.d.ts +11 -0
  13. package/dist/effect.d.ts +22 -0
  14. package/dist/executor.d.ts +9 -0
  15. package/dist/exposure.d.ts +21 -0
  16. package/dist/guards.d.ts +2 -0
  17. package/dist/hooks.d.ts +16 -0
  18. package/dist/ids.d.ts +19 -0
  19. package/dist/index.d.ts +55 -49
  20. package/dist/index.js +3750 -1293
  21. package/dist/normalize.d.ts +9 -0
  22. package/dist/operation-sensitivity.d.ts +729 -0
  23. package/dist/operation.d.ts +145 -0
  24. package/dist/operations/catalogs-list-billing-profiles.d.ts +16 -0
  25. package/dist/operations/catalogs-list-nas.d.ts +25 -0
  26. package/dist/operations/catalogs-list-pops.d.ts +14 -0
  27. package/dist/operations/contracts-check-connection.d.ts +56 -0
  28. package/dist/operations/contracts-list-services.d.ts +103 -0
  29. package/dist/operations/contracts-list-status-reasons.d.ts +15 -0
  30. package/dist/operations/contracts-list.d.ts +52 -0
  31. package/dist/operations/contracts-update-status.d.ts +41 -0
  32. package/dist/operations/contracts-update.d.ts +39 -0
  33. package/dist/operations/coverage-check-address.d.ts +46 -0
  34. package/dist/operations/coverage-check.d.ts +43 -0
  35. package/dist/operations/coverage-list-gateways.d.ts +16 -0
  36. package/dist/operations/crm-contracts-create-by-cpf-cnpj.d.ts +97 -0
  37. package/dist/operations/crm-contracts-create.d.ts +221 -0
  38. package/dist/operations/crm-contracts-list.d.ts +50 -0
  39. package/dist/operations/crm-customers-create.d.ts +165 -0
  40. package/dist/operations/crm-customers-update-status.d.ts +41 -0
  41. package/dist/operations/customers-list.d.ts +104 -0
  42. package/dist/{endpoints/ura/lookup-customer.d.ts → operations/customers-search.d.ts} +56 -46
  43. package/dist/operations/documents-add.d.ts +29 -0
  44. package/dist/operations/documents-list.d.ts +31 -0
  45. package/dist/operations/experimental-annotations-list.d.ts +67 -0
  46. package/dist/operations/invoices-list.d.ts +148 -0
  47. package/dist/operations/maintenance-list.d.ts +35 -0
  48. package/dist/operations/occurrences-create.d.ts +125 -0
  49. package/dist/operations/occurrences-list-methods.d.ts +14 -0
  50. package/dist/operations/occurrences-list-types.d.ts +20 -0
  51. package/dist/operations/occurrences-list.d.ts +127 -0
  52. package/dist/{endpoints/ura/list-plans.d.ts → operations/plans-list.d.ts} +33 -23
  53. package/dist/operations/pre-registrations-create.d.ts +276 -0
  54. package/dist/operations/pre-registrations-list-due-days.d.ts +15 -0
  55. package/dist/operations/pre-registrations-list-plans.d.ts +24 -0
  56. package/dist/operations/pre-registrations-list-sellers.d.ts +16 -0
  57. package/dist/operations/services-add-generic.d.ts +52 -0
  58. package/dist/operations/services-add-tv.d.ts +47 -0
  59. package/dist/operations/services-change-plan.d.ts +40 -0
  60. package/dist/operations/services-remove-generic.d.ts +28 -0
  61. package/dist/operations/services-remove-tv.d.ts +29 -0
  62. package/dist/operations/work-orders-get.d.ts +99 -0
  63. package/dist/operations/work-orders-list-comments.d.ts +34 -0
  64. package/dist/operations/work-orders-list-reasons.d.ts +20 -0
  65. package/dist/operations/work-orders-list.d.ts +81 -0
  66. package/dist/path.d.ts +13 -0
  67. package/dist/raw-request.d.ts +26 -0
  68. package/dist/request.d.ts +28 -0
  69. package/dist/result.d.ts +113 -41
  70. package/dist/retry.d.ts +34 -0
  71. package/dist/sensitivity.d.ts +89 -4
  72. package/dist/tolerant.d.ts +21 -0
  73. package/dist/validation.d.ts +3 -0
  74. package/package.json +6 -3
  75. package/dist/endpoint.d.ts +0 -66
  76. package/dist/endpoints/crm/address.d.ts +0 -20
  77. package/dist/endpoints/crm/create-contract.d.ts +0 -109
  78. package/dist/endpoints/crm/create-customer.d.ts +0 -65
  79. package/dist/endpoints/crm/update-customer-status.d.ts +0 -43
  80. package/dist/endpoints/os/list-occurrence-reasons.d.ts +0 -24
  81. package/dist/endpoints/os/list-occurrence-types.d.ts +0 -25
  82. package/dist/endpoints/precadastro/list-due-days.d.ts +0 -19
  83. package/dist/endpoints/precadastro/list-sellers.d.ts +0 -21
  84. package/dist/endpoints/suporte/add-customer-document.d.ts +0 -24
  85. package/dist/endpoints/suporte/list-customer-documents.d.ts +0 -25
  86. package/dist/endpoints/ura/check-coverage.d.ts +0 -46
  87. package/dist/endpoints/ura/list-annotations.d.ts +0 -32
  88. package/dist/endpoints/ura/list-clients.d.ts +0 -58
  89. package/dist/endpoints/ura/list-contracts.d.ts +0 -45
  90. package/dist/endpoints/ura/list-invoices.d.ts +0 -107
  91. package/dist/endpoints/ura/list-nas.d.ts +0 -29
  92. package/dist/endpoints/ura/list-occurrence-methods.d.ts +0 -19
  93. package/dist/endpoints/ura/list-payment-carriers.d.ts +0 -20
  94. package/dist/endpoints/ura/list-pops.d.ts +0 -19
  95. package/dist/endpoints/ura/list-service-orders.d.ts +0 -64
  96. package/dist/endpoints/ura/open-ticket.d.ts +0 -81
  97. package/dist/errors.d.ts +0 -59
  98. package/dist/schema/parse.d.ts +0 -19
  99. package/dist/schema/paths.d.ts +0 -38
  100. package/dist/transport.d.ts +0 -65
@@ -0,0 +1,104 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ declare const pageSchema: z.ZodObject<{
5
+ paginacao: z.ZodObject<{
6
+ offset: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
+ limit: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ parcial: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ total: z.ZodNumber;
10
+ }, z.core.$loose>;
11
+ clientes: z.ZodArray<z.ZodObject<{
12
+ id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
13
+ nome: z.ZodString;
14
+ tipo: z.ZodString;
15
+ cpfcnpj: z.ZodString;
16
+ sexo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
17
+ dataCadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
18
+ endereco: z.ZodNullable<z.ZodOptional<z.ZodObject<{
19
+ logradouro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ numero: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
21
+ bairro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
22
+ cidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
23
+ uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
+ cep: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
+ complemento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
26
+ latitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ longitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
+ }, z.core.$loose>>>;
29
+ contratos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
30
+ id: z.ZodNumber;
31
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ endereco: z.ZodNullable<z.ZodOptional<z.ZodObject<{
33
+ logradouro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ numero: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
35
+ bairro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
36
+ cidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
37
+ uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
38
+ cep: z.ZodNullable<z.ZodOptional<z.ZodString>>;
39
+ complemento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ latitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ longitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
+ }, z.core.$loose>>>;
43
+ servicos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ id: z.ZodNumber;
45
+ tipo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
46
+ plano: z.ZodNullable<z.ZodOptional<z.ZodObject<{
47
+ id: z.core.$ZodBranded<z.ZodNumber, "PlanId", "out">;
48
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
49
+ }, z.core.$loose>>>;
50
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
51
+ endereco: z.ZodNullable<z.ZodOptional<z.ZodObject<{
52
+ logradouro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
53
+ numero: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
54
+ bairro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
55
+ cidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
56
+ uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
57
+ cep: z.ZodNullable<z.ZodOptional<z.ZodString>>;
58
+ complemento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
59
+ latitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
60
+ longitude: z.ZodNullable<z.ZodOptional<z.ZodString>>;
61
+ }, z.core.$loose>>>;
62
+ }, z.core.$loose>>>>;
63
+ }, z.core.$loose>>>>;
64
+ titulos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>>;
65
+ contatos: z.ZodNullable<z.ZodOptional<z.ZodObject<{
66
+ telefones: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
67
+ celulares: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
68
+ emails: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
69
+ outros: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
70
+ }, z.core.$loose>>>;
71
+ }, z.core.$loose>>;
72
+ }, z.core.$loose>;
73
+ /** One page of `POST /api/ura/clientes/`, with SGP's own `paginacao`. */
74
+ export type CustomersListData = z.output<typeof pageSchema>;
75
+ /** Filters and paging of `customers.list`, named as SGP names them. */
76
+ export interface CustomersListInput {
77
+ /** Index of the first customer of the page. Non-negative integer. */
78
+ offset?: number;
79
+ /** Customers per page. Non-negative integer; SGP decides the cap. */
80
+ limit?: number;
81
+ /** Only the customer with this id, a `CustomerId` (never the id of a contract). */
82
+ cliente_id?: CustomerId;
83
+ /** Only customers with this CPF/CNPJ, in the format SGP stores it. */
84
+ cpfcnpj?: string;
85
+ /** Customers whose name matches, as SGP matches it. */
86
+ cliente_nome?: string;
87
+ /**
88
+ * Only the customer whose service has exactly this PPPoE login (exact match, observed live: a
89
+ * different or partial login lists nothing). Secret: never log it.
90
+ */
91
+ login?: string;
92
+ }
93
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
94
+ export declare const customersListInputSchema: z.ZodObject<{
95
+ offset: z.ZodOptional<z.ZodNumber>;
96
+ limit: z.ZodOptional<z.ZodNumber>;
97
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
98
+ cpfcnpj: z.ZodOptional<z.ZodString>;
99
+ cliente_nome: z.ZodOptional<z.ZodString>;
100
+ login: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strict>;
102
+ /** INTERNAL definition of `customers.list`. */
103
+ export declare const customersList: OperationDefinition<CustomersListData, "customers.list">;
104
+ export {};
@@ -1,16 +1,15 @@
1
1
  import { z } from "zod";
2
- import type { EndpointDefinition } from "../../endpoint.js";
3
- /** Response of `POST /api/ura/consultacliente/`: the contracts that match the filter. */
4
- export declare const lookupCustomerSchema: z.ZodObject<{
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const searchSchema: z.ZodObject<{
5
4
  msg: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
5
  contratos: z.ZodArray<z.ZodObject<{
7
6
  contratoId: z.ZodNumber;
8
- clienteId: z.ZodNumber;
9
- contratoStatus: z.ZodNumber;
10
- contratoStatusDisplay: z.ZodString;
11
- contratoValorAberto: z.ZodNumber;
12
- contratoTitulosAReceber: z.ZodNumber;
13
- cobVencimento: z.ZodNumber;
7
+ clienteId: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
8
+ contratoStatus: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ contratoStatusDisplay: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ contratoValorAberto: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
11
+ contratoTitulosAReceber: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
12
+ cobVencimento: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
14
13
  contratoStatusModo: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
15
14
  motivo_status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
16
15
  dataCadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -26,17 +25,17 @@ export declare const lookupCustomerSchema: z.ZodObject<{
26
25
  data_inicio: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
26
  descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
27
  data_fim: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
- }, z.core.$strip>>>;
30
- contrato_unificado_principal: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
31
- contrato_unificado_filhos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodNumber>>>;
28
+ }, z.core.$loose>>>;
29
+ contrato_unificado_principal: z.ZodOptional<z.ZodUnknown>;
30
+ contrato_unificado_filhos: z.ZodOptional<z.ZodUnknown>;
32
31
  tags: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
33
32
  color: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
33
  font: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
34
  tag: z.ZodNullable<z.ZodOptional<z.ZodString>>;
36
35
  id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
37
- categoria_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
38
- }, z.core.$strip>>>>;
39
- anotacoes: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$strip>>>>;
36
+ categoria_id: z.ZodOptional<z.ZodUnknown>;
37
+ }, z.core.$loose>>>>;
38
+ anotacoes: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
40
39
  contratoCentralLogin: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
40
  contratoCentralSenha: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
41
  servico_login: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -60,62 +59,73 @@ export declare const lookupCustomerSchema: z.ZodObject<{
60
59
  inscricoes: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
61
60
  tipoContato: z.ZodNullable<z.ZodOptional<z.ZodString>>;
62
61
  contato: z.ZodNullable<z.ZodOptional<z.ZodString>>;
63
- }, z.core.$strip>>>>;
64
- telefones_cargos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$strip>>>>;
62
+ }, z.core.$loose>>>>;
63
+ telefones_cargos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
65
64
  emails: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
66
65
  inscricoes: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString>>>;
67
66
  tipoContato: z.ZodNullable<z.ZodOptional<z.ZodString>>;
68
67
  contato: z.ZodNullable<z.ZodOptional<z.ZodString>>;
69
- }, z.core.$strip>>>>;
70
- outros: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$strip>>>>;
68
+ }, z.core.$loose>>>>;
69
+ outros: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
71
70
  endereco_logradouro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
72
- endereco_numero: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
71
+ endereco_numero: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
73
72
  endereco_complemento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
74
73
  endereco_bairro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
75
74
  endereco_cidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
76
75
  endereco_uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
77
76
  endereco_cep: z.ZodNullable<z.ZodOptional<z.ZodString>>;
78
- endereco_pontoreferencia: z.ZodNullable<z.ZodOptional<z.ZodString>>;
77
+ endereco_pontoreferencia: z.ZodOptional<z.ZodUnknown>;
79
78
  endereco_ll: z.ZodNullable<z.ZodOptional<z.ZodString>>;
80
- }, z.core.$strip>>;
81
- }, z.core.$strip>;
82
- /** Key fields of `ura/consultacliente`: required and strict; any mismatch is `SCHEMA_MISMATCH`. */
83
- export declare const lookupCustomerKeyFields: readonly ["contratos", "contratos[].contratoId", "contratos[].clienteId", "contratos[].contratoStatus", "contratos[].contratoStatusDisplay", "contratos[].contratoValorAberto", "contratos[].contratoTitulosAReceber", "contratos[].cobVencimento"];
84
- /** Normalized path of each contract item in the `ura/consultacliente` response. */
85
- export declare const customerContractItemPath = "contratos[]";
86
- /** Keys of a contract item holding secrets: Central and PPPoE credentials, Wi-Fi, MACs, payoff link. */
87
- export declare const customerContractSecretKeys: readonly ["contratoCentralLogin", "contratoCentralSenha", "servico_login", "servico_senha", "servico_wifi_password", "servico_wifi_password_5", "servico_wifi_ssid", "servico_wifi_ssid_5", "servico_mac", "servico_mac2", "link_quitacao"];
88
- /** Keys of a contract item holding personal data: name, CPF/CNPJ, birth date, contacts, address, notes, status reason. */
89
- export declare const customerContractPersonalKeys: readonly ["motivo_status", "razaoSocial", "cpfCnpj", "dataNascimento", "telefones", "telefones_cargos", "emails", "outros", "anotacoes", "endereco_logradouro", "endereco_numero", "endereco_complemento", "endereco_bairro", "endereco_cidade", "endereco_uf", "endereco_cep", "endereco_pontoreferencia", "endereco_ll"];
90
- interface LookupCustomerFilters {
91
- /** CPF or CNPJ of the customer. */
79
+ }, z.core.$loose>>;
80
+ }, z.core.$loose>;
81
+ /**
82
+ * The response of `POST /api/ura/consultacliente/`, in SGP's own shape. `contratos` holds the
83
+ * CANDIDATES: one entry per contract that matches the criteria, each carrying its customer's data
84
+ * flattened (`clienteId`, `razaoSocial`, `cpfCnpj`...) and the service's credentials. It is never
85
+ * one customer picked for you: see {@link CustomersSearchInput}.
86
+ */
87
+ export type CustomersSearchData = z.output<typeof searchSchema>;
88
+ interface CustomersSearchCriteria {
89
+ /** Customer or company document (CPF/CNPJ), in the format SGP stores it. */
92
90
  cpfcnpj?: string;
93
- /** Contract ID. */
91
+ /** Contract id. */
94
92
  contrato?: number;
95
- /** Customer name. */
93
+ /** Customer name, as SGP matches it. */
96
94
  nome?: string;
97
95
  /** Service login (PPPoE). */
98
96
  login?: string;
97
+ /** Phone number, as SGP matches it. */
99
98
  telefone?: string;
100
99
  }
101
100
  /**
102
- * Body parameters of `POST /api/ura/consultacliente/` (besides credentials).
101
+ * Criteria of `customers.search`, named as SGP names them. At least one is required, and a text
102
+ * criterion cannot be an empty string (parameter validation: a string of spaces is not empty and
103
+ * goes to SGP as given): otherwise the call is refused locally (`INVALID_INPUT`, nothing sent). How criteria combine and how names and phones are matched is SGP's decision, not the SDK's.
103
104
  *
104
- * At least one of `cpfcnpj`, `contrato`, `nome`, `login` or `telefone` is required; the others are optional.
105
+ * It is a search, not a lookup by key: any criterion other than `contrato` may match several
106
+ * contracts, of one customer or of different customers (the same document may belong to more than
107
+ * one customer). The result is the list of candidates, possibly empty or long; the SDK never
108
+ * narrows it to one.
105
109
  */
106
- export type LookupCustomerParams = (LookupCustomerFilters & {
110
+ export type CustomersSearchInput = (CustomersSearchCriteria & {
107
111
  cpfcnpj: string;
108
- }) | (LookupCustomerFilters & {
112
+ }) | (CustomersSearchCriteria & {
109
113
  contrato: number;
110
- }) | (LookupCustomerFilters & {
114
+ }) | (CustomersSearchCriteria & {
111
115
  nome: string;
112
- }) | (LookupCustomerFilters & {
116
+ }) | (CustomersSearchCriteria & {
113
117
  login: string;
114
- }) | (LookupCustomerFilters & {
118
+ }) | (CustomersSearchCriteria & {
115
119
  telefone: string;
116
120
  });
117
- /** Parsed response of `POST /api/ura/consultacliente/`. */
118
- export type LookupCustomerResponse = z.output<typeof lookupCustomerSchema>;
119
- /** Definition of `POST /api/ura/consultacliente/`. */
120
- export declare const lookupCustomerDefinition: EndpointDefinition<typeof lookupCustomerSchema>;
121
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
122
+ export declare const customersSearchInputSchema: z.ZodObject<{
123
+ cpfcnpj: z.ZodOptional<z.ZodString>;
124
+ contrato: z.ZodOptional<z.ZodNumber>;
125
+ nome: z.ZodOptional<z.ZodString>;
126
+ login: z.ZodOptional<z.ZodString>;
127
+ telefone: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strict>;
129
+ /** INTERNAL definition of `customers.search`. */
130
+ export declare const customersSearch: OperationDefinition<CustomersSearchData, "customers.search">;
121
131
  export {};
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { FilePart, OperationDefinition } from "../operation.js";
4
+ /**
5
+ * A file to upload: its bytes, the name SGP sees and, optionally, the MIME type. Without
6
+ * `contentType`, a `Blob` keeps its own `type` and raw bytes get none.
7
+ */
8
+ export type DocumentFile = FilePart;
9
+ /** Input of `documents.add`, named as SGP names the fields. */
10
+ export interface DocumentAddInput {
11
+ /** ID of the customer the document is attached to. Goes in the path. */
12
+ cliente_id: CustomerId;
13
+ /** The document, sent as the multipart part `file`. */
14
+ file: DocumentFile;
15
+ /** Description of the document. Personal data when it names the customer. */
16
+ descricao?: string;
17
+ }
18
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
19
+ export declare const documentsAddInputSchema: z.ZodObject<{
20
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
21
+ file: z.ZodObject<{
22
+ data: z.ZodCustom<ArrayBuffer | Blob | Uint8Array<ArrayBufferLike>, ArrayBuffer | Blob | Uint8Array<ArrayBufferLike>>;
23
+ filename: z.ZodString;
24
+ contentType: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strict>;
26
+ descricao: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strict>;
28
+ /** INTERNAL definition of `documents.add`. */
29
+ export declare const documentsAdd: OperationDefinition<null, "documents.add">;
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ /** Input of `documents.list`, named as SGP names the field. */
5
+ export interface DocumentsListInput {
6
+ /**
7
+ * Exercised. ID of the customer whose documents to list, a `CustomerId` (the `id` of
8
+ * `customers.list`, the `clienteId` of `customers.search`), never the id of a contract.
9
+ */
10
+ cliente_id: CustomerId;
11
+ }
12
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
13
+ export declare const documentsListInputSchema: z.ZodObject<{
14
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
15
+ }, z.core.$strict>;
16
+ declare const documentsSchema: z.ZodArray<z.ZodObject<{
17
+ id: z.ZodNumber;
18
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
19
+ arquivo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ usuario: z.ZodNullable<z.ZodOptional<z.ZodString>>;
22
+ }, z.core.$loose>>;
23
+ /**
24
+ * The response of `GET /api/suporte/cliente/{cliente_id}/documento/list/`, in SGP's own shape: a
25
+ * bare array with one entry per document attached to the customer. The route is not paginated, so
26
+ * there is no envelope and no total. An empty array means no document.
27
+ */
28
+ export type DocumentsListData = z.output<typeof documentsSchema>;
29
+ /** INTERNAL definition of `documents.list`. */
30
+ export declare const documentsList: OperationDefinition<DocumentsListData, "documents.list">;
31
+ export {};
@@ -0,0 +1,67 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ declare const annotationSchema: z.ZodObject<{
5
+ id: z.ZodNumber;
6
+ cliente: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
7
+ clientecontrato: z.ZodNullable<z.ZodNumber>;
8
+ anotacao: z.ZodString;
9
+ usuario: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
10
+ tipo: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
11
+ alerta_modo: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
12
+ data_cadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
13
+ data_alteracao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ }, z.core.$loose>;
15
+ /**
16
+ * One note SGP holds about a customer, as the local selection let it through: the typed fields
17
+ * (unknown keys included) plus `raw`, a deep copy of that one record exactly as SGP sent it, so a
18
+ * field that left its typed position with a warning stays recoverable there. A key named `raw` in
19
+ * SGP's record is shadowed by this one and is found at `raw.raw`. Free text and staff identity:
20
+ * see `getSensitivity("experimental.annotations.list")`; `raw` mirrors them and is personal data.
21
+ */
22
+ export type ExperimentalAnnotation = z.output<typeof annotationSchema> & {
23
+ raw: Record<string, unknown>;
24
+ };
25
+ /**
26
+ * Notes of `experimental.annotations.list` that match the requested customer and/or contract, in
27
+ * the order and with the duplicates SGP sent. Empty when none matches.
28
+ */
29
+ export type ExperimentalAnnotationsListData = ExperimentalAnnotation[];
30
+ /**
31
+ * Filters of `experimental.annotations.list`, named as SGP names them. At least one is required,
32
+ * and both together mean AND (the intersection); nothing is ever sent without a filter.
33
+ */
34
+ export type ExperimentalAnnotationsListInput = {
35
+ /** Only notes of this customer, those without a contract included. Positive safe integer. */
36
+ cliente_id: CustomerId;
37
+ /** Only notes of this contract. Positive safe integer. */
38
+ contrato_id?: number;
39
+ } | {
40
+ /** Only notes of this customer, those without a contract included. Positive safe integer. */
41
+ cliente_id?: CustomerId;
42
+ /** Only notes of this contract. Positive safe integer. */
43
+ contrato_id: number;
44
+ };
45
+ /**
46
+ * INTERNAL. Validation of the input, exported so a test can check its keys are classified. A key it
47
+ * does not name is refused, not forwarded: the request can never be widened by the caller.
48
+ */
49
+ export declare const experimentalAnnotationsListInputSchema: z.ZodObject<{
50
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
51
+ contrato_id: z.ZodOptional<z.ZodNumber>;
52
+ }, z.core.$strict>;
53
+ declare const NAME = "experimental.annotations.list";
54
+ /**
55
+ * INTERNAL. The registered face of `experimental.annotations.list`, which `getSensitivity` reads. It
56
+ * has no filters, so it fails closed: it refuses every input and decodes nothing. A call runs on
57
+ * {@link annotationsListFor}, which binds the filters the local selection needs.
58
+ */
59
+ export declare const experimentalAnnotationsList: OperationDefinition<ExperimentalAnnotationsListData, typeof NAME>;
60
+ /**
61
+ * INTERNAL. The definition of one call. The decoder selects locally, so it needs the filters of the
62
+ * call; the executor hands a decoder the body only. `buildRequest` receives the executor's snapshot
63
+ * of the caller's input and binds the filters of valid input here; anything else leaves the
64
+ * definition failing closed: it refuses the input and decodes nothing. One definition per call.
65
+ */
66
+ export declare const annotationsListForCall: () => OperationDefinition<ExperimentalAnnotationsListData, typeof NAME>;
67
+ export {};
@@ -0,0 +1,148 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ declare const pageSchema: z.ZodObject<{
5
+ paginacao: z.ZodObject<{
6
+ offset: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
+ limit: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ parcial: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
9
+ total: z.ZodNumber;
10
+ }, z.core.$loose>;
11
+ titulos: z.ZodArray<z.ZodObject<{
12
+ id: z.ZodNumber;
13
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ valor: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
15
+ dataVencimento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
16
+ clienteNome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
17
+ clienteCpfcnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
18
+ clienteContrato: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
19
+ portador: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ numeroDocumento: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
21
+ nossoNumero: z.ZodNullable<z.ZodOptional<z.ZodString>>;
22
+ link: z.ZodNullable<z.ZodOptional<z.ZodString>>;
23
+ link_cobranca: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
+ valorDesconto: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
25
+ valorCorrigido: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
26
+ valorPago: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
27
+ valorPagoParcial: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
28
+ codigoBarras: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ linhaDigitavel: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
+ codigoPix: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ dataEmissao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ dataPagamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
+ dataCancelamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ demonstrativo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
+ acordoPagamento: z.ZodNullable<z.ZodOptional<z.ZodObject<{
36
+ acordados: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
37
+ cobrados: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
38
+ }, z.core.$loose>>>;
39
+ formaPagamento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ usuario_baixa: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ }, z.core.$loose>>;
42
+ }, z.core.$loose>;
43
+ /**
44
+ * One page of `POST /api/ura/titulos/`, with SGP's own `paginacao`, returned as received:
45
+ *
46
+ * - `offset`: index of the first invoice of the page (SGP starts at 0);
47
+ * - `limit`: page size SGP applied, which may differ from the one requested (SGP caps it);
48
+ * - `parcial`: how many invoices this page holds (observed equal to `titulos.length`);
49
+ * - `total`: how many invoices match the filters in all, across every page.
50
+ *
51
+ * Money is normalized: `valor`, `valorDesconto`, `valorCorrigido`, `valorPago` and
52
+ * `valorPagoParcial` are a `number` (reais) or `null`. SGP sends `valor` as a number or as `""` for an
53
+ * absent amount (`null`, never `0`); numeric text with `.` is read as a number; formatted text such
54
+ * as `"1.234,56"` is never guessed: the field leaves `data` with a warning and stays in
55
+ * `response.body`. Changed versus 2.0.0-beta.1 (where `""` dropped the field).
56
+ *
57
+ * `total` is SGP's and never computed by the SDK: a page without a numeric `total` is
58
+ * `INVALID_RESPONSE`. Nothing here fetches the next page: ask for it with `offset`.
59
+ */
60
+ export type InvoicesListData = z.output<typeof pageSchema>;
61
+ /**
62
+ * Filters, paging and ordering of `invoices.list`, named as SGP names them (the choices are those
63
+ * of SGP's public collection). All optional; SGP decides how filters combine.
64
+ */
65
+ export interface InvoicesListInput {
66
+ /** Index of the first invoice of the page; SGP starts at 0. Non-negative integer. */
67
+ offset?: number;
68
+ /** Invoices per page. Non-negative integer; SGP documents a maximum of 250 and caps larger values. */
69
+ limit?: number;
70
+ /** Only the invoice with this id. */
71
+ titulo_id?: number;
72
+ /** Only invoices of the customer with this id, a `CustomerId` (never the id of a contract). */
73
+ cliente_id?: CustomerId;
74
+ /** Only invoices of the customer with this CPF/CNPJ. */
75
+ cpfcnpj?: string;
76
+ /** Only invoices of this contract. */
77
+ contrato?: number;
78
+ /** Only open (`abertos`), paid (`pagos`) or cancelled (`cancelados`) invoices. */
79
+ status?: "abertos" | "pagos" | "cancelados";
80
+ /** Only invoices issued through this billing profile (portador) id. */
81
+ portador?: number;
82
+ /** Field the invoices are ordered by. */
83
+ ordenar?: "data_documento" | "data_vencimento" | "data_pagamento";
84
+ /** Ascending or descending order. */
85
+ ordenar_ordem?: "asc" | "desc";
86
+ /** CNPJ of the company that issued the invoices; several allowed, separated by comma. */
87
+ empresa_cnpj?: string;
88
+ /** Person type: F (individual), J (company), E (foreign individual), EJ (foreign company). */
89
+ tipo_pessoa?: "F" | "J" | "E" | "EJ";
90
+ /** Initial due date, `AAAA-MM-DD`; SGP requires it when `data_vencimento_fim` is sent. */
91
+ data_vencimento_inicio?: string;
92
+ /** Final due date, `AAAA-MM-DD`. */
93
+ data_vencimento_fim?: string;
94
+ /** Initial payment date, `AAAA-MM-DD`; SGP requires it when `data_pagamento_fim` is sent. */
95
+ data_pagamento_inicio?: string;
96
+ /** Final payment date, `AAAA-MM-DD`. */
97
+ data_pagamento_fim?: string;
98
+ /** Initial cancellation date, `AAAA-MM-DD`; alone, SGP matches invoices cancelled that day. */
99
+ data_cancelamento_inicio?: string;
100
+ /** Final cancellation date, `AAAA-MM-DD`; use with the initial one. */
101
+ data_cancelamento_fim?: string;
102
+ /** Initial date payment-agreement invoices were generated, `AAAA-MM-DD`; alone, matches that day. */
103
+ data_acordo_inicio?: string;
104
+ /** Final date payment-agreement invoices were generated, `AAAA-MM-DD`. */
105
+ data_acordo_fim?: string;
106
+ }
107
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
108
+ export declare const invoicesListInputSchema: z.ZodObject<{
109
+ offset: z.ZodOptional<z.ZodNumber>;
110
+ limit: z.ZodOptional<z.ZodNumber>;
111
+ titulo_id: z.ZodOptional<z.ZodNumber>;
112
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
113
+ cpfcnpj: z.ZodOptional<z.ZodString>;
114
+ contrato: z.ZodOptional<z.ZodNumber>;
115
+ status: z.ZodOptional<z.ZodEnum<{
116
+ abertos: "abertos";
117
+ cancelados: "cancelados";
118
+ pagos: "pagos";
119
+ }>>;
120
+ portador: z.ZodOptional<z.ZodNumber>;
121
+ ordenar: z.ZodOptional<z.ZodEnum<{
122
+ data_documento: "data_documento";
123
+ data_pagamento: "data_pagamento";
124
+ data_vencimento: "data_vencimento";
125
+ }>>;
126
+ ordenar_ordem: z.ZodOptional<z.ZodEnum<{
127
+ asc: "asc";
128
+ desc: "desc";
129
+ }>>;
130
+ empresa_cnpj: z.ZodOptional<z.ZodString>;
131
+ tipo_pessoa: z.ZodOptional<z.ZodEnum<{
132
+ E: "E";
133
+ EJ: "EJ";
134
+ F: "F";
135
+ J: "J";
136
+ }>>;
137
+ data_vencimento_inicio: z.ZodOptional<z.ZodString>;
138
+ data_vencimento_fim: z.ZodOptional<z.ZodString>;
139
+ data_pagamento_inicio: z.ZodOptional<z.ZodString>;
140
+ data_pagamento_fim: z.ZodOptional<z.ZodString>;
141
+ data_cancelamento_inicio: z.ZodOptional<z.ZodString>;
142
+ data_cancelamento_fim: z.ZodOptional<z.ZodString>;
143
+ data_acordo_inicio: z.ZodOptional<z.ZodString>;
144
+ data_acordo_fim: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strict>;
146
+ /** INTERNAL definition of `invoices.list`. */
147
+ export declare const invoicesList: OperationDefinition<InvoicesListData, "invoices.list">;
148
+ export {};
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const maintenancesSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ data_inicial: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
+ data_final: z.ZodNullable<z.ZodOptional<z.ZodString>>;
8
+ observacoes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
9
+ mensagem_central: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ mensagem_ura: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11
+ enviar_sms: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
12
+ ativa: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
13
+ severidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
14
+ status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
15
+ pops: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
16
+ nas: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
17
+ aps: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
18
+ sources: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
19
+ switches: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
20
+ olts: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
21
+ oltpons: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
22
+ ctos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
23
+ vlans: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
24
+ }, z.core.$loose>>;
25
+ /**
26
+ * The response of `GET /api/ura/manutencao/list/`, in SGP's own shape: a bare array with one entry
27
+ * per maintenance notice (SGP "manutenção"), INACTIVE ONES INCLUDED (the one capture held three
28
+ * past notices, all with `ativa: false`). The route takes no filter, is not paginated and has no
29
+ * envelope or total: filter by `ativa` and by the period (`data_inicial`, `data_final`) yourself.
30
+ * An empty array means no notice.
31
+ */
32
+ export type MaintenanceListData = z.output<typeof maintenancesSchema>;
33
+ /** INTERNAL definition of `maintenance.list`. */
34
+ export declare const maintenanceList: OperationDefinition<MaintenanceListData, "maintenance.list">;
35
+ export {};