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 CHANGED
@@ -34,6 +34,10 @@ export declare class Latinfo {
34
34
  constructor(apiKey: string, options?: {
35
35
  baseUrl?: string;
36
36
  });
37
+ rotate(): Promise<{
38
+ api_key: string;
39
+ github_username: string;
40
+ }>;
37
41
  private request;
38
42
  }
39
43
  export {};
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",
4
- "description": "SUNAT RUC/DNI lookup CLI. Query Peru taxpayer data from terminal. Works without login. 18M+ records.",
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",