@infrab4a/connect 4.9.13-beta.0 → 4.9.13-beta.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/index.cjs.js
CHANGED
|
@@ -4772,7 +4772,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4772
4772
|
}
|
|
4773
4773
|
async create(params) {
|
|
4774
4774
|
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
4775
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { shop: null, description: null, title: null } }));
|
|
4775
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
|
|
4776
4776
|
}
|
|
4777
4777
|
async get(identifiers) {
|
|
4778
4778
|
var _a;
|
|
@@ -4963,22 +4963,39 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4963
4963
|
return plainData.products;
|
|
4964
4964
|
}
|
|
4965
4965
|
async updateMetadata(categoryId, { metadata }) {
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4966
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
4967
|
+
return [];
|
|
4968
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
4969
|
+
const metadataUpdated = [];
|
|
4970
|
+
for (const data of metadata) {
|
|
4971
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
4972
|
+
pk_columns: {
|
|
4973
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
4974
|
+
type: 'category_metadata_pk_columns_input',
|
|
4975
|
+
required: true,
|
|
4976
|
+
},
|
|
4977
|
+
_set: {
|
|
4978
|
+
value: lodash.omit(data, ['category_id', 'shop']),
|
|
4979
|
+
type: 'category_metadata_set_input',
|
|
4980
|
+
required: true,
|
|
4981
|
+
},
|
|
4982
|
+
});
|
|
4983
|
+
metadataUpdated.push(update);
|
|
4984
|
+
}
|
|
4985
|
+
return metadataUpdated;
|
|
4986
|
+
}
|
|
4987
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
4988
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
4989
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
4990
|
+
where: {
|
|
4991
|
+
type: 'category_metadata_bool_exp',
|
|
4992
|
+
required: true,
|
|
4993
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
4994
|
+
},
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
return [];
|
|
4998
|
+
}
|
|
4982
4999
|
}
|
|
4983
5000
|
async updateFilters(categoryId, { filters }) {
|
|
4984
5001
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5985,7 +6002,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5985
6002
|
{
|
|
5986
6003
|
metadata: {
|
|
5987
6004
|
columnName: 'metadata',
|
|
5988
|
-
fields: ['title', 'description'],
|
|
6005
|
+
fields: ['shop', 'title', 'description'],
|
|
5989
6006
|
bindPersistData: (value) => ({
|
|
5990
6007
|
metadata: { data: value },
|
|
5991
6008
|
}),
|
|
@@ -6014,7 +6031,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6014
6031
|
async create(params) {
|
|
6015
6032
|
var _a;
|
|
6016
6033
|
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
6017
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name } }));
|
|
6034
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }] }));
|
|
6018
6035
|
}
|
|
6019
6036
|
async get(identifiers) {
|
|
6020
6037
|
const data = await super.get(identifiers);
|
|
@@ -6138,22 +6155,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6138
6155
|
return plainData.products;
|
|
6139
6156
|
}
|
|
6140
6157
|
async updateMetadata(categoryId, { metadata }) {
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6158
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
6159
|
+
return [];
|
|
6160
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
6161
|
+
const metadataUpdated = [];
|
|
6162
|
+
for (const data of metadata) {
|
|
6163
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6164
|
+
pk_columns: {
|
|
6165
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
6166
|
+
type: 'category_metadata_pk_columns_input',
|
|
6167
|
+
required: true,
|
|
6168
|
+
},
|
|
6169
|
+
_set: {
|
|
6170
|
+
value: lodash.omit(data, ['category_id', 'shop']),
|
|
6171
|
+
type: 'category_metadata_set_input',
|
|
6172
|
+
required: true,
|
|
6173
|
+
},
|
|
6174
|
+
});
|
|
6175
|
+
metadataUpdated.push(update);
|
|
6176
|
+
}
|
|
6177
|
+
return metadataUpdated;
|
|
6178
|
+
}
|
|
6179
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
6180
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
6181
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6182
|
+
where: {
|
|
6183
|
+
type: 'category_metadata_bool_exp',
|
|
6184
|
+
required: true,
|
|
6185
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
6186
|
+
},
|
|
6187
|
+
});
|
|
6188
|
+
}
|
|
6189
|
+
return [];
|
|
6190
|
+
}
|
|
6157
6191
|
}
|
|
6158
6192
|
}
|
|
6159
6193
|
tslib.__decorate([
|
package/index.esm.js
CHANGED
|
@@ -4766,7 +4766,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4766
4766
|
}
|
|
4767
4767
|
async create(params) {
|
|
4768
4768
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4769
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { shop: null, description: null, title: null } }));
|
|
4769
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
|
|
4770
4770
|
}
|
|
4771
4771
|
async get(identifiers) {
|
|
4772
4772
|
var _a;
|
|
@@ -4957,22 +4957,39 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4957
4957
|
return plainData.products;
|
|
4958
4958
|
}
|
|
4959
4959
|
async updateMetadata(categoryId, { metadata }) {
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4960
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
4961
|
+
return [];
|
|
4962
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
4963
|
+
const metadataUpdated = [];
|
|
4964
|
+
for (const data of metadata) {
|
|
4965
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
4966
|
+
pk_columns: {
|
|
4967
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
4968
|
+
type: 'category_metadata_pk_columns_input',
|
|
4969
|
+
required: true,
|
|
4970
|
+
},
|
|
4971
|
+
_set: {
|
|
4972
|
+
value: omit(data, ['category_id', 'shop']),
|
|
4973
|
+
type: 'category_metadata_set_input',
|
|
4974
|
+
required: true,
|
|
4975
|
+
},
|
|
4976
|
+
});
|
|
4977
|
+
metadataUpdated.push(update);
|
|
4978
|
+
}
|
|
4979
|
+
return metadataUpdated;
|
|
4980
|
+
}
|
|
4981
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
4982
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
4983
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
4984
|
+
where: {
|
|
4985
|
+
type: 'category_metadata_bool_exp',
|
|
4986
|
+
required: true,
|
|
4987
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
4988
|
+
},
|
|
4989
|
+
});
|
|
4990
|
+
}
|
|
4991
|
+
return [];
|
|
4992
|
+
}
|
|
4976
4993
|
}
|
|
4977
4994
|
async updateFilters(categoryId, { filters }) {
|
|
4978
4995
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5979,7 +5996,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5979
5996
|
{
|
|
5980
5997
|
metadata: {
|
|
5981
5998
|
columnName: 'metadata',
|
|
5982
|
-
fields: ['title', 'description'],
|
|
5999
|
+
fields: ['shop', 'title', 'description'],
|
|
5983
6000
|
bindPersistData: (value) => ({
|
|
5984
6001
|
metadata: { data: value },
|
|
5985
6002
|
}),
|
|
@@ -6008,7 +6025,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6008
6025
|
async create(params) {
|
|
6009
6026
|
var _a;
|
|
6010
6027
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
6011
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name } }));
|
|
6028
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }] }));
|
|
6012
6029
|
}
|
|
6013
6030
|
async get(identifiers) {
|
|
6014
6031
|
const data = await super.get(identifiers);
|
|
@@ -6132,22 +6149,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6132
6149
|
return plainData.products;
|
|
6133
6150
|
}
|
|
6134
6151
|
async updateMetadata(categoryId, { metadata }) {
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6152
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
6153
|
+
return [];
|
|
6154
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
6155
|
+
const metadataUpdated = [];
|
|
6156
|
+
for (const data of metadata) {
|
|
6157
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6158
|
+
pk_columns: {
|
|
6159
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
6160
|
+
type: 'category_metadata_pk_columns_input',
|
|
6161
|
+
required: true,
|
|
6162
|
+
},
|
|
6163
|
+
_set: {
|
|
6164
|
+
value: omit(data, ['category_id', 'shop']),
|
|
6165
|
+
type: 'category_metadata_set_input',
|
|
6166
|
+
required: true,
|
|
6167
|
+
},
|
|
6168
|
+
});
|
|
6169
|
+
metadataUpdated.push(update);
|
|
6170
|
+
}
|
|
6171
|
+
return metadataUpdated;
|
|
6172
|
+
}
|
|
6173
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
6174
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
6175
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6176
|
+
where: {
|
|
6177
|
+
type: 'category_metadata_bool_exp',
|
|
6178
|
+
required: true,
|
|
6179
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
6180
|
+
},
|
|
6181
|
+
});
|
|
6182
|
+
}
|
|
6183
|
+
return [];
|
|
6184
|
+
}
|
|
6151
6185
|
}
|
|
6152
6186
|
}
|
|
6153
6187
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier, ModelBaseStructure } from '../../generic/model';
|
|
2
2
|
import { Shops } from './enums';
|
|
3
3
|
import { Filter } from './filter';
|
|
4
|
-
import { CategoryCondition, CategoryMetadata } from './types';
|
|
4
|
+
import { CategoryCondition, CategoryImages, CategoryMetadata } from './types';
|
|
5
5
|
export declare class CategoryBase<ChildCategory extends ModelBaseStructure<ChildCategory, Identifiers> = ModelBaseStructure<any, any>, Identifiers = ChildCategory['identifiersFields']> extends BaseModel<ChildCategory, Identifiers> {
|
|
6
6
|
id: string;
|
|
7
7
|
brandCategory: boolean;
|
|
@@ -9,7 +9,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
9
9
|
name: string;
|
|
10
10
|
slug: string;
|
|
11
11
|
image?: string;
|
|
12
|
-
images?:
|
|
12
|
+
images?: CategoryImages;
|
|
13
13
|
brandCategoryBanner?: string;
|
|
14
14
|
brandCategoryBannerMobile?: string;
|
|
15
15
|
description: string;
|
|
@@ -20,7 +20,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
20
20
|
shop?: Shops;
|
|
21
21
|
shops?: string[];
|
|
22
22
|
published: boolean;
|
|
23
|
-
metadata: CategoryMetadata;
|
|
23
|
+
metadata: CategoryMetadata[];
|
|
24
24
|
isCollection?: boolean;
|
|
25
25
|
isWishlist?: boolean;
|
|
26
26
|
reference?: string;
|