@jars-lt/jars-app-sdk 0.1.0 → 0.2.1
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 +31 -3
- package/dist/index.cjs +473 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14390 -546
- package/dist/index.d.ts +14390 -546
- package/dist/index.js +456 -4
- package/dist/index.js.map +1 -1
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jars-lt/jars-app-sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for the [JARS Apskaita](https://app.jars.lt) accounting API — Lithuanian cloud accounting
|
|
3
|
+
Official TypeScript SDK for the [JARS Apskaita](https://app.jars.lt) accounting API — Lithuanian cloud accounting. Covers partners, products, invoices, journal entries and reports, plus cash registers & orders, bank transactions & statements, fixed assets & depreciation, employees & payroll, business trips, price lists, projects, professions, per-diem rates, numberings, exchange rates, and batch sales-receipt ingest from external POS/ERP systems.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -71,11 +71,27 @@ Every resource is reachable as a property on the client (`jars.partners`, `jars.
|
|
|
71
71
|
| ----------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
72
72
|
| `jars.partners` | `list` · `get` · `create` · `update` · `remove` |
|
|
73
73
|
| `jars.products` | `list` · `get` · `create` · `update` · `remove` |
|
|
74
|
-
| `jars.invoices` | `list` · `get` · `create` · `update` · `remove` · `post` · `unpost` · `cancel` · `setExternalStatus`
|
|
74
|
+
| `jars.invoices` | `list` · `get` · `create` · `update` · `remove` · `post` · `unpost` · `cancel` · `setExternalStatus` · `postingPreview` |
|
|
75
75
|
| `jars.journal` | `list` · `get` · `create` |
|
|
76
|
-
| `jars.reports` | `trialBalance` · `generalLedger` · `partnerBalance` · `cashBook` · `isafExport`
|
|
76
|
+
| `jars.reports` | `trialBalance` · `generalLedger` · `accountAnalytics` · `partnerBalance` · `employeeBalance` · `cashBook` · `financialStatements` · `isafExport` |
|
|
77
77
|
| `jars.auditLogs` | `list` · `get` |
|
|
78
78
|
| `jars.lookups` | `accounts` · `vatCodes` · `units` · `templates` (list-only) |
|
|
79
|
+
| `jars.cashRegisters` | `list` · `create` · `update` · `remove` |
|
|
80
|
+
| `jars.cashOrders` | `list` · `get` · `create` · `update` · `remove` · `post` · `unpost` · `fiscalize` · `setExternalStatus` |
|
|
81
|
+
| `jars.bankTransactions` | `list` · `get` · `create` · `update` · `setAllocations` · `post` · `unpost` · `setExternalStatus` |
|
|
82
|
+
| `jars.bankStatements` | `list` · `remove` · `detect` · `import` (file upload) |
|
|
83
|
+
| `jars.fixedAssets` | `list` · `get` · `create` · `update` · `remove` · `dispose` |
|
|
84
|
+
| `jars.depreciation` | `list` · `preview` · `post` · `unpost` |
|
|
85
|
+
| `jars.employees` | `list` · `get` · `create` · `update` · `remove` · `nextCode` · `verifyPin` |
|
|
86
|
+
| `jars.payroll` | `list` · `preview` · `post` · `unpost` |
|
|
87
|
+
| `jars.businessTrips` | `list` · `create` · `update` · `remove` · `postAdvance` · `postSettlement` · `unpost` |
|
|
88
|
+
| `jars.priceLists` | `list` · `get` · `create` · `update` · `remove` |
|
|
89
|
+
| `jars.projects` | `list` · `get` · `create` · `update` · `remove` |
|
|
90
|
+
| `jars.professions` | `list` · `get` · `create` · `update` · `remove` |
|
|
91
|
+
| `jars.perDiemRates` | `list` · `create` · `update` · `remove` |
|
|
92
|
+
| `jars.numberings` | `list` · `update` (by prefix) |
|
|
93
|
+
| `jars.exchangeRates` | `list` (read-only euro FX rates) |
|
|
94
|
+
| `jars.salesReceipts` | `ingest` (batch, external POS/ERP sales → CashOrder RECEIPT) |
|
|
79
95
|
|
|
80
96
|
### Method signatures
|
|
81
97
|
|
|
@@ -98,6 +114,18 @@ setExternalStatus<T = unknown>(id: string, externalStatus: string | null): Promi
|
|
|
98
114
|
trialBalance<T = unknown>(params?: ReportParams): Promise<T>
|
|
99
115
|
// lookups: list-only, e.g.
|
|
100
116
|
accounts<T = unknown[]>(params?: ListParams): Promise<T>
|
|
117
|
+
|
|
118
|
+
// document-lifecycle actions (cashOrders, bankTransactions, businessTrips, …)
|
|
119
|
+
post<T = unknown>(id: string): Promise<T>
|
|
120
|
+
unpost<T = unknown>(id: string): Promise<T>
|
|
121
|
+
// batch runs (payroll, depreciation)
|
|
122
|
+
preview<T = unknown>(body: Record<string, unknown>): Promise<T>
|
|
123
|
+
post<T = unknown>(body: Record<string, unknown>): Promise<T>
|
|
124
|
+
// bankStatements: multipart file upload (Blob/File)
|
|
125
|
+
detect<T = unknown>(file: Blob | File, filename?: string): Promise<T>
|
|
126
|
+
import<T = unknown>(file: Blob | File, fields?: Record<string, string>, filename?: string): Promise<T>
|
|
127
|
+
// salesReceipts: batch ingest, one result per item (positional with `items`)
|
|
128
|
+
ingest<T = unknown>(items: Record<string, unknown>[]): Promise<T>
|
|
101
129
|
```
|
|
102
130
|
|
|
103
131
|
### Not in the facade yet
|
package/dist/index.cjs
CHANGED
|
@@ -31,15 +31,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AuditLogsResource: () => AuditLogsResource,
|
|
34
|
+
BankStatementsResource: () => BankStatementsResource,
|
|
35
|
+
BankTransactionsResource: () => BankTransactionsResource,
|
|
36
|
+
BusinessTripsResource: () => BusinessTripsResource,
|
|
37
|
+
CashOrdersResource: () => CashOrdersResource,
|
|
38
|
+
CashRegistersResource: () => CashRegistersResource,
|
|
34
39
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
40
|
+
DepreciationResource: () => DepreciationResource,
|
|
41
|
+
EmployeesResource: () => EmployeesResource,
|
|
42
|
+
ExchangeRatesResource: () => ExchangeRatesResource,
|
|
43
|
+
FixedAssetsResource: () => FixedAssetsResource,
|
|
35
44
|
InvoicesResource: () => InvoicesResource,
|
|
36
45
|
JarsApiError: () => JarsApiError,
|
|
37
46
|
JarsClient: () => JarsClient,
|
|
38
47
|
JournalResource: () => JournalResource,
|
|
39
48
|
LookupsResource: () => LookupsResource,
|
|
49
|
+
NumberingsResource: () => NumberingsResource,
|
|
40
50
|
PartnersResource: () => PartnersResource,
|
|
51
|
+
PayrollResource: () => PayrollResource,
|
|
52
|
+
PerDiemRatesResource: () => PerDiemRatesResource,
|
|
53
|
+
PriceListsResource: () => PriceListsResource,
|
|
41
54
|
ProductsResource: () => ProductsResource,
|
|
42
|
-
|
|
55
|
+
ProfessionsResource: () => ProfessionsResource,
|
|
56
|
+
ProjectsResource: () => ProjectsResource,
|
|
57
|
+
ReportsResource: () => ReportsResource,
|
|
58
|
+
SalesReceiptsResource: () => SalesReceiptsResource
|
|
43
59
|
});
|
|
44
60
|
module.exports = __toCommonJS(index_exports);
|
|
45
61
|
|
|
@@ -145,6 +161,9 @@ var InvoicesResource = class {
|
|
|
145
161
|
body: { externalStatus }
|
|
146
162
|
});
|
|
147
163
|
}
|
|
164
|
+
postingPreview(id) {
|
|
165
|
+
return this.client.request("get", "/api/invoices/{id}/posting-preview", { params: { id } });
|
|
166
|
+
}
|
|
148
167
|
};
|
|
149
168
|
|
|
150
169
|
// src/resources/journal.ts
|
|
@@ -171,15 +190,50 @@ var ReportsResource = class {
|
|
|
171
190
|
trialBalance(params) {
|
|
172
191
|
return this.client.request("get", "/api/reports/trial-balance", { query: params });
|
|
173
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Chronological postings for one account. `from` and `to` are required;
|
|
195
|
+
* `account` is optional but omitting it asks for every account.
|
|
196
|
+
*
|
|
197
|
+
* Rejects with 400 `REPORT_TOO_BROAD` when the query would return more than
|
|
198
|
+
* 10,000 lines — the result is never truncated, because the caller computes a
|
|
199
|
+
* running balance across these lines. Narrow by account or by period.
|
|
200
|
+
*/
|
|
174
201
|
generalLedger(params) {
|
|
175
202
|
return this.client.request("get", "/api/reports/general-ledger", { query: params });
|
|
176
203
|
}
|
|
204
|
+
accountAnalytics(params) {
|
|
205
|
+
return this.client.request("get", "/api/reports/account-analytics", { query: params });
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Settlement balances per partner.
|
|
209
|
+
*
|
|
210
|
+
* Returns `{ rows, totals, rowCount, unfilteredRowCount, truncated }`.
|
|
211
|
+
* `totals` are computed over the full set — before the `nonZeroOnly` filter
|
|
212
|
+
* and before the row cap — so they tie out whatever `rows` contains.
|
|
213
|
+
*
|
|
214
|
+
* `nonZeroOnly` defaults to true: rows whose closing balance is zero are
|
|
215
|
+
* omitted. Pass `nonZeroOnly: false` for the complete list.
|
|
216
|
+
*/
|
|
177
217
|
partnerBalance(params) {
|
|
178
218
|
return this.client.request("get", "/api/reports/partner-balance", { query: params });
|
|
179
219
|
}
|
|
220
|
+
/** Salary/advance balances per employee. `from` and `to` are required. */
|
|
221
|
+
employeeBalance(params) {
|
|
222
|
+
return this.client.request("get", "/api/reports/employee-balance", { query: params });
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Cash book for one register: opening balance plus posted cash movements.
|
|
226
|
+
*
|
|
227
|
+
* Rejects with 400 `REPORT_TOO_BROAD` above 10,000 lines, for the same reason
|
|
228
|
+
* as `generalLedger`.
|
|
229
|
+
*/
|
|
180
230
|
cashBook(params) {
|
|
181
231
|
return this.client.request("get", "/api/reports/cash-book", { query: params });
|
|
182
232
|
}
|
|
233
|
+
/** Balance sheet + P&L. `year` is required; pass `to` for an interim period. */
|
|
234
|
+
financialStatements(params) {
|
|
235
|
+
return this.client.request("get", "/api/reports/financial-statements", { query: params });
|
|
236
|
+
}
|
|
183
237
|
isafExport(params) {
|
|
184
238
|
return this.client.request("get", "/api/reports/isaf-export", { query: params });
|
|
185
239
|
}
|
|
@@ -217,7 +271,368 @@ var LookupsResource = class {
|
|
|
217
271
|
}
|
|
218
272
|
};
|
|
219
273
|
|
|
274
|
+
// src/resources/cash-registers.ts
|
|
275
|
+
var CashRegistersResource = class {
|
|
276
|
+
constructor(client) {
|
|
277
|
+
this.client = client;
|
|
278
|
+
}
|
|
279
|
+
list(params) {
|
|
280
|
+
return this.client.request("get", "/api/cash-registers", { query: toQuery(params) });
|
|
281
|
+
}
|
|
282
|
+
create(body) {
|
|
283
|
+
return this.client.request("post", "/api/cash-registers", { body });
|
|
284
|
+
}
|
|
285
|
+
update(id, body) {
|
|
286
|
+
return this.client.request("put", "/api/cash-registers/{id}", { params: { id }, body });
|
|
287
|
+
}
|
|
288
|
+
remove(id) {
|
|
289
|
+
return this.client.request("delete", "/api/cash-registers/{id}", { params: { id } });
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// src/resources/projects.ts
|
|
294
|
+
var ProjectsResource = class {
|
|
295
|
+
constructor(client) {
|
|
296
|
+
this.client = client;
|
|
297
|
+
}
|
|
298
|
+
list(params) {
|
|
299
|
+
return this.client.request("get", "/api/projects", { query: toQuery(params) });
|
|
300
|
+
}
|
|
301
|
+
get(id) {
|
|
302
|
+
return this.client.request("get", "/api/projects/{id}", { params: { id } });
|
|
303
|
+
}
|
|
304
|
+
create(body) {
|
|
305
|
+
return this.client.request("post", "/api/projects", { body });
|
|
306
|
+
}
|
|
307
|
+
update(id, body) {
|
|
308
|
+
return this.client.request("put", "/api/projects/{id}", { params: { id }, body });
|
|
309
|
+
}
|
|
310
|
+
remove(id) {
|
|
311
|
+
return this.client.request("delete", "/api/projects/{id}", { params: { id } });
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/resources/professions.ts
|
|
316
|
+
var ProfessionsResource = class {
|
|
317
|
+
constructor(client) {
|
|
318
|
+
this.client = client;
|
|
319
|
+
}
|
|
320
|
+
list(params) {
|
|
321
|
+
return this.client.request("get", "/api/professions", { query: toQuery(params) });
|
|
322
|
+
}
|
|
323
|
+
get(id) {
|
|
324
|
+
return this.client.request("get", "/api/professions/{id}", { params: { id } });
|
|
325
|
+
}
|
|
326
|
+
create(body) {
|
|
327
|
+
return this.client.request("post", "/api/professions", { body });
|
|
328
|
+
}
|
|
329
|
+
update(id, body) {
|
|
330
|
+
return this.client.request("put", "/api/professions/{id}", { params: { id }, body });
|
|
331
|
+
}
|
|
332
|
+
remove(id) {
|
|
333
|
+
return this.client.request("delete", "/api/professions/{id}", { params: { id } });
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/resources/perdiem-rates.ts
|
|
338
|
+
var PerDiemRatesResource = class {
|
|
339
|
+
constructor(client) {
|
|
340
|
+
this.client = client;
|
|
341
|
+
}
|
|
342
|
+
list(params) {
|
|
343
|
+
return this.client.request("get", "/api/perdiem-rates", { query: toQuery(params) });
|
|
344
|
+
}
|
|
345
|
+
create(body) {
|
|
346
|
+
return this.client.request("post", "/api/perdiem-rates", { body });
|
|
347
|
+
}
|
|
348
|
+
update(id, body) {
|
|
349
|
+
return this.client.request("put", "/api/perdiem-rates/{id}", { params: { id }, body });
|
|
350
|
+
}
|
|
351
|
+
remove(id) {
|
|
352
|
+
return this.client.request("delete", "/api/perdiem-rates/{id}", { params: { id } });
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// src/resources/price-lists.ts
|
|
357
|
+
var PriceListsResource = class {
|
|
358
|
+
constructor(client) {
|
|
359
|
+
this.client = client;
|
|
360
|
+
}
|
|
361
|
+
list(params) {
|
|
362
|
+
return this.client.request("get", "/api/price-lists", { query: toQuery(params) });
|
|
363
|
+
}
|
|
364
|
+
get(id) {
|
|
365
|
+
return this.client.request("get", "/api/price-lists/{id}", { params: { id } });
|
|
366
|
+
}
|
|
367
|
+
create(body) {
|
|
368
|
+
return this.client.request("post", "/api/price-lists", { body });
|
|
369
|
+
}
|
|
370
|
+
update(id, body) {
|
|
371
|
+
return this.client.request("put", "/api/price-lists/{id}", { params: { id }, body });
|
|
372
|
+
}
|
|
373
|
+
remove(id) {
|
|
374
|
+
return this.client.request("delete", "/api/price-lists/{id}", { params: { id } });
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// src/resources/fixed-assets.ts
|
|
379
|
+
var FixedAssetsResource = class {
|
|
380
|
+
constructor(client) {
|
|
381
|
+
this.client = client;
|
|
382
|
+
}
|
|
383
|
+
list(params) {
|
|
384
|
+
return this.client.request("get", "/api/fixed-assets", { query: toQuery(params) });
|
|
385
|
+
}
|
|
386
|
+
get(id) {
|
|
387
|
+
return this.client.request("get", "/api/fixed-assets/{id}", { params: { id } });
|
|
388
|
+
}
|
|
389
|
+
create(body) {
|
|
390
|
+
return this.client.request("post", "/api/fixed-assets", { body });
|
|
391
|
+
}
|
|
392
|
+
update(id, body) {
|
|
393
|
+
return this.client.request("put", "/api/fixed-assets/{id}", { params: { id }, body });
|
|
394
|
+
}
|
|
395
|
+
remove(id) {
|
|
396
|
+
return this.client.request("delete", "/api/fixed-assets/{id}", { params: { id } });
|
|
397
|
+
}
|
|
398
|
+
dispose(id, body) {
|
|
399
|
+
return this.client.request("post", "/api/fixed-assets/{id}/dispose", { params: { id }, body });
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// src/resources/employees.ts
|
|
404
|
+
var EmployeesResource = class {
|
|
405
|
+
constructor(client) {
|
|
406
|
+
this.client = client;
|
|
407
|
+
}
|
|
408
|
+
list(params) {
|
|
409
|
+
return this.client.request("get", "/api/employees", { query: toQuery(params) });
|
|
410
|
+
}
|
|
411
|
+
get(id) {
|
|
412
|
+
return this.client.request("get", "/api/employees/{id}", { params: { id } });
|
|
413
|
+
}
|
|
414
|
+
create(body) {
|
|
415
|
+
return this.client.request("post", "/api/employees", { body });
|
|
416
|
+
}
|
|
417
|
+
update(id, body) {
|
|
418
|
+
return this.client.request("put", "/api/employees/{id}", { params: { id }, body });
|
|
419
|
+
}
|
|
420
|
+
remove(id) {
|
|
421
|
+
return this.client.request("delete", "/api/employees/{id}", { params: { id } });
|
|
422
|
+
}
|
|
423
|
+
nextCode() {
|
|
424
|
+
return this.client.request("get", "/api/employees/next-code");
|
|
425
|
+
}
|
|
426
|
+
verifyPin(body) {
|
|
427
|
+
return this.client.request("post", "/api/employees/verify-pin", { body });
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/resources/cash-orders.ts
|
|
432
|
+
var CashOrdersResource = class {
|
|
433
|
+
constructor(client) {
|
|
434
|
+
this.client = client;
|
|
435
|
+
}
|
|
436
|
+
list(params) {
|
|
437
|
+
return this.client.request("get", "/api/cash-orders", { query: toQuery(params) });
|
|
438
|
+
}
|
|
439
|
+
get(id) {
|
|
440
|
+
return this.client.request("get", "/api/cash-orders/{id}", { params: { id } });
|
|
441
|
+
}
|
|
442
|
+
create(body) {
|
|
443
|
+
return this.client.request("post", "/api/cash-orders", { body });
|
|
444
|
+
}
|
|
445
|
+
update(id, body) {
|
|
446
|
+
return this.client.request("put", "/api/cash-orders/{id}", { params: { id }, body });
|
|
447
|
+
}
|
|
448
|
+
remove(id) {
|
|
449
|
+
return this.client.request("delete", "/api/cash-orders/{id}", { params: { id } });
|
|
450
|
+
}
|
|
451
|
+
setExternalStatus(id, body) {
|
|
452
|
+
return this.client.request("patch", "/api/cash-orders/{id}/external-status", { params: { id }, body });
|
|
453
|
+
}
|
|
454
|
+
post(id) {
|
|
455
|
+
return this.client.request("post", "/api/cash-orders/{id}/post", { params: { id } });
|
|
456
|
+
}
|
|
457
|
+
unpost(id) {
|
|
458
|
+
return this.client.request("post", "/api/cash-orders/{id}/unpost", { params: { id } });
|
|
459
|
+
}
|
|
460
|
+
fiscalize(id, body) {
|
|
461
|
+
return this.client.request("post", "/api/cash-orders/{id}/fiscalize", { params: { id }, body: body ?? {} });
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// src/resources/bank-transactions.ts
|
|
466
|
+
var BankTransactionsResource = class {
|
|
467
|
+
constructor(client) {
|
|
468
|
+
this.client = client;
|
|
469
|
+
}
|
|
470
|
+
list(params) {
|
|
471
|
+
return this.client.request("get", "/api/bank-transactions", { query: toQuery(params) });
|
|
472
|
+
}
|
|
473
|
+
get(id) {
|
|
474
|
+
return this.client.request("get", "/api/bank-transactions/{id}", { params: { id } });
|
|
475
|
+
}
|
|
476
|
+
create(body) {
|
|
477
|
+
return this.client.request("post", "/api/bank-transactions", { body });
|
|
478
|
+
}
|
|
479
|
+
update(id, body) {
|
|
480
|
+
return this.client.request("put", "/api/bank-transactions/{id}", { params: { id }, body });
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Link the transaction to invoices (payment matching). Separate from `update`
|
|
484
|
+
* because it works at any status — `update` refuses a posted transaction,
|
|
485
|
+
* while allocations must stay editable after posting (a prepayment is posted
|
|
486
|
+
* before its invoice exists).
|
|
487
|
+
*/
|
|
488
|
+
setAllocations(id, body) {
|
|
489
|
+
return this.client.request("put", "/api/bank-transactions/{id}/allocations", { params: { id }, body });
|
|
490
|
+
}
|
|
491
|
+
setExternalStatus(id, body) {
|
|
492
|
+
return this.client.request("patch", "/api/bank-transactions/{id}/external-status", { params: { id }, body });
|
|
493
|
+
}
|
|
494
|
+
post(id) {
|
|
495
|
+
return this.client.request("post", "/api/bank-transactions/{id}/post", { params: { id } });
|
|
496
|
+
}
|
|
497
|
+
unpost(id) {
|
|
498
|
+
return this.client.request("post", "/api/bank-transactions/{id}/unpost", { params: { id } });
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
// src/resources/business-trips.ts
|
|
503
|
+
var BusinessTripsResource = class {
|
|
504
|
+
constructor(client) {
|
|
505
|
+
this.client = client;
|
|
506
|
+
}
|
|
507
|
+
list(params) {
|
|
508
|
+
return this.client.request("get", "/api/business-trips", { query: toQuery(params) });
|
|
509
|
+
}
|
|
510
|
+
create(body) {
|
|
511
|
+
return this.client.request("post", "/api/business-trips", { body });
|
|
512
|
+
}
|
|
513
|
+
update(id, body) {
|
|
514
|
+
return this.client.request("put", "/api/business-trips/{id}", { params: { id }, body });
|
|
515
|
+
}
|
|
516
|
+
remove(id) {
|
|
517
|
+
return this.client.request("delete", "/api/business-trips/{id}", { params: { id } });
|
|
518
|
+
}
|
|
519
|
+
postAdvance(id) {
|
|
520
|
+
return this.client.request("post", "/api/business-trips/{id}/post-advance", { params: { id } });
|
|
521
|
+
}
|
|
522
|
+
postSettlement(id) {
|
|
523
|
+
return this.client.request("post", "/api/business-trips/{id}/post-settlement", { params: { id } });
|
|
524
|
+
}
|
|
525
|
+
unpost(id) {
|
|
526
|
+
return this.client.request("post", "/api/business-trips/{id}/unpost", { params: { id } });
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
// src/resources/payroll.ts
|
|
531
|
+
var PayrollResource = class {
|
|
532
|
+
constructor(client) {
|
|
533
|
+
this.client = client;
|
|
534
|
+
}
|
|
535
|
+
list(params) {
|
|
536
|
+
return this.client.request("get", "/api/payroll", { query: toQuery(params) });
|
|
537
|
+
}
|
|
538
|
+
preview(body) {
|
|
539
|
+
return this.client.request("post", "/api/payroll/preview", { body });
|
|
540
|
+
}
|
|
541
|
+
post(body) {
|
|
542
|
+
return this.client.request("post", "/api/payroll/post", { body });
|
|
543
|
+
}
|
|
544
|
+
unpost(id) {
|
|
545
|
+
return this.client.request("post", "/api/payroll/{id}/unpost", { params: { id } });
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// src/resources/depreciation.ts
|
|
550
|
+
var DepreciationResource = class {
|
|
551
|
+
constructor(client) {
|
|
552
|
+
this.client = client;
|
|
553
|
+
}
|
|
554
|
+
list(params) {
|
|
555
|
+
return this.client.request("get", "/api/depreciation", { query: toQuery(params) });
|
|
556
|
+
}
|
|
557
|
+
preview(body) {
|
|
558
|
+
return this.client.request("post", "/api/depreciation/preview", { body });
|
|
559
|
+
}
|
|
560
|
+
post(body) {
|
|
561
|
+
return this.client.request("post", "/api/depreciation/post", { body });
|
|
562
|
+
}
|
|
563
|
+
unpost(id) {
|
|
564
|
+
return this.client.request("post", "/api/depreciation/{id}/unpost", { params: { id } });
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// src/resources/numberings.ts
|
|
569
|
+
var NumberingsResource = class {
|
|
570
|
+
constructor(client) {
|
|
571
|
+
this.client = client;
|
|
572
|
+
}
|
|
573
|
+
list(params) {
|
|
574
|
+
return this.client.request("get", "/api/numberings", { query: toQuery(params) });
|
|
575
|
+
}
|
|
576
|
+
update(prefix, body) {
|
|
577
|
+
return this.client.request("put", "/api/numberings/{prefix}", { params: { prefix }, body });
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
// src/resources/exchange-rates.ts
|
|
582
|
+
var ExchangeRatesResource = class {
|
|
583
|
+
constructor(client) {
|
|
584
|
+
this.client = client;
|
|
585
|
+
}
|
|
586
|
+
list(params) {
|
|
587
|
+
return this.client.request("get", "/api/exchange-rates", { query: toQuery(params) });
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
// src/resources/bank-statements.ts
|
|
592
|
+
var BankStatementsResource = class {
|
|
593
|
+
constructor(client) {
|
|
594
|
+
this.client = client;
|
|
595
|
+
}
|
|
596
|
+
list(params) {
|
|
597
|
+
return this.client.request("get", "/api/bank-statements", { query: toQuery(params) });
|
|
598
|
+
}
|
|
599
|
+
remove(id) {
|
|
600
|
+
return this.client.request("delete", "/api/bank-statements/{id}", { params: { id } });
|
|
601
|
+
}
|
|
602
|
+
detect(file, filename) {
|
|
603
|
+
const fd = new FormData();
|
|
604
|
+
fd.append("file", file, filename);
|
|
605
|
+
return this.client.request("post", "/api/bank-statements/detect", { body: fd });
|
|
606
|
+
}
|
|
607
|
+
import(file, fields, filename) {
|
|
608
|
+
const fd = new FormData();
|
|
609
|
+
fd.append("file", file, filename);
|
|
610
|
+
if (fields) {
|
|
611
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
612
|
+
fd.append(key, value);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return this.client.request("post", "/api/bank-statements/import", { body: fd });
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// src/resources/sales-receipts.ts
|
|
620
|
+
var SalesReceiptsResource = class {
|
|
621
|
+
constructor(client) {
|
|
622
|
+
this.client = client;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Books a batch of external sales as CashOrder RECEIPT (DRAFT) documents.
|
|
626
|
+
* Returns `{ results: [...] }`, one entry per item — `'created' | 'duplicate' | 'error'` —
|
|
627
|
+
* positional with `items`.
|
|
628
|
+
*/
|
|
629
|
+
ingest(items) {
|
|
630
|
+
return this.client.request("post", "/api/sales/receipts", { body: { items } });
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
220
634
|
// src/client.ts
|
|
635
|
+
var createClient = typeof import_openapi_fetch.default === "function" ? import_openapi_fetch.default : import_openapi_fetch.default.default;
|
|
221
636
|
var DEFAULT_BASE_URL = "https://app.jars.lt";
|
|
222
637
|
function safeJson(text) {
|
|
223
638
|
try {
|
|
@@ -236,6 +651,22 @@ var JarsClient = class {
|
|
|
236
651
|
reports;
|
|
237
652
|
auditLogs;
|
|
238
653
|
lookups;
|
|
654
|
+
cashRegisters;
|
|
655
|
+
projects;
|
|
656
|
+
professions;
|
|
657
|
+
perDiemRates;
|
|
658
|
+
priceLists;
|
|
659
|
+
fixedAssets;
|
|
660
|
+
employees;
|
|
661
|
+
cashOrders;
|
|
662
|
+
bankTransactions;
|
|
663
|
+
businessTrips;
|
|
664
|
+
payroll;
|
|
665
|
+
depreciation;
|
|
666
|
+
numberings;
|
|
667
|
+
exchangeRates;
|
|
668
|
+
bankStatements;
|
|
669
|
+
salesReceipts;
|
|
239
670
|
baseUrl;
|
|
240
671
|
authHeader;
|
|
241
672
|
fetchImpl;
|
|
@@ -244,7 +675,7 @@ var JarsClient = class {
|
|
|
244
675
|
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
245
676
|
this.authHeader = `Bearer ${config.apiKey}`;
|
|
246
677
|
this.fetchImpl = config.fetch ?? fetch;
|
|
247
|
-
this.raw = (
|
|
678
|
+
this.raw = createClient({
|
|
248
679
|
baseUrl: this.baseUrl,
|
|
249
680
|
fetch: this.fetchImpl,
|
|
250
681
|
headers: { Authorization: this.authHeader }
|
|
@@ -256,6 +687,22 @@ var JarsClient = class {
|
|
|
256
687
|
this.reports = new ReportsResource(this);
|
|
257
688
|
this.auditLogs = new AuditLogsResource(this);
|
|
258
689
|
this.lookups = new LookupsResource(this);
|
|
690
|
+
this.cashRegisters = new CashRegistersResource(this);
|
|
691
|
+
this.projects = new ProjectsResource(this);
|
|
692
|
+
this.professions = new ProfessionsResource(this);
|
|
693
|
+
this.perDiemRates = new PerDiemRatesResource(this);
|
|
694
|
+
this.priceLists = new PriceListsResource(this);
|
|
695
|
+
this.fixedAssets = new FixedAssetsResource(this);
|
|
696
|
+
this.employees = new EmployeesResource(this);
|
|
697
|
+
this.cashOrders = new CashOrdersResource(this);
|
|
698
|
+
this.bankTransactions = new BankTransactionsResource(this);
|
|
699
|
+
this.businessTrips = new BusinessTripsResource(this);
|
|
700
|
+
this.payroll = new PayrollResource(this);
|
|
701
|
+
this.depreciation = new DepreciationResource(this);
|
|
702
|
+
this.numberings = new NumberingsResource(this);
|
|
703
|
+
this.exchangeRates = new ExchangeRatesResource(this);
|
|
704
|
+
this.bankStatements = new BankStatementsResource(this);
|
|
705
|
+
this.salesReceipts = new SalesReceiptsResource(this);
|
|
259
706
|
}
|
|
260
707
|
async request(method, path, opts = {}) {
|
|
261
708
|
const finalPath = opts.params ? path.replace(/\{([^}]+)\}/g, (_, key) => {
|
|
@@ -271,8 +718,13 @@ var JarsClient = class {
|
|
|
271
718
|
const headers = new Headers({ Authorization: this.authHeader });
|
|
272
719
|
let body;
|
|
273
720
|
if (opts.body !== void 0) {
|
|
274
|
-
|
|
275
|
-
|
|
721
|
+
const isForm = typeof FormData !== "undefined" && opts.body instanceof FormData;
|
|
722
|
+
if (isForm) {
|
|
723
|
+
body = opts.body;
|
|
724
|
+
} else {
|
|
725
|
+
headers.set("content-type", "application/json");
|
|
726
|
+
body = JSON.stringify(opts.body);
|
|
727
|
+
}
|
|
276
728
|
}
|
|
277
729
|
let res;
|
|
278
730
|
try {
|
|
@@ -300,14 +752,30 @@ var JarsClient = class {
|
|
|
300
752
|
// Annotate the CommonJS export names for ESM import in node:
|
|
301
753
|
0 && (module.exports = {
|
|
302
754
|
AuditLogsResource,
|
|
755
|
+
BankStatementsResource,
|
|
756
|
+
BankTransactionsResource,
|
|
757
|
+
BusinessTripsResource,
|
|
758
|
+
CashOrdersResource,
|
|
759
|
+
CashRegistersResource,
|
|
303
760
|
DEFAULT_BASE_URL,
|
|
761
|
+
DepreciationResource,
|
|
762
|
+
EmployeesResource,
|
|
763
|
+
ExchangeRatesResource,
|
|
764
|
+
FixedAssetsResource,
|
|
304
765
|
InvoicesResource,
|
|
305
766
|
JarsApiError,
|
|
306
767
|
JarsClient,
|
|
307
768
|
JournalResource,
|
|
308
769
|
LookupsResource,
|
|
770
|
+
NumberingsResource,
|
|
309
771
|
PartnersResource,
|
|
772
|
+
PayrollResource,
|
|
773
|
+
PerDiemRatesResource,
|
|
774
|
+
PriceListsResource,
|
|
310
775
|
ProductsResource,
|
|
311
|
-
|
|
776
|
+
ProfessionsResource,
|
|
777
|
+
ProjectsResource,
|
|
778
|
+
ReportsResource,
|
|
779
|
+
SalesReceiptsResource
|
|
312
780
|
});
|
|
313
781
|
//# sourceMappingURL=index.cjs.map
|