@deenruv/replicate-simple-bg-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 (66) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +54 -0
  3. package/dist/plugin-server/constants.d.ts +13 -0
  4. package/dist/plugin-server/constants.js +122 -0
  5. package/dist/plugin-server/entities/replicate-simple-bg.d.ts +11 -0
  6. package/dist/plugin-server/entities/replicate-simple-bg.js +49 -0
  7. package/dist/plugin-server/extensions/replicate-simple-bg.extension.d.ts +1 -0
  8. package/dist/plugin-server/extensions/replicate-simple-bg.extension.js +105 -0
  9. package/dist/plugin-server/graphql/generated-admin-types.d.ts +5807 -0
  10. package/dist/plugin-server/graphql/generated-admin-types.js +1030 -0
  11. package/dist/plugin-server/index.d.ts +5 -0
  12. package/dist/plugin-server/index.js +40 -0
  13. package/dist/plugin-server/resolvers/replicate-simple-bg-admin.resolver.d.ts +51 -0
  14. package/dist/plugin-server/resolvers/replicate-simple-bg-admin.resolver.js +105 -0
  15. package/dist/plugin-server/services/replicate-simple-bg.service.d.ts +45 -0
  16. package/dist/plugin-server/services/replicate-simple-bg.service.js +254 -0
  17. package/dist/plugin-server/types.d.ts +29 -0
  18. package/dist/plugin-server/types.js +2 -0
  19. package/dist/plugin-server/zeus/const.d.ts +6 -0
  20. package/dist/plugin-server/zeus/const.js +3714 -0
  21. package/dist/plugin-server/zeus/index.d.ts +18885 -0
  22. package/dist/plugin-server/zeus/index.js +1101 -0
  23. package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -0
  24. package/dist/plugin-server/zeus/typedDocumentNode.js +13 -0
  25. package/dist/plugin-ui/components/FileUpload.d.ts +11 -0
  26. package/dist/plugin-ui/components/FileUpload.js +50 -0
  27. package/dist/plugin-ui/components/RoomStyleSelect.d.ts +7 -0
  28. package/dist/plugin-ui/components/RoomStyleSelect.js +19 -0
  29. package/dist/plugin-ui/components/RoomTypeSelect.d.ts +7 -0
  30. package/dist/plugin-ui/components/RoomTypeSelect.js +21 -0
  31. package/dist/plugin-ui/components/index.d.ts +1 -0
  32. package/dist/plugin-ui/components/index.js +1 -0
  33. package/dist/plugin-ui/constants.d.ts +1 -0
  34. package/dist/plugin-ui/constants.js +15 -0
  35. package/dist/plugin-ui/graphql/mutations.d.ts +22 -0
  36. package/dist/plugin-ui/graphql/mutations.js +21 -0
  37. package/dist/plugin-ui/graphql/queries.d.ts +87 -0
  38. package/dist/plugin-ui/graphql/queries.js +32 -0
  39. package/dist/plugin-ui/graphql/selectors.d.ts +43 -0
  40. package/dist/plugin-ui/graphql/selectors.js +38 -0
  41. package/dist/plugin-ui/index.d.ts +1 -0
  42. package/dist/plugin-ui/index.js +33 -0
  43. package/dist/plugin-ui/locales/en/index.d.ts +67 -0
  44. package/dist/plugin-ui/locales/en/index.js +2 -0
  45. package/dist/plugin-ui/locales/en/simpleBg.json +66 -0
  46. package/dist/plugin-ui/locales/pl/index.d.ts +67 -0
  47. package/dist/plugin-ui/locales/pl/index.js +2 -0
  48. package/dist/plugin-ui/locales/pl/simpleBg.json +66 -0
  49. package/dist/plugin-ui/pages/ReplicatePage.d.ts +2 -0
  50. package/dist/plugin-ui/pages/ReplicatePage.js +282 -0
  51. package/dist/plugin-ui/pages/ReplicateProductSidebar.d.ts +2 -0
  52. package/dist/plugin-ui/pages/ReplicateProductSidebar.js +186 -0
  53. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  54. package/dist/plugin-ui/translation-ns.js +1 -0
  55. package/dist/plugin-ui/tsconfig.json +18 -0
  56. package/dist/plugin-ui/types.d.ts +35 -0
  57. package/dist/plugin-ui/types.js +15 -0
  58. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  59. package/dist/plugin-ui/zeus/const.js +3711 -0
  60. package/dist/plugin-ui/zeus/index.d.ts +18885 -0
  61. package/dist/plugin-ui/zeus/index.js +1093 -0
  62. package/dist/plugin-ui/zeus/scalars.d.ts +18 -0
  63. package/dist/plugin-ui/zeus/scalars.js +25 -0
  64. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  65. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  66. package/package.json +53 -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,54 @@
1
+ # @deenruv/replicate-simple-bg-plugin
2
+
3
+ An AI-powered background generation plugin that uses [Replicate](https://replicate.com/) models to generate styled room backgrounds from uploaded images, ideal for virtual staging of product photography.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @deenruv/replicate-simple-bg-plugin replicate
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ```typescript
14
+ import { ReplicateSimpleBGPlugin } from '@deenruv/replicate-simple-bg-plugin';
15
+
16
+ // In your Deenruv server config:
17
+ plugins: [
18
+ ReplicateSimpleBGPlugin.init({
19
+ envs: {
20
+ deploymentName: 'your-replicate-deployment',
21
+ apiToken: process.env.REPLICATE_API_TOKEN,
22
+ assetPrefix: 'https://your-cdn.com/assets',
23
+ },
24
+ // Optional: custom prompts for image generation
25
+ prompts: {
26
+ positive: 'modern interior design',
27
+ negative: 'blurry, distorted',
28
+ },
29
+ // Optional: predefined room types and themes
30
+ roomType: [{ value: 'living-room', label: 'Living Room' }],
31
+ roomTheme: [{ value: 'modern', label: 'Modern', image: '/themes/modern.jpg' }],
32
+ }),
33
+ ]
34
+ ```
35
+
36
+ ## Features
37
+
38
+ - AI-powered background generation using Replicate models
39
+ - Configurable room types and interior design themes
40
+ - File upload support with drag-and-drop interface
41
+ - Custom entity for tracking generation jobs and results
42
+ - Configurable positive/negative prompts and seed values
43
+ - Admin API for triggering and managing background generation tasks
44
+
45
+ ## Admin UI
46
+
47
+ This plugin extends the admin UI with a background generation interface including image upload via drag-and-drop, room type and style selection, generation progress tracking, and a product sidebar for quick access to generated backgrounds.
48
+
49
+ ## API Extensions
50
+
51
+ The plugin extends the **Admin API** with:
52
+
53
+ - Mutations for triggering background generation from uploaded images
54
+ - Queries for retrieving generation status and results
@@ -0,0 +1,13 @@
1
+ export declare const REPLICATE_SIMPLE_BG_PLUGIN_OPTIONS: unique symbol;
2
+ export declare const LOGGER_CTX = "ReplicateSimpleBGPlugin";
3
+ export declare const DEFAULT_ROOM_TYPE: {
4
+ value: string;
5
+ label: string;
6
+ }[];
7
+ export declare const DEFAULT_ROOM_THEME: {
8
+ value: string;
9
+ label: string;
10
+ image: string;
11
+ }[];
12
+ export declare const DEFAULT_PROMPT: string[];
13
+ export declare const DEFAULT_NEGATIVE_PROMPT: string[];
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_NEGATIVE_PROMPT = exports.DEFAULT_PROMPT = exports.DEFAULT_ROOM_THEME = exports.DEFAULT_ROOM_TYPE = exports.LOGGER_CTX = exports.REPLICATE_SIMPLE_BG_PLUGIN_OPTIONS = void 0;
4
+ exports.REPLICATE_SIMPLE_BG_PLUGIN_OPTIONS = Symbol("options");
5
+ exports.LOGGER_CTX = "ReplicateSimpleBGPlugin";
6
+ exports.DEFAULT_ROOM_TYPE = [
7
+ {
8
+ value: "BEDROOM",
9
+ label: "bedroom",
10
+ },
11
+ {
12
+ value: "LIVING_ROOM",
13
+ label: "living_room",
14
+ },
15
+ {
16
+ value: "DINING_ROOM",
17
+ label: "dining_room",
18
+ },
19
+ {
20
+ value: "KITCHEN",
21
+ label: "kitchen",
22
+ },
23
+ {
24
+ value: "BATHROOM",
25
+ label: "bathroom",
26
+ },
27
+ {
28
+ value: "OFFICE",
29
+ label: "office",
30
+ },
31
+ ];
32
+ exports.DEFAULT_ROOM_THEME = [
33
+ {
34
+ value: "MODERN",
35
+ label: "modern",
36
+ image: "someimg-modern.png",
37
+ },
38
+ {
39
+ value: "SUMMER",
40
+ label: "summer",
41
+ image: "someimg-summer.png",
42
+ },
43
+ {
44
+ value: "PROFESSIONAL",
45
+ label: "professional",
46
+ image: "someimg-professional.png",
47
+ },
48
+ {
49
+ value: "TROPICAL",
50
+ label: "tropical",
51
+ image: "someimg-tropical.png",
52
+ },
53
+ {
54
+ value: "COASTAL",
55
+ label: "coastal",
56
+ image: "someimg-coastal.png",
57
+ },
58
+ {
59
+ value: "VINTAGE",
60
+ label: "vintage",
61
+ image: "someimg-vintage.png",
62
+ },
63
+ {
64
+ value: "INDUSTRIAL",
65
+ label: "industrial",
66
+ image: "someimg-industrial.png",
67
+ },
68
+ {
69
+ value: "NEOCLASSIC",
70
+ label: "neoclassic",
71
+ image: "someimg-neoclassic.png",
72
+ },
73
+ ];
74
+ exports.DEFAULT_PROMPT = [
75
+ "High resolution",
76
+ "photography",
77
+ "interior design",
78
+ "dreamy sunken",
79
+ "conversion pit",
80
+ "wooden floor",
81
+ "small windows opening onto the garden",
82
+ "bauhaus furniture and decoration",
83
+ "high ceiling",
84
+ "beige blue salmon pastel palette",
85
+ "interior design magazine",
86
+ "cozy atmosphere",
87
+ "8k",
88
+ "intricate detail",
89
+ "photorealistic",
90
+ "realistic light",
91
+ "wide angle",
92
+ "kinkfolk photography",
93
+ "A+D architecture",
94
+ ];
95
+ exports.DEFAULT_NEGATIVE_PROMPT = [
96
+ "deformed iris",
97
+ "deformed pupils",
98
+ "semi-realistic",
99
+ "cgi",
100
+ "3d",
101
+ "render",
102
+ "sketch",
103
+ "cartoon",
104
+ "drawing",
105
+ "anime",
106
+ "mutated",
107
+ "hands and fingers:1.4",
108
+ "deformed",
109
+ "distorted",
110
+ "poorly drawn",
111
+ "bad anatomy",
112
+ "wrong anatomy",
113
+ "extra limb",
114
+ "missing limb",
115
+ "floating limbs",
116
+ "disconnected limbs",
117
+ "mutation",
118
+ "mutated",
119
+ "ugly",
120
+ "disgusting",
121
+ "amputation",
122
+ ];
@@ -0,0 +1,11 @@
1
+ import { DeenruvEntity, DeepPartial } from "@deenruv/core";
2
+ import "reflect-metadata";
3
+ export declare class ReplicateSimpleBgEntity extends DeenruvEntity {
4
+ constructor(input?: DeepPartial<ReplicateSimpleBgEntity>);
5
+ prediction_simple_bg_id: string;
6
+ output: string;
7
+ status: string;
8
+ finishedAt: Date | null;
9
+ roomType: string;
10
+ roomStyle: string;
11
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReplicateSimpleBgEntity = void 0;
13
+ const core_1 = require("@deenruv/core");
14
+ const typeorm_1 = require("typeorm");
15
+ require("reflect-metadata");
16
+ let ReplicateSimpleBgEntity = class ReplicateSimpleBgEntity extends core_1.DeenruvEntity {
17
+ constructor(input) {
18
+ super(input);
19
+ }
20
+ };
21
+ exports.ReplicateSimpleBgEntity = ReplicateSimpleBgEntity;
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ nullable: true, type: "varchar", length: 255 }),
24
+ __metadata("design:type", String)
25
+ ], ReplicateSimpleBgEntity.prototype, "prediction_simple_bg_id", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ nullable: true, type: "varchar", length: 255 }),
28
+ __metadata("design:type", String)
29
+ ], ReplicateSimpleBgEntity.prototype, "output", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ default: "starting" }),
32
+ __metadata("design:type", String)
33
+ ], ReplicateSimpleBgEntity.prototype, "status", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ type: Date, nullable: true }),
36
+ __metadata("design:type", Object)
37
+ ], ReplicateSimpleBgEntity.prototype, "finishedAt", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ nullable: true, type: "varchar", length: 255 }),
40
+ __metadata("design:type", String)
41
+ ], ReplicateSimpleBgEntity.prototype, "roomType", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ nullable: true, type: "varchar", length: 255 }),
44
+ __metadata("design:type", String)
45
+ ], ReplicateSimpleBgEntity.prototype, "roomStyle", void 0);
46
+ exports.ReplicateSimpleBgEntity = ReplicateSimpleBgEntity = __decorate([
47
+ (0, typeorm_1.Entity)(),
48
+ __metadata("design:paramtypes", [Object])
49
+ ], ReplicateSimpleBgEntity);
@@ -0,0 +1 @@
1
+ export declare const AdminExtension: import("graphql").DocumentNode;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminExtension = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.AdminExtension = (0, graphql_tag_1.gql) `
6
+ input StartGenerateSimpleBgInput {
7
+ assetId: String
8
+ roomType: String
9
+ roomStyle: String
10
+ prompt: String
11
+ }
12
+
13
+ input GetPredictionAssetInput {
14
+ predictionId: String!
15
+ productId: String!
16
+ }
17
+
18
+ type AssetPrediction {
19
+ id: ID!
20
+ preview: String!
21
+ source: String!
22
+ }
23
+
24
+ extend type Mutation {
25
+ startGenerateSimpleBg(input: StartGenerateSimpleBgInput!): String!
26
+ getPredictionAsset(input: GetPredictionAssetInput!): Asset!
27
+ }
28
+
29
+ input GetSimpleBgEntityInput {
30
+ prediction_simple_bg_entity_id: String!
31
+ }
32
+
33
+ enum PredictionSimpleBgStatus {
34
+ starting
35
+ preprocessing
36
+ succeeded
37
+ failed
38
+ }
39
+
40
+ type PredictionSimpleBgResult {
41
+ id: ID!
42
+ status: PredictionSimpleBgStatus
43
+ image: String
44
+ roomType: String
45
+ roomStyle: String
46
+ }
47
+
48
+ input ReplicateSimpleBgEntityListOptions
49
+
50
+ type Image {
51
+ url: String!
52
+ }
53
+
54
+ type RoomType implements Node {
55
+ id: ID!
56
+ value: String
57
+ label: String
58
+ }
59
+
60
+ type RoomTheme implements Node {
61
+ id: ID!
62
+ value: String
63
+ label: String
64
+ image: String
65
+ }
66
+
67
+ type SimpleBgPluginOptions {
68
+ roomTypes: [RoomType]
69
+ roomThemes: [RoomTheme]
70
+ }
71
+
72
+ extend type Query {
73
+ getSimpleBgID(input: GetSimpleBgEntityInput!): String
74
+ getSimpleBgPredictions(
75
+ options: ReplicateSimpleBgEntityListOptions
76
+ ): ReplicateSimpleBgEntityList!
77
+ getSimpleBgItem(id: String!): PredictionSimpleBgResult!
78
+ getSimpleBgThemeAsset(url: String!): Image!
79
+ getSimpleBgOptions: SimpleBgPluginOptions!
80
+ }
81
+
82
+ type ReplicateSimpleBgEntity implements Node {
83
+ id: ID!
84
+ status: PredictionSimpleBgStatus!
85
+ finishedAt: DateTime
86
+ }
87
+
88
+ type ReplicateSimpleBgEntityList implements PaginatedList {
89
+ items: [ReplicateSimpleBgEntity!]!
90
+ totalItems: Int!
91
+ }
92
+
93
+ type SimpleBgProduct implements Node {
94
+ createdAt: DateTime
95
+ updatedAt: DateTime
96
+ name: String
97
+ slug: String
98
+ id: ID!
99
+ }
100
+
101
+ type SimpleBgProductList implements PaginatedList {
102
+ items: [SimpleBgProduct!]!
103
+ totalItems: Int!
104
+ }
105
+ `;