@infrab4a/connect 3.13.3-beta.2 → 3.13.5
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/bundles/infrab4a-connect.umd.js +757 -116
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category-collection-children.d.ts +1 -2
- package/domain/catalog/models/category-filter.d.ts +1 -1
- package/domain/catalog/models/category.d.ts +3 -3
- package/domain/catalog/models/filter-option.d.ts +1 -2
- package/domain/catalog/models/filter.d.ts +1 -2
- package/domain/catalog/models/kit-product.d.ts +1 -1
- package/domain/catalog/models/product.d.ts +1 -2
- package/domain/catalog/models/variant.d.ts +1 -2
- package/domain/catalog/repositories/category.repository.d.ts +1 -0
- package/domain/generic/model/base.model.d.ts +9 -5
- package/domain/generic/model/types/base-model-builder.type.d.ts +4 -2
- package/domain/generic/model/types/identifier-model.type.d.ts +6 -5
- package/domain/generic/model/types/model-base-structure.type.d.ts +9 -3
- package/domain/generic/model/types/non-function-property-name.type.d.ts +12 -3
- package/domain/generic/repository/get.repository.d.ts +2 -2
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
- package/domain/generic/repository/types/repository-order-by-list.type.d.ts +2 -2
- package/domain/generic/repository/types/repository-update-params.type.d.ts +2 -2
- package/domain/location/models/address.d.ts +4 -3
- package/domain/shopping/models/checkout.d.ts +5 -6
- package/domain/shopping/models/subscription/checkout.d.ts +3 -4
- package/domain/users/models/subscription/subscription.d.ts +3 -3
- package/domain/users/models/user-address.d.ts +1 -1
- package/domain/users/models/user.d.ts +3 -4
- package/esm2015/domain/catalog/models/category-collection-children.js +1 -4
- package/esm2015/domain/catalog/models/category-filter.js +1 -4
- package/esm2015/domain/catalog/models/category.js +1 -4
- package/esm2015/domain/catalog/models/filter-option.js +1 -4
- package/esm2015/domain/catalog/models/filter.js +1 -4
- package/esm2015/domain/catalog/models/kit-product.js +2 -2
- package/esm2015/domain/catalog/models/product.js +1 -4
- package/esm2015/domain/catalog/models/variant.js +1 -4
- package/esm2015/domain/catalog/repositories/category.repository.js +1 -1
- package/esm2015/domain/generic/model/base.model.js +3 -2
- package/esm2015/domain/generic/model/types/base-model-builder.type.js +1 -1
- package/esm2015/domain/generic/model/types/identifier-model.type.js +1 -1
- package/esm2015/domain/generic/model/types/model-base-structure.type.js +1 -1
- package/esm2015/domain/generic/model/types/non-function-property-name.type.js +1 -1
- package/esm2015/domain/generic/repository/get.repository.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-order-by-list.type.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +1 -1
- package/esm2015/domain/location/models/address.js +2 -2
- package/esm2015/domain/shopping/models/checkout.js +6 -7
- package/esm2015/domain/shopping/models/order.js +1 -1
- package/esm2015/domain/shopping/models/subscription/checkout.js +6 -6
- package/esm2015/domain/users/models/subscription/subscription.js +6 -6
- package/esm2015/domain/users/models/user-address.js +1 -1
- package/esm2015/domain/users/models/user.js +3 -3
- package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +3 -3
- package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +2 -2
- package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +1 -1
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +4 -1
- package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +2 -2
- package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +1 -1
- package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +1 -1
- package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +1 -1
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +1 -1
- package/esm2015/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.js +19 -14
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +1 -1
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +23 -18
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +19 -3
- package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +2 -2
- package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +5 -3
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +18 -4
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +5 -3
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +7 -4
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +7 -5
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +28 -2
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +1 -1
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/esm2015/utils/decorators/debug.class.decorator.js +7 -0
- package/esm2015/utils/decorators/index.js +3 -0
- package/esm2015/utils/decorators/trace.method.decorator.js +81 -0
- package/esm2015/utils/helpers/class-name.helper.js +15 -0
- package/esm2015/utils/helpers/debug-decorator.helper.js +18 -0
- package/esm2015/utils/helpers/debug.helper.js +150 -0
- package/esm2015/utils/helpers/index.js +5 -0
- package/esm2015/utils/helpers/reflect.helper.js +165 -0
- package/esm2015/utils/index.js +4 -1
- package/esm2015/utils/log.utils.js +9 -0
- package/fesm2015/infrab4a-connect.js +581 -90
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/elasticsearch/adapters/axios.adapter.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +2 -2
- package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +1 -1
- package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +4 -4
- package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +4 -4
- package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +3 -3
- package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +2 -1
- package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +1 -1
- package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +3 -3
- package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +5 -5
- package/infra/firebase/firestore/types/firestore.repository.type.d.ts +1 -1
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +5 -3
- package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +5 -5
- package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +4 -2
- package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +6 -5
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +2 -1
- package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +4 -4
- package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +11 -9
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +5 -4
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -0
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +5 -3
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +7 -3
- package/package.json +2 -1
- package/utils/decorators/debug.class.decorator.d.ts +2 -0
- package/utils/decorators/index.d.ts +2 -0
- package/utils/decorators/trace.method.decorator.d.ts +14 -0
- package/utils/helpers/class-name.helper.d.ts +3 -0
- package/utils/helpers/debug-decorator.helper.d.ts +9 -0
- package/utils/helpers/debug.helper.d.ts +60 -0
- package/utils/helpers/index.d.ts +4 -0
- package/utils/helpers/reflect.helper.d.ts +50 -0
- package/utils/index.d.ts +3 -0
- package/utils/log.utils.d.ts +7 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"]));
|
|
5
|
-
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, axios, firebase, gqlQueryBuilder) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('rxjs'), require('debug'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'rxjs', 'debug', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global.rxjs, global.debug, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"]));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, rxjs, debug, tsCustomError, axios, firebase, gqlQueryBuilder) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
}
|
|
16
16
|
Object.defineProperty(BaseModel.prototype, "identifier", {
|
|
17
17
|
get: function () {
|
|
18
|
-
var _this = this;
|
|
19
18
|
var fields = this.constructor.identifiersFields.filter(function (field) { return field !== 'identifier'; });
|
|
19
|
+
var data = this;
|
|
20
20
|
return fields.reduce(function (object, field) {
|
|
21
21
|
var _a;
|
|
22
|
-
return (Object.assign(Object.assign({}, object), (_a = {}, _a[field] =
|
|
22
|
+
return (Object.assign(Object.assign({}, object), (_a = {}, _a[field] = data[field], _a)));
|
|
23
23
|
}, {});
|
|
24
24
|
},
|
|
25
25
|
enumerable: false,
|
|
@@ -816,20 +816,560 @@
|
|
|
816
816
|
__metadata("design:type", Payment)
|
|
817
817
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
818
818
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
819
|
+
exports.DebugNamespaces = void 0;
|
|
820
|
+
(function (DebugNamespaces) {
|
|
821
|
+
DebugNamespaces["ROOT"] = "connect";
|
|
822
|
+
DebugNamespaces["TRACE"] = "trace";
|
|
823
|
+
DebugNamespaces["ERROR"] = "error";
|
|
824
|
+
})(exports.DebugNamespaces || (exports.DebugNamespaces = {}));
|
|
825
|
+
var Logger = debug.debug(exports.DebugNamespaces.ROOT);
|
|
826
|
+
|
|
827
|
+
var ReflectHelper = /** @class */ (function () {
|
|
828
|
+
function ReflectHelper() {
|
|
823
829
|
}
|
|
824
|
-
Object.defineProperty(
|
|
830
|
+
Object.defineProperty(ReflectHelper, "items", {
|
|
825
831
|
get: function () {
|
|
826
|
-
return
|
|
832
|
+
return this._items;
|
|
827
833
|
},
|
|
828
834
|
enumerable: false,
|
|
829
835
|
configurable: true
|
|
830
836
|
});
|
|
831
|
-
|
|
832
|
-
|
|
837
|
+
Object.defineProperty(ReflectHelper, "keys", {
|
|
838
|
+
get: function () {
|
|
839
|
+
return Object.keys(ReflectHelper.items);
|
|
840
|
+
},
|
|
841
|
+
enumerable: false,
|
|
842
|
+
configurable: true
|
|
843
|
+
});
|
|
844
|
+
ReflectHelper.has = function (key, target, property) {
|
|
845
|
+
return (!lodash.isNil(key) &&
|
|
846
|
+
!lodash.isNil(ReflectHelper.items[key]) &&
|
|
847
|
+
(lodash.isNil(target) ||
|
|
848
|
+
(!lodash.isNil(ReflectHelper.items[key][target]) &&
|
|
849
|
+
(lodash.isNil(property) || !lodash.isNil(ReflectHelper.items[key][target][String(property)])))));
|
|
850
|
+
};
|
|
851
|
+
ReflectHelper.get = function (_a) {
|
|
852
|
+
var key = _a.key, target = _a.target, property = _a.property, _b = _a.own, own = _b === void 0 ? true : _b;
|
|
853
|
+
try {
|
|
854
|
+
if (own) {
|
|
855
|
+
return Reflect.getOwnMetadata(key, target, property) || null;
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
return Reflect.getMetadata(key, target, property) || null;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
catch (_err) {
|
|
862
|
+
return null;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
ReflectHelper.first = function (_a) {
|
|
866
|
+
var key = _a.key, target = _a.target, property = _a.property, _b = _a.own, own = _b === void 0 ? true : _b;
|
|
867
|
+
var values = ReflectHelper.get({ key: key, target: target, property: property, own: own });
|
|
868
|
+
return lodash.isArray(values) ? lodash.first(values) : values;
|
|
869
|
+
};
|
|
870
|
+
ReflectHelper.last = function (_a) {
|
|
871
|
+
var key = _a.key, target = _a.target, property = _a.property, _b = _a.own, own = _b === void 0 ? true : _b;
|
|
872
|
+
var values = ReflectHelper.get({ key: key, target: target, property: property, own: own });
|
|
873
|
+
return lodash.isArray(values) ? lodash.last(values) : values;
|
|
874
|
+
};
|
|
875
|
+
ReflectHelper.set = function (_a) {
|
|
876
|
+
var key = _a.key, target = _a.target, property = _a.property, value = _a.value, propertyDescriptor = _a.propertyDescriptor;
|
|
877
|
+
Reflect.defineMetadata(key, value, target, property);
|
|
878
|
+
ReflectHelper.put({ key: key, target: target, property: property, value: value, propertyDescriptor: propertyDescriptor });
|
|
879
|
+
};
|
|
880
|
+
ReflectHelper.add = function (_a) {
|
|
881
|
+
var key = _a.key, target = _a.target, property = _a.property, value = _a.value, propertyDescriptor = _a.propertyDescriptor;
|
|
882
|
+
var values = ReflectHelper.get({ key: key, target: target, property: property }) || new Array();
|
|
883
|
+
if (!Array.isArray(values))
|
|
884
|
+
values = [values];
|
|
885
|
+
values.push(value);
|
|
886
|
+
ReflectHelper.set({ key: key, target: target, property: property, value: values, propertyDescriptor: propertyDescriptor });
|
|
887
|
+
};
|
|
888
|
+
ReflectHelper.all = function (_a) {
|
|
889
|
+
var _this = this;
|
|
890
|
+
var key = _a.key;
|
|
891
|
+
var items = ReflectHelper.items[key] || {};
|
|
892
|
+
return lodash.flatten(Object.keys(items).map(function (item) { return lodash.flatten(_this.allFrom(key, items[item])); }));
|
|
893
|
+
};
|
|
894
|
+
ReflectHelper.allFrom = function (key, target) {
|
|
895
|
+
var _this = this;
|
|
896
|
+
return Object.keys(target)
|
|
897
|
+
.filter(function (property) { return property !== 'object'; })
|
|
898
|
+
.map(function (property) { return _this.allValuesFrom(key, target, property); });
|
|
899
|
+
};
|
|
900
|
+
ReflectHelper.allValuesFrom = function (key, target, property) {
|
|
901
|
+
var values = target[property];
|
|
902
|
+
var value = values.value;
|
|
903
|
+
var propertyDescriptor = values.propertyDescriptor;
|
|
904
|
+
if (!lodash.isArray(value))
|
|
905
|
+
value = [value];
|
|
906
|
+
return lodash.flatten(value.map(function (val) {
|
|
907
|
+
return {
|
|
908
|
+
key: key,
|
|
909
|
+
target: target.object,
|
|
910
|
+
property: property,
|
|
911
|
+
value: val,
|
|
912
|
+
propertyDescriptor: propertyDescriptor,
|
|
913
|
+
};
|
|
914
|
+
}));
|
|
915
|
+
};
|
|
916
|
+
ReflectHelper.delete = function (_a) {
|
|
917
|
+
var key = _a.key, target = _a.target, property = _a.property;
|
|
918
|
+
Reflect.deleteMetadata(key, target, property);
|
|
919
|
+
return ReflectHelper.remove(key, target, property);
|
|
920
|
+
};
|
|
921
|
+
ReflectHelper.clear = function (key) {
|
|
922
|
+
if (!key) {
|
|
923
|
+
ReflectHelper.keys.forEach(function (storedKey) {
|
|
924
|
+
ReflectHelper.clear(storedKey);
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
if (ReflectHelper.keys.includes(key)) {
|
|
929
|
+
Object.values(ReflectHelper.items[key]).forEach(function (target) {
|
|
930
|
+
if (ReflectHelper.has(key, target)) {
|
|
931
|
+
Object.values(ReflectHelper.items[key][target]).forEach(function (property) {
|
|
932
|
+
ReflectHelper.delete({
|
|
933
|
+
key: key,
|
|
934
|
+
target: target.object,
|
|
935
|
+
property: String(property),
|
|
936
|
+
});
|
|
937
|
+
ReflectHelper.remove(key, target, String(property));
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
ReflectHelper.delete({ key: key, target: target.object });
|
|
941
|
+
ReflectHelper.remove(key, target);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
ReflectHelper.getType = function (_a) {
|
|
947
|
+
var target = _a.target, propertyKey = _a.propertyKey;
|
|
948
|
+
return Reflect.getMetadata('design:type', target, propertyKey);
|
|
949
|
+
};
|
|
950
|
+
ReflectHelper.getReturntype = function (_a) {
|
|
951
|
+
var target = _a.target, propertyKey = _a.propertyKey;
|
|
952
|
+
return Reflect.getMetadata('design:returntype', target, propertyKey);
|
|
953
|
+
};
|
|
954
|
+
ReflectHelper.getAllMethods = function (target) {
|
|
955
|
+
var props = [];
|
|
956
|
+
var obj = target;
|
|
957
|
+
do {
|
|
958
|
+
props.push.apply(props, __spreadArray([], __read(Object.getOwnPropertyNames(obj))));
|
|
959
|
+
} while ((obj = Object.getPrototypeOf(obj)));
|
|
960
|
+
return props.sort().filter(function (e, i, arr) {
|
|
961
|
+
if ([
|
|
962
|
+
'__defineGetter__',
|
|
963
|
+
'__defineSetter__',
|
|
964
|
+
'__lookupGetter__',
|
|
965
|
+
'__lookupSetter__',
|
|
966
|
+
'constructor',
|
|
967
|
+
'hasOwnProperty',
|
|
968
|
+
'isPrototypeOf',
|
|
969
|
+
'propertyIsEnumerable',
|
|
970
|
+
'toLocaleString',
|
|
971
|
+
'toString',
|
|
972
|
+
'valueOf',
|
|
973
|
+
].includes(e))
|
|
974
|
+
return false;
|
|
975
|
+
if (e != arr[i + 1] && typeof target[e] === 'function')
|
|
976
|
+
return true;
|
|
977
|
+
});
|
|
978
|
+
};
|
|
979
|
+
ReflectHelper.put = function (_a) {
|
|
980
|
+
var key = _a.key, target = _a.target, property = _a.property, value = _a.value, propertyDescriptor = _a.propertyDescriptor;
|
|
981
|
+
var index = target.constructor.name;
|
|
982
|
+
ReflectHelper.items[key] = ReflectHelper.items[key] || {};
|
|
983
|
+
ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
|
|
984
|
+
ReflectHelper.items[key][index].object = target;
|
|
985
|
+
if (lodash.isNil(property)) {
|
|
986
|
+
ReflectHelper.items[key][index].value = {
|
|
987
|
+
value: value,
|
|
988
|
+
propertyDescriptor: propertyDescriptor,
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
else {
|
|
992
|
+
ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
|
|
993
|
+
ReflectHelper.items[key][index][String(property)] = {
|
|
994
|
+
value: value,
|
|
995
|
+
propertyDescriptor: propertyDescriptor,
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
ReflectHelper.remove = function (key, target, property) {
|
|
1000
|
+
if (ReflectHelper.has(key, target, property))
|
|
1001
|
+
return delete ReflectHelper.items[key][target][String(property)];
|
|
1002
|
+
else if (ReflectHelper.has(key, target))
|
|
1003
|
+
return delete ReflectHelper.items[key][target];
|
|
1004
|
+
else if (ReflectHelper.has(key))
|
|
1005
|
+
return delete ReflectHelper.items[key];
|
|
1006
|
+
else
|
|
1007
|
+
return false;
|
|
1008
|
+
};
|
|
1009
|
+
return ReflectHelper;
|
|
1010
|
+
}());
|
|
1011
|
+
ReflectHelper._items = {};
|
|
1012
|
+
|
|
1013
|
+
var DebugDecoratorHelper = /** @class */ (function () {
|
|
1014
|
+
function DebugDecoratorHelper() {
|
|
1015
|
+
}
|
|
1016
|
+
DebugDecoratorHelper.set = function (target, options) {
|
|
1017
|
+
ReflectHelper.add({
|
|
1018
|
+
key: DebugDecoratorHelper.DebugNamingMetadataKey,
|
|
1019
|
+
target: target,
|
|
1020
|
+
value: options,
|
|
1021
|
+
});
|
|
1022
|
+
};
|
|
1023
|
+
DebugDecoratorHelper.get = function (target) {
|
|
1024
|
+
return ReflectHelper.first({
|
|
1025
|
+
key: DebugDecoratorHelper.DebugNamingMetadataKey,
|
|
1026
|
+
target: target,
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
return DebugDecoratorHelper;
|
|
1030
|
+
}());
|
|
1031
|
+
DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
|
|
1032
|
+
|
|
1033
|
+
var ClassNameHelper = /** @class */ (function () {
|
|
1034
|
+
function ClassNameHelper() {
|
|
1035
|
+
}
|
|
1036
|
+
ClassNameHelper.get = function (clazz) {
|
|
1037
|
+
if (!clazz)
|
|
1038
|
+
return null;
|
|
1039
|
+
var prototype = Object.getPrototypeOf(clazz);
|
|
1040
|
+
var names = lodash.compact([
|
|
1041
|
+
lodash.get(clazz, 'constructor.name'),
|
|
1042
|
+
lodash.get(prototype, 'constructor.name'),
|
|
1043
|
+
lodash.get(prototype, '__proto__.constructor.name'),
|
|
1044
|
+
]);
|
|
1045
|
+
return names.find(function (name) { return name !== 'class_1'; });
|
|
1046
|
+
};
|
|
1047
|
+
return ClassNameHelper;
|
|
1048
|
+
}());
|
|
1049
|
+
|
|
1050
|
+
var isDebuggable = function (object) {
|
|
1051
|
+
return 'debug' in object;
|
|
1052
|
+
};
|
|
1053
|
+
var DebugHelper = /** @class */ (function () {
|
|
1054
|
+
function DebugHelper() {
|
|
1055
|
+
var namespace = [];
|
|
1056
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1057
|
+
namespace[_i] = arguments[_i];
|
|
1058
|
+
}
|
|
1059
|
+
this.namespaces = new Set();
|
|
1060
|
+
this.push.apply(this, __spreadArray([], __read(namespace)));
|
|
1061
|
+
}
|
|
1062
|
+
DebugHelper.namespacesFor = function (target) {
|
|
1063
|
+
if (lodash.isNil(target))
|
|
1064
|
+
return [];
|
|
1065
|
+
var decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
|
|
1066
|
+
var namespaces = lodash.get(decorator, 'namespaces', []);
|
|
1067
|
+
var name = lodash.get(decorator, 'name', ClassNameHelper.get(target));
|
|
1068
|
+
return __spreadArray(__spreadArray([], __read(namespaces)), [name]);
|
|
1069
|
+
};
|
|
1070
|
+
DebugHelper.as = function () {
|
|
1071
|
+
var namespaces = [];
|
|
1072
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1073
|
+
namespaces[_i] = arguments[_i];
|
|
1074
|
+
}
|
|
1075
|
+
return new (DebugHelper.bind.apply(DebugHelper, __spreadArray([void 0], __read(namespaces))))();
|
|
1076
|
+
};
|
|
1077
|
+
DebugHelper.for = function (target) {
|
|
1078
|
+
var namespaces = [];
|
|
1079
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1080
|
+
namespaces[_i - 1] = arguments[_i];
|
|
1081
|
+
}
|
|
1082
|
+
var targetNamespaces = this.namespacesFor(target);
|
|
1083
|
+
return new (DebugHelper.bind.apply(DebugHelper, __spreadArray(__spreadArray([void 0], __read(targetNamespaces)), __read(namespaces))))();
|
|
1084
|
+
};
|
|
1085
|
+
DebugHelper.from = function (target) {
|
|
1086
|
+
var namespaces = [];
|
|
1087
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1088
|
+
namespaces[_i - 1] = arguments[_i];
|
|
1089
|
+
}
|
|
1090
|
+
if (this.isDebuggable(target)) {
|
|
1091
|
+
var debug = target.debug;
|
|
1092
|
+
if (namespaces)
|
|
1093
|
+
debug.push.apply(debug, __spreadArray([], __read(namespaces)));
|
|
1094
|
+
return debug;
|
|
1095
|
+
}
|
|
1096
|
+
return DebugHelper.for.apply(DebugHelper, __spreadArray([target], __read(namespaces)));
|
|
1097
|
+
};
|
|
1098
|
+
DebugHelper.clonedFrom = function (target) {
|
|
1099
|
+
var namespaces = [];
|
|
1100
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1101
|
+
namespaces[_i - 1] = arguments[_i];
|
|
1102
|
+
}
|
|
1103
|
+
if (this.isDebuggable(target)) {
|
|
1104
|
+
namespaces.push.apply(namespaces, __spreadArray([], __read(target.debug.entries)));
|
|
1105
|
+
}
|
|
1106
|
+
else if (!lodash.isNil(target)) {
|
|
1107
|
+
namespaces.push.apply(namespaces, __spreadArray([], __read(this.namespacesFor(target))));
|
|
1108
|
+
}
|
|
1109
|
+
return DebugHelper.for.apply(DebugHelper, __spreadArray([target], __read(namespaces)));
|
|
1110
|
+
};
|
|
1111
|
+
DebugHelper.clone = function (target) {
|
|
1112
|
+
var namespaces = [];
|
|
1113
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1114
|
+
namespaces[_i - 1] = arguments[_i];
|
|
1115
|
+
}
|
|
1116
|
+
var original;
|
|
1117
|
+
if (this.isDebuggable(target)) {
|
|
1118
|
+
original = target.debug;
|
|
1119
|
+
namespaces.push.apply(namespaces, __spreadArray([], __read(original.entries)));
|
|
1120
|
+
}
|
|
1121
|
+
return {
|
|
1122
|
+
original: original,
|
|
1123
|
+
debug: DebugHelper.for.apply(DebugHelper, __spreadArray([target], __read(namespaces))),
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
DebugHelper.replace = function (target, attrs) {
|
|
1127
|
+
if (this.isDebuggable(target))
|
|
1128
|
+
target.debug = attrs.with;
|
|
1129
|
+
};
|
|
1130
|
+
DebugHelper.mock = function (target) {
|
|
1131
|
+
var namespaces = [];
|
|
1132
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1133
|
+
namespaces[_i - 1] = arguments[_i];
|
|
1134
|
+
}
|
|
1135
|
+
var _a = DebugHelper.clone.apply(DebugHelper, __spreadArray([target], __read(namespaces))), original = _a.original, debug = _a.debug;
|
|
1136
|
+
DebugHelper.replace(target, { with: debug });
|
|
1137
|
+
return { original: original, debug: debug };
|
|
1138
|
+
};
|
|
1139
|
+
Object.defineProperty(DebugHelper.prototype, "entries", {
|
|
1140
|
+
get: function () {
|
|
1141
|
+
return Array.from(lodash.get(this, 'namespaces', []));
|
|
1142
|
+
},
|
|
1143
|
+
enumerable: false,
|
|
1144
|
+
configurable: true
|
|
1145
|
+
});
|
|
1146
|
+
Object.defineProperty(DebugHelper.prototype, "namespace", {
|
|
1147
|
+
get: function () {
|
|
1148
|
+
return lodash.compact(lodash.flatten(this.entries)).join(':');
|
|
1149
|
+
},
|
|
1150
|
+
enumerable: false,
|
|
1151
|
+
configurable: true
|
|
1152
|
+
});
|
|
1153
|
+
DebugHelper.prototype.log = function (message) {
|
|
1154
|
+
var args = [];
|
|
1155
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1156
|
+
args[_i - 1] = arguments[_i];
|
|
1157
|
+
}
|
|
1158
|
+
this.logger.apply(this, __spreadArray([JSON.stringify(message)], __read(args.map(function (element) { return JSON.stringify(element); }))));
|
|
1159
|
+
DebugHelper.logs$.next({ namespace: this.namespace, message: message, args: args });
|
|
1160
|
+
return this;
|
|
1161
|
+
};
|
|
1162
|
+
DebugHelper.prototype.trace = function (message) {
|
|
1163
|
+
var args = [];
|
|
1164
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1165
|
+
args[_i - 1] = arguments[_i];
|
|
1166
|
+
}
|
|
1167
|
+
this.logger.extend(exports.DebugNamespaces.TRACE).apply(void 0, __spreadArray([message], __read(args)));
|
|
1168
|
+
DebugHelper.traces$.next({ namespace: this.namespace, message: message, args: args });
|
|
1169
|
+
return this;
|
|
1170
|
+
};
|
|
1171
|
+
DebugHelper.prototype.error = function (error) {
|
|
1172
|
+
var args = [];
|
|
1173
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1174
|
+
args[_i - 1] = arguments[_i];
|
|
1175
|
+
}
|
|
1176
|
+
this.logger.extend(exports.DebugNamespaces.ERROR).apply(void 0, __spreadArray([JSON.stringify(error)], __read(args.map(function (element) { return JSON.stringify(element); }))));
|
|
1177
|
+
DebugHelper.errors$.next({ namespace: this.namespace, error: error, args: args });
|
|
1178
|
+
return this;
|
|
1179
|
+
};
|
|
1180
|
+
DebugHelper.prototype.build = function () {
|
|
1181
|
+
var _this = this;
|
|
1182
|
+
this.logger = Logger;
|
|
1183
|
+
this.tracer = Logger;
|
|
1184
|
+
this.err = Logger;
|
|
1185
|
+
this.entries.forEach(function (namespace) {
|
|
1186
|
+
_this.logger = _this.logger.extend(namespace);
|
|
1187
|
+
_this.tracer = _this.tracer.extend(namespace);
|
|
1188
|
+
_this.err = _this.err.extend(namespace);
|
|
1189
|
+
});
|
|
1190
|
+
return this;
|
|
1191
|
+
};
|
|
1192
|
+
DebugHelper.prototype.with = function () {
|
|
1193
|
+
var namespace = [];
|
|
1194
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1195
|
+
namespace[_i] = arguments[_i];
|
|
1196
|
+
}
|
|
1197
|
+
return new (DebugHelper.bind.apply(DebugHelper, __spreadArray(__spreadArray([void 0], __read(this.entries)), __read(namespace))))();
|
|
1198
|
+
};
|
|
1199
|
+
DebugHelper.prototype.push = function () {
|
|
1200
|
+
var _this = this;
|
|
1201
|
+
var namespace = [];
|
|
1202
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1203
|
+
namespace[_i] = arguments[_i];
|
|
1204
|
+
}
|
|
1205
|
+
if (namespace) {
|
|
1206
|
+
namespace.filter(function (item) { return Boolean(item); }).forEach(function (item) { return _this.namespaces.add(item); });
|
|
1207
|
+
}
|
|
1208
|
+
return this.build();
|
|
1209
|
+
};
|
|
1210
|
+
DebugHelper.prototype.unshift = function () {
|
|
1211
|
+
var namespace = [];
|
|
1212
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1213
|
+
namespace[_i] = arguments[_i];
|
|
1214
|
+
}
|
|
1215
|
+
if (namespace) {
|
|
1216
|
+
return this.reset.apply(this, __spreadArray(__spreadArray([], __read(namespace)), __read(this.entries)));
|
|
1217
|
+
}
|
|
1218
|
+
return this;
|
|
1219
|
+
};
|
|
1220
|
+
DebugHelper.prototype.reset = function () {
|
|
1221
|
+
var namespace = [];
|
|
1222
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1223
|
+
namespace[_i] = arguments[_i];
|
|
1224
|
+
}
|
|
1225
|
+
this.namespaces = new Set(lodash.flatten(lodash.compact(namespace)));
|
|
1226
|
+
return this.build();
|
|
1227
|
+
};
|
|
1228
|
+
DebugHelper.prototype.startWith = function () {
|
|
1229
|
+
var namespace = [];
|
|
1230
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1231
|
+
namespace[_i] = arguments[_i];
|
|
1232
|
+
}
|
|
1233
|
+
var current = this.namespaces;
|
|
1234
|
+
this.namespaces = new Set(lodash.flatten(__spreadArray([lodash.compact(namespace)], __read(current))));
|
|
1235
|
+
return this.build();
|
|
1236
|
+
};
|
|
1237
|
+
DebugHelper.prototype.shift = function () {
|
|
1238
|
+
var list = this.entries;
|
|
1239
|
+
list.shift();
|
|
1240
|
+
return this.reset.apply(this, __spreadArray([], __read(list)));
|
|
1241
|
+
};
|
|
1242
|
+
DebugHelper.prototype.pop = function () {
|
|
1243
|
+
var list = this.entries;
|
|
1244
|
+
list.pop();
|
|
1245
|
+
return this.reset.apply(this, __spreadArray([], __read(list)));
|
|
1246
|
+
};
|
|
1247
|
+
DebugHelper.prototype.clear = function () {
|
|
1248
|
+
return this.reset();
|
|
1249
|
+
};
|
|
1250
|
+
DebugHelper.prototype.remove = function () {
|
|
1251
|
+
var _this = this;
|
|
1252
|
+
var namespace = [];
|
|
1253
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1254
|
+
namespace[_i] = arguments[_i];
|
|
1255
|
+
}
|
|
1256
|
+
if (namespace) {
|
|
1257
|
+
namespace.filter(function (item) { return Boolean(item); }).forEach(function (item) { return _this.namespaces.delete(item); });
|
|
1258
|
+
}
|
|
1259
|
+
return this.build();
|
|
1260
|
+
};
|
|
1261
|
+
DebugHelper.prototype.puts = function () {
|
|
1262
|
+
var args = [];
|
|
1263
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1264
|
+
args[_i] = arguments[_i];
|
|
1265
|
+
}
|
|
1266
|
+
return __spreadArray(["[" + this.namespace + "]"], __read(args)).join(' ');
|
|
1267
|
+
};
|
|
1268
|
+
return DebugHelper;
|
|
1269
|
+
}());
|
|
1270
|
+
DebugHelper.logs$ = new rxjs.Subject();
|
|
1271
|
+
DebugHelper.traces$ = new rxjs.Subject();
|
|
1272
|
+
DebugHelper.errors$ = new rxjs.Subject();
|
|
1273
|
+
DebugHelper.isDebuggable = isDebuggable;
|
|
1274
|
+
|
|
1275
|
+
function Debug(opts) {
|
|
1276
|
+
return function (target) {
|
|
1277
|
+
DebugDecoratorHelper.set(target.prototype, opts);
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
var ASYNC_IDENTIFIER = 'async';
|
|
1282
|
+
function Log(options) {
|
|
1283
|
+
if (options === void 0) { options = {}; }
|
|
1284
|
+
return Trace(Object.assign({ level: 'log' }, options));
|
|
1285
|
+
}
|
|
1286
|
+
function Trace(options) {
|
|
1287
|
+
if (options === void 0) { options = {}; }
|
|
1288
|
+
return function (target, propertyKey, propertyDescriptor) {
|
|
1289
|
+
var method = propertyDescriptor.value;
|
|
1290
|
+
var isPromise = method.toString().includes(ASYNC_IDENTIFIER);
|
|
1291
|
+
var args = {
|
|
1292
|
+
options: options,
|
|
1293
|
+
method: method,
|
|
1294
|
+
target: target,
|
|
1295
|
+
propertyKey: propertyKey,
|
|
1296
|
+
propertyDescriptor: propertyDescriptor,
|
|
1297
|
+
};
|
|
1298
|
+
propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
|
|
1299
|
+
return propertyDescriptor;
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
var traceCall = function (_a) {
|
|
1303
|
+
var target = _a.target, propertyKey = _a.propertyKey, propertyDescriptor = _a.propertyDescriptor, args = _a.args;
|
|
1304
|
+
if (!target.debug)
|
|
1305
|
+
target.debug = DebugHelper.for(target, propertyKey);
|
|
1306
|
+
return target.debug.push(propertyKey).trace('called', { target: target, propertyKey: propertyKey, propertyDescriptor: propertyDescriptor, args: args });
|
|
1307
|
+
};
|
|
1308
|
+
var promiseTracer = function (_a) {
|
|
1309
|
+
var options = _a.options, method = _a.method, propertyKey = _a.propertyKey, propertyDescriptor = _a.propertyDescriptor;
|
|
1310
|
+
return function () {
|
|
1311
|
+
var _this = this;
|
|
1312
|
+
var args = [];
|
|
1313
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1314
|
+
args[_i] = arguments[_i];
|
|
1315
|
+
}
|
|
1316
|
+
return new Promise(function (resolve, reject) {
|
|
1317
|
+
var debug = traceCall({ target: _this, propertyDescriptor: propertyDescriptor, propertyKey: propertyKey, args: args });
|
|
1318
|
+
if (lodash.get(options, 'level', '') === 'log') {
|
|
1319
|
+
debug.with('params').log(args);
|
|
1320
|
+
}
|
|
1321
|
+
return method
|
|
1322
|
+
.apply(_this, args)
|
|
1323
|
+
.then(function (result) {
|
|
1324
|
+
if (options.callbackFn) {
|
|
1325
|
+
options.callbackFn({ target: _this, result: result, args: args, namespace: [propertyKey] });
|
|
1326
|
+
}
|
|
1327
|
+
if (lodash.get(options, 'level', '') === 'log') {
|
|
1328
|
+
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
1329
|
+
}
|
|
1330
|
+
return resolve(result);
|
|
1331
|
+
})
|
|
1332
|
+
.catch(function (error) {
|
|
1333
|
+
debug.error.apply(debug, __spreadArray([error], __read(args)));
|
|
1334
|
+
debug.with('stack').error(error.stack).pop();
|
|
1335
|
+
return reject(error);
|
|
1336
|
+
})
|
|
1337
|
+
.finally(function () {
|
|
1338
|
+
return debug.trace('finally', { args: args }).pop();
|
|
1339
|
+
});
|
|
1340
|
+
});
|
|
1341
|
+
};
|
|
1342
|
+
};
|
|
1343
|
+
var functionTracer = function (_a) {
|
|
1344
|
+
var options = _a.options, target = _a.target, method = _a.method, propertyKey = _a.propertyKey, propertyDescriptor = _a.propertyDescriptor;
|
|
1345
|
+
return function () {
|
|
1346
|
+
var args = [];
|
|
1347
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1348
|
+
args[_i] = arguments[_i];
|
|
1349
|
+
}
|
|
1350
|
+
var debug = traceCall({ target: this || target, propertyDescriptor: propertyDescriptor, propertyKey: propertyKey, args: args });
|
|
1351
|
+
if (lodash.get(options, 'level', '') === 'log') {
|
|
1352
|
+
debug.with('params').log(args);
|
|
1353
|
+
}
|
|
1354
|
+
var result;
|
|
1355
|
+
try {
|
|
1356
|
+
result = method.apply(this, args);
|
|
1357
|
+
if (options.callbackFn)
|
|
1358
|
+
options.callbackFn({ target: this, result: result, args: args, namespace: [propertyKey] });
|
|
1359
|
+
if (lodash.get(options, 'level', '') === 'log') {
|
|
1360
|
+
debug.with('returns').log(result === undefined ? 'void' : result);
|
|
1361
|
+
}
|
|
1362
|
+
return result;
|
|
1363
|
+
}
|
|
1364
|
+
catch (error) {
|
|
1365
|
+
debug.error.apply(debug, __spreadArray([error], __read(args))).pop();
|
|
1366
|
+
throw error;
|
|
1367
|
+
}
|
|
1368
|
+
finally {
|
|
1369
|
+
debug.trace('finally', { args: args }).pop();
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
833
1373
|
|
|
834
1374
|
var isUUID = function (value) { return lodash.isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value); };
|
|
835
1375
|
|
|
@@ -978,7 +1518,7 @@
|
|
|
978
1518
|
var instance = _super.toInstance.call(this, data);
|
|
979
1519
|
if (!lodash.isNil(data.firstName))
|
|
980
1520
|
instance.displayName = "" + data.firstName + (!lodash.isNil(data.lastName) ? " " + data.lastName : '');
|
|
981
|
-
return
|
|
1521
|
+
return;
|
|
982
1522
|
};
|
|
983
1523
|
User.prototype.toPlain = function () {
|
|
984
1524
|
var plain = _super.prototype.toPlain.call(this);
|
|
@@ -999,6 +1539,36 @@
|
|
|
999
1539
|
__metadata("design:type", BeautyProfile)
|
|
1000
1540
|
], User.prototype, "beautyProfile", void 0);
|
|
1001
1541
|
|
|
1542
|
+
var Address = /** @class */ (function (_super) {
|
|
1543
|
+
__extends(Address, _super);
|
|
1544
|
+
function Address() {
|
|
1545
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1546
|
+
}
|
|
1547
|
+
Object.defineProperty(Address, "identifiersFields", {
|
|
1548
|
+
get: function () {
|
|
1549
|
+
return ['id'];
|
|
1550
|
+
},
|
|
1551
|
+
enumerable: false,
|
|
1552
|
+
configurable: true
|
|
1553
|
+
});
|
|
1554
|
+
return Address;
|
|
1555
|
+
}(BaseModel));
|
|
1556
|
+
|
|
1557
|
+
var UserAddress = /** @class */ (function (_super) {
|
|
1558
|
+
__extends(UserAddress, _super);
|
|
1559
|
+
function UserAddress() {
|
|
1560
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1561
|
+
}
|
|
1562
|
+
Object.defineProperty(UserAddress, "identifiersFields", {
|
|
1563
|
+
get: function () {
|
|
1564
|
+
return ['id', 'userId'];
|
|
1565
|
+
},
|
|
1566
|
+
enumerable: false,
|
|
1567
|
+
configurable: true
|
|
1568
|
+
});
|
|
1569
|
+
return UserAddress;
|
|
1570
|
+
}(Address));
|
|
1571
|
+
|
|
1002
1572
|
var Subscription = /** @class */ (function (_super) {
|
|
1003
1573
|
__extends(Subscription, _super);
|
|
1004
1574
|
function Subscription() {
|
|
@@ -1022,12 +1592,12 @@
|
|
|
1022
1592
|
__metadata("design:type", SubscriptionPlan)
|
|
1023
1593
|
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
1024
1594
|
__decorate([
|
|
1025
|
-
classTransformer.Type(function () { return
|
|
1026
|
-
__metadata("design:type",
|
|
1595
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
1596
|
+
__metadata("design:type", UserAddress)
|
|
1027
1597
|
], Subscription.prototype, "shippingAddress", void 0);
|
|
1028
1598
|
__decorate([
|
|
1029
|
-
classTransformer.Type(function () { return
|
|
1030
|
-
__metadata("design:type",
|
|
1599
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
1600
|
+
__metadata("design:type", UserAddress)
|
|
1031
1601
|
], Subscription.prototype, "billingAddress", void 0);
|
|
1032
1602
|
__decorate([
|
|
1033
1603
|
classTransformer.Type(function () { return Coupon; }),
|
|
@@ -1042,21 +1612,6 @@
|
|
|
1042
1612
|
__metadata("design:type", Array)
|
|
1043
1613
|
], Subscription.prototype, "payment", void 0);
|
|
1044
1614
|
|
|
1045
|
-
var UserAddress = /** @class */ (function (_super) {
|
|
1046
|
-
__extends(UserAddress, _super);
|
|
1047
|
-
function UserAddress() {
|
|
1048
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1049
|
-
}
|
|
1050
|
-
Object.defineProperty(UserAddress, "identifiersFields", {
|
|
1051
|
-
get: function () {
|
|
1052
|
-
return ['id', 'userId'];
|
|
1053
|
-
},
|
|
1054
|
-
enumerable: false,
|
|
1055
|
-
configurable: true
|
|
1056
|
-
});
|
|
1057
|
-
return UserAddress;
|
|
1058
|
-
}(Address));
|
|
1059
|
-
|
|
1060
1615
|
var UserPaymentMethod = /** @class */ (function (_super) {
|
|
1061
1616
|
__extends(UserPaymentMethod, _super);
|
|
1062
1617
|
function UserPaymentMethod() {
|
|
@@ -1256,9 +1811,6 @@
|
|
|
1256
1811
|
function Filter() {
|
|
1257
1812
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1258
1813
|
}
|
|
1259
|
-
Filter.prototype.identifierFields = function () {
|
|
1260
|
-
return ['id'];
|
|
1261
|
-
};
|
|
1262
1814
|
Object.defineProperty(Filter, "identifiersFields", {
|
|
1263
1815
|
get: function () {
|
|
1264
1816
|
return ['id'];
|
|
@@ -1274,9 +1826,6 @@
|
|
|
1274
1826
|
function Category() {
|
|
1275
1827
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1276
1828
|
}
|
|
1277
|
-
Category.prototype.identifierFields = function () {
|
|
1278
|
-
return ['id'];
|
|
1279
|
-
};
|
|
1280
1829
|
Object.defineProperty(Category, "identifiersFields", {
|
|
1281
1830
|
get: function () {
|
|
1282
1831
|
return ['id'];
|
|
@@ -1300,9 +1849,6 @@
|
|
|
1300
1849
|
function CategoryCollectionChildren() {
|
|
1301
1850
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1302
1851
|
}
|
|
1303
|
-
CategoryCollectionChildren.prototype.identifierFields = function () {
|
|
1304
|
-
return ['collectionId', 'categoryId'];
|
|
1305
|
-
};
|
|
1306
1852
|
Object.defineProperty(CategoryCollectionChildren, "identifiersFields", {
|
|
1307
1853
|
get: function () {
|
|
1308
1854
|
return ['collectionId', 'categoryId'];
|
|
@@ -1323,9 +1869,6 @@
|
|
|
1323
1869
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1324
1870
|
}
|
|
1325
1871
|
Object.defineProperty(CategoryFilter, "identifiersFields", {
|
|
1326
|
-
// identifierFields(): NonFunctionPropertyNames<CategoryFilter>[] {
|
|
1327
|
-
// return ['id']
|
|
1328
|
-
// }
|
|
1329
1872
|
get: function () {
|
|
1330
1873
|
return ['id', 'filterId', 'categoryId'];
|
|
1331
1874
|
},
|
|
@@ -1355,9 +1898,6 @@
|
|
|
1355
1898
|
function FilterOption() {
|
|
1356
1899
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1357
1900
|
}
|
|
1358
|
-
FilterOption.prototype.identifierFields = function () {
|
|
1359
|
-
return ['id'];
|
|
1360
|
-
};
|
|
1361
1901
|
Object.defineProperty(FilterOption, "identifiersFields", {
|
|
1362
1902
|
get: function () {
|
|
1363
1903
|
return ['id'];
|
|
@@ -1395,9 +1935,6 @@
|
|
|
1395
1935
|
enumerable: false,
|
|
1396
1936
|
configurable: true
|
|
1397
1937
|
});
|
|
1398
|
-
Product.prototype.identifierFields = function () {
|
|
1399
|
-
return ['id'];
|
|
1400
|
-
};
|
|
1401
1938
|
Object.defineProperty(Product, "identifiersFields", {
|
|
1402
1939
|
get: function () {
|
|
1403
1940
|
return ['id'];
|
|
@@ -1423,7 +1960,7 @@
|
|
|
1423
1960
|
}
|
|
1424
1961
|
Object.defineProperty(KitProduct, "identifiersFields", {
|
|
1425
1962
|
get: function () {
|
|
1426
|
-
return ['productId', '
|
|
1963
|
+
return ['productId', 'kitProductId'];
|
|
1427
1964
|
},
|
|
1428
1965
|
enumerable: false,
|
|
1429
1966
|
configurable: true
|
|
@@ -1444,9 +1981,6 @@
|
|
|
1444
1981
|
function Variant() {
|
|
1445
1982
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1446
1983
|
}
|
|
1447
|
-
Variant.prototype.identifierFields = function () {
|
|
1448
|
-
return ['id'];
|
|
1449
|
-
};
|
|
1450
1984
|
Object.defineProperty(Variant, "identifiersFields", {
|
|
1451
1985
|
get: function () {
|
|
1452
1986
|
return ['id', 'productId'];
|
|
@@ -1552,12 +2086,12 @@
|
|
|
1552
2086
|
__metadata("design:type", User)
|
|
1553
2087
|
], Checkout.prototype, "user", void 0);
|
|
1554
2088
|
__decorate([
|
|
1555
|
-
classTransformer.Type(function () { return
|
|
1556
|
-
__metadata("design:type",
|
|
2089
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
2090
|
+
__metadata("design:type", UserAddress)
|
|
1557
2091
|
], Checkout.prototype, "shippingAddress", void 0);
|
|
1558
2092
|
__decorate([
|
|
1559
|
-
classTransformer.Type(function () { return
|
|
1560
|
-
__metadata("design:type",
|
|
2093
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
2094
|
+
__metadata("design:type", UserAddress)
|
|
1561
2095
|
], Checkout.prototype, "billingAddress", void 0);
|
|
1562
2096
|
__decorate([
|
|
1563
2097
|
classTransformer.Type(function () { return ShippingMethod; }),
|
|
@@ -1607,12 +2141,12 @@
|
|
|
1607
2141
|
return CheckoutSubscription;
|
|
1608
2142
|
}(BaseModel));
|
|
1609
2143
|
__decorate([
|
|
1610
|
-
classTransformer.Type(function () { return
|
|
1611
|
-
__metadata("design:type",
|
|
2144
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
2145
|
+
__metadata("design:type", UserAddress)
|
|
1612
2146
|
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
1613
2147
|
__decorate([
|
|
1614
|
-
classTransformer.Type(function () { return
|
|
1615
|
-
__metadata("design:type",
|
|
2148
|
+
classTransformer.Type(function () { return UserAddress; }),
|
|
2149
|
+
__metadata("design:type", UserAddress)
|
|
1616
2150
|
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
1617
2151
|
__decorate([
|
|
1618
2152
|
classTransformer.Type(function () { return SubscriptionPlan; }),
|
|
@@ -2327,34 +2861,34 @@
|
|
|
2327
2861
|
CreateFirestore.prototype.create = function (data) {
|
|
2328
2862
|
return __awaiter(this, void 0, void 0, function () {
|
|
2329
2863
|
var docRef, doc;
|
|
2330
|
-
return __generator(this, function (
|
|
2331
|
-
switch (
|
|
2864
|
+
return __generator(this, function (_c) {
|
|
2865
|
+
switch (_c.label) {
|
|
2332
2866
|
case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
|
|
2333
2867
|
case 1:
|
|
2334
|
-
docRef =
|
|
2868
|
+
docRef = _c.sent();
|
|
2335
2869
|
return [4 /*yield*/, docRef.get()];
|
|
2336
2870
|
case 2:
|
|
2337
|
-
doc =
|
|
2871
|
+
doc = _c.sent();
|
|
2338
2872
|
return [2 /*return*/, doc.data()];
|
|
2339
2873
|
}
|
|
2340
2874
|
});
|
|
2341
2875
|
});
|
|
2342
2876
|
};
|
|
2343
2877
|
CreateFirestore.prototype.save = function (data) {
|
|
2344
|
-
var _a;
|
|
2878
|
+
var _a, _b;
|
|
2345
2879
|
return __awaiter(this, void 0, void 0, function () {
|
|
2346
2880
|
var id, collectionPath, docRef;
|
|
2347
|
-
return __generator(this, function (
|
|
2348
|
-
switch (
|
|
2881
|
+
return __generator(this, function (_c) {
|
|
2882
|
+
switch (_c.label) {
|
|
2349
2883
|
case 0:
|
|
2350
|
-
id = (_a = data
|
|
2884
|
+
id = (_b = (_a = Object.values(data.identifier)) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.toString();
|
|
2351
2885
|
collectionPath = this.buildCollectionPathForAdd(data);
|
|
2352
2886
|
if (lodash.isEmpty(id))
|
|
2353
2887
|
return [2 /*return*/, this.collection(collectionPath).add(data)];
|
|
2354
2888
|
docRef = this.collection(collectionPath).doc(id);
|
|
2355
2889
|
return [4 /*yield*/, docRef.set(data)];
|
|
2356
2890
|
case 1:
|
|
2357
|
-
|
|
2891
|
+
_c.sent();
|
|
2358
2892
|
return [2 /*return*/, docRef];
|
|
2359
2893
|
}
|
|
2360
2894
|
});
|
|
@@ -2799,6 +3333,9 @@
|
|
|
2799
3333
|
});
|
|
2800
3334
|
});
|
|
2801
3335
|
};
|
|
3336
|
+
CategoryFirestoreRepository.prototype.getCategoryByShop = function (shop) {
|
|
3337
|
+
return;
|
|
3338
|
+
};
|
|
2802
3339
|
return CategoryFirestoreRepository;
|
|
2803
3340
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2804
3341
|
|
|
@@ -3356,11 +3893,12 @@
|
|
|
3356
3893
|
BindFilterQueryHelper.BuildWhereSentence = function (field, options, fields) {
|
|
3357
3894
|
var _a;
|
|
3358
3895
|
var fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
3359
|
-
|
|
3896
|
+
var isNestedField = !Array.isArray(options) &&
|
|
3360
3897
|
lodash.isObject(options) &&
|
|
3361
3898
|
lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
3362
3899
|
lodash.isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
3363
|
-
lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to)
|
|
3900
|
+
lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
|
|
3901
|
+
if (isNestedField)
|
|
3364
3902
|
return Object.keys(options).reduce(function (variables, key) {
|
|
3365
3903
|
var _a;
|
|
3366
3904
|
var fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
@@ -3372,7 +3910,7 @@
|
|
|
3372
3910
|
return _a = {},
|
|
3373
3911
|
_a[fieldSentenceOptions.fields[0]] = BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
|
|
3374
3912
|
_a;
|
|
3375
|
-
if (lodash.isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
3913
|
+
if (!Array.isArray(options) && lodash.isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
3376
3914
|
options = Object.values(options)[0];
|
|
3377
3915
|
return Array.isArray(options)
|
|
3378
3916
|
? options.reduce(function (whereSentence, option) { return (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))); }, {})
|
|
@@ -3384,16 +3922,20 @@
|
|
|
3384
3922
|
_a[BindFilterQueryHelper.GetHasuraOperator(options, fieldOption)] = FilterOptionHelper.GetValueFromFilter(options, fieldOption),
|
|
3385
3923
|
_a);
|
|
3386
3924
|
};
|
|
3387
|
-
BindFilterQueryHelper.GetHasuraOperator = function (options, fieldOption) {
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3925
|
+
BindFilterQueryHelper.GetHasuraOperator = function (options, fieldOption) {
|
|
3926
|
+
if (!FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
3927
|
+
return HasuraGraphQLWhere.EQUALS;
|
|
3928
|
+
if (fieldOption.type === HasuraGraphQLColumnType.Jsonb)
|
|
3929
|
+
return BindFilterQueryHelper.GetHasuraJsonbOperator(options);
|
|
3930
|
+
return HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })];
|
|
3931
|
+
};
|
|
3932
|
+
BindFilterQueryHelper.GetHasuraJsonbOperator = function (options) {
|
|
3933
|
+
if (options.operator === exports.Where.IN)
|
|
3934
|
+
return '_contains';
|
|
3935
|
+
if (options.operator === exports.Where.LIKE)
|
|
3936
|
+
return '_has_keys_any';
|
|
3937
|
+
return HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })];
|
|
3938
|
+
};
|
|
3397
3939
|
|
|
3398
3940
|
var GraphQLFieldHelper = /** @class */ (function () {
|
|
3399
3941
|
function GraphQLFieldHelper() {
|
|
@@ -3403,7 +3945,7 @@
|
|
|
3403
3945
|
GraphQLFieldHelper.CheckIsGraphQLParams = function (params) { return !lodash.isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation; };
|
|
3404
3946
|
GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = function (fields) {
|
|
3405
3947
|
return fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
|
|
3406
|
-
var _b
|
|
3948
|
+
var _b;
|
|
3407
3949
|
if (lodash.isString(field))
|
|
3408
3950
|
return field.toString();
|
|
3409
3951
|
var fieldName = Object.keys(field).shift();
|
|
@@ -3412,22 +3954,9 @@
|
|
|
3412
3954
|
return _b = {}, _b[fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue), _b;
|
|
3413
3955
|
if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
|
|
3414
3956
|
return;
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
_c[fieldValue.columnName || fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
3419
|
-
_c) : {
|
|
3420
|
-
operation: fieldValue.columnName || fieldName,
|
|
3421
|
-
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
3422
|
-
variables: (_d = {},
|
|
3423
|
-
_d[fieldValue.columnName + "_where"] = {
|
|
3424
|
-
name: 'where',
|
|
3425
|
-
type: fieldValue.filters.filterType,
|
|
3426
|
-
value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
|
|
3427
|
-
required: true,
|
|
3428
|
-
},
|
|
3429
|
-
_d),
|
|
3430
|
-
};
|
|
3957
|
+
var isNestedField = !!fieldValue.fields;
|
|
3958
|
+
if (isNestedField)
|
|
3959
|
+
return GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields(fieldName, fieldValue);
|
|
3431
3960
|
return fieldValue.columnName;
|
|
3432
3961
|
}).filter(function (field) { return !!field; });
|
|
3433
3962
|
};
|
|
@@ -3486,6 +4015,26 @@
|
|
|
3486
4015
|
return Object.assign(Object.assign({}, result), (_d = {}, _d[columnName] = data[attributeName], _d));
|
|
3487
4016
|
}, {});
|
|
3488
4017
|
};
|
|
4018
|
+
GraphQLFieldHelper.ConvertNestedFieldsToGraphQLFields = function (fieldName, fieldValue) {
|
|
4019
|
+
var _b, _c;
|
|
4020
|
+
var hasCustomFilters = !!fieldValue.filters;
|
|
4021
|
+
if (hasCustomFilters)
|
|
4022
|
+
return {
|
|
4023
|
+
operation: fieldValue.columnName || fieldName,
|
|
4024
|
+
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
4025
|
+
variables: (_b = {},
|
|
4026
|
+
_b[fieldValue.columnName + "_where"] = {
|
|
4027
|
+
name: 'where',
|
|
4028
|
+
type: fieldValue.filters.filterType,
|
|
4029
|
+
value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
|
|
4030
|
+
required: true,
|
|
4031
|
+
},
|
|
4032
|
+
_b),
|
|
4033
|
+
};
|
|
4034
|
+
return _c = {},
|
|
4035
|
+
_c[fieldValue.columnName || fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
4036
|
+
_c;
|
|
4037
|
+
};
|
|
3489
4038
|
|
|
3490
4039
|
var withCreateHasuraGraphQL = function (MixinBase) {
|
|
3491
4040
|
return /** @class */ (function (_super) {
|
|
@@ -3499,6 +4048,7 @@
|
|
|
3499
4048
|
var options = params === null || params === void 0 ? void 0 : params[0];
|
|
3500
4049
|
_this = _super.apply(this, __spreadArray([], __read(params))) || this;
|
|
3501
4050
|
_this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || "insert_" + _this.tableName + "_one";
|
|
4051
|
+
_this.insertAllGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertAllGraphQLOperation) || "insert_" + _this.tableName;
|
|
3502
4052
|
_this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || _this.tableName + "_insert_input";
|
|
3503
4053
|
return _this;
|
|
3504
4054
|
}
|
|
@@ -3507,7 +4057,9 @@
|
|
|
3507
4057
|
var newData;
|
|
3508
4058
|
return __generator(this, function (_b) {
|
|
3509
4059
|
switch (_b.label) {
|
|
3510
|
-
case 0:
|
|
4060
|
+
case 0:
|
|
4061
|
+
this.logger = DebugHelper.from(this, 'create');
|
|
4062
|
+
return [4 /*yield*/, this.save(this.model.toInstance(data))];
|
|
3511
4063
|
case 1:
|
|
3512
4064
|
newData = _b.sent();
|
|
3513
4065
|
return [2 /*return*/, this.model.toInstance(newData)];
|
|
@@ -3515,6 +4067,29 @@
|
|
|
3515
4067
|
});
|
|
3516
4068
|
});
|
|
3517
4069
|
};
|
|
4070
|
+
CreateHasuraGraphQLMixin.prototype.createAll = function (data) {
|
|
4071
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4072
|
+
var result;
|
|
4073
|
+
var _this = this;
|
|
4074
|
+
return __generator(this, function (_b) {
|
|
4075
|
+
switch (_b.label) {
|
|
4076
|
+
case 0:
|
|
4077
|
+
this.logger = DebugHelper.from(this, 'createAll');
|
|
4078
|
+
return [4 /*yield*/, this.mutation(this.insertAllGraphQLOperation, [{ returning: this.model.identifiersFields }], {
|
|
4079
|
+
objects: {
|
|
4080
|
+
type: this.insertGraphQLObjectType,
|
|
4081
|
+
required: true,
|
|
4082
|
+
list: true,
|
|
4083
|
+
value: data.map(function (item) { return _this.convertDataToHasura(item); }),
|
|
4084
|
+
},
|
|
4085
|
+
})];
|
|
4086
|
+
case 1:
|
|
4087
|
+
result = _b.sent();
|
|
4088
|
+
return [2 /*return*/, result[this.insertAllGraphQLOperation].returning.map(function (item, index) { return _this.model.toInstance(Object.assign(Object.assign({}, data[index]), item)); })];
|
|
4089
|
+
}
|
|
4090
|
+
});
|
|
4091
|
+
});
|
|
4092
|
+
};
|
|
3518
4093
|
CreateHasuraGraphQLMixin.prototype.save = function (data) {
|
|
3519
4094
|
return __awaiter(this, void 0, void 0, function () {
|
|
3520
4095
|
var primaryKeyColumns, foreignKeyColumns, result;
|
|
@@ -3532,8 +4107,7 @@
|
|
|
3532
4107
|
(_b = {},
|
|
3533
4108
|
_b[columnOptions.columnName] = Object.keys(columnOptions.foreignKeyColumn).map(function (foreignKeyField) {
|
|
3534
4109
|
var _a;
|
|
3535
|
-
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
|
|
3536
|
-
foreignKeyField;
|
|
4110
|
+
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || foreignKeyField;
|
|
3537
4111
|
}),
|
|
3538
4112
|
_b),
|
|
3539
4113
|
]));
|
|
@@ -3575,10 +4149,12 @@
|
|
|
3575
4149
|
return __generator(this, function (_a) {
|
|
3576
4150
|
switch (_a.label) {
|
|
3577
4151
|
case 0:
|
|
4152
|
+
this.logger = DebugHelper.from(this, 'delete');
|
|
3578
4153
|
instance = this.model.toInstance(identifiers);
|
|
3579
4154
|
return [4 /*yield*/, this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), this.model.identifiersFields.reduce(function (ids, identifier) {
|
|
3580
4155
|
var _a;
|
|
3581
|
-
|
|
4156
|
+
var identifierBinded = identifier;
|
|
4157
|
+
if (lodash.isNil(instance[identifierBinded]))
|
|
3582
4158
|
return ids;
|
|
3583
4159
|
var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
|
|
3584
4160
|
var value = columnOption.to(identifiers[identifier.toString()], instance);
|
|
@@ -3615,6 +4191,7 @@
|
|
|
3615
4191
|
_this.authOptions = options.authOptions;
|
|
3616
4192
|
_this.model = options.model;
|
|
3617
4193
|
_this.fields = options.fields || _this.model.identifiersFields;
|
|
4194
|
+
_this.logger = DebugHelper.from(_this);
|
|
3618
4195
|
return _this;
|
|
3619
4196
|
}
|
|
3620
4197
|
Object.defineProperty(HasuraGraphQLMixin.prototype, "headers", {
|
|
@@ -3664,6 +4241,7 @@
|
|
|
3664
4241
|
return __generator(this, function (_a) {
|
|
3665
4242
|
switch (_a.label) {
|
|
3666
4243
|
case 0:
|
|
4244
|
+
this.logger.with('params').log(params);
|
|
3667
4245
|
headers = this.headers;
|
|
3668
4246
|
return [4 /*yield*/, axios__default["default"]({
|
|
3669
4247
|
url: "" + this.endpoint,
|
|
@@ -3675,6 +4253,7 @@
|
|
|
3675
4253
|
result = (_a.sent()).data;
|
|
3676
4254
|
if (!lodash.isNil(result.errors))
|
|
3677
4255
|
throw new Error(JSON.stringify(result.errors));
|
|
4256
|
+
this.logger.with('returns').log(result);
|
|
3678
4257
|
return [2 /*return*/, result.data];
|
|
3679
4258
|
}
|
|
3680
4259
|
});
|
|
@@ -3703,8 +4282,8 @@
|
|
|
3703
4282
|
return value;
|
|
3704
4283
|
return date;
|
|
3705
4284
|
};
|
|
3706
|
-
HasuraGraphQLMixin.prototype.convertDataFromHasura = function (data) {
|
|
3707
|
-
var plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
|
|
4285
|
+
HasuraGraphQLMixin.prototype.convertDataFromHasura = function (data, fields) {
|
|
4286
|
+
var plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, fields || this.fields);
|
|
3708
4287
|
return this.model.toInstance(plain);
|
|
3709
4288
|
};
|
|
3710
4289
|
HasuraGraphQLMixin.prototype.convertDataToHasura = function (instance, update) {
|
|
@@ -3747,6 +4326,7 @@
|
|
|
3747
4326
|
return __generator(this, function (_b) {
|
|
3748
4327
|
switch (_b.label) {
|
|
3749
4328
|
case 0:
|
|
4329
|
+
this.logger = DebugHelper.from(this, 'update');
|
|
3750
4330
|
plainData = this.paramsToPlain(data);
|
|
3751
4331
|
return [4 /*yield*/, this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), {
|
|
3752
4332
|
_set: {
|
|
@@ -3778,10 +4358,11 @@
|
|
|
3778
4358
|
return this.model.identifiersFields.reduce(function (ids, identifier) {
|
|
3779
4359
|
var _b;
|
|
3780
4360
|
var _a;
|
|
3781
|
-
|
|
4361
|
+
var identifierBinded = identifier;
|
|
4362
|
+
if (lodash.isNil(instance[identifierBinded]))
|
|
3782
4363
|
return ids;
|
|
3783
|
-
var columnOption = AttributeOptionHelper.FindByAttribute(
|
|
3784
|
-
var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[
|
|
4364
|
+
var columnOption = AttributeOptionHelper.FindByAttribute(identifierBinded, _this.fields);
|
|
4365
|
+
var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifierBinded], instance)) || data[columnOption.attributeName];
|
|
3785
4366
|
return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = value, _b));
|
|
3786
4367
|
}, {});
|
|
3787
4368
|
};
|
|
@@ -3810,11 +4391,13 @@
|
|
|
3810
4391
|
return __generator(this, function (_b) {
|
|
3811
4392
|
switch (_b.label) {
|
|
3812
4393
|
case 0:
|
|
4394
|
+
this.logger = DebugHelper.from(this, 'get');
|
|
3813
4395
|
instance = this.model.toInstance(identifiers);
|
|
3814
4396
|
return [4 /*yield*/, this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce(function (ids, identifier) {
|
|
3815
4397
|
var _b;
|
|
3816
4398
|
var _a;
|
|
3817
|
-
|
|
4399
|
+
var identifierBinded = identifier;
|
|
4400
|
+
if (lodash.isNil(instance[identifierBinded]))
|
|
3818
4401
|
return ids;
|
|
3819
4402
|
var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
|
|
3820
4403
|
var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier.toString()], instance)) || identifiers[identifier.toString()];
|
|
@@ -3842,7 +4425,13 @@
|
|
|
3842
4425
|
return /** @class */ (function (_super) {
|
|
3843
4426
|
__extends(FindHasuraGraphQLMixin, _super);
|
|
3844
4427
|
function FindHasuraGraphQLMixin() {
|
|
3845
|
-
|
|
4428
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4429
|
+
_this.bindOrderByAttributes = function (orderBy, fields) { return Object.keys(orderBy).reduce(function (acc, current) {
|
|
4430
|
+
var _b;
|
|
4431
|
+
return (Object.assign(Object.assign({}, acc), (_b = {}, _b[AttributeOptionHelper.FindByAttribute(current, fields)
|
|
4432
|
+
.columnName] = orderBy[current], _b)));
|
|
4433
|
+
}, {}); };
|
|
4434
|
+
return _this;
|
|
3846
4435
|
}
|
|
3847
4436
|
FindHasuraGraphQLMixin.prototype.find = function (params) {
|
|
3848
4437
|
var _a;
|
|
@@ -3852,9 +4441,18 @@
|
|
|
3852
4441
|
return __generator(this, function (_c) {
|
|
3853
4442
|
switch (_c.label) {
|
|
3854
4443
|
case 0:
|
|
4444
|
+
this.logger = DebugHelper.from(this, 'find');
|
|
3855
4445
|
_b = params || {}, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy, options = _b.options;
|
|
3856
4446
|
enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
3857
|
-
variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy)
|
|
4447
|
+
variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy)
|
|
4448
|
+
? {}
|
|
4449
|
+
: {
|
|
4450
|
+
order_by: {
|
|
4451
|
+
type: this.tableName + "_order_by!",
|
|
4452
|
+
list: true,
|
|
4453
|
+
value: this.bindOrderByAttributes(orderBy, this.fields),
|
|
4454
|
+
},
|
|
4455
|
+
})), (lodash.isNil(filters)
|
|
3858
4456
|
? {}
|
|
3859
4457
|
: {
|
|
3860
4458
|
where: {
|
|
@@ -4031,6 +4629,7 @@
|
|
|
4031
4629
|
'image',
|
|
4032
4630
|
'published',
|
|
4033
4631
|
'shop',
|
|
4632
|
+
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4034
4633
|
'slug',
|
|
4035
4634
|
{ brandCategory: { columnName: 'brand_category' } },
|
|
4036
4635
|
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
@@ -4193,7 +4792,16 @@
|
|
|
4193
4792
|
case 0:
|
|
4194
4793
|
if (!slug)
|
|
4195
4794
|
return [2 /*return*/];
|
|
4196
|
-
return [4 /*yield*/, this.find({
|
|
4795
|
+
return [4 /*yield*/, this.find({
|
|
4796
|
+
filters: {
|
|
4797
|
+
slug: slug,
|
|
4798
|
+
shops: { operator: exports.Where.IN, value: [shop] },
|
|
4799
|
+
published: { operator: exports.Where.EQUALS, value: true },
|
|
4800
|
+
},
|
|
4801
|
+
options: {
|
|
4802
|
+
enableCount: false,
|
|
4803
|
+
},
|
|
4804
|
+
})];
|
|
4197
4805
|
case 1:
|
|
4198
4806
|
data = (_c.sent()).data;
|
|
4199
4807
|
if (!data.length)
|
|
@@ -4205,6 +4813,30 @@
|
|
|
4205
4813
|
});
|
|
4206
4814
|
});
|
|
4207
4815
|
};
|
|
4816
|
+
CategoryHasuraGraphQLRepository.prototype.getCategoryByShop = function (shop) {
|
|
4817
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4818
|
+
var data;
|
|
4819
|
+
return __generator(this, function (_c) {
|
|
4820
|
+
switch (_c.label) {
|
|
4821
|
+
case 0:
|
|
4822
|
+
if (!shop)
|
|
4823
|
+
return [2 /*return*/];
|
|
4824
|
+
return [4 /*yield*/, this.find({
|
|
4825
|
+
filters: {
|
|
4826
|
+
shops: { operator: exports.Where.IN, value: [shop] },
|
|
4827
|
+
published: { operator: exports.Where.EQUALS, value: true },
|
|
4828
|
+
},
|
|
4829
|
+
options: {
|
|
4830
|
+
enableCount: false,
|
|
4831
|
+
},
|
|
4832
|
+
})];
|
|
4833
|
+
case 1:
|
|
4834
|
+
data = (_c.sent()).data;
|
|
4835
|
+
return [2 /*return*/, data];
|
|
4836
|
+
}
|
|
4837
|
+
});
|
|
4838
|
+
});
|
|
4839
|
+
};
|
|
4208
4840
|
CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit, gender) {
|
|
4209
4841
|
if (limit === void 0) { limit = 4; }
|
|
4210
4842
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -5708,8 +6340,12 @@
|
|
|
5708
6340
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
5709
6341
|
exports.CheckoutSubscription = CheckoutSubscription;
|
|
5710
6342
|
exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
|
|
6343
|
+
exports.ClassNameHelper = ClassNameHelper;
|
|
5711
6344
|
exports.Coupon = Coupon;
|
|
5712
6345
|
exports.CouponFirestoreRepository = CouponFirestoreRepository;
|
|
6346
|
+
exports.Debug = Debug;
|
|
6347
|
+
exports.DebugDecoratorHelper = DebugDecoratorHelper;
|
|
6348
|
+
exports.DebugHelper = DebugHelper;
|
|
5713
6349
|
exports.DuplicatedResultsError = DuplicatedResultsError;
|
|
5714
6350
|
exports.Edition = Edition;
|
|
5715
6351
|
exports.Filter = Filter;
|
|
@@ -5725,6 +6361,8 @@
|
|
|
5725
6361
|
exports.LeadFirestoreRepository = LeadFirestoreRepository;
|
|
5726
6362
|
exports.LegacyOrderFirestoreRepository = LegacyOrderFirestoreRepository;
|
|
5727
6363
|
exports.LineItem = LineItem;
|
|
6364
|
+
exports.Log = Log;
|
|
6365
|
+
exports.Logger = Logger;
|
|
5728
6366
|
exports.NotFoundError = NotFoundError;
|
|
5729
6367
|
exports.Order = Order;
|
|
5730
6368
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
@@ -5737,6 +6375,7 @@
|
|
|
5737
6375
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
5738
6376
|
exports.ProductsIndex = ProductsIndex;
|
|
5739
6377
|
exports.RecoveryPassword = RecoveryPassword;
|
|
6378
|
+
exports.ReflectHelper = ReflectHelper;
|
|
5740
6379
|
exports.Register = Register;
|
|
5741
6380
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
5742
6381
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
@@ -5755,6 +6394,7 @@
|
|
|
5755
6394
|
exports.SubscriptionPlan = SubscriptionPlan;
|
|
5756
6395
|
exports.SubscriptionPlanFirestoreRepository = SubscriptionPlanFirestoreRepository;
|
|
5757
6396
|
exports.SubscriptionProductFirestoreRepository = SubscriptionProductFirestoreRepository;
|
|
6397
|
+
exports.Trace = Trace;
|
|
5758
6398
|
exports.UnauthorizedError = UnauthorizedError;
|
|
5759
6399
|
exports.User = User;
|
|
5760
6400
|
exports.UserAddress = UserAddress;
|
|
@@ -5768,6 +6408,7 @@
|
|
|
5768
6408
|
exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
|
|
5769
6409
|
exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
|
|
5770
6410
|
exports.WeakPasswordError = WeakPasswordError;
|
|
6411
|
+
exports.isDebuggable = isDebuggable;
|
|
5771
6412
|
exports.isUUID = isUUID;
|
|
5772
6413
|
exports.parseDateTime = parseDateTime;
|
|
5773
6414
|
exports.withCreateFirestore = withCreateFirestore;
|