@longvansoftware/service-js-client 2.3.1 → 2.3.3
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/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +19 -1
- package/dist/src/graphql/storage_s3/mutations.js +0 -2
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +18 -0
- package/dist/src/lib/storage_s3/index.d.ts +1 -1
- package/dist/src/lib/storage_s3/index.js +1 -2
- package/package.json +1 -1
|
@@ -29,3 +29,4 @@ export declare const GET_PRICE_MENUS: DocumentNode;
|
|
|
29
29
|
export declare const GET_SIMPLE_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
30
30
|
export declare const GET_PRODUCT_RELATED_TO_ARTICLE: (fields?: string[]) => DocumentNode;
|
|
31
31
|
export declare const GET_PRODUCTS_FEATURE_TYPE_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
32
|
+
export declare const GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = 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_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = 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_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = 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(
|
|
@@ -1235,3 +1235,21 @@ const GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = (fields = []) => {
|
|
|
1235
1235
|
`;
|
|
1236
1236
|
};
|
|
1237
1237
|
exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = GET_PRODUCTS_FEATURE_TYPE_DYNAMIC;
|
|
1238
|
+
const GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = (fields = []) => {
|
|
1239
|
+
const fieldStr = fields.join("\n ");
|
|
1240
|
+
const hasFields = fields.length > 0;
|
|
1241
|
+
return (0, graphql_tag_1.gql) `
|
|
1242
|
+
query getProductSimpleByHandle(
|
|
1243
|
+
$partnerId: String!
|
|
1244
|
+
$storeChannel: String!
|
|
1245
|
+
$handle: String
|
|
1246
|
+
) {
|
|
1247
|
+
getProductSimpleByHandle(
|
|
1248
|
+
partnerId: $partnerId
|
|
1249
|
+
storeChannel: $storeChannel
|
|
1250
|
+
handle: $handle
|
|
1251
|
+
) ${hasFields ? `{ ${fieldStr} }` : ""}
|
|
1252
|
+
}
|
|
1253
|
+
`;
|
|
1254
|
+
};
|
|
1255
|
+
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC;
|
|
@@ -512,7 +512,6 @@ const UPDATE_CORS_BUCKET = (fields = []) => {
|
|
|
512
512
|
const hasFields = fields.length > 0;
|
|
513
513
|
return (0, graphql_tag_1.gql) `
|
|
514
514
|
mutation UpdateCorsBucket(
|
|
515
|
-
$s3UserId: String!,
|
|
516
515
|
$bucketId: String!,
|
|
517
516
|
$allowedMethods: [String],
|
|
518
517
|
$allowedOrigins: [String],
|
|
@@ -524,7 +523,6 @@ const UPDATE_CORS_BUCKET = (fields = []) => {
|
|
|
524
523
|
$serviceId: String!
|
|
525
524
|
) {
|
|
526
525
|
updateCorsBucket(
|
|
527
|
-
s3UserId: $s3UserId,
|
|
528
526
|
bucketId: $bucketId,
|
|
529
527
|
allowedMethods: $allowedMethods,
|
|
530
528
|
allowedOrigins: $allowedOrigins,
|
|
@@ -56,4 +56,5 @@ export declare class ProductService extends Service {
|
|
|
56
56
|
getSimpleProductsDynamic(variables: any, storeId: string, fields: string[]): Promise<any>;
|
|
57
57
|
getProductRelatedToArticle(articleId: string, storeId: string, fields: string[]): Promise<any>;
|
|
58
58
|
getProductFeatureTypesDynamic(productId: string, storeId: string, fields: string[]): Promise<any>;
|
|
59
|
+
getProductSimpleByHandle(handle: string, store: string, fields: string[]): Promise<any>;
|
|
59
60
|
}
|
|
@@ -455,5 +455,23 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
|
+
getProductSimpleByHandle(handle, store, fields) {
|
|
459
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
460
|
+
const query = (0, queries_1.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC)(fields);
|
|
461
|
+
const variablesHandle = {
|
|
462
|
+
partnerId: this.orgId,
|
|
463
|
+
storeChannel: store ? store : this.storeId,
|
|
464
|
+
handle,
|
|
465
|
+
};
|
|
466
|
+
try {
|
|
467
|
+
const response = yield this.graphqlQueryV2(query, variablesHandle);
|
|
468
|
+
return response.getProductSimpleByHandle;
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
console.log(`Error fetching getProductSimpleByHandle : ${error}`);
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
458
476
|
}
|
|
459
477
|
exports.ProductService = ProductService;
|
|
@@ -29,7 +29,7 @@ export declare class StorageS3Service extends Service {
|
|
|
29
29
|
removeS3Domain(s3UserId: string, domainId: string, byUser: string, serviceId: string, fields: string[]): Promise<any>;
|
|
30
30
|
getListCorsByS3UserId(s3UserId: string, bucketId: string, serviceId: string, fields: string[]): Promise<any>;
|
|
31
31
|
addCorsBucket(s3UserId: string, bucketId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, serviceId: string, fields: string[]): Promise<any>;
|
|
32
|
-
updateCorsBucket(
|
|
32
|
+
updateCorsBucket(bucketId: string, corsId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, serviceId: string, fields: string[]): Promise<any>;
|
|
33
33
|
removeCorsBucket(bucketId: string, corsId: string, updateBy: string, serviceId: string, fields: string[]): Promise<any>;
|
|
34
34
|
getListFileOtherVersion(s3UserId: string, bucketId: string, key: string, serviceId: string, fields: string[]): Promise<any>;
|
|
35
35
|
restoreFileOtherVersion(s3UserId: string, bucketId: string, key: string, versionId: string, serviceId: string, fields: string[]): Promise<any>;
|
|
@@ -536,11 +536,10 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
536
536
|
}
|
|
537
537
|
});
|
|
538
538
|
}
|
|
539
|
-
updateCorsBucket(
|
|
539
|
+
updateCorsBucket(bucketId, corsId, allowedMethods, allowedOrigins, allowedHeaders, exposeHeaders, maxAgeSeconds, updateBy, serviceId, fields) {
|
|
540
540
|
return __awaiter(this, void 0, void 0, function* () {
|
|
541
541
|
const mutation = (0, mutations_1.UPDATE_CORS_BUCKET)(fields);
|
|
542
542
|
const variables = {
|
|
543
|
-
s3UserId,
|
|
544
543
|
bucketId,
|
|
545
544
|
corsId,
|
|
546
545
|
allowedMethods,
|