@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.
Files changed (84) hide show
  1. package/README.md +93 -0
  2. package/dist/config/config.d.ts +26 -0
  3. package/dist/config/config.js +29 -0
  4. package/dist/src/graphql/auth/mutations.d.ts +7 -0
  5. package/dist/src/graphql/auth/mutations.js +99 -0
  6. package/dist/src/graphql/auth/queries.d.ts +1 -0
  7. package/dist/src/graphql/auth/queries.js +25 -0
  8. package/dist/src/graphql/cloud/mutations.d.ts +8 -0
  9. package/dist/src/graphql/cloud/mutations.js +115 -0
  10. package/dist/src/graphql/cloud/queries.d.ts +5 -0
  11. package/dist/src/graphql/cloud/queries.js +121 -0
  12. package/dist/src/graphql/computing/mutations.d.ts +10 -0
  13. package/dist/src/graphql/computing/mutations.js +110 -0
  14. package/dist/src/graphql/computing/queries.d.ts +3 -0
  15. package/dist/src/graphql/computing/queries.js +48 -0
  16. package/dist/src/graphql/crm/mutations.d.ts +8 -0
  17. package/dist/src/graphql/crm/mutations.js +316 -0
  18. package/dist/src/graphql/crm/queries.d.ts +7 -0
  19. package/dist/src/graphql/crm/queries.js +281 -0
  20. package/dist/src/graphql/payment/mutations.d.ts +1 -0
  21. package/dist/src/graphql/payment/mutations.js +35 -0
  22. package/dist/src/graphql/payment/queries.d.ts +2 -0
  23. package/dist/src/graphql/payment/queries.js +23 -0
  24. package/dist/src/graphql/product/mutations.d.ts +0 -0
  25. package/dist/src/graphql/product/mutations.js +1 -0
  26. package/dist/src/graphql/product/queries.d.ts +11 -0
  27. package/dist/src/graphql/product/queries.js +431 -0
  28. package/dist/src/graphql/service/mutations.d.ts +10 -0
  29. package/dist/src/graphql/service/mutations.js +284 -0
  30. package/dist/src/graphql/service/queries.d.ts +6 -0
  31. package/dist/src/graphql/service/queries.js +174 -0
  32. package/dist/src/graphql/user/mutations.d.ts +4 -0
  33. package/dist/src/graphql/user/mutations.js +118 -0
  34. package/dist/src/graphql/user/queries.d.ts +13 -0
  35. package/dist/src/graphql/user/queries.js +252 -0
  36. package/dist/src/index.d.ts +1 -0
  37. package/dist/src/index.js +5 -0
  38. package/dist/src/lib/SDK.d.ts +42 -0
  39. package/dist/src/lib/SDK.js +71 -0
  40. package/dist/src/lib/auth/index.d.ts +27 -0
  41. package/dist/src/lib/auth/index.js +72 -0
  42. package/dist/src/lib/cloud/index.d.ts +25 -0
  43. package/dist/src/lib/cloud/index.js +248 -0
  44. package/dist/src/lib/computing/index.d.ts +25 -0
  45. package/dist/src/lib/computing/index.js +254 -0
  46. package/dist/src/lib/crm/index.d.ts +21 -0
  47. package/dist/src/lib/crm/index.js +296 -0
  48. package/dist/src/lib/order/index.d.ts +452 -0
  49. package/dist/src/lib/order/index.js +1204 -0
  50. package/dist/src/lib/payment/index.d.ts +7 -0
  51. package/dist/src/lib/payment/index.js +69 -0
  52. package/dist/src/lib/product/index.d.ts +37 -0
  53. package/dist/src/lib/product/index.js +132 -0
  54. package/dist/src/lib/service/index.d.ts +94 -0
  55. package/dist/src/lib/service/index.js +348 -0
  56. package/dist/src/lib/service.d.ts +14 -0
  57. package/dist/src/lib/service.js +101 -0
  58. package/dist/src/lib/serviceSDK.d.ts +18 -0
  59. package/dist/src/lib/serviceSDK.js +187 -0
  60. package/dist/src/lib/user/index.d.ts +23 -0
  61. package/dist/src/lib/user/index.js +345 -0
  62. package/dist/src/lib/warehouse/index.d.ts +20 -0
  63. package/dist/src/lib/warehouse/index.js +48 -0
  64. package/dist/src/types/auth.d.ts +82 -0
  65. package/dist/src/types/auth.js +2 -0
  66. package/dist/src/types/cloud.d.ts +40 -0
  67. package/dist/src/types/cloud.js +2 -0
  68. package/dist/src/types/computing.d.ts +16 -0
  69. package/dist/src/types/computing.js +2 -0
  70. package/dist/src/types/crm.d.ts +291 -0
  71. package/dist/src/types/crm.js +2 -0
  72. package/dist/src/types/order.d.ts +54 -0
  73. package/dist/src/types/order.js +2 -0
  74. package/dist/src/types/product.d.ts +63 -0
  75. package/dist/src/types/product.js +2 -0
  76. package/dist/src/types/service.d.ts +29 -0
  77. package/dist/src/types/service.js +2 -0
  78. package/dist/src/types/user.d.ts +95 -0
  79. package/dist/src/types/user.js +2 -0
  80. package/dist/src/types/warehouse.d.ts +5 -0
  81. package/dist/src/types/warehouse.js +2 -0
  82. package/dist/src/utils/helpers.d.ts +4 -0
  83. package/dist/src/utils/helpers.js +41 -0
  84. package/package.json +43 -0
@@ -0,0 +1,7 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class PaymentService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ getPaymentMethod(): Promise<any>;
5
+ createPaymentOrder(paymentOrderData: any): Promise<any>;
6
+ genQRPayment(orderId: any, totalAmount: any): Promise<any>;
7
+ }
@@ -0,0 +1,69 @@
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.PaymentService = void 0;
13
+ const mutations_1 = require("../../graphql/payment/mutations");
14
+ const queries_1 = require("../../graphql/payment/queries");
15
+ const serviceSDK_1 = require("../serviceSDK");
16
+ class PaymentService extends serviceSDK_1.Service {
17
+ constructor(endpoint, orgId, storeId) {
18
+ super(endpoint, orgId, storeId);
19
+ }
20
+ getPaymentMethod() {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const query = queries_1.GET_PAYMENT_METHOD;
23
+ const variables = {
24
+ orgId: this.orgId,
25
+ };
26
+ try {
27
+ const response = yield this.graphqlQuery(query, variables);
28
+ return response.getPaymentMethod;
29
+ }
30
+ catch (error) {
31
+ console.log(`Error fetching get payment method: ${error}`);
32
+ throw error;
33
+ }
34
+ });
35
+ }
36
+ createPaymentOrder(paymentOrderData) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const data = Object.assign({ orgId: this.orgId, storeId: this.storeId }, paymentOrderData);
39
+ try {
40
+ const response = yield this.graphqlMutation(mutations_1.CREATE_PAYMENT_ORDER_MUTATION, data);
41
+ return response.createPaymentOrder;
42
+ }
43
+ catch (error) {
44
+ console.log(`Error in createPaymentOrder: ${error}`);
45
+ throw error;
46
+ }
47
+ });
48
+ }
49
+ genQRPayment(orderId, totalAmount) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ const query = queries_1.GEN_QR_PAYMENT;
52
+ const variables = {
53
+ orgId: this.orgId,
54
+ orderId,
55
+ storeId: this.storeId,
56
+ totalAmount,
57
+ };
58
+ try {
59
+ const response = yield this.graphqlQuery(query, variables);
60
+ return response.genQRPayment;
61
+ }
62
+ catch (error) {
63
+ console.log(`Error fetching get genQRPayment method: ${error}`);
64
+ throw error;
65
+ }
66
+ });
67
+ }
68
+ }
69
+ exports.PaymentService = PaymentService;
@@ -0,0 +1,37 @@
1
+ import { Service } from "../serviceSDK";
2
+ import { Product } from "../../types/product";
3
+ /**
4
+ * Service class for managing product-related operations.
5
+ */
6
+ export declare class ProductService 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
+ * Retrieves a product by its ID.
16
+ * @param productId - The ID of the product.
17
+ * @returns A promise that resolves to the product.
18
+ * @throws If an error occurs while fetching the product.
19
+ */
20
+ getProductById(productId: string): Promise<any>;
21
+ /**
22
+ * Retrieves a product by its slug.
23
+ * @param slug - The slug of the product.
24
+ * @returns A promise that resolves to the product.
25
+ * @throws If an error occurs while fetching the product.
26
+ */
27
+ getProductBySlug(slug: string): Promise<Product>;
28
+ /**
29
+ * Retrieves simple products based on the provided variables.
30
+ * @param variables - The variables for the query.
31
+ * @returns A promise that resolves to the simple products.
32
+ * @throws If an error occurs while fetching the simple products.
33
+ */
34
+ getSimpleProducts(variables: any): Promise<Product[] | null>;
35
+ getProductOption(productId: string): Promise<any>;
36
+ getPolicy(groupId: string): Promise<any>;
37
+ }
@@ -0,0 +1,132 @@
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.ProductService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ const queries_1 = require("../../graphql/product/queries");
15
+ /**
16
+ * Service class for managing product-related operations.
17
+ */
18
+ class ProductService extends serviceSDK_1.Service {
19
+ /**
20
+ * Constructs a new ProductService instance.
21
+ * @param endpoint - The endpoint URL for the service.
22
+ * @param orgId - The organization ID.
23
+ * @param storeId - The store ID.
24
+ */
25
+ constructor(endpoint, orgId, storeId) {
26
+ super(endpoint, orgId, storeId);
27
+ }
28
+ // ...
29
+ /**
30
+ * Retrieves a product by its ID.
31
+ * @param productId - The ID of the product.
32
+ * @returns A promise that resolves to the product.
33
+ * @throws If an error occurs while fetching the product.
34
+ */
35
+ getProductById(productId) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const query = queries_1.GET_PRODUCT_BY_ID_QUERY;
38
+ const variables = {
39
+ partnerId: this.orgId,
40
+ storeChannel: this.storeId,
41
+ productId,
42
+ };
43
+ try {
44
+ const response = yield this.graphqlQuery(query, variables);
45
+ return response.getProductById;
46
+ }
47
+ catch (error) {
48
+ console.log(`Error fetching product by ID: ${error}`);
49
+ throw error;
50
+ }
51
+ });
52
+ }
53
+ /**
54
+ * Retrieves a product by its slug.
55
+ * @param slug - The slug of the product.
56
+ * @returns A promise that resolves to the product.
57
+ * @throws If an error occurs while fetching the product.
58
+ */
59
+ getProductBySlug(slug) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const query = queries_1.GET_PRODUCT_BY_SLUG_QUERY;
62
+ const variables = {
63
+ partnerId: this.orgId,
64
+ storeChannel: this.storeId,
65
+ handle: slug,
66
+ };
67
+ try {
68
+ const response = yield this.graphqlQuery(query, variables);
69
+ return response.getProductByHandle;
70
+ }
71
+ catch (error) {
72
+ console.log(`Error fetching product by slug: ${error}`);
73
+ throw error;
74
+ }
75
+ });
76
+ }
77
+ /**
78
+ * Retrieves simple products based on the provided variables.
79
+ * @param variables - The variables for the query.
80
+ * @returns A promise that resolves to the simple products.
81
+ * @throws If an error occurs while fetching the simple products.
82
+ */
83
+ getSimpleProducts(variables) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const query = queries_1.GET_SIMPLE_PRODUCTS_QUERY;
86
+ const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: this.storeId }, variables);
87
+ try {
88
+ const response = yield this.graphqlQuery(query, variablesHandle);
89
+ return response.getSimpleProducts;
90
+ }
91
+ catch (error) {
92
+ console.log(`Error fetching simple products: ${error}`);
93
+ throw error;
94
+ }
95
+ });
96
+ }
97
+ getProductOption(productId) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ const query = queries_1.GET_PRODUCT_OPTION;
100
+ const variablesHandle = {
101
+ partnerId: this.orgId,
102
+ storeChannel: this.storeId,
103
+ productId,
104
+ };
105
+ try {
106
+ const response = yield this.graphqlQuery(query, variablesHandle);
107
+ return response.getProductOption;
108
+ }
109
+ catch (error) {
110
+ console.log(`Error fetching simple products: ${error}`);
111
+ throw error;
112
+ }
113
+ });
114
+ }
115
+ getPolicy(groupId) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const query = queries_1.GET_POLICY;
118
+ const variablesHandle = {
119
+ groupId
120
+ };
121
+ try {
122
+ const response = yield this.graphqlQuery(query, variablesHandle);
123
+ return response.getPolicy;
124
+ }
125
+ catch (error) {
126
+ console.log(`Error fetching getPolicy: ${error}`);
127
+ throw error;
128
+ }
129
+ });
130
+ }
131
+ }
132
+ exports.ProductService = ProductService;
@@ -0,0 +1,94 @@
1
+ import { Service } from "../serviceSDK";
2
+ import { ServiceRequest } from "../../types/service";
3
+ export declare class ServiceManagementService extends Service {
4
+ /**
5
+ * Constructs a new ProductService 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
+ /**
12
+ * get service by id .
13
+ * @param serviceId - The id of the service
14
+ */
15
+ getServiceById(serviceId: string): Promise<any>;
16
+ /**
17
+ * get service by type
18
+ * @param type - The endpoint URL for the service.
19
+ */
20
+ /**
21
+ * get service by owner id
22
+ * @param ownerId - The endpoint URL for the service.
23
+ */
24
+ getServiceByOwnerId(ownerId: string): Promise<any>;
25
+ /**
26
+ * get service actions
27
+ * @param serviceId -
28
+ * @param actionType
29
+ * @param updatedBy
30
+ */
31
+ getServiceActions(serviceId: string): Promise<any>;
32
+ /**
33
+ * create service
34
+ * @param data
35
+ */
36
+ createService(data: ServiceRequest): Promise<any>;
37
+ /**
38
+ * create service
39
+ * @param data
40
+ * @param serviceId
41
+ * @param updatedBy
42
+ */
43
+ updateService(data: ServiceRequest, serviceId: String, updatedBy: string): Promise<any>;
44
+ /**
45
+ * delete service
46
+ * @param serviceId
47
+ * @param deletedBy
48
+ */
49
+ deleteService(serviceId: string, deletedBy: string): Promise<any>;
50
+ /**
51
+ * update attr value
52
+ * @param serviceId
53
+ * @param attrName
54
+ * @param attrValue
55
+ * @param updatedBy
56
+ */
57
+ updateAttrValue(serviceId: string, attrName: string, attrValue: string, updatedBy: string): Promise<any>;
58
+ /**
59
+ * delete attr value
60
+ * @param serviceId
61
+ * @param attrName
62
+ * @param updatedBy
63
+ */
64
+ deleteAttrValue(serviceId: string, attrName: string, updatedBy: string): Promise<any>;
65
+ /**
66
+ * update success action process status
67
+ * @param serviceId
68
+ * @param actionResult
69
+ * @param updatedBy
70
+ */
71
+ updateSuccessActionProcessStatus(serviceActionId: string, updatedBy: string): Promise<any>;
72
+ /**
73
+ * update fail action process status
74
+ * @param serviceId
75
+ * @param actionResult
76
+ * @param updatedBy
77
+ */
78
+ updateFailActionProcessStatus(serviceActionId: string, description: string, updatedBy: string): Promise<any>;
79
+ /**
80
+ * Creates a service ticket.
81
+ *
82
+ * @param {string} serviceId - The ID of the service.
83
+ * @param {string} name - The name of the service ticket.
84
+ * @param {string} createdBy - The user who created the service ticket.
85
+ * @param {string} description - The description of the service ticket.
86
+ * @returns {Promise<any>} - A promise that resolves to the created service ticket.
87
+ * @throws {Error} - If an error occurs during the creation of the service ticket.
88
+ */
89
+ createServiceTicket(serviceId: string, name: string, createdBy: string, description: string): Promise<any>;
90
+ getServiceTicket(serviceId: string): Promise<any>;
91
+ createServiceAction(serviceId: string, actionType: string, createdBy: string): Promise<any>;
92
+ addActionAttribute(actionId: string, attributeName: string, attributeValue: string, createdBy: string): Promise<any>;
93
+ getActionAttribute(actionId: string, attributeName: string): Promise<any>;
94
+ }
@@ -0,0 +1,348 @@
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.ServiceManagementService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ const queries_1 = require("../../graphql/service/queries");
15
+ const mutations_1 = require("../../graphql/service/mutations");
16
+ class ServiceManagementService extends serviceSDK_1.Service {
17
+ /**
18
+ * Constructs a new ProductService 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
+ /**
27
+ * get service by id .
28
+ * @param serviceId - The id of the service
29
+ */
30
+ getServiceById(serviceId) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const query = queries_1.GET_SERVICE_BY_ID;
33
+ const variables = {
34
+ partnerId: this.orgId,
35
+ serviceId,
36
+ };
37
+ try {
38
+ const response = yield this.graphqlQueryV2(query, variables);
39
+ return response.getServiceById;
40
+ }
41
+ catch (error) {
42
+ console.log(`Error in getServiceById: ${error}`);
43
+ throw error;
44
+ }
45
+ });
46
+ }
47
+ /**
48
+ * get service by type
49
+ * @param type - The endpoint URL for the service.
50
+ */
51
+ /**
52
+ * get service by owner id
53
+ * @param ownerId - The endpoint URL for the service.
54
+ */
55
+ getServiceByOwnerId(ownerId) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const query = queries_1.GET_SERVICE_BY_OWNER_ID;
58
+ const variables = {
59
+ partnerId: this.orgId,
60
+ ownerId,
61
+ };
62
+ try {
63
+ const response = yield this.graphqlQueryV2(query, variables);
64
+ return response.getServiceByOwnerId;
65
+ }
66
+ catch (error) {
67
+ console.log(`Error in getServiceByOwnerId :${error}`);
68
+ }
69
+ });
70
+ }
71
+ /**
72
+ * get service actions
73
+ * @param serviceId -
74
+ * @param actionType
75
+ * @param updatedBy
76
+ */
77
+ getServiceActions(serviceId) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const query = queries_1.GET_SERVICE_ACTION;
80
+ const variables = {
81
+ serviceId: serviceId,
82
+ };
83
+ try {
84
+ const response = yield this.graphqlQueryV2(query, variables);
85
+ return response.getServiceActions;
86
+ }
87
+ catch (error) {
88
+ throw error;
89
+ }
90
+ });
91
+ }
92
+ /**
93
+ * create service
94
+ * @param data
95
+ */
96
+ createService(data) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const mutation = mutations_1.CREATE_SERVICE;
99
+ const variables = {
100
+ partnerId: this.orgId,
101
+ createModel: data,
102
+ };
103
+ try {
104
+ const response = yield this.graphqlMutationV2(mutation, variables);
105
+ return response.createService;
106
+ }
107
+ catch (error) {
108
+ throw error;
109
+ }
110
+ });
111
+ }
112
+ /**
113
+ * create service
114
+ * @param data
115
+ * @param serviceId
116
+ * @param updatedBy
117
+ */
118
+ updateService(data, serviceId, updatedBy) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const mutation = mutations_1.UPDATE_SERVICE;
121
+ const variables = {
122
+ partnerId: this.orgId,
123
+ serviceId: serviceId,
124
+ updateModel: data,
125
+ updatedBy: updatedBy,
126
+ };
127
+ try {
128
+ const response = yield this.graphqlMutationV2(mutation, variables);
129
+ return response.updateService;
130
+ }
131
+ catch (error) {
132
+ throw error;
133
+ }
134
+ });
135
+ }
136
+ /**
137
+ * delete service
138
+ * @param serviceId
139
+ * @param deletedBy
140
+ */
141
+ deleteService(serviceId, deletedBy) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const mutation = mutations_1.DELETE_SERVICE;
144
+ const variables = {
145
+ partnerId: this.orgId,
146
+ serviceId: serviceId,
147
+ deletedBy: deletedBy,
148
+ };
149
+ try {
150
+ const response = yield this.graphqlMutationV2(mutation, variables);
151
+ return response.deleteService;
152
+ }
153
+ catch (error) {
154
+ throw error;
155
+ }
156
+ });
157
+ }
158
+ /**
159
+ * update attr value
160
+ * @param serviceId
161
+ * @param attrName
162
+ * @param attrValue
163
+ * @param updatedBy
164
+ */
165
+ updateAttrValue(serviceId, attrName, attrValue, updatedBy) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const mutation = mutations_1.UPDATE_ATTR_VALUE;
168
+ const variables = {
169
+ partnerId: this.orgId,
170
+ serviceId: serviceId,
171
+ attrName: attrName,
172
+ attrValue: attrValue,
173
+ updatedBy: updatedBy,
174
+ };
175
+ try {
176
+ const response = yield this.graphqlMutationV2(mutation, variables);
177
+ return response.updateAttrValue;
178
+ }
179
+ catch (error) {
180
+ throw error;
181
+ }
182
+ });
183
+ }
184
+ /**
185
+ * delete attr value
186
+ * @param serviceId
187
+ * @param attrName
188
+ * @param updatedBy
189
+ */
190
+ deleteAttrValue(serviceId, attrName, updatedBy) {
191
+ return __awaiter(this, void 0, void 0, function* () {
192
+ const mutation = mutations_1.DELETE_ATTR_VALUE;
193
+ const variables = {
194
+ partnerId: this.orgId,
195
+ serviceId: serviceId,
196
+ attrName: attrName,
197
+ updatedBy: updatedBy,
198
+ };
199
+ try {
200
+ const response = yield this.graphqlMutationV2(mutation, variables);
201
+ return response.deleteAttrValue;
202
+ }
203
+ catch (error) {
204
+ throw error;
205
+ }
206
+ });
207
+ }
208
+ /**
209
+ * update success action process status
210
+ * @param serviceId
211
+ * @param actionResult
212
+ * @param updatedBy
213
+ */
214
+ updateSuccessActionProcessStatus(serviceActionId, updatedBy) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ const mutation = mutations_1.UPDATE_SUCCESS_ACTION_PROCESS_STATUS;
217
+ const variables = {
218
+ serviceActionId: serviceActionId,
219
+ updatedBy: updatedBy,
220
+ };
221
+ try {
222
+ const response = yield this.graphqlMutationV2(mutation, variables);
223
+ return response;
224
+ }
225
+ catch (error) {
226
+ throw error;
227
+ }
228
+ });
229
+ }
230
+ /**
231
+ * update fail action process status
232
+ * @param serviceId
233
+ * @param actionResult
234
+ * @param updatedBy
235
+ */
236
+ updateFailActionProcessStatus(serviceActionId, description, updatedBy) {
237
+ return __awaiter(this, void 0, void 0, function* () {
238
+ const mutation = mutations_1.UPDATE_FAIL_ACTION_PROCESS_STATUS;
239
+ const variables = {
240
+ serviceActionId: serviceActionId,
241
+ description: description,
242
+ updatedBy: updatedBy,
243
+ };
244
+ try {
245
+ const response = yield this.graphqlMutationV2(mutation, variables);
246
+ return response;
247
+ }
248
+ catch (error) {
249
+ throw error;
250
+ }
251
+ });
252
+ }
253
+ /**
254
+ * Creates a service ticket.
255
+ *
256
+ * @param {string} serviceId - The ID of the service.
257
+ * @param {string} name - The name of the service ticket.
258
+ * @param {string} createdBy - The user who created the service ticket.
259
+ * @param {string} description - The description of the service ticket.
260
+ * @returns {Promise<any>} - A promise that resolves to the created service ticket.
261
+ * @throws {Error} - If an error occurs during the creation of the service ticket.
262
+ */
263
+ createServiceTicket(serviceId, name, createdBy, description) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ const mutation = mutations_1.CREATE_SERVICE_TICKET;
266
+ const variables = {
267
+ serviceId,
268
+ name,
269
+ createdBy,
270
+ description,
271
+ };
272
+ try {
273
+ const response = yield this.graphqlMutationV2(mutation, variables);
274
+ return response.createServiceTicket;
275
+ }
276
+ catch (error) {
277
+ throw error;
278
+ }
279
+ });
280
+ }
281
+ getServiceTicket(serviceId) {
282
+ return __awaiter(this, void 0, void 0, function* () {
283
+ const query = queries_1.GET_SERVICE_TICKETS;
284
+ const variables = {
285
+ serviceId,
286
+ };
287
+ try {
288
+ const response = yield this.graphqlQueryV2(query, variables);
289
+ return response.getServiceTickets;
290
+ }
291
+ catch (error) {
292
+ throw error;
293
+ }
294
+ });
295
+ }
296
+ createServiceAction(serviceId, actionType, createdBy) {
297
+ return __awaiter(this, void 0, void 0, function* () {
298
+ const mutation = mutations_1.CREATE_SERVICE_ACTION;
299
+ const variables = {
300
+ serviceId,
301
+ actionType,
302
+ createdBy,
303
+ };
304
+ try {
305
+ const response = yield this.graphqlMutationV2(mutation, variables);
306
+ return response.createServiceAction;
307
+ }
308
+ catch (error) {
309
+ throw error;
310
+ }
311
+ });
312
+ }
313
+ addActionAttribute(actionId, attributeName, attributeValue, createdBy) {
314
+ return __awaiter(this, void 0, void 0, function* () {
315
+ const mutation = mutations_1.ADD_ACTION_ATTRIBUTE;
316
+ const variables = {
317
+ actionId,
318
+ attributeName,
319
+ attributeValue,
320
+ createdBy,
321
+ };
322
+ try {
323
+ const response = yield this.graphqlMutationV2(mutation, variables);
324
+ return response.addActionAttribute;
325
+ }
326
+ catch (error) {
327
+ throw error;
328
+ }
329
+ });
330
+ }
331
+ getActionAttribute(actionId, attributeName) {
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ const query = queries_1.GET_ACTION_ATTRIBUTE;
334
+ const variables = {
335
+ actionId,
336
+ attributeName,
337
+ };
338
+ try {
339
+ const response = yield this.graphqlQueryV2(query, variables);
340
+ return response.getActionAttribute;
341
+ }
342
+ catch (error) {
343
+ throw error;
344
+ }
345
+ });
346
+ }
347
+ }
348
+ exports.ServiceManagementService = ServiceManagementService;