@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 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
@@ -1,4 +1,4 @@
1
- import type { AliasResponse, ResolveAliasParams } from './types.js';
1
+ import type { AliasResponse, ResolveAliasParams } from "./types.js";
2
2
  export declare class VintrClient {
3
3
  private apiKey;
4
4
  private readonly baseUrl;
package/dist/client.js CHANGED
@@ -1,28 +1,33 @@
1
- import https from 'https';
1
+ import https from "https";
2
2
  export class VintrClient {
3
3
  constructor(apiKey) {
4
- this.baseUrl = 'https://api.vintr.xyz';
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
- 'Authorization': `Bearer ${this.apiKey}`,
12
- 'Content-Type': 'application/json',
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: 'GET',
22
+ method: "GET",
20
23
  headers: allHeaders,
21
24
  };
22
25
  const req = https.request(options, (res) => {
23
- let data = '';
24
- res.on('data', (chunk) => data += chunk);
25
- res.on('end', () => {
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 (e) {
39
+ catch {
35
40
  reject(new Error(`Failed to parse response: ${data}`));
36
41
  }
37
42
  });
38
43
  });
39
- req.on('error', reject);
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.searchParams.append('code', params.code);
46
- return this.request(url.pathname + url.search);
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 './alias.js';
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 './types.js';
7
+ export type { Address, Geo, Instructions, Location, AliasResponse, ErrorResponse, ResolveAliasParams, } from "./types.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { VintrClient } from './client.js';
2
- import { AliasAPI } from './alias.js';
1
+ import { VintrClient } from "./client.js";
2
+ import { AliasAPI } from "./alias.js";
3
3
  export class Vintr {
4
4
  constructor(apiKey) {
5
5
  this.client = new VintrClient(apiKey);
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?: 'business' | 'individual';
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vintr/node-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Minimal, elegant Vintr API SDK for Node.js",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",