latinfo 0.5.4 → 0.5.6
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/sdk.d.ts +4 -0
- package/dist/sdk.js +13 -0
- package/package.json +2 -2
package/dist/sdk.d.ts
CHANGED
package/dist/sdk.js
CHANGED
|
@@ -36,6 +36,19 @@ class Latinfo {
|
|
|
36
36
|
this.baseUrl = options?.baseUrl || DEFAULT_API_URL;
|
|
37
37
|
this.pe = new Peru(this.request.bind(this));
|
|
38
38
|
}
|
|
39
|
+
async rotate() {
|
|
40
|
+
const res = await fetch(`${this.baseUrl}/auth/rotate`, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: { Authorization: `Bearer ${this.apiKey}` },
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
const body = await res.json();
|
|
46
|
+
throw new Error(body.message || body.error);
|
|
47
|
+
}
|
|
48
|
+
const data = await res.json();
|
|
49
|
+
this.apiKey = data.api_key;
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
39
52
|
async request(path) {
|
|
40
53
|
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
41
54
|
headers: { Authorization: `Bearer ${this.apiKey}` },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latinfo",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.6",
|
|
4
|
+
"description": "Tax registry API for Latin America. Query RUC, DNI, and company data from SUNAT Peru. 18M+ records, updated daily, sub-100ms from anywhere.",
|
|
5
5
|
"homepage": "https://latinfo.dev",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|