repzo 1.0.2 → 1.0.3
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/changelog.md +13 -0
- package/package.json +1 -1
- package/tsconfig.json +16 -15
- package/lib/index.d.ts +0 -18
- package/lib/index.js +0 -70
- package/lib/types/index.d.ts +0 -263
- package/lib/types/index.js +0 -1
package/changelog.md
ADDED
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./lib",
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"module": "ES2020",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"moduleResolution": "Node",
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"noImplicitThis": false,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
},
|
|
14
|
+
"ts-node": { "esm": true },
|
|
15
|
+
"include": ["src/**/*"],
|
|
16
|
+
"exclude": ["node_modules", "test/**/*", "**/*.spec.ts"]
|
|
17
|
+
}
|
package/lib/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Service, Options, Headers } from "./types/index";
|
|
2
|
-
export default class Repzo {
|
|
3
|
-
private svAPIEndpoint;
|
|
4
|
-
headers: Headers;
|
|
5
|
-
constructor(apiKey: string, options?: Options);
|
|
6
|
-
private _fetch;
|
|
7
|
-
private _create;
|
|
8
|
-
private _update;
|
|
9
|
-
private _delete;
|
|
10
|
-
client: {
|
|
11
|
-
_path: string;
|
|
12
|
-
find: (params?: Service.Client.Find.Params | undefined) => Promise<Service.Client.Find.Result>;
|
|
13
|
-
get: (id: Service.Client.Get.ID, params?: Service.Client.Get.Params | undefined) => Promise<Service.Client.Get.Result>;
|
|
14
|
-
create: (body: Service.Client.Create.Body) => Promise<Service.Client.Create.Result>;
|
|
15
|
-
update: (id: Service.Client.Update.ID, body: Service.Client.Update.Body) => Promise<Service.Client.Update.Result>;
|
|
16
|
-
remove: (id: Service.Client.Remove.ID) => Promise<Service.Client.Remove.Result>;
|
|
17
|
-
};
|
|
18
|
-
}
|
package/lib/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
export default class Repzo {
|
|
3
|
-
constructor(apiKey, options) {
|
|
4
|
-
this.client = {
|
|
5
|
-
_path: "/client",
|
|
6
|
-
find: async (params) => {
|
|
7
|
-
let res = await this._fetch(this.svAPIEndpoint, this.client._path, params);
|
|
8
|
-
return res;
|
|
9
|
-
},
|
|
10
|
-
get: async (id, params) => {
|
|
11
|
-
return await this._fetch(this.svAPIEndpoint, this.client._path + `/${id}`, params);
|
|
12
|
-
},
|
|
13
|
-
create: async (body) => {
|
|
14
|
-
let res = await this._create(this.svAPIEndpoint, this.client._path, body);
|
|
15
|
-
return res;
|
|
16
|
-
},
|
|
17
|
-
update: async (id, body) => {
|
|
18
|
-
let res = await this._update(this.svAPIEndpoint, this.client._path + `/${id}`, body);
|
|
19
|
-
return res;
|
|
20
|
-
},
|
|
21
|
-
remove: async (id) => {
|
|
22
|
-
let res = await this._delete(this.svAPIEndpoint, this.client._path + `/${id}`);
|
|
23
|
-
return res;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this.svAPIEndpoint =
|
|
27
|
-
!(options === null || options === void 0 ? void 0 : options.env) || (options === null || options === void 0 ? void 0 : options.env) == "production"
|
|
28
|
-
? "https://sv.api.repzo.me"
|
|
29
|
-
: (options === null || options === void 0 ? void 0 : options.env) == "staging"
|
|
30
|
-
? "https://staging.sv.api.repzo.me"
|
|
31
|
-
: (options === null || options === void 0 ? void 0 : options.env) == "local"
|
|
32
|
-
? "http://localhost:3030"
|
|
33
|
-
: "";
|
|
34
|
-
this.headers = {
|
|
35
|
-
"api-key": apiKey,
|
|
36
|
-
"Content-Type": "application/json",
|
|
37
|
-
Accept: "application/json"
|
|
38
|
-
};
|
|
39
|
-
if (options === null || options === void 0 ? void 0 : options.headers)
|
|
40
|
-
Object.assign(this.headers, options.headers);
|
|
41
|
-
}
|
|
42
|
-
async _fetch(baseUrl, path, params) {
|
|
43
|
-
let res = await axios.get(baseUrl + path, {
|
|
44
|
-
params,
|
|
45
|
-
headers: this.headers
|
|
46
|
-
});
|
|
47
|
-
return res.data;
|
|
48
|
-
}
|
|
49
|
-
async _create(baseUrl, path, body, params) {
|
|
50
|
-
let res = await axios.post(baseUrl + path, body, {
|
|
51
|
-
params,
|
|
52
|
-
headers: this.headers
|
|
53
|
-
});
|
|
54
|
-
return res.data;
|
|
55
|
-
}
|
|
56
|
-
async _update(baseUrl, path, body, params) {
|
|
57
|
-
let res = await axios.put(baseUrl + path, body, {
|
|
58
|
-
params,
|
|
59
|
-
headers: this.headers
|
|
60
|
-
});
|
|
61
|
-
return res.data;
|
|
62
|
-
}
|
|
63
|
-
async _delete(baseUrl, path, params) {
|
|
64
|
-
let res = await axios.delete(baseUrl + path, {
|
|
65
|
-
params,
|
|
66
|
-
headers: this.headers
|
|
67
|
-
});
|
|
68
|
-
return res.data;
|
|
69
|
-
}
|
|
70
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
export interface Params {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}
|
|
4
|
-
export interface Data {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface Options {
|
|
8
|
-
env?: "staging" | "local" | "production";
|
|
9
|
-
headers?: {
|
|
10
|
-
[key: string]: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface Headers {
|
|
14
|
-
"api-key": string;
|
|
15
|
-
"Content-Type": string;
|
|
16
|
-
Accept: string;
|
|
17
|
-
[key: string]: string;
|
|
18
|
-
}
|
|
19
|
-
export declare namespace Service {
|
|
20
|
-
namespace Client {
|
|
21
|
-
interface Financials {
|
|
22
|
-
credit_limit?: number;
|
|
23
|
-
}
|
|
24
|
-
type JobType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
|
-
interface JobObject {
|
|
26
|
-
type: JobType[];
|
|
27
|
-
description: string;
|
|
28
|
-
tag: string;
|
|
29
|
-
product_id?: string;
|
|
30
|
-
form_id?: string;
|
|
31
|
-
is_required?: boolean;
|
|
32
|
-
category_id?: string;
|
|
33
|
-
order?: number;
|
|
34
|
-
company_namespace: string[];
|
|
35
|
-
}
|
|
36
|
-
interface ShelfshareTarget {
|
|
37
|
-
msl: string;
|
|
38
|
-
contracted_checkout: number;
|
|
39
|
-
contracted_shelf_length: number;
|
|
40
|
-
total_category_length: number;
|
|
41
|
-
}
|
|
42
|
-
interface RepTarget {
|
|
43
|
-
rep: string;
|
|
44
|
-
target: number;
|
|
45
|
-
classification: string;
|
|
46
|
-
}
|
|
47
|
-
interface ClientSchema {
|
|
48
|
-
_id: string;
|
|
49
|
-
local_name?: string;
|
|
50
|
-
tags?: string[];
|
|
51
|
-
cell_phone?: string;
|
|
52
|
-
city?: string;
|
|
53
|
-
client_code?: string;
|
|
54
|
-
contact_name?: string;
|
|
55
|
-
contact_title?: string;
|
|
56
|
-
country?: string;
|
|
57
|
-
disabled?: boolean;
|
|
58
|
-
formatted_address?: string;
|
|
59
|
-
lat?: number;
|
|
60
|
-
lng?: number;
|
|
61
|
-
location_verified?: boolean;
|
|
62
|
-
name: string;
|
|
63
|
-
phone?: string;
|
|
64
|
-
state?: string;
|
|
65
|
-
zip?: string;
|
|
66
|
-
assigned_to?: string[];
|
|
67
|
-
last_location_update?: number;
|
|
68
|
-
credit_limit?: number;
|
|
69
|
-
tax_number?: string;
|
|
70
|
-
sync_id?: string;
|
|
71
|
-
rep_targets?: RepTarget[];
|
|
72
|
-
shelf_share_targets?: ShelfshareTarget[];
|
|
73
|
-
profile_pic?: string;
|
|
74
|
-
logo?: string;
|
|
75
|
-
website?: string;
|
|
76
|
-
email?: string;
|
|
77
|
-
comment?: string;
|
|
78
|
-
parent_client_id?: string;
|
|
79
|
-
target_visit?: number;
|
|
80
|
-
geofencing_radius?: number;
|
|
81
|
-
price_tag?: string;
|
|
82
|
-
jobs?: JobObject[];
|
|
83
|
-
status?: string;
|
|
84
|
-
job_category?: string[];
|
|
85
|
-
availability_msl?: string[];
|
|
86
|
-
territory?: string;
|
|
87
|
-
sv_priceList?: string;
|
|
88
|
-
assigned_media?: string[];
|
|
89
|
-
assigned_products?: string[];
|
|
90
|
-
assigned_product_groups?: string;
|
|
91
|
-
verifiedUntil?: number;
|
|
92
|
-
financials?: Financials;
|
|
93
|
-
customFields?: {
|
|
94
|
-
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
paymentTerm?: string;
|
|
97
|
-
speciality?: string[];
|
|
98
|
-
company_namespace: string[];
|
|
99
|
-
channel?: string;
|
|
100
|
-
isChain?: boolean;
|
|
101
|
-
chain?: string;
|
|
102
|
-
teams?: string[];
|
|
103
|
-
payment_type: "cash" | "credit";
|
|
104
|
-
integration_meta?: {
|
|
105
|
-
[key: string]: any;
|
|
106
|
-
};
|
|
107
|
-
integrated_client_balance?: number;
|
|
108
|
-
createdAt: string;
|
|
109
|
-
updatedAt: string;
|
|
110
|
-
__v: number;
|
|
111
|
-
}
|
|
112
|
-
interface ClientBody {
|
|
113
|
-
name?: string;
|
|
114
|
-
local_name?: string;
|
|
115
|
-
tags?: string[];
|
|
116
|
-
cell_phone?: string;
|
|
117
|
-
city?: string;
|
|
118
|
-
client_code?: string;
|
|
119
|
-
contact_name?: string;
|
|
120
|
-
contact_title?: string;
|
|
121
|
-
country?: string;
|
|
122
|
-
disabled?: boolean;
|
|
123
|
-
formatted_address?: string;
|
|
124
|
-
lat?: number;
|
|
125
|
-
lng?: number;
|
|
126
|
-
location_verified?: boolean;
|
|
127
|
-
phone?: string;
|
|
128
|
-
state?: string;
|
|
129
|
-
zip?: string;
|
|
130
|
-
assigned_to?: string[];
|
|
131
|
-
last_location_update?: number;
|
|
132
|
-
credit_limit?: number;
|
|
133
|
-
tax_number?: string;
|
|
134
|
-
sync_id?: string;
|
|
135
|
-
rep_targets?: RepTarget[];
|
|
136
|
-
shelf_share_targets?: ShelfshareTarget[];
|
|
137
|
-
profile_pic?: string;
|
|
138
|
-
logo?: string;
|
|
139
|
-
website?: string;
|
|
140
|
-
email?: string;
|
|
141
|
-
comment?: string;
|
|
142
|
-
parent_client_id?: string;
|
|
143
|
-
target_visit?: number;
|
|
144
|
-
geofencing_radius?: number;
|
|
145
|
-
price_tag?: string;
|
|
146
|
-
jobs?: JobObject[];
|
|
147
|
-
status?: string;
|
|
148
|
-
job_category?: string[];
|
|
149
|
-
availability_msl?: string[];
|
|
150
|
-
territory?: string;
|
|
151
|
-
sv_priceList?: string;
|
|
152
|
-
assigned_media?: string[];
|
|
153
|
-
assigned_products?: string[];
|
|
154
|
-
assigned_product_groups?: string;
|
|
155
|
-
verifiedUntil?: number;
|
|
156
|
-
financials?: Financials;
|
|
157
|
-
customFields?: {
|
|
158
|
-
[key: string]: any;
|
|
159
|
-
};
|
|
160
|
-
paymentTerm?: string;
|
|
161
|
-
speciality?: string[];
|
|
162
|
-
company_namespace?: string[];
|
|
163
|
-
channel?: string;
|
|
164
|
-
isChain?: boolean;
|
|
165
|
-
chain?: string;
|
|
166
|
-
teams?: string[];
|
|
167
|
-
payment_type?: "cash" | "credit";
|
|
168
|
-
integration_meta?: {
|
|
169
|
-
[key: string]: any;
|
|
170
|
-
};
|
|
171
|
-
integrated_client_balance?: number;
|
|
172
|
-
}
|
|
173
|
-
type PopulatedKeys = "tags" | "reps" | "assigned_to" | "sv_priceList" | "paymentTerm" | "job_category" | "msl" | "chain" | "channel" | "status" | "product" | "assigned_products" | "assigned_product_groups" | "speciality" | "teams";
|
|
174
|
-
export namespace Find {
|
|
175
|
-
type Params = DefaultPaginationQueryParams & {
|
|
176
|
-
from_updatedAt?: number;
|
|
177
|
-
to_updatedAt?: number;
|
|
178
|
-
from_createdAt?: number;
|
|
179
|
-
to_createdAt?: number;
|
|
180
|
-
createdAt?: number;
|
|
181
|
-
updatedAt?: number;
|
|
182
|
-
name?: string;
|
|
183
|
-
search?: string;
|
|
184
|
-
disabled?: boolean;
|
|
185
|
-
active?: boolean;
|
|
186
|
-
tags?: string[] | string;
|
|
187
|
-
_id?: string[] | string;
|
|
188
|
-
assigned_to?: string[] | string;
|
|
189
|
-
availability_msl?: string[] | string;
|
|
190
|
-
status?: string[] | string;
|
|
191
|
-
CLIENT_TAGS?: string[] | string;
|
|
192
|
-
AREA_TAGS?: string[] | string;
|
|
193
|
-
isChain?: boolean;
|
|
194
|
-
chain?: string[] | string;
|
|
195
|
-
channel?: string[] | string;
|
|
196
|
-
city?: string[] | string;
|
|
197
|
-
client_code?: string[] | string;
|
|
198
|
-
country?: string[] | string;
|
|
199
|
-
location_verified?: boolean;
|
|
200
|
-
state?: string[] | string;
|
|
201
|
-
sv_priceList?: string[] | string;
|
|
202
|
-
assigned_media?: string[] | string;
|
|
203
|
-
assigned_products?: string[] | string;
|
|
204
|
-
teams?: string[] | string;
|
|
205
|
-
integrated_client_balance?: number;
|
|
206
|
-
tax_number?: string;
|
|
207
|
-
speciality?: string[] | string;
|
|
208
|
-
assigned_product_groups?: string[] | string;
|
|
209
|
-
populatedKeys?: PopulatedKeys[];
|
|
210
|
-
};
|
|
211
|
-
interface Result extends DefaultPaginationResult {
|
|
212
|
-
data: ClientSchema[];
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
export namespace Get {
|
|
216
|
-
type ID = string;
|
|
217
|
-
interface Params {
|
|
218
|
-
populatedKeys: PopulatedKeys[];
|
|
219
|
-
}
|
|
220
|
-
type Result = ClientSchema;
|
|
221
|
-
}
|
|
222
|
-
export namespace Create {
|
|
223
|
-
interface Body extends ClientBody {
|
|
224
|
-
name: string;
|
|
225
|
-
}
|
|
226
|
-
type Result = ClientSchema;
|
|
227
|
-
}
|
|
228
|
-
export namespace Update {
|
|
229
|
-
type ID = string;
|
|
230
|
-
interface Body extends ClientBody {
|
|
231
|
-
_id?: string;
|
|
232
|
-
createdAt?: string;
|
|
233
|
-
updatedAt?: string;
|
|
234
|
-
__v?: number;
|
|
235
|
-
}
|
|
236
|
-
type Result = ClientSchema;
|
|
237
|
-
}
|
|
238
|
-
export namespace Remove {
|
|
239
|
-
type ID = string;
|
|
240
|
-
type Result = ClientSchema;
|
|
241
|
-
}
|
|
242
|
-
export {};
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
export interface DefaultPaginationQueryParams {
|
|
246
|
-
per_page?: number;
|
|
247
|
-
page?: number;
|
|
248
|
-
sort?: "name" | "client_code" | "createdAt" | "updatedAt";
|
|
249
|
-
sortPageOrder?: "asc" | "dsc";
|
|
250
|
-
}
|
|
251
|
-
export interface DefaultPaginationResult {
|
|
252
|
-
total_result: number;
|
|
253
|
-
current_count: number;
|
|
254
|
-
total_pages: number;
|
|
255
|
-
current_page: number;
|
|
256
|
-
per_page: number;
|
|
257
|
-
first_page_url: string;
|
|
258
|
-
last_page_url: string;
|
|
259
|
-
next_page_url: string | null;
|
|
260
|
-
prev_page_url: string | null;
|
|
261
|
-
path: string;
|
|
262
|
-
data: any[];
|
|
263
|
-
}
|
package/lib/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|