@empty-complete-org/medusa-product-attributes 0.14.1 → 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 (36) hide show
  1. package/.medusa/server/src/admin/index.js +441 -202
  2. package/.medusa/server/src/admin/index.mjs +442 -203
  3. package/.medusa/server/src/api/admin/{attribute-presets → attribute-templates}/[id]/apply/route.js +1 -1
  4. package/.medusa/server/src/api/admin/attribute-templates/[id]/apply/route.js.map +1 -0
  5. package/.medusa/server/src/api/admin/{attribute-presets → attribute-templates}/route.js +6 -6
  6. package/.medusa/server/src/api/admin/attribute-templates/route.js.map +1 -0
  7. package/.medusa/server/src/api/admin/category/[categoryId]/custom-attributes/route.js +1 -1
  8. package/.medusa/server/src/api/admin/category/[categoryId]/custom-attributes/route.js.map +1 -1
  9. package/.medusa/server/src/api/admin/global-attributes/route.d.ts +4 -0
  10. package/.medusa/server/src/api/admin/global-attributes/route.js +30 -0
  11. package/.medusa/server/src/api/admin/global-attributes/route.js.map +1 -0
  12. package/.medusa/server/src/api/admin/product/[productId]/attribute-schema/route.d.ts +2 -0
  13. package/.medusa/server/src/api/admin/product/[productId]/attribute-schema/route.js +34 -0
  14. package/.medusa/server/src/api/admin/product/[productId]/attribute-schema/route.js.map +1 -0
  15. package/.medusa/server/src/modules/product-attributes/index.d.ts +5 -5
  16. package/.medusa/server/src/modules/product-attributes/migrations/Migration20260407120000.d.ts +5 -0
  17. package/.medusa/server/src/modules/product-attributes/migrations/Migration20260407120000.js +58 -0
  18. package/.medusa/server/src/modules/product-attributes/migrations/Migration20260407120000.js.map +1 -0
  19. package/.medusa/server/src/modules/product-attributes/models/{attribute-preset.d.ts → attribute-template.d.ts} +3 -3
  20. package/.medusa/server/src/modules/product-attributes/models/{attribute-preset.js → attribute-template.js} +3 -3
  21. package/.medusa/server/src/modules/product-attributes/models/attribute-template.js.map +1 -0
  22. package/.medusa/server/src/modules/product-attributes/models/category-custom-attribute.d.ts +2 -1
  23. package/.medusa/server/src/modules/product-attributes/models/category-custom-attribute.js +2 -1
  24. package/.medusa/server/src/modules/product-attributes/models/category-custom-attribute.js.map +1 -1
  25. package/.medusa/server/src/modules/product-attributes/models/product-custom-attribute.d.ts +2 -1
  26. package/.medusa/server/src/modules/product-attributes/service.d.ts +56 -17
  27. package/.medusa/server/src/modules/product-attributes/service.js +44 -18
  28. package/.medusa/server/src/modules/product-attributes/service.js.map +1 -1
  29. package/README.md +96 -312
  30. package/README.ru.md +85 -0
  31. package/package.json +1 -1
  32. package/.medusa/server/src/api/admin/attribute-presets/[id]/apply/route.js.map +0 -1
  33. package/.medusa/server/src/api/admin/attribute-presets/route.js.map +0 -1
  34. package/.medusa/server/src/modules/product-attributes/models/attribute-preset.js.map +0 -1
  35. /package/.medusa/server/src/api/admin/{attribute-presets → attribute-templates}/[id]/apply/route.d.ts +0 -0
  36. /package/.medusa/server/src/api/admin/{attribute-presets → attribute-templates}/route.d.ts +0 -0
@@ -6,7 +6,7 @@ async function POST(req, res) {
6
6
  const { id } = req.params;
7
7
  const { category_id } = req.body;
8
8
  const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
9
- const category_custom_attribute = await service.applyPresetToCategory(id, category_id);
9
+ const category_custom_attribute = await service.applyTemplateToCategory(id, category_id);
10
10
  res.status(201).json({ category_custom_attribute });
11
11
  }
12
12
  //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/attribute-templates/[id]/apply/route.ts"],"names":[],"mappings":";;AAIA,oBAMC;AATD,kFAAmF;AAG5E,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IACzB,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,IAA+B,CAAA;IAC3D,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IACxF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACrD,CAAC"}
@@ -6,19 +6,19 @@ exports.PATCH = PATCH;
6
6
  const product_attributes_1 = require("../../../modules/product-attributes");
7
7
  async function GET(req, res) {
8
8
  const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
9
- const attribute_presets = await service.listPresets();
10
- res.json({ attribute_presets });
9
+ const attribute_templates = await service.listTemplates();
10
+ res.json({ attribute_templates });
11
11
  }
12
12
  async function POST(req, res) {
13
13
  const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
14
14
  const body = req.body;
15
- const attribute_preset = await service.createPreset(body);
16
- res.status(201).json({ attribute_preset });
15
+ const attribute_template = await service.createTemplate(body);
16
+ res.status(201).json({ attribute_template });
17
17
  }
18
18
  async function PATCH(req, res) {
19
19
  const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
20
20
  const { id, ...data } = req.body;
21
- const attribute_preset = await service.updatePreset(id, data);
22
- res.json({ attribute_preset });
21
+ const attribute_template = await service.updateTemplate(id, data);
22
+ res.json({ attribute_template });
23
23
  }
24
24
  //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../src/api/admin/attribute-templates/route.ts"],"names":[],"mappings":";;AAIA,kBAIC;AAED,oBAUC;AAED,sBAYC;AAjCD,4EAA6E;AAGtE,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAA;IACzD,GAAG,CAAC,IAAI,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAA;AACnC,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,IAAI,GAAG,GAAG,CAAC,IAKhB,CAAA;IACD,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAA;AAC9C,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,GAAkB,EAAE,GAAmB;IACjE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,IAO3B,CAAA;IACD,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IACjE,GAAG,CAAC,IAAI,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAA;AAClC,CAAC"}
@@ -30,7 +30,7 @@ async function GET(req, res) {
30
30
  const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
31
31
  const productService = req.scope.resolve(utils_1.Modules.PRODUCT);
32
32
  const categoryIds = await resolveAncestorChain(productService, categoryId);
33
- const category_custom_attributes = await service.getAttributesByCategoryIds(categoryIds);
33
+ const category_custom_attributes = await service.getAttributesByCategoryIds(categoryIds, { includeGlobals: false });
34
34
  res.json({ category_custom_attributes });
35
35
  }
36
36
  async function POST(req, res) {
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/category/[categoryId]/custom-attributes/route.ts"],"names":[],"mappings":";;AA6BA,kBASC;AAED,oBAoBC;AAED,sBAcC;AA3ED,qDAAmD;AACnD,kFAAmF;AAGnF;;;;;GAKG;AACH,KAAK,UAAU,oBAAoB,CACjC,cAAmB,EACnB,MAAc;IAEd,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,SAAS,GAAkB,MAAM,CAAA;IACrC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,SAAS,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACrB,MAAM,QAAQ,GAAQ,MAAM,cAAc,CAAC,uBAAuB,CAAC,SAAS,EAAE;YAC5E,MAAM,EAAE,CAAC,IAAI,EAAE,oBAAoB,CAAC;SACrC,CAAC,CAAA;QACF,SAAS,GAAI,QAAQ,EAAE,kBAAoC,IAAI,IAAI,CAAA;QACnE,KAAK,EAAE,CAAA;IACT,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAEM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IACjC,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAEzD,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;IAC1E,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAA;IAExF,GAAG,CAAC,IAAI,CAAC,EAAE,0BAA0B,EAAE,CAAC,CAAA;AAC1C,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IACjC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,IAK7C,CAAA;IAED,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAElF,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC;QACtE,KAAK;QACL,IAAI,EAAE,IAAI,IAAI,MAAM;QACpB,IAAI,EAAE,IAAI,IAAI,IAAI;QAClB,WAAW,EAAE,UAAU;QACvB,UAAU;KACX,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACrD,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,GAAkB,EAAE,GAAmB;IACjE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,IAO3B,CAAA;IAED,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAEjF,GAAG,CAAC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACzC,CAAC"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/category/[categoryId]/custom-attributes/route.ts"],"names":[],"mappings":";;AA6BA,kBASC;AAED,oBAoBC;AAED,sBAcC;AA3ED,qDAAmD;AACnD,kFAAmF;AAGnF;;;;;GAKG;AACH,KAAK,UAAU,oBAAoB,CACjC,cAAmB,EACnB,MAAc;IAEd,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,SAAS,GAAkB,MAAM,CAAA;IACrC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,SAAS,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACrB,MAAM,QAAQ,GAAQ,MAAM,cAAc,CAAC,uBAAuB,CAAC,SAAS,EAAE;YAC5E,MAAM,EAAE,CAAC,IAAI,EAAE,oBAAoB,CAAC;SACrC,CAAC,CAAA;QACF,SAAS,GAAI,QAAQ,EAAE,kBAAoC,IAAI,IAAI,CAAA;QACnE,KAAK,EAAE,CAAA;IACT,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAEM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IACjC,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAEzD,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAA;IAC1E,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,0BAA0B,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;IAEnH,GAAG,CAAC,IAAI,CAAC,EAAE,0BAA0B,EAAE,CAAC,CAAA;AAC1C,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IACjC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,IAK7C,CAAA;IAED,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAElF,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC;QACtE,KAAK;QACL,IAAI,EAAE,IAAI,IAAI,MAAM;QACpB,IAAI,EAAE,IAAI,IAAI,IAAI;QAClB,WAAW,EAAE,UAAU;QACvB,UAAU;KACX,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACrD,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,GAAkB,EAAE,GAAmB;IACjE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,IAO3B,CAAA;IAED,MAAM,yBAAyB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAEjF,GAAG,CAAC,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAA;AACzC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
2
+ export declare function GET(req: MedusaRequest, res: MedusaResponse): Promise<void>;
3
+ export declare function POST(req: MedusaRequest, res: MedusaResponse): Promise<void>;
4
+ export declare function PATCH(req: MedusaRequest, res: MedusaResponse): Promise<void>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET = GET;
4
+ exports.POST = POST;
5
+ exports.PATCH = PATCH;
6
+ const product_attributes_1 = require("../../../modules/product-attributes");
7
+ async function GET(req, res) {
8
+ const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
9
+ const global_attributes = await service.listGlobalAttributes();
10
+ res.json({ global_attributes });
11
+ }
12
+ async function POST(req, res) {
13
+ const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
14
+ const body = req.body;
15
+ const global_attribute = await service.createCategoryAttribute({
16
+ label: body.label,
17
+ type: body.type || "text",
18
+ unit: body.unit ?? null,
19
+ category_id: null,
20
+ is_global: true,
21
+ });
22
+ res.status(201).json({ global_attribute });
23
+ }
24
+ async function PATCH(req, res) {
25
+ const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
26
+ const { id, ...data } = req.body;
27
+ const global_attribute = await service.updateCategoryAttribute(id, data);
28
+ res.json({ global_attribute });
29
+ }
30
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../src/api/admin/global-attributes/route.ts"],"names":[],"mappings":";;AAIA,kBAIC;AAED,oBAeC;AAED,sBAWC;AArCD,4EAA6E;AAGtE,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAA;IAC9D,GAAG,CAAC,IAAI,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAA;AACjC,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,IAAI,GAAG,GAAG,CAAC,IAIhB,CAAA;IACD,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC;QAC7D,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM;QACzB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI;QACvB,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;IACF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAA;AAC5C,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,GAAkB,EAAE,GAAmB;IACjE,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC,IAM3B,CAAA;IACD,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IACxE,GAAG,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAA;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
2
+ export declare function GET(req: MedusaRequest, res: MedusaResponse): Promise<void>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET = GET;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const product_attributes_1 = require("../../../../../modules/product-attributes");
6
+ async function resolveAncestorChain(productService, leafId) {
7
+ const chain = [];
8
+ let currentId = leafId;
9
+ let depth = 0;
10
+ while (currentId && depth < 20) {
11
+ chain.push(currentId);
12
+ const category = await productService.retrieveProductCategory(currentId, {
13
+ select: ["id", "parent_category_id"],
14
+ });
15
+ currentId = category?.parent_category_id ?? null;
16
+ depth++;
17
+ }
18
+ return chain;
19
+ }
20
+ async function GET(req, res) {
21
+ const { productId } = req.params;
22
+ const service = req.scope.resolve(product_attributes_1.CUSTOM_ATTRIBUTE_MODULE);
23
+ const productService = req.scope.resolve(utils_1.Modules.PRODUCT);
24
+ const product = await productService.retrieveProduct(productId, {
25
+ relations: ["categories"],
26
+ });
27
+ const categoryId = product?.categories?.[0]?.id ?? null;
28
+ const categoryIds = categoryId
29
+ ? await resolveAncestorChain(productService, categoryId)
30
+ : [];
31
+ const attributes = await service.getAttributesByCategoryIds(categoryIds);
32
+ res.json({ attributes });
33
+ }
34
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/product/[productId]/attribute-schema/route.ts"],"names":[],"mappings":";;AAuBA,kBAgBC;AAtCD,qDAAmD;AACnD,kFAAmF;AAGnF,KAAK,UAAU,oBAAoB,CACjC,cAAmB,EACnB,MAAc;IAEd,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,SAAS,GAAkB,MAAM,CAAA;IACrC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,SAAS,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACrB,MAAM,QAAQ,GAAQ,MAAM,cAAc,CAAC,uBAAuB,CAAC,SAAS,EAAE;YAC5E,MAAM,EAAE,CAAC,IAAI,EAAE,oBAAoB,CAAC;SACrC,CAAC,CAAA;QACF,SAAS,GAAI,QAAQ,EAAE,kBAAoC,IAAI,IAAI,CAAA;QACnE,KAAK,EAAE,CAAA;IACT,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAEM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,CAAA;IAChC,MAAM,OAAO,GAA2B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,4CAAuB,CAAC,CAAA;IAClF,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAEzD,MAAM,OAAO,GAAQ,MAAM,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE;QACnE,SAAS,EAAE,CAAC,YAAY,CAAC;KAC1B,CAAC,CAAA;IACF,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,IAAI,CAAA;IAEvD,MAAM,WAAW,GAAG,UAAU;QAC5B,CAAC,CAAC,MAAM,oBAAoB,CAAC,cAAc,EAAE,UAAU,CAAC;QACxD,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAA;IAExE,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;AAC1B,CAAC"}
@@ -30,17 +30,17 @@ declare const _default: import("@medusajs/types").ModuleExports<typeof CustomAtt
30
30
  primaryKey: "id";
31
31
  };
32
32
  };
33
- attributePreset: {
33
+ attributeTemplate: {
34
34
  id: {
35
35
  serviceName: "customAttributeModule";
36
- field: "attributePreset";
37
- linkable: "attribute_preset_id";
36
+ field: "attributeTemplate";
37
+ linkable: "attribute_template_id";
38
38
  primaryKey: "id";
39
39
  };
40
40
  toJSON: () => {
41
41
  serviceName: "customAttributeModule";
42
- field: "attributePreset";
43
- linkable: "attribute_preset_id";
42
+ field: "attributeTemplate";
43
+ linkable: "attribute_template_id";
44
44
  primaryKey: "id";
45
45
  };
46
46
  };
@@ -0,0 +1,5 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ export declare class Migration20260407120000 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20260407120000 = void 0;
4
+ const migrations_1 = require("@mikro-orm/migrations");
5
+ class Migration20260407120000 extends migrations_1.Migration {
6
+ async up() {
7
+ // Rename attribute_preset → attribute_template (if it exists)
8
+ this.addSql(`
9
+ DO $$ BEGIN
10
+ IF EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'attribute_preset')
11
+ AND NOT EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'attribute_template')
12
+ THEN
13
+ ALTER TABLE "attribute_preset" RENAME TO "attribute_template";
14
+ ALTER INDEX IF EXISTS "attribute_preset_pkey" RENAME TO "attribute_template_pkey";
15
+ ALTER INDEX IF EXISTS "IDX_attribute_preset_deleted_at" RENAME TO "IDX_attribute_template_deleted_at";
16
+ END IF;
17
+ END $$;
18
+ `);
19
+ // Ensure table exists for fresh installs
20
+ this.addSql(`
21
+ CREATE TABLE IF NOT EXISTS "attribute_template" (
22
+ "id" text NOT NULL,
23
+ "key" text NOT NULL,
24
+ "label" text NOT NULL,
25
+ "type" text NOT NULL DEFAULT 'text',
26
+ "unit" text NULL,
27
+ "description" text NULL,
28
+ "created_at" timestamptz NOT NULL DEFAULT now(),
29
+ "updated_at" timestamptz NOT NULL DEFAULT now(),
30
+ "deleted_at" timestamptz NULL,
31
+ CONSTRAINT "attribute_template_pkey" PRIMARY KEY ("id")
32
+ );
33
+ `);
34
+ this.addSql(`
35
+ CREATE INDEX IF NOT EXISTS "IDX_attribute_template_deleted_at"
36
+ ON "attribute_template" ("deleted_at")
37
+ WHERE "deleted_at" IS NOT NULL;
38
+ `);
39
+ // Add is_global flag + make category_id nullable
40
+ this.addSql(`ALTER TABLE "category_custom_attribute" ALTER COLUMN "category_id" DROP NOT NULL;`);
41
+ this.addSql(`
42
+ ALTER TABLE "category_custom_attribute"
43
+ ADD COLUMN IF NOT EXISTS "is_global" boolean NOT NULL DEFAULT false;
44
+ `);
45
+ this.addSql(`
46
+ CREATE INDEX IF NOT EXISTS "IDX_category_custom_attribute_is_global"
47
+ ON "category_custom_attribute" ("is_global")
48
+ WHERE "deleted_at" IS NULL AND "is_global" = true;
49
+ `);
50
+ }
51
+ async down() {
52
+ this.addSql(`DROP INDEX IF EXISTS "IDX_category_custom_attribute_is_global";`);
53
+ this.addSql(`ALTER TABLE "category_custom_attribute" DROP COLUMN IF EXISTS "is_global";`);
54
+ this.addSql(`ALTER TABLE "category_custom_attribute" ALTER COLUMN "category_id" SET NOT NULL;`);
55
+ }
56
+ }
57
+ exports.Migration20260407120000 = Migration20260407120000;
58
+ //# sourceMappingURL=Migration20260407120000.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20260407120000.js","sourceRoot":"","sources":["../../../../../../src/modules/product-attributes/migrations/Migration20260407120000.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IAC3C,KAAK,CAAC,EAAE;QACf,8DAA8D;QAC9D,IAAI,CAAC,MAAM,CAAC;;;;;;;;;;KAUX,CAAC,CAAA;QAEF,yCAAyC;QACzC,IAAI,CAAC,MAAM,CAAC;;;;;;;;;;;;;KAaX,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC;;;;KAIX,CAAC,CAAA;QAEF,iDAAiD;QACjD,IAAI,CAAC,MAAM,CAAC,mFAAmF,CAAC,CAAA;QAChG,IAAI,CAAC,MAAM,CAAC;;;KAGX,CAAC,CAAA;QACF,IAAI,CAAC,MAAM,CAAC;;;;KAIX,CAAC,CAAA;IACJ,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,iEAAiE,CAAC,CAAA;QAC9E,IAAI,CAAC,MAAM,CAAC,4EAA4E,CAAC,CAAA;QACzF,IAAI,CAAC,MAAM,CAAC,kFAAkF,CAAC,CAAA;IACjG,CAAC;CACF;AAvDD,0DAuDC"}
@@ -1,9 +1,9 @@
1
- declare const AttributePreset: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
1
+ declare const AttributeTemplate: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
2
2
  id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
3
3
  key: import("@medusajs/framework/utils").TextProperty;
4
4
  label: import("@medusajs/framework/utils").TextProperty;
5
5
  type: import("@medusajs/framework/utils").TextProperty;
6
6
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
7
7
  description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
8
- }>, "attribute_preset">;
9
- export default AttributePreset;
8
+ }>, "attribute_template">;
9
+ export default AttributeTemplate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("@medusajs/framework/utils");
4
- const AttributePreset = utils_1.model.define("attribute_preset", {
4
+ const AttributeTemplate = utils_1.model.define("attribute_template", {
5
5
  id: utils_1.model.id().primaryKey(),
6
6
  key: utils_1.model.text(),
7
7
  label: utils_1.model.text(),
@@ -9,5 +9,5 @@ const AttributePreset = utils_1.model.define("attribute_preset", {
9
9
  unit: utils_1.model.text().nullable(),
10
10
  description: utils_1.model.text().nullable(),
11
11
  });
12
- exports.default = AttributePreset;
13
- //# sourceMappingURL=attribute-preset.js.map
12
+ exports.default = AttributeTemplate;
13
+ //# sourceMappingURL=attribute-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-template.js","sourceRoot":"","sources":["../../../../../../src/modules/product-attributes/models/attribute-template.ts"],"names":[],"mappings":";;AAAA,qDAAiD;AAEjD,MAAM,iBAAiB,GAAG,aAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE;IAC3D,EAAE,EAAE,aAAK,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE;IAC3B,GAAG,EAAE,aAAK,CAAC,IAAI,EAAE;IACjB,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;IACnB,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC7B,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAA;AAEF,kBAAe,iBAAiB,CAAA"}
@@ -5,8 +5,9 @@ declare const CategoryCustomAttribute: import("@medusajs/framework/utils").DmlEn
5
5
  label: import("@medusajs/framework/utils").TextProperty;
6
6
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
7
7
  sort_order: import("@medusajs/framework/utils").NumberProperty;
8
- category_id: import("@medusajs/framework/utils").TextProperty;
8
+ category_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
9
9
  is_standard: import("@medusajs/framework/utils").BooleanProperty;
10
+ is_global: import("@medusajs/framework/utils").BooleanProperty;
10
11
  product_custom_attributes: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
11
12
  id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
12
13
  product_id: import("@medusajs/framework/utils").TextProperty;
@@ -13,8 +13,9 @@ const CategoryCustomAttribute = utils_1.model
13
13
  label: utils_1.model.text().default(""),
14
14
  unit: utils_1.model.text().nullable(), // Единица измерения (кг, м, шт и т.д.)
15
15
  sort_order: utils_1.model.number().default(0),
16
- category_id: utils_1.model.text(),
16
+ category_id: utils_1.model.text().nullable(),
17
17
  is_standard: utils_1.model.boolean().default(false), // Стандартные атрибуты (certificates, 3dmodel, manual)
18
+ is_global: utils_1.model.boolean().default(false), // Глобальные атрибуты, применяются ко всем товарам
18
19
  product_custom_attributes: utils_1.model.hasMany(() => product_custom_attribute_1.default),
19
20
  })
20
21
  .cascades({
@@ -1 +1 @@
1
- {"version":3,"file":"category-custom-attribute.js","sourceRoot":"","sources":["../../../../../../src/modules/product-attributes/models/category-custom-attribute.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,0FAA+D;AAE/D,MAAM,uBAAuB,GAAG,aAAK;KAClC,MAAM,CAAC,2BAA2B,EAAE;IACnC,EAAE,EAAE,aAAK,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE;IAC3B,GAAG,EAAE,aAAK,CAAC,IAAI,EAAE;IACjB,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAClC,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,uCAAuC;IACtE,UAAU,EAAE,aAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE;IACzB,WAAW,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,uDAAuD;IACpG,yBAAyB,EAAE,aAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,kCAAsB,CAAC;CACvE,CAAC;KACD,QAAQ,CAAC;IACR,MAAM,EAAE,CAAC,2BAA2B,CAAC;CACtC,CAAC,CAAA;AAEJ,kBAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"category-custom-attribute.js","sourceRoot":"","sources":["../../../../../../src/modules/product-attributes/models/category-custom-attribute.ts"],"names":[],"mappings":";;;;;AAAA,qDAAiD;AACjD,0FAA+D;AAE/D,MAAM,uBAAuB,GAAG,aAAK;KAClC,MAAM,CAAC,2BAA2B,EAAE;IACnC,EAAE,EAAE,aAAK,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE;IAC3B,GAAG,EAAE,aAAK,CAAC,IAAI,EAAE;IACjB,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAClC,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,uCAAuC;IACtE,UAAU,EAAE,aAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACpC,WAAW,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,uDAAuD;IACpG,SAAS,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,mDAAmD;IAC9F,yBAAyB,EAAE,aAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,kCAAsB,CAAC;CACvE,CAAC;KACD,QAAQ,CAAC;IACR,MAAM,EAAE,CAAC,2BAA2B,CAAC;CACtC,CAAC,CAAA;AAEJ,kBAAe,uBAAuB,CAAA"}
@@ -11,8 +11,9 @@ declare const ProductCustomAttribute: import("@medusajs/framework/utils").DmlEnt
11
11
  label: import("@medusajs/framework/utils").TextProperty;
12
12
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
13
13
  sort_order: import("@medusajs/framework/utils").NumberProperty;
14
- category_id: import("@medusajs/framework/utils").TextProperty;
14
+ category_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
15
15
  is_standard: import("@medusajs/framework/utils").BooleanProperty;
16
+ is_global: import("@medusajs/framework/utils").BooleanProperty;
16
17
  product_custom_attributes: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "product_custom_attribute">>;
17
18
  }>, "category_custom_attribute">, undefined>;
18
19
  }>, "product_custom_attribute">;
@@ -6,8 +6,9 @@ declare const CustomAttributeService_base: import("@medusajs/framework/utils").M
6
6
  label: import("@medusajs/framework/utils").TextProperty;
7
7
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
8
8
  sort_order: import("@medusajs/framework/utils").NumberProperty;
9
- category_id: import("@medusajs/framework/utils").TextProperty;
9
+ category_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
10
10
  is_standard: import("@medusajs/framework/utils").BooleanProperty;
11
+ is_global: import("@medusajs/framework/utils").BooleanProperty;
11
12
  product_custom_attributes: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
12
13
  id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
13
14
  product_id: import("@medusajs/framework/utils").TextProperty;
@@ -30,19 +31,20 @@ declare const CustomAttributeService_base: import("@medusajs/framework/utils").M
30
31
  label: import("@medusajs/framework/utils").TextProperty;
31
32
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
32
33
  sort_order: import("@medusajs/framework/utils").NumberProperty;
33
- category_id: import("@medusajs/framework/utils").TextProperty;
34
+ category_id: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
34
35
  is_standard: import("@medusajs/framework/utils").BooleanProperty;
36
+ is_global: import("@medusajs/framework/utils").BooleanProperty;
35
37
  product_custom_attributes: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "product_custom_attribute">>;
36
38
  }>, "category_custom_attribute">, undefined>;
37
39
  }>, "product_custom_attribute">;
38
- AttributePreset: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
40
+ AttributeTemplate: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
39
41
  id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
40
42
  key: import("@medusajs/framework/utils").TextProperty;
41
43
  label: import("@medusajs/framework/utils").TextProperty;
42
44
  type: import("@medusajs/framework/utils").TextProperty;
43
45
  unit: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
44
46
  description: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
45
- }>, "attribute_preset">;
47
+ }>, "attribute_template">;
46
48
  }>>;
47
49
  declare class CustomAttributeService extends CustomAttributeService_base {
48
50
  getCategoryAttributes(categoryId: string): Promise<{
@@ -52,8 +54,9 @@ declare class CustomAttributeService extends CustomAttributeService_base {
52
54
  label: string;
53
55
  unit: string | null;
54
56
  sort_order: number;
55
- category_id: string;
57
+ category_id: string | null;
56
58
  is_standard: boolean;
59
+ is_global: boolean;
57
60
  product_custom_attributes: {
58
61
  id: string;
59
62
  product_id: string;
@@ -71,13 +74,16 @@ declare class CustomAttributeService extends CustomAttributeService_base {
71
74
  updated_at: Date;
72
75
  deleted_at: Date | null;
73
76
  }[]>;
74
- getAttributesByCategoryIds(categoryIds: string[]): Promise<any[]>;
77
+ getAttributesByCategoryIds(categoryIds: string[], opts?: {
78
+ includeGlobals?: boolean;
79
+ }): Promise<any[]>;
75
80
  createCategoryAttribute(data: {
76
81
  label: string;
77
82
  type: string;
78
83
  unit?: string | null;
79
- category_id: string;
84
+ category_id?: string | null;
80
85
  is_standard?: boolean;
86
+ is_global?: boolean;
81
87
  sort_order?: number;
82
88
  }): Promise<{
83
89
  id: string;
@@ -86,8 +92,9 @@ declare class CustomAttributeService extends CustomAttributeService_base {
86
92
  label: string;
87
93
  unit: string | null;
88
94
  sort_order: number;
89
- category_id: string;
95
+ category_id: string | null;
90
96
  is_standard: boolean;
97
+ is_global: boolean;
91
98
  product_custom_attributes: {
92
99
  id: string;
93
100
  product_id: string;
@@ -118,8 +125,36 @@ declare class CustomAttributeService extends CustomAttributeService_base {
118
125
  label: string;
119
126
  unit: string | null;
120
127
  sort_order: number;
121
- category_id: string;
128
+ category_id: string | null;
122
129
  is_standard: boolean;
130
+ is_global: boolean;
131
+ product_custom_attributes: {
132
+ id: string;
133
+ product_id: string;
134
+ value: string;
135
+ value_numeric: number | null;
136
+ value_file: string | null;
137
+ category_custom_attribute: /*elided*/ any;
138
+ raw_value_numeric: Record<string, unknown> | null;
139
+ created_at: Date;
140
+ updated_at: Date;
141
+ deleted_at: Date | null;
142
+ category_custom_attribute_id: string;
143
+ }[];
144
+ created_at: Date;
145
+ updated_at: Date;
146
+ deleted_at: Date | null;
147
+ }[]>;
148
+ listGlobalAttributes(): Promise<{
149
+ id: string;
150
+ key: string;
151
+ type: string;
152
+ label: string;
153
+ unit: string | null;
154
+ sort_order: number;
155
+ category_id: string | null;
156
+ is_standard: boolean;
157
+ is_global: boolean;
123
158
  product_custom_attributes: {
124
159
  id: string;
125
160
  product_id: string;
@@ -156,8 +191,9 @@ declare class CustomAttributeService extends CustomAttributeService_base {
156
191
  label: string;
157
192
  unit: string | null;
158
193
  sort_order: number;
159
- category_id: string;
194
+ category_id: string | null;
160
195
  is_standard: boolean;
196
+ is_global: boolean;
161
197
  product_custom_attributes: /*elided*/ any[];
162
198
  created_at: Date;
163
199
  updated_at: Date;
@@ -187,8 +223,9 @@ declare class CustomAttributeService extends CustomAttributeService_base {
187
223
  label: string;
188
224
  unit: string | null;
189
225
  sort_order: number;
190
- category_id: string;
226
+ category_id: string | null;
191
227
  is_standard: boolean;
228
+ is_global: boolean;
192
229
  product_custom_attributes: /*elided*/ any[];
193
230
  created_at: Date;
194
231
  updated_at: Date;
@@ -213,8 +250,9 @@ declare class CustomAttributeService extends CustomAttributeService_base {
213
250
  label: string;
214
251
  unit: string | null;
215
252
  sort_order: number;
216
- category_id: string;
253
+ category_id: string | null;
217
254
  is_standard: boolean;
255
+ is_global: boolean;
218
256
  product_custom_attributes: /*elided*/ any[];
219
257
  created_at: Date;
220
258
  updated_at: Date;
@@ -226,7 +264,7 @@ declare class CustomAttributeService extends CustomAttributeService_base {
226
264
  deleted_at: Date | null;
227
265
  category_custom_attribute_id: string;
228
266
  }[]>;
229
- listPresets(): Promise<{
267
+ listTemplates(): Promise<{
230
268
  id: string;
231
269
  key: string;
232
270
  label: string;
@@ -237,7 +275,7 @@ declare class CustomAttributeService extends CustomAttributeService_base {
237
275
  updated_at: Date;
238
276
  deleted_at: Date | null;
239
277
  }[]>;
240
- createPreset(data: {
278
+ createTemplate(data: {
241
279
  label: string;
242
280
  type?: string;
243
281
  unit?: string | null;
@@ -253,7 +291,7 @@ declare class CustomAttributeService extends CustomAttributeService_base {
253
291
  updated_at: Date;
254
292
  deleted_at: Date | null;
255
293
  }>;
256
- updatePreset(id: string, data: {
294
+ updateTemplate(id: string, data: {
257
295
  label?: string;
258
296
  type?: string;
259
297
  unit?: string | null;
@@ -270,15 +308,16 @@ declare class CustomAttributeService extends CustomAttributeService_base {
270
308
  updated_at: Date;
271
309
  deleted_at: Date | null;
272
310
  }[]>;
273
- applyPresetToCategory(presetId: string, categoryId: string): Promise<{
311
+ applyTemplateToCategory(templateId: string, categoryId: string): Promise<{
274
312
  id: string;
275
313
  key: string;
276
314
  type: string;
277
315
  label: string;
278
316
  unit: string | null;
279
317
  sort_order: number;
280
- category_id: string;
318
+ category_id: string | null;
281
319
  is_standard: boolean;
320
+ is_global: boolean;
282
321
  product_custom_attributes: {
283
322
  id: string;
284
323
  product_id: string;