trm-core 9.9.0 → 9.10.1

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.txt CHANGED
@@ -8,6 +8,16 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2026-07-23 v9.10.1
12
+ -------------------
13
+ + node package for bundled solutions
14
+
15
+ 2026-07-22 v9.10.0
16
+ -------------------
17
+ + changelog publish support
18
+ ! trm-registry-types ^2.4.0
19
+ + async publish
20
+
11
21
  2026-07-20 v9.9.0
12
22
  -------------------
13
23
  * rest package update
@@ -32,6 +32,7 @@ export interface PublishActionInput {
32
32
  keepLatestReleaseManifestValues?: boolean;
33
33
  private?: boolean;
34
34
  readme?: string;
35
+ changelog?: string;
35
36
  skipCustomizingTransports?: boolean;
36
37
  customizingTransports?: string | Transport[];
37
38
  noLanguageTransport?: boolean;
@@ -33,6 +33,7 @@ const updatePackageData_1 = require("./updatePackageData");
33
33
  const publishToRegistry_1 = require("./publishToRegistry");
34
34
  const getSourceCode_1 = require("./getSourceCode");
35
35
  const checkAllObjectsReleased_1 = require("./checkAllObjectsReleased");
36
+ const setChangelog_1 = require("./setChangelog");
36
37
  ;
37
38
  const WORKFLOW_NAME = 'publish';
38
39
  function publish(inputData) {
@@ -48,6 +49,7 @@ function publish(inputData) {
48
49
  setManifestValues_1.setManifestValues,
49
50
  setCustomizingTransports_1.setCustomizingTransports,
50
51
  setReadme_1.setReadme,
52
+ setChangelog_1.setChangelog,
51
53
  getSourceCode_1.getSourceCode,
52
54
  checkAllObjectsReleased_1.checkAllObjectsReleased,
53
55
  generateDevcTransport_1.generateDevcTransport,
@@ -30,7 +30,8 @@ exports.publishToRegistry = {
30
30
  yield context.runtime.trmPackage.package.publish({
31
31
  artifact: context.runtime.trmPackage.artifact,
32
32
  readme: context.rawInput.publishData.readme,
33
- tags: context.rawInput.packageData.tags
33
+ tags: context.rawInput.packageData.tags,
34
+ changelog: context.rawInput.publishData.changelog
34
35
  });
35
36
  })
36
37
  };
@@ -0,0 +1,3 @@
1
+ import { Step } from "@simonegaffurini/sammarksworkflow";
2
+ import { PublishWorkflowContext } from ".";
3
+ export declare const setChangelog: Step<PublishWorkflowContext>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.setChangelog = void 0;
13
+ const trm_commons_1 = require("trm-commons");
14
+ const registry_1 = require("../../registry");
15
+ exports.setChangelog = {
16
+ name: 'set-changelog',
17
+ filter: (context) => __awaiter(void 0, void 0, void 0, function* () {
18
+ if (context.rawInput.publishData.changelog !== undefined) {
19
+ trm_commons_1.Logger.log(`Skipping changelog input (user provided)`, true);
20
+ return false;
21
+ }
22
+ else {
23
+ if (context.rawInput.packageData.registry.getRegistryType() === registry_1.RegistryType.LOCAL) {
24
+ trm_commons_1.Logger.log(`Skipping changelog input (registry is local)`, true);
25
+ return false;
26
+ }
27
+ else {
28
+ return true;
29
+ }
30
+ }
31
+ }),
32
+ run: (context) => __awaiter(void 0, void 0, void 0, function* () {
33
+ trm_commons_1.Logger.log('Set changelog step', true);
34
+ if (!context.rawInput.contextData.noInquirer) {
35
+ context.rawInput.publishData.changelog = (yield trm_commons_1.Inquirer.prompt([{
36
+ message: `Do you want to write a release changelog?`,
37
+ type: 'confirm',
38
+ name: 'editChangelog',
39
+ default: false
40
+ }, {
41
+ message: 'Write changelog',
42
+ type: 'editor',
43
+ name: 'changelog',
44
+ postfix: '.md',
45
+ when: (hash) => {
46
+ return hash.editChangelog;
47
+ },
48
+ default: `${context.rawInput.packageData.name} changelog
49
+ =================
50
+
51
+ Legend
52
+ ------
53
+ \`\`\`
54
+ * : fixed
55
+ ! : changed
56
+ + : added
57
+ - : removed
58
+ \`\`\`
59
+
60
+ ${new Date().toISOString().split('T')[0]} v${context.runtime.trmPackage.manifest.version}
61
+ -------------------
62
+ \`\`\`
63
+ ...
64
+ \`\`\`
65
+ `
66
+ }])).changelog;
67
+ }
68
+ })
69
+ };
@@ -5,6 +5,17 @@ const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  const trm_commons_1 = require("trm-commons");
7
7
  function getNodePackage(globalPath, packageName) {
8
+ if (process.env.TRM_PREFER_BUNDLED_PACKAGES === '1') {
9
+ const parts = __dirname.split(node_path_1.sep);
10
+ const index = parts.lastIndexOf('node_modules');
11
+ const requestedPackage = packageName || 'trm-core';
12
+ if (index !== -1) {
13
+ try {
14
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(parts.slice(0, index + 1).join(node_path_1.sep), requestedPackage, 'package.json'), 'utf8'));
15
+ }
16
+ catch (_a) { }
17
+ }
18
+ }
8
19
  if (!globalPath) {
9
20
  globalPath = (0, trm_commons_1.getGlobalNodeModules)();
10
21
  }
@@ -15,20 +26,20 @@ function getNodePackage(globalPath, packageName) {
15
26
  try {
16
27
  return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(parts.slice(0, index + 1).join(node_path_1.sep), packageName, 'package.json'), 'utf8'));
17
28
  }
18
- catch (_a) { }
29
+ catch (_b) { }
19
30
  try {
20
31
  const data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(parts.slice(0, index + 1).join(node_path_1.sep), '..'), 'package.json'), 'utf8'));
21
32
  if (data.name === packageName) {
22
33
  return data;
23
34
  }
24
35
  }
25
- catch (_b) { }
36
+ catch (_c) { }
26
37
  }
27
38
  else {
28
39
  try {
29
40
  return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(parts.slice(0, index + 1).join(node_path_1.sep), 'trm-core', 'package.json'), 'utf8'));
30
41
  }
31
- catch (_c) { }
42
+ catch (_d) { }
32
43
  }
33
44
  }
34
45
  else {
@@ -41,19 +52,19 @@ function getNodePackage(globalPath, packageName) {
41
52
  return data;
42
53
  }
43
54
  }
44
- catch (_d) { }
55
+ catch (_e) { }
45
56
  try {
46
57
  return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'node_modules', packageName, 'package.json'), 'utf8'));
47
58
  }
48
- catch (_e) { }
59
+ catch (_f) { }
49
60
  try {
50
61
  return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), packageName, 'package.json'), 'utf8'));
51
62
  }
52
- catch (_f) { }
63
+ catch (_g) { }
53
64
  try {
54
65
  return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), 'node_modules', packageName, 'package.json'), 'utf8'));
55
66
  }
56
- catch (_g) { }
67
+ catch (_h) { }
57
68
  }
58
69
  throw new Error(`Couldn't find "${packageName}" package.json!`);
59
70
  }
@@ -13,7 +13,7 @@ export declare abstract class AbstractRegistry {
13
13
  abstract getPackage: (fullName: string, version: string) => Promise<Package>;
14
14
  abstract downloadArtifact: (fullName: string, version: string) => Promise<TrmArtifact>;
15
15
  abstract validatePublish: (fullName: string, version: string, isPrivate: boolean) => Promise<void>;
16
- abstract publish: (fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string) => Promise<Package | void>;
16
+ abstract publish: (fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string, changelog?: string) => Promise<Package | void>;
17
17
  abstract unpublish: (fullName: string, version: string) => Promise<void>;
18
18
  abstract deprecate: (fullName: string, version: string, deprecate: Deprecate) => Promise<void>;
19
19
  abstract addDistTag: (fullName: string, distTag: DistTagAdd) => Promise<void>;
@@ -26,7 +26,7 @@ export declare class RegistryV2 implements AbstractRegistry {
26
26
  getPackage(fullName: string, version?: string): Promise<Package>;
27
27
  downloadArtifact(fullName: string, version?: string): Promise<TrmArtifact>;
28
28
  validatePublish(fullName: string, version: string, isPrivate: boolean): Promise<void>;
29
- publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string): Promise<void>;
29
+ publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string, tags?: string, changelog?: string): Promise<void>;
30
30
  unpublish(fullName: string, version: string): Promise<void>;
31
31
  deprecate(fullName: string, version: string, deprecate: Deprecate): Promise<void>;
32
32
  addDistTag(fullName: string, distTag: DistTagAdd): Promise<void>;
@@ -459,7 +459,7 @@ class RegistryV2 {
459
459
  }
460
460
  });
461
461
  }
462
- publish(fullName, version, artifact, readme, tags) {
462
+ publish(fullName, version, artifact, readme, tags, changelog) {
463
463
  return __awaiter(this, void 0, void 0, function* () {
464
464
  const fileName = `${fullName}_v${version}`.replace('.', '_') + '.trm';
465
465
  const formData = new FormData.default();
@@ -473,14 +473,46 @@ class RegistryV2 {
473
473
  contentType: 'text/markdown'
474
474
  });
475
475
  }
476
+ if (changelog) {
477
+ formData.append('changelog', Buffer.from(changelog), {
478
+ filename: 'changelog.md',
479
+ contentType: 'text/markdown'
480
+ });
481
+ }
476
482
  var params = { version, tags };
477
483
  if (!tags) {
478
484
  delete params.tags;
479
485
  }
480
- yield this._axiosInstance.post(`/publish/${fullName}`, formData, {
486
+ const response = yield this._axiosInstance.post(`/publish/${fullName}`, formData, {
481
487
  params,
482
488
  headers: formData.getHeaders()
483
489
  });
490
+ if (response.status === 202) {
491
+ let publishStatus = response.data;
492
+ const progressPoolUrl = publishStatus.progress_pool_url;
493
+ const logProgress = trm_commons_1.Logger.progressbar(`↑ ${fullName} ${version} [{bar}] {value}/{total} {message} | Last refresh: {lastRefresh}`, '>');
494
+ logProgress.start(publishStatus.steps, publishStatus.current_step, {
495
+ message: publishStatus.current_step_message || '',
496
+ lastRefresh: new Date().toLocaleTimeString()
497
+ });
498
+ try {
499
+ while (publishStatus.current_step < publishStatus.steps) {
500
+ yield new Promise(resolve => setTimeout(resolve, 5000));
501
+ publishStatus = (yield this._axiosInstance.get(progressPoolUrl)).data;
502
+ logProgress.update(publishStatus.current_step, {
503
+ message: publishStatus.current_step_message || '',
504
+ lastCheck: new Date().toLocaleTimeString()
505
+ });
506
+ }
507
+ }
508
+ catch (e) {
509
+ trm_commons_1.Logger.error(e.toString());
510
+ trm_commons_1.Logger.warning(`Unable to check status on registry, check manually`);
511
+ }
512
+ finally {
513
+ logProgress.stop();
514
+ }
515
+ }
484
516
  });
485
517
  }
486
518
  unpublish(fullName, version) {
@@ -25,6 +25,7 @@ export declare class TrmPackage {
25
25
  artifact: TrmArtifact;
26
26
  readme?: string;
27
27
  tags?: string[];
28
+ changelog?: string;
28
29
  }): Promise<TrmPackage>;
29
30
  compareRegistry(registry: AbstractRegistry): boolean;
30
31
  compareName(name: string): boolean;
@@ -51,7 +51,7 @@ class TrmPackage {
51
51
  tags = data.tags.join(',');
52
52
  }
53
53
  trm_commons_1.Logger.loading(`Publishing "${packageName}" ${packageVersion} to registry "${this.registry.name}"...`, false);
54
- yield this.registry.publish(packageName, packageVersion, artifact, data.readme, tags);
54
+ yield this.registry.publish(packageName, packageVersion, artifact, data.readme, tags, data.changelog);
55
55
  this.manifest = new manifest_1.Manifest(trmManifest);
56
56
  return this;
57
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-core",
3
- "version": "9.9.0",
3
+ "version": "9.10.1",
4
4
  "description": "TRM (Transport Request Manager) Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -62,7 +62,7 @@
62
62
  "semver": "^7.5.4",
63
63
  "semver-sort": "^1.0.0",
64
64
  "spdx-license-ids": "^3.0.13",
65
- "trm-registry-types": "^2.1.0",
65
+ "trm-registry-types": "^2.4.0",
66
66
  "xml-beautify": "^1.2.3",
67
67
  "xml-js": "^1.6.11"
68
68
  },