@infrab4a/connect 4.14.0-beta.0 → 4.14.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.
package/index.cjs.js CHANGED
@@ -6400,130 +6400,50 @@ tslib.__decorate([
6400
6400
  tslib.__metadata("design:returntype", Promise)
6401
6401
  ], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
6402
6402
 
6403
- const { SearchServiceClient } = require('@google-cloud/discoveryengine').v1beta;
6404
- // import { SearchServiceClient } from '@google-cloud/discoveryengine'
6405
- class DiscoveryEngineSearch {
6406
- constructor(configuration) {
6407
- // console.log('DiscoveryEngineSearch', configuration)
6408
- this.config = configuration;
6409
- this.parentEngine = `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`;
6410
- this.parentDataStore = `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents`;
6411
- this.client = new SearchServiceClient({
6412
- apiEndpoint: configuration.apiEndpoint,
6413
- credentials: configuration.credentials,
6414
- });
6415
- this.servingConfig = this.client.projectLocationCollectionDataStoreServingConfigPath(configuration.projectId, configuration.location, configuration.collectionId, configuration.dataStoreId, configuration.servingConfigId);
6416
- }
6417
- save(data) {
6418
- throw new Error('Method not implemented.');
6419
- }
6420
- async query(term, total, gender) {
6421
- const defaultFilter = gender ? `gender: ANY(${gender}, "unisex")` : '';
6422
- const response = await this.client.search({
6423
- pageSize: total,
6424
- query: term,
6425
- filter: defaultFilter,
6426
- languageCode: 'pt-BR',
6427
- servingConfig: this.servingConfig,
6428
- relevanceThreshold: 'MEDIUM',
6429
- }, {
6430
- autoPaginate: false,
6431
- });
6432
- return this.resultProductMapper(response);
6403
+ class VertexAxiosAdapter {
6404
+ constructor(config) {
6405
+ this.config = config;
6406
+ this.logger = DebugHelper.from(this);
6433
6407
  }
6434
- async get(id) {
6435
- const request = {
6436
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6437
- };
6438
- const response = await this.client.getDocument(request);
6439
- const document = JSON.parse(response[0].jsonData);
6440
- return document;
6441
- }
6442
- async create(product) {
6443
- const request = {
6444
- parent: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`,
6445
- allowMissing: true,
6446
- document: {
6447
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${product.id.toString()}`,
6448
- jsonData: JSON.stringify(product),
6449
- data: 'jsonData',
6450
- },
6451
- };
6452
- // Run request
6453
- const response = await this.client.updateDocument(request);
6454
- console.log(response);
6455
- }
6456
- async update(id, product) {
6457
- const request = {
6458
- parent: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`,
6459
- allowMissing: false,
6460
- document: {
6461
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6462
- jsonData: JSON.stringify(product),
6463
- data: 'jsonData',
6408
+ async query(searchTerm, total, gender) {
6409
+ const logger = this.logger.with('query');
6410
+ const req = {
6411
+ url: `${this.config.url}/search`,
6412
+ method: 'POST',
6413
+ responseType: 'json',
6414
+ headers: {
6415
+ Accept: 'application/json',
6416
+ // 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
6417
+ // Authorization: `ApiKey ${this.config.credential}`,
6464
6418
  },
6419
+ data: { searchTerm, total, gender },
6465
6420
  };
6466
- // Run request
6467
- await this.client.updateDocument(request);
6421
+ try {
6422
+ const { data } = await axios__default["default"](req);
6423
+ console.log('response vertex axios', data);
6424
+ // const res = {
6425
+ // total: data.hits.total.value,
6426
+ // hits: data.hits.hits,
6427
+ // }
6428
+ // logger.log({ req, res })
6429
+ return data;
6430
+ }
6431
+ catch (error) {
6432
+ logger.error({ req, res: error });
6433
+ throw error;
6434
+ }
6468
6435
  }
6469
- async delete(id) {
6470
- const request = {
6471
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6472
- };
6473
- await this.client.deleteDocument(request);
6436
+ get(id) {
6437
+ throw new Error('Method not implemented.');
6474
6438
  }
6475
- productMapper(product) {
6476
- var _a, _b;
6477
- const image = product.miniatures && product.miniatures.length ? product.miniatures[0] : null;
6478
- return {
6479
- id: product.id.toString(),
6480
- miniatures: image,
6481
- icon: image,
6482
- name: product.name,
6483
- brand: ((_a = product.brand) === null || _a === void 0 ? void 0 : _a.toString().trim()) ? (_b = product.brand) === null || _b === void 0 ? void 0 : _b.toString().trim() : null,
6484
- ean: product.EAN,
6485
- sku: product.sku,
6486
- slug: product.slug,
6487
- published: product.published,
6488
- gender: product.gender,
6489
- stock: product.stock.quantity,
6490
- rating: product.rate,
6491
- shoppingCount: product.shoppingCount,
6492
- description: product.description.description,
6493
- fullPrice: product.fullPrice,
6494
- price: product.price.price,
6495
- subscriberPrice: product.subscriberPrice,
6496
- outlet: product.outlet,
6497
- createdAt: product.createdAt,
6498
- };
6439
+ save(data) {
6440
+ throw new Error('Method not implemented.');
6499
6441
  }
6500
- resultProductMapper(result) {
6501
- return result[0].length
6502
- ? result[0].map((result) => {
6503
- var _a, _b;
6504
- return {
6505
- id: result.document.structData.fields.id.stringValue,
6506
- name: result.document.structData.fields.name.stringValue,
6507
- brand: result.document.structData.fields.brand.stringValue,
6508
- stock: (_a = result.document.structData.fields.stock) === null || _a === void 0 ? void 0 : _a.numberValue,
6509
- rating: (_b = result.document.structData.fields.rating) === null || _b === void 0 ? void 0 : _b.stringValue,
6510
- // gender: result.document.structData.fields.gender.stringValue,
6511
- // createdAt: result.document.structData.fields.createdAt.stringValue,
6512
- // description: result.document.structData.fields.gender.stringValue,
6513
- // ean: result.document.structData.fields.gender.stringValue,
6514
- // fullPrice: result.document.structData.fields.gender.stringValue,
6515
- // icon: result.document.structData.fields.gender.stringValue,
6516
- // outlet: result.document.structData.fields.gender.stringValue,
6517
- // slug: result.document.structData.fields.gender.stringValue,
6518
- // price: result.document.structData.fields.gender.stringValue,
6519
- // published: result.document.structData.fields.gender.stringValue,
6520
- // shoppingCount: result.document.structData.fields.gender.stringValue,
6521
- // sku: result.document.structData.fields.gender.stringValue,
6522
- // subscriberPrice: result.document.structData.fields.gender.stringValue,
6523
- // miniatures: result.document.structData.fields.gender.stringValue,
6524
- };
6525
- })
6526
- : [];
6442
+ update(id, data) {
6443
+ throw new Error('Method not implemented.');
6444
+ }
6445
+ delete(id) {
6446
+ throw new Error('Method not implemented.');
6527
6447
  }
6528
6448
  }
6529
6449
 
@@ -6726,7 +6646,6 @@ exports.CouponFirestoreRepository = CouponFirestoreRepository;
6726
6646
  exports.Debug = Debug;
6727
6647
  exports.DebugDecoratorHelper = DebugDecoratorHelper;
6728
6648
  exports.DebugHelper = DebugHelper;
6729
- exports.DiscoveryEngineSearch = DiscoveryEngineSearch;
6730
6649
  exports.DuplicatedResultsError = DuplicatedResultsError;
6731
6650
  exports.Edition = Edition;
6732
6651
  exports.Filter = Filter;
@@ -6801,6 +6720,7 @@ exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreReposit
6801
6720
  exports.Variant = Variant;
6802
6721
  exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
6803
6722
  exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
6723
+ exports.VertexAxiosAdapter = VertexAxiosAdapter;
6804
6724
  exports.WeakPasswordError = WeakPasswordError;
6805
6725
  exports.Wishlist = Wishlist;
6806
6726
  exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
package/index.esm.js CHANGED
@@ -6394,130 +6394,50 @@ __decorate([
6394
6394
  __metadata("design:returntype", Promise)
6395
6395
  ], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
6396
6396
 
6397
- const { SearchServiceClient } = require('@google-cloud/discoveryengine').v1beta;
6398
- // import { SearchServiceClient } from '@google-cloud/discoveryengine'
6399
- class DiscoveryEngineSearch {
6400
- constructor(configuration) {
6401
- // console.log('DiscoveryEngineSearch', configuration)
6402
- this.config = configuration;
6403
- this.parentEngine = `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`;
6404
- this.parentDataStore = `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents`;
6405
- this.client = new SearchServiceClient({
6406
- apiEndpoint: configuration.apiEndpoint,
6407
- credentials: configuration.credentials,
6408
- });
6409
- this.servingConfig = this.client.projectLocationCollectionDataStoreServingConfigPath(configuration.projectId, configuration.location, configuration.collectionId, configuration.dataStoreId, configuration.servingConfigId);
6410
- }
6411
- save(data) {
6412
- throw new Error('Method not implemented.');
6413
- }
6414
- async query(term, total, gender) {
6415
- const defaultFilter = gender ? `gender: ANY(${gender}, "unisex")` : '';
6416
- const response = await this.client.search({
6417
- pageSize: total,
6418
- query: term,
6419
- filter: defaultFilter,
6420
- languageCode: 'pt-BR',
6421
- servingConfig: this.servingConfig,
6422
- relevanceThreshold: 'MEDIUM',
6423
- }, {
6424
- autoPaginate: false,
6425
- });
6426
- return this.resultProductMapper(response);
6397
+ class VertexAxiosAdapter {
6398
+ constructor(config) {
6399
+ this.config = config;
6400
+ this.logger = DebugHelper.from(this);
6427
6401
  }
6428
- async get(id) {
6429
- const request = {
6430
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6431
- };
6432
- const response = await this.client.getDocument(request);
6433
- const document = JSON.parse(response[0].jsonData);
6434
- return document;
6435
- }
6436
- async create(product) {
6437
- const request = {
6438
- parent: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`,
6439
- allowMissing: true,
6440
- document: {
6441
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${product.id.toString()}`,
6442
- jsonData: JSON.stringify(product),
6443
- data: 'jsonData',
6444
- },
6445
- };
6446
- // Run request
6447
- const response = await this.client.updateDocument(request);
6448
- console.log(response);
6449
- }
6450
- async update(id, product) {
6451
- const request = {
6452
- parent: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/engines/${this.config.dataStoreId}`,
6453
- allowMissing: false,
6454
- document: {
6455
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6456
- jsonData: JSON.stringify(product),
6457
- data: 'jsonData',
6402
+ async query(searchTerm, total, gender) {
6403
+ const logger = this.logger.with('query');
6404
+ const req = {
6405
+ url: `${this.config.url}/search`,
6406
+ method: 'POST',
6407
+ responseType: 'json',
6408
+ headers: {
6409
+ Accept: 'application/json',
6410
+ // 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
6411
+ // Authorization: `ApiKey ${this.config.credential}`,
6458
6412
  },
6413
+ data: { searchTerm, total, gender },
6459
6414
  };
6460
- // Run request
6461
- await this.client.updateDocument(request);
6415
+ try {
6416
+ const { data } = await axios(req);
6417
+ console.log('response vertex axios', data);
6418
+ // const res = {
6419
+ // total: data.hits.total.value,
6420
+ // hits: data.hits.hits,
6421
+ // }
6422
+ // logger.log({ req, res })
6423
+ return data;
6424
+ }
6425
+ catch (error) {
6426
+ logger.error({ req, res: error });
6427
+ throw error;
6428
+ }
6462
6429
  }
6463
- async delete(id) {
6464
- const request = {
6465
- name: `projects/${this.config.projectId}/locations/${this.config.location}/collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents/${id}`,
6466
- };
6467
- await this.client.deleteDocument(request);
6430
+ get(id) {
6431
+ throw new Error('Method not implemented.');
6468
6432
  }
6469
- productMapper(product) {
6470
- var _a, _b;
6471
- const image = product.miniatures && product.miniatures.length ? product.miniatures[0] : null;
6472
- return {
6473
- id: product.id.toString(),
6474
- miniatures: image,
6475
- icon: image,
6476
- name: product.name,
6477
- brand: ((_a = product.brand) === null || _a === void 0 ? void 0 : _a.toString().trim()) ? (_b = product.brand) === null || _b === void 0 ? void 0 : _b.toString().trim() : null,
6478
- ean: product.EAN,
6479
- sku: product.sku,
6480
- slug: product.slug,
6481
- published: product.published,
6482
- gender: product.gender,
6483
- stock: product.stock.quantity,
6484
- rating: product.rate,
6485
- shoppingCount: product.shoppingCount,
6486
- description: product.description.description,
6487
- fullPrice: product.fullPrice,
6488
- price: product.price.price,
6489
- subscriberPrice: product.subscriberPrice,
6490
- outlet: product.outlet,
6491
- createdAt: product.createdAt,
6492
- };
6433
+ save(data) {
6434
+ throw new Error('Method not implemented.');
6493
6435
  }
6494
- resultProductMapper(result) {
6495
- return result[0].length
6496
- ? result[0].map((result) => {
6497
- var _a, _b;
6498
- return {
6499
- id: result.document.structData.fields.id.stringValue,
6500
- name: result.document.structData.fields.name.stringValue,
6501
- brand: result.document.structData.fields.brand.stringValue,
6502
- stock: (_a = result.document.structData.fields.stock) === null || _a === void 0 ? void 0 : _a.numberValue,
6503
- rating: (_b = result.document.structData.fields.rating) === null || _b === void 0 ? void 0 : _b.stringValue,
6504
- // gender: result.document.structData.fields.gender.stringValue,
6505
- // createdAt: result.document.structData.fields.createdAt.stringValue,
6506
- // description: result.document.structData.fields.gender.stringValue,
6507
- // ean: result.document.structData.fields.gender.stringValue,
6508
- // fullPrice: result.document.structData.fields.gender.stringValue,
6509
- // icon: result.document.structData.fields.gender.stringValue,
6510
- // outlet: result.document.structData.fields.gender.stringValue,
6511
- // slug: result.document.structData.fields.gender.stringValue,
6512
- // price: result.document.structData.fields.gender.stringValue,
6513
- // published: result.document.structData.fields.gender.stringValue,
6514
- // shoppingCount: result.document.structData.fields.gender.stringValue,
6515
- // sku: result.document.structData.fields.gender.stringValue,
6516
- // subscriberPrice: result.document.structData.fields.gender.stringValue,
6517
- // miniatures: result.document.structData.fields.gender.stringValue,
6518
- };
6519
- })
6520
- : [];
6436
+ update(id, data) {
6437
+ throw new Error('Method not implemented.');
6438
+ }
6439
+ delete(id) {
6440
+ throw new Error('Method not implemented.');
6521
6441
  }
6522
6442
  }
6523
6443
 
@@ -6566,4 +6486,4 @@ class ProductsVertexSearch {
6566
6486
  }
6567
6487
  }
6568
6488
 
6569
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DiscoveryEngineSearch, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
6489
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.14.0-beta.0",
3
+ "version": "4.14.0-beta.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -9,7 +9,6 @@
9
9
  "url": "https://github.com/B4AGroup/b4a-firebase-libs"
10
10
  },
11
11
  "dependencies": {
12
- "@google-cloud/discoveryengine": "^1.14.0",
13
12
  "axios": "^0.27.2",
14
13
  "class-transformer": "^0.5.1",
15
14
  "date-fns": "^2.28.0",
@@ -1,19 +0,0 @@
1
- import { Product } from '../../../domain';
2
- import { ProductSearch, VertexConfig } from '../types';
3
- import { VertexSearchAdapter } from './vertex-ai-search-adapter';
4
- export declare class DiscoveryEngineSearch implements VertexSearchAdapter<ProductSearch> {
5
- private config;
6
- private parentEngine;
7
- private parentDataStore;
8
- private servingConfig;
9
- private client;
10
- constructor(configuration: VertexConfig);
11
- save(data: Product): void;
12
- query(term: string, total: number, gender?: string): Promise<ProductSearch[]>;
13
- get(id: string): Promise<any>;
14
- create(product: Product): Promise<void>;
15
- update(id: string, product: Product): Promise<void>;
16
- delete(id: string): Promise<void>;
17
- private productMapper;
18
- private resultProductMapper;
19
- }
@@ -1,2 +1,2 @@
1
- export * from './discovery-engine-adapter';
2
- export * from './vertex-ai-search-adapter';
1
+ export * from './vertex-ai-search.adapter';
2
+ export * from './vertex-axios.adapter';
@@ -0,0 +1,14 @@
1
+ import { Product } from '../../../domain';
2
+ import { ProductSearch } from '../types';
3
+ import { VertexSearchConfig } from '../types/axios-vertex-search-config';
4
+ import { VertexSearchAdapter } from './vertex-ai-search.adapter';
5
+ export declare class VertexAxiosAdapter implements VertexSearchAdapter<ProductSearch> {
6
+ private readonly config;
7
+ private logger;
8
+ constructor(config: VertexSearchConfig);
9
+ query(searchTerm: string, total: number, gender?: String): Promise<ProductSearch[]>;
10
+ get(id: string): Promise<ProductSearch>;
11
+ save(data: Product): void;
12
+ update(id: string, data: Product): void;
13
+ delete(id: string): Promise<void>;
14
+ }
@@ -0,0 +1,4 @@
1
+ export type VertexSearchConfig = {
2
+ url: string;
3
+ token?: string;
4
+ };
@@ -1,3 +1,2 @@
1
+ export * from './axios-vertex-search-config';
1
2
  export * from './product-search';
2
- export * from './vertex-config';
3
- export * from './vertex-search-result';
@@ -1,23 +0,0 @@
1
- export type VertexConfig = {
2
- apiEndpoint: string;
3
- credentials: {
4
- type: string;
5
- project_id: string;
6
- private_key_id: string;
7
- private_key: string;
8
- client_email: string;
9
- client_id: string;
10
- auth_uri: string;
11
- token_uri: string;
12
- auth_provider_x509_cert_url: string;
13
- client_x509_cert_url: string;
14
- apiKey: string;
15
- authDomain: string;
16
- };
17
- projectId: string;
18
- location: string;
19
- dataStoreId: string;
20
- collectionId: string;
21
- engine: string;
22
- servingConfigId: string;
23
- };
@@ -1,18 +0,0 @@
1
- import { protos } from '@google-cloud/discoveryengine';
2
- export type VertexSearchResult<T> = [
3
- VertexResult<T>[],
4
- protos.google.cloud.discoveryengine.v1.ISearchRequest | null,
5
- protos.google.cloud.discoveryengine.v1.ISearchResponse
6
- ];
7
- type VertexResult<T> = {
8
- id?: string | null;
9
- document?: {
10
- structData: {
11
- fields: {
12
- [P in keyof T]: any;
13
- };
14
- };
15
- };
16
- chunk?: protos.google.cloud.discoveryengine.v1.IChunk;
17
- };
18
- export {};