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.
- package/CHANGELOG.md +87 -0
- package/COMPATIBILITY.md +151 -0
- package/MIGRATION.md +283 -0
- package/README.md +422 -265
- package/dist/address.d.ts +46 -0
- package/dist/annotation-selection.d.ts +32 -0
- package/dist/budget.d.ts +29 -0
- package/dist/classify.d.ts +15 -0
- package/dist/client.d.ts +661 -165
- package/dist/config.d.ts +115 -0
- package/dist/constants.d.ts +72 -0
- package/dist/effect.d.ts +22 -0
- package/dist/executor.d.ts +9 -0
- package/dist/exposure.d.ts +21 -0
- package/dist/guards.d.ts +2 -0
- package/dist/hooks.d.ts +16 -0
- package/dist/ids.d.ts +19 -0
- package/dist/index.d.ts +45 -49
- package/dist/index.js +2947 -1292
- package/dist/operation-sensitivity.d.ts +496 -0
- package/dist/operation.d.ts +139 -0
- package/dist/operations/catalogs-list-billing-profiles.d.ts +16 -0
- package/dist/operations/catalogs-list-nas.d.ts +25 -0
- package/dist/operations/catalogs-list-pops.d.ts +14 -0
- package/dist/operations/contracts-list-status-reasons.d.ts +15 -0
- package/dist/operations/contracts-list.d.ts +52 -0
- package/dist/operations/contracts-update-status.d.ts +41 -0
- package/dist/operations/contracts-update.d.ts +39 -0
- package/dist/operations/coverage-check.d.ts +42 -0
- package/dist/operations/crm-contracts-create-by-cpf-cnpj.d.ts +97 -0
- package/dist/operations/crm-contracts-create.d.ts +221 -0
- package/dist/operations/crm-contracts-list.d.ts +50 -0
- package/dist/operations/crm-customers-create.d.ts +155 -0
- package/dist/operations/crm-customers-update-status.d.ts +41 -0
- package/dist/operations/customers-list.d.ts +98 -0
- package/dist/{endpoints/ura/lookup-customer.d.ts → operations/customers-search.d.ts} +56 -46
- package/dist/operations/documents-add.d.ts +29 -0
- package/dist/operations/documents-list.d.ts +31 -0
- package/dist/operations/experimental-annotations-list.d.ts +67 -0
- package/dist/operations/invoices-list.d.ts +142 -0
- package/dist/operations/occurrences-create.d.ts +116 -0
- package/dist/operations/occurrences-list-methods.d.ts +14 -0
- package/dist/operations/occurrences-list-types.d.ts +20 -0
- package/dist/{endpoints/ura/list-plans.d.ts → operations/plans-list.d.ts} +33 -23
- package/dist/operations/pre-registrations-create.d.ts +253 -0
- package/dist/operations/pre-registrations-list-due-days.d.ts +15 -0
- package/dist/operations/pre-registrations-list-plans.d.ts +24 -0
- package/dist/operations/pre-registrations-list-sellers.d.ts +16 -0
- package/dist/operations/services-add-tv.d.ts +47 -0
- package/dist/operations/services-change-plan.d.ts +40 -0
- package/dist/operations/services-remove-tv.d.ts +29 -0
- package/dist/operations/work-orders-list-reasons.d.ts +20 -0
- package/dist/operations/work-orders-list.d.ts +81 -0
- package/dist/path.d.ts +13 -0
- package/dist/raw-request.d.ts +26 -0
- package/dist/request.d.ts +28 -0
- package/dist/result.d.ts +111 -43
- package/dist/retry.d.ts +34 -0
- package/dist/sensitivity.d.ts +89 -4
- package/dist/tolerant.d.ts +21 -0
- package/dist/validation.d.ts +3 -0
- package/package.json +6 -3
- package/dist/endpoint.d.ts +0 -66
- package/dist/endpoints/crm/address.d.ts +0 -20
- package/dist/endpoints/crm/create-contract.d.ts +0 -109
- package/dist/endpoints/crm/create-customer.d.ts +0 -65
- package/dist/endpoints/crm/update-customer-status.d.ts +0 -43
- package/dist/endpoints/os/list-occurrence-reasons.d.ts +0 -24
- package/dist/endpoints/os/list-occurrence-types.d.ts +0 -25
- package/dist/endpoints/precadastro/list-due-days.d.ts +0 -19
- package/dist/endpoints/precadastro/list-sellers.d.ts +0 -21
- package/dist/endpoints/suporte/add-customer-document.d.ts +0 -24
- package/dist/endpoints/suporte/list-customer-documents.d.ts +0 -25
- package/dist/endpoints/ura/check-coverage.d.ts +0 -46
- package/dist/endpoints/ura/list-annotations.d.ts +0 -32
- package/dist/endpoints/ura/list-clients.d.ts +0 -58
- package/dist/endpoints/ura/list-contracts.d.ts +0 -45
- package/dist/endpoints/ura/list-invoices.d.ts +0 -107
- package/dist/endpoints/ura/list-nas.d.ts +0 -29
- package/dist/endpoints/ura/list-occurrence-methods.d.ts +0 -19
- package/dist/endpoints/ura/list-payment-carriers.d.ts +0 -20
- package/dist/endpoints/ura/list-pops.d.ts +0 -19
- package/dist/endpoints/ura/list-service-orders.d.ts +0 -64
- package/dist/endpoints/ura/open-ticket.d.ts +0 -81
- package/dist/errors.d.ts +0 -59
- package/dist/schema/parse.d.ts +0 -19
- package/dist/schema/paths.d.ts +0 -38
- package/dist/transport.d.ts +0 -65
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { SgpErrorCode } from "./result.js";
|
|
2
|
+
import { type Runtime } from "./retry.js";
|
|
3
|
+
/** Default time budget of one call in milliseconds. */
|
|
4
|
+
export declare const DEFAULT_TIMEOUT_MS = 20000;
|
|
5
|
+
/** Largest time budget in milliseconds: the limit of the timers the runtime offers. */
|
|
6
|
+
export declare const MAX_TIMEOUT_MS = 2147483647;
|
|
7
|
+
/** Authentication of the client. Other kinds can be added without changing the constructor. */
|
|
8
|
+
export interface TokenCredentials {
|
|
9
|
+
/** Discriminant of the credentials. */
|
|
10
|
+
kind: "token";
|
|
11
|
+
/** SGP API token. Sent with every request, never returned in a result or hook. */
|
|
12
|
+
token: string;
|
|
13
|
+
/** SGP app name that owns the token. */
|
|
14
|
+
app: string;
|
|
15
|
+
}
|
|
16
|
+
/** How the client authenticates. Today only `{ kind: "token", token, app }`. */
|
|
17
|
+
export type Credentials = TokenCredentials;
|
|
18
|
+
/** Metadata shared by every hook call. Never carries credentials, URLs or bodies. */
|
|
19
|
+
export interface HookMetadata {
|
|
20
|
+
/** Identifies the logical call across its attempts. */
|
|
21
|
+
callId: string;
|
|
22
|
+
/** Attempt number, 1-based. */
|
|
23
|
+
attempt: number;
|
|
24
|
+
/** Name of the operation being run, e.g. `customers.list`; `request` for a raw call. */
|
|
25
|
+
operation: string;
|
|
26
|
+
/** HTTP method of the attempt. */
|
|
27
|
+
method: string;
|
|
28
|
+
/** Path template (`/api/x/{id}/`); omitted when unknown. */
|
|
29
|
+
pathTemplate?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Metadata given to `onResponse`: the call metadata plus the status that arrived. */
|
|
32
|
+
export interface ResponseHookMetadata extends HookMetadata {
|
|
33
|
+
/** HTTP status of the response whose headers just arrived. */
|
|
34
|
+
status: number;
|
|
35
|
+
/** Milliseconds from the start of the attempt until the headers arrived. */
|
|
36
|
+
durationMs: number;
|
|
37
|
+
}
|
|
38
|
+
/** Metadata given to `onError`: the call metadata plus the code of the failed attempt. */
|
|
39
|
+
export interface ErrorHookMetadata extends HookMetadata {
|
|
40
|
+
/** Stable code the failed attempt ends with. */
|
|
41
|
+
code: SgpErrorCode;
|
|
42
|
+
/** HTTP status when a response was received. */
|
|
43
|
+
status?: number;
|
|
44
|
+
/** Milliseconds from the start of the attempt until it failed. */
|
|
45
|
+
durationMs: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Optional observers. Synchronous and for observability only: a hook that throws never changes the
|
|
49
|
+
* result, it only adds a record to `diagnostics`.
|
|
50
|
+
*/
|
|
51
|
+
export interface Hooks {
|
|
52
|
+
/** Runs just before each request is sent. */
|
|
53
|
+
onRequest?: (metadata: HookMetadata) => void;
|
|
54
|
+
/** Runs per attempt when the response headers arrive, whatever the status. */
|
|
55
|
+
onResponse?: (metadata: ResponseHookMetadata) => void;
|
|
56
|
+
/** Runs per failed attempt, after `onResponse` when a response arrived. */
|
|
57
|
+
onError?: (metadata: ErrorHookMetadata) => void;
|
|
58
|
+
}
|
|
59
|
+
/** Custom `fetch`, mainly for tests. */
|
|
60
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
61
|
+
/** Options of `createSgpClient`. The configuration is validated once and then immutable. */
|
|
62
|
+
export interface ClientOptions {
|
|
63
|
+
/** Origin of the SGP instance, `http(s)://host[:port]`, no path, query or credentials. */
|
|
64
|
+
baseUrl: string;
|
|
65
|
+
/** Token and app sent with every request. */
|
|
66
|
+
credentials: Credentials;
|
|
67
|
+
/** Default time budget of a call in milliseconds. Defaults to {@link DEFAULT_TIMEOUT_MS}. */
|
|
68
|
+
timeoutMs?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Default number of additional attempts after a transient failure of a repeatable read, a
|
|
71
|
+
* non-negative integer. Defaults to 0 (no retry). Writes are never retried.
|
|
72
|
+
*/
|
|
73
|
+
maxRetries?: number;
|
|
74
|
+
/** Optional observers, metadata only. */
|
|
75
|
+
hooks?: Hooks;
|
|
76
|
+
/** Defaults to the global `fetch`. */
|
|
77
|
+
fetch?: FetchLike;
|
|
78
|
+
}
|
|
79
|
+
/** Per-call options of every method. */
|
|
80
|
+
export interface CallOptions {
|
|
81
|
+
/** Cancels the call; the result is `ABORTED`. */
|
|
82
|
+
abortSignal?: AbortSignal;
|
|
83
|
+
/** Time budget of the whole call in milliseconds; overrides the client default. */
|
|
84
|
+
timeoutMs?: number;
|
|
85
|
+
/** Additional attempts for this call; overrides the client default. Ignored by writes. */
|
|
86
|
+
maxRetries?: number;
|
|
87
|
+
}
|
|
88
|
+
/** Thrown by `createSgpClient` for an invalid configuration. Never thrown by a method call. */
|
|
89
|
+
export declare class InvalidConfigurationError extends Error {
|
|
90
|
+
readonly name = "InvalidConfigurationError";
|
|
91
|
+
}
|
|
92
|
+
/** Validated, immutable configuration used by the executor. */
|
|
93
|
+
export interface ResolvedConfig {
|
|
94
|
+
readonly origin: string;
|
|
95
|
+
readonly credentials: Readonly<Credentials>;
|
|
96
|
+
readonly timeoutMs: number;
|
|
97
|
+
readonly maxRetries: number;
|
|
98
|
+
readonly runtime: Runtime;
|
|
99
|
+
readonly hooks: Readonly<Hooks>;
|
|
100
|
+
readonly fetch: FetchLike;
|
|
101
|
+
}
|
|
102
|
+
/** Whether `value` is a usable time budget in milliseconds, within what the runtime timers allow. */
|
|
103
|
+
export declare const isValidTimeoutMs: (value: unknown) => value is number;
|
|
104
|
+
/**
|
|
105
|
+
* Whether `value` behaves like an `AbortSignal`. Duck-typed on purpose: a signal made in another
|
|
106
|
+
* realm (a worker, a vm context, a polyfill) fails `instanceof` but is still a valid signal.
|
|
107
|
+
*/
|
|
108
|
+
export declare const isAbortSignalLike: (value: unknown) => value is AbortSignal;
|
|
109
|
+
/** Whether `value` is a usable count of additional attempts: a non-negative safe integer. */
|
|
110
|
+
export declare const isValidMaxRetries: (value: unknown) => value is number;
|
|
111
|
+
/**
|
|
112
|
+
* Validates the options and returns an immutable snapshot. Throws {@link InvalidConfigurationError}
|
|
113
|
+
* naming the first problem, never a secret value. `runtime` is internal, for tests.
|
|
114
|
+
*/
|
|
115
|
+
export declare const resolveConfig: (options: ClientOptions, runtime?: Runtime) => ResolvedConfig;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SGP's equipment acquisition modes, by the `modoaquisicao` it takes: 0 Próprio, 1 Comodato. One
|
|
3
|
+
* constant for every operation that takes the field (CRM contracts and pré-cadastro). Value 2 was
|
|
4
|
+
* observed rejected on the CRM route (31/10), although the vendor's CRM documentation lists 1 and
|
|
5
|
+
* 2; no other value is known to be valid.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ACQUISITION_MODE: {
|
|
8
|
+
readonly owned: 0;
|
|
9
|
+
readonly loan: 1;
|
|
10
|
+
};
|
|
11
|
+
/** A valid `modoaquisicao`. */
|
|
12
|
+
export type AcquisitionMode = (typeof ACQUISITION_MODE)[keyof typeof ACQUISITION_MODE];
|
|
13
|
+
/**
|
|
14
|
+
* SGP's billing methods (formas de cobrança): fixed global codes, the same on every instance. Code 5
|
|
15
|
+
* is not listed: it is documented for one route only and was never confirmed.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BILLING_METHOD: {
|
|
18
|
+
readonly boleto: 1;
|
|
19
|
+
readonly automaticDebit: 2;
|
|
20
|
+
readonly booklet: 3;
|
|
21
|
+
readonly recurringCharge: 4;
|
|
22
|
+
readonly pix: 6;
|
|
23
|
+
};
|
|
24
|
+
/** A known billing-method code. Operations accept any number: SGP decides what it takes. */
|
|
25
|
+
export type BillingMethod = (typeof BILLING_METHOD)[keyof typeof BILLING_METHOD];
|
|
26
|
+
/**
|
|
27
|
+
* SGP's contract status codes (the `status` that `contracts.updateStatus` sends): fixed global
|
|
28
|
+
* codes, the same on every instance. 1 (ativo) and 4 (suspenso) were confirmed by a 200 and a
|
|
29
|
+
* read-back; 2 (inativo) was sent and refused from Ativo; the others were never sent: 3, 5 and 7
|
|
30
|
+
* come from SGP's panel, and 6 (novo) is documented by the vendor (status edit route); its meaning
|
|
31
|
+
* and transitions were never observed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CONTRACT_STATUS: {
|
|
34
|
+
readonly active: 1;
|
|
35
|
+
readonly inactive: 2;
|
|
36
|
+
readonly canceled: 3;
|
|
37
|
+
readonly suspended: 4;
|
|
38
|
+
readonly technicalInfeasibility: 5;
|
|
39
|
+
readonly new: 6;
|
|
40
|
+
readonly activeReducedSpeed: 7;
|
|
41
|
+
};
|
|
42
|
+
/** A known contract-status code. Operations accept any number: SGP decides what it takes. */
|
|
43
|
+
export type ContractStatus = (typeof CONTRACT_STATUS)[keyof typeof CONTRACT_STATUS];
|
|
44
|
+
/**
|
|
45
|
+
* SGP's service types, the `servico_tipo` that `services.changePlan` sends. Only internet (1) was
|
|
46
|
+
* exercised against SGP: the vendor documents other types but no value beyond 1 was ever sent, so
|
|
47
|
+
* the operation accepts any positive integer and SGP decides what it takes.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SERVICE_TYPE: {
|
|
50
|
+
readonly internet: 1;
|
|
51
|
+
};
|
|
52
|
+
/** A service-type code that was exercised against SGP. Operations accept any positive integer. */
|
|
53
|
+
export type ServiceType = (typeof SERVICE_TYPE)[keyof typeof SERVICE_TYPE];
|
|
54
|
+
/**
|
|
55
|
+
* SGP's CRM customer statuses (the `status_id` that `crm.customers.updateStatus` sends): fixed codes
|
|
56
|
+
* of the vendor's CRM documentation. Only 6 (a customer whose contract was made in SGP) was sent
|
|
57
|
+
* live and answered with a 200; the others come from the 1.x constant and were never observed here.
|
|
58
|
+
*/
|
|
59
|
+
export declare const CRM_STATUS: {
|
|
60
|
+
readonly underAnalysis: 1;
|
|
61
|
+
readonly approved: 2;
|
|
62
|
+
readonly rejected: 3;
|
|
63
|
+
readonly awaitingContact: 4;
|
|
64
|
+
readonly tryingContact: 5;
|
|
65
|
+
readonly contractMadeInSgp: 6;
|
|
66
|
+
readonly technicalInfeasibility: 7;
|
|
67
|
+
readonly contractInProspecting: 8;
|
|
68
|
+
readonly rejectedCreditBureau: 9;
|
|
69
|
+
readonly technicalFeasibilityAnalysis: 10;
|
|
70
|
+
};
|
|
71
|
+
/** A known CRM status code. Operations accept any number: SGP decides what it takes. */
|
|
72
|
+
export type CrmStatus = (typeof CRM_STATUS)[keyof typeof CRM_STATUS];
|
package/dist/effect.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { KnownRejection, WriteSpec } from "./operation.js";
|
|
2
|
+
import type { Effect, ResponseBody } from "./result.js";
|
|
3
|
+
/**
|
|
4
|
+
* A known rejection whose body is SGP's `error` string and nothing of the generic wrapper: JSON
|
|
5
|
+
* object, no `errors` key, `error` a string whose trimmed text matches `text`. A body that also
|
|
6
|
+
* carries the `errors` wrapper proves nothing and falls to the generic rule.
|
|
7
|
+
*/
|
|
8
|
+
export declare const errorStringRejection: (status: number, text: RegExp, reason: string) => KnownRejection;
|
|
9
|
+
/**
|
|
10
|
+
* A known rejection whose body is SGP's `errors` array with exactly one message and no other key,
|
|
11
|
+
* the message matching `text` once trimmed. Any other `errors` array is the generic wrapper, proves
|
|
12
|
+
* nothing and stays `unknown`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const singleErrorsEntryRejection: (status: number, text: RegExp, reason: string) => KnownRejection;
|
|
15
|
+
/** The known rejection of `write` that this response is, if any. Only 4xx statuses can match. */
|
|
16
|
+
export declare const findKnownRejection: (write: WriteSpec, status: number, body: ResponseBody) => KnownRejection | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Effect of a write that got a non-2xx response. `none` only with evidence that nothing was
|
|
19
|
+
* applied: a known rejection of the operation, or a 4xx with a field/business error shape. Every
|
|
20
|
+
* other case (3xx, 5xx, generic wrapper, unreadable or unrecognized 4xx body) is `unknown`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const effectOfHttpFailure: (status: number, body: ResponseBody, known: KnownRejection | undefined) => Effect;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CallOptions, type ResolvedConfig } from "./config.js";
|
|
2
|
+
import type { OperationDefinition } from "./operation.js";
|
|
3
|
+
import type { SgpResult } from "./result.js";
|
|
4
|
+
/**
|
|
5
|
+
* The one executor: applies the operation contract to any {@link OperationDefinition}. Expected outcomes (invalid
|
|
6
|
+
* input, transport failures, SGP rejections, incompatible responses) come back in the result; only
|
|
7
|
+
* an internal bug throws.
|
|
8
|
+
*/
|
|
9
|
+
export declare const execute: <Data>(config: ResolvedConfig, definition: OperationDefinition<Data>, input: unknown, options?: CallOptions) => Promise<SgpResult<Data>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ResponseBody, SgpErrorFields } from "./result.js";
|
|
2
|
+
/**
|
|
3
|
+
* INTERNAL. What an operation lets leave the executor of a response it received, for an operation
|
|
4
|
+
* whose SGP answer mixes records outside the requested scope (today `experimental.annotations.list`).
|
|
5
|
+
* Declarative data on the definition: the executor applies it to every response, before it builds
|
|
6
|
+
* any public object, so no result, hook, warning or error ever holds what it withholds.
|
|
7
|
+
*/
|
|
8
|
+
export interface Exposure {
|
|
9
|
+
/** `withhold`: a body with content (`json` or `text`) is replaced by `{ kind: "withheld" }`. */
|
|
10
|
+
body: "withhold";
|
|
11
|
+
/** `strings-only`: `error.sgp` keeps only SGP's own message strings. */
|
|
12
|
+
sgp: "strings-only";
|
|
13
|
+
}
|
|
14
|
+
/** The body as the public response may hold it. `empty` and `unavailable` hold no content. */
|
|
15
|
+
export declare const exposedBody: (body: ResponseBody, exposure: Exposure | undefined) => ResponseBody;
|
|
16
|
+
/**
|
|
17
|
+
* SGP's own error fields without anything that could be a record of someone else: `detail`, `msg`
|
|
18
|
+
* and `error` only as strings, `errors` only as an array of strings or an object of string values.
|
|
19
|
+
* A field with any other element (a foreign note is an object) is dropped whole.
|
|
20
|
+
*/
|
|
21
|
+
export declare const exposedSgp: (sgp: SgpErrorFields | undefined, exposure: Exposure | undefined) => SgpErrorFields | undefined;
|
package/dist/guards.d.ts
ADDED
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ErrorHookMetadata, HookMetadata, Hooks, ResponseHookMetadata } from "./config.js";
|
|
2
|
+
import type { Diagnostic } from "./result.js";
|
|
3
|
+
/**
|
|
4
|
+
* Runs the consumer's hooks for one logical call. A hook that throws is isolated: the thrown value
|
|
5
|
+
* is discarded (it can carry anything) and only the hook name and attempt are recorded. A failing
|
|
6
|
+
* `onError` never triggers `onError` again.
|
|
7
|
+
*/
|
|
8
|
+
interface HookRunner {
|
|
9
|
+
onRequest: (metadata: HookMetadata) => void;
|
|
10
|
+
onResponse: (metadata: ResponseHookMetadata) => void;
|
|
11
|
+
onError: (metadata: ErrorHookMetadata) => void;
|
|
12
|
+
/** Failures recorded so far; empty when every hook behaved. */
|
|
13
|
+
diagnostics: () => Diagnostic[];
|
|
14
|
+
}
|
|
15
|
+
export declare const createHookRunner: (hooks: Readonly<Hooks>) => HookRunner;
|
|
16
|
+
export {};
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Identifier of a customer (SGP "cliente"). A CRM customer is a row of the same table as every
|
|
4
|
+
* customer: the id `crm.customers.create` returns is the one `customers.list` shows (it appeared
|
|
5
|
+
* in `customers.list` right after its creation). It is the `clientes[].id` of `customers.list`, the
|
|
6
|
+
* `clienteId` of `customers.search` and the `cliente_id` that the CRM operations and
|
|
7
|
+
* `documents.add` take.
|
|
8
|
+
*
|
|
9
|
+
* It is NOT the id of a contract (`contratoId`, `id_contrato`, `clientecontrato`): the compiler
|
|
10
|
+
* refuses one where the other belongs, and a plain number where a customer id belongs. The brand is
|
|
11
|
+
* type-only: on the wire and at runtime an id is a plain number, so take one from a response or mark
|
|
12
|
+
* a number you trust with `as CustomerId`.
|
|
13
|
+
*/
|
|
14
|
+
export type CustomerId = number & z.core.$brand<"CustomerId">;
|
|
15
|
+
/**
|
|
16
|
+
* INTERNAL. The validation of a {@link CustomerId}: a number carrying the brand. A site that takes
|
|
17
|
+
* the id as input adds the constraints it needs (`.int().positive()`); a response reads it as is.
|
|
18
|
+
*/
|
|
19
|
+
export declare const customerIdSchema: z.core.$ZodBranded<z.ZodNumber, "CustomerId", "out">;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { SgpAddress } from "./address.js";
|
|
2
|
+
export type { CatalogsClient, ContractsClient, CoverageClient, CrmClient, CrmContractsClient, CrmCustomersClient, CustomersClient, DocumentsClient, ExperimentalAnnotationsClient, ExperimentalClient, InvoicesClient, OccurrencesClient, PlansClient, PreRegistrationsClient, ServicesClient, SgpClient, WorkOrdersClient, } from "./client.js";
|
|
2
3
|
export { createSgpClient } from "./client.js";
|
|
3
|
-
export type {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export type {
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export {
|
|
16
|
-
export type {
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
22
|
-
export type {
|
|
23
|
-
export {
|
|
24
|
-
export type {
|
|
25
|
-
export {
|
|
26
|
-
export type {
|
|
27
|
-
export {
|
|
28
|
-
export type {
|
|
29
|
-
export {
|
|
30
|
-
export type {
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
33
|
-
export {
|
|
34
|
-
export type {
|
|
35
|
-
export {
|
|
36
|
-
export type {
|
|
37
|
-
export {
|
|
38
|
-
export type {
|
|
39
|
-
export {
|
|
40
|
-
export type {
|
|
41
|
-
export {
|
|
42
|
-
export type {
|
|
43
|
-
export {
|
|
44
|
-
export type {
|
|
45
|
-
export {
|
|
46
|
-
export type { OpenTicketParams, OpenTicketResponse, } from "./endpoints/ura/open-ticket.js";
|
|
47
|
-
export { openTicketDefinition, openTicketKeyFields, ticketOpenedItemPath, ticketOpenedPersonalKeys, ticketOpenedSecretKeys, } from "./endpoints/ura/open-ticket.js";
|
|
48
|
-
export type { SchemaWarning, SgpError, SgpErrorCode, SgpResult, SgpWriteError, SgpWriteResult, WriteOutcome, } from "./result.js";
|
|
49
|
-
export { omitSensitive } from "./sensitivity.js";
|
|
50
|
-
export type { SgpClientConfig, SgpFile } from "./transport.js";
|
|
4
|
+
export type { CallOptions, ClientOptions, Credentials, ErrorHookMetadata, FetchLike, HookMetadata, Hooks, ResponseHookMetadata, TokenCredentials, } from "./config.js";
|
|
5
|
+
export { DEFAULT_TIMEOUT_MS, InvalidConfigurationError, MAX_TIMEOUT_MS } from "./config.js";
|
|
6
|
+
export type { AcquisitionMode, BillingMethod, ContractStatus, CrmStatus, ServiceType, } from "./constants.js";
|
|
7
|
+
export { ACQUISITION_MODE, BILLING_METHOD, CONTRACT_STATUS, CRM_STATUS, SERVICE_TYPE, } from "./constants.js";
|
|
8
|
+
export type { CustomerId } from "./ids.js";
|
|
9
|
+
export type { OperationName } from "./operation-sensitivity.js";
|
|
10
|
+
export { getSensitivity } from "./operation-sensitivity.js";
|
|
11
|
+
export type { CatalogsListBillingProfilesData } from "./operations/catalogs-list-billing-profiles.js";
|
|
12
|
+
export type { CatalogsListNasData } from "./operations/catalogs-list-nas.js";
|
|
13
|
+
export type { CatalogsListPopsData } from "./operations/catalogs-list-pops.js";
|
|
14
|
+
export type { ContractsListData, ContractsListInput } from "./operations/contracts-list.js";
|
|
15
|
+
export type { ContractsListStatusReasonsData } from "./operations/contracts-list-status-reasons.js";
|
|
16
|
+
export type { ContractUpdateData, ContractUpdateInput } from "./operations/contracts-update.js";
|
|
17
|
+
export type { ContractUpdateStatusData, ContractUpdateStatusInput, } from "./operations/contracts-update-status.js";
|
|
18
|
+
export type { CoverageCheckData, CoverageCheckInput, CoverageCto, } from "./operations/coverage-check.js";
|
|
19
|
+
export type { CrmContractCreateData, CrmContractCreateInput, } from "./operations/crm-contracts-create.js";
|
|
20
|
+
export type { CrmContractCreateByCpfCnpjData, CrmContractCreateByCpfCnpjInput, } from "./operations/crm-contracts-create-by-cpf-cnpj.js";
|
|
21
|
+
export type { CrmContractsListData, CrmContractsListInput, } from "./operations/crm-contracts-list.js";
|
|
22
|
+
export type { CrmCustomerCreateCompanyInput, CrmCustomerCreateData, CrmCustomerCreateIndividualInput, CrmCustomerCreateInput, } from "./operations/crm-customers-create.js";
|
|
23
|
+
export type { CrmCustomerUpdateStatusData, CrmCustomerUpdateStatusInput, } from "./operations/crm-customers-update-status.js";
|
|
24
|
+
export type { CustomersListData, CustomersListInput } from "./operations/customers-list.js";
|
|
25
|
+
export type { CustomersSearchData, CustomersSearchInput, } from "./operations/customers-search.js";
|
|
26
|
+
export type { DocumentAddInput, DocumentFile } from "./operations/documents-add.js";
|
|
27
|
+
export type { DocumentsListData, DocumentsListInput } from "./operations/documents-list.js";
|
|
28
|
+
export type { ExperimentalAnnotation, ExperimentalAnnotationsListData, ExperimentalAnnotationsListInput, } from "./operations/experimental-annotations-list.js";
|
|
29
|
+
export type { InvoicesListData, InvoicesListInput } from "./operations/invoices-list.js";
|
|
30
|
+
export type { OccurrenceCreateData, OccurrenceCreateInput, } from "./operations/occurrences-create.js";
|
|
31
|
+
export type { OccurrencesListMethodsData } from "./operations/occurrences-list-methods.js";
|
|
32
|
+
export type { OccurrencesListTypesData } from "./operations/occurrences-list-types.js";
|
|
33
|
+
export type { PlanId, PlansListData } from "./operations/plans-list.js";
|
|
34
|
+
export type { PreRegistrationCreateCompanyInput, PreRegistrationCreateData, PreRegistrationCreateIndividualInput, PreRegistrationCreateInput, PreRegistrationPlanId, } from "./operations/pre-registrations-create.js";
|
|
35
|
+
export type { PreRegistrationsListDueDaysData } from "./operations/pre-registrations-list-due-days.js";
|
|
36
|
+
export type { PreRegistrationsListPlansData } from "./operations/pre-registrations-list-plans.js";
|
|
37
|
+
export type { PreRegistrationsListSellersData } from "./operations/pre-registrations-list-sellers.js";
|
|
38
|
+
export type { ServiceAddTvData, ServiceAddTvInput } from "./operations/services-add-tv.js";
|
|
39
|
+
export type { ServiceChangePlanData, ServiceChangePlanInput, } from "./operations/services-change-plan.js";
|
|
40
|
+
export type { ServiceRemoveTvData, ServiceRemoveTvInput, } from "./operations/services-remove-tv.js";
|
|
41
|
+
export type { WorkOrdersListData, WorkOrdersListInput, } from "./operations/work-orders-list.js";
|
|
42
|
+
export type { WorkOrdersListReasonsData } from "./operations/work-orders-list-reasons.js";
|
|
43
|
+
export type { RawRequestInput } from "./raw-request.js";
|
|
44
|
+
export type { CapturedResponse, Diagnostic, Effect, ResponseBody, ResultBase, SchemaWarning, SgpError, SgpErrorCode, SgpErrorFields, SgpFailure, SgpResult, SgpSuccess, } from "./result.js";
|
|
45
|
+
export type { OperationSensitivity, SafeLog, SensitivityScope } from "./sensitivity.js";
|
|
46
|
+
export { pick, toSafeLog } from "./sensitivity.js";
|