@longvansoftware/storefront-js-client 1.5.2 → 1.5.5

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.
@@ -65,7 +65,7 @@ export declare class OrderService extends Service {
65
65
  /**
66
66
  * Updates the customer and shipping address for an order.
67
67
  * @param orderId - The ID of the order.
68
- * @param customerData - The data for the customer.
68
+ * @param customerId - The data for the customer.
69
69
  * @param shippingAddress - The shipping address.
70
70
  * @returns A promise that resolves when the customer and shipping address are updated.
71
71
  * @throws If an error occurs while updating the customer and shipping address.
@@ -158,7 +158,7 @@ class OrderService extends serviceSDK_1.Service {
158
158
  /**
159
159
  * Updates the customer and shipping address for an order.
160
160
  * @param orderId - The ID of the order.
161
- * @param customerData - The data for the customer.
161
+ * @param customerId - The data for the customer.
162
162
  * @param shippingAddress - The shipping address.
163
163
  * @returns A promise that resolves when the customer and shipping address are updated.
164
164
  * @throws If an error occurs while updating the customer and shipping address.
@@ -168,7 +168,7 @@ class OrderService extends serviceSDK_1.Service {
168
168
  const endpoint = `/orders/FOX/${orderId}/customer`;
169
169
  const method = "PUT";
170
170
  const requestData = {
171
- customerId: customerData,
171
+ customerId: customerId,
172
172
  shippingAddressId: shippingAddress,
173
173
  };
174
174
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.5.2",
3
+ "version": "1.5.5",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -1,8 +0,0 @@
1
- export declare const CHANGE_SERVICE_NAME: import("graphql").DocumentNode;
2
- export declare const CREATE_USER_MAIL_HOSTING: import("graphql").DocumentNode;
3
- export declare const DELETE_USER_MAIL_HOSTING: import("graphql").DocumentNode;
4
- export declare const UPDATE_DOMAIN_NAME: import("graphql").DocumentNode;
5
- export declare const UPDATE_USER_NAME: import("graphql").DocumentNode;
6
- export declare const UPDATE_PASSWORD: import("graphql").DocumentNode;
7
- export declare const UPDATE_USER_PASSWORD: import("graphql").DocumentNode;
8
- export declare const UPDATE_DNS: import("graphql").DocumentNode;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPDATE_DNS = exports.UPDATE_USER_PASSWORD = exports.UPDATE_PASSWORD = exports.UPDATE_USER_NAME = exports.UPDATE_DOMAIN_NAME = exports.DELETE_USER_MAIL_HOSTING = exports.CREATE_USER_MAIL_HOSTING = exports.CHANGE_SERVICE_NAME = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- exports.CHANGE_SERVICE_NAME = (0, graphql_tag_1.gql) `
6
- mutation ChangeServiceName(
7
- $serviceId: String!
8
- $updateBy: String!
9
- $name: String!
10
- ) {
11
- changeServiceName(serviceId: $serviceId, updateBy: $updateBy, name: $name) {
12
- partnerId
13
- status
14
- ownerId
15
- startDate
16
- endDate
17
- actionRequest {
18
- id
19
- name
20
- uri
21
- }
22
- }
23
- }
24
- `;
25
- exports.CREATE_USER_MAIL_HOSTING = (0, graphql_tag_1.gql) `
26
- mutation CreateUserMailHosting(
27
- $serviceId: String!
28
- $username: String!
29
- $password: String!
30
- $fullName: String!
31
- ) {
32
- createUserMailHosting(
33
- serviceId: $serviceId
34
- username: $username
35
- password: $password
36
- fullName: $fullName
37
- )
38
- }
39
- `;
40
- exports.DELETE_USER_MAIL_HOSTING = (0, graphql_tag_1.gql) `
41
- mutation DeleteUserMailHosting($serviceId: String!, $username: String!) {
42
- deleteUserMailHosting(serviceId: $serviceId, username: $username)
43
- }
44
- `;
45
- exports.UPDATE_DOMAIN_NAME = (0, graphql_tag_1.gql) `
46
- mutation UpdateDomainName(
47
- $serviceId: String!
48
- $updateBy: String!
49
- $updateData: String!
50
- ) {
51
- updateDomainName(
52
- serviceId: $serviceId
53
- updateBy: $updateBy
54
- updateData: $updateData
55
- )
56
- }
57
- `;
58
- exports.UPDATE_USER_NAME = (0, graphql_tag_1.gql) `
59
- mutation UpdateUserName(
60
- $serviceId: String!
61
- $updateBy: String!
62
- $updateData: String!
63
- ) {
64
- updateUsername(
65
- serviceId: $serviceId
66
- updateBy: $updateBy
67
- updateData: $updateData
68
- )
69
- }
70
- `;
71
- exports.UPDATE_PASSWORD = (0, graphql_tag_1.gql) `
72
- mutation UpdatePassword(
73
- $serviceId: String!
74
- $updateBy: String!
75
- $updateData: String!
76
- ) {
77
- updatePassword(
78
- serviceId: $serviceId
79
- updateBy: $updateBy
80
- updateData: $updateData
81
- )
82
- }
83
- `;
84
- exports.UPDATE_USER_PASSWORD = (0, graphql_tag_1.gql) `
85
- mutation UpdateUserPassword(
86
- $serviceId: String!
87
- $username: String!
88
- $password: String!
89
- ) {
90
- updateUserPassword(
91
- serviceId: $serviceId
92
- username: $username
93
- password: $password
94
- )
95
- }
96
- `;
97
- exports.UPDATE_DNS = (0, graphql_tag_1.gql) `
98
- mutation UpdateDNS(
99
- $serviceId: String!
100
- $dns1: String
101
- $dns2: String
102
- $dns3: String
103
- $dns4: String
104
- $createBy: String
105
- ) {
106
- updateDNS(
107
- serviceId: $serviceId
108
- dns1: $dns1
109
- dns2: $dns2
110
- dns3: $dns3
111
- dns4: $dns4
112
- createBy: $createBy
113
- )
114
- }
115
- `;
@@ -1,5 +0,0 @@
1
- export declare const SERVICE_DETAIL: import("graphql").DocumentNode;
2
- export declare const GET_MAIL_RESOURCE: import("graphql").DocumentNode;
3
- export declare const GET_USER_MAIL_HOSTING: import("graphql").DocumentNode;
4
- export declare const SERVICE_TYPE: import("graphql").DocumentNode;
5
- export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- exports.SERVICE_DETAIL = (0, graphql_tag_1.gql) `
6
- query ServiceDetail($serviceId: String) {
7
- serviceDetail(serviceId: $serviceId) {
8
- service {
9
- serviceId
10
- partnerId
11
- serviceName
12
- type
13
- typeName
14
- status
15
- ownerId
16
- startDate
17
- endDate
18
- serviceType
19
- actionRequest {
20
- id
21
- name
22
- type
23
- uri
24
- }
25
- urlPrivate
26
- urlPublic
27
- username
28
- password
29
- attrs
30
- }
31
- resources {
32
- type
33
- name
34
- total
35
- unit
36
- value
37
- component
38
- }
39
- configs {
40
- configId
41
- name
42
- configValue
43
- }
44
- extraData {
45
- title
46
- content {
47
- name
48
- type
49
- value
50
- action
51
- }
52
- }
53
- }
54
- }
55
- `;
56
- exports.GET_MAIL_RESOURCE = (0, graphql_tag_1.gql) `
57
- query GetMailResource($serviceId: String!) {
58
- getMailResource(serviceId: $serviceId) {
59
- accountTotal
60
- accountUsed
61
- accountRemain
62
- storageTotal
63
- storageUsed
64
- storageRemain
65
- storageRemainUnit
66
- storageTotalUnit
67
- storageUsedUnit
68
- enableAntiVirus
69
- enableAntiSpam
70
- attachmentLimitUnit
71
- }
72
- }
73
- `;
74
- exports.GET_USER_MAIL_HOSTING = (0, graphql_tag_1.gql) `
75
- query GetUserMailResource($serviceId: String!) {
76
- getUserMailHosting(serviceId: $serviceId) {
77
- email
78
- username
79
- fullName
80
- storageUsedUnit
81
- storageUsed
82
- }
83
- }
84
- `;
85
- exports.SERVICE_TYPE = (0, graphql_tag_1.gql) `
86
- query {
87
- serviceTypes
88
- }
89
- `;
90
- exports.SEARCH_SERVICE = (0, graphql_tag_1.gql) `
91
- query SearchService($filter: CloudServiceFilterInput) {
92
- searchService(filter: $filter) {
93
- total
94
- offset
95
- maxResult
96
- resultList {
97
- serviceId
98
- partnerId
99
- serviceName
100
- type
101
- typeName
102
- status
103
- ownerId
104
- startDate
105
- endDate
106
- serviceType
107
- actionRequest {
108
- id
109
- name
110
- type
111
- uri
112
- }
113
- urlPrivate
114
- urlPublic
115
- username
116
- password
117
- attrs
118
- }
119
- }
120
- }
121
- `;
@@ -1,10 +0,0 @@
1
- export declare const RESTARTVM: import("graphql").DocumentNode;
2
- export declare const UPDATE_DESCRIPTION_PORTNAT: import("graphql").DocumentNode;
3
- export declare const CREATE_PORT_NAT: import("graphql").DocumentNode;
4
- export declare const UPDATE_PORT_NAT: import("graphql").DocumentNode;
5
- export declare const REMOVE_PORT_NAT: import("graphql").DocumentNode;
6
- export declare const POWER_ON: import("graphql").DocumentNode;
7
- export declare const POWER_OFF: import("graphql").DocumentNode;
8
- export declare const CREATE_SNAP_SHOT: import("graphql").DocumentNode;
9
- export declare const ROLLBACK_SNAPSHOT: import("graphql").DocumentNode;
10
- export declare const DELETE_SNAPSHOT: import("graphql").DocumentNode;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DELETE_SNAPSHOT = exports.ROLLBACK_SNAPSHOT = exports.CREATE_SNAP_SHOT = exports.POWER_OFF = exports.POWER_ON = exports.REMOVE_PORT_NAT = exports.UPDATE_PORT_NAT = exports.CREATE_PORT_NAT = exports.UPDATE_DESCRIPTION_PORTNAT = exports.RESTARTVM = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- exports.RESTARTVM = (0, graphql_tag_1.gql) `
6
- mutation Restart($computingId: String!, $actor: String!) {
7
- restart(computingId: $computingId, actor: $actor)
8
- }
9
- `;
10
- exports.UPDATE_DESCRIPTION_PORTNAT = (0, graphql_tag_1.gql) `
11
- mutation UpdateDescriptionPortNat(
12
- $portNatId: String!
13
- $description: String!
14
- $updateBy: String
15
- ) {
16
- updateDescriptionPortNat(
17
- portNatId: $portNatId
18
- description: $description
19
- updateBy: $updateBy
20
- )
21
- }
22
- `;
23
- exports.CREATE_PORT_NAT = (0, graphql_tag_1.gql) `
24
- mutation CreatePortNat(
25
- $portNatId: String!
26
- $translatedPort: String!
27
- $createBy: String
28
- ) {
29
- createPortNat(
30
- portNatId: $portNatId
31
- translatedPort: $translatedPort
32
- createBy: $createBy
33
- )
34
- }
35
- `;
36
- exports.UPDATE_PORT_NAT = (0, graphql_tag_1.gql) `
37
- mutation UpdatePortNat(
38
- $portNatId: String!
39
- $translatedPort: String!
40
- $updateBy: String
41
- ) {
42
- updatePortNat(
43
- portNatId: $portNatId
44
- translatedPort: $translatedPort
45
- updateBy: $updateBy
46
- )
47
- }
48
- `;
49
- exports.REMOVE_PORT_NAT = (0, graphql_tag_1.gql) `
50
- mutation RemovePortNat($portNatId: String!, $updateBy: String) {
51
- removePortNat(portNatId: $portNatId, updateBy: $updateBy)
52
- }
53
- `;
54
- exports.POWER_ON = (0, graphql_tag_1.gql) `
55
- mutation PowerOn($computingId: String!, $actor: String!) {
56
- powerOn(computingId: $computingId, actor: $actor)
57
- }
58
- `;
59
- exports.POWER_OFF = (0, graphql_tag_1.gql) `
60
- mutation PowerOff($computingId: String!, $actor: String!) {
61
- powerOff(computingId: $computingId, actor: $actor)
62
- }
63
- `;
64
- exports.CREATE_SNAP_SHOT = (0, graphql_tag_1.gql) `
65
- mutation CreateSnapshot(
66
- $computingId: String!
67
- $snapshotName: String!
68
- $createBy: String
69
- ) {
70
- createSnapshot(
71
- computingId: $computingId
72
- snapshotName: $snapshotName
73
- createBy: $createBy
74
- ) {
75
- id
76
- computingId
77
- snapshotId
78
- name
79
- status
80
- createdStamp
81
- endDate
82
- }
83
- }
84
- `;
85
- exports.ROLLBACK_SNAPSHOT = (0, graphql_tag_1.gql) `
86
- mutation RollbackSnapshot(
87
- $computingId: String!
88
- $snapshotId: String!
89
- $createBy: String
90
- ) {
91
- rollbackSnapshot(
92
- computingId: $computingId
93
- snapshotId: $snapshotId
94
- createBy: $createBy
95
- )
96
- }
97
- `;
98
- exports.DELETE_SNAPSHOT = (0, graphql_tag_1.gql) `
99
- mutation DeleteSnapshot(
100
- $computingId: String!
101
- $snapshotId: String!
102
- $updateBy: String
103
- ) {
104
- deleteSnapshot(
105
- computingId: $computingId
106
- snapshotId: $snapshotId
107
- updateBy: $updateBy
108
- )
109
- }
110
- `;
@@ -1,25 +0,0 @@
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
- }
@@ -1,248 +0,0 @@
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.CloudService = void 0;
13
- const mutations_1 = require("../../graphql/cloud/mutations");
14
- const queries_1 = require("../../graphql/cloud/queries");
15
- const serviceSDK_1 = require("../serviceSDK");
16
- class CloudService extends serviceSDK_1.Service {
17
- /**
18
- * Constructs a new OrderService instance.
19
- * @param endpoint - The endpoint URL for the service.
20
- * @param orgId - The organization ID.
21
- * @param storeId - The store ID.
22
- */
23
- constructor(endpoint, orgId, storeId) {
24
- super(endpoint, orgId, storeId);
25
- }
26
- setToken(token) {
27
- this.token = token;
28
- }
29
- serviceDetail(serviceId) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const query = queries_1.SERVICE_DETAIL;
32
- const variables = {
33
- serviceId,
34
- };
35
- try {
36
- const response = yield this.graphqlQueryV2(query, variables);
37
- return response.serviceDetail;
38
- }
39
- catch (error) {
40
- console.log(`Error in serviceDetail: ${error}`);
41
- throw error;
42
- }
43
- });
44
- }
45
- getMailResource(serviceId) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const query = queries_1.GET_MAIL_RESOURCE;
48
- const variables = {
49
- serviceId,
50
- };
51
- try {
52
- const response = yield this.graphqlQueryV2(query, variables);
53
- return response.getMailResource;
54
- }
55
- catch (error) {
56
- console.log(`Error in getMailResource: ${error}`);
57
- throw error;
58
- }
59
- });
60
- }
61
- changeServiceName(serviceId, updateBy, name) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const mutation = mutations_1.CHANGE_SERVICE_NAME;
64
- const variables = {
65
- serviceId,
66
- updateBy,
67
- name,
68
- };
69
- try {
70
- const response = yield this.graphqlMutationV2(mutation, variables);
71
- return response.changeServiceName;
72
- }
73
- catch (error) {
74
- console.log(`Error in changeServiceName: ${error}`);
75
- throw error;
76
- }
77
- });
78
- }
79
- getUserMailHosting(serviceId) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- const query = queries_1.GET_USER_MAIL_HOSTING;
82
- const variables = {
83
- serviceId,
84
- };
85
- try {
86
- const response = yield this.graphqlQueryV2(query, variables);
87
- return response.getUserMailHosting;
88
- }
89
- catch (error) {
90
- console.log(`Error in getUserMailHosting: ${error}`);
91
- throw error;
92
- }
93
- });
94
- }
95
- createUserMailHosting(payload) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- const mutation = mutations_1.CREATE_USER_MAIL_HOSTING;
98
- const variables = {
99
- serviceId: payload.serviceId,
100
- username: payload.username,
101
- password: payload.password,
102
- fullName: payload.fullName,
103
- };
104
- try {
105
- const response = yield this.graphqlMutationV2(mutation, variables);
106
- return response.createUserMailHosting;
107
- }
108
- catch (error) {
109
- console.log(`Error in createUserMailHosting: ${error}`);
110
- throw error;
111
- }
112
- });
113
- }
114
- updateUserPassword(payload) {
115
- return __awaiter(this, void 0, void 0, function* () {
116
- const mutation = mutations_1.UPDATE_USER_PASSWORD;
117
- const variables = {
118
- serviceId: payload.serviceId,
119
- username: payload.username,
120
- password: payload.password,
121
- };
122
- try {
123
- const response = yield this.graphqlMutationV2(mutation, variables);
124
- return response.updateUserPassword;
125
- }
126
- catch (error) {
127
- console.log(`Error in updateUserPassword: ${error}`);
128
- throw error;
129
- }
130
- });
131
- }
132
- deleteUserMailHosting(payload) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- const mutation = mutations_1.DELETE_USER_MAIL_HOSTING;
135
- const variables = {
136
- serviceId: payload.serviceId,
137
- username: payload.username,
138
- };
139
- try {
140
- const response = yield this.graphqlMutationV2(mutation, variables);
141
- return response.deleteUserMailHosting;
142
- }
143
- catch (error) {
144
- console.log(`Error in deleteUserMailHosting: ${error}`);
145
- throw error;
146
- }
147
- });
148
- }
149
- updateDomainName(payload) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- const mutation = mutations_1.UPDATE_DOMAIN_NAME;
152
- const variables = {
153
- serviceId: payload.serviceId,
154
- updateBy: payload.useUpdate,
155
- updateData: payload.valueUpdate,
156
- };
157
- try {
158
- const response = yield this.graphqlMutationV2(mutation, variables);
159
- return response.updateDomainName;
160
- }
161
- catch (error) {
162
- console.log(`Error in updateDomainName: ${error}`);
163
- throw error;
164
- }
165
- });
166
- }
167
- updateUsername(payload) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- const mutation = mutations_1.UPDATE_USER_NAME;
170
- const variables = {
171
- serviceId: payload.serviceId,
172
- updateBy: payload.useUpdate,
173
- updateData: payload.valueUpdate,
174
- };
175
- try {
176
- const response = yield this.graphqlMutationV2(mutation, variables);
177
- return response.updateUsername;
178
- }
179
- catch (error) {
180
- console.log(`Error in updateUsername: ${error}`);
181
- throw error;
182
- }
183
- });
184
- }
185
- updatePassword(payload) {
186
- return __awaiter(this, void 0, void 0, function* () {
187
- const mutation = mutations_1.UPDATE_PASSWORD;
188
- const variables = {
189
- serviceId: payload.serviceId,
190
- updateBy: payload.useUpdate,
191
- updateData: payload.valueUpdate,
192
- };
193
- try {
194
- const response = yield this.graphqlMutationV2(mutation, variables);
195
- return response.updatePassword;
196
- }
197
- catch (error) {
198
- console.log(`Error in updatePassword: ${error}`);
199
- throw error;
200
- }
201
- });
202
- }
203
- serviceTypes() {
204
- return __awaiter(this, void 0, void 0, function* () {
205
- const query = queries_1.SERVICE_TYPE;
206
- const variables = {};
207
- try {
208
- const response = yield this.graphqlQueryV2(query, variables);
209
- return response.serviceTypes;
210
- }
211
- catch (error) {
212
- console.log(`Error in serviceTypes: ${error}`);
213
- throw error;
214
- }
215
- });
216
- }
217
- searchService(filter) {
218
- return __awaiter(this, void 0, void 0, function* () {
219
- const query = queries_1.SEARCH_SERVICE;
220
- const variables = {
221
- filter,
222
- };
223
- try {
224
- const response = yield this.graphqlQueryV2(query, variables);
225
- return response.searchService;
226
- }
227
- catch (error) {
228
- console.log(`Error in searchService: ${error}`);
229
- throw error;
230
- }
231
- });
232
- }
233
- updateDNS(payload) {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- const mutation = mutations_1.UPDATE_DNS;
236
- const variables = Object.assign({}, payload);
237
- try {
238
- const response = yield this.graphqlMutationV2(mutation, variables);
239
- return response.updateDNS;
240
- }
241
- catch (error) {
242
- console.log(`Error in updateDNS: ${error}`);
243
- throw error;
244
- }
245
- });
246
- }
247
- }
248
- exports.CloudService = CloudService;
@@ -1,14 +0,0 @@
1
- import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
2
- import { DocumentNode } from "graphql";
3
- export declare class Service {
4
- protected token: string | null;
5
- protected client: ApolloClient<NormalizedCacheObject>;
6
- protected orgId: string;
7
- protected storeId: string;
8
- protected endpoint: string;
9
- constructor(endpoint: string, orgId: string, storeId: string);
10
- setToken(token: string): void;
11
- protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
12
- protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
13
- protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
14
- }
@@ -1,101 +0,0 @@
1
- "use strict";
2
- // src/service.ts
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Service = void 0;
17
- const client_1 = require("@apollo/client");
18
- const axios_1 = __importDefault(require("axios"));
19
- class Service {
20
- constructor(endpoint, orgId, storeId) {
21
- this.token = null;
22
- this.client = new client_1.ApolloClient({
23
- uri: endpoint,
24
- cache: new client_1.InMemoryCache(),
25
- defaultOptions: {
26
- query: {
27
- fetchPolicy: "network-only",
28
- },
29
- },
30
- });
31
- this.orgId = orgId;
32
- this.storeId = storeId;
33
- this.endpoint = endpoint;
34
- }
35
- setToken(token) {
36
- this.token = token;
37
- }
38
- // setOrgId(orgId: string) {
39
- // this.orgId = orgId;
40
- // }
41
- graphqlQuery(query, variables) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- try {
44
- const { data, errors } = yield this.client.query({
45
- query: (0, client_1.gql) `
46
- ${query}
47
- `,
48
- variables,
49
- });
50
- if (errors) {
51
- throw new Error(`GraphQL error! errors: ${errors}`);
52
- }
53
- return data;
54
- }
55
- catch (error) {
56
- console.log(`Error in graphqlQuery: ${error}`);
57
- throw error;
58
- }
59
- });
60
- }
61
- graphqlMutation(mutation, variables) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- try {
64
- const { data, errors } = yield this.client.mutate({
65
- mutation: (0, client_1.gql) `
66
- ${mutation}
67
- `,
68
- variables,
69
- });
70
- if (errors) {
71
- throw new Error(`GraphQL error! errors: ${errors}`);
72
- }
73
- return data;
74
- }
75
- catch (error) {
76
- console.log(`Error in graphqlMutation: ${error}`);
77
- throw error;
78
- }
79
- });
80
- }
81
- restApiCallWithToken(path, method, data, headers) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- try {
84
- const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
85
- console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
86
- const response = yield (0, axios_1.default)({
87
- url: this.endpoint + path,
88
- method,
89
- data,
90
- headers: modifiedHeaders,
91
- });
92
- return response.data;
93
- }
94
- catch (error) {
95
- console.log(`Error in restApiCallWithToken: ${error}`);
96
- throw error;
97
- }
98
- });
99
- }
100
- }
101
- exports.Service = Service;
@@ -1,40 +0,0 @@
1
- export interface CreateUserMailHosting {
2
- serviceId: string;
3
- username: string;
4
- password: string;
5
- fullName: string;
6
- }
7
- export interface UpdateUserPassword {
8
- serviceId: string;
9
- username: string;
10
- password: string;
11
- }
12
- export interface DeleteUserPassword {
13
- serviceId: string;
14
- username: string;
15
- }
16
- export interface UpdateInforMationService {
17
- serviceId: string;
18
- useUpdate: string;
19
- valueUpdate: string;
20
- }
21
- export interface Filter {
22
- serviceId: string;
23
- type: string;
24
- status: ServiceStatus;
25
- salePartyId: string;
26
- offset: number;
27
- maxResult: number;
28
- ownerId: string;
29
- commonSearch: string;
30
- }
31
- export interface ServiceStatus {
32
- CREATED: "CREATED";
33
- UPGRADED: "UPGRADED";
34
- PROCESSING: "PROCESSING";
35
- COMPLETED: "COMPLETED";
36
- ERROR: "ERROR";
37
- SUSPEND: "SUSPEND";
38
- CANCELLED: "CANCELLED";
39
- CLOSED: "CLOSED";
40
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- export interface UpdateDescriptionPortNat {
2
- portNatId: string;
3
- description: string;
4
- }
5
- export interface CreatePortNat {
6
- portNatId: string;
7
- translatedPort: string;
8
- }
9
- export interface CreateSnapShot {
10
- computingId: string;
11
- snapshotName: string;
12
- }
13
- export interface RollBackSnapShot {
14
- computingId: string;
15
- snapshotId: string;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });