@longvansoftware/service-js-client 1.13.7 → 1.13.9
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/auth/queries.d.ts +1 -0
- package/dist/src/graphql/auth/queries.js +6 -1
- package/dist/src/graphql/crm/queries.d.ts +3 -0
- package/dist/src/graphql/crm/queries.js +28 -1
- package/dist/src/lib/auth/index.d.ts +1 -0
- package/dist/src/lib/auth/index.js +18 -0
- package/dist/src/lib/cloud/index.d.ts +3 -0
- package/dist/src/lib/cloud/index.js +46 -0
- package/dist/src/lib/crm/index.d.ts +3 -0
- package/dist/src/lib/crm/index.js +55 -0
- package/package.json +1 -1
- package/dist/src/lib/service.d.ts +0 -14
- package/dist/src/lib/service.js +0 -101
- package/dist/src/utils/build-field-string.d.ts +0 -1
- package/dist/src/utils/build-field-string.js +0 -16
@@ -5,3 +5,4 @@ export declare const CHECK_USERNAME_EXISTED: import("graphql").DocumentNode;
|
|
5
5
|
export declare const GET_USER_LOGIN_BY_PARTY_ID: import("graphql").DocumentNode;
|
6
6
|
export declare const GET_PHONE_BY_PARTYID: import("graphql").DocumentNode;
|
7
7
|
export declare const GET_EMAIL_BY_PARTYID: import("graphql").DocumentNode;
|
8
|
+
export declare const GET_ACCESS_TOKEN_BY_OTP: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
3
|
+
exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
@@ -73,3 +73,8 @@ exports.GET_EMAIL_BY_PARTYID = (0, graphql_tag_1.gql) `
|
|
73
73
|
getEmailByPartyId(partyId: $partyId)
|
74
74
|
}
|
75
75
|
`;
|
76
|
+
exports.GET_ACCESS_TOKEN_BY_OTP = (0, graphql_tag_1.gql) `
|
77
|
+
query GetAccessTokenByOTP($otpCode: String!, $phone: String!, $channelType: String) {
|
78
|
+
getAccessTokenByOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
|
79
|
+
}
|
80
|
+
`;
|
@@ -3,6 +3,9 @@ export declare const GET_LIST_TODO: import("graphql").DocumentNode;
|
|
3
3
|
export declare const GET_LIST_WORK_EFFORT_TYPE: import("graphql").DocumentNode;
|
4
4
|
export declare const GET_LIST_TICKET: import("graphql").DocumentNode;
|
5
5
|
export declare const GET_TICKET_BY_ID: import("graphql").DocumentNode;
|
6
|
+
export declare const GET_AVERAGE_RATING: import("graphql").DocumentNode;
|
7
|
+
export declare const GET_URL_EVALUATION: import("graphql").DocumentNode;
|
8
|
+
export declare const GET_NUMBER_OF_TICKET_EVALUATION: import("graphql").DocumentNode;
|
6
9
|
export declare const GET_ATTACHMENT_BY_WORK_EFFORT_ID: import("graphql").DocumentNode;
|
7
10
|
export declare const GET_LIST_COMMENT: import("graphql").DocumentNode;
|
8
11
|
export declare const GET_RESUME_ID_BY_RESOURCE: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
|
3
|
+
exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.GET_LIST_OPPORTUNITY_QUERY = (0, graphql_tag_1.gql) `
|
6
6
|
query GetListOpportunity(
|
@@ -218,6 +218,33 @@ exports.GET_TICKET_BY_ID = (0, graphql_tag_1.gql) `
|
|
218
218
|
}
|
219
219
|
}
|
220
220
|
`;
|
221
|
+
exports.GET_AVERAGE_RATING = (0, graphql_tag_1.gql) `
|
222
|
+
query GetAverageRating($targetIds: [String]!, $customerId: String, $evaluationType: String, $orgId: String) {
|
223
|
+
getAverageRating(targetIds: $targetIds, customerId: $customerId, evaluationType: $evaluationType, orgId: $orgId,) {
|
224
|
+
url
|
225
|
+
targetId
|
226
|
+
evaluationType
|
227
|
+
averageRating
|
228
|
+
haveEvaluation
|
229
|
+
}
|
230
|
+
}
|
231
|
+
`;
|
232
|
+
exports.GET_URL_EVALUATION = (0, graphql_tag_1.gql) `
|
233
|
+
query GetUrlEvaluation($targetIds: [String]!, $customerId: String, $evaluationType: String, $orgId: String) {
|
234
|
+
getUrlEvaluation(targetIds: $targetIds, customerId: $customerId, evaluationType: $evaluationType, orgId: $orgId,) {
|
235
|
+
url
|
236
|
+
targetId
|
237
|
+
evaluationType
|
238
|
+
averageRating
|
239
|
+
haveEvaluation
|
240
|
+
}
|
241
|
+
}
|
242
|
+
`;
|
243
|
+
exports.GET_NUMBER_OF_TICKET_EVALUATION = (0, graphql_tag_1.gql) `
|
244
|
+
query GetNumberOfTicketEvaluation($customerId: String, $orgId: String) {
|
245
|
+
getNumberOfTicketEvaluation(customerId: $customerId, orgId: $orgId,)
|
246
|
+
}
|
247
|
+
`;
|
221
248
|
exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = (0, graphql_tag_1.gql) `
|
222
249
|
query GetAttachmentByWorkEffortId(
|
223
250
|
$partyId: String!
|
@@ -39,6 +39,7 @@ export declare class AuthService extends Service {
|
|
39
39
|
getUserLoginsByPartyId(partyId: string): Promise<any>;
|
40
40
|
sendOTP(phone: string, channelType: string | null): Promise<any>;
|
41
41
|
validateOTP(otpCode: string, phone: string, channelType: string | null): Promise<any>;
|
42
|
+
getAccessTokenByOTP(otpCode: string, phone: string, channelType: string | null): Promise<any>;
|
42
43
|
createUserLogin(userLoginId: string): Promise<any>;
|
43
44
|
createUserDetailWithoutUserLogin(name: string, phone: string, email: string): Promise<any>;
|
44
45
|
getPhoneByPartyId(partyId: string): Promise<any>;
|
@@ -307,6 +307,24 @@ class AuthService extends serviceSDK_1.Service {
|
|
307
307
|
}
|
308
308
|
});
|
309
309
|
}
|
310
|
+
getAccessTokenByOTP(otpCode, phone, channelType) {
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
312
|
+
const mutation = queries_1.GET_ACCESS_TOKEN_BY_OTP;
|
313
|
+
const variables = {
|
314
|
+
otpCode,
|
315
|
+
phone,
|
316
|
+
channelType
|
317
|
+
};
|
318
|
+
try {
|
319
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
320
|
+
return response.getAccessTokenByOTP;
|
321
|
+
}
|
322
|
+
catch (error) {
|
323
|
+
console.log(`Error in getAccessTokenByOTP: ${error}`);
|
324
|
+
throw error;
|
325
|
+
}
|
326
|
+
});
|
327
|
+
}
|
310
328
|
createUserLogin(userLoginId) {
|
311
329
|
return __awaiter(this, void 0, void 0, function* () {
|
312
330
|
const mutation = mutations_1.CREATE_USER_LOGIN;
|
@@ -28,12 +28,15 @@ export declare class CloudService extends Service {
|
|
28
28
|
getServicesByOrderId(orderId: string): Promise<any>;
|
29
29
|
checkDomainNameAvailable(domainName: string): Promise<any>;
|
30
30
|
checkDomainNameAvailableVnnic(domainNames: [string]): Promise<any>;
|
31
|
+
checkDomainName(domainName: string): Promise<any>;
|
32
|
+
checkListDomainName(domainNames: [string]): Promise<any>;
|
31
33
|
getServiceTypeList(): Promise<any>;
|
32
34
|
createDomainContact(serviceId: string, domainContacts: any): Promise<any>;
|
33
35
|
getDomainContacts(serviceId: string): Promise<any>;
|
34
36
|
getOwnersByCustomerId(userId: string): Promise<any>;
|
35
37
|
getContactsByOwnerId(ownerId: string): Promise<any>;
|
36
38
|
getWhoisDomainInfo(domainName: string): Promise<any>;
|
39
|
+
getDomainInfo(domainName: string): Promise<any>;
|
37
40
|
getDomainSupplier(serviceId: string): Promise<any>;
|
38
41
|
checkDomainExist(domainName: string): Promise<any>;
|
39
42
|
getOrderChangeResourceTerm(serviceId: string, createdBy: string): Promise<any>;
|
@@ -327,6 +327,38 @@ class CloudService extends serviceSDK_1.Service {
|
|
327
327
|
}
|
328
328
|
});
|
329
329
|
}
|
330
|
+
checkDomainName(domainName) {
|
331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
332
|
+
const mutation = mutations_1.CHECK_DOMAIN_NAME;
|
333
|
+
const variables = {
|
334
|
+
domainName,
|
335
|
+
};
|
336
|
+
try {
|
337
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
338
|
+
return response.checkDomainName;
|
339
|
+
}
|
340
|
+
catch (error) {
|
341
|
+
console.log(`Error in checkDomainName: ${error}`);
|
342
|
+
throw error;
|
343
|
+
}
|
344
|
+
});
|
345
|
+
}
|
346
|
+
checkListDomainName(domainNames) {
|
347
|
+
return __awaiter(this, void 0, void 0, function* () {
|
348
|
+
const mutation = mutations_1.CHECK_LIST_DOMAIN_NAME;
|
349
|
+
const variables = {
|
350
|
+
domainNames,
|
351
|
+
};
|
352
|
+
try {
|
353
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
354
|
+
return response.checkListDomainName;
|
355
|
+
}
|
356
|
+
catch (error) {
|
357
|
+
console.log(`Error in checkListDomainName: ${error}`);
|
358
|
+
throw error;
|
359
|
+
}
|
360
|
+
});
|
361
|
+
}
|
330
362
|
// async checkDomainNameAvailable(domainName: string) {
|
331
363
|
// const query = CHECK_DOMAIN_NAME_AVAILABLE;
|
332
364
|
// const variables = {
|
@@ -437,6 +469,20 @@ class CloudService extends serviceSDK_1.Service {
|
|
437
469
|
}
|
438
470
|
});
|
439
471
|
}
|
472
|
+
getDomainInfo(domainName) {
|
473
|
+
return __awaiter(this, void 0, void 0, function* () {
|
474
|
+
const mutation = mutations_1.GET_DOMAIN_INFO;
|
475
|
+
const variables = { domainName };
|
476
|
+
try {
|
477
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
478
|
+
return response.getDomainInfo;
|
479
|
+
}
|
480
|
+
catch (error) {
|
481
|
+
console.log(`Error in getDomainInfo: ${error}`);
|
482
|
+
throw error;
|
483
|
+
}
|
484
|
+
});
|
485
|
+
}
|
440
486
|
// async getWhoisDomainInfo(domainName: string) {
|
441
487
|
// const query = GET_WHOIS_DOMAIN_INFO;
|
442
488
|
// const variables = { domainName };
|
@@ -16,6 +16,9 @@ export declare class CrmService extends Service {
|
|
16
16
|
getListTicket(performerId: string, getTicketRequest: getTicketRequest): Promise<any>;
|
17
17
|
addTicket(performerId: string, addTicketRequest: AddTicketRequest, addAttachmentRequest: [AddAttachmentRequest]): Promise<any>;
|
18
18
|
getTicketById(ticketId: string): Promise<any>;
|
19
|
+
getAverageRating(targetIds: [string], customerId: string, evaluationType: string): Promise<any>;
|
20
|
+
getUrlEvaluation(targetIds: [string], customerId: string, evaluationType: string): Promise<any>;
|
21
|
+
getNumberOfTicketEvaluation(customerId: string): Promise<any>;
|
19
22
|
getAttachmentByWorkEffortId(workEffortIds: [string]): Promise<any>;
|
20
23
|
getListComment(getCommentRequest: GetCommentRequest): Promise<any>;
|
21
24
|
addComment(params: any): Promise<any>;
|
@@ -240,6 +240,61 @@ class CrmService extends serviceSDK_1.Service {
|
|
240
240
|
}
|
241
241
|
});
|
242
242
|
}
|
243
|
+
getAverageRating(targetIds, customerId, evaluationType) {
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
245
|
+
const query = queries_1.GET_AVERAGE_RATING;
|
246
|
+
const variables = {
|
247
|
+
targetIds,
|
248
|
+
customerId,
|
249
|
+
evaluationType,
|
250
|
+
orgId: this.orgId
|
251
|
+
};
|
252
|
+
try {
|
253
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
254
|
+
return response.getAverageRating;
|
255
|
+
}
|
256
|
+
catch (error) {
|
257
|
+
console.log(`Error in getAverageRating: ${error}`);
|
258
|
+
throw error;
|
259
|
+
}
|
260
|
+
});
|
261
|
+
}
|
262
|
+
getUrlEvaluation(targetIds, customerId, evaluationType) {
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
264
|
+
const query = queries_1.GET_URL_EVALUATION;
|
265
|
+
const variables = {
|
266
|
+
targetIds,
|
267
|
+
customerId,
|
268
|
+
evaluationType,
|
269
|
+
orgId: this.orgId
|
270
|
+
};
|
271
|
+
try {
|
272
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
273
|
+
return response.getUrlEvaluation;
|
274
|
+
}
|
275
|
+
catch (error) {
|
276
|
+
console.log(`Error in getUrlEvaluation: ${error}`);
|
277
|
+
throw error;
|
278
|
+
}
|
279
|
+
});
|
280
|
+
}
|
281
|
+
getNumberOfTicketEvaluation(customerId) {
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
283
|
+
const query = queries_1.GET_NUMBER_OF_TICKET_EVALUATION;
|
284
|
+
const variables = {
|
285
|
+
customerId,
|
286
|
+
orgId: this.orgId
|
287
|
+
};
|
288
|
+
try {
|
289
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
290
|
+
return response.getNumberOfTicketEvaluation;
|
291
|
+
}
|
292
|
+
catch (error) {
|
293
|
+
console.log(`Error in getNumberOfTicketEvaluation: ${error}`);
|
294
|
+
throw error;
|
295
|
+
}
|
296
|
+
});
|
297
|
+
}
|
243
298
|
getAttachmentByWorkEffortId(workEffortIds) {
|
244
299
|
return __awaiter(this, void 0, void 0, function* () {
|
245
300
|
const query = queries_1.GET_ATTACHMENT_BY_WORK_EFFORT_ID;
|
package/package.json
CHANGED
@@ -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
|
-
}
|
package/dist/src/lib/service.js
DELETED
@@ -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 +0,0 @@
|
|
1
|
-
export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
|
@@ -1,16 +0,0 @@
|
|
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;
|