trm-core 6.2.5 → 6.4.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 (129) hide show
  1. package/changelog.txt +35 -0
  2. package/dist/abapgit/DotAbapGit.d.ts +8 -0
  3. package/dist/abapgit/DotAbapGit.js +80 -0
  4. package/dist/abapgit/index.d.ts +1 -0
  5. package/dist/abapgit/index.js +17 -0
  6. package/dist/actions/checkPackageDependencies/analyze.js +1 -1
  7. package/dist/actions/findDependencies/parseSenvi.js +3 -0
  8. package/dist/actions/findDependencies/setTrmDependencies.js +93 -36
  9. package/dist/actions/install/checkTransports.js +71 -1
  10. package/dist/actions/install/executePostActivities.d.ts +3 -0
  11. package/dist/actions/install/executePostActivities.js +62 -0
  12. package/dist/actions/install/generateInstallTransport.js +1 -0
  13. package/dist/actions/install/importCustTransport.js +1 -0
  14. package/dist/actions/install/importDevcTransport.js +4 -0
  15. package/dist/actions/install/importLangTransport.js +1 -0
  16. package/dist/actions/install/importTadirTransport.js +2 -0
  17. package/dist/actions/install/index.d.ts +9 -4
  18. package/dist/actions/install/index.js +7 -1
  19. package/dist/actions/install/init.js +19 -3
  20. package/dist/actions/install/installDependencies.js +1 -9
  21. package/dist/actions/install/migrate.d.ts +3 -0
  22. package/dist/actions/install/migrate.js +35 -0
  23. package/dist/actions/install/readTadir.js +41 -2
  24. package/dist/actions/install/refreshTmsTxt.d.ts +3 -0
  25. package/dist/actions/install/refreshTmsTxt.js +33 -0
  26. package/dist/actions/install/setInstallDevclass.js +11 -1
  27. package/dist/actions/installDependency/index.d.ts +2 -2
  28. package/dist/actions/installDependency/init.js +4 -0
  29. package/dist/actions/publish/findDependencies.js +20 -15
  30. package/dist/actions/publish/generateCustTransport.js +2 -0
  31. package/dist/actions/publish/generateDevcTransport.js +2 -0
  32. package/dist/actions/publish/generateLangTransport.js +4 -0
  33. package/dist/actions/publish/generateTadirTransport.js +15 -1
  34. package/dist/actions/publish/getSourceCode.d.ts +3 -0
  35. package/dist/actions/publish/getSourceCode.js +36 -0
  36. package/dist/actions/publish/index.d.ts +12 -3
  37. package/dist/actions/publish/index.js +2 -0
  38. package/dist/actions/publish/init.js +10 -2
  39. package/dist/actions/publish/publishToRegistry.js +5 -1
  40. package/dist/actions/publish/setManifestValues.js +69 -1
  41. package/dist/actions/publish/setReadme.js +8 -1
  42. package/dist/client/RESTClient.d.ts +11 -0
  43. package/dist/client/RESTClient.js +141 -39
  44. package/dist/client/RFCClient.d.ts +11 -0
  45. package/dist/client/RFCClient.js +104 -19
  46. package/dist/client/components/LANGU.d.ts +1 -0
  47. package/dist/client/components/LANGU.js +2 -0
  48. package/dist/client/components/SEOCLSNAME.d.ts +1 -0
  49. package/dist/client/components/SEOCLSNAME.js +2 -0
  50. package/dist/client/components/SEODESCR.d.ts +1 -0
  51. package/dist/client/components/SEODESCR.js +2 -0
  52. package/dist/client/components/SYMSGID.d.ts +1 -0
  53. package/dist/client/components/SYMSGID.js +2 -0
  54. package/dist/client/components/SYMSGNO.d.ts +1 -0
  55. package/dist/client/components/SYMSGNO.js +2 -0
  56. package/dist/client/components/SYMSGTY.d.ts +1 -0
  57. package/dist/client/components/SYMSGTY.js +2 -0
  58. package/dist/client/components/SYMSGV.d.ts +1 -0
  59. package/dist/client/components/SYMSGV.js +2 -0
  60. package/dist/client/components/TRSTATUS.d.ts +1 -0
  61. package/dist/client/components/TRSTATUS.js +2 -0
  62. package/dist/client/components/ZTRM_TRKORR.d.ts +1 -0
  63. package/dist/client/components/ZTRM_TRKORR.js +2 -0
  64. package/dist/client/components/index.d.ts +9 -0
  65. package/dist/client/components/index.js +9 -0
  66. package/dist/client/struct/E070.d.ts +2 -1
  67. package/dist/client/struct/SEOCLASSTX.d.ts +6 -0
  68. package/dist/client/struct/SEOCLASSTX.js +2 -0
  69. package/dist/client/struct/SYMSG.d.ts +10 -0
  70. package/dist/client/struct/SYMSG.js +2 -0
  71. package/dist/client/struct/index.d.ts +2 -0
  72. package/dist/client/struct/index.js +2 -0
  73. package/dist/commons/checkCoreTrmDependencies.d.ts +7 -0
  74. package/dist/commons/checkCoreTrmDependencies.js +49 -0
  75. package/dist/commons/getCoreTrmDependencies.d.ts +3 -0
  76. package/dist/commons/getCoreTrmDependencies.js +8 -0
  77. package/dist/commons/getNodePackage.d.ts +1 -0
  78. package/dist/commons/getNodePackage.js +61 -0
  79. package/dist/commons/index.d.ts +3 -0
  80. package/dist/commons/index.js +3 -0
  81. package/dist/logger/CliLogger.d.ts +1 -0
  82. package/dist/logger/CliLogger.js +19 -0
  83. package/dist/logger/ConsoleLogger.d.ts +1 -0
  84. package/dist/logger/ConsoleLogger.js +19 -0
  85. package/dist/logger/DummyLogger.d.ts +1 -0
  86. package/dist/logger/DummyLogger.js +1 -0
  87. package/dist/logger/ILogger.d.ts +1 -0
  88. package/dist/logger/Logger.d.ts +1 -0
  89. package/dist/logger/Logger.js +5 -0
  90. package/dist/manifest/Manifest.d.ts +1 -0
  91. package/dist/manifest/Manifest.js +106 -8
  92. package/dist/manifest/PostActivity.d.ts +11 -0
  93. package/dist/manifest/PostActivity.js +150 -0
  94. package/dist/manifest/TrmManifest.d.ts +1 -0
  95. package/dist/manifest/TrmManifestBase.d.ts +2 -0
  96. package/dist/manifest/TrmManifestNamespace.d.ts +1 -0
  97. package/dist/manifest/TrmManifestPostActivity.d.ts +7 -0
  98. package/dist/manifest/TrmManifestPostActivity.js +2 -0
  99. package/dist/manifest/index.d.ts +2 -0
  100. package/dist/manifest/index.js +2 -0
  101. package/dist/registry/AbstractRegistry.d.ts +19 -0
  102. package/dist/registry/AbstractRegistry.js +6 -0
  103. package/dist/registry/FileSystem.d.ts +23 -0
  104. package/dist/registry/FileSystem.js +161 -0
  105. package/dist/registry/Registry.d.ts +4 -3
  106. package/dist/registry/Registry.js +8 -5
  107. package/dist/registry/RegistryProvider.d.ts +5 -0
  108. package/dist/registry/RegistryProvider.js +35 -0
  109. package/dist/registry/RegistryType.d.ts +2 -1
  110. package/dist/registry/RegistryType.js +1 -0
  111. package/dist/registry/index.d.ts +3 -1
  112. package/dist/registry/index.js +3 -1
  113. package/dist/systemConnector/ISystemConnector.d.ts +11 -0
  114. package/dist/systemConnector/ISystemConnectorBase.d.ts +4 -3
  115. package/dist/systemConnector/RESTSystemConnector.d.ts +11 -0
  116. package/dist/systemConnector/RESTSystemConnector.js +40 -0
  117. package/dist/systemConnector/RFCSystemConnector.d.ts +11 -0
  118. package/dist/systemConnector/RFCSystemConnector.js +40 -0
  119. package/dist/systemConnector/SystemConnector.d.ts +15 -3
  120. package/dist/systemConnector/SystemConnector.js +65 -2
  121. package/dist/systemConnector/SystemConnectorBase.d.ts +8 -5
  122. package/dist/systemConnector/SystemConnectorBase.js +86 -41
  123. package/dist/transport/Transport.d.ts +13 -3
  124. package/dist/transport/Transport.js +134 -39
  125. package/dist/trmPackage/TrmArtifact.d.ts +9 -2
  126. package/dist/trmPackage/TrmArtifact.js +30 -9
  127. package/dist/trmPackage/TrmPackage.d.ts +6 -6
  128. package/dist/trmPackage/TrmPackage.js +1 -2
  129. package/package.json +18 -8
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.PostActivity = void 0;
46
+ const systemConnector_1 = require("../systemConnector");
47
+ const xml = __importStar(require("xml-js"));
48
+ const logger_1 = require("../logger");
49
+ class PostActivity {
50
+ constructor(data) {
51
+ this.data = data;
52
+ this._xml = this.getAbapXml(this.data);
53
+ if (!this._xml) {
54
+ throw new Error(`Can't parse post activity.`);
55
+ }
56
+ }
57
+ execute(silent) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ logger_1.Logger.loading(`Executing post activity: ${this.data.name}`, silent);
60
+ if (!PostActivity.exists(this.data.name)) {
61
+ throw new Error(`Class "${this.data.name}" doesn't exist.`);
62
+ }
63
+ const description = yield this.getDescription();
64
+ logger_1.Logger.loading(`Executing post activity: ${description}`, silent);
65
+ const messages = yield systemConnector_1.SystemConnector.executePostActivity(Buffer.from(this._xml, 'utf8'));
66
+ if (messages && messages.length > 0) {
67
+ for (const message of messages) {
68
+ const parsedMessage = yield systemConnector_1.SystemConnector.getMessage({
69
+ class: message.msgid,
70
+ no: message.msgno,
71
+ v1: message.msgv1,
72
+ v2: message.msgv2,
73
+ v3: message.msgv3,
74
+ v4: message.msgv4,
75
+ });
76
+ logger_1.Logger.msgty(message.msgty, parsedMessage, silent);
77
+ }
78
+ }
79
+ else {
80
+ logger_1.Logger.success(`Executed post activity: ${this.getDescription()}`, silent);
81
+ }
82
+ });
83
+ }
84
+ getDescription() {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ if (this._descriptions === undefined) {
87
+ this._descriptions = yield systemConnector_1.SystemConnector.readClassDescriptions(this.data.name);
88
+ }
89
+ if (!this._descriptions || this._descriptions.length === 0) {
90
+ return this.data.name || `Unknown`;
91
+ }
92
+ else {
93
+ if (this._descriptions.find(o => o.langu === systemConnector_1.SystemConnector.getLogonLanguage(true))) {
94
+ return this._descriptions.find(o => o.langu === systemConnector_1.SystemConnector.getLogonLanguage(true)).descript;
95
+ }
96
+ else {
97
+ return this._descriptions[0].descript;
98
+ }
99
+ }
100
+ });
101
+ }
102
+ getAbapXml(data) {
103
+ var oAbapXml = {
104
+ "_declaration": {
105
+ "_attributes": {
106
+ "version": "1.0",
107
+ "encoding": "utf-8"
108
+ }
109
+ },
110
+ "asx:abap": {
111
+ "_attributes": {
112
+ "xmlns:asx": "http://www.sap.com/abapxml",
113
+ "version": "1.0"
114
+ },
115
+ "asx:values": {
116
+ "DATA": {
117
+ "NAME": {
118
+ "_text": data.name
119
+ }
120
+ }
121
+ }
122
+ }
123
+ };
124
+ if (Array.isArray(data.parameters)) {
125
+ var parameters = data.parameters.map(param => {
126
+ return {
127
+ "NAME": {
128
+ "_text": param.name
129
+ },
130
+ "VALUE": {
131
+ "_text": param.value || ''
132
+ }
133
+ };
134
+ });
135
+ if (parameters.length > 0) {
136
+ oAbapXml['asx:abap']['asx:values']['DATA']['PARAMETERS'] = {
137
+ "item": parameters
138
+ };
139
+ }
140
+ }
141
+ return xml.js2xml(oAbapXml, { compact: true });
142
+ }
143
+ static exists(className) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const classObject = systemConnector_1.SystemConnector.getObject('R3TR', 'CLAS', className.trim().toUpperCase());
146
+ return classObject ? true : false;
147
+ });
148
+ }
149
+ }
150
+ exports.PostActivity = PostActivity;
@@ -8,5 +8,6 @@ export interface TrmManifest extends TrmManifestBase {
8
8
  registry?: string;
9
9
  linkedTransport?: Transport;
10
10
  distFolder?: string;
11
+ srcFolder?: string;
11
12
  namespace?: TrmManifestNamespace;
12
13
  }
@@ -1,5 +1,6 @@
1
1
  import { TrmManifestAuthor } from "./TrmManifestAuthor";
2
2
  import { TrmManifestDependency } from "./TrmManifestDependency";
3
+ import { TrmManifestPostActivity } from "./TrmManifestPostActivity";
3
4
  export interface TrmManifestBase {
4
5
  backwardsCompatible?: boolean;
5
6
  description?: string;
@@ -10,4 +11,5 @@ export interface TrmManifestBase {
10
11
  keywords?: string | string[];
11
12
  dependencies?: TrmManifestDependency[];
12
13
  sapEntries?: any;
14
+ postActivities?: TrmManifestPostActivity[];
13
15
  }
@@ -1,4 +1,5 @@
1
1
  export type TrmManifestNamespace = {
2
+ ns?: string;
2
3
  replicense: string;
3
4
  texts: {
4
5
  language: string;
@@ -0,0 +1,7 @@
1
+ export type TrmManifestPostActivity = {
2
+ name: string;
3
+ parameters?: {
4
+ name: string;
5
+ value: string;
6
+ }[];
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,3 +4,5 @@ export * from "./TrmManifest";
4
4
  export * from "./TrmManifestAuthor";
5
5
  export * from "./TrmManifestDependency";
6
6
  export * from "./TrmManifestNamespace";
7
+ export * from "./TrmManifestPostActivity";
8
+ export * from "./PostActivity";
@@ -20,3 +20,5 @@ __exportStar(require("./TrmManifest"), exports);
20
20
  __exportStar(require("./TrmManifestAuthor"), exports);
21
21
  __exportStar(require("./TrmManifestDependency"), exports);
22
22
  __exportStar(require("./TrmManifestNamespace"), exports);
23
+ __exportStar(require("./TrmManifestPostActivity"), exports);
24
+ __exportStar(require("./PostActivity"), exports);
@@ -0,0 +1,19 @@
1
+ import { Ping, Release, View, WhoAmI } from "trm-registry-types";
2
+ import { RegistryType } from "./RegistryType";
3
+ import { TrmArtifact } from "../trmPackage";
4
+ export declare abstract class AbstractRegistry {
5
+ endpoint: string;
6
+ name: string;
7
+ abstract compare: (registry: AbstractRegistry) => boolean;
8
+ getRegistryType: () => RegistryType;
9
+ authenticate: (defaultData: any) => Promise<AbstractRegistry>;
10
+ getAuthData: () => any;
11
+ ping: () => Promise<Ping>;
12
+ whoAmI: () => Promise<WhoAmI>;
13
+ packageExists: (name: string, version?: string) => Promise<boolean>;
14
+ view: (name: string, version: string) => Promise<View>;
15
+ getArtifact: (name: string, version: string) => Promise<TrmArtifact>;
16
+ publishArtifact: (packageName: string, version: string, artifact: TrmArtifact, readme?: string) => Promise<void>;
17
+ unpublish: (packageName: string, version: string) => Promise<void>;
18
+ getReleases: (packageName: string, versionRange: string) => Promise<Release[]>;
19
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractRegistry = void 0;
4
+ class AbstractRegistry {
5
+ }
6
+ exports.AbstractRegistry = AbstractRegistry;
@@ -0,0 +1,23 @@
1
+ import { Ping, Release, View, WhoAmI } from "trm-registry-types";
2
+ import { AbstractRegistry } from "./AbstractRegistry";
3
+ import { RegistryType } from "./RegistryType";
4
+ import { TrmArtifact } from "../trmPackage";
5
+ export declare const LOCAL_RESERVED_KEYWORD = "local";
6
+ export declare class FileSystem implements AbstractRegistry {
7
+ private _filePath?;
8
+ endpoint: string;
9
+ name: string;
10
+ constructor(_filePath?: string);
11
+ compare(registry: AbstractRegistry): boolean;
12
+ getRegistryType(): RegistryType;
13
+ authenticate(defaultData: any): Promise<AbstractRegistry>;
14
+ getAuthData(): any;
15
+ ping(): Promise<Ping>;
16
+ whoAmI(): Promise<WhoAmI>;
17
+ packageExists(name: string, version?: string): Promise<boolean>;
18
+ view(name: string, version?: string): Promise<View>;
19
+ getArtifact(name: string, version?: string): Promise<TrmArtifact>;
20
+ publishArtifact(packageName: string, version: string, artifact: TrmArtifact, readme?: string): Promise<void>;
21
+ unpublish(packageName: string, version: string): Promise<void>;
22
+ getReleases(packageName: string, versionRange: string): Promise<Release[]>;
23
+ }
@@ -0,0 +1,161 @@
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.FileSystem = exports.LOCAL_RESERVED_KEYWORD = void 0;
13
+ const trm_registry_types_1 = require("trm-registry-types");
14
+ const RegistryType_1 = require("./RegistryType");
15
+ const trmPackage_1 = require("../trmPackage");
16
+ const os_1 = require("os");
17
+ const fs_1 = require("fs");
18
+ const path_1 = require("path");
19
+ const promises_1 = require("fs/promises");
20
+ exports.LOCAL_RESERVED_KEYWORD = 'local';
21
+ class FileSystem {
22
+ constructor(_filePath) {
23
+ this._filePath = _filePath;
24
+ this.name = exports.LOCAL_RESERVED_KEYWORD;
25
+ if (this._filePath) {
26
+ this.endpoint = (0, path_1.parse)(this._filePath).dir;
27
+ this.name = (0, path_1.parse)(this._filePath).base;
28
+ if (this.name === this._filePath) {
29
+ throw new Error(`"${this._filePath}" is not a valid file path.`);
30
+ }
31
+ if (!this.endpoint) {
32
+ throw new Error(`Couldn't determine file directory.`);
33
+ }
34
+ if (!this.name) {
35
+ throw new Error(`Couldn't determine file name.`);
36
+ }
37
+ if ((0, fs_1.existsSync)(this._filePath) && (0, fs_1.lstatSync)(this._filePath).isDirectory()) {
38
+ throw new Error(`"${this._filePath}" is a directory. File name is missing.`);
39
+ }
40
+ if ((0, fs_1.existsSync)(this.endpoint)) {
41
+ if (!(0, fs_1.lstatSync)(this.endpoint).isDirectory()) {
42
+ throw new Error(`"${this.endpoint}" is not a valid directory.`);
43
+ }
44
+ else {
45
+ try {
46
+ (0, fs_1.accessSync)(this.endpoint, fs_1.constants.W_OK);
47
+ }
48
+ catch (e) {
49
+ throw new Error(`Cannot write to directory "${this.endpoint}".`);
50
+ }
51
+ }
52
+ }
53
+ else {
54
+ (0, fs_1.mkdirSync)(this.endpoint, { recursive: true });
55
+ }
56
+ }
57
+ }
58
+ compare(registry) {
59
+ if (registry instanceof FileSystem) {
60
+ return this._filePath === registry._filePath;
61
+ }
62
+ else {
63
+ return false;
64
+ }
65
+ }
66
+ getRegistryType() {
67
+ return RegistryType_1.RegistryType.LOCAL;
68
+ }
69
+ authenticate(defaultData) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return this;
72
+ });
73
+ }
74
+ getAuthData() {
75
+ return null;
76
+ }
77
+ ping() {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ if (this._filePath) {
80
+ return {
81
+ authenticationType: trm_registry_types_1.AuthenticationType.NO_AUTH,
82
+ wallMessage: {
83
+ text: `File system: "${this.name}", "${this.endpoint}"`,
84
+ type: trm_registry_types_1.MessageType.INFO
85
+ }
86
+ };
87
+ }
88
+ return null;
89
+ });
90
+ }
91
+ whoAmI() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ if (this._filePath) {
94
+ return {
95
+ username: (0, os_1.userInfo)().username
96
+ };
97
+ }
98
+ return null;
99
+ });
100
+ }
101
+ packageExists(name, version) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ if (this._filePath) {
104
+ return false;
105
+ }
106
+ return null;
107
+ });
108
+ }
109
+ view(name_1) {
110
+ return __awaiter(this, arguments, void 0, function* (name, version = 'latest') {
111
+ if (this._filePath) {
112
+ const userAuthorizations = {
113
+ canCreateReleases: true
114
+ };
115
+ var error = new Error(`File system can't view packages!`);
116
+ error.response = {
117
+ userAuthorizations
118
+ };
119
+ throw error;
120
+ }
121
+ return null;
122
+ });
123
+ }
124
+ getArtifact(name_1) {
125
+ return __awaiter(this, arguments, void 0, function* (name, version = 'latest') {
126
+ if (this._filePath) {
127
+ try {
128
+ return new trmPackage_1.TrmArtifact((0, fs_1.readFileSync)(this._filePath));
129
+ }
130
+ catch (e) {
131
+ throw new Error(`File system couldn't read package`);
132
+ }
133
+ }
134
+ return null;
135
+ });
136
+ }
137
+ publishArtifact(packageName, version, artifact, readme) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ if (this._filePath) {
140
+ return (0, promises_1.writeFile)(this._filePath, artifact.binary, {
141
+ flag: 'w'
142
+ });
143
+ }
144
+ return null;
145
+ });
146
+ }
147
+ unpublish(packageName, version) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ throw new Error(`File system can't delete packages!`);
150
+ });
151
+ }
152
+ getReleases(packageName, versionRange) {
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ if (this._filePath) {
155
+ return [];
156
+ }
157
+ return null;
158
+ });
159
+ }
160
+ }
161
+ exports.FileSystem = FileSystem;
@@ -1,8 +1,9 @@
1
1
  import { RegistryType } from "./RegistryType";
2
2
  import { Ping, Release, View, WhoAmI } from "trm-registry-types";
3
3
  import { TrmArtifact } from "../trmPackage/TrmArtifact";
4
+ import { AbstractRegistry } from "./AbstractRegistry";
4
5
  export declare const PUBLIC_RESERVED_KEYWORD = "public";
5
- export declare class Registry {
6
+ export declare class Registry implements AbstractRegistry {
6
7
  endpoint: string;
7
8
  name: string;
8
9
  private _registryType;
@@ -11,8 +12,9 @@ export declare class Registry {
11
12
  private _ping;
12
13
  private _whoami;
13
14
  constructor(endpoint: string, name?: string);
15
+ compare(registry: AbstractRegistry): boolean;
14
16
  getRegistryType(): RegistryType;
15
- authenticate(defaultData?: any): Promise<Registry>;
17
+ authenticate(defaultData?: any): Promise<AbstractRegistry>;
16
18
  private _basicAuth;
17
19
  private _tokenAuth;
18
20
  private _oauth2;
@@ -25,5 +27,4 @@ export declare class Registry {
25
27
  publishArtifact(packageName: string, version: string, artifact: TrmArtifact, readme?: string): Promise<void>;
26
28
  unpublish(packageName: string, version: string): Promise<void>;
27
29
  getReleases(packageName: string, versionRange: string): Promise<Release[]>;
28
- static compare(o1: Registry, o2: Registry): boolean;
29
30
  }
@@ -96,6 +96,14 @@ class Registry {
96
96
  baseURL: this.endpoint
97
97
  }, AXIOS_CTX);
98
98
  }
99
+ compare(registry) {
100
+ if (registry instanceof Registry) {
101
+ return this.endpoint === registry.endpoint;
102
+ }
103
+ else {
104
+ return false;
105
+ }
106
+ }
99
107
  getRegistryType() {
100
108
  return this._registryType;
101
109
  }
@@ -390,10 +398,5 @@ class Registry {
390
398
  return response;
391
399
  });
392
400
  }
393
- static compare(o1, o2) {
394
- const s1 = o1.endpoint;
395
- const s2 = o2.endpoint;
396
- return s1 === s2;
397
- }
398
401
  }
399
402
  exports.Registry = Registry;
@@ -0,0 +1,5 @@
1
+ import { AbstractRegistry } from "./AbstractRegistry";
2
+ export declare namespace RegistryProvider {
3
+ var registry: AbstractRegistry[];
4
+ function getRegistry(endpoint?: string): AbstractRegistry;
5
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegistryProvider = void 0;
4
+ const FileSystem_1 = require("./FileSystem");
5
+ const Registry_1 = require("./Registry");
6
+ const RegistryType_1 = require("./RegistryType");
7
+ var RegistryProvider;
8
+ (function (RegistryProvider) {
9
+ RegistryProvider.registry = [];
10
+ function getRegistry(endpoint) {
11
+ var foundRegistry;
12
+ if (endpoint) {
13
+ endpoint = endpoint.toLowerCase().trim();
14
+ }
15
+ if (!endpoint || endpoint === Registry_1.PUBLIC_RESERVED_KEYWORD) {
16
+ foundRegistry = RegistryProvider.registry.find(o => o.getRegistryType() === RegistryType_1.RegistryType.PUBLIC);
17
+ if (!foundRegistry) {
18
+ foundRegistry = new Registry_1.Registry(Registry_1.PUBLIC_RESERVED_KEYWORD);
19
+ RegistryProvider.registry.push(foundRegistry);
20
+ }
21
+ }
22
+ else if (endpoint === FileSystem_1.LOCAL_RESERVED_KEYWORD) {
23
+ foundRegistry = new FileSystem_1.FileSystem();
24
+ }
25
+ else {
26
+ foundRegistry = RegistryProvider.registry.find(o => o.endpoint === endpoint);
27
+ if (!foundRegistry) {
28
+ foundRegistry = new Registry_1.Registry(endpoint, endpoint);
29
+ RegistryProvider.registry.push(foundRegistry);
30
+ }
31
+ }
32
+ return foundRegistry;
33
+ }
34
+ RegistryProvider.getRegistry = getRegistry;
35
+ })(RegistryProvider || (exports.RegistryProvider = RegistryProvider = {}));
@@ -1,4 +1,5 @@
1
1
  export declare enum RegistryType {
2
2
  PUBLIC = 1,
3
- PRIVATE = 2
3
+ PRIVATE = 2,
4
+ LOCAL = 3
4
5
  }
@@ -5,4 +5,5 @@ var RegistryType;
5
5
  (function (RegistryType) {
6
6
  RegistryType[RegistryType["PUBLIC"] = 1] = "PUBLIC";
7
7
  RegistryType[RegistryType["PRIVATE"] = 2] = "PRIVATE";
8
+ RegistryType[RegistryType["LOCAL"] = 3] = "LOCAL";
8
9
  })(RegistryType || (exports.RegistryType = RegistryType = {}));
@@ -1,3 +1,5 @@
1
1
  export * from "./Registry";
2
2
  export * from "./RegistryType";
3
- export * from "./RegistryType";
3
+ export * from "./AbstractRegistry";
4
+ export * from "./FileSystem";
5
+ export * from "./RegistryProvider";
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Registry"), exports);
18
18
  __exportStar(require("./RegistryType"), exports);
19
- __exportStar(require("./RegistryType"), exports);
19
+ __exportStar(require("./AbstractRegistry"), exports);
20
+ __exportStar(require("./FileSystem"), exports);
21
+ __exportStar(require("./RegistryProvider"), exports);
@@ -21,11 +21,13 @@ export interface ISystemConnector extends ISystemConnectorBase {
21
21
  createTocTransport: (text: components.AS4TEXT, target: components.TR_TARGET) => Promise<components.TRKORR>;
22
22
  createWbTransport: (text: components.AS4TEXT, target?: components.TR_TARGET) => Promise<components.TRKORR>;
23
23
  setTransportDoc: (trkorr: components.TRKORR, doc: struct.TLINE[]) => Promise<void>;
24
+ removeComments: (trkorr: components.TRKORR, object: components.TROBJTYPE) => Promise<void>;
24
25
  addToTransportRequest: (trkorr: components.TRKORR, content: struct.E071[], lock: boolean) => Promise<void>;
25
26
  repositoryEnvironment: (objectType: components.SEU_OBJ, objectName: components.SOBJ_NAME) => Promise<struct.SENVI[]>;
26
27
  deleteTrkorr: (trkorr: components.TRKORR) => Promise<void>;
27
28
  releaseTrkorr: (trkorr: components.TRKORR, lock: boolean, timeout?: number) => Promise<void>;
28
29
  addSkipTrkorr: (trkorr: components.TRKORR) => Promise<void>;
30
+ removeSkipTrkorr: (trkorr: components.TRKORR) => Promise<void>;
29
31
  addSrcTrkorr: (trkorr: components.TRKORR) => Promise<void>;
30
32
  readTmsQueue: (target: components.TMSSYSNAM) => Promise<struct.STMSIQREQ[]>;
31
33
  createPackage: (scompkdtln: struct.SCOMPKDTLN) => Promise<void>;
@@ -44,4 +46,13 @@ export interface ISystemConnector extends ISystemConnectorBase {
44
46
  getExistingObjectsBulk?: (objects: struct.TADIR[]) => Promise<struct.TADIR[]>;
45
47
  addNamespace: (namespace: components.NAMESPACE, replicense: components.TRNLICENSE, texts: struct.TRNSPACETT[]) => Promise<void>;
46
48
  getMessage: (data: SapMessage) => Promise<string>;
49
+ migrateTransport: (trkorr: components.TRKORR) => Promise<components.ZTRM_TRKORR>;
50
+ deleteTmsTransport: (trkorr: components.TRKORR, system: components.TMSSYSNAM) => Promise<void>;
51
+ refreshTransportTmsTxt: (trkorr: components.TRKORR) => Promise<void>;
52
+ getDotAbapgit: (devclass: components.DEVCLASS) => Promise<Buffer>;
53
+ getAbapgitSource: (devclass: components.DEVCLASS) => Promise<{
54
+ zip: Buffer;
55
+ objects: struct.TADIR[];
56
+ }>;
57
+ executePostActivity: (data: Buffer) => Promise<struct.SYMSG[]>;
47
58
  }
@@ -1,4 +1,4 @@
1
- import { Registry } from "../registry";
1
+ import { AbstractRegistry } from "../registry";
2
2
  import * as components from "../client/components";
3
3
  import * as struct from "../client/struct";
4
4
  import { Transport } from "../transport";
@@ -10,12 +10,12 @@ export interface ISystemConnectorBase {
10
10
  getSourceTrkorr: () => Promise<components.TRKORR[]>;
11
11
  getIgnoredTrkorr: () => Promise<components.TRKORR[]>;
12
12
  getObject: (pgmid: components.PGMID, object: components.TROBJTYPE, objName: components.SOBJ_NAME) => Promise<struct.TADIR>;
13
- getInstalledPackages: (includeSoruces: boolean, refresh?: boolean) => Promise<TrmPackage[]>;
13
+ getInstalledPackages: (includeSoruces: boolean, refresh?: boolean, includeLocals?: boolean) => Promise<TrmPackage[]>;
14
14
  getDevclass: (devclass: components.DEVCLASS) => Promise<struct.TDEVC>;
15
15
  getTransportTargets: () => Promise<struct.TMSCSYS[]>;
16
16
  getSubpackages: (devclass: components.DEVCLASS) => Promise<struct.TDEVC[]>;
17
17
  getDevclassObjects: (devclass: components.DEVCLASS, includeSubpackages: boolean) => Promise<struct.TADIR[]>;
18
- getInstallPackages: (packageName: string, registry: Registry) => Promise<InstallPackage[]>;
18
+ getInstallPackages: (packageName: string, registry: AbstractRegistry) => Promise<InstallPackage[]>;
19
19
  setPackageSuperpackage: (devclass: components.DEVCLASS, superpackage: components.DEVCLASS) => Promise<void>;
20
20
  clearPackageSuperpackage: (devclass: components.DEVCLASS) => Promise<void>;
21
21
  setPackageTransportLayer: (devclass: components.DEVCLASS, devlayer: components.DEVLAYER) => Promise<void>;
@@ -32,4 +32,5 @@ export interface ISystemConnectorBase {
32
32
  isTransportLayerExist: (devlayer: components.DEVLAYER) => Promise<boolean>;
33
33
  getTrmServerPackage: () => Promise<TrmPackage>;
34
34
  getTrmRestPackage: () => Promise<TrmPackage>;
35
+ readClassDescriptions: (clsname: components.SEOCLSNAME) => Promise<struct.SEOCLASSTX[]>;
35
36
  }
@@ -39,11 +39,13 @@ export declare class RESTSystemConnector extends SystemConnectorBase implements
39
39
  createTocTransport(text: components.AS4TEXT, target: components.TR_TARGET): Promise<components.TRKORR>;
40
40
  createWbTransport(text: components.AS4TEXT, target?: components.TR_TARGET): Promise<components.TRKORR>;
41
41
  setTransportDoc(trkorr: components.TRKORR, doc: struct.TLINE[]): Promise<void>;
42
+ removeComments(trkorr: components.TRKORR, object: components.TROBJTYPE): Promise<void>;
42
43
  addToTransportRequest(trkorr: components.TRKORR, content: struct.E071[], lock: boolean): Promise<void>;
43
44
  repositoryEnvironment(objectType: components.SEU_OBJ, objectName: components.SOBJ_NAME): Promise<struct.SENVI[]>;
44
45
  deleteTrkorr(trkorr: components.TRKORR): Promise<void>;
45
46
  releaseTrkorr(trkorr: components.TRKORR, lock: boolean, timeout?: number): Promise<void>;
46
47
  addSkipTrkorr(trkorr: components.TRKORR): Promise<void>;
48
+ removeSkipTrkorr(trkorr: components.TRKORR): Promise<void>;
47
49
  addSrcTrkorr(trkorr: components.TRKORR): Promise<void>;
48
50
  readTmsQueue(target: components.TMSSYSNAM): Promise<struct.STMSIQREQ[]>;
49
51
  createPackage(scompkdtln: struct.SCOMPKDTLN): Promise<void>;
@@ -62,4 +64,13 @@ export declare class RESTSystemConnector extends SystemConnectorBase implements
62
64
  getExistingObjectsBulk(objects: struct.TADIR[]): Promise<TADIR[]>;
63
65
  addNamespace(namespace: components.NAMESPACE, replicense: components.TRNLICENSE, texts: struct.TRNSPACETT[]): Promise<void>;
64
66
  getMessage(data: SapMessage): Promise<string>;
67
+ migrateTransport(trkorr: components.TRKORR): Promise<components.ZTRM_TRKORR>;
68
+ deleteTmsTransport(trkorr: components.TRKORR, system: components.TMSSYSNAM): Promise<void>;
69
+ refreshTransportTmsTxt(trkorr: components.TRKORR): Promise<void>;
70
+ getDotAbapgit(devclass: components.DEVCLASS): Promise<Buffer>;
71
+ getAbapgitSource(devclass: components.DEVCLASS): Promise<{
72
+ zip: Buffer;
73
+ objects: struct.TADIR[];
74
+ }>;
75
+ executePostActivity(data: Buffer): Promise<struct.SYMSG[]>;
65
76
  }