@infrab4a/connect 4.3.2-beta.0 → 4.3.2-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 +28 -2
- package/index.esm.js +26 -4
- package/package.json +2 -2
- package/src/utils/index.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -4315,8 +4315,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4315
4315
|
{
|
|
4316
4316
|
products: {
|
|
4317
4317
|
columnName: 'products',
|
|
4318
|
-
fields: ['product_id'],
|
|
4319
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
4318
|
+
fields: ['product_id', 'order'],
|
|
4319
|
+
from: (value) => lodash.sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
|
|
4320
4320
|
to: (productIds) => productIds.map((productId) => ({
|
|
4321
4321
|
product_id: +productId,
|
|
4322
4322
|
})),
|
|
@@ -4503,6 +4503,28 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4503
4503
|
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4504
4504
|
},
|
|
4505
4505
|
});
|
|
4506
|
+
const productsOrder = products.map((product, index) => {
|
|
4507
|
+
return {
|
|
4508
|
+
id: product,
|
|
4509
|
+
order: index,
|
|
4510
|
+
};
|
|
4511
|
+
});
|
|
4512
|
+
const updateQueries = productsOrder.map((product) => ({
|
|
4513
|
+
where: {
|
|
4514
|
+
category_id: { _eq: category.id },
|
|
4515
|
+
product_id: { _eq: product.id },
|
|
4516
|
+
},
|
|
4517
|
+
_set: {
|
|
4518
|
+
order: product.order,
|
|
4519
|
+
},
|
|
4520
|
+
}));
|
|
4521
|
+
await this.mutation('update_category_product_many', ['affected_rows'], {
|
|
4522
|
+
updates: {
|
|
4523
|
+
value: updateQueries,
|
|
4524
|
+
type: '[category_product_updates!]',
|
|
4525
|
+
required: true,
|
|
4526
|
+
},
|
|
4527
|
+
});
|
|
4506
4528
|
return plainData.products;
|
|
4507
4529
|
}
|
|
4508
4530
|
async updateMetadata(categoryId, { metadata }) {
|
|
@@ -5647,6 +5669,10 @@ Object.defineProperty(exports, 'set', {
|
|
|
5647
5669
|
enumerable: true,
|
|
5648
5670
|
get: function () { return lodash.set; }
|
|
5649
5671
|
});
|
|
5672
|
+
Object.defineProperty(exports, 'sortBy', {
|
|
5673
|
+
enumerable: true,
|
|
5674
|
+
get: function () { return lodash.sortBy; }
|
|
5675
|
+
});
|
|
5650
5676
|
Object.defineProperty(exports, 'unset', {
|
|
5651
5677
|
enumerable: true,
|
|
5652
5678
|
get: function () { return lodash.unset; }
|
package/index.esm.js
CHANGED
|
@@ -3,8 +3,8 @@ import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __r
|
|
|
3
3
|
import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
|
|
4
4
|
import { parseISO } from 'date-fns';
|
|
5
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
|
-
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
-
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
6
|
+
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
|
|
7
|
+
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
8
8
|
import { debug } from 'debug';
|
|
9
9
|
import { CustomError } from 'ts-custom-error';
|
|
10
10
|
import axios from 'axios';
|
|
@@ -4309,8 +4309,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4309
4309
|
{
|
|
4310
4310
|
products: {
|
|
4311
4311
|
columnName: 'products',
|
|
4312
|
-
fields: ['product_id'],
|
|
4313
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
4312
|
+
fields: ['product_id', 'order'],
|
|
4313
|
+
from: (value) => sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
|
|
4314
4314
|
to: (productIds) => productIds.map((productId) => ({
|
|
4315
4315
|
product_id: +productId,
|
|
4316
4316
|
})),
|
|
@@ -4497,6 +4497,28 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4497
4497
|
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4498
4498
|
},
|
|
4499
4499
|
});
|
|
4500
|
+
const productsOrder = products.map((product, index) => {
|
|
4501
|
+
return {
|
|
4502
|
+
id: product,
|
|
4503
|
+
order: index,
|
|
4504
|
+
};
|
|
4505
|
+
});
|
|
4506
|
+
const updateQueries = productsOrder.map((product) => ({
|
|
4507
|
+
where: {
|
|
4508
|
+
category_id: { _eq: category.id },
|
|
4509
|
+
product_id: { _eq: product.id },
|
|
4510
|
+
},
|
|
4511
|
+
_set: {
|
|
4512
|
+
order: product.order,
|
|
4513
|
+
},
|
|
4514
|
+
}));
|
|
4515
|
+
await this.mutation('update_category_product_many', ['affected_rows'], {
|
|
4516
|
+
updates: {
|
|
4517
|
+
value: updateQueries,
|
|
4518
|
+
type: '[category_product_updates!]',
|
|
4519
|
+
required: true,
|
|
4520
|
+
},
|
|
4521
|
+
});
|
|
4500
4522
|
return plainData.products;
|
|
4501
4523
|
}
|
|
4502
4524
|
async updateMetadata(categoryId, { metadata }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrab4a/connect",
|
|
3
|
-
"version": "4.3.2-beta.
|
|
3
|
+
"version": "4.3.2-beta.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"class-transformer": "^0.5.1",
|
|
14
14
|
"date-fns": "^2.28.0",
|
|
15
15
|
"debug": "^4.3.4",
|
|
16
|
-
"firebase": "^9.
|
|
16
|
+
"firebase": "^9.9.0",
|
|
17
17
|
"gql-query-builder": "3.7.0",
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
19
|
"reflect-metadata": "^0.1.13",
|
package/src/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { add, addBusinessDays, addDays, addMonths, addYears, Duration, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
2
|
-
import { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
2
|
+
import { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
3
3
|
export type DateDuration = Duration;
|
|
4
4
|
export * from './decorators';
|
|
5
5
|
export * from './get';
|
|
@@ -10,4 +10,4 @@ export * from './log.utils';
|
|
|
10
10
|
export * from './mixins';
|
|
11
11
|
export * from './parse-datetime';
|
|
12
12
|
export * from './types';
|
|
13
|
-
export { add,
|
|
13
|
+
export { add, addBusinessDays, addDays, addMonths, addYears, chunk, each, endOfDay, format, formatISO9075, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, parseISO, pick, set, sortBy, startOfDay, sub, unset, };
|