@infrab4a/connect-nestjs 1.5.1-beta.1 → 1.5.1-beta.3

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 (3) hide show
  1. package/index.cjs.js +24 -11
  2. package/index.esm.js +24 -11
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -320,18 +320,18 @@ class ProductVertexHelper {
320
320
  static resultProductMapper(result) {
321
321
  return result[0].length
322
322
  ? result[0].map((result) => {
323
- var _a, _b, _c, _d, _e, _f, _g;
323
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
324
324
  return {
325
325
  id: (_a = result.document) === null || _a === void 0 ? void 0 : _a.structData.fields.id.stringValue,
326
326
  name: (_b = result.document) === null || _b === void 0 ? void 0 : _b.structData.fields.name.stringValue,
327
- brand: (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand.stringValue,
328
- stock: (_e = (_d = result.document) === null || _d === void 0 ? void 0 : _d.structData.fields.stock) === null || _e === void 0 ? void 0 : _e.numberValue,
329
- rating: (_g = (_f = result.document) === null || _f === void 0 ? void 0 : _f.structData.fields.rating) === null || _g === void 0 ? void 0 : _g.stringValue,
330
- gender: result.document.structData.fields.gender.stringValue,
331
- slug: result.document.structData.fields.slug.stringValue,
332
- sku: result.document.structData.fields.sku.stringValue,
333
- ean: result.document.structData.fields.ean.stringValue,
334
- description: result.document.structData.fields.description.stringValue,
327
+ brand: (_d = (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand) === null || _d === void 0 ? void 0 : _d.stringValue,
328
+ stock: (_f = (_e = result.document) === null || _e === void 0 ? void 0 : _e.structData.fields.stock) === null || _f === void 0 ? void 0 : _f.numberValue,
329
+ rating: (_h = (_g = result.document) === null || _g === void 0 ? void 0 : _g.structData.fields.rating) === null || _h === void 0 ? void 0 : _h.stringValue,
330
+ gender: (_k = (_j = result.document) === null || _j === void 0 ? void 0 : _j.structData.fields.gender) === null || _k === void 0 ? void 0 : _k.stringValue,
331
+ slug: (_m = (_l = result.document) === null || _l === void 0 ? void 0 : _l.structData.fields.slug) === null || _m === void 0 ? void 0 : _m.stringValue,
332
+ sku: (_p = (_o = result.document) === null || _o === void 0 ? void 0 : _o.structData.fields.sku) === null || _p === void 0 ? void 0 : _p.stringValue,
333
+ ean: (_r = (_q = result.document) === null || _q === void 0 ? void 0 : _q.structData.fields.ean) === null || _r === void 0 ? void 0 : _r.stringValue,
334
+ description: (_t = (_s = result.document) === null || _s === void 0 ? void 0 : _s.structData.fields.description) === null || _t === void 0 ? void 0 : _t.stringValue,
335
335
  };
336
336
  })
337
337
  : [];
@@ -884,10 +884,23 @@ NestVertexSeachModule = NestVertexSeachModule_1 = __decorate([
884
884
  common.Module({
885
885
  providers: [
886
886
  exports.DiscoveryEngineVertexAdapter,
887
+ {
888
+ provide: 'DiscoveryEngineVertexAdapter',
889
+ useFactory: (config) => {
890
+ if (!config.credentials.private_key)
891
+ return null;
892
+ return new exports.DiscoveryEngineVertexAdapter(config);
893
+ },
894
+ inject: [VERTEX_CONFIG],
895
+ },
887
896
  {
888
897
  provide: connect.ProductsVertexSearch,
889
- useFactory: (adapter) => new connect.ProductsVertexSearch(adapter),
890
- inject: [exports.DiscoveryEngineVertexAdapter],
898
+ useFactory: (adapter) => {
899
+ if (!adapter)
900
+ return null;
901
+ return new connect.ProductsVertexSearch(adapter);
902
+ },
903
+ inject: ['DiscoveryEngineVertexAdapter'],
891
904
  },
892
905
  ],
893
906
  exports: [connect.ProductsVertexSearch],
package/index.esm.js CHANGED
@@ -316,18 +316,18 @@ class ProductVertexHelper {
316
316
  static resultProductMapper(result) {
317
317
  return result[0].length
318
318
  ? result[0].map((result) => {
319
- var _a, _b, _c, _d, _e, _f, _g;
319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
320
320
  return {
321
321
  id: (_a = result.document) === null || _a === void 0 ? void 0 : _a.structData.fields.id.stringValue,
322
322
  name: (_b = result.document) === null || _b === void 0 ? void 0 : _b.structData.fields.name.stringValue,
323
- brand: (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand.stringValue,
324
- stock: (_e = (_d = result.document) === null || _d === void 0 ? void 0 : _d.structData.fields.stock) === null || _e === void 0 ? void 0 : _e.numberValue,
325
- rating: (_g = (_f = result.document) === null || _f === void 0 ? void 0 : _f.structData.fields.rating) === null || _g === void 0 ? void 0 : _g.stringValue,
326
- gender: result.document.structData.fields.gender.stringValue,
327
- slug: result.document.structData.fields.slug.stringValue,
328
- sku: result.document.structData.fields.sku.stringValue,
329
- ean: result.document.structData.fields.ean.stringValue,
330
- description: result.document.structData.fields.description.stringValue,
323
+ brand: (_d = (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand) === null || _d === void 0 ? void 0 : _d.stringValue,
324
+ stock: (_f = (_e = result.document) === null || _e === void 0 ? void 0 : _e.structData.fields.stock) === null || _f === void 0 ? void 0 : _f.numberValue,
325
+ rating: (_h = (_g = result.document) === null || _g === void 0 ? void 0 : _g.structData.fields.rating) === null || _h === void 0 ? void 0 : _h.stringValue,
326
+ gender: (_k = (_j = result.document) === null || _j === void 0 ? void 0 : _j.structData.fields.gender) === null || _k === void 0 ? void 0 : _k.stringValue,
327
+ slug: (_m = (_l = result.document) === null || _l === void 0 ? void 0 : _l.structData.fields.slug) === null || _m === void 0 ? void 0 : _m.stringValue,
328
+ sku: (_p = (_o = result.document) === null || _o === void 0 ? void 0 : _o.structData.fields.sku) === null || _p === void 0 ? void 0 : _p.stringValue,
329
+ ean: (_r = (_q = result.document) === null || _q === void 0 ? void 0 : _q.structData.fields.ean) === null || _r === void 0 ? void 0 : _r.stringValue,
330
+ description: (_t = (_s = result.document) === null || _s === void 0 ? void 0 : _s.structData.fields.description) === null || _t === void 0 ? void 0 : _t.stringValue,
331
331
  };
332
332
  })
333
333
  : [];
@@ -880,10 +880,23 @@ NestVertexSeachModule = NestVertexSeachModule_1 = __decorate([
880
880
  Module({
881
881
  providers: [
882
882
  DiscoveryEngineVertexAdapter,
883
+ {
884
+ provide: 'DiscoveryEngineVertexAdapter',
885
+ useFactory: (config) => {
886
+ if (!config.credentials.private_key)
887
+ return null;
888
+ return new DiscoveryEngineVertexAdapter(config);
889
+ },
890
+ inject: [VERTEX_CONFIG],
891
+ },
883
892
  {
884
893
  provide: ProductsVertexSearch,
885
- useFactory: (adapter) => new ProductsVertexSearch(adapter),
886
- inject: [DiscoveryEngineVertexAdapter],
894
+ useFactory: (adapter) => {
895
+ if (!adapter)
896
+ return null;
897
+ return new ProductsVertexSearch(adapter);
898
+ },
899
+ inject: ['DiscoveryEngineVertexAdapter'],
887
900
  },
888
901
  ],
889
902
  exports: [ProductsVertexSearch],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect-nestjs",
3
- "version": "1.5.1-beta.1",
3
+ "version": "1.5.1-beta.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },