sgp-sdk 1.2.0 → 2.0.0-beta.1

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 (88) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/COMPATIBILITY.md +151 -0
  3. package/MIGRATION.md +283 -0
  4. package/README.md +422 -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 +661 -165
  10. package/dist/config.d.ts +115 -0
  11. package/dist/constants.d.ts +72 -0
  12. package/dist/effect.d.ts +22 -0
  13. package/dist/executor.d.ts +9 -0
  14. package/dist/exposure.d.ts +21 -0
  15. package/dist/guards.d.ts +2 -0
  16. package/dist/hooks.d.ts +16 -0
  17. package/dist/ids.d.ts +19 -0
  18. package/dist/index.d.ts +45 -49
  19. package/dist/index.js +2947 -1292
  20. package/dist/operation-sensitivity.d.ts +496 -0
  21. package/dist/operation.d.ts +139 -0
  22. package/dist/operations/catalogs-list-billing-profiles.d.ts +16 -0
  23. package/dist/operations/catalogs-list-nas.d.ts +25 -0
  24. package/dist/operations/catalogs-list-pops.d.ts +14 -0
  25. package/dist/operations/contracts-list-status-reasons.d.ts +15 -0
  26. package/dist/operations/contracts-list.d.ts +52 -0
  27. package/dist/operations/contracts-update-status.d.ts +41 -0
  28. package/dist/operations/contracts-update.d.ts +39 -0
  29. package/dist/operations/coverage-check.d.ts +42 -0
  30. package/dist/operations/crm-contracts-create-by-cpf-cnpj.d.ts +97 -0
  31. package/dist/operations/crm-contracts-create.d.ts +221 -0
  32. package/dist/operations/crm-contracts-list.d.ts +50 -0
  33. package/dist/operations/crm-customers-create.d.ts +155 -0
  34. package/dist/operations/crm-customers-update-status.d.ts +41 -0
  35. package/dist/operations/customers-list.d.ts +98 -0
  36. package/dist/{endpoints/ura/lookup-customer.d.ts → operations/customers-search.d.ts} +56 -46
  37. package/dist/operations/documents-add.d.ts +29 -0
  38. package/dist/operations/documents-list.d.ts +31 -0
  39. package/dist/operations/experimental-annotations-list.d.ts +67 -0
  40. package/dist/operations/invoices-list.d.ts +142 -0
  41. package/dist/operations/occurrences-create.d.ts +116 -0
  42. package/dist/operations/occurrences-list-methods.d.ts +14 -0
  43. package/dist/operations/occurrences-list-types.d.ts +20 -0
  44. package/dist/{endpoints/ura/list-plans.d.ts → operations/plans-list.d.ts} +33 -23
  45. package/dist/operations/pre-registrations-create.d.ts +253 -0
  46. package/dist/operations/pre-registrations-list-due-days.d.ts +15 -0
  47. package/dist/operations/pre-registrations-list-plans.d.ts +24 -0
  48. package/dist/operations/pre-registrations-list-sellers.d.ts +16 -0
  49. package/dist/operations/services-add-tv.d.ts +47 -0
  50. package/dist/operations/services-change-plan.d.ts +40 -0
  51. package/dist/operations/services-remove-tv.d.ts +29 -0
  52. package/dist/operations/work-orders-list-reasons.d.ts +20 -0
  53. package/dist/operations/work-orders-list.d.ts +81 -0
  54. package/dist/path.d.ts +13 -0
  55. package/dist/raw-request.d.ts +26 -0
  56. package/dist/request.d.ts +28 -0
  57. package/dist/result.d.ts +111 -43
  58. package/dist/retry.d.ts +34 -0
  59. package/dist/sensitivity.d.ts +89 -4
  60. package/dist/tolerant.d.ts +21 -0
  61. package/dist/validation.d.ts +3 -0
  62. package/package.json +6 -3
  63. package/dist/endpoint.d.ts +0 -66
  64. package/dist/endpoints/crm/address.d.ts +0 -20
  65. package/dist/endpoints/crm/create-contract.d.ts +0 -109
  66. package/dist/endpoints/crm/create-customer.d.ts +0 -65
  67. package/dist/endpoints/crm/update-customer-status.d.ts +0 -43
  68. package/dist/endpoints/os/list-occurrence-reasons.d.ts +0 -24
  69. package/dist/endpoints/os/list-occurrence-types.d.ts +0 -25
  70. package/dist/endpoints/precadastro/list-due-days.d.ts +0 -19
  71. package/dist/endpoints/precadastro/list-sellers.d.ts +0 -21
  72. package/dist/endpoints/suporte/add-customer-document.d.ts +0 -24
  73. package/dist/endpoints/suporte/list-customer-documents.d.ts +0 -25
  74. package/dist/endpoints/ura/check-coverage.d.ts +0 -46
  75. package/dist/endpoints/ura/list-annotations.d.ts +0 -32
  76. package/dist/endpoints/ura/list-clients.d.ts +0 -58
  77. package/dist/endpoints/ura/list-contracts.d.ts +0 -45
  78. package/dist/endpoints/ura/list-invoices.d.ts +0 -107
  79. package/dist/endpoints/ura/list-nas.d.ts +0 -29
  80. package/dist/endpoints/ura/list-occurrence-methods.d.ts +0 -19
  81. package/dist/endpoints/ura/list-payment-carriers.d.ts +0 -20
  82. package/dist/endpoints/ura/list-pops.d.ts +0 -19
  83. package/dist/endpoints/ura/list-service-orders.d.ts +0 -64
  84. package/dist/endpoints/ura/open-ticket.d.ts +0 -81
  85. package/dist/errors.d.ts +0 -59
  86. package/dist/schema/parse.d.ts +0 -19
  87. package/dist/schema/paths.d.ts +0 -38
  88. package/dist/transport.d.ts +0 -65
@@ -0,0 +1,155 @@
1
+ import { z } from "zod";
2
+ import { type SgpAddress } from "../address.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ /** The address of a CRM customer: the vendor requires these five keys. */
5
+ interface CrmCustomerAddress extends SgpAddress {
6
+ logradouro: string;
7
+ bairro: string;
8
+ cidade: string;
9
+ cep: string;
10
+ uf: string;
11
+ }
12
+ /**
13
+ * Fields common to both person types. All of them are personal data. Each field says "Exercised"
14
+ * when a live call sent it or "Documented" when only the vendor's documentation lists it.
15
+ */
16
+ interface CrmCustomerCreateCommon {
17
+ /** Exercised. Customer name; for a company, its corporate name. Required. SGP refuses digits in it (400). */
18
+ nome: string;
19
+ /** Exercised. CPF (`F`) or CNPJ (`J`), in the format SGP stores it. Required. */
20
+ cpfcnpj: string;
21
+ /** Exercised. Required. Sent nested (`endereco`) and also as loose fields beside it, the two formats the route reads. */
22
+ endereco: CrmCustomerAddress;
23
+ /** Documented. Contact e-mail. */
24
+ email?: string;
25
+ /** Documented. Contact phone. */
26
+ celular?: string;
27
+ /** Documented. Free-text note. */
28
+ observacao?: string;
29
+ }
30
+ /** `POST /api/crm/cliente/F`: a natural person. */
31
+ export interface CrmCustomerCreateIndividualInput extends CrmCustomerCreateCommon {
32
+ /** Selects the route `/F`; not sent as a field. */
33
+ personType: "F";
34
+ /** Documented. Birth date, `DD/MM/AAAA`. */
35
+ datanasc?: string;
36
+ /** Documented. Identity document number. */
37
+ rg?: string;
38
+ /** Documented. Issuer of the identity document. */
39
+ rg_emissor?: string;
40
+ /** Documented. `M` male, `F` female. */
41
+ sexo?: "M" | "F";
42
+ /** Documented. `C` married, `S` single, `V` widowed, `D` divorced. */
43
+ estadocivil?: "C" | "S" | "V" | "D";
44
+ /** Documented. Mother's name. */
45
+ nomemae?: string;
46
+ /** Documented. Father's name. */
47
+ nomepai?: string;
48
+ /** Documented. Occupation. */
49
+ profissao?: string;
50
+ /** Documented. Nationality. */
51
+ nacionalidade?: string;
52
+ /** Documented. Place of birth. */
53
+ naturalidade?: string;
54
+ }
55
+ /** `POST /api/crm/cliente/J`: a company. Documented only: never exercised against SGP. */
56
+ export interface CrmCustomerCreateCompanyInput extends CrmCustomerCreateCommon {
57
+ /** Selects the route `/J`; not sent as a field. */
58
+ personType: "J";
59
+ /** Documented. Trade name. */
60
+ nomefantasia?: string;
61
+ /** Documented. Name of the person responsible for the company. */
62
+ respempresa?: string;
63
+ /** Documented. CPF of the person responsible for the company. */
64
+ respcpf?: string;
65
+ /** Documented. State registration. */
66
+ insc_estadual?: string;
67
+ /** Documented. Municipal registration. */
68
+ insc_municipal?: string;
69
+ /** Documented. Foundation date, `DD/MM/AAAA`. */
70
+ datafundacao?: string;
71
+ }
72
+ /**
73
+ * Input of `crm.customers.create`. `personType` picks the route (`F` or `J`) and is not sent as a
74
+ * field; every other key is sent under its own name, absent ones omitted. Unknown keys are refused.
75
+ */
76
+ export type CrmCustomerCreateInput = CrmCustomerCreateIndividualInput | CrmCustomerCreateCompanyInput;
77
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public types. */
78
+ export declare const crmCustomersCreateInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
79
+ nome: z.ZodString;
80
+ cpfcnpj: z.ZodString;
81
+ endereco: z.ZodObject<{
82
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
83
+ complemento: z.ZodOptional<z.ZodString>;
84
+ pais: z.ZodOptional<z.ZodString>;
85
+ pontoreferencia: z.ZodOptional<z.ZodString>;
86
+ map_ll: z.ZodOptional<z.ZodString>;
87
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
88
+ logradouro: z.ZodString;
89
+ bairro: z.ZodString;
90
+ cidade: z.ZodString;
91
+ cep: z.ZodString;
92
+ uf: z.ZodString;
93
+ }, z.core.$strict>;
94
+ email: z.ZodOptional<z.ZodString>;
95
+ celular: z.ZodOptional<z.ZodString>;
96
+ observacao: z.ZodOptional<z.ZodString>;
97
+ personType: z.ZodLiteral<"F">;
98
+ datanasc: z.ZodOptional<z.ZodString>;
99
+ rg: z.ZodOptional<z.ZodString>;
100
+ rg_emissor: z.ZodOptional<z.ZodString>;
101
+ sexo: z.ZodOptional<z.ZodEnum<{
102
+ F: "F";
103
+ M: "M";
104
+ }>>;
105
+ estadocivil: z.ZodOptional<z.ZodEnum<{
106
+ C: "C";
107
+ D: "D";
108
+ S: "S";
109
+ V: "V";
110
+ }>>;
111
+ nomemae: z.ZodOptional<z.ZodString>;
112
+ nomepai: z.ZodOptional<z.ZodString>;
113
+ profissao: z.ZodOptional<z.ZodString>;
114
+ nacionalidade: z.ZodOptional<z.ZodString>;
115
+ naturalidade: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strict>, z.ZodObject<{
117
+ nome: z.ZodString;
118
+ cpfcnpj: z.ZodString;
119
+ endereco: z.ZodObject<{
120
+ numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
121
+ complemento: z.ZodOptional<z.ZodString>;
122
+ pais: z.ZodOptional<z.ZodString>;
123
+ pontoreferencia: z.ZodOptional<z.ZodString>;
124
+ map_ll: z.ZodOptional<z.ZodString>;
125
+ condominio: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
126
+ logradouro: z.ZodString;
127
+ bairro: z.ZodString;
128
+ cidade: z.ZodString;
129
+ cep: z.ZodString;
130
+ uf: z.ZodString;
131
+ }, z.core.$strict>;
132
+ email: z.ZodOptional<z.ZodString>;
133
+ celular: z.ZodOptional<z.ZodString>;
134
+ observacao: z.ZodOptional<z.ZodString>;
135
+ personType: z.ZodLiteral<"J">;
136
+ nomefantasia: z.ZodOptional<z.ZodString>;
137
+ respempresa: z.ZodOptional<z.ZodString>;
138
+ respcpf: z.ZodOptional<z.ZodString>;
139
+ insc_estadual: z.ZodOptional<z.ZodString>;
140
+ insc_municipal: z.ZodOptional<z.ZodString>;
141
+ datafundacao: z.ZodOptional<z.ZodString>;
142
+ }, z.core.$strict>], "personType">;
143
+ /**
144
+ * Success body of `POST /api/crm/cliente/{F|J}`: the new customer's `cliente_id` and SGP's
145
+ * `message`, which echoes the customer's name and document. Other keys SGP may add are kept.
146
+ */
147
+ declare const createdSchema: z.ZodObject<{
148
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
149
+ message: z.ZodNullable<z.ZodOptional<z.ZodString>>;
150
+ }, z.core.$loose>;
151
+ /** Response of `crm.customers.create`. */
152
+ export type CrmCustomerCreateData = z.output<typeof createdSchema>;
153
+ /** INTERNAL definition of `crm.customers.create`. */
154
+ export declare const crmCustomersCreate: OperationDefinition<CrmCustomerCreateData, "crm.customers.create">;
155
+ export {};
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ /**
5
+ * Input of `crm.customers.updateStatus`, named as SGP names the fields. The status code is sent as
6
+ * given: SGP decides what it takes and which transitions it allows.
7
+ */
8
+ export interface CrmCustomerUpdateStatusInput {
9
+ /** ID of the CRM customer: the `cliente_id` of `crm.customers.create`. Goes in the path. */
10
+ cliente_id: CustomerId;
11
+ /**
12
+ * Exercised with 6. Status code to move to (`CRM_STATUS`: 6 is "Contrato realizado no SGP"); any
13
+ * number is sent.
14
+ */
15
+ status_id: number;
16
+ /** Documented, never sent. Free-text reason of the change. Personal data when it names the customer. */
17
+ motivo?: string;
18
+ }
19
+ /** INTERNAL. Validation of the input, exported so a test can check it against the public type. */
20
+ export declare const crmCustomersUpdateStatusInputSchema: z.ZodObject<{
21
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
22
+ status_id: z.ZodNumber;
23
+ motivo: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>;
25
+ /**
26
+ * Success body of `POST /api/crm/cliente/{cliente_id}/status/`: the customer, SGP's `message`
27
+ * (which echoes the customer's name) and the status now set. Other keys SGP may add are kept.
28
+ */
29
+ declare const statusUpdatedSchema: z.ZodObject<{
30
+ cliente_id: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
31
+ message: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ novo_status: z.ZodObject<{
33
+ codigo: z.ZodNumber;
34
+ descricao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
+ }, z.core.$loose>;
36
+ }, z.core.$loose>;
37
+ /** Response of `crm.customers.updateStatus`. */
38
+ export type CrmCustomerUpdateStatusData = z.output<typeof statusUpdatedSchema>;
39
+ /** INTERNAL definition of `crm.customers.updateStatus`. */
40
+ export declare const crmCustomersUpdateStatus: OperationDefinition<CrmCustomerUpdateStatusData, "crm.customers.updateStatus">;
41
+ export {};
@@ -0,0 +1,98 @@
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
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
89
+ export declare const customersListInputSchema: z.ZodObject<{
90
+ offset: z.ZodOptional<z.ZodNumber>;
91
+ limit: z.ZodOptional<z.ZodNumber>;
92
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
93
+ cpfcnpj: z.ZodOptional<z.ZodString>;
94
+ cliente_nome: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strict>;
96
+ /** INTERNAL definition of `customers.list`. */
97
+ export declare const customersList: OperationDefinition<CustomersListData, "customers.list">;
98
+ 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 {};