repzo 1.0.267 → 1.0.268
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/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/types/index.d.ts +147 -0
- package/lib/types/report-type.d.ts +207 -0
- package/lib/types/report-type.js +1 -0
- package/package.json +1 -1
- package/src/index.ts +13 -0
- package/src/types/index.ts +204 -0
- package/src/types/report-type.ts +503 -0
package/lib/index.d.ts
CHANGED
|
@@ -1045,6 +1045,7 @@ export default class Repzo {
|
|
|
1045
1045
|
salesAnalyticsReport: {
|
|
1046
1046
|
_path: "sales-analytics-report";
|
|
1047
1047
|
find: (params?: Service.SalesAnalyticsReport.Find.Params) => Promise<Service.SalesAnalyticsReport.Find.Result>;
|
|
1048
|
+
create: (body: Service.SalesAnalyticsReport.CreateBody, params?: Service.SalesAnalyticsReport.Create.Params) => Promise<Service.SalesAnalyticsReport.Create.Result>;
|
|
1048
1049
|
};
|
|
1049
1050
|
workorderAgenda: {
|
|
1050
1051
|
_path: "workorder-agenda";
|
package/lib/index.js
CHANGED
|
@@ -2028,6 +2028,10 @@ class Repzo {
|
|
|
2028
2028
|
let res = await this._fetch(this.svAPIEndpoint, this.salesAnalyticsReport._path, params);
|
|
2029
2029
|
return res;
|
|
2030
2030
|
},
|
|
2031
|
+
create: async (body, params) => {
|
|
2032
|
+
let res = await this._create(this.svAPIEndpoint, this.salesAnalyticsReport._path, body, params);
|
|
2033
|
+
return res;
|
|
2034
|
+
},
|
|
2031
2035
|
};
|
|
2032
2036
|
this.workorderAgenda = {
|
|
2033
2037
|
_path: Repzo._end_points.WORKORDER_AGENDA,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EndPoints } from "../index.js";
|
|
2
|
+
import { SalesAnalyticsFieldAccumulators, SalesAnalyticsReportProjectionKey, SalesAnalyticsReportFilter, SalesAnalyticsGroupByIDs, SalesAnalyticsReportSortedKey } from "./report-type.js";
|
|
2
3
|
export interface Params {
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
}
|
|
@@ -17,6 +18,80 @@ export interface Options {
|
|
|
17
18
|
refresh_token?: string;
|
|
18
19
|
reauthCallBackFn?: (res: Service.Reauth.Result) => void;
|
|
19
20
|
}
|
|
21
|
+
interface ReportColumn {
|
|
22
|
+
_id?: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
report_types: ReportType[];
|
|
27
|
+
default_show: boolean;
|
|
28
|
+
selectable: boolean;
|
|
29
|
+
position: number;
|
|
30
|
+
show: "default" | "hide" | "show";
|
|
31
|
+
column_group?: StringId | string;
|
|
32
|
+
totals_key?: string;
|
|
33
|
+
createdAt?: Date;
|
|
34
|
+
updatedAt?: Date;
|
|
35
|
+
}
|
|
36
|
+
type QueryCriteriaCondition = {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
type QueryCriteriaValue = boolean | string | number | QueryCriteriaElement | QueryCriteriaLogical | null | Date;
|
|
40
|
+
type LogicalOperators = "and" | "or";
|
|
41
|
+
export type QueryCriteriaOperators = "gt" | "lt" | "gte" | "lte" | "in" | "nin" | "eq" | "between" | "last_seven_days" | "today" | "yesterday" | "last_thirty_days" | "last_month" | "last_three_months" | "last_six_months" | "last_twelve_months";
|
|
42
|
+
type QueryCriteriaElement = {
|
|
43
|
+
key: string;
|
|
44
|
+
operator: QueryCriteriaOperators;
|
|
45
|
+
value: QueryCriteriaValue;
|
|
46
|
+
conditions?: QueryCriteriaCondition[];
|
|
47
|
+
};
|
|
48
|
+
type QueryCriteriaLogical = {
|
|
49
|
+
operator: LogicalOperators;
|
|
50
|
+
value: QueryCriteriaValue[];
|
|
51
|
+
};
|
|
52
|
+
type BaseKey = string;
|
|
53
|
+
type BaseValue = any;
|
|
54
|
+
type FilterMap = SalesAnalyticsReportFilter;
|
|
55
|
+
type GroupByKeys = SalesAnalyticsGroupByIDs;
|
|
56
|
+
type FieldAccumulators = SalesAnalyticsFieldAccumulators;
|
|
57
|
+
type SortValue<Keys extends BaseKey> = {
|
|
58
|
+
field: Keys;
|
|
59
|
+
type: "asc" | "desc" | -1 | 1;
|
|
60
|
+
};
|
|
61
|
+
interface EnhancedQueryCriteriaElement<TKeys extends keyof FilterMap, TValue extends BaseValue = QueryCriteriaValue, TCondition = QueryCriteriaCondition> {
|
|
62
|
+
key: TKeys;
|
|
63
|
+
operator: FilterMap[TKeys][number];
|
|
64
|
+
value: TValue;
|
|
65
|
+
conditions?: TCondition[];
|
|
66
|
+
}
|
|
67
|
+
type GroupByType<TGroupID extends keyof GroupByKeys, TFieldAccumulators> = {
|
|
68
|
+
_id: TGroupID;
|
|
69
|
+
fields: {
|
|
70
|
+
[K in GroupByKeys[TGroupID]]: {
|
|
71
|
+
key: K;
|
|
72
|
+
acc: K extends keyof TFieldAccumulators ? TFieldAccumulators[K] : never;
|
|
73
|
+
};
|
|
74
|
+
}[GroupByKeys[TGroupID]][];
|
|
75
|
+
};
|
|
76
|
+
interface GenericQuery<TSortKey extends BaseKey, TFilterMap extends FilterMap, TGroupKey extends GroupByKeys, TFieldAccumulators extends FieldAccumulators, TProjectionKeys extends BaseKey, TMaxAnyOfLength extends number = 1> {
|
|
77
|
+
maxAnyOfLength: TMaxAnyOfLength;
|
|
78
|
+
anyOf: {
|
|
79
|
+
criteria: {
|
|
80
|
+
[K in keyof TFilterMap]: EnhancedQueryCriteriaElement<K & keyof FilterMap>;
|
|
81
|
+
}[keyof TFilterMap][];
|
|
82
|
+
}[];
|
|
83
|
+
options?: {
|
|
84
|
+
sort?: SortValue<TSortKey>[];
|
|
85
|
+
limit?: number;
|
|
86
|
+
page?: number;
|
|
87
|
+
totals_summary?: "none" | "all" | "page";
|
|
88
|
+
without_currency?: boolean;
|
|
89
|
+
};
|
|
90
|
+
group?: GroupByType<keyof TGroupKey & keyof GroupByKeys, TFieldAccumulators>[];
|
|
91
|
+
projection?: TProjectionKeys[];
|
|
92
|
+
columns?: ReportColumn[];
|
|
93
|
+
metadata?: any;
|
|
94
|
+
}
|
|
20
95
|
export interface Headers {
|
|
21
96
|
"api-key": string;
|
|
22
97
|
"Content-Type": string;
|
|
@@ -174,6 +249,8 @@ export interface DefaultPaginationResult {
|
|
|
174
249
|
prev_page_url: string | null;
|
|
175
250
|
path: string;
|
|
176
251
|
data: any[];
|
|
252
|
+
columns?: ReportColumn[];
|
|
253
|
+
keys?: ReportKey[];
|
|
177
254
|
}
|
|
178
255
|
export interface AgendaPaginationResult extends DefaultPaginationResult {
|
|
179
256
|
meta?: {
|
|
@@ -15297,6 +15374,7 @@ export declare namespace Service {
|
|
|
15297
15374
|
_id?: string;
|
|
15298
15375
|
[key: string]: any;
|
|
15299
15376
|
}
|
|
15377
|
+
type CreateBody = GenericQuery<SalesAnalyticsReportSortedKey, SalesAnalyticsReportFilter, SalesAnalyticsGroupByIDs, SalesAnalyticsFieldAccumulators, SalesAnalyticsReportProjectionKey, 1>;
|
|
15300
15378
|
namespace Find {
|
|
15301
15379
|
type Params = DefaultPaginationQueryParams & {
|
|
15302
15380
|
from_issue_date?: string;
|
|
@@ -15363,6 +15441,75 @@ export declare namespace Service {
|
|
|
15363
15441
|
data: Data[];
|
|
15364
15442
|
}
|
|
15365
15443
|
}
|
|
15444
|
+
namespace Create {
|
|
15445
|
+
type Params = DefaultPaginationQueryParams & {
|
|
15446
|
+
from_issue_date?: string;
|
|
15447
|
+
to_issue_date?: string;
|
|
15448
|
+
from_due_date?: string;
|
|
15449
|
+
to_due_date?: string;
|
|
15450
|
+
from_createdAt?: string;
|
|
15451
|
+
to_createdAt?: string;
|
|
15452
|
+
from_updatedAt?: string;
|
|
15453
|
+
to_updatedAt?: string;
|
|
15454
|
+
client?: StringId | StringId[];
|
|
15455
|
+
rep?: StringId | StringId[];
|
|
15456
|
+
creator?: StringId | StringId[];
|
|
15457
|
+
teams?: StringId | StringId[];
|
|
15458
|
+
status?: StatusOption | StatusOption[];
|
|
15459
|
+
promotion?: StringId | StringId[];
|
|
15460
|
+
product?: StringId | StringId[];
|
|
15461
|
+
variant?: StringId | StringId[];
|
|
15462
|
+
category?: StringId | StringId[];
|
|
15463
|
+
sub_category?: StringId | StringId[];
|
|
15464
|
+
brand?: StringId | StringId[];
|
|
15465
|
+
product_groups?: StringId | StringId[];
|
|
15466
|
+
class?: ClassOption | ClassOption[];
|
|
15467
|
+
with_brand?: boolean;
|
|
15468
|
+
with_category?: boolean;
|
|
15469
|
+
with_product_groups?: boolean;
|
|
15470
|
+
with_sub_category?: boolean;
|
|
15471
|
+
with_product_details?: boolean;
|
|
15472
|
+
with_variant_details?: boolean;
|
|
15473
|
+
with_teams?: boolean;
|
|
15474
|
+
with_promotions?: boolean;
|
|
15475
|
+
promotion_type?: PromotionTypeOption;
|
|
15476
|
+
with_balance?: boolean;
|
|
15477
|
+
groupBy?: GroupByOption | GroupByOption[];
|
|
15478
|
+
from_price?: number;
|
|
15479
|
+
to_price?: number;
|
|
15480
|
+
export?: string;
|
|
15481
|
+
chain?: StringId | StringId[];
|
|
15482
|
+
channel?: StringId | StringId[];
|
|
15483
|
+
CLIENT_TAGS?: StringId | StringId[];
|
|
15484
|
+
AREA_TAGS?: StringId | StringId[];
|
|
15485
|
+
tags?: StringId | StringId[];
|
|
15486
|
+
country?: string | string[];
|
|
15487
|
+
state?: string | string[];
|
|
15488
|
+
city?: string | string[];
|
|
15489
|
+
with_chain?: boolean;
|
|
15490
|
+
with_channel?: boolean;
|
|
15491
|
+
with_tags?: boolean;
|
|
15492
|
+
with_client_details?: boolean;
|
|
15493
|
+
admin?: StringId | StringId[];
|
|
15494
|
+
tax?: StringId | StringId[];
|
|
15495
|
+
with_original_price?: boolean;
|
|
15496
|
+
with_route?: boolean;
|
|
15497
|
+
route?: StringId | StringId[];
|
|
15498
|
+
with_external_serial_number?: boolean;
|
|
15499
|
+
with_workorder?: boolean;
|
|
15500
|
+
with_client_customFields?: boolean;
|
|
15501
|
+
with_rep_details?: boolean;
|
|
15502
|
+
with_rep_customFields?: boolean;
|
|
15503
|
+
sortBy?: SortByOption[];
|
|
15504
|
+
includeDocumentsCount?: boolean;
|
|
15505
|
+
};
|
|
15506
|
+
type Body = CreateBody;
|
|
15507
|
+
interface Result extends DefaultPaginationResult {
|
|
15508
|
+
data: Data[];
|
|
15509
|
+
columns: ReportColumn[];
|
|
15510
|
+
keys: ReportKey[];
|
|
15511
|
+
}
|
|
15512
|
+
}
|
|
15366
15513
|
}
|
|
15367
15514
|
namespace WorkorderAgenda {
|
|
15368
15515
|
interface Workorder {
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { QueryCriteriaOperators } from "./index";
|
|
2
|
+
type SalesAnalyticsReportFilterKeys = "is_void" | "client_id" | "rep" | "admin" | "creator._id" | "status" | "time" | "issue_date" | "due_date" | "createdAt" | "updatedAt" | "client.chain" | "client.channel" | "client.city" | "client.state" | "client.country" | "client.tags" | "client.CLIENT_TAGS" | "client.AREA_TAGS" | "product.brand" | "product.category" | "product.sub_category" | "product.product_groups" | "promotions._id" | "items.measureunit._id" | "items.return_reason" | "items.variant.variant_id" | "items.variant.product_id" | "items.promotion_type" | "items.class" | "items.discounted_price" | "items.tax._id" | "items.tax.name" | "items.tax.type" | "return_items.tax.name" | "return_items.tax.type" | "return_items.measureunit._id" | "return_items.return_reason" | "return_items.variant.variant_id" | "return_items.variant.product_id" | "return_items.promotion_type" | "return_items.class" | "return_items.discounted_price" | "return_items.tax._id" | "teams" | "route" | "custom_status";
|
|
3
|
+
interface SalesAnalyticsReportFilter extends Record<SalesAnalyticsReportFilterKeys, QueryCriteriaOperators[]> {
|
|
4
|
+
is_void: ["in"];
|
|
5
|
+
client_id: ["in", "nin"];
|
|
6
|
+
rep: ["in", "nin"];
|
|
7
|
+
admin: ["in", "nin"];
|
|
8
|
+
"creator._id": ["in", "nin"];
|
|
9
|
+
status: ["in", "nin"];
|
|
10
|
+
time: [
|
|
11
|
+
"between",
|
|
12
|
+
"last_seven_days",
|
|
13
|
+
"last_thirty_days",
|
|
14
|
+
"last_month",
|
|
15
|
+
"last_three_months",
|
|
16
|
+
"last_six_months",
|
|
17
|
+
"last_twelve_months",
|
|
18
|
+
"yesterday",
|
|
19
|
+
"today",
|
|
20
|
+
"gte",
|
|
21
|
+
"lte",
|
|
22
|
+
"lt",
|
|
23
|
+
"gt"
|
|
24
|
+
];
|
|
25
|
+
issue_date: [
|
|
26
|
+
"between",
|
|
27
|
+
"last_seven_days",
|
|
28
|
+
"last_thirty_days",
|
|
29
|
+
"last_month",
|
|
30
|
+
"last_three_months",
|
|
31
|
+
"last_six_months",
|
|
32
|
+
"last_twelve_months",
|
|
33
|
+
"yesterday",
|
|
34
|
+
"today",
|
|
35
|
+
"gte",
|
|
36
|
+
"lte",
|
|
37
|
+
"lt",
|
|
38
|
+
"gt"
|
|
39
|
+
];
|
|
40
|
+
due_date: [
|
|
41
|
+
"between",
|
|
42
|
+
"last_seven_days",
|
|
43
|
+
"last_thirty_days",
|
|
44
|
+
"last_month",
|
|
45
|
+
"last_three_months",
|
|
46
|
+
"last_six_months",
|
|
47
|
+
"last_twelve_months",
|
|
48
|
+
"yesterday",
|
|
49
|
+
"today",
|
|
50
|
+
"gte",
|
|
51
|
+
"lte",
|
|
52
|
+
"lt",
|
|
53
|
+
"gt"
|
|
54
|
+
];
|
|
55
|
+
createdAt: [
|
|
56
|
+
"between",
|
|
57
|
+
"last_seven_days",
|
|
58
|
+
"last_thirty_days",
|
|
59
|
+
"last_month",
|
|
60
|
+
"last_three_months",
|
|
61
|
+
"last_six_months",
|
|
62
|
+
"last_twelve_months",
|
|
63
|
+
"yesterday",
|
|
64
|
+
"today",
|
|
65
|
+
"gte",
|
|
66
|
+
"lte",
|
|
67
|
+
"lt",
|
|
68
|
+
"gt"
|
|
69
|
+
];
|
|
70
|
+
updatedAt: [
|
|
71
|
+
"between",
|
|
72
|
+
"last_seven_days",
|
|
73
|
+
"last_thirty_days",
|
|
74
|
+
"last_month",
|
|
75
|
+
"last_three_months",
|
|
76
|
+
"last_six_months",
|
|
77
|
+
"last_twelve_months",
|
|
78
|
+
"yesterday",
|
|
79
|
+
"today",
|
|
80
|
+
"gte",
|
|
81
|
+
"lte",
|
|
82
|
+
"lt",
|
|
83
|
+
"gt"
|
|
84
|
+
];
|
|
85
|
+
"client.chain": ["in", "nin"];
|
|
86
|
+
"client.channel": ["in", "nin"];
|
|
87
|
+
"client.city": ["in", "nin"];
|
|
88
|
+
"client.state": ["in", "nin"];
|
|
89
|
+
"client.country": ["in", "nin"];
|
|
90
|
+
"client.tags": ["in", "nin"];
|
|
91
|
+
"client.CLIENT_TAGS": ["in", "nin"];
|
|
92
|
+
"client.AREA_TAGS": ["in", "nin"];
|
|
93
|
+
"product.brand": ["in", "nin"];
|
|
94
|
+
"product.category": ["in", "nin"];
|
|
95
|
+
"product.sub_category": ["in", "nin"];
|
|
96
|
+
"product.product_groups": ["in", "nin"];
|
|
97
|
+
"promotions._id": ["in", "nin"];
|
|
98
|
+
"items.promos": ["in", "nin"];
|
|
99
|
+
"items.measureunit._id": ["in", "nin"];
|
|
100
|
+
"items.return_reason": ["in", "nin"];
|
|
101
|
+
"items.variant.variant_id": ["in", "nin"];
|
|
102
|
+
"items.variant.product_id": ["in", "nin"];
|
|
103
|
+
"items.promotion_type": ["in", "nin"];
|
|
104
|
+
"items.class": ["in", "nin"];
|
|
105
|
+
"items.discounted_price": ["between"];
|
|
106
|
+
"items.tax._id": ["in", "nin"];
|
|
107
|
+
"items.tax.name": ["in", "nin"];
|
|
108
|
+
"items.tax.type": ["in", "nin"];
|
|
109
|
+
"return_items.tax.name": ["in", "nin"];
|
|
110
|
+
"return_items.tax.type": ["in", "nin"];
|
|
111
|
+
"return_items.measureunit._id": ["in", "nin"];
|
|
112
|
+
"return_items.return_reason": ["in", "nin"];
|
|
113
|
+
"return_items.variant.variant_id": ["in", "nin"];
|
|
114
|
+
"return_items.variant.product_id": ["in", "nin"];
|
|
115
|
+
"return_items.promotion_type": ["in", "nin"];
|
|
116
|
+
"return_items.class": ["in", "nin"];
|
|
117
|
+
"return_items.discounted_price": ["between"];
|
|
118
|
+
"return_items.tax._id": ["in", "nin"];
|
|
119
|
+
teams: ["in", "nin"];
|
|
120
|
+
route: ["in", "nin"];
|
|
121
|
+
custom_status: ["in", "nin"];
|
|
122
|
+
}
|
|
123
|
+
type SalesAnalyticsReportProjectionKey = "issue_date" | "due_date" | "serial_number" | "advanced_serial_number" | "external_serial_number" | "return_serial_number" | "client" | "client_code" | "creator" | "rep_username" | "teams" | "route" | "custom_status" | "workorder_serial_number" | "line_number" | "lines" | "status" | "product" | "product_local_name" | "product_sku" | "product_barcode" | "variant" | "variant_local_name" | "variant_sku" | "variant_barcode" | "category" | "sub_category" | "brand" | "product_groups" | "promotion" | "promotion_ref" | "promotion_type" | "class" | "class" | "return_reason" | "chain" | "channel" | "country" | "state" | "city" | "area_tags" | "client_tags" | "original_price" | "tax" | "visit_uuid" | "base_unit_qty" | "qty" | "measureunit" | "price" | "tax" | "line_total" | "lineTotalAfterDeduction" | "deduction" | "total_before_tax" | "discount_amount" | "tax_total" | "tax_total_after_deduction" | "pre_total" | "return_total" | "total" | "balance" | "tax_total_after_deduction" | `client_customFields.${string}` | `rep_customFields.${string}`;
|
|
124
|
+
type SalesAnalyticsReportSortedKey = "issue_date" | "due_date" | "createdAt" | "updatedAt" | "time" | "line_total" | "pre_total" | "return_total" | "total" | "balance" | "items.tax_total_after_deduction" | "items.lineTotalAfterDeduction" | "items.price" | "discount_amount" | "tax_total" | "items.base_unit_qty" | "items.qty" | "items.deduction";
|
|
125
|
+
type SalesAnalyticsGroupByIDs = {
|
|
126
|
+
client: "client_name" | "client_id" | "client_code" | "client_local_name" | "chain" | "channel" | "client_customFields" | "tags" | "country" | "state" | "city";
|
|
127
|
+
user: "creator_id" | "creator_type" | "creator_name" | "creator_customFields" | "creator_username";
|
|
128
|
+
issue_date: "issue_date";
|
|
129
|
+
due_date: "due_date";
|
|
130
|
+
serial_number: "serial_number" | "external_serial_number" | "return_serial_number";
|
|
131
|
+
product: "product_name" | "product_local_name" | "product" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price" | "product_sku" | "product_barcode" | "sub_category" | "product_groups" | "category" | "brand";
|
|
132
|
+
variant: "variant_name" | "variant_local_name" | "variant_sku" | "variant_barcode" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
133
|
+
brand: "brand" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
134
|
+
category: "category" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
135
|
+
status: "status";
|
|
136
|
+
promotion_type: "promotion_type" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
137
|
+
class: "class" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
138
|
+
measureunit: "measureunit" | "price" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
139
|
+
promotion: "promotions" | "promotion_ref" | "promotion_type" | "price" | "measureunit" | "base_unit_qty" | "qty" | "discount_amount" | "tax" | "return_reason" | "line_total" | "tax_total" | "total_before_tax" | "lineTotalAfterDeduction" | "deduction" | "tax_total_after_deduction" | "original_price";
|
|
140
|
+
chain: "client_name" | "chain";
|
|
141
|
+
channel: "client_name" | "channel";
|
|
142
|
+
city: "client_name" | "city";
|
|
143
|
+
state: "client_name" | "state";
|
|
144
|
+
country: "client_name" | "country";
|
|
145
|
+
route: "route";
|
|
146
|
+
custom_status: "custom_status";
|
|
147
|
+
teams: "teams";
|
|
148
|
+
};
|
|
149
|
+
type SalesAnalyticsFieldAccumulators = {
|
|
150
|
+
client_name: "first" | "last";
|
|
151
|
+
client_id: "first" | "last";
|
|
152
|
+
client_code: "first" | "last";
|
|
153
|
+
client_local_name: "first" | "last";
|
|
154
|
+
chain: "first" | "last";
|
|
155
|
+
channel: "first" | "last";
|
|
156
|
+
client_customFields: "first" | "last";
|
|
157
|
+
tags: "first" | "last";
|
|
158
|
+
country: "first" | "last";
|
|
159
|
+
state: "first" | "last";
|
|
160
|
+
city: "first" | "last";
|
|
161
|
+
creator_id: "first" | "last";
|
|
162
|
+
creator_type: "first" | "last";
|
|
163
|
+
creator_name: "first" | "last";
|
|
164
|
+
creator_customFields: "first" | "last";
|
|
165
|
+
creator_username: "first" | "last";
|
|
166
|
+
issue_date: "first" | "last";
|
|
167
|
+
due_date: "first" | "last";
|
|
168
|
+
serial_number: "first" | "last";
|
|
169
|
+
external_serial_number: "first" | "last";
|
|
170
|
+
return_serial_number: "first" | "last";
|
|
171
|
+
price: "sum" | "avg" | "max" | "min";
|
|
172
|
+
base_unit_qty: "sum" | "avg" | "max" | "min";
|
|
173
|
+
qty: "sum" | "avg" | "max" | "min";
|
|
174
|
+
discount_amount: "sum" | "avg" | "max" | "min";
|
|
175
|
+
line_total: "sum" | "avg" | "max" | "min";
|
|
176
|
+
tax_total: "sum" | "avg" | "max" | "min";
|
|
177
|
+
total_before_tax: "sum" | "avg" | "ma" | "min";
|
|
178
|
+
lineTotalAfterDeduction: "sum" | "avg" | "max" | "min";
|
|
179
|
+
deduction: "sum" | "avg" | "max" | "min";
|
|
180
|
+
tax_total_after_deduction: "sum" | "avg" | "max" | "min";
|
|
181
|
+
original_price: "avg" | "max" | "min" | "sum";
|
|
182
|
+
measureunit: "addToSet" | "first" | "last";
|
|
183
|
+
tax: "addToSet" | "first" | "last";
|
|
184
|
+
return_reason: "addToSet" | "first" | "last";
|
|
185
|
+
promotion_type: "addToSet" | "first" | "last";
|
|
186
|
+
product_name: "first" | "last";
|
|
187
|
+
product_local_name: "first" | "last";
|
|
188
|
+
product: "first" | "last";
|
|
189
|
+
product_sku: "first" | "last";
|
|
190
|
+
product_barcode: "first" | "last";
|
|
191
|
+
sub_category: "first" | "last";
|
|
192
|
+
product_groups: "first" | "last";
|
|
193
|
+
category: "first" | "last";
|
|
194
|
+
brand: "first" | "last";
|
|
195
|
+
variant_name: "first" | "last";
|
|
196
|
+
variant_local_name: "first" | "last";
|
|
197
|
+
variant_sku: "first" | "last";
|
|
198
|
+
variant_barcode: "first" | "last";
|
|
199
|
+
status: "first" | "last";
|
|
200
|
+
class: "first" | "last";
|
|
201
|
+
promotions: "first" | "last";
|
|
202
|
+
promotion_ref: "first" | "last";
|
|
203
|
+
route: "first" | "last";
|
|
204
|
+
custom_status: "first" | "last";
|
|
205
|
+
teams: "first" | "last";
|
|
206
|
+
};
|
|
207
|
+
export { SalesAnalyticsReportSortedKey, SalesAnalyticsGroupByIDs, SalesAnalyticsFieldAccumulators, SalesAnalyticsReportFilter, SalesAnalyticsReportProjectionKey, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5116,6 +5116,19 @@ export default class Repzo {
|
|
|
5116
5116
|
);
|
|
5117
5117
|
return res;
|
|
5118
5118
|
},
|
|
5119
|
+
|
|
5120
|
+
create: async (
|
|
5121
|
+
body: Service.SalesAnalyticsReport.CreateBody,
|
|
5122
|
+
params?: Service.SalesAnalyticsReport.Create.Params,
|
|
5123
|
+
): Promise<Service.SalesAnalyticsReport.Create.Result> => {
|
|
5124
|
+
let res = await this._create(
|
|
5125
|
+
this.svAPIEndpoint,
|
|
5126
|
+
this.salesAnalyticsReport._path,
|
|
5127
|
+
body,
|
|
5128
|
+
params,
|
|
5129
|
+
);
|
|
5130
|
+
return res;
|
|
5131
|
+
},
|
|
5119
5132
|
};
|
|
5120
5133
|
|
|
5121
5134
|
workorderAgenda = {
|
package/src/types/index.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { EndPoints } from "../index.js";
|
|
2
|
+
import {
|
|
3
|
+
SalesAnalyticsFieldAccumulators,
|
|
4
|
+
SalesAnalyticsReportProjectionKey,
|
|
5
|
+
SalesAnalyticsReportFilter,
|
|
6
|
+
SalesAnalyticsGroupByIDs,
|
|
7
|
+
SalesAnalyticsReportSortedKey,
|
|
8
|
+
} from "./report-type.js";
|
|
2
9
|
|
|
3
10
|
export interface Params {
|
|
4
11
|
[key: string]: any;
|
|
@@ -19,6 +26,121 @@ export interface Options {
|
|
|
19
26
|
refresh_token?: string;
|
|
20
27
|
reauthCallBackFn?: (res: Service.Reauth.Result) => void;
|
|
21
28
|
}
|
|
29
|
+
interface ReportColumn {
|
|
30
|
+
_id?: string;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
key: string;
|
|
33
|
+
name: string;
|
|
34
|
+
report_types: ReportType[];
|
|
35
|
+
default_show: boolean;
|
|
36
|
+
selectable: boolean;
|
|
37
|
+
position: number;
|
|
38
|
+
show: "default" | "hide" | "show";
|
|
39
|
+
column_group?: StringId | string;
|
|
40
|
+
totals_key?: string;
|
|
41
|
+
createdAt?: Date;
|
|
42
|
+
updatedAt?: Date;
|
|
43
|
+
}
|
|
44
|
+
type QueryCriteriaCondition = { [key: string]: any };
|
|
45
|
+
type QueryCriteriaValue =
|
|
46
|
+
| boolean
|
|
47
|
+
| string
|
|
48
|
+
| number
|
|
49
|
+
| QueryCriteriaElement
|
|
50
|
+
| QueryCriteriaLogical
|
|
51
|
+
| null
|
|
52
|
+
| Date;
|
|
53
|
+
type LogicalOperators = "and" | "or";
|
|
54
|
+
export type QueryCriteriaOperators =
|
|
55
|
+
| "gt"
|
|
56
|
+
| "lt"
|
|
57
|
+
| "gte"
|
|
58
|
+
| "lte"
|
|
59
|
+
| "in"
|
|
60
|
+
| "nin"
|
|
61
|
+
| "eq"
|
|
62
|
+
| "between"
|
|
63
|
+
| "last_seven_days"
|
|
64
|
+
| "today"
|
|
65
|
+
| "yesterday"
|
|
66
|
+
| "last_thirty_days"
|
|
67
|
+
| "last_month"
|
|
68
|
+
| "last_three_months"
|
|
69
|
+
| "last_six_months"
|
|
70
|
+
| "last_twelve_months";
|
|
71
|
+
|
|
72
|
+
type QueryCriteriaElement = {
|
|
73
|
+
key: string;
|
|
74
|
+
operator: QueryCriteriaOperators;
|
|
75
|
+
value: QueryCriteriaValue;
|
|
76
|
+
conditions?: QueryCriteriaCondition[];
|
|
77
|
+
};
|
|
78
|
+
type QueryCriteriaLogical = {
|
|
79
|
+
operator: LogicalOperators;
|
|
80
|
+
value: QueryCriteriaValue[];
|
|
81
|
+
};
|
|
82
|
+
type BaseKey = string;
|
|
83
|
+
type BaseValue = any;
|
|
84
|
+
type FilterMap = SalesAnalyticsReportFilter;
|
|
85
|
+
type GroupByKeys = SalesAnalyticsGroupByIDs;
|
|
86
|
+
type FieldAccumulators = SalesAnalyticsFieldAccumulators;
|
|
87
|
+
type SortValue<Keys extends BaseKey> = {
|
|
88
|
+
field: Keys;
|
|
89
|
+
type: "asc" | "desc" | -1 | 1;
|
|
90
|
+
};
|
|
91
|
+
interface EnhancedQueryCriteriaElement<
|
|
92
|
+
TKeys extends keyof FilterMap,
|
|
93
|
+
TValue extends BaseValue = QueryCriteriaValue,
|
|
94
|
+
TCondition = QueryCriteriaCondition,
|
|
95
|
+
> {
|
|
96
|
+
key: TKeys;
|
|
97
|
+
operator: FilterMap[TKeys][number];
|
|
98
|
+
value: TValue;
|
|
99
|
+
conditions?: TCondition[];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type GroupByType<TGroupID extends keyof GroupByKeys, TFieldAccumulators> = {
|
|
103
|
+
_id: TGroupID;
|
|
104
|
+
fields: {
|
|
105
|
+
[K in GroupByKeys[TGroupID]]: {
|
|
106
|
+
key: K;
|
|
107
|
+
acc: K extends keyof TFieldAccumulators ? TFieldAccumulators[K] : never;
|
|
108
|
+
};
|
|
109
|
+
}[GroupByKeys[TGroupID]][];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
interface GenericQuery<
|
|
113
|
+
TSortKey extends BaseKey,
|
|
114
|
+
TFilterMap extends FilterMap,
|
|
115
|
+
TGroupKey extends GroupByKeys,
|
|
116
|
+
TFieldAccumulators extends FieldAccumulators,
|
|
117
|
+
TProjectionKeys extends BaseKey,
|
|
118
|
+
TMaxAnyOfLength extends number = 1,
|
|
119
|
+
> {
|
|
120
|
+
maxAnyOfLength: TMaxAnyOfLength;
|
|
121
|
+
anyOf: {
|
|
122
|
+
criteria: {
|
|
123
|
+
[K in keyof TFilterMap]: EnhancedQueryCriteriaElement<
|
|
124
|
+
K & keyof FilterMap
|
|
125
|
+
>;
|
|
126
|
+
}[keyof TFilterMap][];
|
|
127
|
+
}[];
|
|
128
|
+
options?: {
|
|
129
|
+
sort?: SortValue<TSortKey>[];
|
|
130
|
+
limit?: number;
|
|
131
|
+
page?: number;
|
|
132
|
+
totals_summary?: "none" | "all" | "page";
|
|
133
|
+
without_currency?: boolean;
|
|
134
|
+
};
|
|
135
|
+
group?: GroupByType<
|
|
136
|
+
keyof TGroupKey & keyof GroupByKeys,
|
|
137
|
+
TFieldAccumulators
|
|
138
|
+
>[];
|
|
139
|
+
projection?: TProjectionKeys[];
|
|
140
|
+
columns?: ReportColumn[];
|
|
141
|
+
metadata?: any;
|
|
142
|
+
}
|
|
143
|
+
|
|
22
144
|
export interface Headers {
|
|
23
145
|
"api-key": string;
|
|
24
146
|
"Content-Type": string;
|
|
@@ -205,6 +327,8 @@ export interface DefaultPaginationResult {
|
|
|
205
327
|
prev_page_url: string | null;
|
|
206
328
|
path: string;
|
|
207
329
|
data: any[];
|
|
330
|
+
columns?: ReportColumn[];
|
|
331
|
+
keys?: ReportKey[];
|
|
208
332
|
}
|
|
209
333
|
export interface AgendaPaginationResult extends DefaultPaginationResult {
|
|
210
334
|
meta?: {
|
|
@@ -17118,6 +17242,15 @@ export namespace Service {
|
|
|
17118
17242
|
[key: string]: any;
|
|
17119
17243
|
}
|
|
17120
17244
|
|
|
17245
|
+
export type CreateBody = GenericQuery<
|
|
17246
|
+
SalesAnalyticsReportSortedKey,
|
|
17247
|
+
SalesAnalyticsReportFilter,
|
|
17248
|
+
SalesAnalyticsGroupByIDs,
|
|
17249
|
+
SalesAnalyticsFieldAccumulators,
|
|
17250
|
+
SalesAnalyticsReportProjectionKey,
|
|
17251
|
+
1
|
|
17252
|
+
>;
|
|
17253
|
+
|
|
17121
17254
|
export namespace Find {
|
|
17122
17255
|
export type Params = DefaultPaginationQueryParams & {
|
|
17123
17256
|
from_issue_date?: string;
|
|
@@ -17184,6 +17317,77 @@ export namespace Service {
|
|
|
17184
17317
|
data: Data[];
|
|
17185
17318
|
}
|
|
17186
17319
|
}
|
|
17320
|
+
|
|
17321
|
+
export namespace Create {
|
|
17322
|
+
export type Params = DefaultPaginationQueryParams & {
|
|
17323
|
+
from_issue_date?: string;
|
|
17324
|
+
to_issue_date?: string;
|
|
17325
|
+
from_due_date?: string;
|
|
17326
|
+
to_due_date?: string;
|
|
17327
|
+
from_createdAt?: string;
|
|
17328
|
+
to_createdAt?: string;
|
|
17329
|
+
from_updatedAt?: string;
|
|
17330
|
+
to_updatedAt?: string;
|
|
17331
|
+
client?: StringId | StringId[];
|
|
17332
|
+
rep?: StringId | StringId[];
|
|
17333
|
+
creator?: StringId | StringId[];
|
|
17334
|
+
teams?: StringId | StringId[];
|
|
17335
|
+
status?: StatusOption | StatusOption[];
|
|
17336
|
+
promotion?: StringId | StringId[];
|
|
17337
|
+
product?: StringId | StringId[];
|
|
17338
|
+
variant?: StringId | StringId[];
|
|
17339
|
+
category?: StringId | StringId[];
|
|
17340
|
+
sub_category?: StringId | StringId[];
|
|
17341
|
+
brand?: StringId | StringId[];
|
|
17342
|
+
product_groups?: StringId | StringId[];
|
|
17343
|
+
class?: ClassOption | ClassOption[];
|
|
17344
|
+
with_brand?: boolean;
|
|
17345
|
+
with_category?: boolean;
|
|
17346
|
+
with_product_groups?: boolean;
|
|
17347
|
+
with_sub_category?: boolean;
|
|
17348
|
+
with_product_details?: boolean;
|
|
17349
|
+
with_variant_details?: boolean;
|
|
17350
|
+
with_teams?: boolean;
|
|
17351
|
+
with_promotions?: boolean;
|
|
17352
|
+
promotion_type?: PromotionTypeOption;
|
|
17353
|
+
with_balance?: boolean;
|
|
17354
|
+
groupBy?: GroupByOption | GroupByOption[];
|
|
17355
|
+
from_price?: number;
|
|
17356
|
+
to_price?: number;
|
|
17357
|
+
export?: string;
|
|
17358
|
+
chain?: StringId | StringId[];
|
|
17359
|
+
channel?: StringId | StringId[];
|
|
17360
|
+
CLIENT_TAGS?: StringId | StringId[];
|
|
17361
|
+
AREA_TAGS?: StringId | StringId[];
|
|
17362
|
+
tags?: StringId | StringId[];
|
|
17363
|
+
country?: string | string[];
|
|
17364
|
+
state?: string | string[];
|
|
17365
|
+
city?: string | string[];
|
|
17366
|
+
with_chain?: boolean;
|
|
17367
|
+
with_channel?: boolean;
|
|
17368
|
+
with_tags?: boolean;
|
|
17369
|
+
with_client_details?: boolean;
|
|
17370
|
+
admin?: StringId | StringId[];
|
|
17371
|
+
tax?: StringId | StringId[];
|
|
17372
|
+
with_original_price?: boolean;
|
|
17373
|
+
with_route?: boolean;
|
|
17374
|
+
route?: StringId | StringId[];
|
|
17375
|
+
with_external_serial_number?: boolean;
|
|
17376
|
+
with_workorder?: boolean;
|
|
17377
|
+
with_client_customFields?: boolean;
|
|
17378
|
+
with_rep_details?: boolean;
|
|
17379
|
+
with_rep_customFields?: boolean;
|
|
17380
|
+
sortBy?: SortByOption[];
|
|
17381
|
+
includeDocumentsCount?: boolean;
|
|
17382
|
+
};
|
|
17383
|
+
|
|
17384
|
+
export type Body = CreateBody;
|
|
17385
|
+
export interface Result extends DefaultPaginationResult {
|
|
17386
|
+
data: Data[];
|
|
17387
|
+
columns: ReportColumn[];
|
|
17388
|
+
keys: ReportKey[];
|
|
17389
|
+
}
|
|
17390
|
+
}
|
|
17187
17391
|
}
|
|
17188
17392
|
|
|
17189
17393
|
export namespace WorkorderAgenda {
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import type { QueryCriteriaOperators } from "./index";
|
|
2
|
+
|
|
3
|
+
type SalesAnalyticsReportFilterKeys =
|
|
4
|
+
| "is_void"
|
|
5
|
+
| "client_id"
|
|
6
|
+
| "rep"
|
|
7
|
+
| "admin"
|
|
8
|
+
| "creator._id"
|
|
9
|
+
| "status"
|
|
10
|
+
| "time"
|
|
11
|
+
| "issue_date"
|
|
12
|
+
| "due_date"
|
|
13
|
+
| "createdAt"
|
|
14
|
+
| "updatedAt"
|
|
15
|
+
| "client.chain"
|
|
16
|
+
| "client.channel"
|
|
17
|
+
| "client.city"
|
|
18
|
+
| "client.state"
|
|
19
|
+
| "client.country"
|
|
20
|
+
| "client.tags"
|
|
21
|
+
| "client.CLIENT_TAGS"
|
|
22
|
+
| "client.AREA_TAGS"
|
|
23
|
+
| "product.brand"
|
|
24
|
+
| "product.category"
|
|
25
|
+
| "product.sub_category"
|
|
26
|
+
| "product.product_groups"
|
|
27
|
+
| "promotions._id"
|
|
28
|
+
| "items.measureunit._id"
|
|
29
|
+
| "items.return_reason"
|
|
30
|
+
| "items.variant.variant_id"
|
|
31
|
+
| "items.variant.product_id"
|
|
32
|
+
| "items.promotion_type"
|
|
33
|
+
| "items.class"
|
|
34
|
+
| "items.discounted_price"
|
|
35
|
+
| "items.tax._id"
|
|
36
|
+
| "items.tax.name"
|
|
37
|
+
| "items.tax.type"
|
|
38
|
+
| "return_items.tax.name"
|
|
39
|
+
| "return_items.tax.type"
|
|
40
|
+
| "return_items.measureunit._id"
|
|
41
|
+
| "return_items.return_reason"
|
|
42
|
+
| "return_items.variant.variant_id"
|
|
43
|
+
| "return_items.variant.product_id"
|
|
44
|
+
| "return_items.promotion_type"
|
|
45
|
+
| "return_items.class"
|
|
46
|
+
| "return_items.discounted_price"
|
|
47
|
+
| "return_items.tax._id"
|
|
48
|
+
| "teams"
|
|
49
|
+
| "route"
|
|
50
|
+
| "custom_status";
|
|
51
|
+
|
|
52
|
+
interface SalesAnalyticsReportFilter extends Record<
|
|
53
|
+
SalesAnalyticsReportFilterKeys,
|
|
54
|
+
QueryCriteriaOperators[]
|
|
55
|
+
> {
|
|
56
|
+
is_void: ["in"];
|
|
57
|
+
client_id: ["in", "nin"];
|
|
58
|
+
rep: ["in", "nin"];
|
|
59
|
+
admin: ["in", "nin"];
|
|
60
|
+
"creator._id": ["in", "nin"];
|
|
61
|
+
status: ["in", "nin"];
|
|
62
|
+
time: [
|
|
63
|
+
"between",
|
|
64
|
+
"last_seven_days",
|
|
65
|
+
"last_thirty_days",
|
|
66
|
+
"last_month",
|
|
67
|
+
"last_three_months",
|
|
68
|
+
"last_six_months",
|
|
69
|
+
"last_twelve_months",
|
|
70
|
+
"yesterday",
|
|
71
|
+
"today",
|
|
72
|
+
"gte",
|
|
73
|
+
"lte",
|
|
74
|
+
"lt",
|
|
75
|
+
"gt",
|
|
76
|
+
];
|
|
77
|
+
issue_date: [
|
|
78
|
+
"between",
|
|
79
|
+
"last_seven_days",
|
|
80
|
+
"last_thirty_days",
|
|
81
|
+
"last_month",
|
|
82
|
+
"last_three_months",
|
|
83
|
+
"last_six_months",
|
|
84
|
+
"last_twelve_months",
|
|
85
|
+
"yesterday",
|
|
86
|
+
"today",
|
|
87
|
+
"gte",
|
|
88
|
+
"lte",
|
|
89
|
+
"lt",
|
|
90
|
+
"gt",
|
|
91
|
+
];
|
|
92
|
+
due_date: [
|
|
93
|
+
"between",
|
|
94
|
+
"last_seven_days",
|
|
95
|
+
"last_thirty_days",
|
|
96
|
+
"last_month",
|
|
97
|
+
"last_three_months",
|
|
98
|
+
"last_six_months",
|
|
99
|
+
"last_twelve_months",
|
|
100
|
+
"yesterday",
|
|
101
|
+
"today",
|
|
102
|
+
"gte",
|
|
103
|
+
"lte",
|
|
104
|
+
"lt",
|
|
105
|
+
"gt",
|
|
106
|
+
];
|
|
107
|
+
createdAt: [
|
|
108
|
+
"between",
|
|
109
|
+
"last_seven_days",
|
|
110
|
+
"last_thirty_days",
|
|
111
|
+
"last_month",
|
|
112
|
+
"last_three_months",
|
|
113
|
+
"last_six_months",
|
|
114
|
+
"last_twelve_months",
|
|
115
|
+
"yesterday",
|
|
116
|
+
"today",
|
|
117
|
+
"gte",
|
|
118
|
+
"lte",
|
|
119
|
+
"lt",
|
|
120
|
+
"gt",
|
|
121
|
+
];
|
|
122
|
+
updatedAt: [
|
|
123
|
+
"between",
|
|
124
|
+
"last_seven_days",
|
|
125
|
+
"last_thirty_days",
|
|
126
|
+
"last_month",
|
|
127
|
+
"last_three_months",
|
|
128
|
+
"last_six_months",
|
|
129
|
+
"last_twelve_months",
|
|
130
|
+
"yesterday",
|
|
131
|
+
"today",
|
|
132
|
+
"gte",
|
|
133
|
+
"lte",
|
|
134
|
+
"lt",
|
|
135
|
+
"gt",
|
|
136
|
+
];
|
|
137
|
+
"client.chain": ["in", "nin"];
|
|
138
|
+
"client.channel": ["in", "nin"];
|
|
139
|
+
"client.city": ["in", "nin"];
|
|
140
|
+
"client.state": ["in", "nin"];
|
|
141
|
+
"client.country": ["in", "nin"];
|
|
142
|
+
"client.tags": ["in", "nin"];
|
|
143
|
+
"client.CLIENT_TAGS": ["in", "nin"];
|
|
144
|
+
"client.AREA_TAGS": ["in", "nin"];
|
|
145
|
+
"product.brand": ["in", "nin"];
|
|
146
|
+
"product.category": ["in", "nin"];
|
|
147
|
+
"product.sub_category": ["in", "nin"];
|
|
148
|
+
"product.product_groups": ["in", "nin"];
|
|
149
|
+
"promotions._id": ["in", "nin"];
|
|
150
|
+
"items.promos": ["in", "nin"];
|
|
151
|
+
"items.measureunit._id": ["in", "nin"];
|
|
152
|
+
"items.return_reason": ["in", "nin"];
|
|
153
|
+
"items.variant.variant_id": ["in", "nin"];
|
|
154
|
+
"items.variant.product_id": ["in", "nin"];
|
|
155
|
+
"items.promotion_type": ["in", "nin"];
|
|
156
|
+
"items.class": ["in", "nin"];
|
|
157
|
+
"items.discounted_price": ["between"];
|
|
158
|
+
"items.tax._id": ["in", "nin"];
|
|
159
|
+
"items.tax.name": ["in", "nin"];
|
|
160
|
+
"items.tax.type": ["in", "nin"];
|
|
161
|
+
"return_items.tax.name": ["in", "nin"];
|
|
162
|
+
"return_items.tax.type": ["in", "nin"];
|
|
163
|
+
"return_items.measureunit._id": ["in", "nin"];
|
|
164
|
+
"return_items.return_reason": ["in", "nin"];
|
|
165
|
+
"return_items.variant.variant_id": ["in", "nin"];
|
|
166
|
+
"return_items.variant.product_id": ["in", "nin"];
|
|
167
|
+
"return_items.promotion_type": ["in", "nin"];
|
|
168
|
+
"return_items.class": ["in", "nin"];
|
|
169
|
+
"return_items.discounted_price": ["between"];
|
|
170
|
+
"return_items.tax._id": ["in", "nin"];
|
|
171
|
+
teams: ["in", "nin"];
|
|
172
|
+
route: ["in", "nin"];
|
|
173
|
+
custom_status: ["in", "nin"];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
type SalesAnalyticsReportProjectionKey =
|
|
177
|
+
| "issue_date"
|
|
178
|
+
| "due_date"
|
|
179
|
+
| "serial_number"
|
|
180
|
+
| "advanced_serial_number"
|
|
181
|
+
| "external_serial_number"
|
|
182
|
+
| "return_serial_number"
|
|
183
|
+
| "client"
|
|
184
|
+
| "client_code"
|
|
185
|
+
| "creator"
|
|
186
|
+
| "rep_username"
|
|
187
|
+
| "teams"
|
|
188
|
+
| "route"
|
|
189
|
+
| "custom_status"
|
|
190
|
+
| "workorder_serial_number"
|
|
191
|
+
| "line_number"
|
|
192
|
+
| "lines"
|
|
193
|
+
| "status"
|
|
194
|
+
| "product"
|
|
195
|
+
| "product_local_name"
|
|
196
|
+
| "product_sku"
|
|
197
|
+
| "product_barcode"
|
|
198
|
+
| "variant"
|
|
199
|
+
| "variant_local_name"
|
|
200
|
+
| "variant_sku"
|
|
201
|
+
| "variant_barcode"
|
|
202
|
+
| "category"
|
|
203
|
+
| "sub_category"
|
|
204
|
+
| "brand"
|
|
205
|
+
| "product_groups"
|
|
206
|
+
| "promotion"
|
|
207
|
+
| "promotion_ref"
|
|
208
|
+
| "promotion_type"
|
|
209
|
+
| "class"
|
|
210
|
+
| "class"
|
|
211
|
+
| "return_reason"
|
|
212
|
+
| "chain"
|
|
213
|
+
| "channel"
|
|
214
|
+
| "country"
|
|
215
|
+
| "state"
|
|
216
|
+
| "city"
|
|
217
|
+
| "area_tags"
|
|
218
|
+
| "client_tags"
|
|
219
|
+
| "original_price"
|
|
220
|
+
| "tax"
|
|
221
|
+
| "visit_uuid"
|
|
222
|
+
| "base_unit_qty"
|
|
223
|
+
| "qty"
|
|
224
|
+
| "measureunit"
|
|
225
|
+
| "price"
|
|
226
|
+
| "tax"
|
|
227
|
+
| "line_total"
|
|
228
|
+
| "lineTotalAfterDeduction"
|
|
229
|
+
| "deduction"
|
|
230
|
+
| "total_before_tax"
|
|
231
|
+
| "discount_amount"
|
|
232
|
+
| "tax_total"
|
|
233
|
+
| "tax_total_after_deduction"
|
|
234
|
+
| "pre_total"
|
|
235
|
+
| "return_total"
|
|
236
|
+
| "total"
|
|
237
|
+
| "balance"
|
|
238
|
+
| "tax_total_after_deduction"
|
|
239
|
+
| `client_customFields.${string}`
|
|
240
|
+
| `rep_customFields.${string}`;
|
|
241
|
+
|
|
242
|
+
type SalesAnalyticsReportSortedKey =
|
|
243
|
+
| "issue_date"
|
|
244
|
+
| "due_date"
|
|
245
|
+
| "createdAt"
|
|
246
|
+
| "updatedAt"
|
|
247
|
+
| "time"
|
|
248
|
+
| "line_total"
|
|
249
|
+
| "pre_total"
|
|
250
|
+
| "return_total"
|
|
251
|
+
| "total"
|
|
252
|
+
| "balance"
|
|
253
|
+
| "items.tax_total_after_deduction"
|
|
254
|
+
| "items.lineTotalAfterDeduction"
|
|
255
|
+
| "items.price"
|
|
256
|
+
| "discount_amount"
|
|
257
|
+
| "tax_total"
|
|
258
|
+
| "items.base_unit_qty"
|
|
259
|
+
| "items.qty"
|
|
260
|
+
| "items.deduction";
|
|
261
|
+
|
|
262
|
+
type SalesAnalyticsGroupByIDs = {
|
|
263
|
+
client:
|
|
264
|
+
| "client_name"
|
|
265
|
+
| "client_id"
|
|
266
|
+
| "client_code"
|
|
267
|
+
| "client_local_name"
|
|
268
|
+
| "chain"
|
|
269
|
+
| "channel"
|
|
270
|
+
| "client_customFields"
|
|
271
|
+
| "tags"
|
|
272
|
+
| "country"
|
|
273
|
+
| "state"
|
|
274
|
+
| "city";
|
|
275
|
+
user:
|
|
276
|
+
| "creator_id"
|
|
277
|
+
| "creator_type"
|
|
278
|
+
| "creator_name"
|
|
279
|
+
| "creator_customFields"
|
|
280
|
+
| "creator_username";
|
|
281
|
+
issue_date: "issue_date";
|
|
282
|
+
due_date: "due_date";
|
|
283
|
+
serial_number:
|
|
284
|
+
| "serial_number"
|
|
285
|
+
| "external_serial_number"
|
|
286
|
+
| "return_serial_number";
|
|
287
|
+
product:
|
|
288
|
+
| "product_name"
|
|
289
|
+
| "product_local_name"
|
|
290
|
+
| "product"
|
|
291
|
+
| "price"
|
|
292
|
+
| "measureunit"
|
|
293
|
+
| "base_unit_qty"
|
|
294
|
+
| "qty"
|
|
295
|
+
| "discount_amount"
|
|
296
|
+
| "tax"
|
|
297
|
+
| "return_reason"
|
|
298
|
+
| "line_total"
|
|
299
|
+
| "tax_total"
|
|
300
|
+
| "total_before_tax"
|
|
301
|
+
| "lineTotalAfterDeduction"
|
|
302
|
+
| "deduction"
|
|
303
|
+
| "tax_total_after_deduction"
|
|
304
|
+
| "original_price"
|
|
305
|
+
| "product_sku"
|
|
306
|
+
| "product_barcode"
|
|
307
|
+
| "sub_category"
|
|
308
|
+
| "product_groups"
|
|
309
|
+
| "category"
|
|
310
|
+
| "brand";
|
|
311
|
+
variant:
|
|
312
|
+
| "variant_name"
|
|
313
|
+
| "variant_local_name"
|
|
314
|
+
| "variant_sku"
|
|
315
|
+
| "variant_barcode"
|
|
316
|
+
| "price"
|
|
317
|
+
| "measureunit"
|
|
318
|
+
| "base_unit_qty"
|
|
319
|
+
| "qty"
|
|
320
|
+
| "discount_amount"
|
|
321
|
+
| "tax"
|
|
322
|
+
| "return_reason"
|
|
323
|
+
| "line_total"
|
|
324
|
+
| "tax_total"
|
|
325
|
+
| "total_before_tax"
|
|
326
|
+
| "lineTotalAfterDeduction"
|
|
327
|
+
| "deduction"
|
|
328
|
+
| "tax_total_after_deduction"
|
|
329
|
+
| "original_price";
|
|
330
|
+
brand:
|
|
331
|
+
| "brand"
|
|
332
|
+
| "price"
|
|
333
|
+
| "measureunit"
|
|
334
|
+
| "base_unit_qty"
|
|
335
|
+
| "qty"
|
|
336
|
+
| "discount_amount"
|
|
337
|
+
| "tax"
|
|
338
|
+
| "return_reason"
|
|
339
|
+
| "line_total"
|
|
340
|
+
| "tax_total"
|
|
341
|
+
| "total_before_tax"
|
|
342
|
+
| "lineTotalAfterDeduction"
|
|
343
|
+
| "deduction"
|
|
344
|
+
| "tax_total_after_deduction"
|
|
345
|
+
| "original_price";
|
|
346
|
+
category:
|
|
347
|
+
| "category"
|
|
348
|
+
| "price"
|
|
349
|
+
| "measureunit"
|
|
350
|
+
| "base_unit_qty"
|
|
351
|
+
| "qty"
|
|
352
|
+
| "discount_amount"
|
|
353
|
+
| "tax"
|
|
354
|
+
| "return_reason"
|
|
355
|
+
| "line_total"
|
|
356
|
+
| "tax_total"
|
|
357
|
+
| "total_before_tax"
|
|
358
|
+
| "lineTotalAfterDeduction"
|
|
359
|
+
| "deduction"
|
|
360
|
+
| "tax_total_after_deduction"
|
|
361
|
+
| "original_price";
|
|
362
|
+
status: "status";
|
|
363
|
+
promotion_type:
|
|
364
|
+
| "promotion_type"
|
|
365
|
+
| "price"
|
|
366
|
+
| "measureunit"
|
|
367
|
+
| "base_unit_qty"
|
|
368
|
+
| "qty"
|
|
369
|
+
| "discount_amount"
|
|
370
|
+
| "tax"
|
|
371
|
+
| "return_reason"
|
|
372
|
+
| "line_total"
|
|
373
|
+
| "tax_total"
|
|
374
|
+
| "total_before_tax"
|
|
375
|
+
| "lineTotalAfterDeduction"
|
|
376
|
+
| "deduction"
|
|
377
|
+
| "tax_total_after_deduction"
|
|
378
|
+
| "original_price";
|
|
379
|
+
class:
|
|
380
|
+
| "class"
|
|
381
|
+
| "price"
|
|
382
|
+
| "measureunit"
|
|
383
|
+
| "base_unit_qty"
|
|
384
|
+
| "qty"
|
|
385
|
+
| "discount_amount"
|
|
386
|
+
| "tax"
|
|
387
|
+
| "return_reason"
|
|
388
|
+
| "line_total"
|
|
389
|
+
| "tax_total"
|
|
390
|
+
| "total_before_tax"
|
|
391
|
+
| "lineTotalAfterDeduction"
|
|
392
|
+
| "deduction"
|
|
393
|
+
| "tax_total_after_deduction"
|
|
394
|
+
| "original_price";
|
|
395
|
+
measureunit:
|
|
396
|
+
| "measureunit"
|
|
397
|
+
| "price"
|
|
398
|
+
| "base_unit_qty"
|
|
399
|
+
| "qty"
|
|
400
|
+
| "discount_amount"
|
|
401
|
+
| "tax"
|
|
402
|
+
| "return_reason"
|
|
403
|
+
| "line_total"
|
|
404
|
+
| "tax_total"
|
|
405
|
+
| "total_before_tax"
|
|
406
|
+
| "lineTotalAfterDeduction"
|
|
407
|
+
| "deduction"
|
|
408
|
+
| "tax_total_after_deduction"
|
|
409
|
+
| "original_price";
|
|
410
|
+
promotion:
|
|
411
|
+
| "promotions"
|
|
412
|
+
| "promotion_ref"
|
|
413
|
+
| "promotion_type"
|
|
414
|
+
| "price"
|
|
415
|
+
| "measureunit"
|
|
416
|
+
| "base_unit_qty"
|
|
417
|
+
| "qty"
|
|
418
|
+
| "discount_amount"
|
|
419
|
+
| "tax"
|
|
420
|
+
| "return_reason"
|
|
421
|
+
| "line_total"
|
|
422
|
+
| "tax_total"
|
|
423
|
+
| "total_before_tax"
|
|
424
|
+
| "lineTotalAfterDeduction"
|
|
425
|
+
| "deduction"
|
|
426
|
+
| "tax_total_after_deduction"
|
|
427
|
+
| "original_price";
|
|
428
|
+
chain: "client_name" | "chain";
|
|
429
|
+
channel: "client_name" | "channel";
|
|
430
|
+
city: "client_name" | "city";
|
|
431
|
+
state: "client_name" | "state";
|
|
432
|
+
country: "client_name" | "country";
|
|
433
|
+
route: "route";
|
|
434
|
+
custom_status: "custom_status";
|
|
435
|
+
teams: "teams";
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
type SalesAnalyticsFieldAccumulators = {
|
|
439
|
+
client_name: "first" | "last";
|
|
440
|
+
client_id: "first" | "last";
|
|
441
|
+
client_code: "first" | "last";
|
|
442
|
+
client_local_name: "first" | "last";
|
|
443
|
+
chain: "first" | "last";
|
|
444
|
+
channel: "first" | "last";
|
|
445
|
+
client_customFields: "first" | "last";
|
|
446
|
+
tags: "first" | "last";
|
|
447
|
+
country: "first" | "last";
|
|
448
|
+
state: "first" | "last";
|
|
449
|
+
city: "first" | "last";
|
|
450
|
+
creator_id: "first" | "last";
|
|
451
|
+
creator_type: "first" | "last";
|
|
452
|
+
creator_name: "first" | "last";
|
|
453
|
+
creator_customFields: "first" | "last";
|
|
454
|
+
creator_username: "first" | "last";
|
|
455
|
+
issue_date: "first" | "last";
|
|
456
|
+
due_date: "first" | "last";
|
|
457
|
+
serial_number: "first" | "last";
|
|
458
|
+
external_serial_number: "first" | "last";
|
|
459
|
+
return_serial_number: "first" | "last";
|
|
460
|
+
price: "sum" | "avg" | "max" | "min";
|
|
461
|
+
base_unit_qty: "sum" | "avg" | "max" | "min";
|
|
462
|
+
qty: "sum" | "avg" | "max" | "min";
|
|
463
|
+
discount_amount: "sum" | "avg" | "max" | "min";
|
|
464
|
+
line_total: "sum" | "avg" | "max" | "min";
|
|
465
|
+
tax_total: "sum" | "avg" | "max" | "min";
|
|
466
|
+
total_before_tax: "sum" | "avg" | "ma" | "min";
|
|
467
|
+
lineTotalAfterDeduction: "sum" | "avg" | "max" | "min";
|
|
468
|
+
deduction: "sum" | "avg" | "max" | "min";
|
|
469
|
+
tax_total_after_deduction: "sum" | "avg" | "max" | "min";
|
|
470
|
+
original_price: "avg" | "max" | "min" | "sum";
|
|
471
|
+
measureunit: "addToSet" | "first" | "last";
|
|
472
|
+
tax: "addToSet" | "first" | "last";
|
|
473
|
+
return_reason: "addToSet" | "first" | "last";
|
|
474
|
+
promotion_type: "addToSet" | "first" | "last";
|
|
475
|
+
product_name: "first" | "last";
|
|
476
|
+
product_local_name: "first" | "last";
|
|
477
|
+
product: "first" | "last";
|
|
478
|
+
product_sku: "first" | "last";
|
|
479
|
+
product_barcode: "first" | "last";
|
|
480
|
+
sub_category: "first" | "last";
|
|
481
|
+
product_groups: "first" | "last";
|
|
482
|
+
category: "first" | "last";
|
|
483
|
+
brand: "first" | "last";
|
|
484
|
+
variant_name: "first" | "last";
|
|
485
|
+
variant_local_name: "first" | "last";
|
|
486
|
+
variant_sku: "first" | "last";
|
|
487
|
+
variant_barcode: "first" | "last";
|
|
488
|
+
status: "first" | "last";
|
|
489
|
+
class: "first" | "last";
|
|
490
|
+
promotions: "first" | "last";
|
|
491
|
+
promotion_ref: "first" | "last";
|
|
492
|
+
route: "first" | "last";
|
|
493
|
+
custom_status: "first" | "last";
|
|
494
|
+
teams: "first" | "last";
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export {
|
|
498
|
+
SalesAnalyticsReportSortedKey,
|
|
499
|
+
SalesAnalyticsGroupByIDs,
|
|
500
|
+
SalesAnalyticsFieldAccumulators,
|
|
501
|
+
SalesAnalyticsReportFilter,
|
|
502
|
+
SalesAnalyticsReportProjectionKey,
|
|
503
|
+
};
|