@actions/artifact 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +111 -174
  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 +3 -0
  24. package/lib/internal/download/download-artifact.js +168 -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} +12 -12
  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/upload-zip-specification.js +113 -0
  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 +27 -11
  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 -178
  77. package/lib/internal/artifact-client.js.map +0 -1
  78. package/lib/internal/config-variables.d.ts +0 -11
  79. package/lib/internal/config-variables.js +0 -72
  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 -292
  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 -74
  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 -88
  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 -121
  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 -409
  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 +0 -101
  123. package/lib/internal/upload-specification.js.map +0 -1
  124. package/lib/internal/utils.d.ts +0 -70
  125. package/lib/internal/utils.js +0 -292
  126. package/lib/internal/utils.js.map +0 -1
@@ -1,303 +0,0 @@
1
- "use strict";
2
- /**
3
- * CRC64: cyclic redundancy check, 64-bits
4
- *
5
- * In order to validate that artifacts are not being corrupted over the wire, this redundancy check allows us to
6
- * validate that there was no corruption during transmission. The implementation here is based on Go's hash/crc64 pkg,
7
- * but without the slicing-by-8 optimization: https://cs.opensource.google/go/go/+/master:src/hash/crc64/crc64.go
8
- *
9
- * This implementation uses a pregenerated table based on 0x9A6C9329AC4BC9B5 as the polynomial, the same polynomial that
10
- * is used for Azure Storage: https://github.com/Azure/azure-storage-net/blob/cbe605f9faa01bfc3003d75fc5a16b2eaccfe102/Lib/Common/Core/Util/Crc64.cs#L27
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- // when transpile target is >= ES2020 (after dropping node 12) these can be changed to bigint literals - ts(2737)
14
- const PREGEN_POLY_TABLE = [
15
- BigInt('0x0000000000000000'),
16
- BigInt('0x7F6EF0C830358979'),
17
- BigInt('0xFEDDE190606B12F2'),
18
- BigInt('0x81B31158505E9B8B'),
19
- BigInt('0xC962E5739841B68F'),
20
- BigInt('0xB60C15BBA8743FF6'),
21
- BigInt('0x37BF04E3F82AA47D'),
22
- BigInt('0x48D1F42BC81F2D04'),
23
- BigInt('0xA61CECB46814FE75'),
24
- BigInt('0xD9721C7C5821770C'),
25
- BigInt('0x58C10D24087FEC87'),
26
- BigInt('0x27AFFDEC384A65FE'),
27
- BigInt('0x6F7E09C7F05548FA'),
28
- BigInt('0x1010F90FC060C183'),
29
- BigInt('0x91A3E857903E5A08'),
30
- BigInt('0xEECD189FA00BD371'),
31
- BigInt('0x78E0FF3B88BE6F81'),
32
- BigInt('0x078E0FF3B88BE6F8'),
33
- BigInt('0x863D1EABE8D57D73'),
34
- BigInt('0xF953EE63D8E0F40A'),
35
- BigInt('0xB1821A4810FFD90E'),
36
- BigInt('0xCEECEA8020CA5077'),
37
- BigInt('0x4F5FFBD87094CBFC'),
38
- BigInt('0x30310B1040A14285'),
39
- BigInt('0xDEFC138FE0AA91F4'),
40
- BigInt('0xA192E347D09F188D'),
41
- BigInt('0x2021F21F80C18306'),
42
- BigInt('0x5F4F02D7B0F40A7F'),
43
- BigInt('0x179EF6FC78EB277B'),
44
- BigInt('0x68F0063448DEAE02'),
45
- BigInt('0xE943176C18803589'),
46
- BigInt('0x962DE7A428B5BCF0'),
47
- BigInt('0xF1C1FE77117CDF02'),
48
- BigInt('0x8EAF0EBF2149567B'),
49
- BigInt('0x0F1C1FE77117CDF0'),
50
- BigInt('0x7072EF2F41224489'),
51
- BigInt('0x38A31B04893D698D'),
52
- BigInt('0x47CDEBCCB908E0F4'),
53
- BigInt('0xC67EFA94E9567B7F'),
54
- BigInt('0xB9100A5CD963F206'),
55
- BigInt('0x57DD12C379682177'),
56
- BigInt('0x28B3E20B495DA80E'),
57
- BigInt('0xA900F35319033385'),
58
- BigInt('0xD66E039B2936BAFC'),
59
- BigInt('0x9EBFF7B0E12997F8'),
60
- BigInt('0xE1D10778D11C1E81'),
61
- BigInt('0x606216208142850A'),
62
- BigInt('0x1F0CE6E8B1770C73'),
63
- BigInt('0x8921014C99C2B083'),
64
- BigInt('0xF64FF184A9F739FA'),
65
- BigInt('0x77FCE0DCF9A9A271'),
66
- BigInt('0x08921014C99C2B08'),
67
- BigInt('0x4043E43F0183060C'),
68
- BigInt('0x3F2D14F731B68F75'),
69
- BigInt('0xBE9E05AF61E814FE'),
70
- BigInt('0xC1F0F56751DD9D87'),
71
- BigInt('0x2F3DEDF8F1D64EF6'),
72
- BigInt('0x50531D30C1E3C78F'),
73
- BigInt('0xD1E00C6891BD5C04'),
74
- BigInt('0xAE8EFCA0A188D57D'),
75
- BigInt('0xE65F088B6997F879'),
76
- BigInt('0x9931F84359A27100'),
77
- BigInt('0x1882E91B09FCEA8B'),
78
- BigInt('0x67EC19D339C963F2'),
79
- BigInt('0xD75ADABD7A6E2D6F'),
80
- BigInt('0xA8342A754A5BA416'),
81
- BigInt('0x29873B2D1A053F9D'),
82
- BigInt('0x56E9CBE52A30B6E4'),
83
- BigInt('0x1E383FCEE22F9BE0'),
84
- BigInt('0x6156CF06D21A1299'),
85
- BigInt('0xE0E5DE5E82448912'),
86
- BigInt('0x9F8B2E96B271006B'),
87
- BigInt('0x71463609127AD31A'),
88
- BigInt('0x0E28C6C1224F5A63'),
89
- BigInt('0x8F9BD7997211C1E8'),
90
- BigInt('0xF0F5275142244891'),
91
- BigInt('0xB824D37A8A3B6595'),
92
- BigInt('0xC74A23B2BA0EECEC'),
93
- BigInt('0x46F932EAEA507767'),
94
- BigInt('0x3997C222DA65FE1E'),
95
- BigInt('0xAFBA2586F2D042EE'),
96
- BigInt('0xD0D4D54EC2E5CB97'),
97
- BigInt('0x5167C41692BB501C'),
98
- BigInt('0x2E0934DEA28ED965'),
99
- BigInt('0x66D8C0F56A91F461'),
100
- BigInt('0x19B6303D5AA47D18'),
101
- BigInt('0x980521650AFAE693'),
102
- BigInt('0xE76BD1AD3ACF6FEA'),
103
- BigInt('0x09A6C9329AC4BC9B'),
104
- BigInt('0x76C839FAAAF135E2'),
105
- BigInt('0xF77B28A2FAAFAE69'),
106
- BigInt('0x8815D86ACA9A2710'),
107
- BigInt('0xC0C42C4102850A14'),
108
- BigInt('0xBFAADC8932B0836D'),
109
- BigInt('0x3E19CDD162EE18E6'),
110
- BigInt('0x41773D1952DB919F'),
111
- BigInt('0x269B24CA6B12F26D'),
112
- BigInt('0x59F5D4025B277B14'),
113
- BigInt('0xD846C55A0B79E09F'),
114
- BigInt('0xA72835923B4C69E6'),
115
- BigInt('0xEFF9C1B9F35344E2'),
116
- BigInt('0x90973171C366CD9B'),
117
- BigInt('0x1124202993385610'),
118
- BigInt('0x6E4AD0E1A30DDF69'),
119
- BigInt('0x8087C87E03060C18'),
120
- BigInt('0xFFE938B633338561'),
121
- BigInt('0x7E5A29EE636D1EEA'),
122
- BigInt('0x0134D92653589793'),
123
- BigInt('0x49E52D0D9B47BA97'),
124
- BigInt('0x368BDDC5AB7233EE'),
125
- BigInt('0xB738CC9DFB2CA865'),
126
- BigInt('0xC8563C55CB19211C'),
127
- BigInt('0x5E7BDBF1E3AC9DEC'),
128
- BigInt('0x21152B39D3991495'),
129
- BigInt('0xA0A63A6183C78F1E'),
130
- BigInt('0xDFC8CAA9B3F20667'),
131
- BigInt('0x97193E827BED2B63'),
132
- BigInt('0xE877CE4A4BD8A21A'),
133
- BigInt('0x69C4DF121B863991'),
134
- BigInt('0x16AA2FDA2BB3B0E8'),
135
- BigInt('0xF86737458BB86399'),
136
- BigInt('0x8709C78DBB8DEAE0'),
137
- BigInt('0x06BAD6D5EBD3716B'),
138
- BigInt('0x79D4261DDBE6F812'),
139
- BigInt('0x3105D23613F9D516'),
140
- BigInt('0x4E6B22FE23CC5C6F'),
141
- BigInt('0xCFD833A67392C7E4'),
142
- BigInt('0xB0B6C36E43A74E9D'),
143
- BigInt('0x9A6C9329AC4BC9B5'),
144
- BigInt('0xE50263E19C7E40CC'),
145
- BigInt('0x64B172B9CC20DB47'),
146
- BigInt('0x1BDF8271FC15523E'),
147
- BigInt('0x530E765A340A7F3A'),
148
- BigInt('0x2C608692043FF643'),
149
- BigInt('0xADD397CA54616DC8'),
150
- BigInt('0xD2BD67026454E4B1'),
151
- BigInt('0x3C707F9DC45F37C0'),
152
- BigInt('0x431E8F55F46ABEB9'),
153
- BigInt('0xC2AD9E0DA4342532'),
154
- BigInt('0xBDC36EC59401AC4B'),
155
- BigInt('0xF5129AEE5C1E814F'),
156
- BigInt('0x8A7C6A266C2B0836'),
157
- BigInt('0x0BCF7B7E3C7593BD'),
158
- BigInt('0x74A18BB60C401AC4'),
159
- BigInt('0xE28C6C1224F5A634'),
160
- BigInt('0x9DE29CDA14C02F4D'),
161
- BigInt('0x1C518D82449EB4C6'),
162
- BigInt('0x633F7D4A74AB3DBF'),
163
- BigInt('0x2BEE8961BCB410BB'),
164
- BigInt('0x548079A98C8199C2'),
165
- BigInt('0xD53368F1DCDF0249'),
166
- BigInt('0xAA5D9839ECEA8B30'),
167
- BigInt('0x449080A64CE15841'),
168
- BigInt('0x3BFE706E7CD4D138'),
169
- BigInt('0xBA4D61362C8A4AB3'),
170
- BigInt('0xC52391FE1CBFC3CA'),
171
- BigInt('0x8DF265D5D4A0EECE'),
172
- BigInt('0xF29C951DE49567B7'),
173
- BigInt('0x732F8445B4CBFC3C'),
174
- BigInt('0x0C41748D84FE7545'),
175
- BigInt('0x6BAD6D5EBD3716B7'),
176
- BigInt('0x14C39D968D029FCE'),
177
- BigInt('0x95708CCEDD5C0445'),
178
- BigInt('0xEA1E7C06ED698D3C'),
179
- BigInt('0xA2CF882D2576A038'),
180
- BigInt('0xDDA178E515432941'),
181
- BigInt('0x5C1269BD451DB2CA'),
182
- BigInt('0x237C997575283BB3'),
183
- BigInt('0xCDB181EAD523E8C2'),
184
- BigInt('0xB2DF7122E51661BB'),
185
- BigInt('0x336C607AB548FA30'),
186
- BigInt('0x4C0290B2857D7349'),
187
- BigInt('0x04D364994D625E4D'),
188
- BigInt('0x7BBD94517D57D734'),
189
- BigInt('0xFA0E85092D094CBF'),
190
- BigInt('0x856075C11D3CC5C6'),
191
- BigInt('0x134D926535897936'),
192
- BigInt('0x6C2362AD05BCF04F'),
193
- BigInt('0xED9073F555E26BC4'),
194
- BigInt('0x92FE833D65D7E2BD'),
195
- BigInt('0xDA2F7716ADC8CFB9'),
196
- BigInt('0xA54187DE9DFD46C0'),
197
- BigInt('0x24F29686CDA3DD4B'),
198
- BigInt('0x5B9C664EFD965432'),
199
- BigInt('0xB5517ED15D9D8743'),
200
- BigInt('0xCA3F8E196DA80E3A'),
201
- BigInt('0x4B8C9F413DF695B1'),
202
- BigInt('0x34E26F890DC31CC8'),
203
- BigInt('0x7C339BA2C5DC31CC'),
204
- BigInt('0x035D6B6AF5E9B8B5'),
205
- BigInt('0x82EE7A32A5B7233E'),
206
- BigInt('0xFD808AFA9582AA47'),
207
- BigInt('0x4D364994D625E4DA'),
208
- BigInt('0x3258B95CE6106DA3'),
209
- BigInt('0xB3EBA804B64EF628'),
210
- BigInt('0xCC8558CC867B7F51'),
211
- BigInt('0x8454ACE74E645255'),
212
- BigInt('0xFB3A5C2F7E51DB2C'),
213
- BigInt('0x7A894D772E0F40A7'),
214
- BigInt('0x05E7BDBF1E3AC9DE'),
215
- BigInt('0xEB2AA520BE311AAF'),
216
- BigInt('0x944455E88E0493D6'),
217
- BigInt('0x15F744B0DE5A085D'),
218
- BigInt('0x6A99B478EE6F8124'),
219
- BigInt('0x224840532670AC20'),
220
- BigInt('0x5D26B09B16452559'),
221
- BigInt('0xDC95A1C3461BBED2'),
222
- BigInt('0xA3FB510B762E37AB'),
223
- BigInt('0x35D6B6AF5E9B8B5B'),
224
- BigInt('0x4AB846676EAE0222'),
225
- BigInt('0xCB0B573F3EF099A9'),
226
- BigInt('0xB465A7F70EC510D0'),
227
- BigInt('0xFCB453DCC6DA3DD4'),
228
- BigInt('0x83DAA314F6EFB4AD'),
229
- BigInt('0x0269B24CA6B12F26'),
230
- BigInt('0x7D0742849684A65F'),
231
- BigInt('0x93CA5A1B368F752E'),
232
- BigInt('0xECA4AAD306BAFC57'),
233
- BigInt('0x6D17BB8B56E467DC'),
234
- BigInt('0x12794B4366D1EEA5'),
235
- BigInt('0x5AA8BF68AECEC3A1'),
236
- BigInt('0x25C64FA09EFB4AD8'),
237
- BigInt('0xA4755EF8CEA5D153'),
238
- BigInt('0xDB1BAE30FE90582A'),
239
- BigInt('0xBCF7B7E3C7593BD8'),
240
- BigInt('0xC399472BF76CB2A1'),
241
- BigInt('0x422A5673A732292A'),
242
- BigInt('0x3D44A6BB9707A053'),
243
- BigInt('0x759552905F188D57'),
244
- BigInt('0x0AFBA2586F2D042E'),
245
- BigInt('0x8B48B3003F739FA5'),
246
- BigInt('0xF42643C80F4616DC'),
247
- BigInt('0x1AEB5B57AF4DC5AD'),
248
- BigInt('0x6585AB9F9F784CD4'),
249
- BigInt('0xE436BAC7CF26D75F'),
250
- BigInt('0x9B584A0FFF135E26'),
251
- BigInt('0xD389BE24370C7322'),
252
- BigInt('0xACE74EEC0739FA5B'),
253
- BigInt('0x2D545FB4576761D0'),
254
- BigInt('0x523AAF7C6752E8A9'),
255
- BigInt('0xC41748D84FE75459'),
256
- BigInt('0xBB79B8107FD2DD20'),
257
- BigInt('0x3ACAA9482F8C46AB'),
258
- BigInt('0x45A459801FB9CFD2'),
259
- BigInt('0x0D75ADABD7A6E2D6'),
260
- BigInt('0x721B5D63E7936BAF'),
261
- BigInt('0xF3A84C3BB7CDF024'),
262
- BigInt('0x8CC6BCF387F8795D'),
263
- BigInt('0x620BA46C27F3AA2C'),
264
- BigInt('0x1D6554A417C62355'),
265
- BigInt('0x9CD645FC4798B8DE'),
266
- BigInt('0xE3B8B53477AD31A7'),
267
- BigInt('0xAB69411FBFB21CA3'),
268
- BigInt('0xD407B1D78F8795DA'),
269
- BigInt('0x55B4A08FDFD90E51'),
270
- BigInt('0x2ADA5047EFEC8728')
271
- ];
272
- class CRC64 {
273
- constructor() {
274
- this._crc = BigInt(0);
275
- }
276
- update(data) {
277
- const buffer = typeof data === 'string' ? Buffer.from(data) : data;
278
- let crc = CRC64.flip64Bits(this._crc);
279
- for (const dataByte of buffer) {
280
- const crcByte = Number(crc & BigInt(0xff));
281
- crc = PREGEN_POLY_TABLE[crcByte ^ dataByte] ^ (crc >> BigInt(8));
282
- }
283
- this._crc = CRC64.flip64Bits(crc);
284
- }
285
- digest(encoding) {
286
- switch (encoding) {
287
- case 'hex':
288
- return this._crc.toString(16).toUpperCase();
289
- case 'base64':
290
- return this.toBuffer().toString('base64');
291
- default:
292
- return this.toBuffer();
293
- }
294
- }
295
- toBuffer() {
296
- return Buffer.from([0, 8, 16, 24, 32, 40, 48, 56].map(s => Number((this._crc >> BigInt(s)) & BigInt(0xff))));
297
- }
298
- static flip64Bits(n) {
299
- return (BigInt(1) << BigInt(64)) - BigInt(1) - n;
300
- }
301
- }
302
- exports.default = CRC64;
303
- //# sourceMappingURL=crc64.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc64.js","sourceRoot":"","sources":["../../src/internal/crc64.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAEH,iHAAiH;AACjH,MAAM,iBAAiB,GAAG;IACxB,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;IAC5B,MAAM,CAAC,oBAAoB,CAAC;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AAU,CAAC,GAAG,CAAC,CAAA;IACnC,CAAC;IAED,MAAM,CAAC,QAA8B;QACnC,QAAQ,QAAQ,EAAE;YAChB,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;YAC7C,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;YAC3C;gBACE,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;SACzB;IACH,CAAC;IAEO,QAAQ;QACd,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CACrC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAChD,CACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,CAAS;QACzB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAClD,CAAC;CACF;AAED,kBAAe,KAAK,CAAA"}
@@ -1,39 +0,0 @@
1
- /// <reference types="node" />
2
- import * as fs from 'fs';
3
- import { ListArtifactsResponse, QueryArtifactResponse } from './contracts';
4
- import { HttpClientResponse } from '@actions/http-client';
5
- import { DownloadItem } from './download-specification';
6
- export declare class DownloadHttpClient {
7
- private downloadHttpManager;
8
- private statusReporter;
9
- constructor();
10
- /**
11
- * Gets a list of all artifacts that are in a specific container
12
- */
13
- listArtifacts(): Promise<ListArtifactsResponse>;
14
- /**
15
- * Fetches a set of container items that describe the contents of an artifact
16
- * @param artifactName the name of the artifact
17
- * @param containerUrl the artifact container URL for the run
18
- */
19
- getContainerItems(artifactName: string, containerUrl: string): Promise<QueryArtifactResponse>;
20
- /**
21
- * Concurrently downloads all the files that are part of an artifact
22
- * @param downloadItems information about what items to download and where to save them
23
- */
24
- downloadSingleArtifact(downloadItems: DownloadItem[]): Promise<void>;
25
- /**
26
- * Downloads an individual file
27
- * @param httpClientIndex the index of the http client that is used to make all of the calls
28
- * @param artifactLocation origin location where a file will be downloaded from
29
- * @param downloadPath destination location for the file being downloaded
30
- */
31
- private downloadIndividualFile;
32
- /**
33
- * Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
34
- * @param response the http response received when downloading a file
35
- * @param destinationStream the stream where the file should be written to
36
- * @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
37
- */
38
- pipeResponseToFile(response: HttpClientResponse, destinationStream: fs.WriteStream, isGzip: boolean): Promise<void>;
39
- }
@@ -1,292 +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
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.DownloadHttpClient = void 0;
32
- const fs = __importStar(require("fs"));
33
- const core = __importStar(require("@actions/core"));
34
- const zlib = __importStar(require("zlib"));
35
- const utils_1 = require("./utils");
36
- const url_1 = require("url");
37
- const status_reporter_1 = require("./status-reporter");
38
- const perf_hooks_1 = require("perf_hooks");
39
- const http_manager_1 = require("./http-manager");
40
- const config_variables_1 = require("./config-variables");
41
- const requestUtils_1 = require("./requestUtils");
42
- class DownloadHttpClient {
43
- constructor() {
44
- this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), '@actions/artifact-download');
45
- // downloads are usually significantly faster than uploads so display status information every second
46
- this.statusReporter = new status_reporter_1.StatusReporter(1000);
47
- }
48
- /**
49
- * Gets a list of all artifacts that are in a specific container
50
- */
51
- listArtifacts() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const artifactUrl = utils_1.getArtifactUrl();
54
- // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
55
- const client = this.downloadHttpManager.getClient(0);
56
- const headers = utils_1.getDownloadHeaders('application/json');
57
- const response = yield requestUtils_1.retryHttpClientRequest('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); }));
58
- const body = yield response.readBody();
59
- return JSON.parse(body);
60
- });
61
- }
62
- /**
63
- * Fetches a set of container items that describe the contents of an artifact
64
- * @param artifactName the name of the artifact
65
- * @param containerUrl the artifact container URL for the run
66
- */
67
- getContainerItems(artifactName, containerUrl) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- // the itemPath search parameter controls which containers will be returned
70
- const resourceUrl = new url_1.URL(containerUrl);
71
- resourceUrl.searchParams.append('itemPath', artifactName);
72
- // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
73
- const client = this.downloadHttpManager.getClient(0);
74
- const headers = utils_1.getDownloadHeaders('application/json');
75
- const response = yield requestUtils_1.retryHttpClientRequest('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); }));
76
- const body = yield response.readBody();
77
- return JSON.parse(body);
78
- });
79
- }
80
- /**
81
- * Concurrently downloads all the files that are part of an artifact
82
- * @param downloadItems information about what items to download and where to save them
83
- */
84
- downloadSingleArtifact(downloadItems) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const DOWNLOAD_CONCURRENCY = config_variables_1.getDownloadFileConcurrency();
87
- // limit the number of files downloaded at a single time
88
- core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`);
89
- const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()];
90
- let currentFile = 0;
91
- let downloadedFiles = 0;
92
- core.info(`Total number of files that will be downloaded: ${downloadItems.length}`);
93
- this.statusReporter.setTotalNumberOfFilesToProcess(downloadItems.length);
94
- this.statusReporter.start();
95
- yield Promise.all(parallelDownloads.map((index) => __awaiter(this, void 0, void 0, function* () {
96
- while (currentFile < downloadItems.length) {
97
- const currentFileToDownload = downloadItems[currentFile];
98
- currentFile += 1;
99
- const startTime = perf_hooks_1.performance.now();
100
- yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath);
101
- if (core.isDebug()) {
102
- core.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`);
103
- }
104
- this.statusReporter.incrementProcessedCount();
105
- }
106
- })))
107
- .catch(error => {
108
- throw new Error(`Unable to download the artifact: ${error}`);
109
- })
110
- .finally(() => {
111
- this.statusReporter.stop();
112
- // safety dispose all connections
113
- this.downloadHttpManager.disposeAndReplaceAllClients();
114
- });
115
- });
116
- }
117
- /**
118
- * Downloads an individual file
119
- * @param httpClientIndex the index of the http client that is used to make all of the calls
120
- * @param artifactLocation origin location where a file will be downloaded from
121
- * @param downloadPath destination location for the file being downloaded
122
- */
123
- downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- let retryCount = 0;
126
- const retryLimit = config_variables_1.getRetryLimit();
127
- let destinationStream = fs.createWriteStream(downloadPath);
128
- const headers = utils_1.getDownloadHeaders('application/json', true, true);
129
- // a single GET request is used to download a file
130
- const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () {
131
- const client = this.downloadHttpManager.getClient(httpClientIndex);
132
- return yield client.get(artifactLocation, headers);
133
- });
134
- // check the response headers to determine if the file was compressed using gzip
135
- const isGzip = (incomingHeaders) => {
136
- return ('content-encoding' in incomingHeaders &&
137
- incomingHeaders['content-encoding'] === 'gzip');
138
- };
139
- // Increments the current retry count and then checks if the retry limit has been reached
140
- // If there have been too many retries, fail so the download stops. If there is a retryAfterValue value provided,
141
- // it will be used
142
- const backOff = (retryAfterValue) => __awaiter(this, void 0, void 0, function* () {
143
- retryCount++;
144
- if (retryCount > retryLimit) {
145
- return Promise.reject(new Error(`Retry limit has been reached. Unable to download ${artifactLocation}`));
146
- }
147
- else {
148
- this.downloadHttpManager.disposeAndReplaceClient(httpClientIndex);
149
- if (retryAfterValue) {
150
- // Back off by waiting the specified time denoted by the retry-after header
151
- core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`);
152
- yield utils_1.sleep(retryAfterValue);
153
- }
154
- else {
155
- // Back off using an exponential value that depends on the retry count
156
- const backoffTime = utils_1.getExponentialRetryTimeInMilliseconds(retryCount);
157
- core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`);
158
- yield utils_1.sleep(backoffTime);
159
- }
160
- core.info(`Finished backoff for retry #${retryCount}, continuing with download`);
161
- }
162
- });
163
- const isAllBytesReceived = (expected, received) => {
164
- // be lenient, if any input is missing, assume success, i.e. not truncated
165
- if (!expected ||
166
- !received ||
167
- process.env['ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION']) {
168
- core.info('Skipping download validation.');
169
- return true;
170
- }
171
- return parseInt(expected) === received;
172
- };
173
- const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () {
174
- destinationStream.close();
175
- // await until file is created at downloadpath; node15 and up fs.createWriteStream had not created a file yet
176
- yield new Promise(resolve => {
177
- destinationStream.on('close', resolve);
178
- if (destinationStream.writableFinished) {
179
- resolve();
180
- }
181
- });
182
- yield utils_1.rmFile(fileDownloadPath);
183
- destinationStream = fs.createWriteStream(fileDownloadPath);
184
- });
185
- // keep trying to download a file until a retry limit has been reached
186
- while (retryCount <= retryLimit) {
187
- let response;
188
- try {
189
- response = yield makeDownloadRequest();
190
- }
191
- catch (error) {
192
- // if an error is caught, it is usually indicative of a timeout so retry the download
193
- core.info('An error occurred while attempting to download a file');
194
- // eslint-disable-next-line no-console
195
- console.log(error);
196
- // increment the retryCount and use exponential backoff to wait before making the next request
197
- yield backOff();
198
- continue;
199
- }
200
- let forceRetry = false;
201
- if (utils_1.isSuccessStatusCode(response.message.statusCode)) {
202
- // The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
203
- // which can cause some gzip encoded data to be lost
204
- // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
205
- try {
206
- const isGzipped = isGzip(response.message.headers);
207
- yield this.pipeResponseToFile(response, destinationStream, isGzipped);
208
- if (isGzipped ||
209
- isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) {
210
- return;
211
- }
212
- else {
213
- forceRetry = true;
214
- }
215
- }
216
- catch (error) {
217
- // retry on error, most likely streams were corrupted
218
- forceRetry = true;
219
- }
220
- }
221
- if (forceRetry || utils_1.isRetryableStatusCode(response.message.statusCode)) {
222
- core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`);
223
- resetDestinationStream(downloadPath);
224
- // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
225
- utils_1.isThrottledStatusCode(response.message.statusCode)
226
- ? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers))
227
- : yield backOff();
228
- }
229
- else {
230
- // Some unexpected response code, fail immediately and stop the download
231
- utils_1.displayHttpDiagnostics(response);
232
- return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`));
233
- }
234
- }
235
- });
236
- }
237
- /**
238
- * Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
239
- * @param response the http response received when downloading a file
240
- * @param destinationStream the stream where the file should be written to
241
- * @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
242
- */
243
- pipeResponseToFile(response, destinationStream, isGzip) {
244
- return __awaiter(this, void 0, void 0, function* () {
245
- yield new Promise((resolve, reject) => {
246
- if (isGzip) {
247
- const gunzip = zlib.createGunzip();
248
- response.message
249
- .on('error', error => {
250
- core.error(`An error occurred while attempting to read the response stream`);
251
- gunzip.close();
252
- destinationStream.close();
253
- reject(error);
254
- })
255
- .pipe(gunzip)
256
- .on('error', error => {
257
- core.error(`An error occurred while attempting to decompress the response stream`);
258
- destinationStream.close();
259
- reject(error);
260
- })
261
- .pipe(destinationStream)
262
- .on('close', () => {
263
- resolve();
264
- })
265
- .on('error', error => {
266
- core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
267
- reject(error);
268
- });
269
- }
270
- else {
271
- response.message
272
- .on('error', error => {
273
- core.error(`An error occurred while attempting to read the response stream`);
274
- destinationStream.close();
275
- reject(error);
276
- })
277
- .pipe(destinationStream)
278
- .on('close', () => {
279
- resolve();
280
- })
281
- .on('error', error => {
282
- core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
283
- reject(error);
284
- });
285
- }
286
- });
287
- return;
288
- });
289
- }
290
- }
291
- exports.DownloadHttpClient = DownloadHttpClient;
292
- //# sourceMappingURL=download-http-client.js.map