@infrab4a/connect 3.4.0-beta.7 → 3.4.0-beta.8
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 +87 -4
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.js +46 -3
- package/fesm2015/infrab4a-connect.js +45 -2
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4179,13 +4179,13 @@
|
|
|
4179
4179
|
FilterHasuraGraphQLRepository.prototype.updateOptions = function (filterId, _a) {
|
|
4180
4180
|
var options = _a.options;
|
|
4181
4181
|
return __awaiter(this, void 0, void 0, function () {
|
|
4182
|
-
var i, filterOptions, i, hasFilter, error_1, newOption;
|
|
4182
|
+
var i, filterOptions, i, hasFilter, error_1, newOption, filterOptions, i, hasFilter, error_2, newOption;
|
|
4183
4183
|
return __generator(this, function (_a) {
|
|
4184
4184
|
switch (_a.label) {
|
|
4185
4185
|
case 0:
|
|
4186
4186
|
if (!options)
|
|
4187
4187
|
return [2 /*return*/, []];
|
|
4188
|
-
if (!('action' in options && options.action === 'remove')) return [3 /*break*/, 5];
|
|
4188
|
+
if (!('action' in options && options.action === 'remove' && options.value.length)) return [3 /*break*/, 5];
|
|
4189
4189
|
i = 0;
|
|
4190
4190
|
_a.label = 1;
|
|
4191
4191
|
case 1:
|
|
@@ -4199,7 +4199,7 @@
|
|
|
4199
4199
|
return [3 /*break*/, 1];
|
|
4200
4200
|
case 4: return [2 /*return*/, []];
|
|
4201
4201
|
case 5:
|
|
4202
|
-
if (!('action' in options && options.action === 'merge')) return [3 /*break*/, 13];
|
|
4202
|
+
if (!('action' in options && options.action === 'merge' && options.value.length)) return [3 /*break*/, 13];
|
|
4203
4203
|
filterOptions = [];
|
|
4204
4204
|
i = 0;
|
|
4205
4205
|
_a.label = 6;
|
|
@@ -4225,7 +4225,90 @@
|
|
|
4225
4225
|
i++;
|
|
4226
4226
|
return [3 /*break*/, 6];
|
|
4227
4227
|
case 12: return [2 /*return*/, filterOptions];
|
|
4228
|
-
case 13:
|
|
4228
|
+
case 13:
|
|
4229
|
+
if (!(Array.isArray(options) && options.length)) return [3 /*break*/, 20];
|
|
4230
|
+
filterOptions = [];
|
|
4231
|
+
i = 0;
|
|
4232
|
+
_a.label = 14;
|
|
4233
|
+
case 14:
|
|
4234
|
+
if (!(i < options.length)) return [3 /*break*/, 20];
|
|
4235
|
+
_a.label = 15;
|
|
4236
|
+
case 15:
|
|
4237
|
+
_a.trys.push([15, 17, , 19]);
|
|
4238
|
+
return [4 /*yield*/, this.filterOptionRepository.get({ id: options[i].id })];
|
|
4239
|
+
case 16:
|
|
4240
|
+
hasFilter = _a.sent();
|
|
4241
|
+
if (hasFilter)
|
|
4242
|
+
filterOptions.push(hasFilter);
|
|
4243
|
+
return [3 /*break*/, 19];
|
|
4244
|
+
case 17:
|
|
4245
|
+
error_2 = _a.sent();
|
|
4246
|
+
return [4 /*yield*/, this.filterOptionRepository.create(Object.assign(Object.assign({}, options[i]), { filterId: filterId }))];
|
|
4247
|
+
case 18:
|
|
4248
|
+
newOption = _a.sent();
|
|
4249
|
+
filterOptions.push(newOption);
|
|
4250
|
+
return [3 /*break*/, 19];
|
|
4251
|
+
case 19:
|
|
4252
|
+
i++;
|
|
4253
|
+
return [3 /*break*/, 14];
|
|
4254
|
+
case 20: return [2 /*return*/, []];
|
|
4255
|
+
}
|
|
4256
|
+
});
|
|
4257
|
+
});
|
|
4258
|
+
};
|
|
4259
|
+
FilterHasuraGraphQLRepository.prototype.delete = function (params) {
|
|
4260
|
+
var _super = Object.create(null, {
|
|
4261
|
+
delete: { get: function () { return _super_1.prototype.delete; } }
|
|
4262
|
+
});
|
|
4263
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4264
|
+
var options, data;
|
|
4265
|
+
return __generator(this, function (_a) {
|
|
4266
|
+
switch (_a.label) {
|
|
4267
|
+
case 0:
|
|
4268
|
+
options = params.options, data = __rest(params
|
|
4269
|
+
// Validar se o filtro está associado a alguma categoria
|
|
4270
|
+
// Se sim, retornar erro
|
|
4271
|
+
, ["options"]);
|
|
4272
|
+
// Validar se o filtro está associado a alguma categoria
|
|
4273
|
+
// Se sim, retornar erro
|
|
4274
|
+
return [4 /*yield*/, this.deleteOptions(options)];
|
|
4275
|
+
case 1:
|
|
4276
|
+
// Validar se o filtro está associado a alguma categoria
|
|
4277
|
+
// Se sim, retornar erro
|
|
4278
|
+
_a.sent();
|
|
4279
|
+
return [4 /*yield*/, _super.delete.call(this, { id: +data.id })];
|
|
4280
|
+
case 2:
|
|
4281
|
+
_a.sent();
|
|
4282
|
+
return [2 /*return*/];
|
|
4283
|
+
}
|
|
4284
|
+
});
|
|
4285
|
+
});
|
|
4286
|
+
};
|
|
4287
|
+
FilterHasuraGraphQLRepository.prototype.deleteOptions = function (options) {
|
|
4288
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4289
|
+
var i, error_3;
|
|
4290
|
+
return __generator(this, function (_a) {
|
|
4291
|
+
switch (_a.label) {
|
|
4292
|
+
case 0:
|
|
4293
|
+
i = 0;
|
|
4294
|
+
_a.label = 1;
|
|
4295
|
+
case 1:
|
|
4296
|
+
if (!(i < options.length)) return [3 /*break*/, 6];
|
|
4297
|
+
_a.label = 2;
|
|
4298
|
+
case 2:
|
|
4299
|
+
_a.trys.push([2, 4, , 5]);
|
|
4300
|
+
return [4 /*yield*/, this.filterOptionRepository.delete({ id: options[i].id })];
|
|
4301
|
+
case 3:
|
|
4302
|
+
_a.sent();
|
|
4303
|
+
return [3 /*break*/, 5];
|
|
4304
|
+
case 4:
|
|
4305
|
+
error_3 = _a.sent();
|
|
4306
|
+
console.log(error_3);
|
|
4307
|
+
return [3 /*break*/, 5];
|
|
4308
|
+
case 5:
|
|
4309
|
+
i++;
|
|
4310
|
+
return [3 /*break*/, 1];
|
|
4311
|
+
case 6: return [2 /*return*/];
|
|
4229
4312
|
}
|
|
4230
4313
|
});
|
|
4231
4314
|
});
|