@vintr/node-sdk 1.1.0 → 1.1.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.
- package/README.md +1 -3
- package/dist/client.d.ts +1 -1
- package/dist/client.js +19 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,9 +61,7 @@ Resolves an alias to its associated location and metadata.
|
|
|
61
61
|
delivery: "Use the designated delivery entrance.",
|
|
62
62
|
autonomous: "Approach from the east access road."
|
|
63
63
|
}
|
|
64
|
-
}
|
|
65
|
-
createdAt: "2026-08-18T20:39:52.671Z",
|
|
66
|
-
updatedAt: "2026-08-18T20:39:52.671Z"
|
|
64
|
+
}
|
|
67
65
|
}
|
|
68
66
|
```
|
|
69
67
|
|
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
import https from
|
|
1
|
+
import https from "https";
|
|
2
2
|
export class VintrClient {
|
|
3
3
|
constructor(apiKey) {
|
|
4
|
-
this.baseUrl =
|
|
4
|
+
this.baseUrl = "https://api.vintr.xyz";
|
|
5
5
|
this.apiKey = apiKey;
|
|
6
6
|
}
|
|
7
7
|
async request(path, headers) {
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
9
9
|
const url = new URL(path, this.baseUrl);
|
|
10
10
|
const defaultHeaders = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
};
|
|
14
|
+
const allHeaders = {
|
|
15
|
+
...defaultHeaders,
|
|
16
|
+
...headers,
|
|
13
17
|
};
|
|
14
|
-
const allHeaders = { ...defaultHeaders, ...headers };
|
|
15
18
|
const options = {
|
|
16
19
|
hostname: url.hostname,
|
|
17
20
|
port: url.port || 443,
|
|
18
21
|
path: url.pathname + url.search,
|
|
19
|
-
method:
|
|
22
|
+
method: "GET",
|
|
20
23
|
headers: allHeaders,
|
|
21
24
|
};
|
|
22
25
|
const req = https.request(options, (res) => {
|
|
23
|
-
let data =
|
|
24
|
-
res.on(
|
|
25
|
-
|
|
26
|
+
let data = "";
|
|
27
|
+
res.on("data", (chunk) => {
|
|
28
|
+
data += chunk;
|
|
29
|
+
});
|
|
30
|
+
res.on("end", () => {
|
|
26
31
|
try {
|
|
27
32
|
if (res.statusCode === 200) {
|
|
28
33
|
resolve(JSON.parse(data));
|
|
@@ -31,18 +36,19 @@ export class VintrClient {
|
|
|
31
36
|
reject(new Error(`HTTP ${res.statusCode}: ${data}`));
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
|
-
catch
|
|
39
|
+
catch {
|
|
35
40
|
reject(new Error(`Failed to parse response: ${data}`));
|
|
36
41
|
}
|
|
37
42
|
});
|
|
38
43
|
});
|
|
39
|
-
req.on(
|
|
44
|
+
req.on("error", reject);
|
|
40
45
|
req.end();
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
48
|
async resolveAlias(params) {
|
|
44
49
|
const url = new URL(`/${params.alias}`, this.baseUrl);
|
|
45
|
-
url.
|
|
46
|
-
|
|
50
|
+
return this.request(url.pathname, {
|
|
51
|
+
"X-Code": params.code,
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AliasAPI } from
|
|
1
|
+
import { AliasAPI } from "./alias.js";
|
|
2
2
|
export declare class Vintr {
|
|
3
3
|
readonly alias: AliasAPI;
|
|
4
4
|
private client;
|
|
5
5
|
constructor(apiKey: string);
|
|
6
6
|
}
|
|
7
|
-
export type { Address, Geo, Instructions, Location, AliasResponse, ErrorResponse, ResolveAliasParams } from
|
|
7
|
+
export type { Address, Geo, Instructions, Location, AliasResponse, ErrorResponse, ResolveAliasParams, } from "./types.js";
|
package/dist/index.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -25,10 +25,8 @@ export interface Location {
|
|
|
25
25
|
}
|
|
26
26
|
export interface AliasResponse {
|
|
27
27
|
alias: string;
|
|
28
|
-
type?:
|
|
28
|
+
type?: "business" | "individual";
|
|
29
29
|
location?: Location;
|
|
30
|
-
createdAt?: string;
|
|
31
|
-
updatedAt?: string;
|
|
32
30
|
}
|
|
33
31
|
export interface ErrorResponse {
|
|
34
32
|
error: string;
|