trm-core 7.5.6 → 8.0.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 +15 -0
- package/dist/actions/checkPackageDependencies/analyze.js +5 -51
- package/dist/actions/checkPackageDependencies/index.d.ts +2 -5
- package/dist/actions/checkPackageDependencies/init.js +5 -7
- package/dist/actions/checkSapEntries/analyze.js +2 -2
- package/dist/actions/checkSapEntries/index.d.ts +2 -2
- package/dist/actions/checkSapEntries/init.js +1 -4
- package/dist/actions/findDependencies/index.d.ts +0 -2
- package/dist/actions/findDependencies/setTrmDependencies.js +11 -55
- package/dist/actions/install/addNamespace.js +14 -9
- package/dist/actions/install/checkAlreadyInstalled.js +2 -2
- package/dist/actions/install/checkDependencies.js +2 -16
- package/dist/actions/install/checkSapEntries.js +1 -1
- package/dist/actions/install/checkTransports.js +2 -2
- package/dist/actions/install/executePostActivities.js +3 -3
- package/dist/actions/install/generateInstallTransport.js +40 -5
- package/dist/actions/install/index.d.ts +6 -10
- package/dist/actions/install/index.js +2 -4
- package/dist/actions/install/init.js +37 -45
- package/dist/actions/install/installDependencies.js +0 -1
- package/dist/actions/install/setPackageIntegrity.js +1 -1
- package/dist/actions/install/setTrmServerUpgradeService.js +1 -1
- package/dist/actions/installDependency/findInstallRelease.js +18 -18
- package/dist/actions/installDependency/index.d.ts +0 -1
- package/dist/actions/installDependency/init.js +0 -7
- package/dist/actions/installDependency/installRelease.js +0 -1
- package/dist/actions/publish/findDependencies.js +0 -12
- package/dist/actions/publish/generateCustTransport.js +0 -3
- package/dist/actions/publish/generateDevcTransport.js +0 -4
- package/dist/actions/publish/generateLangTransport.js +0 -3
- package/dist/actions/publish/getSourceCode.js +1 -1
- package/dist/actions/publish/index.d.ts +1 -1
- package/dist/actions/publish/init.js +71 -95
- package/dist/actions/publish/setManifestValues.js +4 -13
- package/dist/commons/getAxiosInstance.d.ts +1 -1
- package/dist/manifest/Manifest.d.ts +2 -0
- package/dist/manifest/Manifest.js +47 -17
- package/dist/manifest/TrmManifestDependency.d.ts +0 -1
- package/dist/registry/AbstractRegistry.d.ts +7 -7
- package/dist/registry/FileSystem.d.ts +7 -6
- package/dist/registry/FileSystem.js +35 -34
- package/dist/registry/RegistryProvider.js +4 -4
- package/dist/registry/{Registry.d.ts → RegistryV2.d.ts} +11 -10
- package/dist/registry/{Registry.js → RegistryV2.js} +146 -74
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/systemConnector/ISystemConnectorBase.d.ts +1 -1
- package/dist/systemConnector/SystemConnector.d.ts +1 -1
- package/dist/systemConnector/SystemConnector.js +3 -3
- package/dist/systemConnector/SystemConnectorBase.d.ts +1 -1
- package/dist/systemConnector/SystemConnectorBase.js +33 -11
- package/dist/transport/Transport.d.ts +4 -1
- package/dist/transport/Transport.js +54 -31
- package/dist/trmPackage/TrmArtifact.js +3 -5
- package/dist/trmPackage/TrmPackage.d.ts +0 -16
- package/dist/trmPackage/TrmPackage.js +10 -133
- package/dist/validators/validatePackageVisibility.d.ts +1 -1
- package/dist/validators/validatePackageVisibility.js +2 -16
- package/package.json +4 -3
- package/dist/actions/install/checkIntegrity.d.ts +0 -3
- package/dist/actions/install/checkIntegrity.js +0 -42
|
@@ -91,6 +91,32 @@ class Manifest {
|
|
|
91
91
|
setRegistryEndpoint(endpoint) {
|
|
92
92
|
this._manifest.registry = endpoint;
|
|
93
93
|
}
|
|
94
|
+
getJSON(ignoredKeys = []) {
|
|
95
|
+
const KEYS_ORDER = [
|
|
96
|
+
"name",
|
|
97
|
+
"version",
|
|
98
|
+
"registry",
|
|
99
|
+
"private",
|
|
100
|
+
"description",
|
|
101
|
+
"backwardsCompatible",
|
|
102
|
+
"distFolder",
|
|
103
|
+
"srcFolder",
|
|
104
|
+
"namespace",
|
|
105
|
+
"website",
|
|
106
|
+
"git",
|
|
107
|
+
"license",
|
|
108
|
+
"authors",
|
|
109
|
+
"keywords",
|
|
110
|
+
"dependencies",
|
|
111
|
+
"sapEntries",
|
|
112
|
+
"postActivities",
|
|
113
|
+
];
|
|
114
|
+
var obj = this.get(false);
|
|
115
|
+
ignoredKeys.forEach(k => {
|
|
116
|
+
delete obj[k];
|
|
117
|
+
});
|
|
118
|
+
return this.jsonStringifyWithKeyOrder(obj, KEYS_ORDER, 2);
|
|
119
|
+
}
|
|
94
120
|
getAbapXml() {
|
|
95
121
|
const manifest = this.get();
|
|
96
122
|
var oAbapXml = {
|
|
@@ -246,11 +272,6 @@ class Manifest {
|
|
|
246
272
|
"_text": o.registry
|
|
247
273
|
};
|
|
248
274
|
}
|
|
249
|
-
if (o.integrity) {
|
|
250
|
-
obj['INTEGRITY'] = {
|
|
251
|
-
"_text": o.integrity
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
275
|
if (Object.keys(obj).length > 0) {
|
|
255
276
|
dependencies.push(obj);
|
|
256
277
|
}
|
|
@@ -508,10 +529,6 @@ class Manifest {
|
|
|
508
529
|
dependency.name = originalDependency.name.trim().toLowerCase().replace(/\s/g, '');
|
|
509
530
|
if (semver.validRange(originalDependency.version)) {
|
|
510
531
|
dependency.version = originalDependency.version;
|
|
511
|
-
dependency.integrity = originalDependency.integrity;
|
|
512
|
-
if (!dependency.integrity) {
|
|
513
|
-
throw new Error(`Dependency ${dependency.name} is missing its integrity.`);
|
|
514
|
-
}
|
|
515
532
|
if (originalDependency.registry) {
|
|
516
533
|
dependency.registry = originalDependency.registry;
|
|
517
534
|
}
|
|
@@ -605,7 +622,7 @@ class Manifest {
|
|
|
605
622
|
return manifestClone;
|
|
606
623
|
}
|
|
607
624
|
static fromAbapXml(sXml) {
|
|
608
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
625
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
609
626
|
var manifest;
|
|
610
627
|
sXml = sXml.replace(/&/g, "&").replace(/-/g, "-");
|
|
611
628
|
const oAbapXml = xml.xml2js(sXml, { compact: true });
|
|
@@ -708,21 +725,19 @@ class Manifest {
|
|
|
708
725
|
if (oAbapManifest.dependencies && oAbapManifest.dependencies.item) {
|
|
709
726
|
if (Array.isArray(oAbapManifest.dependencies.item)) {
|
|
710
727
|
manifest.dependencies = oAbapManifest.dependencies.item.map(o => {
|
|
711
|
-
var _a, _b, _c
|
|
728
|
+
var _a, _b, _c;
|
|
712
729
|
return {
|
|
713
730
|
name: (_a = o.name) === null || _a === void 0 ? void 0 : _a.text,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
registry: (_d = o.registry) === null || _d === void 0 ? void 0 : _d.text
|
|
731
|
+
version: (_b = o.version) === null || _b === void 0 ? void 0 : _b.text,
|
|
732
|
+
registry: (_c = o.registry) === null || _c === void 0 ? void 0 : _c.text
|
|
717
733
|
};
|
|
718
734
|
});
|
|
719
735
|
}
|
|
720
736
|
else {
|
|
721
737
|
manifest.dependencies = [{
|
|
722
738
|
name: (_f = oAbapManifest.dependencies.item.name) === null || _f === void 0 ? void 0 : _f.text,
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
registry: (_j = oAbapManifest.dependencies.item.registry) === null || _j === void 0 ? void 0 : _j.text
|
|
739
|
+
version: (_g = oAbapManifest.dependencies.item.version) === null || _g === void 0 ? void 0 : _g.text,
|
|
740
|
+
registry: (_h = oAbapManifest.dependencies.item.registry) === null || _h === void 0 ? void 0 : _h.text
|
|
726
741
|
}];
|
|
727
742
|
}
|
|
728
743
|
}
|
|
@@ -808,5 +823,20 @@ class Manifest {
|
|
|
808
823
|
return [];
|
|
809
824
|
}
|
|
810
825
|
}
|
|
826
|
+
jsonStringifyWithKeyOrder(obj, order, space = 2) {
|
|
827
|
+
const out = {};
|
|
828
|
+
const seen = new Set(order);
|
|
829
|
+
for (const key of order) {
|
|
830
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key] !== undefined) {
|
|
831
|
+
out[key] = obj[key];
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
for (const key of Object.keys(obj)) {
|
|
835
|
+
if (!seen.has(key) && obj[key] !== undefined) {
|
|
836
|
+
out[key] = obj[key];
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return JSON.stringify(out, null, space);
|
|
840
|
+
}
|
|
811
841
|
}
|
|
812
842
|
exports.Manifest = Manifest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Package, Ping, WhoAmI } from "trm-registry-types";
|
|
2
2
|
import { RegistryType } from "./RegistryType";
|
|
3
3
|
import { TrmArtifact } from "../trmPackage";
|
|
4
4
|
export declare abstract class AbstractRegistry {
|
|
@@ -10,10 +10,10 @@ export declare abstract class AbstractRegistry {
|
|
|
10
10
|
getAuthData: () => any;
|
|
11
11
|
ping: () => Promise<Ping>;
|
|
12
12
|
whoAmI: () => Promise<WhoAmI>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
unpublish: (
|
|
18
|
-
|
|
13
|
+
getPackage: (fullName: string, version: string) => Promise<Package>;
|
|
14
|
+
downloadArtifact: (fullName: string, version: string) => Promise<TrmArtifact>;
|
|
15
|
+
validatePublish: (fullName: string, version: string) => Promise<void>;
|
|
16
|
+
publish: (fullName: string, version: string, artifact: TrmArtifact, readme?: string) => Promise<Package>;
|
|
17
|
+
unpublish: (fullName: string, version: string) => Promise<void>;
|
|
18
|
+
deprecate: (fullName: string, version: string, reason: string) => Promise<void>;
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Package, Ping, WhoAmI } from "trm-registry-types";
|
|
2
2
|
import { AbstractRegistry } from "./AbstractRegistry";
|
|
3
3
|
import { RegistryType } from "./RegistryType";
|
|
4
4
|
import { TrmArtifact } from "../trmPackage";
|
|
@@ -15,10 +15,11 @@ export declare class FileSystem implements AbstractRegistry {
|
|
|
15
15
|
getAuthData(): any;
|
|
16
16
|
ping(): Promise<Ping>;
|
|
17
17
|
whoAmI(): Promise<WhoAmI>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
getPackage(fullName: string, version: string): Promise<Package>;
|
|
19
|
+
downloadArtifact(fullName: string, version: string): Promise<TrmArtifact>;
|
|
20
20
|
getArtifact(name: string, version?: string): Promise<TrmArtifact>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
validatePublish(fullName: string, version: string): Promise<void>;
|
|
22
|
+
publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string): Promise<Package>;
|
|
23
|
+
unpublish(fullName: string, version: string): Promise<void>;
|
|
24
|
+
deprecate(fullName: string, version: string, reason: string): Promise<void>;
|
|
24
25
|
}
|
|
@@ -78,47 +78,46 @@ class FileSystem {
|
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
if (this._filePath) {
|
|
80
80
|
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
authentication_type: trm_registry_types_1.AuthenticationType.NO_AUTH,
|
|
82
|
+
messages: [{
|
|
83
|
+
text: `File system: "${this.name}", "${this.endpoint}"`,
|
|
84
|
+
type: trm_registry_types_1.MessageType.INFO
|
|
85
|
+
}]
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
throw new Error(`Missing file path!`);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
whoAmI() {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
if (this._filePath) {
|
|
94
94
|
return {
|
|
95
|
-
|
|
95
|
+
user: (0, os_1.userInfo)().username
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
throw new Error(`Missing file path!`);
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
getPackage(fullName, version) {
|
|
102
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
103
|
if (this._filePath) {
|
|
104
|
-
return
|
|
104
|
+
return {
|
|
105
|
+
name: fullName,
|
|
106
|
+
latest: version,
|
|
107
|
+
versions: [],
|
|
108
|
+
yanked_versions: [],
|
|
109
|
+
deprecated: false,
|
|
110
|
+
manifest: null,
|
|
111
|
+
checksum: null,
|
|
112
|
+
download_link: this._filePath
|
|
113
|
+
};
|
|
105
114
|
}
|
|
106
|
-
|
|
115
|
+
throw new Error(`File system can't view packages!`);
|
|
107
116
|
});
|
|
108
117
|
}
|
|
109
|
-
|
|
110
|
-
return __awaiter(this,
|
|
111
|
-
|
|
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;
|
|
118
|
+
downloadArtifact(fullName, version) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return new trmPackage_1.TrmArtifact((0, fs_1.readFileSync)(this._filePath));
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
getArtifact(name_1) {
|
|
@@ -135,30 +134,32 @@ class FileSystem {
|
|
|
135
134
|
throw new Error(`File system couldn't read package`);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
|
|
137
|
+
throw new Error(`Missing file path!`);
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
|
-
|
|
140
|
+
validatePublish(fullName, version) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
publish(fullName, version, artifact, readme) {
|
|
142
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
146
|
if (this._filePath) {
|
|
144
|
-
|
|
147
|
+
yield (0, promises_1.writeFile)(this._filePath, artifact.binary, {
|
|
145
148
|
flag: 'w'
|
|
146
149
|
});
|
|
150
|
+
return this.getPackage(fullName, version);
|
|
147
151
|
}
|
|
148
|
-
|
|
152
|
+
throw new Error(`Missing file path!`);
|
|
149
153
|
});
|
|
150
154
|
}
|
|
151
|
-
unpublish(
|
|
155
|
+
unpublish(fullName, version) {
|
|
152
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
157
|
throw new Error(`File system can't delete packages!`);
|
|
154
158
|
});
|
|
155
159
|
}
|
|
156
|
-
|
|
160
|
+
deprecate(fullName, version, reason) {
|
|
157
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
|
|
159
|
-
return [];
|
|
160
|
-
}
|
|
161
|
-
return null;
|
|
162
|
+
throw new Error(`File system can't deprecate packages!`);
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RegistryProvider = void 0;
|
|
4
4
|
const FileSystem_1 = require("./FileSystem");
|
|
5
|
-
const
|
|
5
|
+
const RegistryV2_1 = require("./RegistryV2");
|
|
6
6
|
const RegistryType_1 = require("./RegistryType");
|
|
7
7
|
var RegistryProvider;
|
|
8
8
|
(function (RegistryProvider) {
|
|
@@ -12,10 +12,10 @@ var RegistryProvider;
|
|
|
12
12
|
if (endpoint) {
|
|
13
13
|
endpoint = endpoint.toLowerCase().trim();
|
|
14
14
|
}
|
|
15
|
-
if (!endpoint || endpoint ===
|
|
15
|
+
if (!endpoint || endpoint === RegistryV2_1.PUBLIC_RESERVED_KEYWORD) {
|
|
16
16
|
foundRegistry = RegistryProvider.registry.find(o => o.getRegistryType() === RegistryType_1.RegistryType.PUBLIC);
|
|
17
17
|
if (!foundRegistry) {
|
|
18
|
-
foundRegistry = new
|
|
18
|
+
foundRegistry = new RegistryV2_1.RegistryV2(RegistryV2_1.PUBLIC_RESERVED_KEYWORD);
|
|
19
19
|
RegistryProvider.registry.push(foundRegistry);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -25,7 +25,7 @@ var RegistryProvider;
|
|
|
25
25
|
else {
|
|
26
26
|
foundRegistry = RegistryProvider.registry.find(o => o.endpoint === endpoint);
|
|
27
27
|
if (!foundRegistry) {
|
|
28
|
-
foundRegistry = new
|
|
28
|
+
foundRegistry = new RegistryV2_1.RegistryV2(endpoint, endpoint);
|
|
29
29
|
RegistryProvider.registry.push(foundRegistry);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { RegistryType } from "./RegistryType";
|
|
2
|
-
import {
|
|
2
|
+
import { Package, Ping, WhoAmI } from "trm-registry-types";
|
|
3
3
|
import { TrmArtifact } from "../trmPackage/TrmArtifact";
|
|
4
4
|
import { AbstractRegistry } from "./AbstractRegistry";
|
|
5
5
|
export declare const PUBLIC_RESERVED_KEYWORD = "public";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class RegistryV2 implements AbstractRegistry {
|
|
7
7
|
endpoint: string;
|
|
8
8
|
name: string;
|
|
9
|
+
private _cache;
|
|
9
10
|
private _registryType;
|
|
10
11
|
private _axiosInstance;
|
|
11
12
|
private _authData;
|
|
12
|
-
private
|
|
13
|
-
private _whoami;
|
|
13
|
+
private _userAgent;
|
|
14
14
|
constructor(endpoint: string, name?: string);
|
|
15
|
+
private getDefaultAxiosHeaders;
|
|
15
16
|
compare(registry: AbstractRegistry): boolean;
|
|
16
17
|
getRegistryType(): RegistryType;
|
|
17
18
|
authenticate(defaultData?: any): Promise<AbstractRegistry>;
|
|
@@ -21,10 +22,10 @@ export declare class Registry implements AbstractRegistry {
|
|
|
21
22
|
getAuthData(): any;
|
|
22
23
|
ping(): Promise<Ping>;
|
|
23
24
|
whoAmI(): Promise<WhoAmI>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
unpublish(
|
|
29
|
-
|
|
25
|
+
getPackage(fullName: string, version?: string): Promise<Package>;
|
|
26
|
+
downloadArtifact(fullName: string, version?: string): Promise<TrmArtifact>;
|
|
27
|
+
validatePublish(fullName: string, version?: string): Promise<void>;
|
|
28
|
+
publish(fullName: string, version: string, artifact: TrmArtifact, readme?: string): Promise<Package>;
|
|
29
|
+
unpublish(fullName: string, version: string): Promise<void>;
|
|
30
|
+
deprecate(fullName: string, version: string, reason: string): Promise<void>;
|
|
30
31
|
}
|