@longvansoftware/service-js-client 1.0.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/README.md +93 -0
- package/dist/config/config.d.ts +26 -0
- package/dist/config/config.js +29 -0
- package/dist/src/graphql/auth/mutations.d.ts +7 -0
- package/dist/src/graphql/auth/mutations.js +99 -0
- package/dist/src/graphql/auth/queries.d.ts +1 -0
- package/dist/src/graphql/auth/queries.js +25 -0
- package/dist/src/graphql/cloud/mutations.d.ts +8 -0
- package/dist/src/graphql/cloud/mutations.js +115 -0
- package/dist/src/graphql/cloud/queries.d.ts +5 -0
- package/dist/src/graphql/cloud/queries.js +121 -0
- package/dist/src/graphql/computing/mutations.d.ts +10 -0
- package/dist/src/graphql/computing/mutations.js +110 -0
- package/dist/src/graphql/computing/queries.d.ts +3 -0
- package/dist/src/graphql/computing/queries.js +48 -0
- package/dist/src/graphql/crm/mutations.d.ts +8 -0
- package/dist/src/graphql/crm/mutations.js +316 -0
- package/dist/src/graphql/crm/queries.d.ts +7 -0
- package/dist/src/graphql/crm/queries.js +281 -0
- package/dist/src/graphql/payment/mutations.d.ts +1 -0
- package/dist/src/graphql/payment/mutations.js +35 -0
- package/dist/src/graphql/payment/queries.d.ts +2 -0
- package/dist/src/graphql/payment/queries.js +23 -0
- package/dist/src/graphql/product/mutations.d.ts +0 -0
- package/dist/src/graphql/product/mutations.js +1 -0
- package/dist/src/graphql/product/queries.d.ts +11 -0
- package/dist/src/graphql/product/queries.js +431 -0
- package/dist/src/graphql/service/mutations.d.ts +10 -0
- package/dist/src/graphql/service/mutations.js +284 -0
- package/dist/src/graphql/service/queries.d.ts +6 -0
- package/dist/src/graphql/service/queries.js +174 -0
- package/dist/src/graphql/user/mutations.d.ts +4 -0
- package/dist/src/graphql/user/mutations.js +118 -0
- package/dist/src/graphql/user/queries.d.ts +13 -0
- package/dist/src/graphql/user/queries.js +252 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/lib/SDK.d.ts +42 -0
- package/dist/src/lib/SDK.js +71 -0
- package/dist/src/lib/auth/index.d.ts +27 -0
- package/dist/src/lib/auth/index.js +72 -0
- package/dist/src/lib/cloud/index.d.ts +25 -0
- package/dist/src/lib/cloud/index.js +248 -0
- package/dist/src/lib/computing/index.d.ts +25 -0
- package/dist/src/lib/computing/index.js +254 -0
- package/dist/src/lib/crm/index.d.ts +21 -0
- package/dist/src/lib/crm/index.js +296 -0
- package/dist/src/lib/order/index.d.ts +452 -0
- package/dist/src/lib/order/index.js +1204 -0
- package/dist/src/lib/payment/index.d.ts +7 -0
- package/dist/src/lib/payment/index.js +69 -0
- package/dist/src/lib/product/index.d.ts +37 -0
- package/dist/src/lib/product/index.js +132 -0
- package/dist/src/lib/service/index.d.ts +94 -0
- package/dist/src/lib/service/index.js +348 -0
- package/dist/src/lib/service.d.ts +14 -0
- package/dist/src/lib/service.js +101 -0
- package/dist/src/lib/serviceSDK.d.ts +18 -0
- package/dist/src/lib/serviceSDK.js +187 -0
- package/dist/src/lib/user/index.d.ts +23 -0
- package/dist/src/lib/user/index.js +345 -0
- package/dist/src/lib/warehouse/index.d.ts +20 -0
- package/dist/src/lib/warehouse/index.js +48 -0
- package/dist/src/types/auth.d.ts +82 -0
- package/dist/src/types/auth.js +2 -0
- package/dist/src/types/cloud.d.ts +40 -0
- package/dist/src/types/cloud.js +2 -0
- package/dist/src/types/computing.d.ts +16 -0
- package/dist/src/types/computing.js +2 -0
- package/dist/src/types/crm.d.ts +291 -0
- package/dist/src/types/crm.js +2 -0
- package/dist/src/types/order.d.ts +54 -0
- package/dist/src/types/order.js +2 -0
- package/dist/src/types/product.d.ts +63 -0
- package/dist/src/types/product.js +2 -0
- package/dist/src/types/service.d.ts +29 -0
- package/dist/src/types/service.js +2 -0
- package/dist/src/types/user.d.ts +95 -0
- package/dist/src/types/user.js +2 -0
- package/dist/src/types/warehouse.d.ts +5 -0
- package/dist/src/types/warehouse.js +2 -0
- package/dist/src/utils/helpers.d.ts +4 -0
- package/dist/src/utils/helpers.js +41 -0
- package/package.json +43 -0
@@ -0,0 +1,252 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
5
|
+
exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
|
6
|
+
query GetPersonByIds($partyIds: [String!]!) {
|
7
|
+
getPersonByPartyIds(partyIds: $partyIds) {
|
8
|
+
status
|
9
|
+
partyId
|
10
|
+
fullName
|
11
|
+
phone
|
12
|
+
address
|
13
|
+
gender
|
14
|
+
birthDate
|
15
|
+
email
|
16
|
+
personalTitle
|
17
|
+
imageUrl
|
18
|
+
identityNumber
|
19
|
+
id
|
20
|
+
addressModel {
|
21
|
+
id
|
22
|
+
addressInfo
|
23
|
+
provinceGeoId
|
24
|
+
districtGeoId
|
25
|
+
wardGeoId
|
26
|
+
provinceName
|
27
|
+
districtName
|
28
|
+
wardName
|
29
|
+
isDefault
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
`;
|
34
|
+
exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
|
35
|
+
query SearchCompany($keyword: String, $orgId: String!, $limit: Int) {
|
36
|
+
searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
|
37
|
+
id
|
38
|
+
name
|
39
|
+
address
|
40
|
+
gender
|
41
|
+
identityNumber
|
42
|
+
birthDate
|
43
|
+
email
|
44
|
+
phone
|
45
|
+
createdStamp
|
46
|
+
createdBy
|
47
|
+
memberLevel
|
48
|
+
}
|
49
|
+
}
|
50
|
+
`;
|
51
|
+
exports.GET_CUSTOMER_BY_ID = (0, graphql_tag_1.gql) `
|
52
|
+
query GetCustomerById($id: String!) {
|
53
|
+
getCustomerById(id: $id) {
|
54
|
+
id
|
55
|
+
name
|
56
|
+
address
|
57
|
+
gender
|
58
|
+
identityNumber
|
59
|
+
birthDate
|
60
|
+
email
|
61
|
+
phone
|
62
|
+
createdStamp
|
63
|
+
createdBy
|
64
|
+
memberLevel
|
65
|
+
}
|
66
|
+
}
|
67
|
+
`;
|
68
|
+
exports.SEARCH_CUSTOMER = (0, graphql_tag_1.gql) `
|
69
|
+
query SearchCustomers(
|
70
|
+
$keyword: String
|
71
|
+
$type: String
|
72
|
+
$startCreatedDate: DateCustom
|
73
|
+
$endCreatedDate: DateCustom
|
74
|
+
$memberLevel: String
|
75
|
+
$partnerId: String!
|
76
|
+
$currentPage: Int!
|
77
|
+
$pageSize: Int!
|
78
|
+
) {
|
79
|
+
searchCustomers(
|
80
|
+
keyword: $keyword
|
81
|
+
type: $type
|
82
|
+
startCreatedDate: $startCreatedDate
|
83
|
+
endCreatedDate: $endCreatedDate
|
84
|
+
memberLevel: $memberLevel
|
85
|
+
partnerId: $partnerId
|
86
|
+
currentPage: $currentPage
|
87
|
+
pageSize: $pageSize
|
88
|
+
) {
|
89
|
+
totalPages
|
90
|
+
totalElements
|
91
|
+
currentPage
|
92
|
+
content {
|
93
|
+
id
|
94
|
+
name
|
95
|
+
address
|
96
|
+
gender
|
97
|
+
identityNumber
|
98
|
+
birthDate
|
99
|
+
email
|
100
|
+
phone
|
101
|
+
createdStamp
|
102
|
+
createdBy
|
103
|
+
memberLevel
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
`;
|
108
|
+
exports.SEARCH_EMPLOYEES = (0, graphql_tag_1.gql) `
|
109
|
+
query SearchEmployees($keyword: String, $positionShortName: String, $partnerId: String) {
|
110
|
+
searchEmployees(
|
111
|
+
keyword: $keyword
|
112
|
+
positionShortName: $positionShortName
|
113
|
+
partnerId: $partnerId
|
114
|
+
) {
|
115
|
+
id
|
116
|
+
name
|
117
|
+
address
|
118
|
+
gender
|
119
|
+
identityNumber
|
120
|
+
birthDate
|
121
|
+
email
|
122
|
+
phone
|
123
|
+
createdStamp
|
124
|
+
createdBy
|
125
|
+
memberLevel
|
126
|
+
}
|
127
|
+
}
|
128
|
+
`;
|
129
|
+
exports.GET_POSTIONS_BY_EMPLOYEES_ID = (0, graphql_tag_1.gql) `
|
130
|
+
query GetPositionsByEmployeeId($employeeId: String!, $partnerId: String!) {
|
131
|
+
getPositionsByEmployeeId(employeeId: $employeeId, partnerId: $partnerId)
|
132
|
+
}
|
133
|
+
`;
|
134
|
+
exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = (0, graphql_tag_1.gql) `
|
135
|
+
query GetStoreChannelIdsByEmployeeId($employeeId: String!, $partnerId: String!) {
|
136
|
+
getStoreChannelIdsByEmployeeId(employeeId: $employeeId, partnerId: $partnerId)
|
137
|
+
}
|
138
|
+
`;
|
139
|
+
exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = (0, graphql_tag_1.gql) `
|
140
|
+
query GetEmployeesByStoreChannelId($storeChannelId: String!, $partnerId: String!) {
|
141
|
+
getEmployeesByStoreChannelId(storeChannelId: $storeChannelId, partnerId: $partnerId) {
|
142
|
+
id
|
143
|
+
name
|
144
|
+
address
|
145
|
+
gender
|
146
|
+
identityNumber
|
147
|
+
birthDate
|
148
|
+
email
|
149
|
+
phone
|
150
|
+
createdStamp
|
151
|
+
createdBy
|
152
|
+
memberLevel
|
153
|
+
}
|
154
|
+
}
|
155
|
+
`;
|
156
|
+
exports.GET_COMPANY_BY_CONTACT_INFO_ID = (0, graphql_tag_1.gql) `
|
157
|
+
query GetCompanyByContactInfoId($contactId: String!, $partnerId: String!) {
|
158
|
+
getCompanyByContactInfoId(contactId: $contactId, partnerId: $partnerId) {
|
159
|
+
id
|
160
|
+
name
|
161
|
+
address
|
162
|
+
gender
|
163
|
+
identityNumber
|
164
|
+
birthDate
|
165
|
+
email
|
166
|
+
phone
|
167
|
+
createdStamp
|
168
|
+
createdBy
|
169
|
+
memberLevel
|
170
|
+
}
|
171
|
+
}
|
172
|
+
`;
|
173
|
+
exports.GET_CONTACT_INFOS_BY_COMPANY_ID = (0, graphql_tag_1.gql) `
|
174
|
+
query GetContactInfosByCompanyId($companyId: String!, $partnerId: String!) {
|
175
|
+
getContactInfosByCompanyId(companyId: $companyId, partnerId: $partnerId) {
|
176
|
+
id
|
177
|
+
name
|
178
|
+
address
|
179
|
+
gender
|
180
|
+
identityNumber
|
181
|
+
birthDate
|
182
|
+
email
|
183
|
+
phone
|
184
|
+
createdStamp
|
185
|
+
createdBy
|
186
|
+
memberLevel
|
187
|
+
}
|
188
|
+
}
|
189
|
+
`;
|
190
|
+
exports.GET_PROVINCES = (0, graphql_tag_1.gql) `
|
191
|
+
query GetProvinces {
|
192
|
+
getProvinces {
|
193
|
+
geoId
|
194
|
+
geoTypeId
|
195
|
+
geoName
|
196
|
+
geoNameLocal
|
197
|
+
geoCode
|
198
|
+
geoSecCode
|
199
|
+
abbreviation
|
200
|
+
vnPostId
|
201
|
+
jtExpressId
|
202
|
+
vnPostRegion
|
203
|
+
inetId
|
204
|
+
lastUpdatedStamp
|
205
|
+
lastUpdatedTxStamp
|
206
|
+
createdStamp
|
207
|
+
createdTxStamp
|
208
|
+
}
|
209
|
+
}
|
210
|
+
`;
|
211
|
+
exports.GET_DISTRICTS = (0, graphql_tag_1.gql) `
|
212
|
+
query GetDistricts($provinceId: String!) {
|
213
|
+
getDistricts(provinceId: $provinceId) {
|
214
|
+
geoId
|
215
|
+
geoTypeId
|
216
|
+
geoName
|
217
|
+
geoNameLocal
|
218
|
+
geoCode
|
219
|
+
geoSecCode
|
220
|
+
abbreviation
|
221
|
+
vnPostId
|
222
|
+
jtExpressId
|
223
|
+
vnPostRegion
|
224
|
+
inetId
|
225
|
+
lastUpdatedStamp
|
226
|
+
lastUpdatedTxStamp
|
227
|
+
createdStamp
|
228
|
+
createdTxStamp
|
229
|
+
}
|
230
|
+
}
|
231
|
+
`;
|
232
|
+
exports.GET_WARDS = (0, graphql_tag_1.gql) `
|
233
|
+
query GetWards($districtId: String!) {
|
234
|
+
getWards(districtId: $districtId) {
|
235
|
+
geoId
|
236
|
+
geoTypeId
|
237
|
+
geoName
|
238
|
+
geoNameLocal
|
239
|
+
geoCode
|
240
|
+
geoSecCode
|
241
|
+
abbreviation
|
242
|
+
vnPostId
|
243
|
+
jtExpressId
|
244
|
+
vnPostRegion
|
245
|
+
inetId
|
246
|
+
lastUpdatedStamp
|
247
|
+
lastUpdatedTxStamp
|
248
|
+
createdStamp
|
249
|
+
createdTxStamp
|
250
|
+
}
|
251
|
+
}
|
252
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { SDK } from './lib/SDK';
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { ProductService } from "../lib/product/index";
|
2
|
+
import { AuthService } from "../lib/auth/index";
|
3
|
+
import { OrderService } from "../lib/order/index";
|
4
|
+
import { ServiceManagementService } from "./service/index";
|
5
|
+
import { UserService } from "../lib/user/index";
|
6
|
+
import { PaymentService } from "../lib/payment/index";
|
7
|
+
import { CrmService } from "../lib/crm/index";
|
8
|
+
import { WarehouseService } from "../lib/warehouse/index";
|
9
|
+
import { ComputingService } from "../lib/computing/index";
|
10
|
+
import { CloudService } from "./cloud";
|
11
|
+
export interface Endpoints {
|
12
|
+
product: string;
|
13
|
+
crm: string;
|
14
|
+
auth: string;
|
15
|
+
order: string;
|
16
|
+
user: string;
|
17
|
+
payment: string;
|
18
|
+
service: string;
|
19
|
+
warehouse: string;
|
20
|
+
computing: string;
|
21
|
+
cloud: string;
|
22
|
+
}
|
23
|
+
export declare class SDK {
|
24
|
+
orgId: string;
|
25
|
+
storeId: string;
|
26
|
+
storefrontAccessToken: string;
|
27
|
+
environment: string;
|
28
|
+
product: ProductService;
|
29
|
+
auth: AuthService;
|
30
|
+
order: OrderService;
|
31
|
+
user: UserService;
|
32
|
+
payment: PaymentService;
|
33
|
+
crm: CrmService;
|
34
|
+
service: ServiceManagementService;
|
35
|
+
warehouse: WarehouseService;
|
36
|
+
computing: ComputingService;
|
37
|
+
cloud: CloudService;
|
38
|
+
token: string | null;
|
39
|
+
constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
|
40
|
+
setToken(token: string): void;
|
41
|
+
setStoreId(storeId: string): void;
|
42
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SDK = void 0;
|
4
|
+
// src/SDK.ts
|
5
|
+
const index_1 = require("../lib/product/index");
|
6
|
+
const index_2 = require("../lib/auth/index");
|
7
|
+
const index_3 = require("../lib/order/index");
|
8
|
+
const index_4 = require("./service/index");
|
9
|
+
const index_5 = require("../lib/user/index");
|
10
|
+
const config_1 = require("../../config/config");
|
11
|
+
const helpers_1 = require("../utils/helpers");
|
12
|
+
const index_6 = require("../lib/payment/index");
|
13
|
+
const index_7 = require("../lib/crm/index");
|
14
|
+
const index_8 = require("../lib/warehouse/index");
|
15
|
+
const index_9 = require("../lib/computing/index");
|
16
|
+
const cloud_1 = require("./cloud");
|
17
|
+
class SDK {
|
18
|
+
constructor(orgId, storeId, storefrontAccessToken, environment) {
|
19
|
+
this.orgId = orgId;
|
20
|
+
this.storeId = storeId;
|
21
|
+
this.storefrontAccessToken = storefrontAccessToken;
|
22
|
+
this.environment = environment;
|
23
|
+
this.token = null;
|
24
|
+
(0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
|
25
|
+
const endpoints = environment == "live"
|
26
|
+
? config_1.environmentEndpoints.live
|
27
|
+
: config_1.environmentEndpoints.dev;
|
28
|
+
//console.log("🚀 ~ SDK ~ endpoints:", endpoints.computing);
|
29
|
+
this.product = new index_1.ProductService(endpoints.product, orgId, storeId);
|
30
|
+
this.auth = new index_2.AuthService(endpoints.auth, orgId, storeId);
|
31
|
+
this.order = new index_3.OrderService(endpoints.order, orgId, storeId);
|
32
|
+
this.user = new index_5.UserService(endpoints.user, orgId, storeId);
|
33
|
+
this.payment = new index_6.PaymentService(endpoints.payment, orgId, storeId);
|
34
|
+
this.crm = new index_7.CrmService(endpoints.crm, orgId, storeId);
|
35
|
+
this.service = new index_4.ServiceManagementService(endpoints.service, orgId, storeId);
|
36
|
+
this.warehouse = new index_8.WarehouseService(endpoints.warehouse, orgId, storeId);
|
37
|
+
this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
|
38
|
+
this.cloud = new cloud_1.CloudService(endpoints.cloud, orgId, storeId);
|
39
|
+
// Initialize other services here
|
40
|
+
}
|
41
|
+
setToken(token) {
|
42
|
+
this.token = token;
|
43
|
+
// Also set the token in each service
|
44
|
+
this.product.setToken(token);
|
45
|
+
this.auth.setToken(token);
|
46
|
+
this.order.setToken(token);
|
47
|
+
this.user.setToken(token);
|
48
|
+
this.payment.setToken(token);
|
49
|
+
this.crm.setToken(token);
|
50
|
+
this.service.setToken(token);
|
51
|
+
this.warehouse.setToken(token);
|
52
|
+
this.computing.setToken(token);
|
53
|
+
this.cloud.setToken(token);
|
54
|
+
// Set token for other services here
|
55
|
+
}
|
56
|
+
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
57
|
+
// src/service.ts
|
58
|
+
setStoreId(storeId) {
|
59
|
+
this.storeId = storeId;
|
60
|
+
this.product.setStoreId(storeId);
|
61
|
+
this.auth.setStoreId(storeId);
|
62
|
+
this.order.setStoreId(storeId);
|
63
|
+
this.user.setStoreId(storeId);
|
64
|
+
this.payment.setStoreId(storeId);
|
65
|
+
this.crm.setStoreId(storeId);
|
66
|
+
this.service.setStoreId(storeId);
|
67
|
+
this.warehouse.setStoreId(storeId);
|
68
|
+
// Set storeId for other services here
|
69
|
+
}
|
70
|
+
}
|
71
|
+
exports.SDK = SDK;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { Service } from "../serviceSDK";
|
2
|
+
import { LoginRequest, LoginResponse, RegisterRequest } from "../../types/auth";
|
3
|
+
/**
|
4
|
+
* Represents the authentication service.
|
5
|
+
*/
|
6
|
+
export declare class AuthService extends Service {
|
7
|
+
/**
|
8
|
+
* Constructs a new ProductService instance.
|
9
|
+
* @param endpoint - The endpoint URL for the service.
|
10
|
+
* @param orgId - The organization ID.
|
11
|
+
* @param storeId - The store ID.
|
12
|
+
*/
|
13
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
14
|
+
/**
|
15
|
+
* Logs in a user with the provided login request.
|
16
|
+
* @param loginRequest - The login request object.
|
17
|
+
* @returns A promise that resolves to the login response.
|
18
|
+
*/
|
19
|
+
login(loginRequest: LoginRequest): Promise<LoginResponse>;
|
20
|
+
/**
|
21
|
+
* Registers a new user with the provided register request.
|
22
|
+
* @param registerRequest - The register request object.
|
23
|
+
* @returns A promise that resolves when the registration is successful.
|
24
|
+
*/
|
25
|
+
register(registerRequest: RegisterRequest): Promise<void>;
|
26
|
+
getUserDetail(accessToken: string): Promise<any>;
|
27
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.AuthService = void 0;
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
14
|
+
const mutations_1 = require("../../graphql/auth/mutations");
|
15
|
+
const queries_1 = require("../../graphql/auth/queries");
|
16
|
+
/**
|
17
|
+
* Represents the authentication service.
|
18
|
+
*/
|
19
|
+
class AuthService extends serviceSDK_1.Service {
|
20
|
+
/**
|
21
|
+
* Constructs a new ProductService instance.
|
22
|
+
* @param endpoint - The endpoint URL for the service.
|
23
|
+
* @param orgId - The organization ID.
|
24
|
+
* @param storeId - The store ID.
|
25
|
+
*/
|
26
|
+
constructor(endpoint, orgId, storeId) {
|
27
|
+
super(endpoint, orgId, storeId);
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Logs in a user with the provided login request.
|
31
|
+
* @param loginRequest - The login request object.
|
32
|
+
* @returns A promise that resolves to the login response.
|
33
|
+
*/
|
34
|
+
login(loginRequest) {
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
36
|
+
const variables = {
|
37
|
+
loginRequest: Object.assign({ orgId: this.orgId }, loginRequest),
|
38
|
+
};
|
39
|
+
const data = yield this.graphqlMutation(mutations_1.LOGIN_MUTATION, variables);
|
40
|
+
return data.login;
|
41
|
+
});
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Registers a new user with the provided register request.
|
45
|
+
* @param registerRequest - The register request object.
|
46
|
+
* @returns A promise that resolves when the registration is successful.
|
47
|
+
*/
|
48
|
+
register(registerRequest) {
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
50
|
+
const variables = { registerRequest };
|
51
|
+
yield this.graphqlMutation(mutations_1.REGISTER_MUTATION, variables);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
getUserDetail(accessToken) {
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
56
|
+
const query = queries_1.GET_USER_DETAIL;
|
57
|
+
const variables = {
|
58
|
+
orgId: this.orgId,
|
59
|
+
accessToken,
|
60
|
+
};
|
61
|
+
try {
|
62
|
+
const response = yield this.graphqlQuery(query, variables);
|
63
|
+
return response.getUserDetail;
|
64
|
+
}
|
65
|
+
catch (error) {
|
66
|
+
console.log(`Error in getUserDetail: ${error}`);
|
67
|
+
throw error;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
exports.AuthService = AuthService;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { CreateUserMailHosting, DeleteUserPassword, Filter, UpdateInforMationService, UpdateUserPassword } from "../../types/cloud";
|
2
|
+
import { Service } from "../serviceSDK";
|
3
|
+
export declare class CloudService extends Service {
|
4
|
+
/**
|
5
|
+
* Constructs a new OrderService instance.
|
6
|
+
* @param endpoint - The endpoint URL for the service.
|
7
|
+
* @param orgId - The organization ID.
|
8
|
+
* @param storeId - The store ID.
|
9
|
+
*/
|
10
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
11
|
+
setToken(token: string): void;
|
12
|
+
serviceDetail(serviceId: string): Promise<any>;
|
13
|
+
getMailResource(serviceId: string): Promise<any>;
|
14
|
+
changeServiceName(serviceId: string, updateBy: string, name: string): Promise<any>;
|
15
|
+
getUserMailHosting(serviceId: string): Promise<any>;
|
16
|
+
createUserMailHosting(payload: CreateUserMailHosting): Promise<any>;
|
17
|
+
updateUserPassword(payload: UpdateUserPassword): Promise<any>;
|
18
|
+
deleteUserMailHosting(payload: DeleteUserPassword): Promise<any>;
|
19
|
+
updateDomainName(payload: UpdateInforMationService): Promise<any>;
|
20
|
+
updateUsername(payload: UpdateInforMationService): Promise<any>;
|
21
|
+
updatePassword(payload: UpdateInforMationService): Promise<any>;
|
22
|
+
serviceTypes(): Promise<any>;
|
23
|
+
searchService(filter: Filter): Promise<any>;
|
24
|
+
updateDNS(payload: {}): Promise<any>;
|
25
|
+
}
|