@jars-lt/sdk 1.0.3 → 1.1.0
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/.turbo/turbo-build.log +5 -0
- package/dist/index.d.ts +95 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -19
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Company, SubscriptionPlan, WorkdayCheckResponse, AddWorkdaysResponse, NormalizeAddressResponse } from '@jars-lt/types';
|
|
1
|
+
import { Company, SubscriptionPlan, WorkdayCheckResponse, AddWorkdaysResponse, NormalizeAddressResponse, Invoice } from '@jars-lt/types';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for JARS.LT client
|
|
4
4
|
*/
|
|
@@ -132,6 +132,12 @@ export interface CompanyFinancialsResponse {
|
|
|
132
132
|
financials: CompanyFinancialsData[];
|
|
133
133
|
availableYears: number[];
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Invoices list response
|
|
137
|
+
*/
|
|
138
|
+
export interface InvoicesListResponse {
|
|
139
|
+
invoices: Invoice[];
|
|
140
|
+
}
|
|
135
141
|
/**
|
|
136
142
|
* API Error
|
|
137
143
|
*/
|
|
@@ -143,6 +149,10 @@ export declare class JarsAPIError extends Error {
|
|
|
143
149
|
/**
|
|
144
150
|
* Official JARS.LT API Client
|
|
145
151
|
*
|
|
152
|
+
* Supports both Lithuanian and Estonian company registries.
|
|
153
|
+
* Default country depends on the base URL: api.jars.lt defaults to Lithuania,
|
|
154
|
+
* api.jars.ee defaults to Estonia.
|
|
155
|
+
*
|
|
146
156
|
* @example
|
|
147
157
|
* ```typescript
|
|
148
158
|
* import { JarsClient } from '@jars-lt/sdk';
|
|
@@ -151,11 +161,17 @@ export declare class JarsAPIError extends Error {
|
|
|
151
161
|
* apiKey: 'your_api_key_here'
|
|
152
162
|
* });
|
|
153
163
|
*
|
|
154
|
-
* // Search companies
|
|
155
|
-
* const
|
|
164
|
+
* // Search Lithuanian companies
|
|
165
|
+
* const ltCompanies = await client.searchCompanies({ q: 'UAB Maxima' });
|
|
156
166
|
*
|
|
157
|
-
* //
|
|
158
|
-
* const
|
|
167
|
+
* // Search Estonian companies
|
|
168
|
+
* const eeCompanies = await client.searchCompanies({ q: 'Bolt', country: 'ee' });
|
|
169
|
+
*
|
|
170
|
+
* // Or use api.jars.ee as base URL for Estonian defaults
|
|
171
|
+
* const eeClient = new JarsClient({
|
|
172
|
+
* apiKey: 'your_api_key_here',
|
|
173
|
+
* baseURL: 'https://api.jars.ee/api/v1'
|
|
174
|
+
* });
|
|
159
175
|
* ```
|
|
160
176
|
*/
|
|
161
177
|
export declare class JarsClient {
|
|
@@ -168,61 +184,70 @@ export declare class JarsClient {
|
|
|
168
184
|
* @param params.q - Search query (company name or code)
|
|
169
185
|
* @param params.limit - Number of results (max: 100, default: 20)
|
|
170
186
|
* @param params.offset - Skip results (default: 0)
|
|
187
|
+
* @param params.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
171
188
|
* @returns Search results with companies
|
|
172
189
|
*
|
|
173
190
|
* @example
|
|
174
191
|
* ```typescript
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* console.log(results.results); // Array of companies
|
|
192
|
+
* // Search Lithuanian companies
|
|
193
|
+
* const results = await client.searchCompanies({ q: 'Maxima', limit: 10 });
|
|
194
|
+
*
|
|
195
|
+
* // Search Estonian companies
|
|
196
|
+
* const eeResults = await client.searchCompanies({ q: 'Bolt', country: 'ee' });
|
|
181
197
|
* ```
|
|
182
198
|
*/
|
|
183
199
|
searchCompanies(params: {
|
|
184
200
|
q: string;
|
|
185
201
|
limit?: number;
|
|
186
202
|
offset?: number;
|
|
203
|
+
country?: 'lt' | 'ee';
|
|
187
204
|
}): Promise<SearchCompaniesResponse>;
|
|
188
205
|
/**
|
|
189
206
|
* Get company details by company code
|
|
190
207
|
*
|
|
191
|
-
* @param code - Company code
|
|
208
|
+
* @param code - Company registration code
|
|
209
|
+
* @param options - Optional parameters
|
|
210
|
+
* @param options.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
192
211
|
* @returns Company details
|
|
193
212
|
*
|
|
194
213
|
* @example
|
|
195
214
|
* ```typescript
|
|
215
|
+
* // Lithuanian company
|
|
196
216
|
* const company = await client.getCompany('111111111');
|
|
197
|
-
*
|
|
198
|
-
*
|
|
217
|
+
*
|
|
218
|
+
* // Estonian company
|
|
219
|
+
* const eeCompany = await client.getCompany('14532901', { country: 'ee' });
|
|
199
220
|
* ```
|
|
200
221
|
*/
|
|
201
|
-
getCompany(code: string
|
|
222
|
+
getCompany(code: string, options?: {
|
|
223
|
+
country?: 'lt' | 'ee';
|
|
224
|
+
}): Promise<Company>;
|
|
202
225
|
/**
|
|
203
226
|
* Get company financial reports (balance sheet + P&L)
|
|
204
227
|
*
|
|
205
|
-
* @param code - Company code
|
|
228
|
+
* @param code - Company registration code
|
|
206
229
|
* @param params - Optional parameters
|
|
207
230
|
* @param params.year - Specific year to fetch (optional, returns all years if not specified)
|
|
208
231
|
* @param params.limit - Maximum number of years to return (default: 10, max: 50)
|
|
232
|
+
* @param params.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
209
233
|
* @returns Financial reports with balance sheet and P&L data
|
|
210
234
|
*
|
|
211
235
|
* @example
|
|
212
236
|
* ```typescript
|
|
213
237
|
* // Get all available financial reports
|
|
214
238
|
* const financials = await client.getCompanyFinancials('111111111');
|
|
215
|
-
* console.log(financials.availableYears); // [2024, 2023, 2022]
|
|
216
|
-
* console.log(financials.financials[0].profitLoss?.revenue); // Revenue for latest year
|
|
217
239
|
*
|
|
218
240
|
* // Get specific year
|
|
219
241
|
* const financials2024 = await client.getCompanyFinancials('111111111', { year: 2024 });
|
|
220
|
-
*
|
|
242
|
+
*
|
|
243
|
+
* // Estonian company financials
|
|
244
|
+
* const eeFinancials = await client.getCompanyFinancials('14532901', { country: 'ee' });
|
|
221
245
|
* ```
|
|
222
246
|
*/
|
|
223
247
|
getCompanyFinancials(code: string, params?: {
|
|
224
248
|
year?: number;
|
|
225
249
|
limit?: number;
|
|
250
|
+
country?: 'lt' | 'ee';
|
|
226
251
|
}): Promise<CompanyFinancialsResponse>;
|
|
227
252
|
/**
|
|
228
253
|
* Search for addresses (streets, settlements, municipalities)
|
|
@@ -332,6 +357,57 @@ export declare class JarsClient {
|
|
|
332
357
|
* ```
|
|
333
358
|
*/
|
|
334
359
|
normalizeAddress(address: string, limit?: number): Promise<NormalizeAddressResponse>;
|
|
360
|
+
/**
|
|
361
|
+
* List all invoices for the authenticated user
|
|
362
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
363
|
+
*
|
|
364
|
+
* @returns List of invoices
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* const { invoices } = await client.listInvoices();
|
|
369
|
+
* for (const invoice of invoices) {
|
|
370
|
+
* console.log(invoice.number, invoice.status, invoice.total / 100);
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
listInvoices(): Promise<InvoicesListResponse>;
|
|
375
|
+
/**
|
|
376
|
+
* Get a specific invoice by ID
|
|
377
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
378
|
+
*
|
|
379
|
+
* @param invoiceId - Stripe invoice ID (e.g., "in_1abc123")
|
|
380
|
+
* @returns Invoice details
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const invoice = await client.getInvoice('in_1abc123');
|
|
385
|
+
* console.log(invoice.number); // "INV-0091"
|
|
386
|
+
* console.log(invoice.total / 100); // 9.99
|
|
387
|
+
* console.log(invoice.customerName); // "UAB Example"
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
getInvoice(invoiceId: string): Promise<Invoice>;
|
|
391
|
+
/**
|
|
392
|
+
* Download invoice in UBL XML format (Peppol BIS Billing 3.0)
|
|
393
|
+
* The UBL format is compliant with European e-invoicing standard EN 16931
|
|
394
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
395
|
+
*
|
|
396
|
+
* @param invoiceId - Stripe invoice ID (e.g., "in_1abc123")
|
|
397
|
+
* @returns UBL XML string
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* const xml = await client.getInvoiceUbl('in_1abc123');
|
|
402
|
+
* // Save to file
|
|
403
|
+
* fs.writeFileSync('invoice.xml', xml);
|
|
404
|
+
*
|
|
405
|
+
* // Or parse for processing
|
|
406
|
+
* const parser = new DOMParser();
|
|
407
|
+
* const doc = parser.parseFromString(xml, 'text/xml');
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
getInvoiceUbl(invoiceId: string): Promise<string>;
|
|
335
411
|
}
|
|
336
412
|
export * from '@jars-lt/types';
|
|
337
413
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzI;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MA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;;;;;;;;;;;OAkBG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAIxD;AAGD,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,10 @@ exports.JarsAPIError = JarsAPIError;
|
|
|
34
34
|
/**
|
|
35
35
|
* Official JARS.LT API Client
|
|
36
36
|
*
|
|
37
|
+
* Supports both Lithuanian and Estonian company registries.
|
|
38
|
+
* Default country depends on the base URL: api.jars.lt defaults to Lithuania,
|
|
39
|
+
* api.jars.ee defaults to Estonia.
|
|
40
|
+
*
|
|
37
41
|
* @example
|
|
38
42
|
* ```typescript
|
|
39
43
|
* import { JarsClient } from '@jars-lt/sdk';
|
|
@@ -42,11 +46,17 @@ exports.JarsAPIError = JarsAPIError;
|
|
|
42
46
|
* apiKey: 'your_api_key_here'
|
|
43
47
|
* });
|
|
44
48
|
*
|
|
45
|
-
* // Search companies
|
|
46
|
-
* const
|
|
49
|
+
* // Search Lithuanian companies
|
|
50
|
+
* const ltCompanies = await client.searchCompanies({ q: 'UAB Maxima' });
|
|
51
|
+
*
|
|
52
|
+
* // Search Estonian companies
|
|
53
|
+
* const eeCompanies = await client.searchCompanies({ q: 'Bolt', country: 'ee' });
|
|
47
54
|
*
|
|
48
|
-
* //
|
|
49
|
-
* const
|
|
55
|
+
* // Or use api.jars.ee as base URL for Estonian defaults
|
|
56
|
+
* const eeClient = new JarsClient({
|
|
57
|
+
* apiKey: 'your_api_key_here',
|
|
58
|
+
* baseURL: 'https://api.jars.ee/api/v1'
|
|
59
|
+
* });
|
|
50
60
|
* ```
|
|
51
61
|
*/
|
|
52
62
|
class JarsClient {
|
|
@@ -78,16 +88,16 @@ class JarsClient {
|
|
|
78
88
|
* @param params.q - Search query (company name or code)
|
|
79
89
|
* @param params.limit - Number of results (max: 100, default: 20)
|
|
80
90
|
* @param params.offset - Skip results (default: 0)
|
|
91
|
+
* @param params.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
81
92
|
* @returns Search results with companies
|
|
82
93
|
*
|
|
83
94
|
* @example
|
|
84
95
|
* ```typescript
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* console.log(results.results); // Array of companies
|
|
96
|
+
* // Search Lithuanian companies
|
|
97
|
+
* const results = await client.searchCompanies({ q: 'Maxima', limit: 10 });
|
|
98
|
+
*
|
|
99
|
+
* // Search Estonian companies
|
|
100
|
+
* const eeResults = await client.searchCompanies({ q: 'Bolt', country: 'ee' });
|
|
91
101
|
* ```
|
|
92
102
|
*/
|
|
93
103
|
async searchCompanies(params) {
|
|
@@ -97,39 +107,44 @@ class JarsClient {
|
|
|
97
107
|
/**
|
|
98
108
|
* Get company details by company code
|
|
99
109
|
*
|
|
100
|
-
* @param code - Company code
|
|
110
|
+
* @param code - Company registration code
|
|
111
|
+
* @param options - Optional parameters
|
|
112
|
+
* @param options.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
101
113
|
* @returns Company details
|
|
102
114
|
*
|
|
103
115
|
* @example
|
|
104
116
|
* ```typescript
|
|
117
|
+
* // Lithuanian company
|
|
105
118
|
* const company = await client.getCompany('111111111');
|
|
106
|
-
*
|
|
107
|
-
*
|
|
119
|
+
*
|
|
120
|
+
* // Estonian company
|
|
121
|
+
* const eeCompany = await client.getCompany('14532901', { country: 'ee' });
|
|
108
122
|
* ```
|
|
109
123
|
*/
|
|
110
|
-
async getCompany(code) {
|
|
111
|
-
const response = await this.client.get(`/companies/${code}
|
|
124
|
+
async getCompany(code, options) {
|
|
125
|
+
const response = await this.client.get(`/companies/${code}`, { params: options });
|
|
112
126
|
return response.data;
|
|
113
127
|
}
|
|
114
128
|
/**
|
|
115
129
|
* Get company financial reports (balance sheet + P&L)
|
|
116
130
|
*
|
|
117
|
-
* @param code - Company code
|
|
131
|
+
* @param code - Company registration code
|
|
118
132
|
* @param params - Optional parameters
|
|
119
133
|
* @param params.year - Specific year to fetch (optional, returns all years if not specified)
|
|
120
134
|
* @param params.limit - Maximum number of years to return (default: 10, max: 50)
|
|
135
|
+
* @param params.country - Country: "lt" (Lithuania) or "ee" (Estonia). Default depends on base URL domain.
|
|
121
136
|
* @returns Financial reports with balance sheet and P&L data
|
|
122
137
|
*
|
|
123
138
|
* @example
|
|
124
139
|
* ```typescript
|
|
125
140
|
* // Get all available financial reports
|
|
126
141
|
* const financials = await client.getCompanyFinancials('111111111');
|
|
127
|
-
* console.log(financials.availableYears); // [2024, 2023, 2022]
|
|
128
|
-
* console.log(financials.financials[0].profitLoss?.revenue); // Revenue for latest year
|
|
129
142
|
*
|
|
130
143
|
* // Get specific year
|
|
131
144
|
* const financials2024 = await client.getCompanyFinancials('111111111', { year: 2024 });
|
|
132
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* // Estonian company financials
|
|
147
|
+
* const eeFinancials = await client.getCompanyFinancials('14532901', { country: 'ee' });
|
|
133
148
|
* ```
|
|
134
149
|
*/
|
|
135
150
|
async getCompanyFinancials(code, params) {
|
|
@@ -258,6 +273,66 @@ class JarsClient {
|
|
|
258
273
|
const response = await this.client.post('/addresses/normalize', { address, limit });
|
|
259
274
|
return response.data;
|
|
260
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* List all invoices for the authenticated user
|
|
278
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
279
|
+
*
|
|
280
|
+
* @returns List of invoices
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const { invoices } = await client.listInvoices();
|
|
285
|
+
* for (const invoice of invoices) {
|
|
286
|
+
* console.log(invoice.number, invoice.status, invoice.total / 100);
|
|
287
|
+
* }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
async listInvoices() {
|
|
291
|
+
const response = await this.client.get('/invoices');
|
|
292
|
+
return response.data;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get a specific invoice by ID
|
|
296
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
297
|
+
*
|
|
298
|
+
* @param invoiceId - Stripe invoice ID (e.g., "in_1abc123")
|
|
299
|
+
* @returns Invoice details
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* const invoice = await client.getInvoice('in_1abc123');
|
|
304
|
+
* console.log(invoice.number); // "INV-0091"
|
|
305
|
+
* console.log(invoice.total / 100); // 9.99
|
|
306
|
+
* console.log(invoice.customerName); // "UAB Example"
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
async getInvoice(invoiceId) {
|
|
310
|
+
const response = await this.client.get(`/invoices/${invoiceId}`);
|
|
311
|
+
return response.data;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Download invoice in UBL XML format (Peppol BIS Billing 3.0)
|
|
315
|
+
* The UBL format is compliant with European e-invoicing standard EN 16931
|
|
316
|
+
* Note: Invoice requests do not count towards your monthly API quota
|
|
317
|
+
*
|
|
318
|
+
* @param invoiceId - Stripe invoice ID (e.g., "in_1abc123")
|
|
319
|
+
* @returns UBL XML string
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* const xml = await client.getInvoiceUbl('in_1abc123');
|
|
324
|
+
* // Save to file
|
|
325
|
+
* fs.writeFileSync('invoice.xml', xml);
|
|
326
|
+
*
|
|
327
|
+
* // Or parse for processing
|
|
328
|
+
* const parser = new DOMParser();
|
|
329
|
+
* const doc = parser.parseFromString(xml, 'text/xml');
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
async getInvoiceUbl(invoiceId) {
|
|
333
|
+
const response = await this.client.get(`/invoices/${invoiceId}/ubl`);
|
|
334
|
+
return response.data;
|
|
335
|
+
}
|
|
261
336
|
}
|
|
262
337
|
exports.JarsClient = JarsClient;
|
|
263
338
|
// Re-export types from @jars-lt/types for convenience
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAAyD;AAgJzD;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACR,UAAmB,EACnB,QAAc;QAErB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,aAAQ,GAAR,QAAQ,CAAM;QAGrB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AATD,oCASC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,UAAU;IAGrB,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,4BAA4B;YACvD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;YAChC,OAAO,EAAE;gBACP,WAAW,EAAE,MAAM,CAAC,MAAM;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;QAEH,wBAAwB;QACxB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CACnC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAsB,EAAE,EAAE;YACzB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,KAAK,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OAaG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC;QACjE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,SAAS,MAAM,CAAC,CAAC;QACrE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AArTD,gCAqTC;AAED,sDAAsD;AACtD,iDAA+B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jars-lt/sdk",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Official Node.js SDK for JARS.LT API - Lithuanian Company Registry",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Official Node.js SDK for JARS.LT API - Lithuanian and Estonian Company Registry",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -11,15 +11,11 @@
|
|
|
11
11
|
"require": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"dev": "tsc --watch",
|
|
17
|
-
"clean": "rm -rf dist",
|
|
18
|
-
"prepublishOnly": "pnpm build"
|
|
19
|
-
},
|
|
20
14
|
"keywords": [
|
|
21
15
|
"jars",
|
|
22
16
|
"lithuania",
|
|
17
|
+
"estonia",
|
|
18
|
+
"baltic",
|
|
23
19
|
"company-registry",
|
|
24
20
|
"api",
|
|
25
21
|
"sdk",
|
|
@@ -29,11 +25,16 @@
|
|
|
29
25
|
"license": "MIT",
|
|
30
26
|
"homepage": "https://jars.lt",
|
|
31
27
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
28
|
+
"axios": "^1.13.5",
|
|
29
|
+
"@jars-lt/types": "^1.1.0"
|
|
34
30
|
},
|
|
35
31
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^20.
|
|
32
|
+
"@types/node": "^20.19.33",
|
|
37
33
|
"typescript": "^5.3.3"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"dev": "tsc --watch",
|
|
38
|
+
"clean": "rm -rf dist"
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
+
}
|