@applitools/ufg-client
Advanced tools
Comparing version 1.12.2 to 1.12.3
# Changelog | ||
## [1.12.3](https://github.com/Applitools-Dev/sdk/compare/js/ufg-client@1.12.2...js/ufg-client@1.12.3) (2024-07-23) | ||
### Bug Fixes | ||
* update makeUploadResource to include apiKey in the cache key ([#2411](https://github.com/Applitools-Dev/sdk/issues/2411)) ([4114c58](https://github.com/Applitools-Dev/sdk/commit/4114c58ec16fa855374b23810cef1e36d4bb53a7)) | ||
### Performance Improvements | ||
* trim file content when logging it ([#2437](https://github.com/Applitools-Dev/sdk/issues/2437)) ([02ec1f7](https://github.com/Applitools-Dev/sdk/commit/02ec1f79a323af2e89a7428b75212707c761d1ca)) | ||
## [1.12.2](https://github.com/Applitools-Dev/sdk/compare/js/ufg-client@1.12.1...js/ufg-client@1.12.2) (2024-06-26) | ||
@@ -4,0 +16,0 @@ |
@@ -26,3 +26,3 @@ "use strict"; | ||
}); | ||
const uploadResource = (0, upload_resource_1.makeUploadResource)({ requests, logger }); | ||
const uploadResource = (0, upload_resource_1.makeUploadResource)({ requests, logger, apiKey: settings.apiKey }); | ||
const processResources = (0, process_resources_1.makeProcessResources)({ | ||
@@ -29,0 +29,0 @@ fetchResource, |
@@ -33,3 +33,3 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeUploadResource({ requests, batchingTimeout = 300, concurrency = 100, logger: mainLogger, }) { | ||
function makeUploadResource({ requests, batchingTimeout = 300, concurrency = 100, logger: mainLogger, apiKey, }) { | ||
const uploadedResources = new Set(); | ||
@@ -41,3 +41,3 @@ const requestedResources = new Map(); | ||
logger = logger.extend(mainLogger, { tags: [`upload-resource-${utils.general.shortid()}`] }); | ||
const hash = resource.hash.hash; | ||
const hash = resource.hash.hash + '_' + apiKey; | ||
if (uploadedResources.has(hash)) { | ||
@@ -78,2 +78,5 @@ return Promise.resolve(); | ||
}); | ||
if (presentedResources.length !== batch.length) { | ||
throw new Error(`Unexpected number of presented resources - ${presentedResources.length} instead of ${batch.length}`); | ||
} | ||
} | ||
@@ -80,0 +83,0 @@ catch (err) { |
@@ -29,2 +29,3 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
const buffer_1 = require("buffer"); | ||
function makeReqUFG({ settings, logger }) { | ||
@@ -69,3 +70,16 @@ var _a; | ||
} | ||
logger === null || logger === void 0 ? void 0 : logger.log(`Request "${options === null || options === void 0 ? void 0 : options.name}" [${requestId}] will be sent to the address "[${request.method}]${request.url}" with body`, options === null || options === void 0 ? void 0 : options.body); | ||
const { body, originalSize, isTrimmed } = trimBody(); | ||
logger === null || logger === void 0 ? void 0 : logger.log(`Request "${options === null || options === void 0 ? void 0 : options.name}" [${requestId}] will be sent to the address "[${request.method}]${request.url}" with body${isTrimmed ? ` (trimmed from ${originalSize})` : ''}`, body); | ||
function trimBody() { | ||
if ((options === null || options === void 0 ? void 0 : options.body) instanceof buffer_1.Buffer || (options === null || options === void 0 ? void 0 : options.body) instanceof Uint8Array) { | ||
return { | ||
body: options.body.subarray(0, 10), | ||
originalSize: options.body.length, | ||
isTrimmed: options.body.length > 10, | ||
}; | ||
} | ||
else { | ||
return { body: options === null || options === void 0 ? void 0 : options.body }; | ||
} | ||
} | ||
}, | ||
@@ -72,0 +86,0 @@ beforeRetry({ request, attempt, error, response, options }) { |
@@ -146,3 +146,3 @@ "use strict"; | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "checkResources" called for resources', resources); | ||
logger.log('Request "checkResources" called for resources', resources.map(trimValueForResource)); | ||
const response = await req('./resources/query/resources-exist', { | ||
@@ -164,3 +164,3 @@ name: 'checkResources', | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "uploadResource" called for resource', resource); | ||
logger.log('Request "uploadResource" called for resource', trimValueForResource(resource)); | ||
await req(`./resources/sha256/${resource.hash.hash}`, { | ||
@@ -322,1 +322,4 @@ name: 'uploadResource', | ||
} | ||
function trimValueForResource(resource) { | ||
return { ...resource, value: resource.value.subarray(0, 10) }; | ||
} |
{ | ||
"name": "@applitools/ufg-client", | ||
"version": "1.12.2", | ||
"version": "1.12.3", | ||
"homepage": "https://applitools.com", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -10,2 +10,3 @@ import { type ContentfulResource } from './resource'; | ||
logger: Logger; | ||
apiKey?: string; | ||
}; | ||
@@ -16,3 +17,3 @@ export type UploadResource = (options: { | ||
}) => Promise<void>; | ||
export declare function makeUploadResource({ requests, batchingTimeout, concurrency, logger: mainLogger, }: Options): UploadResource; | ||
export declare function makeUploadResource({ requests, batchingTimeout, concurrency, logger: mainLogger, apiKey, }: Options): UploadResource; | ||
export {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140906
2152