Compare commits

..

2 Commits

Author SHA1 Message Date
guidohollander dbcc71dc92 svn cleanup and update
3 years ago
guidohollander 64a50f560d progress
3 years ago

@ -1,15 +0,0 @@
// .eslintrc.js
module.exports = {
root: true,
plugins: ["@typescript-eslint"],
extends: [
"airbnb-typescript/base",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
},
};

4
.gitignore vendored

@ -138,3 +138,7 @@ dist
roadmap.txt
fw.bat
publish_*.ps1
src/**/*.d.ts
src/**/*.js
src/**/*.map

@ -1,3 +0,0 @@
{
"useTabs": true
}

@ -1,171 +0,0 @@
import * as semver from "semver";
import { svnGetLatestTag, svnPropGet } from "./promises";
export class SolutionImplementation {
constructor(url) {
this.url = "";
this.baseUrl = "";
this.repository = "";
this.repositoryUrl = "";
this.componentFolder = null;
this._isSolutionComponent = false;
this._isImplementation = false;
this.implementationUrl = "";
this.type = "";
this.version = null;
this.nextVersion = null;
this.component = "";
this.parseUrl(url);
}
getBaseUrl() {
return this.baseUrl;
}
getUrl() {
return this.url;
}
getImplementationUrl() {
return this.implementationUrl;
}
getRepository() {
return this.repository;
}
getRepositoryUrl() {
return this.repositoryUrl;
}
getComponentFolder() {
return this.componentFolder;
}
isSolutionComponent() {
return this._isSolutionComponent;
}
isImplementation() {
return this._isImplementation;
}
getType() {
return this.type;
}
getVersion() {
return this.version;
}
async getNextVersion(semVerIncrementType) {
await this.getLatestTag()
.then((result) => {
if (semver.valid(semver.coerce(result))) {
const sv = result;
this.nextVersion = semver.inc(sv, semVerIncrementType);
} else {
this.nextVersion = null;
}
})
.catch((error) => {
// Handle error
});
return this.nextVersion;
}
async getLatestTag() {
try {
const lastTagOrBranch = await svnGetLatestTag(this.implementationUrl);
return lastTagOrBranch.name;
} catch (error) {
console.error("Error retrieving last tag or branch:", error);
throw error;
}
}
getTypeAndVersion() {
if ((this.type === "tags" || this.type === "branches") && this.version) {
return `${this.type}/${this.version}`;
}
return `${this.type}`;
}
getComponent() {
return this.component;
}
getComponentDecoded() {
return decodeURIComponent(this.component);
}
getExternalsRaw() {
return decodeURIComponent(this.component);
}
// GetExternalsCollection(): externalsCollection {
// return decodeURIComponent(this.component);
// }
async getExternals() {
const svnOptions = { trustServerCert: true };
try {
const response = await svnPropGet("svn:externals", this.url, svnOptions);
const rawExternals = response.target.property._;
return rawExternals;
} catch (error) {
console.error("Error retrieving last tag or branch:", error);
throw error;
}
}
parseUrl(url) {
this.url = url;
const regex = /^(https?:\/\/[^\/]+\/svn\/)/;
const match = regex.exec(url);
if (match && match.length > 1) {
this.baseUrl = match[1];
} else {
throw new Error("Invalid URL");
}
const segments = url.split("/");
const svnIndex = segments.indexOf("svn");
const trunkTagBranchIndex = segments.findIndex(
(segment, index) =>
index > svnIndex &&
(segment === "trunk" || segment === "tags" || segment === "branches")
);
this._isSolutionComponent = trunkTagBranchIndex - svnIndex > 2;
if (svnIndex !== -1 && svnIndex + 1 < segments.length) {
this.repository = segments[svnIndex + 1];
this.repositoryUrl = `${this.baseUrl}${this.repository}`;
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex - 1 > svnIndex) {
const nextSegment = segments[trunkTagBranchIndex - 1];
if (
nextSegment !== "trunk" &&
nextSegment !== "tags" &&
nextSegment !== "branches"
) {
if (this._isSolutionComponent) {
this.componentFolder = nextSegment;
}
}
}
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex < segments.length) {
this.type = segments[trunkTagBranchIndex];
if (this.type === "tags" || this.type === "branches") {
if (trunkTagBranchIndex + 1 < segments.length) {
this.version = segments[trunkTagBranchIndex + 1];
if (trunkTagBranchIndex + 2 < segments.length) {
this.component = segments[trunkTagBranchIndex + 2];
}
}
} else if (trunkTagBranchIndex + 1 < segments.length) {
this.component = segments[trunkTagBranchIndex + 1];
}
}
this._isImplementation =
this.componentFolder === null && this.component === "";
this.implementationUrl = segments
.slice(0, trunkTagBranchIndex + (this.version === null ? 1 : 2))
.join("/");
if (this._isImplementation) {
const rawExternals = this.getExternals();
}
} else {
throw new Error("Invalid URL");
}
}
}
// Helper function to retrieve the last tag or branch
// async function getLastTagOrBranch(url: string): Promise<string> {
// try {
// const list = await svnListPromise(url);
// const sortedList = list.sort((a, b) => b.date.getTime() - a.date.getTime());
// const lastTagOrBranch = sortedList[0].name;
// return lastTagOrBranch;
// } catch (error) {
// throw error;
// }
// }
//# sourceMappingURL=SolutionImplementation.js.map

@ -1 +0,0 @@
{"version":3,"file":"SolutionImplementation.js","sourceRoot":"","sources":["SolutionImplementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAU,eAAe,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAEhE,MAAM,OAAO,sBAAsB;IAelC,YAAY,GAAW;QAdf,QAAG,GAAG,EAAE,CAAC;QACT,YAAO,GAAG,EAAE,CAAC;QACb,eAAU,GAAG,EAAE,CAAC;QAChB,kBAAa,GAAG,EAAE,CAAC;QACnB,oBAAe,GAAuB,IAAI,CAAC;QAC3C,yBAAoB,GAAG,KAAK,CAAC;QAC7B,sBAAiB,GAAG,KAAK,CAAC;QAC1B,sBAAiB,GAAG,EAAE,CAAC;QACvB,SAAI,GAAG,EAAE,CAAC;QACV,YAAO,GAAuB,IAAI,CAAC;QACnC,gBAAW,GAAuB,IAAI,CAAC;QAEvC,cAAS,GAAG,EAAE,CAAC;QAGtB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,UAAU;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,MAAM;QACL,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;IAED,oBAAoB;QACnB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAED,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,gBAAgB;QACf,OAAO,IAAI,CAA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";
import { svnList, svnGetLatestTag, svnPropGet } from "./promises";
export class SolutionImplementation {
private url = "";
private baseUrl = "";
private repository = "";
private repositoryUrl = "";
private componentFolder: string | undefined = null;
private _isSolutionComponent = false;
private _isImplementation = false;
private implementationUrl = "";
private type = "";
private version: string | undefined = null;
private nextVersion: string | undefined = null;
private component = "";
constructor(url: string) {
this.parseUrl(url);
}
getBaseUrl(): string {
return this.baseUrl;
}
getUrl(): string {
return this.url;
}
getImplementationUrl(): string {
return this.implementationUrl;
}
getRepository(): string {
return this.repository;
}
getRepositoryUrl(): string {
return this.repositoryUrl;
}
getComponentFolder(): string | undefined {
return this.componentFolder;
}
isSolutionComponent(): boolean {
return this._isSolutionComponent;
}
isImplementation(): boolean {
return this._isImplementation;
}
getType(): string {
return this.type;
}
getVersion(): string | undefined {
return this.version;
}
public async getNextVersion(
semVerIncrementType: SemVerIncrementType
): Promise<string | undefined> {
await this.getLatestTag()
.then((result) => {
if (semver.valid(semver.coerce(result))) {
const sv: string = result;
this.nextVersion = semver.inc(sv, semVerIncrementType);
} else {
this.nextVersion = null;
}
})
.catch((error) => {
// Handle error
});
return this.nextVersion;
}
public async getLatestTag(): Promise<string> {
try {
const lastTagOrBranch = await svnGetLatestTag(this.implementationUrl);
return lastTagOrBranch.name;
} catch (error) {
console.error("Error retrieving last tag or branch:", error);
throw error;
}
}
getTypeAndVersion(): string {
if ((this.type === "tags" || this.type === "branches") && this.version) {
return `${this.type}/${this.version}`;
}
return `${this.type}`;
}
getComponent(): string {
return this.component;
}
getComponentDecoded(): string {
return decodeURIComponent(this.component);
}
getExternalsRaw(): string {
return decodeURIComponent(this.component);
}
// GetExternalsCollection(): externalsCollection {
// return decodeURIComponent(this.component);
// }
public async getExternals(): Promise<string> {
const svnOptions = { trustServerCert: true };
try {
const response: ApiExternalsResponse = await svnPropGet(
"svn:externals",
this.url,
svnOptions
);
const rawExternals: string = response.target.property._;
return rawExternals;
} catch (error) {
console.error("Error retrieving last tag or branch:", error);
throw error;
}
}
private parseUrl(url: string): void {
this.url = url;
const regex = /^(https?:\/\/[^\/]+\/svn\/)/;
const match = regex.exec(url);
if (match && match.length > 1) {
this.baseUrl = match[1];
} else {
throw new Error("Invalid URL");
}
const segments = url.split("/");
const svnIndex = segments.indexOf("svn");
const trunkTagBranchIndex = segments.findIndex(
(segment, index) =>
index > svnIndex &&
(segment === "trunk" || segment === "tags" || segment === "branches")
);
this._isSolutionComponent = trunkTagBranchIndex - svnIndex > 2;
if (svnIndex !== -1 && svnIndex + 1 < segments.length) {
this.repository = segments[svnIndex + 1];
this.repositoryUrl = `${this.baseUrl}${this.repository}`;
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex - 1 > svnIndex) {
const nextSegment = segments[trunkTagBranchIndex - 1];
if (
nextSegment !== "trunk" &&
nextSegment !== "tags" &&
nextSegment !== "branches"
) {
if (this._isSolutionComponent) {
this.componentFolder = nextSegment;
}
}
}
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex < segments.length) {
this.type = segments[trunkTagBranchIndex];
if (this.type === "tags" || this.type === "branches") {
if (trunkTagBranchIndex + 1 < segments.length) {
this.version = segments[trunkTagBranchIndex + 1];
if (trunkTagBranchIndex + 2 < segments.length) {
this.component = segments[trunkTagBranchIndex + 2];
}
}
} else if (trunkTagBranchIndex + 1 < segments.length) {
this.component = segments[trunkTagBranchIndex + 1];
}
}
this._isImplementation =
this.componentFolder === null && this.component === "";
this.implementationUrl = segments
.slice(0, trunkTagBranchIndex + (this.version === null ? 1 : 2))
.join("/");
if (this._isImplementation) {
const rawExternals = this.getExternals();
}
} else {
throw new Error("Invalid URL");
}
}
}
// Helper function to retrieve the last tag or branch
// async function getLastTagOrBranch(url: string): Promise<string> {
// try {
// const list = await svnListPromise(url);
// const sortedList = list.sort((a, b) => b.date.getTime() - a.date.getTime());
// const lastTagOrBranch = sortedList[0].name;
// return lastTagOrBranch;
// } catch (error) {
// throw error;
// }
// }

@ -1,15 +0,0 @@
import * as fs from "fs";
import { SolutionImplementation } from "./SolutionImplementation";
export class SolutionImplementationReader {
constructor() {
const json = fs.readFileSync("solutions.json", "utf-8");
this.solutionImplementations = JSON.parse(json);
}
readSolutionUrl() {
this.solutionImplementations.forEach((solutionImplementation) => {
const s = new SolutionImplementation(solutionImplementation.url);
console.log(JSON.stringify(s, null, 2));
});
}
}
//# sourceMappingURL=SolutionImplementationReader.js.map

@ -1 +0,0 @@
{"version":3,"file":"SolutionImplementationReader.js","sourceRoot":"","sources":["SolutionImplementationReader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAEhE,MAAM,OAAO,4BAA4B;IAGxC;QACC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAEM,eAAe;QACrB,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,sBAAkD,EAAE,EAAE;YAC3F,MAAM,CAAC,GAAG,IAAI,sBAAsB,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACJ,CAAC;CACD"}

@ -1,21 +0,0 @@
import * as fs from "fs";
import { type TypeSolutionImplementation } from "./types";
import { SolutionImplementation } from "./SolutionImplementation";
export class SolutionImplementationReader {
private readonly solutionImplementations: TypeSolutionImplementation[];
constructor() {
const json = fs.readFileSync("solutions.json", "utf-8");
this.solutionImplementations = JSON.parse(json);
}
public readSolutionUrl(): void {
this.solutionImplementations.forEach(
(solutionImplementation: TypeSolutionImplementation) => {
const s = new SolutionImplementation(solutionImplementation.url);
console.log(JSON.stringify(s, null, 2));
}
);
}
}

@ -1,85 +0,0 @@
import { SolutionImplementationReader } from "./SolutionImplementationReader";
// Const trunkUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGLO/Business_Licence/trunk/DSC%20Business%20license';
// const tagUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGLO/Interim_Stabilization_Levy/tags/1.0.0/DSC%20Interim%20stabilization%20levy';
// const branchUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/branches/1.5.0/SC%20Address%20-%20Specific';
// const trunkSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/trunk';
// const tagSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/tags/2.1.1.1';
// const branchSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/branches/2.1.1';
async function showOutPut() {
console.log();
}
// ShowOutPut();
// Usage
const solutionImplementations = [];
const solutionImplementationReader = new SolutionImplementationReader();
// SolutionImplementations.push(solutionImplementationReader.readSolutionUrl());
// solution = new SolutionImplementation(tagUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(branchUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(trunkSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(tagSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(branchSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
//# sourceMappingURL=index_bak.js.map

@ -1 +0,0 @@
{"version":3,"file":"index_bak.js","sourceRoot":"","sources":["index_bak.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,0HAA0H;AAC1H,mJAAmJ;AACnJ,yHAAyH;AACzH,2FAA2F;AAC3F,gGAAgG;AAChG,qGAAqG;AAErG,KAAK,UAAU,UAAU;IACvB,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,gBAAgB;AAEhB,QAAQ;AACR,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,4BAA4B,GAAG,IAAI,4BAA4B,EAAE,CAAC;AACxE,gFAAgF;AAEhF,iDAAiD;AACjD,wDAAwD;AACxD,gEAAgE;AAChE,sEAAsE;AACtE,gFAAgF;AAChF,kFAAkF;AAClF,4EAA4E;AAC5E,0DAA0D;AAC1D,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,kFAAkF;AAClF,oFAAoF;AACpF,qBAAqB;AAErB,oDAAoD;AACpD,wDAAwD;AACxD,gEAAgE;AAChE,sEAAsE;AACtE,gFAAgF;AAChF,kFAAkF;AAClF,4EAA4E;AAC5E,0DAA0D;AAC1D,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,kFAAkF;AAClF,oFAAoF;AACpF,qBAAqB;AAErB,2DAA2D;AAC3D,wDAAwD;AACxD,gEAAgE;AAChE,sEAAsE;AACtE,gFAAgF;AAChF,kFAAkF;AAClF,4EAA4E;AAC5E,0DAA0D;AAC1D,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,kFAAkF;AAClF,oFAAoF;AACpF,qBAAqB;AAErB,yDAAyD;AACzD,wDAAwD;AACxD,gEAAgE;AAChE,sEAAsE;AACtE,gFAAgF;AAChF,kFAAkF;AAClF,4EAA4E;AAC5E,0DAA0D;AAC1D,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,kFAAkF;AAClF,oFAAoF;AACpF,qBAAqB;AAErB,4DAA4D;AAC5D,wDAAwD;AACxD,gEAAgE;AAChE,sEAAsE;AACtE,gFAAgF;AAChF,kFAAkF;AAClF,4EAA4E;AAC5E,0DAA0D;AAC1D,gEAAgE;AAChE,8EAA8E;AAC9E,oEAAoE;AACpE,kFAAkF;AAClF,oFAAoF"}

@ -1,94 +0,0 @@
import { SolutionImplementation } from "./SolutionImplementation";
import { SolutionImplementationReader } from "./SolutionImplementationReader";
// Const trunkUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGLO/Business_Licence/trunk/DSC%20Business%20license';
// const tagUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGLO/Interim_Stabilization_Levy/tags/1.0.0/DSC%20Interim%20stabilization%20levy';
// const branchUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/branches/1.5.0/SC%20Address%20-%20Specific';
// const trunkSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/trunk';
// const tagSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/tags/2.1.1.1';
// const branchSolutionUrl = 'https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/branches/2.1.1';
async function showOutPut() {
console.log();
}
// ShowOutPut();
// Usage
const solutionImplementations = [];
const solutionImplementationReader = new SolutionImplementationReader();
// SolutionImplementations.push(solutionImplementationReader.readSolutionUrl());
// solution = new SolutionImplementation(tagUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(branchUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(trunkSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(tagSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());
// console.log('--');
// solution = new SolutionImplementation(branchSolutionUrl);
// console.log('solution.getURL():', solution.getURL());
// console.log('solution.getBaseURL():', solution.getBaseURL());
// console.log('solution.getRepository():', solution.getRepository());
// console.log('solution.getComponentFolder():', solution.getComponentFolder());
// console.log('solution.isSolutionComponent():', solution.isSolutionComponent());
// console.log('solution.isImplementation():', solution.isImplementation());
// console.log('solution.getType():', solution.getType());
// console.log('solution.getVersion():', solution.getVersion());
// console.log('solution.getTypeAndVersion():', solution.getTypeAndVersion());
// console.log('solution.getComponent():', solution.getComponent());
// console.log('solution.getComponentDecoded():', solution.getComponentDecoded());
// console.log('solution.getImplementationURL():', solution.getImplementationURL());

@ -1,8 +0,0 @@
import { promisify } from "util";
import * as nodeSVNUltimate from "node-svn-ultimate";
// Promisify individual functions
const svnList = promisify(nodeSVNUltimate.commands.list);
const svnGetLatestTag = promisify(nodeSVNUltimate.util.getLatestTag);
const svnPropGet = promisify(nodeSVNUltimate.commands.propget);
export { svnList, svnGetLatestTag, svnPropGet };
//# sourceMappingURL=promises.js.map

@ -1 +0,0 @@
{"version":3,"file":"promises.js","sourceRoot":"","sources":["promises.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,MAAM,OAAO,GAAG,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzD,MAAM,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACrE,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAE/D,OAAO,EACN,OAAO,EACP,eAAe,EACf,UAAU,GACV,CAAC"}

@ -1,9 +0,0 @@
import { promisify } from "util";
import * as nodeSVNUltimate from "node-svn-ultimate";
// Promisify individual functions
const svnList = promisify(nodeSVNUltimate.commands.list);
const svnGetLatestTag = promisify(nodeSVNUltimate.util.getLatestTag);
const svnPropGet = promisify(nodeSVNUltimate.commands.propget);
export { svnList, svnGetLatestTag, svnPropGet };

@ -1,6 +0,0 @@
export var Role;
(function (Role) {
Role["ADMIN"] = "admin";
Role["USER"] = "user";
})(Role || (Role = {}));
//# sourceMappingURL=types.js.map

@ -1 +0,0 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,IAGX;AAHD,WAAY,IAAI;IACf,uBAAe,CAAA;IACf,qBAAa,CAAA;AACd,CAAC,EAHW,IAAI,KAAJ,IAAI,QAGf"}

@ -1,36 +0,0 @@
export type SemVerIncrementType = "minor" | "major" | "patch";
export type User = {
id: number;
name: string;
email: string;
};
export enum Role {
ADMIN = "admin",
USER = "user",
}
export type TypeSolutionImplementation = {
name: string;
functionalName: string;
customer: string;
customerCode: string;
path: string;
class: string;
url: string;
};
export type ApiExternalsResponse = {
target: {
$: {
path: string;
};
property: {
_: string;
$: {
name: string;
};
};
};
};

@ -10,6 +10,9 @@
"kind": "build",
"isDefault": true
},
"runOptions": {
"runOn": "folderOpen"
},
"label": "tsc: watch - tsconfig.json"
}
]

12
6

@ -1,12 +0,0 @@
added 61 packages, removed 6 packages, and audited 284 packages in 9s
105 packages are looking for funding
run `npm fund` for details
2 moderate severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.

82
package-lock.json generated

@ -9,12 +9,13 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"node-svn-ultimate": "^1.2.1",
"semver": "^7.5.1"
"semver": "^7.5.1",
"xml2js": "^0.6.0"
},
"devDependencies": {
"@types/node": "^20.2.3",
"@types/semver": "^7.5.0",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"eslint": "^8.41.0",
@ -177,6 +178,15 @@
"integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==",
"dev": true
},
"node_modules/@types/xml2js": {
"version": "0.4.11",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.11.tgz",
"integrity": "sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.59.8",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.8.tgz",
@ -1430,16 +1440,6 @@
"is-callable": "^1.1.3"
}
},
"node_modules/fs-extra": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
"integrity": "sha512-VerQV6vEKuhDWD2HGOybV6v5I73syoc/cXAbKlgTC7M/oFVEtklWlp9QH2Ijw3IaWDOQcMkldSPa7zXy79Z/UQ==",
"dependencies": {
"graceful-fs": "^4.1.2",
"jsonfile": "^2.1.0",
"klaw": "^1.0.0"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -1616,11 +1616,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"node_modules/grapheme-splitter": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
@ -2113,22 +2108,6 @@
"json5": "lib/cli.js"
}
},
"node_modules/jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==",
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/klaw": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
"integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==",
"optionalDependencies": {
"graceful-fs": "^4.1.9"
}
},
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@ -2468,28 +2447,6 @@
"integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
"dev": true
},
"node_modules/node-svn-ultimate": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/node-svn-ultimate/-/node-svn-ultimate-1.2.1.tgz",
"integrity": "sha512-WqNyOq3hW/A2Hi/MAMFu3PhnCzGdTnGaR6Cfr65OL7Qa8pLvlMbJ21t7Vko3CYngnI6Zn1JmKwtA3SlEcFC61A==",
"dependencies": {
"fs-extra": "^1.0.0",
"semver": "^5.3.0",
"uuid": "^3.0.0",
"xml2js": "^0.4.17"
},
"engines": {
"node": ">= 0.10.0"
}
},
"node_modules/node-svn-ultimate/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"bin": {
"semver": "bin/semver"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@ -3381,15 +3338,6 @@
"punycode": "^2.1.0"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@ -3503,9 +3451,9 @@
"dev": true
},
"node_modules/xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.0.tgz",
"integrity": "sha512-eLTh0kA8uHceqesPqSE+VvO1CDDJWMwlQfB6LuN6T8w6MaDJ8Txm8P7s5cHD0miF0V+GGTZrDQfxPZQVsur33w==",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"

@ -7,7 +7,7 @@
"license": "ISC",
"type": "module",
"scripts": {
"build": "tsc",
"build": "tsc && copyfiles -u 1 \"src/data/*.json\" dist",
"format": "prettier --write .",
"prepare": "husky install",
"lint": "eslint ."
@ -15,6 +15,7 @@
"devDependencies": {
"@types/node": "^20.2.3",
"@types/semver": "^7.5.0",
"@types/xml2js": "^0.4.11",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"eslint": "^8.41.0",
@ -29,8 +30,8 @@
"typescript": "^5.1.3"
},
"dependencies": {
"node-svn-ultimate": "^1.2.1",
"semver": "^7.5.1"
"semver": "^7.5.1",
"xml2js": "^0.6.0"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write"

@ -0,0 +1,11 @@
{
"useTabs": true,
"trailingComma": "all",
"function-max-lines": [
2,
{
"max": 1
}
],
"function-body-newline": true
}

@ -0,0 +1,83 @@
[
{
"name": "MBS_ANGUILLA",
"functionalName": "MBS Anguilla",
"customer": "ANGUILLA",
"customerCode": "aia_mbs",
"path": "D:\\repo\\mbs_anguilla_21\\",
"class": "MxS",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MBS_ANGUILLA/trunk"
},
{
"name": "MTS_ANGUILLA",
"functionalName": "MTS Anguilla",
"customer": "ANGUILLA ",
"customerCode": "aia_mts",
"path": "D:\\repo\\mts_anguilla_21\\",
"class": "MxS",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_ANGUILLA/trunk"
},
{
"name": "ONLINE_ANGUILLA",
"functionalName": "Online Anguilla",
"customer": "ANGUILLA",
"customerCode": "aia_online",
"path": "D:\\repo\\online_anguilla\\",
"class": "ONLINE",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_ANGUILLA/trunk"
},
{
"name": "MTS_SKN",
"functionalName": "MTS Saint Kitts and Nevis",
"customer": "SKN",
"customerCode": "skn_mts",
"path": "D:\\repo\\mts_skn\\",
"class": "MxS",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_SKN/trunk"
},
{
"name": "ONLINE_SKN",
"functionalName": "Online Saint Kitts and Nevis",
"customer": "SKN",
"customerCode": "skn_online",
"path": "D:\\repo\\online_skn\\",
"class": "ONLINE",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_SKN/trunk"
},
{
"name": "BDSU_MTS",
"functionalName": "MTS Belastingdienst Suriname",
"customer": "Belastingdienst Suriname",
"customerCode": "bdsu_mts",
"path": "D:\\repo\\mts_bdsu\\",
"class": "MxS",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/BDSU_MTS/trunk",
"test": true
},
{
"name": "MTS_GRENADA",
"functionalName": "MTS Grenada",
"customer": "GRENADA",
"customerCode": "gd_mts",
"path": "D:\\repo\\mts_grenada\\",
"class": "MxS",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_GRENADA/trunk"
},
{
"name": "ONLINE_GD",
"functionalName": "Online Grenada",
"customer": "GRENADA",
"customerCode": "gd_online",
"path": "D:\\repo\\online_gd\\",
"class": "ONLINE",
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_GD/trunk"
}
]

@ -6,7 +6,9 @@
"customerCode": "aia_mbs",
"path": "D:\\repo\\mbs_anguilla_21\\",
"class": "MxS",
"url": "https://svn.bearingpointcaribbean.com/svn/MBS_ANGUILLA/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MBS_ANGUILLA/trunk",
"selected": true
},
{
"name": "MTS_ANGUILLA",
@ -15,7 +17,9 @@
"customerCode": "aia_mts",
"path": "D:\\repo\\mts_anguilla_21\\",
"class": "MxS",
"url": "https://svn.bearingpointcaribbean.com/svn/MTS_ANGUILLA/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_ANGUILLA/trunk",
"selected": true
},
{
"name": "ONLINE_ANGUILLA",
@ -24,7 +28,9 @@
"customerCode": "aia_online",
"path": "D:\\repo\\online_anguilla\\",
"class": "ONLINE",
"url": "https://svn.bearingpointcaribbean.com/svn/ONLINE_ANGUILLA/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_ANGUILLA/trunk",
"selected": false
},
{
"name": "MTS_SKN",
@ -33,7 +39,9 @@
"customerCode": "skn_mts",
"path": "D:\\repo\\mts_skn\\",
"class": "MxS",
"url": "https://svn.bearingpointcaribbean.com/svn/MTS_SKN/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_SKN/trunk",
"selected": true
},
{
"name": "ONLINE_SKN",
@ -42,7 +50,9 @@
"customerCode": "skn_online",
"path": "D:\\repo\\online_skn\\",
"class": "ONLINE",
"url": "https://svn.bearingpointcaribbean.com/svn/ONLINE_SKN/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_SKN/trunk",
"selected": false
},
{
"name": "BDSU_MTS",
@ -51,8 +61,10 @@
"customerCode": "bdsu_mts",
"path": "D:\\repo\\mts_bdsu\\",
"class": "MxS",
"url": "https://svn.bearingpointcaribbean.com/svn/BDSU_MTS/trunk",
"test": true
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/BDSU_MTS/trunk",
"test": true,
"selected": false
},
{
"name": "MTS_GRENADA",
@ -61,7 +73,9 @@
"customerCode": "gd_mts",
"path": "D:\\repo\\mts_grenada\\",
"class": "MxS",
"url": "https://svn.bearingpointcaribbean.com/svn/MTS_GRENADA/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/MTS_GRENADA/trunk",
"selected": true
},
{
"name": "ONLINE_GD",
@ -70,6 +84,8 @@
"customerCode": "gd_online",
"path": "D:\\repo\\online_gd\\",
"class": "ONLINE",
"url": "https://svn.bearingpointcaribbean.com/svn/ONLINE_GD/trunk"
"baseUrl": "https://svn.bearingpointcaribbean.com",
"url": "/svn/ONLINE_GD/trunk",
"selected": false
}
]

@ -0,0 +1,130 @@
import { DirType } from "./types.js";
import { ExternalComponentResource } from "./ExternalComponentResource.js";
export class AngloResource {
protected _url = "";
protected _baseUrl = "";
protected _fullUrl = "";
protected _bareComponentUrl = "";
protected _repository = "";
protected _repositoryUrl = "";
protected _componentFolder?: string;
protected _implementationUrl = "";
protected _dirType: DirType = DirType.trunk;
protected _version?: string;
protected _componentName = "";
constructor(baseUrl: string, url: string) {
this.parseUrl(baseUrl, url);
}
baseUrl(): string {
return this._baseUrl;
}
fullUrl(): string {
return this._fullUrl;
}
implementationUrl(): string {
return this._implementationUrl;
}
repositoryName(): string {
return this._repository;
}
repositoryUrl(): string {
return this._repositoryUrl;
}
dirType(): DirType {
return this._dirType;
}
dirTypeAndVersion(): string {
if (
(this._dirType === DirType.tags || this._dirType === DirType.branches) &&
this._version
) {
return `${this._dirType}/${this._version}`;
}
return `${this._dirType}`;
}
url(): string {
return this._url;
}
version(): string | undefined {
return this._version;
}
private parseUrl(baseUrl: string, url: string): void {
this._url = url;
this._baseUrl = baseUrl;
this._fullUrl = `${baseUrl}${url}`;
const regex = /^(https?:\/\/[^]+\/svn\/)/; //const regex = /^(https?:\/\/[^\/]+\/svn\/)/;
const match = regex.exec(this._fullUrl);
if (!(match && match.length > 1)) {
throw new Error("Invalid URL");
}
const segments = this._fullUrl.split("/");
const svnIndex = segments.indexOf("svn");
const trunkTagBranchIndex = segments.findIndex(
(segment, index) =>
index > svnIndex &&
(segment === "trunk" || segment === "tags" || segment === "branches")
);
if (svnIndex !== -1 && svnIndex + 1 < segments.length) {
this._repository = segments[svnIndex + 1];
this._repositoryUrl = `${this._baseUrl}/${this._repository}`;
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex - 1 > svnIndex) {
const nextSegment = segments[trunkTagBranchIndex - 1];
if (
nextSegment !== "trunk" &&
nextSegment !== "tags" &&
nextSegment !== "branches"
) {
if (this instanceof ExternalComponentResource) {
this._componentFolder = nextSegment;
}
}
}
if (trunkTagBranchIndex !== -1 && trunkTagBranchIndex < segments.length) {
this._dirType = segments[trunkTagBranchIndex] as DirType;
if (this._dirType === "tags" || this._dirType === "branches") {
if (trunkTagBranchIndex + 1 < segments.length) {
this._version = this.normalizeVersion(
segments[trunkTagBranchIndex + 1]
);
if (trunkTagBranchIndex + 2 < segments.length) {
this._componentName = segments[trunkTagBranchIndex + 2];
}
}
} else if (trunkTagBranchIndex + 1 < segments.length) {
this._componentName = segments[trunkTagBranchIndex + 1];
}
}
this._implementationUrl = segments
.slice(0, trunkTagBranchIndex + (this._version === undefined ? 1 : 2))
.join("/");
this._bareComponentUrl = segments
.slice(0, trunkTagBranchIndex)
.join("/")
.replaceAll(baseUrl, "");
} else {
throw new Error("Invalid URL");
}
}
private normalizeVersion(version: string): string {
// when a version has more than 3 segments (which is an illegal semver), prefix the remaining segments with -, ie. 1.2.3-4
const segments = version.split(".");
if (segments.length <= 3) {
return version;
} else {
const lastSegments = segments.slice(2); // Join the last segments together
return `${segments[0]}.${segments[1]}.${lastSegments.join("-")}`;
}
}
}

@ -0,0 +1,98 @@
import * as semver from "semver";
import {
type SemVerIncrementType,
ExternalResourceUpdate,
DirType,
} from "./types.js";
import { svnTagsBranchesList } from "./svn.js";
import { ExternalComponentResource } from "./ExternalComponentResource.js";
import { ImplementationResource } from "./ImplementationResource.js";
import { AngloResource } from "./AngloResource.js";
export class AngloVersionedResource extends AngloResource {
protected _latestVersion?: ImplementationResource | ExternalComponentResource;
protected _nextVersion?: string | null;
public async hasUpdate(
dirType: DirType = DirType.tags
): Promise<ExternalResourceUpdate> {
let returnValue: ExternalResourceUpdate = {
hasUpdate: false,
toVersion: undefined,
};
if (this._version && this._dirType === dirType) {
if (!this._latestVersion) {
await this.getLatestVersion(DirType.tags);
}
const hasUpdate = semver.lt(
this._version as string,
this._latestVersion?.version() as string
);
if (hasUpdate) {
returnValue = {
hasUpdate,
toVersion: this._latestVersion as ExternalComponentResource,
};
}
}
return returnValue;
}
public async getLatestVersion(
dirType: DirType
): Promise<ImplementationResource | ExternalComponentResource> {
try {
const lastTagOrBranch = await svnTagsBranchesList(
dirType,
this._baseUrl,
this._bareComponentUrl,
true
);
const lastTagUrl = `${this._bareComponentUrl}${lastTagOrBranch}`;
if (this instanceof ExternalComponentResource) {
this._latestVersion = new ExternalComponentResource(
this._baseUrl,
lastTagUrl,
this._parentSolutionImplementation
);
} else {
this._latestVersion = new ImplementationResource(
this._baseUrl,
lastTagUrl,
undefined
);
}
return this._latestVersion;
} catch (error) {
console.error("Error retrieving last tag or branch:", error);
throw error;
}
}
public async getNextVersion(
dirType: DirType,
semVerIncrementType: SemVerIncrementType
): Promise<string | undefined> {
if (this._version || this._dirType === "trunk") {
await this.getLatestVersion(dirType)
.then((latestTagSolutionImplementation) => {
if (
semver.valid(
semver.coerce(latestTagSolutionImplementation.version())
)
) {
const sv: string | null | undefined =
latestTagSolutionImplementation.version();
if (semver.inc(sv as string, semVerIncrementType)) {
this._nextVersion = semver.inc(sv as string, semVerIncrementType);
}
} else {
this._nextVersion = undefined;
}
})
.catch((error) => {
console.log(error);
});
return this._nextVersion as string;
}
}
}

@ -0,0 +1,50 @@
import { AngloVersionedResource } from "./AngloVersionedResource.js";
import { ImplementationResource } from "./ImplementationResource.js";
import { svnUpdate } from "./svn.js";
export class ExternalComponentResource extends AngloVersionedResource {
public _parentSolutionImplementation: ImplementationResource;
constructor(
baseUrl: string,
url: string,
parentSolutionImplementation: ImplementationResource
) {
super(baseUrl, url);
this._parentSolutionImplementation = parentSolutionImplementation;
}
componentFolder(): string | undefined {
return this._componentFolder;
}
componentName(): string {
return this._componentName;
}
componentNameDecoded(): string {
return decodeURIComponent(this._componentName);
}
componentNameEncoded(): string {
return encodeURIComponent(this._componentName);
}
parentSolutionImplementation(): ImplementationResource {
return this._parentSolutionImplementation;
}
public async tag(): Promise<ExternalComponentResource> {
// todo
return new ExternalComponentResource(
this._baseUrl,
this._url,
this._parentSolutionImplementation
);
}
public async update(): Promise<void> {
if (
this._parentSolutionImplementation._implementationContext &&
this._componentName
) {
await svnUpdate(
`${this._parentSolutionImplementation._implementationContext.path}${this._componentName}`
);
}
}
}

@ -0,0 +1,82 @@
import {
ExternalComponent,
DirType,
InternalComponent,
TypeSolutionImplementation,
} from "./types.js";
import { svnList, svnPropGet } from "./svn.js";
import { ExternalComponentResource } from "./ExternalComponentResource.js";
import { AngloVersionedResource } from "./AngloVersionedResource.js";
import { InternalComponentResource } from "./InternalComponentResource.js";
export class ImplementationResource extends AngloVersionedResource {
protected _externalsCollection: ExternalComponentResource[] = [];
protected _internalsCollection: InternalComponentResource[] = [];
public _implementationContext?: TypeSolutionImplementation | undefined;
constructor(
baseUrl: string,
url: string,
implementationContext: TypeSolutionImplementation | undefined
) {
super(baseUrl, url);
this._implementationContext = implementationContext;
}
public async getExternals(): Promise<ExternalComponentResource[]> {
const propGetResult = await svnPropGet(
"svn:externals",
this._baseUrl,
this._url
);
propGetResult.forEach((externalComponent: ExternalComponent) => {
const thisExternal = new ExternalComponentResource(
this._baseUrl,
externalComponent.path,
this
);
this._externalsCollection.push(thisExternal);
});
return this._externalsCollection.filter(
(project) => !project.componentName().includes("FRONTEND")
);
}
public async getInternals(): Promise<InternalComponentResource[]> {
const svnListResult: InternalComponent[] = await svnList(
this._baseUrl,
this._url
);
svnListResult.forEach((internalComponent: InternalComponent) => {
const thisInternal = new InternalComponentResource(
this._baseUrl,
`${this._url}/${internalComponent}`,
this
);
this._internalsCollection.push(thisInternal);
});
return this._internalsCollection;
}
public async deploymentCheck(): Promise<ExternalComponentResource[]> {
if (!this._externalsCollection) {
await this.getExternals();
}
return this._externalsCollection.filter(
(externalComponentResource: ExternalComponentResource) => {
return externalComponentResource.dirType() === DirType.trunk;
}
);
}
public async tag(): Promise<ImplementationResource> {
return new ImplementationResource(
this._baseUrl,
this._url,
this._implementationContext
);
}
}

@ -0,0 +1,86 @@
import * as fs from "fs";
import { DirType, TypeSolutionImplementation } from "./types.js";
import { InternalComponentResource } from "./InternalComponentResource.js";
import { ImplementationResource } from "./ImplementationResource.js";
import { ExternalComponentResource } from "./ExternalComponentResource.js";
export class ImplementationResourceReader {
_solutionImplementationsInFile: TypeSolutionImplementation[];
_solutionImplementationCollection: ImplementationResource[] = [];
constructor() {
const json = fs.readFileSync("solutions.json", "utf-8");
this._solutionImplementationsInFile = JSON.parse(json).filter(
(solutionImplementation: TypeSolutionImplementation) => {
return solutionImplementation.selected;
}
);
}
// get solutionImplementationCollection(): Promise<SolutionImplementation[]> {
// return this._solutionImplementationCollection;
// }
public async load(
autoLoadInternals = true,
autoLoadExternals = false
): Promise<ImplementationResource[]> {
await Promise.all(
this._solutionImplementationsInFile.map(
async (solutionImplementation: TypeSolutionImplementation) => {
const thisSolutionImplementation = new ImplementationResource(
solutionImplementation.baseUrl,
solutionImplementation.url,
solutionImplementation
);
if (autoLoadExternals) {
const externals = await thisSolutionImplementation.getExternals();
// externals.forEach(
// async (externalComponentResource: ExternalComponentResource) => {
// const latestVersionExternalComponentResource =
// await externalComponentResource.getLatestVersion(
// DirType.tags
// );
// const hasUpdate = await externalComponentResource.hasUpdate(
// DirType.tags
// );
// console.log(
// `[External] ${externalComponentResource.componentName()}: current version: ${externalComponentResource.version()} - latest version: ${latestVersionExternalComponentResource.version()} - has update?: ${hasUpdate.toVersion?.version()}`
// );
// }
// );
externals.forEach(
async (externalComponentResource: ExternalComponentResource) => {
externalComponentResource.update();
}
);
}
if (autoLoadInternals) {
const internals = await thisSolutionImplementation.getInternals();
internals.forEach(
async (internalComponentResource: InternalComponentResource) => {
internalComponentResource.update();
}
);
}
this._solutionImplementationCollection.push(
thisSolutionImplementation
);
}
)
);
return this._solutionImplementationCollection;
}
public readSolutionUrl(): void {
this._solutionImplementationsInFile.forEach(
(solutionImplementation: TypeSolutionImplementation) => {
const s = new ImplementationResource(
solutionImplementation.baseUrl,
solutionImplementation.url,
solutionImplementation
);
console.log(JSON.stringify(s, null, 2));
}
);
}
}

@ -0,0 +1,34 @@
import { AngloResource } from "./AngloResource.js";
import { ImplementationResource } from "./ImplementationResource.js";
import { svnUpdate } from "./svn.js";
export class InternalComponentResource extends AngloResource {
public _parentSolutionImplementation: ImplementationResource;
constructor(
baseUrl: string,
url: string,
parentSolutionImplementation: ImplementationResource
) {
super(baseUrl, url);
this._parentSolutionImplementation = parentSolutionImplementation;
}
public async checkSpecifics(): Promise<boolean> {
// todo
return true;
}
public async update(): Promise<void> {
if (
this._parentSolutionImplementation._implementationContext &&
this._componentName
) {
await svnUpdate(
`${this._parentSolutionImplementation._implementationContext.path}${this._componentName}`
);
}
}
parentSolutionImplementation(): ImplementationResource {
return this._parentSolutionImplementation;
}
}

@ -0,0 +1,8 @@
[
".metadata",
"TEST",
"com.bearingpoint.ird.anguilla.remoting_connector",
"console-1.0-dev.jar",
"migrations.bat",
"etc"
]

@ -1,27 +1,100 @@
// import { spawn } from "child_process ";
// function spawnSample(command: string, args: string[]) {
// const execProcess = spawn(command, args);
// console.log('spawn');
// console.log(execProcess.spawnfile);
// execProcess.on('spawn', () => {
// console.log('spawn on spawn');
// });
// execProcess.stdout.on('data', (data) => {
// console.log(`spawn stdout: ${data}`);
// });
// execProcess.stderr.on('data', (data) => {
// console.log(`spawn on error ${data}`);
// });
// execProcess.on('exit', (code, signal) => {
// console.log(`spawn on exit code: ${code} signal: ${signal}`);
// });
// execProcess.on('close', (code: number, args: any[])=> {
// console.log(`spawn on close code: ${code} args: ${args}`);
import { ImplementationResourceReader } from "./ImplementationResourceReader.js";
import { ImplementationResource } from "./ImplementationResource.js";
import { ExternalComponentResource } from "./ExternalComponentResource.js";
import { ExternalComponent } from "./types.js";
// import { svnPropGet, svnList, svnGetLatestTag, } from "./svn.js";
// const baseUrl = 'https://svn.bearingpointcaribbean.com';
// const url = '/svn/MBS_ANGUILLA/trunk';
async function deploymentCheck() {
const reader = new ImplementationResourceReader();
const implementationResources = await reader.load(true, true);
implementationResources.forEach(
async (implementationResource: ImplementationResource) => {
const collectionOfComponentToBeTagged: ExternalComponentResource[] =
await implementationResource.deploymentCheck();
console.log(collectionOfComponentToBeTagged);
}
);
}
// async function start() {
// svnList(baseUrl, url)
// .then((listResult) => {
// console.log("Success:", listResult);
// return svnPropGet("svn:externals", baseUrl, url);
// })
// .then((propGetResult) => {
// const payload: string = propGetResult.properties.target[0].property[0]._;
// console.log("Second result:", JSON.stringify(payload, null, 2));
// })
// .catch((error) => {
// console.error("Error:", error);
// });
// }
// function start() {
// spawnSample('powershell',['node', '-v']);
// async function start2() {
// const listResult = await svnList(baseUrl, url);
// console.log("listResult", listResult);
// const propGetResult = await svnPropGet("svn:externals", baseUrl, url);
// console.log("propGetResult", JSON.stringify(propGetResult, null, 2));
// const svnGetLatestTagResult = await svnGetLatestTag(baseUrl, url);
// console.log(
// "svnGetLatestTagResult",
// JSON.stringify(svnGetLatestTagResult, null, 2)
// );
// }
// async function start3() {
// const solutionImplementationReader = new SolutionImplementationReader();
// solutionImplementationReader.solutionImplementations.forEach(
// (solutionImplementation: TypeSolutionImplementation) => {
// console.log(solutionImplementation.customer);
// }
// start();
console.log("Hello world!");
// );
// }
// async function start4() {
// const currentSolution = new SolutionImplementation(baseUrl, url);
// await currentSolution.getLatestVersion(DirType.tags);
// const externalsCollection = await currentSolution.getExternals();
// if (externalsCollection) {
// await Promise.all(
// externalsCollection.map(async (externalComponent) => {
// // const output = `${externalComponent.componentName()} => ${externalComponent.typeAndVersion()}`;
// // console.log("Latest external:", output);
// // console.log(
// // "Externalcomponent.parent:",
// // externalComponent.getParentSolutionImplementation()
// // );
// console.log(
// `${externalComponent.componentName()}: this verison: ${externalComponent.version()}, next minor: ${await externalComponent.getNextVersion(
// DirType.tags,
// 'minor'
// )}, next major: ${await externalComponent.getNextVersion(
// DirType.tags,
// 'major'
// )}`
// );
// })
// );
// }
// // externalComponents.forEach((externalComponent: ExternalComponent) => {
// // const currentExternal = new SolutionImplementation(
// // baseUrl,
// // externalComponent.path
// // );
// // console.log(currentExternal);
// // });
// // console.log(await currentSolution.getExternals());
// }
//start();
//start2();
//start3();
// start4();
deploymentCheck();

@ -0,0 +1,76 @@
import { ExternalComponent } from "./types";
function tidyArrayContent(entry: string): { path: string; name: string } {
let name = "";
let item;
if (entry.includes("'")) {
item = entry.split(" '");
} else {
item = entry.split(" ");
}
const path = item[0];
if (item.length === 2) {
name = item[1].replace(/[']/g, "");
} else if (item.length === 1) {
// eslint-disable-next-line prefer-destructuring
name = item[0];
}
return { path, name };
}
export function parseExternals(
rawExternalsString: string
): Promise<[ExternalComponent]> {
return new Promise((resolve, reject) => {
try {
const splittedExternals: string[] = rawExternalsString.split("\r\n");
const enrichedExternals = splittedExternals.map(
(svnExternal: string) => ({
original: svnExternal,
key: tidyArrayContent(svnExternal).name,
path: decodeURI(tidyArrayContent(svnExternal).path),
version: svnExternal.split("/")[svnExternal.split("/").length - 2],
})
);
const cleansedExternals = enrichedExternals.filter(
(item) => item.original !== ""
);
resolve(cleansedExternals as [ExternalComponent]);
return cleansedExternals as [ExternalComponent];
} catch (error) {
reject(error);
}
});
}
// splittedExternals.forEach((entry) => {
// const tidied = anglo.tidyArrayContent(entry);
// // for componentBaseFolder. If domain-specific, keep first 3, else keep first 4 parts
// const partsToKeep = (tidied.name.toLowerCase().startsWith('dsc')) ? 4 : 5;
// if (tidied.name !== '') {
// const component = getComponentName(decodeURI(tidied.path.split('/').slice(0, partsToKeep).join('/')).replace('//', '/'));
// sol.tidiedexternals.push({
// key: tidied.name,
// path: decodeURI(tidied.path),
// componentBaseFolder: decodeURI(tidied.path.split('/').slice(0, partsToKeep).join('/')).replace('//', '/'),
// componentRoot: state.oSVNInfo.baseURL + decodeURI(tidied.path.split('/').slice(0, partsToKeep).join('/')).replace('//', '/').replace(component.bareComponentName, '').replace(/^\//, ''),
// componentName: component.fullComponentName,
// bareComponentName: component.bareComponentName,
// relativeUrl: tidied.path.replaceAll(`${decodeURI(tidied.path.split('/').slice(0, partsToKeep).join('/')).replace('//', '/')}/`, '').split('/').slice(0, -1).join('/')
// .split('/')
// .splice(-2)
// .join('/'),
// isExternal: true,
// isCoreComponent: !tidied.name.toLowerCase().includes('interface def'),
// isInterfaceDefinition: tidied.name.toLowerCase().includes('interface def'),
// isSpecific: tidied.name.toLowerCase().includes('specific'),
// isDomainSpecific: tidied.name.toLowerCase().startsWith('dsc'),
// isSolutionComponent: tidied.name.toLowerCase().startsWith('sc'),
// isTagged: decodeURI(tidied.path).toLocaleLowerCase().includes('/tags/'),
// isBranched: decodeURI(tidied.path).toLocaleLowerCase().includes('/branches/'),
// isTrunk: decodeURI(tidied.path).toLocaleLowerCase().includes('/trunk/'),
// isFrontend: tidied.name === 'FRONTEND',
// });
// }
// });

@ -0,0 +1,239 @@
import exclusions from "./data/exclude.json" assert { type: "json" };
import * as fs from "fs";
import { exec } from "child_process";
import { parseString } from "xml2js";
import {
SVNList,
ExternalComponent,
SVNProperties,
DirType,
InternalComponent,
} from "./types.js";
import { parseExternals } from "./parser.js";
function execShellCommand(cmd: string) {
return new Promise((resolve) => {
exec(cmd, { maxBuffer: 1024 * 500 }, (error, stdout, stderr) => {
if (error) {
console.warn(error);
}
resolve(stdout || stderr);
});
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function svnCmdWithResponse(
cmd: string,
baseUrl: string,
url: string,
returnRaw = false
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> {
return new Promise((resolve, reject) => {
const execCommand = `svn ${cmd} "${baseUrl}${url}" --xml`;
execShellCommand(execCommand)
.then((svnCmdResponse) => {
parseString(
svnCmdResponse as SVNList | SVNProperties,
(err, result) => {
if (err) {
reject(err);
return;
}
if (returnRaw) {
resolve(result);
} else {
const json = JSON.stringify(result);
const svnCmdResponseJson = JSON.parse(json);
resolve(svnCmdResponseJson);
}
}
);
})
.catch((error) => {
reject(error);
});
});
}
export async function svnList(
baseUrl: string,
url: string
): Promise<InternalComponent[]> {
try {
const svnListResponse: InternalComponent[] = await svnCmdWithResponse(
"list",
baseUrl,
url,
false
);
type arrayOfSVNList = {
name: string[];
};
const internals = svnListResponse.lists.list[0].entry.map(
({ name }: arrayOfSVNList) => `${name[0]}`
);
const excludeJson = fs.readFileSync("./dist/data/exclude.json", "utf-8");
const exclude = JSON.parse(excludeJson);
// const parsedExclusions = exclusions;
const filteredInternals = internals.filter(
(internal: string) => !exclusions.includes(internal)
);
// const internals = listResponse.lists.list[0].entry;
return filteredInternals;
} catch (error) {
console.log(error);
return [];
}
}
async function svnCmdWithoutResponse(
cmd: string,
localPath: string
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> {
return new Promise((resolve, reject) => {
const execCommand = `svn ${cmd} "${localPath}"`;
execShellCommand(execCommand)
.then((svnCmdResponse) => {
console.log(`Performed ${execCommand}`);
resolve(svnCmdResponse);
})
.catch((error) => {
reject(error);
});
});
}
export async function svnUpdate(localPath: string): Promise<void> {
try {
await svnCmdWithoutResponse("cleanup", localPath);
} catch (error) {
console.log(error);
}
try {
await svnCmdWithoutResponse("update", localPath);
} catch (error) {
console.log(error);
}
}
export async function svnPropGet(
property: string,
baseUrl: string,
url: string
): Promise<[ExternalComponent]> {
const propGetResponse = await svnCmdWithResponse(
`propget ${property}`,
baseUrl,
url,
true
);
const rawExternals: string =
propGetResponse.properties.target[0].property[0]._;
return parseExternals(rawExternals);
}
export async function svnTagsBranchesList(
dirType: DirType,
baseUrl: string,
url: string, // expects url that has tags and branches
latestOnly = false
): Promise<string[]> {
try {
url = url.replace(/trunk$/, "");
url = url.replace(/tags$/, "");
url = url.replace(/branches$/, "");
url = dirType === "tags" ? url.concat("/tags") : url.concat("/branches");
const svnListResponse: SVNList = await svnCmdWithResponse(
"list",
baseUrl,
url
);
const regex = /^[0-9.]+$/; // Regular expression for semantic version format
type arrayOfSVNList = {
name: string[];
};
if (
Object.prototype.hasOwnProperty.call(
svnListResponse.lists.list[0],
"entry"
)
) {
// filter any tag or branch version which do not comply with the format 0.0.0 / 0.0.0.0
const filteredTags = svnListResponse.lists.list[0].entry.filter(
(entry: arrayOfSVNList) => {
return regex.test(entry.name[0]);
}
);
// only leave the name in the objects, get rid of the hyrachical structure
let flattenedFilteredTags: string[] = filteredTags.map(
({ name }) => `${name[0]}`
);
flattenedFilteredTags.sort((a, b) => {
const partsA = a.split(".").map(Number);
const partsB = b.split(".").map(Number);
for (let i = 0; i < Math.max(partsA.length, partsB.length); i++) {
const partA = partsA[i] || 0;
const partB = partsB[i] || 0;
if (partA > partB) {
return -1;
} else if (partA < partB) {
return 1;
}
}
return 0;
});
flattenedFilteredTags.sort((a, b) => b.localeCompare(a));
flattenedFilteredTags = flattenedFilteredTags.map(
(element) => (element = `/${dirType}/${element}`)
);
if (latestOnly) {
return [flattenedFilteredTags[0]];
} else {
return flattenedFilteredTags;
}
}
} catch (error) {
console.log(`${url} does not have a ${dirType}: ${error}`);
return [];
}
}
export async function svnGetLatestTag(
baseUrl: string,
url: string
): Promise<string[]> {
return svnTagsBranchesList(DirType.tags, baseUrl, url, true);
}
export async function svnGetLatestBranch(
baseUrl: string,
url: string
): Promise<string[]> {
return svnTagsBranchesList(DirType.branches, baseUrl, url, true);
}
export async function svnGetTagList(
baseUrl: string,
url: string
): Promise<string[]> {
return svnTagsBranchesList(DirType.tags, baseUrl, url, false);
}
export async function svnGetBranchesList(
baseUrl: string,
url: string
): Promise<string[]> {
return svnTagsBranchesList(DirType.branches, baseUrl, url, false);
}

@ -0,0 +1,92 @@
import { ExternalComponentResource } from "./ExternalComponentResource";
export type SVNProperties = {
properties: {
target: {
$: {
path: string;
};
property?: {
_: string;
$: {
name: string;
};
}[];
}[];
};
};
export type SVNList = {
lists: {
list: {
$: {
path: string;
};
entry: {
$: {
kind: string;
};
name: string[];
commit: {
$: {
revision: string;
};
author: string[];
date: string[];
}[];
}[];
}[];
};
};
export type ExternalComponent = {
original: string;
key: string;
path: string;
version: string;
};
export type InternalComponent = {
original: string;
key: string;
path: string;
version: string;
};
export type ExternalResourceUpdate = {
hasUpdate: boolean;
toVersion?: ExternalComponentResource;
};
export type SemVerIncrementType = "minor" | "major" | "patch";
export enum DirType {
tags = "tags",
branches = "branches",
trunk = "trunk",
}
export type TypeSolutionImplementation = {
name: string;
functionalName: string;
customer: string;
customerCode: string;
path: string;
class: string;
baseUrl: string;
url: string;
selected: boolean;
};
export type ApiExternalsResponse = {
target: {
$: {
path: string;
};
property: {
_: string;
$: {
name: string;
};
};
};
};

@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@ -39,7 +39,7 @@
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
"resolveJsonModule": true /* Enable importing .json files. */,
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
@ -84,8 +84,8 @@
/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
"strictNullChecks": false /* When type checking, take into account 'null' and 'undefined'. */,
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictNullChecks": false /* When type checking, take into account 'null' and 'undefined'. */,
"strictFunctionTypes": false /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */

@ -1 +0,0 @@
declare module "node-svn-ultimate";
Loading…
Cancel
Save

Powered by TurnKey Linux.