@longvansoftware/service-js-client 1.11.0 → 1.11.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/dist/src/graphql/computing/mutations.d.ts +22 -18
- package/dist/src/graphql/computing/mutations.js +35 -1
- package/dist/src/graphql/computing/queries.d.ts +1 -1
- package/dist/src/graphql/computing/queries.js +4 -5
- package/dist/src/graphql/product/queries.d.ts +2 -2
- package/dist/src/graphql/product/queries.js +6 -6
- package/dist/src/lib/computing/index.d.ts +4 -1
- package/dist/src/lib/computing/index.js +53 -1
- package/dist/src/utils/build-field-string.d.ts +1 -0
- package/dist/src/utils/build-field-string.js +16 -0
- package/package.json +1 -1
@@ -1,18 +1,22 @@
|
|
1
|
-
|
2
|
-
export declare const
|
3
|
-
export declare const
|
4
|
-
export declare const
|
5
|
-
export declare const
|
6
|
-
export declare const
|
7
|
-
export declare const
|
8
|
-
export declare const
|
9
|
-
export declare const
|
10
|
-
export declare const
|
11
|
-
export declare const
|
12
|
-
export declare const
|
13
|
-
export declare const
|
14
|
-
export declare const
|
15
|
-
export declare const
|
16
|
-
export declare const
|
17
|
-
export declare const
|
18
|
-
export declare const
|
1
|
+
import { DocumentNode } from "graphql";
|
2
|
+
export declare const RESTARTVM: DocumentNode;
|
3
|
+
export declare const UPDATE_DESCRIPTION_PORTNAT: DocumentNode;
|
4
|
+
export declare const CREATE_PORT_NAT: DocumentNode;
|
5
|
+
export declare const UPDATE_PORT_NAT: DocumentNode;
|
6
|
+
export declare const REMOVE_PORT_NAT: DocumentNode;
|
7
|
+
export declare const POWER_ON: DocumentNode;
|
8
|
+
export declare const POWER_OFF: DocumentNode;
|
9
|
+
export declare const CREATE_SNAP_SHOT: DocumentNode;
|
10
|
+
export declare const ROLLBACK_SNAPSHOT: DocumentNode;
|
11
|
+
export declare const DELETE_SNAPSHOT: DocumentNode;
|
12
|
+
export declare const CREATE_CLUSTER: DocumentNode;
|
13
|
+
export declare const ADD_COMPUTING_IN_CLUSTER: DocumentNode;
|
14
|
+
export declare const REMOVE_COMPUTING_IN_CLUSTER: DocumentNode;
|
15
|
+
export declare const STOP_USE_COMPUTING: DocumentNode;
|
16
|
+
export declare const ADD_PORT_NAT: DocumentNode;
|
17
|
+
export declare const UPDATE_DESCRIPTION_COMPUTING: DocumentNode;
|
18
|
+
export declare const CREATE_COMPUTING_FOR_DC: DocumentNode;
|
19
|
+
export declare const UPDATE_NAME_COMPUTING: DocumentNode;
|
20
|
+
export declare const COMPUTING_WAITING_REVOKE: (fields?: string[]) => DocumentNode;
|
21
|
+
export declare const RESTORE_COMPUTING_WAITING_REVOKE: (fields?: string[]) => DocumentNode;
|
22
|
+
export declare const DELETE_COMPUTING: (fields?: string[]) => DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.UPDATE_NAME_COMPUTING = exports.CREATE_COMPUTING_FOR_DC = exports.UPDATE_DESCRIPTION_COMPUTING = exports.ADD_PORT_NAT = exports.STOP_USE_COMPUTING = exports.REMOVE_COMPUTING_IN_CLUSTER = exports.ADD_COMPUTING_IN_CLUSTER = exports.CREATE_CLUSTER = 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;
|
3
|
+
exports.DELETE_COMPUTING = exports.RESTORE_COMPUTING_WAITING_REVOKE = exports.COMPUTING_WAITING_REVOKE = exports.UPDATE_NAME_COMPUTING = exports.CREATE_COMPUTING_FOR_DC = exports.UPDATE_DESCRIPTION_COMPUTING = exports.ADD_PORT_NAT = exports.STOP_USE_COMPUTING = exports.REMOVE_COMPUTING_IN_CLUSTER = exports.ADD_COMPUTING_IN_CLUSTER = exports.CREATE_CLUSTER = 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
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.RESTARTVM = (0, graphql_tag_1.gql) `
|
6
6
|
mutation Restart($computingId: String!, $actor: String!) {
|
@@ -230,6 +230,7 @@ exports.CREATE_COMPUTING_FOR_DC = (0, graphql_tag_1.gql) `
|
|
230
230
|
$ram: RamInput!
|
231
231
|
$resourcePoolId: String!
|
232
232
|
$disks: [DiskInput!]!
|
233
|
+
$createBy: String!
|
233
234
|
) {
|
234
235
|
createComputingForDC(
|
235
236
|
createComputingInputForDC: {
|
@@ -244,6 +245,7 @@ exports.CREATE_COMPUTING_FOR_DC = (0, graphql_tag_1.gql) `
|
|
244
245
|
resourcePoolId: $resourcePoolId
|
245
246
|
disks: $disks
|
246
247
|
}
|
248
|
+
createBy: $createBy
|
247
249
|
) {
|
248
250
|
computingId
|
249
251
|
message
|
@@ -263,3 +265,35 @@ exports.UPDATE_NAME_COMPUTING = (0, graphql_tag_1.gql) `
|
|
263
265
|
)
|
264
266
|
}
|
265
267
|
`;
|
268
|
+
const COMPUTING_WAITING_REVOKE = (fields = []) => {
|
269
|
+
const fieldStr = fields.join("\n ");
|
270
|
+
const hasFields = fields.length > 0;
|
271
|
+
return (0, graphql_tag_1.gql) `
|
272
|
+
mutation ComputingWaitingRevoke($computingId: String! $userId: String!) {
|
273
|
+
computingWaitingRevoke(computingId: $computingId, userId: $userId)
|
274
|
+
${hasFields ? `{ ${fieldStr} }` : ""}
|
275
|
+
}
|
276
|
+
`;
|
277
|
+
};
|
278
|
+
exports.COMPUTING_WAITING_REVOKE = COMPUTING_WAITING_REVOKE;
|
279
|
+
const RESTORE_COMPUTING_WAITING_REVOKE = (fields = []) => {
|
280
|
+
const fieldStr = fields.join("\n ");
|
281
|
+
const hasFields = fields.length > 0;
|
282
|
+
return (0, graphql_tag_1.gql) `
|
283
|
+
mutation RestoreComputingWaitingRevoke($computingId: String! $userId: String!) {
|
284
|
+
restoreComputingWaitingRevoke(computingId: $computingId, userId: $userId)
|
285
|
+
${hasFields ? `{ ${fieldStr} }` : ""}
|
286
|
+
}
|
287
|
+
`;
|
288
|
+
};
|
289
|
+
exports.RESTORE_COMPUTING_WAITING_REVOKE = RESTORE_COMPUTING_WAITING_REVOKE;
|
290
|
+
const DELETE_COMPUTING = (fields = []) => {
|
291
|
+
const fieldStr = fields.join("\n ");
|
292
|
+
const hasFields = fields.length > 0;
|
293
|
+
return (0, graphql_tag_1.gql) `
|
294
|
+
mutation DeleteComputing($computingId: String! $userId: String!) {
|
295
|
+
deleteComputing(computingId: $computingId, userId: $userId) ${hasFields ? `{ ${fieldStr} }` : ""}
|
296
|
+
}
|
297
|
+
`;
|
298
|
+
};
|
299
|
+
exports.DELETE_COMPUTING = DELETE_COMPUTING;
|
@@ -24,4 +24,4 @@ export declare const GET_AVAILABLE_SUBNET_IPS_BY_RESOURCEPOLL_ID: DocumentNode;
|
|
24
24
|
export declare const GET_AVAILABLE_STORAGES_FOR_DC: DocumentNode;
|
25
25
|
export declare const GET_RESOUCE_POOL_BY_SERVICE: DocumentNode;
|
26
26
|
export declare const GET_CONSOLE: DocumentNode;
|
27
|
-
export declare const GET_COMPUTING_WAIT_REVOKE: (fields
|
27
|
+
export declare const GET_COMPUTING_WAIT_REVOKE: (fields?: string[]) => DocumentNode;
|
@@ -530,13 +530,12 @@ exports.GET_CONSOLE = (0, graphql_tag_1.gql) `
|
|
530
530
|
}
|
531
531
|
}
|
532
532
|
`;
|
533
|
-
const GET_COMPUTING_WAIT_REVOKE = (fields) => {
|
533
|
+
const GET_COMPUTING_WAIT_REVOKE = (fields = []) => {
|
534
534
|
const fieldStr = fields.join("\n ");
|
535
|
+
const hasFields = fields.length > 0;
|
535
536
|
return (0, graphql_tag_1.gql) `
|
536
|
-
query GetComputingWaitRevoke($
|
537
|
-
getComputingWaitRevoke(
|
538
|
-
${fieldStr}
|
539
|
-
}
|
537
|
+
query GetComputingWaitRevoke($serviceId: String!) {
|
538
|
+
getComputingWaitRevoke(serviceId: $serviceId) ${hasFields ? `{ ${fieldStr} }` : ""}
|
540
539
|
}
|
541
540
|
`;
|
542
541
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DocumentNode } from "graphql";
|
2
2
|
export declare const GET_PRODUCT_BY_ID_QUERY: DocumentNode;
|
3
|
-
export declare const GET_PRODUCT_BY_ID_QUERY_DYNAMIC: (fields
|
3
|
+
export declare const GET_PRODUCT_BY_ID_QUERY_DYNAMIC: (fields?: string[]) => DocumentNode;
|
4
4
|
export declare const GET_PRODUCT_BY_SLUG_QUERY: DocumentNode;
|
5
5
|
export declare const GET_SIMPLE_PRODUCTS_QUERY: DocumentNode;
|
6
6
|
export declare const GET_CATEGORIES_QUERY: DocumentNode;
|
@@ -12,7 +12,7 @@ export declare const GET_BRAND_DETAIL_QUERY = "\n query GetBrandDetail($partner
|
|
12
12
|
export declare const GET_PRODUCT_OPTION: DocumentNode;
|
13
13
|
export declare const GET_POLICY: DocumentNode;
|
14
14
|
export declare const GET_PRODUCTS: DocumentNode;
|
15
|
-
export declare const GET_PRODUCTS_DYNAMIC: (fields
|
15
|
+
export declare const GET_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
16
16
|
export declare const GET_HANDLE_BY_SERVICETYPE: DocumentNode;
|
17
17
|
export declare const GET_RESOURCE_BY_PRODUCT: DocumentNode;
|
18
18
|
export declare const GET_PRODUCT_VARIANT_BY_ID: DocumentNode;
|
@@ -192,8 +192,9 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
192
192
|
}
|
193
193
|
}
|
194
194
|
`;
|
195
|
-
const GET_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields) => {
|
195
|
+
const GET_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields = []) => {
|
196
196
|
const fieldStr = fields.join("\n ");
|
197
|
+
const hasFields = fields.length > 0;
|
197
198
|
return (0, graphql_tag_1.gql) `
|
198
199
|
query GetProductById(
|
199
200
|
$partnerId: String!
|
@@ -204,9 +205,7 @@ const GET_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields) => {
|
|
204
205
|
partnerId: $partnerId
|
205
206
|
storeChannel: $storeChannel
|
206
207
|
productId: $productId
|
207
|
-
) {
|
208
|
-
${fieldStr}
|
209
|
-
}
|
208
|
+
) ${hasFields ? `{ ${fieldStr} }` : ""}
|
210
209
|
}
|
211
210
|
`;
|
212
211
|
};
|
@@ -687,8 +686,9 @@ exports.GET_PRODUCTS = (0, graphql_tag_1.gql) `
|
|
687
686
|
}
|
688
687
|
}
|
689
688
|
`;
|
690
|
-
const GET_PRODUCTS_DYNAMIC = (fields) => {
|
689
|
+
const GET_PRODUCTS_DYNAMIC = (fields = []) => {
|
691
690
|
const fieldStr = fields.join("\n ");
|
691
|
+
const hasFields = fields.length > 0;
|
692
692
|
return (0, graphql_tag_1.gql) `
|
693
693
|
query GetProducts(
|
694
694
|
$partnerId: String!
|
@@ -773,7 +773,7 @@ const GET_PRODUCTS_DYNAMIC = (fields) => {
|
|
773
773
|
maxResult
|
774
774
|
totalPage
|
775
775
|
data {
|
776
|
-
${fieldStr}
|
776
|
+
${hasFields ? `${fieldStr}` : ""}
|
777
777
|
}
|
778
778
|
}
|
779
779
|
}
|
@@ -50,8 +50,11 @@ export declare class ComputingService extends Service {
|
|
50
50
|
getAvailableSubnetIPsByResourcePoolId(resourcePoolId: string): Promise<any>;
|
51
51
|
getAvailableStoragesForDC(resourcePoolId: string): Promise<any>;
|
52
52
|
getResourcePoolsByService(serviceId: string): Promise<any>;
|
53
|
-
createComputingForDC(data: any): Promise<any>;
|
53
|
+
createComputingForDC(data: any, createBy: string): Promise<any>;
|
54
54
|
updateNameComputing(computingId: string, name: string, updateBy: string): Promise<any>;
|
55
55
|
getConsole(computingId: string): Promise<any>;
|
56
56
|
getComputingWaitRevoke(serviceId: string, fields: string[]): Promise<any>;
|
57
|
+
computingWaitingRevoke(computingId: string, userId: string, fields: string[]): Promise<any>;
|
58
|
+
restoreComputingWaitingRevoke(computingId: string, userId: string, fields: string[]): Promise<any>;
|
59
|
+
deleteComputing(computingId: string, userId: string, fields: string[]): Promise<any>;
|
57
60
|
}
|
@@ -709,7 +709,7 @@ class ComputingService extends serviceSDK_1.Service {
|
|
709
709
|
}
|
710
710
|
});
|
711
711
|
}
|
712
|
-
createComputingForDC(data) {
|
712
|
+
createComputingForDC(data, createBy) {
|
713
713
|
return __awaiter(this, void 0, void 0, function* () {
|
714
714
|
const mutation = mutations_1.CREATE_COMPUTING_FOR_DC;
|
715
715
|
const variables = {
|
@@ -723,6 +723,7 @@ class ComputingService extends serviceSDK_1.Service {
|
|
723
723
|
ram: data === null || data === void 0 ? void 0 : data.ram,
|
724
724
|
resourcePoolId: data === null || data === void 0 ? void 0 : data.resourcePoolId,
|
725
725
|
disks: data === null || data === void 0 ? void 0 : data.disks,
|
726
|
+
createBy,
|
726
727
|
};
|
727
728
|
try {
|
728
729
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
@@ -784,5 +785,56 @@ class ComputingService extends serviceSDK_1.Service {
|
|
784
785
|
}
|
785
786
|
});
|
786
787
|
}
|
788
|
+
computingWaitingRevoke(computingId, userId, fields) {
|
789
|
+
return __awaiter(this, void 0, void 0, function* () {
|
790
|
+
const query = (0, mutations_1.COMPUTING_WAITING_REVOKE)(fields);
|
791
|
+
const variables = {
|
792
|
+
computingId,
|
793
|
+
userId,
|
794
|
+
};
|
795
|
+
try {
|
796
|
+
const response = yield this.graphqlMutationV2(query, variables);
|
797
|
+
return response.computingWaitingRevoke;
|
798
|
+
}
|
799
|
+
catch (error) {
|
800
|
+
console.log(`Error fetching get computingWaitingRevoke method: ${error}`);
|
801
|
+
throw error;
|
802
|
+
}
|
803
|
+
});
|
804
|
+
}
|
805
|
+
restoreComputingWaitingRevoke(computingId, userId, fields) {
|
806
|
+
return __awaiter(this, void 0, void 0, function* () {
|
807
|
+
const query = (0, mutations_1.RESTORE_COMPUTING_WAITING_REVOKE)(fields);
|
808
|
+
const variables = {
|
809
|
+
computingId,
|
810
|
+
userId,
|
811
|
+
};
|
812
|
+
try {
|
813
|
+
const response = yield this.graphqlMutationV2(query, variables);
|
814
|
+
return response.restoreComputingWaitingRevoke;
|
815
|
+
}
|
816
|
+
catch (error) {
|
817
|
+
console.log(`Error fetching get restoreComputingWaitingRevoke method: ${error}`);
|
818
|
+
throw error;
|
819
|
+
}
|
820
|
+
});
|
821
|
+
}
|
822
|
+
deleteComputing(computingId, userId, fields) {
|
823
|
+
return __awaiter(this, void 0, void 0, function* () {
|
824
|
+
const query = (0, mutations_1.DELETE_COMPUTING)(fields);
|
825
|
+
const variables = {
|
826
|
+
computingId,
|
827
|
+
userId,
|
828
|
+
};
|
829
|
+
try {
|
830
|
+
const response = yield this.graphqlMutationV2(query, variables);
|
831
|
+
return response.deleteComputing;
|
832
|
+
}
|
833
|
+
catch (error) {
|
834
|
+
console.log(`Error fetching get deleteComputing method: ${error}`);
|
835
|
+
throw error;
|
836
|
+
}
|
837
|
+
});
|
838
|
+
}
|
787
839
|
}
|
788
840
|
exports.ComputingService = ComputingService;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.buildFieldString = void 0;
|
4
|
+
function buildFieldString(fields, indent = 6) {
|
5
|
+
const space = " ".repeat(indent);
|
6
|
+
return fields
|
7
|
+
.map((field) => {
|
8
|
+
if (typeof field === "string")
|
9
|
+
return `${space}${field}`;
|
10
|
+
const [key, value] = Object.entries(field)[0];
|
11
|
+
const nested = buildFieldString(value, indent + 2);
|
12
|
+
return `${space}${key} {\n${nested}\n${space}}`;
|
13
|
+
})
|
14
|
+
.join("\n");
|
15
|
+
}
|
16
|
+
exports.buildFieldString = buildFieldString;
|