@deenruv/deenruv-examples-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 (54) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +37 -0
  3. package/dist/plugin-server/constants.d.ts +3 -0
  4. package/dist/plugin-server/constants.js +11 -0
  5. package/dist/plugin-server/index.d.ts +2 -0
  6. package/dist/plugin-server/index.js +286 -0
  7. package/dist/plugin-server/zeus/const.d.ts +6 -0
  8. package/dist/plugin-server/zeus/const.js +3656 -0
  9. package/dist/plugin-server/zeus/index.d.ts +18614 -0
  10. package/dist/plugin-server/zeus/index.js +1120 -0
  11. package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -0
  12. package/dist/plugin-server/zeus/typedDocumentNode.js +16 -0
  13. package/dist/plugin-ui/assets/index.d.ts +1 -0
  14. package/dist/plugin-ui/assets/index.js +1 -0
  15. package/dist/plugin-ui/assets/svgs/SquareIcon.d.ts +2 -0
  16. package/dist/plugin-ui/assets/svgs/SquareIcon.js +3 -0
  17. package/dist/plugin-ui/assets/svgs/index.d.ts +1 -0
  18. package/dist/plugin-ui/assets/svgs/index.js +1 -0
  19. package/dist/plugin-ui/components/CustomInput.d.ts +2 -0
  20. package/dist/plugin-ui/components/CustomInput.js +10 -0
  21. package/dist/plugin-ui/components/TestComponent.d.ts +2 -0
  22. package/dist/plugin-ui/components/TestComponent.js +11 -0
  23. package/dist/plugin-ui/components/TestPage.d.ts +2 -0
  24. package/dist/plugin-ui/components/TestPage.js +52 -0
  25. package/dist/plugin-ui/components/index.d.ts +2 -0
  26. package/dist/plugin-ui/components/index.js +2 -0
  27. package/dist/plugin-ui/graphql/mutations.d.ts +22 -0
  28. package/dist/plugin-ui/graphql/mutations.js +11 -0
  29. package/dist/plugin-ui/graphql/queries.d.ts +12 -0
  30. package/dist/plugin-ui/graphql/queries.js +14 -0
  31. package/dist/plugin-ui/graphql/selectors.d.ts +6 -0
  32. package/dist/plugin-ui/graphql/selectors.js +7 -0
  33. package/dist/plugin-ui/index.d.ts +1 -0
  34. package/dist/plugin-ui/index.js +70 -0
  35. package/dist/plugin-ui/locales/en/index.d.ts +41 -0
  36. package/dist/plugin-ui/locales/en/index.js +2 -0
  37. package/dist/plugin-ui/locales/en/test.json +40 -0
  38. package/dist/plugin-ui/locales/pl/index.d.ts +41 -0
  39. package/dist/plugin-ui/locales/pl/index.js +2 -0
  40. package/dist/plugin-ui/locales/pl/test.json +40 -0
  41. package/dist/plugin-ui/tables.d.ts +5 -0
  42. package/dist/plugin-ui/tables.js +7 -0
  43. package/dist/plugin-ui/tabs.d.ts +2 -0
  44. package/dist/plugin-ui/tabs.js +10 -0
  45. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  46. package/dist/plugin-ui/translation-ns.js +1 -0
  47. package/dist/plugin-ui/tsconfig.json +18 -0
  48. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  49. package/dist/plugin-ui/zeus/const.js +3653 -0
  50. package/dist/plugin-ui/zeus/index.d.ts +18614 -0
  51. package/dist/plugin-ui/zeus/index.js +1112 -0
  52. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  53. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  54. 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,37 @@
1
+ # @deenruv/deenruv-examples-plugin
2
+
3
+ Example and reference plugin demonstrating how to use custom fields across various Deenruv entities. It registers a wide variety of custom field types on Products, Orders, OrderLines, Collections, Facets, ProductVariants, and Assets for development and testing purposes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @deenruv/deenruv-examples-plugin
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ```typescript
14
+ import { DeenruvExamplesServerPlugin } from '@deenruv/deenruv-examples-plugin';
15
+
16
+ // In your Deenruv server config:
17
+ plugins: [
18
+ DeenruvExamplesServerPlugin,
19
+ ]
20
+ ```
21
+
22
+ ## Features
23
+
24
+ - Demonstrates all supported custom field types: string, boolean, float, int, text, datetime, localeString, localeText
25
+ - Examples of list-type custom fields (string list, int list, float list, text list, localeString list, localeText list)
26
+ - Relation custom fields: single Asset, list of Assets, list of Products, list of ProductVariants
27
+ - Custom fields on multiple entities: Product, Order, OrderLine, Collection, Facet, ProductVariant, Asset
28
+ - Multi-language labels and descriptions (English and Polish)
29
+ - Reference implementation for plugin developers
30
+
31
+ ## Admin UI
32
+
33
+ This plugin extends the admin UI with example pages, test components, custom input components, and custom table configurations to demonstrate the plugin UI extension system.
34
+
35
+ ## API Extensions
36
+
37
+ This plugin does not add any GraphQL API extensions. It only registers custom fields on existing entities, which are automatically exposed through the standard Deenruv GraphQL API.
@@ -0,0 +1,3 @@
1
+ import { OrderLineEvent, OrderStateTransitionEvent, LoginEvent, LogoutEvent } from "@deenruv/core";
2
+ export declare const PLUGIN_INIT_OPTIONS: unique symbol;
3
+ export declare const events: (typeof OrderLineEvent | typeof OrderStateTransitionEvent | typeof LoginEvent | typeof LogoutEvent)[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.events = exports.PLUGIN_INIT_OPTIONS = void 0;
4
+ const core_1 = require("@deenruv/core");
5
+ exports.PLUGIN_INIT_OPTIONS = Symbol("ANALYTICS_PLUGIN_OPTIONS");
6
+ exports.events = [
7
+ core_1.OrderLineEvent,
8
+ core_1.OrderStateTransitionEvent,
9
+ core_1.LoginEvent,
10
+ core_1.LogoutEvent,
11
+ ];
@@ -0,0 +1,2 @@
1
+ export declare class DeenruvExamplesServerPlugin {
2
+ }
@@ -0,0 +1,286 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DeenruvExamplesServerPlugin = void 0;
10
+ const core_1 = require("@deenruv/core");
11
+ let DeenruvExamplesServerPlugin = class DeenruvExamplesServerPlugin {
12
+ };
13
+ exports.DeenruvExamplesServerPlugin = DeenruvExamplesServerPlugin;
14
+ exports.DeenruvExamplesServerPlugin = DeenruvExamplesServerPlugin = __decorate([
15
+ (0, core_1.DeenruvPlugin)({
16
+ compatibility: "0.0.1",
17
+ imports: [core_1.PluginCommonModule],
18
+ controllers: [],
19
+ providers: [],
20
+ configuration: (config) => {
21
+ // PRODUCT
22
+ config.customFields.Product.push({
23
+ name: "discountBy",
24
+ type: "string",
25
+ nullable: true,
26
+ defaultValue: "",
27
+ ui: { component: "string-custom-field-input" },
28
+ label: [
29
+ { languageCode: core_1.LanguageCode.en, value: "Discount by" },
30
+ { languageCode: core_1.LanguageCode.pl, value: "Obniż cenę o" },
31
+ ],
32
+ description: [
33
+ {
34
+ languageCode: core_1.LanguageCode.en,
35
+ value: "This field lets user define discount by given number.",
36
+ },
37
+ {
38
+ languageCode: core_1.LanguageCode.pl,
39
+ value: "Te pole pozwala określić o ile taniej produkt ma kosztować.",
40
+ },
41
+ ],
42
+ });
43
+ config.customFields.Product.push({
44
+ name: "boolTest",
45
+ type: "boolean",
46
+ label: [{ languageCode: core_1.LanguageCode.en, value: "boolean Test" }],
47
+ });
48
+ config.customFields.Product.push({
49
+ name: "floatTest",
50
+ type: "float",
51
+ label: [{ languageCode: core_1.LanguageCode.en, value: "float Test" }],
52
+ });
53
+ config.customFields.Product.push({
54
+ name: "intTest",
55
+ type: "int",
56
+ label: [{ languageCode: core_1.LanguageCode.en, value: "int Test" }],
57
+ });
58
+ config.customFields.Product.push({
59
+ name: "stringTest",
60
+ type: "string",
61
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
62
+ });
63
+ config.customFields.Product.push({
64
+ name: "textTest",
65
+ type: "text",
66
+ label: [{ languageCode: core_1.LanguageCode.en, value: "text Test" }],
67
+ });
68
+ config.customFields.Product.push({
69
+ name: "dateTime",
70
+ type: "datetime",
71
+ label: [{ languageCode: core_1.LanguageCode.en, value: "dateTime Test" }],
72
+ });
73
+ config.customFields.Product.push({
74
+ name: "listTestString",
75
+ type: "string",
76
+ list: true,
77
+ label: [
78
+ { languageCode: core_1.LanguageCode.en, value: "String list test" },
79
+ { languageCode: core_1.LanguageCode.pl, value: "test listy String" },
80
+ ],
81
+ });
82
+ config.customFields.Product.push({
83
+ name: "listTestInt",
84
+ type: "int",
85
+ list: true,
86
+ label: [{ languageCode: core_1.LanguageCode.en, value: "int list test" }],
87
+ });
88
+ config.customFields.Product.push({
89
+ name: "listTestFloat",
90
+ type: "float",
91
+ list: true,
92
+ label: [{ languageCode: core_1.LanguageCode.en, value: "float list test" }],
93
+ });
94
+ config.customFields.Product.push({
95
+ name: "listTestText",
96
+ type: "text",
97
+ list: true,
98
+ label: [{ languageCode: core_1.LanguageCode.en, value: "Text list test" }],
99
+ });
100
+ config.customFields.Product.push({
101
+ name: "listLocaleString",
102
+ list: true,
103
+ type: "localeString",
104
+ label: [
105
+ { languageCode: core_1.LanguageCode.en, value: "listLocaleString Test" },
106
+ ],
107
+ });
108
+ config.customFields.Product.push({
109
+ name: "listLocaleText",
110
+ list: true,
111
+ type: "localeText",
112
+ label: [{ languageCode: core_1.LanguageCode.en, value: "listLocaleText Test" }],
113
+ });
114
+ config.customFields.Product.push({
115
+ name: "singleAssetTestP",
116
+ type: "relation",
117
+ graphQLType: "Asset",
118
+ entity: core_1.Asset,
119
+ public: true,
120
+ nullable: true,
121
+ eager: true,
122
+ label: [{ languageCode: core_1.LanguageCode.en, value: "single asset Test" }],
123
+ description: [
124
+ {
125
+ languageCode: core_1.LanguageCode.en,
126
+ value: "Recommended size: 1200x630px",
127
+ },
128
+ ],
129
+ });
130
+ config.customFields.Product.push({
131
+ name: "listAssetTestP",
132
+ type: "relation",
133
+ graphQLType: "Asset",
134
+ entity: core_1.Asset,
135
+ public: true,
136
+ nullable: true,
137
+ eager: true,
138
+ list: true,
139
+ label: [{ languageCode: core_1.LanguageCode.en, value: "list asset Test" }],
140
+ description: [
141
+ {
142
+ languageCode: core_1.LanguageCode.en,
143
+ value: "Recommended size: 1200x630px",
144
+ },
145
+ ],
146
+ });
147
+ // ORDER
148
+ config.customFields.Order.push({
149
+ name: "attributes",
150
+ type: "text",
151
+ label: [
152
+ { languageCode: core_1.LanguageCode.en, value: "Attributes" },
153
+ { languageCode: core_1.LanguageCode.pl, value: "Atrybuty" },
154
+ ],
155
+ description: [
156
+ {
157
+ languageCode: core_1.LanguageCode.en,
158
+ value: "Here you can specify order attributes",
159
+ },
160
+ {
161
+ languageCode: core_1.LanguageCode.pl,
162
+ value: "Tutaj możesz opisać różne atrybuty zamówienia",
163
+ },
164
+ ],
165
+ defaultValue: "",
166
+ nullable: true,
167
+ }, {
168
+ name: "additionalInfo",
169
+ type: "string",
170
+ label: [
171
+ { languageCode: core_1.LanguageCode.en, value: "Additional info" },
172
+ { languageCode: core_1.LanguageCode.pl, value: "Dodatkowe informacje" },
173
+ ],
174
+ defaultValue: "",
175
+ nullable: true,
176
+ });
177
+ // ORDER_LINE
178
+ config.customFields.OrderLine.push({
179
+ name: "SOMETHING",
180
+ type: "string",
181
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
182
+ });
183
+ // COLLECTION
184
+ config.customFields.Collection.push({
185
+ name: "stringTest",
186
+ type: "string",
187
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
188
+ });
189
+ config.customFields.Collection.push({
190
+ name: "localestringTest",
191
+ type: "localeString",
192
+ label: [{ languageCode: core_1.LanguageCode.en, value: "localestring Test" }],
193
+ });
194
+ // FACET
195
+ config.customFields.Facet.push({
196
+ name: "stringTest",
197
+ type: "string",
198
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
199
+ });
200
+ config.customFields.Facet.push({
201
+ name: "localestringTest",
202
+ type: "localeString",
203
+ label: [{ languageCode: core_1.LanguageCode.en, value: "localestring Test" }],
204
+ });
205
+ config.customFields.Facet.push({
206
+ name: "ProductListTest",
207
+ type: "relation",
208
+ graphQLType: "Product",
209
+ entity: core_1.Product,
210
+ public: true,
211
+ nullable: true,
212
+ eager: true,
213
+ list: true,
214
+ label: [{ languageCode: core_1.LanguageCode.en, value: "list Product Test" }],
215
+ description: [
216
+ {
217
+ languageCode: core_1.LanguageCode.en,
218
+ value: "Recommended size: 1200x630px",
219
+ },
220
+ ],
221
+ });
222
+ config.customFields.Facet.push({
223
+ name: "listProductVariantTest",
224
+ type: "relation",
225
+ graphQLType: "ProductVariant",
226
+ entity: core_1.ProductVariant,
227
+ public: true,
228
+ nullable: true,
229
+ eager: true,
230
+ list: true,
231
+ label: [
232
+ { languageCode: core_1.LanguageCode.en, value: "list product variant test" },
233
+ ],
234
+ });
235
+ //ORDER_LINE
236
+ config.customFields.OrderLine.push({
237
+ name: "stringTest",
238
+ type: "string",
239
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
240
+ });
241
+ config.customFields.OrderLine.push({
242
+ name: "textTest",
243
+ type: "text",
244
+ label: [{ languageCode: core_1.LanguageCode.en, value: "text Test" }],
245
+ });
246
+ //PRODUCT_VARIANT
247
+ config.customFields.ProductVariant.push({
248
+ name: "stringTest",
249
+ type: "string",
250
+ label: [{ languageCode: core_1.LanguageCode.en, value: "string Test" }],
251
+ });
252
+ // ASSET
253
+ config.customFields.Asset.push({
254
+ name: "attributes",
255
+ type: "text",
256
+ label: [
257
+ { languageCode: core_1.LanguageCode.en, value: "Attributes" },
258
+ { languageCode: core_1.LanguageCode.pl, value: "Atrybuty" },
259
+ ],
260
+ description: [
261
+ {
262
+ languageCode: core_1.LanguageCode.en,
263
+ value: "Here you can specify order attributes",
264
+ },
265
+ {
266
+ languageCode: core_1.LanguageCode.pl,
267
+ value: "Tutaj możesz opisać różne atrybuty zamówienia",
268
+ },
269
+ ],
270
+ defaultValue: "",
271
+ nullable: true,
272
+ }, {
273
+ name: "additionalInfo",
274
+ type: "string",
275
+ label: [
276
+ { languageCode: core_1.LanguageCode.en, value: "Additional info" },
277
+ { languageCode: core_1.LanguageCode.pl, value: "Dodatkowe informacje" },
278
+ ],
279
+ defaultValue: "",
280
+ nullable: true,
281
+ });
282
+ // relation fields
283
+ return config;
284
+ },
285
+ })
286
+ ], DeenruvExamplesServerPlugin);
@@ -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
+ };