repzo 1.0.79 → 1.0.81
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 +17 -0
- package/lib/index.js +56 -11
- package/lib/types/index.d.ts +75 -0
- package/package.json +1 -1
- package/src/index.ts +66 -11
- package/src/types/index.ts +63 -0
package/lib/index.d.ts
CHANGED
|
@@ -568,6 +568,23 @@ export default class Repzo {
|
|
|
568
568
|
params?: Service.Workorder.Get.Params
|
|
569
569
|
) => Promise<Service.Workorder.Get.Result>;
|
|
570
570
|
};
|
|
571
|
+
supplier: {
|
|
572
|
+
_path: string;
|
|
573
|
+
find: (
|
|
574
|
+
params?: Service.Supplier.Find.Params
|
|
575
|
+
) => Promise<Service.Supplier.Find.Result>;
|
|
576
|
+
get: (
|
|
577
|
+
id: Service.Supplier.Get.ID,
|
|
578
|
+
params?: Service.Supplier.Get.Params
|
|
579
|
+
) => Promise<Service.Supplier.Get.Result>;
|
|
580
|
+
create: (
|
|
581
|
+
body: Service.Supplier.Create.Body
|
|
582
|
+
) => Promise<Service.Supplier.Create.Result>;
|
|
583
|
+
update: (
|
|
584
|
+
id: Service.Supplier.Update.ID,
|
|
585
|
+
body: Service.Supplier.Update.Body
|
|
586
|
+
) => Promise<Service.Supplier.Update.Result>;
|
|
587
|
+
};
|
|
571
588
|
quickConvertToPdf: {
|
|
572
589
|
_path: string;
|
|
573
590
|
find: (
|
package/lib/index.js
CHANGED
|
@@ -1175,6 +1175,40 @@ export default class Repzo {
|
|
|
1175
1175
|
);
|
|
1176
1176
|
},
|
|
1177
1177
|
};
|
|
1178
|
+
this.supplier = {
|
|
1179
|
+
_path: "/supplier",
|
|
1180
|
+
find: async (params) => {
|
|
1181
|
+
let res = await this._fetch(
|
|
1182
|
+
this.svAPIEndpoint,
|
|
1183
|
+
this.supplier._path,
|
|
1184
|
+
params
|
|
1185
|
+
);
|
|
1186
|
+
return res;
|
|
1187
|
+
},
|
|
1188
|
+
get: async (id, params) => {
|
|
1189
|
+
return await this._fetch(
|
|
1190
|
+
this.svAPIEndpoint,
|
|
1191
|
+
this.supplier._path + `/${id}`,
|
|
1192
|
+
params
|
|
1193
|
+
);
|
|
1194
|
+
},
|
|
1195
|
+
create: async (body) => {
|
|
1196
|
+
let res = await this._create(
|
|
1197
|
+
this.svAPIEndpoint,
|
|
1198
|
+
this.supplier._path,
|
|
1199
|
+
body
|
|
1200
|
+
);
|
|
1201
|
+
return res;
|
|
1202
|
+
},
|
|
1203
|
+
update: async (id, body) => {
|
|
1204
|
+
let res = await this._update(
|
|
1205
|
+
this.svAPIEndpoint,
|
|
1206
|
+
this.supplier._path + `/${id}`,
|
|
1207
|
+
body
|
|
1208
|
+
);
|
|
1209
|
+
return res;
|
|
1210
|
+
},
|
|
1211
|
+
};
|
|
1178
1212
|
this.quickConvertToPdf = {
|
|
1179
1213
|
_path: "/quick-convert-to-pdf",
|
|
1180
1214
|
find: async (params) => {
|
|
@@ -2061,6 +2095,8 @@ Repzo.CommandLog = class {
|
|
|
2061
2095
|
this.processedAt = command_log.processedAt;
|
|
2062
2096
|
this.onGoing = command_log.onGoing || false;
|
|
2063
2097
|
this.trigger = command_log.trigger;
|
|
2098
|
+
this.sync_details = command_log.sync_details;
|
|
2099
|
+
this.error_details = command_log.error_details;
|
|
2064
2100
|
// this.priority = command_log.priority
|
|
2065
2101
|
// ? command_log.priority
|
|
2066
2102
|
// : this.priority
|
|
@@ -2086,10 +2122,12 @@ Repzo.CommandLog = class {
|
|
|
2086
2122
|
} else {
|
|
2087
2123
|
this.error = error;
|
|
2088
2124
|
}
|
|
2089
|
-
this.error_details
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2125
|
+
this.error_details = [
|
|
2126
|
+
{
|
|
2127
|
+
timestamp: Date.now(),
|
|
2128
|
+
error: this.error,
|
|
2129
|
+
},
|
|
2130
|
+
];
|
|
2093
2131
|
return this;
|
|
2094
2132
|
}
|
|
2095
2133
|
switch (status) {
|
|
@@ -2123,7 +2161,12 @@ Repzo.CommandLog = class {
|
|
|
2123
2161
|
setBody(body) {
|
|
2124
2162
|
this.body = body;
|
|
2125
2163
|
if (!this.sync_details) this.sync_details = [];
|
|
2126
|
-
this.sync_details
|
|
2164
|
+
this.sync_details = [
|
|
2165
|
+
{
|
|
2166
|
+
timestamp: Date.now(),
|
|
2167
|
+
body: this.body,
|
|
2168
|
+
},
|
|
2169
|
+
];
|
|
2127
2170
|
return this;
|
|
2128
2171
|
}
|
|
2129
2172
|
setMeta(meta) {
|
|
@@ -2173,13 +2216,15 @@ Repzo.CommandLog = class {
|
|
|
2173
2216
|
return this;
|
|
2174
2217
|
}
|
|
2175
2218
|
addDetail(detail, meta) {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2219
|
+
if (!this.details) this.details = [];
|
|
2220
|
+
this.details = [
|
|
2221
|
+
{
|
|
2222
|
+
timestamp: Date.now(),
|
|
2223
|
+
content: detail,
|
|
2224
|
+
meta,
|
|
2225
|
+
},
|
|
2226
|
+
];
|
|
2180
2227
|
this.message = detail;
|
|
2181
|
-
if (meta) d.meta = meta;
|
|
2182
|
-
this.details.push(d);
|
|
2183
2228
|
return this;
|
|
2184
2229
|
}
|
|
2185
2230
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6766,6 +6766,69 @@ export declare namespace Service {
|
|
|
6766
6766
|
type Result = ReceivingMaterialSchema;
|
|
6767
6767
|
}
|
|
6768
6768
|
}
|
|
6769
|
+
namespace Supplier {
|
|
6770
|
+
interface SupplierSchema {
|
|
6771
|
+
_id: string;
|
|
6772
|
+
name: string;
|
|
6773
|
+
local_name?: string;
|
|
6774
|
+
phone?: string;
|
|
6775
|
+
address?: string;
|
|
6776
|
+
tax_number?: string;
|
|
6777
|
+
type: "individual" | "company";
|
|
6778
|
+
disabled: boolean;
|
|
6779
|
+
company_namespace: string[];
|
|
6780
|
+
createdAt: string;
|
|
6781
|
+
updatedAt: string;
|
|
6782
|
+
}
|
|
6783
|
+
interface CreateBody {
|
|
6784
|
+
name: string;
|
|
6785
|
+
local_name?: string;
|
|
6786
|
+
phone?: string;
|
|
6787
|
+
address?: string;
|
|
6788
|
+
tax_number?: string;
|
|
6789
|
+
type: "individual" | "company";
|
|
6790
|
+
disabled: boolean;
|
|
6791
|
+
company_namespace: string[];
|
|
6792
|
+
}
|
|
6793
|
+
interface UpdateBody {
|
|
6794
|
+
_id?: string;
|
|
6795
|
+
name?: string;
|
|
6796
|
+
local_name?: string;
|
|
6797
|
+
phone?: string;
|
|
6798
|
+
address?: string;
|
|
6799
|
+
tax_number?: string;
|
|
6800
|
+
type?: "individual" | "company";
|
|
6801
|
+
disabled?: boolean;
|
|
6802
|
+
company_namespace?: string[];
|
|
6803
|
+
}
|
|
6804
|
+
namespace Find {
|
|
6805
|
+
type Params = DefaultPaginationQueryParams & {
|
|
6806
|
+
_id?: string[] | string;
|
|
6807
|
+
name?: string;
|
|
6808
|
+
local_name?: string;
|
|
6809
|
+
type?: string;
|
|
6810
|
+
from_updatedAt?: number;
|
|
6811
|
+
[key: string]: any;
|
|
6812
|
+
};
|
|
6813
|
+
interface Result extends DefaultPaginationResult {
|
|
6814
|
+
data: SupplierSchema[];
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
namespace Get {
|
|
6818
|
+
type ID = string;
|
|
6819
|
+
interface Params {}
|
|
6820
|
+
type Result = SupplierSchema;
|
|
6821
|
+
}
|
|
6822
|
+
namespace Create {
|
|
6823
|
+
type Body = CreateBody;
|
|
6824
|
+
type Result = SupplierSchema;
|
|
6825
|
+
}
|
|
6826
|
+
namespace Update {
|
|
6827
|
+
type ID = string;
|
|
6828
|
+
type Body = UpdateBody;
|
|
6829
|
+
type Result = SupplierSchema;
|
|
6830
|
+
}
|
|
6831
|
+
}
|
|
6769
6832
|
namespace Cycle {
|
|
6770
6833
|
type CycleStatus = "pending" | "approved" | "processing" | "rejected";
|
|
6771
6834
|
export interface Schema {
|
|
@@ -7519,6 +7582,18 @@ export declare namespace Service {
|
|
|
7519
7582
|
onGoing?: boolean;
|
|
7520
7583
|
retries?: number;
|
|
7521
7584
|
trigger?: string;
|
|
7585
|
+
sync_details: {
|
|
7586
|
+
timestamp: number;
|
|
7587
|
+
body: {
|
|
7588
|
+
[key: string]: any;
|
|
7589
|
+
};
|
|
7590
|
+
}[];
|
|
7591
|
+
error_details: {
|
|
7592
|
+
timestamp: number;
|
|
7593
|
+
error: {
|
|
7594
|
+
[key: string]: any;
|
|
7595
|
+
};
|
|
7596
|
+
}[];
|
|
7522
7597
|
createdAt: string;
|
|
7523
7598
|
updatedAt: string;
|
|
7524
7599
|
__v: number;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1689,6 +1689,51 @@ export default class Repzo {
|
|
|
1689
1689
|
);
|
|
1690
1690
|
},
|
|
1691
1691
|
};
|
|
1692
|
+
supplier = {
|
|
1693
|
+
_path: "/supplier",
|
|
1694
|
+
find: async (
|
|
1695
|
+
params?: Service.Supplier.Find.Params
|
|
1696
|
+
): Promise<Service.Supplier.Find.Result> => {
|
|
1697
|
+
let res: Service.Supplier.Find.Result = await this._fetch(
|
|
1698
|
+
this.svAPIEndpoint,
|
|
1699
|
+
this.supplier._path,
|
|
1700
|
+
params
|
|
1701
|
+
);
|
|
1702
|
+
return res;
|
|
1703
|
+
},
|
|
1704
|
+
get: async (
|
|
1705
|
+
id: Service.Supplier.Get.ID,
|
|
1706
|
+
params?: Service.Supplier.Get.Params
|
|
1707
|
+
): Promise<Service.Supplier.Get.Result> => {
|
|
1708
|
+
return await this._fetch(
|
|
1709
|
+
this.svAPIEndpoint,
|
|
1710
|
+
this.supplier._path + `/${id}`,
|
|
1711
|
+
params
|
|
1712
|
+
);
|
|
1713
|
+
},
|
|
1714
|
+
create: async (
|
|
1715
|
+
body: Service.Supplier.Create.Body
|
|
1716
|
+
): Promise<Service.Supplier.Create.Result> => {
|
|
1717
|
+
let res = await this._create(
|
|
1718
|
+
this.svAPIEndpoint,
|
|
1719
|
+
this.supplier._path,
|
|
1720
|
+
body
|
|
1721
|
+
);
|
|
1722
|
+
return res;
|
|
1723
|
+
},
|
|
1724
|
+
|
|
1725
|
+
update: async (
|
|
1726
|
+
id: Service.Supplier.Update.ID,
|
|
1727
|
+
body: Service.Supplier.Update.Body
|
|
1728
|
+
): Promise<Service.Supplier.Update.Result> => {
|
|
1729
|
+
let res: Service.Supplier.Update.Result = await this._update(
|
|
1730
|
+
this.svAPIEndpoint,
|
|
1731
|
+
this.supplier._path + `/${id}`,
|
|
1732
|
+
body
|
|
1733
|
+
);
|
|
1734
|
+
return res;
|
|
1735
|
+
},
|
|
1736
|
+
};
|
|
1692
1737
|
|
|
1693
1738
|
quickConvertToPdf = {
|
|
1694
1739
|
_path: "/quick-convert-to-pdf",
|
|
@@ -2837,10 +2882,13 @@ export default class Repzo {
|
|
|
2837
2882
|
} else {
|
|
2838
2883
|
this.error = error;
|
|
2839
2884
|
}
|
|
2840
|
-
this.error_details
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2885
|
+
this.error_details = [
|
|
2886
|
+
{
|
|
2887
|
+
timestamp: Date.now(),
|
|
2888
|
+
error: this.error,
|
|
2889
|
+
},
|
|
2890
|
+
];
|
|
2891
|
+
|
|
2844
2892
|
return this;
|
|
2845
2893
|
}
|
|
2846
2894
|
switch (status) {
|
|
@@ -2874,7 +2922,12 @@ export default class Repzo {
|
|
|
2874
2922
|
setBody(body: any) {
|
|
2875
2923
|
this.body = body;
|
|
2876
2924
|
if (!this.sync_details) this.sync_details = [];
|
|
2877
|
-
this.sync_details
|
|
2925
|
+
this.sync_details = [
|
|
2926
|
+
{
|
|
2927
|
+
timestamp: Date.now(),
|
|
2928
|
+
body: this.body,
|
|
2929
|
+
},
|
|
2930
|
+
];
|
|
2878
2931
|
return this;
|
|
2879
2932
|
}
|
|
2880
2933
|
setMeta(meta: any) {
|
|
@@ -2924,13 +2977,15 @@ export default class Repzo {
|
|
|
2924
2977
|
return this;
|
|
2925
2978
|
}
|
|
2926
2979
|
addDetail(detail: string, meta?: any) {
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2980
|
+
if (!this.details) this.details = [];
|
|
2981
|
+
this.details = [
|
|
2982
|
+
{
|
|
2983
|
+
timestamp: Date.now(),
|
|
2984
|
+
content: detail,
|
|
2985
|
+
meta,
|
|
2986
|
+
},
|
|
2987
|
+
];
|
|
2931
2988
|
this.message = detail;
|
|
2932
|
-
if (meta) d.meta = meta;
|
|
2933
|
-
this.details.push(d);
|
|
2934
2989
|
return this;
|
|
2935
2990
|
}
|
|
2936
2991
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -6768,6 +6768,69 @@ export namespace Service {
|
|
|
6768
6768
|
export type Result = ReceivingMaterialSchema;
|
|
6769
6769
|
}
|
|
6770
6770
|
}
|
|
6771
|
+
export namespace Supplier {
|
|
6772
|
+
export interface SupplierSchema {
|
|
6773
|
+
_id: string;
|
|
6774
|
+
name: string;
|
|
6775
|
+
local_name?: string;
|
|
6776
|
+
phone?: string;
|
|
6777
|
+
address?: string;
|
|
6778
|
+
tax_number?: string;
|
|
6779
|
+
type: "individual" | "company";
|
|
6780
|
+
disabled: boolean;
|
|
6781
|
+
company_namespace: string[];
|
|
6782
|
+
createdAt: string;
|
|
6783
|
+
updatedAt: string;
|
|
6784
|
+
}
|
|
6785
|
+
export interface CreateBody {
|
|
6786
|
+
name: string;
|
|
6787
|
+
local_name?: string;
|
|
6788
|
+
phone?: string;
|
|
6789
|
+
address?: string;
|
|
6790
|
+
tax_number?: string;
|
|
6791
|
+
type: "individual" | "company";
|
|
6792
|
+
disabled: boolean;
|
|
6793
|
+
company_namespace: string[];
|
|
6794
|
+
}
|
|
6795
|
+
export interface UpdateBody {
|
|
6796
|
+
_id?: string;
|
|
6797
|
+
name?: string;
|
|
6798
|
+
local_name?: string;
|
|
6799
|
+
phone?: string;
|
|
6800
|
+
address?: string;
|
|
6801
|
+
tax_number?: string;
|
|
6802
|
+
type?: "individual" | "company";
|
|
6803
|
+
disabled?: boolean;
|
|
6804
|
+
company_namespace?: string[];
|
|
6805
|
+
}
|
|
6806
|
+
export namespace Find {
|
|
6807
|
+
export type Params = DefaultPaginationQueryParams & {
|
|
6808
|
+
_id?: string[] | string;
|
|
6809
|
+
name?: string;
|
|
6810
|
+
local_name?: string;
|
|
6811
|
+
type?: string;
|
|
6812
|
+
from_updatedAt?: number;
|
|
6813
|
+
[key: string]: any; // integration_meta.
|
|
6814
|
+
};
|
|
6815
|
+
export interface Result extends DefaultPaginationResult {
|
|
6816
|
+
data: SupplierSchema[];
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6819
|
+
export namespace Get {
|
|
6820
|
+
export type ID = string;
|
|
6821
|
+
export interface Params {}
|
|
6822
|
+
export type Result = SupplierSchema;
|
|
6823
|
+
}
|
|
6824
|
+
export namespace Create {
|
|
6825
|
+
export type Body = CreateBody;
|
|
6826
|
+
export type Result = SupplierSchema;
|
|
6827
|
+
}
|
|
6828
|
+
export namespace Update {
|
|
6829
|
+
export type ID = string;
|
|
6830
|
+
export type Body = UpdateBody;
|
|
6831
|
+
export type Result = SupplierSchema;
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6771
6834
|
export namespace Cycle {
|
|
6772
6835
|
type CycleStatus = "pending" | "approved" | "processing" | "rejected";
|
|
6773
6836
|
export interface Schema {
|