@mat3ra/wode 2026.6.19-0 → 2026.6.29-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.
@@ -3,17 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const JSONSchemasInterface_1 = __importDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
7
6
  const PointsGridFormDataProvider_1 = __importDefault(require("./PointsGridFormDataProvider"));
8
7
  class IGridFormDataManager extends PointsGridFormDataProvider_1.default {
9
8
  constructor(contextItem, externalContext) {
10
9
  super(contextItem, externalContext, 0.2);
11
10
  this.name = "igrid";
12
- const jsonSchema = JSONSchemasInterface_1.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
13
- if (!jsonSchema) {
14
- throw new Error("Failed to get patched JSON schema");
15
- }
16
- this.jsonSchema = jsonSchema;
11
+ this.jsonSchema = this.buildFormJsonSchema();
17
12
  }
18
13
  static createFromUnitContext(unitContext, externalContext) {
19
14
  const contextItem = this.findContextItem(unitContext, "igrid");
@@ -3,17 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const JSONSchemasInterface_1 = __importDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
7
6
  const PointsGridFormDataProvider_1 = __importDefault(require("./PointsGridFormDataProvider"));
8
7
  class KGridFormDataManager extends PointsGridFormDataProvider_1.default {
9
8
  constructor(contextItem, externalContext) {
10
9
  super(contextItem, externalContext, 1);
11
10
  this.name = "kgrid";
12
- const jsonSchema = JSONSchemasInterface_1.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
13
- if (!jsonSchema) {
14
- throw new Error("Failed to get patched JSON schema");
15
- }
16
- this.jsonSchema = jsonSchema;
11
+ this.jsonSchema = this.buildFormJsonSchema();
17
12
  }
18
13
  static createFromUnitContext(unitContext, externalContext) {
19
14
  const contextItem = this.findContextItem(unitContext, "kgrid");
@@ -36,16 +36,6 @@ declare abstract class PointsGridFormDataProvider<N extends Schema["name"]> exte
36
36
  getData(): Data;
37
37
  getDefaultData(): PointsGridDataProviderSchema;
38
38
  protected get jsonSchemaPatchConfig(): {
39
- dimensions: {
40
- default?: any[] | undefined;
41
- type: string;
42
- items: {
43
- default?: string | number | readonly number[] | readonly string[] | undefined;
44
- type: string;
45
- };
46
- minItems: number;
47
- maxItems: number;
48
- };
49
39
  shifts: {
50
40
  default?: any[] | undefined;
51
41
  type: string;
@@ -113,6 +103,11 @@ declare abstract class PointsGridFormDataProvider<N extends Schema["name"]> exte
113
103
  };
114
104
  };
115
105
  };
106
+ /**
107
+ * Form schema for RJSF. Replaces ESSE `dimensions.anyOf` (number[] | string[]) with a single
108
+ * array type — patch merge cannot remove `anyOf`, which makes RJSF render a branch picker.
109
+ */
110
+ protected buildFormJsonSchema(): JSONSchema7;
116
111
  /** Prefer persisted `data` — `setData` runs before React re-inits the provider on render. */
117
112
  private get preferGridMetricForUi();
118
113
  get uiSchema(): {
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const constants_1 = require("@mat3ra/code/dist/js/constants");
7
7
  const math_1 = require("@mat3ra/code/dist/js/math");
8
+ const JSONSchemasInterface_1 = __importDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
8
9
  const made_1 = require("@mat3ra/made");
9
10
  const MaterialContextMixin_1 = __importDefault(require("../../mixins/MaterialContextMixin"));
10
11
  const JSONSchemaFormDataProvider_1 = __importDefault(require("../base/JSONSchemaFormDataProvider"));
@@ -112,7 +113,6 @@ class PointsGridFormDataProvider extends JSONSchemaFormDataProvider_1.default {
112
113
  };
113
114
  const gridMetricType = ((_a = this.data) === null || _a === void 0 ? void 0 : _a.gridMetricType) || this.defaultMetric.type;
114
115
  return {
115
- dimensions: vector(this.defaultDimensions, this.isUsingJinjaVariables),
116
116
  shifts: vector(defaultShifts),
117
117
  reciprocalVectorRatios: vector(this.reciprocalVectorRatios),
118
118
  gridMetricType: { default: this.defaultMetric.type },
@@ -158,6 +158,18 @@ class PointsGridFormDataProvider extends JSONSchemaFormDataProvider_1.default {
158
158
  },
159
159
  };
160
160
  }
161
+ /**
162
+ * Form schema for RJSF. Replaces ESSE `dimensions.anyOf` (number[] | string[]) with a single
163
+ * array type — patch merge cannot remove `anyOf`, which makes RJSF render a branch picker.
164
+ */
165
+ buildFormJsonSchema() {
166
+ const jsonSchema = JSONSchemasInterface_1.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
167
+ if (!(jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.properties)) {
168
+ throw new Error("Failed to get patched JSON schema");
169
+ }
170
+ jsonSchema.properties.dimensions = vector(this.defaultDimensions, this.isUsingJinjaVariables);
171
+ return jsonSchema;
172
+ }
161
173
  /** Prefer persisted `data` — `setData` runs before React re-inits the provider on render. */
162
174
  get preferGridMetricForUi() {
163
175
  var _a, _b;
@@ -3,17 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const JSONSchemasInterface_1 = __importDefault(require("@mat3ra/esse/dist/js/esse/JSONSchemasInterface"));
7
6
  const PointsGridFormDataProvider_1 = __importDefault(require("./PointsGridFormDataProvider"));
8
7
  class QGridFormDataManager extends PointsGridFormDataProvider_1.default {
9
8
  constructor(contextItem, externalContext) {
10
9
  super(contextItem, externalContext, 5);
11
10
  this.name = "qgrid";
12
- const jsonSchema = JSONSchemasInterface_1.default.getPatchedSchemaById(this.jsonSchemaId, this.jsonSchemaPatchConfig);
13
- if (!jsonSchema) {
14
- throw new Error("Failed to get patched JSON schema");
15
- }
16
- this.jsonSchema = jsonSchema;
11
+ this.jsonSchema = this.buildFormJsonSchema();
17
12
  }
18
13
  static createFromUnitContext(unitContext, externalContext) {
19
14
  const contextItem = this.findContextItem(unitContext, "qgrid");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mat3ra/wode",
3
- "version": "2026.6.19-0",
3
+ "version": "2026.6.29-0",
4
4
  "description": "WOrkflow DEfinitions",
5
5
  "scripts": {
6
6
  "test": "mocha --recursive --bail --require ts-node/register 'tests/js/**/*.ts'",
@@ -1,4 +1,3 @@
1
- import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
1
  import type { GridContextItemSchema } from "@mat3ra/esse/dist/js/types";
3
2
  import type { JSONSchema7 } from "json-schema";
4
3
 
@@ -16,16 +15,7 @@ export default class IGridFormDataManager extends PointsGridFormDataProvider<Nam
16
15
  constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
17
16
  super(contextItem, externalContext, 0.2);
18
17
 
19
- const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(
20
- this.jsonSchemaId,
21
- this.jsonSchemaPatchConfig,
22
- );
23
-
24
- if (!jsonSchema) {
25
- throw new Error("Failed to get patched JSON schema");
26
- }
27
-
28
- this.jsonSchema = jsonSchema;
18
+ this.jsonSchema = this.buildFormJsonSchema();
29
19
  }
30
20
 
31
21
  static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext) {
@@ -1,4 +1,3 @@
1
- import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
1
  import type { GridContextItemSchema } from "@mat3ra/esse/dist/js/types";
3
2
  import type { JSONSchema7 } from "json-schema";
4
3
 
@@ -17,16 +16,7 @@ export default class KGridFormDataManager extends PointsGridFormDataProvider<Nam
17
16
  constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
18
17
  super(contextItem, externalContext, 1);
19
18
 
20
- const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(
21
- this.jsonSchemaId,
22
- this.jsonSchemaPatchConfig,
23
- );
24
-
25
- if (!jsonSchema) {
26
- throw new Error("Failed to get patched JSON schema");
27
- }
28
-
29
- this.jsonSchema = jsonSchema;
19
+ this.jsonSchema = this.buildFormJsonSchema();
30
20
  }
31
21
 
32
22
  static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext) {
@@ -1,13 +1,14 @@
1
1
  import { Units } from "@mat3ra/code/dist/js/constants";
2
2
  import { math as codeJSMath } from "@mat3ra/code/dist/js/math";
3
3
  import type { Constructor } from "@mat3ra/code/dist/js/utils/types";
4
+ import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
4
5
  import type {
5
6
  GridContextItemSchema,
6
7
  PointsGridDataProviderSchema,
7
8
  Vector3DSchema,
8
9
  } from "@mat3ra/esse/dist/js/types";
9
10
  import { type ReciprocalLattice, Made } from "@mat3ra/made";
10
- import type { JSONSchema7 } from "json-schema";
11
+ import type { JSONSchema7, JSONSchema7Definition } from "json-schema";
11
12
 
12
13
  import materialContextMixin, {
13
14
  type MaterialContextMixin,
@@ -81,6 +82,8 @@ abstract class PointsGridFormDataProvider<
81
82
  value: number;
82
83
  };
83
84
 
85
+ // Assigned in subclass constructors via buildFormJsonSchema() — not in this constructor:
86
+ // jsonSchemaPatchConfig uses this.name, which is only set after super() returns.
84
87
  abstract readonly jsonSchema: JSONSchema7;
85
88
 
86
89
  constructor(contextItem: Partial<Schema>, externalContext: ExternalContext, divisor: number) {
@@ -186,7 +189,6 @@ abstract class PointsGridFormDataProvider<
186
189
  const gridMetricType = this.data?.gridMetricType || this.defaultMetric.type;
187
190
 
188
191
  return {
189
- dimensions: vector(this.defaultDimensions, this.isUsingJinjaVariables),
190
192
  shifts: vector(defaultShifts),
191
193
  reciprocalVectorRatios: vector(this.reciprocalVectorRatios),
192
194
  gridMetricType: { default: this.defaultMetric.type },
@@ -235,6 +237,28 @@ abstract class PointsGridFormDataProvider<
235
237
  };
236
238
  }
237
239
 
240
+ /**
241
+ * Form schema for RJSF. Replaces ESSE `dimensions.anyOf` (number[] | string[]) with a single
242
+ * array type — patch merge cannot remove `anyOf`, which makes RJSF render a branch picker.
243
+ */
244
+ protected buildFormJsonSchema(): JSONSchema7 {
245
+ const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(
246
+ this.jsonSchemaId,
247
+ this.jsonSchemaPatchConfig,
248
+ );
249
+
250
+ if (!jsonSchema?.properties) {
251
+ throw new Error("Failed to get patched JSON schema");
252
+ }
253
+
254
+ jsonSchema.properties.dimensions = vector(
255
+ this.defaultDimensions,
256
+ this.isUsingJinjaVariables,
257
+ ) as JSONSchema7Definition;
258
+
259
+ return jsonSchema;
260
+ }
261
+
238
262
  /** Prefer persisted `data` — `setData` runs before React re-inits the provider on render. */
239
263
  private get preferGridMetricForUi() {
240
264
  return this.data?.preferGridMetric ?? this.preferGridMetric;
@@ -1,4 +1,3 @@
1
- import JSONSchemasInterface from "@mat3ra/esse/dist/js/esse/JSONSchemasInterface";
2
1
  import type { GridContextItemSchema } from "@mat3ra/esse/dist/js/types";
3
2
  import type { JSONSchema7 } from "json-schema";
4
3
 
@@ -16,16 +15,7 @@ export default class QGridFormDataManager extends PointsGridFormDataProvider<Nam
16
15
  constructor(contextItem: Partial<Schema>, externalContext: ExternalContext) {
17
16
  super(contextItem, externalContext, 5);
18
17
 
19
- const jsonSchema = JSONSchemasInterface.getPatchedSchemaById(
20
- this.jsonSchemaId,
21
- this.jsonSchemaPatchConfig,
22
- );
23
-
24
- if (!jsonSchema) {
25
- throw new Error("Failed to get patched JSON schema");
26
- }
27
-
28
- this.jsonSchema = jsonSchema;
18
+ this.jsonSchema = this.buildFormJsonSchema();
29
19
  }
30
20
 
31
21
  static createFromUnitContext(unitContext: UnitContext, externalContext: ExternalContext) {