tiime-sdk 2.1.1 → 2.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/dist/index.d.ts CHANGED
@@ -153,10 +153,16 @@ interface BankTransaction {
153
153
  status: string;
154
154
  status_code: string;
155
155
  comment: string | null;
156
- tags: unknown[];
156
+ tags: Tag[];
157
157
  short_bank_name: string;
158
- beneficiary: unknown | null;
159
- merchant: unknown | null;
158
+ beneficiary: {
159
+ id: number;
160
+ name: string;
161
+ } | null;
162
+ merchant: {
163
+ id: number;
164
+ name: string;
165
+ } | null;
160
166
  transfer_label: string | null;
161
167
  imputations: Imputation[];
162
168
  count_documents: number;
@@ -165,7 +171,9 @@ interface BankTransaction {
165
171
  interface BankTransactionsResponse {
166
172
  metadata: {
167
173
  has_multiple_cardholder: boolean;
168
- accountant_detail_request_data: unknown[];
174
+ accountant_detail_request_data: {
175
+ id: number;
176
+ }[];
169
177
  total_amount: number;
170
178
  };
171
179
  transactions: BankTransaction[];
@@ -218,7 +226,9 @@ interface InvoiceCreateParams {
218
226
  title?: string | null;
219
227
  title_enabled?: boolean;
220
228
  lines: InvoiceLine[];
221
- text_lines?: unknown[];
229
+ text_lines?: {
230
+ text: string;
231
+ }[];
222
232
  status?: "draft" | "saved";
223
233
  template?: string;
224
234
  free_field?: string;
@@ -246,7 +256,7 @@ interface Invoice {
246
256
  lines: InvoiceLine[];
247
257
  type: string;
248
258
  color: string;
249
- tags: unknown[];
259
+ tags: Tag[];
250
260
  totals_per_vat_type: Record<string, {
251
261
  total_excluding_taxes: number;
252
262
  vat_amount: number;
@@ -414,7 +424,11 @@ interface MatchableDocument {
414
424
  mime_type: string;
415
425
  name: string;
416
426
  type: string;
417
- metadata: Record<string, unknown>[];
427
+ metadata: {
428
+ date?: string | null;
429
+ amount?: number | null;
430
+ supplier_name?: string | null;
431
+ }[];
418
432
  created_at: string;
419
433
  tags: {
420
434
  id: number;
@@ -530,11 +544,11 @@ declare class CompanyResource {
530
544
  private companyId;
531
545
  constructor(fetch: $Fetch, companyId: number);
532
546
  get(): Promise<Company>;
533
- users(): Promise<any>;
534
- appConfig(): Promise<any>;
547
+ users(): Promise<unknown>;
548
+ appConfig(): Promise<unknown>;
535
549
  accountingPeriod(rangeYear?: number): Promise<AccountingPeriod>;
536
- tiles(keys: string[]): Promise<any>;
537
- dashboardBlocks(displayGroup?: string): Promise<any>;
550
+ tiles(keys: string[]): Promise<unknown>;
551
+ dashboardBlocks(displayGroup?: string): Promise<unknown>;
538
552
  }
539
553
 
540
554
  interface DocumentsListParams {
@@ -551,7 +565,7 @@ declare class DocumentsResource {
551
565
  constructor(fetch: $Fetch, companyId: number);
552
566
  list(params?: DocumentsListParams): Promise<Document[]>;
553
567
  categories(): Promise<DocumentCategory[]>;
554
- preview(documentId: number): Promise<any>;
568
+ preview(documentId: number): Promise<unknown>;
555
569
  upload(file: Uint8Array, filename: string, type?: string): Promise<Document>;
556
570
  searchMatchable(query: string): Promise<MatchableDocument[]>;
557
571
  download(documentId: number): Promise<ArrayBuffer>;
@@ -618,8 +632,8 @@ declare class UsersResource {
618
632
  private fetch;
619
633
  constructor(fetch: $Fetch);
620
634
  me(): Promise<User>;
621
- legalInformations(): Promise<any>;
622
- settings(companyId: number): Promise<any>;
635
+ legalInformations(): Promise<unknown>;
636
+ settings(companyId: number): Promise<unknown>;
623
637
  }
624
638
 
625
639
  declare class TiimeClient {
package/dist/index.js CHANGED
@@ -270,7 +270,8 @@ var BankTransactionsResource = class {
270
270
  list(params) {
271
271
  const start = ((params?.page ?? 1) - 1) * (params?.pageSize ?? 100);
272
272
  const end = start + (params?.pageSize ?? 100);
273
- const { page: _, pageSize: __, from, to, search, ...query } = params ?? {};
273
+ const { page: _, pageSize: __, from, to, search, ...rest } = params ?? {};
274
+ const query = { ...rest };
274
275
  if (from) query.transaction_date_start = from;
275
276
  if (to) query.transaction_date_end = to;
276
277
  if (search) query.wording = search;
@@ -569,7 +570,11 @@ var InvoicesResource = class {
569
570
  );
570
571
  }
571
572
  create(params) {
572
- const body = { ...DEFAULT_INVOICE_TEMPLATE, ...params };
573
+ const body = {
574
+ ...DEFAULT_INVOICE_TEMPLATE,
575
+ ...params,
576
+ lines: params.lines?.map((line) => ({ ...line }))
577
+ };
573
578
  for (const line of body.lines ?? []) {
574
579
  line.line_amount = line.quantity * line.unit_amount;
575
580
  line.sequence ??= 1;
@@ -679,7 +684,11 @@ var QuotationsResource = class {
679
684
  );
680
685
  }
681
686
  create(params) {
682
- for (const line of params.lines ?? []) {
687
+ const body = {
688
+ ...params,
689
+ lines: params.lines?.map((line) => ({ ...line }))
690
+ };
691
+ for (const line of body.lines ?? []) {
683
692
  line.line_amount = line.quantity * line.unit_amount;
684
693
  line.sequence ??= 1;
685
694
  line.invoicing_category_type ??= "benefit";
@@ -689,7 +698,7 @@ var QuotationsResource = class {
689
698
  }
690
699
  return this.fetch(`/companies/${this.companyId}/quotations`, {
691
700
  method: "POST",
692
- body: params
701
+ body
693
702
  });
694
703
  }
695
704
  async downloadPdf(quotationId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiime-sdk",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "TypeScript SDK for Tiime accounting API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",