@infrab4a/connect 4.23.2 → 4.24.0-beta.1

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.
Files changed (26) hide show
  1. package/index.cjs.js +1595 -1597
  2. package/index.esm.js +1592 -1597
  3. package/package.json +1 -1
  4. package/src/domain/catalog/models/category.d.ts +48 -6
  5. package/src/domain/catalog/models/filter.d.ts +2 -2
  6. package/src/domain/catalog/models/index.d.ts +1 -1
  7. package/src/domain/catalog/models/kit-product.d.ts +5 -4
  8. package/src/domain/catalog/models/product-base.d.ts +12 -8
  9. package/src/domain/catalog/models/product-errors.d.ts +2 -1
  10. package/src/domain/catalog/models/{product-reviews.d.ts → product-review.d.ts} +2 -2
  11. package/src/domain/catalog/models/product.d.ts +4 -7
  12. package/src/domain/catalog/models/types/index.d.ts +0 -1
  13. package/src/domain/catalog/models/types/product-evaluation.type.d.ts +1 -1
  14. package/src/domain/catalog/models/variant.d.ts +3 -16
  15. package/src/domain/catalog/repositories/product-reviews.repository.d.ts +5 -5
  16. package/src/domain/catalog/repositories/product.repository.d.ts +1 -1
  17. package/src/infra/elasticsearch/indexes/products-index.d.ts +5 -5
  18. package/src/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -2
  19. package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +10 -10
  20. package/src/utils/circular-dependencies.d.ts +7 -0
  21. package/src/utils/index.d.ts +1 -0
  22. package/src/domain/catalog/models/category-base.d.ts +0 -47
  23. package/src/domain/catalog/models/category-for-product.d.ts +0 -5
  24. package/src/domain/catalog/models/product-for-category.d.ts +0 -7
  25. package/src/domain/catalog/models/product-for-kit.d.ts +0 -7
  26. package/src/domain/catalog/models/types/product-review.type.d.ts +0 -17
package/index.cjs.js CHANGED
@@ -103,1708 +103,1708 @@ class PaymentProviderFactory {
103
103
  }
104
104
  }
105
105
 
106
- class BaseModel {
107
- get identifier() {
108
- const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
109
- const data = this;
110
- return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
111
- }
112
- get identifiersFields() {
113
- return this.constructor.identifiersFields;
114
- }
115
- constructor(args) {
116
- Object.assign(this, args);
117
- }
118
- static toInstance(data) {
119
- return classTransformer.plainToInstance(this, data || {});
120
- }
121
- static isModel(value) {
122
- return value instanceof this;
123
- }
124
- toPlain() {
125
- return classTransformer.instanceToPlain(this);
126
- }
127
- }
128
-
129
- exports.GenderDestination = void 0;
130
- (function (GenderDestination) {
131
- GenderDestination["FEMALE"] = "female";
132
- GenderDestination["MALE"] = "male";
133
- GenderDestination["UNISEX"] = "unisex";
134
- })(exports.GenderDestination || (exports.GenderDestination = {}));
135
-
136
- exports.ProductLabelEnum = void 0;
137
- (function (ProductLabelEnum) {
138
- ProductLabelEnum["ON_SALE"] = "on-sale";
139
- ProductLabelEnum["OUTLET"] = "outlet";
140
- ProductLabelEnum["LAST_UNITS"] = "last-units";
141
- ProductLabelEnum["GLAMSTAR"] = "glamstar";
142
- })(exports.ProductLabelEnum || (exports.ProductLabelEnum = {}));
143
-
144
- exports.Shops = void 0;
145
- (function (Shops) {
146
- Shops["MENSMARKET"] = "mensmarket";
147
- Shops["GLAMSHOP"] = "Glamshop";
148
- Shops["GLAMPOINTS"] = "Glampoints";
149
- Shops["ALL"] = "ALL";
150
- })(exports.Shops || (exports.Shops = {}));
151
-
152
- exports.WishlistLogType = void 0;
153
- (function (WishlistLogType) {
154
- WishlistLogType["CREATE"] = "create";
155
- WishlistLogType["UPDATE"] = "update";
156
- WishlistLogType["DELETE"] = "delete";
157
- WishlistLogType["ADD_PRODUCT"] = "add_product";
158
- WishlistLogType["REMOVE_PRODUCT"] = "remove_product";
159
- })(exports.WishlistLogType || (exports.WishlistLogType = {}));
160
-
161
- class CategoryBase extends BaseModel {
162
- static get identifiersFields() {
163
- return ['id'];
164
- }
165
- get glamImages() {
166
- return this.images && this.images[exports.Shops.GLAMSHOP]
167
- ? this.images[exports.Shops.GLAMSHOP]
168
- : {
169
- brandBanner: null,
170
- brandBannerMobile: null,
171
- image: null,
172
- };
173
- }
174
- get mensImages() {
175
- return this.images && this.images[exports.Shops.MENSMARKET]
176
- ? this.images[exports.Shops.MENSMARKET]
177
- : {
178
- brandBanner: null,
179
- brandBannerMobile: null,
180
- image: null,
181
- };
182
- }
183
- get glamMetadata() {
184
- return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
185
- }
186
- get mensMetadata() {
187
- return this.metadatas.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
188
- }
189
- getMostRelevantByShop(shop) {
190
- return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
191
- }
192
- }
193
- tslib.__decorate([
194
- classTransformer.Type(() => CategoryBase),
195
- tslib.__metadata("design:type", CategoryBase)
196
- ], CategoryBase.prototype, "parent", void 0);
197
-
198
- class Filter extends BaseModel {
199
- static get identifiersFields() {
200
- return ['id'];
201
- }
202
- }
203
- tslib.__decorate([
204
- classTransformer.Type(() => CategoryBase),
205
- tslib.__metadata("design:type", Array)
206
- ], Filter.prototype, "categories", void 0);
207
-
208
- class CategoryForProduct extends CategoryBase {
209
- static get identifiersFields() {
210
- return ['id'];
211
- }
212
- }
213
-
214
- class ProductBase extends BaseModel {
215
- get evaluation() {
216
- return {
217
- reviews: this.reviews,
218
- count: this.reviewsTotal,
219
- rating: this.rate,
220
- };
221
- }
222
- set evaluation(evaluation) {
223
- if (!evaluation) {
224
- this.reviews = null;
225
- this.reviewsTotal = null;
226
- this.rate = null;
227
- return;
228
- }
229
- this.reviews = evaluation.reviews || this.reviews;
230
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
231
- this.rate = evaluation.rating || this.rate;
232
- }
233
- static get identifiersFields() {
234
- return ['id'];
235
- }
236
- }
237
-
238
- class ProductForKit extends ProductBase {
239
- static get identifiersFields() {
240
- return ['id'];
241
- }
106
+ /**
107
+ * Este arquivo define funções para resolver dependências circulares
108
+ * em ambiente ESM, onde não podemos usar require()
109
+ */
110
+ // Armazenamento global para classes registradas
111
+ const registry = new Map();
112
+ // Registrar uma classe na resolução de dependências circulares
113
+ function registerClass(name, classConstructor) {
114
+ registry.set(name, classConstructor);
242
115
  }
243
- tslib.__decorate([
244
- classTransformer.Type(() => CategoryForProduct),
245
- tslib.__metadata("design:type", CategoryForProduct)
246
- ], ProductForKit.prototype, "category", void 0);
247
-
248
- class KitProduct extends BaseModel {
249
- static get identifiersFields() {
250
- return ['productId', 'kitProductId'];
251
- }
252
- }
253
- tslib.__decorate([
254
- classTransformer.Type(() => ProductForKit),
255
- tslib.__metadata("design:type", ProductForKit)
256
- ], KitProduct.prototype, "kit", void 0);
257
- tslib.__decorate([
258
- classTransformer.Type(() => ProductForKit),
259
- tslib.__metadata("design:type", ProductForKit)
260
- ], KitProduct.prototype, "product", void 0);
261
-
262
- class ProductForCategory extends ProductBase {
263
- static get identifiersFields() {
264
- return ['id'];
265
- }
266
- }
267
- tslib.__decorate([
268
- classTransformer.Type(() => KitProduct),
269
- tslib.__metadata("design:type", Array)
270
- ], ProductForCategory.prototype, "kitProducts", void 0);
271
-
272
- class Category extends CategoryBase {
273
- static get identifiersFields() {
274
- return ['id'];
275
- }
276
- }
277
- tslib.__decorate([
278
- classTransformer.Type(() => ProductForCategory),
279
- tslib.__metadata("design:type", Array)
280
- ], Category.prototype, "childrenProducts", void 0);
281
- tslib.__decorate([
282
- classTransformer.Type(() => Filter),
283
- tslib.__metadata("design:type", Array)
284
- ], Category.prototype, "filters", void 0);
285
-
286
- class CategoryCollectionChildren extends BaseModel {
287
- static get identifiersFields() {
288
- return ['collectionId', 'categoryId'];
289
- }
290
- }
291
- tslib.__decorate([
292
- classTransformer.Type(() => CategoryCollectionChildren),
293
- tslib.__metadata("design:type", CategoryCollectionChildren)
294
- ], CategoryCollectionChildren.prototype, "parent", void 0);
295
-
296
- class CategoryFilter extends BaseModel {
297
- static get identifiersFields() {
298
- return ['id'];
299
- }
116
+ // Obter uma classe registrada
117
+ function getClass(name) {
118
+ return registry.get(name);
300
119
  }
301
- tslib.__decorate([
302
- classTransformer.Type(() => Filter),
303
- tslib.__metadata("design:type", Filter)
304
- ], CategoryFilter.prototype, "filter", void 0);
305
- tslib.__decorate([
306
- classTransformer.Type(() => Category),
307
- tslib.__metadata("design:type", Category)
308
- ], CategoryFilter.prototype, "category", void 0);
309
-
310
- class CategoryProduct extends BaseModel {
311
- static get identifiersFields() {
312
- return ['categoryId', 'productId'];
313
- }
314
- }
315
-
316
- class FilterOption extends BaseModel {
317
- static get identifiersFields() {
318
- return ['id'];
319
- }
120
+ // Função de resolução para class-transformer
121
+ function resolveClass(name) {
122
+ return () => {
123
+ // Forçamos o retorno de uma função que retorna a classe
124
+ // ao invés da classe diretamente para evitar problemas com o decorator
125
+ return getClass(name);
126
+ };
320
127
  }
321
128
 
322
- class Product extends ProductBase {
323
- static get identifiersFields() {
324
- return ['id'];
325
- }
326
- }
327
- tslib.__decorate([
328
- classTransformer.Type(() => CategoryForProduct),
329
- tslib.__metadata("design:type", CategoryForProduct)
330
- ], Product.prototype, "category", void 0);
331
- tslib.__decorate([
332
- classTransformer.Type(() => KitProduct),
333
- tslib.__metadata("design:type", Array)
334
- ], Product.prototype, "kitProducts", void 0);
335
-
336
- class Variant extends BaseModel {
337
- static get identifiersFields() {
338
- return ['id', 'productId'];
339
- }
129
+ function isFunction(value) {
130
+ return typeof value === 'function';
340
131
  }
341
132
 
342
- class ProductErrors extends BaseModel {
343
- static get identifiersFields() {
344
- return ['productId', 'source', 'error'];
345
- }
346
- getProductId() {
347
- return this.product instanceof Product ? this.product.id.toString() : this.product.productId.toString();
348
- }
349
- }
350
- tslib.__decorate([
351
- classTransformer.Type((type) => (+type.object.product.productId ? Variant : Product)),
352
- tslib.__metadata("design:type", Object)
353
- ], ProductErrors.prototype, "product", void 0);
354
-
355
- class ProductReviews extends BaseModel {
356
- static get identifiersFields() {
357
- return ['id'];
358
- }
133
+ function createErrorClass(createImpl) {
134
+ var _super = function (instance) {
135
+ Error.call(instance);
136
+ instance.stack = new Error().stack;
137
+ };
138
+ var ctorFunc = createImpl(_super);
139
+ ctorFunc.prototype = Object.create(Error.prototype);
140
+ ctorFunc.prototype.constructor = ctorFunc;
141
+ return ctorFunc;
359
142
  }
360
143
 
361
- class ProductStockNotification extends BaseModel {
362
- static get identifiersFields() {
363
- return ['id'];
364
- }
365
- }
144
+ var UnsubscriptionError = createErrorClass(function (_super) {
145
+ return function UnsubscriptionErrorImpl(errors) {
146
+ _super(this);
147
+ this.message = errors
148
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
149
+ : '';
150
+ this.name = 'UnsubscriptionError';
151
+ this.errors = errors;
152
+ };
153
+ });
366
154
 
367
- class Wishlist extends Category {
368
- static get identifiersFields() {
369
- return ['id'];
370
- }
155
+ function arrRemove(arr, item) {
156
+ if (arr) {
157
+ var index = arr.indexOf(item);
158
+ 0 <= index && arr.splice(index, 1);
159
+ }
371
160
  }
372
161
 
373
- class Buy2Win extends BaseModel {
374
- static get identifiersFields() {
375
- return ['id'];
376
- }
377
- }
378
- tslib.__decorate([
379
- classTransformer.Type(() => Category),
380
- tslib.__metadata("design:type", Array)
381
- ], Buy2Win.prototype, "categories", void 0);
162
+ var Subscription$1 = (function () {
163
+ function Subscription(initialTeardown) {
164
+ this.initialTeardown = initialTeardown;
165
+ this.closed = false;
166
+ this._parentage = null;
167
+ this._finalizers = null;
168
+ }
169
+ Subscription.prototype.unsubscribe = function () {
170
+ var e_1, _a, e_2, _b;
171
+ var errors;
172
+ if (!this.closed) {
173
+ this.closed = true;
174
+ var _parentage = this._parentage;
175
+ if (_parentage) {
176
+ this._parentage = null;
177
+ if (Array.isArray(_parentage)) {
178
+ try {
179
+ for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
180
+ var parent_1 = _parentage_1_1.value;
181
+ parent_1.remove(this);
182
+ }
183
+ }
184
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
185
+ finally {
186
+ try {
187
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
188
+ }
189
+ finally { if (e_1) throw e_1.error; }
190
+ }
191
+ }
192
+ else {
193
+ _parentage.remove(this);
194
+ }
195
+ }
196
+ var initialFinalizer = this.initialTeardown;
197
+ if (isFunction(initialFinalizer)) {
198
+ try {
199
+ initialFinalizer();
200
+ }
201
+ catch (e) {
202
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
203
+ }
204
+ }
205
+ var _finalizers = this._finalizers;
206
+ if (_finalizers) {
207
+ this._finalizers = null;
208
+ try {
209
+ for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
210
+ var finalizer = _finalizers_1_1.value;
211
+ try {
212
+ execFinalizer(finalizer);
213
+ }
214
+ catch (err) {
215
+ errors = errors !== null && errors !== void 0 ? errors : [];
216
+ if (err instanceof UnsubscriptionError) {
217
+ errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
218
+ }
219
+ else {
220
+ errors.push(err);
221
+ }
222
+ }
223
+ }
224
+ }
225
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
226
+ finally {
227
+ try {
228
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
229
+ }
230
+ finally { if (e_2) throw e_2.error; }
231
+ }
232
+ }
233
+ if (errors) {
234
+ throw new UnsubscriptionError(errors);
235
+ }
236
+ }
237
+ };
238
+ Subscription.prototype.add = function (teardown) {
239
+ var _a;
240
+ if (teardown && teardown !== this) {
241
+ if (this.closed) {
242
+ execFinalizer(teardown);
243
+ }
244
+ else {
245
+ if (teardown instanceof Subscription) {
246
+ if (teardown.closed || teardown._hasParent(this)) {
247
+ return;
248
+ }
249
+ teardown._addParent(this);
250
+ }
251
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
252
+ }
253
+ }
254
+ };
255
+ Subscription.prototype._hasParent = function (parent) {
256
+ var _parentage = this._parentage;
257
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
258
+ };
259
+ Subscription.prototype._addParent = function (parent) {
260
+ var _parentage = this._parentage;
261
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
262
+ };
263
+ Subscription.prototype._removeParent = function (parent) {
264
+ var _parentage = this._parentage;
265
+ if (_parentage === parent) {
266
+ this._parentage = null;
267
+ }
268
+ else if (Array.isArray(_parentage)) {
269
+ arrRemove(_parentage, parent);
270
+ }
271
+ };
272
+ Subscription.prototype.remove = function (teardown) {
273
+ var _finalizers = this._finalizers;
274
+ _finalizers && arrRemove(_finalizers, teardown);
275
+ if (teardown instanceof Subscription) {
276
+ teardown._removeParent(this);
277
+ }
278
+ };
279
+ Subscription.EMPTY = (function () {
280
+ var empty = new Subscription();
281
+ empty.closed = true;
282
+ return empty;
283
+ })();
284
+ return Subscription;
285
+ }());
286
+ var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
287
+ function isSubscription(value) {
288
+ return (value instanceof Subscription$1 ||
289
+ (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
290
+ }
291
+ function execFinalizer(finalizer) {
292
+ if (isFunction(finalizer)) {
293
+ finalizer();
294
+ }
295
+ else {
296
+ finalizer.unsubscribe();
297
+ }
298
+ }
382
299
 
383
- exports.Where = void 0;
384
- (function (Where) {
385
- Where["EQUALS"] = "==";
386
- Where["NOTEQUALS"] = "!=";
387
- Where["GT"] = ">";
388
- Where["GTE"] = ">=";
389
- Where["IN"] = "in";
390
- Where["NOTIN"] = "not in";
391
- Where["LT"] = "<";
392
- Where["LTE"] = "<=";
393
- Where["LIKE"] = "like";
394
- Where["NOTLIKE"] = "not like";
395
- Where["ISNULL"] = "is null";
396
- Where["ISNOTNULL"] = "is not null";
397
- Where["IREGEX"] = "iregex";
398
- })(exports.Where || (exports.Where = {}));
300
+ var config = {
301
+ onUnhandledError: null,
302
+ onStoppedNotification: null,
303
+ Promise: undefined,
304
+ useDeprecatedSynchronousErrorHandling: false,
305
+ useDeprecatedNextContext: false,
306
+ };
399
307
 
400
- exports.UpdateOptionActions = void 0;
401
- (function (UpdateOptionActions) {
402
- UpdateOptionActions["UPDATE"] = "update";
403
- UpdateOptionActions["MERGE"] = "merge";
404
- UpdateOptionActions["REMOVE"] = "remove";
405
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
406
- UpdateOptionActions["NULL"] = "null";
407
- })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
308
+ var timeoutProvider = {
309
+ setTimeout: function (handler, timeout) {
310
+ var args = [];
311
+ for (var _i = 2; _i < arguments.length; _i++) {
312
+ args[_i - 2] = arguments[_i];
313
+ }
314
+ var delegate = timeoutProvider.delegate;
315
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
316
+ return delegate.setTimeout.apply(delegate, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
317
+ }
318
+ return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
319
+ },
320
+ clearTimeout: function (handle) {
321
+ var delegate = timeoutProvider.delegate;
322
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
323
+ },
324
+ delegate: undefined,
325
+ };
408
326
 
409
- class CampaignDashboard extends BaseModel {
410
- static get identifiersFields() {
411
- return ['id'];
412
- }
327
+ function reportUnhandledError(err) {
328
+ timeoutProvider.setTimeout(function () {
329
+ {
330
+ throw err;
331
+ }
332
+ });
413
333
  }
414
334
 
415
- class CampaignHashtag extends BaseModel {
416
- static get identifiersFields() {
417
- return ['id'];
418
- }
419
- }
335
+ function noop() { }
420
336
 
421
- class BeautyProfile extends BaseModel {
422
- toPlain() {
423
- const plain = super.toPlain();
424
- delete plain.id;
425
- return plain;
426
- }
427
- static get identifiersFields() {
428
- return ['id', 'userId'];
429
- }
337
+ var context = null;
338
+ function errorContext(cb) {
339
+ if (config.useDeprecatedSynchronousErrorHandling) {
340
+ var isRoot = !context;
341
+ if (isRoot) {
342
+ context = { errorThrown: false, error: null };
343
+ }
344
+ cb();
345
+ if (isRoot) {
346
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
347
+ context = null;
348
+ if (errorThrown) {
349
+ throw error;
350
+ }
351
+ }
352
+ }
353
+ else {
354
+ cb();
355
+ }
430
356
  }
431
357
 
432
- exports.AccessoryImportances = void 0;
433
- (function (AccessoryImportances) {
434
- AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
435
- AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
436
- AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
437
- })(exports.AccessoryImportances || (exports.AccessoryImportances = {}));
438
-
439
- exports.Area = void 0;
440
- (function (Area) {
441
- Area["GP"] = "Geral";
442
- Area["CRM"] = "CRM";
443
- Area["MediaProd"] = "Media Production";
444
- Area["Tech"] = "Tecnologia";
445
- Area["Transactional"] = "Transacional";
446
- Area["Operations"] = "Opera\u00E7\u00F5es";
447
- Area["Sales"] = "Comercial";
448
- Area["Finantial"] = "Financeiro";
449
- Area["HR"] = "RH";
450
- })(exports.Area || (exports.Area = {}));
451
-
452
- exports.BeardProblems = void 0;
453
- (function (BeardProblems) {
454
- BeardProblems["NO_PROBLEMS"] = "Sem problemas";
455
- BeardProblems["DRY"] = "Barba Seca";
456
- BeardProblems["OILY"] = "Barba Oleaosa";
457
- BeardProblems["DANCRUFF"] = "Barba com Caspa";
458
- BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
459
- BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
460
- BeardProblems["SPARSE_BEARD"] = "Barba Rala";
461
- })(exports.BeardProblems || (exports.BeardProblems = {}));
462
-
463
- exports.BeardSizes = void 0;
464
- (function (BeardSizes) {
465
- BeardSizes["BIG"] = "Grande";
466
- BeardSizes["MEDIUM"] = "M\u00E9dia";
467
- BeardSizes["SHORT"] = "Curta";
468
- BeardSizes["MUSTACHE"] = "Bigode";
469
- BeardSizes["NOTHING"] = "Sem Barba";
470
- })(exports.BeardSizes || (exports.BeardSizes = {}));
471
-
472
- exports.BeautyProductImportances = void 0;
473
- (function (BeautyProductImportances) {
474
- BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
475
- BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
476
- BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
477
- BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
478
- })(exports.BeautyProductImportances || (exports.BeautyProductImportances = {}));
479
-
480
- exports.BodyProblems = void 0;
481
- (function (BodyProblems) {
482
- BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
483
- BodyProblems["FLACCIDITY"] = "Flacidez";
484
- BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
485
- BodyProblems["STRETCH_MARKS"] = "Estrias";
486
- BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
487
- BodyProblems["DRY_SKIN"] = "Pele Seca";
488
- BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
489
- BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
490
- BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
491
- })(exports.BodyProblems || (exports.BodyProblems = {}));
492
-
493
- exports.BodyShapes = void 0;
494
- (function (BodyShapes) {
495
- BodyShapes["LEAN"] = "Magro";
496
- BodyShapes["REGULAR"] = "Regular";
497
- BodyShapes["OVERWEIGHT"] = "Acima do Peso";
498
- BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
499
- BodyShapes["MUSCULAR"] = "Musculoso";
500
- })(exports.BodyShapes || (exports.BodyShapes = {}));
358
+ var Subscriber = (function (_super) {
359
+ tslib.__extends(Subscriber, _super);
360
+ function Subscriber(destination) {
361
+ var _this = _super.call(this) || this;
362
+ _this.isStopped = false;
363
+ if (destination) {
364
+ _this.destination = destination;
365
+ if (isSubscription(destination)) {
366
+ destination.add(_this);
367
+ }
368
+ }
369
+ else {
370
+ _this.destination = EMPTY_OBSERVER;
371
+ }
372
+ return _this;
373
+ }
374
+ Subscriber.create = function (next, error, complete) {
375
+ return new SafeSubscriber(next, error, complete);
376
+ };
377
+ Subscriber.prototype.next = function (value) {
378
+ if (this.isStopped) ;
379
+ else {
380
+ this._next(value);
381
+ }
382
+ };
383
+ Subscriber.prototype.error = function (err) {
384
+ if (this.isStopped) ;
385
+ else {
386
+ this.isStopped = true;
387
+ this._error(err);
388
+ }
389
+ };
390
+ Subscriber.prototype.complete = function () {
391
+ if (this.isStopped) ;
392
+ else {
393
+ this.isStopped = true;
394
+ this._complete();
395
+ }
396
+ };
397
+ Subscriber.prototype.unsubscribe = function () {
398
+ if (!this.closed) {
399
+ this.isStopped = true;
400
+ _super.prototype.unsubscribe.call(this);
401
+ this.destination = null;
402
+ }
403
+ };
404
+ Subscriber.prototype._next = function (value) {
405
+ this.destination.next(value);
406
+ };
407
+ Subscriber.prototype._error = function (err) {
408
+ try {
409
+ this.destination.error(err);
410
+ }
411
+ finally {
412
+ this.unsubscribe();
413
+ }
414
+ };
415
+ Subscriber.prototype._complete = function () {
416
+ try {
417
+ this.destination.complete();
418
+ }
419
+ finally {
420
+ this.unsubscribe();
421
+ }
422
+ };
423
+ return Subscriber;
424
+ }(Subscription$1));
425
+ var _bind = Function.prototype.bind;
426
+ function bind(fn, thisArg) {
427
+ return _bind.call(fn, thisArg);
428
+ }
429
+ var ConsumerObserver = (function () {
430
+ function ConsumerObserver(partialObserver) {
431
+ this.partialObserver = partialObserver;
432
+ }
433
+ ConsumerObserver.prototype.next = function (value) {
434
+ var partialObserver = this.partialObserver;
435
+ if (partialObserver.next) {
436
+ try {
437
+ partialObserver.next(value);
438
+ }
439
+ catch (error) {
440
+ handleUnhandledError(error);
441
+ }
442
+ }
443
+ };
444
+ ConsumerObserver.prototype.error = function (err) {
445
+ var partialObserver = this.partialObserver;
446
+ if (partialObserver.error) {
447
+ try {
448
+ partialObserver.error(err);
449
+ }
450
+ catch (error) {
451
+ handleUnhandledError(error);
452
+ }
453
+ }
454
+ else {
455
+ handleUnhandledError(err);
456
+ }
457
+ };
458
+ ConsumerObserver.prototype.complete = function () {
459
+ var partialObserver = this.partialObserver;
460
+ if (partialObserver.complete) {
461
+ try {
462
+ partialObserver.complete();
463
+ }
464
+ catch (error) {
465
+ handleUnhandledError(error);
466
+ }
467
+ }
468
+ };
469
+ return ConsumerObserver;
470
+ }());
471
+ var SafeSubscriber = (function (_super) {
472
+ tslib.__extends(SafeSubscriber, _super);
473
+ function SafeSubscriber(observerOrNext, error, complete) {
474
+ var _this = _super.call(this) || this;
475
+ var partialObserver;
476
+ if (isFunction(observerOrNext) || !observerOrNext) {
477
+ partialObserver = {
478
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
479
+ error: error !== null && error !== void 0 ? error : undefined,
480
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
481
+ };
482
+ }
483
+ else {
484
+ var context_1;
485
+ if (_this && config.useDeprecatedNextContext) {
486
+ context_1 = Object.create(observerOrNext);
487
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
488
+ partialObserver = {
489
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
490
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
491
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
492
+ };
493
+ }
494
+ else {
495
+ partialObserver = observerOrNext;
496
+ }
497
+ }
498
+ _this.destination = new ConsumerObserver(partialObserver);
499
+ return _this;
500
+ }
501
+ return SafeSubscriber;
502
+ }(Subscriber));
503
+ function handleUnhandledError(error) {
504
+ {
505
+ reportUnhandledError(error);
506
+ }
507
+ }
508
+ function defaultErrorHandler(err) {
509
+ throw err;
510
+ }
511
+ var EMPTY_OBSERVER = {
512
+ closed: true,
513
+ next: noop,
514
+ error: defaultErrorHandler,
515
+ complete: noop,
516
+ };
501
517
 
502
- exports.BodyTattoos = void 0;
503
- (function (BodyTattoos) {
504
- BodyTattoos["NONE"] = "Nenhuma";
505
- BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
506
- BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
507
- })(exports.BodyTattoos || (exports.BodyTattoos = {}));
518
+ var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
508
519
 
509
- exports.FaceSkinOilinesses = void 0;
510
- (function (FaceSkinOilinesses) {
511
- FaceSkinOilinesses["DRY"] = "Seca";
512
- FaceSkinOilinesses["OILY"] = "Oleaosa";
513
- FaceSkinOilinesses["MIXED"] = "Mista";
514
- FaceSkinOilinesses["NORMAL"] = "Normal";
515
- FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
516
- })(exports.FaceSkinOilinesses || (exports.FaceSkinOilinesses = {}));
520
+ function identity(x) {
521
+ return x;
522
+ }
517
523
 
518
- exports.FaceSkinProblems = void 0;
519
- (function (FaceSkinProblems) {
520
- FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
521
- FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
522
- FaceSkinProblems["WRINKLES"] = "Rugas";
523
- FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
524
- FaceSkinProblems["STAINS"] = "Manchas";
525
- FaceSkinProblems["FRECKLES"] = "Sardas";
526
- FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
527
- FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
528
- })(exports.FaceSkinProblems || (exports.FaceSkinProblems = {}));
524
+ function pipeFromArray(fns) {
525
+ if (fns.length === 0) {
526
+ return identity;
527
+ }
528
+ if (fns.length === 1) {
529
+ return fns[0];
530
+ }
531
+ return function piped(input) {
532
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
533
+ };
534
+ }
529
535
 
530
- exports.FaceSkinTones = void 0;
531
- (function (FaceSkinTones) {
532
- FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
533
- FaceSkinTones["CLEAR"] = "Clara";
534
- FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
535
- FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
536
- FaceSkinTones["DARK"] = "Escura";
537
- FaceSkinTones["VERY_DARK"] = "Muito Escura";
538
- })(exports.FaceSkinTones || (exports.FaceSkinTones = {}));
539
-
540
- exports.FamilyIncomes = void 0;
541
- (function (FamilyIncomes) {
542
- FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
543
- FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
544
- FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
545
- FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
546
- FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
547
- FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
548
- })(exports.FamilyIncomes || (exports.FamilyIncomes = {}));
549
-
550
- exports.FragranceImportances = void 0;
551
- (function (FragranceImportances) {
552
- FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
553
- FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
554
- FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
555
- })(exports.FragranceImportances || (exports.FragranceImportances = {}));
556
-
557
- exports.HairColors = void 0;
558
- (function (HairColors) {
559
- HairColors["BLACK"] = "Preto";
560
- HairColors["DARK_BROWN"] = "Castanho Escuro";
561
- HairColors["LIGHT_BROWN"] = "Castanho Claro";
562
- HairColors["DARK_BLONDE"] = "Loiro Escuro";
563
- HairColors["LIGHT_BLONDE"] = "Loiro Claro";
564
- HairColors["WHITE_GRAY"] = "Branco/Grisalho";
565
- HairColors["REDHEAD"] = "Ruivo";
566
- HairColors["OTHER"] = "RuiOutroo";
567
- })(exports.HairColors || (exports.HairColors = {}));
568
-
569
- exports.HairProblems = void 0;
570
- (function (HairProblems) {
571
- HairProblems["NO_PROBLEMS"] = "Sem problemas";
572
- HairProblems["DANCRUFF"] = "Caspa";
573
- HairProblems["LOSS"] = "Queda";
574
- HairProblems["OILY"] = "Oleosidade";
575
- HairProblems["DRYNESS"] = "Ressecamento";
576
- HairProblems["CHEMICAL"] = "Quimica";
577
- HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
578
- HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
579
- })(exports.HairProblems || (exports.HairProblems = {}));
580
-
581
- exports.HairStrands = void 0;
582
- (function (HairStrands) {
583
- HairStrands["NORMAL"] = "Fio Normal";
584
- HairStrands["DRY"] = "Fio Seco";
585
- HairStrands["OILY"] = "Fio Oleoso";
586
- HairStrands["MIXED"] = "Fio Misto";
587
- HairStrands["FINE"] = "Fio Fino";
588
- HairStrands["THICK"] = "Fio Grosso";
589
- })(exports.HairStrands || (exports.HairStrands = {}));
590
-
591
- exports.HairTypes = void 0;
592
- (function (HairTypes) {
593
- HairTypes["Smooth"] = "Liso";
594
- HairTypes["WAVY"] = "Ondulado";
595
- HairTypes["CURLY"] = "Cacheado";
596
- HairTypes["FRIZZY"] = "Crespo";
597
- HairTypes["BALD"] = "Sou careca";
598
- })(exports.HairTypes || (exports.HairTypes = {}));
599
-
600
- exports.OfficePosition = void 0;
601
- (function (OfficePosition) {
602
- OfficePosition["Intern"] = "Estagi\u00E1rio";
603
- OfficePosition["Analyst"] = "Analista";
604
- OfficePosition["Manager"] = "Gerente";
605
- OfficePosition["Director"] = "Diretor";
606
- })(exports.OfficePosition || (exports.OfficePosition = {}));
607
-
608
- exports.PersonTypes = void 0;
609
- (function (PersonTypes) {
610
- PersonTypes["GLAMGIRL"] = "glamgirl";
611
- PersonTypes["BFLU"] = "bflu";
612
- PersonTypes["NONE"] = "none";
613
- })(exports.PersonTypes || (exports.PersonTypes = {}));
614
-
615
- exports.ProductSpents = void 0;
616
- (function (ProductSpents) {
617
- ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
618
- ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
619
- ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
620
- ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
621
- ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
622
- ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
623
- })(exports.ProductSpents || (exports.ProductSpents = {}));
624
-
625
- exports.UserType = void 0;
626
- (function (UserType) {
627
- UserType["B2C"] = "Cliente Transacional";
628
- UserType["GlamGirl"] = "Glamgirl";
629
- UserType["MensBoy"] = "Mensboy";
630
- UserType["B2B"] = "Company";
631
- UserType["Collaborator"] = "Funcion\u00E1rio";
632
- UserType["Influencer"] = "Influencer";
633
- })(exports.UserType || (exports.UserType = {}));
634
-
635
- class Lead extends BaseModel {
636
- static get identifiersFields() {
637
- return ['id'];
638
- }
536
+ var Observable = (function () {
537
+ function Observable(subscribe) {
538
+ if (subscribe) {
539
+ this._subscribe = subscribe;
540
+ }
541
+ }
542
+ Observable.prototype.lift = function (operator) {
543
+ var observable = new Observable();
544
+ observable.source = this;
545
+ observable.operator = operator;
546
+ return observable;
547
+ };
548
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
549
+ var _this = this;
550
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
551
+ errorContext(function () {
552
+ var _a = _this, operator = _a.operator, source = _a.source;
553
+ subscriber.add(operator
554
+ ?
555
+ operator.call(subscriber, source)
556
+ : source
557
+ ?
558
+ _this._subscribe(subscriber)
559
+ :
560
+ _this._trySubscribe(subscriber));
561
+ });
562
+ return subscriber;
563
+ };
564
+ Observable.prototype._trySubscribe = function (sink) {
565
+ try {
566
+ return this._subscribe(sink);
567
+ }
568
+ catch (err) {
569
+ sink.error(err);
570
+ }
571
+ };
572
+ Observable.prototype.forEach = function (next, promiseCtor) {
573
+ var _this = this;
574
+ promiseCtor = getPromiseCtor(promiseCtor);
575
+ return new promiseCtor(function (resolve, reject) {
576
+ var subscriber = new SafeSubscriber({
577
+ next: function (value) {
578
+ try {
579
+ next(value);
580
+ }
581
+ catch (err) {
582
+ reject(err);
583
+ subscriber.unsubscribe();
584
+ }
585
+ },
586
+ error: reject,
587
+ complete: resolve,
588
+ });
589
+ _this.subscribe(subscriber);
590
+ });
591
+ };
592
+ Observable.prototype._subscribe = function (subscriber) {
593
+ var _a;
594
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
595
+ };
596
+ Observable.prototype[observable] = function () {
597
+ return this;
598
+ };
599
+ Observable.prototype.pipe = function () {
600
+ var operations = [];
601
+ for (var _i = 0; _i < arguments.length; _i++) {
602
+ operations[_i] = arguments[_i];
603
+ }
604
+ return pipeFromArray(operations)(this);
605
+ };
606
+ Observable.prototype.toPromise = function (promiseCtor) {
607
+ var _this = this;
608
+ promiseCtor = getPromiseCtor(promiseCtor);
609
+ return new promiseCtor(function (resolve, reject) {
610
+ var value;
611
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
612
+ });
613
+ };
614
+ Observable.create = function (subscribe) {
615
+ return new Observable(subscribe);
616
+ };
617
+ return Observable;
618
+ }());
619
+ function getPromiseCtor(promiseCtor) {
620
+ var _a;
621
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
639
622
  }
640
-
641
- class Edition extends BaseModel {
642
- static get identifiersFields() {
643
- return ['id', 'subscriptionId'];
644
- }
623
+ function isObserver(value) {
624
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
645
625
  }
646
-
647
- exports.BillingStatus = void 0;
648
- (function (BillingStatus) {
649
- BillingStatus["PAYED"] = "PAGO";
650
- })(exports.BillingStatus || (exports.BillingStatus = {}));
651
-
652
- exports.EditionStatus = void 0;
653
- (function (EditionStatus) {
654
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
655
- EditionStatus["SHIPPED"] = "Enviado";
656
- })(exports.EditionStatus || (exports.EditionStatus = {}));
657
-
658
- exports.PaymentType = void 0;
659
- (function (PaymentType) {
660
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
661
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
662
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
663
- })(exports.PaymentType || (exports.PaymentType = {}));
664
-
665
- exports.Plans = void 0;
666
- (function (Plans) {
667
- Plans["SELECT"] = "SELECT";
668
- Plans["PRIME"] = "PRIME";
669
- Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
670
- Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
671
- })(exports.Plans || (exports.Plans = {}));
672
-
673
- exports.Status = void 0;
674
- (function (Status) {
675
- Status["ACTIVE"] = "active";
676
- Status["CANCELLED"] = "Cancelado";
677
- })(exports.Status || (exports.Status = {}));
678
-
679
- class PaymentTransaction extends BaseModel {
626
+ function isSubscriber(value) {
627
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
680
628
  }
681
629
 
682
- class Payment extends BaseModel {
683
- static get identifiersFields() {
684
- return ['id'];
685
- }
686
- }
687
- tslib.__decorate([
688
- classTransformer.Type(() => PaymentTransaction),
689
- tslib.__metadata("design:type", PaymentTransaction)
690
- ], Payment.prototype, "transaction", void 0);
630
+ var ObjectUnsubscribedError = createErrorClass(function (_super) {
631
+ return function ObjectUnsubscribedErrorImpl() {
632
+ _super(this);
633
+ this.name = 'ObjectUnsubscribedError';
634
+ this.message = 'object unsubscribed';
635
+ };
636
+ });
691
637
 
692
- class SubscriptionPayment extends BaseModel {
693
- static get identifiersFields() {
694
- return ['id', 'subscriptionId'];
695
- }
696
- }
697
- tslib.__decorate([
698
- classTransformer.Type(() => Payment),
699
- tslib.__metadata("design:type", Payment)
700
- ], SubscriptionPayment.prototype, "payment", void 0);
701
-
702
- function isFunction(value) {
703
- return typeof value === 'function';
704
- }
705
-
706
- function createErrorClass(createImpl) {
707
- var _super = function (instance) {
708
- Error.call(instance);
709
- instance.stack = new Error().stack;
638
+ var Subject = (function (_super) {
639
+ tslib.__extends(Subject, _super);
640
+ function Subject() {
641
+ var _this = _super.call(this) || this;
642
+ _this.closed = false;
643
+ _this.currentObservers = null;
644
+ _this.observers = [];
645
+ _this.isStopped = false;
646
+ _this.hasError = false;
647
+ _this.thrownError = null;
648
+ return _this;
649
+ }
650
+ Subject.prototype.lift = function (operator) {
651
+ var subject = new AnonymousSubject(this, this);
652
+ subject.operator = operator;
653
+ return subject;
710
654
  };
711
- var ctorFunc = createImpl(_super);
712
- ctorFunc.prototype = Object.create(Error.prototype);
713
- ctorFunc.prototype.constructor = ctorFunc;
714
- return ctorFunc;
715
- }
716
-
717
- var UnsubscriptionError = createErrorClass(function (_super) {
718
- return function UnsubscriptionErrorImpl(errors) {
719
- _super(this);
720
- this.message = errors
721
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
722
- : '';
723
- this.name = 'UnsubscriptionError';
724
- this.errors = errors;
655
+ Subject.prototype._throwIfClosed = function () {
656
+ if (this.closed) {
657
+ throw new ObjectUnsubscribedError();
658
+ }
725
659
  };
726
- });
727
-
728
- function arrRemove(arr, item) {
729
- if (arr) {
730
- var index = arr.indexOf(item);
731
- 0 <= index && arr.splice(index, 1);
732
- }
733
- }
734
-
735
- var Subscription$1 = (function () {
736
- function Subscription(initialTeardown) {
737
- this.initialTeardown = initialTeardown;
738
- this.closed = false;
739
- this._parentage = null;
740
- this._finalizers = null;
741
- }
742
- Subscription.prototype.unsubscribe = function () {
743
- var e_1, _a, e_2, _b;
744
- var errors;
745
- if (!this.closed) {
746
- this.closed = true;
747
- var _parentage = this._parentage;
748
- if (_parentage) {
749
- this._parentage = null;
750
- if (Array.isArray(_parentage)) {
751
- try {
752
- for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
753
- var parent_1 = _parentage_1_1.value;
754
- parent_1.remove(this);
755
- }
756
- }
757
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
758
- finally {
759
- try {
760
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
761
- }
762
- finally { if (e_1) throw e_1.error; }
763
- }
764
- }
765
- else {
766
- _parentage.remove(this);
767
- }
768
- }
769
- var initialFinalizer = this.initialTeardown;
770
- if (isFunction(initialFinalizer)) {
771
- try {
772
- initialFinalizer();
773
- }
774
- catch (e) {
775
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
660
+ Subject.prototype.next = function (value) {
661
+ var _this = this;
662
+ errorContext(function () {
663
+ var e_1, _a;
664
+ _this._throwIfClosed();
665
+ if (!_this.isStopped) {
666
+ if (!_this.currentObservers) {
667
+ _this.currentObservers = Array.from(_this.observers);
776
668
  }
777
- }
778
- var _finalizers = this._finalizers;
779
- if (_finalizers) {
780
- this._finalizers = null;
781
669
  try {
782
- for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
783
- var finalizer = _finalizers_1_1.value;
784
- try {
785
- execFinalizer(finalizer);
786
- }
787
- catch (err) {
788
- errors = errors !== null && errors !== void 0 ? errors : [];
789
- if (err instanceof UnsubscriptionError) {
790
- errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
791
- }
792
- else {
793
- errors.push(err);
794
- }
795
- }
670
+ for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
671
+ var observer = _c.value;
672
+ observer.next(value);
796
673
  }
797
674
  }
798
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
675
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
799
676
  finally {
800
677
  try {
801
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
678
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
802
679
  }
803
- finally { if (e_2) throw e_2.error; }
680
+ finally { if (e_1) throw e_1.error; }
804
681
  }
805
682
  }
806
- if (errors) {
807
- throw new UnsubscriptionError(errors);
808
- }
809
- }
683
+ });
810
684
  };
811
- Subscription.prototype.add = function (teardown) {
812
- var _a;
813
- if (teardown && teardown !== this) {
814
- if (this.closed) {
815
- execFinalizer(teardown);
685
+ Subject.prototype.error = function (err) {
686
+ var _this = this;
687
+ errorContext(function () {
688
+ _this._throwIfClosed();
689
+ if (!_this.isStopped) {
690
+ _this.hasError = _this.isStopped = true;
691
+ _this.thrownError = err;
692
+ var observers = _this.observers;
693
+ while (observers.length) {
694
+ observers.shift().error(err);
695
+ }
816
696
  }
817
- else {
818
- if (teardown instanceof Subscription) {
819
- if (teardown.closed || teardown._hasParent(this)) {
820
- return;
821
- }
822
- teardown._addParent(this);
697
+ });
698
+ };
699
+ Subject.prototype.complete = function () {
700
+ var _this = this;
701
+ errorContext(function () {
702
+ _this._throwIfClosed();
703
+ if (!_this.isStopped) {
704
+ _this.isStopped = true;
705
+ var observers = _this.observers;
706
+ while (observers.length) {
707
+ observers.shift().complete();
823
708
  }
824
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
825
709
  }
826
- }
710
+ });
827
711
  };
828
- Subscription.prototype._hasParent = function (parent) {
829
- var _parentage = this._parentage;
830
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
712
+ Subject.prototype.unsubscribe = function () {
713
+ this.isStopped = this.closed = true;
714
+ this.observers = this.currentObservers = null;
831
715
  };
832
- Subscription.prototype._addParent = function (parent) {
833
- var _parentage = this._parentage;
834
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
716
+ Object.defineProperty(Subject.prototype, "observed", {
717
+ get: function () {
718
+ var _a;
719
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
720
+ },
721
+ enumerable: false,
722
+ configurable: true
723
+ });
724
+ Subject.prototype._trySubscribe = function (subscriber) {
725
+ this._throwIfClosed();
726
+ return _super.prototype._trySubscribe.call(this, subscriber);
835
727
  };
836
- Subscription.prototype._removeParent = function (parent) {
837
- var _parentage = this._parentage;
838
- if (_parentage === parent) {
839
- this._parentage = null;
840
- }
841
- else if (Array.isArray(_parentage)) {
842
- arrRemove(_parentage, parent);
728
+ Subject.prototype._subscribe = function (subscriber) {
729
+ this._throwIfClosed();
730
+ this._checkFinalizedStatuses(subscriber);
731
+ return this._innerSubscribe(subscriber);
732
+ };
733
+ Subject.prototype._innerSubscribe = function (subscriber) {
734
+ var _this = this;
735
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
736
+ if (hasError || isStopped) {
737
+ return EMPTY_SUBSCRIPTION;
843
738
  }
739
+ this.currentObservers = null;
740
+ observers.push(subscriber);
741
+ return new Subscription$1(function () {
742
+ _this.currentObservers = null;
743
+ arrRemove(observers, subscriber);
744
+ });
844
745
  };
845
- Subscription.prototype.remove = function (teardown) {
846
- var _finalizers = this._finalizers;
847
- _finalizers && arrRemove(_finalizers, teardown);
848
- if (teardown instanceof Subscription) {
849
- teardown._removeParent(this);
746
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
747
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
748
+ if (hasError) {
749
+ subscriber.error(thrownError);
750
+ }
751
+ else if (isStopped) {
752
+ subscriber.complete();
850
753
  }
851
754
  };
852
- Subscription.EMPTY = (function () {
853
- var empty = new Subscription();
854
- empty.closed = true;
855
- return empty;
856
- })();
857
- return Subscription;
858
- }());
859
- var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
860
- function isSubscription(value) {
861
- return (value instanceof Subscription$1 ||
862
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
863
- }
864
- function execFinalizer(finalizer) {
865
- if (isFunction(finalizer)) {
866
- finalizer();
867
- }
868
- else {
869
- finalizer.unsubscribe();
870
- }
871
- }
872
-
873
- var config = {
874
- onUnhandledError: null,
875
- onStoppedNotification: null,
876
- Promise: undefined,
877
- useDeprecatedSynchronousErrorHandling: false,
878
- useDeprecatedNextContext: false,
879
- };
880
-
881
- var timeoutProvider = {
882
- setTimeout: function (handler, timeout) {
883
- var args = [];
884
- for (var _i = 2; _i < arguments.length; _i++) {
885
- args[_i - 2] = arguments[_i];
886
- }
887
- var delegate = timeoutProvider.delegate;
888
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
889
- return delegate.setTimeout.apply(delegate, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
890
- }
891
- return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
892
- },
893
- clearTimeout: function (handle) {
894
- var delegate = timeoutProvider.delegate;
895
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
896
- },
897
- delegate: undefined,
898
- };
899
-
900
- function reportUnhandledError(err) {
901
- timeoutProvider.setTimeout(function () {
902
- {
903
- throw err;
904
- }
905
- });
906
- }
907
-
908
- function noop() { }
909
-
910
- var context = null;
911
- function errorContext(cb) {
912
- if (config.useDeprecatedSynchronousErrorHandling) {
913
- var isRoot = !context;
914
- if (isRoot) {
915
- context = { errorThrown: false, error: null };
916
- }
917
- cb();
918
- if (isRoot) {
919
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
920
- context = null;
921
- if (errorThrown) {
922
- throw error;
923
- }
924
- }
925
- }
926
- else {
927
- cb();
928
- }
929
- }
930
-
931
- var Subscriber = (function (_super) {
932
- tslib.__extends(Subscriber, _super);
933
- function Subscriber(destination) {
755
+ Subject.prototype.asObservable = function () {
756
+ var observable = new Observable();
757
+ observable.source = this;
758
+ return observable;
759
+ };
760
+ Subject.create = function (destination, source) {
761
+ return new AnonymousSubject(destination, source);
762
+ };
763
+ return Subject;
764
+ }(Observable));
765
+ var AnonymousSubject = (function (_super) {
766
+ tslib.__extends(AnonymousSubject, _super);
767
+ function AnonymousSubject(destination, source) {
934
768
  var _this = _super.call(this) || this;
935
- _this.isStopped = false;
936
- if (destination) {
937
- _this.destination = destination;
938
- if (isSubscription(destination)) {
939
- destination.add(_this);
940
- }
941
- }
942
- else {
943
- _this.destination = EMPTY_OBSERVER;
944
- }
769
+ _this.destination = destination;
770
+ _this.source = source;
945
771
  return _this;
946
772
  }
947
- Subscriber.create = function (next, error, complete) {
948
- return new SafeSubscriber(next, error, complete);
949
- };
950
- Subscriber.prototype.next = function (value) {
951
- if (this.isStopped) ;
952
- else {
953
- this._next(value);
954
- }
955
- };
956
- Subscriber.prototype.error = function (err) {
957
- if (this.isStopped) ;
958
- else {
959
- this.isStopped = true;
960
- this._error(err);
961
- }
962
- };
963
- Subscriber.prototype.complete = function () {
964
- if (this.isStopped) ;
965
- else {
966
- this.isStopped = true;
967
- this._complete();
968
- }
969
- };
970
- Subscriber.prototype.unsubscribe = function () {
971
- if (!this.closed) {
972
- this.isStopped = true;
973
- _super.prototype.unsubscribe.call(this);
974
- this.destination = null;
975
- }
976
- };
977
- Subscriber.prototype._next = function (value) {
978
- this.destination.next(value);
979
- };
980
- Subscriber.prototype._error = function (err) {
981
- try {
982
- this.destination.error(err);
983
- }
984
- finally {
985
- this.unsubscribe();
986
- }
987
- };
988
- Subscriber.prototype._complete = function () {
989
- try {
990
- this.destination.complete();
991
- }
992
- finally {
993
- this.unsubscribe();
994
- }
773
+ AnonymousSubject.prototype.next = function (value) {
774
+ var _a, _b;
775
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
995
776
  };
996
- return Subscriber;
997
- }(Subscription$1));
998
- var _bind = Function.prototype.bind;
999
- function bind(fn, thisArg) {
1000
- return _bind.call(fn, thisArg);
1001
- }
1002
- var ConsumerObserver = (function () {
1003
- function ConsumerObserver(partialObserver) {
1004
- this.partialObserver = partialObserver;
1005
- }
1006
- ConsumerObserver.prototype.next = function (value) {
1007
- var partialObserver = this.partialObserver;
1008
- if (partialObserver.next) {
1009
- try {
1010
- partialObserver.next(value);
1011
- }
1012
- catch (error) {
1013
- handleUnhandledError(error);
1014
- }
1015
- }
777
+ AnonymousSubject.prototype.error = function (err) {
778
+ var _a, _b;
779
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1016
780
  };
1017
- ConsumerObserver.prototype.error = function (err) {
1018
- var partialObserver = this.partialObserver;
1019
- if (partialObserver.error) {
1020
- try {
1021
- partialObserver.error(err);
1022
- }
1023
- catch (error) {
1024
- handleUnhandledError(error);
1025
- }
1026
- }
1027
- else {
1028
- handleUnhandledError(err);
1029
- }
781
+ AnonymousSubject.prototype.complete = function () {
782
+ var _a, _b;
783
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1030
784
  };
1031
- ConsumerObserver.prototype.complete = function () {
1032
- var partialObserver = this.partialObserver;
1033
- if (partialObserver.complete) {
1034
- try {
1035
- partialObserver.complete();
1036
- }
1037
- catch (error) {
1038
- handleUnhandledError(error);
1039
- }
1040
- }
785
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
786
+ var _a, _b;
787
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1041
788
  };
1042
- return ConsumerObserver;
1043
- }());
1044
- var SafeSubscriber = (function (_super) {
1045
- tslib.__extends(SafeSubscriber, _super);
1046
- function SafeSubscriber(observerOrNext, error, complete) {
1047
- var _this = _super.call(this) || this;
1048
- var partialObserver;
1049
- if (isFunction(observerOrNext) || !observerOrNext) {
1050
- partialObserver = {
1051
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
1052
- error: error !== null && error !== void 0 ? error : undefined,
1053
- complete: complete !== null && complete !== void 0 ? complete : undefined,
1054
- };
1055
- }
1056
- else {
1057
- var context_1;
1058
- if (_this && config.useDeprecatedNextContext) {
1059
- context_1 = Object.create(observerOrNext);
1060
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
1061
- partialObserver = {
1062
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
1063
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
1064
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
1065
- };
1066
- }
1067
- else {
1068
- partialObserver = observerOrNext;
1069
- }
1070
- }
1071
- _this.destination = new ConsumerObserver(partialObserver);
1072
- return _this;
1073
- }
1074
- return SafeSubscriber;
1075
- }(Subscriber));
1076
- function handleUnhandledError(error) {
1077
- {
1078
- reportUnhandledError(error);
1079
- }
1080
- }
1081
- function defaultErrorHandler(err) {
1082
- throw err;
1083
- }
1084
- var EMPTY_OBSERVER = {
1085
- closed: true,
1086
- next: noop,
1087
- error: defaultErrorHandler,
1088
- complete: noop,
1089
- };
1090
-
1091
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
1092
-
1093
- function identity(x) {
1094
- return x;
1095
- }
789
+ return AnonymousSubject;
790
+ }(Subject));
1096
791
 
1097
- function pipeFromArray(fns) {
1098
- if (fns.length === 0) {
1099
- return identity;
1100
- }
1101
- if (fns.length === 1) {
1102
- return fns[0];
1103
- }
1104
- return function piped(input) {
1105
- return fns.reduce(function (prev, fn) { return fn(prev); }, input);
1106
- };
1107
- }
792
+ exports.DebugNamespaces = void 0;
793
+ (function (DebugNamespaces) {
794
+ DebugNamespaces["ROOT"] = "connect";
795
+ DebugNamespaces["TRACE"] = "trace";
796
+ DebugNamespaces["ERROR"] = "error";
797
+ })(exports.DebugNamespaces || (exports.DebugNamespaces = {}));
798
+ const Logger = debug.debug(exports.DebugNamespaces.ROOT);
1108
799
 
1109
- var Observable = (function () {
1110
- function Observable(subscribe) {
1111
- if (subscribe) {
1112
- this._subscribe = subscribe;
1113
- }
1114
- }
1115
- Observable.prototype.lift = function (operator) {
1116
- var observable = new Observable();
1117
- observable.source = this;
1118
- observable.operator = operator;
1119
- return observable;
1120
- };
1121
- Observable.prototype.subscribe = function (observerOrNext, error, complete) {
1122
- var _this = this;
1123
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
1124
- errorContext(function () {
1125
- var _a = _this, operator = _a.operator, source = _a.source;
1126
- subscriber.add(operator
1127
- ?
1128
- operator.call(subscriber, source)
1129
- : source
1130
- ?
1131
- _this._subscribe(subscriber)
1132
- :
1133
- _this._trySubscribe(subscriber));
1134
- });
1135
- return subscriber;
1136
- };
1137
- Observable.prototype._trySubscribe = function (sink) {
1138
- try {
1139
- return this._subscribe(sink);
1140
- }
1141
- catch (err) {
1142
- sink.error(err);
1143
- }
1144
- };
1145
- Observable.prototype.forEach = function (next, promiseCtor) {
1146
- var _this = this;
1147
- promiseCtor = getPromiseCtor(promiseCtor);
1148
- return new promiseCtor(function (resolve, reject) {
1149
- var subscriber = new SafeSubscriber({
1150
- next: function (value) {
1151
- try {
1152
- next(value);
1153
- }
1154
- catch (err) {
1155
- reject(err);
1156
- subscriber.unsubscribe();
1157
- }
1158
- },
1159
- error: reject,
1160
- complete: resolve,
1161
- });
1162
- _this.subscribe(subscriber);
1163
- });
1164
- };
1165
- Observable.prototype._subscribe = function (subscriber) {
1166
- var _a;
1167
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1168
- };
1169
- Observable.prototype[observable] = function () {
1170
- return this;
1171
- };
1172
- Observable.prototype.pipe = function () {
1173
- var operations = [];
1174
- for (var _i = 0; _i < arguments.length; _i++) {
1175
- operations[_i] = arguments[_i];
1176
- }
1177
- return pipeFromArray(operations)(this);
1178
- };
1179
- Observable.prototype.toPromise = function (promiseCtor) {
1180
- var _this = this;
1181
- promiseCtor = getPromiseCtor(promiseCtor);
1182
- return new promiseCtor(function (resolve, reject) {
1183
- var value;
1184
- _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
1185
- });
1186
- };
1187
- Observable.create = function (subscribe) {
1188
- return new Observable(subscribe);
1189
- };
1190
- return Observable;
1191
- }());
1192
- function getPromiseCtor(promiseCtor) {
1193
- var _a;
1194
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
1195
- }
1196
- function isObserver(value) {
1197
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1198
- }
1199
- function isSubscriber(value) {
1200
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
1201
- }
1202
-
1203
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
1204
- return function ObjectUnsubscribedErrorImpl() {
1205
- _super(this);
1206
- this.name = 'ObjectUnsubscribedError';
1207
- this.message = 'object unsubscribed';
1208
- };
1209
- });
1210
-
1211
- var Subject = (function (_super) {
1212
- tslib.__extends(Subject, _super);
1213
- function Subject() {
1214
- var _this = _super.call(this) || this;
1215
- _this.closed = false;
1216
- _this.currentObservers = null;
1217
- _this.observers = [];
1218
- _this.isStopped = false;
1219
- _this.hasError = false;
1220
- _this.thrownError = null;
1221
- return _this;
1222
- }
1223
- Subject.prototype.lift = function (operator) {
1224
- var subject = new AnonymousSubject(this, this);
1225
- subject.operator = operator;
1226
- return subject;
1227
- };
1228
- Subject.prototype._throwIfClosed = function () {
1229
- if (this.closed) {
1230
- throw new ObjectUnsubscribedError();
1231
- }
1232
- };
1233
- Subject.prototype.next = function (value) {
1234
- var _this = this;
1235
- errorContext(function () {
1236
- var e_1, _a;
1237
- _this._throwIfClosed();
1238
- if (!_this.isStopped) {
1239
- if (!_this.currentObservers) {
1240
- _this.currentObservers = Array.from(_this.observers);
1241
- }
1242
- try {
1243
- for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1244
- var observer = _c.value;
1245
- observer.next(value);
1246
- }
1247
- }
1248
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1249
- finally {
1250
- try {
1251
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1252
- }
1253
- finally { if (e_1) throw e_1.error; }
1254
- }
1255
- }
1256
- });
1257
- };
1258
- Subject.prototype.error = function (err) {
1259
- var _this = this;
1260
- errorContext(function () {
1261
- _this._throwIfClosed();
1262
- if (!_this.isStopped) {
1263
- _this.hasError = _this.isStopped = true;
1264
- _this.thrownError = err;
1265
- var observers = _this.observers;
1266
- while (observers.length) {
1267
- observers.shift().error(err);
1268
- }
1269
- }
1270
- });
1271
- };
1272
- Subject.prototype.complete = function () {
1273
- var _this = this;
1274
- errorContext(function () {
1275
- _this._throwIfClosed();
1276
- if (!_this.isStopped) {
1277
- _this.isStopped = true;
1278
- var observers = _this.observers;
1279
- while (observers.length) {
1280
- observers.shift().complete();
1281
- }
1282
- }
1283
- });
1284
- };
1285
- Subject.prototype.unsubscribe = function () {
1286
- this.isStopped = this.closed = true;
1287
- this.observers = this.currentObservers = null;
1288
- };
1289
- Object.defineProperty(Subject.prototype, "observed", {
1290
- get: function () {
1291
- var _a;
1292
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1293
- },
1294
- enumerable: false,
1295
- configurable: true
1296
- });
1297
- Subject.prototype._trySubscribe = function (subscriber) {
1298
- this._throwIfClosed();
1299
- return _super.prototype._trySubscribe.call(this, subscriber);
1300
- };
1301
- Subject.prototype._subscribe = function (subscriber) {
1302
- this._throwIfClosed();
1303
- this._checkFinalizedStatuses(subscriber);
1304
- return this._innerSubscribe(subscriber);
1305
- };
1306
- Subject.prototype._innerSubscribe = function (subscriber) {
1307
- var _this = this;
1308
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1309
- if (hasError || isStopped) {
1310
- return EMPTY_SUBSCRIPTION;
1311
- }
1312
- this.currentObservers = null;
1313
- observers.push(subscriber);
1314
- return new Subscription$1(function () {
1315
- _this.currentObservers = null;
1316
- arrRemove(observers, subscriber);
1317
- });
1318
- };
1319
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1320
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1321
- if (hasError) {
1322
- subscriber.error(thrownError);
1323
- }
1324
- else if (isStopped) {
1325
- subscriber.complete();
1326
- }
1327
- };
1328
- Subject.prototype.asObservable = function () {
1329
- var observable = new Observable();
1330
- observable.source = this;
1331
- return observable;
1332
- };
1333
- Subject.create = function (destination, source) {
1334
- return new AnonymousSubject(destination, source);
1335
- };
1336
- return Subject;
1337
- }(Observable));
1338
- var AnonymousSubject = (function (_super) {
1339
- tslib.__extends(AnonymousSubject, _super);
1340
- function AnonymousSubject(destination, source) {
1341
- var _this = _super.call(this) || this;
1342
- _this.destination = destination;
1343
- _this.source = source;
1344
- return _this;
1345
- }
1346
- AnonymousSubject.prototype.next = function (value) {
1347
- var _a, _b;
1348
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1349
- };
1350
- AnonymousSubject.prototype.error = function (err) {
1351
- var _a, _b;
1352
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1353
- };
1354
- AnonymousSubject.prototype.complete = function () {
1355
- var _a, _b;
1356
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1357
- };
1358
- AnonymousSubject.prototype._subscribe = function (subscriber) {
1359
- var _a, _b;
1360
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1361
- };
1362
- return AnonymousSubject;
1363
- }(Subject));
800
+ class ReflectHelper {
801
+ static get items() {
802
+ return this._items;
803
+ }
804
+ static get keys() {
805
+ return Object.keys(ReflectHelper.items);
806
+ }
807
+ static has(key, target, property) {
808
+ return (!lodash.isNil(key) &&
809
+ !lodash.isNil(ReflectHelper.items[key]) &&
810
+ (lodash.isNil(target) ||
811
+ (!lodash.isNil(ReflectHelper.items[key][target]) &&
812
+ (lodash.isNil(property) || !lodash.isNil(ReflectHelper.items[key][target][String(property)])))));
813
+ }
814
+ static get({ key, target, property, own = true }) {
815
+ try {
816
+ if (own) {
817
+ return Reflect.getOwnMetadata(key, target, property) || null;
818
+ }
819
+ else {
820
+ return Reflect.getMetadata(key, target, property) || null;
821
+ }
822
+ }
823
+ catch (_err) {
824
+ return null;
825
+ }
826
+ }
827
+ static first({ key, target, property, own = true }) {
828
+ const values = ReflectHelper.get({ key, target, property, own });
829
+ return lodash.isArray(values) ? lodash.first(values) : values;
830
+ }
831
+ static last({ key, target, property, own = true }) {
832
+ const values = ReflectHelper.get({ key, target, property, own });
833
+ return lodash.isArray(values) ? lodash.last(values) : values;
834
+ }
835
+ static set({ key, target, property, value, propertyDescriptor }) {
836
+ Reflect.defineMetadata(key, value, target, property);
837
+ ReflectHelper.put({ key, target, property, value, propertyDescriptor });
838
+ }
839
+ static add({ key, target, property, value, propertyDescriptor }) {
840
+ let values = ReflectHelper.get({ key, target, property }) || new Array();
841
+ if (!Array.isArray(values))
842
+ values = [values];
843
+ values.push(value);
844
+ ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
845
+ }
846
+ static all({ key }) {
847
+ const items = ReflectHelper.items[key] || {};
848
+ return lodash.flatten(Object.keys(items).map((item) => lodash.flatten(this.allFrom(key, items[item]))));
849
+ }
850
+ static allFrom(key, target) {
851
+ return Object.keys(target)
852
+ .filter((property) => property !== 'object')
853
+ .map((property) => this.allValuesFrom(key, target, property));
854
+ }
855
+ static allValuesFrom(key, target, property) {
856
+ const values = target[property];
857
+ let value = values.value;
858
+ const propertyDescriptor = values.propertyDescriptor;
859
+ if (!lodash.isArray(value))
860
+ value = [value];
861
+ return lodash.flatten(value.map((val) => {
862
+ return {
863
+ key,
864
+ target: target.object,
865
+ property,
866
+ value: val,
867
+ propertyDescriptor,
868
+ };
869
+ }));
870
+ }
871
+ static delete({ key, target, property }) {
872
+ Reflect.deleteMetadata(key, target, property);
873
+ return ReflectHelper.remove(key, target, property);
874
+ }
875
+ static clear(key) {
876
+ if (!key) {
877
+ ReflectHelper.keys.forEach((storedKey) => {
878
+ ReflectHelper.clear(storedKey);
879
+ });
880
+ }
881
+ else {
882
+ if (ReflectHelper.keys.includes(key)) {
883
+ Object.values(ReflectHelper.items[key]).forEach((target) => {
884
+ if (ReflectHelper.has(key, target)) {
885
+ Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
886
+ ReflectHelper.delete({
887
+ key,
888
+ target: target.object,
889
+ property: String(property),
890
+ });
891
+ ReflectHelper.remove(key, target, String(property));
892
+ });
893
+ }
894
+ ReflectHelper.delete({ key, target: target.object });
895
+ ReflectHelper.remove(key, target);
896
+ });
897
+ }
898
+ }
899
+ }
900
+ static getType({ target, propertyKey }) {
901
+ return Reflect.getMetadata('design:type', target, propertyKey);
902
+ }
903
+ static getReturntype({ target, propertyKey }) {
904
+ return Reflect.getMetadata('design:returntype', target, propertyKey);
905
+ }
906
+ static getAllMethods(target) {
907
+ const props = [];
908
+ let obj = target;
909
+ do {
910
+ props.push(...Object.getOwnPropertyNames(obj));
911
+ } while ((obj = Object.getPrototypeOf(obj)));
912
+ return props.sort().filter((e, i, arr) => {
913
+ if ([
914
+ '__defineGetter__',
915
+ '__defineSetter__',
916
+ '__lookupGetter__',
917
+ '__lookupSetter__',
918
+ 'constructor',
919
+ 'hasOwnProperty',
920
+ 'isPrototypeOf',
921
+ 'propertyIsEnumerable',
922
+ 'toLocaleString',
923
+ 'toString',
924
+ 'valueOf',
925
+ ].includes(e))
926
+ return false;
927
+ if (e != arr[i + 1] && typeof target[e] === 'function')
928
+ return true;
929
+ });
930
+ }
931
+ static put({ key, target, property, value, propertyDescriptor }) {
932
+ const index = target.constructor.name;
933
+ ReflectHelper.items[key] = ReflectHelper.items[key] || {};
934
+ ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
935
+ ReflectHelper.items[key][index].object = target;
936
+ if (lodash.isNil(property)) {
937
+ ReflectHelper.items[key][index].value = {
938
+ value,
939
+ propertyDescriptor,
940
+ };
941
+ }
942
+ else {
943
+ ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
944
+ ReflectHelper.items[key][index][String(property)] = {
945
+ value,
946
+ propertyDescriptor,
947
+ };
948
+ }
949
+ }
950
+ static remove(key, target, property) {
951
+ if (ReflectHelper.has(key, target, property))
952
+ return delete ReflectHelper.items[key][target][String(property)];
953
+ else if (ReflectHelper.has(key, target))
954
+ return delete ReflectHelper.items[key][target];
955
+ else if (ReflectHelper.has(key))
956
+ return delete ReflectHelper.items[key];
957
+ else
958
+ return false;
959
+ }
960
+ }
961
+ ReflectHelper._items = {};
1364
962
 
1365
- exports.DebugNamespaces = void 0;
1366
- (function (DebugNamespaces) {
1367
- DebugNamespaces["ROOT"] = "connect";
1368
- DebugNamespaces["TRACE"] = "trace";
1369
- DebugNamespaces["ERROR"] = "error";
1370
- })(exports.DebugNamespaces || (exports.DebugNamespaces = {}));
1371
- const Logger = debug.debug(exports.DebugNamespaces.ROOT);
963
+ class DebugDecoratorHelper {
964
+ static set(target, options) {
965
+ ReflectHelper.add({
966
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
967
+ target,
968
+ value: options,
969
+ });
970
+ }
971
+ static get(target) {
972
+ return ReflectHelper.first({
973
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
974
+ target,
975
+ });
976
+ }
977
+ }
978
+ DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
1372
979
 
1373
- class ReflectHelper {
1374
- static get items() {
1375
- return this._items;
980
+ class ClassNameHelper {
981
+ static get(clazz) {
982
+ if (!clazz)
983
+ return null;
984
+ const prototype = Object.getPrototypeOf(clazz);
985
+ const names = lodash.compact([
986
+ lodash.get(clazz, 'constructor.name'),
987
+ lodash.get(prototype, 'constructor.name'),
988
+ lodash.get(prototype, '__proto__.constructor.name'),
989
+ ]);
990
+ return names.find((name) => name !== 'class_1');
991
+ }
992
+ }
993
+
994
+ const isDebuggable = (object) => {
995
+ return 'debug' in object;
996
+ };
997
+ class DebugHelper {
998
+ static namespacesFor(target) {
999
+ if (lodash.isNil(target))
1000
+ return [];
1001
+ const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
1002
+ const namespaces = lodash.get(decorator, 'namespaces', []);
1003
+ const name = lodash.get(decorator, 'name', ClassNameHelper.get(target));
1004
+ return [...namespaces, name];
1005
+ }
1006
+ static as(...namespaces) {
1007
+ return new DebugHelper(...namespaces);
1008
+ }
1009
+ static for(target, ...namespaces) {
1010
+ const targetNamespaces = this.namespacesFor(target);
1011
+ return new DebugHelper(...targetNamespaces, ...namespaces);
1012
+ }
1013
+ static from(target, ...namespaces) {
1014
+ if (this.isDebuggable(target)) {
1015
+ const debug = target.debug;
1016
+ if (namespaces)
1017
+ debug.push(...namespaces);
1018
+ return debug;
1019
+ }
1020
+ return DebugHelper.for(target, ...namespaces);
1021
+ }
1022
+ static clonedFrom(target, ...namespaces) {
1023
+ if (this.isDebuggable(target)) {
1024
+ namespaces.push(...target.debug.entries);
1025
+ }
1026
+ else if (!lodash.isNil(target)) {
1027
+ namespaces.push(...this.namespacesFor(target));
1028
+ }
1029
+ return DebugHelper.for(target, ...namespaces);
1030
+ }
1031
+ static clone(target, ...namespaces) {
1032
+ let original;
1033
+ if (this.isDebuggable(target)) {
1034
+ original = target.debug;
1035
+ namespaces.push(...original.entries);
1036
+ }
1037
+ return {
1038
+ original,
1039
+ debug: DebugHelper.for(target, ...namespaces),
1040
+ };
1041
+ }
1042
+ static replace(target, attrs) {
1043
+ if (this.isDebuggable(target))
1044
+ target.debug = attrs.with;
1045
+ }
1046
+ static mock(target, ...namespaces) {
1047
+ const { original, debug } = DebugHelper.clone(target, ...namespaces);
1048
+ DebugHelper.replace(target, { with: debug });
1049
+ return { original, debug };
1050
+ }
1051
+ constructor(...namespace) {
1052
+ this.namespaces = new Set();
1053
+ this.push(...namespace);
1054
+ }
1055
+ get entries() {
1056
+ return Array.from(lodash.get(this, 'namespaces', []));
1057
+ }
1058
+ get namespace() {
1059
+ return lodash.compact(lodash.flatten(this.entries)).join(':');
1060
+ }
1061
+ log(message, ...args) {
1062
+ this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
1063
+ DebugHelper.logs$.next({ namespace: this.namespace, message, args });
1064
+ return this;
1065
+ }
1066
+ trace(message, ...args) {
1067
+ this.logger.extend(exports.DebugNamespaces.TRACE)(message, ...args);
1068
+ DebugHelper.traces$.next({ namespace: this.namespace, message, args });
1069
+ return this;
1070
+ }
1071
+ error(error, ...args) {
1072
+ this.logger.extend(exports.DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
1073
+ DebugHelper.errors$.next({ namespace: this.namespace, error, args });
1074
+ return this;
1075
+ }
1076
+ build() {
1077
+ this.logger = Logger;
1078
+ this.tracer = Logger;
1079
+ this.err = Logger;
1080
+ this.entries.forEach((namespace) => {
1081
+ this.logger = this.logger.extend(namespace);
1082
+ this.tracer = this.tracer.extend(namespace);
1083
+ this.err = this.err.extend(namespace);
1084
+ });
1085
+ return this;
1376
1086
  }
1377
- static get keys() {
1378
- return Object.keys(ReflectHelper.items);
1087
+ with(...namespace) {
1088
+ return new DebugHelper(...this.entries, ...namespace);
1379
1089
  }
1380
- static has(key, target, property) {
1381
- return (!lodash.isNil(key) &&
1382
- !lodash.isNil(ReflectHelper.items[key]) &&
1383
- (lodash.isNil(target) ||
1384
- (!lodash.isNil(ReflectHelper.items[key][target]) &&
1385
- (lodash.isNil(property) || !lodash.isNil(ReflectHelper.items[key][target][String(property)])))));
1090
+ push(...namespace) {
1091
+ if (namespace) {
1092
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
1093
+ }
1094
+ return this.build();
1386
1095
  }
1387
- static get({ key, target, property, own = true }) {
1096
+ unshift(...namespace) {
1097
+ if (namespace) {
1098
+ return this.reset(...namespace, ...this.entries);
1099
+ }
1100
+ return this;
1101
+ }
1102
+ reset(...namespace) {
1103
+ this.namespaces = new Set(lodash.flatten(lodash.compact(namespace)));
1104
+ return this.build();
1105
+ }
1106
+ startWith(...namespace) {
1107
+ const current = this.namespaces;
1108
+ this.namespaces = new Set(lodash.flatten([lodash.compact(namespace), ...current]));
1109
+ return this.build();
1110
+ }
1111
+ shift() {
1112
+ const list = this.entries;
1113
+ list.shift();
1114
+ return this.reset(...list);
1115
+ }
1116
+ pop() {
1117
+ const list = this.entries;
1118
+ list.pop();
1119
+ return this.reset(...list);
1120
+ }
1121
+ clear() {
1122
+ return this.reset();
1123
+ }
1124
+ remove(...namespace) {
1125
+ if (namespace) {
1126
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
1127
+ }
1128
+ return this.build();
1129
+ }
1130
+ puts(...args) {
1131
+ return [`[${this.namespace}]`, ...args].join(' ');
1132
+ }
1133
+ }
1134
+ DebugHelper.logs$ = new Subject();
1135
+ DebugHelper.traces$ = new Subject();
1136
+ DebugHelper.errors$ = new Subject();
1137
+ DebugHelper.isDebuggable = isDebuggable;
1138
+
1139
+ function Debug(opts) {
1140
+ return function (target) {
1141
+ DebugDecoratorHelper.set(target.prototype, opts);
1142
+ };
1143
+ }
1144
+
1145
+ const ASYNC_IDENTIFIER = 'async';
1146
+ function Log(options = {}) {
1147
+ return Trace(Object.assign({ level: 'log' }, options));
1148
+ }
1149
+ function Trace(options = {}) {
1150
+ return function (target, propertyKey, propertyDescriptor) {
1151
+ const method = propertyDescriptor.value;
1152
+ const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
1153
+ const args = {
1154
+ options,
1155
+ method,
1156
+ target,
1157
+ propertyKey,
1158
+ propertyDescriptor,
1159
+ };
1160
+ propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
1161
+ return propertyDescriptor;
1162
+ };
1163
+ }
1164
+ const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
1165
+ if (!target.debug)
1166
+ target.debug = DebugHelper.for(target, propertyKey);
1167
+ return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
1168
+ };
1169
+ const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
1170
+ return function (...args) {
1171
+ return new Promise((resolve, reject) => {
1172
+ const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
1173
+ return method
1174
+ .apply(this, args)
1175
+ .then((result) => {
1176
+ if (options.callbackFn) {
1177
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1178
+ }
1179
+ if (lodash.get(options, 'level', '') === 'log') {
1180
+ debug.log({ req: args, res: result === undefined ? 'void' : result });
1181
+ }
1182
+ return resolve(result);
1183
+ })
1184
+ .catch((error) => {
1185
+ debug.error({ req: args, res: error, stack: error.stack });
1186
+ return reject(error);
1187
+ });
1188
+ });
1189
+ };
1190
+ };
1191
+ const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
1192
+ return function (...args) {
1193
+ const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
1194
+ let result;
1388
1195
  try {
1389
- if (own) {
1390
- return Reflect.getOwnMetadata(key, target, property) || null;
1391
- }
1392
- else {
1393
- return Reflect.getMetadata(key, target, property) || null;
1196
+ result = method.apply(this, args);
1197
+ if (options.callbackFn)
1198
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1199
+ if (lodash.get(options, 'level', '') === 'log') {
1200
+ debug.log({ req: args, res: result === undefined ? 'void' : result });
1394
1201
  }
1202
+ return result;
1395
1203
  }
1396
- catch (_err) {
1397
- return null;
1204
+ catch (error) {
1205
+ if (error instanceof Error)
1206
+ debug.error({ req: args, res: error, stack: error.stack });
1207
+ throw error;
1398
1208
  }
1209
+ };
1210
+ };
1211
+
1212
+ function is(value) {
1213
+ return value;
1214
+ }
1215
+
1216
+ const isUUID = (value) => 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);
1217
+
1218
+ class Base {
1219
+ constructor(...args) {
1220
+ Object.assign(this, ...args);
1399
1221
  }
1400
- static first({ key, target, property, own = true }) {
1401
- const values = ReflectHelper.get({ key, target, property, own });
1402
- return lodash.isArray(values) ? lodash.first(values) : values;
1222
+ }
1223
+
1224
+ const parseDateTime = (value) => {
1225
+ if (!lodash.isString(value))
1226
+ return value;
1227
+ if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
1228
+ !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
1229
+ return value;
1230
+ const date = dateFns.parseISO(value);
1231
+ if (isNaN(date.getTime()))
1232
+ return value;
1233
+ return date;
1234
+ };
1235
+
1236
+ class BaseModel {
1237
+ get identifier() {
1238
+ const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
1239
+ const data = this;
1240
+ return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
1403
1241
  }
1404
- static last({ key, target, property, own = true }) {
1405
- const values = ReflectHelper.get({ key, target, property, own });
1406
- return lodash.isArray(values) ? lodash.last(values) : values;
1242
+ get identifiersFields() {
1243
+ return this.constructor.identifiersFields;
1407
1244
  }
1408
- static set({ key, target, property, value, propertyDescriptor }) {
1409
- Reflect.defineMetadata(key, value, target, property);
1410
- ReflectHelper.put({ key, target, property, value, propertyDescriptor });
1245
+ constructor(args) {
1246
+ Object.assign(this, args);
1411
1247
  }
1412
- static add({ key, target, property, value, propertyDescriptor }) {
1413
- let values = ReflectHelper.get({ key, target, property }) || new Array();
1414
- if (!Array.isArray(values))
1415
- values = [values];
1416
- values.push(value);
1417
- ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
1248
+ static toInstance(data) {
1249
+ return classTransformer.plainToInstance(this, data || {});
1418
1250
  }
1419
- static all({ key }) {
1420
- const items = ReflectHelper.items[key] || {};
1421
- return lodash.flatten(Object.keys(items).map((item) => lodash.flatten(this.allFrom(key, items[item]))));
1251
+ static isModel(value) {
1252
+ return value instanceof this;
1422
1253
  }
1423
- static allFrom(key, target) {
1424
- return Object.keys(target)
1425
- .filter((property) => property !== 'object')
1426
- .map((property) => this.allValuesFrom(key, target, property));
1254
+ toPlain() {
1255
+ return classTransformer.instanceToPlain(this);
1427
1256
  }
1428
- static allValuesFrom(key, target, property) {
1429
- const values = target[property];
1430
- let value = values.value;
1431
- const propertyDescriptor = values.propertyDescriptor;
1432
- if (!lodash.isArray(value))
1433
- value = [value];
1434
- return lodash.flatten(value.map((val) => {
1435
- return {
1436
- key,
1437
- target: target.object,
1438
- property,
1439
- value: val,
1440
- propertyDescriptor,
1257
+ }
1258
+
1259
+ exports.GenderDestination = void 0;
1260
+ (function (GenderDestination) {
1261
+ GenderDestination["FEMALE"] = "female";
1262
+ GenderDestination["MALE"] = "male";
1263
+ GenderDestination["UNISEX"] = "unisex";
1264
+ })(exports.GenderDestination || (exports.GenderDestination = {}));
1265
+
1266
+ exports.ProductLabelEnum = void 0;
1267
+ (function (ProductLabelEnum) {
1268
+ ProductLabelEnum["ON_SALE"] = "on-sale";
1269
+ ProductLabelEnum["OUTLET"] = "outlet";
1270
+ ProductLabelEnum["LAST_UNITS"] = "last-units";
1271
+ ProductLabelEnum["GLAMSTAR"] = "glamstar";
1272
+ })(exports.ProductLabelEnum || (exports.ProductLabelEnum = {}));
1273
+
1274
+ exports.Shops = void 0;
1275
+ (function (Shops) {
1276
+ Shops["MENSMARKET"] = "mensmarket";
1277
+ Shops["GLAMSHOP"] = "Glamshop";
1278
+ Shops["GLAMPOINTS"] = "Glampoints";
1279
+ Shops["ALL"] = "ALL";
1280
+ })(exports.Shops || (exports.Shops = {}));
1281
+
1282
+ exports.WishlistLogType = void 0;
1283
+ (function (WishlistLogType) {
1284
+ WishlistLogType["CREATE"] = "create";
1285
+ WishlistLogType["UPDATE"] = "update";
1286
+ WishlistLogType["DELETE"] = "delete";
1287
+ WishlistLogType["ADD_PRODUCT"] = "add_product";
1288
+ WishlistLogType["REMOVE_PRODUCT"] = "remove_product";
1289
+ })(exports.WishlistLogType || (exports.WishlistLogType = {}));
1290
+
1291
+ class Category extends BaseModel {
1292
+ static get identifiersFields() {
1293
+ return ['id'];
1294
+ }
1295
+ get glamImages() {
1296
+ return this.images && this.images[exports.Shops.GLAMSHOP]
1297
+ ? this.images[exports.Shops.GLAMSHOP]
1298
+ : {
1299
+ brandBanner: null,
1300
+ brandBannerMobile: null,
1301
+ image: null,
1441
1302
  };
1442
- }));
1443
- }
1444
- static delete({ key, target, property }) {
1445
- Reflect.deleteMetadata(key, target, property);
1446
- return ReflectHelper.remove(key, target, property);
1447
- }
1448
- static clear(key) {
1449
- if (!key) {
1450
- ReflectHelper.keys.forEach((storedKey) => {
1451
- ReflectHelper.clear(storedKey);
1452
- });
1453
- }
1454
- else {
1455
- if (ReflectHelper.keys.includes(key)) {
1456
- Object.values(ReflectHelper.items[key]).forEach((target) => {
1457
- if (ReflectHelper.has(key, target)) {
1458
- Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
1459
- ReflectHelper.delete({
1460
- key,
1461
- target: target.object,
1462
- property: String(property),
1463
- });
1464
- ReflectHelper.remove(key, target, String(property));
1465
- });
1466
- }
1467
- ReflectHelper.delete({ key, target: target.object });
1468
- ReflectHelper.remove(key, target);
1469
- });
1470
- }
1471
- }
1472
1303
  }
1473
- static getType({ target, propertyKey }) {
1474
- return Reflect.getMetadata('design:type', target, propertyKey);
1304
+ get mensImages() {
1305
+ return this.images && this.images[exports.Shops.MENSMARKET]
1306
+ ? this.images[exports.Shops.MENSMARKET]
1307
+ : {
1308
+ brandBanner: null,
1309
+ brandBannerMobile: null,
1310
+ image: null,
1311
+ };
1475
1312
  }
1476
- static getReturntype({ target, propertyKey }) {
1477
- return Reflect.getMetadata('design:returntype', target, propertyKey);
1313
+ get glamMetadata() {
1314
+ return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
1478
1315
  }
1479
- static getAllMethods(target) {
1480
- const props = [];
1481
- let obj = target;
1482
- do {
1483
- props.push(...Object.getOwnPropertyNames(obj));
1484
- } while ((obj = Object.getPrototypeOf(obj)));
1485
- return props.sort().filter((e, i, arr) => {
1486
- if ([
1487
- '__defineGetter__',
1488
- '__defineSetter__',
1489
- '__lookupGetter__',
1490
- '__lookupSetter__',
1491
- 'constructor',
1492
- 'hasOwnProperty',
1493
- 'isPrototypeOf',
1494
- 'propertyIsEnumerable',
1495
- 'toLocaleString',
1496
- 'toString',
1497
- 'valueOf',
1498
- ].includes(e))
1499
- return false;
1500
- if (e != arr[i + 1] && typeof target[e] === 'function')
1501
- return true;
1502
- });
1316
+ get mensMetadata() {
1317
+ return this.metadatas.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
1503
1318
  }
1504
- static put({ key, target, property, value, propertyDescriptor }) {
1505
- const index = target.constructor.name;
1506
- ReflectHelper.items[key] = ReflectHelper.items[key] || {};
1507
- ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
1508
- ReflectHelper.items[key][index].object = target;
1509
- if (lodash.isNil(property)) {
1510
- ReflectHelper.items[key][index].value = {
1511
- value,
1512
- propertyDescriptor,
1513
- };
1514
- }
1515
- else {
1516
- ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
1517
- ReflectHelper.items[key][index][String(property)] = {
1518
- value,
1519
- propertyDescriptor,
1520
- };
1521
- }
1319
+ getMostRelevantByShop(shop) {
1320
+ return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
1522
1321
  }
1523
- static remove(key, target, property) {
1524
- if (ReflectHelper.has(key, target, property))
1525
- return delete ReflectHelper.items[key][target][String(property)];
1526
- else if (ReflectHelper.has(key, target))
1527
- return delete ReflectHelper.items[key][target];
1528
- else if (ReflectHelper.has(key))
1529
- return delete ReflectHelper.items[key];
1530
- else
1531
- return false;
1322
+ }
1323
+ tslib.__decorate([
1324
+ classTransformer.Type(() => Category),
1325
+ tslib.__metadata("design:type", Category)
1326
+ ], Category.prototype, "parent", void 0);
1327
+ tslib.__decorate([
1328
+ classTransformer.Type(resolveClass('Product')),
1329
+ tslib.__metadata("design:type", Array)
1330
+ ], Category.prototype, "childrenProducts", void 0);
1331
+ tslib.__decorate([
1332
+ classTransformer.Type(resolveClass('Filter')),
1333
+ tslib.__metadata("design:type", Array)
1334
+ ], Category.prototype, "filters", void 0);
1335
+ registerClass('Category', Category);
1336
+
1337
+ class CategoryCollectionChildren extends BaseModel {
1338
+ static get identifiersFields() {
1339
+ return ['collectionId', 'categoryId'];
1532
1340
  }
1533
1341
  }
1534
- ReflectHelper._items = {};
1342
+ tslib.__decorate([
1343
+ classTransformer.Type(() => CategoryCollectionChildren),
1344
+ tslib.__metadata("design:type", CategoryCollectionChildren)
1345
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
1535
1346
 
1536
- class DebugDecoratorHelper {
1537
- static set(target, options) {
1538
- ReflectHelper.add({
1539
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
1540
- target,
1541
- value: options,
1542
- });
1347
+ class Filter extends BaseModel {
1348
+ static get identifiersFields() {
1349
+ return ['id'];
1543
1350
  }
1544
- static get(target) {
1545
- return ReflectHelper.first({
1546
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
1547
- target,
1548
- });
1351
+ }
1352
+ tslib.__decorate([
1353
+ classTransformer.Type(() => Category),
1354
+ tslib.__metadata("design:type", Array)
1355
+ ], Filter.prototype, "categories", void 0);
1356
+ registerClass('Filter', Filter);
1357
+
1358
+ class CategoryFilter extends BaseModel {
1359
+ static get identifiersFields() {
1360
+ return ['id'];
1549
1361
  }
1550
1362
  }
1551
- DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
1363
+ tslib.__decorate([
1364
+ classTransformer.Type(() => Filter),
1365
+ tslib.__metadata("design:type", Filter)
1366
+ ], CategoryFilter.prototype, "filter", void 0);
1367
+ tslib.__decorate([
1368
+ classTransformer.Type(() => Category),
1369
+ tslib.__metadata("design:type", Category)
1370
+ ], CategoryFilter.prototype, "category", void 0);
1552
1371
 
1553
- class ClassNameHelper {
1554
- static get(clazz) {
1555
- if (!clazz)
1556
- return null;
1557
- const prototype = Object.getPrototypeOf(clazz);
1558
- const names = lodash.compact([
1559
- lodash.get(clazz, 'constructor.name'),
1560
- lodash.get(prototype, 'constructor.name'),
1561
- lodash.get(prototype, '__proto__.constructor.name'),
1562
- ]);
1563
- return names.find((name) => name !== 'class_1');
1372
+ class CategoryProduct extends BaseModel {
1373
+ static get identifiersFields() {
1374
+ return ['categoryId', 'productId'];
1564
1375
  }
1565
1376
  }
1566
1377
 
1567
- const isDebuggable = (object) => {
1568
- return 'debug' in object;
1569
- };
1570
- class DebugHelper {
1571
- static namespacesFor(target) {
1572
- if (lodash.isNil(target))
1573
- return [];
1574
- const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
1575
- const namespaces = lodash.get(decorator, 'namespaces', []);
1576
- const name = lodash.get(decorator, 'name', ClassNameHelper.get(target));
1577
- return [...namespaces, name];
1578
- }
1579
- static as(...namespaces) {
1580
- return new DebugHelper(...namespaces);
1581
- }
1582
- static for(target, ...namespaces) {
1583
- const targetNamespaces = this.namespacesFor(target);
1584
- return new DebugHelper(...targetNamespaces, ...namespaces);
1378
+ class FilterOption extends BaseModel {
1379
+ static get identifiersFields() {
1380
+ return ['id'];
1585
1381
  }
1586
- static from(target, ...namespaces) {
1587
- if (this.isDebuggable(target)) {
1588
- const debug = target.debug;
1589
- if (namespaces)
1590
- debug.push(...namespaces);
1591
- return debug;
1592
- }
1593
- return DebugHelper.for(target, ...namespaces);
1382
+ }
1383
+
1384
+ class KitProduct extends BaseModel {
1385
+ static get identifiersFields() {
1386
+ return ['productId', 'kitProductId'];
1594
1387
  }
1595
- static clonedFrom(target, ...namespaces) {
1596
- if (this.isDebuggable(target)) {
1597
- namespaces.push(...target.debug.entries);
1598
- }
1599
- else if (!lodash.isNil(target)) {
1600
- namespaces.push(...this.namespacesFor(target));
1601
- }
1602
- return DebugHelper.for(target, ...namespaces);
1388
+ }
1389
+ tslib.__decorate([
1390
+ classTransformer.Type(resolveClass('Product')),
1391
+ tslib.__metadata("design:type", Function)
1392
+ ], KitProduct.prototype, "kit", void 0);
1393
+ tslib.__decorate([
1394
+ classTransformer.Type(resolveClass('Product')),
1395
+ tslib.__metadata("design:type", Function)
1396
+ ], KitProduct.prototype, "product", void 0);
1397
+ registerClass('KitProduct', KitProduct);
1398
+
1399
+ class ProductReview extends BaseModel {
1400
+ static get identifiersFields() {
1401
+ return ['id'];
1603
1402
  }
1604
- static clone(target, ...namespaces) {
1605
- let original;
1606
- if (this.isDebuggable(target)) {
1607
- original = target.debug;
1608
- namespaces.push(...original.entries);
1609
- }
1403
+ }
1404
+
1405
+ class ProductBase extends BaseModel {
1406
+ get evaluation() {
1610
1407
  return {
1611
- original,
1612
- debug: DebugHelper.for(target, ...namespaces),
1408
+ reviews: this.reviews,
1409
+ count: this.reviewsTotal,
1410
+ rating: this.rate,
1613
1411
  };
1614
1412
  }
1615
- static replace(target, attrs) {
1616
- if (this.isDebuggable(target))
1617
- target.debug = attrs.with;
1618
- }
1619
- static mock(target, ...namespaces) {
1620
- const { original, debug } = DebugHelper.clone(target, ...namespaces);
1621
- DebugHelper.replace(target, { with: debug });
1622
- return { original, debug };
1623
- }
1624
- constructor(...namespace) {
1625
- this.namespaces = new Set();
1626
- this.push(...namespace);
1627
- }
1628
- get entries() {
1629
- return Array.from(lodash.get(this, 'namespaces', []));
1630
- }
1631
- get namespace() {
1632
- return lodash.compact(lodash.flatten(this.entries)).join(':');
1633
- }
1634
- log(message, ...args) {
1635
- this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
1636
- DebugHelper.logs$.next({ namespace: this.namespace, message, args });
1637
- return this;
1638
- }
1639
- trace(message, ...args) {
1640
- this.logger.extend(exports.DebugNamespaces.TRACE)(message, ...args);
1641
- DebugHelper.traces$.next({ namespace: this.namespace, message, args });
1642
- return this;
1643
- }
1644
- error(error, ...args) {
1645
- this.logger.extend(exports.DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
1646
- DebugHelper.errors$.next({ namespace: this.namespace, error, args });
1647
- return this;
1413
+ set evaluation(evaluation) {
1414
+ if (!evaluation) {
1415
+ this.reviews = null;
1416
+ this.reviewsTotal = null;
1417
+ this.rate = null;
1418
+ return;
1419
+ }
1420
+ this.reviews = evaluation.reviews || this.reviews;
1421
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
1422
+ this.rate = evaluation.rating || this.rate;
1648
1423
  }
1649
- build() {
1650
- this.logger = Logger;
1651
- this.tracer = Logger;
1652
- this.err = Logger;
1653
- this.entries.forEach((namespace) => {
1654
- this.logger = this.logger.extend(namespace);
1655
- this.tracer = this.tracer.extend(namespace);
1656
- this.err = this.err.extend(namespace);
1657
- });
1658
- return this;
1424
+ static get identifiersFields() {
1425
+ return ['id'];
1659
1426
  }
1660
- with(...namespace) {
1661
- return new DebugHelper(...this.entries, ...namespace);
1427
+ }
1428
+ tslib.__decorate([
1429
+ classTransformer.Type(() => Category),
1430
+ tslib.__metadata("design:type", Category)
1431
+ ], ProductBase.prototype, "category", void 0);
1432
+ tslib.__decorate([
1433
+ classTransformer.Type(() => KitProduct),
1434
+ tslib.__metadata("design:type", Array)
1435
+ ], ProductBase.prototype, "kitProducts", void 0);
1436
+ tslib.__decorate([
1437
+ classTransformer.Type(() => ProductReview),
1438
+ tslib.__metadata("design:type", Array)
1439
+ ], ProductBase.prototype, "reviews", void 0);
1440
+
1441
+ class Variant extends ProductBase {
1442
+ static get identifiersFields() {
1443
+ return ['id', 'productId'];
1662
1444
  }
1663
- push(...namespace) {
1664
- if (namespace) {
1665
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
1666
- }
1667
- return this.build();
1445
+ }
1446
+
1447
+ class Product extends ProductBase {
1448
+ }
1449
+ tslib.__decorate([
1450
+ classTransformer.Type(() => Variant),
1451
+ tslib.__metadata("design:type", Array)
1452
+ ], Product.prototype, "variants", void 0);
1453
+ registerClass('Product', Product);
1454
+
1455
+ class ProductErrors extends BaseModel {
1456
+ static get identifiersFields() {
1457
+ return ['productId', 'source', 'error'];
1668
1458
  }
1669
- unshift(...namespace) {
1670
- if (namespace) {
1671
- return this.reset(...namespace, ...this.entries);
1672
- }
1673
- return this;
1459
+ getProductId() {
1460
+ return this.product instanceof Product ? this.product.id.toString() : this.product.productId.toString();
1674
1461
  }
1675
- reset(...namespace) {
1676
- this.namespaces = new Set(lodash.flatten(lodash.compact(namespace)));
1677
- return this.build();
1462
+ }
1463
+ tslib.__decorate([
1464
+ classTransformer.Type((type) => (+type.object.product.productId ? Variant : Product)),
1465
+ tslib.__metadata("design:type", Object)
1466
+ ], ProductErrors.prototype, "product", void 0);
1467
+
1468
+ class ProductStockNotification extends BaseModel {
1469
+ static get identifiersFields() {
1470
+ return ['id'];
1678
1471
  }
1679
- startWith(...namespace) {
1680
- const current = this.namespaces;
1681
- this.namespaces = new Set(lodash.flatten([lodash.compact(namespace), ...current]));
1682
- return this.build();
1472
+ }
1473
+
1474
+ class Wishlist extends Category {
1475
+ static get identifiersFields() {
1476
+ return ['id'];
1683
1477
  }
1684
- shift() {
1685
- const list = this.entries;
1686
- list.shift();
1687
- return this.reset(...list);
1478
+ }
1479
+
1480
+ class Buy2Win extends BaseModel {
1481
+ static get identifiersFields() {
1482
+ return ['id'];
1688
1483
  }
1689
- pop() {
1690
- const list = this.entries;
1691
- list.pop();
1692
- return this.reset(...list);
1484
+ }
1485
+ tslib.__decorate([
1486
+ classTransformer.Type(() => Category),
1487
+ tslib.__metadata("design:type", Array)
1488
+ ], Buy2Win.prototype, "categories", void 0);
1489
+
1490
+ exports.Where = void 0;
1491
+ (function (Where) {
1492
+ Where["EQUALS"] = "==";
1493
+ Where["NOTEQUALS"] = "!=";
1494
+ Where["GT"] = ">";
1495
+ Where["GTE"] = ">=";
1496
+ Where["IN"] = "in";
1497
+ Where["NOTIN"] = "not in";
1498
+ Where["LT"] = "<";
1499
+ Where["LTE"] = "<=";
1500
+ Where["LIKE"] = "like";
1501
+ Where["NOTLIKE"] = "not like";
1502
+ Where["ISNULL"] = "is null";
1503
+ Where["ISNOTNULL"] = "is not null";
1504
+ Where["IREGEX"] = "iregex";
1505
+ })(exports.Where || (exports.Where = {}));
1506
+
1507
+ exports.UpdateOptionActions = void 0;
1508
+ (function (UpdateOptionActions) {
1509
+ UpdateOptionActions["UPDATE"] = "update";
1510
+ UpdateOptionActions["MERGE"] = "merge";
1511
+ UpdateOptionActions["REMOVE"] = "remove";
1512
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
1513
+ UpdateOptionActions["NULL"] = "null";
1514
+ })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
1515
+
1516
+ class CampaignDashboard extends BaseModel {
1517
+ static get identifiersFields() {
1518
+ return ['id'];
1693
1519
  }
1694
- clear() {
1695
- return this.reset();
1520
+ }
1521
+
1522
+ class CampaignHashtag extends BaseModel {
1523
+ static get identifiersFields() {
1524
+ return ['id'];
1696
1525
  }
1697
- remove(...namespace) {
1698
- if (namespace) {
1699
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
1700
- }
1701
- return this.build();
1526
+ }
1527
+
1528
+ class BeautyProfile extends BaseModel {
1529
+ toPlain() {
1530
+ const plain = super.toPlain();
1531
+ delete plain.id;
1532
+ return plain;
1702
1533
  }
1703
- puts(...args) {
1704
- return [`[${this.namespace}]`, ...args].join(' ');
1534
+ static get identifiersFields() {
1535
+ return ['id', 'userId'];
1536
+ }
1537
+ }
1538
+
1539
+ exports.AccessoryImportances = void 0;
1540
+ (function (AccessoryImportances) {
1541
+ AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
1542
+ AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
1543
+ AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
1544
+ })(exports.AccessoryImportances || (exports.AccessoryImportances = {}));
1545
+
1546
+ exports.Area = void 0;
1547
+ (function (Area) {
1548
+ Area["GP"] = "Geral";
1549
+ Area["CRM"] = "CRM";
1550
+ Area["MediaProd"] = "Media Production";
1551
+ Area["Tech"] = "Tecnologia";
1552
+ Area["Transactional"] = "Transacional";
1553
+ Area["Operations"] = "Opera\u00E7\u00F5es";
1554
+ Area["Sales"] = "Comercial";
1555
+ Area["Finantial"] = "Financeiro";
1556
+ Area["HR"] = "RH";
1557
+ })(exports.Area || (exports.Area = {}));
1558
+
1559
+ exports.BeardProblems = void 0;
1560
+ (function (BeardProblems) {
1561
+ BeardProblems["NO_PROBLEMS"] = "Sem problemas";
1562
+ BeardProblems["DRY"] = "Barba Seca";
1563
+ BeardProblems["OILY"] = "Barba Oleaosa";
1564
+ BeardProblems["DANCRUFF"] = "Barba com Caspa";
1565
+ BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
1566
+ BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
1567
+ BeardProblems["SPARSE_BEARD"] = "Barba Rala";
1568
+ })(exports.BeardProblems || (exports.BeardProblems = {}));
1569
+
1570
+ exports.BeardSizes = void 0;
1571
+ (function (BeardSizes) {
1572
+ BeardSizes["BIG"] = "Grande";
1573
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
1574
+ BeardSizes["SHORT"] = "Curta";
1575
+ BeardSizes["MUSTACHE"] = "Bigode";
1576
+ BeardSizes["NOTHING"] = "Sem Barba";
1577
+ })(exports.BeardSizes || (exports.BeardSizes = {}));
1578
+
1579
+ exports.BeautyProductImportances = void 0;
1580
+ (function (BeautyProductImportances) {
1581
+ BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
1582
+ BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
1583
+ BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
1584
+ BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
1585
+ })(exports.BeautyProductImportances || (exports.BeautyProductImportances = {}));
1586
+
1587
+ exports.BodyProblems = void 0;
1588
+ (function (BodyProblems) {
1589
+ BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
1590
+ BodyProblems["FLACCIDITY"] = "Flacidez";
1591
+ BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
1592
+ BodyProblems["STRETCH_MARKS"] = "Estrias";
1593
+ BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
1594
+ BodyProblems["DRY_SKIN"] = "Pele Seca";
1595
+ BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
1596
+ BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
1597
+ BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
1598
+ })(exports.BodyProblems || (exports.BodyProblems = {}));
1599
+
1600
+ exports.BodyShapes = void 0;
1601
+ (function (BodyShapes) {
1602
+ BodyShapes["LEAN"] = "Magro";
1603
+ BodyShapes["REGULAR"] = "Regular";
1604
+ BodyShapes["OVERWEIGHT"] = "Acima do Peso";
1605
+ BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
1606
+ BodyShapes["MUSCULAR"] = "Musculoso";
1607
+ })(exports.BodyShapes || (exports.BodyShapes = {}));
1608
+
1609
+ exports.BodyTattoos = void 0;
1610
+ (function (BodyTattoos) {
1611
+ BodyTattoos["NONE"] = "Nenhuma";
1612
+ BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
1613
+ BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
1614
+ })(exports.BodyTattoos || (exports.BodyTattoos = {}));
1615
+
1616
+ exports.FaceSkinOilinesses = void 0;
1617
+ (function (FaceSkinOilinesses) {
1618
+ FaceSkinOilinesses["DRY"] = "Seca";
1619
+ FaceSkinOilinesses["OILY"] = "Oleaosa";
1620
+ FaceSkinOilinesses["MIXED"] = "Mista";
1621
+ FaceSkinOilinesses["NORMAL"] = "Normal";
1622
+ FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
1623
+ })(exports.FaceSkinOilinesses || (exports.FaceSkinOilinesses = {}));
1624
+
1625
+ exports.FaceSkinProblems = void 0;
1626
+ (function (FaceSkinProblems) {
1627
+ FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
1628
+ FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
1629
+ FaceSkinProblems["WRINKLES"] = "Rugas";
1630
+ FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
1631
+ FaceSkinProblems["STAINS"] = "Manchas";
1632
+ FaceSkinProblems["FRECKLES"] = "Sardas";
1633
+ FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
1634
+ FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
1635
+ })(exports.FaceSkinProblems || (exports.FaceSkinProblems = {}));
1636
+
1637
+ exports.FaceSkinTones = void 0;
1638
+ (function (FaceSkinTones) {
1639
+ FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
1640
+ FaceSkinTones["CLEAR"] = "Clara";
1641
+ FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
1642
+ FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
1643
+ FaceSkinTones["DARK"] = "Escura";
1644
+ FaceSkinTones["VERY_DARK"] = "Muito Escura";
1645
+ })(exports.FaceSkinTones || (exports.FaceSkinTones = {}));
1646
+
1647
+ exports.FamilyIncomes = void 0;
1648
+ (function (FamilyIncomes) {
1649
+ FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
1650
+ FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
1651
+ FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
1652
+ FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
1653
+ FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
1654
+ FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
1655
+ })(exports.FamilyIncomes || (exports.FamilyIncomes = {}));
1656
+
1657
+ exports.FragranceImportances = void 0;
1658
+ (function (FragranceImportances) {
1659
+ FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
1660
+ FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
1661
+ FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
1662
+ })(exports.FragranceImportances || (exports.FragranceImportances = {}));
1663
+
1664
+ exports.HairColors = void 0;
1665
+ (function (HairColors) {
1666
+ HairColors["BLACK"] = "Preto";
1667
+ HairColors["DARK_BROWN"] = "Castanho Escuro";
1668
+ HairColors["LIGHT_BROWN"] = "Castanho Claro";
1669
+ HairColors["DARK_BLONDE"] = "Loiro Escuro";
1670
+ HairColors["LIGHT_BLONDE"] = "Loiro Claro";
1671
+ HairColors["WHITE_GRAY"] = "Branco/Grisalho";
1672
+ HairColors["REDHEAD"] = "Ruivo";
1673
+ HairColors["OTHER"] = "RuiOutroo";
1674
+ })(exports.HairColors || (exports.HairColors = {}));
1675
+
1676
+ exports.HairProblems = void 0;
1677
+ (function (HairProblems) {
1678
+ HairProblems["NO_PROBLEMS"] = "Sem problemas";
1679
+ HairProblems["DANCRUFF"] = "Caspa";
1680
+ HairProblems["LOSS"] = "Queda";
1681
+ HairProblems["OILY"] = "Oleosidade";
1682
+ HairProblems["DRYNESS"] = "Ressecamento";
1683
+ HairProblems["CHEMICAL"] = "Quimica";
1684
+ HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
1685
+ HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
1686
+ })(exports.HairProblems || (exports.HairProblems = {}));
1687
+
1688
+ exports.HairStrands = void 0;
1689
+ (function (HairStrands) {
1690
+ HairStrands["NORMAL"] = "Fio Normal";
1691
+ HairStrands["DRY"] = "Fio Seco";
1692
+ HairStrands["OILY"] = "Fio Oleoso";
1693
+ HairStrands["MIXED"] = "Fio Misto";
1694
+ HairStrands["FINE"] = "Fio Fino";
1695
+ HairStrands["THICK"] = "Fio Grosso";
1696
+ })(exports.HairStrands || (exports.HairStrands = {}));
1697
+
1698
+ exports.HairTypes = void 0;
1699
+ (function (HairTypes) {
1700
+ HairTypes["Smooth"] = "Liso";
1701
+ HairTypes["WAVY"] = "Ondulado";
1702
+ HairTypes["CURLY"] = "Cacheado";
1703
+ HairTypes["FRIZZY"] = "Crespo";
1704
+ HairTypes["BALD"] = "Sou careca";
1705
+ })(exports.HairTypes || (exports.HairTypes = {}));
1706
+
1707
+ exports.OfficePosition = void 0;
1708
+ (function (OfficePosition) {
1709
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
1710
+ OfficePosition["Analyst"] = "Analista";
1711
+ OfficePosition["Manager"] = "Gerente";
1712
+ OfficePosition["Director"] = "Diretor";
1713
+ })(exports.OfficePosition || (exports.OfficePosition = {}));
1714
+
1715
+ exports.PersonTypes = void 0;
1716
+ (function (PersonTypes) {
1717
+ PersonTypes["GLAMGIRL"] = "glamgirl";
1718
+ PersonTypes["BFLU"] = "bflu";
1719
+ PersonTypes["NONE"] = "none";
1720
+ })(exports.PersonTypes || (exports.PersonTypes = {}));
1721
+
1722
+ exports.ProductSpents = void 0;
1723
+ (function (ProductSpents) {
1724
+ ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
1725
+ ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
1726
+ ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
1727
+ ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
1728
+ ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
1729
+ ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
1730
+ })(exports.ProductSpents || (exports.ProductSpents = {}));
1731
+
1732
+ exports.UserType = void 0;
1733
+ (function (UserType) {
1734
+ UserType["B2C"] = "Cliente Transacional";
1735
+ UserType["GlamGirl"] = "Glamgirl";
1736
+ UserType["MensBoy"] = "Mensboy";
1737
+ UserType["B2B"] = "Company";
1738
+ UserType["Collaborator"] = "Funcion\u00E1rio";
1739
+ UserType["Influencer"] = "Influencer";
1740
+ })(exports.UserType || (exports.UserType = {}));
1741
+
1742
+ class Lead extends BaseModel {
1743
+ static get identifiersFields() {
1744
+ return ['id'];
1705
1745
  }
1706
- }
1707
- DebugHelper.logs$ = new Subject();
1708
- DebugHelper.traces$ = new Subject();
1709
- DebugHelper.errors$ = new Subject();
1710
- DebugHelper.isDebuggable = isDebuggable;
1746
+ }
1711
1747
 
1712
- function Debug(opts) {
1713
- return function (target) {
1714
- DebugDecoratorHelper.set(target.prototype, opts);
1715
- };
1748
+ class Edition extends BaseModel {
1749
+ static get identifiersFields() {
1750
+ return ['id', 'subscriptionId'];
1751
+ }
1716
1752
  }
1717
1753
 
1718
- const ASYNC_IDENTIFIER = 'async';
1719
- function Log(options = {}) {
1720
- return Trace(Object.assign({ level: 'log' }, options));
1721
- }
1722
- function Trace(options = {}) {
1723
- return function (target, propertyKey, propertyDescriptor) {
1724
- const method = propertyDescriptor.value;
1725
- const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
1726
- const args = {
1727
- options,
1728
- method,
1729
- target,
1730
- propertyKey,
1731
- propertyDescriptor,
1732
- };
1733
- propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
1734
- return propertyDescriptor;
1735
- };
1736
- }
1737
- const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
1738
- if (!target.debug)
1739
- target.debug = DebugHelper.for(target, propertyKey);
1740
- return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
1741
- };
1742
- const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
1743
- return function (...args) {
1744
- return new Promise((resolve, reject) => {
1745
- const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
1746
- return method
1747
- .apply(this, args)
1748
- .then((result) => {
1749
- if (options.callbackFn) {
1750
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1751
- }
1752
- if (lodash.get(options, 'level', '') === 'log') {
1753
- debug.log({ req: args, res: result === undefined ? 'void' : result });
1754
- }
1755
- return resolve(result);
1756
- })
1757
- .catch((error) => {
1758
- debug.error({ req: args, res: error, stack: error.stack });
1759
- return reject(error);
1760
- });
1761
- });
1762
- };
1763
- };
1764
- const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
1765
- return function (...args) {
1766
- const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
1767
- let result;
1768
- try {
1769
- result = method.apply(this, args);
1770
- if (options.callbackFn)
1771
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1772
- if (lodash.get(options, 'level', '') === 'log') {
1773
- debug.log({ req: args, res: result === undefined ? 'void' : result });
1774
- }
1775
- return result;
1776
- }
1777
- catch (error) {
1778
- if (error instanceof Error)
1779
- debug.error({ req: args, res: error, stack: error.stack });
1780
- throw error;
1781
- }
1782
- };
1783
- };
1754
+ exports.BillingStatus = void 0;
1755
+ (function (BillingStatus) {
1756
+ BillingStatus["PAYED"] = "PAGO";
1757
+ })(exports.BillingStatus || (exports.BillingStatus = {}));
1784
1758
 
1785
- function is(value) {
1786
- return value;
1787
- }
1759
+ exports.EditionStatus = void 0;
1760
+ (function (EditionStatus) {
1761
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
1762
+ EditionStatus["SHIPPED"] = "Enviado";
1763
+ })(exports.EditionStatus || (exports.EditionStatus = {}));
1788
1764
 
1789
- const isUUID = (value) => 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);
1765
+ exports.PaymentType = void 0;
1766
+ (function (PaymentType) {
1767
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
1768
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
1769
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
1770
+ })(exports.PaymentType || (exports.PaymentType = {}));
1790
1771
 
1791
- class Base {
1792
- constructor(...args) {
1793
- Object.assign(this, ...args);
1794
- }
1772
+ exports.Plans = void 0;
1773
+ (function (Plans) {
1774
+ Plans["SELECT"] = "SELECT";
1775
+ Plans["PRIME"] = "PRIME";
1776
+ Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
1777
+ Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
1778
+ })(exports.Plans || (exports.Plans = {}));
1779
+
1780
+ exports.Status = void 0;
1781
+ (function (Status) {
1782
+ Status["ACTIVE"] = "active";
1783
+ Status["CANCELLED"] = "Cancelado";
1784
+ })(exports.Status || (exports.Status = {}));
1785
+
1786
+ class PaymentTransaction extends BaseModel {
1795
1787
  }
1796
1788
 
1797
- const parseDateTime = (value) => {
1798
- if (!lodash.isString(value))
1799
- return value;
1800
- if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
1801
- !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
1802
- return value;
1803
- const date = dateFns.parseISO(value);
1804
- if (isNaN(date.getTime()))
1805
- return value;
1806
- return date;
1807
- };
1789
+ class Payment extends BaseModel {
1790
+ static get identifiersFields() {
1791
+ return ['id'];
1792
+ }
1793
+ }
1794
+ tslib.__decorate([
1795
+ classTransformer.Type(() => PaymentTransaction),
1796
+ tslib.__metadata("design:type", PaymentTransaction)
1797
+ ], Payment.prototype, "transaction", void 0);
1798
+
1799
+ class SubscriptionPayment extends BaseModel {
1800
+ static get identifiersFields() {
1801
+ return ['id', 'subscriptionId'];
1802
+ }
1803
+ }
1804
+ tslib.__decorate([
1805
+ classTransformer.Type(() => Payment),
1806
+ tslib.__metadata("design:type", Payment)
1807
+ ], SubscriptionPayment.prototype, "payment", void 0);
1808
1808
 
1809
1809
  class Coupon extends BaseModel {
1810
1810
  get isInfluencer() {
@@ -5047,11 +5047,6 @@ tslib.__decorate([
5047
5047
  ], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
5048
5048
 
5049
5049
  class VariantHasuraGraphQL extends Variant {
5050
- constructor() {
5051
- super(...arguments);
5052
- this.name = '';
5053
- this.hasVariants = false;
5054
- }
5055
5050
  }
5056
5051
 
5057
5052
  class ProductErrorsHasuraGraphQL extends ProductErrors {
@@ -5925,7 +5920,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5925
5920
  interceptors,
5926
5921
  fields: [],
5927
5922
  });
5928
- this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, is(lodash.omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id']))), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
5923
+ this.bindReviewToModel = (plain) => ProductReview.toInstance(Object.assign(Object.assign({}, is(lodash.omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id']))), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
5929
5924
  this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, is(lodash.omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId']))), { person_id: review.personId, order_id: review.orderId }));
5930
5925
  const commonFields = [
5931
5926
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
@@ -6440,11 +6435,11 @@ tslib.__decorate([
6440
6435
  tslib.__metadata("design:returntype", Promise)
6441
6436
  ], ProductHasuraGraphQLRepository.prototype, "cleanShoppingCountFromIds", null);
6442
6437
 
6443
- class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
6438
+ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
6444
6439
  constructor({ endpoint, authOptions, interceptors, }) {
6445
6440
  super({
6446
6441
  tableName: 'product_review',
6447
- model: ProductReviews,
6442
+ model: ProductReview,
6448
6443
  endpoint,
6449
6444
  authOptions,
6450
6445
  interceptors,
@@ -6497,13 +6492,13 @@ tslib.__decorate([
6497
6492
  tslib.__metadata("design:type", Function),
6498
6493
  tslib.__metadata("design:paramtypes", [Number]),
6499
6494
  tslib.__metadata("design:returntype", void 0)
6500
- ], ProductReviewsHasuraGraphQLRepository.prototype, "aproveReview", null);
6495
+ ], ProductReviewHasuraGraphQLRepository.prototype, "aproveReview", null);
6501
6496
  tslib.__decorate([
6502
6497
  Log(),
6503
6498
  tslib.__metadata("design:type", Function),
6504
6499
  tslib.__metadata("design:paramtypes", [Number]),
6505
6500
  tslib.__metadata("design:returntype", void 0)
6506
- ], ProductReviewsHasuraGraphQLRepository.prototype, "disaproveReview", null);
6501
+ ], ProductReviewHasuraGraphQLRepository.prototype, "disaproveReview", null);
6507
6502
 
6508
6503
  class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
6509
6504
  constructor({ endpoint, authOptions, interceptors, }) {
@@ -7639,8 +7634,8 @@ exports.ProductErrorsHasuraGraphQLRepository = ProductErrorsHasuraGraphQLReposit
7639
7634
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
7640
7635
  exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
7641
7636
  exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
7642
- exports.ProductReviews = ProductReviews;
7643
- exports.ProductReviewsHasuraGraphQLRepository = ProductReviewsHasuraGraphQLRepository;
7637
+ exports.ProductReview = ProductReview;
7638
+ exports.ProductReviewHasuraGraphQLRepository = ProductReviewHasuraGraphQLRepository;
7644
7639
  exports.ProductStockNotification = ProductStockNotification;
7645
7640
  exports.ProductStockNotificationHasuraGraphQLRepository = ProductStockNotificationHasuraGraphQLRepository;
7646
7641
  exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
@@ -7692,10 +7687,13 @@ exports.VertexAxiosAdapter = VertexAxiosAdapter;
7692
7687
  exports.WeakPasswordError = WeakPasswordError;
7693
7688
  exports.Wishlist = Wishlist;
7694
7689
  exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
7690
+ exports.getClass = getClass;
7695
7691
  exports.is = is;
7696
7692
  exports.isDebuggable = isDebuggable;
7697
7693
  exports.isUUID = isUUID;
7698
7694
  exports.parseDateTime = parseDateTime;
7695
+ exports.registerClass = registerClass;
7696
+ exports.resolveClass = resolveClass;
7699
7697
  exports.withCreateFirestore = withCreateFirestore;
7700
7698
  exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
7701
7699
  exports.withCrudFirestore = withCrudFirestore;