@o3r/artifactory-tools 10.0.0-alpha.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.
Files changed (39) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +124 -0
  3. package/collection.json +11 -0
  4. package/package.json +134 -0
  5. package/schematics/ng-add/index.d.ts +8 -0
  6. package/schematics/ng-add/index.d.ts.map +1 -0
  7. package/schematics/ng-add/index.js +15 -0
  8. package/schematics/ng-add/schema.d.ts +5 -0
  9. package/schematics/ng-add/schema.d.ts.map +1 -0
  10. package/schematics/ng-add/schema.js +3 -0
  11. package/schematics/ng-add/schema.json +18 -0
  12. package/src/cli/artifact-cleaner.d.ts +3 -0
  13. package/src/cli/artifact-cleaner.d.ts.map +1 -0
  14. package/src/cli/artifact-cleaner.js +69 -0
  15. package/src/cli/artifact-cleaner.js.map +1 -0
  16. package/src/cli/artifact-retriever.d.ts +3 -0
  17. package/src/cli/artifact-retriever.d.ts.map +1 -0
  18. package/src/cli/artifact-retriever.js +223 -0
  19. package/src/cli/artifact-retriever.js.map +1 -0
  20. package/src/cli/pr-artifact-cleaner.d.ts +3 -0
  21. package/src/cli/pr-artifact-cleaner.d.ts.map +1 -0
  22. package/src/cli/pr-artifact-cleaner.js +176 -0
  23. package/src/cli/pr-artifact-cleaner.js.map +1 -0
  24. package/src/helpers/gavc-response/gavc-response.interfaces.d.ts +47 -0
  25. package/src/helpers/gavc-response/gavc-response.interfaces.d.ts.map +1 -0
  26. package/src/helpers/gavc-response/gavc-response.interfaces.js +2 -0
  27. package/src/helpers/gavc-response/gavc-response.interfaces.js.map +1 -0
  28. package/src/helpers/gavc-response/index.d.ts +2 -0
  29. package/src/helpers/gavc-response/index.d.ts.map +1 -0
  30. package/src/helpers/gavc-response/index.js +2 -0
  31. package/src/helpers/gavc-response/index.js.map +1 -0
  32. package/src/helpers/index.d.ts +2 -0
  33. package/src/helpers/index.d.ts.map +1 -0
  34. package/src/helpers/index.js +2 -0
  35. package/src/helpers/index.js.map +1 -0
  36. package/src/public_api.d.ts +2 -0
  37. package/src/public_api.d.ts.map +1 -0
  38. package/src/public_api.js +2 -0
  39. package/src/public_api.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright Amadeus SAS
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ <h1 align="center">Artifactory tools</h1>
2
+ <p align="center">
3
+ <img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
4
+ </p>
5
+
6
+ ## Description
7
+
8
+ Various artifactory tools
9
+
10
+ ## Artifact Retriever
11
+
12
+ ### Usage
13
+
14
+ ```shell
15
+ Usage: o3r-artifact-retriever [options]
16
+
17
+ Gets an artifact from Artifactory: artifact-group, artifact-name and artifact-version are mandatory
18
+
19
+ Options:
20
+
21
+ --registry <url> Registry URL. It is ignored for Azure Artifacts.
22
+ --repository-manager <manager> Artifact repository manager. Supported managers are JFrog, Azure Artifacts (default: JFrog)
23
+ --organization <organization> Azure Artifacts organization
24
+ --project <project> Azure Artifacts project
25
+ --feed <feed> Azure Artifacts feed
26
+ -a, --artifact-name <version> Artifact name
27
+ -v, --artifact-version <version> Artifact version
28
+ -g, --artifact-group <group> Artifact group name
29
+ -r, --artifact-repos <repositories> Artifact repositories (default: )
30
+ -u, --username <username> Artifactory username (default from ARTIFACTORY_USERNAME)
31
+ -p, --password <password> Artifactory user password (default from ARTIFACTORY_PASSWORD)
32
+ -o, --out <path> Output file name (default: ./built/${name}.jar)
33
+ --use-package-version Use the package version as artifact version
34
+ -h, --help output usage information
35
+ ```
36
+
37
+ > **Info**: *password* and *username* options can be provided via Environment variables.
38
+
39
+ ### JFrog Example
40
+
41
+ ```shell
42
+ artifact-retriever.js --registry "https://jfrog.io/repoName" -u <username> -p <password> -v "1.0.0" -g "io.swagger" -a "typescriptFetch-swagger-codegen" --out /path/to/typescriptFetch-swagger-codegen.jar
43
+ ```
44
+
45
+ ### Azure Artifacts Example
46
+
47
+ ```shell
48
+ artifact-retriever.js --repository-manager "Azure Artifacts" --organization "AmadeusDigitalAirline" --project "Otter" --feed "otter" -u <username> -p <password> -v "1.0.0" -g "io.swagger" -a "typescriptFetch-swagger-codegen" --out /path/to/typescriptFetch-swagger-codegen.jar
49
+ ```
50
+
51
+ ## Dependency Validator
52
+
53
+ Validator of dependencies.
54
+ The purpose is to check if the update is not breaking the application using the current package.
55
+
56
+ ### Usage
57
+
58
+ ```shell
59
+ Usage: dep-validator [options] <gitUrl>
60
+
61
+ Execute dependency tests
62
+
63
+
64
+ Options:
65
+
66
+ -u, --username <username> Git username
67
+ -p, --password <password> Git user password
68
+ -w, --workspace <path> Path to the folder containing the repository to clone
69
+ --workspace-project <path> Path to the project root folder inside the workspace
70
+ -b, --build <tasks> Tasks to run to build the dependency
71
+ -t, --test <tasks> Tasks to run to test the dependency
72
+ -P, --project <path> Project root path
73
+ --include <packages> Packages to include in the process
74
+ --exclude <packages> Packages to exclude from the process
75
+ --no-lerna Disable lerna file parsing
76
+ --no-trustedVersionNumber Determine if the version number is trusted (used for version number generated in Pull Request)
77
+ ```
78
+
79
+ ## Artifact cleaner
80
+
81
+ Cleans old artifacts from artifactory repositories
82
+
83
+ ### Usage
84
+
85
+ ```shell
86
+ Usage: o3r-artifact-cleaner -b <Base 64 encoding of username:password (password already encrypted from artifactory UI)> [options]
87
+
88
+ Cleans old artifacts from artifactory repositories, base 64 encoding of username:password is mandatory
89
+
90
+ Options:
91
+
92
+ --artifactory-url <artifactoryUrl> Artifact URL (Required)
93
+ -a, --duration-kept <durationKept> All the artifact which have been created since more time than this value(ms) will be deleted (Default to 10080000ms (i.e. 7 days))
94
+ -r, --repositories <repositories> Artifact repositories to clean up (coma separated) ex : npm-otter-pr,npm-refx-pr (Default to npm-otter-pr)
95
+ -t, --type-filter <typeFilter> List of artifact type that should be deleted coma separated (ex: jar,tgz) (Default : tgz)
96
+ --dry-run <dryRun> List all files that should be deleted without actually deleting them. (Default to false)
97
+ -h, --help Output usage information
98
+
99
+ Example : yarn o3r-artifact-cleaner -b thisismybase64tokenwithuserandencryptedpassword
100
+ ```
101
+
102
+ ## PR Artifact cleaner
103
+
104
+ Cleans old PR artifacts by identifying using the the build version that is present in the path. If build version is not present in the path this tool cannot yet be used.
105
+
106
+ ### Usage
107
+
108
+ ```shell
109
+ Usage: o3r-pr-artifact-cleaner -b <Base 64 encoding of username:password (password already encrypted from artifactory UI)> [options]
110
+
111
+ Cleans old artifacts from artifactory repositories, base 64 encoding of username:password is mandatory
112
+
113
+ Options:
114
+
115
+ -u, --artifactory-url <artifactoryUrl> Artifact URL
116
+ -d, --duration-kept <durationKept> Only artifacts which are older than this value (in days) will be deleted. (Default to 1 day)
117
+ -r, --repository <repository> Artifact repository to clean up. (Default to dga-maven-built-adt-nce)
118
+ -pr, --pr-versions <prVersions> Number of pr versions that will be kept. (Default to 2 last versions)
119
+ --dry-run <dryRun> List all files that should be deleted without actually deleting them. (Default to false)
120
+ -p, --path <path> Artifact paths to cleanup use matcher from AQL language. Be careful that the path do not include release artifacts (Default to com/amadeus/retailing/*-PR-*)
121
+ -h, --help Output usage information
122
+
123
+ Example : yarn o3r-pr-artifact-cleaner -b thisismybase64tokenwithuserandencryptedpassword
124
+ ```
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/angular/angular-cli/main/packages/angular_devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add Otter Artifactory tools to the project.",
6
+ "factory": "./schematics/ng-add/index#ngAdd",
7
+ "schema": "./schematics/ng-add/schema.json",
8
+ "aliases": ["install", "i"]
9
+ }
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,134 @@
1
+ {
2
+ "name": "@o3r/artifactory-tools",
3
+ "version": "10.0.0-alpha.1",
4
+ "description": "Various artifactory tools",
5
+ "keywords": [
6
+ "otter",
7
+ "otter-module"
8
+ ],
9
+ "scripts": {
10
+ "nx": "nx",
11
+ "ng": "yarn nx",
12
+ "build": "yarn nx build artifactory-tools",
13
+ "postbuild": "patch-package-json-main",
14
+ "prepare:publish": "prepare-publish ./dist",
15
+ "prepare:build:builders": "yarn cpy 'schematics/**/*.json' dist/schematics && yarn cpy 'collection.json' dist",
16
+ "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest"
17
+ },
18
+ "bin": {
19
+ "o3r-artifact-cleaner": "src/cli/artifact-cleaner.js",
20
+ "o3r-artifact-retriever": "src/cli/artifact-retriever.js",
21
+ "o3r-pr-artifact-cleaner": "src/cli/pr-artifact-cleaner.js"
22
+ },
23
+ "dependencies": {
24
+ "commander": "^11.0.0",
25
+ "fs-extra": "^11.0.0",
26
+ "request": "^2.88.0",
27
+ "request-promise-native": "^1.0.9",
28
+ "tslib": "^2.5.3",
29
+ "winston": "^3.8.2"
30
+ },
31
+ "devDependencies": {
32
+ "@angular-devkit/core": "~17.0.3",
33
+ "@angular-devkit/schematics": "~17.0.3",
34
+ "@angular-eslint/eslint-plugin": "~17.1.0",
35
+ "@babel/core": "~7.23.0",
36
+ "@babel/preset-typescript": "~7.23.0",
37
+ "@compodoc/compodoc": "^1.1.19",
38
+ "@nx/eslint-plugin": "~17.1.1",
39
+ "@nx/jest": "~17.1.1",
40
+ "@o3r/build-helpers": "^10.0.0-alpha.1",
41
+ "@o3r/eslint-plugin": "^10.0.0-alpha.1",
42
+ "@types/fs-extra": "^11.0.0",
43
+ "@types/jest": "~29.5.2",
44
+ "@types/node": "^20.0.0",
45
+ "@types/request": "^2.48.7",
46
+ "@types/request-promise-native": "^1.0.18",
47
+ "@typescript-eslint/eslint-plugin": "6.11.0",
48
+ "@typescript-eslint/parser": "^6.11.0",
49
+ "cpy-cli": "^5.0.0",
50
+ "eslint": "^8.42.0",
51
+ "eslint-import-resolver-node": "^0.3.4",
52
+ "eslint-plugin-jest": "~27.6.0",
53
+ "eslint-plugin-jsdoc": "~48.0.0",
54
+ "eslint-plugin-prefer-arrow": "~1.2.3",
55
+ "eslint-plugin-unicorn": "^50.0.0",
56
+ "jest": "~29.7.0",
57
+ "jest-junit": "~16.0.0",
58
+ "nx": "~17.1.1",
59
+ "ts-jest": "~29.1.1",
60
+ "typescript": "~5.2.2"
61
+ },
62
+ "engines": {
63
+ "node": ">=16.0.0"
64
+ },
65
+ "schematics": "./collection.json",
66
+ "module": "./src/public_api.js",
67
+ "type": "module",
68
+ "main": "./src/public_api.js",
69
+ "contributors": [
70
+ {
71
+ "name": "Yannick Adam",
72
+ "url": "https://github.com/yannickadam",
73
+ "email": "yannickadam@users.noreply.github.com"
74
+ },
75
+ {
76
+ "name": "Kilian Panot",
77
+ "url": "https://github.com/kpanot",
78
+ "email": "kpanot@users.noreply.github.com"
79
+ },
80
+ {
81
+ "name": "Jeremy Bourgeois",
82
+ "url": "https://github.com/jbourgeois-1A",
83
+ "email": "jbourgeois-1A@users.noreply.github.com"
84
+ },
85
+ {
86
+ "name": "Pierre Henri Ginoux",
87
+ "url": "https://github.com/pginoux-1A",
88
+ "email": "pginoux-1A@users.noreply.github.com"
89
+ },
90
+ {
91
+ "name": "Mircea Vasile Rednic",
92
+ "url": "https://github.com/mrednic-1A",
93
+ "email": "mrednic-1A@users.noreply.github.com"
94
+ },
95
+ {
96
+ "name": "Stephane Dalle",
97
+ "email": "sdalle-1A@users.noreply.github.com"
98
+ },
99
+ {
100
+ "name": "Nicolas Hoffmann",
101
+ "url": "https://github.com/nhoffmann-1A",
102
+ "email": "nhoffmann-1A@users.noreply.github.com"
103
+ },
104
+ {
105
+ "name": "Victor Scaiceanu",
106
+ "url": "https://github.com/vscaiceanu-1a",
107
+ "email": "vscaiceanu-1A@users.noreply.github.com"
108
+ },
109
+ {
110
+ "name": "Florian Paul",
111
+ "url": "https://github.com/fpaul-1A",
112
+ "email": "fpaul-1A@users.noreply.github.com"
113
+ },
114
+ {
115
+ "name": "Corinne Paulve",
116
+ "url": "https://github.com/cpaulve-1A",
117
+ "email": "cpaulve-1A@users.noreply.github.com"
118
+ },
119
+ {
120
+ "name": "Matthieu Crouzet",
121
+ "url": "https://github.com/matthieu-crouzet",
122
+ "email": "matthieu-crouzet@users.noreply.github.com"
123
+ },
124
+ {
125
+ "name": "Salome Do",
126
+ "url": "https://github.com/sdo-1A",
127
+ "email": "sdo-1A@users.noreply.github.com"
128
+ }
129
+ ],
130
+ "bugs": "https://github.com/AmadeusITGroup/otter/issues",
131
+ "repository": "https://github.com/AmadeusITGroup/otter",
132
+ "license": "BSD-3-Clause",
133
+ "homepage": "https://amadeusitgroup.github.io/otter/"
134
+ }
@@ -0,0 +1,8 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Add Otter artifactory-tools to an Angular Project
4
+ *
5
+ * @param options
6
+ */
7
+ export declare function ngAdd(): Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAG5B"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ /**
6
+ * Add Otter artifactory-tools to an Angular Project
7
+ *
8
+ * @param options
9
+ */
10
+ function ngAdd() {
11
+ /* ng add rules */
12
+ return (0, schematics_1.noop)();
13
+ }
14
+ exports.ngAdd = ngAdd;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ export interface NgAddSchematicsSchema {
2
+ /** Project name */
3
+ projectName?: string | undefined;
4
+ }
5
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "ngAddSchematicsSchema",
4
+ "title": "Add Otter Artifactory tools ",
5
+ "description": "ngAdd Otter Artifactory tools ",
6
+ "properties": {
7
+ "projectName": {
8
+ "type": "string",
9
+ "description": "Project name",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ },
15
+ "additionalProperties": false,
16
+ "required": [
17
+ ]
18
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=artifact-cleaner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-cleaner.d.ts","sourceRoot":"","sources":["../../../src/cli/artifact-cleaner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import * as request from 'request-promise-native';
4
+ import * as winston from 'winston';
5
+ program
6
+ .description('Clean old artifacts from artifactory repositories')
7
+ .requiredOption('--artifactory-url <artifactoryUrl>', 'Artifactory URL')
8
+ .option('-d, --duration-kept <durationKept>', 'All artifacts which have not been downloaded and are older than this value(ms) will be deleted. Default to 10080000ms (7 days)', '604800000')
9
+ .option('-r, --repositories <repositories>', 'Artifact repositories to clean up (coma separated) ex : npm-otter-pr,npm-refx-pr (Default to npm-otter-pr)', (repos) => repos.split(','), ['npm-otter-pr'])
10
+ .option('-t, --type-filter <typeFilter>', 'List of artifact type that should be deleted coma separated (ex: jar,tgz) (Default : tgz)', (type) => type.split(','), ['tgz,json'])
11
+ .option('--dry-run <dryRun>', 'List all files that should be deleted without actually deleting them', false)
12
+ .option('-b, --basicAuth <basicAuth>', 'Base 64 encoding of username:password (password already encrypted from artifactory UI)')
13
+ .parse(process.argv);
14
+ const opts = program.opts();
15
+ const logger = winston.createLogger({
16
+ level: opts.verbose ? 'debug' : 'info',
17
+ format: winston.format.simple(),
18
+ transports: new winston.transports.Console()
19
+ });
20
+ /**
21
+ * Returns true if the url match one of the artifact types
22
+ * @param fullUrl
23
+ * @param types
24
+ */
25
+ const matchFilter = (fullUrl, types) => {
26
+ for (const type of types) {
27
+ if (fullUrl.endsWith(type)) {
28
+ return true;
29
+ }
30
+ }
31
+ logger.info(`${fullUrl} dropped because it doesn't match any of the patterns`);
32
+ return false;
33
+ };
34
+ if (!opts.basicAuth) {
35
+ logger.error('Authentication is mandatory, please specify a base 64 encoded user:password');
36
+ process.exit(1);
37
+ }
38
+ let url = opts.artifactoryUrl;
39
+ const options = {
40
+ headers: {
41
+ // eslint-disable-next-line @typescript-eslint/naming-convention
42
+ Authorization: 'Basic ' + opts.basicAuth
43
+ }
44
+ };
45
+ const limitTimestampToKeepOldArtifact = Date.now() - opts.durationKept;
46
+ url += (url.endsWith('/') ? '' : '/') +
47
+ `api/search/usage?notUsedSince=${limitTimestampToKeepOldArtifact}&createdBefore=${limitTimestampToKeepOldArtifact}&repos=${opts.repositories.join(',')}`;
48
+ logger.info(`Url called : ${url}`);
49
+ void (async () => {
50
+ logger.info(`Requesting old artifacts using ${url}`);
51
+ const responseSearch = await request.get(url, options).promise().catch((e) => {
52
+ logger.warn('No result found ', e);
53
+ process.exit(0);
54
+ });
55
+ const responseSearchObj = JSON.parse(responseSearch);
56
+ /** uris will contain the list of all artifacts that need to be deleted */
57
+ const uris = responseSearchObj.results
58
+ .map((res) => res.uri)
59
+ .filter((uri) => matchFilter(uri, opts.typeFilter))
60
+ .map((uri) => uri.replace('/api/storage', ''));
61
+ for (const uri of uris) {
62
+ logger.info(`Deleting ${uri}...`);
63
+ if (!opts.dryRun) {
64
+ const response = await request.delete(uri, options).promise();
65
+ logger.info(response);
66
+ }
67
+ }
68
+ })();
69
+ //# sourceMappingURL=artifact-cleaner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-cleaner.js","sourceRoot":"","sources":["../../../src/cli/artifact-cleaner.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM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AC,OAAO;SACnC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;SACrB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvB;KACF;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=artifact-retriever.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-retriever.d.ts","sourceRoot":"","sources":["../../../src/cli/artifact-retriever.ts"],"names":[],"mappings":""}
@@ -0,0 +1,223 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import * as fse from 'fs-extra';
4
+ import * as http from 'node:http';
5
+ import * as https from 'node:https';
6
+ import * as fs from 'node:fs';
7
+ import * as path from 'node:path';
8
+ import * as request from 'request-promise-native';
9
+ import * as winston from 'winston';
10
+ const SUPPORTED_REPOSITORY_MANAGERS = ['JFrog', 'Azure Artifacts'];
11
+ program
12
+ .description('Get an artifact from an Artifact repository manager')
13
+ .requiredOption('--registry <url>', 'Registry URL. It is ignored for Azure Artifacts.')
14
+ .option('--repository-manager <manager>', `Artifact repository manager. Supported managers are ${SUPPORTED_REPOSITORY_MANAGERS.join(', ')}`, 'JFrog')
15
+ .option('--organization <organization>', 'Azure Artifacts organization', undefined)
16
+ .option('--project <project>', 'Azure Artifacts project', undefined)
17
+ .option('--feed <feed>', 'Azure Artifacts feed', undefined)
18
+ .option('-a, --artifact-name <name>', 'Artifact name', undefined)
19
+ .option('-v, --artifact-version <version>', 'Artifact version', undefined)
20
+ .option('-g, --artifact-group-id <group>', 'Artifact group id', undefined)
21
+ .option('-r, --artifact-repos <repositories>', 'Artifact repositories', (repos) => repos.split(','), [])
22
+ .option('-u, --username <username>', 'Artifactory username', 'mvn-readonly')
23
+ .option('-p, --password <password>', 'Artifactory user password')
24
+ .option('--password_env_var <password_env_var>', 'Artifactory user password environment var', undefined)
25
+ .option('-o, --out <path>', 'Output file name (default: ./built/${name}.jar)', undefined)
26
+ .option('--silent', 'Prevent exit code 1 if artifact not found (Usage example : dep-checker with post-install scripts', false)
27
+ .option('--verbose', 'Display debug log message')
28
+ .option('--use-package-version', 'Use the package version as artifact version')
29
+ .parse(process.argv);
30
+ const opts = program.opts();
31
+ const logger = winston.createLogger({
32
+ level: opts.verbose ? 'debug' : 'info',
33
+ format: winston.format.simple(),
34
+ transports: new winston.transports.Console()
35
+ });
36
+ if (!SUPPORTED_REPOSITORY_MANAGERS.includes(opts.repositoryManager)) {
37
+ logger.error(`Unsupported repository manager: ${opts.repositoryManager}`);
38
+ process.exit(10);
39
+ }
40
+ if (opts.repositoryManager === 'Azure Artifacts') {
41
+ if (!opts.organization) {
42
+ logger.error('No organization specified for Azure Artifacts');
43
+ process.exit(11);
44
+ }
45
+ if (!opts.project) {
46
+ logger.error('No project specified for Azure Artifacts');
47
+ process.exit(12);
48
+ }
49
+ if (!opts.feed) {
50
+ logger.error('No feed specified for Azure Artifacts');
51
+ process.exit(13);
52
+ }
53
+ }
54
+ if (!opts.artifactVersion && !opts.usePackageVersion) {
55
+ logger.error('No version specified');
56
+ process.exit(14);
57
+ }
58
+ if (!opts.artifactName) {
59
+ logger.error('No artifact name specified');
60
+ process.exit(15);
61
+ }
62
+ if (!opts.artifactGroupId) {
63
+ logger.error('No group id specified');
64
+ process.exit(16);
65
+ }
66
+ let url = opts.registry;
67
+ const jar = request.jar();
68
+ const options = { jar };
69
+ const password = opts.password || opts.password_env_var && process.env[opts.password_env_var];
70
+ if (opts.username && password) {
71
+ options.headers = {
72
+ // eslint-disable-next-line @typescript-eslint/naming-convention
73
+ Authorization: 'Basic ' + Buffer.from(`${opts.username}:${password}`).toString('base64')
74
+ };
75
+ }
76
+ const name = opts.artifactName;
77
+ const artifactGroupId = opts.artifactGroupId;
78
+ let version = opts.usePackageVersion ? require(path.resolve(process.cwd(), 'package.json')).version : opts.artifactVersion;
79
+ const filePath = opts.out || `./built/${name}.jar`;
80
+ fse.ensureDirSync(path.resolve(process.cwd(), path.dirname(filePath)));
81
+ /**
82
+ * Report error on artifact downloading
83
+ * @param e
84
+ */
85
+ const reportError = (e) => {
86
+ logger.error(e);
87
+ };
88
+ /**
89
+ * Download the specified Artifact on JFrog
90
+ */
91
+ async function retrieveArtifactFromJFrog() {
92
+ logger.info(`Searching for ${name}@${version}`);
93
+ url += (url.endsWith('/') ? '' : '/') + `api/search/gavc?a=${name}&g=${artifactGroupId}`;
94
+ if (opts.artifactRepos && opts.artifactRepos.length) {
95
+ url += `&repos=${opts.artifactRepos.join(',')}`;
96
+ }
97
+ if (version.startsWith('0.0.0')) {
98
+ url += `&v=${version}`;
99
+ }
100
+ let responseSearch;
101
+ try {
102
+ responseSearch = await request.get(url, options).promise();
103
+ }
104
+ catch (err) {
105
+ logger.warn('First call to get artifact information failed, retries');
106
+ responseSearch = await request.get(url, options).promise();
107
+ }
108
+ // eslint-disable-next-line no-console
109
+ console.log(responseSearch);
110
+ const responseSearchObj = JSON.parse(responseSearch);
111
+ const uris = responseSearchObj.results
112
+ .map((res) => res.uri)
113
+ .filter((uri) => uri.endsWith('.jar'))
114
+ .sort((a, b) => {
115
+ if (a > b) {
116
+ return -1;
117
+ }
118
+ else if (a < b) {
119
+ return 1;
120
+ }
121
+ return 0;
122
+ });
123
+ if (uris.length) {
124
+ const artifactUrl = uris[0];
125
+ logger.info(`Call to ${artifactUrl}`);
126
+ const gavcResponse = await request.get(artifactUrl, options).promise();
127
+ logger.debug(`GavcResponse : ${gavcResponse}`);
128
+ const parsedGavcResponse = JSON.parse(gavcResponse);
129
+ const downloadUri = parsedGavcResponse.downloadUri;
130
+ logger.info(`Downloading artifact ${downloadUri}`);
131
+ const file = fs.createWriteStream(path.resolve(process.cwd(), filePath));
132
+ file.on('error', reportError);
133
+ const cookieString = jar.getCookieString(url);
134
+ const httpOptions = { headers: options.headers ? { ...options.headers, cookie: cookieString } : undefined };
135
+ if (artifactUrl.startsWith('https')) {
136
+ https.get(downloadUri, httpOptions, (response) => response.pipe(file)).on('error', reportError);
137
+ }
138
+ else {
139
+ http.get(downloadUri, httpOptions, (response) => response.pipe(file)).on('error', reportError);
140
+ }
141
+ }
142
+ else {
143
+ if (opts.silent) {
144
+ logger.warn('No artifact found, silent mode ON, prevented the failure');
145
+ }
146
+ else {
147
+ logger.error('No artifact found');
148
+ process.exit(2);
149
+ }
150
+ }
151
+ }
152
+ /**
153
+ * Get the latest version, if it exists, of the specified artifact
154
+ * @param packages Array of packages from the Azure feed
155
+ * @param artifactName Name of the artifact to get the latest version from
156
+ */
157
+ function getLatestVersion(packages, artifactName) {
158
+ const normalizedArtifactName = `${artifactGroupId}:${artifactName}`.toLowerCase();
159
+ for (const pckg of packages) {
160
+ if (pckg.normalizedName === artifactName || pckg.normalizedName === normalizedArtifactName) {
161
+ const latestVersion = pckg.versions.find(v => v.isLatest);
162
+ if (!latestVersion) {
163
+ throw new Error(`No latest version found for ${artifactName}`);
164
+ }
165
+ return latestVersion.version;
166
+ }
167
+ }
168
+ throw new Error(`No package ${artifactName} found`);
169
+ }
170
+ /**
171
+ * Download the specified Artifact on Azure
172
+ */
173
+ async function retrieveArtifactFromAzure() {
174
+ try {
175
+ if (version.startsWith('0.0.0')) {
176
+ // eslint-disable-next-line max-len
177
+ const res = await request.get(`https://feeds.dev.azure.com/${opts.organization}/${opts.project}/_apis/packaging/feeds/${opts.feed}/packages?api-version=6.0-preview.1`, options).promise();
178
+ version = getLatestVersion(JSON.parse(res).value, name);
179
+ }
180
+ logger.info(`Searching for ${name}@${version}`);
181
+ // eslint-disable-next-line max-len
182
+ url = `https://pkgs.dev.azure.com/${opts.organization}/${opts.project}/_apis/packaging/feeds/${opts.feed}/maven/${opts.artifactGroupId}/${name}/${version}/${name}-${version}.jar/content?api-version=6.0-preview.1`;
183
+ logger.info(`Call to ${url}`);
184
+ const downloadUri = await new Promise((resolve, reject) => {
185
+ https.get(url, options, (response) => resolve(response.headers.location)).on('error', reject);
186
+ });
187
+ if (!downloadUri) {
188
+ throw new Error(`Could not get the download url for the artifact ${name}`);
189
+ }
190
+ logger.info(`Downloading artifact ${downloadUri}`);
191
+ const file = fs.createWriteStream(path.resolve(process.cwd(), filePath));
192
+ file.on('error', reportError);
193
+ if (!downloadUri.startsWith('https')) {
194
+ throw new Error('Artifact must be downloaded using https protocol');
195
+ }
196
+ https.get(downloadUri, (response) => response.pipe(file)).on('error', reportError);
197
+ }
198
+ catch (e) {
199
+ if (opts.silent) {
200
+ logger.warn(e);
201
+ }
202
+ else {
203
+ logger.error(e);
204
+ process.exit(3);
205
+ }
206
+ }
207
+ }
208
+ /**
209
+ * Download an artifact on the specified artifact repository manager
210
+ * @param registry Registry url
211
+ */
212
+ function retrieveArtifact() {
213
+ switch (opts.repositoryManager) {
214
+ case 'JFrog': {
215
+ return retrieveArtifactFromJFrog();
216
+ }
217
+ case 'Azure Artifacts': {
218
+ return retrieveArtifactFromAzure();
219
+ }
220
+ }
221
+ }
222
+ void retrieveArtifact();
223
+ //# sourceMappingURL=artifact-retriever.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-retriever.js","sourceRoot":"","sources":["../../../src/cli/artifact-retriever.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAA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,CAAC;SACpC;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO,yBAAyB,EAAE,CAAC;SACpC;KACF;AACH,CAAC;AACD,KAAK,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=pr-artifact-cleaner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-artifact-cleaner.d.ts","sourceRoot":"","sources":["../../../src/cli/pr-artifact-cleaner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import * as request from 'request-promise-native';
4
+ import * as winston from 'winston';
5
+ program
6
+ .description('Clean pr artifacts from artifactory repositories')
7
+ .requiredOption('-u, --artifactory-url <artifactoryUrl>', 'Artifactory URL')
8
+ .option('-d, --duration-kept <numberOfDays>', 'Only artifacts which are older and have not been downloaded during this duration (in days) will be deleted.', (v) => +v, 1)
9
+ .option('-pr, --pr-versions <prVersions>', 'Number of pr versions that will be kept.', (v) => +v, 1)
10
+ .option('-r, --repository <repositoryName>', 'Artifact repository to clean up.', 'dga-maven-built-adt-nce')
11
+ .option('-p, --path <path>', 'Artifact paths to cleanup use matcher from AQL language. Be careful that the path do not include release artifacts.', 'com/amadeus/retailing/*-PR-*')
12
+ .option('--dry-run', 'List all files that should be deleted without actually deleting them')
13
+ .option('-a, --api-key <apiKey>', 'Artifactory API Key of the user that can be used to log in')
14
+ .option('-b, --basicAuth <base64>', 'Base 64 encoding of username:password (password already encrypted from artifactory UI)')
15
+ .option('-v, --verbose', 'To display the executed AQL query')
16
+ .parse(process.argv);
17
+ const programOptions = program.opts();
18
+ const winstonOptions = {
19
+ console: {
20
+ format: winston.format.combine(winston.format.prettyPrint(), winston.format.splat(), winston.format.printf((info) => {
21
+ if (typeof info.message === 'object') {
22
+ info.message = JSON.stringify(info.message, null, 3);
23
+ }
24
+ return info.message;
25
+ }))
26
+ }
27
+ };
28
+ const logger = winston.createLogger({
29
+ level: programOptions.verbose ? 'debug' : 'info',
30
+ format: winston.format.simple(),
31
+ transports: [
32
+ new winston.transports.Console(winstonOptions.console)
33
+ ]
34
+ });
35
+ if (!programOptions.basicAuth && !programOptions.apiKey) {
36
+ logger.error('Authentication is mandatory, please specify a base 64 encoded user:password with b parameter or an ApiKey with -a parameter');
37
+ process.exit(1);
38
+ }
39
+ if (programOptions.basicAuth && programOptions.apiKey) {
40
+ logger.error('Only one authentication method should be used at a time. Please provide only the apiKey (-a) or the basicAuth (-b) but not both.');
41
+ process.exit(1);
42
+ }
43
+ // eslint-disable-next-line @typescript-eslint/naming-convention
44
+ const authHeader = programOptions.basicAuth ? { Authorization: `Basic ${programOptions.basicAuth}` } : { 'X-JFrog-Art-Api': programOptions.apiKey };
45
+ let url = programOptions.artifactoryUrl;
46
+ url += (url.endsWith('/') ? '' : '/') + 'api/search/aql';
47
+ const ageInDays = programOptions.durationKept;
48
+ const prVersions = programOptions.prVersions;
49
+ const repository = programOptions.repository;
50
+ const path = programOptions.path;
51
+ const options = {
52
+ headers: authHeader,
53
+ uri: url,
54
+ body: `items.find(
55
+ {
56
+ "$and":
57
+ [
58
+ {"repo": {"$eq":"${repository}"}},
59
+ {"path":{"$match":"${path}"}},
60
+ {"created":{"$before":"${ageInDays}d"}}
61
+ ]
62
+ }
63
+ ).include("name","repo","path","created")
64
+ .sort({"$desc" : ["path","name"]})
65
+ .limit(10000)`
66
+ };
67
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
68
+ logger.debug(`AQL search executed : ${options.body}`);
69
+ logger.info(`Url called : ${url}`);
70
+ /**
71
+ * @param result
72
+ * @param result.repo
73
+ * @param result.path
74
+ * @param result.name
75
+ * @param pathWithoutBuildNumber
76
+ */
77
+ function getUniqueId(result, pathWithoutBuildNumber) {
78
+ let mapId;
79
+ if (result.path.indexOf('.') !== -1 && result.path.indexOf('-') !== -1) {
80
+ const splittedPath = result.path.split('/');
81
+ const partialPathWithBuildNumber = splittedPath.find((currentPath) => currentPath.indexOf('.') !== -1);
82
+ if (partialPathWithBuildNumber) {
83
+ const splittedPartialPathWithDot = partialPathWithBuildNumber.split('.');
84
+ splittedPartialPathWithDot.splice(splittedPartialPathWithDot.length - 1, 1);
85
+ mapId = splittedPartialPathWithDot.join('.');
86
+ }
87
+ else {
88
+ const splittedName = result.name.split('.');
89
+ const splittedNameDash = splittedName[splittedName.length - 2].split('-');
90
+ splittedNameDash.splice(0, 1);
91
+ splittedName[splittedName.length - 2] = splittedNameDash.join('-');
92
+ const nameWithoutBuildNumber = splittedName.join('.');
93
+ mapId = pathWithoutBuildNumber + '/' + nameWithoutBuildNumber;
94
+ }
95
+ }
96
+ else {
97
+ mapId = pathWithoutBuildNumber + result.name;
98
+ }
99
+ return mapId;
100
+ }
101
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
102
+ (async () => {
103
+ logger.info(`Requesting old artifacts using ${url}`);
104
+ let responseSearch;
105
+ try {
106
+ responseSearch = await request.post(url, options).promise();
107
+ }
108
+ catch {
109
+ logger.warn('No result found %o', responseSearch);
110
+ process.exit(0);
111
+ }
112
+ const responseSearchObj = JSON.parse(responseSearch);
113
+ /** uris will contain the list of all artifacts that need to be deleted */
114
+ const mapOfKeptItems = new Map();
115
+ const mapOfKeptResult = new Map();
116
+ const resultToDelete = [];
117
+ const sortedResult = responseSearchObj.results.sort((a, b) => b.name.localeCompare(a.name));
118
+ for (const result of sortedResult) {
119
+ const splittedPathBySlash = result.path.split('/');
120
+ const folderwithBuildNumber = splittedPathBySlash.filter((value) => value.indexOf('.') !== -1)[0];
121
+ const splittedPath = folderwithBuildNumber.split('.');
122
+ const pathWithoutBuildNumber = splittedPath.slice(0, -1).join('.');
123
+ const currentBuildNumber = +splittedPath[splittedPath.length - 1];
124
+ const mapId = getUniqueId(result, pathWithoutBuildNumber);
125
+ const buildNumbers = mapOfKeptItems.get(mapId);
126
+ if (!buildNumbers) {
127
+ mapOfKeptItems.set(mapId, [currentBuildNumber]);
128
+ }
129
+ else {
130
+ buildNumbers.sort();
131
+ let isBuildNumberAlreadyInMap = false;
132
+ let isBuildNumberHigherThanExisting = true;
133
+ buildNumbers.forEach((value) => {
134
+ isBuildNumberAlreadyInMap = isBuildNumberAlreadyInMap || (value === currentBuildNumber);
135
+ isBuildNumberHigherThanExisting = isBuildNumberHigherThanExisting && (value < currentBuildNumber);
136
+ });
137
+ if (!isBuildNumberAlreadyInMap) {
138
+ if (buildNumbers.length >= prVersions && !isBuildNumberHigherThanExisting) {
139
+ resultToDelete.push(result);
140
+ }
141
+ else {
142
+ if (buildNumbers.length >= prVersions && isBuildNumberHigherThanExisting) {
143
+ const buildNumberToRemove = buildNumbers.shift();
144
+ if (buildNumberToRemove) {
145
+ const resultsToRemove = mapOfKeptResult.get(`${mapId}${buildNumberToRemove}`);
146
+ if (resultsToRemove) {
147
+ resultToDelete.push(...resultsToRemove);
148
+ }
149
+ }
150
+ }
151
+ buildNumbers.push(currentBuildNumber);
152
+ buildNumbers.sort();
153
+ mapOfKeptItems.set(mapId, buildNumbers);
154
+ const keptBuildNumbers = mapOfKeptResult.get(`${mapId}${currentBuildNumber}`);
155
+ if (!keptBuildNumbers) {
156
+ mapOfKeptResult.set(`${mapId}${currentBuildNumber}`, [result]);
157
+ }
158
+ else {
159
+ keptBuildNumbers.push(result);
160
+ mapOfKeptResult.set(`${mapId}${currentBuildNumber}`, keptBuildNumbers);
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ logger.debug('Map of build that will be kept: %o', mapOfKeptItems);
167
+ const filesToDelete = resultToDelete.map((data) => programOptions.artifactoryUrl + repository + '/' + data.path + '/' + data.name);
168
+ for (const uri of filesToDelete) {
169
+ logger.info(`Deleting ${uri}...`);
170
+ if (!programOptions.dryRun) {
171
+ const response = await request.delete(uri, options).promise();
172
+ logger.info(response);
173
+ }
174
+ }
175
+ })();
176
+ //# sourceMappingURL=pr-artifact-cleaner.js.map
@@ -0,0 +1 @@
1
+ {"version":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C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAE,cAAc,CAAC,cAAyB,GAAG,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/I,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;YAC1B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvB;KACF;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,47 @@
1
+ export interface GavcResponse {
2
+ /** Ex : mvn-built */
3
+ repo: string;
4
+ /** Ex : /io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
5
+ path: string;
6
+ /** Ex : 2018-07-06T17:14:14.123Z */
7
+ created: string;
8
+ /** Ex : anonymous */
9
+ createdBy: string;
10
+ /** Ex : 2018-07-06T17:14:14.031Z */
11
+ lastModified: string;
12
+ /** Ex : anonymous */
13
+ modifiedBy: string;
14
+ /** Ex : 2018-07-06T17:14:14.031Z */
15
+ lastUpdated: string;
16
+ /** Ex : https://jfrog.io/mvn-built/io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
17
+ downloadUri: string;
18
+ /** Ex : application/java-archive */
19
+ mimeType: string;
20
+ /** Ex : 41800 */
21
+ size: 41800;
22
+ /**
23
+ * Ex :
24
+ * checksums : {
25
+ * sha1 : 4b12dc32f3ef1a10a872297423908b52bc1ce6ea;
26
+ * md5 : db17bea6a5f737f0644482055dcf2d36
27
+ * };
28
+ */
29
+ checksums: {
30
+ sha1: string;
31
+ md5: string;
32
+ };
33
+ /**
34
+ * Ex :
35
+ * originalChecksums : {
36
+ * sha1 : b12dc32f3ef1a10a872297423908b52bc1ce6ea;
37
+ * md5 : db17bea6a5f737f0644482055dcf2d36
38
+ * };
39
+ */
40
+ originalChecksums: {
41
+ sha1: string;
42
+ md5: string;
43
+ };
44
+ /** Ex : https://jfrog.io/api/storage/mvn-built/io/swagger/typescriptFetch-swagger-codegen/1.0.0/typescriptFetch-swagger-codegen-1.0.0.jar */
45
+ uri: string;
46
+ }
47
+ //# sourceMappingURL=gavc-response.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gavc-response.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/gavc-response.interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IAEb,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAC;IAEb,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAEhB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAElB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IAErB,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IAEpB,iIAAiI;IACjI,WAAW,EAAE,MAAM,CAAC;IAEpB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IAEjB,iBAAiB;IACjB,IAAI,EAAE,KAAK,CAAC;IAEZ;;;;;;OAMG;IACH,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAEzC;;;;;;OAMG;IACH,iBAAiB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjD,6IAA6I;IAC7I,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gavc-response.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gavc-response.interfaces.js","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/gavc-response.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './gavc-response.interfaces';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './gavc-response.interfaces';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/helpers/gavc-response/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './gavc-response';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './gavc-response';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './helpers/index';
2
+ //# sourceMappingURL=public_api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './helpers/index';
2
+ //# sourceMappingURL=public_api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.js","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}