@actions/artifact 1.1.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +116 -173
  2. package/lib/artifact.d.ts +6 -0
  3. package/lib/artifact.js +23 -0
  4. package/lib/artifact.js.map +1 -0
  5. package/lib/generated/google/protobuf/timestamp.d.ts +145 -0
  6. package/lib/generated/google/protobuf/timestamp.js +136 -0
  7. package/lib/generated/google/protobuf/timestamp.js.map +1 -0
  8. package/lib/generated/google/protobuf/wrappers.d.ts +307 -0
  9. package/lib/generated/google/protobuf/wrappers.js +609 -0
  10. package/lib/generated/google/protobuf/wrappers.js.map +1 -0
  11. package/lib/generated/index.d.ts +4 -0
  12. package/lib/generated/index.js +21 -0
  13. package/lib/generated/index.js.map +1 -0
  14. package/lib/generated/results/api/v1/artifact.d.ts +286 -0
  15. package/lib/generated/results/api/v1/artifact.js +588 -0
  16. package/lib/generated/results/api/v1/artifact.js.map +1 -0
  17. package/lib/generated/results/api/v1/artifact.twirp.d.ts +43 -0
  18. package/lib/generated/results/api/v1/artifact.twirp.js +416 -0
  19. package/lib/generated/results/api/v1/artifact.twirp.js.map +1 -0
  20. package/lib/internal/client.d.ts +61 -0
  21. package/lib/internal/client.js +121 -0
  22. package/lib/internal/client.js.map +1 -0
  23. package/lib/internal/download/download-artifact.d.ts +4 -0
  24. package/lib/internal/download/download-artifact.js +205 -0
  25. package/lib/internal/download/download-artifact.js.map +1 -0
  26. package/lib/internal/find/get-artifact.d.ts +3 -0
  27. package/lib/internal/find/get-artifact.js +118 -0
  28. package/lib/internal/find/get-artifact.js.map +1 -0
  29. package/lib/internal/find/list-artifacts.d.ts +3 -0
  30. package/lib/internal/find/list-artifacts.js +139 -0
  31. package/lib/internal/find/list-artifacts.js.map +1 -0
  32. package/lib/internal/find/retry-options.d.ts +7 -0
  33. package/lib/internal/find/retry-options.js +50 -0
  34. package/lib/internal/find/retry-options.js.map +1 -0
  35. package/lib/internal/shared/artifact-twirp-client.d.ts +6 -0
  36. package/lib/internal/shared/artifact-twirp-client.js +153 -0
  37. package/lib/internal/shared/artifact-twirp-client.js.map +1 -0
  38. package/lib/internal/shared/config.d.ts +6 -0
  39. package/lib/internal/shared/config.js +55 -0
  40. package/lib/internal/shared/config.js.map +1 -0
  41. package/lib/internal/shared/errors.d.ts +22 -0
  42. package/lib/internal/shared/errors.js +70 -0
  43. package/lib/internal/shared/errors.js.map +1 -0
  44. package/lib/internal/shared/interfaces.d.ts +136 -0
  45. package/lib/internal/{contracts.js → shared/interfaces.js} +1 -1
  46. package/lib/internal/shared/interfaces.js.map +1 -0
  47. package/lib/internal/shared/user-agent.d.ts +4 -0
  48. package/lib/internal/shared/user-agent.js +13 -0
  49. package/lib/internal/shared/user-agent.js.map +1 -0
  50. package/lib/internal/shared/util.d.ts +5 -0
  51. package/lib/internal/shared/util.js +81 -0
  52. package/lib/internal/shared/util.js.map +1 -0
  53. package/lib/internal/upload/blob-upload.d.ts +12 -0
  54. package/lib/internal/upload/blob-upload.js +87 -0
  55. package/lib/internal/upload/blob-upload.js.map +1 -0
  56. package/lib/internal/upload/path-and-artifact-name-validation.d.ts +8 -0
  57. package/lib/internal/{path-and-artifact-name-validation.js → upload/path-and-artifact-name-validation.js} +11 -11
  58. package/lib/internal/upload/path-and-artifact-name-validation.js.map +1 -0
  59. package/lib/internal/upload/retention.d.ts +2 -0
  60. package/lib/internal/upload/retention.js +54 -0
  61. package/lib/internal/upload/retention.js.map +1 -0
  62. package/lib/internal/upload/upload-artifact.d.ts +2 -0
  63. package/lib/internal/upload/upload-artifact.js +103 -0
  64. package/lib/internal/upload/upload-artifact.js.map +1 -0
  65. package/lib/internal/upload/upload-zip-specification.d.ts +21 -0
  66. package/lib/internal/{upload-specification.js → upload/upload-zip-specification.js} +44 -36
  67. package/lib/internal/upload/upload-zip-specification.js.map +1 -0
  68. package/lib/internal/upload/zip.d.ts +9 -0
  69. package/lib/internal/upload/zip.js +113 -0
  70. package/lib/internal/upload/zip.js.map +1 -0
  71. package/package.json +26 -12
  72. package/lib/artifact-client.d.ts +0 -10
  73. package/lib/artifact-client.js +0 -12
  74. package/lib/artifact-client.js.map +0 -1
  75. package/lib/internal/artifact-client.d.ts +0 -41
  76. package/lib/internal/artifact-client.js +0 -182
  77. package/lib/internal/artifact-client.js.map +0 -1
  78. package/lib/internal/config-variables.d.ts +0 -12
  79. package/lib/internal/config-variables.js +0 -77
  80. package/lib/internal/config-variables.js.map +0 -1
  81. package/lib/internal/contracts.d.ts +0 -67
  82. package/lib/internal/contracts.js.map +0 -1
  83. package/lib/internal/crc64.d.ts +0 -21
  84. package/lib/internal/crc64.js +0 -303
  85. package/lib/internal/crc64.js.map +0 -1
  86. package/lib/internal/download-http-client.d.ts +0 -39
  87. package/lib/internal/download-http-client.js +0 -296
  88. package/lib/internal/download-http-client.js.map +0 -1
  89. package/lib/internal/download-options.d.ts +0 -7
  90. package/lib/internal/download-options.js +0 -3
  91. package/lib/internal/download-options.js.map +0 -1
  92. package/lib/internal/download-response.d.ts +0 -10
  93. package/lib/internal/download-response.js +0 -3
  94. package/lib/internal/download-response.js.map +0 -1
  95. package/lib/internal/download-specification.d.ts +0 -19
  96. package/lib/internal/download-specification.js +0 -78
  97. package/lib/internal/download-specification.js.map +0 -1
  98. package/lib/internal/http-manager.d.ts +0 -12
  99. package/lib/internal/http-manager.js +0 -32
  100. package/lib/internal/http-manager.js.map +0 -1
  101. package/lib/internal/path-and-artifact-name-validation.d.ts +0 -8
  102. package/lib/internal/path-and-artifact-name-validation.js.map +0 -1
  103. package/lib/internal/requestUtils.d.ts +0 -3
  104. package/lib/internal/requestUtils.js +0 -92
  105. package/lib/internal/requestUtils.js.map +0 -1
  106. package/lib/internal/status-reporter.d.ts +0 -21
  107. package/lib/internal/status-reporter.js +0 -52
  108. package/lib/internal/status-reporter.js.map +0 -1
  109. package/lib/internal/upload-gzip.d.ts +0 -14
  110. package/lib/internal/upload-gzip.js +0 -147
  111. package/lib/internal/upload-gzip.js.map +0 -1
  112. package/lib/internal/upload-http-client.d.ts +0 -48
  113. package/lib/internal/upload-http-client.js +0 -415
  114. package/lib/internal/upload-http-client.js.map +0 -1
  115. package/lib/internal/upload-options.d.ts +0 -34
  116. package/lib/internal/upload-options.js +0 -3
  117. package/lib/internal/upload-options.js.map +0 -1
  118. package/lib/internal/upload-response.d.ts +0 -19
  119. package/lib/internal/upload-response.js +0 -3
  120. package/lib/internal/upload-response.js.map +0 -1
  121. package/lib/internal/upload-specification.d.ts +0 -11
  122. package/lib/internal/upload-specification.js.map +0 -1
  123. package/lib/internal/utils.d.ts +0 -71
  124. package/lib/internal/utils.js +0 -292
  125. package/lib/internal/utils.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actions/artifact",
3
- "version": "1.1.2",
3
+ "version": "2.0.1",
4
4
  "preview": true,
5
5
  "description": "Actions artifact lib",
6
6
  "keywords": [
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "homepage": "https://github.com/actions/toolkit/tree/main/packages/artifact",
12
12
  "license": "MIT",
13
- "main": "lib/artifact-client.js",
14
- "types": "lib/artifact-client.d.ts",
13
+ "main": "lib/artifact.js",
14
+ "types": "lib/artifact.d.ts",
15
15
  "directories": {
16
16
  "lib": "lib",
17
17
  "test": "__tests__"
@@ -30,22 +30,36 @@
30
30
  },
31
31
  "scripts": {
32
32
  "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
33
- "test": "echo \"Error: run tests from root\" && exit 1",
33
+ "test": "cd ../../ && npm run test ./packages/artifact",
34
34
  "bootstrap": "cd ../../ && npm run bootstrap",
35
35
  "tsc-run": "tsc",
36
- "tsc": "npm run bootstrap && npm run tsc-run"
36
+ "tsc": "npm run bootstrap && npm run tsc-run",
37
+ "gen:docs": "typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"
37
38
  },
38
39
  "bugs": {
39
40
  "url": "https://github.com/actions/toolkit/issues"
40
41
  },
41
42
  "dependencies": {
42
- "@actions/core": "^1.9.1",
43
- "@actions/http-client": "^2.0.1",
44
- "tmp": "^0.2.1",
45
- "tmp-promise": "^3.0.2"
43
+ "@actions/core": "^1.10.0",
44
+ "@actions/github": "^5.1.1",
45
+ "@actions/http-client": "^2.1.0",
46
+ "@azure/storage-blob": "^12.15.0",
47
+ "@octokit/core": "^3.5.1",
48
+ "@octokit/plugin-request-log": "^1.0.4",
49
+ "@octokit/plugin-retry": "^3.0.9",
50
+ "@octokit/request-error": "^5.0.0",
51
+ "@protobuf-ts/plugin": "^2.2.3-alpha.1",
52
+ "archiver": "^5.3.1",
53
+ "crypto": "^1.0.1",
54
+ "jwt-decode": "^3.1.2",
55
+ "twirp-ts": "^2.5.0",
56
+ "unzip-stream": "^0.3.1"
46
57
  },
47
58
  "devDependencies": {
48
- "@types/tmp": "^0.2.1",
49
- "typescript": "^4.3.0"
59
+ "@types/archiver": "^5.3.2",
60
+ "@types/unzip-stream": "^0.3.4",
61
+ "typedoc": "^0.25.4",
62
+ "typedoc-plugin-markdown": "^3.17.1",
63
+ "typescript": "^5.2.2"
50
64
  }
51
- }
65
+ }
@@ -1,10 +0,0 @@
1
- import { UploadOptions } from './internal/upload-options';
2
- import { UploadResponse } from './internal/upload-response';
3
- import { DownloadOptions } from './internal/download-options';
4
- import { DownloadResponse } from './internal/download-response';
5
- import { ArtifactClient } from './internal/artifact-client';
6
- export { ArtifactClient, UploadResponse, UploadOptions, DownloadResponse, DownloadOptions };
7
- /**
8
- * Constructs an ArtifactClient
9
- */
10
- export declare function create(): ArtifactClient;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = void 0;
4
- const artifact_client_1 = require("./internal/artifact-client");
5
- /**
6
- * Constructs an ArtifactClient
7
- */
8
- function create() {
9
- return artifact_client_1.DefaultArtifactClient.create();
10
- }
11
- exports.create = create;
12
- //# sourceMappingURL=artifact-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../src/artifact-client.ts"],"names":[],"mappings":";;;AAIA,gEAAgF;AAUhF;;GAEG;AACH,SAAgB,MAAM;IACpB,OAAO,uCAAqB,CAAC,MAAM,EAAE,CAAA;AACvC,CAAC;AAFD,wBAEC"}
@@ -1,41 +0,0 @@
1
- import { UploadResponse } from './upload-response';
2
- import { UploadOptions } from './upload-options';
3
- import { DownloadOptions } from './download-options';
4
- import { DownloadResponse } from './download-response';
5
- export interface ArtifactClient {
6
- /**
7
- * Uploads an artifact
8
- *
9
- * @param name the name of the artifact, required
10
- * @param files a list of absolute or relative paths that denote what files should be uploaded
11
- * @param rootDirectory an absolute or relative file path that denotes the root parent directory of the files being uploaded
12
- * @param options extra options for customizing the upload behavior
13
- * @returns single UploadInfo object
14
- */
15
- uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions): Promise<UploadResponse>;
16
- /**
17
- * Downloads a single artifact associated with a run
18
- *
19
- * @param name the name of the artifact being downloaded
20
- * @param path optional path that denotes where the artifact will be downloaded to
21
- * @param options extra options that allow for the customization of the download behavior
22
- */
23
- downloadArtifact(name: string, path?: string, options?: DownloadOptions): Promise<DownloadResponse>;
24
- /**
25
- * Downloads all artifacts associated with a run. Because there are multiple artifacts being downloaded, a folder will be created for each one in the specified or default directory
26
- * @param path optional path that denotes where the artifacts will be downloaded to
27
- */
28
- downloadAllArtifacts(path?: string): Promise<DownloadResponse[]>;
29
- }
30
- export declare class DefaultArtifactClient implements ArtifactClient {
31
- /**
32
- * Constructs a DefaultArtifactClient
33
- */
34
- static create(): DefaultArtifactClient;
35
- /**
36
- * Uploads an artifact
37
- */
38
- uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadOptions | undefined): Promise<UploadResponse>;
39
- downloadArtifact(name: string, path?: string | undefined, options?: DownloadOptions | undefined): Promise<DownloadResponse>;
40
- downloadAllArtifacts(path?: string | undefined): Promise<DownloadResponse[]>;
41
- }
@@ -1,182 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.DefaultArtifactClient = void 0;
36
- const core = __importStar(require("@actions/core"));
37
- const upload_specification_1 = require("./upload-specification");
38
- const upload_http_client_1 = require("./upload-http-client");
39
- const utils_1 = require("./utils");
40
- const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
41
- const download_http_client_1 = require("./download-http-client");
42
- const download_specification_1 = require("./download-specification");
43
- const config_variables_1 = require("./config-variables");
44
- const path_1 = require("path");
45
- class DefaultArtifactClient {
46
- /**
47
- * Constructs a DefaultArtifactClient
48
- */
49
- static create() {
50
- return new DefaultArtifactClient();
51
- }
52
- /**
53
- * Uploads an artifact
54
- */
55
- uploadArtifact(name, files, rootDirectory, options) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- core.info(`Starting artifact upload
58
- For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`);
59
- (0, path_and_artifact_name_validation_1.checkArtifactName)(name);
60
- // Get specification for the files being uploaded
61
- const uploadSpecification = (0, upload_specification_1.getUploadSpecification)(name, rootDirectory, files);
62
- const uploadResponse = {
63
- artifactName: name,
64
- artifactItems: [],
65
- size: 0,
66
- failedItems: []
67
- };
68
- const uploadHttpClient = new upload_http_client_1.UploadHttpClient();
69
- if (uploadSpecification.length === 0) {
70
- core.warning(`No files found that can be uploaded`);
71
- }
72
- else {
73
- // Create an entry for the artifact in the file container
74
- const response = yield uploadHttpClient.createArtifactInFileContainer(name, options);
75
- if (!response.fileContainerResourceUrl) {
76
- core.debug(response.toString());
77
- throw new Error('No URL provided by the Artifact Service to upload an artifact to');
78
- }
79
- core.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`);
80
- core.info(`Container for artifact "${name}" successfully created. Starting upload of file(s)`);
81
- // Upload each of the files that were found concurrently
82
- const uploadResult = yield uploadHttpClient.uploadArtifactToFileContainer(response.fileContainerResourceUrl, uploadSpecification, options);
83
- // Update the size of the artifact to indicate we are done uploading
84
- // The uncompressed size is used for display when downloading a zip of the artifact from the UI
85
- core.info(`File upload process has finished. Finalizing the artifact upload`);
86
- yield uploadHttpClient.patchArtifactSize(uploadResult.totalSize, name);
87
- if (uploadResult.failedItems.length > 0) {
88
- core.info(`Upload finished. There were ${uploadResult.failedItems.length} items that failed to upload`);
89
- }
90
- else {
91
- core.info(`Artifact has been finalized. All files have been successfully uploaded!`);
92
- }
93
- core.info(`
94
- The raw size of all the files that were specified for upload is ${uploadResult.totalSize} bytes
95
- The size of all the files that were uploaded is ${uploadResult.uploadSize} bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
96
-
97
- Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads \r\n`);
98
- uploadResponse.artifactItems = uploadSpecification.map(item => item.absoluteFilePath);
99
- uploadResponse.size = uploadResult.uploadSize;
100
- uploadResponse.failedItems = uploadResult.failedItems;
101
- }
102
- return uploadResponse;
103
- });
104
- }
105
- downloadArtifact(name, path, options) {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- const downloadHttpClient = new download_http_client_1.DownloadHttpClient();
108
- const artifacts = yield downloadHttpClient.listArtifacts();
109
- if (artifacts.count === 0) {
110
- throw new Error(`Unable to find any artifacts for the associated workflow`);
111
- }
112
- const artifactToDownload = artifacts.value.find(artifact => {
113
- return artifact.name === name;
114
- });
115
- if (!artifactToDownload) {
116
- throw new Error(`Unable to find an artifact with the name: ${name}`);
117
- }
118
- const items = yield downloadHttpClient.getContainerItems(artifactToDownload.name, artifactToDownload.fileContainerResourceUrl);
119
- if (!path) {
120
- path = (0, config_variables_1.getWorkSpaceDirectory)();
121
- }
122
- path = (0, path_1.normalize)(path);
123
- path = (0, path_1.resolve)(path);
124
- // During upload, empty directories are rejected by the remote server so there should be no artifacts that consist of only empty directories
125
- const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(name, items.value, path, (options === null || options === void 0 ? void 0 : options.createArtifactFolder) || false);
126
- if (downloadSpecification.filesToDownload.length === 0) {
127
- core.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`);
128
- }
129
- else {
130
- // Create all necessary directories recursively before starting any download
131
- yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
132
- core.info('Directory structure has been set up for the artifact');
133
- yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
134
- yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
135
- }
136
- return {
137
- artifactName: name,
138
- downloadPath: downloadSpecification.rootDownloadLocation
139
- };
140
- });
141
- }
142
- downloadAllArtifacts(path) {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- const downloadHttpClient = new download_http_client_1.DownloadHttpClient();
145
- const response = [];
146
- const artifacts = yield downloadHttpClient.listArtifacts();
147
- if (artifacts.count === 0) {
148
- core.info('Unable to find any artifacts for the associated workflow');
149
- return response;
150
- }
151
- if (!path) {
152
- path = (0, config_variables_1.getWorkSpaceDirectory)();
153
- }
154
- path = (0, path_1.normalize)(path);
155
- path = (0, path_1.resolve)(path);
156
- let downloadedArtifacts = 0;
157
- while (downloadedArtifacts < artifacts.count) {
158
- const currentArtifactToDownload = artifacts.value[downloadedArtifacts];
159
- downloadedArtifacts += 1;
160
- core.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`);
161
- // Get container entries for the specific artifact
162
- const items = yield downloadHttpClient.getContainerItems(currentArtifactToDownload.name, currentArtifactToDownload.fileContainerResourceUrl);
163
- const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(currentArtifactToDownload.name, items.value, path, true);
164
- if (downloadSpecification.filesToDownload.length === 0) {
165
- core.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`);
166
- }
167
- else {
168
- yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
169
- yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
170
- yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
171
- }
172
- response.push({
173
- artifactName: currentArtifactToDownload.name,
174
- downloadPath: downloadSpecification.rootDownloadLocation
175
- });
176
- }
177
- return response;
178
- });
179
- }
180
- }
181
- exports.DefaultArtifactClient = DefaultArtifactClient;
182
- //# sourceMappingURL=artifact-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../../src/internal/artifact-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,iEAG+B;AAC/B,6DAAqD;AAKrD,mCAGgB;AAChB,2FAAqE;AACrE,iEAAyD;AACzD,qEAAiE;AACjE,yDAAwD;AACxD,+BAAuC;AAuCvC,MAAa,qBAAqB;IAChC;;OAEG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,qBAAqB,EAAE,CAAA;IACpC,CAAC;IAED;;OAEG;IACG,cAAc,CAClB,IAAY,EACZ,KAAe,EACf,aAAqB,EACrB,OAAmC;;YAEnC,IAAI,CAAC,IAAI,CACP;8MACwM,CACzM,CAAA;YACD,IAAA,qDAAiB,EAAC,IAAI,CAAC,CAAA;YAEvB,iDAAiD;YACjD,MAAM,mBAAmB,GAA0B,IAAA,6CAAsB,EACvE,IAAI,EACJ,aAAa,EACb,KAAK,CACN,CAAA;YACD,MAAM,cAAc,GAAmB;gBACrC,YAAY,EAAE,IAAI;gBAClB,aAAa,EAAE,EAAE;gBACjB,IAAI,EAAE,CAAC;gBACP,WAAW,EAAE,EAAE;aAChB,CAAA;YAED,MAAM,gBAAgB,GAAG,IAAI,qCAAgB,EAAE,CAAA;YAE/C,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpC,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAA;aACpD;iBAAM;gBACL,yDAAyD;gBACzD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,6BAA6B,CACnE,IAAI,EACJ,OAAO,CACR,CAAA;gBACD,IAAI,CAAC,QAAQ,CAAC,wBAAwB,EAAE;oBACtC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;oBAC/B,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAA;iBACF;gBAED,IAAI,CAAC,KAAK,CAAC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e,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtD,IAAI,CAAC,IAAI,CACP,qDAAqD,yBAAyB,CAAC,IAAI,EAAE,CACtF,CAAA;iBACF;qBAAM;oBACL,MAAM,IAAA,oCAA4B,EAChC,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,IAAA,mCAA2B,EAC/B,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,kBAAkB,CAAC,sBAAsB,CAC7C,qBAAqB,CAAC,eAAe,CACtC,CAAA;iBACF;gBAED,QAAQ,CAAC,IAAI,CAAC;oBACZ,YAAY,EAAE,yBAAyB,CAAC,IAAI;oBAC5C,YAAY,EAAE,qBAAqB,CAAC,oBAAoB;iBACzD,CAAC,CAAA;aACH;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KAAA;CACF;AAhOD,sDAgOC"}
@@ -1,12 +0,0 @@
1
- export declare function getUploadFileConcurrency(): number;
2
- export declare function getUploadChunkSize(): number;
3
- export declare function getRetryLimit(): number;
4
- export declare function getRetryMultiplier(): number;
5
- export declare function getInitialRetryIntervalInMilliseconds(): number;
6
- export declare function getDownloadFileConcurrency(): number;
7
- export declare function getRuntimeToken(): string;
8
- export declare function getRuntimeUrl(): string;
9
- export declare function getWorkFlowRunId(): string;
10
- export declare function getWorkSpaceDirectory(): string;
11
- export declare function getRetentionDays(): string | undefined;
12
- export declare function isGhes(): boolean;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isGhes = exports.getRetentionDays = exports.getWorkSpaceDirectory = exports.getWorkFlowRunId = exports.getRuntimeUrl = exports.getRuntimeToken = exports.getDownloadFileConcurrency = exports.getInitialRetryIntervalInMilliseconds = exports.getRetryMultiplier = exports.getRetryLimit = exports.getUploadChunkSize = exports.getUploadFileConcurrency = void 0;
4
- // The number of concurrent uploads that happens at the same time
5
- function getUploadFileConcurrency() {
6
- return 2;
7
- }
8
- exports.getUploadFileConcurrency = getUploadFileConcurrency;
9
- // When uploading large files that can't be uploaded with a single http call, this controls
10
- // the chunk size that is used during upload
11
- function getUploadChunkSize() {
12
- return 8 * 1024 * 1024; // 8 MB Chunks
13
- }
14
- exports.getUploadChunkSize = getUploadChunkSize;
15
- // The maximum number of retries that can be attempted before an upload or download fails
16
- function getRetryLimit() {
17
- return 5;
18
- }
19
- exports.getRetryLimit = getRetryLimit;
20
- // With exponential backoff, the larger the retry count, the larger the wait time before another attempt
21
- // The retry multiplier controls by how much the backOff time increases depending on the number of retries
22
- function getRetryMultiplier() {
23
- return 1.5;
24
- }
25
- exports.getRetryMultiplier = getRetryMultiplier;
26
- // The initial wait time if an upload or download fails and a retry is being attempted for the first time
27
- function getInitialRetryIntervalInMilliseconds() {
28
- return 3000;
29
- }
30
- exports.getInitialRetryIntervalInMilliseconds = getInitialRetryIntervalInMilliseconds;
31
- // The number of concurrent downloads that happens at the same time
32
- function getDownloadFileConcurrency() {
33
- return 2;
34
- }
35
- exports.getDownloadFileConcurrency = getDownloadFileConcurrency;
36
- function getRuntimeToken() {
37
- const token = process.env['ACTIONS_RUNTIME_TOKEN'];
38
- if (!token) {
39
- throw new Error('Unable to get ACTIONS_RUNTIME_TOKEN env variable');
40
- }
41
- return token;
42
- }
43
- exports.getRuntimeToken = getRuntimeToken;
44
- function getRuntimeUrl() {
45
- const runtimeUrl = process.env['ACTIONS_RUNTIME_URL'];
46
- if (!runtimeUrl) {
47
- throw new Error('Unable to get ACTIONS_RUNTIME_URL env variable');
48
- }
49
- return runtimeUrl;
50
- }
51
- exports.getRuntimeUrl = getRuntimeUrl;
52
- function getWorkFlowRunId() {
53
- const workFlowRunId = process.env['GITHUB_RUN_ID'];
54
- if (!workFlowRunId) {
55
- throw new Error('Unable to get GITHUB_RUN_ID env variable');
56
- }
57
- return workFlowRunId;
58
- }
59
- exports.getWorkFlowRunId = getWorkFlowRunId;
60
- function getWorkSpaceDirectory() {
61
- const workspaceDirectory = process.env['GITHUB_WORKSPACE'];
62
- if (!workspaceDirectory) {
63
- throw new Error('Unable to get GITHUB_WORKSPACE env variable');
64
- }
65
- return workspaceDirectory;
66
- }
67
- exports.getWorkSpaceDirectory = getWorkSpaceDirectory;
68
- function getRetentionDays() {
69
- return process.env['GITHUB_RETENTION_DAYS'];
70
- }
71
- exports.getRetentionDays = getRetentionDays;
72
- function isGhes() {
73
- const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
74
- return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
75
- }
76
- exports.isGhes = isGhes;
77
- //# sourceMappingURL=config-variables.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-variables.js","sourceRoot":"","sources":["../../src/internal/config-variables.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,SAAgB,wBAAwB;IACtC,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,4DAEC;AAED,2FAA2F;AAC3F,4CAA4C;AAC5C,SAAgB,kBAAkB;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,cAAc;AACvC,CAAC;AAFD,gDAEC;AAED,yFAAyF;AACzF,SAAgB,aAAa;IAC3B,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,sCAEC;AAED,wGAAwG;AACxG,0GAA0G;AAC1G,SAAgB,kBAAkB;IAChC,OAAO,GAAG,CAAA;AACZ,CAAC;AAFD,gDAEC;AAED,yGAAyG;AACzG,SAAgB,qCAAqC;IACnD,OAAO,IAAI,CAAA;AACb,CAAC;AAFD,sFAEC;AAED,mEAAmE;AACnE,SAAgB,0BAA0B;IACxC,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,gEAEC;AAED,SAAgB,eAAe;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAClD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;KACpE;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,0CAMC;AAED,SAAgB,aAAa;IAC3B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IACrD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;KAClE;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAND,sCAMC;AAED,SAAgB,gBAAgB;IAC9B,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAClD,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAND,4CAMC;AAED,SAAgB,qBAAqB;IACnC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC1D,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;KAC/D;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAND,sDAMC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAC7C,CAAC;AAFD,4CAEC;AAED,SAAgB,MAAM;IACpB,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,oBAAoB,CACzD,CAAA;IACD,OAAO,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,YAAY,CAAA;AACtD,CAAC;AALD,wBAKC"}
@@ -1,67 +0,0 @@
1
- export interface ArtifactResponse {
2
- containerId: string;
3
- size: number;
4
- signedContent: string;
5
- fileContainerResourceUrl: string;
6
- type: string;
7
- name: string;
8
- url: string;
9
- }
10
- export interface CreateArtifactParameters {
11
- Type: string;
12
- Name: string;
13
- RetentionDays?: number;
14
- }
15
- export interface PatchArtifactSize {
16
- Size: number;
17
- }
18
- export interface PatchArtifactSizeSuccessResponse {
19
- containerId: number;
20
- size: number;
21
- signedContent: string;
22
- type: string;
23
- name: string;
24
- url: string;
25
- uploadUrl: string;
26
- }
27
- export interface UploadResults {
28
- /**
29
- * The size in bytes of data that was transferred during the upload process to the actions backend service. This takes into account possible
30
- * gzip compression to reduce the amount of data that needs to be transferred
31
- */
32
- uploadSize: number;
33
- /**
34
- * The raw size of the files that were specified for upload
35
- */
36
- totalSize: number;
37
- /**
38
- * An array of files that failed to upload
39
- */
40
- failedItems: string[];
41
- }
42
- export interface ListArtifactsResponse {
43
- count: number;
44
- value: ArtifactResponse[];
45
- }
46
- export interface QueryArtifactResponse {
47
- count: number;
48
- value: ContainerEntry[];
49
- }
50
- export interface ContainerEntry {
51
- containerId: number;
52
- scopeIdentifier: string;
53
- path: string;
54
- itemType: string;
55
- status: string;
56
- fileLength?: number;
57
- fileEncoding?: number;
58
- fileType?: number;
59
- dateCreated: string;
60
- dateLastModified: string;
61
- createdBy: string;
62
- lastModifiedBy: string;
63
- itemLocation: string;
64
- contentLocation: string;
65
- fileId?: number;
66
- contentId: string;
67
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/internal/contracts.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- /**
2
- * CRC64: cyclic redundancy check, 64-bits
3
- *
4
- * In order to validate that artifacts are not being corrupted over the wire, this redundancy check allows us to
5
- * validate that there was no corruption during transmission. The implementation here is based on Go's hash/crc64 pkg,
6
- * but without the slicing-by-8 optimization: https://cs.opensource.google/go/go/+/master:src/hash/crc64/crc64.go
7
- *
8
- * This implementation uses a pregenerated table based on 0x9A6C9329AC4BC9B5 as the polynomial, the same polynomial that
9
- * is used for Azure Storage: https://github.com/Azure/azure-storage-net/blob/cbe605f9faa01bfc3003d75fc5a16b2eaccfe102/Lib/Common/Core/Util/Crc64.cs#L27
10
- */
11
- /// <reference types="node" />
12
- export type CRC64DigestEncoding = 'hex' | 'base64' | 'buffer';
13
- declare class CRC64 {
14
- private _crc;
15
- constructor();
16
- update(data: Buffer | string): void;
17
- digest(encoding?: CRC64DigestEncoding): string | Buffer;
18
- private toBuffer;
19
- static flip64Bits(n: bigint): bigint;
20
- }
21
- export default CRC64;