@verifiquemos/sdk 0.1.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/dist/index.js ADDED
@@ -0,0 +1,236 @@
1
+ // src/client.ts
2
+ import createOpenapiClient from "openapi-fetch";
3
+
4
+ // src/errors.ts
5
+ var ApiError = class extends Error {
6
+ status;
7
+ body;
8
+ constructor(status, message, body) {
9
+ super(message);
10
+ this.name = "ApiError";
11
+ this.status = status;
12
+ this.body = body;
13
+ }
14
+ isUnauthorized() {
15
+ return this.status === 401;
16
+ }
17
+ isPaymentRequired() {
18
+ return this.status === 402;
19
+ }
20
+ isNotFound() {
21
+ return this.status === 404;
22
+ }
23
+ isServerError() {
24
+ return this.status >= 500 && this.status < 600;
25
+ }
26
+ };
27
+ var RateLimitError = class extends ApiError {
28
+ retryAfterSeconds;
29
+ constructor(retryAfterSeconds, body = null) {
30
+ super(429, "Rate limit exceeded", body);
31
+ this.name = "RateLimitError";
32
+ this.retryAfterSeconds = retryAfterSeconds;
33
+ }
34
+ };
35
+ var NetworkError = class extends Error {
36
+ cause;
37
+ constructor(message, cause) {
38
+ super(message);
39
+ this.name = "NetworkError";
40
+ this.cause = cause;
41
+ }
42
+ };
43
+
44
+ // src/client.ts
45
+ var ULID_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
46
+ function generateUlid() {
47
+ const time = Date.now();
48
+ let timePart = "";
49
+ let t = time;
50
+ for (let i = 0; i < 10; i++) {
51
+ timePart = ULID_ALPHABET[t % 32] + timePart;
52
+ t = Math.floor(t / 32);
53
+ }
54
+ const buf = new Uint8Array(16);
55
+ globalThis.crypto.getRandomValues(buf);
56
+ let randPart = "";
57
+ for (let i = 0; i < 16; i++) {
58
+ randPart += ULID_ALPHABET[buf[i] % 32];
59
+ }
60
+ return timePart + randPart;
61
+ }
62
+ var VerifiquemosClient = class {
63
+ // C1 fix: private class field — not reachable via (client as any)._options
64
+ #apiKey;
65
+ #baseUrl;
66
+ #fetch;
67
+ #idempotencyKeyFactory;
68
+ #raw;
69
+ auth;
70
+ validations;
71
+ credits;
72
+ apiKeys;
73
+ constructor(opts) {
74
+ this.#apiKey = opts.apiKey;
75
+ this.#baseUrl = opts.baseUrl ?? "https://api.verifiquemos.gt";
76
+ this.#fetch = opts.fetch ?? globalThis.fetch.bind(globalThis);
77
+ this.#idempotencyKeyFactory = opts.idempotencyKeyFactory ?? generateUlid;
78
+ this.#raw = createOpenapiClient({
79
+ baseUrl: this.#baseUrl,
80
+ fetch: (request) => this.wrappedFetch(request)
81
+ });
82
+ const deps = {
83
+ wrappedFetch: this.wrappedFetch.bind(this),
84
+ raw: this.#raw,
85
+ baseUrl: this.#baseUrl
86
+ };
87
+ this.auth = new AuthApi(deps);
88
+ this.validations = new ValidationsApi(deps);
89
+ this.credits = new CreditsApi(deps);
90
+ this.apiKeys = new ApiKeysApi(deps);
91
+ }
92
+ /**
93
+ * Internal: every request flows through here for header injection + error normalization.
94
+ * Accepts either a Request object (from openapi-fetch) or a URL + RequestInit (direct).
95
+ *
96
+ * @internal
97
+ */
98
+ async wrappedFetch(input, init) {
99
+ const isRequest = typeof Request !== "undefined" && input instanceof Request;
100
+ const url = isRequest ? input.url : typeof input === "string" ? input : input.toString();
101
+ const baseInit = isRequest ? {
102
+ method: input.method,
103
+ body: input.body,
104
+ headers: input.headers,
105
+ // Pass through credentials/mode/etc when present
106
+ credentials: input.credentials,
107
+ cache: input.cache,
108
+ redirect: input.redirect,
109
+ referrer: input.referrer,
110
+ integrity: input.integrity,
111
+ signal: input.signal
112
+ } : { ...init ?? {} };
113
+ const method = (baseInit.method ?? "GET").toUpperCase();
114
+ const headers = new Headers(baseInit.headers ?? void 0);
115
+ headers.set("x-api-key", this.#apiKey);
116
+ if (!headers.has("accept")) {
117
+ headers.set("accept", "application/json");
118
+ }
119
+ if (["POST", "PUT", "PATCH", "DELETE"].includes(method) && !headers.has("idempotency-key")) {
120
+ headers.set("idempotency-key", this.#idempotencyKeyFactory());
121
+ }
122
+ const finalInit = { ...baseInit, headers };
123
+ let response;
124
+ try {
125
+ response = await this.#fetch(url, finalInit);
126
+ } catch (e) {
127
+ throw new NetworkError("Network request failed", e instanceof Error ? e : void 0);
128
+ }
129
+ if (!response.ok) {
130
+ const body = await response.clone().json().catch(() => null);
131
+ if (response.status === 429) {
132
+ const raw = response.headers.get("retry-after") ?? "0";
133
+ const asNumber = Number(raw);
134
+ let retryAfter;
135
+ if (Number.isFinite(asNumber) && asNumber >= 0) {
136
+ retryAfter = asNumber;
137
+ } else {
138
+ const dateMs = new Date(raw).getTime();
139
+ retryAfter = Number.isFinite(dateMs) ? Math.max(0, Math.ceil((dateMs - Date.now()) / 1e3)) : 0;
140
+ }
141
+ throw new RateLimitError(retryAfter, body);
142
+ }
143
+ const detail = body && typeof body === "object" && body !== null && "detail" in body ? body.detail : null;
144
+ const message = typeof detail === "string" ? detail : response.statusText;
145
+ throw new ApiError(response.status, message, body);
146
+ }
147
+ return response;
148
+ }
149
+ };
150
+ var AuthApi = class {
151
+ constructor(deps) {
152
+ this.deps = deps;
153
+ }
154
+ deps;
155
+ async me() {
156
+ const { data } = await this.deps.raw.GET("/api/v1/auth/me");
157
+ return data;
158
+ }
159
+ };
160
+ var ValidationsApi = class {
161
+ constructor(deps) {
162
+ this.deps = deps;
163
+ }
164
+ deps;
165
+ /**
166
+ * Submit a new validation request.
167
+ *
168
+ * Note: `cui` (Guatemalan ID number) is NOT a form field — it is extracted
169
+ * automatically from the uploaded DPI image via OCR on the server side.
170
+ *
171
+ * @param input.naturalezaCliente - Client nature, e.g. "individual" or "juridica".
172
+ * @param input.paisOrigenFondos - Optional ISO-3166-1 alpha-2 country code for funds origin.
173
+ * @param input.dpiFile - DPI image blob (front side; OCR extracts the CUI).
174
+ */
175
+ // Fix #5 — C1: Correct multipart field names to match the real API.
176
+ // - Single dpi_file (not dpi_front + dpi_back)
177
+ // - pais_origen_fondos (not pais_origen)
178
+ // - No cui field (extracted via OCR on the server)
179
+ async create(input) {
180
+ const form = new FormData();
181
+ form.append("naturaleza_cliente", input.naturalezaCliente);
182
+ if (input.paisOrigenFondos) {
183
+ form.append("pais_origen_fondos", input.paisOrigenFondos);
184
+ }
185
+ form.append("dpi_file", input.dpiFile);
186
+ const response = await this.deps.wrappedFetch(
187
+ `${this.deps.baseUrl}/api/v1/validations`,
188
+ { method: "POST", body: form }
189
+ );
190
+ return await response.json();
191
+ }
192
+ async get(id) {
193
+ const { data } = await this.deps.raw.GET("/api/v1/validations/{validation_id}", {
194
+ params: { path: { validation_id: id } }
195
+ });
196
+ return data;
197
+ }
198
+ // Fix #4 — I4: Set accept:application/pdf so the server streams the PDF
199
+ // instead of attempting a JSON serialization.
200
+ async report(id) {
201
+ const response = await this.deps.wrappedFetch(
202
+ `${this.deps.baseUrl}/api/v1/validations/${id}/report`,
203
+ { method: "GET", headers: { accept: "application/pdf" } }
204
+ );
205
+ return await response.blob();
206
+ }
207
+ };
208
+ var CreditsApi = class {
209
+ constructor(deps) {
210
+ this.deps = deps;
211
+ }
212
+ deps;
213
+ async balance() {
214
+ const { data } = await this.deps.raw.GET("/api/v1/credits/balance");
215
+ return data;
216
+ }
217
+ };
218
+ var ApiKeysApi = class {
219
+ constructor(deps) {
220
+ this.deps = deps;
221
+ }
222
+ deps;
223
+ async list(tenantId) {
224
+ const { data } = await this.deps.raw.GET("/api/v1/tenants/{tenant_id}/api-keys", {
225
+ params: { path: { tenant_id: tenantId } }
226
+ });
227
+ return data;
228
+ }
229
+ };
230
+ export {
231
+ ApiError,
232
+ NetworkError,
233
+ RateLimitError,
234
+ VerifiquemosClient
235
+ };
236
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts","../src/errors.ts"],"sourcesContent":["import createOpenapiClient from \"openapi-fetch\";\nimport type { paths } from \"./generated\";\nimport { ApiError, NetworkError, RateLimitError } from \"./errors\";\n\nconst ULID_ALPHABET = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\n// Fix #2 — I2: Use crypto.getRandomValues() instead of Math.random() for\n// cryptographic-quality randomness in idempotency keys.\nfunction generateUlid(): string {\n // Spec: 26-char Crockford Base32. Top 10 chars are timestamp (ms since epoch).\n // Bottom 16 chars are randomness.\n const time = Date.now();\n let timePart = \"\";\n let t = time;\n for (let i = 0; i < 10; i++) {\n timePart = ULID_ALPHABET[t % 32]! + timePart;\n t = Math.floor(t / 32);\n }\n const buf = new Uint8Array(16);\n // globalThis.crypto is available in Node >= 20 and all modern browsers.\n globalThis.crypto.getRandomValues(buf);\n let randPart = \"\";\n for (let i = 0; i < 16; i++) {\n randPart += ULID_ALPHABET[buf[i]! % 32]!;\n }\n return timePart + randPart;\n}\n\nexport interface VerifiquemosClientOptions {\n apiKey: string;\n baseUrl?: string;\n fetch?: typeof fetch;\n /** Override the default Idempotency-Key generator. */\n idempotencyKeyFactory?: () => string;\n}\n\n// Fix #1 — C1: Sub-API classes receive only the wrappedFetch closure and\n// baseUrl (both non-sensitive). The openapi-fetch raw client is also passed\n// so sub-APIs can use typed path helpers. The API key is stored only in a\n// class-private field (#apiKey) and is never exposed on the public surface.\n\n/** Internal bundle passed to sub-API classes; not part of the public API. */\ninterface SubApiDeps {\n wrappedFetch: VerifiquemosClient[\"wrappedFetch\"];\n raw: ReturnType<typeof createOpenapiClient<paths>>;\n baseUrl: string;\n}\n\nexport class VerifiquemosClient {\n // C1 fix: private class field — not reachable via (client as any)._options\n #apiKey: string;\n #baseUrl: string;\n #fetch: typeof fetch;\n #idempotencyKeyFactory: () => string;\n #raw: ReturnType<typeof createOpenapiClient<paths>>;\n\n readonly auth: AuthApi;\n readonly validations: ValidationsApi;\n readonly credits: CreditsApi;\n readonly apiKeys: ApiKeysApi;\n\n constructor(opts: VerifiquemosClientOptions) {\n this.#apiKey = opts.apiKey;\n this.#baseUrl = opts.baseUrl ?? \"https://api.verifiquemos.gt\";\n this.#fetch = opts.fetch ?? globalThis.fetch.bind(globalThis);\n this.#idempotencyKeyFactory = opts.idempotencyKeyFactory ?? generateUlid;\n\n this.#raw = createOpenapiClient<paths>({\n baseUrl: this.#baseUrl,\n fetch: (request: Request) => this.wrappedFetch(request),\n });\n\n const deps: SubApiDeps = {\n wrappedFetch: this.wrappedFetch.bind(this),\n raw: this.#raw,\n baseUrl: this.#baseUrl,\n };\n\n this.auth = new AuthApi(deps);\n this.validations = new ValidationsApi(deps);\n this.credits = new CreditsApi(deps);\n this.apiKeys = new ApiKeysApi(deps);\n }\n\n /**\n * Internal: every request flows through here for header injection + error normalization.\n * Accepts either a Request object (from openapi-fetch) or a URL + RequestInit (direct).\n *\n * @internal\n */\n async wrappedFetch(input: Request | string | URL, init?: RequestInit): Promise<Response> {\n const isRequest = typeof Request !== \"undefined\" && input instanceof Request;\n const url = isRequest ? input.url : typeof input === \"string\" ? input : input.toString();\n const baseInit: RequestInit = isRequest\n ? {\n method: input.method,\n body: input.body,\n headers: input.headers,\n // Pass through credentials/mode/etc when present\n credentials: input.credentials,\n cache: input.cache,\n redirect: input.redirect,\n referrer: input.referrer,\n integrity: input.integrity,\n signal: input.signal,\n }\n : { ...(init ?? {}) };\n\n const method = (baseInit.method ?? \"GET\").toUpperCase();\n const headers = new Headers(baseInit.headers ?? undefined);\n headers.set(\"x-api-key\", this.#apiKey);\n // Fix #4 — I4: Only set default accept if caller hasn't already set one\n // (e.g. validations.report() sets accept:application/pdf).\n if (!headers.has(\"accept\")) {\n headers.set(\"accept\", \"application/json\");\n }\n if ([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"].includes(method) && !headers.has(\"idempotency-key\")) {\n headers.set(\"idempotency-key\", this.#idempotencyKeyFactory());\n }\n\n const finalInit: RequestInit = { ...baseInit, headers };\n\n let response: Response;\n try {\n response = await this.#fetch(url, finalInit);\n } catch (e) {\n throw new NetworkError(\"Network request failed\", e instanceof Error ? e : undefined);\n }\n\n if (!response.ok) {\n const body = await response.clone().json().catch(() => null);\n if (response.status === 429) {\n // Fix #3 — I1: Defensive retry-after parsing — handle both numeric\n // seconds (RFC 6585 §4) and HTTP-date format (RFC 7231 §7.1.3).\n const raw = response.headers.get(\"retry-after\") ?? \"0\";\n const asNumber = Number(raw);\n let retryAfter: number;\n if (Number.isFinite(asNumber) && asNumber >= 0) {\n retryAfter = asNumber;\n } else {\n const dateMs = new Date(raw).getTime();\n retryAfter = Number.isFinite(dateMs)\n ? Math.max(0, Math.ceil((dateMs - Date.now()) / 1000))\n : 0;\n }\n throw new RateLimitError(retryAfter, body);\n }\n const detail =\n body && typeof body === \"object\" && body !== null && \"detail\" in body\n ? (body as { detail: unknown }).detail\n : null;\n const message = typeof detail === \"string\" ? detail : response.statusText;\n throw new ApiError(response.status, message, body);\n }\n\n return response;\n }\n}\n\nclass AuthApi {\n constructor(private readonly deps: SubApiDeps) {}\n\n async me() {\n const { data } = await this.deps.raw.GET(\"/api/v1/auth/me\");\n return data;\n }\n}\n\nclass ValidationsApi {\n constructor(private readonly deps: SubApiDeps) {}\n\n /**\n * Submit a new validation request.\n *\n * Note: `cui` (Guatemalan ID number) is NOT a form field — it is extracted\n * automatically from the uploaded DPI image via OCR on the server side.\n *\n * @param input.naturalezaCliente - Client nature, e.g. \"individual\" or \"juridica\".\n * @param input.paisOrigenFondos - Optional ISO-3166-1 alpha-2 country code for funds origin.\n * @param input.dpiFile - DPI image blob (front side; OCR extracts the CUI).\n */\n // Fix #5 — C1: Correct multipart field names to match the real API.\n // - Single dpi_file (not dpi_front + dpi_back)\n // - pais_origen_fondos (not pais_origen)\n // - No cui field (extracted via OCR on the server)\n async create(input: {\n naturalezaCliente: string;\n paisOrigenFondos?: string;\n dpiFile: Blob;\n }): Promise<{ id: string; status: string }> {\n const form = new FormData();\n form.append(\"naturaleza_cliente\", input.naturalezaCliente);\n if (input.paisOrigenFondos) {\n form.append(\"pais_origen_fondos\", input.paisOrigenFondos);\n }\n form.append(\"dpi_file\", input.dpiFile);\n\n // openapi-fetch's multipart support is limited; use wrappedFetch directly.\n const response = await this.deps.wrappedFetch(\n `${this.deps.baseUrl}/api/v1/validations`,\n { method: \"POST\", body: form },\n );\n return (await response.json()) as { id: string; status: string };\n }\n\n async get(id: string) {\n const { data } = await this.deps.raw.GET(\"/api/v1/validations/{validation_id}\", {\n params: { path: { validation_id: id } },\n });\n return data;\n }\n\n // Fix #4 — I4: Set accept:application/pdf so the server streams the PDF\n // instead of attempting a JSON serialization.\n async report(id: string): Promise<Blob> {\n const response = await this.deps.wrappedFetch(\n `${this.deps.baseUrl}/api/v1/validations/${id}/report`,\n { method: \"GET\", headers: { accept: \"application/pdf\" } },\n );\n return await response.blob();\n }\n}\n\nclass CreditsApi {\n constructor(private readonly deps: SubApiDeps) {}\n\n async balance() {\n const { data } = await this.deps.raw.GET(\"/api/v1/credits/balance\");\n return data;\n }\n}\n\nclass ApiKeysApi {\n constructor(private readonly deps: SubApiDeps) {}\n\n async list(tenantId: string) {\n const { data } = await this.deps.raw.GET(\"/api/v1/tenants/{tenant_id}/api-keys\", {\n params: { path: { tenant_id: tenantId } },\n });\n return data;\n }\n}\n","/**\n * Errors thrown by the Verifiquemos SDK.\n *\n * `ApiError` is thrown for any HTTP 4xx/5xx response from the API.\n * `RateLimitError` is a specialization for 429 responses.\n * `NetworkError` wraps transport failures (DNS, timeout, connection reset).\n */\n\nexport class ApiError extends Error {\n readonly status: number;\n readonly body: unknown;\n\n constructor(status: number, message: string, body: unknown) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.body = body;\n }\n\n isUnauthorized(): boolean {\n return this.status === 401;\n }\n\n isPaymentRequired(): boolean {\n return this.status === 402;\n }\n\n isNotFound(): boolean {\n return this.status === 404;\n }\n\n isServerError(): boolean {\n return this.status >= 500 && this.status < 600;\n }\n}\n\nexport class RateLimitError extends ApiError {\n readonly retryAfterSeconds: number;\n\n constructor(retryAfterSeconds: number, body: unknown = null) {\n super(429, \"Rate limit exceeded\", body);\n this.name = \"RateLimitError\";\n this.retryAfterSeconds = retryAfterSeconds;\n }\n}\n\nexport class NetworkError extends Error {\n override readonly cause?: Error;\n\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = \"NetworkError\";\n this.cause = cause;\n }\n}\n"],"mappings":";AAAA,OAAO,yBAAyB;;;ACQzB,IAAM,WAAN,cAAuB,MAAM;AAAA,EACzB;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,SAAiB,MAAe;AAC1D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,iBAA0B;AACxB,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA,EAEA,oBAA6B;AAC3B,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA,EAEA,aAAsB;AACpB,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA,EAEA,gBAAyB;AACvB,WAAO,KAAK,UAAU,OAAO,KAAK,SAAS;AAAA,EAC7C;AACF;AAEO,IAAM,iBAAN,cAA6B,SAAS;AAAA,EAClC;AAAA,EAET,YAAY,mBAA2B,OAAgB,MAAM;AAC3D,UAAM,KAAK,uBAAuB,IAAI;AACtC,SAAK,OAAO;AACZ,SAAK,oBAAoB;AAAA,EAC3B;AACF;AAEO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACpB;AAAA,EAElB,YAAY,SAAiB,OAAe;AAC1C,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;AACF;;;ADlDA,IAAM,gBAAgB;AAItB,SAAS,eAAuB;AAG9B,QAAM,OAAO,KAAK,IAAI;AACtB,MAAI,WAAW;AACf,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,eAAW,cAAc,IAAI,EAAE,IAAK;AACpC,QAAI,KAAK,MAAM,IAAI,EAAE;AAAA,EACvB;AACA,QAAM,MAAM,IAAI,WAAW,EAAE;AAE7B,aAAW,OAAO,gBAAgB,GAAG;AACrC,MAAI,WAAW;AACf,WAAS,IAAI,GAAG,IAAI,IAA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K,OAAO,uBAAuB,EAAE;AAAA,MAC7C,EAAE,QAAQ,OAAO,SAAS,EAAE,QAAQ,kBAAkB,EAAE;AAAA,IAC1D;AACA,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B;AACF;AAEA,IAAM,aAAN,MAAiB;AAAA,EACf,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,UAAU;AACd,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,KAAK,IAAI,IAAI,yBAAyB;AAClE,WAAO;AAAA,EACT;AACF;AAEA,IAAM,aAAN,MAAiB;AAAA,EACf,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,KAAK,UAAkB;AAC3B,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,KAAK,IAAI,IAAI,wCAAwC;AAAA,MAC/E,QAAQ,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE;AAAA,IAC1C,CAAC;AACD,WAAO;AAAA,EACT;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@verifiquemos/sdk",
3
+ "version": "0.1.1",
4
+ "description": "Official TypeScript SDK for the Verifiquemos compliance API",
5
+ "license": "MIT",
6
+ "author": "Verifiquemos",
7
+ "homepage": "https://verifiquemos.gt/developers",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://dev.azure.com/verifiquemos/Verifiquemos/_git/verifiquemos-sdk-typescript"
11
+ },
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.cjs"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "CHANGELOG.md",
26
+ "LICENSE"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsup",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "typecheck": "tsc --noEmit",
33
+ "regen-types": "bash scripts/regen-types.sh",
34
+ "example:validation": "tsx examples/create-validation.ts",
35
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build"
36
+ },
37
+ "keywords": [
38
+ "verifiquemos",
39
+ "kyc",
40
+ "compliance",
41
+ "guatemala",
42
+ "renap",
43
+ "ofac",
44
+ "api",
45
+ "sdk"
46
+ ],
47
+ "engines": {
48
+ "node": ">=20"
49
+ },
50
+ "dependencies": {
51
+ "openapi-fetch": "^0.13.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.0.0",
55
+ "openapi-typescript": "^7.4.0",
56
+ "tsup": "^8.3.0",
57
+ "tsx": "^4.19.0",
58
+ "typescript": "^5.7.0",
59
+ "vitest": "^2.1.0"
60
+ }
61
+ }