starta.apiclient 1.37.6465 → 1.37.6565

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.
@@ -1,4 +1,4 @@
1
- import { ProductOperation, StartaRequestRunner } from '../../types';
1
+ import { ProductOperation, StartaRequestRunner, TechcardSteps } from '../../types';
2
2
  export default class ProductOperations {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
@@ -9,12 +9,20 @@ export default class ProductOperations {
9
9
  from?: string;
10
10
  to?: string;
11
11
  };
12
- operationType?: 'writeOff' | 'receiving';
12
+ operationType?: 'writeOff' | 'receiving' | 'sell';
13
13
  warehouseId?: string;
14
14
  paymentStatus?: 'paid' | 'unpaid';
15
15
  };
16
16
  }): Promise<import("../../types").StartaResponse>;
17
17
  add(organizationLogin: string, { date, type, supplier, warehouseId, products, isPaid, comment, }: ProductOperation): Promise<import("../../types").StartaResponse>;
18
+ prepare(organizationLogin: string, { productId, quantityForSale, steps, warehouseId, executor, date, }: {
19
+ productId: string;
20
+ quantityForSale: number;
21
+ steps: TechcardSteps;
22
+ warehouseId: string;
23
+ executor: string;
24
+ date: string;
25
+ }): Promise<import("../../types").StartaResponse>;
18
26
  transfer(organizationLogin: string, { date, fromWarehouseId, toWarehouseId, products, }: {
19
27
  organizationLogin: string;
20
28
  date: string;
@@ -29,6 +29,20 @@ class ProductOperations {
29
29
  },
30
30
  });
31
31
  }
32
+ prepare(organizationLogin, { productId, quantityForSale, steps, warehouseId, executor, date, }) {
33
+ return this._requestRunner.performRequest({
34
+ url: `accounts/${organizationLogin}/productOperations/prepare`,
35
+ method: 'POST',
36
+ body: {
37
+ productId,
38
+ quantityForSale,
39
+ steps,
40
+ warehouseId,
41
+ executor,
42
+ date,
43
+ },
44
+ });
45
+ }
32
46
  transfer(organizationLogin, { date, fromWarehouseId, toWarehouseId, products, }) {
33
47
  return this._requestRunner.performRequest({
34
48
  url: `accounts/${organizationLogin}/productOperations/transfer`,
@@ -2,9 +2,10 @@ import { Product, StartaRequestRunner } from '../../types';
2
2
  export default class Products {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
- index(organizationLogin: string, { categoryId, searchQuery, }?: {
5
+ index(organizationLogin: string, { categoryId, searchQuery, withTechcard, }?: {
6
6
  categoryId?: string;
7
7
  searchQuery?: string;
8
+ withTechcard?: boolean;
8
9
  }): Promise<import("../../types").StartaResponse>;
9
10
  add(organizationLogin: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, }: Product): Promise<import("../../types").StartaResponse>;
10
11
  update(organizationLogin: string, productId: string, { name, sku, category, categoryId, forSale, equals, forDisposal, netWeight, grossWeight, sellPrice, costPrice, criticalStock, desiredStock, }: Product): Promise<import("../../types").StartaResponse>;
@@ -5,9 +5,9 @@ class Products {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
8
- index(organizationLogin, { categoryId, searchQuery, } = {}) {
8
+ index(organizationLogin, { categoryId, searchQuery, withTechcard, } = {}) {
9
9
  return this._requestRunner.performRequest({
10
- url: `accounts/${organizationLogin}/products${(0, _helpers_1.buildQuery)({ categoryId, searchQuery })}`,
10
+ url: `accounts/${organizationLogin}/products${(0, _helpers_1.buildQuery)({ categoryId, searchQuery, withTechcard })}`,
11
11
  method: 'GET',
12
12
  });
13
13
  }
@@ -1,52 +1,41 @@
1
- import { StartaRequestRunner } from '../../types';
1
+ import { StartaRequestRunner, TechcardSteps, TechcardType } from '../../types';
2
2
  export default class Techcards {
3
3
  private _requestRunner;
4
4
  constructor(requestRunner: StartaRequestRunner);
5
- add(organizationLogin: string, { name, isEnabled, autoAttach, serviceIds, customerIds, executors, steps, }: {
5
+ add(organizationLogin: string, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, }: {
6
6
  name: string;
7
7
  isEnabled: boolean;
8
- autoAttach: boolean;
9
- serviceIds: Array<string>;
10
- customerIds: Array<string>;
11
- executors: Array<string>;
12
- steps?: Array<{
13
- name: string;
14
- items?: Array<{
15
- type: 'product';
16
- warehouseId: string;
17
- productId: string;
18
- amount: number;
19
- } | {
20
- type: 'comment';
21
- comment: string;
22
- }>;
8
+ type: TechcardType;
9
+ products?: Array<{
10
+ id: any;
11
+ quantityForSale: any;
23
12
  }>;
13
+ autoAttach?: boolean;
14
+ serviceIds?: Array<string>;
15
+ customerIds?: Array<string>;
16
+ executors: Array<string>;
17
+ steps?: TechcardSteps;
24
18
  }): Promise<import("../../types").StartaResponse>;
25
- index(organizationLogin: string, { customerId, serviceId, executor, isEnabled, }?: {
19
+ index(organizationLogin: string, { customerId, serviceId, executor, isEnabled, type, }?: {
26
20
  customerId?: string;
27
21
  serviceId?: string;
28
22
  executor?: string;
29
23
  isEnabled?: boolean;
24
+ type?: TechcardType;
30
25
  }): Promise<import("../../types").StartaResponse>;
31
- update(organizationLogin: string, techcardId: string, { name, isEnabled, autoAttach, serviceIds, customerIds, executors, steps, }: {
32
- name?: string;
33
- isEnabled?: boolean;
26
+ update(organizationLogin: string, techcardId: string, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, }: {
27
+ name: string;
28
+ isEnabled: boolean;
29
+ type: TechcardType;
30
+ products?: Array<{
31
+ id: any;
32
+ quantityForSale: any;
33
+ }>;
34
34
  autoAttach?: boolean;
35
35
  serviceIds?: Array<string>;
36
36
  customerIds?: Array<string>;
37
37
  executors?: Array<string>;
38
- steps?: Array<{
39
- name: string;
40
- items?: Array<{
41
- type: 'product';
42
- warehouseId: string;
43
- productId: string;
44
- amount: number;
45
- } | {
46
- type: 'comment';
47
- comment: string;
48
- }>;
49
- }>;
38
+ steps?: TechcardSteps;
50
39
  }): Promise<import("../../types").StartaResponse>;
51
40
  delete(organizationLogin: string, techcardId: string): Promise<import("../../types").StartaResponse>;
52
41
  }
@@ -5,13 +5,15 @@ class Techcards {
5
5
  constructor(requestRunner) {
6
6
  this._requestRunner = requestRunner;
7
7
  }
8
- add(organizationLogin, { name, isEnabled, autoAttach, serviceIds, customerIds, executors, steps, }) {
8
+ add(organizationLogin, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, }) {
9
9
  return this._requestRunner.performRequest({
10
10
  url: `accounts/${organizationLogin}/techcards`,
11
11
  method: 'POST',
12
12
  body: {
13
13
  name,
14
14
  isEnabled,
15
+ type,
16
+ products,
15
17
  autoAttach,
16
18
  serviceIds,
17
19
  customerIds,
@@ -20,19 +22,21 @@ class Techcards {
20
22
  },
21
23
  });
22
24
  }
23
- index(organizationLogin, { customerId, serviceId, executor, isEnabled, } = {}) {
25
+ index(organizationLogin, { customerId, serviceId, executor, isEnabled, type, } = {}) {
24
26
  return this._requestRunner.performRequest({
25
- url: `accounts/${organizationLogin}/techcards${(0, _helpers_1.buildQuery)({ customerId, serviceId, executor, isEnabled })}`,
27
+ url: `accounts/${organizationLogin}/techcards${(0, _helpers_1.buildQuery)({ customerId, serviceId, executor, isEnabled, type })}`,
26
28
  method: 'GET',
27
29
  });
28
30
  }
29
- update(organizationLogin, techcardId, { name, isEnabled, autoAttach, serviceIds, customerIds, executors, steps, }) {
31
+ update(organizationLogin, techcardId, { name, isEnabled, type, products, autoAttach, serviceIds, customerIds, executors, steps, }) {
30
32
  return this._requestRunner.performRequest({
31
33
  url: `accounts/${organizationLogin}/techcards/${techcardId}`,
32
34
  method: 'PUT',
33
35
  body: {
34
36
  name,
35
37
  isEnabled,
38
+ type,
39
+ products,
36
40
  autoAttach,
37
41
  serviceIds,
38
42
  customerIds,
package/lib/types.d.ts CHANGED
@@ -139,3 +139,16 @@ export type OrderRepeatSettings = {
139
139
  value?: Date | number;
140
140
  };
141
141
  };
142
+ export type TechcardType = 'service' | 'product';
143
+ export type TechcardSteps = Array<{
144
+ name: string;
145
+ items?: Array<{
146
+ type: 'product';
147
+ warehouseId: string;
148
+ productId: string;
149
+ amount: number;
150
+ } | {
151
+ type: 'comment';
152
+ comment: string;
153
+ }>;
154
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starta.apiclient",
3
- "version": "1.37.6465",
3
+ "version": "1.37.6565",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Wrapper for starta.one api",
6
6
  "author": "Collaboracia OÜ",