@microtronics/studio-cli 0.38.0 → 0.40.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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,23 @@
1
1
  # Changelog
2
2
 
3
- ## 0.38.0 (2025-10-23)
3
+ ## 0.40.0 (2025-11-11)
4
4
 
5
5
  ### Features
6
6
 
7
+ * add lowercase property mapping for timeseries containers ([24f575e](https://bitbucket.org/microtronics-core/vscode-studio/commits/24f575efa418417c5fd612e55bd17f5fb80972cf))
8
+
9
+ ## 0.39.0 (2025-11-10)
10
+
11
+ ### Bug Fixes
12
+
13
+ * add separate schema for single record requests ([a52d269](https://bitbucket.org/microtronics-core/vscode-studio/commits/a52d2692ef2e66dbcf49c4b8154c6a4d28d04b2e))
14
+ * fix response schemas for timeseries ([1b24c1c](https://bitbucket.org/microtronics-core/vscode-studio/commits/1b24c1c3deb867b4ab721b4c498930b2cbbd2526))
15
+ * update test fixtures for dde openapi generation ([9653e18](https://bitbucket.org/microtronics-core/vscode-studio/commits/9653e18477bba138a8906d51bc3118470af092fe))
16
+
17
+ ## 0.38.0 (2025-10-23)
18
+
19
+ ### Features
20
+
7
21
  * **cli:** dde generation filter out used containers in precompiler ([15a6c3e](https://bitbucket.org/microtronics-core/vscode-studio/commits/15a6c3eebb8245a3673311de64fa493dfc8c2094))
8
22
 
9
23
  ## 0.37.0 (2025-10-22)
@@ -285,6 +285,7 @@ function generateSchemasFromContainer(apiDescription, containerDefinition, conte
285
285
  properties: {}
286
286
  };
287
287
  const requiredProperties = [];
288
+ const isTimeseriesContainer = containerDefinition.containerType === ContainerType.hx;
288
289
  for (const field of containerDefinition.fields) {
289
290
  if (field.library !== context || field.type === 'shadow') {
290
291
  continue;
@@ -297,27 +298,38 @@ function generateSchemasFromContainer(apiDescription, containerDefinition, conte
297
298
  }
298
299
  schema.required = requiredProperties.length ? requiredProperties : undefined;
299
300
  apiDescription.components.schemas[schemaName] = schema;
300
- if (containerDefinition.containerType === ContainerType.hx) {
301
- apiDescription.components.schemas[`${schemaName}Request`] = {
302
- allOf: [
303
- timeseriesRequestBaseRef,
304
- {
305
- type: 'object',
306
- description: `Request schema of "${containerDefinition.title}"`,
307
- additionalProperties: false,
308
- properties: {
309
- select: {
310
- type: 'array',
311
- description: 'Optional selection of specific fields of the given container',
312
- items: {
313
- type: 'string',
314
- enum: Object.keys(schema.properties)
315
- }
316
- }
301
+ const originalProperties = schema.properties;
302
+ if (isTimeseriesContainer) {
303
+ schema.required = schema.required?.map(name => name.toLowerCase());
304
+ const lowerCaseProperties = {};
305
+ for (const [key, value] of Object.entries(schema.properties)) {
306
+ lowerCaseProperties[key.toLowerCase()] = value;
307
+ }
308
+ schema.properties = lowerCaseProperties;
309
+ }
310
+ if (isTimeseriesContainer) {
311
+ const timerSeriesSelect = {
312
+ type: 'object',
313
+ description: `Request schema of "${containerDefinition.title}"`,
314
+ additionalProperties: false,
315
+ properties: {
316
+ select: {
317
+ type: 'array',
318
+ description: 'Optional selection of specific fields of the given container',
319
+ items: {
320
+ type: 'string',
321
+ enum: Object.keys(originalProperties)
317
322
  }
318
323
  }
319
- ]
324
+ }
325
+ };
326
+ apiDescription.components.schemas[`${schemaName}RequestSingle`] = timerSeriesSelect;
327
+ apiDescription.components.schemas[`${schemaName}Request`] = {
328
+ allOf: [timeseriesRequestBaseRef, timerSeriesSelect]
320
329
  };
330
+ // stamp parameter is always returned if it is a timeseries container
331
+ schema.properties['stamp'] = rapidM2MStampRef;
332
+ requiredProperties.push('stamp');
321
333
  }
322
334
  }
323
335
  function getApiDefinitionForField(field) {
@@ -606,17 +618,31 @@ function generatePathInformationFromContainer(apiDescription, containerDefinitio
606
618
  value?.tags?.unshift(...pathOptions.tags);
607
619
  });
608
620
  apiDescription.paths[pathOptions.path] = methods;
621
+ const histdataSingleResponse = {
622
+ ...successfulOperationResponse,
623
+ content: {
624
+ 'application/json': {
625
+ schema: {
626
+ $ref: `#/components/schemas/${containerDefinition.title}`
627
+ }
628
+ }
629
+ }
630
+ };
609
631
  const youngestPath = `${pathOptions.path}/youngest`;
610
632
  const youngestMethod = {
611
633
  get: structuredClone(methods.get)
612
634
  };
613
635
  youngestMethod.get.summary = `Get the youngest record of "${containerDefinition.title}" container`;
636
+ youngestMethod.get.responses['200'] = histdataSingleResponse;
637
+ youngestMethod.get.parameters[1].schema.$ref = `#/components/schemas/${containerDefinition.title}RequestSingle`;
614
638
  apiDescription.paths[youngestPath] = youngestMethod;
615
639
  const oldestPath = `${pathOptions.path}/oldest`;
616
640
  const oldestMethod = {
617
641
  get: structuredClone(methods.get)
618
642
  };
619
643
  oldestMethod.get.summary = `Get the oldest record of "${containerDefinition.title}" container`;
644
+ oldestMethod.get.responses['200'] = histdataSingleResponse;
645
+ oldestMethod.get.parameters[1].schema.$ref = `#/components/schemas/${containerDefinition.title}RequestSingle`;
620
646
  apiDescription.paths[oldestPath] = oldestMethod;
621
647
  }
622
648
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",