@longvansoftware/service-js-client 2.1.9 → 2.2.1
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 +13 -1
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +82 -8
- package/dist/src/lib/auth/index.d.ts +1 -0
- package/dist/src/lib/auth/index.js +16 -0
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +14 -0
- package/dist/src/types/cloud.d.ts +1 -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
|
@@ -9,3 +9,4 @@ export declare const GET_EMAIL_BY_PARTYID: DocumentNode;
|
|
|
9
9
|
export declare const GET_ACCESS_TOKEN_BY_OTP: DocumentNode;
|
|
10
10
|
export declare const GET_PARTY_DETAIL_BY_PHONE: (fields?: string[]) => DocumentNode;
|
|
11
11
|
export declare const GET_ORGANIZATIONS_BY_PARTYID: (fields?: string[]) => DocumentNode;
|
|
12
|
+
export declare const CHECK_ENABLED_2FA: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_ORGANIZATIONS_BY_PARTYID = exports.GET_PARTY_DETAIL_BY_PHONE = 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;
|
|
3
|
+
exports.CHECK_ENABLED_2FA = exports.GET_ORGANIZATIONS_BY_PARTYID = exports.GET_PARTY_DETAIL_BY_PHONE = 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!) {
|
|
@@ -110,3 +110,15 @@ const GET_ORGANIZATIONS_BY_PARTYID = (fields = []) => {
|
|
|
110
110
|
`;
|
|
111
111
|
};
|
|
112
112
|
exports.GET_ORGANIZATIONS_BY_PARTYID = GET_ORGANIZATIONS_BY_PARTYID;
|
|
113
|
+
const CHECK_ENABLED_2FA = (fields = []) => {
|
|
114
|
+
const fieldStr = fields.join("\n ");
|
|
115
|
+
const hasFields = fields.length > 0;
|
|
116
|
+
return (0, graphql_tag_1.gql) `
|
|
117
|
+
query CheckEnabled2FA($partyId: String!) {
|
|
118
|
+
checkEnabled2FA(partyId: $partyId) {
|
|
119
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
};
|
|
124
|
+
exports.CHECK_ENABLED_2FA = CHECK_ENABLED_2FA;
|
|
@@ -25,3 +25,4 @@ export declare const GET_TAGS_BY_CATEGORY: DocumentNode;
|
|
|
25
25
|
export declare const GET_LIST_PRODUCTS_CONFIG_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
26
26
|
export declare const GET_CATEGORIES: DocumentNode;
|
|
27
27
|
export declare const GET_PRICE_MENUS: DocumentNode;
|
|
28
|
+
export declare const GET_SIMPLE_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
|
6
6
|
// query GetProductById(
|
|
@@ -287,45 +287,53 @@ exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
|
287
287
|
}
|
|
288
288
|
`;
|
|
289
289
|
exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
290
|
-
query
|
|
290
|
+
query getSimpleProducts(
|
|
291
291
|
$partnerId: String!
|
|
292
292
|
$storeChannel: String!
|
|
293
|
+
$hash: String
|
|
293
294
|
$category: String
|
|
294
295
|
$product: String
|
|
295
296
|
$sku: String
|
|
296
|
-
$tag: String
|
|
297
297
|
$priceFrom: BigDecimal
|
|
298
298
|
$priceTo: BigDecimal
|
|
299
|
+
$tag: String
|
|
299
300
|
$status: String
|
|
301
|
+
$toDate: Long
|
|
302
|
+
$fromDate: Long
|
|
300
303
|
$productType: String
|
|
301
|
-
$subType: String
|
|
302
304
|
$sortOrder: String
|
|
303
305
|
$sortBy: String
|
|
304
306
|
$brandId: String
|
|
307
|
+
$feature: String
|
|
305
308
|
$keyword: String
|
|
309
|
+
$buildType: String
|
|
306
310
|
$display: String
|
|
307
|
-
$
|
|
311
|
+
$subType: String
|
|
308
312
|
$currentPage: Int
|
|
309
313
|
$maxResult: Int
|
|
310
314
|
) {
|
|
311
315
|
getSimpleProducts(
|
|
312
316
|
partnerId: $partnerId
|
|
313
317
|
storeChannel: $storeChannel
|
|
318
|
+
hash: $hash
|
|
314
319
|
category: $category
|
|
315
320
|
product: $product
|
|
316
321
|
sku: $sku
|
|
317
|
-
tag: $tag
|
|
318
322
|
priceFrom: $priceFrom
|
|
319
323
|
priceTo: $priceTo
|
|
324
|
+
tag: $tag
|
|
320
325
|
status: $status
|
|
326
|
+
toDate: $toDate
|
|
327
|
+
fromDate: $fromDate
|
|
321
328
|
productType: $productType
|
|
322
|
-
subType: $subType
|
|
323
329
|
sortOrder: $sortOrder
|
|
324
330
|
sortBy: $sortBy
|
|
325
331
|
brandId: $brandId
|
|
332
|
+
feature: $feature
|
|
326
333
|
keyword: $keyword
|
|
334
|
+
buildType: $buildType
|
|
327
335
|
display: $display
|
|
328
|
-
|
|
336
|
+
subType: $subType
|
|
329
337
|
currentPage: $currentPage
|
|
330
338
|
maxResult: $maxResult
|
|
331
339
|
) {
|
|
@@ -1103,3 +1111,69 @@ exports.GET_PRICE_MENUS = (0, graphql_tag_1.gql) `
|
|
|
1103
1111
|
}
|
|
1104
1112
|
}
|
|
1105
1113
|
`;
|
|
1114
|
+
const GET_SIMPLE_PRODUCTS_DYNAMIC = (fields = []) => {
|
|
1115
|
+
const fieldStr = fields.join("\n ");
|
|
1116
|
+
const hasFields = fields.length > 0;
|
|
1117
|
+
return (0, graphql_tag_1.gql) `
|
|
1118
|
+
query getSimpleProducts(
|
|
1119
|
+
$partnerId: String!
|
|
1120
|
+
$storeChannel: String!
|
|
1121
|
+
$hash: String
|
|
1122
|
+
$category: String
|
|
1123
|
+
$product: String
|
|
1124
|
+
$sku: String
|
|
1125
|
+
$priceFrom: BigDecimal
|
|
1126
|
+
$priceTo: BigDecimal
|
|
1127
|
+
$tag: String
|
|
1128
|
+
$status: String
|
|
1129
|
+
$toDate: Long
|
|
1130
|
+
$fromDate: Long
|
|
1131
|
+
$productType: String
|
|
1132
|
+
$sortOrder: String
|
|
1133
|
+
$sortBy: String
|
|
1134
|
+
$brandId: String
|
|
1135
|
+
$feature: String
|
|
1136
|
+
$keyword: String
|
|
1137
|
+
$buildType: String
|
|
1138
|
+
$display: String
|
|
1139
|
+
$subType: String
|
|
1140
|
+
$currentPage: Int
|
|
1141
|
+
$maxResult: Int
|
|
1142
|
+
) {
|
|
1143
|
+
getSimpleProducts(
|
|
1144
|
+
partnerId: $partnerId
|
|
1145
|
+
storeChannel: $storeChannel
|
|
1146
|
+
hash: $hash
|
|
1147
|
+
category: $category
|
|
1148
|
+
product: $product
|
|
1149
|
+
sku: $sku
|
|
1150
|
+
priceFrom: $priceFrom
|
|
1151
|
+
priceTo: $priceTo
|
|
1152
|
+
tag: $tag
|
|
1153
|
+
status: $status
|
|
1154
|
+
toDate: $toDate
|
|
1155
|
+
fromDate: $fromDate
|
|
1156
|
+
productType: $productType
|
|
1157
|
+
sortOrder: $sortOrder
|
|
1158
|
+
sortBy: $sortBy
|
|
1159
|
+
brandId: $brandId
|
|
1160
|
+
feature: $feature
|
|
1161
|
+
keyword: $keyword
|
|
1162
|
+
buildType: $buildType
|
|
1163
|
+
display: $display
|
|
1164
|
+
subType: $subType
|
|
1165
|
+
currentPage: $currentPage
|
|
1166
|
+
maxResult: $maxResult
|
|
1167
|
+
) {
|
|
1168
|
+
total
|
|
1169
|
+
currentPage
|
|
1170
|
+
maxResult
|
|
1171
|
+
totalPage
|
|
1172
|
+
data {
|
|
1173
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
`;
|
|
1178
|
+
};
|
|
1179
|
+
exports.GET_SIMPLE_PRODUCTS_DYNAMIC = GET_SIMPLE_PRODUCTS_DYNAMIC;
|
|
@@ -47,4 +47,5 @@ export declare class AuthService extends Service {
|
|
|
47
47
|
getPartyDetailByPhone(phone: string, fields: string[]): Promise<any>;
|
|
48
48
|
createPartyDetail(name: string, phone: string, createdBy: string, source: string, fields: string[]): Promise<any>;
|
|
49
49
|
getOrganizationsByPartyIdDynamic(partyId: string, fields: string[]): Promise<any>;
|
|
50
|
+
checkEnabled2FA(partyId: string, fields: string[]): Promise<any>;
|
|
50
51
|
}
|
|
@@ -444,5 +444,21 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
444
444
|
}
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
|
+
checkEnabled2FA(partyId, fields) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
const query = (0, queries_1.CHECK_ENABLED_2FA)(fields);
|
|
450
|
+
const variables = {
|
|
451
|
+
partyId
|
|
452
|
+
};
|
|
453
|
+
try {
|
|
454
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
455
|
+
return response.checkEnabled2FA;
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
console.log(`Error in checkEnabled2FA: ${error}`);
|
|
459
|
+
throw error;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
447
463
|
}
|
|
448
464
|
exports.AuthService = AuthService;
|
|
@@ -52,4 +52,5 @@ export declare class ProductService extends Service {
|
|
|
52
52
|
getListProductConfigDynamic(productId: string, store: string, fields: string[]): Promise<any>;
|
|
53
53
|
getCategories(): Promise<any>;
|
|
54
54
|
getPriceMenus(categoryId: string, store: string): Promise<any>;
|
|
55
|
+
getSimpleProductsDynamic(variables: any, storeId: string, fields: string[]): Promise<any>;
|
|
55
56
|
}
|
|
@@ -387,5 +387,19 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
|
+
getSimpleProductsDynamic(variables, storeId, fields) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
392
|
+
const query = (0, queries_1.GET_SIMPLE_PRODUCTS_DYNAMIC)(fields);
|
|
393
|
+
const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: storeId ? storeId : this.storeId }, variables);
|
|
394
|
+
try {
|
|
395
|
+
const response = yield this.graphqlQuery(query, variablesHandle);
|
|
396
|
+
return response.getSimpleProducts;
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
console.log(`Error fetching getSimpleProductsDynamic: ${error}`);
|
|
400
|
+
throw error;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
390
404
|
}
|
|
391
405
|
exports.ProductService = ProductService;
|
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;
|