Giter VIP home page Giter VIP logo

vendure-plus-issues's People

Contributors

koljam avatar michaelbromley avatar

Watchers

 avatar  avatar  avatar

Forkers

koljam

vendure-plus-issues's Issues

AdvancedSearch: Allow geolocation search

https://typesense.org/docs/0.23.1/api/geosearch.html

Usecase
Search by product location.

Suggestion
Add a type that fits the geopoint type from Typesense. This way we can add a custom mapping for this property. By adding searchable: true it should also add the inputs for lat, lng to the search input, to execute the required geo search query with typesense. From the reply geo_distance_meters should be mapped as well, to get information about the distance.

AdvancedSearchPlugin: every type server boots new Shop API keys are being created

We are using the AdvancedSearchPlugin for a while now with Google Cloud Run.
Every time the server boots new API keys are created with document.search permissions with the scope set to our collections. While this certainly is safe, it also creates a lot of API keys. Especially since we are booting quite often in the "serverless" set-up.

I think it would be a nice feature to be able to provide a Shop API client key through the Vendure configuration (where env vars can be injected), for the plugin to use.
We would need to set the collections scope to * (to account for new collections being created) but I don't see much risk there in our case.

Is this something that can be added in the suggested way or an alternative?

Giftcards can be applied 2 times

mutation {
  result: applyGiftCardToOrder(code: "K3QJRL") {
    ... on Order {
      totalWithTaxAfterGiftCard
      giftCardsApplied {
        code
      }
    }
    ... on ErrorResult {
      errorCode
      message
    }
  }
}

When running this mutation 2 times, I get this result:

{
  "data": {
    "result": {
      "totalWithTaxAfterGiftCard": 397900,
      "giftCardsApplied": [
        {
          "code": "K3QJRL"
        },
        {
          "code": "K3QJRL"
        }
      ]
    }
  }
}

The total amount is reduced by 2x the giftcard value. Subsequent mutations don't add a 3rd giftcard.
When running removeGiftCardFromOrder, both giftcards get removed.

Expected behaviour

The giftcard schould only be appliable once.

AdvancedSearch: Add a feature to hide products based on parameters

Usecase:

  • Specific: In order to publish an app to the iOS AppStore the app is required to allow blocking users. In this case, we can't display the products of another user anymore.
  • General: We need a feature, that hides products from a user. Maybe because he doesn't want to see it anymore, because it's blocked content, or maybe because of other parameters that are disallowing access.

Implementation with elasticsearch
In the past, we used the elasticsearch plugin like this:

// Overwrote the search query:
if (ctx.activeUserId) {
    const owner = await this.productOwnerService.getOwner(ctx);
    // Apply list of blocked users for search input
    searchInput.blocked = owner.customFields.blockedUsers ?? [];
    searchInput.blockedBy = owner.customFields.blockedBy ?? [];
}

const result = await this.elasticsearchService.search(ctx, searchInput, true);
// Inside the elasticsearch config:
mapQuery: (query: any, input: ExtendedSearchInput, searchConfig: DeepRequired<SearchConfig>) => {
    // Don't display product of a block user
    const { blocked = [], blockedBy = [] } = input;
    if (blocked.length > 0 || blockedBy.length > 0) {
        query.bool = {
            ...query.bool,
            must_not: {
                terms: {
                    'product-ownerId.keyword': [...blocked, ...blockedBy],
                },
            },
        };
    }
}

AdvancedSearch: Query middleware

The eleastic-search plugin enabled us to apply custom inputs to the search body send to the database.

Usecase:

  • We don't want users to be able to search grouped by variants, therefore we want to overwrite this input to always be false.
  • I want to add custom inputs based on the user/ip/location/etc. that is used for the search query request

Gift card plugin: Code/Amount text misalignment on taller template images in preview

Issue:
Text misalignment occurs for code or amount when using taller template images in the gift card plugin. The text aligns correctly for square-cropped templates. The misalignment is only present in the preview and does not affect the generated gift card images.

Additional Information:
A Loom video demonstrating the issue can be found here: Loom

Expected Behavior:
The code and amount text should align correctly with the selector on taller template images in the preview.

AdvancedSearch: ExternalIndex Search Error

When I configure an external index (I have included the documentation example to illustrate), we get the error below. This also makes that the search in the admin doesn't work.

The error happens when the query_by param is string array instead of a string.

export const cmsExternalIndex = new ExternalIndex<CmsArticleDocument>({
//...
fields: {
    id: {
      type: 'string',
      facet: false,
    },
    title: {
      type: 'string',
      facet: false,
    },
    slug: {
      type: 'string',
      facet: false,
    },
    breadcrumb: {
      type: 'str)ing[]',
      facet: false,
    },
  },

  createTypesenseSearchParams: (ctx, injector, input) => {
    const per_page = input.take ?? 10;
    const page =
      input.skip && 0 < input?.skip
        ? Math.ceil(input.skip / per_page) + 1
        : undefined;
    return {
      q: input.term,
      query_by: ['breadcrumb'], // <---
      prefix: input.prefixMode ?? false,
      per_page,
      page,
    };
  },
//...
}
query {
  searchExternal(input: {indexes: ["cms-articles"], term: "Home"}) {
   
    ... on CmsArticlesResponse {
      items {
        id
        title
        
        highlights {
          matchedTokens
        }
      }
    }
  }
}
{
  "errors": [
    {
      "stack": "GraphQLError: String cannot represent value: [\"Home\"]\n    at GraphQLScalarType.serializeString [as serialize] (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/type/scalars.js:173:9)\n    at completeLeafValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:653:37)\n    at completeValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:578:12)\n    at completeValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:556:21)\n    at /Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:620:25\n    at Array.map (<anonymous>)\n    at safeArrayFrom (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/jsutils/safeArrayFrom.js:36:23)\n    at completeListValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:607:53)\n    at completeValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:572:12)\n    at completeValue (/Users/ramon/Projects/Cleanqueen/source/cleanqueen-api/node_modules/graphql/execution/execute.js:556:21)",
      "message": "String cannot represent value: [\"Home\"]",
      "name": "GraphQLError",
      "locations": [

Captura de pantalla 2023-07-06 a la(s) 13 37 11

Error while issuing giftcard (error.entity-with-id-not-found)

The full error:

[worker] Error: error.entity-with-id-not-found
[worker]     at TransactionalConnection.getEntityOrThrowInternal (C:\Users\kolja\Documents\GitHub\venduretest\node_modules\@vendure\core\src\connection\transactional-connection.ts:250:19)
[worker]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[worker]     at async AssetService.update (C:\Users\kolja\Documents\GitHub\venduretest\node_modules\@vendure\core\src\service\services\asset.service.ts:315:23)
[worker]     at async GiftCardRenderer.createGiftCardImageAsset (C:\Users\kolja\Documents\GitHub\venduretest\libs\plugin-gift-card\src\lib\service\gift-card-renderer.ts:56:9)
[worker]     at async C:\Users\kolja\Documents\GitHub\venduretest\libs\plugin-gift-card\src\lib\service\gift-card.service.ts:105:37

The file gets created and is stored in the file system and it is accessible from the assets-page, but no email is sent and it is not visible on the giftcards page.

Steps to reproduce

  1. Follow Getting Started steps to install Vendure (use npx, database: mysql)
  2. Install dependencies using npm or yarn (tested both)
  3. Install Giftcard Plugin as described in docs
  4. Fix smaller issues like this one
  5. yarn dev or npm run dev
  6. Create a customer
  7. Enable "Image generation" in Admin UI
  8. Change a few parameters
  9. Issue a new Giftcard and see error in console

Versions tested
Node 18.13.0 and as a docker image: node:16 Docker image
yarn 1.22.19
npm 9.2.0
Vendure 1.9.1 and 1.9.2
Database mariadb:10.7

package.json

{
  "name": "venduretest",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev:server": "ts-node ./src/index.ts",
    "dev:worker": "ts-node ./src/index-worker.ts",
    "dev": "concurrently yarn:dev:*",
    "build": "tsc",
    "start:server": "node ./dist/index.js",
    "start:worker": "node ./dist/index-worker.js",
    "start": "concurrently yarn:start:*",
    "migration:generate": "ts-node migration generate",
    "migration:run": "ts-node migration run",
    "migration:revert": "ts-node migration revert"
  },
  "dependencies": {
    "@vendure-plus/gift-card-plugin": "^0.1.1",
    "@vendure/admin-ui-plugin": "^1.9.2",
    "@vendure/asset-server-plugin": "^1.9.2",
    "@vendure/core": "^1.9.2",
    "@vendure/email-plugin": "^1.9.2",
    "@vendure/ui-devkit": "^1.9.2",
    "dotenv": "16.0.3",
    "mysql": "2.18.1",
    "typescript": "4.3.5"
  },
  "devDependencies": {
    "concurrently": "7.6.0",
    "ts-node": "10.9.1"
  }
}

vendure-config.ts

import {
	dummyPaymentHandler,
	DefaultJobQueuePlugin,
	DefaultSearchPlugin,
	VendureConfig,
} from "@vendure/core";
import {defaultEmailHandlers, EmailPlugin} from "@vendure/email-plugin";
import {AssetServerPlugin} from "@vendure/asset-server-plugin";
import {AdminUiPlugin} from "@vendure/admin-ui-plugin";
import "dotenv/config";
import path from "path";

import {GiftCardPlugin} from "@vendure-plus/gift-card-plugin";
import {compileUiExtensions} from "@vendure/ui-devkit/compiler";
import {
	giftCardDeliveryConfirmationEmailHandler,
	giftCardEmailHandler,
} from "./plugins/giftcard/gift-card-email-handlers";

const IS_DEV = process.env.APP_ENV === "dev";

export const config: VendureConfig = {
	apiOptions: {
		port: 3000,
		adminApiPath: "admin-api",
		shopApiPath: "shop-api",
		// The following options are useful in development mode,
		// but are best turned off for production for security
		// reasons.
		...(IS_DEV
			? {
					adminApiPlayground: {
						settings: {"request.credentials": "include"} as any,
					},
					adminApiDebug: true,
					shopApiPlayground: {
						settings: {"request.credentials": "include"} as any,
					},
					shopApiDebug: true,
			  }
			: {}),
	},
	authOptions: {
		tokenMethod: ["bearer", "cookie"],
		superadminCredentials: {
			identifier: process.env.SUPERADMIN_USERNAME,
			password: process.env.SUPERADMIN_PASSWORD,
		},
		cookieOptions: {
			secret: process.env.COOKIE_SECRET,
		},
	},
	dbConnectionOptions: {
		type: "mysql",
		// See the README.md "Migrations" section for an explanation of
		// the `synchronize` and `migrations` options.
		synchronize: true,
		migrations: [path.join(__dirname, "./migrations/*.+(js|ts)")],
		logging: false,
		database: process.env.DB_NAME,
		host: process.env.DB_HOST,
		port: +process.env.DB_PORT,
		username: process.env.DB_USERNAME,
		password: process.env.DB_PASSWORD,
	},
	paymentOptions: {
		paymentMethodHandlers: [dummyPaymentHandler],
	},
	// When adding or altering custom field definitions, the database will
	// need to be updated. See the "Migrations" section in README.md.
	customFields: {},
	plugins: [
		GiftCardPlugin.init({
			defaultImagePaths: [
				// The plugin ships with some generic gift card images you can use to get started
				"node_modules/@vendure-plus/gift-card-plugin/assets/default-gift-card-black.jpg",
				"node_modules/@vendure-plus/gift-card-plugin/assets/default-gift-card-gold.jpg",
				"node_modules/@vendure-plus/gift-card-plugin/assets/default-gift-card-silver.jpg",
			],
			createDefaultGiftCardProduct: {
				// On bootstrap, a new ProductVariant will be created with the following details
				name: "Gift Card",
				sku: "GC01",
			},
		}),
		AdminUiPlugin.init({
			route: "admin",
			port: 3002,
			app: compileUiExtensions({
				outputPath: path.join(__dirname, "../admin-ui"),
				extensions: [GiftCardPlugin.uiExtensions],
				devMode: false,
			}),
		}),
		AssetServerPlugin.init({
			route: "assets",
			assetUploadDir: path.join(__dirname, "../static/assets"),
			// For local dev, the correct value for assetUrlPrefix should
			// be guessed correctly, but for production it will usually need
			// to be set manually to match your production url.
			assetUrlPrefix: IS_DEV
				? undefined
				: "https://www.my-shop.com/assets",
		}),
		DefaultJobQueuePlugin.init({useDatabaseForBuffer: true}),
		DefaultSearchPlugin.init({
			bufferUpdates: false,
			indexStockStatus: true,
		}),
		EmailPlugin.init({
			devMode: true,
			outputPath: path.join(__dirname, "../static/email/test-emails"),
			route: "mailbox",
			handlers: [
				...defaultEmailHandlers,
				giftCardEmailHandler,
				giftCardDeliveryConfirmationEmailHandler,
			],
			templatePath: path.join(__dirname, "../static/email/templates"),
			globalTemplateVars: {
				// The following variables will change depending on your storefront implementation.
				// Here we are assuming a storefront running at http://localhost:8080.
				fromAddress: '"example" <[email protected]>',
				verifyEmailAddressUrl: "http://localhost:8080/verify",
				passwordResetUrl: "http://localhost:8080/password-reset",
				changeEmailAddressUrl:
					"http://localhost:8080/verify-email-address-change",
			},
		}),
	],
};

AdvancedSearch: Hide indexed properties from the shop-api

This feature request is based on this issue for elasticsearch: vendure-ecommerce/vendure#1181

Is your feature request related to a problem? Please describe.
I want to map and search for some custom products properties without exposing the exact value to the shop-api api.

Usecases:

  • A hidden rank/weight that is applied to promote some products
  • A hidden product owner id (I never want to expose user ids)
  • Exact product locations

Describe the solution you'd like
Extend the custom mapping type with a new field:

type CustomMappingDefinition<Args extends any[], T extends CustomMappingTypes, R> = {
    public?: boolean; // **NEW** ( should default to true )
}

AdvancedSearch > and < operators

Currently the AdvancedSearch Plugin doesn't allow filtering based on greater than > less than < and in operator.

We'd like to implement range sliders for our customers to filter our products.
This is supported in Typesense and we currently do it via the instantsearch adapter, querying on a customMapping
image

It would be great to have a range filter implemented in the search query.

AdvancedSearchPlugin: updating a product results in a lot of 'update' tasks being created

At the moment we are using the advanced search plugin. We have bufferUpdates set to 'false' so that the search index gets updated when a product (variant) changes. I noticed that a product change triggers around 140 "update" jobs with empty "variantIds". When I enable bufferUpdates and manually run the pending jobs then only one update job is triggered with the corresponding variantId (see screenshot).

Our context:

  • We are running on Google Cloud Run
  • We use the Google Tasks plugin.
  • We have about 80 collections
Screenshot 2023-07-21 at 09 28 43

Gift Card UI uses rxjs 7 APIs

I have an issue setting up the extension. Angular has trouble compiling

Error: src/extensions/gift-card-plugin/components/layout-preview/layout-preview.component.ts:14:29 - error TS2305: Module '"rxjs"' has no exported member 'startWith'.
Error: src/extensions/gift-card-plugin/components/layout-preview/layout-preview.component.ts:14:63 - error TS2305: Module '"rxjs"' has no exported member 'tap'.

It seems like an older version of rxjs is used (6.x.x) but theses exports are from version 7.x.x

I am not sure how to proceed, if I add 7.x.x to my project some nextjs things become broken. Maybe you have a simple fix?
And if there is another place to ask these questions, let me know, i thought it wouldn't fit in the help channel.

AdvancedSearch: Querying topCollections with curated results throws error

When performing a search query and selecting the topCollections field, and curated results in the result set will cause an error to be thrown.

The root cause seems to be that we attempt some Math operations on the text_match field (which is normally a number) but for curated results this is not numeric, resulting in a "score" of NaN, which in turn causes the GraphQL layer to return:

{
  "errors": [
    {
      "message": "Int cannot represent non-integer value: NaN",
      "locations": [
        {
          "line": 42,
          "column": 7
        }
      ],
      "path": [
        "search",
        "topCollections",
        0,
        "score"
      ]
    }
  ]
}

Conditional gift card usage

In our aspect the gift card is a special promotion where the actual balance is tracked. Based on that idea we would like to set promotions like conditions on gift cards.

Examples:

  • gift card can be used for specific products, product variants, facetvalues
  • gift card cannot be used for specific products, product variants, facetvalues

Current gift card functionality should be the default behaviour.
If product specific conditions exist, then if all conditions are met for a specific product, then the gift card value can be used to this product. In case of multiple products int the cart the gift card balance should be decreased by the values of products where the gift card is usable.

Multiple gift card can be used during the payment process. (They can cause separated payment entities if it is easier. )

Examples (ignore taxes for simplicity):
1.
Gift card has 400 usd balance. It can be used only for product A which is 200 usd.

The cart has 1x product A and 1x product B (100 usd / piece).
Cart value is 300.

Payment:
Gift card payment can fulfill 200 usd. (only product A)
Gift card balance is 200 usd.
Credit card payment fulfill 100 usd.

Gift card A has 400 usd balance. It can be used only for product A which is 200 usd.
Gift card B has 500 usd balance. It cannot be used only for product A.

The cart has 1x product A and 1x product B (100 usd / piece).
Cart value is 300.
Gift card A payment can fulfill 200 usd. (only product A)
Gift card B payment can fulfill 100 usd. (for product B)

EU compliant single purpose vouchers

Single purpose vouchers for gift cards in the EU are subject to VAT at the time of purchase if the tax rate of the final purchase is known, while multi-purpose vouchers are only subject to VAT when used to purchase taxable goods or services.

I wrote a "small essay" on this topic in this issue over here. Quoting from there:

Multi-purpose vouchers should work with the current implementation. They are similar to how gift cards used to be handled: a form of (down-)payment. Single-Purpose vouchers on the other hand come with more problems:

There is a really lengthy discussion over at Shopify regarding this issue. They don't seem to handle single-Purpose vouchers yet.

When using gift cards as a payment method, the total tax amount doesn't get reduced. And since we already paid tax when the customer bought the gift card, we end up paying tax twice.

I think the best option would be to handle gift cards by adding them as a special line item, which has a tax rate (the same tax rate, that has been used for buying the gift card). By setting the tax rate for the gift card you decide between single-purpose vouchers and multi-purpose vouchers. Multi-purpose would probably be the way to go for people outside the EU.

Another benefit of using lines: This should work with any payment plugin, invoices, bookkeeping etc. without the need of additional customisation since they all use lines.

AdvancedSearch: 404 Object not found error in delete operations

Whenever I use a freshly populated system in local development, everything works fine. But once deployed, I get 404 errors from typesense. So I did a portforwarding to use the servers typesense database while using my local development environment.

I was able to debug on 404 error that always appears while reindexing:
image

It seems like there are delete operations executed eventhough the collections that got created are empty:
image

I believe the 404 error should not stop the whole system from working.

AdvancedSearch Schema not ideal for product grouping

The Vendure search implementation is made with a variant based approach in mind.
I made a webshop using the AdvancedSearch where the requirements were set on a variant based search and it worked great! Fully typed searchInput and response thanks to GraphQl codegen.

We have customers where we want the results and counts grouped by product, and the schema should return a list of products not the first variant of each product.
They often have products with more than 100 variants and to not just show 10 pages filled with variants of the same product having it grouped by product is necessary. Since they also want to show the price of the variant they have a variant selector on each product card.
https://webshop.stocker.alpin11.dev/category/polyline-pp

The current workaround discussed with @michaelbromley where we add all the variants on each indexed variant as a JSON serialized string would require extra filtering in the frontend afterwards to remove all the variants which don't pass the facet filter.

Also the collection count doesn't match with the typesense count somehow.
image

I think to do that we could create a second endpoint returning a different schema instead of just setting the groupByProduct flag and returning one variant per product and hackily adding extra values.

Typesense supports grouping, and we implemented it by grouping by product_id and setting the maximum group_limit
https://typesense.org/docs/0.23.1/api/search.html#grouping-parameters

We could take over development for that feature if the AdvancedSearch Plugin source gets made available to us and you think that this is a valid way to extend the Search.

[GiftCardPlugin] giftCardTemplates query should return templateId, not just Asset

The plugin defines this query:

extend type Query {
  giftCardTemplates: [Asset!]!
}

which allows you to display the available template images in the storefront. However, there is no way to access the actual GiftCardTemplate.id, which is what we actually need to pass to the addGiftCardToOrder() mutation in the storefront in order to specify which gift card template to use.

So we should therefore change the query to:

type GiftCardTemplateResult {
  templateId: ID!
  image: Asset!
}
extend type Query {
  giftCardTemplates: [GiftCardTemplateResult!]!
}

ClickhouseAnalytics: Table *.vendure_search_event doesn't exist

I received multiple errors related to the Clickhouse Analytics strategy:

{"timestamp":"2023/06/08 07:38:39 +00:00","level":"error","context":"AdvancedSearchPlugin","message":"Clickhouse error: Code: 60. DB::Exception: Table fainin_search_analytics.vendure_search_event doesn't exist. (UNKNOWN_TABLE) (version 23.3.1.2823 (official build))\n\nquery: \n              SELECT toDate('2023-05-09 07:38:38') + number as date,\n                data.totalQueryCount,\ndata.targetCount,\ndata.rate\n                 FROM numbers(dateDiff('day', toDate('2023-05-09 07:38:38'), toDate('2023-06-08 07:38:38')) + 1) dates\n                  LEFT JOIN (SELECT\n                         row.queryDate date,\n                         count(DISTINCT row.queryId) totalQueryCount,\n                         countIf(event.eventType = 'SEARCH_RESULT_CLICKED') targetCount,\n                         countIf(event.eventType = 'SEARCH_RESULT_CLICKED') / count(DISTINCT row.queryId) rate\n                     FROM vendure_search_query row\n                     LEFT JOIN vendure_search_event event ON row.queryId = event.queryId\n                     GROUP BY row.queryDate) data ON data.date = date\n               FORMAT JSON"}


{"timestamp":"2023/06/08 08:10:55 +00:00","level":"error","context":"AdvancedSearchPlugin","message":"Clickhouse error: Code: 60. DB::Exception: Table fainin_search_analytics.vendure_search_event doesn't exist. (UNKNOWN_TABLE) (version 23.3.1.2823 (official build))\n\nquery: \n            INSERT INTO vendure_search_event (collectionName, queryId, eventType) VALUES ('vendure_products', 'qwujOWidW-p8hdET', 'SEARCH_LIST_VIEWED');\n         FORMAT JSON"}

{"timestamp":"2023/06/08 08:14:20 +00:00","level":"error","context":"AdvancedSearchPlugin","message":"Clickhouse error: Code: 60. DB::Exception: Table fainin_search_analytics.vendure_search_event doesn't exist. (UNKNOWN_TABLE) (version 23.3.1.2823 (official build))\n\nquery: \n            INSERT INTO vendure_search_event (collectionName, queryId, eventType, position, resultId) VALUES ('vendure_products', '-w1GNmFQX9tBVuKg', 'SEARCH_RESULT_CLICKED', 6, '0b738314-960a-4298-ac0b-9db59bd49777');\n         FORMAT JSON"}

When I connect to the database, everything appears to be normal. Except, that position and resultID is always null.
image
image

Furthermore, this error is not appearing all the time! And even though a logSearchResultClicked was successfully executed, I can't see any change in the database.
image
image

No member 'environment' from core - in Giftcard Plugin 1.0.3

There is a new error when compiling the admin ui. This error is new in 1.0.3 and doesn't come up in 1.0.2:

Error: src/extensions/gift-card-plugin/components/dispatch-due-gift-cards-dialog/dispatch-due-gift-cards-dialog.component.ts:2:18 - 
error TS2305: Module '"@vendure/admin-ui/core"' has no exported member 'environment'.
2 import { Dialog, environment } from '@vendure/admin-ui/core';
✖ Failed to compile.

Update search index on specific additional events

Is your feature request related to a problem? Please describe.
Atm we are running into a set-up specific challenge regarding updating the search index. We have created a plugin that will receive stock updates from a third party. We would like to update the search index accordingly. This could be achieved by dispatching a ProductVariantEvent if the stock update is received, which would be correct but also pretty broad. Because a different feature of the same plugin listens to the ProductVariantEvent as well to update product information in the third party system. So we would create a loop if we didn't do any additional checks.

Describe the solution you'd like
We reasoned that it would be nice to be able to update the search index upon the StockMovementEvent event also. It would be nice if this would be added to the plugin core or to be made configurable in the plugin. For the latter I am referring to a way of configuring (additional) events that should update the search index.

Bug: Advanced-search-plugin 1.0.2 has `src` in build dir

The advanced search plugin v1.0.2 has src in build dir, so the package doesn't have a default export. Maybe an import from outside of src was added somewhere, causing TS to include src in the build dir?

image

So all imports in consuming projects need to be rewritten:

- import { AdvancedSearchPlugin } from "@vendure-plus/advanced-search-plugin";
+ import { AdvancedSearchPlugin } from "@vendure-plus/advanced-search-plugin/src";

Other, probably related, errors I am experiencing:

Vitest throws this error:

 FAIL  test/e2e.spec.ts [ test/e2e.spec.ts ]
Error: Parse failure: Unexpected token (1:7)
At file: /node_modules/@vendure-plus/advanced-search-plugin/src/lib/generated-admin-types.ts
Contents of line 1: export type Maybe<T> = T;
 ❯ ssrTransformScript node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53776:15
 ❯ ssrTransform node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53751:12
 ❯ Object.ssrTransform node_modules/vite/dist/node/chunks/dep-e8f070e8.js:63307:20
 ❯ loadAndTransform node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53422:24

yarn tsc works fine, but running the compiled code then gives me:

Error: Cannot find module '@vendure-plus/advanced-search-plugin/src/lib/service/search-index.service'
Require stack:
- /home/martijn/git/huidpraktijkshop/dist/plugins/trigger-search/trigger-search-plugin.js
- /home/martijn/git/huidpraktijkshop/dist/vendure-config.js
- /home/martijn/git/huidpraktijkshop/dist/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/martijn/git/huidpraktijkshop/dist/plugins/trigger-search/trigger-search-plugin.js:13:32)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/martijn/git/huidpraktijkshop/dist/plugins/trigger-search/trigger-search-plugin.js',
    '/home/martijn/git/huidpraktijkshop/dist/vendure-config.js',
    '/home/martijn/git/huidpraktijkshop/dist/index.js'
  ]
}

Web login not supported

If you use npm version 9, you should add the argument --auth-type=legacy with npm adduser or npm login. Otherwise, you will get error npm ERR! Web login not supported.
Source

GiftCardPlugin: Compilation Error - Update 2.0.0

I tried updating to 2.0.0 but I get this error in the compilation step:

Error: src/extensions/gift-card-plugin/gift-card-shared.module.ts:8:5 - error TS2345: Argument of type '{ imports: (typeof SharedModule)[]; declarations: (typeof Nl2brPipe)[]; entryComponents: never[]; exports: (typeof Nl2brPipe | typeof SharedModule)[]; }' 
is not assignable to parameter of type 'NgModule'.
   Object literal may only specify known properties, and 'entryComponents' does not exist in type 'NgModule'.
 
8     entryComponents: [],
     ~~~~~~~~~~~~~~~~~~~

Is there a way to fix it myself or is this some kind of old Angular leftover?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.