@deenruv/upsell-plugin 1.0.0

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 (52) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +42 -0
  3. package/dist/plugin-server/api/upsell-admin.resolver.d.ts +16 -0
  4. package/dist/plugin-server/api/upsell-admin.resolver.js +58 -0
  5. package/dist/plugin-server/api/upsell-product.resolver.d.ts +7 -0
  6. package/dist/plugin-server/api/upsell-product.resolver.js +36 -0
  7. package/dist/plugin-server/constants.d.ts +1 -0
  8. package/dist/plugin-server/constants.js +1 -0
  9. package/dist/plugin-server/entities/upsell.entity.d.ts +8 -0
  10. package/dist/plugin-server/entities/upsell.entity.js +38 -0
  11. package/dist/plugin-server/extensions/upsell.extension.d.ts +3 -0
  12. package/dist/plugin-server/extensions/upsell.extension.js +26 -0
  13. package/dist/plugin-server/index.d.ts +8 -0
  14. package/dist/plugin-server/index.js +43 -0
  15. package/dist/plugin-server/services/upsell.service.d.ts +11 -0
  16. package/dist/plugin-server/services/upsell.service.js +76 -0
  17. package/dist/plugin-server/types.d.ts +1 -0
  18. package/dist/plugin-server/types.js +1 -0
  19. package/dist/plugin-server/zeus/const.d.ts +6 -0
  20. package/dist/plugin-server/zeus/const.js +4039 -0
  21. package/dist/plugin-server/zeus/index.d.ts +20455 -0
  22. package/dist/plugin-server/zeus/index.js +443 -0
  23. package/dist/plugin-ui/components/UpsellSelect.d.ts +2 -0
  24. package/dist/plugin-ui/components/UpsellSelect.js +99 -0
  25. package/dist/plugin-ui/graphql/mutations.d.ts +18 -0
  26. package/dist/plugin-ui/graphql/mutations.js +14 -0
  27. package/dist/plugin-ui/graphql/queries.d.ts +15 -0
  28. package/dist/plugin-ui/graphql/queries.js +11 -0
  29. package/dist/plugin-ui/graphql/scalars.d.ts +13 -0
  30. package/dist/plugin-ui/graphql/scalars.js +14 -0
  31. package/dist/plugin-ui/graphql/selectors.d.ts +12 -0
  32. package/dist/plugin-ui/graphql/selectors.js +8 -0
  33. package/dist/plugin-ui/index.d.ts +1 -0
  34. package/dist/plugin-ui/index.js +21 -0
  35. package/dist/plugin-ui/locales/en/index.d.ts +5 -0
  36. package/dist/plugin-ui/locales/en/index.js +2 -0
  37. package/dist/plugin-ui/locales/en/wfirma.json +4 -0
  38. package/dist/plugin-ui/locales/pl/index.d.ts +5 -0
  39. package/dist/plugin-ui/locales/pl/index.js +2 -0
  40. package/dist/plugin-ui/locales/pl/wfirma.json +4 -0
  41. package/dist/plugin-ui/pages/ExtrasPage.d.ts +2 -0
  42. package/dist/plugin-ui/pages/ExtrasPage.js +8 -0
  43. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  44. package/dist/plugin-ui/translation-ns.js +1 -0
  45. package/dist/plugin-ui/tsconfig.json +18 -0
  46. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  47. package/dist/plugin-ui/zeus/const.js +4039 -0
  48. package/dist/plugin-ui/zeus/index.d.ts +20455 -0
  49. package/dist/plugin-ui/zeus/index.js +459 -0
  50. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  51. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  52. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ # License 1
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2025-present Aexol
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+
13
+ # License 2
14
+
15
+ The MIT License
16
+
17
+ Copyright (c) 2018-2025 Michael Bromley
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @deenruv/upsell-plugin
2
+
3
+ A product upselling plugin that allows you to define and manage upsell/cross-sell relationships between products in your Deenruv store, exposing them via both Admin and Shop APIs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @deenruv/upsell-plugin
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ```typescript
14
+ import { UpsellPlugin } from '@deenruv/upsell-plugin';
15
+
16
+ // In your Deenruv server config:
17
+ plugins: [
18
+ UpsellPlugin.init({}),
19
+ ]
20
+ ```
21
+
22
+ ## Features
23
+
24
+ - Custom `Upsell` entity for defining product-to-product relationships
25
+ - Admin API for creating and managing upsell associations
26
+ - Shop API for querying upsell products on product detail pages
27
+ - Product resolver extensions for seamlessly including upsells in product queries
28
+
29
+ ## Admin UI
30
+
31
+ This plugin extends the admin UI with an upsell management interface including a product upsell selection dialog and an extras management page for configuring upsell relationships between products.
32
+
33
+ ## API Extensions
34
+
35
+ The plugin extends both the **Admin API** and **Shop API**:
36
+
37
+ **Admin API:**
38
+ - Mutations for creating, updating, and deleting upsell relationships
39
+ - Queries for listing upsell associations
40
+
41
+ **Shop API:**
42
+ - Product type resolver extension for querying upsell products associated with a given product
@@ -0,0 +1,16 @@
1
+ import { ID, RequestContext } from "@deenruv/core";
2
+ import { ResolverInputTypes } from "../zeus/index.js";
3
+ import { UpsellService } from "../services/upsell.service.js";
4
+ export declare class UpsellAdminResolver {
5
+ private upsellService;
6
+ constructor(upsellService: UpsellService);
7
+ upsellProducts(ctx: RequestContext, args: {
8
+ productID: ID;
9
+ }): Promise<import("@deenruv/core").Product[]>;
10
+ createUpsell(ctx: RequestContext, args: {
11
+ input: ResolverInputTypes["UpsellInput"][];
12
+ }): Promise<true | undefined>;
13
+ deleteUpsell(ctx: RequestContext, args: {
14
+ input: ResolverInputTypes["UpsellInput"][];
15
+ }): Promise<boolean>;
16
+ }
@@ -0,0 +1,58 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Mutation, Args, Query, Resolver } from "@nestjs/graphql";
14
+ import { Ctx, RequestContext } from "@deenruv/core";
15
+ import { UpsellService } from "../services/upsell.service.js";
16
+ let UpsellAdminResolver = class UpsellAdminResolver {
17
+ constructor(upsellService) {
18
+ this.upsellService = upsellService;
19
+ }
20
+ async upsellProducts(ctx, args) {
21
+ return this.upsellService.upsells(ctx, args.productID);
22
+ }
23
+ async createUpsell(ctx, args) {
24
+ return this.upsellService.createUpsell(ctx, args.input);
25
+ }
26
+ async deleteUpsell(ctx, args) {
27
+ return this.upsellService.deleteUpsell(ctx, args.input);
28
+ }
29
+ };
30
+ __decorate([
31
+ Query(),
32
+ __param(0, Ctx()),
33
+ __param(1, Args()),
34
+ __metadata("design:type", Function),
35
+ __metadata("design:paramtypes", [RequestContext, Object]),
36
+ __metadata("design:returntype", Promise)
37
+ ], UpsellAdminResolver.prototype, "upsellProducts", null);
38
+ __decorate([
39
+ Mutation(),
40
+ __param(0, Ctx()),
41
+ __param(1, Args()),
42
+ __metadata("design:type", Function),
43
+ __metadata("design:paramtypes", [RequestContext, Object]),
44
+ __metadata("design:returntype", Promise)
45
+ ], UpsellAdminResolver.prototype, "createUpsell", null);
46
+ __decorate([
47
+ Mutation(),
48
+ __param(0, Ctx()),
49
+ __param(1, Args()),
50
+ __metadata("design:type", Function),
51
+ __metadata("design:paramtypes", [RequestContext, Object]),
52
+ __metadata("design:returntype", Promise)
53
+ ], UpsellAdminResolver.prototype, "deleteUpsell", null);
54
+ UpsellAdminResolver = __decorate([
55
+ Resolver(),
56
+ __metadata("design:paramtypes", [UpsellService])
57
+ ], UpsellAdminResolver);
58
+ export { UpsellAdminResolver };
@@ -0,0 +1,7 @@
1
+ import { Product, RequestContext } from "@deenruv/core";
2
+ import { UpsellService } from "../services/upsell.service.js";
3
+ export declare class UpsellProductResolver {
4
+ private upsellService;
5
+ constructor(upsellService: UpsellService);
6
+ upsellProducts(ctx: RequestContext, product: Product): Promise<Product[]>;
7
+ }
@@ -0,0 +1,36 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Ctx, Product, RequestContext } from "@deenruv/core";
14
+ import { Parent, ResolveField, Resolver } from "@nestjs/graphql";
15
+ import { UpsellService } from "../services/upsell.service.js";
16
+ let UpsellProductResolver = class UpsellProductResolver {
17
+ constructor(upsellService) {
18
+ this.upsellService = upsellService;
19
+ }
20
+ async upsellProducts(ctx, product) {
21
+ return this.upsellService.upsells(ctx, product.id);
22
+ }
23
+ };
24
+ __decorate([
25
+ ResolveField("upsellProducts"),
26
+ __param(0, Ctx()),
27
+ __param(1, Parent()),
28
+ __metadata("design:type", Function),
29
+ __metadata("design:paramtypes", [RequestContext, Product]),
30
+ __metadata("design:returntype", Promise)
31
+ ], UpsellProductResolver.prototype, "upsellProducts", null);
32
+ UpsellProductResolver = __decorate([
33
+ Resolver("Product"),
34
+ __metadata("design:paramtypes", [UpsellService])
35
+ ], UpsellProductResolver);
36
+ export { UpsellProductResolver };
@@ -0,0 +1 @@
1
+ export declare const UPSELL_PLUGIN_OPTIONS: unique symbol;
@@ -0,0 +1 @@
1
+ export const UPSELL_PLUGIN_OPTIONS = Symbol("upsell-plugin-options");
@@ -0,0 +1,8 @@
1
+ import { Product, DeenruvEntity } from "@deenruv/core";
2
+ import type { DeepPartial } from "@deenruv/core";
3
+ import type { Relation } from "typeorm";
4
+ export declare class UpsellEntity extends DeenruvEntity {
5
+ constructor(input?: DeepPartial<UpsellEntity>);
6
+ base: Relation<Product>;
7
+ upsell: Relation<Product>;
8
+ }
@@ -0,0 +1,38 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Product, DeenruvEntity } from "@deenruv/core";
11
+ import { JoinColumn, Unique, ManyToOne, Entity } from "typeorm";
12
+ let UpsellEntity = class UpsellEntity extends DeenruvEntity {
13
+ constructor(input) {
14
+ super(input);
15
+ }
16
+ };
17
+ __decorate([
18
+ ManyToOne(() => Product, (product) => product.id, {
19
+ onDelete: "CASCADE",
20
+ nullable: false,
21
+ }),
22
+ JoinColumn(),
23
+ __metadata("design:type", Object)
24
+ ], UpsellEntity.prototype, "base", void 0);
25
+ __decorate([
26
+ ManyToOne(() => Product, (product) => product.id, {
27
+ onDelete: "CASCADE",
28
+ nullable: false,
29
+ }),
30
+ JoinColumn(),
31
+ __metadata("design:type", Object)
32
+ ], UpsellEntity.prototype, "upsell", void 0);
33
+ UpsellEntity = __decorate([
34
+ Entity(),
35
+ Unique(["base", "upsell"]),
36
+ __metadata("design:paramtypes", [Object])
37
+ ], UpsellEntity);
38
+ export { UpsellEntity };
@@ -0,0 +1,3 @@
1
+ export declare const base: import("graphql").DocumentNode;
2
+ export declare const ShopAPIExtension: import("graphql").DocumentNode;
3
+ export declare const AdminAPIExtension: import("graphql").DocumentNode;
@@ -0,0 +1,26 @@
1
+ import { gql } from "graphql-tag";
2
+ export const base = gql `
3
+ extend type Product {
4
+ upsellProducts: [Product!]!
5
+ }
6
+ `;
7
+ export const ShopAPIExtension = gql `
8
+ ${base}
9
+ `;
10
+ export const AdminAPIExtension = gql `
11
+ ${base}
12
+
13
+ input UpsellInput {
14
+ baseProductID: ID!
15
+ upsellProductID: ID!
16
+ }
17
+
18
+ extend type Mutation {
19
+ createUpsell(input: [UpsellInput!]!): Boolean!
20
+ deleteUpsell(input: [UpsellInput!]!): Boolean!
21
+ }
22
+
23
+ extend type Query {
24
+ upsellProducts(productID: ID!): [Product!]!
25
+ }
26
+ `;
@@ -0,0 +1,8 @@
1
+ import type { UpsellPluginOptions } from "./types.js";
2
+ import { ModuleRef } from "@nestjs/core";
3
+ export declare class UpsellPlugin {
4
+ private moduleRef;
5
+ static options: UpsellPluginOptions;
6
+ constructor(moduleRef: ModuleRef);
7
+ static init(options: UpsellPluginOptions): typeof UpsellPlugin;
8
+ }
@@ -0,0 +1,43 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { PluginCommonModule, DeenruvPlugin } from "@deenruv/core";
11
+ import { ModuleRef } from "@nestjs/core";
12
+ import { UpsellEntity } from "./entities/upsell.entity.js";
13
+ import { UpsellService } from "./services/upsell.service.js";
14
+ import { AdminAPIExtension, ShopAPIExtension, } from "./extensions/upsell.extension.js";
15
+ import { UpsellAdminResolver } from "./api/upsell-admin.resolver.js";
16
+ import { UpsellProductResolver } from "./api/upsell-product.resolver.js";
17
+ let UpsellPlugin = class UpsellPlugin {
18
+ constructor(moduleRef) {
19
+ this.moduleRef = moduleRef;
20
+ }
21
+ static init(options) {
22
+ this.options = options;
23
+ return this;
24
+ }
25
+ };
26
+ UpsellPlugin = __decorate([
27
+ DeenruvPlugin({
28
+ compatibility: "0.0.1",
29
+ imports: [PluginCommonModule],
30
+ entities: [UpsellEntity],
31
+ providers: [UpsellService],
32
+ shopApiExtensions: {
33
+ schema: ShopAPIExtension,
34
+ resolvers: [UpsellProductResolver],
35
+ },
36
+ adminApiExtensions: {
37
+ schema: AdminAPIExtension,
38
+ resolvers: [UpsellProductResolver, UpsellAdminResolver],
39
+ },
40
+ }),
41
+ __metadata("design:paramtypes", [ModuleRef])
42
+ ], UpsellPlugin);
43
+ export { UpsellPlugin };
@@ -0,0 +1,11 @@
1
+ import { TransactionalConnection, RequestContext, ID } from "@deenruv/core";
2
+ import { ResolverInputTypes } from "../zeus/index.js";
3
+ export declare class UpsellService {
4
+ private connection;
5
+ private readonly logger;
6
+ private readonly log;
7
+ constructor(connection: TransactionalConnection);
8
+ upsells(ctx: RequestContext, productID: ID): Promise<import("@deenruv/core").Product[]>;
9
+ createUpsell(ctx: RequestContext, input: ResolverInputTypes["UpsellInput"][]): Promise<true | undefined>;
10
+ deleteUpsell(ctx: RequestContext, input: ResolverInputTypes["UpsellInput"][]): Promise<boolean>;
11
+ }
@@ -0,0 +1,76 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Injectable } from "@nestjs/common";
11
+ import { TransactionalConnection, Logger, } from "@deenruv/core";
12
+ import { UpsellEntity } from "../entities/upsell.entity.js";
13
+ let UpsellService = class UpsellService {
14
+ constructor(connection) {
15
+ this.connection = connection;
16
+ this.logger = new Logger();
17
+ this.log = (msg) => this.logger.log(msg, "UpsellService");
18
+ this.log("UpsellService initialized");
19
+ }
20
+ async upsells(ctx, productID) {
21
+ try {
22
+ const upsell = await this.connection
23
+ .getRepository(ctx, UpsellEntity)
24
+ .find({
25
+ where: { base: { id: productID } },
26
+ relations: { upsell: { variants: true } },
27
+ });
28
+ return upsell.map(({ upsell }) => upsell);
29
+ }
30
+ catch (error) {
31
+ const errorMessage = error instanceof Error ? error.message : "An error occurred";
32
+ this.logger.error(errorMessage);
33
+ return [];
34
+ }
35
+ }
36
+ async createUpsell(ctx, input) {
37
+ const entities = input.flatMap(({ baseProductID, upsellProductID }) => [
38
+ new UpsellEntity({
39
+ base: { id: baseProductID },
40
+ upsell: { id: upsellProductID },
41
+ }),
42
+ new UpsellEntity({
43
+ base: { id: upsellProductID },
44
+ upsell: { id: baseProductID },
45
+ }),
46
+ ]);
47
+ try {
48
+ return !!(await Promise.all(entities.map((entity) => this.connection.getRepository(ctx, UpsellEntity).upsert(entity, {
49
+ conflictPaths: { base: true, upsell: true },
50
+ upsertType: "on-conflict-do-update",
51
+ }))));
52
+ }
53
+ catch (error) {
54
+ const errorMessage = error instanceof Error ? error.message : "An error occurred";
55
+ this.logger.error(errorMessage);
56
+ }
57
+ }
58
+ async deleteUpsell(ctx, input) {
59
+ const [deletedA, deletedB] = await Promise.all([
60
+ input.map(({ baseProductID, upsellProductID }) => this.connection.getRepository(ctx, UpsellEntity).delete({
61
+ base: { id: baseProductID },
62
+ upsell: { id: upsellProductID },
63
+ })),
64
+ input.map(({ baseProductID, upsellProductID }) => this.connection.getRepository(ctx, UpsellEntity).delete({
65
+ base: { id: upsellProductID },
66
+ upsell: { id: baseProductID },
67
+ })),
68
+ ]);
69
+ return !!deletedA.length && !!deletedB.length;
70
+ }
71
+ };
72
+ UpsellService = __decorate([
73
+ Injectable(),
74
+ __metadata("design:paramtypes", [TransactionalConnection])
75
+ ], UpsellService);
76
+ export { UpsellService };
@@ -0,0 +1 @@
1
+ export type UpsellPluginOptions = {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const AllTypesProps: Record<string, any>;
2
+ export declare const ReturnTypes: Record<string, any>;
3
+ export declare const Ops: {
4
+ query: "Query";
5
+ mutation: "Mutation";
6
+ };