@applitools/ufg-client
Advanced tools
Comparing version 1.2.12 to 1.2.13
@@ -27,11 +27,14 @@ "use strict"; | ||
exports.makeBookRenderer = void 0; | ||
const logger_1 = require("@applitools/logger"); | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeBookRenderer({ requests, batchingTimeout = 100, logger, }) { | ||
function makeBookRenderer({ requests, batchingTimeout = 100, logger: mainLogger }) { | ||
const bookedRendererWithBatching = utils.general.batchify(bookRenderers, { timeout: batchingTimeout }); | ||
return function bookRenderer({ settings }) { | ||
return bookedRendererWithBatching(settings); | ||
return function bookRenderer({ settings, logger = mainLogger }) { | ||
logger = logger.extend(mainLogger, { tags: [`book-renderer-${utils.general.shortid()}`] }); | ||
return bookedRendererWithBatching({ settings, logger }); | ||
}; | ||
async function bookRenderers(batch) { | ||
const logger = (0, logger_1.mergeLoggers)(...batch.map(([{ logger }]) => logger)); | ||
try { | ||
const bookedRenderers = await requests.bookRenderers({ settings: batch.map(([settings]) => settings), logger }); | ||
const bookedRenderers = await requests.bookRenderers({ settings: batch.map(([{ settings }]) => settings), logger }); | ||
bookedRenderers.forEach((bookedRenderer, index) => { | ||
@@ -38,0 +41,0 @@ const [, { resolve }] = batch[index]; |
@@ -14,10 +14,9 @@ "use strict"; | ||
function makeUFGClient({ config, cache = exports.defaultResourceCache, logger, }) { | ||
var _a; | ||
logger = (_a = logger === null || logger === void 0 ? void 0 : logger.extend({ label: 'ufg client' })) !== null && _a !== void 0 ? _a : (0, logger_1.makeLogger)({ label: 'ufg client' }); | ||
logger = (0, logger_1.makeLogger)({ logger, format: { label: 'ufg-client' } }); | ||
const requests = (0, requests_1.makeUFGRequests)({ config, logger }); | ||
const fetchResource = (0, fetch_resource_1.makeFetchResource)({ logger, fetchConcurrency: config.fetchConcurrency }); | ||
const fetchResource = (0, fetch_resource_1.makeFetchResource)({ fetchConcurrency: config.fetchConcurrency, logger }); | ||
const uploadResource = (0, upload_resource_1.makeUploadResource)({ requests, logger }); | ||
const processResources = (0, process_resources_1.makeProcessResources)({ fetchResource, uploadResource, cache, logger }); | ||
return { | ||
createRenderTarget: (0, create_render_target_1.makeCreateRenderTarget)({ processResources }), | ||
createRenderTarget: (0, create_render_target_1.makeCreateRenderTarget)({ processResources, logger }), | ||
bookRenderer: (0, book_renderer_1.makeBookRenderer)({ requests, logger }), | ||
@@ -24,0 +23,0 @@ render: (0, render_1.makeRender)({ requests, logger }), |
@@ -31,7 +31,8 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeCreateRenderTarget({ processResources }) { | ||
return async function createRenderTarget({ snapshot, settings, }) { | ||
function makeCreateRenderTarget({ processResources, logger: mainLogger }) { | ||
return async function createRenderTarget({ snapshot, settings, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`render-target-${utils.general.shortid()}`] }); | ||
const processedSnapshotResources = await processSnapshotResources({ snapshot, settings, logger }); | ||
const resources = await processedSnapshotResources.promise; | ||
const isWeb = !!snapshot.cdt; | ||
const processedSnapshotResources = await processSnapshotResources({ snapshot, settings }); | ||
const resources = await processedSnapshotResources.promise; | ||
const hashedSnapshot = resources[isWeb ? snapshot.url : 'vhs']; | ||
@@ -49,3 +50,3 @@ if (isWeb) { | ||
}; | ||
async function processSnapshotResources({ snapshot, settings, }) { | ||
async function processSnapshotResources({ snapshot, settings, logger, }) { | ||
var _a; | ||
@@ -72,5 +73,6 @@ const [snapshotResources, ...frameResources] = await Promise.all([ | ||
settings: { referer: utils.types.has(snapshot, 'url') ? snapshot.url : undefined, ...settings }, | ||
logger, | ||
}), | ||
...(utils.types.has(snapshot, 'frames') ? (_a = snapshot.frames) !== null && _a !== void 0 ? _a : [] : []).map(frameSnapshot => { | ||
return processSnapshotResources({ snapshot: frameSnapshot, settings }); | ||
return processSnapshotResources({ snapshot: frameSnapshot, settings, logger }); | ||
}), | ||
@@ -100,3 +102,3 @@ ]); | ||
}; | ||
const processedDomResource = await processResources({ resources: domResource }); | ||
const processedDomResource = await processResources({ resources: domResource, logger }); | ||
const frameResourceMapping = frameResources.reduce((mapping, resources) => { | ||
@@ -103,0 +105,0 @@ return Object.assign(mapping, resources.mapping); |
@@ -30,2 +30,3 @@ "use strict"; | ||
exports.makeRender = void 0; | ||
const logger_1 = require("@applitools/logger"); | ||
const utils = __importStar(require("@applitools/utils")); | ||
@@ -35,3 +36,3 @@ const throat_1 = __importDefault(require("throat")); | ||
var _b; | ||
var { requests, concurrency = (_b = utils.general.getEnvValue('CONCURRENT_RENDERS_PER_TEST', 'number')) !== null && _b !== void 0 ? _b : 1, timeout = 60 * 60 * 1000, batchingTimeout = 300, logger, } = _a; | ||
var { requests, concurrency = (_b = utils.general.getEnvValue('CONCURRENT_RENDERS_PER_TEST', 'number')) !== null && _b !== void 0 ? _b : 1, timeout = 60 * 60 * 1000, batchingTimeout = 300, logger: mainLogger, } = _a; | ||
const startRenderWithBatching = utils.general.batchify(startRenders, { timeout: batchingTimeout }); | ||
@@ -47,8 +48,10 @@ const checkRenderResultWithBatching = utils.general.batchify(checkRenderResults, { timeout: batchingTimeout }); | ||
return renderWithConcurrency; | ||
async function render({ target, settings, signal, }) { | ||
async function render({ target, settings, signal, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`render-${utils.general.shortid()}`] }); | ||
const timedOutAt = Date.now() + timeout; | ||
const render = await startRenderWithBatching({ target, settings }); | ||
return checkRenderResultWithBatching({ render, signal, timedOutAt }); | ||
const render = await startRenderWithBatching({ target, settings, logger }); | ||
return checkRenderResultWithBatching({ render, signal, timedOutAt, logger }); | ||
} | ||
async function startRenders(batch) { | ||
const logger = (0, logger_1.mergeLoggers)(...batch.map(([{ logger }]) => logger)); | ||
try { | ||
@@ -59,3 +62,3 @@ const renders = await requests.startRenders({ requests: batch.map(([request]) => request), logger }); | ||
if (render.status === 'need-more-resources') { | ||
logger === null || logger === void 0 ? void 0 : logger.error(`Got unexpected status ${render.status} in start render response`); | ||
logger.error(`Got unexpected status ${render.status} in start render response`); | ||
reject(new Error(`Got unexpected status ${render.status} in start render response`)); | ||
@@ -73,6 +76,7 @@ } | ||
async function checkRenderResults(batch) { | ||
const logger = (0, logger_1.mergeLoggers)(...batch.map(([{ logger }]) => logger)); | ||
try { | ||
batch = batch.filter(([{ render, signal, timedOutAt }, { reject }]) => { | ||
if (signal === null || signal === void 0 ? void 0 : signal.aborted) { | ||
logger === null || logger === void 0 ? void 0 : logger.warn(`Render with id "${render.renderId}" aborted`); | ||
logger.warn(`Render with id "${render.renderId}" aborted`); | ||
reject(new Error(`Render with id "${render.renderId}" aborted`)); | ||
@@ -82,3 +86,3 @@ return false; | ||
else if (Date.now() >= timedOutAt) { | ||
logger === null || logger === void 0 ? void 0 : logger.error(`Render with id "${render.renderId}" timed out`); | ||
logger.error(`Render with id "${render.renderId}" timed out`); | ||
reject(new Error(`Render with id "${render.renderId}" timed out`)); | ||
@@ -93,6 +97,6 @@ return false; | ||
results.forEach((result, index) => { | ||
const [{ render, signal, timedOutAt }, { resolve, reject }] = batch[index]; | ||
const [options, { resolve, reject }] = batch[index]; | ||
if (result.status === 'error') { | ||
logger === null || logger === void 0 ? void 0 : logger.error(`Render with id "${render.renderId}" failed due to an error - ${result.error}`); | ||
reject(new Error(`Render with id "${render.renderId}" failed due to an error - ${result.error}`)); | ||
logger.error(`Render with id "${options.render.renderId}" failed due to an error - ${result.error}`); | ||
reject(new Error(`Render with id "${options.render.renderId}" failed due to an error - ${result.error}`)); | ||
} | ||
@@ -104,3 +108,3 @@ else if (result.status === 'rendered') { | ||
// NOTE: this may create a long promise chain | ||
checkRenderResultWithBatching({ render, signal, timedOutAt }).then(resolve, reject); | ||
checkRenderResultWithBatching(options).then(resolve, reject); | ||
} | ||
@@ -107,0 +111,0 @@ }); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -13,3 +36,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const throat_1 = __importDefault(require("throat")); | ||
function makeFetchResource({ retryLimit = 5, streamingTimeout = 30 * 1000, fetchTimeout = 30 * 1000, fetchConcurrency, cache = new Map(), fetch, logger, } = {}) { | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeFetchResource({ retryLimit = 5, streamingTimeout = 30 * 1000, fetchTimeout = 30 * 1000, fetchConcurrency, cache = new Map(), fetch, logger: mainLogger, }) { | ||
const req = (0, req_1.makeReq)({ | ||
@@ -23,4 +47,5 @@ retry: { | ||
return fetchConcurrency ? (0, throat_1.default)(fetchConcurrency, fetchResource) : fetchResource; | ||
async function fetchResource({ resource, settings = {}, }) { | ||
async function fetchResource({ resource, settings = {}, logger = mainLogger, }) { | ||
var _a; | ||
logger = logger.extend(mainLogger, { tags: [`fetch-resource-${utils.general.shortid()}`] }); | ||
let runningRequest = cache.get(resource.id); | ||
@@ -27,0 +52,0 @@ if (runningRequest) |
@@ -31,8 +31,9 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeProcessResources({ fetchResource, uploadResource, cache = new Map(), logger, }) { | ||
return async function processResources({ resources, settings, }) { | ||
function makeProcessResources({ fetchResource, uploadResource, cache = new Map(), logger: mainLogger, }) { | ||
return async function processResources({ resources, settings, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`process-resources-${utils.general.shortid()}`] }); | ||
const processedResources = await Object.entries(resources).reduce(async (processedResourcesPromise, [url, resource]) => { | ||
if (utils.types.has(resource, 'value') || utils.types.has(resource, 'errorStatusCode')) { | ||
// process contentful resource or failed resource | ||
const processedResource = await processContentfulResource({ resource }); | ||
const processedResource = await processContentfulResource({ resource, logger }); | ||
return Object.assign(await processedResourcesPromise, { [url]: processedResource }); | ||
@@ -42,3 +43,7 @@ } | ||
// process url resource with dependencies | ||
const processedResourceWithDependencies = await processUrlResourceWithDependencies({ resource, settings }); | ||
const processedResourceWithDependencies = await processUrlResourceWithDependencies({ | ||
resource, | ||
settings, | ||
logger, | ||
}); | ||
return Object.assign(await processedResourcesPromise, processedResourceWithDependencies); | ||
@@ -55,10 +60,10 @@ } | ||
}; | ||
async function processContentfulResource({ resource, }) { | ||
return persistResource({ resource }); | ||
async function processContentfulResource({ resource, logger = mainLogger, }) { | ||
return persistResource({ resource, logger }); | ||
} | ||
async function processUrlResource({ resource, settings, }) { | ||
async function processUrlResource({ resource, settings, logger = mainLogger, }) { | ||
const cachedResource = cache.get(resource.id); | ||
if (cachedResource) { | ||
const dependencies = cachedResource.dependencies || []; | ||
logger === null || logger === void 0 ? void 0 : logger.log(`resource retrieved from cache, with dependencies (${dependencies.length}): ${resource.url} with dependencies --> ${dependencies}`); | ||
logger.log(`resource retrieved from cache, with dependencies (${dependencies.length}): ${resource.url} with dependencies --> ${dependencies}`); | ||
return cachedResource; | ||
@@ -68,11 +73,11 @@ } | ||
try { | ||
const fetchedResource = await fetchResource({ resource, settings }); | ||
const fetchedResource = await fetchResource({ resource, settings, logger }); | ||
const dependencyUrls = utils.types.has(fetchedResource, 'value') | ||
? await extractDependencyUrls({ resource: fetchedResource, settings }) | ||
? await extractDependencyUrls({ resource: fetchedResource, settings, logger }) | ||
: []; | ||
logger === null || logger === void 0 ? void 0 : logger.log(`dependencyUrls for ${resource.url} --> ${dependencyUrls}`); | ||
return persistResource({ resource: fetchedResource, dependencies: dependencyUrls }); | ||
logger.log(`dependencyUrls for ${resource.url} --> ${dependencyUrls}`); | ||
return persistResource({ resource: fetchedResource, dependencies: dependencyUrls, logger }); | ||
} | ||
catch (err) { | ||
logger === null || logger === void 0 ? void 0 : logger.log(`error fetching resource at ${resource.url}, setting errorStatusCode to 504. err=${err}`); | ||
logger.log(`error fetching resource at ${resource.url}, setting errorStatusCode to 504. err=${err}`); | ||
return (0, resource_1.makeResource)({ ...resource, errorStatusCode: 504 }); | ||
@@ -85,3 +90,3 @@ } | ||
} | ||
async function processUrlResourceWithDependencies({ resource, settings, }) { | ||
async function processUrlResourceWithDependencies({ resource, settings, logger = mainLogger, }) { | ||
const processedResourcesWithDependencies = {}; | ||
@@ -91,3 +96,3 @@ await doProcessUrlResourceWithDependencies(resource); | ||
async function doProcessUrlResourceWithDependencies(resource) { | ||
const processedResource = await processUrlResource({ resource, settings }); | ||
const processedResource = await processUrlResource({ resource, settings, logger }); | ||
if (processedResource) { | ||
@@ -106,3 +111,3 @@ processedResourcesWithDependencies[resource.url] = processedResource; | ||
} | ||
async function persistResource({ resource, dependencies, }) { | ||
async function persistResource({ resource, dependencies, logger = mainLogger, }) { | ||
var _a; | ||
@@ -114,3 +119,3 @@ const entry = { | ||
if (utils.types.has(resource, 'value')) { | ||
entry.ready = uploadResource({ resource }) | ||
entry.ready = uploadResource({ resource, logger }) | ||
.then(() => { | ||
@@ -132,3 +137,3 @@ const entry = cache.get(resource.id); | ||
} | ||
async function extractDependencyUrls({ resource, settings, }) { | ||
async function extractDependencyUrls({ resource, settings, logger = mainLogger, }) { | ||
try { | ||
@@ -152,3 +157,3 @@ let dependencyUrls = []; | ||
catch (e) { | ||
logger === null || logger === void 0 ? void 0 : logger.log(`could not parse ${resource.contentType} ${resource.url}`, e); | ||
logger.log(`could not parse ${resource.contentType} ${resource.url}`, e); | ||
return []; | ||
@@ -155,0 +160,0 @@ } |
@@ -30,5 +30,6 @@ "use strict"; | ||
exports.makeUploadResource = void 0; | ||
const logger_1 = require("@applitools/logger"); | ||
const throat_1 = __importDefault(require("throat")); | ||
const utils = __importStar(require("@applitools/utils")); | ||
const throat_1 = __importDefault(require("throat")); | ||
function makeUploadResource({ requests, batchingTimeout = 300, concurrency = 100, logger, }) { | ||
function makeUploadResource({ requests, batchingTimeout = 300, concurrency = 100, logger: mainLogger, }) { | ||
const uploadedResources = new Set(); | ||
@@ -38,3 +39,4 @@ const requestedResources = new Map(); | ||
const uploadResourceWithBatching = utils.general.batchify(uploadResources, { timeout: batchingTimeout }); | ||
return async function uploadResource({ resource }) { | ||
return async function uploadResource({ resource, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`upload-resource-${utils.general.shortid()}`] }); | ||
const hash = resource.hash.hash; | ||
@@ -48,3 +50,3 @@ if (uploadedResources.has(hash)) { | ||
else { | ||
const promise = uploadResourceWithBatching(resource) | ||
const promise = uploadResourceWithBatching({ resource, logger }) | ||
.then(result => { | ||
@@ -62,6 +64,10 @@ uploadedResources.add(hash); | ||
async function uploadResources(batch) { | ||
const logger = (0, logger_1.mergeLoggers)(...batch.map(([{ logger }]) => logger)); | ||
try { | ||
const presentedResources = await requests.checkResources({ resources: batch.map(([resource]) => resource), logger }); | ||
const presentedResources = await requests.checkResources({ | ||
resources: batch.map(([{ resource }]) => resource), | ||
logger, | ||
}); | ||
presentedResources.forEach((presented, index) => { | ||
const [resource, { resolve, reject }] = batch[index]; | ||
const [options, { resolve, reject }] = batch[index]; | ||
if (presented) { | ||
@@ -71,3 +77,3 @@ resolve(); | ||
else { | ||
uploadResourceWithConcurrency({ resource, logger }).then(resolve, reject); | ||
uploadResourceWithConcurrency(options).then(resolve, reject); | ||
} | ||
@@ -74,0 +80,0 @@ }); |
@@ -30,5 +30,5 @@ "use strict"; | ||
const utils = __importStar(require("@applitools/utils")); | ||
function makeUFGRequests({ config, logger: defaultLogger, }) { | ||
defaultLogger !== null && defaultLogger !== void 0 ? defaultLogger : (defaultLogger = (0, logger_1.makeLogger)()); | ||
const req = (0, req_ufg_1.makeReqUFG)({ config, logger: defaultLogger }); | ||
function makeUFGRequests({ config, logger }) { | ||
const mainLogger = (0, logger_1.makeLogger)({ logger, format: { label: 'ufg-requests' } }); | ||
const req = (0, req_ufg_1.makeReqUFG)({ config, logger: mainLogger }); | ||
const getChromeEmulationDevicesWithCache = utils.general.cachify(getChromeEmulationDevices); | ||
@@ -47,3 +47,4 @@ const getIOSDevicesWithCache = utils.general.cachify(getIOSDevices); | ||
}; | ||
async function bookRenderers({ settings, logger = defaultLogger, }) { | ||
async function bookRenderers({ settings, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "bookRenderers" called for with settings', settings); | ||
@@ -80,3 +81,4 @@ const response = await req('./job-info', { | ||
} | ||
async function startRenders({ requests, logger = defaultLogger, }) { | ||
async function startRenders({ requests, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`start-render-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "startRenders" called for requests', requests); | ||
@@ -140,3 +142,4 @@ const response = await req('./render', { | ||
} | ||
async function checkRenderResults({ renders, logger = defaultLogger, }) { | ||
async function checkRenderResults({ renders, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "checkRenderResults" called for renders', renders); | ||
@@ -188,3 +191,4 @@ const response = await req('./render-status', { | ||
} | ||
async function checkResources({ resources, logger = defaultLogger, }) { | ||
async function checkResources({ resources, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "checkResources" called for resources', resources); | ||
@@ -205,3 +209,4 @@ const response = await req('./resources/query/resources-exist', { | ||
} | ||
async function uploadResource({ resource, logger = defaultLogger, }) { | ||
async function uploadResource({ resource, logger = mainLogger, }) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "uploadResource" called for resource', resource); | ||
@@ -223,3 +228,4 @@ await req(`./resources/sha256/${resource.hash.hash}`, { | ||
} | ||
async function getChromeEmulationDevices({ logger = defaultLogger } = {}) { | ||
async function getChromeEmulationDevices({ logger = mainLogger } = {}) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "getChromeEmulationDevices" called'); | ||
@@ -235,3 +241,4 @@ const response = await req('./emulated-devices-sizes', { | ||
} | ||
async function getIOSDevices({ logger = defaultLogger } = {}) { | ||
async function getIOSDevices({ logger = mainLogger } = {}) { | ||
logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] }); | ||
logger.log('Request "getIOSDevices" called'); | ||
@@ -238,0 +245,0 @@ const response = await req('./ios-devices-sizes', { |
{ | ||
"name": "@applitools/ufg-client", | ||
"version": "1.2.12", | ||
"version": "1.2.13", | ||
"homepage": "https://applitools.com", | ||
@@ -50,5 +50,5 @@ "bugs": { | ||
"@applitools/jsdom": "1.0.4", | ||
"@applitools/logger": "1.1.52", | ||
"@applitools/req": "1.2.5", | ||
"@applitools/utils": "1.3.35", | ||
"@applitools/logger": "2.0.0", | ||
"@applitools/req": "1.2.6", | ||
"@applitools/utils": "1.3.36", | ||
"abort-controller": "3.0.0", | ||
@@ -60,3 +60,3 @@ "css-tree": "2.3.1", | ||
"@applitools/bongo": "^3.0.3", | ||
"@applitools/test-server": "^1.1.31", | ||
"@applitools/test-server": "^1.2.0", | ||
"@applitools/test-utils": "^1.5.16", | ||
@@ -63,0 +63,0 @@ "@types/css-tree": "^2.3.1", |
import type { RendererSettings, RendererEnvironment } from './types'; | ||
import { type UFGRequests } from './server/requests'; | ||
import { type Logger } from '@applitools/logger'; | ||
import { type UFGRequests } from './server/requests'; | ||
export declare function makeBookRenderer({ requests, batchingTimeout, logger, }: { | ||
type Options = { | ||
requests: UFGRequests; | ||
batchingTimeout?: number; | ||
logger?: Logger; | ||
}): ({ settings }: { | ||
logger: Logger; | ||
}; | ||
export declare function makeBookRenderer({ requests, batchingTimeout, logger: mainLogger }: Options): ({ settings, logger }: { | ||
settings: RendererSettings; | ||
logger?: Logger | undefined; | ||
}) => Promise<RendererEnvironment>; | ||
export {}; |
import type { RenderTarget } from './types'; | ||
import { type Logger } from '@applitools/logger'; | ||
import { type ProcessResources, type ProcessResourcesSettings } from './resources/process-resources'; | ||
export declare function makeCreateRenderTarget({ processResources }: { | ||
type Options = { | ||
processResources: ProcessResources; | ||
}): ({ snapshot, settings, }: { | ||
logger: Logger; | ||
}; | ||
export declare function makeCreateRenderTarget({ processResources, logger: mainLogger }: Options): ({ snapshot, settings, logger, }: { | ||
snapshot: any; | ||
settings?: ProcessResourcesSettings | undefined; | ||
logger?: Logger | undefined; | ||
}) => Promise<RenderTarget>; | ||
export {}; |
import type { RenderTarget, RenderSettings, RenderResult } from './types'; | ||
import { type Logger } from '@applitools/logger'; | ||
import { type AbortSignal } from 'abort-controller'; | ||
import { type UFGRequests } from './server/requests'; | ||
export declare function makeRender({ requests, concurrency, timeout, batchingTimeout, logger, }: { | ||
import { type Logger } from '@applitools/logger'; | ||
type Options = { | ||
requests: UFGRequests; | ||
@@ -10,7 +10,10 @@ concurrency?: number; | ||
batchingTimeout?: number; | ||
logger?: Logger; | ||
}): ({ target, settings, signal, }: { | ||
logger: Logger; | ||
}; | ||
export declare function makeRender({ requests, concurrency, timeout, batchingTimeout, logger: mainLogger, }: Options): ({ target, settings, signal, logger, }: { | ||
target: RenderTarget; | ||
settings: RenderSettings; | ||
signal?: AbortSignal | undefined; | ||
logger?: Logger | undefined; | ||
}) => Promise<RenderResult>; | ||
export {}; |
@@ -5,2 +5,11 @@ import type { Cookie } from '../types'; | ||
import { type UrlResource, type ContentfulResource, FailedResource } from './resource'; | ||
type Options = { | ||
retryLimit?: number; | ||
streamingTimeout?: number; | ||
fetchConcurrency?: number; | ||
fetchTimeout?: number; | ||
cache?: Map<string, Promise<ContentfulResource | FailedResource>>; | ||
fetch?: Fetch; | ||
logger: Logger; | ||
}; | ||
export type FetchResourceSettings = { | ||
@@ -19,11 +28,5 @@ referer?: string; | ||
settings?: FetchResourceSettings; | ||
logger?: Logger; | ||
}) => Promise<ContentfulResource | FailedResource>; | ||
export declare function makeFetchResource({ retryLimit, streamingTimeout, fetchTimeout, fetchConcurrency, cache, fetch, logger, }?: { | ||
retryLimit?: number; | ||
streamingTimeout?: number; | ||
fetchConcurrency?: number; | ||
fetchTimeout?: number; | ||
cache?: Map<string, Promise<ContentfulResource | FailedResource>>; | ||
fetch?: Fetch; | ||
logger?: Logger; | ||
}): FetchResource; | ||
export declare function makeFetchResource({ retryLimit, streamingTimeout, fetchTimeout, fetchConcurrency, cache, fetch, logger: mainLogger, }: Options): FetchResource; | ||
export {}; |
@@ -6,5 +6,14 @@ import type { Renderer } from '../types'; | ||
import { type UploadResource } from './upload-resource'; | ||
type Options = { | ||
fetchResource: FetchResource; | ||
uploadResource: UploadResource; | ||
cache?: Map<string, KnownResource & { | ||
ready: boolean | Promise<boolean>; | ||
}>; | ||
logger: Logger; | ||
}; | ||
export type ProcessResources = (options: { | ||
resources: Record<string, FailedResource | ContentfulResource | UrlResource>; | ||
settings?: ProcessResourcesSettings; | ||
logger?: Logger; | ||
}) => Promise<{ | ||
@@ -20,9 +29,3 @@ mapping: ResourceMapping; | ||
}>; | ||
export declare function makeProcessResources({ fetchResource, uploadResource, cache, logger, }: { | ||
fetchResource: FetchResource; | ||
uploadResource: UploadResource; | ||
cache?: Map<string, KnownResource & { | ||
ready: boolean | Promise<boolean>; | ||
}>; | ||
logger?: Logger; | ||
}): ProcessResources; | ||
export declare function makeProcessResources({ fetchResource, uploadResource, cache, logger: mainLogger, }: Options): ProcessResources; | ||
export {}; |
@@ -1,12 +0,16 @@ | ||
import { type Logger } from '@applitools/logger'; | ||
import { type ContentfulResource } from './resource'; | ||
import { type UFGRequests } from '../server/requests'; | ||
import { type Logger } from '@applitools/logger'; | ||
type Options = { | ||
requests: UFGRequests; | ||
concurrency?: number; | ||
timeout?: number; | ||
batchingTimeout?: number; | ||
logger: Logger; | ||
}; | ||
export type UploadResource = (options: { | ||
resource: ContentfulResource; | ||
logger?: Logger; | ||
}) => Promise<void>; | ||
export declare function makeUploadResource({ requests, batchingTimeout, concurrency, logger, }: { | ||
requests: UFGRequests; | ||
batchingTimeout?: number; | ||
concurrency?: number; | ||
logger?: Logger; | ||
}): UploadResource; | ||
export declare function makeUploadResource({ requests, batchingTimeout, concurrency, logger: mainLogger, }: Options): UploadResource; | ||
export {}; |
@@ -49,5 +49,5 @@ import type { AndroidDevice, IOSDevice, ChromeEmulationDevice, RenderTarget, RendererSettings, RendererEnvironment, RenderSettings, RenderResult } from '../types'; | ||
}; | ||
export declare function makeUFGRequests({ config, logger: defaultLogger, }: { | ||
export declare function makeUFGRequests({ config, logger }: { | ||
config: UFGRequestsConfig; | ||
logger: Logger; | ||
logger?: Logger; | ||
}): UFGRequests; |
@@ -110,5 +110,7 @@ /// <reference types="node" /> | ||
settings?: ProcessResourcesSettings; | ||
logger?: Logger; | ||
}): Promise<RenderTarget>; | ||
bookRenderer(options: { | ||
settings: RendererSettings; | ||
logger?: Logger; | ||
}): Promise<RendererEnvironment>; | ||
@@ -119,2 +121,3 @@ render(options: { | ||
signal?: AbortSignal; | ||
logger?: Logger; | ||
}): Promise<RenderResult>; | ||
@@ -121,0 +124,0 @@ getChromeEmulationDevices(options?: { |
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
104722
1903
+ Added@applitools/logger@2.0.0(transitive)
+ Added@applitools/req@1.2.6(transitive)
+ Added@applitools/utils@1.3.36(transitive)
- Removed@applitools/logger@1.1.52(transitive)
- Removed@applitools/req@1.2.5(transitive)
- Removed@applitools/utils@1.3.35(transitive)
Updated@applitools/logger@2.0.0
Updated@applitools/req@1.2.6
Updated@applitools/utils@1.3.36