@actions/artifact 5.0.3 → 6.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.
- package/README.md +0 -1
- package/lib/artifact.d.ts +4 -4
- package/lib/artifact.js +6 -22
- package/lib/artifact.js.map +1 -1
- package/lib/generated/google/protobuf/timestamp.js +21 -24
- package/lib/generated/google/protobuf/timestamp.js.map +1 -1
- package/lib/generated/google/protobuf/wrappers.js +74 -77
- package/lib/generated/google/protobuf/wrappers.js.map +1 -1
- package/lib/generated/index.d.ts +4 -4
- package/lib/generated/index.js +4 -20
- package/lib/generated/index.js.map +1 -1
- package/lib/generated/results/api/v1/artifact.d.ts +3 -3
- package/lib/generated/results/api/v1/artifact.js +168 -171
- package/lib/generated/results/api/v1/artifact.js.map +1 -1
- package/lib/generated/results/api/v1/artifact.twirp-client.d.ts +1 -1
- package/lib/generated/results/api/v1/artifact.twirp-client.js +23 -28
- package/lib/generated/results/api/v1/artifact.twirp-client.js.map +1 -1
- package/lib/internal/client.d.ts +1 -1
- package/lib/internal/client.js +33 -37
- package/lib/internal/client.js.map +1 -1
- package/lib/internal/delete/delete-artifact.d.ts +1 -1
- package/lib/internal/delete/delete-artifact.js +25 -30
- package/lib/internal/delete/delete-artifact.js.map +1 -1
- package/lib/internal/download/download-artifact.d.ts +1 -1
- package/lib/internal/download/download-artifact.js +25 -57
- package/lib/internal/download/download-artifact.js.map +1 -1
- package/lib/internal/find/get-artifact.d.ts +1 -1
- package/lib/internal/find/get-artifact.js +23 -51
- package/lib/internal/find/get-artifact.js.map +1 -1
- package/lib/internal/find/list-artifacts.d.ts +1 -1
- package/lib/internal/find/list-artifacts.js +25 -30
- package/lib/internal/find/list-artifacts.js.map +1 -1
- package/lib/internal/find/retry-options.d.ts +1 -1
- package/lib/internal/find/retry-options.js +2 -29
- package/lib/internal/find/retry-options.js.map +1 -1
- package/lib/internal/shared/artifact-twirp-client.d.ts +1 -1
- package/lib/internal/shared/artifact-twirp-client.js +32 -36
- package/lib/internal/shared/artifact-twirp-client.js.map +1 -1
- package/lib/internal/shared/config.js +13 -27
- package/lib/internal/shared/config.js.map +1 -1
- package/lib/internal/shared/errors.js +6 -15
- package/lib/internal/shared/errors.js.map +1 -1
- package/lib/internal/shared/interfaces.js +1 -2
- package/lib/internal/shared/package-version.cjs +7 -0
- package/lib/internal/shared/user-agent.js +3 -8
- package/lib/internal/shared/user-agent.js.map +1 -1
- package/lib/internal/shared/util.js +13 -45
- package/lib/internal/shared/util.js.map +1 -1
- package/lib/internal/upload/blob-upload.d.ts +1 -1
- package/lib/internal/upload/blob-upload.js +13 -40
- package/lib/internal/upload/blob-upload.js.map +1 -1
- package/lib/internal/upload/path-and-artifact-name-validation.js +4 -9
- package/lib/internal/upload/path-and-artifact-name-validation.js.map +1 -1
- package/lib/internal/upload/retention.d.ts +1 -1
- package/lib/internal/upload/retention.js +4 -31
- package/lib/internal/upload/retention.js.map +1 -1
- package/lib/internal/upload/upload-artifact.d.ts +1 -1
- package/lib/internal/upload/upload-artifact.js +23 -50
- package/lib/internal/upload/upload-artifact.js.map +1 -1
- package/lib/internal/upload/upload-zip-specification.d.ts +0 -1
- package/lib/internal/upload/upload-zip-specification.js +13 -41
- package/lib/internal/upload/upload-zip-specification.js.map +1 -1
- package/lib/internal/upload/zip.d.ts +1 -2
- package/lib/internal/upload/zip.js +12 -40
- package/lib/internal/upload/zip.js.map +1 -1
- package/package.json +24 -16
|
@@ -1,27 +1,3 @@
|
|
|
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
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,15 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const errors_1 = require("../shared/errors");
|
|
42
|
-
function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
10
|
+
import { BlobClient } from '@azure/storage-blob';
|
|
11
|
+
import { getUploadChunkSize, getConcurrency, getUploadChunkTimeout } from '../shared/config.js';
|
|
12
|
+
import * as core from '@actions/core';
|
|
13
|
+
import * as crypto from 'crypto';
|
|
14
|
+
import * as stream from 'stream';
|
|
15
|
+
import { NetworkError } from '../shared/errors.js';
|
|
16
|
+
export function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
43
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
18
|
let uploadByteCount = 0;
|
|
45
19
|
let lastProgressTime = Date.now();
|
|
@@ -57,9 +31,9 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
|
57
31
|
});
|
|
58
32
|
});
|
|
59
33
|
});
|
|
60
|
-
const maxConcurrency =
|
|
61
|
-
const bufferSize =
|
|
62
|
-
const blobClient = new
|
|
34
|
+
const maxConcurrency = getConcurrency();
|
|
35
|
+
const bufferSize = getUploadChunkSize();
|
|
36
|
+
const blobClient = new BlobClient(authenticatedUploadURL);
|
|
63
37
|
const blockBlobClient = blobClient.getBlockBlobClient();
|
|
64
38
|
core.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`);
|
|
65
39
|
const uploadCallback = (progress) => {
|
|
@@ -81,12 +55,12 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
|
81
55
|
try {
|
|
82
56
|
yield Promise.race([
|
|
83
57
|
blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options),
|
|
84
|
-
chunkTimer(
|
|
58
|
+
chunkTimer(getUploadChunkTimeout())
|
|
85
59
|
]);
|
|
86
60
|
}
|
|
87
61
|
catch (error) {
|
|
88
|
-
if (
|
|
89
|
-
throw new
|
|
62
|
+
if (NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
|
|
63
|
+
throw new NetworkError(error === null || error === void 0 ? void 0 : error.code);
|
|
90
64
|
}
|
|
91
65
|
throw error;
|
|
92
66
|
}
|
|
@@ -106,5 +80,4 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
|
106
80
|
};
|
|
107
81
|
});
|
|
108
82
|
}
|
|
109
|
-
exports.uploadZipToBlobStorage = uploadZipToBlobStorage;
|
|
110
83
|
//# sourceMappingURL=blob-upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-upload.js","sourceRoot":"","sources":["../../../src/internal/upload/blob-upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blob-upload.js","sourceRoot":"","sources":["../../../src/internal/upload/blob-upload.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAA+B,MAAM,qBAAqB,CAAA;AAG5E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAA;AAchD,MAAM,UAAgB,sBAAsB,CAC1C,sBAA8B,EAC9B,eAAgC;;QAEhC,IAAI,eAAe,GAAG,CAAC,CAAA;QACvB,IAAI,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACjC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QAE7C,MAAM,UAAU,GAAG,CAAO,QAAgB,EAAiB,EAAE;YAC3D,OAAA,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;oBAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,gBAAgB,GAAG,QAAQ,EAAE,CAAC;wBAC7C,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAA;oBAC/C,CAAC;gBACH,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAEZ,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;oBACpD,aAAa,CAAC,KAAK,CAAC,CAAA;oBACpB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA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qBAAqB,EAAE,CAAC;aACpC,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,YAAY,CAAC,kBAAkB,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,YAAY,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAA;YACrC,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAA;QAEjE,UAAU,CAAC,GAAG,EAAE,CAAA;QAChB,UAAU,GAAG,UAAU,CAAC,IAAI,EAAY,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,6CAA6C,UAAU,EAAE,CAAC,CAAA;QAEpE,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CACV,wEAAwE,CACzE,CAAA;QACH,CAAC;QACD,OAAO;YACL,UAAU,EAAE,eAAe;YAC3B,UAAU;SACX,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateFilePath = exports.validateArtifactName = void 0;
|
|
4
|
-
const core_1 = require("@actions/core");
|
|
1
|
+
import { info } from '@actions/core';
|
|
5
2
|
/**
|
|
6
3
|
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
|
|
7
4
|
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
|
|
@@ -29,7 +26,7 @@ const invalidArtifactNameCharacters = new Map([
|
|
|
29
26
|
/**
|
|
30
27
|
* Validates the name of the artifact to check to make sure there are no illegal characters
|
|
31
28
|
*/
|
|
32
|
-
function validateArtifactName(name) {
|
|
29
|
+
export function validateArtifactName(name) {
|
|
33
30
|
if (!name) {
|
|
34
31
|
throw new Error(`Provided artifact name input during validation is empty`);
|
|
35
32
|
}
|
|
@@ -42,13 +39,12 @@ Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values())
|
|
|
42
39
|
These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`);
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
|
|
42
|
+
info(`Artifact name is valid!`);
|
|
46
43
|
}
|
|
47
|
-
exports.validateArtifactName = validateArtifactName;
|
|
48
44
|
/**
|
|
49
45
|
* Validates file paths to check for any illegal characters that can cause problems on different file systems
|
|
50
46
|
*/
|
|
51
|
-
function validateFilePath(path) {
|
|
47
|
+
export function validateFilePath(path) {
|
|
52
48
|
if (!path) {
|
|
53
49
|
throw new Error(`Provided file path input during validation is empty`);
|
|
54
50
|
}
|
|
@@ -63,5 +59,4 @@ The following characters are not allowed in files that are uploaded due to limit
|
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
|
-
exports.validateFilePath = validateFilePath;
|
|
67
62
|
//# sourceMappingURL=path-and-artifact-name-validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../../src/internal/upload/path-and-artifact-name-validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../../src/internal/upload/path-and-artifact-name-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAA;AAElC;;;;;;;GAOG;AACH,MAAM,iCAAiC,GAAG,IAAI,GAAG,CAAiB;IAChE,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,UAAU,CAAC;IACjB,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,CAAC,GAAG,EAAE,iBAAi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AA2D,IAAI,uCAAuC,wBAAwB;;8BAExG,KAAK,CAAC,IAAI,CAC9B,iCAAiC,CAAC,MAAM,EAAE,CAC3C,CAAC,QAAQ,EAAE;;;WAGT,CACJ,CAAA;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Timestamp } from '../../generated';
|
|
1
|
+
import { Timestamp } from '../../generated/index.js';
|
|
2
2
|
export declare function getExpiration(retentionDays?: number): Timestamp | undefined;
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getExpiration = void 0;
|
|
27
|
-
const generated_1 = require("../../generated");
|
|
28
|
-
const core = __importStar(require("@actions/core"));
|
|
29
|
-
function getExpiration(retentionDays) {
|
|
1
|
+
import { Timestamp } from '../../generated/index.js';
|
|
2
|
+
import * as core from '@actions/core';
|
|
3
|
+
export function getExpiration(retentionDays) {
|
|
30
4
|
if (!retentionDays) {
|
|
31
5
|
return undefined;
|
|
32
6
|
}
|
|
@@ -37,9 +11,8 @@ function getExpiration(retentionDays) {
|
|
|
37
11
|
}
|
|
38
12
|
const expirationDate = new Date();
|
|
39
13
|
expirationDate.setDate(expirationDate.getDate() + retentionDays);
|
|
40
|
-
return
|
|
14
|
+
return Timestamp.fromDate(expirationDate);
|
|
41
15
|
}
|
|
42
|
-
exports.getExpiration = getExpiration;
|
|
43
16
|
function getRetentionDays() {
|
|
44
17
|
const retentionDays = process.env['GITHUB_RETENTION_DAYS'];
|
|
45
18
|
if (!retentionDays) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../src/internal/upload/retention.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../src/internal/upload/retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,aAAa,CAAC,aAAsB;IAClD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,CAAA;IAC3C,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,aAAa,EAAE,CAAC;QACzD,IAAI,CAAC,OAAO,CACV,wGAAwG,gBAAgB,WAAW,CACpI,CAAA;QACD,aAAa,GAAG,gBAAgB,CAAA;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,IAAI,IAAI,EAAE,CAAA;IACjC,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,CAAA;IAEhE,OAAO,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAC1D,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;IACpC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UploadArtifactOptions, UploadArtifactResponse } from '../shared/interfaces';
|
|
1
|
+
import { UploadArtifactOptions, UploadArtifactResponse } from '../shared/interfaces.js';
|
|
2
2
|
export declare function uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadArtifactOptions | undefined): Promise<UploadArtifactResponse>;
|
|
@@ -1,27 +1,3 @@
|
|
|
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
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,30 +7,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const errors_1 = require("../shared/errors");
|
|
46
|
-
function uploadArtifact(name, files, rootDirectory, options) {
|
|
10
|
+
import * as core from '@actions/core';
|
|
11
|
+
import { getExpiration } from './retention.js';
|
|
12
|
+
import { validateArtifactName } from './path-and-artifact-name-validation.js';
|
|
13
|
+
import { internalArtifactTwirpClient } from '../shared/artifact-twirp-client.js';
|
|
14
|
+
import { getUploadZipSpecification, validateRootDirectory } from './upload-zip-specification.js';
|
|
15
|
+
import { getBackendIdsFromToken } from '../shared/util.js';
|
|
16
|
+
import { uploadZipToBlobStorage } from './blob-upload.js';
|
|
17
|
+
import { createZipUploadStream } from './zip.js';
|
|
18
|
+
import { StringValue } from '../../generated/index.js';
|
|
19
|
+
import { FilesNotFoundError, InvalidResponseError } from '../shared/errors.js';
|
|
20
|
+
export function uploadArtifact(name, files, rootDirectory, options) {
|
|
47
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const zipSpecification =
|
|
22
|
+
validateArtifactName(name);
|
|
23
|
+
validateRootDirectory(rootDirectory);
|
|
24
|
+
const zipSpecification = getUploadZipSpecification(files, rootDirectory);
|
|
51
25
|
if (zipSpecification.length === 0) {
|
|
52
|
-
throw new
|
|
26
|
+
throw new FilesNotFoundError(zipSpecification.flatMap(s => (s.sourcePath ? [s.sourcePath] : [])));
|
|
53
27
|
}
|
|
54
28
|
// get the IDs needed for the artifact creation
|
|
55
|
-
const backendIds =
|
|
29
|
+
const backendIds = getBackendIdsFromToken();
|
|
56
30
|
// create the artifact client
|
|
57
|
-
const artifactClient =
|
|
31
|
+
const artifactClient = internalArtifactTwirpClient();
|
|
58
32
|
// create the artifact
|
|
59
33
|
const createArtifactReq = {
|
|
60
34
|
workflowRunBackendId: backendIds.workflowRunBackendId,
|
|
@@ -63,17 +37,17 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|
|
63
37
|
version: 4
|
|
64
38
|
};
|
|
65
39
|
// if there is a retention period, add it to the request
|
|
66
|
-
const expiresAt =
|
|
40
|
+
const expiresAt = getExpiration(options === null || options === void 0 ? void 0 : options.retentionDays);
|
|
67
41
|
if (expiresAt) {
|
|
68
42
|
createArtifactReq.expiresAt = expiresAt;
|
|
69
43
|
}
|
|
70
44
|
const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq);
|
|
71
45
|
if (!createArtifactResp.ok) {
|
|
72
|
-
throw new
|
|
46
|
+
throw new InvalidResponseError('CreateArtifact: response from backend was not ok');
|
|
73
47
|
}
|
|
74
|
-
const zipUploadStream = yield
|
|
48
|
+
const zipUploadStream = yield createZipUploadStream(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
|
|
75
49
|
// Upload zip to blob storage
|
|
76
|
-
const uploadResult = yield
|
|
50
|
+
const uploadResult = yield uploadZipToBlobStorage(createArtifactResp.signedUploadUrl, zipUploadStream);
|
|
77
51
|
// finalize the artifact
|
|
78
52
|
const finalizeArtifactReq = {
|
|
79
53
|
workflowRunBackendId: backendIds.workflowRunBackendId,
|
|
@@ -82,14 +56,14 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|
|
82
56
|
size: uploadResult.uploadSize ? uploadResult.uploadSize.toString() : '0'
|
|
83
57
|
};
|
|
84
58
|
if (uploadResult.sha256Hash) {
|
|
85
|
-
finalizeArtifactReq.hash =
|
|
59
|
+
finalizeArtifactReq.hash = StringValue.create({
|
|
86
60
|
value: `sha256:${uploadResult.sha256Hash}`
|
|
87
61
|
});
|
|
88
62
|
}
|
|
89
63
|
core.info(`Finalizing artifact upload`);
|
|
90
64
|
const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq);
|
|
91
65
|
if (!finalizeArtifactResp.ok) {
|
|
92
|
-
throw new
|
|
66
|
+
throw new InvalidResponseError('FinalizeArtifact: response from backend was not ok');
|
|
93
67
|
}
|
|
94
68
|
const artifactId = BigInt(finalizeArtifactResp.artifactId);
|
|
95
69
|
core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`);
|
|
@@ -100,5 +74,4 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|
|
100
74
|
};
|
|
101
75
|
});
|
|
102
76
|
}
|
|
103
|
-
exports.uploadArtifact = uploadArtifact;
|
|
104
77
|
//# sourceMappingURL=upload-artifact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-artifact.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-artifact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-artifact.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-artifact.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAKrC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAA;AAC3E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,CAAA;QACH,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;QAC1D,IAAI,CAAC,IAAI,CACP,YAAY,IAAI,4CAA4C,UAAU,EAAE,CACzE,CAAA;QAED,OAAO;YACL,IAAI,EAAE,YAAY,CAAC,UAAU;YAC7B,MAAM,EAAE,YAAY,CAAC,UAAU;YAC/B,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC;SACvB,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -1,57 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getUploadZipSpecification = exports.validateRootDirectory = void 0;
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const core_1 = require("@actions/core");
|
|
29
|
-
const path_1 = require("path");
|
|
30
|
-
const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { info } from '@actions/core';
|
|
3
|
+
import { normalize, resolve } from 'path';
|
|
4
|
+
import { validateFilePath } from './path-and-artifact-name-validation.js';
|
|
31
5
|
/**
|
|
32
6
|
* Checks if a root directory exists and is valid
|
|
33
7
|
* @param rootDirectory an absolute root directory path common to all input files that that will be trimmed from the final zip structure
|
|
34
8
|
*/
|
|
35
|
-
function validateRootDirectory(rootDirectory) {
|
|
9
|
+
export function validateRootDirectory(rootDirectory) {
|
|
36
10
|
if (!fs.existsSync(rootDirectory)) {
|
|
37
11
|
throw new Error(`The provided rootDirectory ${rootDirectory} does not exist`);
|
|
38
12
|
}
|
|
39
13
|
if (!fs.statSync(rootDirectory).isDirectory()) {
|
|
40
14
|
throw new Error(`The provided rootDirectory ${rootDirectory} is not a valid directory`);
|
|
41
15
|
}
|
|
42
|
-
|
|
16
|
+
info(`Root directory input is valid!`);
|
|
43
17
|
}
|
|
44
|
-
exports.validateRootDirectory = validateRootDirectory;
|
|
45
18
|
/**
|
|
46
19
|
* Creates a specification that describes how a zip file will be created for a set of input files
|
|
47
20
|
* @param filesToZip a list of file that should be included in the zip
|
|
48
21
|
* @param rootDirectory an absolute root directory path common to all input files that that will be trimmed from the final zip structure
|
|
49
22
|
*/
|
|
50
|
-
function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
23
|
+
export function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
51
24
|
const specification = [];
|
|
52
25
|
// Normalize and resolve, this allows for either absolute or relative paths to be used
|
|
53
|
-
rootDirectory =
|
|
54
|
-
rootDirectory =
|
|
26
|
+
rootDirectory = normalize(rootDirectory);
|
|
27
|
+
rootDirectory = resolve(rootDirectory);
|
|
55
28
|
/*
|
|
56
29
|
Example
|
|
57
30
|
|
|
@@ -85,14 +58,14 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
|
85
58
|
}
|
|
86
59
|
if (!stats.isDirectory()) {
|
|
87
60
|
// Normalize and resolve, this allows for either absolute or relative paths to be used
|
|
88
|
-
file =
|
|
89
|
-
file =
|
|
61
|
+
file = normalize(file);
|
|
62
|
+
file = resolve(file);
|
|
90
63
|
if (!file.startsWith(rootDirectory)) {
|
|
91
64
|
throw new Error(`The rootDirectory: ${rootDirectory} is not a parent directory of the file: ${file}`);
|
|
92
65
|
}
|
|
93
66
|
// Check for forbidden characters in file paths that may cause ambiguous behavior if downloaded on different file systems
|
|
94
67
|
const uploadPath = file.replace(rootDirectory, '');
|
|
95
|
-
|
|
68
|
+
validateFilePath(uploadPath);
|
|
96
69
|
specification.push({
|
|
97
70
|
sourcePath: file,
|
|
98
71
|
destinationPath: uploadPath,
|
|
@@ -102,7 +75,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
|
102
75
|
else {
|
|
103
76
|
// Empty directory
|
|
104
77
|
const directoryPath = file.replace(rootDirectory, '');
|
|
105
|
-
|
|
78
|
+
validateFilePath(directoryPath);
|
|
106
79
|
specification.push({
|
|
107
80
|
sourcePath: null,
|
|
108
81
|
destinationPath: directoryPath,
|
|
@@ -112,5 +85,4 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
|
112
85
|
}
|
|
113
86
|
return specification;
|
|
114
87
|
}
|
|
115
|
-
exports.getUploadZipSpecification = getUploadZipSpecification;
|
|
116
88
|
//# sourceMappingURL=upload-zip-specification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zip-specification.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-zip-specification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-zip-specification.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-zip-specification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAA;AAClC,OAAO,EAAC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,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CACb,sBAAsB,aAAa,2CAA2C,IAAI,EAAE,CACrF,CAAA;YACH,CAAC;YAED,yHAAyH;YACzH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YAClD,gBAAgB,CAAC,UAAU,CAAC,CAAA;YAE5B,aAAa,CAAC,IAAI,CAAC;gBACjB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,UAAU;gBAC3B,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,kBAAkB;YAClB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YACrD,gBAAgB,CAAC,aAAa,CAAC,CAAA;YAE/B,aAAa,CAAC,IAAI,CAAC;gBACjB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,aAAa;gBAC9B,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as stream from 'stream';
|
|
3
|
-
import { UploadZipSpecification } from './upload-zip-specification';
|
|
2
|
+
import { UploadZipSpecification } from './upload-zip-specification.js';
|
|
4
3
|
export declare const DEFAULT_COMPRESSION_LEVEL = 6;
|
|
5
4
|
export declare class ZipUploadStream extends stream.Transform {
|
|
6
5
|
constructor(bufferSize: number);
|
|
@@ -1,27 +1,3 @@
|
|
|
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
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,17 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const config_1 = require("../shared/config");
|
|
41
|
-
exports.DEFAULT_COMPRESSION_LEVEL = 6;
|
|
10
|
+
import * as stream from 'stream';
|
|
11
|
+
import { realpath } from 'fs/promises';
|
|
12
|
+
import archiver from 'archiver';
|
|
13
|
+
import * as core from '@actions/core';
|
|
14
|
+
import { getUploadChunkSize } from '../shared/config.js';
|
|
15
|
+
export const DEFAULT_COMPRESSION_LEVEL = 6;
|
|
42
16
|
// Custom stream transformer so we can set the highWaterMark property
|
|
43
17
|
// See https://github.com/nodejs/node/issues/8855
|
|
44
|
-
class ZipUploadStream extends stream.Transform {
|
|
18
|
+
export class ZipUploadStream extends stream.Transform {
|
|
45
19
|
constructor(bufferSize) {
|
|
46
20
|
super({
|
|
47
21
|
highWaterMark: bufferSize
|
|
@@ -52,12 +26,11 @@ class ZipUploadStream extends stream.Transform {
|
|
|
52
26
|
cb(null, chunk);
|
|
53
27
|
}
|
|
54
28
|
}
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) {
|
|
29
|
+
export function createZipUploadStream(uploadSpecification_1) {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = DEFAULT_COMPRESSION_LEVEL) {
|
|
58
31
|
core.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`);
|
|
59
32
|
const zip = archiver.create('zip', {
|
|
60
|
-
highWaterMark:
|
|
33
|
+
highWaterMark: getUploadChunkSize(),
|
|
61
34
|
zlib: { level: compressionLevel }
|
|
62
35
|
});
|
|
63
36
|
// register callbacks for various events during the zip lifecycle
|
|
@@ -70,7 +43,7 @@ function createZipUploadStream(uploadSpecification_1) {
|
|
|
70
43
|
// Check if symlink and resolve the source path
|
|
71
44
|
let sourcePath = file.sourcePath;
|
|
72
45
|
if (file.stats.isSymbolicLink()) {
|
|
73
|
-
sourcePath = yield
|
|
46
|
+
sourcePath = yield realpath(file.sourcePath);
|
|
74
47
|
}
|
|
75
48
|
// Add the file to the zip
|
|
76
49
|
zip.file(sourcePath, {
|
|
@@ -82,7 +55,7 @@ function createZipUploadStream(uploadSpecification_1) {
|
|
|
82
55
|
zip.append('', { name: file.destinationPath });
|
|
83
56
|
}
|
|
84
57
|
}
|
|
85
|
-
const bufferSize =
|
|
58
|
+
const bufferSize = getUploadChunkSize();
|
|
86
59
|
const zipUploadStream = new ZipUploadStream(bufferSize);
|
|
87
60
|
core.debug(`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`);
|
|
88
61
|
core.debug(`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`);
|
|
@@ -91,7 +64,6 @@ function createZipUploadStream(uploadSpecification_1) {
|
|
|
91
64
|
return zipUploadStream;
|
|
92
65
|
});
|
|
93
66
|
}
|
|
94
|
-
exports.createZipUploadStream = createZipUploadStream;
|
|
95
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
68
|
const zipErrorCallback = (error) => {
|
|
97
69
|
core.error('An error has occurred while creating the zip file for upload');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../../src/internal/upload/zip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../../src/internal/upload/zip.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAA;AAE1C,qEAAqE;AACrE,iDAAiD;AACjD,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,SAAS;IACnD,YAAY,UAAkB;QAC5B,KAAK,CAAC;YACJ,aAAa,EAAE,UAAU;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED,8DAA8D;IAC9D,UAAU,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAO;QACtC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACjB,CAAC;CACF;AAED,MAAM,UAAgB,qBAAqB;yDACzC,mBAA6C,EAC7C,mBAA2B,yBAAyB;QA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