Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/ufg-client

Package Overview
Dependencies
Maintainers
46
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/ufg-client - npm Package Compare versions

Comparing version 1.9.5 to 1.9.6

dist/get-actual-environment.js

42

CHANGELOG.md
# Changelog
## [1.9.6](https://github.com/applitools/eyes.sdk.javascript1/compare/js/ufg-client@1.9.5...js/ufg-client@1.9.6) (2023-10-17)
### Code Refactoring
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
* drop jsdom dependency ([1b68d39](https://github.com/applitools/eyes.sdk.javascript1/commit/1b68d3945d96b17b9ab1f1a87d352206fd0c81d6))
### Dependencies
* @applitools/utils bumped to 1.6.2
#### Code Refactoring
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
* @applitools/logger bumped to 2.0.12
#### Code Refactoring
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
* @applitools/req bumped to 1.6.2
#### Code Refactoring
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
* @applitools/image bumped to 1.1.7
#### Bug Fixes
* avoid using ascii text decoder ([1b68d39](https://github.com/applitools/eyes.sdk.javascript1/commit/1b68d3945d96b17b9ab1f1a87d352206fd0c81d6))
#### Code Refactoring
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
## [1.9.5](https://github.com/applitools/eyes.sdk.javascript1/compare/js/ufg-client@1.9.4...js/ufg-client@1.9.5) (2023-10-09)

@@ -4,0 +46,0 @@

4

dist/client.js

@@ -7,3 +7,3 @@ "use strict";

const create_render_target_1 = require("./create-render-target");
const get_render_environment_1 = require("./get-render-environment");
const get_actual_environment_1 = require("./get-actual-environment");
const render_1 = require("./render");

@@ -37,4 +37,4 @@ const process_resources_1 = require("./resources/process-resources");

createRenderTarget: (0, create_render_target_1.makeCreateRenderTarget)({ processResources, logger }),
getRenderEnvironment: (0, get_render_environment_1.makeGetRenderEnvironment)({ requests, logger }),
render: (0, render_1.makeRender)({ requests, logger }),
getActualEnvironment: (0, get_actual_environment_1.makeGetActualEnvironment)({ requests, logger }),
getChromeEmulationDevices: requests.getChromeEmulationDevices,

@@ -41,0 +41,0 @@ getAndroidDevices: requests.getAndroidDevices,

@@ -54,3 +54,3 @@ "use strict";

...((_a = snapshot.resourceUrls) !== null && _a !== void 0 ? _a : []).map(url => {
return [url, (0, resource_1.makeResource)({ url, renderer: settings === null || settings === void 0 ? void 0 : settings.renderer })];
return [url, (0, resource_1.makeResource)({ url, environment: settings === null || settings === void 0 ? void 0 : settings.environment })];
}),

@@ -57,0 +57,0 @@ ...Object.entries((_b = snapshot.resourceContents) !== null && _b !== void 0 ? _b : {}).map(([url, resource]) => {

@@ -40,5 +40,5 @@ "use strict";

const renderWithConcurrency = utils.general.wrap(render, (render, options) => {
let throttle = throttles.get(options.settings.renderEnvironmentId);
let throttle = throttles.get(options.settings.environmentId);
if (!throttle)
throttles.set(options.settings.renderEnvironmentId, (throttle = (0, throat_1.default)(concurrency)));
throttles.set(options.settings.environmentId, (throttle = (0, throat_1.default)(concurrency)));
return throttle(render, options);

@@ -45,0 +45,0 @@ });

@@ -32,2 +32,3 @@ "use strict";

const resource_1 = require("./resource");
const buffer_1 = require("buffer");
const create_cookie_header_1 = require("../utils/create-cookie-header");

@@ -57,3 +58,3 @@ const create_user_agent_header_1 = require("../utils/create-user-agent-header");

...settings.headers,
'User-Agent': (_a = (resource.renderer && (0, create_user_agent_header_1.createUserAgentHeader)({ renderer: resource.renderer }))) !== null && _a !== void 0 ? _a : (_b = settings.headers) === null || _b === void 0 ? void 0 : _b['User-Agent'],
'User-Agent': (_a = (resource.environment && (0, create_user_agent_header_1.createUserAgentHeader)({ environment: resource.environment }))) !== null && _a !== void 0 ? _a : (_b = settings.headers) === null || _b === void 0 ? void 0 : _b['User-Agent'],
},

@@ -182,3 +183,3 @@ proxy: resourceUrl => {

try {
resolve({ response, body: Buffer.from(await response.arrayBuffer()) });
resolve({ response, body: buffer_1.Buffer.from(await response.arrayBuffer()) });
}

@@ -185,0 +186,0 @@ catch {

@@ -129,3 +129,3 @@ "use strict";

return [];
return (0, resource_1.makeResource)({ url: dependencyUrl, renderer: settings === null || settings === void 0 ? void 0 : settings.renderer });
return (0, resource_1.makeResource)({ url: dependencyUrl, environment: settings === null || settings === void 0 ? void 0 : settings.environment });
});

@@ -132,0 +132,0 @@ await Promise.all(dependencyResources.map(doProcessUrlResourceWithDependencies));

@@ -27,2 +27,3 @@ "use strict";

exports.makeHashedResource = exports.makeResource = void 0;
const buffer_1 = require("buffer");
const crypto_1 = require("crypto");

@@ -60,5 +61,5 @@ const utils = __importStar(require("@applitools/utils"));

};
if (resource.renderer && isRendererDependantResource(resource)) {
urlResource.renderer = resource.renderer;
urlResource.id += `~${extractRendererName(resource)}`;
if (resource.environment && isEnvironmentDependantResource(resource)) {
urlResource.environment = resource.environment;
urlResource.id += `~${extractEnvironmentName(resource)}`;
}

@@ -85,13 +86,13 @@ return urlResource;

}
function isRendererDependantResource({ url }) {
function isEnvironmentDependantResource({ url }) {
return /https:\/\/fonts.googleapis.com/.test(url);
}
function extractRendererName({ renderer }) {
if (!utils.types.has(renderer, 'name'))
function extractEnvironmentName({ environment }) {
if (!utils.types.has(environment, 'name'))
return;
const [browserName] = renderer.name.split(/[-\d]/, 1);
const [browserName] = environment.name.split(/[-\d]/, 1);
return browserName;
}
function getResourceValue(value) {
return value ? (utils.types.isString(value) ? Buffer.from(value, 'base64') : value) : new Uint8Array(0);
return value ? (utils.types.isString(value) ? buffer_1.Buffer.from(value, 'base64') : value) : new Uint8Array(0);
}

@@ -38,3 +38,2 @@ "use strict";

return {
getRenderEnvironments,
startRenders,

@@ -44,2 +43,3 @@ checkRenderResults,

checkResources,
getActualEnvironments,
getChromeEmulationDevices: getChromeEmulationDevicesWithCache,

@@ -49,34 +49,2 @@ getIOSDevices: getIOSDevicesWithCache,

};
async function getRenderEnvironments({ settings, logger = mainLogger, }) {
logger = logger.extend(mainLogger, { tags: [`get-render-environments-${utils.general.shortid()}`] });
logger.log('Request "getRenderEnvironments" called for with settings', settings);
const response = await req('./job-info', {
name: 'getRenderEnvironments',
method: 'POST',
body: settings.map(settings => {
const renderOptions = {
agentId: defaultAgentId,
webhook: '',
stitchingService: '',
...transformRenderEnvironmentSettings(settings),
};
renderOptions.renderInfo.target = 'viewport';
return renderOptions;
}),
expected: 200,
logger,
});
const results = await response.json().then((results) => {
return results.map((result, index) => {
var _a;
return {
renderEnvironmentId: utils.general.guid(),
renderer: (_a = settings[index]) === null || _a === void 0 ? void 0 : _a.renderer,
rawEnvironment: result.eyesEnvironment,
};
});
});
logger.log('Request "getRenderEnvironments" finished successfully with body', results);
return results;
}
async function startRenders({ requests, logger = mainLogger, }) {

@@ -103,5 +71,5 @@ logger = logger.extend(mainLogger, { tags: [`start-render-request-${utils.general.shortid()}`] });

enableMultipleResultsPerSelector: true,
...transformRenderEnvironmentSettings(settings),
...transformEnvironment(settings.environment),
};
if (utils.types.has(settings.renderer, 'type') && settings.renderer.type === 'native') {
if (utils.types.has(settings.environment, 'type') && settings.environment.type === 'native') {
renderOptions.renderInfo.vhsType = target.vhsType;

@@ -125,3 +93,3 @@ renderOptions.renderInfo.vhsCompatibilityParams = target.vhsCompatibilityParams;

//NOTE: at the moment scroll root is supported only for native devices
if (utils.types.has(settings.renderer, 'type') && settings.renderer.type === 'native') {
if (utils.types.has(settings.environment, 'type') && settings.environment.type === 'native') {
renderOptions.renderInfo.selector = settings.scrollRootElement;

@@ -227,2 +195,34 @@ }

}
async function getActualEnvironments({ settings, logger = mainLogger, }) {
logger = logger.extend(mainLogger, { tags: [`get-actual-environments-${utils.general.shortid()}`] });
logger.log('Request "getActualEnvironments" called for with settings', settings);
const response = await req('./job-info', {
name: 'getActualEnvironments',
method: 'POST',
body: settings.map(settings => {
const renderOptions = {
agentId: defaultAgentId,
webhook: '',
stitchingService: '',
...transformEnvironment(settings.environment),
};
renderOptions.renderInfo.target = 'viewport';
return renderOptions;
}),
expected: 200,
logger,
});
const results = await response.json().then((results) => {
return results.map((result, index) => {
var _a;
return {
requested: (_a = settings[index]) === null || _a === void 0 ? void 0 : _a.environment,
environmentId: utils.general.guid(),
rawEnvironment: result.eyesEnvironment,
};
});
});
logger.log('Request "getActualEnvironments" finished successfully with body', results);
return results;
}
async function getChromeEmulationDevices({ logger = mainLogger, } = {}) {

@@ -254,14 +254,14 @@ logger = logger.extend(mainLogger, { tags: [`ufg-request-${utils.general.shortid()}`] });

exports.makeUFGRequests = makeUFGRequests;
function transformRenderEnvironmentSettings(settings) {
function transformEnvironment(environment) {
var _a, _b;
if (utils.types.has(settings.renderer, ['width', 'height'])) {
if (utils.types.has(environment, ['width', 'height'])) {
return {
platform: { name: 'linux', type: 'web' },
browser: {
name: settings.renderer.name.replace(/(one|two)-versions?-back$/, (_, num) => (num === 'one' ? '1' : '2')),
name: environment.name.replace(/(one|two)-versions?-back$/, (_, num) => (num === 'one' ? '1' : '2')),
},
renderInfo: { width: settings.renderer.width, height: settings.renderer.height },
renderInfo: { width: environment.width, height: environment.height },
};
}
else if (utils.types.has(settings.renderer, 'chromeEmulationInfo')) {
else if (utils.types.has(environment, 'chromeEmulationInfo')) {
return {

@@ -272,4 +272,4 @@ platform: { name: 'linux', type: 'web' },

emulationInfo: {
deviceName: settings.renderer.chromeEmulationInfo.deviceName,
screenOrientation: settings.renderer.chromeEmulationInfo.screenOrientation,
deviceName: environment.chromeEmulationInfo.deviceName,
screenOrientation: environment.chromeEmulationInfo.screenOrientation,
},

@@ -279,11 +279,11 @@ },

}
else if (utils.types.has(settings.renderer, 'androidDeviceInfo')) {
else if (utils.types.has(environment, 'androidDeviceInfo')) {
return {
platform: { name: 'android', type: (_a = settings.renderer.type) !== null && _a !== void 0 ? _a : 'native' },
browser: settings.renderer.type === 'web' ? { name: 'chrome' } : undefined,
platform: { name: 'android', type: (_a = environment.type) !== null && _a !== void 0 ? _a : 'native' },
browser: environment.type === 'web' ? { name: 'chrome' } : undefined,
renderInfo: {
androidDeviceInfo: {
name: settings.renderer.androidDeviceInfo.deviceName,
version: settings.renderer.androidDeviceInfo.version,
screenOrientation: settings.renderer.androidDeviceInfo.screenOrientation,
name: environment.androidDeviceInfo.deviceName,
version: environment.androidDeviceInfo.version,
screenOrientation: environment.androidDeviceInfo.screenOrientation,
},

@@ -293,11 +293,11 @@ },

}
else if (utils.types.has(settings.renderer, 'iosDeviceInfo')) {
else if (utils.types.has(environment, 'iosDeviceInfo')) {
return {
platform: { name: 'ios', type: (_b = settings.renderer.type) !== null && _b !== void 0 ? _b : 'native' },
browser: settings.renderer.type === 'web' ? { name: 'safari' } : undefined,
platform: { name: 'ios', type: (_b = environment.type) !== null && _b !== void 0 ? _b : 'native' },
browser: environment.type === 'web' ? { name: 'safari' } : undefined,
renderInfo: {
iosDeviceInfo: {
name: settings.renderer.iosDeviceInfo.deviceName,
version: settings.renderer.iosDeviceInfo.version,
screenOrientation: settings.renderer.iosDeviceInfo.screenOrientation,
name: environment.iosDeviceInfo.deviceName,
version: environment.iosDeviceInfo.version,
screenOrientation: environment.iosDeviceInfo.screenOrientation,
},

@@ -304,0 +304,0 @@ },

@@ -37,5 +37,5 @@ "use strict";

};
function createUserAgentHeader({ renderer }) {
if (utils.types.has(renderer, 'name')) {
const [browserName] = renderer.name.split(/[-\d]/, 1);
function createUserAgentHeader({ environment }) {
if (utils.types.has(environment, 'name')) {
const [browserName] = environment.name.split(/[-\d]/, 1);
return userAgents[browserName];

@@ -42,0 +42,0 @@ }

@@ -27,3 +27,3 @@ "use strict";

exports.extractSvgDependencyUrls = void 0;
const jsdom_1 = require("jsdom");
const xmldom_1 = require("@xmldom/xmldom");
const extract_css_dependency_urls_1 = require("./extract-css-dependency-urls");

@@ -33,26 +33,32 @@ const utils = __importStar(require("@applitools/utils"));

const urls = new Set();
const doc = typeof DOMParser === 'function'
? new DOMParser().parseFromString(svg, 'image/svg+xml')
: new jsdom_1.JSDOM(svg).window.document;
Array.from(doc.querySelectorAll('img[srcset]')).forEach(element => {
const sources = element.getAttribute('srcset').split(', ');
sources.forEach(source => urls.add(sanitizeUrl(source.trim().split(/\s+/, 1)[0], { baseUrl: resourceUrl })));
const doc = new xmldom_1.DOMParser().parseFromString(svg, 'image/svg+xml');
Array.from(doc.getElementsByTagName('*')).forEach(element => {
const tagName = element.tagName.toUpperCase();
if (tagName === 'IMG') {
if (element.hasAttribute('src')) {
urls.add(sanitizeUrl(element.getAttribute('src'), { baseUrl: resourceUrl }));
}
if (element.hasAttribute('srcset')) {
const sources = element.getAttribute('srcset').split(', ');
sources.forEach(source => urls.add(sanitizeUrl(source.trim().split(/\s+/, 1)[0], { baseUrl: resourceUrl })));
}
}
else if (tagName === 'IMAGE' ||
tagName === 'USE' ||
(tagName === 'LINK' && element.getAttribute('rel') === 'stylesheet')) {
const href = (element.getAttribute('href') || element.getAttribute('xlink:href'));
urls.add(sanitizeUrl(href, { baseUrl: resourceUrl }));
}
else if (tagName === 'OBJECT') {
urls.add(sanitizeUrl(element.getAttribute('data'), { baseUrl: resourceUrl }));
}
else if (tagName === 'STYLE') {
const cssUrls = element.textContent ? (0, extract_css_dependency_urls_1.extractCssDependencyUrls)(element.textContent, { resourceUrl, sourceUrl }) : [];
cssUrls.forEach(url => urls.add(url));
}
if (element.hasAttribute('style')) {
const matches = element.getAttribute('style').matchAll(/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/g);
Array.from(matches).forEach(([, url]) => urls.add(sanitizeUrl(url, { baseUrl: resourceUrl })));
}
});
Array.from(doc.querySelectorAll('img[src]')).forEach(element => {
urls.add(sanitizeUrl(element.getAttribute('src'), { baseUrl: resourceUrl }));
});
Array.from(doc.querySelectorAll('image,use,link[rel="stylesheet"]')).forEach(element => {
urls.add(sanitizeUrl(element.getAttribute('href') || element.getAttribute('xlink:href'), { baseUrl: resourceUrl }));
});
Array.from(doc.getElementsByTagName('object')).forEach(element => {
urls.add(sanitizeUrl(element.getAttribute('data'), { baseUrl: resourceUrl }));
});
Array.from(doc.querySelectorAll('style')).forEach(element => {
const cssUrls = element.textContent ? (0, extract_css_dependency_urls_1.extractCssDependencyUrls)(element.textContent, { resourceUrl, sourceUrl }) : [];
cssUrls.forEach(url => urls.add(url));
});
Array.from(doc.querySelectorAll('*[style]')).forEach(element => {
const matches = element.style.cssText.matchAll(/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/g);
Array.from(matches).forEach(([, url]) => urls.add(sanitizeUrl(url, { baseUrl: resourceUrl })));
});
return [...urls];

@@ -59,0 +65,0 @@ }

{
"name": "@applitools/ufg-client",
"version": "1.9.5",
"version": "1.9.6",
"homepage": "https://applitools.com",

@@ -43,9 +43,9 @@ "bugs": {

"dependencies": {
"@applitools/image": "1.1.6",
"@applitools/logger": "2.0.11",
"@applitools/req": "1.6.1",
"@applitools/utils": "1.6.1",
"@applitools/image": "1.1.7",
"@applitools/logger": "2.0.12",
"@applitools/req": "1.6.2",
"@applitools/utils": "1.6.2",
"@xmldom/xmldom": "0.8.10",
"abort-controller": "3.0.0",
"css-tree": "2.3.1",
"jsdom": "19.0.0",
"throat": "6.0.2"

@@ -57,3 +57,2 @@ },

"@types/css-tree": "^2.3.1",
"@types/jsdom": "^21.1.1",
"@types/node": "^12.20.55",

@@ -60,0 +59,0 @@ "nock": "^13.3.2"

@@ -1,2 +0,2 @@

import type { Renderer, AsyncCache } from '../types';
import type { Environment, AsyncCache } from '../types';
import { type UrlResource, type ContentfulResource, type HashedResource, type KnownResource, type FailedResource } from './resource';

@@ -25,3 +25,3 @@ import { type Logger } from '@applitools/logger';

export type ProcessResourcesSettings = FetchResourceSettings & {
renderer?: Renderer;
environment?: Environment;
};

@@ -28,0 +28,0 @@ export type ResourceMapping = Record<string, HashedResource | {

import type { Optional } from '@applitools/utils';
import type { Renderer } from '../types';
import type { Environment } from '../types';
export type KnownResource = {

@@ -34,3 +34,3 @@ hash: HashedResource | {

url: string;
renderer?: Renderer;
environment?: Environment;
};

@@ -37,0 +37,0 @@ export type HashedResource = {

@@ -1,2 +0,2 @@

import type { UFGServerSettings, RenderTarget, RenderEnvironmentSettings, RenderEnvironment, RenderSettings, RenderResult } from '../types';
import type { UFGServerSettings, RenderTarget, GetActualEnvironmentSettings, ActualEnvironment, RenderSettings, RenderResult } from '../types';
import { type ContentfulResource } from '../resources/resource';

@@ -14,6 +14,2 @@ import { type Logger } from '@applitools/logger';

export interface UFGRequests {
getRenderEnvironments(options: {
settings: RenderEnvironmentSettings[];
logger?: Logger;
}): Promise<RenderEnvironment[]>;
startRenders(options: {

@@ -35,2 +31,6 @@ requests: RenderRequest[];

}): Promise<(boolean | null)[]>;
getActualEnvironments(options: {
settings: GetActualEnvironmentSettings[];
logger?: Logger;
}): Promise<ActualEnvironment[]>;
getChromeEmulationDevices(options?: {

@@ -37,0 +37,0 @@ logger?: Logger;

@@ -5,3 +5,3 @@ import type { Location, Size, Region } from '@applitools/utils';

import { type AbortSignal } from 'abort-controller';
import type { HashedResource, KnownResource } from './resources/resource';
import { type HashedResource, type KnownResource } from './resources/resource';
export interface UFGClient {

@@ -13,6 +13,2 @@ createRenderTarget(options: {

}): Promise<RenderTarget>;
getRenderEnvironment(options: {
settings: RenderEnvironmentSettings;
logger?: Logger;
}): Promise<RenderEnvironment>;
render(options: {

@@ -24,2 +20,6 @@ target: RenderTarget;

}): Promise<RenderResult>;
getActualEnvironment(options: {
settings: GetActualEnvironmentSettings;
logger?: Logger;
}): Promise<ActualEnvironment>;
getChromeEmulationDevices(options?: {

@@ -56,3 +56,3 @@ logger?: Logger;

}
export interface DesktopBrowserRenderer {
export interface DesktopBrowserEnvironment {
name?: 'chrome' | 'chrome-one-version-back' | 'chrome-two-versions-back' | 'firefox' | 'firefox-one-version-back' | 'firefox-two-versions-back' | 'ie' | 'ie10' | 'edge' | 'edgechromium' | 'edgelegacy' | 'edgechromium-one-version-back' | 'edgechromium-two-versions-back' | 'safari' | 'safari-earlyaccess' | 'safari-one-version-back' | 'safari-two-versions-back';

@@ -62,3 +62,3 @@ width: number;

}
export interface ChromeEmulationDeviceRenderer {
export interface ChromeEmulationDeviceEnvironment {
chromeEmulationInfo: {

@@ -69,3 +69,3 @@ deviceName: 'Blackberry PlayBook' | 'BlackBerry Z30' | 'Galaxy A5' | 'Galaxy Note 10' | 'Galaxy Note 10 Plus' | 'Galaxy Note 2' | 'Galaxy Note 3' | 'Galaxy Note 4' | 'Galaxy Note 8' | 'Galaxy Note 9' | 'Galaxy S3' | 'Galaxy S5' | 'Galaxy S8' | 'Galaxy S8 Plus' | 'Galaxy S9' | 'Galaxy S9 Plus' | 'Galaxy S10' | 'Galaxy S10 Plus' | 'Galaxy S20' | 'Galaxy S21' | 'Galaxy S21 Ultra' | 'Galaxy S22' | 'Galaxy S22 Ultra' | 'Galaxy Tab S7' | 'iPad' | 'iPad 6th Gen' | 'iPad 7th Gen' | 'iPad Air 2' | 'iPad Mini' | 'iPad Pro' | 'iPhone 11' | 'iPhone 11 Pro' | 'iPhone 11 Pro Max' | 'iPhone 4' | 'iPhone 5/SE' | 'iPhone 6/7/8' | 'iPhone 6/7/8 Plus' | 'iPhone X' | 'iPhone XR' | 'iPhone XS' | 'iPhone XS Max' | 'Kindle Fire HDX' | 'Laptop with HiDPI screen' | 'Laptop with MDPI screen' | 'Laptop with touch' | 'LG G6' | 'LG Optimus L70' | 'Microsoft Lumia 550' | 'Microsoft Lumia 950' | 'Nexus 10' | 'Nexus 4' | 'Nexus 5' | 'Nexus 5X' | 'Nexus 6' | 'Nexus 6P' | 'Nexus 7' | 'Nokia Lumia 520' | 'Nokia N9' | 'OnePlus 7T' | 'OnePlus 7T Pro' | 'Pixel 2' | 'Pixel 2 XL' | 'Pixel 3' | 'Pixel 3 XL' | 'Pixel 4' | 'Pixel 4 XL' | 'Pixel 5' | 'Sony Xperia 10 II' | 'Huawei Mate 50 Pro' | 'Huawei Matepad 11';

}
export interface IOSDeviceRenderer {
export interface IOSDeviceEnvironment {
iosDeviceInfo: {

@@ -77,3 +77,3 @@ deviceName: 'iPhone 14 Pro Max' | 'iPhone 14' | 'iPhone 13 Pro Max' | 'iPhone 13 Pro' | 'iPhone 13' | 'iPhone 12 Pro Max' | 'iPhone 12 Pro' | 'iPhone 12' | 'iPhone 12 mini' | 'iPhone 11 Pro' | 'iPhone 11 Pro Max' | 'iPhone 11' | 'iPhone XR' | 'iPhone Xs' | 'iPhone X' | 'iPhone 8' | 'iPhone 8 Plus' | 'iPhone 7' | 'iPhone SE (1st generation)' | 'iPad Pro (12.9-inch) (3rd generation)' | 'iPad Pro (11-inch) (4th generation)' | 'iPad (7th generation)' | 'iPad (9th generation)' | 'iPad Air (2nd generation)' | 'iPad Air (4th generation)';

}
export interface AndroidDeviceRenderer {
export interface AndroidDeviceEnvironment {
androidDeviceInfo: {

@@ -85,12 +85,12 @@ deviceName: 'Pixel 3 XL' | 'Pixel 4' | 'Pixel 4 XL' | 'Pixel 5' | 'Pixel 6' | 'Galaxy S10' | 'Galaxy S10 Plus' | 'Galaxy Note 10' | 'Galaxy Note 10 Plus' | 'Galaxy S20' | 'Galaxy S20 Plus' | 'Galaxy S21' | 'Galaxy S21 Plus' | 'Galaxy S21 Ultra' | 'Galaxy S22' | 'Galaxy S22 Plus' | 'Galaxy Tab S7' | 'Galaxy Tab S8' | 'Xiaomi Redmi Note 10 JE' | 'Xiaomi Redmi Note 11' | 'Xiaomi Redmi Note 11 Pro' | 'Sony Xperia 1 II' | 'Sony Xperia 10 II' | 'Sony Xperia Ace II' | 'Huawei P30 Lite';

}
export type MobileDeviceRenderer = (IOSDeviceRenderer | AndroidDeviceRenderer) & {
export type MobileDeviceEnvironment = (IOSDeviceEnvironment | AndroidDeviceEnvironment) & {
type?: 'web' | 'native';
};
export type Renderer = (DesktopBrowserRenderer | ChromeEmulationDeviceRenderer | MobileDeviceRenderer) & {
export type Environment = (DesktopBrowserEnvironment | ChromeEmulationDeviceEnvironment | MobileDeviceEnvironment) & {
/**
* The id of the renderer
* Used to identify the renderer if the same renderer is used multiple times
* The id of the environment
* Used to identify the environment if the same environment is used multiple times
* @internal
**/
id?: string;
environmentId?: string;
};

@@ -141,3 +141,3 @@ export interface Cookie {

export interface RenderTargetSettings {
renderer?: Renderer;
environment?: Environment;
proxy?: Proxy;

@@ -160,8 +160,8 @@ autProxy?: Proxy & {

}
export interface RenderEnvironmentSettings {
renderer: Renderer;
export interface GetActualEnvironmentSettings {
environment: Environment;
}
export interface RenderEnvironment {
renderEnvironmentId: string;
renderer: Renderer;
export interface ActualEnvironment {
requested: Environment;
environmentId: string;
rawEnvironment: Record<string, any>;

@@ -175,4 +175,5 @@ }

};
export interface RenderSettings extends RenderEnvironmentSettings {
renderEnvironmentId: string;
export interface RenderSettings {
environmentId: string;
environment: Environment;
uploadUrl: string;

@@ -179,0 +180,0 @@ stitchingServiceUrl: string;

@@ -1,4 +0,4 @@

import type { Renderer } from '../types';
export declare function createUserAgentHeader({ renderer }: {
renderer: Renderer;
import type { Environment } from '../types';
export declare function createUserAgentHeader({ environment }: {
environment: Environment;
}): string | undefined;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc