sgp-sdk 2.0.0-beta.1 → 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 (33) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/COMPATIBILITY.md +161 -81
  3. package/MIGRATION.md +66 -5
  4. package/README.md +111 -69
  5. package/dist/client.d.ts +303 -26
  6. package/dist/constants.d.ts +13 -0
  7. package/dist/document.d.ts +11 -0
  8. package/dist/index.d.ts +13 -3
  9. package/dist/index.js +1510 -708
  10. package/dist/normalize.d.ts +9 -0
  11. package/dist/operation-sensitivity.d.ts +239 -6
  12. package/dist/operation.d.ts +7 -1
  13. package/dist/operations/contracts-check-connection.d.ts +56 -0
  14. package/dist/operations/contracts-list-services.d.ts +103 -0
  15. package/dist/operations/coverage-check-address.d.ts +46 -0
  16. package/dist/operations/coverage-check.d.ts +8 -7
  17. package/dist/operations/coverage-list-gateways.d.ts +16 -0
  18. package/dist/operations/crm-customers-create.d.ts +13 -3
  19. package/dist/operations/customers-list.d.ts +6 -0
  20. package/dist/operations/invoices-list.d.ts +11 -5
  21. package/dist/operations/maintenance-list.d.ts +35 -0
  22. package/dist/operations/occurrences-create.d.ts +10 -1
  23. package/dist/operations/occurrences-list.d.ts +127 -0
  24. package/dist/operations/pre-registrations-create.d.ts +29 -6
  25. package/dist/operations/pre-registrations-list-plans.d.ts +2 -2
  26. package/dist/operations/services-add-generic.d.ts +52 -0
  27. package/dist/operations/services-add-tv.d.ts +3 -3
  28. package/dist/operations/services-remove-generic.d.ts +28 -0
  29. package/dist/operations/services-remove-tv.d.ts +3 -3
  30. package/dist/operations/work-orders-get.d.ts +99 -0
  31. package/dist/operations/work-orders-list-comments.d.ts +34 -0
  32. package/dist/result.d.ts +5 -1
  33. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A field SGP sends as a JSON number or as numeric text: `data` carries a `number`. `""` and `null`
4
+ * mean "no value" and become `null`, never `0`. Formatted text (`"1.234,56"`) is never guessed: it
5
+ * fails and the tolerant reader drops the field with a warning (`expected: number`).
6
+ */
7
+ export declare const normalizedNumber: z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>;
8
+ /** An enum-like text SGP pads with spaces (`" Ativo "`): `data` carries it trimmed. */
9
+ export declare const trimmedText: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -166,6 +166,9 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
166
166
  }, "customers.search">, import("./operation.js").OperationDefinition<{
167
167
  [x: string]: unknown;
168
168
  message: string;
169
+ precadastro_id?: number | null | undefined;
170
+ new_cliente_id?: (number & import("zod").$brand<"CustomerId">) | null | undefined;
171
+ new_contrato_id?: number | null | undefined;
169
172
  }, "preRegistrations.create">, import("./operation.js").OperationDefinition<{
170
173
  [x: string]: unknown;
171
174
  resposta: {
@@ -196,6 +199,68 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
196
199
  data_cadastro?: string | null | undefined;
197
200
  motivo_status?: string | null | undefined;
198
201
  }[], "contracts.list">, import("./operation.js").OperationDefinition<{
202
+ [x: string]: unknown;
203
+ servico_id: number;
204
+ servico_tipo?: number | null | undefined;
205
+ servico_login?: string | null | undefined;
206
+ servico_password?: string | null | undefined;
207
+ servico_mac?: string | null | undefined;
208
+ servico_online?: boolean | null | undefined;
209
+ nas_ip?: string | null | undefined;
210
+ servicos?: unknown[] | null | undefined;
211
+ contrato_id?: number | null | undefined;
212
+ contrato_status?: string | null | undefined;
213
+ contrato_status_id?: number | null | undefined;
214
+ contrato_status_data?: string | null | undefined;
215
+ contrato_cadastro?: string | null | undefined;
216
+ contrato_pop_id?: number | null | undefined;
217
+ contrato_pop_nome?: string | null | undefined;
218
+ contrato_endereco_ll?: string | null | undefined;
219
+ cliente_id?: (number & import("zod").$brand<"CustomerId">) | null | undefined;
220
+ cliente_nome?: string | null | undefined;
221
+ cliente_email?: string | null | undefined;
222
+ cliente_contato?: string | null | undefined;
223
+ endereco_id?: number | null | undefined;
224
+ endereco_logradouro?: string | null | undefined;
225
+ endereco_numero?: string | number | null | undefined;
226
+ endereco_complemento?: string | null | undefined;
227
+ endereco_bairro?: string | null | undefined;
228
+ endereco_cidade?: string | null | undefined;
229
+ endereco_uf?: string | null | undefined;
230
+ endereco_pontoreferencia?: string | null | undefined;
231
+ endereco_ll?: string | null | undefined;
232
+ plano_id?: number | null | undefined;
233
+ plano?: string | null | undefined;
234
+ plano_download?: string | null | undefined;
235
+ plano_upload?: string | null | undefined;
236
+ os_servicoprestado?: string | null | undefined;
237
+ rad_username?: string | null | undefined;
238
+ rad_ip?: string | null | undefined;
239
+ rad_mac?: string | null | undefined;
240
+ rad_nasipaddress?: string | null | undefined;
241
+ rad_nasportid?: string | null | undefined;
242
+ rad_nasporttype?: string | null | undefined;
243
+ rad_calledstationid?: string | null | undefined;
244
+ rad_acctsessionid?: string | null | undefined;
245
+ rad_radacctid?: number | null | undefined;
246
+ rad_dataconexao?: string | null | undefined;
247
+ rad_tempo?: string | null | undefined;
248
+ rad_tempo_ordem?: number | null | undefined;
249
+ rad_acctinputoctets?: number | null | undefined;
250
+ rad_acctoutputoctets?: number | null | undefined;
251
+ rad_framedprotocol?: string | null | undefined;
252
+ rad_framedipv6prefix?: string | null | undefined;
253
+ rad_delegatedipv6prefix?: string | null | undefined;
254
+ }[], "contracts.listServices">, import("./operation.js").OperationDefinition<{
255
+ [x: string]: unknown;
256
+ status: number;
257
+ msg?: string | null | undefined;
258
+ servico_id?: number | null | undefined;
259
+ contratoId?: number | null | undefined;
260
+ login?: string | null | undefined;
261
+ razaoSocial?: string | null | undefined;
262
+ cpfCnpj?: string | null | undefined;
263
+ }[], "contracts.checkConnection">, import("./operation.js").OperationDefinition<{
199
264
  [x: string]: unknown;
200
265
  paginacao: {
201
266
  [x: string]: unknown;
@@ -336,14 +401,18 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
336
401
  }, "services.changePlan">, import("./operation.js").OperationDefinition<{
337
402
  [x: string]: unknown;
338
403
  msg: string;
339
- clientecontrato_id?: string | undefined;
404
+ clientecontrato_id?: number | null | undefined;
340
405
  servico_id: number;
341
406
  }, "services.addTv">, import("./operation.js").OperationDefinition<{
342
407
  [x: string]: unknown;
408
+ }, "services.addGeneric">, import("./operation.js").OperationDefinition<{
409
+ [x: string]: unknown;
343
410
  msg: string;
344
- clientecontrato_id?: string | undefined;
411
+ clientecontrato_id?: number | null | undefined;
345
412
  servico_id: number;
346
- }, "services.removeTv">, import("./operation.js").OperationDefinition<import("./operations/experimental-annotations-list.js").ExperimentalAnnotationsListData, "experimental.annotations.list">, import("./operation.js").OperationDefinition<{
413
+ }, "services.removeTv">, import("./operation.js").OperationDefinition<{
414
+ [x: string]: unknown;
415
+ }, "services.removeGeneric">, import("./operation.js").OperationDefinition<import("./operations/experimental-annotations-list.js").ExperimentalAnnotationsListData, "experimental.annotations.list">, import("./operation.js").OperationDefinition<{
347
416
  [x: string]: unknown;
348
417
  id: number;
349
418
  pop?: string | null | undefined;
@@ -399,8 +468,8 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
399
468
  observacao?: string | null | undefined;
400
469
  gateway?: {
401
470
  [x: string]: unknown;
402
- gateway_id?: string | number | null | undefined;
403
- id?: string | number | null | undefined;
471
+ gateway_id?: number | null | undefined;
472
+ id?: number | null | undefined;
404
473
  descricao?: string | null | undefined;
405
474
  } | null | undefined;
406
475
  }[], "preRegistrations.listPlans">, import("./operation.js").OperationDefinition<{
@@ -425,6 +494,11 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
425
494
  descricao?: string | null | undefined;
426
495
  usuario?: string | null | undefined;
427
496
  }[], "documents.list">, import("./operation.js").OperationDefinition<import("./operations/coverage-check.js").CoverageCheckData, "coverage.check">, import("./operation.js").OperationDefinition<{
497
+ [x: string]: unknown;
498
+ id: number;
499
+ descricao: string;
500
+ gateway?: string | null | undefined;
501
+ }[], "coverage.listGateways">, import("./operation.js").OperationDefinition<{
428
502
  [x: string]: unknown;
429
503
  cliente_id: number & import("zod").$brand<"CustomerId">;
430
504
  message?: string | null | undefined;
@@ -482,7 +556,166 @@ export declare const shippedOperations: readonly [import("./operation.js").Opera
482
556
  razaoSocial?: string | null | undefined;
483
557
  cpfCnpj?: string | null | undefined;
484
558
  msg?: string | null | undefined;
485
- }, "occurrences.create">, import("./operation.js").OperationDefinition<null, "documents.add">];
559
+ }, "occurrences.create">, import("./operation.js").OperationDefinition<null, "documents.add">, import("./operation.js").OperationDefinition<{
560
+ [x: string]: unknown;
561
+ paginacao: {
562
+ [x: string]: unknown;
563
+ offset?: number | null | undefined;
564
+ limit?: number | null | undefined;
565
+ parcial?: number | null | undefined;
566
+ total: number;
567
+ };
568
+ ocorrencias: {
569
+ [x: string]: unknown;
570
+ id: number;
571
+ cliente?: string | null | undefined;
572
+ contrato?: number | null | undefined;
573
+ contrato_status?: string | null | undefined;
574
+ contrato_status_id?: number | null | undefined;
575
+ pop?: string | null | undefined;
576
+ numero?: string | null | undefined;
577
+ status?: string | null | undefined;
578
+ status_id?: number | null | undefined;
579
+ data_cadastro?: string | null | undefined;
580
+ data_agendamento?: string | null | undefined;
581
+ data_finalizacao?: string | null | undefined;
582
+ tipo?: string | null | undefined;
583
+ metodo?: string | null | undefined;
584
+ conteudo?: string | null | undefined;
585
+ responsavel?: string | null | undefined;
586
+ usuario?: string | null | undefined;
587
+ usuario_finalizacao?: string | null | undefined;
588
+ protocolos_externos?: unknown[] | null | undefined;
589
+ servico?: unknown[] | null | undefined;
590
+ comentarios?: unknown[] | null | undefined;
591
+ ordens_servicos?: {
592
+ [x: string]: unknown;
593
+ id: number;
594
+ status?: string | null | undefined;
595
+ status_id?: number | null | undefined;
596
+ data_cadastro?: string | null | undefined;
597
+ data_agendamento?: string | null | undefined;
598
+ data_finalizacao?: string | null | undefined;
599
+ tipo?: string | null | undefined;
600
+ tipo_id?: number | null | undefined;
601
+ motivo?: string | null | undefined;
602
+ pop?: string | null | undefined;
603
+ conteudo?: string | null | undefined;
604
+ responsavel?: string | null | undefined;
605
+ tecnicos_auxiliares?: unknown[] | null | undefined;
606
+ usuario?: string | null | undefined;
607
+ usuario_finalizacao?: string | null | undefined;
608
+ }[] | null | undefined;
609
+ }[];
610
+ }, "occurrences.list">, import("./operation.js").OperationDefinition<{
611
+ [x: string]: unknown;
612
+ os_id: number;
613
+ os_protocolo?: string | null | undefined;
614
+ os_status?: number | null | undefined;
615
+ os_status_txt?: string | null | undefined;
616
+ os_prioridade?: number | null | undefined;
617
+ os_motivo_id?: number | null | undefined;
618
+ os_motivo_descricao?: string | null | undefined;
619
+ os_data_cadastro?: string | null | undefined;
620
+ os_data_agendamento?: string | null | undefined;
621
+ os_data_finalizacao?: string | null | undefined;
622
+ os_conteudo?: string | null | undefined;
623
+ os_observacao?: string | null | undefined;
624
+ os_anotacao?: string | null | undefined;
625
+ os_servicoprestado?: string | null | undefined;
626
+ os_setor_id?: number | null | undefined;
627
+ os_setor?: string | null | undefined;
628
+ os_tecnico_responsavel?: string | null | undefined;
629
+ os_tecnicos_auxiliares?: unknown[] | null | undefined;
630
+ os_agendamento_confirmado?: boolean | null | undefined;
631
+ os_agendamento_confirmacao_data?: string | null | undefined;
632
+ os_agendamento_confirmacao_status?: number | null | undefined;
633
+ os_agendamento_confirmacao_status_txt?: string | null | undefined;
634
+ os_close_edit?: boolean | null | undefined;
635
+ os_encerrada_impedir_estorno?: boolean | null | undefined;
636
+ os_encerrada_impedir_lancamento_avulso?: boolean | null | undefined;
637
+ os_finalizada_permite_add_imagem?: boolean | null | undefined;
638
+ os_lancamento_comodato?: boolean | null | undefined;
639
+ os_djson?: Record<string, unknown> | null | undefined;
640
+ comentarios?: unknown[] | null | undefined;
641
+ cliente_id?: (number & import("zod").$brand<"CustomerId">) | null | undefined;
642
+ cliente?: string | null | undefined;
643
+ cliente_email?: string | null | undefined;
644
+ cliente_contato?: string | null | undefined;
645
+ contrato_id?: number | null | undefined;
646
+ contrato_status?: string | null | undefined;
647
+ contrato_status_id?: number | null | undefined;
648
+ contrato_status_data?: string | null | undefined;
649
+ contrato_pop_id?: number | null | undefined;
650
+ contrato_pop?: string | null | undefined;
651
+ contrato_endereco_ll?: string | null | undefined;
652
+ endereco_id?: number | null | undefined;
653
+ endereco_logradouro?: string | null | undefined;
654
+ endereco_numero?: string | number | null | undefined;
655
+ endereco_complemento?: string | null | undefined;
656
+ endereco_bairro?: string | null | undefined;
657
+ endereco_cidade?: string | null | undefined;
658
+ endereco_uf?: string | null | undefined;
659
+ endereco_pontoreferencia?: string | null | undefined;
660
+ endereco_ll?: string | null | undefined;
661
+ plano_id?: number | null | undefined;
662
+ plano?: string | null | undefined;
663
+ plano_download?: string | null | undefined;
664
+ plano_upload?: string | null | undefined;
665
+ servico_id?: number | null | undefined;
666
+ servico_tipo?: number | null | undefined;
667
+ servico_login?: string | null | undefined;
668
+ servico_password?: string | null | undefined;
669
+ servico_online?: boolean | null | undefined;
670
+ servico_mac?: string | null | undefined;
671
+ servico_ip?: string | null | undefined;
672
+ servico_online_mac?: string | null | undefined;
673
+ servico_online_ip?: string | null | undefined;
674
+ servico_online_ipv6_pd?: unknown;
675
+ nas_ip?: string | null | undefined;
676
+ wifi_ssid?: string | null | undefined;
677
+ wifi_password?: string | null | undefined;
678
+ wifi_channel?: string | null | undefined;
679
+ wifi_ssid_5?: string | null | undefined;
680
+ wifi_password_5?: string | null | undefined;
681
+ wifi_channel_5?: string | null | undefined;
682
+ wan_user?: string | null | undefined;
683
+ wan_password?: string | null | undefined;
684
+ }, "workOrders.get">, import("./operation.js").OperationDefinition<{
685
+ [x: string]: unknown;
686
+ comentario_id?: number | null | undefined;
687
+ comentario?: string | null | undefined;
688
+ usuario?: string | null | undefined;
689
+ data_cadastro?: string | null | undefined;
690
+ checklist_id?: number | null | undefined;
691
+ checklist_descricao?: string | null | undefined;
692
+ usuario_setores?: unknown[] | null | undefined;
693
+ }[], "workOrders.listComments">, import("./operation.js").OperationDefinition<{
694
+ [x: string]: unknown;
695
+ id: number;
696
+ descricao?: string | null | undefined;
697
+ data_inicial?: string | null | undefined;
698
+ data_final?: string | null | undefined;
699
+ observacoes?: string | null | undefined;
700
+ mensagem_central?: string | null | undefined;
701
+ mensagem_ura?: string | null | undefined;
702
+ enviar_sms?: boolean | null | undefined;
703
+ ativa?: boolean | null | undefined;
704
+ severidade?: string | null | undefined;
705
+ status?: string | null | undefined;
706
+ pops?: unknown[] | null | undefined;
707
+ nas?: unknown[] | null | undefined;
708
+ aps?: unknown[] | null | undefined;
709
+ sources?: unknown[] | null | undefined;
710
+ switches?: unknown[] | null | undefined;
711
+ olts?: unknown[] | null | undefined;
712
+ oltpons?: unknown[] | null | undefined;
713
+ ctos?: unknown[] | null | undefined;
714
+ vlans?: unknown[] | null | undefined;
715
+ }[], "maintenance.list">, import("./operation.js").OperationDefinition<{
716
+ [x: string]: unknown;
717
+ viabilidade?: boolean | null | undefined;
718
+ }, "coverage.checkAddress">];
486
719
  /**
487
720
  * Name of every typed operation of the client, as in `SgpError.operation`. `request()` is not one:
488
721
  * its `error.operation` is `"request"`, and it declares no sensitivity (see `getSensitivity`).
@@ -119,10 +119,16 @@ export type RequestBuild = {
119
119
  } | {
120
120
  ok: false;
121
121
  problem: string;
122
+ /** Value-free issues (field path, then what was expected) that become `error.issues`. */
123
+ issues?: readonly string[];
122
124
  };
123
- /** A recognized refusal inside a 2xx response. */
125
+ /**
126
+ * A recognized refusal inside a 2xx response. `effect: "none"` only with a read-back that showed
127
+ * nothing was created; absent, the effect of a write stays `unknown`.
128
+ */
124
129
  export interface Refusal {
125
130
  reason?: string;
131
+ effect?: "none";
126
132
  }
127
133
  /**
128
134
  * Result of checking a 2xx body. `warnings` lists the non-essential fields the decoder had to drop
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const connectionsSchema: z.ZodArray<z.ZodObject<{
4
+ status: z.ZodNumber;
5
+ msg: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ servico_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
+ contratoId: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
8
+ login: z.ZodNullable<z.ZodOptional<z.ZodString>>;
9
+ razaoSocial: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ cpfCnpj: z.ZodNullable<z.ZodOptional<z.ZodString>>;
11
+ }, z.core.$loose>>;
12
+ /**
13
+ * The verdict of SGP on a contract's connection: ALWAYS an array, one item per internet service
14
+ * (`status`, `msg`, and the service, contract and holder it speaks of). SGP's answer varies: an
15
+ * array, `[]` when the contract is outside its default filter (observed on a suspended contract
16
+ * without `status_all`), or ONE bare object (observed on an active contract without `status_all`).
17
+ * The SDK wraps the bare object, so a consumer reads one shape; `response.body` keeps what SGP sent,
18
+ * and the paths of `warnings` and `issues` refer to the array form (`[0].login`). `[]` is not
19
+ * "offline": it means SGP gave no verdict (try `status_all: 1`).
20
+ */
21
+ export type ContractsCheckConnectionData = z.output<typeof connectionsSchema>;
22
+ /**
23
+ * Input of `contracts.checkConnection`, named as SGP names the fields. At least one of `contrato`
24
+ * and `telefone`. `protocolo_ura` is NOT offered: it explicitly asks SGP to open an occurrence (use
25
+ * `occurrences.create`).
26
+ */
27
+ export interface ContractsCheckConnectionInput {
28
+ /** Exercised. The contract to check. */
29
+ contrato?: number;
30
+ /** Documented, never sent. The phone of the customer, instead of the contract. */
31
+ telefone?: string;
32
+ /**
33
+ * Exercised. Also checks the contracts the default filter leaves out (suspended ones): without it a
34
+ * suspended contract answered `[]`. Sent as `1`.
35
+ */
36
+ status_all?: 1;
37
+ /** Documented, never sent. SGP's status filter; its accepted values are not documented. */
38
+ status_filter?: string;
39
+ /** Documented, never sent. SGP's URA contact; its meaning and format are not documented. */
40
+ uracontato?: string;
41
+ }
42
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
43
+ export declare const contractsCheckConnectionInputSchema: z.ZodObject<{
44
+ contrato: z.ZodOptional<z.ZodNumber>;
45
+ telefone: z.ZodOptional<z.ZodString>;
46
+ status_all: z.ZodOptional<z.ZodLiteral<1>>;
47
+ status_filter: z.ZodOptional<z.ZodString>;
48
+ uracontato: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strict>;
50
+ /**
51
+ * INTERNAL definition of `contracts.checkConnection`. A WRITE, though it looks like a read: the
52
+ * vendor documents that, under an active maintenance, SGP opens an occurrence by default, even
53
+ * without `protocolo_ura` (never tested). So it is never retried and its failures carry an effect.
54
+ */
55
+ export declare const contractsCheckConnection: OperationDefinition<ContractsCheckConnectionData, "contracts.checkConnection">;
56
+ export {};
@@ -0,0 +1,103 @@
1
+ import { z } from "zod";
2
+ import { type CustomerId } from "../ids.js";
3
+ import type { OperationDefinition } from "../operation.js";
4
+ declare const rowsSchema: z.ZodArray<z.ZodObject<{
5
+ servico_id: z.ZodPipe<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>, z.ZodNumber>;
6
+ servico_tipo: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
7
+ servico_login: z.ZodNullable<z.ZodOptional<z.ZodString>>;
8
+ servico_password: z.ZodNullable<z.ZodOptional<z.ZodString>>;
9
+ servico_mac: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ servico_online: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
11
+ nas_ip: z.ZodNullable<z.ZodOptional<z.ZodString>>;
12
+ servicos: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodUnknown>>>;
13
+ contrato_id: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
14
+ contrato_status: z.ZodNullable<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
15
+ contrato_status_id: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
16
+ contrato_status_data: z.ZodNullable<z.ZodOptional<z.ZodString>>;
17
+ contrato_cadastro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
18
+ contrato_pop_id: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
19
+ contrato_pop_nome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ contrato_endereco_ll: z.ZodNullable<z.ZodOptional<z.ZodString>>;
21
+ cliente_id: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>>;
22
+ cliente_nome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
23
+ cliente_email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
+ cliente_contato: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
+ endereco_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
26
+ endereco_logradouro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ endereco_numero: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
28
+ endereco_complemento: z.ZodNullable<z.ZodOptional<z.ZodString>>;
29
+ endereco_bairro: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
+ endereco_cidade: z.ZodNullable<z.ZodOptional<z.ZodString>>;
31
+ endereco_uf: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
+ endereco_pontoreferencia: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
+ endereco_ll: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ plano_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
35
+ plano: z.ZodNullable<z.ZodOptional<z.ZodString>>;
36
+ plano_download: z.ZodNullable<z.ZodOptional<z.ZodString>>;
37
+ plano_upload: z.ZodNullable<z.ZodOptional<z.ZodString>>;
38
+ os_servicoprestado: z.ZodNullable<z.ZodOptional<z.ZodString>>;
39
+ rad_username: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ rad_ip: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ rad_mac: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
+ rad_nasipaddress: z.ZodNullable<z.ZodOptional<z.ZodString>>;
43
+ rad_nasportid: z.ZodNullable<z.ZodOptional<z.ZodString>>;
44
+ rad_nasporttype: z.ZodNullable<z.ZodOptional<z.ZodString>>;
45
+ rad_calledstationid: z.ZodNullable<z.ZodOptional<z.ZodString>>;
46
+ rad_acctsessionid: z.ZodNullable<z.ZodOptional<z.ZodString>>;
47
+ rad_radacctid: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
48
+ rad_dataconexao: z.ZodNullable<z.ZodOptional<z.ZodString>>;
49
+ rad_tempo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
50
+ rad_tempo_ordem: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
51
+ rad_acctinputoctets: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
52
+ rad_acctoutputoctets: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
53
+ rad_framedprotocol: z.ZodNullable<z.ZodOptional<z.ZodString>>;
54
+ rad_framedipv6prefix: z.ZodNullable<z.ZodOptional<z.ZodString>>;
55
+ rad_delegatedipv6prefix: z.ZodNullable<z.ZodOptional<z.ZodString>>;
56
+ }, z.core.$loose>>;
57
+ /**
58
+ * The response of `POST /api/suporte/contrato/list/`, in SGP's own shape: a bare array with ONE ROW
59
+ * PER SERVICE (internet and TV) of the matching contracts, each repeating the customer, contract,
60
+ * address and plan. `[]` when nothing matches. A row of an ONLINE internet service also carries the
61
+ * RADIUS session (`rad_*`: user, IP, MAC, NAS, session ids, connection time, octet counters).
62
+ *
63
+ * Normalized: `servico_id`, `contrato_id`, `contrato_status_id`, `contrato_pop_id`,
64
+ * `rad_radacctid`, `rad_tempo_ordem`, `rad_acctinputoctets` and `rad_acctoutputoctets` are numbers
65
+ * (SGP sends the first four as text); `contrato_status` is trimmed (SGP pads it with spaces). The
66
+ * row's `servico_id` is an invariant: a row without a numeric one is `INVALID_RESPONSE`.
67
+ *
68
+ * It holds PLAINTEXT CREDENTIALS and network identifiers (`servico_password`, `servico_login`,
69
+ * MACs, IPs, NAS, session ids): see `getSensitivity("contracts.listServices")` and project with
70
+ * `pick` before logging or handing it on.
71
+ */
72
+ export type ContractsListServicesData = z.output<typeof rowsSchema>;
73
+ /**
74
+ * Filters of `contracts.listServices`, named as SGP names them (the vendor's collection documents
75
+ * all five). All optional, as the vendor marks none as required.
76
+ *
77
+ * At least one filter is required: without one SGP lists the services of EVERY customer, with
78
+ * plaintext service passwords, so the SDK refuses the call locally (`INVALID_INPUT`, `attempts` 0,
79
+ * nothing sent). There is no paging input. Filter by `contrato_id` whenever you can. Text filters are sent as given; SGP decides how it matches them.
80
+ */
81
+ export interface ContractsListServicesInput {
82
+ /** Exercised. Only the services of this contract (the `contrato_id` of a row, a number). */
83
+ contrato_id?: number;
84
+ /** Exercised. Only the services of the customer with this id (a `CustomerId`, never a contract id). */
85
+ cliente_id?: CustomerId;
86
+ /** Documented, never sent. Only the customer with this name. */
87
+ cliente_nome?: string;
88
+ /** Documented, never sent. Only the customer with this CPF/CNPJ. */
89
+ cliente_cpfcnpj?: string;
90
+ /** Documented, never sent. Only the service with this login. */
91
+ servico_login?: string;
92
+ }
93
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
94
+ export declare const contractsListServicesInputSchema: z.ZodObject<{
95
+ contrato_id: z.ZodOptional<z.ZodNumber>;
96
+ cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
97
+ cliente_nome: z.ZodOptional<z.ZodString>;
98
+ cliente_cpfcnpj: z.ZodOptional<z.ZodString>;
99
+ servico_login: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strict>;
101
+ /** INTERNAL definition of `contracts.listServices`. */
102
+ export declare const contractsListServices: OperationDefinition<ContractsListServicesData, "contracts.listServices">;
103
+ export {};
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ /**
4
+ * Input of `coverage.checkAddress`, named as SGP names the fields. The vendor's collection says
5
+ * "use one of the filters", so at least one is required, or the call is refused locally
6
+ * (`INVALID_INPUT`, nothing sent). How filters combine is SGP's decision: only `cep` alone and
7
+ * `cidade` alone were exercised.
8
+ */
9
+ export interface CoverageCheckAddressInput {
10
+ /** Exercised. Postal code, as SGP keeps it (digits only in the capture). */
11
+ cep?: string;
12
+ /** Exercised. City name, as SGP spells it (upper case in the capture). */
13
+ cidade?: string;
14
+ /** Documented, never sent. Street. */
15
+ logradouro?: string;
16
+ /** Documented, never sent. Neighborhood. */
17
+ bairro?: string;
18
+ /** Documented, never sent. Lowest street number to include (the vendor: "from a street number"). */
19
+ numero_inicial?: number | string;
20
+ /** Documented, never sent. Highest street number to include (the vendor: "up to a street number"). */
21
+ numero_final?: number | string;
22
+ }
23
+ /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
24
+ export declare const coverageCheckAddressInputSchema: z.ZodObject<{
25
+ cep: z.ZodOptional<z.ZodString>;
26
+ cidade: z.ZodOptional<z.ZodString>;
27
+ logradouro: z.ZodOptional<z.ZodString>;
28
+ bairro: z.ZodOptional<z.ZodString>;
29
+ numero_inicial: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
30
+ numero_final: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
31
+ }, z.core.$strict>;
32
+ declare const answerSchema: z.ZodObject<{
33
+ viabilidade: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
34
+ }, z.core.$loose>;
35
+ /**
36
+ * The response of `POST /api/ura/viabilidade/`, in SGP's own shape, kept as received. Observed:
37
+ * `{ "viabilidade": true }` (a postal code) and `{}` (a city alone).
38
+ *
39
+ * A MISSING `viabilidade` MEANS UNKNOWN, NEVER "NO COVERAGE": SGP answered `{}` for a city it
40
+ * could not decide on. Do not read `data.viabilidade ?? false`. The "no coverage" answer was NEVER
41
+ * OBSERVED: whether SGP sends `false` is not known, so a `false` is passed through as it comes.
42
+ */
43
+ export type CoverageCheckAddressData = z.output<typeof answerSchema>;
44
+ /** INTERNAL definition of `coverage.checkAddress`. */
45
+ export declare const coverageCheckAddress: OperationDefinition<CoverageCheckAddressData, "coverage.checkAddress">;
46
+ export {};
@@ -3,8 +3,8 @@ import type { OperationDefinition } from "../operation.js";
3
3
  /** Input of `coverage.check`, named as SGP names the fields. All three are required. */
4
4
  export interface CoverageCheckInput {
5
5
  /**
6
- * Exercised. ID of the map gateway SGP checks against. SGP lists them at
7
- * `/api/ura/listgatewaymapa`, which has no method here yet (use `request()`).
6
+ * Exercised. ID of the map gateway SGP checks against. Read the provider's own list with
7
+ * `coverage.listGateways`, never assume a value.
8
8
  */
9
9
  gateway: number;
10
10
  /** Exercised. Search radius in meters. */
@@ -22,10 +22,10 @@ export declare const coverageCheckInputSchema: z.ZodObject<{
22
22
  coordenada: z.ZodString;
23
23
  }, z.core.$strict>;
24
24
  declare const ctoSchema: z.ZodObject<{
25
- lat: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
26
- lng: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
27
- distancia: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
28
- id: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
25
+ lat: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
26
+ lng: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
27
+ distancia: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
28
+ id: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<number | null, unknown>>>;
29
29
  nome: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
30
  }, z.core.$loose>;
31
31
  /** One CTO (the nearest network box) within the radius, as the gateway reports it. */
@@ -34,7 +34,8 @@ export type CoverageCto = z.output<typeof ctoSchema>;
34
34
  * The response of `GET /api/ura/viabilidadeinstalacao`, in SGP's own shape: an array whose
35
35
  * element is an object keyed by the gateway's own name (`"SGPMaps"`, `"Geogrid"`: data-defined),
36
36
  * holding either the CTOs within the radius or a message (`"Localização inviável"`) when there
37
- * are none. Nothing is converted: Geogrid's numeric strings stay strings.
37
+ * are none. A CTO's `lat`, `lng`, `distancia` and `id` are numbers (`null` for `""`/`null`): Geogrid's
38
+ * numeric strings are converted, SGPMaps' numbers pass through (changed versus 2.0.0-beta.1).
38
39
  */
39
40
  export type CoverageCheckData = Array<Record<string, string | CoverageCto[]>>;
40
41
  /** INTERNAL definition of `coverage.check`. */
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import type { OperationDefinition } from "../operation.js";
3
+ declare const gatewaysSchema: z.ZodArray<z.ZodObject<{
4
+ id: z.ZodNumber;
5
+ descricao: z.ZodString;
6
+ gateway: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
+ }, z.core.$loose>>;
8
+ /**
9
+ * The response of `GET /api/ura/listgatewaymapa`, in SGP's own shape: a bare array with one entry
10
+ * per map gateway (SGP "Mapa FTTH"). The `id` is the `gateway` that `coverage.check` takes. The
11
+ * route is not paginated, so there is no envelope and no total.
12
+ */
13
+ export type CoverageListGatewaysData = z.output<typeof gatewaysSchema>;
14
+ /** INTERNAL definition of `coverage.listGateways`. */
15
+ export declare const coverageListGateways: OperationDefinition<CoverageListGatewaysData, "coverage.listGateways">;
16
+ export {};
@@ -16,7 +16,17 @@ interface CrmCustomerAddress extends SgpAddress {
16
16
  interface CrmCustomerCreateCommon {
17
17
  /** Exercised. Customer name; for a company, its corporate name. Required. SGP refuses digits in it (400). */
18
18
  nome: string;
19
- /** Exercised. CPF (`F`) or CNPJ (`J`), in the format SGP stores it. Required. */
19
+ /**
20
+ * Exercised. Required. A CPF on `personType: "F"`, a CNPJ on `"J"`. The SDK sends it in the
21
+ * canonical mask the base holds (the CRM already stores it that way). After removing `.`, `-`,
22
+ * `/` and spaces: exactly 11 digits go as `999.999.999-99` (`F`); exactly 14 alphanumerics, the
23
+ * last 2 digits, go as `AA.AAA.AAA/AAAA-99`, letters uppercased as the Receita writes them
24
+ * (`J`). An input already in the mask goes unchanged. Anything else is refused locally:
25
+ * `INVALID_INPUT`, `error.issues` is `["cpfcnpj: expected ..."]`, `attempts` 0, nothing sent,
26
+ * `effect` `"none"`. That covers a wrong length, other characters, letters in a CPF or in the
27
+ * last 2 positions of a CNPJ, and the wrong kind for the route (a CNPJ on `F`, a CPF on `J`).
28
+ * Format only: the check digits are not verified.
29
+ */
20
30
  cpfcnpj: string;
21
31
  /** Exercised. Required. Sent nested (`endereco`) and also as loose fields beside it, the two formats the route reads. */
22
32
  endereco: CrmCustomerAddress;
@@ -77,7 +87,7 @@ export type CrmCustomerCreateInput = CrmCustomerCreateIndividualInput | CrmCusto
77
87
  /** INTERNAL. Validation of the input, exported so a test can check it against the public types. */
78
88
  export declare const crmCustomersCreateInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
79
89
  nome: z.ZodString;
80
- cpfcnpj: z.ZodString;
90
+ cpfcnpj: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
81
91
  endereco: z.ZodObject<{
82
92
  numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
83
93
  complemento: z.ZodOptional<z.ZodString>;
@@ -115,7 +125,7 @@ export declare const crmCustomersCreateInputSchema: z.ZodDiscriminatedUnion<[z.Z
115
125
  naturalidade: z.ZodOptional<z.ZodString>;
116
126
  }, z.core.$strict>, z.ZodObject<{
117
127
  nome: z.ZodString;
118
- cpfcnpj: z.ZodString;
128
+ cpfcnpj: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
119
129
  endereco: z.ZodObject<{
120
130
  numero: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
121
131
  complemento: z.ZodOptional<z.ZodString>;
@@ -84,6 +84,11 @@ export interface CustomersListInput {
84
84
  cpfcnpj?: string;
85
85
  /** Customers whose name matches, as SGP matches it. */
86
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;
87
92
  }
88
93
  /** INTERNAL. Validation of the input, exported so a test can check its keys are classified. */
89
94
  export declare const customersListInputSchema: z.ZodObject<{
@@ -92,6 +97,7 @@ export declare const customersListInputSchema: z.ZodObject<{
92
97
  cliente_id: z.ZodOptional<z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">>;
93
98
  cpfcnpj: z.ZodOptional<z.ZodString>;
94
99
  cliente_nome: z.ZodOptional<z.ZodString>;
100
+ login: z.ZodOptional<z.ZodString>;
95
101
  }, z.core.$strict>;
96
102
  /** INTERNAL definition of `customers.list`. */
97
103
  export declare const customersList: OperationDefinition<CustomersListData, "customers.list">;