@microtronics/studio-cli 0.39.0 → 0.41.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,11 +1,25 @@
1
1
  # Changelog
2
2
 
3
- ## 0.39.0 (2025-11-10)
3
+ ## 0.41.0 (2026-01-12)
4
4
 
5
- ### Bug Fixes
5
+ ### Features
6
6
 
7
- * add separate schema for single record requests ([a52d269](https://bitbucket.org/microtronics-core/vscode-studio/commits/a52d2692ef2e66dbcf49c4b8154c6a4d28d04b2e))
8
- * fix response schemas for timeseries ([1b24c1c](https://bitbucket.org/microtronics-core/vscode-studio/commits/1b24c1c3deb867b4ab721b4c498930b2cbbd2526))
7
+ * add validation for maxInstancesPerSite manifest property ([065dc98](https://bitbucket.org/microtronics-core/vscode-studio/commits/065dc9809e8dccb75b74c5b52a58ce4ec15b5860))
8
+ * use manifest maxInstancesPerSite for addon package header ([0350d2a](https://bitbucket.org/microtronics-core/vscode-studio/commits/0350d2af8ee3aae0ddbb00d7af5cd0b1c2c4cdd5))
9
+ * validate manifest before building package ([e70fc0e](https://bitbucket.org/microtronics-core/vscode-studio/commits/e70fc0ef9c89849ce2c19ec0a9bb575a764a3b07))
10
+
11
+ ## 0.40.0 (2025-11-11)
12
+
13
+ ### Features
14
+
15
+ * add lowercase property mapping for timeseries containers ([24f575e](https://bitbucket.org/microtronics-core/vscode-studio/commits/24f575efa418417c5fd612e55bd17f5fb80972cf))
16
+
17
+ ## 0.39.0 (2025-11-10)
18
+
19
+ ### Bug Fixes
20
+
21
+ * add separate schema for single record requests ([a52d269](https://bitbucket.org/microtronics-core/vscode-studio/commits/a52d2692ef2e66dbcf49c4b8154c6a4d28d04b2e))
22
+ * fix response schemas for timeseries ([1b24c1c](https://bitbucket.org/microtronics-core/vscode-studio/commits/1b24c1c3deb867b4ab721b4c498930b2cbbd2526))
9
23
  * update test fixtures for dde openapi generation ([9653e18](https://bitbucket.org/microtronics-core/vscode-studio/commits/9653e18477bba138a8906d51bc3118470af092fe))
10
24
 
11
25
  ## 0.38.0 (2025-10-23)
@@ -2183,6 +2183,7 @@ export declare namespace Manifest {
2183
2183
  description: string;
2184
2184
  type: ProjectTypes;
2185
2185
  legacyProject?: boolean;
2186
+ maxInstancesPerSite?: number;
2186
2187
  icon?: string;
2187
2188
  dpid?: DeviceProfiles;
2188
2189
  engines?: {
package/out/api.js CHANGED
@@ -50,19 +50,14 @@ Object.defineProperty(exports, "Log", { enumerable: true, get: function () { ret
50
50
  * @return {Promise<void>} A promise that resolves when the installation process completes successfully or logs an error if it fails.
51
51
  */
52
52
  async function install(cwd, fs, env, apiToken, dependencies) {
53
- try {
54
- if (dependencies.length > 0) {
55
- for (const dependency of dependencies) {
56
- const [libraryId, version] = dependency.split('@');
57
- await dependencies_1.Dependencies.installDependency(cwd, fs, env, apiToken, libraryId, version || null);
58
- }
59
- }
60
- else {
61
- return await dependencies_1.Dependencies.installDependencies(cwd, fs, env, apiToken);
53
+ if (dependencies.length > 0) {
54
+ for (const dependency of dependencies) {
55
+ const [libraryId, version] = dependency.split('@');
56
+ await dependencies_1.Dependencies.installDependency(cwd, fs, env, apiToken, libraryId, version || null);
62
57
  }
63
58
  }
64
- catch (e) {
65
- console.error(e);
59
+ else {
60
+ return await dependencies_1.Dependencies.installDependencies(cwd, fs, env, apiToken);
66
61
  }
67
62
  }
68
63
  /**
@@ -78,6 +73,7 @@ async function install(cwd, fs, env, apiToken, dependencies) {
78
73
  * @return {Promise<Object>} A promise resolved with an object containing diagnostics information for the specified project parts: `dde`, `dlo`, and `dfiles`.
79
74
  */
80
75
  async function build(cwd, fs, logger, env, apiToken = null, selectedParts = true, errorWithDiagnostics) {
76
+ await manifest_1.Manifest.validateBasicManifest(cwd, fs, null);
81
77
  return package_1.Package.buildAll(cwd, fs, logger, env, apiToken, selectedParts, errorWithDiagnostics);
82
78
  }
83
79
  /**
@@ -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,7 +298,16 @@ 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
+ 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) {
301
311
  const timerSeriesSelect = {
302
312
  type: 'object',
303
313
  description: `Request schema of "${containerDefinition.title}"`,
@@ -308,7 +318,7 @@ function generateSchemasFromContainer(apiDescription, containerDefinition, conte
308
318
  description: 'Optional selection of specific fields of the given container',
309
319
  items: {
310
320
  type: 'string',
311
- enum: Object.keys(schema.properties)
321
+ enum: Object.keys(originalProperties)
312
322
  }
313
323
  }
314
324
  }
@@ -319,6 +329,7 @@ function generateSchemasFromContainer(apiDescription, containerDefinition, conte
319
329
  };
320
330
  // stamp parameter is always returned if it is a timeseries container
321
331
  schema.properties['stamp'] = rapidM2MStampRef;
332
+ requiredProperties.push('stamp');
322
333
  }
323
334
  }
324
335
  function getApiDefinitionForField(field) {
package/out/manifest.js CHANGED
@@ -183,6 +183,7 @@ var Manifest;
183
183
  validateProjectVersion(manifest);
184
184
  validatePOVSettings(manifest);
185
185
  validateBLOSettings(manifest);
186
+ validateMaxInstancesPerSite(manifest);
186
187
  }
187
188
  Manifest.validateBasicManifest = validateBasicManifest;
188
189
  function validateLibraryName(libraryName) {
@@ -433,6 +434,27 @@ function validateAddonOrAnalyticsSupported(manifest) {
433
434
  throw new Error(`For project type "${manifest.type}", "dpid" is not supported!"`);
434
435
  }
435
436
  }
437
+ function validateMaxInstancesPerSite(manifest) {
438
+ const { maxInstancesPerSite } = manifest;
439
+ // If maxInstancesPerSite is not defined, check if it's required
440
+ if (maxInstancesPerSite === undefined) {
441
+ if (Manifest.isAddon(manifest)) {
442
+ throw new Error('Property "maxInstancesPerSite" is required for addon projects!');
443
+ }
444
+ return;
445
+ }
446
+ // If maxInstancesPerSite is defined, validate it's only allowed for addon projects
447
+ if (!Manifest.isAddon(manifest)) {
448
+ throw new Error(`Property "maxInstancesPerSite" is only allowed for addon projects!`);
449
+ }
450
+ // Validate the value
451
+ if (!Number.isInteger(maxInstancesPerSite)) {
452
+ throw new Error('Property "maxInstancesPerSite" must be an integer!');
453
+ }
454
+ if (maxInstancesPerSite < 1 || maxInstancesPerSite > 100) {
455
+ throw new Error('Property "maxInstancesPerSite" must be between 1 and 100!');
456
+ }
457
+ }
436
458
  /**
437
459
  * Check based on the current env if the given version string is correct
438
460
  * @param manifest
@@ -54,7 +54,7 @@ var APM;
54
54
  tagHeader.required_hwfw = undefined;
55
55
  tagHeader.required_productcode = undefined;
56
56
  tagHeader.addon_max_sources = 1;
57
- tagHeader.addon_max_per_site = 1;
57
+ tagHeader.addon_max_per_site = manifest.maxInstancesPerSite;
58
58
  }
59
59
  return tagHeader;
60
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",