diff --git a/action.yml b/action.yml index 3c1d091..c69f53b 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ inputs: # Use this to enable PR comments from endorctl. This is only applicable when a workflow is triggered by a PR. enable_pr_comments: description: >- - "Set to `true` to publish new findings as review comments. Must be used together with `pr` and `github_token`. + "Set to `true` to publish new findings as review comments. Must be used together with `pr` and `github_token`. Additionally, the `issues: write` and `pull-requests: write` permissions must be set in the workflow." default: false # Use this to set the endorctl checksum. @@ -47,7 +47,7 @@ inputs: endorctl_version: description: >- "Set to a version of endorctl to pin this specific version for use. Defaults to the latest version." - # Use this to enable/disable the artifact export. Works only with "json" output type. + # Use this to enable/disable the artifact export. Works only with "json" output type. # The artifact name will be "endor-scan" and the json output file name will be "result-.json" export_scan_result_artifact: description: >- @@ -56,7 +56,7 @@ inputs: # Use this to define your gcp service account. gcp_service_account: description: >- - "Set the target service account for GCP based authentication. GCP authentication is only enabled if this flag is set. + "Set the target service account for GCP based authentication. GCP authentication is only enabled if this flag is set. Cannot be used with `api_key`." # Use this to provide the github token for your repo. github_token: @@ -92,7 +92,7 @@ inputs: # Note that the findings are still created, but they will not block the commit unless they are new. pr_baseline: description: >- - 'Set the baseline branch to enable action policies to only act on new findings. + 'Set the baseline branch to enable action policies to only act on new findings. Must be used together with `pr` Example: `pr_baseline: "main"`.' # Use this to control if `time -v` wraps runs. run_stats: @@ -133,7 +133,7 @@ inputs: # Scan all commits for exposed secrets. scan_git_logs: description: >- - "Perform a more complete and detailed scan of secrets in the repository history. + "Perform a more complete and detailed scan of secrets in the repository history. Must be used together with `scan_secrets`." default: false # Scan github action workflow files @@ -153,7 +153,7 @@ inputs: default: false # Scan source code for SAST. scan_sast: - description: >- + description: >- "Scan source code repository and generate findings for SAST." default: false # Scan source code for AI models. @@ -176,14 +176,14 @@ inputs: description: >- "Enable the usage of Bazel for the scan." bazel_exclude_targets: - description: >- - "Specify a a list of Bazel targets to exclude from scan." + description: >- + "Specify a a list of Bazel targets to exclude from scan." bazel_include_targets: - description: >- - "Specify a list of Bazel targets to scan. If `bazel_targets_include` is not set the `bazel_targets_query` value is used to determine with bazel targets to scan." + description: >- + "Specify a list of Bazel targets to scan. If `bazel_targets_include` is not set the `bazel_targets_query` value is used to determine with bazel targets to scan." bazel_targets_query: - description: >- - "Specify a Bazel query to determine with Bazel targets to scan. Ignored if `bazel_targets_include` is set." + description: >- + "Specify a Bazel query to determine with Bazel targets to scan. Ignored if `bazel_targets_include` is set." # Scan for phantom dependencies phantom_dependencies: default: false diff --git a/dist/index.js b/dist/index.js index c138884..e18c947 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3412,9 +3412,9 @@ function validateArtifactName(name) { for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactNameCharacters) { if (name.includes(invalidCharacterKey)) { throw new Error(`The artifact name is not valid: ${name}. Contains the following character: ${errorMessageForCharacter} - + Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values()).toString()} - + 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.`); } } @@ -3431,9 +3431,9 @@ function validateFilePath(path) { for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) { if (path.includes(invalidCharacterKey)) { throw new Error(`The path for one of the files in artifact is not valid: ${path}. Contains the following character: ${errorMessageForCharacter} - + Invalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()} - + The following characters are not allowed in files that are uploaded 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. `); } @@ -3675,7 +3675,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) { rootDirectory = (0, path_1.resolve)(rootDirectory); /* Example - + Input: rootDirectory: '/home/user/files/plz-upload' artifactFiles: [ @@ -3683,16 +3683,16 @@ function getUploadZipSpecification(filesToZip, rootDirectory) { '/home/user/files/plz-upload/file2.txt', '/home/user/files/plz-upload/dir/file3.txt' ] - + Output: specifications: [ ['/home/user/files/plz-upload/file1.txt', '/file1.txt'], ['/home/user/files/plz-upload/file1.txt', '/file2.txt'], ['/home/user/files/plz-upload/file1.txt', '/dir/file3.txt'] ] - + The final zip that is later uploaded will look like this: - + my-artifact.zip - file.txt - file2.txt @@ -4434,8 +4434,8 @@ class OidcClient { const res = yield httpclient .getJson(id_token_url) .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; @@ -7149,8 +7149,8 @@ class OidcClient { const res = yield httpclient .getJson(id_token_url) .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; @@ -11290,8 +11290,8 @@ class OidcClient { const res = yield httpclient .getJson(id_token_url) .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n Error Message: ${error.result.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; @@ -12526,7 +12526,7 @@ class BaseRequestPolicy { /** * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline. */ - _nextPolicy, + _nextPolicy, /** * The options that can be passed to a given request policy. */ @@ -31888,7 +31888,7 @@ class BlobClient extends StorageClient { get containerName() { return this._containerName; } - constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, + constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -32853,7 +32853,7 @@ class BlobClient extends StorageClient { * AppendBlobClient defines a set of operations applicable to append blobs. */ class AppendBlobClient extends BlobClient { - constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, + constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -33098,7 +33098,7 @@ class AppendBlobClient extends BlobClient { * BlockBlobClient defines a set of operations applicable to block blobs. */ class BlockBlobClient extends BlobClient { - constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, + constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -33661,7 +33661,7 @@ class BlockBlobClient extends BlobClient { if (options.onProgress) { options.onProgress({ loadedBytes: transferProgress }); } - }, + }, // concurrency should set a smaller value than maxConcurrency, which is helpful to // reduce the possibility when a outgoing handler waits for stream data, in // this situation, outgoing handlers are blocked. @@ -33676,7 +33676,7 @@ class BlockBlobClient extends BlobClient { * PageBlobClient defines a set of operations applicable to page blobs. */ class PageBlobClient extends BlobClient { - constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, + constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, blobNameOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -34878,7 +34878,7 @@ function batchHeaderFilterPolicy() { * @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch */ class BlobBatchClient { - constructor(url, credentialOrPipeline, + constructor(url, credentialOrPipeline, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -34910,7 +34910,7 @@ class BlobBatchClient { createBatch() { return new BlobBatch(); } - async deleteBlobs(urlsOrBlobClients, credentialOrOptions, + async deleteBlobs(urlsOrBlobClients, credentialOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -34925,7 +34925,7 @@ class BlobBatchClient { } return this.submitBatch(batch); } - async setBlobsAccessTier(urlsOrBlobClients, credentialOrTier, tierOrOptions, + async setBlobsAccessTier(urlsOrBlobClients, credentialOrTier, tierOrOptions, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -35012,7 +35012,7 @@ class ContainerClient extends StorageClient { get containerName() { return this._containerName; } - constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, + constructor(urlOrConnectionString, credentialOrPipelineOrContainerName, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -36657,7 +36657,7 @@ class BlobServiceClient extends StorageClient { * `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString` * @param options - Optional. Options to configure the HTTP pipeline. */ - static fromConnectionString(connectionString, + static fromConnectionString(connectionString, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -36684,7 +36684,7 @@ class BlobServiceClient extends StorageClient { throw new Error("Connection string must be either an Account connection string or a SAS connection string"); } } - constructor(url, credentialOrPipeline, + constructor(url, credentialOrPipeline, // Legacy, no fix for eslint error without breaking. Disable it for this interface. /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/ options) { @@ -41807,7 +41807,7 @@ class BinaryWriter { * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint. */ sint64(value) { - let long = pb_long_1.PbLong.from(value), + let long = pb_long_1.PbLong.from(value), // zigzag encode sign = long.hi >> 31, lo = (long.lo << 1) ^ sign, hi = ((long.hi << 1) | (long.lo >>> 31)) ^ sign; goog_varint_1.varint64write(lo, hi, this.buf); @@ -45567,8 +45567,8 @@ utils.walkdir = function(dirpath, base, callback) { res.forEach(function(dirEntry) { results.push(dirEntry); }); - - next(); + + next(); }); } else { next(); @@ -45651,7 +45651,7 @@ vending.registerFormat = function(format, module) { /** * Check if the format is already registered. - * + * * @param {String} format the name of the format. * @return boolean */ @@ -45659,7 +45659,7 @@ vending.isRegisteredFormat = function (format) { if (formats[format]) { return true; } - + return false; }; @@ -53643,7 +53643,7 @@ exports = module.exports = function (bufOrEm, eventName) { if (Buffer.isBuffer(bufOrEm)) { return exports.parse(bufOrEm); } - + var s = exports.stream(); if (bufOrEm && bufOrEm.pipe) { bufOrEm.pipe(s); @@ -53652,7 +53652,7 @@ exports = module.exports = function (bufOrEm, eventName) { bufOrEm.on(eventName || 'data', function (buf) { s.write(buf); }); - + bufOrEm.on('end', function () { s.end(); }); @@ -53662,7 +53662,7 @@ exports = module.exports = function (bufOrEm, eventName) { exports.stream = function (input) { if (input) return exports.apply(null, arguments); - + var pending = null; function getBytes (bytes, cb, skip) { pending = { @@ -53675,7 +53675,7 @@ exports.stream = function (input) { }; dispatch(); } - + var offset = null; function dispatch () { if (!pending) { @@ -53687,7 +53687,7 @@ exports.stream = function (input) { } else { var bytes = offset + pending.bytes; - + if (buffers.length >= bytes) { var buf; if (offset == null) { @@ -53702,7 +53702,7 @@ exports.stream = function (input) { } offset = bytes; } - + if (pending.skip) { pending.cb(); } @@ -53712,10 +53712,10 @@ exports.stream = function (input) { } } } - + function builder (saw) { function next () { if (!done) saw.next() } - + var self = words(function (bytes, cb) { return function (name) { getBytes(bytes, function (buf) { @@ -53724,16 +53724,16 @@ exports.stream = function (input) { }); }; }); - + self.tap = function (cb) { saw.nest(cb, vars.store); }; - + self.into = function (key, cb) { if (!vars.get(key)) vars.set(key, {}); var parent = vars; vars = Vars(parent.get(key)); - + saw.nest(function () { cb.apply(this, arguments); this.tap(function () { @@ -53741,15 +53741,15 @@ exports.stream = function (input) { }); }, vars.store); }; - + self.flush = function () { vars.store = {}; next(); }; - + self.loop = function (cb) { var end = false; - + saw.nest(false, function loop () { this.vars = vars.store; cb.call(this, function () { @@ -53762,28 +53762,28 @@ exports.stream = function (input) { }.bind(this)); }, vars.store); }; - + self.buffer = function (name, bytes) { if (typeof bytes === 'string') { bytes = vars.get(bytes); } - + getBytes(bytes, function (buf) { vars.set(name, buf); next(); }); }; - + self.skip = function (bytes) { if (typeof bytes === 'string') { bytes = vars.get(bytes); } - + getBytes(bytes, function () { next(); }); }; - + self.scan = function find (name, search) { if (typeof search === 'string') { search = new Buffer(search); @@ -53791,7 +53791,7 @@ exports.stream = function (input) { else if (!Buffer.isBuffer(search)) { throw new Error('search must be a Buffer or a string'); } - + var taken = 0; pending = function () { var pos = buffers.indexOf(search, offset + taken); @@ -53821,7 +53821,7 @@ exports.stream = function (input) { }; dispatch(); }; - + self.peek = function (cb) { offset = 0; saw.nest(function () { @@ -53831,32 +53831,32 @@ exports.stream = function (input) { }); }); }; - + return self; }; - + var stream = Chainsaw.light(builder); stream.writable = true; - + var buffers = Buffers(); - + stream.write = function (buf) { buffers.push(buf); dispatch(); }; - + var vars = Vars(); - + var done = false, caughtEnd = false; stream.end = function () { caughtEnd = true; }; - + stream.pipe = Stream.prototype.pipe; Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) { stream[name] = EventEmitter.prototype[name]; }); - + return stream; }; @@ -53874,16 +53874,16 @@ exports.parse = function parse (buffer) { return self; }; }); - + var offset = 0; var vars = Vars(); self.vars = vars.store; - + self.tap = function (cb) { cb.call(self, vars.store); return self; }; - + self.into = function (key, cb) { if (!vars.get(key)) { vars.set(key, {}); @@ -53894,7 +53894,7 @@ exports.parse = function parse (buffer) { vars = parent; return self; }; - + self.loop = function (cb) { var end = false; var ender = function () { end = true }; @@ -53903,7 +53903,7 @@ exports.parse = function parse (buffer) { } return self; }; - + self.buffer = function (name, size) { if (typeof size === 'string') { size = vars.get(size); @@ -53911,19 +53911,19 @@ exports.parse = function parse (buffer) { var buf = buffer.slice(offset, Math.min(buffer.length, offset + size)); offset += size; vars.set(name, buf); - + return self; }; - + self.skip = function (bytes) { if (typeof bytes === 'string') { bytes = vars.get(bytes); } offset += bytes; - + return self; }; - + self.scan = function (name, search) { if (typeof search === 'string') { search = new Buffer(search); @@ -53932,7 +53932,7 @@ exports.parse = function parse (buffer) { throw new Error('search must be a Buffer or a string'); } vars.set(name, null); - + // simple but slow string search for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) { for ( @@ -53942,28 +53942,28 @@ exports.parse = function parse (buffer) { ); if (j === search.length) break; } - + vars.set(name, buffer.slice(offset, offset + i)); offset += i + search.length; return self; }; - + self.peek = function (cb) { var was = offset; cb.call(self, vars.store); offset = was; return self; }; - + self.flush = function () { vars.store = {}; return self; }; - + self.eof = function () { return offset >= buffer.length; }; - + return self; }; @@ -54005,29 +54005,29 @@ function decodeLEs (bytes) { function words (decode) { var self = {}; - + [ 1, 2, 4, 8 ].forEach(function (bytes) { var bits = bytes * 8; - + self['word' + bits + 'le'] = self['word' + bits + 'lu'] = decode(bytes, decodeLEu); - + self['word' + bits + 'ls'] = decode(bytes, decodeLEs); - + self['word' + bits + 'be'] = self['word' + bits + 'bu'] = decode(bytes, decodeBEu); - + self['word' + bits + 'bs'] = decode(bytes, decodeBEs); }); - + // word8be(n) == word8le(n) for all n self.word8 = self.word8u = self.word8be; self.word8s = self.word8bs; - + return self; } @@ -54053,7 +54053,7 @@ module.exports = function (store) { return node[key] = value; } } - + var vars = { get : function (name) { return getset(name); @@ -55708,7 +55708,7 @@ function expand(str, isTop) { ? expand(m.post, false) : ['']; - if (/\$$/.test(m.pre)) { + if (/\$$/.test(m.pre)) { for (var k = 0; k < post.length; k++) { var expansion = pre+ '{' + m.body + '}' + post[k]; expansions.push(expansion); @@ -55828,7 +55828,7 @@ Buffers.prototype.push = function () { throw new TypeError('Tried to push a non-buffer'); } } - + for (var i = 0; i < arguments.length; i++) { var buf = arguments[i]; this.buffers.push(buf); @@ -55843,7 +55843,7 @@ Buffers.prototype.unshift = function () { throw new TypeError('Tried to unshift a non-buffer'); } } - + for (var i = 0; i < arguments.length; i++) { var buf = arguments[i]; this.buffers.unshift(buf); @@ -55860,46 +55860,46 @@ Buffers.prototype.splice = function (i, howMany) { var buffers = this.buffers; var index = i >= 0 ? i : this.length - i; var reps = [].slice.call(arguments, 2); - + if (howMany === undefined) { howMany = this.length - index; } else if (howMany > this.length - index) { howMany = this.length - index; } - + for (var i = 0; i < reps.length; i++) { this.length += reps[i].length; } - + var removed = new Buffers(); var bytes = 0; - + var startBytes = 0; for ( var ii = 0; ii < buffers.length && startBytes + buffers[ii].length < index; ii ++ ) { startBytes += buffers[ii].length } - + if (index - startBytes > 0) { var start = index - startBytes; - + if (start + howMany < buffers[ii].length) { removed.push(buffers[ii].slice(start, start + howMany)); - + var orig = buffers[ii]; //var buf = new Buffer(orig.length - howMany); var buf0 = new Buffer(start); for (var i = 0; i < start; i++) { buf0[i] = orig[i]; } - + var buf1 = new Buffer(orig.length - start - howMany); for (var i = start + howMany; i < orig.length; i++) { buf1[ i - howMany - start ] = orig[i] } - + if (reps.length > 0) { var reps_ = reps.slice(); reps_.unshift(buf0); @@ -55920,17 +55920,17 @@ Buffers.prototype.splice = function (i, howMany) { ii ++; } } - + if (reps.length > 0) { buffers.splice.apply(buffers, [ ii, 0 ].concat(reps)); ii += reps.length; } - + while (removed.length < howMany) { var buf = buffers[ii]; var len = buf.length; var take = Math.min(len, howMany - removed.length); - + if (take === len) { removed.push(buf); buffers.splice(ii, 1); @@ -55940,42 +55940,42 @@ Buffers.prototype.splice = function (i, howMany) { buffers[ii] = buffers[ii].slice(take); } } - + this.length -= removed.length; - + return removed; }; - + Buffers.prototype.slice = function (i, j) { var buffers = this.buffers; if (j === undefined) j = this.length; if (i === undefined) i = 0; - + if (j > this.length) j = this.length; - + var startBytes = 0; for ( var si = 0; si < buffers.length && startBytes + buffers[si].length <= i; si ++ ) { startBytes += buffers[si].length } - + var target = new Buffer(j - i); - + var ti = 0; for (var ii = si; ti < j - i && ii < buffers.length; ii++) { var len = buffers[ii].length; - + var start = ti === 0 ? i - startBytes : 0; var end = ti + len >= j - i ? Math.min(start + (j - i) - ti, len) : len ; - + buffers[ii].copy(target, ti, start, end); ti += end - start; } - + return target; }; @@ -57863,7 +57863,7 @@ CRC32.str = crc32_str; * https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT */ - + const {Transform} = __nccwpck_require__(45193); @@ -60767,7 +60767,7 @@ exports.validate = function (xmlData, options) { // check for byte order mark (BOM) xmlData = xmlData.substr(1); } - + for (let i = 0; i < xmlData.length; i++) { if (xmlData[i] === '<' && xmlData[i+1] === '?') { @@ -60779,7 +60779,7 @@ exports.validate = function (xmlData, options) { //read until you reach to '>' avoiding any '>' in attribute value let tagStartPos = i; i++; - + if (xmlData[i] === '!') { i = readCommentAndCDATA(xmlData, i); continue; @@ -61370,12 +61370,12 @@ Builder.prototype.buildObjectNode = function(val, key, attrStr, level) { let tagEndExp = '' + val + tagEndExp ); @@ -61420,11 +61420,11 @@ Builder.prototype.buildTextValNode = function(val, key, attrStr, level) { }else if (this.options.commentPropName !== false && key === this.options.commentPropName) { return this.indentate(level) + `` + this.newLine; }else if(key[0] === "?") {//PI tag - return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; + return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; }else{ let textValue = this.options.tagValueProcessor(key, val); textValue = this.replaceEntitiesValue(textValue); - + if( textValue === ''){ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar; }else{ @@ -61468,10 +61468,10 @@ module.exports = Builder; const EOL = "\n"; /** - * - * @param {array} jArray - * @param {any} options - * @returns + * + * @param {array} jArray + * @param {any} options + * @returns */ function toXml(jArray, options) { let indentation = ""; @@ -61611,7 +61611,7 @@ const util = __nccwpck_require__(38280); //TODO: handle comments function readDocType(xmlData, i){ - + const entities = {}; if( xmlData[i + 3] === 'O' && xmlData[i + 4] === 'C' && @@ -61619,7 +61619,7 @@ function readDocType(xmlData, i){ xmlData[i + 6] === 'Y' && xmlData[i + 7] === 'P' && xmlData[i + 8] === 'E') - { + { i = i+9; let angleBracketsCount = 1; let hasBody = false, comment = false; @@ -61627,7 +61627,7 @@ function readDocType(xmlData, i){ for(;i - + //read EntityName let entityName = ""; for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) { // if(xmlData[i] === " ") continue; - // else + // else entityName += xmlData[i]; } entityName = entityName.trim(); @@ -61807,7 +61807,7 @@ const defaultOptions = { }, // skipEmptyListItem: false }; - + const buildOptions = function(options) { return Object.assign({}, defaultOptions, options); }; @@ -61909,7 +61909,7 @@ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, } if(val.length > 0){ if(!escapeEntities) val = this.replaceEntitiesValue(val); - + const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode); if(newval === null || newval === undefined){ //don't parse @@ -62062,10 +62062,10 @@ const parseXml = function(xmlData) { if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){ }else{ - + const childNode = new xmlNode(tagData.tagName); childNode.add(this.options.textNodeName, ""); - + if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); } @@ -62104,7 +62104,7 @@ const parseXml = function(xmlData) { }else{ currentNode.add(this.options.textNodeName, val); } - + i = closeIndex + 2; }else {//Opening tag let result = readTagExp(xmlData,i, this.options.removeNSPrefix); @@ -62117,7 +62117,7 @@ const parseXml = function(xmlData) { if (this.options.transformTagName) { tagName = this.options.transformTagName(tagName); } - + //save text as child node if (currentNode && textData) { if(currentNode.tagname !== '!xml'){ @@ -62150,7 +62150,7 @@ const parseXml = function(xmlData) { } //unpaired tag else if(this.options.unpairedTags.indexOf(tagName) !== -1){ - + i = result.closeIndex; } //normal tag @@ -62169,10 +62169,10 @@ const parseXml = function(xmlData) { if(tagContent) { tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); } - + jPath = jPath.substr(0, jPath.lastIndexOf(".")); childNode.add(this.options.textNodeName, tagContent); - + this.addChild(currentNode, childNode, jPath) }else{ //selfClosing tag @@ -62184,7 +62184,7 @@ const parseXml = function(xmlData) { }else{ tagExp = tagExp.substr(0, tagExp.length - 1); } - + if(this.options.transformTagName) { tagName = this.options.transformTagName(tagName); } @@ -62200,7 +62200,7 @@ const parseXml = function(xmlData) { else{ const childNode = new xmlNode( tagName); this.tagsNodeStack.push(currentNode); - + if(tagName !== tagExp && attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); } @@ -62253,7 +62253,7 @@ const replaceEntitiesValue = function(val){ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { if (textData) { //store previously collected data as textNode if(isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0 - + textData = this.parseTextData(textData, currentNode.tagname, jPath, @@ -62270,10 +62270,10 @@ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { //TODO: use jPath to simplify the logic /** - * - * @param {string[]} stopNodes + * + * @param {string[]} stopNodes * @param {string} jPath - * @param {string} currentTagName + * @param {string} currentTagName */ function isItStopNode(stopNodes, jPath, currentTagName){ const allNodesExp = "*." + currentTagName; @@ -62286,9 +62286,9 @@ function isItStopNode(stopNodes, jPath, currentTagName){ /** * Returns the tag Expression and where it is ending handling single-double quotes situation - * @param {string} xmlData + * @param {string} xmlData * @param {number} i starting index - * @returns + * @returns */ function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){ let attrBoundary; @@ -62361,9 +62361,9 @@ function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){ } /** * find paired tag for a stop node - * @param {string} xmlData - * @param {string} tagName - * @param {number} i + * @param {string} xmlData + * @param {string} tagName + * @param {number} i */ function readStopNodeData(xmlData, tagName, i){ const startIndex = i; @@ -62371,7 +62371,7 @@ function readStopNodeData(xmlData, tagName, i){ let openTagCount = 1; for (; i < xmlData.length; i++) { - if( xmlData[i] === "<"){ + if( xmlData[i] === "<"){ if (xmlData[i+1] === "/") {//close tag const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); let closeTagName = xmlData.substring(i+2,closeIndex).trim(); @@ -62385,13 +62385,13 @@ function readStopNodeData(xmlData, tagName, i){ } } i=closeIndex; - } else if(xmlData[i+1] === '?') { + } else if(xmlData[i+1] === '?') { const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.") i=closeIndex; - } else if(xmlData.substr(i + 1, 3) === '!--') { + } else if(xmlData.substr(i + 1, 3) === '!--') { const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.") i=closeIndex; - } else if(xmlData.substr(i + 1, 2) === '![') { + } else if(xmlData.substr(i + 1, 2) === '![') { const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; i=closeIndex; } else { @@ -62440,16 +62440,16 @@ const { prettify} = __nccwpck_require__(42882); const validator = __nccwpck_require__(61739); class XMLParser{ - + constructor(options){ this.externalEntities = {}; this.options = buildOptions(options); - + } /** - * Parse XML dats to JS object - * @param {string|Buffer} xmlData - * @param {boolean|Object} validationOption + * Parse XML dats to JS object + * @param {string|Buffer} xmlData + * @param {boolean|Object} validationOption */ parse(xmlData,validationOption){ if(typeof xmlData === "string"){ @@ -62460,7 +62460,7 @@ class XMLParser{ } if( validationOption){ if(validationOption === true) validationOption = {}; //validate with default options - + const result = validator.validate(xmlData, validationOption); if (result !== true) { throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` ) @@ -62475,8 +62475,8 @@ class XMLParser{ /** * Add Entity which is not by default supported by this library - * @param {string} key - * @param {string} value + * @param {string} key + * @param {string} value */ addEntity(key, value){ if(value.indexOf("&") !== -1){ @@ -62502,20 +62502,20 @@ module.exports = XMLParser; /** - * - * @param {array} node - * @param {any} options - * @returns + * + * @param {array} node + * @param {any} options + * @returns */ function prettify(node, options){ return compress( node, options); } /** - * - * @param {array} arr - * @param {object} options - * @param {string} jPath + * + * @param {array} arr + * @param {object} options + * @param {string} jPath * @returns object */ function compress(arr, options, jPath){ @@ -62534,7 +62534,7 @@ function compress(arr, options, jPath){ }else if(property === undefined){ continue; }else if(tagObj[property]){ - + let val = compress(tagObj[property], options, newJpath); const isLeaf = isLeafTag(val, options); @@ -62562,7 +62562,7 @@ function compress(arr, options, jPath){ } } } - + } // if(text && text.length > 0) compressedObj[options.textNodeName] = text; if(typeof text === "string"){ @@ -62597,7 +62597,7 @@ function assignAttributes(obj, attrMap, jpath, options){ function isLeafTag(obj, options){ const { textNodeName } = options; const propCount = Object.keys(obj).length; - + if (propCount === 0) { return true; } @@ -71190,18 +71190,18 @@ function mkdirP (p, opts, f, made) { else if (!opts || typeof opts !== 'object') { opts = { mode: opts }; } - + var mode = opts.mode; var xfs = opts.fs || fs; - + if (mode === undefined) { mode = _0777 } if (!made) made = null; - + var cb = f || /* istanbul ignore next */ function () {}; p = path.resolve(p); - + xfs.mkdir(p, mode, function (er) { if (!er) { made = made || p; @@ -71237,10 +71237,10 @@ mkdirP.sync = function sync (p, opts, made) { if (!opts || typeof opts !== 'object') { opts = { mode: opts }; } - + var mode = opts.mode; var xfs = opts.fs || fs; - + if (mode === undefined) { mode = _0777 } @@ -80381,7 +80381,7 @@ function stat(file, followSymlinks) { case 'ENOENT': if(followSymlinks) { // Fallback to lstat to handle broken links as files - resolve(stat(file, false)); + resolve(stat(file, false)); } else { resolve(null); } @@ -80464,7 +80464,7 @@ class ReaddirGlob extends EventEmitter { } this.options = readOptions(options || {}); - + this.matchers = []; if(this.options.pattern) { const matchers = Array.isArray(this.options.pattern) ? this.options.pattern : [this.options.pattern]; @@ -80477,7 +80477,7 @@ class ReaddirGlob extends EventEmitter { }) ); } - + this.ignoreMatchers = []; if(this.options.ignore) { const ignorePatterns = Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore]; @@ -80485,7 +80485,7 @@ class ReaddirGlob extends EventEmitter { new Minimatch(ignore, {dot: true}) ); } - + this.skipMatchers = []; if(this.options.skip) { const skipPatterns = Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip]; @@ -80498,9 +80498,9 @@ class ReaddirGlob extends EventEmitter { this.paused = false; this.inactive = false; this.aborted = false; - + if(cb) { - this._matches = []; + this._matches = []; this.on('match', match => this._matches.push(this.options.absolute ? match.absolute : match.relative)); this.on('error', err => cb(err)); this.on('end', () => cb(null, this._matches)); @@ -85275,7 +85275,7 @@ if (!Number.parseFloat && window.parseFloat) { Number.parseFloat = window.parseFloat; } - + const consider = { hex : true, leadingZeros: true, @@ -85294,7 +85294,7 @@ function toNumber(str, options = {}){ options = Object.assign({}, consider, options ); if(!str || typeof str !== "string" ) return str; - + let trimmedStr = str.trim(); // if(trimmedStr === "0.0") return 0; // else if(trimmedStr === "+0.0") return 0; @@ -85315,7 +85315,7 @@ function toNumber(str, options = {}){ const leadingZeros = match[2]; let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros //trim ending zeros for floating number - + const eNotation = match[4] || match[6]; if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123 else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123 @@ -85332,7 +85332,7 @@ function toNumber(str, options = {}){ // const decimalPart = match[5].substr(1); // const intPart = trimmedStr.substr(0,trimmedStr.indexOf(".")); - + // const p = numStr.indexOf("."); // const givenIntPart = numStr.substr(0,p); // const givenDecPart = numStr.substr(p+1); @@ -85341,7 +85341,7 @@ function toNumber(str, options = {}){ else if( sign && numStr === "-"+numTrimmedByZeros) return num; else return str; } - + if(leadingZeros){ // if(numTrimmedByZeros === numStr){ // if(options.leadingZeros) return num; @@ -85362,7 +85362,7 @@ function toNumber(str, options = {}){ return str; } // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str; - + }else{ //non-numeric string return str; } @@ -85370,9 +85370,9 @@ function toNumber(str, options = {}){ } /** - * + * * @param {string} numStr without leading zeros - * @returns + * @returns */ function trimZeros(numStr){ if(numStr && numStr.indexOf(".") !== -1){//float @@ -87061,19 +87061,19 @@ Traverse.prototype.deepEqual = function (obj) { 'deepEqual requires exactly one object to compare against' ); } - + var equal = true; var node = obj; - + this.forEach(function (y) { var notEqual = (function () { equal = false; //this.stop(); return undefined; }).bind(this); - + //if (node === undefined || node === null) return notEqual(); - + if (!this.isRoot) { /* if (!Object.hasOwnProperty.call(node, this.key)) { @@ -87083,17 +87083,17 @@ Traverse.prototype.deepEqual = function (obj) { if (typeof node !== 'object') return notEqual(); node = node[this.key]; } - + var x = node; - + this.post(function () { node = x; }); - + var toS = function (o) { return Object.prototype.toString.call(o); }; - + if (this.circular) { if (Traverse(obj).get(this.circular.path) !== x) notEqual(); } @@ -87142,14 +87142,14 @@ Traverse.prototype.deepEqual = function (obj) { } } }); - + return equal; }; Traverse.prototype.paths = function () { var acc = []; this.forEach(function (x) { - acc.push(this.path); + acc.push(this.path); }); return acc; }; @@ -87164,24 +87164,24 @@ Traverse.prototype.nodes = function () { Traverse.prototype.clone = function () { var parents = [], nodes = []; - + return (function clone (src) { for (var i = 0; i < parents.length; i++) { if (parents[i] === src) { return nodes[i]; } } - + if (typeof src === 'object' && src !== null) { var dst = copy(src); - + parents.push(src); nodes.push(dst); - + Object.keys(src).forEach(function (key) { dst[key] = clone(src[key]); }); - + parents.pop(); nodes.pop(); return dst; @@ -87196,11 +87196,11 @@ function walk (root, cb, immutable) { var path = []; var parents = []; var alive = true; - + return (function walker (node_) { var node = immutable ? copy(node_) : node_; var modifiers = {}; - + var state = { node : node, node_ : node_, @@ -87233,12 +87233,12 @@ function walk (root, cb, immutable) { post : function (f) { modifiers.post = f }, stop : function () { alive = false } }; - + if (!alive) return state; - + if (typeof node === 'object' && node !== null) { state.isLeaf = Object.keys(node).length == 0; - + for (var i = 0; i < parents.length; i++) { if (parents[i].node_ === node_) { state.circular = parents[i]; @@ -87249,42 +87249,42 @@ function walk (root, cb, immutable) { else { state.isLeaf = true; } - + state.notLeaf = !state.isLeaf; state.notRoot = !state.isRoot; - + // use return values to update if defined var ret = cb.call(state, state.node); if (ret !== undefined && state.update) state.update(ret); if (modifiers.before) modifiers.before.call(state, state.node); - + if (typeof state.node == 'object' && state.node !== null && !state.circular) { parents.push(state); - + var keys = Object.keys(state.node); keys.forEach(function (key, i) { path.push(key); - + if (modifiers.pre) modifiers.pre.call(state, state.node[key], key); - + var child = walker(state.node[key]); if (immutable && Object.hasOwnProperty.call(state.node, key)) { state.node[key] = child.node; } - + child.isLast = i == keys.length - 1; child.isFirst = i == 0; - + if (modifiers.post) modifiers.post.call(state, child); - + path.pop(); }); parents.pop(); } - + if (modifiers.after) modifiers.after.call(state, state.node); - + return state; })(root).node; } @@ -87300,7 +87300,7 @@ Object.keys(Traverse.prototype).forEach(function (key) { function copy (src) { if (typeof src === 'object' && src !== null) { var dst; - + if (Array.isArray(src)) { dst = []; } @@ -87319,7 +87319,7 @@ function copy (src) { else { dst = Object.create(Object.getPrototypeOf(src)); } - + Object.keys(src).forEach(function (key) { dst[key] = src[key]; }); @@ -122072,7 +122072,7 @@ class NodeHttpClient { return agent; } log_js_1.logger.info("No cached TLS Agent exist, creating a new Agent"); - agent = new https.Agent(Object.assign({ + agent = new https.Agent(Object.assign({ // keepAlive is true if disableKeepAlive is false. keepAlive: !disableKeepAlive }, tlsSettings)); this.cachedHttpsAgents.set(tlsSettings, agent); @@ -124587,7 +124587,7 @@ function createTokenCycler(credential, tokenCyclerOptions) { const tryGetAccessToken = () => credential.getToken(scopes, getTokenOptions); // Take advantage of promise chaining to insert an assignment to `token` // before the refresh can be considered done. - refreshWorker = beginRefresh(tryGetAccessToken, options.retryIntervalInMs, + refreshWorker = beginRefresh(tryGetAccessToken, options.retryIntervalInMs, // If we don't have a token, then we should timeout immediately (_a = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a !== void 0 ? _a : Date.now()) .then((_token) => { @@ -129350,7 +129350,7 @@ class AST { const aps = addPatternStart; // check if we have a possibility of matching . or .., // and prevent that. - const needNoTrav = + const needNoTrav = // dots are allowed, and the pattern starts with [ or . (dot && aps.has(src.charAt(0))) || // the pattern starts with \., and then [ or . @@ -135064,11 +135064,11 @@ class LRUCache { b.__abortController instanceof AC); } async fetch(k, fetchOptions = {}) { - const { + const { // get options - allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, + allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, // set options - ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, + ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, // fetch exclusive options noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions; if (!this.#hasFetchMethod) { @@ -135691,7 +135691,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; -/******/ +/******/ /******/ // The require function /******/ function __nccwpck_require__(moduleId) { /******/ // Check if module is in cache @@ -135705,7 +135705,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ loaded: false, /******/ exports: {} /******/ }; -/******/ +/******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { @@ -135714,14 +135714,14 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ } finally { /******/ if(threw) delete __webpack_module_cache__[moduleId]; /******/ } -/******/ +/******/ /******/ // Flag the module as loaded /******/ module.loaded = true; -/******/ +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ +/******/ /************************************************************************/ /******/ /* webpack/runtime/node module decorator */ /******/ (() => { @@ -135731,19 +135731,19 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ return module; /******/ }; /******/ })(); -/******/ +/******/ /******/ /* webpack/runtime/compat */ -/******/ +/******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ +/******/ /************************************************************************/ -/******/ +/******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __nccwpck_require__(28981); /******/ module.exports = __webpack_exports__; -/******/ +/******/ /******/ })() ; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/package.json b/package.json index 753bdbb..23a57e9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "eslint-plugin-prettier": "^4.2.1", "jest": "^29.6.1", "js-yaml": "^4.1.0", - "prettier": "2.5.1", + "prettier": "^3.4.2", "ts-jest": "^29.1.1", "typescript": "4.9.5" }, diff --git a/yarn.lock b/yarn.lock index 7f4bdc7..0bdcd90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4081,11 +4081,6 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a" - integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== - prettier@^2.2.1: version "2.8.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" @@ -4096,6 +4091,11 @@ prettier@^2.5.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f" + integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ== + pretty-format@^29.0.0: version "29.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a"